@tstdl/base 0.78.0-beta70 → 0.78.0-beta71

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.
@@ -1,9 +1,11 @@
1
1
  import type { InjectableOptionsWithoutLifecycle } from "../../container";
2
2
  import type { Constructor, Type } from "../../types";
3
3
  import type { ApiController, ApiDefinition } from '../types';
4
+ declare type ApiDefinitionProvider = () => ApiDefinition;
4
5
  export declare const apiControllerDefinition: unique symbol;
5
6
  export declare function getApiControllerDefinition(controller: Type): ApiDefinition;
6
7
  export declare function isApiController(controller: Type): boolean;
7
8
  export declare function ensureApiController(controller: Type): void;
8
- export declare function apiController<T = Type<ApiController>, P = any>(definition: ApiDefinition, injectableOptions?: InjectableOptionsWithoutLifecycle<T, P>): ClassDecorator;
9
+ export declare function apiController<T = Type<ApiController>, A = any>(definition: ApiDefinition | ApiDefinitionProvider, injectableOptions?: InjectableOptionsWithoutLifecycle<T, A>): ClassDecorator;
9
10
  export declare function implementApi<T extends ApiDefinition>(definition: T, implementation: ApiController<T>): Constructor<ApiController<T>>;
11
+ export {};
@@ -2,11 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.implementApi = exports.apiController = exports.ensureApiController = exports.isApiController = exports.getApiControllerDefinition = exports.apiControllerDefinition = void 0;
4
4
  const container_1 = require("../../container");
5
+ const type_guards_1 = require("../../utils/type-guards");
5
6
  exports.apiControllerDefinition = Symbol('ApiController definition');
6
7
  const registeredApiControllers = new Map();
7
8
  function getApiControllerDefinition(controller) {
8
9
  ensureApiController(controller);
9
- return registeredApiControllers.get(controller);
10
+ const definitionOrProvider = registeredApiControllers.get(controller);
11
+ if ((0, type_guards_1.isFunction)(definitionOrProvider)) {
12
+ return definitionOrProvider();
13
+ }
14
+ return definitionOrProvider;
10
15
  }
11
16
  exports.getApiControllerDefinition = getApiControllerDefinition;
12
17
  function isApiController(controller) {
@@ -1 +1 @@
1
- {"version":3,"file":"api-controller.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ger";
2
2
  import type { Module } from "../module";
3
3
  import type { FunctionModuleFunction } from "../module/modules";
4
4
  import type { OneOrMany, Type } from "../types";
5
- import type { CancellationToken } from "../utils/cancellation-token";
5
+ import type { ReadonlyCancellationToken } from "../utils/cancellation-token";
6
6
  export declare class Application {
7
7
  private static _instance;
8
8
  private static get instance();
@@ -10,14 +10,22 @@ export declare class Application {
10
10
  private readonly moduleTypes;
11
11
  private readonly moduleInstances;
12
12
  private readonly shutdownPromise;
13
- static get shutdownToken(): CancellationToken;
13
+ private readonly _shutdownToken;
14
+ readonly shutdownToken: ReadonlyCancellationToken;
15
+ static get shutdownToken(): ReadonlyCancellationToken;
14
16
  constructor(logger: Logger);
15
17
  static registerModule(moduleType: Type<Module>): void;
18
+ static registerModuleFunction(fn: FunctionModuleFunction): void;
16
19
  static registerModuleInstance(module: Module): void;
17
- static run(...functions: OneOrMany<FunctionModuleFunction>[]): Promise<void>;
20
+ static run(...functionsAndModules: OneOrMany<FunctionModuleFunction | Type<Module>>[]): Promise<void>;
18
21
  static shutdown(): Promise<void>;
22
+ static requestShutdown(): void;
19
23
  registerModule(moduleType: Type<Module>): void;
24
+ registerModuleFunction(fn: FunctionModuleFunction): void;
20
25
  registerModuleInstance(module: Module): void;
21
- run(...functions: OneOrMany<FunctionModuleFunction>[]): Promise<void>;
26
+ run(...functionsAndModules: OneOrMany<FunctionModuleFunction | Type<Module>>[]): Promise<void>;
22
27
  shutdown(): Promise<void>;
28
+ requestShutdown(): void;
29
+ private runModules;
30
+ private stopModules;
23
31
  }
@@ -23,6 +23,12 @@ const process_shutdown_1 = require("../process-shutdown");
23
23
  const promise_1 = require("../promise");
24
24
  const async_iterable_helpers_1 = require("../utils/async-iterable-helpers");
25
25
  const type_guards_1 = require("../utils/type-guards");
26
+ /**
27
+ * TODO
28
+ *
29
+ * container scopes
30
+ * dispose per container
31
+ */
26
32
  (0, process_shutdown_1.initializeSignals)();
27
33
  let Application = Application_1 = class Application {
28
34
  constructor(logger) {
@@ -30,6 +36,8 @@ let Application = Application_1 = class Application {
30
36
  this.moduleTypes = new Set();
31
37
  this.moduleInstances = new Set();
32
38
  this.shutdownPromise = new promise_1.DeferredPromise();
39
+ this._shutdownToken = process_shutdown_1.shutdownToken.createChild();
40
+ this.shutdownToken = this._shutdownToken.asReadonly;
33
41
  }
34
42
  static get instance() {
35
43
  if ((0, type_guards_1.isUndefined)(this._instance)) {
@@ -38,55 +46,105 @@ let Application = Application_1 = class Application {
38
46
  return this._instance;
39
47
  }
40
48
  static get shutdownToken() {
41
- return process_shutdown_1.shutdownToken;
49
+ return Application_1.instance.shutdownToken;
42
50
  }
43
51
  static registerModule(moduleType) {
44
52
  Application_1.instance.registerModule(moduleType);
45
53
  }
54
+ static registerModuleFunction(fn) {
55
+ Application_1.instance.registerModuleFunction(fn);
56
+ }
46
57
  static registerModuleInstance(module) {
47
58
  Application_1.instance.registerModuleInstance(module);
48
59
  }
49
- static async run(...functions) {
50
- await Application_1.instance.run(...functions);
60
+ static async run(...functionsAndModules) {
61
+ await Application_1.instance.run(...functionsAndModules);
51
62
  }
52
63
  static async shutdown() {
53
64
  await Application_1.instance.shutdown();
54
65
  }
66
+ static requestShutdown() {
67
+ Application_1.instance.requestShutdown();
68
+ }
55
69
  registerModule(moduleType) {
56
70
  this.moduleTypes.add(moduleType);
57
71
  }
72
+ registerModuleFunction(fn) {
73
+ const module = new modules_1.FunctionModule(fn);
74
+ this.registerModuleInstance(module);
75
+ }
58
76
  registerModuleInstance(module) {
59
77
  this.moduleInstances.add(module);
60
78
  }
61
- async run(...functions) {
62
- for (const fn of functions.flatMap((fns) => fns)) {
63
- const module = new modules_1.FunctionModule(fn);
64
- this.registerModuleInstance(module);
79
+ async run(...functionsAndModules) {
80
+ for (const fnOrModule of functionsAndModules.flatMap((fns) => fns)) {
81
+ if (fnOrModule.prototype instanceof module_1.ModuleBase) {
82
+ this.registerModule(fnOrModule);
83
+ }
84
+ else {
85
+ this.registerModuleFunction(fnOrModule);
86
+ }
65
87
  }
66
88
  const resolvedModules = await (0, async_iterable_helpers_1.toArrayAsync)((0, async_iterable_helpers_1.mapAsync)(this.moduleTypes, async (type) => container_1.container.resolveAsync(type)));
67
- const modules = [...resolvedModules, ...this.moduleInstances];
89
+ const modules = [...this.moduleInstances, ...resolvedModules];
68
90
  try {
69
91
  await Promise.race([
70
- runModules(modules, this.logger),
71
- process_shutdown_1.shutdownToken
92
+ this.runModules(modules),
93
+ this.shutdownToken
72
94
  ]);
73
95
  }
74
96
  catch (error) {
75
97
  this.logger.error(error, { includeRest: true, includeStack: true });
76
98
  }
77
99
  finally {
78
- (0, process_shutdown_1.requestShutdown)();
79
- await stopModules(modules, this.logger);
100
+ this.requestShutdown();
101
+ this.logger.info('Shutting down');
102
+ await this.stopModules(modules);
80
103
  await (0, core_1.disposeInstances)();
81
104
  this.logger.info('Bye');
82
105
  }
83
106
  this.shutdownPromise.resolve();
84
107
  }
85
108
  async shutdown() {
86
- this.logger.info('Shutting down');
87
- (0, process_shutdown_1.requestShutdown)();
109
+ this.requestShutdown();
88
110
  await this.shutdownPromise;
89
111
  }
112
+ requestShutdown() {
113
+ if (this.shutdownToken.isSet) {
114
+ return;
115
+ }
116
+ this._shutdownToken.set();
117
+ }
118
+ async runModules(modules) {
119
+ const promises = modules.map(async (module) => {
120
+ try {
121
+ this.logger.info(`Starting module ${module.name}`);
122
+ await module.run();
123
+ this.logger.info(`Module ${module.name} stopped.`);
124
+ }
125
+ catch (error) {
126
+ this.logger.error(error);
127
+ this.requestShutdown();
128
+ }
129
+ });
130
+ await Promise.all(promises);
131
+ }
132
+ async stopModules(modules) {
133
+ const promises = modules.map(async (module) => {
134
+ if (module.state == module_1.ModuleState.Stopped) {
135
+ return;
136
+ }
137
+ this.logger.info(`Stopping module ${module.name}`);
138
+ try {
139
+ await module.stop();
140
+ }
141
+ catch (error) {
142
+ this.logger.error(error);
143
+ this.requestShutdown();
144
+ }
145
+ });
146
+ await Promise.all(promises);
147
+ }
90
148
  };
91
149
  Application = Application_1 = __decorate([
92
150
  (0, container_1.singleton)(),
@@ -94,31 +152,4 @@ Application = Application_1 = __decorate([
94
152
  __metadata("design:paramtypes", [logger_1.Logger])
95
153
  ], Application);
96
154
  exports.Application = Application;
97
- async function runModules(modules, logger) {
98
- const promises = modules.map(async (module) => {
99
- if (logger != undefined) {
100
- logger.verbose(`Starting module ${module.name}`);
101
- }
102
- await module.run();
103
- });
104
- await Promise.all(promises);
105
- }
106
- async function stopModules(modules, logger) {
107
- const promises = modules.map(async (module) => {
108
- if (module.state == module_1.ModuleState.Stopped) {
109
- if (logger != undefined) {
110
- logger.verbose(`Module ${module.name} already stopped`);
111
- }
112
- return;
113
- }
114
- if (logger != undefined) {
115
- logger.verbose(`Stopping module ${module.name}`);
116
- }
117
- await module.stop();
118
- if (logger != undefined) {
119
- logger.verbose(`Stopped module ${module.name}`);
120
- }
121
- });
122
- await Promise.all(promises);
123
- }
124
155
  //# sourceMappingURL=application.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"application.js","sourceRoot":"","sources":["../../source/application/application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA+D;AAC/D,kCAA0C;AAE1C,sCAAkC;AAElC,sCAAuC;AAEvC,+CAAkD;AAClD,0DAAuF;AACvF,wCAA4C;AAE5C,4EAAwE;AAExE,sDAAkD;AAElD,IAAA,oCAAiB,GAAE,CAAC;AAGb,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAoBtB,YAA+C,MAAc;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,IAAI,yBAAe,EAAE,CAAC;IAC/C,CAAC;IAvBO,MAAM,KAAK,QAAQ;QACzB,IAAI,IAAA,yBAAW,EAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YAC/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AM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAC5C,IAAI,MAAM,CAAC,KAAK,IAAI,oBAAW,CAAC,OAAO,EAAE;gBACvC,OAAO;aACR;YAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAEnD,IAAI;gBACF,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;aACrB;YACD,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAc,CAAC,CAAC;gBAClC,IAAI,CAAC,eAAe,EAAE,CAAC;aACxB;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF,CAAA;AA1JY,WAAW;IADvB,IAAA,qBAAS,GAAE;IAwBG,WAAA,IAAA,sBAAU,EAAiB,KAAK,CAAC,CAAA;qCAAS,eAAM;GAvBlD,WAAW,CA0JvB;AA1JY,kCAAW"}
package/core.js CHANGED
@@ -6,7 +6,7 @@ const disposable_1 = require("./disposable");
6
6
  const logger_1 = require("./logger");
7
7
  const console_1 = require("./logger/console");
8
8
  const timing_1 = require("./utils/timing");
9
- let coreLogPrefix = 'CORE';
9
+ let coreLogPrefix = 'Core';
10
10
  let logLevel = logger_1.LogLevel.Debug;
11
11
  let loggerToken = console_1.ConsoleLogger;
12
12
  exports.CORE_LOGGER = (0, container_1.injectionToken)('CORE_LOGGER');
@@ -62,7 +62,7 @@ let NodeHttpServer = NodeHttpServer_1 = class NodeHttpServer extends http_server
62
62
  let listeningListener;
63
63
  let errorListener; // eslint-disable-line prefer-const
64
64
  listeningListener = () => {
65
- this.logger.info(`listening on port ${port}`);
65
+ this.logger.info(`Listening on port ${port}`);
66
66
  this.untrackConnectedSockets = trackConnectedSockets(this.httpServer, this.sockets);
67
67
  this.httpServer.removeListener('error', errorListener);
68
68
  resolve();
@@ -76,7 +76,7 @@ let NodeHttpServer = NodeHttpServer_1 = class NodeHttpServer extends http_server
76
76
  });
77
77
  }
78
78
  async close(timeout) {
79
- this.logger.info('closing http server');
79
+ this.logger.info('Closing http server');
80
80
  const timer = new timer_1.Timer(true);
81
81
  const close$ = (0, rxjs_1.bindNodeCallback)(this.httpServer.close.bind(this.httpServer))().pipe((0, rxjs_1.share)());
82
82
  close$.subscribe();
@@ -86,12 +86,12 @@ let NodeHttpServer = NodeHttpServer_1 = class NodeHttpServer extends http_server
86
86
  break;
87
87
  }
88
88
  if (timer.milliseconds >= timeout) {
89
- this.logger.info(`force closing of ${connections} remaining sockets after waiting for ${timeout} milliseconds`);
89
+ this.logger.info(`Force closing of ${connections} remaining sockets after waiting for ${timeout} milliseconds`);
90
90
  destroySockets(this.sockets);
91
91
  break;
92
92
  }
93
93
  if (connections > 0) {
94
- this.logger.info(`waiting for ${connections} connections to end`);
94
+ this.logger.info(`Waiting for ${connections} connections to end`);
95
95
  await (0, timing_1.cancelableTimeout)(250, cancellation_token_1.CancellationToken.fromObservable(close$));
96
96
  }
97
97
  }
@@ -0,0 +1,20 @@
1
+ import type { ApiServerResult } from "../api";
2
+ import { Notification } from './model';
3
+ declare const notificationApiDefinition: {
4
+ readonly resource: string;
5
+ endpoints: {
6
+ get: {
7
+ parameters: import("../schema").ObjectSchema<{
8
+ for: string;
9
+ }, {
10
+ for: string;
11
+ }>;
12
+ result: import("../schema").ValueSchema<any, Notification[]>;
13
+ };
14
+ };
15
+ };
16
+ declare type NotificationApiDefinition = typeof notificationApiDefinition;
17
+ export declare class NotificationApi {
18
+ get(): Promise<ApiServerResult<NotificationApiDefinition, 'get'>>;
19
+ }
20
+ export {};
@@ -0,0 +1,35 @@
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.NotificationApi = void 0;
10
+ const api_1 = require("../api");
11
+ const server_1 = require("../api/server");
12
+ const schema_1 = require("../schema");
13
+ const model_1 = require("./model");
14
+ const module_1 = require("./module");
15
+ const notificationApiDefinition = (0, api_1.defineApi)({
16
+ get resource() { return module_1.notificationModuleConfig.apiResource; },
17
+ endpoints: {
18
+ get: {
19
+ parameters: (0, schema_1.object)({
20
+ for: (0, schema_1.string)()
21
+ }),
22
+ result: (0, schema_1.array)(model_1.Notification)
23
+ }
24
+ }
25
+ });
26
+ let NotificationApi = class NotificationApi {
27
+ async get() {
28
+ return [];
29
+ }
30
+ };
31
+ NotificationApi = __decorate([
32
+ (0, server_1.apiController)(notificationApiDefinition)
33
+ ], NotificationApi);
34
+ exports.NotificationApi = NotificationApi;
35
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../source/notification/api.ts"],"names":[],"mappings":";;;;;;;;;AACA,gCAAkC;AAClC,0CAA6C;AAC7C,sCAAiD;AACjD,mCAAuC;AACvC,qCAAoD;AAEpD,MAAM,yBAAyB,GAAG,IAAA,eAAS,EAAC;IAC1C,IAAI,QAAQ,KAAK,OAAO,iCAAwB,CAAC,WAAW,CAAC,CAAC,CAAC;IAC/D,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,IAAA,eAAM,EAAC;gBACjB,GAAG,EAAE,IAAA,eAAM,GAAE;aACd,CAAC;YACF,MAAM,EAAE,IAAA,cAAK,EAAC,oBAAY,CAAC;SAC5B;KACF;CACF,CAAC,CAAC;AAMI,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,KAAK,CAAC,GAAG;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAA;AAJY,eAAe;IAD3B,IAAA,sBAAa,EAAC,yBAAyB,CAAC;GAC5B,eAAe,CAI3B;AAJY,0CAAe"}
@@ -0,0 +1,18 @@
1
+ export declare class Notification {
2
+ /**
3
+ *
4
+ */
5
+ for: string;
6
+ /**
7
+ * Timestamp at which the notification was created.
8
+ */
9
+ timestamp: number;
10
+ /**
11
+ * Timestamp at which the notification was marked as read.
12
+ */
13
+ read: number | null;
14
+ /**
15
+ * Custom data.
16
+ */
17
+ data: any;
18
+ }
@@ -0,0 +1,36 @@
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.Notification = void 0;
13
+ const schema_1 = require("../schema");
14
+ let Notification = class Notification {
15
+ };
16
+ __decorate([
17
+ (0, schema_1.Property)(),
18
+ __metadata("design:type", String)
19
+ ], Notification.prototype, "for", void 0);
20
+ __decorate([
21
+ (0, schema_1.Property)(),
22
+ __metadata("design:type", Number)
23
+ ], Notification.prototype, "timestamp", void 0);
24
+ __decorate([
25
+ (0, schema_1.Property)(),
26
+ __metadata("design:type", Object)
27
+ ], Notification.prototype, "read", void 0);
28
+ __decorate([
29
+ (0, schema_1.Any)(),
30
+ __metadata("design:type", Object)
31
+ ], Notification.prototype, "data", void 0);
32
+ Notification = __decorate([
33
+ (0, schema_1.Type)()
34
+ ], Notification);
35
+ exports.Notification = Notification;
36
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../source/notification/model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAA+C;AAGxC,IAAM,YAAY,GAAlB,MAAM,YAAY;CAwBxB,CAAA;AApBC;IAAC,IAAA,iBAAQ,GAAE;;yCACC;AAKZ;IAAC,IAAA,iBAAQ,GAAE;;+CACO;AAKlB;IAAC,IAAA,iBAAQ,GAAE;;0CACS;AAKpB;IAAC,IAAA,YAAG,GAAE;;0CACI;AAvBC,YAAY;IADxB,IAAA,aAAI,GAAE;GACM,YAAY,CAwBxB;AAxBY,oCAAY"}
@@ -0,0 +1,9 @@
1
+ export declare type NotificationModuleConfig = {
2
+ apiResource: string;
3
+ };
4
+ export declare const notificationModuleConfig: NotificationModuleConfig;
5
+ /**
6
+ * Configure notifiation module.
7
+ * @param config configuration
8
+ */
9
+ export declare function configureNotification(config: Partial<NotificationModuleConfig>): void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureNotification = exports.notificationModuleConfig = void 0;
4
+ exports.notificationModuleConfig = {
5
+ apiResource: 'notifications'
6
+ };
7
+ /**
8
+ * Configure notifiation module.
9
+ * @param config configuration
10
+ */
11
+ function configureNotification(config) {
12
+ exports.notificationModuleConfig.apiResource = config.apiResource ?? exports.notificationModuleConfig.apiResource;
13
+ }
14
+ exports.configureNotification = configureNotification;
15
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../source/notification/module.ts"],"names":[],"mappings":";;;AAIa,QAAA,wBAAwB,GAA6B;IAChE,WAAW,EAAE,eAAe;CAC7B,CAAC;AAEF;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,MAAyC;IAC7E,gCAAwB,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,gCAAwB,CAAC,WAAW,CAAC;AACpG,CAAC;AAFD,sDAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.78.0-beta70",
3
+ "version": "0.78.0-beta71",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,7 +39,7 @@
39
39
  "peerDependencies": {
40
40
  "@elastic/elasticsearch": "^8.4",
41
41
  "@koa/router": "^12.0",
42
- "@tstdl/angular": "^0.11.0-beta70",
42
+ "@tstdl/angular": "^0.11.0-beta71",
43
43
  "chroma-js": "^2.4",
44
44
  "got": "^12.5",
45
45
  "handlebars": "^4.7",
@@ -1,80 +1,80 @@
1
1
  import type { Observable, Observer, Subscribable, Subscription } from 'rxjs';
2
2
  export declare type ConnectConfig = {
3
3
  /**
4
- * propagate parent set to child
4
+ * Propagate parent set to child.
5
5
  * @default true
6
6
  */
7
7
  set?: boolean;
8
8
  /**
9
- * propagate unset to child
9
+ * Propagate unset to child.
10
10
  * @default true
11
11
  */
12
12
  unset?: boolean;
13
13
  /**
14
- * propagate complete to child
14
+ * Propagate complete to child.
15
15
  * @default true
16
16
  */
17
17
  complete?: boolean;
18
18
  /**
19
- * propagate errors to child
19
+ * Propagate errors to child.
20
20
  * @default true
21
21
  */
22
22
  error?: boolean;
23
23
  /**
24
- * update state immediately and don't first for next state change
24
+ * Update state immediately and don't wait for next state change.
25
25
  * @default true
26
26
  */
27
27
  immediate?: boolean;
28
28
  /**
29
- * only update the state once (if immediate is also true it basically just sets the same value)
29
+ * Only update the state once (if immediate is also true it basically just sets the same value).
30
30
  * @default false
31
31
  */
32
32
  once?: boolean;
33
33
  };
34
34
  export interface ReadonlyCancellationToken extends PromiseLike<void>, Subscribable<void> {
35
35
  /**
36
- * returns whether this token set
36
+ * Returns whether this token set.
37
37
  */
38
38
  readonly isSet: boolean;
39
39
  /**
40
- * returns whether this token unset
40
+ * Returns whether this token unset.
41
41
  */
42
42
  readonly isUnset: boolean;
43
43
  /**
44
- * observable which emits the current state and every state change
44
+ * Observable which emits the current state and every state change.
45
45
  */
46
46
  readonly state$: Observable<boolean>;
47
47
  /**
48
- * observable which emits when this token is set
48
+ * Observable which emits when this token is set.
49
49
  */
50
50
  readonly set$: Observable<void>;
51
51
  /**
52
- * observable which emits when this token is unset
52
+ * Observable which emits when this token is unset.
53
53
  */
54
54
  readonly unset$: Observable<void>;
55
55
  /**
56
- * returns a promise which is resolved when this token is set
56
+ * Returns a promise which is resolved when this token is set.
57
57
  */
58
58
  readonly $set: Promise<void>;
59
59
  /**
60
- * returns a promise which is resolved when this token is unset
60
+ * Returns a promise which is resolved when this token is unset.
61
61
  */
62
62
  readonly $unset: Promise<void>;
63
63
  /**
64
- * returns a promise which is resolved when this token changes its state
64
+ * Returns a promise which is resolved when this token changes its state.
65
65
  */
66
66
  readonly $state: Promise<boolean>;
67
67
  /**
68
- * returns an AbortSignal
68
+ * Returns an AbortSignal.
69
69
  */
70
70
  asAbortSignal: AbortSignal;
71
71
  /**
72
- * create a new token and connect it to this instance
72
+ * Create a new token and connect it to this instance.
73
73
  * @see {@link connect}
74
74
  */
75
75
  createChild(config?: ConnectConfig): CancellationToken;
76
76
  /**
77
- * propagate events from this instance to the `child`. Events from the `child` are *not* propagated to this instance
77
+ * Propagate events from this instance to the `child`. Events from the `child` are *not* propagated to this instance.
78
78
  * @param child child to connect
79
79
  */
80
80
  connect(child: CancellationToken, config?: ConnectConfig): void;
@@ -100,49 +100,49 @@ export declare class CancellationToken implements ReadonlyCancellationToken {
100
100
  */
101
101
  constructor(initialState?: boolean);
102
102
  /**
103
- * creates a token and sets it whenever the abort signal is aborted
103
+ * Creates a token and sets it whenever the abort signal is aborted.
104
104
  * @param signal abort signal to listen to
105
105
  * @param complete complete token after resolve
106
106
  */
107
107
  static fromAbortSignal(signal: AbortSignal, complete?: boolean): CancellationToken;
108
108
  /**
109
- * creates a token and sets it whenever the promise is resolved
109
+ * Creates a token and sets it whenever the promise is resolved.
110
110
  * @param promise promise to await
111
111
  * @param complete complete token after resolve
112
112
  */
113
113
  static fromPromise(promise: PromiseLike<any>, complete?: boolean): CancellationToken;
114
114
  /**
115
- * creates a token and connets its next, error and complete
116
- * @param observable observable to subscribe. Takes emitted value as state if type is boolean otherwise sets state to true
115
+ * Creates a token and connets its next, error and complete.
116
+ * @param observable observable to subscribe. Takes emitted value as state if type is boolean otherwise sets state to true.
117
117
  */
118
118
  static fromObservable(observable: Observable<void | boolean>, config?: ConnectConfig): CancellationToken;
119
119
  private static connect;
120
120
  createChild(config?: ConnectConfig): CancellationToken;
121
121
  connect(child: CancellationToken, config?: ConnectConfig): void;
122
122
  /**
123
- * become a child of the provided parent. Events from the parent are propagated to this token. Events from this token are *not* propagated to the parent
123
+ * Become a child of the provided parent. Events from the parent are propagated to this token. Events from this token are *not* propagated to the parent.
124
124
  */
125
125
  inherit(parent: ReadonlyCancellationToken, config?: ConnectConfig): this;
126
126
  /**
127
- * set this token
127
+ * Set this token.
128
128
  */
129
129
  set(): void;
130
130
  /**
131
- * unset this token
131
+ * Unset this token.
132
132
  */
133
133
  unset(): void;
134
134
  /**
135
- * set the state
135
+ * Set the state.
136
136
  */
137
137
  setState(state: boolean): void;
138
138
  /**
139
- * errors the token
139
+ * Errors the token.
140
140
  */
141
141
  error(error: Error): void;
142
142
  /**
143
- * clean up subscriptions
143
+ * Clean up subscriptions.
144
144
  *
145
- * keep in mind that *active* awaits (promise) on this token will throw
145
+ * Keep in mind that *active* awaits (promise) on this token will throw.
146
146
  */
147
147
  complete(): void;
148
148
  then<TResult>(onfulfilled?: ((value: void) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TResult>;
@@ -48,7 +48,7 @@ class CancellationToken {
48
48
  return this.abortController.signal;
49
49
  }
50
50
  /**
51
- * creates a token and sets it whenever the abort signal is aborted
51
+ * Creates a token and sets it whenever the abort signal is aborted.
52
52
  * @param signal abort signal to listen to
53
53
  * @param complete complete token after resolve
54
54
  */
@@ -57,7 +57,7 @@ class CancellationToken {
57
57
  return CancellationToken.fromObservable(signal$, { complete });
58
58
  }
59
59
  /**
60
- * creates a token and sets it whenever the promise is resolved
60
+ * Creates a token and sets it whenever the promise is resolved.
61
61
  * @param promise promise to await
62
62
  * @param complete complete token after resolve
63
63
  */
@@ -66,8 +66,8 @@ class CancellationToken {
66
66
  return CancellationToken.fromObservable(signal$, { complete });
67
67
  }
68
68
  /**
69
- * creates a token and connets its next, error and complete
70
- * @param observable observable to subscribe. Takes emitted value as state if type is boolean otherwise sets state to true
69
+ * Creates a token and connets its next, error and complete.
70
+ * @param observable observable to subscribe. Takes emitted value as state if type is boolean otherwise sets state to true.
71
71
  */
72
72
  static fromObservable(observable, config) {
73
73
  const token = new CancellationToken();
@@ -98,40 +98,40 @@ class CancellationToken {
98
98
  CancellationToken.connect(this.state$, child, config);
99
99
  }
100
100
  /**
101
- * become a child of the provided parent. Events from the parent are propagated to this token. Events from this token are *not* propagated to the parent
101
+ * Become a child of the provided parent. Events from the parent are propagated to this token. Events from this token are *not* propagated to the parent.
102
102
  */
103
103
  inherit(parent, config) {
104
104
  CancellationToken.connect(parent.state$, this, config);
105
105
  return this;
106
106
  }
107
107
  /**
108
- * set this token
108
+ * Set this token.
109
109
  */
110
110
  set() {
111
111
  this.stateSubject.next(true);
112
112
  }
113
113
  /**
114
- * unset this token
114
+ * Unset this token.
115
115
  */
116
116
  unset() {
117
117
  this.stateSubject.next(false);
118
118
  }
119
119
  /**
120
- * set the state
120
+ * Set the state.
121
121
  */
122
122
  setState(state) {
123
123
  this.stateSubject.next(state);
124
124
  }
125
125
  /**
126
- * errors the token
126
+ * Errors the token.
127
127
  */
128
128
  error(error) {
129
129
  this.stateSubject.error(error);
130
130
  }
131
131
  /**
132
- * clean up subscriptions
132
+ * Clean up subscriptions.
133
133
  *
134
- * keep in mind that *active* awaits (promise) on this token will throw
134
+ * Keep in mind that *active* awaits (promise) on this token will throw.
135
135
  */
136
136
  complete() {
137
137
  this.stateSubject.complete();