@tsed/platform-router 7.13.1 → 7.13.3
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/lib/cjs/domain/PlatformLayer.js +6 -2
- package/lib/cjs/domain/PlatformLayer.js.map +1 -1
- package/lib/esm/domain/PlatformLayer.js +6 -2
- package/lib/esm/domain/PlatformLayer.js.map +1 -1
- package/lib/types/domain/PlatformLayer.d.ts +1 -0
- package/lib/types/domain/PlatformRouter.d.ts +1 -0
- package/package.json +13 -13
|
@@ -16,8 +16,11 @@ class PlatformLayer {
|
|
|
16
16
|
#args;
|
|
17
17
|
constructor(props = {}) {
|
|
18
18
|
Object.assign(this, props);
|
|
19
|
-
this.layers.
|
|
20
|
-
|
|
19
|
+
this.layers = this.layers.map((layer) => {
|
|
20
|
+
return new PlatformLayer({
|
|
21
|
+
...layer,
|
|
22
|
+
parent: this
|
|
23
|
+
});
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
set(args) {
|
|
@@ -31,6 +34,7 @@ class PlatformLayer {
|
|
|
31
34
|
}
|
|
32
35
|
inspect() {
|
|
33
36
|
return {
|
|
37
|
+
basePath: this.getBasePath(),
|
|
34
38
|
path: this.path,
|
|
35
39
|
method: this.method,
|
|
36
40
|
handlers: this.handlers.map((item) => String(item)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformLayer.js","sourceRoot":"","sources":["../../../src/domain/PlatformLayer.ts"],"names":[],"mappings":";;;AAAA,qCAAqD;AAGrD,yCAAwC;AAqBxC,MAAa,aAAa;IACjB,QAAQ,CAAW;IACnB,IAAI,GAAmB,EAAE,CAAC;IAC1B,MAAM,CAAS;IACf,QAAQ,GAA8B,EAAE,CAAC;IACzC,MAAM,CAAkB;IACxB,IAAI,GAAyB,EAAE,CAAC;IAEhC,MAAM,GAAoB,EAAE,CAAC;IAE7B,MAAM,CAAiB;IAC9B,QAAQ,CAAiB;IACzB,KAAK,CAA2B;IA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,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACxD,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBAC3D,OAAO;oBACL,GAAG,GAAG;oBACN,CAAC,GAAG,CAAC,EAAE,IAAA,kBAAW,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,aAAM,EAAC,KAAK,CAAC;iBAClD,CAAC;YACJ,CAAC,EAAE,EAAE,CAAC;SACP,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO,IAAA,mBAAU,EAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAED,SAAS,CAAC,MAAuB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACjC,OAAO,IAAI,aAAa,CAAC;gBACvB,GAAG,KAAK;gBACR,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhED,sCAgEC","sourcesContent":["import {isPrimitive, nameOf, Type} from \"@tsed/core\";\nimport {Provider} from \"@tsed/di\";\nimport type {PlatformParamsCallback} from \"@tsed/platform-params\";\nimport {concatPath} from \"@tsed/schema\";\n\nimport {PlatformHandlerMetadata} from \"./PlatformHandlerMetadata\";\nimport type {PlatformRouter} from \"./PlatformRouter\";\nimport {SinglePathType} from \"./SinglePathType\";\n\nexport interface PlatformLayerOptions extends Record<string, any> {\n token?: Type<any>;\n}\n\nexport interface PlatformLayerProps {\n parent: PlatformLayer;\n provider: Provider;\n path: SinglePathType;\n basePath: SinglePathType;\n method: string;\n handlers: any[];\n router: PlatformRouter;\n opts: PlatformLayerOptions;\n}\n\nexport class PlatformLayer {\n public provider: Provider;\n public path: SinglePathType = \"\";\n public method: string;\n public handlers: PlatformHandlerMetadata[] = [];\n public router?: PlatformRouter;\n public opts: PlatformLayerOptions = {};\n\n public layers: PlatformLayer[] = [];\n\n public parent?: PlatformLayer;\n basePath: SinglePathType;\n #args: PlatformParamsCallback[];\n\n constructor(props: Partial<PlatformLayerProps> = {}) {\n Object.assign(this, props);\n\n this.layers = this.layers.map((layer) => {\n return new PlatformLayer({\n ...layer,\n parent: this\n });\n });\n }\n\n set(args: PlatformParamsCallback[]) {\n this.#args = args;\n }\n\n getArgs() {\n return [this.path, ...this.#args].filter(Boolean);\n }\n\n isProvider() {\n return !!this.provider;\n }\n\n inspect() {\n return {\n basePath: this.getBasePath(),\n path: this.path,\n method: this.method,\n handlers: this.handlers.map((item: any) => String(item)),\n opts: Object.entries(this.opts).reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: isPrimitive(value) ? value : nameOf(value)\n };\n }, {})\n };\n }\n\n getBasePath(): string {\n return concatPath(this.parent?.getBasePath(), this.basePath);\n }\n\n setLayers(layers: PlatformLayer[]) {\n this.layers = layers.map((layer) => {\n return new PlatformLayer({\n ...layer,\n parent: this\n });\n });\n }\n}\n"]}
|
|
@@ -13,8 +13,11 @@ export class PlatformLayer {
|
|
|
13
13
|
#args;
|
|
14
14
|
constructor(props = {}) {
|
|
15
15
|
Object.assign(this, props);
|
|
16
|
-
this.layers.
|
|
17
|
-
|
|
16
|
+
this.layers = this.layers.map((layer) => {
|
|
17
|
+
return new PlatformLayer({
|
|
18
|
+
...layer,
|
|
19
|
+
parent: this
|
|
20
|
+
});
|
|
18
21
|
});
|
|
19
22
|
}
|
|
20
23
|
set(args) {
|
|
@@ -28,6 +31,7 @@ export class PlatformLayer {
|
|
|
28
31
|
}
|
|
29
32
|
inspect() {
|
|
30
33
|
return {
|
|
34
|
+
basePath: this.getBasePath(),
|
|
31
35
|
path: this.path,
|
|
32
36
|
method: this.method,
|
|
33
37
|
handlers: this.handlers.map((item) => String(item)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformLayer.js","sourceRoot":"","sources":["../../../src/domain/PlatformLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,MAAM,EAAO,MAAM,YAAY,CAAC;AAGrD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAqBxC,MAAM,OAAO,aAAa;IACjB,QAAQ,CAAW;IACnB,IAAI,GAAmB,EAAE,CAAC;IAC1B,MAAM,CAAS;IACf,QAAQ,GAA8B,EAAE,CAAC;IACzC,MAAM,CAAkB;IACxB,IAAI,GAAyB,EAAE,CAAC;IAEhC,MAAM,GAAoB,EAAE,CAAC;IAE7B,MAAM,CAAiB;IAC9B,QAAQ,CAAiB;IACzB,KAAK,CAA2B;IAEhC,YAAY,QAAqC,EAAE;QACjD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAE3B,IAAI,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"PlatformLayer.js","sourceRoot":"","sources":["../../../src/domain/PlatformLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,MAAM,EAAO,MAAM,YAAY,CAAC;AAGrD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAqBxC,MAAM,OAAO,aAAa;IACjB,QAAQ,CAAW;IACnB,IAAI,GAAmB,EAAE,CAAC;IAC1B,MAAM,CAAS;IACf,QAAQ,GAA8B,EAAE,CAAC;IACzC,MAAM,CAAkB;IACxB,IAAI,GAAyB,EAAE,CAAC;IAEhC,MAAM,GAAoB,EAAE,CAAC;IAE7B,MAAM,CAAiB;IAC9B,QAAQ,CAAiB;IACzB,KAAK,CAA2B;IAEhC,YAAY,QAAqC,EAAE;QACjD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CA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D,CAAC;IAED,SAAS,CAAC,MAAuB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACjC,OAAO,IAAI,aAAa,CAAC;gBACvB,GAAG,KAAK;gBACR,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import {isPrimitive, nameOf, Type} from \"@tsed/core\";\nimport {Provider} from \"@tsed/di\";\nimport type {PlatformParamsCallback} from \"@tsed/platform-params\";\nimport {concatPath} from \"@tsed/schema\";\n\nimport {PlatformHandlerMetadata} from \"./PlatformHandlerMetadata\";\nimport type {PlatformRouter} from \"./PlatformRouter\";\nimport {SinglePathType} from \"./SinglePathType\";\n\nexport interface PlatformLayerOptions extends Record<string, any> {\n token?: Type<any>;\n}\n\nexport interface PlatformLayerProps {\n parent: PlatformLayer;\n provider: Provider;\n path: SinglePathType;\n basePath: SinglePathType;\n method: string;\n handlers: any[];\n router: PlatformRouter;\n opts: PlatformLayerOptions;\n}\n\nexport class PlatformLayer {\n public provider: Provider;\n public path: SinglePathType = \"\";\n public method: string;\n public handlers: PlatformHandlerMetadata[] = [];\n public router?: PlatformRouter;\n public opts: PlatformLayerOptions = {};\n\n public layers: PlatformLayer[] = [];\n\n public parent?: PlatformLayer;\n basePath: SinglePathType;\n #args: PlatformParamsCallback[];\n\n constructor(props: Partial<PlatformLayerProps> = {}) {\n Object.assign(this, props);\n\n this.layers = this.layers.map((layer) => {\n return new PlatformLayer({\n ...layer,\n parent: this\n });\n });\n }\n\n set(args: PlatformParamsCallback[]) {\n this.#args = args;\n }\n\n getArgs() {\n return [this.path, ...this.#args].filter(Boolean);\n }\n\n isProvider() {\n return !!this.provider;\n }\n\n inspect() {\n return {\n basePath: this.getBasePath(),\n path: this.path,\n method: this.method,\n handlers: this.handlers.map((item: any) => String(item)),\n opts: Object.entries(this.opts).reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: isPrimitive(value) ? value : nameOf(value)\n };\n }, {})\n };\n }\n\n getBasePath(): string {\n return concatPath(this.parent?.getBasePath(), this.basePath);\n }\n\n setLayers(layers: PlatformLayer[]) {\n this.layers = layers.map((layer) => {\n return new PlatformLayer({\n ...layer,\n parent: this\n });\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-router",
|
|
3
|
-
"version": "7.13.
|
|
3
|
+
"version": "7.13.3",
|
|
4
4
|
"description": "Router",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
"tslib": "2.4.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@tsed/core": "7.13.
|
|
28
|
-
"@tsed/di": "7.13.
|
|
29
|
-
"@tsed/exceptions": "7.13.
|
|
30
|
-
"@tsed/json-mapper": "7.13.
|
|
31
|
-
"@tsed/platform-params": "7.13.
|
|
32
|
-
"@tsed/schema": "7.13.
|
|
27
|
+
"@tsed/core": "7.13.3",
|
|
28
|
+
"@tsed/di": "7.13.3",
|
|
29
|
+
"@tsed/exceptions": "7.13.3",
|
|
30
|
+
"@tsed/json-mapper": "7.13.3",
|
|
31
|
+
"@tsed/platform-params": "7.13.3",
|
|
32
|
+
"@tsed/schema": "7.13.3"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@tsed/core": "^7.13.
|
|
36
|
-
"@tsed/di": "^7.13.
|
|
37
|
-
"@tsed/exceptions": "^7.13.
|
|
38
|
-
"@tsed/json-mapper": "^7.13.
|
|
39
|
-
"@tsed/platform-params": "^7.13.
|
|
40
|
-
"@tsed/schema": "^7.13.
|
|
35
|
+
"@tsed/core": "^7.13.3",
|
|
36
|
+
"@tsed/di": "^7.13.3",
|
|
37
|
+
"@tsed/exceptions": "^7.13.3",
|
|
38
|
+
"@tsed/json-mapper": "^7.13.3",
|
|
39
|
+
"@tsed/platform-params": "^7.13.3",
|
|
40
|
+
"@tsed/schema": "^7.13.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
43
43
|
"@tsed/core": {
|