ignotum 0.0.8 → 0.0.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/README.md +6 -2
- package/dist/cli/bin.mjs +295 -64
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/runtime/{api-BTeMI5tx.js → api-DzcR7spt.js} +22 -23
- package/dist/runtime/api-DzcR7spt.js.map +1 -0
- package/dist/runtime/{api-D9lV-5av.d.ts → api-jCl8Hzry.d.ts} +3 -3
- package/dist/runtime/client.d.ts +5 -5
- package/dist/runtime/client.js +57 -55
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/{descriptor-C5VA9qRl-C338iC6l.js → descriptor-C5VA9qRl-BhD-WQeO.js} +4 -3
- package/dist/runtime/descriptor-C5VA9qRl-BhD-WQeO.js.map +1 -0
- package/dist/runtime/{file-BXf63ulU.js → file-C1abuMgd.js} +8 -1
- package/dist/runtime/file-C1abuMgd.js.map +1 -0
- package/dist/runtime/{id-Btwac71X-DGj0DQuu.d.ts → id-Cs82tq9Q-Caqfx54f.d.ts} +2 -2
- package/dist/runtime/{index-CF04_Dps.d.ts → index-D6VLTbDB.d.ts} +4 -4
- package/dist/runtime/internal/api.d.ts +1 -1
- package/dist/runtime/internal/api.js +1 -1
- package/dist/runtime/internal/host.d.ts +4 -4
- package/dist/runtime/internal/host.js +3 -3
- 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-DrOowBve-Bnipd34u.d.ts → pagination-Bt3l7QaC-D_zI5zsu.d.ts} +3 -3
- package/dist/runtime/pagination-DcIkTOFs.d.ts +1 -0
- package/dist/runtime/{schema-DJfwfq87.js → schema-C00wobuy.js} +3 -3
- package/dist/runtime/{schema-DJfwfq87.js.map → schema-C00wobuy.js.map} +1 -1
- package/dist/runtime/server.d.ts +2 -2
- package/dist/runtime/server.js +2 -2
- package/dist/runtime/{sync-mIXn9eKv.d.ts → sync-bMQq9tXx.d.ts} +2 -2
- package/package.json +4 -2
- package/src/cli/auth-client.ts +286 -0
- package/src/cli/command.ts +65 -2
- package/src/cli/control-client.ts +19 -6
- package/src/cli/new-app.ts +2 -1
- package/src/client/errors.ts +7 -10
- package/src/client/files.ts +36 -51
- package/src/client/sync.ts +35 -23
- package/src/dev-runtime/files.ts +30 -31
- package/src/dev-runtime/sync.ts +19 -25
- package/dist/runtime/api-BTeMI5tx.js.map +0 -1
- package/dist/runtime/descriptor-C5VA9qRl-C338iC6l.js.map +0 -1
- package/dist/runtime/file-BXf63ulU.js.map +0 -1
- package/dist/runtime/pagination-BNFhAjns.d.ts +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";
|
|
@@ -181,15 +181,11 @@ const operationForSubscription = (subscriptionId: SubscriptionId): Operation =>
|
|
|
181
181
|
id: subscriptionId,
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
const
|
|
185
|
-
code: ProtocolErrorCode,
|
|
186
|
-
message: string,
|
|
187
|
-
operation?: Operation,
|
|
188
|
-
): ServerMessage => {
|
|
184
|
+
const syncError = (code: ErrorCode, message: string, operation?: Operation): ServerMessage => {
|
|
189
185
|
if (operation === undefined) {
|
|
190
|
-
return { type: "
|
|
186
|
+
return { type: "Error", code, message };
|
|
191
187
|
}
|
|
192
|
-
return { type: "
|
|
188
|
+
return { type: "Error", code, message, operation };
|
|
193
189
|
};
|
|
194
190
|
|
|
195
191
|
export const runSession = Effect.fn("SyncServer.runSession")(function* (socket: Socket.Socket) {
|
|
@@ -221,8 +217,8 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
221
217
|
message: ServerMessage,
|
|
222
218
|
) => Effect.Effect<void, Schema.SchemaError | Socket.SocketError> = send,
|
|
223
219
|
) => {
|
|
224
|
-
const code:
|
|
225
|
-
return deliver(
|
|
220
|
+
const code: ErrorCode = error._tag;
|
|
221
|
+
return deliver(syncError(code, error.message, operation));
|
|
226
222
|
};
|
|
227
223
|
|
|
228
224
|
const isActive = (subscriptionId: SubscriptionId, subscription: QuerySubscription) =>
|
|
@@ -340,7 +336,7 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
340
336
|
const operation = operationForSubscription(message.id);
|
|
341
337
|
if (encodedFileOccurrencesOf(message.args).length > 0) {
|
|
342
338
|
yield* send(
|
|
343
|
-
|
|
339
|
+
syncError("InvalidArguments", "Queries cannot take files as arguments.", operation),
|
|
344
340
|
);
|
|
345
341
|
return;
|
|
346
342
|
}
|
|
@@ -348,11 +344,7 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
348
344
|
|
|
349
345
|
if (HashMap.has(current, message.id)) {
|
|
350
346
|
yield* send(
|
|
351
|
-
|
|
352
|
-
"DuplicateOperationId",
|
|
353
|
-
`Subscription ${message.id} already exists.`,
|
|
354
|
-
operation,
|
|
355
|
-
),
|
|
347
|
+
syncError("DuplicateOperationId", `Subscription ${message.id} already exists.`, operation),
|
|
356
348
|
);
|
|
357
349
|
return;
|
|
358
350
|
}
|
|
@@ -388,7 +380,7 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
388
380
|
Effect.as(true),
|
|
389
381
|
Effect.catchCause((cause) =>
|
|
390
382
|
send(
|
|
391
|
-
|
|
383
|
+
syncError(
|
|
392
384
|
"InvalidArguments",
|
|
393
385
|
`The mutation files could not be admitted: ${String(cause)}`,
|
|
394
386
|
operation,
|
|
@@ -454,7 +446,7 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
454
446
|
Effect.catchTags({
|
|
455
447
|
InvocationIdConflict: () =>
|
|
456
448
|
send(
|
|
457
|
-
|
|
449
|
+
syncError(
|
|
458
450
|
"InvocationIdConflict",
|
|
459
451
|
`Invocation ${message.id} was already used with different inputs.`,
|
|
460
452
|
operation,
|
|
@@ -472,15 +464,17 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
472
464
|
);
|
|
473
465
|
});
|
|
474
466
|
|
|
475
|
-
const
|
|
476
|
-
message: Extract<ClientMessage, { readonly type: "
|
|
467
|
+
const handlePrepare = Effect.fn("SyncServer.handlePrepare")(function* (
|
|
468
|
+
message: Extract<ClientMessage, { readonly type: "Prepare" }>,
|
|
477
469
|
) {
|
|
478
470
|
const operation: Operation = { type: "Invocation", id: message.id };
|
|
479
471
|
yield* files.prepare(message.id, message.function, message.args, message.files).pipe(
|
|
480
|
-
Effect.flatMap((uploads) =>
|
|
472
|
+
Effect.flatMap((uploads) =>
|
|
473
|
+
send({ type: "Preparation", id: message.id, kind: message.kind, uploads }),
|
|
474
|
+
),
|
|
481
475
|
Effect.catchCause((cause) =>
|
|
482
476
|
send(
|
|
483
|
-
|
|
477
|
+
syncError(
|
|
484
478
|
"InvalidArguments",
|
|
485
479
|
`The mutation files could not be prepared: ${String(cause)}`,
|
|
486
480
|
operation,
|
|
@@ -493,7 +487,7 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
493
487
|
const handleMessage = Effect.fn("SyncServer.handleMessage")(function* (text: string) {
|
|
494
488
|
const message = yield* Schema.decodeEffect(ClientMessageJson)(text).pipe(
|
|
495
489
|
Effect.catch(() =>
|
|
496
|
-
send(
|
|
490
|
+
send(syncError("InvalidMessage", "The WebSocket frame is not valid Ignotum JSON.")),
|
|
497
491
|
),
|
|
498
492
|
);
|
|
499
493
|
|
|
@@ -510,8 +504,8 @@ export const runSession = Effect.fn("SyncServer.runSession")(function* (socket:
|
|
|
510
504
|
yield* Ref.update(subscriptions, HashMap.remove(message.id));
|
|
511
505
|
yield* files.releaseGrants(message.id);
|
|
512
506
|
return;
|
|
513
|
-
case "
|
|
514
|
-
yield*
|
|
507
|
+
case "Prepare":
|
|
508
|
+
yield* handlePrepare(message);
|
|
515
509
|
return;
|
|
516
510
|
case "Invoke":
|
|
517
511
|
yield* handleInvoke(message);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-BTeMI5tx.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 { RuntimeFileMetadata, RuntimeFileOccurrence } from \"../schema/file.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 PrepareMutation = Schema.Struct({\n\ttype: Schema.Literal(\"PrepareMutation\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tfunction: FunctionAddress,\n\targs: Schema.Json,\n\tfiles: Schema.Array(RuntimeFileOccurrence)\n});\nconst ClientMessage = Schema.Union([\n\tSubscribe,\n\tUnsubscribe,\n\tPrepareMutation,\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\tfiles: Schema.optional(Schema.Array(Schema.Struct({\n\t\tpath: RuntimeFileOccurrence.fields.path,\n\t\tfile: RuntimeFileMetadata,\n\t\turl: Schema.String\n\t})))\n});\nconst MutationPrepared = Schema.Struct({\n\ttype: Schema.Literal(\"MutationPrepared\"),\n\tid: InvocationId,\n\tuploads: Schema.Array(Schema.Struct({\n\t\tpath: RuntimeFileOccurrence.fields.path,\n\t\tfile: RuntimeFileMetadata,\n\t\turl: Schema.optional(Schema.String)\n\t}))\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\tMutationPrepared,\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\";\nimport type { FileValue } from \"@ignotum/contracts/schema/file\";\n\nconst FunctionReferenceTypeId: unique symbol = Symbol.for(\"ignotum/internal/api/FunctionReference\");\ndeclare const FunctionReferenceTypesTypeId: unique symbol;\n\ntype FunctionKind = \"Mutation\" | \"Query\";\n\nexport type MutationInput<Value> = Value extends FileValue\n ? Value | File\n : Value extends Date\n ? Value\n : Value extends ReadonlyArray<infer Item>\n ? ReadonlyArray<MutationInput<Item>>\n : Value extends object\n ? { readonly [Key in keyof Value]: MutationInput<Value[Key]> }\n : Value;\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>]\n ? Kind extends \"Mutation\"\n ? MutationInput<Args>\n : Args\n : 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;;;ACC5F,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,kBAAkB,OAAO,OAAO;CACrC,MAAM,OAAO,QAAQ,iBAAiB;CACtC,IAAI;CACJ,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU;CACV,MAAM,OAAO;CACb,OAAO,OAAO,MAAM,qBAAqB;AAC1C,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CAClC;CACA;CAC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AO,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-C5VA9qRl-C338iC6l.js","names":[],"sources":["../../../contracts/dist/runtime/value.js","../../../contracts/dist/runtime/result.js","../../../contracts/dist/versioned.js","../../../contracts/dist/runtime/pagination.js","../../../contracts/dist/descriptor-C5VA9qRl.js"],"sourcesContent":["import { EncodedFileValue, FileValue, isFileValue } from \"../schema/file.js\";\nimport { 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\tFileValue,\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 (isFileValue(value)) return Schema.encodeSync(FileValue)(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 (isFileValue(value)) return;\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 (Schema.is(EncodedFileValue)(value)) return Schema.decodeSync(FileValue)(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 { Schema, SchemaGetter } from \"effect\";\n//#region src/versioned.ts\n/** Registers the first revision of a long-lived format. */\nconst initial = (schema) => schema;\n/** Adds one adjacent migration and keeps encoding on the new current revision. */\nconst upgrade = (previous, current, migrate) => {\n\tconst accepted = Schema.Union([previous, current]);\n\tconst isCurrent = Schema.is(current);\n\treturn accepted.pipe(Schema.decodeTo(Schema.toType(current), {\n\t\tdecode: SchemaGetter.transform((value) => {\n\t\t\tif (isCurrent(value)) return value;\n\t\t\treturn migrate(value);\n\t\t}),\n\t\tencode: SchemaGetter.transform((value) => value)\n\t}));\n};\n//#endregion\nexport { initial, upgrade };\n\n//# sourceMappingURL=versioned.js.map","import { initial } from \"../versioned.js\";\nimport { 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 CursorPayloadV1 = Schema.Struct({\n\tversion: Schema.Literal(1),\n\tquery: Schema.String,\n\tposition: PaginationPosition\n});\nconst CursorPayload = initial(CursorPayloadV1);\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(\"file\"),\n\t\tformats: Schema.Array(Schema.Literals([\n\t\t\t\"jpeg\",\n\t\t\t\"png\",\n\t\t\t\"webp\",\n\t\t\t\"avif\",\n\t\t\t\"gif\"\n\t\t])),\n\t\tmaxBytes: Schema.Int\n\t}),\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 descriptorContainsFile = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"file\": return true;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\": return descriptorContainsFile(descriptor.value);\n\t\tcase \"error\":\n\t\tcase \"object\": return descriptor.fields.some((field) => descriptorContainsFile(field.value));\n\t\tcase \"union\": return descriptor.members.some(descriptorContainsFile);\n\t\tdefault: return false;\n\t}\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 { descriptorFields as a, descriptorContainsFile as i, ValueDescriptorTypeId as n, getValueDescriptor as o, attachValueDescriptor as r, ValueDescriptor as t };\n\n//# sourceMappingURL=descriptor-C5VA9qRl.js.map"],"mappings":";;;AAGA,MAAM,uBAAuB,OAAO,cAAc,OAAO,MAAM;CAC9D,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP;CACA,OAAO,MAAM,oBAAoB;CACjC,OAAO,OAAO,OAAO,QAAQ,OAAO,YAAY,oBAAoB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,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-BXf63ulU.js","names":[],"sources":["../../../contracts/dist/runtime/id.js","../../../contracts/dist/schema/file.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","import { defineId } from \"../runtime/id.js\";\nimport { Predicate, Schema, SchemaGetter } from \"effect\";\n//#region src/schema/file.ts\nconst fileFormats = [\n\t\"jpeg\",\n\t\"png\",\n\t\"webp\",\n\t\"avif\",\n\t\"gif\"\n];\nconst FileFormat = Schema.Literals(fileFormats);\nconst fileMimeTypes = {\n\tavif: \"image/avif\",\n\tgif: \"image/gif\",\n\tjpeg: \"image/jpeg\",\n\tpng: \"image/png\",\n\twebp: \"image/webp\"\n};\nconst fileLimits = {\n\tactiveGrantsPerConnection: 1024,\n\tdistinctFilesPerQuerySnapshot: 256,\n\tfileBytes: 10485760,\n\tfilesPerMutation: 8,\n\tfilenameBytes: 255,\n\tmutationBytes: 26214400,\n\tpreparationLifetimeMillis: 9e5,\n\tstagedBytesPerApp: 104857600\n};\nconst FileId = Object.assign(Schema.String.pipe(Schema.check(Schema.isPattern(/^file_[0-9A-Za-z_-]{20,128}$/)), Schema.brand(\"ignotum/file/FileId\")), { idPrefix: \"file\" });\nconst FileUploadToken = defineId(\"upload\", \"ignotum/file/FileUploadToken\");\nconst FileGrantToken = defineId(\"grant\", \"ignotum/file/FileGrantToken\");\nconst FileValueTypeId = Symbol.for(\"ignotum/file/FileValue\");\nconst FileGrantTypeId = Symbol.for(\"ignotum/file/FileGrant\");\nconst isFileValue = (value) => Predicate.isObject(value) && Predicate.hasProperty(value, FileValueTypeId) && Predicate.isObject(value[FileValueTypeId]) && Predicate.hasProperty(value[FileValueTypeId], \"id\") && Schema.is(FileId)(value[FileValueTypeId].id) && Predicate.hasProperty(value, \"format\") && Schema.is(FileFormat)(value.format) && Predicate.hasProperty(value, \"name\") && Predicate.isString(value.name) && Predicate.hasProperty(value, \"size\") && Predicate.isNumber(value.size) && Predicate.hasProperty(value, \"mimeType\") && value.mimeType === fileMimeTypes[value.format];\nconst buildFileValue = (id, metadata, grantUrl) => {\n\tconst value = {\n\t\tformat: metadata.format,\n\t\tmimeType: fileMimeTypes[metadata.format],\n\t\tname: metadata.name,\n\t\tsize: metadata.size\n\t};\n\tObject.defineProperty(value, FileValueTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: Object.freeze({ id }),\n\t\twritable: false\n\t});\n\tif (grantUrl !== void 0) Object.defineProperty(value, FileGrantTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: grantUrl,\n\t\twritable: false\n\t});\n\treturn Object.freeze(value);\n};\nconst makeFileValue = (id, metadata) => buildFileValue(id, metadata);\nconst fileIdOf = (value) => value[FileValueTypeId].id;\nconst grantFileValue = (value, url) => {\n\treturn buildFileValue(fileIdOf(value), value, url);\n};\nconst fileGrantUrlOf = (value) => value[FileGrantTypeId];\nconst EncodedFileValue = Schema.Struct({\n\t$ignotum: Schema.Literal(\"file\"),\n\tid: FileId,\n\tformat: FileFormat,\n\tname: Schema.String,\n\tsize: Schema.Int.check(Schema.isBetween({\n\t\tminimum: 0,\n\t\tmaximum: fileLimits.fileBytes\n\t}))\n});\nconst RuntimeFileMetadata = Schema.Struct({\n\tid: FileId,\n\tformat: FileFormat,\n\tname: Schema.String,\n\tsize: Schema.Int.check(Schema.isBetween({\n\t\tminimum: 0,\n\t\tmaximum: fileLimits.fileBytes\n\t}))\n});\nconst FilePath = Schema.Array(Schema.Union([Schema.String, Schema.Natural]));\nconst RuntimeFileOccurrence = Schema.Struct({\n\tpath: FilePath,\n\tfile: RuntimeFileMetadata\n});\nconst DecodedFileValue = Schema.declare(isFileValue, { title: \"FileValue\" });\nconst FileValue = EncodedFileValue.pipe(Schema.decodeTo(DecodedFileValue, {\n\tdecode: SchemaGetter.transform((encoded) => makeFileValue(encoded.id, {\n\t\tformat: encoded.format,\n\t\tname: encoded.name,\n\t\tsize: encoded.size\n\t})),\n\tencode: SchemaGetter.transform((value) => ({\n\t\t$ignotum: \"file\",\n\t\tformat: value.format,\n\t\tid: fileIdOf(value),\n\t\tname: value.name,\n\t\tsize: value.size\n\t}))\n}));\nconst constrainedFileValue = (formats, maxBytes) => FileValue.pipe(Schema.check(Schema.makeFilter((value) => {\n\tconst issues = [];\n\tif (!formats.includes(value.format)) issues.push({\n\t\tpath: [\"format\"],\n\t\tissue: `File format '${value.format}' is not allowed by this field.`\n\t});\n\tif (value.size > maxBytes) issues.push({\n\t\tpath: [\"size\"],\n\t\tissue: `File size ${value.size} exceeds this field's ${maxBytes} byte limit.`\n\t});\n\treturn issues;\n})));\nconst collectFileOccurrences = (value, path, occurrences) => {\n\tif (isFileValue(value)) {\n\t\toccurrences.push({\n\t\t\tfile: value,\n\t\t\tpath\n\t\t});\n\t\treturn;\n\t}\n\tif (globalThis.Array.isArray(value)) {\n\t\tfor (const [index, child] of value.entries()) collectFileOccurrences(child, [...path, index], occurrences);\n\t\treturn;\n\t}\n\tif (!Predicate.isObject(value) || Predicate.isDate(value)) return;\n\tfor (const [key, child] of Object.entries(value)) collectFileOccurrences(child, [...path, key], occurrences);\n};\nconst fileOccurrencesOf = (value) => {\n\tconst occurrences = [];\n\tcollectFileOccurrences(value, [], occurrences);\n\treturn occurrences;\n};\nconst runtimeFileOccurrencesOf = (value) => fileOccurrencesOf(value).map(({ file, path }) => ({\n\tpath,\n\tfile: {\n\t\tformat: file.format,\n\t\tid: fileIdOf(file),\n\t\tname: file.name,\n\t\tsize: file.size\n\t}\n}));\nconst collectEncodedFileOccurrences = (value, path, occurrences) => {\n\tif (Schema.is(EncodedFileValue)(value)) {\n\t\tconst file = Schema.decodeUnknownSync(EncodedFileValue)(value);\n\t\toccurrences.push({\n\t\t\tpath,\n\t\t\tfile: {\n\t\t\t\tformat: file.format,\n\t\t\t\tid: file.id,\n\t\t\t\tname: file.name,\n\t\t\t\tsize: file.size\n\t\t\t}\n\t\t});\n\t\treturn;\n\t}\n\tif (globalThis.Array.isArray(value)) {\n\t\tfor (const [index, child] of value.entries()) collectEncodedFileOccurrences(child, [...path, index], occurrences);\n\t\treturn;\n\t}\n\tif (!Schema.is(Schema.JsonObject)(value)) return;\n\tfor (const [key, child] of Object.entries(value)) collectEncodedFileOccurrences(child, [...path, key], occurrences);\n};\nconst encodedFileOccurrencesOf = (value) => {\n\tconst occurrences = [];\n\tcollectEncodedFileOccurrences(value, [], occurrences);\n\treturn occurrences;\n};\n//#endregion\nexport { EncodedFileValue, FileFormat, FileGrantToken, FileGrantTypeId, FileId, FilePath, FileUploadToken, FileValue, FileValueTypeId, RuntimeFileMetadata, RuntimeFileOccurrence, constrainedFileValue, encodedFileOccurrencesOf, fileFormats, fileGrantUrlOf, fileIdOf, fileLimits, fileMimeTypes, fileOccurrencesOf, grantFileValue, isFileValue, makeFileValue, runtimeFileOccurrencesOf };\n\n//# sourceMappingURL=file.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,6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