@uniformdev/canvas 19.147.1-alpha.1 → 19.147.1-alpha.11

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
@@ -466,6 +466,19 @@ function createLimitPolicy({
466
466
  }
467
467
  var nullLimitPolicy = async (func) => await func();
468
468
 
469
+ // src/utils/rewriteFilters.ts
470
+ var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
471
+ function rewriteFilters(filters) {
472
+ return Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
473
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
474
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
475
+ return {
476
+ ...acc,
477
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
478
+ };
479
+ }, {});
480
+ }
481
+
469
482
  // src/CanvasClient.ts
470
483
  var CANVAS_URL = "/api/v1/canvas";
471
484
  var CanvasClient = class extends ApiClient {
@@ -482,12 +495,7 @@ var CanvasClient = class extends ApiClient {
482
495
  async getCompositionList(params = {}) {
483
496
  const { projectId } = this.options;
484
497
  const { resolveData, filters, ...originParams } = params;
485
- const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
486
- const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
487
- let rhs = typeof value === "object" ? Object.values(value)[0] : value;
488
- rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
489
- return { ...acc, [lhs]: rhs };
490
- }, {});
498
+ const rewrittenFilters = rewriteFilters(filters);
491
499
  if (!resolveData) {
492
500
  const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
493
501
  return this.apiClient(fetchUri);
@@ -651,12 +659,7 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
651
659
  getEntries(options) {
652
660
  const { projectId } = this.options;
653
661
  const { skipDataResolution, filters, ...params } = options;
654
- const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
655
- const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
656
- let rhs = typeof value === "object" ? Object.values(value)[0] : value;
657
- rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
658
- return { ...acc, [lhs]: rhs };
659
- }, {});
662
+ const rewrittenFilters = rewriteFilters(filters);
660
663
  if (skipDataResolution) {
661
664
  const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
662
665
  return this.apiClient(url);
@@ -1082,6 +1085,7 @@ function walkNodeTree(node, visitor, options) {
1082
1085
  } else {
1083
1086
  throw new Error("Unknown node type");
1084
1087
  }
1088
+ visitDescendants = false;
1085
1089
  },
1086
1090
  insertAfter: (nodes) => {
1087
1091
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1167,6 +1171,7 @@ function walkNodeTree(node, visitor, options) {
1167
1171
  } else {
1168
1172
  throw new Error("Unknown node type");
1169
1173
  }
1174
+ visitDescendants = false;
1170
1175
  },
1171
1176
  insertAfter: (nodes) => {
1172
1177
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -2152,6 +2157,7 @@ var createCanvasChannel = ({
2152
2157
  listenTo.forEach((item) => item.removeEventListener("message", messageEventListener));
2153
2158
  };
2154
2159
  return {
2160
+ broadcastTo,
2155
2161
  ready,
2156
2162
  destroy,
2157
2163
  triggerComponentAction,
@@ -2299,49 +2305,6 @@ var RelationshipClient = class extends ApiClient8 {
2299
2305
  const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
2300
2306
  return this.apiClient(url);
2301
2307
  };
2302
- this.clearProjectRelationships = async () => {
2303
- const { projectId } = this.options;
2304
- const url = this.createUrl(RELATIONSHIPS_URL);
2305
- return this.apiClient(url, {
2306
- method: "POST",
2307
- body: JSON.stringify({
2308
- action: "clear",
2309
- projectId
2310
- })
2311
- });
2312
- };
2313
- this.indexRelationships = async ({ state, id, type }) => {
2314
- const { projectId } = this.options;
2315
- const url = this.createUrl(RELATIONSHIPS_URL);
2316
- return this.apiClient(url, {
2317
- method: "POST",
2318
- body: JSON.stringify({
2319
- action: "index",
2320
- type,
2321
- projectId,
2322
- state,
2323
- id
2324
- })
2325
- });
2326
- };
2327
- this.getVersion = async () => {
2328
- const { projectId } = this.options;
2329
- const url = this.createUrl("/api/v1/usage-tracking", {
2330
- projectId
2331
- });
2332
- return this.apiClient(url).then((response) => response.version);
2333
- };
2334
- this.setVersion = async (version) => {
2335
- const { projectId } = this.options;
2336
- const url = this.createUrl("/api/v1/usage-tracking");
2337
- return this.apiClient(url, {
2338
- method: "POST",
2339
- body: JSON.stringify({
2340
- projectId,
2341
- version
2342
- })
2343
- });
2344
- };
2345
2308
  }
2346
2309
  };
2347
2310
 
@@ -2477,7 +2440,9 @@ function convertEntryToPutEntry(entry) {
2477
2440
  pattern: entry.pattern,
2478
2441
  state: entry.state,
2479
2442
  projectId: entry.projectId,
2480
- releaseId: entry.releaseId
2443
+ releaseId: entry.releaseId,
2444
+ workflowId: entry.workflowId,
2445
+ workflowStageId: entry.workflowStageId
2481
2446
  };
2482
2447
  }
2483
2448
 
@@ -2780,6 +2745,41 @@ function handleRichTextNodeBinding(object, options) {
2780
2745
 
2781
2746
  // src/index.ts
2782
2747
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
2748
+
2749
+ // src/WorkflowClient.ts
2750
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
2751
+ var workflowsUrl = "/api/v1/workflows";
2752
+ var WorkflowClient = class extends ApiClient12 {
2753
+ constructor(options) {
2754
+ super(options);
2755
+ }
2756
+ /** Fetches workflows for a project */
2757
+ async get(options) {
2758
+ const { projectId } = this.options;
2759
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2760
+ return await this.apiClient(fetchUri);
2761
+ }
2762
+ /** Updates or creates a workflow definition */
2763
+ async upsert(body) {
2764
+ const fetchUri = this.createUrl(workflowsUrl);
2765
+ await this.apiClient(fetchUri, {
2766
+ method: "PUT",
2767
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2768
+ expectNoContent: true
2769
+ });
2770
+ }
2771
+ /** Deletes a workflow definition */
2772
+ async remove(body) {
2773
+ const fetchUri = this.createUrl(workflowsUrl);
2774
+ await this.apiClient(fetchUri, {
2775
+ method: "DELETE",
2776
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2777
+ expectNoContent: true
2778
+ });
2779
+ }
2780
+ };
2781
+
2782
+ // src/index.ts
2783
2783
  var CanvasClientError = ApiClientError2;
2784
2784
  export {
2785
2785
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2844,6 +2844,7 @@ export {
2844
2844
  UncachedCategoryClient,
2845
2845
  UncachedContentClient,
2846
2846
  UniqueBatchEntries,
2847
+ WorkflowClient,
2847
2848
  bindVariables,
2848
2849
  bindVariablesToObject,
2849
2850
  compose,
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,
@@ -602,6 +603,19 @@ function createLimitPolicy({
602
603
  }
603
604
  var nullLimitPolicy = async (func) => await func();
604
605
 
606
+ // src/utils/rewriteFilters.ts
607
+ var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
608
+ function rewriteFilters(filters) {
609
+ return Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
610
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
611
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
612
+ return {
613
+ ...acc,
614
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
615
+ };
616
+ }, {});
617
+ }
618
+
605
619
  // src/CanvasClient.ts
606
620
  var CANVAS_URL = "/api/v1/canvas";
607
621
  var CanvasClient = class extends import_api2.ApiClient {
@@ -618,12 +632,7 @@ var CanvasClient = class extends import_api2.ApiClient {
618
632
  async getCompositionList(params = {}) {
619
633
  const { projectId } = this.options;
620
634
  const { resolveData, filters, ...originParams } = params;
621
- const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
622
- const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
623
- let rhs = typeof value === "object" ? Object.values(value)[0] : value;
624
- rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
625
- return { ...acc, [lhs]: rhs };
626
- }, {});
635
+ const rewrittenFilters = rewriteFilters(filters);
627
636
  if (!resolveData) {
628
637
  const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
629
638
  return this.apiClient(fetchUri);
@@ -787,12 +796,7 @@ var _ContentClient = class _ContentClient extends import_api4.ApiClient {
787
796
  getEntries(options) {
788
797
  const { projectId } = this.options;
789
798
  const { skipDataResolution, filters, ...params } = options;
790
- const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
791
- const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
792
- let rhs = typeof value === "object" ? Object.values(value)[0] : value;
793
- rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
794
- return { ...acc, [lhs]: rhs };
795
- }, {});
799
+ const rewrittenFilters = rewriteFilters(filters);
796
800
  if (skipDataResolution) {
797
801
  const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
798
802
  return this.apiClient(url);
@@ -1218,6 +1222,7 @@ function walkNodeTree(node, visitor, options) {
1218
1222
  } else {
1219
1223
  throw new Error("Unknown node type");
1220
1224
  }
1225
+ visitDescendants = false;
1221
1226
  },
1222
1227
  insertAfter: (nodes) => {
1223
1228
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1303,6 +1308,7 @@ function walkNodeTree(node, visitor, options) {
1303
1308
  } else {
1304
1309
  throw new Error("Unknown node type");
1305
1310
  }
1311
+ visitDescendants = false;
1306
1312
  },
1307
1313
  insertAfter: (nodes) => {
1308
1314
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -2288,6 +2294,7 @@ var createCanvasChannel = ({
2288
2294
  listenTo.forEach((item) => item.removeEventListener("message", messageEventListener));
2289
2295
  };
2290
2296
  return {
2297
+ broadcastTo,
2291
2298
  ready,
2292
2299
  destroy,
2293
2300
  triggerComponentAction,
@@ -2435,49 +2442,6 @@ var RelationshipClient = class extends import_api9.ApiClient {
2435
2442
  const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
2436
2443
  return this.apiClient(url);
2437
2444
  };
2438
- this.clearProjectRelationships = async () => {
2439
- const { projectId } = this.options;
2440
- const url = this.createUrl(RELATIONSHIPS_URL);
2441
- return this.apiClient(url, {
2442
- method: "POST",
2443
- body: JSON.stringify({
2444
- action: "clear",
2445
- projectId
2446
- })
2447
- });
2448
- };
2449
- this.indexRelationships = async ({ state, id, type }) => {
2450
- const { projectId } = this.options;
2451
- const url = this.createUrl(RELATIONSHIPS_URL);
2452
- return this.apiClient(url, {
2453
- method: "POST",
2454
- body: JSON.stringify({
2455
- action: "index",
2456
- type,
2457
- projectId,
2458
- state,
2459
- id
2460
- })
2461
- });
2462
- };
2463
- this.getVersion = async () => {
2464
- const { projectId } = this.options;
2465
- const url = this.createUrl("/api/v1/usage-tracking", {
2466
- projectId
2467
- });
2468
- return this.apiClient(url).then((response) => response.version);
2469
- };
2470
- this.setVersion = async (version) => {
2471
- const { projectId } = this.options;
2472
- const url = this.createUrl("/api/v1/usage-tracking");
2473
- return this.apiClient(url, {
2474
- method: "POST",
2475
- body: JSON.stringify({
2476
- projectId,
2477
- version
2478
- })
2479
- });
2480
- };
2481
2445
  }
2482
2446
  };
2483
2447
 
@@ -2613,7 +2577,9 @@ function convertEntryToPutEntry(entry) {
2613
2577
  pattern: entry.pattern,
2614
2578
  state: entry.state,
2615
2579
  projectId: entry.projectId,
2616
- releaseId: entry.releaseId
2580
+ releaseId: entry.releaseId,
2581
+ workflowId: entry.workflowId,
2582
+ workflowStageId: entry.workflowStageId
2617
2583
  };
2618
2584
  }
2619
2585
 
@@ -2915,8 +2881,43 @@ function handleRichTextNodeBinding(object, options) {
2915
2881
  }
2916
2882
 
2917
2883
  // src/index.ts
2884
+ var import_api14 = require("@uniformdev/context/api");
2885
+
2886
+ // src/WorkflowClient.ts
2918
2887
  var import_api13 = require("@uniformdev/context/api");
2919
- var CanvasClientError = import_api13.ApiClientError;
2888
+ var workflowsUrl = "/api/v1/workflows";
2889
+ var WorkflowClient = class extends import_api13.ApiClient {
2890
+ constructor(options) {
2891
+ super(options);
2892
+ }
2893
+ /** Fetches workflows for a project */
2894
+ async get(options) {
2895
+ const { projectId } = this.options;
2896
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2897
+ return await this.apiClient(fetchUri);
2898
+ }
2899
+ /** Updates or creates a workflow definition */
2900
+ async upsert(body) {
2901
+ const fetchUri = this.createUrl(workflowsUrl);
2902
+ await this.apiClient(fetchUri, {
2903
+ method: "PUT",
2904
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2905
+ expectNoContent: true
2906
+ });
2907
+ }
2908
+ /** Deletes a workflow definition */
2909
+ async remove(body) {
2910
+ const fetchUri = this.createUrl(workflowsUrl);
2911
+ await this.apiClient(fetchUri, {
2912
+ method: "DELETE",
2913
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2914
+ expectNoContent: true
2915
+ });
2916
+ }
2917
+ };
2918
+
2919
+ // src/index.ts
2920
+ var CanvasClientError = import_api14.ApiClientError;
2920
2921
  // Annotate the CommonJS export names for ESM import in node:
2921
2922
  0 && (module.exports = {
2922
2923
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2981,6 +2982,7 @@ var CanvasClientError = import_api13.ApiClientError;
2981
2982
  UncachedCategoryClient,
2982
2983
  UncachedContentClient,
2983
2984
  UniqueBatchEntries,
2985
+ WorkflowClient,
2984
2986
  bindVariables,
2985
2987
  bindVariablesToObject,
2986
2988
  compose,
package/dist/index.mjs CHANGED
@@ -466,6 +466,19 @@ function createLimitPolicy({
466
466
  }
467
467
  var nullLimitPolicy = async (func) => await func();
468
468
 
469
+ // src/utils/rewriteFilters.ts
470
+ var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
471
+ function rewriteFilters(filters) {
472
+ return Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
473
+ const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
474
+ const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
475
+ return {
476
+ ...acc,
477
+ [lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
478
+ };
479
+ }, {});
480
+ }
481
+
469
482
  // src/CanvasClient.ts
470
483
  var CANVAS_URL = "/api/v1/canvas";
471
484
  var CanvasClient = class extends ApiClient {
@@ -482,12 +495,7 @@ var CanvasClient = class extends ApiClient {
482
495
  async getCompositionList(params = {}) {
483
496
  const { projectId } = this.options;
484
497
  const { resolveData, filters, ...originParams } = params;
485
- const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
486
- const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
487
- let rhs = typeof value === "object" ? Object.values(value)[0] : value;
488
- rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
489
- return { ...acc, [lhs]: rhs };
490
- }, {});
498
+ const rewrittenFilters = rewriteFilters(filters);
491
499
  if (!resolveData) {
492
500
  const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
493
501
  return this.apiClient(fetchUri);
@@ -651,12 +659,7 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
651
659
  getEntries(options) {
652
660
  const { projectId } = this.options;
653
661
  const { skipDataResolution, filters, ...params } = options;
654
- const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
655
- const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
656
- let rhs = typeof value === "object" ? Object.values(value)[0] : value;
657
- rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
658
- return { ...acc, [lhs]: rhs };
659
- }, {});
662
+ const rewrittenFilters = rewriteFilters(filters);
660
663
  if (skipDataResolution) {
661
664
  const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
662
665
  return this.apiClient(url);
@@ -1082,6 +1085,7 @@ function walkNodeTree(node, visitor, options) {
1082
1085
  } else {
1083
1086
  throw new Error("Unknown node type");
1084
1087
  }
1088
+ visitDescendants = false;
1085
1089
  },
1086
1090
  insertAfter: (nodes) => {
1087
1091
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1167,6 +1171,7 @@ function walkNodeTree(node, visitor, options) {
1167
1171
  } else {
1168
1172
  throw new Error("Unknown node type");
1169
1173
  }
1174
+ visitDescendants = false;
1170
1175
  },
1171
1176
  insertAfter: (nodes) => {
1172
1177
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -2152,6 +2157,7 @@ var createCanvasChannel = ({
2152
2157
  listenTo.forEach((item) => item.removeEventListener("message", messageEventListener));
2153
2158
  };
2154
2159
  return {
2160
+ broadcastTo,
2155
2161
  ready,
2156
2162
  destroy,
2157
2163
  triggerComponentAction,
@@ -2299,49 +2305,6 @@ var RelationshipClient = class extends ApiClient8 {
2299
2305
  const url = this.createUrl(RELATIONSHIPS_URL, { ...options, projectId });
2300
2306
  return this.apiClient(url);
2301
2307
  };
2302
- this.clearProjectRelationships = async () => {
2303
- const { projectId } = this.options;
2304
- const url = this.createUrl(RELATIONSHIPS_URL);
2305
- return this.apiClient(url, {
2306
- method: "POST",
2307
- body: JSON.stringify({
2308
- action: "clear",
2309
- projectId
2310
- })
2311
- });
2312
- };
2313
- this.indexRelationships = async ({ state, id, type }) => {
2314
- const { projectId } = this.options;
2315
- const url = this.createUrl(RELATIONSHIPS_URL);
2316
- return this.apiClient(url, {
2317
- method: "POST",
2318
- body: JSON.stringify({
2319
- action: "index",
2320
- type,
2321
- projectId,
2322
- state,
2323
- id
2324
- })
2325
- });
2326
- };
2327
- this.getVersion = async () => {
2328
- const { projectId } = this.options;
2329
- const url = this.createUrl("/api/v1/usage-tracking", {
2330
- projectId
2331
- });
2332
- return this.apiClient(url).then((response) => response.version);
2333
- };
2334
- this.setVersion = async (version) => {
2335
- const { projectId } = this.options;
2336
- const url = this.createUrl("/api/v1/usage-tracking");
2337
- return this.apiClient(url, {
2338
- method: "POST",
2339
- body: JSON.stringify({
2340
- projectId,
2341
- version
2342
- })
2343
- });
2344
- };
2345
2308
  }
2346
2309
  };
2347
2310
 
@@ -2477,7 +2440,9 @@ function convertEntryToPutEntry(entry) {
2477
2440
  pattern: entry.pattern,
2478
2441
  state: entry.state,
2479
2442
  projectId: entry.projectId,
2480
- releaseId: entry.releaseId
2443
+ releaseId: entry.releaseId,
2444
+ workflowId: entry.workflowId,
2445
+ workflowStageId: entry.workflowStageId
2481
2446
  };
2482
2447
  }
2483
2448
 
@@ -2780,6 +2745,41 @@ function handleRichTextNodeBinding(object, options) {
2780
2745
 
2781
2746
  // src/index.ts
2782
2747
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
2748
+
2749
+ // src/WorkflowClient.ts
2750
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
2751
+ var workflowsUrl = "/api/v1/workflows";
2752
+ var WorkflowClient = class extends ApiClient12 {
2753
+ constructor(options) {
2754
+ super(options);
2755
+ }
2756
+ /** Fetches workflows for a project */
2757
+ async get(options) {
2758
+ const { projectId } = this.options;
2759
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2760
+ return await this.apiClient(fetchUri);
2761
+ }
2762
+ /** Updates or creates a workflow definition */
2763
+ async upsert(body) {
2764
+ const fetchUri = this.createUrl(workflowsUrl);
2765
+ await this.apiClient(fetchUri, {
2766
+ method: "PUT",
2767
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2768
+ expectNoContent: true
2769
+ });
2770
+ }
2771
+ /** Deletes a workflow definition */
2772
+ async remove(body) {
2773
+ const fetchUri = this.createUrl(workflowsUrl);
2774
+ await this.apiClient(fetchUri, {
2775
+ method: "DELETE",
2776
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2777
+ expectNoContent: true
2778
+ });
2779
+ }
2780
+ };
2781
+
2782
+ // src/index.ts
2783
2783
  var CanvasClientError = ApiClientError2;
2784
2784
  export {
2785
2785
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2844,6 +2844,7 @@ export {
2844
2844
  UncachedCategoryClient,
2845
2845
  UncachedContentClient,
2846
2846
  UniqueBatchEntries,
2847
+ WorkflowClient,
2847
2848
  bindVariables,
2848
2849
  bindVariablesToObject,
2849
2850
  compose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.147.1-alpha.1+3b71376893",
3
+ "version": "19.147.1-alpha.11+af2cff242e",
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.147.1-alpha.1+3b71376893",
42
- "@uniformdev/context": "19.147.1-alpha.1+3b71376893",
41
+ "@uniformdev/assets": "19.147.1-alpha.11+af2cff242e",
42
+ "@uniformdev/context": "19.147.1-alpha.11+af2cff242e",
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": "3b71376893147a07f47c6118425304f96d099067"
51
+ "gitHead": "af2cff242e55fa8548dc06377344264ddd3c271e"
52
52
  }