@miguelmorales13/nestkit 0.11.0 → 0.18.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.
- package/README.md +619 -35
- package/dist/audit/audit.module.d.ts +23 -0
- package/dist/audit/audit.options.d.ts +16 -0
- package/dist/audit/audit.port.d.ts +37 -0
- package/dist/audit/audit.service.d.ts +29 -0
- package/dist/audit/index.cjs +72 -0
- package/dist/audit/index.d.ts +7 -0
- package/dist/audit/index.js +72 -0
- package/dist/audit/sinks.d.ts +18 -0
- package/dist/auth/index.cjs +12 -10
- package/dist/auth/index.js +5 -3
- package/dist/auth/oauth/http.d.ts +10 -3
- package/dist/auth/oauth/index.cjs +189 -29
- package/dist/auth/oauth/index.d.ts +6 -4
- package/dist/auth/oauth/index.js +169 -9
- package/dist/auth/oauth/magic-link.dto.d.ts +6 -0
- package/dist/auth/oauth/memory-magic-link.store.d.ts +19 -0
- package/dist/auth/oauth/oauth-auth.service.d.ts +46 -5
- package/dist/auth/oauth/oauth.controller.d.ts +5 -1
- package/dist/auth/oauth/oauth.options.d.ts +34 -1
- package/dist/auth/oauth/oauth.ports.d.ts +38 -0
- package/dist/bootstrap/index.cjs +9 -6
- package/dist/bootstrap/index.js +8 -5
- package/dist/{chunk-TJHRABML.cjs → chunk-3AUOOEQO.cjs} +12 -7
- package/dist/{chunk-NVCI3CQI.cjs → chunk-4HHZFOVC.cjs} +10 -5
- package/dist/{chunk-EYURGACO.js → chunk-4PFAKLT3.js} +1 -1
- package/dist/chunk-52IOOHNX.cjs +205 -0
- package/dist/chunk-6RAPVLJM.js +212 -0
- package/dist/{chunk-7I2Y7V52.js → chunk-A2DGK4ZL.js} +26 -3
- package/dist/chunk-APUFKA4K.cjs +212 -0
- package/dist/chunk-AXMW5JF7.cjs +83 -0
- package/dist/{chunk-KDAA6GFF.js → chunk-DYHSOULW.js} +12 -7
- package/dist/chunk-ETRUVZTJ.js +43 -0
- package/dist/{chunk-54ZXIB5T.cjs → chunk-FNUZGYUF.cjs} +4 -4
- package/dist/{chunk-FDNGAYTZ.cjs → chunk-HDFPSA2V.cjs} +6 -6
- package/dist/{chunk-V2M75FN3.cjs → chunk-HVHYZXBB.cjs} +2 -2
- package/dist/chunk-IFNYRZP2.js +205 -0
- package/dist/{chunk-A3B2EY4V.js → chunk-IKXSVEJ7.js} +7 -2
- package/dist/{chunk-YFYHLYHN.js → chunk-M3GQDRWR.js} +7 -1
- package/dist/{chunk-J7TURDAL.cjs → chunk-MSTXS3MU.cjs} +28 -5
- package/dist/chunk-PNK5WMPP.cjs +30 -0
- package/dist/chunk-Q5Y33L7B.cjs +19 -0
- package/dist/{chunk-ZA56XBCK.cjs → chunk-SDWHKPXI.cjs} +23 -0
- package/dist/chunk-TCAMLNUZ.js +27 -0
- package/dist/{chunk-AOCF5QCZ.js → chunk-UNEVXCFW.js} +2 -2
- package/dist/chunk-VVMRZEIW.js +30 -0
- package/dist/chunk-W2T2VFLC.cjs +57 -0
- package/dist/chunk-X4PQJZ4G.js +83 -0
- package/dist/chunk-Y72D5L6I.cjs +27 -0
- package/dist/{chunk-ORWJ7LES.js → chunk-ZFIDAX7K.js} +1 -1
- package/dist/chunk-ZJMLEP5H.js +57 -0
- package/dist/crud/crud.controller.d.ts +3 -1
- package/dist/crud/crud.service.d.ts +63 -4
- package/dist/crud/index.cjs +7 -2
- package/dist/crud/index.d.ts +2 -1
- package/dist/crud/index.js +6 -1
- package/dist/crud/list-query.dto.d.ts +23 -0
- package/dist/crud/repository.port.d.ts +33 -1
- package/dist/errors/app.exception.d.ts +9 -1
- package/dist/errors/common.exceptions.d.ts +6 -5
- package/dist/errors/global-exception.filter.d.ts +9 -0
- package/dist/errors/index.cjs +8 -5
- package/dist/errors/index.js +9 -6
- package/dist/i18n/i18n.interceptor.d.ts +16 -0
- package/dist/i18n/i18n.module.d.ts +49 -3
- package/dist/i18n/index.cjs +26 -2
- package/dist/i18n/index.d.ts +8 -0
- package/dist/i18n/index.js +25 -1
- package/dist/i18n/locale.d.ts +53 -0
- package/dist/i18n/message.d.ts +36 -0
- package/dist/i18n/nestjs-i18n.translator.d.ts +9 -0
- package/dist/i18n/runtime.d.ts +55 -0
- package/dist/i18n/translator.port.d.ts +29 -0
- package/dist/idempotency/idempotency.interceptor.d.ts +35 -0
- package/dist/idempotency/idempotency.module.d.ts +27 -0
- package/dist/idempotency/idempotency.options.d.ts +29 -0
- package/dist/idempotency/idempotency.port.d.ts +43 -0
- package/dist/idempotency/index.cjs +207 -0
- package/dist/idempotency/index.d.ts +7 -0
- package/dist/idempotency/index.js +207 -0
- package/dist/idempotency/memory.store.d.ts +24 -0
- package/dist/index.cjs +48 -15
- package/dist/index.js +51 -18
- package/dist/invoicing/adapters/facturama.invoicing.d.ts +50 -0
- package/dist/invoicing/adapters/facturapi.invoicing.d.ts +35 -0
- package/dist/invoicing/amounts.d.ts +52 -0
- package/dist/invoicing/index.cjs +578 -0
- package/dist/invoicing/index.d.ts +11 -0
- package/dist/invoicing/index.js +578 -0
- package/dist/invoicing/invoicing.module.d.ts +42 -0
- package/dist/invoicing/invoicing.options.d.ts +51 -0
- package/dist/invoicing/invoicing.port.d.ts +156 -0
- package/dist/invoicing/lines.d.ts +21 -0
- package/dist/invoicing/provider-http.d.ts +21 -0
- package/dist/payments/adapters/clip.terminal.d.ts +101 -0
- package/dist/payments/adapters/mercadopago.terminal.d.ts +74 -0
- package/dist/payments/index.cjs +796 -0
- package/dist/payments/index.d.ts +12 -0
- package/dist/payments/index.js +796 -0
- package/dist/payments/money.d.ts +20 -0
- package/dist/payments/payments-webhook.controller.d.ts +30 -0
- package/dist/payments/payments.module.d.ts +45 -0
- package/dist/payments/payments.options.d.ts +84 -0
- package/dist/payments/payments.port.d.ts +174 -0
- package/dist/payments/provider-http.d.ts +26 -0
- package/dist/response/api-response.d.ts +7 -0
- package/dist/response/index.cjs +12 -4
- package/dist/response/index.d.ts +2 -0
- package/dist/response/index.js +12 -4
- package/dist/response/paginated.d.ts +25 -0
- package/dist/response/response.interceptor.d.ts +4 -0
- package/dist/stripe/index.cjs +4 -3
- package/dist/stripe/index.js +3 -2
- package/dist/tracking/index.cjs +3 -3
- package/dist/tracking/index.d.ts +1 -1
- package/dist/tracking/index.js +2 -2
- package/dist/tracking/request-context.d.ts +32 -0
- package/package.json +25 -3
- package/dist/chunk-3CLYZC3T.cjs +0 -104
- package/dist/chunk-EBO6UKHL.js +0 -20
- package/dist/chunk-IYUUYCP5.js +0 -36
- package/dist/chunk-JOVBJDJ2.js +0 -104
- package/dist/chunk-M3EL5O6T.cjs +0 -36
- package/dist/chunk-R7BVS6CI.cjs +0 -13
- /package/dist/{chunk-MR2IFCZE.cjs → chunk-H2EHN366.cjs} +0 -0
- /package/dist/{chunk-NAK4WDKS.js → chunk-ODPSIFOB.js} +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkHDFPSA2Vcjs = require('../chunk-HDFPSA2V.cjs');
|
|
5
|
+
require('../chunk-Q5Y33L7B.cjs');
|
|
6
|
+
require('../chunk-PNK5WMPP.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunk2REOCMUDcjs = require('../chunk-2REOCMUD.cjs');
|
|
11
|
+
|
|
12
|
+
// src/idempotency/idempotency.port.ts
|
|
13
|
+
var IDEMPOTENCY_STORE = /* @__PURE__ */ Symbol("IDEMPOTENCY_STORE");
|
|
14
|
+
|
|
15
|
+
// src/idempotency/idempotency.options.ts
|
|
16
|
+
var IDEMPOTENCY_OPTIONS = /* @__PURE__ */ Symbol("IDEMPOTENCY_OPTIONS");
|
|
17
|
+
|
|
18
|
+
// src/idempotency/memory.store.ts
|
|
19
|
+
var MemoryIdempotencyStore = class {
|
|
20
|
+
constructor(maxEntries = 1e4) {
|
|
21
|
+
this.maxEntries = maxEntries;
|
|
22
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
23
|
+
}
|
|
24
|
+
async begin(key, fingerprint, ttlMs) {
|
|
25
|
+
this.evictExpired();
|
|
26
|
+
const existing = this.entries.get(key);
|
|
27
|
+
if (existing) {
|
|
28
|
+
return existing.record ? { state: "completed", record: existing.record } : { state: "in_progress", fingerprint: existing.fingerprint };
|
|
29
|
+
}
|
|
30
|
+
if (this.entries.size >= this.maxEntries) {
|
|
31
|
+
const oldest = this.entries.keys().next();
|
|
32
|
+
if (!oldest.done) this.entries.delete(oldest.value);
|
|
33
|
+
}
|
|
34
|
+
this.entries.set(key, { fingerprint, expiresAt: Date.now() + ttlMs });
|
|
35
|
+
return { state: "claimed" };
|
|
36
|
+
}
|
|
37
|
+
async complete(key, record, ttlMs) {
|
|
38
|
+
this.entries.set(key, { fingerprint: record.fingerprint, expiresAt: Date.now() + ttlMs, record });
|
|
39
|
+
}
|
|
40
|
+
async release(key) {
|
|
41
|
+
this.entries.delete(key);
|
|
42
|
+
}
|
|
43
|
+
/** Visible for tests and for a health endpoint that wants to report size. */
|
|
44
|
+
get size() {
|
|
45
|
+
return this.entries.size;
|
|
46
|
+
}
|
|
47
|
+
evictExpired() {
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
for (const [key, entry] of this.entries) {
|
|
50
|
+
if (entry.expiresAt <= now) this.entries.delete(key);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/idempotency/idempotency.interceptor.ts
|
|
56
|
+
var _crypto = require('crypto');
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
var _common = require('@nestjs/common');
|
|
61
|
+
var _rxjs = require('rxjs');
|
|
62
|
+
var _operators = require('rxjs/operators');
|
|
63
|
+
var DEFAULT_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
|
|
64
|
+
var DEFAULT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
65
|
+
function headerOf(request, name) {
|
|
66
|
+
const value = _nullishCoalesce(_optionalChain([request, 'access', _ => _.headers, 'optionalAccess', _2 => _2[name]]), () => ( _optionalChain([request, 'access', _3 => _3.headers, 'optionalAccess', _4 => _4[name.toLowerCase()]])));
|
|
67
|
+
return Array.isArray(value) ? value[0] : value;
|
|
68
|
+
}
|
|
69
|
+
function stableStringify(value) {
|
|
70
|
+
if (value === null || typeof value !== "object") return _nullishCoalesce(JSON.stringify(value), () => ( "null"));
|
|
71
|
+
if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
|
|
72
|
+
const entries = Object.entries(value).sort(([a], [b]) => a < b ? -1 : 1);
|
|
73
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
|
|
74
|
+
}
|
|
75
|
+
function setHeader(response, name, value) {
|
|
76
|
+
if (typeof _optionalChain([response, 'optionalAccess', _5 => _5.header]) === "function") response.header(name, value);
|
|
77
|
+
else if (typeof _optionalChain([response, 'optionalAccess', _6 => _6.setHeader]) === "function") response.setHeader(name, value);
|
|
78
|
+
}
|
|
79
|
+
var IdempotencyInterceptor = class {
|
|
80
|
+
constructor(store, options = {}) {
|
|
81
|
+
this.store = store;
|
|
82
|
+
this.options = options;
|
|
83
|
+
}
|
|
84
|
+
intercept(context, next) {
|
|
85
|
+
const http = context.switchToHttp();
|
|
86
|
+
const request = http.getRequest();
|
|
87
|
+
const response = http.getResponse();
|
|
88
|
+
const methods = _nullishCoalesce(this.options.methods, () => ( DEFAULT_METHODS));
|
|
89
|
+
const method = String(_nullishCoalesce(_optionalChain([request, 'optionalAccess', _7 => _7.method]), () => ( "GET"))).toUpperCase();
|
|
90
|
+
if (!methods.includes(method)) return next.handle();
|
|
91
|
+
const headerName = _nullishCoalesce(this.options.headerName, () => ( "idempotency-key"));
|
|
92
|
+
const key = headerOf(request, headerName);
|
|
93
|
+
if (!key) {
|
|
94
|
+
if (this.options.require) {
|
|
95
|
+
throw new (0, _chunkHDFPSA2Vcjs.ValidationAppException)(
|
|
96
|
+
`This endpoint requires an ${headerName} header`,
|
|
97
|
+
{ header: headerName },
|
|
98
|
+
"IDEMPOTENCY_KEY_REQUIRED"
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return next.handle();
|
|
102
|
+
}
|
|
103
|
+
const ttlMs = _nullishCoalesce(this.options.ttlMs, () => ( DEFAULT_TTL_MS));
|
|
104
|
+
const scope = this.options.scope ? this.options.scope(request) : _optionalChain([request, 'optionalAccess', _8 => _8.user, 'optionalAccess', _9 => _9.sub]);
|
|
105
|
+
const storeKey = `${_nullishCoalesce(scope, () => ( "anonymous"))}:${key}`;
|
|
106
|
+
const path = _nullishCoalesce(_nullishCoalesce(_optionalChain([request, 'optionalAccess', _10 => _10.originalUrl]), () => ( _optionalChain([request, 'optionalAccess', _11 => _11.url]))), () => ( ""));
|
|
107
|
+
const fingerprint = _crypto.createHash.call(void 0, "sha256").update(`${method} ${path} ${stableStringify(_nullishCoalesce(_optionalChain([request, 'optionalAccess', _12 => _12.body]), () => ( null)))}`).digest("hex");
|
|
108
|
+
return _rxjs.from.call(void 0, this.store.begin(storeKey, fingerprint, ttlMs)).pipe(
|
|
109
|
+
_operators.switchMap.call(void 0, (begin) => {
|
|
110
|
+
if (begin.state === "completed") {
|
|
111
|
+
if (begin.record.fingerprint !== fingerprint) throw this.mismatch(headerName);
|
|
112
|
+
setHeader(response, "idempotent-replay", "true");
|
|
113
|
+
if (typeof _optionalChain([response, 'optionalAccess', _13 => _13.status]) === "function") response.status(begin.record.status);
|
|
114
|
+
return _rxjs.of.call(void 0, begin.record.body);
|
|
115
|
+
}
|
|
116
|
+
if (begin.state === "in_progress") {
|
|
117
|
+
if (begin.fingerprint !== fingerprint) throw this.mismatch(headerName);
|
|
118
|
+
throw new (0, _chunkHDFPSA2Vcjs.ConflictAppException)(
|
|
119
|
+
"A request with this idempotency key is still being processed",
|
|
120
|
+
{ key },
|
|
121
|
+
"IDEMPOTENCY_IN_PROGRESS"
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
return next.handle().pipe(
|
|
125
|
+
// Awaited, not fire-and-forget: an answer that has not been stored
|
|
126
|
+
// yet is not replayable, and the retry this protects against is
|
|
127
|
+
// exactly the one that arrives immediately.
|
|
128
|
+
_operators.concatMap.call(void 0, async (body) => {
|
|
129
|
+
await this.store.complete(
|
|
130
|
+
storeKey,
|
|
131
|
+
{ status: Number(_nullishCoalesce(_optionalChain([response, 'optionalAccess', _14 => _14.statusCode]), () => ( 200))), body, fingerprint, completedAt: /* @__PURE__ */ new Date() },
|
|
132
|
+
ttlMs
|
|
133
|
+
);
|
|
134
|
+
return body;
|
|
135
|
+
}),
|
|
136
|
+
_operators.catchError.call(void 0, (error) => {
|
|
137
|
+
return _rxjs.from.call(void 0, this.store.release(storeKey)).pipe(
|
|
138
|
+
_operators.switchMap.call(void 0, () => {
|
|
139
|
+
throw error;
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
})
|
|
143
|
+
);
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
mismatch(headerName) {
|
|
148
|
+
return new (0, _chunkHDFPSA2Vcjs.ValidationAppException)(
|
|
149
|
+
`This ${headerName} was already used for a different request`,
|
|
150
|
+
void 0,
|
|
151
|
+
"IDEMPOTENCY_KEY_REUSED"
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
IdempotencyInterceptor = exports.IdempotencyInterceptor = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
156
|
+
_common.Injectable.call(void 0, ),
|
|
157
|
+
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Inject.call(void 0, IDEMPOTENCY_STORE)),
|
|
158
|
+
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 1, _common.Inject.call(void 0, IDEMPOTENCY_OPTIONS))
|
|
159
|
+
], IdempotencyInterceptor);
|
|
160
|
+
|
|
161
|
+
// src/idempotency/idempotency.module.ts
|
|
162
|
+
|
|
163
|
+
var IdempotencyModule = class {
|
|
164
|
+
static forRoot(options = {}) {
|
|
165
|
+
const providers = [
|
|
166
|
+
{ provide: IDEMPOTENCY_OPTIONS, useValue: options },
|
|
167
|
+
{
|
|
168
|
+
provide: IDEMPOTENCY_STORE,
|
|
169
|
+
useFactory: () => _nullishCoalesce(options.store, () => ( new MemoryIdempotencyStore()))
|
|
170
|
+
},
|
|
171
|
+
IdempotencyInterceptor
|
|
172
|
+
];
|
|
173
|
+
return {
|
|
174
|
+
module: IdempotencyModule,
|
|
175
|
+
providers,
|
|
176
|
+
exports: [IDEMPOTENCY_STORE, IDEMPOTENCY_OPTIONS, IdempotencyInterceptor]
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
static forRootAsync(config) {
|
|
180
|
+
const providers = [
|
|
181
|
+
{ provide: IDEMPOTENCY_OPTIONS, useFactory: config.useFactory, inject: _nullishCoalesce(config.inject, () => ( [])) },
|
|
182
|
+
{
|
|
183
|
+
provide: IDEMPOTENCY_STORE,
|
|
184
|
+
useFactory: (options) => _nullishCoalesce(options.store, () => ( new MemoryIdempotencyStore())),
|
|
185
|
+
inject: [IDEMPOTENCY_OPTIONS]
|
|
186
|
+
},
|
|
187
|
+
IdempotencyInterceptor
|
|
188
|
+
];
|
|
189
|
+
return {
|
|
190
|
+
module: IdempotencyModule,
|
|
191
|
+
imports: _nullishCoalesce(config.imports, () => ( [])),
|
|
192
|
+
providers,
|
|
193
|
+
exports: [IDEMPOTENCY_STORE, IDEMPOTENCY_OPTIONS, IdempotencyInterceptor]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
IdempotencyModule = exports.IdempotencyModule = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
198
|
+
_common.Global.call(void 0, ),
|
|
199
|
+
_common.Module.call(void 0, {})
|
|
200
|
+
], IdempotencyModule);
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
exports.IDEMPOTENCY_OPTIONS = IDEMPOTENCY_OPTIONS; exports.IDEMPOTENCY_STORE = IDEMPOTENCY_STORE; exports.IdempotencyInterceptor = IdempotencyInterceptor; exports.IdempotencyModule = IdempotencyModule; exports.MemoryIdempotencyStore = MemoryIdempotencyStore;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { IDEMPOTENCY_STORE } from './idempotency.port.js';
|
|
2
|
+
export type { IdempotencyStorePort, IdempotencyRecord, BeginResult } from './idempotency.port.js';
|
|
3
|
+
export { IDEMPOTENCY_OPTIONS } from './idempotency.options.js';
|
|
4
|
+
export type { IdempotencyOptions } from './idempotency.options.js';
|
|
5
|
+
export { MemoryIdempotencyStore } from './memory.store.js';
|
|
6
|
+
export { IdempotencyInterceptor } from './idempotency.interceptor.js';
|
|
7
|
+
export { IdempotencyModule } from './idempotency.module.js';
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConflictAppException,
|
|
3
|
+
ValidationAppException
|
|
4
|
+
} from "../chunk-ZFIDAX7K.js";
|
|
5
|
+
import "../chunk-M3GQDRWR.js";
|
|
6
|
+
import "../chunk-VVMRZEIW.js";
|
|
7
|
+
import {
|
|
8
|
+
__decorateClass,
|
|
9
|
+
__decorateParam
|
|
10
|
+
} from "../chunk-4MGIQFAJ.js";
|
|
11
|
+
|
|
12
|
+
// src/idempotency/idempotency.port.ts
|
|
13
|
+
var IDEMPOTENCY_STORE = /* @__PURE__ */ Symbol("IDEMPOTENCY_STORE");
|
|
14
|
+
|
|
15
|
+
// src/idempotency/idempotency.options.ts
|
|
16
|
+
var IDEMPOTENCY_OPTIONS = /* @__PURE__ */ Symbol("IDEMPOTENCY_OPTIONS");
|
|
17
|
+
|
|
18
|
+
// src/idempotency/memory.store.ts
|
|
19
|
+
var MemoryIdempotencyStore = class {
|
|
20
|
+
constructor(maxEntries = 1e4) {
|
|
21
|
+
this.maxEntries = maxEntries;
|
|
22
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
23
|
+
}
|
|
24
|
+
async begin(key, fingerprint, ttlMs) {
|
|
25
|
+
this.evictExpired();
|
|
26
|
+
const existing = this.entries.get(key);
|
|
27
|
+
if (existing) {
|
|
28
|
+
return existing.record ? { state: "completed", record: existing.record } : { state: "in_progress", fingerprint: existing.fingerprint };
|
|
29
|
+
}
|
|
30
|
+
if (this.entries.size >= this.maxEntries) {
|
|
31
|
+
const oldest = this.entries.keys().next();
|
|
32
|
+
if (!oldest.done) this.entries.delete(oldest.value);
|
|
33
|
+
}
|
|
34
|
+
this.entries.set(key, { fingerprint, expiresAt: Date.now() + ttlMs });
|
|
35
|
+
return { state: "claimed" };
|
|
36
|
+
}
|
|
37
|
+
async complete(key, record, ttlMs) {
|
|
38
|
+
this.entries.set(key, { fingerprint: record.fingerprint, expiresAt: Date.now() + ttlMs, record });
|
|
39
|
+
}
|
|
40
|
+
async release(key) {
|
|
41
|
+
this.entries.delete(key);
|
|
42
|
+
}
|
|
43
|
+
/** Visible for tests and for a health endpoint that wants to report size. */
|
|
44
|
+
get size() {
|
|
45
|
+
return this.entries.size;
|
|
46
|
+
}
|
|
47
|
+
evictExpired() {
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
for (const [key, entry] of this.entries) {
|
|
50
|
+
if (entry.expiresAt <= now) this.entries.delete(key);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/idempotency/idempotency.interceptor.ts
|
|
56
|
+
import { createHash } from "crypto";
|
|
57
|
+
import {
|
|
58
|
+
Inject,
|
|
59
|
+
Injectable
|
|
60
|
+
} from "@nestjs/common";
|
|
61
|
+
import { from, of } from "rxjs";
|
|
62
|
+
import { catchError, concatMap, switchMap } from "rxjs/operators";
|
|
63
|
+
var DEFAULT_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
|
|
64
|
+
var DEFAULT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
65
|
+
function headerOf(request, name) {
|
|
66
|
+
const value = request.headers?.[name] ?? request.headers?.[name.toLowerCase()];
|
|
67
|
+
return Array.isArray(value) ? value[0] : value;
|
|
68
|
+
}
|
|
69
|
+
function stableStringify(value) {
|
|
70
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
|
|
71
|
+
if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
|
|
72
|
+
const entries = Object.entries(value).sort(([a], [b]) => a < b ? -1 : 1);
|
|
73
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
|
|
74
|
+
}
|
|
75
|
+
function setHeader(response, name, value) {
|
|
76
|
+
if (typeof response?.header === "function") response.header(name, value);
|
|
77
|
+
else if (typeof response?.setHeader === "function") response.setHeader(name, value);
|
|
78
|
+
}
|
|
79
|
+
var IdempotencyInterceptor = class {
|
|
80
|
+
constructor(store, options = {}) {
|
|
81
|
+
this.store = store;
|
|
82
|
+
this.options = options;
|
|
83
|
+
}
|
|
84
|
+
intercept(context, next) {
|
|
85
|
+
const http = context.switchToHttp();
|
|
86
|
+
const request = http.getRequest();
|
|
87
|
+
const response = http.getResponse();
|
|
88
|
+
const methods = this.options.methods ?? DEFAULT_METHODS;
|
|
89
|
+
const method = String(request?.method ?? "GET").toUpperCase();
|
|
90
|
+
if (!methods.includes(method)) return next.handle();
|
|
91
|
+
const headerName = this.options.headerName ?? "idempotency-key";
|
|
92
|
+
const key = headerOf(request, headerName);
|
|
93
|
+
if (!key) {
|
|
94
|
+
if (this.options.require) {
|
|
95
|
+
throw new ValidationAppException(
|
|
96
|
+
`This endpoint requires an ${headerName} header`,
|
|
97
|
+
{ header: headerName },
|
|
98
|
+
"IDEMPOTENCY_KEY_REQUIRED"
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return next.handle();
|
|
102
|
+
}
|
|
103
|
+
const ttlMs = this.options.ttlMs ?? DEFAULT_TTL_MS;
|
|
104
|
+
const scope = this.options.scope ? this.options.scope(request) : request?.user?.sub;
|
|
105
|
+
const storeKey = `${scope ?? "anonymous"}:${key}`;
|
|
106
|
+
const path = request?.originalUrl ?? request?.url ?? "";
|
|
107
|
+
const fingerprint = createHash("sha256").update(`${method} ${path} ${stableStringify(request?.body ?? null)}`).digest("hex");
|
|
108
|
+
return from(this.store.begin(storeKey, fingerprint, ttlMs)).pipe(
|
|
109
|
+
switchMap((begin) => {
|
|
110
|
+
if (begin.state === "completed") {
|
|
111
|
+
if (begin.record.fingerprint !== fingerprint) throw this.mismatch(headerName);
|
|
112
|
+
setHeader(response, "idempotent-replay", "true");
|
|
113
|
+
if (typeof response?.status === "function") response.status(begin.record.status);
|
|
114
|
+
return of(begin.record.body);
|
|
115
|
+
}
|
|
116
|
+
if (begin.state === "in_progress") {
|
|
117
|
+
if (begin.fingerprint !== fingerprint) throw this.mismatch(headerName);
|
|
118
|
+
throw new ConflictAppException(
|
|
119
|
+
"A request with this idempotency key is still being processed",
|
|
120
|
+
{ key },
|
|
121
|
+
"IDEMPOTENCY_IN_PROGRESS"
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
return next.handle().pipe(
|
|
125
|
+
// Awaited, not fire-and-forget: an answer that has not been stored
|
|
126
|
+
// yet is not replayable, and the retry this protects against is
|
|
127
|
+
// exactly the one that arrives immediately.
|
|
128
|
+
concatMap(async (body) => {
|
|
129
|
+
await this.store.complete(
|
|
130
|
+
storeKey,
|
|
131
|
+
{ status: Number(response?.statusCode ?? 200), body, fingerprint, completedAt: /* @__PURE__ */ new Date() },
|
|
132
|
+
ttlMs
|
|
133
|
+
);
|
|
134
|
+
return body;
|
|
135
|
+
}),
|
|
136
|
+
catchError((error) => {
|
|
137
|
+
return from(this.store.release(storeKey)).pipe(
|
|
138
|
+
switchMap(() => {
|
|
139
|
+
throw error;
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
})
|
|
143
|
+
);
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
mismatch(headerName) {
|
|
148
|
+
return new ValidationAppException(
|
|
149
|
+
`This ${headerName} was already used for a different request`,
|
|
150
|
+
void 0,
|
|
151
|
+
"IDEMPOTENCY_KEY_REUSED"
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
IdempotencyInterceptor = __decorateClass([
|
|
156
|
+
Injectable(),
|
|
157
|
+
__decorateParam(0, Inject(IDEMPOTENCY_STORE)),
|
|
158
|
+
__decorateParam(1, Inject(IDEMPOTENCY_OPTIONS))
|
|
159
|
+
], IdempotencyInterceptor);
|
|
160
|
+
|
|
161
|
+
// src/idempotency/idempotency.module.ts
|
|
162
|
+
import { Global, Module } from "@nestjs/common";
|
|
163
|
+
var IdempotencyModule = class {
|
|
164
|
+
static forRoot(options = {}) {
|
|
165
|
+
const providers = [
|
|
166
|
+
{ provide: IDEMPOTENCY_OPTIONS, useValue: options },
|
|
167
|
+
{
|
|
168
|
+
provide: IDEMPOTENCY_STORE,
|
|
169
|
+
useFactory: () => options.store ?? new MemoryIdempotencyStore()
|
|
170
|
+
},
|
|
171
|
+
IdempotencyInterceptor
|
|
172
|
+
];
|
|
173
|
+
return {
|
|
174
|
+
module: IdempotencyModule,
|
|
175
|
+
providers,
|
|
176
|
+
exports: [IDEMPOTENCY_STORE, IDEMPOTENCY_OPTIONS, IdempotencyInterceptor]
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
static forRootAsync(config) {
|
|
180
|
+
const providers = [
|
|
181
|
+
{ provide: IDEMPOTENCY_OPTIONS, useFactory: config.useFactory, inject: config.inject ?? [] },
|
|
182
|
+
{
|
|
183
|
+
provide: IDEMPOTENCY_STORE,
|
|
184
|
+
useFactory: (options) => options.store ?? new MemoryIdempotencyStore(),
|
|
185
|
+
inject: [IDEMPOTENCY_OPTIONS]
|
|
186
|
+
},
|
|
187
|
+
IdempotencyInterceptor
|
|
188
|
+
];
|
|
189
|
+
return {
|
|
190
|
+
module: IdempotencyModule,
|
|
191
|
+
imports: config.imports ?? [],
|
|
192
|
+
providers,
|
|
193
|
+
exports: [IDEMPOTENCY_STORE, IDEMPOTENCY_OPTIONS, IdempotencyInterceptor]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
IdempotencyModule = __decorateClass([
|
|
198
|
+
Global(),
|
|
199
|
+
Module({})
|
|
200
|
+
], IdempotencyModule);
|
|
201
|
+
export {
|
|
202
|
+
IDEMPOTENCY_OPTIONS,
|
|
203
|
+
IDEMPOTENCY_STORE,
|
|
204
|
+
IdempotencyInterceptor,
|
|
205
|
+
IdempotencyModule,
|
|
206
|
+
MemoryIdempotencyStore
|
|
207
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BeginResult, IdempotencyRecord, IdempotencyStorePort } from './idempotency.port.js';
|
|
2
|
+
/**
|
|
3
|
+
* In-process store. Correct for a single instance, and **wrong the moment
|
|
4
|
+
* there are two**: each process would hold its own keys, so the same retry
|
|
5
|
+
* landing on a different replica runs the handler again — which is the exact
|
|
6
|
+
* double charge this is meant to prevent. Behind a load balancer, back it with
|
|
7
|
+
* Redis or a table instead.
|
|
8
|
+
*
|
|
9
|
+
* Bounded, like `media`'s store, because it lives in the process heap. Unlike
|
|
10
|
+
* `media`, it **evicts the oldest** rather than rejecting: an evicted key only
|
|
11
|
+
* costs the protection of a retry that probably already happened, while
|
|
12
|
+
* refusing new keys would stop the API from accepting work at all.
|
|
13
|
+
*/
|
|
14
|
+
export declare class MemoryIdempotencyStore implements IdempotencyStorePort {
|
|
15
|
+
private readonly maxEntries;
|
|
16
|
+
private readonly entries;
|
|
17
|
+
constructor(maxEntries?: number);
|
|
18
|
+
begin(key: string, fingerprint: string, ttlMs: number): Promise<BeginResult>;
|
|
19
|
+
complete(key: string, record: IdempotencyRecord, ttlMs: number): Promise<void>;
|
|
20
|
+
release(key: string): Promise<void>;
|
|
21
|
+
/** Visible for tests and for a health endpoint that wants to report size. */
|
|
22
|
+
get size(): number;
|
|
23
|
+
private evictExpired;
|
|
24
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
|
|
@@ -9,46 +8,67 @@ var _chunkRF75KC63cjs = require('./chunk-RF75KC63.cjs');
|
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
var _chunkSPTDXUEDcjs = require('./chunk-SPTDXUED.cjs');
|
|
12
|
-
require('./chunk-
|
|
11
|
+
require('./chunk-H2EHN366.cjs');
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
|
|
17
|
-
var
|
|
16
|
+
var _chunkHVHYZXBBcjs = require('./chunk-HVHYZXBB.cjs');
|
|
17
|
+
require('./chunk-KVBQBT3D.cjs');
|
|
18
|
+
require('./chunk-7SOM7EZP.cjs');
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
var
|
|
21
|
+
var _chunkFNUZGYUFcjs = require('./chunk-FNUZGYUF.cjs');
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
var
|
|
24
|
+
var _chunk3AUOOEQOcjs = require('./chunk-3AUOOEQO.cjs');
|
|
24
25
|
|
|
25
26
|
|
|
27
|
+
var _chunkMSTXS3MUcjs = require('./chunk-MSTXS3MU.cjs');
|
|
26
28
|
|
|
27
|
-
var _chunk3CLYZC3Tcjs = require('./chunk-3CLYZC3T.cjs');
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
var
|
|
32
|
-
require('./chunk-
|
|
32
|
+
var _chunk52IOOHNXcjs = require('./chunk-52IOOHNX.cjs');
|
|
33
|
+
require('./chunk-W2T2VFLC.cjs');
|
|
33
34
|
|
|
34
35
|
|
|
36
|
+
var _chunkQS2W5XCQcjs = require('./chunk-QS2W5XCQ.cjs');
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
|
|
39
|
-
var _chunkFDNGAYTZcjs = require('./chunk-FDNGAYTZ.cjs');
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
var
|
|
43
|
+
var _chunkAPUFKA4Kcjs = require('./chunk-APUFKA4K.cjs');
|
|
43
44
|
|
|
44
45
|
|
|
45
|
-
var _chunkZA56XBCKcjs = require('./chunk-ZA56XBCK.cjs');
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkAXMW5JF7cjs = require('./chunk-AXMW5JF7.cjs');
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
var _chunkY72D5L6Icjs = require('./chunk-Y72D5L6I.cjs');
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var _chunkSDWHKPXIcjs = require('./chunk-SDWHKPXI.cjs');
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var _chunkHDFPSA2Vcjs = require('./chunk-HDFPSA2V.cjs');
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
var _chunkQ5Y33L7Bcjs = require('./chunk-Q5Y33L7B.cjs');
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var _chunkPNK5WMPPcjs = require('./chunk-PNK5WMPP.cjs');
|
|
52
72
|
require('./chunk-2REOCMUD.cjs');
|
|
53
73
|
|
|
54
74
|
|
|
@@ -75,4 +95,17 @@ require('./chunk-2REOCMUD.cjs');
|
|
|
75
95
|
|
|
76
96
|
|
|
77
97
|
|
|
78
|
-
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
exports.AppException = _chunkQ5Y33L7Bcjs.AppException; exports.BaseCrudService = _chunk52IOOHNXcjs.BaseCrudService; exports.BaseResponseDto = _chunkQS2W5XCQcjs.BaseResponseDto; exports.ConflictAppException = _chunkHDFPSA2Vcjs.ConflictAppException; exports.ForbiddenAppException = _chunkHDFPSA2Vcjs.ForbiddenAppException; exports.GlobalExceptionFilter = _chunkMSTXS3MUcjs.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 = _chunkFNUZGYUFcjs.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;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "./chunk-EPVKCBPT.js";
|
|
2
1
|
import {
|
|
3
2
|
PG_POOL,
|
|
4
3
|
PgModule,
|
|
@@ -9,46 +8,67 @@ import {
|
|
|
9
8
|
SUPABASE_SERVICE_ROLE_CLIENT,
|
|
10
9
|
SupabaseModule
|
|
11
10
|
} from "./chunk-PA24P76K.js";
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-ODPSIFOB.js";
|
|
13
12
|
import {
|
|
14
13
|
REQUEST_ID_HEADER,
|
|
15
14
|
RequestIdMiddleware,
|
|
16
15
|
TrackingModule
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4PFAKLT3.js";
|
|
17
|
+
import "./chunk-EPVKCBPT.js";
|
|
18
|
+
import "./chunk-DQYAIQQ5.js";
|
|
18
19
|
import {
|
|
19
20
|
applyNestKitDefaults
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UNEVXCFW.js";
|
|
21
22
|
import {
|
|
22
23
|
ResponseInterceptor
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-DYHSOULW.js";
|
|
25
|
+
import {
|
|
26
|
+
GlobalExceptionFilter
|
|
27
|
+
} from "./chunk-A2DGK4ZL.js";
|
|
24
28
|
import {
|
|
25
29
|
BaseCrudService,
|
|
30
|
+
ListQuery,
|
|
26
31
|
createCrudController
|
|
27
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-IFNYRZP2.js";
|
|
33
|
+
import "./chunk-ZJMLEP5H.js";
|
|
28
34
|
import {
|
|
35
|
+
BaseResponseDto
|
|
36
|
+
} from "./chunk-XX2HPTRU.js";
|
|
37
|
+
import {
|
|
38
|
+
I18nInterceptor,
|
|
29
39
|
I18nModule,
|
|
40
|
+
NestI18nTranslator,
|
|
41
|
+
matchLanguage,
|
|
30
42
|
translateOr
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import
|
|
43
|
+
} from "./chunk-6RAPVLJM.js";
|
|
44
|
+
import {
|
|
45
|
+
currentLanguage,
|
|
46
|
+
translate,
|
|
47
|
+
translateDeep
|
|
48
|
+
} from "./chunk-X4PQJZ4G.js";
|
|
49
|
+
import {
|
|
50
|
+
buildPageMeta,
|
|
51
|
+
isPaginated,
|
|
52
|
+
paginated
|
|
53
|
+
} from "./chunk-TCAMLNUZ.js";
|
|
54
|
+
import {
|
|
55
|
+
RequestContext
|
|
56
|
+
} from "./chunk-ETRUVZTJ.js";
|
|
33
57
|
import {
|
|
34
58
|
ConflictAppException,
|
|
35
59
|
ForbiddenAppException,
|
|
36
60
|
NotFoundAppException,
|
|
37
61
|
UnauthorizedAppException,
|
|
38
62
|
ValidationAppException
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import {
|
|
41
|
-
GlobalExceptionFilter
|
|
42
|
-
} from "./chunk-7I2Y7V52.js";
|
|
43
|
-
import {
|
|
44
|
-
RequestContext
|
|
45
|
-
} from "./chunk-EBO6UKHL.js";
|
|
63
|
+
} from "./chunk-ZFIDAX7K.js";
|
|
46
64
|
import {
|
|
47
65
|
AppException
|
|
48
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-M3GQDRWR.js";
|
|
49
67
|
import {
|
|
50
|
-
|
|
51
|
-
|
|
68
|
+
I18nMessage,
|
|
69
|
+
isI18nMessage,
|
|
70
|
+
t
|
|
71
|
+
} from "./chunk-VVMRZEIW.js";
|
|
52
72
|
import "./chunk-4MGIQFAJ.js";
|
|
53
73
|
export {
|
|
54
74
|
AppException,
|
|
@@ -57,7 +77,11 @@ export {
|
|
|
57
77
|
ConflictAppException,
|
|
58
78
|
ForbiddenAppException,
|
|
59
79
|
GlobalExceptionFilter,
|
|
80
|
+
I18nInterceptor,
|
|
81
|
+
I18nMessage,
|
|
60
82
|
I18nModule,
|
|
83
|
+
ListQuery,
|
|
84
|
+
NestI18nTranslator,
|
|
61
85
|
NotFoundAppException,
|
|
62
86
|
PG_POOL,
|
|
63
87
|
PgModule,
|
|
@@ -72,7 +96,16 @@ export {
|
|
|
72
96
|
UnauthorizedAppException,
|
|
73
97
|
ValidationAppException,
|
|
74
98
|
applyNestKitDefaults,
|
|
99
|
+
buildPageMeta,
|
|
75
100
|
createCrudController,
|
|
101
|
+
currentLanguage,
|
|
102
|
+
isI18nMessage,
|
|
103
|
+
isPaginated,
|
|
104
|
+
matchLanguage,
|
|
105
|
+
paginated,
|
|
106
|
+
t,
|
|
107
|
+
translate,
|
|
108
|
+
translateDeep,
|
|
76
109
|
translateOr,
|
|
77
110
|
withTenantScope
|
|
78
111
|
};
|