@uniformdev/canvas 19.79.1-alpha.13 → 19.79.1-alpha.25

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
@@ -481,15 +481,22 @@ var CanvasClient = class extends ApiClient {
481
481
  /** Fetches lists of Canvas compositions, optionally by type */
482
482
  async getCompositionList(params = {}) {
483
483
  const { projectId } = this.options;
484
- const { resolveData, ...originParams } = params;
484
+ 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
+ }, {});
485
491
  if (!resolveData) {
486
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
492
+ const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
487
493
  return this.apiClient(fetchUri);
488
494
  }
489
495
  const edgeParams = {
490
496
  ...originParams,
491
497
  projectId,
492
- ...params.diagnostics ? { diagnostics: "true" } : {}
498
+ ...params.diagnostics ? { diagnostics: "true" } : {},
499
+ ...rewrittenFilters
493
500
  };
494
501
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
495
502
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -643,12 +650,22 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
643
650
  }
644
651
  getEntries(options) {
645
652
  const { projectId } = this.options;
646
- const { skipDataResolution, ...params } = options;
653
+ 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
+ }, {});
647
660
  if (skipDataResolution) {
648
- const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, projectId });
661
+ const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
649
662
  return this.apiClient(url);
650
663
  }
651
- const edgeUrl = this.createUrl(__privateGet(_ContentClient, _entriesUrl), this.getEdgeOptions(params), this.edgeApiHost);
664
+ const edgeUrl = this.createUrl(
665
+ __privateGet(_ContentClient, _entriesUrl),
666
+ { ...this.getEdgeOptions(params), ...rewrittenFilters },
667
+ this.edgeApiHost
668
+ );
652
669
  return this.apiClient(
653
670
  edgeUrl,
654
671
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
@@ -915,12 +932,14 @@ function getComponentPath(ancestorsAndSelf) {
915
932
  var CANVAS_PERSONALIZE_TYPE = "$personalization";
916
933
  var CANVAS_TEST_TYPE = "$test";
917
934
  var CANVAS_LOCALIZATION_TYPE = "$localization";
935
+ var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
918
936
  var CANVAS_INTENT_TAG_PARAM = "intentTag";
919
937
  var CANVAS_LOCALE_TAG_PARAM = "locale";
920
938
  var CANVAS_BLOCK_PARAM_TYPE = "$block";
921
939
  var CANVAS_PERSONALIZE_SLOT = "pz";
922
940
  var CANVAS_TEST_SLOT = "test";
923
941
  var CANVAS_LOCALIZATION_SLOT = "localized";
942
+ var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
924
943
  var CANVAS_DRAFT_STATE = 0;
925
944
  var CANVAS_PUBLISHED_STATE = 64;
926
945
  var CANVAS_EDITOR_STATE = 63;
@@ -1905,6 +1924,12 @@ var isOpenParameterEditorMessage = (message) => {
1905
1924
  var isUpdateComponentReferencesMessage = (message) => {
1906
1925
  return message.type === "update-component-references";
1907
1926
  };
1927
+ var isRequestComponentSuggestionMessage = (message) => {
1928
+ return message.type === "request-component-suggestion";
1929
+ };
1930
+ var isSuggestComponentMessage = (message) => {
1931
+ return message.type === "suggest-component";
1932
+ };
1908
1933
  var createCanvasChannel = ({
1909
1934
  listenTo,
1910
1935
  broadcastTo
@@ -2056,6 +2081,20 @@ var createCanvasChannel = ({
2056
2081
  };
2057
2082
  postMessage(message);
2058
2083
  };
2084
+ const requestComponentSuggestion = (options) => {
2085
+ const message = {
2086
+ ...options,
2087
+ type: "request-component-suggestion"
2088
+ };
2089
+ postMessage(message);
2090
+ };
2091
+ const suggestComponent = (options) => {
2092
+ const message = {
2093
+ ...options,
2094
+ type: "suggest-component"
2095
+ };
2096
+ postMessage(message);
2097
+ };
2059
2098
  const updateFeatureFlags = (options) => {
2060
2099
  const message = {
2061
2100
  ...options,
@@ -2109,7 +2148,9 @@ var createCanvasChannel = ({
2109
2148
  openParameterEditor,
2110
2149
  reportRenderedCompositions,
2111
2150
  editorStateUpdated,
2112
- updateComponentReferences
2151
+ updateComponentReferences,
2152
+ requestComponentSuggestion,
2153
+ suggestComponent
2113
2154
  };
2114
2155
  };
2115
2156
 
@@ -2281,10 +2322,76 @@ var RelationshipClient = class extends ApiClient8 {
2281
2322
  }
2282
2323
  };
2283
2324
 
2284
- // src/RouteClient.ts
2325
+ // src/ReleaseClient.ts
2285
2326
  import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
2327
+ var releasesUrl = "/api/v1/releases";
2328
+ var ReleaseClient = class extends ApiClient9 {
2329
+ constructor(options) {
2330
+ super(options);
2331
+ }
2332
+ /** Fetches all releases for a project */
2333
+ async get(options) {
2334
+ const { projectId } = this.options;
2335
+ const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
2336
+ return await this.apiClient(fetchUri);
2337
+ }
2338
+ /** Updates or creates (based on id) a release */
2339
+ async upsert(body) {
2340
+ const fetchUri = this.createUrl(releasesUrl);
2341
+ await this.apiClient(fetchUri, {
2342
+ method: "PUT",
2343
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2344
+ expectNoContent: true
2345
+ });
2346
+ }
2347
+ /** Deletes a release */
2348
+ async remove(body) {
2349
+ const fetchUri = this.createUrl(releasesUrl);
2350
+ await this.apiClient(fetchUri, {
2351
+ method: "DELETE",
2352
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2353
+ expectNoContent: true
2354
+ });
2355
+ }
2356
+ /** Readies or unreadies a release for merging */
2357
+ async ready(body) {
2358
+ const fetchUri = this.createUrl(releasesUrl);
2359
+ await this.apiClient(fetchUri, {
2360
+ method: "PATCH",
2361
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2362
+ expectNoContent: true
2363
+ });
2364
+ }
2365
+ };
2366
+
2367
+ // src/ReleaseContentsClient.ts
2368
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
2369
+ var releaseContentsUrl = "/api/v1/release-contents";
2370
+ var ReleaseContentsClient = class extends ApiClient10 {
2371
+ constructor(options) {
2372
+ super(options);
2373
+ }
2374
+ /** Fetches all entities added to a release */
2375
+ async get(options) {
2376
+ const { projectId } = this.options;
2377
+ const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
2378
+ return await this.apiClient(fetchUri);
2379
+ }
2380
+ /** Removes a release content from a release */
2381
+ async remove(body) {
2382
+ const fetchUri = this.createUrl(releaseContentsUrl);
2383
+ await this.apiClient(fetchUri, {
2384
+ method: "DELETE",
2385
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2386
+ expectNoContent: true
2387
+ });
2388
+ }
2389
+ };
2390
+
2391
+ // src/RouteClient.ts
2392
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
2286
2393
  var ROUTE_URL = "/api/v1/route";
2287
- var RouteClient = class extends ApiClient9 {
2394
+ var RouteClient = class extends ApiClient11 {
2288
2395
  constructor(options) {
2289
2396
  var _a;
2290
2397
  if (!options.limitPolicy) {
@@ -2344,8 +2451,10 @@ function convertEntryToPutEntry(entry) {
2344
2451
  fields: entry.entry.fields,
2345
2452
  _locales: entry.entry._locales
2346
2453
  },
2454
+ pattern: entry.pattern,
2347
2455
  state: entry.state,
2348
- projectId: entry.projectId
2456
+ projectId: entry.projectId,
2457
+ releaseId: entry.releaseId
2349
2458
  };
2350
2459
  }
2351
2460
 
@@ -2422,6 +2531,7 @@ function mapSlotToTestVariations(slot) {
2422
2531
  }
2423
2532
 
2424
2533
  // src/utils/placeholder.ts
2534
+ var SEPARATOR = "_";
2425
2535
  var isComponentPlaceholderId = (id) => {
2426
2536
  if (id === PLACEHOLDER_ID) {
2427
2537
  return true;
@@ -2431,11 +2541,31 @@ var isComponentPlaceholderId = (id) => {
2431
2541
  }
2432
2542
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2433
2543
  };
2434
- var generateComponentPlaceholderId = (randomId, sdkVersion) => {
2544
+ var generateComponentPlaceholderId = (randomId, sdkVersion, parent) => {
2435
2545
  if (typeof sdkVersion === "undefined" || sdkVersion === 1) {
2436
2546
  return PLACEHOLDER_ID;
2437
2547
  }
2438
- return `${PLACEHOLDER_ID}_${randomId}`;
2548
+ let idParts = [PLACEHOLDER_ID, randomId];
2549
+ if (parent) {
2550
+ idParts = [...idParts, parent.nodeId, parent.slotId];
2551
+ }
2552
+ return idParts.join(SEPARATOR);
2553
+ };
2554
+ var parseComponentPlaceholderId = (id) => {
2555
+ if (!isComponentPlaceholderId(id)) {
2556
+ return;
2557
+ }
2558
+ const idParts = id.split(SEPARATOR);
2559
+ const result = {
2560
+ id: idParts[1]
2561
+ };
2562
+ if (idParts[2]) {
2563
+ result.parent = {
2564
+ nodeId: idParts[2],
2565
+ slotId: idParts[3]
2566
+ };
2567
+ }
2568
+ return result;
2439
2569
  };
2440
2570
 
2441
2571
  // src/utils/variables/parseVariableExpression.ts
@@ -2652,6 +2782,8 @@ export {
2652
2782
  CANVAS_PERSONALIZE_SLOT,
2653
2783
  CANVAS_PERSONALIZE_TYPE,
2654
2784
  CANVAS_PUBLISHED_STATE,
2785
+ CANVAS_SLOT_SECTION_SLOT,
2786
+ CANVAS_SLOT_SECTION_TYPE,
2655
2787
  CANVAS_TEST_SLOT,
2656
2788
  CANVAS_TEST_TYPE,
2657
2789
  CANVAS_TEST_VARIANT_PARAM,
@@ -2681,6 +2813,8 @@ export {
2681
2813
  PLACEHOLDER_ID,
2682
2814
  PromptClient,
2683
2815
  RelationshipClient,
2816
+ ReleaseClient,
2817
+ ReleaseContentsClient,
2684
2818
  RouteClient,
2685
2819
  SECRET_QUERY_STRING_PARAM,
2686
2820
  UncachedCanvasClient,
@@ -2725,9 +2859,11 @@ export {
2725
2859
  isOpenParameterEditorMessage,
2726
2860
  isReadyMessage,
2727
2861
  isReportRenderedCompositionsMessage,
2862
+ isRequestComponentSuggestionMessage,
2728
2863
  isRootEntryReference,
2729
2864
  isSelectComponentMessage,
2730
2865
  isSelectParameterMessage,
2866
+ isSuggestComponentMessage,
2731
2867
  isSystemComponentDefinition,
2732
2868
  isTriggerCompositionActionMessage,
2733
2869
  isUpdateComponentParameterMessage,
@@ -2741,6 +2877,7 @@ export {
2741
2877
  mapSlotToPersonalizedVariations,
2742
2878
  mapSlotToTestVariations,
2743
2879
  nullLimitPolicy,
2880
+ parseComponentPlaceholderId,
2744
2881
  parseVariableExpression,
2745
2882
  subscribeToComposition,
2746
2883
  walkComponentTree,
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_api11.ApiClientError,
289
+ ApiClientError: () => import_api13.ApiClientError,
290
290
  BatchEntry: () => BatchEntry,
291
291
  CANVAS_BLOCK_PARAM_TYPE: () => CANVAS_BLOCK_PARAM_TYPE,
292
292
  CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
@@ -300,6 +300,8 @@ __export(src_exports, {
300
300
  CANVAS_PERSONALIZE_SLOT: () => CANVAS_PERSONALIZE_SLOT,
301
301
  CANVAS_PERSONALIZE_TYPE: () => CANVAS_PERSONALIZE_TYPE,
302
302
  CANVAS_PUBLISHED_STATE: () => CANVAS_PUBLISHED_STATE,
303
+ CANVAS_SLOT_SECTION_SLOT: () => CANVAS_SLOT_SECTION_SLOT,
304
+ CANVAS_SLOT_SECTION_TYPE: () => CANVAS_SLOT_SECTION_TYPE,
303
305
  CANVAS_TEST_SLOT: () => CANVAS_TEST_SLOT,
304
306
  CANVAS_TEST_TYPE: () => CANVAS_TEST_TYPE,
305
307
  CANVAS_TEST_VARIANT_PARAM: () => CANVAS_TEST_VARIANT_PARAM,
@@ -329,6 +331,8 @@ __export(src_exports, {
329
331
  PLACEHOLDER_ID: () => PLACEHOLDER_ID,
330
332
  PromptClient: () => PromptClient,
331
333
  RelationshipClient: () => RelationshipClient,
334
+ ReleaseClient: () => ReleaseClient,
335
+ ReleaseContentsClient: () => ReleaseContentsClient,
332
336
  RouteClient: () => RouteClient,
333
337
  SECRET_QUERY_STRING_PARAM: () => SECRET_QUERY_STRING_PARAM,
334
338
  UncachedCanvasClient: () => UncachedCanvasClient,
@@ -373,9 +377,11 @@ __export(src_exports, {
373
377
  isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
374
378
  isReadyMessage: () => isReadyMessage,
375
379
  isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
380
+ isRequestComponentSuggestionMessage: () => isRequestComponentSuggestionMessage,
376
381
  isRootEntryReference: () => isRootEntryReference,
377
382
  isSelectComponentMessage: () => isSelectComponentMessage,
378
383
  isSelectParameterMessage: () => isSelectParameterMessage,
384
+ isSuggestComponentMessage: () => isSuggestComponentMessage,
379
385
  isSystemComponentDefinition: () => isSystemComponentDefinition,
380
386
  isTriggerCompositionActionMessage: () => isTriggerCompositionActionMessage,
381
387
  isUpdateComponentParameterMessage: () => isUpdateComponentParameterMessage,
@@ -389,6 +395,7 @@ __export(src_exports, {
389
395
  mapSlotToPersonalizedVariations: () => mapSlotToPersonalizedVariations,
390
396
  mapSlotToTestVariations: () => mapSlotToTestVariations,
391
397
  nullLimitPolicy: () => nullLimitPolicy,
398
+ parseComponentPlaceholderId: () => parseComponentPlaceholderId,
392
399
  parseVariableExpression: () => parseVariableExpression,
393
400
  subscribeToComposition: () => subscribeToComposition,
394
401
  walkComponentTree: () => walkComponentTree,
@@ -609,15 +616,22 @@ var CanvasClient = class extends import_api2.ApiClient {
609
616
  /** Fetches lists of Canvas compositions, optionally by type */
610
617
  async getCompositionList(params = {}) {
611
618
  const { projectId } = this.options;
612
- const { resolveData, ...originParams } = params;
619
+ const { resolveData, filters, ...originParams } = params;
620
+ const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
621
+ const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
622
+ let rhs = typeof value === "object" ? Object.values(value)[0] : value;
623
+ rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
624
+ return { ...acc, [lhs]: rhs };
625
+ }, {});
613
626
  if (!resolveData) {
614
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
627
+ const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
615
628
  return this.apiClient(fetchUri);
616
629
  }
617
630
  const edgeParams = {
618
631
  ...originParams,
619
632
  projectId,
620
- ...params.diagnostics ? { diagnostics: "true" } : {}
633
+ ...params.diagnostics ? { diagnostics: "true" } : {},
634
+ ...rewrittenFilters
621
635
  };
622
636
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
623
637
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -771,12 +785,22 @@ var _ContentClient = class _ContentClient extends import_api4.ApiClient {
771
785
  }
772
786
  getEntries(options) {
773
787
  const { projectId } = this.options;
774
- const { skipDataResolution, ...params } = options;
788
+ const { skipDataResolution, filters, ...params } = options;
789
+ const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
790
+ const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
791
+ let rhs = typeof value === "object" ? Object.values(value)[0] : value;
792
+ rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
793
+ return { ...acc, [lhs]: rhs };
794
+ }, {});
775
795
  if (skipDataResolution) {
776
- const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, projectId });
796
+ const url = this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
777
797
  return this.apiClient(url);
778
798
  }
779
- const edgeUrl = this.createUrl(__privateGet(_ContentClient, _entriesUrl), this.getEdgeOptions(params), this.edgeApiHost);
799
+ const edgeUrl = this.createUrl(
800
+ __privateGet(_ContentClient, _entriesUrl),
801
+ { ...this.getEdgeOptions(params), ...rewrittenFilters },
802
+ this.edgeApiHost
803
+ );
780
804
  return this.apiClient(
781
805
  edgeUrl,
782
806
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
@@ -1043,12 +1067,14 @@ function getComponentPath(ancestorsAndSelf) {
1043
1067
  var CANVAS_PERSONALIZE_TYPE = "$personalization";
1044
1068
  var CANVAS_TEST_TYPE = "$test";
1045
1069
  var CANVAS_LOCALIZATION_TYPE = "$localization";
1070
+ var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
1046
1071
  var CANVAS_INTENT_TAG_PARAM = "intentTag";
1047
1072
  var CANVAS_LOCALE_TAG_PARAM = "locale";
1048
1073
  var CANVAS_BLOCK_PARAM_TYPE = "$block";
1049
1074
  var CANVAS_PERSONALIZE_SLOT = "pz";
1050
1075
  var CANVAS_TEST_SLOT = "test";
1051
1076
  var CANVAS_LOCALIZATION_SLOT = "localized";
1077
+ var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
1052
1078
  var CANVAS_DRAFT_STATE = 0;
1053
1079
  var CANVAS_PUBLISHED_STATE = 64;
1054
1080
  var CANVAS_EDITOR_STATE = 63;
@@ -2033,6 +2059,12 @@ var isOpenParameterEditorMessage = (message) => {
2033
2059
  var isUpdateComponentReferencesMessage = (message) => {
2034
2060
  return message.type === "update-component-references";
2035
2061
  };
2062
+ var isRequestComponentSuggestionMessage = (message) => {
2063
+ return message.type === "request-component-suggestion";
2064
+ };
2065
+ var isSuggestComponentMessage = (message) => {
2066
+ return message.type === "suggest-component";
2067
+ };
2036
2068
  var createCanvasChannel = ({
2037
2069
  listenTo,
2038
2070
  broadcastTo
@@ -2184,6 +2216,20 @@ var createCanvasChannel = ({
2184
2216
  };
2185
2217
  postMessage(message);
2186
2218
  };
2219
+ const requestComponentSuggestion = (options) => {
2220
+ const message = {
2221
+ ...options,
2222
+ type: "request-component-suggestion"
2223
+ };
2224
+ postMessage(message);
2225
+ };
2226
+ const suggestComponent = (options) => {
2227
+ const message = {
2228
+ ...options,
2229
+ type: "suggest-component"
2230
+ };
2231
+ postMessage(message);
2232
+ };
2187
2233
  const updateFeatureFlags = (options) => {
2188
2234
  const message = {
2189
2235
  ...options,
@@ -2237,7 +2283,9 @@ var createCanvasChannel = ({
2237
2283
  openParameterEditor,
2238
2284
  reportRenderedCompositions,
2239
2285
  editorStateUpdated,
2240
- updateComponentReferences
2286
+ updateComponentReferences,
2287
+ requestComponentSuggestion,
2288
+ suggestComponent
2241
2289
  };
2242
2290
  };
2243
2291
 
@@ -2409,10 +2457,76 @@ var RelationshipClient = class extends import_api9.ApiClient {
2409
2457
  }
2410
2458
  };
2411
2459
 
2412
- // src/RouteClient.ts
2460
+ // src/ReleaseClient.ts
2413
2461
  var import_api10 = require("@uniformdev/context/api");
2462
+ var releasesUrl = "/api/v1/releases";
2463
+ var ReleaseClient = class extends import_api10.ApiClient {
2464
+ constructor(options) {
2465
+ super(options);
2466
+ }
2467
+ /** Fetches all releases for a project */
2468
+ async get(options) {
2469
+ const { projectId } = this.options;
2470
+ const fetchUri = this.createUrl(releasesUrl, { ...options, projectId });
2471
+ return await this.apiClient(fetchUri);
2472
+ }
2473
+ /** Updates or creates (based on id) a release */
2474
+ async upsert(body) {
2475
+ const fetchUri = this.createUrl(releasesUrl);
2476
+ await this.apiClient(fetchUri, {
2477
+ method: "PUT",
2478
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2479
+ expectNoContent: true
2480
+ });
2481
+ }
2482
+ /** Deletes a release */
2483
+ async remove(body) {
2484
+ const fetchUri = this.createUrl(releasesUrl);
2485
+ await this.apiClient(fetchUri, {
2486
+ method: "DELETE",
2487
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2488
+ expectNoContent: true
2489
+ });
2490
+ }
2491
+ /** Readies or unreadies a release for merging */
2492
+ async ready(body) {
2493
+ const fetchUri = this.createUrl(releasesUrl);
2494
+ await this.apiClient(fetchUri, {
2495
+ method: "PATCH",
2496
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2497
+ expectNoContent: true
2498
+ });
2499
+ }
2500
+ };
2501
+
2502
+ // src/ReleaseContentsClient.ts
2503
+ var import_api11 = require("@uniformdev/context/api");
2504
+ var releaseContentsUrl = "/api/v1/release-contents";
2505
+ var ReleaseContentsClient = class extends import_api11.ApiClient {
2506
+ constructor(options) {
2507
+ super(options);
2508
+ }
2509
+ /** Fetches all entities added to a release */
2510
+ async get(options) {
2511
+ const { projectId } = this.options;
2512
+ const fetchUri = this.createUrl(releaseContentsUrl, { ...options, projectId });
2513
+ return await this.apiClient(fetchUri);
2514
+ }
2515
+ /** Removes a release content from a release */
2516
+ async remove(body) {
2517
+ const fetchUri = this.createUrl(releaseContentsUrl);
2518
+ await this.apiClient(fetchUri, {
2519
+ method: "DELETE",
2520
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2521
+ expectNoContent: true
2522
+ });
2523
+ }
2524
+ };
2525
+
2526
+ // src/RouteClient.ts
2527
+ var import_api12 = require("@uniformdev/context/api");
2414
2528
  var ROUTE_URL = "/api/v1/route";
2415
- var RouteClient = class extends import_api10.ApiClient {
2529
+ var RouteClient = class extends import_api12.ApiClient {
2416
2530
  constructor(options) {
2417
2531
  var _a;
2418
2532
  if (!options.limitPolicy) {
@@ -2472,8 +2586,10 @@ function convertEntryToPutEntry(entry) {
2472
2586
  fields: entry.entry.fields,
2473
2587
  _locales: entry.entry._locales
2474
2588
  },
2589
+ pattern: entry.pattern,
2475
2590
  state: entry.state,
2476
- projectId: entry.projectId
2591
+ projectId: entry.projectId,
2592
+ releaseId: entry.releaseId
2477
2593
  };
2478
2594
  }
2479
2595
 
@@ -2550,6 +2666,7 @@ function mapSlotToTestVariations(slot) {
2550
2666
  }
2551
2667
 
2552
2668
  // src/utils/placeholder.ts
2669
+ var SEPARATOR = "_";
2553
2670
  var isComponentPlaceholderId = (id) => {
2554
2671
  if (id === PLACEHOLDER_ID) {
2555
2672
  return true;
@@ -2559,11 +2676,31 @@ var isComponentPlaceholderId = (id) => {
2559
2676
  }
2560
2677
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2561
2678
  };
2562
- var generateComponentPlaceholderId = (randomId, sdkVersion) => {
2679
+ var generateComponentPlaceholderId = (randomId, sdkVersion, parent) => {
2563
2680
  if (typeof sdkVersion === "undefined" || sdkVersion === 1) {
2564
2681
  return PLACEHOLDER_ID;
2565
2682
  }
2566
- return `${PLACEHOLDER_ID}_${randomId}`;
2683
+ let idParts = [PLACEHOLDER_ID, randomId];
2684
+ if (parent) {
2685
+ idParts = [...idParts, parent.nodeId, parent.slotId];
2686
+ }
2687
+ return idParts.join(SEPARATOR);
2688
+ };
2689
+ var parseComponentPlaceholderId = (id) => {
2690
+ if (!isComponentPlaceholderId(id)) {
2691
+ return;
2692
+ }
2693
+ const idParts = id.split(SEPARATOR);
2694
+ const result = {
2695
+ id: idParts[1]
2696
+ };
2697
+ if (idParts[2]) {
2698
+ result.parent = {
2699
+ nodeId: idParts[2],
2700
+ slotId: idParts[3]
2701
+ };
2702
+ }
2703
+ return result;
2567
2704
  };
2568
2705
 
2569
2706
  // src/utils/variables/parseVariableExpression.ts
@@ -2754,8 +2891,8 @@ function handleRichTextNodeBinding(object, options) {
2754
2891
  }
2755
2892
 
2756
2893
  // src/index.ts
2757
- var import_api11 = require("@uniformdev/context/api");
2758
- var CanvasClientError = import_api11.ApiClientError;
2894
+ var import_api13 = require("@uniformdev/context/api");
2895
+ var CanvasClientError = import_api13.ApiClientError;
2759
2896
  // Annotate the CommonJS export names for ESM import in node:
2760
2897
  0 && (module.exports = {
2761
2898
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2781,6 +2918,8 @@ var CanvasClientError = import_api11.ApiClientError;
2781
2918
  CANVAS_PERSONALIZE_SLOT,
2782
2919
  CANVAS_PERSONALIZE_TYPE,
2783
2920
  CANVAS_PUBLISHED_STATE,
2921
+ CANVAS_SLOT_SECTION_SLOT,
2922
+ CANVAS_SLOT_SECTION_TYPE,
2784
2923
  CANVAS_TEST_SLOT,
2785
2924
  CANVAS_TEST_TYPE,
2786
2925
  CANVAS_TEST_VARIANT_PARAM,
@@ -2810,6 +2949,8 @@ var CanvasClientError = import_api11.ApiClientError;
2810
2949
  PLACEHOLDER_ID,
2811
2950
  PromptClient,
2812
2951
  RelationshipClient,
2952
+ ReleaseClient,
2953
+ ReleaseContentsClient,
2813
2954
  RouteClient,
2814
2955
  SECRET_QUERY_STRING_PARAM,
2815
2956
  UncachedCanvasClient,
@@ -2854,9 +2995,11 @@ var CanvasClientError = import_api11.ApiClientError;
2854
2995
  isOpenParameterEditorMessage,
2855
2996
  isReadyMessage,
2856
2997
  isReportRenderedCompositionsMessage,
2998
+ isRequestComponentSuggestionMessage,
2857
2999
  isRootEntryReference,
2858
3000
  isSelectComponentMessage,
2859
3001
  isSelectParameterMessage,
3002
+ isSuggestComponentMessage,
2860
3003
  isSystemComponentDefinition,
2861
3004
  isTriggerCompositionActionMessage,
2862
3005
  isUpdateComponentParameterMessage,
@@ -2870,6 +3013,7 @@ var CanvasClientError = import_api11.ApiClientError;
2870
3013
  mapSlotToPersonalizedVariations,
2871
3014
  mapSlotToTestVariations,
2872
3015
  nullLimitPolicy,
3016
+ parseComponentPlaceholderId,
2873
3017
  parseVariableExpression,
2874
3018
  subscribeToComposition,
2875
3019
  walkComponentTree,