@kanjijs/core 0.2.0-beta.1 → 0.2.0-beta.11
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/dist/index.js +59 -55
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1019,69 +1019,73 @@ var methodMetadataStore = new WeakMap;
|
|
|
1019
1019
|
var controllerMetadataStore = new WeakMap;
|
|
1020
1020
|
var moduleMetadataStore = new WeakMap;
|
|
1021
1021
|
var injectionMetadataStore = new WeakMap;
|
|
1022
|
-
var
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
methods =
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
methods = new Map;
|
|
1036
|
-
methodMetadataStore.set(target, methods);
|
|
1037
|
-
}
|
|
1038
|
-
const existing = methods.get(methodName) || {};
|
|
1039
|
-
existing.contract = contract;
|
|
1040
|
-
methods.set(methodName, existing);
|
|
1041
|
-
},
|
|
1042
|
-
addMiddleware(target, middleware, methodName) {
|
|
1043
|
-
if (methodName) {
|
|
1022
|
+
var globalStore = globalThis;
|
|
1023
|
+
if (!globalStore.KANJI_METADATA_STORAGE) {
|
|
1024
|
+
globalStore.KANJI_METADATA_STORAGE = {
|
|
1025
|
+
addRoute(target, methodName, meta) {
|
|
1026
|
+
let methods = methodMetadataStore.get(target);
|
|
1027
|
+
if (!methods) {
|
|
1028
|
+
methods = new Map;
|
|
1029
|
+
methodMetadataStore.set(target, methods);
|
|
1030
|
+
}
|
|
1031
|
+
const existing = methods.get(methodName) || {};
|
|
1032
|
+
methods.set(methodName, { ...existing, ...meta });
|
|
1033
|
+
},
|
|
1034
|
+
addContract(target, methodName, contract) {
|
|
1044
1035
|
let methods = methodMetadataStore.get(target);
|
|
1045
1036
|
if (!methods) {
|
|
1046
1037
|
methods = new Map;
|
|
1047
1038
|
methodMetadataStore.set(target, methods);
|
|
1048
1039
|
}
|
|
1049
1040
|
const existing = methods.get(methodName) || {};
|
|
1050
|
-
existing.
|
|
1041
|
+
existing.contract = contract;
|
|
1051
1042
|
methods.set(methodName, existing);
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1043
|
+
},
|
|
1044
|
+
addMiddleware(target, middleware, methodName) {
|
|
1045
|
+
if (methodName) {
|
|
1046
|
+
let methods = methodMetadataStore.get(target);
|
|
1047
|
+
if (!methods) {
|
|
1048
|
+
methods = new Map;
|
|
1049
|
+
methodMetadataStore.set(target, methods);
|
|
1050
|
+
}
|
|
1051
|
+
const existing = methods.get(methodName) || {};
|
|
1052
|
+
existing.middlewares = [...existing.middlewares || [], middleware];
|
|
1053
|
+
methods.set(methodName, existing);
|
|
1054
|
+
} else {
|
|
1055
|
+
const existing = controllerMetadataStore.get(target) || { prefix: "/" };
|
|
1056
|
+
existing.middlewares = [...existing.middlewares || [], middleware];
|
|
1057
|
+
controllerMetadataStore.set(target, existing);
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
getRoutes(target) {
|
|
1061
|
+
return methodMetadataStore.get(target);
|
|
1062
|
+
},
|
|
1063
|
+
setController(target, meta) {
|
|
1064
|
+
controllerMetadataStore.set(target, meta);
|
|
1065
|
+
},
|
|
1066
|
+
getController(target) {
|
|
1067
|
+
return controllerMetadataStore.get(target);
|
|
1068
|
+
},
|
|
1069
|
+
defineModule(target, meta) {
|
|
1070
|
+
moduleMetadataStore.set(target, meta);
|
|
1071
|
+
},
|
|
1072
|
+
getModule(target) {
|
|
1073
|
+
return moduleMetadataStore.get(target);
|
|
1074
|
+
},
|
|
1075
|
+
addInjection(target, index, token) {
|
|
1076
|
+
let injections = injectionMetadataStore.get(target);
|
|
1077
|
+
if (!injections) {
|
|
1078
|
+
injections = new Map;
|
|
1079
|
+
injectionMetadataStore.set(target, injections);
|
|
1080
|
+
}
|
|
1081
|
+
injections.set(index, token);
|
|
1082
|
+
},
|
|
1083
|
+
getInjections(target) {
|
|
1084
|
+
return injectionMetadataStore.get(target);
|
|
1078
1085
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
return injectionMetadataStore.get(target);
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
var MetadataStorage = globalStore.KANJI_METADATA_STORAGE;
|
|
1085
1089
|
|
|
1086
1090
|
// src/decorators.ts
|
|
1087
1091
|
function Module(metadata) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanjijs/core",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"test": "bun test"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@kanjijs/common": "
|
|
18
|
-
"@kanjijs/contracts": "
|
|
17
|
+
"@kanjijs/common": "^0.2.0-beta.11",
|
|
18
|
+
"@kanjijs/contracts": "^0.2.0-beta.11",
|
|
19
19
|
"reflect-metadata": "^0.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|