@commercetools/sync-actions 8.1.0 → 8.2.1

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.
@@ -24,4 +24,5 @@ export { default as createSyncAttributeGroups } from './attribute-groups/attribu
24
24
  export { default as createSyncApiExtensions } from './api-extensions/api-extensions';
25
25
  export { default as createSyncBusinessUnits } from './business-units/business-units';
26
26
  export { default as createSyncSubscriptions } from './subscriptions/subscriptions';
27
+ export { default as createSyncStandaloneVariants } from './standalone-variants/standalone-variants';
27
28
  export * from './utils/types';
@@ -0,0 +1,47 @@
1
+ import { Asset, Attribute, Delta, Image, SyncActionConfig, UpdateAction } from '../utils/types';
2
+ export type StandaloneVariant = {
3
+ id?: string | number;
4
+ key?: string;
5
+ published?: boolean;
6
+ sku?: string;
7
+ attributes?: Attribute[];
8
+ images?: Image[];
9
+ assets?: Asset[];
10
+ };
11
+ export type StandaloneVariantUpdateAction = UpdateAction & {
12
+ staged?: boolean;
13
+ attributes?: Array<{
14
+ name: string;
15
+ value?: string;
16
+ }>;
17
+ };
18
+ /**
19
+ * Converts an attribute to the format required by the setAttributes action.
20
+ * The value is JSON stringified as required by the API.
21
+ */
22
+ export declare function convertAttributeToUpdateActionShape(attribute: Attribute): {
23
+ name: string;
24
+ value?: string;
25
+ };
26
+ /**
27
+ * Maps base actions (setKey, setSku, publish, unpublish) for standalone variants.
28
+ * Analyzes the diff between old and new variant and generates appropriate actions.
29
+ *
30
+ * Accepts flat variant objects directly (not wrapped in a variants array).
31
+ */
32
+ export declare function actionsMapBase(diff: Delta, oldVariant: StandaloneVariant, newVariant: StandaloneVariant, config?: SyncActionConfig): Array<StandaloneVariantUpdateAction>;
33
+ /**
34
+ * Maps attribute actions for standalone variants.
35
+ * Generates a single setAttributes action when attributes have changed.
36
+ */
37
+ export declare function actionsMapAttributes(diff: Delta, _oldVariant: StandaloneVariant, newVariant: StandaloneVariant, config?: SyncActionConfig): Array<StandaloneVariantUpdateAction>;
38
+ /**
39
+ * Maps image actions for standalone variants.
40
+ * Generates a single setImages action when images have changed.
41
+ */
42
+ export declare function actionsMapImages(diff: Delta, _oldVariant: StandaloneVariant, newVariant: StandaloneVariant, config?: SyncActionConfig): Array<StandaloneVariantUpdateAction>;
43
+ /**
44
+ * Maps asset actions for standalone variants.
45
+ * Generates a single setAssets action when assets have changed.
46
+ */
47
+ export declare function actionsMapAssets(diff: Delta, _oldVariant: StandaloneVariant, newVariant: StandaloneVariant, config?: SyncActionConfig): Array<StandaloneVariantUpdateAction>;
@@ -0,0 +1,5 @@
1
+ import { StandaloneVariant, StandaloneVariantUpdateAction } from './standalone-variant-actions';
2
+ import { ActionGroup, SyncAction, SyncActionConfig } from '../utils/types';
3
+ export type { StandaloneVariant, StandaloneVariantUpdateAction };
4
+ export declare const actionGroups: Array<string>;
5
+ export default function createSyncStandaloneVariants(actionGroupList?: Array<ActionGroup>, syncActionConfig?: SyncActionConfig): SyncAction<StandaloneVariant, StandaloneVariantUpdateAction>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/sync-actions",
3
- "version": "8.1.0",
3
+ "version": "8.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },