@conduitplatform/module-tools 0.16.26 → 0.17.0-alpha.1

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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.cjs +2059 -1775
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +490 -0
  5. package/dist/index.d.ts +490 -7
  6. package/dist/index.esm.js +2033 -1746
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/module.proto +25 -0
  9. package/package.json +27 -31
  10. package/dist/ManagedModule.d.ts +0 -80
  11. package/dist/classes/ConduitActiveSchema.d.ts +0 -19
  12. package/dist/classes/ConduitServiceModule.d.ts +0 -27
  13. package/dist/classes/ConfigController.d.ts +0 -7
  14. package/dist/classes/GrpcServer.d.ts +0 -23
  15. package/dist/classes/ModuleError.d.ts +0 -5
  16. package/dist/classes/index.d.ts +0 -4
  17. package/dist/helpers/GrpcHelper.d.ts +0 -8
  18. package/dist/helpers/GrpcToParsedRouterRequest.d.ts +0 -2
  19. package/dist/helpers/TypeHelpers.d.ts +0 -70
  20. package/dist/helpers/index.d.ts +0 -4
  21. package/dist/helpers/wrapGrpcFunctions.d.ts +0 -5
  22. package/dist/interfaces/ConduitService.d.ts +0 -8
  23. package/dist/interfaces/ModuleLifecycleStage.d.ts +0 -7
  24. package/dist/interfaces/index.d.ts +0 -2
  25. package/dist/logging/index.d.ts +0 -16
  26. package/dist/metrics/MetricsServer.d.ts +0 -11
  27. package/dist/metrics/clientMiddleware.d.ts +0 -2
  28. package/dist/metrics/config/defaults.d.ts +0 -91
  29. package/dist/metrics/index.d.ts +0 -23
  30. package/dist/routing/ProxyRouteBuilder.d.ts +0 -21
  31. package/dist/routing/RouteBuilder.d.ts +0 -23
  32. package/dist/routing/RoutingController.d.ts +0 -8
  33. package/dist/routing/RoutingManager.d.ts +0 -35
  34. package/dist/routing/RoutingUtilities.d.ts +0 -7
  35. package/dist/routing/index.d.ts +0 -5
  36. package/dist/routing/wrapRouterFunctions.d.ts +0 -13
  37. package/dist/utilities/convictConfigParser.d.ts +0 -2
  38. package/dist/utilities/index.d.ts +0 -3
  39. package/dist/utilities/initializeSdk.d.ts +0 -2
  40. package/dist/utilities/linearBackoffTimeout.d.ts +0 -9
  41. package/dist/utilities/merge.d.ts +0 -1
package/dist/module.proto CHANGED
@@ -9,8 +9,33 @@ message SetConfigResponse {
9
9
  string updatedConfig = 1;
10
10
  }
11
11
 
12
+ message GetExportableResourcesRequest {}
13
+
14
+ message GetExportableResourcesResponse {
15
+ string resources = 1;
16
+ }
17
+
18
+ message ExportResourcesRequest {
19
+ repeated string resourceTypes = 1;
20
+ }
21
+
22
+ message ExportResourcesResponse {
23
+ string data = 1;
24
+ }
25
+
26
+ message ImportResourcesRequest {
27
+ string data = 1;
28
+ }
29
+
30
+ message ImportResourcesResponse {
31
+ string result = 1;
32
+ }
33
+
12
34
  service ConduitModule {
13
35
  rpc SetConfig(SetConfigRequest) returns (SetConfigResponse);
36
+ rpc GetExportableResources(GetExportableResourcesRequest) returns (GetExportableResourcesResponse);
37
+ rpc ExportResources(ExportResourcesRequest) returns (ExportResourcesResponse);
38
+ rpc ImportResources(ImportResourcesRequest) returns (ImportResourcesResponse);
14
39
  }
15
40
 
16
41
  service ClientRouter {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduitplatform/module-tools",
3
- "version": "0.16.26",
3
+ "version": "0.17.0-alpha.1",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,27 +18,24 @@
18
18
  }
19
19
  },
20
20
  "engines": {
21
- "node": ">=14"
21
+ "node": ">=20"
22
22
  },
23
23
  "type": "module",
24
- "scripts": {
25
- "prepublish": "npm run build",
26
- "build": "rimraf dist && rollup -c",
27
- "postbuild": "copyfiles -u 1 src/*.proto src/**/*.json ./dist/"
28
- },
29
24
  "license": "MIT",
30
25
  "dependencies": {
31
- "@grpc/grpc-js": "^1.13.3",
32
- "@grpc/proto-loader": "^0.7.13",
33
- "abort-controller-x": "^0.4.3",
34
- "convict": "^6.2.4",
35
- "fast-jwt": "^6.0.2",
36
- "lodash": "^4.17.21",
37
- "lodash-es": "^4.17.21",
26
+ "@grpc/grpc-js": "^1.14.3",
27
+ "@grpc/proto-loader": "^0.8.0",
28
+ "abort-controller-x": "^0.5.0",
29
+ "convict": "^6.2.5",
30
+ "fast-jwt": "^6.1.0",
31
+ "lodash": "^4.18.1",
32
+ "lodash-es": "^4.18.1",
33
+ "nice-grpc-common": "^2.0.2",
38
34
  "prom-client": "^15.1.3",
39
- "protobufjs": "^7.2.6",
40
- "winston": "^3.12.0",
41
- "winston-loki": "^6.0.8"
35
+ "protobufjs": "^8.0.1",
36
+ "winston": "^3.19.0",
37
+ "winston-loki": "^6.1.4",
38
+ "@conduitplatform/grpc-sdk": "1.1.3"
42
39
  },
43
40
  "directories": {
44
41
  "lib": "dist",
@@ -53,27 +50,26 @@
53
50
  "directory": "libraries/module-tools"
54
51
  },
55
52
  "devDependencies": {
56
- "@conduitplatform/grpc-sdk": "*",
57
- "@rollup/plugin-commonjs": "^26.0.1",
58
- "@rollup/plugin-json": "^6.1.0",
59
- "@rollup/plugin-replace": "^5.0.7",
60
- "@rollup/plugin-typescript": "^11.1.6",
61
53
  "@types/convict": "^6.1.6",
62
54
  "@types/fs-extra": "^11.0.4",
63
55
  "@types/google-protobuf": "^3.15.12",
64
- "@types/lodash": "^4.17.12",
56
+ "@types/lodash": "^4.17.24",
65
57
  "@types/lodash-es": "^4.17.12",
66
- "@types/node": "20.11.24",
58
+ "@types/node": "24.9.1",
67
59
  "copyfiles": "^2.4.1",
68
- "rimraf": "^5.0.5",
69
- "rollup": "^4.22.4",
60
+ "rimraf": "^6.1.3",
70
61
  "ts-node": "^10.9.2",
71
- "ts-proto": "^1.167.1",
62
+ "ts-proto": "^2.11.6",
72
63
  "tslib": "^2.6.3",
73
- "typescript": "~5.6.2"
64
+ "tsup": "^8.5.1",
65
+ "typescript": "~6.0.2"
74
66
  },
75
67
  "peerDependencies": {
76
- "@conduitplatform/grpc-sdk": "*",
77
- "@grpc/grpc-js": "^1.13.3"
68
+ "@grpc/grpc-js": "^1.13.3",
69
+ "@conduitplatform/grpc-sdk": "1.1.3"
70
+ },
71
+ "scripts": {
72
+ "prepublish": "npm run build",
73
+ "build": "rimraf dist && tsup"
78
74
  }
79
- }
75
+ }
@@ -1,80 +0,0 @@
1
- import { ConduitServiceModule } from './classes/index.js';
2
- import convict from 'convict';
3
- import { ConduitService } from './interfaces/index.js';
4
- import { GrpcRequest, GrpcResponse, SetConfigRequest, SetConfigResponse } from '@conduitplatform/grpc-sdk';
5
- export declare abstract class ManagedModule<T> extends ConduitServiceModule {
6
- readonly config?: convict.Config<T>;
7
- configOverride: boolean;
8
- service?: ConduitService;
9
- protected abstract readonly configSchema?: object;
10
- protected abstract readonly metricsSchema?: object;
11
- private readonly serviceAddress;
12
- private readonly servicePort;
13
- private _moduleState;
14
- protected constructor(moduleName: string);
15
- get name(): string;
16
- get address(): string;
17
- start(): Promise<void>;
18
- /**
19
- * This is the first function triggered on module spin up.
20
- * @param address {string} external address:port of service (LoadBalancer)
21
- * @param port {string} port to bring up gRPC service
22
- */
23
- initialize(address: string, port: string): void;
24
- /**
25
- * This is triggered before spinning up the Grpc Server
26
- * of the module. On this stage, the redis bus and state have
27
- * not yet been initialized, and only communications with Conduit core
28
- * have been established.
29
- */
30
- preServerStart(): Promise<void>;
31
- /**
32
- * This is triggered right after Grpc Server start.
33
- * At this stage the core module will communicate with your service
34
- * for health checks, and the Bus and State management mechanics
35
- * are online and available.
36
- */
37
- onServerStart(): Promise<void>;
38
- /**
39
- * Triggers right before registering the module with Conduit Core.
40
- */
41
- preRegister(): Promise<void>;
42
- /**
43
- * Triggers when module has been registered with Conduit Core
44
- * This is the step where you should initialize your
45
- * module's general routing (admin or client) and any other operation,
46
- * that would require other modules being able to reach you
47
- */
48
- onRegister(): Promise<void>;
49
- /**
50
- * This is triggered when the module receives new configuration.
51
- * At this step the configuration has not been checked yet,
52
- * and has only been parsed.
53
- * @param config
54
- */
55
- preConfig(config: T): Promise<T>;
56
- /**
57
- * This is triggered when new configuration has been applied.
58
- * This happens either when changes are being made on the configuration,
59
- * or on module start up, where the config is recovered from the database.
60
- * In either case the configuration is now available through the
61
- * Config Controller of the sdk.
62
- */
63
- onConfig(): Promise<void>;
64
- /**
65
- * Registers common and module-specific metric types.
66
- */
67
- registerMetrics(): Promise<void>;
68
- /**
69
- * Initializes metric startup values.
70
- * Implemented by individual modules.
71
- */
72
- initializeMetrics(): Promise<void>;
73
- createGrpcServer(): Promise<void>;
74
- startGrpcServer(): Promise<void>;
75
- setConfig(call: GrpcRequest<SetConfigRequest>, callback: GrpcResponse<SetConfigResponse>): Promise<void>;
76
- /** Used to update the module's configuration on initial Redis/DB reconciliation. */
77
- handleConfigSyncUpdate(): Promise<void>;
78
- private preRegisterLifecycle;
79
- private postRegisterLifecycle;
80
- }
@@ -1,19 +0,0 @@
1
- import { ConduitModel, ConduitSchema, ConduitSchemaOptions, DatabaseProvider, Query } from '@conduitplatform/grpc-sdk';
2
- export declare class ConduitActiveSchema<T> extends ConduitSchema {
3
- private readonly dbInstance;
4
- constructor(dbInstance: DatabaseProvider, name: string, fields?: ConduitModel, modelOptions?: ConduitSchemaOptions, collectionName?: string);
5
- findOne(query: Query<T>, select?: string, populate?: string | string[], userId?: string, scope?: string): Promise<T | null>;
6
- findMany(query: Query<T>, select?: string, skip?: number, limit?: number, sort?: {
7
- [field: string]: -1 | 1;
8
- } | string[] | string, populate?: string | string[], userId?: string, scope?: string): Promise<T[]>;
9
- create(query: Query<T>, userId?: string, scope?: string): Promise<T>;
10
- createMany(query: Query<T>[], userId?: string, scope?: string): Promise<T[]>;
11
- findByIdAndUpdate(id: string, document: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<T | null>;
12
- findByIdAndReplace(id: string, document: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<T | null>;
13
- replaceOne(filterQuery: Query<T>, query: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<any>;
14
- updateOne(filterQuery: Query<T>, query: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<any>;
15
- updateMany(filterQuery: Query<T>, query: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<any>;
16
- deleteOne(query: Query<T>, userId?: string, scope?: string): Promise<any>;
17
- deleteMany(query: Query<T>, userId?: string, scope?: string): Promise<any>;
18
- countDocuments(query: Query<T>, userId?: string, scope?: string): Promise<number>;
19
- }
@@ -1,27 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- import { ServerWritableStream } from '@grpc/grpc-js';
3
- import { GrpcServer } from './GrpcServer.js';
4
- import { ConduitGrpcSdk, GrpcCallback, GrpcRequest, GrpcResponse, HealthCheckRequest, HealthCheckResponse, HealthCheckStatus, SetConfigRequest, SetConfigResponse } from '@conduitplatform/grpc-sdk';
5
- export declare abstract class ConduitServiceModule {
6
- protected readonly _moduleName: string;
7
- protected _serviceName?: string;
8
- protected _address: string;
9
- protected grpcServer: GrpcServer;
10
- protected readonly events: EventEmitter;
11
- private _serviceHealthState;
12
- protected constructor(moduleName: string);
13
- private _registered;
14
- set registered(registered: boolean);
15
- protected _port: string;
16
- get port(): string;
17
- private _grpcSdk;
18
- get grpcSdk(): ConduitGrpcSdk;
19
- set grpcSdk(grpcSdk: ConduitGrpcSdk);
20
- get healthState(): HealthCheckStatus;
21
- updateHealth(state: HealthCheckStatus, init?: boolean): void;
22
- healthCheck(call: GrpcRequest<HealthCheckRequest>, callback: GrpcCallback<HealthCheckResponse>): void;
23
- healthWatch(call: ServerWritableStream<HealthCheckRequest, HealthCheckResponse>): void;
24
- abstract setConfig(call: GrpcRequest<SetConfigRequest>, callback: GrpcResponse<SetConfigResponse>): Promise<void>;
25
- protected addHealthCheckService(): Promise<void>;
26
- protected addModuleService(): Promise<void>;
27
- }
@@ -1,7 +0,0 @@
1
- export declare class ConfigController {
2
- private static instance;
3
- private _config;
4
- get config(): any;
5
- set config(config: any);
6
- static getInstance(): ConfigController;
7
- }
@@ -1,23 +0,0 @@
1
- export declare class GrpcServer {
2
- private grpcServer?;
3
- private started;
4
- private startedOnce;
5
- private _serviceNames;
6
- private scheduledRestart;
7
- private _postponeRequests;
8
- private _useForce?;
9
- private _services;
10
- constructor(port?: string);
11
- waitForReady(): Promise<void>;
12
- private _url;
13
- get url(): string;
14
- createNewServer(useForce?: boolean): Promise<number>;
15
- addService(protoPath: string, protoDescription: string, functions: {
16
- [name: string]: Function;
17
- }, noAuth?: boolean): Promise<GrpcServer>;
18
- wait(time: number): Promise<void>;
19
- refresh(): Promise<void>;
20
- scheduleRefresh(): void;
21
- start(): void;
22
- private postponeRestart;
23
- }
@@ -1,5 +0,0 @@
1
- import { GrpcError, ModuleErrorDefinition } from '@conduitplatform/grpc-sdk';
2
- export declare class ModuleError extends GrpcError {
3
- debugLogInfo?: string;
4
- constructor(errorDefinition: ModuleErrorDefinition, debugLogInfo?: string);
5
- }
@@ -1,4 +0,0 @@
1
- export * from './ConduitActiveSchema.js';
2
- export * from './GrpcServer.js';
3
- export * from './ConduitServiceModule.js';
4
- export * from './ConfigController.js';
@@ -1,8 +0,0 @@
1
- import { Server } from '@grpc/grpc-js';
2
- export declare function createServer(port: string): Promise<{
3
- server: Server;
4
- port: number;
5
- }>;
6
- export declare function addServiceToServer(server: Server, protoPath: string, descriptorObject: string, functions: {
7
- [name: string]: Function;
8
- }): void;
@@ -1,2 +0,0 @@
1
- import { Context, Cookies, Params, ParsedRouterRequest } from '@conduitplatform/grpc-sdk';
2
- export declare function createParsedRouterRequest(params: Params, urlParams?: Params, queryParams?: Params, bodyParams?: Params, path?: string, headers?: Headers, context?: Context, cookies?: Cookies): ParsedRouterRequest;
@@ -1,70 +0,0 @@
1
- import { TYPE } from '@conduitplatform/grpc-sdk';
2
- declare class ConduitStringConstructor {
3
- private constructor();
4
- static get Optional(): TYPE.String;
5
- static get Required(): {
6
- type: TYPE.String;
7
- required: true;
8
- };
9
- }
10
- export declare const ConduitString: typeof ConduitStringConstructor;
11
- declare class ConduitNumberConstructor {
12
- private constructor();
13
- static get Optional(): TYPE.Number;
14
- static get Required(): {
15
- type: TYPE.Number;
16
- required: true;
17
- };
18
- }
19
- export declare const ConduitNumber: typeof ConduitNumberConstructor;
20
- declare class ConduitBooleanConstructor {
21
- private constructor();
22
- static get Optional(): TYPE.Boolean;
23
- static get Required(): {
24
- type: TYPE.Boolean;
25
- required: true;
26
- };
27
- }
28
- export declare const ConduitBoolean: typeof ConduitBooleanConstructor;
29
- declare class ConduitDateConstructor {
30
- private constructor();
31
- static get Optional(): TYPE.Date;
32
- static get Required(): {
33
- type: TYPE.Date;
34
- required: true;
35
- };
36
- }
37
- export declare const ConduitDate: typeof ConduitDateConstructor;
38
- declare class ConduitObjectIdConstructor {
39
- private constructor();
40
- static get Optional(): TYPE.ObjectId;
41
- static get Required(): {
42
- type: TYPE.ObjectId;
43
- required: true;
44
- };
45
- }
46
- export declare const ConduitObjectId: typeof ConduitObjectIdConstructor;
47
- declare class ConduitJSONConstructor {
48
- private constructor();
49
- static get Optional(): TYPE.JSON;
50
- static get Required(): {
51
- type: TYPE.JSON;
52
- required: true;
53
- };
54
- }
55
- export declare const ConduitJson: typeof ConduitJSONConstructor;
56
- declare class ConduitRelationConstructor {
57
- private constructor();
58
- static Optional(model: string): {
59
- type: TYPE.Relation;
60
- model: string;
61
- required: false;
62
- };
63
- static Required(model: string): {
64
- type: TYPE.Relation;
65
- model: string;
66
- required: true;
67
- };
68
- }
69
- export declare const ConduitRelation: typeof ConduitRelationConstructor;
70
- export {};
@@ -1,4 +0,0 @@
1
- export * from './TypeHelpers.js';
2
- export * from './GrpcHelper.js';
3
- export * from './wrapGrpcFunctions.js';
4
- export * from './GrpcToParsedRouterRequest.js';
@@ -1,5 +0,0 @@
1
- export declare function wrapGrpcFunctions(functions: {
2
- [name: string]: Function;
3
- }, postponeRestart: () => void, noAuth?: boolean): {
4
- [name: string]: Function;
5
- };
@@ -1,8 +0,0 @@
1
- import { GrpcRequest, GrpcResponse } from '@conduitplatform/grpc-sdk';
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,7 +0,0 @@
1
- export declare enum ModuleLifecycleStage {
2
- CREATE_GRPC = "creat-grpc-server",
3
- PRE_SERVER_START = "pre-grpc-start",
4
- SERVER_STARTED = "grpc-server-started",
5
- PRE_REGISTER = "pre-register",
6
- POST_REGISTER = "post-register"
7
- }
@@ -1,2 +0,0 @@
1
- export * from './ConduitService.js';
2
- export * from './ModuleLifecycleStage.js';
@@ -1,16 +0,0 @@
1
- import { IConduitLogger, Indexable } from '@conduitplatform/grpc-sdk';
2
- import winston, { LogCallback, Logger } from 'winston';
3
- export declare class ConduitLogger implements IConduitLogger {
4
- private readonly _winston;
5
- constructor(transports?: winston.transport[]);
6
- get winston(): winston.Logger;
7
- addTransport(transport: winston.transport): void;
8
- log(message: string, level?: string, cb?: LogCallback): Logger;
9
- logObject(object: Indexable, message?: string, level?: string, cb?: LogCallback): Logger;
10
- info(message: string, cb?: LogCallback): Logger;
11
- warn(message: string, cb?: LogCallback): Logger;
12
- error(message: string | Error, cb?: LogCallback): Logger;
13
- http(message: string, cb?: LogCallback): Logger;
14
- verbose(message: string, cb?: LogCallback): Logger;
15
- }
16
- export declare function setupLoki(module: string, instance: string): Promise<void>;
@@ -1,11 +0,0 @@
1
- import { IncomingMessage, ServerResponse } from 'http';
2
- import { Registry } from 'prom-client';
3
- export declare class MetricsServer {
4
- private readonly moduleName;
5
- private readonly instance;
6
- private readonly Registry;
7
- constructor(moduleName: string, instance: string, registry: Registry);
8
- initialize(): import("http").Server<typeof IncomingMessage, typeof ServerResponse>;
9
- private requestHandler;
10
- private getHttpPort;
11
- }
@@ -1,2 +0,0 @@
1
- import { ClientMiddleware } from 'nice-grpc-common';
2
- export declare function clientMiddleware(): ClientMiddleware;
@@ -1,91 +0,0 @@
1
- import { MetricType } from '@conduitplatform/grpc-sdk';
2
- declare const _default: {
3
- internalGrpcRequests: {
4
- type: MetricType;
5
- config: {
6
- name: string;
7
- help: string;
8
- };
9
- };
10
- clientGrpcRequests: {
11
- type: MetricType;
12
- config: {
13
- name: string;
14
- help: string;
15
- };
16
- };
17
- adminGrpcRequests: {
18
- type: MetricType;
19
- config: {
20
- name: string;
21
- help: string;
22
- };
23
- };
24
- clientGrpcErrors: {
25
- type: MetricType;
26
- config: {
27
- name: string;
28
- help: string;
29
- };
30
- };
31
- adminGrpcErrors: {
32
- type: MetricType;
33
- config: {
34
- name: string;
35
- help: string;
36
- };
37
- };
38
- moduleHealthState: {
39
- type: MetricType;
40
- config: {
41
- name: string;
42
- help: string;
43
- };
44
- };
45
- grpcRequestLatency: {
46
- type: MetricType;
47
- config: {
48
- name: string;
49
- help: string;
50
- };
51
- };
52
- adminGrpcRequestLatency: {
53
- type: MetricType;
54
- config: {
55
- name: string;
56
- help: string;
57
- };
58
- };
59
- clientGrpcRequestLatency: {
60
- type: MetricType;
61
- config: {
62
- name: string;
63
- help: string;
64
- };
65
- };
66
- grpcResponseStatuses: {
67
- type: MetricType;
68
- config: {
69
- name: string;
70
- help: string;
71
- labelNames: string[];
72
- };
73
- };
74
- adminGrpcResponseStatuses: {
75
- type: MetricType;
76
- config: {
77
- name: string;
78
- help: string;
79
- labelNames: string[];
80
- };
81
- };
82
- clientGrpcResponseStatuses: {
83
- type: MetricType;
84
- config: {
85
- name: string;
86
- help: string;
87
- labelNames: string[];
88
- };
89
- };
90
- };
91
- export default _default;
@@ -1,23 +0,0 @@
1
- import { Counter, CounterConfiguration, Gauge, GaugeConfiguration, Histogram, HistogramConfiguration, LabelValues, MetricConfiguration, Registry, Summary, SummaryConfiguration } from 'prom-client';
2
- import { IConduitMetrics, MetricType } from '@conduitplatform/grpc-sdk';
3
- export declare class ConduitMetrics implements IConduitMetrics {
4
- private readonly moduleName;
5
- private readonly instance;
6
- private readonly _registry;
7
- private _httpServer;
8
- constructor(moduleName: string, instance: string);
9
- get registry(): Registry<"text/plain; version=0.0.4; charset=utf-8">;
10
- initializeDefaultMetrics(): void;
11
- registerMetric(type: MetricType, config: MetricConfiguration<string>): void;
12
- collectDefaultMetrics(): void;
13
- createCounter(config: CounterConfiguration<any>): Counter<any>;
14
- createSummary(config: SummaryConfiguration<any>): Summary<any>;
15
- createHistogram(config: HistogramConfiguration<any>): Histogram<any>;
16
- createGauge(config: GaugeConfiguration<any>): Gauge<any>;
17
- getMetric(name: string): import("prom-client").Metric<string> | undefined;
18
- increment(metric: string, increment?: number, labels?: LabelValues<any>): void;
19
- decrement(metric: string, decrement?: number, labels?: LabelValues<any>): void;
20
- set(metric: string, value: number, labels?: LabelValues<any>): void;
21
- observe(metric: string, value: number, labels?: LabelValues<any>): void;
22
- private addPrefix;
23
- }
@@ -1,21 +0,0 @@
1
- import { ProxyMiddlewareOptions, ProxyRouteActions, ProxyRouteOptions } from '@conduitplatform/grpc-sdk';
2
- import { RoutingManager } from './RoutingManager.js';
3
- export declare class ProxyRouteBuilder {
4
- private readonly manager?;
5
- private _options;
6
- private _proxy;
7
- constructor(manager?: RoutingManager | undefined);
8
- method(action: ProxyRouteActions): ProxyRouteBuilder;
9
- path(path: string): ProxyRouteBuilder;
10
- target(target: string): ProxyRouteBuilder;
11
- options(options: ProxyRouteOptions): ProxyRouteBuilder;
12
- proxy(proxy: ProxyMiddlewareOptions): ProxyRouteBuilder;
13
- middleware(middleware: string | string[], allowDuplicates?: boolean): ProxyRouteBuilder;
14
- add(): void;
15
- build(): {
16
- input: {
17
- options: ProxyRouteOptions;
18
- proxy: ProxyMiddlewareOptions;
19
- };
20
- };
21
- }
@@ -1,23 +0,0 @@
1
- import { ConduitModel, ConduitQueryParams, ConduitReturn, ConduitRoute, ConduitRouteActions, ConduitUrlParams } from '@conduitplatform/grpc-sdk';
2
- import { RoutingManager } from './RoutingManager.js';
3
- import { RequestHandlers } from './wrapRouterFunctions.js';
4
- export declare class RouteBuilder {
5
- private readonly manager?;
6
- private readonly _options;
7
- private _returns;
8
- private _handler;
9
- constructor(manager?: RoutingManager | undefined);
10
- method(action: ConduitRouteActions): RouteBuilder;
11
- name(name: string): RouteBuilder;
12
- description(description: string): RouteBuilder;
13
- cacheControl(cache: string): RouteBuilder;
14
- middleware(middleware: string | string[], allowDuplicates?: boolean): RouteBuilder;
15
- path(path: string): RouteBuilder;
16
- queryParams(params: ConduitQueryParams): RouteBuilder;
17
- urlParams(params: ConduitUrlParams): RouteBuilder;
18
- bodyParams(params: ConduitModel): RouteBuilder;
19
- return(name: string, fields: ConduitReturn): RouteBuilder;
20
- handler(fn: RequestHandlers): RouteBuilder;
21
- add(): void;
22
- build(): ConduitRoute;
23
- }
@@ -1,8 +0,0 @@
1
- import { GrpcCallback, GrpcRequest } from '@conduitplatform/grpc-sdk';
2
- export declare class RoutingController {
3
- private _routeHandlers;
4
- handleRequest(call: GrpcRequest<any>, callback: GrpcCallback<any>): void;
5
- setRoutes(routes: {
6
- [key: string]: (call: any, callback: any) => void;
7
- }): void;
8
- }
@@ -1,35 +0,0 @@
1
- import { RouteBuilder } from './RouteBuilder.js';
2
- import { RequestHandlers, SocketEventHandler } from './wrapRouterFunctions.js';
3
- import { Admin, ConduitMiddlewareOptions, ConduitRouteOptions, ConduitRouteReturnDefinition, ConduitSocketOptions, ProxyMiddlewareOptions, ProxyRouteOptions, Router } from '@conduitplatform/grpc-sdk';
4
- import { GrpcServer } from '../classes/index.js';
5
- import { ProxyRouteBuilder } from './ProxyRouteBuilder.js';
6
- import { RoutingController } from './RoutingController.js';
7
- export declare class RoutingManager {
8
- private readonly _router;
9
- private readonly _server;
10
- private _moduleRoutes;
11
- private _moduleProxyRoutes;
12
- static ClientController: RoutingController;
13
- static AdminController: RoutingController;
14
- private _routeHandlers;
15
- private readonly isAdmin;
16
- constructor(_router: Router | Admin, _server: GrpcServer);
17
- get(path: string): RouteBuilder;
18
- post(path: string): RouteBuilder;
19
- delete(path: string): RouteBuilder;
20
- update(path: string): RouteBuilder;
21
- patch(path: string): RouteBuilder;
22
- proxy(): ProxyRouteBuilder;
23
- clear(): void;
24
- middleware(input: ConduitMiddlewareOptions, handler: RequestHandlers): void;
25
- route(input: ConduitRouteOptions, type: ConduitRouteReturnDefinition, handler: RequestHandlers): void;
26
- proxyRoute(input: {
27
- options: ProxyRouteOptions;
28
- proxy: ProxyMiddlewareOptions;
29
- }): void;
30
- socket(input: ConduitSocketOptions, events: Record<string, SocketEventHandler>): void;
31
- registerRoutes(): Promise<any>;
32
- private generateGrpcName;
33
- private extractNameFromPath;
34
- private parseRouteObject;
35
- }