@revisium/endpoint 1.2.0 → 1.4.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/app.module.js +1 -1
- package/dist/app.module.js.map +1 -1
- package/dist/endpoint-microservice/app-options.module.d.ts +5 -0
- package/dist/endpoint-microservice/app-options.module.js +27 -0
- package/dist/endpoint-microservice/app-options.module.js.map +1 -0
- package/dist/endpoint-microservice/core-api/generated/api.d.ts +84 -23
- package/dist/endpoint-microservice/core-api/generated/api.js +5 -4
- package/dist/endpoint-microservice/core-api/generated/api.js.map +1 -1
- package/dist/endpoint-microservice/core-api/internal-core-api.service.d.ts +5 -3
- package/dist/endpoint-microservice/core-api/internal-core-api.service.js +16 -10
- package/dist/endpoint-microservice/core-api/internal-core-api.service.js.map +1 -1
- package/dist/endpoint-microservice/core-api/utils/transformFromPrismaToRowModel.d.ts +2 -2
- package/dist/endpoint-microservice/endpoint-microservice.module.d.ts +3 -1
- package/dist/endpoint-microservice/endpoint-microservice.module.js +24 -16
- package/dist/endpoint-microservice/endpoint-microservice.module.js.map +1 -1
- package/dist/endpoint-microservice/{endpoint-listener.controller.d.ts → events/endpoint-event.handler.d.ts} +4 -4
- package/dist/endpoint-microservice/events/endpoint-event.handler.js +35 -0
- package/dist/endpoint-microservice/events/endpoint-event.handler.js.map +1 -0
- package/dist/endpoint-microservice/events/endpoint-events.module.d.ts +2 -0
- package/dist/endpoint-microservice/events/endpoint-events.module.js +25 -0
- package/dist/endpoint-microservice/events/endpoint-events.module.js.map +1 -0
- package/dist/endpoint-microservice/events/endpoint-listener.controller.d.ts +12 -0
- package/dist/endpoint-microservice/{endpoint-listener.controller.js → events/endpoint-listener.controller.js} +17 -18
- package/dist/endpoint-microservice/events/endpoint-listener.controller.js.map +1 -0
- package/dist/endpoint-microservice/events/in-process-endpoint.listener.d.ts +12 -0
- package/dist/endpoint-microservice/events/in-process-endpoint.listener.js +53 -0
- package/dist/endpoint-microservice/events/in-process-endpoint.listener.js.map +1 -0
- package/dist/endpoint-microservice/graphql/graphql-endpoint.controller.d.ts +4 -2
- package/dist/endpoint-microservice/graphql/graphql-endpoint.controller.js +44 -12
- package/dist/endpoint-microservice/graphql/graphql-endpoint.controller.js.map +1 -1
- package/dist/endpoint-microservice/graphql/graphql-endpoint.service.d.ts +23 -7
- package/dist/endpoint-microservice/graphql/graphql-endpoint.service.js +61 -59
- package/dist/endpoint-microservice/graphql/graphql-endpoint.service.js.map +1 -1
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/graphql-schema.converter.d.ts +10 -2
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/graphql-schema.converter.js +100 -8
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/graphql-schema.converter.js.map +1 -1
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/types.d.ts +8 -7
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/types.js +104 -1
- package/dist/endpoint-microservice/graphql/graphql-schema-converter/types.js.map +1 -1
- package/dist/endpoint-microservice/graphql/queries/handlers/get-graphql-schema.handler.js +6 -4
- package/dist/endpoint-microservice/graphql/queries/handlers/get-graphql-schema.handler.js.map +1 -1
- package/dist/endpoint-microservice/health/database-check.service.d.ts +1 -1
- package/dist/endpoint-microservice/health/notification.check.d.ts +1 -1
- package/dist/endpoint-microservice/metrics/utils.js +1 -2
- package/dist/endpoint-microservice/metrics/utils.js.map +1 -1
- package/dist/endpoint-microservice/restapi/queries/handlers/get-open-api-schema.handler.d.ts +1 -0
- package/dist/endpoint-microservice/restapi/queries/handlers/get-open-api-schema.handler.js +28 -324
- package/dist/endpoint-microservice/restapi/queries/handlers/get-open-api-schema.handler.js.map +1 -1
- package/dist/endpoint-microservice/restapi/queries/handlers/open-api-shema.utils.d.ts +7 -0
- package/dist/endpoint-microservice/restapi/queries/handlers/open-api-shema.utils.js +141 -0
- package/dist/endpoint-microservice/restapi/queries/handlers/open-api-shema.utils.js.map +1 -0
- package/dist/endpoint-microservice/restapi/restapi-endpoint.service.js +1 -3
- package/dist/endpoint-microservice/restapi/restapi-endpoint.service.js.map +1 -1
- package/dist/endpoint-microservice/shared/app-mode.d.ts +4 -0
- package/dist/endpoint-microservice/shared/app-mode.js +5 -0
- package/dist/endpoint-microservice/shared/app-mode.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/lib/resolveRefs.js +8 -0
- package/dist/endpoint-microservice/shared/schema/lib/resolveRefs.js.map +1 -1
- package/dist/endpoint-microservice/shared/schema/model/schema/json-boolean.store.d.ts +0 -1
- package/dist/endpoint-microservice/shared/schema/model/schema/json-number.store.d.ts +0 -1
- package/dist/endpoint-microservice/shared/schema/model/schema/json-string.store.d.ts +0 -1
- package/dist/endpoint-microservice/shared/schema/plugins/index.d.ts +7 -0
- package/dist/endpoint-microservice/shared/schema/plugins/index.js +7 -0
- package/dist/endpoint-microservice/shared/schema/plugins/index.js.map +1 -1
- package/dist/endpoint-microservice/shared/schema/plugins/row-created-at.schema.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-created-at.schema.js +15 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-created-at.schema.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-created-id.schema.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-created-id.schema.js +15 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-created-id.schema.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-hash.schema.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-hash.schema.js +15 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-hash.schema.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-id.schema.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-id.schema.js +15 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-id.schema.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-schema-hash.schema.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-schema-hash.schema.js +15 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-schema-hash.schema.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-updated-at.schema.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-updated-at.schema.js +15 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-updated-at.schema.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-version-id.schema.d.ts +4 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-version-id.schema.js +15 -0
- package/dist/endpoint-microservice/shared/schema/plugins/row-version-id.schema.js.map +1 -0
- package/dist/endpoint-microservice/shared/schema-ids.consts.d.ts +7 -0
- package/dist/endpoint-microservice/shared/schema-ids.consts.js +7 -0
- package/dist/endpoint-microservice/shared/schema-ids.consts.js.map +1 -1
- package/dist/endpoint-microservice/shared/utils/getOffsetPagination.js +1 -2
- package/dist/endpoint-microservice/shared/utils/getOffsetPagination.js.map +1 -1
- package/dist/endpoint-microservice/shared/utils/parseHeaders.d.ts +0 -1
- package/dist/main.js +8 -1
- package/dist/main.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +51 -42
- package/dist/endpoint-microservice/endpoint-listener.controller.js.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"endpoint-event.handler.js","sourceRoot":"","sources":["../../../src/endpoint-microservice/events/endpoint-event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uCAA0C;AAE1C,2CAIiD;AAG1C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEhD,aAAa,CAAC,EAAU;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,4BAAqB,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC;IAEM,aAAa,CAAC,EAAU;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,4BAAqB,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC;IAEM,aAAa,CAAC,KAGpB;QACC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAC5B,IAAI,4BAAqB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAChE,CAAC;IACJ,CAAC;CACF,CAAA;AAnBY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAE8B,iBAAU;GADxC,oBAAoB,CAmBhC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.EndpointEventsModule = void 0;
|
10
|
+
const common_1 = require("@nestjs/common");
|
11
|
+
const cqrs_1 = require("@nestjs/cqrs");
|
12
|
+
const endpoint_event_handler_1 = require("./endpoint-event.handler");
|
13
|
+
const endpoint_listener_controller_1 = require("./endpoint-listener.controller");
|
14
|
+
const in_process_endpoint_listener_1 = require("./in-process-endpoint.listener");
|
15
|
+
let EndpointEventsModule = class EndpointEventsModule {
|
16
|
+
};
|
17
|
+
exports.EndpointEventsModule = EndpointEventsModule;
|
18
|
+
exports.EndpointEventsModule = EndpointEventsModule = __decorate([
|
19
|
+
(0, common_1.Module)({
|
20
|
+
imports: [cqrs_1.CqrsModule],
|
21
|
+
providers: [endpoint_event_handler_1.EndpointEventHandler, in_process_endpoint_listener_1.InProcessEndpointListener],
|
22
|
+
controllers: [endpoint_listener_controller_1.EndpointListenerController],
|
23
|
+
})
|
24
|
+
], EndpointEventsModule);
|
25
|
+
//# sourceMappingURL=endpoint-events.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"endpoint-events.module.js","sourceRoot":"","sources":["../../../src/endpoint-microservice/events/endpoint-events.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,uCAA0C;AAC1C,qEAA+F;AAC/F,iFAA2G;AAC3G,iFAA0G;AAOnG,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oDAAoB;+BAApB,oBAAoB;IALhC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,iBAAU,CAAC;QACrB,SAAS,EAAE,CAAC,6CAAoB,EAAE,wDAAyB,CAAC;QAC5D,WAAW,EAAE,CAAC,yDAA0B,CAAC;KAC1C,CAAC;GACW,oBAAoB,CAAG"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { EndpointType } from '@prisma/client';
|
2
|
+
import { EndpointEventHandler } from '../../endpoint-microservice/events/endpoint-event.handler';
|
3
|
+
export declare class EndpointListenerController {
|
4
|
+
private readonly handler;
|
5
|
+
constructor(handler: EndpointEventHandler);
|
6
|
+
handleCreated(id: string): Promise<any>;
|
7
|
+
handleUpdated(id: string): Promise<any>;
|
8
|
+
handleDeleted(payload: {
|
9
|
+
endpointId: string;
|
10
|
+
endpointType: EndpointType;
|
11
|
+
}): Promise<any>;
|
12
|
+
}
|
@@ -11,21 +11,20 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.EndpointListenerController = void 0;
|
13
13
|
const common_1 = require("@nestjs/common");
|
14
|
-
const cqrs_1 = require("@nestjs/cqrs");
|
15
14
|
const microservices_1 = require("@nestjs/microservices");
|
16
|
-
const
|
15
|
+
const endpoint_event_handler_1 = require("./endpoint-event.handler");
|
17
16
|
let EndpointListenerController = class EndpointListenerController {
|
18
|
-
constructor(
|
19
|
-
this.
|
17
|
+
constructor(handler) {
|
18
|
+
this.handler = handler;
|
20
19
|
}
|
21
|
-
|
22
|
-
return this.
|
20
|
+
handleCreated(id) {
|
21
|
+
return this.handler.handleCreated(id);
|
23
22
|
}
|
24
|
-
|
25
|
-
return this.
|
23
|
+
handleUpdated(id) {
|
24
|
+
return this.handler.handleUpdated(id);
|
26
25
|
}
|
27
|
-
|
28
|
-
return this.
|
26
|
+
handleDeleted(payload) {
|
27
|
+
return this.handler.handleDeleted(payload);
|
29
28
|
}
|
30
29
|
};
|
31
30
|
exports.EndpointListenerController = EndpointListenerController;
|
@@ -34,21 +33,21 @@ __decorate([
|
|
34
33
|
__metadata("design:type", Function),
|
35
34
|
__metadata("design:paramtypes", [String]),
|
36
35
|
__metadata("design:returntype", void 0)
|
37
|
-
], EndpointListenerController.prototype, "
|
36
|
+
], EndpointListenerController.prototype, "handleCreated", null);
|
38
37
|
__decorate([
|
39
|
-
(0, microservices_1.EventPattern)('
|
38
|
+
(0, microservices_1.EventPattern)('endpoint_updated'),
|
40
39
|
__metadata("design:type", Function),
|
41
|
-
__metadata("design:paramtypes", [
|
40
|
+
__metadata("design:paramtypes", [String]),
|
42
41
|
__metadata("design:returntype", void 0)
|
43
|
-
], EndpointListenerController.prototype, "
|
42
|
+
], EndpointListenerController.prototype, "handleUpdated", null);
|
44
43
|
__decorate([
|
45
|
-
(0, microservices_1.EventPattern)('
|
44
|
+
(0, microservices_1.EventPattern)('endpoint_deleted'),
|
46
45
|
__metadata("design:type", Function),
|
47
|
-
__metadata("design:paramtypes", [
|
46
|
+
__metadata("design:paramtypes", [Object]),
|
48
47
|
__metadata("design:returntype", void 0)
|
49
|
-
], EndpointListenerController.prototype, "
|
48
|
+
], EndpointListenerController.prototype, "handleDeleted", null);
|
50
49
|
exports.EndpointListenerController = EndpointListenerController = __decorate([
|
51
50
|
(0, common_1.Controller)(),
|
52
|
-
__metadata("design:paramtypes", [
|
51
|
+
__metadata("design:paramtypes", [endpoint_event_handler_1.EndpointEventHandler])
|
53
52
|
], EndpointListenerController);
|
54
53
|
//# sourceMappingURL=endpoint-listener.controller.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"endpoint-listener.controller.js","sourceRoot":"","sources":["../../../src/endpoint-microservice/events/endpoint-listener.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yDAAqD;AAErD,qEAA+F;AAGxF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACrC,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IAE5B,aAAa,CAAC,EAAU;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAEiC,aAAa,CAAC,EAAU;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAEiC,aAAa,CAAC,OAG/C;QACC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF,CAAA;AAjBY,gEAA0B;AAGH;IAAjC,IAAA,4BAAY,EAAC,kBAAkB,CAAC;;;;+DAEhC;AAEiC;IAAjC,IAAA,4BAAY,EAAC,kBAAkB,CAAC;;;;+DAEhC;AAEiC;IAAjC,IAAA,4BAAY,EAAC,kBAAkB,CAAC;;;;+DAKhC;qCAhBU,0BAA0B;IADtC,IAAA,mBAAU,GAAE;qCAE2B,6CAAoB;GAD/C,0BAA0B,CAiBtC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { EndpointType } from '@prisma/client';
|
2
|
+
import { EndpointEventHandler } from '../../endpoint-microservice/events/endpoint-event.handler';
|
3
|
+
export declare class InProcessEndpointListener {
|
4
|
+
private readonly handler;
|
5
|
+
constructor(handler: EndpointEventHandler);
|
6
|
+
onCreate(id: string): Promise<any>;
|
7
|
+
onUpdate(id: string): Promise<any>;
|
8
|
+
onDelete(payload: {
|
9
|
+
endpointId: string;
|
10
|
+
endpointType: EndpointType;
|
11
|
+
}): Promise<any>;
|
12
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.InProcessEndpointListener = void 0;
|
13
|
+
const common_1 = require("@nestjs/common");
|
14
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
15
|
+
const endpoint_event_handler_1 = require("./endpoint-event.handler");
|
16
|
+
let InProcessEndpointListener = class InProcessEndpointListener {
|
17
|
+
constructor(handler) {
|
18
|
+
this.handler = handler;
|
19
|
+
}
|
20
|
+
onCreate(id) {
|
21
|
+
return this.handler.handleCreated(id);
|
22
|
+
}
|
23
|
+
onUpdate(id) {
|
24
|
+
return this.handler.handleUpdated(id);
|
25
|
+
}
|
26
|
+
onDelete(payload) {
|
27
|
+
return this.handler.handleDeleted(payload);
|
28
|
+
}
|
29
|
+
};
|
30
|
+
exports.InProcessEndpointListener = InProcessEndpointListener;
|
31
|
+
__decorate([
|
32
|
+
(0, event_emitter_1.OnEvent)('endpoint_created'),
|
33
|
+
__metadata("design:type", Function),
|
34
|
+
__metadata("design:paramtypes", [String]),
|
35
|
+
__metadata("design:returntype", void 0)
|
36
|
+
], InProcessEndpointListener.prototype, "onCreate", null);
|
37
|
+
__decorate([
|
38
|
+
(0, event_emitter_1.OnEvent)('endpoint_updated'),
|
39
|
+
__metadata("design:type", Function),
|
40
|
+
__metadata("design:paramtypes", [String]),
|
41
|
+
__metadata("design:returntype", void 0)
|
42
|
+
], InProcessEndpointListener.prototype, "onUpdate", null);
|
43
|
+
__decorate([
|
44
|
+
(0, event_emitter_1.OnEvent)('endpoint_deleted'),
|
45
|
+
__metadata("design:type", Function),
|
46
|
+
__metadata("design:paramtypes", [Object]),
|
47
|
+
__metadata("design:returntype", void 0)
|
48
|
+
], InProcessEndpointListener.prototype, "onDelete", null);
|
49
|
+
exports.InProcessEndpointListener = InProcessEndpointListener = __decorate([
|
50
|
+
(0, common_1.Injectable)(),
|
51
|
+
__metadata("design:paramtypes", [endpoint_event_handler_1.EndpointEventHandler])
|
52
|
+
], InProcessEndpointListener);
|
53
|
+
//# sourceMappingURL=in-process-endpoint.listener.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"in-process-endpoint.listener.js","sourceRoot":"","sources":["../../../src/endpoint-microservice/events/in-process-endpoint.listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yDAAgD;AAEhD,qEAA+F;AAGxF,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IAEjC,QAAQ,CAAC,EAAU;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAE4B,QAAQ,CAAC,EAAU;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAE4B,QAAQ,CAAC,OAGrC;QACC,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF,CAAA;AAjBY,8DAAyB;AAGP;IAA5B,IAAA,uBAAO,EAAC,kBAAkB,CAAC;;;;yDAE3B;AAE4B;IAA5B,IAAA,uBAAO,EAAC,kBAAkB,CAAC;;;;yDAE3B;AAE4B;IAA5B,IAAA,uBAAO,EAAC,kBAAkB,CAAC;;;;yDAK3B;oCAhBU,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAE2B,6CAAoB;GAD/C,yBAAyB,CAiBrC"}
|
@@ -3,7 +3,9 @@ import { GraphqlEndpointService } from '../../endpoint-microservice/graphql/grap
|
|
3
3
|
export declare class GraphqlEndpointController {
|
4
4
|
private readonly endpointService;
|
5
5
|
constructor(endpointService: GraphqlEndpointService);
|
6
|
-
get(organizationId: string, projectName: string, branchName: string, postfix: string, req: Request, res: Response
|
6
|
+
get(organizationId: string, projectName: string, branchName: string, postfix: string, req: Request, res: Response): void | Response<any, Record<string, any>>;
|
7
7
|
post(organizationId: string, projectName: string, branchName: string, postfix: string | undefined, req: Request, res: Response, next: NextFunction): void;
|
8
|
-
private
|
8
|
+
private handleRequest;
|
9
|
+
private buildExplorerUrl;
|
10
|
+
private buildExampleQuery;
|
9
11
|
}
|
@@ -21,19 +21,22 @@ let GraphqlEndpointController = class GraphqlEndpointController {
|
|
21
21
|
constructor(endpointService) {
|
22
22
|
this.endpointService = endpointService;
|
23
23
|
}
|
24
|
-
get(organizationId, projectName, branchName, postfix, req, res
|
25
|
-
this.
|
24
|
+
get(organizationId, projectName, branchName, postfix, req, res) {
|
25
|
+
const endpoint = this.endpointService.getEndpoint({
|
26
26
|
organizationId,
|
27
27
|
projectName,
|
28
28
|
branchName,
|
29
29
|
postfix,
|
30
|
-
req,
|
31
|
-
res,
|
32
|
-
next,
|
33
30
|
});
|
31
|
+
if (!endpoint) {
|
32
|
+
return res.status(common_1.HttpStatus.NOT_FOUND).send();
|
33
|
+
}
|
34
|
+
const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`;
|
35
|
+
const explorerUrl = this.buildExplorerUrl(fullUrl, endpoint.table);
|
36
|
+
return res.redirect(explorerUrl);
|
34
37
|
}
|
35
38
|
post(organizationId, projectName, branchName, postfix, req, res, next) {
|
36
|
-
this.
|
39
|
+
this.handleRequest({
|
37
40
|
organizationId,
|
38
41
|
projectName,
|
39
42
|
branchName,
|
@@ -43,12 +46,42 @@ let GraphqlEndpointController = class GraphqlEndpointController {
|
|
43
46
|
next,
|
44
47
|
});
|
45
48
|
}
|
46
|
-
|
47
|
-
const
|
48
|
-
|
49
|
+
handleRequest({ organizationId, projectName, branchName, postfix, req, res, next, }) {
|
50
|
+
const endpoint = this.endpointService.getEndpoint({
|
51
|
+
organizationId,
|
52
|
+
projectName,
|
53
|
+
branchName,
|
54
|
+
postfix,
|
55
|
+
});
|
56
|
+
if (!endpoint) {
|
49
57
|
return res.status(common_1.HttpStatus.NOT_FOUND).send();
|
50
58
|
}
|
51
|
-
|
59
|
+
endpoint.middleware(req, res, next);
|
60
|
+
}
|
61
|
+
buildExplorerUrl(endpointUrl, table) {
|
62
|
+
const url = new URL('https://studio.apollographql.com/sandbox/explorer');
|
63
|
+
url.searchParams.set('endpoint', endpointUrl);
|
64
|
+
url.searchParams.set('document', this.buildExampleQuery(table));
|
65
|
+
url.searchParams.set('headers', JSON.stringify({ 'Cache-Control': 'no-cache' }));
|
66
|
+
return url.toString();
|
67
|
+
}
|
68
|
+
buildExampleQuery(table) {
|
69
|
+
return `query ExampleQuery {
|
70
|
+
${table} {
|
71
|
+
edges {
|
72
|
+
node {
|
73
|
+
id
|
74
|
+
}
|
75
|
+
}
|
76
|
+
pageInfo {
|
77
|
+
startCursor
|
78
|
+
endCursor
|
79
|
+
hasPreviousPage
|
80
|
+
hasNextPage
|
81
|
+
}
|
82
|
+
totalCount
|
83
|
+
}
|
84
|
+
}`;
|
52
85
|
}
|
53
86
|
};
|
54
87
|
exports.GraphqlEndpointController = GraphqlEndpointController;
|
@@ -60,9 +93,8 @@ __decorate([
|
|
60
93
|
__param(3, (0, common_1.Param)('postfix')),
|
61
94
|
__param(4, (0, common_1.Req)()),
|
62
95
|
__param(5, (0, common_1.Res)()),
|
63
|
-
__param(6, (0, common_1.Next)()),
|
64
96
|
__metadata("design:type", Function),
|
65
|
-
__metadata("design:paramtypes", [String, String, String, String, Object, Object
|
97
|
+
__metadata("design:paramtypes", [String, String, String, String, Object, Object]),
|
66
98
|
__metadata("design:returntype", void 0)
|
67
99
|
], GraphqlEndpointController.prototype, "get", null);
|
68
100
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"graphql-endpoint.controller.js","sourceRoot":"","sources":["../../../src/endpoint-microservice/graphql/graphql-endpoint.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,6CAAuD;AAEvD,yEAAoG;AACpG,uFAAyG;AAOlG,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAA6B,eAAuC;QAAvC,oBAAe,GAAf,eAAe,CAAwB;IAAG,CAAC;IAGxE,GAAG,CACwB,cAAsB,EACzB,WAAmB,EACpB,UAAkB,
|
1
|
+
{"version":3,"file":"graphql-endpoint.controller.js","sourceRoot":"","sources":["../../../src/endpoint-microservice/graphql/graphql-endpoint.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,6CAAuD;AAEvD,yEAAoG;AACpG,uFAAyG;AAOlG,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAA6B,eAAuC;QAAvC,oBAAe,GAAf,eAAe,CAAwB;IAAG,CAAC;IAGxE,GAAG,CACwB,cAAsB,EACzB,WAAmB,EACpB,UAAkB,EACrB,OAAe,EAC1B,GAAY,EACZ,GAAa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yB;IALrC,IAAA,wBAAe,EAAC,iDAAsB,CAAC;IACvC,IAAA,8BAAoB,GAAE;IACtB,IAAA,mBAAU,EACT,oEAAoE,CACrE;qCAE+C,iDAAsB;GADzD,yBAAyB,CAgHrC"}
|
@@ -1,22 +1,38 @@
|
|
1
|
-
|
1
|
+
import { ApolloServer } from '@apollo/server';
|
2
2
|
import { QueryBus } from '@nestjs/cqrs';
|
3
3
|
import { RequestHandler } from 'express';
|
4
4
|
import { PrismaService } from '../../endpoint-microservice/database/prisma.service';
|
5
5
|
import { GraphqlMetricsPlugin } from '../../endpoint-microservice/metrics/graphql/graphql-metrics.plugin';
|
6
|
+
interface RouteKey {
|
7
|
+
organizationId: string;
|
8
|
+
projectName: string;
|
9
|
+
branchName: string;
|
10
|
+
postfix: string;
|
11
|
+
}
|
6
12
|
export declare class GraphqlEndpointService {
|
7
13
|
private readonly prisma;
|
8
14
|
private readonly queryBus;
|
9
15
|
private readonly graphqlMetricsPlugin;
|
10
16
|
private readonly logger;
|
11
|
-
private readonly
|
17
|
+
private readonly endpointMap;
|
12
18
|
private startedEndpointIds;
|
13
19
|
constructor(prisma: PrismaService, queryBus: QueryBus, graphqlMetricsPlugin: GraphqlMetricsPlugin);
|
14
|
-
|
20
|
+
getEndpoint(routeKey: RouteKey): {
|
21
|
+
middleware: RequestHandler;
|
22
|
+
apollo: ApolloServer;
|
23
|
+
endpointId: string;
|
24
|
+
table?: string;
|
25
|
+
};
|
15
26
|
existEndpoint(endpointId: string): boolean;
|
16
27
|
stopEndpoint(endpointId: string): Promise<void>;
|
17
28
|
runEndpoint(endpointId: string): Promise<void>;
|
18
|
-
private
|
19
|
-
private
|
20
|
-
private
|
21
|
-
private
|
29
|
+
private createApolloServerWithSchema;
|
30
|
+
private getSchemaAndDefaultTable;
|
31
|
+
private buildApolloServer;
|
32
|
+
private createMiddleware;
|
33
|
+
private getEndpointRouteKey;
|
34
|
+
private getRevisionPostfix;
|
35
|
+
private buildUrl;
|
36
|
+
private fetchDbEndpoint;
|
22
37
|
}
|
38
|
+
export {};
|
@@ -12,7 +12,6 @@ var GraphqlEndpointService_1;
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
exports.GraphqlEndpointService = void 0;
|
14
14
|
const server_1 = require("@apollo/server");
|
15
|
-
const default_1 = require("@apollo/server/plugin/landingPage/default");
|
16
15
|
const express4_1 = require("@apollo/server/express4");
|
17
16
|
const common_1 = require("@nestjs/common");
|
18
17
|
const cqrs_1 = require("@nestjs/cqrs");
|
@@ -26,106 +25,109 @@ let GraphqlEndpointService = GraphqlEndpointService_1 = class GraphqlEndpointSer
|
|
26
25
|
this.queryBus = queryBus;
|
27
26
|
this.graphqlMetricsPlugin = graphqlMetricsPlugin;
|
28
27
|
this.logger = new common_1.Logger(GraphqlEndpointService_1.name);
|
29
|
-
this.
|
28
|
+
this.endpointMap = new Map();
|
30
29
|
this.startedEndpointIds = [];
|
31
30
|
}
|
32
|
-
|
33
|
-
const
|
34
|
-
return
|
31
|
+
getEndpoint(routeKey) {
|
32
|
+
const url = this.buildUrl(routeKey);
|
33
|
+
return this.endpointMap.get(url);
|
35
34
|
}
|
36
35
|
existEndpoint(endpointId) {
|
37
36
|
return this.startedEndpointIds.includes(endpointId);
|
38
37
|
}
|
39
38
|
async stopEndpoint(endpointId) {
|
40
|
-
if (!this.
|
39
|
+
if (!this.existEndpoint(endpointId)) {
|
41
40
|
throw new Error(`${endpointId} is not started`);
|
42
41
|
}
|
43
|
-
const [url,
|
44
|
-
if (
|
45
|
-
await
|
46
|
-
this.
|
42
|
+
const [url, endpoint] = [...this.endpointMap.entries()].find(([, value]) => value.endpointId === endpointId) ?? [];
|
43
|
+
if (endpoint) {
|
44
|
+
await endpoint.apollo.stop();
|
45
|
+
this.endpointMap.delete(url);
|
46
|
+
this.startedEndpointIds = this.startedEndpointIds.filter((id) => id !== endpointId);
|
47
|
+
this.logger.log(`stopped endpoint name=${url} endpointId=${endpointId}`);
|
47
48
|
}
|
48
|
-
this.startedEndpointIds = this.startedEndpointIds.filter((id) => id !== endpointId);
|
49
|
-
this.logger.log(`stopped endpoint name=${url} endpointId=${endpointId}`);
|
50
49
|
}
|
51
50
|
async runEndpoint(endpointId) {
|
52
|
-
if (this.
|
51
|
+
if (this.existEndpoint(endpointId)) {
|
53
52
|
throw new Error(`${endpointId} already started`);
|
54
53
|
}
|
55
|
-
const dbEndpoint = await this.
|
56
|
-
const
|
57
|
-
const
|
58
|
-
const
|
54
|
+
const dbEndpoint = await this.fetchDbEndpoint(endpointId);
|
55
|
+
const revision = dbEndpoint.revision;
|
56
|
+
const branch = dbEndpoint.revision.branch;
|
57
|
+
const url = this.getEndpointRouteKey({
|
58
|
+
revision,
|
59
|
+
project: branch.project,
|
60
|
+
branchName: branch.name,
|
61
|
+
});
|
62
|
+
const { apollo, table } = await this.createApolloServerWithSchema({
|
59
63
|
projectId: branch.projectId,
|
60
64
|
projectName: branch.project.name,
|
61
65
|
endpointId,
|
62
66
|
isDraft: revision.isDraft,
|
63
67
|
revisionId: revision.id,
|
64
68
|
});
|
65
|
-
this.
|
66
|
-
|
67
|
-
middleware: (0, express4_1.expressMiddleware)(apollo, {
|
68
|
-
context: async ({ req }) => {
|
69
|
-
return { headers: (0, parseHeaders_1.parseHeaders)(req.headers) };
|
70
|
-
},
|
71
|
-
}),
|
69
|
+
this.endpointMap.set(url, {
|
70
|
+
middleware: this.createMiddleware(apollo),
|
72
71
|
apollo,
|
72
|
+
table,
|
73
73
|
endpointId,
|
74
74
|
});
|
75
|
+
this.startedEndpointIds.push(endpointId);
|
75
76
|
this.logger.log(`started endpoint name=${url} endpointId=${endpointId}`);
|
76
77
|
}
|
77
|
-
async
|
78
|
-
const
|
79
|
-
const
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
async createApolloServerWithSchema(context) {
|
79
|
+
const { schema, defaultTable } = await this.getSchemaAndDefaultTable(context);
|
80
|
+
const apollo = await this.buildApolloServer(schema);
|
81
|
+
return { apollo, table: defaultTable };
|
82
|
+
}
|
83
|
+
async getSchemaAndDefaultTable(context) {
|
84
|
+
const schema = await this.queryBus.execute(new impl_1.GetGraphqlSchemaQuery(context));
|
85
|
+
const fields = Object.keys(schema.getQueryType().getFields()).filter((name) => name !== '_service');
|
86
|
+
const defaultTable = fields[2] ?? 'Table';
|
87
|
+
return { schema, defaultTable };
|
88
|
+
}
|
89
|
+
async buildApolloServer(schema) {
|
90
|
+
const apollo = new server_1.ApolloServer({
|
91
|
+
schema,
|
83
92
|
introspection: true,
|
93
|
+
plugins: [this.graphqlMetricsPlugin],
|
84
94
|
formatError: (error) => {
|
85
95
|
if (error.extensions?.stacktrace) {
|
86
96
|
error.extensions.stacktrace = [];
|
87
97
|
}
|
88
98
|
return error;
|
89
99
|
},
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
document: `query ExampleQuery {
|
94
|
-
${table} {
|
95
|
-
edges {
|
96
|
-
node {
|
97
|
-
id
|
98
|
-
}
|
100
|
+
});
|
101
|
+
await apollo.start();
|
102
|
+
return apollo;
|
99
103
|
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
104
|
+
createMiddleware(apollo) {
|
105
|
+
return (0, express4_1.expressMiddleware)(apollo, {
|
106
|
+
context: async ({ req }) => ({
|
107
|
+
headers: (0, parseHeaders_1.parseHeaders)(req.headers),
|
108
|
+
}),
|
109
|
+
});
|
105
110
|
}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
111
|
+
getEndpointRouteKey(context) {
|
112
|
+
const postfix = this.getRevisionPostfix(context.revision);
|
113
|
+
return this.buildUrl({
|
114
|
+
organizationId: context.project.organizationId,
|
115
|
+
projectName: context.project.name,
|
116
|
+
branchName: context.branchName,
|
117
|
+
postfix,
|
112
118
|
});
|
113
|
-
await server.start();
|
114
|
-
return server;
|
115
119
|
}
|
116
|
-
|
117
|
-
if (revision.isHead)
|
120
|
+
getRevisionPostfix(revision) {
|
121
|
+
if (revision.isHead)
|
118
122
|
return 'head';
|
119
|
-
|
120
|
-
if (revision.isDraft) {
|
123
|
+
if (revision.isDraft)
|
121
124
|
return 'draft';
|
122
|
-
}
|
123
125
|
return revision.id;
|
124
126
|
}
|
125
|
-
|
127
|
+
buildUrl({ organizationId, projectName, branchName, postfix, }) {
|
126
128
|
return `${organizationId}/${projectName}/${branchName}/${postfix}`;
|
127
129
|
}
|
128
|
-
|
130
|
+
fetchDbEndpoint(endpointId) {
|
129
131
|
return this.prisma.endpoint.findUniqueOrThrow({
|
130
132
|
where: { id: endpointId },
|
131
133
|
include: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"graphql-endpoint.service.js","sourceRoot":"","sources":["../../../src/endpoint-microservice/graphql/graphql-endpoint.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA8C;AAC9C,
|
1
|
+
{"version":3,"file":"graphql-endpoint.service.js","sourceRoot":"","sources":["../../../src/endpoint-microservice/graphql/graphql-endpoint.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA8C;AAC9C,sDAA4D;AAC5D,2CAAoD;AACpD,uCAAwC;AAGxC,+DAAkF;AAClF,yCAAuF;AACvF,sFAAwG;AACxG,+DAAmF;AA+B5E,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAejC,YACmB,MAAqB,EACrB,QAAkB,EAClB,oBAA0C;QAF1C,WAAM,GAAN,MAAM,CAAe;QACrB,aAAQ,GAAR,QAAQ,CAAU;QAClB,yBAAoB,GAApB,oBAAoB,CAAsB;QAjB5C,WAAM,GAAG,IAAI,eAAM,CAAC,wBAAsB,CAAC,IAAI,CAAC,CAAC;QAEjD,gBAAW,GAAG,IAAI,GAAG,EAQnC,CAAC;QAEI,uBAAkB,GAAa,EAAE,CAAC;IAMvC,CAAC;IAEG,WAAW,CAAC,QAAkB;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpC,OAA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EAAE,OAAO,CAAC,OAAO,CAAC,cAAc;YAC9C,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;YACjC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAEO,kBAAkB,CAAC,QAI1B;QACC,IAAI,QAAQ,CAAC,MAAM;YAAE,OAAO,MAAM,CAAC;QACnC,IAAI,QAAQ,CAAC,OAAO;YAAE,OAAO,OAAO,CAAC;QACrC,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAEO,QAAQ,CAAC,EACf,cAAc,EACd,WAAW,EACX,UAAU,EACV,OAAO,GACE;QACT,OAAO,GAAG,cAAc,IAAI,WAAW,IAAI,UAAU,IAAI,OAAO,EAAE,CAAC;IACrE,CAAC;IAEO,eAAe,CAAC,UAAkB;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC;YAC5C,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE;YACzB,OAAO,EAAE;gBACP,QAAQ,EAAE;oBACR,OAAO,EAAE;wBACP,MAAM,EAAE;4BACN,OAAO,EAAE;gCACP,OAAO,EAAE,IAAI;6BACd;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AArLY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCAiBgB,8BAAa;QACX,eAAQ;QACI,6CAAoB;GAlBlD,sBAAsB,CAqLlC"}
|
package/dist/endpoint-microservice/graphql/graphql-schema-converter/graphql-schema.converter.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
/// <reference types="node" />
|
2
1
|
import { AsyncLocalStorage } from 'async_hooks';
|
3
|
-
import { GraphQLObjectType, GraphQLSchema } from 'graphql/type';
|
2
|
+
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLObjectType, GraphQLSchema } from 'graphql/type';
|
4
3
|
import { GraphQLFieldConfig } from 'graphql/type/definition';
|
5
4
|
import { RowModel } from '../../../endpoint-microservice/core-api/generated/api';
|
6
5
|
import { ProxyCoreApiService } from '../../../endpoint-microservice/core-api/proxy-core-api.service';
|
@@ -28,6 +27,10 @@ interface ValidTableType {
|
|
28
27
|
}
|
29
28
|
interface GraphQLSchemaConverterContext extends ConverterContextType {
|
30
29
|
pageInfo: GraphQLObjectType;
|
30
|
+
sortOrder: GraphQLEnumType;
|
31
|
+
listArgsMap: Record<string, GraphQLInputObjectType>;
|
32
|
+
filterTypes: Record<string, GraphQLInputObjectType>;
|
33
|
+
whereInputTypeMap: Record<string, GraphQLInputObjectType>;
|
31
34
|
nodes: Record<string, CacheNode>;
|
32
35
|
validTables: Record<string, ValidTableType>;
|
33
36
|
}
|
@@ -48,8 +51,13 @@ export declare class GraphQLSchemaConverter implements Converter<GraphQLSchema>
|
|
48
51
|
private createItemField;
|
49
52
|
private createListField;
|
50
53
|
private getListResolver;
|
54
|
+
private createListFlatField;
|
55
|
+
private getListFlatResolver;
|
56
|
+
private getFlatConnection;
|
57
|
+
private getFlatEdgeType;
|
51
58
|
private getListConnection;
|
52
59
|
private getListArgs;
|
60
|
+
private generateOrderByType;
|
53
61
|
private getEdgeType;
|
54
62
|
private buildNodeCache;
|
55
63
|
private getCachedNodeType;
|