ignotum 0.0.13 → 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 +369 -55
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/runtime/client.d.ts +3 -3
- package/dist/runtime/client.js +24 -4
- 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-E7JKqQ9r.d.ts +1 -0
- package/dist/runtime/index-DWU-7TIh.d.ts +185 -0
- package/dist/runtime/internal/host.d.ts +23 -5
- package/dist/runtime/internal/host.js +24 -4
- 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-DnKg3dkI-r5ZUxBBx.d.ts → pagination-CpYCaRYD-C2Rpp4Cw.d.ts} +14 -4
- package/dist/runtime/pagination-E7JKqQ9r.d.ts +1 -0
- package/dist/runtime/{schema-1Zs03-iS.js → schema-DqogEydG.js} +38 -11
- package/dist/runtime/schema-DqogEydG.js.map +1 -0
- package/dist/runtime/server.d.ts +4 -3
- package/dist/runtime/server.js +1 -1
- package/dist/runtime/types-C1iDP2Yf-BnkfBOQf.d.ts +224 -0
- package/package.json +2 -2
- package/src/cli/agent-files.ts +4 -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/sync.ts +1 -1
- package/src/dev-runtime/database.ts +77 -2
- package/src/dev-runtime/id.ts +19 -4
- package/src/dev-runtime/migrations.ts +9 -0
- package/src/internal/host.ts +1 -1
- package/dist/runtime/descriptor-Cyo9FP9n-C0SRVXNW.js +0 -154
- package/dist/runtime/descriptor-Cyo9FP9n-C0SRVXNW.js.map +0 -1
- package/dist/runtime/id-Dz0apuB3.d.ts +0 -1
- package/dist/runtime/index-D54flWtH.d.ts +0 -402
- package/dist/runtime/pagination-Dz0apuB3.d.ts +0 -1
- package/dist/runtime/schema-1Zs03-iS.js.map +0 -1
package/src/internal/host.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { invoke } from "@ignotum/runtime/guest";
|
|
1
|
+
export { evolve, invoke } from "@ignotum/runtime/guest";
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { p as initial } from "./id-Bt9XWRGL.js";
|
|
2
|
-
import { Function, Predicate, Schema } from "effect";
|
|
3
|
-
//#region ../contracts/dist/runtime/pagination.js
|
|
4
|
-
const PaginationCursor = Schema.String.check(Schema.isBase64Url()).pipe(Schema.brand("ignotum/runtime/PaginationCursor"));
|
|
5
|
-
const PaginationPageSize = Schema.Int.check(Schema.isBetween({
|
|
6
|
-
minimum: 1,
|
|
7
|
-
maximum: 1e3
|
|
8
|
-
})).pipe(Schema.brand("ignotum/runtime/PaginationPageSize"));
|
|
9
|
-
Schema.Struct({
|
|
10
|
-
cursor: Schema.NullOr(PaginationCursor),
|
|
11
|
-
pageSize: PaginationPageSize
|
|
12
|
-
});
|
|
13
|
-
const TablePosition = Schema.Struct({
|
|
14
|
-
type: Schema.Literal("Table"),
|
|
15
|
-
createdAt: Schema.Int,
|
|
16
|
-
id: Schema.String
|
|
17
|
-
});
|
|
18
|
-
const IndexPosition = Schema.Struct({
|
|
19
|
-
type: Schema.Literal("Index"),
|
|
20
|
-
key: Schema.String.check(Schema.isPattern(/^(?:[0-9a-f]{2})*$/)).pipe(Schema.brand("ignotum/runtime/EncodedIndexKey"))
|
|
21
|
-
});
|
|
22
|
-
const PaginationPosition = Schema.Union([TablePosition, IndexPosition]);
|
|
23
|
-
const CursorPayloadV1 = Schema.Struct({
|
|
24
|
-
version: Schema.Literal(1),
|
|
25
|
-
query: Schema.String,
|
|
26
|
-
position: PaginationPosition
|
|
27
|
-
});
|
|
28
|
-
const CursorPayload = initial(CursorPayloadV1);
|
|
29
|
-
Schema.fromJsonString(CursorPayload);
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region ../contracts/dist/descriptor-Cyo9FP9n.js
|
|
32
|
-
const LiteralValue = Schema.Union([
|
|
33
|
-
Schema.String,
|
|
34
|
-
Schema.Finite,
|
|
35
|
-
Schema.Boolean
|
|
36
|
-
]);
|
|
37
|
-
const DescriptorField = Schema.Struct({
|
|
38
|
-
name: Schema.String,
|
|
39
|
-
value: Schema.suspend(() => ValueDescriptor)
|
|
40
|
-
});
|
|
41
|
-
const ValueDescriptor = Schema.Union([
|
|
42
|
-
Schema.Struct({
|
|
43
|
-
type: Schema.Literal("array"),
|
|
44
|
-
value: Schema.suspend(() => ValueDescriptor)
|
|
45
|
-
}),
|
|
46
|
-
Schema.Struct({ type: Schema.Literal("boolean") }),
|
|
47
|
-
Schema.Struct({ type: Schema.Literal("date") }),
|
|
48
|
-
Schema.Struct({
|
|
49
|
-
type: Schema.Literal("file"),
|
|
50
|
-
formats: Schema.Array(Schema.Literals([
|
|
51
|
-
"jpeg",
|
|
52
|
-
"png",
|
|
53
|
-
"webp",
|
|
54
|
-
"avif",
|
|
55
|
-
"gif"
|
|
56
|
-
])),
|
|
57
|
-
maxBytes: Schema.Int
|
|
58
|
-
}),
|
|
59
|
-
Schema.Struct({
|
|
60
|
-
type: Schema.Literal("error"),
|
|
61
|
-
tag: Schema.String,
|
|
62
|
-
fields: Schema.Array(DescriptorField)
|
|
63
|
-
}),
|
|
64
|
-
Schema.Struct({
|
|
65
|
-
type: Schema.Literal("id"),
|
|
66
|
-
table: Schema.String
|
|
67
|
-
}),
|
|
68
|
-
Schema.Struct({ type: Schema.Literal("userId") }),
|
|
69
|
-
Schema.Struct({ type: Schema.Literal("integer") }),
|
|
70
|
-
Schema.Struct({
|
|
71
|
-
type: Schema.Literal("literal"),
|
|
72
|
-
value: LiteralValue
|
|
73
|
-
}),
|
|
74
|
-
Schema.Struct({
|
|
75
|
-
type: Schema.Literal("literals"),
|
|
76
|
-
values: Schema.Array(LiteralValue)
|
|
77
|
-
}),
|
|
78
|
-
Schema.Struct({ type: Schema.Literal("never") }),
|
|
79
|
-
Schema.Struct({ type: Schema.Literal("null") }),
|
|
80
|
-
Schema.Struct({
|
|
81
|
-
type: Schema.Literal("nullable"),
|
|
82
|
-
value: Schema.suspend(() => ValueDescriptor)
|
|
83
|
-
}),
|
|
84
|
-
Schema.Struct({ type: Schema.Literal("number") }),
|
|
85
|
-
Schema.Struct({
|
|
86
|
-
type: Schema.Literal("object"),
|
|
87
|
-
fields: Schema.Array(DescriptorField)
|
|
88
|
-
}),
|
|
89
|
-
Schema.Struct({
|
|
90
|
-
type: Schema.Literal("optional"),
|
|
91
|
-
value: Schema.suspend(() => ValueDescriptor)
|
|
92
|
-
}),
|
|
93
|
-
Schema.Struct({
|
|
94
|
-
type: Schema.Literal("record"),
|
|
95
|
-
value: Schema.suspend(() => ValueDescriptor)
|
|
96
|
-
}),
|
|
97
|
-
Schema.Struct({
|
|
98
|
-
type: Schema.Literal("secret"),
|
|
99
|
-
value: Schema.suspend(() => ValueDescriptor)
|
|
100
|
-
}),
|
|
101
|
-
Schema.Struct({ type: Schema.Literal("string") }),
|
|
102
|
-
Schema.Struct({
|
|
103
|
-
type: Schema.Literal("union"),
|
|
104
|
-
members: Schema.Array(Schema.suspend(() => ValueDescriptor))
|
|
105
|
-
})
|
|
106
|
-
]);
|
|
107
|
-
const ValueDescriptorTypeId = Symbol.for("ignotum/schema/ValueDescriptor");
|
|
108
|
-
const attachValueDescriptor = Function.dual(2, (value, descriptor) => {
|
|
109
|
-
Object.defineProperty(value, ValueDescriptorTypeId, {
|
|
110
|
-
configurable: false,
|
|
111
|
-
enumerable: false,
|
|
112
|
-
value: descriptor,
|
|
113
|
-
writable: false
|
|
114
|
-
});
|
|
115
|
-
return value;
|
|
116
|
-
});
|
|
117
|
-
const getValueDescriptor = (value) => {
|
|
118
|
-
if (!Predicate.hasProperty(value, ValueDescriptorTypeId)) return void 0;
|
|
119
|
-
return Schema.is(ValueDescriptor)(value[ValueDescriptorTypeId]) ? value[ValueDescriptorTypeId] : void 0;
|
|
120
|
-
};
|
|
121
|
-
const descriptorAllowedInEnvironment = (descriptor) => {
|
|
122
|
-
switch (descriptor.type) {
|
|
123
|
-
case "error":
|
|
124
|
-
case "file":
|
|
125
|
-
case "userId":
|
|
126
|
-
case "id": return false;
|
|
127
|
-
case "array":
|
|
128
|
-
case "nullable":
|
|
129
|
-
case "optional":
|
|
130
|
-
case "record":
|
|
131
|
-
case "secret": return descriptorAllowedInEnvironment(descriptor.value);
|
|
132
|
-
case "object": return descriptor.fields.every((field) => descriptorAllowedInEnvironment(field.value));
|
|
133
|
-
case "union": return descriptor.members.every(descriptorAllowedInEnvironment);
|
|
134
|
-
default: return true;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
const descriptorFields = (fields) => {
|
|
138
|
-
const entries = [];
|
|
139
|
-
for (const name of Reflect.ownKeys(fields)) {
|
|
140
|
-
if (!Predicate.isString(name)) throw new Error("Ignotum value objects only support string field names.");
|
|
141
|
-
const field = fields[name];
|
|
142
|
-
const value = field === void 0 ? void 0 : getValueDescriptor(field);
|
|
143
|
-
if (value === void 0) throw new Error(`The field '${name}' must use an Ignotum values validator.`);
|
|
144
|
-
entries.push({
|
|
145
|
-
name,
|
|
146
|
-
value
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
return entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
150
|
-
};
|
|
151
|
-
//#endregion
|
|
152
|
-
export { getValueDescriptor as a, descriptorFields as i, attachValueDescriptor as n, PaginationCursor as o, descriptorAllowedInEnvironment as r, PaginationPageSize as s, ValueDescriptor as t };
|
|
153
|
-
|
|
154
|
-
//# sourceMappingURL=descriptor-Cyo9FP9n-C0SRVXNW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-Cyo9FP9n-C0SRVXNW.js","names":[],"sources":["../../../contracts/dist/runtime/pagination.js","../../../contracts/dist/descriptor-Cyo9FP9n.js"],"sourcesContent":["import { initial } from \"../versioned.js\";\nimport { encodeCanonicalJson } from \"../json.js\";\nimport { Encoding, Result, Schema } from \"effect\";\n//#region src/runtime/pagination.ts\nconst PaginationCursor = Schema.String.check(Schema.isBase64Url()).pipe(Schema.brand(\"ignotum/runtime/PaginationCursor\"));\nconst PaginationPageSize = Schema.Int.check(Schema.isBetween({\n\tminimum: 1,\n\tmaximum: 1e3\n})).pipe(Schema.brand(\"ignotum/runtime/PaginationPageSize\"));\nconst PaginationOptions = Schema.Struct({\n\tcursor: Schema.NullOr(PaginationCursor),\n\tpageSize: PaginationPageSize\n});\nconst TablePosition = Schema.Struct({\n\ttype: Schema.Literal(\"Table\"),\n\tcreatedAt: Schema.Int,\n\tid: Schema.String\n});\nconst IndexPosition = Schema.Struct({\n\ttype: Schema.Literal(\"Index\"),\n\tkey: Schema.String.check(Schema.isPattern(/^(?:[0-9a-f]{2})*$/)).pipe(Schema.brand(\"ignotum/runtime/EncodedIndexKey\"))\n});\nconst PaginationPosition = Schema.Union([TablePosition, IndexPosition]);\nconst CursorPayloadV1 = Schema.Struct({\n\tversion: Schema.Literal(1),\n\tquery: Schema.String,\n\tposition: PaginationPosition\n});\nconst CursorPayload = initial(CursorPayloadV1);\nconst CursorPayloadJson = Schema.fromJsonString(CursorPayload);\nconst paginationQueryIdentity = (tableId, index, lower, upper, order) => encodeCanonicalJson([\n\ttableId,\n\tindex,\n\tlower ?? null,\n\tupper ?? null,\n\torder\n]);\nconst encodePaginationCursor = (query, position) => PaginationCursor.make(Encoding.encodeBase64Url(Schema.encodeSync(CursorPayloadJson)({\n\tversion: 1,\n\tquery,\n\tposition\n})));\nconst decodePaginationCursor = (cursor) => Schema.decodeSync(CursorPayloadJson)(Result.getOrThrow(Encoding.decodeBase64UrlString(cursor)));\n//#endregion\nexport { PaginationCursor, PaginationOptions, PaginationPageSize, PaginationPosition, decodePaginationCursor, encodePaginationCursor, paginationQueryIdentity };\n\n//# sourceMappingURL=pagination.js.map","import { Function, Predicate, Schema } from \"effect\";\n//#region src/schema/descriptor.ts\nconst LiteralValue = Schema.Union([\n\tSchema.String,\n\tSchema.Finite,\n\tSchema.Boolean\n]);\nconst DescriptorField = Schema.Struct({\n\tname: Schema.String,\n\tvalue: Schema.suspend(() => ValueDescriptor)\n});\nconst ValueDescriptor = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"array\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"boolean\") }),\n\tSchema.Struct({ type: Schema.Literal(\"date\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"file\"),\n\t\tformats: Schema.Array(Schema.Literals([\n\t\t\t\"jpeg\",\n\t\t\t\"png\",\n\t\t\t\"webp\",\n\t\t\t\"avif\",\n\t\t\t\"gif\"\n\t\t])),\n\t\tmaxBytes: Schema.Int\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"error\"),\n\t\ttag: Schema.String,\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"id\"),\n\t\ttable: Schema.String\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"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 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, descriptorAllowedInEnvironment as i, ValueDescriptorTypeId as n, descriptorContainsSecret as o, attachValueDescriptor as r, descriptorFields as s, ValueDescriptor as t };\n\n//# sourceMappingURL=descriptor-Cyo9FP9n.js.map"],"mappings":";;;AAIA,MAAM,mBAAmB,OAAO,OAAO,MAAM,OAAO,YAAY,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,kCAAkC,CAAC;AACxH,MAAM,qBAAqB,OAAO,IAAI,MAAM,OAAO,UAAU;CAC5D,SAAS;CACT,SAAS;AACV,CAAC,CAAC,CAAC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,0 @@
|
|
|
1
|
-
import "./pagination-DnKg3dkI-r5ZUxBBx.js";
|
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
import { _ as fileFormats, c as Result$1, g as FileValue, i as ErrorValue, n as DocumentNotFoundValue, p as FileFormat, r as ErrorBrand, t as GeneratedId } from "./id-BzFHf3Wo-DGPCjgrf.js";
|
|
2
|
-
import { a as ValueDescriptor, c as IdContext, i as DescriptorField, n as PaginationPage, o as ValueDescriptorCarrier, r as DescribedValue, s as ValueFields, t as PaginationOptions } from "./pagination-DnKg3dkI-r5ZUxBBx.js";
|
|
3
|
-
import { Brand, Effect, Redacted, Schema, Struct } from "effect";
|
|
4
|
-
//#region ../contracts/dist/values-B4I-91OJ.d.ts
|
|
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
|
-
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>>>;
|
|
52
|
-
}
|
|
53
|
-
interface TableDefinitions {
|
|
54
|
-
readonly [tableName: string]: TableDefinition<Schema.Struct.Fields, IndexDefinitions>;
|
|
55
|
-
}
|
|
56
|
-
type TableNameOf$2<Definition extends TableDefinitions> = keyof Definition & string;
|
|
57
|
-
type ReservedFieldName = "createdAt" | "id" | "updatedAt";
|
|
58
|
-
type ReservedErrorTagName = "InternalServerError";
|
|
59
|
-
declare const ReservedFieldTypeId: unique symbol;
|
|
60
|
-
interface ReservedField<FieldName extends string> {
|
|
61
|
-
readonly [ReservedFieldTypeId]: `The field name '${FieldName}' is reserved by Ignotum`;
|
|
62
|
-
}
|
|
63
|
-
declare const ReservedErrorTagTypeId: unique symbol;
|
|
64
|
-
interface ReservedErrorTag<Tag extends string> {
|
|
65
|
-
readonly [ReservedErrorTagTypeId]: `The error tag '${Tag}' is reserved by Ignotum`;
|
|
66
|
-
}
|
|
67
|
-
type ErrorTagValidation<Tag extends string> = Tag extends ReservedErrorTagName ? ReservedErrorTag<Tag> : unknown;
|
|
68
|
-
type ReservedFieldValidation<Fields extends Schema.Struct.Fields> = { readonly [FieldName in Extract<keyof Fields, ReservedFieldName>]: ReservedField<FieldName>; };
|
|
69
|
-
type ReservedErrorFieldValidation<Fields extends Schema.Struct.Fields> = { readonly [FieldName in Extract<keyof Fields, "_tag">]: ReservedField<FieldName>; };
|
|
70
|
-
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]>>;
|
|
71
|
-
declare const table: <const Fields extends ValueFields>(fields: Fields & ReservedFieldValidation<NoInfer<Fields>>) => TableDefinition<Fields>;
|
|
72
|
-
declare const string: () => DescribedValue<Schema.String>;
|
|
73
|
-
declare const number: () => DescribedValue<Schema.Finite>;
|
|
74
|
-
declare const integer: () => DescribedValue<Schema.Int>;
|
|
75
|
-
declare const boolean: () => DescribedValue<Schema.Boolean>;
|
|
76
|
-
declare const date: () => DescribedValue<Schema.DateFromMillis>;
|
|
77
|
-
interface FileOptions<Formats extends readonly FileFormat[]> {
|
|
78
|
-
readonly formats?: Formats;
|
|
79
|
-
readonly maxBytes?: number;
|
|
80
|
-
}
|
|
81
|
-
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<{
|
|
82
|
-
readonly $ignotum: Schema.Literal<"file">;
|
|
83
|
-
readonly id: Schema.brand<Schema.String, "ignotum/file/FileId"> & {
|
|
84
|
-
readonly idPrefix: "file";
|
|
85
|
-
};
|
|
86
|
-
readonly format: Schema.Literals<readonly ["jpeg", "png", "webp", "avif", "gif"]>;
|
|
87
|
-
readonly name: Schema.String;
|
|
88
|
-
readonly size: Schema.Int;
|
|
89
|
-
}>, never, never>> & Schema.Schema<FileValue<Formats[number]>>;
|
|
90
|
-
declare const never: () => DescribedValue<Schema.Never>;
|
|
91
|
-
declare const nullValue: () => DescribedValue<Schema.Null>;
|
|
92
|
-
declare const literal: <const Value extends LiteralValue>(value: Value) => DescribedValue<Schema.Literal<Value>>;
|
|
93
|
-
declare const literals: <const Members extends readonly [LiteralValue, LiteralValue, ...ReadonlyArray<LiteralValue>]>(...members: Members) => DescribedValue<Schema.Literals<Members>>;
|
|
94
|
-
declare const userId: () => DescribedValue<Schema.brand<Schema.String, "ignotum/id/UserId">>;
|
|
95
|
-
declare const id: <const TableName extends string>(tableName: TableName) => ReferenceDefinition<TableName>;
|
|
96
|
-
declare const array: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.$Array<Value>, Value>;
|
|
97
|
-
declare const object: <const Fields extends ValueFields>(fields: Fields) => ObjectDefinition<Fields>;
|
|
98
|
-
declare const optional: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.optional<Value>, Value>;
|
|
99
|
-
declare const nullable: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.NullOr<Value>, Value>;
|
|
100
|
-
declare const record: <Value extends DescribedValue>(value: Value) => PreserveValueMetadata<Schema.$Record<Schema.String, Value>, Value>;
|
|
101
|
-
declare const union: <const Members extends ReadonlyArray<DescribedValue>>(...members: Members) => PreserveValueMetadata<Schema.Union<Members>, Members[number]>;
|
|
102
|
-
type Secret<Value> = Redacted.Redacted<Value>;
|
|
103
|
-
declare const Secret: {
|
|
104
|
-
readonly isSecret: (u: unknown) => u is Redacted.Redacted<unknown>;
|
|
105
|
-
readonly value: <T>(self: Redacted.Redacted<T>) => T;
|
|
106
|
-
};
|
|
107
|
-
type SecretDefinition<Value extends DescribedValue> = DescribedValue<Schema.RedactedFromValue<Value>>;
|
|
108
|
-
declare function secret(): SecretDefinition<ReturnType<typeof string>>;
|
|
109
|
-
declare function secret<Value extends DescribedValue>(value: Value): SecretDefinition<Value>;
|
|
110
|
-
declare const pagination: () => ObjectDefinition<{
|
|
111
|
-
readonly cursor: DescribedValue<Schema.NullOr<DescribedValue<Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">>> & Schema.Constraint>;
|
|
112
|
-
readonly pageSize: DescribedValue<Schema.brand<Schema.Int, "ignotum/runtime/PaginationPageSize">>;
|
|
113
|
-
}>;
|
|
114
|
-
declare const page: <Value extends DescribedValue>(value: Value) => ObjectDefinition<{
|
|
115
|
-
readonly items: PreserveValueMetadata<Schema.$Array<Value>, Value>;
|
|
116
|
-
readonly nextCursor: DescribedValue<Schema.NullOr<DescribedValue<Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">>> & Schema.Constraint>;
|
|
117
|
-
}> & Schema.Schema<PaginationPage<Value["Type"]>>;
|
|
118
|
-
declare const error: <const Tag extends string, const Fields extends ValueFields>(tag: Tag & ErrorTagValidation<Tag>, fields: Fields & ReservedErrorFieldValidation<NoInfer<Fields>>) => ErrorDefinition<Tag, Fields>;
|
|
119
|
-
declare const values: {
|
|
120
|
-
userId: typeof userId;
|
|
121
|
-
array: typeof array;
|
|
122
|
-
boolean: typeof boolean;
|
|
123
|
-
date: typeof date;
|
|
124
|
-
file: typeof file;
|
|
125
|
-
error: typeof error;
|
|
126
|
-
id: typeof id;
|
|
127
|
-
integer: typeof integer;
|
|
128
|
-
literal: typeof literal;
|
|
129
|
-
literals: typeof literals;
|
|
130
|
-
never: typeof never;
|
|
131
|
-
null: typeof nullValue;
|
|
132
|
-
nullable: typeof nullable;
|
|
133
|
-
number: typeof number;
|
|
134
|
-
object: typeof object;
|
|
135
|
-
optional: typeof optional;
|
|
136
|
-
record: typeof record;
|
|
137
|
-
string: typeof string;
|
|
138
|
-
union: typeof union;
|
|
139
|
-
};
|
|
140
|
-
declare const environmentValues: {
|
|
141
|
-
array: typeof array;
|
|
142
|
-
boolean: typeof boolean;
|
|
143
|
-
date: typeof date;
|
|
144
|
-
integer: typeof integer;
|
|
145
|
-
literal: typeof literal;
|
|
146
|
-
literals: typeof literals;
|
|
147
|
-
never: typeof never;
|
|
148
|
-
null: typeof nullValue;
|
|
149
|
-
nullable: typeof nullable;
|
|
150
|
-
number: typeof number;
|
|
151
|
-
object: typeof object;
|
|
152
|
-
optional: typeof optional;
|
|
153
|
-
record: typeof record;
|
|
154
|
-
secret: typeof secret;
|
|
155
|
-
string: typeof string;
|
|
156
|
-
union: typeof union;
|
|
157
|
-
};
|
|
158
|
-
type EnvironmentValues = typeof environmentValues;
|
|
159
|
-
type DocumentDefinition<Definition extends TableDefinitions, TableName extends TableNameOf$2<Definition>> = ObjectDefinition<Struct.Assign<ResolvedFields<Definition[TableName]["fields"]>, {
|
|
160
|
-
readonly id: IdDefinition<TableName>;
|
|
161
|
-
readonly createdAt: typeof Schema.DateFromMillis;
|
|
162
|
-
readonly updatedAt: typeof Schema.DateFromMillis;
|
|
163
|
-
}>>;
|
|
164
|
-
type BoundValues<Definition extends TableDefinitions> = Omit<typeof values, "id"> & {
|
|
165
|
-
readonly doc: <const TableName extends TableNameOf$2<Definition>>(tableName: TableName) => DocumentDefinition<Definition, TableName>;
|
|
166
|
-
readonly id: <const TableName extends TableNameOf$2<Definition>>(tableName: TableName) => IdDefinition<TableName>;
|
|
167
|
-
readonly page: typeof page;
|
|
168
|
-
readonly pagination: () => ReturnType<typeof pagination> & Schema.Schema<PaginationOptions>;
|
|
169
|
-
};
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region ../contracts/dist/types-D4UfDuy-.d.ts
|
|
172
|
-
//#region src/schema/environment.d.ts
|
|
173
|
-
declare const EnvironmentDefinitionTypeId: unique symbol;
|
|
174
|
-
declare const EnvironmentDecoderTypeId: unique symbol;
|
|
175
|
-
type EnvironmentFields = {
|
|
176
|
-
readonly [fieldName: PropertyKey]: DescribedValue<Schema.ConstraintDecoder<unknown, never>>;
|
|
177
|
-
};
|
|
178
|
-
interface DefinedEnv<Fields extends EnvironmentFields = EnvironmentFields> {
|
|
179
|
-
readonly _tag: "Environment";
|
|
180
|
-
readonly fields: Fields;
|
|
181
|
-
readonly descriptors: ReadonlyArray<DescriptorField>;
|
|
182
|
-
readonly schema: Schema.Struct<Fields>;
|
|
183
|
-
readonly [EnvironmentDefinitionTypeId]: Fields;
|
|
184
|
-
readonly [EnvironmentDecoderTypeId]: (raw: Readonly<Record<string, string>>) => Effect.Effect<Readonly<EnvironmentType<DefinedEnv<Fields>>>, EnvironmentValueInvalid>;
|
|
185
|
-
}
|
|
186
|
-
interface EnvironmentAuthoring {
|
|
187
|
-
readonly values: EnvironmentValues;
|
|
188
|
-
}
|
|
189
|
-
type EnvironmentType<Environment extends DefinedEnv> = Schema.Struct.Type<Environment[typeof EnvironmentDefinitionTypeId]>;
|
|
190
|
-
declare const EnvironmentValueInvalid_base: Schema.Class<EnvironmentValueInvalid, Schema.TaggedStruct<"EnvironmentValueInvalid", {
|
|
191
|
-
readonly key: Schema.optional<Schema.String>;
|
|
192
|
-
readonly message: Schema.String;
|
|
193
|
-
}>, import("effect/Cause").YieldableError>;
|
|
194
|
-
declare class EnvironmentValueInvalid extends EnvironmentValueInvalid_base {}
|
|
195
|
-
declare const defineEnv: <const Fields extends EnvironmentFields>(define: (authoring: EnvironmentAuthoring) => Fields) => DefinedEnv<Fields>;
|
|
196
|
-
declare const emptyEnv: DefinedEnv<{}>;
|
|
197
|
-
//#endregion
|
|
198
|
-
//#region src/schema/types.d.ts
|
|
199
|
-
/** A document identifier branded with the table it belongs to. */
|
|
200
|
-
type Id<TableName extends string> = GeneratedId & Brand.Brand<`ignotum/id/${TableName}`>;
|
|
201
|
-
declare const SchemaDefinitionTypeId: unique symbol;
|
|
202
|
-
interface SchemaDefinitionContract<Definition> {
|
|
203
|
-
readonly [SchemaDefinitionTypeId]: Definition;
|
|
204
|
-
}
|
|
205
|
-
type SchemaDefinitionOf<SchemaDefinition> = SchemaDefinition extends SchemaDefinitionContract<infer Definition> ? Definition : never;
|
|
206
|
-
interface TableDefinitionLike {
|
|
207
|
-
readonly fields: Schema.Struct.Fields;
|
|
208
|
-
}
|
|
209
|
-
interface TablesLike {
|
|
210
|
-
readonly [tableName: string]: TableDefinitionLike;
|
|
211
|
-
}
|
|
212
|
-
type TableNameOf$1<Definition extends TablesLike> = keyof Definition & string;
|
|
213
|
-
interface SystemFields<TableName extends string> {
|
|
214
|
-
readonly id: Id<TableName>;
|
|
215
|
-
readonly createdAt: Date;
|
|
216
|
-
readonly updatedAt: Date;
|
|
217
|
-
}
|
|
218
|
-
type DocumentFields<TableName extends string, Table extends TableDefinitionLike> = SystemFields<TableName> & Schema.Struct.Type<Table["fields"]>;
|
|
219
|
-
/** The complete document returned for a table, including Ignotum system fields. */
|
|
220
|
-
type Document<Definition extends TablesLike, TableName extends TableNameOf$1<Definition>> = { readonly [FieldName in keyof DocumentFields<TableName, Definition[TableName]>]: DocumentFields<TableName, Definition[TableName]>[FieldName]; };
|
|
221
|
-
//#endregion
|
|
222
|
-
//#region ../contracts/dist/schema/index.d.ts
|
|
223
|
-
//#region src/schema/definition.d.ts
|
|
224
|
-
type AnyTableDefinition = TableDefinition<Schema.Struct.Fields, IndexDefinitions>;
|
|
225
|
-
interface Tables {
|
|
226
|
-
readonly [tableName: string]: AnyTableDefinition;
|
|
227
|
-
}
|
|
228
|
-
type FieldsOf<Table extends AnyTableDefinition> = Table["fields"];
|
|
229
|
-
type IdTargetsOfFields<Fields extends Schema.Struct.Fields> = { readonly [FieldName in keyof Fields]: IdTargetsOf<Fields[FieldName]>; }[keyof Fields];
|
|
230
|
-
declare const UnknownTableReferenceTypeId: unique symbol;
|
|
231
|
-
interface UnknownTableReference<TableName extends string> {
|
|
232
|
-
readonly [UnknownTableReferenceTypeId]: `Unknown table reference: ${TableName}`;
|
|
233
|
-
}
|
|
234
|
-
type DefinitionReferenceValidation<Definitions extends Tables> = { readonly [TableName in keyof Definitions]: Exclude<IdTargetsOfFields<FieldsOf<Definitions[TableName]>>, keyof Definitions & string> extends (infer UnknownTarget extends string) ? [UnknownTarget] extends [never] ? unknown : UnknownTableReference<UnknownTarget> : never; };
|
|
235
|
-
type TableNameOf<SchemaDefinition extends Tables> = keyof SchemaDefinition & string;
|
|
236
|
-
interface DefinedSchema<SchemaDefinition extends Tables> extends SchemaDefinitionContract<SchemaDefinition> {
|
|
237
|
-
readonly _tag: "Schema";
|
|
238
|
-
}
|
|
239
|
-
interface SchemaAuthoring {
|
|
240
|
-
readonly table: typeof table;
|
|
241
|
-
readonly values: typeof values;
|
|
242
|
-
}
|
|
243
|
-
declare const defineSchema: <const Definitions extends Tables>(define: (authoring: SchemaAuthoring) => Definitions & DefinitionReferenceValidation<NoInfer<Definitions>>) => DefinedSchema<Definitions>;
|
|
244
|
-
//#endregion
|
|
245
|
-
//#region src/schema/server.d.ts
|
|
246
|
-
type TransportSchema = Schema.ConstraintCodec<unknown, unknown, never, never>;
|
|
247
|
-
interface ErrorSchema extends Schema.ConstraintCodec<ErrorValue, unknown, never, never> {
|
|
248
|
-
readonly Type: ErrorValue;
|
|
249
|
-
}
|
|
250
|
-
interface ResolvedFunctionValue {
|
|
251
|
-
readonly [UnresolvedReferencesTypeId]?: never;
|
|
252
|
-
}
|
|
253
|
-
type ContainsFile<Value> = Value extends FileValue ? true : Value extends Date ? false : Value extends ReadonlyArray<infer Item> ? true extends ContainsFile<Item> ? true : false : Value extends object ? true extends { [Key in keyof Value]-?: ContainsFile<Value[Key]>; }[keyof Value] ? true : false : false;
|
|
254
|
-
declare const InvalidFilePositionTypeId: unique symbol;
|
|
255
|
-
type FileFree<Value, Position extends string> = true extends ContainsFile<Value> ? {
|
|
256
|
-
readonly [InvalidFilePositionTypeId]: `Files cannot appear in ${Position}`;
|
|
257
|
-
} : unknown;
|
|
258
|
-
type ResolvedFunctionFields<Fields extends Schema.Struct.Fields> = { readonly [FieldName in keyof Fields]: Fields[FieldName] & ResolvedFunctionValue & TransportSchema; };
|
|
259
|
-
interface ForbiddenSystemFields {
|
|
260
|
-
readonly id?: never;
|
|
261
|
-
readonly createdAt?: never;
|
|
262
|
-
readonly updatedAt?: never;
|
|
263
|
-
}
|
|
264
|
-
type InsertOf<Table extends Tables[string]> = Schema.Struct.MakeIn<FieldsOf<Table>> & ForbiddenSystemFields;
|
|
265
|
-
type PatchOf<Table extends Tables[string]> = Partial<Schema.Struct.MakeIn<FieldsOf<Table>>> & ForbiddenSystemFields;
|
|
266
|
-
type FunctionArgs = Schema.Struct.Fields | undefined;
|
|
267
|
-
type FunctionReturns = TransportSchema | undefined;
|
|
268
|
-
type ArgsOf<Args extends FunctionArgs> = Args extends Schema.Struct.Fields ? keyof Args extends never ? void : Schema.Struct.Type<Args> : void;
|
|
269
|
-
type ReturnOf<Returns extends FunctionReturns> = Returns extends TransportSchema ? Returns["Type"] : void;
|
|
270
|
-
type DocumentNotFound<TableName extends string = string> = DocumentNotFoundValue<TableName, Id<TableName>>;
|
|
271
|
-
declare const IndexRangeTypeId: unique symbol;
|
|
272
|
-
interface IndexRangeExpression {
|
|
273
|
-
readonly [IndexRangeTypeId]: true;
|
|
274
|
-
}
|
|
275
|
-
type IndexFields<Definition extends Tables, Name extends TableNameOf<Definition>, IndexName extends keyof Definition[Name]["indexes"]> = Definition[Name]["indexes"][IndexName]["fields"] extends (infer Fields extends readonly string[]) ? readonly [...Fields, "createdAt", "id"] : never;
|
|
276
|
-
type IndexFieldValue<Definition extends Tables, Name extends TableNameOf<Definition>, FieldName extends string> = FieldName extends "createdAt" ? Date : FieldName extends "id" ? Id<Name> : FieldName extends keyof FieldsOf<Definition[Name]> ? FieldsOf<Definition[Name]>[FieldName]["Type"] : never;
|
|
277
|
-
interface IndexLowerBound<Definition extends Tables, Name extends TableNameOf<Definition>, FieldName extends string> extends IndexRangeExpression {
|
|
278
|
-
lt(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexRangeExpression;
|
|
279
|
-
lte(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexRangeExpression;
|
|
280
|
-
}
|
|
281
|
-
interface IndexUpperBound<Definition extends Tables, Name extends TableNameOf<Definition>, FieldName extends string> extends IndexRangeExpression {
|
|
282
|
-
gt(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexRangeExpression;
|
|
283
|
-
gte(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexRangeExpression;
|
|
284
|
-
}
|
|
285
|
-
interface IndexRangeBuilder<Definition extends Tables, Name extends TableNameOf<Definition>, Fields extends readonly string[]> extends IndexRangeExpression {
|
|
286
|
-
eq<FieldName extends Fields[0]>(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexRangeBuilder<Definition, Name, Fields extends readonly [string, ...infer Rest extends string[]] ? Rest : []>;
|
|
287
|
-
gt<FieldName extends Fields[0]>(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexLowerBound<Definition, Name, FieldName>;
|
|
288
|
-
gte<FieldName extends Fields[0]>(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexLowerBound<Definition, Name, FieldName>;
|
|
289
|
-
lt<FieldName extends Fields[0]>(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexUpperBound<Definition, Name, FieldName>;
|
|
290
|
-
lte<FieldName extends Fields[0]>(field: FieldName, value: IndexFieldValue<Definition, Name, FieldName>): IndexUpperBound<Definition, Name, FieldName>;
|
|
291
|
-
}
|
|
292
|
-
interface OrderedDatabaseQuery<Definition extends Tables, Name extends TableNameOf<Definition>> {
|
|
293
|
-
collect(): Result$1<ReadonlyArray<Document<Definition, Name>>, never>;
|
|
294
|
-
take(count: number): Result$1<ReadonlyArray<Document<Definition, Name>>, never>;
|
|
295
|
-
first(): Result$1<Document<Definition, Name> | undefined, never>;
|
|
296
|
-
unique(): Result$1<Document<Definition, Name> | undefined, never>;
|
|
297
|
-
paginate(options: PaginationOptions): Result$1<PaginationPage<Document<Definition, Name>>, never>;
|
|
298
|
-
}
|
|
299
|
-
interface SelectableDatabaseQuery<Definition extends Tables, Name extends TableNameOf<Definition>> extends OrderedDatabaseQuery<Definition, Name> {
|
|
300
|
-
order(direction: "asc" | "desc"): OrderedDatabaseQuery<Definition, Name>;
|
|
301
|
-
}
|
|
302
|
-
interface DatabaseQuery<Definition extends Tables, Name extends TableNameOf<Definition>> extends SelectableDatabaseQuery<Definition, Name> {
|
|
303
|
-
index<const IndexName extends keyof Definition[Name]["indexes"] & string>(name: IndexName, range?: (builder: IndexRangeBuilder<Definition, Name, IndexFields<Definition, Name, IndexName>>) => IndexRangeExpression): SelectableDatabaseQuery<Definition, Name>;
|
|
304
|
-
}
|
|
305
|
-
interface DatabaseReader<Definition extends Tables> {
|
|
306
|
-
query<const Name extends TableNameOf<Definition>>(name: Name): DatabaseQuery<Definition, Name>;
|
|
307
|
-
find<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result$1<Document<Definition, Name> | undefined, never>;
|
|
308
|
-
get<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result$1<Document<Definition, Name>, DocumentNotFound<Name>>;
|
|
309
|
-
}
|
|
310
|
-
interface DatabaseWriter<Definition extends Tables> extends DatabaseReader<Definition> {
|
|
311
|
-
delete<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>): Result$1<void, DocumentNotFound<Name>>;
|
|
312
|
-
insert<const Name extends TableNameOf<Definition>>(name: Name, value: InsertOf<Definition[NoInfer<Name>]>): Result$1<Id<Name>, never>;
|
|
313
|
-
patch<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>, value: PatchOf<Definition[NoInfer<Name>]>): Result$1<void, DocumentNotFound<Name>>;
|
|
314
|
-
replace<const Name extends TableNameOf<Definition>>(name: Name, id: Id<NoInfer<Name>>, value: InsertOf<Definition[NoInfer<Name>]>): Result$1<void, DocumentNotFound<Name>>;
|
|
315
|
-
}
|
|
316
|
-
interface QueryContext<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> {
|
|
317
|
-
readonly db: DatabaseReader<Definition>;
|
|
318
|
-
readonly env: EnvironmentType<Environment>;
|
|
319
|
-
readonly id: IdContext;
|
|
320
|
-
}
|
|
321
|
-
interface MutationContext<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> {
|
|
322
|
-
readonly db: DatabaseWriter<Definition>;
|
|
323
|
-
readonly env: EnvironmentType<Environment>;
|
|
324
|
-
readonly id: IdContext;
|
|
325
|
-
}
|
|
326
|
-
type FunctionKind = "Mutation" | "Query";
|
|
327
|
-
type HandlerContext<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv> = Kind extends "Query" ? QueryContext<Definition, Environment> : MutationContext<Definition, Environment>;
|
|
328
|
-
type Handler<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv, Args extends FunctionArgs, Success, Failure extends ErrorValue> = (ctx: HandlerContext<Kind, Definition, Environment>, args: ArgsOf<Args>) => Generator<Effect.Effect<unknown, Failure, never>, Success, never>;
|
|
329
|
-
type HandlerFailure<HandlerType> = HandlerType extends ((...arguments_: infer _Arguments) => Generator<infer Yielded, unknown, never>) ? Yielded extends Effect.Effect<unknown, infer Failure extends ErrorValue, never> ? Failure : never : never;
|
|
330
|
-
type FunctionDefinition<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv, Args extends FunctionArgs, Returns extends FunctionReturns, Errors extends ErrorSchema | undefined, Failure extends ErrorValue> = {
|
|
331
|
-
readonly _tag: Kind;
|
|
332
|
-
readonly handler: Handler<Kind, Definition, Environment, Args, ReturnOf<Returns>, Failure>;
|
|
333
|
-
} & (Args extends Schema.Struct.Fields ? {
|
|
334
|
-
readonly args: Args;
|
|
335
|
-
} : {
|
|
336
|
-
readonly args?: never;
|
|
337
|
-
}) & (Returns extends TransportSchema ? {
|
|
338
|
-
readonly returns: Returns;
|
|
339
|
-
} : {
|
|
340
|
-
readonly returns?: never;
|
|
341
|
-
}) & (Errors extends ErrorSchema ? {
|
|
342
|
-
readonly errors: Errors;
|
|
343
|
-
} : {
|
|
344
|
-
readonly errors?: never;
|
|
345
|
-
});
|
|
346
|
-
interface FunctionInput<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv, Args extends FunctionArgs, Success, Failure extends ErrorValue> {
|
|
347
|
-
readonly handler: Handler<Kind, Definition, Environment, Args, Success, Failure>;
|
|
348
|
-
}
|
|
349
|
-
type WithArgs<Kind extends FunctionKind, Args extends Schema.Struct.Fields> = {
|
|
350
|
-
readonly args: Args & ResolvedFunctionFields<NoInfer<Args>> & (Kind extends "Query" ? FileFree<Schema.Struct.Type<Args>, "query arguments"> : unknown);
|
|
351
|
-
};
|
|
352
|
-
interface WithoutArgs {
|
|
353
|
-
readonly args?: never;
|
|
354
|
-
}
|
|
355
|
-
type WithReturns<Kind extends FunctionKind, Returns extends TransportSchema> = {
|
|
356
|
-
readonly returns: Returns & ResolvedFunctionValue & (Kind extends "Mutation" ? FileFree<Returns["Type"], "mutation returns"> : unknown);
|
|
357
|
-
};
|
|
358
|
-
interface WithoutReturns {
|
|
359
|
-
readonly returns?: never;
|
|
360
|
-
}
|
|
361
|
-
interface DefineFunction<Kind extends FunctionKind, Definition extends Tables, Environment extends DefinedEnv> {
|
|
362
|
-
<const Args extends Schema.Struct.Fields, Returns extends TransportSchema, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Environment, Args, Returns["Type"], Errors["Type"]> & WithArgs<Kind, Args> & WithReturns<Kind, Returns> & {
|
|
363
|
-
readonly errors: Errors & ResolvedFunctionValue & FileFree<Errors["Type"], "errors">;
|
|
364
|
-
}): FunctionDefinition<Kind, Definition, Environment, Args, Returns, Errors, Errors["Type"]>;
|
|
365
|
-
<Returns extends TransportSchema, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Environment, undefined, Returns["Type"], Errors["Type"]> & WithoutArgs & WithReturns<Kind, Returns> & {
|
|
366
|
-
readonly errors: Errors & ResolvedFunctionValue & FileFree<Errors["Type"], "errors">;
|
|
367
|
-
}): FunctionDefinition<Kind, Definition, Environment, undefined, Returns, Errors, Errors["Type"]>;
|
|
368
|
-
<const Args extends Schema.Struct.Fields, Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Environment, Args, void, Errors["Type"]> & WithArgs<Kind, Args> & WithoutReturns & {
|
|
369
|
-
readonly errors: Errors & ResolvedFunctionValue & FileFree<Errors["Type"], "errors">;
|
|
370
|
-
}): FunctionDefinition<Kind, Definition, Environment, Args, undefined, Errors, Errors["Type"]>;
|
|
371
|
-
<Errors extends ErrorSchema>(definition: FunctionInput<Kind, Definition, Environment, undefined, void, Errors["Type"]> & WithoutArgs & WithoutReturns & {
|
|
372
|
-
readonly errors: Errors & ResolvedFunctionValue & FileFree<Errors["Type"], "errors">;
|
|
373
|
-
}): FunctionDefinition<Kind, Definition, Environment, undefined, undefined, Errors, Errors["Type"]>;
|
|
374
|
-
<const Args extends Schema.Struct.Fields, Returns extends TransportSchema, HandlerType extends Handler<Kind, Definition, Environment, Args, Returns["Type"], ErrorValue> = Handler<Kind, Definition, Environment, Args, Returns["Type"], never>>(definition: WithArgs<Kind, Args> & WithReturns<Kind, Returns> & {
|
|
375
|
-
readonly errors?: never;
|
|
376
|
-
readonly handler: HandlerType;
|
|
377
|
-
}): FunctionDefinition<Kind, Definition, Environment, Args, Returns, undefined, HandlerFailure<HandlerType>>;
|
|
378
|
-
<Returns extends TransportSchema, HandlerType extends Handler<Kind, Definition, Environment, undefined, Returns["Type"], ErrorValue> = Handler<Kind, Definition, Environment, undefined, Returns["Type"], never>>(definition: WithoutArgs & WithReturns<Kind, Returns> & {
|
|
379
|
-
readonly errors?: never;
|
|
380
|
-
readonly handler: HandlerType;
|
|
381
|
-
}): FunctionDefinition<Kind, Definition, Environment, undefined, Returns, undefined, HandlerFailure<HandlerType>>;
|
|
382
|
-
<const Args extends Schema.Struct.Fields, HandlerType extends Handler<Kind, Definition, Environment, Args, void, ErrorValue> = Handler<Kind, Definition, Environment, Args, void, never>>(definition: WithArgs<Kind, Args> & WithoutReturns & {
|
|
383
|
-
readonly errors?: never;
|
|
384
|
-
readonly handler: HandlerType;
|
|
385
|
-
}): FunctionDefinition<Kind, Definition, Environment, Args, undefined, undefined, HandlerFailure<HandlerType>>;
|
|
386
|
-
<HandlerType extends Handler<Kind, Definition, Environment, undefined, void, ErrorValue> = Handler<Kind, Definition, Environment, undefined, void, never>>(definition: WithoutArgs & WithoutReturns & {
|
|
387
|
-
readonly errors?: never;
|
|
388
|
-
readonly handler: HandlerType;
|
|
389
|
-
}): FunctionDefinition<Kind, Definition, Environment, undefined, undefined, undefined, HandlerFailure<HandlerType>>;
|
|
390
|
-
}
|
|
391
|
-
interface FunctionBuilders<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> {
|
|
392
|
-
readonly query: DefineFunction<"Query", Definition, Environment>;
|
|
393
|
-
readonly mutation: DefineFunction<"Mutation", Definition, Environment>;
|
|
394
|
-
}
|
|
395
|
-
interface SchemaBindings<Definition extends Tables, Environment extends DefinedEnv = typeof emptyEnv> extends FunctionBuilders<Definition, Environment> {
|
|
396
|
-
readonly values: BoundValues<Definition>;
|
|
397
|
-
}
|
|
398
|
-
declare function bindSchema<const Definition extends Tables>(schema: DefinedSchema<Definition>): SchemaBindings<Definition, typeof emptyEnv>;
|
|
399
|
-
declare function bindSchema<const Definition extends Tables, const Environment extends DefinedEnv>(schema: DefinedSchema<Definition>, environment: Environment): SchemaBindings<Definition, Environment>;
|
|
400
|
-
//#endregion
|
|
401
|
-
export { DefinedEnv as a, Id as c, defineEnv as d, Secret as f, defineSchema as i, SchemaDefinitionOf as l, SchemaAuthoring as n, Document as o, bindSchema as r, EnvironmentAuthoring as s, DefinedSchema as t, SchemaDefinitionTypeId as u };
|
|
402
|
-
//# sourceMappingURL=index-D54flWtH.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./pagination-DnKg3dkI-r5ZUxBBx.js";
|