@orpc/contract 2.0.0-beta.48 → 2.0.0-beta.49

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.
Files changed (81) hide show
  1. package/README.md +4 -4
  2. package/dist/builder-variants.d.ts +103 -0
  3. package/dist/builder.d.ts +78 -0
  4. package/dist/builder.js +112 -0
  5. package/dist/client-factory.d.ts +24 -0
  6. package/dist/client-factory.js +38 -0
  7. package/dist/error-factory.d.ts +80 -0
  8. package/dist/error-factory.js +121 -0
  9. package/dist/error-utils.d.ts +5 -0
  10. package/dist/error-utils.js +40 -0
  11. package/dist/error.d.ts +45 -0
  12. package/dist/error.js +20 -0
  13. package/dist/index.d.ts +62 -0
  14. package/dist/index.js +31 -0
  15. package/dist/meta-built-in.d.ts +30 -0
  16. package/dist/meta-built-in.js +54 -0
  17. package/dist/meta-utils.d.ts +58 -0
  18. package/dist/meta-utils.js +76 -0
  19. package/dist/meta.d.ts +53 -0
  20. package/dist/meta.js +13 -0
  21. package/dist/plugins/index.d.ts +12 -0
  22. package/dist/plugins/index.js +12 -0
  23. package/dist/plugins/request-validation.d.ts +28 -0
  24. package/dist/plugins/request-validation.js +55 -0
  25. package/dist/plugins/response-validation.d.ts +15 -0
  26. package/dist/plugins/response-validation.js +72 -0
  27. package/dist/procedure-client.d.ts +5 -0
  28. package/dist/procedure.d.ts +28 -0
  29. package/dist/procedure.js +28 -0
  30. package/dist/router-client.d.ts +13 -0
  31. package/dist/router-utils.d.ts +30 -0
  32. package/dist/router-utils.js +79 -0
  33. package/dist/router.d.ts +52 -0
  34. package/dist/schema-built-in.d.ts +23 -0
  35. package/dist/schema-built-in.js +76 -0
  36. package/dist/schema-utils.d.ts +20 -0
  37. package/dist/schema-utils.js +44 -0
  38. package/dist/schema.d.ts +25 -0
  39. package/package.json +28 -30
  40. package/dist/builder-variants.d.mts +0 -113
  41. package/dist/builder.d.mts +0 -78
  42. package/dist/builder.mjs +0 -71
  43. package/dist/client-factory.d.mts +0 -24
  44. package/dist/client-factory.mjs +0 -34
  45. package/dist/error-factory.d.mts +0 -87
  46. package/dist/error-factory.mjs +0 -75
  47. package/dist/error-utils.d.mts +0 -11
  48. package/dist/error-utils.mjs +0 -43
  49. package/dist/error.d.mts +0 -41
  50. package/dist/error.mjs +0 -12
  51. package/dist/index.d.mts +0 -62
  52. package/dist/index.mjs +0 -25
  53. package/dist/meta-built-in.d.mts +0 -38
  54. package/dist/meta-built-in.mjs +0 -40
  55. package/dist/meta-utils.d.mts +0 -62
  56. package/dist/meta-utils.mjs +0 -33
  57. package/dist/meta.d.mts +0 -61
  58. package/dist/meta.mjs +0 -11
  59. package/dist/plugins/index.d.mts +0 -12
  60. package/dist/plugins/index.mjs +0 -8
  61. package/dist/plugins/request-validation.d.mts +0 -28
  62. package/dist/plugins/request-validation.mjs +0 -46
  63. package/dist/plugins/response-validation.d.mts +0 -15
  64. package/dist/plugins/response-validation.mjs +0 -53
  65. package/dist/procedure-client.d.mts +0 -10
  66. package/dist/procedure.d.mts +0 -36
  67. package/dist/procedure.mjs +0 -19
  68. package/dist/router-client.d.mts +0 -14
  69. package/dist/router-utils.d.mts +0 -34
  70. package/dist/router-utils.mjs +0 -67
  71. package/dist/router.d.mts +0 -42
  72. package/dist/schema-built-in.d.mts +0 -28
  73. package/dist/schema-built-in.mjs +0 -73
  74. package/dist/schema-utils.d.mts +0 -26
  75. package/dist/schema-utils.mjs +0 -29
  76. package/dist/schema.d.mts +0 -31
  77. /package/dist/{builder-variants.mjs → builder-variants.js} +0 -0
  78. /package/dist/{procedure-client.mjs → procedure-client.js} +0 -0
  79. /package/dist/{router-client.mjs → router-client.js} +0 -0
  80. /package/dist/{router.mjs → router.js} +0 -0
  81. /package/dist/{schema.mjs → schema.js} +0 -0
@@ -1,26 +0,0 @@
1
- import type { IsEqual, Promisable } from "@orpc/shared";
2
- import type { Schema, SchemaIssue } from "./schema.mjs";
3
- export type TypeRest<
4
- TInput,
5
- TOutput
6
- > = [map: (input: TInput) => Promisable<TOutput>] | (IsEqual<TInput, TOutput> extends true ? [] : never);
7
- /**
8
- * Create a schema for things can be trust without validation.
9
- * You can optionally pass a map function for mapping
10
- *
11
- * @example
12
- * ```ts
13
- * const normal = type<number>()
14
- * const withMap = type<number, string>(input => input.toString())
15
- *```
16
- *
17
- * @see {@link https://orpc.dev/docs/procedure#type-utility | Procedure - type Utility}
18
- */
19
- export declare function type<
20
- TInput,
21
- TOutput = TInput
22
- >(...[map]: TypeRest<TInput, TOutput>): Schema<TInput, TOutput>;
23
- /**
24
- * Check if the given issue is following the standard-schema issue format.
25
- */
26
- export declare function isSchemaIssue(issue: unknown): issue is SchemaIssue;
@@ -1,29 +0,0 @@
1
- import { isPropertyKey, isTypescriptObject, ORPC_NAME } from "@orpc/shared";
2
-
3
- export function type(...[map]) {
4
- return { "~standard": {
5
- vendor: ORPC_NAME,
6
- version: 1,
7
- async validate(value) {
8
- if (map) {
9
- return { value: await map(value) };
10
- }
11
- return { value };
12
- }
13
- } };
14
- }
15
-
16
- export function isSchemaIssue(issue) {
17
- if (!isTypescriptObject(issue) || typeof issue.message !== "string") {
18
- return false;
19
- }
20
- if (issue.path !== undefined) {
21
- if (!Array.isArray(issue.path)) {
22
- return false;
23
- }
24
- if (!issue.path.every((segment) => isPropertyKey(segment) || isTypescriptObject(segment) && isPropertyKey(segment.key))) {
25
- return false;
26
- }
27
- }
28
- return true;
29
- }
package/dist/schema.d.mts DELETED
@@ -1,31 +0,0 @@
1
- import type { StandardSchemaV1 } from "@standard-schema/spec";
2
- /**
3
- * TOutput default = TInput for better readability (shorter) in-case both TInput, TOutput is equal
4
- */
5
- export type Schema<
6
- TInput,
7
- TOutput = TInput
8
- > = StandardSchemaV1<TInput, TOutput>;
9
- /**
10
- * Any Standard Schema compatible schema, regardless of its input and output types.
11
- *
12
- * @see {@link https://orpc.dev/docs/integrations/standard-schema | Standard Schema Integration}
13
- */
14
- export type AnySchema = Schema<any>;
15
- export type SchemaIssue = StandardSchemaV1.Issue;
16
- /**
17
- * Infers the input type of a schema.
18
- *
19
- * @see {@link https://orpc.dev/docs/metadata | Metadata}
20
- */
21
- export type InferSchemaInput<T extends AnySchema> = T extends StandardSchemaV1<infer UInput, any> ? UInput : never;
22
- /**
23
- * Infers the output type of a schema.
24
- *
25
- * @see {@link https://orpc.dev/docs/metadata | Metadata}
26
- */
27
- export type InferSchemaOutput<T extends AnySchema> = T extends StandardSchemaV1<any, infer UOutput> ? UOutput : never;
28
- export type MergedSchema<
29
- T extends AnySchema,
30
- U extends AnySchema
31
- > = T extends Schema<infer TInput, infer TOutput> ? U extends Schema<infer UInput, infer UOutput> ? Schema<TInput & UInput, TOutput & UOutput> : never : never;
File without changes
File without changes
File without changes