From f027639045374709b64259584986ea4ae9e1be5b Mon Sep 17 00:00:00 2001 From: Jai Kamat Date: Tue, 6 Feb 2024 03:52:10 -0800 Subject: [PATCH] feat(test-data): create `StandalonePrice` model and associated draft (#472) * chore(test-data): create standalone prices model with draft * chore(test-data): generate changeset * chore(test-data): revise package version * chore(test-data): add pricess team as codeowner * chore(test-data): remove duplicated field type * chore(test-data): test public api for model --- .changeset/fuzzy-cats-glow.md | 7 + .github/CODEOWNERS | 1 + graphql-types/src/generated/settings.ts | 77 ++ models/commons/README.md | 12 + models/commons/src/index.ts | 3 + .../presets/channel-reference.spec.ts | 10 + .../presets/channel-reference.ts | 6 + .../src/key-reference/presets/index.ts | 2 + models/commons/src/price-tier/builder.spec.ts | 57 ++ models/commons/src/price-tier/builder.ts | 12 + models/commons/src/price-tier/generator.ts | 14 + models/commons/src/price-tier/index.ts | 3 + .../commons/src/price-tier/presets/index.ts | 3 + .../price-tier-draft/builder.spec.ts | 56 ++ .../price-tier/price-tier-draft/builder.ts | 12 + .../price-tier/price-tier-draft/generator.ts | 14 + .../src/price-tier/price-tier-draft/index.ts | 2 + .../price-tier-draft/presets/index.ts | 3 + .../price-tier-draft/transformers.ts | 17 + models/commons/src/price-tier/transformers.ts | 19 + models/commons/src/price-tier/types.ts | 17 + models/standalone-price/LICENSE | 21 + models/standalone-price/README.md | 25 + models/standalone-price/package.json | 30 + models/standalone-price/src/builder.spec.ts | 171 ++++ models/standalone-price/src/builder.ts | 12 + models/standalone-price/src/generator.ts | 40 + models/standalone-price/src/index.ts | 6 + models/standalone-price/src/presets/index.ts | 3 + .../standalone-price-draft/builder.spec.ts | 128 +++ .../src/standalone-price-draft/builder.ts | 15 + .../src/standalone-price-draft/generator.ts | 31 + .../src/standalone-price-draft/index.ts | 2 + .../standalone-price-draft/presets/index.ts | 3 + .../standalone-price-draft/transformers.ts | 24 + models/standalone-price/src/transformers.ts | 116 +++ models/standalone-price/src/types.ts | 38 + pnpm-lock.yaml | 35 + schemas/settings.json | 784 +++++++++++++++++- 39 files changed, 1809 insertions(+), 22 deletions(-) create mode 100644 .changeset/fuzzy-cats-glow.md create mode 100644 models/commons/src/key-reference/presets/channel-reference.spec.ts create mode 100644 models/commons/src/key-reference/presets/channel-reference.ts create mode 100644 models/commons/src/price-tier/builder.spec.ts create mode 100644 models/commons/src/price-tier/builder.ts create mode 100644 models/commons/src/price-tier/generator.ts create mode 100644 models/commons/src/price-tier/index.ts create mode 100644 models/commons/src/price-tier/presets/index.ts create mode 100644 models/commons/src/price-tier/price-tier-draft/builder.spec.ts create mode 100644 models/commons/src/price-tier/price-tier-draft/builder.ts create mode 100644 models/commons/src/price-tier/price-tier-draft/generator.ts create mode 100644 models/commons/src/price-tier/price-tier-draft/index.ts create mode 100644 models/commons/src/price-tier/price-tier-draft/presets/index.ts create mode 100644 models/commons/src/price-tier/price-tier-draft/transformers.ts create mode 100644 models/commons/src/price-tier/transformers.ts create mode 100644 models/commons/src/price-tier/types.ts create mode 100644 models/standalone-price/LICENSE create mode 100644 models/standalone-price/README.md create mode 100644 models/standalone-price/package.json create mode 100644 models/standalone-price/src/builder.spec.ts create mode 100644 models/standalone-price/src/builder.ts create mode 100644 models/standalone-price/src/generator.ts create mode 100644 models/standalone-price/src/index.ts create mode 100644 models/standalone-price/src/presets/index.ts create mode 100644 models/standalone-price/src/standalone-price-draft/builder.spec.ts create mode 100644 models/standalone-price/src/standalone-price-draft/builder.ts create mode 100644 models/standalone-price/src/standalone-price-draft/generator.ts create mode 100644 models/standalone-price/src/standalone-price-draft/index.ts create mode 100644 models/standalone-price/src/standalone-price-draft/presets/index.ts create mode 100644 models/standalone-price/src/standalone-price-draft/transformers.ts create mode 100644 models/standalone-price/src/transformers.ts create mode 100644 models/standalone-price/src/types.ts diff --git a/.changeset/fuzzy-cats-glow.md b/.changeset/fuzzy-cats-glow.md new file mode 100644 index 000000000..0b4258e96 --- /dev/null +++ b/.changeset/fuzzy-cats-glow.md @@ -0,0 +1,7 @@ +--- +'@commercetools-test-data/standalone-price': minor +'@commercetools-test-data/commons': minor +'@commercetools-test-data/graphql-types': minor +--- + +Create standalone prices model and associated draft, support channel key reference preset diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 629f973a7..e32120e17 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -44,6 +44,7 @@ /models/shipping-method @commercetools/checkout-team-fe /models/shopping-list @commercetools/checkout-team-fe /models/staged-quote @commercetools/customers-team-fe +/models/standalone-price @commercetools/priceless-team-fe /models/store @commercetools/context-team-fe /models/tax-category @commercetools/checkout-team-fe /models/zone @commercetools/checkout-team-fe diff --git a/graphql-types/src/generated/settings.ts b/graphql-types/src/generated/settings.ts index d1c81525f..6e1f1b729 100644 --- a/graphql-types/src/generated/settings.ts +++ b/graphql-types/src/generated/settings.ts @@ -113,6 +113,7 @@ export type TMcSettingsBusinessUnitsListMyViewTableInput = { export enum TMcSettingsCategoryRecommendationSearchProperty { Attribute = 'Attribute', + /** @deprecated The machine learning APIs are not available anymore. */ MachineLearning = 'MachineLearning', ProductType = 'ProductType', } @@ -396,6 +397,21 @@ export type TMcSettingsCustomViewPermissionDataInput = { oAuthScopes: Array; }; +export type TMcSettingsCustomViewQueryInput = { + limit?: InputMaybe; + offset?: InputMaybe; + sort?: InputMaybe; + where?: InputMaybe; +}; + +export type TMcSettingsCustomViewQueryWhereInput = { + defaultLabel?: InputMaybe; + id?: InputMaybe; + locators?: InputMaybe>; + organizationId?: InputMaybe; + type?: InputMaybe; +}; + export enum TMcSettingsCustomViewSize { Large = 'LARGE', Small = 'SMALL', @@ -419,6 +435,15 @@ export type TMcSettingsCustomViewTypeSettingsInput = { size?: InputMaybe; }; +export type TMcSettingsCustomViewsPagedQueryResult = { + __typename?: 'CustomViewsPagedQueryResult'; + count: Scalars['Int']['output']; + limit: Scalars['Int']['output']; + offset: Scalars['Int']['output']; + results: Array; + total: Scalars['Int']['output']; +}; + export type TMcSettingsCustomersListView = { __typename?: 'CustomersListView'; createdAt: Scalars['DateTime']['output']; @@ -1231,6 +1256,32 @@ export type TMcSettingsMyCustomApplicationQueryWhereInput = { status?: InputMaybe; }; +export type TMcSettingsMyCustomView = { + __typename?: 'MyCustomView'; + createdAt: Scalars['DateTime']['output']; + defaultLabel: Scalars['String']['output']; + description?: Maybe; + id: Scalars['ID']['output']; + labelAllLocales: Array; + locators: Array; + organizationId: Scalars['String']['output']; + organizationName: Scalars['String']['output']; + permissions: Array; + status: TMcSettingsCustomViewStatus; + type: TMcSettingsCustomViewType; + typeSettings?: Maybe; + updatedAt: Scalars['DateTime']['output']; + url: Scalars['String']['output']; +}; + +export type TMcSettingsMyCustomViewsQueryInput = { + where?: InputMaybe; +}; + +export type TMcSettingsMyCustomViewsQueryWhereInput = { + status?: InputMaybe; +}; + export type TMcSettingsNavbarMenu = { __typename?: 'NavbarMenu'; createdAt: Scalars['DateTime']['output']; @@ -1406,9 +1457,18 @@ export type TMcSettingsOrganizationExtensionForCustomApplication = { organizationName?: Maybe; }; +export type TMcSettingsOrganizationExtensionForCustomView = { + __typename?: 'OrganizationExtensionForCustomView'; + customView?: Maybe; + id: Scalars['ID']['output']; + organizationId: Scalars['String']['output']; + organizationName?: Maybe; +}; + export type TMcSettingsPimSearchListView = { __typename?: 'PimSearchListView'; createdAt: Scalars['DateTime']['output']; + expandedRows: Array; filters?: Maybe>; id: Scalars['ID']['output']; isActive?: Maybe; @@ -1422,6 +1482,7 @@ export type TMcSettingsPimSearchListView = { }; export type TMcSettingsPimSearchListViewInput = { + expandedRows?: InputMaybe>; filters: Array; nameAllLocales: Array; search?: InputMaybe; @@ -1554,6 +1615,8 @@ export type TMcSettingsQuery = { allAppliedCustomViewPermissions: Array; /** @deprecated Experimental feature - For internal usage only */ allCustomApplications: TMcSettingsCustomApplicationsPagedQueryResult; + /** @deprecated Experimental feature - For internal usage only */ + allCustomViews: TMcSettingsCustomViewsPagedQueryResult; allCustomViewsInstallationsByLocator: Array; allCustomViewsLocatorGroups: Array; allFeatures: Array; @@ -1582,12 +1645,14 @@ export type TMcSettingsQuery = { /** @deprecated Experimental feature - For internal usage only */ globalOrganizationExtension?: Maybe; myCustomApplications: Array; + myCustomViews: Array; orderDetailView?: Maybe; orderDetailViews: Array>; ordersListView?: Maybe; ordersListViews: Array>; organizationExtension?: Maybe; organizationExtensionForCustomApplication?: Maybe; + organizationExtensionForCustomView?: Maybe; pimSearchListView?: Maybe; pimSearchListViews: Array>; productDiscountsCustomView?: Maybe; @@ -1626,6 +1691,10 @@ export type TMcSettingsQuery_AllCustomApplicationsArgs = { params?: InputMaybe; }; +export type TMcSettingsQuery_AllCustomViewsArgs = { + params?: InputMaybe; +}; + export type TMcSettingsQuery_AllCustomViewsInstallationsByLocatorArgs = { locator: Scalars['String']['input']; }; @@ -1683,6 +1752,10 @@ export type TMcSettingsQuery_MyCustomApplicationsArgs = { params?: InputMaybe; }; +export type TMcSettingsQuery_MyCustomViewsArgs = { + params?: InputMaybe; +}; + export type TMcSettingsQuery_OrderDetailViewArgs = { id: Scalars['ID']['input']; }; @@ -1699,6 +1772,10 @@ export type TMcSettingsQuery_OrganizationExtensionForCustomApplicationArgs = { entryPointUriPath: Scalars['String']['input']; }; +export type TMcSettingsQuery_OrganizationExtensionForCustomViewArgs = { + customViewId: Scalars['String']['input']; +}; + export type TMcSettingsQuery_PimSearchListViewArgs = { id: Scalars['ID']['input']; }; diff --git a/models/commons/README.md b/models/commons/README.md index 6d1e97fac..7ac72ab5e 100644 --- a/models/commons/README.md +++ b/models/commons/README.md @@ -20,6 +20,7 @@ $ pnpm add -D @commercetools-test-data/commons - [Money](#money)
- [Price](#price)
- [Reference](#reference)
+- [PriceTier](#pricetier)
## `Address` @@ -124,3 +125,14 @@ const categoryRef = Reference.presets .category() .build>(); ``` + +## `PriceTier` + +```ts +import { PriceTier, type TPriceTier } from '@commercetools-test-data/commons'; + +const productRef = PriceTier.random().build(); + +// Presets +const categoryRef = PriceTier.presets.build(); +``` diff --git a/models/commons/src/index.ts b/models/commons/src/index.ts index 7a7c0163a..d3745543a 100644 --- a/models/commons/src/index.ts +++ b/models/commons/src/index.ts @@ -8,6 +8,7 @@ export * from './localized-string/types'; export * from './money/types'; export * from './price/types'; export * from './reference/types'; +export * from './price-tier/types'; // Export models export * as Address from './address'; @@ -22,3 +23,5 @@ export * as Money from './money'; export * as Price from './price'; export * as PriceDraft from './price/price-draft'; export * as Reference from './reference'; +export * as PriceTier from './price-tier'; +export * as PriceTierDraft from './price-tier/price-tier-draft'; diff --git a/models/commons/src/key-reference/presets/channel-reference.spec.ts b/models/commons/src/key-reference/presets/channel-reference.spec.ts new file mode 100644 index 000000000..ad636d453 --- /dev/null +++ b/models/commons/src/key-reference/presets/channel-reference.spec.ts @@ -0,0 +1,10 @@ +import type { TKeyReference } from '../types'; +import channelReference from './channel-reference'; + +it('should build channel reference', () => { + const built = channelReference().build(); + expect(built).toEqual({ + key: expect.any(String), + typeId: 'channel', + }); +}); diff --git a/models/commons/src/key-reference/presets/channel-reference.ts b/models/commons/src/key-reference/presets/channel-reference.ts new file mode 100644 index 000000000..d55bd1e3a --- /dev/null +++ b/models/commons/src/key-reference/presets/channel-reference.ts @@ -0,0 +1,6 @@ +import KeyReference from '../builder'; +import type { TKeyReferenceBuilder } from '../types'; + +const channel = (): TKeyReferenceBuilder => KeyReference().typeId('channel'); + +export default channel; diff --git a/models/commons/src/key-reference/presets/index.ts b/models/commons/src/key-reference/presets/index.ts index 400f3afcf..8c3259f80 100644 --- a/models/commons/src/key-reference/presets/index.ts +++ b/models/commons/src/key-reference/presets/index.ts @@ -1,6 +1,7 @@ import associateRole from './associate-role-reference'; import businessUnit from './business-unit-reference'; import category from './category-reference'; +import channel from './channel-reference'; import customerGroup from './customer-group-reference'; import customer from './customer-reference'; import productType from './product-type-reference'; @@ -13,6 +14,7 @@ const presets = { associateRole, businessUnit, category, + channel, customer, customerGroup, productType, diff --git a/models/commons/src/price-tier/builder.spec.ts b/models/commons/src/price-tier/builder.spec.ts new file mode 100644 index 000000000..9c2cc2ce6 --- /dev/null +++ b/models/commons/src/price-tier/builder.spec.ts @@ -0,0 +1,57 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import { TPriceTier, TPriceTierGraphql } from './types'; +import * as PriceTier from '.'; + +describe('builder', () => { + it( + ...createBuilderSpec( + 'default', + PriceTier.random(), + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }) + ) + ); + + it( + ...createBuilderSpec( + 'rest', + PriceTier.random(), + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }) + ) + ); + + it( + ...createBuilderSpec( + 'graphql', + PriceTier.random(), + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + __typename: 'Money', + }), + __typename: 'ProductPriceTier', + }) + ) + ); +}); diff --git a/models/commons/src/price-tier/builder.ts b/models/commons/src/price-tier/builder.ts new file mode 100644 index 000000000..329fe0fbb --- /dev/null +++ b/models/commons/src/price-tier/builder.ts @@ -0,0 +1,12 @@ +import { Builder } from '@commercetools-test-data/core'; +import generator from './generator'; +import transformers from './transformers'; +import type { TPriceTier, TCreatePriceTierBuilder } from './types'; + +const Model: TCreatePriceTierBuilder = () => + Builder({ + generator, + transformers, + }); + +export default Model; diff --git a/models/commons/src/price-tier/generator.ts b/models/commons/src/price-tier/generator.ts new file mode 100644 index 000000000..02965c04f --- /dev/null +++ b/models/commons/src/price-tier/generator.ts @@ -0,0 +1,14 @@ +import { Generator, fake } from '@commercetools-test-data/core'; +import * as CentPrecisionMoney from '../cent-precision-money'; +import { TPriceTier } from './types'; + +// https://docs.commercetools.com/api/types#pricetier + +const generator = Generator({ + fields: { + minimumQuantity: fake((f) => f.number.int()), + value: fake(() => CentPrecisionMoney.random()), + }, +}); + +export default generator; diff --git a/models/commons/src/price-tier/index.ts b/models/commons/src/price-tier/index.ts new file mode 100644 index 000000000..012166617 --- /dev/null +++ b/models/commons/src/price-tier/index.ts @@ -0,0 +1,3 @@ +export { default as random } from './builder'; +export { default as presets } from './presets'; +export * from './types'; diff --git a/models/commons/src/price-tier/presets/index.ts b/models/commons/src/price-tier/presets/index.ts new file mode 100644 index 000000000..763e57fe0 --- /dev/null +++ b/models/commons/src/price-tier/presets/index.ts @@ -0,0 +1,3 @@ +const presets = {}; + +export default presets; diff --git a/models/commons/src/price-tier/price-tier-draft/builder.spec.ts b/models/commons/src/price-tier/price-tier-draft/builder.spec.ts new file mode 100644 index 000000000..308eceea1 --- /dev/null +++ b/models/commons/src/price-tier/price-tier-draft/builder.spec.ts @@ -0,0 +1,56 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import { TPriceTierDraft, TPriceTierDraftGraphql } from '../types'; +import * as PriceTierDraft from '.'; + +describe('builder', () => { + it( + ...createBuilderSpec( + 'default', + PriceTierDraft.random(), + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }) + ) + ); + + it( + ...createBuilderSpec( + 'rest', + PriceTierDraft.random(), + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }) + ) + ); + + it( + ...createBuilderSpec( + 'graphql', + PriceTierDraft.random(), + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + __typename: 'ProductPriceTierInput', + }) + ) + ); +}); diff --git a/models/commons/src/price-tier/price-tier-draft/builder.ts b/models/commons/src/price-tier/price-tier-draft/builder.ts new file mode 100644 index 000000000..b76448eb1 --- /dev/null +++ b/models/commons/src/price-tier/price-tier-draft/builder.ts @@ -0,0 +1,12 @@ +import { Builder } from '@commercetools-test-data/core'; +import generator from './generator'; +import transformers from './transformers'; +import type { TCreatePriceTierDraftBuilder, TPriceTierDraft } from '../types'; + +const Model: TCreatePriceTierDraftBuilder = () => + Builder({ + generator, + transformers, + }); + +export default Model; diff --git a/models/commons/src/price-tier/price-tier-draft/generator.ts b/models/commons/src/price-tier/price-tier-draft/generator.ts new file mode 100644 index 000000000..5d7a9987f --- /dev/null +++ b/models/commons/src/price-tier/price-tier-draft/generator.ts @@ -0,0 +1,14 @@ +import { fake, Generator } from '@commercetools-test-data/core'; +import * as CentPrecisionMoneyDraft from '../../cent-precision-money/cent-precision-money-draft'; +import { TPriceTierDraft } from '../types'; + +// https://docs.commercetools.com/api/types#pricetierdraft + +const generator = Generator({ + fields: { + minimumQuantity: fake((f) => f.number.int()), + value: fake(() => CentPrecisionMoneyDraft.random()), + }, +}); + +export default generator; diff --git a/models/commons/src/price-tier/price-tier-draft/index.ts b/models/commons/src/price-tier/price-tier-draft/index.ts new file mode 100644 index 000000000..96e2519e1 --- /dev/null +++ b/models/commons/src/price-tier/price-tier-draft/index.ts @@ -0,0 +1,2 @@ +export { default as random } from './builder'; +export { default as presets } from './presets'; diff --git a/models/commons/src/price-tier/price-tier-draft/presets/index.ts b/models/commons/src/price-tier/price-tier-draft/presets/index.ts new file mode 100644 index 000000000..763e57fe0 --- /dev/null +++ b/models/commons/src/price-tier/price-tier-draft/presets/index.ts @@ -0,0 +1,3 @@ +const presets = {}; + +export default presets; diff --git a/models/commons/src/price-tier/price-tier-draft/transformers.ts b/models/commons/src/price-tier/price-tier-draft/transformers.ts new file mode 100644 index 000000000..e1e5d5efd --- /dev/null +++ b/models/commons/src/price-tier/price-tier-draft/transformers.ts @@ -0,0 +1,17 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { TPriceTierDraft, TPriceTierDraftGraphql } from '../types'; + +const transformers = { + default: Transformer('default', { + buildFields: ['value'], + }), + rest: Transformer('rest', { + buildFields: ['value'], + }), + graphql: Transformer('graphql', { + buildFields: ['value'], + addFields: () => ({ __typename: 'ProductPriceTierInput' }), + }), +}; + +export default transformers; diff --git a/models/commons/src/price-tier/transformers.ts b/models/commons/src/price-tier/transformers.ts new file mode 100644 index 000000000..6f514eac8 --- /dev/null +++ b/models/commons/src/price-tier/transformers.ts @@ -0,0 +1,19 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { TPriceTier, TPriceTierGraphql } from './types'; + +const transformers = { + default: Transformer('default', { + buildFields: ['value'], + }), + rest: Transformer('rest', { + buildFields: ['value'], + }), + graphql: Transformer('graphql', { + buildFields: ['value'], + addFields: () => ({ + __typename: 'ProductPriceTier', + }), + }), +}; + +export default transformers; diff --git a/models/commons/src/price-tier/types.ts b/models/commons/src/price-tier/types.ts new file mode 100644 index 000000000..9adccca33 --- /dev/null +++ b/models/commons/src/price-tier/types.ts @@ -0,0 +1,17 @@ +import { PriceTier, PriceTierDraft } from '@commercetools/platform-sdk'; +import type { TBuilder } from '@commercetools-test-data/core'; + +export type TPriceTier = PriceTier; +export type TPriceTierDraft = PriceTierDraft; + +export type TPriceTierGraphql = TPriceTier & { + __typename: 'ProductPriceTier'; +}; +export type TPriceTierDraftGraphql = TPriceTierDraft & { + __typename: 'ProductPriceTierInput'; +}; + +export type TPriceTierBuilder = TBuilder; +export type TPriceTierDraftBuilder = TBuilder; +export type TCreatePriceTierBuilder = () => TPriceTierBuilder; +export type TCreatePriceTierDraftBuilder = () => TPriceTierDraftBuilder; diff --git a/models/standalone-price/LICENSE b/models/standalone-price/LICENSE new file mode 100644 index 000000000..e113013cb --- /dev/null +++ b/models/standalone-price/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) commercetools GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/models/standalone-price/README.md b/models/standalone-price/README.md new file mode 100644 index 000000000..6f5cfb32d --- /dev/null +++ b/models/standalone-price/README.md @@ -0,0 +1,25 @@ +# @commercetools-test-data/standalone-price + +This package provides the data model for the commercetools platform `StandalonePrice` type + +https://docs.commercetools.com/api/projects/standalone-prices + +# Install + +```bash +$ yarn add -D @commercetools-test-data/standalone-price +``` + +# Usage + +```ts +import type { + TStandalonePrice, + TStandalonePriceDraft, +} from '@commercetools-test-data/standalone-price'; +import * as StandalonePrice from '@commercetools-test-data/standalone-price'; + +const standalonePrice = StandalonePrice.random().build(); +const standalonePriceDraft = + StandalonePrice.StandalonePriceDraft.random().build(); +``` diff --git a/models/standalone-price/package.json b/models/standalone-price/package.json new file mode 100644 index 000000000..866e882b9 --- /dev/null +++ b/models/standalone-price/package.json @@ -0,0 +1,30 @@ +{ + "name": "@commercetools-test-data/standalone-price", + "version": "6.11.0", + "description": "Data model for commercetools API StandalonePrice", + "bugs": "https://github.com/commercetools/test-data/issues", + "repository": { + "type": "git", + "url": "https://github.com/commercetools/test-data.git", + "directory": "models/standalone-price" + }, + "keywords": ["javascript", "typescript", "test-data"], + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "dist/commercetools-test-data-standalone-price.cjs.js", + "module": "dist/commercetools-test-data-standalone-price.esm.js", + "files": ["dist", "package.json", "LICENSE", "README.md"], + "dependencies": { + "@babel/runtime": "^7.17.9", + "@babel/runtime-corejs3": "^7.17.9", + "@commercetools-test-data/commons": "6.11.0", + "@commercetools-test-data/core": "6.11.0", + "@commercetools-test-data/utils": "6.11.0", + "@commercetools-test-data/customer-group": "6.11.0", + "@commercetools-test-data/channel": "6.11.0", + "@commercetools/platform-sdk": "^7.0.0", + "@faker-js/faker": "^7.4.0" + } +} diff --git a/models/standalone-price/src/builder.spec.ts b/models/standalone-price/src/builder.spec.ts new file mode 100644 index 000000000..fb2398a3e --- /dev/null +++ b/models/standalone-price/src/builder.spec.ts @@ -0,0 +1,171 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import { TStandalonePrice, TStandalonePriceGraphql } from './types'; +import { StandalonePrice } from '.'; + +describe('builder', () => { + it( + ...createBuilderSpec( + 'default', + StandalonePrice.random(), + expect.objectContaining({ + id: expect.any(String), + version: expect.any(Number), + createdAt: expect.any(String), + lastModifiedAt: expect.any(String), + lastModifiedBy: expect.objectContaining({ + anonymousId: expect.any(String), + }), + createdBy: expect.objectContaining({ + anonymousId: expect.any(String), + }), + key: expect.any(String), + sku: expect.any(String), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + country: expect.any(String), + customerGroup: expect.objectContaining({ + id: expect.any(String), + key: expect.any(String), + }), + channel: expect.objectContaining({ + id: expect.any(String), + key: expect.any(String), + }), + validFrom: expect.any(String), + validUntil: expect.any(String), + tiers: expect.arrayContaining([ + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }), + ]), + discounted: null, + staged: null, + active: expect.any(Boolean), + expiresAt: expect.any(String), + }) + ) + ); + + it( + ...createBuilderSpec( + 'rest', + StandalonePrice.random(), + expect.objectContaining({ + id: expect.any(String), + version: expect.any(Number), + createdAt: expect.any(String), + lastModifiedAt: expect.any(String), + lastModifiedBy: expect.objectContaining({ + anonymousId: expect.any(String), + }), + createdBy: expect.objectContaining({ + anonymousId: expect.any(String), + }), + key: expect.any(String), + sku: expect.any(String), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + country: expect.any(String), + customerGroup: expect.objectContaining({ + typeId: 'customer-group', + }), + channel: expect.objectContaining({ + typeId: 'channel', + }), + validFrom: expect.any(String), + validUntil: expect.any(String), + tiers: expect.arrayContaining([ + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }), + ]), + discounted: null, + staged: null, + active: expect.any(Boolean), + }) + ) + ); + + it( + ...createBuilderSpec( + 'graphql', + StandalonePrice.random(), + expect.objectContaining({ + id: expect.any(String), + version: expect.any(Number), + createdAt: expect.any(String), + lastModifiedAt: expect.any(String), + lastModifiedBy: expect.objectContaining({ + anonymousId: expect.any(String), + }), + createdBy: expect.objectContaining({ + anonymousId: expect.any(String), + }), + key: expect.any(String), + sku: expect.any(String), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + country: expect.any(String), + customerGroup: expect.objectContaining({ + id: expect.any(String), + key: expect.any(String), + }), + channel: expect.objectContaining({ + id: expect.any(String), + key: expect.any(String), + }), + customerGroupRef: expect.objectContaining({ + typeId: 'customer-group', + key: expect.any(String), + }), + channelRef: expect.objectContaining({ + typeId: 'channel', + key: expect.any(String), + }), + validFrom: expect.any(String), + validUntil: expect.any(String), + tiers: expect.arrayContaining([ + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }), + ]), + discounted: null, + staged: null, + active: expect.any(Boolean), + __typename: 'StandalonePrice', + }) + ) + ); +}); diff --git a/models/standalone-price/src/builder.ts b/models/standalone-price/src/builder.ts new file mode 100644 index 000000000..38729f02a --- /dev/null +++ b/models/standalone-price/src/builder.ts @@ -0,0 +1,12 @@ +import { Builder } from '@commercetools-test-data/core'; +import generator from './generator'; +import transformers from './transformers'; +import type { TStandalonePrice, TCreateStandalonePriceBuilder } from './types'; + +const Model: TCreateStandalonePriceBuilder = () => + Builder({ + generator, + transformers, + }); + +export default Model; diff --git a/models/standalone-price/src/generator.ts b/models/standalone-price/src/generator.ts new file mode 100644 index 000000000..f1bb5c551 --- /dev/null +++ b/models/standalone-price/src/generator.ts @@ -0,0 +1,40 @@ +import { Channel } from '@commercetools-test-data/channel'; +import { + ClientLogging, + PriceTier, + CentPrecisionMoney, +} from '@commercetools-test-data/commons'; +import { Generator, fake, sequence } from '@commercetools-test-data/core'; +import { CustomerGroup } from '@commercetools-test-data/customer-group'; +import { createRelatedDates } from '@commercetools-test-data/utils'; +import { TStandalonePrice } from './types'; + +// https://docs.commercetools.com/api/projects/standalone-prices#standaloneprice + +const [getCreatedAt, getLastModifiedAt, getExpiresAt] = createRelatedDates(); + +const generator = Generator({ + fields: { + id: fake((f) => f.string.alphanumeric(10)), + version: sequence(), + createdAt: fake(getCreatedAt), + lastModifiedAt: fake(getLastModifiedAt), + lastModifiedBy: fake(() => ClientLogging.random()), + createdBy: fake(() => ClientLogging.random()), + key: fake((f) => f.string.alphanumeric(10)), + sku: fake((f) => `${f.lorem.word()}-${f.string.alphanumeric(3)}`), + value: fake(() => CentPrecisionMoney.random()), + country: fake((f) => f.location.countryCode()), + customerGroup: fake(() => CustomerGroup.random()), + channel: fake(() => Channel.random()), + validFrom: fake(getCreatedAt), + validUntil: fake(getExpiresAt), + tiers: [fake(() => PriceTier.random())], + discounted: null, + staged: null, + active: fake((f) => f.datatype.boolean()), + expiresAt: fake(getExpiresAt), + }, +}); + +export default generator; diff --git a/models/standalone-price/src/index.ts b/models/standalone-price/src/index.ts new file mode 100644 index 000000000..1b5e6c179 --- /dev/null +++ b/models/standalone-price/src/index.ts @@ -0,0 +1,6 @@ +export * as StandalonePriceDraft from './standalone-price-draft'; +export * as StandalonePrice from '.'; + +export { default as random } from './builder'; +export { default as presets } from './presets'; +export * from './types'; diff --git a/models/standalone-price/src/presets/index.ts b/models/standalone-price/src/presets/index.ts new file mode 100644 index 000000000..763e57fe0 --- /dev/null +++ b/models/standalone-price/src/presets/index.ts @@ -0,0 +1,3 @@ +const presets = {}; + +export default presets; diff --git a/models/standalone-price/src/standalone-price-draft/builder.spec.ts b/models/standalone-price/src/standalone-price-draft/builder.spec.ts new file mode 100644 index 000000000..b9f7f0d87 --- /dev/null +++ b/models/standalone-price/src/standalone-price-draft/builder.spec.ts @@ -0,0 +1,128 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import { TStandalonePriceDraft, TStandalonePriceDraftGraphql } from '../types'; +import { StandalonePriceDraft } from '..'; + +describe('builder', () => { + it( + ...createBuilderSpec( + 'default', + StandalonePriceDraft.random(), + expect.objectContaining({ + key: expect.any(String), + sku: expect.any(String), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + country: expect.any(String), + customerGroup: expect.objectContaining({ + typeId: 'customer-group', + }), + channel: expect.objectContaining({ + typeId: 'channel', + }), + validFrom: expect.any(String), + validUntil: expect.any(String), + tiers: expect.arrayContaining([ + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }), + ]), + discounted: null, + staged: null, + active: expect.any(Boolean), + }) + ) + ); + + it( + ...createBuilderSpec( + 'rest', + StandalonePriceDraft.random(), + expect.objectContaining({ + key: expect.any(String), + sku: expect.any(String), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + country: expect.any(String), + customerGroup: expect.objectContaining({ + typeId: 'customer-group', + }), + channel: expect.objectContaining({ + typeId: 'channel', + }), + validFrom: expect.any(String), + validUntil: expect.any(String), + tiers: expect.arrayContaining([ + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }), + ]), + discounted: null, + staged: null, + active: expect.any(Boolean), + }) + ) + ); + + it( + ...createBuilderSpec( + 'graphql', + StandalonePriceDraft.random(), + expect.objectContaining({ + key: expect.any(String), + sku: expect.any(String), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + country: expect.any(String), + customerGroup: expect.objectContaining({ + typeId: 'customer-group', + }), + channel: expect.objectContaining({ + typeId: 'channel', + }), + validFrom: expect.any(String), + validUntil: expect.any(String), + tiers: expect.arrayContaining([ + expect.objectContaining({ + minimumQuantity: expect.any(Number), + value: expect.objectContaining({ + type: 'centPrecision', + currencyCode: expect.any(String), + centAmount: expect.any(Number), + fractionDigits: expect.any(Number), + }), + }), + ]), + discounted: null, + staged: null, + active: expect.any(Boolean), + __typename: 'CreateStandalonePrice', + }) + ) + ); +}); diff --git a/models/standalone-price/src/standalone-price-draft/builder.ts b/models/standalone-price/src/standalone-price-draft/builder.ts new file mode 100644 index 000000000..bd96453c4 --- /dev/null +++ b/models/standalone-price/src/standalone-price-draft/builder.ts @@ -0,0 +1,15 @@ +import { Builder } from '@commercetools-test-data/core'; +import generator from './generator'; +import transformers from './transformers'; +import type { + TCreateStandalonePriceDraftBuilder, + TStandalonePriceDraft, +} from '../types'; + +const Model: TCreateStandalonePriceDraftBuilder = () => + Builder({ + generator, + transformers, + }); + +export default Model; diff --git a/models/standalone-price/src/standalone-price-draft/generator.ts b/models/standalone-price/src/standalone-price-draft/generator.ts new file mode 100644 index 000000000..e0d48e174 --- /dev/null +++ b/models/standalone-price/src/standalone-price-draft/generator.ts @@ -0,0 +1,31 @@ +import { + PriceTierDraft, + KeyReference, + CentPrecisionMoneyDraft, +} from '@commercetools-test-data/commons'; +import { fake, Generator } from '@commercetools-test-data/core'; +import { createRelatedDates } from '@commercetools-test-data/utils'; +import { TStandalonePriceDraft } from '../types'; + +// https://docs.commercetools.com/api/projects/standalone-prices#standalonepricedraft + +const [getValidFrom, getValidUntil] = createRelatedDates(); + +const generator = Generator({ + fields: { + key: fake((f) => f.string.alphanumeric(10)), + sku: fake((f) => `${f.lorem.word()}-${f.string.alphanumeric(3)}`), + value: fake(() => CentPrecisionMoneyDraft.random()), + country: fake((f) => f.location.countryCode()), + customerGroup: fake(() => KeyReference.presets.customerGroup()), + channel: fake(() => KeyReference.presets.channel()), + validFrom: fake(getValidFrom), + validUntil: fake(getValidUntil), + tiers: [fake(() => PriceTierDraft.random())], + discounted: null, + staged: null, + active: fake((f) => f.datatype.boolean()), + }, +}); + +export default generator; diff --git a/models/standalone-price/src/standalone-price-draft/index.ts b/models/standalone-price/src/standalone-price-draft/index.ts new file mode 100644 index 000000000..96e2519e1 --- /dev/null +++ b/models/standalone-price/src/standalone-price-draft/index.ts @@ -0,0 +1,2 @@ +export { default as random } from './builder'; +export { default as presets } from './presets'; diff --git a/models/standalone-price/src/standalone-price-draft/presets/index.ts b/models/standalone-price/src/standalone-price-draft/presets/index.ts new file mode 100644 index 000000000..763e57fe0 --- /dev/null +++ b/models/standalone-price/src/standalone-price-draft/presets/index.ts @@ -0,0 +1,3 @@ +const presets = {}; + +export default presets; diff --git a/models/standalone-price/src/standalone-price-draft/transformers.ts b/models/standalone-price/src/standalone-price-draft/transformers.ts new file mode 100644 index 000000000..d5e25e67f --- /dev/null +++ b/models/standalone-price/src/standalone-price-draft/transformers.ts @@ -0,0 +1,24 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { + TStandalonePriceDraft, + TStandalonePriceDraftGraphql, +} from '../types'; + +const transformers = { + default: Transformer( + 'default', + { buildFields: ['value', 'customerGroup', 'channel', 'tiers'] } + ), + rest: Transformer('rest', { + buildFields: ['value', 'customerGroup', 'channel', 'tiers'], + }), + graphql: Transformer( + 'graphql', + { + buildFields: ['value', 'customerGroup', 'channel', 'tiers'], + addFields: () => ({ __typename: 'CreateStandalonePrice' }), + } + ), +}; + +export default transformers; diff --git a/models/standalone-price/src/transformers.ts b/models/standalone-price/src/transformers.ts new file mode 100644 index 000000000..b013c8719 --- /dev/null +++ b/models/standalone-price/src/transformers.ts @@ -0,0 +1,116 @@ +import { + Reference, + KeyReference, + TReference, + TReferenceGraphql, +} from '@commercetools-test-data/commons'; +import { Transformer } from '@commercetools-test-data/core'; +import { type TCustomerGroup } from '@commercetools-test-data/customer-group'; +import type { + TStandalonePrice, + TStandalonePriceGraphql, + TStandalonePriceRest, +} from './types'; + +// Overloads +function createCustomerGroupReference( + customerGroup: TCustomerGroup, + target: 'rest' +): TReference<'customer-group'>; +function createCustomerGroupReference( + customerGroup: TCustomerGroup, + target: 'graphql' +): TReferenceGraphql<'customer-group'>; + +// Create a customer group reference depending on `id` or `key` field availability +function createCustomerGroupReference( + customerGroup: TCustomerGroup, + target: 'graphql' | 'rest' +) { + let referenceBuilder; + + // `key` is optional in CustomerGroup, prioritize it over `id` + if (customerGroup.key) { + referenceBuilder = KeyReference.random() + .typeId('customer-group') + .key(customerGroup.key); + } else if (customerGroup.id) { + referenceBuilder = Reference.random() + .typeId('customer-group') + .id(customerGroup.id); + } + + // Dynamically call buildRest or buildGraphql based on target + if (referenceBuilder) { + return target === 'rest' + ? referenceBuilder.buildRest>() + : referenceBuilder.buildGraphql>(); + } +} + +const transformers = { + default: Transformer('default', { + buildFields: [ + 'lastModifiedBy', + 'createdBy', + 'value', + 'customerGroup', + 'channel', + 'tiers', + ], + }), + rest: Transformer('rest', { + buildFields: [ + 'lastModifiedBy', + 'createdBy', + 'value', + 'customerGroup', + 'channel', + 'tiers', + ], + replaceFields: ({ fields }) => { + // Remove `expiresAt` from the fields + const { expiresAt, ...rest } = fields; + + const channel = fields.channel + ? KeyReference.random() + .typeId('channel') + .key(fields.channel.key) + .buildRest>() + : undefined; + + return { + ...rest, + customerGroup: fields.customerGroup + ? createCustomerGroupReference(fields.customerGroup, 'rest') + : undefined, + channel, + }; + }, + }), + graphql: Transformer('graphql', { + buildFields: [ + 'lastModifiedBy', + 'createdBy', + 'value', + 'customerGroup', + 'channel', + 'tiers', + ], + addFields: ({ fields }) => { + const customerGroupRef = fields.customerGroup + ? createCustomerGroupReference(fields.customerGroup, 'graphql') + : null; + const channelRef = fields.channel + ? KeyReference.random() + .typeId('channel') + .key(fields.channel.key) + .buildGraphql>() + : null; + + return { __typename: 'StandalonePrice', customerGroupRef, channelRef }; + }, + }), +}; + +export default transformers; diff --git a/models/standalone-price/src/types.ts b/models/standalone-price/src/types.ts new file mode 100644 index 000000000..bc7c210aa --- /dev/null +++ b/models/standalone-price/src/types.ts @@ -0,0 +1,38 @@ +import { + StandalonePrice, + StandalonePriceDraft, + CustomerGroup, + Channel, +} from '@commercetools/platform-sdk'; +import { TReferenceGraphql } from '@commercetools-test-data/commons'; +import type { TBuilder } from '@commercetools-test-data/core'; + +// Base representation +export type TStandalonePrice = Omit< + StandalonePrice, + 'customerGroup' | 'channel' +> & { + customerGroup: CustomerGroup | null; + channel: Channel | null; + expiresAt: string | null; +}; + +// REST representation +export type TStandalonePriceRest = StandalonePrice; +export type TStandalonePriceDraft = StandalonePriceDraft; + +// Graphql representation +export type TStandalonePriceGraphql = TStandalonePrice & { + customerGroupRef: TReferenceGraphql | null; + channelRef: TReferenceGraphql | null; + __typename: 'StandalonePrice'; +}; +export type TStandalonePriceDraftGraphql = StandalonePriceDraft & { + __typename: 'CreateStandalonePrice'; +}; + +export type TStandalonePriceBuilder = TBuilder; +export type TStandalonePriceDraftBuilder = TBuilder; +export type TCreateStandalonePriceBuilder = () => TStandalonePriceBuilder; +export type TCreateStandalonePriceDraftBuilder = + () => TStandalonePriceDraftBuilder; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 659ed16ec..91d59ac3a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -887,6 +887,36 @@ importers: specifier: ^8.0.0 version: 8.0.0 + models/standalone-price: + dependencies: + '@babel/runtime': + specifier: ^7.17.9 + version: 7.23.4 + '@babel/runtime-corejs3': + specifier: ^7.17.9 + version: 7.23.4 + '@commercetools-test-data/channel': + specifier: 6.11.0 + version: link:../channel + '@commercetools-test-data/commons': + specifier: 6.11.0 + version: link:../commons + '@commercetools-test-data/core': + specifier: 6.11.0 + version: link:../../core + '@commercetools-test-data/customer-group': + specifier: 6.11.0 + version: link:../customer-group + '@commercetools-test-data/utils': + specifier: 6.11.0 + version: link:../../utils + '@commercetools/platform-sdk': + specifier: ^7.0.0 + version: 7.0.0 + '@faker-js/faker': + specifier: ^7.4.0 + version: 7.6.0 + models/state: dependencies: '@babel/runtime': @@ -3488,6 +3518,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: false + /@faker-js/faker@7.6.0: + resolution: {integrity: sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==} + engines: {node: '>=14.0.0', npm: '>=6.0.0'} + dev: false + /@faker-js/faker@8.0.0: resolution: {integrity: sha512-XDR8sApuf78GHx8mLXl3KL/q7eB52A963UGejVbdbj3OZtfGlNwp0J78b7apVzqRi0GF8l9g3eSkkaL2UmU9Aw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0, npm: '>=6.14.13'} diff --git a/schemas/settings.json b/schemas/settings.json index f9bb0704c..ae0812f38 100644 --- a/schemas/settings.json +++ b/schemas/settings.json @@ -730,8 +730,8 @@ { "name": "MachineLearning", "description": null, - "isDeprecated": false, - "deprecationReason": null + "isDeprecated": true, + "deprecationReason": "The machine learning APIs are not available anymore." }, { "name": "ProductType", @@ -3703,6 +3703,144 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "INPUT_OBJECT", + "name": "CustomViewQueryInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "limit", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "offset", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sort", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "where", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "CustomViewQueryWhereInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CustomViewQueryWhereInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "defaultLabel", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locators", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organizationId", + "description": null, + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "type": { + "kind": "ENUM", + "name": "CustomViewType", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, { "kind": "ENUM", "name": "CustomViewSize", @@ -3812,6 +3950,105 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "CustomViewsPagedQueryResult", + "description": null, + "fields": [ + { + "name": "count", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "limit", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "offset", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "results", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CustomView", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "total", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "CustomersListView", @@ -10325,7 +10562,7 @@ }, { "kind": "OBJECT", - "name": "NavbarMenu", + "name": "MyCustomView", "description": null, "fields": [ { @@ -10345,19 +10582,7 @@ "deprecationReason": null }, { - "name": "featureToggle", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "icon", + "name": "defaultLabel", "description": null, "args": [], "type": { @@ -10373,15 +10598,324 @@ "deprecationReason": null }, { - "name": "id", + "name": "description", "description": null, "args": [], "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labelAllLocales", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "LocalizedField", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locators", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organizationId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organizationName", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permissions", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CustomViewPermission", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CustomViewStatus", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CustomViewType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "typeSettings", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "CustomViewTypeSettings", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "MyCustomViewsQueryInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "where", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "MyCustomViewsQueryWhereInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "MyCustomViewsQueryWhereInput", + "description": null, + "fields": null, + "inputFields": [ + { + "name": "status", + "description": null, + "type": { + "kind": "ENUM", + "name": "CustomViewStatus", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "NavbarMenu", + "description": null, + "fields": [ + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "featureToggle", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "icon", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", "ofType": null } }, @@ -12111,6 +12645,73 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "OrganizationExtensionForCustomView", + "description": null, + "fields": [ + { + "name": "customView", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "RestrictedCustomViewForOrganization", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organizationId", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organizationName", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "PimSearchListView", @@ -12132,6 +12733,30 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "expandedRows", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "filters", "description": null, @@ -12296,6 +12921,26 @@ "description": null, "fields": null, "inputFields": [ + { + "name": "expandedRows", + "description": null, + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "filters", "description": null, @@ -13864,6 +14509,35 @@ "isDeprecated": true, "deprecationReason": "Experimental feature - For internal usage only" }, + { + "name": "allCustomViews", + "description": null, + "args": [ + { + "name": "params", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "CustomViewQueryInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CustomViewsPagedQueryResult", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "Experimental feature - For internal usage only" + }, { "name": "allCustomViewsInstallationsByLocator", "description": null, @@ -14486,6 +15160,43 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "myCustomViews", + "description": null, + "args": [ + { + "name": "params", + "description": null, + "type": { + "kind": "INPUT_OBJECT", + "name": "MyCustomViewsQueryInput", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MyCustomView", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "orderDetailView", "description": null, @@ -14642,6 +15353,35 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "organizationExtensionForCustomView", + "description": null, + "args": [ + { + "name": "customViewId", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "OBJECT", + "name": "OrganizationExtensionForCustomView", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "pimSearchListView", "description": null,