@kashscript/lexicons 0.1.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/LICENSE +199 -0
- package/README.md +73 -0
- package/dist/engine.d.ts +48 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +110 -0
- package/dist/engine.js.map +1 -0
- package/dist/envelope.d.ts +59 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +43 -0
- package/dist/envelope.js.map +1 -0
- package/dist/extensions/social.d.ts +82 -0
- package/dist/extensions/social.d.ts.map +1 -0
- package/dist/extensions/social.js +99 -0
- package/dist/extensions/social.js.map +1 -0
- package/dist/extensions/trade.d.ts +94 -0
- package/dist/extensions/trade.d.ts.map +1 -0
- package/dist/extensions/trade.js +116 -0
- package/dist/extensions/trade.js.map +1 -0
- package/dist/extensions/zkp.d.ts +76 -0
- package/dist/extensions/zkp.d.ts.map +1 -0
- package/dist/extensions/zkp.js +68 -0
- package/dist/extensions/zkp.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema.d.ts +18 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +125 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/lexicons/index.d.ts +32 -0
- package/dist/lexicons/index.d.ts.map +1 -0
- package/dist/lexicons/index.js +59 -0
- package/dist/lexicons/index.js.map +1 -0
- package/dist/lexicons/kash-id-audit.d.ts +32 -0
- package/dist/lexicons/kash-id-audit.d.ts.map +1 -0
- package/dist/lexicons/kash-id-audit.js +21 -0
- package/dist/lexicons/kash-id-audit.js.map +1 -0
- package/dist/lexicons/kash-id-preferences.d.ts +60 -0
- package/dist/lexicons/kash-id-preferences.d.ts.map +1 -0
- package/dist/lexicons/kash-id-preferences.js +43 -0
- package/dist/lexicons/kash-id-preferences.js.map +1 -0
- package/dist/lexicons/kash-id-profile.d.ts +46 -0
- package/dist/lexicons/kash-id-profile.d.ts.map +1 -0
- package/dist/lexicons/kash-id-profile.js +31 -0
- package/dist/lexicons/kash-id-profile.js.map +1 -0
- package/dist/registry.d.ts +78 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +133 -0
- package/dist/registry.js.map +1 -0
- package/dist/schema.d.ts +101 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +224 -0
- package/dist/schema.js.map +1 -0
- package/dist/semver.d.ts +29 -0
- package/dist/semver.d.ts.map +1 -0
- package/dist/semver.js +42 -0
- package/dist/semver.js.map +1 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +80 -0
- package/src/engine.ts +141 -0
- package/src/envelope.ts +128 -0
- package/src/extensions/social.ts +179 -0
- package/src/extensions/trade.ts +210 -0
- package/src/extensions/zkp.ts +108 -0
- package/src/index.ts +30 -0
- package/src/json-schema.ts +141 -0
- package/src/lexicons/index.ts +68 -0
- package/src/lexicons/kash-id-audit.ts +61 -0
- package/src/lexicons/kash-id-preferences.ts +114 -0
- package/src/lexicons/kash-id-profile.ts +82 -0
- package/src/registry.ts +168 -0
- package/src/schema.ts +347 -0
- package/src/semver.ts +56 -0
- package/src/types.ts +27 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a `Schema` (the internal DSL) to a JSON-Schema Draft 2020-12 object.
|
|
3
|
+
*
|
|
4
|
+
* Output is intended for consumption by external AI tools and documentation
|
|
5
|
+
* generators (Oreoasis ingestion, OpenAPI exporters, schema crawlers). The
|
|
6
|
+
* conversion is lossless for our DSL: every constraint we model maps to a
|
|
7
|
+
* documented JSON-Schema keyword.
|
|
8
|
+
*
|
|
9
|
+
* Kash-specific string formats (did-ks, cid, lexicon-id, …) are exposed via
|
|
10
|
+
* the `format` keyword AND as `pattern` regex so consumers without a custom
|
|
11
|
+
* format registry can still validate.
|
|
12
|
+
*/
|
|
13
|
+
import { FORMAT_PATTERNS, } from "./schema";
|
|
14
|
+
/** Map Kash string-format identifiers to JSON-Schema `format` values.
|
|
15
|
+
* Standard formats (date-time, uri) use the JSON-Schema names; Kash-specific
|
|
16
|
+
* ones use a prefix. The regex source is reused from `FORMAT_PATTERNS` so we
|
|
17
|
+
* never duplicate the canonical regex. */
|
|
18
|
+
const FORMAT_NAMES = {
|
|
19
|
+
"did-ks": "did-ks",
|
|
20
|
+
"cid": "cid",
|
|
21
|
+
"iso8601": "date-time",
|
|
22
|
+
"url": "uri",
|
|
23
|
+
"multibase": "multibase",
|
|
24
|
+
"bcp47": "bcp47-language-tag",
|
|
25
|
+
"iso4217": "iso-4217-currency",
|
|
26
|
+
"lexicon-id": "kash-lexicon-id",
|
|
27
|
+
"nsid": "kash-nsid",
|
|
28
|
+
};
|
|
29
|
+
/** Convert any internal Schema to a JSON-Schema-Draft-2020-12 object. */
|
|
30
|
+
export function toJsonSchema(schema) {
|
|
31
|
+
switch (schema.kind) {
|
|
32
|
+
case "any":
|
|
33
|
+
return {};
|
|
34
|
+
case "boolean":
|
|
35
|
+
return { type: "boolean" };
|
|
36
|
+
case "literal":
|
|
37
|
+
return convertLiteral(schema);
|
|
38
|
+
case "enum":
|
|
39
|
+
return convertEnum(schema);
|
|
40
|
+
case "string":
|
|
41
|
+
return convertString(schema);
|
|
42
|
+
case "number":
|
|
43
|
+
return convertNumber(schema);
|
|
44
|
+
case "array":
|
|
45
|
+
return convertArray(schema);
|
|
46
|
+
case "object":
|
|
47
|
+
return convertObject(schema);
|
|
48
|
+
case "union":
|
|
49
|
+
return convertUnion(schema);
|
|
50
|
+
case "optional":
|
|
51
|
+
// Optionality is encoded by the parent object's `required` array.
|
|
52
|
+
return toJsonSchema(schema.inner);
|
|
53
|
+
case "record":
|
|
54
|
+
return convertRecord(schema);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function convertLiteral(s) {
|
|
58
|
+
return { const: s.value };
|
|
59
|
+
}
|
|
60
|
+
function convertEnum(s) {
|
|
61
|
+
return { enum: [...s.values] };
|
|
62
|
+
}
|
|
63
|
+
function convertString(s) {
|
|
64
|
+
const out = { type: "string" };
|
|
65
|
+
if (s.minLength !== undefined)
|
|
66
|
+
out.minLength = s.minLength;
|
|
67
|
+
if (s.maxLength !== undefined)
|
|
68
|
+
out.maxLength = s.maxLength;
|
|
69
|
+
if (s.pattern)
|
|
70
|
+
out.pattern = s.pattern.source;
|
|
71
|
+
if (s.format) {
|
|
72
|
+
out.format = FORMAT_NAMES[s.format];
|
|
73
|
+
if (out.pattern === undefined)
|
|
74
|
+
out.pattern = FORMAT_PATTERNS[s.format].source;
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
function convertNumber(s) {
|
|
79
|
+
const out = { type: s.integer ? "integer" : "number" };
|
|
80
|
+
if (s.min !== undefined)
|
|
81
|
+
out.minimum = s.min;
|
|
82
|
+
if (s.max !== undefined)
|
|
83
|
+
out.maximum = s.max;
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
function convertArray(s) {
|
|
87
|
+
const out = {
|
|
88
|
+
type: "array",
|
|
89
|
+
items: toJsonSchema(s.items),
|
|
90
|
+
};
|
|
91
|
+
if (s.minItems !== undefined)
|
|
92
|
+
out.minItems = s.minItems;
|
|
93
|
+
if (s.maxItems !== undefined)
|
|
94
|
+
out.maxItems = s.maxItems;
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
function convertObject(s) {
|
|
98
|
+
const properties = {};
|
|
99
|
+
for (const k of Object.keys(s.properties)) {
|
|
100
|
+
const sub = s.properties[k];
|
|
101
|
+
properties[k] = toJsonSchema(sub);
|
|
102
|
+
}
|
|
103
|
+
const out = {
|
|
104
|
+
type: "object",
|
|
105
|
+
properties,
|
|
106
|
+
additionalProperties: s.additionalProperties,
|
|
107
|
+
};
|
|
108
|
+
if (s.required.length > 0)
|
|
109
|
+
out.required = [...s.required];
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
function convertUnion(s) {
|
|
113
|
+
return { anyOf: s.variants.map(toJsonSchema) };
|
|
114
|
+
}
|
|
115
|
+
function convertRecord(s) {
|
|
116
|
+
const out = {
|
|
117
|
+
type: "object",
|
|
118
|
+
additionalProperties: toJsonSchema(s.values),
|
|
119
|
+
};
|
|
120
|
+
if (s.keys.pattern) {
|
|
121
|
+
out.propertyNames = { pattern: s.keys.pattern.source };
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=json-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,eAAe,GAWhB,MAAM,UAAU,CAAC;AAKlB;;;2CAG2C;AAC3C,MAAM,YAAY,GAAuC;IACvD,QAAQ,EAAM,QAAQ;IACtB,KAAK,EAAS,KAAK;IACnB,SAAS,EAAK,WAAW;IACzB,KAAK,EAAS,KAAK;IACnB,WAAW,EAAG,WAAW;IACzB,OAAO,EAAO,oBAAoB;IAClC,SAAS,EAAK,mBAAmB;IACjC,YAAY,EAAE,iBAAiB;IAC/B,MAAM,EAAQ,WAAW;CAC1B,CAAC;AAEF,yEAAyE;AACzE,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,KAAK;YACR,OAAO,EAAE,CAAC;QACZ,KAAK,SAAS;YACZ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC7B,KAAK,SAAS;YACZ,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;QA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KAC7C,CAAC;IACF,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,GAAG,CAAC,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,YAAY,CAAC,CAAc;IAClC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;AACjD,CAAC;AAED,SAAS,aAAa,CAAC,CAAe;IACpC,MAAM,GAAG,GAA4B;QACnC,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC;KAC7C,CAAC;IACF,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,GAAG,CAAC,aAAa,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IACzD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Library — the agnostic, foundry-shipped lexicons.
|
|
3
|
+
*
|
|
4
|
+
* This registry slice contains ONLY the identity-tier lexicons:
|
|
5
|
+
* - kash.id.profile@1.0.0
|
|
6
|
+
* - kash.id.audit@1.0.0
|
|
7
|
+
* - kash.id.preferences@1.0.0
|
|
8
|
+
*
|
|
9
|
+
* Domain lexicons (Social, Trade, Neuron, third-party `app.*`) ship as
|
|
10
|
+
* Extensions and live under `src/extensions/<domain>.ts`. Consumers
|
|
11
|
+
* register what they need. The Core never auto-loads domain content —
|
|
12
|
+
* that is the load-bearing rule of the Box-vs-Content separation.
|
|
13
|
+
*/
|
|
14
|
+
export * from "./kash-id-profile";
|
|
15
|
+
export * from "./kash-id-audit";
|
|
16
|
+
export * from "./kash-id-preferences";
|
|
17
|
+
import type { LexiconDef } from "../registry";
|
|
18
|
+
/**
|
|
19
|
+
* The Standard Library — every identity-tier lexicon every Kash actor
|
|
20
|
+
* needs to interoperate at the protocol layer.
|
|
21
|
+
*
|
|
22
|
+
* Bootstrap pattern:
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { LexiconRegistry } from "@kashscript/lexicons";
|
|
26
|
+
* import { STANDARD_LIBRARY } from "@kashscript/lexicons";
|
|
27
|
+
*
|
|
28
|
+
* const registry = new LexiconRegistry().registerAll(STANDARD_LIBRARY);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const STANDARD_LIBRARY: readonly LexiconDef[];
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lexicons/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAW9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAyBjD,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Library — the agnostic, foundry-shipped lexicons.
|
|
3
|
+
*
|
|
4
|
+
* This registry slice contains ONLY the identity-tier lexicons:
|
|
5
|
+
* - kash.id.profile@1.0.0
|
|
6
|
+
* - kash.id.audit@1.0.0
|
|
7
|
+
* - kash.id.preferences@1.0.0
|
|
8
|
+
*
|
|
9
|
+
* Domain lexicons (Social, Trade, Neuron, third-party `app.*`) ship as
|
|
10
|
+
* Extensions and live under `src/extensions/<domain>.ts`. Consumers
|
|
11
|
+
* register what they need. The Core never auto-loads domain content —
|
|
12
|
+
* that is the load-bearing rule of the Box-vs-Content separation.
|
|
13
|
+
*/
|
|
14
|
+
export * from "./kash-id-profile";
|
|
15
|
+
export * from "./kash-id-audit";
|
|
16
|
+
export * from "./kash-id-preferences";
|
|
17
|
+
import { KASH_PROFILE_BODY_SCHEMA, KASH_PROFILE_ID, KASH_PROFILE_NSID, KASH_PROFILE_VERSION, } from "./kash-id-profile";
|
|
18
|
+
import { KASH_AUDIT_BODY_SCHEMA, KASH_AUDIT_ID, KASH_AUDIT_NSID, KASH_AUDIT_VERSION, } from "./kash-id-audit";
|
|
19
|
+
import { KASH_PREFERENCES_BODY_SCHEMA, KASH_PREFERENCES_ID, KASH_PREFERENCES_NSID, KASH_PREFERENCES_VERSION, } from "./kash-id-preferences";
|
|
20
|
+
/**
|
|
21
|
+
* The Standard Library — every identity-tier lexicon every Kash actor
|
|
22
|
+
* needs to interoperate at the protocol layer.
|
|
23
|
+
*
|
|
24
|
+
* Bootstrap pattern:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { LexiconRegistry } from "@kashscript/lexicons";
|
|
28
|
+
* import { STANDARD_LIBRARY } from "@kashscript/lexicons";
|
|
29
|
+
*
|
|
30
|
+
* const registry = new LexiconRegistry().registerAll(STANDARD_LIBRARY);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export const STANDARD_LIBRARY = [
|
|
34
|
+
{
|
|
35
|
+
id: KASH_PROFILE_ID,
|
|
36
|
+
nsid: KASH_PROFILE_NSID,
|
|
37
|
+
semver: KASH_PROFILE_VERSION,
|
|
38
|
+
bodySchema: KASH_PROFILE_BODY_SCHEMA,
|
|
39
|
+
title: "Kash Profile",
|
|
40
|
+
description: "Sovereign user profile — display name, bio, avatar, pinned PDS URLs.",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: KASH_AUDIT_ID,
|
|
44
|
+
nsid: KASH_AUDIT_NSID,
|
|
45
|
+
semver: KASH_AUDIT_VERSION,
|
|
46
|
+
bodySchema: KASH_AUDIT_BODY_SCHEMA,
|
|
47
|
+
title: "Kash Audit Entry",
|
|
48
|
+
description: "Append-only ledger of identity lifecycle events.",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: KASH_PREFERENCES_ID,
|
|
52
|
+
nsid: KASH_PREFERENCES_NSID,
|
|
53
|
+
semver: KASH_PREFERENCES_VERSION,
|
|
54
|
+
bodySchema: KASH_PREFERENCES_BODY_SCHEMA,
|
|
55
|
+
title: "Kash Preferences",
|
|
56
|
+
description: "App-agnostic settings — theme, language, AI consent flags.",
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lexicons/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EACL,wBAAwB,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,GACnF,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,sBAAsB,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,GAC3E,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,4BAA4B,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,wBAAwB,GACnG,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA0B;IACrD;QACE,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,oBAAoB;QAC5B,UAAU,EAAE,wBAAwB;QACpC,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,sEAAsE;KACpF;IACD;QACE,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,kBAAkB;QAC1B,UAAU,EAAE,sBAAsB;QAClC,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,kDAAkD;KAChE;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,IAAI,EAAE,qBAAqB;QAC3B,MAAM,EAAE,wBAAwB;QAChC,UAAU,EAAE,4BAA4B;QACxC,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,4DAA4D;KAC1E;CACF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexicon: kash.id.audit@1.0.0
|
|
3
|
+
*
|
|
4
|
+
* Append-only ledger of identity-state changes. Each record references the
|
|
5
|
+
* corresponding op-log entry from the Identity Protocol so consumers can
|
|
6
|
+
* audit history without re-replaying the full chain.
|
|
7
|
+
*/
|
|
8
|
+
import { type ObjectSchema } from "../schema";
|
|
9
|
+
export declare const KASH_AUDIT_NSID: "kash.id.audit";
|
|
10
|
+
export declare const KASH_AUDIT_VERSION: {
|
|
11
|
+
readonly major: 1;
|
|
12
|
+
readonly minor: 0;
|
|
13
|
+
readonly patch: 0;
|
|
14
|
+
};
|
|
15
|
+
export declare const KASH_AUDIT_ID: "kash.id.audit@1.0.0";
|
|
16
|
+
export type KashAuditEventType = "key-rotated" | "key-revoked" | "pds-migrated" | "witnesses-changed" | "quorum-set" | "quorum-recovered" | "deactivated";
|
|
17
|
+
export interface KashAuditBody {
|
|
18
|
+
/** Type of identity-state event being logged. */
|
|
19
|
+
readonly event: KashAuditEventType;
|
|
20
|
+
/** CID of the underlying op-log entry (Identity Protocol §3.4 head.opCid). */
|
|
21
|
+
readonly opCid: string;
|
|
22
|
+
/** Sequence number from the op log (Identity Protocol §4.2). */
|
|
23
|
+
readonly opSeq: number;
|
|
24
|
+
/** Op-log entry type ("update", "recover", "quorum-recover", etc.). */
|
|
25
|
+
readonly opType: string;
|
|
26
|
+
/** Human-readable summary for audit-log UIs. 1–280 chars. */
|
|
27
|
+
readonly summary: string;
|
|
28
|
+
/** Optional structured details; shape is per-event-type, free-form here. */
|
|
29
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
30
|
+
}
|
|
31
|
+
export declare const KASH_AUDIT_BODY_SCHEMA: ObjectSchema;
|
|
32
|
+
//# sourceMappingURL=kash-id-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kash-id-audit.d.ts","sourceRoot":"","sources":["../../src/lexicons/kash-id-audit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAK,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAEjD,eAAO,MAAM,eAAe,EAAM,eAAwB,CAAC;AAC3D,eAAO,MAAM,kBAAkB;;;;CAA4C,CAAC;AAC5E,eAAO,MAAM,aAAa,EAAQ,qBAA8B,CAAC;AAIjE,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,YAAY,GACZ,kBAAkB,GAClB,aAAa,CAAC;AAElB,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACtD;AAID,eAAO,MAAM,sBAAsB,EAAE,YAkBpC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexicon: kash.id.audit@1.0.0
|
|
3
|
+
*
|
|
4
|
+
* Append-only ledger of identity-state changes. Each record references the
|
|
5
|
+
* corresponding op-log entry from the Identity Protocol so consumers can
|
|
6
|
+
* audit history without re-replaying the full chain.
|
|
7
|
+
*/
|
|
8
|
+
import { S } from "../schema";
|
|
9
|
+
export const KASH_AUDIT_NSID = "kash.id.audit";
|
|
10
|
+
export const KASH_AUDIT_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
11
|
+
export const KASH_AUDIT_ID = "kash.id.audit@1.0.0";
|
|
12
|
+
/* ── runtime schema ─────────────────────────────────────────────── */
|
|
13
|
+
export const KASH_AUDIT_BODY_SCHEMA = S.object({
|
|
14
|
+
event: S.enum("key-rotated", "key-revoked", "pds-migrated", "witnesses-changed", "quorum-set", "quorum-recovered", "deactivated"),
|
|
15
|
+
opCid: S.string({ format: "cid" }),
|
|
16
|
+
opSeq: S.number({ integer: true, min: 0 }),
|
|
17
|
+
opType: S.string({ minLength: 1, maxLength: 64 }),
|
|
18
|
+
summary: S.string({ minLength: 1, maxLength: 280 }),
|
|
19
|
+
details: S.optional(S.record(S.any())),
|
|
20
|
+
}, ["event", "opCid", "opSeq", "opType", "summary"]);
|
|
21
|
+
//# sourceMappingURL=kash-id-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kash-id-audit.js","sourceRoot":"","sources":["../../src/lexicons/kash-id-audit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAqB,MAAM,WAAW,CAAC;AAEjD,MAAM,CAAC,MAAM,eAAe,GAAM,eAAwB,CAAC;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAW,CAAC;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAQ,qBAA8B,CAAC;AA4BjE,uEAAuE;AAEvE,MAAM,CAAC,MAAM,sBAAsB,GAAiB,CAAC,CAAC,MAAM,CAC1D;IACE,KAAK,EAAI,CAAC,CAAC,IAAI,CACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,aAAa,CACd;IACD,KAAK,EAAI,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACpC,KAAK,EAAI,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IAC5C,MAAM,EAAG,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAClD,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;IACnD,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;CACvC,EACD,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CACjD,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexicon: kash.id.preferences@1.0.0
|
|
3
|
+
*
|
|
4
|
+
* App-agnostic user preferences. Single-record collection (rkey: "self").
|
|
5
|
+
*
|
|
6
|
+
* Privacy-by-default: if `privacy.allowAI` is absent or any flag within it
|
|
7
|
+
* is absent, the relevant flag defaults to FALSE. Oreoasis MUST NOT ingest
|
|
8
|
+
* a user's records without `allowAI.neuronIngest === true`.
|
|
9
|
+
*/
|
|
10
|
+
import { type ObjectSchema } from "../schema";
|
|
11
|
+
export declare const KASH_PREFERENCES_NSID: "kash.id.preferences";
|
|
12
|
+
export declare const KASH_PREFERENCES_VERSION: {
|
|
13
|
+
readonly major: 1;
|
|
14
|
+
readonly minor: 0;
|
|
15
|
+
readonly patch: 0;
|
|
16
|
+
};
|
|
17
|
+
export declare const KASH_PREFERENCES_ID: "kash.id.preferences@1.0.0";
|
|
18
|
+
export type ThemePref = "light" | "dark" | "system";
|
|
19
|
+
export type Visibility = "public" | "followers" | "private";
|
|
20
|
+
export type TimeFormat = "12h" | "24h";
|
|
21
|
+
export interface AIConsent {
|
|
22
|
+
/** May my records be used to train models? */
|
|
23
|
+
readonly training: boolean;
|
|
24
|
+
/** May my records be retrieved at inference time (RAG)? */
|
|
25
|
+
readonly inference: boolean;
|
|
26
|
+
/** May Oreoasis (Neuron) ingest my records into its context engine? */
|
|
27
|
+
readonly neuronIngest: boolean;
|
|
28
|
+
/** Optional list of NSIDs explicitly excluded from any AI use. */
|
|
29
|
+
readonly excludedCollections?: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
export interface PrivacyPreferences {
|
|
32
|
+
/** Visibility of the profile to non-followers / public crawlers. */
|
|
33
|
+
readonly profileVisibility: Visibility;
|
|
34
|
+
/** Whether crawlers / federation peers may index this identity. */
|
|
35
|
+
readonly indexable: boolean;
|
|
36
|
+
/** AI consent flags — ALL DEFAULT FALSE if absent. */
|
|
37
|
+
readonly allowAI?: AIConsent;
|
|
38
|
+
}
|
|
39
|
+
export interface NotificationPreferences {
|
|
40
|
+
readonly handshakes: boolean;
|
|
41
|
+
readonly keyRotations: boolean;
|
|
42
|
+
readonly quorumActivity: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface UnitPreferences {
|
|
45
|
+
/** ISO 4217 currency code (USD, PKR, EUR, …). */
|
|
46
|
+
readonly currency: string;
|
|
47
|
+
readonly timeFormat: TimeFormat;
|
|
48
|
+
/** strftime-like template ("%Y-%m-%d"). */
|
|
49
|
+
readonly dateFormat: string;
|
|
50
|
+
}
|
|
51
|
+
export interface KashPreferencesBody {
|
|
52
|
+
/** BCP 47 language tag ("en", "ur-PK"). */
|
|
53
|
+
readonly language?: string;
|
|
54
|
+
readonly theme?: ThemePref;
|
|
55
|
+
readonly privacy?: PrivacyPreferences;
|
|
56
|
+
readonly notifications?: NotificationPreferences;
|
|
57
|
+
readonly units?: UnitPreferences;
|
|
58
|
+
}
|
|
59
|
+
export declare const KASH_PREFERENCES_BODY_SCHEMA: ObjectSchema;
|
|
60
|
+
//# sourceMappingURL=kash-id-preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kash-id-preferences.d.ts","sourceRoot":"","sources":["../../src/lexicons/kash-id-preferences.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAK,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAEjD,eAAO,MAAM,qBAAqB,EAAM,qBAA8B,CAAC;AACvE,eAAO,MAAM,wBAAwB;;;;CAA4C,CAAC;AAClF,eAAO,MAAM,mBAAmB,EAAQ,2BAAoC,CAAC;AAI7E,MAAM,MAAM,SAAS,GAAO,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AACxD,MAAM,MAAM,UAAU,GAAM,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAC/D,MAAM,MAAM,UAAU,GAAM,KAAK,GAAG,KAAK,CAAC;AAE1C,MAAM,WAAW,SAAS;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,kEAAkE;IAClE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClD;AAED,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC;IACvC,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACjD,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;CAClC;AAyCD,eAAO,MAAM,4BAA4B,EAAE,YAS1C,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexicon: kash.id.preferences@1.0.0
|
|
3
|
+
*
|
|
4
|
+
* App-agnostic user preferences. Single-record collection (rkey: "self").
|
|
5
|
+
*
|
|
6
|
+
* Privacy-by-default: if `privacy.allowAI` is absent or any flag within it
|
|
7
|
+
* is absent, the relevant flag defaults to FALSE. Oreoasis MUST NOT ingest
|
|
8
|
+
* a user's records without `allowAI.neuronIngest === true`.
|
|
9
|
+
*/
|
|
10
|
+
import { S } from "../schema";
|
|
11
|
+
export const KASH_PREFERENCES_NSID = "kash.id.preferences";
|
|
12
|
+
export const KASH_PREFERENCES_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
13
|
+
export const KASH_PREFERENCES_ID = "kash.id.preferences@1.0.0";
|
|
14
|
+
/* ── runtime schema ─────────────────────────────────────────────── */
|
|
15
|
+
const AI_CONSENT = S.object({
|
|
16
|
+
training: S.boolean(),
|
|
17
|
+
inference: S.boolean(),
|
|
18
|
+
neuronIngest: S.boolean(),
|
|
19
|
+
excludedCollections: S.optional(S.array(S.string({ format: "nsid" }), { maxItems: 64 })),
|
|
20
|
+
}, ["training", "inference", "neuronIngest"]);
|
|
21
|
+
const PRIVACY = S.object({
|
|
22
|
+
profileVisibility: S.enum("public", "followers", "private"),
|
|
23
|
+
indexable: S.boolean(),
|
|
24
|
+
allowAI: S.optional(AI_CONSENT),
|
|
25
|
+
}, ["profileVisibility", "indexable"]);
|
|
26
|
+
const NOTIFICATIONS = S.object({
|
|
27
|
+
handshakes: S.boolean(),
|
|
28
|
+
keyRotations: S.boolean(),
|
|
29
|
+
quorumActivity: S.boolean(),
|
|
30
|
+
}, ["handshakes", "keyRotations", "quorumActivity"]);
|
|
31
|
+
const UNITS = S.object({
|
|
32
|
+
currency: S.string({ format: "iso4217" }),
|
|
33
|
+
timeFormat: S.enum("12h", "24h"),
|
|
34
|
+
dateFormat: S.string({ minLength: 1, maxLength: 32 }),
|
|
35
|
+
}, ["currency", "timeFormat", "dateFormat"]);
|
|
36
|
+
export const KASH_PREFERENCES_BODY_SCHEMA = S.object({
|
|
37
|
+
language: S.optional(S.string({ format: "bcp47" })),
|
|
38
|
+
theme: S.optional(S.enum("light", "dark", "system")),
|
|
39
|
+
privacy: S.optional(PRIVACY),
|
|
40
|
+
notifications: S.optional(NOTIFICATIONS),
|
|
41
|
+
units: S.optional(UNITS),
|
|
42
|
+
}, []);
|
|
43
|
+
//# sourceMappingURL=kash-id-preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kash-id-preferences.js","sourceRoot":"","sources":["../../src/lexicons/kash-id-preferences.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAqB,MAAM,WAAW,CAAC;AAEjD,MAAM,CAAC,MAAM,qBAAqB,GAAM,qBAA8B,CAAC;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC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C,KAAK,EAAE,KAAK,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;CACtD,EACD,CAAC,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC,CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAiB,CAAC,CAAC,MAAM,CAChE;IACE,QAAQ,EAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACxD,KAAK,EAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5D,OAAO,EAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;IAClC,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;IACxC,KAAK,EAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;CACjC,EACD,EAAE,CACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexicon: kash.id.profile@1.0.0
|
|
3
|
+
*
|
|
4
|
+
* Sovereign user profile. Single-record collection (rkey: "self" by convention).
|
|
5
|
+
*/
|
|
6
|
+
import { type ObjectSchema } from "../schema";
|
|
7
|
+
import type { CID } from "../types";
|
|
8
|
+
export declare const KASH_PROFILE_NSID: "kash.id.profile";
|
|
9
|
+
export declare const KASH_PROFILE_VERSION: {
|
|
10
|
+
readonly major: 1;
|
|
11
|
+
readonly minor: 0;
|
|
12
|
+
readonly patch: 0;
|
|
13
|
+
};
|
|
14
|
+
export declare const KASH_PROFILE_ID: "kash.id.profile@1.0.0";
|
|
15
|
+
export type ProfileImageMime = "image/jpeg" | "image/png" | "image/webp" | "image/avif";
|
|
16
|
+
export interface ProfileBlobRef {
|
|
17
|
+
readonly cid: CID;
|
|
18
|
+
readonly mimeType: ProfileImageMime;
|
|
19
|
+
readonly altText?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ProfileLink {
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly url: string;
|
|
24
|
+
}
|
|
25
|
+
export interface KashProfileBody {
|
|
26
|
+
/** Optional human-readable handle hint. The authoritative handle is in the DID Document's alsoKnownAs. */
|
|
27
|
+
readonly handle?: string;
|
|
28
|
+
/** Display name. 1–64 characters after NFC normalisation. */
|
|
29
|
+
readonly displayName: string;
|
|
30
|
+
/** Short bio. 0–280 characters. */
|
|
31
|
+
readonly bio?: string;
|
|
32
|
+
/** Avatar image blob reference. */
|
|
33
|
+
readonly avatar?: ProfileBlobRef;
|
|
34
|
+
/** Banner image blob reference. */
|
|
35
|
+
readonly banner?: ProfileBlobRef;
|
|
36
|
+
/** Free-form pronouns string. */
|
|
37
|
+
readonly pronouns?: string;
|
|
38
|
+
/** Human-readable location ("Islamabad, PK"). */
|
|
39
|
+
readonly location?: string;
|
|
40
|
+
/** Pinned PDS / relay URLs the author wants peers to discover. Max 8. */
|
|
41
|
+
readonly pdsUrls?: readonly string[];
|
|
42
|
+
/** External profile links. Max 8. */
|
|
43
|
+
readonly links?: readonly ProfileLink[];
|
|
44
|
+
}
|
|
45
|
+
export declare const KASH_PROFILE_BODY_SCHEMA: ObjectSchema;
|
|
46
|
+
//# sourceMappingURL=kash-id-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kash-id-profile.d.ts","sourceRoot":"","sources":["../../src/lexicons/kash-id-profile.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAK,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,eAAO,MAAM,iBAAiB,EAAM,iBAA0B,CAAC;AAC/D,eAAO,MAAM,oBAAoB;;;;CAA4C,CAAC;AAC9E,eAAO,MAA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*/
|
|
6
|
+
import { S } from "../schema";
|
|
7
|
+
export const KASH_PROFILE_NSID = "kash.id.profile";
|
|
8
|
+
export const KASH_PROFILE_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
9
|
+
export const KASH_PROFILE_ID = "kash.id.profile@1.0.0";
|
|
10
|
+
/* ── runtime schema ─────────────────────────────────────────────── */
|
|
11
|
+
const PROFILE_BLOB_REF = S.object({
|
|
12
|
+
cid: S.string({ format: "cid" }),
|
|
13
|
+
mimeType: S.enum("image/jpeg", "image/png", "image/webp", "image/avif"),
|
|
14
|
+
altText: S.optional(S.string({ maxLength: 420 })),
|
|
15
|
+
}, ["cid", "mimeType"]);
|
|
16
|
+
const PROFILE_LINK = S.object({
|
|
17
|
+
label: S.string({ minLength: 1, maxLength: 32 }),
|
|
18
|
+
url: S.string({ format: "url" }),
|
|
19
|
+
}, ["label", "url"]);
|
|
20
|
+
export const KASH_PROFILE_BODY_SCHEMA = S.object({
|
|
21
|
+
handle: S.optional(S.string({ minLength: 1, maxLength: 64 })),
|
|
22
|
+
displayName: S.string({ minLength: 1, maxLength: 64 }),
|
|
23
|
+
bio: S.optional(S.string({ maxLength: 280 })),
|
|
24
|
+
avatar: S.optional(PROFILE_BLOB_REF),
|
|
25
|
+
banner: S.optional(PROFILE_BLOB_REF),
|
|
26
|
+
pronouns: S.optional(S.string({ maxLength: 32 })),
|
|
27
|
+
location: S.optional(S.string({ maxLength: 64 })),
|
|
28
|
+
pdsUrls: S.optional(S.array(S.string({ format: "url" }), { maxItems: 8 })),
|
|
29
|
+
links: S.optional(S.array(PROFILE_LINK, { maxItems: 8 })),
|
|
30
|
+
}, ["displayName"]);
|
|
31
|
+
//# sourceMappingURL=kash-id-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kash-id-profile.js","sourceRoot":"","sources":["../../src/lexicons/kash-id-profile.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAqB,MAA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D,GAAG,EAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;IACrD,MAAM,EAAO,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACzC,MAAM,EAAO,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACzC,QAAQ,EAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IACpD,QAAQ,EAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IACpD,OAAO,EAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9E,KAAK,EAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;CAChE,EACD,CAAC,aAAa,CAAC,CAChB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LexiconRegistry — agnostic storage for Lexicon definitions.
|
|
3
|
+
*
|
|
4
|
+
* The registry holds a map of Lexicon IDs (NSID@semver) to schema definitions.
|
|
5
|
+
* It is **empty by default**: no Identity, Social, or Trade lexicons are
|
|
6
|
+
* pre-registered. Consumers explicitly register a Standard Library or load
|
|
7
|
+
* Extensions at bootstrap time (see `./engine.ts` and the Standard Library /
|
|
8
|
+
* Extension exports).
|
|
9
|
+
*
|
|
10
|
+
* The class does ZERO validation work itself — it just stores and resolves.
|
|
11
|
+
* Validation is performed by `validateEvent` (see `./engine.ts`) which
|
|
12
|
+
* accepts a registry as a parameter. This decoupling preserves the
|
|
13
|
+
* Box-vs-Content separation: the registry (Box) never knows about any
|
|
14
|
+
* specific domain (Content).
|
|
15
|
+
*/
|
|
16
|
+
import type { Schema } from "./schema";
|
|
17
|
+
import { type Semver } from "./semver";
|
|
18
|
+
/** A single lexicon definition held in the registry. */
|
|
19
|
+
export interface LexiconDef {
|
|
20
|
+
/** Full Lexicon ID — e.g., "kash.id.profile@1.0.0". */
|
|
21
|
+
readonly id: string;
|
|
22
|
+
/** NSID portion — e.g., "kash.id.profile". */
|
|
23
|
+
readonly nsid: string;
|
|
24
|
+
/** Semver of this definition. */
|
|
25
|
+
readonly semver: Semver;
|
|
26
|
+
/** Schema for the envelope body. */
|
|
27
|
+
readonly bodySchema: Schema;
|
|
28
|
+
/** Optional human-readable title (shown by tooling). */
|
|
29
|
+
readonly title?: string;
|
|
30
|
+
/** Optional human-readable description (shown by tooling). */
|
|
31
|
+
readonly description?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Options accepted by the `register(id, schema, opts)` convenience overload. */
|
|
34
|
+
export interface RegisterOptions {
|
|
35
|
+
readonly title?: string;
|
|
36
|
+
readonly description?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* In-memory map of registered lexicons.
|
|
40
|
+
*
|
|
41
|
+
* Multiple major versions for the same NSID may co-exist. The registry
|
|
42
|
+
* resolves by exact match first, then by forward-compatible major.
|
|
43
|
+
*/
|
|
44
|
+
export declare class LexiconRegistry {
|
|
45
|
+
private readonly byId;
|
|
46
|
+
private readonly byNsid;
|
|
47
|
+
/** Number of registered definitions. */
|
|
48
|
+
get size(): number;
|
|
49
|
+
/** Register a fully-described lexicon entry. */
|
|
50
|
+
register(entry: LexiconDef): this;
|
|
51
|
+
/** Register by Lexicon ID + body schema (convenience overload). */
|
|
52
|
+
register(id: string, bodySchema: Schema, opts?: RegisterOptions): this;
|
|
53
|
+
/** Register a batch of entries (typically a Standard Library or Extension export). */
|
|
54
|
+
registerAll(entries: readonly LexiconDef[]): this;
|
|
55
|
+
/** Exact-match lookup by full Lexicon ID. Returns undefined when not present. */
|
|
56
|
+
get(id: string): LexiconDef | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Forward-compatible lookup by NSID + caller-supplied semver.
|
|
59
|
+
* Returns the highest-version registered entry whose major matches the caller.
|
|
60
|
+
*/
|
|
61
|
+
resolve(nsid: string, semver: Semver): LexiconDef | undefined;
|
|
62
|
+
/** True if any version of the given NSID is registered. */
|
|
63
|
+
has(nsid: string): boolean;
|
|
64
|
+
/** True if the exact Lexicon ID is registered. */
|
|
65
|
+
hasId(id: string): boolean;
|
|
66
|
+
/** All registered Lexicon IDs, in insertion order. */
|
|
67
|
+
list(): readonly string[];
|
|
68
|
+
/** All registered entries. */
|
|
69
|
+
entries(): readonly LexiconDef[];
|
|
70
|
+
/** All NSIDs present in the registry. */
|
|
71
|
+
namespaces(): readonly string[];
|
|
72
|
+
/** Drop every registered entry. */
|
|
73
|
+
clear(): void;
|
|
74
|
+
/** Remove a single entry by its full Lexicon ID. Returns whether anything was removed. */
|
|
75
|
+
unregister(id: string): boolean;
|
|
76
|
+
private addEntry;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAsD,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAE3F,wDAAwD;AACxD,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,QAAQ,CAA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