@daffodil/driver 0.87.2 → 0.88.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/daffodil-driver-in-memory.mjs +46 -9
- package/fesm2022/daffodil-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-driver-magento.mjs +472 -38
- package/fesm2022/daffodil-driver-magento.mjs.map +1 -1
- package/in-memory/backend/delegate.class.d.ts +3 -1
- package/in-memory/backend/root.service.d.ts +3 -1
- package/in-memory/config/type.d.ts +9 -0
- package/in-memory/provider.d.ts +19 -0
- package/in-memory/public_api.d.ts +1 -0
- package/magento/apollo/create-http-link.d.ts +8 -0
- package/magento/apollo/possible-types.d.ts +37 -0
- package/magento/apollo/type-policies.d.ts +10 -0
- package/magento/magento.module.d.ts +3 -0
- package/magento/provider.d.ts +14 -0
- package/magento/public_api.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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 } from '@angular/core';
|
|
4
|
+
import { Inject, Injectable, importProvidersFrom, NgModule, makeEnvironmentProviders } from '@angular/core';
|
|
5
5
|
import { combineLatest, take, map } from 'rxjs';
|
|
6
6
|
|
|
7
7
|
const {
|
|
@@ -27,20 +27,25 @@ var Method;
|
|
|
27
27
|
* @inheritdoc
|
|
28
28
|
*/
|
|
29
29
|
class DaffInMemoryBackendDelegate {
|
|
30
|
-
constructor(backends) {
|
|
30
|
+
constructor(backends, config) {
|
|
31
31
|
this.backends = backends;
|
|
32
|
+
this.config = config;
|
|
32
33
|
}
|
|
33
34
|
delegateRequest(reqInfo, method) {
|
|
34
35
|
const backend = this.backends.find((b) => 'collectionName' in b ? b.collectionName === reqInfo.collectionName : b.canHandle(reqInfo.collectionName));
|
|
35
36
|
const request = backend?.[method];
|
|
36
|
-
|
|
37
|
+
if (request) {
|
|
37
38
|
// allow child backends to return nully values
|
|
38
39
|
// 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)
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
return request.call(backend, reqInfo);
|
|
41
|
+
}
|
|
42
|
+
if (!this.config.passThroughUnknownRequests) {
|
|
43
|
+
return reqInfo.utils.createResponse$(() => ({
|
|
41
44
|
status: STATUS.NOT_FOUND,
|
|
42
45
|
statusText: `Backend ${reqInfo.collectionName} not found or does not support the ${method} request method`,
|
|
43
46
|
}));
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
44
49
|
}
|
|
45
50
|
get(reqInfo) {
|
|
46
51
|
return this.delegateRequest(reqInfo, Method.GET);
|
|
@@ -62,9 +67,10 @@ class DaffInMemoryBackendDelegate {
|
|
|
62
67
|
* @inheritdoc
|
|
63
68
|
*/
|
|
64
69
|
class DaffInMemoryRootBackend extends DaffInMemoryBackendDelegate {
|
|
65
|
-
constructor(_backends) {
|
|
66
|
-
super(_backends);
|
|
70
|
+
constructor(_backends, _config) {
|
|
71
|
+
super(_backends, _config);
|
|
67
72
|
this._backends = _backends;
|
|
73
|
+
this._config = _config;
|
|
68
74
|
}
|
|
69
75
|
createDb(reqInfo) {
|
|
70
76
|
return combineLatest(this._backends.map(observe)).pipe(take(1), map((backends) => backends.reduce((db, backend) => ({
|
|
@@ -72,7 +78,7 @@ class DaffInMemoryRootBackend extends DaffInMemoryBackendDelegate {
|
|
|
72
78
|
...backend.createDb(reqInfo),
|
|
73
79
|
}), {})));
|
|
74
80
|
}
|
|
75
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffInMemoryRootBackend, deps: [{ token: DAFF_IN_MEMORY_BACKENDS }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
81
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffInMemoryRootBackend, deps: [{ token: DAFF_IN_MEMORY_BACKENDS }, { token: DAFF_IN_MEMORY_DRIVER_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
76
82
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffInMemoryRootBackend, providedIn: 'root' }); }
|
|
77
83
|
}
|
|
78
84
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffInMemoryRootBackend, decorators: [{
|
|
@@ -83,6 +89,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
83
89
|
}], ctorParameters: () => [{ type: Array, decorators: [{
|
|
84
90
|
type: Inject,
|
|
85
91
|
args: [DAFF_IN_MEMORY_BACKENDS]
|
|
92
|
+
}] }, { type: undefined, decorators: [{
|
|
93
|
+
type: Inject,
|
|
94
|
+
args: [DAFF_IN_MEMORY_DRIVER_CONFIG]
|
|
86
95
|
}] }] });
|
|
87
96
|
|
|
88
97
|
/**
|
|
@@ -102,6 +111,7 @@ class DaffInMemoryDriverBase {
|
|
|
102
111
|
|
|
103
112
|
const DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT = {
|
|
104
113
|
apiBase: 'api',
|
|
114
|
+
passThroughUnknownRequests: false,
|
|
105
115
|
};
|
|
106
116
|
|
|
107
117
|
const { token: DAFF_IN_MEMORY_DRIVER_CONFIG,
|
|
@@ -131,9 +141,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
131
141
|
type: NgModule
|
|
132
142
|
}] });
|
|
133
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Configures the Angular in-memory web API with Daffodil backend services.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* bootstrapApplication(AppComponent, {
|
|
150
|
+
* providers: [
|
|
151
|
+
* provideDaffInMemoryDriver(
|
|
152
|
+
* { delay: 300 },
|
|
153
|
+
* DaffProductInMemoryBackendService,
|
|
154
|
+
* DaffCartInMemoryBackendService
|
|
155
|
+
* )
|
|
156
|
+
* ]
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
const provideDaffInMemoryDriver = (config = DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, ...backends) => {
|
|
161
|
+
config = { ...DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, ...config };
|
|
162
|
+
return [
|
|
163
|
+
importProvidersFrom(HttpClientInMemoryWebApiModule.forRoot(DaffInMemoryRootBackend, { ...config, passThruUnknownUrl: config.passThroughUnknownRequests })),
|
|
164
|
+
makeEnvironmentProviders([
|
|
165
|
+
provideDaffInMemoryDriverConfig(config),
|
|
166
|
+
provideDaffInMemoryBackends(...backends),
|
|
167
|
+
]),
|
|
168
|
+
];
|
|
169
|
+
};
|
|
170
|
+
|
|
134
171
|
/**
|
|
135
172
|
* Generated bundle index. Do not edit.
|
|
136
173
|
*/
|
|
137
174
|
|
|
138
|
-
export { DAFF_IN_MEMORY_BACKENDS, DAFF_IN_MEMORY_DRIVER_CONFIG, DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, DaffInMemoryBackendDelegate, DaffInMemoryDriverBase, DaffInMemoryDriverModule, DaffInMemoryRootBackend, provideDaffInMemoryBackends, provideDaffInMemoryDriverConfig };
|
|
175
|
+
export { DAFF_IN_MEMORY_BACKENDS, DAFF_IN_MEMORY_DRIVER_CONFIG, DAFF_IN_MEMORY_DRIVER_CONFIG_DEFAULT, DaffInMemoryBackendDelegate, DaffInMemoryDriverBase, DaffInMemoryDriverModule, DaffInMemoryRootBackend, provideDaffInMemoryBackends, provideDaffInMemoryDriver, provideDaffInMemoryDriverConfig };
|
|
139
176
|
//# 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/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';\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 constructor(\n protected backends: Array<DaffInMemoryRouteableBackend>,\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 return 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 ? request.call(backend, reqInfo)\n : 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 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';\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 ) {\n super(_backends);\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};\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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAIa,MA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AxB,wBAAwB,EAAA,CAAA,CAAA;;4FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC;;;ACjBD;;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/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":";;;;;;AAIa,MAAA;AACX;;AAEG;AACH,KAAK,EAAE,uBAAuB;AAC9B;;AAEG;AACH,QAAQ,EAAE,2BAA2B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EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAxB,wBAAwB,EAAA,CAAA,CAAA;gHAAxB,wBAAwB,EAAA,CAAA,CAAA;;4FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC;;;ACAD;;;;;;;;;;;;;;;AAeG;AACU,MAAA,yBAAyB,GAAG,CAAC,MAAmC,GAAA,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,10 +1,11 @@
|
|
|
1
|
-
import { DaffInheritableError, daffIsError, createMultiInjectionToken, DaffSortDirectionEnum } from '@daffodil/core';
|
|
2
|
-
import { DaffDriverNetworkError, provideDaffDriverHttpClientCacheService } from '@daffodil/driver';
|
|
3
1
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Inject, Injectable,
|
|
5
|
-
import { ApolloLink } from '@apollo/client/core';
|
|
2
|
+
import { inject, PLATFORM_ID, Inject, Injectable, NgModule } from '@angular/core';
|
|
3
|
+
import { InMemoryCache, from, ApolloLink } from '@apollo/client/core';
|
|
4
|
+
import { provideApollo, gql } from 'apollo-angular';
|
|
5
|
+
import { provideDaffDriverHttpClientCacheService, DaffDriverNetworkError } from '@daffodil/driver';
|
|
6
|
+
import { HttpLink } from 'apollo-angular/http';
|
|
6
7
|
import { isPlatformBrowser } from '@angular/common';
|
|
7
|
-
import {
|
|
8
|
+
import { DaffInheritableError, daffIsError, createMultiInjectionToken, DaffSortDirectionEnum } from '@daffodil/core';
|
|
8
9
|
|
|
9
10
|
var possibleTypes = {
|
|
10
11
|
CartAddressInterface: [
|
|
@@ -100,6 +101,468 @@ var introspectionQueryResultData = {
|
|
|
100
101
|
|
|
101
102
|
const schema = introspectionQueryResultData;
|
|
102
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Creates an Apollo HTTP link for GraphQL requests.
|
|
106
|
+
*
|
|
107
|
+
* @param url - The Shopify Storefront API endpoint URL for GraphQL requests.
|
|
108
|
+
* @returns An ApolloLink instance configured with the provided URL.
|
|
109
|
+
*/
|
|
110
|
+
function createHttpLink(url) {
|
|
111
|
+
const httpLink = inject(HttpLink);
|
|
112
|
+
return httpLink.create({ uri: url });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Magento GraphQL possible types configuration for Apollo Client.
|
|
117
|
+
*
|
|
118
|
+
* This object defines the possible concrete types for each GraphQL interface
|
|
119
|
+
* used in Magento's GraphQL API. Apollo Client uses this information for
|
|
120
|
+
* proper fragment matching and union/interface type resolution.
|
|
121
|
+
*
|
|
122
|
+
* When Apollo Client encounters a GraphQL interface or union type in a query,
|
|
123
|
+
* it needs to know which concrete types can implement that interface to
|
|
124
|
+
* properly cache and normalize the data.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* new InMemoryCache({
|
|
129
|
+
* possibleTypes: MAGENTO_POSSIBLE_TYPES
|
|
130
|
+
* })
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
const MAGENTO_POSSIBLE_TYPES = {
|
|
134
|
+
CartAddressInterface: [
|
|
135
|
+
'BillingCartAddress',
|
|
136
|
+
'ShippingCartAddress',
|
|
137
|
+
],
|
|
138
|
+
CartItemInterface: [
|
|
139
|
+
'SimpleCartItem',
|
|
140
|
+
'VirtualCartItem',
|
|
141
|
+
'DownloadableCartItem',
|
|
142
|
+
'BundleCartItem',
|
|
143
|
+
'ConfigurableCartItem',
|
|
144
|
+
],
|
|
145
|
+
ProductInterface: [
|
|
146
|
+
'VirtualProduct',
|
|
147
|
+
'SimpleProduct',
|
|
148
|
+
'DownloadableProduct',
|
|
149
|
+
'BundleProduct',
|
|
150
|
+
'GroupedProduct',
|
|
151
|
+
'ConfigurableProduct',
|
|
152
|
+
],
|
|
153
|
+
CategoryInterface: [
|
|
154
|
+
'CategoryTree',
|
|
155
|
+
],
|
|
156
|
+
MediaGalleryInterface: [
|
|
157
|
+
'ProductImage',
|
|
158
|
+
'ProductVideo',
|
|
159
|
+
],
|
|
160
|
+
ProductLinksInterface: [
|
|
161
|
+
'ProductLinks',
|
|
162
|
+
],
|
|
163
|
+
CreditMemoItemInterface: [
|
|
164
|
+
'DownloadableCreditMemoItem',
|
|
165
|
+
'BundleCreditMemoItem',
|
|
166
|
+
'CreditMemoItem',
|
|
167
|
+
],
|
|
168
|
+
OrderItemInterface: [
|
|
169
|
+
'DownloadableOrderItem',
|
|
170
|
+
'BundleOrderItem',
|
|
171
|
+
'OrderItem',
|
|
172
|
+
],
|
|
173
|
+
InvoiceItemInterface: [
|
|
174
|
+
'DownloadableInvoiceItem',
|
|
175
|
+
'BundleInvoiceItem',
|
|
176
|
+
'InvoiceItem',
|
|
177
|
+
],
|
|
178
|
+
ShipmentItemInterface: [
|
|
179
|
+
'BundleShipmentItem',
|
|
180
|
+
'ShipmentItem',
|
|
181
|
+
],
|
|
182
|
+
AggregationOptionInterface: [
|
|
183
|
+
'AggregationOption',
|
|
184
|
+
],
|
|
185
|
+
LayerFilterItemInterface: [
|
|
186
|
+
'LayerFilterItem',
|
|
187
|
+
'SwatchLayerFilterItem',
|
|
188
|
+
],
|
|
189
|
+
PhysicalProductInterface: [
|
|
190
|
+
'SimpleProduct',
|
|
191
|
+
'BundleProduct',
|
|
192
|
+
'GroupedProduct',
|
|
193
|
+
'ConfigurableProduct',
|
|
194
|
+
],
|
|
195
|
+
CustomizableOptionInterface: [
|
|
196
|
+
'CustomizableAreaOption',
|
|
197
|
+
'CustomizableDateOption',
|
|
198
|
+
'CustomizableDropDownOption',
|
|
199
|
+
'CustomizableMultipleOption',
|
|
200
|
+
'CustomizableFieldOption',
|
|
201
|
+
'CustomizableFileOption',
|
|
202
|
+
'CustomizableRadioOption',
|
|
203
|
+
'CustomizableCheckboxOption',
|
|
204
|
+
],
|
|
205
|
+
CustomizableProductInterface: [
|
|
206
|
+
'VirtualProduct',
|
|
207
|
+
'SimpleProduct',
|
|
208
|
+
'DownloadableProduct',
|
|
209
|
+
'BundleProduct',
|
|
210
|
+
'ConfigurableProduct',
|
|
211
|
+
],
|
|
212
|
+
SwatchDataInterface: [
|
|
213
|
+
'ImageSwatchData',
|
|
214
|
+
'TextSwatchData',
|
|
215
|
+
'ColorSwatchData',
|
|
216
|
+
],
|
|
217
|
+
SwatchLayerFilterItemInterface: [
|
|
218
|
+
'SwatchLayerFilterItem',
|
|
219
|
+
],
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Custom type policies that allow us to have more granular control
|
|
224
|
+
* over how ApolloClient reads from and writes to the cache.
|
|
225
|
+
*
|
|
226
|
+
* https://www.apollographql.com/docs/react/caching/cache-configuration/#typepolicy-fields
|
|
227
|
+
* https://www.apollographql.com/docs/react/caching/cache-field-behavior/
|
|
228
|
+
*/
|
|
229
|
+
const typePolicies = {
|
|
230
|
+
// Query/Mutation are "types" just like "Cart".
|
|
231
|
+
Query: {
|
|
232
|
+
fields: {
|
|
233
|
+
cart: {
|
|
234
|
+
// Replaces @connection(key: "Cart")
|
|
235
|
+
keyArgs: () => 'Cart',
|
|
236
|
+
},
|
|
237
|
+
customer: {
|
|
238
|
+
keyArgs: () => 'Customer',
|
|
239
|
+
},
|
|
240
|
+
customerCart: {
|
|
241
|
+
keyArgs: () => 'Cart',
|
|
242
|
+
},
|
|
243
|
+
customerWishlistProducts: {
|
|
244
|
+
read: existing => existing || [],
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
AppliedGiftCard: {
|
|
249
|
+
keyFields: ['code'],
|
|
250
|
+
},
|
|
251
|
+
AvailablePaymentMethod: {
|
|
252
|
+
keyFields: ['code'],
|
|
253
|
+
},
|
|
254
|
+
AvailableShippingMethod: {
|
|
255
|
+
// The combination of these fields makes an instance of
|
|
256
|
+
// AvailableShippingMethod unique.
|
|
257
|
+
keyFields: ['carrier_code', 'method_code'],
|
|
258
|
+
},
|
|
259
|
+
Breadcrumb: {
|
|
260
|
+
// Uses provided fields on the object as the `uid`.
|
|
261
|
+
keyFields: ['category_uid'],
|
|
262
|
+
},
|
|
263
|
+
Cart: {
|
|
264
|
+
keyFields: () => 'Cart',
|
|
265
|
+
fields: {
|
|
266
|
+
applied_gift_cards: {
|
|
267
|
+
merge(existing, incoming) {
|
|
268
|
+
return incoming;
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
available_payment_methods: {
|
|
272
|
+
merge(existing, incoming) {
|
|
273
|
+
return incoming;
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
items: {
|
|
277
|
+
merge(existing, incoming) {
|
|
278
|
+
return incoming;
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
prices: {
|
|
282
|
+
// `merge: true` can be used for an object field.
|
|
283
|
+
merge: true,
|
|
284
|
+
},
|
|
285
|
+
shipping_addresses: {
|
|
286
|
+
merge(existing = [], incoming, { readField, mergeObjects }) {
|
|
287
|
+
// street makes these things unique
|
|
288
|
+
const mergeResult = new Set();
|
|
289
|
+
const streetToIndex = new Map();
|
|
290
|
+
existing.forEach((existingShippingAddress, index) => {
|
|
291
|
+
// Use readField instead of existingShippingAddress.street directly because it will follow cache references.
|
|
292
|
+
const street = readField('street', existingShippingAddress);
|
|
293
|
+
streetToIndex.set(street, index);
|
|
294
|
+
});
|
|
295
|
+
incoming.forEach(incomingShippingAddress => {
|
|
296
|
+
const street = readField('street', incomingShippingAddress);
|
|
297
|
+
if (streetToIndex.has(street)) {
|
|
298
|
+
const targetIndex = streetToIndex.get(street);
|
|
299
|
+
const existingShippingAddress = existing[targetIndex];
|
|
300
|
+
const merged = mergeObjects(existingShippingAddress, incomingShippingAddress);
|
|
301
|
+
mergeResult.add(merged);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
// We do not have an address with this street yet, add it on to the end.
|
|
305
|
+
streetToIndex.set(street, streetToIndex.size);
|
|
306
|
+
mergeResult.add(incomingShippingAddress);
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
return Array.from(mergeResult);
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
Customer: {
|
|
315
|
+
keyFields: () => 'Customer',
|
|
316
|
+
merge: true,
|
|
317
|
+
fields: {
|
|
318
|
+
addresses: {
|
|
319
|
+
merge(existing, incoming) {
|
|
320
|
+
return incoming;
|
|
321
|
+
},
|
|
322
|
+
read(cachedAddresses, { toReference }) {
|
|
323
|
+
if (cachedAddresses) {
|
|
324
|
+
return cachedAddresses.map(address => {
|
|
325
|
+
// Update v2 identifiers to new references. Previous
|
|
326
|
+
// entries had `id: CustomerAddress:1` which caused
|
|
327
|
+
// v3's lookup to fail. If we find a legacy id,
|
|
328
|
+
// point it at the object using a reference.
|
|
329
|
+
if (address.id &&
|
|
330
|
+
address.id.includes('CustomerAddress')) {
|
|
331
|
+
return toReference(address.id);
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
return address;
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
// If there are no cached addresses that's fine - the schema
|
|
339
|
+
// shows that it is a nullable field.
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
orders: {
|
|
343
|
+
keyArgs: ['filter'],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
CustomerAddress: {
|
|
348
|
+
fields: {
|
|
349
|
+
street: {
|
|
350
|
+
merge(existing, incoming) {
|
|
351
|
+
return incoming;
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
CustomerPaymentTokens: {
|
|
357
|
+
keyFields: () => 'CustomerPaymentTokens',
|
|
358
|
+
fields: {
|
|
359
|
+
items: {
|
|
360
|
+
merge(existing, incoming) {
|
|
361
|
+
return incoming;
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
Currency: {
|
|
367
|
+
merge: true,
|
|
368
|
+
},
|
|
369
|
+
ProductImage: {
|
|
370
|
+
keyFields: ['url'],
|
|
371
|
+
},
|
|
372
|
+
ConfigurableProductOptions: {
|
|
373
|
+
keyFields: ['uid'],
|
|
374
|
+
},
|
|
375
|
+
SelectedConfigurableOption: {
|
|
376
|
+
// id alone is not enough to identify a selected option as it can refer
|
|
377
|
+
// to something like "size" where value_id refers to "large".
|
|
378
|
+
// TODO: Use configurable_product_option_uid for ConfigurableWishlistItem when available in 2.4.5
|
|
379
|
+
keyFields: fields => fields.configurable_product_option_uid
|
|
380
|
+
? [
|
|
381
|
+
'configurable_product_option_uid',
|
|
382
|
+
'configurable_product_option_value_uid',
|
|
383
|
+
]
|
|
384
|
+
: ['id', 'value_id'],
|
|
385
|
+
},
|
|
386
|
+
SelectedPaymentMethod: {
|
|
387
|
+
keyFields: ['code'],
|
|
388
|
+
},
|
|
389
|
+
ShippingCartAddress: {
|
|
390
|
+
keyFields: ['street'],
|
|
391
|
+
fields: {
|
|
392
|
+
available_shipping_methods: {
|
|
393
|
+
merge(existing = [], incoming, { readField, mergeObjects }) {
|
|
394
|
+
// carrier_code + method_code makes these things unique
|
|
395
|
+
const mergeResult = new Set();
|
|
396
|
+
const carrierToIndex = new Map();
|
|
397
|
+
existing.forEach((existingShippingMethod, index) => {
|
|
398
|
+
// Use readField because it will follow cache references.
|
|
399
|
+
const carrierCode = readField('carrier_code', existingShippingMethod);
|
|
400
|
+
const methodCode = readField('method_code', existingShippingMethod);
|
|
401
|
+
const carrierKey = `${carrierCode}|${methodCode}`;
|
|
402
|
+
carrierToIndex.set(carrierKey, index);
|
|
403
|
+
});
|
|
404
|
+
incoming.forEach(incomingShippingMethod => {
|
|
405
|
+
// Use readField because it will follow cache references.
|
|
406
|
+
const carrierCode = readField('carrier_code', incomingShippingMethod);
|
|
407
|
+
const methodCode = readField('method_code', incomingShippingMethod);
|
|
408
|
+
const carrierKey = `${carrierCode}|${methodCode}`;
|
|
409
|
+
if (carrierToIndex.has(carrierKey)) {
|
|
410
|
+
const targetIndex = carrierToIndex.get(carrierKey);
|
|
411
|
+
const existingShippingMethod = existing[targetIndex];
|
|
412
|
+
const merged = mergeObjects(existingShippingMethod, incomingShippingMethod);
|
|
413
|
+
mergeResult.add(merged);
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
// We do not have a method with this key yet, add it on to the end.
|
|
417
|
+
carrierToIndex.set(carrierKey, carrierToIndex.size);
|
|
418
|
+
mergeResult.add(incomingShippingMethod);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
return Array.from(mergeResult);
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
country: {
|
|
425
|
+
merge: true,
|
|
426
|
+
},
|
|
427
|
+
region: {
|
|
428
|
+
merge: true,
|
|
429
|
+
},
|
|
430
|
+
selected_shipping_method: {
|
|
431
|
+
merge: true,
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
CategoryTree: {
|
|
436
|
+
keyFields: ['uid'],
|
|
437
|
+
fields: {
|
|
438
|
+
children: {
|
|
439
|
+
merge(existing, incoming) {
|
|
440
|
+
return incoming;
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
Wishlist: {
|
|
446
|
+
keyFields: ({ id }) => `CustomerWishlist:${id}`,
|
|
447
|
+
fields: {
|
|
448
|
+
items_v2: {
|
|
449
|
+
keyArgs: false,
|
|
450
|
+
merge: false,
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
WishlistItem: {
|
|
455
|
+
keyFields: ({ id }) => `CustomerWishlistItem:${id}`,
|
|
456
|
+
},
|
|
457
|
+
WishlistItems: {
|
|
458
|
+
fields: {
|
|
459
|
+
items: {
|
|
460
|
+
merge: (existing = [], incoming, { variables }) => {
|
|
461
|
+
if (variables) {
|
|
462
|
+
const { currentPage = 1 } = variables;
|
|
463
|
+
// reset cache collection if we're on the first page
|
|
464
|
+
if (currentPage === 1) {
|
|
465
|
+
return incoming;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return [...existing, ...incoming];
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
SimpleWishlistItem: {
|
|
474
|
+
keyFields: ({ id }) => `CustomerSimpleWishlistItem:${id}`,
|
|
475
|
+
},
|
|
476
|
+
VirtualWishlistItem: {
|
|
477
|
+
keyFields: ({ id }) => `CustomerVirtualWishlistItem:${id}`,
|
|
478
|
+
},
|
|
479
|
+
DownloadableWishlistItem: {
|
|
480
|
+
keyFields: ({ id }) => `CustomerDownloadableWishlistItem:${id}`,
|
|
481
|
+
},
|
|
482
|
+
BundleWishlistItem: {
|
|
483
|
+
keyFields: ({ id }) => `CustomerBundleWishlistItem:${id}`,
|
|
484
|
+
},
|
|
485
|
+
GroupedProductWishlistItem: {
|
|
486
|
+
keyFields: ({ id }) => `CustomerGroupedProductWishlistItem:${id}`,
|
|
487
|
+
},
|
|
488
|
+
ConfigurableWishlistItem: {
|
|
489
|
+
keyFields: ({ id }) => `CustomerConfigurableWishlistItem:${id}`,
|
|
490
|
+
},
|
|
491
|
+
GiftCardWishlistItem: {
|
|
492
|
+
keyFields: ({ id }) => `CustomerGiftCardWishlistItem:${id}`,
|
|
493
|
+
},
|
|
494
|
+
SimpleProduct: {
|
|
495
|
+
keyFields: ['uid'],
|
|
496
|
+
},
|
|
497
|
+
ConfigurableProduct: {
|
|
498
|
+
keyFields: ['uid'],
|
|
499
|
+
},
|
|
500
|
+
BundleProduct: {
|
|
501
|
+
keyFields: ['uid'],
|
|
502
|
+
},
|
|
503
|
+
GroupedProduct: {
|
|
504
|
+
keyFields: ['uid'],
|
|
505
|
+
},
|
|
506
|
+
VirtualProduct: {
|
|
507
|
+
keyFields: ['uid'],
|
|
508
|
+
},
|
|
509
|
+
CartItemInterface: {
|
|
510
|
+
keyFields: ['uid'],
|
|
511
|
+
},
|
|
512
|
+
StoreConfig: {
|
|
513
|
+
keyFields: ['store_code'],
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Interacts with the Apollo client.
|
|
519
|
+
*
|
|
520
|
+
* @inheritdoc
|
|
521
|
+
*/
|
|
522
|
+
class DaffDriverHttpClientCacheMagentoService {
|
|
523
|
+
constructor(platformId) {
|
|
524
|
+
this.platformId = platformId;
|
|
525
|
+
}
|
|
526
|
+
reset() {
|
|
527
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
528
|
+
location.reload();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
532
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, providedIn: 'root' }); }
|
|
533
|
+
}
|
|
534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, decorators: [{
|
|
535
|
+
type: Injectable,
|
|
536
|
+
args: [{
|
|
537
|
+
providedIn: 'root',
|
|
538
|
+
}]
|
|
539
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
540
|
+
type: Inject,
|
|
541
|
+
args: [PLATFORM_ID]
|
|
542
|
+
}] }] });
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Sets up the Magento Daffodil driver configuration for Magento's GraphQl API.
|
|
546
|
+
*
|
|
547
|
+
* Under the hood, this creates an Apollo Client configuration.
|
|
548
|
+
*
|
|
549
|
+
* @param endpoint - The Magento store domain (e.g. "https://www.my-store.com/graphql") or an injection token for a string or function that returns a string
|
|
550
|
+
*/
|
|
551
|
+
function provideMagentoDriver(endpoint, options = {
|
|
552
|
+
possibleTypes: MAGENTO_POSSIBLE_TYPES,
|
|
553
|
+
typePolicies,
|
|
554
|
+
}) {
|
|
555
|
+
return [
|
|
556
|
+
provideApollo(() => ({
|
|
557
|
+
link: from([
|
|
558
|
+
createHttpLink(typeof endpoint === 'string' ? endpoint : inject(endpoint)),
|
|
559
|
+
]),
|
|
560
|
+
cache: new InMemoryCache({ typePolicies: options.typePolicies, possibleTypes: options.possibleTypes }),
|
|
561
|
+
})),
|
|
562
|
+
provideDaffDriverHttpClientCacheService(DaffDriverHttpClientCacheMagentoService),
|
|
563
|
+
];
|
|
564
|
+
}
|
|
565
|
+
|
|
103
566
|
const DAFF_DRIVER_MAGENTO_ERROR_CODE = 'DAFF_DRIVER_MAGENTO_ERROR';
|
|
104
567
|
/**
|
|
105
568
|
* A very general error thrown when a more specific error type cannot be determined.
|
|
@@ -240,15 +703,12 @@ const DAFF_MAGENTO_2_4_3_TYPE_POLICIES = {
|
|
|
240
703
|
keyFields: () => 'Cart',
|
|
241
704
|
fields: {
|
|
242
705
|
applied_gift_cards: {
|
|
243
|
-
// eslint-disable-next-line no-unused-vars
|
|
244
706
|
merge: (existing, incoming) => incoming,
|
|
245
707
|
},
|
|
246
708
|
available_payment_methods: {
|
|
247
|
-
// eslint-disable-next-line no-unused-vars
|
|
248
709
|
merge: (existing, incoming) => incoming,
|
|
249
710
|
},
|
|
250
711
|
items: {
|
|
251
|
-
// eslint-disable-next-line no-unused-vars
|
|
252
712
|
merge: (existing, incoming) => incoming,
|
|
253
713
|
},
|
|
254
714
|
prices: {
|
|
@@ -320,7 +780,6 @@ const DAFF_MAGENTO_2_4_3_TYPE_POLICIES = {
|
|
|
320
780
|
CustomerAddress: {
|
|
321
781
|
fields: {
|
|
322
782
|
street: {
|
|
323
|
-
// eslint-disable-next-line no-unused-vars
|
|
324
783
|
merge: (existing, incoming) => incoming,
|
|
325
784
|
},
|
|
326
785
|
},
|
|
@@ -329,7 +788,6 @@ const DAFF_MAGENTO_2_4_3_TYPE_POLICIES = {
|
|
|
329
788
|
keyFields: () => 'CustomerPaymentTokens',
|
|
330
789
|
fields: {
|
|
331
790
|
items: {
|
|
332
|
-
// eslint-disable-next-line no-unused-vars
|
|
333
791
|
merge: (existing, incoming) => incoming,
|
|
334
792
|
},
|
|
335
793
|
},
|
|
@@ -427,33 +885,6 @@ const DAFF_MAGENTO_2_4_3_TYPE_POLICIES = {
|
|
|
427
885
|
},
|
|
428
886
|
};
|
|
429
887
|
|
|
430
|
-
/**
|
|
431
|
-
* Interacts with the Apollo client.
|
|
432
|
-
*
|
|
433
|
-
* @inheritdoc
|
|
434
|
-
*/
|
|
435
|
-
class DaffDriverHttpClientCacheMagentoService {
|
|
436
|
-
constructor(platformId) {
|
|
437
|
-
this.platformId = platformId;
|
|
438
|
-
}
|
|
439
|
-
reset() {
|
|
440
|
-
if (isPlatformBrowser(this.platformId)) {
|
|
441
|
-
location.reload();
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
445
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, providedIn: 'root' }); }
|
|
446
|
-
}
|
|
447
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffDriverHttpClientCacheMagentoService, decorators: [{
|
|
448
|
-
type: Injectable,
|
|
449
|
-
args: [{
|
|
450
|
-
providedIn: 'root',
|
|
451
|
-
}]
|
|
452
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
453
|
-
type: Inject,
|
|
454
|
-
args: [PLATFORM_ID]
|
|
455
|
-
}] }] });
|
|
456
|
-
|
|
457
888
|
const MAGENTO_CUSTOMER_CACHE_ID_HEADER = 'X-Magento-Cache-Id';
|
|
458
889
|
/**
|
|
459
890
|
* Stores and sets the Magento cache ID header.
|
|
@@ -531,6 +962,9 @@ const magentoMoneyFragment = gql `
|
|
|
531
962
|
}
|
|
532
963
|
`;
|
|
533
964
|
|
|
965
|
+
/**
|
|
966
|
+
* @deprecated in favor of {@link provideMagentoDriver} Deprecated in version 0.88.0. Will be removed in version 0.91.0.
|
|
967
|
+
*/
|
|
534
968
|
class DaffDriverMagentoModule {
|
|
535
969
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffDriverMagentoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
536
970
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.11", ngImport: i0, type: DaffDriverMagentoModule }); }
|
|
@@ -551,5 +985,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
|
|
|
551
985
|
* Generated bundle index. Do not edit.
|
|
552
986
|
*/
|
|
553
987
|
|
|
554
|
-
export { DAFF_DRIVER_MAGENTO_ERROR_CODE, DAFF_MAGENTO_2_4_3_TYPE_POLICIES, DAFF_MAGENTO_CACHEABLE_OPERATIONS, DaffDriverHttpClientCacheMagentoService, DaffDriverMagentoError, DaffDriverMagentoModule, DaffMagentoApolloCacheableOperationsLinkGenerator, DaffMagentoCacheHeaderApolloLinkGenerator, MAGENTO_CUSTOMER_CACHE_ID_HEADER, MagentoSortEnum, daffMagentoTransformGraphQlError, daffTransformMagentoError, magentoMoneyFragment, magentoPageInfoTransform, magentoSearchResultPageInfoFragment, magentoSortDirectionRequestTransform, magentoSortDirectionResponseTransform, provideDaffMagentoCacheableOperation, provideManyDaffMagentoCacheableOperations, schema };
|
|
988
|
+
export { DAFF_DRIVER_MAGENTO_ERROR_CODE, DAFF_MAGENTO_2_4_3_TYPE_POLICIES, DAFF_MAGENTO_CACHEABLE_OPERATIONS, DaffDriverHttpClientCacheMagentoService, DaffDriverMagentoError, DaffDriverMagentoModule, DaffMagentoApolloCacheableOperationsLinkGenerator, DaffMagentoCacheHeaderApolloLinkGenerator, MAGENTO_CUSTOMER_CACHE_ID_HEADER, MagentoSortEnum, daffMagentoTransformGraphQlError, daffTransformMagentoError, magentoMoneyFragment, magentoPageInfoTransform, magentoSearchResultPageInfoFragment, magentoSortDirectionRequestTransform, magentoSortDirectionResponseTransform, provideDaffMagentoCacheableOperation, provideMagentoDriver, provideManyDaffMagentoCacheableOperations, schema };
|
|
555
989
|
//# sourceMappingURL=daffodil-driver-magento.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-driver-magento.mjs","sources":["../../../libs/driver/magento/src/schema/schema.ts","../../../libs/driver/magento/src/errors/error.class.ts","../../../libs/driver/magento/src/errors/transform-graphql.ts","../../../libs/driver/magento/src/errors/transform.ts","../../../libs/driver/magento/src/models/sort.enum.ts","../../../libs/driver/magento/src/graphql/cacheable-operations/cacheable-operations-token.ts","../../../libs/driver/magento/src/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.ts","../../../libs/driver/magento/src/graphql/type-policies.ts","../../../libs/driver/magento/src/graphql/cache.service.ts","../../../libs/driver/magento/src/graphql/cache-header/cache-header-apollo-link.ts","../../../libs/driver/magento/src/transforms/responses/page-info.ts","../../../libs/driver/magento/src/transforms/responses/sort-direction.ts","../../../libs/driver/magento/src/transforms/requests/sort-direction.ts","../../../libs/driver/magento/src/fragments/page-info.ts","../../../libs/driver/magento/src/fragments/money.ts","../../../libs/driver/magento/src/magento.module.ts","../../../libs/driver/magento/src/daffodil-driver-magento.ts"],"sourcesContent":["import introspectionQueryResultData from './introspection.json';\n\nexport const schema = introspectionQueryResultData;\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_DRIVER_MAGENTO_ERROR_CODE = 'DAFF_DRIVER_MAGENTO_ERROR';\n\n/**\n * A very general error thrown when a more specific error type cannot be determined.\n */\nexport class DaffDriverMagentoError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_DRIVER_MAGENTO_ERROR_CODE;\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import { GraphQLFormattedError } from 'graphql';\n\nimport {\n DaffError,\n DaffErrorCodeMap,\n} from '@daffodil/core';\n\nimport { DaffDriverMagentoError } from './error.class';\n\nexport function daffMagentoTransformGraphQlError<T extends DaffErrorCodeMap>(\n error: GraphQLFormattedError,\n map: T,\n): DaffError {\n const ErrorClass = map[<string>error?.extensions?.category] || DaffDriverMagentoError;\n\n return new ErrorClass(error.message) ;\n};\n","import { ApolloError } from '@apollo/client/core';\n\nimport {\n DaffError,\n DaffErrorCodeMap,\n daffIsError,\n} from '@daffodil/core';\nimport { DaffDriverNetworkError } from '@daffodil/driver';\n\nimport { DaffDriverMagentoError } from './error.class';\nimport { daffMagentoTransformGraphQlError } from './transform-graphql';\n\n/**\n * Transforms the passed error according to the lookup in the passed map.\n */\n// TODO: return array of errors\nexport function daffTransformMagentoError<T extends DaffErrorCodeMap>(error: any, map: T): DaffError {\n if (error.graphQLErrors?.length > 0) {\n return (<ApolloError>error).graphQLErrors.map(err => daffMagentoTransformGraphQlError<T>(err, map))[0];\n } else if (error.networkError) {\n return new DaffDriverNetworkError((<ApolloError>error).networkError.message);\n } else if (daffIsError(error)) {\n return error;\n } else {\n return new DaffDriverMagentoError(error.message);\n }\n};\n","export enum MagentoSortEnum {\n ASC = 'ASC',\n DESC = 'DESC'\n}\n","import { createMultiInjectionToken } from '@daffodil/core';\n\nexport const {\n /**\n * A multi-provider injection token of the operation names of magento queries that should\n * be cached. This is needed because queries need to be converted into GET queries in order for Magento\n * to cache them. This token should be used by daffodil driver platform modules to register operation names that are cacheable, and is\n * intended for internal daffodil use only.\n */\n token: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n /**\n * Adds many operation names to the list of cacheable Magento operations. Use only with Angular 9+.\n */\n provider: provideManyDaffMagentoCacheableOperations,\n} = createMultiInjectionToken<string>('DAFF_MAGENTO_CACHEABLE_OPERATIONS');\n\n/**\n * Adds an operation name to the list of cacheable Magento operations. Use only with Angular 9+.\n */\nexport function provideDaffMagentoCacheableOperation(operationName: string) {\n return {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: operationName,\n multi: true,\n };\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { ApolloLink } from '@apollo/client/core';\n\nimport { DaffApolloLinkGenerator } from '@daffodil/core/graphql';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from './cacheable-operations-token';\n\n/**\n * A service that will convert cacheable apollo operations into a format that Magento will understand as cacheable.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoApolloCacheableOperationsLinkGenerator implements DaffApolloLinkGenerator {\n constructor(\n @Inject(DAFF_MAGENTO_CACHEABLE_OPERATIONS) private apolloGetRequests: string[],\n ) {}\n\n getLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if(this.apolloGetRequests.indexOf(operation.operationName) > -1) {\n operation.setContext({ method: 'GET' });\n }\n return forward(operation);\n });\n }\n}\n","import { TypePolicies } from '@apollo/client/core';\n\n/**\n * Custom type policies that allow us to have more granular control\n * over how ApolloClient reads from and writes to the cache.\n *\n * This is applicable to Magento 2.4.3 and up.\n * Heavily based on https://github.com/magento/pwa-studio/blob/99270701b2b607551f2e5881af272ed48ba7064c/packages/peregrine/lib/Apollo/policies/index.js.\n *\n * https://www.apollographql.com/docs/react/caching/cache-configuration/#typepolicy-fields\n * https://www.apollographql.com/docs/react/caching/cache-field-behavior/\n */\nexport const DAFF_MAGENTO_2_4_3_TYPE_POLICIES: TypePolicies = {\n Query: {\n fields: {\n cart: {\n // Replaces @connection(key: \"Cart\")\n keyArgs: () => 'Cart',\n },\n customer: {\n keyArgs: () => 'Customer',\n },\n customerCart: {\n keyArgs: () => 'Cart',\n },\n },\n },\n AppliedGiftCard: {\n keyFields: ['code'],\n },\n AvailablePaymentMethod: {\n keyFields: ['code'],\n },\n AvailableShippingMethod: {\n // The combination of these fields makes an instance of\n // AvailableShippingMethod unique.\n keyFields: ['carrier_code', 'method_code'],\n },\n Breadcrumb: {\n // Uses provided fields on the object as the `id`.\n keyFields: ['category_uid'],\n },\n Cart: {\n keyFields: () => 'Cart',\n fields: {\n applied_gift_cards: {\n // eslint-disable-next-line no-unused-vars\n merge: (existing, incoming) => incoming,\n },\n available_payment_methods: {\n // eslint-disable-next-line no-unused-vars\n merge: (existing, incoming) => incoming,\n },\n items: {\n // eslint-disable-next-line no-unused-vars\n merge: (existing, incoming) => incoming,\n },\n prices: {\n // `merge: true` can be used for an object field.\n merge: true,\n },\n shipping_addresses: {\n merge:(existing = [], incoming, { readField, mergeObjects }) => {\n // street makes these things unique\n const mergeResult = new Set();\n const streetToIndex = new Map();\n\n existing.forEach((existingShippingAddress, index) => {\n // Use readField instead of existingShippingAddress.street directly because it will follow cache references.\n const street = readField(\n 'street',\n existingShippingAddress,\n );\n streetToIndex.set(street, index);\n });\n\n incoming.forEach(incomingShippingAddress => {\n const street = readField(\n 'street',\n incomingShippingAddress,\n );\n\n if (streetToIndex.has(street)) {\n const targetIndex = streetToIndex.get(street);\n const existingShippingAddress = existing[targetIndex];\n const merged = mergeObjects(\n existingShippingAddress,\n incomingShippingAddress,\n );\n mergeResult.add(merged);\n } else {\n // We do not have an address with this street yet, add it on to the end.\n streetToIndex.set(street, streetToIndex.size);\n mergeResult.add(incomingShippingAddress);\n }\n });\n\n return Array.from(mergeResult);\n },\n },\n },\n },\n Customer: {\n keyFields: () => 'Customer',\n fields: {\n addresses: {\n merge: (existing, incoming) => incoming,\n read: (cachedAddresses, { toReference }) => {\n if (cachedAddresses) {\n return cachedAddresses.map(address => {\n // Update v2 identifiers to new references. Previous\n // entries had `id: CustomerAddress:1` which caused\n // v3's lookup to fail. If we find a legacy id,\n // point it at the object using a reference.\n if (address.id?.includes('CustomerAddress')) {\n return toReference(address.id);\n } else {\n return address;\n }\n });\n }\n // If there are no cached addresses that's fine - the schema\n // shows that it is a nullable field.\n },\n },\n orders: {\n keyArgs: ['filter'],\n // TODO: write merge function that handles pagination\n // items: {\n // merge: true,\n // },\n },\n },\n },\n CustomerAddress: {\n fields: {\n street: {\n // eslint-disable-next-line no-unused-vars\n merge: (existing, incoming) => incoming,\n },\n },\n },\n CustomerPaymentTokens: {\n keyFields: () => 'CustomerPaymentTokens',\n fields: {\n items: {\n // eslint-disable-next-line no-unused-vars\n merge: (existing, incoming) => incoming,\n },\n },\n },\n ProductImage: {\n keyFields: ['url'],\n },\n SelectedConfigurableOption: {\n // id alone is not enough to identify a selected option as it can refer\n // to something like \"size\" where value_id refers to \"large\".\n keyFields: ['id', 'value_id'],\n },\n SelectedPaymentMethod: {\n keyFields: ['code'],\n },\n ShippingCartAddress: {\n keyFields: ['street'],\n fields: {\n available_shipping_methods: {\n merge: (existing = [], incoming, { readField, mergeObjects }) => {\n // carrier_code + method_code makes these things unique\n const mergeResult = new Set();\n const carrierToIndex = new Map();\n\n existing.forEach((existingShippingMethod, index) => {\n // Use readField because it will follow cache references.\n const carrierCode = readField(\n 'carrier_code',\n existingShippingMethod,\n );\n const methodCode = readField(\n 'method_code',\n existingShippingMethod,\n );\n const carrierKey = `${carrierCode}|${methodCode}`;\n carrierToIndex.set(carrierKey, index);\n });\n\n incoming.forEach(incomingShippingMethod => {\n // Use readField because it will follow cache references.\n const carrierCode = readField(\n 'carrier_code',\n incomingShippingMethod,\n );\n const methodCode = readField(\n 'method_code',\n incomingShippingMethod,\n );\n const carrierKey = `${carrierCode}|${methodCode}`;\n if (carrierToIndex.has(carrierKey)) {\n const targetIndex = carrierToIndex.get(carrierKey);\n const existingShippingMethod = existing[targetIndex];\n const merged = mergeObjects(\n existingShippingMethod,\n incomingShippingMethod,\n );\n mergeResult.add(merged);\n } else {\n // We do not have a method with this key yet, add it on to the end.\n carrierToIndex.set(carrierKey, carrierToIndex.size);\n mergeResult.add(incomingShippingMethod);\n }\n });\n\n return Array.from(mergeResult);\n },\n },\n country: {\n merge: true,\n },\n region: {\n merge: true,\n },\n selected_shipping_method: {\n merge: true,\n },\n },\n },\n CategoryTree: {\n fields: {\n children: {\n merge: (existing, incoming) => incoming,\n },\n },\n },\n Wishlist: {\n keyFields: ({ id }) => `CustomerWishlist:${id}`,\n },\n WishlistItem: {\n keyFields: ({ id }) => `CustomerWishlistItem:${id}`,\n },\n SimpleWishlistItem: {\n keyFields: ({ id }) => `CustomerSimpleWishlistItem:${id}`,\n },\n VirtualWishlistItem: {\n keyFields: ({ id }) => `CustomerVirtualWishlistItem:${id}`,\n },\n DownloadableWishlistItem: {\n keyFields: ({ id }) => `CustomerDownloadableWishlistItem:${id}`,\n },\n BundleWishlistItem: {\n keyFields: ({ id }) => `CustomerBundleWishlistItem:${id}`,\n },\n GroupedProductWishlistItem: {\n keyFields: ({ id }) => `CustomerGroupedProductWishlistItem:${id}`,\n },\n ConfigurableWishlistItem: {\n keyFields: ({ id }) => `CustomerConfigurableWishlistItem:${id}`,\n },\n GiftCardWishlistItem: {\n keyFields: ({ id }) => `CustomerGiftCardWishlistItem:${id}`,\n },\n};\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Inject,\n Injectable,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffDriverHttpClientCacheServiceInterface } from '@daffodil/driver';\n\n/**\n * Interacts with the Apollo client.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffDriverHttpClientCacheMagentoService implements DaffDriverHttpClientCacheServiceInterface {\n constructor(\n @Inject(PLATFORM_ID) private platformId: string,\n ) {}\n\n reset(): void {\n if (isPlatformBrowser(this.platformId)) {\n location.reload();\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { ApolloLink } from '@apollo/client/core';\n\nimport { DaffApolloLinkGenerator } from '@daffodil/core/graphql';\n\nexport const MAGENTO_CUSTOMER_CACHE_ID_HEADER = 'X-Magento-Cache-Id';\n\n/**\n * Stores and sets the Magento cache ID header.\n * This will set the `X-Magento-Cache-Id` header from the most recent value encountered\n * on a response, if there was a response with that header set.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoCacheHeaderApolloLinkGenerator implements DaffApolloLinkGenerator {\n private _cacheHeader?: string;\n\n getLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (this._cacheHeader) {\n operation.setContext({\n headers: {\n ...operation.getContext().headers,\n [MAGENTO_CUSTOMER_CACHE_ID_HEADER]: this._cacheHeader,\n },\n });\n }\n return forward(operation).map((response) => {\n const { headers } = operation.getContext().response;\n if (headers.get(MAGENTO_CUSTOMER_CACHE_ID_HEADER)) {\n this._cacheHeader = headers.get(MAGENTO_CUSTOMER_CACHE_ID_HEADER);\n }\n return response;\n });\n });\n }\n}\n","import { DaffCollectionMetadata } from '@daffodil/core';\n\nimport { MagentoSearchResultPageInfo } from '../../models/public_api';\n\nexport function magentoPageInfoTransform(pageInfo: MagentoSearchResultPageInfo): Pick<DaffCollectionMetadata, 'pageSize' | 'currentPage' | 'totalPages'> {\n return {\n pageSize: pageInfo.page_size,\n currentPage: pageInfo.current_page,\n totalPages: pageInfo.total_pages,\n };\n}\n","import { DaffSortDirectionEnum } from '@daffodil/core';\n\nimport { MagentoSortEnum } from '../../models/public_api';\n\nconst map = <const>{\n [MagentoSortEnum.ASC]: DaffSortDirectionEnum.Ascending,\n [MagentoSortEnum.DESC]: DaffSortDirectionEnum.Descending,\n};\n\nexport function magentoSortDirectionResponseTransform(direction: MagentoSortEnum): DaffSortDirectionEnum {\n return map[direction];\n}\n","import { DaffSortDirectionEnum } from '@daffodil/core';\n\nimport { MagentoSortEnum } from '../../models/public_api';\n\nconst map = <const>{\n [DaffSortDirectionEnum.Ascending]: MagentoSortEnum.ASC,\n [DaffSortDirectionEnum.Descending]: MagentoSortEnum.DESC,\n};\n\nexport function magentoSortDirectionRequestTransform(direction: DaffSortDirectionEnum): MagentoSortEnum {\n return map[direction];\n}\n","import { gql } from 'apollo-angular';\n\nexport const magentoSearchResultPageInfoFragment = gql`\n fragment magentoSearchResultPageInfo on SearchResultPageInfo {\n page_size\n current_page\n total_pages\n }\n`;\n","import { gql } from 'apollo-angular';\n\nexport const magentoMoneyFragment = gql`\n fragment moneyFragment on Money {\n value\n currency\n }\n`;\n","import { NgModule } from '@angular/core';\n\nimport { provideDaffDriverHttpClientCacheService } from '@daffodil/driver';\n\nimport { DaffDriverHttpClientCacheMagentoService } from './graphql/cache.service';\n\n@NgModule({\n providers: [\n provideDaffDriverHttpClientCacheService(DaffDriverHttpClientCacheMagentoService),\n ],\n})\nexport class DaffDriverMagentoModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,MAAM,GAAG;;ACGf,MAAM,8BAA8B,GAAG;AAE9C;;AAEG;AACG,MAAO,sBAAuB,SAAQ,oBAAoB,CAAA;AAG9D,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC;QAHA,IAAI,CAAA,IAAA,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,IAAA,OAAOA,KAAG,CAAC,SAAS,CAAC;AACvB;;ACPA,MAAM,GAAG,GAAU;AACjB,IAAA,CAAC,qBAAqB,CAAC,SAAS,GAAG,eAAe,CAAC,GAAG;AACtD,IAAA,CAAC,qBAAqB,CAAC,UAAU,GAAG,eAAe,CAAC,IAAI;CACzD;AAEK,SAAU,oCAAoC,CAAC,SAAgC,EAAA;AACnF,IAAA,OAAO,GAAG,CAAC,SAAS,CAAC;AACvB;;ACTO,MAAM,mCAAmC,GAAG,GAAG,CAAA;;;;;;;;ACA/C,MAAM,oBAAoB,GAAG,GAAG,CAAA;;;;;;;MCS1B,uBAAuB,CAAA;+GAAvB,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAvB,uBAAuB,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,EAJvB,SAAA,EAAA;YACT,uCAAuC,CAAC,uCAAuC,CAAC;AACjF,SAAA,EAAA,CAAA,CAAA;;4FAEU,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBALnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;wBACT,uCAAuC,CAAC,uCAAuC,CAAC;AACjF,qBAAA;AACF,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-driver-magento.mjs","sources":["../../../libs/driver/magento/src/schema/schema.ts","../../../libs/driver/magento/src/apollo/create-http-link.ts","../../../libs/driver/magento/src/apollo/possible-types.ts","../../../libs/driver/magento/src/apollo/type-policies.ts","../../../libs/driver/magento/src/graphql/cache.service.ts","../../../libs/driver/magento/src/provider.ts","../../../libs/driver/magento/src/errors/error.class.ts","../../../libs/driver/magento/src/errors/transform-graphql.ts","../../../libs/driver/magento/src/errors/transform.ts","../../../libs/driver/magento/src/models/sort.enum.ts","../../../libs/driver/magento/src/graphql/cacheable-operations/cacheable-operations-token.ts","../../../libs/driver/magento/src/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.ts","../../../libs/driver/magento/src/graphql/type-policies.ts","../../../libs/driver/magento/src/graphql/cache-header/cache-header-apollo-link.ts","../../../libs/driver/magento/src/transforms/responses/page-info.ts","../../../libs/driver/magento/src/transforms/responses/sort-direction.ts","../../../libs/driver/magento/src/transforms/requests/sort-direction.ts","../../../libs/driver/magento/src/fragments/page-info.ts","../../../libs/driver/magento/src/fragments/money.ts","../../../libs/driver/magento/src/magento.module.ts","../../../libs/driver/magento/src/daffodil-driver-magento.ts"],"sourcesContent":["import introspectionQueryResultData from './introspection.json';\n\nexport const schema = introspectionQueryResultData;\n","import { inject } from '@angular/core';\nimport {\n ApolloLink,\n UriFunction,\n} from '@apollo/client/core';\nimport { HttpLink } from 'apollo-angular/http';\n\n/**\n * Creates an Apollo HTTP link for GraphQL requests.\n *\n * @param url - The Shopify Storefront API endpoint URL for GraphQL requests.\n * @returns An ApolloLink instance configured with the provided URL.\n */\nexport function createHttpLink(url: string | UriFunction): ApolloLink {\n const httpLink = inject(HttpLink);\n return httpLink.create({ uri: url });\n}\n","/**\n * Magento GraphQL possible types configuration for Apollo Client.\n *\n * This object defines the possible concrete types for each GraphQL interface\n * used in Magento's GraphQL API. Apollo Client uses this information for\n * proper fragment matching and union/interface type resolution.\n *\n * When Apollo Client encounters a GraphQL interface or union type in a query,\n * it needs to know which concrete types can implement that interface to\n * properly cache and normalize the data.\n *\n * @example\n * ```typescript\n * new InMemoryCache({\n * possibleTypes: MAGENTO_POSSIBLE_TYPES\n * })\n * ```\n */\nexport const MAGENTO_POSSIBLE_TYPES = {\n CartAddressInterface: [\n 'BillingCartAddress',\n 'ShippingCartAddress',\n ],\n CartItemInterface: [\n 'SimpleCartItem',\n 'VirtualCartItem',\n 'DownloadableCartItem',\n 'BundleCartItem',\n 'ConfigurableCartItem',\n ],\n ProductInterface: [\n 'VirtualProduct',\n 'SimpleProduct',\n 'DownloadableProduct',\n 'BundleProduct',\n 'GroupedProduct',\n 'ConfigurableProduct',\n ],\n CategoryInterface: [\n 'CategoryTree',\n ],\n MediaGalleryInterface: [\n 'ProductImage',\n 'ProductVideo',\n ],\n ProductLinksInterface: [\n 'ProductLinks',\n ],\n CreditMemoItemInterface: [\n 'DownloadableCreditMemoItem',\n 'BundleCreditMemoItem',\n 'CreditMemoItem',\n ],\n OrderItemInterface: [\n 'DownloadableOrderItem',\n 'BundleOrderItem',\n 'OrderItem',\n ],\n InvoiceItemInterface: [\n 'DownloadableInvoiceItem',\n 'BundleInvoiceItem',\n 'InvoiceItem',\n ],\n ShipmentItemInterface: [\n 'BundleShipmentItem',\n 'ShipmentItem',\n ],\n AggregationOptionInterface: [\n 'AggregationOption',\n ],\n LayerFilterItemInterface: [\n 'LayerFilterItem',\n 'SwatchLayerFilterItem',\n ],\n PhysicalProductInterface: [\n 'SimpleProduct',\n 'BundleProduct',\n 'GroupedProduct',\n 'ConfigurableProduct',\n ],\n CustomizableOptionInterface: [\n 'CustomizableAreaOption',\n 'CustomizableDateOption',\n 'CustomizableDropDownOption',\n 'CustomizableMultipleOption',\n 'CustomizableFieldOption',\n 'CustomizableFileOption',\n 'CustomizableRadioOption',\n 'CustomizableCheckboxOption',\n ],\n CustomizableProductInterface: [\n 'VirtualProduct',\n 'SimpleProduct',\n 'DownloadableProduct',\n 'BundleProduct',\n 'ConfigurableProduct',\n ],\n SwatchDataInterface: [\n 'ImageSwatchData',\n 'TextSwatchData',\n 'ColorSwatchData',\n ],\n SwatchLayerFilterItemInterface: [\n 'SwatchLayerFilterItem',\n ],\n};\n","/**\n * Custom type policies that allow us to have more granular control\n * over how ApolloClient reads from and writes to the cache.\n *\n * https://www.apollographql.com/docs/react/caching/cache-configuration/#typepolicy-fields\n * https://www.apollographql.com/docs/react/caching/cache-field-behavior/\n */\n\nimport { TypePolicies } from '@apollo/client/cache';\n\nconst typePolicies: TypePolicies = {\n // Query/Mutation are \"types\" just like \"Cart\".\n Query: {\n fields: {\n cart: {\n // Replaces @connection(key: \"Cart\")\n keyArgs: () => 'Cart',\n },\n customer: {\n keyArgs: () => 'Customer',\n },\n customerCart: {\n keyArgs: () => 'Cart',\n },\n customerWishlistProducts: {\n read: existing => existing || [],\n },\n },\n },\n AppliedGiftCard: {\n keyFields: ['code'],\n },\n AvailablePaymentMethod: {\n keyFields: ['code'],\n },\n AvailableShippingMethod: {\n // The combination of these fields makes an instance of\n // AvailableShippingMethod unique.\n keyFields: ['carrier_code', 'method_code'],\n },\n Breadcrumb: {\n // Uses provided fields on the object as the `uid`.\n keyFields: ['category_uid'],\n },\n Cart: {\n keyFields: () => 'Cart',\n fields: {\n applied_gift_cards: {\n\n merge(existing, incoming) {\n return incoming;\n },\n },\n available_payment_methods: {\n\n merge(existing, incoming) {\n return incoming;\n },\n },\n items: {\n\n merge(existing, incoming) {\n return incoming;\n },\n },\n prices: {\n // `merge: true` can be used for an object field.\n merge: true,\n },\n shipping_addresses: {\n merge(existing = [], incoming, { readField, mergeObjects }) {\n // street makes these things unique\n const mergeResult = new Set();\n const streetToIndex = new Map();\n\n existing.forEach((existingShippingAddress, index) => {\n // Use readField instead of existingShippingAddress.street directly because it will follow cache references.\n const street = readField(\n 'street',\n existingShippingAddress,\n );\n streetToIndex.set(street, index);\n });\n\n incoming.forEach(incomingShippingAddress => {\n const street = readField(\n 'street',\n incomingShippingAddress,\n );\n\n if (streetToIndex.has(street)) {\n const targetIndex = streetToIndex.get(street);\n const existingShippingAddress =\n existing[targetIndex];\n const merged = mergeObjects(\n existingShippingAddress,\n incomingShippingAddress,\n );\n mergeResult.add(merged);\n } else {\n // We do not have an address with this street yet, add it on to the end.\n streetToIndex.set(street, streetToIndex.size);\n mergeResult.add(incomingShippingAddress);\n }\n });\n\n return Array.from(mergeResult);\n },\n },\n },\n },\n Customer: {\n keyFields: () => 'Customer',\n merge: true,\n fields: {\n addresses: {\n merge(existing, incoming) {\n return incoming;\n },\n read(cachedAddresses, { toReference }) {\n if (cachedAddresses) {\n return cachedAddresses.map(address => {\n // Update v2 identifiers to new references. Previous\n // entries had `id: CustomerAddress:1` which caused\n // v3's lookup to fail. If we find a legacy id,\n // point it at the object using a reference.\n if (\n address.id &&\n address.id.includes('CustomerAddress')\n ) {\n return toReference(address.id);\n } else {\n return address;\n }\n });\n }\n // If there are no cached addresses that's fine - the schema\n // shows that it is a nullable field.\n },\n },\n orders: {\n keyArgs: ['filter'],\n },\n },\n },\n CustomerAddress: {\n fields: {\n street: {\n\n merge(existing, incoming) {\n return incoming;\n },\n },\n },\n },\n CustomerPaymentTokens: {\n keyFields: () => 'CustomerPaymentTokens',\n fields: {\n items: {\n\n merge(existing, incoming) {\n return incoming;\n },\n },\n },\n },\n Currency: {\n merge: true,\n },\n ProductImage: {\n keyFields: ['url'],\n },\n ConfigurableProductOptions: {\n keyFields: ['uid'],\n },\n SelectedConfigurableOption: {\n // id alone is not enough to identify a selected option as it can refer\n // to something like \"size\" where value_id refers to \"large\".\n // TODO: Use configurable_product_option_uid for ConfigurableWishlistItem when available in 2.4.5\n keyFields: fields => fields.configurable_product_option_uid\n ? [\n 'configurable_product_option_uid',\n 'configurable_product_option_value_uid',\n ]\n : ['id', 'value_id'],\n },\n SelectedPaymentMethod: {\n keyFields: ['code'],\n },\n ShippingCartAddress: {\n keyFields: ['street'],\n fields: {\n available_shipping_methods: {\n merge(existing = [], incoming, { readField, mergeObjects }) {\n // carrier_code + method_code makes these things unique\n const mergeResult = new Set();\n const carrierToIndex = new Map();\n\n existing.forEach((existingShippingMethod, index) => {\n // Use readField because it will follow cache references.\n const carrierCode = readField(\n 'carrier_code',\n existingShippingMethod,\n );\n const methodCode = readField(\n 'method_code',\n existingShippingMethod,\n );\n const carrierKey = `${carrierCode}|${methodCode}`;\n carrierToIndex.set(carrierKey, index);\n });\n\n incoming.forEach(incomingShippingMethod => {\n // Use readField because it will follow cache references.\n const carrierCode = readField(\n 'carrier_code',\n incomingShippingMethod,\n );\n const methodCode = readField(\n 'method_code',\n incomingShippingMethod,\n );\n const carrierKey = `${carrierCode}|${methodCode}`;\n if (carrierToIndex.has(carrierKey)) {\n const targetIndex = carrierToIndex.get(carrierKey);\n const existingShippingMethod =\n existing[targetIndex];\n const merged = mergeObjects(\n existingShippingMethod,\n incomingShippingMethod,\n );\n mergeResult.add(merged);\n } else {\n // We do not have a method with this key yet, add it on to the end.\n carrierToIndex.set(carrierKey, carrierToIndex.size);\n mergeResult.add(incomingShippingMethod);\n }\n });\n\n return Array.from(mergeResult);\n },\n },\n country: {\n merge: true,\n },\n region: {\n merge: true,\n },\n selected_shipping_method: {\n merge: true,\n },\n },\n },\n CategoryTree: {\n keyFields: ['uid'],\n fields: {\n children: {\n merge(existing, incoming) {\n return incoming;\n },\n },\n },\n },\n Wishlist: {\n keyFields: ({ id }) => `CustomerWishlist:${id}`,\n fields: {\n items_v2: {\n keyArgs: false,\n merge: false,\n },\n },\n },\n WishlistItem: {\n keyFields: ({ id }) => `CustomerWishlistItem:${id}`,\n },\n WishlistItems: {\n fields: {\n items: {\n merge: (existing = [], incoming, { variables }) => {\n if (variables) {\n const { currentPage = 1 } = variables;\n // reset cache collection if we're on the first page\n\n if (currentPage === 1) {\n return incoming;\n }\n }\n\n return [...existing, ...incoming];\n },\n },\n },\n },\n SimpleWishlistItem: {\n keyFields: ({ id }) => `CustomerSimpleWishlistItem:${id}`,\n },\n VirtualWishlistItem: {\n keyFields: ({ id }) => `CustomerVirtualWishlistItem:${id}`,\n },\n DownloadableWishlistItem: {\n keyFields: ({ id }) => `CustomerDownloadableWishlistItem:${id}`,\n },\n BundleWishlistItem: {\n keyFields: ({ id }) => `CustomerBundleWishlistItem:${id}`,\n },\n GroupedProductWishlistItem: {\n keyFields: ({ id }) => `CustomerGroupedProductWishlistItem:${id}`,\n },\n ConfigurableWishlistItem: {\n keyFields: ({ id }) => `CustomerConfigurableWishlistItem:${id}`,\n },\n GiftCardWishlistItem: {\n keyFields: ({ id }) => `CustomerGiftCardWishlistItem:${id}`,\n },\n SimpleProduct: {\n keyFields: ['uid'],\n },\n ConfigurableProduct: {\n keyFields: ['uid'],\n },\n BundleProduct: {\n keyFields: ['uid'],\n },\n GroupedProduct: {\n keyFields: ['uid'],\n },\n VirtualProduct: {\n keyFields: ['uid'],\n },\n CartItemInterface: {\n keyFields: ['uid'],\n },\n StoreConfig: {\n keyFields: ['store_code'],\n },\n};\n\nexport default typePolicies;\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Inject,\n Injectable,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffDriverHttpClientCacheServiceInterface } from '@daffodil/driver';\n\n/**\n * Interacts with the Apollo client.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffDriverHttpClientCacheMagentoService implements DaffDriverHttpClientCacheServiceInterface {\n constructor(\n @Inject(PLATFORM_ID) private platformId: string,\n ) {}\n\n reset(): void {\n if (isPlatformBrowser(this.platformId)) {\n location.reload();\n }\n }\n}\n","import {\n inject,\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport {\n from,\n InMemoryCache,\n PossibleTypesMap,\n TypePolicies,\n UriFunction,\n} from '@apollo/client/core';\nimport { provideApollo } from 'apollo-angular';\n\nimport { provideDaffDriverHttpClientCacheService } from '@daffodil/driver';\n\nimport { createHttpLink } from './apollo/create-http-link';\nimport { MAGENTO_POSSIBLE_TYPES } from './apollo/possible-types';\nimport typePolicies from './apollo/type-policies';\nimport { DaffDriverHttpClientCacheMagentoService } from './graphql/cache.service';\n\nexport interface DaffMagentoDriverConfig {\n possibleTypes: PossibleTypesMap;\n typePolicies: TypePolicies;\n}\n\n/**\n * Sets up the Magento Daffodil driver configuration for Magento's GraphQl API.\n *\n * Under the hood, this creates an Apollo Client configuration.\n *\n * @param endpoint - The Magento store domain (e.g. \"https://www.my-store.com/graphql\") or an injection token for a string or function that returns a string\n */\nexport function provideMagentoDriver(endpoint: string | InjectionToken<string | UriFunction>, options: DaffMagentoDriverConfig = {\n possibleTypes: MAGENTO_POSSIBLE_TYPES,\n typePolicies,\n}): Provider[] {\n return [\n provideApollo(() => ({\n link: from([\n createHttpLink(typeof endpoint === 'string' ? endpoint : inject(endpoint)),\n ]),\n cache: new InMemoryCache({ typePolicies: options.typePolicies, possibleTypes: options.possibleTypes }),\n })),\n provideDaffDriverHttpClientCacheService(DaffDriverHttpClientCacheMagentoService),\n ];\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_DRIVER_MAGENTO_ERROR_CODE = 'DAFF_DRIVER_MAGENTO_ERROR';\n\n/**\n * A very general error thrown when a more specific error type cannot be determined.\n */\nexport class DaffDriverMagentoError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_DRIVER_MAGENTO_ERROR_CODE;\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import { GraphQLFormattedError } from 'graphql';\n\nimport {\n DaffError,\n DaffErrorCodeMap,\n} from '@daffodil/core';\n\nimport { DaffDriverMagentoError } from './error.class';\n\nexport function daffMagentoTransformGraphQlError<T extends DaffErrorCodeMap>(\n error: GraphQLFormattedError,\n map: T,\n): DaffError {\n const ErrorClass = map[<string>error?.extensions?.category] || DaffDriverMagentoError;\n\n return new ErrorClass(error.message) ;\n};\n","import { ApolloError } from '@apollo/client/core';\n\nimport {\n DaffError,\n DaffErrorCodeMap,\n daffIsError,\n} from '@daffodil/core';\nimport { DaffDriverNetworkError } from '@daffodil/driver';\n\nimport { DaffDriverMagentoError } from './error.class';\nimport { daffMagentoTransformGraphQlError } from './transform-graphql';\n\n/**\n * Transforms the passed error according to the lookup in the passed map.\n */\n// TODO: return array of errors\nexport function daffTransformMagentoError<T extends DaffErrorCodeMap>(error: any, map: T): DaffError {\n if (error.graphQLErrors?.length > 0) {\n return (<ApolloError>error).graphQLErrors.map(err => daffMagentoTransformGraphQlError<T>(err, map))[0];\n } else if (error.networkError) {\n return new DaffDriverNetworkError((<ApolloError>error).networkError.message);\n } else if (daffIsError(error)) {\n return error;\n } else {\n return new DaffDriverMagentoError(error.message);\n }\n};\n","export enum MagentoSortEnum {\n ASC = 'ASC',\n DESC = 'DESC'\n}\n","import { createMultiInjectionToken } from '@daffodil/core';\n\nexport const {\n /**\n * A multi-provider injection token of the operation names of magento queries that should\n * be cached. This is needed because queries need to be converted into GET queries in order for Magento\n * to cache them. This token should be used by daffodil driver platform modules to register operation names that are cacheable, and is\n * intended for internal daffodil use only.\n */\n token: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n /**\n * Adds many operation names to the list of cacheable Magento operations. Use only with Angular 9+.\n */\n provider: provideManyDaffMagentoCacheableOperations,\n} = createMultiInjectionToken<string>('DAFF_MAGENTO_CACHEABLE_OPERATIONS');\n\n/**\n * Adds an operation name to the list of cacheable Magento operations. Use only with Angular 9+.\n */\nexport function provideDaffMagentoCacheableOperation(operationName: string) {\n return {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: operationName,\n multi: true,\n };\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { ApolloLink } from '@apollo/client/core';\n\nimport { DaffApolloLinkGenerator } from '@daffodil/core/graphql';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from './cacheable-operations-token';\n\n/**\n * A service that will convert cacheable apollo operations into a format that Magento will understand as cacheable.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoApolloCacheableOperationsLinkGenerator implements DaffApolloLinkGenerator {\n constructor(\n @Inject(DAFF_MAGENTO_CACHEABLE_OPERATIONS) private apolloGetRequests: string[],\n ) {}\n\n getLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if(this.apolloGetRequests.indexOf(operation.operationName) > -1) {\n operation.setContext({ method: 'GET' });\n }\n return forward(operation);\n });\n }\n}\n","import { TypePolicies } from '@apollo/client/core';\n\n/**\n * Custom type policies that allow us to have more granular control\n * over how ApolloClient reads from and writes to the cache.\n *\n * This is applicable to Magento 2.4.3 and up.\n * Heavily based on https://github.com/magento/pwa-studio/blob/99270701b2b607551f2e5881af272ed48ba7064c/packages/peregrine/lib/Apollo/policies/index.js.\n *\n * https://www.apollographql.com/docs/react/caching/cache-configuration/#typepolicy-fields\n * https://www.apollographql.com/docs/react/caching/cache-field-behavior/\n */\nexport const DAFF_MAGENTO_2_4_3_TYPE_POLICIES: TypePolicies = {\n Query: {\n fields: {\n cart: {\n // Replaces @connection(key: \"Cart\")\n keyArgs: () => 'Cart',\n },\n customer: {\n keyArgs: () => 'Customer',\n },\n customerCart: {\n keyArgs: () => 'Cart',\n },\n },\n },\n AppliedGiftCard: {\n keyFields: ['code'],\n },\n AvailablePaymentMethod: {\n keyFields: ['code'],\n },\n AvailableShippingMethod: {\n // The combination of these fields makes an instance of\n // AvailableShippingMethod unique.\n keyFields: ['carrier_code', 'method_code'],\n },\n Breadcrumb: {\n // Uses provided fields on the object as the `id`.\n keyFields: ['category_uid'],\n },\n Cart: {\n keyFields: () => 'Cart',\n fields: {\n applied_gift_cards: {\n merge: (existing, incoming) => incoming,\n },\n available_payment_methods: {\n merge: (existing, incoming) => incoming,\n },\n items: {\n merge: (existing, incoming) => incoming,\n },\n prices: {\n // `merge: true` can be used for an object field.\n merge: true,\n },\n shipping_addresses: {\n merge:(existing = [], incoming, { readField, mergeObjects }) => {\n // street makes these things unique\n const mergeResult = new Set();\n const streetToIndex = new Map();\n\n existing.forEach((existingShippingAddress, index) => {\n // Use readField instead of existingShippingAddress.street directly because it will follow cache references.\n const street = readField(\n 'street',\n existingShippingAddress,\n );\n streetToIndex.set(street, index);\n });\n\n incoming.forEach(incomingShippingAddress => {\n const street = readField(\n 'street',\n incomingShippingAddress,\n );\n\n if (streetToIndex.has(street)) {\n const targetIndex = streetToIndex.get(street);\n const existingShippingAddress = existing[targetIndex];\n const merged = mergeObjects(\n existingShippingAddress,\n incomingShippingAddress,\n );\n mergeResult.add(merged);\n } else {\n // We do not have an address with this street yet, add it on to the end.\n streetToIndex.set(street, streetToIndex.size);\n mergeResult.add(incomingShippingAddress);\n }\n });\n\n return Array.from(mergeResult);\n },\n },\n },\n },\n Customer: {\n keyFields: () => 'Customer',\n fields: {\n addresses: {\n merge: (existing, incoming) => incoming,\n read: (cachedAddresses, { toReference }) => {\n if (cachedAddresses) {\n return cachedAddresses.map(address => {\n // Update v2 identifiers to new references. Previous\n // entries had `id: CustomerAddress:1` which caused\n // v3's lookup to fail. If we find a legacy id,\n // point it at the object using a reference.\n if (address.id?.includes('CustomerAddress')) {\n return toReference(address.id);\n } else {\n return address;\n }\n });\n }\n // If there are no cached addresses that's fine - the schema\n // shows that it is a nullable field.\n },\n },\n orders: {\n keyArgs: ['filter'],\n // TODO: write merge function that handles pagination\n // items: {\n // merge: true,\n // },\n },\n },\n },\n CustomerAddress: {\n fields: {\n street: {\n merge: (existing, incoming) => incoming,\n },\n },\n },\n CustomerPaymentTokens: {\n keyFields: () => 'CustomerPaymentTokens',\n fields: {\n items: {\n merge: (existing, incoming) => incoming,\n },\n },\n },\n ProductImage: {\n keyFields: ['url'],\n },\n SelectedConfigurableOption: {\n // id alone is not enough to identify a selected option as it can refer\n // to something like \"size\" where value_id refers to \"large\".\n keyFields: ['id', 'value_id'],\n },\n SelectedPaymentMethod: {\n keyFields: ['code'],\n },\n ShippingCartAddress: {\n keyFields: ['street'],\n fields: {\n available_shipping_methods: {\n merge: (existing = [], incoming, { readField, mergeObjects }) => {\n // carrier_code + method_code makes these things unique\n const mergeResult = new Set();\n const carrierToIndex = new Map();\n\n existing.forEach((existingShippingMethod, index) => {\n // Use readField because it will follow cache references.\n const carrierCode = readField(\n 'carrier_code',\n existingShippingMethod,\n );\n const methodCode = readField(\n 'method_code',\n existingShippingMethod,\n );\n const carrierKey = `${carrierCode}|${methodCode}`;\n carrierToIndex.set(carrierKey, index);\n });\n\n incoming.forEach(incomingShippingMethod => {\n // Use readField because it will follow cache references.\n const carrierCode = readField(\n 'carrier_code',\n incomingShippingMethod,\n );\n const methodCode = readField(\n 'method_code',\n incomingShippingMethod,\n );\n const carrierKey = `${carrierCode}|${methodCode}`;\n if (carrierToIndex.has(carrierKey)) {\n const targetIndex = carrierToIndex.get(carrierKey);\n const existingShippingMethod = existing[targetIndex];\n const merged = mergeObjects(\n existingShippingMethod,\n incomingShippingMethod,\n );\n mergeResult.add(merged);\n } else {\n // We do not have a method with this key yet, add it on to the end.\n carrierToIndex.set(carrierKey, carrierToIndex.size);\n mergeResult.add(incomingShippingMethod);\n }\n });\n\n return Array.from(mergeResult);\n },\n },\n country: {\n merge: true,\n },\n region: {\n merge: true,\n },\n selected_shipping_method: {\n merge: true,\n },\n },\n },\n CategoryTree: {\n fields: {\n children: {\n merge: (existing, incoming) => incoming,\n },\n },\n },\n Wishlist: {\n keyFields: ({ id }) => `CustomerWishlist:${id}`,\n },\n WishlistItem: {\n keyFields: ({ id }) => `CustomerWishlistItem:${id}`,\n },\n SimpleWishlistItem: {\n keyFields: ({ id }) => `CustomerSimpleWishlistItem:${id}`,\n },\n VirtualWishlistItem: {\n keyFields: ({ id }) => `CustomerVirtualWishlistItem:${id}`,\n },\n DownloadableWishlistItem: {\n keyFields: ({ id }) => `CustomerDownloadableWishlistItem:${id}`,\n },\n BundleWishlistItem: {\n keyFields: ({ id }) => `CustomerBundleWishlistItem:${id}`,\n },\n GroupedProductWishlistItem: {\n keyFields: ({ id }) => `CustomerGroupedProductWishlistItem:${id}`,\n },\n ConfigurableWishlistItem: {\n keyFields: ({ id }) => `CustomerConfigurableWishlistItem:${id}`,\n },\n GiftCardWishlistItem: {\n keyFields: ({ id }) => `CustomerGiftCardWishlistItem:${id}`,\n },\n};\n","import { Injectable } from '@angular/core';\nimport { ApolloLink } from '@apollo/client/core';\n\nimport { DaffApolloLinkGenerator } from '@daffodil/core/graphql';\n\nexport const MAGENTO_CUSTOMER_CACHE_ID_HEADER = 'X-Magento-Cache-Id';\n\n/**\n * Stores and sets the Magento cache ID header.\n * This will set the `X-Magento-Cache-Id` header from the most recent value encountered\n * on a response, if there was a response with that header set.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoCacheHeaderApolloLinkGenerator implements DaffApolloLinkGenerator {\n private _cacheHeader?: string;\n\n getLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (this._cacheHeader) {\n operation.setContext({\n headers: {\n ...operation.getContext().headers,\n [MAGENTO_CUSTOMER_CACHE_ID_HEADER]: this._cacheHeader,\n },\n });\n }\n return forward(operation).map((response) => {\n const { headers } = operation.getContext().response;\n if (headers.get(MAGENTO_CUSTOMER_CACHE_ID_HEADER)) {\n this._cacheHeader = headers.get(MAGENTO_CUSTOMER_CACHE_ID_HEADER);\n }\n return response;\n });\n });\n }\n}\n","import { DaffCollectionMetadata } from '@daffodil/core';\n\nimport { MagentoSearchResultPageInfo } from '../../models/public_api';\n\nexport function magentoPageInfoTransform(pageInfo: MagentoSearchResultPageInfo): Pick<DaffCollectionMetadata, 'pageSize' | 'currentPage' | 'totalPages'> {\n return {\n pageSize: pageInfo.page_size,\n currentPage: pageInfo.current_page,\n totalPages: pageInfo.total_pages,\n };\n}\n","import { DaffSortDirectionEnum } from '@daffodil/core';\n\nimport { MagentoSortEnum } from '../../models/public_api';\n\nconst map = <const>{\n [MagentoSortEnum.ASC]: DaffSortDirectionEnum.Ascending,\n [MagentoSortEnum.DESC]: DaffSortDirectionEnum.Descending,\n};\n\nexport function magentoSortDirectionResponseTransform(direction: MagentoSortEnum): DaffSortDirectionEnum {\n return map[direction];\n}\n","import { DaffSortDirectionEnum } from '@daffodil/core';\n\nimport { MagentoSortEnum } from '../../models/public_api';\n\nconst map = <const>{\n [DaffSortDirectionEnum.Ascending]: MagentoSortEnum.ASC,\n [DaffSortDirectionEnum.Descending]: MagentoSortEnum.DESC,\n};\n\nexport function magentoSortDirectionRequestTransform(direction: DaffSortDirectionEnum): MagentoSortEnum {\n return map[direction];\n}\n","import { gql } from 'apollo-angular';\n\nexport const magentoSearchResultPageInfoFragment = gql`\n fragment magentoSearchResultPageInfo on SearchResultPageInfo {\n page_size\n current_page\n total_pages\n }\n`;\n","import { gql } from 'apollo-angular';\n\nexport const magentoMoneyFragment = gql`\n fragment moneyFragment on Money {\n value\n currency\n }\n`;\n","import { NgModule } from '@angular/core';\n\nimport { provideDaffDriverHttpClientCacheService } from '@daffodil/driver';\n\nimport { DaffDriverHttpClientCacheMagentoService } from './graphql/cache.service';\n\n/**\n * @deprecated in favor of {@link provideMagentoDriver} Deprecated in version 0.88.0. Will be removed in version 0.91.0.\n */\n@NgModule({\n providers: [\n provideDaffDriverHttpClientCacheService(DaffDriverHttpClientCacheMagentoService),\n ],\n})\nexport class DaffDriverMagentoModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,MAAM,GAAG;;ACKtB;;;;;AAKG;AACG,SAAU,cAAc,CAAC,GAAyB,EAAA;AACtD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,OAAO,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtC;;AChBA;;;;;;;;;;;;;;;;;AAiBG;AACI,MAAM,sBAAsB,GAAG;AACpC,IAAA,oBAAoB,EAAE;QACpB,oBAAoB;QACpB,qBAAqB;AACtB,KAAA;AACD,IAAA,iBAAiB,EAAE;QACjB,gBAAgB;QAChB,iBAAiB;QACjB,sBAAsB;QACtB,gBAAgB;QAChB,sBAAsB;AACvB,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,gBAAgB;QAChB,eAAe;QACf,qBAAqB;Q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,IAAA,CAAC,qBAAqB,CAAC,UAAU,GAAG,eAAe,CAAC,IAAI;CACzD;AAEK,SAAU,oCAAoC,CAAC,SAAgC,EAAA;AACnF,IAAA,OAAO,GAAG,CAAC,SAAS,CAAC;AACvB;;ACTO,MAAM,mCAAmC,GAAG,GAAG,CAAA;;;;;;;;ACA/C,MAAM,oBAAoB,GAAG,GAAG,CAAA;;;;;;;ACIvC;;AAEG;MAMU,uBAAuB,CAAA;+GAAvB,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAvB,uBAAuB,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,EAJvB,SAAA,EAAA;YACT,uCAAuC,CAAC,uCAAuC,CAAC;AACjF,SAAA,EAAA,CAAA,CAAA;;4FAEU,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBALnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;wBACT,uCAAuC,CAAC,uCAAuC,CAAC;AACjF,qBAAA;AACF,iBAAA;;;ACbD;;AAEG;;;;"}
|
|
@@ -2,6 +2,7 @@ import { RequestInfo } from 'angular-in-memory-web-api';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { DaffInMemoryDataServiceInterface } from './data-service.type';
|
|
4
4
|
import { DaffInMemoryRouteableBackend } from './routeable.type';
|
|
5
|
+
import { DaffInMemoryDriverConfig } from '../public_api';
|
|
5
6
|
declare enum Method {
|
|
6
7
|
GET = "get",
|
|
7
8
|
POST = "post",
|
|
@@ -15,7 +16,8 @@ declare enum Method {
|
|
|
15
16
|
*/
|
|
16
17
|
export declare class DaffInMemoryBackendDelegate implements DaffInMemoryDataServiceInterface {
|
|
17
18
|
protected backends: Array<DaffInMemoryRouteableBackend>;
|
|
18
|
-
|
|
19
|
+
protected config: DaffInMemoryDriverConfig;
|
|
20
|
+
constructor(backends: Array<DaffInMemoryRouteableBackend>, config: DaffInMemoryDriverConfig);
|
|
19
21
|
protected delegateRequest(reqInfo: RequestInfo, method: Method): Observable<any>;
|
|
20
22
|
get?(reqInfo: RequestInfo): Observable<any>;
|
|
21
23
|
post?(reqInfo: RequestInfo): Observable<any>;
|
|
@@ -2,6 +2,7 @@ import { InMemoryDbService, RequestInfo } from 'angular-in-memory-web-api';
|
|
|
2
2
|
import { DaffInMemoryDataServiceInterface } from './data-service.type';
|
|
3
3
|
import { DaffInMemoryBackendDelegate } from './delegate.class';
|
|
4
4
|
import { DaffInMemoryBackendInterface } from './type';
|
|
5
|
+
import { DaffInMemoryDriverConfig } from '../public_api';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
/**
|
|
7
8
|
* An in-memory backend that automatically delegates requests to backends provided to {@link DAFF_IN_MEMORY_BACKENDS}.
|
|
@@ -10,7 +11,8 @@ import * as i0 from "@angular/core";
|
|
|
10
11
|
*/
|
|
11
12
|
export declare class DaffInMemoryRootBackend extends DaffInMemoryBackendDelegate implements DaffInMemoryDataServiceInterface, InMemoryDbService {
|
|
12
13
|
private _backends;
|
|
13
|
-
|
|
14
|
+
private _config;
|
|
15
|
+
constructor(_backends: Array<DaffInMemoryBackendInterface>, _config: DaffInMemoryDriverConfig);
|
|
14
16
|
createDb(reqInfo?: RequestInfo): import("rxjs").Observable<{}>;
|
|
15
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffInMemoryRootBackend, never>;
|
|
16
18
|
static ɵprov: i0.ɵɵInjectableDeclaration<DaffInMemoryRootBackend>;
|
|
@@ -3,4 +3,13 @@ export interface DaffInMemoryDriverConfig {
|
|
|
3
3
|
* The base path segment of the API route.
|
|
4
4
|
*/
|
|
5
5
|
apiBase: string;
|
|
6
|
+
/**
|
|
7
|
+
* When enabled, requests that do not match any configured backend
|
|
8
|
+
* will be automatically forwarded to the provided backend endpoint.
|
|
9
|
+
*
|
|
10
|
+
* This acts as a "catch-all" or fallback mechanism, ensuring that
|
|
11
|
+
* unknown or unconfigured routes are still proxied instead of being
|
|
12
|
+
* rejected.
|
|
13
|
+
*/
|
|
14
|
+
passThroughUnknownRequests?: boolean;
|
|
6
15
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EnvironmentProviders, Type } from '@angular/core';
|
|
2
|
+
import { DaffInMemoryBackendInterface, DaffInMemoryDriverConfig } from './public_api';
|
|
3
|
+
/**
|
|
4
|
+
* Configures the Angular in-memory web API with Daffodil backend services.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* bootstrapApplication(AppComponent, {
|
|
9
|
+
* providers: [
|
|
10
|
+
* provideDaffInMemoryDriver(
|
|
11
|
+
* { delay: 300 },
|
|
12
|
+
* DaffProductInMemoryBackendService,
|
|
13
|
+
* DaffCartInMemoryBackendService
|
|
14
|
+
* )
|
|
15
|
+
* ]
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const provideDaffInMemoryDriver: (config?: DaffInMemoryDriverConfig, ...backends: Array<Type<DaffInMemoryBackendInterface>>) => EnvironmentProviders[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ApolloLink, UriFunction } from '@apollo/client/core';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an Apollo HTTP link for GraphQL requests.
|
|
4
|
+
*
|
|
5
|
+
* @param url - The Shopify Storefront API endpoint URL for GraphQL requests.
|
|
6
|
+
* @returns An ApolloLink instance configured with the provided URL.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createHttpLink(url: string | UriFunction): ApolloLink;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Magento GraphQL possible types configuration for Apollo Client.
|
|
3
|
+
*
|
|
4
|
+
* This object defines the possible concrete types for each GraphQL interface
|
|
5
|
+
* used in Magento's GraphQL API. Apollo Client uses this information for
|
|
6
|
+
* proper fragment matching and union/interface type resolution.
|
|
7
|
+
*
|
|
8
|
+
* When Apollo Client encounters a GraphQL interface or union type in a query,
|
|
9
|
+
* it needs to know which concrete types can implement that interface to
|
|
10
|
+
* properly cache and normalize the data.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* new InMemoryCache({
|
|
15
|
+
* possibleTypes: MAGENTO_POSSIBLE_TYPES
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const MAGENTO_POSSIBLE_TYPES: {
|
|
20
|
+
CartAddressInterface: string[];
|
|
21
|
+
CartItemInterface: string[];
|
|
22
|
+
ProductInterface: string[];
|
|
23
|
+
CategoryInterface: string[];
|
|
24
|
+
MediaGalleryInterface: string[];
|
|
25
|
+
ProductLinksInterface: string[];
|
|
26
|
+
CreditMemoItemInterface: string[];
|
|
27
|
+
OrderItemInterface: string[];
|
|
28
|
+
InvoiceItemInterface: string[];
|
|
29
|
+
ShipmentItemInterface: string[];
|
|
30
|
+
AggregationOptionInterface: string[];
|
|
31
|
+
LayerFilterItemInterface: string[];
|
|
32
|
+
PhysicalProductInterface: string[];
|
|
33
|
+
CustomizableOptionInterface: string[];
|
|
34
|
+
CustomizableProductInterface: string[];
|
|
35
|
+
SwatchDataInterface: string[];
|
|
36
|
+
SwatchLayerFilterItemInterface: string[];
|
|
37
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom type policies that allow us to have more granular control
|
|
3
|
+
* over how ApolloClient reads from and writes to the cache.
|
|
4
|
+
*
|
|
5
|
+
* https://www.apollographql.com/docs/react/caching/cache-configuration/#typepolicy-fields
|
|
6
|
+
* https://www.apollographql.com/docs/react/caching/cache-field-behavior/
|
|
7
|
+
*/
|
|
8
|
+
import { TypePolicies } from '@apollo/client/cache';
|
|
9
|
+
declare const typePolicies: TypePolicies;
|
|
10
|
+
export default typePolicies;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated in favor of {@link provideMagentoDriver} Deprecated in version 0.88.0. Will be removed in version 0.91.0.
|
|
4
|
+
*/
|
|
2
5
|
export declare class DaffDriverMagentoModule {
|
|
3
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffDriverMagentoModule, never>;
|
|
4
7
|
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffDriverMagentoModule, never, never, never>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
+
import { PossibleTypesMap, TypePolicies, UriFunction } from '@apollo/client/core';
|
|
3
|
+
export interface DaffMagentoDriverConfig {
|
|
4
|
+
possibleTypes: PossibleTypesMap;
|
|
5
|
+
typePolicies: TypePolicies;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Sets up the Magento Daffodil driver configuration for Magento's GraphQl API.
|
|
9
|
+
*
|
|
10
|
+
* Under the hood, this creates an Apollo Client configuration.
|
|
11
|
+
*
|
|
12
|
+
* @param endpoint - The Magento store domain (e.g. "https://www.my-store.com/graphql") or an injection token for a string or function that returns a string
|
|
13
|
+
*/
|
|
14
|
+
export declare function provideMagentoDriver(endpoint: string | InjectionToken<string | UriFunction>, options?: DaffMagentoDriverConfig): Provider[];
|
package/magento/public_api.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@daffodil/driver","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/driver"]}}},"version":"0.
|
|
1
|
+
{"name":"@daffodil/driver","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/driver"]}}},"version":"0.88.1","description":"A consistent, sane api driver that works with different ecommerce systems.","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"homepage":"https://github.com/graycoreio/daffodil","optionalDependencies":{"angular-in-memory-web-api":"^0.19.0"},"peerDependencies":{"@angular/common":"^19.0.0","@angular/core":"^19.0.0","rxjs":"7.8.1"},"module":"fesm2022/daffodil-driver.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","default":"./fesm2022/daffodil-driver.mjs"},"./hubspot":{"types":"./hubspot/index.d.ts","default":"./fesm2022/daffodil-driver-hubspot.mjs"},"./in-memory":{"types":"./in-memory/index.d.ts","default":"./fesm2022/daffodil-driver-in-memory.mjs"},"./magento":{"types":"./magento/index.d.ts","default":"./fesm2022/daffodil-driver-magento.mjs"},"./shopify":{"types":"./shopify/index.d.ts","default":"./fesm2022/daffodil-driver-shopify.mjs"},"./hubspot/testing":{"types":"./hubspot/testing/index.d.ts","default":"./fesm2022/daffodil-driver-hubspot-testing.mjs"},"./magento/testing":{"types":"./magento/testing/index.d.ts","default":"./fesm2022/daffodil-driver-magento-testing.mjs"},"./shopify/testing":{"types":"./shopify/testing/index.d.ts","default":"./fesm2022/daffodil-driver-shopify-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
|