@confect/core 9.0.1 → 9.1.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 +16 -23
- package/dist/Ref.d.ts +2 -0
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +5 -1
- package/dist/Ref.js.map +1 -1
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/Ref.ts +24 -0
package/package.json
CHANGED
package/src/Ref.ts
CHANGED
|
@@ -257,6 +257,30 @@ export const encodeArgsSync = <Ref_ extends Any>(
|
|
|
257
257
|
Match.exhaustive,
|
|
258
258
|
);
|
|
259
259
|
|
|
260
|
+
export const decodeArgsSync = <Ref_ extends Any>(
|
|
261
|
+
ref: Ref_,
|
|
262
|
+
encodedArgs: unknown,
|
|
263
|
+
): Args<Ref_> =>
|
|
264
|
+
Match.value(ref.functionSpec.functionProvenance).pipe(
|
|
265
|
+
Match.tag("Confect", (confectFunctionProvenance) =>
|
|
266
|
+
Schema.decodeSync(confectFunctionProvenance.args)(encodedArgs),
|
|
267
|
+
),
|
|
268
|
+
Match.tag("Convex", () => encodedArgs),
|
|
269
|
+
Match.exhaustive,
|
|
270
|
+
) as Args<Ref_>;
|
|
271
|
+
|
|
272
|
+
export const encodeReturnsSync = <Ref_ extends Any>(
|
|
273
|
+
ref: Ref_,
|
|
274
|
+
returns: Returns<Ref_>,
|
|
275
|
+
): unknown =>
|
|
276
|
+
Match.value(ref.functionSpec.functionProvenance).pipe(
|
|
277
|
+
Match.tag("Confect", (confectFunctionProvenance) =>
|
|
278
|
+
Schema.encodeSync(confectFunctionProvenance.returns)(returns),
|
|
279
|
+
),
|
|
280
|
+
Match.tag("Convex", () => returns),
|
|
281
|
+
Match.exhaustive,
|
|
282
|
+
);
|
|
283
|
+
|
|
260
284
|
export const decodeReturnsSync = <Ref_ extends Any>(
|
|
261
285
|
ref: Ref_,
|
|
262
286
|
encodedReturns: unknown,
|