@orpc/contract 0.0.0-next.43c0c87 → 0.0.0-next.44bdf93

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/dist/index.js CHANGED
@@ -450,6 +450,22 @@ var ValidationError = class extends Error {
450
450
  }
451
451
  };
452
452
 
453
+ // src/schema-utils.ts
454
+ function type(...[map]) {
455
+ return {
456
+ "~standard": {
457
+ vendor: "custom",
458
+ version: 1,
459
+ async validate(value) {
460
+ if (map) {
461
+ return { value: await map(value) };
462
+ }
463
+ return { value };
464
+ }
465
+ }
466
+ };
467
+ }
468
+
453
469
  // src/index.ts
454
470
  var oc = new ContractBuilder({
455
471
  errorMap: {},
@@ -475,6 +491,7 @@ export {
475
491
  isDefinedError,
476
492
  oc,
477
493
  safe,
494
+ type,
478
495
  validateORPCError
479
496
  };
480
497
  //# sourceMappingURL=index.js.map
@@ -16,6 +16,7 @@ export * from './procedure-decorated';
16
16
  export * from './router';
17
17
  export * from './router-builder';
18
18
  export * from './router-client';
19
+ export * from './schema-utils';
19
20
  export * from './types';
20
21
  export declare const oc: ContractBuilder<Record<never, never>>;
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { IsEqual, Promisable } from '@orpc/shared';
2
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
3
+ export type TypeRest<TInput, TOutput> = [map: (input: TInput) => Promisable<TOutput>] | (IsEqual<TInput, TOutput> extends true ? [] : never);
4
+ export declare function type<TInput, TOutput = TInput>(...[map]: TypeRest<TInput, TOutput>): StandardSchemaV1<TInput, TOutput>;
5
+ //# sourceMappingURL=schema-utils.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/contract",
3
3
  "type": "module",
4
- "version": "0.0.0-next.43c0c87",
4
+ "version": "0.0.0-next.44bdf93",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "@standard-schema/spec": "1.0.0-beta.4",
33
- "@orpc/shared": "0.0.0-next.43c0c87"
33
+ "@orpc/shared": "0.0.0-next.44bdf93"
34
34
  },
35
35
  "devDependencies": {
36
36
  "arktype": "2.0.0-rc.26",