@daffodil/product 0.89.0 → 0.90.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.
@@ -132,7 +132,7 @@ const daffShopifyProductTransformer = (node) => ({
132
132
  id: node.images.nodes[0]?.id,
133
133
  },
134
134
  id: node.id,
135
- url: `/${node.handle}`,
135
+ url: `/${"products" /* SHOPIFY_ROUTE_PREFIXES.PRODUCTS */}/${node.handle}`,
136
136
  type: DaffProductTypeEnum.Simple,
137
137
  price: node.priceRange.maxVariantPrice.amount,
138
138
  in_stock: node.availableForSale,
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-product-driver-shopify.mjs","sources":["../../../libs/product/driver/shopify/src/queries/gql/get-all-products.ts","../../../libs/product/driver/shopify/src/queries/gql/get-product-by-url.ts","../../../libs/product/driver/shopify/src/queries/gql/get-product.ts","../../../libs/product/driver/shopify/src/queries/response.types.ts","../../../libs/product/driver/shopify/src/transforms/shopify-daff-product-transform.ts","../../../libs/product/driver/shopify/src/product.service.ts","../../../libs/product/driver/shopify/src/provider.ts","../../../libs/product/driver/shopify/src/product-driver.module.ts","../../../libs/product/driver/shopify/src/daffodil-product-driver-shopify.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nimport { ShopifyProductAllResponse } from '../response.types';\nimport { ShopifyProductAllVariables } from '../variables.types';\n\n/**\n * GraphQL query object for getting all products.\n */\nexport const getAllProducts = gql<ShopifyProductAllResponse, ShopifyProductAllVariables>`\n\tquery ShopifyGetAllProducts($length: Int) {\n\t\tproducts(first: $length) {\n\t\t\tnodes {\n\t\t\t\thandle\n\t\t\t\tonlineStoreUrl\n\t\t\t\tavailableForSale\n\t\t\t\tpriceRange {\n\t\t\t\t\tmaxVariantPrice {\n\t\t\t\t\t\tamount\n\t\t\t\t\t\tcurrencyCode\n\t\t\t\t\t}\n\t\t\t\t\tminVariantPrice {\n\t\t\t\t\t\tamount\n\t\t\t\t\t\tcurrencyCode\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tid\n\t\t\t\ttitle\n\t\t\t\tdescription\n\t\t\t\timages(first: 1) {\n\t\t\t\t\tnodes {\n\t\t\t\t\t\tid\n\t\t\t\t\t\turl\n\t\t\t\t\t\taltText\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { ShopifyProductSingleResponse } from '../response.types';\nimport { ShopifyProductUrlVariables } from '../variables.types';\n\n/**\n * GraphQL query object for getting a product by URL.\n *\n * The DaffLocatable url is transformed into a Shopify product handle for querying.\n */\nexport const getProductByUrl = gql<ShopifyProductSingleResponse, ShopifyProductUrlVariables>`\n query ShopifyGetProductByURL($handle: String!) {\n\t product(handle: $handle) {\n\t\t handle\n\t\t id\n\t\t title\n\t\t description\n\t\t availableForSale\n\t\t priceRange {\n\t\t\t maxVariantPrice {\n\t\t\t\t amount\n\t\t\t\t currencyCode\n\t\t\t }\n\t\t\t minVariantPrice {\n\t\t\t\t\t\tamount\n\t\t\t\t\t\tcurrencyCode\n\t\t\t }\n\t\t }\n\t\t images(first: 1) {\n\t\t\t nodes {\n\t\t\t\t id\n\t\t\t\t url\n\t\t\t\t altText\n\t\t\t }\n\t\t }\n\t\t onlineStoreUrl\n\t }\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { ShopifyProductSingleResponse } from '../response.types';\nimport { ShopifyProductIDVariables } from '../variables.types';\n\n/**\n * GraphQL query object for getting a single product by ID.\n */\nexport const getProduct = gql<ShopifyProductSingleResponse, ShopifyProductIDVariables>`\n query ShopifyGetAProduct($id: ID!) {\n\t product(id: $id) {\n\t\t handle\n\t\t id\n\t\t title\n\t\t description\n\t\t availableForSale\n\t\t priceRange {\n\t\t\t maxVariantPrice {\n\t\t\t\t amount\n\t\t\t\t currencyCode\n\t\t\t }\n\t\t\t minVariantPrice {\n\t\t\t\t\t\tamount\n\t\t\t\t\t\tcurrencyCode\n\t\t\t }\n\t\t }\n\t\t images(first: 1) {\n\t\t\t nodes {\n\t\t\t\t id\n\t\t\t\t url\n\t\t\t\t altText\n\t\t\t }\n\t\t }\n\t\t onlineStoreUrl\n\t }\n }\n`;\n","import {\n ShopifyProductNode,\n ShopifyProductGraph,\n} from '@daffodil/driver/shopify';\n\nexport interface ShopifyProductAllResponse {\n products?: ShopifyProductGraph;\n}\n\nexport interface ShopifyProductSingleResponse {\n product: ShopifyProductNode;\n};\n","import { ShopifyProductNode } from '@daffodil/driver/shopify';\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\n\n\n/**\n * Transforms a ProductNode into a different object.\n *\n * @param node - ProductNode object\n * @returns A Product object\n */\nexport const daffShopifyProductTransformer = (node: ShopifyProductNode): DaffProduct => ({\n name: node.title,\n images: node.images.nodes.map(imageNode => ({\n id: imageNode.id,\n url: imageNode.url,\n label: imageNode.altText ?? '',\n })),\n thumbnail: {\n url: node.images.nodes[0]?.url,\n label: node.images.nodes[0]?.altText ?? '',\n id: node.images.nodes[0]?.id,\n },\n id: node.id,\n url: `/${node.handle}`,\n type: DaffProductTypeEnum.Simple,\n price: node.priceRange.maxVariantPrice.amount,\n in_stock: node.availableForSale,\n description: node.description,\n});\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport {\n shopifyIdTransformer,\n shopifyUrlTransformer,\n APOLLO_CLIENT_NAME,\n} from '@daffodil/driver/shopify';\nimport { DaffProduct } from '@daffodil/product';\nimport {\n DaffProductDriverResponse,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n getAllProducts,\n getProduct,\n getProductByUrl,\n} from './queries/public_api';\nimport { daffShopifyProductTransformer } from './transforms/public_api';\n/**\n * A service for getting DaffProducts {@link DaffProduct} from apollo shopify product requests.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShopifyProductService\nimplements DaffProductServiceInterface {\n defaultLength = 20;\n\n constructor(private apollo: Apollo) {}\n\n getAll(): Observable<DaffProduct[]> {\n return this.apollo.use(APOLLO_CLIENT_NAME)\n .query({\n query: getAllProducts,\n variables: {\n length: this.defaultLength,\n },\n })\n .pipe(\n map((result) => {\n const nodes = result.data?.products?.nodes || [];\n return nodes.map((node) => daffShopifyProductTransformer(node));\n }),\n );\n }\n\n get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse> {\n return this.apollo.use(APOLLO_CLIENT_NAME)\n .query({\n query: getProduct,\n variables: { id: shopifyIdTransformer(productId, 'Product') },\n })\n .pipe(\n map((result) => {\n const productNode = result.data.product;\n return {\n id: productNode.id,\n products: [daffShopifyProductTransformer(productNode)],\n };\n }),\n );\n }\n\n getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse> {\n return this.apollo.use(APOLLO_CLIENT_NAME)\n .query({\n query: getProductByUrl,\n variables: { handle: shopifyUrlTransformer(url) },\n })\n .pipe(\n map((result) => {\n const productNode = result.data.product;\n return {\n id: productNode.id,\n products: [daffShopifyProductTransformer(productNode)],\n };\n }),\n );\n }\n}\n","import { Provider } from '@angular/core';\n\nimport { provideDaffProductDriver } from '@daffodil/product/driver';\n\nimport { DaffShopifyProductService } from './product.service';\n\n/**\n * Provides the Shopify product driver.\n *\n * @returns Array of Angular providers for the Shopify product driver\n */\nexport const provideDaffProductShopifyDriver = (): Provider[] => [\n DaffShopifyProductService,\n provideDaffProductDriver(DaffShopifyProductService),\n];\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\n\nimport { provideDaffProductShopifyDriver } from './provider';\n\n/**\n * A module that provides the {@link DaffProductDriver} as the {@link DaffShopifyProductService}.\n *\n * @deprecated Use {@link provideDaffProductShopifyDriver} instead. Deprecated in version 0.89.0. Will be removed in version 0.92.0.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffProductShopifyDriverModule {\n static forRoot(): ModuleWithProviders<DaffProductShopifyDriverModule> {\n return {\n ngModule: DaffProductShopifyDriverModule,\n providers: [\n provideDaffProductShopifyDriver(),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAKA;;AAEG;AACI,MAAM,cAAc,GAAG,GAAG,CAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHxF;;;;AAIG;AACI,MAAM,eAAe,GAAG,GAAG,CAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACL5F;;AAEG;AACI,MAAM,UAAU,GAAG,GAAG,CAAyD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACGrF;;ACJD;;;;;AAKG;MACU,6BAA6B,GAAG,CAAC,IAAwB,MAAmB;IACvF,IAAI,EAAE,IAAI,CAAC,KAAK;AAChB,IAAA,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,KAAK;QAC1C,EAAE,EAAE,SAAS,CAAC,EAAE;QAChB,GAAG,EAAE,SAAS,CAAC,GAAG;AAClB,QAAA,KAAK,EAAE,SAAS,CAAC,OAAO,IAAI,EAAE;AAC/B,KAAA,CAAC,CAAC;AACH,IAAA,SAAS,EAAE;QACT,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG;AAC9B,QAAA,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,EAAE;QAC1C,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;AAC7B,KAAA;IACD,EAAE,EAAE,IAAI,CAAC,EAAE;AACX,IAAA,GAAG,EAAE,CAAA,CAAA,EAAI,IAAI,CAAC,MAAM,CAAA,CAAE;IACtB,IAAI,EAAE,mBAAmB,CAAC,MAAM;AAChC,IAAA,KAAK,EAAE,IAAI,CAAC,UAA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,EAAE;AAClC,aAAA;SACF;IACH;iIARW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAA9B,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,YAHvC,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,YAHvC,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGH,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAL1C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;AClBD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-product-driver-shopify.mjs","sources":["../../../libs/product/driver/shopify/src/queries/gql/get-all-products.ts","../../../libs/product/driver/shopify/src/queries/gql/get-product-by-url.ts","../../../libs/product/driver/shopify/src/queries/gql/get-product.ts","../../../libs/product/driver/shopify/src/queries/response.types.ts","../../../libs/product/driver/shopify/src/transforms/shopify-daff-product-transform.ts","../../../libs/product/driver/shopify/src/product.service.ts","../../../libs/product/driver/shopify/src/provider.ts","../../../libs/product/driver/shopify/src/product-driver.module.ts","../../../libs/product/driver/shopify/src/daffodil-product-driver-shopify.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nimport { ShopifyProductAllResponse } from '../response.types';\nimport { ShopifyProductAllVariables } from '../variables.types';\n\n/**\n * GraphQL query object for getting all products.\n */\nexport const getAllProducts = gql<ShopifyProductAllResponse, ShopifyProductAllVariables>`\n\tquery ShopifyGetAllProducts($length: Int) {\n\t\tproducts(first: $length) {\n\t\t\tnodes {\n\t\t\t\thandle\n\t\t\t\tonlineStoreUrl\n\t\t\t\tavailableForSale\n\t\t\t\tpriceRange {\n\t\t\t\t\tmaxVariantPrice {\n\t\t\t\t\t\tamount\n\t\t\t\t\t\tcurrencyCode\n\t\t\t\t\t}\n\t\t\t\t\tminVariantPrice {\n\t\t\t\t\t\tamount\n\t\t\t\t\t\tcurrencyCode\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tid\n\t\t\t\ttitle\n\t\t\t\tdescription\n\t\t\t\timages(first: 1) {\n\t\t\t\t\tnodes {\n\t\t\t\t\t\tid\n\t\t\t\t\t\turl\n\t\t\t\t\t\taltText\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { ShopifyProductSingleResponse } from '../response.types';\nimport { ShopifyProductUrlVariables } from '../variables.types';\n\n/**\n * GraphQL query object for getting a product by URL.\n *\n * The DaffLocatable url is transformed into a Shopify product handle for querying.\n */\nexport const getProductByUrl = gql<ShopifyProductSingleResponse, ShopifyProductUrlVariables>`\n query ShopifyGetProductByURL($handle: String!) {\n\t product(handle: $handle) {\n\t\t handle\n\t\t id\n\t\t title\n\t\t description\n\t\t availableForSale\n\t\t priceRange {\n\t\t\t maxVariantPrice {\n\t\t\t\t amount\n\t\t\t\t currencyCode\n\t\t\t }\n\t\t\t minVariantPrice {\n\t\t\t\t\t\tamount\n\t\t\t\t\t\tcurrencyCode\n\t\t\t }\n\t\t }\n\t\t images(first: 1) {\n\t\t\t nodes {\n\t\t\t\t id\n\t\t\t\t url\n\t\t\t\t altText\n\t\t\t }\n\t\t }\n\t\t onlineStoreUrl\n\t }\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { ShopifyProductSingleResponse } from '../response.types';\nimport { ShopifyProductIDVariables } from '../variables.types';\n\n/**\n * GraphQL query object for getting a single product by ID.\n */\nexport const getProduct = gql<ShopifyProductSingleResponse, ShopifyProductIDVariables>`\n query ShopifyGetAProduct($id: ID!) {\n\t product(id: $id) {\n\t\t handle\n\t\t id\n\t\t title\n\t\t description\n\t\t availableForSale\n\t\t priceRange {\n\t\t\t maxVariantPrice {\n\t\t\t\t amount\n\t\t\t\t currencyCode\n\t\t\t }\n\t\t\t minVariantPrice {\n\t\t\t\t\t\tamount\n\t\t\t\t\t\tcurrencyCode\n\t\t\t }\n\t\t }\n\t\t images(first: 1) {\n\t\t\t nodes {\n\t\t\t\t id\n\t\t\t\t url\n\t\t\t\t altText\n\t\t\t }\n\t\t }\n\t\t onlineStoreUrl\n\t }\n }\n`;\n","import {\n ShopifyProductNode,\n ShopifyProductGraph,\n} from '@daffodil/driver/shopify';\n\nexport interface ShopifyProductAllResponse {\n products?: ShopifyProductGraph;\n}\n\nexport interface ShopifyProductSingleResponse {\n product: ShopifyProductNode;\n};\n","import {\n SHOPIFY_ROUTE_PREFIXES,\n ShopifyProductNode,\n} from '@daffodil/driver/shopify';\nimport {\n DaffProduct,\n DaffProductTypeEnum,\n} from '@daffodil/product';\n\n\n/**\n * Transforms a ProductNode into a different object.\n *\n * @param node - ProductNode object\n * @returns A Product object\n */\nexport const daffShopifyProductTransformer = (node: ShopifyProductNode): DaffProduct => ({\n name: node.title,\n images: node.images.nodes.map(imageNode => ({\n id: imageNode.id,\n url: imageNode.url,\n label: imageNode.altText ?? '',\n })),\n thumbnail: {\n url: node.images.nodes[0]?.url,\n label: node.images.nodes[0]?.altText ?? '',\n id: node.images.nodes[0]?.id,\n },\n id: node.id,\n url: `/${SHOPIFY_ROUTE_PREFIXES.PRODUCTS}/${node.handle}`,\n type: DaffProductTypeEnum.Simple,\n price: node.priceRange.maxVariantPrice.amount,\n in_stock: node.availableForSale,\n description: node.description,\n});\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport {\n shopifyIdTransformer,\n shopifyUrlTransformer,\n APOLLO_CLIENT_NAME,\n} from '@daffodil/driver/shopify';\nimport { DaffProduct } from '@daffodil/product';\nimport {\n DaffProductDriverResponse,\n DaffProductServiceInterface,\n} from '@daffodil/product/driver';\n\nimport {\n getAllProducts,\n getProduct,\n getProductByUrl,\n} from './queries/public_api';\nimport { daffShopifyProductTransformer } from './transforms/public_api';\n/**\n * A service for getting DaffProducts {@link DaffProduct} from apollo shopify product requests.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShopifyProductService\nimplements DaffProductServiceInterface {\n defaultLength = 20;\n\n constructor(private apollo: Apollo) {}\n\n getAll(): Observable<DaffProduct[]> {\n return this.apollo.use(APOLLO_CLIENT_NAME)\n .query({\n query: getAllProducts,\n variables: {\n length: this.defaultLength,\n },\n })\n .pipe(\n map((result) => {\n const nodes = result.data?.products?.nodes || [];\n return nodes.map((node) => daffShopifyProductTransformer(node));\n }),\n );\n }\n\n get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse> {\n return this.apollo.use(APOLLO_CLIENT_NAME)\n .query({\n query: getProduct,\n variables: { id: shopifyIdTransformer(productId, 'Product') },\n })\n .pipe(\n map((result) => {\n const productNode = result.data.product;\n return {\n id: productNode.id,\n products: [daffShopifyProductTransformer(productNode)],\n };\n }),\n );\n }\n\n getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse> {\n return this.apollo.use(APOLLO_CLIENT_NAME)\n .query({\n query: getProductByUrl,\n variables: { handle: shopifyUrlTransformer(url) },\n })\n .pipe(\n map((result) => {\n const productNode = result.data.product;\n return {\n id: productNode.id,\n products: [daffShopifyProductTransformer(productNode)],\n };\n }),\n );\n }\n}\n","import { Provider } from '@angular/core';\n\nimport { provideDaffProductDriver } from '@daffodil/product/driver';\n\nimport { DaffShopifyProductService } from './product.service';\n\n/**\n * Provides the Shopify product driver.\n *\n * @returns Array of Angular providers for the Shopify product driver\n */\nexport const provideDaffProductShopifyDriver = (): Provider[] => [\n DaffShopifyProductService,\n provideDaffProductDriver(DaffShopifyProductService),\n];\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\n\nimport { provideDaffProductShopifyDriver } from './provider';\n\n/**\n * A module that provides the {@link DaffProductDriver} as the {@link DaffShopifyProductService}.\n *\n * @deprecated Use {@link provideDaffProductShopifyDriver} instead. Deprecated in version 0.89.0. Will be removed in version 0.92.0.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffProductShopifyDriverModule {\n static forRoot(): ModuleWithProviders<DaffProductShopifyDriverModule> {\n return {\n ngModule: DaffProductShopifyDriverModule,\n providers: [\n provideDaffProductShopifyDriver(),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAKA;;AAEG;AACI,MAAM,cAAc,GAAG,GAAG,CAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACHxF;;;;AAIG;AACI,MAAM,eAAe,GAAG,GAAG,CAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACL5F;;AAEG;AACI,MAAM,UAAU,GAAG,GAAG,CAAyD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACGrF;;ACDD;;;;;AAKG;MACU,6BAA6B,GAAG,CAAC,IAAwB,MAAmB;IACvF,IAAI,EAAE,IAAI,CAAC,KAAK;AAChB,IAAA,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,KAAK;QAC1C,EAAE,EAAE,SAAS,CAAC,EAAE;QAChB,GAAG,EAAE,SAAS,CAAC,GAAG;AAClB,QAAA,KAAK,EAAE,SAAS,CAAC,OAAO,IAAI,EAAE;AAC/B,KAAA,CAAC,CAAC;AACH,IAAA,SAAS,EAAE;QACT,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC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description":"Interfaces built for daffodil/state","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"publishConfig":{"directory":"../../dist/product"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^20.0.0","@angular/core":"^20.0.0","@daffodil/core":"0.89.0","@ngrx/effects":"^20.0.0","@ngrx/entity":"^20.0.0","@ngrx/store":"^20.0.0","rxjs":"7.8.1"},"optionalDependencies":{"@apollo/client":"^3.12.6","@daffodil/driver":"0.89.0","angular-in-memory-web-api":"^0.20.0","apollo-angular":"^11.0.0","@faker-js/faker":"^9.8.0"},"module":"fesm2022/daffodil-product.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","default":"./fesm2022/daffodil-product.mjs"},"./driver":{"types":"./driver/index.d.ts","default":"./fesm2022/daffodil-product-driver.mjs"},"./routing":{"types":"./routing/index.d.ts","default":"./fesm2022/daffodil-product-routing.mjs"},"./state":{"types":"./state/index.d.ts","default":"./fesm2022/daffodil-product-state.mjs"},"./testing":{"types":"./testing/index.d.ts","default":"./fesm2022/daffodil-product-testing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","default":"./fesm2022/daffodil-product-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","default":"./fesm2022/daffodil-product-driver-magento.mjs"},"./driver/shopify":{"types":"./driver/shopify/index.d.ts","default":"./fesm2022/daffodil-product-driver-shopify.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","default":"./fesm2022/daffodil-product-driver-testing.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","default":"./fesm2022/daffodil-product-state-testing.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","default":"./fesm2022/daffodil-product-driver-magento-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
1
+ {"name":"@daffodil/product","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/product"]}}},"version":"0.90.0","description":"Interfaces built for daffodil/state","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"publishConfig":{"directory":"../../dist/product"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^20.0.0","@angular/core":"^20.0.0","@daffodil/core":"0.90.0","@ngrx/effects":"^20.0.0","@ngrx/entity":"^20.0.0","@ngrx/store":"^20.0.0","rxjs":"^7.0.0"},"optionalDependencies":{"@apollo/client":"^3.12.6","@daffodil/driver":"0.90.0","angular-in-memory-web-api":"^0.20.0","apollo-angular":"^11.0.0","@faker-js/faker":"^9.8.0"},"module":"fesm2022/daffodil-product.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","default":"./fesm2022/daffodil-product.mjs"},"./driver":{"types":"./driver/index.d.ts","default":"./fesm2022/daffodil-product-driver.mjs"},"./routing":{"types":"./routing/index.d.ts","default":"./fesm2022/daffodil-product-routing.mjs"},"./state":{"types":"./state/index.d.ts","default":"./fesm2022/daffodil-product-state.mjs"},"./testing":{"types":"./testing/index.d.ts","default":"./fesm2022/daffodil-product-testing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","default":"./fesm2022/daffodil-product-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","default":"./fesm2022/daffodil-product-driver-magento.mjs"},"./driver/shopify":{"types":"./driver/shopify/index.d.ts","default":"./fesm2022/daffodil-product-driver-shopify.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","default":"./fesm2022/daffodil-product-driver-testing.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","default":"./fesm2022/daffodil-product-state-testing.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","default":"./fesm2022/daffodil-product-driver-magento-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.6.2"}}