@kashscript/lexicons 0.1.2 → 0.3.0-alpha.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 +7 -1
- package/README.md +1 -0
- package/dist/extensions/door.d.ts +316 -0
- package/dist/extensions/door.d.ts.map +1 -0
- package/dist/extensions/door.js +211 -0
- package/dist/extensions/door.js.map +1 -0
- package/dist/schema.js +5 -1
- package/dist/schema.js.map +1 -1
- package/package.json +10 -2
- package/src/extensions/door.ts +514 -0
- package/src/schema.ts +5 -1
package/LICENSE
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2026 KashScript Studio.
|
|
2
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
you may not use this file except in compliance with the License.
|
|
4
|
+
|
|
1
5
|
Apache License
|
|
2
6
|
Version 2.0, January 2004
|
|
3
7
|
http://www.apache.org/licenses/
|
|
@@ -196,4 +200,6 @@
|
|
|
196
200
|
License Agreement (SSLA) v1.0, Schedule A (Permissive Packages).
|
|
197
201
|
The SSLA grant is at-least-as-permissive as Apache-2.0 and exists to
|
|
198
202
|
give the entire Foundry a single agreement to point at. Full text:
|
|
199
|
-
|
|
203
|
+
docs/legal/SSLA.md in the KashScript repository, or on request from
|
|
204
|
+
studio@kashscript.dev. Canonical public URL from the first commercial
|
|
205
|
+
release: https://www.kashscript.com/legal/ssla
|
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ out of the box. The domain extensions (`social`, `trade`, `zkp`,
|
|
|
30
30
|
| `@kashscript/lexicons/extensions/trade` | The `kash.trade.*` vocabulary |
|
|
31
31
|
| `@kashscript/lexicons/extensions/zkp` | The `kash.zkp.*` vocabulary |
|
|
32
32
|
| `@kashscript/lexicons/extensions/{education,civic,community}` | Further opt-in vocabularies |
|
|
33
|
+
| `@kashscript/lexicons/extensions/door` | `kash.rule@1.0.0` and `kash.rule@1.1.0` (a door's published rule; 1.1.0 adds its address, drafts, parameter bounds and each criterion's subject) and `kash.adoption@1.0.0` (an anchor adopts a rule with local values within its bounds). All three are public, organisation-authored records (d59). The decision receipt is the person's record, so its shape lives in `@kashscript/predicate` since `0.3.0-alpha.0`. Meaning is checked by `@kashscript/predicate`; see `specs/rule.md`, `specs/adoption.md` and `specs/decision.md` |
|
|
33
34
|
|
|
34
35
|
---
|
|
35
36
|
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Door Extension — the rule a door publishes, and the decision receipt it
|
|
3
|
+
* gives back (ECOSYSTEM d84(a): rule · receipt · decision · recourse · renewal).
|
|
4
|
+
*
|
|
5
|
+
* kash.rule@1.0.0
|
|
6
|
+
* A door's published rule: what it decides, why, who decides (a role),
|
|
7
|
+
* the reasons it may give, its contest window, its renewal and end dates,
|
|
8
|
+
* and its criteria. Each criterion is an OpenID4VP 1.0 DCQL query for the
|
|
9
|
+
* receipts that answer it (or the person's own word) plus a FEEL condition
|
|
10
|
+
* over what the query returns — DMN's literal expression. Public and
|
|
11
|
+
* organisation-authored. Signed by its author as a DSSE envelope
|
|
12
|
+
* (`application/vnd.kash.rule+json`).
|
|
13
|
+
*
|
|
14
|
+
* kash.rule@1.1.0 (KS-Q1b; ECOSYSTEM d85(b)–(c))
|
|
15
|
+
* The same rule with its **address** — sector (ISIC Revision 5), anchor
|
|
16
|
+
* family, authority, journey and the seven givens — a **subject** on each
|
|
17
|
+
* criterion, **bounds** on the parameters an adopter may set, and `draft`.
|
|
18
|
+
* Every new field is optional, so every 1.0.0 body is a 1.1.0 body.
|
|
19
|
+
*
|
|
20
|
+
* kash.adoption@1.0.0
|
|
21
|
+
* An anchor — an organisation — adopts one version of a rule with its own
|
|
22
|
+
* values for the parameters the rule bounds. Public, signed by the anchor
|
|
23
|
+
* as DSSE (`application/vnd.kash.adoption+json`). An adoption is the
|
|
24
|
+
* anchor's pact (d85(d)): rulebooks written once, executed locally.
|
|
25
|
+
*
|
|
26
|
+
* Every shape is closed: a field this schema does not name is refused, so none
|
|
27
|
+
* can carry a score or a person's identity. Meaning — the floor's refusals, the
|
|
28
|
+
* FEEL check, bounds, completeness — is checked by `@kashscript/predicate`;
|
|
29
|
+
* this extension is the shape.
|
|
30
|
+
*
|
|
31
|
+
* **The decision receipt is not here** (since 0.3.0): it is the person's own
|
|
32
|
+
* record, a credential they hold, so its schema lives with the package that
|
|
33
|
+
* issues and checks it — `@kashscript/predicate/decision`. d59 makes lexicons
|
|
34
|
+
* the home of public, organisation-authored records only.
|
|
35
|
+
*
|
|
36
|
+
* Import path: `@kashscript/lexicons/extensions/door`.
|
|
37
|
+
*/
|
|
38
|
+
import type { LexiconDef } from "../registry";
|
|
39
|
+
import { type ObjectSchema } from "../schema";
|
|
40
|
+
/** The DMN types a rule may give a value it reads — DMN's itemDefinition, in the FEEL subset. */
|
|
41
|
+
export declare const DOOR_INPUT_TYPES: readonly ["string", "number", "boolean", "date", "date and time", "days and time duration", "years and months duration", "list of string", "list of number", "list of boolean", "list of date", "list of date and time", "list of days and time duration", "list of years and months duration"];
|
|
42
|
+
export type DoorInputType = (typeof DOOR_INPUT_TYPES)[number];
|
|
43
|
+
export declare const DECISION_OUTCOMES: readonly ["yes", "not-yet", "no", "partial"];
|
|
44
|
+
export type DecisionOutcome = (typeof DECISION_OUTCOMES)[number];
|
|
45
|
+
export type ClaimPathElement = string | number | null;
|
|
46
|
+
export interface DcqlClaimsQuery {
|
|
47
|
+
/** Required here: a claim's id is the name its criterion's condition reads. */
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly path: readonly ClaimPathElement[];
|
|
50
|
+
readonly values?: readonly (string | number | boolean)[];
|
|
51
|
+
}
|
|
52
|
+
export interface DcqlTrustedAuthoritiesQuery {
|
|
53
|
+
/** `kash_issuer` (issuer DIDs) or `kash_trust_list` (`<publisher DID>#<list id>`), in the spec's extension point. */
|
|
54
|
+
readonly type: string;
|
|
55
|
+
readonly values: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
export interface DcqlMeta {
|
|
58
|
+
/** `dc+sd-jwt`: the accepted `vct` values. */
|
|
59
|
+
readonly vct_values?: readonly string[];
|
|
60
|
+
/** `kash-artifact`: the accepted registered DSTs (attest's registry). */
|
|
61
|
+
readonly dst_values?: readonly string[];
|
|
62
|
+
/** `kash-artifact`: `countersigned` asks for two independent signatures over the same bytes. */
|
|
63
|
+
readonly attestation?: "countersigned" | "issuer-signed";
|
|
64
|
+
/** `kash-artifact`: where in the signed payload the holder's key is named, for the presentation's binding. */
|
|
65
|
+
readonly holder_path?: readonly ClaimPathElement[];
|
|
66
|
+
}
|
|
67
|
+
export interface DcqlCredentialQuery {
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly format: string;
|
|
70
|
+
readonly multiple?: boolean;
|
|
71
|
+
readonly meta?: DcqlMeta;
|
|
72
|
+
readonly trusted_authorities?: readonly DcqlTrustedAuthoritiesQuery[];
|
|
73
|
+
readonly require_cryptographic_holder_binding?: boolean;
|
|
74
|
+
readonly claims?: readonly DcqlClaimsQuery[];
|
|
75
|
+
readonly claim_sets?: readonly (readonly string[])[];
|
|
76
|
+
}
|
|
77
|
+
export declare const DCQL_CLAIMS_QUERY_SCHEMA: ObjectSchema;
|
|
78
|
+
export declare const DCQL_CREDENTIAL_QUERY_SCHEMA: ObjectSchema;
|
|
79
|
+
export declare const KASH_RULE_NSID: "kash.rule";
|
|
80
|
+
export declare const KASH_RULE_ID: "kash.rule@1.0.0";
|
|
81
|
+
export interface RuleParameter {
|
|
82
|
+
readonly type: DoorInputType;
|
|
83
|
+
/** Public rules: the threshold in clear. */
|
|
84
|
+
readonly value?: string | number | boolean;
|
|
85
|
+
/** Private rules: SHA-256 hex of JCS({name, value, salt}); the desk holds the opening. */
|
|
86
|
+
readonly sealed?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface RuleReason {
|
|
89
|
+
readonly code: string;
|
|
90
|
+
readonly outcome: DecisionOutcome;
|
|
91
|
+
readonly text: string;
|
|
92
|
+
}
|
|
93
|
+
export interface CriterionBasis {
|
|
94
|
+
readonly title: string;
|
|
95
|
+
readonly url?: string;
|
|
96
|
+
readonly clause?: string;
|
|
97
|
+
readonly page?: number;
|
|
98
|
+
readonly quote?: string;
|
|
99
|
+
}
|
|
100
|
+
export type CriterionAnswer = {
|
|
101
|
+
readonly by: "receipts";
|
|
102
|
+
/** DCQL credential queries, verbatim. Their ids are `<criterion>` or `<criterion>_<suffix>`. */
|
|
103
|
+
readonly query: readonly DcqlCredentialQuery[];
|
|
104
|
+
/** Which of them together answer the criterion (DCQL `credential_sets.options`). Default: each alone. */
|
|
105
|
+
readonly options?: readonly (readonly string[])[];
|
|
106
|
+
/** Display names for issuer DIDs and trust lists the queries name. */
|
|
107
|
+
readonly names?: Readonly<Record<string, string>>;
|
|
108
|
+
} | {
|
|
109
|
+
readonly by: "own-word";
|
|
110
|
+
/** What the person states, in plain words. */
|
|
111
|
+
readonly statement: string;
|
|
112
|
+
/** The values the person gives, by name and DMN type. */
|
|
113
|
+
readonly fields: Readonly<Record<string, DoorInputType>>;
|
|
114
|
+
};
|
|
115
|
+
export interface Criterion {
|
|
116
|
+
readonly id: string;
|
|
117
|
+
readonly label: string;
|
|
118
|
+
/** Why the door needs it. Required: P4's second rule — a rule asks only for what its purpose needs. */
|
|
119
|
+
readonly purpose: string;
|
|
120
|
+
readonly answer: CriterionAnswer;
|
|
121
|
+
/** An issuer's predicate (attest's predicate credential, `kind` = this criterion, `rule` = this rule) answers the row instead. */
|
|
122
|
+
readonly predicate?: {
|
|
123
|
+
readonly issuers: readonly {
|
|
124
|
+
readonly id: string;
|
|
125
|
+
readonly name: string;
|
|
126
|
+
}[];
|
|
127
|
+
readonly freshDays: number;
|
|
128
|
+
};
|
|
129
|
+
/** A FEEL expression (the DMN subset) over what the query returns, with a DMN type for every claim it reads. */
|
|
130
|
+
readonly condition?: {
|
|
131
|
+
readonly feel: string;
|
|
132
|
+
readonly types: Readonly<Record<string, DoorInputType>>;
|
|
133
|
+
};
|
|
134
|
+
/** The clause it comes from, when a rule is drawn from a written policy. */
|
|
135
|
+
readonly basis?: CriterionBasis;
|
|
136
|
+
}
|
|
137
|
+
export interface RuleBody {
|
|
138
|
+
/** `did:kash:<author>/rule/<slug>` — the publisher's DID plus a path, as d60 identifies places. */
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly version: number;
|
|
141
|
+
/** The organisation that publishes it and answers for it. Never a person. */
|
|
142
|
+
readonly author: string;
|
|
143
|
+
readonly title: string;
|
|
144
|
+
readonly purpose: string;
|
|
145
|
+
readonly visibility: "public" | "private";
|
|
146
|
+
readonly parameters?: Readonly<Record<string, RuleParameter>>;
|
|
147
|
+
/** d43: every rule renews and ends. */
|
|
148
|
+
readonly dates: {
|
|
149
|
+
readonly published: string;
|
|
150
|
+
readonly renewBy: string;
|
|
151
|
+
readonly endsAt: string;
|
|
152
|
+
};
|
|
153
|
+
/** Who decides: a role, never a named person. */
|
|
154
|
+
readonly decider: {
|
|
155
|
+
readonly role: string;
|
|
156
|
+
};
|
|
157
|
+
readonly outcome: {
|
|
158
|
+
/** What a yes grants, in plain words. */
|
|
159
|
+
readonly grants: string;
|
|
160
|
+
/** It binds the person — credit, a contract, a debt (P3): never automatic. */
|
|
161
|
+
readonly binds: boolean;
|
|
162
|
+
/** It touches sensitive data (GDPR art. 9): never automatic. */
|
|
163
|
+
readonly sensitive: boolean;
|
|
164
|
+
/** The author's standing decision: a yes is given when every criterion is met. Refused with `binds` or `sensitive`. */
|
|
165
|
+
readonly automaticYes: boolean;
|
|
166
|
+
};
|
|
167
|
+
readonly reasons: readonly RuleReason[];
|
|
168
|
+
readonly contest: {
|
|
169
|
+
readonly windowDays: number;
|
|
170
|
+
readonly answerDays: number;
|
|
171
|
+
readonly how: string;
|
|
172
|
+
};
|
|
173
|
+
/** P4's first rule: another way to show the same thing. Paper is the floor. */
|
|
174
|
+
readonly anotherWay: string;
|
|
175
|
+
readonly criteria: readonly Criterion[];
|
|
176
|
+
/** The author's written answers to the warnings validation raised. Published with the rule. */
|
|
177
|
+
readonly answers?: readonly {
|
|
178
|
+
readonly criterion: string;
|
|
179
|
+
readonly code: string;
|
|
180
|
+
readonly text: string;
|
|
181
|
+
}[];
|
|
182
|
+
/** Practice rules say so inside what is signed. */
|
|
183
|
+
readonly practice?: boolean;
|
|
184
|
+
}
|
|
185
|
+
export declare const CRITERION_SCHEMA: ObjectSchema;
|
|
186
|
+
export declare const KASH_RULE_BODY_SCHEMA: ObjectSchema;
|
|
187
|
+
export declare const KASH_RULE_LEXICON: LexiconDef;
|
|
188
|
+
export declare const KASH_RULE_1_1_ID: "kash.rule@1.1.0";
|
|
189
|
+
/** What a criterion is about. d85(b) rule 1 binds when the subject is a person (or an organisation's people). */
|
|
190
|
+
export declare const SUBJECTS: readonly ["person", "organisation", "product", "place"];
|
|
191
|
+
export type Subject = (typeof SUBJECTS)[number];
|
|
192
|
+
export declare const ANCHOR_FAMILIES: readonly ["movement", "knowledge", "work", "community"];
|
|
193
|
+
export declare const AUTHORITY_KINDS: readonly ["floor", "law", "standard", "institution", "community"];
|
|
194
|
+
export declare const JOURNEYS: readonly ["move", "learn", "earn-and-spend", "live", "leisure"];
|
|
195
|
+
export declare const GIVENS: readonly ["area", "spaces", "capitals", "culture", "economy", "time", "relations"];
|
|
196
|
+
export type Given = (typeof GIVENS)[number];
|
|
197
|
+
export declare const SPACE_KINDS: readonly ["premises", "workplace", "campus", "site", "vehicle", "home", "public-space", "online"];
|
|
198
|
+
export declare const CAPITAL_KINDS: readonly ["people", "systems", "resources"];
|
|
199
|
+
export declare const ECONOMY_LEVELS: readonly ["primary", "secondary", "tertiary", "quaternary", "quinary", "uncounted"];
|
|
200
|
+
/** Bounds an adopter may set a parameter within: a range, or a list. */
|
|
201
|
+
export type ParameterBounds = {
|
|
202
|
+
readonly min?: string | number;
|
|
203
|
+
readonly max?: string | number;
|
|
204
|
+
} | {
|
|
205
|
+
readonly allowed: readonly (string | number | boolean)[];
|
|
206
|
+
};
|
|
207
|
+
export interface RuleParameter1_1 extends RuleParameter {
|
|
208
|
+
readonly bounds?: ParameterBounds;
|
|
209
|
+
}
|
|
210
|
+
export interface Criterion1_1 extends Criterion {
|
|
211
|
+
readonly subject?: Subject;
|
|
212
|
+
}
|
|
213
|
+
export interface RuleRef {
|
|
214
|
+
readonly rule: string;
|
|
215
|
+
readonly version?: number;
|
|
216
|
+
}
|
|
217
|
+
export interface Givens {
|
|
218
|
+
readonly area?: {
|
|
219
|
+
readonly text: string;
|
|
220
|
+
readonly anywhere?: boolean;
|
|
221
|
+
readonly countries?: readonly string[];
|
|
222
|
+
readonly places?: readonly string[];
|
|
223
|
+
};
|
|
224
|
+
readonly spaces?: {
|
|
225
|
+
readonly text: string;
|
|
226
|
+
readonly kinds?: readonly (typeof SPACE_KINDS)[number][];
|
|
227
|
+
readonly places?: readonly string[];
|
|
228
|
+
};
|
|
229
|
+
readonly capitals?: {
|
|
230
|
+
readonly text: string;
|
|
231
|
+
readonly needs?: readonly {
|
|
232
|
+
readonly kind: (typeof CAPITAL_KINDS)[number];
|
|
233
|
+
readonly what: string;
|
|
234
|
+
}[];
|
|
235
|
+
};
|
|
236
|
+
readonly culture?: {
|
|
237
|
+
readonly text: string;
|
|
238
|
+
readonly codes?: readonly {
|
|
239
|
+
readonly title: string;
|
|
240
|
+
readonly url?: string;
|
|
241
|
+
}[];
|
|
242
|
+
readonly languages?: readonly string[];
|
|
243
|
+
};
|
|
244
|
+
readonly economy?: {
|
|
245
|
+
readonly text: string;
|
|
246
|
+
readonly level?: (typeof ECONOMY_LEVELS)[number];
|
|
247
|
+
};
|
|
248
|
+
readonly time?: {
|
|
249
|
+
readonly text: string;
|
|
250
|
+
readonly lasts?: string;
|
|
251
|
+
readonly renews?: string;
|
|
252
|
+
};
|
|
253
|
+
readonly relations?: {
|
|
254
|
+
readonly text: string;
|
|
255
|
+
readonly recognises?: readonly RuleRef[];
|
|
256
|
+
readonly within?: readonly {
|
|
257
|
+
readonly id: string;
|
|
258
|
+
}[];
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/** Every rule has an address (d85(c)). */
|
|
262
|
+
export interface RuleAddress {
|
|
263
|
+
/** ISIC Revision 5: a section (A–V) or a two-digit division. */
|
|
264
|
+
readonly sector: {
|
|
265
|
+
readonly classification: "ISIC";
|
|
266
|
+
readonly revision: "5";
|
|
267
|
+
readonly code: string;
|
|
268
|
+
};
|
|
269
|
+
readonly anchorFamily: (typeof ANCHOR_FAMILIES)[number];
|
|
270
|
+
readonly authority: {
|
|
271
|
+
readonly kind: (typeof AUTHORITY_KINDS)[number];
|
|
272
|
+
readonly name?: string;
|
|
273
|
+
readonly url?: string;
|
|
274
|
+
};
|
|
275
|
+
readonly journey: (typeof JOURNEYS)[number];
|
|
276
|
+
/** The seven givens. A rule is complete when all seven are answered. */
|
|
277
|
+
readonly givens: Givens;
|
|
278
|
+
}
|
|
279
|
+
export interface RuleBody1_1 extends Omit<RuleBody, "parameters" | "criteria"> {
|
|
280
|
+
readonly parameters?: Readonly<Record<string, RuleParameter1_1>>;
|
|
281
|
+
readonly criteria: readonly Criterion1_1[];
|
|
282
|
+
readonly address?: RuleAddress;
|
|
283
|
+
/** Published for reading and comment, never decided under. An incomplete rule publishes only as a draft. */
|
|
284
|
+
readonly draft?: boolean;
|
|
285
|
+
}
|
|
286
|
+
export declare const RULE_ADDRESS_SCHEMA: ObjectSchema;
|
|
287
|
+
export declare const CRITERION_1_1_SCHEMA: ObjectSchema;
|
|
288
|
+
export declare const KASH_RULE_1_1_BODY_SCHEMA: ObjectSchema;
|
|
289
|
+
export declare const KASH_RULE_1_1_LEXICON: LexiconDef;
|
|
290
|
+
export declare const KASH_ADOPTION_NSID: "kash.adoption";
|
|
291
|
+
export declare const KASH_ADOPTION_ID: "kash.adoption@1.0.0";
|
|
292
|
+
export interface AdoptionBody {
|
|
293
|
+
/** `did:kash:<anchor>/adoption/<slug>`. */
|
|
294
|
+
readonly id: string;
|
|
295
|
+
/** The adopting organisation — the anchor whose door decides under it. */
|
|
296
|
+
readonly anchor: string;
|
|
297
|
+
readonly rule: {
|
|
298
|
+
readonly id: string;
|
|
299
|
+
readonly version: number;
|
|
300
|
+
readonly hash: string;
|
|
301
|
+
};
|
|
302
|
+
/** Local values for the parameters the rule bounds — nothing else. */
|
|
303
|
+
readonly parameters: Readonly<Record<string, string | number | boolean>>;
|
|
304
|
+
/** It renews and ends, no later than the rule (d43). */
|
|
305
|
+
readonly dates: {
|
|
306
|
+
readonly adopted: string;
|
|
307
|
+
readonly renewBy: string;
|
|
308
|
+
readonly endsAt: string;
|
|
309
|
+
};
|
|
310
|
+
readonly practice?: boolean;
|
|
311
|
+
}
|
|
312
|
+
export declare const KASH_ADOPTION_BODY_SCHEMA: ObjectSchema;
|
|
313
|
+
export declare const KASH_ADOPTION_LEXICON: LexiconDef;
|
|
314
|
+
/** Every door lexicon: the rule at 1.0.0 and 1.1.0, and the adoption. All public and organisation-authored (d59). */
|
|
315
|
+
export declare const DOOR_LEXICONS: readonly LexiconDef[];
|
|
316
|
+
//# sourceMappingURL=door.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"door.d.ts","sourceRoot":"","sources":["../../src/extensions/door.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAK,KAAK,YAAY,EAAe,MAAM,WAAW,CAAC;AAY9D,iGAAiG;AACjG,eAAO,MAAM,gBAAgB,iSAenB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAG9D,eAAO,MAAM,iBAAiB,8CAA+C,CAAC;AAC9E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAIjE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAA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C,KAAK,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAChG,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,yBAAyB,EAAE,YAUvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,UAOnC,CAAC;AAIF,qHAAqH;AACrH,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAAsE,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Door Extension — the rule a door publishes, and the decision receipt it
|
|
3
|
+
* gives back (ECOSYSTEM d84(a): rule · receipt · decision · recourse · renewal).
|
|
4
|
+
*
|
|
5
|
+
* kash.rule@1.0.0
|
|
6
|
+
* A door's published rule: what it decides, why, who decides (a role),
|
|
7
|
+
* the reasons it may give, its contest window, its renewal and end dates,
|
|
8
|
+
* and its criteria. Each criterion is an OpenID4VP 1.0 DCQL query for the
|
|
9
|
+
* receipts that answer it (or the person's own word) plus a FEEL condition
|
|
10
|
+
* over what the query returns — DMN's literal expression. Public and
|
|
11
|
+
* organisation-authored. Signed by its author as a DSSE envelope
|
|
12
|
+
* (`application/vnd.kash.rule+json`).
|
|
13
|
+
*
|
|
14
|
+
* kash.rule@1.1.0 (KS-Q1b; ECOSYSTEM d85(b)–(c))
|
|
15
|
+
* The same rule with its **address** — sector (ISIC Revision 5), anchor
|
|
16
|
+
* family, authority, journey and the seven givens — a **subject** on each
|
|
17
|
+
* criterion, **bounds** on the parameters an adopter may set, and `draft`.
|
|
18
|
+
* Every new field is optional, so every 1.0.0 body is a 1.1.0 body.
|
|
19
|
+
*
|
|
20
|
+
* kash.adoption@1.0.0
|
|
21
|
+
* An anchor — an organisation — adopts one version of a rule with its own
|
|
22
|
+
* values for the parameters the rule bounds. Public, signed by the anchor
|
|
23
|
+
* as DSSE (`application/vnd.kash.adoption+json`). An adoption is the
|
|
24
|
+
* anchor's pact (d85(d)): rulebooks written once, executed locally.
|
|
25
|
+
*
|
|
26
|
+
* Every shape is closed: a field this schema does not name is refused, so none
|
|
27
|
+
* can carry a score or a person's identity. Meaning — the floor's refusals, the
|
|
28
|
+
* FEEL check, bounds, completeness — is checked by `@kashscript/predicate`;
|
|
29
|
+
* this extension is the shape.
|
|
30
|
+
*
|
|
31
|
+
* **The decision receipt is not here** (since 0.3.0): it is the person's own
|
|
32
|
+
* record, a credential they hold, so its schema lives with the package that
|
|
33
|
+
* issues and checks it — `@kashscript/predicate/decision`. d59 makes lexicons
|
|
34
|
+
* the home of public, organisation-authored records only.
|
|
35
|
+
*
|
|
36
|
+
* Import path: `@kashscript/lexicons/extensions/door`.
|
|
37
|
+
*/
|
|
38
|
+
import { S } from "../schema";
|
|
39
|
+
/* ── shared pieces ─────────────────────────────────────────────────── */
|
|
40
|
+
const DID = S.string({ format: "did-ks" });
|
|
41
|
+
const ISO = S.string({ format: "iso8601" });
|
|
42
|
+
const HEX64 = S.string({ pattern: /^[0-9a-f]{64}$/ });
|
|
43
|
+
const SLUG = S.string({ pattern: /^[a-z0-9][a-z0-9-]{0,62}$/ });
|
|
44
|
+
/** DCQL ids: alphanumerics, `_` and `-` (OpenID4VP 1.0 §6.1). */
|
|
45
|
+
const DCQL_ID = S.string({ pattern: /^[A-Za-z0-9_-]{1,64}$/ });
|
|
46
|
+
const TEXT = (max) => S.string({ minLength: 1, maxLength: max });
|
|
47
|
+
/** The DMN types a rule may give a value it reads — DMN's itemDefinition, in the FEEL subset. */
|
|
48
|
+
export const DOOR_INPUT_TYPES = [
|
|
49
|
+
"string",
|
|
50
|
+
"number",
|
|
51
|
+
"boolean",
|
|
52
|
+
"date",
|
|
53
|
+
"date and time",
|
|
54
|
+
"days and time duration",
|
|
55
|
+
"years and months duration",
|
|
56
|
+
"list of string",
|
|
57
|
+
"list of number",
|
|
58
|
+
"list of boolean",
|
|
59
|
+
"list of date",
|
|
60
|
+
"list of date and time",
|
|
61
|
+
"list of days and time duration",
|
|
62
|
+
"list of years and months duration",
|
|
63
|
+
];
|
|
64
|
+
const INPUT_TYPE = S.enum(...DOOR_INPUT_TYPES);
|
|
65
|
+
export const DECISION_OUTCOMES = ["yes", "not-yet", "no", "partial"];
|
|
66
|
+
const PATH = S.array(S.union(S.string({ minLength: 1, maxLength: 128 }), S.number({ integer: true, min: 0 }), S.literal(null)), { minItems: 1, maxItems: 16 });
|
|
67
|
+
export const DCQL_CLAIMS_QUERY_SCHEMA = S.object({
|
|
68
|
+
id: DCQL_ID,
|
|
69
|
+
path: PATH,
|
|
70
|
+
values: S.optional(S.array(S.union(S.string({ maxLength: 512 }), S.number({ integer: true }), S.boolean()), { minItems: 1, maxItems: 64 })),
|
|
71
|
+
}, ["id", "path"]);
|
|
72
|
+
export const DCQL_CREDENTIAL_QUERY_SCHEMA = S.object({
|
|
73
|
+
id: DCQL_ID,
|
|
74
|
+
format: S.string({ minLength: 1, maxLength: 64 }),
|
|
75
|
+
multiple: S.optional(S.boolean()),
|
|
76
|
+
meta: S.optional(S.object({
|
|
77
|
+
vct_values: S.optional(S.array(S.string({ minLength: 1, maxLength: 256 }), { minItems: 1, maxItems: 16 })),
|
|
78
|
+
dst_values: S.optional(S.array(S.string({ minLength: 1, maxLength: 256 }), { minItems: 1, maxItems: 16 })),
|
|
79
|
+
attestation: S.optional(S.enum("countersigned", "issuer-signed")),
|
|
80
|
+
holder_path: S.optional(PATH),
|
|
81
|
+
})),
|
|
82
|
+
trusted_authorities: S.optional(S.array(S.object({ type: S.string({ minLength: 1, maxLength: 64 }), values: S.array(S.string({ minLength: 1, maxLength: 256 }), { minItems: 1, maxItems: 64 }) }, ["type", "values"]), { minItems: 1, maxItems: 8 })),
|
|
83
|
+
require_cryptographic_holder_binding: S.optional(S.boolean()),
|
|
84
|
+
claims: S.optional(S.array(DCQL_CLAIMS_QUERY_SCHEMA, { minItems: 1, maxItems: 32 })),
|
|
85
|
+
claim_sets: S.optional(S.array(S.array(DCQL_ID, { minItems: 1, maxItems: 32 }), { minItems: 1, maxItems: 16 })),
|
|
86
|
+
}, ["id", "format"]);
|
|
87
|
+
/* ── kash.rule@1.0.0 ───────────────────────────────────────────────── */
|
|
88
|
+
export const KASH_RULE_NSID = "kash.rule";
|
|
89
|
+
export const KASH_RULE_ID = "kash.rule@1.0.0";
|
|
90
|
+
const OWN_WORD_ANSWER = S.object({ by: S.literal("own-word"), statement: TEXT(280), fields: S.record(INPUT_TYPE, S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ })) }, ["by", "statement", "fields"]);
|
|
91
|
+
const RECEIPTS_ANSWER = S.object({
|
|
92
|
+
by: S.literal("receipts"),
|
|
93
|
+
query: S.array(DCQL_CREDENTIAL_QUERY_SCHEMA, { minItems: 1, maxItems: 8 }),
|
|
94
|
+
options: S.optional(S.array(S.array(DCQL_ID, { minItems: 1, maxItems: 8 }), { minItems: 1, maxItems: 8 })),
|
|
95
|
+
names: S.optional(S.record(TEXT(120))),
|
|
96
|
+
}, ["by", "query"]);
|
|
97
|
+
export const CRITERION_SCHEMA = S.object({
|
|
98
|
+
id: SLUG,
|
|
99
|
+
label: TEXT(160),
|
|
100
|
+
purpose: TEXT(600),
|
|
101
|
+
answer: S.union(RECEIPTS_ANSWER, OWN_WORD_ANSWER),
|
|
102
|
+
predicate: S.optional(S.object({
|
|
103
|
+
issuers: S.array(S.object({ id: DID, name: TEXT(120) }, ["id", "name"]), { minItems: 1, maxItems: 16 }),
|
|
104
|
+
freshDays: S.number({ integer: true, min: 1, max: 366 }),
|
|
105
|
+
}, ["issuers", "freshDays"])),
|
|
106
|
+
condition: S.optional(S.object({ feel: S.string({ minLength: 1, maxLength: 2048 }), types: S.record(INPUT_TYPE, S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ })) }, ["feel", "types"])),
|
|
107
|
+
basis: S.optional(S.object({ title: TEXT(200), url: S.optional(S.string({ format: "url" })), clause: S.optional(TEXT(120)), page: S.optional(S.number({ integer: true, min: 1 })), quote: S.optional(TEXT(1000)) }, ["title"])),
|
|
108
|
+
}, ["id", "label", "purpose", "answer"]);
|
|
109
|
+
export const KASH_RULE_BODY_SCHEMA = S.object({
|
|
110
|
+
id: S.string({ pattern: /^did:kash:[1-9A-HJ-NP-Za-km-z]{32,48}\/rule\/[a-z0-9][a-z0-9-]{0,62}$/ }),
|
|
111
|
+
version: S.number({ integer: true, min: 1 }),
|
|
112
|
+
author: DID,
|
|
113
|
+
title: TEXT(160),
|
|
114
|
+
purpose: TEXT(1000),
|
|
115
|
+
visibility: S.enum("public", "private"),
|
|
116
|
+
parameters: S.optional(S.record(S.object({ type: INPUT_TYPE, value: S.optional(S.union(S.string({ maxLength: 256 }), S.number(), S.boolean())), sealed: S.optional(HEX64) }, ["type"]), S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ }))),
|
|
117
|
+
dates: S.object({ published: ISO, renewBy: ISO, endsAt: ISO }, ["published", "renewBy", "endsAt"]),
|
|
118
|
+
decider: S.object({ role: TEXT(64) }, ["role"]),
|
|
119
|
+
outcome: S.object({ grants: TEXT(280), binds: S.boolean(), sensitive: S.boolean(), automaticYes: S.boolean() }, ["grants", "binds", "sensitive", "automaticYes"]),
|
|
120
|
+
reasons: S.array(S.object({ code: SLUG, outcome: S.enum(...DECISION_OUTCOMES), text: TEXT(400) }, ["code", "outcome", "text"]), { minItems: 2, maxItems: 32 }),
|
|
121
|
+
contest: S.object({ windowDays: S.number({ integer: true, min: 1, max: 366 }), answerDays: S.number({ integer: true, min: 1, max: 366 }), how: TEXT(400) }, ["windowDays", "answerDays", "how"]),
|
|
122
|
+
anotherWay: TEXT(600),
|
|
123
|
+
criteria: S.array(CRITERION_SCHEMA, { minItems: 1, maxItems: 32 }),
|
|
124
|
+
answers: S.optional(S.array(S.object({ criterion: SLUG, code: S.string({ pattern: /^[A-Z][A-Z_]{1,63}$/ }), text: TEXT(1000) }, ["criterion", "code", "text"]), { maxItems: 64 })),
|
|
125
|
+
practice: S.optional(S.boolean()),
|
|
126
|
+
}, ["id", "version", "author", "title", "purpose", "visibility", "dates", "decider", "outcome", "reasons", "contest", "anotherWay", "criteria"]);
|
|
127
|
+
export const KASH_RULE_LEXICON = {
|
|
128
|
+
id: KASH_RULE_ID,
|
|
129
|
+
nsid: KASH_RULE_NSID,
|
|
130
|
+
semver: { major: 1, minor: 0, patch: 0 },
|
|
131
|
+
bodySchema: KASH_RULE_BODY_SCHEMA,
|
|
132
|
+
title: "A door's rule",
|
|
133
|
+
description: "What a door decides, why, who decides, the reasons it may give, its contest window, renewal and end dates, and its criteria — each an OpenID4VP 1.0 DCQL query plus a FEEL condition. Public, organisation-authored, signed by its author.",
|
|
134
|
+
};
|
|
135
|
+
/* ── kash.rule@1.1.0 — the address, subjects, bounds, drafts ───────── */
|
|
136
|
+
export const KASH_RULE_1_1_ID = "kash.rule@1.1.0";
|
|
137
|
+
/** What a criterion is about. d85(b) rule 1 binds when the subject is a person (or an organisation's people). */
|
|
138
|
+
export const SUBJECTS = ["person", "organisation", "product", "place"];
|
|
139
|
+
export const ANCHOR_FAMILIES = ["movement", "knowledge", "work", "community"];
|
|
140
|
+
export const AUTHORITY_KINDS = ["floor", "law", "standard", "institution", "community"];
|
|
141
|
+
export const JOURNEYS = ["move", "learn", "earn-and-spend", "live", "leisure"];
|
|
142
|
+
export const GIVENS = ["area", "spaces", "capitals", "culture", "economy", "time", "relations"];
|
|
143
|
+
export const SPACE_KINDS = ["premises", "workplace", "campus", "site", "vehicle", "home", "public-space", "online"];
|
|
144
|
+
export const CAPITAL_KINDS = ["people", "systems", "resources"];
|
|
145
|
+
export const ECONOMY_LEVELS = ["primary", "secondary", "tertiary", "quaternary", "quinary", "uncounted"];
|
|
146
|
+
const VALUE = S.union(S.string({ maxLength: 256 }), S.number(), S.boolean());
|
|
147
|
+
const PLACE_REF = S.string({ pattern: /^did:kash:[1-9A-HJ-NP-Za-km-z]{32,48}\/place\/[a-z0-9][a-z0-9-]{0,62}$/ });
|
|
148
|
+
const DURATION = S.string({ pattern: /^P(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?$/ });
|
|
149
|
+
const RULE_ID = KASH_RULE_BODY_SCHEMA.properties.id;
|
|
150
|
+
const GIVEN_TEXT = TEXT(600);
|
|
151
|
+
const PARAMETER_1_1 = S.object({
|
|
152
|
+
type: INPUT_TYPE,
|
|
153
|
+
value: S.optional(VALUE),
|
|
154
|
+
sealed: S.optional(HEX64),
|
|
155
|
+
bounds: S.optional(S.union(S.object({ min: S.optional(S.union(S.string({ maxLength: 64 }), S.number())), max: S.optional(S.union(S.string({ maxLength: 64 }), S.number())) }), S.object({ allowed: S.array(VALUE, { minItems: 1, maxItems: 64 }) }, ["allowed"]))),
|
|
156
|
+
}, ["type"]);
|
|
157
|
+
const GIVENS_SCHEMA = S.object({
|
|
158
|
+
area: S.optional(S.object({ text: GIVEN_TEXT, anywhere: S.optional(S.boolean()), countries: S.optional(S.array(S.string({ pattern: /^[A-Z]{2}$/ }), { minItems: 1, maxItems: 64 })), places: S.optional(S.array(PLACE_REF, { minItems: 1, maxItems: 64 })) }, ["text"])),
|
|
159
|
+
spaces: S.optional(S.object({ text: GIVEN_TEXT, kinds: S.optional(S.array(S.enum(...SPACE_KINDS), { minItems: 1, maxItems: 8 })), places: S.optional(S.array(PLACE_REF, { minItems: 1, maxItems: 64 })) }, ["text"])),
|
|
160
|
+
capitals: S.optional(S.object({ text: GIVEN_TEXT, needs: S.optional(S.array(S.object({ kind: S.enum(...CAPITAL_KINDS), what: TEXT(200) }, ["kind", "what"]), { minItems: 1, maxItems: 16 })) }, ["text"])),
|
|
161
|
+
culture: S.optional(S.object({ text: GIVEN_TEXT, codes: S.optional(S.array(S.object({ title: TEXT(200), url: S.optional(S.string({ format: "url" })) }, ["title"]), { minItems: 1, maxItems: 16 })), languages: S.optional(S.array(S.string({ format: "bcp47" }), { minItems: 1, maxItems: 16 })) }, ["text"])),
|
|
162
|
+
economy: S.optional(S.object({ text: GIVEN_TEXT, level: S.optional(S.enum(...ECONOMY_LEVELS)) }, ["text"])),
|
|
163
|
+
time: S.optional(S.object({ text: GIVEN_TEXT, lasts: S.optional(DURATION), renews: S.optional(DURATION) }, ["text"])),
|
|
164
|
+
relations: S.optional(S.object({ text: GIVEN_TEXT, recognises: S.optional(S.array(S.object({ rule: RULE_ID, version: S.optional(S.number({ integer: true, min: 1 })) }, ["rule"]), { minItems: 1, maxItems: 32 })), within: S.optional(S.array(S.object({ id: S.string({ minLength: 1, maxLength: 256 }) }, ["id"]), { minItems: 1, maxItems: 16 })) }, ["text"])),
|
|
165
|
+
});
|
|
166
|
+
export const RULE_ADDRESS_SCHEMA = S.object({
|
|
167
|
+
sector: S.object({ classification: S.literal("ISIC"), revision: S.literal("5"), code: S.string({ pattern: /^([A-V]|\d{2})$/ }) }, ["classification", "revision", "code"]),
|
|
168
|
+
anchorFamily: S.enum(...ANCHOR_FAMILIES),
|
|
169
|
+
authority: S.object({ kind: S.enum(...AUTHORITY_KINDS), name: S.optional(TEXT(120)), url: S.optional(S.string({ format: "url" })) }, ["kind"]),
|
|
170
|
+
journey: S.enum(...JOURNEYS),
|
|
171
|
+
givens: GIVENS_SCHEMA,
|
|
172
|
+
}, ["sector", "anchorFamily", "authority", "journey", "givens"]);
|
|
173
|
+
export const CRITERION_1_1_SCHEMA = S.object({ ...CRITERION_SCHEMA.properties, subject: S.optional(S.enum(...SUBJECTS)) }, CRITERION_SCHEMA.required);
|
|
174
|
+
export const KASH_RULE_1_1_BODY_SCHEMA = S.object({
|
|
175
|
+
...KASH_RULE_BODY_SCHEMA.properties,
|
|
176
|
+
parameters: S.optional(S.record(PARAMETER_1_1, S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ }))),
|
|
177
|
+
criteria: S.array(CRITERION_1_1_SCHEMA, { minItems: 1, maxItems: 32 }),
|
|
178
|
+
address: S.optional(RULE_ADDRESS_SCHEMA),
|
|
179
|
+
draft: S.optional(S.boolean()),
|
|
180
|
+
}, KASH_RULE_BODY_SCHEMA.required);
|
|
181
|
+
export const KASH_RULE_1_1_LEXICON = {
|
|
182
|
+
id: KASH_RULE_1_1_ID,
|
|
183
|
+
nsid: KASH_RULE_NSID,
|
|
184
|
+
semver: { major: 1, minor: 1, patch: 0 },
|
|
185
|
+
bodySchema: KASH_RULE_1_1_BODY_SCHEMA,
|
|
186
|
+
title: "A door's rule, with its address",
|
|
187
|
+
description: "kash.rule@1.0.0 plus the address (ISIC Rev. 5 sector, anchor family, authority, journey, the seven givens), each criterion's subject, parameter bounds for adopters, and draft. A 1.0.0 body is a 1.1.0 body.",
|
|
188
|
+
};
|
|
189
|
+
/* ── kash.adoption@1.0.0 ───────────────────────────────────────────── */
|
|
190
|
+
export const KASH_ADOPTION_NSID = "kash.adoption";
|
|
191
|
+
export const KASH_ADOPTION_ID = "kash.adoption@1.0.0";
|
|
192
|
+
export const KASH_ADOPTION_BODY_SCHEMA = S.object({
|
|
193
|
+
id: S.string({ pattern: /^did:kash:[1-9A-HJ-NP-Za-km-z]{32,48}\/adoption\/[a-z0-9][a-z0-9-]{0,62}$/ }),
|
|
194
|
+
anchor: DID,
|
|
195
|
+
rule: S.object({ id: RULE_ID, version: S.number({ integer: true, min: 1 }), hash: HEX64 }, ["id", "version", "hash"]),
|
|
196
|
+
parameters: S.record(VALUE, S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ })),
|
|
197
|
+
dates: S.object({ adopted: ISO, renewBy: ISO, endsAt: ISO }, ["adopted", "renewBy", "endsAt"]),
|
|
198
|
+
practice: S.optional(S.boolean()),
|
|
199
|
+
}, ["id", "anchor", "rule", "parameters", "dates"]);
|
|
200
|
+
export const KASH_ADOPTION_LEXICON = {
|
|
201
|
+
id: KASH_ADOPTION_ID,
|
|
202
|
+
nsid: KASH_ADOPTION_NSID,
|
|
203
|
+
semver: { major: 1, minor: 0, patch: 0 },
|
|
204
|
+
bodySchema: KASH_ADOPTION_BODY_SCHEMA,
|
|
205
|
+
title: "An anchor's adoption of a rule",
|
|
206
|
+
description: "An organisation adopts one version of a rule with its own values for the parameters the rule bounds. Public, signed by the anchor.",
|
|
207
|
+
};
|
|
208
|
+
/* ── bundles ───────────────────────────────────────────────────────── */
|
|
209
|
+
/** Every door lexicon: the rule at 1.0.0 and 1.1.0, and the adoption. All public and organisation-authored (d59). */
|
|
210
|
+
export const DOOR_LEXICONS = [KASH_RULE_LEXICON, KASH_RULE_1_1_LEXICON, KASH_ADOPTION_LEXICON];
|
|
211
|
+
//# sourceMappingURL=door.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"door.js","sourceRoot":"","sources":["../../src/extensions/door.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,EAAE,CAAC,EAAkC,MAAM,WAAW,CAAC;AAE9D,0EAA0E;AAE1E,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC3C,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAC5C,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACtD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,CAAC;AAChE,iEAAiE;AACjE,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC,CAAC;AAC/D,MAAM,IAAI,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS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AM,CAAC,MAAM,aAAa,GAA0B,CAAC,iBAAiB,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -196,7 +196,11 @@ function validateObject(s, value, path, errors) {
|
|
|
196
196
|
}
|
|
197
197
|
if (!s.additionalProperties) {
|
|
198
198
|
for (const k of Object.keys(obj)) {
|
|
199
|
-
|
|
199
|
+
// audit r1 (muffler F5): use own-key membership, not `k in s.properties`.
|
|
200
|
+
// `"__proto__" in s.properties` is `true` via Object.prototype, so the `in`
|
|
201
|
+
// form silently ACCEPTS a `__proto__`/`constructor` key under a strict
|
|
202
|
+
// (additionalProperties:false) schema — a prototype-pollution passthrough.
|
|
203
|
+
if (!Object.prototype.hasOwnProperty.call(s.properties, k)) {
|
|
200
204
|
errors.push(err([...path, k], "unknown field", obj[k]));
|
|
201
205
|
}
|
|
202
206
|
}
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA4FH,uEAAuE;AAEvE,MAAM,CAAC,MAAM,CAAC,GAAG;IACf,GAAG;QACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IACD,MAAM,CAAC,IAAiC;QACtC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC;IACrC,CAAC;IACD,MAAM,CAAC,IAAiC;QACtC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC;IACrC,CAAC;IACD,OAAO;QACL,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,KAAuC;QAC7C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACpC,CAAC;IACD,IAAI,CAAC,GAAG,MAAoC;QAC1C,OAAO,E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CAAC,GAAG,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC,QAAQ,CAAC,MAAM,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED,SAAS,cAAc,CAAC,CAAe,EAAE,KAAc,EAAE,IAAkC,EAAE,MAAyB;IACpH,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,0BAA0B,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1D,OAAO;IACT,CAAC;IACD,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;QACtE,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7C,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kashscript/lexicons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-alpha.0",
|
|
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",
|
|
@@ -70,6 +70,11 @@
|
|
|
70
70
|
"types": "./dist/extensions/community.d.ts",
|
|
71
71
|
"import": "./dist/extensions/community.js",
|
|
72
72
|
"default": "./dist/extensions/community.js"
|
|
73
|
+
},
|
|
74
|
+
"./extensions/door": {
|
|
75
|
+
"types": "./dist/extensions/door.d.ts",
|
|
76
|
+
"import": "./dist/extensions/door.js",
|
|
77
|
+
"default": "./dist/extensions/door.js"
|
|
73
78
|
}
|
|
74
79
|
},
|
|
75
80
|
"sideEffects": false,
|
|
@@ -82,10 +87,13 @@
|
|
|
82
87
|
"scripts": {
|
|
83
88
|
"build": "tsc -p tsconfig.json",
|
|
84
89
|
"typecheck": "tsc --noEmit",
|
|
90
|
+
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",
|
|
91
|
+
"test": "bun run typecheck:test && bun test",
|
|
85
92
|
"clean": "rm -rf dist .turbo"
|
|
86
93
|
},
|
|
87
94
|
"devDependencies": {
|
|
88
|
-
"typescript": "^5.6.3"
|
|
95
|
+
"typescript": "^5.6.3",
|
|
96
|
+
"@types/bun": "^1.2.5"
|
|
89
97
|
},
|
|
90
98
|
"license": "Apache-2.0",
|
|
91
99
|
"publishConfig": {
|
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Door Extension — the rule a door publishes, and the decision receipt it
|
|
3
|
+
* gives back (ECOSYSTEM d84(a): rule · receipt · decision · recourse · renewal).
|
|
4
|
+
*
|
|
5
|
+
* kash.rule@1.0.0
|
|
6
|
+
* A door's published rule: what it decides, why, who decides (a role),
|
|
7
|
+
* the reasons it may give, its contest window, its renewal and end dates,
|
|
8
|
+
* and its criteria. Each criterion is an OpenID4VP 1.0 DCQL query for the
|
|
9
|
+
* receipts that answer it (or the person's own word) plus a FEEL condition
|
|
10
|
+
* over what the query returns — DMN's literal expression. Public and
|
|
11
|
+
* organisation-authored. Signed by its author as a DSSE envelope
|
|
12
|
+
* (`application/vnd.kash.rule+json`).
|
|
13
|
+
*
|
|
14
|
+
* kash.rule@1.1.0 (KS-Q1b; ECOSYSTEM d85(b)–(c))
|
|
15
|
+
* The same rule with its **address** — sector (ISIC Revision 5), anchor
|
|
16
|
+
* family, authority, journey and the seven givens — a **subject** on each
|
|
17
|
+
* criterion, **bounds** on the parameters an adopter may set, and `draft`.
|
|
18
|
+
* Every new field is optional, so every 1.0.0 body is a 1.1.0 body.
|
|
19
|
+
*
|
|
20
|
+
* kash.adoption@1.0.0
|
|
21
|
+
* An anchor — an organisation — adopts one version of a rule with its own
|
|
22
|
+
* values for the parameters the rule bounds. Public, signed by the anchor
|
|
23
|
+
* as DSSE (`application/vnd.kash.adoption+json`). An adoption is the
|
|
24
|
+
* anchor's pact (d85(d)): rulebooks written once, executed locally.
|
|
25
|
+
*
|
|
26
|
+
* Every shape is closed: a field this schema does not name is refused, so none
|
|
27
|
+
* can carry a score or a person's identity. Meaning — the floor's refusals, the
|
|
28
|
+
* FEEL check, bounds, completeness — is checked by `@kashscript/predicate`;
|
|
29
|
+
* this extension is the shape.
|
|
30
|
+
*
|
|
31
|
+
* **The decision receipt is not here** (since 0.3.0): it is the person's own
|
|
32
|
+
* record, a credential they hold, so its schema lives with the package that
|
|
33
|
+
* issues and checks it — `@kashscript/predicate/decision`. d59 makes lexicons
|
|
34
|
+
* the home of public, organisation-authored records only.
|
|
35
|
+
*
|
|
36
|
+
* Import path: `@kashscript/lexicons/extensions/door`.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
import type { LexiconDef } from "../registry";
|
|
40
|
+
import { S, type ObjectSchema, type Schema } from "../schema";
|
|
41
|
+
|
|
42
|
+
/* ── shared pieces ─────────────────────────────────────────────────── */
|
|
43
|
+
|
|
44
|
+
const DID = S.string({ format: "did-ks" });
|
|
45
|
+
const ISO = S.string({ format: "iso8601" });
|
|
46
|
+
const HEX64 = S.string({ pattern: /^[0-9a-f]{64}$/ });
|
|
47
|
+
const SLUG = S.string({ pattern: /^[a-z0-9][a-z0-9-]{0,62}$/ });
|
|
48
|
+
/** DCQL ids: alphanumerics, `_` and `-` (OpenID4VP 1.0 §6.1). */
|
|
49
|
+
const DCQL_ID = S.string({ pattern: /^[A-Za-z0-9_-]{1,64}$/ });
|
|
50
|
+
const TEXT = (max: number): Schema => S.string({ minLength: 1, maxLength: max });
|
|
51
|
+
|
|
52
|
+
/** The DMN types a rule may give a value it reads — DMN's itemDefinition, in the FEEL subset. */
|
|
53
|
+
export const DOOR_INPUT_TYPES = [
|
|
54
|
+
"string",
|
|
55
|
+
"number",
|
|
56
|
+
"boolean",
|
|
57
|
+
"date",
|
|
58
|
+
"date and time",
|
|
59
|
+
"days and time duration",
|
|
60
|
+
"years and months duration",
|
|
61
|
+
"list of string",
|
|
62
|
+
"list of number",
|
|
63
|
+
"list of boolean",
|
|
64
|
+
"list of date",
|
|
65
|
+
"list of date and time",
|
|
66
|
+
"list of days and time duration",
|
|
67
|
+
"list of years and months duration",
|
|
68
|
+
] as const;
|
|
69
|
+
export type DoorInputType = (typeof DOOR_INPUT_TYPES)[number];
|
|
70
|
+
const INPUT_TYPE = S.enum(...DOOR_INPUT_TYPES);
|
|
71
|
+
|
|
72
|
+
export const DECISION_OUTCOMES = ["yes", "not-yet", "no", "partial"] as const;
|
|
73
|
+
export type DecisionOutcome = (typeof DECISION_OUTCOMES)[number];
|
|
74
|
+
|
|
75
|
+
/* ── DCQL (OpenID4VP 1.0 §6), as a rule carries it ─────────────────── */
|
|
76
|
+
|
|
77
|
+
export type ClaimPathElement = string | number | null;
|
|
78
|
+
|
|
79
|
+
export interface DcqlClaimsQuery {
|
|
80
|
+
/** Required here: a claim's id is the name its criterion's condition reads. */
|
|
81
|
+
readonly id: string;
|
|
82
|
+
readonly path: readonly ClaimPathElement[];
|
|
83
|
+
readonly values?: readonly (string | number | boolean)[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface DcqlTrustedAuthoritiesQuery {
|
|
87
|
+
/** `kash_issuer` (issuer DIDs) or `kash_trust_list` (`<publisher DID>#<list id>`), in the spec's extension point. */
|
|
88
|
+
readonly type: string;
|
|
89
|
+
readonly values: readonly string[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface DcqlMeta {
|
|
93
|
+
/** `dc+sd-jwt`: the accepted `vct` values. */
|
|
94
|
+
readonly vct_values?: readonly string[];
|
|
95
|
+
/** `kash-artifact`: the accepted registered DSTs (attest's registry). */
|
|
96
|
+
readonly dst_values?: readonly string[];
|
|
97
|
+
/** `kash-artifact`: `countersigned` asks for two independent signatures over the same bytes. */
|
|
98
|
+
readonly attestation?: "countersigned" | "issuer-signed";
|
|
99
|
+
/** `kash-artifact`: where in the signed payload the holder's key is named, for the presentation's binding. */
|
|
100
|
+
readonly holder_path?: readonly ClaimPathElement[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface DcqlCredentialQuery {
|
|
104
|
+
readonly id: string;
|
|
105
|
+
readonly format: string;
|
|
106
|
+
readonly multiple?: boolean;
|
|
107
|
+
readonly meta?: DcqlMeta;
|
|
108
|
+
readonly trusted_authorities?: readonly DcqlTrustedAuthoritiesQuery[];
|
|
109
|
+
readonly require_cryptographic_holder_binding?: boolean;
|
|
110
|
+
readonly claims?: readonly DcqlClaimsQuery[];
|
|
111
|
+
readonly claim_sets?: readonly (readonly string[])[];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const PATH = S.array(S.union(S.string({ minLength: 1, maxLength: 128 }), S.number({ integer: true, min: 0 }), S.literal(null)), { minItems: 1, maxItems: 16 });
|
|
115
|
+
|
|
116
|
+
export const DCQL_CLAIMS_QUERY_SCHEMA: ObjectSchema = S.object(
|
|
117
|
+
{
|
|
118
|
+
id: DCQL_ID,
|
|
119
|
+
path: PATH,
|
|
120
|
+
values: S.optional(S.array(S.union(S.string({ maxLength: 512 }), S.number({ integer: true }), S.boolean()), { minItems: 1, maxItems: 64 })),
|
|
121
|
+
},
|
|
122
|
+
["id", "path"],
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
export const DCQL_CREDENTIAL_QUERY_SCHEMA: ObjectSchema = S.object(
|
|
126
|
+
{
|
|
127
|
+
id: DCQL_ID,
|
|
128
|
+
format: S.string({ minLength: 1, maxLength: 64 }),
|
|
129
|
+
multiple: S.optional(S.boolean()),
|
|
130
|
+
meta: S.optional(
|
|
131
|
+
S.object({
|
|
132
|
+
vct_values: S.optional(S.array(S.string({ minLength: 1, maxLength: 256 }), { minItems: 1, maxItems: 16 })),
|
|
133
|
+
dst_values: S.optional(S.array(S.string({ minLength: 1, maxLength: 256 }), { minItems: 1, maxItems: 16 })),
|
|
134
|
+
attestation: S.optional(S.enum("countersigned", "issuer-signed")),
|
|
135
|
+
holder_path: S.optional(PATH),
|
|
136
|
+
}),
|
|
137
|
+
),
|
|
138
|
+
trusted_authorities: S.optional(
|
|
139
|
+
S.array(S.object({ type: S.string({ minLength: 1, maxLength: 64 }), values: S.array(S.string({ minLength: 1, maxLength: 256 }), { minItems: 1, maxItems: 64 }) }, ["type", "values"]), { minItems: 1, maxItems: 8 }),
|
|
140
|
+
),
|
|
141
|
+
require_cryptographic_holder_binding: S.optional(S.boolean()),
|
|
142
|
+
claims: S.optional(S.array(DCQL_CLAIMS_QUERY_SCHEMA, { minItems: 1, maxItems: 32 })),
|
|
143
|
+
claim_sets: S.optional(S.array(S.array(DCQL_ID, { minItems: 1, maxItems: 32 }), { minItems: 1, maxItems: 16 })),
|
|
144
|
+
},
|
|
145
|
+
["id", "format"],
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
/* ── kash.rule@1.0.0 ───────────────────────────────────────────────── */
|
|
149
|
+
|
|
150
|
+
export const KASH_RULE_NSID = "kash.rule" as const;
|
|
151
|
+
export const KASH_RULE_ID = "kash.rule@1.0.0" as const;
|
|
152
|
+
|
|
153
|
+
export interface RuleParameter {
|
|
154
|
+
readonly type: DoorInputType;
|
|
155
|
+
/** Public rules: the threshold in clear. */
|
|
156
|
+
readonly value?: string | number | boolean;
|
|
157
|
+
/** Private rules: SHA-256 hex of JCS({name, value, salt}); the desk holds the opening. */
|
|
158
|
+
readonly sealed?: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface RuleReason {
|
|
162
|
+
readonly code: string;
|
|
163
|
+
readonly outcome: DecisionOutcome;
|
|
164
|
+
readonly text: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface CriterionBasis {
|
|
168
|
+
readonly title: string;
|
|
169
|
+
readonly url?: string;
|
|
170
|
+
readonly clause?: string;
|
|
171
|
+
readonly page?: number;
|
|
172
|
+
readonly quote?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export type CriterionAnswer =
|
|
176
|
+
| {
|
|
177
|
+
readonly by: "receipts";
|
|
178
|
+
/** DCQL credential queries, verbatim. Their ids are `<criterion>` or `<criterion>_<suffix>`. */
|
|
179
|
+
readonly query: readonly DcqlCredentialQuery[];
|
|
180
|
+
/** Which of them together answer the criterion (DCQL `credential_sets.options`). Default: each alone. */
|
|
181
|
+
readonly options?: readonly (readonly string[])[];
|
|
182
|
+
/** Display names for issuer DIDs and trust lists the queries name. */
|
|
183
|
+
readonly names?: Readonly<Record<string, string>>;
|
|
184
|
+
}
|
|
185
|
+
| {
|
|
186
|
+
readonly by: "own-word";
|
|
187
|
+
/** What the person states, in plain words. */
|
|
188
|
+
readonly statement: string;
|
|
189
|
+
/** The values the person gives, by name and DMN type. */
|
|
190
|
+
readonly fields: Readonly<Record<string, DoorInputType>>;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export interface Criterion {
|
|
194
|
+
readonly id: string;
|
|
195
|
+
readonly label: string;
|
|
196
|
+
/** Why the door needs it. Required: P4's second rule — a rule asks only for what its purpose needs. */
|
|
197
|
+
readonly purpose: string;
|
|
198
|
+
readonly answer: CriterionAnswer;
|
|
199
|
+
/** An issuer's predicate (attest's predicate credential, `kind` = this criterion, `rule` = this rule) answers the row instead. */
|
|
200
|
+
readonly predicate?: { readonly issuers: readonly { readonly id: string; readonly name: string }[]; readonly freshDays: number };
|
|
201
|
+
/** A FEEL expression (the DMN subset) over what the query returns, with a DMN type for every claim it reads. */
|
|
202
|
+
readonly condition?: { readonly feel: string; readonly types: Readonly<Record<string, DoorInputType>> };
|
|
203
|
+
/** The clause it comes from, when a rule is drawn from a written policy. */
|
|
204
|
+
readonly basis?: CriterionBasis;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface RuleBody {
|
|
208
|
+
/** `did:kash:<author>/rule/<slug>` — the publisher's DID plus a path, as d60 identifies places. */
|
|
209
|
+
readonly id: string;
|
|
210
|
+
readonly version: number;
|
|
211
|
+
/** The organisation that publishes it and answers for it. Never a person. */
|
|
212
|
+
readonly author: string;
|
|
213
|
+
readonly title: string;
|
|
214
|
+
readonly purpose: string;
|
|
215
|
+
readonly visibility: "public" | "private";
|
|
216
|
+
readonly parameters?: Readonly<Record<string, RuleParameter>>;
|
|
217
|
+
/** d43: every rule renews and ends. */
|
|
218
|
+
readonly dates: { readonly published: string; readonly renewBy: string; readonly endsAt: string };
|
|
219
|
+
/** Who decides: a role, never a named person. */
|
|
220
|
+
readonly decider: { readonly role: string };
|
|
221
|
+
readonly outcome: {
|
|
222
|
+
/** What a yes grants, in plain words. */
|
|
223
|
+
readonly grants: string;
|
|
224
|
+
/** It binds the person — credit, a contract, a debt (P3): never automatic. */
|
|
225
|
+
readonly binds: boolean;
|
|
226
|
+
/** It touches sensitive data (GDPR art. 9): never automatic. */
|
|
227
|
+
readonly sensitive: boolean;
|
|
228
|
+
/** The author's standing decision: a yes is given when every criterion is met. Refused with `binds` or `sensitive`. */
|
|
229
|
+
readonly automaticYes: boolean;
|
|
230
|
+
};
|
|
231
|
+
readonly reasons: readonly RuleReason[];
|
|
232
|
+
readonly contest: { readonly windowDays: number; readonly answerDays: number; readonly how: string };
|
|
233
|
+
/** P4's first rule: another way to show the same thing. Paper is the floor. */
|
|
234
|
+
readonly anotherWay: string;
|
|
235
|
+
readonly criteria: readonly Criterion[];
|
|
236
|
+
/** The author's written answers to the warnings validation raised. Published with the rule. */
|
|
237
|
+
readonly answers?: readonly { readonly criterion: string; readonly code: string; readonly text: string }[];
|
|
238
|
+
/** Practice rules say so inside what is signed. */
|
|
239
|
+
readonly practice?: boolean;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const OWN_WORD_ANSWER = S.object(
|
|
243
|
+
{ by: S.literal("own-word"), statement: TEXT(280), fields: S.record(INPUT_TYPE, S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ })) },
|
|
244
|
+
["by", "statement", "fields"],
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
const RECEIPTS_ANSWER = S.object(
|
|
248
|
+
{
|
|
249
|
+
by: S.literal("receipts"),
|
|
250
|
+
query: S.array(DCQL_CREDENTIAL_QUERY_SCHEMA, { minItems: 1, maxItems: 8 }),
|
|
251
|
+
options: S.optional(S.array(S.array(DCQL_ID, { minItems: 1, maxItems: 8 }), { minItems: 1, maxItems: 8 })),
|
|
252
|
+
names: S.optional(S.record(TEXT(120))),
|
|
253
|
+
},
|
|
254
|
+
["by", "query"],
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
export const CRITERION_SCHEMA: ObjectSchema = S.object(
|
|
258
|
+
{
|
|
259
|
+
id: SLUG,
|
|
260
|
+
label: TEXT(160),
|
|
261
|
+
purpose: TEXT(600),
|
|
262
|
+
answer: S.union(RECEIPTS_ANSWER, OWN_WORD_ANSWER),
|
|
263
|
+
predicate: S.optional(
|
|
264
|
+
S.object(
|
|
265
|
+
{
|
|
266
|
+
issuers: S.array(S.object({ id: DID, name: TEXT(120) }, ["id", "name"]), { minItems: 1, maxItems: 16 }),
|
|
267
|
+
freshDays: S.number({ integer: true, min: 1, max: 366 }),
|
|
268
|
+
},
|
|
269
|
+
["issuers", "freshDays"],
|
|
270
|
+
),
|
|
271
|
+
),
|
|
272
|
+
condition: S.optional(
|
|
273
|
+
S.object(
|
|
274
|
+
{ feel: S.string({ minLength: 1, maxLength: 2048 }), types: S.record(INPUT_TYPE, S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ })) },
|
|
275
|
+
["feel", "types"],
|
|
276
|
+
),
|
|
277
|
+
),
|
|
278
|
+
basis: S.optional(
|
|
279
|
+
S.object(
|
|
280
|
+
{ title: TEXT(200), url: S.optional(S.string({ format: "url" })), clause: S.optional(TEXT(120)), page: S.optional(S.number({ integer: true, min: 1 })), quote: S.optional(TEXT(1000)) },
|
|
281
|
+
["title"],
|
|
282
|
+
),
|
|
283
|
+
),
|
|
284
|
+
},
|
|
285
|
+
["id", "label", "purpose", "answer"],
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
export const KASH_RULE_BODY_SCHEMA: ObjectSchema = S.object(
|
|
289
|
+
{
|
|
290
|
+
id: S.string({ pattern: /^did:kash:[1-9A-HJ-NP-Za-km-z]{32,48}\/rule\/[a-z0-9][a-z0-9-]{0,62}$/ }),
|
|
291
|
+
version: S.number({ integer: true, min: 1 }),
|
|
292
|
+
author: DID,
|
|
293
|
+
title: TEXT(160),
|
|
294
|
+
purpose: TEXT(1000),
|
|
295
|
+
visibility: S.enum("public", "private"),
|
|
296
|
+
parameters: S.optional(
|
|
297
|
+
S.record(
|
|
298
|
+
S.object({ type: INPUT_TYPE, value: S.optional(S.union(S.string({ maxLength: 256 }), S.number(), S.boolean())), sealed: S.optional(HEX64) }, ["type"]),
|
|
299
|
+
S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ }),
|
|
300
|
+
),
|
|
301
|
+
),
|
|
302
|
+
dates: S.object({ published: ISO, renewBy: ISO, endsAt: ISO }, ["published", "renewBy", "endsAt"]),
|
|
303
|
+
decider: S.object({ role: TEXT(64) }, ["role"]),
|
|
304
|
+
outcome: S.object({ grants: TEXT(280), binds: S.boolean(), sensitive: S.boolean(), automaticYes: S.boolean() }, ["grants", "binds", "sensitive", "automaticYes"]),
|
|
305
|
+
reasons: S.array(S.object({ code: SLUG, outcome: S.enum(...DECISION_OUTCOMES), text: TEXT(400) }, ["code", "outcome", "text"]), { minItems: 2, maxItems: 32 }),
|
|
306
|
+
contest: S.object(
|
|
307
|
+
{ windowDays: S.number({ integer: true, min: 1, max: 366 }), answerDays: S.number({ integer: true, min: 1, max: 366 }), how: TEXT(400) },
|
|
308
|
+
["windowDays", "answerDays", "how"],
|
|
309
|
+
),
|
|
310
|
+
anotherWay: TEXT(600),
|
|
311
|
+
criteria: S.array(CRITERION_SCHEMA, { minItems: 1, maxItems: 32 }),
|
|
312
|
+
answers: S.optional(S.array(S.object({ criterion: SLUG, code: S.string({ pattern: /^[A-Z][A-Z_]{1,63}$/ }), text: TEXT(1000) }, ["criterion", "code", "text"]), { maxItems: 64 })),
|
|
313
|
+
practice: S.optional(S.boolean()),
|
|
314
|
+
},
|
|
315
|
+
["id", "version", "author", "title", "purpose", "visibility", "dates", "decider", "outcome", "reasons", "contest", "anotherWay", "criteria"],
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
export const KASH_RULE_LEXICON: LexiconDef = {
|
|
319
|
+
id: KASH_RULE_ID,
|
|
320
|
+
nsid: KASH_RULE_NSID,
|
|
321
|
+
semver: { major: 1, minor: 0, patch: 0 },
|
|
322
|
+
bodySchema: KASH_RULE_BODY_SCHEMA,
|
|
323
|
+
title: "A door's rule",
|
|
324
|
+
description:
|
|
325
|
+
"What a door decides, why, who decides, the reasons it may give, its contest window, renewal and end dates, and its criteria — each an OpenID4VP 1.0 DCQL query plus a FEEL condition. Public, organisation-authored, signed by its author.",
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
/* ── kash.rule@1.1.0 — the address, subjects, bounds, drafts ───────── */
|
|
329
|
+
|
|
330
|
+
export const KASH_RULE_1_1_ID = "kash.rule@1.1.0" as const;
|
|
331
|
+
|
|
332
|
+
/** What a criterion is about. d85(b) rule 1 binds when the subject is a person (or an organisation's people). */
|
|
333
|
+
export const SUBJECTS = ["person", "organisation", "product", "place"] as const;
|
|
334
|
+
export type Subject = (typeof SUBJECTS)[number];
|
|
335
|
+
|
|
336
|
+
export const ANCHOR_FAMILIES = ["movement", "knowledge", "work", "community"] as const;
|
|
337
|
+
export const AUTHORITY_KINDS = ["floor", "law", "standard", "institution", "community"] as const;
|
|
338
|
+
export const JOURNEYS = ["move", "learn", "earn-and-spend", "live", "leisure"] as const;
|
|
339
|
+
export const GIVENS = ["area", "spaces", "capitals", "culture", "economy", "time", "relations"] as const;
|
|
340
|
+
export type Given = (typeof GIVENS)[number];
|
|
341
|
+
export const SPACE_KINDS = ["premises", "workplace", "campus", "site", "vehicle", "home", "public-space", "online"] as const;
|
|
342
|
+
export const CAPITAL_KINDS = ["people", "systems", "resources"] as const;
|
|
343
|
+
export const ECONOMY_LEVELS = ["primary", "secondary", "tertiary", "quaternary", "quinary", "uncounted"] as const;
|
|
344
|
+
|
|
345
|
+
/** Bounds an adopter may set a parameter within: a range, or a list. */
|
|
346
|
+
export type ParameterBounds =
|
|
347
|
+
| { readonly min?: string | number; readonly max?: string | number }
|
|
348
|
+
| { readonly allowed: readonly (string | number | boolean)[] };
|
|
349
|
+
|
|
350
|
+
export interface RuleParameter1_1 extends RuleParameter {
|
|
351
|
+
readonly bounds?: ParameterBounds;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface Criterion1_1 extends Criterion {
|
|
355
|
+
readonly subject?: Subject;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface RuleRef {
|
|
359
|
+
readonly rule: string;
|
|
360
|
+
readonly version?: number;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface Givens {
|
|
364
|
+
readonly area?: { readonly text: string; readonly anywhere?: boolean; readonly countries?: readonly string[]; readonly places?: readonly string[] };
|
|
365
|
+
readonly spaces?: { readonly text: string; readonly kinds?: readonly (typeof SPACE_KINDS)[number][]; readonly places?: readonly string[] };
|
|
366
|
+
readonly capitals?: { readonly text: string; readonly needs?: readonly { readonly kind: (typeof CAPITAL_KINDS)[number]; readonly what: string }[] };
|
|
367
|
+
readonly culture?: { readonly text: string; readonly codes?: readonly { readonly title: string; readonly url?: string }[]; readonly languages?: readonly string[] };
|
|
368
|
+
readonly economy?: { readonly text: string; readonly level?: (typeof ECONOMY_LEVELS)[number] };
|
|
369
|
+
readonly time?: { readonly text: string; readonly lasts?: string; readonly renews?: string };
|
|
370
|
+
readonly relations?: { readonly text: string; readonly recognises?: readonly RuleRef[]; readonly within?: readonly { readonly id: string }[] };
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** Every rule has an address (d85(c)). */
|
|
374
|
+
export interface RuleAddress {
|
|
375
|
+
/** ISIC Revision 5: a section (A–V) or a two-digit division. */
|
|
376
|
+
readonly sector: { readonly classification: "ISIC"; readonly revision: "5"; readonly code: string };
|
|
377
|
+
readonly anchorFamily: (typeof ANCHOR_FAMILIES)[number];
|
|
378
|
+
readonly authority: { readonly kind: (typeof AUTHORITY_KINDS)[number]; readonly name?: string; readonly url?: string };
|
|
379
|
+
readonly journey: (typeof JOURNEYS)[number];
|
|
380
|
+
/** The seven givens. A rule is complete when all seven are answered. */
|
|
381
|
+
readonly givens: Givens;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface RuleBody1_1 extends Omit<RuleBody, "parameters" | "criteria"> {
|
|
385
|
+
readonly parameters?: Readonly<Record<string, RuleParameter1_1>>;
|
|
386
|
+
readonly criteria: readonly Criterion1_1[];
|
|
387
|
+
readonly address?: RuleAddress;
|
|
388
|
+
/** Published for reading and comment, never decided under. An incomplete rule publishes only as a draft. */
|
|
389
|
+
readonly draft?: boolean;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const VALUE = S.union(S.string({ maxLength: 256 }), S.number(), S.boolean());
|
|
393
|
+
const PLACE_REF = S.string({ pattern: /^did:kash:[1-9A-HJ-NP-Za-km-z]{32,48}\/place\/[a-z0-9][a-z0-9-]{0,62}$/ });
|
|
394
|
+
const DURATION = S.string({ pattern: /^P(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?$/ });
|
|
395
|
+
const RULE_ID = KASH_RULE_BODY_SCHEMA.properties.id!;
|
|
396
|
+
const GIVEN_TEXT = TEXT(600);
|
|
397
|
+
|
|
398
|
+
const PARAMETER_1_1 = S.object(
|
|
399
|
+
{
|
|
400
|
+
type: INPUT_TYPE,
|
|
401
|
+
value: S.optional(VALUE),
|
|
402
|
+
sealed: S.optional(HEX64),
|
|
403
|
+
bounds: S.optional(
|
|
404
|
+
S.union(
|
|
405
|
+
S.object({ min: S.optional(S.union(S.string({ maxLength: 64 }), S.number())), max: S.optional(S.union(S.string({ maxLength: 64 }), S.number())) }),
|
|
406
|
+
S.object({ allowed: S.array(VALUE, { minItems: 1, maxItems: 64 }) }, ["allowed"]),
|
|
407
|
+
),
|
|
408
|
+
),
|
|
409
|
+
},
|
|
410
|
+
["type"],
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
const GIVENS_SCHEMA = S.object({
|
|
414
|
+
area: S.optional(
|
|
415
|
+
S.object(
|
|
416
|
+
{ text: GIVEN_TEXT, anywhere: S.optional(S.boolean()), countries: S.optional(S.array(S.string({ pattern: /^[A-Z]{2}$/ }), { minItems: 1, maxItems: 64 })), places: S.optional(S.array(PLACE_REF, { minItems: 1, maxItems: 64 })) },
|
|
417
|
+
["text"],
|
|
418
|
+
),
|
|
419
|
+
),
|
|
420
|
+
spaces: S.optional(S.object({ text: GIVEN_TEXT, kinds: S.optional(S.array(S.enum(...SPACE_KINDS), { minItems: 1, maxItems: 8 })), places: S.optional(S.array(PLACE_REF, { minItems: 1, maxItems: 64 })) }, ["text"])),
|
|
421
|
+
capitals: S.optional(S.object({ text: GIVEN_TEXT, needs: S.optional(S.array(S.object({ kind: S.enum(...CAPITAL_KINDS), what: TEXT(200) }, ["kind", "what"]), { minItems: 1, maxItems: 16 })) }, ["text"])),
|
|
422
|
+
culture: S.optional(
|
|
423
|
+
S.object(
|
|
424
|
+
{ text: GIVEN_TEXT, codes: S.optional(S.array(S.object({ title: TEXT(200), url: S.optional(S.string({ format: "url" })) }, ["title"]), { minItems: 1, maxItems: 16 })), languages: S.optional(S.array(S.string({ format: "bcp47" }), { minItems: 1, maxItems: 16 })) },
|
|
425
|
+
["text"],
|
|
426
|
+
),
|
|
427
|
+
),
|
|
428
|
+
economy: S.optional(S.object({ text: GIVEN_TEXT, level: S.optional(S.enum(...ECONOMY_LEVELS)) }, ["text"])),
|
|
429
|
+
time: S.optional(S.object({ text: GIVEN_TEXT, lasts: S.optional(DURATION), renews: S.optional(DURATION) }, ["text"])),
|
|
430
|
+
relations: S.optional(
|
|
431
|
+
S.object(
|
|
432
|
+
{ text: GIVEN_TEXT, recognises: S.optional(S.array(S.object({ rule: RULE_ID, version: S.optional(S.number({ integer: true, min: 1 })) }, ["rule"]), { minItems: 1, maxItems: 32 })), within: S.optional(S.array(S.object({ id: S.string({ minLength: 1, maxLength: 256 }) }, ["id"]), { minItems: 1, maxItems: 16 })) },
|
|
433
|
+
["text"],
|
|
434
|
+
),
|
|
435
|
+
),
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
export const RULE_ADDRESS_SCHEMA: ObjectSchema = S.object(
|
|
439
|
+
{
|
|
440
|
+
sector: S.object({ classification: S.literal("ISIC"), revision: S.literal("5"), code: S.string({ pattern: /^([A-V]|\d{2})$/ }) }, ["classification", "revision", "code"]),
|
|
441
|
+
anchorFamily: S.enum(...ANCHOR_FAMILIES),
|
|
442
|
+
authority: S.object({ kind: S.enum(...AUTHORITY_KINDS), name: S.optional(TEXT(120)), url: S.optional(S.string({ format: "url" })) }, ["kind"]),
|
|
443
|
+
journey: S.enum(...JOURNEYS),
|
|
444
|
+
givens: GIVENS_SCHEMA,
|
|
445
|
+
},
|
|
446
|
+
["sector", "anchorFamily", "authority", "journey", "givens"],
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
export const CRITERION_1_1_SCHEMA: ObjectSchema = S.object({ ...CRITERION_SCHEMA.properties, subject: S.optional(S.enum(...SUBJECTS)) }, CRITERION_SCHEMA.required);
|
|
450
|
+
|
|
451
|
+
export const KASH_RULE_1_1_BODY_SCHEMA: ObjectSchema = S.object(
|
|
452
|
+
{
|
|
453
|
+
...KASH_RULE_BODY_SCHEMA.properties,
|
|
454
|
+
parameters: S.optional(S.record(PARAMETER_1_1, S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ }))),
|
|
455
|
+
criteria: S.array(CRITERION_1_1_SCHEMA, { minItems: 1, maxItems: 32 }),
|
|
456
|
+
address: S.optional(RULE_ADDRESS_SCHEMA),
|
|
457
|
+
draft: S.optional(S.boolean()),
|
|
458
|
+
},
|
|
459
|
+
KASH_RULE_BODY_SCHEMA.required,
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
export const KASH_RULE_1_1_LEXICON: LexiconDef = {
|
|
463
|
+
id: KASH_RULE_1_1_ID,
|
|
464
|
+
nsid: KASH_RULE_NSID,
|
|
465
|
+
semver: { major: 1, minor: 1, patch: 0 },
|
|
466
|
+
bodySchema: KASH_RULE_1_1_BODY_SCHEMA,
|
|
467
|
+
title: "A door's rule, with its address",
|
|
468
|
+
description:
|
|
469
|
+
"kash.rule@1.0.0 plus the address (ISIC Rev. 5 sector, anchor family, authority, journey, the seven givens), each criterion's subject, parameter bounds for adopters, and draft. A 1.0.0 body is a 1.1.0 body.",
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/* ── kash.adoption@1.0.0 ───────────────────────────────────────────── */
|
|
473
|
+
|
|
474
|
+
export const KASH_ADOPTION_NSID = "kash.adoption" as const;
|
|
475
|
+
export const KASH_ADOPTION_ID = "kash.adoption@1.0.0" as const;
|
|
476
|
+
|
|
477
|
+
export interface AdoptionBody {
|
|
478
|
+
/** `did:kash:<anchor>/adoption/<slug>`. */
|
|
479
|
+
readonly id: string;
|
|
480
|
+
/** The adopting organisation — the anchor whose door decides under it. */
|
|
481
|
+
readonly anchor: string;
|
|
482
|
+
readonly rule: { readonly id: string; readonly version: number; readonly hash: string };
|
|
483
|
+
/** Local values for the parameters the rule bounds — nothing else. */
|
|
484
|
+
readonly parameters: Readonly<Record<string, string | number | boolean>>;
|
|
485
|
+
/** It renews and ends, no later than the rule (d43). */
|
|
486
|
+
readonly dates: { readonly adopted: string; readonly renewBy: string; readonly endsAt: string };
|
|
487
|
+
readonly practice?: boolean;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export const KASH_ADOPTION_BODY_SCHEMA: ObjectSchema = S.object(
|
|
491
|
+
{
|
|
492
|
+
id: S.string({ pattern: /^did:kash:[1-9A-HJ-NP-Za-km-z]{32,48}\/adoption\/[a-z0-9][a-z0-9-]{0,62}$/ }),
|
|
493
|
+
anchor: DID,
|
|
494
|
+
rule: S.object({ id: RULE_ID, version: S.number({ integer: true, min: 1 }), hash: HEX64 }, ["id", "version", "hash"]),
|
|
495
|
+
parameters: S.record(VALUE, S.string({ pattern: /^[A-Za-z_][A-Za-z0-9_]{0,63}$/ })),
|
|
496
|
+
dates: S.object({ adopted: ISO, renewBy: ISO, endsAt: ISO }, ["adopted", "renewBy", "endsAt"]),
|
|
497
|
+
practice: S.optional(S.boolean()),
|
|
498
|
+
},
|
|
499
|
+
["id", "anchor", "rule", "parameters", "dates"],
|
|
500
|
+
);
|
|
501
|
+
|
|
502
|
+
export const KASH_ADOPTION_LEXICON: LexiconDef = {
|
|
503
|
+
id: KASH_ADOPTION_ID,
|
|
504
|
+
nsid: KASH_ADOPTION_NSID,
|
|
505
|
+
semver: { major: 1, minor: 0, patch: 0 },
|
|
506
|
+
bodySchema: KASH_ADOPTION_BODY_SCHEMA,
|
|
507
|
+
title: "An anchor's adoption of a rule",
|
|
508
|
+
description: "An organisation adopts one version of a rule with its own values for the parameters the rule bounds. Public, signed by the anchor.",
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
/* ── bundles ───────────────────────────────────────────────────────── */
|
|
512
|
+
|
|
513
|
+
/** Every door lexicon: the rule at 1.0.0 and 1.1.0, and the adoption. All public and organisation-authored (d59). */
|
|
514
|
+
export const DOOR_LEXICONS: readonly LexiconDef[] = [KASH_RULE_LEXICON, KASH_RULE_1_1_LEXICON, KASH_ADOPTION_LEXICON];
|
package/src/schema.ts
CHANGED
|
@@ -319,7 +319,11 @@ function validateObject(s: ObjectSchema, value: unknown, path: readonly (string
|
|
|
319
319
|
}
|
|
320
320
|
if (!s.additionalProperties) {
|
|
321
321
|
for (const k of Object.keys(obj)) {
|
|
322
|
-
|
|
322
|
+
// audit r1 (muffler F5): use own-key membership, not `k in s.properties`.
|
|
323
|
+
// `"__proto__" in s.properties` is `true` via Object.prototype, so the `in`
|
|
324
|
+
// form silently ACCEPTS a `__proto__`/`constructor` key under a strict
|
|
325
|
+
// (additionalProperties:false) schema — a prototype-pollution passthrough.
|
|
326
|
+
if (!Object.prototype.hasOwnProperty.call(s.properties, k)) {
|
|
323
327
|
errors.push(err([...path, k], "unknown field", obj[k]));
|
|
324
328
|
}
|
|
325
329
|
}
|