@daffodil/driver 0.92.3 → 0.93.0

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.
@@ -23,10 +23,10 @@ class DaffHubspotResponseFactory extends DaffModelFactory {
23
23
  constructor() {
24
24
  super(MockHubspotResponse);
25
25
  }
26
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffHubspotResponseFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
27
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffHubspotResponseFactory, providedIn: 'root' }); }
26
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffHubspotResponseFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
27
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffHubspotResponseFactory, providedIn: 'root' }); }
28
28
  }
29
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffHubspotResponseFactory, decorators: [{
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffHubspotResponseFactory, decorators: [{
30
30
  type: Injectable,
31
31
  args: [{
32
32
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-driver-hubspot-testing.mjs","sources":["../../../libs/driver/hubspot/testing/src/factories/hubspot-response.factory.ts","../../../libs/driver/hubspot/testing/src/daffodil-driver-hubspot-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n HubspotError,\n HubspotResponse,\n} from '@daffodil/driver/hubspot';\n\nconst MockHubspotError = (): HubspotError => ({\n message: faker.lorem.words(5),\n errorType: faker.lorem.word(),\n});\n\nexport class MockHubspotResponse implements HubspotResponse {\n redirectUri? = faker.internet.url();\n inlineMessage = faker.lorem.words(5);\n errors: HubspotError[] = Array(faker.number.int({ min: 1, max: 5 })).fill(MockHubspotError);\n}\n\n/**\n * Model factory for {@link MockHubspotResponse}s.\n *\n * Should be used to create {@link MockHubspotResponse}s for testing purposes.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffHubspotResponseFactory extends DaffModelFactory<HubspotResponse>{\n constructor() {\n super(MockHubspotResponse);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AASA,MAAM,gBAAgB,GAAG,OAAqB;IAC5C,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,IAAA,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;AAC9B,CAAA,CAAC;MAEW,mBAAmB,CAAA;AAAhC,IAAA,WAAA,GAAA;AACE,QAAA,IAAA,CAAA,WAAW,GAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;QACnC,IAAA,CAAA,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACpC,IAAA,CAAA,MAAM,GAAmB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC7F;AAAC;AAED;;;;AAIG;AAIG,MAAO,0BAA2B,SAAQ,gBAAiC,CAAA;AAC/E,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,mBAAmB,CAAC;IAC5B;+GAHW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cAFzB,MAAM,EAAA,CAAA,CAAA;;4FAEP,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAHtC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC3BD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-driver-hubspot-testing.mjs","sources":["../../../libs/driver/hubspot/testing/src/factories/hubspot-response.factory.ts","../../../libs/driver/hubspot/testing/src/daffodil-driver-hubspot-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n HubspotError,\n HubspotResponse,\n} from '@daffodil/driver/hubspot';\n\nconst MockHubspotError = (): HubspotError => ({\n message: faker.lorem.words(5),\n errorType: faker.lorem.word(),\n});\n\nexport class MockHubspotResponse implements HubspotResponse {\n redirectUri? = faker.internet.url();\n inlineMessage = faker.lorem.words(5);\n errors: HubspotError[] = Array(faker.number.int({ min: 1, max: 5 })).fill(MockHubspotError);\n}\n\n/**\n * Model factory for {@link MockHubspotResponse}s.\n *\n * Should be used to create {@link MockHubspotResponse}s for testing purposes.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffHubspotResponseFactory extends DaffModelFactory<HubspotResponse>{\n constructor() {\n super(MockHubspotResponse);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AASA,MAAM,gBAAgB,GAAG,OAAqB;IAC5C,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,IAAA,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;AAC9B,CAAA,CAAC;MAEW,mBAAmB,CAAA;AAAhC,IAAA,WAAA,GAAA;AACE,QAAA,IAAA,CAAA,WAAW,GAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;QACnC,IAAA,CAAA,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACpC,IAAA,CAAA,MAAM,GAAmB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC7F;AAAC;AAED;;;;AAIG;AAIG,MAAO,0BAA2B,SAAQ,gBAAiC,CAAA;AAC/E,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,mBAAmB,CAAC;IAC5B;8GAHW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cAFzB,MAAM,EAAA,CAAA,CAAA;;2FAEP,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAHtC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC3BD;;AAEG;;;;"}
@@ -78,10 +78,10 @@ class DaffInMemoryRootBackend extends DaffInMemoryBackendDelegate {
78
78
  ...backend.createDb(reqInfo),
79
79
  }), {})));
80
80
  }
81
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffInMemoryRootBackend, deps: [{ token: DAFF_IN_MEMORY_BACKENDS }, { token: DAFF_IN_MEMORY_DRIVER_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
82
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffInMemoryRootBackend, providedIn: 'root' }); }
81
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryRootBackend, deps: [{ token: DAFF_IN_MEMORY_BACKENDS }, { token: DAFF_IN_MEMORY_DRIVER_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
82
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryRootBackend, providedIn: 'root' }); }
83
83
  }
84
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffInMemoryRootBackend, decorators: [{
84
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryRootBackend, decorators: [{
85
85
  type: Injectable,
86
86
  args: [{
87
87
  providedIn: 'root',
@@ -133,11 +133,11 @@ class DaffInMemoryDriverModule {
133
133
  ],
134
134
  };
135
135
  }
136
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffInMemoryDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
137
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.18", ngImport: i0, type: DaffInMemoryDriverModule }); }
138
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffInMemoryDriverModule }); }
136
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
137
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryDriverModule }); }
138
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryDriverModule }); }
139
139
  }
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffInMemoryDriverModule, decorators: [{
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryDriverModule, decorators: [{
141
141
  type: NgModule
142
142
  }] });
143
143
 
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-driver-in-memory.mjs","sources":["../../../libs/driver/in-memory/src/backend/backends.token.ts","../../../libs/driver/in-memory/src/backend/delegate.class.ts","../../../libs/driver/in-memory/src/backend/root.service.ts","../../../libs/driver/in-memory/src/driver/base.class.ts","../../../libs/driver/in-memory/src/config/default.ts","../../../libs/driver/in-memory/src/config/token.ts","../../../libs/driver/in-memory/src/module.ts","../../../libs/driver/in-memory/src/provider.ts","../../../libs/driver/in-memory/src/routing/provider.ts","../../../libs/driver/in-memory/src/daffodil-driver-in-memory.ts"],"sourcesContent":["import { createServicesInjectionToken } from '@daffodil/core';\n\nimport { DaffInMemoryBackendInterface } from './type';\n\nexport const {\n /**\n * A token that holds the currently loaded in-memory backends.\n */\n token: DAFF_IN_MEMORY_BACKENDS,\n /**\n * Provide backend classes to {@link DAFF_IN_MEMORY_BACKENDS}.\n */\n provider: provideDaffInMemoryBackends,\n} = createServicesInjectionToken<DaffInMemoryBackendInterface>('DAFF_IN_MEMORY_BACKENDS');\n","import {\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\nimport { Observable } from 'rxjs';\n\nimport { DaffInMemoryDataServiceInterface } from './data-service.type';\nimport { DaffInMemoryRouteableBackend } from './routeable.type';\nimport { DaffInMemoryDriverConfig } from '../public_api';\n\nenum Method {\n GET = 'get',\n POST = 'post',\n PUT = 'put',\n DELETE = 'delete',\n}\n\n/**\n * An class that automatically delegates requests to in-memory backends.\n *\n * @inheritdoc\n */\nexport class DaffInMemoryBackendDelegate implements DaffInMemoryDataServiceInterface {\n\n constructor(\n protected backends: Array<DaffInMemoryRouteableBackend>,\n protected config: DaffInMemoryDriverConfig,\n ) {}\n\n protected delegateRequest(reqInfo: RequestInfo, method: Method): Observable<any> {\n const backend = this.backends.find((b) => 'collectionName' in b ? b.collectionName === reqInfo.collectionName : b.canHandle(reqInfo.collectionName));\n const request = backend?.[method];\n\n if(request) {\n // allow child backends to return nully values\n // which will fall back to default request behavior (https://github.com/angular/angular/tree/main/packages/misc/angular-in-memory-web-api#http-request-handling)\n return request.call(backend, reqInfo);\n }\n\n if(!this.config.passThroughUnknownRequests) {\n return reqInfo.utils.createResponse$(() => ({\n status: STATUS.NOT_FOUND,\n statusText: `Backend ${reqInfo.collectionName} not found or does not support the ${method} request method`,\n }));\n }\n\n return undefined;\n }\n\n get?(reqInfo: RequestInfo): Observable<any> {\n return this.delegateRequest(reqInfo, Method.GET);\n }\n\n post?(reqInfo: RequestInfo): Observable<any> {\n return this.delegateRequest(reqInfo, Method.POST);\n }\n\n put?(reqInfo: RequestInfo): Observable<any> {\n return this.delegateRequest(reqInfo, Method.PUT);\n }\n\n delete?(reqInfo: RequestInfo): Observable<any> {\n return this.delegateRequest(reqInfo, Method.DELETE);\n }\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n} from 'angular-in-memory-web-api';\nimport {\n combineLatest,\n map,\n take,\n} from 'rxjs';\n\nimport { observe } from '@daffodil/core';\n\nimport { DAFF_IN_MEMORY_BACKENDS } from './backends.token';\nimport { DaffInMemoryDataServiceInterface } from './data-service.type';\nimport { DaffInMemoryBackendDelegate } from './delegate.class';\nimport { DaffInMemoryBackendInterface } from './type';\nimport {\n DAFF_IN_MEMORY_DRIVER_CONFIG,\n DaffInMemoryDriverConfig,\n} from '../public_api';\n\n/**\n * An in-memory backend that automatically delegates requests to backends provided to {@link DAFF_IN_MEMORY_BACKENDS}.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryRootBackend extends DaffInMemoryBackendDelegate implements DaffInMemoryDataServiceInterface, InMemoryDbService {\n constructor(\n @Inject(DAFF_IN_MEMORY_BACKENDS) private _backends: Array<DaffInMemoryBackendInterface>,\n @Inject(DAFF_IN_MEMORY_DRIVER_CONFIG) private _config: DaffInMemoryDriverConfig,\n ) {\n super(_backends, _config);\n }\n\n createDb(reqInfo?: RequestInfo) {\n return combineLatest(this._backends.map(observe)).pipe(\n take(1),\n map((backends) => backends.reduce((db, backend) => ({\n ...db,\n ...backend.createDb(reqInfo),\n }), {})),\n );\n }\n}\n","import { InMemoryBackendConfigArgs } from 'angular-in-memory-web-api';\n\n/**\n * The base class for in-memory drivers.\n */\nexport abstract class DaffInMemoryDriverBase {\n /**\n * The URL of the corresponding backend.\n * Does not include a trailing slash, it is of the form: `/<api base>/<collection name>`.\n */\n protected readonly url = `/${this.config.apiBase}/${this.collectionName}`;\n\n constructor(\n private config: InMemoryBackendConfigArgs,\n private collectionName: string,\n ) {}\n}\n","import { DaffInMemoryDriverConfig } from './type';\n\nexport const DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT: DaffInMemoryDriverConfig = {\n apiBase: 'api',\n passThroughUnknownRequests: false,\n};\n","import { createConfigInjectionToken } from '@daffodil/core';\n\nimport { DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT } from './default';\nimport { DaffInMemoryDriverConfig } from './type';\n\nexport const {\n token: DAFF_IN_MEMORY_DRIVER_CONFIG,\n /**\n * Provider function for {@link DAFF_IN_MEMORY_DRIVER_CONFIG}.\n */\n provider: provideDaffInMemoryDriverConfig,\n} = createConfigInjectionToken<DaffInMemoryDriverConfig>(DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, 'DAFF_IN_MEMORY_DRIVER_CONFIG');\n","import {\n NgModule,\n ModuleWithProviders,\n importProvidersFrom,\n} from '@angular/core';\nimport { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';\n\nimport { DaffInMemoryRootBackend } from './backend/public_api';\nimport {\n DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT,\n DaffInMemoryDriverConfig,\n provideDaffInMemoryDriverConfig,\n} from './config/public_api';\n\n/**\n * Sets up the angular in memory web API with the {@link DaffInMemoryRootBackend}.\n */\n@NgModule()\nexport class DaffInMemoryDriverModule {\n static forRoot(config: DaffInMemoryDriverConfig = DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT): ModuleWithProviders<DaffInMemoryDriverModule> {\n return {\n ngModule: DaffInMemoryDriverModule,\n providers: [\n importProvidersFrom(HttpClientInMemoryWebApiModule.forRoot(DaffInMemoryRootBackend, config)),\n provideDaffInMemoryDriverConfig(config),\n ],\n };\n }\n}\n","import {\n EnvironmentProviders,\n importProvidersFrom,\n makeEnvironmentProviders,\n Type,\n} from '@angular/core';\nimport { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';\n\nimport {\n DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT,\n DaffInMemoryBackendInterface,\n DaffInMemoryDriverConfig,\n DaffInMemoryRootBackend,\n provideDaffInMemoryBackends,\n provideDaffInMemoryDriverConfig,\n} from './public_api';\n\n/**\n * Configures the Angular in-memory web API with Daffodil backend services.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideDaffInMemoryDriver(\n * { delay: 300 },\n * DaffProductInMemoryBackendService,\n * DaffCartInMemoryBackendService\n * )\n * ]\n * });\n * ```\n */\nexport const provideDaffInMemoryDriver = (config: DaffInMemoryDriverConfig = DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, ...backends: Array<Type<DaffInMemoryBackendInterface>>): EnvironmentProviders[] => {\n config = { ...DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT,...config };\n return [\n importProvidersFrom(HttpClientInMemoryWebApiModule.forRoot(DaffInMemoryRootBackend, { ...config, passThruUnknownUrl: config.passThroughUnknownRequests })),\n makeEnvironmentProviders([\n provideDaffInMemoryDriverConfig(config),\n provideDaffInMemoryBackends(...backends),\n ]),\n ];\n};\n","import {\n EnvironmentProviders,\n inject,\n InjectionToken,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport {\n DaffInMemoryRoutableObject,\n DaffInMemoryRoutableObjects,\n} from './routable-object';\n\n/**\n * A function that returns an array of entities with URL properties.\n * Used to provide routable in-memory object information to the routing system.\n */\nexport type DaffInMemoryRoutableObjectsResolver = () => Array<{ url: string }>;\n\n/**\n * Multi-injection token for routable object resolvers.\n *\n * Each in-memory driver (e.g., product, navigation) can register a resolver\n * that provides its entities with URL properties. This token collects all\n * such resolvers so they can be processed together to build the routing map.\n *\n * @docs-private\n */\nconst DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER = new InjectionToken<{ type: string; resolver: DaffInMemoryRoutableObjectsResolver }[]>(\n 'DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER', {\n providedIn: 'root',\n factory: () => [],\n },\n);\n\n/**\n * Internal injection token that builds and provides the complete map of routable objects.\n *\n * This token automatically collects all registered routable object resolvers and builds\n * a Map where the key is the URL path and the value is an object containing both the URL\n * and its associated type. This map is used by in-memory drivers to resolve URLs to their types.\n *\n * @docs-private\n */\nexport const DAFF_INMEMORY_ROUTABLE_OBJECTS = new InjectionToken<DaffInMemoryRoutableObjects>(\n 'DAFF_INMEMORY_ROUTABLE_OBJECTS',\n {\n providedIn: 'root',\n factory: () => {\n const resolvers = inject(DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER, { optional: true }) || [];\n const map = new Map<string, DaffInMemoryRoutableObject>();\n\n if (!Array.isArray(resolvers)) {\n throw new Error('DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER must be an array');\n }\n\n resolvers.forEach((entry) => {\n const entities = entry.resolver();\n entities.forEach(entity => {\n if (map.has(entity.url)) {\n const existing = map.get(entity.url);\n console.warn(\n `[@daffodil/driver/in-memory] Duplicate entity URL detected: \"${entity.url}\". ` +\n `Already registered with type \"${existing?.type}\", attempting to register again with type \"${entry.type}\". ` +\n `The first registration will be used.`,\n );\n return;\n }\n map.set(entity.url, { url: entity.url, type: entry.type });\n });\n });\n\n return map;\n },\n },\n);\n\n/**\n * Registers routable objects from an in-memory driver with the routing system.\n *\n * This function allows in-memory drivers to provide their entities (with URL properties)\n * to enable automatic URL resolution. Each driver provides a resolver function that\n * returns its entities with URL properties, along with a type identifier.\n *\n * The resolver function runs in an injection context, which means you can use Angular's\n * `inject()` function within it to access services and dependencies.\n *\n * @param type - The type identifier for these routable objects (e.g., \"PRODUCTS\")\n * @param resolver - A function that returns an array of entities with URL properties.\n * This function runs in an injection context, allowing use of `inject()`.\n * @returns Environment providers that register the routable objects\n *\n * @usageNotes\n *\n * ### Basic Usage\n *\n * In your driver package, create a resolver function:\n *\n * ```typescript\n * const productResolver = (): Array<{ url: string }> => {\n * return inject(DaffInMemoryBackendProductService).products.map((p) => ({ url: p.url }));\n * };\n * ```\n *\n * Then in your app configuration:\n *\n * ```typescript\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDaffInMemoryRoutableObjects(\"PRODUCTS\", productResolver),\n * ]\n * };\n * ```\n */\nexport const provideDaffInMemoryRoutableObjects = (\n type: string,\n resolver: DaffInMemoryRoutableObjectsResolver,\n): EnvironmentProviders => makeEnvironmentProviders([\n {\n provide: DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER,\n useValue: { type, resolver },\n multi: true,\n },\n]);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAIO,MAAM;AACX;;AAEG;AACH,KAAK,EAAE,uBAAuB;AAC9B;;AAEG;AACH,QAAQ,EAAE,2BAA2B,GACtC,GAAG,4BAA4B,CAA+B,yBAAyB;;ACHxF,IAAK,MA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S,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;AAC1B,YAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE;AACjC,YAAA,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAG;gBACxB,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;oBACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;AACpC,oBAAA,OAAO,CAAC,IAAI,CACV,gEAAgE,MAAM,CAAC,GAAG,CAAA,GAAA,CAAK;AAC/E,wBAAA,CAAA,8BAAA,EAAiC,QAAQ,EAAE,IAAI,8CAA8C,KAAK,CAAC,IAAI,CAAA,GAAA,CAAK;AAC5G,wBAAA,CAAA,oCAAA,CAAsC,CACvC;oBACD;gBACF;gBACA,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AAC5D,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,GAAG;IACZ,CAAC;AACF,CAAA;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;AACI,MAAM,kCAAkC,GAAG,CAChD,IAAY,EACZ,QAA6C,KACpB,wBAAwB,CAAC;AAClD,IAAA;AACE,QAAA,OAAO,EAAE,uCAAuC;AAChD,QAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC5B,QAAA,KAAK,EAAE,IAAI;AACZ,KAAA;AACF,CAAA;;AC1HD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-driver-in-memory.mjs","sources":["../../../libs/driver/in-memory/src/backend/backends.token.ts","../../../libs/driver/in-memory/src/backend/delegate.class.ts","../../../libs/driver/in-memory/src/backend/root.service.ts","../../../libs/driver/in-memory/src/driver/base.class.ts","../../../libs/driver/in-memory/src/config/default.ts","../../../libs/driver/in-memory/src/config/token.ts","../../../libs/driver/in-memory/src/module.ts","../../../libs/driver/in-memory/src/provider.ts","../../../libs/driver/in-memory/src/routing/provider.ts","../../../libs/driver/in-memory/src/daffodil-driver-in-memory.ts"],"sourcesContent":["import { createServicesInjectionToken } from '@daffodil/core';\n\nimport { DaffInMemoryBackendInterface } from './type';\n\nexport const {\n /**\n * A token that holds the currently loaded in-memory backends.\n */\n token: DAFF_IN_MEMORY_BACKENDS,\n /**\n * Provide backend classes to {@link DAFF_IN_MEMORY_BACKENDS}.\n */\n provider: provideDaffInMemoryBackends,\n} = createServicesInjectionToken<DaffInMemoryBackendInterface>('DAFF_IN_MEMORY_BACKENDS');\n","import {\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\nimport { Observable } from 'rxjs';\n\nimport { DaffInMemoryDataServiceInterface } from './data-service.type';\nimport { DaffInMemoryRouteableBackend } from './routeable.type';\nimport { DaffInMemoryDriverConfig } from '../public_api';\n\nenum Method {\n GET = 'get',\n POST = 'post',\n PUT = 'put',\n DELETE = 'delete',\n}\n\n/**\n * An class that automatically delegates requests to in-memory backends.\n *\n * @inheritdoc\n */\nexport class DaffInMemoryBackendDelegate implements DaffInMemoryDataServiceInterface {\n\n constructor(\n protected backends: Array<DaffInMemoryRouteableBackend>,\n protected config: DaffInMemoryDriverConfig,\n ) {}\n\n protected delegateRequest(reqInfo: RequestInfo, method: Method): Observable<any> {\n const backend = this.backends.find((b) => 'collectionName' in b ? b.collectionName === reqInfo.collectionName : b.canHandle(reqInfo.collectionName));\n const request = backend?.[method];\n\n if(request) {\n // allow child backends to return nully values\n // which will fall back to default request behavior (https://github.com/angular/angular/tree/main/packages/misc/angular-in-memory-web-api#http-request-handling)\n return request.call(backend, reqInfo);\n }\n\n if(!this.config.passThroughUnknownRequests) {\n return reqInfo.utils.createResponse$(() => ({\n status: STATUS.NOT_FOUND,\n statusText: `Backend ${reqInfo.collectionName} not found or does not support the ${method} request method`,\n }));\n }\n\n return undefined;\n }\n\n get?(reqInfo: RequestInfo): Observable<any> {\n return this.delegateRequest(reqInfo, Method.GET);\n }\n\n post?(reqInfo: RequestInfo): Observable<any> {\n return this.delegateRequest(reqInfo, Method.POST);\n }\n\n put?(reqInfo: RequestInfo): Observable<any> {\n return this.delegateRequest(reqInfo, Method.PUT);\n }\n\n delete?(reqInfo: RequestInfo): Observable<any> {\n return this.delegateRequest(reqInfo, Method.DELETE);\n }\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n} from 'angular-in-memory-web-api';\nimport {\n combineLatest,\n map,\n take,\n} from 'rxjs';\n\nimport { observe } from '@daffodil/core';\n\nimport { DAFF_IN_MEMORY_BACKENDS } from './backends.token';\nimport { DaffInMemoryDataServiceInterface } from './data-service.type';\nimport { DaffInMemoryBackendDelegate } from './delegate.class';\nimport { DaffInMemoryBackendInterface } from './type';\nimport {\n DAFF_IN_MEMORY_DRIVER_CONFIG,\n DaffInMemoryDriverConfig,\n} from '../public_api';\n\n/**\n * An in-memory backend that automatically delegates requests to backends provided to {@link DAFF_IN_MEMORY_BACKENDS}.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryRootBackend extends DaffInMemoryBackendDelegate implements DaffInMemoryDataServiceInterface, InMemoryDbService {\n constructor(\n @Inject(DAFF_IN_MEMORY_BACKENDS) private _backends: Array<DaffInMemoryBackendInterface>,\n @Inject(DAFF_IN_MEMORY_DRIVER_CONFIG) private _config: DaffInMemoryDriverConfig,\n ) {\n super(_backends, _config);\n }\n\n createDb(reqInfo?: RequestInfo) {\n return combineLatest(this._backends.map(observe)).pipe(\n take(1),\n map((backends) => backends.reduce((db, backend) => ({\n ...db,\n ...backend.createDb(reqInfo),\n }), {})),\n );\n }\n}\n","import { InMemoryBackendConfigArgs } from 'angular-in-memory-web-api';\n\n/**\n * The base class for in-memory drivers.\n */\nexport abstract class DaffInMemoryDriverBase {\n /**\n * The URL of the corresponding backend.\n * Does not include a trailing slash, it is of the form: `/<api base>/<collection name>`.\n */\n protected readonly url = `/${this.config.apiBase}/${this.collectionName}`;\n\n constructor(\n private config: InMemoryBackendConfigArgs,\n private collectionName: string,\n ) {}\n}\n","import { DaffInMemoryDriverConfig } from './type';\n\nexport const DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT: DaffInMemoryDriverConfig = {\n apiBase: 'api',\n passThroughUnknownRequests: false,\n};\n","import { createConfigInjectionToken } from '@daffodil/core';\n\nimport { DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT } from './default';\nimport { DaffInMemoryDriverConfig } from './type';\n\nexport const {\n token: DAFF_IN_MEMORY_DRIVER_CONFIG,\n /**\n * Provider function for {@link DAFF_IN_MEMORY_DRIVER_CONFIG}.\n */\n provider: provideDaffInMemoryDriverConfig,\n} = createConfigInjectionToken<DaffInMemoryDriverConfig>(DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, 'DAFF_IN_MEMORY_DRIVER_CONFIG');\n","import {\n NgModule,\n ModuleWithProviders,\n importProvidersFrom,\n} from '@angular/core';\nimport { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';\n\nimport { DaffInMemoryRootBackend } from './backend/public_api';\nimport {\n DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT,\n DaffInMemoryDriverConfig,\n provideDaffInMemoryDriverConfig,\n} from './config/public_api';\n\n/**\n * Sets up the angular in memory web API with the {@link DaffInMemoryRootBackend}.\n */\n@NgModule()\nexport class DaffInMemoryDriverModule {\n static forRoot(config: DaffInMemoryDriverConfig = DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT): ModuleWithProviders<DaffInMemoryDriverModule> {\n return {\n ngModule: DaffInMemoryDriverModule,\n providers: [\n importProvidersFrom(HttpClientInMemoryWebApiModule.forRoot(DaffInMemoryRootBackend, config)),\n provideDaffInMemoryDriverConfig(config),\n ],\n };\n }\n}\n","import {\n EnvironmentProviders,\n importProvidersFrom,\n makeEnvironmentProviders,\n Type,\n} from '@angular/core';\nimport { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';\n\nimport {\n DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT,\n DaffInMemoryBackendInterface,\n DaffInMemoryDriverConfig,\n DaffInMemoryRootBackend,\n provideDaffInMemoryBackends,\n provideDaffInMemoryDriverConfig,\n} from './public_api';\n\n/**\n * Configures the Angular in-memory web API with Daffodil backend services.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideDaffInMemoryDriver(\n * { delay: 300 },\n * DaffProductInMemoryBackendService,\n * DaffCartInMemoryBackendService\n * )\n * ]\n * });\n * ```\n */\nexport const provideDaffInMemoryDriver = (config: DaffInMemoryDriverConfig = DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, ...backends: Array<Type<DaffInMemoryBackendInterface>>): EnvironmentProviders[] => {\n config = { ...DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT,...config };\n return [\n importProvidersFrom(HttpClientInMemoryWebApiModule.forRoot(DaffInMemoryRootBackend, { ...config, passThruUnknownUrl: config.passThroughUnknownRequests })),\n makeEnvironmentProviders([\n provideDaffInMemoryDriverConfig(config),\n provideDaffInMemoryBackends(...backends),\n ]),\n ];\n};\n","import {\n EnvironmentProviders,\n inject,\n InjectionToken,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport {\n DaffInMemoryRoutableObject,\n DaffInMemoryRoutableObjects,\n} from './routable-object';\n\n/**\n * A function that returns an array of entities with URL properties.\n * Used to provide routable in-memory object information to the routing system.\n */\nexport type DaffInMemoryRoutableObjectsResolver = () => Array<{ url: string }>;\n\n/**\n * Multi-injection token for routable object resolvers.\n *\n * Each in-memory driver (e.g., product, navigation) can register a resolver\n * that provides its entities with URL properties. This token collects all\n * such resolvers so they can be processed together to build the routing map.\n *\n * @docs-private\n */\nconst DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER = new InjectionToken<{ type: string; resolver: DaffInMemoryRoutableObjectsResolver }[]>(\n 'DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER', {\n providedIn: 'root',\n factory: () => [],\n },\n);\n\n/**\n * Internal injection token that builds and provides the complete map of routable objects.\n *\n * This token automatically collects all registered routable object resolvers and builds\n * a Map where the key is the URL path and the value is an object containing both the URL\n * and its associated type. This map is used by in-memory drivers to resolve URLs to their types.\n *\n * @docs-private\n */\nexport const DAFF_INMEMORY_ROUTABLE_OBJECTS = new InjectionToken<DaffInMemoryRoutableObjects>(\n 'DAFF_INMEMORY_ROUTABLE_OBJECTS',\n {\n providedIn: 'root',\n factory: () => {\n const resolvers = inject(DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER, { optional: true }) || [];\n const map = new Map<string, DaffInMemoryRoutableObject>();\n\n if (!Array.isArray(resolvers)) {\n throw new Error('DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER must be an array');\n }\n\n resolvers.forEach((entry) => {\n const entities = entry.resolver();\n entities.forEach(entity => {\n if (map.has(entity.url)) {\n const existing = map.get(entity.url);\n console.warn(\n `[@daffodil/driver/in-memory] Duplicate entity URL detected: \"${entity.url}\". ` +\n `Already registered with type \"${existing?.type}\", attempting to register again with type \"${entry.type}\". ` +\n `The first registration will be used.`,\n );\n return;\n }\n map.set(entity.url, { url: entity.url, type: entry.type });\n });\n });\n\n return map;\n },\n },\n);\n\n/**\n * Registers routable objects from an in-memory driver with the routing system.\n *\n * This function allows in-memory drivers to provide their entities (with URL properties)\n * to enable automatic URL resolution. Each driver provides a resolver function that\n * returns its entities with URL properties, along with a type identifier.\n *\n * The resolver function runs in an injection context, which means you can use Angular's\n * `inject()` function within it to access services and dependencies.\n *\n * @param type - The type identifier for these routable objects (e.g., \"PRODUCTS\")\n * @param resolver - A function that returns an array of entities with URL properties.\n * This function runs in an injection context, allowing use of `inject()`.\n * @returns Environment providers that register the routable objects\n *\n * @usageNotes\n *\n * ### Basic Usage\n *\n * In your driver package, create a resolver function:\n *\n * ```typescript\n * const productResolver = (): Array<{ url: string }> => {\n * return inject(DaffInMemoryBackendProductService).products.map((p) => ({ url: p.url }));\n * };\n * ```\n *\n * Then in your app configuration:\n *\n * ```typescript\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDaffInMemoryRoutableObjects(\"PRODUCTS\", productResolver),\n * ]\n * };\n * ```\n */\nexport const provideDaffInMemoryRoutableObjects = (\n type: string,\n resolver: DaffInMemoryRoutableObjectsResolver,\n): EnvironmentProviders => makeEnvironmentProviders([\n {\n provide: DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER,\n useValue: { type, resolver },\n multi: true,\n },\n]);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAIO,MAAM;AACX;;AAEG;AACH,KAAK,EAAE,uBAAuB;AAC9B;;AAEG;AACH,QAAQ,EAAE,2BAA2B,GACtC,GAAG,4BAA4B,CAA+B,yBAAyB;;ACHxF,IAAK,MAKJ;AALD,CAAA,UAAK,MAAM,EAAA;AACT,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACnB,CAAC,EALI,MAAM,KAAN,MAAM,GAAA,EAAA,CAAA,CAAA;AAOX;;;;AAIG;MACU,2BAA2B,CAAA;IAEtC,WAAA,CACY,QAA6C,EAC7C,MAAgC,EAAA;QADhC,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,MAAM,GAAN,MAAM;IACf;IAEO,eAAe,CAAC,OAAoB,EAAE,MAAc,EAAA;AAC5D,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,IAAI,CAAC,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,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AAC5D,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,GAAG;IACZ,CAAC;AACF,CAAA;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;AACI,MAAM,kCAAkC,GAAG,CAChD,IAAY,EACZ,QAA6C,KACpB,wBAAwB,CAAC;AAClD,IAAA;AACE,QAAA,OAAO,EAAE,uCAAuC;AAChD,QAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC5B,QAAA,KAAK,EAAE,IAAI;AACZ,KAAA;AACF,CAAA;;AC1HD;;AAEG;;;;"}
@@ -15,10 +15,10 @@ class MagentoMoneyFactory extends DaffModelFactory {
15
15
  constructor() {
16
16
  super(MockMagentoMoney);
17
17
  }
18
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoMoneyFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
19
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoMoneyFactory, providedIn: 'root' }); }
18
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoMoneyFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
19
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoMoneyFactory, providedIn: 'root' }); }
20
20
  }
21
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoMoneyFactory, decorators: [{
21
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoMoneyFactory, decorators: [{
22
22
  type: Injectable,
23
23
  args: [{
24
24
  providedIn: 'root',
@@ -40,10 +40,10 @@ class MagentoDiscountFactory extends DaffModelFactory {
40
40
  constructor() {
41
41
  super(MockMagentoDiscount);
42
42
  }
43
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoDiscountFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
44
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoDiscountFactory, providedIn: 'root' }); }
43
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoDiscountFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
44
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoDiscountFactory, providedIn: 'root' }); }
45
45
  }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoDiscountFactory, decorators: [{
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoDiscountFactory, decorators: [{
47
47
  type: Injectable,
48
48
  args: [{
49
49
  providedIn: 'root',
@@ -61,10 +61,10 @@ class MagentoSearchResultPageInfoFactory extends DaffModelFactory {
61
61
  constructor() {
62
62
  super(MockMagentoSearchResultPageInfo);
63
63
  }
64
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoSearchResultPageInfoFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
65
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoSearchResultPageInfoFactory, providedIn: 'root' }); }
64
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoSearchResultPageInfoFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
65
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoSearchResultPageInfoFactory, providedIn: 'root' }); }
66
66
  }
67
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: MagentoSearchResultPageInfoFactory, decorators: [{
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoSearchResultPageInfoFactory, decorators: [{
68
68
  type: Injectable,
69
69
  args: [{
70
70
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-driver-magento-testing.mjs","sources":["../../../libs/driver/magento/testing/src/factories/money.factory.ts","../../../libs/driver/magento/testing/src/factories/discount.factory.ts","../../../libs/driver/magento/testing/src/factories/page-info.factory.ts","../../../libs/driver/magento/testing/src/daffodil-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoMoney } from '@daffodil/driver/magento';\n\nexport class MockMagentoMoney implements MagentoMoney {\n __typename = 'Money';\n value = faker.number.int({ min: 1, max: 10000 });\n currency = faker.finance.currencyCode();\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoMoneyFactory extends DaffModelFactory<MagentoMoney> {\n constructor() {\n super(MockMagentoMoney);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoDiscount,\n MagentoMoney,\n} from '@daffodil/driver/magento';\n\nimport { MagentoMoneyFactory } from './money.factory';\n\nexport class MockMagentoDiscount implements MagentoDiscount {\n __typename = 'Discount';\n amount = this.money();\n label = faker.lorem.word();\n\n private money(): MagentoMoney {\n return (new MagentoMoneyFactory()).create();\n }\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoDiscountFactory extends DaffModelFactory<MagentoDiscount> {\n constructor() {\n super(MockMagentoDiscount);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoSearchResultPageInfo } from '@daffodil/driver/magento';\n\nclass MockMagentoSearchResultPageInfo implements MagentoSearchResultPageInfo {\n current_page = 1;\n page_size = faker.number.int(100);\n total_pages = faker.number.int(100);\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoSearchResultPageInfoFactory extends DaffModelFactory<MagentoSearchResultPageInfo> {\n constructor(){\n super(MockMagentoSearchResultPageInfo);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAMa,gBAAgB,CAAA;AAA7B,IAAA,WAAA,GAAA;QACE,IAAA,CAAA,UAAU,GAAG,OAAO;AACpB,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAChD,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE;IACzC;AAAC;AAAA;AAKK,MAAO,mBAAoB,SAAQ,gBAA8B,CAAA;AACrE,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,gBAAgB,CAAC;IACzB;+GAHW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,E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AC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;IACrC;AAAC;AAKK,MAAO,kCAAmC,SAAQ,gBAA6C,CAAA;AACnG,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,+BAA+B,CAAC;IACxC;+GAHW,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cAFjC,MAAM,EAAA,CAAA,CAAA;;4FAEP,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAH9C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACdD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-driver-magento-testing.mjs","sources":["../../../libs/driver/magento/testing/src/factories/money.factory.ts","../../../libs/driver/magento/testing/src/factories/discount.factory.ts","../../../libs/driver/magento/testing/src/factories/page-info.factory.ts","../../../libs/driver/magento/testing/src/daffodil-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoMoney } from '@daffodil/driver/magento';\n\nexport class MockMagentoMoney implements MagentoMoney {\n __typename = 'Money';\n value = faker.number.int({ min: 1, max: 10000 });\n currency = faker.finance.currencyCode();\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoMoneyFactory extends DaffModelFactory<MagentoMoney> {\n constructor() {\n super(MockMagentoMoney);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoDiscount,\n MagentoMoney,\n} from '@daffodil/driver/magento';\n\nimport { MagentoMoneyFactory } from './money.factory';\n\nexport class MockMagentoDiscount implements MagentoDiscount {\n __typename = 'Discount';\n amount = this.money();\n label = faker.lorem.word();\n\n private money(): MagentoMoney {\n return (new MagentoMoneyFactory()).create();\n }\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoDiscountFactory extends DaffModelFactory<MagentoDiscount> {\n constructor() {\n super(MockMagentoDiscount);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoSearchResultPageInfo } from '@daffodil/driver/magento';\n\nclass MockMagentoSearchResultPageInfo implements MagentoSearchResultPageInfo {\n current_page = 1;\n page_size = faker.number.int(100);\n total_pages = faker.number.int(100);\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoSearchResultPageInfoFactory extends DaffModelFactory<MagentoSearchResultPageInfo> {\n constructor(){\n super(MockMagentoSearchResultPageInfo);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAMa,gBAAgB,CAAA;AAA7B,IAAA,WAAA,GAAA;QACE,IAAA,CAAA,UAAU,GAAG,OAAO;AACpB,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAChD,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE;IACzC;AAAC;AAAA;AAKK,MAAO,mBAAoB,SAAQ,gBAA8B,CAAA;AACrE,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,gBAAgB,CAAC;IACzB;8GAHW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,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A,GAAA;QACE,IAAA,CAAA,YAAY,GAAI,CAAC;QACjB,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QACjC,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;IACrC;AAAC;AAKK,MAAO,kCAAmC,SAAQ,gBAA6C,CAAA;AACnG,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,+BAA+B,CAAC;IACxC;8GAHW,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cAFjC,MAAM,EAAA,CAAA,CAAA;;2FAEP,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAH9C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACdD;;AAEG;;;;"}
@@ -1,13 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { makeEnvironmentProviders, inject, Inject, Injectable, PLATFORM_ID, provideAppInitializer, TransferState, InjectionToken } from '@angular/core';
3
- import { ApolloLink, InMemoryCache, from } from '@apollo/client/core';
4
- import { onError } from '@apollo/client/link/error';
3
+ import { InMemoryCache, ApolloLink as ApolloLink$1 } from '@apollo/client/core';
4
+ import { ErrorLink } from '@apollo/client/link/error';
5
5
  import { Apollo, provideApollo, gql } from 'apollo-angular';
6
6
  import { HttpLink } from 'apollo-angular/http';
7
- import { provideDaffApolloRequestHandlerFactories, DAFF_APOLLO_REQUEST_HANDLERS } from '@daffodil/core/graphql';
8
- import { provideDaffDriverHttpClientCacheService, DaffDriverNetworkError } from '@daffodil/driver';
7
+ import { provideDaffApolloRequestHandlerFactories, getApolloOperationHeaders, DAFF_APOLLO_REQUEST_HANDLERS } from '@daffodil/core/graphql';
8
+ import { provideDaffDriverHttpClientCacheService } from '@daffodil/driver';
9
9
  import { createSingleInjectionToken, createMultiInjectionToken, DaffInheritableError, daffIsError, DaffSortDirectionEnum } from '@daffodil/core';
10
+ import { ApolloLink, CombinedGraphQLErrors } from '@apollo/client';
10
11
  import { isPlatformBrowser } from '@angular/common';
12
+ import { map as map$2 } from 'rxjs';
11
13
 
12
14
  var possibleTypes = {
13
15
  AggregationOptionInterface: [
@@ -537,10 +539,10 @@ class DaffMagentoApolloCacheableOperationsLinkGenerator {
537
539
  return forward(operation);
538
540
  });
539
541
  }
540
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, deps: [{ token: DAFF_MAGENTO_CACHEABLE_OPERATIONS }], target: i0.ɵɵFactoryTarget.Injectable }); }
541
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, providedIn: 'root' }); }
542
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, deps: [{ token: DAFF_MAGENTO_CACHEABLE_OPERATIONS }], target: i0.ɵɵFactoryTarget.Injectable }); }
543
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, providedIn: 'root' }); }
542
544
  }
543
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, decorators: [{
545
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, decorators: [{
544
546
  type: Injectable,
545
547
  args: [{
546
548
  providedIn: 'root',
@@ -790,10 +792,10 @@ class DaffDriverHttpClientCacheMagentoService {
790
792
  location.reload();
791
793
  }
792
794
  }
793
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
794
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, providedIn: 'root' }); }
795
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
796
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, providedIn: 'root' }); }
795
797
  }
796
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, decorators: [{
798
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, decorators: [{
797
799
  type: Injectable,
798
800
  args: [{
799
801
  providedIn: 'root',
@@ -815,19 +817,16 @@ const provideDaffMagentoCacheHeader = () => makeEnvironmentProviders([
815
817
  return (operation, forward) => {
816
818
  if (cacheHeader) {
817
819
  operation.setContext({
818
- headers: {
819
- ...operation.getContext().headers,
820
- [MAGENTO_CUSTOMER_CACHE_ID_HEADER]: cacheHeader,
821
- },
820
+ headers: getApolloOperationHeaders(operation).append(MAGENTO_CUSTOMER_CACHE_ID_HEADER, cacheHeader),
822
821
  });
823
822
  }
824
- return forward(operation).map((response) => {
823
+ return forward(operation).pipe(map$2((response) => {
825
824
  const { headers } = operation.getContext().response;
826
825
  if (headers.get(MAGENTO_CUSTOMER_CACHE_ID_HEADER)) {
827
826
  cacheHeader = headers.get(MAGENTO_CUSTOMER_CACHE_ID_HEADER);
828
827
  }
829
828
  return response;
830
- });
829
+ }));
831
830
  };
832
831
  }),
833
832
  ]);
@@ -844,25 +843,22 @@ class DaffMagentoCacheHeaderApolloLinkGenerator {
844
843
  return new ApolloLink((operation, forward) => {
845
844
  if (this._cacheHeader) {
846
845
  operation.setContext({
847
- headers: {
848
- ...operation.getContext().headers,
849
- [MAGENTO_CUSTOMER_CACHE_ID_HEADER]: this._cacheHeader,
850
- },
846
+ headers: getApolloOperationHeaders(operation).append(MAGENTO_CUSTOMER_CACHE_ID_HEADER, this._cacheHeader),
851
847
  });
852
848
  }
853
- return forward(operation).map((response) => {
849
+ return forward(operation).pipe(map$2((response) => {
854
850
  const { headers } = operation.getContext().response;
855
851
  if (headers.get(MAGENTO_CUSTOMER_CACHE_ID_HEADER)) {
856
852
  this._cacheHeader = headers.get(MAGENTO_CUSTOMER_CACHE_ID_HEADER);
857
853
  }
858
854
  return response;
859
- });
855
+ }));
860
856
  });
861
857
  }
862
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffMagentoCacheHeaderApolloLinkGenerator, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
863
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffMagentoCacheHeaderApolloLinkGenerator, providedIn: 'root' }); }
858
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoCacheHeaderApolloLinkGenerator, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
859
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoCacheHeaderApolloLinkGenerator, providedIn: 'root' }); }
864
860
  }
865
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffMagentoCacheHeaderApolloLinkGenerator, decorators: [{
861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoCacheHeaderApolloLinkGenerator, decorators: [{
866
862
  type: Injectable,
867
863
  args: [{
868
864
  providedIn: 'root',
@@ -886,12 +882,12 @@ token: DAFF_DRIVER_MAGENTO_ERROR_HANDLER,
886
882
  * Provider function for {@link DAFF_DRIVER_MAGENTO_ERROR_HANDLER}.
887
883
  */
888
884
  provider: provideDaffDriverMagentoErrorHandler, } = createSingleInjectionToken('DAFF_DRIVER_MAGENTO_ERROR_HANDLER', {
889
- factory: () => ({ graphQLErrors, networkError }) => {
890
- if (graphQLErrors) {
891
- graphQLErrors.map(({ message, locations, path }) => console.error(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`));
885
+ factory: () => ({ error }) => {
886
+ if (CombinedGraphQLErrors.is(error)) {
887
+ error.errors.map(({ message, locations, path }) => console.error(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`));
892
888
  }
893
- if (networkError) {
894
- console.error(`[Network error]: ${networkError}`);
889
+ else {
890
+ console.error(`[Network error]: ${error.message}`);
895
891
  }
896
892
  },
897
893
  });
@@ -958,9 +954,9 @@ function provideMagentoDriver(options, ...features) {
958
954
  };
959
955
  return {
960
956
  ...inject(DAFF_DRIVER_MAGENTO_EXTRA_APOLLO_OPTIONS),
961
- link: from([
962
- ...inject(DAFF_APOLLO_REQUEST_HANDLERS),
963
- onError(inject(DAFF_DRIVER_MAGENTO_ERROR_HANDLER)),
957
+ link: ApolloLink$1.from([
958
+ ...inject(DAFF_APOLLO_REQUEST_HANDLERS).map((handler) => new ApolloLink$1(handler)),
959
+ new ErrorLink(inject(DAFF_DRIVER_MAGENTO_ERROR_HANDLER)),
964
960
  inject(HttpLink).create(opts),
965
961
  ]),
966
962
  cache: new InMemoryCache({ typePolicies: opts.typePolicies, possibleTypes: opts.possibleTypes }),
@@ -999,20 +995,19 @@ function daffMagentoTransformGraphQlError(error, map) {
999
995
  */
1000
996
  // TODO: return array of errors
1001
997
  function daffTransformMagentoError(error, map) {
1002
- if (error.graphQLErrors?.length > 0) {
1003
- return error.graphQLErrors.map(err => daffMagentoTransformGraphQlError(err, map))[0];
1004
- }
1005
- else if (error.networkError) {
1006
- return new DaffDriverNetworkError(error.networkError.message);
998
+ if (CombinedGraphQLErrors.is(error)) {
999
+ return error.errors.map(err => daffMagentoTransformGraphQlError(err, map))[0];
1007
1000
  }
1008
1001
  else if (daffIsError(error)) {
1009
1002
  return error;
1010
1003
  }
1011
1004
  else {
1005
+ // TODO: how do we determine which error to return?
1006
+ // https://www.apollographql.com/docs/react/data/error-handling#identifying-error-types
1007
+ // return new DaffDriverNetworkError((<ApolloError>error).networkError.message);
1012
1008
  return new DaffDriverMagentoError(error.message);
1013
1009
  }
1014
1010
  }
1015
- ;
1016
1011
 
1017
1012
  var MagentoSortEnum;
1018
1013
  (function (MagentoSortEnum) {