ignotum 0.0.11 → 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.
Files changed (61) hide show
  1. package/README.md +8 -3
  2. package/dist/cli/bin.mjs +1372 -492
  3. package/dist/cli/bin.mjs.map +1 -1
  4. package/dist/runtime/{api-DzcR7spt.js → api-CAgKDij7.js} +38 -2
  5. package/dist/runtime/api-CAgKDij7.js.map +1 -0
  6. package/dist/runtime/{api-DR_8vfKg.d.ts → api-Cv3hMbzo.d.ts} +4 -3
  7. package/dist/runtime/client.d.ts +39 -8
  8. package/dist/runtime/client.js +505 -131
  9. package/dist/runtime/client.js.map +1 -1
  10. package/dist/runtime/descriptor-Cyo9FP9n-C0SRVXNW.js +154 -0
  11. package/dist/runtime/descriptor-Cyo9FP9n-C0SRVXNW.js.map +1 -0
  12. package/dist/runtime/id-Bt9XWRGL.js +423 -0
  13. package/dist/runtime/id-Bt9XWRGL.js.map +1 -0
  14. package/dist/runtime/{id-Cs82tq9Q-hmYFyqTa.d.ts → id-BzFHf3Wo-DGPCjgrf.d.ts} +13 -13
  15. package/dist/runtime/id-Dz0apuB3.d.ts +1 -0
  16. package/dist/runtime/{index-2q9FwJud.d.ts → index-D54flWtH.d.ts} +136 -76
  17. package/dist/runtime/internal/api.d.ts +1 -1
  18. package/dist/runtime/internal/api.js +1 -1
  19. package/dist/runtime/internal/host.d.ts +21 -17
  20. package/dist/runtime/internal/host.js +22 -8
  21. package/dist/runtime/internal/host.js.map +1 -1
  22. package/dist/runtime/internal/server.d.ts +1 -1
  23. package/dist/runtime/internal/server.js +1 -1
  24. package/dist/runtime/internal/types.d.ts +1 -1
  25. package/dist/runtime/internal/types.js +1 -1
  26. package/dist/runtime/{pagination-Bt3l7QaC-BYEGmLBE.d.ts → pagination-DnKg3dkI-r5ZUxBBx.d.ts} +34 -6
  27. package/dist/runtime/pagination-Dz0apuB3.d.ts +1 -0
  28. package/dist/runtime/result-DKAA4gpS.d.ts +1 -0
  29. package/dist/runtime/{schema-ERFjT8-m.js → schema-1Zs03-iS.js} +135 -17
  30. package/dist/runtime/schema-1Zs03-iS.js.map +1 -0
  31. package/dist/runtime/server.d.ts +9 -3
  32. package/dist/runtime/server.js +5 -3
  33. package/dist/runtime/server.js.map +1 -1
  34. package/dist/runtime/{sync-a2EdGSdY.d.ts → sync-Bs8J3fIr.d.ts} +2 -2
  35. package/package.json +4 -4
  36. package/src/cli/agent-files.ts +8 -0
  37. package/src/cli/auth-client.ts +1 -1
  38. package/src/cli/bin.ts +13 -3
  39. package/src/cli/build/server.ts +102 -13
  40. package/src/cli/codegen.ts +7 -4
  41. package/src/cli/control-client.ts +30 -8
  42. package/src/cli/deploy.ts +7 -2
  43. package/src/cli/environment.ts +133 -0
  44. package/src/client/files.ts +43 -27
  45. package/src/client/hooks.ts +94 -17
  46. package/src/client/id.ts +259 -0
  47. package/src/client/index.ts +5 -2
  48. package/src/client/page-observers.ts +77 -0
  49. package/src/client/sync.ts +214 -69
  50. package/src/dev-runtime/functions.ts +232 -86
  51. package/src/dev-runtime/id.ts +174 -2
  52. package/src/dev-runtime/query-cache.ts +105 -0
  53. package/src/dev-runtime/sync.ts +187 -26
  54. package/src/server/index.ts +13 -1
  55. package/dist/runtime/api-DzcR7spt.js.map +0 -1
  56. package/dist/runtime/descriptor-C5VA9qRl-DuQsowaQ.js +0 -311
  57. package/dist/runtime/descriptor-C5VA9qRl-DuQsowaQ.js.map +0 -1
  58. package/dist/runtime/file-C1abuMgd.js +0 -173
  59. package/dist/runtime/file-C1abuMgd.js.map +0 -1
  60. package/dist/runtime/pagination-CFJ3xlAt.d.ts +0 -1
  61. package/dist/runtime/schema-ERFjT8-m.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,OAAO,YAAY,EAAE,SAAS,CAAC;AACnF,MAAM,YAAY,QAAQ,UAAU;CACnC,MAAM,WAAW,OAAO,WAAW,QAAQ,CAAC,CAAC,MAAM;CACnD,OAAO,WAAW,OAAO,OAAO,MAAM,OAAO,UAAU,IAAI,OAAO,IAAI,SAAS,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,KAAK,CAAC,GAAG,QAAQ;AACtI;AACA,MAAM,cAAc,WAAW,OAAO,OAAO,MAAM,OAAO,UAAU,gBAAgB,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,GAAG,KAAK,CAAC;AAC/H,MAAM,QAAQ,SAAS,OAAO,sBAAsB;AACpD,MAAM,eAAe,SAAS,OAAO,6BAA6B;AACnD,SAAS,QAAQ,uBAAuB;AACvD,MAAM,UAAU,SAAS,SAAS,yBAAyB;AAC/B,SAAS,OAAO,qCAAqC;AAC3D,SAAS,OAAO,wBAAwB;AACxC,SAAS,QAAQ,wBAAwB;AACpC,SAAS,OAAO,6BAA6B;AACnD,SAAS,OAAO,uBAAuB;AACnC,SAAS,QAAQ,2BAA2B;AAC5C,SAAS,OAAO,2BAA2B;AAC7C,SAAS,QAAQ,yBAAyB;AACjE,MAAM,eAAe,SAAS,OAAO,2BAA2B;AAChE,MAAM,iBAAiB,SAAS,OAAO,6BAA6B;AAC/C,SAAS,QAAQ,8BAA8B;AACpE,MAAM,sBAAsB,SAA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Aa,OAAO;CACpB,WAAW,OAAO;AACnB,CAAC;AACD,MAAM,iBAAiB,OAAO,SAAS;CACtC;CACA;CACA;AACD,CAAC;AAUD,MAAM,cAAc;AACpB,MAAM,sBAAsB,GAAG,YAAY;AAU3C,MAAM,uBAAuB,QALE,OAAO,OAAO;CAC5C,eAAe,OAAO,QAAQ,CAAC;CAC/B,UAAU,OAAO,OAAO,mBAAmB;CAC3C,OAAO,OAAO;AACf,CACqC,CAAsB;AAC3D,MAAM,0BAA0B"}
@@ -53,7 +53,7 @@ interface TransportObject {
53
53
  }
54
54
  type TransportValue = null | boolean | number | string | Date | FileValue | TransportArray | TransportObject;
55
55
  //#endregion
56
- //#region ../contracts/dist/runtime/result.d.ts
56
+ //#region ../contracts/dist/result-CgX73dpS.d.ts
57
57
  //#region src/runtime/result.d.ts
58
58
  declare const ResultTypeId: unique symbol;
59
59
  declare const PendingResultTypeId: unique symbol;
@@ -94,18 +94,18 @@ type CatchCases<Failure extends ErrorValue> = { readonly [Tag in Failure["_tag"]
94
94
  readonly _tag: Tag;
95
95
  }>) => CatchOutput; };
96
96
  type CaseReturn<Cases> = ReturnType<Extract<Cases[keyof Cases], (...args: never) => CatchOutput>>;
97
- type SuccessOfReturn<Value> = Value extends Result<infer Success, ErrorValue> ? Success : Value;
98
- type FailureOfReturn<Value> = Value extends Result<unknown, infer Failure> ? Failure : never;
97
+ type SuccessOfReturn<Value> = Value extends Result$1<infer Success, ErrorValue> ? Success : Value;
98
+ type FailureOfReturn<Value> = Value extends Result$1<unknown, infer Failure> ? Failure : never;
99
99
  type HandledTags<Cases> = Extract<keyof Cases, string>;
100
100
  type YieldFailure<Yielded> = Yielded extends Effect.Effect<unknown, infer Failure, never> ? Failure extends ErrorValue ? Failure : never : never;
101
- interface Result<out Success, out Failure extends ErrorValue> {
101
+ interface Result$1<out Success, out Failure extends ErrorValue> {
102
102
  readonly [ResultTypeId]: Effect.Effect<Success, Failure>;
103
103
  [Symbol.iterator](): Effect.EffectIterator<Effect.Effect<Success, Failure>>;
104
- catch<const Cases extends CatchCases<Failure>>(cases: Cases & { readonly [Tag in Exclude<keyof Cases, Failure["_tag"]>]: never; }): Result<Success | SuccessOfReturn<CaseReturn<Cases>>, Exclude<Failure, {
104
+ catch<const Cases extends CatchCases<Failure>>(cases: Cases & { readonly [Tag in Exclude<keyof Cases, Failure["_tag"]>]: never; }): Result$1<Success | SuccessOfReturn<CaseReturn<Cases>>, Exclude<Failure, {
105
105
  readonly _tag: HandledTags<Cases>;
106
106
  }> | FailureOfReturn<CaseReturn<Cases>>>;
107
107
  }
108
- type SettledResult<Success, Failure extends ErrorValue> = Omit<Result<Success, Failure>, "catch" | typeof Symbol.iterator>;
108
+ type SettledResult<Success, Failure extends ErrorValue> = Omit<Result$1<Success, Failure>, "catch" | typeof Symbol.iterator>;
109
109
  interface PendingResult {
110
110
  readonly [PendingResultTypeId]: typeof PendingResultTypeId;
111
111
  }
@@ -146,9 +146,9 @@ type CurriedQueryResultMatchers<Success, Failure extends ErrorValue, Output> = O
146
146
  } : {
147
147
  readonly internalError?: (error: InternalError<NoInfer<Failure>>) => Output;
148
148
  });
149
- declare const succeed: <Actual, Expected = Actual>(value: Actual & NoInfer<Expected>) => Result<Expected, never>;
150
- declare const fail: <Actual extends ErrorValue, Expected extends ErrorValue = Actual>(error: Actual & NoInfer<Expected>) => Result<never, Expected>;
151
- declare const tryResult: <Success, Yielded extends Effect.Effect<unknown, ErrorValue, never>>(body: () => Generator<Yielded, Success, never>) => Result<Success, [Yielded] extends [never] ? never : YieldFailure<Yielded>>;
149
+ declare const succeed: <Actual, Expected = Actual>(value: Actual & NoInfer<Expected>) => Result$1<Expected, never>;
150
+ declare const fail: <Actual extends ErrorValue, Expected extends ErrorValue = Actual>(error: Actual & NoInfer<Expected>) => Result$1<never, Expected>;
151
+ declare const tryResult: <Success, Yielded extends Effect.Effect<unknown, ErrorValue, never>>(body: () => Generator<Yielded, Success, never>) => Result$1<Success, [Yielded] extends [never] ? never : YieldFailure<Yielded>>;
152
152
  interface Match {
153
153
  <Success, Failure extends ErrorValue, Output>(result: SettledResult<Success, Failure>, matchers: ResultMatchers<Success, Failure, Output>): Output;
154
154
  <Success, Failure extends ErrorValue, Output>(result: QueryResult<Success, Failure>, matchers: QueryResultMatchers<Success, Failure, Output>): Output;
@@ -156,18 +156,18 @@ interface Match {
156
156
  <Success, Failure extends ErrorValue, Output>(matchers: CurriedResultMatchers<Success, Failure, Output>): (result: SettledResult<Success, Failure>) => Output;
157
157
  }
158
158
  declare const documentNotFound: <TableName extends string, Identifier extends string>(table: TableName, id: Identifier) => DocumentNotFoundValue<TableName, Identifier>;
159
- declare const Result: {
159
+ declare const Result$1: {
160
160
  fail: typeof fail;
161
161
  match: Match;
162
162
  succeed: typeof succeed;
163
163
  try: typeof tryResult;
164
164
  };
165
165
  //#endregion
166
- //#region ../contracts/dist/id-Cs82tq9Q.d.ts
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
- export { fileFormats as _, InternalServerError as a, Result 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-Cs82tq9Q-hmYFyqTa.d.ts.map
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-BzFHf3Wo-DGPCjgrf.d.ts.map
@@ -0,0 +1 @@
1
+ import "./pagination-DnKg3dkI-r5ZUxBBx.js";
@@ -1,32 +1,7 @@
1
- import { _ as fileFormats, c as Result, g as FileValue, i as ErrorValue, n as DocumentNotFoundValue, p as FileFormat, r as ErrorBrand, t as GeneratedId } from "./id-Cs82tq9Q-hmYFyqTa.js";
2
- import { a as ValueDescriptorCarrier, i as ValueDescriptor, n as PaginationPage, o as ValueFields, r as DescribedValue, t as PaginationOptions } from "./pagination-Bt3l7QaC-BYEGmLBE.js";
3
- import { Brand, Effect, Schema, Struct } from "effect";
4
- //#region ../contracts/dist/types-MZtM0RHZ.d.ts
5
- //#region src/schema/types.d.ts
6
- /** A document identifier branded with the table it belongs to. */
7
- type Id<TableName extends string> = GeneratedId & Brand.Brand<`ignotum/id/${TableName}`>;
8
- declare const SchemaDefinitionTypeId: unique symbol;
9
- interface SchemaDefinitionContract<Definition> {
10
- readonly [SchemaDefinitionTypeId]: Definition;
11
- }
12
- type SchemaDefinitionOf<SchemaDefinition> = SchemaDefinition extends SchemaDefinitionContract<infer Definition> ? Definition : never;
13
- interface TableDefinitionLike {
14
- readonly fields: Schema.Struct.Fields;
15
- }
16
- interface TablesLike {
17
- readonly [tableName: string]: TableDefinitionLike;
18
- }
19
- type TableNameOf$2<Definition extends TablesLike> = keyof Definition & string;
20
- interface SystemFields<TableName extends string> {
21
- readonly id: Id<TableName>;
22
- readonly createdAt: Date;
23
- readonly updatedAt: Date;
24
- }
25
- type DocumentFields<TableName extends string, Table extends TableDefinitionLike> = SystemFields<TableName> & Schema.Struct.Type<Table["fields"]>;
26
- /** The complete document returned for a table, including Ignotum system fields. */
27
- type Document<Definition extends TablesLike, TableName extends TableNameOf$2<Definition>> = { readonly [FieldName in keyof DocumentFields<TableName, Definition[TableName]>]: DocumentFields<TableName, Definition[TableName]>[FieldName]; };
28
- //#endregion
29
- //#region ../contracts/dist/schema/values.d.ts
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
+ import { Brand, Effect, Redacted, Schema, Struct } from "effect";
4
+ //#region ../contracts/dist/values-B4I-91OJ.d.ts
30
5
  //#region src/schema/values.d.ts
31
6
  declare const IdTargetsTypeId: unique symbol;
32
7
  declare const UnresolvedReferencesTypeId: unique symbol;
@@ -78,7 +53,7 @@ interface TableDefinition<Fields extends Schema.Struct.Fields, Indexes extends I
78
53
  interface TableDefinitions {
79
54
  readonly [tableName: string]: TableDefinition<Schema.Struct.Fields, IndexDefinitions>;
80
55
  }
81
- type TableNameOf$1<Definition extends TableDefinitions> = keyof Definition & string;
56
+ type TableNameOf$2<Definition extends TableDefinitions> = keyof Definition & string;
82
57
  type ReservedFieldName = "createdAt" | "id" | "updatedAt";
83
58
  type ReservedErrorTagName = "InternalServerError";
84
59
  declare const ReservedFieldTypeId: unique symbol;
@@ -116,6 +91,7 @@ declare const never: () => DescribedValue<Schema.Never>;
116
91
  declare const nullValue: () => DescribedValue<Schema.Null>;
117
92
  declare const literal: <const Value extends LiteralValue>(value: Value) => DescribedValue<Schema.Literal<Value>>;
118
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">>;
119
95
  declare const id: <const TableName extends string>(tableName: TableName) => ReferenceDefinition<TableName>;
120
96
  declare const array: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.$Array<Value>, Value>;
121
97
  declare const object: <const Fields extends ValueFields>(fields: Fields) => ObjectDefinition<Fields>;
@@ -123,6 +99,14 @@ declare const optional: <Value extends DescribedValue>(value: Value) => Preserve
123
99
  declare const nullable: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.NullOr<Value>, Value>;
124
100
  declare const record: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.$Record<Schema.String, Value>, Value>;
125
101
  declare const union: <const Members extends ReadonlyArray<DescribedValue>>(...members: Members) => PreserveValueMetadata<Schema.Union<Members>, Members[number]>;
102
+ type Secret<Value> = Redacted.Redacted<Value>;
103
+ declare const Secret: {
104
+ readonly isSecret: (u: unknown) => u is Redacted.Redacted<unknown>;
105
+ readonly value: <T>(self: Redacted.Redacted<T>) => T;
106
+ };
107
+ type SecretDefinition<Value extends DescribedValue> = DescribedValue<Schema.RedactedFromValue<Value>>;
108
+ declare function secret(): SecretDefinition<ReturnType<typeof string>>;
109
+ declare function secret<Value extends DescribedValue>(value: Value): SecretDefinition<Value>;
126
110
  declare const pagination: () => ObjectDefinition<{
127
111
  readonly cursor: DescribedValue<Schema.NullOr<DescribedValue<Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">>> & Schema.Constraint>;
128
112
  readonly pageSize: DescribedValue<Schema.brand<Schema.Int, "ignotum/runtime/PaginationPageSize">>;
@@ -133,6 +117,7 @@ declare const page: <Value extends DescribedValue>(value: Value) => ObjectDefini
133
117
  }> & Schema.Schema<PaginationPage<Value["Type"]>>;
134
118
  declare const error: <const Tag extends string, const Fields extends ValueFields>(tag: Tag & ErrorTagValidation<Tag>, fields: Fields & ReservedErrorFieldValidation<NoInfer<Fields>>) => ErrorDefinition<Tag, Fields>;
135
119
  declare const values: {
120
+ userId: typeof userId;
136
121
  array: typeof array;
137
122
  boolean: typeof boolean;
138
123
  date: typeof date;
@@ -152,18 +137,88 @@ declare const values: {
152
137
  string: typeof string;
153
138
  union: typeof union;
154
139
  };
155
- type DocumentDefinition<Definition extends TableDefinitions, TableName extends TableNameOf$1<Definition>> = ObjectDefinition<Struct.Assign<ResolvedFields<Definition[TableName]["fields"]>, {
140
+ declare const environmentValues: {
141
+ array: typeof array;
142
+ boolean: typeof boolean;
143
+ date: typeof date;
144
+ integer: typeof integer;
145
+ literal: typeof literal;
146
+ literals: typeof literals;
147
+ never: typeof never;
148
+ null: typeof nullValue;
149
+ nullable: typeof nullable;
150
+ number: typeof number;
151
+ object: typeof object;
152
+ optional: typeof optional;
153
+ record: typeof record;
154
+ secret: typeof secret;
155
+ string: typeof string;
156
+ union: typeof union;
157
+ };
158
+ type EnvironmentValues = typeof environmentValues;
159
+ type DocumentDefinition<Definition extends TableDefinitions, TableName extends TableNameOf$2<Definition>> = ObjectDefinition<Struct.Assign<ResolvedFields<Definition[TableName]["fields"]>, {
156
160
  readonly id: IdDefinition<TableName>;
157
161
  readonly createdAt: typeof Schema.DateFromMillis;
158
162
  readonly updatedAt: typeof Schema.DateFromMillis;
159
163
  }>>;
160
164
  type BoundValues<Definition extends TableDefinitions> = Omit<typeof values, "id"> & {
161
- readonly doc: <const TableName extends TableNameOf$1<Definition>>(tableName: TableName) => DocumentDefinition<Definition, TableName>;
162
- readonly id: <const TableName extends TableNameOf$1<Definition>>(tableName: TableName) => IdDefinition<TableName>;
165
+ readonly doc: <const TableName extends TableNameOf$2<Definition>>(tableName: TableName) => DocumentDefinition<Definition, TableName>;
166
+ readonly id: <const TableName extends TableNameOf$2<Definition>>(tableName: TableName) => IdDefinition<TableName>;
163
167
  readonly page: typeof page;
164
168
  readonly pagination: () => ReturnType<typeof pagination> & Schema.Schema<PaginationOptions>;
165
169
  };
166
170
  //#endregion
171
+ //#region ../contracts/dist/types-D4UfDuy-.d.ts
172
+ //#region src/schema/environment.d.ts
173
+ declare const EnvironmentDefinitionTypeId: unique symbol;
174
+ declare const EnvironmentDecoderTypeId: unique symbol;
175
+ type EnvironmentFields = {
176
+ readonly [fieldName: PropertyKey]: DescribedValue<Schema.ConstraintDecoder<unknown, never>>;
177
+ };
178
+ interface DefinedEnv<Fields extends EnvironmentFields = EnvironmentFields> {
179
+ readonly _tag: "Environment";
180
+ readonly fields: Fields;
181
+ readonly descriptors: ReadonlyArray<DescriptorField>;
182
+ readonly schema: Schema.Struct<Fields>;
183
+ readonly [EnvironmentDefinitionTypeId]: Fields;
184
+ readonly [EnvironmentDecoderTypeId]: (raw: Readonly<Record<string, string>>) => Effect.Effect<Readonly<EnvironmentType<DefinedEnv<Fields>>>, EnvironmentValueInvalid>;
185
+ }
186
+ interface EnvironmentAuthoring {
187
+ readonly values: EnvironmentValues;
188
+ }
189
+ type EnvironmentType<Environment extends DefinedEnv> = Schema.Struct.Type<Environment[typeof EnvironmentDefinitionTypeId]>;
190
+ declare const EnvironmentValueInvalid_base: Schema.Class<EnvironmentValueInvalid, Schema.TaggedStruct<"EnvironmentValueInvalid", {
191
+ readonly key: Schema.optional<Schema.String>;
192
+ readonly message: Schema.String;
193
+ }>, import("effect/Cause").YieldableError>;
194
+ declare class EnvironmentValueInvalid extends EnvironmentValueInvalid_base {}
195
+ declare const defineEnv: <const Fields extends EnvironmentFields>(define: (authoring: EnvironmentAuthoring) => Fields) => DefinedEnv<Fields>;
196
+ declare const emptyEnv: DefinedEnv<{}>;
197
+ //#endregion
198
+ //#region src/schema/types.d.ts
199
+ /** A document identifier branded with the table it belongs to. */
200
+ type Id<TableName extends string> = GeneratedId & Brand.Brand<`ignotum/id/${TableName}`>;
201
+ declare const SchemaDefinitionTypeId: unique symbol;
202
+ interface SchemaDefinitionContract<Definition> {
203
+ readonly [SchemaDefinitionTypeId]: Definition;
204
+ }
205
+ type SchemaDefinitionOf<SchemaDefinition> = SchemaDefinition extends SchemaDefinitionContract<infer Definition> ? Definition : never;
206
+ interface TableDefinitionLike {
207
+ readonly fields: Schema.Struct.Fields;
208
+ }
209
+ interface TablesLike {
210
+ readonly [tableName: string]: TableDefinitionLike;
211
+ }
212
+ type TableNameOf$1<Definition extends TablesLike> = keyof Definition & string;
213
+ interface SystemFields<TableName extends string> {
214
+ readonly id: Id<TableName>;
215
+ readonly createdAt: Date;
216
+ readonly updatedAt: Date;
217
+ }
218
+ type DocumentFields<TableName extends string, Table extends TableDefinitionLike> = SystemFields<TableName> & Schema.Struct.Type<Table["fields"]>;
219
+ /** The complete document returned for a table, including Ignotum system fields. */
220
+ type Document<Definition extends TablesLike, TableName extends TableNameOf$1<Definition>> = { readonly [FieldName in keyof DocumentFields<TableName, Definition[TableName]>]: DocumentFields<TableName, Definition[TableName]>[FieldName]; };
221
+ //#endregion
167
222
  //#region ../contracts/dist/schema/index.d.ts
168
223
  //#region src/schema/definition.d.ts
169
224
  type AnyTableDefinition = TableDefinition<Schema.Struct.Fields, IndexDefinitions>;
@@ -235,11 +290,11 @@ interface IndexRangeBuilder<Definition extends Tables, Name extends TableNameOf<
235
290
  lte<FieldName extends Fields[0]>(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexUpperBound<Definition, Name, FieldName>;
236
291
  }
237
292
  interface OrderedDatabaseQuery<Definition extends Tables, Name extends TableNameOf<Definition>> {
238
- collect(): Result<ReadonlyArray<Document<Definition, Name>>, never>;
239
- take(count: number): Result<ReadonlyArray<Document<Definition, Name>>, never>;
240
- first(): Result<Document<Definition, Name> | undefined, never>;
241
- unique(): Result<Document<Definition, Name> | undefined, never>;
242
- paginate(options: PaginationOptions): Result<PaginationPage<Document<Definition, Name>>, never>;
293
+ collect(): Result$1<ReadonlyArray<Document<Definition, Name>>, never>;
294
+ take(count: number): Result$1<ReadonlyArray<Document<Definition, Name>>, never>;
295
+ first(): Result$1<Document<Definition, Name> | undefined, never>;
296
+ unique(): Result$1<Document<Definition, Name> | undefined, never>;
297
+ paginate(options: PaginationOptions): Result$1<PaginationPage<Document<Definition, Name>>, never>;
243
298
  }
244
299
  interface SelectableDatabaseQuery<Definition extends Tables, Name extends TableNameOf<Definition>> extends OrderedDatabaseQuery<Definition, Name> {
245
300
  order(direction: "asc" | "desc"): OrderedDatabaseQuery<Definition, Name>;
@@ -249,28 +304,32 @@ interface DatabaseQuery<Definition extends Tables, Name extends TableNameOf<Defi
249
304
  }
250
305
  interface DatabaseReader<Definition extends Tables> {
251
306
  query<const Name extends TableNameOf<Definition>>(name: Name): DatabaseQuery<Definition, Name>;
252
- find<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result<Document<Definition, Name> | undefined, never>;
253
- get<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result<Document<Definition, Name>, DocumentNotFound<Name>>;
307
+ find<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result$1<Document<Definition, Name> | undefined, never>;
308
+ get<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result$1<Document<Definition, Name>, DocumentNotFound<Name>>;
254
309
  }
255
310
  interface DatabaseWriter<Definition extends Tables> extends DatabaseReader<Definition> {
256
- delete<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result<void, DocumentNotFound<Name>>;
257
- insert<const Name extends TableNameOf<Definition>>(name: Name, value: InsertOf<Definition[NoInfer<Name>]>): Result<Id<Name>, never>;
258
- patch<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>, value: PatchOf<Definition[NoInfer<Name>]>): Result<void, DocumentNotFound<Name>>;
259
- replace<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>, value: InsertOf<Definition[NoInfer<Name>]>): Result<void, DocumentNotFound<Name>>;
311
+ delete<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result$1<void, DocumentNotFound<Name>>;
312
+ insert<const Name extends TableNameOf<Definition>>(name: Name, value: InsertOf<Definition[NoInfer<Name>]>): Result$1<Id<Name>, never>;
313
+ patch<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>, value: PatchOf<Definition[NoInfer<Name>]>): Result$1<void, DocumentNotFound<Name>>;
314
+ replace<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>, value: InsertOf<Definition[NoInfer<Name>]>): Result$1<void, DocumentNotFound<Name>>;
260
315
  }
261
- interface QueryContext<Definition extends Tables> {
316
+ interface QueryContext<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> {
262
317
  readonly db: DatabaseReader<Definition>;
318
+ readonly env: EnvironmentType<Environment>;
319
+ readonly id: IdContext;
263
320
  }
264
- interface MutationContext<Definition extends Tables> {
321
+ interface MutationContext<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> {
265
322
  readonly db: DatabaseWriter<Definition>;
323
+ readonly env: EnvironmentType<Environment>;
324
+ readonly id: IdContext;
266
325
  }
267
326
  type FunctionKind = "Mutation" | "Query";
268
- type HandlerContext<Kind extends FunctionKind, Definition extends Tables> = Kind extends "Query" ? QueryContext<Definition> : MutationContext<Definition>;
269
- type Handler<Kind extends FunctionKind, Definition extends Tables, Args extends FunctionArgs, Success, Failure extends ErrorValue> = (ctx: HandlerContext<Kind, Definition>, args: ArgsOf<Args>) => Generator<Effect.Effect<unknown, Failure, never>, Success, never>;
327
+ type HandlerContext<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv> = Kind extends "Query" ? QueryContext<Definition, Environment> : MutationContext<Definition, Environment>;
328
+ type Handler<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv, Args extends FunctionArgs, Success, Failure extends ErrorValue> = (ctx: HandlerContext<Kind, Definition, Environment>, args: ArgsOf<Args>) => Generator<Effect.Effect<unknown, Failure, never>, Success, never>;
270
329
  type HandlerFailure<HandlerType> = HandlerType extends ((...arguments_: infer _Arguments) => Generator<infer Yielded, unknown, never>) ? Yielded extends Effect.Effect<unknown, infer Failure extends ErrorValue, never> ? Failure : never : never;
271
- type FunctionDefinition<Kind extends FunctionKind, Definition extends Tables, Args extends FunctionArgs, Returns extends FunctionReturns, Errors extends ErrorSchema | undefined, Failure extends ErrorValue> = {
330
+ type FunctionDefinition<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv, Args extends FunctionArgs, Returns extends FunctionReturns, Errors extends ErrorSchema | undefined, Failure extends ErrorValue> = {
272
331
  readonly _tag: Kind;
273
- readonly handler: Handler<Kind, Definition, Args, ReturnOf<Returns>, Failure>;
332
+ readonly handler: Handler<Kind, Definition, Environment, Args, ReturnOf<Returns>, Failure>;
274
333
  } & (Args extends Schema.Struct.Fields ? {
275
334
  readonly args: Args;
276
335
  } : {
@@ -284,8 +343,8 @@ type FunctionDefinition<Kind extends FunctionKind, Definition extends Tables, Ar
284
343
  } : {
285
344
  readonly errors?: never;
286
345
  });
287
- interface FunctionInput<Kind extends FunctionKind, Definition extends Tables, Args extends FunctionArgs, Success, Failure extends ErrorValue> {
288
- readonly handler: Handler<Kind, Definition, Args, Success, Failure>;
346
+ interface FunctionInput<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv, Args extends FunctionArgs, Success, Failure extends ErrorValue> {
347
+ readonly handler: Handler<Kind, Definition, Environment, Args, Success, Failure>;
289
348
  }
290
349
  type WithArgs<Kind extends FunctionKind, Args extends Schema.Struct.Fields> = {
291
350
  readonly args: Args & ResolvedFunctionFields<NoInfer<Args>> & (Kind extends "Query" ? FileFree<Schema.Struct.Type<Args>, "query arguments"> : unknown);
@@ -299,44 +358,45 @@ type WithReturns<Kind extends FunctionKind, Returns extends TransportSchema> = {
299
358
  interface WithoutReturns {
300
359
  readonly returns?: never;
301
360
  }
302
- interface DefineFunction<Kind extends FunctionKind, Definition extends Tables> {
303
- <const Args extends Schema.Struct.Fields, Returns extends TransportSchema, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Args, Returns["Type"], Errors["Type"]> & WithArgs<Kind, Args> & WithReturns<Kind, Returns> & {
361
+ interface DefineFunction<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv> {
362
+ <const Args extends Schema.Struct.Fields, Returns extends TransportSchema, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Environment, Args, Returns["Type"], Errors["Type"]> & WithArgs<Kind, Args> & WithReturns<Kind, Returns> & {
304
363
  readonly errors: Errors & ResolvedFunctionValue & FileFree<Errors["Type"], "errors">;
305
- }): FunctionDefinition<Kind, Definition, Args, Returns, Errors, Errors["Type"]>;
306
- <Returns extends TransportSchema, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, undefined, Returns["Type"], Errors["Type"]> & WithoutArgs & WithReturns<Kind, Returns> & {
364
+ }): FunctionDefinition<Kind, Definition, Environment, Args, Returns, Errors, Errors["Type"]>;
365
+ <Returns extends TransportSchema, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Environment, undefined, Returns["Type"], Errors["Type"]> & WithoutArgs & WithReturns<Kind, Returns> & {
307
366
  readonly errors: Errors & ResolvedFunctionValue & FileFree<Errors["Type"], "errors">;
308
- }): FunctionDefinition<Kind, Definition, undefined, Returns, Errors, Errors["Type"]>;
309
- <const Args extends Schema.Struct.Fields, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Args, void, Errors["Type"]> & WithArgs<Kind, Args> & WithoutReturns & {
367
+ }): FunctionDefinition<Kind, Definition, Environment, undefined, Returns, Errors, Errors["Type"]>;
368
+ <const Args extends Schema.Struct.Fields, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Environment, Args, void, Errors["Type"]> & WithArgs<Kind, Args> & WithoutReturns & {
310
369
  readonly errors: Errors & ResolvedFunctionValue & FileFree<Errors["Type"], "errors">;
311
- }): FunctionDefinition<Kind, Definition, Args, undefined, Errors, Errors["Type"]>;
312
- <Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, undefined, void, Errors["Type"]> & WithoutArgs & WithoutReturns & {
370
+ }): FunctionDefinition<Kind, Definition, Environment, Args, undefined, Errors, Errors["Type"]>;
371
+ <Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Environment, undefined, void, Errors["Type"]> & WithoutArgs & WithoutReturns & {
313
372
  readonly errors: Errors & ResolvedFunctionValue & FileFree<Errors["Type"], "errors">;
314
- }): FunctionDefinition<Kind, Definition, undefined, undefined, Errors, Errors["Type"]>;
315
- <const Args extends Schema.Struct.Fields, Returns extends TransportSchema, HandlerType extends Handler<Kind, Definition, Args, Returns["Type"], ErrorValue> = Handler<Kind, Definition, Args, Returns["Type"], never>>(definition: WithArgs<Kind, Args> & WithReturns<Kind, Returns> & {
373
+ }): FunctionDefinition<Kind, Definition, Environment, undefined, undefined, Errors, Errors["Type"]>;
374
+ <const Args extends Schema.Struct.Fields, Returns extends TransportSchema, HandlerType extends Handler<Kind, Definition, Environment, Args, Returns["Type"], ErrorValue> = Handler<Kind, Definition, Environment, Args, Returns["Type"], never>>(definition: WithArgs<Kind, Args> & WithReturns<Kind, Returns> & {
316
375
  readonly errors?: never;
317
376
  readonly handler: HandlerType;
318
- }): FunctionDefinition<Kind, Definition, Args, Returns, undefined, HandlerFailure<HandlerType>>;
319
- <Returns extends TransportSchema, HandlerType extends Handler<Kind, Definition, undefined, Returns["Type"], ErrorValue> = Handler<Kind, Definition, undefined, Returns["Type"], never>>(definition: WithoutArgs & WithReturns<Kind, Returns> & {
377
+ }): FunctionDefinition<Kind, Definition, Environment, Args, Returns, undefined, HandlerFailure<HandlerType>>;
378
+ <Returns extends TransportSchema, HandlerType extends Handler<Kind, Definition, Environment, undefined, Returns["Type"], ErrorValue> = Handler<Kind, Definition, Environment, undefined, Returns["Type"], never>>(definition: WithoutArgs & WithReturns<Kind, Returns> & {
320
379
  readonly errors?: never;
321
380
  readonly handler: HandlerType;
322
- }): FunctionDefinition<Kind, Definition, undefined, Returns, undefined, HandlerFailure<HandlerType>>;
323
- <const Args extends Schema.Struct.Fields, HandlerType extends Handler<Kind, Definition, Args, void, ErrorValue> = Handler<Kind, Definition, Args, void, never>>(definition: WithArgs<Kind, Args> & WithoutReturns & {
381
+ }): FunctionDefinition<Kind, Definition, Environment, undefined, Returns, undefined, HandlerFailure<HandlerType>>;
382
+ <const Args extends Schema.Struct.Fields, HandlerType extends Handler<Kind, Definition, Environment, Args, void, ErrorValue> = Handler<Kind, Definition, Environment, Args, void, never>>(definition: WithArgs<Kind, Args> & WithoutReturns & {
324
383
  readonly errors?: never;
325
384
  readonly handler: HandlerType;
326
- }): FunctionDefinition<Kind, Definition, Args, undefined, undefined, HandlerFailure<HandlerType>>;
327
- <HandlerType extends Handler<Kind, Definition, undefined, void, ErrorValue> = Handler<Kind, Definition, undefined, void, never>>(definition: WithoutArgs & WithoutReturns & {
385
+ }): FunctionDefinition<Kind, Definition, Environment, Args, undefined, undefined, HandlerFailure<HandlerType>>;
386
+ <HandlerType extends Handler<Kind, Definition, Environment, undefined, void, ErrorValue> = Handler<Kind, Definition, Environment, undefined, void, never>>(definition: WithoutArgs & WithoutReturns & {
328
387
  readonly errors?: never;
329
388
  readonly handler: HandlerType;
330
- }): FunctionDefinition<Kind, Definition, undefined, undefined, undefined, HandlerFailure<HandlerType>>;
389
+ }): FunctionDefinition<Kind, Definition, Environment, undefined, undefined, undefined, HandlerFailure<HandlerType>>;
331
390
  }
332
- interface FunctionBuilders<Definition extends Tables> {
333
- readonly query: DefineFunction<"Query", Definition>;
334
- readonly mutation: DefineFunction<"Mutation", Definition>;
391
+ interface FunctionBuilders<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> {
392
+ readonly query: DefineFunction<"Query", Definition, Environment>;
393
+ readonly mutation: DefineFunction<"Mutation", Definition, Environment>;
335
394
  }
336
- interface SchemaBindings<Definition extends Tables> extends FunctionBuilders<Definition> {
395
+ interface SchemaBindings<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> extends FunctionBuilders<Definition, Environment> {
337
396
  readonly values: BoundValues<Definition>;
338
397
  }
339
- declare const bindSchema: <const Definition extends Tables>(schema: DefinedSchema<Definition>) => SchemaBindings<Definition>;
398
+ declare function bindSchema<const Definition extends Tables>(schema: DefinedSchema<Definition>): SchemaBindings<Definition, typeof emptyEnv>;
399
+ declare function bindSchema<const Definition extends Tables, const Environment extends DefinedEnv>(schema: DefinedSchema<Definition>, environment: Environment): SchemaBindings<Definition, Environment>;
340
400
  //#endregion
341
- export { Document as a, SchemaDefinitionTypeId as c, defineSchema as i, SchemaAuthoring as n, Id as o, bindSchema as r, SchemaDefinitionOf as s, DefinedSchema as t };
342
- //# sourceMappingURL=index-2q9FwJud.d.ts.map
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 };
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-DR_8vfKg.js";
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-DzcR7spt.js";
1
+ import { n as functionPathOf, t as createApi } from "../api-CAgKDij7.js";
2
2
  export { createApi, functionPathOf };
@@ -1,14 +1,16 @@
1
- import { c as Result, d as TransportObject, f as TransportValue, i as ErrorValue, u as documentNotFound } from "../id-Cs82tq9Q-hmYFyqTa.js";
2
- import "../sync-a2EdGSdY.js";
3
- import { n as PaginationPage, t as PaginationOptions } from "../pagination-Bt3l7QaC-BYEGmLBE.js";
4
- import "../pagination-CFJ3xlAt.js";
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";
5
7
  import { Effect, Schema } from "effect";
6
8
  //#region ../contracts/dist/runtime/functions.d.ts
7
9
  //#region src/runtime/functions.d.ts
8
10
  declare const FunctionKind: Schema.Literals<readonly ["Mutation", "Query"]>;
9
11
  type FunctionKind = typeof FunctionKind.Type;
10
12
  //#endregion
11
- //#region ../runtime/dist/guest-DjAV4yQ0.d.ts
13
+ //#region ../runtime/dist/guest-BN_3RI9b.d.ts
12
14
  //#region src/guest.d.ts
13
15
  interface GuestFunctionDefinition {
14
16
  readonly _tag: FunctionKind;
@@ -32,30 +34,32 @@ interface GuestQueryRange {
32
34
  interface GuestDatabaseQuery {
33
35
  readonly index: (name: string, range?: (builder: GuestQueryRange) => GuestQueryRange) => GuestDatabaseQuery;
34
36
  readonly order: (direction: "asc" | "desc") => GuestDatabaseQuery;
35
- readonly collect: () => Result<ReadonlyArray<TransportObject>, never>;
36
- readonly take: (count: number) => Result<ReadonlyArray<TransportObject>, never>;
37
- readonly first: () => Result<TransportObject | undefined, never>;
38
- readonly unique: () => Result<TransportObject | undefined, never>;
39
- readonly paginate: (options: PaginationOptions) => Result<PaginationPage<TransportObject>, never>;
37
+ readonly collect: () => Result$1<ReadonlyArray<TransportObject>, never>;
38
+ readonly take: (count: number) => Result$1<ReadonlyArray<TransportObject>, never>;
39
+ readonly first: () => Result$1<TransportObject | undefined, never>;
40
+ readonly unique: () => Result$1<TransportObject | undefined, never>;
41
+ readonly paginate: (options: PaginationOptions) => Result$1<PaginationPage<TransportObject>, never>;
40
42
  }
41
43
  interface GuestDatabaseReader {
42
- readonly find: (table: string, id: string) => Result<TransportObject | undefined, never>;
43
- readonly get: (table: string, id: string) => Result<TransportObject, ReturnType<typeof documentNotFound>>;
44
+ readonly find: (table: string, id: string) => Result$1<TransportObject | undefined, never>;
45
+ readonly get: (table: string, id: string) => Result$1<TransportObject, ReturnType<typeof documentNotFound>>;
44
46
  readonly query: (table: string) => GuestDatabaseQuery;
45
47
  }
46
48
  interface GuestDatabaseWriter extends GuestDatabaseReader {
47
- readonly delete: (table: string, id: string) => Result<void, ReturnType<typeof documentNotFound>>;
48
- readonly insert: (table: string, value: TransportObject) => Result<string, never>;
49
- readonly patch: (table: string, id: string, value: TransportObject) => Result<void, ReturnType<typeof documentNotFound>>;
50
- readonly replace: (table: string, id: string, value: TransportObject) => Result<void, ReturnType<typeof documentNotFound>>;
49
+ readonly delete: (table: string, id: string) => Result$1<void, ReturnType<typeof documentNotFound>>;
50
+ readonly insert: (table: string, value: TransportObject) => Result$1<string, never>;
51
+ readonly patch: (table: string, id: string, value: TransportObject) => Result$1<void, ReturnType<typeof documentNotFound>>;
52
+ readonly replace: (table: string, id: string, value: TransportObject) => Result$1<void, ReturnType<typeof documentNotFound>>;
51
53
  }
52
54
  interface GuestQueryContext {
53
55
  readonly db: GuestDatabaseReader;
56
+ readonly id: IdContext;
54
57
  }
55
58
  interface GuestMutationContext {
56
59
  readonly db: GuestDatabaseWriter;
60
+ readonly id: IdContext;
57
61
  }
58
- declare const invoke: (definition: GuestFunctionDefinition, encodedArgs: Schema.Json, call: GuestHostCall) => Promise<string>;
62
+ declare const invoke: (definition: GuestFunctionDefinition, encodedArgs: Schema.Json, call: GuestHostCall, rawEnvironment?: Readonly<Record<string, string>>) => Promise<string>;
59
63
  //#endregion
60
64
  export { invoke };
61
65
  //# sourceMappingURL=host.d.ts.map