@rocketmakers/orbit-template-service 2.0.0-beta.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/README.md +40 -0
- package/lib/src/core/index.d.ts +2 -0
- package/lib/src/core/index.d.ts.map +1 -0
- package/lib/src/core/index.js +5 -0
- package/lib/src/core/index.js.map +1 -0
- package/lib/src/core/validation.d.ts +8 -0
- package/lib/src/core/validation.d.ts.map +1 -0
- package/lib/src/core/validation.js +20 -0
- package/lib/src/core/validation.js.map +1 -0
- package/lib/src/index.d.ts +4 -0
- package/lib/src/index.d.ts.map +1 -0
- package/lib/src/index.js +7 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/ioc/container.d.ts +13 -0
- package/lib/src/ioc/container.d.ts.map +1 -0
- package/lib/src/ioc/container.js +7 -0
- package/lib/src/ioc/container.js.map +1 -0
- package/lib/src/ioc/index.d.ts +3 -0
- package/lib/src/ioc/index.d.ts.map +1 -0
- package/lib/src/ioc/index.js +6 -0
- package/lib/src/ioc/index.js.map +1 -0
- package/lib/src/ioc/register.d.ts +2 -0
- package/lib/src/ioc/register.d.ts.map +1 -0
- package/lib/src/ioc/register.js +13 -0
- package/lib/src/ioc/register.js.map +1 -0
- package/lib/src/ioc/types.d.ts +5 -0
- package/lib/src/ioc/types.d.ts.map +1 -0
- package/lib/src/ioc/types.js +3 -0
- package/lib/src/ioc/types.js.map +1 -0
- package/lib/src/services/index.d.ts +2 -0
- package/lib/src/services/index.d.ts.map +1 -0
- package/lib/src/services/index.js +5 -0
- package/lib/src/services/index.js.map +1 -0
- package/lib/src/services/templateService.d.ts +11 -0
- package/lib/src/services/templateService.d.ts.map +1 -0
- package/lib/src/services/templateService.js +102 -0
- package/lib/src/services/templateService.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +2340 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# `@rocketmakers/orbit-template-services`
|
|
2
|
+
|
|
3
|
+
## Set of service classes required to manage templates for orbit notifications
|
|
4
|
+
|
|
5
|
+
### Implementation
|
|
6
|
+
|
|
7
|
+
When using `@rocketmakers/orbit-template-services` there are two options to register service classes with your ioc framework.
|
|
8
|
+
|
|
9
|
+
Option #1:
|
|
10
|
+
|
|
11
|
+
If you only want to register classes as needed, or inject alternative repository layers, you can bootstrap services as you would with any other class.
|
|
12
|
+
|
|
13
|
+
Option #2:
|
|
14
|
+
|
|
15
|
+
You can bootstrap template service classes using the exposed `registerTemplateServiceIoC()` function by following the steps below. This will register all service classes, using injected git http template repository classes from `@rocketmakers/orbit-template-http-repository` (you must install this as a dependency).
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// Register core types and services from @rocketmakers/orbit-core
|
|
19
|
+
registerCoreIoC();
|
|
20
|
+
|
|
21
|
+
// Register types and repository classes from @rocketmakers/orbit-template-http-repository
|
|
22
|
+
registerTemplateRepositoryIoC({ rootUrl, serviceName });
|
|
23
|
+
|
|
24
|
+
// Register template types and services from @rocketmakers/orbit-template-services
|
|
25
|
+
registerTemplateServiceIoC()();
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Docs
|
|
29
|
+
|
|
30
|
+
Hosted docs covering types, interfaces and all service class/method signatures within this package can be found using the link below:
|
|
31
|
+
|
|
32
|
+
[Documentation](https://rocketmakers.gitlab.io/microservices/orbit-packages/docs/modules/orbit_template_services.html)
|
|
33
|
+
|
|
34
|
+
### Source code
|
|
35
|
+
|
|
36
|
+
Source code for this package can be found using the link below:
|
|
37
|
+
|
|
38
|
+
[Source code](https://gitlab.com/rocketmakers/microservices/orbit-packages/-/tree/develop/packages/template/orbit-template-services)
|
|
39
|
+
|
|
40
|
+
Contributing docs can be found in the [README.md](https://gitlab.com/rocketmakers/microservices/orbit-packages/-/blob/develop/README.md)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LayoutId } from '@rocketmakers/orbit-template-core';
|
|
2
|
+
export declare namespace Validation {
|
|
3
|
+
function renderLayoutTemplates<TPayload>(layoutId: LayoutId, payload: TPayload): Promise<{
|
|
4
|
+
validatedLayoutId: import("@rocketmakers/orbit-core").OpaqueString<"LayoutId">;
|
|
5
|
+
providedPayload: unknown;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/core/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAM7D,yBAAiB,UAAU,CAAC;IAC1B,SAAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ;;;OAK1F;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Validation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
6
|
+
const validateLayoutId = orbit_core_1.CommonValidators.opaque(true).minLength(1).build();
|
|
7
|
+
const validatePayloadExists = orbit_core_1.CommonValidators.objectMandatory({}, { ignoreExtraKeys: true }).build();
|
|
8
|
+
var Validation;
|
|
9
|
+
(function (Validation) {
|
|
10
|
+
function renderLayoutTemplates(layoutId, payload) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
return {
|
|
13
|
+
validatedLayoutId: yield orbit_core_1.validate(validateLayoutId, layoutId),
|
|
14
|
+
providedPayload: yield orbit_core_1.validate(validatePayloadExists, payload),
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
Validation.renderLayoutTemplates = renderLayoutTemplates;
|
|
19
|
+
})(Validation = exports.Validation || (exports.Validation = {}));
|
|
20
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/core/validation.ts"],"names":[],"mappings":";;;;AACA,yDAAsE;AAEtE,MAAM,gBAAgB,GAAG,6BAAgB,CAAC,MAAM,CAAW,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AACtF,MAAM,qBAAqB,GAAG,6BAAgB,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;AAEtG,IAAiB,UAAU,CAO1B;AAPD,WAAiB,UAAU;IACzB,SAAsB,qBAAqB,CAAW,QAAkB,EAAE,OAAiB;;YACzF,OAAO;gBACL,iBAAiB,EAAE,MAAM,qBAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC;gBAC7D,eAAe,EAAE,MAAM,qBAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;aAChE,CAAC;QACJ,CAAC;KAAA;IALqB,gCAAqB,wBAK1C,CAAA;AACH,CAAC,EAPgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAO1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC"}
|
package/lib/src/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./core"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./ioc"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./services"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAIA,iDAAuB;AACvB,gDAAsB;AACtB,qDAA2B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IRepositoryContainerTypes } from '@rocketmakers/orbit-template-core';
|
|
2
|
+
import { ITemplateServicesContainerTypes } from './types';
|
|
3
|
+
export declare const register: {
|
|
4
|
+
function<K extends never>(key: K, item: ITemplateServicesContainerTypes[K] | import("@rocketmakers/ioc").IFunctionResolver<ITemplateServicesContainerTypes[K]>): void;
|
|
5
|
+
constant<K_1 extends "templateService">(key: K_1, item: ITemplateServicesContainerTypes[K_1]): void;
|
|
6
|
+
class<K_2 extends "templateService", C extends new (...args: any) => ITemplateServicesContainerTypes[K_2]>(key: K_2, cls: C): {
|
|
7
|
+
construct<TK = ITemplateServicesContainerTypes>(keys: { [K_3 in keyof ConstructorParameters<C>]: ConstructorParameters<C>[K_3] extends ConstructorParameters<C>[number] ? import("@rocketmakers/ioc").PropsOfType<TK, ConstructorParameters<C>[K_3]> : never; }): import("@rocketmakers/ioc").BindingInWhenOnSyntax<InstanceType<C>>;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const container: {
|
|
11
|
+
get<K extends "templateService" | "rootUrl" | "serviceName" | "logger" | "templateRepository">(key: K): (ITemplateServicesContainerTypes & IRepositoryContainerTypes)[K];
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/ioc/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE1D,eAAO,MAAM,QAAQ;;;;;;CAAuD,CAAC;AAE7E,eAAO,MAAM,SAAS;;CAAkF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.container = exports.register = void 0;
|
|
4
|
+
const ioc_1 = require("@rocketmakers/ioc");
|
|
5
|
+
exports.register = ioc_1.containerRegister();
|
|
6
|
+
exports.container = ioc_1.containerFactory();
|
|
7
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../../src/ioc/container.ts"],"names":[],"mappings":";;;AACA,2CAAwE;AAG3D,QAAA,QAAQ,GAAG,uBAAiB,EAAmC,CAAC;AAEhE,QAAA,SAAS,GAAG,sBAAgB,EAA+D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ioc/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ioc/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,kDAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/ioc/register.ts"],"names":[],"mappings":"AAIA,wBAAgB,0BAA0B,SAKzC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerTemplateServiceIoC = void 0;
|
|
4
|
+
const services_1 = require("../services");
|
|
5
|
+
const container_1 = require("./container");
|
|
6
|
+
function registerTemplateServiceIoC() {
|
|
7
|
+
container_1.register
|
|
8
|
+
.class('templateService', services_1.TemplateService)
|
|
9
|
+
.construct(['templateRepository'])
|
|
10
|
+
.inSingletonScope();
|
|
11
|
+
}
|
|
12
|
+
exports.registerTemplateServiceIoC = registerTemplateServiceIoC;
|
|
13
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/ioc/register.ts"],"names":[],"mappings":";;;AACA,0CAA8C;AAC9C,2CAAuC;AAEvC,SAAgB,0BAA0B;IACxC,oBAAQ;SACL,KAAK,CAAC,iBAAiB,EAAE,0BAAe,CAAC;SACzC,SAAS,CAA4B,CAAC,oBAAoB,CAAC,CAAC;SAC5D,gBAAgB,EAAE,CAAC;AACxB,CAAC;AALD,gEAKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ioc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,+BAA+B;IAE9C,eAAe,EAAE,eAAe,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ioc/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CompiledTemplate, ICache, ITemplateRepository, LayoutId } from '@rocketmakers/orbit-template-core';
|
|
2
|
+
export declare class TemplateService {
|
|
3
|
+
private templateRepository;
|
|
4
|
+
constructor(templateRepository: ITemplateRepository);
|
|
5
|
+
private cache;
|
|
6
|
+
getCache(): Promise<ICache | undefined>;
|
|
7
|
+
initCache(): Promise<ICache>;
|
|
8
|
+
updateCache(): Promise<ICache>;
|
|
9
|
+
renderLayoutTemplates<TPayload>(layoutId: LayoutId, payload: TPayload): Promise<CompiledTemplate[]>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=templateService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateService.d.ts","sourceRoot":"","sources":["../../../src/services/templateService.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,mBAAmB,EACnB,QAAQ,EAET,MAAM,mCAAmC,CAAC;AAS3C,qBAAa,eAAe;IAEd,OAAO,CAAC,kBAAkB;gBAAlB,kBAAkB,EAAE,mBAAmB;IAE3D,OAAO,CAAC,KAAK,CAAmB;IAMnB,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAcvC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAkC5B,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAkC9B,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAyCjH"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const handlebars = require("handlebars");
|
|
6
|
+
const Ajv = require("ajv");
|
|
7
|
+
const orbit_core_1 = require("@rocketmakers/orbit-core");
|
|
8
|
+
const core_1 = require("../core");
|
|
9
|
+
class TemplateService {
|
|
10
|
+
constructor(templateRepository) {
|
|
11
|
+
this.templateRepository = templateRepository;
|
|
12
|
+
}
|
|
13
|
+
getCache() {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const currentCache = yield this.cache;
|
|
16
|
+
if (currentCache) {
|
|
17
|
+
return currentCache;
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
initCache() {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
if (this.cache) {
|
|
25
|
+
return this.cache;
|
|
26
|
+
}
|
|
27
|
+
const updateFunctions = [];
|
|
28
|
+
const { partials, layouts } = yield this.templateRepository.getInitialCache();
|
|
29
|
+
this.cache = new Promise((resolve) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
for (const partial in partials) {
|
|
31
|
+
updateFunctions.push(() => handlebars.registerPartial(partial, partials[partial]));
|
|
32
|
+
}
|
|
33
|
+
for (const layout in layouts) {
|
|
34
|
+
layouts[layout].forEach(template => {
|
|
35
|
+
updateFunctions.push(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
handlebars.precompile(template.content, { strict: true });
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
yield updateFunctions.forEach(fn => fn());
|
|
41
|
+
resolve({ partials, layouts });
|
|
42
|
+
}));
|
|
43
|
+
return this.cache;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
updateCache() {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const updateFunctions = [];
|
|
49
|
+
const currentCache = yield this.cache;
|
|
50
|
+
this.cache = new Promise((resolve) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const { partials, layouts } = yield this.templateRepository.getUpdatedCache(currentCache);
|
|
52
|
+
for (const partial in partials) {
|
|
53
|
+
updateFunctions.push(() => handlebars.registerPartial(partial, partials[partial]));
|
|
54
|
+
}
|
|
55
|
+
for (const layout in layouts) {
|
|
56
|
+
layouts[layout].forEach(template => {
|
|
57
|
+
updateFunctions.push(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
handlebars.precompile(template.content, { strict: true });
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
yield updateFunctions.forEach(fn => fn());
|
|
63
|
+
resolve({ partials, layouts });
|
|
64
|
+
}));
|
|
65
|
+
return this.cache;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
renderLayoutTemplates(layoutId, payload) {
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const { validatedLayoutId } = yield core_1.Validation.renderLayoutTemplates(layoutId, payload);
|
|
71
|
+
const schema = yield this.templateRepository.getPayloadSchema(validatedLayoutId);
|
|
72
|
+
if (schema) {
|
|
73
|
+
const ajv = new Ajv({ allErrors: true, verbose: true });
|
|
74
|
+
const valid = ajv.validate(schema, payload);
|
|
75
|
+
if (!valid && ajv.errors) {
|
|
76
|
+
const { errors } = ajv;
|
|
77
|
+
const validationErrors = errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
78
|
+
return { path: e.dataPath, value: e.params, messages: { developer: e.message ? e.message : '' } };
|
|
79
|
+
});
|
|
80
|
+
throw new orbit_core_1.ValidationError(validationErrors, 'Payload does not match schema retrieved from template repository');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const currentCache = yield this.cache;
|
|
84
|
+
if (!currentCache.layouts[validatedLayoutId]) {
|
|
85
|
+
throw new orbit_core_1.NotFoundError(`No layout found matching id: ${validatedLayoutId}`);
|
|
86
|
+
}
|
|
87
|
+
const res = currentCache.layouts[validatedLayoutId].map(template => {
|
|
88
|
+
const compile = handlebars.compile(template.content, { strict: true });
|
|
89
|
+
try {
|
|
90
|
+
return { name: template.type, compiled: compile(payload) };
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
console.error(error);
|
|
94
|
+
throw new orbit_core_1.BadRequestError('Provided payload did not successfully compile using target template', error.message);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return res;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.TemplateService = TemplateService;
|
|
102
|
+
//# sourceMappingURL=templateService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateService.js","sourceRoot":"","sources":["../../../src/services/templateService.ts"],"names":[],"mappings":";;;;AAQA,yCAAyC;AACzC,2BAA2B;AAC3B,yDAA2F;AAC3F,kCAAqC;AAKrC,MAAa,eAAe;IAE1B,YAAoB,kBAAuC;QAAvC,uBAAkB,GAAlB,kBAAkB,CAAqB;IAAG,CAAC;IAQlD,QAAQ;;YACnB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC;YAEtC,IAAI,YAAY,EAAE;gBAChB,OAAO,YAAY,CAAC;aACrB;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;KAAA;IAMY,SAAS;;YACpB,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,OAAO,IAAI,CAAC,KAAK,CAAC;aACnB;YAED,MAAM,eAAe,GAAqB,EAAE,CAAC;YAE7C,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;YAE9E,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,CAAM,OAAO,EAAC,EAAE;gBACvC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;oBAC9B,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACpF;gBAED,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;oBAC5B,OAAO,CAAC,MA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