@plyaz/core 1.8.1 → 1.8.2
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/domain/base/BaseFrontendDomainService.d.ts +29 -1
- package/dist/domain/base/BaseFrontendDomainService.d.ts.map +1 -1
- package/dist/domain/example/FrontendExampleDomainService.d.ts +6 -4
- package/dist/domain/example/FrontendExampleDomainService.d.ts.map +1 -1
- package/dist/entry-backend.js +54 -10
- package/dist/entry-backend.js.map +1 -1
- package/dist/entry-backend.mjs +54 -10
- package/dist/entry-backend.mjs.map +1 -1
- package/dist/entry-frontend-browser.js +54 -10
- package/dist/entry-frontend-browser.js.map +1 -1
- package/dist/entry-frontend-browser.mjs +54 -10
- package/dist/entry-frontend-browser.mjs.map +1 -1
- package/dist/entry-frontend.js +54 -10
- package/dist/entry-frontend.js.map +1 -1
- package/dist/entry-frontend.mjs +54 -10
- package/dist/entry-frontend.mjs.map +1 -1
- package/dist/index.js +54 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -10
- package/dist/index.mjs.map +1 -1
- package/dist/init/ServiceRegistry.d.ts.map +1 -1
- package/dist/init/nestjs/index.js +8 -2
- package/dist/init/nestjs/index.js.map +1 -1
- package/dist/init/nestjs/index.mjs +8 -2
- package/dist/init/nestjs/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34979,10 +34979,16 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
34979
34979
|
return initPromise;
|
|
34980
34980
|
}
|
|
34981
34981
|
/** Build stores for service injection */
|
|
34982
|
-
|
|
34982
|
+
// eslint-disable-next-line complexity
|
|
34983
|
+
static buildStoresForService(config, entry) {
|
|
34983
34984
|
const allKeys = /* @__PURE__ */ new Set();
|
|
34984
34985
|
if (config.store) {
|
|
34985
34986
|
allKeys.add(config.store);
|
|
34987
|
+
} else if ("primaryStoreKey" in entry.service && typeof entry.service.primaryStoreKey === "string") {
|
|
34988
|
+
allKeys.add(entry.service.primaryStoreKey);
|
|
34989
|
+
_ServiceRegistry.logger.debug(
|
|
34990
|
+
`Auto-resolved store key '${entry.service.primaryStoreKey}' from service class`
|
|
34991
|
+
);
|
|
34986
34992
|
}
|
|
34987
34993
|
if (config.readStores) {
|
|
34988
34994
|
config.readStores.forEach((key) => allKeys.add(key));
|
|
@@ -35020,7 +35026,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
35020
35026
|
const observability = _ServiceRegistry.buildObservabilityConfig(config, entry);
|
|
35021
35027
|
const storage = await _ServiceRegistry.buildStorageConfig(config, entry);
|
|
35022
35028
|
const notifications = await _ServiceRegistry.buildNotificationsConfig(config, entry);
|
|
35023
|
-
const stores = _ServiceRegistry.buildStoresForService(config);
|
|
35029
|
+
const stores = _ServiceRegistry.buildStoresForService(config, entry);
|
|
35024
35030
|
let observabilityInstance = observability?.instance;
|
|
35025
35031
|
if (observability?.dedicated && observability.config) {
|
|
35026
35032
|
observabilityInstance = await _ServiceRegistry.createDedicatedObservability(
|
|
@@ -36991,13 +36997,14 @@ var BaseDomainService = class {
|
|
|
36991
36997
|
);
|
|
36992
36998
|
}
|
|
36993
36999
|
};
|
|
36994
|
-
var BaseFrontendDomainService = class extends BaseDomainService {
|
|
37000
|
+
var BaseFrontendDomainService = class _BaseFrontendDomainService extends BaseDomainService {
|
|
36995
37001
|
// ─────────────────────────────────────────────────────────────────────────
|
|
36996
37002
|
// Constructor
|
|
36997
37003
|
// ─────────────────────────────────────────────────────────────────────────
|
|
36998
37004
|
// eslint-disable-next-line complexity
|
|
36999
37005
|
constructor(config) {
|
|
37000
|
-
|
|
37006
|
+
const resolvedConfig = _BaseFrontendDomainService.resolveApiClientConfig(config);
|
|
37007
|
+
super(resolvedConfig);
|
|
37001
37008
|
// ─────────────────────────────────────────────────────────────────────────
|
|
37002
37009
|
// Store Properties
|
|
37003
37010
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -37023,6 +37030,11 @@ var BaseFrontendDomainService = class extends BaseDomainService {
|
|
|
37023
37030
|
const serviceConfig = config.serviceConfig;
|
|
37024
37031
|
if (serviceConfig.store !== void 0) {
|
|
37025
37032
|
this.primaryStoreKey = serviceConfig.store;
|
|
37033
|
+
} else {
|
|
37034
|
+
const staticKey = this.constructor.primaryStoreKey;
|
|
37035
|
+
if (staticKey) {
|
|
37036
|
+
this.primaryStoreKey = staticKey;
|
|
37037
|
+
}
|
|
37026
37038
|
}
|
|
37027
37039
|
if (serviceConfig.readStores !== void 0) {
|
|
37028
37040
|
this.readStoreKeys = Array.from(
|
|
@@ -37068,6 +37080,36 @@ var BaseFrontendDomainService = class extends BaseDomainService {
|
|
|
37068
37080
|
static {
|
|
37069
37081
|
__name(this, "BaseFrontendDomainService");
|
|
37070
37082
|
}
|
|
37083
|
+
/**
|
|
37084
|
+
* Auto-resolve apiClientConfig from serviceConfig.apiBasePath if not explicitly provided.
|
|
37085
|
+
* This reduces boilerplate in child services - they only need to set apiBasePath in config.
|
|
37086
|
+
*
|
|
37087
|
+
* Priority:
|
|
37088
|
+
* 1. Explicit apiClientConfig.baseURL (full control)
|
|
37089
|
+
* 2. serviceConfig.apiBasePath (auto-constructed, merged with injected options)
|
|
37090
|
+
* 3. undefined (no API client)
|
|
37091
|
+
*
|
|
37092
|
+
* When auto-constructing, merges injected API options (headers, timeout, etc.)
|
|
37093
|
+
* with the service's apiBasePath as baseURL.
|
|
37094
|
+
*/
|
|
37095
|
+
static resolveApiClientConfig(config) {
|
|
37096
|
+
if (config.apiClientConfig?.baseURL) {
|
|
37097
|
+
return config;
|
|
37098
|
+
}
|
|
37099
|
+
const apiBasePath = config.serviceConfig.apiBasePath;
|
|
37100
|
+
if (apiBasePath) {
|
|
37101
|
+
const injectedOptions = config.injected?.api ? {} : config.apiClientConfig ?? {};
|
|
37102
|
+
return {
|
|
37103
|
+
...config,
|
|
37104
|
+
apiClientConfig: {
|
|
37105
|
+
...injectedOptions,
|
|
37106
|
+
baseURL: apiBasePath
|
|
37107
|
+
// Service's apiBasePath always takes precedence
|
|
37108
|
+
}
|
|
37109
|
+
};
|
|
37110
|
+
}
|
|
37111
|
+
return config;
|
|
37112
|
+
}
|
|
37071
37113
|
// ─────────────────────────────────────────────────────────────────────────
|
|
37072
37114
|
// Store Management (Public API)
|
|
37073
37115
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -45244,8 +45286,6 @@ var FrontendExampleDomainService = class _FrontendExampleDomainService extends B
|
|
|
45244
45286
|
super({
|
|
45245
45287
|
serviceName: "ExampleFrontendService",
|
|
45246
45288
|
supportedRuntimes: ["frontend"],
|
|
45247
|
-
// API client config - uses injected options or creates from apiBasePath
|
|
45248
|
-
apiClientConfig: options?.apiClient?.options ?? { baseURL: apiBasePath },
|
|
45249
45289
|
serviceConfig: {
|
|
45250
45290
|
enabled: true,
|
|
45251
45291
|
apiBasePath,
|
|
@@ -45309,10 +45349,6 @@ var FrontendExampleDomainService = class _FrontendExampleDomainService extends B
|
|
|
45309
45349
|
* Required by BaseFrontendDomainService
|
|
45310
45350
|
*/
|
|
45311
45351
|
this.eventPrefix = "example";
|
|
45312
|
-
/**
|
|
45313
|
-
* Primary store key - the store this service can mutate
|
|
45314
|
-
*/
|
|
45315
|
-
this.primaryStoreKey = store.STORE_KEYS.EXAMPLE;
|
|
45316
45352
|
/**
|
|
45317
45353
|
* Read-only store keys - inherits error and featureFlags from base
|
|
45318
45354
|
* No need to redeclare them - they're always included by default
|
|
@@ -45335,6 +45371,14 @@ var FrontendExampleDomainService = class _FrontendExampleDomainService extends B
|
|
|
45335
45371
|
// ─────────────────────────────────────────────────────────────────────────
|
|
45336
45372
|
this.serviceKey = core.SERVICE_KEYS.EXAMPLE_FRONTEND;
|
|
45337
45373
|
}
|
|
45374
|
+
static {
|
|
45375
|
+
/**
|
|
45376
|
+
* Primary store key for this service.
|
|
45377
|
+
* Used by ServiceRegistry to auto-inject the store if not specified in config.
|
|
45378
|
+
* Also used by base class constructor to set instance primaryStoreKey.
|
|
45379
|
+
*/
|
|
45380
|
+
this.primaryStoreKey = store.STORE_KEYS.EXAMPLE;
|
|
45381
|
+
}
|
|
45338
45382
|
/**
|
|
45339
45383
|
* Factory method for ServiceRegistry auto-initialization.
|
|
45340
45384
|
* Creates and initializes the service instance.
|