@orpc/nest 1.13.0 → 1.13.1

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.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { AnySchema, ContractRouter, HTTPPath, AnyContractRouter, ContractProcedure } from '@orpc/contract';
1
+ import { AnySchema, ContractRouter, HTTPPath, AnyContractRouter } from '@orpc/contract';
2
+ export { PopulateContractRouterPathsOptions, PopulatedContractRouterPaths, populateContractRouterPaths } from '@orpc/contract';
2
3
  import { CreateProcedureClientOptions, Router, Context, BuilderConfig, Implementer } from '@orpc/server';
3
4
  export { ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, ORPCError, ProcedureImplementer, RouterImplementer, RouterImplementerWithMiddlewares, onError, onFinish, onStart, onSuccess } from '@orpc/server';
4
5
  import { DynamicModule, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
@@ -55,26 +56,11 @@ declare class ImplementInterceptor implements NestInterceptor {
55
56
  }
56
57
 
57
58
  declare function toNestPattern(path: HTTPPath): string;
58
- type PopulatedContractRouterPaths<T extends AnyContractRouter> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrors, infer UMeta> ? ContractProcedure<UInputSchema, UOutputSchema, UErrors, UMeta> : {
59
- [K in keyof T]: T[K] extends AnyContractRouter ? PopulatedContractRouterPaths<T[K]> : never;
60
- };
61
- interface PopulateContractRouterPathsOptions {
62
- path?: readonly string[];
63
- }
64
- /**
65
- * populateContractRouterPaths is completely optional,
66
- * because the procedure's path is required for NestJS implementation.
67
- * This utility automatically populates any missing paths
68
- * Using the router's keys + `/`.
69
- *
70
- * @see {@link https://orpc.dev/docs/openapi/integrations/implement-contract-in-nest#define-your-contract NestJS Implement Contract Docs}
71
- */
72
- declare function populateContractRouterPaths<T extends AnyContractRouter>(router: T, options?: PopulateContractRouterPathsOptions): PopulatedContractRouterPaths<T>;
73
59
 
74
60
  /**
75
61
  * Alias for `implement` from `@orpc/server` with default context set to `ORPCGlobalContext`
76
62
  */
77
63
  declare function implement<T extends AnyContractRouter, TContext extends Context = ORPCGlobalContext>(contract: T, config?: BuilderConfig): Implementer<T, TContext, TContext>;
78
64
 
79
- export { Implement as Impl, Implement, ImplementInterceptor, ORPCModule, ORPC_MODULE_CONFIG_SYMBOL, implement, populateContractRouterPaths, toNestPattern };
80
- export type { ORPCGlobalContext, ORPCModuleConfig, PopulateContractRouterPathsOptions, PopulatedContractRouterPaths };
65
+ export { Implement as Impl, Implement, ImplementInterceptor, ORPCModule, ORPC_MODULE_CONFIG_SYMBOL, implement, toNestPattern };
66
+ export type { ORPCGlobalContext, ORPCModuleConfig };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { AnySchema, ContractRouter, HTTPPath, AnyContractRouter, ContractProcedure } from '@orpc/contract';
1
+ import { AnySchema, ContractRouter, HTTPPath, AnyContractRouter } from '@orpc/contract';
2
+ export { PopulateContractRouterPathsOptions, PopulatedContractRouterPaths, populateContractRouterPaths } from '@orpc/contract';
2
3
  import { CreateProcedureClientOptions, Router, Context, BuilderConfig, Implementer } from '@orpc/server';
3
4
  export { ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, ORPCError, ProcedureImplementer, RouterImplementer, RouterImplementerWithMiddlewares, onError, onFinish, onStart, onSuccess } from '@orpc/server';
4
5
  import { DynamicModule, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
@@ -55,26 +56,11 @@ declare class ImplementInterceptor implements NestInterceptor {
55
56
  }
56
57
 
57
58
  declare function toNestPattern(path: HTTPPath): string;
58
- type PopulatedContractRouterPaths<T extends AnyContractRouter> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrors, infer UMeta> ? ContractProcedure<UInputSchema, UOutputSchema, UErrors, UMeta> : {
59
- [K in keyof T]: T[K] extends AnyContractRouter ? PopulatedContractRouterPaths<T[K]> : never;
60
- };
61
- interface PopulateContractRouterPathsOptions {
62
- path?: readonly string[];
63
- }
64
- /**
65
- * populateContractRouterPaths is completely optional,
66
- * because the procedure's path is required for NestJS implementation.
67
- * This utility automatically populates any missing paths
68
- * Using the router's keys + `/`.
69
- *
70
- * @see {@link https://orpc.dev/docs/openapi/integrations/implement-contract-in-nest#define-your-contract NestJS Implement Contract Docs}
71
- */
72
- declare function populateContractRouterPaths<T extends AnyContractRouter>(router: T, options?: PopulateContractRouterPathsOptions): PopulatedContractRouterPaths<T>;
73
59
 
74
60
  /**
75
61
  * Alias for `implement` from `@orpc/server` with default context set to `ORPCGlobalContext`
76
62
  */
77
63
  declare function implement<T extends AnyContractRouter, TContext extends Context = ORPCGlobalContext>(contract: T, config?: BuilderConfig): Implementer<T, TContext, TContext>;
78
64
 
79
- export { Implement as Impl, Implement, ImplementInterceptor, ORPCModule, ORPC_MODULE_CONFIG_SYMBOL, implement, populateContractRouterPaths, toNestPattern };
80
- export type { ORPCGlobalContext, ORPCModuleConfig, PopulateContractRouterPathsOptions, PopulatedContractRouterPaths };
65
+ export { Implement as Impl, Implement, ImplementInterceptor, ORPCModule, ORPC_MODULE_CONFIG_SYMBOL, implement, toNestPattern };
66
+ export type { ORPCGlobalContext, ORPCModuleConfig };
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  import { getRouter, unlazy, isProcedure, implement as implement$1 } from '@orpc/server';
2
2
  export { ORPCError, onError, onFinish, onStart, onSuccess } from '@orpc/server';
3
3
  import { Module, Injectable, Inject, Optional, applyDecorators, Delete, Patch, Put, Post, Get, Head, HttpCode, UseInterceptors } from '@nestjs/common';
4
- import { isContractProcedure, ContractProcedure, fallbackContractConfig } from '@orpc/contract';
4
+ import { isContractProcedure, fallbackContractConfig } from '@orpc/contract';
5
+ export { populateContractRouterPaths } from '@orpc/contract';
5
6
  import { standardizeHTTPPath, StandardOpenAPISerializer, StandardOpenAPIJsonSerializer, StandardBracketNotationSerializer } from '@orpc/openapi-client/standard';
6
7
  import { StandardOpenAPICodec } from '@orpc/openapi/standard';
7
8
  import { StandardHandler } from '@orpc/server/standard';
8
- import { toArray, get, intercept } from '@orpc/shared';
9
+ import { get, toArray, intercept } from '@orpc/shared';
9
10
  import * as StandardServerFastify from '@orpc/standard-server-fastify';
10
11
  import * as StandardServerNode from '@orpc/standard-server-node';
11
12
  import { mergeMap } from 'rxjs';
12
- import { toHttpPath } from '@orpc/client/standard';
13
13
 
14
14
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
15
15
  var __decorateClass$1 = (decorators, target, key, kind) => {
@@ -59,26 +59,6 @@ ORPCModule = __decorateClass$1([
59
59
  function toNestPattern(path) {
60
60
  return standardizeHTTPPath(path).replace(/\/\{\+([^}]+)\}/g, "/*$1").replace(/\/\{([^}]+)\}/g, "/:$1");
61
61
  }
62
- function populateContractRouterPaths(router, options = {}) {
63
- const path = toArray(options.path);
64
- if (isContractProcedure(router)) {
65
- if (router["~orpc"].route.path === void 0) {
66
- return new ContractProcedure({
67
- ...router["~orpc"],
68
- route: {
69
- ...router["~orpc"].route,
70
- path: toHttpPath(path)
71
- }
72
- });
73
- }
74
- return router;
75
- }
76
- const populated = {};
77
- for (const key in router) {
78
- populated[key] = populateContractRouterPaths(router[key], { ...options, path: [...path, key] });
79
- }
80
- return populated;
81
- }
82
62
 
83
63
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
84
64
  var __decorateClass = (decorators, target, key, kind) => {
@@ -105,7 +85,7 @@ function Implement(contract) {
105
85
  throw new Error(`
106
86
  @Implement decorator requires contract to have a 'path'.
107
87
  Please define one using 'path' property on the '.route' method.
108
- Or use "populateContractRouterPaths" utility to automatically fill in any missing paths.
88
+ Or use "populateContractRouterPaths" from "@orpc/contract" utility to automatically fill in any missing paths.
109
89
  `);
110
90
  }
111
91
  return (target, propertyKey, descriptor) => {
@@ -213,4 +193,4 @@ function implement(contract, config = {}) {
213
193
  return implement$1(contract, config);
214
194
  }
215
195
 
216
- export { Implement as Impl, Implement, ImplementInterceptor, ORPCModule, ORPC_MODULE_CONFIG_SYMBOL, implement, populateContractRouterPaths, toNestPattern };
196
+ export { Implement as Impl, Implement, ImplementInterceptor, ORPCModule, ORPC_MODULE_CONFIG_SYMBOL, implement, toNestPattern };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/nest",
3
3
  "type": "module",
4
- "version": "1.13.0",
4
+ "version": "1.13.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.dev",
7
7
  "repository": {
@@ -39,15 +39,15 @@
39
39
  }
40
40
  },
41
41
  "dependencies": {
42
- "@orpc/openapi": "1.13.0",
43
- "@orpc/client": "1.13.0",
44
- "@orpc/openapi-client": "1.13.0",
45
- "@orpc/server": "1.13.0",
46
- "@orpc/contract": "1.13.0",
47
- "@orpc/shared": "1.13.0",
48
- "@orpc/standard-server-fastify": "1.13.0",
49
- "@orpc/standard-server": "1.13.0",
50
- "@orpc/standard-server-node": "1.13.0"
42
+ "@orpc/contract": "1.13.1",
43
+ "@orpc/openapi": "1.13.1",
44
+ "@orpc/openapi-client": "1.13.1",
45
+ "@orpc/client": "1.13.1",
46
+ "@orpc/server": "1.13.1",
47
+ "@orpc/shared": "1.13.1",
48
+ "@orpc/standard-server": "1.13.1",
49
+ "@orpc/standard-server-fastify": "1.13.1",
50
+ "@orpc/standard-server-node": "1.13.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@fastify/cookie": "^11.0.2",