@tstdl/base 0.78.0-beta31 → 0.78.0-beta34
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/examples/pdf/templates/hello-name.d.ts +1 -4
- package/openid-connect/oidc.service.d.ts +3 -2
- package/openid-connect/oidc.service.js +10 -2
- package/openid-connect/oidc.service.js.map +1 -1
- package/package.json +2 -2
- package/templates/providers/file-template.provider.base.d.ts +1 -1
- package/templates/providers/file-template.provider.d.ts +2 -2
- package/templates/providers/file-template.provider.js.map +1 -1
- package/templates/renderers/handlebars.template-renderer.d.ts +8 -2
- package/templates/renderers/handlebars.template-renderer.js +20 -2
- package/templates/renderers/handlebars.template-renderer.js.map +1 -1
- package/templates/template.model.d.ts +1 -0
- package/templates/template.model.js +5 -0
- package/templates/template.model.js.map +1 -1
|
@@ -4,8 +4,9 @@ import { OidcStateRepository } from './oidc-state.repository';
|
|
|
4
4
|
import type { OidcGetTokenParameters, OidcInitParameters, OidcInitResult, OidcRefreshTokenParameters, OidcToken } from './oidc.service-model';
|
|
5
5
|
export declare class OidcService<Data = any> {
|
|
6
6
|
private readonly oidcConfigurationService;
|
|
7
|
-
private readonly
|
|
8
|
-
|
|
7
|
+
private readonly maybeOidcStateRepository;
|
|
8
|
+
private get oidcStateRepository();
|
|
9
|
+
constructor(oidcConfigurationService: OidcConfigurationService, oidcStateRepository: OidcStateRepository | undefined);
|
|
9
10
|
initAuthorization({ endpoint, clientId, clientSecret, scope, expiration, data }: OidcInitParameters<Data>): Promise<OidcInitResult>;
|
|
10
11
|
getState(state: string): Promise<OidcState<Data>>;
|
|
11
12
|
deleteState(state: string): Promise<void>;
|
|
@@ -8,6 +8,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.OidcService = void 0;
|
|
13
16
|
const container_1 = require("../container");
|
|
@@ -34,7 +37,10 @@ const tokenResponseSchema = (0, schema_1.object)({
|
|
|
34
37
|
let OidcService = class OidcService {
|
|
35
38
|
constructor(oidcConfigurationService, oidcStateRepository) {
|
|
36
39
|
this.oidcConfigurationService = oidcConfigurationService;
|
|
37
|
-
this.
|
|
40
|
+
this.maybeOidcStateRepository = oidcStateRepository;
|
|
41
|
+
}
|
|
42
|
+
get oidcStateRepository() {
|
|
43
|
+
return (0, type_guards_1.assertDefinedPass)(this.maybeOidcStateRepository, 'OidcStateRepository is not provided but required.');
|
|
38
44
|
}
|
|
39
45
|
async initAuthorization({ endpoint, clientId, clientSecret, scope, expiration, data }) {
|
|
40
46
|
const oidcConfiguration = await this.oidcConfigurationService.getConfiguration(endpoint);
|
|
@@ -144,7 +150,9 @@ let OidcService = class OidcService {
|
|
|
144
150
|
};
|
|
145
151
|
OidcService = __decorate([
|
|
146
152
|
(0, container_1.singleton)(),
|
|
147
|
-
|
|
153
|
+
__param(1, (0, container_1.inject)(oidc_state_repository_1.OidcStateRepository)),
|
|
154
|
+
__param(1, (0, container_1.optional)()),
|
|
155
|
+
__metadata("design:paramtypes", [oidc_configuration_service_1.OidcConfigurationService, Object])
|
|
148
156
|
], OidcService);
|
|
149
157
|
exports.OidcService = OidcService;
|
|
150
158
|
function parseTokenResponse(response) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.service.js","sourceRoot":"","sources":["../../source/openid-connect/oidc.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oidc.service.js","sourceRoot":"","sources":["../../source/openid-connect/oidc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAA4E;AAC5E,o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IAC1B,CAAC;CACF,CAAA;AAlJY,WAAW;IADvB,IAAA,qBAAS,GAAE;IASuD,WAAA,IAAA,kBAAM,EAAC,2CAAmB,CAAC,CAAA;IAAE,WAAA,IAAA,oBAAc,GAAE,CAAA;qCAAxE,qDAAwB;GARnD,WAAW,CAkJvB;AAlJY,kCAAW;AAoJxB,SAAS,kBAAkB,CAAC,QAAc;IACxC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,eAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,2DAA2D;IAEtL,MAAM,YAAY,GAAG,IAAA,yBAAmB,EAAe,QAAQ,CAAC,CAAC;IAEjE,MAAM,KAAK,GAAc;QACvB,SAAS,EAAE,UAAU;QACrB,UAAU,EAAE,IAAA,8BAAgB,EAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI;QACnE,WAAW,EAAE,YAAY;QACzB,YAAY,EAAE,aAAa;QAC3B,GAAG,EAAE,QAAQ;KACd,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.78.0-
|
|
3
|
+
"version": "0.78.0-beta34",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@elastic/elasticsearch": "^8.2",
|
|
41
41
|
"@koa/router": "^12.0",
|
|
42
|
-
"@tstdl/angular": "^0.11.0-
|
|
42
|
+
"@tstdl/angular": "^0.11.0-beta34",
|
|
43
43
|
"chroma-js": "^2.4",
|
|
44
44
|
"got": "^12.3",
|
|
45
45
|
"handlebars": "^4.7",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "../../schema";
|
|
2
2
|
import type { TypedOmit } from "../../types";
|
|
3
3
|
import type { Template } from '../template.model';
|
|
4
|
-
export declare type FileTemplateBase = TypedOmit<
|
|
4
|
+
export declare type FileTemplateBase<T extends Template = Template> = TypedOmit<T, 'template'>;
|
|
5
5
|
export declare type FileForward<T extends FileTemplateBase, U extends FileTemplateBase> = [fileKey: keyof U, targetKey: keyof T];
|
|
6
6
|
export declare class FileTemplateProviderBase<T extends FileTemplateBase, U extends FileTemplateBase> {
|
|
7
7
|
private readonly schema;
|
|
@@ -4,7 +4,7 @@ import type { Template } from '../template.model';
|
|
|
4
4
|
import type { TemplateProvider } from '../template.provider';
|
|
5
5
|
import type { FileTemplateBase } from './file-template.provider.base';
|
|
6
6
|
import { FileTemplateProviderBase } from './file-template.provider.base';
|
|
7
|
-
export declare type FileTemplate = FileTemplateBase & {
|
|
7
|
+
export declare type FileTemplate<T extends Template = Template> = FileTemplateBase<T> & {
|
|
8
8
|
template?: string;
|
|
9
9
|
/** subject template file */
|
|
10
10
|
templateFile?: string;
|
|
@@ -19,4 +19,4 @@ export declare class FileTemplateProvider extends FileTemplateProviderBase<Templ
|
|
|
19
19
|
constructor(basePath: string);
|
|
20
20
|
}
|
|
21
21
|
export declare function configureFileTemplateProvider(config?: Partial<FileTemplateProviderConfig>): void;
|
|
22
|
-
export declare function fileTemplate<T extends
|
|
22
|
+
export declare function fileTemplate<T extends Template = Template>(template: FileTemplate<T>): FileTemplate<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-template.provider.js","sourceRoot":"","sources":["../../../source/templates/providers/file-template.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAAwE;
|
|
1
|
+
{"version":3,"file":"file-template.provider.js","sourceRoot":"","sources":["../../../source/templates/providers/file-template.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,+CAAwE;AACxE,yCAA6D;AAI7D,+EAAyE;AAe5D,QAAA,0BAA0B,GAA+B,EAAE,CAAC;AAEzE,MAAM,kBAAkB,GAAG,IAAA,eAAM,EAAe;IAC9C,IAAI,EAAE,IAAA,eAAM,GAAE;IACd,QAAQ,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,GAAE,CAAC;IAC5B,YAAY,EAAE,IAAA,iBAAQ,EAAC,IAAA,eAAM,GAAE,CAAC;IAChC,OAAO,EAAE,IAAA,iBAAQ,EAAC,IAAA,gBAAO,GAAE,CAAC;CAC7B,CAAC,CAAC;AAKI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,sDAAgD;IAGxF,YAAyB,QAAgB;QACvC,KAAK,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AANY,oBAAoB;IAHhC,IAAA,qBAAS,EAAC;QACT,uBAAuB,EAAE,GAAG,EAAE,CAAC,kCAA0B,CAAC,QAAQ;KACnE,CAAC;IAIa,WAAA,IAAA,qBAAS,GAAE,CAAA;;GAHb,oBAAoB,CAMhC;AANY,oDAAoB;AAQjC,SAAgB,6BAA6B,CAAC,SAA8C,EAAE;IAC5F,kCAA0B,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,kCAA0B,CAAC,QAAQ,CAAC;AAC/F,CAAC;AAFD,sEAEC;AAED,SAAgB,YAAY,CAAgC,QAAyB;IACnF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAFD,oCAEC"}
|
|
@@ -3,14 +3,20 @@ import * as handlebars from 'handlebars';
|
|
|
3
3
|
import type { Template } from '../template.model';
|
|
4
4
|
import type { TemplateRenderResult } from '../template.renderer';
|
|
5
5
|
import { TemplateRenderer } from '../template.renderer';
|
|
6
|
+
export declare type HandlebarsTemplateHelper = handlebars.HelperDelegate;
|
|
7
|
+
export declare type HandlebarsTemplateHelpersObject = Record<string, HandlebarsTemplateHelper>;
|
|
8
|
+
export declare type HandlebarsTemplatePartial = string | HandlebarsTemplate | handlebars.TemplateDelegate;
|
|
9
|
+
export declare type HandlebarsTemplatePartialsObject = Record<string, HandlebarsTemplatePartial>;
|
|
6
10
|
export declare type HandlebarsTemplateOptions = {
|
|
7
11
|
strict?: boolean;
|
|
8
12
|
preventIndent?: boolean;
|
|
9
|
-
helpers?:
|
|
10
|
-
partials?:
|
|
13
|
+
helpers?: HandlebarsTemplateHelpersObject;
|
|
14
|
+
partials?: HandlebarsTemplatePartialsObject;
|
|
11
15
|
};
|
|
12
16
|
export declare type HandlebarsTemplate = Template<'handlebars', HandlebarsTemplateOptions>;
|
|
13
17
|
export declare class HandlebarsTemplateRenderer extends TemplateRenderer<HandlebarsTemplate> {
|
|
14
18
|
canHandleType(type: string): boolean;
|
|
15
19
|
render(template: HandlebarsTemplate, context?: object): Promise<TemplateRenderResult>;
|
|
16
20
|
}
|
|
21
|
+
export declare function handlebarsTemplateOptions<T extends HandlebarsTemplateOptions>(options: T): T;
|
|
22
|
+
export declare function handlebarsTemplate<T extends HandlebarsTemplate = HandlebarsTemplate>(template: T): T;
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.HandlebarsTemplateRenderer = void 0;
|
|
9
|
+
exports.handlebarsTemplate = exports.handlebarsTemplateOptions = exports.HandlebarsTemplateRenderer = void 0;
|
|
10
10
|
const container_1 = require("../../container");
|
|
11
11
|
const memoize_1 = require("../../utils/function/memoize");
|
|
12
12
|
const object_1 = require("../../utils/object/object");
|
|
@@ -27,6 +27,14 @@ HandlebarsTemplateRenderer = __decorate([
|
|
|
27
27
|
(0, container_1.singleton)()
|
|
28
28
|
], HandlebarsTemplateRenderer);
|
|
29
29
|
exports.HandlebarsTemplateRenderer = HandlebarsTemplateRenderer;
|
|
30
|
+
function handlebarsTemplateOptions(options) {
|
|
31
|
+
return options;
|
|
32
|
+
}
|
|
33
|
+
exports.handlebarsTemplateOptions = handlebarsTemplateOptions;
|
|
34
|
+
function handlebarsTemplate(template) {
|
|
35
|
+
return template;
|
|
36
|
+
}
|
|
37
|
+
exports.handlebarsTemplate = handlebarsTemplate;
|
|
30
38
|
function _compileHandlebarsTemplate({ template, options = {} }) {
|
|
31
39
|
const renderer = handlebars.compile(template, {
|
|
32
40
|
strict: options.strict ?? true,
|
|
@@ -34,6 +42,16 @@ function _compileHandlebarsTemplate({ template, options = {} }) {
|
|
|
34
42
|
knownHelpers: (0, type_guards_1.isDefined)(options.helpers) ? (0, object_1.mapObjectValues)(options.helpers, () => true) : undefined,
|
|
35
43
|
knownHelpersOnly: true
|
|
36
44
|
});
|
|
37
|
-
|
|
45
|
+
const normalizedPartials = (0, type_guards_1.isDefined)(options.partials) ? (0, object_1.mapObjectValues)(options.partials, normalizePartial) : undefined;
|
|
46
|
+
return (context) => renderer(context, { helpers: options.helpers, partials: normalizedPartials });
|
|
47
|
+
}
|
|
48
|
+
function normalizePartial(partial) {
|
|
49
|
+
if ((0, type_guards_1.isString)(partial)) {
|
|
50
|
+
return compileHandlebarsTemplate({ type: 'handlebars', template: partial });
|
|
51
|
+
}
|
|
52
|
+
if ((0, type_guards_1.isFunction)(partial)) {
|
|
53
|
+
return partial;
|
|
54
|
+
}
|
|
55
|
+
return compileHandlebarsTemplate(partial);
|
|
38
56
|
}
|
|
39
57
|
//# sourceMappingURL=handlebars.template-renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlebars.template-renderer.js","sourceRoot":"","sources":["../../../source/templates/renderers/handlebars.template-renderer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAwC;AAExC,0DAAyD;AACzD,sDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"handlebars.template-renderer.js","sourceRoot":"","sources":["../../../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BAAS,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAA,wBAAe,EAAC,OAAO,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEzH,OAAO,CAAC,OAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC1G,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAkC;IAC1D,IAAI,IAAA,sBAAQ,EAAC,OAAO,CAAC,EAAE;QACrB,OAAO,yBAAyB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;KAC7E;IAED,IAAI,IAAA,wBAAU,EAAC,OAAO,CAAC,EAAE;QACvB,OAAO,OAAO,CAAC;KAChB;IAED,OAAO,yBAAyB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.model.js","sourceRoot":"","sources":["../../source/templates/template.model.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"template.model.js","sourceRoot":"","sources":["../../source/templates/template.model.ts"],"names":[],"mappings":";;;AAMA,SAAgB,QAAQ,CAAgC,QAAW;IACjE,OAAO,QAAQ,CAAC;AAClB,CAAC;AAFD,4BAEC"}
|