@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,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Social Extension — domain lexicons (Indusland-shaped but Indusland-agnostic).
|
|
3
|
+
*
|
|
4
|
+
* kash.social.post@1.0.0 — a post (text, media, optional Bento metadata).
|
|
5
|
+
* kash.social.interaction@1.0.0 — unified like / share / react event.
|
|
6
|
+
* kash.social.follow@1.0.0 — directed relationship between two DIDs.
|
|
7
|
+
*
|
|
8
|
+
* Import path: `@kashscript/lexicons/extensions/social`.
|
|
9
|
+
*
|
|
10
|
+
* This file is an **extension**: the Foundry core never auto-loads it.
|
|
11
|
+
* Consumers explicitly register `SOCIAL_EXTENSION` against their
|
|
12
|
+
* `LexiconRegistry` to opt in to social-domain validation.
|
|
13
|
+
*
|
|
14
|
+
* Data minimisation: every field that is not load-bearing for the specific
|
|
15
|
+
* action is optional.
|
|
16
|
+
*/
|
|
17
|
+
import { RECORD_REF_SCHEMA } from "../envelope";
|
|
18
|
+
import { S } from "../schema";
|
|
19
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
20
|
+
* kash.social.post@1.0.0
|
|
21
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
22
|
+
export const KASH_SOCIAL_POST_NSID = "kash.social.post";
|
|
23
|
+
export const KASH_SOCIAL_POST_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
24
|
+
export const KASH_SOCIAL_POST_ID = "kash.social.post@1.0.0";
|
|
25
|
+
const POST_MEDIA_REF = S.object({
|
|
26
|
+
cid: S.string({ format: "cid" }),
|
|
27
|
+
mimeType: S.enum("image/jpeg", "image/png", "image/webp", "image/avif", "video/mp4", "video/webm", "audio/mpeg", "audio/ogg"),
|
|
28
|
+
altText: S.optional(S.string({ maxLength: 420 })),
|
|
29
|
+
width: S.optional(S.number({ integer: true, min: 1, max: 16384 })),
|
|
30
|
+
height: S.optional(S.number({ integer: true, min: 1, max: 16384 })),
|
|
31
|
+
durationMs: S.optional(S.number({ integer: true, min: 0, max: 86_400_000 })),
|
|
32
|
+
}, ["cid", "mimeType"]);
|
|
33
|
+
const BENTO_META = S.object({
|
|
34
|
+
title: S.optional(S.string({ minLength: 1, maxLength: 80 })),
|
|
35
|
+
accent: S.optional(S.enum("sun", "poppy", "sky", "lilac", "sage", "rose")),
|
|
36
|
+
size: S.optional(S.enum("small", "medium", "large")),
|
|
37
|
+
}, []);
|
|
38
|
+
export const KASH_SOCIAL_POST_BODY_SCHEMA = S.object({
|
|
39
|
+
text: S.optional(S.string({ maxLength: 1000 })),
|
|
40
|
+
media: S.optional(S.array(POST_MEDIA_REF, { maxItems: 8 })),
|
|
41
|
+
bento: S.optional(BENTO_META),
|
|
42
|
+
replyTo: S.optional(RECORD_REF_SCHEMA),
|
|
43
|
+
repostOf: S.optional(RECORD_REF_SCHEMA),
|
|
44
|
+
mentions: S.optional(S.array(S.string({ format: "did-ks" }), { maxItems: 16 })),
|
|
45
|
+
tags: S.optional(S.array(S.string({ minLength: 1, maxLength: 32, pattern: /^[a-z0-9][a-z0-9_-]*$/ }), { maxItems: 16 })),
|
|
46
|
+
lang: S.optional(S.string({ format: "bcp47" })),
|
|
47
|
+
}, []);
|
|
48
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
49
|
+
* kash.social.interaction@1.0.0
|
|
50
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
51
|
+
export const KASH_SOCIAL_INTERACTION_NSID = "kash.social.interaction";
|
|
52
|
+
export const KASH_SOCIAL_INTERACTION_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
53
|
+
export const KASH_SOCIAL_INTERACTION_ID = "kash.social.interaction@1.0.0";
|
|
54
|
+
export const KASH_SOCIAL_INTERACTION_BODY_SCHEMA = S.object({
|
|
55
|
+
type: S.enum("like", "share", "react"),
|
|
56
|
+
target: RECORD_REF_SCHEMA,
|
|
57
|
+
reaction: S.optional(S.string({ minLength: 1, maxLength: 16 })),
|
|
58
|
+
}, ["type", "target"]);
|
|
59
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
60
|
+
* kash.social.follow@1.0.0
|
|
61
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
62
|
+
export const KASH_SOCIAL_FOLLOW_NSID = "kash.social.follow";
|
|
63
|
+
export const KASH_SOCIAL_FOLLOW_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
64
|
+
export const KASH_SOCIAL_FOLLOW_ID = "kash.social.follow@1.0.0";
|
|
65
|
+
export const KASH_SOCIAL_FOLLOW_BODY_SCHEMA = S.object({
|
|
66
|
+
subject: S.string({ format: "did-ks" }),
|
|
67
|
+
subjectHandle: S.optional(S.string({ minLength: 1, maxLength: 64 })),
|
|
68
|
+
}, ["subject"]);
|
|
69
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
70
|
+
* Extension bundle
|
|
71
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
72
|
+
/** All Social-domain lexicons. Pass to `LexiconRegistry.registerAll()`. */
|
|
73
|
+
export const SOCIAL_EXTENSION = [
|
|
74
|
+
{
|
|
75
|
+
id: KASH_SOCIAL_POST_ID,
|
|
76
|
+
nsid: KASH_SOCIAL_POST_NSID,
|
|
77
|
+
semver: KASH_SOCIAL_POST_VERSION,
|
|
78
|
+
bodySchema: KASH_SOCIAL_POST_BODY_SCHEMA,
|
|
79
|
+
title: "Social Post",
|
|
80
|
+
description: "A post — text, media, and optional Bento-style tile metadata.",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: KASH_SOCIAL_INTERACTION_ID,
|
|
84
|
+
nsid: KASH_SOCIAL_INTERACTION_NSID,
|
|
85
|
+
semver: KASH_SOCIAL_INTERACTION_VERSION,
|
|
86
|
+
bodySchema: KASH_SOCIAL_INTERACTION_BODY_SCHEMA,
|
|
87
|
+
title: "Social Interaction",
|
|
88
|
+
description: "Unified like / share / react event against a post.",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: KASH_SOCIAL_FOLLOW_ID,
|
|
92
|
+
nsid: KASH_SOCIAL_FOLLOW_NSID,
|
|
93
|
+
semver: KASH_SOCIAL_FOLLOW_VERSION,
|
|
94
|
+
bodySchema: KASH_SOCIAL_FOLLOW_BODY_SCHEMA,
|
|
95
|
+
title: "Social Follow",
|
|
96
|
+
description: "Directed follow relationship between two DIDs.",
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
//# sourceMappingURL=social.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social.js","sourceRoot":"","sources":["../../src/extensions/social.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAkB,MAAM,aAAa,CAAC;AAEhE,OA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AAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;CACrE,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;AAEF;;uEAEuE;AAEvE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAA0B;IACrD;QACE,EAAE,EAAE,mBAAmB;QACvB,IAAI,EAAE,qBAAqB;QAC3B,MAAM,EAAE,wBAAwB;QAChC,UAAU,EAAE,4BAA4B;QACxC,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,+DAA+D;KAC7E;IACD;QACE,EAAE,EAAE,0BAA0B;QAC9B,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE,+BAA+B;QACvC,UAAU,EAAE,mCAAmC;QAC/C,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,oDAAoD;KAClE;IACD;QACE,EAAE,EAAE,qBAAqB;QACzB,IAAI,EAAE,uBAAuB;QAC7B,MAAM,EAAE,0BAA0B;QAClC,UAAU,EAAE,8BAA8B;QAC1C,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,gDAAgD;KAC9D;CACF,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trade Extension — domain lexicons (Duedale-shaped but Duedale-agnostic).
|
|
3
|
+
*
|
|
4
|
+
* kash.trade.offer@1.0.0 — an item / service for sale.
|
|
5
|
+
* kash.trade.receipt@1.0.0 — a cryptographically signed completed transaction.
|
|
6
|
+
* kash.trade.status@1.0.0 — a lightweight logistics update.
|
|
7
|
+
*
|
|
8
|
+
* Import path: `@kashscript/lexicons/extensions/trade`.
|
|
9
|
+
*
|
|
10
|
+
* This file is an **extension**: the Foundry core never auto-loads it.
|
|
11
|
+
* Consumers explicitly register `TRADE_EXTENSION` against their
|
|
12
|
+
* `LexiconRegistry` to opt in to trade-domain validation.
|
|
13
|
+
*
|
|
14
|
+
* Prices follow ISO 4217 (currency codes) and store amounts as DECIMAL STRINGS
|
|
15
|
+
* to avoid IEEE-754 float drift. Locations use ISO 3166-2 region codes when
|
|
16
|
+
* available, falling back to free-form region strings.
|
|
17
|
+
*/
|
|
18
|
+
import { type RecordRef } from "../envelope";
|
|
19
|
+
import type { LexiconDef } from "../registry";
|
|
20
|
+
import { type ObjectSchema } from "../schema";
|
|
21
|
+
export type PriceUnit = "fixed" | "per-hour" | "per-day" | "per-month" | "per-unit";
|
|
22
|
+
export interface PriceSpec {
|
|
23
|
+
readonly amount: string;
|
|
24
|
+
readonly currency: string;
|
|
25
|
+
readonly unit?: PriceUnit;
|
|
26
|
+
}
|
|
27
|
+
export declare const KASH_TRADE_OFFER_NSID: "kash.trade.offer";
|
|
28
|
+
export declare const KASH_TRADE_OFFER_VERSION: {
|
|
29
|
+
readonly major: 1;
|
|
30
|
+
readonly minor: 0;
|
|
31
|
+
readonly patch: 0;
|
|
32
|
+
};
|
|
33
|
+
export declare const KASH_TRADE_OFFER_ID: "kash.trade.offer@1.0.0";
|
|
34
|
+
export type TradeCategory = "goods" | "services" | "rentals" | "digital";
|
|
35
|
+
export type TradeStatus = "open" | "reserved" | "closed";
|
|
36
|
+
export type FulfilmentMode = "pickup" | "ship" | "digital";
|
|
37
|
+
export interface OfferMediaRef {
|
|
38
|
+
readonly cid: string;
|
|
39
|
+
readonly mimeType: "image/jpeg" | "image/png" | "image/webp";
|
|
40
|
+
}
|
|
41
|
+
export interface LocationSpec {
|
|
42
|
+
readonly region: string;
|
|
43
|
+
readonly handler: FulfilmentMode;
|
|
44
|
+
}
|
|
45
|
+
export interface KashTradeOfferBody {
|
|
46
|
+
readonly title: string;
|
|
47
|
+
readonly description?: string;
|
|
48
|
+
readonly category: TradeCategory;
|
|
49
|
+
readonly price: PriceSpec;
|
|
50
|
+
readonly media?: readonly OfferMediaRef[];
|
|
51
|
+
readonly location?: LocationSpec;
|
|
52
|
+
readonly validUntil?: string;
|
|
53
|
+
readonly status: TradeStatus;
|
|
54
|
+
readonly relatedPost?: RecordRef;
|
|
55
|
+
}
|
|
56
|
+
export declare const KASH_TRADE_OFFER_BODY_SCHEMA: ObjectSchema;
|
|
57
|
+
export declare const KASH_TRADE_RECEIPT_NSID: "kash.trade.receipt";
|
|
58
|
+
export declare const KASH_TRADE_RECEIPT_VERSION: {
|
|
59
|
+
readonly major: 1;
|
|
60
|
+
readonly minor: 0;
|
|
61
|
+
readonly patch: 0;
|
|
62
|
+
};
|
|
63
|
+
export declare const KASH_TRADE_RECEIPT_ID: "kash.trade.receipt@1.0.0";
|
|
64
|
+
export type TradeRole = "buyer" | "seller";
|
|
65
|
+
export interface KashTradeReceiptBody {
|
|
66
|
+
readonly offer: RecordRef;
|
|
67
|
+
readonly counterparty: string;
|
|
68
|
+
readonly role: TradeRole;
|
|
69
|
+
readonly price: PriceSpec;
|
|
70
|
+
readonly settledAt: string;
|
|
71
|
+
readonly paymentRef?: string;
|
|
72
|
+
readonly counterpartyReceipt?: RecordRef;
|
|
73
|
+
readonly linkedPost?: RecordRef;
|
|
74
|
+
}
|
|
75
|
+
export declare const KASH_TRADE_RECEIPT_BODY_SCHEMA: ObjectSchema;
|
|
76
|
+
export declare const KASH_TRADE_STATUS_NSID: "kash.trade.status";
|
|
77
|
+
export declare const KASH_TRADE_STATUS_VERSION: {
|
|
78
|
+
readonly major: 1;
|
|
79
|
+
readonly minor: 0;
|
|
80
|
+
readonly patch: 0;
|
|
81
|
+
};
|
|
82
|
+
export declare const KASH_TRADE_STATUS_ID: "kash.trade.status@1.0.0";
|
|
83
|
+
export type TradeState = "pending" | "shipped" | "in-transit" | "delivered" | "received" | "disputed" | "refunded" | "cancelled";
|
|
84
|
+
export interface KashTradeStatusBody {
|
|
85
|
+
readonly receipt: RecordRef;
|
|
86
|
+
readonly state: TradeState;
|
|
87
|
+
readonly note?: string;
|
|
88
|
+
readonly trackingRef?: string;
|
|
89
|
+
readonly at?: string;
|
|
90
|
+
}
|
|
91
|
+
export declare const KASH_TRADE_STATUS_BODY_SCHEMA: ObjectSchema;
|
|
92
|
+
/** All Trade-domain lexicons. Pass to `LexiconRegistry.registerAll()`. */
|
|
93
|
+
export declare const TRADE_EXTENSION: readonly LexiconDef[];
|
|
94
|
+
//# sourceMappingURL=trade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade.d.ts","sourceRoot":"","sources":["../../src/extensions/trade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAK,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAQjD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAEpF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC3B;AAeD,eAAO,MAAM,qBAAqB,EAAM,kBAA2B,CAAC;AACpE,eAAO,MAAM,wBAAwB;;;;CAA4C,CAAC;AAClF,eAAO,MAAM,mBAAmB,EAAQ,wBAAiC,CAAC;AAE1E,MAAM,MAAM,aAAa,GAAI,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAC1E,MAAM,MAAM,WAAW,GAAM,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AAC5D,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,CAA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,CAAC;CACjC;AAED,eAAO,MAAM,8BAA8B,EAAE,YAY5C,CAAC;AAMF,eAAO,MAAM,sBAAsB,EAAM,mBAA4B,CAAC;AACtE,eAAO,MAAM,yBAAyB;;;;CAA4C,CAAC;AACnF,eAAO,MAAM,oBAAoB,EAAQ,yBAAkC,CAAC;AAE5E,MAAM,MAAM,UAAU,GAClB,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAClD,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,6BAA6B,EAAE,YAS3C,CAAC;AAMF,0EAA0E;AAC1E,eAAO,MAAM,eAAe,EAAE,SAAS,UAAU,EAyBhD,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trade Extension — domain lexicons (Duedale-shaped but Duedale-agnostic).
|
|
3
|
+
*
|
|
4
|
+
* kash.trade.offer@1.0.0 — an item / service for sale.
|
|
5
|
+
* kash.trade.receipt@1.0.0 — a cryptographically signed completed transaction.
|
|
6
|
+
* kash.trade.status@1.0.0 — a lightweight logistics update.
|
|
7
|
+
*
|
|
8
|
+
* Import path: `@kashscript/lexicons/extensions/trade`.
|
|
9
|
+
*
|
|
10
|
+
* This file is an **extension**: the Foundry core never auto-loads it.
|
|
11
|
+
* Consumers explicitly register `TRADE_EXTENSION` against their
|
|
12
|
+
* `LexiconRegistry` to opt in to trade-domain validation.
|
|
13
|
+
*
|
|
14
|
+
* Prices follow ISO 4217 (currency codes) and store amounts as DECIMAL STRINGS
|
|
15
|
+
* to avoid IEEE-754 float drift. Locations use ISO 3166-2 region codes when
|
|
16
|
+
* available, falling back to free-form region strings.
|
|
17
|
+
*/
|
|
18
|
+
import { RECORD_REF_SCHEMA } from "../envelope";
|
|
19
|
+
import { S } from "../schema";
|
|
20
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
21
|
+
* Money — ISO 4217 amount as a decimal string. AI-parseable.
|
|
22
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
23
|
+
const DECIMAL_AMOUNT_RE = /^(?:0|[1-9][0-9]{0,17})(?:\.[0-9]{1,8})?$/;
|
|
24
|
+
const PRICE_SPEC = S.object({
|
|
25
|
+
amount: S.string({ pattern: DECIMAL_AMOUNT_RE, maxLength: 32 }),
|
|
26
|
+
currency: S.string({ format: "iso4217" }),
|
|
27
|
+
unit: S.optional(S.enum("fixed", "per-hour", "per-day", "per-month", "per-unit")),
|
|
28
|
+
}, ["amount", "currency"]);
|
|
29
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
30
|
+
* kash.trade.offer@1.0.0
|
|
31
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
32
|
+
export const KASH_TRADE_OFFER_NSID = "kash.trade.offer";
|
|
33
|
+
export const KASH_TRADE_OFFER_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
34
|
+
export const KASH_TRADE_OFFER_ID = "kash.trade.offer@1.0.0";
|
|
35
|
+
const OFFER_MEDIA_REF = S.object({
|
|
36
|
+
cid: S.string({ format: "cid" }),
|
|
37
|
+
mimeType: S.enum("image/jpeg", "image/png", "image/webp"),
|
|
38
|
+
}, ["cid", "mimeType"]);
|
|
39
|
+
const LOCATION_SPEC = S.object({
|
|
40
|
+
region: S.string({ minLength: 1, maxLength: 64 }),
|
|
41
|
+
handler: S.enum("pickup", "ship", "digital"),
|
|
42
|
+
}, ["region", "handler"]);
|
|
43
|
+
export const KASH_TRADE_OFFER_BODY_SCHEMA = S.object({
|
|
44
|
+
title: S.string({ minLength: 1, maxLength: 140 }),
|
|
45
|
+
description: S.optional(S.string({ maxLength: 4000 })),
|
|
46
|
+
category: S.enum("goods", "services", "rentals", "digital"),
|
|
47
|
+
price: PRICE_SPEC,
|
|
48
|
+
media: S.optional(S.array(OFFER_MEDIA_REF, { maxItems: 8 })),
|
|
49
|
+
location: S.optional(LOCATION_SPEC),
|
|
50
|
+
validUntil: S.optional(S.string({ format: "iso8601" })),
|
|
51
|
+
status: S.enum("open", "reserved", "closed"),
|
|
52
|
+
relatedPost: S.optional(RECORD_REF_SCHEMA),
|
|
53
|
+
}, ["title", "category", "price", "status"]);
|
|
54
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
55
|
+
* kash.trade.receipt@1.0.0
|
|
56
|
+
*
|
|
57
|
+
* Dual-receipt pattern: each party publishes their OWN receipt.
|
|
58
|
+
* Cross-domain interop: optional `linkedPost` references a `kash.social.post`.
|
|
59
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
60
|
+
export const KASH_TRADE_RECEIPT_NSID = "kash.trade.receipt";
|
|
61
|
+
export const KASH_TRADE_RECEIPT_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
62
|
+
export const KASH_TRADE_RECEIPT_ID = "kash.trade.receipt@1.0.0";
|
|
63
|
+
export const KASH_TRADE_RECEIPT_BODY_SCHEMA = S.object({
|
|
64
|
+
offer: RECORD_REF_SCHEMA,
|
|
65
|
+
counterparty: S.string({ format: "did-ks" }),
|
|
66
|
+
role: S.enum("buyer", "seller"),
|
|
67
|
+
price: PRICE_SPEC,
|
|
68
|
+
settledAt: S.string({ format: "iso8601" }),
|
|
69
|
+
paymentRef: S.optional(S.string({ minLength: 1, maxLength: 128 })),
|
|
70
|
+
counterpartyReceipt: S.optional(RECORD_REF_SCHEMA),
|
|
71
|
+
linkedPost: S.optional(RECORD_REF_SCHEMA),
|
|
72
|
+
}, ["offer", "counterparty", "role", "price", "settledAt"]);
|
|
73
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
74
|
+
* kash.trade.status@1.0.0
|
|
75
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
76
|
+
export const KASH_TRADE_STATUS_NSID = "kash.trade.status";
|
|
77
|
+
export const KASH_TRADE_STATUS_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
78
|
+
export const KASH_TRADE_STATUS_ID = "kash.trade.status@1.0.0";
|
|
79
|
+
export const KASH_TRADE_STATUS_BODY_SCHEMA = S.object({
|
|
80
|
+
receipt: RECORD_REF_SCHEMA,
|
|
81
|
+
state: S.enum("pending", "shipped", "in-transit", "delivered", "received", "disputed", "refunded", "cancelled"),
|
|
82
|
+
note: S.optional(S.string({ minLength: 1, maxLength: 280 })),
|
|
83
|
+
trackingRef: S.optional(S.string({ minLength: 1, maxLength: 128 })),
|
|
84
|
+
at: S.optional(S.string({ format: "iso8601" })),
|
|
85
|
+
}, ["receipt", "state"]);
|
|
86
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
87
|
+
* Extension bundle
|
|
88
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
89
|
+
/** All Trade-domain lexicons. Pass to `LexiconRegistry.registerAll()`. */
|
|
90
|
+
export const TRADE_EXTENSION = [
|
|
91
|
+
{
|
|
92
|
+
id: KASH_TRADE_OFFER_ID,
|
|
93
|
+
nsid: KASH_TRADE_OFFER_NSID,
|
|
94
|
+
semver: KASH_TRADE_OFFER_VERSION,
|
|
95
|
+
bodySchema: KASH_TRADE_OFFER_BODY_SCHEMA,
|
|
96
|
+
title: "Trade Offer",
|
|
97
|
+
description: "An item or service for sale — ISO 4217 price, optional location and media.",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: KASH_TRADE_RECEIPT_ID,
|
|
101
|
+
nsid: KASH_TRADE_RECEIPT_NSID,
|
|
102
|
+
semver: KASH_TRADE_RECEIPT_VERSION,
|
|
103
|
+
bodySchema: KASH_TRADE_RECEIPT_BODY_SCHEMA,
|
|
104
|
+
title: "Trade Receipt",
|
|
105
|
+
description: "Cryptographically signed completed transaction. Dual-receipt pattern; optionally links to a social post.",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: KASH_TRADE_STATUS_ID,
|
|
109
|
+
nsid: KASH_TRADE_STATUS_NSID,
|
|
110
|
+
semver: KASH_TRADE_STATUS_VERSION,
|
|
111
|
+
bodySchema: KASH_TRADE_STATUS_BODY_SCHEMA,
|
|
112
|
+
title: "Trade Status",
|
|
113
|
+
description: "Lightweight logistics update bound to a receipt.",
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
//# sourceMappingURL=trade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade.js","sourceRoot":"","sources":["../../src/extensions/trade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,iBAAiB,EAAkB,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAE,CAAC,EAAqB,MAAM,WAAW,CAAC;AAEjD;;uEAEuE;AAEvE,MAAM,iBAAiB,GAAG,2CAA2C,CAAC;AAUtE,MAAM,UAAU,GAAiB,CAAC,CAAC,MAAM,CACvC;IACE,MAAM,EAAI,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACjE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACzC,IAAI,EAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;CACtF,EACD,CAAC,QAAQ,EAAE,UAAU,CAAC,CACvB,CAAC;AAEF;;uEAEuE;AAEvE,MAAM,CAAC,MAAM,qBAAqB,GAAM,kBAA2B,CAAC;AACpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,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QAClC,UAAU,EAAE,8BAA8B;QAC1C,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,0GAA0G;KACxH;IACD;QACE,EAAE,EAAE,oBAAoB;QACxB,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,yBAAyB;QACjC,UAAU,EAAE,6BAA6B;QACzC,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,kDAAkD;KAChE;CACF,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZKP Extension — privacy-bearing proof submissions.
|
|
3
|
+
*
|
|
4
|
+
* kash.zkp.proof-of-claim@1.0.0
|
|
5
|
+
* The on-the-wire shape a holder uses to submit a SNARK proof to a
|
|
6
|
+
* verifier. Pairs naturally with the {@link @kashscript/identity-zkp}
|
|
7
|
+
* prover surface but is transport-agnostic — verifiers can accept it
|
|
8
|
+
* over HTTP, Kafka, anywhere a Kash-Event flows.
|
|
9
|
+
*
|
|
10
|
+
* **F3 (audit) — one-shot-keypair pattern.** Every submission carries a
|
|
11
|
+
* `submitWith` discriminator that names the keypair model the envelope
|
|
12
|
+
* uses:
|
|
13
|
+
*
|
|
14
|
+
* • `"ephemeral-keypair"` — the holder mints a FRESH keypair just for
|
|
15
|
+
* this submission. The envelope's `kid` is the ephemeral DID; the
|
|
16
|
+
* verifier learns nothing about the holder's persistent identity.
|
|
17
|
+
* This is the unlinkable mode. Cross-verifier correlation requires
|
|
18
|
+
* the verifiers to combine OUT-OF-BAND signals (network, billing) —
|
|
19
|
+
* the wire format itself reveals nothing.
|
|
20
|
+
*
|
|
21
|
+
* • `"session-keypair"` — the holder uses a per-verifier session key
|
|
22
|
+
* (typically derived from a verifier-bound nonce). Submissions to
|
|
23
|
+
* the SAME verifier within the session are linkable; submissions
|
|
24
|
+
* across verifiers/sessions are not.
|
|
25
|
+
*
|
|
26
|
+
* • `"persistent-keypair"` — the holder uses their long-lived DID key.
|
|
27
|
+
* All submissions are correlatable. Use only when correlation is
|
|
28
|
+
* desired (e.g., audit-trail flows; high-trust authenticated grants).
|
|
29
|
+
*
|
|
30
|
+
* The lexicon DOES NOT enforce which discriminator is used — that is a
|
|
31
|
+
* holder choice — but verifiers MUST surface the chosen mode in their
|
|
32
|
+
* UX and decision logic.
|
|
33
|
+
*
|
|
34
|
+
* Import path: `@kashscript/lexicons/extensions/zkp`.
|
|
35
|
+
*/
|
|
36
|
+
import type { LexiconDef } from "../registry";
|
|
37
|
+
import { type ObjectSchema } from "../schema";
|
|
38
|
+
export declare const KASH_ZKP_PROOF_OF_CLAIM_NSID: "kash.zkp.proof-of-claim";
|
|
39
|
+
export declare const KASH_ZKP_PROOF_OF_CLAIM_VERSION: {
|
|
40
|
+
readonly major: 1;
|
|
41
|
+
readonly minor: 0;
|
|
42
|
+
readonly patch: 0;
|
|
43
|
+
};
|
|
44
|
+
export declare const KASH_ZKP_PROOF_OF_CLAIM_ID: "kash.zkp.proof-of-claim@1.0.0";
|
|
45
|
+
/** Keypair-model discriminator. See module docstring. */
|
|
46
|
+
export type SubmitWith = "ephemeral-keypair" | "session-keypair" | "persistent-keypair";
|
|
47
|
+
/** Supported SNARK envelopes. Mirrors `@kashscript/identity-zkp` `ProofSystem`. */
|
|
48
|
+
export type ZkpProofSystem = "groth16" | "plonk" | "fflonk";
|
|
49
|
+
export interface KashZkpProofOfClaimBody {
|
|
50
|
+
/** The claim being proven, in plain language (display-only — never signed-into-circuit). */
|
|
51
|
+
readonly claim: string;
|
|
52
|
+
/** Stable circuit id (e.g., `"kash-range-proof-on-commitment-v1"`). */
|
|
53
|
+
readonly circuitId: string;
|
|
54
|
+
/** Proof system the envelope targets. */
|
|
55
|
+
readonly system: ZkpProofSystem;
|
|
56
|
+
/** The opaque proof envelope as emitted by snarkjs (any JSON shape). */
|
|
57
|
+
readonly proof: Readonly<Record<string, unknown>>;
|
|
58
|
+
/** Public signals — ordered, snarkjs decimal-string convention. */
|
|
59
|
+
readonly publicSignals: readonly string[];
|
|
60
|
+
/** Keypair model the holder used to submit. See module docstring. */
|
|
61
|
+
readonly submitWith: SubmitWith;
|
|
62
|
+
/**
|
|
63
|
+
* OPTIONAL audience identifier when the holder bound the proof to a specific
|
|
64
|
+
* verifier (typically the verifier's DID or origin URL). Verifiers SHOULD
|
|
65
|
+
* reject submissions whose `audience` does not match their own identity.
|
|
66
|
+
*/
|
|
67
|
+
readonly audience?: string;
|
|
68
|
+
/** OPTIONAL ISO-8601 expiry. Verifiers SHOULD reject after this instant. */
|
|
69
|
+
readonly expiresAt?: string;
|
|
70
|
+
/** OPTIONAL base58btc-encoded SHA-256 over `{ proof, publicSignals, audience, expiresAt }`. */
|
|
71
|
+
readonly bindingHashB58?: string;
|
|
72
|
+
}
|
|
73
|
+
export declare const KASH_ZKP_PROOF_OF_CLAIM_BODY_SCHEMA: ObjectSchema;
|
|
74
|
+
/** All ZKP-domain lexicons. Pass to `LexiconRegistry.registerAll()`. */
|
|
75
|
+
export declare const ZKP_EXTENSION: readonly LexiconDef[];
|
|
76
|
+
//# sourceMappingURL=zkp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zkp.d.ts","sourceRoot":"","sources":["../../src/extensions/zkp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAK,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAMjD,eAAO,MAAM,4BAA4B,EAAM,yBAAkC,CAAC;AAClF,eAAO,MAAM,+BAA+B;;;;CAA4C,CAAC;AACzF,eAAO,MAAM,0BAA0B,EAAQ,+BAAwC,CAAC;AAExF,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAExF,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,uBAAuB;IACtC,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,+FAA+F;IAC/F,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,eAAO,MAAM,mCAAmC,EAAE,YAajD,CAAC;AAMF,wEAAwE;AACxE,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAS9C,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZKP Extension — privacy-bearing proof submissions.
|
|
3
|
+
*
|
|
4
|
+
* kash.zkp.proof-of-claim@1.0.0
|
|
5
|
+
* The on-the-wire shape a holder uses to submit a SNARK proof to a
|
|
6
|
+
* verifier. Pairs naturally with the {@link @kashscript/identity-zkp}
|
|
7
|
+
* prover surface but is transport-agnostic — verifiers can accept it
|
|
8
|
+
* over HTTP, Kafka, anywhere a Kash-Event flows.
|
|
9
|
+
*
|
|
10
|
+
* **F3 (audit) — one-shot-keypair pattern.** Every submission carries a
|
|
11
|
+
* `submitWith` discriminator that names the keypair model the envelope
|
|
12
|
+
* uses:
|
|
13
|
+
*
|
|
14
|
+
* • `"ephemeral-keypair"` — the holder mints a FRESH keypair just for
|
|
15
|
+
* this submission. The envelope's `kid` is the ephemeral DID; the
|
|
16
|
+
* verifier learns nothing about the holder's persistent identity.
|
|
17
|
+
* This is the unlinkable mode. Cross-verifier correlation requires
|
|
18
|
+
* the verifiers to combine OUT-OF-BAND signals (network, billing) —
|
|
19
|
+
* the wire format itself reveals nothing.
|
|
20
|
+
*
|
|
21
|
+
* • `"session-keypair"` — the holder uses a per-verifier session key
|
|
22
|
+
* (typically derived from a verifier-bound nonce). Submissions to
|
|
23
|
+
* the SAME verifier within the session are linkable; submissions
|
|
24
|
+
* across verifiers/sessions are not.
|
|
25
|
+
*
|
|
26
|
+
* • `"persistent-keypair"` — the holder uses their long-lived DID key.
|
|
27
|
+
* All submissions are correlatable. Use only when correlation is
|
|
28
|
+
* desired (e.g., audit-trail flows; high-trust authenticated grants).
|
|
29
|
+
*
|
|
30
|
+
* The lexicon DOES NOT enforce which discriminator is used — that is a
|
|
31
|
+
* holder choice — but verifiers MUST surface the chosen mode in their
|
|
32
|
+
* UX and decision logic.
|
|
33
|
+
*
|
|
34
|
+
* Import path: `@kashscript/lexicons/extensions/zkp`.
|
|
35
|
+
*/
|
|
36
|
+
import { S } from "../schema";
|
|
37
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
38
|
+
* kash.zkp.proof-of-claim@1.0.0
|
|
39
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
40
|
+
export const KASH_ZKP_PROOF_OF_CLAIM_NSID = "kash.zkp.proof-of-claim";
|
|
41
|
+
export const KASH_ZKP_PROOF_OF_CLAIM_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
42
|
+
export const KASH_ZKP_PROOF_OF_CLAIM_ID = "kash.zkp.proof-of-claim@1.0.0";
|
|
43
|
+
export const KASH_ZKP_PROOF_OF_CLAIM_BODY_SCHEMA = S.object({
|
|
44
|
+
claim: S.string({ minLength: 1, maxLength: 280 }),
|
|
45
|
+
circuitId: S.string({ minLength: 1, maxLength: 128, pattern: /^[a-z0-9][a-z0-9-]*$/ }),
|
|
46
|
+
system: S.enum("groth16", "plonk", "fflonk"),
|
|
47
|
+
proof: S.object({}, []), // open shape — system-dependent
|
|
48
|
+
publicSignals: S.array(S.string({ maxLength: 96 }), { maxItems: 32 }),
|
|
49
|
+
submitWith: S.enum("ephemeral-keypair", "session-keypair", "persistent-keypair"),
|
|
50
|
+
audience: S.optional(S.string({ minLength: 1, maxLength: 512 })),
|
|
51
|
+
expiresAt: S.optional(S.string({ format: "iso8601" })),
|
|
52
|
+
bindingHashB58: S.optional(S.string({ minLength: 32, maxLength: 64 })),
|
|
53
|
+
}, ["claim", "circuitId", "system", "proof", "publicSignals", "submitWith"]);
|
|
54
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
55
|
+
* Extension bundle
|
|
56
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
57
|
+
/** All ZKP-domain lexicons. Pass to `LexiconRegistry.registerAll()`. */
|
|
58
|
+
export const ZKP_EXTENSION = [
|
|
59
|
+
{
|
|
60
|
+
id: KASH_ZKP_PROOF_OF_CLAIM_ID,
|
|
61
|
+
nsid: KASH_ZKP_PROOF_OF_CLAIM_NSID,
|
|
62
|
+
semver: KASH_ZKP_PROOF_OF_CLAIM_VERSION,
|
|
63
|
+
bodySchema: KASH_ZKP_PROOF_OF_CLAIM_BODY_SCHEMA,
|
|
64
|
+
title: "ZKP Proof of Claim",
|
|
65
|
+
description: "Wire envelope for submitting a SNARK proof to a verifier. Carries a submitWith discriminator that names the keypair-model the envelope uses, so verifiers can reason about linkability.",
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
//# sourceMappingURL=zkp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zkp.js","sourceRoot":"","sources":["../../src/extensions/zkp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,CAAC,EAAqB,MAAM,WAAW,CA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CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;CACvE,EACD,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,CAAC,CACzE,CAAC;AAEF;;uEAEuE;AAEvE,wEAAwE;AACxE,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD;QACE,EAAE,EAAE,0BAA0B;QAC9B,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE,+BAA+B;QACvC,UAAU,EAAE,mCAAmC;QAC/C,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,yLAAyL;KACvM;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @kashscript/lexicons — main export surface.
|
|
3
|
+
*
|
|
4
|
+
* Exposes:
|
|
5
|
+
* - Framework (types, schema DSL, semver, envelope) — the Box.
|
|
6
|
+
* - Registry + Engine (LexiconRegistry, validateEvent, getSchemaDefinition).
|
|
7
|
+
* - Standard Library (identity-tier lexicons) — the agnostic core Content.
|
|
8
|
+
*
|
|
9
|
+
* Domain Extensions (Social, Trade, …) are NOT auto-exported here.
|
|
10
|
+
* They live under subpath imports:
|
|
11
|
+
* - @kashscript/lexicons/extensions/social
|
|
12
|
+
* - @kashscript/lexicons/extensions/trade
|
|
13
|
+
*
|
|
14
|
+
* This package is zero-dependency. No network, no crypto, no storage —
|
|
15
|
+
* pure data modelling and validation.
|
|
16
|
+
*/
|
|
17
|
+
export * from "./types";
|
|
18
|
+
export * from "./schema";
|
|
19
|
+
export * from "./semver";
|
|
20
|
+
export * from "./envelope";
|
|
21
|
+
export * from "./registry";
|
|
22
|
+
export * from "./engine";
|
|
23
|
+
export * from "./json-schema";
|
|
24
|
+
export * from "./lexicons";
|
|
25
|
+
export declare const LEXICONS_FRAMEWORK_VERSION: "1.0.0";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAI9B,cAAc,YAAY,CAAC;AAE3B,eAAO,MAAM,0BAA0B,EAAG,OAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @kashscript/lexicons — main export surface.
|
|
3
|
+
*
|
|
4
|
+
* Exposes:
|
|
5
|
+
* - Framework (types, schema DSL, semver, envelope) — the Box.
|
|
6
|
+
* - Registry + Engine (LexiconRegistry, validateEvent, getSchemaDefinition).
|
|
7
|
+
* - Standard Library (identity-tier lexicons) — the agnostic core Content.
|
|
8
|
+
*
|
|
9
|
+
* Domain Extensions (Social, Trade, …) are NOT auto-exported here.
|
|
10
|
+
* They live under subpath imports:
|
|
11
|
+
* - @kashscript/lexicons/extensions/social
|
|
12
|
+
* - @kashscript/lexicons/extensions/trade
|
|
13
|
+
*
|
|
14
|
+
* This package is zero-dependency. No network, no crypto, no storage —
|
|
15
|
+
* pure data modelling and validation.
|
|
16
|
+
*/
|
|
17
|
+
export * from "./types";
|
|
18
|
+
export * from "./schema";
|
|
19
|
+
export * from "./semver";
|
|
20
|
+
export * from "./envelope";
|
|
21
|
+
export * from "./registry";
|
|
22
|
+
export * from "./engine";
|
|
23
|
+
export * from "./json-schema";
|
|
24
|
+
// Standard Library (identity tier) — lexicons consumers will almost always want.
|
|
25
|
+
// Domain content (social, trade, neuron) ships as separately-imported Extensions.
|
|
26
|
+
export * from "./lexicons";
|
|
27
|
+
export const LEXICONS_FRAMEWORK_VERSION = "1.0.0";
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAE9B,iFAAiF;AACjF,kFAAkF;AAClF,cAAc,YAAY,CAAC;AAE3B,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { type Schema } from "./schema";
|
|
14
|
+
/** Minimal JSON-Schema object. Booleans (`true`/`false` schemas) are NOT emitted. */
|
|
15
|
+
export type JsonSchema = Readonly<Record<string, unknown>>;
|
|
16
|
+
/** Convert any internal Schema to a JSON-Schema-Draft-2020-12 object. */
|
|
17
|
+
export declare function toJsonSchema(schema: Schema): JsonSchema;
|
|
18
|
+
//# sourceMappingURL=json-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../src/json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAQL,KAAK,MAAM,EAIZ,MAAM,UAAU,CAAC;AAElB,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAkB3D,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CA0BvD"}
|