ignotum 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/bin.mjs +825 -403
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/runtime/{api-DzcR7spt.js → api-CAgKDij7.js} +38 -2
- package/dist/runtime/api-CAgKDij7.js.map +1 -0
- package/dist/runtime/{api-5XSrIeqW.d.ts → api-Cv3hMbzo.d.ts} +4 -4
- package/dist/runtime/client.d.ts +39 -9
- package/dist/runtime/client.js +339 -60
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/descriptor-Cyo9FP9n-C0SRVXNW.js +154 -0
- package/dist/runtime/descriptor-Cyo9FP9n-C0SRVXNW.js.map +1 -0
- package/dist/runtime/id-Bt9XWRGL.js +423 -0
- package/dist/runtime/id-Bt9XWRGL.js.map +1 -0
- package/dist/runtime/{id-Cs82tq9Q-CK-maMgN.d.ts → id-BzFHf3Wo-DGPCjgrf.d.ts} +2 -2
- package/dist/runtime/id-Dz0apuB3.d.ts +1 -0
- package/dist/runtime/{index-CrWg4Z0y.d.ts → index-D54flWtH.d.ts} +9 -5
- package/dist/runtime/internal/api.d.ts +1 -1
- package/dist/runtime/internal/api.js +1 -1
- package/dist/runtime/internal/host.d.ts +9 -6
- package/dist/runtime/internal/host.js +15 -6
- 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-D-R9NR61-CpIoHFoI.d.ts → pagination-DnKg3dkI-r5ZUxBBx.d.ts} +31 -6
- package/dist/runtime/pagination-Dz0apuB3.d.ts +1 -0
- package/dist/runtime/result-DKAA4gpS.d.ts +1 -0
- package/dist/runtime/{schema-B9XxyRO8.js → schema-1Zs03-iS.js} +5 -3
- package/dist/runtime/schema-1Zs03-iS.js.map +1 -0
- package/dist/runtime/server.d.ts +6 -4
- package/dist/runtime/server.js +2 -2
- package/dist/runtime/server.js.map +1 -1
- package/dist/runtime/{sync-avN7NkcU.d.ts → sync-Bs8J3fIr.d.ts} +2 -2
- package/package.json +1 -1
- package/src/cli/agent-files.ts +6 -0
- package/src/client/hooks.ts +68 -0
- package/src/client/id.ts +259 -0
- package/src/client/index.ts +5 -2
- package/src/client/sync.ts +143 -10
- package/src/dev-runtime/functions.ts +111 -88
- package/src/dev-runtime/id.ts +175 -0
- package/src/dev-runtime/query-cache.ts +105 -0
- package/src/dev-runtime/sync.ts +149 -17
- package/src/server/index.ts +2 -0
- package/dist/runtime/api-DzcR7spt.js.map +0 -1
- package/dist/runtime/descriptor-XzDX2JDw-j3O6YHgW.js +0 -330
- package/dist/runtime/descriptor-XzDX2JDw-j3O6YHgW.js.map +0 -1
- package/dist/runtime/file-C1abuMgd.js +0 -173
- package/dist/runtime/file-C1abuMgd.js.map +0 -1
- package/dist/runtime/pagination-CX5IPbEi.d.ts +0 -1
- package/dist/runtime/result-DIjKM-p4.d.ts +0 -1
- package/dist/runtime/schema-B9XxyRO8.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-Bt9XWRGL.js","names":["Result"],"sources":["../../../contracts/dist/runtime/id.js","../../../contracts/dist/schema/file.js","../../../contracts/dist/runtime/value.js","../../../contracts/dist/runtime/result.js","../../../contracts/dist/versioned.js","../../../contracts/dist/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 AuthSessionId = defineId(\"ses\", \"ignotum/auth/SessionId\");\nconst AuthAccountId = defineId(\"acct\", \"ignotum/auth/AccountId\");\nconst AuthVerificationId = defineId(\"ver\", \"ignotum/auth/VerificationId\");\nconst AuthMemberId = defineId(\"mbr\", \"ignotum/auth/MemberId\");\nconst AuthInvitationId = defineId(\"invt\", \"ignotum/auth/InvitationId\");\nconst AuthDeviceCodeId = defineId(\"dvc\", \"ignotum/auth/DeviceCodeId\");\nconst AuthInternalId = defineId(\"auth\", \"ignotum/auth/InternalId\");\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\");\nconst IdUserId = defineId(\"iid\", \"ignotum/id/AppUserId\");\nconst IdGlobalUserId = defineId(\"idu\", \"ignotum/id/GlobalUserId\");\nconst IdSessionId = defineId(\"ids\", \"ignotum/id/SessionId\");\nconst IdRequestId = defineId(\"idr\", \"ignotum/id/RequestId\");\nconst SessionEpoch = defineId(\"epoch\", \"ignotum/id/SessionEpoch\");\n//#endregion\nexport { AppId, AuthAccountId, AuthDeviceCodeId, AuthInternalId, AuthInvitationId, AuthMemberId, AuthSessionId, AuthVerificationId, ConnectionId, DeploymentId, DevDatabaseLockId, GeneratedId, IdAlphabet, IdGlobalUserId, IdLength, IdRequestId, IdSessionId, IdUserId, InvocationId, PlatformPrincipalId, RequestId, RuntimeRequestNonce, SessionEpoch, 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","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 TransportValueTypeSchema = Schema.toType(TransportValueSchema);\nconst TransportObjectTypeSchema = Schema.Record(Schema.String, Schema.UndefinedOr(TransportValueTypeSchema));\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(TransportObjectTypeSchema)(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(TransportObjectTypeSchema)(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 { TransportObjectTypeSchema, TransportValueSchema, TransportValueTypeSchema, 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 { ErrorBrand, resultFromEffect } from \"./runtime/result.js\";\nimport { Effect, Schema } from \"effect\";\n//#region src/id.ts\nconst DevelopmentUsername = Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9_-]{0,63}$/));\nconst UserId = DevelopmentUsername.pipe(Schema.brand(\"ignotum/id/UserId\"));\nconst User = Schema.Struct({\n\tid: UserId,\n\tname: Schema.optional(Schema.String),\n\temail: Schema.optional(Schema.String),\n\timage: Schema.optional(Schema.String)\n});\nconst ProfileField = Schema.Literals([\n\t\"name\",\n\t\"email\",\n\t\"image\"\n]);\nconst ProfileFields = Schema.Array(ProfileField).check(Schema.isUnique());\nconst IdRequired = Schema.TaggedStruct(\"IdRequired\", {}).pipe(Schema.brand(ErrorBrand));\nconst makeIdContext = (read) => ({\n\tcurrent: () => resultFromEffect(read),\n\trequire: () => resultFromEffect(read.pipe(Effect.flatMap((user) => user === null ? Effect.fail(IdRequired.make({})) : Effect.succeed(user))))\n});\nconst SessionState = Schema.Struct({\n\tsessionEpoch: Schema.String,\n\tviewRevision: Schema.Natural,\n\tuser: Schema.NullOr(User),\n\tvalidUntil: Schema.Finite\n});\nconst SessionResponse = Schema.Struct({\n\tdevelopment: Schema.optional(Schema.Literal(true)),\n\toutcome: Schema.optional(Schema.Literals([\n\t\t\"SignedIn\",\n\t\t\"ProfileUpdated\",\n\t\t\"Cancelled\"\n\t])),\n\t...SessionState.fields,\n\tserverTime: Schema.Finite,\n\texpiresAt: Schema.Finite\n});\nconst ReturnPath = Schema.String.check(Schema.makeFilter((value) => {\n\tif (!value.startsWith(\"/\") || value.startsWith(\"//\") || value.includes(\"\\\\\")) return false;\n\tconst url = new URL(value, \"https://app.ignotum.invalid\");\n\treturn url.origin === \"https://app.ignotum.invalid\" && url.pathname !== \"/_ignotum\" && !url.pathname.startsWith(\"/_ignotum/\");\n}, { message: \"Return to a path within this app.\" }));\nconst SessionRequest = Schema.Struct({\n\tintent: Schema.Literals([\"signIn\", \"requestProfile\"]),\n\tprofile: ProfileFields,\n\treturnTo: ReturnPath,\n\tsessionEpoch: Schema.String\n});\nconst SessionRedirect = Schema.Struct({\n\tredirectUrl: Schema.String,\n\texpiresAt: Schema.Finite\n});\nconst SessionOutcome = Schema.Literals([\n\t\"SignedIn\",\n\t\"ProfileUpdated\",\n\t\"Cancelled\"\n]);\nconst idLimits = {\n\tsessionMillis: 2592e6,\n\tleaseMillis: 3e4,\n\trefreshMillis: 2e4,\n\trequestMillis: 6e5,\n\tcodeMillis: 6e4,\n\trequestBytes: 16384,\n\tpendingRequests: 5\n};\nconst sessionPath = \"/_ignotum/v1/session\";\nconst sessionRequestsPath = `${sessionPath}/requests`;\nconst sessionCallbackPath = `${sessionPath}/callback`;\nconst sessionCookieName = \"__Host-ignotum-session\";\nconst idImagePath = \"/_ignotum/v1/id/image/\";\nconst idViewKey = (session) => encodeCanonicalJson([session.user, session.viewRevision]);\nconst DevelopmentSelectionV1 = Schema.Struct({\n\tformatVersion: Schema.Literal(1),\n\tusername: Schema.NullOr(DevelopmentUsername),\n\tepoch: Schema.String\n});\nconst DevelopmentSelection = initial(DevelopmentSelectionV1);\nconst developmentSelectionKey = \"ignotum.id.development\";\n//#endregion\nexport { DevelopmentSelection, DevelopmentUsername, IdRequired, ProfileField, ProfileFields, ReturnPath, SessionOutcome, SessionRedirect, SessionRequest, SessionResponse, SessionState, User, UserId, developmentSelectionKey, idImagePath, idLimits, idViewKey, makeIdContext, sessionCallbackPath, sessionCookieName, sessionPath, sessionRequestsPath };\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,OAA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Result$1: {
|
|
|
163
163
|
try: typeof tryResult;
|
|
164
164
|
};
|
|
165
165
|
//#endregion
|
|
166
|
-
//#region ../contracts/dist/id-
|
|
166
|
+
//#region ../contracts/dist/id-BzFHf3Wo.d.ts
|
|
167
167
|
declare const GeneratedId: Schema.brand<Schema.String, "ignotum/id"> & {
|
|
168
168
|
readonly idPrefix: undefined;
|
|
169
169
|
};
|
|
170
170
|
type GeneratedId = typeof GeneratedId.Type;
|
|
171
171
|
//#endregion
|
|
172
172
|
export { fileFormats as _, InternalServerError as a, Result$1 as c, TransportObject as d, TransportValue as f, FileValue as g, FileMimeType as h, ErrorValue as i, SettledResult as l, FileMetadata as m, DocumentNotFoundValue as n, Match as o, FileFormat as p, ErrorBrand as r, QueryResult as s, GeneratedId as t, documentNotFound as u };
|
|
173
|
-
//# sourceMappingURL=id-
|
|
173
|
+
//# sourceMappingURL=id-BzFHf3Wo-DGPCjgrf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./pagination-DnKg3dkI-r5ZUxBBx.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as fileFormats, c as Result$1, g as FileValue, i as ErrorValue, n as DocumentNotFoundValue, p as FileFormat, r as ErrorBrand, t as GeneratedId } from "./id-
|
|
2
|
-
import { a as ValueDescriptor, i as DescriptorField, n as PaginationPage, o as ValueDescriptorCarrier, r as DescribedValue, s as ValueFields, t as PaginationOptions } from "./pagination-
|
|
1
|
+
import { _ as fileFormats, c as Result$1, g as FileValue, i as ErrorValue, n as DocumentNotFoundValue, p as FileFormat, r as ErrorBrand, t as GeneratedId } from "./id-BzFHf3Wo-DGPCjgrf.js";
|
|
2
|
+
import { a as ValueDescriptor, c as IdContext, i as DescriptorField, n as PaginationPage, o as ValueDescriptorCarrier, r as DescribedValue, s as ValueFields, t as PaginationOptions } from "./pagination-DnKg3dkI-r5ZUxBBx.js";
|
|
3
3
|
import { Brand, Effect, Redacted, Schema, Struct } from "effect";
|
|
4
|
-
//#region ../contracts/dist/values-
|
|
4
|
+
//#region ../contracts/dist/values-B4I-91OJ.d.ts
|
|
5
5
|
//#region src/schema/values.d.ts
|
|
6
6
|
declare const IdTargetsTypeId: unique symbol;
|
|
7
7
|
declare const UnresolvedReferencesTypeId: unique symbol;
|
|
@@ -91,6 +91,7 @@ declare const never: () => DescribedValue<Schema.Never>;
|
|
|
91
91
|
declare const nullValue: () => DescribedValue<Schema.Null>;
|
|
92
92
|
declare const literal: <const Value extends LiteralValue>(value: Value) => DescribedValue<Schema.Literal<Value>>;
|
|
93
93
|
declare const literals: <const Members extends readonly [LiteralValue, LiteralValue, ...ReadonlyArray<LiteralValue>]>(...members: Members) => DescribedValue<Schema.Literals<Members>>;
|
|
94
|
+
declare const userId: () => DescribedValue<Schema.brand<Schema.String, "ignotum/id/UserId">>;
|
|
94
95
|
declare const id: <const TableName extends string>(tableName: TableName) => ReferenceDefinition<TableName>;
|
|
95
96
|
declare const array: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.$Array<Value>, Value>;
|
|
96
97
|
declare const object: <const Fields extends ValueFields>(fields: Fields) => ObjectDefinition<Fields>;
|
|
@@ -116,6 +117,7 @@ declare const page: <Value extends DescribedValue>(value: Value) => ObjectDefini
|
|
|
116
117
|
}> & Schema.Schema<PaginationPage<Value["Type"]>>;
|
|
117
118
|
declare const error: <const Tag extends string, const Fields extends ValueFields>(tag: Tag & ErrorTagValidation<Tag>, fields: Fields & ReservedErrorFieldValidation<NoInfer<Fields>>) => ErrorDefinition<Tag, Fields>;
|
|
118
119
|
declare const values: {
|
|
120
|
+
userId: typeof userId;
|
|
119
121
|
array: typeof array;
|
|
120
122
|
boolean: typeof boolean;
|
|
121
123
|
date: typeof date;
|
|
@@ -166,7 +168,7 @@ type BoundValues<Definition extends TableDefinitions> = Omit<typeof values, "id"
|
|
|
166
168
|
readonly pagination: () => ReturnType<typeof pagination> & Schema.Schema<PaginationOptions>;
|
|
167
169
|
};
|
|
168
170
|
//#endregion
|
|
169
|
-
//#region ../contracts/dist/types-
|
|
171
|
+
//#region ../contracts/dist/types-D4UfDuy-.d.ts
|
|
170
172
|
//#region src/schema/environment.d.ts
|
|
171
173
|
declare const EnvironmentDefinitionTypeId: unique symbol;
|
|
172
174
|
declare const EnvironmentDecoderTypeId: unique symbol;
|
|
@@ -314,10 +316,12 @@ interface DatabaseWriter<Definition extends Tables> extends DatabaseReader<Defin
|
|
|
314
316
|
interface QueryContext<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> {
|
|
315
317
|
readonly db: DatabaseReader<Definition>;
|
|
316
318
|
readonly env: EnvironmentType<Environment>;
|
|
319
|
+
readonly id: IdContext;
|
|
317
320
|
}
|
|
318
321
|
interface MutationContext<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> {
|
|
319
322
|
readonly db: DatabaseWriter<Definition>;
|
|
320
323
|
readonly env: EnvironmentType<Environment>;
|
|
324
|
+
readonly id: IdContext;
|
|
321
325
|
}
|
|
322
326
|
type FunctionKind = "Mutation" | "Query";
|
|
323
327
|
type HandlerContext<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv> = Kind extends "Query" ? QueryContext<Definition, Environment> : MutationContext<Definition, Environment>;
|
|
@@ -395,4 +399,4 @@ declare function bindSchema<const Definition extends Tables>(schema: DefinedSche
|
|
|
395
399
|
declare function bindSchema<const Definition extends Tables, const Environment extends DefinedEnv>(schema: DefinedSchema<Definition>, environment: Environment): SchemaBindings<Definition, Environment>;
|
|
396
400
|
//#endregion
|
|
397
401
|
export { DefinedEnv as a, Id as c, defineEnv as d, Secret as f, defineSchema as i, SchemaDefinitionOf as l, SchemaAuthoring as n, Document as o, bindSchema as r, EnvironmentAuthoring as s, DefinedSchema as t, SchemaDefinitionTypeId as u };
|
|
398
|
-
//# sourceMappingURL=index-
|
|
402
|
+
//# sourceMappingURL=index-D54flWtH.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as functionPathOf, i as createApi, n as FunctionReference, r as MutationInput, t as Api } from "../api-
|
|
1
|
+
import { a as functionPathOf, i as createApi, n as FunctionReference, r as MutationInput, t as Api } from "../api-Cv3hMbzo.js";
|
|
2
2
|
export { Api, FunctionReference, MutationInput, createApi, functionPathOf };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as functionPathOf, t as createApi } from "../api-
|
|
1
|
+
import { n as functionPathOf, t as createApi } from "../api-CAgKDij7.js";
|
|
2
2
|
export { createApi, functionPathOf };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { c as Result$1, d as TransportObject, f as TransportValue, i as ErrorValue, u as documentNotFound } from "../id-
|
|
2
|
-
import "../result-
|
|
3
|
-
import "../sync-
|
|
4
|
-
import { n as PaginationPage, t as PaginationOptions } from "../pagination-
|
|
5
|
-
import "../
|
|
1
|
+
import { c as Result$1, d as TransportObject, f as TransportValue, i as ErrorValue, u as documentNotFound } from "../id-BzFHf3Wo-DGPCjgrf.js";
|
|
2
|
+
import "../result-DKAA4gpS.js";
|
|
3
|
+
import "../sync-Bs8J3fIr.js";
|
|
4
|
+
import { c as IdContext, n as PaginationPage, t as PaginationOptions } from "../pagination-DnKg3dkI-r5ZUxBBx.js";
|
|
5
|
+
import "../id-Dz0apuB3.js";
|
|
6
|
+
import "../pagination-Dz0apuB3.js";
|
|
6
7
|
import { Effect, Schema } from "effect";
|
|
7
8
|
//#region ../contracts/dist/runtime/functions.d.ts
|
|
8
9
|
//#region src/runtime/functions.d.ts
|
|
9
10
|
declare const FunctionKind: Schema.Literals<readonly ["Mutation", "Query"]>;
|
|
10
11
|
type FunctionKind = typeof FunctionKind.Type;
|
|
11
12
|
//#endregion
|
|
12
|
-
//#region ../runtime/dist/guest-
|
|
13
|
+
//#region ../runtime/dist/guest-BN_3RI9b.d.ts
|
|
13
14
|
//#region src/guest.d.ts
|
|
14
15
|
interface GuestFunctionDefinition {
|
|
15
16
|
readonly _tag: FunctionKind;
|
|
@@ -52,9 +53,11 @@ interface GuestDatabaseWriter extends GuestDatabaseReader {
|
|
|
52
53
|
}
|
|
53
54
|
interface GuestQueryContext {
|
|
54
55
|
readonly db: GuestDatabaseReader;
|
|
56
|
+
readonly id: IdContext;
|
|
55
57
|
}
|
|
56
58
|
interface GuestMutationContext {
|
|
57
59
|
readonly db: GuestDatabaseWriter;
|
|
60
|
+
readonly id: IdContext;
|
|
58
61
|
}
|
|
59
62
|
declare const invoke: (definition: GuestFunctionDefinition, encodedArgs: Schema.Json, call: GuestHostCall, rawEnvironment?: Readonly<Record<string, string>>) => Promise<string>;
|
|
60
63
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c as getFunctionSchema, o as emptyEnv, r as decodeDefinedEnvironment, s as getFunctionEnvironment, t as SchemaDefinitionTypeId } from "../schema-
|
|
1
|
+
import { C as TransportObjectTypeSchema, S as resultFromEffect, T as datePathsOfObject, V as runtimeFileOccurrencesOf, W as GeneratedId, g as ErrorValueSchema, s as User, u as makeIdContext, v as documentNotFound, w as datePathsOf } from "../id-Bt9XWRGL.js";
|
|
2
|
+
import { o as PaginationCursor, s as PaginationPageSize } from "../descriptor-Cyo9FP9n-C0SRVXNW.js";
|
|
3
|
+
import { c as getFunctionSchema, o as emptyEnv, r as decodeDefinedEnvironment, s as getFunctionEnvironment, t as SchemaDefinitionTypeId } from "../schema-1Zs03-iS.js";
|
|
4
4
|
import { Effect, Predicate, Schema } from "effect";
|
|
5
5
|
//#region ../contracts/dist/runtime/host.js
|
|
6
6
|
const HostDocument = Schema.Struct({
|
|
@@ -74,7 +74,7 @@ const HostReplace = Schema.Struct({
|
|
|
74
74
|
id: GeneratedId,
|
|
75
75
|
fields: Schema.JsonObject
|
|
76
76
|
});
|
|
77
|
-
const
|
|
77
|
+
const DatabaseHostRequest = Schema.Union([
|
|
78
78
|
HostCollect,
|
|
79
79
|
HostQuery,
|
|
80
80
|
HostPaginate,
|
|
@@ -84,6 +84,12 @@ const QuickJsHostRequest = Schema.Union([
|
|
|
84
84
|
HostPatch,
|
|
85
85
|
HostReplace
|
|
86
86
|
]);
|
|
87
|
+
const HostReadId = Schema.Struct({ type: Schema.Literal("ReadId") });
|
|
88
|
+
const QuickJsHostRequest = Schema.Union([DatabaseHostRequest, HostReadId]);
|
|
89
|
+
const HostIdentity = Schema.Struct({
|
|
90
|
+
type: Schema.Literal("Identity"),
|
|
91
|
+
user: Schema.NullOr(User)
|
|
92
|
+
});
|
|
87
93
|
const HostDocuments = Schema.Struct({
|
|
88
94
|
type: Schema.Literal("Documents"),
|
|
89
95
|
documents: Schema.Array(HostDocument)
|
|
@@ -106,6 +112,7 @@ const HostCompleted = Schema.Struct({
|
|
|
106
112
|
found: Schema.Boolean
|
|
107
113
|
});
|
|
108
114
|
Schema.Union([
|
|
115
|
+
HostIdentity,
|
|
109
116
|
HostDocuments,
|
|
110
117
|
HostPage,
|
|
111
118
|
HostFound,
|
|
@@ -119,7 +126,8 @@ const decodeHostResponse = Schema.decodeEffect(Schema.fromJsonString(Schema.Unio
|
|
|
119
126
|
HostPage,
|
|
120
127
|
HostFound,
|
|
121
128
|
HostInserted,
|
|
122
|
-
HostCompleted
|
|
129
|
+
HostCompleted,
|
|
130
|
+
HostIdentity
|
|
123
131
|
])));
|
|
124
132
|
const encodeHostRequest = Schema.encodeSync(Schema.fromJsonString(QuickJsHostRequest));
|
|
125
133
|
const callHost = Effect.fn("Guest.callHost")(function* (call, request) {
|
|
@@ -398,7 +406,8 @@ const runGuest = Effect.fn("Guest.invoke")(function* (definition, encodedArgs, c
|
|
|
398
406
|
const args = yield* Schema.decodeUnknownEffect(Schema.ObjectKeyword)(decodedArgs.value);
|
|
399
407
|
const context = Object.freeze({
|
|
400
408
|
db: definition._tag === "Query" ? makeReader(schema, call) : makeWriter(schema, call),
|
|
401
|
-
env: environment
|
|
409
|
+
env: environment,
|
|
410
|
+
id: makeIdContext(callHost(call, { type: "ReadId" }).pipe(Effect.flatMap((response) => response.type === "Identity" ? Effect.succeed(response.user) : Effect.die("The ID response is invalid."))))
|
|
402
411
|
});
|
|
403
412
|
return yield* Effect.gen(() => definition.handler(context, args)).pipe(Effect.matchEffect({
|
|
404
413
|
onFailure: (error) => encodeFailure(definition, error),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","names":[],"sources":["../../../../contracts/dist/runtime/host.js","../../../../runtime/dist/guest.js"],"sourcesContent":["import { GeneratedId } from \"./id.js\";\nimport { PaginationCursor, PaginationPageSize } from \"./pagination.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/host.ts\nconst HostDocument = Schema.Struct({\n\tid: GeneratedId,\n\tcreatedAt: Schema.Int,\n\tupdatedAt: Schema.Int,\n\tfields: Schema.JsonObject\n});\nconst HostCollect = Schema.Struct({\n\ttype: Schema.Literal(\"Collect\"),\n\ttable: Schema.String\n});\nconst HostIndexComparison = Schema.Struct({\n\tfield: Schema.String,\n\tvalue: Schema.Json\n});\nconst HostIndexRange = Schema.Struct({\n\tequal: Schema.Array(HostIndexComparison),\n\tlower: Schema.optional(Schema.Struct({\n\t\t...HostIndexComparison.fields,\n\t\tinclusive: Schema.Boolean\n\t})),\n\tupper: Schema.optional(Schema.Struct({\n\t\t...HostIndexComparison.fields,\n\t\tinclusive: Schema.Boolean\n\t}))\n});\nconst HostQuery = Schema.Struct({\n\ttype: Schema.Literal(\"Query\"),\n\ttable: Schema.String,\n\tindex: Schema.optional(Schema.String),\n\trange: Schema.optional(HostIndexRange),\n\torder: Schema.Literals([\"Asc\", \"Desc\"]),\n\tlimit: Schema.optional(Schema.Natural)\n});\nconst HostPaginate = Schema.Struct({\n\ttype: Schema.Literal(\"Paginate\"),\n\ttable: Schema.String,\n\tindex: Schema.optional(Schema.String),\n\trange: Schema.optional(HostIndexRange),\n\torder: Schema.Literals([\"Asc\", \"Desc\"]),\n\tpagination: Schema.Struct({\n\t\tcursor: Schema.NullOr(PaginationCursor),\n\t\tpageSize: PaginationPageSize\n\t})\n});\nconst HostFind = Schema.Struct({\n\ttype: Schema.Literal(\"Find\"),\n\ttable: Schema.String,\n\tid: GeneratedId\n});\nconst HostInsert = Schema.Struct({\n\ttype: Schema.Literal(\"Insert\"),\n\ttable: Schema.String,\n\tfields: Schema.JsonObject\n});\nconst HostDelete = Schema.Struct({\n\ttype: Schema.Literal(\"Delete\"),\n\ttable: Schema.String,\n\tid: GeneratedId\n});\nconst HostPatch = Schema.Struct({\n\ttype: Schema.Literal(\"Patch\"),\n\ttable: Schema.String,\n\tid: GeneratedId,\n\tfields: Schema.JsonObject\n});\nconst HostReplace = Schema.Struct({\n\ttype: Schema.Literal(\"Replace\"),\n\ttable: Schema.String,\n\tid: GeneratedId,\n\tfields: Schema.JsonObject\n});\nconst QuickJsHostRequest = Schema.Union([\n\tHostCollect,\n\tHostQuery,\n\tHostPaginate,\n\tHostFind,\n\tHostInsert,\n\tHostDelete,\n\tHostPatch,\n\tHostReplace\n]);\nconst HostDocuments = Schema.Struct({\n\ttype: Schema.Literal(\"Documents\"),\n\tdocuments: Schema.Array(HostDocument)\n});\nconst HostPage = Schema.Struct({\n\ttype: Schema.Literal(\"Page\"),\n\tdocuments: Schema.Array(HostDocument),\n\tnextCursor: Schema.NullOr(PaginationCursor)\n});\nconst HostFound = Schema.Struct({\n\ttype: Schema.Literal(\"Found\"),\n\tdocument: Schema.NullOr(HostDocument)\n});\nconst HostInserted = Schema.Struct({\n\ttype: Schema.Literal(\"Inserted\"),\n\tid: GeneratedId\n});\nconst HostCompleted = Schema.Struct({\n\ttype: Schema.Literal(\"Completed\"),\n\tfound: Schema.Boolean\n});\nconst QuickJsHostResponse = Schema.Union([\n\tHostDocuments,\n\tHostPage,\n\tHostFound,\n\tHostInserted,\n\tHostCompleted\n]);\n//#endregion\nexport { HostCollect, HostCompleted, HostDelete, HostDocument, HostDocuments, HostFind, HostFound, HostIndexComparison, HostIndexRange, HostInsert, HostInserted, HostPage, HostPaginate, HostPatch, HostQuery, HostReplace, QuickJsHostRequest, QuickJsHostResponse };\n\n//# sourceMappingURL=host.js.map","import { HostCompleted, HostDocuments, HostFound, HostInserted, HostPage, QuickJsHostRequest } from \"@ignotum/contracts/runtime/host\";\nimport { runtimeFileOccurrencesOf } from \"@ignotum/contracts/schema/file\";\nimport { GeneratedId } from \"@ignotum/contracts/runtime/id\";\nimport { Effect, Predicate, Schema } from \"effect\";\nimport { ErrorValueSchema, documentNotFound, resultFromEffect } from \"@ignotum/contracts/runtime/result\";\nimport { getFunctionEnvironment, getFunctionSchema } from \"@ignotum/contracts/runtime/schema\";\nimport { SchemaDefinitionTypeId, decodeDefinedEnvironment, emptyEnv } from \"@ignotum/contracts/schema\";\nimport { TransportObjectTypeSchema, datePathsOf, datePathsOfObject } from \"@ignotum/contracts/runtime/value\";\n//#region src/guest.ts\nconst decodeHostResponse = Schema.decodeEffect(Schema.fromJsonString(Schema.Union([\n\tHostDocuments,\n\tHostPage,\n\tHostFound,\n\tHostInserted,\n\tHostCompleted\n])));\nconst encodeHostRequest = Schema.encodeSync(Schema.fromJsonString(QuickJsHostRequest));\nconst callHost = Effect.fn(\"Guest.callHost\")(function* (call, request) {\n\treturn yield* Effect.tryPromise(() => call(encodeHostRequest(request))).pipe(Effect.flatMap(decodeHostResponse), Effect.orDie);\n});\nconst tableFor = (schema, table) => {\n\tconst definition = schema[SchemaDefinitionTypeId][table];\n\tif (definition === void 0) throw new Error(`Unknown database table '${table}'.`);\n\treturn definition;\n};\nconst guestCodec = (schema) => schema;\nconst encodeFields = (schema, table, fields) => {\n\tconst definition = tableFor(schema, table);\n\treturn Schema.decodeUnknownSync(Schema.JsonObject)(Schema.encodeUnknownSync(Schema.toCodecJson(guestCodec(definition.schema)), { onExcessProperty: \"error\" })(fields));\n};\nconst encodePatchFields = (schema, table, fields) => {\n\tconst definition = tableFor(schema, table);\n\treturn Schema.decodeSync(Schema.JsonObject)(Object.fromEntries(Object.entries(fields).map(([name, value]) => {\n\t\tconst field = definition.fields[name];\n\t\tif (field === void 0) throw new Error(`Unknown field '${name}' on table '${table}'.`);\n\t\treturn [name, Schema.encodeUnknownSync(Schema.toCodecJson(guestCodec(field)))(value)];\n\t})));\n};\nconst documentCodec = (schema, table) => guestCodec(Schema.Struct({\n\t...tableFor(schema, table).fields,\n\tid: Schema.String,\n\tcreatedAt: Schema.DateFromMillis,\n\tupdatedAt: Schema.DateFromMillis\n}));\nconst decodeDocument = (schema, table, document) => Schema.decodeUnknownSync(TransportObjectTypeSchema)(Schema.decodeSync(Schema.toCodecJson(documentCodec(schema, table)))({\n\t...document.fields,\n\tid: document.id,\n\tcreatedAt: document.createdAt,\n\tupdatedAt: document.updatedAt\n}));\nconst expectResponse = (response, tag) => {\n\tif (response.type !== tag) throw new Error(`Unexpected host response '${response.type}'.`);\n\treturn response;\n};\nconst makeReader = (schema, call) => {\n\tconst findEffect = (table, id) => callHost(call, {\n\t\ttype: \"Find\",\n\t\ttable,\n\t\tid: GeneratedId.make(id)\n\t}).pipe(Effect.map((response) => expectResponse(response, \"Found\")), Effect.map(({ document }) => document === null ? void 0 : decodeDocument(schema, table, document)));\n\tconst query = (table, selectedIndex, selectedRange, order = \"Asc\") => {\n\t\tconst definition = tableFor(schema, table);\n\t\tconst encodeIndexValue = (field, value) => {\n\t\t\tconst codec = field === \"createdAt\" ? Schema.DateFromMillis : field === \"id\" ? GeneratedId : definition.fields[field];\n\t\t\tif (codec === void 0) throw new Error(`Unknown index field '${field}'.`);\n\t\t\treturn Schema.decodeUnknownSync(Schema.Json)(Schema.encodeUnknownSync(guestCodec(codec))(value));\n\t\t};\n\t\tconst execute = (limit) => {\n\t\t\tconst request = selectedIndex === void 0 ? {\n\t\t\t\ttype: \"Query\",\n\t\t\t\ttable,\n\t\t\t\torder\n\t\t\t} : selectedRange === void 0 ? {\n\t\t\t\ttype: \"Query\",\n\t\t\t\ttable,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\torder\n\t\t\t} : {\n\t\t\t\ttype: \"Query\",\n\t\t\t\ttable,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\trange: selectedRange,\n\t\t\t\torder\n\t\t\t};\n\t\t\treturn callHost(call, limit === void 0 ? request : {\n\t\t\t\t...request,\n\t\t\t\tlimit\n\t\t\t}).pipe(Effect.map((response) => expectResponse(response, \"Documents\")), Effect.map(({ documents }) => documents.map((document) => decodeDocument(schema, table, document))));\n\t\t};\n\t\tconst executePage = (pagination) => {\n\t\t\treturn callHost(call, selectedIndex === void 0 ? {\n\t\t\t\ttype: \"Paginate\",\n\t\t\t\ttable,\n\t\t\t\torder,\n\t\t\t\tpagination\n\t\t\t} : selectedRange === void 0 ? {\n\t\t\t\ttype: \"Paginate\",\n\t\t\t\ttable,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\torder,\n\t\t\t\tpagination\n\t\t\t} : {\n\t\t\t\ttype: \"Paginate\",\n\t\t\t\ttable,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\trange: selectedRange,\n\t\t\t\torder,\n\t\t\t\tpagination\n\t\t\t}).pipe(Effect.map((response) => expectResponse(response, \"Page\")), Effect.map(({ documents, nextCursor }) => ({\n\t\t\t\titems: documents.map((document) => decodeDocument(schema, table, document)),\n\t\t\t\tnextCursor\n\t\t\t})));\n\t\t};\n\t\tconst validateLimit = (count) => {\n\t\t\tif (!Number.isInteger(count) || count < 0 || count > 1e3) throw new Error(\"Query limits must be integers between 0 and 1000.\");\n\t\t\treturn count;\n\t\t};\n\t\treturn Object.freeze({\n\t\t\tindex: (name, buildRange) => {\n\t\t\t\tif (selectedIndex !== void 0) throw new Error(\"A query can select only one index.\");\n\t\t\t\tconst index = definition.indexes[name];\n\t\t\t\tif (index === void 0) throw new Error(`Unknown index '${name}' on table '${table}'.`);\n\t\t\t\tif (buildRange === void 0) return query(table, name, void 0, order);\n\t\t\t\tconst fields = [\n\t\t\t\t\t...index.fields,\n\t\t\t\t\t\"createdAt\",\n\t\t\t\t\t\"id\"\n\t\t\t\t];\n\t\t\t\tconst range = { equal: [] };\n\t\t\t\tlet position = 0;\n\t\t\t\tlet boundedField;\n\t\t\t\tconst expectField = (field) => {\n\t\t\t\t\tconst expected = fields[position];\n\t\t\t\t\tif (field !== expected) throw new Error(`Expected index field '${expected}', received '${field}'.`);\n\t\t\t\t};\n\t\t\t\tconst builder = {\n\t\t\t\t\teq: (field, value) => {\n\t\t\t\t\t\tif (boundedField !== void 0) throw new Error(\"Equality cannot follow an index bound.\");\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\trange.equal.push({\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value)\n\t\t\t\t\t\t});\n\t\t\t\t\t\tposition += 1;\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t},\n\t\t\t\t\tgt: (field, value) => {\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\tif (range.lower !== void 0) throw new Error(\"An index range has only one lower bound.\");\n\t\t\t\t\t\tboundedField = field;\n\t\t\t\t\t\trange.lower = {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value),\n\t\t\t\t\t\t\tinclusive: false\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t},\n\t\t\t\t\tgte: (field, value) => {\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\tif (range.lower !== void 0) throw new Error(\"An index range has only one lower bound.\");\n\t\t\t\t\t\tboundedField = field;\n\t\t\t\t\t\trange.lower = {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value),\n\t\t\t\t\t\t\tinclusive: true\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t},\n\t\t\t\t\tlt: (field, value) => {\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\tif (range.upper !== void 0) throw new Error(\"An index range has only one upper bound.\");\n\t\t\t\t\t\tboundedField = field;\n\t\t\t\t\t\trange.upper = {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value),\n\t\t\t\t\t\t\tinclusive: false\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t},\n\t\t\t\t\tlte: (field, value) => {\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\tif (range.upper !== void 0) throw new Error(\"An index range has only one upper bound.\");\n\t\t\t\t\t\tboundedField = field;\n\t\t\t\t\t\trange.upper = {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value),\n\t\t\t\t\t\t\tinclusive: true\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst built = buildRange(builder);\n\t\t\t\tif (!Predicate.isObject(built)) throw new Error(\"An index range callback must return its builder.\");\n\t\t\t\treturn query(table, name, range, order);\n\t\t\t},\n\t\t\torder: (direction) => query(table, selectedIndex, selectedRange, direction === \"asc\" ? \"Asc\" : \"Desc\"),\n\t\t\tcollect: () => resultFromEffect(execute()),\n\t\t\ttake: (count) => resultFromEffect(execute(validateLimit(count))),\n\t\t\tfirst: () => resultFromEffect(execute(1).pipe(Effect.map((documents) => documents[0]))),\n\t\t\tunique: () => resultFromEffect(execute(2).pipe(Effect.flatMap((documents) => documents.length > 1 ? Effect.die(/* @__PURE__ */ new Error(\"A unique database query matched more than one document.\")) : Effect.succeed(documents[0])))),\n\t\t\tpaginate: (options) => resultFromEffect(executePage(options))\n\t\t});\n\t};\n\treturn Object.freeze({\n\t\tfind: (table, id) => resultFromEffect(findEffect(table, id)),\n\t\tget: (table, id) => resultFromEffect(findEffect(table, id).pipe(Effect.flatMap((document) => document === void 0 ? Effect.fail(documentNotFound(table, id)) : Effect.succeed(document)))),\n\t\tquery: (table) => query(table)\n\t});\n};\nconst makeWriter = (schema, call) => {\n\tconst reader = makeReader(schema, call);\n\tconst complete = Effect.fn(\"Guest.completeWrite\")(function* (table, id, request) {\n\t\tif (expectResponse(yield* callHost(call, request), \"Completed\").found === false) return yield* Effect.fail(documentNotFound(table, id));\n\t});\n\tconst writer = {\n\t\t...reader,\n\t\tdelete: (table, id) => resultFromEffect(complete(table, id, {\n\t\t\ttype: \"Delete\",\n\t\t\ttable,\n\t\t\tid: GeneratedId.make(id)\n\t\t})),\n\t\tinsert: (table, value) => resultFromEffect(callHost(call, {\n\t\t\ttype: \"Insert\",\n\t\t\ttable,\n\t\t\tfields: encodeFields(schema, table, value)\n\t\t}).pipe(Effect.map((response) => expectResponse(response, \"Inserted\").id))),\n\t\tpatch: (table, id, value) => resultFromEffect(complete(table, id, {\n\t\t\ttype: \"Patch\",\n\t\t\ttable,\n\t\t\tid: GeneratedId.make(id),\n\t\t\tfields: encodePatchFields(schema, table, value)\n\t\t})),\n\t\treplace: (table, id, value) => resultFromEffect(complete(table, id, {\n\t\t\ttype: \"Replace\",\n\t\t\ttable,\n\t\t\tid: GeneratedId.make(id),\n\t\t\tfields: encodeFields(schema, table, value)\n\t\t}))\n\t};\n\treturn Object.freeze(writer);\n};\nconst encodeSuccess = Effect.fn(\"Guest.encodeSuccess\")(function* (definition, value) {\n\tif (definition.returns === void 0) {\n\t\tyield* Schema.encodeUnknownEffect(Schema.Undefined)(value);\n\t\treturn { type: \"Success\" };\n\t}\n\tconst encoded = yield* Schema.encodeUnknownEffect(Schema.toCodecJson(definition.returns))(value);\n\tconst files = runtimeFileOccurrencesOf(value);\n\tconst result = files.length === 0 ? {\n\t\ttype: \"Success\",\n\t\tvalue: encoded\n\t} : {\n\t\ttype: \"Success\",\n\t\tvalue: encoded,\n\t\tfiles\n\t};\n\tconst dates = datePathsOf(value);\n\treturn dates.length === 0 ? result : {\n\t\t...result,\n\t\tdates\n\t};\n});\nconst encodeFailure = Effect.fn(\"Guest.encodeFailure\")(function* (definition, error) {\n\tconst result = {\n\t\ttype: \"Failure\",\n\t\terror: yield* Schema.encodeUnknownEffect(Schema.toCodecJson(definition.errors ?? ErrorValueSchema))(error)\n\t};\n\tconst dates = datePathsOfObject(error);\n\treturn dates.length === 0 ? result : {\n\t\t...result,\n\t\tdates\n\t};\n});\nconst runGuest = Effect.fn(\"Guest.invoke\")(function* (definition, encodedArgs, call, rawEnvironment) {\n\tconst schema = getFunctionSchema(definition);\n\tif (schema === void 0) return yield* Effect.die(\"The function has no bound schema.\");\n\tconst environmentDefinition = getFunctionEnvironment(definition) ?? emptyEnv;\n\tconst environment = yield* decodeDefinedEnvironment(environmentDefinition, rawEnvironment).pipe(Effect.mapError(() => /* @__PURE__ */ new Error(\"The deployment environment is invalid.\")));\n\tconst decodedArgs = yield* Schema.decodeEffect(Schema.toCodecJson(guestCodec(Schema.Struct(definition.args ?? {}))))(encodedArgs).pipe(Effect.match({\n\t\tonFailure: () => ({ valid: false }),\n\t\tonSuccess: (value) => ({\n\t\t\tvalid: true,\n\t\t\tvalue\n\t\t})\n\t}));\n\tif (!decodedArgs.valid) return {\n\t\ttype: \"InvocationRejected\",\n\t\tcode: \"InvalidArguments\",\n\t\tmessage: \"The invocation arguments do not match the function definition.\"\n\t};\n\tconst args = yield* Schema.decodeUnknownEffect(Schema.ObjectKeyword)(decodedArgs.value);\n\tconst context = Object.freeze({\n\t\tdb: definition._tag === \"Query\" ? makeReader(schema, call) : makeWriter(schema, call),\n\t\tenv: environment\n\t});\n\treturn yield* Effect.gen(() => definition.handler(context, args)).pipe(Effect.matchEffect({\n\t\tonFailure: (error) => encodeFailure(definition, error),\n\t\tonSuccess: (value) => encodeSuccess(definition, value)\n\t}));\n});\nconst invoke = (definition, encodedArgs, call, rawEnvironment = {}) => Effect.runPromise(runGuest(definition, encodedArgs, call, rawEnvironment)).then((result) => Schema.encodeSync(Schema.fromJsonString(Schema.Json))(result));\n//#endregion\nexport { invoke };\n\n//# sourceMappingURL=guest.js.map"],"mappings":";;;;;AAIA,MAAM,eAAe,OAAO,OAAO;CAClC,IAAI;CACJ,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,QAAQ,OAAO;AAChB,C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C,CAAC,MAAM,WAAW,OAAO,WAAW,OAAO,eAAe,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"host.js","names":[],"sources":["../../../../contracts/dist/runtime/host.js","../../../../runtime/dist/guest.js"],"sourcesContent":["import { GeneratedId } from \"./id.js\";\nimport { User } from \"../id.js\";\nimport { PaginationCursor, PaginationPageSize } from \"./pagination.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/host.ts\nconst HostDocument = Schema.Struct({\n\tid: GeneratedId,\n\tcreatedAt: Schema.Int,\n\tupdatedAt: Schema.Int,\n\tfields: Schema.JsonObject\n});\nconst HostCollect = Schema.Struct({\n\ttype: Schema.Literal(\"Collect\"),\n\ttable: Schema.String\n});\nconst HostIndexComparison = Schema.Struct({\n\tfield: Schema.String,\n\tvalue: Schema.Json\n});\nconst HostIndexRange = Schema.Struct({\n\tequal: Schema.Array(HostIndexComparison),\n\tlower: Schema.optional(Schema.Struct({\n\t\t...HostIndexComparison.fields,\n\t\tinclusive: Schema.Boolean\n\t})),\n\tupper: Schema.optional(Schema.Struct({\n\t\t...HostIndexComparison.fields,\n\t\tinclusive: Schema.Boolean\n\t}))\n});\nconst HostQuery = Schema.Struct({\n\ttype: Schema.Literal(\"Query\"),\n\ttable: Schema.String,\n\tindex: Schema.optional(Schema.String),\n\trange: Schema.optional(HostIndexRange),\n\torder: Schema.Literals([\"Asc\", \"Desc\"]),\n\tlimit: Schema.optional(Schema.Natural)\n});\nconst HostPaginate = Schema.Struct({\n\ttype: Schema.Literal(\"Paginate\"),\n\ttable: Schema.String,\n\tindex: Schema.optional(Schema.String),\n\trange: Schema.optional(HostIndexRange),\n\torder: Schema.Literals([\"Asc\", \"Desc\"]),\n\tpagination: Schema.Struct({\n\t\tcursor: Schema.NullOr(PaginationCursor),\n\t\tpageSize: PaginationPageSize\n\t})\n});\nconst HostFind = Schema.Struct({\n\ttype: Schema.Literal(\"Find\"),\n\ttable: Schema.String,\n\tid: GeneratedId\n});\nconst HostInsert = Schema.Struct({\n\ttype: Schema.Literal(\"Insert\"),\n\ttable: Schema.String,\n\tfields: Schema.JsonObject\n});\nconst HostDelete = Schema.Struct({\n\ttype: Schema.Literal(\"Delete\"),\n\ttable: Schema.String,\n\tid: GeneratedId\n});\nconst HostPatch = Schema.Struct({\n\ttype: Schema.Literal(\"Patch\"),\n\ttable: Schema.String,\n\tid: GeneratedId,\n\tfields: Schema.JsonObject\n});\nconst HostReplace = Schema.Struct({\n\ttype: Schema.Literal(\"Replace\"),\n\ttable: Schema.String,\n\tid: GeneratedId,\n\tfields: Schema.JsonObject\n});\nconst DatabaseHostRequest = Schema.Union([\n\tHostCollect,\n\tHostQuery,\n\tHostPaginate,\n\tHostFind,\n\tHostInsert,\n\tHostDelete,\n\tHostPatch,\n\tHostReplace\n]);\nconst HostReadId = Schema.Struct({ type: Schema.Literal(\"ReadId\") });\nconst QuickJsHostRequest = Schema.Union([DatabaseHostRequest, HostReadId]);\nconst HostIdentity = Schema.Struct({\n\ttype: Schema.Literal(\"Identity\"),\n\tuser: Schema.NullOr(User)\n});\nconst HostDocuments = Schema.Struct({\n\ttype: Schema.Literal(\"Documents\"),\n\tdocuments: Schema.Array(HostDocument)\n});\nconst HostPage = Schema.Struct({\n\ttype: Schema.Literal(\"Page\"),\n\tdocuments: Schema.Array(HostDocument),\n\tnextCursor: Schema.NullOr(PaginationCursor)\n});\nconst HostFound = Schema.Struct({\n\ttype: Schema.Literal(\"Found\"),\n\tdocument: Schema.NullOr(HostDocument)\n});\nconst HostInserted = Schema.Struct({\n\ttype: Schema.Literal(\"Inserted\"),\n\tid: GeneratedId\n});\nconst HostCompleted = Schema.Struct({\n\ttype: Schema.Literal(\"Completed\"),\n\tfound: Schema.Boolean\n});\nconst QuickJsHostResponse = Schema.Union([\n\tHostIdentity,\n\tHostDocuments,\n\tHostPage,\n\tHostFound,\n\tHostInserted,\n\tHostCompleted\n]);\n//#endregion\nexport { DatabaseHostRequest, HostCollect, HostCompleted, HostDelete, HostDocument, HostDocuments, HostFind, HostFound, HostIdentity, HostIndexComparison, HostIndexRange, HostInsert, HostInserted, HostPage, HostPaginate, HostPatch, HostQuery, HostReadId, HostReplace, QuickJsHostRequest, QuickJsHostResponse };\n\n//# sourceMappingURL=host.js.map","import { HostCompleted, HostDocuments, HostFound, HostIdentity, HostInserted, HostPage, QuickJsHostRequest } from \"@ignotum/contracts/runtime/host\";\nimport { runtimeFileOccurrencesOf } from \"@ignotum/contracts/schema/file\";\nimport { GeneratedId } from \"@ignotum/contracts/runtime/id\";\nimport { Effect, Predicate, Schema } from \"effect\";\nimport { makeIdContext } from \"@ignotum/contracts/id\";\nimport { ErrorValueSchema, documentNotFound, resultFromEffect } from \"@ignotum/contracts/runtime/result\";\nimport { getFunctionEnvironment, getFunctionSchema } from \"@ignotum/contracts/runtime/schema\";\nimport { SchemaDefinitionTypeId, decodeDefinedEnvironment, emptyEnv } from \"@ignotum/contracts/schema\";\nimport { TransportObjectTypeSchema, datePathsOf, datePathsOfObject } from \"@ignotum/contracts/runtime/value\";\n//#region src/guest.ts\nconst decodeHostResponse = Schema.decodeEffect(Schema.fromJsonString(Schema.Union([\n\tHostDocuments,\n\tHostPage,\n\tHostFound,\n\tHostInserted,\n\tHostCompleted,\n\tHostIdentity\n])));\nconst encodeHostRequest = Schema.encodeSync(Schema.fromJsonString(QuickJsHostRequest));\nconst callHost = Effect.fn(\"Guest.callHost\")(function* (call, request) {\n\treturn yield* Effect.tryPromise(() => call(encodeHostRequest(request))).pipe(Effect.flatMap(decodeHostResponse), Effect.orDie);\n});\nconst tableFor = (schema, table) => {\n\tconst definition = schema[SchemaDefinitionTypeId][table];\n\tif (definition === void 0) throw new Error(`Unknown database table '${table}'.`);\n\treturn definition;\n};\nconst guestCodec = (schema) => schema;\nconst encodeFields = (schema, table, fields) => {\n\tconst definition = tableFor(schema, table);\n\treturn Schema.decodeUnknownSync(Schema.JsonObject)(Schema.encodeUnknownSync(Schema.toCodecJson(guestCodec(definition.schema)), { onExcessProperty: \"error\" })(fields));\n};\nconst encodePatchFields = (schema, table, fields) => {\n\tconst definition = tableFor(schema, table);\n\treturn Schema.decodeSync(Schema.JsonObject)(Object.fromEntries(Object.entries(fields).map(([name, value]) => {\n\t\tconst field = definition.fields[name];\n\t\tif (field === void 0) throw new Error(`Unknown field '${name}' on table '${table}'.`);\n\t\treturn [name, Schema.encodeUnknownSync(Schema.toCodecJson(guestCodec(field)))(value)];\n\t})));\n};\nconst documentCodec = (schema, table) => guestCodec(Schema.Struct({\n\t...tableFor(schema, table).fields,\n\tid: Schema.String,\n\tcreatedAt: Schema.DateFromMillis,\n\tupdatedAt: Schema.DateFromMillis\n}));\nconst decodeDocument = (schema, table, document) => Schema.decodeUnknownSync(TransportObjectTypeSchema)(Schema.decodeSync(Schema.toCodecJson(documentCodec(schema, table)))({\n\t...document.fields,\n\tid: document.id,\n\tcreatedAt: document.createdAt,\n\tupdatedAt: document.updatedAt\n}));\nconst expectResponse = (response, tag) => {\n\tif (response.type !== tag) throw new Error(`Unexpected host response '${response.type}'.`);\n\treturn response;\n};\nconst makeReader = (schema, call) => {\n\tconst findEffect = (table, id) => callHost(call, {\n\t\ttype: \"Find\",\n\t\ttable,\n\t\tid: GeneratedId.make(id)\n\t}).pipe(Effect.map((response) => expectResponse(response, \"Found\")), Effect.map(({ document }) => document === null ? void 0 : decodeDocument(schema, table, document)));\n\tconst query = (table, selectedIndex, selectedRange, order = \"Asc\") => {\n\t\tconst definition = tableFor(schema, table);\n\t\tconst encodeIndexValue = (field, value) => {\n\t\t\tconst codec = field === \"createdAt\" ? Schema.DateFromMillis : field === \"id\" ? GeneratedId : definition.fields[field];\n\t\t\tif (codec === void 0) throw new Error(`Unknown index field '${field}'.`);\n\t\t\treturn Schema.decodeUnknownSync(Schema.Json)(Schema.encodeUnknownSync(guestCodec(codec))(value));\n\t\t};\n\t\tconst execute = (limit) => {\n\t\t\tconst request = selectedIndex === void 0 ? {\n\t\t\t\ttype: \"Query\",\n\t\t\t\ttable,\n\t\t\t\torder\n\t\t\t} : selectedRange === void 0 ? {\n\t\t\t\ttype: \"Query\",\n\t\t\t\ttable,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\torder\n\t\t\t} : {\n\t\t\t\ttype: \"Query\",\n\t\t\t\ttable,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\trange: selectedRange,\n\t\t\t\torder\n\t\t\t};\n\t\t\treturn callHost(call, limit === void 0 ? request : {\n\t\t\t\t...request,\n\t\t\t\tlimit\n\t\t\t}).pipe(Effect.map((response) => expectResponse(response, \"Documents\")), Effect.map(({ documents }) => documents.map((document) => decodeDocument(schema, table, document))));\n\t\t};\n\t\tconst executePage = (pagination) => {\n\t\t\treturn callHost(call, selectedIndex === void 0 ? {\n\t\t\t\ttype: \"Paginate\",\n\t\t\t\ttable,\n\t\t\t\torder,\n\t\t\t\tpagination\n\t\t\t} : selectedRange === void 0 ? {\n\t\t\t\ttype: \"Paginate\",\n\t\t\t\ttable,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\torder,\n\t\t\t\tpagination\n\t\t\t} : {\n\t\t\t\ttype: \"Paginate\",\n\t\t\t\ttable,\n\t\t\t\tindex: selectedIndex,\n\t\t\t\trange: selectedRange,\n\t\t\t\torder,\n\t\t\t\tpagination\n\t\t\t}).pipe(Effect.map((response) => expectResponse(response, \"Page\")), Effect.map(({ documents, nextCursor }) => ({\n\t\t\t\titems: documents.map((document) => decodeDocument(schema, table, document)),\n\t\t\t\tnextCursor\n\t\t\t})));\n\t\t};\n\t\tconst validateLimit = (count) => {\n\t\t\tif (!Number.isInteger(count) || count < 0 || count > 1e3) throw new Error(\"Query limits must be integers between 0 and 1000.\");\n\t\t\treturn count;\n\t\t};\n\t\treturn Object.freeze({\n\t\t\tindex: (name, buildRange) => {\n\t\t\t\tif (selectedIndex !== void 0) throw new Error(\"A query can select only one index.\");\n\t\t\t\tconst index = definition.indexes[name];\n\t\t\t\tif (index === void 0) throw new Error(`Unknown index '${name}' on table '${table}'.`);\n\t\t\t\tif (buildRange === void 0) return query(table, name, void 0, order);\n\t\t\t\tconst fields = [\n\t\t\t\t\t...index.fields,\n\t\t\t\t\t\"createdAt\",\n\t\t\t\t\t\"id\"\n\t\t\t\t];\n\t\t\t\tconst range = { equal: [] };\n\t\t\t\tlet position = 0;\n\t\t\t\tlet boundedField;\n\t\t\t\tconst expectField = (field) => {\n\t\t\t\t\tconst expected = fields[position];\n\t\t\t\t\tif (field !== expected) throw new Error(`Expected index field '${expected}', received '${field}'.`);\n\t\t\t\t};\n\t\t\t\tconst builder = {\n\t\t\t\t\teq: (field, value) => {\n\t\t\t\t\t\tif (boundedField !== void 0) throw new Error(\"Equality cannot follow an index bound.\");\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\trange.equal.push({\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value)\n\t\t\t\t\t\t});\n\t\t\t\t\t\tposition += 1;\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t},\n\t\t\t\t\tgt: (field, value) => {\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\tif (range.lower !== void 0) throw new Error(\"An index range has only one lower bound.\");\n\t\t\t\t\t\tboundedField = field;\n\t\t\t\t\t\trange.lower = {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value),\n\t\t\t\t\t\t\tinclusive: false\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t},\n\t\t\t\t\tgte: (field, value) => {\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\tif (range.lower !== void 0) throw new Error(\"An index range has only one lower bound.\");\n\t\t\t\t\t\tboundedField = field;\n\t\t\t\t\t\trange.lower = {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value),\n\t\t\t\t\t\t\tinclusive: true\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t},\n\t\t\t\t\tlt: (field, value) => {\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\tif (range.upper !== void 0) throw new Error(\"An index range has only one upper bound.\");\n\t\t\t\t\t\tboundedField = field;\n\t\t\t\t\t\trange.upper = {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value),\n\t\t\t\t\t\t\tinclusive: false\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t},\n\t\t\t\t\tlte: (field, value) => {\n\t\t\t\t\t\texpectField(field);\n\t\t\t\t\t\tif (range.upper !== void 0) throw new Error(\"An index range has only one upper bound.\");\n\t\t\t\t\t\tboundedField = field;\n\t\t\t\t\t\trange.upper = {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tvalue: encodeIndexValue(field, value),\n\t\t\t\t\t\t\tinclusive: true\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn builder;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst built = buildRange(builder);\n\t\t\t\tif (!Predicate.isObject(built)) throw new Error(\"An index range callback must return its builder.\");\n\t\t\t\treturn query(table, name, range, order);\n\t\t\t},\n\t\t\torder: (direction) => query(table, selectedIndex, selectedRange, direction === \"asc\" ? \"Asc\" : \"Desc\"),\n\t\t\tcollect: () => resultFromEffect(execute()),\n\t\t\ttake: (count) => resultFromEffect(execute(validateLimit(count))),\n\t\t\tfirst: () => resultFromEffect(execute(1).pipe(Effect.map((documents) => documents[0]))),\n\t\t\tunique: () => resultFromEffect(execute(2).pipe(Effect.flatMap((documents) => documents.length > 1 ? Effect.die(/* @__PURE__ */ new Error(\"A unique database query matched more than one document.\")) : Effect.succeed(documents[0])))),\n\t\t\tpaginate: (options) => resultFromEffect(executePage(options))\n\t\t});\n\t};\n\treturn Object.freeze({\n\t\tfind: (table, id) => resultFromEffect(findEffect(table, id)),\n\t\tget: (table, id) => resultFromEffect(findEffect(table, id).pipe(Effect.flatMap((document) => document === void 0 ? Effect.fail(documentNotFound(table, id)) : Effect.succeed(document)))),\n\t\tquery: (table) => query(table)\n\t});\n};\nconst makeWriter = (schema, call) => {\n\tconst reader = makeReader(schema, call);\n\tconst complete = Effect.fn(\"Guest.completeWrite\")(function* (table, id, request) {\n\t\tif (expectResponse(yield* callHost(call, request), \"Completed\").found === false) return yield* Effect.fail(documentNotFound(table, id));\n\t});\n\tconst writer = {\n\t\t...reader,\n\t\tdelete: (table, id) => resultFromEffect(complete(table, id, {\n\t\t\ttype: \"Delete\",\n\t\t\ttable,\n\t\t\tid: GeneratedId.make(id)\n\t\t})),\n\t\tinsert: (table, value) => resultFromEffect(callHost(call, {\n\t\t\ttype: \"Insert\",\n\t\t\ttable,\n\t\t\tfields: encodeFields(schema, table, value)\n\t\t}).pipe(Effect.map((response) => expectResponse(response, \"Inserted\").id))),\n\t\tpatch: (table, id, value) => resultFromEffect(complete(table, id, {\n\t\t\ttype: \"Patch\",\n\t\t\ttable,\n\t\t\tid: GeneratedId.make(id),\n\t\t\tfields: encodePatchFields(schema, table, value)\n\t\t})),\n\t\treplace: (table, id, value) => resultFromEffect(complete(table, id, {\n\t\t\ttype: \"Replace\",\n\t\t\ttable,\n\t\t\tid: GeneratedId.make(id),\n\t\t\tfields: encodeFields(schema, table, value)\n\t\t}))\n\t};\n\treturn Object.freeze(writer);\n};\nconst encodeSuccess = Effect.fn(\"Guest.encodeSuccess\")(function* (definition, value) {\n\tif (definition.returns === void 0) {\n\t\tyield* Schema.encodeUnknownEffect(Schema.Undefined)(value);\n\t\treturn { type: \"Success\" };\n\t}\n\tconst encoded = yield* Schema.encodeUnknownEffect(Schema.toCodecJson(definition.returns))(value);\n\tconst files = runtimeFileOccurrencesOf(value);\n\tconst result = files.length === 0 ? {\n\t\ttype: \"Success\",\n\t\tvalue: encoded\n\t} : {\n\t\ttype: \"Success\",\n\t\tvalue: encoded,\n\t\tfiles\n\t};\n\tconst dates = datePathsOf(value);\n\treturn dates.length === 0 ? result : {\n\t\t...result,\n\t\tdates\n\t};\n});\nconst encodeFailure = Effect.fn(\"Guest.encodeFailure\")(function* (definition, error) {\n\tconst result = {\n\t\ttype: \"Failure\",\n\t\terror: yield* Schema.encodeUnknownEffect(Schema.toCodecJson(definition.errors ?? ErrorValueSchema))(error)\n\t};\n\tconst dates = datePathsOfObject(error);\n\treturn dates.length === 0 ? result : {\n\t\t...result,\n\t\tdates\n\t};\n});\nconst runGuest = Effect.fn(\"Guest.invoke\")(function* (definition, encodedArgs, call, rawEnvironment) {\n\tconst schema = getFunctionSchema(definition);\n\tif (schema === void 0) return yield* Effect.die(\"The function has no bound schema.\");\n\tconst environmentDefinition = getFunctionEnvironment(definition) ?? emptyEnv;\n\tconst environment = yield* decodeDefinedEnvironment(environmentDefinition, rawEnvironment).pipe(Effect.mapError(() => /* @__PURE__ */ new Error(\"The deployment environment is invalid.\")));\n\tconst decodedArgs = yield* Schema.decodeEffect(Schema.toCodecJson(guestCodec(Schema.Struct(definition.args ?? {}))))(encodedArgs).pipe(Effect.match({\n\t\tonFailure: () => ({ valid: false }),\n\t\tonSuccess: (value) => ({\n\t\t\tvalid: true,\n\t\t\tvalue\n\t\t})\n\t}));\n\tif (!decodedArgs.valid) return {\n\t\ttype: \"InvocationRejected\",\n\t\tcode: \"InvalidArguments\",\n\t\tmessage: \"The invocation arguments do not match the function definition.\"\n\t};\n\tconst args = yield* Schema.decodeUnknownEffect(Schema.ObjectKeyword)(decodedArgs.value);\n\tconst context = Object.freeze({\n\t\tdb: definition._tag === \"Query\" ? makeReader(schema, call) : makeWriter(schema, call),\n\t\tenv: environment,\n\t\tid: makeIdContext(callHost(call, { type: \"ReadId\" }).pipe(Effect.flatMap((response) => response.type === \"Identity\" ? Effect.succeed(response.user) : Effect.die(\"The ID response is invalid.\"))))\n\t});\n\treturn yield* Effect.gen(() => definition.handler(context, args)).pipe(Effect.matchEffect({\n\t\tonFailure: (error) => encodeFailure(definition, error),\n\t\tonSuccess: (value) => encodeSuccess(definition, value)\n\t}));\n});\nconst invoke = (definition, encodedArgs, call, rawEnvironment = {}) => Effect.runPromise(runGuest(definition, encodedArgs, call, rawEnvironment)).then((result) => Schema.encodeSync(Schema.fromJsonString(Schema.Json))(result));\n//#endregion\nexport { invoke };\n\n//# sourceMappingURL=guest.js.map"],"mappings":";;;;;AAKA,MAAM,eAAe,OAAO,OAAO;CAClC,IAAI;CACJ,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,QAAQ,OAAO;AAChB,CAAC;AACD,MAAM,cAAc,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,SAAS;CAC9B,OAAO,OAAO;AACf,CAAC;AACD,MAAM,sBAAsB,OAAO,OAAO;CACzC,OAAO,OAAO;CACd,OAAO,OAAO;AACf,CAAC;AACD,MAAM,iBAAiB,OAAO,OAAO;CACpC,OAAO,OAAO,MAAM,mBAAmB;CACvC,OAAO,OAAO,SAAS,OAAO,OAAO;EACpC,GAAG,oBAAoB;EACvB,WAAW,OAAO;CACnB,CAAC,CAAC;CACF,OAAO,OAAO,SAAS,OAAO,OAAO;EACpC,GAAG,oBAAoB;EACvB,WAAW,OAAO;CACnB,CAAC,CAAC;AACH,CAAC;AACD,MAAM,YAAY,OAAO,OAAO;CAC/B,MAAM,OAAO,QAAQ,OAAO;CAC5B,OAAO,OAAO;CACd,OAAO,OAAO,SAAS,OAAO,MAAM;CACpC,OAAO,OAAO,SAAS,cAAc;CACrC,OAAO,OAAO,SAAS,CAAC,OAAO,MAAM,CAAC;CACtC,OAAO,OAAO,SAAS,OAAO,OAAO;AACtC,CAAC;AACD,MAAM,eAAe,OAAO,OAAO;CAClC,MAAM,OAAO,QAAQ,UAAU;CAC/B,OAAO,OAAO;CACd,OAAO,OAAO,SAAS,OAAO,MAAM;CACpC,OAAO,OAAO,SAAS,cAAc;CACrC,OAAO,OAAO,SAAS,CAAC,OAAO,MAAM,CAAC;CACtC,YAAY,OAAO,OAAO;EACzB,QAAQ,OAAO,OAAO,gB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AC,YAAY,OAAO,OAAO;EAC9B,MAAM;EACN,MAAM;EACN,SAAS;CACV;CACA,MAAM,OAAO,OAAO,OAAO,oBAAoB,OAAO,aAAa,CAAC,CAAC,YAAY,KAAK;CACtF,MAAM,UAAU,OAAO,OAAO;EAC7B,IAAI,WAAW,SAAS,UAAU,WAAW,QAAQ,IAAI,IAAI,WAAW,QAAQ,IAAI;EACpF,KAAK;EACL,IAAI,cAAc,SAAS,MAAM,EAAE,MAAM,SAAS,CAAC,CAAC,CAAC,KAAK,OAAO,SAAS,aAAa,SAAS,SAAS,aAAa,OAAO,QAAQ,SAAS,IAAI,IAAI,OAAO,IAAI,6BAA6B,CAAC,CAAC,CAAC;CAClM,CAAC;CACD,OAAO,OAAO,OAAO,UAAU,WAAW,QAAQ,SAAS,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,YAAY;EACzF,YAAY,UAAU,cAAc,YAAY,KAAK;EACrD,YAAY,UAAU,cAAc,YAAY,KAAK;CACtD,CAAC,CAAC;AACH,CAAC;AACD,MAAM,UAAU,YAAY,aAAa,MAAM,iBAAiB,CAAC,MAAM,OAAO,WAAW,SAAS,YAAY,aAAa,MAAM,cAAc,CAAC,CAAC,CAAC,MAAM,WAAW,OAAO,WAAW,OAAO,eAAe,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as Id, l as SchemaDefinitionOf, o as Document, u as SchemaDefinitionTypeId } from "../index-
|
|
1
|
+
import { c as Id, l as SchemaDefinitionOf, o as Document, u as SchemaDefinitionTypeId } from "../index-D54flWtH.js";
|
|
2
2
|
export { type Document, type Id, type SchemaDefinitionOf, SchemaDefinitionTypeId };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SchemaDefinitionTypeId } from "../schema-
|
|
1
|
+
import { t as SchemaDefinitionTypeId } from "../schema-1Zs03-iS.js";
|
|
2
2
|
export { SchemaDefinitionTypeId };
|
package/dist/runtime/{pagination-D-R9NR61-CpIoHFoI.d.ts → pagination-DnKg3dkI-r5ZUxBBx.d.ts}
RENAMED
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
import "./id-
|
|
2
|
-
import { Schema } from "effect";
|
|
3
|
-
//#region ../contracts/dist/
|
|
1
|
+
import { c as Result$1 } from "./id-BzFHf3Wo-DGPCjgrf.js";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
//#region ../contracts/dist/id-W_I1iiJQ.d.ts
|
|
4
|
+
declare const UserId: Schema.brand<Schema.String, "ignotum/id/UserId">;
|
|
5
|
+
type UserId = typeof UserId.Type;
|
|
6
|
+
declare const User: Schema.Struct<{
|
|
7
|
+
readonly id: Schema.brand<Schema.String, "ignotum/id/UserId">;
|
|
8
|
+
readonly name: Schema.optional<Schema.String>;
|
|
9
|
+
readonly email: Schema.optional<Schema.String>;
|
|
10
|
+
readonly image: Schema.optional<Schema.String>;
|
|
11
|
+
}>;
|
|
12
|
+
type User = typeof User.Type;
|
|
13
|
+
declare const ProfileField: Schema.Literals<readonly ["name", "email", "image"]>;
|
|
14
|
+
type ProfileField = typeof ProfileField.Type;
|
|
15
|
+
declare const IdRequired: Schema.brand<Schema.Struct<{
|
|
16
|
+
readonly _tag: Schema.tag<"IdRequired">;
|
|
17
|
+
}>, "ignotum/error">;
|
|
18
|
+
type IdRequired = typeof IdRequired.Type;
|
|
19
|
+
interface IdContext {
|
|
20
|
+
readonly current: () => Result$1<User | null, never>;
|
|
21
|
+
readonly require: () => Result$1<User, IdRequired>;
|
|
22
|
+
}
|
|
23
|
+
declare const SessionOutcome: Schema.Literals<readonly ["SignedIn", "ProfileUpdated", "Cancelled"]>;
|
|
24
|
+
type SessionOutcome = typeof SessionOutcome.Type;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region ../contracts/dist/descriptor-BM7e5QAn.d.ts
|
|
4
27
|
//#region src/schema/descriptor.d.ts
|
|
5
28
|
interface DescriptorField {
|
|
6
29
|
readonly name: string;
|
|
@@ -24,6 +47,8 @@ type ValueDescriptor = {
|
|
|
24
47
|
} | {
|
|
25
48
|
readonly type: "id";
|
|
26
49
|
readonly table: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly type: "userId";
|
|
27
52
|
} | {
|
|
28
53
|
readonly type: "integer";
|
|
29
54
|
} | {
|
|
@@ -69,7 +94,7 @@ type ValueFields = {
|
|
|
69
94
|
readonly [fieldName: PropertyKey]: DescribedValue;
|
|
70
95
|
};
|
|
71
96
|
//#endregion
|
|
72
|
-
//#region ../contracts/dist/pagination-
|
|
97
|
+
//#region ../contracts/dist/pagination-DnKg3dkI.d.ts
|
|
73
98
|
//#region src/runtime/pagination.d.ts
|
|
74
99
|
declare const PaginationCursor: Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">;
|
|
75
100
|
type PaginationCursor = typeof PaginationCursor.Type;
|
|
@@ -83,5 +108,5 @@ interface PaginationPage<Item> {
|
|
|
83
108
|
readonly nextCursor: PaginationCursor | null;
|
|
84
109
|
}
|
|
85
110
|
//#endregion
|
|
86
|
-
export { ValueDescriptor as a, DescriptorField as i, PaginationPage as n, ValueDescriptorCarrier as o, DescribedValue as r, ValueFields as s, PaginationOptions as t };
|
|
87
|
-
//# sourceMappingURL=pagination-
|
|
111
|
+
export { ValueDescriptor as a, IdContext as c, User as d, UserId as f, DescriptorField as i, ProfileField as l, PaginationPage as n, ValueDescriptorCarrier as o, DescribedValue as r, ValueFields as s, PaginationOptions as t, SessionOutcome as u };
|
|
112
|
+
//# sourceMappingURL=pagination-DnKg3dkI-r5ZUxBBx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./pagination-DnKg3dkI-r5ZUxBBx.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./id-BzFHf3Wo-DGPCjgrf.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as getValueDescriptor, i as descriptorFields, n as attachValueDescriptor, o as PaginationCursor, r as descriptorAllowedInEnvironment, s as PaginationPageSize
|
|
1
|
+
import { I as fileLimits, M as constrainedFileValue, N as fileFormats, O as FileFormat, W as GeneratedId, c as UserId, h as ErrorBrand } from "./id-Bt9XWRGL.js";
|
|
2
|
+
import { a as getValueDescriptor, i as descriptorFields, n as attachValueDescriptor, o as PaginationCursor, r as descriptorAllowedInEnvironment, s as PaginationPageSize } from "./descriptor-Cyo9FP9n-C0SRVXNW.js";
|
|
3
3
|
import { Effect, Predicate, Redacted, Result, Schema, Struct } from "effect";
|
|
4
4
|
//#region ../contracts/dist/schema/values.js
|
|
5
5
|
const LiteralValueSchema = Schema.Union([
|
|
@@ -105,6 +105,7 @@ const makeIdSchema = (tableName) => {
|
|
|
105
105
|
table: tableName
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
|
+
const userId = () => attachValueDescriptor(fresh(UserId), { type: "userId" });
|
|
108
109
|
const id = (tableName) => makeIdSchema(tableName);
|
|
109
110
|
const requireDescriptor = (value) => {
|
|
110
111
|
const descriptor = getValueDescriptor(value);
|
|
@@ -224,6 +225,7 @@ const error = (tag, fields) => {
|
|
|
224
225
|
return definition;
|
|
225
226
|
};
|
|
226
227
|
const values = {
|
|
228
|
+
userId,
|
|
227
229
|
array,
|
|
228
230
|
boolean,
|
|
229
231
|
date,
|
|
@@ -418,4 +420,4 @@ function bindSchema(schema, environment = emptyEnv) {
|
|
|
418
420
|
//#endregion
|
|
419
421
|
export { defineSchema as a, getFunctionSchema as c, defineEnv as i, Secret as l, bindSchema as n, emptyEnv as o, decodeDefinedEnvironment as r, getFunctionEnvironment as s, SchemaDefinitionTypeId as t };
|
|
420
422
|
|
|
421
|
-
//# sourceMappingURL=schema-
|
|
423
|
+
//# sourceMappingURL=schema-1Zs03-iS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-1Zs03-iS.js","names":["utf8ByteLength","Result$1"],"sources":["../../../contracts/dist/schema/values.js","../../../contracts/dist/runtime/schema.js","../../../contracts/dist/schema/index.js"],"sourcesContent":["import { GeneratedId } from \"../runtime/id.js\";\nimport { FileFormat, constrainedFileValue, fileFormats, fileLimits } from \"./file.js\";\nimport { ErrorBrand } from \"../runtime/result.js\";\nimport { UserId } from \"../id.js\";\nimport { c as getValueDescriptor, r as attachValueDescriptor, s as descriptorFields } from \"../descriptor-Cyo9FP9n.js\";\nimport { PaginationCursor, PaginationPageSize } from \"../runtime/pagination.js\";\nimport { Redacted, 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 file = (options = {}) => {\n\tconst formats = options.formats ?? fileFormats;\n\tif (formats.length === 0) throw new Error(\"File format lists cannot be empty.\");\n\tSchema.decodeUnknownSync(Schema.Array(FileFormat))(formats);\n\tif (new Set(formats).size !== formats.length) throw new Error(\"File format lists cannot contain duplicates.\");\n\tconst maxBytes = options.maxBytes ?? fileLimits.fileBytes;\n\tif (!Number.isSafeInteger(maxBytes) || maxBytes <= 0 || maxBytes > fileLimits.fileBytes) throw new Error(`File sizes must be between 1 and ${fileLimits.fileBytes} bytes.`);\n\treturn attachValueDescriptor(constrainedFileValue(formats, maxBytes), {\n\t\ttype: \"file\",\n\t\tformats: [...formats],\n\t\tmaxBytes\n\t});\n};\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 userId = () => attachValueDescriptor(fresh(UserId), { type: \"userId\" });\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 Secret = {\n\tisSecret: Redacted.isRedacted,\n\tvalue: Redacted.value\n};\nfunction secret(value = string()) {\n\treturn attachValueDescriptor(Schema.RedactedFromValue(value, { disallowEncode: true }), {\n\t\ttype: \"secret\",\n\t\tvalue: requireDescriptor(value)\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\tuserId,\n\tarray,\n\tboolean,\n\tdate,\n\tfile,\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 environmentValues = {\n\tarray,\n\tboolean,\n\tdate,\n\tinteger,\n\tliteral,\n\tliterals,\n\tnever,\n\tnull: nullValue,\n\tnullable,\n\tnumber,\n\tobject,\n\toptional,\n\trecord,\n\tsecret,\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 { Secret, bindValues, environmentValues, schemaIndexLimits, table, values };\n\n//# sourceMappingURL=values.js.map","//#region src/runtime/schema.ts\nconst FunctionSchemaTypeId = Symbol.for(\"ignotum/runtime/schema/FunctionSchema\");\nconst FunctionEnvironmentTypeId = Symbol.for(\"ignotum/runtime/schema/FunctionEnvironment\");\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];\nconst attachFunctionEnvironment = (environment) => (definition) => {\n\tObject.defineProperty(definition, FunctionEnvironmentTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: environment,\n\t\twritable: false\n\t});\n\treturn definition;\n};\nconst getFunctionEnvironment = (value) => value[FunctionEnvironmentTypeId];\n//#endregion\nexport { FunctionEnvironmentTypeId, FunctionSchemaTypeId, attachFunctionEnvironment, attachFunctionSchema, getFunctionEnvironment, getFunctionSchema };\n\n//# sourceMappingURL=schema.js.map","import { FileFormat, FileId, FileValue, FileValueTypeId, fileFormats, fileLimits, fileMimeTypes, isFileValue } from \"./file.js\";\nimport { Result } from \"../runtime/result.js\";\nimport { a as descriptorContainsFile, c as getValueDescriptor, i as descriptorAllowedInEnvironment, n as ValueDescriptorTypeId, o as descriptorContainsSecret, s as descriptorFields, t as ValueDescriptor } from \"../descriptor-Cyo9FP9n.js\";\nimport { Secret, bindValues, environmentValues, schemaIndexLimits, table, values } from \"./values.js\";\nimport { attachFunctionEnvironment, attachFunctionSchema } from \"../runtime/schema.js\";\nimport { Effect, Predicate, Result as Result$1, Schema } 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/environment.ts\nconst EnvironmentDefinitionTypeId = Symbol.for(\"ignotum/schema/EnvironmentDefinition\");\nconst EnvironmentDecoderTypeId = Symbol.for(\"ignotum/schema/EnvironmentDecoder\");\nconst environmentLimits = {\n\tbytes: 65536,\n\tvariables: 128\n};\nvar EnvironmentValueInvalid = class extends Schema.TaggedError()(\"EnvironmentValueInvalid\", {\n\tkey: Schema.optional(Schema.String),\n\tmessage: Schema.String\n}) {};\nconst environmentName = /^[A-Z_][A-Z0-9_]*$/;\nconst defineEnv = (define) => {\n\tconst fields = define({ values: environmentValues });\n\tif (Reflect.ownKeys(fields).length > environmentLimits.variables) throw new Error(`Environments cannot declare more than ${environmentLimits.variables} variables.`);\n\tfor (const name of Reflect.ownKeys(fields)) {\n\t\tif (!Predicate.isString(name)) throw new Error(\"Environment variable names must be strings.\");\n\t\tif (!environmentName.test(name)) throw new Error(`Environment variable '${name}' must match ${environmentName.source}.`);\n\t\tif (name.startsWith(\"IGNOTUM_\")) throw new Error(`Environment variable '${name}' uses the reserved IGNOTUM_ prefix.`);\n\t}\n\tconst descriptors = descriptorFields(fields);\n\tfor (const field of descriptors) if (!descriptorAllowedInEnvironment(field.value)) throw new Error(`Environment variable '${field.name}' uses an unsupported validator.`);\n\tconst environment = {\n\t\t_tag: \"Environment\",\n\t\tfields,\n\t\tdescriptors,\n\t\tschema: Schema.Struct(fields),\n\t\t[EnvironmentDefinitionTypeId]: fields\n\t};\n\tObject.defineProperty(environment, EnvironmentDecoderTypeId, {\n\t\tenumerable: false,\n\t\tvalue: (raw) => decodeEnvironment(environment, raw)\n\t});\n\treturn Object.freeze(environment);\n};\nconst emptyEnv = defineEnv(() => ({}));\nconst isDefinedEnv = (value) => value._tag === \"Environment\" && Predicate.isObject(value[EnvironmentDefinitionTypeId]);\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 invalidValue = (key) => EnvironmentValueInvalid.make({\n\tkey,\n\tmessage: `Environment variable '${key}' does not match its declaration.`\n});\nconst decodeEnvironment = Effect.fn(\"Environment.decode\")(function* (environment, raw) {\n\tconst declared = new Set(Object.keys(environment.fields));\n\tconst supplied = Object.keys(raw);\n\tif (supplied.length > environmentLimits.variables) return yield* EnvironmentValueInvalid.make({ message: `Environments cannot contain more than ${environmentLimits.variables} variables.` });\n\tconst rawJson = JSON.stringify(raw);\n\tif (utf8ByteLength(rawJson) > environmentLimits.bytes) return yield* EnvironmentValueInvalid.make({ message: `Environments cannot exceed ${environmentLimits.bytes} UTF-8 bytes.` });\n\tfor (const key of supplied) if (!declared.has(key)) return yield* EnvironmentValueInvalid.make({\n\t\tkey,\n\t\tmessage: `Environment variable '${key}' is not declared in server/env.ts.`\n\t});\n\tconst decoded = {};\n\tfor (const [key, field] of Object.entries(environment.fields)) {\n\t\tconst input = Object.hasOwn(raw, key) ? raw[key] : void 0;\n\t\tconst direct = yield* Effect.result(Schema.decodeUnknownEffect(field)(input));\n\t\tif (Result$1.isSuccess(direct)) {\n\t\t\tif (direct.success !== void 0) Reflect.set(decoded, key, direct.success);\n\t\t\tcontinue;\n\t\t}\n\t\tif (input === void 0) return yield* invalidValue(key);\n\t\tconst parsed = yield* Effect.result(Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown))(input));\n\t\tif (Result$1.isFailure(parsed)) return yield* invalidValue(key);\n\t\tconst fromJson = yield* Effect.result(Schema.decodeUnknownEffect(field)(parsed.success));\n\t\tif (Result$1.isFailure(fromJson)) return yield* invalidValue(key);\n\t\tif (fromJson.success !== void 0) Reflect.set(decoded, key, fromJson.success);\n\t}\n\treturn Object.freeze(decoded);\n});\nconst decodeDefinedEnvironment = (environment, raw) => environment[EnvironmentDecoderTypeId](raw);\n//#endregion\n//#region src/schema/server.ts\nconst makeFunctionBuilder = (schema, environment, kind) => {\n\tconst define = (definition) => attachFunctionEnvironment(environment)(attachFunctionSchema(schema)({\n\t\t_tag: kind,\n\t\t...definition\n\t}));\n\treturn define;\n};\nconst makeFunctionBuilders = (schema, environment) => ({\n\tmutation: makeFunctionBuilder(schema, environment, \"Mutation\"),\n\tquery: makeFunctionBuilder(schema, environment, \"Query\")\n});\nfunction bindSchema(schema, environment = emptyEnv) {\n\treturn {\n\t\tvalues: bindValues(schema[SchemaDefinitionTypeId]),\n\t\t...makeFunctionBuilders(schema, environment)\n\t};\n}\n//#endregion\nexport { EnvironmentDefinitionTypeId, EnvironmentValueInvalid, FileFormat, FileId, FileValue, FileValueTypeId, Result, SchemaDefinitionTypeId, Secret, ValueDescriptor, ValueDescriptorTypeId, bindSchema, bindValues, decodeDefinedEnvironment, decodeEnvironment, defineEnv, defineSchema, descriptorAllowedInEnvironment, descriptorContainsFile, descriptorContainsSecret, descriptorFields, emptyEnv, environmentLimits, environmentValues, fileFormats, fileLimits, fileMimeTypes, getValueDescriptor, isDefinedEnv, isDefinedSchema, isFileValue, schemaIndexLimits, table, values };\n\n//# sourceMappingURL=index.js.map"],"mappings":";;;;AAQA,MAAM,qBAAqB,OAAO,MAAM;CACvC,OAAO;CACP,OAAO;CACP,OAAO;AACR,CAAC;AACD,MAAM,oBAAoB;CACzB,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,UAAU;CACV,WAAW;AACZ;AACA,MAAMA,oBAAkB,UAAU;CACjC,IAAI,QAAQ;CACZ,KAAK,MAAM,aAAa,OAAO;EAC9B,MAAM,QAAQ,UAAU,YAAY,CAAC,KAAK;EAC1C,SAAS,SAAS,MAAM,IAAI,SAAS,OAAO,IAAI,SAAS,QAAQ,IAAI;CACtE;CACA,OAAO;AACR;AACA,MAAM,SAAS,WAAW;CACzB,MAAM,cAAc;CACpB,MAAM,QAAQ,YAAY;EACzB,MAAM,SAAS,MAAM,eAAe;GACnC,IAAIA,iBAAe,IAAI,IAAI,kBAAkB,WAAW,MAAM,IAAI,MAAM,6BAA6B,kBAAkB,UAAU,cAAc;GAC/I,IAAI,KAAK,WAAW,GAAG,MAAM,IAAI,MAAM,8BAA8B;GACrE,IAAI,KAAK,WAAW,GAAG,GAAG,MAAM,IAAI,MAAM,8CAA8C;GACxF,IAAI,OAAO,OAAO,SAAS,IAAI,GAAG,MAAM,IAAI,MAAM,yBAAyB,KAAK,GAAG;GACnF,IAAI,WAAW,SAAS,kBAAkB,g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