@anglr/common 17.0.0-beta.20230711090239 → 17.0.0-beta.20230814105451
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/changelog.md +45 -1
- package/es2022/hotkeys/src/services/appHotkeys.service.js +6 -2
- package/es2022/hotkeys/src/services/appHotkeys.service.js.map +1 -1
- package/es2022/numeral/src/modules/numeral.module.js +4 -4
- package/es2022/numeral/src/modules/numeral.module.js.map +1 -1
- package/es2022/numeral/src/pipes/numeral.pipe.js +6 -6
- package/es2022/numeral/src/pipes/numeral.pipe.js.map +1 -1
- package/es2022/src/index.js +3 -1
- package/es2022/src/index.js.map +1 -1
- package/es2022/src/modules/debugData/components/debugData/debugData.component.js +26 -26
- package/es2022/src/modules/debugData/components/debugData/debugData.component.js.map +1 -1
- package/es2022/src/modules/tooltip/components/tooltip/tooltip.component.js +15 -15
- package/es2022/src/modules/tooltip/components/tooltip/tooltip.component.js.map +1 -1
- package/es2022/src/services/logger/logger.interface.js.map +1 -1
- package/es2022/src/services/permanentStorage/cookiePermanentStorage.service.js +22 -0
- package/es2022/src/services/permanentStorage/cookiePermanentStorage.service.js.map +1 -1
- package/es2022/src/services/permanentStorage/permanentStorage.interface.js.map +1 -1
- package/es2022/src/services/position/position.interface.js.map +1 -1
- package/es2022/src/services/stringLocalization/stringLocalization.interface.js.map +1 -1
- package/es2022/src/services/temporaryStorage/temporaryStorage.interface.js.map +1 -1
- package/es2022/src/types/providerDecoratedType.js +32 -0
- package/es2022/src/types/providerDecoratedType.js.map +1 -0
- package/es2022/src/types/providers.js +48 -0
- package/es2022/src/types/providers.js.map +1 -0
- package/es2022/store/src/index.js +1 -1
- package/es2022/store/src/index.js.map +1 -1
- package/es2022/store/src/services/permanentStorage/localPermanentStorage.service.js +21 -1
- package/es2022/store/src/services/permanentStorage/localPermanentStorage.service.js.map +1 -1
- package/es2022/store/src/services/temporaryStorage/sessionTemporaryStorage.service.js +21 -0
- package/es2022/store/src/services/temporaryStorage/sessionTemporaryStorage.service.js.map +1 -1
- package/es2022/structured-log/src/index.js +2 -1
- package/es2022/structured-log/src/index.js.map +1 -1
- package/es2022/structured-log/src/misc/providers.js +12 -0
- package/es2022/structured-log/src/misc/providers.js.map +1 -0
- package/es2022/structured-log/src/modules/consoleLog.module.js +0 -15
- package/es2022/structured-log/src/modules/consoleLog.module.js.map +1 -1
- package/es2022/structured-log/src/services/logger.service.js +21 -0
- package/es2022/structured-log/src/services/logger.service.js.map +1 -1
- package/es2022/structured-log/src/services/rest/restSink.options.js +40 -0
- package/es2022/structured-log/src/services/rest/restSink.options.js.map +1 -0
- package/es2022/structured-log/src/services/rest/restSink.service.js +22 -12
- package/es2022/structured-log/src/services/rest/restSink.service.js.map +1 -1
- package/es2022/structured-log/src/types/tokens.js +0 -9
- package/es2022/structured-log/src/types/tokens.js.map +1 -1
- package/hotkeys/src/services/appHotkeys.service.d.ts.map +1 -1
- package/numeral/src/modules/numeral.module.d.ts +1 -1
- package/numeral/src/pipes/numeral.pipe.d.ts +3 -3
- package/numeral/src/pipes/numeral.pipe.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +6 -4
- package/src/index.d.ts.map +1 -1
- package/src/modules/debugData/components/debugData/debugData.component.d.ts +8 -8
- package/src/modules/debugData/components/debugData/debugData.component.d.ts.map +1 -1
- package/src/modules/debugData/components/debugData/debugData.component.html +1 -1
- package/src/modules/tooltip/components/tooltip/tooltip.component.d.ts +10 -9
- package/src/modules/tooltip/components/tooltip/tooltip.component.d.ts.map +1 -1
- package/src/services/logger/logger.interface.d.ts +6 -0
- package/src/services/logger/logger.interface.d.ts.map +1 -1
- package/src/services/permanentStorage/cookiePermanentStorage.service.d.ts +5 -1
- package/src/services/permanentStorage/cookiePermanentStorage.service.d.ts.map +1 -1
- package/src/services/permanentStorage/permanentStorage.interface.d.ts +6 -0
- package/src/services/permanentStorage/permanentStorage.interface.d.ts.map +1 -1
- package/src/services/position/position.interface.d.ts +6 -0
- package/src/services/position/position.interface.d.ts.map +1 -1
- package/src/services/stringLocalization/stringLocalization.interface.d.ts +6 -0
- package/src/services/stringLocalization/stringLocalization.interface.d.ts.map +1 -1
- package/src/services/temporaryStorage/temporaryStorage.interface.d.ts +6 -0
- package/src/services/temporaryStorage/temporaryStorage.interface.d.ts.map +1 -1
- package/src/types/providerDecoratedType.d.ts +12 -0
- package/src/types/providerDecoratedType.d.ts.map +1 -0
- package/src/types/providers.d.ts +32 -0
- package/src/types/providers.d.ts.map +1 -0
- package/store/src/index.d.ts +1 -1
- package/store/src/index.d.ts.map +1 -1
- package/store/src/services/permanentStorage/localPermanentStorage.service.d.ts +5 -1
- package/store/src/services/permanentStorage/localPermanentStorage.service.d.ts.map +1 -1
- package/store/src/services/temporaryStorage/sessionTemporaryStorage.service.d.ts +5 -1
- package/store/src/services/temporaryStorage/sessionTemporaryStorage.service.d.ts.map +1 -1
- package/structured-log/src/index.d.ts +2 -1
- package/structured-log/src/index.d.ts.map +1 -1
- package/structured-log/src/misc/providers.d.ts +6 -0
- package/structured-log/src/misc/providers.d.ts.map +1 -0
- package/structured-log/src/modules/consoleLog.module.d.ts +0 -5
- package/structured-log/src/modules/consoleLog.module.d.ts.map +1 -1
- package/structured-log/src/services/logger.service.d.ts +5 -1
- package/structured-log/src/services/logger.service.d.ts.map +1 -1
- package/structured-log/src/services/rest/restSink.options.d.ts +24 -0
- package/structured-log/src/services/rest/restSink.options.d.ts.map +1 -0
- package/structured-log/src/services/rest/restSink.service.d.ts +7 -4
- package/structured-log/src/services/rest/restSink.service.d.ts.map +1 -1
- package/structured-log/src/types/tokens.d.ts +0 -4
- package/structured-log/src/types/tokens.d.ts.map +1 -1
- package/version.bak +1 -1
- package/es2022/structured-log/src/services/rest/restSinkConfig.service.js +0 -60
- package/es2022/structured-log/src/services/rest/restSinkConfig.service.js.map +0 -1
- package/structured-log/src/services/rest/restSinkConfig.service.d.ts +0 -22
- package/structured-log/src/services/rest/restSinkConfig.service.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.interface.js","sourceRoot":"","sources":["../../../../src/services/position/position.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Func1} from '@jscrpt/common';\nimport {Observable} from 'rxjs';\n\nimport {PositionOffsetString, PositionPlacement} from './position.types';\n\n/**\n * Options for autoupdate specific functionality\n */\nexport interface AutoUpdateOptions\n{\n /**\n * Indication whether update position when ancestor scroll changes\n */\n ancestorScroll: boolean;\n\n /**\n * Indication whether update position when ancestor size changes\n */\n ancestorResize: boolean;\n\n /**\n * Indication whether update position when target element changes size\n */\n elementResize: boolean;\n}\n\n/**\n * Defines object which describes offsets for positioned element\n */\nexport interface PositionOffsets\n{\n /**\n * Distance between positioned and reference element.\n */\n mainAxis?: number;\n\n /**\n * Skidding between floating and reference element.\n */\n crossAxis?: number;\n\n /**\n * Works on the same axis as crossAxis but applies only to aligned placements and works logically. The offset is inverted for -end alignments.\n */\n alignmentAxis?: number|null;\n}\n\n/**\n * Stores positioned element and reference element\n */\nexport interface PositionElements<TElement extends Element = Element>\n{\n /**\n * Reference element against which is object positioned\n */\n reference: TElement;\n\n /**\n * Element that is positioned\n */\n floating: TElement;\n}\n\n/**\n * Arguments that are passed during positioning\n */\nexport interface PositionArguments<TElement extends Element = Element>\n{\n /**\n * X coordinate of positioned element\n */\n x: number;\n\n /**\n * Y coordinate of positioned element\n */\n y: number;\n\n /**\n * Elements that are being used during positioning\n */\n elements: PositionElements<TElement>;\n}\n\n/**\n * Options that are passed to position service\n */\nexport interface PositionOptions\n{\n //######################### properties #########################\n\n /**\n * Placement of target element against source element\n */\n placement: PositionPlacement;\n\n /**\n * Offset which allows moving target element along the cross axis of placement, or any chosed direction\n */\n offset: PositionOffsetString|number|PositionOffsets|Func1<number|PositionOffsets, PositionArguments>;\n\n /**\n * Indication whether perform flip in case of collision (with view boundaries)\n */\n flip: boolean;\n\n /**\n * Indication whether set up 'auto updating' of position\n */\n autoUpdate: boolean|AutoUpdateOptions;\n\n /**\n * Mouse event that occured when positioning was called\n */\n mouseEvent?: MouseEvent;\n}\n\n/**\n * Result of positioning process, storing new coordinates\n */\nexport interface PositionResult<TElement extends Element = any>\n{\n /**\n * Target element to be positioned\n */\n target: TElement;\n\n /**\n * X coordinate of position of target\n */\n x: number;\n\n /**\n * Y coordinate of position of target\n */\n y: number;\n\n /**\n * Indication whether there was flip applied\n */\n flip: boolean;\n\n /**\n * Disposes instance of engine used for positioning\n */\n dispose(): void;\n}\n\n/**\n * Service that is used for positioning two elements against each other\n */\nexport interface Position\n{\n //######################### methods #########################\n\n /**\n * Places target element relatively to source element according options and returns result storing information about new position\n * @param target - Target element to be placed\n * @param source - Source element to be placed against\n * @param options - Optional options with informations about new position\n */\n placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"position.interface.js","sourceRoot":"","sources":["../../../../src/services/position/position.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from '@angular/core';\nimport {Func1} from '@jscrpt/common';\nimport {Observable} from 'rxjs';\n\nimport {PositionOffsetString, PositionPlacement} from './position.types';\n\n/**\n * Options for autoupdate specific functionality\n */\nexport interface AutoUpdateOptions\n{\n /**\n * Indication whether update position when ancestor scroll changes\n */\n ancestorScroll: boolean;\n\n /**\n * Indication whether update position when ancestor size changes\n */\n ancestorResize: boolean;\n\n /**\n * Indication whether update position when target element changes size\n */\n elementResize: boolean;\n}\n\n/**\n * Defines object which describes offsets for positioned element\n */\nexport interface PositionOffsets\n{\n /**\n * Distance between positioned and reference element.\n */\n mainAxis?: number;\n\n /**\n * Skidding between floating and reference element.\n */\n crossAxis?: number;\n\n /**\n * Works on the same axis as crossAxis but applies only to aligned placements and works logically. The offset is inverted for -end alignments.\n */\n alignmentAxis?: number|null;\n}\n\n/**\n * Stores positioned element and reference element\n */\nexport interface PositionElements<TElement extends Element = Element>\n{\n /**\n * Reference element against which is object positioned\n */\n reference: TElement;\n\n /**\n * Element that is positioned\n */\n floating: TElement;\n}\n\n/**\n * Arguments that are passed during positioning\n */\nexport interface PositionArguments<TElement extends Element = Element>\n{\n /**\n * X coordinate of positioned element\n */\n x: number;\n\n /**\n * Y coordinate of positioned element\n */\n y: number;\n\n /**\n * Elements that are being used during positioning\n */\n elements: PositionElements<TElement>;\n}\n\n/**\n * Options that are passed to position service\n */\nexport interface PositionOptions\n{\n //######################### properties #########################\n\n /**\n * Placement of target element against source element\n */\n placement: PositionPlacement;\n\n /**\n * Offset which allows moving target element along the cross axis of placement, or any chosed direction\n */\n offset: PositionOffsetString|number|PositionOffsets|Func1<number|PositionOffsets, PositionArguments>;\n\n /**\n * Indication whether perform flip in case of collision (with view boundaries)\n */\n flip: boolean;\n\n /**\n * Indication whether set up 'auto updating' of position\n */\n autoUpdate: boolean|AutoUpdateOptions;\n\n /**\n * Mouse event that occured when positioning was called\n */\n mouseEvent?: MouseEvent;\n}\n\n/**\n * Result of positioning process, storing new coordinates\n */\nexport interface PositionResult<TElement extends Element = any>\n{\n /**\n * Target element to be positioned\n */\n target: TElement;\n\n /**\n * X coordinate of position of target\n */\n x: number;\n\n /**\n * Y coordinate of position of target\n */\n y: number;\n\n /**\n * Indication whether there was flip applied\n */\n flip: boolean;\n\n /**\n * Disposes instance of engine used for positioning\n */\n dispose(): void;\n}\n\n/**\n * Service that is used for positioning two elements against each other\n */\nexport interface Position\n{\n //######################### methods #########################\n\n /**\n * Places target element relatively to source element according options and returns result storing information about new position\n * @param target - Target element to be placed\n * @param source - Source element to be placed against\n * @param options - Optional options with informations about new position\n */\n placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>;\n}\n\n/**\n * Used for restriction of position provider type only for type decorated with position provider\n */\nexport interface PositionType extends Type<unknown>\n{\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringLocalization.interface.js","sourceRoot":"","sources":["../../../../src/services/stringLocalization/stringLocalization.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Observable} from 'rxjs';\n\n/**\n * Provides api to localize strings\n */\nexport interface StringLocalization\n{\n /**\n * Occurs when indication that locale has changes and strings should be obtained again, because they have changed\n */\n readonly textsChange: Observable<void>;\n\n /**\n * Gets localized string for specified key, interpolation might be used\n * @param key - Key to be localized\n * @param interpolateParams - Optional object storing interpolation parameters\n */\n get(key: string, interpolateParams?: Object): string;\n}"]}
|
|
1
|
+
{"version":3,"file":"stringLocalization.interface.js","sourceRoot":"","sources":["../../../../src/services/stringLocalization/stringLocalization.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from '@angular/core';\nimport {Observable} from 'rxjs';\n\n/**\n * Provides api to localize strings\n */\nexport interface StringLocalization\n{\n /**\n * Occurs when indication that locale has changes and strings should be obtained again, because they have changed\n */\n readonly textsChange: Observable<void>;\n\n /**\n * Gets localized string for specified key, interpolation might be used\n * @param key - Key to be localized\n * @param interpolateParams - Optional object storing interpolation parameters\n */\n get(key: string, interpolateParams?: Object): string;\n}\n\n/**\n * Used for restriction of string localization provider type only for type decorated with string localization provider\n */\nexport interface StringLocalizationType extends Type<unknown>\n{\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temporaryStorage.interface.js","sourceRoot":"","sources":["../../../../src/services/temporaryStorage/temporaryStorage.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Provides api for implementing temporary storage\n */\nexport interface TemporaryStorage\n{\n /**\n * Gets value that was stored with 'name' from temporary storage\n * @param name - Name with which was value stored\n */\n get<TResult>(name: string): TResult;\n\n /**\n * Sets value that will be stored with 'name'e in temporary storage\n * @param name - Name with which will be value stored\n * @param value - Value to be stored\n */\n set(name: string, value: any): void;\n\n /**\n * Removes value stored with 'name' from temporary storage\n * @param name - Name of stored value that will be removed\n */\n remove(name: string): void;\n}"]}
|
|
1
|
+
{"version":3,"file":"temporaryStorage.interface.js","sourceRoot":"","sources":["../../../../src/services/temporaryStorage/temporaryStorage.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from '@angular/core';\n\n/**\n * Provides api for implementing temporary storage\n */\nexport interface TemporaryStorage\n{\n /**\n * Gets value that was stored with 'name' from temporary storage\n * @param name - Name with which was value stored\n */\n get<TResult>(name: string): TResult;\n\n /**\n * Sets value that will be stored with 'name'e in temporary storage\n * @param name - Name with which will be value stored\n * @param value - Value to be stored\n */\n set(name: string, value: any): void;\n\n /**\n * Removes value stored with 'name' from temporary storage\n * @param name - Name of stored value that will be removed\n */\n remove(name: string): void;\n}\n\n/**\n * Used for restriction of temporary storage provider type only for type decorated with temporary storage provider\n */\nexport interface TemporaryStorageType extends Type<unknown>\n{\n}"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { nameof } from '@jscrpt/common';
|
|
2
|
+
/**
|
|
3
|
+
* Gets provider from type
|
|
4
|
+
* @param type - Type that should contain provider
|
|
5
|
+
*/
|
|
6
|
+
export function getProviderForType(type) {
|
|
7
|
+
const typeWithProvider = type;
|
|
8
|
+
if (!typeWithProvider.ɵɵprovider) {
|
|
9
|
+
throw new Error(`Type ${type} is without provider!`);
|
|
10
|
+
}
|
|
11
|
+
return typeWithProvider.ɵɵprovider;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Attach provider to type
|
|
15
|
+
* @param provider - Provider to be attached
|
|
16
|
+
*/
|
|
17
|
+
export function TypeProvider(provider) {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
19
|
+
return function (target) {
|
|
20
|
+
const typeWithProvider = target;
|
|
21
|
+
if (!typeWithProvider.ɵɵprovider) {
|
|
22
|
+
Object.defineProperty(typeWithProvider, nameof('ɵɵprovider'), {
|
|
23
|
+
value: provider,
|
|
24
|
+
writable: false,
|
|
25
|
+
enumerable: false,
|
|
26
|
+
configurable: false,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return target;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=providerDecoratedType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerDecoratedType.js","sourceRoot":"","sources":["../../../src/types/providerDecoratedType.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAatC;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAmB;IAElD,MAAM,gBAAgB,GAAG,IAA6B,CAAC;IAEvD,IAAG,CAAC,gBAAgB,CAAC,UAAU,EAC/B;QACI,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,uBAAuB,CAAC,CAAC;KACxD;IAED,OAAO,gBAAgB,CAAC,UAAU,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAAkB;IAE3C,wDAAwD;IACxD,OAAO,UAAsC,MAAiB;QAE1D,MAAM,gBAAgB,GAAG,MAA+B,CAAC;QAEzD,IAAG,CAAC,gBAAgB,CAAC,UAAU,EAC/B;YACI,MAAM,CAAC,cAAc,CAAC,gBAAgB,EAAE,MAAM,CAAwB,YAAY,CAAC,EACnF;gBACI,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,KAAK;gBACf,UAAU,EAAE,KAAK;gBACjB,YAAY,EAAE,KAAK;aACtB,CAAC,CAAC;SACN;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;AACN,CAAC","sourcesContent":["import {Provider, Type} from '@angular/core';\nimport {nameof} from '@jscrpt/common';\n\n/**\n * Type that contains provider\n */\ninterface ProviderDecoratedType\n{\n /**\n * Provider that is attached to type\n */\n ɵɵprovider?: Provider;\n}\n\n/**\n * Gets provider from type\n * @param type - Type that should contain provider\n */\nexport function getProviderForType(type: Type<unknown>): Provider\n{\n const typeWithProvider = type as ProviderDecoratedType;\n\n if(!typeWithProvider.ɵɵprovider)\n {\n throw new Error(`Type ${type} is without provider!`);\n }\n\n return typeWithProvider.ɵɵprovider;\n}\n\n/**\n * Attach provider to type\n * @param provider - Provider to be attached\n */\nexport function TypeProvider(provider: Provider): ClassDecorator\n{\n // eslint-disable-next-line @typescript-eslint/ban-types\n return function<TFunction extends Function> (target: TFunction): TFunction\n {\n const typeWithProvider = target as ProviderDecoratedType;\n \n if(!typeWithProvider.ɵɵprovider)\n {\n Object.defineProperty(typeWithProvider, nameof<ProviderDecoratedType>('ɵɵprovider'),\n {\n value: provider,\n writable: false,\n enumerable: false,\n configurable: false,\n });\n }\n\n return target;\n };\n}"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { makeEnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { getProviderForType } from './providerDecoratedType';
|
|
3
|
+
/**
|
|
4
|
+
* Provides logger service type
|
|
5
|
+
* @param type - Type of logger that should be used
|
|
6
|
+
*/
|
|
7
|
+
export function provideLogger(type) {
|
|
8
|
+
return makeEnvironmentProviders([
|
|
9
|
+
getProviderForType(type),
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Provides permanent storage service type
|
|
14
|
+
* @param type - Type of permanent storage that should be used
|
|
15
|
+
*/
|
|
16
|
+
export function providePermanentStorage(type) {
|
|
17
|
+
return makeEnvironmentProviders([
|
|
18
|
+
getProviderForType(type),
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Provides position service type
|
|
23
|
+
* @param type - Type of position that should be used
|
|
24
|
+
*/
|
|
25
|
+
export function providePosition(type) {
|
|
26
|
+
return makeEnvironmentProviders([
|
|
27
|
+
getProviderForType(type),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Provides string localization service type
|
|
32
|
+
* @param type - Type of string localization that should be used
|
|
33
|
+
*/
|
|
34
|
+
export function provideStringLocalization(type) {
|
|
35
|
+
return makeEnvironmentProviders([
|
|
36
|
+
getProviderForType(type),
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provides temporary storage service type
|
|
41
|
+
* @param type - Type of temporary storage that should be used
|
|
42
|
+
*/
|
|
43
|
+
export function provideTemporaryStorage(type) {
|
|
44
|
+
return makeEnvironmentProviders([
|
|
45
|
+
getProviderForType(type),
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../src/types/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAO7E,OAAO,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAE3D;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAgB;IAE1C,OAAO,wBAAwB,CAC/B;QACI,kBAAkB,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAA0B;IAE9D,OAAO,wBAAwB,CAC/B;QACI,kBAAkB,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAkB;IAE9C,OAAO,wBAAwB,CAC/B;QACI,kBAAkB,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAA4B;IAElE,OAAO,wBAAwB,CAC/B;QACI,kBAAkB,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAA0B;IAE9D,OAAO,wBAAwB,CAC/B;QACI,kBAAkB,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';\n\nimport {LoggerType} from '../services/logger/logger.interface';\nimport {PermanentStorageType} from '../services/permanentStorage/permanentStorage.interface';\nimport {PositionType} from '../services/position/position.interface';\nimport {StringLocalizationType} from '../services/stringLocalization/stringLocalization.interface';\nimport {TemporaryStorageType} from '../services/temporaryStorage/temporaryStorage.interface';\nimport {getProviderForType} from './providerDecoratedType';\n\n/**\n * Provides logger service type\n * @param type - Type of logger that should be used\n */\nexport function provideLogger(type: LoggerType): EnvironmentProviders\n{\n return makeEnvironmentProviders(\n [\n getProviderForType(type),\n ]);\n}\n\n/**\n * Provides permanent storage service type\n * @param type - Type of permanent storage that should be used\n */\nexport function providePermanentStorage(type: PermanentStorageType): EnvironmentProviders\n{\n return makeEnvironmentProviders(\n [\n getProviderForType(type),\n ]);\n}\n\n/**\n * Provides position service type\n * @param type - Type of position that should be used\n */\nexport function providePosition(type: PositionType): EnvironmentProviders\n{\n return makeEnvironmentProviders(\n [\n getProviderForType(type),\n ]);\n}\n\n/**\n * Provides string localization service type\n * @param type - Type of string localization that should be used\n */\nexport function provideStringLocalization(type: StringLocalizationType): EnvironmentProviders\n{\n return makeEnvironmentProviders(\n [\n getProviderForType(type),\n ]);\n}\n\n/**\n * Provides temporary storage service type\n * @param type - Type of temporary storage that should be used\n */\nexport function provideTemporaryStorage(type: TemporaryStorageType): EnvironmentProviders\n{\n return makeEnvironmentProviders(\n [\n getProviderForType(type),\n ]);\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { LocalPermanentStorageService, SessionTemporaryStorageService } from './services';
|
|
1
|
+
export { LocalPermanentStorageService, SessionTemporaryStorageService, SessionTemporaryStorage, LocalPermanentStorage } from './services';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../store/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAE,8BAA8B,EAAC,MAAM,YAAY,CAAC","sourcesContent":["export {LocalPermanentStorageService, SessionTemporaryStorageService} from './services';"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../store/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,qBAAqB,EAAC,MAAM,YAAY,CAAC","sourcesContent":["export {LocalPermanentStorageService, SessionTemporaryStorageService, SessionTemporaryStorage, LocalPermanentStorage} from './services';"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
1
2
|
import { Injectable } from '@angular/core';
|
|
3
|
+
import { PERMANENT_STORAGE, TypeProvider } from '@anglr/common';
|
|
2
4
|
import store from 'store';
|
|
3
5
|
import expirePlugin from 'store/plugins/expire';
|
|
4
6
|
import * as i0 from "@angular/core";
|
|
5
|
-
//TODO: add tokens for storages
|
|
6
7
|
/**
|
|
7
8
|
* Implementation of permanent storage using LocalStorage
|
|
8
9
|
*/
|
|
@@ -47,4 +48,23 @@ export { LocalPermanentStorageService };
|
|
|
47
48
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LocalPermanentStorageService, decorators: [{
|
|
48
49
|
type: Injectable
|
|
49
50
|
}], ctorParameters: function () { return []; } });
|
|
51
|
+
/**
|
|
52
|
+
* Provider for permanent storage that is using local storage implementation
|
|
53
|
+
*/
|
|
54
|
+
const LOCAL_PERMANENT_STORAGE = {
|
|
55
|
+
provide: PERMANENT_STORAGE,
|
|
56
|
+
useClass: LocalPermanentStorageService
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Type that contains provider for local permanent storage when used with `providePermanentStorage`
|
|
60
|
+
*/
|
|
61
|
+
let LocalPermanentStorageType = class LocalPermanentStorageType {
|
|
62
|
+
};
|
|
63
|
+
LocalPermanentStorageType = __decorate([
|
|
64
|
+
TypeProvider(LOCAL_PERMANENT_STORAGE)
|
|
65
|
+
], LocalPermanentStorageType);
|
|
66
|
+
/**
|
|
67
|
+
* Sets permanent storage to use local permanent storage when used with `providePermanentStorage`
|
|
68
|
+
*/
|
|
69
|
+
export const LocalPermanentStorage = LocalPermanentStorageType;
|
|
50
70
|
//# sourceMappingURL=localPermanentStorage.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localPermanentStorage.service.js","sourceRoot":"","sources":["../../../../../store/src/services/permanentStorage/localPermanentStorage.service.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"localPermanentStorage.service.js","sourceRoot":"","sources":["../../../../../store/src/services/permanentStorage/localPermanentStorage.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAgB,UAAU,EAAW,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,iBAAiB,EAA0C,YAAY,EAAC,MAAM,eAAe,CAAC;AACtG,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,YAAY,MAAM,sBAAsB,CAAC;;AAEhD;;GAEG;AACH,MACa,4BAA4B;IAErC,iEAAiE;IAEjE;QAEI,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED,yGAAyG;IAEzG;;;OAGG;IACI,GAAG,CAAU,IAAY;QAE5B,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAiBD;;;;;OAKG;IACI,GAAG,CAAC,IAAY,EAAE,KAAU,EAAE,OAAc;QAE/C,IAAG,OAAO,EACV;YACI,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;SAC7C;aAED;YACI,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SAC1B;IACL,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAY;QAEtB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;uGA5DQ,4BAA4B;2GAA5B,4BAA4B;;SAA5B,4BAA4B;2FAA5B,4BAA4B;kBADxC,UAAU;;AAgEX;;GAEG;AACH,MAAM,uBAAuB,GAE7B;IACI,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,4BAA4B;CACzC,CAAC;AAEF;;GAEG;AAEH,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;CAE9B,CAAA;AAFK,yBAAyB;IAD9B,YAAY,CAAC,uBAAuB,CAAC;GAChC,yBAAyB,CAE9B;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAyB,yBAAyB,CAAC","sourcesContent":["import {ClassProvider, Injectable, Provider} from '@angular/core';\nimport {PERMANENT_STORAGE, PermanentStorage, PermanentStorageType, TypeProvider} from '@anglr/common';\nimport store from 'store';\nimport expirePlugin from 'store/plugins/expire';\n\n/**\n * Implementation of permanent storage using LocalStorage\n */\n@Injectable()\nexport class LocalPermanentStorageService implements PermanentStorage\n{\n //######################### constructor #########################\n\n constructor()\n {\n store.addPlugin(expirePlugin);\n }\n\n //######################### public methods - implementation of PermanentStorage #########################\n\n /**\n * Gets value that was stored with 'name' from permanent storage\n * @param name - Name with which was value stored\n */\n public get<TResult>(name: string): TResult\n {\n return store.get(name);\n }\n\n /**\n * Sets value that will be stored with 'name'e in permanent storage\n * @param name - Name with which will be value stored\n * @param value - Value to be stored\n */\n public set(name: string, value: any): void;\n\n /**\n * Sets value that will be stored with 'name' in permanent storage until expiration date\n * @param name - Name with which will be value stored\n * @param value - Value to be stored\n * @param expires - Time when value should expire\n */\n public set(name: string, value: any, expires: Date): void;\n\n /**\n * Sets value that will be stored with 'name' in permanent storage until expiration date\n * @param name - Name with which will be value stored\n * @param value - Value to be stored\n * @param expires - Time when value should expire\n */\n public set(name: string, value: any, expires?: Date): void\n {\n if(expires)\n {\n store.set(name, value, expires.valueOf());\n }\n else\n {\n store.set(name, value);\n }\n }\n\n /**\n * Removes value stored with 'name' from permanent storage\n * @param name - Name of stored value that will be removed\n */\n public remove(name: string): void\n {\n store.remove(name);\n }\n}\n\n/**\n * Provider for permanent storage that is using local storage implementation\n */\nconst LOCAL_PERMANENT_STORAGE: Provider =\n<ClassProvider>\n{\n provide: PERMANENT_STORAGE,\n useClass: LocalPermanentStorageService\n};\n\n/**\n * Type that contains provider for local permanent storage when used with `providePermanentStorage`\n */\n@TypeProvider(LOCAL_PERMANENT_STORAGE)\nclass LocalPermanentStorageType\n{\n}\n\n/**\n * Sets permanent storage to use local permanent storage when used with `providePermanentStorage`\n */\nexport const LocalPermanentStorage: PermanentStorageType = LocalPermanentStorageType;"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
1
2
|
import { Injectable } from '@angular/core';
|
|
3
|
+
import { TEMPORARY_STORAGE, TypeProvider } from '@anglr/common';
|
|
2
4
|
import store from 'store/storages/sessionStorage';
|
|
3
5
|
import * as i0 from "@angular/core";
|
|
4
6
|
/**
|
|
@@ -35,4 +37,23 @@ export { SessionTemporaryStorageService };
|
|
|
35
37
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SessionTemporaryStorageService, decorators: [{
|
|
36
38
|
type: Injectable
|
|
37
39
|
}] });
|
|
40
|
+
/**
|
|
41
|
+
* Provider for temporary storage that is using session storage implementation
|
|
42
|
+
*/
|
|
43
|
+
const SESSION_TEMPORARY_STORAGE = {
|
|
44
|
+
provide: TEMPORARY_STORAGE,
|
|
45
|
+
useClass: SessionTemporaryStorageService
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Type that contains provider for session temporary storage when used with `provideTemporaryStorage`
|
|
49
|
+
*/
|
|
50
|
+
let SessionTemporaryStorageType = class SessionTemporaryStorageType {
|
|
51
|
+
};
|
|
52
|
+
SessionTemporaryStorageType = __decorate([
|
|
53
|
+
TypeProvider(SESSION_TEMPORARY_STORAGE)
|
|
54
|
+
], SessionTemporaryStorageType);
|
|
55
|
+
/**
|
|
56
|
+
* Sets temporary storage to use session temporary storage when used with `provideTemporaryStorage`
|
|
57
|
+
*/
|
|
58
|
+
export const SessionTemporaryStorage = SessionTemporaryStorageType;
|
|
38
59
|
//# sourceMappingURL=sessionTemporaryStorage.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionTemporaryStorage.service.js","sourceRoot":"","sources":["../../../../../store/src/services/temporaryStorage/sessionTemporaryStorage.service.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sessionTemporaryStorage.service.js","sourceRoot":"","sources":["../../../../../store/src/services/temporaryStorage/sessionTemporaryStorage.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAgB,UAAU,EAAW,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,iBAAiB,EAA0C,YAAY,EAAC,MAAM,eAAe,CAAC;AACtG,OAAO,KAAK,MAAM,+BAA+B,CAAC;;AAElD;;GAEG;AACH,MACa,8BAA8B;IAEvC,yGAAyG;IAEzG;;;OAGG;IACI,GAAG,CAAU,IAAY;QAE5B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAQ,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAC,IAAY,EAAE,KAAU;QAE/B,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAY;QAEtB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;uGA9BQ,8BAA8B;2GAA9B,8BAA8B;;SAA9B,8BAA8B;2FAA9B,8BAA8B;kBAD1C,UAAU;;AAkCX;;GAEG;AACH,MAAM,yBAAyB,GAE/B;IACI,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,8BAA8B;CAC3C,CAAC;AAEF;;GAEG;AAEH,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;CAEhC,CAAA;AAFK,2BAA2B;IADhC,YAAY,CAAC,yBAAyB,CAAC;GAClC,2BAA2B,CAEhC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAyB,2BAA2B,CAAC","sourcesContent":["import {ClassProvider, Injectable, Provider} from '@angular/core';\nimport {TEMPORARY_STORAGE, TemporaryStorage, TemporaryStorageType, TypeProvider} from '@anglr/common';\nimport store from 'store/storages/sessionStorage';\n\n/**\n * Implementation of temporary storage using SessionStorage\n */\n@Injectable()\nexport class SessionTemporaryStorageService implements TemporaryStorage\n{\n //######################### public methods - implementation of TemporaryStorage #########################\n\n /**\n * Gets value that was stored with 'name' from temporary storage\n * @param name - Name with which was value stored\n */\n public get<TResult>(name: string): TResult\n {\n return store.read(name) as any;\n }\n\n /**\n * Sets value that will be stored with 'name'e in temporary storage\n * @param name - Name with which will be value stored\n * @param value - Value to be stored\n */\n public set(name: string, value: any): void\n {\n store.write(name, value);\n }\n\n /**\n * Removes value stored with 'name' from temporary storage\n * @param name - Name of stored value that will be removed\n */\n public remove(name: string): void\n {\n store.remove(name);\n }\n}\n\n/**\n * Provider for temporary storage that is using session storage implementation\n */\nconst SESSION_TEMPORARY_STORAGE: Provider =\n<ClassProvider>\n{\n provide: TEMPORARY_STORAGE,\n useClass: SessionTemporaryStorageService\n};\n\n/**\n * Type that contains provider for session temporary storage when used with `provideTemporaryStorage`\n */\n@TypeProvider(SESSION_TEMPORARY_STORAGE)\nclass SessionTemporaryStorageType\n{\n}\n\n/**\n * Sets temporary storage to use session temporary storage when used with `provideTemporaryStorage`\n */\nexport const SessionTemporaryStorage: TemporaryStorageType = SessionTemporaryStorageType;"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export * from './components/console/console.component.animations';
|
|
2
2
|
export * from './components/console/console.component';
|
|
3
3
|
export * from './modules/consoleLog.module';
|
|
4
|
+
export * from './misc/providers';
|
|
4
5
|
export * from './misc/utils';
|
|
5
6
|
export * from './types/tokens';
|
|
6
7
|
export * from './types/logger.interface';
|
|
7
8
|
export * from './services/console/consoleComponentSink.service';
|
|
8
9
|
export * from './services/console/consoleSinkConfig.service';
|
|
9
10
|
export * from './services/logger.service';
|
|
10
|
-
export * from './services/rest/
|
|
11
|
+
export * from './services/rest/restSink.options';
|
|
11
12
|
export * from './services/rest/restSink.service';
|
|
12
13
|
export * from './services/developerConsole/developerConsoleSink.options';
|
|
13
14
|
export * from './services/developerConsole/developerConsoleSink.service';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../structured-log/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC;AAClE,cAAc,wCAAwC,CAAC;AACvD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iDAAiD,CAAC;AAChE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../structured-log/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC;AAClE,cAAc,wCAAwC,CAAC;AACvD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iDAAiD,CAAC;AAChE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0DAA0D,CAAC;AACzE,cAAc,0DAA0D,CAAC","sourcesContent":["export * from './components/console/console.component.animations';\nexport * from './components/console/console.component';\nexport * from './modules/consoleLog.module';\nexport * from './misc/providers';\nexport * from './misc/utils';\nexport * from './types/tokens';\nexport * from './types/logger.interface';\nexport * from './services/console/consoleComponentSink.service';\nexport * from './services/console/consoleSinkConfig.service';\nexport * from './services/logger.service';\nexport * from './services/rest/restSink.options';\nexport * from './services/rest/restSink.service';\nexport * from './services/developerConsole/developerConsoleSink.options';\nexport * from './services/developerConsole/developerConsoleSink.service';\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { makeEnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { CONSOLE_COMPONENT_SINK, CONSOLE_COMPONENT_SINK_SERVICE_PROVIDER } from '../types/tokens';
|
|
3
|
+
/**
|
|
4
|
+
* Provides console component as sink for logger
|
|
5
|
+
*/
|
|
6
|
+
export function provideConsoleComponentSink() {
|
|
7
|
+
return makeEnvironmentProviders([
|
|
8
|
+
CONSOLE_COMPONENT_SINK_SERVICE_PROVIDER,
|
|
9
|
+
CONSOLE_COMPONENT_SINK,
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../../structured-log/src/misc/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAC,sBAAsB,EAAE,uCAAuC,EAAC,MAAM,iBAAiB,CAAC;AAEhG;;GAEG;AACH,MAAM,UAAU,2BAA2B;IAEvC,OAAO,wBAAwB,CAC/B;QACI,uCAAuC;QACvC,sBAAsB;KACzB,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';\n\nimport {CONSOLE_COMPONENT_SINK, CONSOLE_COMPONENT_SINK_SERVICE_PROVIDER} from '../types/tokens';\n\n/**\n * Provides console component as sink for logger\n */\nexport function provideConsoleComponentSink(): EnvironmentProviders\n{\n return makeEnvironmentProviders(\n [\n CONSOLE_COMPONENT_SINK_SERVICE_PROVIDER,\n CONSOLE_COMPONENT_SINK,\n ]);\n}"]}
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { ConsoleComponent } from '../components/console/console.component';
|
|
4
|
-
import { CONSOLE_COMPONENT_SINK, STRUCTURED_LOG_LOGGER, CONSOLE_COMPONENT_SINK_SERVICE_PROVIDER } from '../types/tokens';
|
|
5
4
|
import * as i0 from "@angular/core";
|
|
6
5
|
/**
|
|
7
6
|
* Module containing component Console (log)
|
|
8
7
|
*/
|
|
9
8
|
class ConsoleLogModule {
|
|
10
|
-
//######################### public methods #########################
|
|
11
|
-
/**
|
|
12
|
-
* Registers structured-log as logger service, with console component sink
|
|
13
|
-
*/
|
|
14
|
-
static forRoot() {
|
|
15
|
-
return {
|
|
16
|
-
ngModule: ConsoleLogModule,
|
|
17
|
-
providers: [
|
|
18
|
-
CONSOLE_COMPONENT_SINK_SERVICE_PROVIDER,
|
|
19
|
-
CONSOLE_COMPONENT_SINK,
|
|
20
|
-
STRUCTURED_LOG_LOGGER
|
|
21
|
-
]
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
9
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ConsoleLogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
25
10
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.4", ngImport: i0, type: ConsoleLogModule, declarations: [ConsoleComponent], imports: [CommonModule], exports: [ConsoleComponent] });
|
|
26
11
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ConsoleLogModule, imports: [CommonModule] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consoleLog.module.js","sourceRoot":"","sources":["../../../../structured-log/src/modules/consoleLog.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"consoleLog.module.js","sourceRoot":"","sources":["../../../../structured-log/src/modules/consoleLog.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,yCAAyC,CAAC;;AAEzE;;GAEG;AACH,MAea,gBAAgB;uGAAhB,gBAAgB;wGAAhB,gBAAgB,iBAPrB,gBAAgB,aAJhB,YAAY,aAQZ,gBAAgB;wGAGX,gBAAgB,YAXrB,YAAY;;SAWP,gBAAgB;2FAAhB,gBAAgB;kBAf5B,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,YAAY;qBACf;oBACD,YAAY,EACZ;wBACI,gBAAgB;qBACnB;oBACD,OAAO,EACP;wBACI,gBAAgB;qBACnB;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\n\nimport {ConsoleComponent} from '../components/console/console.component';\n\n/**\n * Module containing component Console (log)\n */\n@NgModule(\n{\n imports:\n [\n CommonModule\n ],\n declarations:\n [\n ConsoleComponent\n ],\n exports:\n [\n ConsoleComponent\n ]\n})\nexport class ConsoleLogModule\n{\n}"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
1
2
|
import { Injectable, Inject } from '@angular/core';
|
|
3
|
+
import { LOGGER, TypeProvider } from '@anglr/common';
|
|
2
4
|
import { configure } from 'structured-log';
|
|
3
5
|
import { LOGGER_SINKS } from '../types/tokens';
|
|
4
6
|
import * as i0 from "@angular/core";
|
|
@@ -47,4 +49,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
|
|
|
47
49
|
type: Inject,
|
|
48
50
|
args: [LOGGER_SINKS]
|
|
49
51
|
}] }]; } });
|
|
52
|
+
/**
|
|
53
|
+
* Provider for logger that is using structured log implementation
|
|
54
|
+
*/
|
|
55
|
+
const STRUCTURED_LOG_LOGGER = {
|
|
56
|
+
provide: LOGGER,
|
|
57
|
+
useClass: LoggerService
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Type that contains provider for structured log logger when used with `provideLogger`
|
|
61
|
+
*/
|
|
62
|
+
let StructuredLogLoggerType = class StructuredLogLoggerType {
|
|
63
|
+
};
|
|
64
|
+
StructuredLogLoggerType = __decorate([
|
|
65
|
+
TypeProvider(STRUCTURED_LOG_LOGGER)
|
|
66
|
+
], StructuredLogLoggerType);
|
|
67
|
+
/**
|
|
68
|
+
* Sets logger to use structured log logger when used with `provideLogger`
|
|
69
|
+
*/
|
|
70
|
+
export const StructuredLogLogger = StructuredLogLoggerType;
|
|
50
71
|
//# sourceMappingURL=logger.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.service.js","sourceRoot":"","sources":["../../../../structured-log/src/services/logger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.service.js","sourceRoot":"","sources":["../../../../structured-log/src/services/logger.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAA0B,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAC,MAAM,EAA2C,YAAY,EAAC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAC,SAAS,EAAe,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;AACH,MACa,aAAa;IAEtB,oEAAoE;IAEpE;;OAEG;IACK,OAAO,CAAS;IAExB,iEAAiE;IACjE,YAAkC,KAAa;QAE3C,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC;QAElC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAEjB,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC;IAC1C,CAAC;IAmBD,KAAK,CAAC,sBAA2B,EAAE,GAAG,UAAiB;QAEnD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAiBD,KAAK,CAAC,sBAA2B,EAAE,GAAG,UAAiB;QAEnD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAiBD,IAAI,CAAC,sBAA2B,EAAE,GAAG,UAAiB;QAElD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAiBD,IAAI,CAAC,sBAA2B,EAAE,GAAG,UAAiB;QAElD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAiBD,KAAK,CAAC,sBAA2B,EAAE,GAAG,UAAiB;QAEnD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAiBD,OAAO,CAAC,sBAA2B,EAAE,GAAG,UAAiB;QAErD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IAC7D,CAAC;uGA9IQ,aAAa,kBAUF,YAAY;2GAVvB,aAAa;;SAAb,aAAa;2FAAb,aAAa;kBADzB,UAAU;;0BAWM,MAAM;2BAAC,YAAY;;AAuIpC;;GAEG;AACH,MAAM,qBAAqB,GAE3B;IACI,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,aAAa;CAC1B,CAAC;AAEF;;GAEG;AAEH,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CAE5B,CAAA;AAFK,uBAAuB;IAD5B,YAAY,CAAC,qBAAqB,CAAC;GAC9B,uBAAuB,CAE5B;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAiB,uBAAuB,CAAC","sourcesContent":["import {Injectable, Inject, Provider, ClassProvider} from '@angular/core';\nimport {LOGGER, Logger as LoggerInterface, PositionType, TypeProvider} from '@anglr/common';\nimport {configure, Sink, Logger} from 'structured-log';\n\nimport {LOGGER_SINKS} from '../types/tokens';\n\n/**\n * Service used for logging using structured-log\n */\n@Injectable()\nexport class LoggerService implements LoggerInterface\n{\n //######################### private fields #########################\n\n /**\n * Currently used instance of logger\n */\n private _logger: Logger;\n\n //######################### constructor #########################\n constructor(@Inject(LOGGER_SINKS) sinks: Sink[])\n {\n const configuration = configure();\n\n sinks.forEach(sink =>\n {\n configuration.writeTo(sink);\n });\n\n this._logger = configuration.create();\n }\n\n //######################### public methods #########################\n\n /**\n * Logs an event with the LogEventLevel.fatal severity.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n fatal(messageTemplate: string, ...properties: any[]): void;\n\n /**\n * Logs an event with the LogEventLevel.fatal severity.\n * @param error - Error for the log event.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n fatal(error: Error, messageTemplate: string, ...properties: any[]): void;\n\n fatal(errorOrMessageTemplate: any, ...properties: any[]): void\n {\n this._logger.fatal(errorOrMessageTemplate, properties);\n }\n\n /**\n * Logs an event with the LogEventLevel.error severity.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n error(messageTemplate: string, ...properties: any[]): void;\n\n /**\n * Logs an event with the LogEventLevel.error severity.\n * @param error - Error for the log event.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n error(error: Error, messageTemplate: string, ...properties: any[]): void;\n\n error(errorOrMessageTemplate: any, ...properties: any[]): void\n {\n this._logger.error(errorOrMessageTemplate, properties);\n }\n\n /**\n * Logs an event with the LogEventLevel.warning severity.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n warn(messageTemplate: string, ...properties: any[]): void;\n\n /**\n * Logs an event with the LogEventLevel.warning severity.\n * @param error - Error for the log event.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n warn(error: Error, messageTemplate: string, ...properties: any[]): void;\n\n warn(errorOrMessageTemplate: any, ...properties: any[]): void\n {\n this._logger.warn(errorOrMessageTemplate, properties);\n }\n\n /**\n * Logs an event with the LogEventLevel.information severity.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n info(messageTemplate: string, ...properties: any[]): void;\n\n /**\n * Logs an event with the LogEventLevel.information severity.\n * @param error - Error for the log event.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n info(error: Error, messageTemplate: string, ...properties: any[]): void;\n\n info(errorOrMessageTemplate: any, ...properties: any[]): void\n {\n this._logger.info(errorOrMessageTemplate, properties);\n }\n\n /**\n * Logs an event with the LogEventLevel.debug severity.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n debug(messageTemplate: string, ...properties: any[]): void;\n\n /**\n * Logs an event with the LogEventLevel.debug severity.\n * @param error - Error for the log event.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n debug(error: Error, messageTemplate: string, ...properties: any[]): void;\n\n debug(errorOrMessageTemplate: any, ...properties: any[]): void\n {\n this._logger.debug(errorOrMessageTemplate, properties);\n }\n\n /**\n * Logs an event with the LogEventLevel.verbose severity.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n verbose(messageTemplate: string, ...properties: any[]): void;\n\n /**\n * Logs an event with the LogEventLevel.verbose severity.\n * @param error - Error for the log event.\n * @param messageTemplate - Message template for the log event.\n * @param properties - Properties that can be used to render the message template.\n */\n verbose(error: Error, messageTemplate: string, ...properties: any[]): void;\n\n verbose(errorOrMessageTemplate: any, ...properties: any[]): void\n {\n this._logger.verbose(errorOrMessageTemplate, properties);\n }\n}\n\n/**\n * Provider for logger that is using structured log implementation\n */\nconst STRUCTURED_LOG_LOGGER: Provider =\n<ClassProvider>\n{\n provide: LOGGER,\n useClass: LoggerService\n};\n\n/**\n * Type that contains provider for structured log logger when used with `provideLogger`\n */\n@TypeProvider(STRUCTURED_LOG_LOGGER)\nclass StructuredLogLoggerType\n{\n}\n\n/**\n * Sets logger to use structured log logger when used with `provideLogger`\n */\nexport const StructuredLogLogger: PositionType = StructuredLogLoggerType;"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isPresent } from '@jscrpt/common';
|
|
2
|
+
import { LogEventLevel } from 'structured-log';
|
|
3
|
+
/**
|
|
4
|
+
* Options for rest sink
|
|
5
|
+
*/
|
|
6
|
+
export class RestSinkOptions {
|
|
7
|
+
//######################### public properties #########################
|
|
8
|
+
/**
|
|
9
|
+
* Number of seconds after which should be flush called
|
|
10
|
+
*/
|
|
11
|
+
secondsToFlushAfter = 300;
|
|
12
|
+
/**
|
|
13
|
+
* Number of logs after which should be flush called
|
|
14
|
+
*/
|
|
15
|
+
flushAfterNumberOfLogs = 50;
|
|
16
|
+
/**
|
|
17
|
+
* Minimal log level that will be flushed immediately
|
|
18
|
+
*/
|
|
19
|
+
immediateFlushMinLevel = LogEventLevel.error;
|
|
20
|
+
/**
|
|
21
|
+
* Restricts logs to specified level
|
|
22
|
+
*/
|
|
23
|
+
restrictToLevel = LogEventLevel.warning;
|
|
24
|
+
//######################### constructor #########################
|
|
25
|
+
constructor(secondsToFlushAfter, flushAfterNumberOfLogs, immediateFlushMinLevel, restrictToLevel) {
|
|
26
|
+
if (isPresent(secondsToFlushAfter)) {
|
|
27
|
+
this.secondsToFlushAfter = secondsToFlushAfter;
|
|
28
|
+
}
|
|
29
|
+
if (isPresent(flushAfterNumberOfLogs)) {
|
|
30
|
+
this.flushAfterNumberOfLogs = flushAfterNumberOfLogs;
|
|
31
|
+
}
|
|
32
|
+
if (isPresent(immediateFlushMinLevel)) {
|
|
33
|
+
this.immediateFlushMinLevel = immediateFlushMinLevel;
|
|
34
|
+
}
|
|
35
|
+
if (isPresent(restrictToLevel)) {
|
|
36
|
+
this.restrictToLevel = restrictToLevel;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=restSink.options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restSink.options.js","sourceRoot":"","sources":["../../../../../structured-log/src/services/rest/restSink.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAE7C;;GAEG;AACH,MAAM,OAAO,eAAe;IAExB,uEAAuE;IAEvE;;OAEG;IACI,mBAAmB,GAAW,GAAG,CAAC;IAEzC;;OAEG;IACI,sBAAsB,GAAW,EAAE,CAAC;IAE3C;;OAEG;IACI,sBAAsB,GAAkB,aAAa,CAAC,KAAK,CAAC;IAEnE;;OAEG;IACI,eAAe,GAAkB,aAAa,CAAC,OAAO,CAAC;IAE9D,iEAAiE;IACjE,YAAY,mBAA4B,EAC5B,sBAA+B,EAC/B,sBAAsC,EACtC,eAA+B;QAEvC,IAAG,SAAS,CAAC,mBAAmB,CAAC,EACjC;YACI,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;SAClD;QAED,IAAG,SAAS,CAAC,sBAAsB,CAAC,EACpC;YACI,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;SACxD;QAED,IAAG,SAAS,CAAC,sBAAsB,CAAC,EACpC;YACI,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;SACxD;QAED,IAAG,SAAS,CAAC,eAAe,CAAC,EAC7B;YACI,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;SAC1C;IACL,CAAC;CACJ","sourcesContent":["import {isPresent} from '@jscrpt/common';\nimport {LogEventLevel} from 'structured-log';\n\n/**\n * Options for rest sink\n */\nexport class RestSinkOptions\n{\n //######################### public properties #########################\n\n /**\n * Number of seconds after which should be flush called\n */\n public secondsToFlushAfter: number = 300;\n\n /**\n * Number of logs after which should be flush called\n */\n public flushAfterNumberOfLogs: number = 50;\n\n /**\n * Minimal log level that will be flushed immediately\n */\n public immediateFlushMinLevel: LogEventLevel = LogEventLevel.error;\n\n /**\n * Restricts logs to specified level\n */\n public restrictToLevel: LogEventLevel = LogEventLevel.warning;\n\n //######################### constructor #########################\n constructor(secondsToFlushAfter?: number,\n flushAfterNumberOfLogs?: number,\n immediateFlushMinLevel?: LogEventLevel,\n restrictToLevel?: LogEventLevel,)\n {\n if(isPresent(secondsToFlushAfter))\n {\n this.secondsToFlushAfter = secondsToFlushAfter;\n }\n\n if(isPresent(flushAfterNumberOfLogs))\n {\n this.flushAfterNumberOfLogs = flushAfterNumberOfLogs;\n }\n\n if(isPresent(immediateFlushMinLevel))\n {\n this.immediateFlushMinLevel = immediateFlushMinLevel;\n }\n\n if(isPresent(restrictToLevel))\n {\n this.restrictToLevel = restrictToLevel;\n }\n }\n}\n"]}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { Injectable, Inject } from '@angular/core';
|
|
1
|
+
import { Injectable, Inject, Optional } from '@angular/core';
|
|
2
2
|
import { APP_STABLE } from '@anglr/common';
|
|
3
3
|
import { isPresent } from '@jscrpt/common';
|
|
4
4
|
import { LogEventLevel } from 'structured-log';
|
|
5
5
|
import { lastValueFrom } from 'rxjs';
|
|
6
6
|
import { toText, isEnabled } from '../../misc/utils';
|
|
7
|
-
import {
|
|
7
|
+
import { RestSinkOptions } from './restSink.options';
|
|
8
8
|
import { LOGGER_REST_CLIENT } from '../../types/tokens';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
|
-
import * as i1 from "./
|
|
10
|
+
import * as i1 from "./restSink.options";
|
|
11
11
|
/**
|
|
12
12
|
* Sink that is used for storing logs using REST
|
|
13
13
|
*/
|
|
14
14
|
class RestSinkService {
|
|
15
|
-
_configSvc;
|
|
16
15
|
_restClient;
|
|
17
16
|
//######################### private fields #########################
|
|
18
17
|
/**
|
|
@@ -27,14 +26,23 @@ class RestSinkService {
|
|
|
27
26
|
* Interval timer id
|
|
28
27
|
*/
|
|
29
28
|
_timer;
|
|
29
|
+
/**
|
|
30
|
+
* Configuration options for rest sink
|
|
31
|
+
*/
|
|
32
|
+
_config;
|
|
30
33
|
//######################### constructor #########################
|
|
31
|
-
constructor(
|
|
32
|
-
this._configSvc = _configSvc;
|
|
34
|
+
constructor(isStable, _restClient, config) {
|
|
33
35
|
this._restClient = _restClient;
|
|
36
|
+
if (!config || !(config instanceof RestSinkOptions)) {
|
|
37
|
+
this._config = new RestSinkOptions();
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this._config = config;
|
|
41
|
+
}
|
|
34
42
|
isStable.then(() => {
|
|
35
43
|
this._timer = setInterval(() => {
|
|
36
44
|
this.flush();
|
|
37
|
-
}, (this.
|
|
45
|
+
}, (this._config.secondsToFlushAfter ?? 0) * 1000);
|
|
38
46
|
});
|
|
39
47
|
}
|
|
40
48
|
//######################### public methods - implementation of OnDestroy #########################
|
|
@@ -62,7 +70,7 @@ class RestSinkService {
|
|
|
62
70
|
this._updatePrototype(e);
|
|
63
71
|
this._prototypeUpdated = true;
|
|
64
72
|
}
|
|
65
|
-
if (!isEnabled(this.
|
|
73
|
+
if (!isEnabled(this._config.restrictToLevel, e.level)) {
|
|
66
74
|
return;
|
|
67
75
|
}
|
|
68
76
|
const logLevel = LogEventLevel[e.level].toUpperCase();
|
|
@@ -73,12 +81,12 @@ class RestSinkService {
|
|
|
73
81
|
message,
|
|
74
82
|
timestamp
|
|
75
83
|
});
|
|
76
|
-
if (isEnabled(this.
|
|
84
|
+
if (isEnabled(this._config.immediateFlushMinLevel, e.level)) {
|
|
77
85
|
forceFlush = true;
|
|
78
86
|
}
|
|
79
87
|
});
|
|
80
88
|
//flush if number of records is bigger than max or flush is required
|
|
81
|
-
if (forceFlush || this._logs.length >= this.
|
|
89
|
+
if (forceFlush || this._logs.length >= this._config.flushAfterNumberOfLogs) {
|
|
82
90
|
this.flush();
|
|
83
91
|
}
|
|
84
92
|
}
|
|
@@ -110,17 +118,19 @@ class RestSinkService {
|
|
|
110
118
|
messageTemplateInstance.constructor.prototype.toText = toText;
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RestSinkService, deps: [{ token:
|
|
121
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RestSinkService, deps: [{ token: APP_STABLE }, { token: LOGGER_REST_CLIENT }, { token: i1.RestSinkOptions, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
114
122
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RestSinkService });
|
|
115
123
|
}
|
|
116
124
|
export { RestSinkService };
|
|
117
125
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RestSinkService, decorators: [{
|
|
118
126
|
type: Injectable
|
|
119
|
-
}], ctorParameters: function () { return [{ type:
|
|
127
|
+
}], ctorParameters: function () { return [{ type: Promise, decorators: [{
|
|
120
128
|
type: Inject,
|
|
121
129
|
args: [APP_STABLE]
|
|
122
130
|
}] }, { type: undefined, decorators: [{
|
|
123
131
|
type: Inject,
|
|
124
132
|
args: [LOGGER_REST_CLIENT]
|
|
133
|
+
}] }, { type: i1.RestSinkOptions, decorators: [{
|
|
134
|
+
type: Optional
|
|
125
135
|
}] }]; } });
|
|
126
136
|
//# sourceMappingURL=restSink.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restSink.service.js","sourceRoot":"","sources":["../../../../../structured-log/src/services/rest/restSink.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"restSink.service.js","sourceRoot":"","sources":["../../../../../structured-log/src/services/rest/restSink.service.ts"],"names":[],"mappings":"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","sourcesContent":["import {Injectable, Inject, Optional} from '@angular/core';\nimport {APP_STABLE} from '@anglr/common';\nimport {isPresent} from '@jscrpt/common';\nimport {Sink, LogEvent, LogEventLevel} from 'structured-log';\nimport {lastValueFrom} from 'rxjs';\n\nimport {toText, isEnabled} from '../../misc/utils';\nimport {RestSinkOptions} from './restSink.options';\nimport {LOGGER_REST_CLIENT} from '../../types/tokens';\nimport {LoggerRestClient, RestLog} from '../../types/logger.interface';\n\n/**\n * Sink that is used for storing logs using REST\n */\n@Injectable()\nexport class RestSinkService implements Sink\n{\n //######################### private fields #########################\n\n /**\n * Indication that prototype of MessageTemplate was updated\n */\n private _prototypeUpdated: boolean = false;\n\n /**\n * Array of unflushed logs\n */\n private _logs: RestLog[] = [];\n\n /**\n * Interval timer id\n */\n private _timer: number|undefined|null;\n\n /**\n * Configuration options for rest sink\n */\n private _config: RestSinkOptions;\n\n //######################### constructor #########################\n constructor(@Inject(APP_STABLE) isStable: Promise<void>,\n @Inject(LOGGER_REST_CLIENT) private _restClient: LoggerRestClient,\n @Optional() config?: RestSinkOptions,)\n {\n if(!config || !(config instanceof RestSinkOptions))\n {\n this._config = new RestSinkOptions();\n }\n else\n {\n this._config = config;\n }\n\n isStable.then(() =>\n {\n this._timer = setInterval(() =>\n {\n this.flush();\n }, (this._config.secondsToFlushAfter ?? 0) * 1000) as any;\n });\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n if(isPresent(this._timer))\n {\n clearInterval(this._timer);\n }\n\n this.flush();\n }\n\n //######################### public methods - implementation of Sink #########################\n\n /**\n * Emits events into log\n * @param events - Events to be emitted\n */\n public emit(events: LogEvent[]): void\n {\n if(!events || !events.length)\n {\n return;\n }\n\n let forceFlush = false;\n\n events.forEach(e =>\n {\n if(!this._prototypeUpdated)\n {\n this._updatePrototype(e);\n\n this._prototypeUpdated = true;\n }\n\n if (!isEnabled(this._config.restrictToLevel, e.level))\n {\n return;\n }\n\n const logLevel = LogEventLevel[e.level].toUpperCase();\n const timestamp = e.timestamp;\n const message = e.messageTemplate.render(e.properties);\n\n this._logs.push(\n {\n logLevel,\n message,\n timestamp\n });\n\n if (isEnabled(this._config.immediateFlushMinLevel, e.level))\n {\n forceFlush = true;\n }\n });\n\n //flush if number of records is bigger than max or flush is required\n if(forceFlush || this._logs.length >= this._config.flushAfterNumberOfLogs)\n {\n this.flush();\n }\n }\n\n /**\n * Flushes logs\n */\n public flush(): Promise<void>\n {\n let promise: Promise<void>|undefined;\n\n //no logs available\n if(!this._logs.length)\n {\n return Promise.resolve();\n }\n\n try\n {\n promise = lastValueFrom(this._restClient.log(this._logs));\n }\n catch(e)\n {\n console.log(e);\n }\n\n this._logs = [];\n\n return promise ?? Promise.resolve();\n }\n\n //######################### private methods #########################\n\n /**\n * Updates prototype of MessageTemplate\n */\n private _updatePrototype(e: LogEvent): void\n {\n const messageTemplateInstance = (<any>e.messageTemplate);\n\n if(messageTemplateInstance.constructor && messageTemplateInstance.constructor.prototype && messageTemplateInstance.constructor.prototype.toText)\n {\n messageTemplateInstance.constructor.prototype.toText = toText;\n }\n }\n}"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { LOGGER } from '@anglr/common';
|
|
3
2
|
import { ConsoleComponentSinkService } from '../services/console/consoleComponentSink.service';
|
|
4
|
-
import { LoggerService } from '../services/logger.service';
|
|
5
3
|
import { ConsoleSinkConfigService } from '../services/console/consoleSinkConfig.service';
|
|
6
4
|
import { RestSinkService } from '../services/rest/restSink.service';
|
|
7
5
|
import { DeveloperConsoleSinkService } from '../services/developerConsole/developerConsoleSink.service';
|
|
@@ -55,11 +53,4 @@ export const DEVELOPER_CONSOLE_SINK = {
|
|
|
55
53
|
useClass: DeveloperConsoleSinkService,
|
|
56
54
|
multi: true
|
|
57
55
|
};
|
|
58
|
-
/**
|
|
59
|
-
* Provider for logger that is using structured log implementation
|
|
60
|
-
*/
|
|
61
|
-
export const STRUCTURED_LOG_LOGGER = {
|
|
62
|
-
provide: LOGGER,
|
|
63
|
-
useClass: LoggerService
|
|
64
|
-
};
|
|
65
56
|
//# sourceMappingURL=tokens.js.map
|