@vritti/api-sdk 0.4.2 → 0.4.4

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 (61) hide show
  1. package/dist/auth.cjs +58 -17
  2. package/dist/auth.cjs.map +1 -1
  3. package/dist/auth.d.cts +1 -1
  4. package/dist/auth.d.ts +1 -1
  5. package/dist/auth.js +58 -17
  6. package/dist/auth.js.map +1 -1
  7. package/dist/cache.cjs +51 -17
  8. package/dist/cache.cjs.map +1 -1
  9. package/dist/cache.js +51 -17
  10. package/dist/cache.js.map +1 -1
  11. package/dist/catalog-resolver.cjs +3 -3
  12. package/dist/catalog-resolver.cjs.map +1 -1
  13. package/dist/catalog-resolver.d.cts +2 -2
  14. package/dist/catalog-resolver.d.ts +2 -2
  15. package/dist/catalog-resolver.js +3 -3
  16. package/dist/catalog-resolver.js.map +1 -1
  17. package/dist/{code-pattern-BP4zkNtT.d.cts → code-pattern-BQM7qLcU.d.cts} +1 -1
  18. package/dist/{code-pattern-BP4zkNtT.d.ts → code-pattern-BQM7qLcU.d.ts} +1 -1
  19. package/dist/data-table.cjs +153 -47
  20. package/dist/data-table.cjs.map +1 -1
  21. package/dist/data-table.js +153 -47
  22. package/dist/data-table.js.map +1 -1
  23. package/dist/database.cjs +101 -31
  24. package/dist/database.cjs.map +1 -1
  25. package/dist/database.js +101 -31
  26. package/dist/database.js.map +1 -1
  27. package/dist/decorators.d.cts +2 -2
  28. package/dist/decorators.d.ts +2 -2
  29. package/dist/drizzle-pg-core.d.cts +1 -1
  30. package/dist/drizzle-pg-core.d.ts +1 -1
  31. package/dist/email.cjs +22 -6
  32. package/dist/email.cjs.map +1 -1
  33. package/dist/email.js +22 -6
  34. package/dist/email.js.map +1 -1
  35. package/dist/files.cjs +1 -1
  36. package/dist/files.cjs.map +1 -1
  37. package/dist/files.js +1 -1
  38. package/dist/files.js.map +1 -1
  39. package/dist/filters.cjs +18 -4
  40. package/dist/filters.cjs.map +1 -1
  41. package/dist/filters.js +18 -4
  42. package/dist/filters.js.map +1 -1
  43. package/dist/index.d.cts +1 -1
  44. package/dist/index.d.ts +1 -1
  45. package/dist/license.d.cts +1 -1
  46. package/dist/license.d.ts +1 -1
  47. package/dist/logger.cjs +49 -15
  48. package/dist/logger.cjs.map +1 -1
  49. package/dist/logger.js +49 -15
  50. package/dist/logger.js.map +1 -1
  51. package/dist/nats.cjs +49 -17
  52. package/dist/nats.cjs.map +1 -1
  53. package/dist/nats.js +49 -17
  54. package/dist/nats.js.map +1 -1
  55. package/dist/root.cjs +44 -12
  56. package/dist/root.cjs.map +1 -1
  57. package/dist/root.js +44 -12
  58. package/dist/root.js.map +1 -1
  59. package/dist/{types-Cj6uMN5E.d.cts → types-VDKSjje5.d.cts} +3 -3
  60. package/dist/{types-Cj6uMN5E.d.ts → types-VDKSjje5.d.ts} +3 -3
  61. package/package.json +29 -29
package/dist/nats.js CHANGED
@@ -69,8 +69,15 @@ __name(findPgError, "findPgError");
69
69
  // src/filters/rpc-problem-exception.filter.ts
70
70
  function _ts_decorate(decorators, target, key, desc) {
71
71
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
72
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
73
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
72
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
73
+ r = Reflect.decorate(decorators, target, key, desc);
74
+ } else {
75
+ for (var i = decorators.length - 1; i >= 0; i--) {
76
+ if (d = decorators[i]) {
77
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
78
+ }
79
+ }
80
+ }
74
81
  return c > 3 && r && Object.defineProperty(target, key, r), r;
75
82
  }
76
83
  __name(_ts_decorate, "_ts_decorate");
@@ -206,8 +213,8 @@ import { ConfigModule, ConfigService } from "@nestjs/config";
206
213
  import { ClientProxyFactory, Transport } from "@nestjs/microservices";
207
214
 
208
215
  // src/nats/constants.ts
209
- var NATS_MODULE_OPTIONS = Symbol("NATS_MODULE_OPTIONS");
210
- var NATS_CONTEXT_RESOLVER = Symbol("NATS_CONTEXT_RESOLVER");
216
+ var NATS_MODULE_OPTIONS = /* @__PURE__ */ Symbol("NATS_MODULE_OPTIONS");
217
+ var NATS_CONTEXT_RESOLVER = /* @__PURE__ */ Symbol("NATS_CONTEXT_RESOLVER");
211
218
 
212
219
  // src/nats/nats-client.service.ts
213
220
  import { Inject, Injectable, Scope } from "@nestjs/common";
@@ -228,13 +235,22 @@ __name(resolveInjectedRequest, "resolveInjectedRequest");
228
235
  // src/nats/nats-client.service.ts
229
236
  function _ts_decorate2(decorators, target, key, desc) {
230
237
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
231
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
232
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
238
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
239
+ r = Reflect.decorate(decorators, target, key, desc);
240
+ } else {
241
+ for (var i = decorators.length - 1; i >= 0; i--) {
242
+ if (d = decorators[i]) {
243
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
244
+ }
245
+ }
246
+ }
233
247
  return c > 3 && r && Object.defineProperty(target, key, r), r;
234
248
  }
235
249
  __name(_ts_decorate2, "_ts_decorate");
236
- function _ts_metadata(k, v) {
237
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
250
+ function _ts_metadata(metadataKey, metadataValue) {
251
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
252
+ return Reflect.metadata(metadataKey, metadataValue);
253
+ }
238
254
  }
239
255
  __name(_ts_metadata, "_ts_metadata");
240
256
  function _ts_param(paramIndex, decorator) {
@@ -243,7 +259,7 @@ function _ts_param(paramIndex, decorator) {
243
259
  };
244
260
  }
245
261
  __name(_ts_param, "_ts_param");
246
- var NATS_CLIENTS = Symbol("NATS_CLIENTS");
262
+ var NATS_CLIENTS = /* @__PURE__ */ Symbol("NATS_CLIENTS");
247
263
  var NatsClientService = class {
248
264
  static {
249
265
  __name(this, "NatsClientService");
@@ -311,13 +327,22 @@ import { Inject as Inject2, Injectable as Injectable2 } from "@nestjs/common";
311
327
  import { NatsRecordBuilder as NatsRecordBuilder2 } from "@nestjs/microservices";
312
328
  function _ts_decorate3(decorators, target, key, desc) {
313
329
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
314
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
315
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
330
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
331
+ r = Reflect.decorate(decorators, target, key, desc);
332
+ } else {
333
+ for (var i = decorators.length - 1; i >= 0; i--) {
334
+ if (d = decorators[i]) {
335
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
336
+ }
337
+ }
338
+ }
316
339
  return c > 3 && r && Object.defineProperty(target, key, r), r;
317
340
  }
318
341
  __name(_ts_decorate3, "_ts_decorate");
319
- function _ts_metadata2(k, v) {
320
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
342
+ function _ts_metadata2(metadataKey, metadataValue) {
343
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
344
+ return Reflect.metadata(metadataKey, metadataValue);
345
+ }
321
346
  }
322
347
  __name(_ts_metadata2, "_ts_metadata");
323
348
  function _ts_param2(paramIndex, decorator) {
@@ -326,7 +351,7 @@ function _ts_param2(paramIndex, decorator) {
326
351
  };
327
352
  }
328
353
  __name(_ts_param2, "_ts_param");
329
- var NATS_MS_CLIENTS = Symbol("NATS_MS_CLIENTS");
354
+ var NATS_MS_CLIENTS = /* @__PURE__ */ Symbol("NATS_MS_CLIENTS");
330
355
  var NatsMicroserviceClientService = class {
331
356
  static {
332
357
  __name(this, "NatsMicroserviceClientService");
@@ -367,12 +392,19 @@ NatsMicroserviceClientService = _ts_decorate3([
367
392
  // src/nats/nats-client.module.ts
368
393
  function _ts_decorate4(decorators, target, key, desc) {
369
394
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
370
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
371
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
395
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
396
+ r = Reflect.decorate(decorators, target, key, desc);
397
+ } else {
398
+ for (var i = decorators.length - 1; i >= 0; i--) {
399
+ if (d = decorators[i]) {
400
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
401
+ }
402
+ }
403
+ }
372
404
  return c > 3 && r && Object.defineProperty(target, key, r), r;
373
405
  }
374
406
  __name(_ts_decorate4, "_ts_decorate");
375
- var NATS_MS_OPTIONS = Symbol("NATS_MS_OPTIONS");
407
+ var NATS_MS_OPTIONS = /* @__PURE__ */ Symbol("NATS_MS_OPTIONS");
376
408
  var NatsClientModule = class _NatsClientModule {
377
409
  static {
378
410
  __name(this, "NatsClientModule");
package/dist/nats.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/filters/rpc-problem-exception.filter.ts","../src/exceptions/conflict.exception.ts","../src/exceptions/base-field.exception.ts","../src/filters/pg-error.translator.ts","../src/nats/decorators/nats-headers.decorator.ts","../src/nats/nats-context.ts","../src/nats/nats-client.module.ts","../src/nats/constants.ts","../src/nats/nats-client.service.ts","../src/context/resolve-request.ts","../src/nats/nats-microservice-client.service.ts"],"sourcesContent":["import { type ArgumentsHost, Catch, type HttpException, HttpStatus, Logger } from '@nestjs/common';\nimport { RpcException } from '@nestjs/microservices';\nimport { type Observable, throwError } from 'rxjs';\nimport { tryTranslatePgError } from './pg-error.translator';\n\ninterface FieldError {\n field: string;\n message: string;\n}\n\ninterface ProblemPayload {\n type: string;\n label?: string;\n detail: string;\n message: string;\n errors: FieldError[];\n status: number;\n statusCode: number;\n}\n\n@Catch()\nexport class RpcProblemExceptionFilter {\n private readonly logger = new Logger(RpcProblemExceptionFilter.name);\n\n catch(exception: unknown, _host: ArgumentsHost): Observable<never> {\n // Translate raw Postgres errors into a ConflictException before the rest of the filter handles them.\n const translatedPgError = tryTranslatePgError(exception);\n if (translatedPgError) exception = translatedPgError;\n\n if (exception instanceof RpcException) {\n return throwError(() => exception.getError());\n }\n\n if (this.isHttpException(exception)) {\n const status = exception.getStatus();\n const response = exception.getResponse();\n const payload = this.toProblemPayload(response, status);\n // Log 4xx/5xx so the microservice terminal shows what actually failed (previously silent)\n const log = status >= HttpStatus.INTERNAL_SERVER_ERROR ? this.logger.error : this.logger.warn;\n log.call(this.logger, `RPC ${status}: ${payload.detail}`);\n return throwError(() => payload);\n }\n\n if (exception instanceof Error) {\n const cause = (exception as { cause?: unknown }).cause;\n const causeMessage = cause instanceof Error ? cause.message : undefined;\n const causeStack = cause instanceof Error ? cause.stack : undefined;\n this.logger.error(causeMessage ?? exception.message, causeStack ?? exception.stack);\n if (cause && cause !== exception) {\n this.logger.error(`Wrapped by: ${exception.message}`);\n }\n return throwError(() =>\n this.toProblemPayload(\n {\n type: 'about:blank',\n detail: causeMessage ?? exception.message,\n errors: [],\n },\n HttpStatus.INTERNAL_SERVER_ERROR,\n ),\n );\n }\n\n this.logger.error(`Unhandled non-error exception: ${JSON.stringify(exception)}`);\n return throwError(() =>\n this.toProblemPayload(\n {\n type: 'about:blank',\n detail: 'An unexpected error occurred',\n errors: [],\n },\n HttpStatus.INTERNAL_SERVER_ERROR,\n ),\n );\n }\n\n private toProblemPayload(response: unknown, status: number): ProblemPayload {\n if (typeof response === 'string') {\n return {\n type: 'about:blank',\n detail: response,\n message: response,\n errors: [],\n status,\n statusCode: status,\n };\n }\n\n const obj = (response ?? {}) as Record<string, unknown>;\n // Prefer RFC 9457 `detail`, then Nest/@nestjs-common's `message` (string or class-validator array),\n // so exceptions thrown as `@nestjs/common` errors still surface their real message across NATS.\n const detail =\n typeof obj.detail === 'string'\n ? obj.detail\n : typeof obj.message === 'string'\n ? obj.message\n : Array.isArray(obj.message)\n ? obj.message.join(', ')\n : 'Request failed';\n return {\n type: typeof obj.type === 'string' ? obj.type : 'about:blank',\n label: typeof obj.label === 'string' ? obj.label : undefined,\n detail,\n message: detail,\n errors: Array.isArray(obj.errors) ? (obj.errors as FieldError[]) : [],\n status,\n statusCode: status,\n };\n }\n\n private isHttpException(error: unknown): error is HttpException {\n return (\n error instanceof Error &&\n typeof (error as { getStatus?: unknown }).getStatus === 'function' &&\n typeof (error as { getResponse?: unknown }).getResponse === 'function'\n );\n }\n}\n","import { HttpStatus } from '@nestjs/common';\nimport { HttpProblemException, type ProblemOptions } from './base-field.exception';\n\nexport class ConflictException extends HttpProblemException {\n constructor(detailOrOptions?: string | ProblemOptions) {\n super(detailOrOptions ?? 'Conflict', HttpStatus.CONFLICT);\n }\n}\n","import { HttpException, HttpStatus } from '@nestjs/common';\nimport type { FieldError } from '../types/error-response.types';\n\n// Re-export FieldError for backwards compatibility\nexport type { FieldError } from '../types/error-response.types';\n\nexport interface ProblemOptions {\n type?: string;\n label?: string;\n detail?: string;\n errors?: FieldError[];\n}\n\nexport abstract class HttpProblemException extends HttpException {\n constructor(detailOrOptions: string | ProblemOptions, httpStatus: HttpStatus) {\n const options = typeof detailOrOptions === 'string' ? { detail: detailOrOptions } : detailOrOptions;\n\n super(\n {\n type: options.type ?? 'about:blank',\n label: options.label,\n detail: options.detail,\n errors: options.errors ?? [],\n },\n httpStatus,\n );\n }\n}\n","import { ConflictException } from '../exceptions/conflict.exception';\n\nconst PG_UNIQUE_VIOLATION = '23505';\n\nexport type PgErrorShape = {\n code?: string;\n message?: string;\n constraint?: string;\n table?: string;\n schema?: string;\n column?: string;\n detail?: string;\n hint?: string;\n};\n\n// Returns a ConflictException for a Postgres unique-violation error, otherwise undefined.\nexport function tryTranslatePgError(error: unknown): ConflictException | undefined {\n const pgError = findPgError(error);\n if (!pgError) return undefined;\n const { code, constraint, table, detail } = pgError;\n if (code !== PG_UNIQUE_VIOLATION) return undefined;\n return new ConflictException({\n label: 'Duplicate Entry',\n detail: detail?.trim() || 'A record with these values already exists.',\n errors: [],\n ...(constraint || table ? { meta: { constraint, table } } : {}),\n });\n}\n\n// Walks up to N levels of `.cause` looking for a pg-shaped error (has SQLSTATE `code`), capping depth.\nexport function findPgError(error: unknown, depth = 0): PgErrorShape | undefined {\n if (!error || typeof error !== 'object' || depth > 5) return undefined;\n const candidate = error as PgErrorShape & { cause?: unknown };\n if (typeof candidate.code === 'string') return candidate;\n return findPgError(candidate.cause, depth + 1);\n}\n","import { createParamDecorator, type ExecutionContext, InternalServerErrorException } from '@nestjs/common';\nimport { NatsContext } from '@nestjs/microservices';\nimport { parseNatsHeaders } from '../nats-context';\n\n// Extracts parsed NatsContext from NATS message headers\nexport const RpcNatsHeaders = createParamDecorator((_data: unknown, ctx: ExecutionContext) => {\n const rpcCtx = ctx.switchToRpc().getContext<NatsContext>();\n return parseNatsHeaders(rpcCtx.getHeaders());\n});\n\n// Extracts siteId from NATS headers — throws if missing or empty\nexport const RpcSiteId = createParamDecorator((_data: unknown, ctx: ExecutionContext): string => {\n const rpcCtx = ctx.switchToRpc().getContext<NatsContext>();\n const headers = parseNatsHeaders(rpcCtx.getHeaders());\n if (!headers?.siteId) throw new InternalServerErrorException('Missing siteId in NATS headers.');\n return headers.siteId;\n});\n\n// Extracts siteCurrencyCode from NATS headers — throws if missing or empty\nexport const RpcSiteCurrencyCode = createParamDecorator((_data: unknown, ctx: ExecutionContext): string => {\n const rpcCtx = ctx.switchToRpc().getContext<NatsContext>();\n const headers = parseNatsHeaders(rpcCtx.getHeaders());\n if (!headers?.siteCurrencyCode) throw new InternalServerErrorException('Missing siteCurrencyCode in NATS headers.');\n return headers.siteCurrencyCode;\n});\n","export interface NatsHeaders {\n orgId: string;\n userId: string;\n siteId: string;\n legalEntityId: string;\n siteGroupId: string;\n siteTimezone: string;\n siteCurrencyCode: string;\n}\n\n// The single source of truth for context transport, both directions. Adding a field means\n// adding one entry here plus one on NatsHeaders — encode and parse both pick it up.\nexport const NATS_HEADER_KEYS = {\n orgId: 'x-org-id',\n userId: 'x-user-id',\n siteId: 'x-site-id',\n legalEntityId: 'x-le-id',\n siteGroupId: 'x-sg-id',\n siteTimezone: 'x-site-timezone',\n siteCurrencyCode: 'x-site-currency-code',\n} as const satisfies Record<keyof NatsHeaders, string>;\n\n// Applied when a header is absent, so a missing optional field lands on the same value the\n// producing side would have sent for \"not set\"\nconst HEADER_FALLBACKS: Partial<Record<keyof NatsHeaders, string>> = {\n siteTimezone: 'UTC',\n};\n\n// Reads a header value from either a plain object or a NATS MsgHdrsImpl\nfunction getHeader(headers: unknown, key: string): string | undefined {\n if (!headers) return undefined;\n // MsgHdrsImpl uses .get(), plain objects use bracket access\n if (typeof (headers as { get?: unknown }).get === 'function') {\n const val = (headers as { get(key: string): string[] }).get(key);\n return Array.isArray(val) ? val[0] : (val as string | undefined);\n }\n return (headers as Record<string, string>)[key];\n}\n\n/**\n * Parses NATS message headers into a NatsHeaders object.\n *\n * Only `orgId` is required. It is what scopes every row the receiving service will read, so\n * without it there is no safe way to run — the caller returns null and the interceptor decides.\n *\n * `userId` is deliberately NOT required. A control-plane call has no user behind it, and an\n * earlier version rejected the whole context when it was blank — which meant the receiving\n * service skipped RLS entirely, ran with `app.org_id` unset, and matched no rows. Losing the\n * tenant because there was no user is a far worse failure than an empty acting principal.\n */\nexport function parseNatsHeaders(headers: unknown): NatsHeaders | null {\n if (!headers) return null;\n\n const orgId = getHeader(headers, NATS_HEADER_KEYS.orgId);\n if (!orgId) return null;\n\n const parsed = {} as NatsHeaders;\n for (const [field, key] of Object.entries(NATS_HEADER_KEYS) as [keyof NatsHeaders, string][]) {\n parsed[field] = getHeader(headers, key) || HEADER_FALLBACKS[field] || '';\n }\n return parsed;\n}\n","import { type DynamicModule, Global, Logger, Module, type OnModuleDestroy, type Provider } from '@nestjs/common';\nimport { ConfigModule, ConfigService } from '@nestjs/config';\nimport type { ClientProxy } from '@nestjs/microservices';\nimport { ClientProxyFactory, Transport } from '@nestjs/microservices';\nimport { NATS_CONTEXT_RESOLVER, NATS_MODULE_OPTIONS } from './constants';\nimport type {\n NatsMicroserviceModuleAsyncOptions,\n NatsModuleBaseOptions,\n NatsRootModuleAsyncOptions,\n NatsRootModuleOptions,\n} from './nats-client.interfaces';\nimport { NATS_CLIENTS, NatsClientService } from './nats-client.service';\nimport { NATS_MS_CLIENTS, NatsMicroserviceClientService } from './nats-microservice-client.service';\n\nconst NATS_MS_OPTIONS = Symbol('NATS_MS_OPTIONS');\n\n@Global()\n@Module({})\nexport class NatsClientModule implements OnModuleDestroy {\n private static readonly logger = new Logger(NatsClientModule.name);\n private static allClients: ClientProxy[] = [];\n\n async onModuleDestroy() {\n await Promise.all(NatsClientModule.allClients.map((c) => c.close()));\n NatsClientModule.allClients = [];\n }\n\n // Builds a Map of named NATS ClientProxy instances\n private static buildClients(options: NatsModuleBaseOptions, natsUrl: string): Map<string, ClientProxy> {\n const clients = new Map<string, ClientProxy>();\n\n for (const svc of options.services) {\n const proxy = ClientProxyFactory.create({\n transport: Transport.NATS,\n options: { servers: [natsUrl] },\n });\n clients.set(svc.name, proxy);\n NatsClientModule.allClients.push(proxy);\n NatsClientModule.logger.log(`Registered NATS client: ${svc.name} → ${natsUrl}`);\n }\n\n return clients;\n }\n\n // Gateway mode — request-scoped, resolves context from the request via callback\n static forRoot(asyncOptions: NatsRootModuleAsyncOptions): DynamicModule {\n const optionsProvider: Provider = {\n provide: NATS_MODULE_OPTIONS,\n useFactory: asyncOptions.useFactory,\n inject: asyncOptions.inject || [],\n };\n\n const resolverProvider: Provider = {\n provide: NATS_CONTEXT_RESOLVER,\n useFactory: (options: NatsRootModuleOptions) => options.contextResolver,\n inject: [NATS_MODULE_OPTIONS],\n };\n\n const clientsProvider: Provider = {\n provide: NATS_CLIENTS,\n useFactory: (options: NatsRootModuleOptions, config: ConfigService): Map<string, ClientProxy> => {\n const natsUrl = options.natsUrl ?? config.get<string>('NATS_URL', 'nats://localhost:4222');\n return NatsClientModule.buildClients(options, natsUrl);\n },\n inject: [NATS_MODULE_OPTIONS, ConfigService],\n };\n\n return {\n module: NatsClientModule,\n imports: [ConfigModule, ...(asyncOptions.imports ?? [])],\n providers: [optionsProvider, resolverProvider, clientsProvider, NatsClientService],\n exports: [NatsClientService],\n };\n }\n\n // Microservice mode — singleton, forwards context from incoming NATS payload\n static forMicroservice(asyncOptions: NatsMicroserviceModuleAsyncOptions): DynamicModule {\n const optionsProvider: Provider = {\n provide: NATS_MS_OPTIONS,\n useFactory: asyncOptions.useFactory,\n inject: asyncOptions.inject || [],\n };\n\n const clientsProvider: Provider = {\n provide: NATS_MS_CLIENTS,\n useFactory: (options: NatsModuleBaseOptions, config: ConfigService): Map<string, ClientProxy> => {\n const natsUrl = options.natsUrl ?? config.get<string>('NATS_URL', 'nats://localhost:4222');\n return NatsClientModule.buildClients(options, natsUrl);\n },\n inject: [NATS_MS_OPTIONS, ConfigService],\n };\n\n return {\n module: NatsClientModule,\n imports: [ConfigModule, ...(asyncOptions.imports ?? [])],\n providers: [optionsProvider, clientsProvider, NatsMicroserviceClientService],\n exports: [NatsMicroserviceClientService],\n };\n }\n}\n","export const NATS_MODULE_OPTIONS = Symbol('NATS_MODULE_OPTIONS');\nexport const NATS_CONTEXT_RESOLVER = Symbol('NATS_CONTEXT_RESOLVER');\n","// Pulls the fastify module augmentation into this entry's dts graph — tsup builds each entry in isolation\nimport '../types/fastify-augmentation';\nimport { Inject, Injectable, Scope } from '@nestjs/common';\nimport { REQUEST } from '@nestjs/core';\nimport type { ClientProxy } from '@nestjs/microservices';\nimport { NatsRecordBuilder } from '@nestjs/microservices';\nimport type { FastifyRequest } from 'fastify';\nimport { headers as natsHeaders } from 'nats';\nimport { resolveInjectedRequest } from '../context/resolve-request';\nimport { NATS_CONTEXT_RESOLVER } from './constants';\nimport type { ContextResolverFn } from './nats-client.interfaces';\nimport { NATS_HEADER_KEYS, type NatsHeaders } from './nats-context';\n\nexport const NATS_CLIENTS = Symbol('NATS_CLIENTS');\n\n@Injectable({ scope: Scope.REQUEST })\nexport class NatsClientService {\n private cachedContext: NatsHeaders | null = null;\n\n constructor(\n @Inject(REQUEST) private readonly injectedRequest: FastifyRequest,\n @Inject(NATS_CONTEXT_RESOLVER) private readonly contextResolver: ContextResolverFn,\n @Inject(NATS_CLIENTS) private readonly clients: Map<string, ClientProxy>,\n ) {}\n\n // Unwraps the GraphQL { req, reply } context wrapper so auth is visible across both transports\n private get request(): FastifyRequest {\n return resolveInjectedRequest(this.injectedRequest);\n }\n\n // Sends a message to a named microservice with NatsHeaders as NATS headers\n async send<T>(service: string, cmd: string, data?: object): Promise<T> {\n const client = this.clients.get(service);\n if (!client) {\n throw new Error(\n `NATS service \"${service}\" is not registered. Available: [${[...this.clients.keys()].join(', ')}]`,\n );\n }\n\n if (!this.cachedContext) {\n // The resolver takes the whole request rather than one auth field: which caller kinds\n // exist, and what each contributes, is the consuming server's model — this side only\n // knows that something has to produce headers.\n const context = await this.contextResolver(this.request);\n if (!context) {\n throw new Error('No auth context on request — is the auth guard active for this route?');\n }\n this.cachedContext = context;\n }\n\n const headers = contextToHeaders(this.cachedContext);\n const record = new NatsRecordBuilder(data ?? {}).setHeaders(headers).build();\n\n return client.send<T>({ cmd }, record).toPromise() as Promise<T>;\n }\n}\n\n// Converts NatsHeaders to a NATS MsgHdrs object for NATS transport.\n//\n// Driven by the key map rather than a field-per-line, so a new context field travels the\n// moment it is added to NATS_HEADER_KEYS. Empty values are omitted — parseNatsHeaders applies\n// the same defaults on the way back, so sending a blank would just restate them.\nfunction contextToHeaders(ctx: NatsHeaders): import('nats').MsgHdrs {\n const hdrs = natsHeaders();\n for (const [field, key] of Object.entries(NATS_HEADER_KEYS) as [keyof NatsHeaders, string][]) {\n if (ctx[field]) hdrs.set(key, ctx[field]);\n }\n return hdrs;\n}\n","import type { FastifyRequest } from 'fastify';\n\n// Unwraps the @Inject(REQUEST) value to the real Fastify request (GraphQL injects a { req, reply } context).\nexport function resolveInjectedRequest(injected: FastifyRequest): FastifyRequest {\n const candidate = injected as unknown as { headers?: unknown; req?: FastifyRequest };\n if (candidate && candidate.headers === undefined && candidate.req) {\n return candidate.req;\n }\n return injected;\n}\n","import { Inject, Injectable } from '@nestjs/common';\nimport type { ClientProxy } from '@nestjs/microservices';\nimport { NatsRecordBuilder } from '@nestjs/microservices';\nimport { NATS_HEADER_KEYS, type NatsHeaders } from './nats-context';\n\nexport const NATS_MS_CLIENTS = Symbol('NATS_MS_CLIENTS');\n\n@Injectable()\nexport class NatsMicroserviceClientService {\n constructor(@Inject(NATS_MS_CLIENTS) private readonly clients: Map<string, ClientProxy>) {}\n\n // Forwards a message to another microservice with NatsHeaders\n async send<T>(service: string, cmd: string, natsHeaders: NatsHeaders, data?: object): Promise<T> {\n const client = this.clients.get(service);\n if (!client) {\n throw new Error(\n `NATS service \"${service}\" is not registered. Available: [${[...this.clients.keys()].join(', ')}]`,\n );\n }\n\n const headers: Record<string, string> = {\n [NATS_HEADER_KEYS.orgId]: natsHeaders.orgId,\n [NATS_HEADER_KEYS.userId]: natsHeaders.userId,\n [NATS_HEADER_KEYS.siteId]: natsHeaders.siteId,\n [NATS_HEADER_KEYS.siteTimezone]: natsHeaders.siteTimezone,\n };\n\n const record = new NatsRec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AAS;QAACD;;IACZ;EACF;;EAGA,OAAOE,gBAAgBpB,cAAiE;AACtF,UAAMC,kBAA4B;MAChCC,SAASjC;MACTmC,YAAYJ,aAAaI;MACzBC,QAAQL,aAAaK,UAAU,CAAA;IACjC;AAEA,UAAMI,kBAA4B;MAChCP,SAASmB;MACTjB,YAAY,wBAACrB,SAAgC4B,WAAAA;AAC3C,cAAM3B,UAAUD,QAAQC,WAAW2B,OAAOC,IAAY,YAAY,uBAAA;AAClE,eAAOzC,kBAAiBW,aAAaC,SAASC,OAAAA;MAChD,GAHY;MAIZqB,QAAQ;QAACpC;QAAiB4C;;IAC5B;AAEA,WAAO;MACLC,QAAQ3C;MACR4C,SAAS;QAACC;WAAkBhB,aAAae,WAAW,CAAA;;MACpDE,WAAW;QAAChB;QAAiBQ;QAAiBa;;MAC9CH,SAAS;QAACG;;IACZ;EACF;AACF;;;;;","names":["Catch","HttpStatus","Logger","RpcException","throwError","HttpStatus","HttpException","HttpProblemException","HttpException","detailOrOptions","httpStatus","options","detail","type","label","errors","ConflictException","HttpProblemException","detailOrOptions","HttpStatus","CONFLICT","PG_UNIQUE_VIOLATION","tryTranslatePgError","error","pgError","findPgError","undefined","code","constraint","table","detail","ConflictException","label","trim","errors","meta","depth","candidate","cause","RpcProblemExceptionFilter","logger","Logger","name","catch","exception","_host","translatedPgError","tryTranslatePgError","RpcException","throwError","getError","isHttpException","status","getStatus","response","getResponse","payload","toProblemPayload","log","HttpStatus","INTERNAL_SERVER_ERROR","error","warn","call","detail","Error","cause","causeMessage","message","undefined","causeStack","stack","type","errors","JSON","stringify","statusCode","obj","Array","isArray","join","label","createParamDecorator","InternalServerErrorException","NATS_HEADER_KEYS","orgId","userId","siteId","legalEntityId","siteGroupId","siteTimezone","siteCurrencyCode","HEADER_FALLBACKS","getHeader","headers","key","undefined","get","val","Array","isArray","parseNatsHeaders","parsed","field","Object","entries","RpcNatsHeaders","createParamDecorator","_data","ctx","rpcCtx","switchToRpc","getContext","parseNatsHeaders","getHeaders","RpcSiteId","headers","siteId","InternalServerErrorException","RpcSiteCurrencyCode","siteCurrencyCode","Global","Logger","Module","ConfigModule","ConfigService","ClientProxyFactory","Transport","NATS_MODULE_OPTIONS","Symbol","NATS_CONTEXT_RESOLVER","Inject","Injectable","Scope","REQUEST","NatsRecordBuilder","headers","natsHeaders","resolveInjectedRequest","injected","candidate","headers","undefined","req","NATS_CLIENTS","Symbol","NatsClientService","cachedContext","injectedRequest","contextResolver","clients","request","resolveInjectedRequest","send","service","cmd","data","client","get","Error","keys","join","context","headers","contextToHeaders","record","NatsRecordBuilder","setHeaders","build","toPromise","scope","Scope","REQUEST","ctx","hdrs","natsHeaders","field","key","Object","entries","NATS_HEADER_KEYS","set","Inject","Injectable","NatsRecordBuilder","NATS_MS_CLIENTS","Symbol","NatsMicroserviceClientService","clients","send","service","cmd","natsHeaders","data","client","get","Error","keys","join","headers","NATS_HEADER_KEYS","orgId","userId","siteId","siteTimezone","record","NatsRecordBuilder","setHeaders","build","toPromise","NATS_MS_OPTIONS","Symbol","NatsClientModule","logger","Logger","name","allClients","onModuleDestroy","Promise","all","map","c","close","buildClients","options","natsUrl","clients","Map","svc","services","proxy","ClientProxyFactory","create","transport","Transport","NATS","servers","set","push","log","forRoot","asyncOptions","optionsProvider","provide","NATS_MODULE_OPTIONS","useFactory","inject","resolverProvider","NATS_CONTEXT_RESOLVER","contextResolver","clientsProvider","NATS_CLIENTS","config","get","ConfigService","module","imports","ConfigModule","providers","NatsClientService","exports","forMicroservice","NATS_MS_CLIENTS","NatsMicroserviceClientService"]}
1
+ {"version":3,"sources":["../src/filters/rpc-problem-exception.filter.ts","../src/exceptions/conflict.exception.ts","../src/exceptions/base-field.exception.ts","../src/filters/pg-error.translator.ts","../src/nats/decorators/nats-headers.decorator.ts","../src/nats/nats-context.ts","../src/nats/nats-client.module.ts","../src/nats/constants.ts","../src/nats/nats-client.service.ts","../src/context/resolve-request.ts","../src/nats/nats-microservice-client.service.ts"],"sourcesContent":["import { type ArgumentsHost, Catch, type HttpException, HttpStatus, Logger } from '@nestjs/common';\nimport { RpcException } from '@nestjs/microservices';\nimport { type Observable, throwError } from 'rxjs';\nimport { tryTranslatePgError } from './pg-error.translator';\n\ninterface FieldError {\n field: string;\n message: string;\n}\n\ninterface ProblemPayload {\n type: string;\n label?: string;\n detail: string;\n message: string;\n errors: FieldError[];\n status: number;\n statusCode: number;\n}\n\n@Catch()\nexport class RpcProblemExceptionFilter {\n private readonly logger = new Logger(RpcProblemExceptionFilter.name);\n\n catch(exception: unknown, _host: ArgumentsHost): Observable<never> {\n // Translate raw Postgres errors into a ConflictException before the rest of the filter handles them.\n const translatedPgError = tryTranslatePgError(exception);\n if (translatedPgError) exception = translatedPgError;\n\n if (exception instanceof RpcException) {\n return throwError(() => exception.getError());\n }\n\n if (this.isHttpException(exception)) {\n const status = exception.getStatus();\n const response = exception.getResponse();\n const payload = this.toProblemPayload(response, status);\n // Log 4xx/5xx so the microservice terminal shows what actually failed (previously silent)\n const log = status >= HttpStatus.INTERNAL_SERVER_ERROR ? this.logger.error : this.logger.warn;\n log.call(this.logger, `RPC ${status}: ${payload.detail}`);\n return throwError(() => payload);\n }\n\n if (exception instanceof Error) {\n const cause = (exception as { cause?: unknown }).cause;\n const causeMessage = cause instanceof Error ? cause.message : undefined;\n const causeStack = cause instanceof Error ? cause.stack : undefined;\n this.logger.error(causeMessage ?? exception.message, causeStack ?? exception.stack);\n if (cause && cause !== exception) {\n this.logger.error(`Wrapped by: ${exception.message}`);\n }\n return throwError(() =>\n this.toProblemPayload(\n {\n type: 'about:blank',\n detail: causeMessage ?? exception.message,\n errors: [],\n },\n HttpStatus.INTERNAL_SERVER_ERROR,\n ),\n );\n }\n\n this.logger.error(`Unhandled non-error exception: ${JSON.stringify(exception)}`);\n return throwError(() =>\n this.toProblemPayload(\n {\n type: 'about:blank',\n detail: 'An unexpected error occurred',\n errors: [],\n },\n HttpStatus.INTERNAL_SERVER_ERROR,\n ),\n );\n }\n\n private toProblemPayload(response: unknown, status: number): ProblemPayload {\n if (typeof response === 'string') {\n return {\n type: 'about:blank',\n detail: response,\n message: response,\n errors: [],\n status,\n statusCode: status,\n };\n }\n\n const obj = (response ?? {}) as Record<string, unknown>;\n // Prefer RFC 9457 `detail`, then Nest/@nestjs-common's `message` (string or class-validator array),\n // so exceptions thrown as `@nestjs/common` errors still surface their real message across NATS.\n const detail =\n typeof obj.detail === 'string'\n ? obj.detail\n : typeof obj.message === 'string'\n ? obj.message\n : Array.isArray(obj.message)\n ? obj.message.join(', ')\n : 'Request failed';\n return {\n type: typeof obj.type === 'string' ? obj.type : 'about:blank',\n label: typeof obj.label === 'string' ? obj.label : undefined,\n detail,\n message: detail,\n errors: Array.isArray(obj.errors) ? (obj.errors as FieldError[]) : [],\n status,\n statusCode: status,\n };\n }\n\n private isHttpException(error: unknown): error is HttpException {\n return (\n error instanceof Error &&\n typeof (error as { getStatus?: unknown }).getStatus === 'function' &&\n typeof (error as { getResponse?: unknown }).getResponse === 'function'\n );\n }\n}\n","import { HttpStatus } from '@nestjs/common';\nimport { HttpProblemException, type ProblemOptions } from './base-field.exception';\n\nexport class ConflictException extends HttpProblemException {\n constructor(detailOrOptions?: string | ProblemOptions) {\n super(detailOrOptions ?? 'Conflict', HttpStatus.CONFLICT);\n }\n}\n","import { HttpException, HttpStatus } from '@nestjs/common';\nimport type { FieldError } from '../types/error-response.types';\n\n// Re-export FieldError for backwards compatibility\nexport type { FieldError } from '../types/error-response.types';\n\nexport interface ProblemOptions {\n type?: string;\n label?: string;\n detail?: string;\n errors?: FieldError[];\n}\n\nexport abstract class HttpProblemException extends HttpException {\n constructor(detailOrOptions: string | ProblemOptions, httpStatus: HttpStatus) {\n const options = typeof detailOrOptions === 'string' ? { detail: detailOrOptions } : detailOrOptions;\n\n super(\n {\n type: options.type ?? 'about:blank',\n label: options.label,\n detail: options.detail,\n errors: options.errors ?? [],\n },\n httpStatus,\n );\n }\n}\n","import { ConflictException } from '../exceptions/conflict.exception';\n\nconst PG_UNIQUE_VIOLATION = '23505';\n\nexport type PgErrorShape = {\n code?: string;\n message?: string;\n constraint?: string;\n table?: string;\n schema?: string;\n column?: string;\n detail?: string;\n hint?: string;\n};\n\n// Returns a ConflictException for a Postgres unique-violation error, otherwise undefined.\nexport function tryTranslatePgError(error: unknown): ConflictException | undefined {\n const pgError = findPgError(error);\n if (!pgError) return undefined;\n const { code, constraint, table, detail } = pgError;\n if (code !== PG_UNIQUE_VIOLATION) return undefined;\n return new ConflictException({\n label: 'Duplicate Entry',\n detail: detail?.trim() || 'A record with these values already exists.',\n errors: [],\n ...(constraint || table ? { meta: { constraint, table } } : {}),\n });\n}\n\n// Walks up to N levels of `.cause` looking for a pg-shaped error (has SQLSTATE `code`), capping depth.\nexport function findPgError(error: unknown, depth = 0): PgErrorShape | undefined {\n if (!error || typeof error !== 'object' || depth > 5) return undefined;\n const candidate = error as PgErrorShape & { cause?: unknown };\n if (typeof candidate.code === 'string') return candidate;\n return findPgError(candidate.cause, depth + 1);\n}\n","import { createParamDecorator, type ExecutionContext, InternalServerErrorException } from '@nestjs/common';\nimport { NatsContext } from '@nestjs/microservices';\nimport { parseNatsHeaders } from '../nats-context';\n\n// Extracts parsed NatsContext from NATS message headers\nexport const RpcNatsHeaders = createParamDecorator((_data: unknown, ctx: ExecutionContext) => {\n const rpcCtx = ctx.switchToRpc().getContext<NatsContext>();\n return parseNatsHeaders(rpcCtx.getHeaders());\n});\n\n// Extracts siteId from NATS headers — throws if missing or empty\nexport const RpcSiteId = createParamDecorator((_data: unknown, ctx: ExecutionContext): string => {\n const rpcCtx = ctx.switchToRpc().getContext<NatsContext>();\n const headers = parseNatsHeaders(rpcCtx.getHeaders());\n if (!headers?.siteId) throw new InternalServerErrorException('Missing siteId in NATS headers.');\n return headers.siteId;\n});\n\n// Extracts siteCurrencyCode from NATS headers — throws if missing or empty\nexport const RpcSiteCurrencyCode = createParamDecorator((_data: unknown, ctx: ExecutionContext): string => {\n const rpcCtx = ctx.switchToRpc().getContext<NatsContext>();\n const headers = parseNatsHeaders(rpcCtx.getHeaders());\n if (!headers?.siteCurrencyCode) throw new InternalServerErrorException('Missing siteCurrencyCode in NATS headers.');\n return headers.siteCurrencyCode;\n});\n","export interface NatsHeaders {\n orgId: string;\n userId: string;\n siteId: string;\n legalEntityId: string;\n siteGroupId: string;\n siteTimezone: string;\n siteCurrencyCode: string;\n}\n\n// The single source of truth for context transport, both directions. Adding a field means\n// adding one entry here plus one on NatsHeaders — encode and parse both pick it up.\nexport const NATS_HEADER_KEYS = {\n orgId: 'x-org-id',\n userId: 'x-user-id',\n siteId: 'x-site-id',\n legalEntityId: 'x-le-id',\n siteGroupId: 'x-sg-id',\n siteTimezone: 'x-site-timezone',\n siteCurrencyCode: 'x-site-currency-code',\n} as const satisfies Record<keyof NatsHeaders, string>;\n\n// Applied when a header is absent, so a missing optional field lands on the same value the\n// producing side would have sent for \"not set\"\nconst HEADER_FALLBACKS: Partial<Record<keyof NatsHeaders, string>> = {\n siteTimezone: 'UTC',\n};\n\n// Reads a header value from either a plain object or a NATS MsgHdrsImpl\nfunction getHeader(headers: unknown, key: string): string | undefined {\n if (!headers) return undefined;\n // MsgHdrsImpl uses .get(), plain objects use bracket access\n if (typeof (headers as { get?: unknown }).get === 'function') {\n const val = (headers as { get(key: string): string[] }).get(key);\n return Array.isArray(val) ? val[0] : (val as string | undefined);\n }\n return (headers as Record<string, string>)[key];\n}\n\n/**\n * Parses NATS message headers into a NatsHeaders object.\n *\n * Only `orgId` is required. It is what scopes every row the receiving service will read, so\n * without it there is no safe way to run — the caller returns null and the interceptor decides.\n *\n * `userId` is deliberately NOT required. A control-plane call has no user behind it, and an\n * earlier version rejected the whole context when it was blank — which meant the receiving\n * service skipped RLS entirely, ran with `app.org_id` unset, and matched no rows. Losing the\n * tenant because there was no user is a far worse failure than an empty acting principal.\n */\nexport function parseNatsHeaders(headers: unknown): NatsHeaders | null {\n if (!headers) return null;\n\n const orgId = getHeader(headers, NATS_HEADER_KEYS.orgId);\n if (!orgId) return null;\n\n const parsed = {} as NatsHeaders;\n for (const [field, key] of Object.entries(NATS_HEADER_KEYS) as [keyof NatsHeaders, string][]) {\n parsed[field] = getHeader(headers, key) || HEADER_FALLBACKS[field] || '';\n }\n return parsed;\n}\n","import { type DynamicModule, Global, Logger, Module, type OnModuleDestroy, type Provider } from '@nestjs/common';\nimport { ConfigModule, ConfigService } from '@nestjs/config';\nimport type { ClientProxy } from '@nestjs/microservices';\nimport { ClientProxyFactory, Transport } from '@nestjs/microservices';\nimport { NATS_CONTEXT_RESOLVER, NATS_MODULE_OPTIONS } from './constants';\nimport type {\n NatsMicroserviceModuleAsyncOptions,\n NatsModuleBaseOptions,\n NatsRootModuleAsyncOptions,\n NatsRootModuleOptions,\n} from './nats-client.interfaces';\nimport { NATS_CLIENTS, NatsClientService } from './nats-client.service';\nimport { NATS_MS_CLIENTS, NatsMicroserviceClientService } from './nats-microservice-client.service';\n\nconst NATS_MS_OPTIONS = Symbol('NATS_MS_OPTIONS');\n\n@Global()\n@Module({})\nexport class NatsClientModule implements OnModuleDestroy {\n private static readonly logger = new Logger(NatsClientModule.name);\n private static allClients: ClientProxy[] = [];\n\n async onModuleDestroy() {\n await Promise.all(NatsClientModule.allClients.map((c) => c.close()));\n NatsClientModule.allClients = [];\n }\n\n // Builds a Map of named NATS ClientProxy instances\n private static buildClients(options: NatsModuleBaseOptions, natsUrl: string): Map<string, ClientProxy> {\n const clients = new Map<string, ClientProxy>();\n\n for (const svc of options.services) {\n const proxy = ClientProxyFactory.create({\n transport: Transport.NATS,\n options: { servers: [natsUrl] },\n });\n clients.set(svc.name, proxy);\n NatsClientModule.allClients.push(proxy);\n NatsClientModule.logger.log(`Registered NATS client: ${svc.name} → ${natsUrl}`);\n }\n\n return clients;\n }\n\n // Gateway mode — request-scoped, resolves context from the request via callback\n static forRoot(asyncOptions: NatsRootModuleAsyncOptions): DynamicModule {\n const optionsProvider: Provider = {\n provide: NATS_MODULE_OPTIONS,\n useFactory: asyncOptions.useFactory,\n inject: asyncOptions.inject || [],\n };\n\n const resolverProvider: Provider = {\n provide: NATS_CONTEXT_RESOLVER,\n useFactory: (options: NatsRootModuleOptions) => options.contextResolver,\n inject: [NATS_MODULE_OPTIONS],\n };\n\n const clientsProvider: Provider = {\n provide: NATS_CLIENTS,\n useFactory: (options: NatsRootModuleOptions, config: ConfigService): Map<string, ClientProxy> => {\n const natsUrl = options.natsUrl ?? config.get<string>('NATS_URL', 'nats://localhost:4222');\n return NatsClientModule.buildClients(options, natsUrl);\n },\n inject: [NATS_MODULE_OPTIONS, ConfigService],\n };\n\n return {\n module: NatsClientModule,\n imports: [ConfigModule, ...(asyncOptions.imports ?? [])],\n providers: [optionsProvider, resolverProvider, clientsProvider, NatsClientService],\n exports: [NatsClientService],\n };\n }\n\n // Microservice mode — singleton, forwards context from incoming NATS payload\n static forMicroservice(asyncOptions: NatsMicroserviceModuleAsyncOptions): DynamicModule {\n const optionsProvider: Provider = {\n provide: NATS_MS_OPTIONS,\n useFactory: asyncOptions.useFactory,\n inject: asyncOptions.inject || [],\n };\n\n const clientsProvider: Provider = {\n provide: NATS_MS_CLIENTS,\n useFactory: (options: NatsModuleBaseOptions, config: ConfigService): Map<string, ClientProxy> => {\n const natsUrl = options.natsUrl ?? config.get<string>('NATS_URL', 'nats://localhost:4222');\n return NatsClientModule.buildClients(options, natsUrl);\n },\n inject: [NATS_MS_OPTIONS, ConfigService],\n };\n\n return {\n module: NatsClientModule,\n imports: [ConfigModule, ...(asyncOptions.imports ?? [])],\n providers: [optionsProvider, clientsProvider, NatsMicroserviceClientService],\n exports: [NatsMicroserviceClientService],\n };\n }\n}\n","export const NATS_MODULE_OPTIONS = Symbol('NATS_MODULE_OPTIONS');\nexport const NATS_CONTEXT_RESOLVER = Symbol('NATS_CONTEXT_RESOLVER');\n","// Pulls the fastify module augmentation into this entry's dts graph — tsup builds each entry in isolation\nimport '../types/fastify-augmentation';\nimport { Inject, Injectable, Scope } from '@nestjs/common';\nimport { REQUEST } from '@nestjs/core';\nimport type { ClientProxy } from '@nestjs/microservices';\nimport { NatsRecordBuilder } from '@nestjs/microservices';\nimport type { FastifyRequest } from 'fastify';\nimport { headers as natsHeaders } from 'nats';\nimport { resolveInjectedRequest } from '../context/resolve-request';\nimport { NATS_CONTEXT_RESOLVER } from './constants';\nimport type { ContextResolverFn } from './nats-client.interfaces';\nimport { NATS_HEADER_KEYS, type NatsHeaders } from './nats-context';\n\nexport const NATS_CLIENTS = Symbol('NATS_CLIENTS');\n\n@Injectable({ scope: Scope.REQUEST })\nexport class NatsClientService {\n private cachedContext: NatsHeaders | null = null;\n\n constructor(\n @Inject(REQUEST) private readonly injectedRequest: FastifyRequest,\n @Inject(NATS_CONTEXT_RESOLVER) private readonly contextResolver: ContextResolverFn,\n @Inject(NATS_CLIENTS) private readonly clients: Map<string, ClientProxy>,\n ) {}\n\n // Unwraps the GraphQL { req, reply } context wrapper so auth is visible across both transports\n private get request(): FastifyRequest {\n return resolveInjectedRequest(this.injectedRequest);\n }\n\n // Sends a message to a named microservice with NatsHeaders as NATS headers\n async send<T>(service: string, cmd: string, data?: object): Promise<T> {\n const client = this.clients.get(service);\n if (!client) {\n throw new Error(\n `NATS service \"${service}\" is not registered. Available: [${[...this.clients.keys()].join(', ')}]`,\n );\n }\n\n if (!this.cachedContext) {\n // The resolver takes the whole request rather than one auth field: which caller kinds\n // exist, and what each contributes, is the consuming server's model — this side only\n // knows that something has to produce headers.\n const context = await this.contextResolver(this.request);\n if (!context) {\n throw new Error('No auth context on request — is the auth guard active for this route?');\n }\n this.cachedContext = context;\n }\n\n const headers = contextToHeaders(this.cachedContext);\n const record = new NatsRecordBuilder(data ?? {}).setHeaders(headers).build();\n\n return client.send<T>({ cmd }, record).toPromise() as Promise<T>;\n }\n}\n\n// Converts NatsHeaders to a NATS MsgHdrs object for NATS transport.\n//\n// Driven by the key map rather than a field-per-line, so a new context field travels the\n// moment it is added to NATS_HEADER_KEYS. Empty values are omitted — parseNatsHeaders applies\n// the same defaults on the way back, so sending a blank would just restate them.\nfunction contextToHeaders(ctx: NatsHeaders): import('nats').MsgHdrs {\n const hdrs = natsHeaders();\n for (const [field, key] of Object.entries(NATS_HEADER_KEYS) as [keyof NatsHeaders, string][]) {\n if (ctx[field]) hdrs.set(key, ctx[field]);\n }\n return hdrs;\n}\n","import type { FastifyRequest } from 'fastify';\n\n// Unwraps the @Inject(REQUEST) value to the real Fastify request (GraphQL injects a { req, reply } context).\nexport function resolveInjectedRequest(injected: FastifyRequest): FastifyRequest {\n const candidate = injected as unknown as { headers?: unknown; req?: FastifyRequest };\n if (candidate && candidate.headers === undefined && candidate.req) {\n return candidate.req;\n }\n return injected;\n}\n","import { Inject, Injectable } from '@nestjs/common';\nimport type { ClientProxy } from '@nestjs/microservices';\nimport { NatsRecordBuilder } from '@nestjs/microservices';\nimport { NATS_HEADER_KEYS, type NatsHeaders } from './nats-context';\n\nexport const NATS_MS_CLIENTS = Symbol('NATS_MS_CLIENTS');\n\n@Injectable()\nexport class NatsMicroserviceClientService {\n constructor(@Inject(NATS_MS_CLIENTS) private readonly clients: Map<string, ClientProxy>) {}\n\n // Forwards a message to another microservice with NatsHeaders\n async send<T>(service: string, cmd: string, natsHeaders: NatsHeaders, data?: object): Promise<T> {\n const client = this.clients.get(service);\n if (!client) {\n throw new Error(\n `NATS service \"${service}\" is not registered. Available: [${[...this.clients.keys()].join(', ')}]`,\n );\n }\n\n const headers: Record<string, string> = {\n [NATS_HEADER_KEYS.orgId]: natsHeaders.orgId,\n [NATS_HEADER_KEYS.userId]: natsHeaders.userId,\n [NATS_HEADER_KEYS.siteId]: natsHeaders.siteId,\n [NATS_HEADER_KEYS.siteTimezone]: natsHeaders.siteTimezone,\n };\n\n const record = new NatsRecordBuilder(data ?? {}).setHeaders(headers).build();\n return client.send<T>({ cmd }, record).toPromise() as Promise<T>;\n }\n}\n"],"mappings":";;;;AAAA,SAA6BA,OAA2BC,cAAAA,aAAYC,cAAc;AAClF,SAASC,oBAAoB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ACzBC,QAAQL,aAAaK,UAAU,CAAA;IACjC;AAEA,UAAMI,kBAA4B;MAChCP,SAASmB;MACTjB,YAAY,wBAACrB,SAAgC4B,WAAAA;AAC3C,cAAM3B,UAAUD,QAAQC,WAAW2B,OAAOC,IAAY,YAAY,uBAAA;AAClE,eAAOzC,kBAAiBW,aAAaC,SAASC,OAAAA;MAChD,GAHY;MAIZqB,QAAQ;QAACpC;QAAiB4C;;IAC5B;AAEA,WAAO;MACLC,QAAQ3C;MACR4C,SAAS;QAACC;WAAkBhB,aAAae,WAAW,CAAA;;MACpDE,WAAW;QAAChB;QAAiBQ;QAAiBa;;MAC9CH,SAAS;QAACG;;IACZ;EACF;AACF;;;;;","names":["Catch","HttpStatus","Logger","RpcException","throwError","HttpStatus","HttpException","HttpProblemException","HttpException","detailOrOptions","httpStatus","options","detail","type","label","errors","ConflictException","HttpProblemException","detailOrOptions","HttpStatus","CONFLICT","PG_UNIQUE_VIOLATION","tryTranslatePgError","error","pgError","findPgError","undefined","code","constraint","table","detail","ConflictException","label","trim","errors","meta","depth","candidate","cause","RpcProblemExceptionFilter","logger","Logger","name","catch","exception","_host","translatedPgError","tryTranslatePgError","RpcException","throwError","getError","isHttpException","status","getStatus","response","getResponse","payload","toProblemPayload","log","HttpStatus","INTERNAL_SERVER_ERROR","error","warn","call","detail","Error","cause","causeMessage","message","undefined","causeStack","stack","type","errors","JSON","stringify","statusCode","obj","Array","isArray","join","label","createParamDecorator","InternalServerErrorException","NATS_HEADER_KEYS","orgId","userId","siteId","legalEntityId","siteGroupId","siteTimezone","siteCurrencyCode","HEADER_FALLBACKS","getHeader","headers","key","undefined","get","val","Array","isArray","parseNatsHeaders","parsed","field","Object","entries","RpcNatsHeaders","createParamDecorator","_data","ctx","rpcCtx","switchToRpc","getContext","parseNatsHeaders","getHeaders","RpcSiteId","headers","siteId","InternalServerErrorException","RpcSiteCurrencyCode","siteCurrencyCode","Global","Logger","Module","ConfigModule","ConfigService","ClientProxyFactory","Transport","NATS_MODULE_OPTIONS","Symbol","NATS_CONTEXT_RESOLVER","Inject","Injectable","Scope","REQUEST","NatsRecordBuilder","headers","natsHeaders","resolveInjectedRequest","injected","candidate","headers","undefined","req","NATS_CLIENTS","Symbol","NatsClientService","cachedContext","injectedRequest","contextResolver","clients","request","resolveInjectedRequest","send","service","cmd","data","client","get","Error","keys","join","context","headers","contextToHeaders","record","NatsRecordBuilder","setHeaders","build","toPromise","scope","Scope","REQUEST","ctx","hdrs","natsHeaders","field","key","Object","entries","NATS_HEADER_KEYS","set","Inject","Injectable","NatsRecordBuilder","NATS_MS_CLIENTS","Symbol","NatsMicroserviceClientService","clients","send","service","cmd","natsHeaders","data","client","get","Error","keys","join","headers","NATS_HEADER_KEYS","orgId","userId","siteId","siteTimezone","record","NatsRecordBuilder","setHeaders","build","toPromise","NATS_MS_OPTIONS","Symbol","NatsClientModule","logger","Logger","name","allClients","onModuleDestroy","Promise","all","map","c","close","buildClients","options","natsUrl","clients","Map","svc","services","proxy","ClientProxyFactory","create","transport","Transport","NATS","servers","set","push","log","forRoot","asyncOptions","optionsProvider","provide","NATS_MODULE_OPTIONS","useFactory","inject","resolverProvider","NATS_CONTEXT_RESOLVER","contextResolver","clientsProvider","NATS_CLIENTS","config","get","ConfigService","module","imports","ConfigModule","providers","NatsClientService","exports","forMicroservice","NATS_MS_CLIENTS","NatsMicroserviceClientService"]}
package/dist/root.cjs CHANGED
@@ -65,8 +65,15 @@ __name(ApiHealthCheck, "ApiHealthCheck");
65
65
  var import_common3 = require("@nestjs/common");
66
66
  function _ts_decorate(decorators, target, key, desc) {
67
67
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
68
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
69
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
68
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
69
+ r = Reflect.decorate(decorators, target, key, desc);
70
+ } else {
71
+ for (var i = decorators.length - 1; i >= 0; i--) {
72
+ if (d = decorators[i]) {
73
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
74
+ }
75
+ }
76
+ }
70
77
  return c > 3 && r && Object.defineProperty(target, key, r), r;
71
78
  }
72
79
  __name(_ts_decorate, "_ts_decorate");
@@ -86,13 +93,22 @@ AppService = _ts_decorate([
86
93
  // src/root/controllers/app.controller.ts
87
94
  function _ts_decorate2(decorators, target, key, desc) {
88
95
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
90
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
96
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
97
+ r = Reflect.decorate(decorators, target, key, desc);
98
+ } else {
99
+ for (var i = decorators.length - 1; i >= 0; i--) {
100
+ if (d = decorators[i]) {
101
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
102
+ }
103
+ }
104
+ }
91
105
  return c > 3 && r && Object.defineProperty(target, key, r), r;
92
106
  }
93
107
  __name(_ts_decorate2, "_ts_decorate");
94
- function _ts_metadata(k, v) {
95
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
108
+ function _ts_metadata(metadataKey, metadataValue) {
109
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
110
+ return Reflect.metadata(metadataKey, metadataValue);
111
+ }
96
112
  }
97
113
  __name(_ts_metadata, "_ts_metadata");
98
114
  var AppController = class {
@@ -159,13 +175,22 @@ __name(ApiGetCsrfToken, "ApiGetCsrfToken");
159
175
  // src/root/controllers/csrf.controller.ts
160
176
  function _ts_decorate3(decorators, target, key, desc) {
161
177
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
162
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
163
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
178
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
179
+ r = Reflect.decorate(decorators, target, key, desc);
180
+ } else {
181
+ for (var i = decorators.length - 1; i >= 0; i--) {
182
+ if (d = decorators[i]) {
183
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
184
+ }
185
+ }
186
+ }
164
187
  return c > 3 && r && Object.defineProperty(target, key, r), r;
165
188
  }
166
189
  __name(_ts_decorate3, "_ts_decorate");
167
- function _ts_metadata2(k, v) {
168
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
190
+ function _ts_metadata2(metadataKey, metadataValue) {
191
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
192
+ return Reflect.metadata(metadataKey, metadataValue);
193
+ }
169
194
  }
170
195
  __name(_ts_metadata2, "_ts_metadata");
171
196
  function _ts_param(paramIndex, decorator) {
@@ -208,8 +233,15 @@ CsrfController = _ts_decorate3([
208
233
  // src/root/root.module.ts
209
234
  function _ts_decorate4(decorators, target, key, desc) {
210
235
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
211
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
212
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
236
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
237
+ r = Reflect.decorate(decorators, target, key, desc);
238
+ } else {
239
+ for (var i = decorators.length - 1; i >= 0; i--) {
240
+ if (d = decorators[i]) {
241
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
242
+ }
243
+ }
244
+ }
213
245
  return c > 3 && r && Object.defineProperty(target, key, r), r;
214
246
  }
215
247
  __name(_ts_decorate4, "_ts_decorate");
package/dist/root.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/root/index.ts","../src/root/root.module.ts","../src/root/controllers/app.controller.ts","../src/auth/decorators/require.decorator.ts","../src/root/docs/app.docs.ts","../src/root/services/app.service.ts","../src/root/controllers/csrf.controller.ts","../src/root/docs/csrf.docs.ts"],"sourcesContent":["export { RootModule } from './root.module';\n","import { Module } from '@nestjs/common';\nimport { AppController } from './controllers/app.controller';\nimport { CsrfController } from './controllers/csrf.controller';\nimport { AppService } from './services/app.service';\n\n@Module({\n controllers: [AppController, CsrfController],\n providers: [AppService],\n})\nexport class RootModule {}\n","import { Controller, Get } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport { AuthType, Require } from '../../auth/decorators/require.decorator';\nimport { ApiHealthCheck } from '../docs/app.docs';\nimport { AppService } from '../services/app.service';\n\n@ApiTags('Health')\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n // Returns a welcome message indicating the API is running\n @Get()\n @Require(AuthType.Public)\n @ApiHealthCheck()\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","import { SetMetadata } from '@nestjs/common';\n\nexport const REQUIRE_AUTH_KEY = 'requireAuth';\n\nexport enum AuthType {\n Session = 'session',\n App = 'app',\n Cloud = 'cloud',\n Public = 'public',\n}\n\nexport interface AuthRequirement {\n type: AuthType;\n subtypes: string[];\n}\n\n// Declares how a route authenticates, and which subtypes of that caller may reach it.\n//\n// One decorator for every caller kind, so the branch the guard takes is stated at the call\n// site rather than inferred from which of three decorators happens to be present:\n//\n// @Require(AuthType.Session, SessionTypeValues.WEB) session types WEB\n// @Require(AuthType.App, AppTypeValues.GRAPHQL) app credentials of type GRAPHQL\n// @Require(AuthType.Cloud) signed control-plane calls\n// @Require(AuthType.Public) no authentication\n//\n// Subtypes are compared as strings — the enums belong to the consuming server's schema and\n// this only ever compares. Passing none means \"any subtype\", so the caller is still\n// authenticated but unrestricted.\nexport const Require = (type: AuthType, ...subtypes: string[]) =>\n SetMetadata<string, AuthRequirement>(REQUIRE_AUTH_KEY, { type, subtypes });\n","import { applyDecorators } from '@nestjs/common';\nimport { ApiOperation, ApiResponse } from '@nestjs/swagger';\n\nexport function ApiHealthCheck() {\n return applyDecorators(\n ApiOperation({ summary: 'Health check endpoint' }),\n ApiResponse({\n status: 200,\n description: 'Returns a welcome message indicating the API is running',\n type: String,\n }),\n );\n}\n","import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n // Returns the API welcome message\n getHello(): string {\n return `Hello World!`;\n }\n}\n","import { Controller, Get, HttpCode, HttpStatus, Res } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport type { FastifyReply } from 'fastify';\nimport { AuthType, Require } from '../../auth/decorators/require.decorator';\nimport { ApiGetCsrfToken } from '../docs/csrf.docs';\n\n// Type augmentation for @fastify/csrf-protection — added by the consuming server at runtime\ntype FastifyReplyWithCsrf = FastifyReply & { generateCsrf(): string };\n\n@ApiTags('CSRF')\n@Controller('csrf')\nexport class CsrfController {\n // Generates a CSRF token via Fastify's csrf-protection plugin\n @Get('token')\n @Require(AuthType.Public)\n @HttpCode(HttpStatus.OK)\n @ApiGetCsrfToken()\n getToken(@Res({ passthrough: true }) reply: FastifyReply): { csrfToken: string } {\n const csrfToken = (reply as FastifyReplyWithCsrf).generateCsrf();\n return { csrfToken };\n }\n}\n","import { applyDecorators } from '@nestjs/common';\nimport { ApiOperation, ApiResponse } from '@nestjs/swagger';\n\nexport function ApiGetCsrfToken() {\n return applyDecorators(\n ApiOperation({\n summary: 'Get CSRF token',\n description:\n 'Generates and returns a CSRF token that must be included in all state-changing requests (POST, PUT, PATCH, DELETE). The token should be sent in the X-CSRF-Token header.',\n }),\n ApiResponse({\n status: 200,\n description: 'CSRF token generated successfully',\n schema: {\n type: 'object',\n properties: {\n csrfToken: {\n type: 'string',\n description: 'The CSRF token to use in subsequent requests',\n example: 'abc123xyz789',\n },\n },\n required: ['csrfToken'],\n },\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,IAAAA,iBAAuB;;;ACAvB,IAAAC,iBAAgC;AAChC,IAAAC,kBAAwB;;;ACDxB,oBAA4B;AAErB,IAAMC,mBAAmB;AAEzB,IAAKC,WAAAA,0BAAAA,WAAAA;;;;;SAAAA;;AAyBL,IAAMC,UAAU,wBAACC,SAAmBC,iBACzCC,2BAAqCL,kBAAkB;EAAEG;EAAMC;AAAS,CAAA,GADnD;;;AC7BvB,IAAAE,iBAAgC;AAChC,qBAA0C;AAEnC,SAASC,iBAAAA;AACd,aAAOC,oCACLC,6BAAa;IAAEC,SAAS;EAAwB,CAAA,OAChDC,4BAAY;IACVC,QAAQ;IACRC,aAAa;IACbC,MAAMC;EACR,CAAA,CAAA;AAEJ;AATgBR;;;ACHhB,IAAAS,iBAA2B;;;;;;;;AAGpB,IAAMC,aAAN,MAAMA;SAAAA;;;;EAEXC,WAAmB;AACjB,WAAO;EACT;AACF;;;;;;;;;;;;;;;;;AHAO,IAAMC,gBAAN,MAAMA;SAAAA;;;;EACX,YAA6BC,YAAwB;SAAxBA,aAAAA;EAAyB;;EAMtDC,WAAmB;AACjB,WAAO,KAAKD,WAAWC,SAAQ;EACjC;AACF;;;mBALoBC,MAAAA;;;;;;;;;;;;;;;;AIbpB,IAAAC,iBAA2D;AAC3D,IAAAC,kBAAwB;;;ACDxB,IAAAC,iBAAgC;AAChC,IAAAC,kBAA0C;AAEnC,SAASC,kBAAAA;AACd,aAAOC,oCACLC,8BAAa;IACXC,SAAS;IACTC,aACE;EACJ,CAAA,OACAC,6BAAY;IACVC,QAAQ;IACRF,aAAa;IACbG,QAAQ;MACNC,MAAM;MACNC,YAAY;QACVC,WAAW;UACTF,MAAM;UACNJ,aAAa;UACbO,SAAS;QACX;MACF;MACAC,UAAU;QAAC;;IACb;EACF,CAAA,CAAA;AAEJ;AAvBgBZ;;;;;;;;;;;;;;;;;;;;ADQT,IAAMa,iBAAN,MAAMA;SAAAA;;;;EAMXC,SAAqCC,OAA4C;AAC/E,UAAMC,YAAaD,MAA+BE,aAAY;AAC9D,WAAO;MAAED;IAAU;EACrB;AACF;;;mBAPoBE,MAAAA;yDACGC,EAAAA;;;IAELC,aAAa;;;;;;;;;;;;;;;;;;;;;ALRxB,IAAMC,aAAN,MAAMA;SAAAA;;;AAAY;;;IAHvBC,aAAa;MAACC;MAAeC;;IAC7BC,WAAW;MAACC;;;;","names":["import_common","import_common","import_swagger","REQUIRE_AUTH_KEY","AuthType","Require","type","subtypes","SetMetadata","import_common","ApiHealthCheck","applyDecorators","ApiOperation","summary","ApiResponse","status","description","type","String","import_common","AppService","getHello","AppController","appService","getHello","Public","import_common","import_swagger","import_common","import_swagger","ApiGetCsrfToken","applyDecorators","ApiOperation","summary","description","ApiResponse","status","schema","type","properties","csrfToken","example","required","CsrfController","getToken","reply","csrfToken","generateCsrf","Public","OK","passthrough","RootModule","controllers","AppController","CsrfController","providers","AppService"]}
1
+ {"version":3,"sources":["../src/root/index.ts","../src/root/root.module.ts","../src/root/controllers/app.controller.ts","../src/auth/decorators/require.decorator.ts","../src/root/docs/app.docs.ts","../src/root/services/app.service.ts","../src/root/controllers/csrf.controller.ts","../src/root/docs/csrf.docs.ts"],"sourcesContent":["export { RootModule } from './root.module';\n","import { Module } from '@nestjs/common';\nimport { AppController } from './controllers/app.controller';\nimport { CsrfController } from './controllers/csrf.controller';\nimport { AppService } from './services/app.service';\n\n@Module({\n controllers: [AppController, CsrfController],\n providers: [AppService],\n})\nexport class RootModule {}\n","import { Controller, Get } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport { AuthType, Require } from '../../auth/decorators/require.decorator';\nimport { ApiHealthCheck } from '../docs/app.docs';\nimport { AppService } from '../services/app.service';\n\n@ApiTags('Health')\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n // Returns a welcome message indicating the API is running\n @Get()\n @Require(AuthType.Public)\n @ApiHealthCheck()\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","import { SetMetadata } from '@nestjs/common';\n\nexport const REQUIRE_AUTH_KEY = 'requireAuth';\n\nexport enum AuthType {\n Session = 'session',\n App = 'app',\n Cloud = 'cloud',\n Public = 'public',\n}\n\nexport interface AuthRequirement {\n type: AuthType;\n subtypes: string[];\n}\n\n// Declares how a route authenticates, and which subtypes of that caller may reach it.\n//\n// One decorator for every caller kind, so the branch the guard takes is stated at the call\n// site rather than inferred from which of three decorators happens to be present:\n//\n// @Require(AuthType.Session, SessionTypeValues.WEB) session types WEB\n// @Require(AuthType.App, AppTypeValues.GRAPHQL) app credentials of type GRAPHQL\n// @Require(AuthType.Cloud) signed control-plane calls\n// @Require(AuthType.Public) no authentication\n//\n// Subtypes are compared as strings — the enums belong to the consuming server's schema and\n// this only ever compares. Passing none means \"any subtype\", so the caller is still\n// authenticated but unrestricted.\nexport const Require = (type: AuthType, ...subtypes: string[]) =>\n SetMetadata<string, AuthRequirement>(REQUIRE_AUTH_KEY, { type, subtypes });\n","import { applyDecorators } from '@nestjs/common';\nimport { ApiOperation, ApiResponse } from '@nestjs/swagger';\n\nexport function ApiHealthCheck() {\n return applyDecorators(\n ApiOperation({ summary: 'Health check endpoint' }),\n ApiResponse({\n status: 200,\n description: 'Returns a welcome message indicating the API is running',\n type: String,\n }),\n );\n}\n","import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n // Returns the API welcome message\n getHello(): string {\n return `Hello World!`;\n }\n}\n","import { Controller, Get, HttpCode, HttpStatus, Res } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport type { FastifyReply } from 'fastify';\nimport { AuthType, Require } from '../../auth/decorators/require.decorator';\nimport { ApiGetCsrfToken } from '../docs/csrf.docs';\n\n// Type augmentation for @fastify/csrf-protection — added by the consuming server at runtime\ntype FastifyReplyWithCsrf = FastifyReply & { generateCsrf(): string };\n\n@ApiTags('CSRF')\n@Controller('csrf')\nexport class CsrfController {\n // Generates a CSRF token via Fastify's csrf-protection plugin\n @Get('token')\n @Require(AuthType.Public)\n @HttpCode(HttpStatus.OK)\n @ApiGetCsrfToken()\n getToken(@Res({ passthrough: true }) reply: FastifyReply): { csrfToken: string } {\n const csrfToken = (reply as FastifyReplyWithCsrf).generateCsrf();\n return { csrfToken };\n }\n}\n","import { applyDecorators } from '@nestjs/common';\nimport { ApiOperation, ApiResponse } from '@nestjs/swagger';\n\nexport function ApiGetCsrfToken() {\n return applyDecorators(\n ApiOperation({\n summary: 'Get CSRF token',\n description:\n 'Generates and returns a CSRF token that must be included in all state-changing requests (POST, PUT, PATCH, DELETE). The token should be sent in the X-CSRF-Token header.',\n }),\n ApiResponse({\n status: 200,\n description: 'CSRF token generated successfully',\n schema: {\n type: 'object',\n properties: {\n csrfToken: {\n type: 'string',\n description: 'The CSRF token to use in subsequent requests',\n example: 'abc123xyz789',\n },\n },\n required: ['csrfToken'],\n },\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,IAAAA,iBAAuB;;;ACAvB,IAAAC,iBAAgC;AAChC,IAAAC,kBAAwB;;;ACDxB,oBAA4B;AAErB,IAAMC,mBAAmB;AAEzB,IAAKC,WAAAA,0BAAAA,WAAAA;;;;;SAAAA;;AAyBL,IAAMC,UAAU,wBAACC,SAAmBC,iBACzCC,2BAAqCL,kBAAkB;EAAEG;EAAMC;AAAS,CAAA,GADnD;;;AC7BvB,IAAAE,iBAAgC;AAChC,qBAA0C;AAEnC,SAASC,iBAAAA;AACd,aAAOC,oCACLC,6BAAa;IAAEC,SAAS;EAAwB,CAAA,OAChDC,4BAAY;IACVC,QAAQ;IACRC,aAAa;IACbC,MAAMC;EACR,CAAA,CAAA;AAEJ;AATgBR;;;ACHhB,IAAAS,iBAA2B;;;;;;;;;;;;;;;AAGpB,IAAMC,aAAN,MAAMA;SAAAA;;;;EAEXC,WAAmB;AACjB,WAAO;EACT;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AHAO,IAAMC,gBAAN,MAAMA;SAAAA;;;;EACX,YAA6BC,YAAwB;SAAxBA,aAAAA;EAAyB;;EAMtDC,WAAmB;AACjB,WAAO,KAAKD,WAAWC,SAAQ;EACjC;AACF;;;mBALoBC,MAAAA;;;;;;;;;;;;;;;;AIbpB,IAAAC,iBAA2D;AAC3D,IAAAC,kBAAwB;;;ACDxB,IAAAC,iBAAgC;AAChC,IAAAC,kBAA0C;AAEnC,SAASC,kBAAAA;AACd,aAAOC,oCACLC,8BAAa;IACXC,SAAS;IACTC,aACE;EACJ,CAAA,OACAC,6BAAY;IACVC,QAAQ;IACRF,aAAa;IACbG,QAAQ;MACNC,MAAM;MACNC,YAAY;QACVC,WAAW;UACTF,MAAM;UACNJ,aAAa;UACbO,SAAS;QACX;MACF;MACAC,UAAU;QAAC;;IACb;EACF,CAAA,CAAA;AAEJ;AAvBgBZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ADQT,IAAMa,iBAAN,MAAMA;SAAAA;;;;EAMXC,SAAqCC,OAA4C;AAC/E,UAAMC,YAAaD,MAA+BE,aAAY;AAC9D,WAAO;MAAED;IAAU;EACrB;AACF;;;mBAPoBE,MAAAA;yDACGC,EAAAA;;;IAELC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;ALRxB,IAAMC,aAAN,MAAMA;SAAAA;;;AAAY;;;IAHvBC,aAAa;MAACC;MAAeC;;IAC7BC,WAAW;MAACC;;;;","names":["import_common","import_common","import_swagger","REQUIRE_AUTH_KEY","AuthType","Require","type","subtypes","SetMetadata","import_common","ApiHealthCheck","applyDecorators","ApiOperation","summary","ApiResponse","status","description","type","String","import_common","AppService","getHello","AppController","appService","getHello","Public","import_common","import_swagger","import_common","import_swagger","ApiGetCsrfToken","applyDecorators","ApiOperation","summary","description","ApiResponse","status","schema","type","properties","csrfToken","example","required","CsrfController","getToken","reply","csrfToken","generateCsrf","Public","OK","passthrough","RootModule","controllers","AppController","CsrfController","providers","AppService"]}
package/dist/root.js CHANGED
@@ -41,8 +41,15 @@ __name(ApiHealthCheck, "ApiHealthCheck");
41
41
  import { Injectable } from "@nestjs/common";
42
42
  function _ts_decorate(decorators, target, key, desc) {
43
43
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
44
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
45
+ r = Reflect.decorate(decorators, target, key, desc);
46
+ } else {
47
+ for (var i = decorators.length - 1; i >= 0; i--) {
48
+ if (d = decorators[i]) {
49
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
50
+ }
51
+ }
52
+ }
46
53
  return c > 3 && r && Object.defineProperty(target, key, r), r;
47
54
  }
48
55
  __name(_ts_decorate, "_ts_decorate");
@@ -62,13 +69,22 @@ AppService = _ts_decorate([
62
69
  // src/root/controllers/app.controller.ts
63
70
  function _ts_decorate2(decorators, target, key, desc) {
64
71
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
65
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
66
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
72
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
73
+ r = Reflect.decorate(decorators, target, key, desc);
74
+ } else {
75
+ for (var i = decorators.length - 1; i >= 0; i--) {
76
+ if (d = decorators[i]) {
77
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
78
+ }
79
+ }
80
+ }
67
81
  return c > 3 && r && Object.defineProperty(target, key, r), r;
68
82
  }
69
83
  __name(_ts_decorate2, "_ts_decorate");
70
- function _ts_metadata(k, v) {
71
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
84
+ function _ts_metadata(metadataKey, metadataValue) {
85
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
86
+ return Reflect.metadata(metadataKey, metadataValue);
87
+ }
72
88
  }
73
89
  __name(_ts_metadata, "_ts_metadata");
74
90
  var AppController = class {
@@ -135,13 +151,22 @@ __name(ApiGetCsrfToken, "ApiGetCsrfToken");
135
151
  // src/root/controllers/csrf.controller.ts
136
152
  function _ts_decorate3(decorators, target, key, desc) {
137
153
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
138
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
139
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
154
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
155
+ r = Reflect.decorate(decorators, target, key, desc);
156
+ } else {
157
+ for (var i = decorators.length - 1; i >= 0; i--) {
158
+ if (d = decorators[i]) {
159
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
160
+ }
161
+ }
162
+ }
140
163
  return c > 3 && r && Object.defineProperty(target, key, r), r;
141
164
  }
142
165
  __name(_ts_decorate3, "_ts_decorate");
143
- function _ts_metadata2(k, v) {
144
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
166
+ function _ts_metadata2(metadataKey, metadataValue) {
167
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
168
+ return Reflect.metadata(metadataKey, metadataValue);
169
+ }
145
170
  }
146
171
  __name(_ts_metadata2, "_ts_metadata");
147
172
  function _ts_param(paramIndex, decorator) {
@@ -184,8 +209,15 @@ CsrfController = _ts_decorate3([
184
209
  // src/root/root.module.ts
185
210
  function _ts_decorate4(decorators, target, key, desc) {
186
211
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
187
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
188
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
212
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
213
+ r = Reflect.decorate(decorators, target, key, desc);
214
+ } else {
215
+ for (var i = decorators.length - 1; i >= 0; i--) {
216
+ if (d = decorators[i]) {
217
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
218
+ }
219
+ }
220
+ }
189
221
  return c > 3 && r && Object.defineProperty(target, key, r), r;
190
222
  }
191
223
  __name(_ts_decorate4, "_ts_decorate");
package/dist/root.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/root/root.module.ts","../src/root/controllers/app.controller.ts","../src/auth/decorators/require.decorator.ts","../src/root/docs/app.docs.ts","../src/root/services/app.service.ts","../src/root/controllers/csrf.controller.ts","../src/root/docs/csrf.docs.ts"],"sourcesContent":["import { Module } from '@nestjs/common';\nimport { AppController } from './controllers/app.controller';\nimport { CsrfController } from './controllers/csrf.controller';\nimport { AppService } from './services/app.service';\n\n@Module({\n controllers: [AppController, CsrfController],\n providers: [AppService],\n})\nexport class RootModule {}\n","import { Controller, Get } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport { AuthType, Require } from '../../auth/decorators/require.decorator';\nimport { ApiHealthCheck } from '../docs/app.docs';\nimport { AppService } from '../services/app.service';\n\n@ApiTags('Health')\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n // Returns a welcome message indicating the API is running\n @Get()\n @Require(AuthType.Public)\n @ApiHealthCheck()\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","import { SetMetadata } from '@nestjs/common';\n\nexport const REQUIRE_AUTH_KEY = 'requireAuth';\n\nexport enum AuthType {\n Session = 'session',\n App = 'app',\n Cloud = 'cloud',\n Public = 'public',\n}\n\nexport interface AuthRequirement {\n type: AuthType;\n subtypes: string[];\n}\n\n// Declares how a route authenticates, and which subtypes of that caller may reach it.\n//\n// One decorator for every caller kind, so the branch the guard takes is stated at the call\n// site rather than inferred from which of three decorators happens to be present:\n//\n// @Require(AuthType.Session, SessionTypeValues.WEB) session types WEB\n// @Require(AuthType.App, AppTypeValues.GRAPHQL) app credentials of type GRAPHQL\n// @Require(AuthType.Cloud) signed control-plane calls\n// @Require(AuthType.Public) no authentication\n//\n// Subtypes are compared as strings — the enums belong to the consuming server's schema and\n// this only ever compares. Passing none means \"any subtype\", so the caller is still\n// authenticated but unrestricted.\nexport const Require = (type: AuthType, ...subtypes: string[]) =>\n SetMetadata<string, AuthRequirement>(REQUIRE_AUTH_KEY, { type, subtypes });\n","import { applyDecorators } from '@nestjs/common';\nimport { ApiOperation, ApiResponse } from '@nestjs/swagger';\n\nexport function ApiHealthCheck() {\n return applyDecorators(\n ApiOperation({ summary: 'Health check endpoint' }),\n ApiResponse({\n status: 200,\n description: 'Returns a welcome message indicating the API is running',\n type: String,\n }),\n );\n}\n","import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n // Returns the API welcome message\n getHello(): string {\n return `Hello World!`;\n }\n}\n","import { Controller, Get, HttpCode, HttpStatus, Res } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport type { FastifyReply } from 'fastify';\nimport { AuthType, Require } from '../../auth/decorators/require.decorator';\nimport { ApiGetCsrfToken } from '../docs/csrf.docs';\n\n// Type augmentation for @fastify/csrf-protection — added by the consuming server at runtime\ntype FastifyReplyWithCsrf = FastifyReply & { generateCsrf(): string };\n\n@ApiTags('CSRF')\n@Controller('csrf')\nexport class CsrfController {\n // Generates a CSRF token via Fastify's csrf-protection plugin\n @Get('token')\n @Require(AuthType.Public)\n @HttpCode(HttpStatus.OK)\n @ApiGetCsrfToken()\n getToken(@Res({ passthrough: true }) reply: FastifyReply): { csrfToken: string } {\n const csrfToken = (reply as FastifyReplyWithCsrf).generateCsrf();\n return { csrfToken };\n }\n}\n","import { applyDecorators } from '@nestjs/common';\nimport { ApiOperation, ApiResponse } from '@nestjs/swagger';\n\nexport function ApiGetCsrfToken() {\n return applyDecorators(\n ApiOperation({\n summary: 'Get CSRF token',\n description:\n 'Generates and returns a CSRF token that must be included in all state-changing requests (POST, PUT, PATCH, DELETE). The token should be sent in the X-CSRF-Token header.',\n }),\n ApiResponse({\n status: 200,\n description: 'CSRF token generated successfully',\n schema: {\n type: 'object',\n properties: {\n csrfToken: {\n type: 'string',\n description: 'The CSRF token to use in subsequent requests',\n example: 'abc123xyz789',\n },\n },\n required: ['csrfToken'],\n },\n }),\n );\n}\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACAvB,SAASC,YAAYC,WAAW;AAChC,SAASC,eAAe;;;ACDxB,SAASC,mBAAmB;AAErB,IAAMC,mBAAmB;AAEzB,IAAKC,WAAAA,0BAAAA,WAAAA;;;;;SAAAA;;AAyBL,IAAMC,UAAU,wBAACC,SAAmBC,aACzCC,YAAqCL,kBAAkB;EAAEG;EAAMC;AAAS,CAAA,GADnD;;;AC7BvB,SAASE,uBAAuB;AAChC,SAASC,cAAcC,mBAAmB;AAEnC,SAASC,iBAAAA;AACd,SAAOC,gBACLC,aAAa;IAAEC,SAAS;EAAwB,CAAA,GAChDC,YAAY;IACVC,QAAQ;IACRC,aAAa;IACbC,MAAMC;EACR,CAAA,CAAA;AAEJ;AATgBR;;;ACHhB,SAASS,kBAAkB;;;;;;;;AAGpB,IAAMC,aAAN,MAAMA;SAAAA;;;;EAEXC,WAAmB;AACjB,WAAO;EACT;AACF;;;;;;;;;;;;;;;;;AHAO,IAAMC,gBAAN,MAAMA;SAAAA;;;;EACX,YAA6BC,YAAwB;SAAxBA,aAAAA;EAAyB;;EAMtDC,WAAmB;AACjB,WAAO,KAAKD,WAAWC,SAAQ;EACjC;AACF;;;mBALoBC,MAAAA;;;;;;;;;;;;;;;;AIbpB,SAASC,cAAAA,aAAYC,OAAAA,MAAKC,UAAUC,YAAYC,WAAW;AAC3D,SAASC,WAAAA,gBAAe;;;ACDxB,SAASC,mBAAAA,wBAAuB;AAChC,SAASC,gBAAAA,eAAcC,eAAAA,oBAAmB;AAEnC,SAASC,kBAAAA;AACd,SAAOC,iBACLC,cAAa;IACXC,SAAS;IACTC,aACE;EACJ,CAAA,GACAC,aAAY;IACVC,QAAQ;IACRF,aAAa;IACbG,QAAQ;MACNC,MAAM;MACNC,YAAY;QACVC,WAAW;UACTF,MAAM;UACNJ,aAAa;UACbO,SAAS;QACX;MACF;MACAC,UAAU;QAAC;;IACb;EACF,CAAA,CAAA;AAEJ;AAvBgBZ;;;;;;;;;;;;;;;;;;;;ADQT,IAAMa,iBAAN,MAAMA;SAAAA;;;;EAMXC,SAAqCC,OAA4C;AAC/E,UAAMC,YAAaD,MAA+BE,aAAY;AAC9D,WAAO;MAAED;IAAU;EACrB;AACF;;;mBAPoBE,MAAAA;sBACGC,EAAAA;;;IAELC,aAAa;;;;;;;;;;;;;;;;;;;;;ALRxB,IAAMC,aAAN,MAAMA;SAAAA;;;AAAY;;;IAHvBC,aAAa;MAACC;MAAeC;;IAC7BC,WAAW;MAACC;;;;","names":["Module","Controller","Get","ApiTags","SetMetadata","REQUIRE_AUTH_KEY","AuthType","Require","type","subtypes","SetMetadata","applyDecorators","ApiOperation","ApiResponse","ApiHealthCheck","applyDecorators","ApiOperation","summary","ApiResponse","status","description","type","String","Injectable","AppService","getHello","AppController","appService","getHello","Public","Controller","Get","HttpCode","HttpStatus","Res","ApiTags","applyDecorators","ApiOperation","ApiResponse","ApiGetCsrfToken","applyDecorators","ApiOperation","summary","description","ApiResponse","status","schema","type","properties","csrfToken","example","required","CsrfController","getToken","reply","csrfToken","generateCsrf","Public","OK","passthrough","RootModule","controllers","AppController","CsrfController","providers","AppService"]}
1
+ {"version":3,"sources":["../src/root/root.module.ts","../src/root/controllers/app.controller.ts","../src/auth/decorators/require.decorator.ts","../src/root/docs/app.docs.ts","../src/root/services/app.service.ts","../src/root/controllers/csrf.controller.ts","../src/root/docs/csrf.docs.ts"],"sourcesContent":["import { Module } from '@nestjs/common';\nimport { AppController } from './controllers/app.controller';\nimport { CsrfController } from './controllers/csrf.controller';\nimport { AppService } from './services/app.service';\n\n@Module({\n controllers: [AppController, CsrfController],\n providers: [AppService],\n})\nexport class RootModule {}\n","import { Controller, Get } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport { AuthType, Require } from '../../auth/decorators/require.decorator';\nimport { ApiHealthCheck } from '../docs/app.docs';\nimport { AppService } from '../services/app.service';\n\n@ApiTags('Health')\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n // Returns a welcome message indicating the API is running\n @Get()\n @Require(AuthType.Public)\n @ApiHealthCheck()\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","import { SetMetadata } from '@nestjs/common';\n\nexport const REQUIRE_AUTH_KEY = 'requireAuth';\n\nexport enum AuthType {\n Session = 'session',\n App = 'app',\n Cloud = 'cloud',\n Public = 'public',\n}\n\nexport interface AuthRequirement {\n type: AuthType;\n subtypes: string[];\n}\n\n// Declares how a route authenticates, and which subtypes of that caller may reach it.\n//\n// One decorator for every caller kind, so the branch the guard takes is stated at the call\n// site rather than inferred from which of three decorators happens to be present:\n//\n// @Require(AuthType.Session, SessionTypeValues.WEB) session types WEB\n// @Require(AuthType.App, AppTypeValues.GRAPHQL) app credentials of type GRAPHQL\n// @Require(AuthType.Cloud) signed control-plane calls\n// @Require(AuthType.Public) no authentication\n//\n// Subtypes are compared as strings — the enums belong to the consuming server's schema and\n// this only ever compares. Passing none means \"any subtype\", so the caller is still\n// authenticated but unrestricted.\nexport const Require = (type: AuthType, ...subtypes: string[]) =>\n SetMetadata<string, AuthRequirement>(REQUIRE_AUTH_KEY, { type, subtypes });\n","import { applyDecorators } from '@nestjs/common';\nimport { ApiOperation, ApiResponse } from '@nestjs/swagger';\n\nexport function ApiHealthCheck() {\n return applyDecorators(\n ApiOperation({ summary: 'Health check endpoint' }),\n ApiResponse({\n status: 200,\n description: 'Returns a welcome message indicating the API is running',\n type: String,\n }),\n );\n}\n","import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n // Returns the API welcome message\n getHello(): string {\n return `Hello World!`;\n }\n}\n","import { Controller, Get, HttpCode, HttpStatus, Res } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport type { FastifyReply } from 'fastify';\nimport { AuthType, Require } from '../../auth/decorators/require.decorator';\nimport { ApiGetCsrfToken } from '../docs/csrf.docs';\n\n// Type augmentation for @fastify/csrf-protection — added by the consuming server at runtime\ntype FastifyReplyWithCsrf = FastifyReply & { generateCsrf(): string };\n\n@ApiTags('CSRF')\n@Controller('csrf')\nexport class CsrfController {\n // Generates a CSRF token via Fastify's csrf-protection plugin\n @Get('token')\n @Require(AuthType.Public)\n @HttpCode(HttpStatus.OK)\n @ApiGetCsrfToken()\n getToken(@Res({ passthrough: true }) reply: FastifyReply): { csrfToken: string } {\n const csrfToken = (reply as FastifyReplyWithCsrf).generateCsrf();\n return { csrfToken };\n }\n}\n","import { applyDecorators } from '@nestjs/common';\nimport { ApiOperation, ApiResponse } from '@nestjs/swagger';\n\nexport function ApiGetCsrfToken() {\n return applyDecorators(\n ApiOperation({\n summary: 'Get CSRF token',\n description:\n 'Generates and returns a CSRF token that must be included in all state-changing requests (POST, PUT, PATCH, DELETE). The token should be sent in the X-CSRF-Token header.',\n }),\n ApiResponse({\n status: 200,\n description: 'CSRF token generated successfully',\n schema: {\n type: 'object',\n properties: {\n csrfToken: {\n type: 'string',\n description: 'The CSRF token to use in subsequent requests',\n example: 'abc123xyz789',\n },\n },\n required: ['csrfToken'],\n },\n }),\n );\n}\n"],"mappings":";;;;AAAA,SAASA,cAAc;;;ACAvB,SAASC,YAAYC,WAAW;AAChC,SAASC,eAAe;;;ACDxB,SAASC,mBAAmB;AAErB,IAAMC,mBAAmB;AAEzB,IAAKC,WAAAA,0BAAAA,WAAAA;;;;;SAAAA;;AAyBL,IAAMC,UAAU,wBAACC,SAAmBC,aACzCC,YAAqCL,kBAAkB;EAAEG;EAAMC;AAAS,CAAA,GADnD;;;AC7BvB,SAASE,uBAAuB;AAChC,SAASC,cAAcC,mBAAmB;AAEnC,SAASC,iBAAAA;AACd,SAAOC,gBACLC,aAAa;IAAEC,SAAS;EAAwB,CAAA,GAChDC,YAAY;IACVC,QAAQ;IACRC,aAAa;IACbC,MAAMC;EACR,CAAA,CAAA;AAEJ;AATgBR;;;ACHhB,SAASS,kBAAkB;;;;;;;;;;;;;;;AAGpB,IAAMC,aAAN,MAAMA;SAAAA;;;;EAEXC,WAAmB;AACjB,WAAO;EACT;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AHAO,IAAMC,gBAAN,MAAMA;SAAAA;;;;EACX,YAA6BC,YAAwB;SAAxBA,aAAAA;EAAyB;;EAMtDC,WAAmB;AACjB,WAAO,KAAKD,WAAWC,SAAQ;EACjC;AACF;;;mBALoBC,MAAAA;;;;;;;;;;;;;;;;AIbpB,SAASC,cAAAA,aAAYC,OAAAA,MAAKC,UAAUC,YAAYC,WAAW;AAC3D,SAASC,WAAAA,gBAAe;;;ACDxB,SAASC,mBAAAA,wBAAuB;AAChC,SAASC,gBAAAA,eAAcC,eAAAA,oBAAmB;AAEnC,SAASC,kBAAAA;AACd,SAAOC,iBACLC,cAAa;IACXC,SAAS;IACTC,aACE;EACJ,CAAA,GACAC,aAAY;IACVC,QAAQ;IACRF,aAAa;IACbG,QAAQ;MACNC,MAAM;MACNC,YAAY;QACVC,WAAW;UACTF,MAAM;UACNJ,aAAa;UACbO,SAAS;QACX;MACF;MACAC,UAAU;QAAC;;IACb;EACF,CAAA,CAAA;AAEJ;AAvBgBZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ADQT,IAAMa,iBAAN,MAAMA;SAAAA;;;;EAMXC,SAAqCC,OAA4C;AAC/E,UAAMC,YAAaD,MAA+BE,aAAY;AAC9D,WAAO;MAAED;IAAU;EACrB;AACF;;;mBAPoBE,MAAAA;sBACGC,EAAAA;;;IAELC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;ALRxB,IAAMC,aAAN,MAAMA;SAAAA;;;AAAY;;;IAHvBC,aAAa;MAACC;MAAeC;;IAC7BC,WAAW;MAACC;;;;","names":["Module","Controller","Get","ApiTags","SetMetadata","REQUIRE_AUTH_KEY","AuthType","Require","type","subtypes","SetMetadata","applyDecorators","ApiOperation","ApiResponse","ApiHealthCheck","applyDecorators","ApiOperation","summary","ApiResponse","status","description","type","String","Injectable","AppService","getHello","AppController","appService","getHello","Public","Controller","Get","HttpCode","HttpStatus","Res","ApiTags","applyDecorators","ApiOperation","ApiResponse","ApiGetCsrfToken","applyDecorators","ApiOperation","summary","description","ApiResponse","status","schema","type","properties","csrfToken","example","required","CsrfController","getToken","reply","csrfToken","generateCsrf","Public","OK","passthrough","RootModule","controllers","AppController","CsrfController","providers","AppService"]}
@@ -129,17 +129,17 @@ interface BusinessVocabulary {
129
129
  interface SnapshotBusiness {
130
130
  name: string;
131
131
  vocabulary?: BusinessVocabulary;
132
- apps: SnapshotApp[];
133
132
  roleTemplates: Record<string, SnapshotRoleTemplate>;
134
133
  plans: Record<string, SnapshotPlan>;
135
134
  }
136
135
  interface VersionSnapshot {
137
136
  schemaVersion?: number;
138
137
  features: Record<string, SnapshotFeature>;
138
+ apps: SnapshotApp[];
139
139
  businesses: Record<string, SnapshotBusiness>;
140
140
  }
141
141
  declare function snapshotFeatureKey(code: string, scope: ScopeType): string;
142
- declare const SNAPSHOT_SCHEMA_VERSION = 5;
142
+ declare const SNAPSHOT_SCHEMA_VERSION = 6;
143
143
  type LockReason = 'PLAN' | 'SITE' | 'SERVICE';
144
144
  interface CatalogPermission {
145
145
  code: string;
@@ -177,4 +177,4 @@ interface FeatureCatalogEntry {
177
177
  }
178
178
  type RoleItem = SnapshotRoleTemplate;
179
179
 
180
- export { type ApiSurface as A, BUCKET_BY_SURFACE as B, type CatalogPermission as C, type SnapshotRoleTemplate as D, SURFACE_BY_BUCKET as E, type FeatureCatalogEntry as F, snapshotFeatureKey as G, type UiPlatformBucket as H, type VocabularyEntry as I, type LockReason as L, type PlatformBucket as P, type RoleItem as R, type SiteFeatureLocks as S, UI_PLATFORMS as U, type VersionSnapshot as V, type SiteType as a, type ScopeType as b, type ServiceCode as c, type SnapshotFeature as d, type PlatformCodes as e, type FeatureUnlocks as f, type PlatformDenyCodes as g, API_BUCKETS as h, API_SURFACES as i, type ApiBucket as j, type BusinessVocabulary as k, type FeatureLocks as l, isApiBucket as m, type PermissionGroupRef as n, PLATFORMS as o, SERVICE_CODES as p, SITE_TYPES as q, SNAPSHOT_SCHEMA_VERSION as r, type SnapshotApp as s, type SnapshotAppFeatureRef as t, type SnapshotBusiness as u, type SnapshotMicrofrontendMobile as v, type SnapshotMicrofrontends as w, type SnapshotMicrofrontendWeb as x, type SnapshotPermission as y, type SnapshotPlan as z };
180
+ export { type ApiSurface as A, BUCKET_BY_SURFACE as B, type CatalogPermission as C, type SnapshotRoleTemplate as D, type UiPlatformBucket as E, type FeatureCatalogEntry as F, type VocabularyEntry as G, isApiBucket as H, snapshotFeatureKey as I, type LockReason as L, type PlatformBucket as P, type RoleItem as R, type SiteFeatureLocks as S, UI_PLATFORMS as U, type VersionSnapshot as V, type SiteType as a, type ScopeType as b, type ServiceCode as c, type SnapshotFeature as d, type PlatformCodes as e, type FeatureUnlocks as f, type PlatformDenyCodes as g, API_BUCKETS as h, API_SURFACES as i, type ApiBucket as j, type BusinessVocabulary as k, type FeatureLocks as l, PLATFORMS as m, type PermissionGroupRef as n, SERVICE_CODES as o, SITE_TYPES as p, SNAPSHOT_SCHEMA_VERSION as q, SURFACE_BY_BUCKET as r, type SnapshotApp as s, type SnapshotAppFeatureRef as t, type SnapshotBusiness as u, type SnapshotMicrofrontendMobile as v, type SnapshotMicrofrontendWeb as w, type SnapshotMicrofrontends as x, type SnapshotPermission as y, type SnapshotPlan as z };
@@ -129,17 +129,17 @@ interface BusinessVocabulary {
129
129
  interface SnapshotBusiness {
130
130
  name: string;
131
131
  vocabulary?: BusinessVocabulary;
132
- apps: SnapshotApp[];
133
132
  roleTemplates: Record<string, SnapshotRoleTemplate>;
134
133
  plans: Record<string, SnapshotPlan>;
135
134
  }
136
135
  interface VersionSnapshot {
137
136
  schemaVersion?: number;
138
137
  features: Record<string, SnapshotFeature>;
138
+ apps: SnapshotApp[];
139
139
  businesses: Record<string, SnapshotBusiness>;
140
140
  }
141
141
  declare function snapshotFeatureKey(code: string, scope: ScopeType): string;
142
- declare const SNAPSHOT_SCHEMA_VERSION = 5;
142
+ declare const SNAPSHOT_SCHEMA_VERSION = 6;
143
143
  type LockReason = 'PLAN' | 'SITE' | 'SERVICE';
144
144
  interface CatalogPermission {
145
145
  code: string;
@@ -177,4 +177,4 @@ interface FeatureCatalogEntry {
177
177
  }
178
178
  type RoleItem = SnapshotRoleTemplate;
179
179
 
180
- export { type ApiSurface as A, BUCKET_BY_SURFACE as B, type CatalogPermission as C, type SnapshotRoleTemplate as D, SURFACE_BY_BUCKET as E, type FeatureCatalogEntry as F, snapshotFeatureKey as G, type UiPlatformBucket as H, type VocabularyEntry as I, type LockReason as L, type PlatformBucket as P, type RoleItem as R, type SiteFeatureLocks as S, UI_PLATFORMS as U, type VersionSnapshot as V, type SiteType as a, type ScopeType as b, type ServiceCode as c, type SnapshotFeature as d, type PlatformCodes as e, type FeatureUnlocks as f, type PlatformDenyCodes as g, API_BUCKETS as h, API_SURFACES as i, type ApiBucket as j, type BusinessVocabulary as k, type FeatureLocks as l, isApiBucket as m, type PermissionGroupRef as n, PLATFORMS as o, SERVICE_CODES as p, SITE_TYPES as q, SNAPSHOT_SCHEMA_VERSION as r, type SnapshotApp as s, type SnapshotAppFeatureRef as t, type SnapshotBusiness as u, type SnapshotMicrofrontendMobile as v, type SnapshotMicrofrontends as w, type SnapshotMicrofrontendWeb as x, type SnapshotPermission as y, type SnapshotPlan as z };
180
+ export { type ApiSurface as A, BUCKET_BY_SURFACE as B, type CatalogPermission as C, type SnapshotRoleTemplate as D, type UiPlatformBucket as E, type FeatureCatalogEntry as F, type VocabularyEntry as G, isApiBucket as H, snapshotFeatureKey as I, type LockReason as L, type PlatformBucket as P, type RoleItem as R, type SiteFeatureLocks as S, UI_PLATFORMS as U, type VersionSnapshot as V, type SiteType as a, type ScopeType as b, type ServiceCode as c, type SnapshotFeature as d, type PlatformCodes as e, type FeatureUnlocks as f, type PlatformDenyCodes as g, API_BUCKETS as h, API_SURFACES as i, type ApiBucket as j, type BusinessVocabulary as k, type FeatureLocks as l, PLATFORMS as m, type PermissionGroupRef as n, SERVICE_CODES as o, SITE_TYPES as p, SNAPSHOT_SCHEMA_VERSION as q, SURFACE_BY_BUCKET as r, type SnapshotApp as s, type SnapshotAppFeatureRef as t, type SnapshotBusiness as u, type SnapshotMicrofrontendMobile as v, type SnapshotMicrofrontendWeb as w, type SnapshotMicrofrontends as x, type SnapshotPermission as y, type SnapshotPlan as z };