@nakafa/aksara-contracts 0.50.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +207 -152
- package/README.md +3 -0
- package/dist/artifact/integrity.d.ts +33 -8
- package/dist/artifact/integrity.js +19 -17
- package/dist/artifact/limits.d.ts +13 -7
- package/dist/artifact/limits.js +7 -15
- package/dist/artifact/source.d.ts +10 -4
- package/dist/artifact/source.js +4 -8
- package/dist/artifact/spec.d.ts +54 -22
- package/dist/artifact/spec.js +7 -8
- package/dist/artifact/verify.d.ts +11 -5
- package/dist/assessment/hash.d.ts +3 -1
- package/dist/assessment/paper.d.ts +3 -1
- package/dist/content.d.ts +37 -11
- package/dist/content.js +7 -21
- package/dist/errors.d.ts +3 -1
- package/dist/graph/family.d.ts +6 -2
- package/dist/graph/identity.d.ts +3 -1
- package/dist/hash/digest.d.ts +10 -0
- package/dist/hash/digest.js +40 -0
- package/dist/hash/stream.d.ts +12 -0
- package/dist/hash/stream.js +27 -0
- package/dist/hash/text.d.ts +3 -1
- package/dist/hash/text.js +2 -15
- package/dist/limits.d.ts +2 -2
- package/dist/limits.js +2 -2
- package/dist/preview/auth.d.ts +4 -2
- package/dist/preview/auth.js +26 -12
- package/dist/program/snapshot/digest.d.ts +3 -1
- package/dist/program/snapshot/digest.js +14 -22
- package/dist/program/snapshot/hash.d.ts +6 -2
- package/dist/program/snapshot/hash.js +10 -21
- package/dist/projection/digest.d.ts +11 -9
- package/dist/projection/digest.js +23 -32
- package/dist/projection/hash.d.ts +222 -2
- package/dist/projection/hash.js +6 -8
- package/dist/projection/verify.d.ts +16 -6
- package/dist/question/item.d.ts +3 -1
- package/dist/question/item.js +3 -1
- package/dist/quran/notes.d.ts +3 -1
- package/dist/quran/provenance.d.ts +6 -2
- package/dist/quran/provenance.js +8 -15
- package/dist/quran/snapshot/digest.d.ts +9 -5
- package/dist/quran/snapshot/digest.js +33 -41
- package/dist/quran/snapshot/hash.d.ts +3 -1
- package/dist/quran/snapshot/hash.js +9 -15
- package/dist/quran/snapshot/row/hash.d.ts +3 -1
- package/dist/quran/snapshot/row/hash.js +2 -8
- package/dist/release/digest.d.ts +10 -8
- package/dist/release/digest.js +22 -31
- package/dist/release/hash.d.ts +3 -1
- package/dist/release/hash.js +3 -8
- package/dist/release/items.d.ts +25 -9
- package/dist/release/items.js +12 -3
- package/dist/release/policy.d.ts +3 -1
- package/dist/release/result/digest.d.ts +23 -13
- package/dist/release/result/digest.js +20 -29
- package/dist/release/rollback/digest.d.ts +16 -10
- package/dist/release/rollback/digest.js +25 -32
- package/dist/release/rollback/spec.d.ts +102 -24
- package/dist/release/route/digest.d.ts +10 -8
- package/dist/release/route/digest.js +22 -31
- package/dist/release/route/verify.d.ts +16 -6
- package/dist/release/route/verify.js +8 -2
- package/dist/release/snapshot/evidence/requirement.d.ts +3 -1
- package/dist/release/snapshot/evidence/tryout.d.ts +1 -1
- package/dist/release/snapshot/evidence/tryout.js +1 -1
- package/dist/release/snapshot/evidence.d.ts +1 -1
- package/dist/release/snapshot/verify.d.ts +19 -7
- package/dist/release/snapshot/verify.js +20 -18
- package/dist/release/verify.d.ts +9 -3
- package/dist/renderer/compatibility.d.ts +6 -2
- package/dist/renderer/compatibility.js +3 -1
- package/dist/renderer/contract.d.ts +9 -3
- package/dist/renderer/contract.js +3 -1
- package/dist/runtime/error.d.ts +3 -1
- package/dist/runtime/protected/spec.d.ts +61 -16
- package/dist/runtime/protected/verify.d.ts +11 -5
- package/dist/runtime/spec.d.ts +44 -12
- package/dist/runtime/verify.d.ts +22 -10
- package/dist/runtime/verify.js +2 -1
- package/dist/signature/key.d.ts +21 -0
- package/dist/signature/key.js +104 -0
- package/dist/signature/spec.d.ts +18 -6
- package/dist/signature/spec.js +16 -4
- package/dist/transport/batch.d.ts +34 -8
- package/dist/transport/group.d.ts +51 -12
- package/dist/transport/request.d.ts +826 -764
- package/dist/transport/response.d.ts +148 -58
- package/dist/tree.d.ts +52 -0
- package/dist/tree.js +162 -0
- package/dist/tryout/canonical.d.ts +11 -1
- package/dist/tryout/canonical.js +6 -10
- package/dist/tryout/closure/accounting.d.ts +3 -1
- package/dist/tryout/digest.d.ts +12 -6
- package/dist/tryout/digest.js +21 -14
- package/dist/tryout/hash/catalog.d.ts +228 -3
- package/dist/tryout/hash/catalog.js +5 -7
- package/dist/tryout/hash/content.d.ts +113 -2
- package/dist/tryout/hash/content.js +10 -8
- package/dist/tryout/hash/placement.d.ts +236 -5
- package/dist/tryout/hash/placement.js +7 -8
- package/dist/tryout/runtime/hash.d.ts +3 -1
- package/dist/tryout/runtime/hash.js +3 -1
- package/dist/tryout/runtime/source.d.ts +3 -1
- package/dist/tryout/runtime/verify.d.ts +13 -5
- package/dist/tryout/runtime/verify.js +1 -1
- package/dist/tryout/scoring.d.ts +3 -1
- package/dist/tryout/snapshot/hash.d.ts +45 -4
- package/dist/tryout/snapshot/hash.js +9 -7
- package/package.json +22 -2
|
@@ -997,12 +997,25 @@ export declare const PublicationRollbackSuccessSchema: Schema.Struct<{
|
|
|
997
997
|
readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
|
|
998
998
|
readonly payload: Schema.Struct<{
|
|
999
999
|
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
1000
|
-
readonly byteLength: Schema.Finite;
|
|
1001
|
-
readonly compiledCode: Schema.String;
|
|
1002
1000
|
readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
1003
|
-
readonly compilerVersion: Schema.Literal<"0.
|
|
1001
|
+
readonly compilerVersion: Schema.Literal<"0.2.0">;
|
|
1004
1002
|
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
1005
|
-
readonly
|
|
1003
|
+
readonly contentTree: Schema.Codec<{
|
|
1004
|
+
readonly $node: "element";
|
|
1005
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
1006
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
1007
|
+
readonly props: {
|
|
1008
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
1009
|
+
};
|
|
1010
|
+
}, {
|
|
1011
|
+
readonly $node: "element";
|
|
1012
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
1013
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
1014
|
+
readonly props: {
|
|
1015
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
1016
|
+
};
|
|
1017
|
+
}, never, never>;
|
|
1018
|
+
readonly format: Schema.Literal<"content-tree">;
|
|
1006
1019
|
readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
|
|
1007
1020
|
readonly plainText: Schema.String;
|
|
1008
1021
|
readonly rawMdx: Schema.String;
|
|
@@ -1241,12 +1254,25 @@ export declare const PublicationRollbackSuccessSchema: Schema.Struct<{
|
|
|
1241
1254
|
readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
|
|
1242
1255
|
readonly payload: Schema.Struct<{
|
|
1243
1256
|
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
1244
|
-
readonly byteLength: Schema.Finite;
|
|
1245
|
-
readonly compiledCode: Schema.String;
|
|
1246
1257
|
readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
1247
|
-
readonly compilerVersion: Schema.Literal<"0.
|
|
1258
|
+
readonly compilerVersion: Schema.Literal<"0.2.0">;
|
|
1248
1259
|
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
1249
|
-
readonly
|
|
1260
|
+
readonly contentTree: Schema.Codec<{
|
|
1261
|
+
readonly $node: "element";
|
|
1262
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
1263
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
1264
|
+
readonly props: {
|
|
1265
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
1266
|
+
};
|
|
1267
|
+
}, {
|
|
1268
|
+
readonly $node: "element";
|
|
1269
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
1270
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
1271
|
+
readonly props: {
|
|
1272
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
1273
|
+
};
|
|
1274
|
+
}, never, never>;
|
|
1275
|
+
readonly format: Schema.Literal<"content-tree">;
|
|
1250
1276
|
readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
|
|
1251
1277
|
readonly plainText: Schema.String;
|
|
1252
1278
|
readonly rawMdx: Schema.String;
|
|
@@ -2439,12 +2465,25 @@ export declare const PublicationSuccessSchema: Schema.Union<readonly [Schema.Str
|
|
|
2439
2465
|
readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
|
|
2440
2466
|
readonly payload: Schema.Struct<{
|
|
2441
2467
|
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
2442
|
-
readonly byteLength: Schema.Finite;
|
|
2443
|
-
readonly compiledCode: Schema.String;
|
|
2444
2468
|
readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
2445
|
-
readonly compilerVersion: Schema.Literal<"0.
|
|
2469
|
+
readonly compilerVersion: Schema.Literal<"0.2.0">;
|
|
2446
2470
|
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
2447
|
-
readonly
|
|
2471
|
+
readonly contentTree: Schema.Codec<{
|
|
2472
|
+
readonly $node: "element";
|
|
2473
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
2474
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
2475
|
+
readonly props: {
|
|
2476
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
2477
|
+
};
|
|
2478
|
+
}, {
|
|
2479
|
+
readonly $node: "element";
|
|
2480
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
2481
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
2482
|
+
readonly props: {
|
|
2483
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
2484
|
+
};
|
|
2485
|
+
}, never, never>;
|
|
2486
|
+
readonly format: Schema.Literal<"content-tree">;
|
|
2448
2487
|
readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
|
|
2449
2488
|
readonly plainText: Schema.String;
|
|
2450
2489
|
readonly rawMdx: Schema.String;
|
|
@@ -2683,12 +2722,25 @@ export declare const PublicationSuccessSchema: Schema.Union<readonly [Schema.Str
|
|
|
2683
2722
|
readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
|
|
2684
2723
|
readonly payload: Schema.Struct<{
|
|
2685
2724
|
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
2686
|
-
readonly byteLength: Schema.Finite;
|
|
2687
|
-
readonly compiledCode: Schema.String;
|
|
2688
2725
|
readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
2689
|
-
readonly compilerVersion: Schema.Literal<"0.
|
|
2726
|
+
readonly compilerVersion: Schema.Literal<"0.2.0">;
|
|
2690
2727
|
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
2691
|
-
readonly
|
|
2728
|
+
readonly contentTree: Schema.Codec<{
|
|
2729
|
+
readonly $node: "element";
|
|
2730
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
2731
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
2732
|
+
readonly props: {
|
|
2733
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
2734
|
+
};
|
|
2735
|
+
}, {
|
|
2736
|
+
readonly $node: "element";
|
|
2737
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
2738
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
2739
|
+
readonly props: {
|
|
2740
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
2741
|
+
};
|
|
2742
|
+
}, never, never>;
|
|
2743
|
+
readonly format: Schema.Literal<"content-tree">;
|
|
2692
2744
|
readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
|
|
2693
2745
|
readonly plainText: Schema.String;
|
|
2694
2746
|
readonly rawMdx: Schema.String;
|
|
@@ -3947,12 +3999,25 @@ export declare const PublicationResponseSchema: Schema.Union<readonly [Schema.Un
|
|
|
3947
3999
|
readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
|
|
3948
4000
|
readonly payload: Schema.Struct<{
|
|
3949
4001
|
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
3950
|
-
readonly byteLength: Schema.Finite;
|
|
3951
|
-
readonly compiledCode: Schema.String;
|
|
3952
4002
|
readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
3953
|
-
readonly compilerVersion: Schema.Literal<"0.
|
|
4003
|
+
readonly compilerVersion: Schema.Literal<"0.2.0">;
|
|
3954
4004
|
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
3955
|
-
readonly
|
|
4005
|
+
readonly contentTree: Schema.Codec<{
|
|
4006
|
+
readonly $node: "element";
|
|
4007
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
4008
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
4009
|
+
readonly props: {
|
|
4010
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
4011
|
+
};
|
|
4012
|
+
}, {
|
|
4013
|
+
readonly $node: "element";
|
|
4014
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
4015
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
4016
|
+
readonly props: {
|
|
4017
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
4018
|
+
};
|
|
4019
|
+
}, never, never>;
|
|
4020
|
+
readonly format: Schema.Literal<"content-tree">;
|
|
3956
4021
|
readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
|
|
3957
4022
|
readonly plainText: Schema.String;
|
|
3958
4023
|
readonly rawMdx: Schema.String;
|
|
@@ -4191,12 +4256,25 @@ export declare const PublicationResponseSchema: Schema.Union<readonly [Schema.Un
|
|
|
4191
4256
|
readonly keyId: Schema.brand<Schema.String, "@NakafaAI/AksaraSigningKeyId">;
|
|
4192
4257
|
readonly payload: Schema.Struct<{
|
|
4193
4258
|
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
4194
|
-
readonly byteLength: Schema.Finite;
|
|
4195
|
-
readonly compiledCode: Schema.String;
|
|
4196
4259
|
readonly compilerConfigHash: Schema.brand<Schema.String, "@NakafaAI/AksaraSha256Hash">;
|
|
4197
|
-
readonly compilerVersion: Schema.Literal<"0.
|
|
4260
|
+
readonly compilerVersion: Schema.Literal<"0.2.0">;
|
|
4198
4261
|
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
4199
|
-
readonly
|
|
4262
|
+
readonly contentTree: Schema.Codec<{
|
|
4263
|
+
readonly $node: "element";
|
|
4264
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
4265
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
4266
|
+
readonly props: {
|
|
4267
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
4268
|
+
};
|
|
4269
|
+
}, {
|
|
4270
|
+
readonly $node: "element";
|
|
4271
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
4272
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
4273
|
+
readonly props: {
|
|
4274
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
4275
|
+
};
|
|
4276
|
+
}, never, never>;
|
|
4277
|
+
readonly format: Schema.Literal<"content-tree">;
|
|
4200
4278
|
readonly mdxCompilerVersion: Schema.Literal<"3.1.1">;
|
|
4201
4279
|
readonly plainText: Schema.String;
|
|
4202
4280
|
readonly rawMdx: Schema.String;
|
|
@@ -5266,12 +5344,18 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5266
5344
|
readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
|
|
5267
5345
|
readonly payload: {
|
|
5268
5346
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
5269
|
-
readonly byteLength: number;
|
|
5270
|
-
readonly compiledCode: string;
|
|
5271
5347
|
readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
5272
|
-
readonly compilerVersion: "0.
|
|
5348
|
+
readonly compilerVersion: "0.2.0";
|
|
5273
5349
|
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
5274
|
-
readonly
|
|
5350
|
+
readonly contentTree: {
|
|
5351
|
+
readonly $node: "element";
|
|
5352
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
5353
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
5354
|
+
readonly props: {
|
|
5355
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
5356
|
+
};
|
|
5357
|
+
};
|
|
5358
|
+
readonly format: "content-tree";
|
|
5275
5359
|
readonly mdxCompilerVersion: "3.1.1";
|
|
5276
5360
|
readonly plainText: string;
|
|
5277
5361
|
readonly rawMdx: string;
|
|
@@ -5399,13 +5483,18 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5399
5483
|
};
|
|
5400
5484
|
readonly stimulusKey?: string;
|
|
5401
5485
|
readonly response: {
|
|
5402
|
-
readonly
|
|
5403
|
-
|
|
5404
|
-
readonly isCorrect: boolean;
|
|
5486
|
+
readonly categories: readonly {
|
|
5487
|
+
readonly categoryKey: string;
|
|
5405
5488
|
readonly label: string;
|
|
5406
|
-
readonly optionKey: string;
|
|
5407
5489
|
readonly order: number;
|
|
5408
5490
|
}[];
|
|
5491
|
+
readonly kind: "category";
|
|
5492
|
+
readonly statements: readonly {
|
|
5493
|
+
readonly correctCategoryKey: string;
|
|
5494
|
+
readonly label: string;
|
|
5495
|
+
readonly order: number;
|
|
5496
|
+
readonly statementKey: string;
|
|
5497
|
+
}[];
|
|
5409
5498
|
} | {
|
|
5410
5499
|
readonly kind: "multiple-choice";
|
|
5411
5500
|
readonly options: readonly {
|
|
@@ -5415,17 +5504,12 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5415
5504
|
readonly order: number;
|
|
5416
5505
|
}[];
|
|
5417
5506
|
} | {
|
|
5418
|
-
readonly
|
|
5419
|
-
|
|
5420
|
-
readonly
|
|
5421
|
-
readonly order: number;
|
|
5422
|
-
}[];
|
|
5423
|
-
readonly kind: "category";
|
|
5424
|
-
readonly statements: readonly {
|
|
5425
|
-
readonly correctCategoryKey: string;
|
|
5507
|
+
readonly kind: "single-choice";
|
|
5508
|
+
readonly options: readonly {
|
|
5509
|
+
readonly isCorrect: boolean;
|
|
5426
5510
|
readonly label: string;
|
|
5511
|
+
readonly optionKey: string;
|
|
5427
5512
|
readonly order: number;
|
|
5428
|
-
readonly statementKey: string;
|
|
5429
5513
|
}[];
|
|
5430
5514
|
} | {
|
|
5431
5515
|
readonly criteria: readonly {
|
|
@@ -5518,12 +5602,18 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5518
5602
|
readonly keyId: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSigningKeyId">;
|
|
5519
5603
|
readonly payload: {
|
|
5520
5604
|
readonly artifactLocale: ("de" | "en" | "id") & import("effect/Brand").Brand<"@NakafaAI/AksaraArtifactLocale">;
|
|
5521
|
-
readonly byteLength: number;
|
|
5522
|
-
readonly compiledCode: string;
|
|
5523
5605
|
readonly compilerConfigHash: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
5524
|
-
readonly compilerVersion: "0.
|
|
5606
|
+
readonly compilerVersion: "0.2.0";
|
|
5525
5607
|
readonly contentKey: string & import("effect/Brand").Brand<"@NakafaAI/AksaraContentKey">;
|
|
5526
|
-
readonly
|
|
5608
|
+
readonly contentTree: {
|
|
5609
|
+
readonly $node: "element";
|
|
5610
|
+
readonly children: readonly import("../tree.js").ContentTreeChild[];
|
|
5611
|
+
readonly name: import("../tree.js").ContentTreeElementName;
|
|
5612
|
+
readonly props: {
|
|
5613
|
+
readonly [key: string]: import("../tree.js").ContentTreeValue;
|
|
5614
|
+
};
|
|
5615
|
+
};
|
|
5616
|
+
readonly format: "content-tree";
|
|
5527
5617
|
readonly mdxCompilerVersion: "3.1.1";
|
|
5528
5618
|
readonly plainText: string;
|
|
5529
5619
|
readonly rawMdx: string;
|
|
@@ -5651,12 +5741,17 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5651
5741
|
};
|
|
5652
5742
|
readonly stimulusKey?: string;
|
|
5653
5743
|
readonly response: {
|
|
5654
|
-
readonly
|
|
5655
|
-
|
|
5656
|
-
readonly
|
|
5744
|
+
readonly categories: readonly {
|
|
5745
|
+
readonly categoryKey: string;
|
|
5746
|
+
readonly label: string;
|
|
5747
|
+
readonly order: number;
|
|
5748
|
+
}[];
|
|
5749
|
+
readonly kind: "category";
|
|
5750
|
+
readonly statements: readonly {
|
|
5751
|
+
readonly correctCategoryKey: string;
|
|
5657
5752
|
readonly label: string;
|
|
5658
|
-
readonly optionKey: string;
|
|
5659
5753
|
readonly order: number;
|
|
5754
|
+
readonly statementKey: string;
|
|
5660
5755
|
}[];
|
|
5661
5756
|
} | {
|
|
5662
5757
|
readonly kind: "multiple-choice";
|
|
@@ -5667,17 +5762,12 @@ export declare const decodePublicationResponse: (input: unknown) => Effect.Effec
|
|
|
5667
5762
|
readonly order: number;
|
|
5668
5763
|
}[];
|
|
5669
5764
|
} | {
|
|
5670
|
-
readonly
|
|
5671
|
-
|
|
5672
|
-
readonly
|
|
5673
|
-
readonly order: number;
|
|
5674
|
-
}[];
|
|
5675
|
-
readonly kind: "category";
|
|
5676
|
-
readonly statements: readonly {
|
|
5677
|
-
readonly correctCategoryKey: string;
|
|
5765
|
+
readonly kind: "single-choice";
|
|
5766
|
+
readonly options: readonly {
|
|
5767
|
+
readonly isCorrect: boolean;
|
|
5678
5768
|
readonly label: string;
|
|
5769
|
+
readonly optionKey: string;
|
|
5679
5770
|
readonly order: number;
|
|
5680
|
-
readonly statementKey: string;
|
|
5681
5771
|
}[];
|
|
5682
5772
|
} | {
|
|
5683
5773
|
readonly criteria: readonly {
|
package/dist/tree.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Intrinsic HTML tags that the Markdown and MDX pipeline may emit, in code-unit order. */
|
|
3
|
+
export declare const CONTENT_TREE_INTRINSIC_TAGS: readonly ["a", "blockquote", "br", "code", "del", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "pre", "section", "strong", "sub", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"];
|
|
4
|
+
/** One intrinsic HTML tag from the allowed pipeline list. */
|
|
5
|
+
export declare const ContentTreeIntrinsicTagSchema: Schema.Literals<readonly ["a", "blockquote", "br", "code", "del", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "pre", "section", "strong", "sub", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"]>;
|
|
6
|
+
/** The element name of one tree node: the fragment, an intrinsic tag, or a renderer component. */
|
|
7
|
+
export declare const ContentTreeElementNameSchema: Schema.Union<readonly [Schema.Literal<"fragment">, Schema.Literals<readonly ["a", "blockquote", "br", "code", "del", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "img", "input", "li", "ol", "p", "pre", "section", "strong", "sub", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"]>, Schema.String]>;
|
|
8
|
+
export type ContentTreeElementName = typeof ContentTreeElementNameSchema.Type;
|
|
9
|
+
/**
|
|
10
|
+
* A value a prop or a list may hold: JSON data, an element of the tree, or a
|
|
11
|
+
* plain JSON object whose values are tree values. The recursive shapes are
|
|
12
|
+
* object members of this union, which is how the repository names recursive
|
|
13
|
+
* Schema types, so the element and props names below are derived from it.
|
|
14
|
+
*/
|
|
15
|
+
export type ContentTreeValue = null | boolean | number | string | readonly ContentTreeValue[] | {
|
|
16
|
+
readonly $node: "element";
|
|
17
|
+
readonly children: readonly ContentTreeChild[];
|
|
18
|
+
readonly name: ContentTreeElementName;
|
|
19
|
+
readonly props: {
|
|
20
|
+
readonly [key: string]: ContentTreeValue;
|
|
21
|
+
};
|
|
22
|
+
} | {
|
|
23
|
+
readonly [key: string]: ContentTreeValue;
|
|
24
|
+
};
|
|
25
|
+
/** One rendered node: its name, its props, and its ordered children. */
|
|
26
|
+
export type ContentTreeElement = Extract<ContentTreeValue, {
|
|
27
|
+
readonly $node: "element";
|
|
28
|
+
}>;
|
|
29
|
+
/** Named props of one element, each a JSON value or an element of the tree. */
|
|
30
|
+
export type ContentTreeProps = ContentTreeElement["props"];
|
|
31
|
+
/** Text, or one element in the order React would render it. */
|
|
32
|
+
export type ContentTreeChild = string | ContentTreeElement;
|
|
33
|
+
/** The signed content tree: the fragment that Nakafa renders with its component map. */
|
|
34
|
+
export declare const ContentTreeSchema: Schema.Codec<{
|
|
35
|
+
readonly $node: "element";
|
|
36
|
+
readonly children: readonly ContentTreeChild[];
|
|
37
|
+
readonly name: ContentTreeElementName;
|
|
38
|
+
readonly props: {
|
|
39
|
+
readonly [key: string]: ContentTreeValue;
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
readonly $node: "element";
|
|
43
|
+
readonly children: readonly ContentTreeChild[];
|
|
44
|
+
readonly name: ContentTreeElementName;
|
|
45
|
+
readonly props: {
|
|
46
|
+
readonly [key: string]: ContentTreeValue;
|
|
47
|
+
};
|
|
48
|
+
}, never, never>;
|
|
49
|
+
/** Serializes the tree as the exact JSON text that hashes and signatures cover. */
|
|
50
|
+
export declare function canonicalizeContentTree(tree: ContentTreeElement): string;
|
|
51
|
+
/** Lists the renderer components that one tree uses, once each, in first-use order. */
|
|
52
|
+
export declare function contentTreeComponentNames(tree: ContentTreeElement): readonly string[];
|
package/dist/tree.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Array as Arr, Order, Predicate, Record as Rec, Schema } from "effect";
|
|
2
|
+
import { encodeJsonText } from "#contracts/text/json";
|
|
3
|
+
/** Key that only an element may carry, so a plain JSON object can never imitate one. */
|
|
4
|
+
const ELEMENT_KEY = "$node";
|
|
5
|
+
/** Name of the element that renders its children without an element of its own. */
|
|
6
|
+
const FRAGMENT_NAME = "fragment";
|
|
7
|
+
/** Renderer components are capitalized JSX names, never intrinsic tags. */
|
|
8
|
+
const COMPONENT_NAME_PATTERN = /^[A-Z][A-Za-z0-9]*$/;
|
|
9
|
+
/** Intrinsic HTML tags that the Markdown and MDX pipeline may emit, in code-unit order. */
|
|
10
|
+
export const CONTENT_TREE_INTRINSIC_TAGS = [
|
|
11
|
+
"a",
|
|
12
|
+
"blockquote",
|
|
13
|
+
"br",
|
|
14
|
+
"code",
|
|
15
|
+
"del",
|
|
16
|
+
"div",
|
|
17
|
+
"em",
|
|
18
|
+
"h1",
|
|
19
|
+
"h2",
|
|
20
|
+
"h3",
|
|
21
|
+
"h4",
|
|
22
|
+
"h5",
|
|
23
|
+
"h6",
|
|
24
|
+
"hr",
|
|
25
|
+
"img",
|
|
26
|
+
"input",
|
|
27
|
+
"li",
|
|
28
|
+
"ol",
|
|
29
|
+
"p",
|
|
30
|
+
"pre",
|
|
31
|
+
"section",
|
|
32
|
+
"strong",
|
|
33
|
+
"sub",
|
|
34
|
+
"sup",
|
|
35
|
+
"table",
|
|
36
|
+
"tbody",
|
|
37
|
+
"td",
|
|
38
|
+
"th",
|
|
39
|
+
"thead",
|
|
40
|
+
"tr",
|
|
41
|
+
"ul",
|
|
42
|
+
];
|
|
43
|
+
/** One intrinsic HTML tag from the allowed pipeline list. */
|
|
44
|
+
export const ContentTreeIntrinsicTagSchema = Schema.Literals(CONTENT_TREE_INTRINSIC_TAGS);
|
|
45
|
+
/** The element name of one tree node: the fragment, an intrinsic tag, or a renderer component. */
|
|
46
|
+
export const ContentTreeElementNameSchema = Schema.Union([
|
|
47
|
+
Schema.Literal(FRAGMENT_NAME),
|
|
48
|
+
ContentTreeIntrinsicTagSchema,
|
|
49
|
+
Schema.String.check(Schema.isPattern(COMPONENT_NAME_PATTERN)),
|
|
50
|
+
]);
|
|
51
|
+
/** Rejects a props object that uses the reserved element key. */
|
|
52
|
+
function hasNoElementKey(props) {
|
|
53
|
+
return !Predicate.hasProperty(props, ELEMENT_KEY);
|
|
54
|
+
}
|
|
55
|
+
/** Any prop value: JSON data or a nested element. */
|
|
56
|
+
const ContentTreeValueSchema = Schema.suspend(() => Schema.Union([
|
|
57
|
+
Schema.Null,
|
|
58
|
+
Schema.Boolean,
|
|
59
|
+
Schema.Finite,
|
|
60
|
+
Schema.String,
|
|
61
|
+
Schema.Array(ContentTreeValueSchema),
|
|
62
|
+
ContentTreeElementSchema,
|
|
63
|
+
ContentTreePropsSchema,
|
|
64
|
+
]));
|
|
65
|
+
/** Props of one element or one plain JSON object, never carrying the element key. */
|
|
66
|
+
const ContentTreePropsSchema = Schema.suspend(() => Schema.Record(Schema.String, ContentTreeValueSchema).check(Schema.makeFilter(hasNoElementKey, {
|
|
67
|
+
message: "Expected props without the reserved element key.",
|
|
68
|
+
})));
|
|
69
|
+
/** Text or a nested element. */
|
|
70
|
+
const ContentTreeChildSchema = Schema.suspend(() => Schema.Union([Schema.String, ContentTreeElementSchema]));
|
|
71
|
+
/**
|
|
72
|
+
* One element of the tree, with its reserved marker and its exact fields. The
|
|
73
|
+
* signed bytes come from canonicalizeContentTree, never from the key order of a
|
|
74
|
+
* decoded object, which the repository's formatter keeps alphabetical.
|
|
75
|
+
*/
|
|
76
|
+
const ContentTreeElementSchema = Schema.Struct({
|
|
77
|
+
$node: Schema.Literal("element"),
|
|
78
|
+
children: Schema.Array(ContentTreeChildSchema),
|
|
79
|
+
name: ContentTreeElementNameSchema,
|
|
80
|
+
props: ContentTreePropsSchema,
|
|
81
|
+
});
|
|
82
|
+
/** The signed content tree: the fragment that Nakafa renders with its component map. */
|
|
83
|
+
export const ContentTreeSchema = ContentTreeElementSchema.check(Schema.makeFilter((tree) => tree.name === FRAGMENT_NAME, {
|
|
84
|
+
message: "Expected the fragment as the content tree root.",
|
|
85
|
+
}));
|
|
86
|
+
/** Checks whether a tree value is an element rather than JSON data. */
|
|
87
|
+
function isElement(value) {
|
|
88
|
+
return (Predicate.isObject(value) &&
|
|
89
|
+
!Arr.isArray(value) &&
|
|
90
|
+
Predicate.hasProperty(value, ELEMENT_KEY));
|
|
91
|
+
}
|
|
92
|
+
/** Checks whether a tree value is a list of tree values. */
|
|
93
|
+
function isList(value) {
|
|
94
|
+
return Arr.isArray(value);
|
|
95
|
+
}
|
|
96
|
+
/** Checks whether a tree value is a plain props object. */
|
|
97
|
+
function isProps(value) {
|
|
98
|
+
return Predicate.isObject(value);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Writes one props object as JSON text with its keys in code-unit order. The
|
|
102
|
+
* text is assembled by hand, so no formatter or key sort can change its bytes.
|
|
103
|
+
*/
|
|
104
|
+
function canonicalPropsText(props) {
|
|
105
|
+
const entries = Arr.sortWith(Rec.toEntries(props), ([key]) => key, Order.String);
|
|
106
|
+
const texts = Arr.map(entries, ([key, value]) => `${encodeJsonText(key)}:${canonicalValueText(value)}`);
|
|
107
|
+
return `{${Arr.join(texts, ",")}}`;
|
|
108
|
+
}
|
|
109
|
+
/** Writes one tree value as JSON text in the one canonical form. */
|
|
110
|
+
function canonicalValueText(value) {
|
|
111
|
+
if (isElement(value)) {
|
|
112
|
+
return canonicalElementText(value);
|
|
113
|
+
}
|
|
114
|
+
if (isList(value)) {
|
|
115
|
+
return `[${Arr.join(Arr.map(value, canonicalValueText), ",")}]`;
|
|
116
|
+
}
|
|
117
|
+
if (isProps(value)) {
|
|
118
|
+
return canonicalPropsText(value);
|
|
119
|
+
}
|
|
120
|
+
return encodeJsonText(value);
|
|
121
|
+
}
|
|
122
|
+
/** Writes one element as JSON text with its fields in the declared order. */
|
|
123
|
+
function canonicalElementText(element) {
|
|
124
|
+
const children = Arr.join(Arr.map(element.children, (child) => typeof child === "string"
|
|
125
|
+
? encodeJsonText(child)
|
|
126
|
+
: canonicalElementText(child)), ",");
|
|
127
|
+
return `{"$node":"element","name":${encodeJsonText(element.name)},"props":${canonicalPropsText(element.props)},"children":[${children}]}`;
|
|
128
|
+
}
|
|
129
|
+
/** Serializes the tree as the exact JSON text that hashes and signatures cover. */
|
|
130
|
+
export function canonicalizeContentTree(tree) {
|
|
131
|
+
return canonicalElementText(tree);
|
|
132
|
+
}
|
|
133
|
+
/** Checks whether an element name is a renderer component, not the fragment or an intrinsic tag. */
|
|
134
|
+
function isComponentElementName(name) {
|
|
135
|
+
return (name !== FRAGMENT_NAME && !Schema.is(ContentTreeIntrinsicTagSchema)(name));
|
|
136
|
+
}
|
|
137
|
+
/** Collects the component names of one element and of every element nested beneath it. */
|
|
138
|
+
function componentNamesOfElement(element) {
|
|
139
|
+
const own = isComponentElementName(element.name) ? [element.name] : [];
|
|
140
|
+
return [
|
|
141
|
+
...own,
|
|
142
|
+
...Arr.flatMap(element.children, (child) => typeof child === "string" ? [] : componentNamesOfElement(child)),
|
|
143
|
+
...Arr.flatMap(Rec.values(element.props), componentNamesOfValue),
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
/** Collects the component names of one prop value, which may hold lists, objects, and elements. */
|
|
147
|
+
function componentNamesOfValue(value) {
|
|
148
|
+
if (isElement(value)) {
|
|
149
|
+
return componentNamesOfElement(value);
|
|
150
|
+
}
|
|
151
|
+
if (isList(value)) {
|
|
152
|
+
return Arr.flatMap(value, componentNamesOfValue);
|
|
153
|
+
}
|
|
154
|
+
if (isProps(value)) {
|
|
155
|
+
return Arr.flatMap(Rec.values(value), componentNamesOfValue);
|
|
156
|
+
}
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
/** Lists the renderer components that one tree uses, once each, in first-use order. */
|
|
160
|
+
export function contentTreeComponentNames(tree) {
|
|
161
|
+
return Arr.dedupe(componentNamesOfElement(tree));
|
|
162
|
+
}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
declare const TryoutCanonicalHashError_base: Schema.Class<TryoutCanonicalHashError, Schema.TaggedStruct<"TryoutCanonicalHashError", {
|
|
3
|
+
readonly domain: Schema.String;
|
|
4
|
+
}>, import("effect/Cause").YieldableError & {
|
|
5
|
+
readonly brand: unique symbol;
|
|
6
|
+
}>;
|
|
7
|
+
/** Web Crypto could not hash one domain-separated try-out identity. */
|
|
8
|
+
export declare class TryoutCanonicalHashError extends TryoutCanonicalHashError_base {
|
|
9
|
+
}
|
|
1
10
|
/** Computes one domain-separated canonical try-out SHA-256 identity. */
|
|
2
|
-
export declare
|
|
11
|
+
export declare const hashTryoutCanonical: (domain: string, canonical: string) => Effect.Effect<string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">, TryoutCanonicalHashError, never>;
|
|
12
|
+
export {};
|
package/dist/tryout/canonical.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
export
|
|
5
|
-
const digest = createHash("sha256")
|
|
6
|
-
.update(domain)
|
|
7
|
-
.update("\n")
|
|
8
|
-
.update(canonical)
|
|
9
|
-
.digest("hex");
|
|
10
|
-
return Sha256HashSchema.make(`sha256:${digest}`);
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { hashText } from "#contracts/hash/text";
|
|
3
|
+
/** Web Crypto could not hash one domain-separated try-out identity. */
|
|
4
|
+
export class TryoutCanonicalHashError extends Schema.TaggedError()("TryoutCanonicalHashError", { domain: Schema.String }) {
|
|
11
5
|
}
|
|
6
|
+
/** Computes one domain-separated canonical try-out SHA-256 identity. */
|
|
7
|
+
export const hashTryoutCanonical = Effect.fn("AksaraContracts.hashTryoutCanonical")((domain, canonical) => hashText(`${domain}\n${canonical}`).pipe(Effect.mapError(() => new TryoutCanonicalHashError({ domain }))));
|
|
@@ -7,7 +7,9 @@ declare const TryoutClosureError_base: Schema.Class<TryoutClosureError, Schema.T
|
|
|
7
7
|
readonly code: Schema.Literals<readonly ["assessed-language", "duplicate-locale", "fact-mismatch", "inactive-locale", "missing-locale", "missing-section", "question-count"]>;
|
|
8
8
|
readonly expected: Schema.String;
|
|
9
9
|
readonly identity: Schema.String;
|
|
10
|
-
}>, import("effect/Cause").YieldableError
|
|
10
|
+
}>, import("effect/Cause").YieldableError & {
|
|
11
|
+
readonly brand: unique symbol;
|
|
12
|
+
}>;
|
|
11
13
|
/** A try-out snapshot is incomplete or inconsistent across app locales. */
|
|
12
14
|
export declare class TryoutClosureError extends TryoutClosureError_base {
|
|
13
15
|
}
|
package/dist/tryout/digest.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Effect, Schema, Stream } from "effect";
|
|
2
|
-
import { Sha256HashSchema } from "#contracts/ids";
|
|
2
|
+
import type { Sha256HashSchema } from "#contracts/ids";
|
|
3
3
|
declare const TryoutDigestError_base: Schema.Class<TryoutDigestError, Schema.TaggedStruct<"TryoutDigestError", {
|
|
4
4
|
readonly code: Schema.Literals<readonly ["integrity", "order"]>;
|
|
5
5
|
readonly identity: Schema.String;
|
|
6
|
-
}>, import("effect/Cause").YieldableError
|
|
6
|
+
}>, import("effect/Cause").YieldableError & {
|
|
7
|
+
readonly brand: unique symbol;
|
|
8
|
+
}>;
|
|
7
9
|
/** A snapshot stream is duplicated, unsorted, or tampered. */
|
|
8
10
|
export declare class TryoutDigestError extends TryoutDigestError_base {
|
|
9
11
|
}
|
|
@@ -11,8 +13,12 @@ interface DigestRecord<Row> {
|
|
|
11
13
|
readonly row: Row;
|
|
12
14
|
readonly rowHash: typeof Sha256HashSchema.Type;
|
|
13
15
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Digests one canonically ordered record stream. The canonical bytes are held
|
|
18
|
+
* until one Web Crypto digest runs over them, because Web Crypto has no
|
|
19
|
+
* incremental form.
|
|
20
|
+
*/
|
|
21
|
+
export declare const digestTryoutRecords: <E, R, Row, HashError>(input: {
|
|
16
22
|
/** Serializes one row into its exact digest bytes. */
|
|
17
23
|
readonly canonicalize: (row: Row) => string;
|
|
18
24
|
readonly domain: string;
|
|
@@ -20,9 +26,9 @@ export declare const digestTryoutRecords: <E, R, Row>(input: {
|
|
|
20
26
|
readonly identity: (row: Row) => string;
|
|
21
27
|
readonly records: Stream.Stream<DigestRecord<Row>, E, R>;
|
|
22
28
|
/** Recomputes the authenticated row hash for integrity checking. */
|
|
23
|
-
readonly rowHash: (row: Row) => typeof Sha256HashSchema.Type
|
|
29
|
+
readonly rowHash: (row: Row) => Effect.Effect<typeof Sha256HashSchema.Type, HashError>;
|
|
24
30
|
}) => Effect.Effect<{
|
|
25
31
|
count: number;
|
|
26
32
|
digest: string & import("effect/Brand").Brand<"@NakafaAI/AksaraSha256Hash">;
|
|
27
|
-
}, E | TryoutDigestError, R>;
|
|
33
|
+
}, E | HashError | import("effect/PlatformError").PlatformError | TryoutDigestError, R>;
|
|
28
34
|
export {};
|