@keq-request/nestjs 5.0.0-alpha.34 → 5.0.0-alpha.35
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/.turbo/turbo-build.log +34 -16
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +62 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +61 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -9
- package/tsconfig.json +5 -4
- package/tsdown.config.ts +12 -0
- package/dist/keq.module-definition.d.ts +0 -3
- package/dist/keq.module-definition.d.ts.map +0 -1
- package/dist/keq.module.d.ts +0 -49
- package/dist/keq.module.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/keq-module-options.d.ts +0 -5
- package/dist/types/keq-module-options.d.ts.map +0 -1
- package/tsup.config.ts +0 -14
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
|
|
2
|
-
> @keq-request/nestjs@5.0.0-alpha.
|
|
3
|
-
>
|
|
2
|
+
> @keq-request/nestjs@5.0.0-alpha.35 build /home/runner/work/keq/keq/packages/nestjs
|
|
3
|
+
> tsdown
|
|
4
4
|
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
5
|
+
[34mℹ[39m [34mtsdown v0.21.10[39m powered by [38;2;255;126;23mrolldown v1.0.0-rc.17[39m
|
|
6
|
+
[34mℹ[39m config file: [4m/home/runner/work/keq/keq/packages/nestjs/tsdown.config.ts[24m
|
|
7
|
+
(node:2732) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/keq/keq/packages/nestjs/tsdown.config.ts?no-cache=d433c752-7b69-49b8-899f-3db56eb2b711 is not specified and it doesn't parse as CommonJS.
|
|
8
|
+
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
|
|
9
|
+
To eliminate this warning, add "type": "module" to /home/runner/work/keq/keq/packages/nestjs/package.json.
|
|
10
|
+
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
11
|
+
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
12
|
+
[34mℹ[39m target: [34mnode20[39m
|
|
13
|
+
[34mℹ[39m tsconfig: [34mtsconfig.lib.json[39m
|
|
14
|
+
[34mℹ[39m Build start
|
|
15
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.js[22m [2m2.35 kB[22m [2m│ gzip: 1.00 kB[22m
|
|
16
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.js.map [2m3.54 kB[22m [2m│ gzip: 1.35 kB[22m
|
|
17
|
+
[34mℹ[39m [33m[CJS][39m 2 files, total: 5.89 kB
|
|
18
|
+
[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugin `tsdown:deps`. See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
19
|
+
|
|
20
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.d.ts.map [2m0.54 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
21
|
+
[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugins. Here is a breakdown:
|
|
22
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m2.17 kB[22m [2m│ gzip: 0.89 kB[22m
|
|
23
|
+
[34mℹ[39m [33m[CJS][39m 2 files, total: 2.71 kB
|
|
24
|
+
- rolldown-plugin-dts:generate (48%)
|
|
25
|
+
- tsdown:deps (46%)
|
|
26
|
+
See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
27
|
+
|
|
28
|
+
[32m✔[39m Build complete in [32m4131ms[39m
|
|
29
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.mjs[22m [2m2.17 kB[22m [2m│ gzip: 0.92 kB[22m
|
|
30
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.mjs.map [2m3.49 kB[22m [2m│ gzip: 1.34 kB[22m
|
|
31
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.d.mts.map [2m0.54 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
32
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m2.17 kB[22m [2m│ gzip: 0.89 kB[22m
|
|
33
|
+
[34mℹ[39m [34m[ESM][39m 4 files, total: 8.37 kB
|
|
34
|
+
[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
35
|
+
|
|
36
|
+
[32m✔[39m Build complete in [32m4134ms[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { KeqMiddleware } from "keq";
|
|
2
|
+
import * as _$_nestjs_common0 from "@nestjs/common";
|
|
3
|
+
import { DynamicModule } from "@nestjs/common";
|
|
4
|
+
|
|
5
|
+
//#region src/types/keq-module-options.d.ts
|
|
6
|
+
interface KeqModuleOptions {
|
|
7
|
+
middlewares?: KeqMiddleware[];
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/keq.module-definition.d.ts
|
|
11
|
+
declare const ConfigurableModuleClass: _$_nestjs_common0.ConfigurableModuleCls<KeqModuleOptions, "register", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: KeqModuleOptions & Partial<{}>, ASYNC_OPTIONS_TYPE: _$_nestjs_common0.ConfigurableModuleAsyncOptions<KeqModuleOptions, "create"> & Partial<{}>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/keq.module.d.ts
|
|
14
|
+
/**
|
|
15
|
+
* KeqModule - Dynamic module for integrating Keq HTTP client with NestJS
|
|
16
|
+
*
|
|
17
|
+
* This module is global, so KeqRequest can be injected anywhere in your application
|
|
18
|
+
* without needing to import the module in every feature module.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Synchronous registration
|
|
23
|
+
* KeqModule.register({
|
|
24
|
+
* middlewares: [...]
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* // Asynchronous registration
|
|
28
|
+
* KeqModule.registerAsync({
|
|
29
|
+
* imports: [ConfigModule],
|
|
30
|
+
* useFactory: (config: ConfigService) => ({
|
|
31
|
+
* middlewares: [...]
|
|
32
|
+
* }),
|
|
33
|
+
* inject: [ConfigService]
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* // Inject in service
|
|
37
|
+
* class UserService {
|
|
38
|
+
* constructor(private readonly keqRequest: KeqRequest) {}
|
|
39
|
+
* async getUser(id: string) {
|
|
40
|
+
* return await this.keqRequest.get(`/users/${id}`).resolveWith('json')
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare class KeqModule extends ConfigurableModuleClass {
|
|
46
|
+
/**
|
|
47
|
+
* Register the module with synchronous options
|
|
48
|
+
* @param options - Configuration options including middlewares
|
|
49
|
+
* @returns DynamicModule with KeqRequest provider
|
|
50
|
+
*/
|
|
51
|
+
static register(options: typeof OPTIONS_TYPE): DynamicModule;
|
|
52
|
+
/**
|
|
53
|
+
* Register the module with asynchronous options
|
|
54
|
+
* Useful when you need to inject dependencies like ConfigService
|
|
55
|
+
* @param options - Async configuration options
|
|
56
|
+
* @returns DynamicModule with KeqRequest provider
|
|
57
|
+
*/
|
|
58
|
+
static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { KeqModule, KeqModuleOptions };
|
|
62
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/keq-module-options.ts","../src/keq.module-definition.ts","../src/keq.module.ts"],"mappings":";;;;;UAGiB,gBAAA;EACf,WAAA,GAAc,aAAA;AAAA;;;cCEd,uBAAA,EAAuB,iBAAA,CAAA,qBAAA,CAAA,gBAAA,6BAAA,oBAAA,mBAAA,YAAA,EAEX,gBAAA,GAAA,OAAA,MAAA,kBAAA,EACM,iBAAA,CAAA,8BAAA,CAAA,gBAAA,cAAA,OAAA;;;;;;ADNpB;;;;;;;;ACEA;;;;;;;;;;;;;;;;;;;;cCsDa,SAAA,SAAkB,uBAAA;EDnD7B;;;;;EAAA,OCyDO,QAAA,CAAS,OAAA,SAAgB,YAAA,GAAe,aAAA;EAN1B;;;;;;EAAA,OAoBd,aAAA,CAAc,OAAA,SAAgB,kBAAA,GAAqB,aAAA;AAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as _$_nestjs_common0 from "@nestjs/common";
|
|
2
|
+
import { DynamicModule } from "@nestjs/common";
|
|
3
|
+
import { KeqMiddleware } from "keq";
|
|
4
|
+
|
|
5
|
+
//#region src/types/keq-module-options.d.ts
|
|
6
|
+
interface KeqModuleOptions {
|
|
7
|
+
middlewares?: KeqMiddleware[];
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/keq.module-definition.d.ts
|
|
11
|
+
declare const ConfigurableModuleClass: _$_nestjs_common0.ConfigurableModuleCls<KeqModuleOptions, "register", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: KeqModuleOptions & Partial<{}>, ASYNC_OPTIONS_TYPE: _$_nestjs_common0.ConfigurableModuleAsyncOptions<KeqModuleOptions, "create"> & Partial<{}>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/keq.module.d.ts
|
|
14
|
+
/**
|
|
15
|
+
* KeqModule - Dynamic module for integrating Keq HTTP client with NestJS
|
|
16
|
+
*
|
|
17
|
+
* This module is global, so KeqRequest can be injected anywhere in your application
|
|
18
|
+
* without needing to import the module in every feature module.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Synchronous registration
|
|
23
|
+
* KeqModule.register({
|
|
24
|
+
* middlewares: [...]
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* // Asynchronous registration
|
|
28
|
+
* KeqModule.registerAsync({
|
|
29
|
+
* imports: [ConfigModule],
|
|
30
|
+
* useFactory: (config: ConfigService) => ({
|
|
31
|
+
* middlewares: [...]
|
|
32
|
+
* }),
|
|
33
|
+
* inject: [ConfigService]
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* // Inject in service
|
|
37
|
+
* class UserService {
|
|
38
|
+
* constructor(private readonly keqRequest: KeqRequest) {}
|
|
39
|
+
* async getUser(id: string) {
|
|
40
|
+
* return await this.keqRequest.get(`/users/${id}`).resolveWith('json')
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare class KeqModule extends ConfigurableModuleClass {
|
|
46
|
+
/**
|
|
47
|
+
* Register the module with synchronous options
|
|
48
|
+
* @param options - Configuration options including middlewares
|
|
49
|
+
* @returns DynamicModule with KeqRequest provider
|
|
50
|
+
*/
|
|
51
|
+
static register(options: typeof OPTIONS_TYPE): DynamicModule;
|
|
52
|
+
/**
|
|
53
|
+
* Register the module with asynchronous options
|
|
54
|
+
* Useful when you need to inject dependencies like ConfigService
|
|
55
|
+
* @param options - Async configuration options
|
|
56
|
+
* @returns DynamicModule with KeqRequest provider
|
|
57
|
+
*/
|
|
58
|
+
static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { KeqModule, KeqModuleOptions };
|
|
3
62
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/keq-module-options.ts","../src/keq.module-definition.ts","../src/keq.module.ts"],"mappings":";;;;;UAGiB,gBAAA;EACf,WAAA,GAAc,aAAA;AAAA;;;cCEd,uBAAA,EAAuB,iBAAA,CAAA,qBAAA,CAAA,gBAAA,6BAAA,oBAAA,mBAAA,YAAA,EAEX,gBAAA,GAAA,OAAA,MAAA,kBAAA,EACM,iBAAA,CAAA,8BAAA,CAAA,gBAAA,cAAA,OAAA;;;;;;ADNpB;;;;;;;;ACEA;;;;;;;;;;;;;;;;;;;;cCsDa,SAAA,SAAkB,uBAAA;EDnD7B;;;;;EAAA,OCyDO,QAAA,CAAS,OAAA,SAAgB,YAAA,GAAe,aAAA;EAN1B;;;;;;EAAA,OAoBd,aAAA,CAAc,OAAA,SAAgB,kBAAA,GAAqB,aAAA;AAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,94 +1,63 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/index.ts
|
|
22
|
-
var index_exports = {};
|
|
23
|
-
__export(index_exports, {
|
|
24
|
-
KeqModule: () => KeqModule
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
|
|
28
|
-
// src/keq.module.ts
|
|
29
|
-
var import_keq = require("keq");
|
|
30
|
-
var import_common2 = require("@nestjs/common");
|
|
31
|
-
|
|
32
|
-
// src/keq.module-definition.ts
|
|
33
|
-
var import_common = require("@nestjs/common");
|
|
34
|
-
var { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE } = new import_common.ConfigurableModuleBuilder().build();
|
|
35
|
-
|
|
36
|
-
// src/keq.module.ts
|
|
37
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
38
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
39
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
40
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
41
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let keq = require("keq");
|
|
3
|
+
let _nestjs_common = require("@nestjs/common");
|
|
4
|
+
//#region src/keq.module-definition.ts
|
|
5
|
+
const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE } = new _nestjs_common.ConfigurableModuleBuilder().build();
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/decorate.js
|
|
8
|
+
function __decorate(decorators, target, key, desc) {
|
|
9
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
42
13
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/keq.module.ts
|
|
16
|
+
/**
|
|
17
|
+
* Provider that creates and configures a KeqRequest instance
|
|
18
|
+
* Applies any middlewares defined in the module options
|
|
19
|
+
*/
|
|
20
|
+
const requestProvider = {
|
|
21
|
+
provide: keq.KeqRequest,
|
|
22
|
+
useFactory: (config) => {
|
|
23
|
+
const request = new keq.KeqRequest();
|
|
24
|
+
if (config.middlewares) for (const middleware of config.middlewares) request.use(middleware);
|
|
25
|
+
return request;
|
|
26
|
+
},
|
|
27
|
+
inject: [MODULE_OPTIONS_TOKEN]
|
|
58
28
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
mo.global = true;
|
|
84
|
-
return mo;
|
|
85
|
-
}
|
|
29
|
+
let KeqModule = class KeqModule extends ConfigurableModuleClass {
|
|
30
|
+
/**
|
|
31
|
+
* Register the module with synchronous options
|
|
32
|
+
* @param options - Configuration options including middlewares
|
|
33
|
+
* @returns DynamicModule with KeqRequest provider
|
|
34
|
+
*/
|
|
35
|
+
static register(options) {
|
|
36
|
+
const mo = super.register(options);
|
|
37
|
+
mo.providers.push(requestProvider);
|
|
38
|
+
mo.global = true;
|
|
39
|
+
return mo;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Register the module with asynchronous options
|
|
43
|
+
* Useful when you need to inject dependencies like ConfigService
|
|
44
|
+
* @param options - Async configuration options
|
|
45
|
+
* @returns DynamicModule with KeqRequest provider
|
|
46
|
+
*/
|
|
47
|
+
static registerAsync(options) {
|
|
48
|
+
const mo = super.registerAsync(options);
|
|
49
|
+
mo.providers.push(requestProvider);
|
|
50
|
+
mo.global = true;
|
|
51
|
+
return mo;
|
|
52
|
+
}
|
|
86
53
|
};
|
|
87
|
-
KeqModule =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
54
|
+
KeqModule = __decorate([(0, _nestjs_common.Global)()], KeqModule);
|
|
55
|
+
//#endregion
|
|
56
|
+
Object.defineProperty(exports, "KeqModule", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function() {
|
|
59
|
+
return KeqModule;
|
|
60
|
+
}
|
|
93
61
|
});
|
|
62
|
+
|
|
94
63
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["ConfigurableModuleBuilder","KeqRequest"],"sources":["../src/keq.module-definition.ts","../src/keq.module.ts"],"sourcesContent":["\nimport { ConfigurableModuleBuilder } from '@nestjs/common'\nimport { KeqModuleOptions } from './types/keq-module-options'\n\n\nexport const {\n ConfigurableModuleClass,\n MODULE_OPTIONS_TOKEN,\n OPTIONS_TYPE,\n ASYNC_OPTIONS_TYPE,\n} = new ConfigurableModuleBuilder<KeqModuleOptions>().build()\n","\nimport { KeqRequest } from 'keq'\nimport { DynamicModule, Global, Provider } from '@nestjs/common'\nimport { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE } from './keq.module-definition.js'\nimport { KeqModuleOptions } from './types/index.js'\n\n\n/**\n * Provider that creates and configures a KeqRequest instance\n * Applies any middlewares defined in the module options\n */\nconst requestProvider: Provider = {\n provide: KeqRequest,\n useFactory: (config: KeqModuleOptions) => {\n const request = new KeqRequest()\n\n if (config.middlewares) {\n for (const middleware of config.middlewares) {\n request.use(middleware)\n }\n }\n\n return request\n },\n inject: [MODULE_OPTIONS_TOKEN],\n}\n\n/**\n * KeqModule - Dynamic module for integrating Keq HTTP client with NestJS\n *\n * This module is global, so KeqRequest can be injected anywhere in your application\n * without needing to import the module in every feature module.\n *\n * @example\n * ```typescript\n * // Synchronous registration\n * KeqModule.register({\n * middlewares: [...]\n * })\n *\n * // Asynchronous registration\n * KeqModule.registerAsync({\n * imports: [ConfigModule],\n * useFactory: (config: ConfigService) => ({\n * middlewares: [...]\n * }),\n * inject: [ConfigService]\n * })\n *\n * // Inject in service\n * class UserService {\n * constructor(private readonly keqRequest: KeqRequest) {}\n * async getUser(id: string) {\n * return await this.keqRequest.get(`/users/${id}`).resolveWith('json')\n * }\n * }\n * ```\n */\n@Global()\nexport class KeqModule extends ConfigurableModuleClass {\n /**\n * Register the module with synchronous options\n * @param options - Configuration options including middlewares\n * @returns DynamicModule with KeqRequest provider\n */\n static register(options: typeof OPTIONS_TYPE): DynamicModule {\n const mo = super.register(options)\n mo.providers!.push(requestProvider)\n mo.global = true\n\n return mo\n }\n\n /**\n * Register the module with asynchronous options\n * Useful when you need to inject dependencies like ConfigService\n * @param options - Async configuration options\n * @returns DynamicModule with KeqRequest provider\n */\n static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule {\n const mo = super.registerAsync(options)\n mo.providers!.push(requestProvider)\n mo.global = true\n\n return mo\n }\n}\n"],"mappings":";;;;AAKA,MAAa,EACX,yBACA,sBACA,cACA,uBACE,IAAIA,eAAAA,2BAA6C,CAAC,OAAO;;;;;;;;;;;;;;;ACC7D,MAAM,kBAA4B;CAChC,SAASC,IAAAA;CACT,aAAa,WAA6B;EACxC,MAAM,UAAU,IAAIA,IAAAA,YAAY;AAEhC,MAAI,OAAO,YACT,MAAK,MAAM,cAAc,OAAO,YAC9B,SAAQ,IAAI,WAAW;AAI3B,SAAO;;CAET,QAAQ,CAAC,qBAAqB;CAC/B;AAkCM,IAAA,YAAA,MAAM,kBAAkB,wBAAwB;;;;;;CAMrD,OAAO,SAAS,SAA6C;EAC3D,MAAM,KAAK,MAAM,SAAS,QAAQ;AAClC,KAAG,UAAW,KAAK,gBAAgB;AACnC,KAAG,SAAS;AAEZ,SAAO;;;;;;;;CAST,OAAO,cAAc,SAAmD;EACtE,MAAM,KAAK,MAAM,cAAc,QAAQ;AACvC,KAAG,UAAW,KAAK,gBAAgB;AACnC,KAAG,SAAS;AAEZ,SAAO;;;oDA1BF,CAAA,EAAA,UAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,69 +1,57 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/keq.module.ts
|
|
5
1
|
import { KeqRequest } from "keq";
|
|
6
|
-
import { Global } from "@nestjs/common";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2
|
+
import { ConfigurableModuleBuilder, Global } from "@nestjs/common";
|
|
3
|
+
//#region src/keq.module-definition.ts
|
|
4
|
+
const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE } = new ConfigurableModuleBuilder().build();
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/decorate.js
|
|
7
|
+
function __decorate(decorators, target, key, desc) {
|
|
8
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
]
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/keq.module.ts
|
|
15
|
+
/**
|
|
16
|
+
* Provider that creates and configures a KeqRequest instance
|
|
17
|
+
* Applies any middlewares defined in the module options
|
|
18
|
+
*/
|
|
19
|
+
const requestProvider = {
|
|
20
|
+
provide: KeqRequest,
|
|
21
|
+
useFactory: (config) => {
|
|
22
|
+
const request = new KeqRequest();
|
|
23
|
+
if (config.middlewares) for (const middleware of config.middlewares) request.use(middleware);
|
|
24
|
+
return request;
|
|
25
|
+
},
|
|
26
|
+
inject: [MODULE_OPTIONS_TOKEN]
|
|
34
27
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
mo.global = true;
|
|
60
|
-
return mo;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
KeqModule = _ts_decorate([
|
|
64
|
-
Global()
|
|
65
|
-
], KeqModule);
|
|
66
|
-
export {
|
|
67
|
-
KeqModule
|
|
28
|
+
let KeqModule = class KeqModule extends ConfigurableModuleClass {
|
|
29
|
+
/**
|
|
30
|
+
* Register the module with synchronous options
|
|
31
|
+
* @param options - Configuration options including middlewares
|
|
32
|
+
* @returns DynamicModule with KeqRequest provider
|
|
33
|
+
*/
|
|
34
|
+
static register(options) {
|
|
35
|
+
const mo = super.register(options);
|
|
36
|
+
mo.providers.push(requestProvider);
|
|
37
|
+
mo.global = true;
|
|
38
|
+
return mo;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Register the module with asynchronous options
|
|
42
|
+
* Useful when you need to inject dependencies like ConfigService
|
|
43
|
+
* @param options - Async configuration options
|
|
44
|
+
* @returns DynamicModule with KeqRequest provider
|
|
45
|
+
*/
|
|
46
|
+
static registerAsync(options) {
|
|
47
|
+
const mo = super.registerAsync(options);
|
|
48
|
+
mo.providers.push(requestProvider);
|
|
49
|
+
mo.global = true;
|
|
50
|
+
return mo;
|
|
51
|
+
}
|
|
68
52
|
};
|
|
53
|
+
KeqModule = __decorate([Global()], KeqModule);
|
|
54
|
+
//#endregion
|
|
55
|
+
export { KeqModule };
|
|
56
|
+
|
|
69
57
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/keq.module.ts","../src/keq.module
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/keq.module-definition.ts","../src/keq.module.ts"],"sourcesContent":["\nimport { ConfigurableModuleBuilder } from '@nestjs/common'\nimport { KeqModuleOptions } from './types/keq-module-options'\n\n\nexport const {\n ConfigurableModuleClass,\n MODULE_OPTIONS_TOKEN,\n OPTIONS_TYPE,\n ASYNC_OPTIONS_TYPE,\n} = new ConfigurableModuleBuilder<KeqModuleOptions>().build()\n","\nimport { KeqRequest } from 'keq'\nimport { DynamicModule, Global, Provider } from '@nestjs/common'\nimport { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE } from './keq.module-definition.js'\nimport { KeqModuleOptions } from './types/index.js'\n\n\n/**\n * Provider that creates and configures a KeqRequest instance\n * Applies any middlewares defined in the module options\n */\nconst requestProvider: Provider = {\n provide: KeqRequest,\n useFactory: (config: KeqModuleOptions) => {\n const request = new KeqRequest()\n\n if (config.middlewares) {\n for (const middleware of config.middlewares) {\n request.use(middleware)\n }\n }\n\n return request\n },\n inject: [MODULE_OPTIONS_TOKEN],\n}\n\n/**\n * KeqModule - Dynamic module for integrating Keq HTTP client with NestJS\n *\n * This module is global, so KeqRequest can be injected anywhere in your application\n * without needing to import the module in every feature module.\n *\n * @example\n * ```typescript\n * // Synchronous registration\n * KeqModule.register({\n * middlewares: [...]\n * })\n *\n * // Asynchronous registration\n * KeqModule.registerAsync({\n * imports: [ConfigModule],\n * useFactory: (config: ConfigService) => ({\n * middlewares: [...]\n * }),\n * inject: [ConfigService]\n * })\n *\n * // Inject in service\n * class UserService {\n * constructor(private readonly keqRequest: KeqRequest) {}\n * async getUser(id: string) {\n * return await this.keqRequest.get(`/users/${id}`).resolveWith('json')\n * }\n * }\n * ```\n */\n@Global()\nexport class KeqModule extends ConfigurableModuleClass {\n /**\n * Register the module with synchronous options\n * @param options - Configuration options including middlewares\n * @returns DynamicModule with KeqRequest provider\n */\n static register(options: typeof OPTIONS_TYPE): DynamicModule {\n const mo = super.register(options)\n mo.providers!.push(requestProvider)\n mo.global = true\n\n return mo\n }\n\n /**\n * Register the module with asynchronous options\n * Useful when you need to inject dependencies like ConfigService\n * @param options - Async configuration options\n * @returns DynamicModule with KeqRequest provider\n */\n static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule {\n const mo = super.registerAsync(options)\n mo.providers!.push(requestProvider)\n mo.global = true\n\n return mo\n }\n}\n"],"mappings":";;;AAKA,MAAa,EACX,yBACA,sBACA,cACA,uBACE,IAAI,2BAA6C,CAAC,OAAO;;;;;;;;;;;;;;;ACC7D,MAAM,kBAA4B;CAChC,SAAS;CACT,aAAa,WAA6B;EACxC,MAAM,UAAU,IAAI,YAAY;AAEhC,MAAI,OAAO,YACT,MAAK,MAAM,cAAc,OAAO,YAC9B,SAAQ,IAAI,WAAW;AAI3B,SAAO;;CAET,QAAQ,CAAC,qBAAqB;CAC/B;AAkCM,IAAA,YAAA,MAAM,kBAAkB,wBAAwB;;;;;;CAMrD,OAAO,SAAS,SAA6C;EAC3D,MAAM,KAAK,MAAM,SAAS,QAAQ;AAClC,KAAG,UAAW,KAAK,gBAAgB;AACnC,KAAG,SAAS;AAEZ,SAAO;;;;;;;;CAST,OAAO,cAAc,SAAmD;EACtE,MAAM,KAAK,MAAM,cAAc,QAAQ;AACvC,KAAG,UAAW,KAAK,gBAAgB;AACnC,KAAG,SAAS;AAEZ,SAAO;;;wBA1BV,QAAQ,CAAA,EAAA,UAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keq-request/nestjs",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.35",
|
|
4
4
|
"description": "Request API write by Typescript for flexibility, readability, and a low learning curve.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"request",
|
|
@@ -33,22 +33,21 @@
|
|
|
33
33
|
"type": "git",
|
|
34
34
|
"url": "git+https://github.com/keq-request/keq.git"
|
|
35
35
|
},
|
|
36
|
-
"dependencies": {},
|
|
37
36
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"keq": "5.0.0-alpha.
|
|
37
|
+
"@nestjs/common": "^11.1.19",
|
|
38
|
+
"@types/node": "^20.19.39",
|
|
39
|
+
"keq": "5.0.0-alpha.35"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
42
|
+
"@nestjs/common": "^11.0.0",
|
|
43
|
+
"keq": "^5.0.0-alpha.35"
|
|
45
44
|
},
|
|
46
45
|
"engines": {
|
|
47
46
|
"node": ">=20.0.0"
|
|
48
47
|
},
|
|
49
48
|
"scripts": {
|
|
50
|
-
"build": "
|
|
51
|
-
"dev": "
|
|
49
|
+
"build": "tsdown",
|
|
50
|
+
"dev": "tsdown --watch",
|
|
52
51
|
"test": "jest",
|
|
53
52
|
"test:update": "jest -u"
|
|
54
53
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig.base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"
|
|
4
|
+
"rootDir": "..",
|
|
5
|
+
"outDir": "./dist",
|
|
5
6
|
"emitDecoratorMetadata": true,
|
|
6
7
|
"experimentalDecorators": true,
|
|
7
8
|
"paths": {
|
|
8
|
-
"~/*": ["
|
|
9
|
-
"~~/*": ["
|
|
10
|
-
"@keq-request/test": ["
|
|
9
|
+
"~/*": ["./src/*"],
|
|
10
|
+
"~~/*": ["./*"],
|
|
11
|
+
"@keq-request/test": ["../test/src/index.ts"]
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
}
|
package/tsdown.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from 'tsdown'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['cjs', 'esm'],
|
|
6
|
+
target: ['node20'],
|
|
7
|
+
platform: 'neutral',
|
|
8
|
+
tsconfig: 'tsconfig.lib.json',
|
|
9
|
+
dts: { sourcemap: true },
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
clean: true,
|
|
12
|
+
})
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { KeqModuleOptions } from './types/keq-module-options';
|
|
2
|
-
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<KeqModuleOptions, "register", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: KeqModuleOptions & Partial<{}>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<KeqModuleOptions, "create"> & Partial<{}>;
|
|
3
|
-
//# sourceMappingURL=keq.module-definition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keq.module-definition.d.ts","sourceRoot":"","sources":["../src/keq.module-definition.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAG7D,eAAO,MACL,uBAAuB,8FACvB,oBAAoB,mBACpB,YAAY,kCACZ,kBAAkB,mGACyC,CAAA"}
|
package/dist/keq.module.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { DynamicModule } from '@nestjs/common';
|
|
2
|
-
import { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, OPTIONS_TYPE } from './keq.module-definition.js';
|
|
3
|
-
/**
|
|
4
|
-
* KeqModule - Dynamic module for integrating Keq HTTP client with NestJS
|
|
5
|
-
*
|
|
6
|
-
* This module is global, so KeqRequest can be injected anywhere in your application
|
|
7
|
-
* without needing to import the module in every feature module.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* // Synchronous registration
|
|
12
|
-
* KeqModule.register({
|
|
13
|
-
* middlewares: [...]
|
|
14
|
-
* })
|
|
15
|
-
*
|
|
16
|
-
* // Asynchronous registration
|
|
17
|
-
* KeqModule.registerAsync({
|
|
18
|
-
* imports: [ConfigModule],
|
|
19
|
-
* useFactory: (config: ConfigService) => ({
|
|
20
|
-
* middlewares: [...]
|
|
21
|
-
* }),
|
|
22
|
-
* inject: [ConfigService]
|
|
23
|
-
* })
|
|
24
|
-
*
|
|
25
|
-
* // Inject in service
|
|
26
|
-
* class UserService {
|
|
27
|
-
* constructor(private readonly keqRequest: KeqRequest) {}
|
|
28
|
-
* async getUser(id: string) {
|
|
29
|
-
* return await this.keqRequest.get(`/users/${id}`).resolveWith('json')
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare class KeqModule extends ConfigurableModuleClass {
|
|
35
|
-
/**
|
|
36
|
-
* Register the module with synchronous options
|
|
37
|
-
* @param options - Configuration options including middlewares
|
|
38
|
-
* @returns DynamicModule with KeqRequest provider
|
|
39
|
-
*/
|
|
40
|
-
static register(options: typeof OPTIONS_TYPE): DynamicModule;
|
|
41
|
-
/**
|
|
42
|
-
* Register the module with asynchronous options
|
|
43
|
-
* Useful when you need to inject dependencies like ConfigService
|
|
44
|
-
* @param options - Async configuration options
|
|
45
|
-
* @returns DynamicModule with KeqRequest provider
|
|
46
|
-
*/
|
|
47
|
-
static registerAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=keq.module.d.ts.map
|
package/dist/keq.module.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keq.module.d.ts","sourceRoot":"","sources":["../src/keq.module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAoB,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAwB,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAwB5H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,SAAU,SAAQ,uBAAuB;IACpD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,YAAY,GAAG,aAAa;IAQ5D;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,kBAAkB,GAAG,aAAa;CAOxE"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keq-module-options.d.ts","sourceRoot":"","sources":["../../src/types/keq-module-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAGnC,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,aAAa,EAAE,CAAA;CAC9B"}
|
package/tsup.config.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: ['src/index.ts'],
|
|
5
|
-
format: ['cjs', 'esm'],
|
|
6
|
-
target: ['node20'],
|
|
7
|
-
platform: 'node',
|
|
8
|
-
tsconfig: 'tsconfig.lib.json',
|
|
9
|
-
dts: false,
|
|
10
|
-
splitting: false,
|
|
11
|
-
sourcemap: true,
|
|
12
|
-
clean: true,
|
|
13
|
-
onSuccess: 'tsc --emitDeclarationOnly -d --declarationMap -p ./tsconfig.lib.json && tsc-alias -p ./tsconfig.lib.json',
|
|
14
|
-
})
|