@proofoftech/flowsafe 0.1.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/CHANGELOG.md +21 -0
- package/LICENSE +202 -0
- package/README.md +273 -0
- package/dist/approval-api/contract.d.ts +45 -0
- package/dist/approval-api/contract.d.ts.map +1 -0
- package/dist/approval-api/contract.js +37 -0
- package/dist/approval-api/contract.js.map +1 -0
- package/dist/approval-api/d1-store.d.ts +52 -0
- package/dist/approval-api/d1-store.d.ts.map +1 -0
- package/dist/approval-api/d1-store.js +468 -0
- package/dist/approval-api/d1-store.js.map +1 -0
- package/dist/approval-api/grants.d.ts +52 -0
- package/dist/approval-api/grants.d.ts.map +1 -0
- package/dist/approval-api/grants.js +200 -0
- package/dist/approval-api/grants.js.map +1 -0
- package/dist/approval-api/index.d.ts +21 -0
- package/dist/approval-api/index.d.ts.map +1 -0
- package/dist/approval-api/index.js +18 -0
- package/dist/approval-api/index.js.map +1 -0
- package/dist/approval-api/retention.d.ts +32 -0
- package/dist/approval-api/retention.d.ts.map +1 -0
- package/dist/approval-api/retention.js +81 -0
- package/dist/approval-api/retention.js.map +1 -0
- package/dist/approval-api/router.d.ts +51 -0
- package/dist/approval-api/router.d.ts.map +1 -0
- package/dist/approval-api/router.js +245 -0
- package/dist/approval-api/router.js.map +1 -0
- package/dist/approval-api/service.d.ts +134 -0
- package/dist/approval-api/service.d.ts.map +1 -0
- package/dist/approval-api/service.js +537 -0
- package/dist/approval-api/service.js.map +1 -0
- package/dist/approval-api/store.d.ts +126 -0
- package/dist/approval-api/store.d.ts.map +1 -0
- package/dist/approval-api/store.js +189 -0
- package/dist/approval-api/store.js.map +1 -0
- package/dist/approval-api/tenant-brand.d.ts +35 -0
- package/dist/approval-api/tenant-brand.d.ts.map +1 -0
- package/dist/approval-api/tenant-brand.js +18 -0
- package/dist/approval-api/tenant-brand.js.map +1 -0
- package/dist/approval-api/tenant-context.d.ts +44 -0
- package/dist/approval-api/tenant-context.d.ts.map +1 -0
- package/dist/approval-api/tenant-context.js +49 -0
- package/dist/approval-api/tenant-context.js.map +1 -0
- package/dist/approval-api/tenant-store.d.ts +36 -0
- package/dist/approval-api/tenant-store.d.ts.map +1 -0
- package/dist/approval-api/tenant-store.js +122 -0
- package/dist/approval-api/tenant-store.js.map +1 -0
- package/dist/approval-api/types.d.ts +247 -0
- package/dist/approval-api/types.d.ts.map +1 -0
- package/dist/approval-api/types.js +157 -0
- package/dist/approval-api/types.js.map +1 -0
- package/dist/approval-ui/App.d.ts +11 -0
- package/dist/approval-ui/App.d.ts.map +1 -0
- package/dist/approval-ui/App.js +15 -0
- package/dist/approval-ui/App.js.map +1 -0
- package/dist/approval-ui/DetailView.d.ts +13 -0
- package/dist/approval-ui/DetailView.d.ts.map +1 -0
- package/dist/approval-ui/DetailView.js +20 -0
- package/dist/approval-ui/DetailView.js.map +1 -0
- package/dist/approval-ui/MetricsView.d.ts +7 -0
- package/dist/approval-ui/MetricsView.d.ts.map +1 -0
- package/dist/approval-ui/MetricsView.js +22 -0
- package/dist/approval-ui/MetricsView.js.map +1 -0
- package/dist/approval-ui/QueueView.d.ts +11 -0
- package/dist/approval-ui/QueueView.d.ts.map +1 -0
- package/dist/approval-ui/QueueView.js +59 -0
- package/dist/approval-ui/QueueView.js.map +1 -0
- package/dist/approval-ui/client.d.ts +34 -0
- package/dist/approval-ui/client.d.ts.map +1 -0
- package/dist/approval-ui/client.js +103 -0
- package/dist/approval-ui/client.js.map +1 -0
- package/dist/approval-ui/components.d.ts +125 -0
- package/dist/approval-ui/components.d.ts.map +1 -0
- package/dist/approval-ui/components.js +54 -0
- package/dist/approval-ui/components.js.map +1 -0
- package/dist/approval-ui/index.d.ts +21 -0
- package/dist/approval-ui/index.d.ts.map +1 -0
- package/dist/approval-ui/index.js +21 -0
- package/dist/approval-ui/index.js.map +1 -0
- package/dist/approval-ui/mount.d.ts +23 -0
- package/dist/approval-ui/mount.d.ts.map +1 -0
- package/dist/approval-ui/mount.js +17 -0
- package/dist/approval-ui/mount.js.map +1 -0
- package/dist/approval-ui/tips.d.ts +32 -0
- package/dist/approval-ui/tips.d.ts.map +1 -0
- package/dist/approval-ui/tips.js +32 -0
- package/dist/approval-ui/tips.js.map +1 -0
- package/dist/approval-ui/use-approval-dashboard.d.ts +70 -0
- package/dist/approval-ui/use-approval-dashboard.d.ts.map +1 -0
- package/dist/approval-ui/use-approval-dashboard.js +148 -0
- package/dist/approval-ui/use-approval-dashboard.js.map +1 -0
- package/dist/approval-ui/view-model.d.ts +24 -0
- package/dist/approval-ui/view-model.d.ts.map +1 -0
- package/dist/approval-ui/view-model.js +62 -0
- package/dist/approval-ui/view-model.js.map +1 -0
- package/dist/artifacts/index.d.ts +123 -0
- package/dist/artifacts/index.d.ts.map +1 -0
- package/dist/artifacts/index.js +223 -0
- package/dist/artifacts/index.js.map +1 -0
- package/dist/audit-export/index.d.ts +71 -0
- package/dist/audit-export/index.d.ts.map +1 -0
- package/dist/audit-export/index.js +124 -0
- package/dist/audit-export/index.js.map +1 -0
- package/dist/do-runner/breakwater-keys.d.ts +23 -0
- package/dist/do-runner/breakwater-keys.d.ts.map +1 -0
- package/dist/do-runner/breakwater-keys.js +38 -0
- package/dist/do-runner/breakwater-keys.js.map +1 -0
- package/dist/do-runner/cf-types.d.ts +26 -0
- package/dist/do-runner/cf-types.d.ts.map +1 -0
- package/dist/do-runner/cf-types.js +13 -0
- package/dist/do-runner/cf-types.js.map +1 -0
- package/dist/do-runner/d1-storage.d.ts +128 -0
- package/dist/do-runner/d1-storage.d.ts.map +1 -0
- package/dist/do-runner/d1-storage.js +287 -0
- package/dist/do-runner/d1-storage.js.map +1 -0
- package/dist/do-runner/durable-object.d.ts +28 -0
- package/dist/do-runner/durable-object.d.ts.map +1 -0
- package/dist/do-runner/durable-object.js +164 -0
- package/dist/do-runner/durable-object.js.map +1 -0
- package/dist/do-runner/index.d.ts +12 -0
- package/dist/do-runner/index.d.ts.map +1 -0
- package/dist/do-runner/index.js +11 -0
- package/dist/do-runner/index.js.map +1 -0
- package/dist/do-runner/init.d.ts +38 -0
- package/dist/do-runner/init.d.ts.map +1 -0
- package/dist/do-runner/init.js +45 -0
- package/dist/do-runner/init.js.map +1 -0
- package/dist/do-runner/path-safe-id.d.ts +19 -0
- package/dist/do-runner/path-safe-id.d.ts.map +1 -0
- package/dist/do-runner/path-safe-id.js +70 -0
- package/dist/do-runner/path-safe-id.js.map +1 -0
- package/dist/do-runner/resume-ledger.d.ts +48 -0
- package/dist/do-runner/resume-ledger.d.ts.map +1 -0
- package/dist/do-runner/resume-ledger.js +59 -0
- package/dist/do-runner/resume-ledger.js.map +1 -0
- package/dist/do-runner/runtime.d.ts +161 -0
- package/dist/do-runner/runtime.d.ts.map +1 -0
- package/dist/do-runner/runtime.js +509 -0
- package/dist/do-runner/runtime.js.map +1 -0
- package/dist/host-kit/approval-bridge.d.ts +109 -0
- package/dist/host-kit/approval-bridge.d.ts.map +1 -0
- package/dist/host-kit/approval-bridge.js +262 -0
- package/dist/host-kit/approval-bridge.js.map +1 -0
- package/dist/host-kit/bearer-auth.d.ts +19 -0
- package/dist/host-kit/bearer-auth.d.ts.map +1 -0
- package/dist/host-kit/bearer-auth.js +67 -0
- package/dist/host-kit/bearer-auth.js.map +1 -0
- package/dist/host-kit/do-response.d.ts +13 -0
- package/dist/host-kit/do-response.d.ts.map +1 -0
- package/dist/host-kit/do-response.js +24 -0
- package/dist/host-kit/do-response.js.map +1 -0
- package/dist/host-kit/do-run-topology.d.ts +32 -0
- package/dist/host-kit/do-run-topology.d.ts.map +1 -0
- package/dist/host-kit/do-run-topology.js +39 -0
- package/dist/host-kit/do-run-topology.js.map +1 -0
- package/dist/host-kit/env-vars.d.ts +26 -0
- package/dist/host-kit/env-vars.d.ts.map +1 -0
- package/dist/host-kit/env-vars.js +48 -0
- package/dist/host-kit/env-vars.js.map +1 -0
- package/dist/host-kit/host-approval-service.d.ts +125 -0
- package/dist/host-kit/host-approval-service.d.ts.map +1 -0
- package/dist/host-kit/host-approval-service.js +187 -0
- package/dist/host-kit/host-approval-service.js.map +1 -0
- package/dist/host-kit/index.d.ts +18 -0
- package/dist/host-kit/index.d.ts.map +1 -0
- package/dist/host-kit/index.js +34 -0
- package/dist/host-kit/index.js.map +1 -0
- package/dist/host-kit/module.d.ts +34 -0
- package/dist/host-kit/module.d.ts.map +1 -0
- package/dist/host-kit/module.js +17 -0
- package/dist/host-kit/module.js.map +1 -0
- package/dist/host-kit/registration.d.ts +11 -0
- package/dist/host-kit/registration.d.ts.map +1 -0
- package/dist/host-kit/registration.js +21 -0
- package/dist/host-kit/registration.js.map +1 -0
- package/dist/host-kit/run-route-error.d.ts +11 -0
- package/dist/host-kit/run-route-error.d.ts.map +1 -0
- package/dist/host-kit/run-route-error.js +22 -0
- package/dist/host-kit/run-route-error.js.map +1 -0
- package/dist/host-kit/run-router.d.ts +60 -0
- package/dist/host-kit/run-router.d.ts.map +1 -0
- package/dist/host-kit/run-router.js +212 -0
- package/dist/host-kit/run-router.js.map +1 -0
- package/dist/host-kit/subdomain-check.d.ts +23 -0
- package/dist/host-kit/subdomain-check.d.ts.map +1 -0
- package/dist/host-kit/subdomain-check.js +60 -0
- package/dist/host-kit/subdomain-check.js.map +1 -0
- package/dist/host-kit/tenant-registry.d.ts +51 -0
- package/dist/host-kit/tenant-registry.d.ts.map +1 -0
- package/dist/host-kit/tenant-registry.js +87 -0
- package/dist/host-kit/tenant-registry.js.map +1 -0
- package/dist/host-kit/verifier.d.ts +63 -0
- package/dist/host-kit/verifier.d.ts.map +1 -0
- package/dist/host-kit/verifier.js +191 -0
- package/dist/host-kit/verifier.js.map +1 -0
- package/dist/host-kit/workflow-meta.d.ts +25 -0
- package/dist/host-kit/workflow-meta.d.ts.map +1 -0
- package/dist/host-kit/workflow-meta.js +12 -0
- package/dist/host-kit/workflow-meta.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// Artifacts — R2-backed workflow artifact storage (Phase 4 "Workflow
|
|
2
|
+
// artifacts stored in R2"). Steps write files a run produces (reports,
|
|
3
|
+
// exports, generated media) keyed `${workflowId}/${runId}/${name}`, so
|
|
4
|
+
// artifacts inherit the run's addressing and can be reclaimed alongside it.
|
|
5
|
+
//
|
|
6
|
+
// One store implementation over a structural bucket seam: R2ArtifactStore
|
|
7
|
+
// speaks the ArtifactBucket subset of Cloudflare's R2Bucket, and
|
|
8
|
+
// InMemoryArtifactBucket implements the same subset for tests and local dev
|
|
9
|
+
// — the store logic is identical either way. Ids reuse the do-runner's
|
|
10
|
+
// PATH_SAFE_ID_PATTERN so anything addressable as a run is addressable as an
|
|
11
|
+
// artifact scope, and names are validated segment-wise (no '.'/'..', no
|
|
12
|
+
// empty segments) so a name can never escape its run's keyspace.
|
|
13
|
+
import { PATH_SAFE_ID_PATTERN } from '../do-runner/path-safe-id.js';
|
|
14
|
+
export class InvalidArtifactRefError extends Error {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'InvalidArtifactRefError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// R2's hard key limit; enforced here so an oversized name fails as a clear
|
|
21
|
+
// client error instead of an opaque bucket rejection.
|
|
22
|
+
const MAX_KEY_BYTES = 1024;
|
|
23
|
+
function assertPathSafeId(value, field) {
|
|
24
|
+
if (!PATH_SAFE_ID_PATTERN.test(value)) {
|
|
25
|
+
throw new InvalidArtifactRefError(`${field} must be URL-path-safe (letters, digits, '.', '_', '~', '-'; 1-200 chars)`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function assertArtifactName(name) {
|
|
29
|
+
const segments = name.split('/');
|
|
30
|
+
if (name.length === 0 ||
|
|
31
|
+
segments.some((segment) => !PATH_SAFE_ID_PATTERN.test(segment))) {
|
|
32
|
+
throw new InvalidArtifactRefError("artifact name must be '/'-joined path-safe segments (letters, digits, '.', '_', '~', '-'; no empty, '.', or '..' segments)");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Workflow artifact store over an R2 bucket (or any ArtifactBucket, e.g.
|
|
37
|
+
* InMemoryArtifactBucket in tests/dev). Typical step usage:
|
|
38
|
+
*
|
|
39
|
+
* const artifacts = new R2ArtifactStore(env.ARTIFACTS);
|
|
40
|
+
* await artifacts.put(
|
|
41
|
+
* { workflowId, runId, name: 'reports/summary.md' },
|
|
42
|
+
* markdown,
|
|
43
|
+
* { contentType: 'text/markdown' },
|
|
44
|
+
* );
|
|
45
|
+
*/
|
|
46
|
+
export class R2ArtifactStore {
|
|
47
|
+
#bucket;
|
|
48
|
+
#keyPrefix;
|
|
49
|
+
constructor(bucket, options = {}) {
|
|
50
|
+
if (options.keyPrefix !== undefined) {
|
|
51
|
+
assertArtifactName(options.keyPrefix);
|
|
52
|
+
}
|
|
53
|
+
this.#bucket = bucket;
|
|
54
|
+
this.#keyPrefix = options.keyPrefix ? `${options.keyPrefix}/` : '';
|
|
55
|
+
}
|
|
56
|
+
async put(ref, body, options = {}) {
|
|
57
|
+
const key = this.#key(ref);
|
|
58
|
+
const object = await this.#bucket.put(key, body, {
|
|
59
|
+
httpMetadata: options.contentType
|
|
60
|
+
? { contentType: options.contentType }
|
|
61
|
+
: undefined,
|
|
62
|
+
customMetadata: options.metadata,
|
|
63
|
+
});
|
|
64
|
+
// R2 returns the written object; a bucket that returns null (allowed by
|
|
65
|
+
// the subset) still yields a correct record from the inputs.
|
|
66
|
+
return object
|
|
67
|
+
? this.#record(object, ref)
|
|
68
|
+
: {
|
|
69
|
+
...ref,
|
|
70
|
+
key,
|
|
71
|
+
contentType: options.contentType,
|
|
72
|
+
metadata: options.metadata,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async get(ref) {
|
|
76
|
+
const object = await this.#bucket.get(this.#key(ref));
|
|
77
|
+
if (!object)
|
|
78
|
+
return undefined;
|
|
79
|
+
return {
|
|
80
|
+
record: this.#record(object, ref),
|
|
81
|
+
arrayBuffer: () => object.arrayBuffer(),
|
|
82
|
+
text: () => object.text(),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** All artifacts of a run (cursor pagination drained), sorted by name. */
|
|
86
|
+
async list(scope) {
|
|
87
|
+
assertPathSafeId(scope.workflowId, 'workflowId');
|
|
88
|
+
assertPathSafeId(scope.runId, 'runId');
|
|
89
|
+
const runPrefix = `${this.#keyPrefix}${scope.workflowId}/${scope.runId}/`;
|
|
90
|
+
const prefix = `${runPrefix}${scope.namePrefix ?? ''}`;
|
|
91
|
+
const records = [];
|
|
92
|
+
let cursor;
|
|
93
|
+
do {
|
|
94
|
+
const page = await this.#bucket.list({ prefix, cursor });
|
|
95
|
+
for (const object of page.objects) {
|
|
96
|
+
records.push(this.#record(object, {
|
|
97
|
+
workflowId: scope.workflowId,
|
|
98
|
+
runId: scope.runId,
|
|
99
|
+
name: object.key.slice(runPrefix.length),
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
cursor = page.truncated ? page.cursor : undefined;
|
|
103
|
+
} while (cursor !== undefined);
|
|
104
|
+
return records.sort((a, b) => a.name.localeCompare(b.name));
|
|
105
|
+
}
|
|
106
|
+
async delete(ref) {
|
|
107
|
+
await this.#bucket.delete(this.#key(ref));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Delete every artifact of a run; returns the count. Idempotent (a
|
|
111
|
+
* deleted run lists nothing). The purges call it: pass this store as
|
|
112
|
+
* `artifactStore` to BOTH purgeExpiredWorkflowRuns (per aged-out run,
|
|
113
|
+
* with its snapshot row) and purgeTenant (per surviving run at
|
|
114
|
+
* offboarding) — the snapshot rows are the only enumerable record of a
|
|
115
|
+
* run's artifact keys, so an unpaired retention purge strands them.
|
|
116
|
+
*/
|
|
117
|
+
async deleteRun(workflowId, runId) {
|
|
118
|
+
const records = await this.list({ workflowId, runId });
|
|
119
|
+
for (const record of records) {
|
|
120
|
+
await this.#bucket.delete(record.key);
|
|
121
|
+
}
|
|
122
|
+
return records.length;
|
|
123
|
+
}
|
|
124
|
+
#key(ref) {
|
|
125
|
+
assertPathSafeId(ref.workflowId, 'workflowId');
|
|
126
|
+
assertPathSafeId(ref.runId, 'runId');
|
|
127
|
+
assertArtifactName(ref.name);
|
|
128
|
+
const key = `${this.#keyPrefix}${ref.workflowId}/${ref.runId}/${ref.name}`;
|
|
129
|
+
if (new TextEncoder().encode(key).length > MAX_KEY_BYTES) {
|
|
130
|
+
throw new InvalidArtifactRefError(`artifact key exceeds R2's ${MAX_KEY_BYTES}-byte limit`);
|
|
131
|
+
}
|
|
132
|
+
return key;
|
|
133
|
+
}
|
|
134
|
+
#record(object, ref) {
|
|
135
|
+
return {
|
|
136
|
+
...ref,
|
|
137
|
+
key: object.key,
|
|
138
|
+
size: object.size,
|
|
139
|
+
contentType: object.httpMetadata?.contentType,
|
|
140
|
+
uploadedAt: object.uploaded.toISOString(),
|
|
141
|
+
metadata: object.customMetadata,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function collectBytes(body) {
|
|
146
|
+
if (typeof body === 'string')
|
|
147
|
+
return new TextEncoder().encode(body);
|
|
148
|
+
if (body instanceof ArrayBuffer)
|
|
149
|
+
return new Uint8Array(body.slice(0));
|
|
150
|
+
if (ArrayBuffer.isView(body)) {
|
|
151
|
+
return new Uint8Array(body.buffer.slice(body.byteOffset, body.byteOffset + body.byteLength));
|
|
152
|
+
}
|
|
153
|
+
if (body instanceof Blob)
|
|
154
|
+
return new Uint8Array(await body.arrayBuffer());
|
|
155
|
+
// ReadableStream — drain it, like R2 would.
|
|
156
|
+
const chunks = [];
|
|
157
|
+
let total = 0;
|
|
158
|
+
const reader = body.getReader();
|
|
159
|
+
for (;;) {
|
|
160
|
+
const { done, value } = await reader.read();
|
|
161
|
+
if (done)
|
|
162
|
+
break;
|
|
163
|
+
chunks.push(value);
|
|
164
|
+
total += value.byteLength;
|
|
165
|
+
}
|
|
166
|
+
const bytes = new Uint8Array(total);
|
|
167
|
+
let offset = 0;
|
|
168
|
+
for (const chunk of chunks) {
|
|
169
|
+
bytes.set(chunk, offset);
|
|
170
|
+
offset += chunk.byteLength;
|
|
171
|
+
}
|
|
172
|
+
return bytes;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* ArtifactBucket for tests and local dev — same subset R2 implements, one
|
|
176
|
+
* page per list() (truncated: false), bodies normalized to bytes on put.
|
|
177
|
+
*/
|
|
178
|
+
export class InMemoryArtifactBucket {
|
|
179
|
+
#objects = new Map();
|
|
180
|
+
async put(key, value, options) {
|
|
181
|
+
const stored = {
|
|
182
|
+
bytes: await collectBytes(value),
|
|
183
|
+
uploaded: new Date(),
|
|
184
|
+
contentType: options?.httpMetadata?.contentType,
|
|
185
|
+
customMetadata: options?.customMetadata,
|
|
186
|
+
};
|
|
187
|
+
this.#objects.set(key, stored);
|
|
188
|
+
return this.#object(key, stored);
|
|
189
|
+
}
|
|
190
|
+
async get(key) {
|
|
191
|
+
const stored = this.#objects.get(key);
|
|
192
|
+
if (!stored)
|
|
193
|
+
return null;
|
|
194
|
+
return {
|
|
195
|
+
...this.#object(key, stored),
|
|
196
|
+
arrayBuffer: async () => stored.bytes.buffer.slice(stored.bytes.byteOffset, stored.bytes.byteOffset + stored.bytes.byteLength),
|
|
197
|
+
text: async () => new TextDecoder().decode(stored.bytes),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
async delete(key) {
|
|
201
|
+
this.#objects.delete(key);
|
|
202
|
+
}
|
|
203
|
+
async list(options) {
|
|
204
|
+
const prefix = options?.prefix ?? '';
|
|
205
|
+
const objects = [...this.#objects.entries()]
|
|
206
|
+
.filter(([key]) => key.startsWith(prefix))
|
|
207
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
208
|
+
.map(([key, stored]) => this.#object(key, stored));
|
|
209
|
+
return { objects, truncated: false };
|
|
210
|
+
}
|
|
211
|
+
#object(key, stored) {
|
|
212
|
+
return {
|
|
213
|
+
key,
|
|
214
|
+
size: stored.bytes.byteLength,
|
|
215
|
+
uploaded: stored.uploaded,
|
|
216
|
+
httpMetadata: stored.contentType !== undefined
|
|
217
|
+
? { contentType: stored.contentType }
|
|
218
|
+
: undefined,
|
|
219
|
+
customMetadata: stored.customMetadata,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,uEAAuE;AACvE,uEAAuE;AACvE,4EAA4E;AAC5E,EAAE;AACF,0EAA0E;AAC1E,iEAAiE;AACjE,4EAA4E;AAC5E,uEAAuE;AACvE,6EAA6E;AAC7E,wEAAwE;AACxE,iEAAiE;AAIjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AA+FpE,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAED,2EAA2E;AAC3E,sDAAsD;AACtD,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,SAAS,gBAAgB,CAAC,KAAa,EAAE,KAAa;IACpD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,GAAG,KAAK,2EAA2E,CACpF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IACE,IAAI,CAAC,MAAM,KAAK,CAAC;QACjB,QAAQ,CAAC,I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;YACzB,YAAY,EACV,MAAM,CAAC,WAAW,KAAK,SAAS;gBAC9B,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE;gBACrC,CAAC,CAAC,SAAS;YACf,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Producer subset of a Cloudflare `Queue<TEvent>` binding (send returns
|
|
3
|
+
* `Promise<QueueSendResponse>` on Workers — anything awaitable works here).
|
|
4
|
+
*/
|
|
5
|
+
export interface AuditQueue<TEvent = unknown> {
|
|
6
|
+
send(message: TEvent): Promise<unknown>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Adapt a Queue producer binding onto the audit-sink contracts. Generic so
|
|
10
|
+
* the returned sink assigns to any event-typed sink signature (breakwater's
|
|
11
|
+
* `AuditSink`, approval-api's `ApprovalAuditSink` wrapper) without casts.
|
|
12
|
+
*/
|
|
13
|
+
export declare function queueAuditSink<TEvent>(queue: AuditQueue<TEvent>): (event: TEvent) => Promise<void>;
|
|
14
|
+
/** Consumer subset of a Cloudflare queue `Message<TEvent>`. */
|
|
15
|
+
export interface AuditQueueMessage<TEvent = unknown> {
|
|
16
|
+
readonly body: TEvent;
|
|
17
|
+
ack(): void;
|
|
18
|
+
retry(): void;
|
|
19
|
+
}
|
|
20
|
+
/** Consumer subset of a Cloudflare `MessageBatch<TEvent>`. */
|
|
21
|
+
export interface AuditMessageBatch<TEvent = unknown> {
|
|
22
|
+
readonly messages: readonly AuditQueueMessage<TEvent>[];
|
|
23
|
+
ackAll(): void;
|
|
24
|
+
retryAll(): void;
|
|
25
|
+
}
|
|
26
|
+
/** Structural subset of fetch — injectable for tests. */
|
|
27
|
+
export type AuditExportFetch = (url: string, init: {
|
|
28
|
+
method: string;
|
|
29
|
+
headers: Record<string, string>;
|
|
30
|
+
body: string;
|
|
31
|
+
}) => Promise<{
|
|
32
|
+
ok: boolean;
|
|
33
|
+
status: number;
|
|
34
|
+
}>;
|
|
35
|
+
export interface AuditExportOptions<TEvent = unknown> {
|
|
36
|
+
/** HTTP event-collector URL (Splunk HEC, Datadog intake, Elastic, ...). */
|
|
37
|
+
endpoint: string;
|
|
38
|
+
/**
|
|
39
|
+
* Merged over the NDJSON content-type (so it can be overridden), e.g.
|
|
40
|
+
* `{ authorization: 'Splunk <token>' }`.
|
|
41
|
+
*/
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
/**
|
|
44
|
+
* Per-event reshaping for SIEM-specific envelopes — Splunk HEC wants
|
|
45
|
+
* `(event) => ({ event })`. Default: the event itself.
|
|
46
|
+
*/
|
|
47
|
+
transform?: (event: TEvent) => unknown;
|
|
48
|
+
/** Defaults to the global fetch. */
|
|
49
|
+
fetch?: AuditExportFetch;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The whole Worker `queue()` handler for the audit-export consumer,
|
|
53
|
+
* previously copied verbatim into each host: guard the endpoint config —
|
|
54
|
+
* a consumer bound without an endpoint logs a config-error and RETRIES the
|
|
55
|
+
* batch (fail closed: nothing is acked unconfirmed, and the DLQ eventually
|
|
56
|
+
* surfaces the misconfig) — then delegate to createAuditQueueConsumer.
|
|
57
|
+
*/
|
|
58
|
+
export declare function createAuditQueueHandler<TEvent = unknown>(options: {
|
|
59
|
+
/** SIEM collector URL (the host's SIEM_ENDPOINT var). */
|
|
60
|
+
endpoint?: string;
|
|
61
|
+
/** Sent as the `authorization` header (the SIEM_AUTH_HEADER secret). */
|
|
62
|
+
authHeader?: string;
|
|
63
|
+
}): (batch: AuditMessageBatch<TEvent>) => Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Build a Workers queue consumer exporting audit batches to a SIEM. The
|
|
66
|
+
* export is all-or-nothing per batch: a failed POST retries the whole batch
|
|
67
|
+
* (Queues backoff, then the configured dead-letter queue), so no event is
|
|
68
|
+
* acked before the collector confirmed it.
|
|
69
|
+
*/
|
|
70
|
+
export declare function createAuditQueueConsumer<TEvent = unknown>(options: AuditExportOptions<TEvent>): (batch: AuditMessageBatch<TEvent>) => Promise<void>;
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/audit-export/index.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,MAAM,GAAG,OAAO;IAC1C,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EACnC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,GACxB,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAIlC;AAED,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,OAAO;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,GAAG,IAAI,IAAI,CAAC;IACZ,KAAK,IAAI,IAAI,CAAC;CACf;AAED,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,OAAO;IACjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;IACxD,MAAM,IAAI,IAAI,CAAC;IACf,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,yDAAyD;AACzD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd,KACE,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9C,MAAM,WAAW,kBAAkB,CAAC,MAAM,GAAG,OAAO;IAClD,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,oCAAoC;IACpC,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE;IACjE,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,CAAC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAqBtD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,GAAG,OAAO,EACvD,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAClC,CAAC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAmErD"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Audit export — Cloudflare Queues integration shipping audit events to a
|
|
2
|
+
// SIEM (Phase 4 "Audit export to SIEM via Queues"). Producer side:
|
|
3
|
+
// queueAuditSink() adapts a Queue producer binding onto the audit-sink
|
|
4
|
+
// contracts (breakwater AuditLogger `sink` and approval-api `audit` both
|
|
5
|
+
// accept it — per-event send() is deliberate: producer-side buffering would
|
|
6
|
+
// lose events on isolate death, and Queues does the delivery batching).
|
|
7
|
+
// Consumer side: createAuditQueueConsumer() turns queue batches into one
|
|
8
|
+
// authenticated HTTP POST (NDJSON — the generic HTTP event-collector shape;
|
|
9
|
+
// `transform` reshapes per SIEM envelope), acking on 2xx and retrying the
|
|
10
|
+
// whole batch otherwise so Queues' backoff/DLQ semantics own reliability.
|
|
11
|
+
//
|
|
12
|
+
// All types are structural subsets of @cloudflare/workers-types (Queue,
|
|
13
|
+
// MessageBatch, fetch) so the module tests off-Workers and never forces the
|
|
14
|
+
// types package on consumers.
|
|
15
|
+
/**
|
|
16
|
+
* Adapt a Queue producer binding onto the audit-sink contracts. Generic so
|
|
17
|
+
* the returned sink assigns to any event-typed sink signature (breakwater's
|
|
18
|
+
* `AuditSink`, approval-api's `ApprovalAuditSink` wrapper) without casts.
|
|
19
|
+
*/
|
|
20
|
+
export function queueAuditSink(queue) {
|
|
21
|
+
return async (event) => {
|
|
22
|
+
await queue.send(event);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The whole Worker `queue()` handler for the audit-export consumer,
|
|
27
|
+
* previously copied verbatim into each host: guard the endpoint config —
|
|
28
|
+
* a consumer bound without an endpoint logs a config-error and RETRIES the
|
|
29
|
+
* batch (fail closed: nothing is acked unconfirmed, and the DLQ eventually
|
|
30
|
+
* surfaces the misconfig) — then delegate to createAuditQueueConsumer.
|
|
31
|
+
*/
|
|
32
|
+
export function createAuditQueueHandler(options) {
|
|
33
|
+
return async (batch) => {
|
|
34
|
+
if (!options.endpoint) {
|
|
35
|
+
console.error(JSON.stringify({
|
|
36
|
+
type: 'config-error',
|
|
37
|
+
var: 'SIEM_ENDPOINT',
|
|
38
|
+
reason: 'audit consumer bound without an export endpoint — retrying batch',
|
|
39
|
+
}));
|
|
40
|
+
batch.retryAll();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
await createAuditQueueConsumer({
|
|
44
|
+
endpoint: options.endpoint,
|
|
45
|
+
headers: options.authHeader
|
|
46
|
+
? { authorization: options.authHeader }
|
|
47
|
+
: undefined,
|
|
48
|
+
})(batch);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a Workers queue consumer exporting audit batches to a SIEM. The
|
|
53
|
+
* export is all-or-nothing per batch: a failed POST retries the whole batch
|
|
54
|
+
* (Queues backoff, then the configured dead-letter queue), so no event is
|
|
55
|
+
* acked before the collector confirmed it.
|
|
56
|
+
*/
|
|
57
|
+
export function createAuditQueueConsumer(options) {
|
|
58
|
+
const transform = options.transform ?? ((event) => event);
|
|
59
|
+
const doFetch = options.fetch ?? fetch;
|
|
60
|
+
return async (batch) => {
|
|
61
|
+
if (batch.messages.length === 0)
|
|
62
|
+
return;
|
|
63
|
+
const lines = [];
|
|
64
|
+
for (const message of batch.messages) {
|
|
65
|
+
// A transform or serialization that fails must drop only THAT event,
|
|
66
|
+
// never reject the batch — a rejection retries every co-batched good
|
|
67
|
+
// event and drags them all to the DLQ. Two failure shapes, both
|
|
68
|
+
// dropped loudly so the rest keep flowing: a throw (a throwing
|
|
69
|
+
// transform, or an unserializable event — BigInt, circular ref) and a
|
|
70
|
+
// silent swallow (transform returns undefined → stringify undefined).
|
|
71
|
+
let line;
|
|
72
|
+
try {
|
|
73
|
+
line = JSON.stringify(transform(message.body));
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error(JSON.stringify({
|
|
77
|
+
type: 'audit-export-error',
|
|
78
|
+
reason: `event dropped — transform/serialize threw: ${String(error)}`,
|
|
79
|
+
}));
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (typeof line === 'string') {
|
|
83
|
+
lines.push(line);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
console.error(JSON.stringify({
|
|
87
|
+
type: 'audit-export-error',
|
|
88
|
+
reason: 'transform produced no serializable event — dropped',
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (lines.length === 0) {
|
|
93
|
+
batch.ackAll();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
let ok = false;
|
|
97
|
+
let status;
|
|
98
|
+
try {
|
|
99
|
+
const response = await doFetch(options.endpoint, {
|
|
100
|
+
method: 'POST',
|
|
101
|
+
headers: {
|
|
102
|
+
'content-type': 'application/x-ndjson',
|
|
103
|
+
...options.headers,
|
|
104
|
+
},
|
|
105
|
+
body: lines.join('\n'),
|
|
106
|
+
});
|
|
107
|
+
ok = response.ok;
|
|
108
|
+
status = response.status;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
console.error(JSON.stringify({ type: 'audit-export-error', reason: String(error) }));
|
|
112
|
+
}
|
|
113
|
+
if (ok) {
|
|
114
|
+
batch.ackAll();
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
if (status !== undefined) {
|
|
118
|
+
console.error(JSON.stringify({ type: 'audit-export-error', status }));
|
|
119
|
+
}
|
|
120
|
+
batch.retryAll();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/audit-export/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mEAAmE;AACnE,uEAAuE;AACvE,yEAAyE;AACzE,4EAA4E;AAC5E,wEAAwE;AACxE,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,EAAE;AACF,wEAAwE;AACxE,4EAA4E;AAC5E,8BAA8B;AAU9B;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAyB;IAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,EAAE;QACrB,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC;AA2CD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAmB,OAKzD;IACC,OAAO,KAAK,EAAE,KAAK,EAAE,EAAE;QACrB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CACX,IAAI,CAAC,SAAS,CAAC;gBACb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AS,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;YACxE,CAAC;YACD,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* requestContext key the breakwater connector write-gate reads. The value is
|
|
3
|
+
* a plain array of approved connector ids (breakwater's approvalGranted does
|
|
4
|
+
* `Array.isArray(value) && value.includes(connectorId)`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const BREAKWATER_APPROVED_CONNECTORS_KEY = "breakwater.approvedConnectors";
|
|
7
|
+
/** requestContext key breakwater actor resolution reads ({ id, role }). */
|
|
8
|
+
export declare const BREAKWATER_ACTOR_KEY = "breakwater.actor";
|
|
9
|
+
/**
|
|
10
|
+
* requestContext key breakwater's crossWorkflowIsolation evaluator reads:
|
|
11
|
+
* the calling workflow's scope (its workflowId). RunnerRuntime mints it on
|
|
12
|
+
* every start/resume leg — trusted-runtime-only, like the grant key above.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BREAKWATER_WORKFLOW_SCOPE_KEY = "breakwater.workflowScope";
|
|
15
|
+
/**
|
|
16
|
+
* requestContext key breakwater's tenantIsolation evaluator and connector
|
|
17
|
+
* key-scoping read: the caller's OPAQUE isolation scope. RunnerRuntime mints
|
|
18
|
+
* the runId's tenant prefix here on every leg of a tenant-salted run (INV-1),
|
|
19
|
+
* so connector idempotency + rate-limit keys segment per tenant. Absent on
|
|
20
|
+
* non-tenant runs — breakwater then preserves its single-tenant keys.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BREAKWATER_ISOLATION_SCOPE_KEY = "breakwater.isolationScope";
|
|
23
|
+
//# sourceMappingURL=breakwater-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breakwater-keys.d.ts","sourceRoot":"","sources":["../../src/do-runner/breakwater-keys.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,kCACd,CAAC;AAElC,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,6BAA6B,CAAC;AAExE;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// breakwater requestContext keys, mirrored by value.
|
|
2
|
+
//
|
|
3
|
+
// flowsafe deliberately does NOT import @proofoftech/breakwater at runtime:
|
|
4
|
+
// the packages compose over documented requestContext keys
|
|
5
|
+
// (docs/security-threat-model.md, trust boundary 6), and a
|
|
6
|
+
// runtime dependency would force breakwater's dist to exist before flowsafe
|
|
7
|
+
// typechecks (the repo gate runs typecheck before build). Literal equality
|
|
8
|
+
// with breakwater's exported constants is enforced by the cross-package
|
|
9
|
+
// contract tests in end-to-end.test.ts — drift fails the suite, not
|
|
10
|
+
// production.
|
|
11
|
+
//
|
|
12
|
+
// The literals live HERE — a leaf module the do-runner owns — because the
|
|
13
|
+
// runtime mints the workflow-scope key itself on every leg. approval-api's
|
|
14
|
+
// contract.ts re-exports them, keeping approval-api -> do-runner as the only
|
|
15
|
+
// cross-directory dependency direction.
|
|
16
|
+
/**
|
|
17
|
+
* requestContext key the breakwater connector write-gate reads. The value is
|
|
18
|
+
* a plain array of approved connector ids (breakwater's approvalGranted does
|
|
19
|
+
* `Array.isArray(value) && value.includes(connectorId)`).
|
|
20
|
+
*/
|
|
21
|
+
export const BREAKWATER_APPROVED_CONNECTORS_KEY = 'breakwater.approvedConnectors';
|
|
22
|
+
/** requestContext key breakwater actor resolution reads ({ id, role }). */
|
|
23
|
+
export const BREAKWATER_ACTOR_KEY = 'breakwater.actor';
|
|
24
|
+
/**
|
|
25
|
+
* requestContext key breakwater's crossWorkflowIsolation evaluator reads:
|
|
26
|
+
* the calling workflow's scope (its workflowId). RunnerRuntime mints it on
|
|
27
|
+
* every start/resume leg — trusted-runtime-only, like the grant key above.
|
|
28
|
+
*/
|
|
29
|
+
export const BREAKWATER_WORKFLOW_SCOPE_KEY = 'breakwater.workflowScope';
|
|
30
|
+
/**
|
|
31
|
+
* requestContext key breakwater's tenantIsolation evaluator and connector
|
|
32
|
+
* key-scoping read: the caller's OPAQUE isolation scope. RunnerRuntime mints
|
|
33
|
+
* the runId's tenant prefix here on every leg of a tenant-salted run (INV-1),
|
|
34
|
+
* so connector idempotency + rate-limit keys segment per tenant. Absent on
|
|
35
|
+
* non-tenant runs — breakwater then preserves its single-tenant keys.
|
|
36
|
+
*/
|
|
37
|
+
export const BREAKWATER_ISOLATION_SCOPE_KEY = 'breakwater.isolationScope';
|
|
38
|
+
//# sourceMappingURL=breakwater-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breakwater-keys.js","sourceRoot":"","sources":["../../src/do-runner/breakwater-keys.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,4EAA4E;AAC5E,2DAA2D;AAC3D,2DAA2D;AAC3D,4EAA4E;AAC5E,2EAA2E;AAC3E,wEAAwE;AACxE,oEAAoE;AACpE,cAAc;AACd,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,wCAAwC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAC7C,+BAA+B,CAAC;AAElC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,0BAA0B,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ResumeLedgerStorage } from './resume-ledger.js';
|
|
2
|
+
/**
|
|
3
|
+
* Structural subset of D1Database — the binding init() and createD1Storage
|
|
4
|
+
* forward, opaque, into @mastra/cloudflare-d1's D1Store (see the cast at
|
|
5
|
+
* that boundary in d1-storage.ts). do-runner itself never calls a method on
|
|
6
|
+
* it — D1Store does, internally — so `prepare` is kept only as the one
|
|
7
|
+
* identifying member: it rejects a value that plainly isn't D1-shaped (a
|
|
8
|
+
* string, a KV namespace, ...) at the type level without over-specifying a
|
|
9
|
+
* surface nothing here consumes.
|
|
10
|
+
*/
|
|
11
|
+
export interface D1DatabaseBinding {
|
|
12
|
+
prepare(query: string): unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Structural subset of DurableObjectState — the shape DurableObjectRunner
|
|
16
|
+
* reads from. Only `id.name` (tenant/run identity recovery off the DO's own
|
|
17
|
+
* idFromName address, INV-1) and `storage` (the ctx.storage-backed resume
|
|
18
|
+
* ledger — DurableStorageResumeLedger in resume-ledger.ts) are ever touched.
|
|
19
|
+
*/
|
|
20
|
+
export interface DurableObjectRunnerState {
|
|
21
|
+
readonly id: {
|
|
22
|
+
readonly name?: string;
|
|
23
|
+
};
|
|
24
|
+
readonly storage: ResumeLedgerStorage;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=cf-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cf-types.d.ts","sourceRoot":"","sources":["../../src/do-runner/cf-types.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE;QACX,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;CACvC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Structural subsets of the Cloudflare Workers runtime types the DO runner
|
|
2
|
+
// forwards (D1Database) or reads from (DurableObjectState).
|
|
3
|
+
// @cloudflare/workers-types is a devDependency only — its types are ambient,
|
|
4
|
+
// never runtime code — so importing it from an exported signature here would
|
|
5
|
+
// leak into the published dist/**/*.d.ts and force every consumer to install
|
|
6
|
+
// it too (or silently degrade flagship types like D1Database to `any` under
|
|
7
|
+
// skipLibCheck, the operative mode). Same posture as SnapshotDatabase in
|
|
8
|
+
// d1-storage.ts, IdempotencyDatabase in breakwater, and ApprovalDatabase in
|
|
9
|
+
// approval-api: each interface below covers only the members do-runner
|
|
10
|
+
// actually reads or forwards, held structurally so tests can back them with
|
|
11
|
+
// plain objects and Workers pass the real bindings straight through.
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=cf-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cf-types.js","sourceRoot":"","sources":["../../src/do-runner/cf-types.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4DAA4D;AAC5D,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AACvE,4EAA4E;AAC5E,qEAAqE"}
|