@confect/server 9.0.0-next.1 → 9.0.0-next.10
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/CHANGELOG.md +293 -4
- package/dist/ActionCtx.d.ts +4 -11
- package/dist/ActionCtx.d.ts.map +1 -1
- package/dist/ActionCtx.js +1 -1
- package/dist/ActionCtx.js.map +1 -1
- package/dist/ActionRunner.d.ts +8 -13
- package/dist/ActionRunner.d.ts.map +1 -1
- package/dist/ActionRunner.js +4 -3
- package/dist/ActionRunner.js.map +1 -1
- package/dist/Auth.d.ts +17 -23
- package/dist/Auth.d.ts.map +1 -1
- package/dist/Auth.js +5 -1
- package/dist/Auth.js.map +1 -1
- package/dist/BlobNotFoundError.d.ts +6 -12
- package/dist/BlobNotFoundError.d.ts.map +1 -1
- package/dist/BlobNotFoundError.js +1 -1
- package/dist/BlobNotFoundError.js.map +1 -1
- package/dist/ConvexConfigProvider.d.ts +2 -9
- package/dist/ConvexConfigProvider.d.ts.map +1 -1
- package/dist/ConvexConfigProvider.js +6 -1
- package/dist/ConvexConfigProvider.js.map +1 -1
- package/dist/CronJob.d.ts +12 -19
- package/dist/CronJob.d.ts.map +1 -1
- package/dist/CronJob.js +1 -1
- package/dist/CronJob.js.map +1 -1
- package/dist/CronJobs.d.ts +11 -18
- package/dist/CronJobs.d.ts.map +1 -1
- package/dist/CronJobs.js +11 -4
- package/dist/CronJobs.js.map +1 -1
- package/dist/DataModel.d.ts +24 -29
- package/dist/DataModel.d.ts.map +1 -1
- package/dist/DatabaseReader.d.ts +4323 -64
- package/dist/DatabaseReader.d.ts.map +1 -1
- package/dist/DatabaseReader.js +6 -6
- package/dist/DatabaseReader.js.map +1 -1
- package/dist/DatabaseSchema.d.ts +38 -130
- package/dist/DatabaseSchema.d.ts.map +1 -1
- package/dist/DatabaseSchema.js +20 -30
- package/dist/DatabaseSchema.js.map +1 -1
- package/dist/DatabaseWriter.d.ts +38 -42
- package/dist/DatabaseWriter.d.ts.map +1 -1
- package/dist/DatabaseWriter.js +8 -5
- package/dist/DatabaseWriter.js.map +1 -1
- package/dist/Document.d.ts +28 -37
- package/dist/Document.d.ts.map +1 -1
- package/dist/Document.js +5 -1
- package/dist/Document.js.map +1 -1
- package/dist/FunctionImpl.d.ts +30 -29
- package/dist/FunctionImpl.d.ts.map +1 -1
- package/dist/FunctionImpl.js +25 -14
- package/dist/FunctionImpl.js.map +1 -1
- package/dist/GroupImpl.d.ts +45 -41
- package/dist/GroupImpl.d.ts.map +1 -1
- package/dist/GroupImpl.js +42 -35
- package/dist/GroupImpl.js.map +1 -1
- package/dist/Handler.d.ts +34 -40
- package/dist/Handler.d.ts.map +1 -1
- package/dist/HttpApi.d.ts +21 -25
- package/dist/HttpApi.d.ts.map +1 -1
- package/dist/HttpApi.js +11 -6
- package/dist/HttpApi.js.map +1 -1
- package/dist/MutationCtx.d.ts +4 -11
- package/dist/MutationCtx.d.ts.map +1 -1
- package/dist/MutationCtx.js +1 -1
- package/dist/MutationCtx.js.map +1 -1
- package/dist/MutationRunner.d.ts +8 -13
- package/dist/MutationRunner.d.ts.map +1 -1
- package/dist/MutationRunner.js +4 -3
- package/dist/MutationRunner.js.map +1 -1
- package/dist/OrderedQuery.d.ts +16 -21
- package/dist/OrderedQuery.d.ts.map +1 -1
- package/dist/OrderedQuery.js +4 -1
- package/dist/OrderedQuery.js.map +1 -1
- package/dist/QueryCtx.d.ts +4 -11
- package/dist/QueryCtx.d.ts.map +1 -1
- package/dist/QueryCtx.js +1 -1
- package/dist/QueryCtx.js.map +1 -1
- package/dist/QueryInitializer.d.ts +34 -39
- package/dist/QueryInitializer.d.ts.map +1 -1
- package/dist/QueryInitializer.js +5 -1
- package/dist/QueryInitializer.js.map +1 -1
- package/dist/QueryRunner.d.ts +8 -13
- package/dist/QueryRunner.d.ts.map +1 -1
- package/dist/QueryRunner.js +4 -3
- package/dist/QueryRunner.js.map +1 -1
- package/dist/RegisteredConvexFunction.d.ts +1107 -60
- package/dist/RegisteredConvexFunction.d.ts.map +1 -1
- package/dist/RegisteredConvexFunction.js +14 -9
- package/dist/RegisteredConvexFunction.js.map +1 -1
- package/dist/RegisteredFunction.d.ts +48 -64
- package/dist/RegisteredFunction.d.ts.map +1 -1
- package/dist/RegisteredFunction.js +9 -5
- package/dist/RegisteredFunction.js.map +1 -1
- package/dist/RegisteredFunctions.d.ts +48 -26
- package/dist/RegisteredFunctions.d.ts.map +1 -1
- package/dist/RegisteredFunctions.js +22 -9
- package/dist/RegisteredFunctions.js.map +1 -1
- package/dist/RegisteredNodeFunction.d.ts +4 -14
- package/dist/RegisteredNodeFunction.d.ts.map +1 -1
- package/dist/RegisteredNodeFunction.js +5 -4
- package/dist/RegisteredNodeFunction.js.map +1 -1
- package/dist/RegistryItem.d.ts +17 -27
- package/dist/RegistryItem.d.ts.map +1 -1
- package/dist/RegistryItem.js +1 -1
- package/dist/RegistryItem.js.map +1 -1
- package/dist/Scheduler.d.ts +16 -20
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +10 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/SchemaToValidator.d.ts +71 -64
- package/dist/SchemaToValidator.d.ts.map +1 -1
- package/dist/SchemaToValidator.js +15 -3
- package/dist/SchemaToValidator.js.map +1 -1
- package/dist/StorageActionWriter.d.ts +21 -28
- package/dist/StorageActionWriter.d.ts.map +1 -1
- package/dist/StorageActionWriter.js +4 -1
- package/dist/StorageActionWriter.js.map +1 -1
- package/dist/StorageReader.d.ts +14 -21
- package/dist/StorageReader.d.ts.map +1 -1
- package/dist/StorageReader.js +5 -1
- package/dist/StorageReader.js.map +1 -1
- package/dist/StorageWriter.d.ts +16 -23
- package/dist/StorageWriter.d.ts.map +1 -1
- package/dist/StorageWriter.js +4 -1
- package/dist/StorageWriter.js.map +1 -1
- package/dist/Table.d.ts +204 -197
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +72 -62
- package/dist/Table.js.map +1 -1
- package/dist/TableInfo.d.ts +35 -41
- package/dist/TableInfo.d.ts.map +1 -1
- package/dist/VectorSearch.d.ts +30 -35
- package/dist/VectorSearch.d.ts.map +1 -1
- package/dist/VectorSearch.js +3 -1
- package/dist/VectorSearch.js.map +1 -1
- package/dist/index.d.ts +35 -36
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -5
- package/dist/internal/utils.d.ts +9 -11
- package/dist/internal/utils.d.ts.map +1 -1
- package/dist/internal/utils.js +3 -1
- package/dist/internal/utils.js.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.d.ts.map +1 -0
- package/dist/tsconfig.src.tsbuildinfo +1 -0
- package/package.json +50 -59
- package/src/ActionCtx.ts +1 -1
- package/src/ActionRunner.ts +2 -1
- package/src/Auth.ts +5 -1
- package/src/BlobNotFoundError.ts +1 -1
- package/src/ConvexConfigProvider.ts +6 -8
- package/src/CronJob.ts +1 -1
- package/src/CronJobs.ts +8 -10
- package/src/DatabaseReader.ts +18 -21
- package/src/DatabaseSchema.ts +38 -98
- package/src/DatabaseWriter.ts +13 -6
- package/src/Document.ts +5 -1
- package/src/FunctionImpl.ts +36 -44
- package/src/GroupImpl.ts +54 -81
- package/src/HttpApi.ts +8 -9
- package/src/MutationCtx.ts +1 -1
- package/src/MutationRunner.ts +2 -1
- package/src/OrderedQuery.ts +5 -1
- package/src/QueryCtx.ts +1 -1
- package/src/QueryInitializer.ts +15 -3
- package/src/QueryRunner.ts +2 -1
- package/src/RegisteredConvexFunction.ts +11 -7
- package/src/RegisteredFunction.ts +5 -1
- package/src/RegisteredFunctions.ts +69 -93
- package/src/RegisteredNodeFunction.ts +7 -6
- package/src/RegistryItem.ts +1 -1
- package/src/Scheduler.ts +5 -1
- package/src/SchemaToValidator.ts +14 -16
- package/src/StorageActionWriter.ts +4 -1
- package/src/StorageReader.ts +5 -1
- package/src/StorageWriter.ts +4 -1
- package/src/Table.ts +253 -132
- package/src/VectorSearch.ts +3 -1
- package/src/index.ts +0 -1
- package/src/internal/utils.ts +3 -1
- package/dist/Api.d.ts +0 -30
- package/dist/Api.d.ts.map +0 -1
- package/dist/Api.js +0 -26
- package/dist/Api.js.map +0 -1
- package/dist/GroupPath.d.ts +0 -8
- package/dist/GroupPath.d.ts.map +0 -1
- package/dist/GroupPath.js +0 -10
- package/dist/GroupPath.js.map +0 -1
- package/src/Api.ts +0 -75
- package/src/GroupPath.ts +0 -43
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { pipe } from "effect/Function";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Array from "effect/Array";
|
|
5
|
+
import * as ConfigError from "effect/ConfigError";
|
|
6
|
+
import * as ConfigProvider from "effect/ConfigProvider";
|
|
7
|
+
import * as ConfigProviderPathPatch from "effect/ConfigProviderPathPatch";
|
|
3
8
|
|
|
4
9
|
//#region src/ConvexConfigProvider.ts
|
|
5
10
|
var ConvexConfigProvider_exports = /* @__PURE__ */ __exportAll({ make: () => make });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvexConfigProvider.js","names":[],"sources":["../src/ConvexConfigProvider.ts"],"sourcesContent":["import {\
|
|
1
|
+
{"version":3,"file":"ConvexConfigProvider.js","names":[],"sources":["../src/ConvexConfigProvider.ts"],"sourcesContent":["import { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as ConfigError from \"effect/ConfigError\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as ConfigProviderPathPatch from \"effect/ConfigProviderPathPatch\";\nimport * as Effect from \"effect/Effect\";\n\ndeclare const process: { env: Record<string, string | undefined> };\n\nexport const make = (\n options?: Partial<ConfigProvider.ConfigProvider.FromEnvConfig>,\n): ConfigProvider.ConfigProvider => {\n const pathDelim = options?.pathDelim ?? \"_\";\n const seqDelim = options?.seqDelim ?? \",\";\n\n return ConfigProvider.fromFlat(\n ConfigProvider.makeFlat({\n load: (path, primitive, split = true) => {\n const pathString = Array.join(path, pathDelim);\n const value = process.env[pathString];\n\n if (value === undefined) {\n return Effect.fail(\n ConfigError.MissingData(\n [...path],\n `Expected ${pathString} to exist in the process context`,\n ),\n );\n }\n\n const parse = (text: string) =>\n pipe(\n primitive.parse(text.trim()),\n Effect.mapError(ConfigError.prefixed([...path])),\n );\n\n if (!split) {\n return pipe(parse(value), Effect.map(Array.of));\n } else {\n return pipe(\n value.split(seqDelim),\n Effect.forEach((v) => parse(v)),\n );\n }\n },\n enumerateChildren: (path) =>\n Effect.fail(\n ConfigError.Unsupported(\n [...path],\n \"process.env is not enumerable in the Convex runtime\",\n ),\n ),\n patch: ConfigProviderPathPatch.empty,\n }),\n );\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,QACX,YACkC;CAClC,MAAM,YAAY,SAAS,aAAa;CACxC,MAAM,WAAW,SAAS,YAAY;AAEtC,QAAO,eAAe,SACpB,eAAe,SAAS;EACtB,OAAO,MAAM,WAAW,QAAQ,SAAS;GACvC,MAAM,aAAa,MAAM,KAAK,MAAM,UAAU;GAC9C,MAAM,QAAQ,QAAQ,IAAI;AAE1B,OAAI,UAAU,OACZ,QAAO,OAAO,KACZ,YAAY,YACV,CAAC,GAAG,KAAK,EACT,YAAY,WAAW,kCACxB,CACF;GAGH,MAAM,SAAS,SACb,KACE,UAAU,MAAM,KAAK,MAAM,CAAC,EAC5B,OAAO,SAAS,YAAY,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,CACjD;AAEH,OAAI,CAAC,MACH,QAAO,KAAK,MAAM,MAAM,EAAE,OAAO,IAAI,MAAM,GAAG,CAAC;OAE/C,QAAO,KACL,MAAM,MAAM,SAAS,EACrB,OAAO,SAAS,MAAM,MAAM,EAAE,CAAC,CAChC;;EAGL,oBAAoB,SAClB,OAAO,KACL,YAAY,YACV,CAAC,GAAG,KAAK,EACT,sDACD,CACF;EACH,OAAO,wBAAwB;EAChC,CAAC,CACH"}
|
package/dist/CronJob.d.ts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { Ref } from "@confect/core";
|
|
2
|
+
import type { Cron, Duration } from "effect";
|
|
3
|
+
export declare const TypeId = "@confect/server/CronJob";
|
|
4
|
+
export type TypeId = typeof TypeId;
|
|
5
|
+
export interface CronJob {
|
|
6
|
+
readonly [TypeId]: TypeId;
|
|
7
|
+
readonly identifier: string;
|
|
8
|
+
readonly schedule: Cron.Cron | Duration.Duration;
|
|
9
|
+
readonly ref: Ref.AnyMutation | Ref.AnyAction;
|
|
10
|
+
readonly args: Record<string, unknown>;
|
|
7
11
|
}
|
|
8
|
-
declare const
|
|
9
|
-
|
|
10
|
-
interface CronJob {
|
|
11
|
-
readonly [TypeId]: TypeId;
|
|
12
|
-
readonly identifier: string;
|
|
13
|
-
readonly schedule: Cron.Cron | Duration.Duration;
|
|
14
|
-
readonly ref: Ref$1.AnyMutation | Ref$1.AnyAction;
|
|
15
|
-
readonly args: Record<string, unknown>;
|
|
16
|
-
}
|
|
17
|
-
declare const isCronJob: (u: unknown) => u is CronJob;
|
|
18
|
-
declare const make: <R extends Ref$1.AnyMutation | Ref$1.AnyAction>(identifier: string, schedule: Cron.Cron | Duration.Duration, ref: R, ...args: Ref$1.OptionalArgs<R>) => CronJob;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { CronJob, CronJob_d_exports, TypeId, isCronJob, make };
|
|
12
|
+
export declare const isCronJob: (u: unknown) => u is CronJob;
|
|
13
|
+
export declare const make: <R extends Ref.AnyMutation | Ref.AnyAction>(identifier: string, schedule: Cron.Cron | Duration.Duration, ref: R, ...args: Ref.OptionalArgs<R>) => CronJob;
|
|
21
14
|
//# sourceMappingURL=CronJob.d.ts.map
|
package/dist/CronJob.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronJob.d.ts","
|
|
1
|
+
{"version":3,"file":"CronJob.d.ts","sourceRoot":"","sources":["../src/CronJob.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAG7C,eAAO,MAAM,MAAM,4BAA4B,CAAC;AAChD,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACjD,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,SAAS,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,SAAS,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,OACV,CAAC;AAmBnC,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,SAAS,EAC5D,YAAY,MAAM,EAClB,UAAU,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,QAAQ,EACvC,KAAK,CAAC,EACN,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,KAC3B,OAA8D,CAAC"}
|
package/dist/CronJob.js
CHANGED
package/dist/CronJob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronJob.js","names":[],"sources":["../src/CronJob.ts"],"sourcesContent":["import type { Ref } from \"@confect/core\";\nimport type { Cron, Duration } from \"effect\";\nimport
|
|
1
|
+
{"version":3,"file":"CronJob.js","names":[],"sources":["../src/CronJob.ts"],"sourcesContent":["import type { Ref } from \"@confect/core\";\nimport type { Cron, Duration } from \"effect\";\nimport * as Predicate from \"effect/Predicate\";\n\nexport const TypeId = \"@confect/server/CronJob\";\nexport type TypeId = typeof TypeId;\n\nexport interface CronJob {\n readonly [TypeId]: TypeId;\n\n readonly identifier: string;\n readonly schedule: Cron.Cron | Duration.Duration;\n readonly ref: Ref.AnyMutation | Ref.AnyAction;\n readonly args: Record<string, unknown>;\n}\n\nexport const isCronJob = (u: unknown): u is CronJob =>\n Predicate.hasProperty(u, TypeId);\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst makeProto = (\n identifier: string,\n schedule: Cron.Cron | Duration.Duration,\n ref: Ref.AnyMutation | Ref.AnyAction,\n args: Record<string, unknown>,\n): CronJob =>\n Object.assign(Object.create(Proto), {\n identifier,\n schedule,\n ref,\n args,\n });\n\nexport const make = <R extends Ref.AnyMutation | Ref.AnyAction>(\n identifier: string,\n schedule: Cron.Cron | Duration.Duration,\n ref: R,\n ...args: Ref.OptionalArgs<R>\n): CronJob => makeProto(identifier, schedule, ref, args[0] ?? {});\n"],"mappings":";;;;;;;;;AAIA,MAAa,SAAS;AAYtB,MAAa,aAAa,MACxB,UAAU,YAAY,GAAG,OAAO;AAElC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,aACJ,YACA,UACA,KACA,SAEA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACA;CACA;CACD,CAAC;AAEJ,MAAa,QACX,YACA,UACA,KACA,GAAG,SACS,UAAU,YAAY,UAAU,KAAK,KAAK,MAAM,EAAE,CAAC"}
|
package/dist/CronJobs.d.ts
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type Crons } from "convex/server";
|
|
2
|
+
import type * as CronJob from "./CronJob";
|
|
3
|
+
export declare const TypeId = "@confect/server/CronJobs";
|
|
4
|
+
export type TypeId = typeof TypeId;
|
|
5
|
+
export interface CronJobs {
|
|
6
|
+
readonly [TypeId]: TypeId;
|
|
7
|
+
readonly cronJobs: Record<string, CronJob.CronJob>;
|
|
8
|
+
readonly convexCronJobs: Crons;
|
|
9
|
+
add(cron: CronJob.CronJob): CronJobs;
|
|
7
10
|
}
|
|
8
|
-
declare const
|
|
9
|
-
|
|
10
|
-
interface CronJobs {
|
|
11
|
-
readonly [TypeId]: TypeId;
|
|
12
|
-
readonly cronJobs: Record<string, CronJob>;
|
|
13
|
-
readonly convexCronJobs: Crons;
|
|
14
|
-
add(cron: CronJob): CronJobs;
|
|
15
|
-
}
|
|
16
|
-
declare const isCronJobs: (u: unknown) => u is CronJobs;
|
|
17
|
-
declare const make: () => CronJobs;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { CronJobs, CronJobs_d_exports, TypeId, isCronJobs, make };
|
|
11
|
+
export declare const isCronJobs: (u: unknown) => u is CronJobs;
|
|
12
|
+
export declare const make: () => CronJobs;
|
|
20
13
|
//# sourceMappingURL=CronJobs.d.ts.map
|
package/dist/CronJobs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronJobs.d.ts","
|
|
1
|
+
{"version":3,"file":"CronJobs.d.ts","sourceRoot":"","sources":["../src/CronJobs.ts"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AASxE,OAAO,KAAK,KAAK,OAAO,MAAM,WAAW,CAAC;AAE1C,eAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC;IAE/B,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,GAAG,QAAQ,CAAC;CACtC;AAED,eAAO,MAAM,UAAU,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,QACX,CAAC;AAiDnC,eAAO,MAAM,IAAI,QAAO,QAA4C,CAAC"}
|
package/dist/CronJobs.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { Array, Cron, Duration, Match, Order, Predicate, Record, pipe } from "effect";
|
|
3
2
|
import { cronJobs } from "convex/server";
|
|
4
|
-
import {
|
|
3
|
+
import { pipe } from "effect/Function";
|
|
4
|
+
import * as Array from "effect/Array";
|
|
5
|
+
import * as Predicate from "effect/Predicate";
|
|
6
|
+
import { Ref } from "@confect/core";
|
|
7
|
+
import * as Cron from "effect/Cron";
|
|
8
|
+
import * as Duration from "effect/Duration";
|
|
9
|
+
import * as Match from "effect/Match";
|
|
10
|
+
import * as Order from "effect/Order";
|
|
11
|
+
import * as Record from "effect/Record";
|
|
5
12
|
|
|
6
13
|
//#region src/CronJobs.ts
|
|
7
14
|
var CronJobs_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -17,8 +24,8 @@ const Proto = {
|
|
|
17
24
|
[TypeId]: TypeId,
|
|
18
25
|
add(cronJob) {
|
|
19
26
|
const newConvexCrons = Object.assign(cronJobs(), { crons: { ...this.convexCronJobs.crons } });
|
|
20
|
-
const functionReference = Ref
|
|
21
|
-
const encodedArgs = Ref
|
|
27
|
+
const functionReference = Ref.getFunctionReference(cronJob.ref);
|
|
28
|
+
const encodedArgs = Ref.encodeArgsSync(cronJob.ref, cronJob.args);
|
|
22
29
|
Match.value(cronJob.schedule).pipe(Match.when(Cron.isCron, (cron) => {
|
|
23
30
|
newConvexCrons.cron(cronJob.identifier, cronToConvexCronString(cron), functionReference, encodedArgs);
|
|
24
31
|
}), Match.when(Duration.isDuration, (duration) => {
|
package/dist/CronJobs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronJobs.js","names":["makeConvexCrons"
|
|
1
|
+
{"version":3,"file":"CronJobs.js","names":["makeConvexCrons"],"sources":["../src/CronJobs.ts"],"sourcesContent":["import { Ref } from \"@confect/core\";\nimport type { CronJob as ConvexCronJob } from \"convex/server\";\nimport { cronJobs as makeConvexCrons, type Crons } from \"convex/server\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Cron from \"effect/Cron\";\nimport * as Duration from \"effect/Duration\";\nimport * as Match from \"effect/Match\";\nimport * as Order from \"effect/Order\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport type * as CronJob from \"./CronJob\";\n\nexport const TypeId = \"@confect/server/CronJobs\";\nexport type TypeId = typeof TypeId;\n\nexport interface CronJobs {\n readonly [TypeId]: TypeId;\n readonly cronJobs: Record<string, CronJob.CronJob>;\n readonly convexCronJobs: Crons;\n\n add(cron: CronJob.CronJob): CronJobs;\n}\n\nexport const isCronJobs = (u: unknown): u is CronJobs =>\n Predicate.hasProperty(u, TypeId);\n\nconst Proto = {\n [TypeId]: TypeId,\n\n add(this: CronJobs, cronJob: CronJob.CronJob) {\n const newConvexCrons = Object.assign(makeConvexCrons(), {\n crons: { ...this.convexCronJobs.crons },\n });\n\n const functionReference = Ref.getFunctionReference(cronJob.ref);\n const encodedArgs = Ref.encodeArgsSync(cronJob.ref, cronJob.args);\n\n Match.value(cronJob.schedule).pipe(\n Match.when(Cron.isCron, (cron) => {\n newConvexCrons.cron(\n cronJob.identifier,\n cronToConvexCronString(cron),\n functionReference,\n encodedArgs,\n );\n }),\n Match.when(Duration.isDuration, (duration) => {\n newConvexCrons.interval(\n cronJob.identifier,\n durationToConvexIntervalSchedule(duration),\n functionReference,\n encodedArgs,\n );\n }),\n Match.exhaustive,\n );\n\n return makeProto(\n Record.set(this.cronJobs, cronJob.identifier, cronJob),\n newConvexCrons,\n );\n },\n};\n\nconst makeProto = (\n cronJobs: Record<string, CronJob.CronJob>,\n convexCronJobs: Crons,\n): CronJobs =>\n Object.assign(Object.create(Proto), {\n cronJobs,\n convexCronJobs,\n });\n\nexport const make = (): CronJobs => makeProto({}, makeConvexCrons());\n\n/** @internal */\nexport const cronToConvexCronString = (cron: Cron.Cron): string => {\n const hasNonDefaultSeconds = cron.seconds.size !== 1 || !cron.seconds.has(0);\n if (hasNonDefaultSeconds) {\n throw new Error(\n \"Convex cron expressions do not support a seconds field. \" +\n \"The seconds field must be the default {0}. \" +\n \"Sub-minute scheduling is supported only by interval schedules defined using a Duration.\",\n );\n }\n\n return Array.join(\n [\n setToField(cron.minutes),\n setToField(cron.hours),\n setToField(cron.days),\n setToField(cron.months),\n setToField(cron.weekdays),\n ],\n \" \",\n );\n};\n\nconst setToField = (set: ReadonlySet<number>): string => {\n if (set.size === 0) return \"*\";\n return pipe(\n set,\n Array.sort(Order.number),\n Array.map((n) => n.toString()),\n Array.join(\",\"),\n );\n};\n\n/** @internal */\nexport const durationToConvexIntervalSchedule = (\n duration: Duration.Duration,\n): IntervalSchedule => {\n const millis = Duration.toMillis(duration);\n if (millis <= 0) {\n throw new Error(\"Interval must be a positive duration.\");\n }\n\n const oneHourInMillis = Duration.hours(1).pipe(Duration.toMillis);\n const hours = millis / oneHourInMillis;\n if (Number.isInteger(hours)) {\n return { type: \"interval\", hours };\n }\n\n const oneMinuteInMillis = Duration.minutes(1).pipe(Duration.toMillis);\n const minutes = millis / oneMinuteInMillis;\n if (Number.isInteger(minutes)) {\n return { type: \"interval\", minutes };\n }\n\n const oneSecondInMillis = Duration.seconds(1).pipe(Duration.toMillis);\n const seconds = millis / oneSecondInMillis;\n if (Number.isInteger(seconds)) {\n return { type: \"interval\", seconds };\n }\n\n throw new Error(\n \"Interval must be a whole number of seconds, minutes, or hours.\",\n );\n};\n\ntype IntervalSchedule = Extract<\n ConvexCronJob[\"schedule\"],\n { type: \"interval\"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KAAK,MAAM,OAAO,EACxB,MAAM,KAAK,MAAM,EAAE,UAAU,CAAC,EAC9B,MAAM,KAAK,IAAI,CAChB;;;AAIH,MAAa,oCACX,aACqB;CACrB,MAAM,SAAS,SAAS,SAAS,SAAS;AAC1C,KAAI,UAAU,EACZ,OAAM,IAAI,MAAM,wCAAwC;CAI1D,MAAM,QAAQ,SADU,SAAS,MAAM,EAAE,CAAC,KAAK,SAAS,SAAS;AAEjE,KAAI,OAAO,UAAU,MAAM,CACzB,QAAO;EAAE,MAAM;EAAY;EAAO;CAIpC,MAAM,UAAU,SADU,SAAS,QAAQ,EAAE,CAAC,KAAK,SAAS,SAAS;AAErE,KAAI,OAAO,UAAU,QAAQ,CAC3B,QAAO;EAAE,MAAM;EAAY;EAAS;CAItC,MAAM,UAAU,SADU,SAAS,QAAQ,EAAE,CAAC,KAAK,SAAS,SAAS;AAErE,KAAI,OAAO,UAAU,QAAQ,CAC3B,QAAO;EAAE,MAAM;EAAY;EAAS;AAGtC,OAAM,IAAI,MACR,iEACD"}
|
package/dist/DataModel.d.ts
CHANGED
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
2
|
+
import type * as Table from "./Table";
|
|
3
|
+
import type * as TableInfo from "./TableInfo";
|
|
4
|
+
export declare const TypeId: "@confect/server/DataModel";
|
|
5
|
+
export type TypeId = typeof TypeId;
|
|
6
|
+
export interface DataModel<Tables_ extends Table.AnyWithProps> {
|
|
7
|
+
readonly [TypeId]: TypeId;
|
|
8
|
+
readonly tables: Table.TablesRecord<Tables_>;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
interface DataModel<Tables_ extends AnyWithProps$1> {
|
|
12
|
-
readonly [TypeId]: TypeId;
|
|
13
|
-
readonly tables: TablesRecord<Tables_>;
|
|
10
|
+
export interface Any {
|
|
11
|
+
readonly [TypeId]: TypeId;
|
|
14
12
|
}
|
|
15
|
-
interface Any {
|
|
16
|
-
|
|
13
|
+
export interface AnyWithProps extends Any {
|
|
14
|
+
readonly tables: Record<string, Table.AnyWithProps>;
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type
|
|
24
|
-
type
|
|
25
|
-
type
|
|
26
|
-
type
|
|
27
|
-
type
|
|
28
|
-
type
|
|
29
|
-
type
|
|
30
|
-
type DocumentByName<DataModel_ extends AnyWithProps, TableName extends TableNames<DataModel_>> = DocumentWithName<DataModel_, TableName>;
|
|
31
|
-
//#endregion
|
|
32
|
-
export { Any, AnyWithProps, DataModel, DataModel_d_exports, DocumentByName, DocumentWithName, FromSchema, FromTables, TableInfoWithName, TableInfoWithName_, TableNames, TableWithName, Tables, ToConvex, TypeId };
|
|
16
|
+
export type FromSchema<Schema extends DatabaseSchema.AnyWithProps> = DataModel<DatabaseSchema.Tables<Schema>>;
|
|
17
|
+
export type FromTables<Tables_ extends Table.AnyWithProps> = DataModel<Tables_>;
|
|
18
|
+
export type ToConvex<DataModel_ extends AnyWithProps> = {
|
|
19
|
+
[TableName_ in TableNames<DataModel_>]: TableInfoWithName<DataModel_, TableName_>;
|
|
20
|
+
};
|
|
21
|
+
export type Tables<DataModel_ extends AnyWithProps> = DataModel_ extends DataModel<infer Tables_> ? Tables_ : never;
|
|
22
|
+
export type TableNames<DataModel_ extends AnyWithProps> = Table.Name<Tables<DataModel_>> & string;
|
|
23
|
+
export type TableWithName<DataModel_ extends AnyWithProps, TableName extends TableNames<DataModel_>> = Table.WithName<Tables<DataModel_>, TableName>;
|
|
24
|
+
export type TableInfoWithName_<DataModel_ extends AnyWithProps, TableName extends TableNames<DataModel_>> = TableInfo.TableInfo<Table.WithName<Tables<DataModel_>, TableName>>;
|
|
25
|
+
export type TableInfoWithName<DataModel_ extends AnyWithProps, TableName extends TableNames<DataModel_>> = TableInfo.ConvexTableInfo<TableInfo.TableInfo<Table.WithName<Tables<DataModel_>, TableName>>>;
|
|
26
|
+
export type DocumentWithName<DataModel_ extends AnyWithProps, TableName extends TableNames<DataModel_>> = TableInfo.Document<TableInfo.TableInfo<Table.WithName<Tables<DataModel_>, TableName>>>;
|
|
27
|
+
export type DocumentByName<DataModel_ extends AnyWithProps, TableName extends TableNames<DataModel_>> = DocumentWithName<DataModel_, TableName>;
|
|
33
28
|
//# sourceMappingURL=DataModel.d.ts.map
|
package/dist/DataModel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataModel.d.ts","
|
|
1
|
+
{"version":3,"file":"DataModel.d.ts","sourceRoot":"","sources":["../src/DataModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,OAAO,CAAC,MAAM,MAAM,EAAE,2BAA2B,CAAC;AACzD,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,MAAM,WAAW,SAAS,CAAC,OAAO,SAAS,KAAK,CAAC,YAAY;IAC3D,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,GAAG;IAClB,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,YAAa,SAAQ,GAAG;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;CACrD;AAED,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,cAAc,CAAC,YAAY,IAA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