@nakafa/aksara-contracts 0.39.0 → 0.40.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/README.md +6 -5
- package/dist/adoption/protected.d.ts +125 -0
- package/dist/adoption/protected.js +70 -0
- package/dist/adoption/public.d.ts +619 -0
- package/dist/adoption/public.js +121 -0
- package/dist/adoption/runtime.d.ts +1297 -0
- package/dist/adoption/runtime.js +40 -0
- package/dist/adoption/schema.d.ts +3794 -0
- package/dist/adoption/schema.js +125 -0
- package/dist/adoption/transport.d.ts +23257 -0
- package/dist/adoption/transport.js +74 -0
- package/dist/adoption/verify.d.ts +457 -0
- package/dist/adoption/verify.js +167 -0
- package/dist/artifact/integrity.d.ts +1 -4
- package/dist/artifact/limits.d.ts +1 -4
- package/dist/artifact/source.d.ts +1 -4
- package/dist/artifact/spec.d.ts +5 -45
- package/dist/artifact/spec.js +2 -20
- package/dist/artifact/verify.d.ts +2 -5
- package/dist/artifact/verify.js +0 -1
- package/dist/content.d.ts +8 -48
- package/dist/content.js +4 -9
- package/dist/preview/artifact.d.ts +1 -1
- package/dist/preview/artifact.js +1 -1
- package/dist/preview/auth.d.ts +3 -20
- package/dist/projection/digest.d.ts +35 -35
- package/dist/projection/verify.d.ts +87 -87
- package/dist/quran/snapshot/row/hash.d.ts +50 -50
- package/dist/release/current/evidence.d.ts +9 -63
- package/dist/release/current/state.d.ts +15 -105
- package/dist/release/hash.d.ts +0 -1
- package/dist/release/lifecycle.d.ts +6 -42
- package/dist/release/lifecycle.js +1 -3
- package/dist/release/result/digest.d.ts +4 -4
- package/dist/release/rollback/spec.d.ts +6 -24
- package/dist/release/signing.js +0 -1
- package/dist/release/snapshot/verify.d.ts +21 -21
- package/dist/release/spec.d.ts +0 -6
- package/dist/release/spec.js +0 -3
- package/dist/release/verify.d.ts +1 -2
- package/dist/renderer/compatibility.d.ts +10 -46
- package/dist/renderer/compatibility.js +20 -45
- package/dist/renderer/component.d.ts +7 -97
- package/dist/renderer/component.js +15 -93
- package/dist/renderer/contract.d.ts +14 -86
- package/dist/renderer/contract.js +16 -54
- package/dist/renderer/manifest.d.ts +10 -72
- package/dist/renderer/manifest.js +40 -41
- package/dist/runtime/protected/spec.d.ts +13 -76
- package/dist/runtime/protected/verify.d.ts +5 -25
- package/dist/runtime/protected/verify.js +2 -4
- package/dist/runtime/spec.d.ts +12 -75
- package/dist/runtime/verify.d.ts +64 -106
- package/dist/runtime/verify.js +2 -4
- package/dist/transport/batch.d.ts +2 -8
- package/dist/transport/group.d.ts +3 -12
- package/dist/transport/request.d.ts +116 -256
- package/dist/transport/response.d.ts +187 -467
- package/dist/tryout/catalog-hash.d.ts +18 -18
- package/dist/tryout/runtime/verify.d.ts +1 -1
- package/package.json +28 -1
- package/dist/renderer/selection.d.ts +0 -39
- package/dist/renderer/selection.js +0 -87
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { canonicalizeSignedContentArtifact as canonicalizeRetainedSignedContentArtifact, SignedContentArtifactSchema as RetainedSignedContentArtifactSchema, } from "@nakafa/aksara-retained/content";
|
|
2
|
+
import { ReleaseVerificationEvidenceSchema as RetainedReleaseVerificationEvidenceSchema, ReleaseVerificationStatusSchema as RetainedReleaseVerificationStatusSchema, SignedContentReleaseSchema as RetainedSignedContentReleaseSchema, } from "@nakafa/aksara-retained/release";
|
|
3
|
+
import { ActiveContentReleaseSchema as RetainedActiveContentReleaseSchema, ActiveRollbackContentReleaseSchema as RetainedActiveRollbackContentReleaseSchema, RecoveryLookupSchema as RetainedRecoveryLookupSchema, } from "@nakafa/aksara-retained/release/current/evidence";
|
|
4
|
+
import { StagedContentReleaseSchema as RetainedStagedContentReleaseSchema, StagedRollbackContentReleaseSchema as RetainedStagedRollbackContentReleaseSchema, } from "@nakafa/aksara-retained/release/current/state";
|
|
5
|
+
import { ContentReleaseBundleSchema as RetainedContentReleaseBundleSchema, RollbackContentReleaseBundleSchema as RetainedRollbackContentReleaseBundleSchema, } from "@nakafa/aksara-retained/release/lifecycle";
|
|
6
|
+
import { RendererManifestEnvelopeSchema as RetainedRendererManifestEnvelopeSchema } from "@nakafa/aksara-retained/renderer/contract";
|
|
7
|
+
import { Schema } from "effect";
|
|
8
|
+
import { SignedContentArtifactSchema as CurrentSignedContentArtifactSchema, canonicalizeSignedContentArtifact as canonicalizeCurrentSignedContentArtifact, } from "#contracts/content";
|
|
9
|
+
import { ContentKeySchema } from "#contracts/ids";
|
|
10
|
+
import { canonicalizeContentProjection } from "#contracts/projection/spec";
|
|
11
|
+
import { canonicalizeContentChange } from "#contracts/release/canonical";
|
|
12
|
+
import { ActiveContentReleaseSchema as CurrentActiveContentReleaseSchema, ActiveRollbackContentReleaseSchema as CurrentActiveRollbackContentReleaseSchema, RecoveryLookupSchema as CurrentRecoveryLookupSchema, } from "#contracts/release/current/evidence";
|
|
13
|
+
import { ContentReleaseCurrentSchema as CurrentContentReleaseCurrentSchema, StagedContentReleaseSchema as CurrentStagedContentReleaseSchema, StagedRollbackContentReleaseSchema as CurrentStagedRollbackContentReleaseSchema, } from "#contracts/release/current/state";
|
|
14
|
+
import { ContentReleaseBundleSchema as CurrentContentReleaseBundleSchema, RollbackContentReleaseBundleSchema as CurrentRollbackContentReleaseBundleSchema, } from "#contracts/release/lifecycle";
|
|
15
|
+
import { RollbackDeleteStateSchema as CurrentRollbackDeleteStateSchema, RollbackPageSchema as CurrentRollbackPageSchema, RollbackRecordSchema as CurrentRollbackRecordSchema, RollbackUpsertStateSchema as CurrentRollbackUpsertStateSchema, MAX_ROLLBACK_PAGE_RECORDS, } from "#contracts/release/rollback/spec";
|
|
16
|
+
import { ReleaseVerificationEvidenceSchema as CurrentReleaseVerificationEvidenceSchema, ReleaseVerificationStatusSchema as CurrentReleaseVerificationStatusSchema, SignedContentReleaseSchema as CurrentSignedContentReleaseSchema, } from "#contracts/release/spec";
|
|
17
|
+
import { RendererComponentNameSchema } from "#contracts/renderer/component";
|
|
18
|
+
import { RendererManifestEnvelopeSchema as CurrentRendererManifestEnvelopeSchema } from "#contracts/renderer/contract";
|
|
19
|
+
/** Temporary exact signed schemas for the bounded renderer adoption. */
|
|
20
|
+
export const SignedContentArtifactSchema = Schema.Union([
|
|
21
|
+
CurrentSignedContentArtifactSchema,
|
|
22
|
+
RetainedSignedContentArtifactSchema,
|
|
23
|
+
]);
|
|
24
|
+
export const SignedContentReleaseSchema = Schema.Union([
|
|
25
|
+
CurrentSignedContentReleaseSchema,
|
|
26
|
+
RetainedSignedContentReleaseSchema,
|
|
27
|
+
]);
|
|
28
|
+
export const RendererManifestEnvelopeSchema = Schema.Union([
|
|
29
|
+
CurrentRendererManifestEnvelopeSchema,
|
|
30
|
+
RetainedRendererManifestEnvelopeSchema,
|
|
31
|
+
]);
|
|
32
|
+
export const ReleaseVerificationEvidenceSchema = Schema.Union([
|
|
33
|
+
CurrentReleaseVerificationEvidenceSchema,
|
|
34
|
+
RetainedReleaseVerificationEvidenceSchema,
|
|
35
|
+
]);
|
|
36
|
+
export const ReleaseVerificationStatusSchema = Schema.Union([
|
|
37
|
+
CurrentReleaseVerificationStatusSchema,
|
|
38
|
+
RetainedReleaseVerificationStatusSchema,
|
|
39
|
+
]);
|
|
40
|
+
/** Original retained bundles and new bundles keep their published exact shape. */
|
|
41
|
+
export const ContentReleaseBundleSchema = Schema.Union([
|
|
42
|
+
CurrentContentReleaseBundleSchema,
|
|
43
|
+
RetainedContentReleaseBundleSchema,
|
|
44
|
+
]);
|
|
45
|
+
/** Frozen renderer plus either signed rollback release at recovery boundaries. */
|
|
46
|
+
export const RollbackContentReleaseBundleSchema = Schema.Union([
|
|
47
|
+
CurrentRollbackContentReleaseBundleSchema,
|
|
48
|
+
RetainedRollbackContentReleaseBundleSchema,
|
|
49
|
+
]);
|
|
50
|
+
export const ActiveContentReleaseSchema = Schema.Union([
|
|
51
|
+
CurrentActiveContentReleaseSchema,
|
|
52
|
+
RetainedActiveContentReleaseSchema,
|
|
53
|
+
]);
|
|
54
|
+
export const ActiveRollbackContentReleaseSchema = Schema.Union([
|
|
55
|
+
CurrentActiveRollbackContentReleaseSchema,
|
|
56
|
+
RetainedActiveRollbackContentReleaseSchema,
|
|
57
|
+
]);
|
|
58
|
+
export const StagedContentReleaseSchema = Schema.Union([
|
|
59
|
+
CurrentStagedContentReleaseSchema,
|
|
60
|
+
RetainedStagedContentReleaseSchema,
|
|
61
|
+
]);
|
|
62
|
+
export const StagedRollbackContentReleaseSchema = Schema.Union([
|
|
63
|
+
CurrentStagedRollbackContentReleaseSchema,
|
|
64
|
+
RetainedStagedRollbackContentReleaseSchema,
|
|
65
|
+
]);
|
|
66
|
+
export const RecoveryLookupSchema = Schema.Union([
|
|
67
|
+
CurrentRecoveryLookupSchema,
|
|
68
|
+
RetainedRecoveryLookupSchema,
|
|
69
|
+
]);
|
|
70
|
+
/** Reuses the authoritative identity checks across independently signed slots. */
|
|
71
|
+
export const ContentReleaseCurrentSchema = CurrentContentReleaseCurrentSchema.mapFields((fields) => ({
|
|
72
|
+
...fields,
|
|
73
|
+
active: Schema.NullOr(ActiveContentReleaseSchema),
|
|
74
|
+
candidate: Schema.NullOr(StagedContentReleaseSchema),
|
|
75
|
+
recovery: Schema.NullOr(StagedRollbackContentReleaseSchema),
|
|
76
|
+
}), { unsafePreserveChecks: true });
|
|
77
|
+
/** An inverse carries the original artifact, never a re-signed projection. */
|
|
78
|
+
export const RollbackUpsertStateSchema = CurrentRollbackUpsertStateSchema.mapFields((fields) => ({ ...fields, artifact: SignedContentArtifactSchema }), { unsafePreserveChecks: true });
|
|
79
|
+
export const RollbackStateSchema = Schema.Union([
|
|
80
|
+
RollbackUpsertStateSchema,
|
|
81
|
+
CurrentRollbackDeleteStateSchema,
|
|
82
|
+
]);
|
|
83
|
+
export const RollbackRecordSchema = CurrentRollbackRecordSchema.mapFields((fields) => ({
|
|
84
|
+
...fields,
|
|
85
|
+
current: RollbackStateSchema,
|
|
86
|
+
prior: RollbackStateSchema,
|
|
87
|
+
}), { unsafePreserveChecks: true });
|
|
88
|
+
export const RollbackPageSchema = CurrentRollbackPageSchema.mapFields((fields) => ({
|
|
89
|
+
...fields,
|
|
90
|
+
records: Schema.Array(RollbackRecordSchema).check(Schema.isMaxLength(MAX_ROLLBACK_PAGE_RECORDS)),
|
|
91
|
+
}), { unsafePreserveChecks: true });
|
|
92
|
+
/** Selects the exact published canonicalizer without altering signed fields. */
|
|
93
|
+
export function canonicalizeSignedContentArtifact(artifact) {
|
|
94
|
+
if (Schema.is(CurrentSignedContentArtifactSchema)(artifact)) {
|
|
95
|
+
return canonicalizeCurrentSignedContentArtifact(artifact);
|
|
96
|
+
}
|
|
97
|
+
return canonicalizeRetainedSignedContentArtifact(artifact);
|
|
98
|
+
}
|
|
99
|
+
/** Narrows one complete retained inverse state to its immutable signed body. */
|
|
100
|
+
export function isRollbackUpsert(state) {
|
|
101
|
+
return "artifact" in state;
|
|
102
|
+
}
|
|
103
|
+
/** Preserves the original artifact serializer inside the unchanged page wire. */
|
|
104
|
+
function canonicalizeRollbackState(state) {
|
|
105
|
+
const change = JSON.stringify(canonicalizeContentChange(state.change));
|
|
106
|
+
if (!isRollbackUpsert(state)) {
|
|
107
|
+
return `{"change":${change}}`;
|
|
108
|
+
}
|
|
109
|
+
return `{"artifact":${canonicalizeSignedContentArtifact(state.artifact)},"change":${change},"projection":${canonicalizeContentProjection(state.projection)}}`;
|
|
110
|
+
}
|
|
111
|
+
/** Serializes both independently retained sides of an exact inverse record. */
|
|
112
|
+
export function canonicalizeRollbackRecord(record) {
|
|
113
|
+
return `{"current":${canonicalizeRollbackState(record.current)},"index":${record.index},"prior":${canonicalizeRollbackState(record.prior)}}`;
|
|
114
|
+
}
|
|
115
|
+
/** Keeps the existing rollback byte ceiling applicable to mixed signed bodies. */
|
|
116
|
+
export function canonicalizeRollbackPage(page) {
|
|
117
|
+
return `{"done":${page.done},"nextIndex":${page.nextIndex},"records":[${page.records.map(canonicalizeRollbackRecord).join(",")}],"rollbackOfManifestHash":${JSON.stringify(page.rollbackOfManifestHash)},"rollbackOf":${JSON.stringify(page.rollbackOf)},"total":${page.total}}`;
|
|
118
|
+
}
|
|
119
|
+
/** Authenticated retained code requests an unsupported internal capability. */
|
|
120
|
+
export class RetainedRendererComponentUnsupportedError extends Schema.TaggedError()("RetainedRendererComponentUnsupportedError", {
|
|
121
|
+
componentName: RendererComponentNameSchema,
|
|
122
|
+
contentKey: ContentKeySchema,
|
|
123
|
+
version: Schema.Finite,
|
|
124
|
+
}) {
|
|
125
|
+
}
|