@o3r/logger 12.1.10 → 12.1.11
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/fesm2022/o3r-logger-services-logrocket-logger-client.mjs.map +1 -1
- package/fesm2022/o3r-logger.mjs +7 -7
- package/fesm2022/o3r-logger.mjs.map +1 -1
- package/package.json +12 -8
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +28 -3
- package/schematics/ng-add/index.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o3r-logger-services-logrocket-logger-client.mjs","sources":["../../src/services/logrocket-logger-client/logrocket-logger-client.ts","../../src/services/logrocket-logger-client/o3r-logger-services-logrocket-logger-client.ts"],"sourcesContent":["import {\n Action,\n MetaReducer,\n} from '@ngrx/store';\nimport * as LogRocket from 'logrocket';\nimport createNgrxMiddleware, {\n Options,\n} from 'logrocket-ngrx';\nimport type {\n LoggerClient,\n} from '@o3r/logger';\n\n/**\n * LogRocket client.\n */\nexport class LogRocketClient implements LoggerClient {\n /**\n * Meta reducer configuration to change what store related items LogRocket records\n */\n private readonly metaReducerOptions?: Options;\n\n /**\n * Constructor.\n * @param appId LogROcket application ID\n * @param initOptions Optional configuration to change what LogRocket records\n * @param metaReducerOptions Optional meta reducer configuration to change what store related items LogRocket records\n */\n constructor(appId: string, initOptions?: any, metaReducerOptions?: Options) {\n const defaultOptions = {\n network: {\n requestSanitizer: (request: Request) => {\n // if the url contains '/purchase/orders'\n if (request.url.toLowerCase().includes('/purchase/orders')) {\n // scrub out the body\n return { ...request, body: '' };\n }\n return request;\n }\n }\n };\n\n LogRocket.init(appId, { ...defaultOptions, ...initOptions });\n this.metaReducerOptions = metaReducerOptions;\n }\n\n /**\n * @inheritdoc\n */\n public identify(uid: string, vars?: { [key: string]: string }): void {\n LogRocket.identify(uid, vars);\n }\n\n /**\n * @inheritdoc\n */\n public event(name: string, properties?: any): void {\n const trackEvent = properties ? `${name}: ${properties as string}` : name;\n LogRocket.track(trackEvent);\n }\n\n /**\n * @inheritdoc\n */\n public error(message?: any, ...optionalParams: any[]): void {\n LogRocket.error(message, optionalParams);\n }\n\n /**\n * @inheritdoc\n */\n public warn(message?: any, ...optionalParams: any[]): void {\n LogRocket.warn(message, ...optionalParams);\n }\n\n /**\n * @inheritdoc\n */\n public log(message?: any, ...optionalParams: any[]): void {\n LogRocket.log(message, ...optionalParams);\n }\n\n /**\n * @inheritdoc\n */\n public getSessionURL(): string | undefined {\n return LogRocket.sessionURL || undefined;\n }\n\n /**\n * @inheritdoc\n */\n public stopRecording(): void {\n // eslint-disable-next-line no-console -- we don't want to log this Error on LogRocket as it's when LogRocket is wrongly used\n console.error('Impossible to stop recording with LogRocket');\n }\n\n /**\n * @inheritdoc\n */\n public resumeRecording(): void {\n // eslint-disable-next-line no-console -- we don't want to log this Error on LogRocket as it's when LogRocket is wrongly used\n console.error('Impossible to restart recording with LogRocket.');\n }\n\n /**\n * @inheritdoc\n */\n public createMetaReducer(): MetaReducer<any, Action> {\n const defaultOptions = {\n actionSanitizer: (action: Action) => {\n // Filter @ngrx actions\n if (action.type.startsWith('@ngrx/')) {\n return null;\n }\n return action;\n }\n };\n return createNgrxMiddleware(LogRocket, { ...defaultOptions, ...this.metaReducerOptions });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;AAYA;;AAEG;MACU,eAAe,CAAA;AAM1B;;;;;AAKG;AACH,IAAA,WAAA,CAAY,KAAa,EAAE,WAAiB,EAAE,kBAA4B,EAAA;AACxE,QAAA,MAAM,cAAc,GAAG;AACrB,YAAA,OAAO,EAAE;AACP,gBAAA,gBAAgB,EAAE,CAAC,OAAgB,KAAI;;AAErC,oBAAA,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE;;wBAE1D,OAAO,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;;AAEjC,oBAAA,OAAO,OAAO;;AAEjB;SACF;AAED,QAAA,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,WAAW,EAAE,CAAC;AAC5D,QAAA,IAAI,CAAC,kBAAkB,GAAG,kBAAkB;;AAG9C;;AAEG;IACI,QAAQ,CAAC,GAAW,EAAE,IAAgC,EAAA;AAC3D,QAAA,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;;AAG/B;;AAEG;IACI,KAAK,CAAC,IAAY,EAAE,UAAgB,EAAA;AACzC,QAAA,MAAM,UAAU,GAAG,UAAU,GAAG,CAAA,EAAG,IAAI,CAAA,EAAA,EAAK,UAAoB,CAAE,
|
|
1
|
+
{"version":3,"file":"o3r-logger-services-logrocket-logger-client.mjs","sources":["../../src/services/logrocket-logger-client/logrocket-logger-client.ts","../../src/services/logrocket-logger-client/o3r-logger-services-logrocket-logger-client.ts"],"sourcesContent":["import {\n Action,\n MetaReducer,\n} from '@ngrx/store';\nimport * as LogRocket from 'logrocket';\nimport createNgrxMiddleware, {\n Options,\n} from 'logrocket-ngrx';\nimport type {\n LoggerClient,\n} from '@o3r/logger';\n\n/**\n * LogRocket client.\n */\nexport class LogRocketClient implements LoggerClient {\n /**\n * Meta reducer configuration to change what store related items LogRocket records\n */\n private readonly metaReducerOptions?: Options;\n\n /**\n * Constructor.\n * @param appId LogROcket application ID\n * @param initOptions Optional configuration to change what LogRocket records\n * @param metaReducerOptions Optional meta reducer configuration to change what store related items LogRocket records\n */\n constructor(appId: string, initOptions?: any, metaReducerOptions?: Options) {\n const defaultOptions = {\n network: {\n requestSanitizer: (request: Request) => {\n // if the url contains '/purchase/orders'\n if (request.url.toLowerCase().includes('/purchase/orders')) {\n // scrub out the body\n return { ...request, body: '' };\n }\n return request;\n }\n }\n };\n\n LogRocket.init(appId, { ...defaultOptions, ...initOptions });\n this.metaReducerOptions = metaReducerOptions;\n }\n\n /**\n * @inheritdoc\n */\n public identify(uid: string, vars?: { [key: string]: string }): void {\n LogRocket.identify(uid, vars);\n }\n\n /**\n * @inheritdoc\n */\n public event(name: string, properties?: any): void {\n const trackEvent = properties ? `${name}: ${properties as string}` : name;\n LogRocket.track(trackEvent);\n }\n\n /**\n * @inheritdoc\n */\n public error(message?: any, ...optionalParams: any[]): void {\n LogRocket.error(message, optionalParams);\n }\n\n /**\n * @inheritdoc\n */\n public warn(message?: any, ...optionalParams: any[]): void {\n LogRocket.warn(message, ...optionalParams);\n }\n\n /**\n * @inheritdoc\n */\n public log(message?: any, ...optionalParams: any[]): void {\n LogRocket.log(message, ...optionalParams);\n }\n\n /**\n * @inheritdoc\n */\n public getSessionURL(): string | undefined {\n return LogRocket.sessionURL || undefined;\n }\n\n /**\n * @inheritdoc\n */\n public stopRecording(): void {\n // eslint-disable-next-line no-console -- we don't want to log this Error on LogRocket as it's when LogRocket is wrongly used\n console.error('Impossible to stop recording with LogRocket');\n }\n\n /**\n * @inheritdoc\n */\n public resumeRecording(): void {\n // eslint-disable-next-line no-console -- we don't want to log this Error on LogRocket as it's when LogRocket is wrongly used\n console.error('Impossible to restart recording with LogRocket.');\n }\n\n /**\n * @inheritdoc\n */\n public createMetaReducer(): MetaReducer<any, Action> {\n const defaultOptions = {\n actionSanitizer: (action: Action) => {\n // Filter @ngrx actions\n if (action.type.startsWith('@ngrx/')) {\n return null;\n }\n return action;\n }\n };\n return createNgrxMiddleware(LogRocket, { ...defaultOptions, ...this.metaReducerOptions });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;AAYA;;AAEG;MACU,eAAe,CAAA;AAM1B;;;;;AAKG;AACH,IAAA,WAAA,CAAY,KAAa,EAAE,WAAiB,EAAE,kBAA4B,EAAA;AACxE,QAAA,MAAM,cAAc,GAAG;AACrB,YAAA,OAAO,EAAE;AACP,gBAAA,gBAAgB,EAAE,CAAC,OAAgB,KAAI;;AAErC,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G9D;;AAEG;IACI,eAAe,GAAA;;AAEpB,QAAA,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC;;AAGlE;;AAEG;IACI,iBAAiB,GAAA;AACtB,QAAA,MAAM,cAAc,GAAG;AACrB,YAAA,eAAe,EAAE,CAAC,MAAc,KAAI;;gBAElC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;AACpC,oBAAA,OAAO,IAAI;;AAEb,gBAAA,OAAO,MAAM;;SAEhB;AACD,QAAA,OAAO,oBAAoB,CAAC,SAAS,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;;AAE5F;;ACvHD;;AAEG;;;;"}
|
package/fesm2022/o3r-logger.mjs
CHANGED
|
@@ -169,10 +169,10 @@ class LoggerService {
|
|
|
169
169
|
.filter((metaReducer) => !!metaReducer);
|
|
170
170
|
return metaReducers.length <= 1 ? metaReducers[0] : metaReducers;
|
|
171
171
|
}
|
|
172
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
173
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.
|
|
172
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoggerService, deps: [{ token: LOGGER_CLIENT_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
173
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoggerService, providedIn: 'root' }); }
|
|
174
174
|
}
|
|
175
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoggerService, decorators: [{
|
|
176
176
|
type: Injectable,
|
|
177
177
|
args: [{
|
|
178
178
|
providedIn: 'root'
|
|
@@ -200,13 +200,13 @@ class LoggerModule {
|
|
|
200
200
|
]
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
204
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.
|
|
205
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.
|
|
203
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoggerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
204
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: LoggerModule }); }
|
|
205
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoggerModule, providers: [
|
|
206
206
|
LoggerService
|
|
207
207
|
] }); }
|
|
208
208
|
}
|
|
209
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LoggerModule, decorators: [{
|
|
210
210
|
type: NgModule,
|
|
211
211
|
args: [{
|
|
212
212
|
providers: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o3r-logger.mjs","sources":["../../src/services/logger/logger.console.ts","../../src/services/logger/logger.token.ts","../../src/services/logger/logger.service.ts","../../src/services/logger/logger.module.ts","../../src/services/logger/logger.noop.ts","../../src/o3r-logger.ts"],"sourcesContent":["/* eslint-disable no-console -- this is the purpose of this logger */\nimport {\n Action,\n ActionReducer,\n MetaReducer,\n} from '@ngrx/store';\nimport type {\n LoggerClient,\n} from './logger.client';\n\n/**\n * Console logger used to display the logs in the browser console\n * Should be used in development mode.\n */\nexport class ConsoleLogger implements LoggerClient {\n /** @inheritdoc */\n public error = console.error;\n\n /** @inheritdoc */\n public warn = console.warn;\n\n /** @inheritdoc */\n public debug = console.debug;\n\n /** @inheritdoc */\n public info = console.info;\n\n /** @inheritdoc */\n public log = console.log;\n\n /** @inheritdoc */\n public identify(uuid: string) {\n this.debug('logging identify function called');\n this.log(`Identify user id ${uuid}`);\n }\n\n /** @inheritdoc */\n public event(name: string, properties?: any) {\n this.debug('logging event function called');\n this.log('event:', name);\n if (properties) {\n this.log('properties:', properties);\n }\n }\n\n /** @inheritdoc */\n public getSessionURL(): undefined {\n this.debug('logging getSessionURL function called');\n return undefined;\n }\n\n /** @inheritdoc */\n public stopRecording() {\n this.debug('logging stopRecording function called');\n }\n\n /** @inheritdoc */\n public resumeRecording() {\n this.debug('logging resumeRecording function called');\n }\n\n /** @inheritdoc */\n public createMetaReducer(): MetaReducer<any, Action> {\n this.debug('logging createMetaReducer function called but a noop reducer is returned for the console logger');\n return (reducer: ActionReducer<any>): ActionReducer<any> => reducer;\n }\n}\n","import {\n InjectionToken,\n} from '@angular/core';\nimport {\n LoggerClient,\n} from './logger.client';\n\nexport const LOGGER_CLIENT_TOKEN: InjectionToken<LoggerClient | LoggerClient[]> = new InjectionToken('Logger Client injection token');\n","import {\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport {\n Action,\n MetaReducer,\n} from '@ngrx/store';\nimport type {\n Logger,\n} from '@o3r/core';\nimport {\n LoggerClient,\n} from './logger.client';\nimport {\n ConsoleLogger,\n} from './logger.console';\nimport {\n LOGGER_CLIENT_TOKEN,\n} from './logger.token';\n\n/**\n * Logger service\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class LoggerService implements Logger {\n /** Loggers */\n private readonly clients: LoggerClient[];\n\n /**\n * Record the recording status to make sure that new clients recording status will be consistent with the service\n */\n private recordingState: 'default' | 'resumed' | 'stopped' = 'default';\n\n constructor(@Optional() @Inject(LOGGER_CLIENT_TOKEN) clients?: LoggerClient | LoggerClient[]) {\n this.clients = clients ? (Array.isArray(clients) ? clients : [clients]) : [new ConsoleLogger()];\n }\n\n /**\n * Identify a user.\n * @param uid Unique identifier for the current user\n * @param vars Addition information about the user\n */\n public identify(uid: string, vars?: { [key: string]: string }) {\n this.clients.forEach((client) => client.identify(uid, vars));\n }\n\n /**\n * Log custom event.\n * @param name Name of the event to log\n * @param properties Additional properties\n */\n public event(name: string, properties?: any): void {\n this.clients.forEach((client) => client.event(name, properties));\n }\n\n /**\n * Generate a link to the replay of the current session.\n */\n public getClientSessionURL(): string | string[] | undefined {\n const sessionUrls = this.clients\n .map((client) => client.getSessionURL())\n .filter((sessionUrl): sessionUrl is string => !!sessionUrl);\n return sessionUrls.length <= 1 ? sessionUrls[0] : sessionUrls;\n }\n\n /**\n * Register a new client to the logger service\n * @param client\n */\n public registerClient(client: LoggerClient) {\n if (this.clients.includes(client)) {\n this.warn(`Client ${client.constructor.name} already registered`);\n return;\n }\n if (this.recordingState === 'resumed') {\n client.resumeRecording();\n } else if (this.recordingState === 'stopped') {\n client.stopRecording();\n }\n this.clients.push(client);\n }\n\n /**\n * Stop recording.\n */\n public stopClientRecording(): void {\n this.recordingState = 'stopped';\n this.clients.forEach((client) => client.stopRecording());\n }\n\n /**\n * Resume recording.\n */\n public resumeClientRecording(): void {\n this.recordingState = 'resumed';\n this.clients.forEach((client) => client.resumeRecording());\n }\n\n /**\n * Report an error\n * @param message\n * @param optionalParams\n */\n public error(message?: any, ...optionalParams: any[]) {\n this.clients.forEach((client) => client.error(message, ...optionalParams));\n }\n\n /**\n * Report a warning\n * @param message\n * @param optionalParams\n */\n public warn(message?: any, ...optionalParams: any[]) {\n this.clients.forEach((client) => client.warn(message, ...optionalParams));\n }\n\n /**\n * Log a message\n * @param message\n * @param optionalParams\n */\n public log(message?: any, ...optionalParams: any[]) {\n this.clients.forEach((client) => client.log(message, ...optionalParams));\n }\n\n /**\n * Log a message\n * @param message\n * @param optionalParams\n */\n public info(message?: any, ...optionalParams: any[]): void {\n this.clients.forEach((client) => (client.info ? client.info(message, ...optionalParams) : client.log(message, ...optionalParams)));\n }\n\n /**\n * Log a debug message\n * @param message\n * @param optionalParams\n */\n public debug(message?: any, ...optionalParams: any[]) {\n this.clients.forEach((client) => client.debug?.(message, ...optionalParams));\n }\n\n /**\n * Create a meta reducer to log ngrx store.\n */\n public createMetaReducer(): MetaReducer<any, Action> | MetaReducer<any, Action>[] | undefined {\n const metaReducers = this.clients\n .map((client) => client.createMetaReducer())\n .filter((metaReducer): metaReducer is MetaReducer<any, Action> => !!metaReducer);\n return metaReducers.length <= 1 ? metaReducers[0] : metaReducers;\n }\n}\n","import {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport {\n LoggerClient,\n} from './logger.client';\nimport {\n ConsoleLogger,\n} from './logger.console';\nimport {\n LoggerService,\n} from './logger.service';\nimport {\n LOGGER_CLIENT_TOKEN,\n} from './logger.token';\n\n@NgModule({\n providers: [\n LoggerService\n ]\n})\nexport class LoggerModule {\n public static forRoot(...clients: LoggerClient[]): ModuleWithProviders<LoggerModule> {\n if (clients.length === 0) {\n clients = [new ConsoleLogger()];\n }\n return {\n ngModule: LoggerModule,\n providers: [\n {\n provide: LOGGER_CLIENT_TOKEN,\n useValue: clients,\n multi: false\n }\n ]\n };\n }\n}\n","/* eslint-disable no-console -- this is the purpose of this logger */\nimport type {\n Action,\n ActionReducer,\n MetaReducer,\n} from '@ngrx/store';\nimport type {\n LoggerClient,\n} from './logger.client';\n\n/**\n * Console logger used to display the logs in the browser console\n * Should be used in development mode.\n */\nexport const noopLogger: Readonly<LoggerClient> = {\n identify: () => {},\n event: () => {},\n getSessionURL: () => undefined,\n stopRecording: () => {},\n resumeRecording: () => {},\n error: console.error,\n warn: console.warn,\n debug: console.debug,\n info: console.info,\n log: console.log,\n createMetaReducer: (): MetaReducer<any, Action> => (reducer: ActionReducer<any>): ActionReducer<any> => reducer\n} as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;AAUA;;;AAGG;MACU,aAAa,CAAA;AAA1B,IAAA,WAAA,GAAA;;AAES,QAAA,IAAA,CAAA,KAAK,GAAG,OAAO,CAAC,KAAK;;AAGrB,QAAA,IAAA,CAAA,IAAI,GAAG,OAAO,CAAC,IAAI;;AAGnB,QAAA,IAAA,CAAA,KAAK,GAAG,OAAO,CAAC,KAAK;;AAGrB,QAAA,IAAA,CAAA,IAAI,GAAG,OAAO,CAAC,IAAI;;AAGnB,QAAA,IAAA,CAAA,GAAG,GAAG,OAAO,CAAC,GAAG;;;AAGjB,IAAA,QAAQ,CAAC,IAAY,EAAA;AAC1B,QAAA,IAAI,CAAC,KAAK,CAAC,kCAAkC,CAAC;AAC9C,QAAA,IAAI,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAA,CAAE,CAAC;;;IAI/B,KAAK,CAAC,IAAY,EAAE,UAAgB,EAAA;AACzC,QAAA,IAAI,CAAC,KAAK,CAAC,+BAA+B,CAAC;AAC3C,QAAA,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxB,IAAI,UAAU,EAAE;AACd,YAAA,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,UAAU,CAAC;;;;IAKhC,aAAa,GAAA;AAClB,QAAA,IAAI,CAAC,KAAK,CAAC,uCAAuC,CAAC;AACnD,QAAA,OAAO,SAAS;;;IAIX,aAAa,GAAA;AAClB,QAAA,IAAI,CAAC,KAAK,CAAC,uCAAuC,CAAC;;;IAI9C,eAAe,GAAA;AACpB,QAAA,IAAI,CAAC,KAAK,CAAC,yCAAyC,CAAC;;;IAIhD,iBAAiB,GAAA;AACtB,QAAA,IAAI,CAAC,KAAK,CAAC,iGAAiG,CAAC;AAC7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EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,iBAAiB,EAAE,MAAgC,CAAC,OAA2B,KAAyB;;;ACzB1G;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"o3r-logger.mjs","sources":["../../src/services/logger/logger.console.ts","../../src/services/logger/logger.token.ts","../../src/services/logger/logger.service.ts","../../src/services/logger/logger.module.ts","../../src/services/logger/logger.noop.ts","../../src/o3r-logger.ts"],"sourcesContent":["/* eslint-disable no-console -- this is the purpose of this logger */\nimport {\n Action,\n ActionReducer,\n MetaReducer,\n} from '@ngrx/store';\nimport type {\n LoggerClient,\n} from './logger.client';\n\n/**\n * Console logger used to display the logs in the browser console\n * Should be used in development mode.\n */\nexport class ConsoleLogger implements LoggerClient {\n /** @inheritdoc */\n public error = console.error;\n\n /** @inheritdoc */\n public warn = console.warn;\n\n /** @inheritdoc */\n public debug = console.debug;\n\n /** @inheritdoc */\n public info = console.info;\n\n /** @inheritdoc */\n public log = console.log;\n\n /** @inheritdoc */\n public identify(uuid: string) {\n this.debug('logging identify function called');\n this.log(`Identify user id ${uuid}`);\n }\n\n /** @inheritdoc */\n public event(name: string, properties?: any) {\n this.debug('logging event function called');\n this.log('event:', name);\n if (properties) {\n this.log('properties:', properties);\n }\n }\n\n /** @inheritdoc */\n public getSessionURL(): undefined {\n this.debug('logging getSessionURL function called');\n return undefined;\n }\n\n /** @inheritdoc */\n public stopRecording() {\n this.debug('logging stopRecording function called');\n }\n\n /** @inheritdoc */\n public resumeRecording() {\n this.debug('logging resumeRecording function called');\n }\n\n /** @inheritdoc */\n public createMetaReducer(): MetaReducer<any, Action> {\n this.debug('logging createMetaReducer function called but a noop reducer is returned for the console logger');\n return (reducer: ActionReducer<any>): ActionReducer<any> => reducer;\n }\n}\n","import {\n InjectionToken,\n} from '@angular/core';\nimport {\n LoggerClient,\n} from './logger.client';\n\nexport const LOGGER_CLIENT_TOKEN: InjectionToken<LoggerClient | LoggerClient[]> = new InjectionToken('Logger Client injection token');\n","import {\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport {\n Action,\n MetaReducer,\n} from '@ngrx/store';\nimport type {\n Logger,\n} from '@o3r/core';\nimport {\n LoggerClient,\n} from './logger.client';\nimport {\n ConsoleLogger,\n} from './logger.console';\nimport {\n LOGGER_CLIENT_TOKEN,\n} from './logger.token';\n\n/**\n * Logger service\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class LoggerService implements Logger {\n /** Loggers */\n private readonly clients: LoggerClient[];\n\n /**\n * Record the recording status to make sure that new clients recording status will be consistent with the service\n */\n private recordingState: 'default' | 'resumed' | 'stopped' = 'default';\n\n constructor(@Optional() @Inject(LOGGER_CLIENT_TOKEN) clients?: LoggerClient | LoggerClient[]) {\n this.clients = clients ? (Array.isArray(clients) ? clients : [clients]) : [new ConsoleLogger()];\n }\n\n /**\n * Identify a user.\n * @param uid Unique identifier for the current user\n * @param vars Addition information about the user\n */\n public identify(uid: string, vars?: { [key: string]: string }) {\n this.clients.forEach((client) => client.identify(uid, vars));\n }\n\n /**\n * Log custom event.\n * @param name Name of the event to log\n * @param properties Additional properties\n */\n public event(name: string, properties?: any): void {\n this.clients.forEach((client) => client.event(name, properties));\n }\n\n /**\n * Generate a link to the replay of the current session.\n */\n public getClientSessionURL(): string | string[] | undefined {\n const sessionUrls = this.clients\n .map((client) => client.getSessionURL())\n .filter((sessionUrl): sessionUrl is string => !!sessionUrl);\n return sessionUrls.length <= 1 ? sessionUrls[0] : sessionUrls;\n }\n\n /**\n * Register a new client to the logger service\n * @param client\n */\n public registerClient(client: LoggerClient) {\n if (this.clients.includes(client)) {\n this.warn(`Client ${client.constructor.name} already registered`);\n return;\n }\n if (this.recordingState === 'resumed') {\n client.resumeRecording();\n } else if (this.recordingState === 'stopped') {\n client.stopRecording();\n }\n this.clients.push(client);\n }\n\n /**\n * Stop recording.\n */\n public stopClientRecording(): void {\n this.recordingState = 'stopped';\n this.clients.forEach((client) => client.stopRecording());\n }\n\n /**\n * Resume recording.\n */\n public resumeClientRecording(): void {\n this.recordingState = 'resumed';\n this.clients.forEach((client) => client.resumeRecording());\n }\n\n /**\n * Report an error\n * @param message\n * @param optionalParams\n */\n public error(message?: any, ...optionalParams: any[]) {\n this.clients.forEach((client) => client.error(message, ...optionalParams));\n }\n\n /**\n * Report a warning\n * @param message\n * @param optionalParams\n */\n public warn(message?: any, ...optionalParams: any[]) {\n this.clients.forEach((client) => client.warn(message, ...optionalParams));\n }\n\n /**\n * Log a message\n * @param message\n * @param optionalParams\n */\n public log(message?: any, ...optionalParams: any[]) {\n this.clients.forEach((client) => client.log(message, ...optionalParams));\n }\n\n /**\n * Log a message\n * @param message\n * @param optionalParams\n */\n public info(message?: any, ...optionalParams: any[]): void {\n this.clients.forEach((client) => (client.info ? client.info(message, ...optionalParams) : client.log(message, ...optionalParams)));\n }\n\n /**\n * Log a debug message\n * @param message\n * @param optionalParams\n */\n public debug(message?: any, ...optionalParams: any[]) {\n this.clients.forEach((client) => client.debug?.(message, ...optionalParams));\n }\n\n /**\n * Create a meta reducer to log ngrx store.\n */\n public createMetaReducer(): MetaReducer<any, Action> | MetaReducer<any, Action>[] | undefined {\n const metaReducers = this.clients\n .map((client) => client.createMetaReducer())\n .filter((metaReducer): metaReducer is MetaReducer<any, Action> => !!metaReducer);\n return metaReducers.length <= 1 ? metaReducers[0] : metaReducers;\n }\n}\n","import {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport {\n LoggerClient,\n} from './logger.client';\nimport {\n ConsoleLogger,\n} from './logger.console';\nimport {\n LoggerService,\n} from './logger.service';\nimport {\n LOGGER_CLIENT_TOKEN,\n} from './logger.token';\n\n@NgModule({\n providers: [\n LoggerService\n ]\n})\nexport class LoggerModule {\n public static forRoot(...clients: LoggerClient[]): ModuleWithProviders<LoggerModule> {\n if (clients.length === 0) {\n clients = [new ConsoleLogger()];\n }\n return {\n ngModule: LoggerModule,\n providers: [\n {\n provide: LOGGER_CLIENT_TOKEN,\n useValue: clients,\n multi: false\n }\n ]\n };\n }\n}\n","/* eslint-disable no-console -- this is the purpose of this logger */\nimport type {\n Action,\n ActionReducer,\n MetaReducer,\n} from '@ngrx/store';\nimport type {\n LoggerClient,\n} from './logger.client';\n\n/**\n * Console logger used to display the logs in the browser console\n * Should be used in development mode.\n */\nexport const noopLogger: Readonly<LoggerClient> = {\n identify: () => {},\n event: () => {},\n getSessionURL: () => undefined,\n stopRecording: () => {},\n resumeRecording: () => {},\n error: console.error,\n warn: console.warn,\n debug: console.debug,\n info: console.info,\n log: console.log,\n createMetaReducer: (): MetaReducer<any, Action> => (reducer: ActionReducer<any>): ActionReducer<any> => reducer\n} as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;AAUA;;;AAGG;MACU,aAAa,CAAA;AAA1B,IAAA,WAAA,GAAA;;AAES,QAAA,IAAA,CAAA,KAAK,GAAG,OAAO,CAAC,KAAK;;AAGrB,QAAA,IAAA,CAAA,IAAI,GAAG,OAAO,CAAC,IAAI;;AAGnB,QAAA,IAAA,CAAA,KAAK,GAAG,OAAO,CAAC,KAAK;;AAGrB,QAAA,IAAA,CAAA,IAAI,GAAG,OAAO,CAAC,IAAI;;AAGnB,QAAA,IAAA,CAAA,GAAG,GAAG,OAAO,CAAC,GAAG;;;AAGjB,IAAA,QAAQ,CAAC,IAAY,EAAA;AAC1B,QAAA,IAAI,CAAC,KAAK,CAAC,kCAAkC,CAAC;AAC9C,QAAA,IAAI,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAA,CAAE,CAAC;;;IAI/B,KAAK,CAAC,IAAY,EAAE,UAAgB,EAAA;AACzC,QAAA,IAAI,CAAC,KAAK,CAAC,+BAA+B,CAAC;AAC3C,QAAA,IAAI,CAAC,GAAG,CAAC,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AAA,YAAY,EAAA,SAAA,EAJZ;YACT;AACD,SAAA,EAAA,CAAA,CAAA;;4FAEU,YAAY,EAAA,UAAA,EAAA,CAAA;kBALxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;wBACT;AACD;AACF,iBAAA;;;ACXD;;;AAGG;AACI,MAAM,UAAU,GAA2B;AAChD,IAAA,QAAQ,EAAE,MAAK,GAAG;AAClB,IAAA,KAAK,EAAE,MAAK,GAAG;AACf,IAAA,aAAa,EAAE,MAAM,SAAS;AAC9B,IAAA,aAAa,EAAE,MAAK,GAAG;AACvB,IAAA,eAAe,EAAE,MAAK,GAAG;IACzB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,iBAAiB,EAAE,MAAgC,CAAC,OAA2B,KAAyB;;;ACzB1G;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/logger",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -16,14 +16,15 @@
|
|
|
16
16
|
"@angular/platform-browser-dynamic": "^19.0.0",
|
|
17
17
|
"@fullstory/browser": "^2.0.0",
|
|
18
18
|
"@ngrx/store": "^19.0.0",
|
|
19
|
-
"@o3r/core": "^12.1.
|
|
20
|
-
"@o3r/schematics": "^12.1.
|
|
19
|
+
"@o3r/core": "^12.1.11",
|
|
20
|
+
"@o3r/schematics": "^12.1.11",
|
|
21
21
|
"@schematics/angular": "^19.0.0",
|
|
22
22
|
"logrocket": "^9.0.0",
|
|
23
23
|
"logrocket-ngrx": "^0.2.1",
|
|
24
24
|
"rxjs": "^7.8.1",
|
|
25
25
|
"smartlook-client": "^10.0.0",
|
|
26
|
-
"ts-node": "~10.9.2"
|
|
26
|
+
"ts-node": "~10.9.2",
|
|
27
|
+
"type-fest": "^4.30.1"
|
|
27
28
|
},
|
|
28
29
|
"peerDependenciesMeta": {
|
|
29
30
|
"@angular-devkit/schematics": {
|
|
@@ -46,6 +47,9 @@
|
|
|
46
47
|
},
|
|
47
48
|
"smartlook-client": {
|
|
48
49
|
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"type-fest": {
|
|
52
|
+
"optional": true
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
"dependencies": {
|
|
@@ -65,10 +69,6 @@
|
|
|
65
69
|
"types": "./index.d.ts",
|
|
66
70
|
"default": "./fesm2022/o3r-logger.mjs"
|
|
67
71
|
},
|
|
68
|
-
"./services/fullstory-logger-client": {
|
|
69
|
-
"types": "./services/fullstory-logger-client/index.d.ts",
|
|
70
|
-
"default": "./fesm2022/o3r-logger-services-fullstory-logger-client.mjs"
|
|
71
|
-
},
|
|
72
72
|
"./services/logrocket-logger-client": {
|
|
73
73
|
"types": "./services/logrocket-logger-client/index.d.ts",
|
|
74
74
|
"default": "./fesm2022/o3r-logger-services-logrocket-logger-client.mjs"
|
|
@@ -76,6 +76,10 @@
|
|
|
76
76
|
"./services/smartlook-logger-client": {
|
|
77
77
|
"types": "./services/smartlook-logger-client/index.d.ts",
|
|
78
78
|
"default": "./fesm2022/o3r-logger-services-smartlook-logger-client.mjs"
|
|
79
|
+
},
|
|
80
|
+
"./services/fullstory-logger-client": {
|
|
81
|
+
"types": "./services/fullstory-logger-client/index.d.ts",
|
|
82
|
+
"default": "./fesm2022/o3r-logger-services-fullstory-logger-client.mjs"
|
|
79
83
|
}
|
|
80
84
|
},
|
|
81
85
|
"sideEffects": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EACL,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAwDlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,KAAG,IAKtD,CAAC"}
|
|
@@ -9,17 +9,42 @@ const reportMissingSchematicsDep = (logger) => (reason) => {
|
|
|
9
9
|
Otherwise, use the error message as guidance.`);
|
|
10
10
|
throw reason;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* List of external dependencies to be added to the project as peer dependencies
|
|
14
|
+
*/
|
|
15
|
+
const dependenciesToInstall = [
|
|
16
|
+
'@angular/core',
|
|
17
|
+
'@angular/platform-browser-dynamic',
|
|
18
|
+
'@ngrx/store'
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* List of external dependencies to be added to the project as dev dependencies
|
|
22
|
+
*/
|
|
23
|
+
const devDependenciesToInstall = [];
|
|
12
24
|
/**
|
|
13
25
|
* Add Otter logger to an Angular Project
|
|
14
26
|
* @param options
|
|
15
27
|
*/
|
|
16
28
|
function ngAddFn(options) {
|
|
17
29
|
/* ng add rules */
|
|
18
|
-
return async (tree) => {
|
|
19
|
-
const { getPackageInstallConfig, setupDependencies } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
30
|
+
return async (tree, context) => {
|
|
31
|
+
const { getExternalDependenciesInfo, getPackageInstallConfig, getWorkspaceConfig, setupDependencies } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
32
|
+
const workspaceProject = options.projectName ? getWorkspaceConfig(tree)?.projects[options.projectName] : undefined;
|
|
33
|
+
const projectDirectory = workspaceProject?.root || '.';
|
|
34
|
+
const projectPackageJson = tree.readJson(path.posix.join(projectDirectory, 'package.json'));
|
|
35
|
+
const externalDependenciesInfo = getExternalDependenciesInfo({
|
|
36
|
+
devDependenciesToInstall,
|
|
37
|
+
dependenciesToInstall,
|
|
38
|
+
projectType: workspaceProject?.projectType,
|
|
39
|
+
o3rPackageJsonPath: packageJsonPath,
|
|
40
|
+
projectPackageJson
|
|
41
|
+
}, context.logger);
|
|
20
42
|
return setupDependencies({
|
|
21
43
|
projectName: options.projectName,
|
|
22
|
-
dependencies:
|
|
44
|
+
dependencies: {
|
|
45
|
+
...getPackageInstallConfig(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion),
|
|
46
|
+
...externalDependenciesInfo
|
|
47
|
+
}
|
|
23
48
|
});
|
|
24
49
|
};
|
|
25
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAWlC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAE5E,MAAM,0BAA0B,GAAG,CAAC,MAA2C,EAAE,EAAE,CAAC,CAAC,MAAW,EAAE,EAAE;IAClG,MAAM,CAAC,KAAK,CAAC;;oDAEqC,CAAC,CAAC;IACpD,MAAM,MAAM,CAAC;AACf,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG;IAC5B,eAAe;IACf,mCAAmC;IACnC,aAAa;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,wBAAwB,GAAa,EAAE,CAAC;AAE9C;;;GAGG;AACH,SAAS,OAAO,CAAC,OAA8B;IAC7C,kBAAkB;IAClB,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QAC7B,M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