@dereekb/nestjs 13.11.17 → 13.12.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/discord/package.json +4 -4
- package/discord/src/lib/discord.api.spec.client.d.ts +20 -0
- package/eslint/index.cjs.js +148 -115
- package/eslint/index.esm.js +148 -115
- package/eslint/package.json +1 -1
- package/mailgun/package.json +6 -6
- package/openai/package.json +6 -6
- package/package.json +11 -4
- package/stripe/package.json +6 -6
- package/twilio/index.cjs.default.js +1 -0
- package/twilio/index.cjs.js +2184 -0
- package/twilio/index.cjs.mjs +2 -0
- package/twilio/index.d.ts +1 -0
- package/twilio/index.esm.js +2159 -0
- package/twilio/package.json +27 -0
- package/twilio/src/index.d.ts +1 -0
- package/twilio/src/lib/index.d.ts +8 -0
- package/twilio/src/lib/lookup/index.d.ts +4 -0
- package/twilio/src/lib/lookup/lookup.api.d.ts +7 -0
- package/twilio/src/lib/lookup/lookup.module.d.ts +7 -0
- package/twilio/src/lib/lookup/lookup.service.d.ts +39 -0
- package/twilio/src/lib/lookup/lookup.type.d.ts +37 -0
- package/twilio/src/lib/twilio.api.d.ts +13 -0
- package/twilio/src/lib/twilio.config.d.ts +71 -0
- package/twilio/src/lib/twilio.module.d.ts +17 -0
- package/twilio/src/lib/twilio.service.d.ts +91 -0
- package/twilio/src/lib/twilio.type.d.ts +53 -0
- package/twilio/src/lib/verify/index.d.ts +4 -0
- package/twilio/src/lib/verify/verify.api.d.ts +10 -0
- package/twilio/src/lib/verify/verify.config.d.ts +22 -0
- package/twilio/src/lib/verify/verify.module.d.ts +17 -0
- package/twilio/src/lib/verify/verify.service.d.ts +83 -0
- package/twilio/src/lib/webhook/index.d.ts +6 -0
- package/twilio/src/lib/webhook/webhook.twilio.config.d.ts +28 -0
- package/twilio/src/lib/webhook/webhook.twilio.controller.d.ts +9 -0
- package/twilio/src/lib/webhook/webhook.twilio.d.ts +68 -0
- package/twilio/src/lib/webhook/webhook.twilio.module.d.ts +22 -0
- package/twilio/src/lib/webhook/webhook.twilio.service.d.ts +21 -0
- package/twilio/src/lib/webhook/webhook.twilio.verify.d.ts +53 -0
- package/typeform/package.json +6 -6
- package/vapiai/package.json +6 -6
package/discord/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/discord",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.12.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/nestjs": "13.
|
|
6
|
-
"@dereekb/rxjs": "13.
|
|
7
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/nestjs": "13.12.0",
|
|
6
|
+
"@dereekb/rxjs": "13.12.0",
|
|
7
|
+
"@dereekb/util": "13.12.0",
|
|
8
8
|
"@nestjs/common": "^11.1.19",
|
|
9
9
|
"@nestjs/config": "^4.0.4",
|
|
10
10
|
"discord.js": "^14.26.3",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DiscordApi } from './discord.api';
|
|
2
|
+
/**
|
|
3
|
+
* Shared, process-singleton Discord test client.
|
|
4
|
+
*
|
|
5
|
+
* Integration spec files import {@link getSharedDiscordTestClient} so that at most one
|
|
6
|
+
* `client.login()` call occurs per vitest worker process, regardless of how many spec
|
|
7
|
+
* files participate. This keeps the bot's daily gateway-session quota intact during
|
|
8
|
+
* normal development.
|
|
9
|
+
*/
|
|
10
|
+
export interface SharedDiscordTestClient {
|
|
11
|
+
readonly discordApi: DiscordApi;
|
|
12
|
+
readonly testChannelId: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the shared logged-in test client, creating it on first call and reusing it
|
|
16
|
+
* on subsequent calls within the same process.
|
|
17
|
+
*
|
|
18
|
+
* @returns The cached {@link SharedDiscordTestClient}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getSharedDiscordTestClient(): Promise<SharedDiscordTestClient>;
|
package/eslint/index.cjs.js
CHANGED
|
@@ -126,6 +126,59 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
126
126
|
}
|
|
127
127
|
return tokenName;
|
|
128
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns the first class decorator that is both in `classDecorators` and imported from '@nestjs/common'.
|
|
131
|
+
*
|
|
132
|
+
* @param classNode - The ClassDeclaration AST node.
|
|
133
|
+
* @param classDecorators - Class decorator names that trigger this rule.
|
|
134
|
+
* @param nestjsImports - Identifiers known to be imported from '@nestjs/common'.
|
|
135
|
+
* @returns The matched decorator node, or undefined when none matches.
|
|
136
|
+
*/ function findMatchedClassDecorator(classNode, classDecorators, nestjsImports) {
|
|
137
|
+
var decorators = classNode.decorators;
|
|
138
|
+
if (!decorators || decorators.length === 0) return undefined;
|
|
139
|
+
return decorators.find(function(d) {
|
|
140
|
+
var name = getDecoratorName(d);
|
|
141
|
+
return classDecorators.has(name) && nestjsImports.has(name);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Returns the constructor parameter list of a class declaration, if a constructor is present.
|
|
146
|
+
*
|
|
147
|
+
* @param classNode - The ClassDeclaration AST node.
|
|
148
|
+
* @returns The parameter list, or undefined when there's no constructor.
|
|
149
|
+
*/ function findConstructorParams(classNode) {
|
|
150
|
+
var constructor = classNode.body.body.find(function(member) {
|
|
151
|
+
return member.type === 'MethodDefinition' && member.kind === 'constructor';
|
|
152
|
+
});
|
|
153
|
+
return constructor === null || constructor === void 0 ? void 0 : constructor.value.params;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Builds the fixer for converting a type-only import into a value import so it
|
|
157
|
+
* can be used as an `@Inject()` token at runtime.
|
|
158
|
+
*
|
|
159
|
+
* @param fixer - The ESLint fixer instance.
|
|
160
|
+
* @param typeImportInfo - Info about the type-only import to convert.
|
|
161
|
+
* @returns The fixer command produced by `fixer.removeRange`.
|
|
162
|
+
*/ function buildTypeOnlyImportFix(fixer, typeImportInfo) {
|
|
163
|
+
var fixResult;
|
|
164
|
+
if (typeImportInfo.isDeclarationLevel) {
|
|
165
|
+
// `import type { X } from '...'` → `import { X } from '...'`
|
|
166
|
+
var importKeywordEnd = typeImportInfo.declaration.range[0] + 'import '.length;
|
|
167
|
+
fixResult = fixer.removeRange([
|
|
168
|
+
importKeywordEnd,
|
|
169
|
+
importKeywordEnd + 'type '.length
|
|
170
|
+
]);
|
|
171
|
+
} else {
|
|
172
|
+
// `import { type X }` → `import { X }`
|
|
173
|
+
var specRange = typeImportInfo.specifier.range;
|
|
174
|
+
var importedRange = typeImportInfo.specifier.imported.range;
|
|
175
|
+
fixResult = fixer.removeRange([
|
|
176
|
+
specRange[0],
|
|
177
|
+
importedRange[0]
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
return fixResult;
|
|
181
|
+
}
|
|
129
182
|
/**
|
|
130
183
|
* ESLint rule requiring @Inject() on all constructor parameters in NestJS injectable classes.
|
|
131
184
|
*
|
|
@@ -239,128 +292,108 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
239
292
|
}
|
|
240
293
|
},
|
|
241
294
|
ClassDeclaration: function ClassDeclaration(classNode) {
|
|
242
|
-
var
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
var
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
295
|
+
var matchedClassDecorator = findMatchedClassDecorator(classNode, classDecorators, nestjsImports);
|
|
296
|
+
if (!matchedClassDecorator) return;
|
|
297
|
+
var params = findConstructorParams(classNode);
|
|
298
|
+
if (!params || params.length === 0) return;
|
|
299
|
+
var classDecoratorName = getDecoratorName(matchedClassDecorator);
|
|
300
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
301
|
+
try {
|
|
302
|
+
for(var _iterator = params[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
303
|
+
var param = _step.value;
|
|
304
|
+
processConstructorParam(param, classDecoratorName);
|
|
305
|
+
}
|
|
306
|
+
} catch (err) {
|
|
307
|
+
_didIteratorError = true;
|
|
308
|
+
_iteratorError = err;
|
|
309
|
+
} finally{
|
|
255
310
|
try {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
var hasValidDecorator = paramDecoratorsOnNode && paramDecoratorsOnNode.length > 0 && paramDecoratorsOnNode.some(function(d) {
|
|
260
|
-
return paramDecorators.has(getDecoratorName(d));
|
|
261
|
-
});
|
|
262
|
-
if (hasValidDecorator) {
|
|
263
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
264
|
-
try {
|
|
265
|
-
var _loop = function() {
|
|
266
|
-
var decorator = _step1.value;
|
|
267
|
-
var tokenName = getInjectTokenFromDecorator(decorator);
|
|
268
|
-
if (tokenName) {
|
|
269
|
-
var typeImportInfo = typeOnlyImports.get(tokenName);
|
|
270
|
-
if (typeImportInfo) {
|
|
271
|
-
context.report({
|
|
272
|
-
node: decorator,
|
|
273
|
-
messageId: 'typeOnlyInjectToken',
|
|
274
|
-
data: {
|
|
275
|
-
token: tokenName
|
|
276
|
-
},
|
|
277
|
-
fix: function fix(fixer) {
|
|
278
|
-
var fixResult;
|
|
279
|
-
if (typeImportInfo.isDeclarationLevel) {
|
|
280
|
-
// `import type { X } from '...'` → `import { X } from '...'`
|
|
281
|
-
// Remove 'type ' after 'import '
|
|
282
|
-
var importKeywordEnd = typeImportInfo.declaration.range[0] + 'import '.length;
|
|
283
|
-
fixResult = fixer.removeRange([
|
|
284
|
-
importKeywordEnd,
|
|
285
|
-
importKeywordEnd + 'type '.length
|
|
286
|
-
]);
|
|
287
|
-
} else {
|
|
288
|
-
// `import { type X }` → `import { X }`
|
|
289
|
-
// The specifier range includes 'type X', so remove 'type ' prefix
|
|
290
|
-
var specRange = typeImportInfo.specifier.range;
|
|
291
|
-
var importedRange = typeImportInfo.specifier.imported.range;
|
|
292
|
-
fixResult = fixer.removeRange([
|
|
293
|
-
specRange[0],
|
|
294
|
-
importedRange[0]
|
|
295
|
-
]);
|
|
296
|
-
}
|
|
297
|
-
return fixResult;
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
// Remove from tracking so we don't report the same import twice
|
|
301
|
-
typeOnlyImports.delete(tokenName);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
// Has @Inject() — check if the injection token is a type-only import
|
|
306
|
-
for(var _iterator = paramDecoratorsOnNode[Symbol.iterator](), _step1; !(_iteratorNormalCompletion = (_step1 = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
307
|
-
} catch (err) {
|
|
308
|
-
_didIteratorError = true;
|
|
309
|
-
_iteratorError = err;
|
|
310
|
-
} finally{
|
|
311
|
-
try {
|
|
312
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
313
|
-
_iterator.return();
|
|
314
|
-
}
|
|
315
|
-
} finally{
|
|
316
|
-
if (_didIteratorError) {
|
|
317
|
-
throw _iteratorError;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
} else {
|
|
322
|
-
// Missing @Inject() entirely
|
|
323
|
-
var tokenName = getInjectTokenName(param);
|
|
324
|
-
context.report({
|
|
325
|
-
node: param,
|
|
326
|
-
messageId: 'missingInject',
|
|
327
|
-
data: {
|
|
328
|
-
name: getParamName(param),
|
|
329
|
-
classDecorator: classDecoratorName
|
|
330
|
-
},
|
|
331
|
-
fix: tokenName ? function(fixer) {
|
|
332
|
-
var fixes = [];
|
|
333
|
-
fixes.push(fixer.insertTextBefore(param, "@Inject(".concat(tokenName, ") ")));
|
|
334
|
-
if (!nestjsImports.has('Inject') && nestjsImportNode) {
|
|
335
|
-
var lastSpecifier = nestjsImportNode.specifiers[nestjsImportNode.specifiers.length - 1];
|
|
336
|
-
if (lastSpecifier) {
|
|
337
|
-
fixes.push(fixer.insertTextAfter(lastSpecifier, ', Inject'));
|
|
338
|
-
}
|
|
339
|
-
nestjsImports.add('Inject');
|
|
340
|
-
}
|
|
341
|
-
return fixes;
|
|
342
|
-
} : undefined
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
for(var _iterator = params[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
347
|
-
} catch (err) {
|
|
348
|
-
_didIteratorError = true;
|
|
349
|
-
_iteratorError = err;
|
|
311
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
312
|
+
_iterator.return();
|
|
313
|
+
}
|
|
350
314
|
} finally{
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
_iterator.return();
|
|
354
|
-
}
|
|
355
|
-
} finally{
|
|
356
|
-
if (_didIteratorError) {
|
|
357
|
-
throw _iteratorError;
|
|
358
|
-
}
|
|
315
|
+
if (_didIteratorError) {
|
|
316
|
+
throw _iteratorError;
|
|
359
317
|
}
|
|
360
318
|
}
|
|
361
319
|
}
|
|
362
320
|
}
|
|
363
321
|
};
|
|
322
|
+
function processConstructorParam(param, classDecoratorName) {
|
|
323
|
+
var paramDecoratorsOnNode = param.decorators;
|
|
324
|
+
var hasValidDecorator = paramDecoratorsOnNode && paramDecoratorsOnNode.length > 0 && paramDecoratorsOnNode.some(function(d) {
|
|
325
|
+
return paramDecorators.has(getDecoratorName(d));
|
|
326
|
+
});
|
|
327
|
+
if (hasValidDecorator) {
|
|
328
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
329
|
+
try {
|
|
330
|
+
for(var _iterator = paramDecoratorsOnNode[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
331
|
+
var decorator = _step.value;
|
|
332
|
+
reportTypeOnlyTokenIfAny(decorator);
|
|
333
|
+
}
|
|
334
|
+
} catch (err) {
|
|
335
|
+
_didIteratorError = true;
|
|
336
|
+
_iteratorError = err;
|
|
337
|
+
} finally{
|
|
338
|
+
try {
|
|
339
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
340
|
+
_iterator.return();
|
|
341
|
+
}
|
|
342
|
+
} finally{
|
|
343
|
+
if (_didIteratorError) {
|
|
344
|
+
throw _iteratorError;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
reportMissingInject(param, classDecoratorName);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function reportTypeOnlyTokenIfAny(decorator) {
|
|
353
|
+
var tokenName = getInjectTokenFromDecorator(decorator);
|
|
354
|
+
if (!tokenName) return;
|
|
355
|
+
var typeImportInfo = typeOnlyImports.get(tokenName);
|
|
356
|
+
if (!typeImportInfo) return;
|
|
357
|
+
context.report({
|
|
358
|
+
node: decorator,
|
|
359
|
+
messageId: 'typeOnlyInjectToken',
|
|
360
|
+
data: {
|
|
361
|
+
token: tokenName
|
|
362
|
+
},
|
|
363
|
+
fix: function fix(fixer) {
|
|
364
|
+
return buildTypeOnlyImportFix(fixer, typeImportInfo);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
// Remove from tracking so we don't report the same import twice
|
|
368
|
+
typeOnlyImports.delete(tokenName);
|
|
369
|
+
}
|
|
370
|
+
function reportMissingInject(param, classDecoratorName) {
|
|
371
|
+
var tokenName = getInjectTokenName(param);
|
|
372
|
+
context.report({
|
|
373
|
+
node: param,
|
|
374
|
+
messageId: 'missingInject',
|
|
375
|
+
data: {
|
|
376
|
+
name: getParamName(param),
|
|
377
|
+
classDecorator: classDecoratorName
|
|
378
|
+
},
|
|
379
|
+
fix: tokenName ? function(fixer) {
|
|
380
|
+
return buildMissingInjectFix(fixer, param, tokenName);
|
|
381
|
+
} : undefined
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
function buildMissingInjectFix(fixer, param, tokenName) {
|
|
385
|
+
var fixes = [
|
|
386
|
+
fixer.insertTextBefore(param, "@Inject(".concat(tokenName, ") "))
|
|
387
|
+
];
|
|
388
|
+
if (!nestjsImports.has('Inject') && nestjsImportNode) {
|
|
389
|
+
var lastSpecifier = nestjsImportNode.specifiers[nestjsImportNode.specifiers.length - 1];
|
|
390
|
+
if (lastSpecifier) {
|
|
391
|
+
fixes.push(fixer.insertTextAfter(lastSpecifier, ', Inject'));
|
|
392
|
+
}
|
|
393
|
+
nestjsImports.add('Inject');
|
|
394
|
+
}
|
|
395
|
+
return fixes;
|
|
396
|
+
}
|
|
364
397
|
}
|
|
365
398
|
};
|
|
366
399
|
|
package/eslint/index.esm.js
CHANGED
|
@@ -124,6 +124,59 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
124
124
|
}
|
|
125
125
|
return tokenName;
|
|
126
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Returns the first class decorator that is both in `classDecorators` and imported from '@nestjs/common'.
|
|
129
|
+
*
|
|
130
|
+
* @param classNode - The ClassDeclaration AST node.
|
|
131
|
+
* @param classDecorators - Class decorator names that trigger this rule.
|
|
132
|
+
* @param nestjsImports - Identifiers known to be imported from '@nestjs/common'.
|
|
133
|
+
* @returns The matched decorator node, or undefined when none matches.
|
|
134
|
+
*/ function findMatchedClassDecorator(classNode, classDecorators, nestjsImports) {
|
|
135
|
+
var decorators = classNode.decorators;
|
|
136
|
+
if (!decorators || decorators.length === 0) return undefined;
|
|
137
|
+
return decorators.find(function(d) {
|
|
138
|
+
var name = getDecoratorName(d);
|
|
139
|
+
return classDecorators.has(name) && nestjsImports.has(name);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Returns the constructor parameter list of a class declaration, if a constructor is present.
|
|
144
|
+
*
|
|
145
|
+
* @param classNode - The ClassDeclaration AST node.
|
|
146
|
+
* @returns The parameter list, or undefined when there's no constructor.
|
|
147
|
+
*/ function findConstructorParams(classNode) {
|
|
148
|
+
var constructor = classNode.body.body.find(function(member) {
|
|
149
|
+
return member.type === 'MethodDefinition' && member.kind === 'constructor';
|
|
150
|
+
});
|
|
151
|
+
return constructor === null || constructor === void 0 ? void 0 : constructor.value.params;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Builds the fixer for converting a type-only import into a value import so it
|
|
155
|
+
* can be used as an `@Inject()` token at runtime.
|
|
156
|
+
*
|
|
157
|
+
* @param fixer - The ESLint fixer instance.
|
|
158
|
+
* @param typeImportInfo - Info about the type-only import to convert.
|
|
159
|
+
* @returns The fixer command produced by `fixer.removeRange`.
|
|
160
|
+
*/ function buildTypeOnlyImportFix(fixer, typeImportInfo) {
|
|
161
|
+
var fixResult;
|
|
162
|
+
if (typeImportInfo.isDeclarationLevel) {
|
|
163
|
+
// `import type { X } from '...'` → `import { X } from '...'`
|
|
164
|
+
var importKeywordEnd = typeImportInfo.declaration.range[0] + 'import '.length;
|
|
165
|
+
fixResult = fixer.removeRange([
|
|
166
|
+
importKeywordEnd,
|
|
167
|
+
importKeywordEnd + 'type '.length
|
|
168
|
+
]);
|
|
169
|
+
} else {
|
|
170
|
+
// `import { type X }` → `import { X }`
|
|
171
|
+
var specRange = typeImportInfo.specifier.range;
|
|
172
|
+
var importedRange = typeImportInfo.specifier.imported.range;
|
|
173
|
+
fixResult = fixer.removeRange([
|
|
174
|
+
specRange[0],
|
|
175
|
+
importedRange[0]
|
|
176
|
+
]);
|
|
177
|
+
}
|
|
178
|
+
return fixResult;
|
|
179
|
+
}
|
|
127
180
|
/**
|
|
128
181
|
* ESLint rule requiring @Inject() on all constructor parameters in NestJS injectable classes.
|
|
129
182
|
*
|
|
@@ -237,128 +290,108 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
237
290
|
}
|
|
238
291
|
},
|
|
239
292
|
ClassDeclaration: function ClassDeclaration(classNode) {
|
|
240
|
-
var
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
293
|
+
var matchedClassDecorator = findMatchedClassDecorator(classNode, classDecorators, nestjsImports);
|
|
294
|
+
if (!matchedClassDecorator) return;
|
|
295
|
+
var params = findConstructorParams(classNode);
|
|
296
|
+
if (!params || params.length === 0) return;
|
|
297
|
+
var classDecoratorName = getDecoratorName(matchedClassDecorator);
|
|
298
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
299
|
+
try {
|
|
300
|
+
for(var _iterator = params[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
301
|
+
var param = _step.value;
|
|
302
|
+
processConstructorParam(param, classDecoratorName);
|
|
303
|
+
}
|
|
304
|
+
} catch (err) {
|
|
305
|
+
_didIteratorError = true;
|
|
306
|
+
_iteratorError = err;
|
|
307
|
+
} finally{
|
|
253
308
|
try {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
var hasValidDecorator = paramDecoratorsOnNode && paramDecoratorsOnNode.length > 0 && paramDecoratorsOnNode.some(function(d) {
|
|
258
|
-
return paramDecorators.has(getDecoratorName(d));
|
|
259
|
-
});
|
|
260
|
-
if (hasValidDecorator) {
|
|
261
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
262
|
-
try {
|
|
263
|
-
var _loop = function() {
|
|
264
|
-
var decorator = _step1.value;
|
|
265
|
-
var tokenName = getInjectTokenFromDecorator(decorator);
|
|
266
|
-
if (tokenName) {
|
|
267
|
-
var typeImportInfo = typeOnlyImports.get(tokenName);
|
|
268
|
-
if (typeImportInfo) {
|
|
269
|
-
context.report({
|
|
270
|
-
node: decorator,
|
|
271
|
-
messageId: 'typeOnlyInjectToken',
|
|
272
|
-
data: {
|
|
273
|
-
token: tokenName
|
|
274
|
-
},
|
|
275
|
-
fix: function fix(fixer) {
|
|
276
|
-
var fixResult;
|
|
277
|
-
if (typeImportInfo.isDeclarationLevel) {
|
|
278
|
-
// `import type { X } from '...'` → `import { X } from '...'`
|
|
279
|
-
// Remove 'type ' after 'import '
|
|
280
|
-
var importKeywordEnd = typeImportInfo.declaration.range[0] + 'import '.length;
|
|
281
|
-
fixResult = fixer.removeRange([
|
|
282
|
-
importKeywordEnd,
|
|
283
|
-
importKeywordEnd + 'type '.length
|
|
284
|
-
]);
|
|
285
|
-
} else {
|
|
286
|
-
// `import { type X }` → `import { X }`
|
|
287
|
-
// The specifier range includes 'type X', so remove 'type ' prefix
|
|
288
|
-
var specRange = typeImportInfo.specifier.range;
|
|
289
|
-
var importedRange = typeImportInfo.specifier.imported.range;
|
|
290
|
-
fixResult = fixer.removeRange([
|
|
291
|
-
specRange[0],
|
|
292
|
-
importedRange[0]
|
|
293
|
-
]);
|
|
294
|
-
}
|
|
295
|
-
return fixResult;
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
// Remove from tracking so we don't report the same import twice
|
|
299
|
-
typeOnlyImports.delete(tokenName);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
// Has @Inject() — check if the injection token is a type-only import
|
|
304
|
-
for(var _iterator = paramDecoratorsOnNode[Symbol.iterator](), _step1; !(_iteratorNormalCompletion = (_step1 = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
305
|
-
} catch (err) {
|
|
306
|
-
_didIteratorError = true;
|
|
307
|
-
_iteratorError = err;
|
|
308
|
-
} finally{
|
|
309
|
-
try {
|
|
310
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
311
|
-
_iterator.return();
|
|
312
|
-
}
|
|
313
|
-
} finally{
|
|
314
|
-
if (_didIteratorError) {
|
|
315
|
-
throw _iteratorError;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
} else {
|
|
320
|
-
// Missing @Inject() entirely
|
|
321
|
-
var tokenName = getInjectTokenName(param);
|
|
322
|
-
context.report({
|
|
323
|
-
node: param,
|
|
324
|
-
messageId: 'missingInject',
|
|
325
|
-
data: {
|
|
326
|
-
name: getParamName(param),
|
|
327
|
-
classDecorator: classDecoratorName
|
|
328
|
-
},
|
|
329
|
-
fix: tokenName ? function(fixer) {
|
|
330
|
-
var fixes = [];
|
|
331
|
-
fixes.push(fixer.insertTextBefore(param, "@Inject(".concat(tokenName, ") ")));
|
|
332
|
-
if (!nestjsImports.has('Inject') && nestjsImportNode) {
|
|
333
|
-
var lastSpecifier = nestjsImportNode.specifiers[nestjsImportNode.specifiers.length - 1];
|
|
334
|
-
if (lastSpecifier) {
|
|
335
|
-
fixes.push(fixer.insertTextAfter(lastSpecifier, ', Inject'));
|
|
336
|
-
}
|
|
337
|
-
nestjsImports.add('Inject');
|
|
338
|
-
}
|
|
339
|
-
return fixes;
|
|
340
|
-
} : undefined
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
for(var _iterator = params[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
345
|
-
} catch (err) {
|
|
346
|
-
_didIteratorError = true;
|
|
347
|
-
_iteratorError = err;
|
|
309
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
310
|
+
_iterator.return();
|
|
311
|
+
}
|
|
348
312
|
} finally{
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
_iterator.return();
|
|
352
|
-
}
|
|
353
|
-
} finally{
|
|
354
|
-
if (_didIteratorError) {
|
|
355
|
-
throw _iteratorError;
|
|
356
|
-
}
|
|
313
|
+
if (_didIteratorError) {
|
|
314
|
+
throw _iteratorError;
|
|
357
315
|
}
|
|
358
316
|
}
|
|
359
317
|
}
|
|
360
318
|
}
|
|
361
319
|
};
|
|
320
|
+
function processConstructorParam(param, classDecoratorName) {
|
|
321
|
+
var paramDecoratorsOnNode = param.decorators;
|
|
322
|
+
var hasValidDecorator = paramDecoratorsOnNode && paramDecoratorsOnNode.length > 0 && paramDecoratorsOnNode.some(function(d) {
|
|
323
|
+
return paramDecorators.has(getDecoratorName(d));
|
|
324
|
+
});
|
|
325
|
+
if (hasValidDecorator) {
|
|
326
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
327
|
+
try {
|
|
328
|
+
for(var _iterator = paramDecoratorsOnNode[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
329
|
+
var decorator = _step.value;
|
|
330
|
+
reportTypeOnlyTokenIfAny(decorator);
|
|
331
|
+
}
|
|
332
|
+
} catch (err) {
|
|
333
|
+
_didIteratorError = true;
|
|
334
|
+
_iteratorError = err;
|
|
335
|
+
} finally{
|
|
336
|
+
try {
|
|
337
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
338
|
+
_iterator.return();
|
|
339
|
+
}
|
|
340
|
+
} finally{
|
|
341
|
+
if (_didIteratorError) {
|
|
342
|
+
throw _iteratorError;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
} else {
|
|
347
|
+
reportMissingInject(param, classDecoratorName);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function reportTypeOnlyTokenIfAny(decorator) {
|
|
351
|
+
var tokenName = getInjectTokenFromDecorator(decorator);
|
|
352
|
+
if (!tokenName) return;
|
|
353
|
+
var typeImportInfo = typeOnlyImports.get(tokenName);
|
|
354
|
+
if (!typeImportInfo) return;
|
|
355
|
+
context.report({
|
|
356
|
+
node: decorator,
|
|
357
|
+
messageId: 'typeOnlyInjectToken',
|
|
358
|
+
data: {
|
|
359
|
+
token: tokenName
|
|
360
|
+
},
|
|
361
|
+
fix: function fix(fixer) {
|
|
362
|
+
return buildTypeOnlyImportFix(fixer, typeImportInfo);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
// Remove from tracking so we don't report the same import twice
|
|
366
|
+
typeOnlyImports.delete(tokenName);
|
|
367
|
+
}
|
|
368
|
+
function reportMissingInject(param, classDecoratorName) {
|
|
369
|
+
var tokenName = getInjectTokenName(param);
|
|
370
|
+
context.report({
|
|
371
|
+
node: param,
|
|
372
|
+
messageId: 'missingInject',
|
|
373
|
+
data: {
|
|
374
|
+
name: getParamName(param),
|
|
375
|
+
classDecorator: classDecoratorName
|
|
376
|
+
},
|
|
377
|
+
fix: tokenName ? function(fixer) {
|
|
378
|
+
return buildMissingInjectFix(fixer, param, tokenName);
|
|
379
|
+
} : undefined
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
function buildMissingInjectFix(fixer, param, tokenName) {
|
|
383
|
+
var fixes = [
|
|
384
|
+
fixer.insertTextBefore(param, "@Inject(".concat(tokenName, ") "))
|
|
385
|
+
];
|
|
386
|
+
if (!nestjsImports.has('Inject') && nestjsImportNode) {
|
|
387
|
+
var lastSpecifier = nestjsImportNode.specifiers[nestjsImportNode.specifiers.length - 1];
|
|
388
|
+
if (lastSpecifier) {
|
|
389
|
+
fixes.push(fixer.insertTextAfter(lastSpecifier, ', Inject'));
|
|
390
|
+
}
|
|
391
|
+
nestjsImports.add('Inject');
|
|
392
|
+
}
|
|
393
|
+
return fixes;
|
|
394
|
+
}
|
|
362
395
|
}
|
|
363
396
|
};
|
|
364
397
|
|
package/eslint/package.json
CHANGED
package/mailgun/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/mailgun",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.12.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.
|
|
6
|
-
"@dereekb/model": "13.
|
|
7
|
-
"@dereekb/nestjs": "13.
|
|
8
|
-
"@dereekb/rxjs": "13.
|
|
9
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/date": "13.12.0",
|
|
6
|
+
"@dereekb/model": "13.12.0",
|
|
7
|
+
"@dereekb/nestjs": "13.12.0",
|
|
8
|
+
"@dereekb/rxjs": "13.12.0",
|
|
9
|
+
"@dereekb/util": "13.12.0",
|
|
10
10
|
"@nestjs/common": "^11.1.19",
|
|
11
11
|
"@nestjs/config": "^4.0.4",
|
|
12
12
|
"form-data": "^4.0.5",
|
package/openai/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/openai",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.12.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.
|
|
6
|
-
"@dereekb/model": "13.
|
|
7
|
-
"@dereekb/nestjs": "13.
|
|
8
|
-
"@dereekb/rxjs": "13.
|
|
9
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/date": "13.12.0",
|
|
6
|
+
"@dereekb/model": "13.12.0",
|
|
7
|
+
"@dereekb/nestjs": "13.12.0",
|
|
8
|
+
"@dereekb/rxjs": "13.12.0",
|
|
9
|
+
"@dereekb/util": "13.12.0",
|
|
10
10
|
"@nestjs/common": "^11.1.19",
|
|
11
11
|
"@nestjs/config": "^4.0.4",
|
|
12
12
|
"express": "^5.2.1",
|