@uniformdev/canvas 19.134.3-alpha.28 → 19.135.1-alpha.9

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.
package/dist/index.esm.js CHANGED
@@ -992,6 +992,21 @@ function getPropertiesValue(entity) {
992
992
  function getPropertyValue(parameter) {
993
993
  return parameter ? parameter.value : parameter;
994
994
  }
995
+ function getLocalizedPropertyValues(parameter) {
996
+ if (!parameter) {
997
+ return parameter;
998
+ }
999
+ const localizedValues = /* @__PURE__ */ new Map();
1000
+ if (typeof parameter.value !== "undefined") {
1001
+ localizedValues.set(void 0, parameter.value);
1002
+ }
1003
+ if (parameter.locales !== void 0) {
1004
+ for (const [locale, localeValue] of Object.entries(parameter.locales)) {
1005
+ localizedValues.set(locale, localeValue);
1006
+ }
1007
+ }
1008
+ return localizedValues;
1009
+ }
995
1010
  function flattenValues(data, options = {}) {
996
1011
  if (!data) {
997
1012
  return data;
@@ -1067,6 +1082,7 @@ function walkNodeTree(node, visitor, options) {
1067
1082
  } else {
1068
1083
  throw new Error("Unknown node type");
1069
1084
  }
1085
+ visitDescendants = false;
1070
1086
  },
1071
1087
  insertAfter: (nodes) => {
1072
1088
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1152,6 +1168,7 @@ function walkNodeTree(node, visitor, options) {
1152
1168
  } else {
1153
1169
  throw new Error("Unknown node type");
1154
1170
  }
1171
+ visitDescendants = false;
1155
1172
  },
1156
1173
  insertAfter: (nodes) => {
1157
1174
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -1939,6 +1956,12 @@ var createCanvasChannel = ({
1939
1956
  const broadcastToItems = [...broadcastTo];
1940
1957
  const postMessage = (message) => {
1941
1958
  broadcastToItems.forEach((item) => item == null ? void 0 : item.postMessage(JSON.stringify(message), "*"));
1959
+ for (const handlerId in handlers) {
1960
+ const handler = handlers[handlerId];
1961
+ if (handler.types.includes(message.type)) {
1962
+ handler.handler(message, new MessageEvent(message.type));
1963
+ }
1964
+ }
1942
1965
  };
1943
1966
  const selectComponent = (id) => {
1944
1967
  const message = {
@@ -1979,15 +2002,17 @@ var createCanvasChannel = ({
1979
2002
  hash: generateHash({
1980
2003
  composition,
1981
2004
  secret
1982
- })
2005
+ }),
2006
+ eventTimestamp: Date.now()
1983
2007
  };
1984
2008
  postMessage(message);
1985
2009
  };
1986
- const updateCompositionInternal = (composition, hash) => {
2010
+ const updateCompositionInternal = (composition, hash, eventTimestamp) => {
1987
2011
  const message = {
1988
2012
  type: "update-composition-internal",
1989
2013
  composition,
1990
- hash
2014
+ hash,
2015
+ eventTimestamp: eventTimestamp != null ? eventTimestamp : Date.now()
1991
2016
  };
1992
2017
  postMessage(message);
1993
2018
  };
@@ -2454,7 +2479,9 @@ function convertEntryToPutEntry(entry) {
2454
2479
  pattern: entry.pattern,
2455
2480
  state: entry.state,
2456
2481
  projectId: entry.projectId,
2457
- releaseId: entry.releaseId
2482
+ releaseId: entry.releaseId,
2483
+ workflowId: entry.workflowId,
2484
+ workflowStageId: entry.workflowStageId
2458
2485
  };
2459
2486
  }
2460
2487
 
@@ -2757,6 +2784,41 @@ function handleRichTextNodeBinding(object, options) {
2757
2784
 
2758
2785
  // src/index.ts
2759
2786
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
2787
+
2788
+ // src/WorkflowClient.ts
2789
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
2790
+ var workflowsUrl = "/api/v1/workflows";
2791
+ var WorkflowClient = class extends ApiClient12 {
2792
+ constructor(options) {
2793
+ super(options);
2794
+ }
2795
+ /** Fetches workflows for a project */
2796
+ async get(options) {
2797
+ const { projectId } = this.options;
2798
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2799
+ return await this.apiClient(fetchUri);
2800
+ }
2801
+ /** Updates or creates a workflow definition */
2802
+ async upsert(body) {
2803
+ const fetchUri = this.createUrl(workflowsUrl);
2804
+ await this.apiClient(fetchUri, {
2805
+ method: "PUT",
2806
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2807
+ expectNoContent: true
2808
+ });
2809
+ }
2810
+ /** Deletes a workflow definition */
2811
+ async remove(body) {
2812
+ const fetchUri = this.createUrl(workflowsUrl);
2813
+ await this.apiClient(fetchUri, {
2814
+ method: "DELETE",
2815
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2816
+ expectNoContent: true
2817
+ });
2818
+ }
2819
+ };
2820
+
2821
+ // src/index.ts
2760
2822
  var CanvasClientError = ApiClientError2;
2761
2823
  export {
2762
2824
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2821,6 +2883,7 @@ export {
2821
2883
  UncachedCategoryClient,
2822
2884
  UncachedContentClient,
2823
2885
  UniqueBatchEntries,
2886
+ WorkflowClient,
2824
2887
  bindVariables,
2825
2888
  bindVariablesToObject,
2826
2889
  compose,
@@ -2841,6 +2904,7 @@ export {
2841
2904
  getChannelName,
2842
2905
  getComponentJsonPointer,
2843
2906
  getComponentPath,
2907
+ getLocalizedPropertyValues,
2844
2908
  getNounForLocation,
2845
2909
  getNounForNode,
2846
2910
  getParameterAttributes,
package/dist/index.js CHANGED
@@ -286,7 +286,7 @@ __export(src_exports, {
286
286
  ATTRIBUTE_PARAMETER_TYPE: () => ATTRIBUTE_PARAMETER_TYPE,
287
287
  ATTRIBUTE_PARAMETER_VALUE: () => ATTRIBUTE_PARAMETER_VALUE,
288
288
  ATTRIBUTE_PLACEHOLDER: () => ATTRIBUTE_PLACEHOLDER,
289
- ApiClientError: () => import_api13.ApiClientError,
289
+ ApiClientError: () => import_api14.ApiClientError,
290
290
  BatchEntry: () => BatchEntry,
291
291
  CANVAS_BLOCK_PARAM_TYPE: () => CANVAS_BLOCK_PARAM_TYPE,
292
292
  CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
@@ -339,6 +339,7 @@ __export(src_exports, {
339
339
  UncachedCategoryClient: () => UncachedCategoryClient,
340
340
  UncachedContentClient: () => UncachedContentClient,
341
341
  UniqueBatchEntries: () => UniqueBatchEntries,
342
+ WorkflowClient: () => WorkflowClient,
342
343
  bindVariables: () => bindVariables,
343
344
  bindVariablesToObject: () => bindVariablesToObject,
344
345
  compose: () => compose,
@@ -359,6 +360,7 @@ __export(src_exports, {
359
360
  getChannelName: () => getChannelName,
360
361
  getComponentJsonPointer: () => getComponentJsonPointer,
361
362
  getComponentPath: () => getComponentPath,
363
+ getLocalizedPropertyValues: () => getLocalizedPropertyValues,
362
364
  getNounForLocation: () => getNounForLocation,
363
365
  getNounForNode: () => getNounForNode,
364
366
  getParameterAttributes: () => getParameterAttributes,
@@ -1127,6 +1129,21 @@ function getPropertiesValue(entity) {
1127
1129
  function getPropertyValue(parameter) {
1128
1130
  return parameter ? parameter.value : parameter;
1129
1131
  }
1132
+ function getLocalizedPropertyValues(parameter) {
1133
+ if (!parameter) {
1134
+ return parameter;
1135
+ }
1136
+ const localizedValues = /* @__PURE__ */ new Map();
1137
+ if (typeof parameter.value !== "undefined") {
1138
+ localizedValues.set(void 0, parameter.value);
1139
+ }
1140
+ if (parameter.locales !== void 0) {
1141
+ for (const [locale, localeValue] of Object.entries(parameter.locales)) {
1142
+ localizedValues.set(locale, localeValue);
1143
+ }
1144
+ }
1145
+ return localizedValues;
1146
+ }
1130
1147
  function flattenValues(data, options = {}) {
1131
1148
  if (!data) {
1132
1149
  return data;
@@ -1202,6 +1219,7 @@ function walkNodeTree(node, visitor, options) {
1202
1219
  } else {
1203
1220
  throw new Error("Unknown node type");
1204
1221
  }
1222
+ visitDescendants = false;
1205
1223
  },
1206
1224
  insertAfter: (nodes) => {
1207
1225
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1287,6 +1305,7 @@ function walkNodeTree(node, visitor, options) {
1287
1305
  } else {
1288
1306
  throw new Error("Unknown node type");
1289
1307
  }
1308
+ visitDescendants = false;
1290
1309
  },
1291
1310
  insertAfter: (nodes) => {
1292
1311
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -2074,6 +2093,12 @@ var createCanvasChannel = ({
2074
2093
  const broadcastToItems = [...broadcastTo];
2075
2094
  const postMessage = (message) => {
2076
2095
  broadcastToItems.forEach((item) => item == null ? void 0 : item.postMessage(JSON.stringify(message), "*"));
2096
+ for (const handlerId in handlers) {
2097
+ const handler = handlers[handlerId];
2098
+ if (handler.types.includes(message.type)) {
2099
+ handler.handler(message, new MessageEvent(message.type));
2100
+ }
2101
+ }
2077
2102
  };
2078
2103
  const selectComponent = (id) => {
2079
2104
  const message = {
@@ -2114,15 +2139,17 @@ var createCanvasChannel = ({
2114
2139
  hash: generateHash({
2115
2140
  composition,
2116
2141
  secret
2117
- })
2142
+ }),
2143
+ eventTimestamp: Date.now()
2118
2144
  };
2119
2145
  postMessage(message);
2120
2146
  };
2121
- const updateCompositionInternal = (composition, hash) => {
2147
+ const updateCompositionInternal = (composition, hash, eventTimestamp) => {
2122
2148
  const message = {
2123
2149
  type: "update-composition-internal",
2124
2150
  composition,
2125
- hash
2151
+ hash,
2152
+ eventTimestamp: eventTimestamp != null ? eventTimestamp : Date.now()
2126
2153
  };
2127
2154
  postMessage(message);
2128
2155
  };
@@ -2589,7 +2616,9 @@ function convertEntryToPutEntry(entry) {
2589
2616
  pattern: entry.pattern,
2590
2617
  state: entry.state,
2591
2618
  projectId: entry.projectId,
2592
- releaseId: entry.releaseId
2619
+ releaseId: entry.releaseId,
2620
+ workflowId: entry.workflowId,
2621
+ workflowStageId: entry.workflowStageId
2593
2622
  };
2594
2623
  }
2595
2624
 
@@ -2891,8 +2920,43 @@ function handleRichTextNodeBinding(object, options) {
2891
2920
  }
2892
2921
 
2893
2922
  // src/index.ts
2923
+ var import_api14 = require("@uniformdev/context/api");
2924
+
2925
+ // src/WorkflowClient.ts
2894
2926
  var import_api13 = require("@uniformdev/context/api");
2895
- var CanvasClientError = import_api13.ApiClientError;
2927
+ var workflowsUrl = "/api/v1/workflows";
2928
+ var WorkflowClient = class extends import_api13.ApiClient {
2929
+ constructor(options) {
2930
+ super(options);
2931
+ }
2932
+ /** Fetches workflows for a project */
2933
+ async get(options) {
2934
+ const { projectId } = this.options;
2935
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2936
+ return await this.apiClient(fetchUri);
2937
+ }
2938
+ /** Updates or creates a workflow definition */
2939
+ async upsert(body) {
2940
+ const fetchUri = this.createUrl(workflowsUrl);
2941
+ await this.apiClient(fetchUri, {
2942
+ method: "PUT",
2943
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2944
+ expectNoContent: true
2945
+ });
2946
+ }
2947
+ /** Deletes a workflow definition */
2948
+ async remove(body) {
2949
+ const fetchUri = this.createUrl(workflowsUrl);
2950
+ await this.apiClient(fetchUri, {
2951
+ method: "DELETE",
2952
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2953
+ expectNoContent: true
2954
+ });
2955
+ }
2956
+ };
2957
+
2958
+ // src/index.ts
2959
+ var CanvasClientError = import_api14.ApiClientError;
2896
2960
  // Annotate the CommonJS export names for ESM import in node:
2897
2961
  0 && (module.exports = {
2898
2962
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2957,6 +3021,7 @@ var CanvasClientError = import_api13.ApiClientError;
2957
3021
  UncachedCategoryClient,
2958
3022
  UncachedContentClient,
2959
3023
  UniqueBatchEntries,
3024
+ WorkflowClient,
2960
3025
  bindVariables,
2961
3026
  bindVariablesToObject,
2962
3027
  compose,
@@ -2977,6 +3042,7 @@ var CanvasClientError = import_api13.ApiClientError;
2977
3042
  getChannelName,
2978
3043
  getComponentJsonPointer,
2979
3044
  getComponentPath,
3045
+ getLocalizedPropertyValues,
2980
3046
  getNounForLocation,
2981
3047
  getNounForNode,
2982
3048
  getParameterAttributes,
package/dist/index.mjs CHANGED
@@ -992,6 +992,21 @@ function getPropertiesValue(entity) {
992
992
  function getPropertyValue(parameter) {
993
993
  return parameter ? parameter.value : parameter;
994
994
  }
995
+ function getLocalizedPropertyValues(parameter) {
996
+ if (!parameter) {
997
+ return parameter;
998
+ }
999
+ const localizedValues = /* @__PURE__ */ new Map();
1000
+ if (typeof parameter.value !== "undefined") {
1001
+ localizedValues.set(void 0, parameter.value);
1002
+ }
1003
+ if (parameter.locales !== void 0) {
1004
+ for (const [locale, localeValue] of Object.entries(parameter.locales)) {
1005
+ localizedValues.set(locale, localeValue);
1006
+ }
1007
+ }
1008
+ return localizedValues;
1009
+ }
995
1010
  function flattenValues(data, options = {}) {
996
1011
  if (!data) {
997
1012
  return data;
@@ -1067,6 +1082,7 @@ function walkNodeTree(node, visitor, options) {
1067
1082
  } else {
1068
1083
  throw new Error("Unknown node type");
1069
1084
  }
1085
+ visitDescendants = false;
1070
1086
  },
1071
1087
  insertAfter: (nodes) => {
1072
1088
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1152,6 +1168,7 @@ function walkNodeTree(node, visitor, options) {
1152
1168
  } else {
1153
1169
  throw new Error("Unknown node type");
1154
1170
  }
1171
+ visitDescendants = false;
1155
1172
  },
1156
1173
  insertAfter: (nodes) => {
1157
1174
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -1939,6 +1956,12 @@ var createCanvasChannel = ({
1939
1956
  const broadcastToItems = [...broadcastTo];
1940
1957
  const postMessage = (message) => {
1941
1958
  broadcastToItems.forEach((item) => item == null ? void 0 : item.postMessage(JSON.stringify(message), "*"));
1959
+ for (const handlerId in handlers) {
1960
+ const handler = handlers[handlerId];
1961
+ if (handler.types.includes(message.type)) {
1962
+ handler.handler(message, new MessageEvent(message.type));
1963
+ }
1964
+ }
1942
1965
  };
1943
1966
  const selectComponent = (id) => {
1944
1967
  const message = {
@@ -1979,15 +2002,17 @@ var createCanvasChannel = ({
1979
2002
  hash: generateHash({
1980
2003
  composition,
1981
2004
  secret
1982
- })
2005
+ }),
2006
+ eventTimestamp: Date.now()
1983
2007
  };
1984
2008
  postMessage(message);
1985
2009
  };
1986
- const updateCompositionInternal = (composition, hash) => {
2010
+ const updateCompositionInternal = (composition, hash, eventTimestamp) => {
1987
2011
  const message = {
1988
2012
  type: "update-composition-internal",
1989
2013
  composition,
1990
- hash
2014
+ hash,
2015
+ eventTimestamp: eventTimestamp != null ? eventTimestamp : Date.now()
1991
2016
  };
1992
2017
  postMessage(message);
1993
2018
  };
@@ -2454,7 +2479,9 @@ function convertEntryToPutEntry(entry) {
2454
2479
  pattern: entry.pattern,
2455
2480
  state: entry.state,
2456
2481
  projectId: entry.projectId,
2457
- releaseId: entry.releaseId
2482
+ releaseId: entry.releaseId,
2483
+ workflowId: entry.workflowId,
2484
+ workflowStageId: entry.workflowStageId
2458
2485
  };
2459
2486
  }
2460
2487
 
@@ -2757,6 +2784,41 @@ function handleRichTextNodeBinding(object, options) {
2757
2784
 
2758
2785
  // src/index.ts
2759
2786
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
2787
+
2788
+ // src/WorkflowClient.ts
2789
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
2790
+ var workflowsUrl = "/api/v1/workflows";
2791
+ var WorkflowClient = class extends ApiClient12 {
2792
+ constructor(options) {
2793
+ super(options);
2794
+ }
2795
+ /** Fetches workflows for a project */
2796
+ async get(options) {
2797
+ const { projectId } = this.options;
2798
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2799
+ return await this.apiClient(fetchUri);
2800
+ }
2801
+ /** Updates or creates a workflow definition */
2802
+ async upsert(body) {
2803
+ const fetchUri = this.createUrl(workflowsUrl);
2804
+ await this.apiClient(fetchUri, {
2805
+ method: "PUT",
2806
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2807
+ expectNoContent: true
2808
+ });
2809
+ }
2810
+ /** Deletes a workflow definition */
2811
+ async remove(body) {
2812
+ const fetchUri = this.createUrl(workflowsUrl);
2813
+ await this.apiClient(fetchUri, {
2814
+ method: "DELETE",
2815
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2816
+ expectNoContent: true
2817
+ });
2818
+ }
2819
+ };
2820
+
2821
+ // src/index.ts
2760
2822
  var CanvasClientError = ApiClientError2;
2761
2823
  export {
2762
2824
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2821,6 +2883,7 @@ export {
2821
2883
  UncachedCategoryClient,
2822
2884
  UncachedContentClient,
2823
2885
  UniqueBatchEntries,
2886
+ WorkflowClient,
2824
2887
  bindVariables,
2825
2888
  bindVariablesToObject,
2826
2889
  compose,
@@ -2841,6 +2904,7 @@ export {
2841
2904
  getChannelName,
2842
2905
  getComponentJsonPointer,
2843
2906
  getComponentPath,
2907
+ getLocalizedPropertyValues,
2844
2908
  getNounForLocation,
2845
2909
  getNounForNode,
2846
2910
  getParameterAttributes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.134.3-alpha.28+506233b832",
3
+ "version": "19.135.1-alpha.9+6715fce92a",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -38,8 +38,8 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/assets": "19.134.3-alpha.28+506233b832",
42
- "@uniformdev/context": "19.134.3-alpha.28+506233b832",
41
+ "@uniformdev/assets": "19.135.1-alpha.9+6715fce92a",
42
+ "@uniformdev/context": "19.135.1-alpha.9+6715fce92a",
43
43
  "immer": "10.0.4"
44
44
  },
45
45
  "files": [
@@ -48,5 +48,5 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "506233b8324cbb3d7d6a0ef97b8d5e01b36bfb08"
51
+ "gitHead": "6715fce92a09242316f5a218cc3d94b39e58cc05"
52
52
  }