@confect/core 9.2.4 → 9.3.0
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 +51 -0
- package/dist/FunctionProvenance.d.ts +74 -3
- package/dist/FunctionProvenance.d.ts.map +1 -1
- package/dist/FunctionProvenance.js +43 -2
- package/dist/FunctionProvenance.js.map +1 -1
- package/dist/FunctionSpec.d.ts +42 -9
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +16 -2
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/PaginationOptions.d.ts +31 -0
- package/dist/PaginationOptions.d.ts.map +1 -0
- package/dist/PaginationOptions.js +29 -0
- package/dist/PaginationOptions.js.map +1 -0
- package/dist/PaginationResult.d.ts +1 -0
- package/dist/PaginationResult.d.ts.map +1 -1
- package/dist/PaginationResult.js.map +1 -1
- package/dist/Ref.d.ts +34 -5
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +52 -14
- package/dist/Ref.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/FunctionProvenance.ts +147 -4
- package/src/FunctionSpec.ts +67 -1
- package/src/PaginationOptions.ts +25 -0
- package/src/PaginationResult.ts +3 -0
- package/src/Ref.ts +97 -28
- package/src/index.ts +1 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
/**
|
|
3
|
+
* Schema for the `paginationOpts` argument that every paginated query
|
|
4
|
+
* receives. Mirrors `paginationOptsValidator` from `convex/server`.
|
|
5
|
+
*
|
|
6
|
+
* Use this as the `paginationOpts` field of a paginated query's args schema.
|
|
7
|
+
* Beyond `numItems` and `cursor`, Convex's pagination protocol sends the
|
|
8
|
+
* optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)
|
|
9
|
+
* with real requests — most notably `usePaginatedQuery` from `convex/react`
|
|
10
|
+
* always includes `id`, and includes `endCursor` when splitting pages.
|
|
11
|
+
* Declaring them is required for the generated Convex argument validator to
|
|
12
|
+
* accept those requests and for the fields to survive decoding and reach
|
|
13
|
+
* `paginate`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PaginationOptions: Schema.Struct<{
|
|
16
|
+
numItems: typeof Schema.Number;
|
|
17
|
+
cursor: Schema.Union<[typeof Schema.String, typeof Schema.Null]>;
|
|
18
|
+
endCursor: Schema.optionalWith<Schema.Union<[typeof Schema.String, typeof Schema.Null]>, {
|
|
19
|
+
exact: true;
|
|
20
|
+
}>;
|
|
21
|
+
id: Schema.optionalWith<typeof Schema.Number, {
|
|
22
|
+
exact: true;
|
|
23
|
+
}>;
|
|
24
|
+
maximumRowsRead: Schema.optionalWith<typeof Schema.Number, {
|
|
25
|
+
exact: true;
|
|
26
|
+
}>;
|
|
27
|
+
maximumBytesRead: Schema.optionalWith<typeof Schema.Number, {
|
|
28
|
+
exact: true;
|
|
29
|
+
}>;
|
|
30
|
+
}>;
|
|
31
|
+
//# sourceMappingURL=PaginationOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationOptions.d.ts","sourceRoot":"","sources":["../src/PaginationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAS5B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
//#region src/PaginationOptions.ts
|
|
4
|
+
var PaginationOptions_exports = /* @__PURE__ */ __exportAll({ PaginationOptions: () => PaginationOptions });
|
|
5
|
+
/**
|
|
6
|
+
* Schema for the `paginationOpts` argument that every paginated query
|
|
7
|
+
* receives. Mirrors `paginationOptsValidator` from `convex/server`.
|
|
8
|
+
*
|
|
9
|
+
* Use this as the `paginationOpts` field of a paginated query's args schema.
|
|
10
|
+
* Beyond `numItems` and `cursor`, Convex's pagination protocol sends the
|
|
11
|
+
* optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)
|
|
12
|
+
* with real requests — most notably `usePaginatedQuery` from `convex/react`
|
|
13
|
+
* always includes `id`, and includes `endCursor` when splitting pages.
|
|
14
|
+
* Declaring them is required for the generated Convex argument validator to
|
|
15
|
+
* accept those requests and for the fields to survive decoding and reach
|
|
16
|
+
* `paginate`.
|
|
17
|
+
*/
|
|
18
|
+
const PaginationOptions = Schema.Struct({
|
|
19
|
+
numItems: Schema.Number,
|
|
20
|
+
cursor: Schema.Union(Schema.String, Schema.Null),
|
|
21
|
+
endCursor: Schema.optionalWith(Schema.Union(Schema.String, Schema.Null), { exact: true }),
|
|
22
|
+
id: Schema.optionalWith(Schema.Number, { exact: true }),
|
|
23
|
+
maximumRowsRead: Schema.optionalWith(Schema.Number, { exact: true }),
|
|
24
|
+
maximumBytesRead: Schema.optionalWith(Schema.Number, { exact: true })
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { PaginationOptions, PaginationOptions_exports };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=PaginationOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationOptions.js","names":[],"sources":["../src/PaginationOptions.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\n/**\n * Schema for the `paginationOpts` argument that every paginated query\n * receives. Mirrors `paginationOptsValidator` from `convex/server`.\n *\n * Use this as the `paginationOpts` field of a paginated query's args schema.\n * Beyond `numItems` and `cursor`, Convex's pagination protocol sends the\n * optional fields (`endCursor`, `id`, `maximumRowsRead`, `maximumBytesRead`)\n * with real requests — most notably `usePaginatedQuery` from `convex/react`\n * always includes `id`, and includes `endCursor` when splitting pages.\n * Declaring them is required for the generated Convex argument validator to\n * accept those requests and for the fields to survive decoding and reach\n * `paginate`.\n */\nexport const PaginationOptions = Schema.Struct({\n numItems: Schema.Number,\n cursor: Schema.Union(Schema.String, Schema.Null),\n endCursor: Schema.optionalWith(Schema.Union(Schema.String, Schema.Null), {\n exact: true,\n }),\n id: Schema.optionalWith(Schema.Number, { exact: true }),\n maximumRowsRead: Schema.optionalWith(Schema.Number, { exact: true }),\n maximumBytesRead: Schema.optionalWith(Schema.Number, { exact: true }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAa,oBAAoB,OAAO,OAAO;CAC7C,UAAU,OAAO;CACjB,QAAQ,OAAO,MAAM,OAAO,QAAQ,OAAO,IAAI;CAC/C,WAAW,OAAO,aAAa,OAAO,MAAM,OAAO,QAAQ,OAAO,IAAI,GAAG,EACvE,OAAO,KACT,CAAC;CACD,IAAI,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,KAAK,CAAC;CACtD,iBAAiB,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,KAAK,CAAC;CACnE,kBAAkB,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,KAAK,CAAC;AACtE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
|
+
export type PaginationResult<Doc extends Schema.Schema.AnyNoContext> = ReturnType<typeof PaginationResult<Doc>>;
|
|
2
3
|
export declare const PaginationResult: <Doc extends Schema.Schema.AnyNoContext>(Doc: Doc) => Schema.Struct<{
|
|
3
4
|
page: Schema.mutable<Schema.Array$<Doc>>;
|
|
4
5
|
isDone: typeof Schema.Boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationResult.d.ts","sourceRoot":"","sources":["../src/PaginationResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EACrE,KAAK,GAAG;;;;;;;;;;EAiBN,CAAC"}
|
|
1
|
+
{"version":3,"file":"PaginationResult.d.ts","sourceRoot":"","sources":["../src/PaginationResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,gBAAgB,CAAC,GAAG,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,IACjE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE3C,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EACrE,KAAK,GAAG;;;;;;;;;;EAiBN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationResult.js","names":[],"sources":["../src/PaginationResult.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport const PaginationResult = <Doc extends Schema.Schema.AnyNoContext>(\n Doc: Doc,\n) =>\n Schema.Struct({\n page: Schema.mutable(Schema.Array(Doc)),\n isDone: Schema.Boolean,\n continueCursor: Schema.String,\n splitCursor: Schema.optionalWith(Schema.Union(Schema.String, Schema.Null), {\n exact: true,\n }),\n pageStatus: Schema.optionalWith(\n Schema.Union(\n Schema.Literal(\"SplitRecommended\"),\n Schema.Literal(\"SplitRequired\"),\n Schema.Null,\n ),\n { exact: true },\n ),\n });\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"PaginationResult.js","names":[],"sources":["../src/PaginationResult.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport type PaginationResult<Doc extends Schema.Schema.AnyNoContext> =\n ReturnType<typeof PaginationResult<Doc>>;\n\nexport const PaginationResult = <Doc extends Schema.Schema.AnyNoContext>(\n Doc: Doc,\n) =>\n Schema.Struct({\n page: Schema.mutable(Schema.Array(Doc)),\n isDone: Schema.Boolean,\n continueCursor: Schema.String,\n splitCursor: Schema.optionalWith(Schema.Union(Schema.String, Schema.Null), {\n exact: true,\n }),\n pageStatus: Schema.optionalWith(\n Schema.Union(\n Schema.Literal(\"SplitRecommended\"),\n Schema.Literal(\"SplitRequired\"),\n Schema.Null,\n ),\n { exact: true },\n ),\n });\n"],"mappings":";;;;AAKA,MAAa,oBACX,QAEA,OAAO,OAAO;CACZ,MAAM,OAAO,QAAQ,OAAO,MAAM,GAAG,CAAC;CACtC,QAAQ,OAAO;CACf,gBAAgB,OAAO;CACvB,aAAa,OAAO,aAAa,OAAO,MAAM,OAAO,QAAQ,OAAO,IAAI,GAAG,EACzE,OAAO,KACT,CAAC;CACD,YAAY,OAAO,aACjB,OAAO,MACL,OAAO,QAAQ,kBAAkB,GACjC,OAAO,QAAQ,eAAe,GAC9B,OAAO,IACT,GACA,EAAE,OAAO,KAAK,CAChB;AACF,CAAC"}
|
package/dist/Ref.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FunctionReference as ConvexFunctionReference, FunctionVisibility } from "convex/server";
|
|
1
|
+
import type { FunctionReference as ConvexFunctionReference, FunctionVisibility, PaginationOptions, PaginationResult } from "convex/server";
|
|
2
2
|
import type { Value } from "convex/values";
|
|
3
3
|
import { ConvexError } from "convex/values";
|
|
4
4
|
import type { ParseResult } from "effect";
|
|
@@ -21,6 +21,11 @@ export interface AnyPublic extends Ref<any, "public", any, any, any> {
|
|
|
21
21
|
}
|
|
22
22
|
export interface AnyQuery extends Ref<RuntimeAndFunctionType.AnyQuery, FunctionVisibility, any, any, any> {
|
|
23
23
|
}
|
|
24
|
+
export interface AnyPublicPaginatedQuery extends Ref<RuntimeAndFunctionType.AnyQuery, "public", {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
paginationOpts: PaginationOptions;
|
|
27
|
+
}, PaginationResult<any>, any> {
|
|
28
|
+
}
|
|
24
29
|
export interface AnyMutation extends Ref<RuntimeAndFunctionType.AnyMutation, FunctionVisibility, any, any, any> {
|
|
25
30
|
}
|
|
26
31
|
export interface AnyAction extends Ref<RuntimeAndFunctionType.AnyAction, FunctionVisibility, any, any, any> {
|
|
@@ -77,11 +82,35 @@ export declare const decodeErrorOrElse: <Ref_ extends Any, E>(ref: Ref_, mapUnkn
|
|
|
77
82
|
*/
|
|
78
83
|
export declare const decodeError: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Effect.Effect<Option.Option<Error<Ref_>>, ParseResult.ParseError>;
|
|
79
84
|
/**
|
|
80
|
-
* Synchronous counterpart to `decodeError`.
|
|
81
|
-
*
|
|
85
|
+
* Synchronous counterpart to `decodeError`. Returns `None` when the value is
|
|
86
|
+
* not this ref's typed error — either because the ref declares no `error`
|
|
87
|
+
* schema, or because `encodedError` doesn't match the one it declares.
|
|
88
|
+
*
|
|
89
|
+
* The second case is reachable in normal operation: Convex raises its own
|
|
90
|
+
* `ConvexError`s (an `InvalidCursor` pagination error, for instance), and
|
|
91
|
+
* those never match a user-declared error schema. Callers pair this with a
|
|
92
|
+
* fallback that surfaces the original error, so failing to decode must not
|
|
93
|
+
* throw — a `ParseError` here would replace the real error with an opaque one
|
|
94
|
+
* and lose the only useful diagnostic. Hence the `Option` suffix rather than
|
|
95
|
+
* `Sync`, matching `Schema.decodeUnknownOption`: the sibling `*Sync` helpers
|
|
96
|
+
* in this module all throw on a parse failure, and this one deliberately
|
|
97
|
+
* doesn't.
|
|
98
|
+
*/
|
|
99
|
+
export declare const decodeErrorOption: <Ref_ extends Any>(ref: Ref_, encodedError: unknown) => Option.Option<Error<Ref_>>;
|
|
100
|
+
/**
|
|
101
|
+
* Encode the args of a paginated query ref via its user-args schema —
|
|
102
|
+
* `paginationOpts` is excluded, since the pagination protocol fields are
|
|
103
|
+
* managed by the client (e.g. `usePaginatedQuery` from `convex/react`), not by
|
|
104
|
+
* the caller. Requires a ref built with `FunctionSpec.publicPaginatedQuery`
|
|
105
|
+
* (or `internalPaginatedQuery`).
|
|
106
|
+
*/
|
|
107
|
+
export declare const encodePaginatedQueryArgsSync: <Ref_ extends AnyPublicPaginatedQuery>(ref: Ref_, args: Omit<Args<Ref_>, "paginationOpts">) => unknown;
|
|
108
|
+
/**
|
|
109
|
+
* Decode a page of a paginated query's results via the ref's item schema.
|
|
110
|
+
* Requires a ref built with `FunctionSpec.publicPaginatedQuery` (or
|
|
111
|
+
* `internalPaginatedQuery`).
|
|
82
112
|
*/
|
|
83
|
-
export declare const
|
|
84
|
-
export declare const maybeDecodeErrorSync: <Ref_ extends Any>(ref: Ref_, error: unknown) => unknown;
|
|
113
|
+
export declare const decodePaginationPageSync: <Ref_ extends AnyPublicPaginatedQuery>(ref: Ref_, encodedPage: unknown) => Returns<Ref_>["page"];
|
|
85
114
|
/**
|
|
86
115
|
* Encode args via the ref's args schema, invoke `call`, decode returns via the
|
|
87
116
|
* ref's returns schema, and translate any thrown `ConvexError` into the ref's
|
package/dist/Ref.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../src/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,IAAI,uBAAuB,EAC5C,kBAAkB,
|
|
1
|
+
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../src/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,IAAI,uBAAuB,EAC5C,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,YAAY,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,KAAK,sBAAsB,MAAM,0BA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AG,KAAK,EACtD,KAAK,IAAI,EACT,MAAM,IAAI,CAAC,IAAI,CAAC,EAChB,MAAM,CACJ,iBAAiB,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAC1C,WAAW,EAAE,OAAO,KACjB,WAAW,CAAC,OAAO,CAAC,EACzB,kBAAkB,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,KACtC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,UAAU,CAqCpE,CAAC"}
|
package/dist/Ref.js
CHANGED
|
@@ -9,19 +9,20 @@ import * as Option from "effect/Option";
|
|
|
9
9
|
var Ref_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
decodeArgsSync: () => decodeArgsSync,
|
|
11
11
|
decodeError: () => decodeError,
|
|
12
|
+
decodeErrorOption: () => decodeErrorOption,
|
|
12
13
|
decodeErrorOrElse: () => decodeErrorOrElse,
|
|
13
|
-
|
|
14
|
+
decodePaginationPageSync: () => decodePaginationPageSync,
|
|
14
15
|
decodeReturns: () => decodeReturns,
|
|
15
16
|
decodeReturnsSync: () => decodeReturnsSync,
|
|
16
17
|
encodeArgs: () => encodeArgs,
|
|
17
18
|
encodeArgsSync: () => encodeArgsSync,
|
|
19
|
+
encodePaginatedQueryArgsSync: () => encodePaginatedQueryArgsSync,
|
|
18
20
|
encodeReturnsSync: () => encodeReturnsSync,
|
|
19
21
|
getConvexFunctionName: () => getConvexFunctionName,
|
|
20
22
|
getFunctionReference: () => getFunctionReference,
|
|
21
23
|
hasErrorSchema: () => hasErrorSchema,
|
|
22
24
|
isConvexError: () => isConvexError,
|
|
23
25
|
make: () => make,
|
|
24
|
-
maybeDecodeErrorSync: () => maybeDecodeErrorSync,
|
|
25
26
|
runWithCodec: () => runWithCodec
|
|
26
27
|
});
|
|
27
28
|
const make = (functionNamespace, functionSpec) => ({
|
|
@@ -40,11 +41,11 @@ const getFunctionReference = (ref) => {
|
|
|
40
41
|
};
|
|
41
42
|
const hasErrorSchema = (ref) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance), Match.tag("Convex", () => false), Match.exhaustive);
|
|
42
43
|
const encodeArgs = (ref, args) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.encode(confectFunctionProvenance.args)(args)), Match.tag("Convex", () => Effect.succeed(args)), Match.exhaustive);
|
|
43
|
-
const decodeReturns = (ref, returns) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.
|
|
44
|
+
const decodeReturns = (ref, returns) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.decodeUnknown(confectFunctionProvenance.returns)(returns)), Match.tag("Convex", () => Effect.succeed(returns)), Match.exhaustive);
|
|
44
45
|
const encodeArgsSync = (ref, args) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.encodeSync(confectFunctionProvenance.args)(args)), Match.tag("Convex", () => args), Match.exhaustive);
|
|
45
|
-
const decodeArgsSync = (ref, encodedArgs) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.
|
|
46
|
+
const decodeArgsSync = (ref, encodedArgs) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.decodeUnknownSync(confectFunctionProvenance.args)(encodedArgs)), Match.tag("Convex", () => encodedArgs), Match.exhaustive);
|
|
46
47
|
const encodeReturnsSync = (ref, returns) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.encodeSync(confectFunctionProvenance.returns)(returns)), Match.tag("Convex", () => returns), Match.exhaustive);
|
|
47
|
-
const decodeReturnsSync = (ref, encodedReturns) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.
|
|
48
|
+
const decodeReturnsSync = (ref, encodedReturns) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Schema.decodeUnknownSync(confectFunctionProvenance.returns)(encodedReturns)), Match.tag("Convex", () => encodedReturns), Match.exhaustive);
|
|
48
49
|
const ConvexErrorIdentifier = Symbol.for("ConvexError");
|
|
49
50
|
const isConvexError = (error) => error instanceof ConvexError || typeof error === "object" && error !== null && ConvexErrorIdentifier in error;
|
|
50
51
|
/**
|
|
@@ -58,7 +59,7 @@ const isConvexError = (error) => error instanceof ConvexError || typeof error ==
|
|
|
58
59
|
*/
|
|
59
60
|
const decodeErrorOrElse = (ref, mapUnknownError) => (error) => {
|
|
60
61
|
if (isConvexError(error)) {
|
|
61
|
-
const decoded =
|
|
62
|
+
const decoded = decodeErrorOption(ref, error.data);
|
|
62
63
|
if (Option.isSome(decoded)) return decoded.value;
|
|
63
64
|
}
|
|
64
65
|
return mapUnknownError(error);
|
|
@@ -70,13 +71,50 @@ const decodeErrorOrElse = (ref, mapUnknownError) => (error) => {
|
|
|
70
71
|
* into, and the caller is responsible for deciding what to do (typically:
|
|
71
72
|
* surface the original value as a defect).
|
|
72
73
|
*/
|
|
73
|
-
const decodeError = (ref, encodedError) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance ? Effect.map(Schema.
|
|
74
|
+
const decodeError = (ref, encodedError) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance ? Effect.map(Schema.decodeUnknown(confectFunctionProvenance.error)(encodedError), Option.some) : Effect.succeed(Option.none())), Match.tag("Convex", () => Effect.succeed(Option.none())), Match.exhaustive);
|
|
74
75
|
/**
|
|
75
|
-
* Synchronous counterpart to `decodeError`.
|
|
76
|
-
*
|
|
76
|
+
* Synchronous counterpart to `decodeError`. Returns `None` when the value is
|
|
77
|
+
* not this ref's typed error — either because the ref declares no `error`
|
|
78
|
+
* schema, or because `encodedError` doesn't match the one it declares.
|
|
79
|
+
*
|
|
80
|
+
* The second case is reachable in normal operation: Convex raises its own
|
|
81
|
+
* `ConvexError`s (an `InvalidCursor` pagination error, for instance), and
|
|
82
|
+
* those never match a user-declared error schema. Callers pair this with a
|
|
83
|
+
* fallback that surfaces the original error, so failing to decode must not
|
|
84
|
+
* throw — a `ParseError` here would replace the real error with an opaque one
|
|
85
|
+
* and lose the only useful diagnostic. Hence the `Option` suffix rather than
|
|
86
|
+
* `Sync`, matching `Schema.decodeUnknownOption`: the sibling `*Sync` helpers
|
|
87
|
+
* in this module all throw on a parse failure, and this one deliberately
|
|
88
|
+
* doesn't.
|
|
77
89
|
*/
|
|
78
|
-
const
|
|
79
|
-
const
|
|
90
|
+
const decodeErrorOption = (ref, encodedError) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => "error" in confectFunctionProvenance ? Schema.decodeUnknownOption(confectFunctionProvenance.error)(encodedError) : Option.none()), Match.tag("Convex", () => Option.none()), Match.exhaustive);
|
|
91
|
+
const missingPaginatedProvenanceError = (ref) => new globalThis.Error(`Paginated query ref "${getConvexFunctionName(ref)}" was not built with \`FunctionSpec.publicPaginatedQuery\` (or \`FunctionSpec.internalPaginatedQuery\`). Paginated encoding and decoding require the user-args and item schemas those constructors store. Define the function as, e.g.:
|
|
92
|
+
|
|
93
|
+
FunctionSpec.publicPaginatedQuery({
|
|
94
|
+
name: "...",
|
|
95
|
+
args: () => Schema.Struct({ ... }), // optional; without paginationOpts
|
|
96
|
+
item: () => ItemSchema,
|
|
97
|
+
})`);
|
|
98
|
+
/**
|
|
99
|
+
* Encode the args of a paginated query ref via its user-args schema —
|
|
100
|
+
* `paginationOpts` is excluded, since the pagination protocol fields are
|
|
101
|
+
* managed by the client (e.g. `usePaginatedQuery` from `convex/react`), not by
|
|
102
|
+
* the caller. Requires a ref built with `FunctionSpec.publicPaginatedQuery`
|
|
103
|
+
* (or `internalPaginatedQuery`).
|
|
104
|
+
*/
|
|
105
|
+
const encodePaginatedQueryArgsSync = (ref, args) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => {
|
|
106
|
+
if (confectFunctionProvenance.kind._tag !== "Paginated") throw missingPaginatedProvenanceError(ref);
|
|
107
|
+
return Schema.encodeUnknownSync(confectFunctionProvenance.kind.userArgs)(args);
|
|
108
|
+
}), Match.tag("Convex", () => args), Match.exhaustive);
|
|
109
|
+
/**
|
|
110
|
+
* Decode a page of a paginated query's results via the ref's item schema.
|
|
111
|
+
* Requires a ref built with `FunctionSpec.publicPaginatedQuery` (or
|
|
112
|
+
* `internalPaginatedQuery`).
|
|
113
|
+
*/
|
|
114
|
+
const decodePaginationPageSync = (ref, encodedPage) => Match.value(ref.functionSpec.functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => {
|
|
115
|
+
if (confectFunctionProvenance.kind._tag !== "Paginated") throw missingPaginatedProvenanceError(ref);
|
|
116
|
+
return Schema.decodeUnknownSync(confectFunctionProvenance.kind.page)(encodedPage);
|
|
117
|
+
}), Match.tag("Convex", () => encodedPage), Match.exhaustive);
|
|
80
118
|
/**
|
|
81
119
|
* Encode args via the ref's args schema, invoke `call`, decode returns via the
|
|
82
120
|
* ref's returns schema, and translate any thrown `ConvexError` into the ref's
|
|
@@ -92,7 +130,7 @@ const runWithCodec = (ref, args, call, mapUnknownError) => Effect.gen(function*
|
|
|
92
130
|
try: () => Promise.resolve(call(functionReference, encodedArgs)),
|
|
93
131
|
catch: (error) => {
|
|
94
132
|
if (isConvexError(error)) {
|
|
95
|
-
const decoded =
|
|
133
|
+
const decoded = decodeErrorOption(ref, error.data);
|
|
96
134
|
if (Option.isSome(decoded)) return decoded.value;
|
|
97
135
|
}
|
|
98
136
|
if (mapUnknownError !== void 0) return mapUnknownError(error);
|
|
@@ -102,10 +140,10 @@ const runWithCodec = (ref, args, call, mapUnknownError) => Effect.gen(function*
|
|
|
102
140
|
return yield* Match.value(functionProvenance).pipe(Match.tag("Confect", (confectFunctionProvenance) => Effect.gen(function* () {
|
|
103
141
|
const encodedArgs = yield* Schema.encode(confectFunctionProvenance.args)(args);
|
|
104
142
|
const encodedReturns = yield* invoke(encodedArgs);
|
|
105
|
-
return yield* Schema.
|
|
143
|
+
return yield* Schema.decodeUnknown(confectFunctionProvenance.returns)(encodedReturns);
|
|
106
144
|
})), Match.tag("Convex", () => invoke(args)), Match.exhaustive);
|
|
107
145
|
});
|
|
108
146
|
//#endregion
|
|
109
|
-
export { Ref_exports, decodeArgsSync, decodeError, decodeErrorOrElse,
|
|
147
|
+
export { Ref_exports, decodeArgsSync, decodeError, decodeErrorOption, decodeErrorOrElse, decodePaginationPageSync, decodeReturns, decodeReturnsSync, encodeArgs, encodeArgsSync, encodePaginatedQueryArgsSync, encodeReturnsSync, getConvexFunctionName, getFunctionReference, hasErrorSchema, isConvexError, make, runWithCodec };
|
|
110
148
|
|
|
111
149
|
//# sourceMappingURL=Ref.js.map
|
package/dist/Ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type {\n FunctionReference as ConvexFunctionReference,\n FunctionVisibility,\n} from \"convex/server\";\nimport { makeFunctionReference } from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport { ConvexError } from \"convex/values\";\nimport type { ParseResult } from \"effect\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport interface Ref<\n _RuntimeAndFunctionType extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n _FunctionVisibility extends FunctionVisibility,\n _Args,\n _Returns,\n _Error = never,\n> {\n readonly _RuntimeAndFunctionType?: _RuntimeAndFunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n readonly _Error?: _Error;\n /** @internal */\n readonly functionSpec: FunctionSpec.AnyWithProps;\n /** @internal */\n readonly functionNamespace: string;\n}\n\nexport interface Any extends Ref<any, any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any, any> {}\n\nexport interface AnyQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport type GetRuntimeAndFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType_\n : never;\n\nexport type GetRuntime<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetRuntime<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionVisibility<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer FunctionVisibility_,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? FunctionVisibility_\n : never;\n\nexport type Args<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer Args_,\n infer _Returns,\n infer _Error\n >\n ? Args_\n : never;\n\nexport type OptionalArgs<Ref_ extends Any> = keyof Args<Ref_> extends never\n ? [args?: Args<Ref_>]\n : [args: Args<Ref_>];\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_,\n infer _Error\n >\n ? Returns_\n : never;\n\nexport type Error<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer Error_\n >\n ? Error_\n : never;\n\nexport type FunctionReference<Ref_ extends Any> = ConvexFunctionReference<\n GetFunctionType<Ref_>,\n GetFunctionVisibility<Ref_>\n>;\n\nexport type FromFunctionSpec<FunctionSpec_ extends FunctionSpec.AnyWithProps> =\n Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n FunctionSpec.Args<FunctionSpec_>,\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>\n >;\n\nexport const make = <FunctionSpec_ extends FunctionSpec.AnyWithProps>(\n /**\n * The namespace portion of a Convex function name, i.e. the part before the\n * colon. For example, for `myGroupDir/myGroupMod:myFunc` this would be\n * `myGroupDir/myGroupMod`.\n */\n functionNamespace: string,\n functionSpec: FunctionSpec_,\n): FromFunctionSpec<FunctionSpec_> => ({ functionSpec, functionNamespace });\n\nexport const getConvexFunctionName = (ref: Any): string =>\n `${ref.functionNamespace}:${ref.functionSpec.name}`;\n\nconst functionReferenceCache = new Map<string, FunctionReference<Any>>();\n\nexport const getFunctionReference = <Ref_ extends Any>(\n ref: Ref_,\n): FunctionReference<Ref_> => {\n const functionName = getConvexFunctionName(ref);\n\n const cached = functionReferenceCache.get(functionName);\n if (cached !== undefined) {\n return cached as FunctionReference<Ref_>;\n }\n\n const functionReference = makeFunctionReference(functionName);\n functionReferenceCache.set(functionName, functionReference);\n\n return functionReference as FunctionReference<Ref_>;\n};\n\nexport const hasErrorSchema = (ref: Any): boolean =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\n \"Confect\",\n (confectFunctionProvenance) => \"error\" in confectFunctionProvenance,\n ),\n Match.tag(\"Convex\", () => false),\n Match.exhaustive,\n );\n\nexport const encodeArgs = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): Effect.Effect<unknown, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encode(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(args)),\n Match.exhaustive,\n );\n\nexport const decodeReturns = <Ref_ extends Any>(\n ref: Ref_,\n returns: unknown,\n): Effect.Effect<Returns<Ref_>, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decode(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(returns)),\n Match.exhaustive,\n );\n\nexport const encodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => args),\n Match.exhaustive,\n );\n\nexport const decodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedArgs: unknown,\n): Args<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeSync(confectFunctionProvenance.args)(encodedArgs),\n ),\n Match.tag(\"Convex\", () => encodedArgs),\n Match.exhaustive,\n ) as Args<Ref_>;\n\nexport const encodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n returns: Returns<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => returns),\n Match.exhaustive,\n );\n\nexport const decodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedReturns: unknown,\n): Returns<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeSync(confectFunctionProvenance.returns)(encodedReturns),\n ),\n Match.tag(\"Convex\", () => encodedReturns),\n Match.exhaustive,\n ) as Returns<Ref_>;\n\nconst ConvexErrorIdentifier = Symbol.for(\"ConvexError\");\n\nexport const isConvexError = (error: unknown): error is ConvexError<Value> =>\n error instanceof ConvexError ||\n (typeof error === \"object\" &&\n error !== null &&\n ConvexErrorIdentifier in error);\n\n/**\n * Build a callback-style handler that decodes the ref's typed error from a\n * caught `ConvexError`, or else forwards the value to `mapUnknownError`. The\n * fallback is also invoked when the input *is* a `ConvexError` but the ref\n * doesn't declare a typed-error schema—by definition such a value falls\n * outside the ref's error contract. Useful when adapting non-Effect APIs (e.g.\n * emitter callbacks for streamed subscriptions) to the same error semantics\n * that `runWithCodec` provides.\n */\nexport const decodeErrorOrElse =\n <Ref_ extends Any, E>(ref: Ref_, mapUnknownError: (error: unknown) => E) =>\n (error: unknown): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorSync(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n return mapUnknownError(error);\n };\n\n/**\n * Decode `encodedError` against the ref's error schema. Returns `None` if the\n * ref doesn't declare a typed error (Confect ref without an `error` schema, or\n * a Convex-provenance ref)—by definition there's nothing to decode the value\n * into, and the caller is responsible for deciding what to do (typically:\n * surface the original value as a defect).\n */\nexport const decodeError = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Effect.Effect<Option.Option<Error<Ref_>>, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Effect.map(\n Schema.decode(confectFunctionProvenance.error)(encodedError),\n Option.some,\n )\n : Effect.succeed(Option.none<Error<Ref_>>()),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(Option.none<Error<Ref_>>())),\n Match.exhaustive,\n );\n\n/**\n * Synchronous counterpart to `decodeError`. Throws on schema decode failure;\n * returns `None` when the ref doesn't declare a typed error.\n */\nexport const decodeErrorSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Option.Option<Error<Ref_>> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Option.some(\n Schema.decodeSync(confectFunctionProvenance.error)(\n encodedError,\n ) as Error<Ref_>,\n )\n : Option.none<Error<Ref_>>(),\n ),\n Match.tag(\"Convex\", () => Option.none<Error<Ref_>>()),\n Match.exhaustive,\n );\n\nexport const maybeDecodeErrorSync = <Ref_ extends Any>(\n ref: Ref_,\n error: unknown,\n): unknown =>\n isConvexError(error)\n ? Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Schema.decodeSync(confectFunctionProvenance.error)(error.data)\n : error,\n ),\n Match.tag(\"Convex\", () => error),\n Match.exhaustive,\n )\n : error;\n\n/**\n * Encode args via the ref's args schema, invoke `call`, decode returns via the\n * ref's returns schema, and translate any thrown `ConvexError` into the ref's\n * typed error. Anything else the Promise rejects with—network failures,\n * server-side runtime errors, validation failures, etc.—is passed to\n * `mapUnknownError` to be turned into a typed `E`, or surfaced as a defect when\n * no handler is provided.\n */\nexport const runWithCodec = <Ref_ extends Any, E = never>(\n ref: Ref_,\n args: Args<Ref_>,\n call: (\n functionReference: FunctionReference<Ref_>,\n encodedArgs: unknown,\n ) => PromiseLike<unknown>,\n mapUnknownError?: (error: unknown) => E,\n): Effect.Effect<Returns<Ref_>, E | Error<Ref_> | ParseResult.ParseError> =>\n Effect.gen(function* () {\n const functionReference = getFunctionReference(ref);\n const functionProvenance = ref.functionSpec.functionProvenance;\n const invoke = (\n encodedArgs: unknown,\n ): Effect.Effect<unknown, Error<Ref_> | E> =>\n Effect.tryPromise({\n try: () => Promise.resolve(call(functionReference, encodedArgs)),\n catch: (error): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorSync(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n if (mapUnknownError !== undefined) {\n return mapUnknownError(error);\n }\n throw error;\n },\n });\n return yield* Match.value(functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Effect.gen(function* () {\n const encodedArgs = yield* Schema.encode(\n confectFunctionProvenance.args,\n )(args);\n const encodedReturns = yield* invoke(encodedArgs);\n return yield* Schema.decode(confectFunctionProvenance.returns)(\n encodedReturns,\n );\n }),\n ),\n Match.tag(\"Convex\", () => invoke(args)),\n Match.exhaustive,\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsLA,MAAa,QAMX,mBACA,kBACqC;CAAE;CAAc;AAAkB;AAEzE,MAAa,yBAAyB,QACpC,GAAG,IAAI,kBAAkB,GAAG,IAAI,aAAa;AAE/C,MAAM,yCAAyB,IAAI,IAAoC;AAEvE,MAAa,wBACX,QAC4B;CAC5B,MAAM,eAAe,sBAAsB,GAAG;CAE9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B,GACA,MAAM,IAAI,gBAAgB,OAAO,KAAkB,CAAC,GACpD,MAAM,UACR;AAEF,MAAa,wBACX,KACA,UAEA,cAAc,KAAK,IACf,MAAM,MAAM,IAAI,aAAa,kBAAkB,CAAC,CAAC,KAC/C,MAAM,IAAI,YAAY,8BACpB,WAAW,4BACP,OAAO,WAAW,0BAA0B,KAAK,CAAC,CAAC,MAAM,IAAI,IAC7D,KACN,GACA,MAAM,IAAI,gBAAgB,KAAK,GAC/B,MAAM,UACR,IACA;;;;;;;;;AAUN,MAAa,gBACX,KACA,MACA,MAIA,oBAEA,OAAO,IAAI,aAAa;CACtB,MAAM,oBAAoB,qBAAqB,GAAG;CAClD,MAAM,qBAAqB,IAAI,aAAa;CAC5C,MAAM,UACJ,gBAEA,OAAO,WAAW;EAChB,WAAW,QAAQ,QAAQ,KAAK,mBAAmB,WAAW,CAAC;EAC/D,QAAQ,UAA2B;GACjC,IAAI,cAAc,KAAK,GAAG;IACxB,MAAM,UAAU,gBAAgB,KAAK,MAAM,IAAI;IAC/C,IAAI,OAAO,OAAO,OAAO,GACvB,OAAO,QAAQ;GAEnB;GACA,IAAI,oBAAoB,KAAA,GACtB,OAAO,gBAAgB,KAAK;GAE9B,MAAM;EACR;CACF,CAAC;CACH,OAAO,OAAO,MAAM,MAAM,kBAAkB,CAAC,CAAC,KAC5C,MAAM,IAAI,YAAY,8BACpB,OAAO,IAAI,aAAa;EACtB,MAAM,cAAc,OAAO,OAAO,OAChC,0BAA0B,IAC5B,CAAC,CAAC,IAAI;EACN,MAAM,iBAAiB,OAAO,OAAO,WAAW;EAChD,OAAO,OAAO,OAAO,OAAO,0BAA0B,OAAO,CAAC,CAC5D,cACF;CACF,CAAC,CACH,GACA,MAAM,IAAI,gBAAgB,OAAO,IAAI,CAAC,GACtC,MAAM,UACR;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type {\n FunctionReference as ConvexFunctionReference,\n FunctionVisibility,\n PaginationOptions,\n PaginationResult,\n} from \"convex/server\";\nimport { makeFunctionReference } from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport { ConvexError } from \"convex/values\";\nimport type { ParseResult } from \"effect\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport interface Ref<\n _RuntimeAndFunctionType extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n _FunctionVisibility extends FunctionVisibility,\n _Args,\n _Returns,\n _Error = never,\n> {\n readonly _RuntimeAndFunctionType?: _RuntimeAndFunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n readonly _Error?: _Error;\n /** @internal */\n readonly functionSpec: FunctionSpec.AnyWithProps;\n /** @internal */\n readonly functionNamespace: string;\n}\n\nexport interface Any extends Ref<any, any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any, any> {}\n\nexport interface AnyQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicPaginatedQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n {\n [key: string]: any;\n paginationOpts: PaginationOptions;\n },\n PaginationResult<any>,\n any\n> {}\n\nexport interface AnyMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport type GetRuntimeAndFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType_\n : never;\n\nexport type GetRuntime<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetRuntime<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionVisibility<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer FunctionVisibility_,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? FunctionVisibility_\n : never;\n\nexport type Args<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer Args_,\n infer _Returns,\n infer _Error\n >\n ? Args_\n : never;\n\nexport type OptionalArgs<Ref_ extends Any> = keyof Args<Ref_> extends never\n ? [args?: Args<Ref_>]\n : [args: Args<Ref_>];\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_,\n infer _Error\n >\n ? Returns_\n : never;\n\nexport type Error<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer Error_\n >\n ? Error_\n : never;\n\nexport type FunctionReference<Ref_ extends Any> = ConvexFunctionReference<\n GetFunctionType<Ref_>,\n GetFunctionVisibility<Ref_>\n>;\n\nexport type FromFunctionSpec<FunctionSpec_ extends FunctionSpec.AnyWithProps> =\n Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n FunctionSpec.Args<FunctionSpec_>,\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>\n >;\n\nexport const make = <FunctionSpec_ extends FunctionSpec.AnyWithProps>(\n /**\n * The namespace portion of a Convex function name, i.e. the part before the\n * colon. For example, for `myGroupDir/myGroupMod:myFunc` this would be\n * `myGroupDir/myGroupMod`.\n */\n functionNamespace: string,\n functionSpec: FunctionSpec_,\n): FromFunctionSpec<FunctionSpec_> => ({ functionSpec, functionNamespace });\n\nexport const getConvexFunctionName = (ref: Any): string =>\n `${ref.functionNamespace}:${ref.functionSpec.name}`;\n\nconst functionReferenceCache = new Map<string, FunctionReference<Any>>();\n\nexport const getFunctionReference = <Ref_ extends Any>(\n ref: Ref_,\n): FunctionReference<Ref_> => {\n const functionName = getConvexFunctionName(ref);\n\n const cached = functionReferenceCache.get(functionName);\n if (cached !== undefined) {\n return cached as FunctionReference<Ref_>;\n }\n\n const functionReference = makeFunctionReference(functionName);\n functionReferenceCache.set(functionName, functionReference);\n\n return functionReference as FunctionReference<Ref_>;\n};\n\nexport const hasErrorSchema = (ref: Any): boolean =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\n \"Confect\",\n (confectFunctionProvenance) => \"error\" in confectFunctionProvenance,\n ),\n Match.tag(\"Convex\", () => false),\n Match.exhaustive,\n );\n\nexport const encodeArgs = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): Effect.Effect<unknown, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encode(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(args)),\n Match.exhaustive,\n );\n\nexport const decodeReturns = <Ref_ extends Any>(\n ref: Ref_,\n returns: unknown,\n): Effect.Effect<Returns<Ref_>, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknown(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(returns)),\n Match.exhaustive,\n );\n\nexport const encodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => args),\n Match.exhaustive,\n );\n\nexport const decodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedArgs: unknown,\n): Args<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknownSync(confectFunctionProvenance.args)(encodedArgs),\n ),\n Match.tag(\"Convex\", () => encodedArgs),\n Match.exhaustive,\n ) as Args<Ref_>;\n\nexport const encodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n returns: Returns<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => returns),\n Match.exhaustive,\n );\n\nexport const decodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedReturns: unknown,\n): Returns<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknownSync(confectFunctionProvenance.returns)(\n encodedReturns,\n ),\n ),\n Match.tag(\"Convex\", () => encodedReturns),\n Match.exhaustive,\n ) as Returns<Ref_>;\n\nconst ConvexErrorIdentifier = Symbol.for(\"ConvexError\");\n\nexport const isConvexError = (error: unknown): error is ConvexError<Value> =>\n error instanceof ConvexError ||\n (typeof error === \"object\" &&\n error !== null &&\n ConvexErrorIdentifier in error);\n\n/**\n * Build a callback-style handler that decodes the ref's typed error from a\n * caught `ConvexError`, or else forwards the value to `mapUnknownError`. The\n * fallback is also invoked when the input *is* a `ConvexError` but the ref\n * doesn't declare a typed-error schema—by definition such a value falls\n * outside the ref's error contract. Useful when adapting non-Effect APIs (e.g.\n * emitter callbacks for streamed subscriptions) to the same error semantics\n * that `runWithCodec` provides.\n */\nexport const decodeErrorOrElse =\n <Ref_ extends Any, E>(ref: Ref_, mapUnknownError: (error: unknown) => E) =>\n (error: unknown): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorOption(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n return mapUnknownError(error);\n };\n\n/**\n * Decode `encodedError` against the ref's error schema. Returns `None` if the\n * ref doesn't declare a typed error (Confect ref without an `error` schema, or\n * a Convex-provenance ref)—by definition there's nothing to decode the value\n * into, and the caller is responsible for deciding what to do (typically:\n * surface the original value as a defect).\n */\nexport const decodeError = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Effect.Effect<Option.Option<Error<Ref_>>, ParseResult.ParseError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Effect.map(\n Schema.decodeUnknown(confectFunctionProvenance.error)(encodedError),\n Option.some,\n )\n : Effect.succeed(Option.none<Error<Ref_>>()),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(Option.none<Error<Ref_>>())),\n Match.exhaustive,\n );\n\n/**\n * Synchronous counterpart to `decodeError`. Returns `None` when the value is\n * not this ref's typed error — either because the ref declares no `error`\n * schema, or because `encodedError` doesn't match the one it declares.\n *\n * The second case is reachable in normal operation: Convex raises its own\n * `ConvexError`s (an `InvalidCursor` pagination error, for instance), and\n * those never match a user-declared error schema. Callers pair this with a\n * fallback that surfaces the original error, so failing to decode must not\n * throw — a `ParseError` here would replace the real error with an opaque one\n * and lose the only useful diagnostic. Hence the `Option` suffix rather than\n * `Sync`, matching `Schema.decodeUnknownOption`: the sibling `*Sync` helpers\n * in this module all throw on a parse failure, and this one deliberately\n * doesn't.\n */\nexport const decodeErrorOption = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Option.Option<Error<Ref_>> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? (Schema.decodeUnknownOption(confectFunctionProvenance.error)(\n encodedError,\n ) as Option.Option<Error<Ref_>>)\n : Option.none<Error<Ref_>>(),\n ),\n Match.tag(\"Convex\", () => Option.none<Error<Ref_>>()),\n Match.exhaustive,\n );\n\nconst missingPaginatedProvenanceError = (ref: Any) =>\n new globalThis.Error(\n `Paginated query ref \"${getConvexFunctionName(ref)}\" was not built with ` +\n \"`FunctionSpec.publicPaginatedQuery` (or `FunctionSpec.internalPaginatedQuery`). \" +\n \"Paginated encoding and decoding require the user-args and item schemas \" +\n \"those constructors store. Define the function as, e.g.:\\n\\n\" +\n \" FunctionSpec.publicPaginatedQuery({\\n\" +\n ' name: \"...\",\\n' +\n \" args: () => Schema.Struct({ ... }), // optional; without paginationOpts\\n\" +\n \" item: () => ItemSchema,\\n\" +\n \" })\",\n );\n\n/**\n * Encode the args of a paginated query ref via its user-args schema —\n * `paginationOpts` is excluded, since the pagination protocol fields are\n * managed by the client (e.g. `usePaginatedQuery` from `convex/react`), not by\n * the caller. Requires a ref built with `FunctionSpec.publicPaginatedQuery`\n * (or `internalPaginatedQuery`).\n */\nexport const encodePaginatedQueryArgsSync = <\n Ref_ extends AnyPublicPaginatedQuery,\n>(\n ref: Ref_,\n args: Omit<Args<Ref_>, \"paginationOpts\">,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) => {\n if (confectFunctionProvenance.kind._tag !== \"Paginated\") {\n throw missingPaginatedProvenanceError(ref);\n }\n return Schema.encodeUnknownSync(confectFunctionProvenance.kind.userArgs)(\n args,\n );\n }),\n Match.tag(\"Convex\", () => args),\n Match.exhaustive,\n );\n\n/**\n * Decode a page of a paginated query's results via the ref's item schema.\n * Requires a ref built with `FunctionSpec.publicPaginatedQuery` (or\n * `internalPaginatedQuery`).\n */\nexport const decodePaginationPageSync = <Ref_ extends AnyPublicPaginatedQuery>(\n ref: Ref_,\n encodedPage: unknown,\n): Returns<Ref_>[\"page\"] =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) => {\n if (confectFunctionProvenance.kind._tag !== \"Paginated\") {\n throw missingPaginatedProvenanceError(ref);\n }\n return Schema.decodeUnknownSync(confectFunctionProvenance.kind.page)(\n encodedPage,\n );\n }),\n Match.tag(\"Convex\", () => encodedPage),\n Match.exhaustive,\n ) as Returns<Ref_>[\"page\"];\n\n/**\n * Encode args via the ref's args schema, invoke `call`, decode returns via the\n * ref's returns schema, and translate any thrown `ConvexError` into the ref's\n * typed error. Anything else the Promise rejects with—network failures,\n * server-side runtime errors, validation failures, etc.—is passed to\n * `mapUnknownError` to be turned into a typed `E`, or surfaced as a defect when\n * no handler is provided.\n */\nexport const runWithCodec = <Ref_ extends Any, E = never>(\n ref: Ref_,\n args: Args<Ref_>,\n call: (\n functionReference: FunctionReference<Ref_>,\n encodedArgs: unknown,\n ) => PromiseLike<unknown>,\n mapUnknownError?: (error: unknown) => E,\n): Effect.Effect<Returns<Ref_>, E | Error<Ref_> | ParseResult.ParseError> =>\n Effect.gen(function* () {\n const functionReference = getFunctionReference(ref);\n const functionProvenance = ref.functionSpec.functionProvenance;\n const invoke = (\n encodedArgs: unknown,\n ): Effect.Effect<unknown, Error<Ref_> | E> =>\n Effect.tryPromise({\n try: () => Promise.resolve(call(functionReference, encodedArgs)),\n catch: (error): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorOption(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n if (mapUnknownError !== undefined) {\n return mapUnknownError(error);\n }\n throw error;\n },\n });\n return yield* Match.value(functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Effect.gen(function* () {\n const encodedArgs = yield* Schema.encode(\n confectFunctionProvenance.args,\n )(args);\n const encodedReturns = yield* invoke(encodedArgs);\n return yield* Schema.decodeUnknown(confectFunctionProvenance.returns)(\n encodedReturns,\n );\n }),\n ),\n Match.tag(\"Convex\", () => invoke(args)),\n Match.exhaustive,\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmMA,MAAa,QAMX,mBACA,kBACqC;CAAE;CAAc;AAAkB;AAEzE,MAAa,yBAAyB,QACpC,GAAG,IAAI,kBAAkB,GAAG,IAAI,aAAa;AAE/C,MAAM,yCAAyB,IAAI,IAAoC;AAEvE,MAAa,wBACX,QAC4B;CAC5B,MAAM,eAAe,sBAAsB,GAAG;CAE9C,MAAM,SAAS,uBAAuB,IAAI,YAAY;CACtD,IAAI,WAAW,KAAA,GACb,OAAO;CAGT,MAAM,oBAAoB,sBAAsB,YAAY;CAC5D,uBAAuB,IAAI,cAAc,iBAAiB;CAE1D,OAAO;AACT;AAEA,MAAa,kBAAkB,QAC7B,MAAM,MAAM,IAAI,aAAa,kBAAkB,CAAC,CAAC,KAC/C,MAAM,IACJ,YACC,8BAA8B,WAAW,yBAC5C,GACA,MAAM,IAAI,gBAAgB,KAAK,GAC/B,MAAM,UACR;AAEF,MAAa,cACX,KACA,SAEA,MAAM,MAAM,IAAI,aAAa,kBAAkB,CAAC,CAAC,KAC/C,MAAM,IAAI,YAAY,8BACpB,OAAO,OAAO,0BAA0B,IAAI,CAAC,CAAC,IAAI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ACA,gBAEA,MAAM,MAAM,IAAI,aAAa,kBAAkB,CAAC,CAAC,KAC/C,MAAM,IAAI,YAAY,8BAA8B;CAClD,IAAI,0BAA0B,KAAK,SAAS,aAC1C,MAAM,gCAAgC,GAAG;CAE3C,OAAO,OAAO,kBAAkB,0BAA0B,KAAK,IAAI,CAAC,CAClE,WACF;AACF,CAAC,GACD,MAAM,IAAI,gBAAgB,WAAW,GACrC,MAAM,UACR;;;;;;;;;AAUF,MAAa,gBACX,KACA,MACA,MAIA,oBAEA,OAAO,IAAI,aAAa;CACtB,MAAM,oBAAoB,qBAAqB,GAAG;CAClD,MAAM,qBAAqB,IAAI,aAAa;CAC5C,MAAM,UACJ,gBAEA,OAAO,WAAW;EAChB,WAAW,QAAQ,QAAQ,KAAK,mBAAmB,WAAW,CAAC;EAC/D,QAAQ,UAA2B;GACjC,IAAI,cAAc,KAAK,GAAG;IACxB,MAAM,UAAU,kBAAkB,KAAK,MAAM,IAAI;IACjD,IAAI,OAAO,OAAO,OAAO,GACvB,OAAO,QAAQ;GAEnB;GACA,IAAI,oBAAoB,KAAA,GACtB,OAAO,gBAAgB,KAAK;GAE9B,MAAM;EACR;CACF,CAAC;CACH,OAAO,OAAO,MAAM,MAAM,kBAAkB,CAAC,CAAC,KAC5C,MAAM,IAAI,YAAY,8BACpB,OAAO,IAAI,aAAa;EACtB,MAAM,cAAc,OAAO,OAAO,OAChC,0BAA0B,IAC5B,CAAC,CAAC,IAAI;EACN,MAAM,iBAAiB,OAAO,OAAO,WAAW;EAChD,OAAO,OAAO,OAAO,cAAc,0BAA0B,OAAO,CAAC,CACnE,cACF;CACF,CAAC,CACH,GACA,MAAM,IAAI,gBAAgB,OAAO,IAAI,CAAC,GACtC,MAAM,UACR;AACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * as GroupPath from "./GroupPath";
|
|
|
5
5
|
export * as GroupSpec from "./GroupSpec";
|
|
6
6
|
export * as Identifier from "./Identifier";
|
|
7
7
|
export * as Lazy from "./Lazy";
|
|
8
|
+
export * as PaginationOptions from "./PaginationOptions";
|
|
8
9
|
export * as PaginationResult from "./PaginationResult";
|
|
9
10
|
export * as Ref from "./Ref";
|
|
10
11
|
export * as Refs from "./Refs";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Lazy_exports } from "./Lazy.js";
|
|
2
|
+
import { PaginationOptions_exports } from "./PaginationOptions.js";
|
|
3
|
+
import { PaginationResult_exports } from "./PaginationResult.js";
|
|
2
4
|
import { FunctionProvenance_exports } from "./FunctionProvenance.js";
|
|
3
5
|
import { Identifier_exports } from "./Identifier.js";
|
|
4
6
|
import { RuntimeAndFunctionType_exports } from "./RuntimeAndFunctionType.js";
|
|
@@ -6,7 +8,6 @@ import { FunctionSpec_exports } from "./FunctionSpec.js";
|
|
|
6
8
|
import { GenericId_exports } from "./GenericId.js";
|
|
7
9
|
import { GroupPath_exports } from "./GroupPath.js";
|
|
8
10
|
import { GroupSpec_exports } from "./GroupSpec.js";
|
|
9
|
-
import { PaginationResult_exports } from "./PaginationResult.js";
|
|
10
11
|
import { Ref_exports } from "./Ref.js";
|
|
11
12
|
import { Refs_exports } from "./Refs.js";
|
|
12
13
|
import { Registry_exports } from "./Registry.js";
|
|
@@ -14,4 +15,4 @@ import { Spec_exports } from "./Spec.js";
|
|
|
14
15
|
import { SystemFields_exports } from "./SystemFields.js";
|
|
15
16
|
import { Types_exports } from "./Types.js";
|
|
16
17
|
import { UserIdentity_exports } from "./UserIdentity.js";
|
|
17
|
-
export { FunctionProvenance_exports as FunctionProvenance, FunctionSpec_exports as FunctionSpec, GenericId_exports as GenericId, GroupPath_exports as GroupPath, GroupSpec_exports as GroupSpec, Identifier_exports as Identifier, Lazy_exports as Lazy, PaginationResult_exports as PaginationResult, Ref_exports as Ref, Refs_exports as Refs, Registry_exports as Registry, RuntimeAndFunctionType_exports as RuntimeAndFunctionType, Spec_exports as Spec, SystemFields_exports as SystemFields, Types_exports as Types, UserIdentity_exports as UserIdentity };
|
|
18
|
+
export { FunctionProvenance_exports as FunctionProvenance, FunctionSpec_exports as FunctionSpec, GenericId_exports as GenericId, GroupPath_exports as GroupPath, GroupSpec_exports as GroupSpec, Identifier_exports as Identifier, Lazy_exports as Lazy, PaginationOptions_exports as PaginationOptions, PaginationResult_exports as PaginationResult, Ref_exports as Ref, Refs_exports as Refs, Registry_exports as Registry, RuntimeAndFunctionType_exports as RuntimeAndFunctionType, Spec_exports as Spec, SystemFields_exports as SystemFields, Types_exports as Types, UserIdentity_exports as UserIdentity };
|