@goatlab/node-backend 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -6
- package/dist/Cache.d.ts +1 -1
- package/dist/Cache.js +18 -16
- package/dist/Cache.js.map +1 -1
- package/dist/container/Container.d.ts +2 -2
- package/dist/container/Container.js +16 -8
- package/dist/container/Container.js.map +1 -1
- package/dist/container/DistributedCacheInvalidator.d.ts +1 -1
- package/dist/container/DistributedCacheInvalidator.js +8 -8
- package/dist/container/DistributedCacheInvalidator.js.map +1 -1
- package/dist/container/examples/batch-operations.example.js +25 -23
- package/dist/container/examples/batch-operations.example.js.map +1 -1
- package/dist/container/helpers.js +2 -1
- package/dist/container/helpers.js.map +1 -1
- package/dist/index.d.ts +25 -23
- package/dist/index.js +41 -39
- package/dist/index.js.map +1 -1
- package/dist/server/bootstraps/ExpressTrpcAppConfig.d.ts +118 -0
- package/dist/server/bootstraps/ExpressTrpcAppConfig.js +175 -0
- package/dist/server/bootstraps/ExpressTrpcAppConfig.js.map +1 -0
- package/dist/server/bootstraps/getExpressTrpcApp.d.ts +6 -18
- package/dist/server/bootstraps/getExpressTrpcApp.js +277 -160
- package/dist/server/bootstraps/getExpressTrpcApp.js.map +1 -1
- package/dist/server/consts.js +8 -8
- package/dist/server/consts.js.map +1 -1
- package/dist/server/context/request.context.js +0 -1
- package/dist/server/context/request.context.js.map +1 -1
- package/dist/server/context/trpc.context.d.ts +1 -1
- package/dist/server/context/trpc.context.js +2 -2
- package/dist/server/context/trpc.context.js.map +1 -1
- package/dist/server/initOpenApiDocs.d.ts +1 -1
- package/dist/server/initOpenApiDocs.js +3 -3
- package/dist/server/initOpenApiDocs.js.map +1 -1
- package/dist/server/middleware/cloudTaskDecrypt.middleware.d.ts +2 -2
- package/dist/server/middleware/cloudTaskDecrypt.middleware.js +7 -9
- package/dist/server/middleware/cloudTaskDecrypt.middleware.js.map +1 -1
- package/dist/server/middleware/error.middleware.d.ts +1 -1
- package/dist/server/middleware/error.middleware.js +16 -7
- package/dist/server/middleware/error.middleware.js.map +1 -1
- package/dist/server/middleware/handleRequest.middleware.d.ts +1 -1
- package/dist/server/middleware/handleRequest.middleware.js +3 -3
- package/dist/server/middleware/handleRequest.middleware.js.map +1 -1
- package/dist/server/middleware/logger/cloudRun.logger.d.ts +2 -2
- package/dist/server/middleware/logger/cloudRun.logger.js +15 -15
- package/dist/server/middleware/logger/cloudRun.logger.js.map +1 -1
- package/dist/server/middleware/logger/logger.service.js +2 -2
- package/dist/server/middleware/logs.middleware.d.ts +1 -1
- package/dist/server/middleware/logs.middleware.js +10 -14
- package/dist/server/middleware/logs.middleware.js.map +1 -1
- package/dist/server/middleware/memoryMonitor.example.js +13 -11
- package/dist/server/middleware/memoryMonitor.example.js.map +1 -1
- package/dist/server/middleware/memoryMonitor.middleware.d.ts +1 -1
- package/dist/server/middleware/memoryMonitor.middleware.js.map +1 -1
- package/dist/server/middleware/productionError.middleware.d.ts +2 -2
- package/dist/server/middleware/productionError.middleware.js.map +1 -1
- package/dist/server/middleware/security.middleware.d.ts +1 -1
- package/dist/server/middleware/security.middleware.js +1 -1
- package/dist/server/middleware/security.middleware.js.map +1 -1
- package/dist/server/middleware/trpcError.middleware.d.ts +1 -1
- package/dist/server/middleware/trpcError.middleware.js +8 -5
- package/dist/server/middleware/trpcError.middleware.js.map +1 -1
- package/dist/server/schemas/user.schema.js +3 -3
- package/dist/server/sentry/getSentry.d.ts +1 -1
- package/dist/server/sentry/getSentry.js +3 -3
- package/dist/server/sentry/getSentry.js.map +1 -1
- package/dist/server/sentry/sentry.service.d.ts +1 -1
- package/dist/server/sentry/sentry.service.js +11 -11
- package/dist/server/sentry/sentry.service.js.map +1 -1
- package/dist/server/services/email/email.model.js +1 -1
- package/dist/server/services/email/email.service.d.ts +3 -3
- package/dist/server/services/email/email.service.js +14 -14
- package/dist/server/services/email/email.service.js.map +1 -1
- package/dist/server/services/secrets/examples/container-preload.example.js +36 -16
- package/dist/server/services/secrets/examples/container-preload.example.js.map +1 -1
- package/dist/server/services/secrets/index.d.ts +1 -1
- package/dist/server/services/secrets/index.js.map +1 -1
- package/dist/server/services/secrets/secret.service.js +12 -9
- package/dist/server/services/secrets/secret.service.js.map +1 -1
- package/dist/server/services/sendgrid/sendgridApi.service.d.ts +1 -1
- package/dist/server/services/sendgrid/sendgridApi.service.js +14 -16
- package/dist/server/services/sendgrid/sendgridApi.service.js.map +1 -1
- package/dist/server/services/translations/template.util.js.map +1 -1
- package/dist/server/services/translations/translation.model.d.ts +2 -2
- package/dist/server/services/translations/translation.model.js +7 -1
- package/dist/server/services/translations/translation.model.js.map +1 -1
- package/dist/server/services/translations/translation.service.d.ts +5 -5
- package/dist/server/services/translations/translation.service.js +11 -9
- package/dist/server/services/translations/translation.service.js.map +1 -1
- package/dist/server/services/util/benchmarker.js +8 -8
- package/dist/server/services/util/benchmarker.js.map +1 -1
- package/dist/server/services/util/pagination.d.ts +4 -4
- package/dist/server/services/util/pagination.js +4 -4
- package/dist/server/services/util/pagination.js.map +1 -1
- package/dist/server/services/util/url.service.d.ts +4 -4
- package/dist/server/services/util/url.service.js +7 -7
- package/dist/server/services/util/url.service.js.map +1 -1
- package/dist/server/test/express.mock.js +6 -6
- package/dist/server/test/firebase.mock.js +2 -2
- package/dist/server/test/trpc.mock.d.ts +1 -1
- package/dist/server/test/trpc.mock.js +1 -1
- package/dist/server/test/trpc.mock.js.map +1 -1
- package/dist/server/trpc.d.ts +1 -1
- package/dist/server/trpc.js +10 -10
- package/dist/server/trpc.js.map +1 -1
- package/dist/test/const.js +7 -7
- package/dist/test/const.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -9
|
@@ -15,37 +15,39 @@ const factories = {
|
|
|
15
15
|
},
|
|
16
16
|
dispose: async () => {
|
|
17
17
|
console.log('Database connection closed');
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
}),
|
|
20
|
-
cache: (
|
|
20
|
+
cache: (_redisUrl) => ({
|
|
21
21
|
get: async (key) => {
|
|
22
22
|
console.log(`Cache GET: ${key}`);
|
|
23
23
|
return null;
|
|
24
24
|
},
|
|
25
25
|
set: async (key, value) => {
|
|
26
26
|
console.log(`Cache SET: ${key} = ${JSON.stringify(value)}`);
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
}),
|
|
29
29
|
api: {
|
|
30
30
|
users: (db, cache) => ({
|
|
31
31
|
getAll: async () => {
|
|
32
32
|
const cached = await cache.get('users:all');
|
|
33
|
-
if (cached)
|
|
33
|
+
if (cached) {
|
|
34
34
|
return cached;
|
|
35
|
+
}
|
|
35
36
|
const users = await db.query('SELECT * FROM users');
|
|
36
37
|
await cache.set('users:all', users);
|
|
37
38
|
return users;
|
|
38
39
|
},
|
|
39
40
|
getById: async (id) => {
|
|
40
41
|
const cached = await cache.get(`users:${id}`);
|
|
41
|
-
if (cached)
|
|
42
|
+
if (cached) {
|
|
42
43
|
return cached;
|
|
44
|
+
}
|
|
43
45
|
const [user] = await db.query(`SELECT * FROM users WHERE id = ${id}`);
|
|
44
46
|
await cache.set(`users:${id}`, user);
|
|
45
47
|
return user;
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
}
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
}
|
|
49
51
|
};
|
|
50
52
|
// Create container with initializer
|
|
51
53
|
const container = new Container_1.Container(factories, async (preload, meta) => {
|
|
@@ -58,12 +60,12 @@ const container = new Container_1.Container(factories, async (preload, meta) =>
|
|
|
58
60
|
database: db,
|
|
59
61
|
cache: cache,
|
|
60
62
|
api: {
|
|
61
|
-
users: preload.api.users(meta.id, db, cache)
|
|
62
|
-
}
|
|
63
|
+
users: preload.api.users(meta.id, db, cache)
|
|
64
|
+
}
|
|
63
65
|
}; // Type assertion needed due to complex nested structure
|
|
64
66
|
}, {
|
|
65
67
|
enableMetrics: true,
|
|
66
|
-
enableDiagnostics: true
|
|
68
|
+
enableDiagnostics: true
|
|
67
69
|
});
|
|
68
70
|
// Example tenants to process
|
|
69
71
|
const tenants = [
|
|
@@ -72,36 +74,36 @@ const tenants = [
|
|
|
72
74
|
name: 'Acme Corp',
|
|
73
75
|
connectionString: 'postgres://acme:pass@db/acme',
|
|
74
76
|
redisUrl: 'redis://cache:6379/1',
|
|
75
|
-
tier: 'enterprise'
|
|
77
|
+
tier: 'enterprise'
|
|
76
78
|
},
|
|
77
79
|
{
|
|
78
80
|
id: 'tenant-2',
|
|
79
81
|
name: 'Globex Inc',
|
|
80
82
|
connectionString: 'postgres://globex:pass@db/globex',
|
|
81
83
|
redisUrl: 'redis://cache:6379/2',
|
|
82
|
-
tier: 'pro'
|
|
84
|
+
tier: 'pro'
|
|
83
85
|
},
|
|
84
86
|
{
|
|
85
87
|
id: 'tenant-3',
|
|
86
88
|
name: 'Initech LLC',
|
|
87
89
|
connectionString: 'postgres://initech:pass@db/initech',
|
|
88
90
|
redisUrl: 'redis://cache:6379/3',
|
|
89
|
-
tier: 'free'
|
|
91
|
+
tier: 'free'
|
|
90
92
|
},
|
|
91
93
|
{
|
|
92
94
|
id: 'tenant-4',
|
|
93
95
|
name: 'Umbrella Corp',
|
|
94
96
|
connectionString: 'postgres://umbrella:pass@db/umbrella',
|
|
95
97
|
redisUrl: 'redis://cache:6379/4',
|
|
96
|
-
tier: 'enterprise'
|
|
98
|
+
tier: 'enterprise'
|
|
97
99
|
},
|
|
98
100
|
{
|
|
99
101
|
id: 'tenant-5',
|
|
100
102
|
name: 'Wayne Enterprises',
|
|
101
103
|
connectionString: 'postgres://wayne:pass@db/wayne',
|
|
102
104
|
redisUrl: 'redis://cache:6379/5',
|
|
103
|
-
tier: 'enterprise'
|
|
104
|
-
}
|
|
105
|
+
tier: 'enterprise'
|
|
106
|
+
}
|
|
105
107
|
];
|
|
106
108
|
async function demonstrateBatchOperations() {
|
|
107
109
|
console.log('===== Container Batch Operations Demo =====\n');
|
|
@@ -113,16 +115,16 @@ async function demonstrateBatchOperations() {
|
|
|
113
115
|
fn: async () => {
|
|
114
116
|
// Simulate some work for each tenant
|
|
115
117
|
const { api } = container.context;
|
|
116
|
-
const users = await api?.users.getAll() || [];
|
|
118
|
+
const users = (await api?.users.getAll()) || [];
|
|
117
119
|
console.log(` ✓ Processed tenant ${metadata.name}`);
|
|
118
120
|
return { tenantId: metadata.id, userCount: users.length };
|
|
119
|
-
}
|
|
121
|
+
}
|
|
120
122
|
})), {
|
|
121
123
|
concurrency: 3, // Process 3 tenants at a time
|
|
122
124
|
continueOnError: true,
|
|
123
|
-
onProgress: (completed, total,
|
|
125
|
+
onProgress: (completed, total, _current) => {
|
|
124
126
|
console.log(`Progress: ${completed}/${total} tenants processed`);
|
|
125
|
-
}
|
|
127
|
+
}
|
|
126
128
|
});
|
|
127
129
|
const duration = Date.now() - startTime;
|
|
128
130
|
console.log(`\nBatch bootstrap completed in ${duration}ms`);
|
|
@@ -149,9 +151,9 @@ async function demonstrateBatchOperations() {
|
|
|
149
151
|
// Simulate slow operation
|
|
150
152
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
151
153
|
return { processed: true };
|
|
152
|
-
}
|
|
154
|
+
}
|
|
153
155
|
})), {
|
|
154
|
-
timeout: 200
|
|
156
|
+
timeout: 200 // 200ms timeout
|
|
155
157
|
});
|
|
156
158
|
console.log(`Timeout test result: ${timeoutResults[0].status}`);
|
|
157
159
|
// Show final metrics
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-operations.example.js","sourceRoot":"","sources":["../../../src/container/examples/batch-operations.example.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,yEAAyE;;AAEzE,4CAAwC;AAqCxC,mDAAmD;AACnD,MAAM,SAAS,GAAqB;IAClC,QAAQ,EAAE,CAAC,gBAAwB,EAAE,EAAE,CAAC,CAAC;QACvC,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,0BAA0B,gBAAgB,EAAE,CAAC,CAAA;QAC3D,CAAC;QACD,KAAK,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE;YAC3B,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAA;YACtC,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;QAC3C,CAAC;KACF,CAAC;IACF,KAAK,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"batch-operations.example.js","sourceRoot":"","sources":["../../../src/container/examples/batch-operations.example.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,yEAAyE;;AAEzE,4CAAwC;AAqCxC,mDAAmD;AACnD,MAAM,SAAS,GAAqB;IAClC,QAAQ,EAAE,CAAC,gBAAwB,EAAE,EAAE,CAAC,CAAC;QACvC,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,0BAA0B,gBAAgB,EAAE,CAAC,CAAA;QAC3D,CAAC;QACD,KAAK,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE;YAC3B,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAA;YACtC,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;QAC3C,CAAC;KACF,CAAC;IACF,KAAK,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC;QAC7B,GAAG,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE;YACzB,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,EAAE,CAAC,CAAA;YAChC,OAAO,IAAI,CAAA;QACb,CAAC;QACD,GAAG,EAAE,KAAK,EAAE,GAAW,EAAE,KAAU,EAAE,EAAE;YACrC,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,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AAE,CAAC,CAAA;IAE/D,qBAAqB;IACrB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAC5C,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAA;IAEnC,UAAU;IACV,MAAM,SAAS,CAAC,UAAU,EAAE,CAAA;AAC9B,CAAC;AAED,eAAe;AACf,0BAA0B,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -8,7 +8,8 @@ exports.safeDispose = safeDispose;
|
|
|
8
8
|
* Detects ES6 classes by checking for 'class ' prefix in function string
|
|
9
9
|
* This is ~35-40ns faster than try/catch approach for each instantiation
|
|
10
10
|
*/
|
|
11
|
-
const isClass = (fn) => typeof fn === 'function' &&
|
|
11
|
+
const isClass = (fn) => typeof fn === 'function' &&
|
|
12
|
+
/^class\s/.test(Function.prototype.toString.call(fn));
|
|
12
13
|
exports.isClass = isClass;
|
|
13
14
|
/**
|
|
14
15
|
* Optimized instantiation helper that uses class detection to avoid exceptions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/container/helpers.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/container/helpers.ts"],"names":[],"mappings":";;;AAoBA,kCAkBC;AASD,kCAYC;AAzDD;;;;GAIG;AACI,MAAM,OAAO,GAAG,CAAC,EAAW,EAAkC,EAAE,CACrE,OAAO,EAAE,KAAK,UAAU;IACxB,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;AAF1C,QAAA,OAAO,WAEmC;AAEvD;;;;;;;;GAQG;AACH,SAAgB,WAAW,CACzB,OAAsB,EACtB,MAAS;IAET,oDAAoD;IACpD,IAAI,IAAA,eAAO,EAAC,OAAO,CAAC,EAAE,CAAC;QACrB,OAAO,IAAK,OAA8B,CAAC,GAAG,MAAM,CAAC,CAAA;IACvD,CAAC;IAED,4BAA4B;IAC5B,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,OAAQ,OAA0B,CAAC,GAAG,MAAM,CAAC,CAAA;IAC/C,CAAC;IAED,uBAAuB;IACvB,MAAM,IAAI,KAAK,CACb,gEAAgE,OAAO,OAAO,EAAE,CACjF,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAAC,GAAY;IAC5C,IAAI,CAAC;QACH,MAAM,CAAC,GAAI,GAAW,EAAE,OAAO,CAAA;QAC/B,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE,CAAC;YAC5B,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,sDAAsD;QACtD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACpC,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import { Cache } from './Cache';
|
|
2
1
|
import type { Options } from 'keyv';
|
|
2
|
+
import { Cache } from './Cache';
|
|
3
3
|
export { Cache };
|
|
4
4
|
export type { Options };
|
|
5
|
-
export { getExpressTrpcApp } from './server/bootstraps/getExpressTrpcApp';
|
|
6
|
-
export { SentryService } from './server/sentry/sentry.service';
|
|
7
|
-
export { getSentry } from './server/sentry/getSentry';
|
|
8
|
-
export { getLogger } from './server/middleware/logger/logger.service';
|
|
9
|
-
export { handleRequest } from './server/middleware/handleRequest.middleware';
|
|
10
|
-
export { useCloudTaskDecryptMiddleware } from './server/middleware/cloudTaskDecrypt.middleware';
|
|
11
|
-
export { getTrpc } from './server/trpc';
|
|
12
|
-
export { requestContext } from './server/context/request.context';
|
|
13
|
-
export { mockedAuthenticatedTrpcRouter } from './server/test/trpc.mock';
|
|
14
|
-
export type * from '@trpc/server/unstable-core-do-not-import';
|
|
15
5
|
export type * from '@trpc/server';
|
|
16
|
-
export
|
|
6
|
+
export { TRPCError } from '@trpc/server';
|
|
7
|
+
export type * from '@trpc/server/unstable-core-do-not-import';
|
|
8
|
+
export { Container } from './container/Container';
|
|
9
|
+
export { DistributedCacheInvalidator, getDistributedCacheInvalidator } from './container/DistributedCacheInvalidator';
|
|
10
|
+
export { createServiceCache } from './container/LruCache';
|
|
11
|
+
export type { BatchBootstrapOptions, BatchBootstrapResult, BatchInvalidationResult, ContainerBootstrapResult, ContainerContext, ContainerFactories, ContainerMetadata, ContainerOptions, Factory, MapInterface, PreloadStructure } from './container/types';
|
|
12
|
+
export type { ExpressTrpcAppConfig } from './server/bootstraps/ExpressTrpcAppConfig';
|
|
13
|
+
export { getDefaultConfig } from './server/bootstraps/ExpressTrpcAppConfig';
|
|
14
|
+
export { getExpressTrpcApp } from './server/bootstraps/getExpressTrpcApp';
|
|
17
15
|
export type { PackageInfo } from './server/consts';
|
|
18
16
|
export { config } from './server/consts';
|
|
17
|
+
export type { LocationOutput } from './server/context/context.model';
|
|
18
|
+
export { requestContext } from './server/context/request.context';
|
|
19
|
+
export { useCloudTaskDecryptMiddleware } from './server/middleware/cloudTaskDecrypt.middleware';
|
|
20
|
+
export { handleRequest } from './server/middleware/handleRequest.middleware';
|
|
21
|
+
export { getLogger } from './server/middleware/logger/logger.service';
|
|
22
|
+
export { getSentry } from './server/sentry/getSentry';
|
|
23
|
+
export { SentryService } from './server/sentry/sentry.service';
|
|
24
|
+
export type { EmailAttachment, EmailTemplates, Theme } from './server/services/email/email.model';
|
|
25
|
+
export { Content, EmailCategory, Layout } from './server/services/email/email.model';
|
|
19
26
|
export { EmailService } from './server/services/email/email.service';
|
|
20
|
-
export { Layout, Content, EmailCategory } from './server/services/email/email.model';
|
|
21
|
-
export type { EmailTemplates, Theme, EmailAttachment } from './server/services/email/email.model';
|
|
22
|
-
export { SendgridService } from './server/services/sendgrid/sendgridApi.service';
|
|
23
27
|
export { getGcpServiceAccountFromBase64 } from './server/services/gcp/getGcpServiceAccountFromBase64';
|
|
24
28
|
export type { SecretProvider, VaultConfig } from './server/services/secrets/secret.service';
|
|
25
29
|
export { SecretService } from './server/services/secrets/secret.service';
|
|
26
|
-
export { UrlService } from './server/services/util/url.service';
|
|
27
|
-
export { paginationUtility } from './server/services/util/pagination';
|
|
28
30
|
export type { SendGridEmailResponse } from './server/services/sendgrid/sendgrid.model';
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
+
export { SendgridService } from './server/services/sendgrid/sendgridApi.service';
|
|
32
|
+
export { tr, translationService } from './server/services/translations/translation.service';
|
|
33
|
+
export { paginationUtility } from './server/services/util/pagination';
|
|
34
|
+
export { UrlService } from './server/services/util/url.service';
|
|
35
|
+
export { mockedAuthenticatedTrpcRouter } from './server/test/trpc.mock';
|
|
36
|
+
export { getTrpc } from './server/trpc';
|
|
31
37
|
export type { Environment } from './server/types/Envinronment';
|
|
32
|
-
export { Container } from './container/Container';
|
|
33
|
-
export type { Factory, ContainerOptions, PreloadStructure, ContainerFactories, ContainerMetadata, ContainerContext, MapInterface, ContainerBootstrapResult, BatchBootstrapOptions, BatchBootstrapResult, BatchInvalidationResult } from './container/types';
|
|
34
|
-
export { createServiceCache } from './container/LruCache';
|
|
35
|
-
export { DistributedCacheInvalidator, getDistributedCacheInvalidator } from './container/DistributedCacheInvalidator';
|
|
36
38
|
export * as zodCompat from './server/zod-compat';
|
package/dist/index.js
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zodCompat = exports.
|
|
3
|
+
exports.zodCompat = exports.getTrpc = exports.mockedAuthenticatedTrpcRouter = exports.UrlService = exports.paginationUtility = exports.translationService = exports.tr = exports.SendgridService = exports.SecretService = exports.getGcpServiceAccountFromBase64 = exports.EmailService = exports.Layout = exports.EmailCategory = exports.Content = exports.SentryService = exports.getSentry = exports.getLogger = exports.handleRequest = exports.useCloudTaskDecryptMiddleware = exports.requestContext = exports.config = exports.getExpressTrpcApp = exports.getDefaultConfig = exports.createServiceCache = exports.getDistributedCacheInvalidator = exports.DistributedCacheInvalidator = exports.Container = exports.TRPCError = exports.Cache = void 0;
|
|
4
4
|
const Cache_1 = require("./Cache");
|
|
5
5
|
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_1.Cache; } });
|
|
6
|
+
var server_1 = require("@trpc/server");
|
|
7
|
+
Object.defineProperty(exports, "TRPCError", { enumerable: true, get: function () { return server_1.TRPCError; } });
|
|
8
|
+
////////////////////////
|
|
9
|
+
// Container System
|
|
10
|
+
////////////////////////
|
|
11
|
+
var Container_1 = require("./container/Container");
|
|
12
|
+
Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return Container_1.Container; } });
|
|
13
|
+
var DistributedCacheInvalidator_1 = require("./container/DistributedCacheInvalidator");
|
|
14
|
+
Object.defineProperty(exports, "DistributedCacheInvalidator", { enumerable: true, get: function () { return DistributedCacheInvalidator_1.DistributedCacheInvalidator; } });
|
|
15
|
+
Object.defineProperty(exports, "getDistributedCacheInvalidator", { enumerable: true, get: function () { return DistributedCacheInvalidator_1.getDistributedCacheInvalidator; } });
|
|
16
|
+
var LruCache_1 = require("./container/LruCache");
|
|
17
|
+
Object.defineProperty(exports, "createServiceCache", { enumerable: true, get: function () { return LruCache_1.createServiceCache; } });
|
|
18
|
+
var ExpressTrpcAppConfig_1 = require("./server/bootstraps/ExpressTrpcAppConfig");
|
|
19
|
+
Object.defineProperty(exports, "getDefaultConfig", { enumerable: true, get: function () { return ExpressTrpcAppConfig_1.getDefaultConfig; } });
|
|
6
20
|
// New backend package
|
|
7
21
|
var getExpressTrpcApp_1 = require("./server/bootstraps/getExpressTrpcApp");
|
|
8
22
|
Object.defineProperty(exports, "getExpressTrpcApp", { enumerable: true, get: function () { return getExpressTrpcApp_1.getExpressTrpcApp; } });
|
|
9
|
-
var sentry_service_1 = require("./server/sentry/sentry.service");
|
|
10
|
-
Object.defineProperty(exports, "SentryService", { enumerable: true, get: function () { return sentry_service_1.SentryService; } });
|
|
11
|
-
var getSentry_1 = require("./server/sentry/getSentry");
|
|
12
|
-
Object.defineProperty(exports, "getSentry", { enumerable: true, get: function () { return getSentry_1.getSentry; } });
|
|
13
|
-
var logger_service_1 = require("./server/middleware/logger/logger.service");
|
|
14
|
-
Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return logger_service_1.getLogger; } });
|
|
15
|
-
var handleRequest_middleware_1 = require("./server/middleware/handleRequest.middleware");
|
|
16
|
-
Object.defineProperty(exports, "handleRequest", { enumerable: true, get: function () { return handleRequest_middleware_1.handleRequest; } });
|
|
17
|
-
var cloudTaskDecrypt_middleware_1 = require("./server/middleware/cloudTaskDecrypt.middleware");
|
|
18
|
-
Object.defineProperty(exports, "useCloudTaskDecryptMiddleware", { enumerable: true, get: function () { return cloudTaskDecrypt_middleware_1.useCloudTaskDecryptMiddleware; } });
|
|
19
|
-
var trpc_1 = require("./server/trpc");
|
|
20
|
-
Object.defineProperty(exports, "getTrpc", { enumerable: true, get: function () { return trpc_1.getTrpc; } });
|
|
21
|
-
var request_context_1 = require("./server/context/request.context");
|
|
22
|
-
Object.defineProperty(exports, "requestContext", { enumerable: true, get: function () { return request_context_1.requestContext; } });
|
|
23
|
-
var trpc_mock_1 = require("./server/test/trpc.mock");
|
|
24
|
-
Object.defineProperty(exports, "mockedAuthenticatedTrpcRouter", { enumerable: true, get: function () { return trpc_mock_1.mockedAuthenticatedTrpcRouter; } });
|
|
25
23
|
var consts_1 = require("./server/consts");
|
|
26
24
|
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return consts_1.config; } });
|
|
27
|
-
var
|
|
28
|
-
Object.defineProperty(exports, "
|
|
25
|
+
var request_context_1 = require("./server/context/request.context");
|
|
26
|
+
Object.defineProperty(exports, "requestContext", { enumerable: true, get: function () { return request_context_1.requestContext; } });
|
|
27
|
+
var cloudTaskDecrypt_middleware_1 = require("./server/middleware/cloudTaskDecrypt.middleware");
|
|
28
|
+
Object.defineProperty(exports, "useCloudTaskDecryptMiddleware", { enumerable: true, get: function () { return cloudTaskDecrypt_middleware_1.useCloudTaskDecryptMiddleware; } });
|
|
29
|
+
var handleRequest_middleware_1 = require("./server/middleware/handleRequest.middleware");
|
|
30
|
+
Object.defineProperty(exports, "handleRequest", { enumerable: true, get: function () { return handleRequest_middleware_1.handleRequest; } });
|
|
31
|
+
var logger_service_1 = require("./server/middleware/logger/logger.service");
|
|
32
|
+
Object.defineProperty(exports, "getLogger", { enumerable: true, get: function () { return logger_service_1.getLogger; } });
|
|
33
|
+
var getSentry_1 = require("./server/sentry/getSentry");
|
|
34
|
+
Object.defineProperty(exports, "getSentry", { enumerable: true, get: function () { return getSentry_1.getSentry; } });
|
|
35
|
+
var sentry_service_1 = require("./server/sentry/sentry.service");
|
|
36
|
+
Object.defineProperty(exports, "SentryService", { enumerable: true, get: function () { return sentry_service_1.SentryService; } });
|
|
29
37
|
var email_model_1 = require("./server/services/email/email.model");
|
|
30
|
-
Object.defineProperty(exports, "Layout", { enumerable: true, get: function () { return email_model_1.Layout; } });
|
|
31
38
|
Object.defineProperty(exports, "Content", { enumerable: true, get: function () { return email_model_1.Content; } });
|
|
32
39
|
Object.defineProperty(exports, "EmailCategory", { enumerable: true, get: function () { return email_model_1.EmailCategory; } });
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
Object.defineProperty(exports, "Layout", { enumerable: true, get: function () { return email_model_1.Layout; } });
|
|
41
|
+
var email_service_1 = require("./server/services/email/email.service");
|
|
42
|
+
Object.defineProperty(exports, "EmailService", { enumerable: true, get: function () { return email_service_1.EmailService; } });
|
|
35
43
|
var getGcpServiceAccountFromBase64_1 = require("./server/services/gcp/getGcpServiceAccountFromBase64");
|
|
36
44
|
Object.defineProperty(exports, "getGcpServiceAccountFromBase64", { enumerable: true, get: function () { return getGcpServiceAccountFromBase64_1.getGcpServiceAccountFromBase64; } });
|
|
37
45
|
var secret_service_1 = require("./server/services/secrets/secret.service");
|
|
38
46
|
Object.defineProperty(exports, "SecretService", { enumerable: true, get: function () { return secret_service_1.SecretService; } });
|
|
39
|
-
var
|
|
40
|
-
Object.defineProperty(exports, "
|
|
41
|
-
var pagination_1 = require("./server/services/util/pagination");
|
|
42
|
-
Object.defineProperty(exports, "paginationUtility", { enumerable: true, get: function () { return pagination_1.paginationUtility; } });
|
|
43
|
-
var server_1 = require("@trpc/server");
|
|
44
|
-
Object.defineProperty(exports, "TRPCError", { enumerable: true, get: function () { return server_1.TRPCError; } });
|
|
47
|
+
var sendgridApi_service_1 = require("./server/services/sendgrid/sendgridApi.service");
|
|
48
|
+
Object.defineProperty(exports, "SendgridService", { enumerable: true, get: function () { return sendgridApi_service_1.SendgridService; } });
|
|
45
49
|
var translation_service_1 = require("./server/services/translations/translation.service");
|
|
46
|
-
Object.defineProperty(exports, "translationService", { enumerable: true, get: function () { return translation_service_1.translationService; } });
|
|
47
50
|
Object.defineProperty(exports, "tr", { enumerable: true, get: function () { return translation_service_1.tr; } });
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
Object.defineProperty(exports, "
|
|
53
|
-
var
|
|
54
|
-
Object.defineProperty(exports, "
|
|
55
|
-
var
|
|
56
|
-
Object.defineProperty(exports, "
|
|
57
|
-
Object.defineProperty(exports, "getDistributedCacheInvalidator", { enumerable: true, get: function () { return DistributedCacheInvalidator_1.getDistributedCacheInvalidator; } });
|
|
51
|
+
Object.defineProperty(exports, "translationService", { enumerable: true, get: function () { return translation_service_1.translationService; } });
|
|
52
|
+
var pagination_1 = require("./server/services/util/pagination");
|
|
53
|
+
Object.defineProperty(exports, "paginationUtility", { enumerable: true, get: function () { return pagination_1.paginationUtility; } });
|
|
54
|
+
var url_service_1 = require("./server/services/util/url.service");
|
|
55
|
+
Object.defineProperty(exports, "UrlService", { enumerable: true, get: function () { return url_service_1.UrlService; } });
|
|
56
|
+
var trpc_mock_1 = require("./server/test/trpc.mock");
|
|
57
|
+
Object.defineProperty(exports, "mockedAuthenticatedTrpcRouter", { enumerable: true, get: function () { return trpc_mock_1.mockedAuthenticatedTrpcRouter; } });
|
|
58
|
+
var trpc_1 = require("./server/trpc");
|
|
59
|
+
Object.defineProperty(exports, "getTrpc", { enumerable: true, get: function () { return trpc_1.getTrpc; } });
|
|
58
60
|
////////////////////////
|
|
59
61
|
// Zod Compatibility
|
|
60
62
|
////////////////////////
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,mCAA+B;AAEtB,sFAFA,aAAK,OAEA;AAId,uCAAwC;AAA/B,mGAAA,SAAS,OAAA;AAElB,wBAAwB;AACxB,mBAAmB;AACnB,wBAAwB;AACxB,mDAAiD;AAAxC,sGAAA,SAAS,OAAA;AAClB,uFAGgD;AAF9C,0IAAA,2BAA2B,OAAA;AAC3B,6IAAA,8BAA8B,OAAA;AAEhC,iDAAyD;AAAhD,8GAAA,kBAAkB,OAAA;AAe3B,iFAA2E;AAAlE,wHAAA,gBAAgB,OAAA;AACzB,sBAAsB;AACtB,2EAAyE;AAAhE,sHAAA,iBAAiB,OAAA;AAE1B,0CAAwC;AAA/B,gGAAA,MAAM,OAAA;AAEf,oEAAiE;AAAxD,iHAAA,cAAc,OAAA;AACvB,+FAA+F;AAAtF,4IAAA,6BAA6B,OAAA;AACtC,yFAA4E;AAAnE,yHAAA,aAAa,OAAA;AACtB,4EAAqE;AAA5D,2GAAA,SAAS,OAAA;AAClB,uDAAqD;AAA5C,sGAAA,SAAS,OAAA;AAClB,iEAA8D;AAArD,+GAAA,aAAa,OAAA;AAMtB,mEAI4C;AAH1C,sGAAA,OAAO,OAAA;AACP,4GAAA,aAAa,OAAA;AACb,qGAAA,MAAM,OAAA;AAER,uEAAoE;AAA3D,6GAAA,YAAY,OAAA;AACrB,uGAAqG;AAA5F,gJAAA,8BAA8B,OAAA;AAKvC,2EAAwE;AAA/D,+GAAA,aAAa,OAAA;AAEtB,sFAAgF;AAAvE,sHAAA,eAAe,OAAA;AACxB,0FAG2D;AAFzD,yGAAA,EAAE,OAAA;AACF,yHAAA,kBAAkB,OAAA;AAEpB,gEAAqE;AAA5D,+GAAA,iBAAiB,OAAA;AAC1B,kEAA+D;AAAtD,yGAAA,UAAU,OAAA;AACnB,qDAAuE;AAA9D,0HAAA,6BAA6B,OAAA;AACtC,sCAAuC;AAA9B,+FAAA,OAAO,OAAA;AAGhB,wBAAwB;AACxB,oBAAoB;AACpB,wBAAwB;AACxB,mDAAgD"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { CommonLogger } from '@goatlab/js-utils';
|
|
2
|
+
import type { BuiltRouter } from '@trpc/server/unstable-core-do-not-import';
|
|
3
|
+
import type { RequestHandler, Router } from 'express';
|
|
4
|
+
import type { SentryService } from '../sentry/sentry.service';
|
|
5
|
+
import type { Environment } from '../types/Envinronment';
|
|
6
|
+
export interface RequiredExpressTrpcAppConfig {
|
|
7
|
+
trpcRouter: BuiltRouter<any, any>;
|
|
8
|
+
}
|
|
9
|
+
export interface OptionalExpressTrpcAppConfig {
|
|
10
|
+
appName?: string;
|
|
11
|
+
appVersion?: string;
|
|
12
|
+
port?: number;
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
environment?: Environment;
|
|
15
|
+
sentryService?: SentryService;
|
|
16
|
+
logger?: CommonLogger;
|
|
17
|
+
expressResources?: Router[] | readonly Router[];
|
|
18
|
+
customHandlers?: RequestHandler[];
|
|
19
|
+
features?: {
|
|
20
|
+
openApiDocs?: boolean;
|
|
21
|
+
sentry?: boolean;
|
|
22
|
+
trustProxy?: boolean;
|
|
23
|
+
etag?: 'weak' | 'strong' | boolean;
|
|
24
|
+
};
|
|
25
|
+
security?: {
|
|
26
|
+
cors?: {
|
|
27
|
+
allowedOrigins?: string[];
|
|
28
|
+
credentials?: boolean;
|
|
29
|
+
maxAge?: number;
|
|
30
|
+
};
|
|
31
|
+
helmet?: {
|
|
32
|
+
contentSecurityPolicy?: boolean | object;
|
|
33
|
+
crossOriginEmbedderPolicy?: boolean;
|
|
34
|
+
};
|
|
35
|
+
rateLimit?: {
|
|
36
|
+
global?: {
|
|
37
|
+
windowMs?: number;
|
|
38
|
+
max?: number;
|
|
39
|
+
};
|
|
40
|
+
auth?: {
|
|
41
|
+
windowMs?: number;
|
|
42
|
+
max?: number;
|
|
43
|
+
};
|
|
44
|
+
api?: {
|
|
45
|
+
windowMs?: number;
|
|
46
|
+
max?: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
requestTimeout?: number;
|
|
50
|
+
};
|
|
51
|
+
bodyParsing?: {
|
|
52
|
+
json?: {
|
|
53
|
+
limit?: string;
|
|
54
|
+
type?: string[];
|
|
55
|
+
};
|
|
56
|
+
urlencoded?: {
|
|
57
|
+
limit?: string;
|
|
58
|
+
extended?: boolean;
|
|
59
|
+
};
|
|
60
|
+
raw?: {
|
|
61
|
+
limit?: string;
|
|
62
|
+
inflate?: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
performance?: {
|
|
66
|
+
compression?: {
|
|
67
|
+
enabled?: boolean;
|
|
68
|
+
level?: number;
|
|
69
|
+
threshold?: number;
|
|
70
|
+
chunkSize?: number;
|
|
71
|
+
memLevel?: number;
|
|
72
|
+
};
|
|
73
|
+
memoryMonitoring?: {
|
|
74
|
+
enabled?: boolean;
|
|
75
|
+
warningThreshold?: number;
|
|
76
|
+
criticalThreshold?: number;
|
|
77
|
+
monitorInterval?: number;
|
|
78
|
+
enableGarbageCollection?: boolean;
|
|
79
|
+
addHeaders?: boolean;
|
|
80
|
+
};
|
|
81
|
+
caching?: {
|
|
82
|
+
staticAssets?: {
|
|
83
|
+
maxAge?: number;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
server?: {
|
|
88
|
+
viewEngine?: string;
|
|
89
|
+
viewPaths?: string[];
|
|
90
|
+
};
|
|
91
|
+
healthCheck?: {
|
|
92
|
+
path?: string;
|
|
93
|
+
customChecks?: () => Promise<any>;
|
|
94
|
+
};
|
|
95
|
+
readyCheck?: {
|
|
96
|
+
path?: string;
|
|
97
|
+
customChecks?: () => Promise<any>;
|
|
98
|
+
};
|
|
99
|
+
processManagement?: {
|
|
100
|
+
gracefulShutdown?: {
|
|
101
|
+
enabled?: boolean;
|
|
102
|
+
timeout?: number;
|
|
103
|
+
onShutdown?: () => Promise<void>;
|
|
104
|
+
};
|
|
105
|
+
uncaughtException?: {
|
|
106
|
+
handler?: (error: Error) => void;
|
|
107
|
+
};
|
|
108
|
+
unhandledRejection?: {
|
|
109
|
+
handler?: (reason: any, promise: Promise<any>) => void;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export type ExpressTrpcAppConfig = RequiredExpressTrpcAppConfig & Required<OptionalExpressTrpcAppConfig>;
|
|
114
|
+
export type ExpressTrpcAppConfigInput = RequiredExpressTrpcAppConfig & Partial<OptionalExpressTrpcAppConfig>;
|
|
115
|
+
/**
|
|
116
|
+
* Get complete default configuration
|
|
117
|
+
*/
|
|
118
|
+
export declare function getDefaultConfig(userConfig: ExpressTrpcAppConfigInput): ExpressTrpcAppConfig;
|