@daffodil/driver 0.39.8 → 0.39.12
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/bundles/daffodil-driver-magento-testing.umd.js +2 -2
- package/bundles/daffodil-driver-magento-testing.umd.js.map +1 -1
- package/bundles/daffodil-driver-magento-testing.umd.min.js +1 -1
- package/bundles/daffodil-driver-magento-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-driver-magento.umd.js +349 -12
- package/bundles/daffodil-driver-magento.umd.js.map +1 -1
- package/bundles/daffodil-driver-magento.umd.min.js +1 -1
- package/bundles/daffodil-driver-magento.umd.min.js.map +1 -1
- package/daffodil-driver.metadata.json +1 -1
- package/esm2015/index.js +2 -2
- package/esm2015/magento/errors/error.class.js +12 -0
- package/esm2015/magento/errors/public_api.js +3 -1
- package/esm2015/magento/errors/transform-graphql.js +7 -0
- package/esm2015/magento/errors/transform.js +10 -11
- package/esm2015/magento/testing/factories/discount.factory.js +2 -2
- package/esm2015/magento/testing/factories/money.factory.js +2 -2
- package/esm2015/models/public_api.js +2 -0
- package/esm2015/models/response.interface.js +2 -0
- package/esm2015/public_api.js +3 -0
- package/fesm2015/daffodil-driver-magento-testing.js +1 -1
- package/fesm2015/daffodil-driver-magento-testing.js.map +1 -1
- package/fesm2015/daffodil-driver-magento.js +22 -8
- package/fesm2015/daffodil-driver-magento.js.map +1 -1
- package/index.d.ts +1 -1
- package/magento/daffodil-driver-magento.metadata.json +1 -1
- package/magento/errors/error.class.d.ts +9 -0
- package/magento/errors/public_api.d.ts +2 -0
- package/magento/errors/transform-graphql.d.ts +3 -0
- package/magento/errors/transform.d.ts +2 -2
- package/models/public_api.d.ts +1 -0
- package/models/response.interface.d.ts +15 -0
- package/package.json +1 -1
- package/public_api.d.ts +2 -0
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
const lookup = map[error.graphQLErrors[0].extensions.category];
|
|
6
|
-
return lookup ? new lookup(error.message) : error;
|
|
7
|
-
}
|
|
8
|
-
;
|
|
1
|
+
import { daffIsError, } from '@daffodil/core';
|
|
2
|
+
import { DaffDriverMagentoError } from './error.class';
|
|
3
|
+
import { daffMagentoTransformGraphQlError } from './transform-graphql';
|
|
9
4
|
/**
|
|
10
5
|
* Transforms the passed error according to the lookup in the passed map.
|
|
11
6
|
*/
|
|
7
|
+
// TODO: return array of errors
|
|
12
8
|
export function daffTransformMagentoError(error, map) {
|
|
13
9
|
// TODO: handle network errors
|
|
14
10
|
if (error.graphQLErrors) {
|
|
15
|
-
return
|
|
11
|
+
return error.graphQLErrors.map(err => daffMagentoTransformGraphQlError(err, map))[0];
|
|
16
12
|
}
|
|
17
|
-
else {
|
|
13
|
+
else if (daffIsError(error)) {
|
|
18
14
|
return error;
|
|
19
15
|
}
|
|
16
|
+
else {
|
|
17
|
+
return new DaffDriverMagentoError(error.message);
|
|
18
|
+
}
|
|
20
19
|
}
|
|
21
20
|
;
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9kcml2ZXIvbWFnZW50by9zcmMvZXJyb3JzL3RyYW5zZm9ybS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBR0wsV0FBVyxHQUNaLE1BQU0sZ0JBQWdCLENBQUM7QUFFeEIsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3ZELE9BQU8sRUFBRSxnQ0FBZ0MsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRXZFOztHQUVHO0FBQ0gsK0JBQStCO0FBQy9CLE1BQU0sVUFBVSx5QkFBeUIsQ0FBNkIsS0FBVSxFQ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IG5ldHdvcmsgZXJyb3JzXG4gIGlmIChlcnJvci5ncmFwaFFMRXJyb3JzKSB7XG4gICAgcmV0dXJuIGVycm9yLmdyYXBoUUxFcnJvcnMubWFwKGVyciA9PiBkYWZmTWFnZW50b1RyYW5zZm9ybUdyYXBoUWxFcnJvcjxUPihlcnIsIG1hcCkpWzBdO1xuICB9IGVsc2UgaWYgKGRhZmZJc0Vycm9yKGVycm9yKSkge1xuICAgIHJldHVybiBlcnJvcjtcbiAgfSBlbHNlIHtcbiAgICByZXR1cm4gbmV3IERhZmZEcml2ZXJNYWdlbnRvRXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gIH1cbn07XG4iXX0=
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
|
-
import * as faker from 'faker/locale/en_US';
|
|
2
|
+
import * as faker from '@faker-js/faker/locale/en_US';
|
|
3
3
|
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
4
4
|
import { MagentoMoneyFactory } from './money.factory';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
@@ -26,4 +26,4 @@ MagentoDiscountFactory.decorators = [
|
|
|
26
26
|
},] }
|
|
27
27
|
];
|
|
28
28
|
MagentoDiscountFactory.ctorParameters = () => [];
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlzY291bnQuZmFjdG9yeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvZHJpdmVyL21hZ2VudG8vdGVzdGluZy9zcmMvZmFjdG9yaWVzL2Rpc2NvdW50LmZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMzQyxPQUFPLEtBQUssS0FBSyxNQU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dG9yeSc7XG5cbmV4cG9ydCBjbGFzcyBNb2NrTWFnZW50b0Rpc2NvdW50IGltcGxlbWVudHMgTWFnZW50b0Rpc2NvdW50IHtcblx0X190eXBlbmFtZSA9ICdEaXNjb3VudCc7XG4gIGFtb3VudCA9IHRoaXMubW9uZXkoKTtcbiAgbGFiZWwgPSBmYWtlci5yYW5kb20ud29yZCgpO1xuXG4gIHByaXZhdGUgbW9uZXkoKTogTWFnZW50b01vbmV5IHtcbiAgICByZXR1cm4gKG5ldyBNYWdlbnRvTW9uZXlGYWN0b3J5KCkpLmNyZWF0ZSgpO1xuICB9XG59O1xuXG5ASW5qZWN0YWJsZSh7XG4gIHByb3ZpZGVkSW46ICdyb290Jyxcbn0pXG5leHBvcnQgY2xhc3MgTWFnZW50b0Rpc2NvdW50RmFjdG9yeSBleHRlbmRzIERhZmZNb2RlbEZhY3Rvcnk8TWFnZW50b0Rpc2NvdW50PiB7XG4gIGNvbnN0cnVjdG9yKCkge1xuICAgIHN1cGVyKE1vY2tNYWdlbnRvRGlzY291bnQpO1xuICB9XG59XG4iXX0=
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
|
-
import * as faker from 'faker/locale/en_US';
|
|
2
|
+
import * as faker from '@faker-js/faker/locale/en_US';
|
|
3
3
|
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export class MockMagentoMoney {
|
|
@@ -22,4 +22,4 @@ MagentoMoneyFactory.decorators = [
|
|
|
22
22
|
},] }
|
|
23
23
|
];
|
|
24
24
|
MagentoMoneyFactory.ctorParameters = () => [];
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9uZXkuZmFjdG9yeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL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aWwvZHJpdmVyL21hZ2VudG8nO1xuXG5leHBvcnQgY2xhc3MgTW9ja01hZ2VudG9Nb25leSBpbXBsZW1lbnRzIE1hZ2VudG9Nb25leSB7XG5cdF9fdHlwZW5hbWUgPSAnTW9uZXknO1xuICB2YWx1ZSA9IGZha2VyLmRhdGF0eXBlLm51bWJlcih7IG1pbjogMSwgbWF4OiAxMDAwMCB9KTtcbiAgY3VycmVuY3kgPSBmYWtlci5yYW5kb20ud29yZCgpO1xufTtcblxuQEluamVjdGFibGUoe1xuICBwcm92aWRlZEluOiAncm9vdCcsXG59KVxuZXhwb3J0IGNsYXNzIE1hZ2VudG9Nb25leUZhY3RvcnkgZXh0ZW5kcyBEYWZmTW9kZWxGYWN0b3J5PE1hZ2VudG9Nb25leT4ge1xuICBjb25zdHJ1Y3RvcigpIHtcbiAgICBzdXBlcihNb2NrTWFnZW50b01vbmV5KTtcbiAgfVxufVxuIl19
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvZHJpdmVyL3NyYy9tb2RlbHMvcHVibGljX2FwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgRGFmZkRyaXZlclJlc3BvbnNlIH0gZnJvbSAnLi9yZXNwb25zZS5pbnRlcmZhY2UnO1xuIl19
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzcG9uc2UuaW50ZXJmYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGlicy9kcml2ZXIvc3JjL21vZGVscy9yZXNwb25zZS5pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IERhZmZFcnJvciB9IGZyb20gJ0BkYWZmb2RpbC9jb3JlJztcblxuLyoqXG4gKiBBIGRyaXZlciByZXNwb25zZS5cbiAqIENhbiBjb250YWluIGEgcmVzcG9uc2UsIGVycm9ycywgb3IgYm90aC5cbiAqL1xuZXhwb3J0IGludGVyZmFjZSBEYWZmRHJpdmVyUmVzcG9uc2U8VD4ge1xuICAvKipcbiAgICogVGhlIGJvZHkgb2YgdGhlIHJlc3BvbnNlLlxuICAgKi9cbiAgcmVzcG9uc2U/OiBUO1xuICAvKipcbiAgICogQSBsaXN0IG9mIGVycm9ycyB0aGF0IG9jY3VyZWQgZHVyaW5nIHRoZSBkcml2ZXIgY2FsbC5cbiAgICovXG4gIGVycm9yczogRGFmZkVycm9yW107XG59XG4iXX0=
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from './errors/public_api';
|
|
2
|
+
export * from './models/public_api';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYnMvZHJpdmVyL3NyYy9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxxQkFBcUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vZXJyb3JzL3B1YmxpY19hcGknO1xuZXhwb3J0ICogZnJvbSAnLi9tb2RlbHMvcHVibGljX2FwaSc7XG4iXX0=
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ɵɵdefineInjectable, Injectable } from '@angular/core';
|
|
2
|
-
import { datatype, random } from 'faker/locale/en_US';
|
|
2
|
+
import { datatype, random } from '@faker-js/faker/locale/en_US';
|
|
3
3
|
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
4
4
|
|
|
5
5
|
class MockMagentoMoney {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-driver-magento-testing.js","sources":["../../../libs/driver/magento/testing/src/factories/money.factory.ts","../../../libs/driver/magento/testing/src/factories/discount.factory.ts","../../../libs/driver/magento/testing/src/daffodil-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoMoney } from '@daffodil/driver/magento';\n\nexport class MockMagentoMoney implements MagentoMoney {\n\t__typename = 'Money';\n value = faker.datatype.number({ min: 1, max: 10000 });\n currency = faker.random.word();\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoMoneyFactory extends DaffModelFactory<MagentoMoney> {\n constructor() {\n super(MockMagentoMoney);\n }\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoDiscount,\n MagentoMoney,\n} from '@daffodil/driver/magento';\n\nimport { MagentoMoneyFactory } from './money.factory';\n\nexport class MockMagentoDiscount implements MagentoDiscount {\n\t__typename = 'Discount';\n amount = this.money();\n label = faker.random.word();\n\n private money(): MagentoMoney {\n return (new MagentoMoneyFactory()).create();\n }\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoDiscountFactory extends DaffModelFactory<MagentoDiscount> {\n constructor() {\n super(MockMagentoDiscount);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["faker.datatype","faker.random"],"mappings":";;;;MAMa,gBAAgB;IAA7B;QACC,eAAU,GAAG,OAAO,CAAC;QACpB,UAAK,GAAGA,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,aAAQ,GAAGC,MAAY,CAAC,IAAI,EAAE,CAAC;KAChC;CAAA;AAAA,CAAC;MAKW,mBAAoB,SAAQ,gBAA8B;IACrE;QACE,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACzB;;;;YANF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;MCHY,mBAAmB;IAAhC;QACC,eAAU,GAAG,UAAU,CAAC;QACvB,WAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,UAAK,GAAGA,MAAY,CAAC,IAAI,EAAE,CAAC;KAK7B;IAHS,KAAK;QACX,OAAO,CAAC,IAAI,mBAAmB,EAAE,EAAE,MAAM,EAAE,CAAC;KAC7C;CACF;AAAA,CAAC;MAKW,sBAAuB,SAAQ,gBAAiC;IAC3E;QACE,KAAK,CAAC,mBAAmB,CAAC,CAAC;KAC5B;;;;YANF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;ACvBD;;;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-driver-magento-testing.js","sources":["../../../libs/driver/magento/testing/src/factories/money.factory.ts","../../../libs/driver/magento/testing/src/factories/discount.factory.ts","../../../libs/driver/magento/testing/src/daffodil-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoMoney } from '@daffodil/driver/magento';\n\nexport class MockMagentoMoney implements MagentoMoney {\n\t__typename = 'Money';\n value = faker.datatype.number({ min: 1, max: 10000 });\n currency = faker.random.word();\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoMoneyFactory extends DaffModelFactory<MagentoMoney> {\n constructor() {\n super(MockMagentoMoney);\n }\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoDiscount,\n MagentoMoney,\n} from '@daffodil/driver/magento';\n\nimport { MagentoMoneyFactory } from './money.factory';\n\nexport class MockMagentoDiscount implements MagentoDiscount {\n\t__typename = 'Discount';\n amount = this.money();\n label = faker.random.word();\n\n private money(): MagentoMoney {\n return (new MagentoMoneyFactory()).create();\n }\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoDiscountFactory extends DaffModelFactory<MagentoDiscount> {\n constructor() {\n super(MockMagentoDiscount);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["faker.datatype","faker.random"],"mappings":";;;;MAMa,gBAAgB;IAA7B;QACC,eAAU,GAAG,OAAO,CAAC;QACpB,UAAK,GAAGA,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,aAAQ,GAAGC,MAAY,CAAC,IAAI,EAAE,CAAC;KAChC;CAAA;AAAA,CAAC;MAKW,mBAAoB,SAAQ,gBAA8B;IACrE;QACE,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACzB;;;;YANF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;MCHY,mBAAmB;IAAhC;QACC,eAAU,GAAG,UAAU,CAAC;QACvB,WAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,UAAK,GAAGA,MAAY,CAAC,IAAI,EAAE,CAAC;KAK7B;IAHS,KAAK;QACX,OAAO,CAAC,IAAI,mBAAmB,EAAE,EAAE,MAAM,EAAE,CAAC;KAC7C;CACF;AAAA,CAAC;MAKW,sBAAuB,SAAQ,gBAAiC;IAC3E;QACE,KAAK,CAAC,mBAAmB,CAAC,CAAC;KAC5B;;;;YANF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;ACvBD;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DaffInheritableError, daffIsError } from '@daffodil/core';
|
|
1
2
|
import { InjectionToken, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject } from '@angular/core';
|
|
2
3
|
import { ApolloLink } from '@apollo/client/core';
|
|
3
4
|
|
|
@@ -95,25 +96,38 @@ var introspectionQueryResultData = {
|
|
|
95
96
|
|
|
96
97
|
const schema = introspectionQueryResultData;
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
const DAFF_DRIVER_MAGENTO_ERROR_CODE = 'DAFF_DRIVER_MAGENTO_ERROR';
|
|
100
|
+
/**
|
|
101
|
+
* A very general error thrown when a more specific error type cannot be determined.
|
|
102
|
+
*/
|
|
103
|
+
class DaffDriverMagentoError extends DaffInheritableError {
|
|
104
|
+
constructor(message) {
|
|
105
|
+
super(message);
|
|
106
|
+
this.code = DAFF_DRIVER_MAGENTO_ERROR_CODE;
|
|
101
107
|
}
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function daffMagentoTransformGraphQlError(error, map) {
|
|
111
|
+
const ErrorClass = map[error.extensions.category] || DaffDriverMagentoError;
|
|
112
|
+
return new ErrorClass(error.message);
|
|
104
113
|
}
|
|
105
114
|
;
|
|
115
|
+
|
|
106
116
|
/**
|
|
107
117
|
* Transforms the passed error according to the lookup in the passed map.
|
|
108
118
|
*/
|
|
119
|
+
// TODO: return array of errors
|
|
109
120
|
function daffTransformMagentoError(error, map) {
|
|
110
121
|
// TODO: handle network errors
|
|
111
122
|
if (error.graphQLErrors) {
|
|
112
|
-
return
|
|
123
|
+
return error.graphQLErrors.map(err => daffMagentoTransformGraphQlError(err, map))[0];
|
|
113
124
|
}
|
|
114
|
-
else {
|
|
125
|
+
else if (daffIsError(error)) {
|
|
115
126
|
return error;
|
|
116
127
|
}
|
|
128
|
+
else {
|
|
129
|
+
return new DaffDriverMagentoError(error.message);
|
|
130
|
+
}
|
|
117
131
|
}
|
|
118
132
|
;
|
|
119
133
|
|
|
@@ -177,5 +191,5 @@ DaffMagentoApolloCacheableOperationsLinkGenerator.ctorParameters = () => [
|
|
|
177
191
|
* Generated bundle index. Do not edit.
|
|
178
192
|
*/
|
|
179
193
|
|
|
180
|
-
export { DAFF_MAGENTO_CACHEABLE_OPERATIONS, DaffMagentoApolloCacheableOperationsLinkGenerator, daffTransformMagentoError, provideDaffMagentoCacheableOperation, provideManyDaffMagentoCacheableOperations, schema };
|
|
194
|
+
export { DAFF_DRIVER_MAGENTO_ERROR_CODE, DAFF_MAGENTO_CACHEABLE_OPERATIONS, DaffDriverMagentoError, DaffMagentoApolloCacheableOperationsLinkGenerator, daffMagentoTransformGraphQlError, daffTransformMagentoError, provideDaffMagentoCacheableOperation, provideManyDaffMagentoCacheableOperations, schema };
|
|
181
195
|
//# sourceMappingURL=daffodil-driver-magento.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-driver-magento.js","sources":["../../../libs/driver/magento/src/schema/schema.ts","../../../libs/driver/magento/src/errors/transform.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/daffodil-driver-magento.ts"],"sourcesContent":["import introspectionQueryResultData from './introspection.json';\n\nexport const schema = introspectionQueryResultData;\n","import {
|
|
1
|
+
{"version":3,"file":"daffodil-driver-magento.js","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/graphql/cacheable-operations/cacheable-operations-token.ts","../../../libs/driver/magento/src/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.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\tpublic readonly code: string = DAFF_DRIVER_MAGENTO_ERROR_CODE;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\n}\n","import { GraphQLError } 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: GraphQLError,\n map: T,\n): DaffError {\n const ErrorClass = map[error.extensions.category] || DaffDriverMagentoError;\n\n return new ErrorClass(error.message) ;\n};\n","import {\n DaffError,\n DaffErrorCodeMap,\n daffIsError,\n} from '@daffodil/core';\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 // TODO: handle network errors\n if (error.graphQLErrors) {\n return error.graphQLErrors.map(err => daffMagentoTransformGraphQlError<T>(err, map))[0];\n } else if (daffIsError(error)) {\n return error;\n } else {\n return new DaffDriverMagentoError(error.message);\n }\n};\n","import { InjectionToken } from '@angular/core';\n\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 */\nexport const DAFF_MAGENTO_CACHEABLE_OPERATIONS = new InjectionToken<string[]>('DAFF_MAGENTO_CACHEABLE_OPERATIONS', { factory: () => []});\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\n/**\n * Adds many operation names to the list of cacheable Magento operations. Use only with Angular 9+.\n */\nexport function provideManyDaffMagentoCacheableOperations(...operationNames: string[]) {\n return operationNames.map(name => ({\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: name,\n multi: true,\n }));\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { ApolloLink } from '@apollo/client/core';\n\nimport { DaffApolloCacheableOperationLinkGenerator } 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 DaffApolloCacheableOperationLinkGenerator {\n constructor(\n\t\t@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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEa,MAAM,GAAG;;MCGT,8BAA8B,GAAG,4BAA4B;AAE1E;;;MAGa,sBAAuB,SAAQ,oBAAoB;IAG/D,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHD,SAAI,GAAW,8BAA8B,CAAC;KAI7D;;;SCNc,gCAAgC,CAC9C,KAAmB,EACnB,GAAM;IAEN,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,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CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;aACzC;YACD,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;SAC3B,CAAC,CAAC;KACJ;;;;YAfF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;wCAGE,MAAM,SAAC,iCAAiC;;;ACpB3C;;;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './public_api';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"daffTransformMagentoError":{"__symbolic":"function"},"MagentoMoney":{"__symbolic":"interface"},"MagentoDiscount":{"__symbolic":"interface"},"DaffMagentoApolloCacheableOperationsLinkGenerator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":15,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":3},"arguments":[{"__symbolic":"reference","name":"DAFF_MAGENTO_CACHEABLE_OPERATIONS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"string"}]}]}],"getLink":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"DAFF_MAGENTO_CACHEABLE_OPERATIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":8,"character":53},"arguments":["DAFF_MAGENTO_CACHEABLE_OPERATIONS",{"__symbolic":"error","message":"Lambda not supported","line":8,"character":126,"module":"./graphql/cacheable-operations/cacheable-operations-token"}]},"provideDaffMagentoCacheableOperation":{"__symbolic":"function","parameters":["operationName"],"value":{"provide":{"__symbolic":"reference","name":"DAFF_MAGENTO_CACHEABLE_OPERATIONS"},"useValue":{"__symbolic":"reference","name":"operationName"},"multi":true}},"provideManyDaffMagentoCacheableOperations":{"__symbolic":"function","parameters":["operationNames"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"operationNames"},"member":"map"},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":25,"character":28,"module":"./graphql/cacheable-operations/cacheable-operations-token"}]}}},"origins":{"schema":"./schema/schema","daffTransformMagentoError":"./errors/transform","MagentoMoney":"./models/responses/money","MagentoDiscount":"./models/responses/discount","DaffMagentoApolloCacheableOperationsLinkGenerator":"./graphql/cacheable-operations/apollo-cacheable-operations-link-generator","DAFF_MAGENTO_CACHEABLE_OPERATIONS":"./graphql/cacheable-operations/cacheable-operations-token","provideDaffMagentoCacheableOperation":"./graphql/cacheable-operations/cacheable-operations-token","provideManyDaffMagentoCacheableOperations":"./graphql/cacheable-operations/cacheable-operations-token"},"importAs":"@daffodil/driver/magento"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"daffTransformMagentoError":{"__symbolic":"function"},"daffMagentoTransformGraphQlError":{"__symbolic":"function"},"DAFF_DRIVER_MAGENTO_ERROR_CODE":"DAFF_DRIVER_MAGENTO_ERROR","DaffDriverMagentoError":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@daffodil/core","name":"DaffInheritableError","line":10,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"}]}]}},"MagentoMoney":{"__symbolic":"interface"},"MagentoDiscount":{"__symbolic":"interface"},"DaffMagentoApolloCacheableOperationsLinkGenerator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":15,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":3},"arguments":[{"__symbolic":"reference","name":"DAFF_MAGENTO_CACHEABLE_OPERATIONS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"string"}]}]}],"getLink":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"DAFF_MAGENTO_CACHEABLE_OPERATIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":8,"character":53},"arguments":["DAFF_MAGENTO_CACHEABLE_OPERATIONS",{"__symbolic":"error","message":"Lambda not supported","line":8,"character":126,"module":"./graphql/cacheable-operations/cacheable-operations-token"}]},"provideDaffMagentoCacheableOperation":{"__symbolic":"function","parameters":["operationName"],"value":{"provide":{"__symbolic":"reference","name":"DAFF_MAGENTO_CACHEABLE_OPERATIONS"},"useValue":{"__symbolic":"reference","name":"operationName"},"multi":true}},"provideManyDaffMagentoCacheableOperations":{"__symbolic":"function","parameters":["operationNames"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"operationNames"},"member":"map"},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":25,"character":28,"module":"./graphql/cacheable-operations/cacheable-operations-token"}]}}},"origins":{"schema":"./schema/schema","daffTransformMagentoError":"./errors/transform","daffMagentoTransformGraphQlError":"./errors/transform-graphql","DAFF_DRIVER_MAGENTO_ERROR_CODE":"./errors/error.class","DaffDriverMagentoError":"./errors/error.class","MagentoMoney":"./models/responses/money","MagentoDiscount":"./models/responses/discount","DaffMagentoApolloCacheableOperationsLinkGenerator":"./graphql/cacheable-operations/apollo-cacheable-operations-link-generator","DAFF_MAGENTO_CACHEABLE_OPERATIONS":"./graphql/cacheable-operations/cacheable-operations-token","provideDaffMagentoCacheableOperation":"./graphql/cacheable-operations/cacheable-operations-token","provideManyDaffMagentoCacheableOperations":"./graphql/cacheable-operations/cacheable-operations-token"},"importAs":"@daffodil/driver/magento"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DaffError, DaffInheritableError } from '@daffodil/core';
|
|
2
|
+
export declare const DAFF_DRIVER_MAGENTO_ERROR_CODE = "DAFF_DRIVER_MAGENTO_ERROR";
|
|
3
|
+
/**
|
|
4
|
+
* A very general error thrown when a more specific error type cannot be determined.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DaffDriverMagentoError extends DaffInheritableError implements DaffError {
|
|
7
|
+
readonly code: string;
|
|
8
|
+
constructor(message?: string);
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DaffErrorCodeMap } from '@daffodil/core';
|
|
1
|
+
import { DaffError, DaffErrorCodeMap } from '@daffodil/core';
|
|
2
2
|
/**
|
|
3
3
|
* Transforms the passed error according to the lookup in the passed map.
|
|
4
4
|
*/
|
|
5
|
-
export declare function daffTransformMagentoError<T extends DaffErrorCodeMap>(error: any, map: T):
|
|
5
|
+
export declare function daffTransformMagentoError<T extends DaffErrorCodeMap>(error: any, map: T): DaffError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DaffDriverResponse } from './response.interface';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DaffError } from '@daffodil/core';
|
|
2
|
+
/**
|
|
3
|
+
* A driver response.
|
|
4
|
+
* Can contain a response, errors, or both.
|
|
5
|
+
*/
|
|
6
|
+
export interface DaffDriverResponse<T> {
|
|
7
|
+
/**
|
|
8
|
+
* The body of the response.
|
|
9
|
+
*/
|
|
10
|
+
response?: T;
|
|
11
|
+
/**
|
|
12
|
+
* A list of errors that occured during the driver call.
|
|
13
|
+
*/
|
|
14
|
+
errors: DaffError[];
|
|
15
|
+
}
|
package/package.json
CHANGED
package/public_api.d.ts
ADDED