ignotum 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/bin.mjs +1183 -447
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/runtime/{api-DzcR7spt.js → api-CAgKDij7.js} +38 -2
- package/dist/runtime/api-CAgKDij7.js.map +1 -0
- package/dist/runtime/{api-5XSrIeqW.d.ts → api-Cv3hMbzo.d.ts} +4 -4
- package/dist/runtime/client.d.ts +39 -9
- package/dist/runtime/client.js +362 -63
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/descriptor-DCCz5AHd-_nhlnu8U.js +298 -0
- package/dist/runtime/descriptor-DCCz5AHd-_nhlnu8U.js.map +1 -0
- package/dist/runtime/id-Bt9XWRGL.js +423 -0
- package/dist/runtime/id-Bt9XWRGL.js.map +1 -0
- package/dist/runtime/{id-Cs82tq9Q-CK-maMgN.d.ts → id-BzFHf3Wo-DGPCjgrf.d.ts} +2 -2
- package/dist/runtime/id-E7JKqQ9r.d.ts +1 -0
- package/dist/runtime/index-DWU-7TIh.d.ts +185 -0
- package/dist/runtime/internal/api.d.ts +1 -1
- package/dist/runtime/internal/api.js +1 -1
- package/dist/runtime/internal/host.d.ts +28 -7
- package/dist/runtime/internal/host.js +37 -8
- package/dist/runtime/internal/host.js.map +1 -1
- package/dist/runtime/internal/server.d.ts +1 -1
- package/dist/runtime/internal/server.js +1 -1
- package/dist/runtime/internal/types.d.ts +2 -1
- package/dist/runtime/internal/types.js +1 -1
- package/dist/runtime/{pagination-D-R9NR61-CpIoHFoI.d.ts → pagination-CpYCaRYD-C2Rpp4Cw.d.ts} +42 -7
- package/dist/runtime/pagination-E7JKqQ9r.d.ts +1 -0
- package/dist/runtime/result-DKAA4gpS.d.ts +1 -0
- package/dist/runtime/{schema-B9XxyRO8.js → schema-DqogEydG.js} +41 -12
- package/dist/runtime/schema-DqogEydG.js.map +1 -0
- package/dist/runtime/server.d.ts +7 -4
- package/dist/runtime/server.js +2 -2
- package/dist/runtime/server.js.map +1 -1
- package/dist/runtime/{sync-avN7NkcU.d.ts → sync-Bs8J3fIr.d.ts} +2 -2
- package/dist/runtime/types-C1iDP2Yf-BnkfBOQf.d.ts +224 -0
- package/package.json +2 -2
- package/src/cli/agent-files.ts +10 -0
- package/src/cli/build/server.ts +35 -6
- package/src/cli/command.ts +25 -2
- package/src/cli/deploy.ts +34 -11
- package/src/client/hooks.ts +68 -0
- package/src/client/id.ts +259 -0
- package/src/client/index.ts +5 -2
- package/src/client/sync.ts +144 -11
- package/src/dev-runtime/database.ts +77 -2
- package/src/dev-runtime/functions.ts +111 -88
- package/src/dev-runtime/id.ts +190 -0
- package/src/dev-runtime/migrations.ts +9 -0
- package/src/dev-runtime/query-cache.ts +105 -0
- package/src/dev-runtime/sync.ts +149 -17
- package/src/internal/host.ts +1 -1
- package/src/server/index.ts +2 -0
- package/dist/runtime/api-DzcR7spt.js.map +0 -1
- package/dist/runtime/descriptor-XzDX2JDw-j3O6YHgW.js +0 -330
- package/dist/runtime/descriptor-XzDX2JDw-j3O6YHgW.js.map +0 -1
- package/dist/runtime/file-C1abuMgd.js +0 -173
- package/dist/runtime/file-C1abuMgd.js.map +0 -1
- package/dist/runtime/index-CrWg4Z0y.d.ts +0 -398
- package/dist/runtime/pagination-CX5IPbEi.d.ts +0 -1
- package/dist/runtime/result-DIjKM-p4.d.ts +0 -1
- package/dist/runtime/schema-B9XxyRO8.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
1
|
+
import { I as fileLimits, M as constrainedFileValue, N as fileFormats, O as FileFormat, W as GeneratedId, c as UserId, h as ErrorBrand } from "./id-Bt9XWRGL.js";
|
|
2
|
+
import { a as descriptorFields, c as validateFieldRenames, d as PaginationPageSize, i as descriptorAllowedInEnvironment, l as withValueChildren, r as attachValueDescriptor, s as getValueDescriptor, u as PaginationCursor } from "./descriptor-DCCz5AHd-_nhlnu8U.js";
|
|
3
3
|
import { Effect, Predicate, Redacted, Result, Schema, Struct } from "effect";
|
|
4
4
|
//#region ../contracts/dist/schema/values.js
|
|
5
5
|
const LiteralValueSchema = Schema.Union([
|
|
@@ -24,7 +24,14 @@ const utf8ByteLength$1 = (value) => {
|
|
|
24
24
|
};
|
|
25
25
|
const table = (fields) => {
|
|
26
26
|
const tableFields = fields;
|
|
27
|
-
|
|
27
|
+
validateFieldRenames(tableFields);
|
|
28
|
+
const make = (indexes, schema = withValueChildren(attachValueDescriptor(Schema.Struct(tableFields), {
|
|
29
|
+
type: "object",
|
|
30
|
+
fields: descriptorFields(tableFields)
|
|
31
|
+
}), {
|
|
32
|
+
type: "object",
|
|
33
|
+
fields: tableFields
|
|
34
|
+
})) => {
|
|
28
35
|
const index = (name, fieldNames) => {
|
|
29
36
|
if (utf8ByteLength$1(name) > schemaIndexLimits.nameBytes) throw new Error(`Index names cannot exceed ${schemaIndexLimits.nameBytes} UTF-8 bytes.`);
|
|
30
37
|
if (name.length === 0) throw new Error("Index names cannot be empty.");
|
|
@@ -47,7 +54,7 @@ const table = (fields) => {
|
|
|
47
54
|
name,
|
|
48
55
|
fields: fieldNames
|
|
49
56
|
}
|
|
50
|
-
});
|
|
57
|
+
}, schema);
|
|
51
58
|
};
|
|
52
59
|
return {
|
|
53
60
|
_tag: "Table",
|
|
@@ -56,9 +63,10 @@ const table = (fields) => {
|
|
|
56
63
|
fields: descriptorFields(tableFields)
|
|
57
64
|
},
|
|
58
65
|
fields: tableFields,
|
|
66
|
+
from: (previous, convert) => make(indexes, schema.from(previous, convert)),
|
|
59
67
|
index,
|
|
60
68
|
indexes,
|
|
61
|
-
schema
|
|
69
|
+
schema
|
|
62
70
|
};
|
|
63
71
|
};
|
|
64
72
|
return make({});
|
|
@@ -105,6 +113,7 @@ const makeIdSchema = (tableName) => {
|
|
|
105
113
|
table: tableName
|
|
106
114
|
});
|
|
107
115
|
};
|
|
116
|
+
const userId = () => attachValueDescriptor(fresh(UserId), { type: "userId" });
|
|
108
117
|
const id = (tableName) => makeIdSchema(tableName);
|
|
109
118
|
const requireDescriptor = (value) => {
|
|
110
119
|
const descriptor = getValueDescriptor(value);
|
|
@@ -112,15 +121,19 @@ const requireDescriptor = (value) => {
|
|
|
112
121
|
return descriptor;
|
|
113
122
|
};
|
|
114
123
|
const array = (value) => {
|
|
115
|
-
return attachValueDescriptor(Schema.Array(value), {
|
|
124
|
+
return withValueChildren(attachValueDescriptor(Schema.Array(value), {
|
|
116
125
|
type: "array",
|
|
117
126
|
value: requireDescriptor(value)
|
|
127
|
+
}), {
|
|
128
|
+
type: "array",
|
|
129
|
+
value
|
|
118
130
|
});
|
|
119
131
|
};
|
|
120
132
|
const assertFieldsExist = (fields, keys, operation) => {
|
|
121
133
|
for (const key of keys) if (!Object.hasOwn(fields, key)) throw new Error(`Cannot ${operation} unknown field '${String(key)}'.`);
|
|
122
134
|
};
|
|
123
135
|
const fixedObject = (fields) => {
|
|
136
|
+
validateFieldRenames(fields);
|
|
124
137
|
const pick = (...keys) => {
|
|
125
138
|
assertFieldsExist(fields, keys, "pick");
|
|
126
139
|
return fixedObject(Struct.pick(fields, keys));
|
|
@@ -150,9 +163,12 @@ const fixedObject = (fields) => {
|
|
|
150
163
|
}
|
|
151
164
|
return fixedObject(partialFields);
|
|
152
165
|
};
|
|
153
|
-
const schema = attachValueDescriptor(Schema.Struct(fields), {
|
|
166
|
+
const schema = withValueChildren(attachValueDescriptor(Schema.Struct(fields), {
|
|
154
167
|
type: "object",
|
|
155
168
|
fields: descriptorFields(fields)
|
|
169
|
+
}), {
|
|
170
|
+
type: "object",
|
|
171
|
+
fields
|
|
156
172
|
});
|
|
157
173
|
return Object.assign(schema, {
|
|
158
174
|
extend,
|
|
@@ -164,27 +180,39 @@ const fixedObject = (fields) => {
|
|
|
164
180
|
};
|
|
165
181
|
const object = (fields) => fixedObject(fields);
|
|
166
182
|
const optional = (value) => {
|
|
167
|
-
return attachValueDescriptor(Schema.optional(value), {
|
|
183
|
+
return withValueChildren(attachValueDescriptor(Schema.optional(value), {
|
|
168
184
|
type: "optional",
|
|
169
185
|
value: requireDescriptor(value)
|
|
186
|
+
}), {
|
|
187
|
+
type: "optional",
|
|
188
|
+
value
|
|
170
189
|
});
|
|
171
190
|
};
|
|
172
191
|
const nullable = (value) => {
|
|
173
|
-
return attachValueDescriptor(Schema.NullOr(value), {
|
|
192
|
+
return withValueChildren(attachValueDescriptor(Schema.NullOr(value), {
|
|
174
193
|
type: "nullable",
|
|
175
194
|
value: requireDescriptor(value)
|
|
195
|
+
}), {
|
|
196
|
+
type: "nullable",
|
|
197
|
+
value
|
|
176
198
|
});
|
|
177
199
|
};
|
|
178
200
|
const record = (value) => {
|
|
179
|
-
return attachValueDescriptor(Schema.Record(Schema.String, value), {
|
|
201
|
+
return withValueChildren(attachValueDescriptor(Schema.Record(Schema.String, value), {
|
|
180
202
|
type: "record",
|
|
181
203
|
value: requireDescriptor(value)
|
|
204
|
+
}), {
|
|
205
|
+
type: "record",
|
|
206
|
+
value
|
|
182
207
|
});
|
|
183
208
|
};
|
|
184
209
|
const union = (...members) => {
|
|
185
|
-
return attachValueDescriptor(Schema.Union(members), {
|
|
210
|
+
return withValueChildren(attachValueDescriptor(Schema.Union(members), {
|
|
186
211
|
type: "union",
|
|
187
212
|
members: members.map(requireDescriptor)
|
|
213
|
+
}), {
|
|
214
|
+
type: "union",
|
|
215
|
+
members
|
|
188
216
|
});
|
|
189
217
|
};
|
|
190
218
|
const Secret = {
|
|
@@ -224,6 +252,7 @@ const error = (tag, fields) => {
|
|
|
224
252
|
return definition;
|
|
225
253
|
};
|
|
226
254
|
const values = {
|
|
255
|
+
userId,
|
|
227
256
|
array,
|
|
228
257
|
boolean,
|
|
229
258
|
date,
|
|
@@ -418,4 +447,4 @@ function bindSchema(schema, environment = emptyEnv) {
|
|
|
418
447
|
//#endregion
|
|
419
448
|
export { defineSchema as a, getFunctionSchema as c, defineEnv as i, Secret as l, bindSchema as n, emptyEnv as o, decodeDefinedEnvironment as r, getFunctionEnvironment as s, SchemaDefinitionTypeId as t };
|
|
420
449
|
|
|
421
|
-
//# sourceMappingURL=schema-
|
|
450
|
+
//# sourceMappingURL=schema-DqogEydG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-DqogEydG.js","names":["utf8ByteLength","Result$1"],"sources":["../../../contracts/dist/schema/values.js","../../../contracts/dist/runtime/schema.js","../../../contracts/dist/schema/index.js"],"sourcesContent":["import { GeneratedId } from \"../runtime/id.js\";\nimport { FileFormat, constrainedFileValue, fileFormats, fileLimits } from \"./file.js\";\nimport { ErrorBrand } from \"../runtime/result.js\";\nimport { UserId } from \"../id.js\";\nimport { c as getValueDescriptor, f as validateFieldRenames, p as withValueChildren, r as attachValueDescriptor, s as descriptorFields } from \"../descriptor-DCCz5AHd.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 evolveStoredValue, i as descriptorAllowedInEnvironment, l as applyValueDefaults, n as ValueDescriptorTypeId, o as descriptorContainsSecret, s as descriptorFields, t as ValueDescriptor, u as evolveStoredFields } from \"../descriptor-DCCz5AHd.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, bindSchema, bindValues, decodeDefinedEnvironment, decodeEnvironment, defineEnv, defineSchema, descriptorAllowedInEnvironment, descriptorContainsFile, descriptorContainsSecret, descriptorFields, emptyEnv, environmentLimits, environmentValues, evolveStoredFields, evolveStoredValue, fileFormats, fileLimits, fileMimeTypes, getValueDescriptor, isDefinedEnv, isDefinedSchema, isFileVal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B;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"}
|
package/dist/runtime/server.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { c as Result$1, g as FileValue, h as FileMimeType, i as ErrorValue, m as FileMetadata, p as FileFormat } from "./id-
|
|
2
|
-
import "./result-
|
|
3
|
-
import {
|
|
1
|
+
import { c as Result$1, g as FileValue, h as FileMimeType, i as ErrorValue, m as FileMetadata, p as FileFormat } from "./id-BzFHf3Wo-DGPCjgrf.js";
|
|
2
|
+
import "./result-DKAA4gpS.js";
|
|
3
|
+
import { d as User, f as UserId } from "./pagination-CpYCaRYD-C2Rpp4Cw.js";
|
|
4
|
+
import "./id-E7JKqQ9r.js";
|
|
5
|
+
import { l as defineEnv$1, m as Secret$1, r as EnvironmentAuthoring, t as DefinedEnv } from "./types-C1iDP2Yf-BnkfBOQf.js";
|
|
6
|
+
import { i as defineSchema$1, n as SchemaAuthoring, t as DefinedSchema } from "./index-DWU-7TIh.js";
|
|
4
7
|
//#region src/server/index.d.ts
|
|
5
8
|
declare const Result: typeof Result$1;
|
|
6
9
|
type Result<Success, Failure extends ErrorValue> = Result$1<Success, Failure>;
|
|
@@ -9,5 +12,5 @@ declare const defineSchema: typeof defineSchema$1;
|
|
|
9
12
|
declare const Secret: typeof Secret$1;
|
|
10
13
|
type Secret<Value> = Secret$1<Value>;
|
|
11
14
|
//#endregion
|
|
12
|
-
export { type DefinedEnv, type DefinedSchema, type EnvironmentAuthoring, type FileFormat, type FileMetadata, type FileMimeType, type FileValue, Result, type SchemaAuthoring, Secret, defineEnv, defineSchema };
|
|
15
|
+
export { type DefinedEnv, type DefinedSchema, type EnvironmentAuthoring, type FileFormat, type FileMetadata, type FileMimeType, type FileValue, Result, type SchemaAuthoring, Secret, type User, type UserId, defineEnv, defineSchema };
|
|
13
16
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/runtime/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as defineSchema$1, i as defineEnv$1, l as Secret$1 } from "./schema-
|
|
1
|
+
import { _ as Result$1 } from "./id-Bt9XWRGL.js";
|
|
2
|
+
import { a as defineSchema$1, i as defineEnv$1, l as Secret$1 } from "./schema-DqogEydG.js";
|
|
3
3
|
//#region src/server/index.ts
|
|
4
4
|
const Result = Result$1;
|
|
5
5
|
const defineEnv = defineEnv$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["contractResult","defineContractEnv","defineContractSchema","contractSecret"],"sources":["../../src/server/index.ts"],"sourcesContent":["import { Result as contractResult } from \"@ignotum/contracts/runtime/result\";\nimport type { ErrorValue, Result as ContractResult } from \"@ignotum/contracts/runtime/result\";\nimport {\n defineEnv as defineContractEnv,\n defineSchema as defineContractSchema,\n Secret as contractSecret,\n} from \"@ignotum/contracts/schema\";\nimport type { Secret as ContractSecret } from \"@ignotum/contracts/schema\";\n\nexport const Result: typeof contractResult = contractResult;\nexport type Result<Success, Failure extends ErrorValue> = ContractResult<Success, Failure>;\nexport const defineEnv: typeof defineContractEnv = defineContractEnv;\nexport const defineSchema: typeof defineContractSchema = defineContractSchema;\nexport const Secret: typeof contractSecret = contractSecret;\nexport type Secret<Value> = ContractSecret<Value>;\nexport type {\n DefinedEnv,\n DefinedSchema,\n EnvironmentAuthoring,\n FileFormat,\n FileMetadata,\n FileMimeType,\n FileValue,\n SchemaAuthoring,\n} from \"@ignotum/contracts/schema\";\n"],"mappings":";;;AASA,MAAa,SAAgCA;AAE7C,MAAa,YAAsCC;AACnD,MAAa,eAA4CC;AACzD,MAAa,SAAgCC"}
|
|
1
|
+
{"version":3,"file":"server.js","names":["contractResult","defineContractEnv","defineContractSchema","contractSecret"],"sources":["../../src/server/index.ts"],"sourcesContent":["import { Result as contractResult } from \"@ignotum/contracts/runtime/result\";\nimport type { ErrorValue, Result as ContractResult } from \"@ignotum/contracts/runtime/result\";\nimport {\n defineEnv as defineContractEnv,\n defineSchema as defineContractSchema,\n Secret as contractSecret,\n} from \"@ignotum/contracts/schema\";\nimport type { Secret as ContractSecret } from \"@ignotum/contracts/schema\";\n\nexport const Result: typeof contractResult = contractResult;\nexport type Result<Success, Failure extends ErrorValue> = ContractResult<Success, Failure>;\nexport const defineEnv: typeof defineContractEnv = defineContractEnv;\nexport const defineSchema: typeof defineContractSchema = defineContractSchema;\nexport const Secret: typeof contractSecret = contractSecret;\nexport type Secret<Value> = ContractSecret<Value>;\nexport type {\n DefinedEnv,\n DefinedSchema,\n EnvironmentAuthoring,\n FileFormat,\n FileMetadata,\n FileMimeType,\n FileValue,\n SchemaAuthoring,\n} from \"@ignotum/contracts/schema\";\n\nexport type { User, UserId } from \"@ignotum/contracts/id\";\n"],"mappings":";;;AASA,MAAa,SAAgCA;AAE7C,MAAa,YAAsCC;AACnD,MAAa,eAA4CC;AACzD,MAAa,SAAgCC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./id-
|
|
1
|
+
import "./id-BzFHf3Wo-DGPCjgrf.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-
|
|
8
|
+
//# sourceMappingURL=sync-Bs8J3fIr.d.ts.map
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { _ as fileFormats, g as FileValue, p as FileFormat, r as ErrorBrand, t as GeneratedId } from "./id-BzFHf3Wo-DGPCjgrf.js";
|
|
2
|
+
import { a as ValueDescriptor, i as DescriptorField, n as PaginationPage, o as ValueDescriptorCarrier, r as DescribedValue, s as ValueFields, t as PaginationOptions } from "./pagination-CpYCaRYD-C2Rpp4Cw.js";
|
|
3
|
+
import { Brand, Effect, Redacted, Schema, Struct } from "effect";
|
|
4
|
+
//#region ../contracts/dist/values-DpCxdMvK.d.ts
|
|
5
|
+
//#region src/schema/values.d.ts
|
|
6
|
+
declare const IdTargetsTypeId: unique symbol;
|
|
7
|
+
declare const UnresolvedReferencesTypeId: unique symbol;
|
|
8
|
+
interface IdTargets<TableName extends string> {
|
|
9
|
+
readonly [IdTargetsTypeId]: TableName;
|
|
10
|
+
}
|
|
11
|
+
interface UnresolvedReferences<TableName extends string> {
|
|
12
|
+
readonly [UnresolvedReferencesTypeId]: TableName;
|
|
13
|
+
}
|
|
14
|
+
type IdTargetsOf<Value> = Value extends IdTargets<infer TableName> ? TableName : never;
|
|
15
|
+
type UnresolvedReferencesOf<Value> = Value extends UnresolvedReferences<infer TableName> ? TableName : never;
|
|
16
|
+
type WithIdTargets<Value, TableName extends string> = [TableName] extends [never] ? Value : Value & IdTargets<TableName>;
|
|
17
|
+
type WithUnresolvedReferences<Value, TableName extends string> = [TableName] extends [never] ? Value : Value & UnresolvedReferences<TableName>;
|
|
18
|
+
type PreserveIdMetadata<Value, Source> = WithUnresolvedReferences<WithIdTargets<Value, IdTargetsOf<Source>>, UnresolvedReferencesOf<Source>>;
|
|
19
|
+
type PreserveValueMetadata<Value extends Schema.Constraint, Source> = Source extends ValueDescriptorCarrier ? DescribedValue<PreserveIdMetadata<Value, Source> & Schema.Constraint> : PreserveIdMetadata<Value, Source>;
|
|
20
|
+
type IdDefinition<TableName extends string> = DescribedValue<Schema.brand<typeof GeneratedId, `ignotum/id/${TableName}`> & IdTargets<TableName>>;
|
|
21
|
+
type ReferenceDefinition<TableName extends string> = IdDefinition<TableName> & UnresolvedReferences<TableName>;
|
|
22
|
+
type AddedFieldValidation<Fields, AddedFields> = Extract<keyof AddedFields, keyof Fields> extends never ? readonly [] : readonly [invalidFields: never];
|
|
23
|
+
type OverriddenFieldValidation<Fields, OverriddenFields> = Exclude<keyof OverriddenFields, keyof Fields> extends never ? readonly [] : readonly [invalidFields: never];
|
|
24
|
+
type PartialFields<Fields extends Schema.Struct.Fields> = { readonly [FieldName in keyof Fields]: Fields[FieldName] extends Schema.Constraint ? PreserveValueMetadata<Schema.optional<Fields[FieldName]>, Fields[FieldName]> : never; };
|
|
25
|
+
interface FixedObjectValidator<Fields extends Schema.Struct.Fields> extends Schema.Struct<Fields> {
|
|
26
|
+
readonly pick: <const Keys extends ReadonlyArray<keyof Fields>>(...keys: Keys) => ObjectDefinition<Pick<Fields, Keys[number]>>;
|
|
27
|
+
readonly omit: <const Keys extends ReadonlyArray<keyof Fields>>(...keys: Keys) => ObjectDefinition<Omit<Fields, Keys[number]>>;
|
|
28
|
+
readonly extend: <const AddedFields extends ValueFields>(fields: AddedFields, ...validation: AddedFieldValidation<Fields, AddedFields>) => ObjectDefinition<Struct.Assign<Fields, AddedFields>>;
|
|
29
|
+
readonly override: <const OverriddenFields extends Partial<Record<keyof Fields, DescribedValue>>>(fields: OverriddenFields, ...validation: OverriddenFieldValidation<Fields, OverriddenFields>) => ObjectDefinition<Struct.Assign<Fields, OverriddenFields>>;
|
|
30
|
+
readonly partial: () => ObjectDefinition<PartialFields<Fields>>;
|
|
31
|
+
}
|
|
32
|
+
type ObjectDefinition<Fields extends Schema.Struct.Fields> = DescribedValue<PreserveIdMetadata<FixedObjectValidator<Fields>, Fields[keyof Fields]>>;
|
|
33
|
+
type ResolvedFields<Fields extends Schema.Struct.Fields> = { readonly [FieldName in keyof Fields]: Omit<Fields[FieldName], typeof UnresolvedReferencesTypeId>; };
|
|
34
|
+
type LiteralValue = string | number | boolean;
|
|
35
|
+
interface IndexDefinition<Name extends string = string, FieldNames extends readonly string[] = readonly string[]> {
|
|
36
|
+
readonly name: Name;
|
|
37
|
+
readonly fields: FieldNames;
|
|
38
|
+
}
|
|
39
|
+
interface IndexDefinitions {
|
|
40
|
+
readonly [indexName: string]: IndexDefinition;
|
|
41
|
+
}
|
|
42
|
+
type IndexScalar = boolean | Date | number | string;
|
|
43
|
+
type IndexFieldName<Fields extends Schema.Struct.Fields> = { readonly [FieldName in keyof Fields & string]: Fields[FieldName]["Type"] extends IndexScalar ? FieldName : never; }[keyof Fields & string];
|
|
44
|
+
type IndexFieldTuple<Fields extends Schema.Struct.Fields> = readonly [IndexFieldName<Fields>, ...ReadonlyArray<IndexFieldName<Fields>>];
|
|
45
|
+
interface TableDefinition<Fields extends Schema.Struct.Fields, Indexes extends IndexDefinitions = {}> {
|
|
46
|
+
readonly _tag: "Table";
|
|
47
|
+
readonly descriptor: ValueDescriptor;
|
|
48
|
+
readonly fields: Fields;
|
|
49
|
+
readonly indexes: Indexes;
|
|
50
|
+
readonly schema: Schema.Struct<Fields>;
|
|
51
|
+
from<Previous extends DescribedValue>(previous: Previous, convert: (value: Previous["Type"]) => Schema.Struct.Type<Fields>): TableDefinition<Fields, Indexes>;
|
|
52
|
+
readonly index: <const Name extends string, const FieldNames extends IndexFieldTuple<Fields>>(name: Name extends keyof Indexes ? never : Name, fields: FieldNames) => TableDefinition<Fields, Indexes & Record<Name, IndexDefinition<Name, FieldNames>>>;
|
|
53
|
+
}
|
|
54
|
+
interface TableDefinitions {
|
|
55
|
+
readonly [tableName: string]: TableDefinition<Schema.Struct.Fields, IndexDefinitions>;
|
|
56
|
+
}
|
|
57
|
+
type TableNameOf$1<Definition extends TableDefinitions> = keyof Definition & string;
|
|
58
|
+
type ReservedFieldName = "createdAt" | "id" | "updatedAt";
|
|
59
|
+
type ReservedErrorTagName = "InternalServerError";
|
|
60
|
+
declare const ReservedFieldTypeId: unique symbol;
|
|
61
|
+
interface ReservedField<FieldName extends string> {
|
|
62
|
+
readonly [ReservedFieldTypeId]: `The field name '${FieldName}' is reserved by Ignotum`;
|
|
63
|
+
}
|
|
64
|
+
declare const ReservedErrorTagTypeId: unique symbol;
|
|
65
|
+
interface ReservedErrorTag<Tag extends string> {
|
|
66
|
+
readonly [ReservedErrorTagTypeId]: `The error tag '${Tag}' is reserved by Ignotum`;
|
|
67
|
+
}
|
|
68
|
+
type ErrorTagValidation<Tag extends string> = Tag extends ReservedErrorTagName ? ReservedErrorTag<Tag> : unknown;
|
|
69
|
+
type ReservedFieldValidation<Fields extends Schema.Struct.Fields> = { readonly [FieldName in Extract<keyof Fields, ReservedFieldName>]: ReservedField<FieldName>; };
|
|
70
|
+
type ReservedErrorFieldValidation<Fields extends Schema.Struct.Fields> = { readonly [FieldName in Extract<keyof Fields, "_tag">]: ReservedField<FieldName>; };
|
|
71
|
+
type ErrorDefinition<Tag extends string, Fields extends Schema.Struct.Fields> = DescribedValue<PreserveIdMetadata<Schema.brand<Schema.TaggedStruct<Tag, Fields>, typeof ErrorBrand> & ((fields: Schema.Struct.MakeIn<Fields>) => Schema.brand<Schema.TaggedStruct<Tag, Fields>, typeof ErrorBrand>["Type"]), Fields[keyof Fields]>>;
|
|
72
|
+
declare const table: <const Fields extends ValueFields>(fields: Fields & ReservedFieldValidation<NoInfer<Fields>>) => TableDefinition<Fields>;
|
|
73
|
+
declare const string: () => DescribedValue<Schema.String>;
|
|
74
|
+
declare const number: () => DescribedValue<Schema.Finite>;
|
|
75
|
+
declare const integer: () => DescribedValue<Schema.Int>;
|
|
76
|
+
declare const boolean: () => DescribedValue<Schema.Boolean>;
|
|
77
|
+
declare const date: () => DescribedValue<Schema.DateFromMillis>;
|
|
78
|
+
interface FileOptions<Formats extends readonly FileFormat[]> {
|
|
79
|
+
readonly formats?: Formats;
|
|
80
|
+
readonly maxBytes?: number;
|
|
81
|
+
}
|
|
82
|
+
declare const file: <const Formats extends readonly FileFormat[] = typeof fileFormats>(options?: FileOptions<Formats>) => DescribedValue<Schema.decodeTo<Schema.declare<FileValue<"avif" | "gif" | "jpeg" | "png" | "webp">, FileValue<"avif" | "gif" | "jpeg" | "png" | "webp">>, Schema.Struct<{
|
|
83
|
+
readonly $ignotum: Schema.Literal<"file">;
|
|
84
|
+
readonly id: Schema.brand<Schema.String, "ignotum/file/FileId"> & {
|
|
85
|
+
readonly idPrefix: "file";
|
|
86
|
+
};
|
|
87
|
+
readonly format: Schema.Literals<readonly ["jpeg", "png", "webp", "avif", "gif"]>;
|
|
88
|
+
readonly name: Schema.String;
|
|
89
|
+
readonly size: Schema.Int;
|
|
90
|
+
}>, never, never>> & Schema.Schema<FileValue<Formats[number]>>;
|
|
91
|
+
declare const never: () => DescribedValue<Schema.Never>;
|
|
92
|
+
declare const nullValue: () => DescribedValue<Schema.Null>;
|
|
93
|
+
declare const literal: <const Value extends LiteralValue>(value: Value) => DescribedValue<Schema.Literal<Value>>;
|
|
94
|
+
declare const literals: <const Members extends readonly [LiteralValue, LiteralValue, ...ReadonlyArray<LiteralValue>]>(...members: Members) => DescribedValue<Schema.Literals<Members>>;
|
|
95
|
+
declare const userId: () => DescribedValue<Schema.brand<Schema.String, "ignotum/id/UserId">>;
|
|
96
|
+
declare const id: <const TableName extends string>(tableName: TableName) => ReferenceDefinition<TableName>;
|
|
97
|
+
declare const array: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.$Array<Value>, Value>;
|
|
98
|
+
declare const object: <const Fields extends ValueFields>(fields: Fields) => ObjectDefinition<Fields>;
|
|
99
|
+
declare const optional: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.optional<Value>, Value>;
|
|
100
|
+
declare const nullable: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.NullOr<Value>, Value>;
|
|
101
|
+
declare const record: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.$Record<Schema.String, Value>, Value>;
|
|
102
|
+
declare const union: <const Members extends ReadonlyArray<DescribedValue>>(...members: Members) => PreserveValueMetadata<Schema.Union<Members>, Members[number]>;
|
|
103
|
+
type Secret<Value> = Redacted.Redacted<Value>;
|
|
104
|
+
declare const Secret: {
|
|
105
|
+
readonly isSecret: (u: unknown) => u is Redacted.Redacted<unknown>;
|
|
106
|
+
readonly value: <T>(self: Redacted.Redacted<T>) => T;
|
|
107
|
+
};
|
|
108
|
+
type SecretDefinition<Value extends DescribedValue> = DescribedValue<Schema.RedactedFromValue<Value>>;
|
|
109
|
+
declare function secret(): SecretDefinition<ReturnType<typeof string>>;
|
|
110
|
+
declare function secret<Value extends DescribedValue>(value: Value): SecretDefinition<Value>;
|
|
111
|
+
declare const pagination: () => ObjectDefinition<{
|
|
112
|
+
readonly cursor: DescribedValue<Schema.NullOr<DescribedValue<Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">>> & Schema.Constraint>;
|
|
113
|
+
readonly pageSize: DescribedValue<Schema.brand<Schema.Int, "ignotum/runtime/PaginationPageSize">>;
|
|
114
|
+
}>;
|
|
115
|
+
declare const page: <Value extends DescribedValue>(value: Value) => ObjectDefinition<{
|
|
116
|
+
readonly items: PreserveValueMetadata<Schema.$Array<Value>, Value>;
|
|
117
|
+
readonly nextCursor: DescribedValue<Schema.NullOr<DescribedValue<Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">>> & Schema.Constraint>;
|
|
118
|
+
}> & Schema.Schema<PaginationPage<Value["Type"]>>;
|
|
119
|
+
declare const error: <const Tag extends string, const Fields extends ValueFields>(tag: Tag & ErrorTagValidation<Tag>, fields: Fields & ReservedErrorFieldValidation<NoInfer<Fields>>) => ErrorDefinition<Tag, Fields>;
|
|
120
|
+
declare const values: {
|
|
121
|
+
userId: typeof userId;
|
|
122
|
+
array: typeof array;
|
|
123
|
+
boolean: typeof boolean;
|
|
124
|
+
date: typeof date;
|
|
125
|
+
file: typeof file;
|
|
126
|
+
error: typeof error;
|
|
127
|
+
id: typeof id;
|
|
128
|
+
integer: typeof integer;
|
|
129
|
+
literal: typeof literal;
|
|
130
|
+
literals: typeof literals;
|
|
131
|
+
never: typeof never;
|
|
132
|
+
null: typeof nullValue;
|
|
133
|
+
nullable: typeof nullable;
|
|
134
|
+
number: typeof number;
|
|
135
|
+
object: typeof object;
|
|
136
|
+
optional: typeof optional;
|
|
137
|
+
record: typeof record;
|
|
138
|
+
string: typeof string;
|
|
139
|
+
union: typeof union;
|
|
140
|
+
};
|
|
141
|
+
declare const environmentValues: {
|
|
142
|
+
array: typeof array;
|
|
143
|
+
boolean: typeof boolean;
|
|
144
|
+
date: typeof date;
|
|
145
|
+
integer: typeof integer;
|
|
146
|
+
literal: typeof literal;
|
|
147
|
+
literals: typeof literals;
|
|
148
|
+
never: typeof never;
|
|
149
|
+
null: typeof nullValue;
|
|
150
|
+
nullable: typeof nullable;
|
|
151
|
+
number: typeof number;
|
|
152
|
+
object: typeof object;
|
|
153
|
+
optional: typeof optional;
|
|
154
|
+
record: typeof record;
|
|
155
|
+
secret: typeof secret;
|
|
156
|
+
string: typeof string;
|
|
157
|
+
union: typeof union;
|
|
158
|
+
};
|
|
159
|
+
type EnvironmentValues = typeof environmentValues;
|
|
160
|
+
type DocumentDefinition<Definition extends TableDefinitions, TableName extends TableNameOf$1<Definition>> = ObjectDefinition<Struct.Assign<ResolvedFields<Definition[TableName]["fields"]>, {
|
|
161
|
+
readonly id: IdDefinition<TableName>;
|
|
162
|
+
readonly createdAt: typeof Schema.DateFromMillis;
|
|
163
|
+
readonly updatedAt: typeof Schema.DateFromMillis;
|
|
164
|
+
}>>;
|
|
165
|
+
type BoundValues<Definition extends TableDefinitions> = Omit<typeof values, "id"> & {
|
|
166
|
+
readonly doc: <const TableName extends TableNameOf$1<Definition>>(tableName: TableName) => DocumentDefinition<Definition, TableName>;
|
|
167
|
+
readonly id: <const TableName extends TableNameOf$1<Definition>>(tableName: TableName) => IdDefinition<TableName>;
|
|
168
|
+
readonly page: typeof page;
|
|
169
|
+
readonly pagination: () => ReturnType<typeof pagination> & Schema.Schema<PaginationOptions>;
|
|
170
|
+
};
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region ../contracts/dist/types-C1iDP2Yf.d.ts
|
|
173
|
+
//#region src/schema/environment.d.ts
|
|
174
|
+
declare const EnvironmentDefinitionTypeId: unique symbol;
|
|
175
|
+
declare const EnvironmentDecoderTypeId: unique symbol;
|
|
176
|
+
type EnvironmentFields = {
|
|
177
|
+
readonly [fieldName: PropertyKey]: DescribedValue<Schema.ConstraintDecoder<unknown, never>>;
|
|
178
|
+
};
|
|
179
|
+
interface DefinedEnv<Fields extends EnvironmentFields = EnvironmentFields> {
|
|
180
|
+
readonly _tag: "Environment";
|
|
181
|
+
readonly fields: Fields;
|
|
182
|
+
readonly descriptors: ReadonlyArray<DescriptorField>;
|
|
183
|
+
readonly schema: Schema.Struct<Fields>;
|
|
184
|
+
readonly [EnvironmentDefinitionTypeId]: Fields;
|
|
185
|
+
readonly [EnvironmentDecoderTypeId]: (raw: Readonly<Record<string, string>>) => Effect.Effect<Readonly<EnvironmentType<DefinedEnv<Fields>>>, EnvironmentValueInvalid>;
|
|
186
|
+
}
|
|
187
|
+
interface EnvironmentAuthoring {
|
|
188
|
+
readonly values: EnvironmentValues;
|
|
189
|
+
}
|
|
190
|
+
type EnvironmentType<Environment extends DefinedEnv> = Schema.Struct.Type<Environment[typeof EnvironmentDefinitionTypeId]>;
|
|
191
|
+
declare const EnvironmentValueInvalid_base: Schema.Class<EnvironmentValueInvalid, Schema.TaggedStruct<"EnvironmentValueInvalid", {
|
|
192
|
+
readonly key: Schema.optional<Schema.String>;
|
|
193
|
+
readonly message: Schema.String;
|
|
194
|
+
}>, import("effect/Cause").YieldableError>;
|
|
195
|
+
declare class EnvironmentValueInvalid extends EnvironmentValueInvalid_base {}
|
|
196
|
+
declare const defineEnv: <const Fields extends EnvironmentFields>(define: (authoring: EnvironmentAuthoring) => Fields) => DefinedEnv<Fields>;
|
|
197
|
+
declare const emptyEnv: DefinedEnv<{}>;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/schema/types.d.ts
|
|
200
|
+
/** A document identifier branded with the table it belongs to. */
|
|
201
|
+
type Id<TableName extends string> = GeneratedId & Brand.Brand<`ignotum/id/${TableName}`>;
|
|
202
|
+
declare const SchemaDefinitionTypeId: unique symbol;
|
|
203
|
+
interface SchemaDefinitionContract<Definition> {
|
|
204
|
+
readonly [SchemaDefinitionTypeId]: Definition;
|
|
205
|
+
}
|
|
206
|
+
type SchemaDefinitionOf<SchemaDefinition> = SchemaDefinition extends SchemaDefinitionContract<infer Definition> ? Definition : never;
|
|
207
|
+
interface TableDefinitionLike {
|
|
208
|
+
readonly fields: Schema.Struct.Fields;
|
|
209
|
+
}
|
|
210
|
+
interface TablesLike {
|
|
211
|
+
readonly [tableName: string]: TableDefinitionLike;
|
|
212
|
+
}
|
|
213
|
+
type TableNameOf<Definition extends TablesLike> = keyof Definition & string;
|
|
214
|
+
interface SystemFields<TableName extends string> {
|
|
215
|
+
readonly id: Id<TableName>;
|
|
216
|
+
readonly createdAt: Date;
|
|
217
|
+
readonly updatedAt: Date;
|
|
218
|
+
}
|
|
219
|
+
type DocumentFields<TableName extends string, Table extends TableDefinitionLike> = SystemFields<TableName> & Schema.Struct.Type<Table["fields"]>;
|
|
220
|
+
/** The complete document returned for a table, including Ignotum system fields. */
|
|
221
|
+
type Document<Definition extends TablesLike, TableName extends TableNameOf<Definition>> = { readonly [FieldName in keyof DocumentFields<TableName, Definition[TableName]>]: DocumentFields<TableName, Definition[TableName]>[FieldName]; };
|
|
222
|
+
//#endregion
|
|
223
|
+
export { table as _, Id as a, 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 };
|
|
224
|
+
//# sourceMappingURL=types-C1iDP2Yf-BnkfBOQf.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ignotum",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Ignotum is an opinionated TypeScript application cloud.",
|
|
5
5
|
"author": "Johannes Schießl",
|
|
6
6
|
"repository": {
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"@effect/sql-sqlite-node": "4.0.0-rc.111",
|
|
82
82
|
"redis": "6.2.1",
|
|
83
83
|
"@ignotum/contracts": "1.0.0",
|
|
84
|
-
"@ignotum/deployment": "1.0.0",
|
|
85
84
|
"@ignotum/runtime": "1.0.0",
|
|
85
|
+
"@ignotum/deployment": "1.0.0",
|
|
86
86
|
"@ignotum/shared": "1.0.0"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
package/src/cli/agent-files.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import authentication from "../../../../docs/user/authentication.md?raw";
|
|
2
|
+
import profileSharing from "../../../../docs/user/profile-sharing.md?raw";
|
|
3
|
+
import localAuthentication from "../../../../docs/user/local-authentication.md?raw";
|
|
1
4
|
import agents from "../../../../docs/agent/AGENTS.md?raw";
|
|
2
5
|
import skill from "../../../../docs/agent/skills/ignotum/SKILL.md?raw";
|
|
3
6
|
import api from "../../../../docs/user/api.md?raw";
|
|
@@ -5,6 +8,7 @@ import appEntry from "../../../../docs/user/app-entry.md?raw";
|
|
|
5
8
|
import cli from "../../../../docs/user/cli.md?raw";
|
|
6
9
|
import database from "../../../../docs/user/database.md?raw";
|
|
7
10
|
import deployApp from "../../../../docs/user/deploy-app.md?raw";
|
|
11
|
+
import consoleGuide from "../../../../docs/user/console.md?raw";
|
|
8
12
|
import deploymentModel from "../../../../docs/user/deployment-model.md?raw";
|
|
9
13
|
import deployments from "../../../../docs/user/deployments.md?raw";
|
|
10
14
|
import errors from "../../../../docs/user/errors.md?raw";
|
|
@@ -18,6 +22,7 @@ import index from "../../../../docs/user/index.md?raw";
|
|
|
18
22
|
import indexes from "../../../../docs/user/indexes.md?raw";
|
|
19
23
|
import limits from "../../../../docs/user/limits.md?raw";
|
|
20
24
|
import localDevelopment from "../../../../docs/user/local-development.md?raw";
|
|
25
|
+
import migrations from "../../../../docs/user/migrations.md?raw";
|
|
21
26
|
import mutations from "../../../../docs/user/mutations.md?raw";
|
|
22
27
|
import pagination from "../../../../docs/user/pagination.md?raw";
|
|
23
28
|
import preact from "../../../../docs/user/preact.md?raw";
|
|
@@ -38,11 +43,15 @@ export interface AppFile {
|
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
const references = [
|
|
46
|
+
["authentication.md", authentication],
|
|
47
|
+
["profile-sharing.md", profileSharing],
|
|
48
|
+
["local-authentication.md", localAuthentication],
|
|
41
49
|
["api.md", api],
|
|
42
50
|
["app-entry.md", appEntry],
|
|
43
51
|
["cli.md", cli],
|
|
44
52
|
["database.md", database],
|
|
45
53
|
["deploy-app.md", deployApp],
|
|
54
|
+
["console.md", consoleGuide],
|
|
46
55
|
["deployment-model.md", deploymentModel],
|
|
47
56
|
["deployments.md", deployments],
|
|
48
57
|
["errors.md", errors],
|
|
@@ -56,6 +65,7 @@ const references = [
|
|
|
56
65
|
["indexes.md", indexes],
|
|
57
66
|
["limits.md", limits],
|
|
58
67
|
["local-development.md", localDevelopment],
|
|
68
|
+
["migrations.md", migrations],
|
|
59
69
|
["mutations.md", mutations],
|
|
60
70
|
["pagination.md", pagination],
|
|
61
71
|
["preact.md", preact],
|