ignotum 0.0.7 → 0.0.9
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/README.md +89 -101
- package/dist/cli/bin.mjs +1119 -195
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/runtime/{api-DtX8qPrq.js → api-DzcR7spt.js} +36 -13
- package/dist/runtime/api-DzcR7spt.js.map +1 -0
- package/dist/runtime/{api-Dp4J-xt-.d.ts → api-jCl8Hzry.d.ts} +7 -9
- package/dist/runtime/client.d.ts +12 -5
- package/dist/runtime/client.js +285 -60
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/{descriptor-t6BOEGw9-C1rwYIlx.js → descriptor-C5VA9qRl-BKbdenuU.js} +38 -7
- package/dist/runtime/descriptor-C5VA9qRl-BKbdenuU.js.map +1 -0
- package/dist/runtime/file-C1abuMgd.js +173 -0
- package/dist/runtime/file-C1abuMgd.js.map +1 -0
- package/dist/runtime/{id-Btwac71X-DhnKYsjY.d.ts → id-Cs82tq9Q-Caqfx54f.d.ts} +51 -5
- package/dist/runtime/{index-B5KSOjGN.d.ts → index-D6VLTbDB.d.ts} +40 -21
- package/dist/runtime/internal/api.d.ts +2 -2
- package/dist/runtime/internal/api.js +1 -1
- package/dist/runtime/internal/host.d.ts +8 -7
- package/dist/runtime/internal/host.js +21 -10
- 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 +1 -1
- package/dist/runtime/internal/types.js +1 -1
- package/dist/runtime/{pagination-B1BzNkh8-BUSTbeSg.d.ts → pagination-Bt3l7QaC-D_zI5zsu.d.ts} +8 -4
- package/dist/runtime/pagination-DcIkTOFs.d.ts +1 -0
- package/dist/runtime/{schema-D9RmboaS.js → schema-B6PK_ZwV.js} +17 -3
- package/dist/runtime/schema-B6PK_ZwV.js.map +1 -0
- package/dist/runtime/server.d.ts +3 -3
- package/dist/runtime/server.js +2 -2
- package/dist/runtime/server.js.map +1 -1
- package/dist/runtime/sync-bMQq9tXx.d.ts +8 -0
- package/package.json +7 -5
- package/src/cli/agent-files.ts +52 -13
- package/src/cli/app-configuration.ts +4 -1
- package/src/cli/auth-client.ts +286 -0
- package/src/cli/build/server.ts +83 -6
- package/src/cli/command.ts +65 -2
- package/src/cli/control-client.ts +19 -6
- package/src/cli/new-app.ts +16 -0
- package/src/client/errors.ts +7 -10
- package/src/client/files.ts +153 -0
- package/src/client/hooks.ts +2 -15
- package/src/client/index.ts +7 -0
- package/src/client/sync.ts +158 -30
- package/src/dev-runtime/database.ts +69 -57
- package/src/dev-runtime/files.ts +337 -0
- package/src/dev-runtime/functions.ts +14 -6
- package/src/dev-runtime/migrations.ts +14 -0
- package/src/dev-runtime/sync.ts +134 -22
- package/src/internal/api.ts +16 -1
- package/src/server/index.ts +8 -1
- package/dist/runtime/api-DtX8qPrq.js.map +0 -1
- package/dist/runtime/descriptor-t6BOEGw9-C1rwYIlx.js.map +0 -1
- package/dist/runtime/id-D570vudg.js +0 -26
- package/dist/runtime/id-D570vudg.js.map +0 -1
- package/dist/runtime/pagination-BKPko9Hm.d.ts +0 -1
- package/dist/runtime/schema-D9RmboaS.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as AppId, r as FileId, v as DeploymentId, w as SubscriptionId, x as InvocationId } from "./file-C1abuMgd.js";
|
|
2
2
|
import { Predicate, Schema } from "effect";
|
|
3
3
|
//#region ../contracts/dist/runtime/identity.js
|
|
4
4
|
const InvocationKey = Schema.String.pipe(Schema.brand("ignotum/hosted/InvocationKey"));
|
|
@@ -36,9 +36,18 @@ const Invoke = Schema.Struct({
|
|
|
36
36
|
function: FunctionAddress,
|
|
37
37
|
args: Schema.Json
|
|
38
38
|
});
|
|
39
|
+
const Prepare = Schema.Struct({
|
|
40
|
+
type: Schema.Literal("Prepare"),
|
|
41
|
+
id: InvocationId,
|
|
42
|
+
kind: Schema.Literal("Mutation"),
|
|
43
|
+
function: FunctionAddress,
|
|
44
|
+
args: Schema.Json,
|
|
45
|
+
files: Schema.Array(FileId)
|
|
46
|
+
});
|
|
39
47
|
const ClientMessage = Schema.Union([
|
|
40
48
|
Subscribe,
|
|
41
49
|
Unsubscribe,
|
|
50
|
+
Prepare,
|
|
42
51
|
Invoke
|
|
43
52
|
]);
|
|
44
53
|
const SubscriptionOperation = Schema.Struct({
|
|
@@ -73,7 +82,20 @@ const Snapshot = Schema.Struct({
|
|
|
73
82
|
type: Schema.Literal("Snapshot"),
|
|
74
83
|
id: SubscriptionId,
|
|
75
84
|
result: WireResult,
|
|
76
|
-
revision: AppStateRevision
|
|
85
|
+
revision: AppStateRevision,
|
|
86
|
+
files: Schema.optional(Schema.Array(Schema.Struct({
|
|
87
|
+
id: FileId,
|
|
88
|
+
url: Schema.String
|
|
89
|
+
})))
|
|
90
|
+
});
|
|
91
|
+
const Preparation = Schema.Struct({
|
|
92
|
+
type: Schema.Literal("Preparation"),
|
|
93
|
+
id: InvocationId,
|
|
94
|
+
kind: Schema.Literal("Mutation"),
|
|
95
|
+
uploads: Schema.Array(Schema.Struct({
|
|
96
|
+
id: FileId,
|
|
97
|
+
url: Schema.optional(Schema.String)
|
|
98
|
+
}))
|
|
77
99
|
});
|
|
78
100
|
const SyncResultSuccess = Schema.Struct({
|
|
79
101
|
type: Schema.Literal("Result"),
|
|
@@ -86,7 +108,7 @@ const SyncResultFailure = Schema.Struct({
|
|
|
86
108
|
id: InvocationId,
|
|
87
109
|
result: WireFailure
|
|
88
110
|
});
|
|
89
|
-
const
|
|
111
|
+
const ErrorCode = Schema.Literals([
|
|
90
112
|
"DuplicateOperationId",
|
|
91
113
|
"FunctionUnavailable",
|
|
92
114
|
"InvalidArguments",
|
|
@@ -96,25 +118,26 @@ const ProtocolErrorCode = Schema.Literals([
|
|
|
96
118
|
"UnknownFunction",
|
|
97
119
|
"WrongFunctionKind"
|
|
98
120
|
]);
|
|
99
|
-
const
|
|
100
|
-
type: Schema.Literal("
|
|
121
|
+
const SyncError = Schema.Struct({
|
|
122
|
+
type: Schema.Literal("Error"),
|
|
101
123
|
operation: Schema.optional(Operation),
|
|
102
|
-
code:
|
|
124
|
+
code: ErrorCode,
|
|
103
125
|
message: Schema.String
|
|
104
126
|
});
|
|
105
|
-
const
|
|
106
|
-
type: Schema.Literal("
|
|
127
|
+
const Deployment = Schema.Struct({
|
|
128
|
+
type: Schema.Literal("Deployment"),
|
|
107
129
|
deploymentId: DeploymentId,
|
|
108
130
|
generation: DeploymentGeneration
|
|
109
131
|
});
|
|
110
|
-
const
|
|
132
|
+
const DeploymentCloseCode = 4409;
|
|
111
133
|
const ServerMessage = Schema.Union([
|
|
112
134
|
SyncHandshake,
|
|
113
135
|
Snapshot,
|
|
136
|
+
Preparation,
|
|
114
137
|
SyncResultSuccess,
|
|
115
138
|
SyncResultFailure,
|
|
116
|
-
|
|
117
|
-
|
|
139
|
+
SyncError,
|
|
140
|
+
Deployment
|
|
118
141
|
]);
|
|
119
142
|
const ClientMessageJson = Schema.fromJsonString(ClientMessage);
|
|
120
143
|
const ServerMessageJson = Schema.fromJsonString(ServerMessage);
|
|
@@ -145,6 +168,6 @@ function createApi() {
|
|
|
145
168
|
} });
|
|
146
169
|
}
|
|
147
170
|
//#endregion
|
|
148
|
-
export {
|
|
171
|
+
export { ErrorCode as a, ServerMessageJson as c, WireSuccess as d, AppStateRevision as f, DeploymentCloseCode as i, WireFailure as l, InvocationKey as m, functionPathOf as n, FunctionAddress as o, DeploymentGeneration as p, ClientMessageJson as r, Operation as s, createApi as t, WireResult as u };
|
|
149
172
|
|
|
150
|
-
//# sourceMappingURL=api-
|
|
173
|
+
//# sourceMappingURL=api-DzcR7spt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-DzcR7spt.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 { AppStateRevision, DeploymentGeneration } from \"./identity.js\";\nimport { FileId } from \"../schema/file.js\";\nimport { TransportValueSchema, datePathsOf, datePathsOfObject, decodeTransportObject, decodeTransportValue, encodeTransportObject, encodeTransportValue } from \"./value.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\ttype: Schema.Literal(\"Handshake\"),\n\tappId: AppId,\n\tdeploymentId: DeploymentId,\n\tgeneration: DeploymentGeneration\n});\nconst Snapshot = Schema.Struct({\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\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\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireSuccess,\n\tcommittedRevision: AppStateRevision\n});\nconst SyncResultFailure = Schema.Struct({\n\ttype: Schema.Literal(\"Result\"),\n\tid: InvocationId,\n\tresult: WireFailure\n});\nconst ErrorCode = Schema.Literals([\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\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 ServerMessage = Schema.Union([\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, InvocationId, Operation, ServerMessage, ServerMessageJson, 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,uB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WAAW,OAAO,SAAS,SAAS;CACpC,MAAM;CACN,SAAS,OAAO;AACjB,CAAC;AACD,MAAM,aAAa,OAAO,OAAO;CAChC,MAAM,OAAO,QAAQ,YAAY;CACjC,cAAc;CACd,YAAY;AACb,CAAC;AACD,MAAM,sBAAsB;AAC5B,MAAM,gBAAgB,OAAO,MAAM;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,oBAAoB,OAAO,eAAe,aAAa;AAC7D,MAAM,oBAAoB,OAAO,eAAe,aAAa;;;AC5I7D,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,13 +1,11 @@
|
|
|
1
|
-
import { a as InternalServerError, i as ErrorValue } from "./id-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
declare const FunctionAddress: Schema.TemplateLiteral<readonly ["api.", Schema.String, ".", Schema.String]>;
|
|
5
|
-
type FunctionAddress = typeof FunctionAddress.Type;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { a as InternalServerError, g as FileValue, i as ErrorValue } from "./id-Cs82tq9Q-Caqfx54f.js";
|
|
2
|
+
import { t as FunctionAddress } from "./sync-bMQq9tXx.js";
|
|
3
|
+
import { Effect } from "effect";
|
|
7
4
|
//#region src/internal/api.d.ts
|
|
8
5
|
declare const FunctionReferenceTypeId: unique symbol;
|
|
9
6
|
declare const FunctionReferenceTypesTypeId: unique symbol;
|
|
10
7
|
type FunctionKind = "Mutation" | "Query";
|
|
8
|
+
type MutationInput<Value> = Value extends FileValue ? Value | File : Value extends Date ? Value : Value extends ReadonlyArray<infer Item> ? ReadonlyArray<MutationInput<Item>> : Value extends object ? { readonly [Key in keyof Value]: MutationInput<Value[Key]>; } : Value;
|
|
11
9
|
interface FunctionReference<Kind extends FunctionKind, Args, Success, Failure extends ErrorValue> {
|
|
12
10
|
readonly [FunctionReferenceTypeId]: FunctionAddress;
|
|
13
11
|
readonly [FunctionReferenceTypesTypeId]?: {
|
|
@@ -37,11 +35,11 @@ declare namespace FunctionReference {
|
|
|
37
35
|
type ReferenceOf<Definition> = Definition extends {
|
|
38
36
|
readonly _tag: infer Kind extends FunctionKind;
|
|
39
37
|
readonly handler: (...arguments_: infer HandlerArguments) => Generator<infer Yielded, infer Success, never>;
|
|
40
|
-
} ? HandlerArguments extends readonly [infer _Context, ...infer Rest] ? FunctionReference<Kind, Rest extends readonly [infer Args, ...ReadonlyArray<unknown>] ? Args : void, Success, (Yielded extends Effect.Effect<unknown, infer Failure extends ErrorValue, never> ? Failure : never) | InternalServerError> : never : never;
|
|
38
|
+
} ? HandlerArguments extends readonly [infer _Context, ...infer Rest] ? FunctionReference<Kind, Rest extends readonly [infer Args, ...ReadonlyArray<unknown>] ? Kind extends "Mutation" ? MutationInput<Args> : Args : void, Success, (Yielded extends Effect.Effect<unknown, infer Failure extends ErrorValue, never> ? Failure : never) | InternalServerError> : never : never;
|
|
41
39
|
type ApiModule<Module> = { readonly [FunctionName in keyof Module as FunctionName extends string ? ReferenceOf<Module[FunctionName]> extends never ? never : FunctionName : never]: ReferenceOf<Module[FunctionName]>; };
|
|
42
40
|
type Api<Modules> = { readonly [ModuleName in keyof Modules]: ApiModule<Modules[ModuleName]>; };
|
|
43
41
|
declare const functionPathOf: <Kind extends FunctionKind, Args, Success, Failure extends ErrorValue>(reference: FunctionReference<Kind, Args, Success, Failure>) => `api.${string}.${string}`;
|
|
44
42
|
declare function createApi<Modules>(): Api<Modules>;
|
|
45
43
|
//#endregion
|
|
46
|
-
export { functionPathOf as i, FunctionReference as n,
|
|
47
|
-
//# sourceMappingURL=api-
|
|
44
|
+
export { functionPathOf as a, createApi as i, FunctionReference as n, MutationInput as r, Api as t };
|
|
45
|
+
//# sourceMappingURL=api-jCl8Hzry.d.ts.map
|
package/dist/runtime/client.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { a as InternalServerError, i as ErrorValue, l as SettledResult, o as Match, s as QueryResult$1 } from "./id-
|
|
2
|
-
import
|
|
3
|
-
import { n as
|
|
4
|
-
import "./pagination-
|
|
1
|
+
import { a as InternalServerError, g as FileValue, h as FileMimeType, i as ErrorValue, l as SettledResult, m as FileMetadata, o as Match, p as FileFormat, s as QueryResult$1 } from "./id-Cs82tq9Q-Caqfx54f.js";
|
|
2
|
+
import "./sync-bMQq9tXx.js";
|
|
3
|
+
import { n as FunctionReference } from "./api-jCl8Hzry.js";
|
|
4
|
+
import { n as PaginationPage, t as PaginationOptions } from "./pagination-Bt3l7QaC-D_zI5zsu.js";
|
|
5
|
+
import "./pagination-DcIkTOFs.js";
|
|
6
|
+
import { Context as Context$1, Effect, Layer } from "effect";
|
|
5
7
|
import { Dispatch, Reducer, StateUpdater, useCallback, useContext, useDebugValue, useEffect, useErrorBoundary, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState } from "preact/hooks";
|
|
6
8
|
import { AnyComponent, Attributes, ClassAttributes, Component, ComponentChild, ComponentChildren, ComponentClass, ComponentConstructor, ComponentFactory, ComponentProps, ComponentType, ComponentType as ComponentType$1, Consumer, Context, ContextType, ErrorInfo, Fragment, FunctionComponent, FunctionalComponent, JSX, Key, PreactConsumer, PreactContext, PreactDOMAttributes, PreactProvider, Provider, Ref, RefCallback, RefObject, RenderableProps, TargetedAnimationEvent, TargetedClipboardEvent, TargetedCommandEvent, TargetedCompositionEvent, TargetedDragEvent, TargetedEvent, TargetedFocusEvent, TargetedInputEvent, TargetedKeyboardEvent, TargetedMouseEvent, TargetedPictureInPictureEvent, TargetedPointerEvent, TargetedSnapEvent, TargetedSubmitEvent, TargetedToggleEvent, TargetedTouchEvent, TargetedTransitionEvent, TargetedUIEvent, TargetedWheelEvent, VNode, cloneElement, createContext, createElement, createRef, h, isValidElement, toChildArray } from "preact";
|
|
9
|
+
//#region src/client/files.d.ts
|
|
10
|
+
declare const Files: {
|
|
11
|
+
readonly url: (file: FileValue) => string;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
7
14
|
//#region src/client/query.d.ts
|
|
8
15
|
declare const QuerySkipTypeId: unique symbol;
|
|
9
16
|
interface QuerySkip {
|
|
@@ -49,5 +56,5 @@ declare const Result: {
|
|
|
49
56
|
type Result<Value, Error extends ErrorValue> = SettledResult<Value, Error>;
|
|
50
57
|
type QueryResult<Value, Error extends ErrorValue> = QueryResult$1<Value, Error>;
|
|
51
58
|
//#endregion
|
|
52
|
-
export { type AnyComponent, type AppDefinition, type Attributes, type ClassAttributes, Component, type ComponentChild, type ComponentChildren, type ComponentClass, type ComponentConstructor, type ComponentFactory, type ComponentProps, type ComponentType, type Consumer, type Context, type ContextType, type Dispatch, type ErrorInfo, Fragment, type FunctionComponent, type FunctionalComponent, type InternalServerError, type JSX, type Key, type PaginatedQueryOptions, type PaginatedQueryValue, type PaginationStatus, type PreactConsumer, type PreactContext, type PreactDOMAttributes, type PreactProvider, type Provider, Query, QueryResult, type QuerySkip, type Reducer, type Ref, type RefCallback, type RefObject, type RenderableProps, Result, type StateUpdater, type TargetedAnimationEvent, type TargetedClipboardEvent, type TargetedCommandEvent, type TargetedCompositionEvent, type TargetedDragEvent, type TargetedEvent, type TargetedFocusEvent, type TargetedInputEvent, type TargetedKeyboardEvent, type TargetedMouseEvent, type TargetedPictureInPictureEvent, type TargetedPointerEvent, type TargetedSnapEvent, type TargetedSubmitEvent, type TargetedToggleEvent, type TargetedTouchEvent, type TargetedTransitionEvent, type TargetedUIEvent, type TargetedWheelEvent, type VNode, app, cloneElement, createContext, createElement, createRef, h, isValidElement, toChildArray, useCallback, useContext, useDebugValue, useEffect, useErrorBoundary, useId, useImperativeHandle, useLayoutEffect, useMemo, useMutation, usePaginatedQuery, useQuery, useReducer, useRef, useState };
|
|
59
|
+
export { type AnyComponent, type AppDefinition, type Attributes, type ClassAttributes, Component, type ComponentChild, type ComponentChildren, type ComponentClass, type ComponentConstructor, type ComponentFactory, type ComponentProps, type ComponentType, type Consumer, type Context, type ContextType, type Dispatch, type ErrorInfo, type FileFormat, type FileMetadata, type FileMimeType, type FileValue, Files, Fragment, type FunctionComponent, type FunctionalComponent, type InternalServerError, type JSX, type Key, type PaginatedQueryOptions, type PaginatedQueryValue, type PaginationStatus, type PreactConsumer, type PreactContext, type PreactDOMAttributes, type PreactProvider, type Provider, Query, QueryResult, type QuerySkip, type Reducer, type Ref, type RefCallback, type RefObject, type RenderableProps, Result, type StateUpdater, type TargetedAnimationEvent, type TargetedClipboardEvent, type TargetedCommandEvent, type TargetedCompositionEvent, type TargetedDragEvent, type TargetedEvent, type TargetedFocusEvent, type TargetedInputEvent, type TargetedKeyboardEvent, type TargetedMouseEvent, type TargetedPictureInPictureEvent, type TargetedPointerEvent, type TargetedSnapEvent, type TargetedSubmitEvent, type TargetedToggleEvent, type TargetedTouchEvent, type TargetedTransitionEvent, type TargetedUIEvent, type TargetedWheelEvent, type VNode, app, cloneElement, createContext, createElement, createRef, h, isValidElement, toChildArray, useCallback, useContext, useDebugValue, useEffect, useErrorBoundary, useId, useImperativeHandle, useLayoutEffect, useMemo, useMutation, usePaginatedQuery, useQuery, useReducer, useRef, useState };
|
|
53
60
|
//# sourceMappingURL=client.d.ts.map
|