@prisma/composer-prisma-cloud 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/LICENSE +201 -0
- package/dist/control.d.mts +56 -0
- package/dist/control.mjs +1814 -0
- package/dist/control.mjs.map +1 -0
- package/dist/cron/index.d.mts +96 -0
- package/dist/cron/index.mjs +356 -0
- package/dist/cron/index.mjs.map +1 -0
- package/dist/cron/scheduler-entrypoint.mjs +7713 -0
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -0
- package/dist/cron/scheduler-service.mjs +282 -0
- package/dist/cron/scheduler-service.mjs.map +1 -0
- package/dist/index.d.mts +168 -0
- package/dist/index.mjs +179 -0
- package/dist/index.mjs.map +1 -0
- package/dist/prisma-next-COrwlg3N.mjs +176 -0
- package/dist/prisma-next-COrwlg3N.mjs.map +1 -0
- package/dist/prisma-next.d.mts +72 -0
- package/dist/prisma-next.mjs +2 -0
- package/dist/serializer-C2CsA7xm-29Eg2Tjl.mjs +207 -0
- package/dist/serializer-C2CsA7xm-29Eg2Tjl.mjs.map +1 -0
- package/dist/storage/index.d.mts +67 -0
- package/dist/storage/index.mjs +374 -0
- package/dist/storage/index.mjs.map +1 -0
- package/dist/storage/storage-entrypoint.mjs +1138 -0
- package/dist/storage/storage-entrypoint.mjs.map +1 -0
- package/dist/storage/storage-service.mjs +340 -0
- package/dist/storage/storage-service.mjs.map +1 -0
- package/dist/storage/testing.d.mts +82 -0
- package/dist/storage/testing.mjs +531 -0
- package/dist/storage/testing.mjs.map +1 -0
- package/dist/testing.d.mts +26 -0
- package/dist/testing.mjs +32 -0
- package/dist/testing.mjs.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { contract, rpc, serve } from "@prisma/composer/rpc";
|
|
2
|
+
import { type } from "arktype";
|
|
3
|
+
import { hydrateSecrets, hydrateSync, module, number, param, service } from "@prisma/composer";
|
|
4
|
+
import node from "@prisma/composer/node";
|
|
5
|
+
import { blindCast } from "@prisma/composer/casts";
|
|
6
|
+
blindCast(Symbol.for("prisma:prisma-cloud-secret-source"));
|
|
7
|
+
/**
|
|
8
|
+
* Walks a node's own params, then each dependency input's connection params —
|
|
9
|
+
* the same enumeration order `configOf` uses, but carrying the raw
|
|
10
|
+
* `ConfigParam` (with its `serialize`/`deserialize`) instead of a pure-data
|
|
11
|
+
* projection.
|
|
12
|
+
*/
|
|
13
|
+
function paramEntries(node) {
|
|
14
|
+
const entries = [];
|
|
15
|
+
for (const [input, value] of Object.entries(node.inputs)) {
|
|
16
|
+
if (typeof value !== "object" || value === null) continue;
|
|
17
|
+
const params = blindCast(value).connection.params;
|
|
18
|
+
for (const [name, param] of Object.entries(params)) entries.push({
|
|
19
|
+
owner: { input },
|
|
20
|
+
name,
|
|
21
|
+
param
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
for (const [name, param] of Object.entries(node.params)) entries.push({
|
|
25
|
+
owner: "service",
|
|
26
|
+
name,
|
|
27
|
+
param
|
|
28
|
+
});
|
|
29
|
+
return entries;
|
|
30
|
+
}
|
|
31
|
+
const configKey = (address, d) => {
|
|
32
|
+
const segments = address.split(".").filter((s) => s.length > 0);
|
|
33
|
+
const owner = d.owner === "service" ? [] : [d.owner.input];
|
|
34
|
+
return [
|
|
35
|
+
"COMPOSE",
|
|
36
|
+
...segments,
|
|
37
|
+
...owner,
|
|
38
|
+
d.name
|
|
39
|
+
].join("_").toUpperCase();
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Typed value → its stored string. Service-own literals are JSON-encoded; a
|
|
43
|
+
* dependency-input value is a provisioning ref at deploy (and a resolved
|
|
44
|
+
* string at boot) and passes through untouched — LANDMINE: JSON-encoding it
|
|
45
|
+
* would break the ordering edge Alchemy resolves through it.
|
|
46
|
+
*/
|
|
47
|
+
function encode(owner, value) {
|
|
48
|
+
return owner === "service" ? JSON.stringify(value) : blindCast(value);
|
|
49
|
+
}
|
|
50
|
+
/** Reverses `encode`: JSON-parse a service-own value, take a dependency-input value raw. */
|
|
51
|
+
function decode(owner, raw) {
|
|
52
|
+
return owner === "service" ? JSON.parse(raw) : raw;
|
|
53
|
+
}
|
|
54
|
+
function coerce(raw, d, key) {
|
|
55
|
+
if (!(raw !== void 0 && raw !== "")) {
|
|
56
|
+
if (d.param.default !== void 0) return d.param.default;
|
|
57
|
+
if (d.param.optional === true) return void 0;
|
|
58
|
+
throw new Error(`missing required config param "${d.name}" (env ${key})`);
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return standardValidateSync(d.param.schema, decode(d.owner, raw));
|
|
62
|
+
} catch (cause) {
|
|
63
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
64
|
+
throw new Error(`invalid value for config param "${d.name}" (env ${key}): ${message}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Boot: read each declared param from env by its key, reverse the param's own
|
|
69
|
+
* serialization (missing/invalid fails loudly), assemble the typed Config.
|
|
70
|
+
* Secrets ride a separate channel (deserializeSecrets), not this one.
|
|
71
|
+
*/
|
|
72
|
+
const deserialize = (node, address) => {
|
|
73
|
+
const service = {};
|
|
74
|
+
const inputs = {};
|
|
75
|
+
for (const d of paramEntries(node)) {
|
|
76
|
+
const key = configKey(address, d);
|
|
77
|
+
const value = coerce(process.env[key], d, key);
|
|
78
|
+
if (d.owner === "service") service[d.name] = value;
|
|
79
|
+
else {
|
|
80
|
+
let bucket = inputs[d.owner.input];
|
|
81
|
+
if (bucket === void 0) {
|
|
82
|
+
bucket = {};
|
|
83
|
+
inputs[d.owner.input] = bucket;
|
|
84
|
+
}
|
|
85
|
+
bucket[d.name] = value;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
service,
|
|
90
|
+
inputs
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* run()'s setup step: write the resolved config to the environment under
|
|
95
|
+
* address-free keys (configKey("", d) + each serialize suffix), which load()
|
|
96
|
+
* reads back with no address. Uses env, not a module variable, because a
|
|
97
|
+
* framework may fork worker processes that inherit env but not memory.
|
|
98
|
+
* Writes only these keys; nothing else is touched.
|
|
99
|
+
*/
|
|
100
|
+
const stash = (node, config) => {
|
|
101
|
+
for (const d of paramEntries(node)) {
|
|
102
|
+
const value = d.owner === "service" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];
|
|
103
|
+
if (value === void 0) continue;
|
|
104
|
+
process.env[configKey("", d)] = encode(d.owner, value);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
/** The pointer-row key for a secret slot: COMPOSE_<addr>_<slot> (secrets are service-level). */
|
|
108
|
+
const secretKey = (address, slot) => configKey(address, {
|
|
109
|
+
owner: "service",
|
|
110
|
+
name: slot
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* Boot: resolve every secret slot to its value by double-lookup — read the
|
|
114
|
+
* pointer key (the platform NAME), then read that platform var. A missing
|
|
115
|
+
* pointer or a missing/empty platform value is a loud failure naming both keys.
|
|
116
|
+
* Returns a plain Record for core's `hydrateSecrets` to box.
|
|
117
|
+
*/
|
|
118
|
+
const deserializeSecrets = (node, address) => {
|
|
119
|
+
const values = {};
|
|
120
|
+
for (const slot of Object.keys(node.secretSlots)) {
|
|
121
|
+
const key = secretKey(address, slot);
|
|
122
|
+
const name = process.env[key];
|
|
123
|
+
if (name === void 0 || name === "") throw new Error(`missing secret pointer for slot "${slot}" (env ${key}) — the deploy did not write it.`);
|
|
124
|
+
const value = process.env[name];
|
|
125
|
+
if (value === void 0 || value === "") throw new Error(`secret "${slot}" is not provisioned (env ${key} → ${name}): the platform var "${name}" is unset or empty.`);
|
|
126
|
+
values[slot] = value;
|
|
127
|
+
}
|
|
128
|
+
return values;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* run()'s setup step for secrets: re-emit each slot's pointer NAME under its
|
|
132
|
+
* address-free key, so the address-free `deserializeSecrets` double-looks-up
|
|
133
|
+
* identically. Never the value — the value stays only in the platform var.
|
|
134
|
+
*/
|
|
135
|
+
const stashSecrets = (node, address) => {
|
|
136
|
+
for (const slot of Object.keys(node.secretSlots)) {
|
|
137
|
+
const name = process.env[secretKey(address, slot)];
|
|
138
|
+
if (name === void 0) continue;
|
|
139
|
+
process.env[secretKey("", slot)] = name;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */
|
|
143
|
+
function standardValidateSync(schema, value) {
|
|
144
|
+
const result = schema["~standard"].validate(value);
|
|
145
|
+
if (result instanceof Promise) throw new Error("config param schema validation must be synchronous — async Standard Schema validators are not supported for config params");
|
|
146
|
+
if (result.issues !== void 0) throw new Error(`config param validation failed: ${result.issues.map((issue) => issue.message).join("; ")}`);
|
|
147
|
+
return result.value;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region ../../1-prisma-cloud/1-extensions/target/dist/index.mjs
|
|
151
|
+
const reservedParams = { port: number({ default: 3e3 }) };
|
|
152
|
+
/**
|
|
153
|
+
* A Prisma Compute service — declarations only (deps + params + build + the
|
|
154
|
+
* ports it exposes), no descriptor. `params` merges with the reserved
|
|
155
|
+
* `ReservedParams` (`port`); a user param whose name collides with a reserved
|
|
156
|
+
* one fails at authoring, the same way a colliding dependency name does.
|
|
157
|
+
* Returns the extension's runnable/loadable node:
|
|
158
|
+
* · run(address, boot) — the process controller: deserialize the platform
|
|
159
|
+
* environment (keyed off `address`, the extension's ONE env read) into a
|
|
160
|
+
* typed Config, re-emit it under address-free process-local stash keys,
|
|
161
|
+
* then call boot() to start the app's entry.
|
|
162
|
+
* · load() / config() — called from inside the app's entry: read the stash;
|
|
163
|
+
* load() hydrates + memoizes the deps, config() returns the typed params.
|
|
164
|
+
* Separate accessors so a dep and a param never share a namespace (ADR-0021).
|
|
165
|
+
*
|
|
166
|
+
* `service()`'s underlying node carries `extension: '@prisma/composer-prisma-cloud'` —
|
|
167
|
+
* the control-plane registry key `prisma-composer deploy` resolves through the
|
|
168
|
+
* app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at
|
|
169
|
+
* deploy time; nodes are pure data.
|
|
170
|
+
*/
|
|
171
|
+
const compute = (def) => {
|
|
172
|
+
const userParams = def.params ?? blindCast({});
|
|
173
|
+
for (const reserved of Object.keys(reservedParams)) {
|
|
174
|
+
if (reserved in def.deps) throw new Error(`compute(): dependency "${reserved}" collides with the reserved service param of the same name — rename the dependency.`);
|
|
175
|
+
if (reserved in userParams) throw new Error(`compute(): param "${reserved}" collides with the reserved service param of the same name — rename the param.`);
|
|
176
|
+
}
|
|
177
|
+
const params = blindCast({
|
|
178
|
+
...userParams,
|
|
179
|
+
...reservedParams
|
|
180
|
+
});
|
|
181
|
+
const node = service({
|
|
182
|
+
name: def.name,
|
|
183
|
+
extension: "@prisma/composer-prisma-cloud",
|
|
184
|
+
type: "compute",
|
|
185
|
+
inputs: def.deps,
|
|
186
|
+
params,
|
|
187
|
+
...def.secrets !== void 0 ? { secrets: def.secrets } : {},
|
|
188
|
+
build: def.build,
|
|
189
|
+
...def.expose !== void 0 ? { expose: def.expose } : {}
|
|
190
|
+
});
|
|
191
|
+
let resolved;
|
|
192
|
+
let loadedDeps;
|
|
193
|
+
let loadedParams;
|
|
194
|
+
let loadedSecrets;
|
|
195
|
+
function processConfig() {
|
|
196
|
+
if (resolved === void 0) resolved = deserialize(node, "");
|
|
197
|
+
return resolved;
|
|
198
|
+
}
|
|
199
|
+
const runnable = {
|
|
200
|
+
...node,
|
|
201
|
+
async run(address, boot) {
|
|
202
|
+
const config = deserialize(node, address);
|
|
203
|
+
stash(node, config);
|
|
204
|
+
stashSecrets(node, address);
|
|
205
|
+
const port = config.service["port"];
|
|
206
|
+
if (typeof port === "number") process.env["PORT"] = String(port);
|
|
207
|
+
return boot();
|
|
208
|
+
},
|
|
209
|
+
load() {
|
|
210
|
+
if (loadedDeps === void 0) loadedDeps = blindCast(hydrateSync(node, processConfig()));
|
|
211
|
+
return loadedDeps;
|
|
212
|
+
},
|
|
213
|
+
config() {
|
|
214
|
+
if (loadedParams === void 0) loadedParams = blindCast(processConfig().service);
|
|
215
|
+
return loadedParams;
|
|
216
|
+
},
|
|
217
|
+
secrets() {
|
|
218
|
+
if (loadedSecrets === void 0) loadedSecrets = blindCast(hydrateSecrets(node, deserializeSecrets(node, "")));
|
|
219
|
+
return loadedSecrets;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
return Object.freeze(blindCast(runnable));
|
|
223
|
+
};
|
|
224
|
+
Object.freeze({
|
|
225
|
+
kind: "postgres",
|
|
226
|
+
__cmp: { url: "" },
|
|
227
|
+
satisfies: (required) => required.kind === "postgres"
|
|
228
|
+
});
|
|
229
|
+
Object.freeze({
|
|
230
|
+
kind: "credentials",
|
|
231
|
+
__cmp: {
|
|
232
|
+
accessKeyId: "",
|
|
233
|
+
secretAccessKey: ""
|
|
234
|
+
},
|
|
235
|
+
satisfies: (required) => required.kind === "credentials"
|
|
236
|
+
});
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region ../../1-prisma-cloud/2-shared-modules/cron/dist/scheduler-iL9rl3YY.mjs
|
|
239
|
+
/**
|
|
240
|
+
* The one call edge between the scheduler and the app's runner: `trigger(jobId)`.
|
|
241
|
+
* The scheduler depends on it (`rpc(triggerContract)`); the runner exposes it
|
|
242
|
+
* (`expose: { trigger: triggerContract }`). `jobId` travels as data through this
|
|
243
|
+
* single method — adding a job never adds a method, service, or port.
|
|
244
|
+
*/
|
|
245
|
+
const triggerContract = contract({ trigger: rpc({
|
|
246
|
+
input: type({ jobId: "string" }),
|
|
247
|
+
output: type({ ok: "boolean" })
|
|
248
|
+
}) });
|
|
249
|
+
/**
|
|
250
|
+
* `defineSchedule({ tick: '60s', mrr: '24h' })` →
|
|
251
|
+
* `{ jobs: [{ jobId: 'tick', every: '60s' }, { jobId: 'mrr', every: '24h' }] }`,
|
|
252
|
+
* preserving key order.
|
|
253
|
+
*/
|
|
254
|
+
function defineSchedule(spec) {
|
|
255
|
+
return { jobs: Object.entries(spec).map(([jobId, every]) => ({
|
|
256
|
+
jobId,
|
|
257
|
+
every
|
|
258
|
+
})) };
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Parses the `every` grammar `<integer><unit>`, unit one of `s`/`m`/`h`/`d`
|
|
262
|
+
* (e.g. `30s`, `24h`), returning milliseconds. Throws on a malformed value —
|
|
263
|
+
* empty, missing/unknown unit, non-integer, or non-positive.
|
|
264
|
+
*/
|
|
265
|
+
function parseEvery(s) {
|
|
266
|
+
const match = /^(\d+)([smhd])$/.exec(s);
|
|
267
|
+
if (match === null) throw new Error(`parseEvery(): "${s}" is not a valid interval — expected "<integer><unit>" with unit one of s/m/h/d (e.g. "30s", "24h").`);
|
|
268
|
+
const [, digits = "", unit = ""] = match;
|
|
269
|
+
const value = Number(digits);
|
|
270
|
+
if (!Number.isInteger(value) || value <= 0) throw new Error(`parseEvery(): "${s}" must have a positive integer value.`);
|
|
271
|
+
switch (unit) {
|
|
272
|
+
case "s": return value * 1e3;
|
|
273
|
+
case "m": return value * 6e4;
|
|
274
|
+
case "h": return value * 36e5;
|
|
275
|
+
case "d": return value * 864e5;
|
|
276
|
+
default: throw new Error(`parseEvery(): "${s}" has an unknown unit "${unit}" — expected one of s/m/h/d.`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The reusable scheduler node and its firing logic. `cronScheduler` builds a
|
|
281
|
+
* `compute()` whose `jobs` param default is the app's schedule and whose only
|
|
282
|
+
* dependency is `trigger(jobId)`; nothing else about it varies per app.
|
|
283
|
+
* `runScheduler` is the pure, injectable firing loop the entrypoint (and its
|
|
284
|
+
* tests) drive.
|
|
285
|
+
*/
|
|
286
|
+
const scheduleSchema = type({
|
|
287
|
+
jobId: "string",
|
|
288
|
+
every: "string"
|
|
289
|
+
}).array();
|
|
290
|
+
/**
|
|
291
|
+
* The always-on scheduler service. `schedule` sets only the `jobs` param's
|
|
292
|
+
* default — the value the deploy serializes into config; the scheduler
|
|
293
|
+
* itself is job-agnostic.
|
|
294
|
+
*/
|
|
295
|
+
function cronScheduler(schedule) {
|
|
296
|
+
return compute({
|
|
297
|
+
name: "scheduler",
|
|
298
|
+
deps: { trigger: rpc(triggerContract) },
|
|
299
|
+
params: { jobs: param(scheduleSchema, { default: [...schedule.jobs] }) },
|
|
300
|
+
build: node({
|
|
301
|
+
module: new URL("./scheduler-service.mjs", import.meta.url).href,
|
|
302
|
+
entry: "./scheduler-entrypoint.mjs"
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Fires `call(jobId)` on each job's `every` interval. A rejected `call` is
|
|
308
|
+
* logged, never thrown — a missed tick is healed by an idempotent target, not
|
|
309
|
+
* by scheduler state. `setTimer` defaults to `setInterval`; tests inject a
|
|
310
|
+
* fake to drive time.
|
|
311
|
+
*/
|
|
312
|
+
function runScheduler(opts) {
|
|
313
|
+
const setTimer = opts.setTimer ?? ((fn, ms) => setInterval(fn, ms));
|
|
314
|
+
for (const job of opts.jobs) setTimer(() => {
|
|
315
|
+
opts.call(job.jobId).catch((err) => {
|
|
316
|
+
console.error(`cron: job "${job.jobId}" failed`, err);
|
|
317
|
+
});
|
|
318
|
+
}, parseEvery(job.every));
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region ../../1-prisma-cloud/2-shared-modules/cron/dist/index.mjs
|
|
322
|
+
/**
|
|
323
|
+
* `opts.runner` is a service exposing `{ trigger }`; the returned module
|
|
324
|
+
* provisions it alongside the scheduler that fires `opts.schedule` at it. The
|
|
325
|
+
* module's boundary deps mirror the runner's own deps, so the parent wires the
|
|
326
|
+
* real work target through them, e.g.
|
|
327
|
+
* `provision(cron({ schedule, runner }), { worker: worker.rpc })`. `opts.name`
|
|
328
|
+
* sets the module name (default `'cron'`). Exposes nothing.
|
|
329
|
+
*/
|
|
330
|
+
function cron(opts) {
|
|
331
|
+
return module(opts.name ?? "cron", { deps: opts.runner.inputs }, ({ inputs, provision }) => {
|
|
332
|
+
const runner = provision(opts.runner, {
|
|
333
|
+
id: "runner",
|
|
334
|
+
deps: inputs
|
|
335
|
+
});
|
|
336
|
+
provision(cronScheduler(opts.schedule), {
|
|
337
|
+
id: "scheduler",
|
|
338
|
+
deps: { trigger: runner.trigger }
|
|
339
|
+
});
|
|
340
|
+
return {};
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function serveSchedule(service, _schedule, handlers) {
|
|
344
|
+
const byId = blindCast(handlers);
|
|
345
|
+
const triggerHandler = async (input, deps) => {
|
|
346
|
+
const handler = byId[input.jobId];
|
|
347
|
+
if (handler === void 0) throw new Error(`serveSchedule(): no handler for job id "${input.jobId}" — not in the schedule.`);
|
|
348
|
+
await handler(deps);
|
|
349
|
+
return { ok: true };
|
|
350
|
+
};
|
|
351
|
+
return serve(service, blindCast({ trigger: { trigger: triggerHandler } }));
|
|
352
|
+
}
|
|
353
|
+
//#endregion
|
|
354
|
+
export { cron, cronScheduler, defineSchedule, runScheduler, serveSchedule, triggerContract };
|
|
355
|
+
|
|
356
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../1-prisma-cloud/1-extensions/target/dist/serializer-C2CsA7xm.mjs","../../../../1-prisma-cloud/1-extensions/target/dist/index.mjs","../../../../1-prisma-cloud/2-shared-modules/cron/dist/scheduler-iL9rl3YY.mjs","../../../../1-prisma-cloud/2-shared-modules/cron/dist/index.mjs"],"sourcesContent":["import { secretSource } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/secret.ts\n/**\n* Brands the payload `envSecret` builds. Core's `secretSource()` is a public\n* SPI, so a user could bypass `envSecret` and bind a raw `secretSource('x')`;\n* the brand lets `secretName` reject such a source (or another target's) with a\n* clear error instead of reading an absent `.name`.\n*/\nconst PRISMA_CLOUD_SECRET_SOURCE = blindCast(Symbol.for(\"prisma:prisma-cloud-secret-source\"));\nconst RESERVED_SECRET_PREFIX = \"COMPOSE_\";\nconst POISONED_SECRET_NAMES = /* @__PURE__ */ new Set([\"DATABASE_URL\", \"DATABASE_URL_POOLED\"]);\n/**\n* Binds a secret slot to a named Prisma Cloud platform env var (ADR-0029). The\n* value is provisioned out-of-band; only the name is carried. The name may not\n* use the framework's reserved `COMPOSE_` prefix or the poisoned\n* `DATABASE_URL(_POOLED)` keys.\n*/\nfunction envSecret(name) {\n\tif (typeof name !== \"string\" || name.length === 0) throw new Error(\"envSecret() requires a non-empty platform env-var name, e.g. envSecret('STRIPE_SECRET_KEY').\");\n\tif (name.startsWith(RESERVED_SECRET_PREFIX)) throw new Error(`envSecret name \"${name}\" may not start with \"${RESERVED_SECRET_PREFIX}\" — that prefix is reserved for the framework's own generated config keys.`);\n\tif (POISONED_SECRET_NAMES.has(name)) throw new Error(`envSecret name \"${name}\" is reserved — ${[...POISONED_SECRET_NAMES].join(\" and \")} are poisoned at project provision and cannot back a secret.`);\n\treturn secretSource({\n\t\t[PRISMA_CLOUD_SECRET_SOURCE]: true,\n\t\tname\n\t});\n}\n/** True only for a payload that `envSecret` built — i.e. one carrying the brand. */\nfunction isEnvSecretPayload(payload) {\n\treturn typeof payload === \"object\" && payload !== null && blindCast(payload)[PRISMA_CLOUD_SECRET_SOURCE] === true;\n}\n/**\n* Reads the Prisma Cloud env-var name back out of a secret binding's opaque\n* source. A source not built by `envSecret` (a raw `secretSource(...)` or\n* another target's source) carries no name — reject it here. `secretName` runs\n* in preflight before any provisioning, so a foreign source fails early and\n* clearly rather than producing a broken deploy with an undefined name.\n*/\nfunction secretName(binding) {\n\tconst payload = binding.source.payload;\n\tif (!isEnvSecretPayload(payload)) throw new Error(`secret slot \"${binding.slot}\" of service \"${binding.serviceAddress}\" is bound to a source not created by envSecret() — bind secrets with envSecret('NAME') from @prisma/composer-prisma-cloud.`);\n\treturn payload.name;\n}\n//#endregion\n//#region src/serializer.ts\n/**\n* Walks a node's own params, then each dependency input's connection params —\n* the same enumeration order `configOf` uses, but carrying the raw\n* `ConfigParam` (with its `serialize`/`deserialize`) instead of a pure-data\n* projection.\n*/\nfunction paramEntries(node) {\n\tconst entries = [];\n\tfor (const [input, value] of Object.entries(node.inputs)) {\n\t\tif (typeof value !== \"object\" || value === null) continue;\n\t\tconst params = blindCast(value).connection.params;\n\t\tfor (const [name, param] of Object.entries(params)) entries.push({\n\t\t\towner: { input },\n\t\t\tname,\n\t\t\tparam\n\t\t});\n\t}\n\tfor (const [name, param] of Object.entries(node.params)) entries.push({\n\t\towner: \"service\",\n\t\tname,\n\t\tparam\n\t});\n\treturn entries;\n}\nconst configKey = (address, d) => {\n\tconst segments = address.split(\".\").filter((s) => s.length > 0);\n\tconst owner = d.owner === \"service\" ? [] : [d.owner.input];\n\treturn [\n\t\t\"COMPOSE\",\n\t\t...segments,\n\t\t...owner,\n\t\td.name\n\t].join(\"_\").toUpperCase();\n};\n/**\n* Typed value → its stored string. Service-own literals are JSON-encoded; a\n* dependency-input value is a provisioning ref at deploy (and a resolved\n* string at boot) and passes through untouched — LANDMINE: JSON-encoding it\n* would break the ordering edge Alchemy resolves through it.\n*/\nfunction encode(owner, value) {\n\treturn owner === \"service\" ? JSON.stringify(value) : blindCast(value);\n}\n/** Reverses `encode`: JSON-parse a service-own value, take a dependency-input value raw. */\nfunction decode(owner, raw) {\n\treturn owner === \"service\" ? JSON.parse(raw) : raw;\n}\nfunction coerce(raw, d, key) {\n\tif (!(raw !== void 0 && raw !== \"\")) {\n\t\tif (d.param.default !== void 0) return d.param.default;\n\t\tif (d.param.optional === true) return void 0;\n\t\tthrow new Error(`missing required config param \"${d.name}\" (env ${key})`);\n\t}\n\ttry {\n\t\treturn standardValidateSync(d.param.schema, decode(d.owner, raw));\n\t} catch (cause) {\n\t\tconst message = cause instanceof Error ? cause.message : String(cause);\n\t\tthrow new Error(`invalid value for config param \"${d.name}\" (env ${key}): ${message}`);\n\t}\n}\n/**\n* Boot: read each declared param from env by its key, reverse the param's own\n* serialization (missing/invalid fails loudly), assemble the typed Config.\n* Secrets ride a separate channel (deserializeSecrets), not this one.\n*/\nconst deserialize = (node, address) => {\n\tconst service = {};\n\tconst inputs = {};\n\tfor (const d of paramEntries(node)) {\n\t\tconst key = configKey(address, d);\n\t\tconst value = coerce(process.env[key], d, key);\n\t\tif (d.owner === \"service\") service[d.name] = value;\n\t\telse {\n\t\t\tlet bucket = inputs[d.owner.input];\n\t\t\tif (bucket === void 0) {\n\t\t\t\tbucket = {};\n\t\t\t\tinputs[d.owner.input] = bucket;\n\t\t\t}\n\t\t\tbucket[d.name] = value;\n\t\t}\n\t}\n\treturn {\n\t\tservice,\n\t\tinputs\n\t};\n};\n/**\n* run()'s setup step: write the resolved config to the environment under\n* address-free keys (configKey(\"\", d) + each serialize suffix), which load()\n* reads back with no address. Uses env, not a module variable, because a\n* framework may fork worker processes that inherit env but not memory.\n* Writes only these keys; nothing else is touched.\n*/\nconst stash = (node, config) => {\n\tfor (const d of paramEntries(node)) {\n\t\tconst value = d.owner === \"service\" ? config.service[d.name] : config.inputs[d.owner.input]?.[d.name];\n\t\tif (value === void 0) continue;\n\t\tprocess.env[configKey(\"\", d)] = encode(d.owner, value);\n\t}\n};\n/** The pointer-row key for a secret slot: COMPOSE_<addr>_<slot> (secrets are service-level). */\nconst secretKey = (address, slot) => configKey(address, {\n\towner: \"service\",\n\tname: slot\n});\n/**\n* Deploy: the pointer rows for a node's secret slots — each slot's key mapped to\n* the platform NAME the root bound it to (looked up in `graph.secrets`). Never a\n* value. A declared slot with no binding is a Load-invariant violation (Load\n* binds every slot), surfaced loudly here rather than written as a blank row.\n*/\nfunction secretPointerRows(node, address, bindings) {\n\tconst rows = [];\n\tfor (const slot of Object.keys(node.secretSlots)) {\n\t\tconst binding = bindings.find((b) => b.serviceAddress === address && b.slot === slot);\n\t\tif (binding === void 0) throw new Error(`secret slot \"${slot}\" of \"${address}\" has no bound platform name — Load should have bound it (ADR-0029).`);\n\t\trows.push({\n\t\t\tkey: secretKey(address, slot),\n\t\t\tname: secretName(binding)\n\t\t});\n\t}\n\treturn rows;\n}\n/**\n* Boot: resolve every secret slot to its value by double-lookup — read the\n* pointer key (the platform NAME), then read that platform var. A missing\n* pointer or a missing/empty platform value is a loud failure naming both keys.\n* Returns a plain Record for core's `hydrateSecrets` to box.\n*/\nconst deserializeSecrets = (node, address) => {\n\tconst values = {};\n\tfor (const slot of Object.keys(node.secretSlots)) {\n\t\tconst key = secretKey(address, slot);\n\t\tconst name = process.env[key];\n\t\tif (name === void 0 || name === \"\") throw new Error(`missing secret pointer for slot \"${slot}\" (env ${key}) — the deploy did not write it.`);\n\t\tconst value = process.env[name];\n\t\tif (value === void 0 || value === \"\") throw new Error(`secret \"${slot}\" is not provisioned (env ${key} → ${name}): the platform var \"${name}\" is unset or empty.`);\n\t\tvalues[slot] = value;\n\t}\n\treturn values;\n};\n/**\n* run()'s setup step for secrets: re-emit each slot's pointer NAME under its\n* address-free key, so the address-free `deserializeSecrets` double-looks-up\n* identically. Never the value — the value stays only in the platform var.\n*/\nconst stashSecrets = (node, address) => {\n\tfor (const slot of Object.keys(node.secretSlots)) {\n\t\tconst name = process.env[secretKey(address, slot)];\n\t\tif (name === void 0) continue;\n\t\tprocess.env[secretKey(\"\", slot)] = name;\n\t}\n};\n/** Synchronous Standard Schema validation — see the matching note in core's `config.ts`. */\nfunction standardValidateSync(schema, value) {\n\tconst result = schema[\"~standard\"].validate(value);\n\tif (result instanceof Promise) throw new Error(\"config param schema validation must be synchronous — async Standard Schema validators are not supported for config params\");\n\tif (result.issues !== void 0) throw new Error(`config param validation failed: ${result.issues.map((issue) => issue.message).join(\"; \")}`);\n\treturn result.value;\n}\n//#endregion\nexport { paramEntries as a, stashSecrets as c, encode as i, envSecret as l, deserialize as n, secretPointerRows as o, deserializeSecrets as r, stash as s, configKey as t, secretName as u };\n\n//# sourceMappingURL=serializer-C2CsA7xm.mjs.map","import { c as stashSecrets, l as envSecret, n as deserialize, r as deserializeSecrets, s as stash, t as configKey, u as secretName } from \"./serializer-C2CsA7xm.mjs\";\nimport { dependency, hydrateSecrets, hydrateSync, number, resource, service, string } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/compute.ts\nconst reservedParams = { port: number({ default: 3e3 }) };\n/**\n* A Prisma Compute service — declarations only (deps + params + build + the\n* ports it exposes), no descriptor. `params` merges with the reserved\n* `ReservedParams` (`port`); a user param whose name collides with a reserved\n* one fails at authoring, the same way a colliding dependency name does.\n* Returns the extension's runnable/loadable node:\n* · run(address, boot) — the process controller: deserialize the platform\n* environment (keyed off `address`, the extension's ONE env read) into a\n* typed Config, re-emit it under address-free process-local stash keys,\n* then call boot() to start the app's entry.\n* · load() / config() — called from inside the app's entry: read the stash;\n* load() hydrates + memoizes the deps, config() returns the typed params.\n* Separate accessors so a dep and a param never share a namespace (ADR-0021).\n*\n* `service()`'s underlying node carries `extension: '@prisma/composer-prisma-cloud'` —\n* the control-plane registry key `prisma-composer deploy` resolves through the\n* app's `prisma-composer.config.ts` (ADR-0017). This module loads nothing at\n* deploy time; nodes are pure data.\n*/\nconst compute = (def) => {\n\tconst userParams = def.params ?? blindCast({});\n\tfor (const reserved of Object.keys(reservedParams)) {\n\t\tif (reserved in def.deps) throw new Error(`compute(): dependency \"${reserved}\" collides with the reserved service param of the same name — rename the dependency.`);\n\t\tif (reserved in userParams) throw new Error(`compute(): param \"${reserved}\" collides with the reserved service param of the same name — rename the param.`);\n\t}\n\tconst params = blindCast({\n\t\t...userParams,\n\t\t...reservedParams\n\t});\n\tconst node = service({\n\t\tname: def.name,\n\t\textension: \"@prisma/composer-prisma-cloud\",\n\t\ttype: \"compute\",\n\t\tinputs: def.deps,\n\t\tparams,\n\t\t...def.secrets !== void 0 ? { secrets: def.secrets } : {},\n\t\tbuild: def.build,\n\t\t...def.expose !== void 0 ? { expose: def.expose } : {}\n\t});\n\tlet resolved;\n\tlet loadedDeps;\n\tlet loadedParams;\n\tlet loadedSecrets;\n\tfunction processConfig() {\n\t\tif (resolved === void 0) resolved = deserialize(node, \"\");\n\t\treturn resolved;\n\t}\n\tconst runnable = {\n\t\t...node,\n\t\tasync run(address, boot) {\n\t\t\tconst config = deserialize(node, address);\n\t\t\tstash(node, config);\n\t\t\tstashSecrets(node, address);\n\t\t\tconst port = config.service[\"port\"];\n\t\t\tif (typeof port === \"number\") process.env[\"PORT\"] = String(port);\n\t\t\treturn boot();\n\t\t},\n\t\tload() {\n\t\t\tif (loadedDeps === void 0) loadedDeps = blindCast(hydrateSync(node, processConfig()));\n\t\t\treturn loadedDeps;\n\t\t},\n\t\tconfig() {\n\t\t\tif (loadedParams === void 0) loadedParams = blindCast(processConfig().service);\n\t\t\treturn loadedParams;\n\t\t},\n\t\tsecrets() {\n\t\t\tif (loadedSecrets === void 0) loadedSecrets = blindCast(hydrateSecrets(node, deserializeSecrets(node, \"\")));\n\t\t\treturn loadedSecrets;\n\t\t}\n\t};\n\treturn Object.freeze(blindCast(runnable));\n};\n//#endregion\n//#region src/http.ts\nconst defaultHttpClient = (cfg) => ({\n\turl: cfg.url,\n\tfetch: (path, init) => fetch(new URL(path, cfg.url), init)\n});\n/**\n* A service-to-service dependency. Its binding (what `load()` returns) is a\n* derived HttpClient — a thin URL-anchored fetch wrapper (fetch is standard\n* across runtimes — no driver, no runtime coupling). http() is a\n* protocol-owned kind: the framework owns the transport, so the client is\n* kind-canonical and derived from the contract, with no user client in the\n* declaration (ADR-0015). The typed generated client arrives with the\n* interface primitive (a later extension point).\n*/\nconst http = (opts) => dependency({\n\tname: opts.name,\n\ttype: \"http\",\n\tconnection: {\n\t\tparams: { url: string() },\n\t\thydrate: (v) => defaultHttpClient({ url: v.url })\n\t}\n});\n//#endregion\n//#region src/postgres.ts\n/**\n* The contract a Postgres provides — and the contract its consumers require.\n* `satisfies` compares KIND, not identity: an extension module can be duplicated\n* across a workspace (same rationale as the Symbol.for node brand), and every\n* duplicate's contract must still satisfy. `__cmp` is the connection config a\n* postgres offers; core never inspects it.\n*/\nconst postgresContract = Object.freeze({\n\tkind: \"postgres\",\n\t__cmp: { url: \"\" },\n\tsatisfies: (required) => required.kind === \"postgres\"\n});\nfunction postgres(opts) {\n\tif (opts?.name !== void 0) return resource({\n\t\tname: opts.name,\n\t\textension: \"@prisma/composer-prisma-cloud\",\n\t\tprovides: postgresContract\n\t});\n\treturn dependency({\n\t\ttype: \"postgres\",\n\t\tconnection: {\n\t\t\tparams: { url: string() },\n\t\t\thydrate: (v) => v\n\t\t},\n\t\trequired: postgresContract\n\t});\n}\n//#endregion\n//#region src/s3-credentials.ts\n/**\n* The contract the `s3-credentials` resource provides — a minted SigV4 key\n* pair. `satisfies` compares KIND only (mirrors `postgresContract`); `__cmp` is\n* the config the resource offers, which core never inspects.\n*/\nconst credentialsContract = Object.freeze({\n\tkind: \"credentials\",\n\t__cmp: {\n\t\taccessKeyId: \"\",\n\t\tsecretAccessKey: \"\"\n\t},\n\tsatisfies: (required) => required.kind === \"credentials\"\n});\nfunction s3Credentials(opts) {\n\tif (opts?.name !== void 0) return resource({\n\t\tname: opts.name,\n\t\textension: \"@prisma/composer-prisma-cloud\",\n\t\tprovides: credentialsContract\n\t});\n\treturn dependency({\n\t\ttype: \"credentials\",\n\t\tconnection: {\n\t\t\tparams: {\n\t\t\t\taccessKeyId: string(),\n\t\t\t\tsecretAccessKey: string()\n\t\t\t},\n\t\t\thydrate: (v) => v\n\t\t},\n\t\trequired: credentialsContract\n\t});\n}\n//#endregion\n//#region src/s3-store.ts\n/**\n* The storage service authoring factory — a `compute` service routed to the\n* `s3-store` lowering instead of `compute`'s. It is exactly `compute`'s\n* runnable (run/load/config, deps, params, build, expose) with the routing\n* `type` overridden to `'s3-store'`: nothing at runtime keys off `type` (the\n* serializer keys off the deployment address and each param's owner/name, and\n* `load`/`config` off deps/params), so only the deploy-time descriptor lookup\n* sees the override and routes to the extended-output lowering (§ 5). The\n* return type is compute's exactly (including the reserved `port` param). The\n* storage module (D4b) calls this with its `db`/`credentials` deps, a `bucket`\n* param, and `expose: { store: s3Contract }`.\n*/\nfunction s3StoreService(def) {\n\tconst node = compute(def);\n\treturn Object.freeze(blindCast({\n\t\t...node,\n\t\ttype: \"s3-store\"\n\t}));\n}\n//#endregion\nexport { compute, configKey, credentialsContract, envSecret, http, postgres, postgresContract, s3Credentials, s3StoreService, secretName };\n\n//# sourceMappingURL=index.mjs.map","import { contract, rpc } from \"@internal/rpc\";\nimport { type } from \"arktype\";\nimport { param } from \"@internal/core\";\nimport node from \"@internal/node\";\nimport { compute } from \"@internal/prisma-cloud\";\n//#region src/contract.ts\n/**\n* The one call edge between the scheduler and the app's runner: `trigger(jobId)`.\n* The scheduler depends on it (`rpc(triggerContract)`); the runner exposes it\n* (`expose: { trigger: triggerContract }`). `jobId` travels as data through this\n* single method — adding a job never adds a method, service, or port.\n*/\nconst triggerContract = contract({ trigger: rpc({\n\tinput: type({ jobId: \"string\" }),\n\toutput: type({ ok: \"boolean\" })\n}) });\n//#endregion\n//#region src/schedule.ts\n/**\n* `defineSchedule({ tick: '60s', mrr: '24h' })` →\n* `{ jobs: [{ jobId: 'tick', every: '60s' }, { jobId: 'mrr', every: '24h' }] }`,\n* preserving key order.\n*/\nfunction defineSchedule(spec) {\n\treturn { jobs: Object.entries(spec).map(([jobId, every]) => ({\n\t\tjobId,\n\t\tevery\n\t})) };\n}\n/**\n* Parses the `every` grammar `<integer><unit>`, unit one of `s`/`m`/`h`/`d`\n* (e.g. `30s`, `24h`), returning milliseconds. Throws on a malformed value —\n* empty, missing/unknown unit, non-integer, or non-positive.\n*/\nfunction parseEvery(s) {\n\tconst match = /^(\\d+)([smhd])$/.exec(s);\n\tif (match === null) throw new Error(`parseEvery(): \"${s}\" is not a valid interval — expected \"<integer><unit>\" with unit one of s/m/h/d (e.g. \"30s\", \"24h\").`);\n\tconst [, digits = \"\", unit = \"\"] = match;\n\tconst value = Number(digits);\n\tif (!Number.isInteger(value) || value <= 0) throw new Error(`parseEvery(): \"${s}\" must have a positive integer value.`);\n\tswitch (unit) {\n\t\tcase \"s\": return value * 1e3;\n\t\tcase \"m\": return value * 6e4;\n\t\tcase \"h\": return value * 36e5;\n\t\tcase \"d\": return value * 864e5;\n\t\tdefault: throw new Error(`parseEvery(): \"${s}\" has an unknown unit \"${unit}\" — expected one of s/m/h/d.`);\n\t}\n}\n//#endregion\n//#region src/scheduler.ts\n/**\n* The reusable scheduler node and its firing logic. `cronScheduler` builds a\n* `compute()` whose `jobs` param default is the app's schedule and whose only\n* dependency is `trigger(jobId)`; nothing else about it varies per app.\n* `runScheduler` is the pure, injectable firing loop the entrypoint (and its\n* tests) drive.\n*/\nconst scheduleSchema = type({\n\tjobId: \"string\",\n\tevery: \"string\"\n}).array();\n/**\n* The always-on scheduler service. `schedule` sets only the `jobs` param's\n* default — the value the deploy serializes into config; the scheduler\n* itself is job-agnostic.\n*/\nfunction cronScheduler(schedule) {\n\treturn compute({\n\t\tname: \"scheduler\",\n\t\tdeps: { trigger: rpc(triggerContract) },\n\t\tparams: { jobs: param(scheduleSchema, { default: [...schedule.jobs] }) },\n\t\tbuild: node({\n\t\t\tmodule: new URL(\"./scheduler-service.mjs\", import.meta.url).href,\n\t\t\tentry: \"./scheduler-entrypoint.mjs\"\n\t\t})\n\t});\n}\n/**\n* Fires `call(jobId)` on each job's `every` interval. A rejected `call` is\n* logged, never thrown — a missed tick is healed by an idempotent target, not\n* by scheduler state. `setTimer` defaults to `setInterval`; tests inject a\n* fake to drive time.\n*/\nfunction runScheduler(opts) {\n\tconst setTimer = opts.setTimer ?? ((fn, ms) => setInterval(fn, ms));\n\tfor (const job of opts.jobs) setTimer(() => {\n\t\topts.call(job.jobId).catch((err) => {\n\t\t\tconsole.error(`cron: job \"${job.jobId}\" failed`, err);\n\t\t});\n\t}, parseEvery(job.every));\n}\n//#endregion\nexport { triggerContract as i, runScheduler as n, defineSchedule as r, cronScheduler as t };\n\n//# sourceMappingURL=scheduler-iL9rl3YY.mjs.map","import { i as triggerContract, n as runScheduler, r as defineSchedule, t as cronScheduler } from \"./scheduler-iL9rl3YY.mjs\";\nimport { serve } from \"@internal/rpc\";\nimport { module } from \"@internal/core\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/module.ts\n/**\n* `opts.runner` is a service exposing `{ trigger }`; the returned module\n* provisions it alongside the scheduler that fires `opts.schedule` at it. The\n* module's boundary deps mirror the runner's own deps, so the parent wires the\n* real work target through them, e.g.\n* `provision(cron({ schedule, runner }), { worker: worker.rpc })`. `opts.name`\n* sets the module name (default `'cron'`). Exposes nothing.\n*/\nfunction cron(opts) {\n\treturn module(opts.name ?? \"cron\", { deps: opts.runner.inputs }, ({ inputs, provision }) => {\n\t\tconst runner = provision(opts.runner, {\n\t\t\tid: \"runner\",\n\t\t\tdeps: inputs\n\t\t});\n\t\tprovision(cronScheduler(opts.schedule), {\n\t\t\tid: \"scheduler\",\n\t\t\tdeps: { trigger: runner.trigger }\n\t\t});\n\t\treturn {};\n\t});\n}\n//#endregion\n//#region src/serve-schedule.ts\nfunction serveSchedule(service, _schedule, handlers) {\n\tconst byId = blindCast(handlers);\n\tconst triggerHandler = async (input, deps) => {\n\t\tconst handler = byId[input.jobId];\n\t\tif (handler === void 0) throw new Error(`serveSchedule(): no handler for job id \"${input.jobId}\" — not in the schedule.`);\n\t\tawait handler(deps);\n\t\treturn { ok: true };\n\t};\n\treturn serve(service, blindCast({ trigger: { trigger: triggerHandler } }));\n}\n//#endregion\nexport { cron, cronScheduler, defineSchedule, runScheduler, serveSchedule, triggerContract };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AASmC,UAAU,OAAO,IAAI,mCAAmC,CAAC;;;;;;;AA0C5F,SAAS,aAAa,MAAM;CAC3B,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,MAAM,GAAG;EACzD,IAAI,OAAO,UAAU,YAAY,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