@confect/core 10.0.0-next.22 → 10.0.0-next.24
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 +24 -0
- package/dist/FunctionProvenance.d.ts +34 -25
- package/dist/FunctionProvenance.d.ts.map +1 -1
- package/dist/FunctionProvenance.js +13 -11
- package/dist/FunctionProvenance.js.map +1 -1
- package/dist/FunctionSpec.d.ts +12 -8
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GroupPath.d.ts +5 -6
- package/dist/GroupPath.d.ts.map +1 -1
- package/dist/GroupPath.js.map +1 -1
- package/dist/GroupSpec.d.ts +5 -2
- package/dist/GroupSpec.d.ts.map +1 -1
- package/dist/GroupSpec.js +2 -2
- package/dist/GroupSpec.js.map +1 -1
- package/dist/Identifier.d.ts +5 -4
- package/dist/Identifier.d.ts.map +1 -1
- package/dist/Identifier.js +5 -4
- package/dist/Identifier.js.map +1 -1
- package/dist/Lazy.d.ts +11 -12
- package/dist/Lazy.d.ts.map +1 -1
- package/dist/Lazy.js +11 -12
- package/dist/Lazy.js.map +1 -1
- package/dist/MiddlewareSpec.d.ts +27 -25
- package/dist/MiddlewareSpec.d.ts.map +1 -1
- package/dist/MiddlewareSpec.js +8 -4
- package/dist/MiddlewareSpec.js.map +1 -1
- package/dist/PaginationError.d.ts +9 -3
- package/dist/PaginationError.d.ts.map +1 -1
- package/dist/PaginationError.js +9 -3
- package/dist/PaginationError.js.map +1 -1
- package/dist/PaginationOptions.d.ts +2 -2
- package/dist/PaginationOptions.js +2 -2
- package/dist/PaginationOptions.js.map +1 -1
- package/dist/Ref.d.ts +38 -32
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +25 -25
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.d.ts +1 -1
- package/dist/Refs.d.ts.map +1 -1
- package/dist/Refs.js +2 -1
- package/dist/Refs.js.map +1 -1
- package/dist/Spec.d.ts +14 -11
- package/dist/Spec.d.ts.map +1 -1
- package/dist/Spec.js +13 -8
- package/dist/Spec.js.map +1 -1
- package/dist/SystemFields.d.ts +14 -12
- package/dist/SystemFields.d.ts.map +1 -1
- package/dist/SystemFields.js +11 -9
- package/dist/SystemFields.js.map +1 -1
- package/dist/Table.d.ts +1 -0
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -5
- package/src/FunctionProvenance.ts +34 -25
- package/src/FunctionSpec.ts +12 -8
- package/src/GroupPath.ts +5 -6
- package/src/GroupSpec.ts +9 -5
- package/src/Identifier.ts +5 -4
- package/src/Lazy.ts +11 -12
- package/src/MiddlewareSpec.ts +27 -25
- package/src/PaginationError.ts +9 -3
- package/src/PaginationOptions.ts +2 -2
- package/src/Ref.ts +38 -32
- package/src/Refs.ts +2 -2
- package/src/Spec.ts +49 -38
- package/src/SystemFields.ts +22 -22
- package/src/Table.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @confect/core
|
|
2
2
|
|
|
3
|
+
## 10.0.0-next.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 850a3c3: Require `effect@^4.0.0-rc.117` across `@confect/*` and `@effect/platform-node@^4.0.0-rc.117` for `@confect/server`'s optional Node integration. Upgrade these dependencies alongside Confect; existing Confect call sites are unchanged.
|
|
8
|
+
|
|
9
|
+
## 10.0.0-next.23
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 09f9f55: Use `Spec.groups(spec)` and `DatabaseSchema.tables(schema)` to inspect assembled group and table records. Adding a group at an existing spec name now replaces its inferred type as well as its runtime value.
|
|
14
|
+
|
|
15
|
+
### Breaking Changes
|
|
16
|
+
- The `Spec.groups` and `DatabaseSchema.tables` accessors replace the corresponding instance properties.
|
|
17
|
+
- `Spec.Spec`, `DatabaseSchema.DatabaseSchema`, and `DataModel.DataModel` take a record type instead of a union of its members. The separate `~Groups` and `~Tables` phantom properties on these containers are removed; the `Groups` and `Tables` type helpers remain available.
|
|
18
|
+
|
|
19
|
+
Run `confect codegen` to update generated spec and schema annotations. Ordinary `Spec.make().add(...)`, `Spec.make().addAt(...)`, and `DatabaseSchema.make({ ... })` calls keep their existing syntax. `DataModel.FromTables` continues to accept a table union.
|
|
20
|
+
|
|
21
|
+
For handwritten annotations, use `Spec.Spec<{ readonly notes: typeof notesGroup }>` or `DatabaseSchema.DatabaseSchema<{ readonly notes: typeof notesTable }>` in place of the corresponding member-union parameter.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 2c379cf: Fix function error types widening to `any` when `exactOptionalPropertyTypes` is disabled and no `error` schema is declared. Function refs, handlers, clients, and test helpers now preserve precise error channels under either setting, which may reveal application type errors previously hidden by `any`.
|
|
26
|
+
|
|
3
27
|
## 10.0.0-next.22
|
|
4
28
|
|
|
5
29
|
### Major Changes
|
|
@@ -21,7 +21,9 @@ export type ArgsFields = {
|
|
|
21
21
|
export interface ArgsSchema<ArgsFields_ extends ArgsFields> extends Schema.Codec<any, any> {
|
|
22
22
|
readonly fields: ArgsFields_;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Erased structural view used after the exact field map is no longer needed.
|
|
26
|
+
*/
|
|
25
27
|
export type AnyArgsSchema = ArgsSchema<ArgsFields>;
|
|
26
28
|
export type FunctionProvenance = Data.TaggedEnum<{
|
|
27
29
|
Confect: {
|
|
@@ -36,12 +38,11 @@ export type FunctionProvenance = Data.TaggedEnum<{
|
|
|
36
38
|
};
|
|
37
39
|
}>;
|
|
38
40
|
/**
|
|
39
|
-
* The declaration shape of a Confect function—orthogonal to both the
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* composed.
|
|
41
|
+
* The declaration shape of a Confect function—orthogonal to both the provenance
|
|
42
|
+
* origin (Confect vs Convex) and the function type (query/mutation/action). A
|
|
43
|
+
* `Standard` function declares its args fields and returns schema directly; a
|
|
44
|
+
* `Paginated` function declares user-args fields and an item schema from which
|
|
45
|
+
* the Convex-facing `args`/`returns` are composed.
|
|
45
46
|
*/
|
|
46
47
|
export type ConfectKind = Standard | Paginated;
|
|
47
48
|
export interface Standard {
|
|
@@ -49,11 +50,17 @@ export interface Standard {
|
|
|
49
50
|
}
|
|
50
51
|
export interface Paginated<UserArgsFields_ extends ArgsFields = ArgsFields, Item extends Schema.Codec<any, any> = Schema.Codec<any, any>> {
|
|
51
52
|
readonly _tag: "Paginated";
|
|
52
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* User-declared args—no `paginationOpts`.
|
|
55
|
+
*/
|
|
53
56
|
readonly userArgs: ArgsSchema<UserArgsFields_>;
|
|
54
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Page element schema.
|
|
59
|
+
*/
|
|
55
60
|
readonly item: Item;
|
|
56
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Mutable array of items—the page decode target.
|
|
63
|
+
*/
|
|
57
64
|
readonly page: Schema.Codec<any, any>;
|
|
58
65
|
}
|
|
59
66
|
export interface Confect<ArgsFields_ extends ArgsFields, Returns extends Schema.Codec<any, any>, Error extends Schema.Codec<any, any> = never, Kind extends ConfectKind = ConfectKind> {
|
|
@@ -156,24 +163,26 @@ export declare const FunctionProvenance: {
|
|
|
156
163
|
}, "_tag">;
|
|
157
164
|
};
|
|
158
165
|
/**
|
|
159
|
-
* Build a `Confect` provenance from lazy args-fields and schema thunks.
|
|
160
|
-
* `
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* assembled `_generated/spec.ts` cheap—no
|
|
164
|
-
*
|
|
166
|
+
* Build a `Confect` provenance from lazy args-fields and schema thunks. `args`,
|
|
167
|
+
* `returns`, and `error` are exposed as sync lazy memoised getters (via
|
|
168
|
+
* {@link Lazy.defineProperty}) that only evaluate their thunk on first access,
|
|
169
|
+
* mirroring how `Table` defers `Fields`/`Doc`. This keeps importing the
|
|
170
|
+
* assembled `_generated/spec.ts` cheap—no
|
|
171
|
+
* `Schema.Struct(...)`/`Schema.Array(...)` work runs at module load; it is
|
|
172
|
+
* deferred to the first invocation that actually compiles validators or runs a
|
|
173
|
+
* codec.
|
|
165
174
|
*
|
|
166
175
|
* The object is built by hand rather than through `FunctionProvenance.Confect`
|
|
167
176
|
* because the `Data` constructor copies its input with `Object.assign`, which
|
|
168
|
-
* would force the getters at construction time and defeat the laziness.
|
|
169
|
-
*
|
|
170
|
-
*
|
|
177
|
+
* would force the getters at construction time and defeat the laziness. `error`
|
|
178
|
+
* is only installed when an `errorThunk` is provided, so its absence is
|
|
179
|
+
* observable via `"error" in provenance` without forcing anything; nothing
|
|
171
180
|
* relies on `Data`'s structural `Equal`/`Hash` for provenance values.
|
|
172
181
|
*/
|
|
173
182
|
export declare const Confect: <const ArgsFields_ extends ArgsFields, Returns extends Schema.Codec<any, any>, Error extends Schema.Codec<any, any> = never>(args: () => ArgsFields_, returns: () => Returns, error?: () => Error) => Confect<ArgsFields_, Returns, Error, Standard>;
|
|
174
183
|
/**
|
|
175
|
-
* The composed args schema of a paginated query: the user-declared fields
|
|
176
|
-
*
|
|
184
|
+
* The composed args schema of a paginated query: the user-declared fields plus
|
|
185
|
+
* the `paginationOpts` field managed by Convex's pagination protocol.
|
|
177
186
|
*
|
|
178
187
|
* The fields-first representation keeps the user-declared map available for
|
|
179
188
|
* type-level composition without reconstructing it from an erased schema.
|
|
@@ -183,8 +192,8 @@ export type PaginatedArgsFields<UserArgsFields extends ArgsFields> = UserArgsFie
|
|
|
183
192
|
};
|
|
184
193
|
export type PaginatedArgs<UserArgsFields extends ArgsFields> = Schema.Struct<PaginatedArgsFields<UserArgsFields>>;
|
|
185
194
|
/**
|
|
186
|
-
* The composed returns schema of a paginated query: a `PaginationResult` of
|
|
187
|
-
*
|
|
195
|
+
* The composed returns schema of a paginated query: a `PaginationResult` of the
|
|
196
|
+
* item schema. Same deferred-conditional device as {@link PaginatedArgs}.
|
|
188
197
|
*/
|
|
189
198
|
export type PaginatedReturns<Item extends Schema.Codec<any, any>> = PaginationResult.PaginationResult<Item> extends infer ComposedReturns extends Schema.Codec<any, any> ? ComposedReturns : never;
|
|
190
199
|
export interface ConfectPaginated<UserArgsFields extends ArgsFields, Item extends Schema.Codec<any, any>, Error extends Schema.Codec<any, any> = never> extends Confect<PaginatedArgsFields<UserArgsFields>, PaginatedReturns<Item>, Error, Paginated<UserArgsFields, Item>> {
|
|
@@ -194,8 +203,8 @@ export interface AnyConfectPaginated extends AnyConfect {
|
|
|
194
203
|
}
|
|
195
204
|
/**
|
|
196
205
|
* Build the provenance of a paginated query from lazy schema thunks, with the
|
|
197
|
-
* same laziness contract as {@link Confect}. The user-facing schemas live on
|
|
198
|
-
*
|
|
206
|
+
* same laziness contract as {@link Confect}. The user-facing schemas live on the
|
|
207
|
+
* `Paginated` kind (`kind.userArgs`, `kind.item`, `kind.page`)—the kind
|
|
199
208
|
* container is built eagerly (it is cheap) while the schemas inside it stay
|
|
200
209
|
* lazy. The composed Convex-facing `args`/`returns` are derived lazily from
|
|
201
210
|
* them: `args` spreads the user fields plus `paginationOpts`, and `returns`
|
|
@@ -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,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,GAAG,EAAE,WAAW,GAAG,MAA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SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,CAC5C,SAAQ,OAAO,CACf,mBAAmB,CAAC,cAAc,CAAC,EACnC,gBAAgB,CAAC,IAAI,CAAC,EACtB,KAAK,EACL,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,CAChC;CAAG;AAEJ,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,CAAC,eAAe,SAAS,UAAU,EACxC,IAAI,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EACnC,KAAK,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,YAElC,MAAM,eAAe,QACzB,MAAM,IAAI,UACR,MAAM,KAAK,KAClB,gBAAgB,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,CAkC/C,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,mBAAmB,EAAE,OAAO;;sBA3MnD,mBAAmB;yBAChB,GAAG;CAgNhB,CAAC"}
|
|
@@ -14,18 +14,20 @@ var FunctionProvenance_exports = /* @__PURE__ */ __exportAll({
|
|
|
14
14
|
const FunctionProvenance = Data.taggedEnum();
|
|
15
15
|
const Standard = { _tag: "Standard" };
|
|
16
16
|
/**
|
|
17
|
-
* Build a `Confect` provenance from lazy args-fields and schema thunks.
|
|
18
|
-
* `
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* assembled `_generated/spec.ts` cheap—no
|
|
22
|
-
*
|
|
17
|
+
* Build a `Confect` provenance from lazy args-fields and schema thunks. `args`,
|
|
18
|
+
* `returns`, and `error` are exposed as sync lazy memoised getters (via
|
|
19
|
+
* {@link Lazy.defineProperty}) that only evaluate their thunk on first access,
|
|
20
|
+
* mirroring how `Table` defers `Fields`/`Doc`. This keeps importing the
|
|
21
|
+
* assembled `_generated/spec.ts` cheap—no
|
|
22
|
+
* `Schema.Struct(...)`/`Schema.Array(...)` work runs at module load; it is
|
|
23
|
+
* deferred to the first invocation that actually compiles validators or runs a
|
|
24
|
+
* codec.
|
|
23
25
|
*
|
|
24
26
|
* The object is built by hand rather than through `FunctionProvenance.Confect`
|
|
25
27
|
* because the `Data` constructor copies its input with `Object.assign`, which
|
|
26
|
-
* would force the getters at construction time and defeat the laziness.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
28
|
+
* would force the getters at construction time and defeat the laziness. `error`
|
|
29
|
+
* is only installed when an `errorThunk` is provided, so its absence is
|
|
30
|
+
* observable via `"error" in provenance` without forcing anything; nothing
|
|
29
31
|
* relies on `Data`'s structural `Equal`/`Hash` for provenance values.
|
|
30
32
|
*/
|
|
31
33
|
const Confect = (args, returns, error) => {
|
|
@@ -40,8 +42,8 @@ const Confect = (args, returns, error) => {
|
|
|
40
42
|
};
|
|
41
43
|
/**
|
|
42
44
|
* Build the provenance of a paginated query from lazy schema thunks, with the
|
|
43
|
-
* same laziness contract as {@link Confect}. The user-facing schemas live on
|
|
44
|
-
*
|
|
45
|
+
* same laziness contract as {@link Confect}. The user-facing schemas live on the
|
|
46
|
+
* `Paginated` kind (`kind.userArgs`, `kind.item`, `kind.page`)—the kind
|
|
45
47
|
* container is built eagerly (it is cheap) while the schemas inside it stay
|
|
46
48
|
* lazy. The composed Convex-facing `args`/`returns` are derived lazily from
|
|
47
49
|
* them: `args` spreads the user fields plus `paginationOpts`, and `returns`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionProvenance.js","names":["PaginationOptions.PaginationOptions","PaginationResult.PaginationResult"],"sources":["../src/FunctionProvenance.ts"],"sourcesContent":["import type { DefaultFunctionArgs } from \"convex/server\";\nimport * as Data from \"effect/Data\";\nimport * as Schema from \"effect/Schema\";\nimport * as Lazy from \"./Lazy\";\nimport * as PaginationOptions from \"./PaginationOptions\";\nimport * as PaginationResult from \"./PaginationResult\";\n\n/**\n * A field map accepted as Confect function args. Restricting each field to a\n * context-free codec means the struct assembled from the fields can always be\n * encoded and decoded synchronously at a Convex boundary.\n */\nexport type ArgsFields = {\n readonly [key: PropertyKey]: Schema.ConstraintCodec<any, any>;\n};\n\n/**\n * A struct-shaped Confect args schema that keeps its exact field map while\n * erasing the rest of `Schema.Struct`'s large implementation type. Decoded and\n * encoded args are derived directly from `ArgsFields_`; keeping the runtime\n * codec structural prevents every ref lookup from expanding the full Effect\n * schema type.\n */\nexport interface ArgsSchema<\n ArgsFields_ extends ArgsFields,\n> extends Schema.Codec<any, any> {\n readonly fields: ArgsFields_;\n}\n\n/** Erased structural view used after the exact field map is no longer needed. */\nexport type AnyArgsSchema = ArgsSchema<ArgsFields>;\n\nexport type FunctionProvenance = Data.TaggedEnum<{\n Confect: {\n args: AnyArgsSchema;\n returns: Schema.Codec<any, any>;\n error?: Schema.Codec<any, any>;\n kind: ConfectKind;\n };\n Convex: {\n \"~args\": DefaultFunctionArgs;\n \"~returns\": any;\n };\n}>;\n\n/**\n * The declaration shape of a Confect function—orthogonal to both the\n * provenance origin (Confect vs Convex) and the function type\n * (query/mutation/action). A `Standard` function declares its args fields and\n * returns schema directly; a `Paginated` function declares user-args fields\n * and an item schema from which the Convex-facing `args`/`returns` are\n * composed.\n */\nexport type ConfectKind = Standard | Paginated;\n\nexport interface Standard {\n readonly _tag: \"Standard\";\n}\n\nexport interface Paginated<\n UserArgsFields_ extends ArgsFields = ArgsFields,\n Item extends Schema.Codec<any, any> = Schema.Codec<any, any>,\n> {\n readonly _tag: \"Paginated\";\n /** User-declared args—no `paginationOpts`. */\n readonly userArgs: ArgsSchema<UserArgsFields_>;\n /** Page element schema. */\n readonly item: Item;\n /** Mutable array of items—the page decode target. */\n readonly page: Schema.Codec<any, any>;\n}\n\nexport interface Confect<\n ArgsFields_ extends ArgsFields,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n Kind extends ConfectKind = ConfectKind,\n> {\n readonly _tag: \"Confect\";\n readonly \"~ArgsFields\": ArgsFields_;\n readonly args: ArgsSchema<ArgsFields_>;\n readonly returns: Returns;\n readonly error?: Error;\n readonly kind: Kind;\n}\n\nexport interface AnyConfect {\n readonly _tag: \"Confect\";\n readonly args: AnyArgsSchema;\n readonly returns: Schema.Codec<any, any>;\n readonly error?: Schema.Codec<any, any>;\n readonly kind: ConfectKind;\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\nconst Standard: Standard = { _tag: \"Standard\" };\n\n/**\n * Build a `Confect` provenance from lazy args-fields and schema thunks.\n * `args`, `returns`, and `error` are exposed as sync lazy memoised getters\n * (via {@link Lazy.defineProperty}) that only evaluate their thunk on first\n * access, mirroring how `Table` defers `Fields`/`Doc`. This keeps importing the\n * assembled `_generated/spec.ts` cheap—no `Schema.Struct(...)`/`Schema.Array(...)` work runs at module load; it is deferred to the first\n * invocation that 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 const ArgsFields_ extends ArgsFields,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n args: () => ArgsFields_,\n returns: () => Returns,\n error?: () => Error,\n): Confect<ArgsFields_, Returns, Error, Standard> => {\n const provenance = { _tag: \"Confect\" as const, kind: Standard };\n\n Lazy.defineProperty(provenance, \"args\", () => Schema.Struct(args()));\n Lazy.defineProperty(provenance, \"returns\", returns);\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return provenance as Confect<ArgsFields_, Returns, Error, Standard>;\n};\n\n/**\n * The composed args schema of a paginated query: the user-declared fields\n * plus the `paginationOpts` field managed by Convex's pagination protocol.\n *\n * The fields-first representation keeps the user-declared map available for\n * type-level composition without reconstructing it from an erased schema.\n */\nexport type PaginatedArgsFields<UserArgsFields extends ArgsFields> =\n UserArgsFields & {\n readonly paginationOpts: typeof PaginationOptions.PaginationOptions;\n };\n\nexport type PaginatedArgs<UserArgsFields extends ArgsFields> = Schema.Struct<\n PaginatedArgsFields<UserArgsFields>\n>;\n\n/**\n * The composed returns schema of a paginated query: a `PaginationResult` of\n * the item schema. Same deferred-conditional device as {@link PaginatedArgs}.\n */\nexport type PaginatedReturns<Item extends Schema.Codec<any, any>> =\n PaginationResult.PaginationResult<Item> extends infer ComposedReturns extends\n Schema.Codec<any, any>\n ? ComposedReturns\n : never;\n\nexport interface ConfectPaginated<\n UserArgsFields extends ArgsFields,\n Item extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n> extends Confect<\n PaginatedArgsFields<UserArgsFields>,\n PaginatedReturns<Item>,\n Error,\n Paginated<UserArgsFields, Item>\n> {}\n\nexport interface AnyConfectPaginated extends AnyConfect {\n readonly kind: Paginated;\n}\n\n/**\n * Build the provenance of a paginated query from lazy schema thunks, with the\n * same laziness contract as {@link Confect}. The user-facing schemas live on\n * the `Paginated` kind (`kind.userArgs`, `kind.item`, `kind.page`)—the kind\n * container is built eagerly (it is cheap) while the schemas inside it stay\n * lazy. The composed Convex-facing `args`/`returns` are derived lazily from\n * them: `args` spreads the user fields plus `paginationOpts`, and `returns`\n * wraps the item in `PaginationResult`. Composition living here means the\n * composed schemas can never drift from the stored user schemas.\n */\nexport const ConfectPaginated = <\n const UserArgsFields_ extends ArgsFields,\n Item extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n userArgs: () => UserArgsFields_,\n item: () => Item,\n error?: () => Error,\n): ConfectPaginated<UserArgsFields_, Item, Error> => {\n const kind = { _tag: \"Paginated\" as const };\n const paginatedKind = kind as Paginated<UserArgsFields_, Item>;\n\n Lazy.defineProperty(kind, \"userArgs\", () => Schema.Struct(userArgs()));\n Lazy.defineProperty(kind, \"item\", item);\n Lazy.defineProperty(kind, \"page\", () =>\n Schema.mutable(Schema.Array(paginatedKind.item)),\n );\n\n const provenance = { _tag: \"Confect\" as const, kind: paginatedKind };\n const self = provenance as ConfectPaginated<UserArgsFields_, Item, Error>;\n\n Lazy.defineProperty(provenance, \"args\", () => {\n const fields = paginatedKind.userArgs.fields;\n if (\"paginationOpts\" in fields) {\n throw new globalThis.Error(\n \"A paginated query's args schema must not declare `paginationOpts`—\" +\n \"it is added automatically from the `PaginationOptions` schema\",\n );\n }\n return Schema.Struct({\n ...fields,\n paginationOpts: PaginationOptions.PaginationOptions,\n });\n });\n Lazy.defineProperty(provenance, \"returns\", () =>\n PaginationResult.PaginationResult(paginatedKind.item),\n );\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return self;\n};\n\nexport const Convex = <Args extends DefaultFunctionArgs, Returns>() =>\n FunctionProvenance.Convex(\n {} as {\n \"~args\": Args;\n \"~returns\": Returns;\n },\n );\n"],"mappings":";;;;;;;;;;;;;AAsGA,MAAa,qBAAqB,KAAK,WAA+B;AAEtE,MAAM,WAAqB,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;AAiB9C,MAAa,WAKX,MACA,SACA,UACmD;CACnD,MAAM,aAAa;EAAE,MAAM;EAAoB,MAAM;CAAS;CAE9D,eAAoB,YAAY,cAAc,OAAO,OAAO,KAAK,CAAC,CAAC;CACnE,eAAoB,YAAY,WAAW,OAAO;CAClD,IAAI,UAAU,KAAA,GACZ,eAAoB,YAAY,SAAS,KAAK;CAGhD,OAAO;AACT;;;;;;;;;;;AAqDA,MAAa,oBAKX,UACA,MACA,UACmD;CACnD,MAAM,OAAO,EAAE,MAAM,YAAqB;CAC1C,MAAM,gBAAgB;CAEtB,eAAoB,MAAM,kBAAkB,OAAO,OAAO,SAAS,CAAC,CAAC;CACrE,eAAoB,MAAM,QAAQ,IAAI;CACtC,eAAoB,MAAM,cACxB,OAAO,QAAQ,OAAO,MAAM,cAAc,IAAI,CAAC,CACjD;CAEA,MAAM,aAAa;EAAE,MAAM;EAAoB,MAAM;CAAc;CACnE,MAAM,OAAO;CAEb,eAAoB,YAAY,cAAc;EAC5C,MAAM,SAAS,cAAc,SAAS;EACtC,IAAI,oBAAoB,QACtB,MAAM,IAAI,WAAW,MACnB,iIAEF;EAEF,OAAO,OAAO,OAAO;GACnB,GAAG;GACH,gBAAgBA;EAClB,CAAC;CACH,CAAC;CACD,eAAoB,YAAY,iBAC9BC,iBAAkC,cAAc,IAAI,CACtD;CACA,IAAI,UAAU,KAAA,GACZ,eAAoB,YAAY,SAAS,KAAK;CAGhD,OAAO;AACT;AAEA,MAAa,eACX,mBAAmB,OACjB,CAAC,CAIH"}
|
|
1
|
+
{"version":3,"file":"FunctionProvenance.js","names":["PaginationOptions.PaginationOptions","PaginationResult.PaginationResult"],"sources":["../src/FunctionProvenance.ts"],"sourcesContent":["import type { DefaultFunctionArgs } from \"convex/server\";\nimport * as Data from \"effect/Data\";\nimport * as Schema from \"effect/Schema\";\nimport * as Lazy from \"./Lazy\";\nimport * as PaginationOptions from \"./PaginationOptions\";\nimport * as PaginationResult from \"./PaginationResult\";\n\n/**\n * A field map accepted as Confect function args. Restricting each field to a\n * context-free codec means the struct assembled from the fields can always be\n * encoded and decoded synchronously at a Convex boundary.\n */\nexport type ArgsFields = {\n readonly [key: PropertyKey]: Schema.ConstraintCodec<any, any>;\n};\n\n/**\n * A struct-shaped Confect args schema that keeps its exact field map while\n * erasing the rest of `Schema.Struct`'s large implementation type. Decoded and\n * encoded args are derived directly from `ArgsFields_`; keeping the runtime\n * codec structural prevents every ref lookup from expanding the full Effect\n * schema type.\n */\nexport interface ArgsSchema<\n ArgsFields_ extends ArgsFields,\n> extends Schema.Codec<any, any> {\n readonly fields: ArgsFields_;\n}\n\n/**\n * Erased structural view used after the exact field map is no longer needed.\n */\nexport type AnyArgsSchema = ArgsSchema<ArgsFields>;\n\nexport type FunctionProvenance = Data.TaggedEnum<{\n Confect: {\n args: AnyArgsSchema;\n returns: Schema.Codec<any, any>;\n error?: Schema.Codec<any, any>;\n kind: ConfectKind;\n };\n Convex: {\n \"~args\": DefaultFunctionArgs;\n \"~returns\": any;\n };\n}>;\n\n/**\n * The declaration shape of a Confect function—orthogonal to both the provenance\n * origin (Confect vs Convex) and the function type (query/mutation/action). A\n * `Standard` function declares its args fields and returns schema directly; a\n * `Paginated` function declares user-args fields and an item schema from which\n * the Convex-facing `args`/`returns` are composed.\n */\nexport type ConfectKind = Standard | Paginated;\n\nexport interface Standard {\n readonly _tag: \"Standard\";\n}\n\nexport interface Paginated<\n UserArgsFields_ extends ArgsFields = ArgsFields,\n Item extends Schema.Codec<any, any> = Schema.Codec<any, any>,\n> {\n readonly _tag: \"Paginated\";\n /**\n * User-declared args—no `paginationOpts`.\n */\n readonly userArgs: ArgsSchema<UserArgsFields_>;\n /**\n * Page element schema.\n */\n readonly item: Item;\n /**\n * Mutable array of items—the page decode target.\n */\n readonly page: Schema.Codec<any, any>;\n}\n\nexport interface Confect<\n ArgsFields_ extends ArgsFields,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n Kind extends ConfectKind = ConfectKind,\n> {\n readonly _tag: \"Confect\";\n readonly \"~ArgsFields\": ArgsFields_;\n readonly args: ArgsSchema<ArgsFields_>;\n readonly returns: Returns;\n readonly error?: Error;\n readonly kind: Kind;\n}\n\nexport interface AnyConfect {\n readonly _tag: \"Confect\";\n readonly args: AnyArgsSchema;\n readonly returns: Schema.Codec<any, any>;\n readonly error?: Schema.Codec<any, any>;\n readonly kind: ConfectKind;\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\nconst Standard: Standard = { _tag: \"Standard\" };\n\n/**\n * Build a `Confect` provenance from lazy args-fields and schema thunks. `args`,\n * `returns`, and `error` are exposed as sync lazy memoised getters (via\n * {@link Lazy.defineProperty}) that only evaluate their thunk on first access,\n * mirroring how `Table` defers `Fields`/`Doc`. This keeps importing the\n * assembled `_generated/spec.ts` cheap—no\n * `Schema.Struct(...)`/`Schema.Array(...)` work runs at module load; it is\n * deferred to the first invocation that actually compiles validators or runs a\n * 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. `error`\n * is only installed when an `errorThunk` is provided, so its absence is\n * 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 const ArgsFields_ extends ArgsFields,\n Returns extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n args: () => ArgsFields_,\n returns: () => Returns,\n error?: () => Error,\n): Confect<ArgsFields_, Returns, Error, Standard> => {\n const provenance = { _tag: \"Confect\" as const, kind: Standard };\n\n Lazy.defineProperty(provenance, \"args\", () => Schema.Struct(args()));\n Lazy.defineProperty(provenance, \"returns\", returns);\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return provenance as Confect<ArgsFields_, Returns, Error, Standard>;\n};\n\n/**\n * The composed args schema of a paginated query: the user-declared fields plus\n * the `paginationOpts` field managed by Convex's pagination protocol.\n *\n * The fields-first representation keeps the user-declared map available for\n * type-level composition without reconstructing it from an erased schema.\n */\nexport type PaginatedArgsFields<UserArgsFields extends ArgsFields> =\n UserArgsFields & {\n readonly paginationOpts: typeof PaginationOptions.PaginationOptions;\n };\n\nexport type PaginatedArgs<UserArgsFields extends ArgsFields> = Schema.Struct<\n PaginatedArgsFields<UserArgsFields>\n>;\n\n/**\n * The composed returns schema of a paginated query: a `PaginationResult` of the\n * item schema. Same deferred-conditional device as {@link PaginatedArgs}.\n */\nexport type PaginatedReturns<Item extends Schema.Codec<any, any>> =\n PaginationResult.PaginationResult<Item> extends infer ComposedReturns extends\n Schema.Codec<any, any>\n ? ComposedReturns\n : never;\n\nexport interface ConfectPaginated<\n UserArgsFields extends ArgsFields,\n Item extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n> extends Confect<\n PaginatedArgsFields<UserArgsFields>,\n PaginatedReturns<Item>,\n Error,\n Paginated<UserArgsFields, Item>\n> {}\n\nexport interface AnyConfectPaginated extends AnyConfect {\n readonly kind: Paginated;\n}\n\n/**\n * Build the provenance of a paginated query from lazy schema thunks, with the\n * same laziness contract as {@link Confect}. The user-facing schemas live on the\n * `Paginated` kind (`kind.userArgs`, `kind.item`, `kind.page`)—the kind\n * container is built eagerly (it is cheap) while the schemas inside it stay\n * lazy. The composed Convex-facing `args`/`returns` are derived lazily from\n * them: `args` spreads the user fields plus `paginationOpts`, and `returns`\n * wraps the item in `PaginationResult`. Composition living here means the\n * composed schemas can never drift from the stored user schemas.\n */\nexport const ConfectPaginated = <\n const UserArgsFields_ extends ArgsFields,\n Item extends Schema.Codec<any, any>,\n Error extends Schema.Codec<any, any> = never,\n>(\n userArgs: () => UserArgsFields_,\n item: () => Item,\n error?: () => Error,\n): ConfectPaginated<UserArgsFields_, Item, Error> => {\n const kind = { _tag: \"Paginated\" as const };\n const paginatedKind = kind as Paginated<UserArgsFields_, Item>;\n\n Lazy.defineProperty(kind, \"userArgs\", () => Schema.Struct(userArgs()));\n Lazy.defineProperty(kind, \"item\", item);\n Lazy.defineProperty(kind, \"page\", () =>\n Schema.mutable(Schema.Array(paginatedKind.item)),\n );\n\n const provenance = { _tag: \"Confect\" as const, kind: paginatedKind };\n const self = provenance as ConfectPaginated<UserArgsFields_, Item, Error>;\n\n Lazy.defineProperty(provenance, \"args\", () => {\n const fields = paginatedKind.userArgs.fields;\n if (\"paginationOpts\" in fields) {\n throw new globalThis.Error(\n \"A paginated query's args schema must not declare `paginationOpts`—\" +\n \"it is added automatically from the `PaginationOptions` schema\",\n );\n }\n return Schema.Struct({\n ...fields,\n paginationOpts: PaginationOptions.PaginationOptions,\n });\n });\n Lazy.defineProperty(provenance, \"returns\", () =>\n PaginationResult.PaginationResult(paginatedKind.item),\n );\n if (error !== undefined) {\n Lazy.defineProperty(provenance, \"error\", error);\n }\n\n return self;\n};\n\nexport const Convex = <Args extends DefaultFunctionArgs, Returns>() =>\n FunctionProvenance.Convex(\n {} as {\n \"~args\": Args;\n \"~returns\": Returns;\n },\n );\n"],"mappings":";;;;;;;;;;;;;AA6GA,MAAa,qBAAqB,KAAK,WAA+B;AAEtE,MAAM,WAAqB,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;;AAmB9C,MAAa,WAKX,MACA,SACA,UACmD;CACnD,MAAM,aAAa;EAAE,MAAM;EAAoB,MAAM;CAAS;CAE9D,eAAoB,YAAY,cAAc,OAAO,OAAO,KAAK,CAAC,CAAC;CACnE,eAAoB,YAAY,WAAW,OAAO;CAClD,IAAI,UAAU,KAAA,GACZ,eAAoB,YAAY,SAAS,KAAK;CAGhD,OAAO;AACT;;;;;;;;;;;AAqDA,MAAa,oBAKX,UACA,MACA,UACmD;CACnD,MAAM,OAAO,EAAE,MAAM,YAAqB;CAC1C,MAAM,gBAAgB;CAEtB,eAAoB,MAAM,kBAAkB,OAAO,OAAO,SAAS,CAAC,CAAC;CACrE,eAAoB,MAAM,QAAQ,IAAI;CACtC,eAAoB,MAAM,cACxB,OAAO,QAAQ,OAAO,MAAM,cAAc,IAAI,CAAC,CACjD;CAEA,MAAM,aAAa;EAAE,MAAM;EAAoB,MAAM;CAAc;CACnE,MAAM,OAAO;CAEb,eAAoB,YAAY,cAAc;EAC5C,MAAM,SAAS,cAAc,SAAS;EACtC,IAAI,oBAAoB,QACtB,MAAM,IAAI,WAAW,MACnB,iIAEF;EAEF,OAAO,OAAO,OAAO;GACnB,GAAG;GACH,gBAAgBA;EAClB,CAAC;CACH,CAAC;CACD,eAAoB,YAAY,iBAC9BC,iBAAkC,cAAc,IAAI,CACtD;CACA,IAAI,UAAU,KAAA,GACZ,eAAoB,YAAY,SAAS,KAAK;CAGhD,OAAO;AACT;AAEA,MAAa,eACX,mBAAmB,OACjB,CAAC,CAIH"}
|
package/dist/FunctionSpec.d.ts
CHANGED
|
@@ -39,7 +39,9 @@ export type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> = Function
|
|
|
39
39
|
export type GetFunctionProvenance<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["functionProvenance"];
|
|
40
40
|
export type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["name"];
|
|
41
41
|
export type MiddlewareSpecs<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["middlewareSpecs"][number];
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The field map declared by a Confect-provenance spec.
|
|
44
|
+
*/
|
|
43
45
|
export type ArgsFields<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
44
46
|
readonly functionProvenance: {
|
|
45
47
|
readonly _tag: "Confect";
|
|
@@ -50,7 +52,9 @@ export type ArgsFields<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ exten
|
|
|
50
52
|
readonly _tag: "Confect";
|
|
51
53
|
};
|
|
52
54
|
} ? FunctionProvenance.ArgsFields : never;
|
|
53
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* The args schema assembled from a Confect-provenance spec's field map.
|
|
57
|
+
*/
|
|
54
58
|
export type ArgsSchema<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
55
59
|
readonly functionProvenance: {
|
|
56
60
|
readonly _tag: "Confect";
|
|
@@ -71,9 +75,9 @@ export type ReturnsSchema<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ ex
|
|
|
71
75
|
export type ErrorSchema<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
72
76
|
readonly functionProvenance: {
|
|
73
77
|
readonly _tag: "Confect";
|
|
74
|
-
readonly error?: infer ErrorSchema_
|
|
78
|
+
readonly error?: infer ErrorSchema_;
|
|
75
79
|
};
|
|
76
|
-
} ? ErrorSchema_ : never;
|
|
80
|
+
} ? Extract<ErrorSchema_, Schema.Codec<any, any>> : never;
|
|
77
81
|
export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
78
82
|
readonly functionProvenance: {
|
|
79
83
|
readonly _tag: "Confect";
|
|
@@ -114,10 +118,10 @@ export type WithoutName<FunctionSpec_ extends AnyWithProps, Name_ extends Name<F
|
|
|
114
118
|
readonly name: Name_;
|
|
115
119
|
}>;
|
|
116
120
|
/**
|
|
117
|
-
* `Schema.Struct` fields that must not declare `paginationOpts`. Used to
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
+
* `Schema.Struct` fields that must not declare `paginationOpts`. Used to reject
|
|
122
|
+
* a user args schema that redeclares the field the paginated constructors add
|
|
123
|
+
* themselves; the check reports at the `args` thunk with an unsatisfiable type
|
|
124
|
+
* when violated.
|
|
121
125
|
*/
|
|
122
126
|
type ForbidPaginationOpts<UserArgsFields extends FunctionProvenance.ArgsFields> = "paginationOpts" extends keyof UserArgsFields ? {
|
|
123
127
|
readonly paginationOpts: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.d.ts","sourceRoot":"","sources":["../src/FunctionSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,oBAAoB,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,KAAK,MAA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,MAAM;;;0FA6B5B,CAAC;AACF,eAAO,MAAM,oBAAoB,GAnC7B,CAAC,SAAS,0BAA0B;;;YAGnC,cAEI,KAAK,SAAS,MAAM;;;wFAiC5B,CAAC;AACF,eAAO,MAAM,sBAAsB,GAvC/B,CAAC,SAAS,0BAA0B;;;cAGnC,cAEI,KAAK,SAAS,MAAM;;;0FAqC5B,CAAC;AACF,eAAO,MAAM,kBAAkB,GA3C3B,CAAC,SAAS,0BAA0B;;;YAGnC,cAEI,KAAK,SAAS,MAAM;;;wFAyC5B,CAAC;AACF,eAAO,MAAM,oBAAoB,GA/C7B,CAAC,SAAS,0BAA0B;;;cAGnC,cAEI,KAAK,SAAS,MAAM;;;0FA6C5B,CAAC;AACF,eAAO,MAAM,sBAAsB,GAnD/B,CAAC,SAAS,0BAA0B;;;YAGnC,cAEI,KAAK,SAAS,MAAM;;;wFAiD5B,CAAC;AACF,eAAO,MAAM,wBAAwB,GAvDjC,CAAC,SAAS,0BAA0B;;;cAGnC,cAEI,KAAK,SAAS,MAAM;;;0FAqD5B,CAAC"}
|
package/dist/FunctionSpec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionSpec.js","names":["FunctionProvenance.Confect","FunctionProvenance.ConfectPaginated","RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction","FunctionProvenance.Convex"],"sources":["../src/FunctionSpec.ts"],"sourcesContent":["import type * as MiddlewareAttachment from \"./MiddlewareAttachment\";\nimport type {\n DefaultFunctionArgs,\n FunctionType,\n FunctionVisibility,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"convex/server\";\nimport type * as Schema from \"effect/Schema\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport type * as MiddlewareSpec from \"./MiddlewareSpec\";\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 MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n readonly middlewareSpecs: ReadonlyArray<MiddlewareSpecs_>;\n readonly middlewareAttachments: ReadonlyArray<\n MiddlewareAttachment.MiddlewareAttachment<MiddlewareSpecs_>\n >;\n}\n\nexport interface Builder<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance_,\n MiddlewareSpecs_\n> {\n middleware<MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec>(\n middlewareSpec: MiddlewareSpec_ &\n MiddlewareSpec.ValidateFunctionAttach<\n MiddlewareSpec_,\n RuntimeAndFunctionType_,\n FunctionProvenance_,\n MiddlewareSpecs_\n >,\n ...options: MiddlewareAttachment.Args<NoInfer<MiddlewareSpec_>>\n ): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance_,\n MiddlewareSpecs_ | MiddlewareSpec_\n >;\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 MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect,\n MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex,\n MiddlewareSpec.AnyMiddlewareSpec\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 MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance,\n MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_,\n MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type GetFunctionProvenance<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionProvenance\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type MiddlewareSpecs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"middlewareSpecs\"][number];\n\n/** The field map declared by a Confect-provenance spec. */\nexport type ArgsFields<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly \"~ArgsFields\": infer ArgsFields_ extends\n FunctionProvenance.ArgsFields;\n };\n }\n ? ArgsFields_\n : FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n }\n ? FunctionProvenance.ArgsFields\n : never;\n\n/** The args schema assembled from a Confect-provenance spec's field map. */\nexport type ArgsSchema<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly \"~ArgsFields\": infer ArgsFields_ extends\n FunctionProvenance.ArgsFields;\n };\n }\n ? Schema.Struct<ArgsFields_>\n : FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly args: infer ArgsSchema_ extends\n FunctionProvenance.AnyArgsSchema;\n };\n }\n ? ArgsSchema_\n : never;\n\nexport type ReturnsSchema<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_\n : never;\n\nexport type ErrorSchema<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly error?: infer ErrorSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ErrorSchema_\n : never;\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n}\n ? ArgsSchema<FunctionSpec_>[\"Type\"]\n : GetFunctionProvenance<FunctionSpec_> extends FunctionProvenance.Convex<\n infer Args_,\n any\n >\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n }\n ? ReturnsSchema<FunctionSpec_>[\"Type\"]\n : GetFunctionProvenance<FunctionSpec_> extends FunctionProvenance.Convex<\n any,\n infer Returns_\n >\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n }\n ? ArgsSchema<FunctionSpec_>[\"Encoded\"]\n : GetFunctionProvenance<FunctionSpec_> extends FunctionProvenance.Convex<\n infer Args_,\n any\n >\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n }\n ? ReturnsSchema<FunctionSpec_>[\"Encoded\"]\n : GetFunctionProvenance<FunctionSpec_> extends FunctionProvenance.Convex<\n any,\n infer Returns_\n >\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> =\n ErrorSchema<FunctionSpec_>[\"Type\"];\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n ErrorSchema<FunctionSpec_>[\"Encoded\"];\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 get middlewareSpecs() {\n return this.middlewareAttachments.map(({ spec }) => spec);\n },\n\n middleware(\n this: AnyWithProps,\n middlewareSpec: MiddlewareSpec.AnyMiddlewareSpec,\n ...options: ReadonlyArray<unknown>\n ) {\n if (this.functionProvenance._tag === \"Convex\") {\n throw new Error(\n `Plain Convex function \"${this.name}\" cannot have middleware`,\n );\n }\n const functionType = this.runtimeAndFunctionType.functionType;\n if (!middlewareSpec.functionTypes[functionType]) {\n throw new Error(\n `Middleware \"${middlewareSpec.key}\" does not declare function type \"${functionType}\" of function \"${this.name}\"`,\n );\n }\n if (\n !(\"options\" in middlewareSpec) &&\n this.middlewareAttachments.some(\n ({ spec }) => spec.key === middlewareSpec.key,\n )\n ) {\n throw new Error(\n `Middleware \"${middlewareSpec.key}\" is already attached to function \"${this.name}\"`,\n );\n }\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType: this.runtimeAndFunctionType,\n functionVisibility: this.functionVisibility,\n name: this.name,\n functionProvenance: this.functionProvenance,\n middlewareAttachments: [\n ...this.middlewareAttachments,\n { spec: middlewareSpec, options: options[0] },\n ],\n });\n },\n} satisfies ThisType<AnyWithProps>;\n\ninterface Options {\n readonly name: string;\n readonly args?: () => FunctionProvenance.ArgsFields;\n readonly returns: () => Schema.Codec<any, any>;\n readonly error?: () => Schema.Codec<any, any>;\n}\n\nconst make = <\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n>(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n) => {\n function makeSpec<\n const Name_ extends string,\n const ArgsFields_ extends FunctionProvenance.ArgsFields,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >(options: {\n name: Name_;\n args: () => ArgsFields_;\n returns: () => Returns_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<ArgsFields_, Returns_, Error_>\n >;\n function makeSpec<\n const Name_ extends string,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >(options: {\n name: Name_;\n args?: never;\n returns: () => Returns_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<{}, Returns_, Error_>\n >;\n function makeSpec({ name, args, returns, error }: Options) {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance:\n args === undefined\n ? FunctionProvenance.Confect(() => ({}), returns, error)\n : FunctionProvenance.Confect(args, returns, error),\n middlewareAttachments: [],\n });\n }\n\n return makeSpec;\n};\n\n/**\n * `Schema.Struct` fields that must not declare `paginationOpts`. Used to\n * reject a user args schema that redeclares the field the paginated\n * constructors add themselves; the check reports at the `args` thunk with an\n * unsatisfiable type when violated.\n */\ntype ForbidPaginationOpts<\n UserArgsFields extends FunctionProvenance.ArgsFields,\n> = \"paginationOpts\" extends keyof UserArgsFields\n ? { readonly paginationOpts: never }\n : unknown;\n\ninterface PaginatedOptions {\n readonly name: string;\n readonly args?: () => FunctionProvenance.ArgsFields;\n readonly item: () => Schema.Codec<any, any>;\n readonly error?: () => Schema.Codec<any, any>;\n}\n\nconst makePaginated = <\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n>(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n) => {\n function makeSpec<\n const Name_ extends string,\n const UserArgsFields_ extends FunctionProvenance.ArgsFields,\n Item_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >(options: {\n name: Name_;\n args: () => UserArgsFields_ & ForbidPaginationOpts<UserArgsFields_>;\n item: () => Item_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.ConfectPaginated<UserArgsFields_, Item_, Error_>\n >;\n function makeSpec<\n const Name_ extends string,\n Item_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >(options: {\n name: Name_;\n args?: never;\n item: () => Item_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.ConfectPaginated<{}, Item_, Error_>\n >;\n function makeSpec({ name, args, item, error }: PaginatedOptions) {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance:\n args === undefined\n ? FunctionProvenance.ConfectPaginated(() => ({}), item, error)\n : FunctionProvenance.ConfectPaginated(args, item, error),\n middlewareAttachments: [],\n });\n }\n\n return makeSpec;\n};\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicPaginatedQuery = makePaginated(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const internalPaginatedQuery = makePaginated(\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 extends DefaultFunctionArgs, any>\n ? A\n : F extends RegisteredMutation<\n any,\n infer A extends DefaultFunctionArgs,\n any\n >\n ? A\n : F extends RegisteredAction<\n any,\n infer A extends DefaultFunctionArgs,\n any\n >\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 ): Builder<\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 middlewareAttachments: [],\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,MAAM;AA0QjC,MAAM,QAAQ;EACX,SAAS;CAEV,IAAI,kBAAkB;EACpB,OAAO,KAAK,sBAAsB,KAAK,EAAE,WAAW,IAAI;CAC1D;CAEA,WAEE,gBACA,GAAG,SACH;EACA,IAAI,KAAK,mBAAmB,SAAS,UACnC,MAAM,IAAI,MACR,0BAA0B,KAAK,KAAK,yBACtC;EAEF,MAAM,eAAe,KAAK,uBAAuB;EACjD,IAAI,CAAC,eAAe,cAAc,eAChC,MAAM,IAAI,MACR,eAAe,eAAe,IAAI,oCAAoC,aAAa,iBAAiB,KAAK,KAAK,EAChH;EAEF,IACE,EAAE,aAAa,mBACf,KAAK,sBAAsB,MACxB,EAAE,WAAW,KAAK,QAAQ,eAAe,GAC5C,GAEA,MAA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F;AAEA,MAAa,mBAAmB,KAC9BC,YACA,QACF;AACA,MAAa,qBAAqB,KAChCA,YACA,UACF;AAwCA,MAAM,cAMF,wBACA,8BASA,SAMG;CACH,kCAAkC,IAAI;CAEtC,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;EACzC;EACA;EACA;EACA,oBAAoBC,OAGlB;EACF,uBAAuB,CAAC;CAC1B,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","FunctionProvenance.ConfectPaginated","RuntimeAndFunctionType.ConvexQuery","RuntimeAndFunctionType.ConvexMutation","RuntimeAndFunctionType.ConvexAction","RuntimeAndFunctionType.NodeAction","FunctionProvenance.Convex"],"sources":["../src/FunctionSpec.ts"],"sourcesContent":["import type * as MiddlewareAttachment from \"./MiddlewareAttachment\";\nimport type {\n DefaultFunctionArgs,\n FunctionType,\n FunctionVisibility,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"convex/server\";\nimport type * as Schema from \"effect/Schema\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as FunctionProvenance from \"./FunctionProvenance\";\nimport { validateConfectFunctionIdentifier } from \"./Identifier\";\nimport type * as MiddlewareSpec from \"./MiddlewareSpec\";\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 MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtimeAndFunctionType: RuntimeAndFunctionType_;\n readonly functionVisibility: FunctionVisibility_;\n readonly name: Name_;\n readonly functionProvenance: FunctionProvenance_;\n readonly middlewareSpecs: ReadonlyArray<MiddlewareSpecs_>;\n readonly middlewareAttachments: ReadonlyArray<\n MiddlewareAttachment.MiddlewareAttachment<MiddlewareSpecs_>\n >;\n}\n\nexport interface Builder<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Name_ extends string,\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance_,\n MiddlewareSpecs_\n> {\n middleware<MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec>(\n middlewareSpec: MiddlewareSpec_ &\n MiddlewareSpec.ValidateFunctionAttach<\n MiddlewareSpec_,\n RuntimeAndFunctionType_,\n FunctionProvenance_,\n MiddlewareSpecs_\n >,\n ...options: MiddlewareAttachment.Args<NoInfer<MiddlewareSpec_>>\n ): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance_,\n MiddlewareSpecs_ | MiddlewareSpec_\n >;\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 MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyConfect extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConfect,\n MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyConvex extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance.AnyConvex,\n MiddlewareSpec.AnyMiddlewareSpec\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 MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyWithPropsWithFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n> extends FunctionSpec<\n RuntimeAndFunctionType_,\n FunctionVisibility,\n string,\n FunctionProvenance.FunctionProvenance,\n MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport interface AnyWithPropsWithFunctionProvenance<\n FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,\n> extends FunctionSpec<\n RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility,\n string,\n FunctionProvenance_,\n MiddlewareSpec.AnyMiddlewareSpec\n> {}\n\nexport type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"runtimeAndFunctionType\"];\n\nexport type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionVisibility\"];\n\nexport type GetFunctionProvenance<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"functionProvenance\"];\n\nexport type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_[\"name\"];\n\nexport type MiddlewareSpecs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_[\"middlewareSpecs\"][number];\n\n/**\n * The field map declared by a Confect-provenance spec.\n */\nexport type ArgsFields<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly \"~ArgsFields\": infer ArgsFields_ extends\n FunctionProvenance.ArgsFields;\n };\n }\n ? ArgsFields_\n : FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n }\n ? FunctionProvenance.ArgsFields\n : never;\n\n/**\n * The args schema assembled from a Confect-provenance spec's field map.\n */\nexport type ArgsSchema<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly \"~ArgsFields\": infer ArgsFields_ extends\n FunctionProvenance.ArgsFields;\n };\n }\n ? Schema.Struct<ArgsFields_>\n : FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly args: infer ArgsSchema_ extends\n FunctionProvenance.AnyArgsSchema;\n };\n }\n ? ArgsSchema_\n : never;\n\nexport type ReturnsSchema<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly returns: infer ReturnsSchema_ extends Schema.Codec<any, any>;\n };\n }\n ? ReturnsSchema_\n : never;\n\nexport type ErrorSchema<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: {\n readonly _tag: \"Confect\";\n readonly error?: infer ErrorSchema_;\n };\n }\n ? Extract<ErrorSchema_, Schema.Codec<any, any>>\n : never;\n\nexport type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n}\n ? ArgsSchema<FunctionSpec_>[\"Type\"]\n : GetFunctionProvenance<FunctionSpec_> extends FunctionProvenance.Convex<\n infer Args_,\n any\n >\n ? Args_\n : never;\n\nexport type Returns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n }\n ? ReturnsSchema<FunctionSpec_>[\"Type\"]\n : GetFunctionProvenance<FunctionSpec_> extends FunctionProvenance.Convex<\n any,\n infer Returns_\n >\n ? Awaited<Returns_>\n : never;\n\nexport type EncodedArgs<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n }\n ? ArgsSchema<FunctionSpec_>[\"Encoded\"]\n : GetFunctionProvenance<FunctionSpec_> extends FunctionProvenance.Convex<\n infer Args_,\n any\n >\n ? Args_\n : never;\n\nexport type EncodedReturns<FunctionSpec_ extends AnyWithProps> =\n FunctionSpec_ extends {\n readonly functionProvenance: { readonly _tag: \"Confect\" };\n }\n ? ReturnsSchema<FunctionSpec_>[\"Encoded\"]\n : GetFunctionProvenance<FunctionSpec_> extends FunctionProvenance.Convex<\n any,\n infer Returns_\n >\n ? Returns_\n : never;\n\nexport type Error<FunctionSpec_ extends AnyWithProps> =\n ErrorSchema<FunctionSpec_>[\"Type\"];\n\nexport type EncodedError<FunctionSpec_ extends AnyWithProps> =\n ErrorSchema<FunctionSpec_>[\"Encoded\"];\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 get middlewareSpecs() {\n return this.middlewareAttachments.map(({ spec }) => spec);\n },\n\n middleware(\n this: AnyWithProps,\n middlewareSpec: MiddlewareSpec.AnyMiddlewareSpec,\n ...options: ReadonlyArray<unknown>\n ) {\n if (this.functionProvenance._tag === \"Convex\") {\n throw new Error(\n `Plain Convex function \"${this.name}\" cannot have middleware`,\n );\n }\n const functionType = this.runtimeAndFunctionType.functionType;\n if (!middlewareSpec.functionTypes[functionType]) {\n throw new Error(\n `Middleware \"${middlewareSpec.key}\" does not declare function type \"${functionType}\" of function \"${this.name}\"`,\n );\n }\n if (\n !(\"options\" in middlewareSpec) &&\n this.middlewareAttachments.some(\n ({ spec }) => spec.key === middlewareSpec.key,\n )\n ) {\n throw new Error(\n `Middleware \"${middlewareSpec.key}\" is already attached to function \"${this.name}\"`,\n );\n }\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType: this.runtimeAndFunctionType,\n functionVisibility: this.functionVisibility,\n name: this.name,\n functionProvenance: this.functionProvenance,\n middlewareAttachments: [\n ...this.middlewareAttachments,\n { spec: middlewareSpec, options: options[0] },\n ],\n });\n },\n} satisfies ThisType<AnyWithProps>;\n\ninterface Options {\n readonly name: string;\n readonly args?: () => FunctionProvenance.ArgsFields;\n readonly returns: () => Schema.Codec<any, any>;\n readonly error?: () => Schema.Codec<any, any>;\n}\n\nconst make = <\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n>(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n) => {\n function makeSpec<\n const Name_ extends string,\n const ArgsFields_ extends FunctionProvenance.ArgsFields,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >(options: {\n name: Name_;\n args: () => ArgsFields_;\n returns: () => Returns_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<ArgsFields_, Returns_, Error_>\n >;\n function makeSpec<\n const Name_ extends string,\n Returns_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >(options: {\n name: Name_;\n args?: never;\n returns: () => Returns_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.Confect<{}, Returns_, Error_>\n >;\n function makeSpec({ name, args, returns, error }: Options) {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance:\n args === undefined\n ? FunctionProvenance.Confect(() => ({}), returns, error)\n : FunctionProvenance.Confect(args, returns, error),\n middlewareAttachments: [],\n });\n }\n\n return makeSpec;\n};\n\n/**\n * `Schema.Struct` fields that must not declare `paginationOpts`. Used to reject\n * a user args schema that redeclares the field the paginated constructors add\n * themselves; the check reports at the `args` thunk with an unsatisfiable type\n * when violated.\n */\ntype ForbidPaginationOpts<\n UserArgsFields extends FunctionProvenance.ArgsFields,\n> = \"paginationOpts\" extends keyof UserArgsFields\n ? { readonly paginationOpts: never }\n : unknown;\n\ninterface PaginatedOptions {\n readonly name: string;\n readonly args?: () => FunctionProvenance.ArgsFields;\n readonly item: () => Schema.Codec<any, any>;\n readonly error?: () => Schema.Codec<any, any>;\n}\n\nconst makePaginated = <\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n>(\n runtimeAndFunctionType: RuntimeAndFunctionType_,\n functionVisibility: FunctionVisibility_,\n) => {\n function makeSpec<\n const Name_ extends string,\n const UserArgsFields_ extends FunctionProvenance.ArgsFields,\n Item_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >(options: {\n name: Name_;\n args: () => UserArgsFields_ & ForbidPaginationOpts<UserArgsFields_>;\n item: () => Item_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.ConfectPaginated<UserArgsFields_, Item_, Error_>\n >;\n function makeSpec<\n const Name_ extends string,\n Item_ extends Schema.Codec<any, any>,\n Error_ extends Schema.Codec<any, any> = never,\n >(options: {\n name: Name_;\n args?: never;\n item: () => Item_;\n error?: () => Error_;\n }): Builder<\n RuntimeAndFunctionType_,\n FunctionVisibility_,\n Name_,\n FunctionProvenance.ConfectPaginated<{}, Item_, Error_>\n >;\n function makeSpec({ name, args, item, error }: PaginatedOptions) {\n validateConfectFunctionIdentifier(name);\n\n return Object.assign(Object.create(Proto), {\n runtimeAndFunctionType,\n functionVisibility,\n name,\n functionProvenance:\n args === undefined\n ? FunctionProvenance.ConfectPaginated(() => ({}), item, error)\n : FunctionProvenance.ConfectPaginated(args, item, error),\n middlewareAttachments: [],\n });\n }\n\n return makeSpec;\n};\n\nexport const publicQuery = make(RuntimeAndFunctionType.ConvexQuery, \"public\");\nexport const internalQuery = make(\n RuntimeAndFunctionType.ConvexQuery,\n \"internal\",\n);\nexport const publicPaginatedQuery = makePaginated(\n RuntimeAndFunctionType.ConvexQuery,\n \"public\",\n);\nexport const internalPaginatedQuery = makePaginated(\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 extends DefaultFunctionArgs, any>\n ? A\n : F extends RegisteredMutation<\n any,\n infer A extends DefaultFunctionArgs,\n any\n >\n ? A\n : F extends RegisteredAction<\n any,\n infer A extends DefaultFunctionArgs,\n any\n >\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 ): Builder<\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 middlewareAttachments: [],\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS;AAGtB,MAAa,kBAAkB,MAC7B,UAAU,YAAY,GAAG,MAAM;AA8QjC,MAAM,QAAQ;EACX,SAAS;CAEV,IAAI,kBAAkB;EACpB,OAAO,KAAK,sBAAsB,KAAK,EAAE,WAAW,IAAI;CAC1D;CAEA,WAEE,gBACA,GAAG,SACH;EACA,IAAI,KAAK,mBAAmB,SAAS,UACnC,MAAM,IAAI,MACR,0BAA0B,KAAK,KAAK,yBACtC;EAEF,MAAM,eAAe,KAAK,uBAAuB;EACjD,IAAI,CAAC,eAAe,cAAc,eAChC,MAAM,IAAI,MACR,eAAe,eAAe,IAAI,oCAAoC,aAAa,iBAAiB,KAAK,KAAK,EAChH;EAEF,IACE,EAAE,aAAa,mBACf,KAAK,sBAAsB,MACxB,EAAE,WAAW,KAAK,QAAQ,eAAe,GAC5C,GAEA,MAAM,IAAI,MACR,eAAe,eAAe,IAAI,qCAAqC,KAAK,KAAK,EACnF;EAGF,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;GACzC,wBAAwB,KAAK;GAC7B,oBAAoB,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AAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG;EACzC;EACA;EACA;EACA,oBAAoBC,OAGlB;EACF,uBAAuB,CAAC;CAC1B,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"}
|
package/dist/GroupPath.d.ts
CHANGED
|
@@ -3,18 +3,17 @@ import type * as GroupSpec from "./GroupSpec";
|
|
|
3
3
|
* Recursively generates paths for a group and its nested groups.
|
|
4
4
|
*
|
|
5
5
|
* - For a group with no subgroups, returns just the group name.
|
|
6
|
-
* - For a group with subgroups, returns the group name plus all possible paths
|
|
6
|
+
* - For a group with subgroups, returns the group name plus all possible paths
|
|
7
|
+
* through its direct subgroups.
|
|
7
8
|
*/
|
|
8
9
|
export type All<Group extends GroupSpec.AnyWithProps, Depth extends 1[] = []> = Depth["length"] extends 15 ? string : Group extends any ? [GroupSpec.Groups<Group>] extends [never] ? GroupSpec.Name<Group> : GroupSpec.Name<Group> | AllHelper<Group, GroupSpec.Groups<Group>, Depth> : never;
|
|
9
10
|
type AllHelper<Parent extends GroupSpec.AnyWithProps, Groups_ extends GroupSpec.AnyWithProps, Depth extends 1[] = []> = Groups_ extends GroupSpec.AnyWithProps ? `${GroupSpec.Name<Parent>}.${All<Groups_, [...Depth, 1]>}` : never;
|
|
10
11
|
/**
|
|
11
|
-
* Recursively extracts the group at the given dot-separated path.
|
|
12
|
-
*
|
|
12
|
+
* Recursively extracts the group at the given dot-separated path. Path must
|
|
13
|
+
* match the format defined in `Path` above, e.g. "group" or "group.subgroup".
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
15
|
-
*
|
|
16
|
-
* type G = WithPath<RootGroup, "group.subgroup">;
|
|
17
|
-
* ```
|
|
16
|
+
* type G = WithPath<RootGroup, "group.subgroup">;
|
|
18
17
|
*/
|
|
19
18
|
export type GroupAt<Group, Path extends string> = Group extends GroupSpec.AnyWithProps ? Path extends `${infer Head}.${infer Tail}` ? Group extends {
|
|
20
19
|
readonly name: Head;
|
package/dist/GroupPath.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupPath.d.ts","sourceRoot":"","sources":["../src/GroupPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"GroupPath.d.ts","sourceRoot":"","sources":["../src/GroupPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,aAAa,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CACb,KAAK,SAAS,SAAS,CAAC,YAAY,EACpC,KAAK,SAAS,CAAC,EAAE,GAAG,EAAE,IACpB,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,GAC1B,MAAM,GACN,KAAK,SAAS,GAAG,GACf,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACvC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GACrB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAC1E,KAAK,CAAC;AAEZ,KAAK,SAAS,CACZ,MAAM,SAAS,SAAS,CAAC,YAAY,EACrC,OAAO,SAAS,SAAS,CAAC,YAAY,EACtC,KAAK,SAAS,CAAC,EAAE,GAAG,EAAE,IACpB,OAAO,SAAS,SAAS,CAAC,YAAY,GACtC,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAC1D,KAAK,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,CACjB,KAAK,EACL,IAAI,SAAS,MAAM,IACjB,KAAK,SAAS,SAAS,CAAC,YAAY,GACpC,IAAI,SAAS,GAAG,MAAM,IAAI,IAAI,MAAM,IAAI,EAAE,GACxC,KAAK,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GACnC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,GACtC,KAAK,GACP,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,GACjC,KAAK,CAAC;AAEV,MAAM,MAAM,WAAW,CACrB,KAAK,SAAS,SAAS,CAAC,YAAY,EACpC,SAAS,SAAS,MAAM,IAExB,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,SAAS,MAAM,SAAS,GAC/D,SAAS,SAAS,SAAS,CAAC,YAAY,GACtC,GAAG,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAC3C,KAAK,GACP,KAAK,CAAC"}
|
package/dist/GroupPath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupPath.js","names":[],"sources":["../src/GroupPath.ts"],"sourcesContent":["import type * as GroupSpec from \"./GroupSpec\";\n\n/**\n * Recursively generates paths for a group and its nested groups.\n *\n * - For a group with no subgroups, returns just the group name.\n * - For a group with subgroups, returns the group name plus all possible paths through its direct subgroups.\n */\nexport type All<\n Group extends GroupSpec.AnyWithProps,\n Depth extends 1[] = [],\n> = Depth[\"length\"] extends 15\n ? string\n : Group extends any\n ? [GroupSpec.Groups<Group>] extends [never]\n ? GroupSpec.Name<Group>\n : GroupSpec.Name<Group> | AllHelper<Group, GroupSpec.Groups<Group>, Depth>\n : never;\n\ntype AllHelper<\n Parent extends GroupSpec.AnyWithProps,\n Groups_ extends GroupSpec.AnyWithProps,\n Depth extends 1[] = [],\n> = Groups_ extends GroupSpec.AnyWithProps\n ? `${GroupSpec.Name<Parent>}.${All<Groups_, [...Depth, 1]>}`\n : never;\n\n/**\n * Recursively extracts the group at the given dot-separated path
|
|
1
|
+
{"version":3,"file":"GroupPath.js","names":[],"sources":["../src/GroupPath.ts"],"sourcesContent":["import type * as GroupSpec from \"./GroupSpec\";\n\n/**\n * Recursively generates paths for a group and its nested groups.\n *\n * - For a group with no subgroups, returns just the group name.\n * - For a group with subgroups, returns the group name plus all possible paths\n * through its direct subgroups.\n */\nexport type All<\n Group extends GroupSpec.AnyWithProps,\n Depth extends 1[] = [],\n> = Depth[\"length\"] extends 15\n ? string\n : Group extends any\n ? [GroupSpec.Groups<Group>] extends [never]\n ? GroupSpec.Name<Group>\n : GroupSpec.Name<Group> | AllHelper<Group, GroupSpec.Groups<Group>, Depth>\n : never;\n\ntype AllHelper<\n Parent extends GroupSpec.AnyWithProps,\n Groups_ extends GroupSpec.AnyWithProps,\n Depth extends 1[] = [],\n> = Groups_ extends GroupSpec.AnyWithProps\n ? `${GroupSpec.Name<Parent>}.${All<Groups_, [...Depth, 1]>}`\n : never;\n\n/**\n * Recursively extracts the group at the given dot-separated path. Path must\n * match the format defined in `Path` above, e.g. \"group\" or \"group.subgroup\".\n *\n * @example\n * type G = WithPath<RootGroup, \"group.subgroup\">;\n */\nexport type GroupAt<\n Group,\n Path extends string,\n> = Group extends GroupSpec.AnyWithProps\n ? Path extends `${infer Head}.${infer Tail}`\n ? Group extends { readonly name: Head }\n ? GroupAt<GroupSpec.Groups<Group>, Tail>\n : never\n : GroupSpec.WithName<Group, Path>\n : never;\n\nexport type SubGroupsAt<\n Group extends GroupSpec.AnyWithProps,\n GroupPath extends string,\n> =\n GroupSpec.Groups<GroupAt<Group, GroupPath>> extends infer SubGroups\n ? SubGroups extends GroupSpec.AnyWithProps\n ? `${GroupPath}.${GroupSpec.Name<SubGroups>}`\n : never\n : never;\n"],"mappings":""}
|
package/dist/GroupSpec.d.ts
CHANGED
|
@@ -42,7 +42,10 @@ export type GroupNames<Group extends AnyWithProps> = [Groups<Group>] extends [
|
|
|
42
42
|
export type WithName<Group extends AnyWithProps, Name_ extends Name<Group>> = Extract<Group, {
|
|
43
43
|
readonly name: Name_;
|
|
44
44
|
}>;
|
|
45
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Assigns a segment name to a leaf group created with {@link make} for typing
|
|
47
|
+
* and refs.
|
|
48
|
+
*/
|
|
46
49
|
export type NamedAt<Group extends Any, Name_ extends string> = Omit<Group, "name"> & {
|
|
47
50
|
readonly name: Name_;
|
|
48
51
|
};
|
|
@@ -51,6 +54,6 @@ export declare const make: () => GroupSpec<"Convex", "">;
|
|
|
51
54
|
export declare const makeAt: <const Name_ extends string>(name: Name_) => GroupSpec<"Convex", Name_>;
|
|
52
55
|
export declare const makeNode: () => GroupSpec<"Node", "">;
|
|
53
56
|
export declare const makeNodeAt: <const Name_ extends string>(name: Name_) => GroupSpec<"Node", Name_>;
|
|
54
|
-
export declare
|
|
57
|
+
export declare function withName<const Name_ extends string, Group extends Any>(name: Name_, group: Group): NamedAt<Group, Name_>;
|
|
55
58
|
export declare const validateMiddleware: (group: AnyWithProps) => Result.Result<void, MiddlewareAttachment.ValidationError>;
|
|
56
59
|
//# sourceMappingURL=GroupSpec.d.ts.map
|
package/dist/GroupSpec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupSpec.d.ts","sourceRoot":"","sources":["../src/GroupSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,oBAAoB,MAAM,wBAAwB,CAAC;AAG/D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,YAAY,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,KAA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,EACV,OAAO,GAAG,WAAW,EACrB,gBAAgB,CACjB,GACD,KAAK,CAAC;AAoJZ,eAAO,MAAM,IAAI,QAAO,SAAS,CAAC,QAAQ,EAAE,EAAE,CAO1C,CAAC;AAEL,eAAO,MAAM,MAAM,GAAI,KAAK,CAAC,KAAK,SAAS,MAAM,QACzC,KAAK,KACV,SAAS,CAAC,QAAQ,EAAE,KAAK,CAU3B,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,SAAS,CAAC,MAAM,EAAE,EAAE,CAO5C,CAAC;AAEL,eAAO,MAAM,UAAU,GAAI,KAAK,CAAC,KAAK,SAAS,MAAM,QAC7C,KAAK,KACV,SAAS,CAAC,MAAM,EAAE,KAAK,CAUzB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,SAAS,GAAG,EACpE,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAkBzB,eAAO,MAAM,kBAAkB,UACtB,YAAY,KAClB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC,eAAe,CAcvD,CAAC"}
|
package/dist/GroupSpec.js
CHANGED
|
@@ -113,7 +113,7 @@ const makeNodeAt = (name) => {
|
|
|
113
113
|
middlewareAttachments: []
|
|
114
114
|
});
|
|
115
115
|
};
|
|
116
|
-
|
|
116
|
+
function withName(name, group) {
|
|
117
117
|
validateConfectFunctionIdentifier(name);
|
|
118
118
|
const group_ = group;
|
|
119
119
|
if (group_.name === name) return group_;
|
|
@@ -124,7 +124,7 @@ const withName = (name, group) => {
|
|
|
124
124
|
groups: group_.groups,
|
|
125
125
|
middlewareAttachments: group_.middlewareAttachments
|
|
126
126
|
});
|
|
127
|
-
}
|
|
127
|
+
}
|
|
128
128
|
const validateMiddleware = (group) => Result.gen(function* () {
|
|
129
129
|
yield* validateAll(group.middlewareAttachments, `group "${group.name}"`);
|
|
130
130
|
for (const function_ of Object.values(group.functions)) yield* validateAll([...group.middlewareAttachments, ...function_.middlewareAttachments], `function "${function_.name}"`);
|