@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
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miguelmorales13/nestkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"description": "Reusable NestJS building blocks: i18n, error handling, standardized responses, request tracking, base entities, generic CRUD, Postgres/Supabase connection helpers, outbound Telegram/WhatsApp/Stripe/Meta clients, short-lived media hosting, batteries-included auth, Stripe webhooks,
|
|
7
|
+
"description": "Reusable NestJS building blocks: i18n, error handling, standardized responses, request tracking, base entities, generic CRUD, Postgres/Supabase connection helpers, outbound Telegram/WhatsApp/Stripe/Meta clients, short-lived media hosting, batteries-included auth, Stripe webhooks, Resend/Nodemailer email, card-present terminal payments (Mercado Pago Point, Clip), and CFDI 4.0 invoicing (Facturapi, Facturama).",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
@@ -140,12 +140,33 @@
|
|
|
140
140
|
"types": "./dist/storage/index.d.ts",
|
|
141
141
|
"import": "./dist/storage/index.js",
|
|
142
142
|
"require": "./dist/storage/index.cjs"
|
|
143
|
+
},
|
|
144
|
+
"./payments": {
|
|
145
|
+
"types": "./dist/payments/index.d.ts",
|
|
146
|
+
"import": "./dist/payments/index.js",
|
|
147
|
+
"require": "./dist/payments/index.cjs"
|
|
148
|
+
},
|
|
149
|
+
"./invoicing": {
|
|
150
|
+
"types": "./dist/invoicing/index.d.ts",
|
|
151
|
+
"import": "./dist/invoicing/index.js",
|
|
152
|
+
"require": "./dist/invoicing/index.cjs"
|
|
153
|
+
},
|
|
154
|
+
"./idempotency": {
|
|
155
|
+
"types": "./dist/idempotency/index.d.ts",
|
|
156
|
+
"import": "./dist/idempotency/index.js",
|
|
157
|
+
"require": "./dist/idempotency/index.cjs"
|
|
158
|
+
},
|
|
159
|
+
"./audit": {
|
|
160
|
+
"types": "./dist/audit/index.d.ts",
|
|
161
|
+
"import": "./dist/audit/index.js",
|
|
162
|
+
"require": "./dist/audit/index.cjs"
|
|
143
163
|
}
|
|
144
164
|
},
|
|
145
165
|
"scripts": {
|
|
146
166
|
"build": "tsup && tsc -p tsconfig.build.json",
|
|
147
167
|
"typecheck": "tsc --noEmit",
|
|
148
|
-
"dev": "tsup --watch"
|
|
168
|
+
"dev": "tsup --watch",
|
|
169
|
+
"test": "bun test"
|
|
149
170
|
},
|
|
150
171
|
"peerDependencies": {
|
|
151
172
|
"@nestjs/common": "^11.0.0",
|
|
@@ -224,6 +245,7 @@
|
|
|
224
245
|
"@nestjs/core": "^11.0.0",
|
|
225
246
|
"@nestjs/swagger": "^11.0.0",
|
|
226
247
|
"@supabase/supabase-js": "^2.45.0",
|
|
248
|
+
"@types/bun": "^1.4.2",
|
|
227
249
|
"@types/jsonwebtoken": "^9.0.10",
|
|
228
250
|
"@types/node": "^22.0.0",
|
|
229
251
|
"@types/nodemailer": "^8.0.1",
|
package/dist/chunk-3CLYZC3T.cjs
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
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 _chunk2REOCMUDcjs = require('./chunk-2REOCMUD.cjs');
|
|
5
|
-
|
|
6
|
-
// src/crud/crud.service.ts
|
|
7
|
-
var BaseCrudService = class {
|
|
8
|
-
constructor(repository, options = {}) {
|
|
9
|
-
this.repository = repository;
|
|
10
|
-
this.options = options;
|
|
11
|
-
}
|
|
12
|
-
findById(id, tenantId) {
|
|
13
|
-
return this.repository.findById(id, tenantId);
|
|
14
|
-
}
|
|
15
|
-
findAll(filter, tenantId) {
|
|
16
|
-
return this.repository.findAll(filter, tenantId);
|
|
17
|
-
}
|
|
18
|
-
create(data, tenantId) {
|
|
19
|
-
return this.repository.create(data, tenantId);
|
|
20
|
-
}
|
|
21
|
-
update(id, data, tenantId) {
|
|
22
|
-
return this.repository.update(id, data, tenantId);
|
|
23
|
-
}
|
|
24
|
-
async delete(id, tenantId) {
|
|
25
|
-
if (this.options.deleteStrategy === "soft") {
|
|
26
|
-
await this.repository.update(id, { deletedAt: /* @__PURE__ */ new Date() }, tenantId);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
await this.repository.delete(id, tenantId);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/crud/crud.controller.ts
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var _common = require('@nestjs/common');
|
|
46
|
-
function createCrudController(serviceToken, options = {}) {
|
|
47
|
-
const tenantIdOf = (req) => _optionalChain([options, 'access', _ => _.tenantIdExtractor, 'optionalCall', _2 => _2(req)]);
|
|
48
|
-
let CrudControllerHost = class {
|
|
49
|
-
constructor(service) {
|
|
50
|
-
this.service = service;
|
|
51
|
-
}
|
|
52
|
-
findAll(filter, req) {
|
|
53
|
-
return this.service.findAll(filter, tenantIdOf(req));
|
|
54
|
-
}
|
|
55
|
-
findById(id, req) {
|
|
56
|
-
return this.service.findById(id, tenantIdOf(req));
|
|
57
|
-
}
|
|
58
|
-
create(data, req) {
|
|
59
|
-
return this.service.create(data, tenantIdOf(req));
|
|
60
|
-
}
|
|
61
|
-
update(id, data, req) {
|
|
62
|
-
return this.service.update(id, data, tenantIdOf(req));
|
|
63
|
-
}
|
|
64
|
-
remove(id, req) {
|
|
65
|
-
return this.service.delete(id, tenantIdOf(req));
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
_chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
69
|
-
_common.Get.call(void 0, ),
|
|
70
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Query.call(void 0, )),
|
|
71
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 1, _common.Req.call(void 0, ))
|
|
72
|
-
], CrudControllerHost.prototype, "findAll", 1);
|
|
73
|
-
_chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
74
|
-
_common.Get.call(void 0, ":id"),
|
|
75
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Param.call(void 0, "id")),
|
|
76
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 1, _common.Req.call(void 0, ))
|
|
77
|
-
], CrudControllerHost.prototype, "findById", 1);
|
|
78
|
-
_chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
79
|
-
_common.Post.call(void 0, ),
|
|
80
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Body.call(void 0, )),
|
|
81
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 1, _common.Req.call(void 0, ))
|
|
82
|
-
], CrudControllerHost.prototype, "create", 1);
|
|
83
|
-
_chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
84
|
-
_common.Patch.call(void 0, ":id"),
|
|
85
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Param.call(void 0, "id")),
|
|
86
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 1, _common.Body.call(void 0, )),
|
|
87
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 2, _common.Req.call(void 0, ))
|
|
88
|
-
], CrudControllerHost.prototype, "update", 1);
|
|
89
|
-
_chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
90
|
-
_common.Delete.call(void 0, ":id"),
|
|
91
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Param.call(void 0, "id")),
|
|
92
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 1, _common.Req.call(void 0, ))
|
|
93
|
-
], CrudControllerHost.prototype, "remove", 1);
|
|
94
|
-
CrudControllerHost = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
95
|
-
_common.Controller.call(void 0, _nullishCoalesce(options.path, () => ( ""))),
|
|
96
|
-
_chunk2REOCMUDcjs.__decorateParam.call(void 0, 0, _common.Inject.call(void 0, serviceToken))
|
|
97
|
-
], CrudControllerHost);
|
|
98
|
-
return CrudControllerHost;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
exports.BaseCrudService = BaseCrudService; exports.createCrudController = createCrudController;
|
package/dist/chunk-EBO6UKHL.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// src/tracking/request-context.ts
|
|
2
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
3
|
-
var RequestContext = class {
|
|
4
|
-
static {
|
|
5
|
-
this.storage = new AsyncLocalStorage();
|
|
6
|
-
}
|
|
7
|
-
static run(store, fn) {
|
|
8
|
-
return this.storage.run(store, fn);
|
|
9
|
-
}
|
|
10
|
-
static getStore() {
|
|
11
|
-
return this.storage.getStore();
|
|
12
|
-
}
|
|
13
|
-
static getRequestId() {
|
|
14
|
-
return this.storage.getStore()?.requestId;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
RequestContext
|
|
20
|
-
};
|
package/dist/chunk-IYUUYCP5.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__decorateClass
|
|
3
|
-
} from "./chunk-4MGIQFAJ.js";
|
|
4
|
-
|
|
5
|
-
// src/i18n/i18n.module.ts
|
|
6
|
-
import { Module } from "@nestjs/common";
|
|
7
|
-
import { I18nModule as BaseI18nModule, I18nJsonLoader } from "nestjs-i18n";
|
|
8
|
-
var I18nModule = class {
|
|
9
|
-
static forRoot(options = {}) {
|
|
10
|
-
return BaseI18nModule.forRoot({
|
|
11
|
-
fallbackLanguage: options.fallbackLanguage ?? "es",
|
|
12
|
-
loaderOptions: {
|
|
13
|
-
path: options.path ?? "./i18n/",
|
|
14
|
-
watch: true
|
|
15
|
-
},
|
|
16
|
-
loader: I18nJsonLoader
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
I18nModule = __decorateClass([
|
|
21
|
-
Module({})
|
|
22
|
-
], I18nModule);
|
|
23
|
-
|
|
24
|
-
// src/i18n/translate.helper.ts
|
|
25
|
-
function translateOr(i18n, key, fallback, args) {
|
|
26
|
-
try {
|
|
27
|
-
return i18n.t(key, { args, defaultValue: fallback });
|
|
28
|
-
} catch {
|
|
29
|
-
return fallback;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
I18nModule,
|
|
35
|
-
translateOr
|
|
36
|
-
};
|
package/dist/chunk-JOVBJDJ2.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__decorateClass,
|
|
3
|
-
__decorateParam
|
|
4
|
-
} from "./chunk-4MGIQFAJ.js";
|
|
5
|
-
|
|
6
|
-
// src/crud/crud.service.ts
|
|
7
|
-
var BaseCrudService = class {
|
|
8
|
-
constructor(repository, options = {}) {
|
|
9
|
-
this.repository = repository;
|
|
10
|
-
this.options = options;
|
|
11
|
-
}
|
|
12
|
-
findById(id, tenantId) {
|
|
13
|
-
return this.repository.findById(id, tenantId);
|
|
14
|
-
}
|
|
15
|
-
findAll(filter, tenantId) {
|
|
16
|
-
return this.repository.findAll(filter, tenantId);
|
|
17
|
-
}
|
|
18
|
-
create(data, tenantId) {
|
|
19
|
-
return this.repository.create(data, tenantId);
|
|
20
|
-
}
|
|
21
|
-
update(id, data, tenantId) {
|
|
22
|
-
return this.repository.update(id, data, tenantId);
|
|
23
|
-
}
|
|
24
|
-
async delete(id, tenantId) {
|
|
25
|
-
if (this.options.deleteStrategy === "soft") {
|
|
26
|
-
await this.repository.update(id, { deletedAt: /* @__PURE__ */ new Date() }, tenantId);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
await this.repository.delete(id, tenantId);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/crud/crud.controller.ts
|
|
34
|
-
import {
|
|
35
|
-
Body,
|
|
36
|
-
Controller,
|
|
37
|
-
Delete,
|
|
38
|
-
Get,
|
|
39
|
-
Inject,
|
|
40
|
-
Param,
|
|
41
|
-
Patch,
|
|
42
|
-
Post,
|
|
43
|
-
Query,
|
|
44
|
-
Req
|
|
45
|
-
} from "@nestjs/common";
|
|
46
|
-
function createCrudController(serviceToken, options = {}) {
|
|
47
|
-
const tenantIdOf = (req) => options.tenantIdExtractor?.(req);
|
|
48
|
-
let CrudControllerHost = class {
|
|
49
|
-
constructor(service) {
|
|
50
|
-
this.service = service;
|
|
51
|
-
}
|
|
52
|
-
findAll(filter, req) {
|
|
53
|
-
return this.service.findAll(filter, tenantIdOf(req));
|
|
54
|
-
}
|
|
55
|
-
findById(id, req) {
|
|
56
|
-
return this.service.findById(id, tenantIdOf(req));
|
|
57
|
-
}
|
|
58
|
-
create(data, req) {
|
|
59
|
-
return this.service.create(data, tenantIdOf(req));
|
|
60
|
-
}
|
|
61
|
-
update(id, data, req) {
|
|
62
|
-
return this.service.update(id, data, tenantIdOf(req));
|
|
63
|
-
}
|
|
64
|
-
remove(id, req) {
|
|
65
|
-
return this.service.delete(id, tenantIdOf(req));
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
__decorateClass([
|
|
69
|
-
Get(),
|
|
70
|
-
__decorateParam(0, Query()),
|
|
71
|
-
__decorateParam(1, Req())
|
|
72
|
-
], CrudControllerHost.prototype, "findAll", 1);
|
|
73
|
-
__decorateClass([
|
|
74
|
-
Get(":id"),
|
|
75
|
-
__decorateParam(0, Param("id")),
|
|
76
|
-
__decorateParam(1, Req())
|
|
77
|
-
], CrudControllerHost.prototype, "findById", 1);
|
|
78
|
-
__decorateClass([
|
|
79
|
-
Post(),
|
|
80
|
-
__decorateParam(0, Body()),
|
|
81
|
-
__decorateParam(1, Req())
|
|
82
|
-
], CrudControllerHost.prototype, "create", 1);
|
|
83
|
-
__decorateClass([
|
|
84
|
-
Patch(":id"),
|
|
85
|
-
__decorateParam(0, Param("id")),
|
|
86
|
-
__decorateParam(1, Body()),
|
|
87
|
-
__decorateParam(2, Req())
|
|
88
|
-
], CrudControllerHost.prototype, "update", 1);
|
|
89
|
-
__decorateClass([
|
|
90
|
-
Delete(":id"),
|
|
91
|
-
__decorateParam(0, Param("id")),
|
|
92
|
-
__decorateParam(1, Req())
|
|
93
|
-
], CrudControllerHost.prototype, "remove", 1);
|
|
94
|
-
CrudControllerHost = __decorateClass([
|
|
95
|
-
Controller(options.path ?? ""),
|
|
96
|
-
__decorateParam(0, Inject(serviceToken))
|
|
97
|
-
], CrudControllerHost);
|
|
98
|
-
return CrudControllerHost;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export {
|
|
102
|
-
BaseCrudService,
|
|
103
|
-
createCrudController
|
|
104
|
-
};
|
package/dist/chunk-M3EL5O6T.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
-
|
|
3
|
-
var _chunk2REOCMUDcjs = require('./chunk-2REOCMUD.cjs');
|
|
4
|
-
|
|
5
|
-
// src/i18n/i18n.module.ts
|
|
6
|
-
var _common = require('@nestjs/common');
|
|
7
|
-
var _nestjsi18n = require('nestjs-i18n');
|
|
8
|
-
var I18nModule = class {
|
|
9
|
-
static forRoot(options = {}) {
|
|
10
|
-
return _nestjsi18n.I18nModule.forRoot({
|
|
11
|
-
fallbackLanguage: _nullishCoalesce(options.fallbackLanguage, () => ( "es")),
|
|
12
|
-
loaderOptions: {
|
|
13
|
-
path: _nullishCoalesce(options.path, () => ( "./i18n/")),
|
|
14
|
-
watch: true
|
|
15
|
-
},
|
|
16
|
-
loader: _nestjsi18n.I18nJsonLoader
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
I18nModule = exports.I18nModule = _chunk2REOCMUDcjs.__decorateClass.call(void 0, [
|
|
21
|
-
_common.Module.call(void 0, {})
|
|
22
|
-
], I18nModule);
|
|
23
|
-
|
|
24
|
-
// src/i18n/translate.helper.ts
|
|
25
|
-
function translateOr(i18n, key, fallback, args) {
|
|
26
|
-
try {
|
|
27
|
-
return i18n.t(key, { args, defaultValue: fallback });
|
|
28
|
-
} catch (e) {
|
|
29
|
-
return fallback;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
exports.I18nModule = I18nModule; exports.translateOr = translateOr;
|
package/dist/chunk-R7BVS6CI.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/errors/app.exception.ts
|
|
2
|
-
var _common = require('@nestjs/common');
|
|
3
|
-
var AppException = class extends _common.HttpException {
|
|
4
|
-
constructor(code, message, status, details) {
|
|
5
|
-
super({ code, message, details }, status);
|
|
6
|
-
this.code = code;
|
|
7
|
-
this.details = details;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.AppException = AppException;
|
|
File without changes
|
|
File without changes
|