@quandis/qbo4.configuration 4.0.1-CI-20241007-232230 → 4.0.1-CI-20241009-155903

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quandis/qbo4.configuration",
3
- "version": "4.0.1-CI-20241007-232230",
3
+ "version": "4.0.1-CI-20241009-155903",
4
4
  "type": "module",
5
5
  "types": "./src/Program.d.ts",
6
6
  "exports": {
@@ -1,35 +1,35 @@
1
- import { ConfigData, IConfiguration, IConfigurationSource } from "./IConfiguration.js";
2
- export declare class JsonConfigurationSource implements IConfigurationSource {
3
- private jsonConfig;
4
- constructor(jsonConfig: ConfigData);
5
- getData(): ConfigData;
6
- getValues(): IterableIterator<{
7
- key: string;
8
- value: any;
9
- }>;
10
- }
11
- export declare class EmptyConfigurationSource implements IConfigurationSource {
12
- getData(): ConfigData;
13
- getValues(): IterableIterator<{
14
- key: string;
15
- value: any;
16
- }>;
17
- }
18
- export declare class ConfigurationSection implements IConfiguration {
19
- data: ConfigData;
20
- constructor(sectionData: ConfigData);
21
- getSection(path: string): IConfiguration;
22
- get(path: string): any;
23
- bind<T>(type: {
24
- new (): T;
25
- }): T;
26
- getValues(): IterableIterator<{
27
- key: string;
28
- value: any;
29
- }>;
30
- }
31
- export declare class Configuration extends ConfigurationSection {
32
- private sources;
33
- constructor(sources: IConfigurationSource[]);
34
- private mergeConfigurations;
35
- }
1
+ import { ConfigData, IConfiguration, IConfigurationSource } from "./IConfiguration.js";
2
+ export declare class JsonConfigurationSource implements IConfigurationSource {
3
+ private jsonConfig;
4
+ constructor(jsonConfig: ConfigData);
5
+ getData(): ConfigData;
6
+ getValues(): IterableIterator<{
7
+ key: string;
8
+ value: any;
9
+ }>;
10
+ }
11
+ export declare class EmptyConfigurationSource implements IConfigurationSource {
12
+ getData(): ConfigData;
13
+ getValues(): IterableIterator<{
14
+ key: string;
15
+ value: any;
16
+ }>;
17
+ }
18
+ export declare class ConfigurationSection implements IConfiguration {
19
+ data: ConfigData;
20
+ constructor(sectionData: ConfigData);
21
+ getSection(path: string): IConfiguration;
22
+ get(path: string): any;
23
+ bind<T>(type: {
24
+ new (): T;
25
+ }): T;
26
+ getValues(): IterableIterator<{
27
+ key: string;
28
+ value: any;
29
+ }>;
30
+ }
31
+ export declare class Configuration extends ConfigurationSection {
32
+ private sources;
33
+ constructor(sources: IConfigurationSource[]);
34
+ private mergeConfigurations;
35
+ }
@@ -1,105 +1,105 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- 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;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- import { Lifecycle, injectAll, injectable } from "tsyringe";
14
- import { services } from "./Services.js";
15
- import { IConfigurationSourceToken, IConfigurationToken, iterateConfig } from "./IConfiguration.js";
16
- export class JsonConfigurationSource {
17
- constructor(jsonConfig) {
18
- this.jsonConfig = jsonConfig;
19
- }
20
- getData() {
21
- return this.jsonConfig;
22
- }
23
- *getValues() {
24
- yield* iterateConfig(this.jsonConfig);
25
- }
26
- }
27
- export class EmptyConfigurationSource {
28
- getData() {
29
- return {};
30
- }
31
- *getValues() {
32
- yield* iterateConfig({});
33
- }
34
- }
35
- export class ConfigurationSection {
36
- constructor(sectionData) {
37
- this.data = sectionData;
38
- }
39
- getSection(path) {
40
- const keys = path.split(':');
41
- let currentSection = this.data;
42
- for (const key of keys) {
43
- if (!(key in currentSection)) {
44
- return new ConfigurationSection({}); // Or handle as needed
45
- }
46
- currentSection = currentSection[key];
47
- }
48
- return new ConfigurationSection(currentSection);
49
- }
50
- get(path) {
51
- const keys = path.split(':');
52
- let currentSection = this.data;
53
- for (const key of keys) {
54
- if (currentSection && (key in currentSection)) {
55
- currentSection = currentSection[key];
56
- }
57
- else {
58
- return {};
59
- }
60
- }
61
- return currentSection;
62
- }
63
- bind(type) {
64
- const instance = new type();
65
- for (const key in this.data) {
66
- if (this.data.hasOwnProperty(key)) {
67
- instance[key] = this.data[key];
68
- }
69
- }
70
- return instance;
71
- }
72
- *getValues() {
73
- yield* iterateConfig(this.data);
74
- }
75
- }
76
- let Configuration = class Configuration extends ConfigurationSection {
77
- //constructor(config: ConfigSection) {
78
- // this.config = config;
79
- //}
80
- //constructor(@injectAll(ILoggerToken) private loggers: ILogger[], @injectAll(ILogReaderToken) private readers: ILogReader[]) {
81
- // this.logTrace(`LoggingService.constructor loaded with ${loggers.length} loggers and ${readers.length} readers.`);
82
- //}
83
- constructor(sources) {
84
- super({});
85
- this.sources = sources;
86
- this.mergeConfigurations(sources);
87
- }
88
- mergeConfigurations(sources) {
89
- sources.forEach(source => {
90
- const section = source.getData();
91
- this.data = { ...this.data, ...section };
92
- });
93
- }
94
- };
95
- Configuration = __decorate([
96
- injectable(),
97
- __param(0, injectAll(IConfigurationSourceToken)),
98
- __metadata("design:paramtypes", [Array])
99
- ], Configuration);
100
- export { Configuration };
101
- // Register the Configuration class as a singleton
102
- services.container.register(IConfigurationToken, { useClass: Configuration }, { lifecycle: Lifecycle.Singleton });
103
- // Ensure we can have a default configuration source.
104
- services.container.register(IConfigurationSourceToken, { useClass: EmptyConfigurationSource }, { lifecycle: Lifecycle.Singleton });
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Lifecycle, injectAll, injectable } from "tsyringe";
14
+ import { services } from "./Services.js";
15
+ import { IConfigurationSourceToken, IConfigurationToken, iterateConfig } from "./IConfiguration.js";
16
+ export class JsonConfigurationSource {
17
+ constructor(jsonConfig) {
18
+ this.jsonConfig = jsonConfig;
19
+ }
20
+ getData() {
21
+ return this.jsonConfig;
22
+ }
23
+ *getValues() {
24
+ yield* iterateConfig(this.jsonConfig);
25
+ }
26
+ }
27
+ export class EmptyConfigurationSource {
28
+ getData() {
29
+ return {};
30
+ }
31
+ *getValues() {
32
+ yield* iterateConfig({});
33
+ }
34
+ }
35
+ export class ConfigurationSection {
36
+ constructor(sectionData) {
37
+ this.data = sectionData;
38
+ }
39
+ getSection(path) {
40
+ const keys = path.split(':');
41
+ let currentSection = this.data;
42
+ for (const key of keys) {
43
+ if (!(key in currentSection)) {
44
+ return new ConfigurationSection({}); // Or handle as needed
45
+ }
46
+ currentSection = currentSection[key];
47
+ }
48
+ return new ConfigurationSection(currentSection);
49
+ }
50
+ get(path) {
51
+ const keys = path.split(':');
52
+ let currentSection = this.data;
53
+ for (const key of keys) {
54
+ if (currentSection && (key in currentSection)) {
55
+ currentSection = currentSection[key];
56
+ }
57
+ else {
58
+ return {};
59
+ }
60
+ }
61
+ return currentSection;
62
+ }
63
+ bind(type) {
64
+ const instance = new type();
65
+ for (const key in this.data) {
66
+ if (this.data.hasOwnProperty(key)) {
67
+ instance[key] = this.data[key];
68
+ }
69
+ }
70
+ return instance;
71
+ }
72
+ *getValues() {
73
+ yield* iterateConfig(this.data);
74
+ }
75
+ }
76
+ let Configuration = class Configuration extends ConfigurationSection {
77
+ //constructor(config: ConfigSection) {
78
+ // this.config = config;
79
+ //}
80
+ //constructor(@injectAll(ILoggerToken) private loggers: ILogger[], @injectAll(ILogReaderToken) private readers: ILogReader[]) {
81
+ // this.logTrace(`LoggingService.constructor loaded with ${loggers.length} loggers and ${readers.length} readers.`);
82
+ //}
83
+ constructor(sources) {
84
+ super({});
85
+ this.sources = sources;
86
+ this.mergeConfigurations(sources);
87
+ }
88
+ mergeConfigurations(sources) {
89
+ sources.forEach(source => {
90
+ const section = source.getData();
91
+ this.data = { ...this.data, ...section };
92
+ });
93
+ }
94
+ };
95
+ Configuration = __decorate([
96
+ injectable(),
97
+ __param(0, injectAll(IConfigurationSourceToken)),
98
+ __metadata("design:paramtypes", [Array])
99
+ ], Configuration);
100
+ export { Configuration };
101
+ // Register the Configuration class as a singleton
102
+ services.container.register(IConfigurationToken, { useClass: Configuration }, { lifecycle: Lifecycle.Singleton });
103
+ // Ensure we can have a default configuration source.
104
+ services.container.register(IConfigurationSourceToken, { useClass: EmptyConfigurationSource }, { lifecycle: Lifecycle.Singleton });
105
105
  //# sourceMappingURL=Configuration.js.map
@@ -1,34 +1,34 @@
1
- import { InjectionToken } from "tsyringe";
2
- export type ConfigData = {
3
- [key: string]: any;
4
- };
5
- export interface IConfigurationSource extends ConfigData {
6
- getData(): ConfigData;
7
- getValues(): IterableIterator<{
8
- key: string;
9
- value: any;
10
- }>;
11
- }
12
- /**
13
- * Define a token for the ILoggerService interface
14
- */
15
- export declare const IConfigurationSourceToken: InjectionToken<IConfigurationSource>;
16
- export interface IConfiguration {
17
- getSection(section: string): IConfiguration;
18
- bind<T>(type: {
19
- new (): T;
20
- }): T;
21
- get(path: string): any;
22
- getValues(): IterableIterator<{
23
- key: string;
24
- value: any;
25
- }>;
26
- }
27
- /**
28
- * Define a token for the ILoggerService interface
29
- */
30
- export declare const IConfigurationToken: InjectionToken<IConfiguration>;
31
- export declare function iterateConfig(obj: any, prefix?: string): IterableIterator<{
32
- key: string;
33
- value: any;
34
- }>;
1
+ import { InjectionToken } from "tsyringe";
2
+ export type ConfigData = {
3
+ [key: string]: any;
4
+ };
5
+ export interface IConfigurationSource extends ConfigData {
6
+ getData(): ConfigData;
7
+ getValues(): IterableIterator<{
8
+ key: string;
9
+ value: any;
10
+ }>;
11
+ }
12
+ /**
13
+ * Define a token for the ILoggerService interface
14
+ */
15
+ export declare const IConfigurationSourceToken: InjectionToken<IConfigurationSource>;
16
+ export interface IConfiguration {
17
+ getSection(section: string): IConfiguration;
18
+ bind<T>(type: {
19
+ new (): T;
20
+ }): T;
21
+ get(path: string): any;
22
+ getValues(): IterableIterator<{
23
+ key: string;
24
+ value: any;
25
+ }>;
26
+ }
27
+ /**
28
+ * Define a token for the ILoggerService interface
29
+ */
30
+ export declare const IConfigurationToken: InjectionToken<IConfiguration>;
31
+ export declare function iterateConfig(obj: any, prefix?: string): IterableIterator<{
32
+ key: string;
33
+ value: any;
34
+ }>;
@@ -1,38 +1,38 @@
1
- /**
2
- * Define a token for the ILoggerService interface
3
- */
4
- export const IConfigurationSourceToken = 'IConfigurationSourceToken';
5
- /**
6
- * Define a token for the ILoggerService interface
7
- */
8
- export const IConfigurationToken = 'IConfigurationToken';
9
- // Helper function to iterate over a configuration object and yield key-value pairs
10
- export function* iterateConfig(obj, prefix = '') {
11
- for (const [key, value] of Object.entries(obj)) {
12
- const fullKey = prefix ? `${prefix}:${key}` : key;
13
- // Check if the value is an array
14
- if (Array.isArray(value)) {
15
- for (let i = 0; i < value.length; i++) {
16
- const item = value[i];
17
- // For each item in the array, extend the prefix to include the index
18
- if (typeof item === 'object' && item !== null) {
19
- // Recursively yield nested object values, including arrays
20
- yield* iterateConfig(item, `${fullKey}:${i}`);
21
- }
22
- else {
23
- // Yield primitive values directly, with index in the key
24
- yield { key: `${fullKey}:${i}`, value: item };
25
- }
26
- }
27
- }
28
- else if (typeof value === 'object' && value !== null) {
29
- // Recursively yield nested object values
30
- yield* iterateConfig(value, fullKey);
31
- }
32
- else {
33
- // Yield primitive values directly
34
- yield { key: fullKey, value };
35
- }
36
- }
37
- }
1
+ /**
2
+ * Define a token for the ILoggerService interface
3
+ */
4
+ export const IConfigurationSourceToken = 'IConfigurationSourceToken';
5
+ /**
6
+ * Define a token for the ILoggerService interface
7
+ */
8
+ export const IConfigurationToken = 'IConfigurationToken';
9
+ // Helper function to iterate over a configuration object and yield key-value pairs
10
+ export function* iterateConfig(obj, prefix = '') {
11
+ for (const [key, value] of Object.entries(obj)) {
12
+ const fullKey = prefix ? `${prefix}:${key}` : key;
13
+ // Check if the value is an array
14
+ if (Array.isArray(value)) {
15
+ for (let i = 0; i < value.length; i++) {
16
+ const item = value[i];
17
+ // For each item in the array, extend the prefix to include the index
18
+ if (typeof item === 'object' && item !== null) {
19
+ // Recursively yield nested object values, including arrays
20
+ yield* iterateConfig(item, `${fullKey}:${i}`);
21
+ }
22
+ else {
23
+ // Yield primitive values directly, with index in the key
24
+ yield { key: `${fullKey}:${i}`, value: item };
25
+ }
26
+ }
27
+ }
28
+ else if (typeof value === 'object' && value !== null) {
29
+ // Recursively yield nested object values
30
+ yield* iterateConfig(value, fullKey);
31
+ }
32
+ else {
33
+ // Yield primitive values directly
34
+ yield { key: fullKey, value };
35
+ }
36
+ }
37
+ }
38
38
  //# sourceMappingURL=IConfiguration.js.map
package/src/Program.d.ts CHANGED
@@ -1,24 +1,24 @@
1
- import { TemplateFunction } from './qbo-template.js';
2
- import { Services } from './Services.js';
3
- declare global {
4
- interface HTMLElement {
5
- attachInternals(): ElementInternals;
6
- }
7
- interface Window {
8
- qbo4: {
9
- services?: Services;
10
- configuration?: {
11
- templates?: Map<string, Map<string, TemplateFunction>>;
12
- html?: any;
13
- };
14
- };
15
- }
16
- }
17
- import 'reflect-metadata';
18
- export { html } from 'lit';
19
- export * from './Services.js';
20
- export * from './IConfiguration.js';
21
- export * from './Configuration.js';
22
- export * from './qbo-config-editor.js';
23
- export * from './qbo-template.js';
24
- export * from './qbo-css.js';
1
+ import { TemplateFunction } from './qbo-template.js';
2
+ import { Services } from './Services.js';
3
+ declare global {
4
+ interface HTMLElement {
5
+ attachInternals(): ElementInternals;
6
+ }
7
+ interface Window {
8
+ qbo4: {
9
+ services?: Services;
10
+ configuration?: {
11
+ templates?: Map<string, Map<string, TemplateFunction>>;
12
+ html?: any;
13
+ };
14
+ };
15
+ }
16
+ }
17
+ import 'reflect-metadata';
18
+ export { html } from 'lit';
19
+ export * from './Services.js';
20
+ export * from './IConfiguration.js';
21
+ export * from './Configuration.js';
22
+ export * from './qbo-config-editor.js';
23
+ export * from './qbo-template.js';
24
+ export * from './qbo-css.js';
package/src/Program.js CHANGED
@@ -1,9 +1,9 @@
1
- import 'reflect-metadata';
2
- export { html } from 'lit';
3
- export * from './Services.js';
4
- export * from './IConfiguration.js';
5
- export * from './Configuration.js';
6
- export * from './qbo-config-editor.js';
7
- export * from './qbo-template.js';
8
- export * from './qbo-css.js';
1
+ import 'reflect-metadata';
2
+ export { html } from 'lit';
3
+ export * from './Services.js';
4
+ export * from './IConfiguration.js';
5
+ export * from './Configuration.js';
6
+ export * from './qbo-config-editor.js';
7
+ export * from './qbo-template.js';
8
+ export * from './qbo-css.js';
9
9
  //# sourceMappingURL=Program.js.map
package/src/Services.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { DependencyContainer, InjectionToken } from "tsyringe";
2
- export declare class Services {
3
- container: DependencyContainer;
4
- options: any;
5
- constructor(container: DependencyContainer, options: any);
6
- getService<T>(token: string | InjectionToken<T>): T;
7
- }
8
- declare const services: Services;
9
- export { services };
1
+ import { DependencyContainer, InjectionToken } from "tsyringe";
2
+ export declare class Services {
3
+ container: DependencyContainer;
4
+ options: any;
5
+ constructor(container: DependencyContainer, options: any);
6
+ getService<T>(token: string | InjectionToken<T>): T;
7
+ }
8
+ declare const services: Services;
9
+ export { services };
package/src/Services.js CHANGED
@@ -1,19 +1,19 @@
1
- import { container } from "tsyringe";
2
- export class Services {
3
- constructor(container, options) {
4
- this.container = container;
5
- this.options = options;
6
- }
7
- getService(token) {
8
- return this.container.resolve(token);
9
- }
10
- }
11
- const services = window?.qbo4?.services || new Services(container.createChildContainer(), {});
12
- // Expose tsyring.container as qbo4.Logging.Services, but ensure it's global.
13
- if (typeof window !== 'undefined') {
14
- window.qbo4 = window.qbo4 || {};
15
- window.qbo4.services = window.qbo4.services || new Services(container.createChildContainer(), {});
16
- const services = window.qbo4.services;
17
- }
18
- export { services };
1
+ import { container } from "tsyringe";
2
+ export class Services {
3
+ constructor(container, options) {
4
+ this.container = container;
5
+ this.options = options;
6
+ }
7
+ getService(token) {
8
+ return this.container.resolve(token);
9
+ }
10
+ }
11
+ const services = window?.qbo4?.services || new Services(container.createChildContainer(), {});
12
+ // Expose tsyring.container as qbo4.Logging.Services, but ensure it's global.
13
+ if (typeof window !== 'undefined') {
14
+ window.qbo4 = window.qbo4 || {};
15
+ window.qbo4.services = window.qbo4.services || new Services(container.createChildContainer(), {});
16
+ const services = window.qbo4.services;
17
+ }
18
+ export { services };
19
19
  //# sourceMappingURL=Services.js.map
@@ -1,18 +1,18 @@
1
- import { LitElement } from 'lit';
2
- export declare class QboConfigEditor extends LitElement {
3
- private _internals;
4
- static get formAssociated(): boolean;
5
- value: any;
6
- configData: Object;
7
- static styles: import("lit").CSSResult;
8
- constructor();
9
- _handleInput(e: any): void;
10
- connectedCallback(): Promise<void>;
11
- handleInputChange(key: any, event: any): void;
12
- updateConfigData(key: any, newValue: any, event: any, isKey?: boolean): void;
13
- addKeyValuePair(event: any): void;
14
- deleteKeyValuePair(key: any, event: any): void;
15
- saveChanges(event: any): void;
16
- cancelChanges(event: any): void;
17
- render(): import("lit-html").TemplateResult<1>;
18
- }
1
+ import { LitElement } from 'lit';
2
+ export declare class QboConfigEditor extends LitElement {
3
+ private _internals;
4
+ static get formAssociated(): boolean;
5
+ value: any;
6
+ configData: Object;
7
+ static styles: import("lit").CSSResult;
8
+ constructor();
9
+ _handleInput(e: any): void;
10
+ connectedCallback(): Promise<void>;
11
+ handleInputChange(key: any, event: any): void;
12
+ updateConfigData(key: any, newValue: any, event: any, isKey?: boolean): void;
13
+ addKeyValuePair(event: any): void;
14
+ deleteKeyValuePair(key: any, event: any): void;
15
+ saveChanges(event: any): void;
16
+ cancelChanges(event: any): void;
17
+ render(): import("lit-html").TemplateResult<1>;
18
+ }