@prisma/composer-prisma-cloud 0.1.0-dev.1 → 0.1.0-dev.10
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/dist/control.d.mts +44 -4
- package/dist/control.mjs +155 -37
- package/dist/control.mjs.map +1 -1
- package/dist/cron/index.mjs +73 -8
- package/dist/cron/index.mjs.map +1 -1
- package/dist/cron/scheduler-entrypoint.mjs +158 -93
- package/dist/cron/scheduler-entrypoint.mjs.map +1 -1
- package/dist/cron/scheduler-service.mjs +73 -8
- package/dist/cron/scheduler-service.mjs.map +1 -1
- package/dist/index.d.mts +34 -15
- package/dist/index.mjs +4 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{prisma-next-COrwlg3N.mjs → prisma-next-qPB8_Az6.mjs} +2 -2
- package/dist/prisma-next-qPB8_Az6.mjs.map +1 -0
- package/dist/prisma-next.d.mts +1 -1
- package/dist/prisma-next.mjs +1 -1
- package/dist/{param-DB0B8m15-IvzNq9BM.mjs → provisioned-edges-DIQAR4q4-Bn9op-JG.mjs} +87 -28
- package/dist/provisioned-edges-DIQAR4q4-Bn9op-JG.mjs.map +1 -0
- package/dist/{serializer-DAEWRfnm-D3GW9dOZ.mjs → serializer-CX4VYdf_-KKGoAxfx.mjs} +29 -3
- package/dist/{serializer-DAEWRfnm-D3GW9dOZ.mjs.map → serializer-CX4VYdf_-KKGoAxfx.mjs.map} +1 -1
- package/dist/serializer-Cx5slrV4-xJfH6EWS.d.mts +36 -0
- package/dist/storage/index.d.mts +11 -11
- package/dist/storage/index.mjs +74 -8
- package/dist/storage/index.mjs.map +1 -1
- package/dist/storage/storage-entrypoint.mjs +7197 -12
- package/dist/storage/storage-entrypoint.mjs.map +1 -1
- package/dist/storage/storage-service.mjs +74 -8
- package/dist/storage/storage-service.mjs.map +1 -1
- package/dist/storage/testing.mjs.map +1 -1
- package/dist/streams/index.d.mts +224 -22
- package/dist/streams/index.mjs +3637 -37
- package/dist/streams/index.mjs.map +1 -1
- package/dist/streams/streams-entrypoint.mjs +7731 -221
- package/dist/streams/streams-entrypoint.mjs.map +1 -1
- package/dist/streams/streams-service.mjs +400 -21
- package/dist/streams/streams-service.mjs.map +1 -1
- package/dist/streams/testing.d.mts +1 -1
- package/dist/streams/testing.mjs.map +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +1 -1
- package/dist/testing.mjs.map +1 -1
- package/package.json +14 -14
- package/dist/param-DB0B8m15-IvzNq9BM.mjs.map +0 -1
- package/dist/prisma-next-COrwlg3N.mjs.map +0 -1
package/dist/streams/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Contract, DependencyEnd, ModuleNode
|
|
2
|
-
|
|
1
|
+
import { Contract, DependencyEnd, ModuleNode } from "@prisma/composer";
|
|
2
|
+
import "@standard-schema/spec";
|
|
3
|
+
//#region ../../1-prisma-cloud/2-shared-modules/storage/dist/index-BHsuudro.d.mts
|
|
3
4
|
//#region src/contract.d.ts
|
|
4
5
|
interface S3Config {
|
|
5
6
|
readonly url: string;
|
|
@@ -10,38 +11,239 @@ interface S3Config {
|
|
|
10
11
|
declare const s3Contract: Contract<'s3', S3Config>;
|
|
11
12
|
type S3Contract = typeof s3Contract;
|
|
12
13
|
//#endregion
|
|
13
|
-
//#region ../../1-prisma-cloud/2-shared-modules/streams/dist/
|
|
14
|
+
//#region ../../1-prisma-cloud/2-shared-modules/streams/dist/index-CyjEQsPk.d.mts
|
|
14
15
|
//#region src/contract.d.ts
|
|
15
16
|
interface StreamsConfig {
|
|
16
17
|
readonly url: string;
|
|
18
|
+
readonly apiKey: string;
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* One stream's declaration in a `streamsContract` def map. Untyped only in
|
|
22
|
+
* this slice — carries no event schema. Typed validation
|
|
23
|
+
* (`streamDef({ event })`) is a recorded follow-up slice; this shape is
|
|
24
|
+
* deliberately empty rather than half-carrying a schema parameter that does
|
|
25
|
+
* nothing.
|
|
26
|
+
*/
|
|
27
|
+
interface StreamDef {
|
|
28
|
+
readonly kind: 'stream-def';
|
|
29
|
+
}
|
|
30
|
+
/** Declares an untyped stream in a `streamsContract` def map. */
|
|
31
|
+
declare function streamDef(): StreamDef;
|
|
32
|
+
type StreamDefs = Record<string, StreamDef>;
|
|
33
|
+
/**
|
|
34
|
+
* Names the streams a contract transports, each with an optional def:
|
|
35
|
+
* `streamsContract({ jobs: streamDef(), audit: streamDef() })`. The
|
|
36
|
+
* `durableStreams(contract)` dependency built from it hydrates to one handle
|
|
37
|
+
* per declared name.
|
|
38
|
+
*/
|
|
39
|
+
declare function streamsContract<D extends StreamDefs>(defs: D): Contract<'streams', D>;
|
|
40
|
+
/** The type of a `streamsContract(defs)` value. */
|
|
41
|
+
type StreamsContract<D extends StreamDefs = StreamDefs> = Contract<'streams', D>;
|
|
42
|
+
/** The handles a `durableStreams(contract)` dependency hydrates to: one per declared stream name. */
|
|
43
|
+
type StreamHandles<D extends StreamDefs> = { readonly [K in keyof D]: StreamHandle; };
|
|
44
|
+
/**
|
|
45
|
+
* A consumer's dependency on a durable-streams server. Given a
|
|
46
|
+
* `streamsContract(defs)`, hydrates to one handle per declared stream name —
|
|
47
|
+
* the handle owns the name, so no call site names it again. Called with no
|
|
48
|
+
* argument, hydrates to a `StreamsClient` for dynamic stream names (e.g.
|
|
49
|
+
* per-tenant streams) — the `postgres()` parity: the same lifecycle
|
|
50
|
+
* ownership, the name is data rather than a wiring-time declaration.
|
|
51
|
+
*/
|
|
52
|
+
declare function durableStreams<D extends StreamDefs>(contract: Contract<'streams', D>): DependencyEnd<StreamHandles<D>, Contract<'streams', StreamDefs>>;
|
|
53
|
+
declare function durableStreams(): DependencyEnd<StreamsClient, Contract<'streams', StreamDefs>>;
|
|
22
54
|
//#endregion
|
|
23
|
-
//#region src/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
55
|
+
//#region src/client.d.ts
|
|
56
|
+
/** A catch-up read: the events from the requested offset, and the cursor to resume from. */
|
|
57
|
+
interface StreamsReadResult<T> {
|
|
58
|
+
readonly events: readonly T[];
|
|
59
|
+
/** Opaque resume cursor (the protocol's `stream-next-offset`); feed it back as `offset`. */
|
|
60
|
+
readonly nextOffset: string;
|
|
61
|
+
}
|
|
62
|
+
/** One live long-poll delivery, or a timeout with nothing new. */
|
|
63
|
+
interface StreamsTailResult<T> {
|
|
64
|
+
readonly events: readonly T[];
|
|
65
|
+
readonly nextOffset: string;
|
|
66
|
+
readonly timedOut: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The transport a consumer's `durableStreams()` binding hydrates to (bare
|
|
70
|
+
* form) — holds the base URL, the bearer header, and the per-stream write
|
|
71
|
+
* handles a batched append needs. `stream(name)` is the client's whole
|
|
72
|
+
* public surface: a dynamic streams consumer names a stream by calling it,
|
|
73
|
+
* never by any other method here.
|
|
74
|
+
*/
|
|
75
|
+
declare class StreamsClient {
|
|
76
|
+
private readonly base;
|
|
77
|
+
private readonly headers;
|
|
78
|
+
private readonly writers;
|
|
79
|
+
private readonly handles;
|
|
80
|
+
constructor(config: StreamsConfig);
|
|
81
|
+
/** One handle per stream name, memoized so its ensure-create state survives repeat calls. */
|
|
82
|
+
stream(name: string): StreamHandle;
|
|
83
|
+
private writer;
|
|
84
|
+
/** Creates the stream (idempotent: an existing stream of any content type is success). Used by `StreamHandle`'s ensure-create. */
|
|
85
|
+
create(name: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Appends one JSON event. NEVER retried beyond `StreamHandle`'s one-shot
|
|
88
|
+
* 404 heal: the protocol has no idempotency key, so a failed request is
|
|
89
|
+
* indistinguishable from one that applied — the caller retries, because
|
|
90
|
+
* only it knows whether a duplicate is acceptable.
|
|
91
|
+
*/
|
|
92
|
+
append(name: string, event: unknown): Promise<void>;
|
|
93
|
+
/** Reads the stream from `offset` (default: the beginning) to the current head. */
|
|
94
|
+
read<T = unknown>(name: string, opts?: {
|
|
95
|
+
offset?: string;
|
|
96
|
+
}): Promise<StreamsReadResult<T>>;
|
|
97
|
+
/**
|
|
98
|
+
* Waits for the next live delivery after `offset` (default: the current
|
|
99
|
+
* head), via long-poll — SSE cannot traverse the Compute ingress (PRO-218).
|
|
100
|
+
* Resolves with the delivered events, or `timedOut: true` after `timeoutMs`
|
|
101
|
+
* (default 20s) with nothing new.
|
|
102
|
+
*/
|
|
103
|
+
tail<T = unknown>(name: string, opts?: {
|
|
104
|
+
offset?: string;
|
|
105
|
+
timeoutMs?: number;
|
|
106
|
+
signal?: AbortSignal;
|
|
107
|
+
}): Promise<StreamsTailResult<T>>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* One stream's handle — the name and the ensure-create memo. Everything a
|
|
111
|
+
* `durableStreams(contract)` handle or a `durableStreams()` client's
|
|
112
|
+
* `stream(name)` result exposes; no call site passes a name again.
|
|
113
|
+
*
|
|
114
|
+
* Owns the lifecycle the app used to hand-roll: the first operation creates
|
|
115
|
+
* the stream (memoized here; upstream create is already ensure-style, so a
|
|
116
|
+
* racing second instance is harmless — using a stream is sufficient to
|
|
117
|
+
* create it), and a 404 on any operation heals by dropping the memo,
|
|
118
|
+
* re-creating, and retrying that operation once. A 404 is generated INSTEAD
|
|
119
|
+
* OF a write at every layer, so it proves nothing was applied — retrying
|
|
120
|
+
* once cannot duplicate an event, even an append. Ambiguous failures (socket
|
|
121
|
+
* closes, 502/504) never match `isStreamNotFound` and surface raw.
|
|
122
|
+
*/
|
|
123
|
+
declare class StreamHandle {
|
|
124
|
+
private readonly name;
|
|
125
|
+
private readonly transport;
|
|
126
|
+
private ensured;
|
|
127
|
+
constructor(name: string, transport: StreamsClient);
|
|
128
|
+
private ensureCreate;
|
|
129
|
+
private withHeal;
|
|
130
|
+
/**
|
|
131
|
+
* Appends one JSON event. NEVER retried beyond the one-shot 404 heal above:
|
|
132
|
+
* the protocol has no idempotency key, so a failed request is
|
|
133
|
+
* indistinguishable from one that applied — the caller retries, because
|
|
134
|
+
* only it knows whether a duplicate is acceptable.
|
|
135
|
+
*/
|
|
136
|
+
append(event: unknown): Promise<void>;
|
|
137
|
+
/** Reads the stream from `offset` (default: the beginning) to the current head. */
|
|
138
|
+
read<T = unknown>(opts?: {
|
|
139
|
+
offset?: string;
|
|
140
|
+
}): Promise<StreamsReadResult<T>>;
|
|
141
|
+
/**
|
|
142
|
+
* Waits for the next live delivery after `offset` (default: the current
|
|
143
|
+
* head), via long-poll. Resolves with the delivered events, or
|
|
144
|
+
* `timedOut: true` after `timeoutMs` (default 20s) with nothing new.
|
|
145
|
+
*/
|
|
146
|
+
tail<T = unknown>(opts?: {
|
|
147
|
+
offset?: string;
|
|
148
|
+
timeoutMs?: number;
|
|
149
|
+
signal?: AbortSignal;
|
|
150
|
+
}): Promise<StreamsTailResult<T>>;
|
|
151
|
+
}
|
|
33
152
|
//#endregion
|
|
34
|
-
//#region ../../1-prisma-cloud/2-shared-modules/streams/dist/index.d.mts
|
|
35
153
|
//#region src/streams-module.d.ts
|
|
36
154
|
declare function streams(opts?: {
|
|
37
155
|
name?: string;
|
|
38
156
|
}): ModuleNode<{
|
|
39
157
|
store: DependencyEnd<S3Config, S3Contract>;
|
|
40
158
|
}, {
|
|
41
|
-
streams:
|
|
159
|
+
streams: Contract<'streams', StreamDefs>;
|
|
160
|
+
}, Record<never, never>>;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region ../../../../node_modules/@standard-schema/spec/dist/index.d.ts
|
|
163
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
164
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
165
|
+
/** The Standard properties. */
|
|
166
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
167
|
+
}
|
|
168
|
+
declare namespace StandardTypedV1 {
|
|
169
|
+
/** The Standard Typed properties interface. */
|
|
170
|
+
interface Props<Input = unknown, Output = Input> {
|
|
171
|
+
/** The version number of the standard. */
|
|
172
|
+
readonly version: 1;
|
|
173
|
+
/** The vendor name of the schema library. */
|
|
174
|
+
readonly vendor: string;
|
|
175
|
+
/** Inferred types associated with the schema. */
|
|
176
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
177
|
+
}
|
|
178
|
+
/** The Standard Typed types interface. */
|
|
179
|
+
interface Types<Input = unknown, Output = Input> {
|
|
180
|
+
/** The input type of the schema. */
|
|
181
|
+
readonly input: Input;
|
|
182
|
+
/** The output type of the schema. */
|
|
183
|
+
readonly output: Output;
|
|
184
|
+
}
|
|
185
|
+
/** Infers the input type of a Standard Typed. */
|
|
186
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
187
|
+
/** Infers the output type of a Standard Typed. */
|
|
188
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
189
|
+
}
|
|
190
|
+
/** The Standard Schema interface. */
|
|
191
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
192
|
+
/** The Standard Schema properties. */
|
|
193
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
194
|
+
}
|
|
195
|
+
declare namespace StandardSchemaV1 {
|
|
196
|
+
/** The Standard Schema properties interface. */
|
|
197
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
198
|
+
/** Validates unknown input values. */
|
|
199
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
200
|
+
}
|
|
201
|
+
/** The result interface of the validate function. */
|
|
202
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
203
|
+
/** The result interface if validation succeeds. */
|
|
204
|
+
interface SuccessResult<Output> {
|
|
205
|
+
/** The typed output value. */
|
|
206
|
+
readonly value: Output;
|
|
207
|
+
/** A falsy value for `issues` indicates success. */
|
|
208
|
+
readonly issues?: undefined;
|
|
209
|
+
}
|
|
210
|
+
interface Options {
|
|
211
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
212
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
213
|
+
}
|
|
214
|
+
/** The result interface if validation fails. */
|
|
215
|
+
interface FailureResult {
|
|
216
|
+
/** The issues of failed validation. */
|
|
217
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
218
|
+
}
|
|
219
|
+
/** The issue interface of the failure output. */
|
|
220
|
+
interface Issue {
|
|
221
|
+
/** The error message of the issue. */
|
|
222
|
+
readonly message: string;
|
|
223
|
+
/** The path of the issue, if any. */
|
|
224
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
225
|
+
}
|
|
226
|
+
/** The path segment interface of the issue. */
|
|
227
|
+
interface PathSegment {
|
|
228
|
+
/** The key representing a path segment. */
|
|
229
|
+
readonly key: PropertyKey;
|
|
230
|
+
}
|
|
231
|
+
/** The Standard types interface. */
|
|
232
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
233
|
+
/** Infers the input type of a Standard. */
|
|
234
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
235
|
+
/** Infers the output type of a Standard. */
|
|
236
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/exports/streams-service.d.ts
|
|
240
|
+
declare function streamsService(): import("@prisma/composer").RunnableServiceNode<{
|
|
241
|
+
store: import("@prisma/composer").DependencyEnd<S3Config, import("@prisma/composer").Contract<"s3", S3Config>>;
|
|
242
|
+
}, Record<never, never> & {
|
|
243
|
+
readonly port: import("@prisma/composer").ConfigParam<StandardSchemaV1<number, number>>;
|
|
42
244
|
}, {
|
|
43
|
-
|
|
44
|
-
}
|
|
245
|
+
streams: import("@prisma/composer").Contract<"streams", StreamDefs>;
|
|
246
|
+
}, Record<never, never>>;
|
|
45
247
|
//#endregion
|
|
46
|
-
export { type StreamsConfig, type StreamsContract, durableStreams, streams, streamsContract, streamsService };
|
|
248
|
+
export { type StreamDef, type StreamDefs, StreamHandle, type StreamHandles, StreamsClient, type StreamsConfig, type StreamsContract, type StreamsReadResult, type StreamsTailResult, durableStreams, streamDef, streams, streamsContract, streamsService };
|
|
47
249
|
//# sourceMappingURL=index.d.mts.map
|