@conduitplatform/grpc-sdk 0.16.0-alpha.2 → 0.16.0-alpha.21
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/README.mdx +1 -7
- package/dist/classes/ConduitAuthorizedResource.js +5 -6
- package/dist/classes/ConduitAuthorizedResource.js.map +1 -1
- package/dist/classes/ConduitModule.d.ts +9 -6
- package/dist/classes/ConduitModule.js +68 -141
- package/dist/classes/ConduitModule.js.map +1 -1
- package/dist/classes/ConduitSchema.js +3 -4
- package/dist/classes/ConduitSchema.js.map +1 -1
- package/dist/classes/Error.js +17 -40
- package/dist/classes/Error.js.map +1 -1
- package/dist/classes/HealthCheck.js +30 -71
- package/dist/classes/HealthCheck.js.map +1 -1
- package/dist/classes/index.d.ts +2 -6
- package/dist/classes/index.js +2 -6
- package/dist/classes/index.js.map +1 -1
- package/dist/index.d.ts +34 -31
- package/dist/index.js +331 -499
- package/dist/index.js.map +1 -1
- package/dist/interceptors/grpcSignedToken.d.ts +1 -1
- package/dist/interceptors/grpcSignedToken.js +7 -79
- package/dist/interceptors/grpcSignedToken.js.map +1 -1
- package/dist/interceptors/moduleName.d.ts +1 -1
- package/dist/interceptors/moduleName.js +7 -79
- package/dist/interceptors/moduleName.js.map +1 -1
- package/dist/interfaces/ConduitMiddleware.js.map +1 -0
- package/dist/{routing/interfaces → interfaces}/ConduitRoute.d.ts +2 -3
- package/dist/interfaces/ConduitRoute.js.map +1 -0
- package/dist/{routing → interfaces}/ConduitRouteReturn.d.ts +3 -3
- package/dist/{routing → interfaces}/ConduitRouteReturn.js +9 -18
- package/dist/interfaces/ConduitRouteReturn.js.map +1 -0
- package/dist/interfaces/ConduitSchemaExtension.d.ts +1 -1
- package/dist/interfaces/GrpcCallback.d.ts +1 -1
- package/dist/{utilities/Logger.d.ts → interfaces/IConduitLogger.d.ts} +4 -7
- package/dist/interfaces/{ConduitService.js → IConduitLogger.js} +1 -1
- package/dist/interfaces/IConduitLogger.js.map +1 -0
- package/dist/{metrics/index.d.ts → interfaces/IConduitMetrics.d.ts} +5 -11
- package/dist/interfaces/IConduitMetrics.js +3 -0
- package/dist/interfaces/IConduitMetrics.js.map +1 -0
- package/dist/interfaces/Indexable.d.ts +7 -8
- package/dist/interfaces/Model.d.ts +66 -13
- package/dist/interfaces/Model.js.map +1 -1
- package/dist/interfaces/Params.d.ts +3 -3
- package/dist/interfaces/ProxyRoute.js.map +1 -0
- package/dist/interfaces/RawQuery.d.ts +2 -2
- package/dist/interfaces/Route.d.ts +64 -0
- package/dist/interfaces/Route.js +12 -0
- package/dist/interfaces/Route.js.map +1 -0
- package/dist/{routing/interfaces → interfaces}/Socket.d.ts +4 -5
- package/dist/interfaces/Socket.js.map +1 -0
- package/dist/interfaces/UntypedArray.d.ts +1 -1
- package/dist/interfaces/index.d.ts +9 -2
- package/dist/interfaces/index.js +9 -2
- package/dist/interfaces/index.js.map +1 -1
- package/dist/{routing/interfaces → interfaces}/types.d.ts +11 -9
- package/dist/{routing/interfaces → interfaces}/types.js.map +1 -1
- package/dist/module.proto +72 -0
- package/dist/modules/admin/index.d.ts +5 -5
- package/dist/modules/admin/index.js +18 -37
- package/dist/modules/admin/index.js.map +1 -1
- package/dist/modules/authentication/index.d.ts +5 -2
- package/dist/modules/authentication/index.js +30 -40
- package/dist/modules/authentication/index.js.map +1 -1
- package/dist/modules/authorization/index.d.ts +6 -2
- package/dist/modules/authorization/index.js +38 -47
- package/dist/modules/authorization/index.js.map +1 -1
- package/dist/modules/chat/index.js +16 -34
- package/dist/modules/chat/index.js.map +1 -1
- package/dist/modules/config/index.d.ts +14 -5
- package/dist/modules/config/index.js +85 -177
- package/dist/modules/config/index.js.map +1 -1
- package/dist/modules/core/index.js +8 -26
- package/dist/modules/core/index.js.map +1 -1
- package/dist/modules/database/index.d.ts +24 -14
- package/dist/modules/database/index.js +193 -134
- package/dist/modules/database/index.js.map +1 -1
- package/dist/modules/email/index.js +15 -33
- package/dist/modules/email/index.js.map +1 -1
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +0 -2
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/pushNotifications/index.js +38 -56
- package/dist/modules/pushNotifications/index.js.map +1 -1
- package/dist/modules/router/index.d.ts +5 -5
- package/dist/modules/router/index.js +20 -39
- package/dist/modules/router/index.js.map +1 -1
- package/dist/modules/sms/index.js +17 -35
- package/dist/modules/sms/index.js.map +1 -1
- package/dist/modules/storage/index.d.ts +8 -4
- package/dist/modules/storage/index.js +66 -37
- package/dist/modules/storage/index.js.map +1 -1
- package/dist/protoUtils/authentication.d.ts +127 -46
- package/dist/protoUtils/authentication.js +481 -220
- package/dist/protoUtils/authentication.js.map +1 -1
- package/dist/protoUtils/authorization.d.ts +147 -82
- package/dist/protoUtils/authorization.js +684 -512
- package/dist/protoUtils/authorization.js.map +1 -1
- package/dist/protoUtils/chat.d.ts +7 -61
- package/dist/protoUtils/chat.js +130 -313
- package/dist/protoUtils/chat.js.map +1 -1
- package/dist/protoUtils/core.d.ts +88 -107
- package/dist/protoUtils/core.js +699 -733
- package/dist/protoUtils/core.js.map +1 -1
- package/dist/protoUtils/database.d.ts +195 -15
- package/dist/protoUtils/database.js +1077 -666
- package/dist/protoUtils/database.js.map +1 -1
- package/dist/protoUtils/email.d.ts +3 -48
- package/dist/protoUtils/email.js +145 -284
- package/dist/protoUtils/email.js.map +1 -1
- package/dist/protoUtils/google/protobuf/empty.d.ts +27 -0
- package/dist/protoUtils/google/protobuf/empty.js +46 -0
- package/dist/protoUtils/google/protobuf/empty.js.map +1 -0
- package/dist/protoUtils/grpc_health_check.d.ts +3 -4
- package/dist/protoUtils/grpc_health_check.js +37 -36
- package/dist/protoUtils/grpc_health_check.js.map +1 -1
- package/dist/protoUtils/index.d.ts +12 -0
- package/dist/{routing/interfaces → protoUtils}/index.js +12 -6
- package/dist/protoUtils/index.js.map +1 -0
- package/dist/protoUtils/module.d.ts +251 -0
- package/dist/protoUtils/module.js +874 -0
- package/dist/protoUtils/module.js.map +1 -0
- package/dist/protoUtils/push-notifications.d.ts +7 -50
- package/dist/protoUtils/push-notifications.js +269 -356
- package/dist/protoUtils/push-notifications.js.map +1 -1
- package/dist/protoUtils/router.d.ts +45 -111
- package/dist/protoUtils/router.js +357 -575
- package/dist/protoUtils/router.js.map +1 -1
- package/dist/protoUtils/sms.d.ts +3 -48
- package/dist/protoUtils/sms.js +120 -219
- package/dist/protoUtils/sms.js.map +1 -1
- package/dist/protoUtils/storage.d.ts +144 -62
- package/dist/protoUtils/storage.js +782 -282
- package/dist/protoUtils/storage.js.map +1 -1
- package/dist/types/db.d.ts +11 -11
- package/dist/types/index.d.ts +3 -10
- package/dist/types/index.js +21 -24
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/EventBus.d.ts +3 -1
- package/dist/utilities/EventBus.js +38 -17
- package/dist/utilities/EventBus.js.map +1 -1
- package/dist/utilities/RedisManager.js +11 -21
- package/dist/utilities/RedisManager.js.map +1 -1
- package/dist/utilities/StateManager.js +13 -14
- package/dist/utilities/StateManager.js.map +1 -1
- package/dist/utilities/env.js +4 -4
- package/dist/utilities/env.js.map +1 -1
- package/dist/utilities/index.d.ts +3 -2
- package/dist/utilities/index.js +3 -2
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/sleep.js +1 -1
- package/dist/utilities/sleep.js.map +1 -1
- package/package.json +24 -25
- package/dist/classes/ConduitActiveSchema.d.ts +0 -19
- package/dist/classes/ConduitActiveSchema.js +0 -57
- package/dist/classes/ConduitActiveSchema.js.map +0 -1
- package/dist/classes/ConduitServiceModule.d.ts +0 -26
- package/dist/classes/ConduitServiceModule.js +0 -166
- package/dist/classes/ConduitServiceModule.js.map +0 -1
- package/dist/classes/ConfigController.d.ts +0 -7
- package/dist/classes/ConfigController.js +0 -27
- package/dist/classes/ConfigController.js.map +0 -1
- package/dist/classes/GrpcServer.d.ts +0 -22
- package/dist/classes/GrpcServer.js +0 -207
- package/dist/classes/GrpcServer.js.map +0 -1
- package/dist/classes/ManagedModule.d.ts +0 -74
- package/dist/classes/ManagedModule.js +0 -333
- package/dist/classes/ManagedModule.js.map +0 -1
- package/dist/classes/ModuleManager.d.ts +0 -11
- package/dist/classes/ModuleManager.js +0 -204
- package/dist/classes/ModuleManager.js.map +0 -1
- package/dist/helpers/GrpcHelper.d.ts +0 -8
- package/dist/helpers/GrpcHelper.js +0 -43
- package/dist/helpers/GrpcHelper.js.map +0 -1
- package/dist/helpers/TypeHelpers.d.ts +0 -44
- package/dist/helpers/TypeHelpers.js +0 -144
- package/dist/helpers/TypeHelpers.js.map +0 -1
- package/dist/helpers/index.d.ts +0 -3
- package/dist/helpers/index.js +0 -20
- package/dist/helpers/index.js.map +0 -1
- package/dist/helpers/wrapGrpcFunctions.d.ts +0 -5
- package/dist/helpers/wrapGrpcFunctions.js +0 -56
- package/dist/helpers/wrapGrpcFunctions.js.map +0 -1
- package/dist/interfaces/ConduitService.d.ts +0 -8
- package/dist/interfaces/ConduitService.js.map +0 -1
- package/dist/metrics/MetricsServer.d.ts +0 -9
- package/dist/metrics/MetricsServer.js +0 -94
- package/dist/metrics/MetricsServer.js.map +0 -1
- package/dist/metrics/clientMiddleware.d.ts +0 -2
- package/dist/metrics/clientMiddleware.js +0 -265
- package/dist/metrics/clientMiddleware.js.map +0 -1
- package/dist/metrics/config/defaults.d.ts +0 -91
- package/dist/metrics/config/defaults.js +0 -93
- package/dist/metrics/config/defaults.js.map +0 -1
- package/dist/metrics/index.js +0 -152
- package/dist/metrics/index.js.map +0 -1
- package/dist/modules/forms/index.d.ts +0 -6
- package/dist/modules/forms/index.js +0 -32
- package/dist/modules/forms/index.js.map +0 -1
- package/dist/modules/functions/index.d.ts +0 -6
- package/dist/modules/functions/index.js +0 -32
- package/dist/modules/functions/index.js.map +0 -1
- package/dist/protoUtils/forms.d.ts +0 -58
- package/dist/protoUtils/forms.js +0 -127
- package/dist/protoUtils/forms.js.map +0 -1
- package/dist/protoUtils/functions.d.ts +0 -58
- package/dist/protoUtils/functions.js +0 -127
- package/dist/protoUtils/functions.js.map +0 -1
- package/dist/routing/ConduitRouteReturn.js.map +0 -1
- package/dist/routing/ProxyRouteBuilder.d.ts +0 -21
- package/dist/routing/ProxyRouteBuilder.js +0 -81
- package/dist/routing/ProxyRouteBuilder.js.map +0 -1
- package/dist/routing/RouteBuilder.d.ts +0 -24
- package/dist/routing/RouteBuilder.js +0 -107
- package/dist/routing/RouteBuilder.js.map +0 -1
- package/dist/routing/RoutingManager.d.ts +0 -33
- package/dist/routing/RoutingManager.js +0 -201
- package/dist/routing/RoutingManager.js.map +0 -1
- package/dist/routing/RoutingUtilities.d.ts +0 -7
- package/dist/routing/RoutingUtilities.js +0 -13
- package/dist/routing/RoutingUtilities.js.map +0 -1
- package/dist/routing/index.d.ts +0 -7
- package/dist/routing/index.js +0 -24
- package/dist/routing/index.js.map +0 -1
- package/dist/routing/interfaces/ConduitMiddleware.js.map +0 -1
- package/dist/routing/interfaces/ConduitRoute.js.map +0 -1
- package/dist/routing/interfaces/ProxyRoute.js.map +0 -1
- package/dist/routing/interfaces/Route.d.ts +0 -52
- package/dist/routing/interfaces/Route.js +0 -21
- package/dist/routing/interfaces/Route.js.map +0 -1
- package/dist/routing/interfaces/Socket.js.map +0 -1
- package/dist/routing/interfaces/index.d.ts +0 -6
- package/dist/routing/interfaces/index.js.map +0 -1
- package/dist/routing/wrapRouterFunctions.d.ts +0 -8
- package/dist/routing/wrapRouterFunctions.js +0 -132
- package/dist/routing/wrapRouterFunctions.js.map +0 -1
- package/dist/utilities/Logger.js +0 -255
- package/dist/utilities/Logger.js.map +0 -1
- package/dist/utilities/linearBackoffTimeout.d.ts +0 -10
- package/dist/utilities/linearBackoffTimeout.js +0 -119
- package/dist/utilities/linearBackoffTimeout.js.map +0 -1
- package/dist/utilities/merge.d.ts +0 -1
- package/dist/utilities/merge.js +0 -15
- package/dist/utilities/merge.js.map +0 -1
- /package/dist/{routing/interfaces → interfaces}/ConduitMiddleware.d.ts +0 -0
- /package/dist/{routing/interfaces → interfaces}/ConduitMiddleware.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/ConduitRoute.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/ProxyRoute.d.ts +0 -0
- /package/dist/{routing/interfaces → interfaces}/ProxyRoute.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/Socket.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/types.js +0 -0
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addServiceToServer = exports.createServer = void 0;
|
|
4
|
-
var grpc_js_1 = require("@grpc/grpc-js");
|
|
5
|
-
var protoLoader = require('@grpc/proto-loader');
|
|
6
|
-
function createServer(port) {
|
|
7
|
-
var grpcServer = new grpc_js_1.Server({
|
|
8
|
-
'grpc.max_receive_message_length': 1024 * 1024 * 100,
|
|
9
|
-
'grpc.max_send_message_length': 1024 * 1024 * 100,
|
|
10
|
-
});
|
|
11
|
-
return new Promise(function (resolve, reject) {
|
|
12
|
-
grpcServer.bindAsync(port, grpc_js_1.ServerCredentials.createInsecure(), function (err, port) {
|
|
13
|
-
if (err) {
|
|
14
|
-
reject(err);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
resolve({
|
|
18
|
-
server: grpcServer,
|
|
19
|
-
port: port,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
exports.createServer = createServer;
|
|
26
|
-
function addServiceToServer(server, protoPath, descriptorObject, functions) {
|
|
27
|
-
var packageDefinition = protoLoader.loadSync(protoPath, {
|
|
28
|
-
keepCase: true,
|
|
29
|
-
longs: String,
|
|
30
|
-
enums: String,
|
|
31
|
-
defaults: true,
|
|
32
|
-
oneofs: true,
|
|
33
|
-
});
|
|
34
|
-
var protoDescriptor = (0, grpc_js_1.loadPackageDefinition)(packageDefinition);
|
|
35
|
-
var objs = descriptorObject.split('.');
|
|
36
|
-
var descObj = protoDescriptor;
|
|
37
|
-
objs.forEach(function (r) {
|
|
38
|
-
descObj = descObj[r];
|
|
39
|
-
});
|
|
40
|
-
server.addService(descObj.service, functions);
|
|
41
|
-
}
|
|
42
|
-
exports.addServiceToServer = addServiceToServer;
|
|
43
|
-
//# sourceMappingURL=GrpcHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GrpcHelper.js","sourceRoot":"","sources":["../../src/helpers/GrpcHelper.ts"],"names":[],"mappings":";;;AAAA,yCAKuB;AAEvB,IAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElD,SAAgB,YAAY,CAAC,IAAY;IACvC,IAAM,UAAU,GAAW,IAAI,gBAAM,CAAC;QACpC,iCAAiC,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG;QACpD,8BAA8B,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG;KAClD,CAAC,CAAC;IACH,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QACjC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,2BAAiB,CAAC,cAAc,EAAE,EAAE,UAAC,GAAG,EAAE,IAAI;YACvE,IAAI,GAAG,EAAE;gBACP,MAAM,CAAC,GAAG,CAAC,CAAC;aACb;iBAAM;gBACL,OAAO,CAAC;oBACN,MAAM,EAAE,UAAU;oBAClB,IAAI,MAAA;iBACL,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,oCAiBC;AAED,SAAgB,kBAAkB,CAChC,MAAc,EACd,SAAiB,EACjB,gBAAwB,EACxB,SAAuC;IAEvC,IAAM,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC,SAAS,EAAE;QACxD,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IACH,IAAM,eAAe,GAAG,IAAA,+BAAqB,EAAC,iBAAiB,CAAC,CAAC;IACjE,IAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,OAAO,GAAQ,eAAe,CAAC;IACnC,IAAI,CAAC,OAAO,CAAC,UAAC,CAAS;QACrB,OAAO,GAAG,OAAO,CAAC,CAAC,CAAQ,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,SAAyC,CAAC,CAAC;AAChF,CAAC;AArBD,gDAqBC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ConduitModelField, TYPE } from '../interfaces';
|
|
2
|
-
declare class ConduitStringConstructor {
|
|
3
|
-
private constructor();
|
|
4
|
-
static get Optional(): TYPE;
|
|
5
|
-
static get Required(): ConduitModelField;
|
|
6
|
-
}
|
|
7
|
-
export declare const ConduitString: typeof ConduitStringConstructor;
|
|
8
|
-
declare class ConduitNumberConstructor {
|
|
9
|
-
private constructor();
|
|
10
|
-
static get Optional(): TYPE;
|
|
11
|
-
static get Required(): ConduitModelField;
|
|
12
|
-
}
|
|
13
|
-
export declare const ConduitNumber: typeof ConduitNumberConstructor;
|
|
14
|
-
declare class ConduitBooleanConstructor {
|
|
15
|
-
private constructor();
|
|
16
|
-
static get Optional(): TYPE;
|
|
17
|
-
static get Required(): ConduitModelField;
|
|
18
|
-
}
|
|
19
|
-
export declare const ConduitBoolean: typeof ConduitBooleanConstructor;
|
|
20
|
-
declare class ConduitDateConstructor {
|
|
21
|
-
private constructor();
|
|
22
|
-
static get Optional(): TYPE;
|
|
23
|
-
static get Required(): ConduitModelField;
|
|
24
|
-
}
|
|
25
|
-
export declare const ConduitDate: typeof ConduitDateConstructor;
|
|
26
|
-
declare class ConduitObjectIdConstructor {
|
|
27
|
-
private constructor();
|
|
28
|
-
static get Optional(): TYPE;
|
|
29
|
-
static get Required(): ConduitModelField;
|
|
30
|
-
}
|
|
31
|
-
export declare const ConduitObjectId: typeof ConduitObjectIdConstructor;
|
|
32
|
-
declare class ConduitJSONConstructor {
|
|
33
|
-
private constructor();
|
|
34
|
-
static get Optional(): TYPE;
|
|
35
|
-
static get Required(): ConduitModelField;
|
|
36
|
-
}
|
|
37
|
-
export declare const ConduitJson: typeof ConduitJSONConstructor;
|
|
38
|
-
declare class ConduitRelationConstructor {
|
|
39
|
-
private constructor();
|
|
40
|
-
static Optional(model: string): ConduitModelField;
|
|
41
|
-
static Required(model: string): ConduitModelField;
|
|
42
|
-
}
|
|
43
|
-
export declare const ConduitRelation: typeof ConduitRelationConstructor;
|
|
44
|
-
export {};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConduitRelation = exports.ConduitJson = exports.ConduitObjectId = exports.ConduitDate = exports.ConduitBoolean = exports.ConduitNumber = exports.ConduitString = void 0;
|
|
4
|
-
var interfaces_1 = require("../interfaces");
|
|
5
|
-
var ConduitStringConstructor = /** @class */ (function () {
|
|
6
|
-
// private to disallow creating other instances of this type
|
|
7
|
-
function ConduitStringConstructor() {
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(ConduitStringConstructor, "Optional", {
|
|
10
|
-
get: function () {
|
|
11
|
-
return interfaces_1.TYPE.String;
|
|
12
|
-
},
|
|
13
|
-
enumerable: false,
|
|
14
|
-
configurable: true
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(ConduitStringConstructor, "Required", {
|
|
17
|
-
get: function () {
|
|
18
|
-
return { type: interfaces_1.TYPE.String, required: true };
|
|
19
|
-
},
|
|
20
|
-
enumerable: false,
|
|
21
|
-
configurable: true
|
|
22
|
-
});
|
|
23
|
-
return ConduitStringConstructor;
|
|
24
|
-
}());
|
|
25
|
-
exports.ConduitString = ConduitStringConstructor;
|
|
26
|
-
var ConduitNumberConstructor = /** @class */ (function () {
|
|
27
|
-
// private to disallow creating other instances of this type
|
|
28
|
-
function ConduitNumberConstructor() {
|
|
29
|
-
}
|
|
30
|
-
Object.defineProperty(ConduitNumberConstructor, "Optional", {
|
|
31
|
-
get: function () {
|
|
32
|
-
return interfaces_1.TYPE.Number;
|
|
33
|
-
},
|
|
34
|
-
enumerable: false,
|
|
35
|
-
configurable: true
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(ConduitNumberConstructor, "Required", {
|
|
38
|
-
get: function () {
|
|
39
|
-
return { type: interfaces_1.TYPE.Number, required: true };
|
|
40
|
-
},
|
|
41
|
-
enumerable: false,
|
|
42
|
-
configurable: true
|
|
43
|
-
});
|
|
44
|
-
return ConduitNumberConstructor;
|
|
45
|
-
}());
|
|
46
|
-
exports.ConduitNumber = ConduitNumberConstructor;
|
|
47
|
-
var ConduitBooleanConstructor = /** @class */ (function () {
|
|
48
|
-
// private to disallow creating other instances of this type
|
|
49
|
-
function ConduitBooleanConstructor() {
|
|
50
|
-
}
|
|
51
|
-
Object.defineProperty(ConduitBooleanConstructor, "Optional", {
|
|
52
|
-
get: function () {
|
|
53
|
-
return interfaces_1.TYPE.Boolean;
|
|
54
|
-
},
|
|
55
|
-
enumerable: false,
|
|
56
|
-
configurable: true
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(ConduitBooleanConstructor, "Required", {
|
|
59
|
-
get: function () {
|
|
60
|
-
return { type: interfaces_1.TYPE.Boolean, required: true };
|
|
61
|
-
},
|
|
62
|
-
enumerable: false,
|
|
63
|
-
configurable: true
|
|
64
|
-
});
|
|
65
|
-
return ConduitBooleanConstructor;
|
|
66
|
-
}());
|
|
67
|
-
exports.ConduitBoolean = ConduitBooleanConstructor;
|
|
68
|
-
var ConduitDateConstructor = /** @class */ (function () {
|
|
69
|
-
// private to disallow creating other instances of this type
|
|
70
|
-
function ConduitDateConstructor() {
|
|
71
|
-
}
|
|
72
|
-
Object.defineProperty(ConduitDateConstructor, "Optional", {
|
|
73
|
-
get: function () {
|
|
74
|
-
return interfaces_1.TYPE.Date;
|
|
75
|
-
},
|
|
76
|
-
enumerable: false,
|
|
77
|
-
configurable: true
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(ConduitDateConstructor, "Required", {
|
|
80
|
-
get: function () {
|
|
81
|
-
return { type: interfaces_1.TYPE.Date, required: true };
|
|
82
|
-
},
|
|
83
|
-
enumerable: false,
|
|
84
|
-
configurable: true
|
|
85
|
-
});
|
|
86
|
-
return ConduitDateConstructor;
|
|
87
|
-
}());
|
|
88
|
-
exports.ConduitDate = ConduitDateConstructor;
|
|
89
|
-
var ConduitObjectIdConstructor = /** @class */ (function () {
|
|
90
|
-
// private to disallow creating other instances of this type
|
|
91
|
-
function ConduitObjectIdConstructor() {
|
|
92
|
-
}
|
|
93
|
-
Object.defineProperty(ConduitObjectIdConstructor, "Optional", {
|
|
94
|
-
get: function () {
|
|
95
|
-
return interfaces_1.TYPE.ObjectId;
|
|
96
|
-
},
|
|
97
|
-
enumerable: false,
|
|
98
|
-
configurable: true
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(ConduitObjectIdConstructor, "Required", {
|
|
101
|
-
get: function () {
|
|
102
|
-
return { type: interfaces_1.TYPE.ObjectId, required: true };
|
|
103
|
-
},
|
|
104
|
-
enumerable: false,
|
|
105
|
-
configurable: true
|
|
106
|
-
});
|
|
107
|
-
return ConduitObjectIdConstructor;
|
|
108
|
-
}());
|
|
109
|
-
exports.ConduitObjectId = ConduitObjectIdConstructor;
|
|
110
|
-
var ConduitJSONConstructor = /** @class */ (function () {
|
|
111
|
-
// private to disallow creating other instances of this type
|
|
112
|
-
function ConduitJSONConstructor() {
|
|
113
|
-
}
|
|
114
|
-
Object.defineProperty(ConduitJSONConstructor, "Optional", {
|
|
115
|
-
get: function () {
|
|
116
|
-
return interfaces_1.TYPE.JSON;
|
|
117
|
-
},
|
|
118
|
-
enumerable: false,
|
|
119
|
-
configurable: true
|
|
120
|
-
});
|
|
121
|
-
Object.defineProperty(ConduitJSONConstructor, "Required", {
|
|
122
|
-
get: function () {
|
|
123
|
-
return { type: interfaces_1.TYPE.JSON, required: true };
|
|
124
|
-
},
|
|
125
|
-
enumerable: false,
|
|
126
|
-
configurable: true
|
|
127
|
-
});
|
|
128
|
-
return ConduitJSONConstructor;
|
|
129
|
-
}());
|
|
130
|
-
exports.ConduitJson = ConduitJSONConstructor;
|
|
131
|
-
var ConduitRelationConstructor = /** @class */ (function () {
|
|
132
|
-
// private to disallow creating other instances of this type
|
|
133
|
-
function ConduitRelationConstructor() {
|
|
134
|
-
}
|
|
135
|
-
ConduitRelationConstructor.Optional = function (model) {
|
|
136
|
-
return { type: interfaces_1.TYPE.Relation, model: model, required: false };
|
|
137
|
-
};
|
|
138
|
-
ConduitRelationConstructor.Required = function (model) {
|
|
139
|
-
return { type: interfaces_1.TYPE.Relation, model: model, required: true };
|
|
140
|
-
};
|
|
141
|
-
return ConduitRelationConstructor;
|
|
142
|
-
}());
|
|
143
|
-
exports.ConduitRelation = ConduitRelationConstructor;
|
|
144
|
-
//# sourceMappingURL=TypeHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypeHelpers.js","sourceRoot":"","sources":["../../src/helpers/TypeHelpers.ts"],"names":[],"mappings":";;;AAAA,4CAAwD;AAExD;IACE,4DAA4D;IAC5D;IAAuB,CAAC;IAExB,sBAAW,oCAAQ;aAAnB;YACE,OAAO,iBAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAED,sBAAW,oCAAQ;aAAnB;YACE,OAAO,EAAE,IAAI,EAAE,iBAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC/C,CAAC;;;OAAA;IACH,+BAAC;AAAD,CAAC,AAXD,IAWC;AAEY,QAAA,aAAa,GAAG,wBAAwB,CAAC;AAEtD;IACE,4DAA4D;IAC5D;IAAuB,CAAC;IAExB,sBAAW,oCAAQ;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,IAWC;AAEY,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAE1D;IACE,4DAA4D;IAC5D;IAAuB,CAAC;IAExB,sBAAW,kCAAQ;aAAnB;YACE,OAAO,iBAAI,CAAC,IAAI,CAAC;QACnB,CAAC;;;OAAA;IAED,sBAAW,kCAAQ;aAAnB;YACE,OAAO,EAAE,IAAI,EAAE,iBAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7C,CAAC;;;OAAA;IACH,6BAAC;AAAD,CAAC,AAXD,IAWC;AAEY,QAAA,WAAW,GAAG,sBAAsB,CAAC;AAElD;IACE,4DAA4D;IAC5D;IAAuB,CAAC;IAEjB,mCAAQ,GAAf,UAAgB,KAAa;QAC3B,OAAO,EAAE,IAAI,EAAE,iBAAI,CAAC,QAAQ,EAAE,KAAK,OAAA,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACzD,CAAC;IAEM,mCAAQ,GAAf,UAAgB,KAAa;QAC3B,OAAO,EAAE,IAAI,EAAE,iBAAI,CAAC,QAAQ,EAAE,KAAK,OAAA,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;IACH,iCAAC;AAAD,CAAC,AAXD,IAWC;AAEY,QAAA,eAAe,GAAG,0BAA0B,CAAC"}
|
package/dist/helpers/index.d.ts
DELETED
package/dist/helpers/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./TypeHelpers"), exports);
|
|
18
|
-
__exportStar(require("./GrpcHelper"), exports);
|
|
19
|
-
__exportStar(require("./wrapGrpcFunctions"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.wrapGrpcFunctions = void 0;
|
|
7
|
-
var fast_jwt_1 = require("fast-jwt");
|
|
8
|
-
var grpc_js_1 = require("@grpc/grpc-js");
|
|
9
|
-
var index_1 = __importDefault(require("../index"));
|
|
10
|
-
function wrapGrpcFunctions(functions, postponeRestart) {
|
|
11
|
-
var grpcKey = process.env.GRPC_KEY;
|
|
12
|
-
var wrappedFunctions = {};
|
|
13
|
-
Object.keys(functions).forEach(function (name) {
|
|
14
|
-
wrappedFunctions[name] = function (call, callback) {
|
|
15
|
-
var _a;
|
|
16
|
-
(_a = index_1.default.Metrics) === null || _a === void 0 ? void 0 : _a.increment('internal_grpc_requests_total');
|
|
17
|
-
postponeRestart();
|
|
18
|
-
if (grpcKey) {
|
|
19
|
-
var verify = (0, fast_jwt_1.createVerifier)({ key: grpcKey });
|
|
20
|
-
var grpcToken = call.metadata.get('grpc-token')[0];
|
|
21
|
-
if (!grpcToken) {
|
|
22
|
-
return throwError(callback, 'No gRPC protection token provided', grpc_js_1.status.PERMISSION_DENIED);
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
var jwt = verify(grpcToken);
|
|
26
|
-
call.metadata.set('module-name', jwt.moduleName);
|
|
27
|
-
}
|
|
28
|
-
catch (_b) {
|
|
29
|
-
return throwError(callback, 'Failed to verify gRPC protection token. GRPC_KEY value differs', grpc_js_1.status.PERMISSION_DENIED);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
var invoked;
|
|
33
|
-
try {
|
|
34
|
-
invoked = functions[name](call, callback);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
return throwError(callback, error.message);
|
|
38
|
-
}
|
|
39
|
-
if (typeof (invoked === null || invoked === void 0 ? void 0 : invoked.then) === 'function') {
|
|
40
|
-
invoked.then().catch(function (error) {
|
|
41
|
-
return throwError(callback, error.message);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
return wrappedFunctions;
|
|
47
|
-
}
|
|
48
|
-
exports.wrapGrpcFunctions = wrapGrpcFunctions;
|
|
49
|
-
function throwError(callback, message, code) {
|
|
50
|
-
if (code === void 0) { code = grpc_js_1.status.INTERNAL; }
|
|
51
|
-
// Aborting server streams is not yet implemented!
|
|
52
|
-
if (callback) {
|
|
53
|
-
callback({ code: code, message: message });
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=wrapGrpcFunctions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrapGrpcFunctions.js","sourceRoot":"","sources":["../../src/helpers/wrapGrpcFunctions.ts"],"names":[],"mappings":";;;;;;AAAA,qCAA0C;AAC1C,yCAAuC;AACvC,mDAAwD;AAOxD,SAAgB,iBAA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AO,CAAE,IAAI,CAAA,KAAK,UAAU,EAAE;gBACvC,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,UAAC,KAAY;oBAChC,OAAO,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC7C,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AA7CD,8CA6CC;AAED,SAAS,UAAU,CACjB,QAAuC,EACvC,OAAe,EACf,IAA8B;IAA9B,qBAAA,EAAA,OAAe,gBAAM,CAAC,QAAQ;IAE9B,kDAAkD;IAClD,IAAI,QAAQ,EAAE;QACZ,QAAQ,CAAC,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;KAC7B;AACH,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { GrpcRequest, GrpcResponse } from '..';
|
|
2
|
-
export interface ConduitService {
|
|
3
|
-
readonly protoPath: string;
|
|
4
|
-
readonly protoDescription: string;
|
|
5
|
-
functions: {
|
|
6
|
-
[p: string]: (call: GrpcRequest<any>, callback: GrpcResponse<any>) => void | Promise<void>;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConduitService.js","sourceRoot":"","sources":["../../src/interfaces/ConduitService.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Registry } from 'prom-client';
|
|
2
|
-
export declare class MetricsServer {
|
|
3
|
-
private readonly moduleName;
|
|
4
|
-
private readonly instance;
|
|
5
|
-
private readonly Registry;
|
|
6
|
-
constructor(moduleName: string, instance: string, registry: Registry);
|
|
7
|
-
initialize(): import("express-serve-static-core").Express;
|
|
8
|
-
getHttpPort(): number;
|
|
9
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.MetricsServer = void 0;
|
|
43
|
-
var index_1 = __importDefault(require("../index"));
|
|
44
|
-
var express_1 = __importDefault(require("express"));
|
|
45
|
-
var lodash_1 = require("lodash");
|
|
46
|
-
var MetricsServer = /** @class */ (function () {
|
|
47
|
-
function MetricsServer(moduleName, instance, registry) {
|
|
48
|
-
this.moduleName = moduleName;
|
|
49
|
-
this.instance = instance;
|
|
50
|
-
this.Registry = registry;
|
|
51
|
-
}
|
|
52
|
-
MetricsServer.prototype.initialize = function () {
|
|
53
|
-
var _this = this;
|
|
54
|
-
var server = (0, express_1.default)();
|
|
55
|
-
var port = this.getHttpPort();
|
|
56
|
-
var url = '0.0.0.0:' + port.toString();
|
|
57
|
-
server.listen(port, function () {
|
|
58
|
-
index_1.default.Logger.info("Metrics server listening on: ".concat(url));
|
|
59
|
-
});
|
|
60
|
-
server.get('/', function (req, res) {
|
|
61
|
-
return res
|
|
62
|
-
.status(200)
|
|
63
|
-
.send("Conduit Metrics for module: ".concat(_this.moduleName, ", instance: ").concat(_this.instance));
|
|
64
|
-
});
|
|
65
|
-
server.get('/metrics', function (req, res) { return __awaiter(_this, void 0, void 0, function () {
|
|
66
|
-
var metrics;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0: return [4 /*yield*/, this.Registry.metrics()];
|
|
70
|
-
case 1:
|
|
71
|
-
metrics = _a.sent();
|
|
72
|
-
return [2 /*return*/, res.status(200).send(metrics)];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}); });
|
|
76
|
-
return server;
|
|
77
|
-
};
|
|
78
|
-
MetricsServer.prototype.getHttpPort = function () {
|
|
79
|
-
var value = process.env['METRICS_PORT'];
|
|
80
|
-
if (!value) {
|
|
81
|
-
index_1.default.Logger.error("Metrics HTTP port not set");
|
|
82
|
-
process.exit(-1);
|
|
83
|
-
}
|
|
84
|
-
var port = parseInt(value, 10);
|
|
85
|
-
if ((0, lodash_1.isNaN)(port) || port < 1 || port > 65535) {
|
|
86
|
-
index_1.default.Logger.error("Invalid HTTP port value: ".concat(port));
|
|
87
|
-
process.exit(-1);
|
|
88
|
-
}
|
|
89
|
-
return port;
|
|
90
|
-
};
|
|
91
|
-
return MetricsServer;
|
|
92
|
-
}());
|
|
93
|
-
exports.MetricsServer = MetricsServer;
|
|
94
|
-
//# sourceMappingURL=MetricsServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MetricsServer.js","sourceRoot":"","sources":["../../src/metrics/MetricsServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsC;AACtC,oDAA8B;AAE9B,iCAA+B;AAE/B;IAKE,uBAAY,UAAkB,EAAE,QAAgB,EAAE,QAAkB;QAClE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,kCAAU,GAAV;QAAA,iBAmBC;QAlBC,IAAM,MAAM,GAAG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