@kashscript/lexicons 0.1.0 → 0.1.2
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/README.md +29 -29
- package/dist/extensions/civic.d.ts +32 -0
- package/dist/extensions/civic.d.ts.map +1 -0
- package/dist/extensions/civic.js +89 -0
- package/dist/extensions/civic.js.map +1 -0
- package/dist/extensions/community.d.ts +33 -0
- package/dist/extensions/community.d.ts.map +1 -0
- package/dist/extensions/community.js +88 -0
- package/dist/extensions/community.js.map +1 -0
- package/dist/extensions/education.d.ts +36 -0
- package/dist/extensions/education.d.ts.map +1 -0
- package/dist/extensions/education.js +97 -0
- package/dist/extensions/education.js.map +1 -0
- package/dist/types.d.ts +3 -3
- package/dist/types.js +3 -3
- package/package.json +16 -1
- package/src/extensions/civic.ts +117 -0
- package/src/extensions/community.ts +114 -0
- package/src/extensions/education.ts +116 -0
- package/src/types.ts +3 -3
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ A *lexicon* is the Kash equivalent of an AT-Protocol record schema: a
|
|
|
10
10
|
versioned, NSID-addressed JSON shape that describes what valid `kash.*`
|
|
11
11
|
records look like. This package gives you the primitives to **define**,
|
|
12
12
|
**register**, and **validate** lexicons — but ships zero domain content
|
|
13
|
-
out of the box. The domain extensions (`social`, `trade`, `zkp
|
|
14
|
-
explicit subpath imports.
|
|
13
|
+
out of the box. The domain extensions (`social`, `trade`, `zkp`,
|
|
14
|
+
`education`, `civic`, `community`) are explicit subpath imports.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
@@ -19,51 +19,51 @@ explicit subpath imports.
|
|
|
19
19
|
|
|
20
20
|
| Subpath | Purpose |
|
|
21
21
|
|----------------------------------------|------------------------------------------------------|
|
|
22
|
-
| `@kashscript/lexicons` | Default —
|
|
23
|
-
| `@kashscript/lexicons/envelope` |
|
|
24
|
-
| `@kashscript/lexicons/schema` | Schema DSL — `
|
|
22
|
+
| `@kashscript/lexicons` | Default — the framework + identity-tier `STANDARD_LIBRARY` |
|
|
23
|
+
| `@kashscript/lexicons/envelope` | Kash-Event envelope shape (header + body + signature) + `RecordRef` |
|
|
24
|
+
| `@kashscript/lexicons/schema` | Schema DSL — the `S` builder (`S.object`, `S.string`, …) + `validate()` |
|
|
25
25
|
| `@kashscript/lexicons/registry` | `LexiconRegistry` — register, lookup, version-resolve |
|
|
26
|
-
| `@kashscript/lexicons/engine` | `
|
|
26
|
+
| `@kashscript/lexicons/engine` | `validateEvent` / `validateBody` / `getSchemaDefinition` |
|
|
27
27
|
| `@kashscript/lexicons/json-schema` | Export lexicons as JSON Schema (draft 2020-12) |
|
|
28
28
|
| `@kashscript/lexicons/semver` | Strict semver for lexicon evolution |
|
|
29
29
|
| `@kashscript/lexicons/extensions/social` | The `kash.social.*` vocabulary |
|
|
30
30
|
| `@kashscript/lexicons/extensions/trade` | The `kash.trade.*` vocabulary |
|
|
31
31
|
| `@kashscript/lexicons/extensions/zkp` | The `kash.zkp.*` vocabulary |
|
|
32
|
+
| `@kashscript/lexicons/extensions/{education,civic,community}` | Further opt-in vocabularies |
|
|
32
33
|
|
|
33
34
|
---
|
|
34
35
|
|
|
35
36
|
## Quickstart
|
|
36
37
|
|
|
37
38
|
```typescript
|
|
38
|
-
import {
|
|
39
|
+
import { S } from "@kashscript/lexicons/schema";
|
|
39
40
|
import { LexiconRegistry } from "@kashscript/lexicons/registry";
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
// 1. Define a lexicon
|
|
43
|
-
const myPost = {
|
|
44
|
-
nsid: "com.example.post",
|
|
45
|
-
version: "1.0.0",
|
|
46
|
-
shape: object({
|
|
47
|
-
text: string({ maxLength: 280 }),
|
|
48
|
-
createdAt: number(),
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// 2. Register it
|
|
53
|
-
const registry = new LexiconRegistry();
|
|
54
|
-
registry.register(myPost);
|
|
41
|
+
import { validateBody, validateEvent } from "@kashscript/lexicons/engine";
|
|
55
42
|
|
|
56
|
-
//
|
|
57
|
-
const
|
|
43
|
+
// 1. Define a body schema with the `S` builder (3rd arg of S.object = required keys).
|
|
44
|
+
const noteSchema = S.object(
|
|
58
45
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
text: "hello world",
|
|
62
|
-
createdAt: Date.now(),
|
|
46
|
+
text: S.string({ maxLength: 280 }),
|
|
47
|
+
createdAt: S.string({ format: "iso8601" }),
|
|
63
48
|
},
|
|
49
|
+
["text", "createdAt"],
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// 2. Register it under `<nsid>@<semver>` (register() is chainable).
|
|
53
|
+
const registry = new LexiconRegistry();
|
|
54
|
+
registry.register("com.example.note@1.0.0", noteSchema, { title: "Example Note" });
|
|
55
|
+
|
|
56
|
+
// 3a. Validate a record body before signing it.
|
|
57
|
+
const bodyResult = validateBody(
|
|
58
|
+
"com.example.note@1.0.0",
|
|
59
|
+
{ text: "hello world", createdAt: new Date().toISOString() },
|
|
64
60
|
registry,
|
|
65
61
|
);
|
|
66
|
-
if (!
|
|
62
|
+
if (!bodyResult.ok) console.error(bodyResult.errors); // [{ path, message, received }]
|
|
63
|
+
|
|
64
|
+
// 3b. Or validate a full signed Kash-Event envelope (header.lexicon picks the schema).
|
|
65
|
+
const eventResult = validateEvent(incomingEvent, registry); // incomingEvent: unknown
|
|
66
|
+
if (eventResult.ok) console.log("valid:", eventResult.value.header.lexicon);
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
---
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Civic Extension — governance-domain lexicons (Cliffhase-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.civic.permit@1.0.0 — a permit / licence issued by an agency
|
|
5
|
+
* kash.civic.petition@1.0.0 — a citizen petition with optional pledge
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/civic`.
|
|
8
|
+
*
|
|
9
|
+
* Pairs with the Cliffhase program at
|
|
10
|
+
* `apps/kashscript/app/studio/cliffhase`.
|
|
11
|
+
*/
|
|
12
|
+
import type { LexiconDef } from "../registry";
|
|
13
|
+
import { type ObjectSchema } from "../schema";
|
|
14
|
+
export declare const KASH_CIVIC_PERMIT_NSID: "kash.civic.permit";
|
|
15
|
+
export declare const KASH_CIVIC_PERMIT_VERSION: {
|
|
16
|
+
readonly major: 1;
|
|
17
|
+
readonly minor: 0;
|
|
18
|
+
readonly patch: 0;
|
|
19
|
+
};
|
|
20
|
+
export declare const KASH_CIVIC_PERMIT_ID: "kash.civic.permit@1.0.0";
|
|
21
|
+
export type PermitKind = "driving" | "professional" | "business" | "import-export" | "construction" | "occupancy" | "food-handling" | "other";
|
|
22
|
+
export declare const KASH_CIVIC_PERMIT_BODY_SCHEMA: ObjectSchema;
|
|
23
|
+
export declare const KASH_CIVIC_PETITION_NSID: "kash.civic.petition";
|
|
24
|
+
export declare const KASH_CIVIC_PETITION_VERSION: {
|
|
25
|
+
readonly major: 1;
|
|
26
|
+
readonly minor: 0;
|
|
27
|
+
readonly patch: 0;
|
|
28
|
+
};
|
|
29
|
+
export declare const KASH_CIVIC_PETITION_ID: "kash.civic.petition@1.0.0";
|
|
30
|
+
export declare const KASH_CIVIC_PETITION_BODY_SCHEMA: ObjectSchema;
|
|
31
|
+
export declare const CIVIC_EXTENSION: readonly LexiconDef[];
|
|
32
|
+
//# sourceMappingURL=civic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"civic.d.ts","sourceRoot":"","sources":["../../src/extensions/civic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAK,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAUjD,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,GACT,cAAc,GACd,UAAU,GACV,eAAe,GACf,cAAc,GACd,WAAW,GACX,eAAe,GACf,OAAO,CAAC;AAEZ,eAAO,MAAM,6BAA6B,EAAE,YAyB3C,CAAC;AASF,eAAO,MAAM,wBAAwB,EAAM,qBAA8B,CAAC;AAC1E,eAAO,MAAM,2BAA2B;;;;CAA4C,CAAC;AACrF,eAAO,MAAM,sBAAsB,EAAQ,2BAAoC,CAAC;AAEhF,eAAO,MAAM,+BAA+B,EAAE,YAkB7C,CAAC;AAMF,eAAO,MAAM,eAAe,EAAE,SAAS,UAAU,EAiBhD,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Civic Extension — governance-domain lexicons (Cliffhase-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.civic.permit@1.0.0 — a permit / licence issued by an agency
|
|
5
|
+
* kash.civic.petition@1.0.0 — a citizen petition with optional pledge
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/civic`.
|
|
8
|
+
*
|
|
9
|
+
* Pairs with the Cliffhase program at
|
|
10
|
+
* `apps/kashscript/app/studio/cliffhase`.
|
|
11
|
+
*/
|
|
12
|
+
import { S } from "../schema";
|
|
13
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
14
|
+
* kash.civic.permit@1.0.0
|
|
15
|
+
*
|
|
16
|
+
* A typed record of a permit / licence / certification issued by a
|
|
17
|
+
* government body. Holder presents this (or a ZK disclosure of part
|
|
18
|
+
* of it) to anyone who needs to confirm the credential.
|
|
19
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
20
|
+
export const KASH_CIVIC_PERMIT_NSID = "kash.civic.permit";
|
|
21
|
+
export const KASH_CIVIC_PERMIT_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
22
|
+
export const KASH_CIVIC_PERMIT_ID = "kash.civic.permit@1.0.0";
|
|
23
|
+
export const KASH_CIVIC_PERMIT_BODY_SCHEMA = S.object({
|
|
24
|
+
/** Holder DID. */
|
|
25
|
+
holderDid: S.string({ format: "did-ks" }),
|
|
26
|
+
/** Issuing agency identifier — agency's own short code. */
|
|
27
|
+
issuingAgency: S.string({ minLength: 1, maxLength: 64 }),
|
|
28
|
+
/** Permit / licence number on the agency's system. */
|
|
29
|
+
permitNumber: S.string({ minLength: 1, maxLength: 64 }),
|
|
30
|
+
/** What kind of permit. */
|
|
31
|
+
kind: S.enum("driving", "professional", "business", "import-export", "construction", "occupancy", "food-handling", "other"),
|
|
32
|
+
/** ISO date when it was issued. */
|
|
33
|
+
issuedAt: S.string({ format: "iso8601" }),
|
|
34
|
+
/** ISO date when it expires — required so a verifier can check freshness. */
|
|
35
|
+
expiresAt: S.string({ format: "iso8601" }),
|
|
36
|
+
/** Scope of authority granted (free-text). */
|
|
37
|
+
scope: S.string({ minLength: 1, maxLength: 500 }),
|
|
38
|
+
/** Jurisdiction code (ISO-3166-2 or local extension). */
|
|
39
|
+
jurisdiction: S.string({ minLength: 1, maxLength: 16 }),
|
|
40
|
+
/** Optional pointer to the on-paper / on-system source record. */
|
|
41
|
+
sourceUri: S.optional(S.string({ minLength: 1, maxLength: 500 })),
|
|
42
|
+
}, ["holderDid", "issuingAgency", "permitNumber", "kind", "issuedAt", "expiresAt", "scope", "jurisdiction"]);
|
|
43
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
44
|
+
* kash.civic.petition@1.0.0
|
|
45
|
+
*
|
|
46
|
+
* A citizen-initiated petition record. Other citizens sign their
|
|
47
|
+
* endorsement as separate envelopes referencing this record's cid.
|
|
48
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
49
|
+
export const KASH_CIVIC_PETITION_NSID = "kash.civic.petition";
|
|
50
|
+
export const KASH_CIVIC_PETITION_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
51
|
+
export const KASH_CIVIC_PETITION_ID = "kash.civic.petition@1.0.0";
|
|
52
|
+
export const KASH_CIVIC_PETITION_BODY_SCHEMA = S.object({
|
|
53
|
+
/** Petition title — 1 sentence, displayed verbatim. */
|
|
54
|
+
title: S.string({ minLength: 1, maxLength: 200 }),
|
|
55
|
+
/** Long-form description. */
|
|
56
|
+
body: S.string({ minLength: 1, maxLength: 50_000 }),
|
|
57
|
+
/** Target agency / official the petition addresses. */
|
|
58
|
+
targetAgency: S.string({ minLength: 1, maxLength: 200 }),
|
|
59
|
+
/** Jurisdiction the petition belongs to. */
|
|
60
|
+
jurisdiction: S.string({ minLength: 1, maxLength: 16 }),
|
|
61
|
+
/** Optional ISO date by which the petitioner needs a response. */
|
|
62
|
+
responseBy: S.optional(S.string({ format: "iso8601" })),
|
|
63
|
+
/** Minimum signatures required for this petition to be valid in the host system. */
|
|
64
|
+
quorumTarget: S.optional(S.number({ min: 1, max: 10_000_000 })),
|
|
65
|
+
/** ISO date the petition was opened for signatures. */
|
|
66
|
+
openedAt: S.string({ format: "iso8601" }),
|
|
67
|
+
}, ["title", "body", "targetAgency", "jurisdiction", "openedAt"]);
|
|
68
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
69
|
+
* Extension bundle
|
|
70
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
71
|
+
export const CIVIC_EXTENSION = [
|
|
72
|
+
{
|
|
73
|
+
id: KASH_CIVIC_PERMIT_ID,
|
|
74
|
+
nsid: KASH_CIVIC_PERMIT_NSID,
|
|
75
|
+
semver: KASH_CIVIC_PERMIT_VERSION,
|
|
76
|
+
bodySchema: KASH_CIVIC_PERMIT_BODY_SCHEMA,
|
|
77
|
+
title: "Civic Permit",
|
|
78
|
+
description: "Government-issued permit / licence record.",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: KASH_CIVIC_PETITION_ID,
|
|
82
|
+
nsid: KASH_CIVIC_PETITION_NSID,
|
|
83
|
+
semver: KASH_CIVIC_PETITION_VERSION,
|
|
84
|
+
bodySchema: KASH_CIVIC_PETITION_BODY_SCHEMA,
|
|
85
|
+
title: "Civic Petition",
|
|
86
|
+
description: "A citizen-initiated petition addressed to a government body.",
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
//# sourceMappingURL=civic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"civic.js","sourceRoot":"","sources":["../../src/extensions/civic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,CAAC,EAAqB,MAAM,WAAW,CAAC;AAEjD;;;;;;uEAMuE;AAEvE,MAAM,CAAC,MAAM,sBAAsB,GAAM,mBAA4B,CAAC;AACtE,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAW,CAAC;AACnF,MAAM,CAAC,MAAM,oBAAoB,GAAQ,yBAAkC,CAAC;AAY5E,MAAM,CAAC,MAAM,6BAA6B,GAAiB,CAAC,CAAC,MAAM,CACjE;IACE,kBAAkB;IAClB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACzC,2DAA2D;IAC3D,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACxD,sDAAsD;IACtD,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACvD,2BAA2B;IAC3B,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EACtD,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,CACtD;IACD,mCAAmC;IACnC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACzC,6EAA6E;IAC7E,SA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,EAAE,CAAC;IACxD,4CAA4C;IAC5C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACvD,kEAAkE;IAClE,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACvD,oFAAoF;IACpF,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;IAC/D,uDAAuD;IACvD,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;CAC1C,EACD,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,CAAC,CAC9D,CAAC;AAEF;;uEAEuE;AAEvE,MAAM,CAAC,MAAM,eAAe,GAA0B;IACpD;QACE,EAAE,EAAE,oBAAoB;QACxB,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,yBAAyB;QACjC,UAAU,EAAE,6BAA6B;QACzC,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,4CAA4C;KAC1D;IACD;QACE,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,wBAAwB;QAC9B,MAAM,EAAE,2BAA2B;QACnC,UAAU,EAAE,+BAA+B;QAC3C,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,8DAA8D;KAC5E;CACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Community Extension — community-domain lexicons (Acmecase-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.community.membership@1.0.0 — verifiable community-member record
|
|
5
|
+
* kash.community.aid-claim@1.0.0 — a member's claim against a mutual-aid pool
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/community`.
|
|
8
|
+
*
|
|
9
|
+
* Pairs with the Acmecase program at
|
|
10
|
+
* `apps/kashscript/app/studio/acmecase`.
|
|
11
|
+
*/
|
|
12
|
+
import type { LexiconDef } from "../registry";
|
|
13
|
+
import { type ObjectSchema } from "../schema";
|
|
14
|
+
export declare const KASH_COMMUNITY_MEMBERSHIP_NSID: "kash.community.membership";
|
|
15
|
+
export declare const KASH_COMMUNITY_MEMBERSHIP_VERSION: {
|
|
16
|
+
readonly major: 1;
|
|
17
|
+
readonly minor: 0;
|
|
18
|
+
readonly patch: 0;
|
|
19
|
+
};
|
|
20
|
+
export declare const KASH_COMMUNITY_MEMBERSHIP_ID: "kash.community.membership@1.0.0";
|
|
21
|
+
export type MembershipStatus = "active" | "lapsed" | "suspended" | "honorary";
|
|
22
|
+
export declare const KASH_COMMUNITY_MEMBERSHIP_BODY_SCHEMA: ObjectSchema;
|
|
23
|
+
export declare const KASH_COMMUNITY_AID_CLAIM_NSID: "kash.community.aid-claim";
|
|
24
|
+
export declare const KASH_COMMUNITY_AID_CLAIM_VERSION: {
|
|
25
|
+
readonly major: 1;
|
|
26
|
+
readonly minor: 0;
|
|
27
|
+
readonly patch: 0;
|
|
28
|
+
};
|
|
29
|
+
export declare const KASH_COMMUNITY_AID_CLAIM_ID: "kash.community.aid-claim@1.0.0";
|
|
30
|
+
export type AidClaimKind = "medical" | "rent" | "utilities" | "education" | "funeral" | "emergency" | "other";
|
|
31
|
+
export declare const KASH_COMMUNITY_AID_CLAIM_BODY_SCHEMA: ObjectSchema;
|
|
32
|
+
export declare const COMMUNITY_EXTENSION: readonly LexiconDef[];
|
|
33
|
+
//# sourceMappingURL=community.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../src/extensions/community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAK,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAUjD,eAAO,MAAM,8BAA8B,EAAM,2BAAoC,CAAC;AACtF,eAAO,MAAM,iCAAiC;;;;CAA4C,CAAC;AAC3F,eAAO,MAAM,4BAA4B,EAAQ,iCAA0C,CAAC;AAE5F,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;AAE9E,eAAO,MAAM,qCAAqC,EAAE,YAkBnD,CAAC;AAUF,eAAO,MAAM,6BAA6B,EAAM,0BAAmC,CAAC;AACpF,eAAO,MAAM,gCAAgC;;;;CAA4C,CAAC;AAC1F,eAAO,MAAM,2BAA2B,EAAQ,gCAAyC,CAAC;AAE1F,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,MAAM,GACN,WAAW,GACX,WAAW,GACX,SAAS,GACT,WAAW,GACX,OAAO,CAAC;AAEZ,eAAO,MAAM,oCAAoC,EAAE,YAoBlD,CAAC;AAMF,eAAO,MAAM,mBAAmB,EAAE,SAAS,UAAU,EAiBpD,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Community Extension — community-domain lexicons (Acmecase-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.community.membership@1.0.0 — verifiable community-member record
|
|
5
|
+
* kash.community.aid-claim@1.0.0 — a member's claim against a mutual-aid pool
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/community`.
|
|
8
|
+
*
|
|
9
|
+
* Pairs with the Acmecase program at
|
|
10
|
+
* `apps/kashscript/app/studio/acmecase`.
|
|
11
|
+
*/
|
|
12
|
+
import { S } from "../schema";
|
|
13
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
14
|
+
* kash.community.membership@1.0.0
|
|
15
|
+
*
|
|
16
|
+
* A community (cooperative, mosque committee, building society)
|
|
17
|
+
* signs one record per current member. Holder selectively discloses
|
|
18
|
+
* membership to others without revealing their identity if desired.
|
|
19
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
20
|
+
export const KASH_COMMUNITY_MEMBERSHIP_NSID = "kash.community.membership";
|
|
21
|
+
export const KASH_COMMUNITY_MEMBERSHIP_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
22
|
+
export const KASH_COMMUNITY_MEMBERSHIP_ID = "kash.community.membership@1.0.0";
|
|
23
|
+
export const KASH_COMMUNITY_MEMBERSHIP_BODY_SCHEMA = S.object({
|
|
24
|
+
/** Member's DID — kept hidden in many disclosures. */
|
|
25
|
+
memberDid: S.string({ format: "did-ks" }),
|
|
26
|
+
/** Community's short codename (e.g., "f7-residents", "lahore-coop-1"). */
|
|
27
|
+
communityCode: S.string({ minLength: 1, maxLength: 64, pattern: /^[a-z0-9][a-z0-9_-]*$/ }),
|
|
28
|
+
/** Display name of the community. */
|
|
29
|
+
communityName: S.string({ minLength: 1, maxLength: 200 }),
|
|
30
|
+
/** Status of the membership at issue time. */
|
|
31
|
+
status: S.enum("active", "lapsed", "suspended", "honorary"),
|
|
32
|
+
/** ISO date the member joined. */
|
|
33
|
+
joinedAt: S.string({ format: "iso8601" }),
|
|
34
|
+
/** ISO date this attestation expires — invites periodic re-issue. */
|
|
35
|
+
expiresAt: S.string({ format: "iso8601" }),
|
|
36
|
+
/** Optional member role within the community. */
|
|
37
|
+
role: S.optional(S.string({ minLength: 1, maxLength: 64 })),
|
|
38
|
+
}, ["memberDid", "communityCode", "communityName", "status", "joinedAt", "expiresAt"]);
|
|
39
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
40
|
+
* kash.community.aid-claim@1.0.0
|
|
41
|
+
*
|
|
42
|
+
* A member's signed claim against a community mutual-aid pool.
|
|
43
|
+
* Pairs with the SUBSCRIPTION-based pool in
|
|
44
|
+
* `packages/trade-sdk/use-cases/acmecase-mutual-aid`.
|
|
45
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
46
|
+
export const KASH_COMMUNITY_AID_CLAIM_NSID = "kash.community.aid-claim";
|
|
47
|
+
export const KASH_COMMUNITY_AID_CLAIM_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
48
|
+
export const KASH_COMMUNITY_AID_CLAIM_ID = "kash.community.aid-claim@1.0.0";
|
|
49
|
+
export const KASH_COMMUNITY_AID_CLAIM_BODY_SCHEMA = S.object({
|
|
50
|
+
/** Claimant's DID. */
|
|
51
|
+
claimantDid: S.string({ format: "did-ks" }),
|
|
52
|
+
/** Pool's manifest id (the Trade SUBSCRIPTION manifest the claim draws from). */
|
|
53
|
+
poolManifestId: S.string({ minLength: 1, maxLength: 200 }),
|
|
54
|
+
/** Kind of need. */
|
|
55
|
+
kind: S.enum("medical", "rent", "utilities", "education", "funeral", "emergency", "other"),
|
|
56
|
+
/** Amount requested, in base units (decimal-stringified bigint to avoid JSON number loss). */
|
|
57
|
+
amountBaseUnits: S.string({ minLength: 1, maxLength: 80, pattern: /^[0-9]+$/ }),
|
|
58
|
+
/** Currency code (e.g., "PKR"). */
|
|
59
|
+
currency: S.string({ minLength: 1, maxLength: 16 }),
|
|
60
|
+
/** Free-text justification — what the claim is for. */
|
|
61
|
+
justification: S.string({ minLength: 1, maxLength: 5_000 }),
|
|
62
|
+
/** Optional pointer to supporting documents on a PDS. */
|
|
63
|
+
supportingDocsCid: S.optional(S.string({ format: "cid" })),
|
|
64
|
+
/** ISO date the claim was filed. */
|
|
65
|
+
filedAt: S.string({ format: "iso8601" }),
|
|
66
|
+
}, ["claimantDid", "poolManifestId", "kind", "amountBaseUnits", "currency", "justification", "filedAt"]);
|
|
67
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
68
|
+
* Extension bundle
|
|
69
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
70
|
+
export const COMMUNITY_EXTENSION = [
|
|
71
|
+
{
|
|
72
|
+
id: KASH_COMMUNITY_MEMBERSHIP_ID,
|
|
73
|
+
nsid: KASH_COMMUNITY_MEMBERSHIP_NSID,
|
|
74
|
+
semver: KASH_COMMUNITY_MEMBERSHIP_VERSION,
|
|
75
|
+
bodySchema: KASH_COMMUNITY_MEMBERSHIP_BODY_SCHEMA,
|
|
76
|
+
title: "Community Membership",
|
|
77
|
+
description: "Verifiable community-member record issued by a community admin.",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: KASH_COMMUNITY_AID_CLAIM_ID,
|
|
81
|
+
nsid: KASH_COMMUNITY_AID_CLAIM_NSID,
|
|
82
|
+
semver: KASH_COMMUNITY_AID_CLAIM_VERSION,
|
|
83
|
+
bodySchema: KASH_COMMUNITY_AID_CLAIM_BODY_SCHEMA,
|
|
84
|
+
title: "Community Aid Claim",
|
|
85
|
+
description: "A member's signed claim against a community mutual-aid pool.",
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
//# sourceMappingURL=community.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community.js","sourceRoot":"","sources":["../../src/extensions/community.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,CAAC,EAAqB,MAAM,WAAW,CAAC;AAEjD;;;;;;uEAMuE;AAEvE,MAAM,CAAC,MAAM,8BAA8B,GAAM,2BAAoC,CAAC;AACtF,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAW,CAAC;AAC3F,MAAM,CAAC,MAAM,4BAA4B,GAAQ,iCAA0C,CAAC;AAI5F,MAAM,CAAC,MAAM,qCAAqC,GAAiB,CAAC,CAAC,MAAM,CACzE;IACE,sDAAsD;IACtD,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACzC,0EAA0E;IAC1E,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC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AC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Education Extension — academia-domain lexicons (Jinnahnook-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.education.transcript@1.0.0 — a course / degree transcript record
|
|
5
|
+
* kash.education.peer-review@1.0.0 — a peer-review of an academic work
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/education`.
|
|
8
|
+
*
|
|
9
|
+
* The Foundry core never auto-loads this extension. Consumers register
|
|
10
|
+
* `EDUCATION_EXTENSION` against their `LexiconRegistry` to opt in to
|
|
11
|
+
* academic-domain validation. Pairs with the Jinnahnook program at
|
|
12
|
+
* `apps/kashscript/app/studio/jinnahnook`.
|
|
13
|
+
*/
|
|
14
|
+
import type { LexiconDef } from "../registry";
|
|
15
|
+
import { type ObjectSchema } from "../schema";
|
|
16
|
+
export declare const KASH_EDU_TRANSCRIPT_NSID: "kash.education.transcript";
|
|
17
|
+
export declare const KASH_EDU_TRANSCRIPT_VERSION: {
|
|
18
|
+
readonly major: 1;
|
|
19
|
+
readonly minor: 0;
|
|
20
|
+
readonly patch: 0;
|
|
21
|
+
};
|
|
22
|
+
export declare const KASH_EDU_TRANSCRIPT_ID: "kash.education.transcript@1.0.0";
|
|
23
|
+
export type CreditKind = "course" | "thesis" | "internship" | "lab" | "seminar";
|
|
24
|
+
export declare const KASH_EDU_TRANSCRIPT_BODY_SCHEMA: ObjectSchema;
|
|
25
|
+
export declare const KASH_EDU_PEER_REVIEW_NSID: "kash.education.peer-review";
|
|
26
|
+
export declare const KASH_EDU_PEER_REVIEW_VERSION: {
|
|
27
|
+
readonly major: 1;
|
|
28
|
+
readonly minor: 0;
|
|
29
|
+
readonly patch: 0;
|
|
30
|
+
};
|
|
31
|
+
export declare const KASH_EDU_PEER_REVIEW_ID: "kash.education.peer-review@1.0.0";
|
|
32
|
+
export type ReviewVerdict = "accept" | "minor-revisions" | "major-revisions" | "reject";
|
|
33
|
+
export declare const KASH_EDU_PEER_REVIEW_BODY_SCHEMA: ObjectSchema;
|
|
34
|
+
/** Education-domain lexicons. Pass to `LexiconRegistry.registerAll()`. */
|
|
35
|
+
export declare const EDUCATION_EXTENSION: readonly LexiconDef[];
|
|
36
|
+
//# sourceMappingURL=education.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"education.d.ts","sourceRoot":"","sources":["../../src/extensions/education.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAK,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAWjD,eAAO,MAAM,wBAAwB,EAAM,2BAAoC,CAAC;AAChF,eAAO,MAAM,2BAA2B;;;;CAA4C,CAAC;AACrF,eAAO,MAAM,sBAAsB,EAAQ,iCAA0C,CAAC;AAEtF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAEhF,eAAO,MAAM,+BAA+B,EAAE,YAwB7C,CAAC;AAUF,eAAO,MAAM,yBAAyB,EAAM,4BAAqC,CAAC;AAClF,eAAO,MAAM,4BAA4B;;;;CAA4C,CAAC;AACtF,eAAO,MAAM,uBAAuB,EAAQ,kCAA2C,CAAC;AAExF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,QAAQ,CAAC;AAExF,eAAO,MAAM,gCAAgC,EAAE,YAmB9C,CAAC;AAMF,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,EAAE,SAAS,UAAU,EAiBpD,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Education Extension — academia-domain lexicons (Jinnahnook-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.education.transcript@1.0.0 — a course / degree transcript record
|
|
5
|
+
* kash.education.peer-review@1.0.0 — a peer-review of an academic work
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/education`.
|
|
8
|
+
*
|
|
9
|
+
* The Foundry core never auto-loads this extension. Consumers register
|
|
10
|
+
* `EDUCATION_EXTENSION` against their `LexiconRegistry` to opt in to
|
|
11
|
+
* academic-domain validation. Pairs with the Jinnahnook program at
|
|
12
|
+
* `apps/kashscript/app/studio/jinnahnook`.
|
|
13
|
+
*/
|
|
14
|
+
import { S } from "../schema";
|
|
15
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
16
|
+
* kash.education.transcript@1.0.0
|
|
17
|
+
*
|
|
18
|
+
* Issuer (a registrar / institution) signs one record per
|
|
19
|
+
* course-or-degree credit awarded to a student. The student holds
|
|
20
|
+
* their transcript as a collection of these records and can
|
|
21
|
+
* selectively disclose individual entries via @kashscript/identity-zkp.
|
|
22
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
23
|
+
export const KASH_EDU_TRANSCRIPT_NSID = "kash.education.transcript";
|
|
24
|
+
export const KASH_EDU_TRANSCRIPT_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
25
|
+
export const KASH_EDU_TRANSCRIPT_ID = "kash.education.transcript@1.0.0";
|
|
26
|
+
export const KASH_EDU_TRANSCRIPT_BODY_SCHEMA = S.object({
|
|
27
|
+
/** DID of the student this transcript entry is about. */
|
|
28
|
+
studentDid: S.string({ format: "did-ks" }),
|
|
29
|
+
/** Stable institutional identifier for the course / unit. */
|
|
30
|
+
courseCode: S.string({ minLength: 1, maxLength: 32, pattern: /^[A-Z0-9][A-Z0-9-]{0,31}$/ }),
|
|
31
|
+
/** Display title — kept separate from courseCode so the wire shape stays stable across rename. */
|
|
32
|
+
courseTitle: S.string({ minLength: 1, maxLength: 200 }),
|
|
33
|
+
/** Kind of credit. */
|
|
34
|
+
kind: S.enum("course", "thesis", "internship", "lab", "seminar"),
|
|
35
|
+
/** Credit units (e.g., 3 for a 3-credit course). */
|
|
36
|
+
credits: S.number({ min: 0, max: 200 }),
|
|
37
|
+
/** Grade — institution-specific letter / score / pass-fail tag. */
|
|
38
|
+
grade: S.string({ minLength: 1, maxLength: 8 }),
|
|
39
|
+
/** ISO date the credit was awarded. */
|
|
40
|
+
awardedAt: S.string({ format: "iso8601" }),
|
|
41
|
+
/** Optional advisor / instructor of record. */
|
|
42
|
+
instructorDid: S.optional(S.string({ format: "did-ks" })),
|
|
43
|
+
/** Optional human-readable notes. */
|
|
44
|
+
notes: S.optional(S.string({ maxLength: 1000 })),
|
|
45
|
+
}, [
|
|
46
|
+
"studentDid", "courseCode", "courseTitle", "kind", "credits", "grade", "awardedAt",
|
|
47
|
+
]);
|
|
48
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
49
|
+
* kash.education.peer-review@1.0.0
|
|
50
|
+
*
|
|
51
|
+
* A reviewer's signed assessment of an academic work (paper, thesis
|
|
52
|
+
* chapter, conference submission). Used by Jinnahnook for the peer-
|
|
53
|
+
* review surface; can be anonymised at disclosure time via ZK.
|
|
54
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
55
|
+
export const KASH_EDU_PEER_REVIEW_NSID = "kash.education.peer-review";
|
|
56
|
+
export const KASH_EDU_PEER_REVIEW_VERSION = { major: 1, minor: 0, patch: 0 };
|
|
57
|
+
export const KASH_EDU_PEER_REVIEW_ID = "kash.education.peer-review@1.0.0";
|
|
58
|
+
export const KASH_EDU_PEER_REVIEW_BODY_SCHEMA = S.object({
|
|
59
|
+
/** The work being reviewed — cid of the manuscript, plus title for display. */
|
|
60
|
+
workCid: S.string({ format: "cid" }),
|
|
61
|
+
workTitle: S.string({ minLength: 1, maxLength: 300 }),
|
|
62
|
+
/** Author DID — what selective disclosure later proves out. */
|
|
63
|
+
authorDid: S.string({ format: "did-ks" }),
|
|
64
|
+
/** Optional venue (journal / conference name). */
|
|
65
|
+
venue: S.optional(S.string({ minLength: 1, maxLength: 200 })),
|
|
66
|
+
/** Verdict from the standard four-option ladder. */
|
|
67
|
+
verdict: S.enum("accept", "minor-revisions", "major-revisions", "reject"),
|
|
68
|
+
/** Reviewer's written assessment. */
|
|
69
|
+
body: S.string({ minLength: 1, maxLength: 50_000 }),
|
|
70
|
+
/** Numeric score on the institutional scale. */
|
|
71
|
+
score: S.optional(S.number({ min: 0, max: 10 })),
|
|
72
|
+
/** When the review was finalised. */
|
|
73
|
+
reviewedAt: S.string({ format: "iso8601" }),
|
|
74
|
+
}, ["workCid", "workTitle", "authorDid", "verdict", "body", "reviewedAt"]);
|
|
75
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
76
|
+
* Extension bundle
|
|
77
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
78
|
+
/** Education-domain lexicons. Pass to `LexiconRegistry.registerAll()`. */
|
|
79
|
+
export const EDUCATION_EXTENSION = [
|
|
80
|
+
{
|
|
81
|
+
id: KASH_EDU_TRANSCRIPT_ID,
|
|
82
|
+
nsid: KASH_EDU_TRANSCRIPT_NSID,
|
|
83
|
+
semver: KASH_EDU_TRANSCRIPT_VERSION,
|
|
84
|
+
bodySchema: KASH_EDU_TRANSCRIPT_BODY_SCHEMA,
|
|
85
|
+
title: "Education Transcript Entry",
|
|
86
|
+
description: "A single course / degree credit record signed by the issuing institution.",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: KASH_EDU_PEER_REVIEW_ID,
|
|
90
|
+
nsid: KASH_EDU_PEER_REVIEW_NSID,
|
|
91
|
+
semver: KASH_EDU_PEER_REVIEW_VERSION,
|
|
92
|
+
bodySchema: KASH_EDU_PEER_REVIEW_BODY_SCHEMA,
|
|
93
|
+
title: "Academic Peer Review",
|
|
94
|
+
description: "A reviewer's signed assessment of an academic work.",
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
//# sourceMappingURL=education.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"education.js","sourceRoot":"","sources":["../../src/extensions/education.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAA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EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IACnD,gDAAgD;IAChD,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAChD,qCAAqC;IACrC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;CAC5C,EACD,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,CACvE,CAAC;AAEF;;uEAEuE;AAEvE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,mBAAmB,GAA0B;IACxD;QACE,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,wBAAwB;QAC9B,MAAM,EAAE,2BAA2B;QACnC,UAAU,EAAE,+BAA+B;QAC3C,KAAK,EAAE,4BAA4B;QACnC,WAAW,EAAE,2EAA2E;KACzF;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,IAAI,EAAE,yBAAyB;QAC/B,MAAM,EAAE,4BAA4B;QACpC,UAAU,EAAE,gCAAgC;QAC5C,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,qDAAqD;KACnE;CACF,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared brand types used across the lexicon framework.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shared brand types used across the lexicon framework. Kept local to
|
|
3
|
+
* preserve the zero-dependency posture; the canonical did:kash types
|
|
4
|
+
* live in `@kashscript/identity-core/types`.
|
|
5
5
|
*/
|
|
6
6
|
/** W3C DID restricted to the did:kash method emitted by `@kashscript/identity-core`. */
|
|
7
7
|
export type DID = `did:kash:${string}`;
|
package/dist/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared brand types used across the lexicon framework.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shared brand types used across the lexicon framework. Kept local to
|
|
3
|
+
* preserve the zero-dependency posture; the canonical did:kash types
|
|
4
|
+
* live in `@kashscript/identity-core/types`.
|
|
5
5
|
*/
|
|
6
6
|
/** Domain-Separation Tag for record-tier signatures (Identity Protocol §5.5). */
|
|
7
7
|
export const KASH_RECORD_DST = "kash-record-v1\n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kashscript/lexicons",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Zero-dependency lexicon framework — envelope, schema DSL, registry, validator. Agnostic core; domain content ships as opt-in extensions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -55,6 +55,21 @@
|
|
|
55
55
|
"types": "./dist/extensions/zkp.d.ts",
|
|
56
56
|
"import": "./dist/extensions/zkp.js",
|
|
57
57
|
"default": "./dist/extensions/zkp.js"
|
|
58
|
+
},
|
|
59
|
+
"./extensions/education": {
|
|
60
|
+
"types": "./dist/extensions/education.d.ts",
|
|
61
|
+
"import": "./dist/extensions/education.js",
|
|
62
|
+
"default": "./dist/extensions/education.js"
|
|
63
|
+
},
|
|
64
|
+
"./extensions/civic": {
|
|
65
|
+
"types": "./dist/extensions/civic.d.ts",
|
|
66
|
+
"import": "./dist/extensions/civic.js",
|
|
67
|
+
"default": "./dist/extensions/civic.js"
|
|
68
|
+
},
|
|
69
|
+
"./extensions/community": {
|
|
70
|
+
"types": "./dist/extensions/community.d.ts",
|
|
71
|
+
"import": "./dist/extensions/community.js",
|
|
72
|
+
"default": "./dist/extensions/community.js"
|
|
58
73
|
}
|
|
59
74
|
},
|
|
60
75
|
"sideEffects": false,
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Civic Extension — governance-domain lexicons (Cliffhase-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.civic.permit@1.0.0 — a permit / licence issued by an agency
|
|
5
|
+
* kash.civic.petition@1.0.0 — a citizen petition with optional pledge
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/civic`.
|
|
8
|
+
*
|
|
9
|
+
* Pairs with the Cliffhase program at
|
|
10
|
+
* `apps/kashscript/app/studio/cliffhase`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { LexiconDef } from "../registry";
|
|
14
|
+
import { S, type ObjectSchema } from "../schema";
|
|
15
|
+
|
|
16
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
17
|
+
* kash.civic.permit@1.0.0
|
|
18
|
+
*
|
|
19
|
+
* A typed record of a permit / licence / certification issued by a
|
|
20
|
+
* government body. Holder presents this (or a ZK disclosure of part
|
|
21
|
+
* of it) to anyone who needs to confirm the credential.
|
|
22
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
23
|
+
|
|
24
|
+
export const KASH_CIVIC_PERMIT_NSID = "kash.civic.permit" as const;
|
|
25
|
+
export const KASH_CIVIC_PERMIT_VERSION = { major: 1, minor: 0, patch: 0 } as const;
|
|
26
|
+
export const KASH_CIVIC_PERMIT_ID = "kash.civic.permit@1.0.0" as const;
|
|
27
|
+
|
|
28
|
+
export type PermitKind =
|
|
29
|
+
| "driving"
|
|
30
|
+
| "professional"
|
|
31
|
+
| "business"
|
|
32
|
+
| "import-export"
|
|
33
|
+
| "construction"
|
|
34
|
+
| "occupancy"
|
|
35
|
+
| "food-handling"
|
|
36
|
+
| "other";
|
|
37
|
+
|
|
38
|
+
export const KASH_CIVIC_PERMIT_BODY_SCHEMA: ObjectSchema = S.object(
|
|
39
|
+
{
|
|
40
|
+
/** Holder DID. */
|
|
41
|
+
holderDid: S.string({ format: "did-ks" }),
|
|
42
|
+
/** Issuing agency identifier — agency's own short code. */
|
|
43
|
+
issuingAgency: S.string({ minLength: 1, maxLength: 64 }),
|
|
44
|
+
/** Permit / licence number on the agency's system. */
|
|
45
|
+
permitNumber: S.string({ minLength: 1, maxLength: 64 }),
|
|
46
|
+
/** What kind of permit. */
|
|
47
|
+
kind: S.enum(
|
|
48
|
+
"driving", "professional", "business", "import-export",
|
|
49
|
+
"construction", "occupancy", "food-handling", "other",
|
|
50
|
+
),
|
|
51
|
+
/** ISO date when it was issued. */
|
|
52
|
+
issuedAt: S.string({ format: "iso8601" }),
|
|
53
|
+
/** ISO date when it expires — required so a verifier can check freshness. */
|
|
54
|
+
expiresAt: S.string({ format: "iso8601" }),
|
|
55
|
+
/** Scope of authority granted (free-text). */
|
|
56
|
+
scope: S.string({ minLength: 1, maxLength: 500 }),
|
|
57
|
+
/** Jurisdiction code (ISO-3166-2 or local extension). */
|
|
58
|
+
jurisdiction: S.string({ minLength: 1, maxLength: 16 }),
|
|
59
|
+
/** Optional pointer to the on-paper / on-system source record. */
|
|
60
|
+
sourceUri: S.optional(S.string({ minLength: 1, maxLength: 500 })),
|
|
61
|
+
},
|
|
62
|
+
["holderDid", "issuingAgency", "permitNumber", "kind", "issuedAt", "expiresAt", "scope", "jurisdiction"],
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
66
|
+
* kash.civic.petition@1.0.0
|
|
67
|
+
*
|
|
68
|
+
* A citizen-initiated petition record. Other citizens sign their
|
|
69
|
+
* endorsement as separate envelopes referencing this record's cid.
|
|
70
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
71
|
+
|
|
72
|
+
export const KASH_CIVIC_PETITION_NSID = "kash.civic.petition" as const;
|
|
73
|
+
export const KASH_CIVIC_PETITION_VERSION = { major: 1, minor: 0, patch: 0 } as const;
|
|
74
|
+
export const KASH_CIVIC_PETITION_ID = "kash.civic.petition@1.0.0" as const;
|
|
75
|
+
|
|
76
|
+
export const KASH_CIVIC_PETITION_BODY_SCHEMA: ObjectSchema = S.object(
|
|
77
|
+
{
|
|
78
|
+
/** Petition title — 1 sentence, displayed verbatim. */
|
|
79
|
+
title: S.string({ minLength: 1, maxLength: 200 }),
|
|
80
|
+
/** Long-form description. */
|
|
81
|
+
body: S.string({ minLength: 1, maxLength: 50_000 }),
|
|
82
|
+
/** Target agency / official the petition addresses. */
|
|
83
|
+
targetAgency: S.string({ minLength: 1, maxLength: 200 }),
|
|
84
|
+
/** Jurisdiction the petition belongs to. */
|
|
85
|
+
jurisdiction: S.string({ minLength: 1, maxLength: 16 }),
|
|
86
|
+
/** Optional ISO date by which the petitioner needs a response. */
|
|
87
|
+
responseBy: S.optional(S.string({ format: "iso8601" })),
|
|
88
|
+
/** Minimum signatures required for this petition to be valid in the host system. */
|
|
89
|
+
quorumTarget: S.optional(S.number({ min: 1, max: 10_000_000 })),
|
|
90
|
+
/** ISO date the petition was opened for signatures. */
|
|
91
|
+
openedAt: S.string({ format: "iso8601" }),
|
|
92
|
+
},
|
|
93
|
+
["title", "body", "targetAgency", "jurisdiction", "openedAt"],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
97
|
+
* Extension bundle
|
|
98
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
99
|
+
|
|
100
|
+
export const CIVIC_EXTENSION: readonly LexiconDef[] = [
|
|
101
|
+
{
|
|
102
|
+
id: KASH_CIVIC_PERMIT_ID,
|
|
103
|
+
nsid: KASH_CIVIC_PERMIT_NSID,
|
|
104
|
+
semver: KASH_CIVIC_PERMIT_VERSION,
|
|
105
|
+
bodySchema: KASH_CIVIC_PERMIT_BODY_SCHEMA,
|
|
106
|
+
title: "Civic Permit",
|
|
107
|
+
description: "Government-issued permit / licence record.",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: KASH_CIVIC_PETITION_ID,
|
|
111
|
+
nsid: KASH_CIVIC_PETITION_NSID,
|
|
112
|
+
semver: KASH_CIVIC_PETITION_VERSION,
|
|
113
|
+
bodySchema: KASH_CIVIC_PETITION_BODY_SCHEMA,
|
|
114
|
+
title: "Civic Petition",
|
|
115
|
+
description: "A citizen-initiated petition addressed to a government body.",
|
|
116
|
+
},
|
|
117
|
+
];
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Community Extension — community-domain lexicons (Acmecase-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.community.membership@1.0.0 — verifiable community-member record
|
|
5
|
+
* kash.community.aid-claim@1.0.0 — a member's claim against a mutual-aid pool
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/community`.
|
|
8
|
+
*
|
|
9
|
+
* Pairs with the Acmecase program at
|
|
10
|
+
* `apps/kashscript/app/studio/acmecase`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { LexiconDef } from "../registry";
|
|
14
|
+
import { S, type ObjectSchema } from "../schema";
|
|
15
|
+
|
|
16
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
17
|
+
* kash.community.membership@1.0.0
|
|
18
|
+
*
|
|
19
|
+
* A community (cooperative, mosque committee, building society)
|
|
20
|
+
* signs one record per current member. Holder selectively discloses
|
|
21
|
+
* membership to others without revealing their identity if desired.
|
|
22
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
23
|
+
|
|
24
|
+
export const KASH_COMMUNITY_MEMBERSHIP_NSID = "kash.community.membership" as const;
|
|
25
|
+
export const KASH_COMMUNITY_MEMBERSHIP_VERSION = { major: 1, minor: 0, patch: 0 } as const;
|
|
26
|
+
export const KASH_COMMUNITY_MEMBERSHIP_ID = "kash.community.membership@1.0.0" as const;
|
|
27
|
+
|
|
28
|
+
export type MembershipStatus = "active" | "lapsed" | "suspended" | "honorary";
|
|
29
|
+
|
|
30
|
+
export const KASH_COMMUNITY_MEMBERSHIP_BODY_SCHEMA: ObjectSchema = S.object(
|
|
31
|
+
{
|
|
32
|
+
/** Member's DID — kept hidden in many disclosures. */
|
|
33
|
+
memberDid: S.string({ format: "did-ks" }),
|
|
34
|
+
/** Community's short codename (e.g., "f7-residents", "lahore-coop-1"). */
|
|
35
|
+
communityCode: S.string({ minLength: 1, maxLength: 64, pattern: /^[a-z0-9][a-z0-9_-]*$/ }),
|
|
36
|
+
/** Display name of the community. */
|
|
37
|
+
communityName: S.string({ minLength: 1, maxLength: 200 }),
|
|
38
|
+
/** Status of the membership at issue time. */
|
|
39
|
+
status: S.enum("active", "lapsed", "suspended", "honorary"),
|
|
40
|
+
/** ISO date the member joined. */
|
|
41
|
+
joinedAt: S.string({ format: "iso8601" }),
|
|
42
|
+
/** ISO date this attestation expires — invites periodic re-issue. */
|
|
43
|
+
expiresAt: S.string({ format: "iso8601" }),
|
|
44
|
+
/** Optional member role within the community. */
|
|
45
|
+
role: S.optional(S.string({ minLength: 1, maxLength: 64 })),
|
|
46
|
+
},
|
|
47
|
+
["memberDid", "communityCode", "communityName", "status", "joinedAt", "expiresAt"],
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
51
|
+
* kash.community.aid-claim@1.0.0
|
|
52
|
+
*
|
|
53
|
+
* A member's signed claim against a community mutual-aid pool.
|
|
54
|
+
* Pairs with the SUBSCRIPTION-based pool in
|
|
55
|
+
* `packages/trade-sdk/use-cases/acmecase-mutual-aid`.
|
|
56
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
57
|
+
|
|
58
|
+
export const KASH_COMMUNITY_AID_CLAIM_NSID = "kash.community.aid-claim" as const;
|
|
59
|
+
export const KASH_COMMUNITY_AID_CLAIM_VERSION = { major: 1, minor: 0, patch: 0 } as const;
|
|
60
|
+
export const KASH_COMMUNITY_AID_CLAIM_ID = "kash.community.aid-claim@1.0.0" as const;
|
|
61
|
+
|
|
62
|
+
export type AidClaimKind =
|
|
63
|
+
| "medical"
|
|
64
|
+
| "rent"
|
|
65
|
+
| "utilities"
|
|
66
|
+
| "education"
|
|
67
|
+
| "funeral"
|
|
68
|
+
| "emergency"
|
|
69
|
+
| "other";
|
|
70
|
+
|
|
71
|
+
export const KASH_COMMUNITY_AID_CLAIM_BODY_SCHEMA: ObjectSchema = S.object(
|
|
72
|
+
{
|
|
73
|
+
/** Claimant's DID. */
|
|
74
|
+
claimantDid: S.string({ format: "did-ks" }),
|
|
75
|
+
/** Pool's manifest id (the Trade SUBSCRIPTION manifest the claim draws from). */
|
|
76
|
+
poolManifestId: S.string({ minLength: 1, maxLength: 200 }),
|
|
77
|
+
/** Kind of need. */
|
|
78
|
+
kind: S.enum("medical", "rent", "utilities", "education", "funeral", "emergency", "other"),
|
|
79
|
+
/** Amount requested, in base units (decimal-stringified bigint to avoid JSON number loss). */
|
|
80
|
+
amountBaseUnits: S.string({ minLength: 1, maxLength: 80, pattern: /^[0-9]+$/ }),
|
|
81
|
+
/** Currency code (e.g., "PKR"). */
|
|
82
|
+
currency: S.string({ minLength: 1, maxLength: 16 }),
|
|
83
|
+
/** Free-text justification — what the claim is for. */
|
|
84
|
+
justification: S.string({ minLength: 1, maxLength: 5_000 }),
|
|
85
|
+
/** Optional pointer to supporting documents on a PDS. */
|
|
86
|
+
supportingDocsCid: S.optional(S.string({ format: "cid" })),
|
|
87
|
+
/** ISO date the claim was filed. */
|
|
88
|
+
filedAt: S.string({ format: "iso8601" }),
|
|
89
|
+
},
|
|
90
|
+
["claimantDid", "poolManifestId", "kind", "amountBaseUnits", "currency", "justification", "filedAt"],
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
94
|
+
* Extension bundle
|
|
95
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
96
|
+
|
|
97
|
+
export const COMMUNITY_EXTENSION: readonly LexiconDef[] = [
|
|
98
|
+
{
|
|
99
|
+
id: KASH_COMMUNITY_MEMBERSHIP_ID,
|
|
100
|
+
nsid: KASH_COMMUNITY_MEMBERSHIP_NSID,
|
|
101
|
+
semver: KASH_COMMUNITY_MEMBERSHIP_VERSION,
|
|
102
|
+
bodySchema: KASH_COMMUNITY_MEMBERSHIP_BODY_SCHEMA,
|
|
103
|
+
title: "Community Membership",
|
|
104
|
+
description: "Verifiable community-member record issued by a community admin.",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: KASH_COMMUNITY_AID_CLAIM_ID,
|
|
108
|
+
nsid: KASH_COMMUNITY_AID_CLAIM_NSID,
|
|
109
|
+
semver: KASH_COMMUNITY_AID_CLAIM_VERSION,
|
|
110
|
+
bodySchema: KASH_COMMUNITY_AID_CLAIM_BODY_SCHEMA,
|
|
111
|
+
title: "Community Aid Claim",
|
|
112
|
+
description: "A member's signed claim against a community mutual-aid pool.",
|
|
113
|
+
},
|
|
114
|
+
];
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Education Extension — academia-domain lexicons (Jinnahnook-shaped).
|
|
3
|
+
*
|
|
4
|
+
* kash.education.transcript@1.0.0 — a course / degree transcript record
|
|
5
|
+
* kash.education.peer-review@1.0.0 — a peer-review of an academic work
|
|
6
|
+
*
|
|
7
|
+
* Import path: `@kashscript/lexicons/extensions/education`.
|
|
8
|
+
*
|
|
9
|
+
* The Foundry core never auto-loads this extension. Consumers register
|
|
10
|
+
* `EDUCATION_EXTENSION` against their `LexiconRegistry` to opt in to
|
|
11
|
+
* academic-domain validation. Pairs with the Jinnahnook program at
|
|
12
|
+
* `apps/kashscript/app/studio/jinnahnook`.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { LexiconDef } from "../registry";
|
|
16
|
+
import { S, type ObjectSchema } from "../schema";
|
|
17
|
+
|
|
18
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
19
|
+
* kash.education.transcript@1.0.0
|
|
20
|
+
*
|
|
21
|
+
* Issuer (a registrar / institution) signs one record per
|
|
22
|
+
* course-or-degree credit awarded to a student. The student holds
|
|
23
|
+
* their transcript as a collection of these records and can
|
|
24
|
+
* selectively disclose individual entries via @kashscript/identity-zkp.
|
|
25
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
26
|
+
|
|
27
|
+
export const KASH_EDU_TRANSCRIPT_NSID = "kash.education.transcript" as const;
|
|
28
|
+
export const KASH_EDU_TRANSCRIPT_VERSION = { major: 1, minor: 0, patch: 0 } as const;
|
|
29
|
+
export const KASH_EDU_TRANSCRIPT_ID = "kash.education.transcript@1.0.0" as const;
|
|
30
|
+
|
|
31
|
+
export type CreditKind = "course" | "thesis" | "internship" | "lab" | "seminar";
|
|
32
|
+
|
|
33
|
+
export const KASH_EDU_TRANSCRIPT_BODY_SCHEMA: ObjectSchema = S.object(
|
|
34
|
+
{
|
|
35
|
+
/** DID of the student this transcript entry is about. */
|
|
36
|
+
studentDid: S.string({ format: "did-ks" }),
|
|
37
|
+
/** Stable institutional identifier for the course / unit. */
|
|
38
|
+
courseCode: S.string({ minLength: 1, maxLength: 32, pattern: /^[A-Z0-9][A-Z0-9-]{0,31}$/ }),
|
|
39
|
+
/** Display title — kept separate from courseCode so the wire shape stays stable across rename. */
|
|
40
|
+
courseTitle: S.string({ minLength: 1, maxLength: 200 }),
|
|
41
|
+
/** Kind of credit. */
|
|
42
|
+
kind: S.enum("course", "thesis", "internship", "lab", "seminar"),
|
|
43
|
+
/** Credit units (e.g., 3 for a 3-credit course). */
|
|
44
|
+
credits: S.number({ min: 0, max: 200 }),
|
|
45
|
+
/** Grade — institution-specific letter / score / pass-fail tag. */
|
|
46
|
+
grade: S.string({ minLength: 1, maxLength: 8 }),
|
|
47
|
+
/** ISO date the credit was awarded. */
|
|
48
|
+
awardedAt: S.string({ format: "iso8601" }),
|
|
49
|
+
/** Optional advisor / instructor of record. */
|
|
50
|
+
instructorDid: S.optional(S.string({ format: "did-ks" })),
|
|
51
|
+
/** Optional human-readable notes. */
|
|
52
|
+
notes: S.optional(S.string({ maxLength: 1000 })),
|
|
53
|
+
},
|
|
54
|
+
[
|
|
55
|
+
"studentDid", "courseCode", "courseTitle", "kind", "credits", "grade", "awardedAt",
|
|
56
|
+
],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
60
|
+
* kash.education.peer-review@1.0.0
|
|
61
|
+
*
|
|
62
|
+
* A reviewer's signed assessment of an academic work (paper, thesis
|
|
63
|
+
* chapter, conference submission). Used by Jinnahnook for the peer-
|
|
64
|
+
* review surface; can be anonymised at disclosure time via ZK.
|
|
65
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
66
|
+
|
|
67
|
+
export const KASH_EDU_PEER_REVIEW_NSID = "kash.education.peer-review" as const;
|
|
68
|
+
export const KASH_EDU_PEER_REVIEW_VERSION = { major: 1, minor: 0, patch: 0 } as const;
|
|
69
|
+
export const KASH_EDU_PEER_REVIEW_ID = "kash.education.peer-review@1.0.0" as const;
|
|
70
|
+
|
|
71
|
+
export type ReviewVerdict = "accept" | "minor-revisions" | "major-revisions" | "reject";
|
|
72
|
+
|
|
73
|
+
export const KASH_EDU_PEER_REVIEW_BODY_SCHEMA: ObjectSchema = S.object(
|
|
74
|
+
{
|
|
75
|
+
/** The work being reviewed — cid of the manuscript, plus title for display. */
|
|
76
|
+
workCid: S.string({ format: "cid" }),
|
|
77
|
+
workTitle: S.string({ minLength: 1, maxLength: 300 }),
|
|
78
|
+
/** Author DID — what selective disclosure later proves out. */
|
|
79
|
+
authorDid: S.string({ format: "did-ks" }),
|
|
80
|
+
/** Optional venue (journal / conference name). */
|
|
81
|
+
venue: S.optional(S.string({ minLength: 1, maxLength: 200 })),
|
|
82
|
+
/** Verdict from the standard four-option ladder. */
|
|
83
|
+
verdict: S.enum("accept", "minor-revisions", "major-revisions", "reject"),
|
|
84
|
+
/** Reviewer's written assessment. */
|
|
85
|
+
body: S.string({ minLength: 1, maxLength: 50_000 }),
|
|
86
|
+
/** Numeric score on the institutional scale. */
|
|
87
|
+
score: S.optional(S.number({ min: 0, max: 10 })),
|
|
88
|
+
/** When the review was finalised. */
|
|
89
|
+
reviewedAt: S.string({ format: "iso8601" }),
|
|
90
|
+
},
|
|
91
|
+
["workCid", "workTitle", "authorDid", "verdict", "body", "reviewedAt"],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
/* ─────────────────────────────────────────────────────────────────
|
|
95
|
+
* Extension bundle
|
|
96
|
+
* ───────────────────────────────────────────────────────────────── */
|
|
97
|
+
|
|
98
|
+
/** Education-domain lexicons. Pass to `LexiconRegistry.registerAll()`. */
|
|
99
|
+
export const EDUCATION_EXTENSION: readonly LexiconDef[] = [
|
|
100
|
+
{
|
|
101
|
+
id: KASH_EDU_TRANSCRIPT_ID,
|
|
102
|
+
nsid: KASH_EDU_TRANSCRIPT_NSID,
|
|
103
|
+
semver: KASH_EDU_TRANSCRIPT_VERSION,
|
|
104
|
+
bodySchema: KASH_EDU_TRANSCRIPT_BODY_SCHEMA,
|
|
105
|
+
title: "Education Transcript Entry",
|
|
106
|
+
description: "A single course / degree credit record signed by the issuing institution.",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: KASH_EDU_PEER_REVIEW_ID,
|
|
110
|
+
nsid: KASH_EDU_PEER_REVIEW_NSID,
|
|
111
|
+
semver: KASH_EDU_PEER_REVIEW_VERSION,
|
|
112
|
+
bodySchema: KASH_EDU_PEER_REVIEW_BODY_SCHEMA,
|
|
113
|
+
title: "Academic Peer Review",
|
|
114
|
+
description: "A reviewer's signed assessment of an academic work.",
|
|
115
|
+
},
|
|
116
|
+
];
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared brand types used across the lexicon framework.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shared brand types used across the lexicon framework. Kept local to
|
|
3
|
+
* preserve the zero-dependency posture; the canonical did:kash types
|
|
4
|
+
* live in `@kashscript/identity-core/types`.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/** W3C DID restricted to the did:kash method emitted by `@kashscript/identity-core`. */
|