@confect/core 9.2.4 → 10.0.0-next.1
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 +22 -3
- package/dist/FunctionProvenance.d.ts +30 -30
- package/dist/FunctionProvenance.d.ts.map +1 -1
- package/dist/FunctionProvenance.js +2 -1
- package/dist/FunctionProvenance.js.map +1 -1
- package/dist/FunctionSpec.d.ts +14 -14
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +2 -1
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GenericId.d.ts +2 -2
- package/dist/GenericId.d.ts.map +1 -1
- package/dist/GenericId.js +6 -4
- package/dist/GenericId.js.map +1 -1
- package/dist/GroupPath.js +2 -1
- package/dist/GroupSpec.js +2 -1
- package/dist/GroupSpec.js.map +1 -1
- package/dist/Identifier.js +4 -3
- package/dist/Identifier.js.map +1 -1
- package/dist/Lazy.js +2 -1
- package/dist/Lazy.js.map +1 -1
- package/dist/PaginationResult.d.ts +6 -10
- package/dist/PaginationResult.d.ts.map +1 -1
- package/dist/PaginationResult.js +8 -3
- package/dist/PaginationResult.js.map +1 -1
- package/dist/Ref.d.ts +5 -5
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +12 -12
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.js +3 -2
- package/dist/Refs.js.map +1 -1
- package/dist/Registry.d.ts +1 -4
- package/dist/Registry.d.ts.map +1 -1
- package/dist/Registry.js +3 -2
- package/dist/Registry.js.map +1 -1
- package/dist/RuntimeAndFunctionType.js +2 -1
- package/dist/RuntimeAndFunctionType.js.map +1 -1
- package/dist/Spec.js +2 -1
- package/dist/Spec.js.map +1 -1
- package/dist/SystemFields.d.ts +51 -10
- package/dist/SystemFields.d.ts.map +1 -1
- package/dist/SystemFields.js +81 -3
- package/dist/SystemFields.js.map +1 -1
- package/dist/Types.d.ts +1 -1
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js +2 -1
- package/dist/Types.js.map +1 -1
- package/dist/UserIdentity.d.ts +20 -54
- package/dist/UserIdentity.d.ts.map +1 -1
- package/dist/UserIdentity.js +19 -18
- package/dist/UserIdentity.js.map +1 -1
- package/dist/_virtual/_rolldown/runtime.js +11 -6
- package/dist/index.js +2 -1
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/package.json +10 -11
- package/src/FunctionProvenance.ts +12 -12
- package/src/FunctionSpec.ts +9 -9
- package/src/GenericId.ts +7 -7
- package/src/PaginationResult.ts +5 -8
- package/src/Ref.ts +21 -16
- package/src/Registry.ts +3 -3
- package/src/SystemFields.ts +255 -26
- package/src/Types.ts +1 -5
- package/src/UserIdentity.ts +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
# @confect/core
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 10.0.0-next.1
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4d98ea8: Raise the required `effect` peer version to `^4.0.0-beta.98` (from `^4.0.0-beta.97`).
|
|
8
|
+
|
|
9
|
+
`effect`'s `SchemaError` is now exposed as its own public module (`effect/SchemaError`), which changes the import path TypeScript picks when Confect emits `.d.ts` declarations that reference `Schema.SchemaError` (for example in generated `services.d.ts`). Existing `Schema.SchemaError` / `Schema.isSchemaError` usage is unaffected — this is purely a declaration-emit detail that consumers relying on generated types may notice.
|
|
10
|
+
|
|
11
|
+
## 10.0.0-next.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
- 70e313e: Migrate to Effect v4. All `@confect/*` packages now require `effect@^4.0.0-beta.97`; `@effect/platform` and `@effect/cli` are no longer dependencies (their functionality moved into `effect` core and `effect/unstable/*`).
|
|
16
|
+
|
|
17
|
+
Breaking changes for users:
|
|
18
|
+
- **Schemas** follow Effect v4's Schema API: `Schema.Union([a, b])` (array form), `Schema.Literals([...])` for literal unions, `Schema.optionalKey` in place of `optionalWith({ exact: true })`, `Schema.TaggedErrorClass` in place of `Schema.TaggedError`, and checks like `Schema.String.check(Schema.isMaxLength(...))` in place of piped filters.
|
|
19
|
+
- **Option-returning functions** must use a codec with a serializable encoded form, such as `Schema.OptionFromNullOr(...)` — v4's `Schema.Option` encodes to an `Option` instance, which is not a Convex value.
|
|
20
|
+
- **Table schemas** may now be transformations (`Schema.decodeTo` chains, `Schema.encodeKeys`), branded structs, suspended schemas, or unions of these — Convex's system fields are carried through the whole encoding chain. Schemas that do not resolve to an object shape at every step (such as `Schema.Class`) are rejected with a descriptive error when the table is defined.
|
|
21
|
+
- **Clients**: decode failures surface as `SchemaError` rather than `ParseError` in `@confect/js` and `@confect/react`, and `@confect/react`'s `useMutation`/`useAction` handles with an `error` schema now resolve to `Result` (v4's replacement for `Either`).
|
|
22
|
+
- **HTTP** is now mounted through the renamed `HttpRouter` module (formerly `HttpApi`). `HttpRouter.make(routes)` takes a single route-registering `Layer` composed from Effect's own `effect/unstable/http` and `effect/unstable/httpapi` modules — `HttpApiBuilder.layer(api)` (with group handler layers supplied via `Layer.provide`; a missing group is a compile-time error), `HttpApiScalar.layer` for docs, `HttpRouter.add` for plain routes, and `HttpRouter.middleware(fn, { global: true })` for middleware, merged with `Layer.mergeAll`. The per-path-prefix record and its `api`/`apiLive`/`middleware`/`scalar` options are gone; Confect registers one catch-all Convex HTTP action at `/`, and plain Convex routes added to the returned router still take precedence. Handlers, middleware, and route-layer construction all run with Confect's Convex-aware `ConfigProvider` in context.
|
|
23
|
+
- **Node actions** use `effect/unstable/process` (`ChildProcessSpawner`) and `@effect/platform-node`'s `NodeServices` in place of `@effect/platform` `Command`/`NodeContext`.
|
|
24
|
+
- **Configuration**: Confect's Convex-aware `ConfigProvider` treats empty-string environment variables as missing values (matching Effect v4's built-in providers), so `Config.withDefault` and `Config.option` recover from them.
|
|
25
|
+
- **CLI**: a malformed `convex.json` now fails codegen with a descriptive error instead of being silently ignored.
|
|
26
|
+
- Confect queries no longer stub the global `Date.now`. Queries run with a `Clock` whose unsafe accessors return constants, so Effect-internal reads (log timestamps, spans) never evict a query from Convex's cache; explicit time reads — `Clock.currentTimeMillis`/`currentTimeNanos` or a raw `Date.now()` call — opt the query out and evict as they honestly should.
|
|
8
27
|
|
|
9
28
|
## 9.2.1
|
|
10
29
|
|
|
@@ -3,19 +3,19 @@ import type { Schema } from "effect";
|
|
|
3
3
|
import * as Data from "effect/Data";
|
|
4
4
|
export type FunctionProvenance = Data.TaggedEnum<{
|
|
5
5
|
Confect: {
|
|
6
|
-
args: Schema.
|
|
7
|
-
returns: Schema.
|
|
8
|
-
error?: Schema.
|
|
6
|
+
args: Schema.Codec<any, any>;
|
|
7
|
+
returns: Schema.Codec<any, any>;
|
|
8
|
+
error?: Schema.Codec<any, any>;
|
|
9
9
|
};
|
|
10
10
|
Convex: {};
|
|
11
11
|
}>;
|
|
12
|
-
export interface Confect<Args extends Schema.
|
|
12
|
+
export interface Confect<Args extends Schema.Codec<any, any>, Returns extends Schema.Codec<any, any>, Error extends Schema.Codec<any, any> = never> {
|
|
13
13
|
readonly _tag: "Confect";
|
|
14
14
|
readonly args: Args;
|
|
15
15
|
readonly returns: Returns;
|
|
16
16
|
readonly error?: Error;
|
|
17
17
|
}
|
|
18
|
-
export interface AnyConfect extends Confect<Schema.
|
|
18
|
+
export interface AnyConfect extends Confect<Schema.Codec<any, any>, Schema.Codec<any, any>, Schema.Codec<any, any>> {
|
|
19
19
|
}
|
|
20
20
|
export interface Convex<Args extends DefaultFunctionArgs, Returns> {
|
|
21
21
|
readonly _tag: "Convex";
|
|
@@ -25,22 +25,22 @@ export interface Convex<Args extends DefaultFunctionArgs, Returns> {
|
|
|
25
25
|
export interface AnyConvex extends Convex<DefaultFunctionArgs, any> {
|
|
26
26
|
}
|
|
27
27
|
export declare const FunctionProvenance: {
|
|
28
|
-
readonly Confect: Data.
|
|
28
|
+
readonly Confect: Data.TaggedEnum.ConstructorFrom<{
|
|
29
29
|
readonly _tag: "Confect";
|
|
30
|
-
readonly args: Schema.
|
|
31
|
-
readonly returns: Schema.
|
|
32
|
-
readonly error?: Schema.
|
|
30
|
+
readonly args: Schema.Codec<any, any>;
|
|
31
|
+
readonly returns: Schema.Codec<any, any>;
|
|
32
|
+
readonly error?: Schema.Codec<any, any>;
|
|
33
33
|
}, "_tag">;
|
|
34
|
-
readonly Convex: Data.
|
|
34
|
+
readonly Convex: Data.TaggedEnum.ConstructorFrom<{
|
|
35
35
|
readonly _tag: "Convex";
|
|
36
36
|
readonly _args: DefaultFunctionArgs;
|
|
37
37
|
readonly _returns: any;
|
|
38
38
|
}, "_tag">;
|
|
39
39
|
readonly $is: <Tag extends "Confect" | "Convex">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
40
40
|
readonly _tag: "Confect";
|
|
41
|
-
readonly args: Schema.
|
|
42
|
-
readonly returns: Schema.
|
|
43
|
-
readonly error?: Schema.
|
|
41
|
+
readonly args: Schema.Codec<any, any>;
|
|
42
|
+
readonly returns: Schema.Codec<any, any>;
|
|
43
|
+
readonly error?: Schema.Codec<any, any>;
|
|
44
44
|
}, {
|
|
45
45
|
readonly _tag: Tag;
|
|
46
46
|
}> | Extract<{
|
|
@@ -51,34 +51,34 @@ export declare const FunctionProvenance: {
|
|
|
51
51
|
readonly _tag: Tag;
|
|
52
52
|
}>;
|
|
53
53
|
readonly $match: {
|
|
54
|
-
<
|
|
54
|
+
<Cases extends {
|
|
55
55
|
readonly Confect: (args: {
|
|
56
56
|
readonly _tag: "Confect";
|
|
57
|
-
readonly args: Schema.
|
|
58
|
-
readonly returns: Schema.
|
|
59
|
-
readonly error?: Schema.
|
|
57
|
+
readonly args: Schema.Codec<any, any>;
|
|
58
|
+
readonly returns: Schema.Codec<any, any>;
|
|
59
|
+
readonly error?: Schema.Codec<any, any>;
|
|
60
60
|
}) => any;
|
|
61
61
|
readonly Convex: (args: {
|
|
62
62
|
readonly _tag: "Convex";
|
|
63
63
|
readonly _args: DefaultFunctionArgs;
|
|
64
64
|
readonly _returns: any;
|
|
65
65
|
}) => any;
|
|
66
|
-
}>(cases: Cases
|
|
66
|
+
}>(cases: Cases): (value: {
|
|
67
67
|
readonly _tag: "Confect";
|
|
68
|
-
readonly args: Schema.
|
|
69
|
-
readonly returns: Schema.
|
|
70
|
-
readonly error?: Schema.
|
|
68
|
+
readonly args: Schema.Codec<any, any>;
|
|
69
|
+
readonly returns: Schema.Codec<any, any>;
|
|
70
|
+
readonly error?: Schema.Codec<any, any>;
|
|
71
71
|
} | {
|
|
72
72
|
readonly _tag: "Convex";
|
|
73
73
|
readonly _args: DefaultFunctionArgs;
|
|
74
74
|
readonly _returns: any;
|
|
75
75
|
}) => import("effect/Unify").Unify<ReturnType<Cases["Confect" | "Convex"]>>;
|
|
76
|
-
<
|
|
76
|
+
<Cases extends {
|
|
77
77
|
readonly Confect: (args: {
|
|
78
78
|
readonly _tag: "Confect";
|
|
79
|
-
readonly args: Schema.
|
|
80
|
-
readonly returns: Schema.
|
|
81
|
-
readonly error?: Schema.
|
|
79
|
+
readonly args: Schema.Codec<any, any>;
|
|
80
|
+
readonly returns: Schema.Codec<any, any>;
|
|
81
|
+
readonly error?: Schema.Codec<any, any>;
|
|
82
82
|
}) => any;
|
|
83
83
|
readonly Convex: (args: {
|
|
84
84
|
readonly _tag: "Convex";
|
|
@@ -87,14 +87,14 @@ export declare const FunctionProvenance: {
|
|
|
87
87
|
}) => any;
|
|
88
88
|
}>(value: {
|
|
89
89
|
readonly _tag: "Confect";
|
|
90
|
-
readonly args: Schema.
|
|
91
|
-
readonly returns: Schema.
|
|
92
|
-
readonly error?: Schema.
|
|
90
|
+
readonly args: Schema.Codec<any, any>;
|
|
91
|
+
readonly returns: Schema.Codec<any, any>;
|
|
92
|
+
readonly error?: Schema.Codec<any, any>;
|
|
93
93
|
} | {
|
|
94
94
|
readonly _tag: "Convex";
|
|
95
95
|
readonly _args: DefaultFunctionArgs;
|
|
96
96
|
readonly _returns: any;
|
|
97
|
-
}, cases: Cases
|
|
97
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Confect" | "Convex"]>>;
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
/**
|
|
@@ -113,7 +113,7 @@ export declare const FunctionProvenance: {
|
|
|
113
113
|
* is observable via `"error" in provenance` without forcing anything; nothing
|
|
114
114
|
* relies on `Data`'s structural `Equal`/`Hash` for provenance values.
|
|
115
115
|
*/
|
|
116
|
-
export declare const Confect: <Args extends Schema.
|
|
116
|
+
export declare const Confect: <Args extends Schema.Codec<any, any>, Returns extends Schema.Codec<any, any>, Error extends Schema.Codec<any, any> = never>(args: () => Args, returns: () => Returns, error?: () => Error) => Confect<Args, Returns, Error>;
|
|
117
117
|
export declare const Convex: <_Args extends DefaultFunctionArgs, _Returns>() => {
|
|
118
118
|
readonly _tag: "Convex";
|
|
119
119
|
readonly _args: DefaultFunctionArgs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionProvenance.d.ts","sourceRoot":"","sources":["../src/FunctionProvenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAGpC,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,UAAU,CAAC;IAC/C,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"FunctionProvenance.d.ts","sourceRoot":"","sources":["../src/FunctionProvenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAGpC,MAAM,MAAM,kBAAkB,GAAG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vB,mBAAmB;+BAEhB,GAAG;;;CA6BsD,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,OAAO,GAClB,IAAI,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACnC,OAAO,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACtC,KAAK,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,EAE5C,MAAM,MAAM,IAAI,EAChB,SAAS,MAAM,OAAO,EACtB,QAAQ,MAAM,KAAK,KAClB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAU9B,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,mBAAmB,EAAE,QAAQ;;oBArEvD,mBAAmB;uBAEhB,GAAG;CAyEd,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { defineProperty } from "./Lazy.js";
|
|
3
3
|
import * as Data from "effect/Data";
|
|
4
|
+
|
|
4
5
|
//#region src/FunctionProvenance.ts
|
|
5
6
|
var FunctionProvenance_exports = /* @__PURE__ */ __exportAll({
|
|
6
7
|
Confect: () => Confect,
|
|
@@ -32,7 +33,7 @@ const Confect = (args, returns, error) => {
|
|
|
32
33
|
return provenance;
|
|
33
34
|
};
|
|
34
35
|
const Convex = () => FunctionProvenance.Convex({});
|
|
36
|
+
|
|
35
37
|
//#endregion
|
|
36
38
|
export { Confect, Convex, FunctionProvenance, FunctionProvenance_exports };
|
|
37
|
-
|
|
38
39
|
//# sourceMappingURL=FunctionProvenance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionProvenance.js","names":[],"sources":["../src/FunctionProvenance.ts"],"sourcesContent":["import type { DefaultFunctionArgs } from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Data from \"effect/Data\";\nimport * as Lazy from \"./Lazy\";\n\nexport type FunctionProvenance = Data.TaggedEnum<{\n Confect: {\n args: Schema.
|
|
1
|
+
{"version":3,"file":"FunctionProvenance.js","names":[],"sources":["../src/FunctionProvenance.ts"],"sourcesContent":["import type { DefaultFunctionArgs } from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Data from \"effect/Data\";\nimport * as Lazy from \"./Lazy\";\n\nexport type FunctionProvenance = Data.TaggedEnum<{\n Confect: {\n args: Schema.Codec<any, any>;\n returns: Schema.Codec<any, any>;\n error?: Schema.Codec<any, any>;\n };\n Convex: {\n /** @internal */\n _args: DefaultFunctionArgs;\n /** @internal */\n _returns: any;\n };\n}>;\n\nexport interface Confect<\n Args extends Schema.Codec<any, any>,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n> {\n readonly _tag: \"Confect\";\n readonly args: Args;\n readonly returns: Returns;\n readonly error?: Error;\n}\n\nexport interface AnyConfect extends Confect<\n Schema.Codec<any, any>,\n Schema.Codec<any, any>,\n Schema.Codec<any, any>\n> {}\n\nexport interface Convex<Args extends DefaultFunctionArgs, Returns> {\n readonly _tag: \"Convex\";\n readonly _args: Args;\n readonly _returns: Returns;\n}\n\nexport interface AnyConvex extends Convex<DefaultFunctionArgs, any> {}\n\nexport const FunctionProvenance = Data.taggedEnum<FunctionProvenance>();\n\n/**\n * Build a `Confect` provenance from lazy schema thunks. `args`, `returns`,\n * and `error` are exposed as sync lazy memoised getters (via {@link Lazy.defineProperty})\n * that only evaluate their thunk on first access, mirroring how `Table`\n * defers `Fields`/`Doc`/`tableDefinition`. This keeps importing the assembled\n * `_generated/spec.ts` cheap — no `Schema.Struct(...)` / `Schema.Array(...)`\n * work runs at module load; it is deferred to the first invocation that\n * actually compiles validators or runs a codec.\n *\n * The object is built by hand rather than through `FunctionProvenance.Confect`\n * because the `Data` constructor copies its input with `Object.assign`, which\n * would force the getters at construction time and defeat the laziness.\n * `error` is only installed when an `errorThunk` is provided, so its absence\n * is observable via `\"error\" in provenance` without forcing anything; nothing\n * relies on `Data`'s structural `Equal`/`Hash` for provenance values.\n */\nexport const Confect = <\n Args extends Schema.Codec<any, any>,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n args: () => Args,\n returns: () => Returns,\n error?: () => Error,\n): Confect<Args, Returns, Error> => {\n const provenance = { _tag: \"Confect\" as const };\n\n Lazy.defineProperty(provenance, \"args\", args);\n Lazy.defineProperty(provenance, \"returns\", returns);\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return provenance as Confect<Args, Returns, Error>;\n};\n\nexport const Convex = <_Args extends DefaultFunctionArgs, _Returns>() =>\n FunctionProvenance.Convex(\n {} as {\n _args: _Args;\n _returns: _Returns;\n },\n );\n"],"mappings":";;;;;;;;;;AA4CA,MAAa,qBAAqB,KAAK,YAAgC;;;;;;;;;;;;;;;;;AAkBvE,MAAa,WAKX,MACA,SACA,UACkC;CAClC,MAAM,aAAa,EAAE,MAAM,WAAoB;AAE/C,gBAAoB,YAAY,QAAQ,KAAK;AAC7C,gBAAoB,YAAY,WAAW,QAAQ;AACnD,KAAI,UAAU,OACZ,gBAAoB,YAAY,SAAS,MAAM;AAGjD,QAAO;;AAGT,MAAa,eACX,mBAAmB,OACjB,EAAE,CAIH"}
|
package/dist/FunctionSpec.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["name"];
|
|
|
33
33
|
export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
34
34
|
functionProvenance: {
|
|
35
35
|
_tag: "Confect";
|
|
36
|
-
args: infer ArgsSchema_ extends Schema.
|
|
36
|
+
args: infer ArgsSchema_ extends Schema.Codec<any, any>;
|
|
37
37
|
};
|
|
38
38
|
} ? ArgsSchema_["Type"] : FunctionSpec_ extends {
|
|
39
39
|
functionProvenance: {
|
|
@@ -44,7 +44,7 @@ export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
|
44
44
|
export type Returns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
45
45
|
functionProvenance: {
|
|
46
46
|
_tag: "Confect";
|
|
47
|
-
returns: infer ReturnsSchema_ extends Schema.
|
|
47
|
+
returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;
|
|
48
48
|
};
|
|
49
49
|
} ? ReturnsSchema_["Type"] : FunctionSpec_ extends {
|
|
50
50
|
functionProvenance: {
|
|
@@ -55,7 +55,7 @@ export type Returns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends
|
|
|
55
55
|
export type EncodedArgs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
56
56
|
functionProvenance: {
|
|
57
57
|
_tag: "Confect";
|
|
58
|
-
args: infer ArgsSchema_ extends Schema.
|
|
58
|
+
args: infer ArgsSchema_ extends Schema.Codec<any, any>;
|
|
59
59
|
};
|
|
60
60
|
} ? ArgsSchema_["Encoded"] : FunctionSpec_ extends {
|
|
61
61
|
functionProvenance: {
|
|
@@ -66,7 +66,7 @@ export type EncodedArgs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ exte
|
|
|
66
66
|
export type EncodedReturns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
67
67
|
functionProvenance: {
|
|
68
68
|
_tag: "Confect";
|
|
69
|
-
returns: infer ReturnsSchema_ extends Schema.
|
|
69
|
+
returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;
|
|
70
70
|
};
|
|
71
71
|
} ? ReturnsSchema_["Encoded"] : FunctionSpec_ extends {
|
|
72
72
|
functionProvenance: {
|
|
@@ -75,10 +75,10 @@ export type EncodedReturns<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ e
|
|
|
75
75
|
};
|
|
76
76
|
} ? Returns_ : never;
|
|
77
77
|
export type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
78
|
-
functionProvenance: FunctionProvenance.Confect<any, any, infer ErrorSchema_ extends Schema.
|
|
78
|
+
functionProvenance: FunctionProvenance.Confect<any, any, infer ErrorSchema_ extends Schema.Codec<any, any>>;
|
|
79
79
|
} ? ErrorSchema_["Type"] : never;
|
|
80
80
|
export type EncodedError<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
81
|
-
functionProvenance: FunctionProvenance.Confect<any, any, infer ErrorSchema_ extends Schema.
|
|
81
|
+
functionProvenance: FunctionProvenance.Confect<any, any, infer ErrorSchema_ extends Schema.Codec<any, any>>;
|
|
82
82
|
} ? ErrorSchema_["Encoded"] : never;
|
|
83
83
|
export type WithName<FunctionSpec_ extends AnyWithProps, Name_ extends string> = Extract<FunctionSpec_, {
|
|
84
84
|
readonly name: Name_;
|
|
@@ -97,7 +97,7 @@ export type WithFunctionProvenance<FunctionSpec_ extends AnyWithProps, FunctionP
|
|
|
97
97
|
export type WithoutName<FunctionSpec_ extends AnyWithProps, Name_ extends Name<FunctionSpec_>> = Exclude<FunctionSpec_, {
|
|
98
98
|
readonly name: Name_;
|
|
99
99
|
}>;
|
|
100
|
-
export declare const publicQuery: <const Name_ extends string, Args_ extends Schema.
|
|
100
|
+
export declare const publicQuery: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
101
101
|
name: Name_;
|
|
102
102
|
args: () => Args_;
|
|
103
103
|
returns: () => Returns_;
|
|
@@ -106,7 +106,7 @@ export declare const publicQuery: <const Name_ extends string, Args_ extends Sch
|
|
|
106
106
|
readonly runtime: "Convex";
|
|
107
107
|
readonly functionType: "query";
|
|
108
108
|
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
109
|
-
export declare const internalQuery: <const Name_ extends string, Args_ extends Schema.
|
|
109
|
+
export declare const internalQuery: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
110
110
|
name: Name_;
|
|
111
111
|
args: () => Args_;
|
|
112
112
|
returns: () => Returns_;
|
|
@@ -115,7 +115,7 @@ export declare const internalQuery: <const Name_ extends string, Args_ extends S
|
|
|
115
115
|
readonly runtime: "Convex";
|
|
116
116
|
readonly functionType: "query";
|
|
117
117
|
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
118
|
-
export declare const publicMutation: <const Name_ extends string, Args_ extends Schema.
|
|
118
|
+
export declare const publicMutation: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
119
119
|
name: Name_;
|
|
120
120
|
args: () => Args_;
|
|
121
121
|
returns: () => Returns_;
|
|
@@ -124,7 +124,7 @@ export declare const publicMutation: <const Name_ extends string, Args_ extends
|
|
|
124
124
|
readonly runtime: "Convex";
|
|
125
125
|
readonly functionType: "mutation";
|
|
126
126
|
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
127
|
-
export declare const internalMutation: <const Name_ extends string, Args_ extends Schema.
|
|
127
|
+
export declare const internalMutation: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
128
128
|
name: Name_;
|
|
129
129
|
args: () => Args_;
|
|
130
130
|
returns: () => Returns_;
|
|
@@ -133,7 +133,7 @@ export declare const internalMutation: <const Name_ extends string, Args_ extend
|
|
|
133
133
|
readonly runtime: "Convex";
|
|
134
134
|
readonly functionType: "mutation";
|
|
135
135
|
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
136
|
-
export declare const publicAction: <const Name_ extends string, Args_ extends Schema.
|
|
136
|
+
export declare const publicAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
137
137
|
name: Name_;
|
|
138
138
|
args: () => Args_;
|
|
139
139
|
returns: () => Returns_;
|
|
@@ -142,7 +142,7 @@ export declare const publicAction: <const Name_ extends string, Args_ extends Sc
|
|
|
142
142
|
readonly runtime: "Convex";
|
|
143
143
|
readonly functionType: "action";
|
|
144
144
|
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
145
|
-
export declare const internalAction: <const Name_ extends string, Args_ extends Schema.
|
|
145
|
+
export declare const internalAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
146
146
|
name: Name_;
|
|
147
147
|
args: () => Args_;
|
|
148
148
|
returns: () => Returns_;
|
|
@@ -151,7 +151,7 @@ export declare const internalAction: <const Name_ extends string, Args_ extends
|
|
|
151
151
|
readonly runtime: "Convex";
|
|
152
152
|
readonly functionType: "action";
|
|
153
153
|
}, "internal", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
154
|
-
export declare const publicNodeAction: <const Name_ extends string, Args_ extends Schema.
|
|
154
|
+
export declare const publicNodeAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
155
155
|
name: Name_;
|
|
156
156
|
args: () => Args_;
|
|
157
157
|
returns: () => Returns_;
|
|
@@ -160,7 +160,7 @@ export declare const publicNodeAction: <const Name_ extends string, Args_ extend
|
|
|
160
160
|
readonly runtime: "Node";
|
|
161
161
|
readonly functionType: "action";
|
|
162
162
|
}, "public", Name_, FunctionProvenance.Confect<Args_, Returns_, Error_>>;
|
|
163
|
-
export declare const internalNodeAction: <const Name_ extends string, Args_ extends Schema.
|
|
163
|
+
export declare const internalNodeAction: <const Name_ extends string, Args_ extends Schema.Codec<any, any>, Returns_ extends Schema.Codec<any, any>, Error_ extends Schema.Codec<any, any> = never>({ name, args, returns, error, }: {
|
|
164
164
|
name: Name_;
|
|
165
165
|
args: () => Args_;
|
|
166
166
|
returns: () => Returns_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.d.ts","sourceRoot":"","sources":["../src/FunctionSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AAEnE,eAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,eAAO,MAAM,cAAc,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,YACf,CAAC;AAEnC,MAAM,WAAW,YAAY,CAC3B,uBAAuB,SAAS,sBAAsB,CAAC,sBAAsB,EAC7E,mBAAmB,SAAS,kBAAkB,EAC9C,KAAK,SAAS,MAAM,EACpB,mBAAmB,SAAS,kBAAkB,CAAC,kBAAkB;IAEjE,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;IACzD,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;CAClD;AAED,MAAM,WAAW,GAAG;IAClB,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,YAAa,SAAQ,YAAY,CAChD,sBA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M,sBAAsB,GAtC/B,CAAC,yDAKF,KAAK,CAAC,KAAK,SAAS,MAAM,EACzB,MAAM,KAAK;;;mFAmCd,CAAC;AACF,eAAO,MAAM,kBAAkB,GA1C3B,CAAC,qDAKF,KAAK,CAAC,KAAK,SAAS,MAAM,EACzB,MAAM,KAAK;;;iFAuCd,CAAC;AACF,eAAO,MAAM,oBAAoB,GA9C7B,CAAC,uDAKF,KAAK,CAAC,KAAK,SAAS,MAAM,EACzB,MAAM,KAAK;;;mFA2Cd,CAAC;AACF,eAAO,MAAM,sBAAsB,GAlD/B,CAAC,qDAKF,KAAK,CAAC,KAAK,SAAS,MAAM,EACzB,MAAM,KAAK;;;iFA+Cd,CAAC;AACF,eAAO,MAAM,wBAAwB,GAtDjC,CAAC,uDAKF,KAAK,CAAC,KAAK,SAAS,MAAM,EACzB,MAAM,KAAK;;;mFAmDd,CAAC"}
|
package/dist/FunctionSpec.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Confect, Convex } from "./FunctionProvenance.js";
|
|
|
3
3
|
import { validateConfectFunctionIdentifier } from "./Identifier.js";
|
|
4
4
|
import { ConvexAction, ConvexMutation, ConvexQuery, NodeAction } from "./RuntimeAndFunctionType.js";
|
|
5
5
|
import * as Predicate from "effect/Predicate";
|
|
6
|
+
|
|
6
7
|
//#region src/FunctionSpec.ts
|
|
7
8
|
var FunctionSpec_exports = /* @__PURE__ */ __exportAll({
|
|
8
9
|
TypeId: () => TypeId,
|
|
@@ -61,7 +62,7 @@ const convexPublicAction = makeConvex(ConvexAction, "public");
|
|
|
61
62
|
const convexInternalAction = makeConvex(ConvexAction, "internal");
|
|
62
63
|
const convexPublicNodeAction = makeConvex(NodeAction, "public");
|
|
63
64
|
const convexInternalNodeAction = makeConvex(NodeAction, "internal");
|
|
65
|
+
|
|
64
66
|
//#endregion
|
|
65
67
|
export { FunctionSpec_exports, TypeId, convexInternalAction, convexInternalMutation, convexInternalNodeAction, convexInternalQuery, convexPublicAction, convexPublicMutation, convexPublicNodeAction, convexPublicQuery, internalAction, internalMutation, internalNodeAction, internalQuery, isFunctionSpec, publicAction, publicMutation, publicNodeAction, publicQuery };
|
|
66
|
-
|
|
67
68
|
//# sourceMappingURL=FunctionSpec.js.map
|
package/dist/FunctionSpec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction","FunctionProvenance.Convex"],"sources":["../src/FunctionSpec.ts"],"sourcesContent":["import type {\n FunctionType,\n FunctionVisibility,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/FunctionSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface FunctionSpec<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends FunctionSpec<\n RuntimeAndFunctionType.WithRuntime<Runtime>,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Schema.AnyNoContext;\n };\n}\n ? ArgsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Schema.AnyNoContext;\n };\n }\n ? ReturnsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Schema.AnyNoContext;\n };\n }\n ? ArgsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Schema.AnyNoContext;\n };\n }\n ? ReturnsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Schema.AnyNoContext\n >;\n}\n ? ErrorSchema_[\"Type\"]\n : never;\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Schema.AnyNoContext\n >;\n }\n ? ErrorSchema_[\"Encoded\"]\n : never;\n\nexport type WithName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends string,\n> = Extract<FunctionSpec_, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n FunctionSpec_ extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n FunctionSpec_ extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithFunctionProvenance<\n FunctionSpec_ extends AnyWithProps,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> = Extract<\n FunctionSpec_,\n { readonly functionProvenance: FunctionProvenance_ }\n>;\n\nexport type WithoutName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends Name<FunctionSpec_>,\n> = Exclude<FunctionSpec_, { readonly name: Name_ }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst make =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n Error_ extends Schema.Schema.AnyNoContext = never,\n >({\n name,\n args,\n returns,\n error,\n }: {\n name: Name_;\n args: () => Args_;\n returns: () => Returns_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<Args_, Returns_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Confect(args, returns, error),\n });\n };\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const internalMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const publicAction = make(RuntimeAndFunctionType.ConvexAction, \"public\");\nexport const internalAction = make(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\n\nexport const publicNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const internalNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n\ntype MatchingRegisteredFunction<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n> =\n RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"query\"\n ? RegisteredQuery<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"mutation\"\n ? RegisteredMutation<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"action\"\n ? RegisteredAction<FunctionVisibility_, any, any>\n : never;\n\ntype ExtractArgs<F> =\n F extends RegisteredQuery<any, infer A, any>\n ? A\n : F extends RegisteredMutation<any, infer A, any>\n ? A\n : F extends RegisteredAction<any, infer A, any>\n ? A\n : never;\n\ntype ExtractReturns<F> =\n F extends RegisteredQuery<any, any, infer R>\n ? R\n : F extends RegisteredMutation<any, any, infer R>\n ? R\n : F extends RegisteredAction<any, any, infer R>\n ? R\n : never;\n\nconst makeConvex =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n F extends MatchingRegisteredFunction<\n RuntimeAndFunctionType_,\n FunctionVisibility_\n >,\n >() =>\n <const Name_ extends string>(\n name: Name_,\n ): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Convex<\n ExtractArgs<F>,\n ExtractReturns<F>\n >(),\n }) as any;\n };\n\nexport const convexPublicQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const convexInternalQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const convexPublicMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const convexInternalMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const convexPublicAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"public\",\n);\nexport const convexInternalAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\nexport const convexPublicNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const convexInternalNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,MAAM;AAyLjC,MAAM,QAAQ,GACX,SAAS,OACZ;AAEA,MAAM,QAMF,wBACA,wBAOA,EACA,MACA,MACA,SACA,YAWG;CACH,kCAAkC,IAAI;CAEtC,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;EACzC;EACA;EACA;EACA,oBAAoBA,QAA2B,MAAM,SAAS,KAAK;CACrE,CAAC;AACH;AAEF,MAAa,cAAc,KAAKC,aAAoC,QAAQ;AAC5E,MAAa,gBAAgB,KAC3BA,aACA,UACF;AACA,MAAa,iBAAiB,KAC5BC,gBACA,QACF;AACA,MAAa,mBAAmB,KAC9BA,gBACA,UACF;AACA,MAAa,eAAe,KAAKC,cAAqC,QAAQ;AAC9E,MAAa,iBAAiB,KAC5BA,cACA,UACF;AAEA,MAAa,mBAAmB,KAC9BC,YACA,QACF;AACA,MAAa,qBAAqB,KAChCA,YACA,UACF;AAgCA,MAAM,cAMF,wBACA,8BASA,SAMG;CACH,kCAAkC,IAAI;CAEtC,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;EACzC;EACA;EACA;EACA,oBAAoBC,OAGlB;CACJ,CAAC;AACH;AAEF,MAAa,oBAAoB,WAC/BJ,aACA,QACF;AACA,MAAa,sBAAsB,WACjCA,aACA,UACF;AACA,MAAa,uBAAuB,WAClCC,gBACA,QACF;AACA,MAAa,yBAAyB,WACpCA,gBACA,UACF;AACA,MAAa,qBAAqB,WAChCC,cACA,QACF;AACA,MAAa,uBAAuB,WAClCA,cACA,UACF;AACA,MAAa,yBAAyB,WACpCC,YACA,QACF;AACA,MAAa,2BAA2B,WACtCA,YACA,UACF"}
|
|
1
|
+
{"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction","FunctionProvenance.Convex"],"sources":["../src/FunctionSpec.ts"],"sourcesContent":["import type {\n FunctionType,\n FunctionVisibility,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/FunctionSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isFunctionSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface FunctionSpec<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends FunctionSpec<\n RuntimeAndFunctionType.WithRuntime<Runtime>,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n}\n ? ArgsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Type\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n args: infer ArgsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ArgsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _args: infer Args_ };\n }\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: {\n _tag: \"Confect\";\n returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_[\"Encoded\"]\n : FunctionSpec_ extends {\n functionProvenance: { _tag: \"Convex\"; _returns: infer Returns_ };\n }\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n}\n ? ErrorSchema_[\"Type\"]\n : never;\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n functionProvenance: FunctionProvenance.Confect<\n any,\n any,\n infer ErrorSchema_ extends Schema.Codec<any, any>\n >;\n }\n ? ErrorSchema_[\"Encoded\"]\n : never;\n\nexport type WithName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends string,\n> = Extract<FunctionSpec_, { readonly name: Name_ }>;\n\nexport type WithRuntimeAndFunctionType<\n FunctionSpec_ extends AnyWithProps,\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: RuntimeAndFunctionType_ }\n>;\n\nexport type WithFunctionType<\n FunctionSpec_ extends AnyWithProps,\n FunctionType_ extends FunctionType,\n> = Extract<\n FunctionSpec_,\n { readonly runtimeAndFunctionType: { readonly functionType: FunctionType_ } }\n>;\n\nexport type WithFunctionProvenance<\n FunctionSpec_ extends AnyWithProps,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> = Extract<\n FunctionSpec_,\n { readonly functionProvenance: FunctionProvenance_ }\n>;\n\nexport type WithoutName<\n FunctionSpec_ extends AnyWithProps,\n Name_ extends Name<FunctionSpec_>,\n> = Exclude<FunctionSpec_, { readonly name: Name_ }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst make =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n const Name_ extends string,\n Args_ extends Schema.Codec<any, any>,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >({\n name,\n args,\n returns,\n error,\n }: {\n name: Name_;\n args: () => Args_;\n returns: () => Returns_;\n error?: () => Error_;\n }): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<Args_, Returns_, Error_>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Confect(args, returns, error),\n });\n };\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const internalMutation = make(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const publicAction = make(RuntimeAndFunctionType.ConvexAction, \"public\");\nexport const internalAction = make(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\n\nexport const publicNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const internalNodeAction = make(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n\ntype MatchingRegisteredFunction<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n> =\n RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"query\"\n ? RegisteredQuery<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"mutation\"\n ? RegisteredMutation<FunctionVisibility_, any, any>\n : RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_> extends \"action\"\n ? RegisteredAction<FunctionVisibility_, any, any>\n : never;\n\ntype ExtractArgs<F> =\n F extends RegisteredQuery<any, infer A, any>\n ? A\n : F extends RegisteredMutation<any, infer A, any>\n ? A\n : F extends RegisteredAction<any, infer A, any>\n ? A\n : never;\n\ntype ExtractReturns<F> =\n F extends RegisteredQuery<any, any, infer R>\n ? R\n : F extends RegisteredMutation<any, any, infer R>\n ? R\n : F extends RegisteredAction<any, any, infer R>\n ? R\n : never;\n\nconst makeConvex =\n <\n RuntimeAndFunctionType_ extends\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n >(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n ) =>\n <\n F extends MatchingRegisteredFunction<\n RuntimeAndFunctionType_,\n FunctionVisibility_\n >,\n >() =>\n <const Name_ extends string>(\n name: Name_,\n ): FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Convex<ExtractArgs<F>, ExtractReturns<F>>\n > => {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance: FunctionProvenance.Convex<\n ExtractArgs<F>,\n ExtractReturns<F>\n >(),\n }) as any;\n };\n\nexport const convexPublicQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const convexInternalQuery = makeConvex(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const convexPublicMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"public\",\n);\nexport const convexInternalMutation = makeConvex(\n RuntimeAndFunctionType.ConvexMutation,\n \"internal\",\n);\nexport const convexPublicAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"public\",\n);\nexport const convexInternalAction = makeConvex(\n RuntimeAndFunctionType.ConvexAction,\n \"internal\",\n);\nexport const convexPublicNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"public\",\n);\nexport const convexInternalNodeAction = makeConvex(\n RuntimeAndFunctionType.NodeAction,\n \"internal\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,OAAO;AAyLlC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,QAMF,wBACA,wBAOA,EACA,MACA,MACA,SACA,YAWG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA,oBAAoBA,QAA2B,MAAM,SAAS,MAAM;EACrE,CAAC;;AAGN,MAAa,cAAc,KAAKC,aAAoC,SAAS;AAC7E,MAAa,gBAAgB,KAC3BA,aACA,WACD;AACD,MAAa,iBAAiB,KAC5BC,gBACA,SACD;AACD,MAAa,mBAAmB,KAC9BA,gBACA,WACD;AACD,MAAa,eAAe,KAAKC,cAAqC,SAAS;AAC/E,MAAa,iBAAiB,KAC5BA,cACA,WACD;AAED,MAAa,mBAAmB,KAC9BC,YACA,SACD;AACD,MAAa,qBAAqB,KAChCA,YACA,WACD;AAgCD,MAAM,cAMF,wBACA,8BASA,SAMG;AACH,mCAAkC,KAAK;AAEvC,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC;EACA;EACA;EACA,oBAAoBC,QAGjB;EACJ,CAAC;;AAGN,MAAa,oBAAoB,WAC/BJ,aACA,SACD;AACD,MAAa,sBAAsB,WACjCA,aACA,WACD;AACD,MAAa,uBAAuB,WAClCC,gBACA,SACD;AACD,MAAa,yBAAyB,WACpCA,gBACA,WACD;AACD,MAAa,qBAAqB,WAChCC,cACA,SACD;AACD,MAAa,uBAAuB,WAClCA,cACA,WACD;AACD,MAAa,yBAAyB,WACpCC,YACA,SACD;AACD,MAAa,2BAA2B,WACtCA,YACA,WACD"}
|
package/dist/GenericId.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GenericId as ConvexGenericId } from "convex/values";
|
|
2
|
-
import
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
import * as SchemaAST from "effect/SchemaAST";
|
|
5
|
-
export declare const GenericId: <TableName extends string>(tableName: TableName) => Schema.
|
|
5
|
+
export declare const GenericId: <TableName extends string>(tableName: TableName) => Schema.Codec<ConvexGenericId<TableName>>;
|
|
6
6
|
export type GenericId<TableName extends string> = ConvexGenericId<TableName>;
|
|
7
7
|
export declare const tableName: <TableName extends string>(ast: SchemaAST.AST) => Option.Option<TableName>;
|
|
8
8
|
//# sourceMappingURL=GenericId.d.ts.map
|
package/dist/GenericId.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericId.d.ts","sourceRoot":"","sources":["../src/GenericId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"GenericId.d.ts","sourceRoot":"","sources":["../src/GenericId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAI9C,eAAO,MAAM,SAAS,GAAI,SAAS,SAAS,MAAM,EAChD,WAAW,SAAS,KACnB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,CAGiB,CAAC;AAE5D,MAAM,MAAM,SAAS,CAAC,SAAS,SAAS,MAAM,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC;AAE7E,eAAO,MAAM,SAAS,GAAI,SAAS,SAAS,MAAM,EAChD,KAAK,SAAS,CAAC,GAAG,KACjB,MAAM,CAAC,MAAM,CAAC,SAAS,CAC2C,CAAC"}
|
package/dist/GenericId.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
2
3
|
import * as Schema from "effect/Schema";
|
|
3
4
|
import * as SchemaAST from "effect/SchemaAST";
|
|
5
|
+
|
|
4
6
|
//#region src/GenericId.ts
|
|
5
7
|
var GenericId_exports = /* @__PURE__ */ __exportAll({
|
|
6
8
|
GenericId: () => GenericId,
|
|
7
9
|
tableName: () => tableName
|
|
8
10
|
});
|
|
9
|
-
const ConvexId =
|
|
10
|
-
const GenericId = (tableName) => Schema.String.
|
|
11
|
-
const tableName = (ast) => SchemaAST.
|
|
11
|
+
const ConvexId = "~@confect/core/ConvexId";
|
|
12
|
+
const GenericId = (tableName) => Schema.String.annotate({ [ConvexId]: tableName });
|
|
13
|
+
const tableName = (ast) => Option.fromNullishOr(SchemaAST.resolveAt(ConvexId)(ast));
|
|
14
|
+
|
|
12
15
|
//#endregion
|
|
13
16
|
export { GenericId, GenericId_exports, tableName };
|
|
14
|
-
|
|
15
17
|
//# sourceMappingURL=GenericId.js.map
|
package/dist/GenericId.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericId.js","names":[],"sources":["../src/GenericId.ts"],"sourcesContent":["import type { GenericId as ConvexGenericId } from \"convex/values\";\nimport
|
|
1
|
+
{"version":3,"file":"GenericId.js","names":[],"sources":["../src/GenericId.ts"],"sourcesContent":["import type { GenericId as ConvexGenericId } from \"convex/values\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\n\nconst ConvexId = \"~@confect/core/ConvexId\";\n\nexport const GenericId = <TableName extends string>(\n tableName: TableName,\n): Schema.Codec<ConvexGenericId<TableName>> =>\n Schema.String.annotate({\n [ConvexId]: tableName,\n }) as unknown as Schema.Codec<ConvexGenericId<TableName>>;\n\nexport type GenericId<TableName extends string> = ConvexGenericId<TableName>;\n\nexport const tableName = <TableName extends string>(\n ast: SchemaAST.AST,\n): Option.Option<TableName> =>\n Option.fromNullishOr(SchemaAST.resolveAt<TableName>(ConvexId)(ast));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,WAAW;AAEjB,MAAa,aACX,cAEA,OAAO,OAAO,SAAS,GACpB,WAAW,WACb,CAAC;AAIJ,MAAa,aACX,QAEA,OAAO,cAAc,UAAU,UAAqB,SAAS,CAAC,IAAI,CAAC"}
|
package/dist/GroupPath.js
CHANGED
package/dist/GroupSpec.js
CHANGED
|
@@ -2,6 +2,7 @@ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { validateConfectFunctionIdentifier } from "./Identifier.js";
|
|
3
3
|
import * as Predicate from "effect/Predicate";
|
|
4
4
|
import * as Record from "effect/Record";
|
|
5
|
+
|
|
5
6
|
//#region src/GroupSpec.ts
|
|
6
7
|
var GroupSpec_exports = /* @__PURE__ */ __exportAll({
|
|
7
8
|
TypeId: () => TypeId,
|
|
@@ -93,7 +94,7 @@ const withName = (name, group) => {
|
|
|
93
94
|
groups: group_.groups
|
|
94
95
|
});
|
|
95
96
|
};
|
|
97
|
+
|
|
96
98
|
//#endregion
|
|
97
99
|
export { GroupSpec_exports, TypeId, isGroupSpec, make, makeAt, makeNode, makeNodeAt, withName };
|
|
98
|
-
|
|
99
100
|
//# sourceMappingURL=GroupSpec.js.map
|
package/dist/GroupSpec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupSpec.js","names":[],"sources":["../src/GroupSpec.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\n\nexport const TypeId = \"@confect/core/GroupSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isGroupSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface GroupSpec<\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime> = never,\n // Subgroups may be of any runtime, independent of this group's own runtime: a\n // group is only a namespace for its children, which are otherwise-independent\n // modules. Functions, by contrast, stay homogeneous (a Node group only accepts\n // Node actions) — `addFunction` keeps the `<Runtime>` bound below.\n Groups_ extends AnyWithProps = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtime: Runtime;\n readonly name: Name_;\n readonly functions: {\n [FunctionName in FunctionSpec.Name<\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>\n >]: FunctionSpec.WithName<Functions_, FunctionName>;\n };\n readonly groups: {\n [GroupName in Name<Groups_>]: WithName<Groups_, GroupName>;\n };\n\n addFunction<Function extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>>(\n function_: Function,\n ): GroupSpec<Runtime, Name_, Functions_ | Function, Groups_>;\n\n addGroup<Group extends AnyWithProps>(\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | Group>;\n\n addGroupAt<const AtName extends string, Group extends AnyWithProps>(\n name: AtName,\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | NamedAt<Group, AtName>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends GroupSpec<\n RuntimeAndFunctionType.Runtime,\n string,\n FunctionSpec.AnyWithProps,\n AnyWithProps\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends GroupSpec<\n Runtime,\n string,\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n AnyWithPropsWithRuntime<Runtime>\n> {}\n\nexport type Name<Group extends AnyWithProps> = Group[\"name\"];\n\nexport type Functions<Group extends AnyWithProps> =\n Group[\"functions\"][keyof Group[\"functions\"]];\n\nexport type Groups<Group extends AnyWithProps> =\n Group[\"groups\"][keyof Group[\"groups\"]];\n\nexport type GroupNames<Group extends AnyWithProps> = [Groups<Group>] extends [\n never,\n]\n ? never\n : Name<Groups<Group>>;\n\nexport type WithName<\n Group extends AnyWithProps,\n Name_ extends Name<Group>,\n> = Extract<Group, { readonly name: Name_ }>;\n\n/** Assigns a segment name to a leaf group created with {@link make} for typing and refs. */\nexport type NamedAt<Group extends Any, Name_ extends string> = Omit<\n Group,\n \"name\"\n> & {\n readonly name: Name_;\n};\n\nexport type AddGroups<\n Group extends AnyWithProps,\n ExtraGroups extends AnyWithProps,\n> =\n Group extends GroupSpec<\n infer Runtime,\n infer Name_,\n infer Functions_,\n infer Groups_\n >\n ? GroupSpec<Runtime, Name_, Functions_, Groups_ | ExtraGroups>\n : never;\n\nconst Proto = {\n [TypeId]: TypeId,\n\n addFunction<Function extends FunctionSpec.AnyWithProps>(\n this: Any,\n function_: Function,\n ) {\n const this_ = this as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: Record.set(this_.functions, function_.name, function_),\n groups: this_.groups,\n });\n },\n\n addGroup<Group extends Any>(this: Any, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, group_.name, group_),\n });\n },\n\n addGroupAt<Group extends Any>(this: Any, name: string, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, name, withName(name, group_)),\n });\n },\n};\n\nconst makeProto = <\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n Groups_ extends AnyWithPropsWithRuntime<Runtime>,\n>({\n runtime,\n name,\n functions,\n groups,\n}: {\n runtime: Runtime;\n name: Name_;\n functions: Record.ReadonlyRecord<string, Functions_>;\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): GroupSpec<Runtime, Name_, Functions_, Groups_> =>\n Object.assign(Object.create(Proto), {\n runtime,\n name,\n functions,\n groups,\n });\n\nexport const make = (): GroupSpec<\"Convex\", \"\"> =>\n makeProto({\n runtime: \"Convex\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Convex\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Convex\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const makeNode = (): GroupSpec<\"Node\", \"\"> =>\n makeProto({\n runtime: \"Node\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeNodeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Node\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Node\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const withName = <const Name_ extends string>(\n name: Name_,\n group: Any,\n): AnyWithProps => {\n validateConfectFunctionIdentifier(name);\n const group_ = group as AnyWithProps;\n\n if (group_.name === name) {\n return group_;\n }\n\n return makeProto({\n runtime: group_.runtime,\n name,\n functions: group_.functions,\n groups: group_.groups,\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"GroupSpec.js","names":[],"sources":["../src/GroupSpec.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\n\nexport const TypeId = \"@confect/core/GroupSpec\";\nexport type TypeId = typeof TypeId;\n\nexport const isGroupSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface GroupSpec<\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime> = never,\n // Subgroups may be of any runtime, independent of this group's own runtime: a\n // group is only a namespace for its children, which are otherwise-independent\n // modules. Functions, by contrast, stay homogeneous (a Node group only accepts\n // Node actions) — `addFunction` keeps the `<Runtime>` bound below.\n Groups_ extends AnyWithProps = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtime: Runtime;\n readonly name: Name_;\n readonly functions: {\n [FunctionName in FunctionSpec.Name<\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>\n >]: FunctionSpec.WithName<Functions_, FunctionName>;\n };\n readonly groups: {\n [GroupName in Name<Groups_>]: WithName<Groups_, GroupName>;\n };\n\n addFunction<Function extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>>(\n function_: Function,\n ): GroupSpec<Runtime, Name_, Functions_ | Function, Groups_>;\n\n addGroup<Group extends AnyWithProps>(\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | Group>;\n\n addGroupAt<const AtName extends string, Group extends AnyWithProps>(\n name: AtName,\n group: Group,\n ): GroupSpec<Runtime, Name_, Functions_, Groups_ | NamedAt<Group, AtName>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends GroupSpec<\n RuntimeAndFunctionType.Runtime,\n string,\n FunctionSpec.AnyWithProps,\n AnyWithProps\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends GroupSpec<\n Runtime,\n string,\n FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n AnyWithPropsWithRuntime<Runtime>\n> {}\n\nexport type Name<Group extends AnyWithProps> = Group[\"name\"];\n\nexport type Functions<Group extends AnyWithProps> =\n Group[\"functions\"][keyof Group[\"functions\"]];\n\nexport type Groups<Group extends AnyWithProps> =\n Group[\"groups\"][keyof Group[\"groups\"]];\n\nexport type GroupNames<Group extends AnyWithProps> = [Groups<Group>] extends [\n never,\n]\n ? never\n : Name<Groups<Group>>;\n\nexport type WithName<\n Group extends AnyWithProps,\n Name_ extends Name<Group>,\n> = Extract<Group, { readonly name: Name_ }>;\n\n/** Assigns a segment name to a leaf group created with {@link make} for typing and refs. */\nexport type NamedAt<Group extends Any, Name_ extends string> = Omit<\n Group,\n \"name\"\n> & {\n readonly name: Name_;\n};\n\nexport type AddGroups<\n Group extends AnyWithProps,\n ExtraGroups extends AnyWithProps,\n> =\n Group extends GroupSpec<\n infer Runtime,\n infer Name_,\n infer Functions_,\n infer Groups_\n >\n ? GroupSpec<Runtime, Name_, Functions_, Groups_ | ExtraGroups>\n : never;\n\nconst Proto = {\n [TypeId]: TypeId,\n\n addFunction<Function extends FunctionSpec.AnyWithProps>(\n this: Any,\n function_: Function,\n ) {\n const this_ = this as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: Record.set(this_.functions, function_.name, function_),\n groups: this_.groups,\n });\n },\n\n addGroup<Group extends Any>(this: Any, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, group_.name, group_),\n });\n },\n\n addGroupAt<Group extends Any>(this: Any, name: string, group: Group) {\n const this_ = this as AnyWithProps;\n const group_ = group as unknown as AnyWithProps;\n\n return makeProto({\n runtime: this_.runtime,\n name: this_.name,\n functions: this_.functions,\n groups: Record.set(this_.groups, name, withName(name, group_)),\n });\n },\n};\n\nconst makeProto = <\n Runtime extends RuntimeAndFunctionType.Runtime,\n Name_ extends string,\n Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime>,\n Groups_ extends AnyWithPropsWithRuntime<Runtime>,\n>({\n runtime,\n name,\n functions,\n groups,\n}: {\n runtime: Runtime;\n name: Name_;\n functions: Record.ReadonlyRecord<string, Functions_>;\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): GroupSpec<Runtime, Name_, Functions_, Groups_> =>\n Object.assign(Object.create(Proto), {\n runtime,\n name,\n functions,\n groups,\n });\n\nexport const make = (): GroupSpec<\"Convex\", \"\"> =>\n makeProto({\n runtime: \"Convex\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Convex\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Convex\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const makeNode = (): GroupSpec<\"Node\", \"\"> =>\n makeProto({\n runtime: \"Node\",\n name: \"\",\n functions: Record.empty(),\n groups: Record.empty(),\n });\n\nexport const makeNodeAt = <const Name_ extends string>(\n name: Name_,\n): GroupSpec<\"Node\", Name_> => {\n validateConfectFunctionIdentifier(name);\n\n return makeProto({\n runtime: \"Node\",\n name,\n functions: Record.empty(),\n groups: Record.empty(),\n });\n};\n\nexport const withName = <const Name_ extends string>(\n name: Name_,\n group: Any,\n): AnyWithProps => {\n validateConfectFunctionIdentifier(name);\n const group_ = group as AnyWithProps;\n\n if (group_.name === name) {\n return group_;\n }\n\n return makeProto({\n runtime: group_.runtime,\n name,\n functions: group_.functions,\n groups: group_.groups,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAMA,MAAa,SAAS;AAGtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,OAAO;AAkGlC,MAAM,QAAQ;EACX,SAAS;CAEV,YAEE,WACA;EACA,MAAM,QAAQ;AAEd,SAAO,UAAU;GACf,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,WAAW,OAAO,IAAI,MAAM,WAAW,UAAU,MAAM,UAAU;GACjE,QAAQ,MAAM;GACf,CAAC;;CAGJ,SAAuC,OAAc;EACnD,MAAM,QAAQ;EACd,MAAM,SAAS;AAEf,SAAO,UAAU;GACf,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,WAAW,MAAM;GACjB,QAAQ,OAAO,IAAI,MAAM,QAAQ,OAAO,MAAM,OAAO;GACtD,CAAC;;CAGJ,WAAyC,MAAc,OAAc;EACnE,MAAM,QAAQ;EACd,MAAM,SAAS;AAEf,SAAO,UAAU;GACf,SAAS,MAAM;GACf,MAAM,MAAM;GACZ,WAAW,MAAM;GACjB,QAAQ,OAAO,IAAI,MAAM,QAAQ,MAAM,SAAS,MAAM,OAAO,CAAC;GAC/D,CAAC;;CAEL;AAED,MAAM,aAKJ,EACA,SACA,MACA,WACA,aAOA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACA;CACA;CACD,CAAC;AAEJ,MAAa,aACX,UAAU;CACR,SAAS;CACT,MAAM;CACN,WAAW,OAAO,OAAO;CACzB,QAAQ,OAAO,OAAO;CACv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