@transcommerce/cwm-shared 1.1.35 → 1.1.36

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.
@@ -27125,42 +27125,27 @@ const MockCustomer = {
27125
27125
  };
27126
27126
 
27127
27127
  /*
27128
- The LogService is really just a wrapper around the existing console logging functionality
27129
- The three main reasons for using this service are:
27130
- 1. The abstraction layer will allow us to pick a different logging endpoint if needed
27131
- 2. This service allows you to specify what level verbosity you want this service tp log with
27132
- 3. Has logic to log method entry and exit points automagically
27133
- 4. Keeps track of call stack for nested method calls
27134
- 02*/
27135
- class LogService {
27128
+ *The ClassLoggerService is really just a wrapper around the existing console logging functionality
27129
+ *The four main reasons for using this service are:
27130
+ * 1. The abstraction layer will allow us to pick a different logging endpoint if needed
27131
+ * 2. This service allows you to specify what level of verbosity you want this service to log with
27132
+ * 3. Has logic to log classname, method entry, and method exit points automagically
27133
+ * 4. Keeps track of the call stack to group nested method calls
27134
+ */
27135
+ class ClassLoggerService {
27136
27136
  logLevel = 'Info';
27137
- _classStack = new Stack();
27137
+ collapseGroups = true;
27138
+ _className = "";
27138
27139
  get className() {
27139
- return this._classStack.peek() ?? "";
27140
+ return this._className;
27140
27141
  }
27141
27142
  set className(value) {
27142
- if (this.logLevel === 'None') {
27143
- return;
27144
- }
27145
- if (this._classStack.size > 0 && this._classStack.peek() !== value) {
27146
- //console.groupCollapsed(this.targetName + " - " + value + " - " + new Date().toLocaleString())
27147
- console.groupEnd();
27148
- console.timeEnd(this.targetName);
27149
- this._classStack.pop();
27150
- }
27151
- if (this._classStack.size === 0 || this._classStack.peek() !== value) {
27152
- this._classStack.push(value);
27153
- this.methodName = "constructor()";
27154
- }
27155
- else {
27156
- this._classStack.push(value);
27157
- console.groupCollapsed(this.targetName);
27158
- console.time(this.targetName);
27159
- }
27143
+ this._className = value;
27144
+ this.methodName = "constructor()";
27160
27145
  }
27161
- _methodStack = new Stack();
27146
+ callStack = new Stack();
27162
27147
  get methodName() {
27163
- return this._methodStack.peek() ?? "";
27148
+ return this.callStack.peek() ?? "";
27164
27149
  }
27165
27150
  set methodName(value) {
27166
27151
  if (this.logLevel === 'None') {
@@ -27170,8 +27155,11 @@ class LogService {
27170
27155
  this.endOfMethod();
27171
27156
  }
27172
27157
  else {
27173
- this._methodStack.push(value);
27174
- console.groupCollapsed(this.targetName);
27158
+ this.callStack.push(value);
27159
+ if (this.collapseGroups)
27160
+ console.groupCollapsed(this.targetName);
27161
+ else
27162
+ console.group(this.targetName);
27175
27163
  console.time(this.targetName);
27176
27164
  this.info("Start of method");
27177
27165
  }
@@ -27180,54 +27168,51 @@ class LogService {
27180
27168
  this.info("End of method");
27181
27169
  console.groupEnd();
27182
27170
  console.timeEnd(this.targetName);
27183
- this._methodStack.pop();
27171
+ this.callStack.pop();
27184
27172
  }
27185
27173
  get targetName() {
27186
27174
  if (this.methodName === "")
27187
27175
  return this.className;
27188
27176
  else
27189
- return this.className + "." + this.methodName;
27177
+ return `${this.className}.${this.methodName}`;
27190
27178
  }
27191
27179
  get prefix() {
27192
- return Date.now().toLocaleString() + " " + this.targetName + "> ";
27180
+ return `${new Date().toLocaleString()} ${this.targetName}> `;
27193
27181
  }
27194
27182
  log(message, ...optionalParams) {
27195
27183
  if (this.logLevel != 'None') {
27196
- console.log(this.prefix + " " + message, optionalParams);
27184
+ console.log(`${this.prefix} ${message}`, optionalParams);
27197
27185
  }
27198
27186
  }
27199
27187
  debug(message, ...optionalParams) {
27200
27188
  if (this.logLevel === 'Debug') {
27201
- console.debug(this.prefix + " Debug: " + message, optionalParams);
27189
+ console.debug(`${this.prefix} Debug: ${message}`, optionalParams);
27202
27190
  }
27203
27191
  }
27204
27192
  info(message, ...optionalParams) {
27205
27193
  if (this.logLevel === 'Debug' || this.logLevel === 'Info') {
27206
- console.info(this.prefix + " Information: " + message, optionalParams);
27194
+ console.info(`${this.prefix} Information: ${message}`, optionalParams);
27207
27195
  }
27208
27196
  }
27209
27197
  warn(message, ...optionalParams) {
27210
27198
  if (this.logLevel === 'Warn' || this.logLevel === 'Debug' || this.logLevel === 'Info') {
27211
- console.warn(this.prefix + " Warning: " + message, optionalParams);
27199
+ console.warn(`${this.prefix} Warning: ${message}`, optionalParams);
27212
27200
  }
27213
27201
  }
27214
27202
  error(message, ...optionalParams) {
27215
27203
  if (this.logLevel != 'None') {
27216
- console.error(this.prefix + " Error: " + message, optionalParams);
27204
+ console.error(`${this.prefix} Error: ${message}`, optionalParams);
27217
27205
  }
27218
27206
  }
27219
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
27220
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LogService, providedIn: 'root' });
27207
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ClassLoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
27208
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ClassLoggerService });
27221
27209
  }
27222
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LogService, decorators: [{
27223
- type: Injectable,
27224
- args: [{
27225
- providedIn: 'root'
27226
- }]
27210
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ClassLoggerService, decorators: [{
27211
+ type: Injectable
27227
27212
  }] });
27228
27213
 
27229
27214
  class ConfigService {
27230
- logService;
27215
+ logger;
27231
27216
  mockData = false;
27232
27217
  configClient;
27233
27218
  configConnectString;
@@ -27238,40 +27223,41 @@ class ConfigService {
27238
27223
  set configCache(value) {
27239
27224
  this._configCache = value;
27240
27225
  }
27241
- constructor(logService) {
27242
- this.logService = logService;
27243
- this.logService.className = "ConfigService";
27226
+ constructor(logger) {
27227
+ this.logger = logger;
27228
+ this.logger.className = "ConfigService";
27244
27229
  this.configConnectString = "Endpoint=https://cheap-weed-menus-appconfig.azconfig.io;Id=tyjA;Secret=1FgL95lHkXViZX4Qf2GcRqn26mhTYDVYany8ToXpTnO68AzrdUUEJQQJ99AHAC8vTInIcYexAAACAZACsteF";
27245
27230
  this.configClient = new AppConfigurationClient(this.configConnectString);
27246
- this.logService.log("Config Client", this.configClient);
27247
- this.logService.methodName = "";
27231
+ this.logger.info("Config Client", this.configClient);
27232
+ this.logger.methodName = "";
27248
27233
  }
27249
27234
  async getConfigurationSettingAsync(key, label) {
27250
- this.logService.methodName = "getConfigurationSettingAsync()";
27235
+ this.logger.methodName = "getConfigurationSettingAsync()";
27251
27236
  let setting = {};
27252
- this.logService.log("Get Configuration Setting for Key/Label requested", key, label);
27237
+ this.logger.info("Get Configuration Setting for Key/Label requested", key, label);
27253
27238
  if (this.mockData || this.configCache != undefined) {
27254
27239
  if (this.configCache == undefined) {
27255
27240
  this.configCache = MockConfig;
27256
- this.logService.log("Configuration Cache was undefined and Mock Data Enabled. Mock Config will be cached and used for this and all subsequent calls", this.configCache);
27241
+ this.logger.info("Configuration Cache was undefined and Mock Data Enabled. Mock Config will be cached and used for this and all subsequent calls", this.configCache);
27257
27242
  }
27258
27243
  setting.key = key;
27259
27244
  setting.value = JSON.stringify(this.configCache);
27260
27245
  if (this.mockData)
27261
- this.logService.log("Mock Data Enabled, Skipping getConfigurationSetting() and using Mock Config from the Configuration Cache", this.configCache);
27262
- this.logService.log("Configuration Cache was available, skipping getConfigurationSetting() and using Cached Configuration", this.configCache);
27246
+ this.logger.info("Mock Data Enabled, Skipping getConfigurationSetting() and using Mock Config from the Configuration Cache", this.configCache);
27247
+ else
27248
+ this.logger.info("Configuration Cache was available, skipping getConfigurationSetting() and using Cached Configuration", this.configCache);
27263
27249
  }
27264
27250
  else if (this.configCache == undefined) {
27265
- this.logService.log("Configuration Cache was undefined and Mock Data disabled. Getting Configuration Setting Key/Label. Configuration will be cached and used for this and all subsequent calls", key, label);
27251
+ this.logger.info("Configuration Cache was undefined and Mock Data disabled. Getting Configuration Setting Key/Label. Configuration will be cached and used for this and all subsequent calls", key, label);
27266
27252
  setting = await this.configClient.getConfigurationSetting({ key: key, label: label.replace(".", "") });
27267
27253
  }
27268
27254
  return setting.value;
27269
27255
  }
27270
27256
  async setConfigurationSettingAsync(templateName, label, setting, contentType = "Text") {
27271
- this.logService.className = "ConfigService";
27272
- this.logService.methodName = "setConfigurationSettingAsync()";
27257
+ this.logger.methodName = "setConfigurationSettingAsync()";
27273
27258
  if (this.mockData) {
27274
- this.logService.log("Mock Data Enabled, Skipping setConfigurationSettingAsync()");
27259
+ this.logger.info("Mock Data Enabled, Skipping setConfigurationSettingAsync()");
27260
+ this.logger.methodName = "";
27275
27261
  return;
27276
27262
  }
27277
27263
  const configurationSetting = {
@@ -27280,46 +27266,45 @@ class ConfigService {
27280
27266
  value: setting,
27281
27267
  contentType: contentType,
27282
27268
  };
27283
- this.logService.log("Setting", configurationSetting);
27269
+ this.logger.info("Calling configClient.setConfigurationSetting", configurationSetting);
27284
27270
  await this.configClient.setConfigurationSetting(configurationSetting);
27285
- this.logService.methodName = "";
27271
+ this.logger.methodName = "";
27286
27272
  }
27287
27273
  async getConfigAsync(company) {
27288
- this.logService.className = "ConfigService";
27289
- this.logService.methodName = "getConfigAsync()";
27274
+ this.logger.methodName = "getConfigAsync()";
27290
27275
  if (this.mockData) {
27291
27276
  this.configCache = MockConfig;
27292
- this.logService.log("Mock Data Enabled, Using Mock Config", this.configCache);
27277
+ this.logger.info("Mock Data Enabled, Using Mock Config", this.configCache);
27293
27278
  }
27294
27279
  else if (this.configCache == undefined) {
27295
- this.logService.log("Loading Configuration from Azure App Configuration");
27280
+ this.logger.info("Config Cache was undefined. Loading Configuration from Azure App Configuration");
27296
27281
  const jsonConfig = await this.getConfigurationSettingAsync("App.Config.Json", company) ?? "{ }";
27297
27282
  this.configCache = JSON.parse(jsonConfig);
27298
- this.logService.log("Loaded and Cached Configuration from Azure App Configuration", this.configCache);
27283
+ this.logger.debug("Loaded and Cached Configuration from Azure App Configuration", this.configCache);
27299
27284
  }
27300
27285
  else {
27301
- this.logService.log("Using Cached Configuration", this.configCache);
27286
+ this.logger.info("Using Cached Configuration", this.configCache);
27302
27287
  }
27303
27288
  const config = this.configCache;
27304
- this.logService.methodName = "";
27289
+ this.logger.methodName = "";
27305
27290
  return config;
27306
27291
  }
27307
27292
  async saveConfigAsync(config, company) {
27308
- this.logService.className = "ConfigService";
27309
- this.logService.methodName = "saveConfigAsync()";
27293
+ this.logger.methodName = "saveConfigAsync()";
27310
27294
  // Update configuration cache
27311
27295
  this.configCache = config;
27312
- this.logService.log("Updated Config Cache", this.configCache);
27296
+ this.logger.info("Updated Config Cache", this.configCache);
27313
27297
  if (this.mockData) {
27314
- this.logService.log("Mock Data Enabled, Skipping setConfigurationSettingAsync()");
27298
+ this.logger.info("Mock Data Enabled, Skipping setConfigurationSettingAsync()");
27299
+ this.logger.methodName = "";
27315
27300
  return;
27316
27301
  }
27317
- this.logService.log("Saving Configuration to Azure App Configuration");
27302
+ this.logger.info("Saving Configuration to Azure App Configuration");
27318
27303
  await this.setConfigurationSettingAsync("App.Config.Json", company, config, "JSON");
27319
- this.logService.log("Saved Configuration to Azure App Configuration");
27320
- this.logService.methodName = "";
27304
+ this.logger.debug("Saved Configuration to Azure App Configuration");
27305
+ this.logger.methodName = "";
27321
27306
  }
27322
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ConfigService, deps: [{ token: LogService }], target: i0.ɵɵFactoryTarget.Injectable });
27307
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ConfigService, deps: [{ token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
27323
27308
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ConfigService, providedIn: 'root' });
27324
27309
  }
27325
27310
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ConfigService, decorators: [{
@@ -27327,12 +27312,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
27327
27312
  args: [{
27328
27313
  providedIn: 'root'
27329
27314
  }]
27330
- }], ctorParameters: () => [{ type: LogService }] });
27315
+ }], ctorParameters: () => [{ type: ClassLoggerService }] });
27331
27316
 
27332
27317
  class BaseApiService {
27333
27318
  configService;
27334
27319
  httpClient;
27335
- logService;
27320
+ logger;
27336
27321
  config;
27337
27322
  get apiBaseUrl() {
27338
27323
  if (this.config)
@@ -27343,12 +27328,12 @@ class BaseApiService {
27343
27328
  get apiFullUrl() {
27344
27329
  return this.apiBaseUrl;
27345
27330
  }
27346
- constructor(configService, httpClient, logService) {
27331
+ constructor(configService, httpClient, logger) {
27347
27332
  this.configService = configService;
27348
27333
  this.httpClient = httpClient;
27349
- this.logService = logService;
27334
+ this.logger = logger;
27350
27335
  }
27351
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BaseApiService, deps: [{ token: ConfigService }, { token: i2$1.HttpClient }, { token: LogService }], target: i0.ɵɵFactoryTarget.Injectable });
27336
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BaseApiService, deps: [{ token: ConfigService }, { token: i2$1.HttpClient }, { token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
27352
27337
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BaseApiService, providedIn: 'root' });
27353
27338
  }
27354
27339
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BaseApiService, decorators: [{
@@ -27356,94 +27341,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
27356
27341
  args: [{
27357
27342
  providedIn: 'root'
27358
27343
  }]
27359
- }], ctorParameters: () => [{ type: ConfigService }, { type: i2$1.HttpClient }, { type: LogService }] });
27360
-
27361
- /*
27362
- *The ClassLoggerService is really just a wrapper around the existing console logging functionality
27363
- *The four main reasons for using this service are:
27364
- * 1. The abstraction layer will allow us to pick a different logging endpoint if needed
27365
- * 2. This service allows you to specify what level of verbosity you want this service to log with
27366
- * 3. Has logic to log classname, method entry, and method exit points automagically
27367
- * 4. Keeps track of the call stack to group nested method calls
27368
- */
27369
- class ClassLoggerService {
27370
- logLevel = 'Info';
27371
- collapseGroups = true;
27372
- _className = "";
27373
- get className() {
27374
- return this._className;
27375
- }
27376
- set className(value) {
27377
- this._className = value;
27378
- this.methodName = "constructor()";
27379
- }
27380
- callStack = new Stack();
27381
- get methodName() {
27382
- return this.callStack.peek() ?? "";
27383
- }
27384
- set methodName(value) {
27385
- if (this.logLevel === 'None') {
27386
- return;
27387
- }
27388
- if (value === "") {
27389
- this.endOfMethod();
27390
- }
27391
- else {
27392
- this.callStack.push(value);
27393
- if (this.collapseGroups)
27394
- console.groupCollapsed(this.targetName);
27395
- else
27396
- console.group(this.targetName);
27397
- console.time(this.targetName);
27398
- this.info("Start of method");
27399
- }
27400
- }
27401
- endOfMethod() {
27402
- this.info("End of method");
27403
- console.groupEnd();
27404
- console.timeEnd(this.targetName);
27405
- this.callStack.pop();
27406
- }
27407
- get targetName() {
27408
- if (this.methodName === "")
27409
- return this.className;
27410
- else
27411
- return `${this.className}.${this.methodName}`;
27412
- }
27413
- get prefix() {
27414
- return `${new Date().toLocaleString()} ${this.targetName}> `;
27415
- }
27416
- log(message, ...optionalParams) {
27417
- if (this.logLevel != 'None') {
27418
- console.log(`${this.prefix} ${message}`, optionalParams);
27419
- }
27420
- }
27421
- debug(message, ...optionalParams) {
27422
- if (this.logLevel === 'Debug') {
27423
- console.debug(`${this.prefix} Debug: ${message}`, optionalParams);
27424
- }
27425
- }
27426
- info(message, ...optionalParams) {
27427
- if (this.logLevel === 'Debug' || this.logLevel === 'Info') {
27428
- console.info(`${this.prefix} Information: ${message}`, optionalParams);
27429
- }
27430
- }
27431
- warn(message, ...optionalParams) {
27432
- if (this.logLevel === 'Warn' || this.logLevel === 'Debug' || this.logLevel === 'Info') {
27433
- console.warn(`${this.prefix} Warning: ${message}`, optionalParams);
27434
- }
27435
- }
27436
- error(message, ...optionalParams) {
27437
- if (this.logLevel != 'None') {
27438
- console.error(`${this.prefix} Error: ${message}`, optionalParams);
27439
- }
27440
- }
27441
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ClassLoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
27442
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ClassLoggerService });
27443
- }
27444
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ClassLoggerService, decorators: [{
27445
- type: Injectable
27446
- }] });
27344
+ }], ctorParameters: () => [{ type: ConfigService }, { type: i2$1.HttpClient }, { type: ClassLoggerService }] });
27447
27345
 
27448
27346
  class CustomerApiService extends BaseApiService {
27449
27347
  get apiFullUrl() {
@@ -27467,9 +27365,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
27467
27365
 
27468
27366
  class InventoryApiService extends BaseApiService {
27469
27367
  useMockData = false;
27470
- constructor(configService, httpClient, logService) {
27471
- super(configService, httpClient, logService);
27472
- logService.className = "InventoryApiService";
27368
+ constructor(configService, httpClient, logger) {
27369
+ super(configService, httpClient, logger);
27370
+ logger.className = "InventoryApiService";
27473
27371
  }
27474
27372
  get httpHeaders() {
27475
27373
  return new HttpHeaders()
@@ -27481,21 +27379,21 @@ class InventoryApiService extends BaseApiService {
27481
27379
  return this.apiBaseUrl + (this.config ?? MockConfig.apiConfig).getInventoryApiRoute;
27482
27380
  }
27483
27381
  async getProductsAsync(companyName) {
27484
- this.logService.methodName = "getProductsAsync()";
27382
+ this.logger.methodName = "getProductsAsync()";
27485
27383
  let response;
27486
27384
  this.configService.mockData = this.useMockData;
27487
- this.logService.log("Fetching Configuration for Company", companyName);
27385
+ this.logger.log("Fetching Configuration for Company", companyName);
27488
27386
  this.config = (await this.configService.getConfigAsync(companyName)).apiConfig;
27489
- this.logService.log("Fetching Products for Company", companyName);
27387
+ this.logger.log("Fetching Products for Company", companyName);
27490
27388
  if (this.useMockData) {
27491
27389
  response = Promise.resolve(MockInventoryApiResponse);
27492
- this.logService.log("Mock Data Returned", response);
27390
+ this.logger.log("Mock Data Returned", response);
27493
27391
  }
27494
27392
  else {
27495
27393
  response = firstValueFrom(this.httpClient.get(this.apiFullUrl, { headers: this.httpHeaders }));
27496
- this.logService.log("Inventory API Response", response);
27394
+ this.logger.log("Inventory API Response", response);
27497
27395
  }
27498
- this.logService.methodName = "";
27396
+ this.logger.methodName = "";
27499
27397
  return response;
27500
27398
  }
27501
27399
  async getCategoriesAsync(companyName) {
@@ -27521,7 +27419,7 @@ class InventoryApiService extends BaseApiService {
27521
27419
  return productsByAllCategories;
27522
27420
  }
27523
27421
  ;
27524
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: InventoryApiService, deps: [{ token: ConfigService }, { token: i2$1.HttpClient }, { token: LogService }], target: i0.ɵɵFactoryTarget.Injectable });
27422
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: InventoryApiService, deps: [{ token: ConfigService }, { token: i2$1.HttpClient }, { token: ClassLoggerService }], target: i0.ɵɵFactoryTarget.Injectable });
27525
27423
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: InventoryApiService, providedIn: 'root' });
27526
27424
  }
27527
27425
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: InventoryApiService, decorators: [{
@@ -27529,7 +27427,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
27529
27427
  args: [{
27530
27428
  providedIn: 'root'
27531
27429
  }]
27532
- }], ctorParameters: () => [{ type: ConfigService }, { type: i2$1.HttpClient }, { type: LogService }] });
27430
+ }], ctorParameters: () => [{ type: ConfigService }, { type: i2$1.HttpClient }, { type: ClassLoggerService }] });
27533
27431
 
27534
27432
  /**
27535
27433
  * Provides a wrapper for accessing the web storage API and synchronizing session storage across tabs/windows.
@@ -27812,6 +27710,108 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
27812
27710
  }]
27813
27711
  }] });
27814
27712
 
27713
+ /*
27714
+ The ClassLoggerService is really just a wrapper around the existing console logging functionality
27715
+ The three main reasons for using this service are:
27716
+ 1. The abstraction layer will allow us to pick a different logging endpoint if needed
27717
+ 2. This service allows you to specify what level verbosity you want this service tp log with
27718
+ 3. Has logic to log method entry and exit points automagically
27719
+ 4. Keeps track of call stack for nested method calls
27720
+ 02*/
27721
+ class LogService {
27722
+ logLevel = 'Info';
27723
+ _classStack = new Stack();
27724
+ get className() {
27725
+ return this._classStack.peek() ?? "";
27726
+ }
27727
+ set className(value) {
27728
+ if (this.logLevel === 'None') {
27729
+ return;
27730
+ }
27731
+ if (this._classStack.size > 0 && this._classStack.peek() !== value) {
27732
+ //console.groupCollapsed(this.targetName + " - " + value + " - " + new Date().toLocaleString())
27733
+ console.groupEnd();
27734
+ console.timeEnd(this.targetName);
27735
+ this._classStack.pop();
27736
+ }
27737
+ if (this._classStack.size === 0 || this._classStack.peek() !== value) {
27738
+ this._classStack.push(value);
27739
+ this.methodName = "constructor()";
27740
+ }
27741
+ else {
27742
+ this._classStack.push(value);
27743
+ console.groupCollapsed(this.targetName);
27744
+ console.time(this.targetName);
27745
+ }
27746
+ }
27747
+ _methodStack = new Stack();
27748
+ get methodName() {
27749
+ return this._methodStack.peek() ?? "";
27750
+ }
27751
+ set methodName(value) {
27752
+ if (this.logLevel === 'None') {
27753
+ return;
27754
+ }
27755
+ if (value === "") {
27756
+ this.endOfMethod();
27757
+ }
27758
+ else {
27759
+ this._methodStack.push(value);
27760
+ console.groupCollapsed(this.targetName);
27761
+ console.time(this.targetName);
27762
+ this.info("Start of method");
27763
+ }
27764
+ }
27765
+ endOfMethod() {
27766
+ this.info("End of method");
27767
+ console.groupEnd();
27768
+ console.timeEnd(this.targetName);
27769
+ this._methodStack.pop();
27770
+ }
27771
+ get targetName() {
27772
+ if (this.methodName === "")
27773
+ return this.className;
27774
+ else
27775
+ return this.className + "." + this.methodName;
27776
+ }
27777
+ get prefix() {
27778
+ return Date.now().toLocaleString() + " " + this.targetName + "> ";
27779
+ }
27780
+ log(message, ...optionalParams) {
27781
+ if (this.logLevel != 'None') {
27782
+ console.log(this.prefix + " " + message, optionalParams);
27783
+ }
27784
+ }
27785
+ debug(message, ...optionalParams) {
27786
+ if (this.logLevel === 'Debug') {
27787
+ console.debug(this.prefix + " Debug: " + message, optionalParams);
27788
+ }
27789
+ }
27790
+ info(message, ...optionalParams) {
27791
+ if (this.logLevel === 'Debug' || this.logLevel === 'Info') {
27792
+ console.info(this.prefix + " Information: " + message, optionalParams);
27793
+ }
27794
+ }
27795
+ warn(message, ...optionalParams) {
27796
+ if (this.logLevel === 'Warn' || this.logLevel === 'Debug' || this.logLevel === 'Info') {
27797
+ console.warn(this.prefix + " Warning: " + message, optionalParams);
27798
+ }
27799
+ }
27800
+ error(message, ...optionalParams) {
27801
+ if (this.logLevel != 'None') {
27802
+ console.error(this.prefix + " Error: " + message, optionalParams);
27803
+ }
27804
+ }
27805
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
27806
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LogService, providedIn: 'root' });
27807
+ }
27808
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LogService, decorators: [{
27809
+ type: Injectable,
27810
+ args: [{
27811
+ providedIn: 'root'
27812
+ }]
27813
+ }] });
27814
+
27815
27815
  // ================================================
27816
27816
  // Export every type you want this module to expose
27817
27817
  // ================================================