@plyaz/core 1.9.7 → 1.10.1

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.
@@ -34,8 +34,13 @@ import { FilesMapperClass } from './mappers/FilesMapper';
34
34
  */
35
35
  export declare class FrontendFilesDomainService extends BaseFrontendDomainService<FilesFrontendServiceConfig, FilesFrontendStoreSlice, FilesFrontendStoreData, FilesEntity, GetFileResponse, FilesCreateInput, Partial<FilesCreateInput>, Record<string, unknown>, FilesStoreItem, InstanceType<typeof FilesMapperClass>, CoreBaseValidatorInstance, void> {
36
36
  static readonly serviceKey = "files-frontend";
37
+ /**
38
+ * Primary store key for this service.
39
+ * Used by ServiceRegistry to auto-inject the store.
40
+ * Must be static for base class constructor to access.
41
+ */
42
+ static readonly primaryStoreKey: "files";
37
43
  protected eventPrefix: string;
38
- protected primaryStoreKey: "files";
39
44
  static create(config?: FilesFrontendServiceConfig, options?: CoreServiceCreateOptions): Promise<FrontendFilesDomainService>;
40
45
  constructor(config?: FilesFrontendServiceConfig, options?: CoreServiceCreateOptions);
41
46
  isAvailable(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"FrontendFilesDomainService.d.ts","sourceRoot":"","sources":["../../../src/domain/files/FrontendFilesDomainService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,WAAW,EACX,0BAA0B,EAC1B,gBAAgB,EAGjB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,S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CtF;;;OAGG;IACH,SAAS,CAAC,kBAAkB,CAAC,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1E;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CAAC,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAC1E;AAQD,wBAAsB,6BAA6B,CACjD,MAAM,CAAC,EAAE,0BAA0B,EACnC,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,0BAA0B,CAAC,CAGrC;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAKhD"}
1
+ {"version":3,"file":"FrontendFilesDomainService.d.ts","sourceRoot":"","sources":["../../../src/domain/files/FrontendFilesDomainService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,WAAW,EACX,0BAA0B,EAC1B,gBAAgB,EAGjB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAe,MAAM,uBAAuB,CAAC;AAUtE;;;;;;;;;;;;;GAaG;AACH,qBAAa,0BAA2B,SAAQ,yBAAyB,CACvE,0BAA0B,EAC1B,uBAAuB,EACvB,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,OAAO,CAAC,gBAAgB,CAAC,EACzB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,cAAc,EACd,YAAY,CAAC,OAAO,gBAAgB,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wB,GACjC,OAAO,CAAC,0BAA0B,CAAC,CAGrC;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAKhD"}
@@ -2273,10 +2273,10 @@ var init_ServiceRegistry = __esm({
2273
2273
  const dedicatedDb = config.dedicatedDb;
2274
2274
  const isDedicated = dedicatedDb === true || typeof dedicatedDb === "object";
2275
2275
  const serviceKey = entry.service.serviceKey;
2276
- const isBackendRuntime = types.BACKEND_RUNTIMES.includes(_ServiceRegistry._runtime);
2276
+ const isBackendRuntime = types.BACKEND_RUNTIMES.includes(_ServiceRegistry._runtime) || types.UNIVERSAL_RUNTIMES.includes(_ServiceRegistry._runtime);
2277
2277
  if ((isDedicated || _ServiceRegistry._dbConfig) && !isBackendRuntime) {
2278
2278
  _ServiceRegistry.logger.warn(
2279
- `Service '${serviceKey}' is requesting database injection in '${_ServiceRegistry._runtime}' runtime. Database is only available in backend runtimes (${types.BACKEND_RUNTIMES.join(", ")}). This service will not have database access.`
2279
+ `Service '${serviceKey}' is requesting database injection in '${_ServiceRegistry._runtime}' runtime. Database is only available in backend runtimes (${types.BACKEND_RUNTIMES.join(", ")}) or universal runtimes (${types.UNIVERSAL_RUNTIMES.join(", ")}). This service will not have database access.`
2280
2280
  );
2281
2281
  return void 0;
2282
2282
  }
@@ -2389,10 +2389,10 @@ var init_ServiceRegistry = __esm({
2389
2389
  const dedicatedStorage = config.dedicatedStorage;
2390
2390
  const isDedicated = dedicatedStorage === true || typeof dedicatedStorage === "object";
2391
2391
  const serviceKey = entry.service.serviceKey;
2392
- const isBackendRuntime = types.BACKEND_RUNTIMES.includes(_ServiceRegistry._runtime);
2392
+ const isBackendRuntime = types.BACKEND_RUNTIMES.includes(_ServiceRegistry._runtime) || types.UNIVERSAL_RUNTIMES.includes(_ServiceRegistry._runtime);
2393
2393
  if ((isDedicated || _ServiceRegistry._storageConfig) && !isBackendRuntime) {
2394
2394
  _ServiceRegistry.logger.warn(
2395
- `Service '${serviceKey}' is requesting storage injection in '${_ServiceRegistry._runtime}' runtime. Storage is only available in backend runtimes (${types.BACKEND_RUNTIMES.join(", ")}). This service will not have storage access.`
2395
+ `Service '${serviceKey}' is requesting storage injection in '${_ServiceRegistry._runtime}' runtime. Storage is only available in backend runtimes (${types.BACKEND_RUNTIMES.join(", ")}) or universal runtimes (${types.UNIVERSAL_RUNTIMES.join(", ")}). This service will not have storage access.`
2396
2396
  );
2397
2397
  return void 0;
2398
2398
  }
@@ -2441,10 +2441,10 @@ var init_ServiceRegistry = __esm({
2441
2441
  const dedicatedNotifications = config.dedicatedNotifications;
2442
2442
  const isDedicated = dedicatedNotifications === true || typeof dedicatedNotifications === "object";
2443
2443
  const serviceKey = entry.service.serviceKey;
2444
- const isBackendRuntime = types.BACKEND_RUNTIMES.includes(_ServiceRegistry._runtime);
2444
+ const isBackendRuntime = types.BACKEND_RUNTIMES.includes(_ServiceRegistry._runtime) || types.UNIVERSAL_RUNTIMES.includes(_ServiceRegistry._runtime);
2445
2445
  if ((isDedicated || _ServiceRegistry._notificationsConfig) && !isBackendRuntime) {
2446
2446
  _ServiceRegistry.logger.warn(
2447
- `Service '${serviceKey}' is requesting notifications injection in '${_ServiceRegistry._runtime}' runtime. Notifications is only available in backend runtimes (${types.BACKEND_RUNTIMES.join(", ")}). This service will not have notifications access.`
2447
+ `Service '${serviceKey}' is requesting notifications injection in '${_ServiceRegistry._runtime}' runtime. Notifications is only available in backend runtimes (${types.BACKEND_RUNTIMES.join(", ")}) or universal runtimes (${types.UNIVERSAL_RUNTIMES.join(", ")}). This service will not have notifications access.`
2448
2448
  );
2449
2449
  return void 0;
2450
2450
  }
@@ -3194,6 +3194,11 @@ var init_CoreInitializer = __esm({
3194
3194
  environment: globalEnvironment,
3195
3195
  runtime,
3196
3196
  apiClient: apiConfig ? { baseURL: apiConfig.baseURL, ...apiConfig } : void 0,
3197
+ db: options.db,
3198
+ cache: options.cache,
3199
+ storage: options.storage,
3200
+ notifications: options.notifications,
3201
+ observability: options.observability,
3197
3202
  services: mergedServices,
3198
3203
  stores: {
3199
3204
  // Returns specific slice from namespaced root store (type-safe)
@@ -9250,11 +9255,13 @@ var init_FrontendFilesDomainService = __esm({
9250
9255
  logger4 = new logger$1.PackageLogger({ packageName: "core", service: "FrontendFilesDomainService" });
9251
9256
  FrontendFilesDomainService = class _FrontendFilesDomainService extends BaseFrontendDomainService {
9252
9257
  constructor(config = {}, options) {
9258
+ const apiBasePath = config.apiBasePath || "/api";
9253
9259
  super({
9254
9260
  serviceName: "FrontendFilesDomainService",
9255
9261
  supportedRuntimes: ["frontend"],
9256
9262
  serviceConfig: {
9257
9263
  enabled: true,
9264
+ apiBasePath,
9258
9265
  responseDataKey: "data",
9259
9266
  ...config,
9260
9267
  // Configure fetchers for CRUD operations
@@ -9288,7 +9295,6 @@ var init_FrontendFilesDomainService = __esm({
9288
9295
  injected: options?.injected
9289
9296
  });
9290
9297
  this.eventPrefix = "files";
9291
- this.primaryStoreKey = store.STORE_KEYS.FILES;
9292
9298
  }
9293
9299
  static {
9294
9300
  __name(this, "FrontendFilesDomainService");
@@ -9296,9 +9302,25 @@ var init_FrontendFilesDomainService = __esm({
9296
9302
  static {
9297
9303
  this.serviceKey = "files-frontend";
9298
9304
  }
9305
+ static {
9306
+ /**
9307
+ * Primary store key for this service.
9308
+ * Used by ServiceRegistry to auto-inject the store.
9309
+ * Must be static for base class constructor to access.
9310
+ */
9311
+ this.primaryStoreKey = store.STORE_KEYS.FILES;
9312
+ }
9299
9313
  static async create(config = {}, options) {
9300
9314
  this.registerEventHandlers();
9301
- return new _FrontendFilesDomainService(config, options);
9315
+ const mergedConfig = {
9316
+ ...config,
9317
+ // Use || instead of ?? because api.baseURL may be '' (empty string) for same-origin requests.
9318
+ // The ?? operator only falls through on null/undefined, not empty strings.
9319
+ // An empty string is not a valid API path, so we treat it as "not provided" and fall through to default.
9320
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
9321
+ apiBasePath: config.apiBasePath || options?.apiClient?.options?.baseURL || "/api"
9322
+ };
9323
+ return new _FrontendFilesDomainService(mergedConfig, options);
9302
9324
  }
9303
9325
  isAvailable() {
9304
9326
  return this.isServiceEnabled && typeof window !== "undefined";