From 935ebe63f211657f44cecec41c5ec724bbcc762d Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Mon, 2 Oct 2023 11:46:18 +0200 Subject: [PATCH 01/11] feat: add new model for merchant center custom views --- models/custom-view/LICENSE | 21 +++++ models/custom-view/README.md | 23 ++++++ models/custom-view/package.json | 28 +++++++ models/custom-view/src/builder.spec.ts | 64 +++++++++++++++ models/custom-view/src/builder.ts | 12 +++ .../src/custom-view-draft/builder.spec.ts | 54 +++++++++++++ .../src/custom-view-draft/builder.ts | 12 +++ .../src/custom-view-draft/generator.ts | 38 +++++++++ .../src/custom-view-draft/index.ts | 2 + .../src/custom-view-draft/presets/index.ts | 3 + .../src/custom-view-draft/transformers.ts | 9 +++ models/custom-view/src/generator.ts | 38 +++++++++ models/custom-view/src/index.ts | 8 ++ models/custom-view/src/presets/index.ts | 3 + models/custom-view/src/transformers.ts | 40 ++++++++++ models/custom-view/src/types.ts | 80 +++++++++++++++++++ models/custom-view/src/utils.ts | 35 ++++++++ 17 files changed, 470 insertions(+) create mode 100644 models/custom-view/LICENSE create mode 100644 models/custom-view/README.md create mode 100644 models/custom-view/package.json create mode 100644 models/custom-view/src/builder.spec.ts create mode 100644 models/custom-view/src/builder.ts create mode 100644 models/custom-view/src/custom-view-draft/builder.spec.ts create mode 100644 models/custom-view/src/custom-view-draft/builder.ts create mode 100644 models/custom-view/src/custom-view-draft/generator.ts create mode 100644 models/custom-view/src/custom-view-draft/index.ts create mode 100644 models/custom-view/src/custom-view-draft/presets/index.ts create mode 100644 models/custom-view/src/custom-view-draft/transformers.ts create mode 100644 models/custom-view/src/generator.ts create mode 100644 models/custom-view/src/index.ts create mode 100644 models/custom-view/src/presets/index.ts create mode 100644 models/custom-view/src/transformers.ts create mode 100644 models/custom-view/src/types.ts create mode 100644 models/custom-view/src/utils.ts diff --git a/models/custom-view/LICENSE b/models/custom-view/LICENSE new file mode 100644 index 000000000..e113013cb --- /dev/null +++ b/models/custom-view/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/custom-view/README.md b/models/custom-view/README.md new file mode 100644 index 000000000..87958a4d6 --- /dev/null +++ b/models/custom-view/README.md @@ -0,0 +1,23 @@ +# @commercetools-test-data/custom-view + +This package provides the data model for the commercetools internal API `CustomView` type + +# Install + +```bash +$ pnpm add -D @commercetools-test-data/custom-view +``` + +# Usage + +```ts +import { + CustomView, + CustomViewDraft, + type TCustomView, + type TCustomViewDraft, +} from '@commercetools-test-data/custom-view'; + +const customView = CustomView.random().build(); +const customViewDraft = CustomViewDraft.random().build(); +``` diff --git a/models/custom-view/package.json b/models/custom-view/package.json new file mode 100644 index 000000000..fe7211f54 --- /dev/null +++ b/models/custom-view/package.json @@ -0,0 +1,28 @@ +{ + "name": "@commercetools-test-data/custom-view", + "version": "6.0.0", + "description": "Data model for internal commercetools API Custom View", + "bugs": "https://github.com/commercetools/test-data/issues", + "repository": { + "type": "git", + "url": "https://github.com/commercetools/test-data.git", + "directory": "models/custom-view" + }, + "keywords": ["javascript", "typescript", "test-data"], + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "dist/commercetools-test-data-custom-view.cjs.js", + "module": "dist/commercetools-test-data-custom-view.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.0.0", + "@commercetools-test-data/core": "6.0.0", + "@commercetools-test-data/utils": "6.0.0", + "@commercetools/platform-sdk": "^4.11.0", + "@faker-js/faker": "^8.0.0" + } +} diff --git a/models/custom-view/src/builder.spec.ts b/models/custom-view/src/builder.spec.ts new file mode 100644 index 000000000..501c05068 --- /dev/null +++ b/models/custom-view/src/builder.spec.ts @@ -0,0 +1,64 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import type { TCustomView } from './types'; +import * as CustomViewModel from './index'; + +describe('builder', () => { + it( + ...createBuilderSpec( + 'default', + CustomViewModel.random(), + expect.objectContaining({ + id: expect.any(String), + createdAt: expect.any(String), + updatedAt: expect.any(String), + + defaultLabel: expect.any(String), + labelAllLocales: expect.arrayContaining( + expect.objectContaining({ + locale: expect.any(String), + value: expect.any(String), + }) + ), + locators: expect.arrayContaining(expect.any(String)), + ownerId: expect.any(String), + status: expect.stringMatching(/DRAFT|PUBLIC/), + type: expect.stringContaining('CustomPanel'), + typeSettings: expect.objectContaining({ + size: expect.stringMatching(/SMALL|LARGE/), + }), + url: expect.any(String), + }) + ) + ); + + it( + ...createBuilderSpec( + 'graphql', + CustomViewModel.random(), + expect.objectContaining({ + __typename: 'CustomView', + id: expect.any(String), + createdAt: expect.any(String), + updatedAt: expect.any(String), + + defaultLabel: expect.any(String), + labelAllLocales: expect.arrayContaining( + expect.objectContaining({ + locale: expect.any(String), + value: expect.any(String), + }) + ), + locators: expect.arrayContaining(expect.any(String)), + ownerId: expect.any(String), + status: expect.stringMatching(/DRAFT|PUBLIC/), + type: expect.stringContaining('CustomPanel'), + typeSettings: expect.objectContaining({ + size: expect.stringMatching(/SMALL|LARGE/), + }), + url: expect.any(String), + }) + ) + ); +}); diff --git a/models/custom-view/src/builder.ts b/models/custom-view/src/builder.ts new file mode 100644 index 000000000..16a47d112 --- /dev/null +++ b/models/custom-view/src/builder.ts @@ -0,0 +1,12 @@ +import { Builder } from '@commercetools-test-data/core'; +import generator from './generator'; +import transformers from './transformers'; +import type { TCustomView, TCreateCustomViewBuilder } from './types'; + +const Model: TCreateCustomViewBuilder = () => + Builder({ + generator, + transformers, + }); + +export default Model; diff --git a/models/custom-view/src/custom-view-draft/builder.spec.ts b/models/custom-view/src/custom-view-draft/builder.spec.ts new file mode 100644 index 000000000..de48a96a7 --- /dev/null +++ b/models/custom-view/src/custom-view-draft/builder.spec.ts @@ -0,0 +1,54 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import type { CustomViewDraft } from '../types'; +import * as CustomViewDraftModel from './index'; + +describe('builder', () => { + it( + ...createBuilderSpec( + 'default', + CustomViewDraftModel.random(), + expect.objectContaining({ + defaultLabel: expect.any(String), + labelAllLocales: expect.arrayContaining( + expect.objectContaining({ + locale: expect.any(String), + value: expect.any(String), + }) + ), + locators: expect.arrayContaining(expect.any(String)), + ownerId: expect.any(String), + status: expect.stringMatching(/DRAFT|PUBLIC/), + type: expect.stringContaining('CustomPanel'), + typeSettings: expect.objectContaining({ + size: expect.stringMatching(/SMALL|LARGE/), + }), + url: expect.any(String), + }) + ) + ); + it( + ...createBuilderSpec( + 'graphql', + CustomViewDraftModel.random(), + expect.objectContaining({ + defaultLabel: expect.any(String), + labelAllLocales: expect.arrayContaining( + expect.objectContaining({ + locale: expect.any(String), + value: expect.any(String), + }) + ), + locators: expect.arrayContaining(expect.any(String)), + ownerId: expect.any(String), + status: expect.stringMatching(/DRAFT|PUBLIC/), + type: expect.stringContaining('CustomPanel'), + typeSettings: expect.objectContaining({ + size: expect.stringMatching(/SMALL|LARGE/), + }), + url: expect.any(String), + }) + ) + ); +}); diff --git a/models/custom-view/src/custom-view-draft/builder.ts b/models/custom-view/src/custom-view-draft/builder.ts new file mode 100644 index 000000000..48ca53ae5 --- /dev/null +++ b/models/custom-view/src/custom-view-draft/builder.ts @@ -0,0 +1,12 @@ +import { Builder } from '@commercetools-test-data/core'; +import type { TCreateCustomViewDraftBuilder, CustomViewDraft } from '../types'; +import generator from './generator'; +import transformers from './transformers'; + +const ChannelDraft: TCreateCustomViewDraftBuilder = () => + Builder({ + generator, + transformers, + }); + +export default ChannelDraft; diff --git a/models/custom-view/src/custom-view-draft/generator.ts b/models/custom-view/src/custom-view-draft/generator.ts new file mode 100644 index 000000000..4c0f67652 --- /dev/null +++ b/models/custom-view/src/custom-view-draft/generator.ts @@ -0,0 +1,38 @@ +import { LocalizedString } from '@commercetools-test-data/commons'; +import { fake, Generator } from '@commercetools-test-data/core'; +import { CustomViewDraft } from '../types'; +import { defaultLocators } from '../utils'; + +const generator = Generator({ + fields: { + defaultLabel: 'Selling Trend', + labelAllLocales: LocalizedString.presets + .empty() + .en('Selling Trend') + .de('Verkaufstrend'), + locators: fake((f) => + f.helpers.arrayElements(defaultLocators, { + min: 0, + max: defaultLocators.length, + }) + ), + permissions: [ + { + name: 'viewCustomView', + oAuthScopes: ['view_products'], + }, + { + name: 'manageCustomView', + oAuthScopes: ['manage_products'], + }, + ], + status: fake((f) => f.helpers.arrayElement(['DRAFT', 'PUBLIC'])), + type: 'CustomPanel', + typeSettings: { + size: fake((f) => f.helpers.arrayElement(['SMALL', 'LARGE'])), + }, + url: fake((f) => f.internet.url()), + }, +}); + +export default generator; diff --git a/models/custom-view/src/custom-view-draft/index.ts b/models/custom-view/src/custom-view-draft/index.ts new file mode 100644 index 000000000..96e2519e1 --- /dev/null +++ b/models/custom-view/src/custom-view-draft/index.ts @@ -0,0 +1,2 @@ +export { default as random } from './builder'; +export { default as presets } from './presets'; diff --git a/models/custom-view/src/custom-view-draft/presets/index.ts b/models/custom-view/src/custom-view-draft/presets/index.ts new file mode 100644 index 000000000..763e57fe0 --- /dev/null +++ b/models/custom-view/src/custom-view-draft/presets/index.ts @@ -0,0 +1,3 @@ +const presets = {}; + +export default presets; diff --git a/models/custom-view/src/custom-view-draft/transformers.ts b/models/custom-view/src/custom-view-draft/transformers.ts new file mode 100644 index 000000000..9ff5fb69e --- /dev/null +++ b/models/custom-view/src/custom-view-draft/transformers.ts @@ -0,0 +1,9 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { CustomViewDraft } from '../types'; + +const transformers = { + default: Transformer('default', {}), + graphql: Transformer('graphql', {}), +}; + +export default transformers; diff --git a/models/custom-view/src/generator.ts b/models/custom-view/src/generator.ts new file mode 100644 index 000000000..eee28fbb5 --- /dev/null +++ b/models/custom-view/src/generator.ts @@ -0,0 +1,38 @@ +import { LocalizedString } from '@commercetools-test-data/commons'; +import { fake, Generator } from '@commercetools-test-data/core'; +import { createRelatedDates } from '@commercetools-test-data/utils'; +import { CustomView } from './types'; +import { defaultLocators } from './utils'; + +const [getOlderDate, getNewerDate] = createRelatedDates(); + +const generator = Generator({ + fields: { + createdAt: fake(getOlderDate), + defaultLabel: 'Selling Trend', + id: fake((f) => f.string.uuid()), + installedBy: null, + labelAllLocales: LocalizedString.presets + .empty() + .en('Selling Trend') + .de('Verkaufstrend'), + locators: fake((f) => + f.helpers.arrayElements(defaultLocators, { + min: 0, + max: defaultLocators.length, + }) + ), + // owner: null, + ownerId: fake((f) => f.string.uuid()), + permissions: null, + status: fake((f) => f.helpers.arrayElement(['DRAFT', 'PUBLIC'])), + type: 'CustomPanel', + typeSettings: { + size: fake((f) => f.helpers.arrayElement(['SMALL', 'LARGE'])), + }, + updatedAt: fake(getNewerDate), + url: fake((f) => f.internet.url()), + }, +}); + +export default generator; diff --git a/models/custom-view/src/index.ts b/models/custom-view/src/index.ts new file mode 100644 index 000000000..7b8231289 --- /dev/null +++ b/models/custom-view/src/index.ts @@ -0,0 +1,8 @@ +export * as CustomViewDraft from './custom-view-draft'; +export * as CustomView from '.'; + +export { default as random } from './builder'; +export { default as presets } from './presets'; +export { default as draftPresets } from './custom-view-draft/presets'; + +export * from './types'; diff --git a/models/custom-view/src/presets/index.ts b/models/custom-view/src/presets/index.ts new file mode 100644 index 000000000..763e57fe0 --- /dev/null +++ b/models/custom-view/src/presets/index.ts @@ -0,0 +1,3 @@ +const presets = {}; + +export default presets; diff --git a/models/custom-view/src/transformers.ts b/models/custom-view/src/transformers.ts new file mode 100644 index 000000000..f5026392f --- /dev/null +++ b/models/custom-view/src/transformers.ts @@ -0,0 +1,40 @@ +import { LocalizedString } from '@commercetools-test-data/commons'; +import { Transformer } from '@commercetools-test-data/core'; +import type { CustomView } from './types'; +import { formatCustomViewIdToResourceAccessKey } from './utils'; + +const customFieldsGenerator = ({ fields }: { fields: CustomView }) => { + const permissions = [ + { + name: `view${formatCustomViewIdToResourceAccessKey(fields.id)}`, + oAuthScopes: ['view_products'], + }, + { + name: `manage${formatCustomViewIdToResourceAccessKey(fields.id)}`, + oAuthScopes: ['manage_products'], + }, + ]; + const labelAllLocales = + LocalizedString.toLocalizedField(fields.defaultLabel) || []; + + return { + permissions, + labelAllLocales, + }; +}; + +const transformers = { + default: Transformer('default', { + addFields: customFieldsGenerator, + }), + graphql: Transformer('graphql', { + addFields: ({ fields }) => { + return { + ...customFieldsGenerator({ fields }), + __typename: 'CustomView', + }; + }, + }), +}; + +export default transformers; diff --git a/models/custom-view/src/types.ts b/models/custom-view/src/types.ts new file mode 100644 index 000000000..c086652d3 --- /dev/null +++ b/models/custom-view/src/types.ts @@ -0,0 +1,80 @@ +import { TBuilder } from '@commercetools-test-data/core'; + +type LocalizedField = { + id?: string; + locale: string; + value?: string; +}; + +type CustomViewType = 'CustomPanel'; + +type CustomViewSize = 'SMALL' | 'LARGE'; + +type CustomViewStatus = 'DRAFT' | 'PUBLIC'; + +type CustomViewTypeSettings = { + size?: CustomViewSize; +}; + +type CustomViewPermission = { + name: string; + oAuthScopes: string[]; +}; + +export type CustomViewInstallationPermission = { + createdAt: string; + id: string; + name: string; + oAuthScopes: string[]; + updatedAt: string; +}; + +export type CustomViewInstallation = { + acceptedPermissions: CustomViewInstallationPermission[]; + createdAt: string; + id: string; + installInAllProjects: boolean; + // owner: OrganizationExtension; + ownerId: string; + // projects: ProjectExtension[]; + updatedAt: string; +}; + +export type CustomView = { + createdAt: string; + defaultLabel: string; + description?: string; + id: string; + installedBy: CustomViewInstallation[]; + labelAllLocales: LocalizedField[]; + locators: string[]; + // owner: OrganizationExtension; + ownerId: string; + permissions: Array; + status: CustomViewStatus; + type: CustomViewType; + typeSettings?: CustomViewTypeSettings; + updatedAt: string; + url: string; +}; + +export type CustomViewDraft = { + defaultLabel: string; + description?: string; + labelAllLocales: LocalizedField[]; + locators: string[]; + permissions: CustomViewPermission[]; + type: CustomViewType; + typeSettings?: CustomViewTypeSettings; + status: CustomViewStatus; + url: string; +}; + +export type TCustomView = CustomView; +export type TCustomViewDraft = CustomViewDraft; + +export type TCustomViewBuilder = TBuilder; +export type TCreateCustomViewBuilder = () => TCustomViewBuilder; + +export type TCustomViewDraftBuilder = TBuilder; +export type TCreateCustomViewDraftBuilder = () => TCustomViewDraftBuilder; diff --git a/models/custom-view/src/utils.ts b/models/custom-view/src/utils.ts new file mode 100644 index 000000000..193bd4b68 --- /dev/null +++ b/models/custom-view/src/utils.ts @@ -0,0 +1,35 @@ +const upperFirst = (word: string) => word[0].toUpperCase() + word.slice(1); + +export const formatCustomViewIdToResourceAccessKey = ( + entryPointUriPath: string +) => + entryPointUriPath + // Splits the string by underscore. + .split('_') + // Uppercase the first character of each word split. + .map(upperFirst) + // Join the words by an underscore. + .join('_') + // Each word is split by a hyphen. + .split('-') + .map((word, i) => { + // Regex below checking if the character is numeric. + // If the word after the hyphen is numeric, replace the hyphen with a forward slash. + // If not, omit the hyphen and uppercase the first character + if (i > 0 && /^-?\d+$/.test(word[0])) { + return `/${word}`; + } + return upperFirst(word); + }) + .join(''); + +export const defaultLocators = [ + 'products.product_details.general', + 'products.product_variant_details.general', + 'categories.category_details.external_search', + 'customers.customer_addresses.edit_address', + 'orders.order_details.custom_field', + 'standalone_prices.standalone_price_details', + 'discounts.product_discount_details.custom_fields', + 'operations.import_log_details', +]; From d7d9017062a3c42a3c35c54d327d504410f1ea3c Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Mon, 2 Oct 2023 11:53:57 +0200 Subject: [PATCH 02/11] refactor: update dependencies lock file --- pnpm-lock.yaml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8f6bb361..182a1ac77 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -282,6 +282,30 @@ importers: specifier: ^4.17.21 version: 4.17.21 + models/custom-view: + dependencies: + '@babel/runtime': + specifier: ^7.17.9 + version: 7.21.0 + '@babel/runtime-corejs3': + specifier: ^7.17.9 + version: 7.21.0 + '@commercetools-test-data/commons': + specifier: 6.0.0 + version: link:../commons + '@commercetools-test-data/core': + specifier: 6.0.0 + version: link:../../core + '@commercetools-test-data/utils': + specifier: 6.0.0 + version: link:../../utils + '@commercetools/platform-sdk': + specifier: ^4.11.0 + version: 4.11.0 + '@faker-js/faker': + specifier: ^8.0.0 + version: 8.0.0 + models/customer: dependencies: '@babel/runtime': @@ -423,6 +447,30 @@ importers: specifier: ^8.0.0 version: 8.0.0 + models/organization-extension: + dependencies: + '@babel/runtime': + specifier: ^7.17.9 + version: 7.21.0 + '@babel/runtime-corejs3': + specifier: ^7.17.9 + version: 7.21.0 + '@commercetools-test-data/commons': + specifier: 6.0.0 + version: link:../commons + '@commercetools-test-data/core': + specifier: 6.0.0 + version: link:../../core + '@commercetools-test-data/utils': + specifier: 6.0.0 + version: link:../../utils + '@commercetools/platform-sdk': + specifier: ^4.11.0 + version: 4.11.0 + '@faker-js/faker': + specifier: ^8.0.0 + version: 8.0.0 + models/payment: dependencies: '@babel/runtime': From e47d04609d4a2ab614d86dee35ca48559a16ca7a Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Mon, 2 Oct 2023 12:17:23 +0200 Subject: [PATCH 03/11] refactor: improce tests names --- models/custom-view/src/builder.spec.ts | 2 +- models/custom-view/src/custom-view-draft/builder.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/custom-view/src/builder.spec.ts b/models/custom-view/src/builder.spec.ts index 501c05068..4a868653e 100644 --- a/models/custom-view/src/builder.spec.ts +++ b/models/custom-view/src/builder.spec.ts @@ -4,7 +4,7 @@ import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; import type { TCustomView } from './types'; import * as CustomViewModel from './index'; -describe('builder', () => { +describe('CustomView model builder', () => { it( ...createBuilderSpec( 'default', diff --git a/models/custom-view/src/custom-view-draft/builder.spec.ts b/models/custom-view/src/custom-view-draft/builder.spec.ts index de48a96a7..08ee02260 100644 --- a/models/custom-view/src/custom-view-draft/builder.spec.ts +++ b/models/custom-view/src/custom-view-draft/builder.spec.ts @@ -4,7 +4,7 @@ import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; import type { CustomViewDraft } from '../types'; import * as CustomViewDraftModel from './index'; -describe('builder', () => { +describe('CustomViewDraft model builder', () => { it( ...createBuilderSpec( 'default', From 9dcc7d01df2f41a7d4b6e79285c76542d7ac186a Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Fri, 13 Oct 2023 13:05:39 +0200 Subject: [PATCH 04/11] refactor(custom-view): create new internal model for custom views permissions --- models/commons/src/index.ts | 2 + .../src/localized-field/builder.spec.ts | 45 ++++++++++++++++ models/commons/src/localized-field/builder.ts | 12 +++++ .../commons/src/localized-field/generator.ts | 16 ++++++ .../src/localized-field}/index.ts | 0 .../src/localized-field}/presets/index.ts | 0 .../src/localized-field/transformers.ts | 9 ++++ models/commons/src/localized-field/types.ts | 9 ++++ .../src/custom-view-draft/builder.spec.ts | 54 ------------------- .../custom-view-permission/builder.spec.ts | 42 +++++++++++++++ .../src/custom-view-permission/builder.ts | 15 ++++++ .../custom-view-permission-draft/builder.ts | 16 ++++++ .../custom-view-permission-draft/generator.ts | 11 ++++ .../custom-view-permission-draft/index.ts | 2 + .../presets/index.ts | 6 +++ .../presets/manage-permission.ts | 22 ++++++++ .../presets/view-permission.ts | 29 ++++++++++ .../transformers.ts | 15 ++++++ .../src/custom-view-permission/generator.ts | 11 ++++ .../src/custom-view-permission/index.ts | 8 +++ .../custom-view-permission/presets/index.ts | 6 +++ .../presets/manage-permission.ts | 22 ++++++++ .../presets/view-permission.ts | 29 ++++++++++ .../custom-view-permission/transformers.ts | 15 ++++++ .../src/custom-view-permission/types.ts | 19 +++++++ .../custom-view-type-settings/builder.spec.ts | 25 +++++++++ .../src/custom-view-type-settings/builder.ts | 15 ++++++ .../custom-view-type-settings/generator.ts | 8 +++ .../src/custom-view-type-settings/index.ts | 6 +++ .../presets/custom-view-panel.ts | 7 +++ .../presets/index.ts | 5 ++ .../custom-view-type-settings/transformers.ts | 15 ++++++ .../src/custom-view-type-settings/types.ts | 21 ++++++++ .../src/{ => custom-view}/builder.spec.ts | 42 ++++----------- .../src/{ => custom-view}/builder.ts | 0 .../custom-view-draft/builder.spec.ts | 54 +++++++++++++++++++ .../custom-view-draft/builder.ts | 0 .../custom-view-draft/generator.ts | 1 + .../custom-view/custom-view-draft/index.ts | 2 + .../custom-view-draft}/presets/index.ts | 0 .../custom-view-draft/transformers.ts | 0 .../src/{ => custom-view}/generator.ts | 30 ++++++----- .../src/{ => custom-view}/index.ts | 0 .../src/custom-view/presets/index.ts | 3 ++ .../src/custom-view/transformers.ts | 15 ++++++ .../src/{ => custom-view}/types.ts | 5 ++ .../src/{ => custom-view}/utils.ts | 0 models/custom-view/src/transformers.ts | 40 -------------- 48 files changed, 570 insertions(+), 139 deletions(-) create mode 100644 models/commons/src/localized-field/builder.spec.ts create mode 100644 models/commons/src/localized-field/builder.ts create mode 100644 models/commons/src/localized-field/generator.ts rename models/{custom-view/src/custom-view-draft => commons/src/localized-field}/index.ts (100%) rename models/{custom-view/src/custom-view-draft => commons/src/localized-field}/presets/index.ts (100%) create mode 100644 models/commons/src/localized-field/transformers.ts create mode 100644 models/commons/src/localized-field/types.ts delete mode 100644 models/custom-view/src/custom-view-draft/builder.spec.ts create mode 100644 models/custom-view/src/custom-view-permission/builder.spec.ts create mode 100644 models/custom-view/src/custom-view-permission/builder.ts create mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/builder.ts create mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/generator.ts create mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/index.ts create mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/index.ts create mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/manage-permission.ts create mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/view-permission.ts create mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/transformers.ts create mode 100644 models/custom-view/src/custom-view-permission/generator.ts create mode 100644 models/custom-view/src/custom-view-permission/index.ts create mode 100644 models/custom-view/src/custom-view-permission/presets/index.ts create mode 100644 models/custom-view/src/custom-view-permission/presets/manage-permission.ts create mode 100644 models/custom-view/src/custom-view-permission/presets/view-permission.ts create mode 100644 models/custom-view/src/custom-view-permission/transformers.ts create mode 100644 models/custom-view/src/custom-view-permission/types.ts create mode 100644 models/custom-view/src/custom-view-type-settings/builder.spec.ts create mode 100644 models/custom-view/src/custom-view-type-settings/builder.ts create mode 100644 models/custom-view/src/custom-view-type-settings/generator.ts create mode 100644 models/custom-view/src/custom-view-type-settings/index.ts create mode 100644 models/custom-view/src/custom-view-type-settings/presets/custom-view-panel.ts create mode 100644 models/custom-view/src/custom-view-type-settings/presets/index.ts create mode 100644 models/custom-view/src/custom-view-type-settings/transformers.ts create mode 100644 models/custom-view/src/custom-view-type-settings/types.ts rename models/custom-view/src/{ => custom-view}/builder.spec.ts (51%) rename models/custom-view/src/{ => custom-view}/builder.ts (100%) create mode 100644 models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts rename models/custom-view/src/{ => custom-view}/custom-view-draft/builder.ts (100%) rename models/custom-view/src/{ => custom-view}/custom-view-draft/generator.ts (96%) create mode 100644 models/custom-view/src/custom-view/custom-view-draft/index.ts rename models/custom-view/src/{ => custom-view/custom-view-draft}/presets/index.ts (100%) rename models/custom-view/src/{ => custom-view}/custom-view-draft/transformers.ts (100%) rename models/custom-view/src/{ => custom-view}/generator.ts (52%) rename models/custom-view/src/{ => custom-view}/index.ts (100%) create mode 100644 models/custom-view/src/custom-view/presets/index.ts create mode 100644 models/custom-view/src/custom-view/transformers.ts rename models/custom-view/src/{ => custom-view}/types.ts (95%) rename models/custom-view/src/{ => custom-view}/utils.ts (100%) delete mode 100644 models/custom-view/src/transformers.ts diff --git a/models/commons/src/index.ts b/models/commons/src/index.ts index c0a8f6d1a..bdad12be2 100644 --- a/models/commons/src/index.ts +++ b/models/commons/src/index.ts @@ -7,6 +7,7 @@ export * from './localized-string/types'; export * from './money/types'; export * from './price/types'; export * from './reference/types'; +export * from './localized-field/types'; // Export models export * as Address from './address'; @@ -20,3 +21,4 @@ export * as Money from './money'; export * as Price from './price'; export * as PriceDraft from './price/price-draft'; export * as Reference from './reference'; +export * as LocalizedField from './localized-field'; diff --git a/models/commons/src/localized-field/builder.spec.ts b/models/commons/src/localized-field/builder.spec.ts new file mode 100644 index 000000000..173ed39c0 --- /dev/null +++ b/models/commons/src/localized-field/builder.spec.ts @@ -0,0 +1,45 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import type { TLocalizedField } from './types'; +import * as LocalizedField from './index'; + +describe('builder', () => { + it( + ...createBuilderSpec( + 'default', + LocalizedField.random(), + expect.objectContaining({ + locale: expect.any(String), + value: expect.any(String), + }) + ) + ); + it('foo bar', () => { + const data = LocalizedField.random(); + console.log({ data }); + }); + // it( + // ...createBuilderSpec( + // 'graphql', + // LocalizedField.random(), + // expect.arrayContaining([ + // expect.objectContaining({ + // __typename: 'LocalizedString', + // locale: 'de', + // value: expect.any(String), + // }), + // expect.objectContaining({ + // __typename: 'LocalizedString', + // locale: 'en', + // value: expect.any(String), + // }), + // expect.objectContaining({ + // __typename: 'LocalizedString', + // locale: 'fr', + // value: expect.any(String), + // }), + // ]) + // ) + // ); +}); diff --git a/models/commons/src/localized-field/builder.ts b/models/commons/src/localized-field/builder.ts new file mode 100644 index 000000000..baef0683d --- /dev/null +++ b/models/commons/src/localized-field/builder.ts @@ -0,0 +1,12 @@ +import { Builder } from '@commercetools-test-data/core'; +import generator from './generator'; +import transformers from './transformers'; +import type { TCreateLocalizedFieldBuilder, TLocalizedField } from './types'; + +const Model: TCreateLocalizedFieldBuilder = () => + Builder({ + generator, + transformers, + }); + +export default Model; diff --git a/models/commons/src/localized-field/generator.ts b/models/commons/src/localized-field/generator.ts new file mode 100644 index 000000000..3162c601d --- /dev/null +++ b/models/commons/src/localized-field/generator.ts @@ -0,0 +1,16 @@ +import { Generator, fake } from '@commercetools-test-data/core'; +import type { TLocalizedField } from './types'; + +const generator = Generator({ + fields: { + locale: fake((f) => f.helpers.arrayElement(['en', 'de', 'fr', 'es'])), + value: fake((f) => + f.lorem.words({ + min: 1, + max: 4, + }) + ), + }, +}); + +export default generator; diff --git a/models/custom-view/src/custom-view-draft/index.ts b/models/commons/src/localized-field/index.ts similarity index 100% rename from models/custom-view/src/custom-view-draft/index.ts rename to models/commons/src/localized-field/index.ts diff --git a/models/custom-view/src/custom-view-draft/presets/index.ts b/models/commons/src/localized-field/presets/index.ts similarity index 100% rename from models/custom-view/src/custom-view-draft/presets/index.ts rename to models/commons/src/localized-field/presets/index.ts diff --git a/models/commons/src/localized-field/transformers.ts b/models/commons/src/localized-field/transformers.ts new file mode 100644 index 000000000..515620524 --- /dev/null +++ b/models/commons/src/localized-field/transformers.ts @@ -0,0 +1,9 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { TLocalizedField } from './types'; + +const transformers = { + default: Transformer('default', {}), + graphql: Transformer('graphql', {}), +}; + +export default transformers; diff --git a/models/commons/src/localized-field/types.ts b/models/commons/src/localized-field/types.ts new file mode 100644 index 000000000..ec0abd22b --- /dev/null +++ b/models/commons/src/localized-field/types.ts @@ -0,0 +1,9 @@ +import type { TBuilder } from '@commercetools-test-data/core'; + +export type TLocalizedField = { + locale: string; + value: string; +}; + +export type TLocalizedFieldBuilder = TBuilder; +export type TCreateLocalizedFieldBuilder = () => TLocalizedFieldBuilder; diff --git a/models/custom-view/src/custom-view-draft/builder.spec.ts b/models/custom-view/src/custom-view-draft/builder.spec.ts deleted file mode 100644 index 08ee02260..000000000 --- a/models/custom-view/src/custom-view-draft/builder.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* eslint-disable jest/no-disabled-tests */ -/* eslint-disable jest/valid-title */ -import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; -import type { CustomViewDraft } from '../types'; -import * as CustomViewDraftModel from './index'; - -describe('CustomViewDraft model builder', () => { - it( - ...createBuilderSpec( - 'default', - CustomViewDraftModel.random(), - expect.objectContaining({ - defaultLabel: expect.any(String), - labelAllLocales: expect.arrayContaining( - expect.objectContaining({ - locale: expect.any(String), - value: expect.any(String), - }) - ), - locators: expect.arrayContaining(expect.any(String)), - ownerId: expect.any(String), - status: expect.stringMatching(/DRAFT|PUBLIC/), - type: expect.stringContaining('CustomPanel'), - typeSettings: expect.objectContaining({ - size: expect.stringMatching(/SMALL|LARGE/), - }), - url: expect.any(String), - }) - ) - ); - it( - ...createBuilderSpec( - 'graphql', - CustomViewDraftModel.random(), - expect.objectContaining({ - defaultLabel: expect.any(String), - labelAllLocales: expect.arrayContaining( - expect.objectContaining({ - locale: expect.any(String), - value: expect.any(String), - }) - ), - locators: expect.arrayContaining(expect.any(String)), - ownerId: expect.any(String), - status: expect.stringMatching(/DRAFT|PUBLIC/), - type: expect.stringContaining('CustomPanel'), - typeSettings: expect.objectContaining({ - size: expect.stringMatching(/SMALL|LARGE/), - }), - url: expect.any(String), - }) - ) - ); -}); diff --git a/models/custom-view/src/custom-view-permission/builder.spec.ts b/models/custom-view/src/custom-view-permission/builder.spec.ts new file mode 100644 index 000000000..99e65342d --- /dev/null +++ b/models/custom-view/src/custom-view-permission/builder.spec.ts @@ -0,0 +1,42 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import type { TCustomViewPermission } from './types'; +import * as CustomViewPermissionModel from './index'; + +describe('CustomView model builder', () => { + it( + ...createBuilderSpec( + 'default', + CustomViewPermissionModel.random(), + expect.objectContaining({ + name: '', + oAuthScopes: expect.arrayContaining([]), + }) + ) + ); + + it( + ...createBuilderSpec( + 'default', + CustomViewPermissionModel.presets.viewPermission(), + expect.objectContaining({ + name: 'view', + oAuthScopes: expect.arrayContaining([expect.stringMatching(/^view_/)]), + }) + ) + ); + + it( + ...createBuilderSpec( + 'default', + CustomViewPermissionModel.presets.managePermission(), + expect.objectContaining({ + name: 'manage', + oAuthScopes: expect.arrayContaining([ + expect.stringMatching(/^manage_/), + ]), + }) + ) + ); +}); diff --git a/models/custom-view/src/custom-view-permission/builder.ts b/models/custom-view/src/custom-view-permission/builder.ts new file mode 100644 index 000000000..11296ac17 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/builder.ts @@ -0,0 +1,15 @@ +import { Builder } from '@commercetools-test-data/core'; +import generator from './generator'; +import transformers from './transformers'; +import type { + TCustomViewPermission, + TCreateCustomViewPermissionBuilder, +} from './types'; + +const Model: TCreateCustomViewPermissionBuilder = () => + Builder({ + generator, + transformers, + }); + +export default Model; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/builder.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/builder.ts new file mode 100644 index 000000000..468626539 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/builder.ts @@ -0,0 +1,16 @@ +import { Builder } from '@commercetools-test-data/core'; +import type { + TCreateCustomViewPermissionDraftBuilder, + TCustomViewPermissionDraft, +} from '../types'; +import generator from './generator'; +import transformers from './transformers'; + +const CustomViewInstallationDraft: TCreateCustomViewPermissionDraftBuilder = + () => + Builder({ + generator, + transformers, + }); + +export default CustomViewInstallationDraft; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/generator.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/generator.ts new file mode 100644 index 000000000..116c0a2a6 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/generator.ts @@ -0,0 +1,11 @@ +import { Generator } from '@commercetools-test-data/core'; +import { CustomViewPermissionDraft } from '../types'; + +const generator = Generator({ + fields: { + name: null, + oAuthScopes: [], + }, +}); + +export default generator; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/index.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/index.ts new file mode 100644 index 000000000..96e2519e1 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/index.ts @@ -0,0 +1,2 @@ +export { default as random } from './builder'; +export { default as presets } from './presets'; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/index.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/index.ts new file mode 100644 index 000000000..05c389a76 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/index.ts @@ -0,0 +1,6 @@ +import managePermission from './manage-permission'; +import viewPermission from './view-permission'; + +const presets = { viewPermission, managePermission }; + +export default presets; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/manage-permission.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/manage-permission.ts new file mode 100644 index 000000000..944e069e2 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/manage-permission.ts @@ -0,0 +1,22 @@ +import { faker } from '@faker-js/faker'; +import CustomViewPermissionDraft from '../builder'; + +const manageOauthScopes = [ + 'manage_orders', + 'manage_payments', + 'manage_types', + 'manage_discount_codes', + 'manage_business_units', +]; + +const managePermission = () => + CustomViewPermissionDraft() + .name('manage') + .oAuthScopes( + faker.helpers.arrayElements(manageOauthScopes, { + min: 1, + max: 3, + }) + ); + +export default managePermission; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/view-permission.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/view-permission.ts new file mode 100644 index 000000000..2b262a66b --- /dev/null +++ b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/view-permission.ts @@ -0,0 +1,29 @@ +import { faker } from '@faker-js/faker'; +import CustomViewPermission from '../builder'; + +const viewOauthScopes = [ + 'view_products', + 'view_states', + 'view_types', + 'view_customer_groups', + 'view_product_selections', + 'view_orders', + 'view_customers', + 'view_payments', + 'view_discount_codes', + 'view_business_units', + 'view_associate_roles', + 'view_stores', +]; + +const viewPermission = () => + CustomViewPermission() + .name('view') + .oAuthScopes( + faker.helpers.arrayElements(viewOauthScopes, { + min: 1, + max: 3, + }) + ); + +export default viewPermission; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/transformers.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/transformers.ts new file mode 100644 index 000000000..d301fd2db --- /dev/null +++ b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/transformers.ts @@ -0,0 +1,15 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { CustomViewPermissionDraft } from '../types'; + +const transformers = { + default: Transformer( + 'default', + {} + ), + graphql: Transformer( + 'graphql', + {} + ), +}; + +export default transformers; diff --git a/models/custom-view/src/custom-view-permission/generator.ts b/models/custom-view/src/custom-view-permission/generator.ts new file mode 100644 index 000000000..02260f646 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/generator.ts @@ -0,0 +1,11 @@ +import { Generator } from '@commercetools-test-data/core'; +import { CustomViewPermission } from './types'; + +const generator = Generator({ + fields: { + name: '', + oAuthScopes: [], + }, +}); + +export default generator; diff --git a/models/custom-view/src/custom-view-permission/index.ts b/models/custom-view/src/custom-view-permission/index.ts new file mode 100644 index 000000000..bbba4f16d --- /dev/null +++ b/models/custom-view/src/custom-view-permission/index.ts @@ -0,0 +1,8 @@ +export * as CustomViewPermissionDraft from './custom-view-permission-draft'; +export * as CustomViewPermission from '.'; + +export { default as random } from './builder'; +export { default as presets } from './presets'; +export { default as draftPresets } from './custom-view-permission-draft/presets'; + +export * from './types'; diff --git a/models/custom-view/src/custom-view-permission/presets/index.ts b/models/custom-view/src/custom-view-permission/presets/index.ts new file mode 100644 index 000000000..05c389a76 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/presets/index.ts @@ -0,0 +1,6 @@ +import managePermission from './manage-permission'; +import viewPermission from './view-permission'; + +const presets = { viewPermission, managePermission }; + +export default presets; diff --git a/models/custom-view/src/custom-view-permission/presets/manage-permission.ts b/models/custom-view/src/custom-view-permission/presets/manage-permission.ts new file mode 100644 index 000000000..7e3960c8b --- /dev/null +++ b/models/custom-view/src/custom-view-permission/presets/manage-permission.ts @@ -0,0 +1,22 @@ +import { faker } from '@faker-js/faker'; +import CustomViewPermission from '../builder'; + +const manageOauthScopes = [ + 'manage_orders', + 'manage_payments', + 'manage_types', + 'manage_discount_codes', + 'manage_business_units', +]; + +const managePermission = () => + CustomViewPermission() + .name('manage') + .oAuthScopes( + faker.helpers.arrayElements(manageOauthScopes, { + min: 1, + max: 3, + }) + ); + +export default managePermission; diff --git a/models/custom-view/src/custom-view-permission/presets/view-permission.ts b/models/custom-view/src/custom-view-permission/presets/view-permission.ts new file mode 100644 index 000000000..2b262a66b --- /dev/null +++ b/models/custom-view/src/custom-view-permission/presets/view-permission.ts @@ -0,0 +1,29 @@ +import { faker } from '@faker-js/faker'; +import CustomViewPermission from '../builder'; + +const viewOauthScopes = [ + 'view_products', + 'view_states', + 'view_types', + 'view_customer_groups', + 'view_product_selections', + 'view_orders', + 'view_customers', + 'view_payments', + 'view_discount_codes', + 'view_business_units', + 'view_associate_roles', + 'view_stores', +]; + +const viewPermission = () => + CustomViewPermission() + .name('view') + .oAuthScopes( + faker.helpers.arrayElements(viewOauthScopes, { + min: 1, + max: 3, + }) + ); + +export default viewPermission; diff --git a/models/custom-view/src/custom-view-permission/transformers.ts b/models/custom-view/src/custom-view-permission/transformers.ts new file mode 100644 index 000000000..0b779aa53 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/transformers.ts @@ -0,0 +1,15 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { CustomViewPermission } from './types'; + +const transformers = { + default: Transformer( + 'default', + {} + ), + graphql: Transformer( + 'graphql', + {} + ), +}; + +export default transformers; diff --git a/models/custom-view/src/custom-view-permission/types.ts b/models/custom-view/src/custom-view-permission/types.ts new file mode 100644 index 000000000..fb06c8427 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/types.ts @@ -0,0 +1,19 @@ +import { TBuilder } from '@commercetools-test-data/core'; + +export type CustomViewPermission = { + name: string; + oAuthScopes: string[]; +}; + +export type CustomViewPermissionDraft = CustomViewPermission; + +export type TCustomViewPermission = CustomViewPermission; +export type TCustomViewPermissionDraft = CustomViewPermission; + +export type TCustomViewPermissionBuilder = TBuilder; +export type TCreateCustomViewPermissionBuilder = + () => TCustomViewPermissionBuilder; + +export type TCustomViewPermissionDraftBuilder = TBuilder; +export type TCreateCustomViewPermissionDraftBuilder = + () => TCustomViewPermissionDraftBuilder; diff --git a/models/custom-view/src/custom-view-type-settings/builder.spec.ts b/models/custom-view/src/custom-view-type-settings/builder.spec.ts new file mode 100644 index 000000000..32bd7265d --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings/builder.spec.ts @@ -0,0 +1,25 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import type { TCustomViewTypeSettings } from './types'; +import * as CustomViewTypeSettingsModel from './index'; + +describe('CustomView model builder', () => { + it( + ...createBuilderSpec( + 'default', + CustomViewTypeSettingsModel.random(), + expect.objectContaining({}) + ) + ); + + it( + ...createBuilderSpec( + 'default', + CustomViewTypeSettingsModel.presets.customViewPanelSettings('SMALL'), + expect.objectContaining({ + size: 'SMALL', + }) + ) + ); +}); diff --git a/models/custom-view/src/custom-view-type-settings/builder.ts b/models/custom-view/src/custom-view-type-settings/builder.ts new file mode 100644 index 000000000..ee0cd1259 --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings/builder.ts @@ -0,0 +1,15 @@ +import { Builder } from '@commercetools-test-data/core'; +import generator from './generator'; +import transformers from './transformers'; +import type { + TCustomViewTypeSettings, + TCreateCustomViewTypeSettingsBuilder, +} from './types'; + +const Model: TCreateCustomViewTypeSettingsBuilder = () => + Builder({ + generator, + transformers, + }); + +export default Model; diff --git a/models/custom-view/src/custom-view-type-settings/generator.ts b/models/custom-view/src/custom-view-type-settings/generator.ts new file mode 100644 index 000000000..72f4db67b --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings/generator.ts @@ -0,0 +1,8 @@ +import { Generator } from '@commercetools-test-data/core'; +import { CustomViewTypeSettings } from './types'; + +const generator = Generator({ + fields: {}, +}); + +export default generator; diff --git a/models/custom-view/src/custom-view-type-settings/index.ts b/models/custom-view/src/custom-view-type-settings/index.ts new file mode 100644 index 000000000..d40834341 --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings/index.ts @@ -0,0 +1,6 @@ +export * as CustomViewTypeSettings from '.'; + +export { default as random } from './builder'; +export { default as presets } from './presets'; + +export * from './types'; diff --git a/models/custom-view/src/custom-view-type-settings/presets/custom-view-panel.ts b/models/custom-view/src/custom-view-type-settings/presets/custom-view-panel.ts new file mode 100644 index 000000000..76924cdbc --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings/presets/custom-view-panel.ts @@ -0,0 +1,7 @@ +import CustomViewTypeSettings from '../builder'; +import { CustomViewSize } from '../types'; + +const customViewPanel = (size: CustomViewSize) => + CustomViewTypeSettings().size(size); + +export default customViewPanel; diff --git a/models/custom-view/src/custom-view-type-settings/presets/index.ts b/models/custom-view/src/custom-view-type-settings/presets/index.ts new file mode 100644 index 000000000..1cba0fab1 --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings/presets/index.ts @@ -0,0 +1,5 @@ +import customViewPanelSettings from './custom-view-panel'; + +const presets = { customViewPanelSettings }; + +export default presets; diff --git a/models/custom-view/src/custom-view-type-settings/transformers.ts b/models/custom-view/src/custom-view-type-settings/transformers.ts new file mode 100644 index 000000000..c0a96091e --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings/transformers.ts @@ -0,0 +1,15 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { CustomViewTypeSettings } from './types'; + +const transformers = { + default: Transformer( + 'default', + {} + ), + graphql: Transformer( + 'graphql', + {} + ), +}; + +export default transformers; diff --git a/models/custom-view/src/custom-view-type-settings/types.ts b/models/custom-view/src/custom-view-type-settings/types.ts new file mode 100644 index 000000000..23acb1e14 --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings/types.ts @@ -0,0 +1,21 @@ +import { TBuilder } from '@commercetools-test-data/core'; + +export type CustomViewSize = 'SMALL' | 'LARGE'; + +export type CustomViewTypeSettings = { + size?: CustomViewSize; +}; + +export type CustomViewTypeSettingsDraft = CustomViewTypeSettings; + +export type TCustomViewTypeSettings = CustomViewTypeSettings; +export type TCustomViewTypeSettingsDraft = CustomViewTypeSettings; + +export type TCustomViewTypeSettingsBuilder = TBuilder; +export type TCreateCustomViewTypeSettingsBuilder = + () => TCustomViewTypeSettingsBuilder; + +export type TCustomViewTypeSettingsDraftBuilder = + TBuilder; +export type TCreateCustomViewTypeSettingsDraftBuilder = + () => TCustomViewTypeSettingsDraftBuilder; diff --git a/models/custom-view/src/builder.spec.ts b/models/custom-view/src/custom-view/builder.spec.ts similarity index 51% rename from models/custom-view/src/builder.spec.ts rename to models/custom-view/src/custom-view/builder.spec.ts index 4a868653e..d3d12a76f 100644 --- a/models/custom-view/src/builder.spec.ts +++ b/models/custom-view/src/custom-view/builder.spec.ts @@ -13,45 +13,21 @@ describe('CustomView model builder', () => { id: expect.any(String), createdAt: expect.any(String), updatedAt: expect.any(String), - defaultLabel: expect.any(String), - labelAllLocales: expect.arrayContaining( + labelAllLocales: expect.arrayContaining([ expect.objectContaining({ locale: expect.any(String), value: expect.any(String), - }) - ), - locators: expect.arrayContaining(expect.any(String)), + }), + ]), + locators: expect.arrayContaining([expect.any(String)]), ownerId: expect.any(String), - status: expect.stringMatching(/DRAFT|PUBLIC/), - type: expect.stringContaining('CustomPanel'), - typeSettings: expect.objectContaining({ - size: expect.stringMatching(/SMALL|LARGE/), - }), - url: expect.any(String), - }) - ) - ); - - it( - ...createBuilderSpec( - 'graphql', - CustomViewModel.random(), - expect.objectContaining({ - __typename: 'CustomView', - id: expect.any(String), - createdAt: expect.any(String), - updatedAt: expect.any(String), - - defaultLabel: expect.any(String), - labelAllLocales: expect.arrayContaining( + permissions: expect.arrayContaining([ expect.objectContaining({ - locale: expect.any(String), - value: expect.any(String), - }) - ), - locators: expect.arrayContaining(expect.any(String)), - ownerId: expect.any(String), + name: expect.any(String), + oAuthScopes: expect.arrayContaining([expect.any(String)]), + }), + ]), status: expect.stringMatching(/DRAFT|PUBLIC/), type: expect.stringContaining('CustomPanel'), typeSettings: expect.objectContaining({ diff --git a/models/custom-view/src/builder.ts b/models/custom-view/src/custom-view/builder.ts similarity index 100% rename from models/custom-view/src/builder.ts rename to models/custom-view/src/custom-view/builder.ts diff --git a/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts b/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts new file mode 100644 index 000000000..f19e68ab3 --- /dev/null +++ b/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts @@ -0,0 +1,54 @@ +/* eslint-disable jest/no-disabled-tests */ +/* eslint-disable jest/valid-title */ +import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; +import type { CustomViewDraft } from '../types'; +import * as CustomViewDraftModel from './index'; + +describe('CustomViewDraft model builder', () => { + it( + ...createBuilderSpec( + 'default', + CustomViewDraftModel.random(), + expect.objectContaining({ + defaultLabel: expect.any(String), + // labelAllLocales: expect.arrayContaining([ + // expect.objectContaining({ + // locale: expect.any(String), + // value: expect.any(String), + // }) + // ]), + locators: expect.arrayContaining([expect.any(String)]), + ownerId: expect.any(String), + status: expect.stringMatching(/DRAFT|PUBLIC/), + type: expect.stringContaining('CustomPanel'), + typeSettings: expect.objectContaining({ + size: expect.stringMatching(/SMALL|LARGE/), + }), + url: expect.any(String), + }) + ) + ); + // it( + // ...createBuilderSpec( + // 'graphql', + // CustomViewDraftModel.random(), + // expect.objectContaining({ + // defaultLabel: expect.any(String), + // labelAllLocales: expect.arrayContaining( + // expect.objectContaining({ + // locale: expect.any(String), + // value: expect.any(String), + // }) + // ), + // locators: expect.arrayContaining(expect.any(String)), + // ownerId: expect.any(String), + // status: expect.stringMatching(/DRAFT|PUBLIC/), + // type: expect.stringContaining('CustomPanel'), + // typeSettings: expect.objectContaining({ + // size: expect.stringMatching(/SMALL|LARGE/), + // }), + // url: expect.any(String), + // }) + // ) + // ); +}); diff --git a/models/custom-view/src/custom-view-draft/builder.ts b/models/custom-view/src/custom-view/custom-view-draft/builder.ts similarity index 100% rename from models/custom-view/src/custom-view-draft/builder.ts rename to models/custom-view/src/custom-view/custom-view-draft/builder.ts diff --git a/models/custom-view/src/custom-view-draft/generator.ts b/models/custom-view/src/custom-view/custom-view-draft/generator.ts similarity index 96% rename from models/custom-view/src/custom-view-draft/generator.ts rename to models/custom-view/src/custom-view/custom-view-draft/generator.ts index 4c0f67652..496ff80e0 100644 --- a/models/custom-view/src/custom-view-draft/generator.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/generator.ts @@ -16,6 +16,7 @@ const generator = Generator({ max: defaultLocators.length, }) ), + ownerId: fake((f) => f.string.uuid()), permissions: [ { name: 'viewCustomView', diff --git a/models/custom-view/src/custom-view/custom-view-draft/index.ts b/models/custom-view/src/custom-view/custom-view-draft/index.ts new file mode 100644 index 000000000..96e2519e1 --- /dev/null +++ b/models/custom-view/src/custom-view/custom-view-draft/index.ts @@ -0,0 +1,2 @@ +export { default as random } from './builder'; +export { default as presets } from './presets'; diff --git a/models/custom-view/src/presets/index.ts b/models/custom-view/src/custom-view/custom-view-draft/presets/index.ts similarity index 100% rename from models/custom-view/src/presets/index.ts rename to models/custom-view/src/custom-view/custom-view-draft/presets/index.ts diff --git a/models/custom-view/src/custom-view-draft/transformers.ts b/models/custom-view/src/custom-view/custom-view-draft/transformers.ts similarity index 100% rename from models/custom-view/src/custom-view-draft/transformers.ts rename to models/custom-view/src/custom-view/custom-view-draft/transformers.ts diff --git a/models/custom-view/src/generator.ts b/models/custom-view/src/custom-view/generator.ts similarity index 52% rename from models/custom-view/src/generator.ts rename to models/custom-view/src/custom-view/generator.ts index eee28fbb5..8ce2c57f2 100644 --- a/models/custom-view/src/generator.ts +++ b/models/custom-view/src/custom-view/generator.ts @@ -1,6 +1,8 @@ -import { LocalizedString } from '@commercetools-test-data/commons'; +import { LocalizedField } from '@commercetools-test-data/commons'; import { fake, Generator } from '@commercetools-test-data/core'; import { createRelatedDates } from '@commercetools-test-data/utils'; +import { CustomViewPermission } from '../custom-view-permission'; +import { CustomViewTypeSettings } from '../custom-view-type-settings'; import { CustomView } from './types'; import { defaultLocators } from './utils'; @@ -9,27 +11,31 @@ const [getOlderDate, getNewerDate] = createRelatedDates(); const generator = Generator({ fields: { createdAt: fake(getOlderDate), - defaultLabel: 'Selling Trend', + defaultLabel: fake((f) => f.commerce.department()), id: fake((f) => f.string.uuid()), - installedBy: null, - labelAllLocales: LocalizedString.presets - .empty() - .en('Selling Trend') - .de('Verkaufstrend'), + installedBy: null, // buildField + labelAllLocales: [ + LocalizedField.random().build(), + LocalizedField.random().build(), + ], locators: fake((f) => f.helpers.arrayElements(defaultLocators, { min: 0, max: defaultLocators.length, }) ), - // owner: null, ownerId: fake((f) => f.string.uuid()), - permissions: null, + permissions: [ + CustomViewPermission.presets.viewPermission().build(), + CustomViewPermission.presets.viewPermission().build(), + ], status: fake((f) => f.helpers.arrayElement(['DRAFT', 'PUBLIC'])), type: 'CustomPanel', - typeSettings: { - size: fake((f) => f.helpers.arrayElement(['SMALL', 'LARGE'])), - }, + typeSettings: fake((f) => + CustomViewTypeSettings.presets + .customViewPanelSettings(f.helpers.arrayElement(['SMALL', 'LARGE'])) + .build() + ), updatedAt: fake(getNewerDate), url: fake((f) => f.internet.url()), }, diff --git a/models/custom-view/src/index.ts b/models/custom-view/src/custom-view/index.ts similarity index 100% rename from models/custom-view/src/index.ts rename to models/custom-view/src/custom-view/index.ts diff --git a/models/custom-view/src/custom-view/presets/index.ts b/models/custom-view/src/custom-view/presets/index.ts new file mode 100644 index 000000000..763e57fe0 --- /dev/null +++ b/models/custom-view/src/custom-view/presets/index.ts @@ -0,0 +1,3 @@ +const presets = {}; + +export default presets; diff --git a/models/custom-view/src/custom-view/transformers.ts b/models/custom-view/src/custom-view/transformers.ts new file mode 100644 index 000000000..005aff320 --- /dev/null +++ b/models/custom-view/src/custom-view/transformers.ts @@ -0,0 +1,15 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { CustomView, CustomViewGraphql } from './types'; + +const transformers = { + default: Transformer('default', {}), + graphql: Transformer('graphql', { + addFields: () => { + return { + __typename: 'CustomView', + }; + }, + }), +}; + +export default transformers; diff --git a/models/custom-view/src/types.ts b/models/custom-view/src/custom-view/types.ts similarity index 95% rename from models/custom-view/src/types.ts rename to models/custom-view/src/custom-view/types.ts index c086652d3..e27cc5b7d 100644 --- a/models/custom-view/src/types.ts +++ b/models/custom-view/src/custom-view/types.ts @@ -58,11 +58,16 @@ export type CustomView = { url: string; }; +export type CustomViewGraphql = CustomView & { + __typename: 'CustomView'; +}; + export type CustomViewDraft = { defaultLabel: string; description?: string; labelAllLocales: LocalizedField[]; locators: string[]; + ownerId: string; permissions: CustomViewPermission[]; type: CustomViewType; typeSettings?: CustomViewTypeSettings; diff --git a/models/custom-view/src/utils.ts b/models/custom-view/src/custom-view/utils.ts similarity index 100% rename from models/custom-view/src/utils.ts rename to models/custom-view/src/custom-view/utils.ts diff --git a/models/custom-view/src/transformers.ts b/models/custom-view/src/transformers.ts deleted file mode 100644 index f5026392f..000000000 --- a/models/custom-view/src/transformers.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { LocalizedString } from '@commercetools-test-data/commons'; -import { Transformer } from '@commercetools-test-data/core'; -import type { CustomView } from './types'; -import { formatCustomViewIdToResourceAccessKey } from './utils'; - -const customFieldsGenerator = ({ fields }: { fields: CustomView }) => { - const permissions = [ - { - name: `view${formatCustomViewIdToResourceAccessKey(fields.id)}`, - oAuthScopes: ['view_products'], - }, - { - name: `manage${formatCustomViewIdToResourceAccessKey(fields.id)}`, - oAuthScopes: ['manage_products'], - }, - ]; - const labelAllLocales = - LocalizedString.toLocalizedField(fields.defaultLabel) || []; - - return { - permissions, - labelAllLocales, - }; -}; - -const transformers = { - default: Transformer('default', { - addFields: customFieldsGenerator, - }), - graphql: Transformer('graphql', { - addFields: ({ fields }) => { - return { - ...customFieldsGenerator({ fields }), - __typename: 'CustomView', - }; - }, - }), -}; - -export default transformers; From d1469115b1c3fec34831351912aea1f04d629f15 Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Fri, 13 Oct 2023 13:25:01 +0200 Subject: [PATCH 05/11] refactor(custom-view): refactor draft model --- .../custom-view-draft/builder.spec.ts | 41 ++++++------------- .../custom-view-draft/generator.ts | 30 +++++++------- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts b/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts index f19e68ab3..c35678a0c 100644 --- a/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts @@ -11,14 +11,20 @@ describe('CustomViewDraft model builder', () => { CustomViewDraftModel.random(), expect.objectContaining({ defaultLabel: expect.any(String), - // labelAllLocales: expect.arrayContaining([ - // expect.objectContaining({ - // locale: expect.any(String), - // value: expect.any(String), - // }) - // ]), + labelAllLocales: expect.arrayContaining([ + expect.objectContaining({ + locale: expect.any(String), + value: expect.any(String), + }), + ]), locators: expect.arrayContaining([expect.any(String)]), ownerId: expect.any(String), + permissions: expect.arrayContaining([ + expect.objectContaining({ + name: expect.any(String), + oAuthScopes: expect.arrayContaining([expect.any(String)]), + }), + ]), status: expect.stringMatching(/DRAFT|PUBLIC/), type: expect.stringContaining('CustomPanel'), typeSettings: expect.objectContaining({ @@ -28,27 +34,4 @@ describe('CustomViewDraft model builder', () => { }) ) ); - // it( - // ...createBuilderSpec( - // 'graphql', - // CustomViewDraftModel.random(), - // expect.objectContaining({ - // defaultLabel: expect.any(String), - // labelAllLocales: expect.arrayContaining( - // expect.objectContaining({ - // locale: expect.any(String), - // value: expect.any(String), - // }) - // ), - // locators: expect.arrayContaining(expect.any(String)), - // ownerId: expect.any(String), - // status: expect.stringMatching(/DRAFT|PUBLIC/), - // type: expect.stringContaining('CustomPanel'), - // typeSettings: expect.objectContaining({ - // size: expect.stringMatching(/SMALL|LARGE/), - // }), - // url: expect.any(String), - // }) - // ) - // ); }); diff --git a/models/custom-view/src/custom-view/custom-view-draft/generator.ts b/models/custom-view/src/custom-view/custom-view-draft/generator.ts index 496ff80e0..972ca64b3 100644 --- a/models/custom-view/src/custom-view/custom-view-draft/generator.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/generator.ts @@ -1,15 +1,17 @@ -import { LocalizedString } from '@commercetools-test-data/commons'; +import { LocalizedField } from '@commercetools-test-data/commons'; import { fake, Generator } from '@commercetools-test-data/core'; +import { CustomViewPermission } from '../../custom-view-permission'; +import { CustomViewTypeSettings } from '../../custom-view-type-settings'; import { CustomViewDraft } from '../types'; import { defaultLocators } from '../utils'; const generator = Generator({ fields: { defaultLabel: 'Selling Trend', - labelAllLocales: LocalizedString.presets - .empty() - .en('Selling Trend') - .de('Verkaufstrend'), + labelAllLocales: [ + LocalizedField.random().build(), + LocalizedField.random().build(), + ], locators: fake((f) => f.helpers.arrayElements(defaultLocators, { min: 0, @@ -18,20 +20,16 @@ const generator = Generator({ ), ownerId: fake((f) => f.string.uuid()), permissions: [ - { - name: 'viewCustomView', - oAuthScopes: ['view_products'], - }, - { - name: 'manageCustomView', - oAuthScopes: ['manage_products'], - }, + CustomViewPermission.presets.viewPermission().build(), + CustomViewPermission.presets.viewPermission().build(), ], status: fake((f) => f.helpers.arrayElement(['DRAFT', 'PUBLIC'])), type: 'CustomPanel', - typeSettings: { - size: fake((f) => f.helpers.arrayElement(['SMALL', 'LARGE'])), - }, + typeSettings: fake((f) => + CustomViewTypeSettings.presets + .customViewPanelSettings(f.helpers.arrayElement(['SMALL', 'LARGE'])) + .build() + ), url: fake((f) => f.internet.url()), }, }); From 75826065111c1e40ba021122241cd584c1e3361a Mon Sep 17 00:00:00 2001 From: Nicola Molinari Date: Wed, 18 Oct 2023 12:20:39 +0200 Subject: [PATCH 06/11] fix(custom-views): models setup and tests --- models/commons/src/index.ts | 4 +- .../src/localized-field/builder.spec.ts | 43 +- .../commons/src/localized-field/generator.ts | 2 +- .../src/localized-field/transformers.ts | 8 +- models/commons/src/localized-field/types.ts | 3 + models/custom-view/package.json | 16 +- .../custom-view-permission/builder.spec.ts | 23 +- .../src/custom-view-permission/constants.ts | 54 ++ .../custom-view-permission-draft/builder.ts | 16 - .../custom-view-permission-draft/generator.ts | 11 - .../custom-view-permission-draft/index.ts | 2 - .../presets/index.ts | 6 - .../presets/manage-permission.ts | 22 - .../presets/view-permission.ts | 29 - .../transformers.ts | 15 - .../src/custom-view-permission/generator.ts | 10 +- .../src/custom-view-permission/index.ts | 7 +- .../custom-view-permission/presets/index.ts | 8 +- .../presets/manage-only-permissions.ts | 26 + .../presets/manage-permission.ts | 22 - .../presets/presets.spec.ts | 26 + .../presets/view-only-permissions.ts | 24 + .../presets/view-permission.ts | 29 - .../custom-view-permission/transformers.ts | 15 +- .../src/custom-view-permission/types.ts | 16 +- .../custom-view-type-settings/builder.spec.ts | 25 +- .../custom-view-type-settings/generator.ts | 11 +- .../src/custom-view-type-settings/index.ts | 3 - .../presets/custom-view-panel.ts | 7 - .../presets/index.ts | 4 +- .../custom-view-type-settings/transformers.ts | 15 +- .../src/custom-view-type-settings/types.ts | 14 +- .../src/custom-view/builder.spec.ts | 49 +- .../custom-view-draft/builder.spec.ts | 49 +- .../custom-view/custom-view-draft/builder.ts | 4 +- .../custom-view-draft/generator.ts | 39 +- .../custom-view-draft/transformers.ts | 13 +- .../custom-view/src/custom-view/generator.ts | 43 +- models/custom-view/src/custom-view/index.ts | 3 - .../src/custom-view/transformers.ts | 17 +- models/custom-view/src/custom-view/types.ts | 46 +- models/custom-view/src/index.ts | 6 + pnpm-lock.yaml | 731 +++++++++++++++--- 43 files changed, 1053 insertions(+), 463 deletions(-) create mode 100644 models/custom-view/src/custom-view-permission/constants.ts delete mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/builder.ts delete mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/generator.ts delete mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/index.ts delete mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/index.ts delete mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/manage-permission.ts delete mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/view-permission.ts delete mode 100644 models/custom-view/src/custom-view-permission/custom-view-permission-draft/transformers.ts create mode 100644 models/custom-view/src/custom-view-permission/presets/manage-only-permissions.ts delete mode 100644 models/custom-view/src/custom-view-permission/presets/manage-permission.ts create mode 100644 models/custom-view/src/custom-view-permission/presets/presets.spec.ts create mode 100644 models/custom-view/src/custom-view-permission/presets/view-only-permissions.ts delete mode 100644 models/custom-view/src/custom-view-permission/presets/view-permission.ts delete mode 100644 models/custom-view/src/custom-view-type-settings/presets/custom-view-panel.ts create mode 100644 models/custom-view/src/index.ts diff --git a/models/commons/src/index.ts b/models/commons/src/index.ts index bdad12be2..7a7c0163a 100644 --- a/models/commons/src/index.ts +++ b/models/commons/src/index.ts @@ -3,11 +3,11 @@ export * from './address/types'; export * from './cent-precision-money/types'; export * from './client-logging/types'; export * from './key-reference/types'; +export * from './localized-field/types'; export * from './localized-string/types'; export * from './money/types'; export * from './price/types'; export * from './reference/types'; -export * from './localized-field/types'; // Export models export * as Address from './address'; @@ -16,9 +16,9 @@ export * as CentPrecisionMoney from './cent-precision-money'; export * as CentPrecisionMoneyDraft from './cent-precision-money/cent-precision-money-draft'; export * as ClientLogging from './client-logging'; export * as KeyReference from './key-reference'; +export * as LocalizedField from './localized-field'; export * as LocalizedString from './localized-string'; export * as Money from './money'; export * as Price from './price'; export * as PriceDraft from './price/price-draft'; export * as Reference from './reference'; -export * as LocalizedField from './localized-field'; diff --git a/models/commons/src/localized-field/builder.spec.ts b/models/commons/src/localized-field/builder.spec.ts index 173ed39c0..00fe3c8ab 100644 --- a/models/commons/src/localized-field/builder.spec.ts +++ b/models/commons/src/localized-field/builder.spec.ts @@ -1,7 +1,7 @@ /* eslint-disable jest/no-disabled-tests */ /* eslint-disable jest/valid-title */ import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; -import type { TLocalizedField } from './types'; +import type { TLocalizedField, TLocalizedFieldGraphql } from './types'; import * as LocalizedField from './index'; describe('builder', () => { @@ -10,36 +10,21 @@ describe('builder', () => { 'default', LocalizedField.random(), expect.objectContaining({ - locale: expect.any(String), + locale: expect.stringMatching(/^(de|en|es)$/), + value: expect.any(String), + }) + ) + ); + + it( + ...createBuilderSpec( + 'graphql', + LocalizedField.random(), + expect.objectContaining({ + __typename: 'LocalizedField', + locale: expect.stringMatching(/^(de|en|es)$/), value: expect.any(String), }) ) ); - it('foo bar', () => { - const data = LocalizedField.random(); - console.log({ data }); - }); - // it( - // ...createBuilderSpec( - // 'graphql', - // LocalizedField.random(), - // expect.arrayContaining([ - // expect.objectContaining({ - // __typename: 'LocalizedString', - // locale: 'de', - // value: expect.any(String), - // }), - // expect.objectContaining({ - // __typename: 'LocalizedString', - // locale: 'en', - // value: expect.any(String), - // }), - // expect.objectContaining({ - // __typename: 'LocalizedString', - // locale: 'fr', - // value: expect.any(String), - // }), - // ]) - // ) - // ); }); diff --git a/models/commons/src/localized-field/generator.ts b/models/commons/src/localized-field/generator.ts index 3162c601d..78e7b5930 100644 --- a/models/commons/src/localized-field/generator.ts +++ b/models/commons/src/localized-field/generator.ts @@ -3,7 +3,7 @@ import type { TLocalizedField } from './types'; const generator = Generator({ fields: { - locale: fake((f) => f.helpers.arrayElement(['en', 'de', 'fr', 'es'])), + locale: fake((f) => f.helpers.arrayElement(['en', 'de', 'es'])), value: fake((f) => f.lorem.words({ min: 1, diff --git a/models/commons/src/localized-field/transformers.ts b/models/commons/src/localized-field/transformers.ts index 515620524..9b72bf2d0 100644 --- a/models/commons/src/localized-field/transformers.ts +++ b/models/commons/src/localized-field/transformers.ts @@ -1,9 +1,13 @@ import { Transformer } from '@commercetools-test-data/core'; -import type { TLocalizedField } from './types'; +import type { TLocalizedField, TLocalizedFieldGraphql } from './types'; const transformers = { default: Transformer('default', {}), - graphql: Transformer('graphql', {}), + graphql: Transformer('graphql', { + addFields: () => ({ + __typename: 'LocalizedField', + }), + }), }; export default transformers; diff --git a/models/commons/src/localized-field/types.ts b/models/commons/src/localized-field/types.ts index ec0abd22b..e2b5a211b 100644 --- a/models/commons/src/localized-field/types.ts +++ b/models/commons/src/localized-field/types.ts @@ -4,6 +4,9 @@ export type TLocalizedField = { locale: string; value: string; }; +export type TLocalizedFieldGraphql = TLocalizedField & { + __typename: 'LocalizedField'; +}; export type TLocalizedFieldBuilder = TBuilder; export type TCreateLocalizedFieldBuilder = () => TLocalizedFieldBuilder; diff --git a/models/custom-view/package.json b/models/custom-view/package.json index fe7211f54..60054e560 100644 --- a/models/custom-view/package.json +++ b/models/custom-view/package.json @@ -1,7 +1,7 @@ { "name": "@commercetools-test-data/custom-view", "version": "6.0.0", - "description": "Data model for internal commercetools API Custom View", + "description": "Data model for internal Merchan Center API Custom View", "bugs": "https://github.com/commercetools/test-data/issues", "repository": { "type": "git", @@ -19,10 +19,14 @@ "dependencies": { "@babel/runtime": "^7.17.9", "@babel/runtime-corejs3": "^7.17.9", - "@commercetools-test-data/commons": "6.0.0", - "@commercetools-test-data/core": "6.0.0", - "@commercetools-test-data/utils": "6.0.0", - "@commercetools/platform-sdk": "^4.11.0", - "@faker-js/faker": "^8.0.0" + "@commercetools-frontend/application-config": "^22.9.1", + "@commercetools-frontend/constants": "^22.9.1", + "@commercetools-test-data/commons": "6.3.8", + "@commercetools-test-data/core": "6.3.8", + "@commercetools-test-data/utils": "6.3.8", + "@commercetools/platform-sdk": "^6.0.0", + "@faker-js/faker": "^8.0.0", + "@types/lodash": "^4.14.182", + "lodash": "^4.17.21" } } diff --git a/models/custom-view/src/custom-view-permission/builder.spec.ts b/models/custom-view/src/custom-view-permission/builder.spec.ts index 99e65342d..a3ee7c01e 100644 --- a/models/custom-view/src/custom-view-permission/builder.spec.ts +++ b/models/custom-view/src/custom-view-permission/builder.spec.ts @@ -1,7 +1,10 @@ /* eslint-disable jest/no-disabled-tests */ /* eslint-disable jest/valid-title */ import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; -import type { TCustomViewPermission } from './types'; +import type { + TCustomViewPermission, + TCustomViewPermissionGraphql, +} from './types'; import * as CustomViewPermissionModel from './index'; describe('CustomView model builder', () => { @@ -10,17 +13,18 @@ describe('CustomView model builder', () => { 'default', CustomViewPermissionModel.random(), expect.objectContaining({ - name: '', - oAuthScopes: expect.arrayContaining([]), + name: 'view', + oAuthScopes: expect.arrayContaining([expect.stringMatching(/^view_/)]), }) ) ); it( - ...createBuilderSpec( - 'default', - CustomViewPermissionModel.presets.viewPermission(), + ...createBuilderSpec( + 'graphql', + CustomViewPermissionModel.presets.ViewOnlyPermissions(), expect.objectContaining({ + __typename: 'CustomViewPermission', name: 'view', oAuthScopes: expect.arrayContaining([expect.stringMatching(/^view_/)]), }) @@ -28,10 +32,11 @@ describe('CustomView model builder', () => { ); it( - ...createBuilderSpec( - 'default', - CustomViewPermissionModel.presets.managePermission(), + ...createBuilderSpec( + 'graphql', + CustomViewPermissionModel.presets.ManageOnlyPermissions(), expect.objectContaining({ + __typename: 'CustomViewPermission', name: 'manage', oAuthScopes: expect.arrayContaining([ expect.stringMatching(/^manage_/), diff --git a/models/custom-view/src/custom-view-permission/constants.ts b/models/custom-view/src/custom-view-permission/constants.ts new file mode 100644 index 000000000..7bc7d451b --- /dev/null +++ b/models/custom-view/src/custom-view-permission/constants.ts @@ -0,0 +1,54 @@ +export const supportedViewOAuthScopes = [ + 'view_api_clients', + 'view_audit_log', + 'view_cart_discounts', + 'view_categories', + 'view_customer_groups', + 'view_customers', + 'view_discount_codes', + 'view_import_containers', + 'view_key_value_documents', + 'view_messages', + 'view_order_edits', + 'view_orders', + 'view_payments', + 'view_products', + 'view_project_settings', + 'view_published_products', + 'view_shipping_methods', + 'view_shopping_lists', + 'view_states', + 'view_stores', + 'view_tax_categories', + 'view_types', +]; + +export const supportedManageOAuthScopes = [ + 'manage_api_clients', + 'manage_audit_log', + 'manage_cart_discounts', + 'manage_categories', + 'manage_customer_groups', + 'manage_customers', + 'manage_discount_codes', + 'manage_extensions', + 'manage_import_containers', + 'manage_key_value_documents', + 'manage_order_edits', + 'manage_orders', + 'manage_payments', + 'manage_products', + 'manage_project_settings', + 'manage_shipping_methods', + 'manage_shopping_lists', + 'manage_states', + 'manage_stores', + 'manage_subscriptions', + 'manage_tax_categories', + 'manage_types', +]; + +export const supportedOAuthScopes = [ + ...supportedViewOAuthScopes, + ...supportedManageOAuthScopes, +]; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/builder.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/builder.ts deleted file mode 100644 index 468626539..000000000 --- a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/builder.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Builder } from '@commercetools-test-data/core'; -import type { - TCreateCustomViewPermissionDraftBuilder, - TCustomViewPermissionDraft, -} from '../types'; -import generator from './generator'; -import transformers from './transformers'; - -const CustomViewInstallationDraft: TCreateCustomViewPermissionDraftBuilder = - () => - Builder({ - generator, - transformers, - }); - -export default CustomViewInstallationDraft; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/generator.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/generator.ts deleted file mode 100644 index 116c0a2a6..000000000 --- a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/generator.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Generator } from '@commercetools-test-data/core'; -import { CustomViewPermissionDraft } from '../types'; - -const generator = Generator({ - fields: { - name: null, - oAuthScopes: [], - }, -}); - -export default generator; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/index.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/index.ts deleted file mode 100644 index 96e2519e1..000000000 --- a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default as random } from './builder'; -export { default as presets } from './presets'; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/index.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/index.ts deleted file mode 100644 index 05c389a76..000000000 --- a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import managePermission from './manage-permission'; -import viewPermission from './view-permission'; - -const presets = { viewPermission, managePermission }; - -export default presets; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/manage-permission.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/manage-permission.ts deleted file mode 100644 index 944e069e2..000000000 --- a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/manage-permission.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { faker } from '@faker-js/faker'; -import CustomViewPermissionDraft from '../builder'; - -const manageOauthScopes = [ - 'manage_orders', - 'manage_payments', - 'manage_types', - 'manage_discount_codes', - 'manage_business_units', -]; - -const managePermission = () => - CustomViewPermissionDraft() - .name('manage') - .oAuthScopes( - faker.helpers.arrayElements(manageOauthScopes, { - min: 1, - max: 3, - }) - ); - -export default managePermission; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/view-permission.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/view-permission.ts deleted file mode 100644 index 2b262a66b..000000000 --- a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/presets/view-permission.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { faker } from '@faker-js/faker'; -import CustomViewPermission from '../builder'; - -const viewOauthScopes = [ - 'view_products', - 'view_states', - 'view_types', - 'view_customer_groups', - 'view_product_selections', - 'view_orders', - 'view_customers', - 'view_payments', - 'view_discount_codes', - 'view_business_units', - 'view_associate_roles', - 'view_stores', -]; - -const viewPermission = () => - CustomViewPermission() - .name('view') - .oAuthScopes( - faker.helpers.arrayElements(viewOauthScopes, { - min: 1, - max: 3, - }) - ); - -export default viewPermission; diff --git a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/transformers.ts b/models/custom-view/src/custom-view-permission/custom-view-permission-draft/transformers.ts deleted file mode 100644 index d301fd2db..000000000 --- a/models/custom-view/src/custom-view-permission/custom-view-permission-draft/transformers.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Transformer } from '@commercetools-test-data/core'; -import type { CustomViewPermissionDraft } from '../types'; - -const transformers = { - default: Transformer( - 'default', - {} - ), - graphql: Transformer( - 'graphql', - {} - ), -}; - -export default transformers; diff --git a/models/custom-view/src/custom-view-permission/generator.ts b/models/custom-view/src/custom-view-permission/generator.ts index 02260f646..51d7eda97 100644 --- a/models/custom-view/src/custom-view-permission/generator.ts +++ b/models/custom-view/src/custom-view-permission/generator.ts @@ -1,10 +1,12 @@ import { Generator } from '@commercetools-test-data/core'; -import { CustomViewPermission } from './types'; +import sampleSize from 'lodash/sampleSize'; +import { supportedViewOAuthScopes } from './constants'; +import type { TCustomViewPermission } from './types'; -const generator = Generator({ +const generator = Generator({ fields: { - name: '', - oAuthScopes: [], + name: 'view', + oAuthScopes: sampleSize(supportedViewOAuthScopes, 2), }, }); diff --git a/models/custom-view/src/custom-view-permission/index.ts b/models/custom-view/src/custom-view-permission/index.ts index bbba4f16d..153b04270 100644 --- a/models/custom-view/src/custom-view-permission/index.ts +++ b/models/custom-view/src/custom-view-permission/index.ts @@ -1,8 +1,3 @@ -export * as CustomViewPermissionDraft from './custom-view-permission-draft'; -export * as CustomViewPermission from '.'; - export { default as random } from './builder'; -export { default as presets } from './presets'; -export { default as draftPresets } from './custom-view-permission-draft/presets'; - +export * as presets from './presets'; export * from './types'; diff --git a/models/custom-view/src/custom-view-permission/presets/index.ts b/models/custom-view/src/custom-view-permission/presets/index.ts index 05c389a76..55569c31c 100644 --- a/models/custom-view/src/custom-view-permission/presets/index.ts +++ b/models/custom-view/src/custom-view-permission/presets/index.ts @@ -1,6 +1,4 @@ -import managePermission from './manage-permission'; -import viewPermission from './view-permission'; +import ManageOnlyPermissions from './manage-only-permissions'; +import ViewOnlyPermissions from './view-only-permissions'; -const presets = { viewPermission, managePermission }; - -export default presets; +export { ViewOnlyPermissions, ManageOnlyPermissions }; diff --git a/models/custom-view/src/custom-view-permission/presets/manage-only-permissions.ts b/models/custom-view/src/custom-view-permission/presets/manage-only-permissions.ts new file mode 100644 index 000000000..71d68dac5 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/presets/manage-only-permissions.ts @@ -0,0 +1,26 @@ +import { entryPointUriPathToResourceAccesses } from '@commercetools-frontend/application-config/ssr'; +import { CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/constants'; +import camelCase from 'lodash/camelCase'; +import sampleSize from 'lodash/sampleSize'; +import upperFirst from 'lodash/upperFirst'; +import CustomApplicationPermission from '../builder'; +import { supportedManageOAuthScopes } from '../constants'; + +const preset = (additionalPermission = '') => { + const resourceAccesses = entryPointUriPathToResourceAccesses( + CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, + [additionalPermission] + ); + return CustomApplicationPermission() + .name( + !additionalPermission + ? resourceAccesses.manage + : // @ts-ignore + resourceAccesses[ + `manage${upperFirst(camelCase(additionalPermission))}` + ] + ) + .oAuthScopes(sampleSize(supportedManageOAuthScopes, 1)); +}; + +export default preset; diff --git a/models/custom-view/src/custom-view-permission/presets/manage-permission.ts b/models/custom-view/src/custom-view-permission/presets/manage-permission.ts deleted file mode 100644 index 7e3960c8b..000000000 --- a/models/custom-view/src/custom-view-permission/presets/manage-permission.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { faker } from '@faker-js/faker'; -import CustomViewPermission from '../builder'; - -const manageOauthScopes = [ - 'manage_orders', - 'manage_payments', - 'manage_types', - 'manage_discount_codes', - 'manage_business_units', -]; - -const managePermission = () => - CustomViewPermission() - .name('manage') - .oAuthScopes( - faker.helpers.arrayElements(manageOauthScopes, { - min: 1, - max: 3, - }) - ); - -export default managePermission; diff --git a/models/custom-view/src/custom-view-permission/presets/presets.spec.ts b/models/custom-view/src/custom-view-permission/presets/presets.spec.ts new file mode 100644 index 000000000..7ce659952 --- /dev/null +++ b/models/custom-view/src/custom-view-permission/presets/presets.spec.ts @@ -0,0 +1,26 @@ +import { ViewOnlyPermissions, ManageOnlyPermissions } from '.'; + +describe('view only permissions', () => { + it('should build important properties', () => { + const built = ViewOnlyPermissions().buildGraphql(); + + expect(built).toEqual( + expect.objectContaining({ + name: 'view', + oAuthScopes: expect.arrayContaining([expect.any(String)]), + }) + ); + }); +}); +describe('with manage only permissions', () => { + it('should build important properties', () => { + const built = ManageOnlyPermissions().buildGraphql(); + + expect(built).toEqual( + expect.objectContaining({ + name: 'manage', + oAuthScopes: expect.arrayContaining([expect.any(String)]), + }) + ); + }); +}); diff --git a/models/custom-view/src/custom-view-permission/presets/view-only-permissions.ts b/models/custom-view/src/custom-view-permission/presets/view-only-permissions.ts new file mode 100644 index 000000000..1b0c5343c --- /dev/null +++ b/models/custom-view/src/custom-view-permission/presets/view-only-permissions.ts @@ -0,0 +1,24 @@ +import { entryPointUriPathToResourceAccesses } from '@commercetools-frontend/application-config/ssr'; +import { CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/constants'; +import camelCase from 'lodash/camelCase'; +import sampleSize from 'lodash/sampleSize'; +import upperFirst from 'lodash/upperFirst'; +import CustomApplicationPermission from '../builder'; +import { supportedViewOAuthScopes } from '../constants'; + +const preset = (additionalPermission = '') => { + const resourceAccesses = entryPointUriPathToResourceAccesses( + CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, + [additionalPermission] + ); + return CustomApplicationPermission() + .name( + !additionalPermission + ? resourceAccesses.view + : // @ts-ignore + resourceAccesses[`view${upperFirst(camelCase(additionalPermission))}`] + ) + .oAuthScopes(sampleSize(supportedViewOAuthScopes, 1)); +}; + +export default preset; diff --git a/models/custom-view/src/custom-view-permission/presets/view-permission.ts b/models/custom-view/src/custom-view-permission/presets/view-permission.ts deleted file mode 100644 index 2b262a66b..000000000 --- a/models/custom-view/src/custom-view-permission/presets/view-permission.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { faker } from '@faker-js/faker'; -import CustomViewPermission from '../builder'; - -const viewOauthScopes = [ - 'view_products', - 'view_states', - 'view_types', - 'view_customer_groups', - 'view_product_selections', - 'view_orders', - 'view_customers', - 'view_payments', - 'view_discount_codes', - 'view_business_units', - 'view_associate_roles', - 'view_stores', -]; - -const viewPermission = () => - CustomViewPermission() - .name('view') - .oAuthScopes( - faker.helpers.arrayElements(viewOauthScopes, { - min: 1, - max: 3, - }) - ); - -export default viewPermission; diff --git a/models/custom-view/src/custom-view-permission/transformers.ts b/models/custom-view/src/custom-view-permission/transformers.ts index 0b779aa53..5a0ec1f28 100644 --- a/models/custom-view/src/custom-view-permission/transformers.ts +++ b/models/custom-view/src/custom-view-permission/transformers.ts @@ -1,14 +1,21 @@ import { Transformer } from '@commercetools-test-data/core'; -import type { CustomViewPermission } from './types'; +import type { + TCustomViewPermission, + TCustomViewPermissionGraphql, +} from './types'; const transformers = { - default: Transformer( + default: Transformer( 'default', {} ), - graphql: Transformer( + graphql: Transformer( 'graphql', - {} + { + addFields: () => ({ + __typename: 'CustomViewPermission', + }), + } ), }; diff --git a/models/custom-view/src/custom-view-permission/types.ts b/models/custom-view/src/custom-view-permission/types.ts index fb06c8427..a2e0e0da9 100644 --- a/models/custom-view/src/custom-view-permission/types.ts +++ b/models/custom-view/src/custom-view-permission/types.ts @@ -1,19 +1,17 @@ -import { TBuilder } from '@commercetools-test-data/core'; +import type { TBuilder } from '@commercetools-test-data/core'; -export type CustomViewPermission = { +export type TCustomViewPermission = { name: string; oAuthScopes: string[]; }; +export type TCustomViewPermissionGraphql = TCustomViewPermission & { + __typename: 'CustomViewPermission'; +}; -export type CustomViewPermissionDraft = CustomViewPermission; - -export type TCustomViewPermission = CustomViewPermission; -export type TCustomViewPermissionDraft = CustomViewPermission; - -export type TCustomViewPermissionBuilder = TBuilder; +export type TCustomViewPermissionBuilder = TBuilder; export type TCreateCustomViewPermissionBuilder = () => TCustomViewPermissionBuilder; -export type TCustomViewPermissionDraftBuilder = TBuilder; +export type TCustomViewPermissionDraftBuilder = TBuilder; export type TCreateCustomViewPermissionDraftBuilder = () => TCustomViewPermissionDraftBuilder; diff --git a/models/custom-view/src/custom-view-type-settings/builder.spec.ts b/models/custom-view/src/custom-view-type-settings/builder.spec.ts index 32bd7265d..29de6dd7e 100644 --- a/models/custom-view/src/custom-view-type-settings/builder.spec.ts +++ b/models/custom-view/src/custom-view-type-settings/builder.spec.ts @@ -1,23 +1,32 @@ /* eslint-disable jest/no-disabled-tests */ /* eslint-disable jest/valid-title */ import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; -import type { TCustomViewTypeSettings } from './types'; -import * as CustomViewTypeSettingsModel from './index'; +import type { + TCustomViewTypeSettings, + TCustomViewTypeSettingsGraphql, +} from './types'; +import * as CustomViewTypeSettings from './index'; -describe('CustomView model builder', () => { +describe('builder', () => { it( ...createBuilderSpec( 'default', - CustomViewTypeSettingsModel.random(), - expect.objectContaining({}) + CustomViewTypeSettings.random(), + expect.objectContaining({ + size: expect.stringMatching(/SMALL|LARGE/), + }) ) ); it( - ...createBuilderSpec( - 'default', - CustomViewTypeSettingsModel.presets.customViewPanelSettings('SMALL'), + ...createBuilderSpec< + TCustomViewTypeSettings, + TCustomViewTypeSettingsGraphql + >( + 'graphql', + CustomViewTypeSettings.random().size('SMALL'), expect.objectContaining({ + __typename: 'CustomViewTypeSettings', size: 'SMALL', }) ) diff --git a/models/custom-view/src/custom-view-type-settings/generator.ts b/models/custom-view/src/custom-view-type-settings/generator.ts index 72f4db67b..15d21459c 100644 --- a/models/custom-view/src/custom-view-type-settings/generator.ts +++ b/models/custom-view/src/custom-view-type-settings/generator.ts @@ -1,8 +1,11 @@ -import { Generator } from '@commercetools-test-data/core'; -import { CustomViewTypeSettings } from './types'; +import { fake, Generator } from '@commercetools-test-data/core'; +import type { TCustomViewTypeSettings } from './types'; -const generator = Generator({ - fields: {}, +const generator = Generator({ + fields: { + // Assumes that the type is `CustomPanel`. + size: fake((f) => f.helpers.arrayElement(['SMALL', 'LARGE'])), + }, }); export default generator; diff --git a/models/custom-view/src/custom-view-type-settings/index.ts b/models/custom-view/src/custom-view-type-settings/index.ts index d40834341..012166617 100644 --- a/models/custom-view/src/custom-view-type-settings/index.ts +++ b/models/custom-view/src/custom-view-type-settings/index.ts @@ -1,6 +1,3 @@ -export * as CustomViewTypeSettings from '.'; - export { default as random } from './builder'; export { default as presets } from './presets'; - export * from './types'; diff --git a/models/custom-view/src/custom-view-type-settings/presets/custom-view-panel.ts b/models/custom-view/src/custom-view-type-settings/presets/custom-view-panel.ts deleted file mode 100644 index 76924cdbc..000000000 --- a/models/custom-view/src/custom-view-type-settings/presets/custom-view-panel.ts +++ /dev/null @@ -1,7 +0,0 @@ -import CustomViewTypeSettings from '../builder'; -import { CustomViewSize } from '../types'; - -const customViewPanel = (size: CustomViewSize) => - CustomViewTypeSettings().size(size); - -export default customViewPanel; diff --git a/models/custom-view/src/custom-view-type-settings/presets/index.ts b/models/custom-view/src/custom-view-type-settings/presets/index.ts index 1cba0fab1..763e57fe0 100644 --- a/models/custom-view/src/custom-view-type-settings/presets/index.ts +++ b/models/custom-view/src/custom-view-type-settings/presets/index.ts @@ -1,5 +1,3 @@ -import customViewPanelSettings from './custom-view-panel'; - -const presets = { customViewPanelSettings }; +const presets = {}; export default presets; diff --git a/models/custom-view/src/custom-view-type-settings/transformers.ts b/models/custom-view/src/custom-view-type-settings/transformers.ts index c0a96091e..e1fd29232 100644 --- a/models/custom-view/src/custom-view-type-settings/transformers.ts +++ b/models/custom-view/src/custom-view-type-settings/transformers.ts @@ -1,14 +1,21 @@ import { Transformer } from '@commercetools-test-data/core'; -import type { CustomViewTypeSettings } from './types'; +import type { + TCustomViewTypeSettings, + TCustomViewTypeSettingsGraphql, +} from './types'; const transformers = { - default: Transformer( + default: Transformer( 'default', {} ), - graphql: Transformer( + graphql: Transformer( 'graphql', - {} + { + addFields: () => ({ + __typename: 'CustomViewTypeSettings', + }), + } ), }; diff --git a/models/custom-view/src/custom-view-type-settings/types.ts b/models/custom-view/src/custom-view-type-settings/types.ts index 23acb1e14..8869c956d 100644 --- a/models/custom-view/src/custom-view-type-settings/types.ts +++ b/models/custom-view/src/custom-view-type-settings/types.ts @@ -2,20 +2,18 @@ import { TBuilder } from '@commercetools-test-data/core'; export type CustomViewSize = 'SMALL' | 'LARGE'; -export type CustomViewTypeSettings = { +export type TCustomViewTypeSettings = { size?: CustomViewSize; }; +export type TCustomViewTypeSettingsGraphql = TCustomViewTypeSettings & { + __typename: 'CustomViewTypeSettings'; +}; -export type CustomViewTypeSettingsDraft = CustomViewTypeSettings; - -export type TCustomViewTypeSettings = CustomViewTypeSettings; -export type TCustomViewTypeSettingsDraft = CustomViewTypeSettings; - -export type TCustomViewTypeSettingsBuilder = TBuilder; +export type TCustomViewTypeSettingsBuilder = TBuilder; export type TCreateCustomViewTypeSettingsBuilder = () => TCustomViewTypeSettingsBuilder; export type TCustomViewTypeSettingsDraftBuilder = - TBuilder; + TBuilder; export type TCreateCustomViewTypeSettingsDraftBuilder = () => TCustomViewTypeSettingsDraftBuilder; diff --git a/models/custom-view/src/custom-view/builder.spec.ts b/models/custom-view/src/custom-view/builder.spec.ts index d3d12a76f..013e56e25 100644 --- a/models/custom-view/src/custom-view/builder.spec.ts +++ b/models/custom-view/src/custom-view/builder.spec.ts @@ -2,13 +2,13 @@ /* eslint-disable jest/valid-title */ import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; import type { TCustomView } from './types'; -import * as CustomViewModel from './index'; +import * as CustomView from './index'; -describe('CustomView model builder', () => { +describe('builder', () => { it( ...createBuilderSpec( 'default', - CustomViewModel.random(), + CustomView.random(), expect.objectContaining({ id: expect.any(String), createdAt: expect.any(String), @@ -16,7 +16,7 @@ describe('CustomView model builder', () => { defaultLabel: expect.any(String), labelAllLocales: expect.arrayContaining([ expect.objectContaining({ - locale: expect.any(String), + locale: expect.stringMatching(/^(de|en|es)$/), value: expect.any(String), }), ]), @@ -24,14 +24,47 @@ describe('CustomView model builder', () => { ownerId: expect.any(String), permissions: expect.arrayContaining([ expect.objectContaining({ - name: expect.any(String), + name: expect.stringMatching(/^(view|manage)$/), oAuthScopes: expect.arrayContaining([expect.any(String)]), }), ]), - status: expect.stringMatching(/DRAFT|PUBLIC/), - type: expect.stringContaining('CustomPanel'), + status: expect.stringMatching(/^(DRAFT|PRIVATE_USAGE)$/), + type: 'CustomPanel', typeSettings: expect.objectContaining({ - size: expect.stringMatching(/SMALL|LARGE/), + size: expect.stringMatching(/^(SMALL|LARGE)$/), + }), + url: expect.any(String), + }) + ) + ); + it( + ...createBuilderSpec( + 'graphql', + CustomView.random(), + expect.objectContaining({ + __typename: 'CustomView', + id: expect.any(String), + createdAt: expect.any(String), + updatedAt: expect.any(String), + defaultLabel: expect.any(String), + labelAllLocales: expect.arrayContaining([ + expect.objectContaining({ + locale: expect.stringMatching(/^(de|en|es)$/), + value: expect.any(String), + }), + ]), + locators: expect.arrayContaining([expect.any(String)]), + ownerId: expect.any(String), + permissions: expect.arrayContaining([ + expect.objectContaining({ + name: expect.stringMatching(/^(view|manage)$/), + oAuthScopes: expect.arrayContaining([expect.any(String)]), + }), + ]), + status: expect.stringMatching(/^(DRAFT|PRIVATE_USAGE)$/), + type: 'CustomPanel', + typeSettings: expect.objectContaining({ + size: expect.stringMatching(/^(SMALL|LARGE)$/), }), url: expect.any(String), }) diff --git a/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts b/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts index c35678a0c..0f3d2a9ba 100644 --- a/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/builder.spec.ts @@ -1,34 +1,61 @@ /* eslint-disable jest/no-disabled-tests */ /* eslint-disable jest/valid-title */ import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; -import type { CustomViewDraft } from '../types'; -import * as CustomViewDraftModel from './index'; +import type { TCustomViewDraft } from '../types'; +import * as CustomViewDraft from './index'; -describe('CustomViewDraft model builder', () => { +describe('builder', () => { it( - ...createBuilderSpec( + ...createBuilderSpec( 'default', - CustomViewDraftModel.random(), + CustomViewDraft.random(), expect.objectContaining({ defaultLabel: expect.any(String), labelAllLocales: expect.arrayContaining([ expect.objectContaining({ - locale: expect.any(String), + locale: expect.stringMatching(/^(de|en|es)$/), value: expect.any(String), }), ]), locators: expect.arrayContaining([expect.any(String)]), - ownerId: expect.any(String), permissions: expect.arrayContaining([ expect.objectContaining({ - name: expect.any(String), + name: expect.stringMatching(/^(view|manage)$/), oAuthScopes: expect.arrayContaining([expect.any(String)]), }), ]), - status: expect.stringMatching(/DRAFT|PUBLIC/), - type: expect.stringContaining('CustomPanel'), + status: 'DRAFT', + type: 'CustomPanel', typeSettings: expect.objectContaining({ - size: expect.stringMatching(/SMALL|LARGE/), + size: expect.stringMatching(/^(SMALL|LARGE)$/), + }), + url: expect.any(String), + }) + ) + ); + it( + ...createBuilderSpec( + 'graphql', + CustomViewDraft.random(), + expect.objectContaining({ + defaultLabel: expect.any(String), + labelAllLocales: expect.arrayContaining([ + expect.objectContaining({ + locale: expect.stringMatching(/^(de|en|es)$/), + value: expect.any(String), + }), + ]), + locators: expect.arrayContaining([expect.any(String)]), + permissions: expect.arrayContaining([ + expect.objectContaining({ + name: expect.stringMatching(/^(view|manage)$/), + oAuthScopes: expect.arrayContaining([expect.any(String)]), + }), + ]), + status: 'DRAFT', + type: 'CustomPanel', + typeSettings: expect.objectContaining({ + size: expect.stringMatching(/^(SMALL|LARGE)$/), }), url: expect.any(String), }) diff --git a/models/custom-view/src/custom-view/custom-view-draft/builder.ts b/models/custom-view/src/custom-view/custom-view-draft/builder.ts index 48ca53ae5..bf4631d37 100644 --- a/models/custom-view/src/custom-view/custom-view-draft/builder.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/builder.ts @@ -1,10 +1,10 @@ import { Builder } from '@commercetools-test-data/core'; -import type { TCreateCustomViewDraftBuilder, CustomViewDraft } from '../types'; +import type { TCreateCustomViewDraftBuilder, TCustomViewDraft } from '../types'; import generator from './generator'; import transformers from './transformers'; const ChannelDraft: TCreateCustomViewDraftBuilder = () => - Builder({ + Builder({ generator, transformers, }); diff --git a/models/custom-view/src/custom-view/custom-view-draft/generator.ts b/models/custom-view/src/custom-view/custom-view-draft/generator.ts index 972ca64b3..0ffa7c688 100644 --- a/models/custom-view/src/custom-view/custom-view-draft/generator.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/generator.ts @@ -1,36 +1,29 @@ import { LocalizedField } from '@commercetools-test-data/commons'; import { fake, Generator } from '@commercetools-test-data/core'; -import { CustomViewPermission } from '../../custom-view-permission'; -import { CustomViewTypeSettings } from '../../custom-view-type-settings'; -import { CustomViewDraft } from '../types'; +import * as CustomViewPermission from '../../custom-view-permission'; +import * as CustomViewTypeSettings from '../../custom-view-type-settings'; +import { TCustomViewDraft } from '../types'; import { defaultLocators } from '../utils'; -const generator = Generator({ +const generator = Generator({ fields: { - defaultLabel: 'Selling Trend', - labelAllLocales: [ - LocalizedField.random().build(), - LocalizedField.random().build(), - ], + url: fake((f) => f.internet.url()), + defaultLabel: fake((f) => f.commerce.department()), + labelAllLocales: fake(() => [LocalizedField.random()]), + description: null, locators: fake((f) => f.helpers.arrayElements(defaultLocators, { - min: 0, + min: 1, max: defaultLocators.length, }) ), - ownerId: fake((f) => f.string.uuid()), - permissions: [ - CustomViewPermission.presets.viewPermission().build(), - CustomViewPermission.presets.viewPermission().build(), - ], - status: fake((f) => f.helpers.arrayElement(['DRAFT', 'PUBLIC'])), - type: 'CustomPanel', - typeSettings: fake((f) => - CustomViewTypeSettings.presets - .customViewPanelSettings(f.helpers.arrayElement(['SMALL', 'LARGE'])) - .build() - ), - url: fake((f) => f.internet.url()), + permissions: fake(() => [ + CustomViewPermission.presets.ViewOnlyPermissions(), + CustomViewPermission.presets.ManageOnlyPermissions(), + ]), + status: 'DRAFT', + type: fake((f) => f.helpers.arrayElement(['CustomPanel'])), + typeSettings: fake((f) => CustomViewTypeSettings.random()), }, }); diff --git a/models/custom-view/src/custom-view/custom-view-draft/transformers.ts b/models/custom-view/src/custom-view/custom-view-draft/transformers.ts index 9ff5fb69e..ad1d3d116 100644 --- a/models/custom-view/src/custom-view/custom-view-draft/transformers.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/transformers.ts @@ -1,9 +1,16 @@ import { Transformer } from '@commercetools-test-data/core'; -import type { CustomViewDraft } from '../types'; +import type { TCustomViewDraft, TCustomViewDraftGraphql } from '../types'; const transformers = { - default: Transformer('default', {}), - graphql: Transformer('graphql', {}), + default: Transformer('default', { + buildFields: ['labelAllLocales', 'permissions', 'typeSettings'], + }), + graphql: Transformer('graphql', { + buildFields: ['labelAllLocales', 'permissions', 'typeSettings'], + addFields: () => ({ + __typename: 'CustomViewDraftDataInput', + }), + }), }; export default transformers; diff --git a/models/custom-view/src/custom-view/generator.ts b/models/custom-view/src/custom-view/generator.ts index 8ce2c57f2..d309d0ed8 100644 --- a/models/custom-view/src/custom-view/generator.ts +++ b/models/custom-view/src/custom-view/generator.ts @@ -1,43 +1,36 @@ import { LocalizedField } from '@commercetools-test-data/commons'; import { fake, Generator } from '@commercetools-test-data/core'; import { createRelatedDates } from '@commercetools-test-data/utils'; -import { CustomViewPermission } from '../custom-view-permission'; -import { CustomViewTypeSettings } from '../custom-view-type-settings'; -import { CustomView } from './types'; +import * as CustomViewPermission from '../custom-view-permission'; +import * as CustomViewTypeSettings from '../custom-view-type-settings'; +import { TCustomView } from './types'; import { defaultLocators } from './utils'; const [getOlderDate, getNewerDate] = createRelatedDates(); -const generator = Generator({ +const generator = Generator({ fields: { - createdAt: fake(getOlderDate), - defaultLabel: fake((f) => f.commerce.department()), id: fake((f) => f.string.uuid()), - installedBy: null, // buildField - labelAllLocales: [ - LocalizedField.random().build(), - LocalizedField.random().build(), - ], + ownerId: fake((f) => f.string.uuid()), + url: fake((f) => f.internet.url()), + defaultLabel: fake((f) => f.commerce.department()), + labelAllLocales: fake(() => [LocalizedField.random()]), + description: null, locators: fake((f) => f.helpers.arrayElements(defaultLocators, { - min: 0, + min: 1, max: defaultLocators.length, }) ), - ownerId: fake((f) => f.string.uuid()), - permissions: [ - CustomViewPermission.presets.viewPermission().build(), - CustomViewPermission.presets.viewPermission().build(), - ], - status: fake((f) => f.helpers.arrayElement(['DRAFT', 'PUBLIC'])), - type: 'CustomPanel', - typeSettings: fake((f) => - CustomViewTypeSettings.presets - .customViewPanelSettings(f.helpers.arrayElement(['SMALL', 'LARGE'])) - .build() - ), + permissions: fake(() => [ + CustomViewPermission.presets.ViewOnlyPermissions(), + CustomViewPermission.presets.ManageOnlyPermissions(), + ]), + status: fake((f) => f.helpers.arrayElement(['DRAFT', 'PRIVATE_USAGE'])), + type: fake((f) => f.helpers.arrayElement(['CustomPanel'])), + typeSettings: fake((f) => CustomViewTypeSettings.random()), + createdAt: fake(getOlderDate), updatedAt: fake(getNewerDate), - url: fake((f) => f.internet.url()), }, }); diff --git a/models/custom-view/src/custom-view/index.ts b/models/custom-view/src/custom-view/index.ts index 7b8231289..401e5e9f0 100644 --- a/models/custom-view/src/custom-view/index.ts +++ b/models/custom-view/src/custom-view/index.ts @@ -1,8 +1,5 @@ export * as CustomViewDraft from './custom-view-draft'; -export * as CustomView from '.'; export { default as random } from './builder'; export { default as presets } from './presets'; -export { default as draftPresets } from './custom-view-draft/presets'; - export * from './types'; diff --git a/models/custom-view/src/custom-view/transformers.ts b/models/custom-view/src/custom-view/transformers.ts index 005aff320..803dd4cfc 100644 --- a/models/custom-view/src/custom-view/transformers.ts +++ b/models/custom-view/src/custom-view/transformers.ts @@ -1,14 +1,15 @@ import { Transformer } from '@commercetools-test-data/core'; -import type { CustomView, CustomViewGraphql } from './types'; +import type { TCustomView, TCustomViewGraphql } from './types'; const transformers = { - default: Transformer('default', {}), - graphql: Transformer('graphql', { - addFields: () => { - return { - __typename: 'CustomView', - }; - }, + default: Transformer('default', { + buildFields: ['labelAllLocales', 'permissions', 'typeSettings'], + }), + graphql: Transformer('graphql', { + buildFields: ['labelAllLocales', 'permissions', 'typeSettings'], + addFields: () => ({ + __typename: 'CustomView', + }), }), }; diff --git a/models/custom-view/src/custom-view/types.ts b/models/custom-view/src/custom-view/types.ts index e27cc5b7d..f1fb15ffa 100644 --- a/models/custom-view/src/custom-view/types.ts +++ b/models/custom-view/src/custom-view/types.ts @@ -1,5 +1,7 @@ import { TBuilder } from '@commercetools-test-data/core'; +// TODO: generate graphql types and use those + type LocalizedField = { id?: string; locale: string; @@ -10,7 +12,7 @@ type CustomViewType = 'CustomPanel'; type CustomViewSize = 'SMALL' | 'LARGE'; -type CustomViewStatus = 'DRAFT' | 'PUBLIC'; +type CustomViewStatus = 'DRAFT' | 'PRIVATE_USAGE'; type CustomViewTypeSettings = { size?: CustomViewSize; @@ -40,46 +42,36 @@ export type CustomViewInstallation = { updatedAt: string; }; -export type CustomView = { - createdAt: string; - defaultLabel: string; - description?: string; +export type TCustomView = { id: string; - installedBy: CustomViewInstallation[]; - labelAllLocales: LocalizedField[]; - locators: string[]; // owner: OrganizationExtension; ownerId: string; - permissions: Array; - status: CustomViewStatus; - type: CustomViewType; - typeSettings?: CustomViewTypeSettings; - updatedAt: string; url: string; -}; - -export type CustomViewGraphql = CustomView & { - __typename: 'CustomView'; -}; - -export type CustomViewDraft = { defaultLabel: string; description?: string; labelAllLocales: LocalizedField[]; locators: string[]; - ownerId: string; permissions: CustomViewPermission[]; + status: CustomViewStatus; type: CustomViewType; typeSettings?: CustomViewTypeSettings; - status: CustomViewStatus; - url: string; + createdAt: string; + updatedAt: string; +}; +export type TCustomViewGraphql = TCustomView & { + __typename: 'CustomView'; }; -export type TCustomView = CustomView; -export type TCustomViewDraft = CustomViewDraft; +export type TCustomViewDraft = Omit< + TCustomView, + 'id' | 'createdAt' | 'updatedAt' | 'ownerId' +>; +export type TCustomViewDraftGraphql = TCustomViewDraft & { + __typename: 'CustomViewDraftDataInput'; +}; -export type TCustomViewBuilder = TBuilder; +export type TCustomViewBuilder = TBuilder; export type TCreateCustomViewBuilder = () => TCustomViewBuilder; -export type TCustomViewDraftBuilder = TBuilder; +export type TCustomViewDraftBuilder = TBuilder; export type TCreateCustomViewDraftBuilder = () => TCustomViewDraftBuilder; diff --git a/models/custom-view/src/index.ts b/models/custom-view/src/index.ts new file mode 100644 index 000000000..79f2f3b8b --- /dev/null +++ b/models/custom-view/src/index.ts @@ -0,0 +1,6 @@ +// Export types +export * from './custom-view/types'; + +// Export models +export * as CustomView from './custom-view'; +export * as CustomViewDraft from './custom-view/custom-view-draft'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 182a1ac77..e38b354dc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -290,21 +290,33 @@ importers: '@babel/runtime-corejs3': specifier: ^7.17.9 version: 7.21.0 + '@commercetools-frontend/application-config': + specifier: ^22.9.1 + version: 22.9.1 + '@commercetools-frontend/constants': + specifier: ^22.9.1 + version: 22.9.1 '@commercetools-test-data/commons': - specifier: 6.0.0 + specifier: 6.3.8 version: link:../commons '@commercetools-test-data/core': - specifier: 6.0.0 + specifier: 6.3.8 version: link:../../core '@commercetools-test-data/utils': - specifier: 6.0.0 + specifier: 6.3.8 version: link:../../utils '@commercetools/platform-sdk': - specifier: ^4.11.0 - version: 4.11.0 + specifier: ^6.0.0 + version: 6.0.0 '@faker-js/faker': specifier: ^8.0.0 version: 8.0.0 + '@types/lodash': + specifier: ^4.14.182 + version: 4.14.186 + lodash: + specifier: ^4.17.21 + version: 4.17.21 models/customer: dependencies: @@ -447,30 +459,6 @@ importers: specifier: ^8.0.0 version: 8.0.0 - models/organization-extension: - dependencies: - '@babel/runtime': - specifier: ^7.17.9 - version: 7.21.0 - '@babel/runtime-corejs3': - specifier: ^7.17.9 - version: 7.21.0 - '@commercetools-test-data/commons': - specifier: 6.0.0 - version: link:../commons - '@commercetools-test-data/core': - specifier: 6.0.0 - version: link:../../core - '@commercetools-test-data/utils': - specifier: 6.0.0 - version: link:../../utils - '@commercetools/platform-sdk': - specifier: ^4.11.0 - version: 4.11.0 - '@faker-js/faker': - specifier: ^8.0.0 - version: 8.0.0 - models/payment: dependencies: '@babel/runtime': @@ -889,7 +877,7 @@ packages: resolution: {integrity: sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.21.4 + '@babel/types': 7.23.0 dev: false /@babel/helper-annotate-as-pure@7.22.5: @@ -1001,8 +989,8 @@ packages: resolution: {integrity: sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/template': 7.20.7 - '@babel/types': 7.21.4 + '@babel/template': 7.22.15 + '@babel/types': 7.23.0 dev: false /@babel/helper-function-name@7.23.0: @@ -1017,7 +1005,7 @@ packages: resolution: {integrity: sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.21.4 + '@babel/types': 7.23.0 dev: false /@babel/helper-hoist-variables@7.22.5: @@ -1123,7 +1111,7 @@ packages: resolution: {integrity: sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.21.4 + '@babel/types': 7.23.0 dev: false /@babel/helper-simple-access@7.22.5: @@ -1144,7 +1132,7 @@ packages: resolution: {integrity: sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.21.4 + '@babel/types': 7.23.0 dev: false /@babel/helper-split-export-declaration@7.22.6: @@ -1329,6 +1317,15 @@ packages: '@babel/helper-plugin-utils': 7.20.2 dev: false + /@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.23.0): + resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.20.2 + dev: false + /@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.21.0): resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} peerDependencies: @@ -1451,16 +1448,6 @@ packages: '@babel/helper-plugin-utils': 7.22.5 dev: false - /@babel/plugin-syntax-jsx@7.18.6(@babel/core@7.21.0): - resolution: {integrity: sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.21.0 - '@babel/helper-plugin-utils': 7.20.2 - dev: false - /@babel/plugin-syntax-jsx@7.18.6(@babel/core@7.23.0): resolution: {integrity: sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==} engines: {node: '>=6.9.0'} @@ -1619,13 +1606,13 @@ packages: '@babel/helper-plugin-utils': 7.22.5 dev: false - /@babel/plugin-syntax-typescript@7.18.6(@babel/core@7.21.0): + /@babel/plugin-syntax-typescript@7.18.6(@babel/core@7.23.0): resolution: {integrity: sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.21.0 + '@babel/core': 7.23.0 '@babel/helper-plugin-utils': 7.20.2 dev: false @@ -1896,18 +1883,16 @@ packages: '@babel/helper-plugin-utils': 7.22.5 dev: false - /@babel/plugin-transform-modules-commonjs@7.21.2(@babel/core@7.21.0): + /@babel/plugin-transform-modules-commonjs@7.21.2(@babel/core@7.23.0): resolution: {integrity: sha512-Cln+Yy04Gxua7iPdj6nOV96smLGjpElir5YwzF0LBPKoPlLDNJePNlrGGaybAJkd0zKRnOVXOgizSqPYMNYkzA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.21.0 - '@babel/helper-module-transforms': 7.21.2 + '@babel/core': 7.23.0 + '@babel/helper-module-transforms': 7.23.0(@babel/core@7.23.0) '@babel/helper-plugin-utils': 7.20.2 '@babel/helper-simple-access': 7.20.2 - transitivePeerDependencies: - - supports-color dev: false /@babel/plugin-transform-modules-commonjs@7.23.0(@babel/core@7.23.0): @@ -2109,10 +2094,10 @@ packages: dependencies: '@babel/core': 7.23.0 '@babel/helper-annotate-as-pure': 7.18.6 - '@babel/helper-module-imports': 7.21.4 + '@babel/helper-module-imports': 7.22.15 '@babel/helper-plugin-utils': 7.20.2 '@babel/plugin-syntax-jsx': 7.18.6(@babel/core@7.23.0) - '@babel/types': 7.21.4 + '@babel/types': 7.23.0 dev: false /@babel/plugin-transform-react-jsx@7.22.15(@babel/core@7.23.0): @@ -2416,6 +2401,20 @@ packages: '@babel/plugin-transform-typescript': 7.22.15(@babel/core@7.23.0) dev: false + /@babel/register@7.22.15(@babel/core@7.23.0): + resolution: {integrity: sha512-V3Q3EqoQdn65RCgTLwauZaTfd1ShhwPmbBv+1dkZV/HpCGMKVyn6oFcRlI7RaKqiDQjX2Qd3AuoEguBgdjIKlg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.23.0 + clone-deep: 4.0.1 + find-cache-dir: 2.1.0 + make-dir: 2.1.0 + pirates: 4.0.5 + source-map-support: 0.5.21 + dev: false + /@babel/regjsgen@0.8.0: resolution: {integrity: sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==} dev: false @@ -2753,6 +2752,33 @@ packages: prettier: 2.8.8 dev: false + /@commercetools-frontend/application-config@22.9.1: + resolution: {integrity: sha512-VU4pPN76S7vcTSG0YN1k6pEWIYFuxsbsA8Hi3sbJMLhJYyDCvpMqBDrDNbmsmt1dMRRsdkvvtIS1/WHGxlH6IA==} + engines: {node: 16.x || >=18.0.0} + dependencies: + '@babel/core': 7.23.0 + '@babel/register': 7.22.15(@babel/core@7.23.0) + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 + '@commercetools-frontend/babel-preset-mc-app': 22.9.1 + '@commercetools-frontend/constants': 22.9.1 + '@types/dompurify': 2.4.0 + '@types/lodash': 4.14.200 + '@types/react': 17.0.68 + ajv: 8.12.0 + core-js: 3.32.2 + cosmiconfig: 7.1.0 + dompurify: 2.4.7 + jsdom: 21.1.2 + lodash: 4.17.21 + omit-empty-es: 1.1.3 + transitivePeerDependencies: + - bufferutil + - canvas + - supports-color + - utf-8-validate + dev: false + /@commercetools-frontend/babel-preset-mc-app@22.8.1: resolution: {integrity: sha512-NQupEeXv6Kzd5TrFpjGGbFzP81j5K4QCFfujjYd0yOYHcKxNzifqXeD+r2iq+geqsoizQXCEYG6sh3fnsB1q3w==} engines: {node: 16.x || >=18.0.0} @@ -2786,6 +2812,46 @@ packages: - supports-color dev: false + /@commercetools-frontend/babel-preset-mc-app@22.9.1: + resolution: {integrity: sha512-QBLXd4knad7BL5DW8qqYfKZjRcXTxRv0E0l/5jaKA7R94jtXTXwebAhHcdeM1+fBKNLEowmIyJCVXgM5ydECPA==} + engines: {node: 16.x || >=18.0.0} + dependencies: + '@babel/core': 7.23.0 + '@babel/plugin-proposal-do-expressions': 7.22.5(@babel/core@7.23.0) + '@babel/plugin-proposal-export-default-from': 7.22.17(@babel/core@7.23.0) + '@babel/plugin-transform-class-properties': 7.22.5(@babel/core@7.23.0) + '@babel/plugin-transform-destructuring': 7.23.0(@babel/core@7.23.0) + '@babel/plugin-transform-export-namespace-from': 7.22.11(@babel/core@7.23.0) + '@babel/plugin-transform-logical-assignment-operators': 7.22.11(@babel/core@7.23.0) + '@babel/plugin-transform-object-rest-spread': 7.22.15(@babel/core@7.23.0) + '@babel/plugin-transform-private-methods': 7.22.5(@babel/core@7.23.0) + '@babel/plugin-transform-private-property-in-object': 7.22.11(@babel/core@7.23.0) + '@babel/plugin-transform-regenerator': 7.22.10(@babel/core@7.23.0) + '@babel/plugin-transform-runtime': 7.22.15(@babel/core@7.23.0) + '@babel/preset-env': 7.22.20(@babel/core@7.23.0) + '@babel/preset-react': 7.22.15(@babel/core@7.23.0) + '@babel/preset-typescript': 7.23.0(@babel/core@7.23.0) + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 + '@emotion/babel-plugin': 11.11.0 + '@emotion/babel-preset-css-prop': 11.11.0(@babel/core@7.23.0) + babel-plugin-dev-expression: 0.2.3(@babel/core@7.23.0) + babel-plugin-lodash: 3.3.4 + babel-plugin-macros: 3.1.0 + babel-plugin-preval: 5.1.0 + babel-plugin-transform-react-remove-prop-types: 0.4.24 + core-js: 3.32.2 + transitivePeerDependencies: + - supports-color + dev: false + + /@commercetools-frontend/constants@22.9.1: + resolution: {integrity: sha512-+secRsVaMjiavm5+9TCiqCypHec4mdg7QFmJtnKMtgv1R/4wClX6KCmzII9PTM0SezeRvArtvzDE/ltamQRbfQ==} + dependencies: + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 + dev: false + /@commercetools-frontend/eslint-config-mc-app@22.8.1(eslint@8.50.0)(jest@29.7.0): resolution: {integrity: sha512-MTDbux4MhTTBC37c9Xqn2bZyLfdwG/rqEEvWQ5cWe7MNAvUIPCJExG71RF8CMzIvySx5wKMPwj9G04TGCJKZxw==} engines: {node: 16.x || >=18.0.0} @@ -2858,7 +2924,7 @@ packages: '@commercetools-test-data/utils': 5.11.2 '@commercetools/platform-sdk': 4.11.0 '@faker-js/faker': 8.0.0 - '@types/lodash': 4.14.186 + '@types/lodash': 4.14.200 lodash: 4.17.21 transitivePeerDependencies: - encoding @@ -2870,7 +2936,7 @@ packages: '@babel/runtime': 7.23.1 '@babel/runtime-corejs3': 7.23.1 '@faker-js/faker': 8.0.0 - '@types/lodash': 4.14.186 + '@types/lodash': 4.14.200 lodash: 4.17.21 dev: false @@ -2982,7 +3048,7 @@ packages: engines: {node: '>=v14'} dependencies: '@commitlint/types': 17.4.4 - ajv: 8.11.0 + ajv: 8.12.0 dev: false /@commitlint/ensure@17.6.7: @@ -3485,7 +3551,7 @@ packages: resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@babel/core': 7.21.0 + '@babel/core': 7.23.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.19 babel-plugin-istanbul: 6.1.1 @@ -3734,8 +3800,8 @@ packages: /@preconstruct/hook@0.4.0: resolution: {integrity: sha512-a7mrlPTM3tAFJyz43qb4pPVpUx8j8TzZBFsNFqcKcE/sEakNXRlQAuCT4RGZRf9dQiiUnBahzSIWawU4rENl+Q==} dependencies: - '@babel/core': 7.21.0 - '@babel/plugin-transform-modules-commonjs': 7.21.2(@babel/core@7.21.0) + '@babel/core': 7.23.0 + '@babel/plugin-transform-modules-commonjs': 7.21.2(@babel/core@7.23.0) pirates: 4.0.5 source-map-support: 0.5.21 transitivePeerDependencies: @@ -3854,7 +3920,7 @@ packages: resolution: {integrity: sha512-6YWYPPpxG3e/xOo6HIWwB/58HukkwIVTOaZ0VwdMVjhRUX/01E4FtQbck9GazOOj7MXHc5RBzMrU86iBJHbI+A==} engines: {node: '>=12'} dependencies: - '@babel/code-frame': 7.18.6 + '@babel/code-frame': 7.22.13 '@babel/runtime': 7.23.1 '@types/aria-query': 4.2.2 aria-query: 5.1.3 @@ -3864,6 +3930,11 @@ packages: pretty-format: 27.5.1 dev: false + /@tootallnate/once@2.0.0: + resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} + engines: {node: '>= 10'} + dev: false + /@tsconfig/node10@1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} dev: false @@ -3897,20 +3968,26 @@ packages: /@types/babel__generator@7.6.4: resolution: {integrity: sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==} dependencies: - '@babel/types': 7.21.4 + '@babel/types': 7.23.0 dev: false /@types/babel__template@7.4.1: resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==} dependencies: - '@babel/parser': 7.21.2 - '@babel/types': 7.21.4 + '@babel/parser': 7.23.0 + '@babel/types': 7.23.0 dev: false /@types/babel__traverse@7.18.2: resolution: {integrity: sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg==} dependencies: - '@babel/types': 7.21.4 + '@babel/types': 7.23.0 + dev: false + + /@types/dompurify@2.4.0: + resolution: {integrity: sha512-IDBwO5IZhrKvHFUl+clZxgf3hn2b/lU6H1KaBShPkQyGJUQ0xwebezIPSuiyGwfz1UzJWQl4M7BDxtHtCCPlTg==} + dependencies: + '@types/trusted-types': 2.0.4 dev: false /@types/eslint@8.44.2: @@ -3981,6 +4058,10 @@ packages: resolution: {integrity: sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==} dev: false + /@types/lodash@4.14.200: + resolution: {integrity: sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==} + dev: false + /@types/minimist@1.2.2: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: false @@ -4005,6 +4086,18 @@ packages: resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} dev: false + /@types/prop-types@15.7.8: + resolution: {integrity: sha512-kMpQpfZKSCBqltAJwskgePRaYRFukDkm1oItcAbC3gNELR20XIBcN9VRgg4+m8DKsTfkWeA4m4Imp4DDuWy7FQ==} + dev: false + + /@types/react@17.0.68: + resolution: {integrity: sha512-y8heXejd/Gi43S28GOqIFmr6BzhLa3anMlPojRu4rHh3MtRrrpB+BtLEcqP3XPO1urXByzBdkOLU7sodYWnpkA==} + dependencies: + '@types/prop-types': 15.7.8 + '@types/scheduler': 0.16.4 + csstype: 3.1.1 + dev: false + /@types/resolve@1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: @@ -4017,6 +4110,10 @@ packages: '@types/node': 18.18.1 dev: false + /@types/scheduler@0.16.4: + resolution: {integrity: sha512-2L9ifAGl7wmXwP4v3pN4p2FLhD0O1qsJpvKmNin5VA8+UvNVb447UDaAEV6UdrkA+m/Xs58U1RFps44x6TFsVQ==} + dev: false + /@types/semver@6.2.3: resolution: {integrity: sha512-KQf+QAMWKMrtBMsB8/24w53tEsxllMj6TuA80TT/5igJalLI/zm0L3oXRbIAl4Ohfc85gyHX/jhMwsVkmhLU4A==} dev: false @@ -4029,6 +4126,10 @@ packages: resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==} dev: false + /@types/trusted-types@2.0.4: + resolution: {integrity: sha512-IDaobHimLQhjwsQ/NMwRVfa/yL7L/wriQPMhw1ZJall0KX6E1oxk29XMDeilW5qTIg5aoiqf5Udy8U/51aNoQQ==} + dev: false + /@types/yargs-parser@21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} dev: false @@ -4266,6 +4367,17 @@ packages: through: 2.3.8 dev: false + /abab@2.0.6: + resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} + dev: false + + /acorn-globals@7.0.1: + resolution: {integrity: sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==} + dependencies: + acorn: 8.10.0 + acorn-walk: 8.2.0 + dev: false + /acorn-jsx@5.3.2(acorn@8.10.0): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -4285,6 +4397,15 @@ packages: hasBin: true dev: false + /agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + dependencies: + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: false + /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -4294,8 +4415,8 @@ packages: uri-js: 4.4.1 dev: false - /ajv@8.11.0: - resolution: {integrity: sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==} + /ajv@8.12.0: + resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} dependencies: fast-deep-equal: 3.1.3 json-schema-traverse: 1.0.0 @@ -4487,6 +4608,10 @@ packages: has-symbols: 1.0.3 dev: false + /asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: false + /at-least-node@1.0.0: resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==} engines: {node: '>= 4.0.0'} @@ -4526,6 +4651,24 @@ packages: - supports-color dev: false + /babel-jest@29.7.0(@babel/core@7.23.0): + resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@babel/core': ^7.8.0 + dependencies: + '@babel/core': 7.23.0 + '@jest/transform': 29.7.0 + '@types/babel__core': 7.1.19 + babel-plugin-istanbul: 6.1.1 + babel-preset-jest: 29.6.3(@babel/core@7.23.0) + chalk: 4.1.2 + graceful-fs: 4.2.10 + slash: 3.0.0 + transitivePeerDependencies: + - supports-color + dev: false + /babel-plugin-dev-expression@0.2.3(@babel/core@7.23.0): resolution: {integrity: sha512-rP5LK9QQTzCW61nVVzw88En1oK8t8gTsIeC6E61oelxNsU842yMjF0G1MxhvUpCkxCEIj7sE8/e5ieTheT//uw==} peerDependencies: @@ -4551,8 +4694,8 @@ packages: resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@babel/template': 7.20.7 - '@babel/types': 7.21.4 + '@babel/template': 7.22.15 + '@babel/types': 7.23.0 '@types/babel__core': 7.1.19 '@types/babel__traverse': 7.18.2 dev: false @@ -4561,7 +4704,7 @@ packages: resolution: {integrity: sha512-yDZLjK7TCkWl1gpBeBGmuaDIFhZKmkoL+Cu2MUUjv5VxUZx/z7tBGBCBcQs5RI1Bkz5LLmNdjx7paOyQtMovyg==} dependencies: '@babel/helper-module-imports': 7.21.4 - '@babel/types': 7.21.4 + '@babel/types': 7.23.0 glob: 7.2.3 lodash: 4.17.21 require-package-name: 2.0.1 @@ -4572,7 +4715,7 @@ packages: engines: {node: '>=10', npm: '>=6'} dependencies: '@babel/runtime': 7.23.1 - cosmiconfig: 7.0.1 + cosmiconfig: 7.1.0 resolve: 1.22.1 dev: false @@ -4646,6 +4789,26 @@ packages: '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.21.0) dev: false + /babel-preset-current-node-syntax@1.0.1(@babel/core@7.23.0): + resolution: {integrity: sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.23.0 + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.23.0) + '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.23.0) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.23.0) + dev: false + /babel-preset-jest@29.6.3(@babel/core@7.21.0): resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -4657,6 +4820,17 @@ packages: babel-preset-current-node-syntax: 1.0.1(@babel/core@7.21.0) dev: false + /babel-preset-jest@29.6.3(@babel/core@7.23.0): + resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.23.0 + babel-plugin-jest-hoist: 29.6.3 + babel-preset-current-node-syntax: 1.0.1(@babel/core@7.23.0) + dev: false + /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: false @@ -4877,6 +5051,15 @@ packages: wrap-ansi: 7.0.0 dev: false + /clone-deep@4.0.1: + resolution: {integrity: sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==} + engines: {node: '>=6'} + dependencies: + is-plain-object: 2.0.4 + kind-of: 6.0.3 + shallow-clone: 3.0.1 + dev: false + /clone-response@1.0.3: resolution: {integrity: sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==} dependencies: @@ -4922,6 +5105,13 @@ packages: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} dev: false + /combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + dependencies: + delayed-stream: 1.0.0 + dev: false + /commander@11.0.0: resolution: {integrity: sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==} engines: {node: '>=16'} @@ -5030,6 +5220,17 @@ packages: yaml: 1.10.2 dev: false + /cosmiconfig@7.1.0: + resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} + engines: {node: '>=10'} + dependencies: + '@types/parse-json': 4.0.0 + import-fresh: 3.3.0 + parse-json: 5.2.0 + path-type: 4.0.0 + yaml: 1.10.2 + dev: false + /cosmiconfig@8.0.0: resolution: {integrity: sha512-da1EafcpH6b/TD8vDRaWV7xFINlHlF6zKsGwS1TsuVJTZRkquaS5HTMq7uq6h31619QjbsYl21gVDOm32KM1vQ==} engines: {node: '>=14'} @@ -5105,6 +5306,13 @@ packages: which: 2.0.2 dev: false + /cssstyle@3.0.0: + resolution: {integrity: sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==} + engines: {node: '>=14'} + dependencies: + rrweb-cssom: 0.6.0 + dev: false + /csstype@3.1.1: resolution: {integrity: sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==} dev: false @@ -5140,6 +5348,15 @@ packages: engines: {node: '>=8'} dev: false + /data-urls@4.0.0: + resolution: {integrity: sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==} + engines: {node: '>=14'} + dependencies: + abab: 2.0.6 + whatwg-mimetype: 3.0.0 + whatwg-url: 12.0.1 + dev: false + /dataloader@1.4.0: resolution: {integrity: sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==} dev: false @@ -5184,6 +5401,10 @@ packages: engines: {node: '>=0.10.0'} dev: false + /decimal.js@10.4.3: + resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} + dev: false + /decompress-response@3.3.0: resolution: {integrity: sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==} engines: {node: '>=4'} @@ -5272,6 +5493,11 @@ packages: object-keys: 1.1.1 dev: false + /delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + dev: false + /detect-indent@6.1.0: resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} engines: {node: '>=8'} @@ -5322,6 +5548,17 @@ packages: resolution: {integrity: sha512-NMt+m9zFMPZe0JcY9gN224Qvk6qLIdqex29clBvc/y75ZBX9YA9wNK3frsYvu2DI1xcCIwxwnX+TlsJ2DSOADg==} dev: false + /domexception@4.0.0: + resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==} + engines: {node: '>=12'} + dependencies: + webidl-conversions: 7.0.0 + dev: false + + /dompurify@2.4.7: + resolution: {integrity: sha512-kxxKlPEDa6Nc5WJi+qRgPbOAbgTpSULL+vI3NUXsZMlkJxTqYI9wg5ZTay2sFrdZRWHPWNi+EdAhcJf81WtoMQ==} + dev: false + /dot-prop@5.3.0: resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==} engines: {node: '>=8'} @@ -5391,6 +5628,11 @@ packages: ansi-colors: 4.1.3 dev: false + /entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + dev: false + /error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} dependencies: @@ -5549,6 +5791,18 @@ packages: engines: {node: '>=10'} dev: false + /escodegen@2.1.0: + resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} + engines: {node: '>=6.0'} + hasBin: true + dependencies: + esprima: 4.0.1 + estraverse: 5.3.0 + esutils: 2.0.3 + optionalDependencies: + source-map: 0.6.1 + dev: false + /eslint-config-prettier@8.10.0(eslint@8.50.0): resolution: {integrity: sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==} hasBin: true @@ -6101,10 +6355,26 @@ packages: to-regex-range: 5.0.1 dev: false + /find-cache-dir@2.1.0: + resolution: {integrity: sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==} + engines: {node: '>=6'} + dependencies: + commondir: 1.0.1 + make-dir: 2.1.0 + pkg-dir: 3.0.0 + dev: false + /find-root@1.1.0: resolution: {integrity: sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==} dev: false + /find-up@3.0.0: + resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==} + engines: {node: '>=6'} + dependencies: + locate-path: 3.0.0 + dev: false + /find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -6154,6 +6424,15 @@ packages: is-callable: 1.2.7 dev: false + /form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: false + /fs-extra@11.1.0: resolution: {integrity: sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==} engines: {node: '>=14.14'} @@ -6482,6 +6761,13 @@ packages: lru-cache: 6.0.0 dev: false + /html-encoding-sniffer@3.0.0: + resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} + engines: {node: '>=12'} + dependencies: + whatwg-encoding: 2.0.0 + dev: false + /html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} dev: false @@ -6490,6 +6776,27 @@ packages: resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==} dev: false + /http-proxy-agent@5.0.0: + resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==} + engines: {node: '>= 6'} + dependencies: + '@tootallnate/once': 2.0.0 + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: false + + /https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + dependencies: + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: false + /human-id@1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} dev: false @@ -6517,6 +6824,13 @@ packages: safer-buffer: 2.1.2 dev: false + /iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: false + /ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: false @@ -6764,6 +7078,17 @@ packages: engines: {node: '>=0.10.0'} dev: false + /is-plain-object@2.0.4: + resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} + engines: {node: '>=0.10.0'} + dependencies: + isobject: 3.0.1 + dev: false + + /is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + dev: false + /is-reference@1.2.1: resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} dependencies: @@ -6879,6 +7204,11 @@ packages: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: false + /isobject@3.0.1: + resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} + engines: {node: '>=0.10.0'} + dev: false + /istanbul-lib-coverage@3.2.0: resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} engines: {node: '>=8'} @@ -6888,11 +7218,11 @@ packages: resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==} engines: {node: '>=8'} dependencies: - '@babel/core': 7.21.0 - '@babel/parser': 7.21.2 + '@babel/core': 7.23.0 + '@babel/parser': 7.23.0 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.0 - semver: 6.3.0 + semver: 6.3.1 transitivePeerDependencies: - supports-color dev: false @@ -6901,8 +7231,8 @@ packages: resolution: {integrity: sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw==} engines: {node: '>=10'} dependencies: - '@babel/core': 7.21.0 - '@babel/parser': 7.21.2 + '@babel/core': 7.23.0 + '@babel/parser': 7.23.0 '@istanbuljs/schema': 0.1.3 istanbul-lib-coverage: 3.2.0 semver: 7.5.4 @@ -7026,11 +7356,11 @@ packages: ts-node: optional: true dependencies: - '@babel/core': 7.21.0 + '@babel/core': 7.23.0 '@jest/test-sequencer': 29.7.0 '@jest/types': 29.6.3 '@types/node': 18.18.1 - babel-jest: 29.7.0(@babel/core@7.21.0) + babel-jest: 29.7.0(@babel/core@7.23.0) chalk: 4.1.2 ci-info: 3.5.0 deepmerge: 4.2.2 @@ -7172,7 +7502,7 @@ packages: resolution: {integrity: sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@babel/code-frame': 7.18.6 + '@babel/code-frame': 7.22.13 '@jest/types': 29.5.0 '@types/stack-utils': 2.0.1 chalk: 4.1.2 @@ -7187,7 +7517,7 @@ packages: resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@babel/code-frame': 7.18.6 + '@babel/code-frame': 7.22.13 '@jest/types': 29.6.3 '@types/stack-utils': 2.0.1 chalk: 4.1.2 @@ -7342,15 +7672,15 @@ packages: resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@babel/core': 7.21.0 - '@babel/generator': 7.21.1 - '@babel/plugin-syntax-jsx': 7.18.6(@babel/core@7.21.0) - '@babel/plugin-syntax-typescript': 7.18.6(@babel/core@7.21.0) - '@babel/types': 7.21.4 + '@babel/core': 7.23.0 + '@babel/generator': 7.23.0 + '@babel/plugin-syntax-jsx': 7.18.6(@babel/core@7.23.0) + '@babel/plugin-syntax-typescript': 7.18.6(@babel/core@7.23.0) + '@babel/types': 7.23.0 '@jest/expect-utils': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - babel-preset-current-node-syntax: 1.0.1(@babel/core@7.21.0) + babel-preset-current-node-syntax: 1.0.1(@babel/core@7.23.0) chalk: 4.1.2 expect: 29.7.0 graceful-fs: 4.2.10 @@ -7530,6 +7860,47 @@ packages: argparse: 2.0.1 dev: false + /jsdom@21.1.2: + resolution: {integrity: sha512-sCpFmK2jv+1sjff4u7fzft+pUh2KSUbUrEHYHyfSIbGTIcmnjyp83qg6qLwdJ/I3LpTXx33ACxeRL7Lsyc6lGQ==} + engines: {node: '>=14'} + peerDependencies: + canvas: ^2.5.0 + peerDependenciesMeta: + canvas: + optional: true + dependencies: + abab: 2.0.6 + acorn: 8.10.0 + acorn-globals: 7.0.1 + cssstyle: 3.0.0 + data-urls: 4.0.0 + decimal.js: 10.4.3 + domexception: 4.0.0 + escodegen: 2.1.0 + form-data: 4.0.0 + html-encoding-sniffer: 3.0.0 + http-proxy-agent: 5.0.0 + https-proxy-agent: 5.0.1 + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.7 + parse5: 7.1.2 + rrweb-cssom: 0.6.0 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 4.1.3 + w3c-xmlserializer: 4.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 2.0.0 + whatwg-mimetype: 3.0.0 + whatwg-url: 12.0.1 + ws: 8.14.2 + xml-name-validator: 4.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: false + /jsesc@0.5.0: resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} hasBin: true @@ -7701,6 +8072,14 @@ packages: strip-bom: 3.0.0 dev: false + /locate-path@3.0.0: + resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==} + engines: {node: '>=6'} + dependencies: + p-locate: 3.0.0 + path-exists: 3.0.0 + dev: false + /locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -7844,11 +8223,19 @@ packages: '@jridgewell/sourcemap-codec': 1.4.14 dev: false + /make-dir@2.1.0: + resolution: {integrity: sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==} + engines: {node: '>=6'} + dependencies: + pify: 4.0.1 + semver: 5.7.2 + dev: false + /make-dir@3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} dependencies: - semver: 6.3.0 + semver: 6.3.1 dev: false /make-error@1.3.6: @@ -7939,6 +8326,18 @@ packages: picomatch: 2.3.1 dev: false + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + dev: false + + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + dependencies: + mime-db: 1.52.0 + dev: false + /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -8099,6 +8498,10 @@ packages: path-key: 4.0.0 dev: false + /nwsapi@2.2.7: + resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} + dev: false + /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -8174,6 +8577,13 @@ packages: es-abstract: 1.20.4 dev: false + /omit-empty-es@1.1.3: + resolution: {integrity: sha512-rqEprmXZ0CaOcY7vtCdRLm7QPrmyst30GN4WWsUwcbvosHF55cszEZ6Gg9SNnVIiXC91luURcSp+xChg2ymjkA==} + dependencies: + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 + dev: false + /once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: @@ -8248,6 +8658,13 @@ packages: yocto-queue: 1.0.0 dev: false + /p-locate@3.0.0: + resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==} + engines: {node: '>=6'} + dependencies: + p-limit: 2.3.0 + dev: false + /p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -8322,6 +8739,17 @@ packages: lines-and-columns: 1.2.4 dev: false + /parse5@7.1.2: + resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} + dependencies: + entities: 4.5.0 + dev: false + + /path-exists@3.0.0: + resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} + engines: {node: '>=4'} + dev: false + /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -8381,6 +8809,13 @@ packages: engines: {node: '>= 6'} dev: false + /pkg-dir@3.0.0: + resolution: {integrity: sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==} + engines: {node: '>=6'} + dependencies: + find-up: 3.0.0 + dev: false + /pkg-dir@4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} @@ -8475,6 +8910,10 @@ packages: resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==} dev: false + /psl@1.9.0: + resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + dev: false + /pump@3.0.0: resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} dependencies: @@ -8487,10 +8926,19 @@ packages: engines: {node: '>=6'} dev: false + /punycode@2.3.0: + resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} + engines: {node: '>=6'} + dev: false + /pure-rand@6.0.1: resolution: {integrity: sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg==} dev: false + /querystringify@2.2.0: + resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + dev: false + /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: false @@ -8684,6 +9132,10 @@ packages: engines: {node: '>=0.10.5'} dev: false + /requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + dev: false + /resolve-cwd@3.0.0: resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} engines: {node: '>=8'} @@ -8773,6 +9225,10 @@ packages: fsevents: 2.3.2 dev: false + /rrweb-cssom@0.6.0: + resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} + dev: false + /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -8805,6 +9261,13 @@ packages: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: false + /saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + dependencies: + xmlchars: 2.2.0 + dev: false + /sembear@0.5.2: resolution: {integrity: sha512-Ij1vCAdFgWABd7zTg50Xw1/p0JgESNxuLlneEAsmBrKishA06ulTTL/SHGmNy2Zud7+rKrHTKNI6moJsn1ppAQ==} dependencies: @@ -8856,6 +9319,13 @@ packages: has-property-descriptors: 1.0.0 dev: false + /shallow-clone@3.0.1: + resolution: {integrity: sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==} + engines: {node: '>=8'} + dependencies: + kind-of: 6.0.3 + dev: false + /shebang-command@1.2.0: resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==} engines: {node: '>=0.10.0'} @@ -9203,6 +9673,10 @@ packages: engines: {node: '>= 0.4'} dev: false + /symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + dev: false + /tapable@2.2.1: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} @@ -9284,10 +9758,27 @@ packages: is-number: 7.0.0 dev: false + /tough-cookie@4.1.3: + resolution: {integrity: sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==} + engines: {node: '>=6'} + dependencies: + psl: 1.9.0 + punycode: 2.3.0 + universalify: 0.2.0 + url-parse: 1.5.10 + dev: false + /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} dev: false + /tr46@4.1.1: + resolution: {integrity: sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==} + engines: {node: '>=14'} + dependencies: + punycode: 2.3.0 + dev: false + /trim-newlines@3.0.1: resolution: {integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==} engines: {node: '>=8'} @@ -9519,6 +10010,11 @@ packages: engines: {node: '>= 4.0.0'} dev: false + /universalify@0.2.0: + resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} + engines: {node: '>= 4.0.0'} + dev: false + /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} @@ -9559,6 +10055,13 @@ packages: prepend-http: 2.0.0 dev: false + /url-parse@1.5.10: + resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} + dependencies: + querystringify: 2.2.0 + requires-port: 1.0.0 + dev: false + /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: false @@ -9593,6 +10096,13 @@ packages: builtins: 1.0.3 dev: false + /w3c-xmlserializer@4.0.0: + resolution: {integrity: sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==} + engines: {node: '>=14'} + dependencies: + xml-name-validator: 4.0.0 + dev: false + /walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} dependencies: @@ -9609,6 +10119,31 @@ packages: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} dev: false + /webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + dev: false + + /whatwg-encoding@2.0.0: + resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} + engines: {node: '>=12'} + dependencies: + iconv-lite: 0.6.3 + dev: false + + /whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} + dev: false + + /whatwg-url@12.0.1: + resolution: {integrity: sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==} + engines: {node: '>=14'} + dependencies: + tr46: 4.1.1 + webidl-conversions: 7.0.0 + dev: false + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: @@ -9742,6 +10277,28 @@ packages: signal-exit: 3.0.7 dev: false + /ws@8.14.2: + resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + + /xml-name-validator@4.0.0: + resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} + engines: {node: '>=12'} + dev: false + + /xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + dev: false + /y18n@4.0.3: resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} dev: false From f8b6907bfebfc01877d299153c87ea4a53d9cc14 Mon Sep 17 00:00:00 2001 From: Nicola Molinari Date: Wed, 18 Oct 2023 12:27:20 +0200 Subject: [PATCH 07/11] docs: changesets --- .changeset/olive-jobs-dress.md | 14 ++++++++++++++ .changeset/warm-moons-laugh.md | 5 +++++ models/custom-view/README.md | 9 +++++---- models/custom-view/src/index.ts | 5 +++++ 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 .changeset/olive-jobs-dress.md create mode 100644 .changeset/warm-moons-laugh.md diff --git a/.changeset/olive-jobs-dress.md b/.changeset/olive-jobs-dress.md new file mode 100644 index 000000000..cdffaa400 --- /dev/null +++ b/.changeset/olive-jobs-dress.md @@ -0,0 +1,14 @@ +--- +'@commercetools-test-data/custom-view': minor +--- + +New package to generate test data for Custom Views. + +```ts +import { + CustomView, + type TCustomViewGraphql, +} from '@commercetools-test-data/custom-view'; + +const customView = CustomView.random().buildGraphql(); +``` diff --git a/.changeset/warm-moons-laugh.md b/.changeset/warm-moons-laugh.md new file mode 100644 index 000000000..21dd71d45 --- /dev/null +++ b/.changeset/warm-moons-laugh.md @@ -0,0 +1,5 @@ +--- +'@commercetools-test-data/commons': minor +--- + +Add new model `LocalizedField` diff --git a/models/custom-view/README.md b/models/custom-view/README.md index 87958a4d6..7bc0d72e5 100644 --- a/models/custom-view/README.md +++ b/models/custom-view/README.md @@ -14,10 +14,11 @@ $ pnpm add -D @commercetools-test-data/custom-view import { CustomView, CustomViewDraft, - type TCustomView, - type TCustomViewDraft, + type TCustomViewGraphql, + type TCustomViewDraftGraphql, } from '@commercetools-test-data/custom-view'; -const customView = CustomView.random().build(); -const customViewDraft = CustomViewDraft.random().build(); +const customView = CustomView.random().buildGraphql(); +const customViewDraft = + CustomViewDraft.random().buildGraphql(); ``` diff --git a/models/custom-view/src/index.ts b/models/custom-view/src/index.ts index 79f2f3b8b..c6fde5efb 100644 --- a/models/custom-view/src/index.ts +++ b/models/custom-view/src/index.ts @@ -1,6 +1,11 @@ // Export types export * from './custom-view/types'; +export * from './custom-view-permission/types'; +export * from './custom-view-type-settings/types'; // Export models export * as CustomView from './custom-view'; export * as CustomViewDraft from './custom-view/custom-view-draft'; + +export * as CustomViewPermission from './custom-view-permission'; +export * as CustomViewTypeSettings from './custom-view-type-settings'; From 39462a7494e8d09965efe9218b9d5d48949b9667 Mon Sep 17 00:00:00 2001 From: Nicola Molinari Date: Wed, 18 Oct 2023 12:33:26 +0200 Subject: [PATCH 08/11] refactor(custom-views): rename model to CustomViewTypeSettingsForCustomPanel --- .../builder.spec.ts | 15 ++++++++----- .../builder.ts | 8 +++---- .../generator.ts | 4 ++-- .../index.ts | 0 .../presets/index.ts | 0 .../transformers.ts | 22 +++++++++++++++++++ .../types.ts | 16 ++++++++++++++ .../custom-view-type-settings/transformers.ts | 22 ------------------- .../src/custom-view-type-settings/types.ts | 19 ---------------- .../custom-view-draft/generator.ts | 2 +- .../custom-view/src/custom-view/generator.ts | 4 ++-- models/custom-view/src/index.ts | 4 ++-- 12 files changed, 58 insertions(+), 58 deletions(-) rename models/custom-view/src/{custom-view-type-settings => custom-view-type-settings-for-custom-panel}/builder.spec.ts (63%) rename models/custom-view/src/{custom-view-type-settings => custom-view-type-settings-for-custom-panel}/builder.ts (51%) rename models/custom-view/src/{custom-view-type-settings => custom-view-type-settings-for-custom-panel}/generator.ts (62%) rename models/custom-view/src/{custom-view-type-settings => custom-view-type-settings-for-custom-panel}/index.ts (100%) rename models/custom-view/src/{custom-view-type-settings => custom-view-type-settings-for-custom-panel}/presets/index.ts (100%) create mode 100644 models/custom-view/src/custom-view-type-settings-for-custom-panel/transformers.ts create mode 100644 models/custom-view/src/custom-view-type-settings-for-custom-panel/types.ts delete mode 100644 models/custom-view/src/custom-view-type-settings/transformers.ts delete mode 100644 models/custom-view/src/custom-view-type-settings/types.ts diff --git a/models/custom-view/src/custom-view-type-settings/builder.spec.ts b/models/custom-view/src/custom-view-type-settings-for-custom-panel/builder.spec.ts similarity index 63% rename from models/custom-view/src/custom-view-type-settings/builder.spec.ts rename to models/custom-view/src/custom-view-type-settings-for-custom-panel/builder.spec.ts index 29de6dd7e..094726303 100644 --- a/models/custom-view/src/custom-view-type-settings/builder.spec.ts +++ b/models/custom-view/src/custom-view-type-settings-for-custom-panel/builder.spec.ts @@ -2,26 +2,29 @@ /* eslint-disable jest/valid-title */ import { createBuilderSpec } from '@commercetools-test-data/core/test-utils'; import type { - TCustomViewTypeSettings, - TCustomViewTypeSettingsGraphql, + TCustomViewTypeSettingsForCustomPanel, + TCustomViewTypeSettingsForCustomPanelGraphql, } from './types'; import * as CustomViewTypeSettings from './index'; describe('builder', () => { it( - ...createBuilderSpec( + ...createBuilderSpec< + TCustomViewTypeSettingsForCustomPanel, + TCustomViewTypeSettingsForCustomPanel + >( 'default', CustomViewTypeSettings.random(), expect.objectContaining({ - size: expect.stringMatching(/SMALL|LARGE/), + size: expect.stringMatching(/^(SMALL|LARGE)$/), }) ) ); it( ...createBuilderSpec< - TCustomViewTypeSettings, - TCustomViewTypeSettingsGraphql + TCustomViewTypeSettingsForCustomPanel, + TCustomViewTypeSettingsForCustomPanelGraphql >( 'graphql', CustomViewTypeSettings.random().size('SMALL'), diff --git a/models/custom-view/src/custom-view-type-settings/builder.ts b/models/custom-view/src/custom-view-type-settings-for-custom-panel/builder.ts similarity index 51% rename from models/custom-view/src/custom-view-type-settings/builder.ts rename to models/custom-view/src/custom-view-type-settings-for-custom-panel/builder.ts index ee0cd1259..b91524cdb 100644 --- a/models/custom-view/src/custom-view-type-settings/builder.ts +++ b/models/custom-view/src/custom-view-type-settings-for-custom-panel/builder.ts @@ -2,12 +2,12 @@ import { Builder } from '@commercetools-test-data/core'; import generator from './generator'; import transformers from './transformers'; import type { - TCustomViewTypeSettings, - TCreateCustomViewTypeSettingsBuilder, + TCustomViewTypeSettingsForCustomPanel, + TCreateCustomViewTypeSettingsForCustomPanelBuilder, } from './types'; -const Model: TCreateCustomViewTypeSettingsBuilder = () => - Builder({ +const Model: TCreateCustomViewTypeSettingsForCustomPanelBuilder = () => + Builder({ generator, transformers, }); diff --git a/models/custom-view/src/custom-view-type-settings/generator.ts b/models/custom-view/src/custom-view-type-settings-for-custom-panel/generator.ts similarity index 62% rename from models/custom-view/src/custom-view-type-settings/generator.ts rename to models/custom-view/src/custom-view-type-settings-for-custom-panel/generator.ts index 15d21459c..f511461ee 100644 --- a/models/custom-view/src/custom-view-type-settings/generator.ts +++ b/models/custom-view/src/custom-view-type-settings-for-custom-panel/generator.ts @@ -1,7 +1,7 @@ import { fake, Generator } from '@commercetools-test-data/core'; -import type { TCustomViewTypeSettings } from './types'; +import type { TCustomViewTypeSettingsForCustomPanel } from './types'; -const generator = Generator({ +const generator = Generator({ fields: { // Assumes that the type is `CustomPanel`. size: fake((f) => f.helpers.arrayElement(['SMALL', 'LARGE'])), diff --git a/models/custom-view/src/custom-view-type-settings/index.ts b/models/custom-view/src/custom-view-type-settings-for-custom-panel/index.ts similarity index 100% rename from models/custom-view/src/custom-view-type-settings/index.ts rename to models/custom-view/src/custom-view-type-settings-for-custom-panel/index.ts diff --git a/models/custom-view/src/custom-view-type-settings/presets/index.ts b/models/custom-view/src/custom-view-type-settings-for-custom-panel/presets/index.ts similarity index 100% rename from models/custom-view/src/custom-view-type-settings/presets/index.ts rename to models/custom-view/src/custom-view-type-settings-for-custom-panel/presets/index.ts diff --git a/models/custom-view/src/custom-view-type-settings-for-custom-panel/transformers.ts b/models/custom-view/src/custom-view-type-settings-for-custom-panel/transformers.ts new file mode 100644 index 000000000..c445f0a46 --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings-for-custom-panel/transformers.ts @@ -0,0 +1,22 @@ +import { Transformer } from '@commercetools-test-data/core'; +import type { + TCustomViewTypeSettingsForCustomPanel, + TCustomViewTypeSettingsForCustomPanelGraphql, +} from './types'; + +const transformers = { + default: Transformer< + TCustomViewTypeSettingsForCustomPanel, + TCustomViewTypeSettingsForCustomPanel + >('default', {}), + graphql: Transformer< + TCustomViewTypeSettingsForCustomPanel, + TCustomViewTypeSettingsForCustomPanelGraphql + >('graphql', { + addFields: () => ({ + __typename: 'CustomViewTypeSettings', + }), + }), +}; + +export default transformers; diff --git a/models/custom-view/src/custom-view-type-settings-for-custom-panel/types.ts b/models/custom-view/src/custom-view-type-settings-for-custom-panel/types.ts new file mode 100644 index 000000000..e35466665 --- /dev/null +++ b/models/custom-view/src/custom-view-type-settings-for-custom-panel/types.ts @@ -0,0 +1,16 @@ +import { TBuilder } from '@commercetools-test-data/core'; + +export type CustomViewSize = 'SMALL' | 'LARGE'; + +export type TCustomViewTypeSettingsForCustomPanel = { + size: CustomViewSize; +}; +export type TCustomViewTypeSettingsForCustomPanelGraphql = + TCustomViewTypeSettingsForCustomPanel & { + __typename: 'CustomViewTypeSettings'; + }; + +export type TCustomViewTypeSettingsForCustomPanelBuilder = + TBuilder; +export type TCreateCustomViewTypeSettingsForCustomPanelBuilder = + () => TCustomViewTypeSettingsForCustomPanelBuilder; diff --git a/models/custom-view/src/custom-view-type-settings/transformers.ts b/models/custom-view/src/custom-view-type-settings/transformers.ts deleted file mode 100644 index e1fd29232..000000000 --- a/models/custom-view/src/custom-view-type-settings/transformers.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Transformer } from '@commercetools-test-data/core'; -import type { - TCustomViewTypeSettings, - TCustomViewTypeSettingsGraphql, -} from './types'; - -const transformers = { - default: Transformer( - 'default', - {} - ), - graphql: Transformer( - 'graphql', - { - addFields: () => ({ - __typename: 'CustomViewTypeSettings', - }), - } - ), -}; - -export default transformers; diff --git a/models/custom-view/src/custom-view-type-settings/types.ts b/models/custom-view/src/custom-view-type-settings/types.ts deleted file mode 100644 index 8869c956d..000000000 --- a/models/custom-view/src/custom-view-type-settings/types.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { TBuilder } from '@commercetools-test-data/core'; - -export type CustomViewSize = 'SMALL' | 'LARGE'; - -export type TCustomViewTypeSettings = { - size?: CustomViewSize; -}; -export type TCustomViewTypeSettingsGraphql = TCustomViewTypeSettings & { - __typename: 'CustomViewTypeSettings'; -}; - -export type TCustomViewTypeSettingsBuilder = TBuilder; -export type TCreateCustomViewTypeSettingsBuilder = - () => TCustomViewTypeSettingsBuilder; - -export type TCustomViewTypeSettingsDraftBuilder = - TBuilder; -export type TCreateCustomViewTypeSettingsDraftBuilder = - () => TCustomViewTypeSettingsDraftBuilder; diff --git a/models/custom-view/src/custom-view/custom-view-draft/generator.ts b/models/custom-view/src/custom-view/custom-view-draft/generator.ts index 0ffa7c688..1d2d89342 100644 --- a/models/custom-view/src/custom-view/custom-view-draft/generator.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/generator.ts @@ -1,7 +1,7 @@ import { LocalizedField } from '@commercetools-test-data/commons'; import { fake, Generator } from '@commercetools-test-data/core'; import * as CustomViewPermission from '../../custom-view-permission'; -import * as CustomViewTypeSettings from '../../custom-view-type-settings'; +import * as CustomViewTypeSettings from '../../custom-view-type-settings-for-custom-panel'; import { TCustomViewDraft } from '../types'; import { defaultLocators } from '../utils'; diff --git a/models/custom-view/src/custom-view/generator.ts b/models/custom-view/src/custom-view/generator.ts index d309d0ed8..ee0d103e2 100644 --- a/models/custom-view/src/custom-view/generator.ts +++ b/models/custom-view/src/custom-view/generator.ts @@ -2,7 +2,7 @@ import { LocalizedField } from '@commercetools-test-data/commons'; import { fake, Generator } from '@commercetools-test-data/core'; import { createRelatedDates } from '@commercetools-test-data/utils'; import * as CustomViewPermission from '../custom-view-permission'; -import * as CustomViewTypeSettings from '../custom-view-type-settings'; +import * as CustomViewTypeSettingsForCustomPanel from '../custom-view-type-settings-for-custom-panel'; import { TCustomView } from './types'; import { defaultLocators } from './utils'; @@ -28,7 +28,7 @@ const generator = Generator({ ]), status: fake((f) => f.helpers.arrayElement(['DRAFT', 'PRIVATE_USAGE'])), type: fake((f) => f.helpers.arrayElement(['CustomPanel'])), - typeSettings: fake((f) => CustomViewTypeSettings.random()), + typeSettings: fake((f) => CustomViewTypeSettingsForCustomPanel.random()), createdAt: fake(getOlderDate), updatedAt: fake(getNewerDate), }, diff --git a/models/custom-view/src/index.ts b/models/custom-view/src/index.ts index c6fde5efb..ddd37ef26 100644 --- a/models/custom-view/src/index.ts +++ b/models/custom-view/src/index.ts @@ -1,11 +1,11 @@ // Export types export * from './custom-view/types'; export * from './custom-view-permission/types'; -export * from './custom-view-type-settings/types'; +export * from './custom-view-type-settings-for-custom-panel/types'; // Export models export * as CustomView from './custom-view'; export * as CustomViewDraft from './custom-view/custom-view-draft'; export * as CustomViewPermission from './custom-view-permission'; -export * as CustomViewTypeSettings from './custom-view-type-settings'; +export * as CustomViewTypeSettingsForCustomPanel from './custom-view-type-settings-for-custom-panel'; From fb486129b3cf85e5f133e2342677d65389339545 Mon Sep 17 00:00:00 2001 From: Nicola Molinari Date: Wed, 18 Oct 2023 12:44:07 +0200 Subject: [PATCH 09/11] refactor(custom-views): minor improvements --- .../custom-view/src/custom-view/constants.ts | 10 ++++++ .../custom-view/src/custom-view/generator.ts | 4 +-- models/custom-view/src/custom-view/utils.ts | 35 ------------------- 3 files changed, 12 insertions(+), 37 deletions(-) create mode 100644 models/custom-view/src/custom-view/constants.ts delete mode 100644 models/custom-view/src/custom-view/utils.ts diff --git a/models/custom-view/src/custom-view/constants.ts b/models/custom-view/src/custom-view/constants.ts new file mode 100644 index 000000000..eb62d14f3 --- /dev/null +++ b/models/custom-view/src/custom-view/constants.ts @@ -0,0 +1,10 @@ +export const defaultLocators = [ + 'products.product_details.general', + 'products.product_variant_details.general', + 'categories.category_details.external_search', + 'customers.customer_addresses.edit_address', + 'orders.order_details.custom_field', + 'standalone_prices.standalone_price_details', + 'discounts.product_discount_details.custom_fields', + 'operations.import_log_details', +]; diff --git a/models/custom-view/src/custom-view/generator.ts b/models/custom-view/src/custom-view/generator.ts index ee0d103e2..f19882b4c 100644 --- a/models/custom-view/src/custom-view/generator.ts +++ b/models/custom-view/src/custom-view/generator.ts @@ -3,8 +3,8 @@ import { fake, Generator } from '@commercetools-test-data/core'; import { createRelatedDates } from '@commercetools-test-data/utils'; import * as CustomViewPermission from '../custom-view-permission'; import * as CustomViewTypeSettingsForCustomPanel from '../custom-view-type-settings-for-custom-panel'; +import { defaultLocators } from './constants'; import { TCustomView } from './types'; -import { defaultLocators } from './utils'; const [getOlderDate, getNewerDate] = createRelatedDates(); @@ -19,7 +19,7 @@ const generator = Generator({ locators: fake((f) => f.helpers.arrayElements(defaultLocators, { min: 1, - max: defaultLocators.length, + max: 4, }) ), permissions: fake(() => [ diff --git a/models/custom-view/src/custom-view/utils.ts b/models/custom-view/src/custom-view/utils.ts deleted file mode 100644 index 193bd4b68..000000000 --- a/models/custom-view/src/custom-view/utils.ts +++ /dev/null @@ -1,35 +0,0 @@ -const upperFirst = (word: string) => word[0].toUpperCase() + word.slice(1); - -export const formatCustomViewIdToResourceAccessKey = ( - entryPointUriPath: string -) => - entryPointUriPath - // Splits the string by underscore. - .split('_') - // Uppercase the first character of each word split. - .map(upperFirst) - // Join the words by an underscore. - .join('_') - // Each word is split by a hyphen. - .split('-') - .map((word, i) => { - // Regex below checking if the character is numeric. - // If the word after the hyphen is numeric, replace the hyphen with a forward slash. - // If not, omit the hyphen and uppercase the first character - if (i > 0 && /^-?\d+$/.test(word[0])) { - return `/${word}`; - } - return upperFirst(word); - }) - .join(''); - -export const defaultLocators = [ - 'products.product_details.general', - 'products.product_variant_details.general', - 'categories.category_details.external_search', - 'customers.customer_addresses.edit_address', - 'orders.order_details.custom_field', - 'standalone_prices.standalone_price_details', - 'discounts.product_discount_details.custom_fields', - 'operations.import_log_details', -]; From 1c6e74dbca5f4cdd8ace2d133028939a895a766e Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Wed, 18 Oct 2023 18:03:35 +0200 Subject: [PATCH 10/11] fix(models): fix custom view draft model import --- .../custom-view/src/custom-view/custom-view-draft/generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/custom-view/src/custom-view/custom-view-draft/generator.ts b/models/custom-view/src/custom-view/custom-view-draft/generator.ts index 1d2d89342..903676fdd 100644 --- a/models/custom-view/src/custom-view/custom-view-draft/generator.ts +++ b/models/custom-view/src/custom-view/custom-view-draft/generator.ts @@ -2,8 +2,8 @@ import { LocalizedField } from '@commercetools-test-data/commons'; import { fake, Generator } from '@commercetools-test-data/core'; import * as CustomViewPermission from '../../custom-view-permission'; import * as CustomViewTypeSettings from '../../custom-view-type-settings-for-custom-panel'; +import { defaultLocators } from '../constants'; import { TCustomViewDraft } from '../types'; -import { defaultLocators } from '../utils'; const generator = Generator({ fields: { From 6055940991ef1222aa700519dde81fccc480b98b Mon Sep 17 00:00:00 2001 From: Carlos Martinez Date: Wed, 18 Oct 2023 19:43:56 +0200 Subject: [PATCH 11/11] chore: update app-kit dependencies --- models/custom-view/package.json | 4 +- pnpm-lock.yaml | 109 ++++++++++++++++++++++++-------- 2 files changed, 85 insertions(+), 28 deletions(-) diff --git a/models/custom-view/package.json b/models/custom-view/package.json index 60054e560..c2f524909 100644 --- a/models/custom-view/package.json +++ b/models/custom-view/package.json @@ -19,8 +19,8 @@ "dependencies": { "@babel/runtime": "^7.17.9", "@babel/runtime-corejs3": "^7.17.9", - "@commercetools-frontend/application-config": "^22.9.1", - "@commercetools-frontend/constants": "^22.9.1", + "@commercetools-frontend/application-config": "^22.10.0", + "@commercetools-frontend/constants": "^22.10.0", "@commercetools-test-data/commons": "6.3.8", "@commercetools-test-data/core": "6.3.8", "@commercetools-test-data/utils": "6.3.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e38b354dc..bf39b3304 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -291,11 +291,11 @@ importers: specifier: ^7.17.9 version: 7.21.0 '@commercetools-frontend/application-config': - specifier: ^22.9.1 - version: 22.9.1 + specifier: ^22.10.0 + version: 22.10.0 '@commercetools-frontend/constants': - specifier: ^22.9.1 - version: 22.9.1 + specifier: ^22.10.0 + version: 22.10.0 '@commercetools-test-data/commons': specifier: 6.3.8 version: link:../commons @@ -459,6 +459,30 @@ importers: specifier: ^8.0.0 version: 8.0.0 + models/organization-extension: + dependencies: + '@babel/runtime': + specifier: ^7.17.9 + version: 7.23.1 + '@babel/runtime-corejs3': + specifier: ^7.17.9 + version: 7.23.1 + '@commercetools-test-data/commons': + specifier: 6.0.0 + version: 6.0.0 + '@commercetools-test-data/core': + specifier: 6.0.0 + version: 6.0.0 + '@commercetools-test-data/utils': + specifier: 6.0.0 + version: 6.0.0 + '@commercetools/platform-sdk': + specifier: ^4.11.0 + version: 4.11.0 + '@faker-js/faker': + specifier: ^8.0.0 + version: 8.0.0 + models/payment: dependencies: '@babel/runtime': @@ -2552,7 +2576,7 @@ packages: /@changesets/apply-release-plan@6.1.4: resolution: {integrity: sha512-FMpKF1fRlJyCZVYHr3CbinpZZ+6MwvOtWUuO8uo+svcATEoc1zRDcj23pAurJ2TZ/uVz1wFHH6K3NlACy0PLew==} dependencies: - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.1 '@changesets/config': 2.3.1 '@changesets/get-version-range-type': 0.3.2 '@changesets/git': 2.0.0 @@ -2570,7 +2594,7 @@ packages: /@changesets/assemble-release-plan@5.2.4: resolution: {integrity: sha512-xJkWX+1/CUaOUWTguXEbCDTyWJFECEhmdtbkjhn5GVBGxdP/JwaHBIU9sW3FR6gD07UwZ7ovpiPclQZs+j+mvg==} dependencies: - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.1 '@changesets/errors': 0.1.4 '@changesets/get-dependents-graph': 1.3.6 '@changesets/types': 5.2.1 @@ -2673,7 +2697,7 @@ packages: /@changesets/get-release-plan@3.0.17: resolution: {integrity: sha512-6IwKTubNEgoOZwDontYc2x2cWXfr6IKxP3IhKeK+WjyD6y3M4Gl/jdQvBw+m/5zWILSOCAaGLu2ZF6Q+WiPniw==} dependencies: - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.1 '@changesets/assemble-release-plan': 5.2.4 '@changesets/config': 2.3.1 '@changesets/pre': 1.0.14 @@ -2689,7 +2713,7 @@ packages: /@changesets/git@2.0.0: resolution: {integrity: sha512-enUVEWbiqUTxqSnmesyJGWfzd51PY4H7mH9yUw0hPVpZBJ6tQZFMU3F3mT/t9OJ/GjyiM4770i+sehAn6ymx6A==} dependencies: - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.1 '@changesets/errors': 0.1.4 '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 @@ -2714,7 +2738,7 @@ packages: /@changesets/pre@1.0.14: resolution: {integrity: sha512-dTsHmxQWEQekHYHbg+M1mDVYFvegDh9j/kySNuDKdylwfMEevTeDouR7IfHNyVodxZXu17sXoJuf2D0vi55FHQ==} dependencies: - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.1 '@changesets/errors': 0.1.4 '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 @@ -2724,7 +2748,7 @@ packages: /@changesets/read@0.5.9: resolution: {integrity: sha512-T8BJ6JS6j1gfO1HFq50kU3qawYxa4NTbI/ASNVVCBTsKquy2HYwM9r7ZnzkiMe8IEObAJtUVGSrePCOxAK2haQ==} dependencies: - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.1 '@changesets/git': 2.0.0 '@changesets/logger': 0.0.5 '@changesets/parse': 0.3.16 @@ -2745,23 +2769,23 @@ packages: /@changesets/write@0.2.3: resolution: {integrity: sha512-Dbamr7AIMvslKnNYsLFafaVORx4H0pvCA2MHqgtNCySMe1blImEyAEOzDmcgKAkgz4+uwoLz7demIrX+JBr/Xw==} dependencies: - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.1 '@changesets/types': 5.2.1 fs-extra: 7.0.1 human-id: 1.0.2 prettier: 2.8.8 dev: false - /@commercetools-frontend/application-config@22.9.1: - resolution: {integrity: sha512-VU4pPN76S7vcTSG0YN1k6pEWIYFuxsbsA8Hi3sbJMLhJYyDCvpMqBDrDNbmsmt1dMRRsdkvvtIS1/WHGxlH6IA==} + /@commercetools-frontend/application-config@22.10.0: + resolution: {integrity: sha512-g94zHyhRONOJAM7dysGsZJeVVRf65287msWiRcjb/1pLou/7pWWiDW2BOSs2iJ6953XTqCa1hxuRebTOpgXm2g==} engines: {node: 16.x || >=18.0.0} dependencies: '@babel/core': 7.23.0 '@babel/register': 7.22.15(@babel/core@7.23.0) '@babel/runtime': 7.23.1 '@babel/runtime-corejs3': 7.23.1 - '@commercetools-frontend/babel-preset-mc-app': 22.9.1 - '@commercetools-frontend/constants': 22.9.1 + '@commercetools-frontend/babel-preset-mc-app': 22.10.0 + '@commercetools-frontend/constants': 22.10.0 '@types/dompurify': 2.4.0 '@types/lodash': 4.14.200 '@types/react': 17.0.68 @@ -2779,8 +2803,8 @@ packages: - utf-8-validate dev: false - /@commercetools-frontend/babel-preset-mc-app@22.8.1: - resolution: {integrity: sha512-NQupEeXv6Kzd5TrFpjGGbFzP81j5K4QCFfujjYd0yOYHcKxNzifqXeD+r2iq+geqsoizQXCEYG6sh3fnsB1q3w==} + /@commercetools-frontend/babel-preset-mc-app@22.10.0: + resolution: {integrity: sha512-d5N0XBkh9Rj2zfeQggZaO574PsXv6CV/6j98GICY2FG16CQ5iBjz45qBZEcHmUbn0WQKdVcmw+C3Rx5AiXsZbQ==} engines: {node: 16.x || >=18.0.0} dependencies: '@babel/core': 7.23.0 @@ -2812,8 +2836,8 @@ packages: - supports-color dev: false - /@commercetools-frontend/babel-preset-mc-app@22.9.1: - resolution: {integrity: sha512-QBLXd4knad7BL5DW8qqYfKZjRcXTxRv0E0l/5jaKA7R94jtXTXwebAhHcdeM1+fBKNLEowmIyJCVXgM5ydECPA==} + /@commercetools-frontend/babel-preset-mc-app@22.8.1: + resolution: {integrity: sha512-NQupEeXv6Kzd5TrFpjGGbFzP81j5K4QCFfujjYd0yOYHcKxNzifqXeD+r2iq+geqsoizQXCEYG6sh3fnsB1q3w==} engines: {node: 16.x || >=18.0.0} dependencies: '@babel/core': 7.23.0 @@ -2845,8 +2869,8 @@ packages: - supports-color dev: false - /@commercetools-frontend/constants@22.9.1: - resolution: {integrity: sha512-+secRsVaMjiavm5+9TCiqCypHec4mdg7QFmJtnKMtgv1R/4wClX6KCmzII9PTM0SezeRvArtvzDE/ltamQRbfQ==} + /@commercetools-frontend/constants@22.10.0: + resolution: {integrity: sha512-ty15pNpX+ThJAR+GnYHgDBHEDyc9GeXia72VBFR/gnu1XbH7JkPPBxMjU6csOUSHiC27o82N7xxtzUMtLeZaXQ==} dependencies: '@babel/runtime': 7.23.1 '@babel/runtime-corejs3': 7.23.1 @@ -2889,8 +2913,8 @@ packages: /@commercetools-test-data/attribute-definition@5.11.2: resolution: {integrity: sha512-uL5nP2+FJqUROv5gxdaYDp9xbuig45gxwEf3oBIOambnZjSO28dwh86mt5SeL5f29hhiN9ApswgjKIVjNbbgAw==} dependencies: - '@babel/runtime': 7.21.0 - '@babel/runtime-corejs3': 7.21.0 + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 '@commercetools-test-data/attribute-type': 5.11.2 '@commercetools-test-data/commons': 5.11.2 '@commercetools-test-data/core': 5.11.2 @@ -2930,6 +2954,21 @@ packages: - encoding dev: false + /@commercetools-test-data/commons@6.0.0: + resolution: {integrity: sha512-U8vS3mS3UUW4Te2anfV0a2cWBubAz1yJi0l4Zl7uwFzInKj8ylM1fkhRnWVQheNoW0a0YPeifeaExPAh8MNxww==} + dependencies: + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 + '@commercetools-test-data/core': 6.0.0 + '@commercetools-test-data/utils': 6.0.0 + '@commercetools/platform-sdk': 4.11.0 + '@faker-js/faker': 8.0.0 + '@types/lodash': 4.14.200 + lodash: 4.17.21 + transitivePeerDependencies: + - encoding + dev: false + /@commercetools-test-data/core@5.11.2: resolution: {integrity: sha512-iz++zEBengERwg3REm51RsEFmiUeNPQz1K9K2kZjH1sAkFxOf1ydmpM0Tt4Awmi/OHQ+G2tGKKdJewm8AQyHNg==} dependencies: @@ -2940,11 +2979,21 @@ packages: lodash: 4.17.21 dev: false + /@commercetools-test-data/core@6.0.0: + resolution: {integrity: sha512-lNJi7pRwytqgx7uAhLIOLkTQVsPL3Q+eXc4Cfvaqq+RN0yg6Uja9OaDVLAy96ZBRPKPE8/wT76Awohpv0Pv47Q==} + dependencies: + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 + '@faker-js/faker': 8.0.0 + '@types/lodash': 4.14.200 + lodash: 4.17.21 + dev: false + /@commercetools-test-data/product-variant@5.11.2: resolution: {integrity: sha512-7VT0Iez2bi8fhpqJOzVx/WfmLV+mAXlc5SOxZoTeP1JyUyY07GiujI0ctKAh8Q3/0qzVyJ08RFV1BLtYxLWeKA==} dependencies: - '@babel/runtime': 7.21.0 - '@babel/runtime-corejs3': 7.21.0 + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 '@commercetools-test-data/attribute-definition': 5.11.2 '@commercetools-test-data/commons': 5.11.2 '@commercetools-test-data/core': 5.11.2 @@ -2963,6 +3012,14 @@ packages: '@faker-js/faker': 8.0.0 dev: false + /@commercetools-test-data/utils@6.0.0: + resolution: {integrity: sha512-nJ2QluPuYri1FLNlYNNklncKLuWNFF7+4IJ/EC7pHeQGRWq0tVh2Vo9lr3/9OJzZxHLbKcSGeDeIf1ZaAPlMJQ==} + dependencies: + '@babel/runtime': 7.23.1 + '@babel/runtime-corejs3': 7.23.1 + '@faker-js/faker': 8.0.0 + dev: false + /@commercetools/platform-sdk@4.11.0: resolution: {integrity: sha512-ftcq6mCxzpIG9wmGpTED6KQCApk4nyURh81J3PRP3d48oCLOrkZSyzDDfvflGoVZQeIcox+YdtyqZoryFrRtmQ==} engines: {node: '>=14'} @@ -3698,7 +3755,7 @@ packages: /@manypkg/get-packages@1.1.3: resolution: {integrity: sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==} dependencies: - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.1 '@changesets/types': 4.1.0 '@manypkg/find-root': 1.1.0 fs-extra: 8.1.0