@unchainedshop/core 4.8.1 → 4.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,9 +59,12 @@ export default function createBulkImporterFactory(db, bulkImporterOptions) {
59
59
  }
60
60
  }
61
61
  catch (e) {
62
- throw new Error(`🤧 ${entity}.${operation}.${event.payload?._id || '*'} (${e.message})`, {
63
- cause: e,
64
- });
62
+ const prefix = `🤧 ${entity}.${operation}.${event.payload?._id || '*'}`;
63
+ if (e.issues) {
64
+ const summary = e.issues.map((issue) => issue.message).join(', ');
65
+ throw new Error(`${prefix} (${summary})`, { cause: e });
66
+ }
67
+ throw new Error(`${prefix} (${e.message})`, { cause: e });
65
68
  }
66
69
  },
67
70
  prepare: async (event, unchainedAPI) => {
@@ -6,7 +6,7 @@ export declare const AssortmentCreatePayloadSchema: z.ZodMiniObject<{
6
6
  specification: z.ZodMiniObject<{
7
7
  isActive: z.ZodMiniBoolean<boolean>;
8
8
  isRoot: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
9
- sequence: z.ZodMiniNumber<number>;
9
+ sequence: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
10
10
  tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
11
11
  meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
12
12
  content: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
@@ -71,7 +71,7 @@ declare namespace createAssortment {
71
71
  specification: z.ZodMiniObject<{
72
72
  isActive: z.ZodMiniBoolean<boolean>;
73
73
  isRoot: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
74
- sequence: z.ZodMiniNumber<number>;
74
+ sequence: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
75
75
  tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
76
76
  meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniAny, z.ZodMiniAny>>;
77
77
  content: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
@@ -9,7 +9,7 @@ export const AssortmentCreatePayloadSchema = z.object({
9
9
  specification: z.object({
10
10
  isActive: z.boolean(),
11
11
  isRoot: z.optional(z.boolean()),
12
- sequence: z.number(),
12
+ sequence: z.optional(z.number()),
13
13
  tags: z.optional(z.array(z.string())),
14
14
  meta: z.optional(z.record(z.any(), z.any())),
15
15
  content: z.optional(z.record(z.string(), z.object({
@@ -9,7 +9,7 @@ export declare const ProductCreateSpecificationSchema: z.ZodMiniObject<{
9
9
  readonly PLAN_PRODUCT: "PLAN_PRODUCT";
10
10
  readonly TOKENIZED_PRODUCT: "TOKENIZED_PRODUCT";
11
11
  }>;
12
- sequence: z.ZodMiniNumber<number>;
12
+ sequence: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
13
13
  status: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
14
14
  published: z.ZodMiniOptional<z.ZodMiniNullable<z.iso.ZodMiniISODateTime>>;
15
15
  tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
@@ -66,7 +66,7 @@ export declare const ProductCreatePayloadSchema: z.ZodMiniObject<{
66
66
  readonly PLAN_PRODUCT: "PLAN_PRODUCT";
67
67
  readonly TOKENIZED_PRODUCT: "TOKENIZED_PRODUCT";
68
68
  }>;
69
- sequence: z.ZodMiniNumber<number>;
69
+ sequence: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
70
70
  status: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
71
71
  published: z.ZodMiniOptional<z.ZodMiniNullable<z.iso.ZodMiniISODateTime>>;
72
72
  tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
@@ -169,7 +169,7 @@ declare namespace createProduct {
169
169
  readonly PLAN_PRODUCT: "PLAN_PRODUCT";
170
170
  readonly TOKENIZED_PRODUCT: "TOKENIZED_PRODUCT";
171
171
  }>;
172
- sequence: z.ZodMiniNumber<number>;
172
+ sequence: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
173
173
  status: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
174
174
  published: z.ZodMiniOptional<z.ZodMiniNullable<z.iso.ZodMiniISODateTime>>;
175
175
  tags: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
@@ -6,7 +6,7 @@ import convertTagsToLowerCase from "../utils/convertTagsToLowerCase.js";
6
6
  import { ProductType } from '@unchainedshop/core-products';
7
7
  export const ProductCreateSpecificationSchema = z.object({
8
8
  type: z.enum(ProductType),
9
- sequence: z.number(),
9
+ sequence: z.optional(z.number()),
10
10
  status: z.nullish(z.string()),
11
11
  published: z.nullish(z.iso.datetime()),
12
12
  tags: z.optional(z.array(z.string())),
@@ -60,7 +60,7 @@ export const ProductCreatePayloadSchema = z.object({
60
60
  variations: z.optional(z.array(ProductVariationSchema)),
61
61
  });
62
62
  const transformSpecification = (specification) => {
63
- const { variationResolvers: assignments, content, supply, warehousing, ...productData } = specification;
63
+ const { variationResolvers: assignments, content, supply, warehousing, sequence, ...productData } = specification;
64
64
  const tags = productData?.tags ? convertTagsToLowerCase(productData.tags) : [];
65
65
  const proxy = assignments ? { assignments } : undefined;
66
66
  return {
@@ -70,6 +70,7 @@ const transformSpecification = (specification) => {
70
70
  warehousing,
71
71
  supply,
72
72
  proxy,
73
+ ...(sequence != null && { sequence }),
73
74
  };
74
75
  };
75
76
  export default async function createProduct(payload, { logger, createShouldUpsertIfIDExists }, unchainedAPI) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core",
3
3
  "description": "Core orchestration package for the Unchained Engine with business services and directors",
4
- "version": "4.8.1",
4
+ "version": "4.8.3",
5
5
  "main": "lib/core-index.js",
6
6
  "types": "lib/core-index.d.ts",
7
7
  "type": "module",