@chromahq/core 0.1.6 → 0.1.7

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/dist/index.cjs.js CHANGED
@@ -1317,24 +1317,15 @@ class ApplicationBootstrap {
1317
1317
  const dependencies = [];
1318
1318
  for (const param of parameters) {
1319
1319
  const paramName = param.toLowerCase();
1320
- if (paramName === "store" || paramName.startsWith("store")) {
1320
+ if (paramName === "appstore") {
1321
1321
  let storeInstance;
1322
- if (paramName === "store" && container.isBound("CentralStore")) {
1322
+ if (paramName === "appstore" && container.isBound("CentralStore")) {
1323
1323
  storeInstance = container.get("CentralStore");
1324
- } else {
1325
- const storeKeyMatch = paramName.match(/^store(.+)$/);
1326
- if (storeKeyMatch && storeKeyMatch[1]) {
1327
- const storeName = storeKeyMatch[1].replace(/^([A-Z])/, (m) => m.toLowerCase());
1328
- const diKey = `CentralStore:${storeName}`;
1329
- if (container.isBound(diKey)) {
1330
- storeInstance = container.get(diKey);
1331
- }
1324
+ if (!storeInstance) {
1325
+ throw new Error(`No store found for parameter "${param}" in ${ServiceClass.name}`);
1332
1326
  }
1327
+ Reflect.defineMetadata("name", param, storeInstance);
1333
1328
  }
1334
- if (!storeInstance) {
1335
- this.logger.warn(`\u26A0\uFE0F No store found for parameter "${param}" in ${ServiceClass.name}`);
1336
- }
1337
- dependencies.push(storeInstance);
1338
1329
  continue;
1339
1330
  }
1340
1331
  const matchingService = Array.from(this.serviceRegistry.entries()).find(
@@ -1458,6 +1449,9 @@ class ApplicationBootstrap {
1458
1449
  serviceMetadata.dependencies.forEach((dependency, index) => {
1459
1450
  b(_$1(dependency), ServiceClass, index);
1460
1451
  });
1452
+ if (container.isBound("CentralStore")) {
1453
+ b(_$1("CentralStore"), ServiceClass, serviceMetadata.dependencies.length);
1454
+ }
1461
1455
  container.bind(ServiceClass).toSelf().inSingletonScope();
1462
1456
  serviceMetadata.registered = true;
1463
1457
  this.logger.success(`\u2705 Registered service: ${ServiceClass.name}`);
@@ -1519,6 +1513,9 @@ class ApplicationBootstrap {
1519
1513
  dependencies.forEach((dependency, index) => {
1520
1514
  b(_$1(dependency), MessageClass, index);
1521
1515
  });
1516
+ if (container.isBound("CentralStore")) {
1517
+ b(_$1("CentralStore"), MessageClass, dependencies.length);
1518
+ }
1522
1519
  const messageMetadata = Reflect.getMetadata("name", MessageClass);
1523
1520
  const messageName = messageMetadata || MessageClass.name;
1524
1521
  container.bind(messageName).to(MessageClass).inSingletonScope();
@@ -1577,6 +1574,9 @@ class ApplicationBootstrap {
1577
1574
  dependencies.forEach((dependency, index) => {
1578
1575
  b(_$1(dependency), JobClass, index);
1579
1576
  });
1577
+ if (container.isBound("CentralStore")) {
1578
+ b(_$1("CentralStore"), JobClass, dependencies.length);
1579
+ }
1580
1580
  const jobMetadata = Reflect.getMetadata("name", JobClass);
1581
1581
  const jobName = jobMetadata || JobClass.name;
1582
1582
  container.bind(JobClass).toSelf().inSingletonScope();
package/dist/index.es.js CHANGED
@@ -1315,24 +1315,15 @@ class ApplicationBootstrap {
1315
1315
  const dependencies = [];
1316
1316
  for (const param of parameters) {
1317
1317
  const paramName = param.toLowerCase();
1318
- if (paramName === "store" || paramName.startsWith("store")) {
1318
+ if (paramName === "appstore") {
1319
1319
  let storeInstance;
1320
- if (paramName === "store" && container.isBound("CentralStore")) {
1320
+ if (paramName === "appstore" && container.isBound("CentralStore")) {
1321
1321
  storeInstance = container.get("CentralStore");
1322
- } else {
1323
- const storeKeyMatch = paramName.match(/^store(.+)$/);
1324
- if (storeKeyMatch && storeKeyMatch[1]) {
1325
- const storeName = storeKeyMatch[1].replace(/^([A-Z])/, (m) => m.toLowerCase());
1326
- const diKey = `CentralStore:${storeName}`;
1327
- if (container.isBound(diKey)) {
1328
- storeInstance = container.get(diKey);
1329
- }
1322
+ if (!storeInstance) {
1323
+ throw new Error(`No store found for parameter "${param}" in ${ServiceClass.name}`);
1330
1324
  }
1325
+ Reflect.defineMetadata("name", param, storeInstance);
1331
1326
  }
1332
- if (!storeInstance) {
1333
- this.logger.warn(`\u26A0\uFE0F No store found for parameter "${param}" in ${ServiceClass.name}`);
1334
- }
1335
- dependencies.push(storeInstance);
1336
1327
  continue;
1337
1328
  }
1338
1329
  const matchingService = Array.from(this.serviceRegistry.entries()).find(
@@ -1456,6 +1447,9 @@ class ApplicationBootstrap {
1456
1447
  serviceMetadata.dependencies.forEach((dependency, index) => {
1457
1448
  b(_$1(dependency), ServiceClass, index);
1458
1449
  });
1450
+ if (container.isBound("CentralStore")) {
1451
+ b(_$1("CentralStore"), ServiceClass, serviceMetadata.dependencies.length);
1452
+ }
1459
1453
  container.bind(ServiceClass).toSelf().inSingletonScope();
1460
1454
  serviceMetadata.registered = true;
1461
1455
  this.logger.success(`\u2705 Registered service: ${ServiceClass.name}`);
@@ -1517,6 +1511,9 @@ class ApplicationBootstrap {
1517
1511
  dependencies.forEach((dependency, index) => {
1518
1512
  b(_$1(dependency), MessageClass, index);
1519
1513
  });
1514
+ if (container.isBound("CentralStore")) {
1515
+ b(_$1("CentralStore"), MessageClass, dependencies.length);
1516
+ }
1520
1517
  const messageMetadata = Reflect.getMetadata("name", MessageClass);
1521
1518
  const messageName = messageMetadata || MessageClass.name;
1522
1519
  container.bind(messageName).to(MessageClass).inSingletonScope();
@@ -1575,6 +1572,9 @@ class ApplicationBootstrap {
1575
1572
  dependencies.forEach((dependency, index) => {
1576
1573
  b(_$1(dependency), JobClass, index);
1577
1574
  });
1575
+ if (container.isBound("CentralStore")) {
1576
+ b(_$1("CentralStore"), JobClass, dependencies.length);
1577
+ }
1578
1578
  const jobMetadata = Reflect.getMetadata("name", JobClass);
1579
1579
  const jobName = jobMetadata || JobClass.name;
1580
1580
  container.bind(JobClass).toSelf().inSingletonScope();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chromahq/core",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Core library for building Chrome extensions with Chroma framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",