@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,254 @@
|
|
|
1
|
+
import { type AssetBuildPolicy } from "./assets.js";
|
|
2
|
+
import type { AssetR2Bucket } from "./cloudflare-assets.js";
|
|
3
|
+
export type { AssetR2Bucket, AssetR2Object } from "./cloudflare-assets.js";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
export type { ArtifactSnapshotPolicy } from "./internal/verified-artifact-snapshot.js";
|
|
6
|
+
import { type ArtifactSnapshotPolicy } from "./internal/verified-artifact-snapshot.js";
|
|
7
|
+
import type { AppReleaseStoreResult, AppTransitionId, ArtifactReader, ReleaseTransition } from "./internal/app-release-contract.js";
|
|
8
|
+
import type { PromiseAppReleaseStore } from "./internal/app-release-contract.js";
|
|
9
|
+
import type { AppId, PublicSurfaceId, ReleaseId } from "./internal/app-release-contract.js";
|
|
10
|
+
import { type TeamAppPublisherRegistry } from "./publisher.js";
|
|
11
|
+
/** Durable catalog-scoped fact awaiting delivery to a separately owned Team. */
|
|
12
|
+
export type AppReleaseTransitionObligation = {
|
|
13
|
+
readonly sequence: number;
|
|
14
|
+
readonly transition: ReleaseTransition;
|
|
15
|
+
readonly transitionId: AppTransitionId;
|
|
16
|
+
readonly affectedPublicSurfaceIds: readonly PublicSurfaceId[];
|
|
17
|
+
/** Catalog-owned material needed by a Team without a second catalog read. */
|
|
18
|
+
readonly affectedSurfaces: readonly AppReleaseAffectedSurface[];
|
|
19
|
+
readonly affectedBuyerApps: readonly AppId[];
|
|
20
|
+
/** The last opaque Global Team cursor and whether enumeration is complete. */
|
|
21
|
+
readonly enumeration: {
|
|
22
|
+
readonly cursor: string | null;
|
|
23
|
+
readonly complete: boolean;
|
|
24
|
+
};
|
|
25
|
+
readonly state: "pending" | "acknowledged";
|
|
26
|
+
};
|
|
27
|
+
/** Catalog-owned public-Surface material carried with a transition obligation. */
|
|
28
|
+
export type AppReleaseAffectedSurface = {
|
|
29
|
+
readonly publicSurfaceId: PublicSurfaceId;
|
|
30
|
+
readonly appId: AppId;
|
|
31
|
+
readonly stableRoute: import("./internal/app-release-contract.js").StableRoute;
|
|
32
|
+
};
|
|
33
|
+
/** Durable delivery state for one Team recipient of a transition obligation. */
|
|
34
|
+
export type AppReleaseTeamRecipient = {
|
|
35
|
+
readonly teamId: string;
|
|
36
|
+
readonly state: "pending" | "applied" | "no-op" | "expired";
|
|
37
|
+
};
|
|
38
|
+
/** One ordered page of Team IDs returned by the separately owned Team directory. */
|
|
39
|
+
export type AppReleaseTeamRecipientPage = {
|
|
40
|
+
/** Null identifies the first page; all later cursors remain opaque strings. */
|
|
41
|
+
readonly cursor?: string | null | undefined;
|
|
42
|
+
readonly nextCursor?: string | null | undefined;
|
|
43
|
+
readonly teamIds: readonly string[];
|
|
44
|
+
readonly complete: boolean;
|
|
45
|
+
};
|
|
46
|
+
/** Terminal delivery outcome recorded for one Team recipient. */
|
|
47
|
+
export type AppReleaseTeamRecipientOutcome = "applied" | "no-op" | "expired";
|
|
48
|
+
/** D1-only at-least-once read/ack seam; Team routing remains outside App Release. */
|
|
49
|
+
export type AppReleaseTransitionObligationStore = {
|
|
50
|
+
/** Read one obligation by its immutable transition identity, or report it absent. */
|
|
51
|
+
readByTransitionId(transitionId: AppTransitionId): Promise<AppReleaseStoreResult<AppReleaseTransitionObligation | {
|
|
52
|
+
readonly kind: "absent";
|
|
53
|
+
}>>;
|
|
54
|
+
/** Read pending obligations after a sequence cursor in ascending sequence order. */
|
|
55
|
+
read(options: {
|
|
56
|
+
readonly afterSequence?: number | undefined;
|
|
57
|
+
readonly limit?: number | undefined;
|
|
58
|
+
}): Promise<AppReleaseStoreResult<readonly AppReleaseTransitionObligation[]>>;
|
|
59
|
+
/** Persist the next ordered Team-recipient page; identical replays are idempotent. */
|
|
60
|
+
recordTeamRecipientPage(sequence: number, page: AppReleaseTeamRecipientPage): Promise<AppReleaseStoreResult<AppReleaseTransitionObligation | {
|
|
61
|
+
readonly kind: "absent";
|
|
62
|
+
}>>;
|
|
63
|
+
/** Read pending recipients for one obligation in stable Team-ID order. */
|
|
64
|
+
readPendingTeamRecipients(options: {
|
|
65
|
+
readonly sequence: number;
|
|
66
|
+
readonly limit?: number | undefined;
|
|
67
|
+
}): Promise<AppReleaseStoreResult<readonly AppReleaseTeamRecipient[]>>;
|
|
68
|
+
/** Record a pending recipient's terminal outcome; conflicting replays fail. */
|
|
69
|
+
recordTeamRecipientOutcome(sequence: number, teamId: string, outcome: AppReleaseTeamRecipientOutcome): Promise<AppReleaseStoreResult<AppReleaseTeamRecipient | {
|
|
70
|
+
readonly kind: "absent";
|
|
71
|
+
}>>;
|
|
72
|
+
/** Acknowledge only after enumeration is complete and no recipients remain pending. */
|
|
73
|
+
acknowledge(sequence: number): Promise<AppReleaseStoreResult<AppReleaseTransitionObligation | {
|
|
74
|
+
readonly kind: "absent";
|
|
75
|
+
}>>;
|
|
76
|
+
};
|
|
77
|
+
/** Selected Release basis from the same D1 authority snapshot, including its transition sequence. */
|
|
78
|
+
export type AppReleaseSurfaceTransitionBasis = {
|
|
79
|
+
readonly kind: "absent";
|
|
80
|
+
} | {
|
|
81
|
+
readonly kind: "ambiguous";
|
|
82
|
+
} | {
|
|
83
|
+
readonly kind: "none";
|
|
84
|
+
readonly appId: AppId;
|
|
85
|
+
readonly publicSurfaceId: PublicSurfaceId;
|
|
86
|
+
} | {
|
|
87
|
+
readonly kind: "selected";
|
|
88
|
+
readonly appId: AppId;
|
|
89
|
+
readonly publicSurfaceId: PublicSurfaceId;
|
|
90
|
+
readonly releaseId: ReleaseId;
|
|
91
|
+
readonly sequence: number;
|
|
92
|
+
readonly eligibility: "eligible" | "ineligible";
|
|
93
|
+
/** Authority-read start time; consumers may only shorten its horizon. */
|
|
94
|
+
readonly checkedAt: number;
|
|
95
|
+
};
|
|
96
|
+
/** Structural result returned by the D1 operations used by App Release. */
|
|
97
|
+
export type AppReleaseD1QueryResult = {
|
|
98
|
+
/** Whether D1 completed the operation successfully. */
|
|
99
|
+
readonly success: boolean;
|
|
100
|
+
/** Untrusted row values returned by the operation. */
|
|
101
|
+
readonly results: readonly unknown[];
|
|
102
|
+
};
|
|
103
|
+
/** Structural prepared-statement surface needed by the D1-backed store. */
|
|
104
|
+
export type AppReleaseD1PreparedStatement = {
|
|
105
|
+
/** Bind positional values and return the statement to execute. */
|
|
106
|
+
bind(...values: unknown[]): AppReleaseD1PreparedStatement;
|
|
107
|
+
/** Read the first untrusted row, or `null` when none exists. */
|
|
108
|
+
first(): Promise<object | null>;
|
|
109
|
+
/** Read all matching rows. */
|
|
110
|
+
all(): Promise<AppReleaseD1QueryResult>;
|
|
111
|
+
/** Execute a mutating statement. */
|
|
112
|
+
run(): Promise<AppReleaseD1QueryResult>;
|
|
113
|
+
};
|
|
114
|
+
/** Structural D1 surface kept independent of Cloudflare vendor declarations. */
|
|
115
|
+
export type AppReleaseD1Database = {
|
|
116
|
+
/** Prepare one SQL statement for binding and execution. */
|
|
117
|
+
prepare(query: string): AppReleaseD1PreparedStatement;
|
|
118
|
+
/** Execute a group of statements atomically in native D1. */
|
|
119
|
+
batch(statements: readonly AppReleaseD1PreparedStatement[]): Promise<readonly AppReleaseD1QueryResult[]>;
|
|
120
|
+
};
|
|
121
|
+
/** Structural R2 object surface needed by the artifact reader. */
|
|
122
|
+
export type AppReleaseR2Object = {
|
|
123
|
+
/** Native immutable object version checked for referenced App children. */
|
|
124
|
+
readonly version: string;
|
|
125
|
+
/** Object size in bytes, checked before the body is buffered. */
|
|
126
|
+
readonly size: number;
|
|
127
|
+
/** HTTP metadata retained with the object, when present. */
|
|
128
|
+
readonly httpMetadata?: {
|
|
129
|
+
/** Declared media type for the stored object. */
|
|
130
|
+
readonly contentType?: string;
|
|
131
|
+
};
|
|
132
|
+
/** Read the immutable object body. */
|
|
133
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
134
|
+
};
|
|
135
|
+
/** Structural R2 surface kept independent of Cloudflare vendor declarations. */
|
|
136
|
+
export type AppReleaseR2Bucket = {
|
|
137
|
+
/** Read one object by its opaque storage key. */
|
|
138
|
+
get(key: string): Promise<AppReleaseR2Object | null>;
|
|
139
|
+
};
|
|
140
|
+
/** R2 operations used by the scoped Team erasure owner. */
|
|
141
|
+
export type ErasureBucket = AppReleaseR2Bucket & {
|
|
142
|
+
/** Read the metadata for an exact object key. */
|
|
143
|
+
head(key: string): Promise<object | null>;
|
|
144
|
+
/** Delete an exact object key after catalog references are checked. */
|
|
145
|
+
delete(key: string): Promise<void>;
|
|
146
|
+
};
|
|
147
|
+
/** Read every catalog reference before deleting content-addressed R2 objects. */
|
|
148
|
+
export declare function createTeamAppReleaseErasure(database: AppReleaseD1Database, bucket: ErasureBucket, assetPolicy?: AssetBuildPolicy, now?: () => number): {
|
|
149
|
+
/** Reject any live App or R2 key outside this Team's current or retry scope. */
|
|
150
|
+
verifyManifest(teamId: string, appIds: readonly string[], keys: readonly string[]): Promise<{
|
|
151
|
+
teamId: string;
|
|
152
|
+
apps: {
|
|
153
|
+
appId: string;
|
|
154
|
+
keys: readonly string[];
|
|
155
|
+
}[];
|
|
156
|
+
repositories: string[];
|
|
157
|
+
}>;
|
|
158
|
+
/** Inventory Team catalog rows, exclusive objects, and source repositories. */
|
|
159
|
+
preflight(teamId: string): Promise<{
|
|
160
|
+
teamId: string;
|
|
161
|
+
apps: {
|
|
162
|
+
appId: string;
|
|
163
|
+
keys: readonly string[];
|
|
164
|
+
}[];
|
|
165
|
+
repositories: string[];
|
|
166
|
+
}>;
|
|
167
|
+
/** Remove one Team's catalog and exclusive objects, resuming pending jobs. */
|
|
168
|
+
erase(teamId: string): Promise<{
|
|
169
|
+
apps: number;
|
|
170
|
+
}>;
|
|
171
|
+
/** Verify the named Apps, pending jobs, obligations and exclusive objects. */
|
|
172
|
+
readback(teamId: string, appIds: readonly string[], keys: readonly string[]): Promise<{
|
|
173
|
+
clear: boolean;
|
|
174
|
+
personalClear: boolean;
|
|
175
|
+
retainedArtifacts: {
|
|
176
|
+
releaseIds: readonly ReleaseId[];
|
|
177
|
+
disposition_id: string;
|
|
178
|
+
app_id: AppId;
|
|
179
|
+
release_ids_json: string;
|
|
180
|
+
artifact_roots_json: string;
|
|
181
|
+
created_at: number;
|
|
182
|
+
state: "pending" | "revoked" | "retaining" | "retained" | "revoking";
|
|
183
|
+
request_id: string | null;
|
|
184
|
+
reason: string | null;
|
|
185
|
+
completed_at: number | null;
|
|
186
|
+
}[];
|
|
187
|
+
remaining: string[];
|
|
188
|
+
pending: string[];
|
|
189
|
+
obligationTeams: string[];
|
|
190
|
+
obligationPages: string[];
|
|
191
|
+
objects: string[];
|
|
192
|
+
}>;
|
|
193
|
+
};
|
|
194
|
+
/** The erasure coordinator consumes this owner-issued readback, including outstanding buyer custody. */
|
|
195
|
+
export declare const appArtifactErasureReadbackSchema: Schema.Struct<{
|
|
196
|
+
readonly clear: Schema.Boolean;
|
|
197
|
+
readonly personalClear: Schema.Boolean;
|
|
198
|
+
readonly retainedArtifacts: Schema.$Array<Schema.Struct<{
|
|
199
|
+
readonly releaseIds: Schema.$Array<Schema.refine<ReleaseId, Schema.String>>;
|
|
200
|
+
readonly disposition_id: Schema.String;
|
|
201
|
+
readonly app_id: Schema.refine<AppId, Schema.String>;
|
|
202
|
+
readonly release_ids_json: Schema.String;
|
|
203
|
+
readonly artifact_roots_json: Schema.String;
|
|
204
|
+
readonly created_at: Schema.Number;
|
|
205
|
+
readonly state: Schema.Literals<readonly ["pending", "retaining", "retained", "revoking", "revoked"]>;
|
|
206
|
+
readonly request_id: Schema.NullOr<Schema.String>;
|
|
207
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
208
|
+
readonly completed_at: Schema.NullOr<Schema.Number>;
|
|
209
|
+
}>>;
|
|
210
|
+
readonly remaining: Schema.$Array<Schema.String>;
|
|
211
|
+
readonly pending: Schema.$Array<Schema.String>;
|
|
212
|
+
readonly obligationTeams: Schema.$Array<Schema.String>;
|
|
213
|
+
readonly obligationPages: Schema.$Array<Schema.String>;
|
|
214
|
+
readonly objects: Schema.$Array<Schema.String>;
|
|
215
|
+
}>;
|
|
216
|
+
/** The one current App Release D1 schema for an empty catalog. */
|
|
217
|
+
export declare const APP_RELEASE_D1_FRESH_SCHEMA: string;
|
|
218
|
+
/** Create the native registry that joins a Team publisher to one App/source. */
|
|
219
|
+
export declare function createD1TeamAppPublisherRegistry(database: AppReleaseD1Database): TeamAppPublisherRegistry;
|
|
220
|
+
/** Create the D1-backed App Release store with private public-website authority. */
|
|
221
|
+
export declare function createD1AppReleaseStore(database: AppReleaseD1Database): PromiseAppReleaseStore & {
|
|
222
|
+
readonly transitionObligations: AppReleaseTransitionObligationStore;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Create the R2-backed artifact reader for opaque artifact references.
|
|
226
|
+
*
|
|
227
|
+
* Asset manifests are verified cheaply for delivery: the root bytes are
|
|
228
|
+
* digest-checked here, while the asset handler checks the requested object.
|
|
229
|
+
* Publication callers pass `verification: "publication"` to retain the
|
|
230
|
+
* complete manifest object sweep.
|
|
231
|
+
*/
|
|
232
|
+
export declare function createR2ArtifactReader(bucket: AppReleaseR2Bucket, policy?: ArtifactSnapshotPolicy, assets?: {
|
|
233
|
+
readonly bucket: Pick<AssetR2Bucket, "head">;
|
|
234
|
+
readonly policy: AssetBuildPolicy;
|
|
235
|
+
}): ArtifactReader;
|
|
236
|
+
/**
|
|
237
|
+
* Open the D1-only obligation adjunct for a future owner-driven dispatcher.
|
|
238
|
+
* The ordinary App Release store contract intentionally does not expose it.
|
|
239
|
+
*/
|
|
240
|
+
export declare function createD1TransitionObligationStore(database: AppReleaseD1Database): AppReleaseTransitionObligationStore;
|
|
241
|
+
/**
|
|
242
|
+
* Resolve one previously selected Release on a Surface and retain the exact
|
|
243
|
+
* transition sequence. The Release need not remain the Surface's current
|
|
244
|
+
* default, but it must still be verified, active, and owned by that Surface.
|
|
245
|
+
*/
|
|
246
|
+
export declare function readD1SurfaceTransitionBasis(database: AppReleaseD1Database, stableRoute: import("./internal/app-release-contract.js").StableRoute, releaseId: ReleaseId, now?: () => number): Promise<AppReleaseStoreResult<AppReleaseSurfaceTransitionBasis>>;
|
|
247
|
+
/** Match one eligible selected Release without leaking store-result branching to consumers. */
|
|
248
|
+
export declare function matchEligibleSurfaceTransitionBasis(result: AppReleaseStoreResult<AppReleaseSurfaceTransitionBasis>, expected: Readonly<{
|
|
249
|
+
appId: AppId;
|
|
250
|
+
releaseId: ReleaseId;
|
|
251
|
+
sequence?: number;
|
|
252
|
+
}>): Extract<AppReleaseSurfaceTransitionBasis, {
|
|
253
|
+
kind: "selected";
|
|
254
|
+
}> | null;
|