ignotum 0.0.18 → 0.0.19

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 (78) hide show
  1. package/README.md +73 -62
  2. package/dist/cli/Undici-C6Asbalt.mjs +30 -0
  3. package/dist/cli/Undici-C6Asbalt.mjs.map +1 -0
  4. package/dist/cli/bin.mjs +732 -24022
  5. package/dist/cli/bin.mjs.map +1 -1
  6. package/dist/platform/_headers +1 -1
  7. package/dist/platform/_ignotum/v1.1/client.js +12 -0
  8. package/dist/runtime/{api-BnUKx9cj-D49Tf0rX.d.ts → api-BnUKx9cj-K-F-SOLs.d.ts} +4 -4
  9. package/dist/runtime/{api-C-tltz6s.js → api-CrrSjYL1.js} +2 -2
  10. package/dist/runtime/{api-C-tltz6s.js.map → api-CrrSjYL1.js.map} +1 -1
  11. package/dist/runtime/{bootstrap-DlNIfH-r.js → bootstrap-CLVnD5vS.js} +4 -4
  12. package/dist/runtime/bootstrap-CLVnD5vS.js.map +1 -0
  13. package/dist/runtime/{bootstrap-DjTwGJao-DBx5zdFI.d.ts → bootstrap-DjTwGJao-DPi768T4.d.ts} +3 -3
  14. package/dist/runtime/client.d.ts +9 -9
  15. package/dist/runtime/client.js +4 -4
  16. package/dist/runtime/id-BPFV3D3V.d.ts +1 -0
  17. package/dist/runtime/{id-7an3nxTu-DZJSM5xh.d.ts → id-D87q-n2D-CDMwTSUR.d.ts} +2 -2
  18. package/dist/runtime/{id-BrEnxY-r.js → id-rzjaCxeF.js} +11 -2
  19. package/dist/runtime/{id-BrEnxY-r.js.map → id-rzjaCxeF.js.map} +1 -1
  20. package/dist/runtime/{index-Biaw5vdF.d.ts → index-BWHInzfU.d.ts} +3 -3
  21. package/dist/runtime/internal/api.d.ts +1 -1
  22. package/dist/runtime/internal/api.js +1 -1
  23. package/dist/runtime/internal/bootstrap.d.ts +1 -1
  24. package/dist/runtime/internal/bootstrap.js +1 -1
  25. package/dist/runtime/internal/client.d.ts +1 -1
  26. package/dist/runtime/internal/client.js +4 -4
  27. package/dist/runtime/internal/client.js.map +1 -1
  28. package/dist/runtime/internal/host.d.ts +6 -6
  29. package/dist/runtime/internal/host.js +3 -3
  30. package/dist/runtime/internal/routes.d.ts +1 -1
  31. package/dist/runtime/internal/server.d.ts +1 -1
  32. package/dist/runtime/internal/server.js +1 -1
  33. package/dist/runtime/internal/types.d.ts +2 -2
  34. package/dist/runtime/internal/types.js +1 -1
  35. package/dist/runtime/pagination-BPFV3D3V.d.ts +1 -0
  36. package/dist/runtime/{pagination--f4kMKf6.js → pagination-CfEleffG.js} +3 -2
  37. package/dist/runtime/pagination-CfEleffG.js.map +1 -0
  38. package/dist/runtime/result-Bq32FA7g.d.ts +1 -0
  39. package/dist/runtime/{router-C1eC9yy5.js → router-CfNPtoVO.js} +109 -60
  40. package/dist/runtime/router-CfNPtoVO.js.map +1 -0
  41. package/dist/runtime/{schema-BSjepoNF.js → schema-JtFb4BbG.js} +3 -3
  42. package/dist/runtime/{schema-BSjepoNF.js.map → schema-JtFb4BbG.js.map} +1 -1
  43. package/dist/runtime/server.d.ts +5 -5
  44. package/dist/runtime/server.js +2 -2
  45. package/dist/runtime/{sync-By2hX5ev.d.ts → sync-BMmV8oYt.d.ts} +2 -2
  46. package/dist/runtime/{sync-BwgS19Xy.js → sync-DUfp7S5R.js} +2 -2
  47. package/dist/runtime/{sync-BwgS19Xy.js.map → sync-DUfp7S5R.js.map} +1 -1
  48. package/dist/runtime/{types-DeCCyqLU-CHx7KFtx.d.ts → types-BeT6F0Pg-DMvRDN0c.d.ts} +5 -5
  49. package/package.json +9 -8
  50. package/src/cli/app-configuration.ts +44 -5
  51. package/src/cli/auth-client.ts +3 -3
  52. package/src/cli/build/managed-server.ts +3 -2
  53. package/src/cli/build/server.ts +2 -2
  54. package/src/cli/command.ts +18 -11
  55. package/src/cli/control-client.ts +2 -2
  56. package/src/cli/deploy.ts +27 -2
  57. package/src/cli/dev.ts +1 -1
  58. package/src/cli/managed-dev-platform.ts +13 -4
  59. package/src/cli/module-boundaries.ts +1 -1
  60. package/src/cli/new-app.ts +35 -6
  61. package/src/cli/package-manager.ts +1 -1
  62. package/src/cli/route-static.ts +7 -2
  63. package/src/cli/typecheck.ts +66 -0
  64. package/src/cli/upload-journal.ts +3 -3
  65. package/src/dev-runtime/database.ts +1 -1
  66. package/src/dev-runtime/files.ts +1 -1
  67. package/src/dev-runtime/managed-functions.ts +3 -2
  68. package/src/dev-runtime/managed-sync.ts +114 -105
  69. package/src/dev-runtime/managed-websocket.ts +11 -7
  70. package/src/dev-runtime/migrations.ts +2 -2
  71. package/src/dev-runtime/sync.ts +3 -3
  72. package/dist/platform/_ignotum/v1.0/client.js +0 -12
  73. package/dist/runtime/bootstrap-DlNIfH-r.js.map +0 -1
  74. package/dist/runtime/id-BI08JkmR.d.ts +0 -1
  75. package/dist/runtime/pagination--f4kMKf6.js.map +0 -1
  76. package/dist/runtime/pagination-BI08JkmR.d.ts +0 -1
  77. package/dist/runtime/result-BkziOG1L.d.ts +0 -1
  78. package/dist/runtime/router-C1eC9yy5.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"schema-BSjepoNF.js","names":["utf8ByteLength","Result$1"],"sources":["../../../contracts/dist/descriptor-CTY4mtwS.js","../../../contracts/dist/schema/values.js","../../../contracts/dist/runtime/schema.js","../../../contracts/dist/schema/index.js"],"sourcesContent":["import { Effect, Function, Predicate, Schema } from \"effect\";\n//#region src/schema/evolution.ts\nconst ValueEvolutionTypeId = Symbol.for(\"ignotum/schema/ValueEvolution\");\nconst evolutionRules = (value) => value[ValueEvolutionTypeId] ?? {};\nconst codec = (value) => Schema.toCodecJson(value);\nconst encode = (schema, value) => Schema.decodeUnknownSync(Schema.Json)(Schema.encodeUnknownSync(codec(schema), { onExcessProperty: \"error\" })(value));\nconst decode = (schema, value) => Schema.decodeUnknownSync(codec(schema), { onExcessProperty: \"error\" })(value);\nconst copy = (value) => Object.create(Object.getPrototypeOf(value), Object.getOwnPropertyDescriptors(value));\nconst isValueObject = Schema.is(Schema.Record(Schema.String, Schema.Unknown));\nconst attachEvolution = (value, rules = {}) => {\n\tObject.defineProperty(value, ValueEvolutionTypeId, {\n\t\tconfigurable: true,\n\t\tvalue: rules\n\t});\n\treturn Object.assign(value, {\n\t\tdefault(defaultValue) {\n\t\t\tif (getValueDescriptor(value)?.type === \"optional\") throw new Error(\"Defaults require a non-optional validator. A default already allows omission on creation.\");\n\t\t\tconst defaultJson = JSON.stringify(encode(value, defaultValue));\n\t\t\tconst next = copy(value);\n\t\t\tconst constructor = Schema.withConstructorDefault(Effect.sync(() => decode(value, JSON.parse(defaultJson))))(value);\n\t\t\tObject.defineProperty(next, \"ast\", {\n\t\t\t\tvalue: constructor.ast,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\t\t\treturn attachEvolution(next, {\n\t\t\t\t...rules,\n\t\t\t\tdefaultJson\n\t\t\t});\n\t\t},\n\t\trenameFrom(name) {\n\t\t\tif (name.length === 0 || [\n\t\t\t\t\"id\",\n\t\t\t\t\"createdAt\",\n\t\t\t\t\"updatedAt\"\n\t\t\t].includes(name)) throw new Error(`Cannot rename reserved or empty field '${name}'.`);\n\t\t\treturn attachEvolution(copy(value), {\n\t\t\t\t...rules,\n\t\t\t\trenameFrom: name\n\t\t\t});\n\t\t},\n\t\tfrom(previous, convert) {\n\t\t\tif (getValueDescriptor(previous) === void 0) throw new Error(\"Historical values must use an Ignotum values validator.\");\n\t\t\treturn attachEvolution(copy(value), {\n\t\t\t\t...rules,\n\t\t\t\tprevious: [...rules.previous ?? [], {\n\t\t\t\t\tschema: previous,\n\t\t\t\t\tconvert\n\t\t\t\t}]\n\t\t\t});\n\t\t}\n\t});\n};\nconst withValueChildren = (value, children) => {\n\tattachEvolution(value, {\n\t\t...evolutionRules(value),\n\t\tchildren\n\t});\n\treturn value;\n};\nconst validateFieldRenames = (fields) => {\n\tconst sources = /* @__PURE__ */ new Set();\n\tfor (const [name, field] of Object.entries(fields)) {\n\t\tconst source = evolutionRules(field).renameFrom;\n\t\tif (source === void 0) continue;\n\t\tif (source === name || Object.hasOwn(fields, source) || sources.has(source)) throw new Error(`Rename source '${source}' conflicts with another field.`);\n\t\tsources.add(source);\n\t}\n};\nconst mapChildren = (schema, value, visit, rename) => {\n\tconst children = evolutionRules(schema).children;\n\tif (children === void 0) return value;\n\tswitch (children.type) {\n\t\tcase \"object\": {\n\t\t\tif (!isValueObject(value)) return value;\n\t\t\tconst result = { ...value };\n\t\t\tfor (const [name, field] of Object.entries(children.fields)) {\n\t\t\t\tconst source = rename ? evolutionRules(field).renameFrom : void 0;\n\t\t\t\tif (source !== void 0 && Object.hasOwn(result, source)) {\n\t\t\t\t\tif (Object.hasOwn(result, name)) throw new Error(`Both '${name}' and its rename source '${source}' are present.`);\n\t\t\t\t\tObject.defineProperty(result, name, {\n\t\t\t\t\t\tvalue: result[source],\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t});\n\t\t\t\t\tdelete result[source];\n\t\t\t\t}\n\t\t\t\tconst next = visit(field, Object.hasOwn(result, name) ? result[name] : void 0);\n\t\t\t\tif (next !== void 0) Object.defineProperty(result, name, {\n\t\t\t\t\tvalue: next,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\tcase \"array\": return Array.isArray(value) ? value.map((item) => visit(children.value, item)) : value;\n\t\tcase \"record\": return isValueObject(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, visit(children.value, item)])) : value;\n\t\tcase \"nullable\": return value === null ? value : visit(children.value, value);\n\t\tcase \"optional\": return value === void 0 ? value : visit(children.value, value);\n\t\tcase \"union\":\n\t\t\tfor (const member of children.members) try {\n\t\t\t\tconst result = visit(member, value);\n\t\t\t\tif (rename) decode(member, result);\n\t\t\t\telse encode(member, result);\n\t\t\t\treturn result;\n\t\t\t} catch {}\n\t\t\treturn value;\n\t}\n};\n/** Apply creation defaults to decoded values, without accepting historical representations. */\nconst applyValueDefaults = (schema, value) => {\n\tconst rules = evolutionRules(schema);\n\tif (value === void 0 && rules.defaultJson !== void 0) return decode(schema, JSON.parse(rules.defaultJson));\n\treturn mapChildren(schema, value, applyValueDefaults, false);\n};\n/** Convert a stored JSON value to the current representation, preserving already valid values. */\nconst evolveStoredValue = (schema, value) => {\n\ttry {\n\t\tdecode(schema, value);\n\t\treturn value;\n\t} catch {}\n\tconst rules = evolutionRules(schema);\n\tif (value === void 0 && rules.defaultJson !== void 0) return JSON.parse(rules.defaultJson);\n\tlet failure;\n\ttry {\n\t\tconst next = mapChildren(schema, value, evolveStoredValue, true);\n\t\tdecode(schema, next);\n\t\treturn next;\n\t} catch (cause) {\n\t\tfailure = cause;\n\t}\n\tconst matches = [];\n\tfor (const previous of rules.previous ?? []) try {\n\t\tmatches.push({\n\t\t\tprevious,\n\t\t\tvalue: decode(previous.schema, value)\n\t\t});\n\t} catch {}\n\tif (matches.length > 1) throw new Error(\"More than one historical validator matches this value.\");\n\tconst match = matches[0];\n\tif (match === void 0) throw failure;\n\treturn encode(schema, applyValueDefaults(schema, match.previous.convert(match.value)));\n};\nconst evolveStoredFields = (schema, value) => Schema.decodeUnknownSync(Schema.JsonObject)(evolveStoredValue(schema, value));\n//#endregion\n//#region src/schema/descriptor.ts\nconst LiteralValue = Schema.Union([\n\tSchema.String,\n\tSchema.Finite,\n\tSchema.Boolean\n]);\nconst DescriptorField = Schema.Struct({\n\tname: Schema.String,\n\tvalue: Schema.suspend(() => ValueDescriptor)\n});\nconst ValueDescriptor = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"array\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"boolean\") }),\n\tSchema.Struct({ type: Schema.Literal(\"date\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"file\"),\n\t\tformats: Schema.Array(Schema.Literals([\n\t\t\t\"jpeg\",\n\t\t\t\"png\",\n\t\t\t\"webp\",\n\t\t\t\"avif\",\n\t\t\t\"gif\"\n\t\t])),\n\t\tmaxBytes: Schema.Int\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"error\"),\n\t\ttag: Schema.String,\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"id\"),\n\t\ttable: Schema.String\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"userId\") }),\n\tSchema.Struct({ type: Schema.Literal(\"integer\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"literal\"),\n\t\tvalue: LiteralValue\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"literals\"),\n\t\tvalues: Schema.Array(LiteralValue)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"never\") }),\n\tSchema.Struct({ type: Schema.Literal(\"null\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"nullable\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"number\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"object\"),\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"optional\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"record\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"secret\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"string\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"union\"),\n\t\tmembers: Schema.Array(Schema.suspend(() => ValueDescriptor))\n\t})\n]);\nconst ValueDescriptorTypeId = Symbol.for(\"ignotum/schema/ValueDescriptor\");\nconst attachValueDescriptor = Function.dual(2, (value, descriptor) => {\n\tObject.defineProperty(value, ValueDescriptorTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: descriptor,\n\t\twritable: false\n\t});\n\treturn attachEvolution(value);\n});\nconst getValueDescriptor = (value) => {\n\tif (!Predicate.hasProperty(value, ValueDescriptorTypeId)) return void 0;\n\treturn Schema.is(ValueDescriptor)(value[ValueDescriptorTypeId]) ? value[ValueDescriptorTypeId] : void 0;\n};\nconst descriptorContainsFile = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"file\": return true;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\":\n\t\tcase \"secret\": return descriptorContainsFile(descriptor.value);\n\t\tcase \"error\":\n\t\tcase \"object\": return descriptor.fields.some((field) => descriptorContainsFile(field.value));\n\t\tcase \"union\": return descriptor.members.some(descriptorContainsFile);\n\t\tdefault: return false;\n\t}\n};\nconst descriptorContainsSecret = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"secret\": return true;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\": return descriptorContainsSecret(descriptor.value);\n\t\tcase \"error\":\n\t\tcase \"object\": return descriptor.fields.some((field) => descriptorContainsSecret(field.value));\n\t\tcase \"union\": return descriptor.members.some(descriptorContainsSecret);\n\t\tdefault: return false;\n\t}\n};\nconst descriptorAllowedInEnvironment = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"error\":\n\t\tcase \"file\":\n\t\tcase \"userId\":\n\t\tcase \"id\": return false;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\":\n\t\tcase \"secret\": return descriptorAllowedInEnvironment(descriptor.value);\n\t\tcase \"object\": return descriptor.fields.every((field) => descriptorAllowedInEnvironment(field.value));\n\t\tcase \"union\": return descriptor.members.every(descriptorAllowedInEnvironment);\n\t\tdefault: return true;\n\t}\n};\nconst descriptorFields = (fields) => {\n\tconst entries = [];\n\tfor (const name of Reflect.ownKeys(fields)) {\n\t\tif (!Predicate.isString(name)) throw new Error(\"Ignotum value objects only support string field names.\");\n\t\tconst field = fields[name];\n\t\tconst value = field === void 0 ? void 0 : getValueDescriptor(field);\n\t\tif (value === void 0) throw new Error(`The field '${name}' must use an Ignotum values validator.`);\n\t\tentries.push({\n\t\t\tname,\n\t\t\tvalue\n\t\t});\n\t}\n\treturn entries.sort((left, right) => left.name.localeCompare(right.name));\n};\n//#endregion\nexport { descriptorContainsFile as a, getValueDescriptor as c, evolveStoredFields as d, evolveStoredValue as f, descriptorAllowedInEnvironment as i, applyValueDefaults as l, withValueChildren as m, ValueDescriptorTypeId as n, descriptorContainsSecret as o, validateFieldRenames as p, attachValueDescriptor as r, descriptorFields as s, ValueDescriptor as t, evolutionRules as u };\n\n//# sourceMappingURL=descriptor-CTY4mtwS.js.map","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, m as withValueChildren, p as validateFieldRenames, r as attachValueDescriptor, s as descriptorFields } from \"../descriptor-CTY4mtwS.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\tvalidateFieldRenames(tableFields);\n\tconst make = (indexes, schema = withValueChildren(attachValueDescriptor(Schema.Struct(tableFields), {\n\t\ttype: \"object\",\n\t\tfields: descriptorFields(tableFields)\n\t}), {\n\t\ttype: \"object\",\n\t\tfields: tableFields\n\t})) => {\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}, schema);\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\tfrom: (previous, convert) => make(indexes, schema.from(previous, convert)),\n\t\t\tindex,\n\t\t\tindexes,\n\t\t\tschema\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 withValueChildren(attachValueDescriptor(Schema.Array(value), {\n\t\ttype: \"array\",\n\t\tvalue: requireDescriptor(value)\n\t}), {\n\t\ttype: \"array\",\n\t\tvalue\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\tvalidateFieldRenames(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 = withValueChildren(attachValueDescriptor(Schema.Struct(fields), {\n\t\ttype: \"object\",\n\t\tfields: descriptorFields(fields)\n\t}), {\n\t\ttype: \"object\",\n\t\tfields\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 withValueChildren(attachValueDescriptor(Schema.optional(value), {\n\t\ttype: \"optional\",\n\t\tvalue: requireDescriptor(value)\n\t}), {\n\t\ttype: \"optional\",\n\t\tvalue\n\t});\n};\nconst nullable = (value) => {\n\treturn withValueChildren(attachValueDescriptor(Schema.NullOr(value), {\n\t\ttype: \"nullable\",\n\t\tvalue: requireDescriptor(value)\n\t}), {\n\t\ttype: \"nullable\",\n\t\tvalue\n\t});\n};\nconst record = (value) => {\n\treturn withValueChildren(attachValueDescriptor(Schema.Record(Schema.String, value), {\n\t\ttype: \"record\",\n\t\tvalue: requireDescriptor(value)\n\t}), {\n\t\ttype: \"record\",\n\t\tvalue\n\t});\n};\nconst union = (...members) => {\n\treturn withValueChildren(attachValueDescriptor(Schema.Union(members), {\n\t\ttype: \"union\",\n\t\tmembers: members.map(requireDescriptor)\n\t}), {\n\t\ttype: \"union\",\n\t\tmembers\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, d as evolveStoredFields, f as evolveStoredValue, i as descriptorAllowedInEnvironment, l as applyValueDefaults, n as ValueDescriptorTypeId, o as descriptorContainsSecret, r as attachValueDescriptor, s as descriptorFields, t as ValueDescriptor, u as evolutionRules } from \"../descriptor-CTY4mtwS.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, applyValueDefaults, attachValueDescriptor, bindSchema, bindValues, decodeDefinedEnvironment, decodeEnvironment, defineEnv, defineSchema, descriptorAllowedInEnvironment, descriptorContainsFile, descriptorContainsSecret, descriptorFields, emptyEnv, environmentLimits, environmentValues, evolutionRules, evolveStoredFields, evolveStoredValue, fileFormats, fileLimits, fileMimeTypes, getValueDescriptor, isDefinedEnv, isDefinedSchema, isFileValue, schemaIndexLimits, table, values };\n\n//# sourceMappingURL=index.js.map"],"mappings":";;;;;AAEA,MAAM,uBAAuB,OAAO,IAAI,+BAA+B;AACvE,MAAM,kBAAkB,UAAU,MAAM,yBAAyB,CAAC;AAClE,MAAM,SAAS,UAAU,OAAO,YAAY,KAAK;AACjD,MAAM,UAAU,QAAQ,UAAU,OAAO,kBAAkB,OAAO,IAAI,CAAC,CAAC,OAAO,kBAAkB,MAAM,MAAM,GAAG,EAAE,kBAAkB,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AACrJ,MAAM,UAAU,QAAQ,UAAU,OAAO,kBAAkB,MAAM,MAAM,GAAG,EAAE,kBAAkB,QAAQ,CAAC,CAAC,CAAC,KAAK;AAC9G,MAAM,QAAQ,UAAU,OAAO,OAAO,OAAO,eAAe,KAAK,GAAG,OAAO,0BAA0B,KAAK,CAAC;AAC3G,MAAM,gBAAgB,OAAO,GAAG,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,CAAC;AAC5E,MAAM,mBAAmB,OAAO,QAAQ,CAAC,MAAM;CAC9C,OAAO,eAAe,OAAO,sBAAsB;EAClD,cAAc;EACd,OAAO;CACR,CAAC;CACD,OAAO,OAAO,OAAO,OAAO;EAC3B,QAAQ,cAAc;GACrB,IAAI,mBAAmB,KAAK,CAAC,EAAE,SAAS,YAAY,MAAM,IAAI,MAAM,2FAA2F;GAC/J,MAAM,cAA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O,eAAe,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;EAC5G,IAAIA,OAAS,UAAU,MAAM,GAAG,OAAO,OAAO,aAAa,GAAG;EAC9D,MAAM,WAAW,OAAO,OAAO,OAAO,OAAO,oBAAoB,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC;EACvF,IAAIA,OAAS,UAAU,QAAQ,GAAG,OAAO,OAAO,aAAa,GAAG;EAChE,IAAI,SAAS,YAAY,KAAK,GAAG,QAAQ,IAAI,SAAS,KAAK,SAAS,OAAO;CAC5E;CACA,OAAO,OAAO,OAAO,OAAO;AAC7B,CAAC;AACD,MAAM,4BAA4B,aAAa,QAAQ,YAAY,yBAAyB,CAAC,GAAG;AAGhG,MAAM,uBAAuB,QAAQ,aAAa,SAAS;CAC1D,MAAM,UAAU,eAAe,0BAA0B,WAAW,CAAC,CAAC,qBAAqB,MAAM,CAAC,CAAC;EAClG,MAAM;EACN,GAAG;CACJ,CAAC,CAAC;CACF,OAAO;AACR;AACA,MAAM,wBAAwB,QAAQ,iBAAiB;CACtD,UAAU,oBAAoB,QAAQ,aAAa,UAAU;CAC7D,OAAO,oBAAoB,QAAQ,aAAa,OAAO;AACxD;AACA,SAAS,WAAW,QAAQ,cAAc,UAAU;CACnD,OAAO;EACN,QAAQ,WAAW,OAAO,uBAAuB;EACjD,GAAG,qBAAqB,QAAQ,WAAW;CAC5C;AACD"}
1
+ {"version":3,"file":"schema-JtFb4BbG.js","names":["utf8ByteLength","Result$1"],"sources":["../../../contracts/dist/descriptor-CTY4mtwS.js","../../../contracts/dist/schema/values.js","../../../contracts/dist/runtime/schema.js","../../../contracts/dist/schema/index.js"],"sourcesContent":["import { Effect, Function, Predicate, Schema } from \"effect\";\n//#region src/schema/evolution.ts\nconst ValueEvolutionTypeId = Symbol.for(\"ignotum/schema/ValueEvolution\");\nconst evolutionRules = (value) => value[ValueEvolutionTypeId] ?? {};\nconst codec = (value) => Schema.toCodecJson(value);\nconst encode = (schema, value) => Schema.decodeUnknownSync(Schema.Json)(Schema.encodeUnknownSync(codec(schema), { onExcessProperty: \"error\" })(value));\nconst decode = (schema, value) => Schema.decodeUnknownSync(codec(schema), { onExcessProperty: \"error\" })(value);\nconst copy = (value) => Object.create(Object.getPrototypeOf(value), Object.getOwnPropertyDescriptors(value));\nconst isValueObject = Schema.is(Schema.Record(Schema.String, Schema.Unknown));\nconst attachEvolution = (value, rules = {}) => {\n\tObject.defineProperty(value, ValueEvolutionTypeId, {\n\t\tconfigurable: true,\n\t\tvalue: rules\n\t});\n\treturn Object.assign(value, {\n\t\tdefault(defaultValue) {\n\t\t\tif (getValueDescriptor(value)?.type === \"optional\") throw new Error(\"Defaults require a non-optional validator. A default already allows omission on creation.\");\n\t\t\tconst defaultJson = JSON.stringify(encode(value, defaultValue));\n\t\t\tconst next = copy(value);\n\t\t\tconst constructor = Schema.withConstructorDefault(Effect.sync(() => decode(value, JSON.parse(defaultJson))))(value);\n\t\t\tObject.defineProperty(next, \"ast\", {\n\t\t\t\tvalue: constructor.ast,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\t\t\treturn attachEvolution(next, {\n\t\t\t\t...rules,\n\t\t\t\tdefaultJson\n\t\t\t});\n\t\t},\n\t\trenameFrom(name) {\n\t\t\tif (name.length === 0 || [\n\t\t\t\t\"id\",\n\t\t\t\t\"createdAt\",\n\t\t\t\t\"updatedAt\"\n\t\t\t].includes(name)) throw new Error(`Cannot rename reserved or empty field '${name}'.`);\n\t\t\treturn attachEvolution(copy(value), {\n\t\t\t\t...rules,\n\t\t\t\trenameFrom: name\n\t\t\t});\n\t\t},\n\t\tfrom(previous, convert) {\n\t\t\tif (getValueDescriptor(previous) === void 0) throw new Error(\"Historical values must use an Ignotum values validator.\");\n\t\t\treturn attachEvolution(copy(value), {\n\t\t\t\t...rules,\n\t\t\t\tprevious: [...rules.previous ?? [], {\n\t\t\t\t\tschema: previous,\n\t\t\t\t\tconvert\n\t\t\t\t}]\n\t\t\t});\n\t\t}\n\t});\n};\nconst withValueChildren = (value, children) => {\n\tattachEvolution(value, {\n\t\t...evolutionRules(value),\n\t\tchildren\n\t});\n\treturn value;\n};\nconst validateFieldRenames = (fields) => {\n\tconst sources = /* @__PURE__ */ new Set();\n\tfor (const [name, field] of Object.entries(fields)) {\n\t\tconst source = evolutionRules(field).renameFrom;\n\t\tif (source === void 0) continue;\n\t\tif (source === name || Object.hasOwn(fields, source) || sources.has(source)) throw new Error(`Rename source '${source}' conflicts with another field.`);\n\t\tsources.add(source);\n\t}\n};\nconst mapChildren = (schema, value, visit, rename) => {\n\tconst children = evolutionRules(schema).children;\n\tif (children === void 0) return value;\n\tswitch (children.type) {\n\t\tcase \"object\": {\n\t\t\tif (!isValueObject(value)) return value;\n\t\t\tconst result = { ...value };\n\t\t\tfor (const [name, field] of Object.entries(children.fields)) {\n\t\t\t\tconst source = rename ? evolutionRules(field).renameFrom : void 0;\n\t\t\t\tif (source !== void 0 && Object.hasOwn(result, source)) {\n\t\t\t\t\tif (Object.hasOwn(result, name)) throw new Error(`Both '${name}' and its rename source '${source}' are present.`);\n\t\t\t\t\tObject.defineProperty(result, name, {\n\t\t\t\t\t\tvalue: result[source],\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t});\n\t\t\t\t\tdelete result[source];\n\t\t\t\t}\n\t\t\t\tconst next = visit(field, Object.hasOwn(result, name) ? result[name] : void 0);\n\t\t\t\tif (next !== void 0) Object.defineProperty(result, name, {\n\t\t\t\t\tvalue: next,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\tcase \"array\": return Array.isArray(value) ? value.map((item) => visit(children.value, item)) : value;\n\t\tcase \"record\": return isValueObject(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, visit(children.value, item)])) : value;\n\t\tcase \"nullable\": return value === null ? value : visit(children.value, value);\n\t\tcase \"optional\": return value === void 0 ? value : visit(children.value, value);\n\t\tcase \"union\":\n\t\t\tfor (const member of children.members) try {\n\t\t\t\tconst result = visit(member, value);\n\t\t\t\tif (rename) decode(member, result);\n\t\t\t\telse encode(member, result);\n\t\t\t\treturn result;\n\t\t\t} catch {}\n\t\t\treturn value;\n\t}\n};\n/** Apply creation defaults to decoded values, without accepting historical representations. */\nconst applyValueDefaults = (schema, value) => {\n\tconst rules = evolutionRules(schema);\n\tif (value === void 0 && rules.defaultJson !== void 0) return decode(schema, JSON.parse(rules.defaultJson));\n\treturn mapChildren(schema, value, applyValueDefaults, false);\n};\n/** Convert a stored JSON value to the current representation, preserving already valid values. */\nconst evolveStoredValue = (schema, value) => {\n\ttry {\n\t\tdecode(schema, value);\n\t\treturn value;\n\t} catch {}\n\tconst rules = evolutionRules(schema);\n\tif (value === void 0 && rules.defaultJson !== void 0) return JSON.parse(rules.defaultJson);\n\tlet failure;\n\ttry {\n\t\tconst next = mapChildren(schema, value, evolveStoredValue, true);\n\t\tdecode(schema, next);\n\t\treturn next;\n\t} catch (cause) {\n\t\tfailure = cause;\n\t}\n\tconst matches = [];\n\tfor (const previous of rules.previous ?? []) try {\n\t\tmatches.push({\n\t\t\tprevious,\n\t\t\tvalue: decode(previous.schema, value)\n\t\t});\n\t} catch {}\n\tif (matches.length > 1) throw new Error(\"More than one historical validator matches this value.\");\n\tconst match = matches[0];\n\tif (match === void 0) throw failure;\n\treturn encode(schema, applyValueDefaults(schema, match.previous.convert(match.value)));\n};\nconst evolveStoredFields = (schema, value) => Schema.decodeUnknownSync(Schema.JsonObject)(evolveStoredValue(schema, value));\n//#endregion\n//#region src/schema/descriptor.ts\nconst LiteralValue = Schema.Union([\n\tSchema.String,\n\tSchema.Finite,\n\tSchema.Boolean\n]);\nconst DescriptorField = Schema.Struct({\n\tname: Schema.String,\n\tvalue: Schema.suspend(() => ValueDescriptor)\n});\nconst ValueDescriptor = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"array\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"boolean\") }),\n\tSchema.Struct({ type: Schema.Literal(\"date\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"file\"),\n\t\tformats: Schema.Array(Schema.Literals([\n\t\t\t\"jpeg\",\n\t\t\t\"png\",\n\t\t\t\"webp\",\n\t\t\t\"avif\",\n\t\t\t\"gif\"\n\t\t])),\n\t\tmaxBytes: Schema.Int\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"error\"),\n\t\ttag: Schema.String,\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"id\"),\n\t\ttable: Schema.String\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"userId\") }),\n\tSchema.Struct({ type: Schema.Literal(\"integer\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"literal\"),\n\t\tvalue: LiteralValue\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"literals\"),\n\t\tvalues: Schema.Array(LiteralValue)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"never\") }),\n\tSchema.Struct({ type: Schema.Literal(\"null\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"nullable\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"number\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"object\"),\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"optional\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"record\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"secret\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"string\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"union\"),\n\t\tmembers: Schema.Array(Schema.suspend(() => ValueDescriptor))\n\t})\n]);\nconst ValueDescriptorTypeId = Symbol.for(\"ignotum/schema/ValueDescriptor\");\nconst attachValueDescriptor = Function.dual(2, (value, descriptor) => {\n\tObject.defineProperty(value, ValueDescriptorTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: descriptor,\n\t\twritable: false\n\t});\n\treturn attachEvolution(value);\n});\nconst getValueDescriptor = (value) => {\n\tif (!Predicate.hasProperty(value, ValueDescriptorTypeId)) return void 0;\n\treturn Schema.is(ValueDescriptor)(value[ValueDescriptorTypeId]) ? value[ValueDescriptorTypeId] : void 0;\n};\nconst descriptorContainsFile = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"file\": return true;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\":\n\t\tcase \"secret\": return descriptorContainsFile(descriptor.value);\n\t\tcase \"error\":\n\t\tcase \"object\": return descriptor.fields.some((field) => descriptorContainsFile(field.value));\n\t\tcase \"union\": return descriptor.members.some(descriptorContainsFile);\n\t\tdefault: return false;\n\t}\n};\nconst descriptorContainsSecret = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"secret\": return true;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\": return descriptorContainsSecret(descriptor.value);\n\t\tcase \"error\":\n\t\tcase \"object\": return descriptor.fields.some((field) => descriptorContainsSecret(field.value));\n\t\tcase \"union\": return descriptor.members.some(descriptorContainsSecret);\n\t\tdefault: return false;\n\t}\n};\nconst descriptorAllowedInEnvironment = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"error\":\n\t\tcase \"file\":\n\t\tcase \"userId\":\n\t\tcase \"id\": return false;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\":\n\t\tcase \"secret\": return descriptorAllowedInEnvironment(descriptor.value);\n\t\tcase \"object\": return descriptor.fields.every((field) => descriptorAllowedInEnvironment(field.value));\n\t\tcase \"union\": return descriptor.members.every(descriptorAllowedInEnvironment);\n\t\tdefault: return true;\n\t}\n};\nconst descriptorFields = (fields) => {\n\tconst entries = [];\n\tfor (const name of Reflect.ownKeys(fields)) {\n\t\tif (!Predicate.isString(name)) throw new Error(\"Ignotum value objects only support string field names.\");\n\t\tconst field = fields[name];\n\t\tconst value = field === void 0 ? void 0 : getValueDescriptor(field);\n\t\tif (value === void 0) throw new Error(`The field '${name}' must use an Ignotum values validator.`);\n\t\tentries.push({\n\t\t\tname,\n\t\t\tvalue\n\t\t});\n\t}\n\treturn entries.sort((left, right) => left.name.localeCompare(right.name));\n};\n//#endregion\nexport { descriptorContainsFile as a, getValueDescriptor as c, evolveStoredFields as d, evolveStoredValue as f, descriptorAllowedInEnvironment as i, applyValueDefaults as l, withValueChildren as m, ValueDescriptorTypeId as n, descriptorContainsSecret as o, validateFieldRenames as p, attachValueDescriptor as r, descriptorFields as s, ValueDescriptor as t, evolutionRules as u };\n\n//# sourceMappingURL=descriptor-CTY4mtwS.js.map","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, m as withValueChildren, p as validateFieldRenames, r as attachValueDescriptor, s as descriptorFields } from \"../descriptor-CTY4mtwS.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\tvalidateFieldRenames(tableFields);\n\tconst make = (indexes, schema = withValueChildren(attachValueDescriptor(Schema.Struct(tableFields), {\n\t\ttype: \"object\",\n\t\tfields: descriptorFields(tableFields)\n\t}), {\n\t\ttype: \"object\",\n\t\tfields: tableFields\n\t})) => {\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}, schema);\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\tfrom: (previous, convert) => make(indexes, schema.from(previous, convert)),\n\t\t\tindex,\n\t\t\tindexes,\n\t\t\tschema\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 withValueChildren(attachValueDescriptor(Schema.Array(value), {\n\t\ttype: \"array\",\n\t\tvalue: requireDescriptor(value)\n\t}), {\n\t\ttype: \"array\",\n\t\tvalue\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\tvalidateFieldRenames(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 = withValueChildren(attachValueDescriptor(Schema.Struct(fields), {\n\t\ttype: \"object\",\n\t\tfields: descriptorFields(fields)\n\t}), {\n\t\ttype: \"object\",\n\t\tfields\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 withValueChildren(attachValueDescriptor(Schema.optional(value), {\n\t\ttype: \"optional\",\n\t\tvalue: requireDescriptor(value)\n\t}), {\n\t\ttype: \"optional\",\n\t\tvalue\n\t});\n};\nconst nullable = (value) => {\n\treturn withValueChildren(attachValueDescriptor(Schema.NullOr(value), {\n\t\ttype: \"nullable\",\n\t\tvalue: requireDescriptor(value)\n\t}), {\n\t\ttype: \"nullable\",\n\t\tvalue\n\t});\n};\nconst record = (value) => {\n\treturn withValueChildren(attachValueDescriptor(Schema.Record(Schema.String, value), {\n\t\ttype: \"record\",\n\t\tvalue: requireDescriptor(value)\n\t}), {\n\t\ttype: \"record\",\n\t\tvalue\n\t});\n};\nconst union = (...members) => {\n\treturn withValueChildren(attachValueDescriptor(Schema.Union(members), {\n\t\ttype: \"union\",\n\t\tmembers: members.map(requireDescriptor)\n\t}), {\n\t\ttype: \"union\",\n\t\tmembers\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, d as evolveStoredFields, f as evolveStoredValue, i as descriptorAllowedInEnvironment, l as applyValueDefaults, n as ValueDescriptorTypeId, o as descriptorContainsSecret, r as attachValueDescriptor, s as descriptorFields, t as ValueDescriptor, u as evolutionRules } from \"../descriptor-CTY4mtwS.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, applyValueDefaults, attachValueDescriptor, bindSchema, bindValues, decodeDefinedEnvironment, decodeEnvironment, defineEnv, defineSchema, descriptorAllowedInEnvironment, descriptorContainsFile, descriptorContainsSecret, descriptorFields, emptyEnv, environmentLimits, environmentValues, evolutionRules, evolveStoredFields, evolveStoredValue, fileFormats, fileLimits, fileMimeTypes, getValueDescriptor, isDefinedEnv, isDefinedSchema, isFileValue, schemaIndexLimits, table, values };\n\n//# sourceMappingURL=index.js.map"],"mappings":";;;;;AAEA,MAAM,uBAAuB,OAAO,IAAI,+BAA+B;AACvE,MAAM,kBAAkB,UAAU,MAAM,yBAAyB,CAAC;AAClE,MAAM,SAAS,UAAU,OAAO,YAAY,KAAK;AACjD,MAAM,UAAU,QAAQ,UAAU,OAAO,kBAAkB,OAAO,IAAI,CAAC,CAAC,OAAO,kBAAkB,MAAM,MAAM,GAAG,EAAE,kBAAkB,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AACrJ,MAAM,UAAU,QAAQ,UAAU,OAAO,kBAAkB,MAAM,MAAM,GAAG,EAAE,kBAAkB,QAAQ,CAAC,CAAC,CAAC,KAAK;AAC9G,MAAM,QAAQ,UAAU,OAAO,OAAO,OAAO,eAAe,KAAK,GAAG,OAAO,0BAA0B,KAAK,CAAC;AAC3G,MAAM,gBAAgB,OAAO,GAAG,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,CAAC;AAC5E,MAAM,mBAAmB,OAAO,QAAQ,CAAC,MAAM;CAC9C,OAAO,eAAe,OAAO,sBAAsB;E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O,YAAY,KAAK,GAAG,QAAQ,IAAI,SAAS,KAAK,OAAO,OAAO;GACvE;EACD;EACA,IAAI,UAAU,KAAK,GAAG,OAAO,OAAO,aAAa,GAAG;EACpD,MAAM,SAAS,OAAO,OAAO,OAAO,OAAO,oBAAoB,OAAO,eAAe,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;EAC5G,IAAIA,OAAS,UAAU,MAAM,GAAG,OAAO,OAAO,aAAa,GAAG;EAC9D,MAAM,WAAW,OAAO,OAAO,OAAO,OAAO,oBAAoB,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC;EACvF,IAAIA,OAAS,UAAU,QAAQ,GAAG,OAAO,OAAO,aAAa,GAAG;EAChE,IAAI,SAAS,YAAY,KAAK,GAAG,QAAQ,IAAI,SAAS,KAAK,SAAS,OAAO;CAC5E;CACA,OAAO,OAAO,OAAO,OAAO;AAC7B,CAAC;AACD,MAAM,4BAA4B,aAAa,QAAQ,YAAY,yBAAyB,CAAC,GAAG;AAGhG,MAAM,uBAAuB,QAAQ,aAAa,SAAS;CAC1D,MAAM,UAAU,eAAe,0BAA0B,WAAW,CAAC,CAAC,qBAAqB,MAAM,CAAC,CAAC;EAClG,MAAM;EACN,GAAG;CACJ,CAAC,CAAC;CACF,OAAO;AACR;AACA,MAAM,wBAAwB,QAAQ,iBAAiB;CACtD,UAAU,oBAAoB,QAAQ,aAAa,UAAU;CAC7D,OAAO,oBAAoB,QAAQ,aAAa,OAAO;AACxD;AACA,SAAS,WAAW,QAAQ,cAAc,UAAU;CACnD,OAAO;EACN,QAAQ,WAAW,OAAO,uBAAuB;EACjD,GAAG,qBAAqB,QAAQ,WAAW;CAC5C;AACD"}
@@ -1,8 +1,8 @@
1
- import { T as UserId, l as defineEnv$1, m as Secret$1, r as EnvironmentAuthoring, t as DefinedEnv, w as User } from "./types-DeCCyqLU-CHx7KFtx.js";
2
- import { c as Result$1, g as FileValue, h as FileMimeType, i as ErrorValue, m as FileMetadata, p as FileFormat } from "./id-7an3nxTu-DZJSM5xh.js";
3
- import { i as defineSchema$1, n as SchemaAuthoring, t as DefinedSchema } from "./index-Biaw5vdF.js";
4
- import "./result-BkziOG1L.js";
5
- import "./id-BI08JkmR.js";
1
+ import { T as UserId, l as defineEnv$1, m as Secret$1, r as EnvironmentAuthoring, t as DefinedEnv, w as User } from "./types-BeT6F0Pg-DMvRDN0c.js";
2
+ import { c as Result$1, g as FileValue, h as FileMimeType, i as ErrorValue, m as FileMetadata, p as FileFormat } from "./id-D87q-n2D-CDMwTSUR.js";
3
+ import { i as defineSchema$1, n as SchemaAuthoring, t as DefinedSchema } from "./index-BWHInzfU.js";
4
+ import "./result-Bq32FA7g.js";
5
+ import "./id-BPFV3D3V.js";
6
6
  //#region ../platform/dist/versions/1/guest/server/index.d.ts
7
7
  //#region src/versions/1/guest/server/index.d.ts
8
8
  declare const Result: typeof Result$1;
@@ -1,5 +1,5 @@
1
- import { h as Result$1 } from "./id-BrEnxY-r.js";
2
- import { a as defineSchema$1, i as defineEnv$1, l as Secret$1 } from "./schema-BSjepoNF.js";
1
+ import { g as Result$1 } from "./id-rzjaCxeF.js";
2
+ import { a as defineSchema$1, i as defineEnv$1, l as Secret$1 } from "./schema-JtFb4BbG.js";
3
3
  //#region ../platform/dist/versions/1/guest/server/index.js
4
4
  const Result = Result$1;
5
5
  const defineEnv = defineEnv$1;
@@ -1,8 +1,8 @@
1
- import "./id-7an3nxTu-DZJSM5xh.js";
1
+ import "./id-D87q-n2D-CDMwTSUR.js";
2
2
  import { Schema } from "effect";
3
3
  //#region ../contracts/dist/runtime/sync.d.ts
4
4
  declare const FunctionAddress: Schema.TemplateLiteral<readonly ["api.", Schema.String, ".", Schema.String]>;
5
5
  type FunctionAddress = typeof FunctionAddress.Type;
6
6
  //#endregion
7
7
  export { FunctionAddress as t };
8
- //# sourceMappingURL=sync-By2hX5ev.d.ts.map
8
+ //# sourceMappingURL=sync-BMmV8oYt.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { d as VersionId, l as SubscriptionId, o as InvocationId, r as AppId } from "./artifact-BB5qzoa6.js";
2
- import { G as ActivationGeneration, K as AppStateRevision, M as FileId, o as SessionState } from "./id-BrEnxY-r.js";
2
+ import { K as ActivationGeneration, N as FileId, o as SessionState, q as AppStateRevision } from "./id-rzjaCxeF.js";
3
3
  import { Schema } from "effect";
4
4
  //#region ../contracts/dist/runtime/sync.js
5
5
  const FunctionNamePart = Schema.String.check(Schema.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]*$/));
@@ -175,4 +175,4 @@ Schema.fromJsonString(ServerMessage);
175
175
  //#endregion
176
176
  export { WireSuccess as i, WireFailure as n, WireResult as r, FunctionAddress as t };
177
177
 
178
- //# sourceMappingURL=sync-BwgS19Xy.js.map
178
+ //# sourceMappingURL=sync-DUfp7S5R.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync-BwgS19Xy.js","names":[],"sources":["../../../contracts/dist/runtime/sync.js"],"sourcesContent":["import { AppId, InvocationId, SubscriptionId, VersionId } from \"./id.js\";\nimport { ActivationGeneration, AppStateRevision } from \"./identity.js\";\nimport { FileId } from \"../schema/file.js\";\nimport { TransportValueSchema, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue } from \"./value.js\";\nimport { SessionState } from \"../id.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/sync.ts\nconst FunctionNamePart = Schema.String.check(Schema.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]*$/));\nconst ApiFunctionAddressParts = Schema.TemplateLiteralParser([\n\t\"api.\",\n\tFunctionNamePart,\n\t\".\",\n\tFunctionNamePart\n]);\nconst FunctionAddress = Schema.TemplateLiteral([\n\t\"api.\",\n\tFunctionNamePart,\n\t\".\",\n\tFunctionNamePart\n]);\nconst apiFunctionParts = (address) => {\n\tconst [, moduleName, , functionName] = Schema.decodeSync(ApiFunctionAddressParts)(address);\n\treturn {\n\t\tfunctionName,\n\t\tmoduleName\n\t};\n};\nconst Subscribe = Schema.Struct({\n\ttype: Schema.Literal(\"Subscribe\"),\n\tid: SubscriptionId,\n\tfunction: FunctionAddress,\n\targs: Schema.Json\n});\nconst Unsubscribe = Schema.Struct({\n\ttype: Schema.Literal(\"Unsubscribe\"),\n\tid: SubscriptionId\n});\nconst Invoke = Schema.Struct({\n\ttype: Schema.Literal(\"Invoke\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tfunction: FunctionAddress,\n\targs: Schema.Json\n});\nconst Prepare = Schema.Struct({\n\ttype: Schema.Literal(\"Prepare\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tfunction: FunctionAddress,\n\targs: Schema.Json,\n\tfiles: Schema.Array(FileId)\n});\nconst ClientMessage = Schema.Union([\n\tSubscribe,\n\tUnsubscribe,\n\tPrepare,\n\tInvoke\n]);\nconst SubscriptionOperation = Schema.Struct({\n\ttype: Schema.Literal(\"Subscription\"),\n\tid: SubscriptionId\n});\nconst InvocationOperation = Schema.Struct({\n\ttype: Schema.Literal(\"Invocation\"),\n\tid: InvocationId\n});\nconst Operation = Schema.Union([SubscriptionOperation, InvocationOperation]);\nconst DatePath = Schema.Array(Schema.Union([Schema.String, Schema.Natural]));\nconst DatePaths = Schema.Array(DatePath);\nconst WireSuccess = Schema.Struct({\n\ttype: Schema.Literal(\"Success\"),\n\tvalue: Schema.optional(Schema.Json),\n\tdates: Schema.optional(DatePaths)\n});\nconst WireFailure = Schema.Struct({\n\ttype: Schema.Literal(\"Failure\"),\n\terror: Schema.Json,\n\tdates: Schema.optional(DatePaths)\n});\nconst WireResult = Schema.Union([WireSuccess, WireFailure]);\nconst SyncHandshake = Schema.Struct({\n\tsession: Schema.optional(SessionState),\n\tserverTime: Schema.optional(Schema.Finite),\n\ttype: Schema.Literal(\"Handshake\"),\n\tappId: AppId,\n\tversionId: VersionId,\n\tgeneration: ActivationGeneration\n});\nconst Snapshot = Schema.Struct({\n\tidentity: Schema.optional(Schema.Struct({\n\t\tsessionEpoch: Schema.String,\n\t\tviewRevision: Schema.Natural,\n\t\tdependsOnId: Schema.Boolean\n\t})),\n\ttype: Schema.Literal(\"Snapshot\"),\n\tid: SubscriptionId,\n\tresult: WireResult,\n\trevision: AppStateRevision,\n\tfiles: Schema.optional(Schema.Array(Schema.Struct({\n\t\tid: FileId,\n\t\turl: Schema.String\n\t})))\n});\nconst Preparation = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Preparation\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tuploads: Schema.Array(Schema.Struct({\n\t\tid: FileId,\n\t\turl: Schema.optional(Schema.String)\n\t}))\n});\nconst SyncResultSuccess = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireSuccess,\n\tcommittedRevision: AppStateRevision\n});\nconst SyncResultFailure = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireFailure\n});\nconst ErrorCode = Schema.Literals([\n\t\"SessionChanged\",\n\t\"SessionExpired\",\n\t\"DuplicateOperationId\",\n\t\"FunctionUnavailable\",\n\t\"InvalidArguments\",\n\t\"InvalidMessage\",\n\t\"InvocationIdConflict\",\n\t\"ResourceLimitExceeded\",\n\t\"UnknownFunction\",\n\t\"WrongFunctionKind\"\n]);\nconst SyncError = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Error\"),\n\toperation: Schema.optional(Operation),\n\tcode: ErrorCode,\n\tmessage: Schema.String\n});\nconst Version = Schema.Struct({\n\ttype: Schema.Literal(\"Version\"),\n\tversionId: VersionId,\n\tgeneration: ActivationGeneration\n});\nconst VersionCloseCode = 4409;\nconst Session = Schema.Union([Schema.Struct({\n\ttype: Schema.Literal(\"Session\"),\n\tevent: Schema.Literal(\"Updated\"),\n\tserverTime: Schema.Finite,\n\tsession: SessionState\n}), Schema.Struct({\n\ttype: Schema.Literal(\"Session\"),\n\tevent: Schema.Literals([\n\t\t\"SignedOut\",\n\t\t\"Revoked\",\n\t\t\"Expired\",\n\t\t\"Unavailable\",\n\t\t\"Replaced\"\n\t]),\n\tsessionEpoch: Schema.String\n})]);\nconst Invalidate = Schema.Struct({\n\ttype: Schema.Literal(\"Invalidate\"),\n\tsessionEpoch: Schema.String,\n\tids: Schema.Array(SubscriptionId)\n});\nconst ServerMessage = Schema.Union([\n\tSession,\n\tInvalidate,\n\tSyncHandshake,\n\tSnapshot,\n\tPreparation,\n\tSyncResultSuccess,\n\tSyncResultFailure,\n\tSyncError,\n\tVersion\n]);\nconst ClientMessageJson = Schema.fromJsonString(ClientMessage);\nconst ServerMessageJson = Schema.fromJsonString(ServerMessage);\n//#endregion\nexport { ClientMessage, ClientMessageJson, DatePath, ErrorCode, FunctionAddress, FunctionNamePart, Invalidate, InvocationId, Operation, ServerMessage, ServerMessageJson, Session, SubscriptionId, SyncHandshake, TransportValueSchema, Version, VersionCloseCode, WireFailure, WireResult, WireSuccess, apiFunctionParts, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue };\n\n//# sourceMappingURL=sync.js.map"],"mappings":";;;;AAOA,MAAM,mBAAmB,OAAO,OAAO,MAAM,OAAO,UAAU,4BAA4B,CAAC;AAC3D,OAAO,sBAAsB;CAC5D;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,kBAAkB,OAAO,gBAAgB;CAC9C;CACA;CACA;CACA;AACD,CAAC;AAQD,MAAM,YAAY,OAAO,OAAO;CAC/B,MAAM,OAAO,QAAQ,WAAW;CAChC,IAAI;CACJ,UAAU;CACV,MAAM,OAAO;AACd,CAAC;AACD,MAAM,cAAc,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,aAAa;CAClC,IAAI;AACL,CAAC;AACD,MAAM,SAAS,OAAO,OAAO;CAC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AO;CAC3C,MAAM,OAAO,QAAQ,SAAS;CAC9B,OAAO,OAAO,QAAQ,SAAS;CAC/B,YAAY,OAAO;CACnB,SAAS;AACV,CAAC,GAAG,OAAO,OAAO;CACjB,MAAM,OAAO,QAAQ,SAAS;CAC9B,OAAO,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,cAAc,OAAO;AACtB,CAAC,CAAC,CAAC;AACH,MAAM,aAAa,OAAO,OAAO;CAChC,MAAM,OAAO,QAAQ,YAAY;CACjC,cAAc,OAAO;CACrB,KAAK,OAAO,MAAM,cAAc;AACjC,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACyB,OAAO,eAAe,aAAa;AACnC,OAAO,eAAe,aAAa"}
1
+ {"version":3,"file":"sync-DUfp7S5R.js","names":[],"sources":["../../../contracts/dist/runtime/sync.js"],"sourcesContent":["import { AppId, InvocationId, SubscriptionId, VersionId } from \"./id.js\";\nimport { ActivationGeneration, AppStateRevision } from \"./identity.js\";\nimport { FileId } from \"../schema/file.js\";\nimport { TransportValueSchema, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue } from \"./value.js\";\nimport { SessionState } from \"../id.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/sync.ts\nconst FunctionNamePart = Schema.String.check(Schema.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]*$/));\nconst ApiFunctionAddressParts = Schema.TemplateLiteralParser([\n\t\"api.\",\n\tFunctionNamePart,\n\t\".\",\n\tFunctionNamePart\n]);\nconst FunctionAddress = Schema.TemplateLiteral([\n\t\"api.\",\n\tFunctionNamePart,\n\t\".\",\n\tFunctionNamePart\n]);\nconst apiFunctionParts = (address) => {\n\tconst [, moduleName, , functionName] = Schema.decodeSync(ApiFunctionAddressParts)(address);\n\treturn {\n\t\tfunctionName,\n\t\tmoduleName\n\t};\n};\nconst Subscribe = Schema.Struct({\n\ttype: Schema.Literal(\"Subscribe\"),\n\tid: SubscriptionId,\n\tfunction: FunctionAddress,\n\targs: Schema.Json\n});\nconst Unsubscribe = Schema.Struct({\n\ttype: Schema.Literal(\"Unsubscribe\"),\n\tid: SubscriptionId\n});\nconst Invoke = Schema.Struct({\n\ttype: Schema.Literal(\"Invoke\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tfunction: FunctionAddress,\n\targs: Schema.Json\n});\nconst Prepare = Schema.Struct({\n\ttype: Schema.Literal(\"Prepare\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tfunction: FunctionAddress,\n\targs: Schema.Json,\n\tfiles: Schema.Array(FileId)\n});\nconst ClientMessage = Schema.Union([\n\tSubscribe,\n\tUnsubscribe,\n\tPrepare,\n\tInvoke\n]);\nconst SubscriptionOperation = Schema.Struct({\n\ttype: Schema.Literal(\"Subscription\"),\n\tid: SubscriptionId\n});\nconst InvocationOperation = Schema.Struct({\n\ttype: Schema.Literal(\"Invocation\"),\n\tid: InvocationId\n});\nconst Operation = Schema.Union([SubscriptionOperation, InvocationOperation]);\nconst DatePath = Schema.Array(Schema.Union([Schema.String, Schema.Natural]));\nconst DatePaths = Schema.Array(DatePath);\nconst WireSuccess = Schema.Struct({\n\ttype: Schema.Literal(\"Success\"),\n\tvalue: Schema.optional(Schema.Json),\n\tdates: Schema.optional(DatePaths)\n});\nconst WireFailure = Schema.Struct({\n\ttype: Schema.Literal(\"Failure\"),\n\terror: Schema.Json,\n\tdates: Schema.optional(DatePaths)\n});\nconst WireResult = Schema.Union([WireSuccess, WireFailure]);\nconst SyncHandshake = Schema.Struct({\n\tsession: Schema.optional(SessionState),\n\tserverTime: Schema.optional(Schema.Finite),\n\ttype: Schema.Literal(\"Handshake\"),\n\tappId: AppId,\n\tversionId: VersionId,\n\tgeneration: ActivationGeneration\n});\nconst Snapshot = Schema.Struct({\n\tidentity: Schema.optional(Schema.Struct({\n\t\tsessionEpoch: Schema.String,\n\t\tviewRevision: Schema.Natural,\n\t\tdependsOnId: Schema.Boolean\n\t})),\n\ttype: Schema.Literal(\"Snapshot\"),\n\tid: SubscriptionId,\n\tresult: WireResult,\n\trevision: AppStateRevision,\n\tfiles: Schema.optional(Schema.Array(Schema.Struct({\n\t\tid: FileId,\n\t\turl: Schema.String\n\t})))\n});\nconst Preparation = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Preparation\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tuploads: Schema.Array(Schema.Struct({\n\t\tid: FileId,\n\t\turl: Schema.optional(Schema.String)\n\t}))\n});\nconst SyncResultSuccess = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireSuccess,\n\tcommittedRevision: AppStateRevision\n});\nconst SyncResultFailure = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireFailure\n});\nconst ErrorCode = Schema.Literals([\n\t\"SessionChanged\",\n\t\"SessionExpired\",\n\t\"DuplicateOperationId\",\n\t\"FunctionUnavailable\",\n\t\"InvalidArguments\",\n\t\"InvalidMessage\",\n\t\"InvocationIdConflict\",\n\t\"ResourceLimitExceeded\",\n\t\"UnknownFunction\",\n\t\"WrongFunctionKind\"\n]);\nconst SyncError = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Error\"),\n\toperation: Schema.optional(Operation),\n\tcode: ErrorCode,\n\tmessage: Schema.String\n});\nconst Version = Schema.Struct({\n\ttype: Schema.Literal(\"Version\"),\n\tversionId: VersionId,\n\tgeneration: ActivationGeneration\n});\nconst VersionCloseCode = 4409;\nconst Session = Schema.Union([Schema.Struct({\n\ttype: Schema.Literal(\"Session\"),\n\tevent: Schema.Literal(\"Updated\"),\n\tserverTime: Schema.Finite,\n\tsession: SessionState\n}), Schema.Struct({\n\ttype: Schema.Literal(\"Session\"),\n\tevent: Schema.Literals([\n\t\t\"SignedOut\",\n\t\t\"Revoked\",\n\t\t\"Expired\",\n\t\t\"Unavailable\",\n\t\t\"Replaced\"\n\t]),\n\tsessionEpoch: Schema.String\n})]);\nconst Invalidate = Schema.Struct({\n\ttype: Schema.Literal(\"Invalidate\"),\n\tsessionEpoch: Schema.String,\n\tids: Schema.Array(SubscriptionId)\n});\nconst ServerMessage = Schema.Union([\n\tSession,\n\tInvalidate,\n\tSyncHandshake,\n\tSnapshot,\n\tPreparation,\n\tSyncResultSuccess,\n\tSyncResultFailure,\n\tSyncError,\n\tVersion\n]);\nconst ClientMessageJson = Schema.fromJsonString(ClientMessage);\nconst ServerMessageJson = Schema.fromJsonString(ServerMessage);\n//#endregion\nexport { ClientMessage, ClientMessageJson, DatePath, ErrorCode, FunctionAddress, FunctionNamePart, Invalidate, InvocationId, Operation, ServerMessage, ServerMessageJson, Session, SubscriptionId, SyncHandshake, TransportValueSchema, Version, VersionCloseCode, WireFailure, WireResult, WireSuccess, apiFunctionParts, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue };\n\n//# sourceMappingURL=sync.js.map"],"mappings":";;;;AAOA,MAAM,mBAAmB,OAAO,OAAO,MAAM,OAAO,UAAU,4BAA4B,CAAC;AAC3D,OAAO,sBAAsB;CAC5D;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,kBAAkB,OAAO,gBAAgB;CAC9C;CACA;CACA;CACA;AACD,CAAC;AAQD,MAAM,YAAY,OAAO,OAAO;CAC/B,MAAM,OAAO,QAAQ,WAAW;CAChC,IAAI;CACJ,UAAU;CACV,MAAM,OAAO;AACd,CAAC;AACD,MAAM,cAAc,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,aAAa;CAClC,IAAI;AACL,CAAC;AACD,MAAM,SAAS,OAAO,OAAO;CAC5B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;CAC3C,MAAM,OAAO,QAAQ,SAAS;CAC9B,OAAO,OAAO,QAAQ,SAAS;CAC/B,YAAY,OAAO;CACnB,SAAS;AACV,CAAC,GAAG,OAAO,OAAO;CACjB,MAAM,OAAO,QAAQ,SAAS;CAC9B,OAAO,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,cAAc,OAAO;AACtB,CAAC,CAAC,CAAC;AACH,MAAM,aAAa,OAAO,OAAO;CAChC,MAAM,OAAO,QAAQ,YAAY;CACjC,cAAc,OAAO;CACrB,KAAK,OAAO,MAAM,cAAc;AACjC,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACyB,OAAO,eAAe,aAAa;AACnC,OAAO,eAAe,aAAa"}
@@ -1,4 +1,4 @@
1
- import { _ as fileFormats, c as Result$1, g as FileValue, p as FileFormat, r as ErrorBrand, t as GeneratedId } from "./id-7an3nxTu-DZJSM5xh.js";
1
+ import { _ as fileFormats, c as Result$1, g as FileValue, p as FileFormat, r as ErrorBrand, t as GeneratedId } from "./id-D87q-n2D-CDMwTSUR.js";
2
2
  import { Brand, Effect, Redacted, Schema, Struct } from "effect";
3
3
  //#region ../contracts/dist/descriptor-DUgW3hSe.d.ts
4
4
  //#region src/schema/evolution.d.ts
@@ -104,7 +104,7 @@ interface IdContext {
104
104
  declare const SessionOutcome: Schema.Literals<readonly ["SignedIn", "ProfileUpdated", "Cancelled"]>;
105
105
  type SessionOutcome = typeof SessionOutcome.Type;
106
106
  //#endregion
107
- //#region ../contracts/dist/pagination-CbYlCjjP.d.ts
107
+ //#region ../contracts/dist/pagination-yfh1_FUK.d.ts
108
108
  //#region src/runtime/pagination.d.ts
109
109
  declare const PaginationCursor: Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">;
110
110
  type PaginationCursor = typeof PaginationCursor.Type;
@@ -118,7 +118,7 @@ interface PaginationPage<Item> {
118
118
  readonly nextCursor: PaginationCursor | null;
119
119
  }
120
120
  //#endregion
121
- //#region ../contracts/dist/values-DM_s3QjY.d.ts
121
+ //#region ../contracts/dist/values-CETTcvTn.d.ts
122
122
  //#region src/schema/values.d.ts
123
123
  declare const IdTargetsTypeId: unique symbol;
124
124
  declare const UnresolvedReferencesTypeId: unique symbol;
@@ -286,7 +286,7 @@ type BoundValues<Definition extends TableDefinitions> = Omit<typeof values, "id"
286
286
  readonly pagination: () => ReturnType<typeof pagination> & Schema.Schema<PaginationOptions>;
287
287
  };
288
288
  //#endregion
289
- //#region ../contracts/dist/types-DeCCyqLU.d.ts
289
+ //#region ../contracts/dist/types-BeT6F0Pg.d.ts
290
290
  //#region src/schema/environment.d.ts
291
291
  declare const EnvironmentDefinitionTypeId: unique symbol;
292
292
  declare const EnvironmentDecoderTypeId: unique symbol;
@@ -338,4 +338,4 @@ type DocumentFields<TableName extends string, Table extends TableDefinitionLike>
338
338
  type Document<Definition extends TablesLike, TableName extends TableNameOf<Definition>> = { readonly [FieldName in keyof DocumentFields<TableName, Definition[TableName]>]: DocumentFields<TableName, Definition[TableName]>[FieldName]; };
339
339
  //#endregion
340
340
  export { SessionOutcome as C, ProfileField as S, UserId as T, table as _, Id as a, PaginationPage as b, SchemaDefinitionTypeId as c, BoundValues as d, IdTargetsOf as f, UnresolvedReferencesTypeId as g, TableDefinition as h, EnvironmentType as i, defineEnv as l, Secret as m, Document as n, SchemaDefinitionContract as o, IndexDefinitions as p, EnvironmentAuthoring as r, SchemaDefinitionOf as s, DefinedEnv as t, emptyEnv as u, values as v, User as w, IdContext as x, PaginationOptions as y };
341
- //# sourceMappingURL=types-DeCCyqLU-CHx7KFtx.d.ts.map
341
+ //# sourceMappingURL=types-BeT6F0Pg-DMvRDN0c.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ignotum",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Ignotum is an opinionated TypeScript application cloud.",
5
5
  "author": "Johannes Schießl",
6
6
  "repository": {
@@ -79,14 +79,14 @@
79
79
  "registry": "https://registry.npmjs.org/"
80
80
  },
81
81
  "dependencies": {
82
- "@effect/platform-browser": "4.0.0-rc.111",
82
+ "@effect/platform-browser": "4.0.0",
83
83
  "@jridgewell/remapping": "2.3.5",
84
84
  "@prefresh/core": "1.5.10",
85
85
  "@prefresh/utils": "1.2.1",
86
86
  "@prefresh/vite": "3.0.1",
87
87
  "@tailwindcss/vite": "4.3.3",
88
- "better-auth": "1.6.25",
89
- "effect": "4.0.0-rc.111",
88
+ "better-auth": "1.7.7",
89
+ "effect": "4.0.0",
90
90
  "magic-string": "0.30.21",
91
91
  "nanoid": "6.0.1",
92
92
  "open": "11.0.0",
@@ -96,17 +96,18 @@
96
96
  "preact": "10.29.8",
97
97
  "semver": "7.8.5",
98
98
  "tailwindcss": "4.3.3",
99
+ "undici": "8.11.2",
99
100
  "vite": "8.2.2"
100
101
  },
101
102
  "devDependencies": {
102
103
  "@cloudflare/vitest-plugin": "1.1.1",
103
104
  "@cloudflare/workers-types": "5.20260901.1",
104
- "@effect/platform-node": "4.0.0-rc.111",
105
- "@effect/sql-d1": "4.0.0-rc.112",
106
- "@effect/sql-sqlite-node": "4.0.0-rc.111",
105
+ "@effect/platform-node": "4.0.0",
106
+ "@effect/sql-d1": "4.0.0",
107
+ "@effect/sql-sqlite-node": "4.0.0",
107
108
  "@playwright/test": "1.63.0",
108
109
  "@types/semver": "^7.8.0",
109
- "alchemy": "2.0.0-beta.74",
110
+ "alchemy": "2.0.0-beta.80",
110
111
  "miniflare": "5.20260826.0-alpha",
111
112
  "quickjs-emscripten": "0.32.0",
112
113
  "redis": "6.2.1",
@@ -2,7 +2,7 @@ import { AppSlug, type ControlApp } from "@ignotum/contracts/control";
2
2
  import { AppId } from "@ignotum/contracts/runtime/identity";
3
3
  import * as Versioned from "@ignotum/contracts/versioned";
4
4
  import { Effect, FileSystem, Path, Schema } from "effect";
5
- import { Prompt } from "effect/unstable/cli";
5
+ import { Prompt } from "effect/cli";
6
6
 
7
7
  import { ControlApiError, ControlClient, HostedControlConfiguration } from "./control-client.js";
8
8
 
@@ -16,6 +16,12 @@ const AppConfigurationThroughV1 = Versioned.initial(AppConfigurationV1);
16
16
  export const AppConfiguration = AppConfigurationThroughV1;
17
17
  export type AppConfiguration = typeof AppConfiguration.Type;
18
18
 
19
+ const ProjectConfigurationV1 = Schema.Struct({
20
+ formatVersion: Schema.Literal(1),
21
+ suggestedSlug: Schema.String,
22
+ });
23
+ const ProjectConfiguration = Versioned.initial(ProjectConfigurationV1);
24
+
19
25
  export class AppConfigurationInvalid extends Schema.TaggedError<AppConfigurationInvalid>()(
20
26
  "AppConfigurationInvalid",
21
27
  {
@@ -30,6 +36,26 @@ const invalid = (message: string, cause?: unknown) =>
30
36
  const appConfigurationPath = (appDirectory: string, path: Path.Path): string =>
31
37
  path.join(appDirectory, ".ignotum", "app.json");
32
38
 
39
+ const loadSuggestedSlug = Effect.fn("AppConfiguration.loadSuggestedSlug")(function* (
40
+ appDirectory: string,
41
+ ) {
42
+ const fileSystem = yield* FileSystem.FileSystem;
43
+ const path = yield* Path.Path;
44
+ const configPath = path.join(appDirectory, "ignotum.json");
45
+ if (!(yield* fileSystem.exists(configPath))) return undefined;
46
+ const text = yield* fileSystem
47
+ .readFileString(configPath)
48
+ .pipe(Effect.mapError((cause) => invalid(`Could not read ${configPath}.`, cause)));
49
+ const configuration = yield* Schema.decodeEffect(Schema.fromJsonString(ProjectConfiguration))(
50
+ text,
51
+ ).pipe(
52
+ Effect.mapError((cause) =>
53
+ invalid(`${configPath} is not a valid project configuration.`, cause),
54
+ ),
55
+ );
56
+ return Schema.is(AppSlug)(configuration.suggestedSlug) ? configuration.suggestedSlug : undefined;
57
+ });
58
+
33
59
  const loadAppConfiguration = Effect.fn("AppConfiguration.load")(function* (appDirectory: string) {
34
60
  const fileSystem = yield* FileSystem.FileSystem;
35
61
  const path = yield* Path.Path;
@@ -72,7 +98,7 @@ const writeAppConfiguration = Effect.fn("AppConfiguration.write")(function* (
72
98
 
73
99
  const promptForSlug = Effect.fn("AppConfiguration.promptForSlug")(function* () {
74
100
  const value = yield* Prompt.run(
75
- Prompt.text({
101
+ Prompt.String({
76
102
  message: "App slug",
77
103
  validate: (input) =>
78
104
  Schema.decodeEffect(AppSlug)(input).pipe(
@@ -118,11 +144,24 @@ export const configureApp = Effect.fn("AppConfiguration.configure")(function* (
118
144
  return configured;
119
145
  }
120
146
 
121
- const slug = requestedSlug ?? (yield* promptForSlug());
122
- const app = yield* control.getAppBySlug(slug).pipe(
147
+ const suggestedSlug =
148
+ requestedSlug === undefined ? yield* loadSuggestedSlug(appDirectory) : undefined;
149
+ const resolveApp = (slug: AppSlug) =>
150
+ control.getAppBySlug(slug).pipe(
151
+ Effect.catchTags({
152
+ ControlApiError: (error: ControlApiError) =>
153
+ error.code === "AppNotFound" ? control.createApp(slug) : Effect.fail(error),
154
+ }),
155
+ );
156
+ const slug = requestedSlug ?? suggestedSlug ?? (yield* promptForSlug());
157
+ const app = yield* resolveApp(slug).pipe(
123
158
  Effect.catchTags({
124
159
  ControlApiError: (error: ControlApiError) =>
125
- error.code === "AppNotFound" ? control.createApp(slug) : Effect.fail(error),
160
+ requestedSlug === undefined &&
161
+ suggestedSlug !== undefined &&
162
+ (error.code === "AppAccessDenied" || error.code === "SlugUnavailable")
163
+ ? promptForSlug().pipe(Effect.flatMap(resolveApp))
164
+ : Effect.fail(error),
126
165
  }),
127
166
  );
128
167
  const configuration = {
@@ -63,9 +63,9 @@ export class AuthCredentialStore extends Context.Service<
63
63
  Effect.gen(function* () {
64
64
  const fileSystem = yield* FileSystem.FileSystem;
65
65
  const path = yield* Path.Path;
66
- const configured = yield* Config.option(Config.string("IGNOTUM_CONFIG_DIR"));
67
- const xdg = yield* Config.option(Config.string("XDG_CONFIG_HOME"));
68
- const appData = yield* Config.option(Config.string("APPDATA"));
66
+ const configured = yield* Config.option(Config.String("IGNOTUM_CONFIG_DIR"));
67
+ const xdg = yield* Config.option(Config.String("XDG_CONFIG_HOME"));
68
+ const appData = yield* Config.option(Config.String("APPDATA"));
69
69
  const configurationDirectory = Option.getOrElse(configured, () =>
70
70
  Option.getOrElse(xdg, () =>
71
71
  process.platform === "win32" && Option.isSome(appData)
@@ -1,4 +1,5 @@
1
- import { Crypto, Effect, Encoding, FileSystem, Path, Schema } from "effect";
1
+ import { Base64Url } from "effect/encoding";
2
+ import { Crypto, Effect, FileSystem, Path, Schema } from "effect";
2
3
  import { normalizePath, type Plugin } from "vite";
3
4
  import {
4
5
  AppModuleId,
@@ -269,7 +270,7 @@ export const compileManagedServer = Effect.fn("Deploy.compileManagedServer")(fun
269
270
  const environmentBytes = utf8Bytes(
270
271
  `${encodeCanonical(EnvironmentArtifact, {
271
272
  formatVersion: 1,
272
- nonce: Encoding.encodeBase64Url(yield* crypto.randomBytes(32)),
273
+ nonce: Base64Url.encode(yield* crypto.randomBytes(32)),
273
274
  values: discovered.environment.values,
274
275
  })}\n`,
275
276
  );
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
4
4
 
5
5
  import * as Config from "effect/Config";
6
6
  import { Array, Effect, FileSystem, Path, Predicate, Schema, Stream, String } from "effect";
7
- import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
7
+ import { ChildProcess, ChildProcessSpawner } from "effect/process";
8
8
  import { createServer, defaultServerConditions, normalizePath } from "vite";
9
9
  import type { ViteDevServer } from "vite";
10
10
 
@@ -106,7 +106,7 @@ const acquireModuleRunner = Effect.fn("Deploy.acquireServerModuleRunner")(functi
106
106
  conditions: ReadonlyArray<string>,
107
107
  ) {
108
108
  const boundaries = yield* moduleBoundariesPlugin("Server", appDirectory);
109
- const discoveryCacheDirectory = yield* Config.string("IGNOTUM_DISCOVERY_CACHE_DIR").pipe(
109
+ const discoveryCacheDirectory = yield* Config.String("IGNOTUM_DISCOVERY_CACHE_DIR").pipe(
110
110
  Config.withDefault(""),
111
111
  );
112
112
  return yield* Effect.acquireRelease(