@kanjijs/auth 0.2.0-beta.1 → 0.2.0-beta.10
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 +2 -2
package/dist/index.js
CHANGED
|
@@ -1038,69 +1038,73 @@ var methodMetadataStore = new WeakMap;
|
|
|
1038
1038
|
var controllerMetadataStore = new WeakMap;
|
|
1039
1039
|
var moduleMetadataStore = new WeakMap;
|
|
1040
1040
|
var injectionMetadataStore = new WeakMap;
|
|
1041
|
-
var
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
methods =
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
methods = new Map;
|
|
1055
|
-
methodMetadataStore.set(target, methods);
|
|
1056
|
-
}
|
|
1057
|
-
const existing = methods.get(methodName) || {};
|
|
1058
|
-
existing.contract = contract;
|
|
1059
|
-
methods.set(methodName, existing);
|
|
1060
|
-
},
|
|
1061
|
-
addMiddleware(target, middleware, methodName) {
|
|
1062
|
-
if (methodName) {
|
|
1041
|
+
var globalStore = globalThis;
|
|
1042
|
+
if (!globalStore.KANJI_METADATA_STORAGE) {
|
|
1043
|
+
globalStore.KANJI_METADATA_STORAGE = {
|
|
1044
|
+
addRoute(target, methodName, meta) {
|
|
1045
|
+
let methods = methodMetadataStore.get(target);
|
|
1046
|
+
if (!methods) {
|
|
1047
|
+
methods = new Map;
|
|
1048
|
+
methodMetadataStore.set(target, methods);
|
|
1049
|
+
}
|
|
1050
|
+
const existing = methods.get(methodName) || {};
|
|
1051
|
+
methods.set(methodName, { ...existing, ...meta });
|
|
1052
|
+
},
|
|
1053
|
+
addContract(target, methodName, contract) {
|
|
1063
1054
|
let methods = methodMetadataStore.get(target);
|
|
1064
1055
|
if (!methods) {
|
|
1065
1056
|
methods = new Map;
|
|
1066
1057
|
methodMetadataStore.set(target, methods);
|
|
1067
1058
|
}
|
|
1068
1059
|
const existing = methods.get(methodName) || {};
|
|
1069
|
-
existing.
|
|
1060
|
+
existing.contract = contract;
|
|
1070
1061
|
methods.set(methodName, existing);
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1062
|
+
},
|
|
1063
|
+
addMiddleware(target, middleware, methodName) {
|
|
1064
|
+
if (methodName) {
|
|
1065
|
+
let methods = methodMetadataStore.get(target);
|
|
1066
|
+
if (!methods) {
|
|
1067
|
+
methods = new Map;
|
|
1068
|
+
methodMetadataStore.set(target, methods);
|
|
1069
|
+
}
|
|
1070
|
+
const existing = methods.get(methodName) || {};
|
|
1071
|
+
existing.middlewares = [...existing.middlewares || [], middleware];
|
|
1072
|
+
methods.set(methodName, existing);
|
|
1073
|
+
} else {
|
|
1074
|
+
const existing = controllerMetadataStore.get(target) || { prefix: "/" };
|
|
1075
|
+
existing.middlewares = [...existing.middlewares || [], middleware];
|
|
1076
|
+
controllerMetadataStore.set(target, existing);
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
getRoutes(target) {
|
|
1080
|
+
return methodMetadataStore.get(target);
|
|
1081
|
+
},
|
|
1082
|
+
setController(target, meta) {
|
|
1083
|
+
controllerMetadataStore.set(target, meta);
|
|
1084
|
+
},
|
|
1085
|
+
getController(target) {
|
|
1086
|
+
return controllerMetadataStore.get(target);
|
|
1087
|
+
},
|
|
1088
|
+
defineModule(target, meta) {
|
|
1089
|
+
moduleMetadataStore.set(target, meta);
|
|
1090
|
+
},
|
|
1091
|
+
getModule(target) {
|
|
1092
|
+
return moduleMetadataStore.get(target);
|
|
1093
|
+
},
|
|
1094
|
+
addInjection(target, index, token) {
|
|
1095
|
+
let injections = injectionMetadataStore.get(target);
|
|
1096
|
+
if (!injections) {
|
|
1097
|
+
injections = new Map;
|
|
1098
|
+
injectionMetadataStore.set(target, injections);
|
|
1099
|
+
}
|
|
1100
|
+
injections.set(index, token);
|
|
1101
|
+
},
|
|
1102
|
+
getInjections(target) {
|
|
1103
|
+
return injectionMetadataStore.get(target);
|
|
1097
1104
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
return injectionMetadataStore.get(target);
|
|
1102
|
-
}
|
|
1103
|
-
};
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
var MetadataStorage = globalStore.KANJI_METADATA_STORAGE;
|
|
1104
1108
|
function Module(metadata) {
|
|
1105
1109
|
return (target) => {
|
|
1106
1110
|
MetadataStorage.defineModule(target, metadata);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanjijs/auth",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.10",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"hono": "^4.0.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@kanjijs/core": "
|
|
21
|
+
"@kanjijs/core": "^0.2.0-beta.10"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"typescript": "^5.0.0",
|