@daffodil/driver 0.76.0 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/errors/network-error.class.mjs +1 -1
- package/esm2022/http-client-cache/noop.service.mjs +4 -4
- package/esm2022/hubspot/hubspot-forms.service.mjs +1 -1
- package/esm2022/in-memory/backend/backends.token.mjs +11 -0
- package/esm2022/in-memory/backend/data-service.type.mjs +2 -0
- package/esm2022/in-memory/backend/delegate.class.mjs +43 -0
- package/esm2022/in-memory/backend/public_api.mjs +7 -0
- package/esm2022/in-memory/backend/root.service.mjs +35 -0
- package/esm2022/in-memory/backend/routeable.type.mjs +2 -0
- package/esm2022/in-memory/backend/type.mjs +2 -0
- package/esm2022/in-memory/config/default.mjs +4 -0
- package/esm2022/in-memory/config/public_api.mjs +4 -0
- package/esm2022/in-memory/config/token.mjs +4 -0
- package/esm2022/in-memory/config/type.mjs +2 -0
- package/esm2022/in-memory/daffodil-driver-in-memory.mjs +5 -0
- package/esm2022/in-memory/driver/base.class.mjs +15 -0
- package/esm2022/in-memory/driver/public_api.mjs +2 -0
- package/esm2022/in-memory/index.mjs +2 -0
- package/esm2022/in-memory/module.mjs +26 -0
- package/esm2022/in-memory/public_api.mjs +5 -0
- package/esm2022/magento/errors/error.class.mjs +1 -1
- package/esm2022/magento/errors/network-error.class.mjs +1 -1
- package/esm2022/magento/errors/transform-graphql.mjs +2 -2
- package/esm2022/magento/errors/transform.mjs +1 -1
- package/esm2022/magento/graphql/cache-header/cache-header-apollo-link.mjs +4 -4
- package/esm2022/magento/graphql/cache.service.mjs +4 -4
- package/esm2022/magento/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.mjs +4 -4
- package/esm2022/magento/graphql/type-policies.mjs +1 -1
- package/esm2022/magento/magento.module.mjs +5 -5
- package/esm2022/magento/testing/factories/discount.factory.mjs +4 -4
- package/esm2022/magento/testing/factories/money.factory.mjs +4 -4
- package/esm2022/magento/testing/factories/page-info.factory.mjs +4 -4
- package/fesm2022/daffodil-driver-hubspot.mjs.map +1 -1
- package/fesm2022/daffodil-driver-in-memory.mjs +135 -0
- package/fesm2022/daffodil-driver-in-memory.mjs.map +1 -0
- package/fesm2022/daffodil-driver-magento-testing.mjs +9 -9
- package/fesm2022/daffodil-driver-magento-testing.mjs.map +1 -1
- package/fesm2022/daffodil-driver-magento.mjs +14 -14
- package/fesm2022/daffodil-driver-magento.mjs.map +1 -1
- package/fesm2022/daffodil-driver.mjs +3 -3
- package/fesm2022/daffodil-driver.mjs.map +1 -1
- package/in-memory/backend/backends.token.d.ts +2 -0
- package/in-memory/backend/data-service.type.d.ts +23 -0
- package/in-memory/backend/delegate.class.d.ts +25 -0
- package/in-memory/backend/public_api.d.ts +6 -0
- package/in-memory/backend/root.service.d.ts +17 -0
- package/in-memory/backend/routeable.type.d.ts +25 -0
- package/in-memory/backend/type.d.ts +6 -0
- package/in-memory/config/default.d.ts +2 -0
- package/in-memory/config/public_api.d.ts +3 -0
- package/in-memory/config/token.d.ts +2 -0
- package/in-memory/config/type.d.ts +6 -0
- package/in-memory/driver/base.class.d.ts +14 -0
- package/in-memory/driver/public_api.d.ts +1 -0
- package/in-memory/index.d.ts +1 -0
- package/in-memory/module.d.ts +12 -0
- package/in-memory/public_api.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-driver.mjs","sources":["../../../libs/driver/src/errors/codes.ts","../../../libs/driver/src/errors/bad-input.ts","../../../libs/driver/src/errors/network-error.class.ts","../../../libs/driver/src/http-client-cache/noop.service.ts","../../../libs/driver/src/http-client-cache/service.token.ts","../../../libs/driver/src/daffodil-driver.ts"],"sourcesContent":["export enum DaffDriverErrorCodes {\n BAD_INPUT = 'DAFF_BAD_INPUT'\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffDriverErrorCodes } from './codes';\n\nexport class DaffBadInputError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffDriverErrorCodes.BAD_INPUT;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_DRIVER_NETWORK_ERROR_CODE = 'DAFF_DRIVER_NETWORK_ERROR';\n\n/**\n * An error thrown when the a driver encounters a problem with network connectivity.\n */\nexport class DaffDriverNetworkError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_DRIVER_NETWORK_ERROR_CODE;\n\n constructor(message?: string) {\n
|
|
1
|
+
{"version":3,"file":"daffodil-driver.mjs","sources":["../../../libs/driver/src/errors/codes.ts","../../../libs/driver/src/errors/bad-input.ts","../../../libs/driver/src/errors/network-error.class.ts","../../../libs/driver/src/http-client-cache/noop.service.ts","../../../libs/driver/src/http-client-cache/service.token.ts","../../../libs/driver/src/daffodil-driver.ts"],"sourcesContent":["export enum DaffDriverErrorCodes {\n BAD_INPUT = 'DAFF_BAD_INPUT'\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffDriverErrorCodes } from './codes';\n\nexport class DaffBadInputError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffDriverErrorCodes.BAD_INPUT;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_DRIVER_NETWORK_ERROR_CODE = 'DAFF_DRIVER_NETWORK_ERROR';\n\n/**\n * An error thrown when the a driver encounters a problem with network connectivity.\n */\nexport class DaffDriverNetworkError extends DaffInheritableError implements DaffError {\n public readonly code: string = DAFF_DRIVER_NETWORK_ERROR_CODE;\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffDriverHttpClientCacheServiceInterface } from './service.type';\n\n/**\n * A noop service. Always does nothing for every single method.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffDriverHttpClientCacheNoopService implements DaffDriverHttpClientCacheServiceInterface {\n reset(): void {}\n}\n","import {\n InjectionToken,\n inject,\n} from '@angular/core';\n\nimport { DaffDriverHttpClientCacheNoopService } from './noop.service';\nimport { DaffDriverHttpClientCacheServiceInterface } from './service.type';\n\nexport const DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE = new InjectionToken<DaffDriverHttpClientCacheServiceInterface>('DAFF_DRIVER_HTTP_CLIENT_CACHE_SERVICE', { factory: () => inject(DaffDriverHttpClientCacheNoopService) });\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;IAAY,qBAEX;AAFD,CAAA,UAAY,oBAAoB,EAAA;AAC9B,IAAA,oBAAA,CAAA,WAAA,CAAA,GAAA,gBAA4B,CAAA;AAC9B,CAAC,EAFW,oBAAoB,KAApB,oBAAoB,GAE/B,EAAA,CAAA,CAAA;;ACKK,MAAO,iBAAkB,SAAQ,oBAAoB,CAAA;AAGzD,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;AAFlB,QAAA,IAAA,CAAA,IAAI,GAAW,oBAAoB,CAAC,SAAS,CAAC;KAI7D;AACF;;ACRM,MAAM,8BAA8B,GAAG,4BAA4B;AAE1E;;AAEG;AACG,MAAO,sBAAuB,SAAQ,oBAAoB,CAAA;AAG9D,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHD,IAAI,CAAA,IAAA,GAAW,8BAA8B,CAAC;KAI7D;AACF;;ACZD;;;;AAIG;MAIU,oCAAoC,CAAA;AAC/C,IAAA,KAAK,MAAW;8GADL,oCAAoC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAApC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oCAAoC,cAFnC,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEP,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBAHhD,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;MCHY,qCAAqC,GAAG,IAAI,cAAc,CAA4C,uCAAuC,EAAE,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC,oCAAoC,CAAC,EAAE;;ACR3N;;AAEG;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { DaffInMemoryBackendInterface } from './type';
|
|
2
|
+
export declare const DAFF_IN_MEMORY_BACKENDS: import("@angular/core").InjectionToken<DaffInMemoryBackendInterface[]>, provideDaffInMemoryBackends: <R extends DaffInMemoryBackendInterface = DaffInMemoryBackendInterface>(...classes: import("@angular/core").Type<R>[]) => Array<import("@angular/core").ExistingProvider>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RequestInfo } from 'angular-in-memory-web-api';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
/**
|
|
4
|
+
* An interface for defining in memory services that can handle CRUD requests.
|
|
5
|
+
*/
|
|
6
|
+
export interface DaffInMemoryDataServiceInterface {
|
|
7
|
+
/**
|
|
8
|
+
* The R in CRUD.
|
|
9
|
+
*/
|
|
10
|
+
get?(reqInfo: RequestInfo): Observable<any>;
|
|
11
|
+
/**
|
|
12
|
+
* The C in CRUD.
|
|
13
|
+
*/
|
|
14
|
+
post?(reqInfo: RequestInfo): Observable<any>;
|
|
15
|
+
/**
|
|
16
|
+
* The U in CRUD.
|
|
17
|
+
*/
|
|
18
|
+
put?(reqInfo: RequestInfo): Observable<any>;
|
|
19
|
+
/**
|
|
20
|
+
* The D in CRUD.
|
|
21
|
+
*/
|
|
22
|
+
delete?(reqInfo: RequestInfo): Observable<any>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RequestInfo } from 'angular-in-memory-web-api';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { DaffInMemoryDataServiceInterface } from './data-service.type';
|
|
4
|
+
import { DaffInMemoryRouteableBackend } from './routeable.type';
|
|
5
|
+
declare enum Method {
|
|
6
|
+
GET = "get",
|
|
7
|
+
POST = "post",
|
|
8
|
+
PUT = "put",
|
|
9
|
+
DELETE = "delete"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An class that automatically delegates requests to in-memory backends.
|
|
13
|
+
*
|
|
14
|
+
* @inheritdoc
|
|
15
|
+
*/
|
|
16
|
+
export declare class DaffInMemoryBackendDelegate implements DaffInMemoryDataServiceInterface {
|
|
17
|
+
protected backends: Array<DaffInMemoryRouteableBackend>;
|
|
18
|
+
constructor(backends: Array<DaffInMemoryRouteableBackend>);
|
|
19
|
+
protected delegateRequest(reqInfo: RequestInfo, method: Method): Observable<any>;
|
|
20
|
+
get?(reqInfo: RequestInfo): Observable<any>;
|
|
21
|
+
post?(reqInfo: RequestInfo): Observable<any>;
|
|
22
|
+
put?(reqInfo: RequestInfo): Observable<any>;
|
|
23
|
+
delete?(reqInfo: RequestInfo): Observable<any>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InMemoryDbService, RequestInfo } from 'angular-in-memory-web-api';
|
|
2
|
+
import { DaffInMemoryDataServiceInterface } from './data-service.type';
|
|
3
|
+
import { DaffInMemoryBackendDelegate } from './delegate.class';
|
|
4
|
+
import { DaffInMemoryBackendInterface } from './type';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* An in-memory backend that automatically delegates requests to backends provided to {@link DAFF_IN_MEMORY_BACKENDS}.
|
|
8
|
+
*
|
|
9
|
+
* @inheritdoc
|
|
10
|
+
*/
|
|
11
|
+
export declare class DaffInMemoryRootBackend extends DaffInMemoryBackendDelegate implements DaffInMemoryDataServiceInterface, InMemoryDbService {
|
|
12
|
+
private _backends;
|
|
13
|
+
constructor(_backends: Array<DaffInMemoryBackendInterface>);
|
|
14
|
+
createDb(reqInfo?: RequestInfo): import("rxjs").Observable<{}>;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffInMemoryRootBackend, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffInMemoryRootBackend>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DaffInMemoryDataServiceInterface } from './data-service.type';
|
|
2
|
+
/**
|
|
3
|
+
* A routing target that handles a single collection.
|
|
4
|
+
*/
|
|
5
|
+
export interface DaffInMemorySingleRouteableBackend extends DaffInMemoryDataServiceInterface {
|
|
6
|
+
/**
|
|
7
|
+
* The collection name of the backend service where the backend only serves one collection.
|
|
8
|
+
* Used for routing requests to the correct backend.
|
|
9
|
+
*/
|
|
10
|
+
readonly collectionName: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A routing target that handles multiple collections.
|
|
14
|
+
*/
|
|
15
|
+
export interface DaffInMemoryMultiRouteableBackend extends DaffInMemoryDataServiceInterface {
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if the backend can handle the request with the specified collection name.
|
|
18
|
+
* Used for backends that handle multiple collections.
|
|
19
|
+
*/
|
|
20
|
+
canHandle(collectionName: string): boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An in-memory backend that can be easily routed to based on the available capabilities.
|
|
24
|
+
*/
|
|
25
|
+
export type DaffInMemoryRouteableBackend = DaffInMemorySingleRouteableBackend | DaffInMemoryMultiRouteableBackend;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InMemoryDbService } from 'angular-in-memory-web-api';
|
|
2
|
+
import { DaffInMemoryRouteableBackend } from './routeable.type';
|
|
3
|
+
/**
|
|
4
|
+
* An interface for defining in memory backends that use the angular in memory web api.
|
|
5
|
+
*/
|
|
6
|
+
export type DaffInMemoryBackendInterface = InMemoryDbService & DaffInMemoryRouteableBackend;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { DaffInMemoryDriverConfig } from './type';
|
|
2
|
+
export declare const DAFF_IN_MEMORY_DRIVER_CONFIG: import("@angular/core").InjectionToken<DaffInMemoryDriverConfig>, provideDaffInMemoryDriverConfig: <R extends DaffInMemoryDriverConfig = DaffInMemoryDriverConfig>(config: Partial<R>) => import("@angular/core").ValueProvider;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InMemoryBackendConfigArgs } from 'angular-in-memory-web-api';
|
|
2
|
+
/**
|
|
3
|
+
* The base class for in-memory drivers.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class DaffInMemoryDriverBase {
|
|
6
|
+
private config;
|
|
7
|
+
private collectionName;
|
|
8
|
+
/**
|
|
9
|
+
* The URL of the corresponding backend.
|
|
10
|
+
* Does not include a trailing slash, it is of the form: `/<api base>/<collection name>`.
|
|
11
|
+
*/
|
|
12
|
+
protected readonly url: string;
|
|
13
|
+
constructor(config: InMemoryBackendConfigArgs, collectionName: string);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './base.class';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public_api';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { DaffInMemoryDriverConfig } from './config/public_api';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Sets up the angular in memory web API with the {@link DaffInMemoryRootBackend}.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DaffInMemoryDriverModule {
|
|
8
|
+
static forRoot(config?: DaffInMemoryDriverConfig): ModuleWithProviders<DaffInMemoryDriverModule>;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffInMemoryDriverModule, never>;
|
|
10
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffInMemoryDriverModule, never, never, never>;
|
|
11
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffInMemoryDriverModule>;
|
|
12
|
+
}
|
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.78.0","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.18.0"},"peerDependencies":{"@angular/common":"^18.2.2","@angular/core":"^18.2.2","rxjs":"7.8.1"},"module":"fesm2022/daffodil-driver.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/daffodil-driver.mjs","esm":"./esm2022/daffodil-driver.mjs","default":"./fesm2022/daffodil-driver.mjs"},"./hubspot":{"types":"./hubspot/index.d.ts","esm2022":"./esm2022/hubspot/daffodil-driver-hubspot.mjs","esm":"./esm2022/hubspot/daffodil-driver-hubspot.mjs","default":"./fesm2022/daffodil-driver-hubspot.mjs"},"./in-memory":{"types":"./in-memory/index.d.ts","esm2022":"./esm2022/in-memory/daffodil-driver-in-memory.mjs","esm":"./esm2022/in-memory/daffodil-driver-in-memory.mjs","default":"./fesm2022/daffodil-driver-in-memory.mjs"},"./magento":{"types":"./magento/index.d.ts","esm2022":"./esm2022/magento/daffodil-driver-magento.mjs","esm":"./esm2022/magento/daffodil-driver-magento.mjs","default":"./fesm2022/daffodil-driver-magento.mjs"},"./magento/testing":{"types":"./magento/testing/index.d.ts","esm2022":"./esm2022/magento/testing/daffodil-driver-magento-testing.mjs","esm":"./esm2022/magento/testing/daffodil-driver-magento-testing.mjs","default":"./fesm2022/daffodil-driver-magento-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
|