ignotum 0.0.7 → 0.0.9
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/README.md +89 -101
- package/dist/cli/bin.mjs +1119 -195
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/runtime/{api-DtX8qPrq.js → api-DzcR7spt.js} +36 -13
- package/dist/runtime/api-DzcR7spt.js.map +1 -0
- package/dist/runtime/{api-Dp4J-xt-.d.ts → api-jCl8Hzry.d.ts} +7 -9
- package/dist/runtime/client.d.ts +12 -5
- package/dist/runtime/client.js +285 -60
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/{descriptor-t6BOEGw9-C1rwYIlx.js → descriptor-C5VA9qRl-BKbdenuU.js} +38 -7
- package/dist/runtime/descriptor-C5VA9qRl-BKbdenuU.js.map +1 -0
- package/dist/runtime/file-C1abuMgd.js +173 -0
- package/dist/runtime/file-C1abuMgd.js.map +1 -0
- package/dist/runtime/{id-Btwac71X-DhnKYsjY.d.ts → id-Cs82tq9Q-Caqfx54f.d.ts} +51 -5
- package/dist/runtime/{index-B5KSOjGN.d.ts → index-D6VLTbDB.d.ts} +40 -21
- package/dist/runtime/internal/api.d.ts +2 -2
- package/dist/runtime/internal/api.js +1 -1
- package/dist/runtime/internal/host.d.ts +8 -7
- package/dist/runtime/internal/host.js +21 -10
- package/dist/runtime/internal/host.js.map +1 -1
- package/dist/runtime/internal/server.d.ts +1 -1
- package/dist/runtime/internal/server.js +1 -1
- package/dist/runtime/internal/types.d.ts +1 -1
- package/dist/runtime/internal/types.js +1 -1
- package/dist/runtime/{pagination-B1BzNkh8-BUSTbeSg.d.ts → pagination-Bt3l7QaC-D_zI5zsu.d.ts} +8 -4
- package/dist/runtime/pagination-DcIkTOFs.d.ts +1 -0
- package/dist/runtime/{schema-D9RmboaS.js → schema-B6PK_ZwV.js} +17 -3
- package/dist/runtime/schema-B6PK_ZwV.js.map +1 -0
- package/dist/runtime/server.d.ts +3 -3
- package/dist/runtime/server.js +2 -2
- package/dist/runtime/server.js.map +1 -1
- package/dist/runtime/sync-bMQq9tXx.d.ts +8 -0
- package/package.json +7 -5
- package/src/cli/agent-files.ts +52 -13
- package/src/cli/app-configuration.ts +4 -1
- package/src/cli/auth-client.ts +286 -0
- package/src/cli/build/server.ts +83 -6
- package/src/cli/command.ts +65 -2
- package/src/cli/control-client.ts +19 -6
- package/src/cli/new-app.ts +16 -0
- package/src/client/errors.ts +7 -10
- package/src/client/files.ts +153 -0
- package/src/client/hooks.ts +2 -15
- package/src/client/index.ts +7 -0
- package/src/client/sync.ts +158 -30
- package/src/dev-runtime/database.ts +69 -57
- package/src/dev-runtime/files.ts +337 -0
- package/src/dev-runtime/functions.ts +14 -6
- package/src/dev-runtime/migrations.ts +14 -0
- package/src/dev-runtime/sync.ts +134 -22
- package/src/internal/api.ts +16 -1
- package/src/server/index.ts +8 -1
- package/dist/runtime/api-DtX8qPrq.js.map +0 -1
- package/dist/runtime/descriptor-t6BOEGw9-C1rwYIlx.js.map +0 -1
- package/dist/runtime/id-D570vudg.js +0 -26
- package/dist/runtime/id-D570vudg.js.map +0 -1
- package/dist/runtime/pagination-BKPko9Hm.d.ts +0 -1
- package/dist/runtime/schema-D9RmboaS.js.map +0 -1
package/src/dev-runtime/sync.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
type ClientMessage,
|
|
20
20
|
type FunctionAddress,
|
|
21
21
|
type Operation,
|
|
22
|
-
type
|
|
22
|
+
type ErrorCode,
|
|
23
23
|
type ServerMessage,
|
|
24
24
|
type SubscriptionId,
|
|
25
25
|
} from "@ignotum/contracts/runtime/sync";
|
|
@@ -44,6 +44,15 @@ import { SqlClient, SqlError, SqlSchema } from "effect/unstable/sql";
|
|
|
44
44
|
import type * as Socket from "effect/unstable/socket/Socket";
|
|
45
45
|
import type { Plugin, ViteDevServer } from "vite";
|
|
46
46
|
import { FunctionRuntime, type PreparedFunction } from "@ignotum/runtime/functions";
|
|
47
|
+
import {
|
|
48
|
+
FileGrantToken,
|
|
49
|
+
FileUploadToken,
|
|
50
|
+
encodedFileOccurrencesOf,
|
|
51
|
+
fileLimits,
|
|
52
|
+
fileMimeTypes,
|
|
53
|
+
} from "@ignotum/contracts/schema/file";
|
|
54
|
+
import { fileGrantUrlPrefix, fileUploadUrlPrefix } from "@ignotum/contracts/runtime/transport";
|
|
55
|
+
import { collectStreamBytes } from "@ignotum/shared/http-body";
|
|
47
56
|
import {
|
|
48
57
|
makeDependencyIndex,
|
|
49
58
|
QueryInvalidation,
|
|
@@ -56,6 +65,7 @@ import { LocalDatabase } from "./database.js";
|
|
|
56
65
|
import { idGeneratorLayer } from "./id.js";
|
|
57
66
|
import { DevelopmentDatabase } from "./migrations.js";
|
|
58
67
|
import { FunctionExecutor, FunctionRegistry, functionRuntimeLayer } from "./functions.js";
|
|
68
|
+
import { LocalApplicationFiles, localApplicationFilesLayer } from "./files.js";
|
|
59
69
|
|
|
60
70
|
interface QuerySubscription {
|
|
61
71
|
readonly args: Schema.Json;
|
|
@@ -171,21 +181,18 @@ const operationForSubscription = (subscriptionId: SubscriptionId): Operation =>
|
|
|
171
181
|
id: subscriptionId,
|
|
172
182
|
});
|
|
173
183
|
|
|
174
|
-
const
|
|
175
|
-
code: ProtocolErrorCode,
|
|
176
|
-
message: string,
|
|
177
|
-
operation?: Operation,
|
|
178
|
-
): ServerMessage => {
|
|
184
|
+
const syncError = (code: ErrorCode, message: string, operation?: Operation): ServerMessage => {
|
|
179
185
|
if (operation === undefined) {
|
|
180
|
-
return { type: "
|
|
186
|
+
return { type: "Error", code, message };
|
|
181
187
|
}
|
|
182
|
-
return { type: "
|
|
188
|
+
return { type: "Error", code, message, operation };
|
|
183
189
|
};
|
|
184
190
|
|
|
185
191
|
export const runSession = Effect.fn("SyncServer.runSession")(function* (socket: Socket.Socket) {
|
|
186
192
|
const runtime = yield* FunctionRuntime;
|
|
187
193
|
const invalidation = yield* QueryInvalidation;
|
|
188
194
|
const mutationReplay = yield* MutationReplay;
|
|
195
|
+
const files = yield* LocalApplicationFiles;
|
|
189
196
|
const subscriptions = yield* Ref.make(HashMap.empty<SubscriptionId, QuerySubscription>());
|
|
190
197
|
const dependencyIndex = makeDependencyIndex<SubscriptionId>();
|
|
191
198
|
const invocationFibers = yield* FiberSet.make();
|
|
@@ -210,8 +217,8 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
210
217
|
message: ServerMessage,
|
|
211
218
|
) => Effect.Effect<void, Schema.SchemaError | Socket.SocketError> = send,
|
|
212
219
|
) => {
|
|
213
|
-
const code:
|
|
214
|
-
return deliver(
|
|
220
|
+
const code: ErrorCode = error._tag;
|
|
221
|
+
return deliver(syncError(code, error.message, operation));
|
|
215
222
|
};
|
|
216
223
|
|
|
217
224
|
const isActive = (subscriptionId: SubscriptionId, subscription: QuerySubscription) =>
|
|
@@ -268,12 +275,14 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
268
275
|
}
|
|
269
276
|
dependencyIndex.record(subscriptionId, result.dependencies);
|
|
270
277
|
if ((yield* invalidation.latestRevision) > result.observedRevision) continue;
|
|
271
|
-
yield*
|
|
278
|
+
const granted = yield* files.grants(subscriptionId, result.files ?? []);
|
|
279
|
+
const snapshot = {
|
|
272
280
|
type: "Snapshot",
|
|
273
281
|
id: subscriptionId,
|
|
274
282
|
result: result.result,
|
|
275
283
|
revision: result.observedRevision,
|
|
276
|
-
}
|
|
284
|
+
} as const;
|
|
285
|
+
yield* deliver(granted.length === 0 ? snapshot : { ...snapshot, files: granted });
|
|
277
286
|
return;
|
|
278
287
|
}
|
|
279
288
|
});
|
|
@@ -325,15 +334,17 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
325
334
|
message: Extract<ClientMessage, { readonly type: "Subscribe" }>,
|
|
326
335
|
) {
|
|
327
336
|
const operation = operationForSubscription(message.id);
|
|
337
|
+
if (encodedFileOccurrencesOf(message.args).length > 0) {
|
|
338
|
+
yield* send(
|
|
339
|
+
syncError("InvalidArguments", "Queries cannot take files as arguments.", operation),
|
|
340
|
+
);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
328
343
|
const current = yield* Ref.get(subscriptions);
|
|
329
344
|
|
|
330
345
|
if (HashMap.has(current, message.id)) {
|
|
331
346
|
yield* send(
|
|
332
|
-
|
|
333
|
-
"DuplicateOperationId",
|
|
334
|
-
`Subscription ${message.id} already exists.`,
|
|
335
|
-
operation,
|
|
336
|
-
),
|
|
347
|
+
syncError("DuplicateOperationId", `Subscription ${message.id} already exists.`, operation),
|
|
337
348
|
);
|
|
338
349
|
return;
|
|
339
350
|
}
|
|
@@ -365,6 +376,22 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
365
376
|
message: Extract<ClientMessage, { readonly type: "Invoke" }>,
|
|
366
377
|
) {
|
|
367
378
|
const operation: Operation = { type: "Invocation", id: message.id };
|
|
379
|
+
const admitted = yield* files.admit(message.id, message.function, message.args).pipe(
|
|
380
|
+
Effect.as(true),
|
|
381
|
+
Effect.catchCause((cause) =>
|
|
382
|
+
send(
|
|
383
|
+
syncError(
|
|
384
|
+
"InvalidArguments",
|
|
385
|
+
`The mutation files could not be admitted: ${String(cause)}`,
|
|
386
|
+
operation,
|
|
387
|
+
),
|
|
388
|
+
).pipe(Effect.as(false)),
|
|
389
|
+
),
|
|
390
|
+
);
|
|
391
|
+
if (!admitted) {
|
|
392
|
+
yield* files.releasePreparation(message.id);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
368
395
|
const prepared = yield* runtime.prepare(message.function, "Mutation", message.args).pipe(
|
|
369
396
|
Effect.catchTags({
|
|
370
397
|
FunctionUnavailable: (error) => sendResolutionError(operation, error),
|
|
@@ -375,6 +402,7 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
375
402
|
);
|
|
376
403
|
|
|
377
404
|
if (prepared === undefined) {
|
|
405
|
+
yield* files.releasePreparation(message.id);
|
|
378
406
|
return;
|
|
379
407
|
}
|
|
380
408
|
|
|
@@ -418,13 +446,14 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
418
446
|
Effect.catchTags({
|
|
419
447
|
InvocationIdConflict: () =>
|
|
420
448
|
send(
|
|
421
|
-
|
|
449
|
+
syncError(
|
|
422
450
|
"InvocationIdConflict",
|
|
423
451
|
`Invocation ${message.id} was already used with different inputs.`,
|
|
424
452
|
operation,
|
|
425
453
|
),
|
|
426
454
|
),
|
|
427
455
|
}),
|
|
456
|
+
Effect.ensuring(files.releasePreparation(message.id)),
|
|
428
457
|
Effect.catchCause((cause) =>
|
|
429
458
|
Effect.logError("A mutation invocation fiber failed.").pipe(
|
|
430
459
|
Effect.annotateLogs({ cause, function: message.function, requestId: message.id }),
|
|
@@ -435,10 +464,30 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
435
464
|
);
|
|
436
465
|
});
|
|
437
466
|
|
|
467
|
+
const handlePrepare = Effect.fn("SyncServer.handlePrepare")(function* (
|
|
468
|
+
message: Extract<ClientMessage, { readonly type: "Prepare" }>,
|
|
469
|
+
) {
|
|
470
|
+
const operation: Operation = { type: "Invocation", id: message.id };
|
|
471
|
+
yield* files.prepare(message.id, message.function, message.args, message.files).pipe(
|
|
472
|
+
Effect.flatMap((uploads) =>
|
|
473
|
+
send({ type: "Preparation", id: message.id, kind: message.kind, uploads }),
|
|
474
|
+
),
|
|
475
|
+
Effect.catchCause((cause) =>
|
|
476
|
+
send(
|
|
477
|
+
syncError(
|
|
478
|
+
"InvalidArguments",
|
|
479
|
+
`The mutation files could not be prepared: ${String(cause)}`,
|
|
480
|
+
operation,
|
|
481
|
+
),
|
|
482
|
+
),
|
|
483
|
+
),
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
|
|
438
487
|
const handleMessage = Effect.fn("SyncServer.handleMessage")(function* (text: string) {
|
|
439
488
|
const message = yield* Schema.decodeEffect(ClientMessageJson)(text).pipe(
|
|
440
489
|
Effect.catch(() =>
|
|
441
|
-
send(
|
|
490
|
+
send(syncError("InvalidMessage", "The WebSocket frame is not valid Ignotum JSON.")),
|
|
442
491
|
),
|
|
443
492
|
);
|
|
444
493
|
|
|
@@ -453,6 +502,10 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
453
502
|
case "Unsubscribe":
|
|
454
503
|
dependencyIndex.remove(message.id);
|
|
455
504
|
yield* Ref.update(subscriptions, HashMap.remove(message.id));
|
|
505
|
+
yield* files.releaseGrants(message.id);
|
|
506
|
+
return;
|
|
507
|
+
case "Prepare":
|
|
508
|
+
yield* handlePrepare(message);
|
|
456
509
|
return;
|
|
457
510
|
case "Invoke":
|
|
458
511
|
yield* handleInvoke(message);
|
|
@@ -460,9 +513,22 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
460
513
|
}
|
|
461
514
|
});
|
|
462
515
|
|
|
463
|
-
yield* socket
|
|
464
|
-
|
|
465
|
-
|
|
516
|
+
yield* socket
|
|
517
|
+
.runString((text) => messageSemaphore.withPermits(1)(handleMessage(text)), {
|
|
518
|
+
onOpen: send({ type: "Handshake", ...localSyncIdentity }).pipe(Effect.orDie),
|
|
519
|
+
})
|
|
520
|
+
.pipe(
|
|
521
|
+
Effect.ensuring(
|
|
522
|
+
Ref.get(subscriptions).pipe(
|
|
523
|
+
Effect.flatMap((active) =>
|
|
524
|
+
Effect.forEach(HashMap.keys(active), (subscriptionId) =>
|
|
525
|
+
files.releaseGrants(subscriptionId),
|
|
526
|
+
),
|
|
527
|
+
),
|
|
528
|
+
Effect.asVoid,
|
|
529
|
+
),
|
|
530
|
+
),
|
|
531
|
+
);
|
|
466
532
|
});
|
|
467
533
|
|
|
468
534
|
interface SyncHandlersService {
|
|
@@ -500,6 +566,10 @@ const makeHandlersLayer = (server: ViteDevServer, appDirectory: string, database
|
|
|
500
566
|
queryInvalidationLayer,
|
|
501
567
|
persistenceLayer,
|
|
502
568
|
NodeServices.layer,
|
|
569
|
+
localApplicationFilesLayer(appDirectory).pipe(
|
|
570
|
+
Layer.provideMerge(DevelopmentDatabase.layer),
|
|
571
|
+
Layer.provide(Layer.mergeAll(idGeneratorLayer, sqliteLayer, NodeServices.layer)),
|
|
572
|
+
),
|
|
503
573
|
);
|
|
504
574
|
|
|
505
575
|
return Layer.effect(
|
|
@@ -522,6 +592,48 @@ const makeHandlersLayer = (server: ViteDevServer, appDirectory: string, database
|
|
|
522
592
|
const httpApp = Effect.gen(function* () {
|
|
523
593
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
524
594
|
const pathname = new URL(request.url, "http://ignotum.local").pathname;
|
|
595
|
+
if (pathname.startsWith(fileUploadUrlPrefix)) {
|
|
596
|
+
if (request.method !== "PUT")
|
|
597
|
+
return HttpServerResponse.text("Method Not Allowed", { status: 405 });
|
|
598
|
+
const token = Schema.decodeOption(FileUploadToken)(
|
|
599
|
+
pathname.slice(fileUploadUrlPrefix.length),
|
|
600
|
+
);
|
|
601
|
+
if (Option.isNone(token)) return HttpServerResponse.text("Not Found", { status: 404 });
|
|
602
|
+
const bytes = yield* collectStreamBytes(
|
|
603
|
+
request.stream,
|
|
604
|
+
fileLimits.fileBytes,
|
|
605
|
+
() => new Error("The local application file is too large."),
|
|
606
|
+
).pipe(Effect.orDie);
|
|
607
|
+
return yield* LocalApplicationFiles.pipe(
|
|
608
|
+
Effect.flatMap((storage) => storage.upload(token.value, bytes)),
|
|
609
|
+
Effect.match({
|
|
610
|
+
onFailure: (error) => HttpServerResponse.text(String(error), { status: 422 }),
|
|
611
|
+
onSuccess: () => HttpServerResponse.text("Stored", { status: 201 }),
|
|
612
|
+
}),
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
if (pathname.startsWith(fileGrantUrlPrefix)) {
|
|
616
|
+
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
617
|
+
return HttpServerResponse.text("Method Not Allowed", { status: 405 });
|
|
618
|
+
}
|
|
619
|
+
const token = Schema.decodeOption(FileGrantToken)(
|
|
620
|
+
pathname.slice(fileGrantUrlPrefix.length),
|
|
621
|
+
);
|
|
622
|
+
if (Option.isNone(token)) return HttpServerResponse.text("Not Found", { status: 404 });
|
|
623
|
+
const granted = yield* LocalApplicationFiles.pipe(
|
|
624
|
+
Effect.flatMap((storage) => storage.readGrant(token.value)),
|
|
625
|
+
);
|
|
626
|
+
if (Option.isNone(granted)) return HttpServerResponse.text("Not Found", { status: 404 });
|
|
627
|
+
const headers = {
|
|
628
|
+
"cache-control": "private, no-store",
|
|
629
|
+
"content-length": String(granted.value.bytes.byteLength),
|
|
630
|
+
"content-type": fileMimeTypes[granted.value.file.format],
|
|
631
|
+
"x-content-type-options": "nosniff",
|
|
632
|
+
};
|
|
633
|
+
return request.method === "HEAD"
|
|
634
|
+
? HttpServerResponse.empty({ headers })
|
|
635
|
+
: HttpServerResponse.uint8Array(granted.value.bytes, { headers });
|
|
636
|
+
}
|
|
525
637
|
return yield* HttpServerResponse.json(
|
|
526
638
|
pathname === syncPath
|
|
527
639
|
? { code: "UpgradeRequired", message: `Connect to ${syncPath} with WebSocket.` }
|
package/src/internal/api.ts
CHANGED
|
@@ -3,12 +3,23 @@ import type { Effect } from "effect";
|
|
|
3
3
|
|
|
4
4
|
import type { ErrorValue, InternalServerError } from "@ignotum/contracts/runtime/result";
|
|
5
5
|
import { FunctionAddress } from "@ignotum/contracts/runtime/sync";
|
|
6
|
+
import type { FileValue } from "@ignotum/contracts/schema/file";
|
|
6
7
|
|
|
7
8
|
const FunctionReferenceTypeId: unique symbol = Symbol.for("ignotum/internal/api/FunctionReference");
|
|
8
9
|
declare const FunctionReferenceTypesTypeId: unique symbol;
|
|
9
10
|
|
|
10
11
|
type FunctionKind = "Mutation" | "Query";
|
|
11
12
|
|
|
13
|
+
export type MutationInput<Value> = Value extends FileValue
|
|
14
|
+
? Value | File
|
|
15
|
+
: Value extends Date
|
|
16
|
+
? Value
|
|
17
|
+
: Value extends ReadonlyArray<infer Item>
|
|
18
|
+
? ReadonlyArray<MutationInput<Item>>
|
|
19
|
+
: Value extends object
|
|
20
|
+
? { readonly [Key in keyof Value]: MutationInput<Value[Key]> }
|
|
21
|
+
: Value;
|
|
22
|
+
|
|
12
23
|
export interface FunctionReference<
|
|
13
24
|
Kind extends FunctionKind,
|
|
14
25
|
Args,
|
|
@@ -58,7 +69,11 @@ type ReferenceOf<Definition> = Definition extends {
|
|
|
58
69
|
? HandlerArguments extends readonly [infer _Context, ...infer Rest]
|
|
59
70
|
? FunctionReference<
|
|
60
71
|
Kind,
|
|
61
|
-
Rest extends readonly [infer Args, ...ReadonlyArray<unknown>]
|
|
72
|
+
Rest extends readonly [infer Args, ...ReadonlyArray<unknown>]
|
|
73
|
+
? Kind extends "Mutation"
|
|
74
|
+
? MutationInput<Args>
|
|
75
|
+
: Args
|
|
76
|
+
: void,
|
|
62
77
|
Success,
|
|
63
78
|
| (Yielded extends Effect.Effect<unknown, infer Failure extends ErrorValue, never>
|
|
64
79
|
? Failure
|
package/src/server/index.ts
CHANGED
|
@@ -5,4 +5,11 @@ import { defineSchema as defineContractSchema } from "@ignotum/contracts/schema"
|
|
|
5
5
|
export const Result: typeof contractResult = contractResult;
|
|
6
6
|
export type Result<Success, Failure extends ErrorValue> = ContractResult<Success, Failure>;
|
|
7
7
|
export const defineSchema: typeof defineContractSchema = defineContractSchema;
|
|
8
|
-
export type {
|
|
8
|
+
export type {
|
|
9
|
+
DefinedSchema,
|
|
10
|
+
FileFormat,
|
|
11
|
+
FileMetadata,
|
|
12
|
+
FileMimeType,
|
|
13
|
+
FileValue,
|
|
14
|
+
SchemaAuthoring,
|
|
15
|
+
} from "@ignotum/contracts/schema";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-DtX8qPrq.js","names":[],"sources":["../../../contracts/dist/runtime/identity.js","../../../contracts/dist/runtime/sync.js","../../src/internal/api.ts"],"sourcesContent":["import { AppId, ConnectionId, DeploymentId, DevDatabaseLockId, InvocationId, PlatformPrincipalId, RequestId, RuntimeRequestNonce, SubscriptionId, TableId, TeamId } from \"./id.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/identity.ts\nconst InvocationKey = Schema.String.pipe(Schema.brand(\"ignotum/hosted/InvocationKey\"));\nconst DeploymentGeneration = Schema.Natural.pipe(Schema.brand(\"ignotum/hosted/DeploymentGeneration\"));\nconst AppStateRevision = Schema.Natural.pipe(Schema.brand(\"ignotum/hosted/AppStateRevision\"));\n//#endregion\nexport { AppId, AppStateRevision, ConnectionId, DeploymentGeneration, DeploymentId, DevDatabaseLockId, InvocationId, InvocationKey, PlatformPrincipalId, RequestId, RuntimeRequestNonce, SubscriptionId, TableId, TeamId };\n\n//# sourceMappingURL=identity.js.map","import { AppId, DeploymentId, InvocationId, SubscriptionId } from \"./id.js\";\nimport { AppStateRevision, DeploymentGeneration } from \"./identity.js\";\nimport { TransportValueSchema, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue } from \"./value.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/sync.ts\nconst FunctionNamePart = Schema.String.check(Schema.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]*$/));\nconst ApiFunctionAddressParts = Schema.TemplateLiteralParser([\n\t\"api.\",\n\tFunctionNamePart,\n\t\".\",\n\tFunctionNamePart\n]);\nconst FunctionAddress = Schema.TemplateLiteral([\n\t\"api.\",\n\tFunctionNamePart,\n\t\".\",\n\tFunctionNamePart\n]);\nconst apiFunctionParts = (address) => {\n\tconst [, moduleName, , functionName] = Schema.decodeSync(ApiFunctionAddressParts)(address);\n\treturn {\n\t\tfunctionName,\n\t\tmoduleName\n\t};\n};\nconst Subscribe = Schema.Struct({\n\ttype: Schema.Literal(\"Subscribe\"),\n\tid: SubscriptionId,\n\tfunction: FunctionAddress,\n\targs: Schema.Json\n});\nconst Unsubscribe = Schema.Struct({\n\ttype: Schema.Literal(\"Unsubscribe\"),\n\tid: SubscriptionId\n});\nconst Invoke = Schema.Struct({\n\ttype: Schema.Literal(\"Invoke\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tfunction: FunctionAddress,\n\targs: Schema.Json\n});\nconst ClientMessage = Schema.Union([\n\tSubscribe,\n\tUnsubscribe,\n\tInvoke\n]);\nconst SubscriptionOperation = Schema.Struct({\n\ttype: Schema.Literal(\"Subscription\"),\n\tid: SubscriptionId\n});\nconst InvocationOperation = Schema.Struct({\n\ttype: Schema.Literal(\"Invocation\"),\n\tid: InvocationId\n});\nconst Operation = Schema.Union([SubscriptionOperation, InvocationOperation]);\nconst DatePath = Schema.Array(Schema.Union([Schema.String, Schema.Natural]));\nconst DatePaths = Schema.Array(DatePath);\nconst WireSuccess = Schema.Struct({\n\ttype: Schema.Literal(\"Success\"),\n\tvalue: Schema.optional(Schema.Json),\n\tdates: Schema.optional(DatePaths)\n});\nconst WireFailure = Schema.Struct({\n\ttype: Schema.Literal(\"Failure\"),\n\terror: Schema.Json,\n\tdates: Schema.optional(DatePaths)\n});\nconst WireResult = Schema.Union([WireSuccess, WireFailure]);\nconst SyncHandshake = Schema.Struct({\n\ttype: Schema.Literal(\"Handshake\"),\n\tappId: AppId,\n\tdeploymentId: DeploymentId,\n\tgeneration: DeploymentGeneration\n});\nconst Snapshot = Schema.Struct({\n\ttype: Schema.Literal(\"Snapshot\"),\n\tid: SubscriptionId,\n\tresult: WireResult,\n\trevision: AppStateRevision\n});\nconst SyncResultSuccess = Schema.Struct({\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireSuccess,\n\tcommittedRevision: AppStateRevision\n});\nconst SyncResultFailure = Schema.Struct({\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireFailure\n});\nconst ProtocolErrorCode = Schema.Literals([\n\t\"DuplicateOperationId\",\n\t\"FunctionUnavailable\",\n\t\"InvalidArguments\",\n\t\"InvalidMessage\",\n\t\"InvocationIdConflict\",\n\t\"ResourceLimitExceeded\",\n\t\"UnknownFunction\",\n\t\"WrongFunctionKind\"\n]);\nconst ProtocolError = Schema.Struct({\n\ttype: Schema.Literal(\"ProtocolError\"),\n\toperation: Schema.optional(Operation),\n\tcode: ProtocolErrorCode,\n\tmessage: Schema.String\n});\nconst DeploymentChanged = Schema.Struct({\n\ttype: Schema.Literal(\"DeploymentChanged\"),\n\tdeploymentId: DeploymentId,\n\tgeneration: DeploymentGeneration\n});\nconst DeploymentChangedCloseCode = 4409;\nconst ServerMessage = Schema.Union([\n\tSyncHandshake,\n\tSnapshot,\n\tSyncResultSuccess,\n\tSyncResultFailure,\n\tProtocolError,\n\tDeploymentChanged\n]);\nconst ClientMessageJson = Schema.fromJsonString(ClientMessage);\nconst ServerMessageJson = Schema.fromJsonString(ServerMessage);\n//#endregion\nexport { ClientMessage, ClientMessageJson, DatePath, DeploymentChanged, DeploymentChangedCloseCode, FunctionAddress, FunctionNamePart, InvocationId, Operation, ProtocolErrorCode, ServerMessage, ServerMessageJson, SubscriptionId, SyncHandshake, TransportValueSchema, WireFailure, WireResult, WireSuccess, apiFunctionParts, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue };\n\n//# sourceMappingURL=sync.js.map","import { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport type { ErrorValue, InternalServerError } from \"@ignotum/contracts/runtime/result\";\nimport { FunctionAddress } from \"@ignotum/contracts/runtime/sync\";\n\nconst FunctionReferenceTypeId: unique symbol = Symbol.for(\"ignotum/internal/api/FunctionReference\");\ndeclare const FunctionReferenceTypesTypeId: unique symbol;\n\ntype FunctionKind = \"Mutation\" | \"Query\";\n\nexport interface FunctionReference<\n Kind extends FunctionKind,\n Args,\n Success,\n Failure extends ErrorValue,\n> {\n readonly [FunctionReferenceTypeId]: FunctionAddress;\n readonly [FunctionReferenceTypesTypeId]?: {\n readonly kind: Kind;\n readonly args: Args;\n readonly value: Success;\n readonly error: Failure;\n };\n}\n\ntype ReferenceTypes<Reference> = Reference extends {\n readonly [FunctionReferenceTypesTypeId]?: infer Types;\n}\n ? Exclude<Types, undefined>\n : never;\n\nexport declare namespace FunctionReference {\n type Args<Reference> =\n ReferenceTypes<Reference> extends { readonly args: infer Args } ? Args : never;\n type Failure<Reference> =\n ReferenceTypes<Reference> extends {\n readonly error: infer Failure;\n }\n ? Failure\n : never;\n type Kind<Reference> =\n ReferenceTypes<Reference> extends { readonly kind: infer Kind } ? Kind : never;\n type Success<Reference> =\n ReferenceTypes<Reference> extends {\n readonly value: infer Success;\n }\n ? Success\n : never;\n}\n\ntype ReferenceOf<Definition> = Definition extends {\n readonly _tag: infer Kind extends FunctionKind;\n readonly handler: (\n ...arguments_: infer HandlerArguments\n ) => Generator<infer Yielded, infer Success, never>;\n}\n ? HandlerArguments extends readonly [infer _Context, ...infer Rest]\n ? FunctionReference<\n Kind,\n Rest extends readonly [infer Args, ...ReadonlyArray<unknown>] ? Args : void,\n Success,\n | (Yielded extends Effect.Effect<unknown, infer Failure extends ErrorValue, never>\n ? Failure\n : never)\n | InternalServerError\n >\n : never\n : never;\n\ntype ApiModule<Module> = {\n readonly [FunctionName in keyof Module as FunctionName extends string\n ? ReferenceOf<Module[FunctionName]> extends never\n ? never\n : FunctionName\n : never]: ReferenceOf<Module[FunctionName]>;\n};\n\nexport type Api<Modules> = {\n readonly [ModuleName in keyof Modules]: ApiModule<Modules[ModuleName]>;\n};\n\nexport const functionPathOf = <\n Kind extends FunctionKind,\n Args,\n Success,\n Failure extends ErrorValue,\n>(\n reference: FunctionReference<Kind, Args, Success, Failure>,\n) => reference[FunctionReferenceTypeId];\n\nconst makeModuleReference = (moduleName: string) => {\n const references = new Map<string, object>();\n\n return new Proxy(\n {},\n {\n get: (_target, functionName) => {\n if (!Predicate.isString(functionName)) {\n return undefined;\n }\n\n const existing = references.get(functionName);\n if (existing !== undefined) {\n return existing;\n }\n\n const reference = {\n [FunctionReferenceTypeId]: FunctionAddress.make(`api.${moduleName}.${functionName}`),\n };\n references.set(functionName, reference);\n return reference;\n },\n },\n );\n};\n\nexport function createApi<Modules>(): Api<Modules>;\nexport function createApi() {\n const modules = new Map<string, object>();\n\n return new Proxy(\n {},\n {\n get: (_target, moduleName) => {\n if (!Predicate.isString(moduleName)) {\n return undefined;\n }\n\n const existing = modules.get(moduleName);\n if (existing !== undefined) {\n return existing;\n }\n\n const moduleReference = makeModuleReference(moduleName);\n modules.set(moduleName, moduleReference);\n return moduleReference;\n },\n },\n );\n}\n"],"mappings":";;;AAGA,MAAM,gBAAgB,OAAO,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AACrF,MAAM,uBAAuB,OAAO,QAAQ,KAAK,OAAO,MAAM,qCAAqC,CAAC;AACpG,MAAM,mBAAmB,OAAO,QAAQ,KAAK,OAAO,MAAM,iCAAiC,CAAC;;;ACA5F,MAAM,mBAAmB,OAAO,OAAO,MAAM,OAAO,UAAU,4BAA4B,CAAC;AAC3D,OAAO,sBAAsB;CAC5D;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,kBAAkB,OAAO,gBAAgB;CAC9C;CACA;CACA;CACA;AACD,CAAC;AAQD,MAAM,YAAY,OAAO,OAAO;CAC/B,MAAM,OAAO,QAAQ,WAAW;CAChC,IAAI;CACJ,UAAU;CACV,MAAM,OAAO;AACd,CAAC;AACD,MAAM,cAAc,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,aAAa;CAClC,IAAI;AACL,CAAC;AACD,MAAM,SAAS,OAAO,OAAO;CAC5B,MAAM,OAAO,QAAQ,QAAQ;CAC7B,IAAI;CACJ,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU;CACV,MAAM,OAAO;AACd,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CAClC;CACA;CACA;AACD,CAAC;AACD,MAAM,wBAAwB,OAAO,OAAO;CAC3C,MAAM,OAAO,QAAQ,cAAc;CACnC,IAAI;AACL,CAAC;AACD,MAAM,sBAAsB,OAAO,OAAO;CACzC,MAAM,OAAO,Q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QAAQ,mBAAmB;CACxC,cAAc;CACd,YAAY;AACb,CAAC;AACD,MAAM,6BAA6B;AACnC,MAAM,gBAAgB,OAAO,MAAM;CAClC;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,oBAAoB,OAAO,eAAe,aAAa;AAC7D,MAAM,oBAAoB,OAAO,eAAe,aAAa;;;ACrH7D,MAAM,0BAAyC,OAAO,IAAI,wCAAwC;AA4ElG,MAAa,kBAMX,cACG,UAAU;AAEf,MAAM,uBAAuB,eAAuB;CAClD,MAAM,6BAAa,IAAI,IAAoB;CAE3C,OAAO,IAAI,MACT,CAAC,GACD,EACE,MAAM,SAAS,iBAAiB;EAC9B,IAAI,CAAC,UAAU,SAAS,YAAY,GAClC;EAGF,MAAM,WAAW,WAAW,IAAI,YAAY;EAC5C,IAAI,aAAa,KAAA,GACf,OAAO;EAGT,MAAM,YAAY,GACf,0BAA0B,gBAAgB,KAAK,OAAO,WAAW,GAAG,cAAc,EACrF;EACA,WAAW,IAAI,cAAc,SAAS;EACtC,OAAO;CACT,EACF,CACF;AACF;AAGA,SAAgB,YAAY;CAC1B,MAAM,0BAAU,IAAI,IAAoB;CAExC,OAAO,IAAI,MACT,CAAC,GACD,EACE,MAAM,SAAS,eAAe;EAC5B,IAAI,CAAC,UAAU,SAAS,UAAU,GAChC;EAGF,MAAM,WAAW,QAAQ,IAAI,UAAU;EACvC,IAAI,aAAa,KAAA,GACf,OAAO;EAGT,MAAM,kBAAkB,oBAAoB,UAAU;EACtD,QAAQ,IAAI,YAAY,eAAe;EACvC,OAAO;CACT,EACF,CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-t6BOEGw9-C1rwYIlx.js","names":[],"sources":["../../../contracts/dist/runtime/value.js","../../../contracts/dist/runtime/result.js","../../../contracts/dist/runtime/pagination.js","../../../contracts/dist/descriptor-t6BOEGw9.js"],"sourcesContent":["import { Predicate, Schema } from \"effect\";\n//#region src/runtime/value.ts\nconst TransportValueSchema = Schema.suspend(() => Schema.Union([\n\tSchema.Null,\n\tSchema.Boolean,\n\tSchema.Finite,\n\tSchema.String,\n\tSchema.Date,\n\tSchema.Array(TransportValueSchema),\n\tSchema.Record(Schema.String, Schema.UndefinedOr(TransportValueSchema))\n]));\nconst encodeTransportValue = (value) => {\n\tif (Predicate.isDate(value)) return Schema.encodeSync(Schema.DateFromMillis)(value);\n\tif (globalThis.Array.isArray(value)) return value.map(encodeTransportValue);\n\tif (Predicate.isNumber(value)) return Schema.decodeSync(Schema.Finite)(value);\n\tif (Predicate.isNull(value) || Predicate.isString(value) || Predicate.isBoolean(value)) return value;\n\treturn Object.fromEntries(Object.entries(value).flatMap(([key, child]) => child === void 0 ? [] : [[key, encodeTransportValue(child)]]));\n};\nconst encodeTransportObject = (value) => Schema.decodeUnknownSync(Schema.JsonObject)(encodeTransportValue(Schema.decodeUnknownSync(TransportValueSchema)(value)));\nconst collectDatePaths = (value, path, paths) => {\n\tif (Predicate.isDate(value)) {\n\t\tSchema.decodeSync(Schema.Date)(value);\n\t\tpaths.push(path);\n\t\treturn;\n\t}\n\tif (globalThis.Array.isArray(value)) {\n\t\tfor (const [index, child] of value.entries()) collectDatePaths(child, [...path, index], paths);\n\t\treturn;\n\t}\n\tif (value === void 0 || Predicate.isNull(value) || Predicate.isString(value) || Predicate.isNumber(value) || Predicate.isBoolean(value)) return;\n\tfor (const [key, child] of Object.entries(value)) collectDatePaths(child, [...path, key], paths);\n};\nconst datePathsOf = (value) => {\n\tconst paths = [];\n\tcollectDatePaths(value, [], paths);\n\treturn paths;\n};\nconst datePathsOfObject = (value) => datePathsOf(Schema.decodeUnknownSync(TransportValueSchema)(value));\nconst pathKey = (path) => JSON.stringify(path);\nconst decodeTransportValueAt = (value, path, encodedDatePaths) => {\n\tif (encodedDatePaths.has(pathKey(path))) return Schema.decodeUnknownSync(Schema.DateFromMillis)(value);\n\tif (globalThis.Array.isArray(value)) return value.map((item, index) => decodeTransportValueAt(item, [...path, index], encodedDatePaths));\n\tif (Predicate.isNull(value) || Predicate.isString(value) || Predicate.isNumber(value) || Predicate.isBoolean(value)) return value;\n\treturn Object.fromEntries(Object.entries(value).map(([key, item]) => [key, decodeTransportValueAt(item, [...path, key], encodedDatePaths)]));\n};\nconst decodeTransportValue = (value, datePaths) => decodeTransportValueAt(value, [], new Set(datePaths.map(pathKey)));\nconst decodeTransportObject = (value, datePaths) => {\n\tconst encodedDatePaths = new Set(datePaths.map(pathKey));\n\treturn Object.fromEntries(Object.entries(value).map(([key, child]) => [key, decodeTransportValueAt(child, [key], encodedDatePaths)]));\n};\n//#endregion\nexport { TransportValueSchema, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue };\n\n//# sourceMappingURL=value.js.map","import { RequestId } from \"./id.js\";\nimport { decodeTransportObject } from \"./value.js\";\nimport { Brand, Effect, Effectable, Function, Option, Predicate, Schema } from \"effect\";\n//#region src/runtime/result.ts\nconst ResultTypeId = Symbol.for(\"ignotum/runtime/result/Result\");\nconst CompletedResultTypeId = Symbol.for(\"ignotum/runtime/result/Completed\");\nconst PendingResultTypeId = Symbol.for(\"ignotum/runtime/result/Pending\");\nconst ErrorBrand = \"ignotum/error\";\nconst makeErrorValue = Brand.nominal();\nconst ErrorValueSchema = Schema.StructWithRest(Schema.Struct({ _tag: Schema.String }), [Schema.Record(Schema.String, Schema.Json)]).pipe(Schema.brand(ErrorBrand));\nvar InternalServerErrorCause = class extends Schema.TaggedError()(\"InternalServerError\", { requestId: RequestId }) {};\nconst InternalServerError = InternalServerErrorCause;\nconst InternalServerErrorSchema = InternalServerErrorCause.pipe(Schema.brand(ErrorBrand));\nconst effectOf = (value) => Predicate.hasProperty(value, ResultTypeId) ? value[ResultTypeId] : Effect.succeed(value);\nfunction makeResultEffectBase() {\n\tconst Base = function() {};\n\tBase.prototype = Effectable.Prototype({\n\t\tlabel: \"IgnotumResult\",\n\t\tevaluate() {\n\t\t\treturn this[ResultTypeId];\n\t\t}\n\t});\n\treturn Base;\n}\nconst ResultEffectBase = makeResultEffectBase();\nvar ResultOperation = class ResultOperation extends ResultEffectBase {\n\t[ResultTypeId];\n\tconstructor(effect, completed) {\n\t\tsuper();\n\t\tthis[ResultTypeId] = effect;\n\t\tif (completed !== void 0) Object.defineProperty(this, CompletedResultTypeId, { value: completed });\n\t}\n\tcatch(cases) {\n\t\tconst effectCases = {};\n\t\tfor (const [tag, handler] of Object.entries(cases)) if (Predicate.isFunction(handler)) effectCases[tag] = (failure) => effectOf(handler(failure));\n\t\tconst runtimeEffect = this[ResultTypeId];\n\t\tconst caught = Effect.catchTags(runtimeEffect, effectCases);\n\t\treturn new ResultOperation(caught);\n\t}\n};\nvar PendingQueryResult = class {\n\t[PendingResultTypeId] = PendingResultTypeId;\n};\nconst inspectResult = (value) => {\n\tif (!Predicate.hasProperty(value, CompletedResultTypeId)) return void 0;\n\treturn value[CompletedResultTypeId];\n};\nconst effectFromResult = (result) => result[ResultTypeId];\nconst resultFromEffect = (effect) => new ResultOperation(effect);\nconst isFailureResult = (result) => Predicate.hasProperty(result, CompletedResultTypeId) && Predicate.isObject(result[CompletedResultTypeId]) && Predicate.hasProperty(result[CompletedResultTypeId], \"type\") && result[CompletedResultTypeId].type === \"Failure\";\nconst succeed = (value) => new ResultOperation(Effect.succeed(value), {\n\ttype: \"Success\",\n\tvalue\n});\nconst fail = (error) => new ResultOperation(Effect.fail(error), {\n\ttype: \"Failure\",\n\terror\n});\nconst tryResult = (body) => {\n\treturn new ResultOperation(Effect.gen(body));\n};\nconst match = Function.dual(2, (result, matchers) => {\n\tif (result instanceof PendingQueryResult) {\n\t\tif (matchers.pending === void 0) throw new Error(\"A pending Result requires a pending matcher.\");\n\t\treturn matchers.pending();\n\t}\n\tif (!Predicate.hasProperty(result, ResultTypeId)) throw new Error(\"Unknown Result implementation.\");\n\tconst inspected = inspectResult(result);\n\tif (inspected?.type === \"Success\") {\n\t\tconst value = inspected.value;\n\t\treturn matchers.value(value);\n\t}\n\tif (!isFailureResult(result)) throw new Error(\"Unknown or incomplete Result operation.\");\n\tconst error = result[CompletedResultTypeId].error;\n\tif (error._tag === \"InternalServerError\") {\n\t\tconst internalError = Schema.decodeUnknownSync(InternalServerErrorSchema)(error);\n\t\tconst handler = matchers.internalError;\n\t\tif (handler === void 0) throw internalError;\n\t\treturn handler(internalError);\n\t}\n\tconst errorMatcher = matchers.error;\n\tif (errorMatcher === void 0) throw new Error(`No matcher was provided for ${error._tag}.`);\n\tif (Predicate.isFunction(errorMatcher)) return errorMatcher(error);\n\tconst handlers = errorMatcher;\n\tconst handler = Object.hasOwn(handlers, error._tag) ? handlers[error._tag] : void 0;\n\tif (handler === void 0) throw new Error(`No matcher was provided for ${error._tag}.`);\n\treturn handler(error);\n});\nconst pending = () => new PendingQueryResult();\nconst failureFromWire = (error, datePaths = []) => {\n\tconst internalError = Schema.decodeUnknownOption(InternalServerErrorSchema)(error);\n\tif (Option.isSome(internalError)) return fail(internalError.value);\n\tconst decoded = Schema.decodeUnknownOption(ErrorValueSchema)(error);\n\tif (Option.isNone(decoded)) throw new Error(\"The server returned an invalid application error.\");\n\tconst restored = decodeTransportObject(decoded.value, datePaths);\n\treturn fail(makeErrorValue({\n\t\t...restored,\n\t\t_tag: decoded.value._tag\n\t}));\n};\nconst documentNotFound = (table, id) => Brand.nominal()({\n\t_tag: \"DocumentNotFound\",\n\ttable,\n\tid\n});\nconst Result = {\n\tfail,\n\tmatch,\n\tsucceed,\n\ttry: tryResult\n};\n//#endregion\nexport { ErrorBrand, ErrorValueSchema, InternalServerError, InternalServerErrorSchema, Result, documentNotFound, effectFromResult, failureFromWire, inspectResult, match, pending, resultFromEffect };\n\n//# sourceMappingURL=result.js.map","import { encodeCanonicalJson } from \"../json.js\";\nimport { Encoding, Result, Schema } from \"effect\";\n//#region src/runtime/pagination.ts\nconst PaginationCursor = Schema.String.check(Schema.isBase64Url()).pipe(Schema.brand(\"ignotum/runtime/PaginationCursor\"));\nconst PaginationPageSize = Schema.Int.check(Schema.isBetween({\n\tminimum: 1,\n\tmaximum: 1e3\n})).pipe(Schema.brand(\"ignotum/runtime/PaginationPageSize\"));\nconst PaginationOptions = Schema.Struct({\n\tcursor: Schema.NullOr(PaginationCursor),\n\tpageSize: PaginationPageSize\n});\nconst TablePosition = Schema.Struct({\n\ttype: Schema.Literal(\"Table\"),\n\tcreatedAt: Schema.Int,\n\tid: Schema.String\n});\nconst IndexPosition = Schema.Struct({\n\ttype: Schema.Literal(\"Index\"),\n\tkey: Schema.String.check(Schema.isPattern(/^(?:[0-9a-f]{2})*$/)).pipe(Schema.brand(\"ignotum/runtime/EncodedIndexKey\"))\n});\nconst PaginationPosition = Schema.Union([TablePosition, IndexPosition]);\nconst CursorPayload = Schema.Struct({\n\tversion: Schema.Literal(1),\n\tquery: Schema.String,\n\tposition: PaginationPosition\n});\nconst CursorPayloadJson = Schema.fromJsonString(CursorPayload);\nconst paginationQueryIdentity = (tableId, index, lower, upper, order) => encodeCanonicalJson([\n\ttableId,\n\tindex,\n\tlower ?? null,\n\tupper ?? null,\n\torder\n]);\nconst encodePaginationCursor = (query, position) => PaginationCursor.make(Encoding.encodeBase64Url(Schema.encodeSync(CursorPayloadJson)({\n\tversion: 1,\n\tquery,\n\tposition\n})));\nconst decodePaginationCursor = (cursor) => Schema.decodeSync(CursorPayloadJson)(Result.getOrThrow(Encoding.decodeBase64UrlString(cursor)));\n//#endregion\nexport { PaginationCursor, PaginationOptions, PaginationPageSize, PaginationPosition, decodePaginationCursor, encodePaginationCursor, paginationQueryIdentity };\n\n//# sourceMappingURL=pagination.js.map","import { Function, Predicate, Schema } from \"effect\";\n//#region src/schema/descriptor.ts\nconst LiteralValue = Schema.Union([\n\tSchema.String,\n\tSchema.Finite,\n\tSchema.Boolean\n]);\nconst DescriptorField = Schema.Struct({\n\tname: Schema.String,\n\tvalue: Schema.suspend(() => ValueDescriptor)\n});\nconst ValueDescriptor = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"array\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"boolean\") }),\n\tSchema.Struct({ type: Schema.Literal(\"date\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"error\"),\n\t\ttag: Schema.String,\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"id\"),\n\t\ttable: Schema.String\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"integer\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"literal\"),\n\t\tvalue: LiteralValue\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"literals\"),\n\t\tvalues: Schema.Array(LiteralValue)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"never\") }),\n\tSchema.Struct({ type: Schema.Literal(\"null\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"nullable\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"number\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"object\"),\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"optional\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"record\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"string\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"union\"),\n\t\tmembers: Schema.Array(Schema.suspend(() => ValueDescriptor))\n\t})\n]);\nconst ValueDescriptorTypeId = Symbol.for(\"ignotum/schema/ValueDescriptor\");\nconst attachValueDescriptor = Function.dual(2, (value, descriptor) => {\n\tObject.defineProperty(value, ValueDescriptorTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: descriptor,\n\t\twritable: false\n\t});\n\treturn value;\n});\nconst getValueDescriptor = (value) => {\n\tif (!Predicate.hasProperty(value, ValueDescriptorTypeId)) return void 0;\n\treturn Schema.is(ValueDescriptor)(value[ValueDescriptorTypeId]) ? value[ValueDescriptorTypeId] : void 0;\n};\nconst descriptorFields = (fields) => {\n\tconst entries = [];\n\tfor (const name of Reflect.ownKeys(fields)) {\n\t\tif (!Predicate.isString(name)) throw new Error(\"Ignotum value objects only support string field names.\");\n\t\tconst field = fields[name];\n\t\tconst value = field === void 0 ? void 0 : getValueDescriptor(field);\n\t\tif (value === void 0) throw new Error(`The field '${name}' must use an Ignotum values validator.`);\n\t\tentries.push({\n\t\t\tname,\n\t\t\tvalue\n\t\t});\n\t}\n\treturn entries.sort((left, right) => left.name.localeCompare(right.name));\n};\n//#endregion\nexport { getValueDescriptor as a, descriptorFields as i, ValueDescriptorTypeId as n, attachValueDescriptor as r, ValueDescriptor as t };\n\n//# sourceMappingURL=descriptor-t6BOEGw9.js.map"],"mappings":";;;AAEA,MAAM,uBAAuB,OAAO,cAAc,OAAO,MAAM;CAC9D,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO,MAAM,oBAAoB;CACjC,OAAO,OAAO,OAAO,QAAQ,OAAO,YAAY,oBAAoB,CAAC;AACtE,CAAC,CAAC;AACF,MAAM,wBAAwB,UAAU;CACvC,IAAI,UAAU,OAAO,KAAK,GAAG,OAAO,OAAO,WAAW,OAAO,cAAc,CAAC,CAAC,KAAK;CAClF,IAAI,WAAW,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,oBAAoB;CAC1E,IAAI,UAAU,SAAS,KAAK,GAAG,OAAO,OAAO,WAAW,OAAO,MAAM,CAAC,CAAC,KAAK;CAC5E,IAAI,UAAU,OAAO,KAAK,KAAK,UAAU,SAAS,KAAK,KAAK,UAAU,UAAU,KAAK,GAAG,OAAO;CAC/F,OAAO,OAAO,YAAY,OAAO,QAAQ,KAAK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,KAAK,cAAc,MAAM,IAAI,CAAC;AACzE"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
//#region ../contracts/dist/runtime/id.js
|
|
3
|
-
const IdAlphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
4
|
-
const IdPrefix = Schema.String.check(Schema.isPattern(/^[a-z]+$/));
|
|
5
|
-
const IdPayloadPattern = /^[0-9a-z]{24}$/;
|
|
6
|
-
const withPrefix = (definition, idPrefix) => Object.assign(definition, { idPrefix });
|
|
7
|
-
const defineId = (prefix, brand) => {
|
|
8
|
-
const idPrefix = Schema.decodeSync(IdPrefix)(prefix);
|
|
9
|
-
return withPrefix(Schema.String.check(Schema.isPattern(new RegExp(`^${idPrefix}_[0-9a-z]{24}$`))).pipe(Schema.brand(brand)), idPrefix);
|
|
10
|
-
};
|
|
11
|
-
const GeneratedId = withPrefix(Schema.String.check(Schema.isPattern(IdPayloadPattern)).pipe(Schema.brand("ignotum/id")), void 0);
|
|
12
|
-
const AppId = defineId("app", "ignotum/hosted/AppId");
|
|
13
|
-
const DeploymentId = defineId("dep", "ignotum/hosted/DeploymentId");
|
|
14
|
-
defineId("team", "ignotum/hosted/TeamId");
|
|
15
|
-
const TableId = defineId("table", "ignotum/runtime/TableId");
|
|
16
|
-
defineId("prn", "ignotum/control/PlatformPrincipalId");
|
|
17
|
-
const InvocationId = defineId("inv", "ignotum/sync/InvocationId");
|
|
18
|
-
const SubscriptionId = defineId("sub", "ignotum/sync/SubscriptionId");
|
|
19
|
-
defineId("conn", "ignotum/gateway/ConnectionId");
|
|
20
|
-
const RuntimeRequestNonce = defineId("nonce", "ignotum/runtime/RequestNonce");
|
|
21
|
-
const RequestId = defineId("req", "ignotum/runtime/RequestId");
|
|
22
|
-
defineId("lock", "ignotum/dev/DatabaseLockId");
|
|
23
|
-
//#endregion
|
|
24
|
-
export { InvocationId as a, SubscriptionId as c, IdAlphabet as i, TableId as l, DeploymentId as n, RequestId as o, GeneratedId as r, RuntimeRequestNonce as s, AppId as t };
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=id-D570vudg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"id-D570vudg.js","names":[],"sources":["../../../contracts/dist/runtime/id.js"],"sourcesContent":["import { Schema } from \"effect\";\n//#region src/runtime/id.ts\nconst IdAlphabet = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nconst IdLength = 24;\nconst IdPrefix = Schema.String.check(Schema.isPattern(/^[a-z]+$/));\nconst IdPayloadPattern = /^[0-9a-z]{24}$/;\nconst withPrefix = (definition, idPrefix) => Object.assign(definition, { idPrefix });\nconst defineId = (prefix, brand) => {\n\tconst idPrefix = Schema.decodeSync(IdPrefix)(prefix);\n\treturn withPrefix(Schema.String.check(Schema.isPattern(new RegExp(`^${idPrefix}_[0-9a-z]{24}$`))).pipe(Schema.brand(brand)), idPrefix);\n};\nconst GeneratedId = withPrefix(Schema.String.check(Schema.isPattern(IdPayloadPattern)).pipe(Schema.brand(\"ignotum/id\")), void 0);\nconst AppId = defineId(\"app\", \"ignotum/hosted/AppId\");\nconst DeploymentId = defineId(\"dep\", \"ignotum/hosted/DeploymentId\");\nconst TeamId = defineId(\"team\", \"ignotum/hosted/TeamId\");\nconst TableId = defineId(\"table\", \"ignotum/runtime/TableId\");\nconst PlatformPrincipalId = defineId(\"prn\", \"ignotum/control/PlatformPrincipalId\");\nconst InvocationId = defineId(\"inv\", \"ignotum/sync/InvocationId\");\nconst SubscriptionId = defineId(\"sub\", \"ignotum/sync/SubscriptionId\");\nconst ConnectionId = defineId(\"conn\", \"ignotum/gateway/ConnectionId\");\nconst RuntimeRequestNonce = defineId(\"nonce\", \"ignotum/runtime/RequestNonce\");\nconst RequestId = defineId(\"req\", \"ignotum/runtime/RequestId\");\nconst DevDatabaseLockId = defineId(\"lock\", \"ignotum/dev/DatabaseLockId\");\n//#endregion\nexport { AppId, ConnectionId, DeploymentId, DevDatabaseLockId, GeneratedId, IdAlphabet, IdLength, InvocationId, PlatformPrincipalId, RequestId, RuntimeRequestNonce, SubscriptionId, TableId, TeamId, defineId };\n\n//# sourceMappingURL=id.js.map"],"mappings":";;AAEA,MAAM,aAAa;AAEnB,MAAM,WAAW,OAAO,OAAO,MAAM,OAAO,UAAU,UAAU,CAAC;AACjE,MAAM,mBAAmB;AACzB,MAAM,cAAc,YAAY,aAAa,OAAO,OAAO,YAAY,EAAE,SAAS,CAAC;AACnF,MAAM,YAAY,QAAQ,UAAU;CACnC,MAAM,WAAW,OAAO,WAAW,QAAQ,CAAC,CAAC,MAAM;CACnD,OAAO,WAAW,OAAO,OAAO,MAAM,OAAO,UAAU,IAAI,OAAO,IAAI,SAAS,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,KAAK,CAAC,GAAG,QAAQ;AACtI;AACA,MAAM,cAAc,WAAW,OAAO,OAAO,MAAM,OAAO,UAAU,gBAAgB,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,GAAG,KAAK,CAAC;AAC/H,MAAM,QAAQ,SAAS,OAAO,sBAAsB;AACpD,MAAM,eAAe,SAAS,OAAO,6BAA6B;AACnD,SAAS,QAAQ,uBAAuB;AACvD,MAAM,UAAU,SAAS,SAAS,yBAAyB;AAC/B,SAAS,OAAO,qCAAqC;AACjF,MAAM,eAAe,SAAS,OAAO,2BAA2B;AAChE,MAAM,iBAAiB,SAAS,OAAO,6BAA6B;AAC/C,SAAS,QAAQ,8BAA8B;AACpE,MAAM,sBAAsB,SAAS,SAAS,8BAA8B;AAC5E,MAAM,YAAY,SAAS,OAAO,2BAA2B;AACnC,SAAS,QAAQ,4BAA4B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./pagination-B1BzNkh8-BUSTbeSg.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-D9RmboaS.js","names":[],"sources":["../../../contracts/dist/schema/values.js","../../../contracts/dist/runtime/schema.js","../../../contracts/dist/schema/index.js"],"sourcesContent":["import { GeneratedId } from \"../runtime/id.js\";\nimport { a as getValueDescriptor, i as descriptorFields, r as attachValueDescriptor } from \"../descriptor-t6BOEGw9.js\";\nimport { PaginationCursor, PaginationPageSize } from \"../runtime/pagination.js\";\nimport { ErrorBrand } from \"../runtime/result.js\";\nimport { Schema, Struct } from \"effect\";\n//#region src/schema/values.ts\nconst LiteralValueSchema = Schema.Union([\n\tSchema.String,\n\tSchema.Finite,\n\tSchema.Boolean\n]);\nconst schemaIndexLimits = {\n\tfieldsPerIndex: 8,\n\tindexesPerSchema: 128,\n\tindexesPerTable: 16,\n\tkeyBytes: 4096,\n\tnameBytes: 64\n};\nconst utf8ByteLength = (value) => {\n\tlet bytes = 0;\n\tfor (const character of value) {\n\t\tconst point = character.codePointAt(0) ?? 0;\n\t\tbytes += point <= 127 ? 1 : point <= 2047 ? 2 : point <= 65535 ? 3 : 4;\n\t}\n\treturn bytes;\n};\nconst table = (fields) => {\n\tconst tableFields = fields;\n\tconst make = (indexes) => {\n\t\tconst index = (name, fieldNames) => {\n\t\t\tif (utf8ByteLength(name) > schemaIndexLimits.nameBytes) throw new Error(`Index names cannot exceed ${schemaIndexLimits.nameBytes} UTF-8 bytes.`);\n\t\t\tif (name.length === 0) throw new Error(\"Index names cannot be empty.\");\n\t\t\tif (name.startsWith(\"$\")) throw new Error(\"Index names beginning with '$' are reserved.\");\n\t\t\tif (Object.hasOwn(indexes, name)) throw new Error(`Duplicate index name '${name}'.`);\n\t\t\tif (fieldNames.length > schemaIndexLimits.fieldsPerIndex) throw new Error(`Indexes cannot contain more than ${schemaIndexLimits.fieldsPerIndex} fields.`);\n\t\t\tif (new Set(fieldNames).size !== fieldNames.length) throw new Error(`Index '${name}' contains duplicate fields.`);\n\t\t\tfor (const fieldName of fieldNames) {\n\t\t\t\tif (!Object.hasOwn(tableFields, fieldName)) throw new Error(`Index '${name}' references unknown field '${fieldName}'.`);\n\t\t\t\tconst descriptor = getValueDescriptor(tableFields[fieldName]);\n\t\t\t\tif (!(descriptor?.type === \"boolean\" || descriptor?.type === \"date\" || descriptor?.type === \"id\" || descriptor?.type === \"integer\" || descriptor?.type === \"number\" || descriptor?.type === \"string\" || descriptor?.type === \"literal\" || descriptor?.type === \"literals\")) throw new Error(`Index '${name}' field '${fieldName}' is not indexable.`);\n\t\t\t\tif (descriptor.type === \"literals\" && !(descriptor.values.every(Schema.is(Schema.Boolean)) || descriptor.values.every(Schema.is(Schema.Finite)) || descriptor.values.every(Schema.is(Schema.String)))) throw new Error(`Index '${name}' field '${fieldName}' mixes value types.`);\n\t\t\t}\n\t\t\tconst duplicate = Object.values(indexes).find((candidate) => candidate.fields.length === fieldNames.length && candidate.fields.every((fieldName, position) => fieldName === fieldNames[position]));\n\t\t\tif (duplicate !== void 0) throw new Error(`Index '${name}' duplicates index '${duplicate.name}'.`);\n\t\t\tif (Object.keys(indexes).length >= schemaIndexLimits.indexesPerTable) throw new Error(`Tables cannot declare more than ${schemaIndexLimits.indexesPerTable} indexes.`);\n\t\t\treturn make({\n\t\t\t\t...indexes,\n\t\t\t\t[name]: {\n\t\t\t\t\tname,\n\t\t\t\t\tfields: fieldNames\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\treturn {\n\t\t\t_tag: \"Table\",\n\t\t\tdescriptor: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tfields: descriptorFields(tableFields)\n\t\t\t},\n\t\t\tfields: tableFields,\n\t\t\tindex,\n\t\t\tindexes,\n\t\t\tschema: Schema.Struct(tableFields)\n\t\t};\n\t};\n\treturn make({});\n};\nconst fresh = (value) => value.pipe(Schema.annotate({}));\nconst string = () => attachValueDescriptor(fresh(Schema.String), { type: \"string\" });\nconst number = () => attachValueDescriptor(fresh(Schema.Finite), { type: \"number\" });\nconst integer = () => attachValueDescriptor(fresh(Schema.Int), { type: \"integer\" });\nconst boolean = () => attachValueDescriptor(fresh(Schema.Boolean), { type: \"boolean\" });\nconst date = () => attachValueDescriptor(fresh(Schema.DateFromMillis), { type: \"date\" });\nconst never = () => attachValueDescriptor(fresh(Schema.Never), { type: \"never\" });\nconst nullValue = () => attachValueDescriptor(fresh(Schema.Null), { type: \"null\" });\nconst literal = (value) => {\n\tSchema.decodeSync(LiteralValueSchema)(value);\n\treturn attachValueDescriptor(Schema.Literal(value), {\n\t\ttype: \"literal\",\n\t\tvalue\n\t});\n};\nconst literals = (...members) => {\n\tSchema.decodeSync(Schema.Array(LiteralValueSchema))(members);\n\treturn attachValueDescriptor(Schema.Literals(members), {\n\t\ttype: \"literals\",\n\t\tvalues: members\n\t});\n};\nconst makeIdSchema = (tableName) => {\n\tconst identifier = `ignotum/id/${tableName}`;\n\treturn attachValueDescriptor(GeneratedId.pipe(Schema.brand(identifier), Schema.annotate({ \"ignotum/table\": tableName })), {\n\t\ttype: \"id\",\n\t\ttable: tableName\n\t});\n};\nconst id = (tableName) => makeIdSchema(tableName);\nconst requireDescriptor = (value) => {\n\tconst descriptor = getValueDescriptor(value);\n\tif (descriptor === void 0) throw new Error(\"Ignotum value combinators require a values validator.\");\n\treturn descriptor;\n};\nconst array = (value) => {\n\treturn attachValueDescriptor(Schema.Array(value), {\n\t\ttype: \"array\",\n\t\tvalue: requireDescriptor(value)\n\t});\n};\nconst assertFieldsExist = (fields, keys, operation) => {\n\tfor (const key of keys) if (!Object.hasOwn(fields, key)) throw new Error(`Cannot ${operation} unknown field '${String(key)}'.`);\n};\nconst fixedObject = (fields) => {\n\tconst pick = (...keys) => {\n\t\tassertFieldsExist(fields, keys, \"pick\");\n\t\treturn fixedObject(Struct.pick(fields, keys));\n\t};\n\tconst omit = (...keys) => {\n\t\tassertFieldsExist(fields, keys, \"omit\");\n\t\treturn fixedObject(Struct.omit(fields, keys));\n\t};\n\tconst extend = (addedFields, ..._validation) => {\n\t\tfor (const key of Reflect.ownKeys(addedFields)) if (Object.hasOwn(fields, key)) throw new Error(`Cannot extend existing field '${String(key)}'.`);\n\t\treturn fixedObject(Struct.assign(fields, addedFields));\n\t};\n\tconst override = (overriddenFields, ..._validation) => {\n\t\tassertFieldsExist(fields, Reflect.ownKeys(overriddenFields), \"override\");\n\t\treturn fixedObject(Struct.assign(fields, overriddenFields));\n\t};\n\tconst partial = () => {\n\t\tconst partialFields = Struct.map(fields, Schema.optional);\n\t\tfor (const name of Reflect.ownKeys(fields)) {\n\t\t\tconst field = fields[name];\n\t\t\tconst partialField = partialFields[name];\n\t\t\tif (field === void 0 || partialField === void 0) continue;\n\t\t\tattachValueDescriptor(partialField, {\n\t\t\t\ttype: \"optional\",\n\t\t\t\tvalue: requireDescriptor(field)\n\t\t\t});\n\t\t}\n\t\treturn fixedObject(partialFields);\n\t};\n\tconst schema = attachValueDescriptor(Schema.Struct(fields), {\n\t\ttype: \"object\",\n\t\tfields: descriptorFields(fields)\n\t});\n\treturn Object.assign(schema, {\n\t\textend,\n\t\tomit,\n\t\toverride,\n\t\tpartial,\n\t\tpick\n\t});\n};\nconst object = (fields) => fixedObject(fields);\nconst optional = (value) => {\n\treturn attachValueDescriptor(Schema.optional(value), {\n\t\ttype: \"optional\",\n\t\tvalue: requireDescriptor(value)\n\t});\n};\nconst nullable = (value) => {\n\treturn attachValueDescriptor(Schema.NullOr(value), {\n\t\ttype: \"nullable\",\n\t\tvalue: requireDescriptor(value)\n\t});\n};\nconst record = (value) => {\n\treturn attachValueDescriptor(Schema.Record(Schema.String, value), {\n\t\ttype: \"record\",\n\t\tvalue: requireDescriptor(value)\n\t});\n};\nconst union = (...members) => {\n\treturn attachValueDescriptor(Schema.Union(members), {\n\t\ttype: \"union\",\n\t\tmembers: members.map(requireDescriptor)\n\t});\n};\nconst paginationCursor = () => attachValueDescriptor(fresh(PaginationCursor), { type: \"string\" });\nconst pagination = () => fixedObject({\n\tcursor: nullable(paginationCursor()),\n\tpageSize: attachValueDescriptor(fresh(PaginationPageSize), { type: \"integer\" })\n});\nconst page = (value) => {\n\treturn fixedObject({\n\t\titems: array(value),\n\t\tnextCursor: nullable(paginationCursor())\n\t});\n};\nconst error = (tag, fields) => {\n\tif (tag === \"InternalServerError\") throw new Error(\"The error tag 'InternalServerError' is reserved by Ignotum.\");\n\tconst errorFields = { ...fields };\n\tReflect.deleteProperty(errorFields, \"_tag\");\n\tconst schema = Schema.TaggedStruct(tag, errorFields).pipe(Schema.brand(ErrorBrand));\n\tconst make = (input) => schema.make(input);\n\tconst definition = Object.assign(make, schema);\n\tObject.setPrototypeOf(definition, Object.getPrototypeOf(schema));\n\tattachValueDescriptor(definition, {\n\t\ttype: \"error\",\n\t\ttag,\n\t\tfields: descriptorFields(errorFields)\n\t});\n\treturn definition;\n};\nconst values = {\n\tarray,\n\tboolean,\n\tdate,\n\terror,\n\tid,\n\tinteger,\n\tliteral,\n\tliterals,\n\tnever,\n\tnull: nullValue,\n\tnullable,\n\tnumber,\n\tobject,\n\toptional,\n\trecord,\n\tstring,\n\tunion\n};\nconst bindValues = (definition) => {\n\tconst boundId = (tableName) => makeIdSchema(tableName);\n\tconst doc = (tableName) => {\n\t\tconst tableDefinition = definition[tableName];\n\t\tif (tableDefinition === void 0) throw new Error(`Unknown table '${tableName}'.`);\n\t\tconst tableFields = tableDefinition.fields;\n\t\tconst systemFields = {\n\t\t\tid: boundId(tableName),\n\t\t\tcreatedAt: date(),\n\t\t\tupdatedAt: date()\n\t\t};\n\t\treturn fixedObject(Struct.assign(tableFields, systemFields));\n\t};\n\tconst boundPagination = () => {\n\t\treturn pagination();\n\t};\n\treturn {\n\t\t...values,\n\t\tdoc,\n\t\tid: boundId,\n\t\tpage,\n\t\tpagination: boundPagination\n\t};\n};\n//#endregion\nexport { bindValues, schemaIndexLimits, table, values };\n\n//# sourceMappingURL=values.js.map","//#region src/runtime/schema.ts\nconst FunctionSchemaTypeId = Symbol.for(\"ignotum/runtime/schema/FunctionSchema\");\nconst attachFunctionSchema = (schema) => (definition) => {\n\tObject.defineProperty(definition, FunctionSchemaTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: schema,\n\t\twritable: false\n\t});\n\treturn definition;\n};\nconst getFunctionSchema = (value) => value[FunctionSchemaTypeId];\n//#endregion\nexport { FunctionSchemaTypeId, attachFunctionSchema, getFunctionSchema };\n\n//# sourceMappingURL=schema.js.map","import { a as getValueDescriptor, n as ValueDescriptorTypeId, t as ValueDescriptor } from \"../descriptor-t6BOEGw9.js\";\nimport { Result } from \"../runtime/result.js\";\nimport { bindValues, schemaIndexLimits, table, values } from \"./values.js\";\nimport { attachFunctionSchema } from \"../runtime/schema.js\";\nimport { Predicate } from \"effect\";\n//#region src/schema/types.ts\nconst SchemaDefinitionTypeId = Symbol.for(\"ignotum/schema/SchemaDefinition\");\n//#endregion\n//#region src/schema/definition.ts\nconst defineSchema = (define) => {\n\tconst definitions = define({\n\t\ttable,\n\t\tvalues\n\t});\n\tif (Object.values(definitions).reduce((count, definition) => count + Object.keys(definition.indexes).length, 0) > schemaIndexLimits.indexesPerSchema) throw new Error(`Schemas cannot declare more than ${schemaIndexLimits.indexesPerSchema} indexes.`);\n\treturn {\n\t\t_tag: \"Schema\",\n\t\t[SchemaDefinitionTypeId]: definitions\n\t};\n};\nconst isDefinedSchema = (value) => value._tag === \"Schema\" && Predicate.isObject(value[SchemaDefinitionTypeId]);\n//#endregion\n//#region src/schema/server.ts\nconst makeFunctionBuilder = (schema, kind) => {\n\tconst define = (definition) => attachFunctionSchema(schema)({\n\t\t_tag: kind,\n\t\t...definition\n\t});\n\treturn define;\n};\nconst makeFunctionBuilders = (schema) => ({\n\tmutation: makeFunctionBuilder(schema, \"Mutation\"),\n\tquery: makeFunctionBuilder(schema, \"Query\")\n});\nconst bindSchema = (schema) => ({\n\tvalues: bindValues(schema[SchemaDefinitionTypeId]),\n\t...makeFunctionBuilders(schema)\n});\n//#endregion\nexport { Result, SchemaDefinitionTypeId, ValueDescriptor, ValueDescriptorTypeId, bindSchema, bindValues, defineSchema, getValueDescriptor, isDefinedSchema, schemaIndexLimits, table, values };\n\n//# sourceMappingURL=index.js.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