@miguelmorales13/nestkit 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/dist/alerts/alert-on-failure.decorator.d.ts +5 -0
  2. package/dist/alerts/alert-sinks.d.ts +29 -0
  3. package/dist/alerts/alerts.module.d.ts +19 -0
  4. package/dist/alerts/alerts.options.d.ts +1 -0
  5. package/dist/alerts/alerts.service.d.ts +28 -0
  6. package/dist/alerts/alerts.types.d.ts +66 -0
  7. package/dist/alerts/index.cjs +276 -0
  8. package/dist/alerts/index.d.ts +10 -0
  9. package/dist/alerts/index.js +276 -0
  10. package/dist/alerts/logger-with-alerts.d.ts +18 -0
  11. package/dist/alerts/process-guards.d.ts +21 -0
  12. package/dist/alerts/runtime.d.ts +4 -0
  13. package/dist/audit/index.cjs +13 -13
  14. package/dist/audit/index.js +2 -2
  15. package/dist/auth/index.cjs +21 -21
  16. package/dist/auth/index.js +3 -3
  17. package/dist/auth/oauth/index.cjs +101 -101
  18. package/dist/auth/oauth/index.js +3 -3
  19. package/dist/bootstrap/apply-defaults.d.ts +9 -0
  20. package/dist/bootstrap/index.cjs +7 -6
  21. package/dist/bootstrap/index.js +6 -5
  22. package/dist/chunk-3TUMVLPJ.js +14 -0
  23. package/dist/{chunk-PA24P76K.js → chunk-45SW7FBE.js} +1 -1
  24. package/dist/{chunk-RF75KC63.cjs → chunk-47IYXZHW.cjs} +2 -2
  25. package/dist/{chunk-TUNDBBQF.js → chunk-4WWOKZIO.js} +4 -4
  26. package/dist/{chunk-2DUEQKOI.js → chunk-5LVGCTJ3.js} +4 -4
  27. package/dist/chunk-A6YGIZCQ.cjs +14 -0
  28. package/dist/chunk-A7FI6HXV.js +40 -0
  29. package/dist/chunk-CU4FUIVJ.cjs +8 -0
  30. package/dist/{chunk-FH5UNWWW.cjs → chunk-D35TBVRO.cjs} +4 -4
  31. package/dist/{chunk-4MGIQFAJ.js → chunk-D3DDJWUD.js} +5 -0
  32. package/dist/chunk-DVGPEBUL.js +8 -0
  33. package/dist/{chunk-VKOPDDCC.js → chunk-ENZ7LQRE.js} +1 -1
  34. package/dist/{chunk-3AUOOEQO.cjs → chunk-F77X4QUN.cjs} +2 -2
  35. package/dist/chunk-FBNV5X6C.js +61 -0
  36. package/dist/{chunk-APUFKA4K.cjs → chunk-FDZQCLLK.cjs} +6 -6
  37. package/dist/{chunk-DYHSOULW.js → chunk-IGSNB5BX.js} +1 -1
  38. package/dist/chunk-IVWPA6QH.cjs +90 -0
  39. package/dist/{chunk-LSDY6ETG.cjs → chunk-JJKGQNGD.cjs} +5 -5
  40. package/dist/{chunk-ALIKVFOV.cjs → chunk-JRFE7NSO.cjs} +12 -4
  41. package/dist/{chunk-HVHYZXBB.cjs → chunk-KNU5RN3O.cjs} +3 -3
  42. package/dist/{chunk-52IOOHNX.cjs → chunk-KQPJCVN3.cjs} +26 -26
  43. package/dist/chunk-LGFHLAY3.cjs +61 -0
  44. package/dist/{chunk-2REOCMUD.cjs → chunk-LRX7AMSS.cjs} +6 -1
  45. package/dist/{chunk-4PFAKLT3.js → chunk-MUWHGBIB.js} +1 -1
  46. package/dist/{chunk-ZJMLEP5H.js → chunk-NJYLQDB3.js} +1 -1
  47. package/dist/{chunk-IFNYRZP2.js → chunk-OSRH6KYZ.js} +4 -4
  48. package/dist/{chunk-6RAPVLJM.js → chunk-OTE77ONL.js} +1 -1
  49. package/dist/chunk-UDACUMLO.cjs +40 -0
  50. package/dist/{chunk-PFHHLB7B.js → chunk-UGAAJRPO.js} +10 -2
  51. package/dist/{chunk-SPTDXUED.cjs → chunk-URLDTS2Q.cjs} +2 -2
  52. package/dist/{chunk-W2T2VFLC.cjs → chunk-VALDHJOO.cjs} +5 -5
  53. package/dist/chunk-WFCQDOSN.js +90 -0
  54. package/dist/consent/consent.interceptor.d.ts +20 -0
  55. package/dist/consent/consent.module.d.ts +25 -0
  56. package/dist/consent/consent.options.d.ts +30 -0
  57. package/dist/consent/consent.port.d.ts +17 -0
  58. package/dist/consent/consent.service.d.ts +44 -0
  59. package/dist/consent/guard/index.cjs +13 -0
  60. package/dist/consent/guard/index.d.ts +31 -0
  61. package/dist/consent/guard/index.js +13 -0
  62. package/dist/consent/index.cjs +271 -0
  63. package/dist/consent/index.d.ts +13 -0
  64. package/dist/consent/index.js +271 -0
  65. package/dist/consent/memory.store.d.ts +7 -0
  66. package/dist/consent/shared/index.cjs +11 -0
  67. package/dist/consent/shared/index.d.ts +19 -0
  68. package/dist/consent/shared/index.js +11 -0
  69. package/dist/consent/typeorm.store.d.ts +22 -0
  70. package/dist/crud/index.cjs +4 -4
  71. package/dist/crud/index.js +3 -3
  72. package/dist/database/postgres/index.cjs +3 -3
  73. package/dist/database/postgres/index.js +2 -2
  74. package/dist/database/supabase/index.cjs +3 -3
  75. package/dist/database/supabase/index.js +2 -2
  76. package/dist/database/typeorm/index.cjs +2 -2
  77. package/dist/database/typeorm/index.js +1 -1
  78. package/dist/devices/device-check.interceptor.d.ts +20 -0
  79. package/dist/devices/devices.module.d.ts +28 -0
  80. package/dist/devices/devices.options.d.ts +53 -0
  81. package/dist/devices/devices.port.d.ts +62 -0
  82. package/dist/devices/devices.service.d.ts +58 -0
  83. package/dist/devices/index.cjs +327 -0
  84. package/dist/devices/index.d.ts +8 -0
  85. package/dist/devices/index.js +327 -0
  86. package/dist/devices/memory.store.d.ts +12 -0
  87. package/dist/email/index.cjs +2 -2
  88. package/dist/email/index.js +1 -1
  89. package/dist/email/nodemailer/index.cjs +2 -2
  90. package/dist/email/nodemailer/index.js +1 -1
  91. package/dist/email/resend/index.cjs +2 -2
  92. package/dist/email/resend/index.js +1 -1
  93. package/dist/entities/index.cjs +1 -1
  94. package/dist/entities/index.js +1 -1
  95. package/dist/errors/index.cjs +7 -7
  96. package/dist/errors/index.js +7 -7
  97. package/dist/events/buses.d.ts +27 -0
  98. package/dist/events/events.controller.d.ts +15 -0
  99. package/dist/events/events.module.d.ts +29 -0
  100. package/dist/events/events.options.d.ts +50 -0
  101. package/dist/events/events.service.d.ts +49 -0
  102. package/dist/events/events.types.d.ts +77 -0
  103. package/dist/events/index.cjs +557 -0
  104. package/dist/events/index.d.ts +10 -0
  105. package/dist/events/index.js +557 -0
  106. package/dist/events/memory-ticket.store.d.ts +9 -0
  107. package/dist/google-business/google-business-http.d.ts +41 -0
  108. package/dist/google-business/google-business.errors.d.ts +75 -0
  109. package/dist/google-business/google-business.mappers.d.ts +52 -0
  110. package/dist/google-business/google-business.module.d.ts +26 -0
  111. package/dist/google-business/google-business.options.d.ts +40 -0
  112. package/dist/google-business/google-business.ports.d.ts +18 -0
  113. package/dist/google-business/google-business.service.d.ts +120 -0
  114. package/dist/google-business/google-business.types.d.ts +155 -0
  115. package/dist/google-business/index.cjs +1025 -0
  116. package/dist/google-business/index.d.ts +15 -0
  117. package/dist/google-business/index.js +1025 -0
  118. package/dist/google-business/testing/google-simulator.d.ts +61 -0
  119. package/dist/hardening/body-limits.d.ts +24 -0
  120. package/dist/hardening/http.types.d.ts +26 -0
  121. package/dist/hardening/index.cjs +179 -0
  122. package/dist/hardening/index.d.ts +19 -0
  123. package/dist/hardening/index.js +179 -0
  124. package/dist/hardening/memory-rate-limit.store.d.ts +10 -0
  125. package/dist/hardening/origin-secret.d.ts +29 -0
  126. package/dist/hardening/rate-limit.decorator.d.ts +8 -0
  127. package/dist/hardening/rate-limit.guard.d.ts +18 -0
  128. package/dist/hardening/rate-limit.module.d.ts +23 -0
  129. package/dist/hardening/rate-limit.options.d.ts +35 -0
  130. package/dist/hardening/rate-limit.port.d.ts +11 -0
  131. package/dist/hardening/redis-rate-limit.store.d.ts +23 -0
  132. package/dist/hardening/trust-proxy.d.ts +22 -0
  133. package/dist/health/health.controller.d.ts +32 -0
  134. package/dist/health/health.module.d.ts +15 -0
  135. package/dist/health/health.options.d.ts +24 -0
  136. package/dist/health/index.cjs +103 -0
  137. package/dist/health/index.d.ts +5 -0
  138. package/dist/health/index.js +103 -0
  139. package/dist/i18n/index.cjs +3 -3
  140. package/dist/i18n/index.js +2 -2
  141. package/dist/idempotency/idempotency.interceptor.d.ts +1 -0
  142. package/dist/idempotency/idempotency.options.d.ts +15 -0
  143. package/dist/idempotency/index.cjs +214 -7
  144. package/dist/idempotency/index.d.ts +5 -0
  145. package/dist/idempotency/index.js +210 -3
  146. package/dist/idempotency/no-idempotency.decorator.d.ts +8 -0
  147. package/dist/idempotency/postgres.store.d.ts +49 -0
  148. package/dist/idempotency/redis.store.d.ts +59 -0
  149. package/dist/index.cjs +19 -18
  150. package/dist/index.js +32 -31
  151. package/dist/invoicing/index.cjs +2 -2
  152. package/dist/invoicing/index.js +1 -1
  153. package/dist/jobs/defer-job.d.ts +10 -0
  154. package/dist/jobs/index.cjs +318 -0
  155. package/dist/jobs/index.d.ts +8 -0
  156. package/dist/jobs/index.js +318 -0
  157. package/dist/jobs/jobs-admin.controller.d.ts +18 -0
  158. package/dist/jobs/jobs.module.d.ts +33 -0
  159. package/dist/jobs/jobs.options.d.ts +62 -0
  160. package/dist/jobs/jobs.service.d.ts +53 -0
  161. package/dist/jobs/jobs.sql.d.ts +11 -0
  162. package/dist/media/index.cjs +14 -14
  163. package/dist/media/index.js +1 -1
  164. package/dist/meta/index.cjs +3 -3
  165. package/dist/meta/index.js +1 -1
  166. package/dist/notifications/index.cjs +375 -0
  167. package/dist/notifications/index.d.ts +8 -0
  168. package/dist/notifications/index.js +375 -0
  169. package/dist/notifications/memory.stores.d.ts +23 -0
  170. package/dist/notifications/notifications.controller.d.ts +11 -0
  171. package/dist/notifications/notifications.module.d.ts +31 -0
  172. package/dist/notifications/notifications.options.d.ts +33 -0
  173. package/dist/notifications/notifications.port.d.ts +97 -0
  174. package/dist/notifications/notifier.service.d.ts +31 -0
  175. package/dist/payments/index.cjs +7 -7
  176. package/dist/payments/index.js +1 -1
  177. package/dist/pinterest/index.cjs +3 -3
  178. package/dist/pinterest/index.js +1 -1
  179. package/dist/privacy/anonymizer.d.ts +14 -0
  180. package/dist/privacy/index.cjs +768 -0
  181. package/dist/privacy/index.d.ts +13 -0
  182. package/dist/privacy/index.js +768 -0
  183. package/dist/privacy/memory.store.d.ts +15 -0
  184. package/dist/privacy/privacy.module.d.ts +30 -0
  185. package/dist/privacy/privacy.options.d.ts +43 -0
  186. package/dist/privacy/privacy.port.d.ts +25 -0
  187. package/dist/privacy/privacy.service.d.ts +69 -0
  188. package/dist/privacy/privacy.types.d.ts +125 -0
  189. package/dist/privacy/sql.d.ts +7 -0
  190. package/dist/privacy/sql.store.d.ts +21 -0
  191. package/dist/privacy/zip.d.ts +23 -0
  192. package/dist/push/index.cjs +13 -13
  193. package/dist/push/index.js +5 -5
  194. package/dist/resilience/alert-channels.d.ts +39 -0
  195. package/dist/resilience/alert-errors.interceptor.d.ts +10 -0
  196. package/dist/resilience/alert-on-failure.decorator.d.ts +10 -0
  197. package/dist/resilience/alert.service.d.ts +77 -0
  198. package/dist/resilience/index.cjs +863 -0
  199. package/dist/resilience/index.d.ts +18 -0
  200. package/dist/resilience/index.js +863 -0
  201. package/dist/resilience/memory-alert-store.d.ts +26 -0
  202. package/dist/resilience/provider-health.controller.d.ts +14 -0
  203. package/dist/resilience/provider-unavailable.exception.d.ts +11 -0
  204. package/dist/resilience/resilience.module.d.ts +34 -0
  205. package/dist/resilience/resilience.options.d.ts +28 -0
  206. package/dist/resilience/resilience.types.d.ts +167 -0
  207. package/dist/resilience/resilient-fetch.d.ts +38 -0
  208. package/dist/resilience/runtime.d.ts +24 -0
  209. package/dist/resilience/typeorm/alert.entity.d.ts +21 -0
  210. package/dist/resilience/typeorm/index.cjs +102 -0
  211. package/dist/resilience/typeorm/index.d.ts +3 -0
  212. package/dist/resilience/typeorm/index.js +102 -0
  213. package/dist/resilience/typeorm/typeorm-alert-store.d.ts +39 -0
  214. package/dist/resilience/validate-destination.d.ts +63 -0
  215. package/dist/response/index.cjs +3 -3
  216. package/dist/response/index.js +2 -2
  217. package/dist/scheduling/cron-lock.service.d.ts +36 -0
  218. package/dist/scheduling/cron-unico.decorator.d.ts +27 -0
  219. package/dist/scheduling/fallback.store.d.ts +34 -0
  220. package/dist/scheduling/index.cjs +392 -0
  221. package/dist/scheduling/index.d.ts +18 -0
  222. package/dist/scheduling/index.js +392 -0
  223. package/dist/scheduling/lock-store.port.d.ts +19 -0
  224. package/dist/scheduling/memory.store.d.ts +15 -0
  225. package/dist/scheduling/redis.module.d.ts +31 -0
  226. package/dist/scheduling/redis.store.d.ts +24 -0
  227. package/dist/scheduling/scheduling.module.d.ts +24 -0
  228. package/dist/scheduling/scheduling.options.d.ts +27 -0
  229. package/dist/scheduling/sql.store.d.ts +26 -0
  230. package/dist/secrets/index.cjs +274 -0
  231. package/dist/secrets/index.d.ts +8 -0
  232. package/dist/secrets/index.js +274 -0
  233. package/dist/secrets/secrets.errors.d.ts +6 -0
  234. package/dist/secrets/secrets.module.d.ts +21 -0
  235. package/dist/secrets/secrets.options.d.ts +32 -0
  236. package/dist/secrets/secrets.service.d.ts +54 -0
  237. package/dist/secrets/secrets.transformer.d.ts +33 -0
  238. package/dist/security/hash.d.ts +8 -0
  239. package/dist/security/index.cjs +119 -2
  240. package/dist/security/index.d.ts +5 -0
  241. package/dist/security/index.js +119 -2
  242. package/dist/security/mask.d.ts +22 -0
  243. package/dist/security/signed-grant.d.ts +30 -0
  244. package/dist/storage/index.cjs +2 -2
  245. package/dist/storage/index.js +1 -1
  246. package/dist/stripe/index.cjs +7 -7
  247. package/dist/stripe/index.js +1 -1
  248. package/dist/telegram/index.cjs +2 -2
  249. package/dist/telegram/index.js +1 -1
  250. package/dist/tenancy/app-role.d.ts +24 -0
  251. package/dist/tenancy/db-helpers.d.ts +12 -0
  252. package/dist/tenancy/index.cjs +205 -0
  253. package/dist/tenancy/index.d.ts +14 -0
  254. package/dist/tenancy/index.js +205 -0
  255. package/dist/tenancy/pg/index.cjs +34 -0
  256. package/dist/tenancy/pg/index.d.ts +2 -0
  257. package/dist/tenancy/pg/index.js +34 -0
  258. package/dist/tenancy/pg/with-tenant.d.ts +23 -0
  259. package/dist/tenancy/request-context.d.ts +18 -0
  260. package/dist/tenancy/rls-guardrail.d.ts +38 -0
  261. package/dist/tenancy/scope.d.ts +5 -0
  262. package/dist/tenancy/tenancy.errors.d.ts +5 -0
  263. package/dist/tenancy/tenancy.middleware.d.ts +8 -0
  264. package/dist/tenancy/tenancy.module.d.ts +37 -0
  265. package/dist/tenancy/tenancy.options.d.ts +34 -0
  266. package/dist/tenancy/typeorm/index.cjs +41 -0
  267. package/dist/tenancy/typeorm/index.d.ts +2 -0
  268. package/dist/tenancy/typeorm/index.js +41 -0
  269. package/dist/tenancy/typeorm/with-tenant.d.ts +23 -0
  270. package/dist/tiktok/index.cjs +3 -3
  271. package/dist/tiktok/index.js +1 -1
  272. package/dist/tracking/index.cjs +3 -3
  273. package/dist/tracking/index.js +2 -2
  274. package/dist/umami/index.cjs +4 -4
  275. package/dist/umami/index.js +1 -1
  276. package/dist/whatsapp/index.cjs +2 -2
  277. package/dist/whatsapp/index.js +1 -1
  278. package/package.json +107 -2
@@ -7,7 +7,7 @@ import "../chunk-VVMRZEIW.js";
7
7
  import {
8
8
  __decorateClass,
9
9
  __decorateParam
10
- } from "../chunk-4MGIQFAJ.js";
10
+ } from "../chunk-D3DDJWUD.js";
11
11
 
12
12
  // src/idempotency/idempotency.port.ts
13
13
  var IDEMPOTENCY_STORE = /* @__PURE__ */ Symbol("IDEMPOTENCY_STORE");
@@ -60,6 +60,13 @@ import {
60
60
  } from "@nestjs/common";
61
61
  import { from, of } from "rxjs";
62
62
  import { catchError, concatMap, switchMap } from "rxjs/operators";
63
+
64
+ // src/idempotency/no-idempotency.decorator.ts
65
+ import { SetMetadata } from "@nestjs/common";
66
+ var NO_IDEMPOTENCY_KEY = "nestkit:no-idempotency";
67
+ var NoIdempotency = () => SetMetadata(NO_IDEMPOTENCY_KEY, true);
68
+
69
+ // src/idempotency/idempotency.interceptor.ts
63
70
  var DEFAULT_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
64
71
  var DEFAULT_TTL_MS = 24 * 60 * 60 * 1e3;
65
72
  function headerOf(request, name) {
@@ -85,6 +92,7 @@ var IdempotencyInterceptor = class {
85
92
  const http = context.switchToHttp();
86
93
  const request = http.getRequest();
87
94
  const response = http.getResponse();
95
+ if (this.isExcluded(context, request)) return next.handle();
88
96
  const methods = this.options.methods ?? DEFAULT_METHODS;
89
97
  const method = String(request?.method ?? "GET").toUpperCase();
90
98
  if (!methods.includes(method)) return next.handle();
@@ -101,7 +109,8 @@ var IdempotencyInterceptor = class {
101
109
  return next.handle();
102
110
  }
103
111
  const ttlMs = this.options.ttlMs ?? DEFAULT_TTL_MS;
104
- const scope = this.options.scope ? this.options.scope(request) : request?.user?.sub;
112
+ const scopeFn = this.options.scopeBy ?? this.options.scope;
113
+ const scope = scopeFn ? scopeFn(request) : request?.user?.sub;
105
114
  const storeKey = `${scope ?? "anonymous"}:${key}`;
106
115
  const path = request?.originalUrl ?? request?.url ?? "";
107
116
  const fingerprint = createHash("sha256").update(`${method} ${path} ${stableStringify(request?.body ?? null)}`).digest("hex");
@@ -126,6 +135,11 @@ var IdempotencyInterceptor = class {
126
135
  // yet is not replayable, and the retry this protects against is
127
136
  // exactly the one that arrives immediately.
128
137
  concatMap(async (body) => {
138
+ const max = this.options.maxResponseBytes;
139
+ if (max !== void 0 && Buffer.byteLength(JSON.stringify(body ?? null), "utf8") > max) {
140
+ await this.store.release(storeKey);
141
+ return body;
142
+ }
129
143
  await this.store.complete(
130
144
  storeKey,
131
145
  { status: Number(response?.statusCode ?? 200), body, fingerprint, completedAt: /* @__PURE__ */ new Date() },
@@ -144,6 +158,19 @@ var IdempotencyInterceptor = class {
144
158
  })
145
159
  );
146
160
  }
161
+ isExcluded(context, request) {
162
+ const handler = typeof context.getHandler === "function" ? context.getHandler() : void 0;
163
+ const klass = typeof context.getClass === "function" ? context.getClass() : void 0;
164
+ if (handler && Reflect.getMetadata(NO_IDEMPOTENCY_KEY, handler)) return true;
165
+ if (klass && Reflect.getMetadata(NO_IDEMPOTENCY_KEY, klass)) return true;
166
+ const patterns = this.options.excludeRoutes;
167
+ if (!patterns?.length) return false;
168
+ const path = String(request?.originalUrl ?? request?.url ?? "").split("?")[0];
169
+ return patterns.some((re) => {
170
+ re.lastIndex = 0;
171
+ return re.test(path);
172
+ });
173
+ }
147
174
  mismatch(headerName) {
148
175
  return new ValidationAppException(
149
176
  `This ${headerName} was already used for a different request`,
@@ -198,10 +225,190 @@ IdempotencyModule = __decorateClass([
198
225
  Global(),
199
226
  Module({})
200
227
  ], IdempotencyModule);
228
+
229
+ // src/idempotency/postgres.store.ts
230
+ var IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?$/;
231
+ function checkTable(table) {
232
+ if (!IDENTIFIER.test(table)) throw new Error(`PostgresIdempotencyStore: invalid table name "${table}"`);
233
+ return table;
234
+ }
235
+ function rowsOf(result) {
236
+ if (Array.isArray(result)) return result.length === 2 && Array.isArray(result[0]) ? result[0] : result;
237
+ const rows = result?.rows;
238
+ return Array.isArray(rows) ? rows : [];
239
+ }
240
+ var PostgresIdempotencyStore = class _PostgresIdempotencyStore {
241
+ constructor(options) {
242
+ this.calls = 0;
243
+ this.table = checkTable(options.table ?? "idempotency_key");
244
+ const { pool } = options;
245
+ if (options.query) this.query = options.query;
246
+ else if (pool) this.query = (sql, params) => pool.query(sql, params);
247
+ else throw new Error("PostgresIdempotencyStore: pass `pool` or `query`");
248
+ this.maxBytes = options.maxBytes;
249
+ this.cleanupEvery = options.cleanupEvery ?? 100;
250
+ }
251
+ static createTableSql(table = "idempotency_key") {
252
+ const t = checkTable(table);
253
+ const idx = `${t.replace(".", "_")}_expires_idx`;
254
+ return `CREATE TABLE IF NOT EXISTS ${t} (
255
+ key text PRIMARY KEY,
256
+ fingerprint text NOT NULL,
257
+ status integer,
258
+ body jsonb,
259
+ completed_at timestamptz,
260
+ expires_at timestamptz NOT NULL
261
+ );
262
+ CREATE INDEX IF NOT EXISTS ${idx} ON ${t} (expires_at)`;
263
+ }
264
+ async ensureTable() {
265
+ for (const statement of _PostgresIdempotencyStore.createTableSql(this.table).split(";\n")) {
266
+ await this.query(statement, []);
267
+ }
268
+ }
269
+ async begin(key, fingerprint, ttlMs) {
270
+ await this.maybeCleanup();
271
+ const claimed = rowsOf(
272
+ await this.query(
273
+ `INSERT INTO ${this.table} (key, fingerprint, expires_at)
274
+ VALUES ($1, $2, now() + make_interval(secs => $3::double precision / 1000))
275
+ ON CONFLICT (key) DO UPDATE
276
+ SET fingerprint = EXCLUDED.fingerprint, status = NULL, body = NULL,
277
+ completed_at = NULL, expires_at = EXCLUDED.expires_at
278
+ WHERE ${this.table}.expires_at <= now()
279
+ RETURNING key`,
280
+ [key, fingerprint, ttlMs]
281
+ )
282
+ );
283
+ if (claimed.length > 0) return { state: "claimed" };
284
+ const found = rowsOf(
285
+ await this.query(
286
+ `SELECT fingerprint, status, body, completed_at FROM ${this.table} WHERE key = $1`,
287
+ [key]
288
+ )
289
+ )[0];
290
+ if (!found) return this.begin(key, fingerprint, ttlMs);
291
+ if (found.status === null || found.status === void 0) {
292
+ return { state: "in_progress", fingerprint: found.fingerprint };
293
+ }
294
+ return {
295
+ state: "completed",
296
+ record: {
297
+ status: Number(found.status),
298
+ body: found.body,
299
+ fingerprint: found.fingerprint,
300
+ completedAt: new Date(found.completed_at)
301
+ }
302
+ };
303
+ }
304
+ async complete(key, record, ttlMs) {
305
+ const body = JSON.stringify(record.body ?? null);
306
+ if (this.maxBytes !== void 0 && Buffer.byteLength(body, "utf8") > this.maxBytes) {
307
+ await this.release(key);
308
+ return;
309
+ }
310
+ await this.query(
311
+ `UPDATE ${this.table}
312
+ SET status = $2, body = $3::jsonb, fingerprint = $4, completed_at = $5,
313
+ expires_at = now() + make_interval(secs => $6::double precision / 1000)
314
+ WHERE key = $1`,
315
+ [key, record.status, body, record.fingerprint, record.completedAt, ttlMs]
316
+ );
317
+ }
318
+ async release(key) {
319
+ await this.query(`DELETE FROM ${this.table} WHERE key = $1`, [key]);
320
+ }
321
+ /** Deletes every expired row now. Returns nothing; also runs on its own every `cleanupEvery` calls. */
322
+ async purgeExpired() {
323
+ await this.query(`DELETE FROM ${this.table} WHERE expires_at <= now()`, []);
324
+ }
325
+ async maybeCleanup() {
326
+ if (this.cleanupEvery <= 0) return;
327
+ this.calls += 1;
328
+ if (this.calls % this.cleanupEvery !== 0) return;
329
+ try {
330
+ await this.purgeExpired();
331
+ } catch {
332
+ }
333
+ }
334
+ };
335
+
336
+ // src/idempotency/redis.store.ts
337
+ var REDIS_IDEMPOTENCY_DEFAULT_MAX_BYTES = 256 * 1024;
338
+ var RedisIdempotencyStore = class {
339
+ constructor(options) {
340
+ this.inFallback = /* @__PURE__ */ new Set();
341
+ this.client = options.client;
342
+ this.prefix = options.prefix ?? "idem:";
343
+ this.maxBytes = options.maxBytes ?? REDIS_IDEMPOTENCY_DEFAULT_MAX_BYTES;
344
+ this.onError = options.onError;
345
+ this.fallback = options.fallback;
346
+ }
347
+ async begin(key, fingerprint, ttlMs) {
348
+ try {
349
+ const raw = await this.client.reclamarOLeer(
350
+ this.prefix + key,
351
+ JSON.stringify({ f: fingerprint }),
352
+ ttlMs
353
+ );
354
+ if (raw === null || raw === void 0) return { state: "claimed" };
355
+ const entry = JSON.parse(raw);
356
+ if (entry.r) {
357
+ return {
358
+ state: "completed",
359
+ record: {
360
+ status: entry.r.status,
361
+ body: entry.r.body,
362
+ fingerprint: entry.f,
363
+ completedAt: new Date(entry.r.completedAt)
364
+ }
365
+ };
366
+ }
367
+ return { state: "in_progress", fingerprint: entry.f };
368
+ } catch (error) {
369
+ if (!this.fallback) throw error;
370
+ this.onError?.(error);
371
+ const result = await this.fallback.begin(key, fingerprint, ttlMs);
372
+ if (result.state === "claimed") this.inFallback.add(key);
373
+ return result;
374
+ }
375
+ }
376
+ async complete(key, record, ttlMs) {
377
+ if (this.fallback && this.inFallback.delete(key)) return this.fallback.complete(key, record, ttlMs);
378
+ const text = JSON.stringify({
379
+ f: record.fingerprint,
380
+ r: { status: record.status, body: record.body, completedAt: record.completedAt.toISOString() }
381
+ });
382
+ try {
383
+ if (Buffer.byteLength(text, "utf8") > this.maxBytes) {
384
+ await this.client.borrar(this.prefix + key);
385
+ return;
386
+ }
387
+ await this.client.fijar(this.prefix + key, text, ttlMs);
388
+ } catch (error) {
389
+ if (!this.fallback) throw error;
390
+ this.onError?.(error);
391
+ }
392
+ }
393
+ async release(key) {
394
+ if (this.fallback && this.inFallback.delete(key)) return this.fallback.release(key);
395
+ try {
396
+ await this.client.borrar(this.prefix + key);
397
+ } catch (error) {
398
+ if (!this.fallback) throw error;
399
+ this.onError?.(error);
400
+ }
401
+ }
402
+ };
201
403
  export {
202
404
  IDEMPOTENCY_OPTIONS,
203
405
  IDEMPOTENCY_STORE,
204
406
  IdempotencyInterceptor,
205
407
  IdempotencyModule,
206
- MemoryIdempotencyStore
408
+ MemoryIdempotencyStore,
409
+ NO_IDEMPOTENCY_KEY,
410
+ NoIdempotency,
411
+ PostgresIdempotencyStore,
412
+ REDIS_IDEMPOTENCY_DEFAULT_MAX_BYTES,
413
+ RedisIdempotencyStore
207
414
  };
@@ -0,0 +1,8 @@
1
+ /** Metadata key read by the interceptor. */
2
+ export declare const NO_IDEMPOTENCY_KEY = "nestkit:no-idempotency";
3
+ /**
4
+ * Opts a handler (or a whole controller) out of idempotency, whatever the
5
+ * client sends. For endpoints whose answer is a credential — a session, a
6
+ * device token — which must never be parked in a store for the TTL.
7
+ */
8
+ export declare const NoIdempotency: () => MethodDecorator & ClassDecorator;
@@ -0,0 +1,49 @@
1
+ import type { BeginResult, IdempotencyRecord, IdempotencyStorePort } from './idempotency.port.js';
2
+ /** Minimal SQL runner: `(sql, params) => rows` — a `pg` Pool/Client adapter, TypeORM's `DataSource.query`, etc. Postgres syntax, `$n` params. */
3
+ export type IdempotencyQuery = (sql: string, params: unknown[]) => Promise<unknown>;
4
+ /** Structural `pg` Pool/Client: only `query` is used, so `pg` is never imported. */
5
+ export interface IdempotencyPgPool {
6
+ query(sql: string, params?: unknown[]): Promise<{
7
+ rows: any[];
8
+ }>;
9
+ }
10
+ export interface PostgresIdempotencyStoreOptions {
11
+ /** Table name (optionally `schema.table`). Defaults to `idempotency_key`. */
12
+ table?: string;
13
+ /** A `pg` Pool or Client. */
14
+ pool?: IdempotencyPgPool;
15
+ /** Alternative to `pool`. One of the two is required. */
16
+ query?: IdempotencyQuery;
17
+ /** Largest answer kept, in bytes of its JSON; a bigger one is released instead. Unlimited by default. */
18
+ maxBytes?: number;
19
+ /** Every N-th `begin` deletes expired rows (best effort). Defaults to 100; 0 turns it off. */
20
+ cleanupEvery?: number;
21
+ }
22
+ /**
23
+ * Idempotency keys in Postgres, shared by every instance.
24
+ *
25
+ * `begin` is one atomic `INSERT … ON CONFLICT DO UPDATE … WHERE expires_at <= now()`:
26
+ * the row is ours if it is new or expired; otherwise nothing is returned and a
27
+ * second `SELECT` reads what is there. Expired rows are also swept every
28
+ * `cleanupEvery` calls so the table does not grow forever (an index on
29
+ * `expires_at` keeps the sweep cheap).
30
+ *
31
+ * Create the table with `PostgresIdempotencyStore.createTableSql()` in a
32
+ * migration, or call `ensureTable()` once at boot.
33
+ */
34
+ export declare class PostgresIdempotencyStore implements IdempotencyStorePort {
35
+ private readonly table;
36
+ private readonly query;
37
+ private readonly maxBytes?;
38
+ private readonly cleanupEvery;
39
+ private calls;
40
+ constructor(options: PostgresIdempotencyStoreOptions);
41
+ static createTableSql(table?: string): string;
42
+ ensureTable(): Promise<void>;
43
+ begin(key: string, fingerprint: string, ttlMs: number): Promise<BeginResult>;
44
+ complete(key: string, record: IdempotencyRecord, ttlMs: number): Promise<void>;
45
+ release(key: string): Promise<void>;
46
+ /** Deletes every expired row now. Returns nothing; also runs on its own every `cleanupEvery` calls. */
47
+ purgeExpired(): Promise<void>;
48
+ private maybeCleanup;
49
+ }
@@ -0,0 +1,59 @@
1
+ import type { BeginResult, IdempotencyRecord, IdempotencyStorePort } from './idempotency.port.js';
2
+ /**
3
+ * Structural Redis client: the three atomic operations this store needs, so
4
+ * neither `ioredis` nor `redis` is imported. Adapt your client to it:
5
+ *
6
+ * ```ts
7
+ * const client: RedisIdempotencyClient = {
8
+ * reclamarOLeer: (key, value, ttlMs) => redis.set(key, value, 'PX', ttlMs, 'NX', 'GET'),
9
+ * fijar: (key, value, ttlMs) => redis.set(key, value, 'PX', ttlMs).then(() => undefined),
10
+ * borrar: (key) => redis.del(key).then(() => undefined),
11
+ * };
12
+ * ```
13
+ */
14
+ export interface RedisIdempotencyClient {
15
+ /**
16
+ * `SET key value NX PX ttl GET` in ONE command (Redis 7+): claims the key if
17
+ * absent and returns `null`, otherwise returns what was stored and leaves it
18
+ * untouched. A separate GET + SET would lose the race this module exists for.
19
+ */
20
+ reclamarOLeer(key: string, value: string, ttlMs: number): Promise<string | null>;
21
+ /** `SET key value PX ttl` (overwrite). */
22
+ fijar(key: string, value: string, ttlMs: number): Promise<void>;
23
+ /** `DEL key`. */
24
+ borrar(key: string): Promise<void>;
25
+ }
26
+ export interface RedisIdempotencyStoreOptions {
27
+ client: RedisIdempotencyClient;
28
+ /** Key prefix. Defaults to `idem:`. */
29
+ prefix?: string;
30
+ /** Largest answer kept, in bytes; a bigger one is released instead. Defaults to 256 KB. */
31
+ maxBytes?: number;
32
+ /** Called when Redis throws; the request is then served from `fallback` and never rejected. */
33
+ onError?: (error: unknown) => void;
34
+ /** Used while Redis is down. Defaults to none: a Redis failure then propagates. */
35
+ fallback?: IdempotencyStorePort;
36
+ }
37
+ export declare const REDIS_IDEMPOTENCY_DEFAULT_MAX_BYTES: number;
38
+ /**
39
+ * Idempotency keys in Redis, shared between instances.
40
+ *
41
+ * Commands per request (Upstash bills per command): first time = 2 (claim +
42
+ * store answer); replay = 1; handler error = 2 (claim + delete).
43
+ *
44
+ * With a `fallback`, a Redis outage degrades to that store instead of
45
+ * rejecting the request (a sale is never blocked by Redis); keys claimed there
46
+ * are completed and released there too.
47
+ */
48
+ export declare class RedisIdempotencyStore implements IdempotencyStorePort {
49
+ private readonly client;
50
+ private readonly prefix;
51
+ private readonly maxBytes;
52
+ private readonly onError?;
53
+ private readonly fallback?;
54
+ private readonly inFallback;
55
+ constructor(options: RedisIdempotencyStoreOptions);
56
+ begin(key: string, fingerprint: string, ttlMs: number): Promise<BeginResult>;
57
+ complete(key: string, record: IdempotencyRecord, ttlMs: number): Promise<void>;
58
+ release(key: string): Promise<void>;
59
+ }
package/dist/index.cjs CHANGED
@@ -3,73 +3,74 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkRF75KC63cjs = require('./chunk-RF75KC63.cjs');
6
+ var _chunk47IYXZHWcjs = require('./chunk-47IYXZHW.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
- var _chunkSPTDXUEDcjs = require('./chunk-SPTDXUED.cjs');
11
+ var _chunkURLDTS2Qcjs = require('./chunk-URLDTS2Q.cjs');
12
12
 
13
13
 
14
14
 
15
15
 
16
- var _chunkHVHYZXBBcjs = require('./chunk-HVHYZXBB.cjs');
16
+ var _chunkKNU5RN3Ocjs = require('./chunk-KNU5RN3O.cjs');
17
+ require('./chunk-H2EHN366.cjs');
17
18
 
18
19
 
19
20
  var _chunkQS2W5XCQcjs = require('./chunk-QS2W5XCQ.cjs');
20
- require('./chunk-H2EHN366.cjs');
21
+ require('./chunk-7SOM7EZP.cjs');
21
22
 
22
23
 
23
24
 
24
25
 
25
- var _chunk52IOOHNXcjs = require('./chunk-52IOOHNX.cjs');
26
- require('./chunk-W2T2VFLC.cjs');
27
26
 
28
27
 
29
- var _chunkALIKVFOVcjs = require('./chunk-ALIKVFOV.cjs');
28
+ var _chunkFDZQCLLKcjs = require('./chunk-FDZQCLLK.cjs');
30
29
 
31
30
 
32
- var _chunk3AUOOEQOcjs = require('./chunk-3AUOOEQO.cjs');
33
- require('./chunk-7SOM7EZP.cjs');
31
+ var _chunkJRFE7NSOcjs = require('./chunk-JRFE7NSO.cjs');
34
32
 
35
33
 
34
+ var _chunkF77X4QUNcjs = require('./chunk-F77X4QUN.cjs');
36
35
 
37
36
 
37
+ var _chunkJJKGQNGDcjs = require('./chunk-JJKGQNGD.cjs');
38
+ require('./chunk-IVWPA6QH.cjs');
38
39
 
39
40
 
40
- var _chunkHDFPSA2Vcjs = require('./chunk-HDFPSA2V.cjs');
41
41
 
42
42
 
43
- var _chunkLSDY6ETGcjs = require('./chunk-LSDY6ETG.cjs');
43
+ var _chunkAXMW5JF7cjs = require('./chunk-AXMW5JF7.cjs');
44
44
 
45
45
 
46
- var _chunkQ5Y33L7Bcjs = require('./chunk-Q5Y33L7B.cjs');
47
46
 
48
47
 
48
+ var _chunkKQPJCVN3cjs = require('./chunk-KQPJCVN3.cjs');
49
49
 
50
50
 
51
51
 
52
52
 
53
- var _chunkAPUFKA4Kcjs = require('./chunk-APUFKA4K.cjs');
53
+ var _chunkY72D5L6Icjs = require('./chunk-Y72D5L6I.cjs');
54
+ require('./chunk-VALDHJOO.cjs');
54
55
 
55
56
 
57
+ var _chunkSDWHKPXIcjs = require('./chunk-SDWHKPXI.cjs');
56
58
 
57
59
 
58
- var _chunkAXMW5JF7cjs = require('./chunk-AXMW5JF7.cjs');
59
60
 
60
61
 
61
62
 
62
63
 
63
- var _chunkY72D5L6Icjs = require('./chunk-Y72D5L6I.cjs');
64
+ var _chunkHDFPSA2Vcjs = require('./chunk-HDFPSA2V.cjs');
64
65
 
65
66
 
66
- var _chunkSDWHKPXIcjs = require('./chunk-SDWHKPXI.cjs');
67
+ var _chunkQ5Y33L7Bcjs = require('./chunk-Q5Y33L7B.cjs');
67
68
 
68
69
 
69
70
 
70
71
 
71
72
  var _chunkPNK5WMPPcjs = require('./chunk-PNK5WMPP.cjs');
72
- require('./chunk-2REOCMUD.cjs');
73
+ require('./chunk-LRX7AMSS.cjs');
73
74
 
74
75
 
75
76
 
@@ -108,4 +109,4 @@ require('./chunk-2REOCMUD.cjs');
108
109
 
109
110
 
110
111
 
111
- exports.AppException = _chunkQ5Y33L7Bcjs.AppException; exports.BaseCrudService = _chunk52IOOHNXcjs.BaseCrudService; exports.BaseResponseDto = _chunkQS2W5XCQcjs.BaseResponseDto; exports.ConflictAppException = _chunkHDFPSA2Vcjs.ConflictAppException; exports.ForbiddenAppException = _chunkHDFPSA2Vcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunkLSDY6ETGcjs.GlobalExceptionFilter; exports.I18nInterceptor = _chunkAPUFKA4Kcjs.I18nInterceptor; exports.I18nMessage = _chunkPNK5WMPPcjs.I18nMessage; exports.I18nModule = _chunkAPUFKA4Kcjs.I18nModule; exports.ListQuery = _chunk52IOOHNXcjs.ListQuery; exports.NestI18nTranslator = _chunkAPUFKA4Kcjs.NestI18nTranslator; exports.NotFoundAppException = _chunkHDFPSA2Vcjs.NotFoundAppException; exports.PG_POOL = _chunkRF75KC63cjs.PG_POOL; exports.PgModule = _chunkRF75KC63cjs.PgModule; exports.REQUEST_ID_HEADER = _chunkHVHYZXBBcjs.REQUEST_ID_HEADER; exports.RequestContext = _chunkSDWHKPXIcjs.RequestContext; exports.RequestIdMiddleware = _chunkHVHYZXBBcjs.RequestIdMiddleware; exports.ResponseInterceptor = _chunk3AUOOEQOcjs.ResponseInterceptor; exports.SUPABASE_ANON_CLIENT = _chunkSPTDXUEDcjs.SUPABASE_ANON_CLIENT; exports.SUPABASE_SERVICE_ROLE_CLIENT = _chunkSPTDXUEDcjs.SUPABASE_SERVICE_ROLE_CLIENT; exports.SupabaseModule = _chunkSPTDXUEDcjs.SupabaseModule; exports.TrackingModule = _chunkHVHYZXBBcjs.TrackingModule; exports.UnauthorizedAppException = _chunkHDFPSA2Vcjs.UnauthorizedAppException; exports.ValidationAppException = _chunkHDFPSA2Vcjs.ValidationAppException; exports.applyNestKitDefaults = _chunkALIKVFOVcjs.applyNestKitDefaults; exports.buildPageMeta = _chunkY72D5L6Icjs.buildPageMeta; exports.createCrudController = _chunk52IOOHNXcjs.createCrudController; exports.currentLanguage = _chunkAXMW5JF7cjs.currentLanguage; exports.isI18nMessage = _chunkPNK5WMPPcjs.isI18nMessage; exports.isPaginated = _chunkY72D5L6Icjs.isPaginated; exports.matchLanguage = _chunkAPUFKA4Kcjs.matchLanguage; exports.paginated = _chunkY72D5L6Icjs.paginated; exports.t = _chunkPNK5WMPPcjs.t; exports.translate = _chunkAXMW5JF7cjs.translate; exports.translateDeep = _chunkAXMW5JF7cjs.translateDeep; exports.translateOr = _chunkAPUFKA4Kcjs.translateOr; exports.withTenantScope = _chunkRF75KC63cjs.withTenantScope;
112
+ exports.AppException = _chunkQ5Y33L7Bcjs.AppException; exports.BaseCrudService = _chunkKQPJCVN3cjs.BaseCrudService; exports.BaseResponseDto = _chunkQS2W5XCQcjs.BaseResponseDto; exports.ConflictAppException = _chunkHDFPSA2Vcjs.ConflictAppException; exports.ForbiddenAppException = _chunkHDFPSA2Vcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunkJJKGQNGDcjs.GlobalExceptionFilter; exports.I18nInterceptor = _chunkFDZQCLLKcjs.I18nInterceptor; exports.I18nMessage = _chunkPNK5WMPPcjs.I18nMessage; exports.I18nModule = _chunkFDZQCLLKcjs.I18nModule; exports.ListQuery = _chunkKQPJCVN3cjs.ListQuery; exports.NestI18nTranslator = _chunkFDZQCLLKcjs.NestI18nTranslator; exports.NotFoundAppException = _chunkHDFPSA2Vcjs.NotFoundAppException; exports.PG_POOL = _chunk47IYXZHWcjs.PG_POOL; exports.PgModule = _chunk47IYXZHWcjs.PgModule; exports.REQUEST_ID_HEADER = _chunkKNU5RN3Ocjs.REQUEST_ID_HEADER; exports.RequestContext = _chunkSDWHKPXIcjs.RequestContext; exports.RequestIdMiddleware = _chunkKNU5RN3Ocjs.RequestIdMiddleware; exports.ResponseInterceptor = _chunkF77X4QUNcjs.ResponseInterceptor; exports.SUPABASE_ANON_CLIENT = _chunkURLDTS2Qcjs.SUPABASE_ANON_CLIENT; exports.SUPABASE_SERVICE_ROLE_CLIENT = _chunkURLDTS2Qcjs.SUPABASE_SERVICE_ROLE_CLIENT; exports.SupabaseModule = _chunkURLDTS2Qcjs.SupabaseModule; exports.TrackingModule = _chunkKNU5RN3Ocjs.TrackingModule; exports.UnauthorizedAppException = _chunkHDFPSA2Vcjs.UnauthorizedAppException; exports.ValidationAppException = _chunkHDFPSA2Vcjs.ValidationAppException; exports.applyNestKitDefaults = _chunkJRFE7NSOcjs.applyNestKitDefaults; exports.buildPageMeta = _chunkY72D5L6Icjs.buildPageMeta; exports.createCrudController = _chunkKQPJCVN3cjs.createCrudController; exports.currentLanguage = _chunkAXMW5JF7cjs.currentLanguage; exports.isI18nMessage = _chunkPNK5WMPPcjs.isI18nMessage; exports.isPaginated = _chunkY72D5L6Icjs.isPaginated; exports.matchLanguage = _chunkFDZQCLLKcjs.matchLanguage; exports.paginated = _chunkY72D5L6Icjs.paginated; exports.t = _chunkPNK5WMPPcjs.t; exports.translate = _chunkAXMW5JF7cjs.translate; exports.translateDeep = _chunkAXMW5JF7cjs.translateDeep; exports.translateOr = _chunkFDZQCLLKcjs.translateOr; exports.withTenantScope = _chunk47IYXZHWcjs.withTenantScope;
package/dist/index.js CHANGED
@@ -3,73 +3,74 @@ import {
3
3
  PG_POOL,
4
4
  PgModule,
5
5
  withTenantScope
6
- } from "./chunk-VKOPDDCC.js";
6
+ } from "./chunk-ENZ7LQRE.js";
7
7
  import {
8
8
  SUPABASE_ANON_CLIENT,
9
9
  SUPABASE_SERVICE_ROLE_CLIENT,
10
10
  SupabaseModule
11
- } from "./chunk-PA24P76K.js";
11
+ } from "./chunk-45SW7FBE.js";
12
12
  import {
13
13
  REQUEST_ID_HEADER,
14
14
  RequestIdMiddleware,
15
15
  TrackingModule
16
- } from "./chunk-4PFAKLT3.js";
16
+ } from "./chunk-MUWHGBIB.js";
17
+ import "./chunk-ODPSIFOB.js";
17
18
  import {
18
19
  BaseResponseDto
19
20
  } from "./chunk-XX2HPTRU.js";
20
- import "./chunk-ODPSIFOB.js";
21
- import {
22
- BaseCrudService,
23
- ListQuery,
24
- createCrudController
25
- } from "./chunk-IFNYRZP2.js";
26
- import "./chunk-ZJMLEP5H.js";
27
- import {
28
- applyNestKitDefaults
29
- } from "./chunk-PFHHLB7B.js";
30
- import {
31
- ResponseInterceptor
32
- } from "./chunk-DYHSOULW.js";
33
21
  import "./chunk-DQYAIQQ5.js";
34
- import {
35
- ConflictAppException,
36
- ForbiddenAppException,
37
- NotFoundAppException,
38
- UnauthorizedAppException,
39
- ValidationAppException
40
- } from "./chunk-ZFIDAX7K.js";
41
- import {
42
- GlobalExceptionFilter
43
- } from "./chunk-2DUEQKOI.js";
44
- import {
45
- AppException
46
- } from "./chunk-M3GQDRWR.js";
47
22
  import {
48
23
  I18nInterceptor,
49
24
  I18nModule,
50
25
  NestI18nTranslator,
51
26
  matchLanguage,
52
27
  translateOr
53
- } from "./chunk-6RAPVLJM.js";
28
+ } from "./chunk-OTE77ONL.js";
29
+ import {
30
+ applyNestKitDefaults
31
+ } from "./chunk-UGAAJRPO.js";
32
+ import {
33
+ ResponseInterceptor
34
+ } from "./chunk-IGSNB5BX.js";
35
+ import {
36
+ GlobalExceptionFilter
37
+ } from "./chunk-5LVGCTJ3.js";
38
+ import "./chunk-WFCQDOSN.js";
54
39
  import {
55
40
  currentLanguage,
56
41
  translate,
57
42
  translateDeep
58
43
  } from "./chunk-X4PQJZ4G.js";
44
+ import {
45
+ BaseCrudService,
46
+ ListQuery,
47
+ createCrudController
48
+ } from "./chunk-OSRH6KYZ.js";
59
49
  import {
60
50
  buildPageMeta,
61
51
  isPaginated,
62
52
  paginated
63
53
  } from "./chunk-TCAMLNUZ.js";
54
+ import "./chunk-NJYLQDB3.js";
64
55
  import {
65
56
  RequestContext
66
57
  } from "./chunk-ETRUVZTJ.js";
58
+ import {
59
+ ConflictAppException,
60
+ ForbiddenAppException,
61
+ NotFoundAppException,
62
+ UnauthorizedAppException,
63
+ ValidationAppException
64
+ } from "./chunk-ZFIDAX7K.js";
65
+ import {
66
+ AppException
67
+ } from "./chunk-M3GQDRWR.js";
67
68
  import {
68
69
  I18nMessage,
69
70
  isI18nMessage,
70
71
  t
71
72
  } from "./chunk-VVMRZEIW.js";
72
- import "./chunk-4MGIQFAJ.js";
73
+ import "./chunk-D3DDJWUD.js";
73
74
  export {
74
75
  AppException,
75
76
  BaseCrudService,
@@ -7,7 +7,7 @@ var _chunkQ5Y33L7Bcjs = require('../chunk-Q5Y33L7B.cjs');
7
7
  require('../chunk-PNK5WMPP.cjs');
8
8
 
9
9
 
10
- var _chunk2REOCMUDcjs = require('../chunk-2REOCMUD.cjs');
10
+ var _chunkLRX7AMSScjs = require('../chunk-LRX7AMSS.cjs');
11
11
 
12
12
  // src/invoicing/invoicing.port.ts
13
13
  var INVOICING = /* @__PURE__ */ Symbol("INVOICING");
@@ -561,7 +561,7 @@ var InvoicingModule = class {
561
561
  };
562
562
  }
563
563
  };
564
- InvoicingModule = exports.InvoicingModule = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
564
+ InvoicingModule = exports.InvoicingModule = _chunkLRX7AMSScjs.__decorateClass.call(void 0, [
565
565
  _common.Global.call(void 0, ),
566
566
  _common.Module.call(void 0, {})
567
567
  ], InvoicingModule);
@@ -7,7 +7,7 @@ import {
7
7
  import "../chunk-VVMRZEIW.js";
8
8
  import {
9
9
  __decorateClass
10
- } from "../chunk-4MGIQFAJ.js";
10
+ } from "../chunk-D3DDJWUD.js";
11
11
 
12
12
  // src/invoicing/invoicing.port.ts
13
13
  var INVOICING = /* @__PURE__ */ Symbol("INVOICING");
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A handler throws this when a third party asked to wait (HTTP 429 with
3
+ * `Retry-After`): the job goes back to the queue for after that wait WITHOUT
4
+ * spending an attempt, up to `maxDeferrals`. A `null` wait means the provider
5
+ * did not say how long: the queue uses its own growing wait.
6
+ */
7
+ export declare class DeferJob extends Error {
8
+ readonly retryAfterMs: number | null;
9
+ constructor(retryAfterMs?: number | null, message?: string);
10
+ }