phecda-server 6.0.2 → 7.0.0-alpha.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/bin/cli.mjs +160 -157
- package/dist/{chunk-HDQAT2IM.mjs → chunk-5622RBNB.mjs} +118 -90
- package/dist/chunk-BGXSMOLX.js +265 -0
- package/dist/{chunk-F3W3NN7F.mjs → chunk-HMVLXNV3.mjs} +5 -14
- package/dist/{chunk-GHFSIZUO.js → chunk-J5CFUN4V.js} +18 -3
- package/dist/{chunk-XCND2QW3.js → chunk-MBCHNDAY.js} +27 -36
- package/dist/{chunk-WXFZZZRY.mjs → chunk-P75VKZJY.mjs} +101 -137
- package/dist/chunk-SW5IKE5H.js +503 -0
- package/dist/{chunk-UXD62LGG.mjs → chunk-WHJ5FALK.mjs} +17 -2
- package/dist/core-BIcUwV18.d.mts +47 -0
- package/dist/core-CYwEPfN4.d.ts +47 -0
- package/dist/helper.d.mts +4 -6
- package/dist/helper.d.ts +4 -6
- package/dist/helper.js +3 -3
- package/dist/helper.mjs +2 -2
- package/dist/{server → http}/elysia/index.d.mts +5 -5
- package/dist/{server → http}/elysia/index.d.ts +5 -5
- package/dist/{server → http}/elysia/index.js +80 -62
- package/dist/{server → http}/elysia/index.mjs +50 -32
- package/dist/{server → http}/express/index.d.mts +5 -5
- package/dist/{server → http}/express/index.d.ts +5 -5
- package/dist/{server → http}/express/index.js +71 -55
- package/dist/{server → http}/express/index.mjs +42 -26
- package/dist/{server → http}/fastify/index.d.mts +5 -5
- package/dist/{server → http}/fastify/index.d.ts +5 -5
- package/dist/{server → http}/fastify/index.js +72 -72
- package/dist/{server → http}/fastify/index.mjs +47 -47
- package/dist/{server → http}/h3/index.d.mts +5 -5
- package/dist/{server → http}/h3/index.d.ts +5 -5
- package/dist/http/h3/index.js +160 -0
- package/dist/{server → http}/h3/index.mjs +68 -62
- package/dist/{server → http}/hono/index.d.mts +5 -5
- package/dist/{server → http}/hono/index.d.ts +5 -5
- package/dist/{server → http}/hono/index.js +69 -54
- package/dist/{server → http}/hono/index.mjs +41 -26
- package/dist/{server → http}/hyper-express/index.d.mts +5 -5
- package/dist/{server → http}/hyper-express/index.d.ts +5 -5
- package/dist/{server → http}/hyper-express/index.js +69 -56
- package/dist/{server → http}/hyper-express/index.mjs +41 -28
- package/dist/{server → http}/koa/index.d.mts +5 -5
- package/dist/{server → http}/koa/index.d.ts +5 -5
- package/dist/{server → http}/koa/index.js +71 -55
- package/dist/{server → http}/koa/index.mjs +42 -26
- package/dist/index.d.mts +53 -41
- package/dist/index.d.ts +53 -41
- package/dist/index.js +62 -78
- package/dist/index.mjs +46 -62
- package/dist/{meta-KtfiBIde.d.ts → meta-BXKLFTgG.d.mts} +2 -3
- package/dist/{meta-KtfiBIde.d.mts → meta-BXKLFTgG.d.ts} +2 -3
- package/dist/rpc/bullmq/index.d.mts +6 -6
- package/dist/rpc/bullmq/index.d.ts +6 -6
- package/dist/rpc/bullmq/index.js +24 -24
- package/dist/rpc/bullmq/index.mjs +14 -14
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +25 -21
- package/dist/rpc/kafka/index.mjs +15 -11
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +22 -21
- package/dist/rpc/nats/index.mjs +13 -12
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +23 -22
- package/dist/rpc/rabbitmq/index.mjs +12 -11
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +24 -20
- package/dist/rpc/redis/index.mjs +15 -11
- package/dist/test.d.mts +3 -3
- package/dist/test.d.ts +3 -3
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types-JVT0mgLD.d.ts → types-BtbL49Zs.d.mts} +2 -1
- package/dist/{types-DIw7B6Up.d.ts → types-VFzEM7LL.d.ts} +5 -5
- package/dist/{types-BvD3B5Ny.d.mts → types-h40T3cRG.d.mts} +5 -5
- package/dist/{types-t9D1fU6G.d.mts → types-m3IEDKjP.d.ts} +2 -1
- package/package.json +24 -24
- package/dist/chunk-7SYPUIBY.js +0 -539
- package/dist/chunk-LYEZ6RGX.js +0 -237
- package/dist/core-2SNw8m2B.d.mts +0 -30
- package/dist/core-BmJJLUqj.d.ts +0 -30
- package/dist/server/h3/index.js +0 -154
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
var _chunkBGXSMOLXjs = require('./chunk-BGXSMOLX.js');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
@@ -23,15 +24,14 @@
|
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
var _chunkXCND2QW3js = require('./chunk-XCND2QW3.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var _chunkLYEZ6RGXjs = require('./chunk-LYEZ6RGX.js');
|
|
34
33
|
|
|
34
|
+
var _chunkMBCHNDAYjs = require('./chunk-MBCHNDAY.js');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -56,7 +56,7 @@ var _chunkLYEZ6RGXjs = require('./chunk-LYEZ6RGX.js');
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
var
|
|
59
|
+
var _chunkSW5IKE5Hjs = require('./chunk-SW5IKE5H.js');
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
@@ -68,13 +68,15 @@ var _chunk7SYPUIBYjs = require('./chunk-7SYPUIBY.js');
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
var _chunkJ5CFUN4Vjs = require('./chunk-J5CFUN4V.js');
|
|
72
74
|
|
|
73
75
|
// src/types.ts
|
|
74
76
|
var ResponseSymbol = Symbol("response");
|
|
75
77
|
var CustomResponse = class {
|
|
76
78
|
static {
|
|
77
|
-
|
|
79
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "CustomResponse");
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
};
|
|
@@ -87,35 +89,35 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
87
89
|
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;
|
|
88
90
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
89
91
|
}
|
|
90
|
-
|
|
92
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
|
|
91
93
|
function _ts_metadata(k, v) {
|
|
92
94
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
93
95
|
}
|
|
94
|
-
|
|
96
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
|
|
95
97
|
var ServerBase = (_class = class extends _phecdacore.Base {constructor(...args2) { super(...args2); _class.prototype.__init.call(this); }
|
|
96
98
|
static {
|
|
97
|
-
|
|
99
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "ServerBase");
|
|
98
100
|
}
|
|
99
|
-
__init() {this.emitter = exports.emitter =
|
|
101
|
+
__init() {this.emitter = exports.emitter = _chunkBGXSMOLXjs.emitter}
|
|
100
102
|
}, _class);
|
|
101
103
|
var HttpBase = class extends ServerBase {
|
|
102
104
|
static {
|
|
103
|
-
|
|
105
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "HttpBase");
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
};
|
|
107
109
|
_ts_decorate([
|
|
108
|
-
|
|
110
|
+
_chunkMBCHNDAYjs.Ctx,
|
|
109
111
|
_ts_metadata("design:type", typeof HttpContext === "undefined" ? Object : HttpContext)
|
|
110
112
|
], HttpBase.prototype, "context", void 0);
|
|
111
113
|
var RpcBase = class extends ServerBase {
|
|
112
114
|
static {
|
|
113
|
-
|
|
115
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "RpcBase");
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
};
|
|
117
119
|
_ts_decorate([
|
|
118
|
-
|
|
120
|
+
_chunkMBCHNDAYjs.Ctx,
|
|
119
121
|
_ts_metadata("design:type", typeof RpcContext === "undefined" ? Object : RpcContext)
|
|
120
122
|
], RpcBase.prototype, "context", void 0);
|
|
121
123
|
|
|
@@ -123,125 +125,106 @@ _ts_decorate([
|
|
|
123
125
|
|
|
124
126
|
var PFilter = class extends ServerBase {
|
|
125
127
|
static {
|
|
126
|
-
|
|
128
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "PFilter");
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
constructor(tag) {
|
|
130
132
|
super();
|
|
131
133
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
132
|
-
|
|
134
|
+
_chunkSW5IKE5Hjs.addFilter.call(void 0, this.key, this.use.bind(this));
|
|
133
135
|
this.onUnmount(() => {
|
|
134
|
-
delete
|
|
136
|
+
delete _chunkSW5IKE5Hjs.Context.filterRecord[this.key];
|
|
135
137
|
});
|
|
136
138
|
}
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
// src/modules/guard.ts
|
|
140
142
|
|
|
141
|
-
var PGuard = class extends ServerBase {
|
|
143
|
+
var PGuard = (_class2 = class extends ServerBase {
|
|
142
144
|
static {
|
|
143
|
-
|
|
145
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "PGuard");
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
__init2() {this.priority = 0}
|
|
146
149
|
constructor(tag) {
|
|
147
|
-
super();
|
|
148
|
-
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
149
|
-
_chunk7SYPUIBYjs.addGuard.call(void 0, this.key, this.use.bind(this));
|
|
150
|
-
this.onUnmount(() => {
|
|
151
|
-
delete _chunk7SYPUIBYjs.Context.guardRecord[this.key];
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
// src/modules/interceptor.ts
|
|
157
|
-
|
|
158
|
-
var PInterceptor = class extends ServerBase {
|
|
159
|
-
static {
|
|
160
|
-
_chunkGHFSIZUOjs.__name.call(void 0, this, "PInterceptor");
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
constructor(tag) {
|
|
164
|
-
super();
|
|
150
|
+
super();_class2.prototype.__init2.call(this);;
|
|
165
151
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
152
|
+
_chunkSW5IKE5Hjs.addGuard.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
166
153
|
this.onUnmount(() => {
|
|
167
|
-
delete
|
|
154
|
+
delete _chunkSW5IKE5Hjs.Context.guardRecord[this.key];
|
|
168
155
|
});
|
|
169
|
-
_chunk7SYPUIBYjs.addInterceptor.call(void 0, this.key, this.use.bind(this));
|
|
170
156
|
}
|
|
171
|
-
};
|
|
157
|
+
}, _class2);
|
|
172
158
|
|
|
173
159
|
// src/modules/pipe.ts
|
|
174
160
|
|
|
175
161
|
var PPipe = class extends ServerBase {
|
|
176
162
|
static {
|
|
177
|
-
|
|
163
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "PPipe");
|
|
178
164
|
}
|
|
179
165
|
|
|
180
166
|
constructor(tag) {
|
|
181
167
|
super();
|
|
182
168
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
183
|
-
|
|
169
|
+
_chunkSW5IKE5Hjs.addPipe.call(void 0, this.key, this.use.bind(this));
|
|
184
170
|
this.onUnmount(() => {
|
|
185
|
-
delete
|
|
171
|
+
delete _chunkSW5IKE5Hjs.Context.pipeRecord[this.key];
|
|
186
172
|
});
|
|
187
173
|
}
|
|
188
174
|
};
|
|
189
175
|
|
|
190
|
-
// src/modules/
|
|
176
|
+
// src/modules/addon.ts
|
|
191
177
|
|
|
192
|
-
var
|
|
178
|
+
var PAddon = (_class3 = class extends ServerBase {
|
|
193
179
|
static {
|
|
194
|
-
|
|
180
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "PAddon");
|
|
195
181
|
}
|
|
196
182
|
|
|
183
|
+
__init3() {this.priority = 0}
|
|
197
184
|
constructor(tag) {
|
|
198
|
-
super();
|
|
185
|
+
super();_class3.prototype.__init3.call(this);;
|
|
199
186
|
this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
200
|
-
|
|
187
|
+
_chunkSW5IKE5Hjs.addAddon.call(void 0, this.key, this.use.bind(this), this.priority);
|
|
201
188
|
this.onUnmount(() => {
|
|
202
|
-
delete
|
|
189
|
+
delete _chunkSW5IKE5Hjs.Context.addonRecord[this.key];
|
|
203
190
|
});
|
|
204
191
|
}
|
|
205
|
-
};
|
|
192
|
+
}, _class3);
|
|
206
193
|
|
|
207
194
|
// src/modules/extension.ts
|
|
208
195
|
|
|
209
196
|
var PExtension = class extends ServerBase {
|
|
210
197
|
static {
|
|
211
|
-
|
|
198
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "PExtension");
|
|
212
199
|
}
|
|
213
200
|
|
|
201
|
+
|
|
202
|
+
|
|
214
203
|
constructor(tag) {
|
|
215
204
|
super();
|
|
216
205
|
const key = this.key = tag || _phecdacore.getTag.call(void 0, this);
|
|
217
206
|
if (this.pipe) {
|
|
218
|
-
|
|
207
|
+
_chunkSW5IKE5Hjs.addPipe.call(void 0, key, this.pipe.bind(this));
|
|
219
208
|
this.onUnmount(() => {
|
|
220
|
-
delete
|
|
209
|
+
delete _chunkSW5IKE5Hjs.Context.pipeRecord[key];
|
|
221
210
|
});
|
|
222
211
|
}
|
|
223
|
-
if (this.
|
|
224
|
-
|
|
212
|
+
if (this.addon) {
|
|
213
|
+
_chunkSW5IKE5Hjs.addAddon.call(void 0, key, this.addon.bind(this), this.addonPriority);
|
|
225
214
|
this.onUnmount(() => {
|
|
226
|
-
delete
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
if (this.intercept) {
|
|
230
|
-
_chunk7SYPUIBYjs.addInterceptor.call(void 0, key, this.intercept.bind(this));
|
|
231
|
-
this.onUnmount(() => {
|
|
232
|
-
delete _chunk7SYPUIBYjs.Context.interceptorRecord[key];
|
|
215
|
+
delete _chunkSW5IKE5Hjs.Context.addonRecord[key];
|
|
233
216
|
});
|
|
234
217
|
}
|
|
235
218
|
if (this.guard) {
|
|
236
|
-
|
|
219
|
+
_chunkSW5IKE5Hjs.addGuard.call(void 0, key, this.guard.bind(this), this.guardPriority);
|
|
237
220
|
this.onUnmount(() => {
|
|
238
|
-
delete
|
|
221
|
+
delete _chunkSW5IKE5Hjs.Context.guardRecord[key];
|
|
239
222
|
});
|
|
240
223
|
}
|
|
241
224
|
if (this.filter) {
|
|
242
|
-
|
|
225
|
+
_chunkSW5IKE5Hjs.addFilter.call(void 0, key, this.filter.bind(this));
|
|
243
226
|
this.onUnmount(() => {
|
|
244
|
-
delete
|
|
227
|
+
delete _chunkSW5IKE5Hjs.Context.filterRecord[key];
|
|
245
228
|
});
|
|
246
229
|
}
|
|
247
230
|
}
|
|
@@ -251,7 +234,7 @@ var PExtension = class extends ServerBase {
|
|
|
251
234
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
252
235
|
var Generator = class {
|
|
253
236
|
static {
|
|
254
|
-
|
|
237
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "Generator");
|
|
255
238
|
}
|
|
256
239
|
|
|
257
240
|
constructor(path) {
|
|
@@ -266,12 +249,12 @@ var Generator = class {
|
|
|
266
249
|
};
|
|
267
250
|
|
|
268
251
|
// src/generator/rpc.ts
|
|
269
|
-
var RPCGenerator = (
|
|
252
|
+
var RPCGenerator = (_class4 = class extends Generator {constructor(...args3) { super(...args3); _class4.prototype.__init4.call(this);_class4.prototype.__init5.call(this); }
|
|
270
253
|
static {
|
|
271
|
-
|
|
254
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "RPCGenerator");
|
|
272
255
|
}
|
|
273
|
-
|
|
274
|
-
|
|
256
|
+
__init4() {this.name = "RPC"}
|
|
257
|
+
__init5() {this.classMap = {}}
|
|
275
258
|
getContent() {
|
|
276
259
|
let content = "";
|
|
277
260
|
for (const name in this.classMap) {
|
|
@@ -299,15 +282,15 @@ var RPCGenerator = (_class2 = class extends Generator {constructor(...args3) { s
|
|
|
299
282
|
}
|
|
300
283
|
return this.getContent();
|
|
301
284
|
}
|
|
302
|
-
},
|
|
285
|
+
}, _class4);
|
|
303
286
|
|
|
304
287
|
// src/generator/http.ts
|
|
305
|
-
var HTTPGenerator = (
|
|
288
|
+
var HTTPGenerator = (_class5 = class extends Generator {constructor(...args4) { super(...args4); _class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this); }
|
|
306
289
|
static {
|
|
307
|
-
|
|
290
|
+
_chunkJ5CFUN4Vjs.__name.call(void 0, this, "HTTPGenerator");
|
|
308
291
|
}
|
|
309
|
-
|
|
310
|
-
|
|
292
|
+
__init6() {this.name = "HTTP"}
|
|
293
|
+
__init7() {this.classMap = {}}
|
|
311
294
|
getContent() {
|
|
312
295
|
let content = "";
|
|
313
296
|
for (const name in this.classMap) {
|
|
@@ -340,7 +323,7 @@ return ret
|
|
|
340
323
|
}
|
|
341
324
|
return this.getContent();
|
|
342
325
|
}
|
|
343
|
-
},
|
|
326
|
+
}, _class5);
|
|
344
327
|
|
|
345
328
|
// src/index.ts
|
|
346
329
|
|
|
@@ -420,4 +403,5 @@ return ret
|
|
|
420
403
|
|
|
421
404
|
|
|
422
405
|
|
|
423
|
-
|
|
406
|
+
|
|
407
|
+
exports.Addon = _chunkMBCHNDAYjs.Addon; exports.Arg = _chunkMBCHNDAYjs.Arg; exports.BadGatewayException = _chunkSW5IKE5Hjs.BadGatewayException; exports.BadRequestException = _chunkSW5IKE5Hjs.BadRequestException; exports.BaseParam = _chunkMBCHNDAYjs.BaseParam; exports.Body = _chunkMBCHNDAYjs.Body; exports.ConflictException = _chunkSW5IKE5Hjs.ConflictException; exports.Context = _chunkSW5IKE5Hjs.Context; exports.Controller = _chunkMBCHNDAYjs.Controller; exports.Ctx = _chunkMBCHNDAYjs.Ctx; exports.CustomResponse = CustomResponse; exports.Define = _chunkMBCHNDAYjs.Define; exports.Delete = _chunkMBCHNDAYjs.Delete; exports.ERROR_SYMBOL = _chunkJ5CFUN4Vjs.ERROR_SYMBOL; exports.Exception = _chunkSW5IKE5Hjs.Exception; exports.Factory = _chunkBGXSMOLXjs.Factory; exports.Filter = _chunkMBCHNDAYjs.Filter; exports.ForbiddenException = _chunkSW5IKE5Hjs.ForbiddenException; exports.FrameworkException = _chunkSW5IKE5Hjs.FrameworkException; exports.Generator = Generator; exports.Get = _chunkMBCHNDAYjs.Get; exports.Guard = _chunkMBCHNDAYjs.Guard; exports.HTTPGenerator = HTTPGenerator; exports.Head = _chunkMBCHNDAYjs.Head; exports.Header = _chunkMBCHNDAYjs.Header; exports.HttpBase = HttpBase; exports.IS_HMR = _chunkJ5CFUN4Vjs.IS_HMR; exports.IS_ONLY_GENERATE = _chunkJ5CFUN4Vjs.IS_ONLY_GENERATE; exports.IS_STRICT = _chunkJ5CFUN4Vjs.IS_STRICT; exports.InvalidInputException = _chunkSW5IKE5Hjs.InvalidInputException; exports.LOG_LEVEL = _chunkJ5CFUN4Vjs.LOG_LEVEL; exports.Meta = _chunkBGXSMOLXjs.Meta; exports.Mixin = _chunkJ5CFUN4Vjs.Mixin; exports.NotFoundException = _chunkSW5IKE5Hjs.NotFoundException; exports.PAddon = PAddon; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PPipe = PPipe; exports.PS_EXIT_CODE = _chunkJ5CFUN4Vjs.PS_EXIT_CODE; exports.Param = _chunkMBCHNDAYjs.Param; exports.Patch = _chunkMBCHNDAYjs.Patch; exports.PayloadLargeException = _chunkSW5IKE5Hjs.PayloadLargeException; exports.Pipe = _chunkMBCHNDAYjs.Pipe; exports.Post = _chunkMBCHNDAYjs.Post; exports.Put = _chunkMBCHNDAYjs.Put; exports.Query = _chunkMBCHNDAYjs.Query; exports.Queue = _chunkMBCHNDAYjs.Queue; exports.RPCGenerator = RPCGenerator; exports.Route = _chunkMBCHNDAYjs.Route; exports.Rpc = _chunkMBCHNDAYjs.Rpc; exports.RpcBase = RpcBase; exports.Search = _chunkMBCHNDAYjs.Search; exports.ServerBase = ServerBase; exports.ServerPhecda = _chunkBGXSMOLXjs.ServerPhecda; exports.ServiceUnavailableException = _chunkSW5IKE5Hjs.ServiceUnavailableException; exports.TimeoutException = _chunkSW5IKE5Hjs.TimeoutException; exports.TimerException = _chunkSW5IKE5Hjs.TimerException; exports.UnauthorizedException = _chunkSW5IKE5Hjs.UnauthorizedException; exports.UndefinedException = _chunkSW5IKE5Hjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkSW5IKE5Hjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkSW5IKE5Hjs.ValidateException; exports.WorkerException = _chunkSW5IKE5Hjs.WorkerException; exports.addAddon = _chunkSW5IKE5Hjs.addAddon; exports.addFilter = _chunkSW5IKE5Hjs.addFilter; exports.addGuard = _chunkSW5IKE5Hjs.addGuard; exports.addPipe = _chunkSW5IKE5Hjs.addPipe; exports.defaultPipe = _chunkSW5IKE5Hjs.defaultPipe; exports.defaultServerInject = _chunkBGXSMOLXjs.defaultServerInject; exports.emitter = _chunkBGXSMOLXjs.emitter; exports.getLogger = _chunkJ5CFUN4Vjs.getLogger; exports.log = _chunkJ5CFUN4Vjs.log; exports.phecdaNamespace = _chunkBGXSMOLXjs.phecdaNamespace; exports.runMiddleware = _chunkJ5CFUN4Vjs.runMiddleware; exports.setLogger = _chunkJ5CFUN4Vjs.setLogger; exports.useS = _chunkBGXSMOLXjs.useS;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Factory,
|
|
3
|
+
Meta,
|
|
4
|
+
ServerPhecda,
|
|
5
|
+
defaultServerInject,
|
|
6
|
+
emitter,
|
|
7
|
+
phecdaNamespace,
|
|
8
|
+
useS
|
|
9
|
+
} from "./chunk-5622RBNB.mjs";
|
|
10
|
+
import {
|
|
11
|
+
Addon,
|
|
2
12
|
Arg,
|
|
3
13
|
BaseParam,
|
|
4
14
|
Body,
|
|
@@ -11,11 +21,9 @@ import {
|
|
|
11
21
|
Guard,
|
|
12
22
|
Head,
|
|
13
23
|
Header,
|
|
14
|
-
Interceptor,
|
|
15
24
|
Param,
|
|
16
25
|
Patch,
|
|
17
26
|
Pipe,
|
|
18
|
-
Plugin,
|
|
19
27
|
Post,
|
|
20
28
|
Put,
|
|
21
29
|
Query,
|
|
@@ -23,14 +31,7 @@ import {
|
|
|
23
31
|
Route,
|
|
24
32
|
Rpc,
|
|
25
33
|
Search
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import {
|
|
28
|
-
Factory,
|
|
29
|
-
Meta,
|
|
30
|
-
createPhecda,
|
|
31
|
-
emitter,
|
|
32
|
-
isObject
|
|
33
|
-
} from "./chunk-HDQAT2IM.mjs";
|
|
34
|
+
} from "./chunk-HMVLXNV3.mjs";
|
|
34
35
|
import {
|
|
35
36
|
BadGatewayException,
|
|
36
37
|
BadRequestException,
|
|
@@ -50,13 +51,12 @@ import {
|
|
|
50
51
|
UnsupportedMediaTypeException,
|
|
51
52
|
ValidateException,
|
|
52
53
|
WorkerException,
|
|
54
|
+
addAddon,
|
|
53
55
|
addFilter,
|
|
54
56
|
addGuard,
|
|
55
|
-
addInterceptor,
|
|
56
57
|
addPipe,
|
|
57
|
-
addPlugin,
|
|
58
58
|
defaultPipe
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-P75VKZJY.mjs";
|
|
60
60
|
import {
|
|
61
61
|
ERROR_SYMBOL,
|
|
62
62
|
IS_HMR,
|
|
@@ -66,9 +66,11 @@ import {
|
|
|
66
66
|
Mixin,
|
|
67
67
|
PS_EXIT_CODE,
|
|
68
68
|
__name,
|
|
69
|
+
getLogger,
|
|
69
70
|
log,
|
|
71
|
+
runMiddleware,
|
|
70
72
|
setLogger
|
|
71
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-WHJ5FALK.mjs";
|
|
72
74
|
|
|
73
75
|
// src/types.ts
|
|
74
76
|
var ResponseSymbol = Symbol("response");
|
|
@@ -143,35 +145,19 @@ var PGuard = class extends ServerBase {
|
|
|
143
145
|
__name(this, "PGuard");
|
|
144
146
|
}
|
|
145
147
|
key;
|
|
148
|
+
priority = 0;
|
|
146
149
|
constructor(tag) {
|
|
147
150
|
super();
|
|
148
151
|
this.key = tag || getTag2(this);
|
|
149
|
-
addGuard(this.key, this.use.bind(this));
|
|
152
|
+
addGuard(this.key, this.use.bind(this), this.priority);
|
|
150
153
|
this.onUnmount(() => {
|
|
151
154
|
delete Context.guardRecord[this.key];
|
|
152
155
|
});
|
|
153
156
|
}
|
|
154
157
|
};
|
|
155
158
|
|
|
156
|
-
// src/modules/interceptor.ts
|
|
157
|
-
import { getTag as getTag3 } from "phecda-core";
|
|
158
|
-
var PInterceptor = class extends ServerBase {
|
|
159
|
-
static {
|
|
160
|
-
__name(this, "PInterceptor");
|
|
161
|
-
}
|
|
162
|
-
key;
|
|
163
|
-
constructor(tag) {
|
|
164
|
-
super();
|
|
165
|
-
this.key = tag || getTag3(this);
|
|
166
|
-
this.onUnmount(() => {
|
|
167
|
-
delete Context.interceptorRecord[this.key];
|
|
168
|
-
});
|
|
169
|
-
addInterceptor(this.key, this.use.bind(this));
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
159
|
// src/modules/pipe.ts
|
|
174
|
-
import { getTag as
|
|
160
|
+
import { getTag as getTag3 } from "phecda-core";
|
|
175
161
|
var PPipe = class extends ServerBase {
|
|
176
162
|
static {
|
|
177
163
|
__name(this, "PPipe");
|
|
@@ -179,7 +165,7 @@ var PPipe = class extends ServerBase {
|
|
|
179
165
|
key;
|
|
180
166
|
constructor(tag) {
|
|
181
167
|
super();
|
|
182
|
-
this.key = tag ||
|
|
168
|
+
this.key = tag || getTag3(this);
|
|
183
169
|
addPipe(this.key, this.use.bind(this));
|
|
184
170
|
this.onUnmount(() => {
|
|
185
171
|
delete Context.pipeRecord[this.key];
|
|
@@ -187,53 +173,50 @@ var PPipe = class extends ServerBase {
|
|
|
187
173
|
}
|
|
188
174
|
};
|
|
189
175
|
|
|
190
|
-
// src/modules/
|
|
191
|
-
import { getTag as
|
|
192
|
-
var
|
|
176
|
+
// src/modules/addon.ts
|
|
177
|
+
import { getTag as getTag4 } from "phecda-core";
|
|
178
|
+
var PAddon = class extends ServerBase {
|
|
193
179
|
static {
|
|
194
|
-
__name(this, "
|
|
180
|
+
__name(this, "PAddon");
|
|
195
181
|
}
|
|
196
182
|
key;
|
|
183
|
+
priority = 0;
|
|
197
184
|
constructor(tag) {
|
|
198
185
|
super();
|
|
199
|
-
this.key = tag ||
|
|
200
|
-
|
|
186
|
+
this.key = tag || getTag4(this);
|
|
187
|
+
addAddon(this.key, this.use.bind(this), this.priority);
|
|
201
188
|
this.onUnmount(() => {
|
|
202
|
-
delete Context.
|
|
189
|
+
delete Context.addonRecord[this.key];
|
|
203
190
|
});
|
|
204
191
|
}
|
|
205
192
|
};
|
|
206
193
|
|
|
207
194
|
// src/modules/extension.ts
|
|
208
|
-
import { getTag as
|
|
195
|
+
import { getTag as getTag5 } from "phecda-core";
|
|
209
196
|
var PExtension = class extends ServerBase {
|
|
210
197
|
static {
|
|
211
198
|
__name(this, "PExtension");
|
|
212
199
|
}
|
|
213
200
|
key;
|
|
201
|
+
guardPriority;
|
|
202
|
+
addonPriority;
|
|
214
203
|
constructor(tag) {
|
|
215
204
|
super();
|
|
216
|
-
const key = this.key = tag ||
|
|
205
|
+
const key = this.key = tag || getTag5(this);
|
|
217
206
|
if (this.pipe) {
|
|
218
207
|
addPipe(key, this.pipe.bind(this));
|
|
219
208
|
this.onUnmount(() => {
|
|
220
209
|
delete Context.pipeRecord[key];
|
|
221
210
|
});
|
|
222
211
|
}
|
|
223
|
-
if (this.
|
|
224
|
-
|
|
212
|
+
if (this.addon) {
|
|
213
|
+
addAddon(key, this.addon.bind(this), this.addonPriority);
|
|
225
214
|
this.onUnmount(() => {
|
|
226
|
-
delete Context.
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
if (this.intercept) {
|
|
230
|
-
addInterceptor(key, this.intercept.bind(this));
|
|
231
|
-
this.onUnmount(() => {
|
|
232
|
-
delete Context.interceptorRecord[key];
|
|
215
|
+
delete Context.addonRecord[key];
|
|
233
216
|
});
|
|
234
217
|
}
|
|
235
218
|
if (this.guard) {
|
|
236
|
-
addGuard(key, this.guard.bind(this));
|
|
219
|
+
addGuard(key, this.guard.bind(this), this.guardPriority);
|
|
237
220
|
this.onUnmount(() => {
|
|
238
221
|
delete Context.guardRecord[key];
|
|
239
222
|
});
|
|
@@ -345,6 +328,7 @@ return ret
|
|
|
345
328
|
// src/index.ts
|
|
346
329
|
export * from "phecda-core";
|
|
347
330
|
export {
|
|
331
|
+
Addon,
|
|
348
332
|
Arg,
|
|
349
333
|
BadGatewayException,
|
|
350
334
|
BadRequestException,
|
|
@@ -373,24 +357,21 @@ export {
|
|
|
373
357
|
IS_HMR,
|
|
374
358
|
IS_ONLY_GENERATE,
|
|
375
359
|
IS_STRICT,
|
|
376
|
-
Interceptor,
|
|
377
360
|
InvalidInputException,
|
|
378
361
|
LOG_LEVEL,
|
|
379
362
|
Meta,
|
|
380
363
|
Mixin,
|
|
381
364
|
NotFoundException,
|
|
365
|
+
PAddon,
|
|
382
366
|
PExtension,
|
|
383
367
|
PFilter,
|
|
384
368
|
PGuard,
|
|
385
|
-
PInterceptor,
|
|
386
369
|
PPipe,
|
|
387
|
-
PPlugin,
|
|
388
370
|
PS_EXIT_CODE,
|
|
389
371
|
Param,
|
|
390
372
|
Patch,
|
|
391
373
|
PayloadLargeException,
|
|
392
374
|
Pipe,
|
|
393
|
-
Plugin,
|
|
394
375
|
Post,
|
|
395
376
|
Put,
|
|
396
377
|
Query,
|
|
@@ -401,6 +382,7 @@ export {
|
|
|
401
382
|
RpcBase,
|
|
402
383
|
Search,
|
|
403
384
|
ServerBase,
|
|
385
|
+
ServerPhecda,
|
|
404
386
|
ServiceUnavailableException,
|
|
405
387
|
TimeoutException,
|
|
406
388
|
TimerException,
|
|
@@ -409,15 +391,17 @@ export {
|
|
|
409
391
|
UnsupportedMediaTypeException,
|
|
410
392
|
ValidateException,
|
|
411
393
|
WorkerException,
|
|
394
|
+
addAddon,
|
|
412
395
|
addFilter,
|
|
413
396
|
addGuard,
|
|
414
|
-
addInterceptor,
|
|
415
397
|
addPipe,
|
|
416
|
-
addPlugin,
|
|
417
|
-
createPhecda,
|
|
418
398
|
defaultPipe,
|
|
399
|
+
defaultServerInject,
|
|
419
400
|
emitter,
|
|
420
|
-
|
|
401
|
+
getLogger,
|
|
421
402
|
log,
|
|
422
|
-
|
|
403
|
+
phecdaNamespace,
|
|
404
|
+
runMiddleware,
|
|
405
|
+
setLogger,
|
|
406
|
+
useS
|
|
423
407
|
};
|
|
@@ -41,9 +41,9 @@ interface BaseContext {
|
|
|
41
41
|
}
|
|
42
42
|
interface DefaultOptions {
|
|
43
43
|
globalGuards?: string[];
|
|
44
|
-
globalInterceptors?: string[];
|
|
45
44
|
globalFilter?: string;
|
|
46
45
|
globalPipe?: string;
|
|
46
|
+
globalAddons?: string[];
|
|
47
47
|
}
|
|
48
48
|
interface BaseError {
|
|
49
49
|
[ERROR_SYMBOL]: true;
|
|
@@ -91,8 +91,7 @@ interface ControllerMetaData extends ServiceMetaData {
|
|
|
91
91
|
guards: string[];
|
|
92
92
|
pipe?: string;
|
|
93
93
|
filter?: string;
|
|
94
|
-
|
|
95
|
-
plugins: string[];
|
|
94
|
+
addons: string[];
|
|
96
95
|
}
|
|
97
96
|
type MetaData = ControllerMetaData | ServiceMetaData;
|
|
98
97
|
declare class Meta {
|
|
@@ -41,9 +41,9 @@ interface BaseContext {
|
|
|
41
41
|
}
|
|
42
42
|
interface DefaultOptions {
|
|
43
43
|
globalGuards?: string[];
|
|
44
|
-
globalInterceptors?: string[];
|
|
45
44
|
globalFilter?: string;
|
|
46
45
|
globalPipe?: string;
|
|
46
|
+
globalAddons?: string[];
|
|
47
47
|
}
|
|
48
48
|
interface BaseError {
|
|
49
49
|
[ERROR_SYMBOL]: true;
|
|
@@ -91,8 +91,7 @@ interface ControllerMetaData extends ServiceMetaData {
|
|
|
91
91
|
guards: string[];
|
|
92
92
|
pipe?: string;
|
|
93
93
|
filter?: string;
|
|
94
|
-
|
|
95
|
-
plugins: string[];
|
|
94
|
+
addons: string[];
|
|
96
95
|
}
|
|
97
96
|
type MetaData = ControllerMetaData | ServiceMetaData;
|
|
98
97
|
declare class Meta {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../meta-
|
|
2
|
+
import { F as Factory } from '../../core-BIcUwV18.mjs';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-BtbL49Zs.mjs';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-BXKLFTgG.mjs';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
7
|
interface BullmqCtx extends RpcContext {
|
|
8
8
|
type: 'bullmq';
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
type BullmqOptions = Omit<RpcServerOptions, 'globalAddons'> & {
|
|
11
11
|
workerOpts?: WorkerOptions;
|
|
12
12
|
queueOpts?: QueueOptions;
|
|
13
|
-
}
|
|
14
|
-
declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions
|
|
13
|
+
};
|
|
14
|
+
declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions): Promise<{
|
|
15
15
|
workerMap: Record<string, Worker<any, any, string>>;
|
|
16
16
|
queueMap: Record<string, Queue<any, any, string>>;
|
|
17
17
|
}>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { WorkerOptions, QueueOptions, Worker, Queue } from 'bullmq';
|
|
2
|
-
import { F as Factory } from '../../core-
|
|
3
|
-
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-
|
|
4
|
-
import { T as ToClientMap } from '../../meta-
|
|
2
|
+
import { F as Factory } from '../../core-CYwEPfN4.js';
|
|
3
|
+
import { R as RpcContext, a as RpcServerOptions, b as RpcClientOptions } from '../../types-m3IEDKjP.js';
|
|
4
|
+
import { T as ToClientMap } from '../../meta-BXKLFTgG.js';
|
|
5
5
|
import 'phecda-core';
|
|
6
6
|
|
|
7
7
|
interface BullmqCtx extends RpcContext {
|
|
8
8
|
type: 'bullmq';
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
type BullmqOptions = Omit<RpcServerOptions, 'globalAddons'> & {
|
|
11
11
|
workerOpts?: WorkerOptions;
|
|
12
12
|
queueOpts?: QueueOptions;
|
|
13
|
-
}
|
|
14
|
-
declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions
|
|
13
|
+
};
|
|
14
|
+
declare function create({ moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: BullmqOptions): Promise<{
|
|
15
15
|
workerMap: Record<string, Worker<any, any, string>>;
|
|
16
16
|
queueMap: Record<string, Queue<any, any, string>>;
|
|
17
17
|
}>;
|