ignotum 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +6 -6
  2. package/dist/cli/bin.mjs +6042 -4693
  3. package/dist/cli/bin.mjs.map +1 -1
  4. package/dist/cli/emscripten-module-D5GzfUNv.mjs +533 -0
  5. package/dist/cli/emscripten-module-D5GzfUNv.mjs.map +1 -0
  6. package/dist/cli/ffi-7IElU4Co.mjs +148 -0
  7. package/dist/cli/ffi-7IElU4Co.mjs.map +1 -0
  8. package/dist/cli/managed-release-WHYLZwaS.mjs +10902 -0
  9. package/dist/cli/managed-release-WHYLZwaS.mjs.map +1 -0
  10. package/dist/cli/managed-release.d.mts +1 -0
  11. package/dist/cli/managed-release.mjs +14 -0
  12. package/dist/cli/managed-release.mjs.map +1 -0
  13. package/dist/cli/module-ES6BEMUI-D36I4NVn.mjs +1289 -0
  14. package/dist/cli/module-ES6BEMUI-D36I4NVn.mjs.map +1 -0
  15. package/dist/runtime/{api-Cv3hMbzo.d.ts → api-B4fwp5a2.d.ts} +4 -4
  16. package/dist/runtime/bootstrap-BISQSn_O.js +916 -0
  17. package/dist/runtime/bootstrap-BISQSn_O.js.map +1 -0
  18. package/dist/runtime/bootstrap-BTFScKAc.d.ts +545 -0
  19. package/dist/runtime/client.d.ts +50 -15
  20. package/dist/runtime/client.js +7 -1158
  21. package/dist/runtime/client.js.map +1 -1
  22. package/dist/runtime/{descriptor-DCCz5AHd-_nhlnu8U.js → descriptor-CTY4mtwS-cS43EbwS.js} +3 -32
  23. package/dist/runtime/descriptor-CTY4mtwS-cS43EbwS.js.map +1 -0
  24. package/dist/runtime/{id-Bt9XWRGL.js → id--1m0NuUL.js} +4 -4
  25. package/dist/runtime/id--1m0NuUL.js.map +1 -0
  26. package/dist/runtime/{id-BzFHf3Wo-DGPCjgrf.d.ts → id-7an3nxTu-DZJSM5xh.d.ts} +2 -2
  27. package/dist/runtime/id-CBOt2kDo.d.ts +1 -0
  28. package/dist/runtime/identity-QjtJRxBD.d.ts +2 -0
  29. package/dist/runtime/image-Djtjy4Z8.js +19 -0
  30. package/dist/runtime/image-Djtjy4Z8.js.map +1 -0
  31. package/dist/runtime/{index-DWU-7TIh.d.ts → index-D4seNHlX.d.ts} +3 -4
  32. package/dist/runtime/internal/api.d.ts +1 -1
  33. package/dist/runtime/internal/api.js +30 -1
  34. package/dist/runtime/internal/api.js.map +1 -0
  35. package/dist/runtime/internal/bootstrap.d.ts +2 -0
  36. package/dist/runtime/internal/bootstrap.js +2 -0
  37. package/dist/runtime/internal/client.d.ts +2 -0
  38. package/dist/runtime/internal/client.js +75 -0
  39. package/dist/runtime/internal/client.js.map +1 -0
  40. package/dist/runtime/internal/host.d.ts +6 -7
  41. package/dist/runtime/internal/host.js +5 -4
  42. package/dist/runtime/internal/host.js.map +1 -1
  43. package/dist/runtime/internal/routes.d.ts +2 -0
  44. package/dist/runtime/internal/routes.js +2 -0
  45. package/dist/runtime/internal/server.d.ts +1 -1
  46. package/dist/runtime/internal/server.js +1 -1
  47. package/dist/runtime/internal/types.d.ts +2 -2
  48. package/dist/runtime/internal/types.js +1 -1
  49. package/dist/runtime/pagination-CBOt2kDo.d.ts +1 -0
  50. package/dist/runtime/pagination-D3qd6s9N.js +33 -0
  51. package/dist/runtime/pagination-D3qd6s9N.js.map +1 -0
  52. package/dist/runtime/result-BkziOG1L.d.ts +1 -0
  53. package/dist/runtime/router-BSBI1oN1.js +2377 -0
  54. package/dist/runtime/router-BSBI1oN1.js.map +1 -0
  55. package/dist/runtime/routes-Ce8TVP-T.js +690 -0
  56. package/dist/runtime/routes-Ce8TVP-T.js.map +1 -0
  57. package/dist/runtime/{schema-DqogEydG.js → schema-D1wOqiNH.js} +4 -3
  58. package/dist/runtime/schema-D1wOqiNH.js.map +1 -0
  59. package/dist/runtime/server.d.ts +5 -6
  60. package/dist/runtime/server.js +2 -2
  61. package/dist/runtime/{sync-Bs8J3fIr.d.ts → sync-D-GK2sv9.d.ts} +3 -2
  62. package/dist/runtime/{api-CAgKDij7.js → sync-DzUwA8W9.js} +22 -41
  63. package/dist/runtime/sync-DzUwA8W9.js.map +1 -0
  64. package/dist/runtime/{types-C1iDP2Yf-BnkfBOQf.d.ts → types-DeCCyqLU-BIm7rU-0.d.ts} +123 -6
  65. package/package.json +30 -5
  66. package/src/cli/agent-files.ts +10 -8
  67. package/src/cli/build/managed-client.ts +411 -0
  68. package/src/cli/build/managed-server.ts +294 -0
  69. package/src/cli/build/managed.ts +67 -0
  70. package/src/cli/build/output.ts +47 -0
  71. package/src/cli/build/server.ts +49 -247
  72. package/src/cli/client-config.ts +1 -140
  73. package/src/cli/client-styles.ts +1 -0
  74. package/src/cli/codegen.ts +9 -4
  75. package/src/cli/command.ts +9 -9
  76. package/src/cli/control-client.ts +88 -103
  77. package/src/cli/deploy.ts +120 -184
  78. package/src/cli/dev.ts +506 -107
  79. package/src/cli/image-assets.ts +499 -0
  80. package/src/cli/managed-client-boundaries.ts +103 -0
  81. package/src/cli/managed-dev-platform.ts +118 -0
  82. package/src/cli/managed-exports.ts +219 -0
  83. package/src/cli/managed-release-bin.ts +13 -0
  84. package/src/cli/managed-release.ts +260 -0
  85. package/src/cli/module-boundaries.ts +11 -1
  86. package/src/cli/new-app.ts +111 -87
  87. package/src/cli/route-codegen.ts +311 -0
  88. package/src/cli/route-static.ts +710 -0
  89. package/src/client/bootstrap.ts +110 -0
  90. package/src/client/errors.ts +13 -7
  91. package/src/client/files.ts +64 -0
  92. package/src/client/id.ts +9 -5
  93. package/src/client/image.ts +28 -0
  94. package/src/client/index.ts +25 -2
  95. package/src/client/managed-client.ts +729 -0
  96. package/src/client/managed-upgrade.ts +283 -0
  97. package/src/client/recovery-journal.ts +195 -0
  98. package/src/client/route-boundaries.ts +184 -0
  99. package/src/client/router-history.ts +152 -0
  100. package/src/client/router-store.ts +644 -0
  101. package/src/client/router.ts +324 -0
  102. package/src/client/routes.ts +28 -0
  103. package/src/client/sync.ts +65 -591
  104. package/src/dev-runtime/database.ts +2 -2
  105. package/src/dev-runtime/functions.ts +3 -3
  106. package/src/dev-runtime/managed-functions.ts +255 -0
  107. package/src/dev-runtime/managed-sync.ts +263 -0
  108. package/src/dev-runtime/managed-websocket.ts +71 -0
  109. package/src/dev-runtime/migrations.ts +11 -0
  110. package/src/dev-runtime/sync.ts +236 -236
  111. package/src/image-assets.d.ts +36 -0
  112. package/src/internal/client.ts +186 -0
  113. package/src/internal/http-paths.ts +0 -3
  114. package/src/internal/routes.ts +45 -0
  115. package/dist/runtime/api-CAgKDij7.js.map +0 -1
  116. package/dist/runtime/descriptor-DCCz5AHd-_nhlnu8U.js.map +0 -1
  117. package/dist/runtime/id-Bt9XWRGL.js.map +0 -1
  118. package/dist/runtime/id-E7JKqQ9r.d.ts +0 -1
  119. package/dist/runtime/pagination-CpYCaRYD-C2Rpp4Cw.d.ts +0 -122
  120. package/dist/runtime/pagination-E7JKqQ9r.d.ts +0 -1
  121. package/dist/runtime/result-DKAA4gpS.d.ts +0 -1
  122. package/dist/runtime/schema-DqogEydG.js.map +0 -1
  123. package/src/cli/build/client.ts +0 -119
  124. package/src/cli/build/public.ts +0 -186
  125. package/src/cli/client-entry.ts +0 -152
  126. package/src/cli/client-plugin.ts +0 -136
  127. package/src/client/app.ts +0 -15
@@ -0,0 +1,36 @@
1
+ declare module "*.css" {}
2
+
3
+ declare module "*.avif" {
4
+ const source: import("ignotum/client").ImageSource;
5
+ export default source;
6
+ }
7
+
8
+ declare module "*.gif" {
9
+ const source: import("ignotum/client").ImageSource;
10
+ export default source;
11
+ }
12
+
13
+ declare module "*.ico" {
14
+ const source: import("ignotum/client").ImageSource;
15
+ export default source;
16
+ }
17
+
18
+ declare module "*.jpeg" {
19
+ const source: import("ignotum/client").ImageSource;
20
+ export default source;
21
+ }
22
+
23
+ declare module "*.jpg" {
24
+ const source: import("ignotum/client").ImageSource;
25
+ export default source;
26
+ }
27
+
28
+ declare module "*.png" {
29
+ const source: import("ignotum/client").ImageSource;
30
+ export default source;
31
+ }
32
+
33
+ declare module "*.webp" {
34
+ const source: import("ignotum/client").ImageSource;
35
+ export default source;
36
+ }
@@ -0,0 +1,186 @@
1
+ import {
2
+ LayoutMetadata,
3
+ RouteDefinition,
4
+ StaticMetadata,
5
+ UrlValueDescriptor,
6
+ UrlScalarDescriptor,
7
+ } from "@ignotum/contracts/app-definition";
8
+ import type { Id } from "@ignotum/contracts/schema";
9
+ import { Schema } from "effect";
10
+ import type { ComponentChildren, ComponentType } from "preact";
11
+ import type { RouteLocation } from "../client/routes.js";
12
+
13
+ export { createImageSource } from "../client/image.js";
14
+
15
+ declare const UrlValueTypeId: unique symbol;
16
+ type Scalar = string | number | boolean;
17
+ type RequiredDescriptor = Exclude<UrlValueDescriptor, { type: "optional" | "default" }>;
18
+ type Mode = "required" | "optional" | "default";
19
+
20
+ export interface UrlValue<
21
+ Value,
22
+ Kind extends "scalar" | "array" = "scalar" | "array",
23
+ Presence extends Mode = Mode,
24
+ > {
25
+ readonly descriptor: UrlValueDescriptor;
26
+ readonly [UrlValueTypeId]?: {
27
+ readonly value: Value;
28
+ readonly kind: Kind;
29
+ readonly presence: Presence;
30
+ };
31
+ }
32
+ export interface RequiredUrlValue<Value, Kind extends "scalar" | "array"> extends UrlValue<
33
+ Value,
34
+ Kind,
35
+ "required"
36
+ > {
37
+ default(value: Value): UrlValue<Value, Kind, "default">;
38
+ }
39
+ export type UrlFields = Readonly<Record<string, UrlValue<unknown>>>;
40
+ export type PathFields = Readonly<
41
+ Record<
42
+ string,
43
+ UrlValue<unknown, "scalar", "required"> | UrlValue<readonly string[], "array", "required">
44
+ >
45
+ >;
46
+ type ValueOf<Value> = Value extends UrlValue<infer Decoded> ? Decoded : never;
47
+ type OptionalKeys<Fields extends UrlFields> = {
48
+ [Key in keyof Fields]: Fields[Key] extends UrlValue<
49
+ unknown,
50
+ "scalar" | "array",
51
+ "optional" | "default"
52
+ >
53
+ ? Key
54
+ : never;
55
+ }[keyof Fields];
56
+ export type DecodedFields<Fields extends UrlFields> = {
57
+ readonly [Key in keyof Fields]: Fields[Key] extends UrlValue<
58
+ unknown,
59
+ "scalar" | "array",
60
+ "optional"
61
+ >
62
+ ? ValueOf<Fields[Key]> | undefined
63
+ : ValueOf<Fields[Key]>;
64
+ };
65
+ export type InputFields<Fields extends UrlFields> = {
66
+ readonly [Key in Exclude<keyof Fields, OptionalKeys<Fields>>]: ValueOf<Fields[Key]>;
67
+ } & { readonly [Key in OptionalKeys<Fields>]?: ValueOf<Fields[Key]> | undefined };
68
+
69
+ const validateValue = Schema.decodeUnknownSync(UrlValueDescriptor);
70
+ const required = <Value, Kind extends "scalar" | "array">(
71
+ descriptor: RequiredDescriptor,
72
+ ): RequiredUrlValue<Value, Kind> => {
73
+ const checked = validateValue(descriptor);
74
+ return {
75
+ descriptor: checked,
76
+ default: (value) => ({
77
+ descriptor: validateValue({ type: "default", value: checked, default: value }),
78
+ }),
79
+ };
80
+ };
81
+
82
+ export interface UrlValues<DataModel> {
83
+ string(): RequiredUrlValue<string, "scalar">;
84
+ id<Table extends Extract<keyof DataModel, string>>(
85
+ table: Table,
86
+ ): RequiredUrlValue<Id<Table>, "scalar">;
87
+ number(): RequiredUrlValue<number, "scalar">;
88
+ integer(): RequiredUrlValue<number, "scalar">;
89
+ boolean(): RequiredUrlValue<boolean, "scalar">;
90
+ literal<const Value extends Scalar>(value: Value): RequiredUrlValue<Value, "scalar">;
91
+ literals<const Values extends readonly [Scalar, ...Scalar[]]>(
92
+ ...values: Values
93
+ ): RequiredUrlValue<Values[number], "scalar">;
94
+ optional<Value, Kind extends "scalar" | "array">(
95
+ value: RequiredUrlValue<Value, Kind>,
96
+ ): UrlValue<Value, Kind, "optional">;
97
+ array<Value>(
98
+ value: RequiredUrlValue<Value, "scalar">,
99
+ ): RequiredUrlValue<readonly Value[], "array">;
100
+ }
101
+
102
+ export interface RouteErrorProps {
103
+ readonly error: unknown;
104
+ readonly retry: () => void;
105
+ }
106
+ export interface InvalidRouteProps {
107
+ readonly location: RouteLocation;
108
+ readonly issues: ReadonlyArray<{
109
+ readonly source: "params" | "searchParams";
110
+ readonly field?: string | undefined;
111
+ readonly message: string;
112
+ }>;
113
+ }
114
+ export interface PageDefinition<
115
+ Params extends PathFields | undefined = PathFields | undefined,
116
+ Search extends UrlFields = UrlFields,
117
+ > extends StaticMetadata {
118
+ readonly params?: Params;
119
+ readonly searchParams?: Search;
120
+ readonly component: ComponentType<{
121
+ readonly params: Params extends PathFields
122
+ ? DecodedFields<Params>
123
+ : Readonly<Record<string, string | readonly string[]>>;
124
+ readonly searchParams: DecodedFields<Search>;
125
+ }>;
126
+ readonly error?: ComponentType<RouteErrorProps>;
127
+ readonly invalid?: ComponentType<InvalidRouteProps>;
128
+ }
129
+ export interface LayoutDefinition extends LayoutMetadata {
130
+ readonly component: ComponentType<{ readonly children: ComponentChildren }>;
131
+ readonly error?: ComponentType<RouteErrorProps>;
132
+ readonly invalid?: ComponentType<InvalidRouteProps>;
133
+ readonly notFound?: ComponentType<{ readonly location: RouteLocation }>;
134
+ }
135
+
136
+ export const bindSchema = <DataModel>() => {
137
+ const values: UrlValues<DataModel> = {
138
+ string: () => required({ type: "string" }),
139
+ id: (table) => required({ type: "id", table }),
140
+ number: () => required({ type: "number" }),
141
+ integer: () => required({ type: "integer" }),
142
+ boolean: () => required({ type: "boolean" }),
143
+ literal: (value) => required({ type: "literal", value }),
144
+ literals: (...values) => required({ type: "literals", values }),
145
+ optional: (value) => ({
146
+ descriptor: validateValue({ type: "optional", value: value.descriptor }),
147
+ }),
148
+ array: (value) =>
149
+ required({
150
+ type: "array",
151
+ value: Schema.decodeUnknownSync(UrlScalarDescriptor)(value.descriptor),
152
+ }),
153
+ };
154
+ const route = <
155
+ const Params extends PathFields | undefined = undefined,
156
+ const Search extends UrlFields = {},
157
+ >(
158
+ definition: PageDefinition<Params, Search>,
159
+ ): PageDefinition<Params, Search> => {
160
+ Schema.decodeUnknownSync(StaticMetadata)({ title: definition.title, meta: definition.meta });
161
+ const params: PathFields = definition.params ?? {};
162
+ Schema.decodeUnknownSync(RouteDefinition.fields.params)(
163
+ Object.entries(params).map(([name, value]) => ({
164
+ name,
165
+ value: value.descriptor,
166
+ })),
167
+ );
168
+ for (const value of Object.values(definition.searchParams ?? {}))
169
+ validateValue(value.descriptor);
170
+ return definition;
171
+ };
172
+ const layout = (definition: LayoutDefinition): LayoutDefinition => {
173
+ Schema.decodeUnknownSync(LayoutMetadata)({
174
+ title: definition.title,
175
+ titleTemplate: definition.titleTemplate,
176
+ meta: definition.meta,
177
+ });
178
+ return definition;
179
+ };
180
+ return { route, layout, values };
181
+ };
182
+
183
+ export { createRouteReference, getRouteDefinition } from "./routes.js";
184
+
185
+ export { mountClient } from "../client/bootstrap.js";
186
+ export type { ClientRegistration, RegisteredClientModule } from "../client/router-store.js";
@@ -1,7 +1,4 @@
1
- import { appSyncPath } from "@ignotum/contracts/runtime/transport";
2
-
3
1
  export const ignotumPathPrefix = "/_ignotum";
4
- export const syncPath = appSyncPath;
5
2
 
6
3
  export const isIgnotumPath = (pathname: string): boolean =>
7
4
  pathname === ignotumPathPrefix || pathname.startsWith(`${ignotumPathPrefix}/`);
@@ -0,0 +1,45 @@
1
+ import { RouteDefinition } from "@ignotum/contracts/app-definition";
2
+ import { Schema } from "effect";
3
+
4
+ import type { DecodedFields, InputFields, PathFields, UrlFields } from "./client.js";
5
+
6
+ const RouteReferenceTypeId: unique symbol = Symbol.for("ignotum/internal/routes/RouteReference");
7
+ declare const RouteReferenceTypesTypeId: unique symbol;
8
+
9
+ export interface RouteReference<Params = unknown, Search = unknown, SearchInputs = unknown> {
10
+ readonly [RouteReferenceTypeId]: RouteDefinition;
11
+ readonly [RouteReferenceTypesTypeId]?: {
12
+ readonly params: Params;
13
+ readonly searchParams: Search;
14
+ readonly searchInputs: SearchInputs;
15
+ };
16
+ }
17
+ export type ReferenceTypes<Reference> =
18
+ Reference extends RouteReference<infer Params, infer Search, infer SearchInputs>
19
+ ? {
20
+ readonly params: Params;
21
+ readonly searchParams: Search;
22
+ readonly searchInputs: SearchInputs;
23
+ }
24
+ : never;
25
+ type ParamsOf<Page, Inferred> = Page extends { readonly params?: infer Params }
26
+ ? Params extends PathFields
27
+ ? DecodedFields<Params>
28
+ : Inferred
29
+ : Inferred;
30
+ type SearchOf<Page> = Page extends { readonly searchParams?: infer Search extends UrlFields }
31
+ ? Search
32
+ : {};
33
+
34
+ export const createRouteReference = <Page, InferredParams>(
35
+ definition: typeof RouteDefinition.Encoded,
36
+ ): RouteReference<
37
+ ParamsOf<Page, InferredParams>,
38
+ DecodedFields<SearchOf<Page>>,
39
+ InputFields<SearchOf<Page>>
40
+ > => ({
41
+ [RouteReferenceTypeId]: Schema.decodeUnknownSync(RouteDefinition)(definition),
42
+ });
43
+
44
+ export const getRouteDefinition = (reference: RouteReference): RouteDefinition =>
45
+ reference[RouteReferenceTypeId];
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-CAgKDij7.js","names":[],"sources":["../../../contracts/dist/runtime/identity.js","../../../contracts/dist/runtime/sync.js","../../src/internal/api.ts"],"sourcesContent":["import { AppId, AuthAccountId, AuthDeviceCodeId, AuthInternalId, AuthInvitationId, AuthMemberId, AuthSessionId, AuthVerificationId, ConnectionId, DeploymentId, DevDatabaseLockId, InvocationId, PlatformPrincipalId, RequestId, RuntimeRequestNonce, SubscriptionId, TableId, TeamId } from \"./id.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/identity.ts\nconst InvocationKey = Schema.String.pipe(Schema.brand(\"ignotum/hosted/InvocationKey\"));\nconst DeploymentGeneration = Schema.Natural.pipe(Schema.brand(\"ignotum/hosted/DeploymentGeneration\"));\nconst AppStateRevision = Schema.Natural.pipe(Schema.brand(\"ignotum/hosted/AppStateRevision\"));\n//#endregion\nexport { AppId, AppStateRevision, AuthAccountId, AuthDeviceCodeId, AuthInternalId, AuthInvitationId, AuthMemberId, AuthSessionId, AuthVerificationId, ConnectionId, DeploymentGeneration, DeploymentId, DevDatabaseLockId, InvocationId, InvocationKey, PlatformPrincipalId, RequestId, RuntimeRequestNonce, SubscriptionId, TableId, TeamId };\n\n//# sourceMappingURL=identity.js.map","import { AppId, DeploymentId, InvocationId, SubscriptionId } from \"./id.js\";\nimport { FileId } from \"../schema/file.js\";\nimport { TransportValueSchema, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue } from \"./value.js\";\nimport { SessionState } from \"../id.js\";\nimport { AppStateRevision, DeploymentGeneration } from \"./identity.js\";\nimport { Schema } from \"effect\";\n//#region src/runtime/sync.ts\nconst FunctionNamePart = Schema.String.check(Schema.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]*$/));\nconst ApiFunctionAddressParts = Schema.TemplateLiteralParser([\n\t\"api.\",\n\tFunctionNamePart,\n\t\".\",\n\tFunctionNamePart\n]);\nconst FunctionAddress = Schema.TemplateLiteral([\n\t\"api.\",\n\tFunctionNamePart,\n\t\".\",\n\tFunctionNamePart\n]);\nconst apiFunctionParts = (address) => {\n\tconst [, moduleName, , functionName] = Schema.decodeSync(ApiFunctionAddressParts)(address);\n\treturn {\n\t\tfunctionName,\n\t\tmoduleName\n\t};\n};\nconst Subscribe = Schema.Struct({\n\ttype: Schema.Literal(\"Subscribe\"),\n\tid: SubscriptionId,\n\tfunction: FunctionAddress,\n\targs: Schema.Json\n});\nconst Unsubscribe = Schema.Struct({\n\ttype: Schema.Literal(\"Unsubscribe\"),\n\tid: SubscriptionId\n});\nconst Invoke = Schema.Struct({\n\ttype: Schema.Literal(\"Invoke\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tfunction: FunctionAddress,\n\targs: Schema.Json\n});\nconst Prepare = Schema.Struct({\n\ttype: Schema.Literal(\"Prepare\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tfunction: FunctionAddress,\n\targs: Schema.Json,\n\tfiles: Schema.Array(FileId)\n});\nconst ClientMessage = Schema.Union([\n\tSubscribe,\n\tUnsubscribe,\n\tPrepare,\n\tInvoke\n]);\nconst SubscriptionOperation = Schema.Struct({\n\ttype: Schema.Literal(\"Subscription\"),\n\tid: SubscriptionId\n});\nconst InvocationOperation = Schema.Struct({\n\ttype: Schema.Literal(\"Invocation\"),\n\tid: InvocationId\n});\nconst Operation = Schema.Union([SubscriptionOperation, InvocationOperation]);\nconst DatePath = Schema.Array(Schema.Union([Schema.String, Schema.Natural]));\nconst DatePaths = Schema.Array(DatePath);\nconst WireSuccess = Schema.Struct({\n\ttype: Schema.Literal(\"Success\"),\n\tvalue: Schema.optional(Schema.Json),\n\tdates: Schema.optional(DatePaths)\n});\nconst WireFailure = Schema.Struct({\n\ttype: Schema.Literal(\"Failure\"),\n\terror: Schema.Json,\n\tdates: Schema.optional(DatePaths)\n});\nconst WireResult = Schema.Union([WireSuccess, WireFailure]);\nconst SyncHandshake = Schema.Struct({\n\tsession: Schema.optional(SessionState),\n\tserverTime: Schema.optional(Schema.Finite),\n\ttype: Schema.Literal(\"Handshake\"),\n\tappId: AppId,\n\tdeploymentId: DeploymentId,\n\tgeneration: DeploymentGeneration\n});\nconst Snapshot = Schema.Struct({\n\tidentity: Schema.optional(Schema.Struct({\n\t\tsessionEpoch: Schema.String,\n\t\tviewRevision: Schema.Natural,\n\t\tdependsOnId: Schema.Boolean\n\t})),\n\ttype: Schema.Literal(\"Snapshot\"),\n\tid: SubscriptionId,\n\tresult: WireResult,\n\trevision: AppStateRevision,\n\tfiles: Schema.optional(Schema.Array(Schema.Struct({\n\t\tid: FileId,\n\t\turl: Schema.String\n\t})))\n});\nconst Preparation = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Preparation\"),\n\tid: InvocationId,\n\tkind: Schema.Literal(\"Mutation\"),\n\tuploads: Schema.Array(Schema.Struct({\n\t\tid: FileId,\n\t\turl: Schema.optional(Schema.String)\n\t}))\n});\nconst SyncResultSuccess = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireSuccess,\n\tcommittedRevision: AppStateRevision\n});\nconst SyncResultFailure = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireFailure\n});\nconst ErrorCode = Schema.Literals([\n\t\"SessionChanged\",\n\t\"SessionExpired\",\n\t\"DuplicateOperationId\",\n\t\"FunctionUnavailable\",\n\t\"InvalidArguments\",\n\t\"InvalidMessage\",\n\t\"InvocationIdConflict\",\n\t\"ResourceLimitExceeded\",\n\t\"UnknownFunction\",\n\t\"WrongFunctionKind\"\n]);\nconst SyncError = Schema.Struct({\n\tsessionEpoch: Schema.optional(Schema.String),\n\ttype: Schema.Literal(\"Error\"),\n\toperation: Schema.optional(Operation),\n\tcode: ErrorCode,\n\tmessage: Schema.String\n});\nconst Deployment = Schema.Struct({\n\ttype: Schema.Literal(\"Deployment\"),\n\tdeploymentId: DeploymentId,\n\tgeneration: DeploymentGeneration\n});\nconst DeploymentCloseCode = 4409;\nconst Session = Schema.Union([Schema.Struct({\n\ttype: Schema.Literal(\"Session\"),\n\tevent: Schema.Literal(\"Updated\"),\n\tserverTime: Schema.Finite,\n\tsession: SessionState\n}), Schema.Struct({\n\ttype: Schema.Literal(\"Session\"),\n\tevent: Schema.Literals([\n\t\t\"SignedOut\",\n\t\t\"Revoked\",\n\t\t\"Expired\",\n\t\t\"Unavailable\",\n\t\t\"Replaced\"\n\t]),\n\tsessionEpoch: Schema.String\n})]);\nconst Invalidate = Schema.Struct({\n\ttype: Schema.Literal(\"Invalidate\"),\n\tsessionEpoch: Schema.String,\n\tids: Schema.Array(SubscriptionId)\n});\nconst ServerMessage = Schema.Union([\n\tSession,\n\tInvalidate,\n\tSyncHandshake,\n\tSnapshot,\n\tPreparation,\n\tSyncResultSuccess,\n\tSyncResultFailure,\n\tSyncError,\n\tDeployment\n]);\nconst ClientMessageJson = Schema.fromJsonString(ClientMessage);\nconst ServerMessageJson = Schema.fromJsonString(ServerMessage);\n//#endregion\nexport { ClientMessage, ClientMessageJson, DatePath, Deployment, DeploymentCloseCode, ErrorCode, FunctionAddress, FunctionNamePart, Invalidate, InvocationId, Operation, ServerMessage, ServerMessageJson, Session, SubscriptionId, SyncHandshake, TransportValueSchema, WireFailure, WireResult, WireSuccess, apiFunctionParts, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue };\n\n//# sourceMappingURL=sync.js.map","import { Predicate } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport type { ErrorValue, InternalServerError } from \"@ignotum/contracts/runtime/result\";\nimport { FunctionAddress } from \"@ignotum/contracts/runtime/sync\";\nimport type { FileValue } from \"@ignotum/contracts/schema/file\";\n\nconst FunctionReferenceTypeId: unique symbol = Symbol.for(\"ignotum/internal/api/FunctionReference\");\ndeclare const FunctionReferenceTypesTypeId: unique symbol;\n\ntype FunctionKind = \"Mutation\" | \"Query\";\n\nexport type MutationInput<Value> = Value extends FileValue\n ? Value | File\n : Value extends Date\n ? Value\n : Value extends ReadonlyArray<infer Item>\n ? ReadonlyArray<MutationInput<Item>>\n : Value extends object\n ? { readonly [Key in keyof Value]: MutationInput<Value[Key]> }\n : Value;\n\nexport interface FunctionReference<\n Kind extends FunctionKind,\n Args,\n Success,\n Failure extends ErrorValue,\n> {\n readonly [FunctionReferenceTypeId]: FunctionAddress;\n readonly [FunctionReferenceTypesTypeId]?: {\n readonly kind: Kind;\n readonly args: Args;\n readonly value: Success;\n readonly error: Failure;\n };\n}\n\ntype ReferenceTypes<Reference> = Reference extends {\n readonly [FunctionReferenceTypesTypeId]?: infer Types;\n}\n ? Exclude<Types, undefined>\n : never;\n\nexport declare namespace FunctionReference {\n type Args<Reference> =\n ReferenceTypes<Reference> extends { readonly args: infer Args } ? Args : never;\n type Failure<Reference> =\n ReferenceTypes<Reference> extends {\n readonly error: infer Failure;\n }\n ? Failure\n : never;\n type Kind<Reference> =\n ReferenceTypes<Reference> extends { readonly kind: infer Kind } ? Kind : never;\n type Success<Reference> =\n ReferenceTypes<Reference> extends {\n readonly value: infer Success;\n }\n ? Success\n : never;\n}\n\ntype ReferenceOf<Definition> = Definition extends {\n readonly _tag: infer Kind extends FunctionKind;\n readonly handler: (\n ...arguments_: infer HandlerArguments\n ) => Generator<infer Yielded, infer Success, never>;\n}\n ? HandlerArguments extends readonly [infer _Context, ...infer Rest]\n ? FunctionReference<\n Kind,\n Rest extends readonly [infer Args, ...ReadonlyArray<unknown>]\n ? Kind extends \"Mutation\"\n ? MutationInput<Args>\n : Args\n : void,\n Success,\n | (Yielded extends Effect.Effect<unknown, infer Failure extends ErrorValue, never>\n ? Failure\n : never)\n | InternalServerError\n >\n : never\n : never;\n\ntype ApiModule<Module> = {\n readonly [FunctionName in keyof Module as FunctionName extends string\n ? ReferenceOf<Module[FunctionName]> extends never\n ? never\n : FunctionName\n : never]: ReferenceOf<Module[FunctionName]>;\n};\n\nexport type Api<Modules> = {\n readonly [ModuleName in keyof Modules]: ApiModule<Modules[ModuleName]>;\n};\n\nexport const functionPathOf = <\n Kind extends FunctionKind,\n Args,\n Success,\n Failure extends ErrorValue,\n>(\n reference: FunctionReference<Kind, Args, Success, Failure>,\n) => reference[FunctionReferenceTypeId];\n\nconst makeModuleReference = (moduleName: string) => {\n const references = new Map<string, object>();\n\n return new Proxy(\n {},\n {\n get: (_target, functionName) => {\n if (!Predicate.isString(functionName)) {\n return undefined;\n }\n\n const existing = references.get(functionName);\n if (existing !== undefined) {\n return existing;\n }\n\n const reference = {\n [FunctionReferenceTypeId]: FunctionAddress.make(`api.${moduleName}.${functionName}`),\n };\n references.set(functionName, reference);\n return reference;\n },\n },\n );\n};\n\nexport function createApi<Modules>(): Api<Modules>;\nexport function createApi() {\n const modules = new Map<string, object>();\n\n return new Proxy(\n {},\n {\n get: (_target, moduleName) => {\n if (!Predicate.isString(moduleName)) {\n return undefined;\n }\n\n const existing = modules.get(moduleName);\n if (existing !== undefined) {\n return existing;\n }\n\n const moduleReference = makeModuleReference(moduleName);\n modules.set(moduleName, moduleReference);\n return moduleReference;\n },\n },\n );\n}\n"],"mappings":";;;AAGA,MAAM,gBAAgB,OAAO,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AACrF,MAAM,uBAAuB,OAAO,QAAQ,KAAK,OAAO,MAAM,qCAAqC,CAAC;AACpG,MAAM,mBAAmB,OAAO,QAAQ,KAAK,OAAO,MAAM,iCAAiC,CAAC;;;ACE5F,MAAM,mBAAmB,OAAO,OAAO,MAAM,OAAO,UAAU,4BAA4B,CAAC;AAC3D,OAAO,sBAAsB;CAC5D;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,kBAAkB,OAAO,gBAAgB;CAC9C;CACA;CACA;CACA;AACD,CAAC;AAQD,MAAM,YAAY,OAAO,OAAO;CAC/B,MAAM,OAAO,QAAQ,WAAW;CAChC,IAAI;CACJ,UAAU;CACV,MAAM,OAAO;AACd,CAAC;AACD,MAAM,cAAc,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,aAAa;CAClC,IAAI;AACL,CAAC;AACD,MAAM,SAAS,OAAO,OAAO;CAC5B,MAAM,OAAO,QAAQ,QAAQ;CAC7B,IAAI;CACJ,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU;CACV,MAAM,OAAO;AACd,CAAC;AACD,MAAM,UAAU,OAAO,OAAO;CAC7B,MAAM,OAAO,QAAQ,SAAS;CAC9B,IAAI;CACJ,MAAM,OAAO,QAAQ,UAAU;CAC/B,UAAU;CACV,MAAM,OAAO;CACb,OAAO,OAAO,MAAM,MAAM;AAC3B,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CAClC;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,wBAAwB,OAAO,OAAO;CAC3C,MAAM,OAAO,QAAQ,cAAc;CACnC,IAAI;AACL,CAAC;AACD,MAAM,sBAAsB,O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CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,oBAAoB,OAAO,eAAe,aAAa;AAC7D,MAAM,oBAAoB,OAAO,eAAe,aAAa;;;ACjL7D,MAAM,0BAAyC,OAAO,IAAI,wCAAwC;AA0FlG,MAAa,kBAMX,cACG,UAAU;AAEf,MAAM,uBAAuB,eAAuB;CAClD,MAAM,6BAAa,IAAI,IAAoB;CAE3C,OAAO,IAAI,MACT,CAAC,GACD,EACE,MAAM,SAAS,iBAAiB;EAC9B,IAAI,CAAC,UAAU,SAAS,YAAY,GAClC;EAGF,MAAM,WAAW,WAAW,IAAI,YAAY;EAC5C,IAAI,aAAa,KAAA,GACf,OAAO;EAGT,MAAM,YAAY,GACf,0BAA0B,gBAAgB,KAAK,OAAO,WAAW,GAAG,cAAc,EACrF;EACA,WAAW,IAAI,cAAc,SAAS;EACtC,OAAO;CACT,EACF,CACF;AACF;AAGA,SAAgB,YAAY;CAC1B,MAAM,0BAAU,IAAI,IAAoB;CAExC,OAAO,IAAI,MACT,CAAC,GACD,EACE,MAAM,SAAS,eAAe;EAC5B,IAAI,CAAC,UAAU,SAAS,UAAU,GAChC;EAGF,MAAM,WAAW,QAAQ,IAAI,UAAU;EACvC,IAAI,aAAa,KAAA,GACf,OAAO;EAGT,MAAM,kBAAkB,oBAAoB,UAAU;EACtD,QAAQ,IAAI,YAAY,eAAe;EACvC,OAAO;CACT,EACF,CACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-DCCz5AHd-_nhlnu8U.js","names":[],"sources":["../../../contracts/dist/runtime/pagination.js","../../../contracts/dist/descriptor-DCCz5AHd.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 { Effect, Function, Predicate, Schema } from \"effect\";\n//#region src/schema/evolution.ts\nconst ValueEvolutionTypeId = Symbol.for(\"ignotum/schema/ValueEvolution\");\nconst evolutionRules = (value) => value[ValueEvolutionTypeId] ?? {};\nconst codec = (value) => Schema.toCodecJson(value);\nconst encode = (schema, value) => Schema.decodeUnknownSync(Schema.Json)(Schema.encodeUnknownSync(codec(schema), { onExcessProperty: \"error\" })(value));\nconst decode = (schema, value) => Schema.decodeUnknownSync(codec(schema), { onExcessProperty: \"error\" })(value);\nconst copy = (value) => Object.create(Object.getPrototypeOf(value), Object.getOwnPropertyDescriptors(value));\nconst isValueObject = Schema.is(Schema.Record(Schema.String, Schema.Unknown));\nconst attachEvolution = (value, rules = {}) => {\n\tObject.defineProperty(value, ValueEvolutionTypeId, {\n\t\tconfigurable: true,\n\t\tvalue: rules\n\t});\n\treturn Object.assign(value, {\n\t\tdefault(defaultValue) {\n\t\t\tif (getValueDescriptor(value)?.type === \"optional\") throw new Error(\"Defaults require a non-optional validator. A default already allows omission on creation.\");\n\t\t\tconst defaultJson = JSON.stringify(encode(value, defaultValue));\n\t\t\tconst next = copy(value);\n\t\t\tconst constructor = Schema.withConstructorDefault(Effect.sync(() => decode(value, JSON.parse(defaultJson))))(value);\n\t\t\tObject.defineProperty(next, \"ast\", {\n\t\t\t\tvalue: constructor.ast,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\t\t\treturn attachEvolution(next, {\n\t\t\t\t...rules,\n\t\t\t\tdefaultJson\n\t\t\t});\n\t\t},\n\t\trenameFrom(name) {\n\t\t\tif (name.length === 0 || [\n\t\t\t\t\"id\",\n\t\t\t\t\"createdAt\",\n\t\t\t\t\"updatedAt\"\n\t\t\t].includes(name)) throw new Error(`Cannot rename reserved or empty field '${name}'.`);\n\t\t\treturn attachEvolution(copy(value), {\n\t\t\t\t...rules,\n\t\t\t\trenameFrom: name\n\t\t\t});\n\t\t},\n\t\tfrom(previous, convert) {\n\t\t\tif (getValueDescriptor(previous) === void 0) throw new Error(\"Historical values must use an Ignotum values validator.\");\n\t\t\treturn attachEvolution(copy(value), {\n\t\t\t\t...rules,\n\t\t\t\tprevious: [...rules.previous ?? [], {\n\t\t\t\t\tschema: previous,\n\t\t\t\t\tconvert\n\t\t\t\t}]\n\t\t\t});\n\t\t}\n\t});\n};\nconst withValueChildren = (value, children) => {\n\tattachEvolution(value, {\n\t\t...evolutionRules(value),\n\t\tchildren\n\t});\n\treturn value;\n};\nconst validateFieldRenames = (fields) => {\n\tconst sources = /* @__PURE__ */ new Set();\n\tfor (const [name, field] of Object.entries(fields)) {\n\t\tconst source = evolutionRules(field).renameFrom;\n\t\tif (source === void 0) continue;\n\t\tif (source === name || Object.hasOwn(fields, source) || sources.has(source)) throw new Error(`Rename source '${source}' conflicts with another field.`);\n\t\tsources.add(source);\n\t}\n};\nconst mapChildren = (schema, value, visit, rename) => {\n\tconst children = evolutionRules(schema).children;\n\tif (children === void 0) return value;\n\tswitch (children.type) {\n\t\tcase \"object\": {\n\t\t\tif (!isValueObject(value)) return value;\n\t\t\tconst result = { ...value };\n\t\t\tfor (const [name, field] of Object.entries(children.fields)) {\n\t\t\t\tconst source = rename ? evolutionRules(field).renameFrom : void 0;\n\t\t\t\tif (source !== void 0 && Object.hasOwn(result, source)) {\n\t\t\t\t\tif (Object.hasOwn(result, name)) throw new Error(`Both '${name}' and its rename source '${source}' are present.`);\n\t\t\t\t\tObject.defineProperty(result, name, {\n\t\t\t\t\t\tvalue: result[source],\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t});\n\t\t\t\t\tdelete result[source];\n\t\t\t\t}\n\t\t\t\tconst next = visit(field, Object.hasOwn(result, name) ? result[name] : void 0);\n\t\t\t\tif (next !== void 0) Object.defineProperty(result, name, {\n\t\t\t\t\tvalue: next,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\tcase \"array\": return Array.isArray(value) ? value.map((item) => visit(children.value, item)) : value;\n\t\tcase \"record\": return isValueObject(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, visit(children.value, item)])) : value;\n\t\tcase \"nullable\": return value === null ? value : visit(children.value, value);\n\t\tcase \"optional\": return value === void 0 ? value : visit(children.value, value);\n\t\tcase \"union\":\n\t\t\tfor (const member of children.members) try {\n\t\t\t\tconst result = visit(member, value);\n\t\t\t\tif (rename) decode(member, result);\n\t\t\t\telse encode(member, result);\n\t\t\t\treturn result;\n\t\t\t} catch {}\n\t\t\treturn value;\n\t}\n};\n/** Apply creation defaults to decoded values, without accepting historical representations. */\nconst applyValueDefaults = (schema, value) => {\n\tconst rules = evolutionRules(schema);\n\tif (value === void 0 && rules.defaultJson !== void 0) return decode(schema, JSON.parse(rules.defaultJson));\n\treturn mapChildren(schema, value, applyValueDefaults, false);\n};\n/** Convert a stored JSON value to the current representation, preserving already valid values. */\nconst evolveStoredValue = (schema, value) => {\n\ttry {\n\t\tdecode(schema, value);\n\t\treturn value;\n\t} catch {}\n\tconst rules = evolutionRules(schema);\n\tif (value === void 0 && rules.defaultJson !== void 0) return JSON.parse(rules.defaultJson);\n\tlet failure;\n\ttry {\n\t\tconst next = mapChildren(schema, value, evolveStoredValue, true);\n\t\tdecode(schema, next);\n\t\treturn next;\n\t} catch (cause) {\n\t\tfailure = cause;\n\t}\n\tconst matches = [];\n\tfor (const previous of rules.previous ?? []) try {\n\t\tmatches.push({\n\t\t\tprevious,\n\t\t\tvalue: decode(previous.schema, value)\n\t\t});\n\t} catch {}\n\tif (matches.length > 1) throw new Error(\"More than one historical validator matches this value.\");\n\tconst match = matches[0];\n\tif (match === void 0) throw failure;\n\treturn encode(schema, applyValueDefaults(schema, match.previous.convert(match.value)));\n};\nconst evolveStoredFields = (schema, value) => Schema.decodeUnknownSync(Schema.JsonObject)(evolveStoredValue(schema, value));\n//#endregion\n//#region src/schema/descriptor.ts\nconst LiteralValue = Schema.Union([\n\tSchema.String,\n\tSchema.Finite,\n\tSchema.Boolean\n]);\nconst DescriptorField = Schema.Struct({\n\tname: Schema.String,\n\tvalue: Schema.suspend(() => ValueDescriptor)\n});\nconst ValueDescriptor = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"array\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"boolean\") }),\n\tSchema.Struct({ type: Schema.Literal(\"date\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"file\"),\n\t\tformats: Schema.Array(Schema.Literals([\n\t\t\t\"jpeg\",\n\t\t\t\"png\",\n\t\t\t\"webp\",\n\t\t\t\"avif\",\n\t\t\t\"gif\"\n\t\t])),\n\t\tmaxBytes: Schema.Int\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"error\"),\n\t\ttag: Schema.String,\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"id\"),\n\t\ttable: Schema.String\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"userId\") }),\n\tSchema.Struct({ type: Schema.Literal(\"integer\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"literal\"),\n\t\tvalue: LiteralValue\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"literals\"),\n\t\tvalues: Schema.Array(LiteralValue)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"never\") }),\n\tSchema.Struct({ type: Schema.Literal(\"null\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"nullable\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"number\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"object\"),\n\t\tfields: Schema.Array(DescriptorField)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"optional\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"record\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"secret\"),\n\t\tvalue: Schema.suspend(() => ValueDescriptor)\n\t}),\n\tSchema.Struct({ type: Schema.Literal(\"string\") }),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"union\"),\n\t\tmembers: Schema.Array(Schema.suspend(() => ValueDescriptor))\n\t})\n]);\nconst ValueDescriptorTypeId = Symbol.for(\"ignotum/schema/ValueDescriptor\");\nconst attachValueDescriptor = Function.dual(2, (value, descriptor) => {\n\tObject.defineProperty(value, ValueDescriptorTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: descriptor,\n\t\twritable: false\n\t});\n\treturn attachEvolution(value);\n});\nconst getValueDescriptor = (value) => {\n\tif (!Predicate.hasProperty(value, ValueDescriptorTypeId)) return void 0;\n\treturn Schema.is(ValueDescriptor)(value[ValueDescriptorTypeId]) ? value[ValueDescriptorTypeId] : void 0;\n};\nconst descriptorContainsFile = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"file\": return true;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\":\n\t\tcase \"secret\": return descriptorContainsFile(descriptor.value);\n\t\tcase \"error\":\n\t\tcase \"object\": return descriptor.fields.some((field) => descriptorContainsFile(field.value));\n\t\tcase \"union\": return descriptor.members.some(descriptorContainsFile);\n\t\tdefault: return false;\n\t}\n};\nconst descriptorContainsSecret = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"secret\": return true;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\": return descriptorContainsSecret(descriptor.value);\n\t\tcase \"error\":\n\t\tcase \"object\": return descriptor.fields.some((field) => descriptorContainsSecret(field.value));\n\t\tcase \"union\": return descriptor.members.some(descriptorContainsSecret);\n\t\tdefault: return false;\n\t}\n};\nconst descriptorAllowedInEnvironment = (descriptor) => {\n\tswitch (descriptor.type) {\n\t\tcase \"error\":\n\t\tcase \"file\":\n\t\tcase \"userId\":\n\t\tcase \"id\": return false;\n\t\tcase \"array\":\n\t\tcase \"nullable\":\n\t\tcase \"optional\":\n\t\tcase \"record\":\n\t\tcase \"secret\": return descriptorAllowedInEnvironment(descriptor.value);\n\t\tcase \"object\": return descriptor.fields.every((field) => descriptorAllowedInEnvironment(field.value));\n\t\tcase \"union\": return descriptor.members.every(descriptorAllowedInEnvironment);\n\t\tdefault: return true;\n\t}\n};\nconst descriptorFields = (fields) => {\n\tconst entries = [];\n\tfor (const name of Reflect.ownKeys(fields)) {\n\t\tif (!Predicate.isString(name)) throw new Error(\"Ignotum value objects only support string field names.\");\n\t\tconst field = fields[name];\n\t\tconst value = field === void 0 ? void 0 : getValueDescriptor(field);\n\t\tif (value === void 0) throw new Error(`The field '${name}' must use an Ignotum values validator.`);\n\t\tentries.push({\n\t\t\tname,\n\t\t\tvalue\n\t\t});\n\t}\n\treturn entries.sort((left, right) => left.name.localeCompare(right.name));\n};\n//#endregion\nexport { descriptorContainsFile as a, getValueDescriptor as c, evolveStoredValue as d, validateFieldRenames as f, descriptorAllowedInEnvironment as i, applyValueDefaults as l, ValueDescriptorTypeId as n, descriptorContainsSecret as o, withValueChildren as p, attachValueDescriptor as r, descriptorFields as s, ValueDescriptor as t, evolveStoredFields as u };\n\n//# sourceMappingURL=descriptor-DCCz5AHd.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,CAAC,KAAK,OAAO,MAAM,oCAAoC,CAAC;AACjC,OAAO,OAAO;CACvC,QAAQ,OAAO,OAAO,gBAAgB;CACtC,UAAU;AACX,CAAC;AACD,MAAM,gBAAgB,OAAO,OAAO;CACnC,MAAM,OAAO,QAAQ,OAAO;CAC5B,WAAW,OAAO;CAClB,IAAI,OAAO;AACZ,CAAC;AACD,MAAM,gBAAgB,OAAO,OAAO;CACnC,MAAM,OAA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,UAAU,OAAO,+BAA+B,WAAW,KAAK;EACrE,KAAK,UAAU,OAAO,WAAW,OAAO,OAAO,UAAU,+BAA+B,MAAM,KAAK,CAAC;EACpG,KAAK,SAAS,OAAO,WAAW,QAAQ,MAAM,8BAA8B;EAC5E,SAAS,OAAO;CACjB;AACD;AACA,MAAM,oBAAoB,WAAW;CACpC,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,QAAQ,QAAQ,QAAQ,MAAM,GAAG;EAC3C,IAAI,CAAC,UAAU,SAAS,IAAI,GAAG,MAAM,IAAI,MAAM,wDAAwD;EACvG,MAAM,QAAQ,OAAO;EACrB,MAAM,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,mBAAmB,KAAK;EAClE,IAAI,UAAU,KAAK,GAAG,MAAM,IAAI,MAAM,cAAc,KAAK,wCAAwC;EACjG,QAAQ,KAAK;GACZ;GACA;EACD,CAAC;CACF;CACA,OAAO,QAAQ,MAAM,MAAM,UAAU,KAAK,KAAK,cAAc,MAAM,IAAI,CAAC;AACzE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"id-Bt9XWRGL.js","names":["Result"],"sources":["../../../contracts/dist/runtime/id.js","../../../contracts/dist/schema/file.js","../../../contracts/dist/runtime/value.js","../../../contracts/dist/runtime/result.js","../../../contracts/dist/versioned.js","../../../contracts/dist/id.js"],"sourcesContent":["import { Schema } from \"effect\";\n//#region src/runtime/id.ts\nconst IdAlphabet = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nconst IdLength = 24;\nconst IdPrefix = Schema.String.check(Schema.isPattern(/^[a-z]+$/));\nconst IdPayloadPattern = /^[0-9a-z]{24}$/;\nconst withPrefix = (definition, idPrefix) => Object.assign(definition, { idPrefix });\nconst defineId = (prefix, brand) => {\n\tconst idPrefix = Schema.decodeSync(IdPrefix)(prefix);\n\treturn withPrefix(Schema.String.check(Schema.isPattern(new RegExp(`^${idPrefix}_[0-9a-z]{24}$`))).pipe(Schema.brand(brand)), idPrefix);\n};\nconst GeneratedId = withPrefix(Schema.String.check(Schema.isPattern(IdPayloadPattern)).pipe(Schema.brand(\"ignotum/id\")), void 0);\nconst AppId = defineId(\"app\", \"ignotum/hosted/AppId\");\nconst DeploymentId = defineId(\"dep\", \"ignotum/hosted/DeploymentId\");\nconst TeamId = defineId(\"team\", \"ignotum/hosted/TeamId\");\nconst TableId = defineId(\"table\", \"ignotum/runtime/TableId\");\nconst PlatformPrincipalId = defineId(\"prn\", \"ignotum/control/PlatformPrincipalId\");\nconst AuthSessionId = defineId(\"ses\", \"ignotum/auth/SessionId\");\nconst AuthAccountId = defineId(\"acct\", \"ignotum/auth/AccountId\");\nconst AuthVerificationId = defineId(\"ver\", \"ignotum/auth/VerificationId\");\nconst AuthMemberId = defineId(\"mbr\", \"ignotum/auth/MemberId\");\nconst AuthInvitationId = defineId(\"invt\", \"ignotum/auth/InvitationId\");\nconst AuthDeviceCodeId = defineId(\"dvc\", \"ignotum/auth/DeviceCodeId\");\nconst AuthInternalId = defineId(\"auth\", \"ignotum/auth/InternalId\");\nconst InvocationId = defineId(\"inv\", \"ignotum/sync/InvocationId\");\nconst SubscriptionId = defineId(\"sub\", \"ignotum/sync/SubscriptionId\");\nconst ConnectionId = defineId(\"conn\", \"ignotum/gateway/ConnectionId\");\nconst RuntimeRequestNonce = defineId(\"nonce\", \"ignotum/runtime/RequestNonce\");\nconst RequestId = defineId(\"req\", \"ignotum/runtime/RequestId\");\nconst DevDatabaseLockId = defineId(\"lock\", \"ignotum/dev/DatabaseLockId\");\nconst IdUserId = defineId(\"iid\", \"ignotum/id/AppUserId\");\nconst IdGlobalUserId = defineId(\"idu\", \"ignotum/id/GlobalUserId\");\nconst IdSessionId = defineId(\"ids\", \"ignotum/id/SessionId\");\nconst IdRequestId = defineId(\"idr\", \"ignotum/id/RequestId\");\nconst SessionEpoch = defineId(\"epoch\", \"ignotum/id/SessionEpoch\");\n//#endregion\nexport { AppId, AuthAccountId, AuthDeviceCodeId, AuthInternalId, AuthInvitationId, AuthMemberId, AuthSessionId, AuthVerificationId, ConnectionId, DeploymentId, DevDatabaseLockId, GeneratedId, IdAlphabet, IdGlobalUserId, IdLength, IdRequestId, IdSessionId, IdUserId, InvocationId, PlatformPrincipalId, RequestId, RuntimeRequestNonce, SessionEpoch, SubscriptionId, TableId, TeamId, defineId };\n\n//# sourceMappingURL=id.js.map","import { defineId } from \"../runtime/id.js\";\nimport { Predicate, Schema, SchemaGetter } from \"effect\";\n//#region src/schema/file.ts\nconst fileFormats = [\n\t\"jpeg\",\n\t\"png\",\n\t\"webp\",\n\t\"avif\",\n\t\"gif\"\n];\nconst FileFormat = Schema.Literals(fileFormats);\nconst fileMimeTypes = {\n\tavif: \"image/avif\",\n\tgif: \"image/gif\",\n\tjpeg: \"image/jpeg\",\n\tpng: \"image/png\",\n\twebp: \"image/webp\"\n};\nconst fileLimits = {\n\tactiveGrantsPerConnection: 1024,\n\tdistinctFilesPerQuerySnapshot: 256,\n\tfileBytes: 10485760,\n\tfilesPerMutation: 8,\n\tfilenameBytes: 255,\n\tmutationBytes: 26214400,\n\tpreparationLifetimeMillis: 9e5,\n\tstagedBytesPerApp: 104857600\n};\nconst FileId = Object.assign(Schema.String.pipe(Schema.check(Schema.isPattern(/^file_[0-9A-Za-z_-]{20,128}$/)), Schema.brand(\"ignotum/file/FileId\")), { idPrefix: \"file\" });\nconst FileUploadToken = defineId(\"upload\", \"ignotum/file/FileUploadToken\");\nconst FileGrantToken = defineId(\"grant\", \"ignotum/file/FileGrantToken\");\nconst FileValueTypeId = Symbol.for(\"ignotum/file/FileValue\");\nconst FileGrantTypeId = Symbol.for(\"ignotum/file/FileGrant\");\nconst isFileValue = (value) => Predicate.isObject(value) && Predicate.hasProperty(value, FileValueTypeId) && Predicate.isObject(value[FileValueTypeId]) && Predicate.hasProperty(value[FileValueTypeId], \"id\") && Schema.is(FileId)(value[FileValueTypeId].id) && Predicate.hasProperty(value, \"format\") && Schema.is(FileFormat)(value.format) && Predicate.hasProperty(value, \"name\") && Predicate.isString(value.name) && Predicate.hasProperty(value, \"size\") && Predicate.isNumber(value.size) && Predicate.hasProperty(value, \"mimeType\") && value.mimeType === fileMimeTypes[value.format];\nconst buildFileValue = (id, metadata, grantUrl) => {\n\tconst value = {\n\t\tformat: metadata.format,\n\t\tmimeType: fileMimeTypes[metadata.format],\n\t\tname: metadata.name,\n\t\tsize: metadata.size\n\t};\n\tObject.defineProperty(value, FileValueTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: Object.freeze({ id }),\n\t\twritable: false\n\t});\n\tif (grantUrl !== void 0) Object.defineProperty(value, FileGrantTypeId, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: grantUrl,\n\t\twritable: false\n\t});\n\treturn Object.freeze(value);\n};\nconst makeFileValue = (id, metadata) => buildFileValue(id, metadata);\nconst fileIdOf = (value) => value[FileValueTypeId].id;\nconst grantFileValue = (value, url) => {\n\treturn buildFileValue(fileIdOf(value), value, url);\n};\nconst fileGrantUrlOf = (value) => value[FileGrantTypeId];\nconst EncodedFileValue = Schema.Struct({\n\t$ignotum: Schema.Literal(\"file\"),\n\tid: FileId,\n\tformat: FileFormat,\n\tname: Schema.String,\n\tsize: Schema.Int.check(Schema.isBetween({\n\t\tminimum: 0,\n\t\tmaximum: fileLimits.fileBytes\n\t}))\n});\nconst RuntimeFileMetadata = Schema.Struct({\n\tid: FileId,\n\tformat: FileFormat,\n\tname: Schema.String,\n\tsize: Schema.Int.check(Schema.isBetween({\n\t\tminimum: 0,\n\t\tmaximum: fileLimits.fileBytes\n\t}))\n});\nconst FilePath = Schema.Array(Schema.Union([Schema.String, Schema.Natural]));\nconst RuntimeFileOccurrence = Schema.Struct({\n\tpath: FilePath,\n\tfile: RuntimeFileMetadata\n});\nconst DecodedFileValue = Schema.declare(isFileValue, { title: \"FileValue\" });\nconst FileValue = EncodedFileValue.pipe(Schema.decodeTo(DecodedFileValue, {\n\tdecode: SchemaGetter.transform((encoded) => makeFileValue(encoded.id, {\n\t\tformat: encoded.format,\n\t\tname: encoded.name,\n\t\tsize: encoded.size\n\t})),\n\tencode: SchemaGetter.transform((value) => ({\n\t\t$ignotum: \"file\",\n\t\tformat: value.format,\n\t\tid: fileIdOf(value),\n\t\tname: value.name,\n\t\tsize: value.size\n\t}))\n}));\nconst constrainedFileValue = (formats, maxBytes) => FileValue.pipe(Schema.check(Schema.makeFilter((value) => {\n\tconst issues = [];\n\tif (!formats.includes(value.format)) issues.push({\n\t\tpath: [\"format\"],\n\t\tissue: `File format '${value.format}' is not allowed by this field.`\n\t});\n\tif (value.size > maxBytes) issues.push({\n\t\tpath: [\"size\"],\n\t\tissue: `File size ${value.size} exceeds this field's ${maxBytes} byte limit.`\n\t});\n\treturn issues;\n})));\nconst collectFileOccurrences = (value, path, occurrences) => {\n\tif (isFileValue(value)) {\n\t\toccurrences.push({\n\t\t\tfile: value,\n\t\t\tpath\n\t\t});\n\t\treturn;\n\t}\n\tif (globalThis.Array.isArray(value)) {\n\t\tfor (const [index, child] of value.entries()) collectFileOccurrences(child, [...path, index], occurrences);\n\t\treturn;\n\t}\n\tif (!Predicate.isObject(value) || Predicate.isDate(value)) return;\n\tfor (const [key, child] of Object.entries(value)) collectFileOccurrences(child, [...path, key], occurrences);\n};\nconst fileOccurrencesOf = (value) => {\n\tconst occurrences = [];\n\tcollectFileOccurrences(value, [], occurrences);\n\treturn occurrences;\n};\nconst runtimeFileOccurrencesOf = (value) => fileOccurrencesOf(value).map(({ file, path }) => ({\n\tpath,\n\tfile: {\n\t\tformat: file.format,\n\t\tid: fileIdOf(file),\n\t\tname: file.name,\n\t\tsize: file.size\n\t}\n}));\nconst collectEncodedFileOccurrences = (value, path, occurrences) => {\n\tif (Schema.is(EncodedFileValue)(value)) {\n\t\tconst file = Schema.decodeUnknownSync(EncodedFileValue)(value);\n\t\toccurrences.push({\n\t\t\tpath,\n\t\t\tfile: {\n\t\t\t\tformat: file.format,\n\t\t\t\tid: file.id,\n\t\t\t\tname: file.name,\n\t\t\t\tsize: file.size\n\t\t\t}\n\t\t});\n\t\treturn;\n\t}\n\tif (globalThis.Array.isArray(value)) {\n\t\tfor (const [index, child] of value.entries()) collectEncodedFileOccurrences(child, [...path, index], occurrences);\n\t\treturn;\n\t}\n\tif (!Schema.is(Schema.JsonObject)(value)) return;\n\tfor (const [key, child] of Object.entries(value)) collectEncodedFileOccurrences(child, [...path, key], occurrences);\n};\nconst encodedFileOccurrencesOf = (value) => {\n\tconst occurrences = [];\n\tcollectEncodedFileOccurrences(value, [], occurrences);\n\treturn occurrences;\n};\n//#endregion\nexport { EncodedFileValue, FileFormat, FileGrantToken, FileGrantTypeId, FileId, FilePath, FileUploadToken, FileValue, FileValueTypeId, RuntimeFileMetadata, RuntimeFileOccurrence, constrainedFileValue, encodedFileOccurrencesOf, fileFormats, fileGrantUrlOf, fileIdOf, fileLimits, fileMimeTypes, fileOccurrencesOf, grantFileValue, isFileValue, makeFileValue, runtimeFileOccurrencesOf };\n\n//# sourceMappingURL=file.js.map","import { EncodedFileValue, FileValue, isFileValue } from \"../schema/file.js\";\nimport { Predicate, Schema } from \"effect\";\n//#region src/runtime/value.ts\nconst TransportValueSchema = Schema.suspend(() => Schema.Union([\n\tSchema.Null,\n\tSchema.Boolean,\n\tSchema.Finite,\n\tSchema.String,\n\tSchema.Date,\n\tFileValue,\n\tSchema.Array(TransportValueSchema),\n\tSchema.Record(Schema.String, Schema.UndefinedOr(TransportValueSchema))\n]));\nconst TransportValueTypeSchema = Schema.toType(TransportValueSchema);\nconst TransportObjectTypeSchema = Schema.Record(Schema.String, Schema.UndefinedOr(TransportValueTypeSchema));\nconst encodeTransportValue = (value) => {\n\tif (Predicate.isDate(value)) return Schema.encodeSync(Schema.DateFromMillis)(value);\n\tif (isFileValue(value)) return Schema.encodeSync(FileValue)(value);\n\tif (globalThis.Array.isArray(value)) return value.map(encodeTransportValue);\n\tif (Predicate.isNumber(value)) return Schema.decodeSync(Schema.Finite)(value);\n\tif (Predicate.isNull(value) || Predicate.isString(value) || Predicate.isBoolean(value)) return value;\n\treturn Object.fromEntries(Object.entries(value).flatMap(([key, child]) => child === void 0 ? [] : [[key, encodeTransportValue(child)]]));\n};\nconst encodeTransportObject = (value) => Schema.decodeUnknownSync(Schema.JsonObject)(encodeTransportValue(Schema.decodeUnknownSync(TransportObjectTypeSchema)(value)));\nconst collectDatePaths = (value, path, paths) => {\n\tif (Predicate.isDate(value)) {\n\t\tSchema.decodeSync(Schema.Date)(value);\n\t\tpaths.push(path);\n\t\treturn;\n\t}\n\tif (isFileValue(value)) return;\n\tif (globalThis.Array.isArray(value)) {\n\t\tfor (const [index, child] of value.entries()) collectDatePaths(child, [...path, index], paths);\n\t\treturn;\n\t}\n\tif (value === void 0 || Predicate.isNull(value) || Predicate.isString(value) || Predicate.isNumber(value) || Predicate.isBoolean(value)) return;\n\tfor (const [key, child] of Object.entries(value)) collectDatePaths(child, [...path, key], paths);\n};\nconst datePathsOf = (value) => {\n\tconst paths = [];\n\tcollectDatePaths(value, [], paths);\n\treturn paths;\n};\nconst datePathsOfObject = (value) => datePathsOf(Schema.decodeUnknownSync(TransportObjectTypeSchema)(value));\nconst pathKey = (path) => JSON.stringify(path);\nconst decodeTransportValueAt = (value, path, encodedDatePaths) => {\n\tif (encodedDatePaths.has(pathKey(path))) return Schema.decodeUnknownSync(Schema.DateFromMillis)(value);\n\tif (Schema.is(EncodedFileValue)(value)) return Schema.decodeSync(FileValue)(value);\n\tif (globalThis.Array.isArray(value)) return value.map((item, index) => decodeTransportValueAt(item, [...path, index], encodedDatePaths));\n\tif (Predicate.isNull(value) || Predicate.isString(value) || Predicate.isNumber(value) || Predicate.isBoolean(value)) return value;\n\treturn Object.fromEntries(Object.entries(value).map(([key, item]) => [key, decodeTransportValueAt(item, [...path, key], encodedDatePaths)]));\n};\nconst decodeTransportValue = (value, datePaths) => decodeTransportValueAt(value, [], new Set(datePaths.map(pathKey)));\nconst decodeTransportObject = (value, datePaths) => {\n\tconst encodedDatePaths = new Set(datePaths.map(pathKey));\n\treturn Object.fromEntries(Object.entries(value).map(([key, child]) => [key, decodeTransportValueAt(child, [key], encodedDatePaths)]));\n};\n//#endregion\nexport { TransportObjectTypeSchema, TransportValueSchema, TransportValueTypeSchema, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue };\n\n//# sourceMappingURL=value.js.map","import { RequestId } from \"./id.js\";\nimport { decodeTransportObject } from \"./value.js\";\nimport { Brand, Effect, Effectable, Function, Option, Predicate, Schema } from \"effect\";\n//#region src/runtime/result.ts\nconst ResultTypeId = Symbol.for(\"ignotum/runtime/result/Result\");\nconst CompletedResultTypeId = Symbol.for(\"ignotum/runtime/result/Completed\");\nconst PendingResultTypeId = Symbol.for(\"ignotum/runtime/result/Pending\");\nconst ErrorBrand = \"ignotum/error\";\nconst makeErrorValue = Brand.nominal();\nconst ErrorValueSchema = Schema.StructWithRest(Schema.Struct({ _tag: Schema.String }), [Schema.Record(Schema.String, Schema.Json)]).pipe(Schema.brand(ErrorBrand));\nvar InternalServerErrorCause = class extends Schema.TaggedError()(\"InternalServerError\", { requestId: RequestId }) {};\nconst InternalServerError = InternalServerErrorCause;\nconst InternalServerErrorSchema = InternalServerErrorCause.pipe(Schema.brand(ErrorBrand));\nconst effectOf = (value) => Predicate.hasProperty(value, ResultTypeId) ? value[ResultTypeId] : Effect.succeed(value);\nfunction makeResultEffectBase() {\n\tconst Base = function() {};\n\tBase.prototype = Effectable.Prototype({\n\t\tlabel: \"IgnotumResult\",\n\t\tevaluate() {\n\t\t\treturn this[ResultTypeId];\n\t\t}\n\t});\n\treturn Base;\n}\nconst ResultEffectBase = makeResultEffectBase();\nvar ResultOperation = class ResultOperation extends ResultEffectBase {\n\t[ResultTypeId];\n\tconstructor(effect, completed) {\n\t\tsuper();\n\t\tthis[ResultTypeId] = effect;\n\t\tif (completed !== void 0) Object.defineProperty(this, CompletedResultTypeId, { value: completed });\n\t}\n\tcatch(cases) {\n\t\tconst effectCases = {};\n\t\tfor (const [tag, handler] of Object.entries(cases)) if (Predicate.isFunction(handler)) effectCases[tag] = (failure) => effectOf(handler(failure));\n\t\tconst runtimeEffect = this[ResultTypeId];\n\t\tconst caught = Effect.catchTags(runtimeEffect, effectCases);\n\t\treturn new ResultOperation(caught);\n\t}\n};\nvar PendingQueryResult = class {\n\t[PendingResultTypeId] = PendingResultTypeId;\n};\nconst inspectResult = (value) => {\n\tif (!Predicate.hasProperty(value, CompletedResultTypeId)) return void 0;\n\treturn value[CompletedResultTypeId];\n};\nconst effectFromResult = (result) => result[ResultTypeId];\nconst resultFromEffect = (effect) => new ResultOperation(effect);\nconst isFailureResult = (result) => Predicate.hasProperty(result, CompletedResultTypeId) && Predicate.isObject(result[CompletedResultTypeId]) && Predicate.hasProperty(result[CompletedResultTypeId], \"type\") && result[CompletedResultTypeId].type === \"Failure\";\nconst succeed = (value) => new ResultOperation(Effect.succeed(value), {\n\ttype: \"Success\",\n\tvalue\n});\nconst fail = (error) => new ResultOperation(Effect.fail(error), {\n\ttype: \"Failure\",\n\terror\n});\nconst tryResult = (body) => {\n\treturn new ResultOperation(Effect.gen(body));\n};\nconst match = Function.dual(2, (result, matchers) => {\n\tif (result instanceof PendingQueryResult) {\n\t\tif (matchers.pending === void 0) throw new Error(\"A pending Result requires a pending matcher.\");\n\t\treturn matchers.pending();\n\t}\n\tif (!Predicate.hasProperty(result, ResultTypeId)) throw new Error(\"Unknown Result implementation.\");\n\tconst inspected = inspectResult(result);\n\tif (inspected?.type === \"Success\") {\n\t\tconst value = inspected.value;\n\t\treturn matchers.value(value);\n\t}\n\tif (!isFailureResult(result)) throw new Error(\"Unknown or incomplete Result operation.\");\n\tconst error = result[CompletedResultTypeId].error;\n\tif (error._tag === \"InternalServerError\") {\n\t\tconst internalError = Schema.decodeUnknownSync(InternalServerErrorSchema)(error);\n\t\tconst handler = matchers.internalError;\n\t\tif (handler === void 0) throw internalError;\n\t\treturn handler(internalError);\n\t}\n\tconst errorMatcher = matchers.error;\n\tif (errorMatcher === void 0) throw new Error(`No matcher was provided for ${error._tag}.`);\n\tif (Predicate.isFunction(errorMatcher)) return errorMatcher(error);\n\tconst handlers = errorMatcher;\n\tconst handler = Object.hasOwn(handlers, error._tag) ? handlers[error._tag] : void 0;\n\tif (handler === void 0) throw new Error(`No matcher was provided for ${error._tag}.`);\n\treturn handler(error);\n});\nconst pending = () => new PendingQueryResult();\nconst failureFromWire = (error, datePaths = []) => {\n\tconst internalError = Schema.decodeUnknownOption(InternalServerErrorSchema)(error);\n\tif (Option.isSome(internalError)) return fail(internalError.value);\n\tconst decoded = Schema.decodeUnknownOption(ErrorValueSchema)(error);\n\tif (Option.isNone(decoded)) throw new Error(\"The server returned an invalid application error.\");\n\tconst restored = decodeTransportObject(decoded.value, datePaths);\n\treturn fail(makeErrorValue({\n\t\t...restored,\n\t\t_tag: decoded.value._tag\n\t}));\n};\nconst documentNotFound = (table, id) => Brand.nominal()({\n\t_tag: \"DocumentNotFound\",\n\ttable,\n\tid\n});\nconst Result = {\n\tfail,\n\tmatch,\n\tsucceed,\n\ttry: tryResult\n};\n//#endregion\nexport { ErrorBrand, ErrorValueSchema, InternalServerError, InternalServerErrorSchema, Result, documentNotFound, effectFromResult, failureFromWire, inspectResult, match, pending, resultFromEffect };\n\n//# sourceMappingURL=result.js.map","import { Schema, SchemaGetter } from \"effect\";\n//#region src/versioned.ts\n/** Registers the first revision of a long-lived format. */\nconst initial = (schema) => schema;\n/** Adds one adjacent migration and keeps encoding on the new current revision. */\nconst upgrade = (previous, current, migrate) => {\n\tconst accepted = Schema.Union([previous, current]);\n\tconst isCurrent = Schema.is(current);\n\treturn accepted.pipe(Schema.decodeTo(Schema.toType(current), {\n\t\tdecode: SchemaGetter.transform((value) => {\n\t\t\tif (isCurrent(value)) return value;\n\t\t\treturn migrate(value);\n\t\t}),\n\t\tencode: SchemaGetter.transform((value) => value)\n\t}));\n};\n//#endregion\nexport { initial, upgrade };\n\n//# sourceMappingURL=versioned.js.map","import { initial } from \"./versioned.js\";\nimport { encodeCanonicalJson } from \"./json.js\";\nimport { ErrorBrand, resultFromEffect } from \"./runtime/result.js\";\nimport { Effect, Schema } from \"effect\";\n//#region src/id.ts\nconst DevelopmentUsername = Schema.String.check(Schema.isPattern(/^[a-z][a-z0-9_-]{0,63}$/));\nconst UserId = DevelopmentUsername.pipe(Schema.brand(\"ignotum/id/UserId\"));\nconst User = Schema.Struct({\n\tid: UserId,\n\tname: Schema.optional(Schema.String),\n\temail: Schema.optional(Schema.String),\n\timage: Schema.optional(Schema.String)\n});\nconst ProfileField = Schema.Literals([\n\t\"name\",\n\t\"email\",\n\t\"image\"\n]);\nconst ProfileFields = Schema.Array(ProfileField).check(Schema.isUnique());\nconst IdRequired = Schema.TaggedStruct(\"IdRequired\", {}).pipe(Schema.brand(ErrorBrand));\nconst makeIdContext = (read) => ({\n\tcurrent: () => resultFromEffect(read),\n\trequire: () => resultFromEffect(read.pipe(Effect.flatMap((user) => user === null ? Effect.fail(IdRequired.make({})) : Effect.succeed(user))))\n});\nconst SessionState = Schema.Struct({\n\tsessionEpoch: Schema.String,\n\tviewRevision: Schema.Natural,\n\tuser: Schema.NullOr(User),\n\tvalidUntil: Schema.Finite\n});\nconst SessionResponse = Schema.Struct({\n\tdevelopment: Schema.optional(Schema.Literal(true)),\n\toutcome: Schema.optional(Schema.Literals([\n\t\t\"SignedIn\",\n\t\t\"ProfileUpdated\",\n\t\t\"Cancelled\"\n\t])),\n\t...SessionState.fields,\n\tserverTime: Schema.Finite,\n\texpiresAt: Schema.Finite\n});\nconst ReturnPath = Schema.String.check(Schema.makeFilter((value) => {\n\tif (!value.startsWith(\"/\") || value.startsWith(\"//\") || value.includes(\"\\\\\")) return false;\n\tconst url = new URL(value, \"https://app.ignotum.invalid\");\n\treturn url.origin === \"https://app.ignotum.invalid\" && url.pathname !== \"/_ignotum\" && !url.pathname.startsWith(\"/_ignotum/\");\n}, { message: \"Return to a path within this app.\" }));\nconst SessionRequest = Schema.Struct({\n\tintent: Schema.Literals([\"signIn\", \"requestProfile\"]),\n\tprofile: ProfileFields,\n\treturnTo: ReturnPath,\n\tsessionEpoch: Schema.String\n});\nconst SessionRedirect = Schema.Struct({\n\tredirectUrl: Schema.String,\n\texpiresAt: Schema.Finite\n});\nconst SessionOutcome = Schema.Literals([\n\t\"SignedIn\",\n\t\"ProfileUpdated\",\n\t\"Cancelled\"\n]);\nconst idLimits = {\n\tsessionMillis: 2592e6,\n\tleaseMillis: 3e4,\n\trefreshMillis: 2e4,\n\trequestMillis: 6e5,\n\tcodeMillis: 6e4,\n\trequestBytes: 16384,\n\tpendingRequests: 5\n};\nconst sessionPath = \"/_ignotum/v1/session\";\nconst sessionRequestsPath = `${sessionPath}/requests`;\nconst sessionCallbackPath = `${sessionPath}/callback`;\nconst sessionCookieName = \"__Host-ignotum-session\";\nconst idImagePath = \"/_ignotum/v1/id/image/\";\nconst idViewKey = (session) => encodeCanonicalJson([session.user, session.viewRevision]);\nconst DevelopmentSelectionV1 = Schema.Struct({\n\tformatVersion: Schema.Literal(1),\n\tusername: Schema.NullOr(DevelopmentUsername),\n\tepoch: Schema.String\n});\nconst DevelopmentSelection = initial(DevelopmentSelectionV1);\nconst developmentSelectionKey = \"ignotum.id.development\";\n//#endregion\nexport { DevelopmentSelection, DevelopmentUsername, IdRequired, ProfileField, ProfileFields, ReturnPath, SessionOutcome, SessionRedirect, SessionRequest, SessionResponse, SessionState, User, UserId, developmentSelectionKey, idImagePath, idLimits, idViewKey, makeIdContext, sessionCallbackPath, sessionCookieName, sessionPath, sessionRequestsPath };\n\n//# sourceMappingURL=id.js.map"],"mappings":";;AAEA,MAAM,aAAa;AAEnB,MAAM,WAAW,OAAO,OAAO,MAAM,OAAO,UAAU,UAAU,CAAC;AACjE,MAAM,mBAAmB;AACzB,MAAM,cAAc,YAAY,aAAa,OAAO,OAAO,YAAY,EAAE,SAAS,CAAC;AACnF,MAAM,YAAY,QAAQ,UAAU;CACnC,MAAM,WAAW,OAAO,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DGPCjgrf.js";
2
- import { Effect, Schema } from "effect";
3
- //#region ../contracts/dist/id-W_I1iiJQ.d.ts
4
- declare const UserId: Schema.brand<Schema.String, "ignotum/id/UserId">;
5
- type UserId = typeof UserId.Type;
6
- declare const User: Schema.Struct<{
7
- readonly id: Schema.brand<Schema.String, "ignotum/id/UserId">;
8
- readonly name: Schema.optional<Schema.String>;
9
- readonly email: Schema.optional<Schema.String>;
10
- readonly image: Schema.optional<Schema.String>;
11
- }>;
12
- type User = typeof User.Type;
13
- declare const ProfileField: Schema.Literals<readonly ["name", "email", "image"]>;
14
- type ProfileField = typeof ProfileField.Type;
15
- declare const IdRequired: Schema.brand<Schema.Struct<{
16
- readonly _tag: Schema.tag<"IdRequired">;
17
- }>, "ignotum/error">;
18
- type IdRequired = typeof IdRequired.Type;
19
- interface IdContext {
20
- readonly current: () => Result$1<User | null, never>;
21
- readonly require: () => Result$1<User, IdRequired>;
22
- }
23
- declare const SessionOutcome: Schema.Literals<readonly ["SignedIn", "ProfileUpdated", "Cancelled"]>;
24
- type SessionOutcome = typeof SessionOutcome.Type;
25
- //#endregion
26
- //#region ../contracts/dist/descriptor-DAHJJO3I.d.ts
27
- //#region src/schema/evolution.d.ts
28
- type Defaulted<Value extends Schema.Constraint> = Omit<Value, "~type.constructor.default"> & {
29
- readonly "~type.constructor.default": "with-default";
30
- };
31
- interface ValueEvolution<Value extends Schema.Constraint> {
32
- default(value: Value["Type"]): DescribedValue<Defaulted<Value>>;
33
- renameFrom(name: string): DescribedValue<Value>;
34
- from<Previous extends DescribedValue>(previous: Previous, convert: (value: Previous["Type"]) => Value["Type"]): DescribedValue<Value>;
35
- }
36
- //#endregion
37
- //#region src/schema/descriptor.d.ts
38
- interface DescriptorField {
39
- readonly name: string;
40
- readonly value: ValueDescriptor;
41
- }
42
- type ValueDescriptor = {
43
- readonly type: "array";
44
- readonly value: ValueDescriptor;
45
- } | {
46
- readonly type: "boolean";
47
- } | {
48
- readonly type: "date";
49
- } | {
50
- readonly type: "file";
51
- readonly formats: ReadonlyArray<"jpeg" | "png" | "webp" | "avif" | "gif">;
52
- readonly maxBytes: number;
53
- } | {
54
- readonly type: "error";
55
- readonly tag: string;
56
- readonly fields: ReadonlyArray<DescriptorField>;
57
- } | {
58
- readonly type: "id";
59
- readonly table: string;
60
- } | {
61
- readonly type: "userId";
62
- } | {
63
- readonly type: "integer";
64
- } | {
65
- readonly type: "literal";
66
- readonly value: string | number | boolean;
67
- } | {
68
- readonly type: "literals";
69
- readonly values: ReadonlyArray<string | number | boolean>;
70
- } | {
71
- readonly type: "never";
72
- } | {
73
- readonly type: "null";
74
- } | {
75
- readonly type: "nullable";
76
- readonly value: ValueDescriptor;
77
- } | {
78
- readonly type: "number";
79
- } | {
80
- readonly type: "object";
81
- readonly fields: ReadonlyArray<DescriptorField>;
82
- } | {
83
- readonly type: "optional";
84
- readonly value: ValueDescriptor;
85
- } | {
86
- readonly type: "record";
87
- readonly value: ValueDescriptor;
88
- } | {
89
- readonly type: "secret";
90
- readonly value: ValueDescriptor;
91
- } | {
92
- readonly type: "string";
93
- } | {
94
- readonly type: "union";
95
- readonly members: ReadonlyArray<ValueDescriptor>;
96
- };
97
- declare const ValueDescriptor: Schema.Codec<ValueDescriptor>;
98
- declare const ValueDescriptorTypeId: unique symbol;
99
- interface ValueDescriptorCarrier {
100
- readonly [ValueDescriptorTypeId]: ValueDescriptor;
101
- }
102
- type DescribedValue<Value extends Schema.Constraint = Schema.Constraint> = Value & ValueDescriptorCarrier & ValueEvolution<Value>;
103
- type ValueFields = {
104
- readonly [fieldName: PropertyKey]: DescribedValue;
105
- };
106
- //#endregion
107
- //#region ../contracts/dist/pagination-CpYCaRYD.d.ts
108
- //#region src/runtime/pagination.d.ts
109
- declare const PaginationCursor: Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">;
110
- type PaginationCursor = typeof PaginationCursor.Type;
111
- declare const PaginationOptions: Schema.Struct<{
112
- readonly cursor: Schema.NullOr<Schema.brand<Schema.String, "ignotum/runtime/PaginationCursor">>;
113
- readonly pageSize: Schema.brand<Schema.Int, "ignotum/runtime/PaginationPageSize">;
114
- }>;
115
- type PaginationOptions = typeof PaginationOptions.Type;
116
- interface PaginationPage<Item> {
117
- readonly items: ReadonlyArray<Item>;
118
- readonly nextCursor: PaginationCursor | null;
119
- }
120
- //#endregion
121
- export { ValueDescriptor as a, IdContext as c, User as d, UserId as f, DescriptorField as i, ProfileField as l, PaginationPage as n, ValueDescriptorCarrier as o, DescribedValue as r, ValueFields as s, PaginationOptions as t, SessionOutcome as u };
122
- //# sourceMappingURL=pagination-CpYCaRYD-C2Rpp4Cw.d.ts.map
@@ -1 +0,0 @@
1
- import "./pagination-CpYCaRYD-C2Rpp4Cw.js";
@@ -1 +0,0 @@
1
- import "./id-BzFHf3Wo-DGPCjgrf.js";