@fungi.computer/puffball 0.0.0-stage → 0.0.1
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 +21 -0
- package/README.md +443 -2
- package/dist/app-api.d.ts +7 -0
- package/dist/app-api.js +61 -0
- package/dist/app-backend-binding-vocabulary.d.ts +299 -0
- package/dist/app-backend-binding-vocabulary.js +257 -0
- package/dist/app-backend-bindings.d.ts +21 -0
- package/dist/app-backend-bindings.js +47 -0
- package/dist/app-declaration.d.ts +46 -0
- package/dist/app-declaration.js +115 -0
- package/dist/app-event-facts.d.ts +40 -0
- package/dist/app-event-facts.js +28 -0
- package/dist/app-method-context.d.ts +109 -0
- package/dist/app-method-context.js +9 -0
- package/dist/app-method-runtime.d.ts +86 -0
- package/dist/app-method-runtime.js +122 -0
- package/dist/app-origin-paths.d.ts +6 -0
- package/dist/app-origin-paths.js +6 -0
- package/dist/app-vocabulary.d.ts +189 -0
- package/dist/app-vocabulary.js +103 -0
- package/dist/app.d.ts +379 -0
- package/dist/app.js +71 -0
- package/dist/artifact-dispositions.d.ts +115 -0
- package/dist/artifact-dispositions.js +234 -0
- package/dist/assets.d.ts +54 -0
- package/dist/assets.js +89 -0
- package/dist/backend.d.ts +41 -0
- package/dist/backend.js +29 -0
- package/dist/background-replay.d.ts +115 -0
- package/dist/background-replay.js +175 -0
- package/dist/buyer-references.d.ts +69 -0
- package/dist/buyer-references.js +154 -0
- package/dist/cloudflare-assets.d.ts +48 -0
- package/dist/cloudflare-assets.js +105 -0
- package/dist/cloudflare.d.ts +254 -0
- package/dist/cloudflare.js +1619 -0
- package/dist/effect.d.ts +73 -0
- package/dist/effect.js +325 -0
- package/dist/git-representation.d.ts +13 -0
- package/dist/git-representation.js +16 -0
- package/dist/inbox.d.ts +132 -0
- package/dist/inbox.js +81 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +85 -0
- package/dist/internal/app-description.d.ts +14 -0
- package/dist/internal/app-description.js +98 -0
- package/dist/internal/app-release-artifact-reader.d.ts +26 -0
- package/dist/internal/app-release-artifact-reader.js +1 -0
- package/dist/internal/app-release-contract.d.ts +540 -0
- package/dist/internal/app-release-contract.js +169 -0
- package/dist/internal/app-release-schema.d.ts +1676 -0
- package/dist/internal/app-release-schema.js +386 -0
- package/dist/internal/app-release-store.d.ts +47 -0
- package/dist/internal/app-release-store.js +1 -0
- package/dist/internal/background-sync.d.ts +7 -0
- package/dist/internal/background-sync.js +10 -0
- package/dist/internal/deterministic-memory-app-release-store.d.ts +14 -0
- package/dist/internal/deterministic-memory-app-release-store.js +319 -0
- package/dist/internal/failure.d.ts +2 -0
- package/dist/internal/failure.js +9 -0
- package/dist/internal/immutable-release-material.d.ts +3 -0
- package/dist/internal/immutable-release-material.js +13 -0
- package/dist/internal/promise-app-release-store-adapter.d.ts +9 -0
- package/dist/internal/promise-app-release-store-adapter.js +65 -0
- package/dist/internal/promise-artifact-reader-adapter.d.ts +9 -0
- package/dist/internal/promise-artifact-reader-adapter.js +18 -0
- package/dist/internal/public-route-sql.d.ts +10 -0
- package/dist/internal/public-route-sql.js +239 -0
- package/dist/internal/public-website-authority.d.ts +338 -0
- package/dist/internal/public-website-authority.js +50 -0
- package/dist/internal/public-website-delivery.d.ts +59 -0
- package/dist/internal/public-website-delivery.js +232 -0
- package/dist/internal/public-website-fetch.d.ts +8 -0
- package/dist/internal/public-website-fetch.js +54 -0
- package/dist/internal/release-transition-material.d.ts +3 -0
- package/dist/internal/release-transition-material.js +11 -0
- package/dist/internal/verified-artifact-snapshot.d.ts +41 -0
- package/dist/internal/verified-artifact-snapshot.js +91 -0
- package/dist/public-route-moderation.d.ts +83 -0
- package/dist/public-route-moderation.js +236 -0
- package/dist/public-route-policy.d.ts +51 -0
- package/dist/public-route-policy.js +88 -0
- package/dist/public-routes.d.ts +34 -0
- package/dist/public-routes.js +136 -0
- package/dist/publisher.d.ts +61 -0
- package/dist/publisher.js +16 -0
- package/dist/safety-takedown.d.ts +56 -0
- package/dist/safety-takedown.js +146 -0
- package/dist/seller-closure-notice.d.ts +14 -0
- package/dist/seller-closure-notice.js +14 -0
- package/dist/seller-closure.d.ts +15 -0
- package/dist/seller-closure.js +31 -0
- package/dist/testing.d.ts +8 -0
- package/dist/testing.js +47 -0
- package/docs/api/README.md +26 -0
- package/docs/api/app-backend-binding-vocabulary.md +276 -0
- package/docs/api/app-backend-bindings.md +141 -0
- package/docs/api/app-event-facts.md +110 -0
- package/docs/api/app-method-context.md +166 -0
- package/docs/api/app-method-runtime.md +330 -0
- package/docs/api/backend.md +108 -0
- package/docs/api/background-replay.md +516 -0
- package/docs/api/cloudflare.md +1044 -0
- package/docs/api/effect.md +2429 -0
- package/docs/api/git-representation.md +56 -0
- package/docs/api/inbox.md +289 -0
- package/docs/api/index.md +2868 -0
- package/docs/api/publisher.md +147 -0
- package/docs/api/testing.md +31 -0
- package/package.json +158 -3
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import type { AppDeclaration } from "../app-vocabulary.js";
|
|
2
|
+
import type { CairnId } from "@fungi.computer/cairn/id";
|
|
3
|
+
/** Opaque Global App identifier. */
|
|
4
|
+
export type AppId = string & {
|
|
5
|
+
readonly appReleaseKind: "AppId";
|
|
6
|
+
};
|
|
7
|
+
/** Opaque immutable Release identifier. */
|
|
8
|
+
export type ReleaseId = string & {
|
|
9
|
+
readonly appReleaseKind: "ReleaseId";
|
|
10
|
+
};
|
|
11
|
+
/** Opaque anonymous public-Surface identifier. */
|
|
12
|
+
export type PublicSurfaceId = string & {
|
|
13
|
+
readonly appReleaseKind: "PublicSurfaceId";
|
|
14
|
+
};
|
|
15
|
+
/** Opaque, bounded artifact locator for an injected reader. */
|
|
16
|
+
export type ArtifactRef = string & {
|
|
17
|
+
readonly appReleaseKind: "ArtifactRef";
|
|
18
|
+
};
|
|
19
|
+
/** Caller-provided idempotency key for one control-plane operation. */
|
|
20
|
+
export type IdempotencyKey = string & {
|
|
21
|
+
readonly appReleaseKind: "IdempotencyKey";
|
|
22
|
+
};
|
|
23
|
+
/** Pinned lowercase Git source revision. */
|
|
24
|
+
export type SourceRevision = string & {
|
|
25
|
+
readonly appReleaseKind: "SourceRevision";
|
|
26
|
+
};
|
|
27
|
+
/** Lowercase SHA-256 digest with its `sha256:` prefix. */
|
|
28
|
+
export type Sha256Digest = string & {
|
|
29
|
+
readonly appReleaseKind: "Sha256Digest";
|
|
30
|
+
};
|
|
31
|
+
/** Canonical, local origin-relative stable route for a public Surface. */
|
|
32
|
+
export type StableRoute = string & {
|
|
33
|
+
readonly appReleaseKind: "StableRoute";
|
|
34
|
+
};
|
|
35
|
+
/** Cairn-issued opaque identity for one owner-issued App transition. */
|
|
36
|
+
export type AppTransitionId = CairnId<"app-release", "transition">;
|
|
37
|
+
/** Immutable artifact bytes exposed only through fresh copies. */
|
|
38
|
+
export type ImmutableArtifactBytes = {
|
|
39
|
+
/** The immutable snapshot's bounded byte length. */
|
|
40
|
+
readonly byteLength: number;
|
|
41
|
+
/** Return an independently mutable copy of the immutable snapshot. */
|
|
42
|
+
copy(): Uint8Array;
|
|
43
|
+
};
|
|
44
|
+
/** Source and build facts permanently bound to a Release artifact. */
|
|
45
|
+
export type ArtifactProvenance = {
|
|
46
|
+
/** Pinned source revision from which the artifact was built. */
|
|
47
|
+
readonly sourceRevision: SourceRevision;
|
|
48
|
+
/** Digest of the source tree used for the build. */
|
|
49
|
+
readonly sourceTreeDigest: Sha256Digest;
|
|
50
|
+
/** Digest of the deterministic build recipe. */
|
|
51
|
+
readonly buildRecipeDigest: Sha256Digest;
|
|
52
|
+
};
|
|
53
|
+
/** Immutable artifact identity and provenance bound to a Release. */
|
|
54
|
+
export type ReleaseArtifact = {
|
|
55
|
+
/** Opaque reference resolved only by the injected reader. */
|
|
56
|
+
readonly artifactRef: ArtifactRef;
|
|
57
|
+
/** Digest expected from the resolved artifact bytes. */
|
|
58
|
+
readonly artifactDigest: Sha256Digest;
|
|
59
|
+
/** Write-once source and build provenance. */
|
|
60
|
+
readonly provenance: ArtifactProvenance;
|
|
61
|
+
};
|
|
62
|
+
/** Global App record owned by the catalog. */
|
|
63
|
+
export type App = {
|
|
64
|
+
/** Opaque App identity. */
|
|
65
|
+
readonly appId: AppId;
|
|
66
|
+
};
|
|
67
|
+
/** Immutable App Release record. */
|
|
68
|
+
export type Release = {
|
|
69
|
+
/** Opaque immutable Release identity. */
|
|
70
|
+
readonly releaseId: ReleaseId;
|
|
71
|
+
/** App that owns this Release. */
|
|
72
|
+
readonly appId: AppId;
|
|
73
|
+
/** Immutable artifact identity and provenance. */
|
|
74
|
+
readonly artifact: ReleaseArtifact;
|
|
75
|
+
};
|
|
76
|
+
/** Anonymous website Surface and its explicit App owner. */
|
|
77
|
+
export type PublicSurface = {
|
|
78
|
+
/** Opaque public-Surface identity. */
|
|
79
|
+
readonly publicSurfaceId: PublicSurfaceId;
|
|
80
|
+
/** App that owns this Surface. */
|
|
81
|
+
readonly appId: AppId;
|
|
82
|
+
/** Canonical local route locator for this Surface. */
|
|
83
|
+
readonly stableRoute: StableRoute;
|
|
84
|
+
};
|
|
85
|
+
/** Admitted publisher identity retained separately from public Surface metadata. */
|
|
86
|
+
export type PublicSurfacePublisher = Readonly<{
|
|
87
|
+
kind: "customer" | "platform";
|
|
88
|
+
teamId: string;
|
|
89
|
+
userId: string;
|
|
90
|
+
requestKey: string;
|
|
91
|
+
}>;
|
|
92
|
+
/** Creation requires explicit publisher custody; an ID is never authority. */
|
|
93
|
+
export type PublicSurfaceDefinition = PublicSurface & Readonly<{
|
|
94
|
+
publisher: PublicSurfacePublisher;
|
|
95
|
+
}>;
|
|
96
|
+
/** Supported immutable artifact representation formats. */
|
|
97
|
+
export type ArtifactMediaType = "text/html; charset=utf-8" | "application/vnd.fungi.app-backend+json" | "application/vnd.fungi.app-assets+json" | "application/vnd.fungi.app+json";
|
|
98
|
+
/** One immutable child reference retained after App publication verification. */
|
|
99
|
+
export type VerifiedAppArtifactReference = Readonly<{
|
|
100
|
+
readonly artifactRef: ArtifactRef;
|
|
101
|
+
readonly digest: Sha256Digest;
|
|
102
|
+
readonly mediaType: Exclude<ArtifactMediaType, "application/vnd.fungi.app+json">;
|
|
103
|
+
readonly version: string;
|
|
104
|
+
readonly byteLength: number;
|
|
105
|
+
}>;
|
|
106
|
+
/** Executable descriptor decoded from one verified backend child artifact. */
|
|
107
|
+
export type DurableBackend = Readonly<{
|
|
108
|
+
readonly runtime: Readonly<{
|
|
109
|
+
readonly kind: "durable-facet";
|
|
110
|
+
readonly stateSchema: number;
|
|
111
|
+
}>;
|
|
112
|
+
readonly compatibilityDate: string;
|
|
113
|
+
readonly exportName: string;
|
|
114
|
+
readonly code: string;
|
|
115
|
+
}>;
|
|
116
|
+
/** Backend facts needed for admission, with executable code deliberately absent. */
|
|
117
|
+
export type VerifiedBackendProfile = Omit<DurableBackend, "code">;
|
|
118
|
+
/** Normalized immutable App description persisted by the verification owner. */
|
|
119
|
+
export type VerifiedAppDescription = Readonly<{
|
|
120
|
+
readonly format: "fungi-app-v1";
|
|
121
|
+
readonly ui: VerifiedAppArtifactReference | null;
|
|
122
|
+
readonly backend: Readonly<{
|
|
123
|
+
readonly artifact: VerifiedAppArtifactReference;
|
|
124
|
+
readonly profile: VerifiedBackendProfile;
|
|
125
|
+
}> | null;
|
|
126
|
+
/** The App's digest-covered request; never a grant. */
|
|
127
|
+
readonly declaration: AppDeclaration;
|
|
128
|
+
}>;
|
|
129
|
+
/** Verified metadata returned without reading any artifact body. */
|
|
130
|
+
export type ResolvedAppMetadata = Readonly<{
|
|
131
|
+
readonly release: Release;
|
|
132
|
+
readonly digest: Sha256Digest;
|
|
133
|
+
readonly description: VerifiedAppDescription;
|
|
134
|
+
}>;
|
|
135
|
+
/** Current metadata-only authority for one selected public Surface. */
|
|
136
|
+
export type PublicSurfaceAuthority = Readonly<{
|
|
137
|
+
/** Surface default observed atomically with this eligible, possibly pinned Release. */
|
|
138
|
+
readonly currentReleaseId: ReleaseId;
|
|
139
|
+
/** Catalog transition that selected this Release on this Surface. */
|
|
140
|
+
readonly sequence: number;
|
|
141
|
+
readonly app: App;
|
|
142
|
+
readonly release: Release;
|
|
143
|
+
readonly surface: PublicSurface;
|
|
144
|
+
readonly digest: Sha256Digest;
|
|
145
|
+
readonly revocation: ReleaseRevocation;
|
|
146
|
+
readonly description: VerifiedAppDescription;
|
|
147
|
+
}>;
|
|
148
|
+
/** Successful, verified artifact read. */
|
|
149
|
+
export type VerifiedArtifactRead = {
|
|
150
|
+
/** Discriminant for a verified immutable representation snapshot. */
|
|
151
|
+
readonly kind: "verified";
|
|
152
|
+
/** Computed digest matching the requested digest. */
|
|
153
|
+
readonly digest: Sha256Digest;
|
|
154
|
+
/** Explicit artifact formats; an asset root is never interpreted as HTML or backend code. */
|
|
155
|
+
readonly mediaType: ArtifactMediaType;
|
|
156
|
+
/** Immutable representation byte snapshot. */
|
|
157
|
+
readonly bytes: ImmutableArtifactBytes;
|
|
158
|
+
/** Byte length matching the immutable snapshot. */
|
|
159
|
+
readonly byteLength: number;
|
|
160
|
+
};
|
|
161
|
+
/** Verified UI representation; selection authority remains with its host. */
|
|
162
|
+
export type AppUi = Omit<VerifiedArtifactRead, "kind" | "mediaType"> & {
|
|
163
|
+
readonly mediaType: "text/html; charset=utf-8" | "application/vnd.fungi.app-assets+json";
|
|
164
|
+
};
|
|
165
|
+
/** Normalized immutable code description shared by Surface and facet consumers. */
|
|
166
|
+
export type AppDescription = Readonly<{
|
|
167
|
+
readonly ui: AppUi | null;
|
|
168
|
+
readonly backend: Readonly<{
|
|
169
|
+
readonly digest: Sha256Digest;
|
|
170
|
+
readonly descriptor: DurableBackend;
|
|
171
|
+
}> | null;
|
|
172
|
+
}>;
|
|
173
|
+
/** One eligible Release with all declared executable parts resolved. */
|
|
174
|
+
export type ResolvedApp = AppDescription & Readonly<{
|
|
175
|
+
readonly release: Release;
|
|
176
|
+
readonly digest: Sha256Digest;
|
|
177
|
+
}>;
|
|
178
|
+
/** Closed result union returned by an injected artifact reader. */
|
|
179
|
+
export type ArtifactReadResult = VerifiedArtifactRead | {
|
|
180
|
+
readonly kind: "unavailable";
|
|
181
|
+
} | {
|
|
182
|
+
readonly kind: "missing";
|
|
183
|
+
} | {
|
|
184
|
+
readonly kind: "digest-mismatch";
|
|
185
|
+
readonly actualDigest: Sha256Digest;
|
|
186
|
+
};
|
|
187
|
+
/** Names the owner-controlled verification work requested for one read. */
|
|
188
|
+
export type ArtifactVerificationIntent = "publication";
|
|
189
|
+
/** Storage-neutral port that resolves an opaque reference and verifies bytes. */
|
|
190
|
+
export type ArtifactReader = {
|
|
191
|
+
/** Resolve and verify exactly one expected immutable artifact. */
|
|
192
|
+
read(input: {
|
|
193
|
+
/** Opaque artifact reference; never a storage capability. */
|
|
194
|
+
readonly artifactRef: ArtifactRef;
|
|
195
|
+
/** Digest that the resolved bytes must match. */
|
|
196
|
+
readonly expectedDigest: Sha256Digest;
|
|
197
|
+
/** Child reference pins the native object version as well as its content. */
|
|
198
|
+
readonly expectedObject?: {
|
|
199
|
+
readonly version: string;
|
|
200
|
+
readonly byteLength: number;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Publication asks the reader to verify every object named by an asset
|
|
204
|
+
* manifest. Omitted for ordinary delivery, which verifies one requested
|
|
205
|
+
* object at the asset handler boundary.
|
|
206
|
+
*/
|
|
207
|
+
readonly verification?: ArtifactVerificationIntent;
|
|
208
|
+
}): Promise<ArtifactReadResult>;
|
|
209
|
+
};
|
|
210
|
+
/** Closed infrastructure failure projected by an App Release store. */
|
|
211
|
+
export type AppReleaseStoreFailure = {
|
|
212
|
+
readonly kind: "unavailable";
|
|
213
|
+
};
|
|
214
|
+
/** Closed successful outcome for one App Release store operation. */
|
|
215
|
+
export type AppReleaseStoreSuccess<Value> = {
|
|
216
|
+
readonly kind: "success";
|
|
217
|
+
readonly value: Value;
|
|
218
|
+
};
|
|
219
|
+
/** Closed failed outcome for one App Release store operation. */
|
|
220
|
+
export type AppReleaseStoreOperationFailure = {
|
|
221
|
+
readonly kind: "failure";
|
|
222
|
+
readonly failure: AppReleaseStoreFailure;
|
|
223
|
+
};
|
|
224
|
+
/** Closed envelope returned by every App Release store operation. */
|
|
225
|
+
export type AppReleaseStoreResult<Value> = AppReleaseStoreSuccess<Value> | AppReleaseStoreOperationFailure;
|
|
226
|
+
/** Explicit result of looking up one Global App. */
|
|
227
|
+
export type AppRead = {
|
|
228
|
+
readonly kind: "found";
|
|
229
|
+
readonly app: App;
|
|
230
|
+
} | {
|
|
231
|
+
readonly kind: "absent";
|
|
232
|
+
};
|
|
233
|
+
/** Explicit result of atomically creating or observing one Global App. */
|
|
234
|
+
export type AppCreate = {
|
|
235
|
+
readonly kind: "created";
|
|
236
|
+
readonly app: App;
|
|
237
|
+
} | {
|
|
238
|
+
readonly kind: "existing";
|
|
239
|
+
readonly app: App;
|
|
240
|
+
};
|
|
241
|
+
/** Explicit result of looking up one immutable Release. */
|
|
242
|
+
export type ReleaseRead = {
|
|
243
|
+
readonly kind: "found";
|
|
244
|
+
readonly release: Release;
|
|
245
|
+
} | {
|
|
246
|
+
readonly kind: "absent";
|
|
247
|
+
};
|
|
248
|
+
/** Explicit result of atomically creating or observing one immutable Release. */
|
|
249
|
+
export type ReleaseCreate = {
|
|
250
|
+
readonly kind: "created";
|
|
251
|
+
readonly release: Release;
|
|
252
|
+
} | {
|
|
253
|
+
readonly kind: "existing";
|
|
254
|
+
readonly release: Release;
|
|
255
|
+
};
|
|
256
|
+
/** Explicit result of looking up one App-owned anonymous public Surface. */
|
|
257
|
+
export type PublicSurfaceRead = {
|
|
258
|
+
readonly kind: "found";
|
|
259
|
+
readonly surface: PublicSurface;
|
|
260
|
+
} | {
|
|
261
|
+
readonly kind: "absent";
|
|
262
|
+
};
|
|
263
|
+
/** Explicit result of atomically creating or observing one public Surface. */
|
|
264
|
+
export type PublicSurfaceCreate = {
|
|
265
|
+
readonly kind: "created";
|
|
266
|
+
readonly surface: PublicSurface;
|
|
267
|
+
} | {
|
|
268
|
+
readonly kind: "existing";
|
|
269
|
+
readonly surface: PublicSurface;
|
|
270
|
+
} | {
|
|
271
|
+
readonly kind: "conflict";
|
|
272
|
+
};
|
|
273
|
+
/** Verification fact retained after a valid immutable artifact snapshot. */
|
|
274
|
+
export type ReleaseVerification = {
|
|
275
|
+
readonly kind: "verified";
|
|
276
|
+
readonly digest: Sha256Digest;
|
|
277
|
+
readonly mediaType: "application/vnd.fungi.app+json";
|
|
278
|
+
readonly description: VerifiedAppDescription;
|
|
279
|
+
} | {
|
|
280
|
+
readonly kind: "unverified";
|
|
281
|
+
};
|
|
282
|
+
/** Revocation fact retained independently from immutable Release bytes. */
|
|
283
|
+
export type ReleaseRevocation = {
|
|
284
|
+
readonly kind: "active";
|
|
285
|
+
} | {
|
|
286
|
+
readonly kind: "revoked";
|
|
287
|
+
};
|
|
288
|
+
/** Durable Release facts observed by transition policy. */
|
|
289
|
+
export type ReleaseLifecycle = {
|
|
290
|
+
readonly kind: "found";
|
|
291
|
+
readonly release: Release;
|
|
292
|
+
readonly verification: ReleaseVerification;
|
|
293
|
+
readonly revocation: ReleaseRevocation;
|
|
294
|
+
} | {
|
|
295
|
+
readonly kind: "absent";
|
|
296
|
+
};
|
|
297
|
+
/** Durable public-Surface selection fact observed by transition policy. */
|
|
298
|
+
export type PublicSurfaceLifecycle = {
|
|
299
|
+
readonly kind: "found";
|
|
300
|
+
readonly surface: PublicSurface;
|
|
301
|
+
readonly selection: {
|
|
302
|
+
readonly kind: "none";
|
|
303
|
+
} | {
|
|
304
|
+
readonly kind: "selected";
|
|
305
|
+
readonly releaseId: ReleaseId;
|
|
306
|
+
};
|
|
307
|
+
} | {
|
|
308
|
+
readonly kind: "absent";
|
|
309
|
+
};
|
|
310
|
+
/** Safe immutable website bytes selected by the current Surface authority. */
|
|
311
|
+
export type PublicWebsiteRepresentation = Readonly<{
|
|
312
|
+
readonly releaseId: ReleaseId;
|
|
313
|
+
readonly digest: Sha256Digest;
|
|
314
|
+
readonly mediaType: "text/html; charset=utf-8";
|
|
315
|
+
readonly byteLength: number;
|
|
316
|
+
readonly bytes: ImmutableArtifactBytes;
|
|
317
|
+
}>;
|
|
318
|
+
/** Verified root manifest selected by the existing public Surface owner. */
|
|
319
|
+
export type PublicAssetBuildRepresentation = Omit<PublicWebsiteRepresentation, "mediaType"> & {
|
|
320
|
+
readonly mediaType: "application/vnd.fungi.app-assets+json";
|
|
321
|
+
};
|
|
322
|
+
/** Result of looking up an operation-scoped idempotency key. */
|
|
323
|
+
export type TransitionLookup = {
|
|
324
|
+
readonly kind: "absent";
|
|
325
|
+
} | {
|
|
326
|
+
readonly kind: "found";
|
|
327
|
+
readonly receipt: TransitionReceipt;
|
|
328
|
+
} | {
|
|
329
|
+
readonly kind: "conflict";
|
|
330
|
+
};
|
|
331
|
+
/** Result of atomically recording one transition and its receipt. */
|
|
332
|
+
export type TransitionPersistence = {
|
|
333
|
+
readonly kind: "created";
|
|
334
|
+
readonly receipt: TransitionReceipt;
|
|
335
|
+
} | {
|
|
336
|
+
readonly kind: "existing";
|
|
337
|
+
readonly receipt: TransitionReceipt;
|
|
338
|
+
} | {
|
|
339
|
+
readonly kind: "conflict";
|
|
340
|
+
} | {
|
|
341
|
+
readonly kind: "identity-collision";
|
|
342
|
+
} | {
|
|
343
|
+
readonly kind: "lifecycle-conflict";
|
|
344
|
+
};
|
|
345
|
+
/** Effect-free projection of the App Release store boundary. */
|
|
346
|
+
export type PromiseAppReleaseStore = {
|
|
347
|
+
/** Look up one App by its opaque identifier. */
|
|
348
|
+
readApp(appId: AppId): Promise<AppReleaseStoreResult<AppRead>>;
|
|
349
|
+
/** Create an App if absent, or return the immutable existing record. */
|
|
350
|
+
createAppIfAbsent(app: App): Promise<AppReleaseStoreResult<AppCreate>>;
|
|
351
|
+
/** Look up one immutable Release by its opaque identifier. */
|
|
352
|
+
readRelease(releaseId: ReleaseId): Promise<AppReleaseStoreResult<ReleaseRead>>;
|
|
353
|
+
/** Create a Release if absent, or return the immutable existing record. */
|
|
354
|
+
createReleaseIfAbsent(release: Release): Promise<AppReleaseStoreResult<ReleaseCreate>>;
|
|
355
|
+
/** Look up one public Surface by its opaque identifier. */
|
|
356
|
+
readPublicSurface(publicSurfaceId: PublicSurfaceId): Promise<AppReleaseStoreResult<PublicSurfaceRead>>;
|
|
357
|
+
/** Create a public Surface if absent, or return the immutable existing record. */
|
|
358
|
+
createPublicSurfaceIfAbsent(surface: PublicSurfaceDefinition): Promise<AppReleaseStoreResult<PublicSurfaceCreate>>;
|
|
359
|
+
/** Read immutable Release facts needed by owner-issued transitions. */
|
|
360
|
+
readonly readReleaseLifecycle?: (releaseId: ReleaseId) => Promise<AppReleaseStoreResult<ReleaseLifecycle>>;
|
|
361
|
+
/** Atomically retain that one Release artifact was successfully verified. */
|
|
362
|
+
readonly recordReleaseVerification?: (input: {
|
|
363
|
+
readonly releaseId: ReleaseId;
|
|
364
|
+
readonly digest: Sha256Digest;
|
|
365
|
+
readonly mediaType: "application/vnd.fungi.app+json";
|
|
366
|
+
readonly description: VerifiedAppDescription;
|
|
367
|
+
}) => Promise<AppReleaseStoreResult<{
|
|
368
|
+
readonly kind: "recorded";
|
|
369
|
+
}>>;
|
|
370
|
+
/** Read one operation-scoped transition receipt before policy checks. */
|
|
371
|
+
readonly readTransition?: (request: ReleaseTransition) => Promise<AppReleaseStoreResult<TransitionLookup>>;
|
|
372
|
+
/** Atomically persist a validated transition and its terminal receipt. */
|
|
373
|
+
readonly persistTransition?: (request: ReleaseTransition, receipt: TransitionReceipt) => Promise<AppReleaseStoreResult<TransitionPersistence>>;
|
|
374
|
+
};
|
|
375
|
+
/** Owner-issued transition request. */
|
|
376
|
+
export type ReleaseTransition = {
|
|
377
|
+
readonly kind: "promotion";
|
|
378
|
+
readonly publicSurfaceId: PublicSurfaceId;
|
|
379
|
+
readonly releaseId: ReleaseId;
|
|
380
|
+
readonly idempotencyKey: IdempotencyKey;
|
|
381
|
+
} | {
|
|
382
|
+
readonly kind: "rollback";
|
|
383
|
+
readonly publicSurfaceId: PublicSurfaceId;
|
|
384
|
+
readonly releaseId: ReleaseId;
|
|
385
|
+
readonly idempotencyKey: IdempotencyKey;
|
|
386
|
+
} | {
|
|
387
|
+
readonly kind: "revocation";
|
|
388
|
+
readonly releaseId: ReleaseId;
|
|
389
|
+
readonly idempotencyKey: IdempotencyKey;
|
|
390
|
+
};
|
|
391
|
+
/** Terminal receipt for an owner-issued transition. */
|
|
392
|
+
export type TransitionReceipt = {
|
|
393
|
+
readonly transition: ReleaseTransition;
|
|
394
|
+
readonly transitionId: AppTransitionId;
|
|
395
|
+
};
|
|
396
|
+
/** Inputs for the catalog factory. */
|
|
397
|
+
export type AppReleaseCatalogOptions = {
|
|
398
|
+
readonly artifactReader: ArtifactReader;
|
|
399
|
+
readonly store: PromiseAppReleaseStore;
|
|
400
|
+
readonly artifactPolicy?: {
|
|
401
|
+
readonly maxBytes: number;
|
|
402
|
+
readonly maxManifestBytes?: number;
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
/** Public App Release catalog and public-website resolution seam. */
|
|
406
|
+
export type AppReleaseCatalog = {
|
|
407
|
+
/** Create an App once and return the canonical stored record. */
|
|
408
|
+
createApp(app: App): Promise<App>;
|
|
409
|
+
/** Create a Release once and return the canonical stored record. */
|
|
410
|
+
createRelease(release: Release): Promise<Release>;
|
|
411
|
+
/** Resolve and verify the immutable artifact bound to a Release. */
|
|
412
|
+
verifyReleaseArtifact(releaseId: ReleaseId): Promise<VerifiedArtifactRead>;
|
|
413
|
+
/**
|
|
414
|
+
* Read one verified, active Release snapshot and recheck its lifecycle.
|
|
415
|
+
* The caller owns selection authorization and must resolve before each use.
|
|
416
|
+
*/
|
|
417
|
+
resolveEligibleReleaseArtifact(releaseId: ReleaseId): Promise<VerifiedArtifactRead & {
|
|
418
|
+
readonly release: Release;
|
|
419
|
+
}>;
|
|
420
|
+
/** Resolve the UI and backend bound by one eligible immutable Release. */
|
|
421
|
+
resolveEligibleApp(releaseId: ReleaseId): Promise<ResolvedApp>;
|
|
422
|
+
/** Resolve verified App metadata without reading any artifact body. */
|
|
423
|
+
resolveEligibleAppMetadata(releaseId: ReleaseId): Promise<ResolvedAppMetadata>;
|
|
424
|
+
/** Resolve one selected Surface's current metadata authority without bodies. */
|
|
425
|
+
resolvePublicSurfaceAuthority(stableRoute: StableRoute): Promise<PublicSurfaceAuthority>;
|
|
426
|
+
/** Resolve one previously selected Release's current metadata authority. */
|
|
427
|
+
resolvePublicSurfaceAuthorityVersion(stableRoute: StableRoute, releaseId: ReleaseId): Promise<PublicSurfaceAuthority>;
|
|
428
|
+
/** Create a public Surface once and return the canonical stored record. */
|
|
429
|
+
createPublicSurface(surface: PublicSurfaceDefinition): Promise<PublicSurface>;
|
|
430
|
+
/** Apply one owner-issued promotion, rollback, or revocation request. */
|
|
431
|
+
transition(request: ReleaseTransition): Promise<TransitionReceipt>;
|
|
432
|
+
/** Resolve an asset-build root through the same current Surface authority. */
|
|
433
|
+
resolvePublicAssetBuild(stableRoute: StableRoute): Promise<PublicAssetBuildRepresentation>;
|
|
434
|
+
/** Resolve a pinned asset-build root through Surface authority. */
|
|
435
|
+
resolvePublicAssetBuildVersion(stableRoute: StableRoute, releaseId: ReleaseId): Promise<PublicAssetBuildRepresentation>;
|
|
436
|
+
/** Resolve the current eligible immutable website representation. */
|
|
437
|
+
resolvePublicWebsite(stableRoute: StableRoute): Promise<PublicWebsiteRepresentation>;
|
|
438
|
+
/** Resolve a pinned eligible immutable website representation. */
|
|
439
|
+
resolvePublicWebsiteVersion(stableRoute: StableRoute, releaseId: ReleaseId): Promise<PublicWebsiteRepresentation>;
|
|
440
|
+
};
|
|
441
|
+
/** Names the parser boundary that rejected an untrusted value. */
|
|
442
|
+
export type AppReleaseParserName = "AppId" | "ReleaseId" | "PublicSurfaceId" | "ArtifactRef" | "IdempotencyKey" | "SourceRevision" | "Sha256Digest" | "StableRoute" | "AppTransitionId";
|
|
443
|
+
/** Names a public catalog command whose hostile input was rejected. */
|
|
444
|
+
export type AppReleaseCommandName = "createApp" | "createRelease" | "verifyReleaseArtifact" | "resolveEligibleReleaseArtifact" | "resolveEligibleAppMetadata" | "resolvePublicSurfaceAuthority" | "resolvePublicSurfaceAuthorityVersion" | "createPublicSurface" | "transition";
|
|
445
|
+
/** Fixed, non-leaking input failure for one public parser boundary. */
|
|
446
|
+
export declare class AppReleaseInputError extends Error {
|
|
447
|
+
readonly parserName: AppReleaseParserName;
|
|
448
|
+
constructor(parserName: AppReleaseParserName);
|
|
449
|
+
}
|
|
450
|
+
/** Fixed non-leaking input failure for one public catalog command. */
|
|
451
|
+
export declare class AppReleaseCommandInputError extends Error {
|
|
452
|
+
readonly commandName: AppReleaseCommandName;
|
|
453
|
+
constructor(commandName: AppReleaseCommandName);
|
|
454
|
+
}
|
|
455
|
+
/** Fixed non-leaking failure when a foreign Store success is structurally invalid. */
|
|
456
|
+
export declare class AppReleaseInvalidStoreResultError extends Error {
|
|
457
|
+
constructor();
|
|
458
|
+
}
|
|
459
|
+
/** Fixed conflict when one Release ID receives changed immutable input. */
|
|
460
|
+
export declare class AppReleaseImmutableConflictError extends Error {
|
|
461
|
+
constructor();
|
|
462
|
+
}
|
|
463
|
+
/** Fixed failure when a new Release references an App that does not exist. */
|
|
464
|
+
export declare class AppReleaseOwnerAppAbsentError extends Error {
|
|
465
|
+
readonly appId: AppId;
|
|
466
|
+
constructor(appId: AppId);
|
|
467
|
+
}
|
|
468
|
+
/** Fixed failure when a new public Surface references an App that does not exist. */
|
|
469
|
+
export declare class AppReleaseSurfaceOwnerAppAbsentError extends Error {
|
|
470
|
+
readonly appId: AppId;
|
|
471
|
+
constructor(appId: AppId);
|
|
472
|
+
}
|
|
473
|
+
/** Fixed non-leaking failure when the injected App Release store is unavailable. */
|
|
474
|
+
export declare class AppReleaseStoreUnavailableError extends Error {
|
|
475
|
+
constructor();
|
|
476
|
+
}
|
|
477
|
+
/** Fixed failure when artifact verification names no stored Release. */
|
|
478
|
+
export declare class AppReleaseReleaseAbsentError extends Error {
|
|
479
|
+
constructor();
|
|
480
|
+
}
|
|
481
|
+
/** Fixed non-leaking failure when the injected artifact reader is unavailable. */
|
|
482
|
+
export declare class AppReleaseArtifactUnavailableError extends Error {
|
|
483
|
+
constructor();
|
|
484
|
+
}
|
|
485
|
+
/** Fixed failure when the requested artifact cannot be found. */
|
|
486
|
+
export declare class AppReleaseArtifactMissingError extends Error {
|
|
487
|
+
constructor();
|
|
488
|
+
}
|
|
489
|
+
/** Fixed failure when resolved artifact bytes do not match the expected digest. */
|
|
490
|
+
export declare class AppReleaseArtifactDigestMismatchError extends Error {
|
|
491
|
+
constructor();
|
|
492
|
+
}
|
|
493
|
+
/** Fixed failure when a hostile artifact read cannot form a valid snapshot. */
|
|
494
|
+
export declare class AppReleaseArtifactInvalidSnapshotError extends Error {
|
|
495
|
+
constructor();
|
|
496
|
+
}
|
|
497
|
+
/** Error thrown when a catalog operation is not implemented in this slice. */
|
|
498
|
+
export declare class AppReleaseUnimplementedError extends Error {
|
|
499
|
+
constructor();
|
|
500
|
+
}
|
|
501
|
+
/** Fixed failure when a transition names no stored Release. */
|
|
502
|
+
export declare class AppReleaseTransitionReleaseAbsentError extends Error {
|
|
503
|
+
constructor();
|
|
504
|
+
}
|
|
505
|
+
/** Fixed failure when promotion or rollback names an unverified Release. */
|
|
506
|
+
export declare class AppReleaseTransitionReleaseUnverifiedError extends Error {
|
|
507
|
+
constructor();
|
|
508
|
+
}
|
|
509
|
+
/** Fixed failure when a website selection names a non-HTML artifact. */
|
|
510
|
+
export declare class AppReleaseTransitionArtifactIncompatibleError extends Error {
|
|
511
|
+
constructor();
|
|
512
|
+
}
|
|
513
|
+
/** Fixed failure when promotion or rollback names a revoked Release. */
|
|
514
|
+
export declare class AppReleaseTransitionReleaseRevokedError extends Error {
|
|
515
|
+
constructor();
|
|
516
|
+
}
|
|
517
|
+
/** Fixed failure when a transition names no stored public Surface. */
|
|
518
|
+
export declare class AppReleaseTransitionSurfaceAbsentError extends Error {
|
|
519
|
+
constructor();
|
|
520
|
+
}
|
|
521
|
+
/** Fixed failure when a Release is owned by another App than its Surface. */
|
|
522
|
+
export declare class AppReleaseTransitionOwnershipConflictError extends Error {
|
|
523
|
+
constructor();
|
|
524
|
+
}
|
|
525
|
+
/** Fixed failure when an idempotency key is reused for changed material input. */
|
|
526
|
+
export declare class AppReleaseTransitionIdempotencyConflictError extends Error {
|
|
527
|
+
constructor();
|
|
528
|
+
}
|
|
529
|
+
/** Fixed, non-leaking failure when Cairn cannot issue a transition identity. */
|
|
530
|
+
export declare class AppReleaseTransitionIdUnavailableError extends Error {
|
|
531
|
+
constructor();
|
|
532
|
+
}
|
|
533
|
+
/** Fixed non-leaking failure for malformed, absent, or unselected routes. */
|
|
534
|
+
export declare class AppReleasePublicWebsiteNotFoundError extends Error {
|
|
535
|
+
constructor();
|
|
536
|
+
}
|
|
537
|
+
/** Fixed non-leaking failure when public delivery cannot be proven safe. */
|
|
538
|
+
export declare class AppReleasePublicWebsiteUnavailableError extends Error {
|
|
539
|
+
constructor();
|
|
540
|
+
}
|