From 33393f592a46b90790bf0f425dab29e740840045 Mon Sep 17 00:00:00 2001 From: Foo Bar Date: Sun, 29 Jan 2023 22:59:24 -0700 Subject: [PATCH] [wip] jex and thinking about model thing on the jr thing" --- jrx/src/model/model.ts | 40 ++++++++++++++++++++++++++++++++++++++++ utils/jex/src/jex.erl | 5 ++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 jrx/src/model/model.ts diff --git a/jrx/src/model/model.ts b/jrx/src/model/model.ts new file mode 100644 index 0000000..8a1048f --- /dev/null +++ b/jrx/src/model/model.ts @@ -0,0 +1,40 @@ +/* idea: versioned state + * + * there is a version 0 state + * + * each state migration contains a migration from the previous version to the + * new version + * + * laws: + * + * - all version N states must map to valid version N+1 states + * + */ + +export { + jr_version, + jr_state +}; + +let jr_version = 0; + +/** + * current state type for current version + */ +type jr_state = jr_0_state; + +/** + * All jr state types, historically + */ +type jr_n_state + = jr_0_state; + +/** + * This is the version 0 state + */ +type jr_0_state + = {version : 0, + keypair : keypair}; + +type keypair + = {secretKey: Uint8Array diff --git a/utils/jex/src/jex.erl b/utils/jex/src/jex.erl index 61c1a2f..5ae4049 100644 --- a/utils/jex/src/jex.erl +++ b/utils/jex/src/jex.erl @@ -357,7 +357,10 @@ pkg_tmpdir(PkgName) -> -spec pkg_type() -> Result when Result :: {ok, PkgType} | {error, Reason :: term()}, - PkgType :: library | external | extension. + PkgType :: library + | external + | extension + | website. pkg_type() -> % cfg errors if package type is invalid