@daffodil/driver 0.90.0 → 0.92.3-rc.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.
- package/README.md +16 -1
- package/fesm2022/daffodil-driver-hubspot-testing.mjs +3 -3
- package/fesm2022/daffodil-driver-hubspot-testing.mjs.map +1 -1
- package/fesm2022/daffodil-driver-in-memory.mjs +100 -9
- package/fesm2022/daffodil-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-driver-magento-testing.mjs +9 -9
- package/fesm2022/daffodil-driver-magento-testing.mjs.map +1 -1
- package/fesm2022/daffodil-driver-magento.mjs +359 -281
- package/fesm2022/daffodil-driver-magento.mjs.map +1 -1
- package/fesm2022/daffodil-driver-shopify-testing.mjs +128 -53
- package/fesm2022/daffodil-driver-shopify-testing.mjs.map +1 -1
- package/fesm2022/daffodil-driver-shopify.mjs +1440 -1432
- package/fesm2022/daffodil-driver-shopify.mjs.map +1 -1
- package/fesm2022/daffodil-driver.mjs +3 -3
- package/fesm2022/daffodil-driver.mjs.map +1 -1
- package/in-memory/index.d.ts +80 -3
- package/magento/index.d.ts +112 -36
- package/package.json +1 -1
- package/shopify/index.d.ts +4318 -3116
- package/shopify/testing/index.d.ts +101 -36
package/README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
# @daffodil/driver
|
|
2
2
|
|
|
3
|
-
The `@daffodil/driver` package
|
|
3
|
+
The `@daffodil/driver` package provides core driver interfaces, models, and utilities for integrating Daffodil with various ecommerce platforms.
|
|
4
|
+
|
|
5
|
+
## Available drivers
|
|
6
|
+
|
|
7
|
+
- **[Magento/MageOS](/libs/driver/guides/magento.md)** - GraphQL integration with Magento 2.x and MageOS
|
|
8
|
+
- **Shopify** - GraphQL integration with Shopify Storefront API
|
|
9
|
+
- **In-Memory** - Mock driver with fake data for testing and development
|
|
10
|
+
|
|
11
|
+
## What's included
|
|
12
|
+
|
|
13
|
+
This package contains:
|
|
14
|
+
- Driver interface definitions and models
|
|
15
|
+
- HTTP client caching utilities
|
|
16
|
+
- Error handling for driver operations
|
|
17
|
+
- Configuration utilities for platform-specific drivers
|
|
18
|
+
|
|
@@ -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.
|
|
27
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
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' }); }
|
|
28
28
|
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", 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
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import { createServicesInjectionToken, observe, createConfigInjectionToken } from '@daffodil/core';
|
|
2
2
|
import { STATUS, HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Inject, Injectable, importProvidersFrom, NgModule, makeEnvironmentProviders } from '@angular/core';
|
|
4
|
+
import { Inject, Injectable, importProvidersFrom, NgModule, makeEnvironmentProviders, InjectionToken, inject } from '@angular/core';
|
|
5
5
|
import { combineLatest, take, map } from 'rxjs';
|
|
6
6
|
|
|
7
7
|
const {
|
|
@@ -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.
|
|
82
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
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' }); }
|
|
83
83
|
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", 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.
|
|
137
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
138
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
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 }); }
|
|
139
139
|
}
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DaffInMemoryDriverModule, decorators: [{
|
|
141
141
|
type: NgModule
|
|
142
142
|
}] });
|
|
143
143
|
|
|
@@ -168,9 +168,100 @@ const provideDaffInMemoryDriver = (config = DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT
|
|
|
168
168
|
];
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Multi-injection token for routable object resolvers.
|
|
173
|
+
*
|
|
174
|
+
* Each in-memory driver (e.g., product, navigation) can register a resolver
|
|
175
|
+
* that provides its entities with URL properties. This token collects all
|
|
176
|
+
* such resolvers so they can be processed together to build the routing map.
|
|
177
|
+
*
|
|
178
|
+
* @docs-private
|
|
179
|
+
*/
|
|
180
|
+
const DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER = new InjectionToken('DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER', {
|
|
181
|
+
providedIn: 'root',
|
|
182
|
+
factory: () => [],
|
|
183
|
+
});
|
|
184
|
+
/**
|
|
185
|
+
* Internal injection token that builds and provides the complete map of routable objects.
|
|
186
|
+
*
|
|
187
|
+
* This token automatically collects all registered routable object resolvers and builds
|
|
188
|
+
* a Map where the key is the URL path and the value is an object containing both the URL
|
|
189
|
+
* and its associated type. This map is used by in-memory drivers to resolve URLs to their types.
|
|
190
|
+
*
|
|
191
|
+
* @docs-private
|
|
192
|
+
*/
|
|
193
|
+
const DAFF_INMEMORY_ROUTABLE_OBJECTS = new InjectionToken('DAFF_INMEMORY_ROUTABLE_OBJECTS', {
|
|
194
|
+
providedIn: 'root',
|
|
195
|
+
factory: () => {
|
|
196
|
+
const resolvers = inject(DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER, { optional: true }) || [];
|
|
197
|
+
const map = new Map();
|
|
198
|
+
if (!Array.isArray(resolvers)) {
|
|
199
|
+
throw new Error('DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER must be an array');
|
|
200
|
+
}
|
|
201
|
+
resolvers.forEach((entry) => {
|
|
202
|
+
const entities = entry.resolver();
|
|
203
|
+
entities.forEach(entity => {
|
|
204
|
+
if (map.has(entity.url)) {
|
|
205
|
+
const existing = map.get(entity.url);
|
|
206
|
+
console.warn(`[@daffodil/driver/in-memory] Duplicate entity URL detected: "${entity.url}". ` +
|
|
207
|
+
`Already registered with type "${existing?.type}", attempting to register again with type "${entry.type}". ` +
|
|
208
|
+
`The first registration will be used.`);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
map.set(entity.url, { url: entity.url, type: entry.type });
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
return map;
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
/**
|
|
218
|
+
* Registers routable objects from an in-memory driver with the routing system.
|
|
219
|
+
*
|
|
220
|
+
* This function allows in-memory drivers to provide their entities (with URL properties)
|
|
221
|
+
* to enable automatic URL resolution. Each driver provides a resolver function that
|
|
222
|
+
* returns its entities with URL properties, along with a type identifier.
|
|
223
|
+
*
|
|
224
|
+
* The resolver function runs in an injection context, which means you can use Angular's
|
|
225
|
+
* `inject()` function within it to access services and dependencies.
|
|
226
|
+
*
|
|
227
|
+
* @param type - The type identifier for these routable objects (e.g., "PRODUCTS")
|
|
228
|
+
* @param resolver - A function that returns an array of entities with URL properties.
|
|
229
|
+
* This function runs in an injection context, allowing use of `inject()`.
|
|
230
|
+
* @returns Environment providers that register the routable objects
|
|
231
|
+
*
|
|
232
|
+
* @usageNotes
|
|
233
|
+
*
|
|
234
|
+
* ### Basic Usage
|
|
235
|
+
*
|
|
236
|
+
* In your driver package, create a resolver function:
|
|
237
|
+
*
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const productResolver = (): Array<{ url: string }> => {
|
|
240
|
+
* return inject(DaffInMemoryBackendProductService).products.map((p) => ({ url: p.url }));
|
|
241
|
+
* };
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* Then in your app configuration:
|
|
245
|
+
*
|
|
246
|
+
* ```typescript
|
|
247
|
+
* export const appConfig: ApplicationConfig = {
|
|
248
|
+
* providers: [
|
|
249
|
+
* provideDaffInMemoryRoutableObjects("PRODUCTS", productResolver),
|
|
250
|
+
* ]
|
|
251
|
+
* };
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
const provideDaffInMemoryRoutableObjects = (type, resolver) => makeEnvironmentProviders([
|
|
255
|
+
{
|
|
256
|
+
provide: DAFF_INMEMORY_ROUTABLE_OBJECTS_RESOLVER,
|
|
257
|
+
useValue: { type, resolver },
|
|
258
|
+
multi: true,
|
|
259
|
+
},
|
|
260
|
+
]);
|
|
261
|
+
|
|
171
262
|
/**
|
|
172
263
|
* Generated bundle index. Do not edit.
|
|
173
264
|
*/
|
|
174
265
|
|
|
175
|
-
export { DAFF_IN_MEMORY_BACKENDS, DAFF_IN_MEMORY_DRIVER_CONFIG, DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, DaffInMemoryBackendDelegate, DaffInMemoryDriverBase, DaffInMemoryDriverModule, DaffInMemoryRootBackend, provideDaffInMemoryBackends, provideDaffInMemoryDriver, provideDaffInMemoryDriverConfig };
|
|
266
|
+
export { DAFF_INMEMORY_ROUTABLE_OBJECTS, DAFF_IN_MEMORY_BACKENDS, DAFF_IN_MEMORY_DRIVER_CONFIG, DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, DaffInMemoryBackendDelegate, DaffInMemoryDriverBase, DaffInMemoryDriverModule, DaffInMemoryRootBackend, provideDaffInMemoryBackends, provideDaffInMemoryDriver, provideDaffInMemoryDriverConfig, provideDaffInMemoryRoutableObjects };
|
|
176
267
|
//# sourceMappingURL=daffodil-driver-in-memory.mjs.map
|
|
@@ -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/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","/**\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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pC;;;ACAD;;;;;;;;;;;;;;;AAeG;AACI,MAAM,yBAAyB,GAAG,CAAC,MAAA,GAAmC,oCAAoC,EAAE,GAAG,QAAmD,KAA4B;IACnM,MAAM,GAAG,EAAE,GAAG,oCAAoC,EAAC,GAAG,MAAM,EAAE;IAC9D,OAAO;AACL,QAAA,mBAAmB,CAAC,8BAA8B,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,GAAG,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,0BAA0B,EAAE,CAAC,CAAC;AAC1J,QAAA,wBAAwB,CAAC;YACvB,+BAA+B,CAAC,MAAM,CAAC;YACvC,2BAA2B,CAAC,GAAG,QAAQ,CAAC;SACzC,CAAC;KACH;AACH;;AC1CA;;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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
17
17
|
}
|
|
18
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
19
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
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' }); }
|
|
20
20
|
}
|
|
21
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", 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.
|
|
44
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
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' }); }
|
|
45
45
|
}
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", 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.
|
|
65
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
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' }); }
|
|
66
66
|
}
|
|
67
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", 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
|
|
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,EAAA,mBAAmB,cAFlB,MAAM,EAAA,CAAA,CAAA;;4FAEP,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;MCHY,mBAAmB,CAAA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