@celerity-sdk/core 0.5.0 → 0.6.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/dist/index.cjs +34 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +34 -22
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1544,7 +1544,8 @@ function buildModuleGraph(rootModule) {
|
|
|
1544
1544
|
controllers: [],
|
|
1545
1545
|
functionHandlers: [],
|
|
1546
1546
|
guards: [],
|
|
1547
|
-
providers: []
|
|
1547
|
+
providers: [],
|
|
1548
|
+
layers: []
|
|
1548
1549
|
});
|
|
1549
1550
|
return;
|
|
1550
1551
|
}
|
|
@@ -1586,7 +1587,8 @@ function buildModuleGraph(rootModule) {
|
|
|
1586
1587
|
controllers,
|
|
1587
1588
|
functionHandlers: metadata.functionHandlers ?? [],
|
|
1588
1589
|
guards,
|
|
1589
|
-
providers
|
|
1590
|
+
providers,
|
|
1591
|
+
layers: metadata.layers ?? []
|
|
1590
1592
|
});
|
|
1591
1593
|
}
|
|
1592
1594
|
__name(walk, "walk");
|
|
@@ -1730,10 +1732,10 @@ var debug5 = (0, import_debug5.default)("celerity:core:scanner:http");
|
|
|
1730
1732
|
async function scanHttpHandlers(graph, container, registry) {
|
|
1731
1733
|
for (const [, node] of graph) {
|
|
1732
1734
|
for (const controllerClass of node.controllers) {
|
|
1733
|
-
await scanClassHandler(controllerClass, container, registry);
|
|
1735
|
+
await scanClassHandler(controllerClass, container, registry, node.layers);
|
|
1734
1736
|
}
|
|
1735
1737
|
for (const fnHandler of node.functionHandlers) {
|
|
1736
|
-
scanFunctionHandler(fnHandler, registry);
|
|
1738
|
+
scanFunctionHandler(fnHandler, registry, node.layers);
|
|
1737
1739
|
}
|
|
1738
1740
|
}
|
|
1739
1741
|
}
|
|
@@ -1757,7 +1759,7 @@ async function scanModule(moduleClass, container, registry) {
|
|
|
1757
1759
|
await scanHttpGuards(graph, container, registry);
|
|
1758
1760
|
}
|
|
1759
1761
|
__name(scanModule, "scanModule");
|
|
1760
|
-
async function scanClassHandler(controllerClass, container, registry) {
|
|
1762
|
+
async function scanClassHandler(controllerClass, container, registry, moduleLayers) {
|
|
1761
1763
|
const controllerMeta = Reflect.getOwnMetadata(CONTROLLER_METADATA, controllerClass);
|
|
1762
1764
|
if (!controllerMeta) return;
|
|
1763
1765
|
const prototype = controllerClass.prototype;
|
|
@@ -1778,6 +1780,7 @@ async function scanClassHandler(controllerClass, container, registry) {
|
|
|
1778
1780
|
const descriptor = Object.getOwnPropertyDescriptor(prototype, methodName);
|
|
1779
1781
|
if (!descriptor?.value || typeof descriptor.value !== "function") continue;
|
|
1780
1782
|
const layers = [
|
|
1783
|
+
...moduleLayers,
|
|
1781
1784
|
...classLayers,
|
|
1782
1785
|
...methodLayers
|
|
1783
1786
|
];
|
|
@@ -1807,10 +1810,11 @@ async function scanClassHandler(controllerClass, container, registry) {
|
|
|
1807
1810
|
}
|
|
1808
1811
|
}
|
|
1809
1812
|
__name(scanClassHandler, "scanClassHandler");
|
|
1810
|
-
function scanFunctionHandler(definition, registry) {
|
|
1813
|
+
function scanFunctionHandler(definition, registry, moduleLayers) {
|
|
1811
1814
|
if (definition.type !== "http") return;
|
|
1812
1815
|
const meta = definition.metadata;
|
|
1813
1816
|
const layers = [
|
|
1817
|
+
...moduleLayers,
|
|
1814
1818
|
...meta.layers ?? []
|
|
1815
1819
|
];
|
|
1816
1820
|
if (meta.schema) {
|
|
@@ -1947,15 +1951,15 @@ var debug6 = (0, import_debug6.default)("celerity:core:scanner:websocket");
|
|
|
1947
1951
|
async function scanWebSocketHandlers(graph, container, registry) {
|
|
1948
1952
|
for (const [, node] of graph) {
|
|
1949
1953
|
for (const controllerClass of node.controllers) {
|
|
1950
|
-
await scanClassHandler2(controllerClass, container, registry);
|
|
1954
|
+
await scanClassHandler2(controllerClass, container, registry, node.layers);
|
|
1951
1955
|
}
|
|
1952
1956
|
for (const fnHandler of node.functionHandlers) {
|
|
1953
|
-
scanFunctionHandler2(fnHandler, registry);
|
|
1957
|
+
scanFunctionHandler2(fnHandler, registry, node.layers);
|
|
1954
1958
|
}
|
|
1955
1959
|
}
|
|
1956
1960
|
}
|
|
1957
1961
|
__name(scanWebSocketHandlers, "scanWebSocketHandlers");
|
|
1958
|
-
async function scanClassHandler2(controllerClass, container, registry) {
|
|
1962
|
+
async function scanClassHandler2(controllerClass, container, registry, moduleLayers) {
|
|
1959
1963
|
const isWsController = Reflect.getOwnMetadata(WEBSOCKET_CONTROLLER_METADATA, controllerClass);
|
|
1960
1964
|
if (!isWsController) return;
|
|
1961
1965
|
const prototype = controllerClass.prototype;
|
|
@@ -1974,6 +1978,7 @@ async function scanClassHandler2(controllerClass, container, registry) {
|
|
|
1974
1978
|
if (!descriptor?.value || typeof descriptor.value !== "function") continue;
|
|
1975
1979
|
debug6("scanClassHandler: %s %s (%s.%s)", eventMeta.eventType, eventMeta.route, controllerClass.name, methodName);
|
|
1976
1980
|
const layers = [
|
|
1981
|
+
...moduleLayers,
|
|
1977
1982
|
...classLayers,
|
|
1978
1983
|
...methodLayers
|
|
1979
1984
|
];
|
|
@@ -2000,10 +2005,11 @@ async function scanClassHandler2(controllerClass, container, registry) {
|
|
|
2000
2005
|
}
|
|
2001
2006
|
}
|
|
2002
2007
|
__name(scanClassHandler2, "scanClassHandler");
|
|
2003
|
-
function scanFunctionHandler2(definition, registry) {
|
|
2008
|
+
function scanFunctionHandler2(definition, registry, moduleLayers) {
|
|
2004
2009
|
if (definition.type !== "websocket") return;
|
|
2005
2010
|
const meta = definition.metadata;
|
|
2006
2011
|
const layers = [
|
|
2012
|
+
...moduleLayers,
|
|
2007
2013
|
...meta.layers ?? []
|
|
2008
2014
|
];
|
|
2009
2015
|
if (meta.schema) {
|
|
@@ -2035,15 +2041,15 @@ var debug7 = (0, import_debug7.default)("celerity:core:scanner:consumer");
|
|
|
2035
2041
|
async function scanConsumerHandlers(graph, container, registry) {
|
|
2036
2042
|
for (const [, node] of graph) {
|
|
2037
2043
|
for (const controllerClass of node.controllers) {
|
|
2038
|
-
await scanClassHandler3(controllerClass, container, registry);
|
|
2044
|
+
await scanClassHandler3(controllerClass, container, registry, node.layers);
|
|
2039
2045
|
}
|
|
2040
2046
|
for (const fnHandler of node.functionHandlers) {
|
|
2041
|
-
scanFunctionHandler3(fnHandler, registry);
|
|
2047
|
+
scanFunctionHandler3(fnHandler, registry, node.layers);
|
|
2042
2048
|
}
|
|
2043
2049
|
}
|
|
2044
2050
|
}
|
|
2045
2051
|
__name(scanConsumerHandlers, "scanConsumerHandlers");
|
|
2046
|
-
async function scanClassHandler3(controllerClass, container, registry) {
|
|
2052
|
+
async function scanClassHandler3(controllerClass, container, registry, moduleLayers) {
|
|
2047
2053
|
const consumerMeta = Reflect.getOwnMetadata(CONSUMER_METADATA, controllerClass);
|
|
2048
2054
|
if (!consumerMeta) return;
|
|
2049
2055
|
const prototype = controllerClass.prototype;
|
|
@@ -2060,6 +2066,7 @@ async function scanClassHandler3(controllerClass, container, registry) {
|
|
|
2060
2066
|
if (!descriptor?.value || typeof descriptor.value !== "function") continue;
|
|
2061
2067
|
const handlerTag = consumerMeta.source ? `${consumerMeta.source}::${methodName}` : methodName;
|
|
2062
2068
|
const layers = [
|
|
2069
|
+
...moduleLayers,
|
|
2063
2070
|
...classLayers,
|
|
2064
2071
|
...methodLayers
|
|
2065
2072
|
];
|
|
@@ -2085,11 +2092,12 @@ async function scanClassHandler3(controllerClass, container, registry) {
|
|
|
2085
2092
|
}
|
|
2086
2093
|
}
|
|
2087
2094
|
__name(scanClassHandler3, "scanClassHandler");
|
|
2088
|
-
function scanFunctionHandler3(definition, registry) {
|
|
2095
|
+
function scanFunctionHandler3(definition, registry, moduleLayers) {
|
|
2089
2096
|
if (definition.type !== "consumer") return;
|
|
2090
2097
|
const meta = definition.metadata;
|
|
2091
2098
|
const handlerTag = definition.id ?? "default";
|
|
2092
2099
|
const layers = [
|
|
2100
|
+
...moduleLayers,
|
|
2093
2101
|
...meta.layers ?? []
|
|
2094
2102
|
];
|
|
2095
2103
|
if (meta.messageSchema) {
|
|
@@ -2119,15 +2127,15 @@ var debug8 = (0, import_debug8.default)("celerity:core:scanner:schedule");
|
|
|
2119
2127
|
async function scanScheduleHandlers(graph, container, registry) {
|
|
2120
2128
|
for (const [, node] of graph) {
|
|
2121
2129
|
for (const controllerClass of node.controllers) {
|
|
2122
|
-
await scanClassHandler4(controllerClass, container, registry);
|
|
2130
|
+
await scanClassHandler4(controllerClass, container, registry, node.layers);
|
|
2123
2131
|
}
|
|
2124
2132
|
for (const fnHandler of node.functionHandlers) {
|
|
2125
|
-
scanFunctionHandler4(fnHandler, registry);
|
|
2133
|
+
scanFunctionHandler4(fnHandler, registry, node.layers);
|
|
2126
2134
|
}
|
|
2127
2135
|
}
|
|
2128
2136
|
}
|
|
2129
2137
|
__name(scanScheduleHandlers, "scanScheduleHandlers");
|
|
2130
|
-
async function scanClassHandler4(controllerClass, container, registry) {
|
|
2138
|
+
async function scanClassHandler4(controllerClass, container, registry, moduleLayers) {
|
|
2131
2139
|
const prototype = controllerClass.prototype;
|
|
2132
2140
|
const methods = Object.getOwnPropertyNames(prototype).filter((name) => name !== "constructor");
|
|
2133
2141
|
const classLayers = Reflect.getOwnMetadata(LAYER_METADATA, controllerClass) ?? [];
|
|
@@ -2142,6 +2150,7 @@ async function scanClassHandler4(controllerClass, container, registry) {
|
|
|
2142
2150
|
if (!descriptor?.value || typeof descriptor.value !== "function") continue;
|
|
2143
2151
|
const handlerTag = handlerMeta.source ? `${handlerMeta.source}::${methodName}` : methodName;
|
|
2144
2152
|
const layers = [
|
|
2153
|
+
...moduleLayers,
|
|
2145
2154
|
...classLayers,
|
|
2146
2155
|
...methodLayers
|
|
2147
2156
|
];
|
|
@@ -2173,11 +2182,12 @@ async function scanClassHandler4(controllerClass, container, registry) {
|
|
|
2173
2182
|
}
|
|
2174
2183
|
}
|
|
2175
2184
|
__name(scanClassHandler4, "scanClassHandler");
|
|
2176
|
-
function scanFunctionHandler4(definition, registry) {
|
|
2185
|
+
function scanFunctionHandler4(definition, registry, moduleLayers) {
|
|
2177
2186
|
if (definition.type !== "schedule") return;
|
|
2178
2187
|
const meta = definition.metadata;
|
|
2179
2188
|
const handlerTag = meta.source ?? definition.id ?? "default";
|
|
2180
2189
|
const layers = [
|
|
2190
|
+
...moduleLayers,
|
|
2181
2191
|
...meta.layers ?? []
|
|
2182
2192
|
];
|
|
2183
2193
|
if (meta.schema) {
|
|
@@ -2212,15 +2222,15 @@ var debug9 = (0, import_debug9.default)("celerity:core:scanner:custom");
|
|
|
2212
2222
|
async function scanCustomHandlers(graph, container, registry) {
|
|
2213
2223
|
for (const [, node] of graph) {
|
|
2214
2224
|
for (const controllerClass of node.controllers) {
|
|
2215
|
-
await scanClassHandler5(controllerClass, container, registry);
|
|
2225
|
+
await scanClassHandler5(controllerClass, container, registry, node.layers);
|
|
2216
2226
|
}
|
|
2217
2227
|
for (const fnHandler of node.functionHandlers) {
|
|
2218
|
-
scanFunctionHandler5(fnHandler, registry);
|
|
2228
|
+
scanFunctionHandler5(fnHandler, registry, node.layers);
|
|
2219
2229
|
}
|
|
2220
2230
|
}
|
|
2221
2231
|
}
|
|
2222
2232
|
__name(scanCustomHandlers, "scanCustomHandlers");
|
|
2223
|
-
async function scanClassHandler5(controllerClass, container, registry) {
|
|
2233
|
+
async function scanClassHandler5(controllerClass, container, registry, moduleLayers) {
|
|
2224
2234
|
const prototype = controllerClass.prototype;
|
|
2225
2235
|
const methods = Object.getOwnPropertyNames(prototype).filter((name) => name !== "constructor");
|
|
2226
2236
|
const classLayers = Reflect.getOwnMetadata(LAYER_METADATA, controllerClass) ?? [];
|
|
@@ -2234,6 +2244,7 @@ async function scanClassHandler5(controllerClass, container, registry) {
|
|
|
2234
2244
|
const descriptor = Object.getOwnPropertyDescriptor(prototype, methodName);
|
|
2235
2245
|
if (!descriptor?.value || typeof descriptor.value !== "function") continue;
|
|
2236
2246
|
const layers = [
|
|
2247
|
+
...moduleLayers,
|
|
2237
2248
|
...classLayers,
|
|
2238
2249
|
...methodLayers
|
|
2239
2250
|
];
|
|
@@ -2259,11 +2270,12 @@ async function scanClassHandler5(controllerClass, container, registry) {
|
|
|
2259
2270
|
}
|
|
2260
2271
|
}
|
|
2261
2272
|
__name(scanClassHandler5, "scanClassHandler");
|
|
2262
|
-
function scanFunctionHandler5(definition, registry) {
|
|
2273
|
+
function scanFunctionHandler5(definition, registry, moduleLayers) {
|
|
2263
2274
|
if (definition.type !== "custom") return;
|
|
2264
2275
|
const meta = definition.metadata;
|
|
2265
2276
|
const name = meta.name ?? definition.id ?? "default";
|
|
2266
2277
|
const layers = [
|
|
2278
|
+
...moduleLayers,
|
|
2267
2279
|
...meta.layers ?? []
|
|
2268
2280
|
];
|
|
2269
2281
|
if (meta.schema) {
|