@asturiu/v0-sdk 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +82 -2
- package/contract/assertion-vectors.json +90 -0
- package/contract/schemas/branding.schema.json +46 -0
- package/contract/schemas/definitions.schema.json +376 -0
- package/contract/schemas/portal.schema.json +56 -0
- package/contract/tenant-api-routes.json +165 -0
- package/dist/branding.d.ts +131 -0
- package/dist/branding.d.ts.map +1 -0
- package/dist/branding.js +206 -0
- package/dist/branding.js.map +1 -0
- package/dist/changesets.d.ts +58 -0
- package/dist/changesets.d.ts.map +1 -0
- package/dist/changesets.js +18 -0
- package/dist/changesets.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +12 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/changesets.d.ts +14 -0
- package/dist/cli/changesets.d.ts.map +1 -0
- package/dist/cli/changesets.js +252 -0
- package/dist/cli/changesets.js.map +1 -0
- package/dist/cli/cli.d.ts +37 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +415 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/context.d.ts +147 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +258 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/engine.d.ts +59 -0
- package/dist/cli/engine.d.ts.map +1 -0
- package/dist/cli/engine.js +85 -0
- package/dist/cli/engine.js.map +1 -0
- package/dist/cli/feedback.d.ts +40 -0
- package/dist/cli/feedback.d.ts.map +1 -0
- package/dist/cli/feedback.js +420 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/files.d.ts +83 -0
- package/dist/cli/files.d.ts.map +1 -0
- package/dist/cli/files.js +389 -0
- package/dist/cli/files.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/overview.d.ts +6 -0
- package/dist/cli/overview.d.ts.map +1 -0
- package/dist/cli/overview.js +379 -0
- package/dist/cli/overview.js.map +1 -0
- package/dist/cli/parts.d.ts +5 -0
- package/dist/cli/parts.d.ts.map +1 -0
- package/dist/cli/parts.js +414 -0
- package/dist/cli/parts.js.map +1 -0
- package/dist/cli/sources.d.ts +37 -0
- package/dist/cli/sources.d.ts.map +1 -0
- package/dist/cli/sources.js +91 -0
- package/dist/cli/sources.js.map +1 -0
- package/dist/cli/terminal.d.ts +135 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +353 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/ui-page.d.ts +8 -0
- package/dist/cli/ui-page.d.ts.map +1 -0
- package/dist/cli/ui-page.js +216 -0
- package/dist/cli/ui-page.js.map +1 -0
- package/dist/cli/ui.d.ts +54 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +251 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/client.d.ts +88 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +165 -0
- package/dist/client.js.map +1 -0
- package/dist/contacts.d.ts +43 -0
- package/dist/contacts.d.ts.map +1 -0
- package/dist/contacts.js +46 -0
- package/dist/contacts.js.map +1 -0
- package/dist/definition-set.d.ts +731 -0
- package/dist/definition-set.d.ts.map +1 -0
- package/dist/definition-set.js +659 -0
- package/dist/definition-set.js.map +1 -0
- package/dist/definitions.d.ts +42 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +154 -0
- package/dist/definitions.js.map +1 -0
- package/dist/enrolment.d.ts +9 -0
- package/dist/enrolment.d.ts.map +1 -0
- package/dist/enrolment.js +8 -0
- package/dist/enrolment.js.map +1 -0
- package/dist/fill.d.ts +73 -0
- package/dist/fill.d.ts.map +1 -0
- package/dist/fill.js +46 -0
- package/dist/fill.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/notifications.d.ts +33 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +36 -0
- package/dist/notifications.js.map +1 -0
- package/dist/oidc.d.ts +122 -0
- package/dist/oidc.d.ts.map +1 -0
- package/dist/oidc.js +150 -0
- package/dist/oidc.js.map +1 -0
- package/dist/overlay.d.ts +109 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +58 -0
- package/dist/overlay.js.map +1 -0
- package/dist/passes.d.ts +95 -0
- package/dist/passes.d.ts.map +1 -0
- package/dist/passes.js +140 -0
- package/dist/passes.js.map +1 -0
- package/dist/portal-options.d.ts +65 -0
- package/dist/portal-options.d.ts.map +1 -0
- package/dist/portal-options.js +120 -0
- package/dist/portal-options.js.map +1 -0
- package/dist/reads.d.ts +41 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +44 -0
- package/dist/reads.js.map +1 -0
- package/dist/recovery-words.d.ts +8 -0
- package/dist/recovery-words.d.ts.map +1 -0
- package/dist/recovery-words.js +136 -0
- package/dist/recovery-words.js.map +1 -0
- package/dist/recovery.d.ts +198 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +112 -0
- package/dist/recovery.js.map +1 -0
- package/dist/reveal.d.ts +35 -0
- package/dist/reveal.d.ts.map +1 -0
- package/dist/reveal.js +66 -0
- package/dist/reveal.js.map +1 -0
- package/dist/seal.d.ts +15 -0
- package/dist/seal.d.ts.map +1 -0
- package/dist/seal.js +0 -0
- package/dist/seal.js.map +1 -0
- package/dist/session.d.ts +66 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +61 -0
- package/dist/session.js.map +1 -0
- package/dist/signing-in-mark.d.ts +14 -0
- package/dist/signing-in-mark.d.ts.map +1 -0
- package/dist/signing-in-mark.js +24 -0
- package/dist/signing-in-mark.js.map +1 -0
- package/dist/signing-in.d.ts +22 -0
- package/dist/signing-in.d.ts.map +1 -0
- package/dist/signing-in.js +203 -0
- package/dist/signing-in.js.map +1 -0
- package/dist/tags.d.ts +96 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/tags.js +88 -0
- package/dist/tags.js.map +1 -0
- package/dist/tenant-subscription.d.ts +47 -0
- package/dist/tenant-subscription.d.ts.map +1 -0
- package/dist/tenant-subscription.js +7 -0
- package/dist/tenant-subscription.js.map +1 -0
- package/dist/testing/index.d.ts +125 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +320 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/theme.d.ts +237 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +504 -0
- package/dist/theme.js.map +1 -0
- package/dist/tickets.d.ts +152 -0
- package/dist/tickets.d.ts.map +1 -0
- package/dist/tickets.js +65 -0
- package/dist/tickets.js.map +1 -0
- package/dist/tiers.d.ts +168 -0
- package/dist/tiers.d.ts.map +1 -0
- package/dist/tiers.js +341 -0
- package/dist/tiers.js.map +1 -0
- package/dist/types.d.ts +885 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/urlid.d.ts +50 -0
- package/dist/urlid.d.ts.map +1 -0
- package/dist/urlid.js +78 -0
- package/dist/urlid.js.map +1 -0
- package/dist/version.d.ts +15 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/make/asturiu.mk +43 -0
- package/package.json +63 -4
- package/src/branding.ts +221 -0
- package/src/changesets.ts +61 -0
- package/src/cli/bin.ts +12 -0
- package/src/cli/changesets.ts +233 -0
- package/src/cli/cli.ts +425 -0
- package/src/cli/context.ts +299 -0
- package/src/cli/engine.ts +112 -0
- package/src/cli/feedback.ts +406 -0
- package/src/cli/files.ts +371 -0
- package/src/cli/index.ts +7 -0
- package/src/cli/overview.ts +343 -0
- package/src/cli/parts.ts +371 -0
- package/src/cli/sources.ts +111 -0
- package/src/cli/terminal.ts +384 -0
- package/src/cli/ui-page.ts +215 -0
- package/src/cli/ui.ts +266 -0
- package/src/client.ts +202 -0
- package/src/contacts.ts +61 -0
- package/src/definition-set.ts +965 -0
- package/src/definitions.ts +156 -0
- package/src/enrolment.ts +10 -0
- package/src/fill.ts +83 -0
- package/src/index.ts +38 -0
- package/src/notifications.ts +55 -0
- package/src/oidc.ts +199 -0
- package/src/overlay.ts +137 -0
- package/src/passes.ts +168 -0
- package/src/portal-options.ts +125 -0
- package/src/reads.ts +71 -0
- package/src/recovery-words.ts +137 -0
- package/src/recovery.ts +269 -0
- package/src/reveal.ts +72 -0
- package/src/seal.ts +0 -0
- package/src/session.ts +93 -0
- package/src/signing-in-mark.ts +23 -0
- package/src/signing-in.ts +213 -0
- package/src/tags.ts +146 -0
- package/src/tenant-subscription.ts +44 -0
- package/src/testing/index.ts +337 -0
- package/src/theme.ts +628 -0
- package/src/tickets.ts +195 -0
- package/src/tiers.ts +397 -0
- package/src/types.ts +847 -0
- package/src/urlid.ts +77 -0
- package/src/version.ts +15 -0
- package/templates/asturiu/branding.json +4 -0
- package/templates/asturiu/definitions.json +23 -0
- package/templates/asturiu/portal.json +16 -0
package/src/urlid.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ARID type tokens (ADR-008). The Engine's `arid` module keeps the same
|
|
3
|
+
* list; a test there fails when they differ.
|
|
4
|
+
*/
|
|
5
|
+
export const ARID_TYPE_TOKENS = ["tnt", "usr", "cst", "vlt", "prn", "grp", "pfl", "wlt", "ent", "fld", "att", "wdf", "edf", "fdf", "grt", "trg", "evt", "ntf", "rcv", "trf", "cnt", "msg", "ovl", "pss", "tkt", "sbs"] as const;
|
|
6
|
+
/** The type token a route fixes (ADR-008). */
|
|
7
|
+
export type ResourceType = (typeof ARID_TYPE_TOKENS)[number];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The URL spelling of an ARID (components/02 §Resource URLs).
|
|
11
|
+
*
|
|
12
|
+
* A browser URL names a resource by its `ResourceID` alone when the Issuer is
|
|
13
|
+
* `global`, and by `<issuer>~<ResourceID>` otherwise:
|
|
14
|
+
*
|
|
15
|
+
* /wallets/01M25QTXZNCXBE3DCYZQWAMB72 ARID:0:global:wlt:01M25Q…
|
|
16
|
+
* /wallets/device-a~01M25QTXZNCXBE3DCYZQWAMB72 ARID:0:device-a:wlt:01M25Q…
|
|
17
|
+
*
|
|
18
|
+
* This is a *rendering* of the ARID, never an identifier of its own: the route
|
|
19
|
+
* fixes the type, the form fixes the ARID version, and the page rebuilds the
|
|
20
|
+
* full ARID before anything else sees it. Four rules keep that safe:
|
|
21
|
+
*
|
|
22
|
+
* 1. One route family per resource type. A route that could show two types
|
|
23
|
+
* cannot rebuild the ARID.
|
|
24
|
+
* 2. URL forms are added, never retired. A later ARID version gets its own
|
|
25
|
+
* form; every form ever linked keeps resolving.
|
|
26
|
+
* 3. Only a browser URL ever carries this form. Nothing stores, logs, HMACs or
|
|
27
|
+
* emits it — those carry the ARID. No Engine component imports this file,
|
|
28
|
+
* with one exception (ADR-048): a link to a frontend page that the Engine
|
|
29
|
+
* sends to a person — today only the Operations API's approval link of a
|
|
30
|
+
* waiting Definition plan. A new case needs an ADR.
|
|
31
|
+
* 4. A route that moves keeps a redirect from the old path.
|
|
32
|
+
*
|
|
33
|
+
* `~` is an RFC 3986 unreserved character that neither the Issuer grammar
|
|
34
|
+
* (`[a-z0-9-]`) nor a ULID (uppercase Crockford base32) contains, so the form
|
|
35
|
+
* needs no percent-encoding and parses without lookahead. The grammar is
|
|
36
|
+
* repeated here rather than imported: the Frontend kit must stay free of
|
|
37
|
+
* `node:` imports (ADR-013), and `../arid.js` pulls in `node:crypto`.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/** The Issuer a bare `ResourceID` stands for. Fixed, not per deployment: a link must mean the same thing everywhere. */
|
|
41
|
+
export const URL_DEFAULT_ISSUER = "global";
|
|
42
|
+
const URL_ISSUER_SEPARATOR = "~";
|
|
43
|
+
const ARID_VERSION = "0";
|
|
44
|
+
const ISSUER_REGEX = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
45
|
+
const ULID_REGEX = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
46
|
+
const TYPE_REGEX = /^[a-z]{3}$/;
|
|
47
|
+
|
|
48
|
+
/** The URL segment for an ARID. Throws on a malformed ARID: only a value the Engine issued belongs in a link. */
|
|
49
|
+
export function aridToUrlId(arid: string): string {
|
|
50
|
+
const parts = arid.split(":");
|
|
51
|
+
if (parts.length !== 5 || parts[0] !== "ARID" || parts[1] !== ARID_VERSION) throw new Error("malformed ARID");
|
|
52
|
+
const [, , issuer, , id] = parts;
|
|
53
|
+
if (!ISSUER_REGEX.test(issuer) || !ULID_REGEX.test(id)) throw new Error("malformed ARID");
|
|
54
|
+
return issuer === URL_DEFAULT_ISSUER ? id : `${issuer}${URL_ISSUER_SEPARATOR}${id}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The ARID a route segment names, for the type the route fixes. Accepts the
|
|
59
|
+
* canonical form, a lower-cased `ResourceID` (Crockford base32 is
|
|
60
|
+
* case-insensitive) and a full ARID of the same type; `null` for anything
|
|
61
|
+
* else. Compare the segment with `aridToUrlId(result)` to decide whether to
|
|
62
|
+
* redirect to the canonical spelling.
|
|
63
|
+
*/
|
|
64
|
+
export function aridFromUrlId(type: ResourceType, segment: string): string | null {
|
|
65
|
+
if (!TYPE_REGEX.test(type)) return null;
|
|
66
|
+
if (segment.startsWith("ARID:")) {
|
|
67
|
+
const parts = segment.split(":");
|
|
68
|
+
if (parts.length !== 5 || parts[1] !== ARID_VERSION || parts[3] !== type) return null;
|
|
69
|
+
if (!ISSUER_REGEX.test(parts[2]) || !ULID_REGEX.test(parts[4])) return null;
|
|
70
|
+
return segment;
|
|
71
|
+
}
|
|
72
|
+
const at = segment.indexOf(URL_ISSUER_SEPARATOR);
|
|
73
|
+
const issuer = at < 0 ? URL_DEFAULT_ISSUER : segment.slice(0, at);
|
|
74
|
+
const id = (at < 0 ? segment : segment.slice(at + 1)).toUpperCase();
|
|
75
|
+
if (!ISSUER_REGEX.test(issuer) || !ULID_REGEX.test(id)) return null;
|
|
76
|
+
return `ARID:${ARID_VERSION}:${issuer}:${type}:${id}`;
|
|
77
|
+
}
|
package/src/version.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SDK's own version (ADR-074 §4): a semantic version of its own, separate
|
|
3
|
+
* from the Engine's. A test checks it against `package.json`. The Asturiu
|
|
4
|
+
* generation is in the name, never in the number.
|
|
5
|
+
*/
|
|
6
|
+
export const SDK_NAME = "@asturiu/v0-sdk";
|
|
7
|
+
export const SDK_VERSION = "1.0.0";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* What every Tenant API call sends as its `User-Agent`. The Tenant API
|
|
11
|
+
* forwards the version as `X-Asturiu-Sdk-Version`, and the Engine records it
|
|
12
|
+
* on the key as `last_sdk_version`: how an administrator sees what a
|
|
13
|
+
* Tenant's server runs.
|
|
14
|
+
*/
|
|
15
|
+
export const SDK_USER_AGENT = `asturiu-v0-sdk/${SDK_VERSION}`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "The Definition set: what your Customers keep, as Wallet types with the Entry types they own, and Entry types with their fields (ADR-029, ADR-031). Keys are permanent; labels are what people see. Make it your own, then check it with `asturiu-v0-tenant definitions`.",
|
|
3
|
+
"shared_fields": {
|
|
4
|
+
"title": { "label": "Title", "value_type": "text", "searchable": true },
|
|
5
|
+
"notes": { "label": "Notes", "value_type": "text" }
|
|
6
|
+
},
|
|
7
|
+
"wallets": {
|
|
8
|
+
"documents": {
|
|
9
|
+
"label": "Documents",
|
|
10
|
+
"entries": {
|
|
11
|
+
"document": {
|
|
12
|
+
"label": "Document",
|
|
13
|
+
"fields": {
|
|
14
|
+
"title": { "use": "title", "required": true, "order": 0 },
|
|
15
|
+
"issued_on": { "label": "Issued on", "value_type": "date", "order": 1 },
|
|
16
|
+
"file": { "label": "File", "value_type": "attachment", "order": 2 },
|
|
17
|
+
"notes": { "use": "notes", "order": 3 }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "What your Customer Portal shows (ADR-037, ADR-039). A switch left out is on; a page left out is back to its default. Redirects stay with an administrator.",
|
|
3
|
+
"account_link": true,
|
|
4
|
+
"open_app": true,
|
|
5
|
+
"back_link": true,
|
|
6
|
+
"language_menu": true,
|
|
7
|
+
"appearance": true,
|
|
8
|
+
"pages": {
|
|
9
|
+
"profile": { "mode": "portal" },
|
|
10
|
+
"security": { "mode": "portal" },
|
|
11
|
+
"plan": { "mode": "portal" },
|
|
12
|
+
"privacy": { "mode": "portal" },
|
|
13
|
+
"recovery": { "mode": "portal" },
|
|
14
|
+
"support": { "mode": "portal" }
|
|
15
|
+
}
|
|
16
|
+
}
|