phecda-server 5.0.0-beta.22 → 5.0.0-beta.24
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.
|
@@ -116,8 +116,8 @@ async function Factory(models, opts = {}) {
|
|
|
116
116
|
const dependenceGraph = /* @__PURE__ */ new Map();
|
|
117
117
|
const isolateSet = /* @__PURE__ */ new Set();
|
|
118
118
|
const { http, rpc } = opts;
|
|
119
|
-
if (!_phecdacore.
|
|
120
|
-
_phecdacore.
|
|
119
|
+
if (!_phecdacore.getInject.call(void 0, "watcher")) {
|
|
120
|
+
_phecdacore.setInject.call(void 0, "watcher", ({ eventName, instance, key, options }) => {
|
|
121
121
|
const fn = typeof instance[key] === "function" ? instance[key].bind(instance) : (v) => instance[key] = v;
|
|
122
122
|
if (_optionalChain([options, 'optionalAccess', _2 => _2.once]))
|
|
123
123
|
emitter.once(eventName, fn);
|
|
@@ -100,7 +100,7 @@ __name(generateHTTPCode, "generateHTTPCode");
|
|
|
100
100
|
import "reflect-metadata";
|
|
101
101
|
import fs from "fs";
|
|
102
102
|
import EventEmitter from "node:events";
|
|
103
|
-
import { Empty, SHARE_KEY, get, getExposeKey,
|
|
103
|
+
import { Empty, SHARE_KEY, get, getExposeKey, getInject, getState, getTag, invokeHandler, isPhecda, setInject } from "phecda-core";
|
|
104
104
|
import Debug from "debug";
|
|
105
105
|
function Injectable() {
|
|
106
106
|
return (target) => Empty(target);
|
|
@@ -116,8 +116,8 @@ async function Factory(models, opts = {}) {
|
|
|
116
116
|
const dependenceGraph = /* @__PURE__ */ new Map();
|
|
117
117
|
const isolateSet = /* @__PURE__ */ new Set();
|
|
118
118
|
const { http, rpc } = opts;
|
|
119
|
-
if (!
|
|
120
|
-
|
|
119
|
+
if (!getInject("watcher")) {
|
|
120
|
+
setInject("watcher", ({ eventName, instance, key, options }) => {
|
|
121
121
|
const fn = typeof instance[key] === "function" ? instance[key].bind(instance) : (v) => instance[key] = v;
|
|
122
122
|
if (options?.once)
|
|
123
123
|
emitter.once(eventName, fn);
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk2TLXS2XOjs = require('./chunk-2TLXS2XO.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -61,7 +61,7 @@ var _phecdacore = require('phecda-core'); _createStarExport(_phecdacore);
|
|
|
61
61
|
|
|
62
62
|
function BaseParam(type, key) {
|
|
63
63
|
return (target, k, index) => {
|
|
64
|
-
_phecdacore.
|
|
64
|
+
_phecdacore.setStateKey.call(void 0, target, k);
|
|
65
65
|
const state = _phecdacore.getOwnState.call(void 0, target, k);
|
|
66
66
|
if (!state.params)
|
|
67
67
|
state.params = [];
|
|
@@ -83,7 +83,7 @@ function BaseParam(type, key) {
|
|
|
83
83
|
_chunkPC6CFB6Sjs.__name.call(void 0, BaseParam, "BaseParam");
|
|
84
84
|
function Pipe(key, opts) {
|
|
85
85
|
return (target, k, index) => {
|
|
86
|
-
_phecdacore.
|
|
86
|
+
_phecdacore.setStateKey.call(void 0, target, k);
|
|
87
87
|
const state = _phecdacore.getOwnState.call(void 0, target, k);
|
|
88
88
|
if (!state.params)
|
|
89
89
|
state.params = [];
|
|
@@ -131,7 +131,7 @@ function Route(route, type) {
|
|
|
131
131
|
if (!key)
|
|
132
132
|
key = _phecdacore.SHARE_KEY;
|
|
133
133
|
target = key === _phecdacore.SHARE_KEY ? target.prototype : target;
|
|
134
|
-
_phecdacore.
|
|
134
|
+
_phecdacore.setStateKey.call(void 0, target, key);
|
|
135
135
|
const state = _phecdacore.getOwnState.call(void 0, target, key);
|
|
136
136
|
state.http = {
|
|
137
137
|
route,
|
|
@@ -170,7 +170,7 @@ function Rpc(...types) {
|
|
|
170
170
|
if (!key)
|
|
171
171
|
key = _phecdacore.SHARE_KEY;
|
|
172
172
|
target = key === _phecdacore.SHARE_KEY ? target.prototype : target;
|
|
173
|
-
_phecdacore.
|
|
173
|
+
_phecdacore.setStateKey.call(void 0, target, key);
|
|
174
174
|
const state = _phecdacore.getOwnState.call(void 0, target, key);
|
|
175
175
|
if (!state.rpc)
|
|
176
176
|
state.rpc = {};
|
|
@@ -184,7 +184,7 @@ function Event(isEvent = true) {
|
|
|
184
184
|
if (!key)
|
|
185
185
|
key = _phecdacore.SHARE_KEY;
|
|
186
186
|
target = key === _phecdacore.SHARE_KEY ? target.prototype : target;
|
|
187
|
-
_phecdacore.
|
|
187
|
+
_phecdacore.setStateKey.call(void 0, target, key);
|
|
188
188
|
const state = _phecdacore.getOwnState.call(void 0, target, key);
|
|
189
189
|
if (!state.rpc)
|
|
190
190
|
state.rpc = {};
|
|
@@ -201,7 +201,7 @@ function Guard(...guards) {
|
|
|
201
201
|
if (!key)
|
|
202
202
|
key = _phecdacore.SHARE_KEY;
|
|
203
203
|
target = key === _phecdacore.SHARE_KEY ? target.prototype : target;
|
|
204
|
-
_phecdacore.
|
|
204
|
+
_phecdacore.setStateKey.call(void 0, target, key);
|
|
205
205
|
const state = _phecdacore.getOwnState.call(void 0, target, key);
|
|
206
206
|
if (!state.guards)
|
|
207
207
|
state.guards = [];
|
|
@@ -215,7 +215,7 @@ function Plugin(...plugins) {
|
|
|
215
215
|
if (!key)
|
|
216
216
|
key = _phecdacore.SHARE_KEY;
|
|
217
217
|
target = key === _phecdacore.SHARE_KEY ? target.prototype : target;
|
|
218
|
-
_phecdacore.
|
|
218
|
+
_phecdacore.setStateKey.call(void 0, target, key);
|
|
219
219
|
const state = _phecdacore.getOwnState.call(void 0, target, key);
|
|
220
220
|
if (!state.plugins)
|
|
221
221
|
state.plugins = [];
|
|
@@ -229,7 +229,7 @@ function Interceptor(...interceptors) {
|
|
|
229
229
|
if (!key)
|
|
230
230
|
key = _phecdacore.SHARE_KEY;
|
|
231
231
|
target = key === _phecdacore.SHARE_KEY ? target.prototype : target;
|
|
232
|
-
_phecdacore.
|
|
232
|
+
_phecdacore.setStateKey.call(void 0, target, key);
|
|
233
233
|
const state = _phecdacore.getOwnState.call(void 0, target, key);
|
|
234
234
|
if (!state.interceptors)
|
|
235
235
|
state.interceptors = [];
|
|
@@ -243,7 +243,7 @@ function Filter(filter) {
|
|
|
243
243
|
if (!key)
|
|
244
244
|
key = _phecdacore.SHARE_KEY;
|
|
245
245
|
target = key === _phecdacore.SHARE_KEY ? target.prototype : target;
|
|
246
|
-
_phecdacore.
|
|
246
|
+
_phecdacore.setStateKey.call(void 0, target, key);
|
|
247
247
|
const state = _phecdacore.getOwnState.call(void 0, target, key);
|
|
248
248
|
state.filter = filter;
|
|
249
249
|
_phecdacore.setState.call(void 0, target, key, state);
|
|
@@ -254,7 +254,7 @@ _chunkPC6CFB6Sjs.__name.call(void 0, Filter, "Filter");
|
|
|
254
254
|
// src/decorators/index.ts
|
|
255
255
|
function Header(name, value) {
|
|
256
256
|
return (target, k) => {
|
|
257
|
-
_phecdacore.
|
|
257
|
+
_phecdacore.setStateKey.call(void 0, target, k);
|
|
258
258
|
const state = _phecdacore.getOwnState.call(void 0, target, k);
|
|
259
259
|
if (!state.header)
|
|
260
260
|
state.header = {};
|
|
@@ -273,7 +273,7 @@ function Define(key, value) {
|
|
|
273
273
|
k = _phecdacore.SHARE_KEY;
|
|
274
274
|
target = target.prototype;
|
|
275
275
|
}
|
|
276
|
-
_phecdacore.
|
|
276
|
+
_phecdacore.setStateKey.call(void 0, target, k);
|
|
277
277
|
const state = _phecdacore.getOwnState.call(void 0, target, k);
|
|
278
278
|
if (!state.define)
|
|
279
279
|
state.define = {};
|
|
@@ -514,4 +514,4 @@ _chunkPC6CFB6Sjs.__name.call(void 0, PExtension, "PExtension");
|
|
|
514
514
|
|
|
515
515
|
|
|
516
516
|
|
|
517
|
-
exports.Arg = Arg; exports.BadGatewayException = _chunkBZFD4POHjs.BadGatewayException; exports.BadRequestException = _chunkBZFD4POHjs.BadRequestException; exports.BaseParam = BaseParam; exports.Body = Body; exports.ConflictException = _chunkBZFD4POHjs.ConflictException; exports.Context = _chunkBZFD4POHjs.Context; exports.Controller = Controller; exports.Ctx = Ctx; exports.Define = Define; exports.Delete = Delete; exports.Dev = Dev; exports.ERROR_SYMBOL = _chunkPC6CFB6Sjs.ERROR_SYMBOL; exports.Event = Event; exports.Exception = _chunkBZFD4POHjs.Exception; exports.Factory =
|
|
517
|
+
exports.Arg = Arg; exports.BadGatewayException = _chunkBZFD4POHjs.BadGatewayException; exports.BadRequestException = _chunkBZFD4POHjs.BadRequestException; exports.BaseParam = BaseParam; exports.Body = Body; exports.ConflictException = _chunkBZFD4POHjs.ConflictException; exports.Context = _chunkBZFD4POHjs.Context; exports.Controller = Controller; exports.Ctx = Ctx; exports.Define = Define; exports.Delete = Delete; exports.Dev = Dev; exports.ERROR_SYMBOL = _chunkPC6CFB6Sjs.ERROR_SYMBOL; exports.Event = Event; exports.Exception = _chunkBZFD4POHjs.Exception; exports.Factory = _chunk2TLXS2XOjs.Factory; exports.Filter = Filter; exports.ForbiddenException = _chunkBZFD4POHjs.ForbiddenException; exports.FrameworkException = _chunkBZFD4POHjs.FrameworkException; exports.Get = Get; exports.Guard = Guard; exports.Head = Head; exports.Header = Header; exports.IS_DEV = _chunkPC6CFB6Sjs.IS_DEV; exports.IS_LOG_BAN = _chunkPC6CFB6Sjs.IS_LOG_BAN; exports.IS_STRICT = _chunkPC6CFB6Sjs.IS_STRICT; exports.Injectable = _chunk2TLXS2XOjs.Injectable; exports.Interceptor = Interceptor; exports.InvalidInputException = _chunkBZFD4POHjs.InvalidInputException; exports.MERGE_SYMBOL = _chunkPC6CFB6Sjs.MERGE_SYMBOL; exports.META_SYMBOL = _chunkPC6CFB6Sjs.META_SYMBOL; exports.MODULE_SYMBOL = _chunkPC6CFB6Sjs.MODULE_SYMBOL; exports.Meta = _chunk2TLXS2XOjs.Meta; exports.Mix = _chunkPC6CFB6Sjs.Mix; exports.NotFoundException = _chunkBZFD4POHjs.NotFoundException; exports.PExtension = PExtension; exports.PFilter = PFilter; exports.PGuard = PGuard; exports.PInterceptor = PInterceptor; exports.PPipe = PPipe; exports.PPlugin = PPlugin; exports.PS_FILE_RE = _chunkPC6CFB6Sjs.PS_FILE_RE; exports.PS_IMPORT_RE = _chunkPC6CFB6Sjs.PS_IMPORT_RE; exports.PS_SYMBOL = _chunkPC6CFB6Sjs.PS_SYMBOL; exports.Param = Param; exports.Patch = Patch; exports.PayloadLargeException = _chunkBZFD4POHjs.PayloadLargeException; exports.Pipe = Pipe; exports.Plugin = Plugin; exports.Post = Post; exports.Put = Put; exports.Query = Query; exports.Route = Route; exports.Rpc = Rpc; exports.ServiceUnavailableException = _chunkBZFD4POHjs.ServiceUnavailableException; exports.TimeoutException = _chunkBZFD4POHjs.TimeoutException; exports.UNMOUNT_SYMBOL = _chunkPC6CFB6Sjs.UNMOUNT_SYMBOL; exports.UnauthorizedException = _chunkBZFD4POHjs.UnauthorizedException; exports.UndefinedException = _chunkBZFD4POHjs.UndefinedException; exports.UnsupportedMediaTypeException = _chunkBZFD4POHjs.UnsupportedMediaTypeException; exports.ValidateException = _chunkBZFD4POHjs.ValidateException; exports.addFilter = _chunkBZFD4POHjs.addFilter; exports.addGuard = _chunkBZFD4POHjs.addGuard; exports.addInterceptor = _chunkBZFD4POHjs.addInterceptor; exports.addPipe = _chunkBZFD4POHjs.addPipe; exports.addPlugin = _chunkBZFD4POHjs.addPlugin; exports.argToReq = _chunkXCXOCS2Zjs.argToReq; exports.defaultPipe = _chunkBZFD4POHjs.defaultPipe; exports.emitter = _chunk2TLXS2XOjs.emitter; exports.generateHTTPCode = _chunk2TLXS2XOjs.generateHTTPCode; exports.generateRPCCode = _chunk2TLXS2XOjs.generateRPCCode; exports.getConfig = _chunkPC6CFB6Sjs.getConfig; exports.isAopDepInject = _chunkBZFD4POHjs.isAopDepInject; exports.log = _chunkPC6CFB6Sjs.log; exports.resolveDep = _chunkXCXOCS2Zjs.resolveDep; exports.setConfig = _chunkPC6CFB6Sjs.setConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
emitter,
|
|
6
6
|
generateHTTPCode,
|
|
7
7
|
generateRPCCode
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-O7NCAS3L.mjs";
|
|
9
9
|
import {
|
|
10
10
|
argToReq,
|
|
11
11
|
resolveDep
|
|
@@ -55,13 +55,13 @@ import {
|
|
|
55
55
|
} from "./chunk-6UJL6PS3.mjs";
|
|
56
56
|
|
|
57
57
|
// src/decorators/index.ts
|
|
58
|
-
import { SHARE_KEY as SHARE_KEY3, getOwnState as getOwnState4, set, setState as setState4,
|
|
58
|
+
import { SHARE_KEY as SHARE_KEY3, getOwnState as getOwnState4, set, setState as setState4, setStateKey as setStateKey4 } from "phecda-core";
|
|
59
59
|
|
|
60
60
|
// src/decorators/param.ts
|
|
61
|
-
import { getOwnState, setState,
|
|
61
|
+
import { getOwnState, setState, setStateKey } from "phecda-core";
|
|
62
62
|
function BaseParam(type, key) {
|
|
63
63
|
return (target, k, index) => {
|
|
64
|
-
|
|
64
|
+
setStateKey(target, k);
|
|
65
65
|
const state = getOwnState(target, k);
|
|
66
66
|
if (!state.params)
|
|
67
67
|
state.params = [];
|
|
@@ -83,7 +83,7 @@ function BaseParam(type, key) {
|
|
|
83
83
|
__name(BaseParam, "BaseParam");
|
|
84
84
|
function Pipe(key, opts) {
|
|
85
85
|
return (target, k, index) => {
|
|
86
|
-
|
|
86
|
+
setStateKey(target, k);
|
|
87
87
|
const state = getOwnState(target, k);
|
|
88
88
|
if (!state.params)
|
|
89
89
|
state.params = [];
|
|
@@ -125,13 +125,13 @@ function Arg() {
|
|
|
125
125
|
__name(Arg, "Arg");
|
|
126
126
|
|
|
127
127
|
// src/decorators/route.ts
|
|
128
|
-
import { SHARE_KEY, getOwnState as getOwnState2, setState as setState2,
|
|
128
|
+
import { SHARE_KEY, getOwnState as getOwnState2, setState as setState2, setStateKey as setStateKey2 } from "phecda-core";
|
|
129
129
|
function Route(route, type) {
|
|
130
130
|
return (target, key) => {
|
|
131
131
|
if (!key)
|
|
132
132
|
key = SHARE_KEY;
|
|
133
133
|
target = key === SHARE_KEY ? target.prototype : target;
|
|
134
|
-
|
|
134
|
+
setStateKey2(target, key);
|
|
135
135
|
const state = getOwnState2(target, key);
|
|
136
136
|
state.http = {
|
|
137
137
|
route,
|
|
@@ -170,7 +170,7 @@ function Rpc(...types) {
|
|
|
170
170
|
if (!key)
|
|
171
171
|
key = SHARE_KEY;
|
|
172
172
|
target = key === SHARE_KEY ? target.prototype : target;
|
|
173
|
-
|
|
173
|
+
setStateKey2(target, key);
|
|
174
174
|
const state = getOwnState2(target, key);
|
|
175
175
|
if (!state.rpc)
|
|
176
176
|
state.rpc = {};
|
|
@@ -184,7 +184,7 @@ function Event(isEvent = true) {
|
|
|
184
184
|
if (!key)
|
|
185
185
|
key = SHARE_KEY;
|
|
186
186
|
target = key === SHARE_KEY ? target.prototype : target;
|
|
187
|
-
|
|
187
|
+
setStateKey2(target, key);
|
|
188
188
|
const state = getOwnState2(target, key);
|
|
189
189
|
if (!state.rpc)
|
|
190
190
|
state.rpc = {};
|
|
@@ -195,13 +195,13 @@ function Event(isEvent = true) {
|
|
|
195
195
|
__name(Event, "Event");
|
|
196
196
|
|
|
197
197
|
// src/decorators/aop.ts
|
|
198
|
-
import { SHARE_KEY as SHARE_KEY2, getOwnState as getOwnState3, setState as setState3,
|
|
198
|
+
import { SHARE_KEY as SHARE_KEY2, getOwnState as getOwnState3, setState as setState3, setStateKey as setStateKey3 } from "phecda-core";
|
|
199
199
|
function Guard(...guards) {
|
|
200
200
|
return (target, key) => {
|
|
201
201
|
if (!key)
|
|
202
202
|
key = SHARE_KEY2;
|
|
203
203
|
target = key === SHARE_KEY2 ? target.prototype : target;
|
|
204
|
-
|
|
204
|
+
setStateKey3(target, key);
|
|
205
205
|
const state = getOwnState3(target, key);
|
|
206
206
|
if (!state.guards)
|
|
207
207
|
state.guards = [];
|
|
@@ -215,7 +215,7 @@ function Plugin(...plugins) {
|
|
|
215
215
|
if (!key)
|
|
216
216
|
key = SHARE_KEY2;
|
|
217
217
|
target = key === SHARE_KEY2 ? target.prototype : target;
|
|
218
|
-
|
|
218
|
+
setStateKey3(target, key);
|
|
219
219
|
const state = getOwnState3(target, key);
|
|
220
220
|
if (!state.plugins)
|
|
221
221
|
state.plugins = [];
|
|
@@ -229,7 +229,7 @@ function Interceptor(...interceptors) {
|
|
|
229
229
|
if (!key)
|
|
230
230
|
key = SHARE_KEY2;
|
|
231
231
|
target = key === SHARE_KEY2 ? target.prototype : target;
|
|
232
|
-
|
|
232
|
+
setStateKey3(target, key);
|
|
233
233
|
const state = getOwnState3(target, key);
|
|
234
234
|
if (!state.interceptors)
|
|
235
235
|
state.interceptors = [];
|
|
@@ -243,7 +243,7 @@ function Filter(filter) {
|
|
|
243
243
|
if (!key)
|
|
244
244
|
key = SHARE_KEY2;
|
|
245
245
|
target = key === SHARE_KEY2 ? target.prototype : target;
|
|
246
|
-
|
|
246
|
+
setStateKey3(target, key);
|
|
247
247
|
const state = getOwnState3(target, key);
|
|
248
248
|
state.filter = filter;
|
|
249
249
|
setState3(target, key, state);
|
|
@@ -254,7 +254,7 @@ __name(Filter, "Filter");
|
|
|
254
254
|
// src/decorators/index.ts
|
|
255
255
|
function Header(name, value) {
|
|
256
256
|
return (target, k) => {
|
|
257
|
-
|
|
257
|
+
setStateKey4(target, k);
|
|
258
258
|
const state = getOwnState4(target, k);
|
|
259
259
|
if (!state.header)
|
|
260
260
|
state.header = {};
|
|
@@ -273,7 +273,7 @@ function Define(key, value) {
|
|
|
273
273
|
k = SHARE_KEY3;
|
|
274
274
|
target = target.prototype;
|
|
275
275
|
}
|
|
276
|
-
|
|
276
|
+
setStateKey4(target, k);
|
|
277
277
|
const state = getOwnState4(target, k);
|
|
278
278
|
if (!state.define)
|
|
279
279
|
state.define = {};
|
package/dist/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2TLXS2XOjs = require('./chunk-2TLXS2XO.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkPC6CFB6Sjs = require('./chunk-PC6CFB6S.js');
|
|
@@ -8,7 +8,7 @@ var _chunkPC6CFB6Sjs = require('./chunk-PC6CFB6S.js');
|
|
|
8
8
|
// src/test.ts
|
|
9
9
|
var _phecdacore = require('phecda-core');
|
|
10
10
|
async function TestFactory(...Modules) {
|
|
11
|
-
const { moduleMap, constructorMap } = await
|
|
11
|
+
const { moduleMap, constructorMap } = await _chunk2TLXS2XOjs.Factory.call(void 0, Modules);
|
|
12
12
|
return {
|
|
13
13
|
get(Module) {
|
|
14
14
|
const tag = _phecdacore.getTag.call(void 0, Module);
|
package/dist/test.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-server",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.24",
|
|
4
4
|
"description": "provide express middlewares, `nestjs` format",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"hyper-express": "^6.15.2",
|
|
130
130
|
"picocolors": "^1.0.0",
|
|
131
131
|
"reflect-metadata": "^0.1.13",
|
|
132
|
-
"phecda-core": "3.0.0-beta.
|
|
132
|
+
"phecda-core": "3.0.0-beta.16"
|
|
133
133
|
},
|
|
134
134
|
"scripts": {
|
|
135
135
|
"dev": "tsup --watch",
|