@commercetools-test-data/commons
Version:
Data model for commercetools platform common types
1,315 lines (1,095 loc) • 70.5 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var core = require('@commercetools-test-data/core');
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
var faker = require('@faker-js/faker');
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
var utils = require('@commercetools-test-data/utils');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
const generator$h = core.Generator({
fields: {
id: core.fake(f => f.string.alphanumeric(8)),
key: core.fake(f => f.lorem.slug(2)),
title: core.fake(f => f.person.jobTitle()),
salutation: core.oneOf('Dear', 'To Whom it May Concern', 'Members of the Committee'),
firstName: core.fake(f => f.person.firstName()),
lastName: core.fake(f => f.person.lastName()),
streetName: core.fake(f => f.location.street()),
streetNumber: core.fake(f => String(f.number.int())),
additionalStreetInfo: core.fake(f => f.location.street()),
postalCode: core.fake(f => f.location.zipCode()),
city: core.fake(f => f.location.city()),
region: null,
state: core.fake(f => f.location.state()),
country: 'DE',
company: core.fake(f => f.company.name()),
department: core.fake(f => f.commerce.department()),
building: null,
apartment: null,
pOBox: 'PO Box 1033',
phone: core.fake(f => f.phone.number()),
mobile: core.fake(f => f.phone.number()),
fax: core.fake(f => f.phone.number()),
email: core.fake(f => f.internet.email()),
additionalAddressInfo: null,
externalId: null,
custom: null
}
});
const transformers$h = {
default: core.Transformer('default', {}),
rest: core.Transformer('rest', {}),
graphql: core.Transformer('graphql', {
addFields: () => ({
__typename: 'Address'
})
})
};
const Model$f = () => core.Builder({
name: 'Address',
generator: generator$h,
transformers: transformers$h
});
const presets$1s = {};
var index$i = /*#__PURE__*/Object.freeze({
__proto__: null,
random: Model$f,
presets: presets$1s
});
// https://docs.commercetools.com/api/types#addressdraft
const generator$g = core.Generator({
fields: {
id: null,
key: core.fake(f => f.lorem.slug(2)),
title: core.fake(f => f.person.jobTitle()),
salutation: core.oneOf('Dear', 'To Whom it May Concern', 'Members of the Committee'),
firstName: core.fake(f => f.person.firstName()),
lastName: core.fake(f => f.person.lastName()),
streetName: core.fake(f => f.location.street()),
streetNumber: core.fake(f => String(f.number.int())),
additionalStreetInfo: core.fake(f => f.location.street()),
postalCode: core.fake(f => f.location.zipCode()),
city: core.fake(f => f.location.city()),
region: null,
state: core.fake(f => f.location.state()),
country: 'DE',
company: core.fake(f => f.company.name()),
department: core.fake(f => f.commerce.department()),
building: null,
apartment: null,
pOBox: 'PO Box 1033',
phone: core.fake(f => f.phone.number()),
mobile: core.fake(f => f.phone.number()),
fax: core.fake(f => f.phone.number()),
email: core.fake(f => f.internet.email()),
additionalAddressInfo: null,
externalId: null,
custom: null
}
});
const transformers$g = {
default: core.Transformer('default', {}),
rest: core.Transformer('rest', {}),
graphql: core.Transformer('graphql', {})
};
const AddressDraft = () => core.Builder({
name: 'AddressDraft',
generator: generator$g,
transformers: transformers$g
});
const withCountryUs = () => AddressDraft().country('US');
const withCountryUsNoState = () => AddressDraft().state(null).country('US');
const presets$1r = {
withCountryUs,
withCountryUsNoState
};
const empty$3 = () => AddressDraft().id(undefined).key(undefined).title(undefined).salutation(undefined).firstName(undefined).lastName(undefined).streetName(undefined).streetNumber(undefined).additionalStreetInfo(undefined).postalCode(undefined).city(undefined).state(undefined).region(undefined).company(undefined).department(undefined).building(undefined).apartment(undefined).pOBox(undefined).phone(undefined).mobile(undefined).fax(undefined).email(undefined).additionalAddressInfo(undefined).externalId(undefined).custom(undefined);
const ameliaJonesAddress = () => presets$1n.empty().firstName('Amelia').lastName('Jones').streetName('Churchill Way').streetNumber('59').postalCode('B3 4BH').city('Birmingham').country('GB').region('West Midlands');
const avaBrownAddress = () => presets$1n.empty().firstName('Ava').lastName('Brown').streetName('Queen Street').streetNumber('72').postalCode('CF10 2DL').city('Cardiff').country('GB').region('Wales');
const camilleLefèvreAddress = () => presets$1n.empty().firstName('Camille').lastName('Lefèvre').streetName('Avenue Jean Médecin').streetNumber('22').postalCode('06000').city('Nice').country('FR').region("Provence-Alpes-Côte d'Azur");
const carlosGarcíaAddress = () => presets$1n.empty().firstName('Carlos').lastName('García').streetName('Gran Vía').streetNumber('28').postalCode('28013').city('Madrid').country('ES').region('Comunidad de Madrid');
const eagleHeavyLiftTechnologiesIncUsNy1Address = () => presets$1n.empty().key('eagle-heavy-lift-technologies-inc-us-ny-1').streetName('Broadway').streetNumber('123').additionalStreetInfo('Unit 456').postalCode('10001').city('New York').country('US').region('New York').state('New York').company('Eagle Heavy Lift Technologies Inc. NY').building('A').apartment('789');
const emmaJohnsonAddress = () => presets$1n.empty().firstName('Emma').lastName('Johnson').streetName('High Street').streetNumber('15').postalCode('B4 7SL').city('Birmingham').country('GB').region('West Midlands');
const jamesSmithAddress = () => presets$1n.empty().firstName('James').lastName('Smith').streetName('Baker Street').streetNumber('221B').postalCode('NW1 6XE').city('London').country('GB').region('Greater London');
const libertyCraneSolutionsLlcUsNc1Address = () => presets$1n.empty().key('liberty-crane-solutions-llc-us-nc-1').streetName('Main Street').streetNumber('789').additionalStreetInfo('Building B').postalCode('27601').city('Raleigh').country('US').region('North Carolina').state('North Carolina').company('Liberty Crane Solutions LLC NC').building('C').apartment('456');
const lifttechSolutionsLtdAddress = () => presets$1n.empty().key('lifttech-solutions-ltd').streetName('Baker Street').streetNumber('221B').additionalStreetInfo('Sherlock Holmes House').postalCode('SW1A 1AA').city('London').country('GB').company('LiftTech Solutions Ltd').building('C').apartment('987');
const lifttechSolutionsLtdDeAddress = () => presets$1n.empty().key('lifttech-solutions-ltd-de').streetName('Hauptstraße').streetNumber('456').additionalStreetInfo('Etage 3').postalCode('12345').city('Berlin').country('DE').company('LiftTech Solutions Ltd DE').building('D').apartment('654');
const lifttechSolutionsLtdEsAddress = () => presets$1n.empty().key('lifttech-solutions-ltd-es').streetName('Calle Mayor').streetNumber('101').additionalStreetInfo('Piso 2').postalCode('28013').city('Madrid').country('ES').company('LiftTech Solutions Ltd ES').building('F').apartment('567');
const lifttechSolutionsLtdFrAddress = () => presets$1n.empty().key('lifttech-solutions-ltd-fr').streetName('Rue de la Paix').streetNumber('789').additionalStreetInfo('Étage 4').postalCode('75002').city('Paris').country('FR').company('LiftTech Solutions Ltd FR').building('E').apartment('321');
const lucasDuboisAddress = () => presets$1n.empty().firstName('Lucas').lastName('Dubois').streetName('Rue de Rivoli').streetNumber('117').postalCode('75001').city('Paris').country('FR').region('Île-de-France');
const lukasSchmidtAddress = () => presets$1n.empty().firstName('Lukas').lastName('Schmidt').streetName('Königstraße').streetNumber('50').postalCode('70173').city('Stuttgart').country('DE').state('Baden-Württemberg');
const michaelWilliamsAddress = () => presets$1n.empty().firstName('Michael').lastName('Williams').streetName('George Street').streetNumber('42').postalCode('EH2 2LE').city('Edinburgh').country('GB').region('Scotland');
const oliverSmithAddress = () => presets$1n.empty().firstName('Oliver').lastName('Smith').streetName('Victoria Street').streetNumber('100').postalCode('SW1E 5JL').city('London').country('GB').region('Greater London');
const oliviaJonesAddress = () => presets$1n.empty().firstName('Olivia').lastName('Newton').streetName('Market Street').streetNumber('18').postalCode('M1 1PT').city('Manchester').country('GB').region('Greater Manchester');
const sofiaLópezAddress = () => presets$1n.empty().firstName('Sofía').lastName('López').streetName('La Rambla').streetNumber('91').postalCode('08002').city('Barcelona').country('ES').region('Catalunya');
const sophieMüllerAddress = () => presets$1n.empty().firstName('Sophie').lastName('Müller').streetName('Schloßstraße').streetNumber('30').postalCode('10115').city('Berlin').country('DE').state('Berlin');
const williamDavisAddress = () => presets$1n.empty().firstName('William').lastName('Davis').streetName('King Street').streetNumber('85').postalCode('W6 9JT').city('London').country('GB').region('Greater London');
const williamTaylorAddress = () => presets$1n.empty().firstName('William').lastName('Taylor').streetName('Duke Street').streetNumber('32').postalCode('L1 5AS').city('Liverpool').country('GB').region('Merseyside');
const presets$1q = {
jamesSmithAddress,
emmaJohnsonAddress,
michaelWilliamsAddress,
oliviaNewtonAddress: oliviaJonesAddress,
williamDavisAddress,
avaBrownAddress,
oliverSmithAddress,
ameliaJonesAddress,
williamTaylorAddress,
lukasSchmidtAddress,
sophieMuellerAddress: sophieMüllerAddress,
lucasDuboisAddress,
camilleLefevreAddress: camilleLefèvreAddress,
carlosGarciaAddress: carlosGarcíaAddress,
sofiaLopezAddress: sofiaLópezAddress,
eagleHeavyLiftTechnologiesIncUsNy1Address,
libertyCraneSolutionsLlcUsNc1Address,
lifttechSolutionsLtdAddress,
lifttechSolutionsLtdDeAddress,
lifttechSolutionsLtdFrAddress,
lifttechSolutionsLtdEsAddress
};
const jenniferJonesAddress = () => presets$1n.empty().firstName('Jennifer').lastName('Jones').streetName('Main Road').streetNumber('100').postalCode('SW1A2AA').city('Westminster').country('GB');
const jenniferRobinsonAddress = () => presets$1n.empty().firstName('Jennifer').lastName('Robinson').streetName('Second Street').streetNumber('15').postalCode('10001').city('New York City').state('New York').country('US');
const jenniferSchmidtAddress = () => presets$1n.empty().firstName('Jennifer').lastName('Schmidt').streetName('Hauptstrasse').streetNumber('25').postalCode('14467').city('Potsdam').country('DE');
const sebastianFranklinAddress = () => presets$1n.empty().firstName('Sebastian').lastName('Franklin').streetName('South Road').streetNumber('9').postalCode('27517').city('Durham').state('North Carolina').country('US');
const sebastianMullerAddress = () => presets$1n.empty().firstName('Sebastian').lastName('Müller').streetName('Schulstrasse').streetNumber('12').postalCode('80331').city('München').country('DE');
const sebastianSmithAddress = () => presets$1n.empty().firstName('Sebastian').lastName('Smith').streetName('Center Street').streetNumber('1').postalCode('PO167GZ').city('Fareham').country('GB');
const presets$1p = {
jenniferJonesAddress,
jenniferRobinsonAddress,
jenniferSchmidtAddress,
sebastianFranklinAddress,
sebastianMullerAddress,
sebastianSmithAddress
};
const sampleAustralia = () => presets$1n.empty().firstName('Sample Customer').lastName('Australia').streetName('Center Road').streetNumber('1').postalCode('34567').city('Center Town').country('AU');
const sampleGermany = () => presets$1n.empty().firstName('Sample Customer').lastName('Germany').streetName('Sample Street').streetNumber('1').postalCode('12345').city('Sample Town').country('DE');
const sampleUsa = () => presets$1n.empty().firstName('Sample Customer').lastName('USA').streetName('Main Street').streetNumber('1').postalCode('56789').city('Mainville').state('New Jersey').country('US');
const presets$1o = {
sampleUsa,
sampleAustralia,
sampleGermany
};
const presets$1n = {
changeHistoryData: presets$1r,
empty: empty$3,
sampleDataB2B: presets$1q,
sampleDataB2CLifestyle: presets$1p,
sampleDataFashion: presets$1o
};
var index$h = /*#__PURE__*/Object.freeze({
__proto__: null,
random: AddressDraft,
presets: presets$1n
});
// https://docs.commercetools.com/api/types#centprecisionmoneydraft
const generator$f = core.Generator({
fields: {
centAmount: core.fake(f => f.number.int({
min: 1,
max: 9999999999
})),
currencyCode: core.oneOf('EUR', 'USD'),
type: 'centPrecision',
// Default fraction digits for a currency for EUR and USD
fractionDigits: 2
}
});
const transformers$f = {
default: core.Transformer('default', {
buildFields: []
}),
rest: core.Transformer('rest', {
buildFields: []
}),
graphql: core.Transformer('graphql', {
buildFields: []
})
};
const Model$e = () => core.Builder({
name: 'CentPrecisionMoneyDraft',
generator: generator$f,
transformers: transformers$f
});
const presets$1m = {};
var index$g = /*#__PURE__*/Object.freeze({
__proto__: null,
random: Model$e,
presets: presets$1m
});
// https://docs.commercetools.com/api/types#centprecisionmoney
const generator$e = core.Generator({
fields: {
centAmount: core.fake(f => f.number.int({
min: 1,
max: 9999999999
})),
currencyCode: core.oneOf('EUR', 'USD'),
type: 'centPrecision',
// Default fraction digits for a currency for EUR and USD
fractionDigits: 2
}
});
const transformers$e = {
default: core.Transformer('default', {
buildFields: []
}),
rest: core.Transformer('rest', {
buildFields: []
}),
graphql: core.Transformer('graphql', {
buildFields: [],
addFields: () => ({
__typename: 'Money'
})
})
};
const Model$d = () => core.Builder({
name: 'CentPrecisionMoney',
generator: generator$e,
transformers: transformers$e
});
const presets$1l = {};
var index$f = /*#__PURE__*/Object.freeze({
__proto__: null,
CentPrecisionMoneyDraft: index$g,
random: Model$d,
presets: presets$1l
});
function ownKeys$7(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$7(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$7(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
const commonFieldsConfig$5 = {
fields: {
id: core.fake(f => f.string.uuid()),
typeId: null
}
};
const restFieldsConfig$5 = {
fields: _objectSpread$7(_objectSpread$7({}, commonFieldsConfig$5.fields), {}, {
obj: null
}),
postBuild(model) {
return _objectSpread$7(_objectSpread$7({}, model), {}, {
obj: model.obj || {
id: model.id
}
});
}
};
const graphqlFieldsConfig$5 = {
fields: _objectSpread$7(_objectSpread$7({}, commonFieldsConfig$5.fields), {}, {
__typename: 'Reference'
})
};
const RestModelBuilder$5 = () => core.createSpecializedBuilder({
name: 'ReferenceRestBuilder',
type: 'rest',
modelFieldsConfig: restFieldsConfig$5
});
const GraphqlModelBuilder$5 = () => core.createSpecializedBuilder({
name: 'ReferenceGraphqlBuilder',
type: 'graphql',
modelFieldsConfig: graphqlFieldsConfig$5
});
const CompatModelBuilder$2 = () => core.createCompatibilityBuilder({
name: 'ReferenceCompatBuilder',
modelFieldsConfig: {
rest: restFieldsConfig$5,
graphql: graphqlFieldsConfig$5
}
});
const referenceTypes = {
associateRole: 'associate-role',
attributeGroup: 'attribute-group',
businessUnit: 'business-unit',
cart: 'cart',
cartDiscount: 'cart-discount',
category: 'category',
channel: 'channel',
customer: 'customer',
customerGroup: 'customer-group',
discountCode: 'discount-code',
extension: 'extension',
inventoryEntry: 'inventory-entry',
keyValueDocument: 'key-value-document',
payment: 'payment',
product: 'product',
productDiscount: 'product-discount',
productPrice: 'product-price',
productType: 'product-type',
order: 'order',
orderEdit: 'order-edit',
review: 'review',
shippingMethod: 'shipping-method',
shoppingList: 'shopping-list',
standalonePrice: 'standalone-price',
state: 'state',
store: 'store',
subscription: 'subscription',
taxCategory: 'tax-category',
type: 'type',
zone: 'zone',
productSelection: 'product-selection',
quoteRequest: 'quote-request',
stagedQuote: 'staged-quote',
quote: 'quote',
directDiscount: 'direct-discount'
};
var constants = /*#__PURE__*/Object.freeze({
__proto__: null,
referenceTypes: referenceTypes
});
function buildReferencePresets(typeId) {
return {
restPreset: () => ReferenceRest.random().typeId(typeId),
graphqlPreset: () => ReferenceGraphql.random().typeId(typeId),
compatPreset: () => Reference.random().typeId(typeId)
};
}
const presets$1k = buildReferencePresets(referenceTypes.associateRole);
const presets$1j = buildReferencePresets(referenceTypes.attributeGroup);
const presets$1i = buildReferencePresets(referenceTypes.businessUnit);
const presets$1h = buildReferencePresets(referenceTypes.cartDiscount);
const presets$1g = buildReferencePresets(referenceTypes.cart);
const presets$1f = buildReferencePresets(referenceTypes.category);
const presets$1e = buildReferencePresets(referenceTypes.channel);
const presets$1d = buildReferencePresets(referenceTypes.customerGroup);
const presets$1c = buildReferencePresets(referenceTypes.customer);
const presets$1b = buildReferencePresets(referenceTypes.directDiscount);
const presets$1a = buildReferencePresets(referenceTypes.discountCode);
const presets$19 = buildReferencePresets(referenceTypes.extension);
const presets$18 = buildReferencePresets(referenceTypes.inventoryEntry);
const presets$17 = buildReferencePresets(referenceTypes.keyValueDocument);
const presets$16 = buildReferencePresets(referenceTypes.orderEdit);
const presets$15 = buildReferencePresets(referenceTypes.order);
const presets$14 = buildReferencePresets(referenceTypes.payment);
const presets$13 = buildReferencePresets(referenceTypes.productDiscount);
const presets$12 = buildReferencePresets(referenceTypes.productPrice);
const presets$11 = buildReferencePresets(referenceTypes.product);
const presets$10 = buildReferencePresets(referenceTypes.productSelection);
const presets$$ = buildReferencePresets(referenceTypes.productType);
const presets$_ = buildReferencePresets(referenceTypes.quote);
const presets$Z = buildReferencePresets(referenceTypes.quoteRequest);
const presets$Y = buildReferencePresets(referenceTypes.review);
const presets$X = buildReferencePresets(referenceTypes.shippingMethod);
const presets$W = buildReferencePresets(referenceTypes.shoppingList);
const presets$V = buildReferencePresets(referenceTypes.stagedQuote);
const presets$U = buildReferencePresets(referenceTypes.standalonePrice);
const presets$T = buildReferencePresets(referenceTypes.state);
const presets$S = buildReferencePresets(referenceTypes.store);
const presets$R = buildReferencePresets(referenceTypes.subscription);
const presets$Q = buildReferencePresets(referenceTypes.taxCategory);
const presets$P = buildReferencePresets(referenceTypes.type);
const presets$O = buildReferencePresets(referenceTypes.zone);
const restPresets$5 = {
associateRoleReference: presets$1k.restPreset,
attributeGroupReference: presets$1j.restPreset,
businessUnitReference: presets$1i.restPreset,
cartDiscountReference: presets$1h.restPreset,
cartReference: presets$1g.restPreset,
categoryReference: presets$1f.restPreset,
channelReference: presets$1e.restPreset,
customerReference: presets$1c.restPreset,
customerGroupReference: presets$1d.restPreset,
directDiscountReference: presets$1b.restPreset,
discountCodeReference: presets$1a.restPreset,
extensionReference: presets$19.restPreset,
inventoryEntryReference: presets$18.restPreset,
keyValueDocumentReference: presets$17.restPreset,
orderReference: presets$15.restPreset,
orderEditReference: presets$16.restPreset,
paymentReference: presets$14.restPreset,
productReference: presets$11.restPreset,
productDiscountReference: presets$13.restPreset,
productPriceReference: presets$12.restPreset,
productSelectionReference: presets$10.restPreset,
productTypeReference: presets$$.restPreset,
quoteReference: presets$_.restPreset,
quoteRequestReference: presets$Z.restPreset,
reviewReference: presets$Y.restPreset,
shippingMethodReference: presets$X.restPreset,
shoppingListReference: presets$W.restPreset,
stagedQuoteReference: presets$V.restPreset,
standalonePriceReference: presets$U.restPreset,
stateReference: presets$T.restPreset,
storeReference: presets$S.restPreset,
subscriptionReference: presets$R.restPreset,
taxCategoryReference: presets$Q.restPreset,
typeReference: presets$P.restPreset,
zoneReference: presets$O.restPreset
};
const graphqlPresets$5 = {
associateRoleReference: presets$1k.graphqlPreset,
attributeGroupReference: presets$1j.graphqlPreset,
businessUnitReference: presets$1i.graphqlPreset,
cartDiscountReference: presets$1h.graphqlPreset,
cartReference: presets$1g.graphqlPreset,
categoryReference: presets$1f.graphqlPreset,
channelReference: presets$1e.graphqlPreset,
customerReference: presets$1c.graphqlPreset,
customerGroupReference: presets$1d.graphqlPreset,
directDiscountReference: presets$1b.graphqlPreset,
discountCodeReference: presets$1a.graphqlPreset,
extensionReference: presets$19.graphqlPreset,
inventoryEntryReference: presets$18.graphqlPreset,
keyValueDocumentReference: presets$17.graphqlPreset,
orderReference: presets$15.graphqlPreset,
orderEditReference: presets$16.graphqlPreset,
paymentReference: presets$14.graphqlPreset,
productReference: presets$11.graphqlPreset,
productDiscountReference: presets$13.graphqlPreset,
productPriceReference: presets$12.graphqlPreset,
productSelectionReference: presets$10.graphqlPreset,
productTypeReference: presets$$.graphqlPreset,
quoteReference: presets$_.graphqlPreset,
quoteRequestReference: presets$Z.graphqlPreset,
reviewReference: presets$Y.graphqlPreset,
shippingMethodReference: presets$X.graphqlPreset,
shoppingListReference: presets$W.graphqlPreset,
stagedQuoteReference: presets$V.graphqlPreset,
standalonePriceReference: presets$U.graphqlPreset,
stateReference: presets$T.graphqlPreset,
storeReference: presets$S.graphqlPreset,
subscriptionReference: presets$R.graphqlPreset,
taxCategoryReference: presets$Q.graphqlPreset,
typeReference: presets$P.graphqlPreset,
zoneReference: presets$O.graphqlPreset
};
const compatPresets$2 = {
associateRoleReference: presets$1k.compatPreset,
attributeGroupReference: presets$1j.compatPreset,
businessUnitReference: presets$1i.compatPreset,
cartDiscountReference: presets$1h.compatPreset,
cartReference: presets$1g.compatPreset,
categoryReference: presets$1f.compatPreset,
channelReference: presets$1e.compatPreset,
customerReference: presets$1c.compatPreset,
customerGroupReference: presets$1d.compatPreset,
directDiscountReference: presets$1b.compatPreset,
discountCodeReference: presets$1a.compatPreset,
extensionReference: presets$19.compatPreset,
inventoryEntryReference: presets$18.compatPreset,
keyValueDocumentReference: presets$17.compatPreset,
orderReference: presets$15.compatPreset,
orderEditReference: presets$16.compatPreset,
paymentReference: presets$14.compatPreset,
productReference: presets$11.compatPreset,
productDiscountReference: presets$13.compatPreset,
productPriceReference: presets$12.compatPreset,
productSelectionReference: presets$10.compatPreset,
productTypeReference: presets$$.compatPreset,
quoteReference: presets$_.compatPreset,
quoteRequestReference: presets$Z.compatPreset,
reviewReference: presets$Y.compatPreset,
shippingMethodReference: presets$X.compatPreset,
shoppingListReference: presets$W.compatPreset,
stagedQuoteReference: presets$V.compatPreset,
standalonePriceReference: presets$U.compatPreset,
stateReference: presets$T.compatPreset,
storeReference: presets$S.compatPreset,
subscriptionReference: presets$R.compatPreset,
taxCategoryReference: presets$Q.compatPreset,
typeReference: presets$P.compatPreset,
zoneReference: presets$O.compatPreset
};
function ownKeys$6(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$6(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$6(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
const commonFieldsConfig$4 = {
fields: {
id: core.fake(f => f.string.uuid()),
typeId: null
}
};
const restFieldsConfig$4 = {
fields: _objectSpread$6({}, commonFieldsConfig$4.fields)
};
const graphqlFieldsConfig$4 = {
fields: _objectSpread$6({}, commonFieldsConfig$4.fields)
};
const RestModelBuilder$4 = () => core.createSpecializedBuilder({
name: 'ReferenceDraftRestBuilder',
type: 'rest',
modelFieldsConfig: restFieldsConfig$4
});
const GraphqlModelBuilder$4 = () => core.createSpecializedBuilder({
name: 'ReferenceDraftGraphqlBuilder',
type: 'graphql',
modelFieldsConfig: graphqlFieldsConfig$4
});
const CompatModelBuilder$1 = () => core.createCompatibilityBuilder({
name: 'ReferenceDraftCompatBuilder',
modelFieldsConfig: {
rest: restFieldsConfig$4,
graphql: graphqlFieldsConfig$4
}
});
function buildReferenceDraftPresets(typeId) {
return {
restPreset: () => ReferenceDraftRest.random().typeId(typeId),
graphqlPreset: () => ReferenceDraftGraphql.random().typeId(typeId),
compatPreset: () => ReferenceDraft.random().typeId(typeId)
};
}
const presets$N = buildReferenceDraftPresets(referenceTypes.associateRole);
const presets$M = buildReferenceDraftPresets(referenceTypes.attributeGroup);
const presets$L = buildReferenceDraftPresets(referenceTypes.businessUnit);
const presets$K = buildReferenceDraftPresets(referenceTypes.cartDiscount);
const presets$J = buildReferenceDraftPresets(referenceTypes.cart);
const presets$I = buildReferenceDraftPresets(referenceTypes.category);
const presets$H = buildReferenceDraftPresets(referenceTypes.channel);
const presets$G = buildReferenceDraftPresets(referenceTypes.customer);
const presets$F = buildReferenceDraftPresets(referenceTypes.customerGroup);
const presets$E = buildReferenceDraftPresets(referenceTypes.directDiscount);
const presets$D = buildReferenceDraftPresets(referenceTypes.discountCode);
const presets$C = buildReferenceDraftPresets(referenceTypes.extension);
const presets$B = buildReferenceDraftPresets(referenceTypes.inventoryEntry);
const presets$A = buildReferenceDraftPresets(referenceTypes.keyValueDocument);
const presets$z = buildReferenceDraftPresets(referenceTypes.order);
const presets$y = buildReferenceDraftPresets(referenceTypes.orderEdit);
const presets$x = buildReferenceDraftPresets(referenceTypes.payment);
const presets$w = buildReferenceDraftPresets(referenceTypes.productDiscount);
const presets$v = buildReferenceDraftPresets(referenceTypes.product);
const presets$u = buildReferenceDraftPresets(referenceTypes.productPrice);
const presets$t = buildReferenceDraftPresets(referenceTypes.productSelection);
const presets$s = buildReferenceDraftPresets(referenceTypes.productType);
const presets$r = buildReferenceDraftPresets(referenceTypes.quote);
const presets$q = buildReferenceDraftPresets(referenceTypes.quoteRequest);
const presets$p = buildReferenceDraftPresets(referenceTypes.review);
const presets$o = buildReferenceDraftPresets(referenceTypes.shippingMethod);
const presets$n = buildReferenceDraftPresets(referenceTypes.shoppingList);
const presets$m = buildReferenceDraftPresets(referenceTypes.stagedQuote);
const presets$l = buildReferenceDraftPresets(referenceTypes.standalonePrice);
const presets$k = buildReferenceDraftPresets(referenceTypes.state);
const presets$j = buildReferenceDraftPresets(referenceTypes.store);
const presets$i = buildReferenceDraftPresets(referenceTypes.subscription);
const presets$h = buildReferenceDraftPresets(referenceTypes.taxCategory);
const presets$g = buildReferenceDraftPresets(referenceTypes.type);
const presets$f = buildReferenceDraftPresets(referenceTypes.zone);
const restPresets$4 = {
associateRoleReference: presets$N.restPreset,
attributeGroupReference: presets$M.restPreset,
businessUnitReference: presets$L.restPreset,
cartDiscountReference: presets$K.restPreset,
cartReference: presets$J.restPreset,
categoryReference: presets$I.restPreset,
channelReference: presets$H.restPreset,
customerReference: presets$G.restPreset,
customerGroupReference: presets$F.restPreset,
directDiscountReference: presets$E.restPreset,
discountCodeReference: presets$D.restPreset,
extensionReference: presets$C.restPreset,
inventoryEntryReference: presets$B.restPreset,
keyValueDocumentReference: presets$A.restPreset,
orderReference: presets$z.restPreset,
orderEditReference: presets$y.restPreset,
paymentReference: presets$x.restPreset,
productReference: presets$v.restPreset,
productDiscountReference: presets$w.restPreset,
productPriceReference: presets$u.restPreset,
productSelectionReference: presets$t.restPreset,
productTypeReference: presets$s.restPreset,
quoteReference: presets$r.restPreset,
quoteRequestReference: presets$q.restPreset,
reviewReference: presets$p.restPreset,
shippingMethodReference: presets$o.restPreset,
shoppingListReference: presets$n.restPreset,
stagedQuoteReference: presets$m.restPreset,
standalonePriceReference: presets$l.restPreset,
stateReference: presets$k.restPreset,
storeReference: presets$j.restPreset,
subscriptionReference: presets$i.restPreset,
taxCategoryReference: presets$h.restPreset,
typeReference: presets$g.restPreset,
zoneReference: presets$f.restPreset
};
const graphqlPresets$4 = {
associateRoleReference: presets$N.graphqlPreset,
attributeGroupReference: presets$M.graphqlPreset,
businessUnitReference: presets$L.graphqlPreset,
cartDiscountReference: presets$K.graphqlPreset,
cartReference: presets$J.graphqlPreset,
categoryReference: presets$I.graphqlPreset,
channelReference: presets$H.graphqlPreset,
customerReference: presets$G.graphqlPreset,
customerGroupReference: presets$F.graphqlPreset,
directDiscountReference: presets$E.graphqlPreset,
discountCodeReference: presets$D.graphqlPreset,
extensionReference: presets$C.graphqlPreset,
inventoryEntryReference: presets$B.graphqlPreset,
keyValueDocumentReference: presets$A.graphqlPreset,
orderReference: presets$z.graphqlPreset,
orderEditReference: presets$y.graphqlPreset,
paymentReference: presets$x.graphqlPreset,
productReference: presets$v.graphqlPreset,
productDiscountReference: presets$w.graphqlPreset,
productPriceReference: presets$u.graphqlPreset,
productSelectionReference: presets$t.graphqlPreset,
productTypeReference: presets$s.graphqlPreset,
quoteReference: presets$r.graphqlPreset,
quoteRequestReference: presets$q.graphqlPreset,
reviewReference: presets$p.graphqlPreset,
shippingMethodReference: presets$o.graphqlPreset,
shoppingListReference: presets$n.graphqlPreset,
stagedQuoteReference: presets$m.graphqlPreset,
standalonePriceReference: presets$l.graphqlPreset,
stateReference: presets$k.graphqlPreset,
storeReference: presets$j.graphqlPreset,
subscriptionReference: presets$i.graphqlPreset,
taxCategoryReference: presets$h.graphqlPreset,
typeReference: presets$g.graphqlPreset,
zoneReference: presets$f.graphqlPreset
};
const compatPresets$1 = {
associateRoleReference: presets$N.compatPreset,
attributeGroupReference: presets$M.compatPreset,
businessUnitReference: presets$L.compatPreset,
cartDiscountReference: presets$K.compatPreset,
cartReference: presets$J.compatPreset,
categoryReference: presets$I.compatPreset,
channelReference: presets$H.compatPreset,
customerReference: presets$G.compatPreset,
customerGroupReference: presets$F.compatPreset,
directDiscountReference: presets$E.compatPreset,
discountCodeReference: presets$D.compatPreset,
extensionReference: presets$C.compatPreset,
inventoryEntryReference: presets$B.compatPreset,
keyValueDocumentReference: presets$A.compatPreset,
orderReference: presets$z.compatPreset,
orderEditReference: presets$y.compatPreset,
paymentReference: presets$x.compatPreset,
productReference: presets$v.compatPreset,
productDiscountReference: presets$w.compatPreset,
productPriceReference: presets$u.compatPreset,
productSelectionReference: presets$t.compatPreset,
productTypeReference: presets$s.compatPreset,
quoteReference: presets$r.compatPreset,
quoteRequestReference: presets$q.compatPreset,
reviewReference: presets$p.compatPreset,
shippingMethodReference: presets$o.compatPreset,
shoppingListReference: presets$n.compatPreset,
stagedQuoteReference: presets$m.compatPreset,
standalonePriceReference: presets$l.compatPreset,
stateReference: presets$k.compatPreset,
storeReference: presets$j.compatPreset,
subscriptionReference: presets$i.compatPreset,
taxCategoryReference: presets$h.compatPreset,
typeReference: presets$g.compatPreset,
zoneReference: presets$f.compatPreset
};
const ReferenceDraftRest = {
random: RestModelBuilder$4,
presets: restPresets$4
};
const ReferenceDraftGraphql = {
random: GraphqlModelBuilder$4,
presets: graphqlPresets$4
};
/**
* @deprecated Use `ReferenceDraftRest` or `ReferenceDraftGraphql` exported models instead of `ReferenceDraft`.
*/
const ReferenceDraft = {
random: CompatModelBuilder$1,
presets: compatPresets$1
};
const ReferenceRest = {
random: RestModelBuilder$5,
presets: restPresets$5
};
const ReferenceGraphql = {
random: GraphqlModelBuilder$5,
presets: graphqlPresets$5
};
/**
* @deprecated Use `ReferenceRest` or `ReferenceGraphql` exported models instead of `Reference`.
*/
const Reference = {
random: CompatModelBuilder$2,
presets: compatPresets$2,
constants
};
// https://docs.commercetools.com/api/types#client-logging
const generator$d = core.Generator({
fields: {
externalUserId: core.fake(f => f.string.uuid()),
anonymousId: core.fake(f => f.string.uuid()),
clientId: core.fake(f => f.string.uuid()),
customer: core.fake(() => Reference.random().typeId('customer'))
}
});
const transformers$d = {
default: core.Transformer('default', {
buildFields: ['customer']
}),
rest: core.Transformer('rest', {
buildFields: ['customer']
}),
graphql: core.Transformer('graphql', {
replaceFields: _ref => {
let fields = _ref.fields;
const customerRef = core.buildField(fields.customer, 'graphql');
const userRef = Reference.random().typeId('user').buildGraphql();
return {
__typename: 'Initiator',
isPlatformClient: faker.faker.datatype.boolean(),
externalUserId: fields.externalUserId,
anonymousId: fields.anonymousId,
clientId: fields.clientId,
customerRef,
userRef
};
}
})
};
const Model$c = () => core.Builder({
name: 'ClientLogging',
generator: generator$d,
transformers: transformers$d
});
var index$e = {};
var index$d = /*#__PURE__*/Object.freeze({
__proto__: null,
random: Model$c,
presets: index$e
});
// https://docs.commercetools.com/api/types#highprecisionmoneydraft
const generator$c = core.Generator({
fields: {
type: 'highPrecision',
currencyCode: core.oneOf('EUR', 'USD'),
fractionDigits: core.fake(f => f.number.int({
min: 3,
max: 10
})),
preciseAmount: core.fake(f => f.number.int({
min: 1,
max: 9999999999
}))
}
});
const transformers$c = {
default: core.Transformer('default', {
buildFields: []
}),
rest: core.Transformer('rest', {
buildFields: []
}),
graphql: core.Transformer('graphql', {
buildFields: []
})
};
const Model$b = () => core.Builder({
name: 'HighPrecisionMoneyDraft',
generator: generator$c,
transformers: transformers$c
});
const presets$e = {};
var index$c = /*#__PURE__*/Object.freeze({
__proto__: null,
random: Model$b,
presets: presets$e
});
function ownKeys$5(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$5(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$5(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
// https://docs.commercetools.com/api/types#highprecisionmoney
const CENT_PRECISION_FRACTION_DIGITS = 2;
const generator$b = core.Generator({
fields: {
type: 'highPrecision',
centAmount: 1,
currencyCode: core.oneOf('EUR', 'USD'),
fractionDigits: core.fake(f => f.number.int({
min: 3,
max: 10
})),
preciseAmount: core.fake(f => f.number.int({
min: 1,
max: 9999999999
}))
},
postBuild: highPrecision => {
const centAmount = Math.round(highPrecision.preciseAmount / 10 ** (highPrecision.fractionDigits - CENT_PRECISION_FRACTION_DIGITS));
return _objectSpread$5(_objectSpread$5({}, highPrecision), {}, {
centAmount
});
}
});
const transformers$b = {
default: core.Transformer('default', {
buildFields: []
}),
rest: core.Transformer('rest', {
buildFields: []
}),
graphql: core.Transformer('graphql', {
buildFields: [],
addFields: () => ({
__typename: 'HighPrecisionMoney'
})
})
};
const Model$a = () => core.Builder({
name: 'HighPrecisionMoney',
generator: generator$b,
transformers: transformers$b
});
const presets$d = {};
var index$b = /*#__PURE__*/Object.freeze({
__proto__: null,
HighPrecisionMoneyDraft: index$c,
random: Model$a,
presets: presets$d
});
// https://docs.commercetools.com/api/types#keyreference
const generator$a = core.Generator({
fields: {
typeId: null,
key: core.fake(f => f.string.alphanumeric(8))
}
});
const transformers$a = {
default: core.Transformer('default', {}),
rest: core.Transformer('rest', {}),
graphql: core.Transformer('graphql', {})
};
const Model$9 = () => core.Builder({
name: 'KeyReferenceDraft',
generator: generator$a,
transformers: transformers$a
});
const associateRole$1 = () => Model$9().typeId('associate-role');
const businessUnit$1 = () => Model$9().typeId('business-unit');
const cart = () => Model$9().typeId('cart');
const category$1 = () => Model$9().typeId('category');
const channel$1 = () => Model$9().typeId('channel');
const customerGroup$1 = () => Model$9().typeId('customer-group');
const customer$1 = () => Model$9().typeId('customer');
const productSelection = () => Model$9().typeId('product-selection');
const productType$1 = () => Model$9().typeId('product-type');
const quote = () => Model$9().typeId('quote');
const quoteRequest = () => Model$9().typeId('quote-request');
const shippingMethod$1 = () => Model$9().typeId('shipping-method');
const stagedQuote = () => Model$9().typeId('staged-quote');
const storeReference$1 = () => Model$9().typeId('store');
const taxCategory$1 = () => Model$9().typeId('tax-category');
const zoneReference$1 = () => Model$9().typeId('zone');
const presets$c = {
associateRole: associateRole$1,
businessUnit: businessUnit$1,
cart,
category: category$1,
channel: channel$1,
customer: customer$1,
customerGroup: customerGroup$1,
productSelection,
productType: productType$1,
quote,
quoteRequest,
shippingMethod: shippingMethod$1,
stagedQuote,
store: storeReference$1,
taxCategory: taxCategory$1,
zone: zoneReference$1
};
var index$a = /*#__PURE__*/Object.freeze({
__proto__: null,
random: Model$9,
presets: presets$c
});
// https://docs.commercetools.com/api/types#keyreference
const generator$9 = core.Generator({
fields: {
typeId: null,
key: core.fake(f => f.string.alphanumeric(8))
}
});
const transformers$9 = {
default: core.Transformer('default', {}),
rest: core.Transformer('rest', {}),
graphql: core.Transformer('graphql', {
addFields: () => ({
__typename: 'Reference'
})
})
};
const Model$8 = () => core.Builder({
name: 'KeyReference',
generator: generator$9,
transformers: transformers$9
});
const associateRole = () => Model$8().typeId('associate-role');
const businessUnit = () => Model$8().typeId('business-unit');
const category = () => Model$8().typeId('category');
const channel = () => Model$8().typeId('channel');
const customerGroup = () => Model$8().typeId('customer-group');
const customer = () => Model$8().typeId('customer');
const productType = () => Model$8().typeId('product-type');
const shippingMethod = () => Model$8().typeId('shipping-method');
const storeReference = () => Model$8().typeId('store');
const taxCategory = () => Model$8().typeId('tax-category');
const zoneReference = () => Model$8().typeId('zone');
const presets$b = {
associateRole,
businessUnit,
category,
channel,
customer,
customerGroup,
productType,
taxCategory,
shippingMethod,
zone: zoneReference,
store: storeReference
};
var index$9 = /*#__PURE__*/Object.freeze({
__proto__: null,
KeyReferenceDraft: index$a,
random: Model$8,
presets: presets$b
});
const generator$8 = core.Generator({
fields: {
locale: core.fake(f => f.helpers.arrayElement(['en', 'de', 'es'])),
value: core.fake(f => f.lorem.words({
min: 1,
max: 4
}))
}
});
const transformers$8 = {
default: core.Transformer('default', {}),
graphql: core.Transformer('graphql', {
addFields: () => ({
__typename: 'LocalizedField'
})
})
};
const Model$7 = () => core.Builder({
name: 'LocalizedField',
generator: generator$8,
transformers: transformers$8
});
const presets$a = {};
var index$8 = /*#__PURE__*/Object.freeze({
__proto__: null,
random: Model$7,
presets: presets$a
});
// https://docs.commercetools.com/api/types#localizedstring
const generator$7 = core.Generator({
fields: {
de: core.fake(f => f.lorem.words(5)),
en: core.fake(f => f.lorem.words(3)),
fr: core.fake(f => f.lorem.words(4))
}
});
const isNil$1 = value => value === undefined || value === null;
const transformers$7 = {
default: core.Transformer('default', {}),
rest: core.Transformer('rest', {}),
graphql: core.Transformer('graphql', {
replaceFields: _ref => {
var _context, _context2;
let fields = _ref.fields;
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](_context2 = _Object$entries__default["default"](fields)).call(_context2, _ref2 => {
let _ref3 = _slicedToArray(_ref2, 2),
value = _ref3[1];
return !isNil$1(value);
})).call(_context, _ref4 => {
let _ref5 = _slicedToArray(_ref4, 2),
locale = _ref5[0],
value = _ref5[1];
return {
locale,
value: value || ''
};
});
}
})
};
const Model$6 = () => core.Builder({
name: 'LocalizedStringDraft',
generator: generator$7,
transformers: transformers$7
});
const empty$2 = () => Model$6().en(undefined).de(undefined).fr(undefined);
const ofSlugs$1 = () => Model$6().en(faker.faker.lorem.slug()).de(faker.faker.lorem.slug()).fr(faker.faker.lorem.slug());
const presets$9 = {
empty: empty$2,
ofSlugs: ofSlugs$1
};
const toLocalizedField$1 = value => {
if (!value) {
return null;
}
const localizedField = core.buildField(value, 'graphql');
return localizedField;
};
var index$7 = /*#__PURE__*/Object.freeze({
__proto__: null,
random: Model$6,
presets: presets$9,
toLocalizedField: toLocalizedField$1
});
// https://docs.commercetools.com/api/types#localizedstring
const generator$6 = core.Generator({
fields: {
de: core.fake(f => f.lorem.words(5)),
en: core.fake(f => f.lorem.words(3)),
fr: core.fake(f => f.lorem.words(4))
}
});
const isNil = value => value === undefined || value === null;
const transformers$6 = {
default: core.Transformer('default', {}),
rest: core.Transformer('rest', {}),
graphql: core.Transformer('graphql', {
replaceFields: _ref => {
var _context, _context2;
let fields = _ref.fields;
return _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](_context2 = _Object$entries__default["default"](fields)).call(_context2, _ref2 => {
let _ref3 = _slicedToArray(_ref2, 2),
value = _ref3[1];
return !isNil(value);
})).call(_context, _ref4 => {
let _ref5 = _slicedToArray(_ref4, 2),
locale = _ref5[0],
value = _ref5[1];
return {
locale,
value: value || '',
__typename: 'LocalizedString'
};
});
}
})
};
const Model$5 = () => core.Builder({
name: 'LocalizedString',
generator: generator$6,
transformers: transformers$6
});
const empty$1 = () => Model$5().en(undefined).de(undefined).fr(undefined);
const ofSlugs = () => Model$5().en(faker.faker.lorem.slug()).de(faker.faker.lorem.slug()).fr(faker.faker.lorem.slug());
const presets$8 =