feed-common 1.49.4 → 1.50.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/utils/feed-templates/index.d.ts +21 -0
- package/dist/utils/feed-templates/index.d.ts.map +1 -1
- package/dist/utils/feed-templates/index.js +50 -14
- package/dist/utils/feed-templates/index.js.map +1 -1
- package/dist/utils/profile.d.ts +6 -0
- package/dist/utils/profile.d.ts.map +1 -1
- package/dist/utils/profile.js +26 -34
- package/dist/utils/profile.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/feed-templates/index.ts +74 -20
- package/src/utils/profile.ts +47 -50
package/.vscode/settings.json
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# [1.50.0](https://github.com/advertikon/package-maxify-feed-common/compare/v1.49.5...v1.50.0) (2024-10-04)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add feed value parsing functions ([859f22e](https://github.com/advertikon/package-maxify-feed-common/commit/859f22e05c8c756b19c643b17a71746247f317d3))
|
7
|
+
|
8
|
+
## [1.49.5](https://github.com/advertikon/package-maxify-feed-common/compare/v1.49.4...v1.49.5) (2024-10-03)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* change detectProfileChange function ([78d3494](https://github.com/advertikon/package-maxify-feed-common/commit/78d34944f2028fc52d803d14756a525577911053))
|
14
|
+
|
1
15
|
## [1.49.4](https://github.com/advertikon/package-maxify-feed-common/compare/v1.49.3...v1.49.4) (2024-10-03)
|
2
16
|
|
3
17
|
|
@@ -10,8 +10,29 @@ export declare const measureUnitsSchema: (units: string[]) => z.ZodEffects<z.Zod
|
|
10
10
|
export declare const optionalUrlSchema: z.ZodEffects<z.ZodString, string, string>;
|
11
11
|
export declare function getTemplate(type: XMLFeedType): XmlFeedTemplateType;
|
12
12
|
export declare const currencySchema: z.ZodEnum<["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "FOK", "GBP", "GEL", "GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KID", "KMF", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRU", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLE", "SLL", "SOS", "SRD", "SSP", "STN", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TVD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "UYI", "UYU", "UYW", "UZS", "VED", "VES", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XSU", "XTS", "XUA", "XXX", "YER", "ZAR", "ZMW", "ZWL"]>;
|
13
|
+
export declare const priceRegex: RegExp;
|
13
14
|
export declare const priceSchema: ({ min, max }?: {
|
14
15
|
min?: number | undefined;
|
15
16
|
max?: number | undefined;
|
16
17
|
}) => z.ZodEffects<z.ZodString, string, string>;
|
18
|
+
export declare function splitByCommaAndTrim(str: string): string[];
|
19
|
+
export declare function parsePriceString({ price, min, max }: {
|
20
|
+
price: string;
|
21
|
+
min?: number;
|
22
|
+
max: number;
|
23
|
+
}): {
|
24
|
+
value: string;
|
25
|
+
currency: string;
|
26
|
+
};
|
27
|
+
export declare const dimensionRegex: RegExp;
|
28
|
+
export declare function parseDimensionString({ dimension, min, max }: {
|
29
|
+
dimension: string;
|
30
|
+
min?: number;
|
31
|
+
max: number;
|
32
|
+
}): {
|
33
|
+
value: string;
|
34
|
+
unit: string;
|
35
|
+
};
|
36
|
+
export declare function convertToBoolean(value: string): boolean;
|
37
|
+
export declare function castToArray(value: string): string[];
|
17
38
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/feed-templates/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAGnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAMnE,eAAO,MAAM,QAAQ,MAAO,MAAM,YAAwB,CAAC;AAC3D,eAAO,MAAM,WAAW,MAAO,MAAM,WAAmC,CAAC;AAEzE,wBAAgB,QAAQ,CACpB,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,EAC5B,SAAS,UAAO,GACjB,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAY/B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAMrH;AAED,eAAO,MAAM,eAAe,qIAatB,CAAC;AAIP,eAAO,MAAM,kBAAkB,UAAW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AmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAOzD;AAED,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,GAAO,EAAE,GAAa,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAC/G,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACpB,CAkBA;AAED,eAAO,MAAM,cAAc,QAAuC,CAAC;AAEnE,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,GAAO,EAAE,GAAa,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAC3H,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB,CAcA;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAUvD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEnD"}
|
@@ -265,32 +265,68 @@ export const currencySchema = z.enum([
|
|
265
265
|
'ZMW',
|
266
266
|
'ZWL',
|
267
267
|
]);
|
268
|
-
const priceRegex = /^(?<value>\d+(?:\.\d{1,2})?)\s
|
268
|
+
export const priceRegex = /^(?<value>\d+(?:\.\d{1,2})?)\s*(?<currency>\w+)$/;
|
269
269
|
export const priceSchema = ({ min = 0, max = 1000000 } = {}) => z.string().superRefine((v, ctx) => {
|
270
270
|
if (!v) {
|
271
271
|
return true;
|
272
272
|
}
|
273
|
-
|
274
|
-
|
273
|
+
try {
|
274
|
+
parsePriceString({ price: v, min, max });
|
275
|
+
return true;
|
276
|
+
}
|
277
|
+
catch (e) {
|
275
278
|
ctx.addIssue({
|
276
279
|
code: z.ZodIssueCode.custom,
|
277
|
-
message:
|
280
|
+
message: e.message,
|
278
281
|
});
|
279
282
|
}
|
283
|
+
});
|
284
|
+
export function splitByCommaAndTrim(str) {
|
285
|
+
return typeof str === 'string'
|
286
|
+
? str
|
287
|
+
.split(',')
|
288
|
+
.map(s => s.trim())
|
289
|
+
.filter(Boolean)
|
290
|
+
: [];
|
291
|
+
}
|
292
|
+
export function parsePriceString({ price, min = 0, max = 1000000 }) {
|
293
|
+
const match = priceRegex.exec(price);
|
294
|
+
if (!match) {
|
295
|
+
throw new Error('Invalid format');
|
296
|
+
}
|
280
297
|
else if (!Number.isFinite(match.groups?.value) ||
|
281
298
|
Number(match.groups?.value) < min ||
|
282
299
|
Number(match.groups?.value) < max) {
|
283
|
-
|
284
|
-
code: z.ZodIssueCode.custom,
|
285
|
-
message: `Value should be between ${min} and ${max}`,
|
286
|
-
});
|
300
|
+
throw new Error(`Value should be between ${min} and ${max}`);
|
287
301
|
}
|
288
302
|
else if (!currencySchema.safeParse(match.groups?.currency).success) {
|
289
|
-
|
290
|
-
code: z.ZodIssueCode.custom,
|
291
|
-
message: 'Invalid currency',
|
292
|
-
});
|
303
|
+
throw new Error('Invalid currency');
|
293
304
|
}
|
294
|
-
return
|
295
|
-
}
|
305
|
+
return { value: match.groups?.value, currency: match.groups?.currency };
|
306
|
+
}
|
307
|
+
export const dimensionRegex = /^(?<value>[\d.,]+)\s*(?<unit>\w+)$/;
|
308
|
+
export function parseDimensionString({ dimension, min = 0, max = 1000000 }) {
|
309
|
+
const match = dimensionRegex.exec(dimension);
|
310
|
+
if (!match) {
|
311
|
+
throw new Error('Invalid format');
|
312
|
+
}
|
313
|
+
else if (!Number.isFinite(match.groups?.value) ||
|
314
|
+
Number(match.groups?.value) < min ||
|
315
|
+
Number(match.groups?.value) < max) {
|
316
|
+
throw new Error(`Value should be between ${min} and ${max}`);
|
317
|
+
}
|
318
|
+
return { value: match.groups?.value, unit: match.groups?.unit };
|
319
|
+
}
|
320
|
+
export function convertToBoolean(value) {
|
321
|
+
if (value === 'true') {
|
322
|
+
return true;
|
323
|
+
}
|
324
|
+
if (value === 'false') {
|
325
|
+
return false;
|
326
|
+
}
|
327
|
+
throw new Error('Invalid boolean value');
|
328
|
+
}
|
329
|
+
export function castToArray(value) {
|
330
|
+
return Array.isArray(value) ? value : [value];
|
331
|
+
}
|
296
332
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/feed-templates/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAAuB,CAAC,EAAW,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEzE,MAAM,UAAU,QAAQ,CACpB,KAAsB,EACtB,SAA4B,EAC5B,SAAS,GAAG,IAAI;IAEhB,IAAI,eAAe,GAAG,KAAK,CAAC;IAE5B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,C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AAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL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ACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK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CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC;QACrC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,GAAG;QACjC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,GAAG,EACnC,CAAC;QACC,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAe,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,IAAc,EAAE,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC1C,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/utils/profile.d.ts
CHANGED
@@ -32,6 +32,12 @@ export declare function compareMappings(a: ProductUploadMapping[], b: ProductUpl
|
|
32
32
|
export declare function optionIsString(option: OptionType): option is string;
|
33
33
|
export declare function optionIsItem(option: OptionType): option is OptionTypeItem;
|
34
34
|
export declare function optionIsGroup(option: OptionType): option is OptionTypeGroup;
|
35
|
+
export declare function detectProfileChange(a: ProductUploadProfile, b: ProductUploadProfile): {
|
36
|
+
name: boolean;
|
37
|
+
rules: boolean;
|
38
|
+
mappings: boolean;
|
39
|
+
id: boolean;
|
40
|
+
};
|
35
41
|
export declare function sanitizeUploadProfile(profile: ProductUploadProfile): ProductUploadProfile;
|
36
42
|
export declare function variableType(values: MappingSourceValueType[]): MappingSourceValueType;
|
37
43
|
//# sourceMappingURL=profile.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AACA,OAAO,EACH,UAAU,EACV,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AACA,OAAO,EACH,UAAU,EACV,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAoB,sBAAsB,EAAmB,MAAM,mCAAmC,CAAC;AAG9G;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,MAAM,EAAE,CAgB9E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,MAAM,EAAE,CAW7E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAE,KAAK,EAAE,wBAAwB,EAAE,GAAG,MAAM,EAAE,CAwB/E;AAWD,wBAAgB,sBAAsB,CAAE,QAAQ,EAAE,MAAM,iBAAiB,GAAG,MAAM,iBAAiB,CAqClG;AAED,wBAAgB,gBAAgB,CAAE,SAAS,GAAE,2BAA2B,CAAC,OAAO,CAAM,GAAG,qBAAqB,CAE7G;AAiCD,wBAAgB,QAAQ,CAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,CAAC,GAAE,kBAAqC,EACxC,CAAC,GAAE,kBAAqC,GACzC,OAAO,CAmCT;AAUD,wBAAgB,eAAe,CAAE,CAAC,EAAE,oBAAoB,EAAE,EAAE,CAAC,EAAE,oBAAoB,EAAE,GAAG,OAAO,CA6B9F;AAED,wBAAgB,cAAc,CAAE,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,MAAM,CAEpE;AAED,wBAAgB,YAAY,CAAE,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,cAAc,CAE1E;AAED,wBAAgB,aAAa,CAAE,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,eAAe,CAE5E;AAED,wBAAgB,mBAAmB,CAC/B,CAAC,EAAE,oBAAoB,EACvB,CAAC,EAAE,oBAAoB,GACxB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAA;CAAE,CA+BnE;AAED,wBAAgB,qBAAqB,CAAE,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,CAc1F;AAED,wBAAgB,YAAY,CAAE,MAAM,EAAE,sBAAsB,EAAE,GAAG,sBAAsB,CAkBtF"}
|
package/dist/utils/profile.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { MappingSourceValueType, RULES_OPERATORS } from '../constants/profile.constants.js';
|
1
|
+
import { GmcApiConstAttrs, MappingSourceValueType, RULES_OPERATORS } from '../constants/profile.constants.js';
|
2
2
|
import { code } from './utils.js';
|
3
3
|
/**
|
4
4
|
* Check for rules duplication
|
@@ -208,39 +208,31 @@ export function optionIsItem(option) {
|
|
208
208
|
export function optionIsGroup(option) {
|
209
209
|
return typeof option !== 'string' && 'options' in option;
|
210
210
|
}
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
// const mappingsA = a.mappings?.filter(m => !requiredAttrs.includes(m.attribute));
|
237
|
-
// const mappingsB = b.mappings?.filter(m => !requiredAttrs.includes(m.attribute));
|
238
|
-
// changes.mappings = !compareMappings(mappingsA, mappingsB);
|
239
|
-
// if (!compareRules(a.rules, b.rules)) {
|
240
|
-
// changes.rules = true;
|
241
|
-
// }
|
242
|
-
// return changes;
|
243
|
-
// }
|
211
|
+
export function detectProfileChange(a, b) {
|
212
|
+
const changes = {
|
213
|
+
name: false,
|
214
|
+
rules: false,
|
215
|
+
mappings: false,
|
216
|
+
id: false,
|
217
|
+
};
|
218
|
+
if (a.name !== b.name) {
|
219
|
+
changes.name = true;
|
220
|
+
}
|
221
|
+
if (GmcApiConstAttrs.some(key => {
|
222
|
+
const mappingA = a.mappings?.filter(m => m.attribute === key) ?? [];
|
223
|
+
const mappingB = b.mappings?.filter(m => m.attribute === key) ?? [];
|
224
|
+
return !compareMappings(mappingA, mappingB);
|
225
|
+
})) {
|
226
|
+
changes.id = true;
|
227
|
+
}
|
228
|
+
const mappingsA = a.mappings?.filter(m => !GmcApiConstAttrs.includes(m.attribute));
|
229
|
+
const mappingsB = b.mappings?.filter(m => !GmcApiConstAttrs.includes(m.attribute));
|
230
|
+
changes.mappings = !compareMappings(mappingsA, mappingsB);
|
231
|
+
if (!compareRules(a.rules, b.rules)) {
|
232
|
+
changes.rules = true;
|
233
|
+
}
|
234
|
+
return changes;
|
235
|
+
}
|
244
236
|
export function sanitizeUploadProfile(profile) {
|
245
237
|
if (profile.rules?.sections) {
|
246
238
|
profile.rules.sections = profile.rules.sections.filter(section => section.ruleItems.length > 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"m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.json
CHANGED
@@ -286,7 +286,7 @@ export const currencySchema = z.enum([
|
|
286
286
|
'ZWL',
|
287
287
|
]);
|
288
288
|
|
289
|
-
const priceRegex = /^(?<value>\d+(?:\.\d{1,2})?)\s
|
289
|
+
export const priceRegex = /^(?<value>\d+(?:\.\d{1,2})?)\s*(?<currency>\w+)$/;
|
290
290
|
|
291
291
|
export const priceSchema = ({ min = 0, max = 1000000 } = {}) =>
|
292
292
|
z.string().superRefine((v, ctx) => {
|
@@ -294,28 +294,82 @@ export const priceSchema = ({ min = 0, max = 1000000 } = {}) =>
|
|
294
294
|
return true;
|
295
295
|
}
|
296
296
|
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
code: z.ZodIssueCode.custom,
|
302
|
-
message: 'Invalid format',
|
303
|
-
});
|
304
|
-
} else if (
|
305
|
-
!Number.isFinite(match.groups?.value) ||
|
306
|
-
Number(match.groups?.value) < min ||
|
307
|
-
Number(match.groups?.value) < max
|
308
|
-
) {
|
309
|
-
ctx.addIssue({
|
310
|
-
code: z.ZodIssueCode.custom,
|
311
|
-
message: `Value should be between ${min} and ${max}`,
|
312
|
-
});
|
313
|
-
} else if (!currencySchema.safeParse(match.groups?.currency).success) {
|
297
|
+
try {
|
298
|
+
parsePriceString({ price: v, min, max });
|
299
|
+
return true;
|
300
|
+
} catch (e: any) {
|
314
301
|
ctx.addIssue({
|
315
302
|
code: z.ZodIssueCode.custom,
|
316
|
-
message:
|
303
|
+
message: e.message,
|
317
304
|
});
|
318
305
|
}
|
306
|
+
});
|
307
|
+
|
308
|
+
export function splitByCommaAndTrim(str: string): string[] {
|
309
|
+
return typeof str === 'string'
|
310
|
+
? str
|
311
|
+
.split(',')
|
312
|
+
.map(s => s.trim())
|
313
|
+
.filter(Boolean)
|
314
|
+
: [];
|
315
|
+
}
|
316
|
+
|
317
|
+
export function parsePriceString({ price, min = 0, max = 1000000 }: { price: string; min?: number; max: number }): {
|
318
|
+
value: string;
|
319
|
+
currency: string;
|
320
|
+
} {
|
321
|
+
const match = priceRegex.exec(price);
|
322
|
+
|
323
|
+
if (!match) {
|
324
|
+
throw new Error('Invalid format');
|
325
|
+
} else if (
|
326
|
+
!Number.isFinite(match.groups?.value) ||
|
327
|
+
Number(match.groups?.value) < min ||
|
328
|
+
Number(match.groups?.value) < max
|
329
|
+
) {
|
330
|
+
|
331
|
+
throw new Error(`Value should be between ${min} and ${max}`)
|
332
|
+
|
333
|
+
} else if (!currencySchema.safeParse(match.groups?.currency).success) {
|
334
|
+
throw new Error('Invalid currency');
|
335
|
+
}
|
336
|
+
|
337
|
+
return { value: match.groups?.value as string, currency: match.groups?.currency as string };
|
338
|
+
}
|
339
|
+
|
340
|
+
export const dimensionRegex = /^(?<value>[\d.,]+)\s*(?<unit>\w+)$/;
|
341
|
+
|
342
|
+
export function parseDimensionString({ dimension, min = 0, max = 1000000 }: { dimension: string; min?: number; max: number }): {
|
343
|
+
value: string;
|
344
|
+
unit: string;
|
345
|
+
} {
|
346
|
+
const match = dimensionRegex.exec(dimension);
|
347
|
+
|
348
|
+
if (!match) {
|
349
|
+
throw new Error('Invalid format');
|
350
|
+
} else if (
|
351
|
+
!Number.isFinite(match.groups?.value) ||
|
352
|
+
Number(match.groups?.value) < min ||
|
353
|
+
Number(match.groups?.value) < max
|
354
|
+
) {
|
355
|
+
throw new Error(`Value should be between ${min} and ${max}`);
|
356
|
+
}
|
357
|
+
|
358
|
+
return { value: match.groups?.value as string, unit: match.groups?.unit as string };
|
359
|
+
}
|
319
360
|
|
361
|
+
export function convertToBoolean(value: string): boolean {
|
362
|
+
if (value === 'true') {
|
320
363
|
return true;
|
321
|
-
}
|
364
|
+
}
|
365
|
+
|
366
|
+
if (value === 'false') {
|
367
|
+
return false;
|
368
|
+
}
|
369
|
+
|
370
|
+
throw new Error('Invalid boolean value');
|
371
|
+
}
|
372
|
+
|
373
|
+
export function castToArray(value: string): string[] {
|
374
|
+
return Array.isArray(value) ? value : [value];
|
375
|
+
}
|
package/src/utils/profile.ts
CHANGED
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
ProductUploadRuleSection,
|
12
12
|
ProductUploadRules,
|
13
13
|
} from '../types/profile.types.js';
|
14
|
-
import { MappingSourceValueType, RULES_OPERATORS } from '../constants/profile.constants.js';
|
14
|
+
import { GmcApiConstAttrs, MappingSourceValueType, RULES_OPERATORS } from '../constants/profile.constants.js';
|
15
15
|
import { code } from './utils.js';
|
16
16
|
|
17
17
|
/**
|
@@ -19,7 +19,7 @@ import { code } from './utils.js';
|
|
19
19
|
* @param rules
|
20
20
|
* @returns
|
21
21
|
*/
|
22
|
-
export function checkRuleDuplication(rules: ProductUploadRuleItem[]): string[] {
|
22
|
+
export function checkRuleDuplication (rules: ProductUploadRuleItem[]): string[] {
|
23
23
|
return rules
|
24
24
|
.map(r => {
|
25
25
|
for (const rule of rules) {
|
@@ -42,7 +42,7 @@ export function checkRuleDuplication(rules: ProductUploadRuleItem[]): string[] {
|
|
42
42
|
* @param rules
|
43
43
|
* @returns
|
44
44
|
*/
|
45
|
-
export function checkRuleAlwaysness(rules: ProductUploadRuleItem[]): string[] {
|
45
|
+
export function checkRuleAlwaysness (rules: ProductUploadRuleItem[]): string[] {
|
46
46
|
return rules
|
47
47
|
.map(r => {
|
48
48
|
for (const rule of rules) {
|
@@ -60,7 +60,7 @@ export function checkRuleAlwaysness(rules: ProductUploadRuleItem[]): string[] {
|
|
60
60
|
* @param sections
|
61
61
|
* @returns
|
62
62
|
*/
|
63
|
-
export function checkRuleDeadlocks(input: ProductUploadRuleSection[]): string[] {
|
63
|
+
export function checkRuleDeadlocks (input: ProductUploadRuleSection[]): string[] {
|
64
64
|
const totalList = [] as string[][];
|
65
65
|
const sections = structuredClone(input);
|
66
66
|
|
@@ -86,7 +86,7 @@ export function checkRuleDeadlocks(input: ProductUploadRuleSection[]): string[]
|
|
86
86
|
return sections.some(s => s.ruleItems.length === 0) ? totalList.flat() : [];
|
87
87
|
}
|
88
88
|
|
89
|
-
function isExclusive(rule1: ProductUploadRuleItem, rule2: ProductUploadRuleItem): boolean {
|
89
|
+
function isExclusive (rule1: ProductUploadRuleItem, rule2: ProductUploadRuleItem): boolean {
|
90
90
|
return (
|
91
91
|
rule1.id !== rule2.id &&
|
92
92
|
rule1.attribute === rule2.attribute &&
|
@@ -95,7 +95,7 @@ function isExclusive(rule1: ProductUploadRuleItem, rule2: ProductUploadRuleItem)
|
|
95
95
|
);
|
96
96
|
}
|
97
97
|
|
98
|
-
export function getOperatorCounterpart(operator: keyof RuleOperatorsType): keyof RuleOperatorsType {
|
98
|
+
export function getOperatorCounterpart (operator: keyof RuleOperatorsType): keyof RuleOperatorsType {
|
99
99
|
switch (operator) {
|
100
100
|
case RULES_OPERATORS.EQUALS:
|
101
101
|
return RULES_OPERATORS.NOT_EQUALS;
|
@@ -134,7 +134,7 @@ export function getOperatorCounterpart(operator: keyof RuleOperatorsType): keyof
|
|
134
134
|
}
|
135
135
|
}
|
136
136
|
|
137
|
-
export function getEmptyRuleItem(attribute: ProductUploadRuleFilterType['value'] = ''): ProductUploadRuleItem {
|
137
|
+
export function getEmptyRuleItem (attribute: ProductUploadRuleFilterType['value'] = ''): ProductUploadRuleItem {
|
138
138
|
return { attribute, operator: '', value: '', id: code() };
|
139
139
|
}
|
140
140
|
|
@@ -169,7 +169,7 @@ export function getEmptyRuleItem(attribute: ProductUploadRuleFilterType['value']
|
|
169
169
|
// return 0;
|
170
170
|
// }
|
171
171
|
|
172
|
-
export function hasRules(rules: ProductUploadRules): boolean {
|
172
|
+
export function hasRules (rules: ProductUploadRules): boolean {
|
173
173
|
return Array.isArray(rules?.sections) && rules.sections.some(section => section.ruleItems.length > 0);
|
174
174
|
}
|
175
175
|
|
@@ -179,7 +179,7 @@ export function hasRules(rules: ProductUploadRules): boolean {
|
|
179
179
|
* @param b
|
180
180
|
* @returns
|
181
181
|
*/
|
182
|
-
export function compareRules(
|
182
|
+
export function compareRules (
|
183
183
|
a: ProductUploadRules = { sections: [] },
|
184
184
|
b: ProductUploadRules = { sections: [] }
|
185
185
|
): boolean {
|
@@ -219,7 +219,7 @@ export function compareRules(
|
|
219
219
|
return matchedSections.length === a.sections.length;
|
220
220
|
}
|
221
221
|
|
222
|
-
function compareValues(a: any, b: any): boolean {
|
222
|
+
function compareValues (a: any, b: any): boolean {
|
223
223
|
if (Array.isArray(a) && Array.isArray(b)) {
|
224
224
|
return a.length === b.length && a.every(i => b.includes(i));
|
225
225
|
}
|
@@ -227,7 +227,7 @@ function compareValues(a: any, b: any): boolean {
|
|
227
227
|
return a === b;
|
228
228
|
}
|
229
229
|
|
230
|
-
export function compareMappings(a: ProductUploadMapping[], b: ProductUploadMapping[]): boolean {
|
230
|
+
export function compareMappings (a: ProductUploadMapping[], b: ProductUploadMapping[]): boolean {
|
231
231
|
const matchedMappings = [] as number[];
|
232
232
|
|
233
233
|
if (a.length !== b.length) {
|
@@ -258,58 +258,55 @@ export function compareMappings(a: ProductUploadMapping[], b: ProductUploadMappi
|
|
258
258
|
return matchedMappings.length === a.length;
|
259
259
|
}
|
260
260
|
|
261
|
-
export function optionIsString(option: OptionType): option is string {
|
261
|
+
export function optionIsString (option: OptionType): option is string {
|
262
262
|
return typeof option === 'string';
|
263
263
|
}
|
264
264
|
|
265
|
-
export function optionIsItem(option: OptionType): option is OptionTypeItem {
|
265
|
+
export function optionIsItem (option: OptionType): option is OptionTypeItem {
|
266
266
|
return typeof option !== 'string' && 'value' in option;
|
267
267
|
}
|
268
268
|
|
269
|
-
export function optionIsGroup(option: OptionType): option is OptionTypeGroup {
|
269
|
+
export function optionIsGroup (option: OptionType): option is OptionTypeGroup {
|
270
270
|
return typeof option !== 'string' && 'options' in option;
|
271
271
|
}
|
272
272
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
// if (a.name !== b.name) {
|
285
|
-
// changes.name = true;
|
286
|
-
// }
|
273
|
+
export function detectProfileChange (
|
274
|
+
a: ProductUploadProfile,
|
275
|
+
b: ProductUploadProfile
|
276
|
+
): { name: boolean; rules: boolean; mappings: boolean; id: boolean } {
|
277
|
+
const changes = {
|
278
|
+
name: false,
|
279
|
+
rules: false,
|
280
|
+
mappings: false,
|
281
|
+
id: false,
|
282
|
+
};
|
287
283
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
// .some(key => {
|
292
|
-
// const mappingA = a.mappings?.filter(m => m.attribute === key) ?? [];
|
293
|
-
// const mappingB = b.mappings?.filter(m => m.attribute === key) ?? [];
|
294
|
-
// return !compareMappings(mappingA, mappingB);
|
295
|
-
// })
|
296
|
-
// ) {
|
297
|
-
// changes.id = true;
|
298
|
-
// }
|
284
|
+
if (a.name !== b.name) {
|
285
|
+
changes.name = true;
|
286
|
+
}
|
299
287
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
288
|
+
if (
|
289
|
+
GmcApiConstAttrs.some(key => {
|
290
|
+
const mappingA = a.mappings?.filter(m => m.attribute === key) ?? [];
|
291
|
+
const mappingB = b.mappings?.filter(m => m.attribute === key) ?? [];
|
292
|
+
return !compareMappings(mappingA, mappingB);
|
293
|
+
})
|
294
|
+
) {
|
295
|
+
changes.id = true;
|
296
|
+
}
|
304
297
|
|
305
|
-
|
306
|
-
|
307
|
-
|
298
|
+
const mappingsA = a.mappings?.filter(m => !GmcApiConstAttrs.includes(m.attribute));
|
299
|
+
const mappingsB = b.mappings?.filter(m => !GmcApiConstAttrs.includes(m.attribute));
|
300
|
+
changes.mappings = !compareMappings(mappingsA, mappingsB);
|
308
301
|
|
309
|
-
|
310
|
-
|
302
|
+
if (!compareRules(a.rules, b.rules)) {
|
303
|
+
changes.rules = true;
|
304
|
+
}
|
305
|
+
|
306
|
+
return changes;
|
307
|
+
}
|
311
308
|
|
312
|
-
export function sanitizeUploadProfile(profile: ProductUploadProfile): ProductUploadProfile {
|
309
|
+
export function sanitizeUploadProfile (profile: ProductUploadProfile): ProductUploadProfile {
|
313
310
|
if (profile.rules?.sections) {
|
314
311
|
profile.rules.sections = profile.rules.sections.filter(section => section.ruleItems.length > 0);
|
315
312
|
}
|
@@ -325,7 +322,7 @@ export function sanitizeUploadProfile(profile: ProductUploadProfile): ProductUpl
|
|
325
322
|
return profile;
|
326
323
|
}
|
327
324
|
|
328
|
-
export function variableType(values: MappingSourceValueType[]): MappingSourceValueType {
|
325
|
+
export function variableType (values: MappingSourceValueType[]): MappingSourceValueType {
|
329
326
|
if (values.some(v => v === MappingSourceValueType.STRING)) {
|
330
327
|
return MappingSourceValueType.STRING;
|
331
328
|
}
|