@uniformdev/canvas 19.61.1-alpha.10 → 19.61.1-alpha.13

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
@@ -478,10 +478,20 @@ var CanvasClient = class extends ApiClient {
478
478
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
479
479
  }
480
480
  /** Fetches lists of Canvas compositions, optionally by type */
481
- async getCompositionList(options) {
481
+ async getCompositionList(params = {}) {
482
482
  const { projectId } = this.options;
483
- const fetchUri = this.createUrl(CANVAS_URL, { ...options, projectId });
484
- return await this.apiClient(fetchUri);
483
+ const { resolveData, ...originParams } = params;
484
+ if (!resolveData) {
485
+ const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
486
+ return this.apiClient(fetchUri);
487
+ }
488
+ const edgeParams = {
489
+ ...originParams,
490
+ projectId,
491
+ ...params.diagnostics ? { diagnostics: "true" } : {}
492
+ };
493
+ const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
494
+ return this.apiClient(edgeUrl);
485
495
  }
486
496
  getCompositionByNodePath(options) {
487
497
  return this.getOneComposition(options);
@@ -499,12 +509,12 @@ var CanvasClient = class extends ApiClient {
499
509
  return this.getOneComposition(options);
500
510
  }
501
511
  /** Fetches historical versions of a composition or pattern */
502
- async unstable_getCompositionHistory(options) {
503
- const edgeUrl = this.createUrl("/api/v1/canvas-history", {
512
+ async getCompositionHistory(options) {
513
+ const historyUrl = this.createUrl("/api/v1/canvas-history", {
504
514
  ...options,
505
515
  projectId: this.options.projectId
506
516
  });
507
- return this.apiClient(edgeUrl);
517
+ return this.apiClient(historyUrl);
508
518
  }
509
519
  getOneComposition({
510
520
  skipDataResolution,
@@ -546,7 +556,7 @@ var CanvasClient = class extends ApiClient {
546
556
  async getComponentDefinitions(options) {
547
557
  const { projectId } = this.options;
548
558
  const fetchUri = this.createUrl("/api/v1/canvas-definitions", { ...options, projectId });
549
- return await this.apiClient(fetchUri);
559
+ return this.apiClient(fetchUri);
550
560
  }
551
561
  /** Updates or creates a Canvas component definition */
552
562
  async updateComponentDefinition(body) {
@@ -699,6 +709,14 @@ var _ContentClient = class _ContentClient extends ApiClient4 {
699
709
  const fetchUri = skipDataResolution ? this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, projectId }) : this.createUrl(__privateGet(_ContentClient, _entriesUrl), this.getEdgeOptions(params), this.edgeApiHost);
700
710
  return this.apiClient(fetchUri);
701
711
  }
712
+ /** Fetches historical versions of an entry */
713
+ async getEntryHistory(options) {
714
+ const historyUrl = this.createUrl("/api/v1/entries-history", {
715
+ ...options,
716
+ projectId: this.options.projectId
717
+ });
718
+ return this.apiClient(historyUrl);
719
+ }
702
720
  async upsertContentType(body) {
703
721
  const fetchUri = this.createUrl(__privateGet(_ContentClient, _contentTypesUrl));
704
722
  await this.apiClient(fetchUri, {
@@ -963,6 +981,7 @@ var CANVAS_EDITOR_STATE = 63;
963
981
  var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
964
982
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
965
983
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
984
+ var SECRET_QUERY_STRING_PARAM = "secret";
966
985
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
967
986
  var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
968
987
  var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
@@ -976,13 +995,10 @@ var EMPTY_COMPOSITION = {
976
995
  _name: "An empty composition used for contextual editing",
977
996
  type: "_empty_composition_type"
978
997
  };
979
- var EDGE_MIN_CACHE_TTL = 15;
980
- var EDGE_MAX_CACHE_TTL = 600;
998
+ var EDGE_MIN_CACHE_TTL = 10;
999
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
981
1000
  var EDGE_DEFAULT_CACHE_TTL = 30;
982
1001
  var EDGE_CACHE_DISABLED = -1;
983
- var EDGE_MIN_L2_CACHE_TTL_IN_HOURS = 1;
984
- var EDGE_MAX_L2_CACHE_TTL_IN_HOURS = 4 * 7 * 24;
985
- var EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS = 24;
986
1002
 
987
1003
  // src/utils/entryConverter.ts
988
1004
  function convertEntryToPutEntry(entry) {
@@ -991,6 +1007,7 @@ function convertEntryToPutEntry(entry) {
991
1007
  type: entry.entry.type,
992
1008
  _dataResources: entry.entry._dataResources,
993
1009
  _id: entry.entry._id,
1010
+ _name: entry.entry._name,
994
1011
  _slug: entry.entry._slug,
995
1012
  fields: entry.entry.fields
996
1013
  },
@@ -2077,10 +2094,50 @@ function subscribeToComposition({
2077
2094
  };
2078
2095
  }
2079
2096
 
2080
- // src/RouteClient.ts
2097
+ // src/PromptClient.ts
2081
2098
  import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
2099
+ var PromptUrl = "/api/v1/prompt";
2100
+ var PromptsUrl = "/api/v1/prompts";
2101
+ var PromptClient = class extends ApiClient7 {
2102
+ constructor(options) {
2103
+ super(options);
2104
+ }
2105
+ /** Fetches all Prompts for a project */
2106
+ async get(options) {
2107
+ const { projectId } = this.options;
2108
+ const fetchUri = this.createUrl(PromptUrl, { ...options, projectId });
2109
+ return await this.apiClient(fetchUri);
2110
+ }
2111
+ /** Fetches all Prompts for a project */
2112
+ async getList(options) {
2113
+ const { projectId } = this.options;
2114
+ const fetchUri = this.createUrl(PromptsUrl, { ...options, projectId });
2115
+ return await this.apiClient(fetchUri);
2116
+ }
2117
+ /** Updates or creates (based on id) a Prompt */
2118
+ async upsert(body) {
2119
+ const fetchUri = this.createUrl(PromptUrl);
2120
+ await this.apiClient(fetchUri, {
2121
+ method: "PUT",
2122
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2123
+ expectNoContent: true
2124
+ });
2125
+ }
2126
+ /** Deletes a Prompt */
2127
+ async remove(body) {
2128
+ const fetchUri = this.createUrl(PromptUrl);
2129
+ await this.apiClient(fetchUri, {
2130
+ method: "DELETE",
2131
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2132
+ expectNoContent: true
2133
+ });
2134
+ }
2135
+ };
2136
+
2137
+ // src/RouteClient.ts
2138
+ import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2082
2139
  var ROUTE_URL = "/api/v1/route";
2083
- var RouteClient = class extends ApiClient7 {
2140
+ var RouteClient = class extends ApiClient8 {
2084
2141
  constructor(options) {
2085
2142
  var _a;
2086
2143
  if (!options.limitPolicy) {
@@ -2196,6 +2253,9 @@ var isComponentPlaceholderId = (id) => {
2196
2253
  if (id === PLACEHOLDER_ID) {
2197
2254
  return true;
2198
2255
  }
2256
+ if (typeof id !== "string") {
2257
+ return false;
2258
+ }
2199
2259
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2200
2260
  };
2201
2261
  var generateComponentPlaceholderId = (randomId, sdkVersion) => {
@@ -2423,11 +2483,8 @@ export {
2423
2483
  DataTypeClient,
2424
2484
  EDGE_CACHE_DISABLED,
2425
2485
  EDGE_DEFAULT_CACHE_TTL,
2426
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2427
2486
  EDGE_MAX_CACHE_TTL,
2428
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2429
2487
  EDGE_MIN_CACHE_TTL,
2430
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2431
2488
  EMPTY_COMPOSITION,
2432
2489
  EnhancerBuilder,
2433
2490
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2438,7 +2495,9 @@ export {
2438
2495
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2439
2496
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2440
2497
  PLACEHOLDER_ID,
2498
+ PromptClient,
2441
2499
  RouteClient,
2500
+ SECRET_QUERY_STRING_PARAM,
2442
2501
  UncachedCanvasClient,
2443
2502
  UncachedCategoryClient,
2444
2503
  UncachedContentClient,
package/dist/index.js CHANGED
@@ -283,7 +283,7 @@ __export(src_exports, {
283
283
  ATTRIBUTE_PARAMETER_TYPE: () => ATTRIBUTE_PARAMETER_TYPE,
284
284
  ATTRIBUTE_PARAMETER_VALUE: () => ATTRIBUTE_PARAMETER_VALUE,
285
285
  ATTRIBUTE_PLACEHOLDER: () => ATTRIBUTE_PLACEHOLDER,
286
- ApiClientError: () => import_api9.ApiClientError,
286
+ ApiClientError: () => import_api10.ApiClientError,
287
287
  BatchEntry: () => BatchEntry,
288
288
  CANVAS_BLOCK_PARAM_TYPE: () => CANVAS_BLOCK_PARAM_TYPE,
289
289
  CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
@@ -309,11 +309,8 @@ __export(src_exports, {
309
309
  DataTypeClient: () => DataTypeClient,
310
310
  EDGE_CACHE_DISABLED: () => EDGE_CACHE_DISABLED,
311
311
  EDGE_DEFAULT_CACHE_TTL: () => EDGE_DEFAULT_CACHE_TTL,
312
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS: () => EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
313
312
  EDGE_MAX_CACHE_TTL: () => EDGE_MAX_CACHE_TTL,
314
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS: () => EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
315
313
  EDGE_MIN_CACHE_TTL: () => EDGE_MIN_CACHE_TTL,
316
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS: () => EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
317
314
  EMPTY_COMPOSITION: () => EMPTY_COMPOSITION,
318
315
  EnhancerBuilder: () => EnhancerBuilder,
319
316
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE: () => IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -324,7 +321,9 @@ __export(src_exports, {
324
321
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM: () => IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
325
322
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE: () => IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
326
323
  PLACEHOLDER_ID: () => PLACEHOLDER_ID,
324
+ PromptClient: () => PromptClient,
327
325
  RouteClient: () => RouteClient,
326
+ SECRET_QUERY_STRING_PARAM: () => SECRET_QUERY_STRING_PARAM,
328
327
  UncachedCanvasClient: () => UncachedCanvasClient,
329
328
  UncachedCategoryClient: () => UncachedCategoryClient,
330
329
  UncachedContentClient: () => UncachedContentClient,
@@ -591,10 +590,20 @@ var CanvasClient = class extends import_api2.ApiClient {
591
590
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
592
591
  }
593
592
  /** Fetches lists of Canvas compositions, optionally by type */
594
- async getCompositionList(options) {
593
+ async getCompositionList(params = {}) {
595
594
  const { projectId } = this.options;
596
- const fetchUri = this.createUrl(CANVAS_URL, { ...options, projectId });
597
- return await this.apiClient(fetchUri);
595
+ const { resolveData, ...originParams } = params;
596
+ if (!resolveData) {
597
+ const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
598
+ return this.apiClient(fetchUri);
599
+ }
600
+ const edgeParams = {
601
+ ...originParams,
602
+ projectId,
603
+ ...params.diagnostics ? { diagnostics: "true" } : {}
604
+ };
605
+ const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
606
+ return this.apiClient(edgeUrl);
598
607
  }
599
608
  getCompositionByNodePath(options) {
600
609
  return this.getOneComposition(options);
@@ -612,12 +621,12 @@ var CanvasClient = class extends import_api2.ApiClient {
612
621
  return this.getOneComposition(options);
613
622
  }
614
623
  /** Fetches historical versions of a composition or pattern */
615
- async unstable_getCompositionHistory(options) {
616
- const edgeUrl = this.createUrl("/api/v1/canvas-history", {
624
+ async getCompositionHistory(options) {
625
+ const historyUrl = this.createUrl("/api/v1/canvas-history", {
617
626
  ...options,
618
627
  projectId: this.options.projectId
619
628
  });
620
- return this.apiClient(edgeUrl);
629
+ return this.apiClient(historyUrl);
621
630
  }
622
631
  getOneComposition({
623
632
  skipDataResolution,
@@ -659,7 +668,7 @@ var CanvasClient = class extends import_api2.ApiClient {
659
668
  async getComponentDefinitions(options) {
660
669
  const { projectId } = this.options;
661
670
  const fetchUri = this.createUrl("/api/v1/canvas-definitions", { ...options, projectId });
662
- return await this.apiClient(fetchUri);
671
+ return this.apiClient(fetchUri);
663
672
  }
664
673
  /** Updates or creates a Canvas component definition */
665
674
  async updateComponentDefinition(body) {
@@ -812,6 +821,14 @@ var _ContentClient = class _ContentClient extends import_api5.ApiClient {
812
821
  const fetchUri = skipDataResolution ? this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, projectId }) : this.createUrl(__privateGet(_ContentClient, _entriesUrl), this.getEdgeOptions(params), this.edgeApiHost);
813
822
  return this.apiClient(fetchUri);
814
823
  }
824
+ /** Fetches historical versions of an entry */
825
+ async getEntryHistory(options) {
826
+ const historyUrl = this.createUrl("/api/v1/entries-history", {
827
+ ...options,
828
+ projectId: this.options.projectId
829
+ });
830
+ return this.apiClient(historyUrl);
831
+ }
815
832
  async upsertContentType(body) {
816
833
  const fetchUri = this.createUrl(__privateGet(_ContentClient, _contentTypesUrl));
817
834
  await this.apiClient(fetchUri, {
@@ -1076,6 +1093,7 @@ var CANVAS_EDITOR_STATE = 63;
1076
1093
  var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1077
1094
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1078
1095
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1096
+ var SECRET_QUERY_STRING_PARAM = "secret";
1079
1097
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1080
1098
  var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
1081
1099
  var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
@@ -1089,13 +1107,10 @@ var EMPTY_COMPOSITION = {
1089
1107
  _name: "An empty composition used for contextual editing",
1090
1108
  type: "_empty_composition_type"
1091
1109
  };
1092
- var EDGE_MIN_CACHE_TTL = 15;
1093
- var EDGE_MAX_CACHE_TTL = 600;
1110
+ var EDGE_MIN_CACHE_TTL = 10;
1111
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1094
1112
  var EDGE_DEFAULT_CACHE_TTL = 30;
1095
1113
  var EDGE_CACHE_DISABLED = -1;
1096
- var EDGE_MIN_L2_CACHE_TTL_IN_HOURS = 1;
1097
- var EDGE_MAX_L2_CACHE_TTL_IN_HOURS = 4 * 7 * 24;
1098
- var EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS = 24;
1099
1114
 
1100
1115
  // src/utils/entryConverter.ts
1101
1116
  function convertEntryToPutEntry(entry) {
@@ -1104,6 +1119,7 @@ function convertEntryToPutEntry(entry) {
1104
1119
  type: entry.entry.type,
1105
1120
  _dataResources: entry.entry._dataResources,
1106
1121
  _id: entry.entry._id,
1122
+ _name: entry.entry._name,
1107
1123
  _slug: entry.entry._slug,
1108
1124
  fields: entry.entry.fields
1109
1125
  },
@@ -2190,10 +2206,50 @@ function subscribeToComposition({
2190
2206
  };
2191
2207
  }
2192
2208
 
2193
- // src/RouteClient.ts
2209
+ // src/PromptClient.ts
2194
2210
  var import_api8 = require("@uniformdev/context/api");
2211
+ var PromptUrl = "/api/v1/prompt";
2212
+ var PromptsUrl = "/api/v1/prompts";
2213
+ var PromptClient = class extends import_api8.ApiClient {
2214
+ constructor(options) {
2215
+ super(options);
2216
+ }
2217
+ /** Fetches all Prompts for a project */
2218
+ async get(options) {
2219
+ const { projectId } = this.options;
2220
+ const fetchUri = this.createUrl(PromptUrl, { ...options, projectId });
2221
+ return await this.apiClient(fetchUri);
2222
+ }
2223
+ /** Fetches all Prompts for a project */
2224
+ async getList(options) {
2225
+ const { projectId } = this.options;
2226
+ const fetchUri = this.createUrl(PromptsUrl, { ...options, projectId });
2227
+ return await this.apiClient(fetchUri);
2228
+ }
2229
+ /** Updates or creates (based on id) a Prompt */
2230
+ async upsert(body) {
2231
+ const fetchUri = this.createUrl(PromptUrl);
2232
+ await this.apiClient(fetchUri, {
2233
+ method: "PUT",
2234
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2235
+ expectNoContent: true
2236
+ });
2237
+ }
2238
+ /** Deletes a Prompt */
2239
+ async remove(body) {
2240
+ const fetchUri = this.createUrl(PromptUrl);
2241
+ await this.apiClient(fetchUri, {
2242
+ method: "DELETE",
2243
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2244
+ expectNoContent: true
2245
+ });
2246
+ }
2247
+ };
2248
+
2249
+ // src/RouteClient.ts
2250
+ var import_api9 = require("@uniformdev/context/api");
2195
2251
  var ROUTE_URL = "/api/v1/route";
2196
- var RouteClient = class extends import_api8.ApiClient {
2252
+ var RouteClient = class extends import_api9.ApiClient {
2197
2253
  constructor(options) {
2198
2254
  var _a;
2199
2255
  if (!options.limitPolicy) {
@@ -2309,6 +2365,9 @@ var isComponentPlaceholderId = (id) => {
2309
2365
  if (id === PLACEHOLDER_ID) {
2310
2366
  return true;
2311
2367
  }
2368
+ if (typeof id !== "string") {
2369
+ return false;
2370
+ }
2312
2371
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2313
2372
  };
2314
2373
  var generateComponentPlaceholderId = (randomId, sdkVersion) => {
@@ -2501,8 +2560,8 @@ function handleRichTextNodeBinding(object, options) {
2501
2560
  }
2502
2561
 
2503
2562
  // src/index.ts
2504
- var import_api9 = require("@uniformdev/context/api");
2505
- var CanvasClientError = import_api9.ApiClientError;
2563
+ var import_api10 = require("@uniformdev/context/api");
2564
+ var CanvasClientError = import_api10.ApiClientError;
2506
2565
  // Annotate the CommonJS export names for ESM import in node:
2507
2566
  0 && (module.exports = {
2508
2567
  ATTRIBUTE_COMPONENT_ID,
@@ -2537,11 +2596,8 @@ var CanvasClientError = import_api9.ApiClientError;
2537
2596
  DataTypeClient,
2538
2597
  EDGE_CACHE_DISABLED,
2539
2598
  EDGE_DEFAULT_CACHE_TTL,
2540
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2541
2599
  EDGE_MAX_CACHE_TTL,
2542
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2543
2600
  EDGE_MIN_CACHE_TTL,
2544
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2545
2601
  EMPTY_COMPOSITION,
2546
2602
  EnhancerBuilder,
2547
2603
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2552,7 +2608,9 @@ var CanvasClientError = import_api9.ApiClientError;
2552
2608
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2553
2609
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2554
2610
  PLACEHOLDER_ID,
2611
+ PromptClient,
2555
2612
  RouteClient,
2613
+ SECRET_QUERY_STRING_PARAM,
2556
2614
  UncachedCanvasClient,
2557
2615
  UncachedCategoryClient,
2558
2616
  UncachedContentClient,
package/dist/index.mjs CHANGED
@@ -478,10 +478,20 @@ var CanvasClient = class extends ApiClient {
478
478
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
479
479
  }
480
480
  /** Fetches lists of Canvas compositions, optionally by type */
481
- async getCompositionList(options) {
481
+ async getCompositionList(params = {}) {
482
482
  const { projectId } = this.options;
483
- const fetchUri = this.createUrl(CANVAS_URL, { ...options, projectId });
484
- return await this.apiClient(fetchUri);
483
+ const { resolveData, ...originParams } = params;
484
+ if (!resolveData) {
485
+ const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
486
+ return this.apiClient(fetchUri);
487
+ }
488
+ const edgeParams = {
489
+ ...originParams,
490
+ projectId,
491
+ ...params.diagnostics ? { diagnostics: "true" } : {}
492
+ };
493
+ const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
494
+ return this.apiClient(edgeUrl);
485
495
  }
486
496
  getCompositionByNodePath(options) {
487
497
  return this.getOneComposition(options);
@@ -499,12 +509,12 @@ var CanvasClient = class extends ApiClient {
499
509
  return this.getOneComposition(options);
500
510
  }
501
511
  /** Fetches historical versions of a composition or pattern */
502
- async unstable_getCompositionHistory(options) {
503
- const edgeUrl = this.createUrl("/api/v1/canvas-history", {
512
+ async getCompositionHistory(options) {
513
+ const historyUrl = this.createUrl("/api/v1/canvas-history", {
504
514
  ...options,
505
515
  projectId: this.options.projectId
506
516
  });
507
- return this.apiClient(edgeUrl);
517
+ return this.apiClient(historyUrl);
508
518
  }
509
519
  getOneComposition({
510
520
  skipDataResolution,
@@ -546,7 +556,7 @@ var CanvasClient = class extends ApiClient {
546
556
  async getComponentDefinitions(options) {
547
557
  const { projectId } = this.options;
548
558
  const fetchUri = this.createUrl("/api/v1/canvas-definitions", { ...options, projectId });
549
- return await this.apiClient(fetchUri);
559
+ return this.apiClient(fetchUri);
550
560
  }
551
561
  /** Updates or creates a Canvas component definition */
552
562
  async updateComponentDefinition(body) {
@@ -699,6 +709,14 @@ var _ContentClient = class _ContentClient extends ApiClient4 {
699
709
  const fetchUri = skipDataResolution ? this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, projectId }) : this.createUrl(__privateGet(_ContentClient, _entriesUrl), this.getEdgeOptions(params), this.edgeApiHost);
700
710
  return this.apiClient(fetchUri);
701
711
  }
712
+ /** Fetches historical versions of an entry */
713
+ async getEntryHistory(options) {
714
+ const historyUrl = this.createUrl("/api/v1/entries-history", {
715
+ ...options,
716
+ projectId: this.options.projectId
717
+ });
718
+ return this.apiClient(historyUrl);
719
+ }
702
720
  async upsertContentType(body) {
703
721
  const fetchUri = this.createUrl(__privateGet(_ContentClient, _contentTypesUrl));
704
722
  await this.apiClient(fetchUri, {
@@ -963,6 +981,7 @@ var CANVAS_EDITOR_STATE = 63;
963
981
  var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
964
982
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
965
983
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
984
+ var SECRET_QUERY_STRING_PARAM = "secret";
966
985
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
967
986
  var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
968
987
  var IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM = "is_config_check";
@@ -976,13 +995,10 @@ var EMPTY_COMPOSITION = {
976
995
  _name: "An empty composition used for contextual editing",
977
996
  type: "_empty_composition_type"
978
997
  };
979
- var EDGE_MIN_CACHE_TTL = 15;
980
- var EDGE_MAX_CACHE_TTL = 600;
998
+ var EDGE_MIN_CACHE_TTL = 10;
999
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
981
1000
  var EDGE_DEFAULT_CACHE_TTL = 30;
982
1001
  var EDGE_CACHE_DISABLED = -1;
983
- var EDGE_MIN_L2_CACHE_TTL_IN_HOURS = 1;
984
- var EDGE_MAX_L2_CACHE_TTL_IN_HOURS = 4 * 7 * 24;
985
- var EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS = 24;
986
1002
 
987
1003
  // src/utils/entryConverter.ts
988
1004
  function convertEntryToPutEntry(entry) {
@@ -991,6 +1007,7 @@ function convertEntryToPutEntry(entry) {
991
1007
  type: entry.entry.type,
992
1008
  _dataResources: entry.entry._dataResources,
993
1009
  _id: entry.entry._id,
1010
+ _name: entry.entry._name,
994
1011
  _slug: entry.entry._slug,
995
1012
  fields: entry.entry.fields
996
1013
  },
@@ -2077,10 +2094,50 @@ function subscribeToComposition({
2077
2094
  };
2078
2095
  }
2079
2096
 
2080
- // src/RouteClient.ts
2097
+ // src/PromptClient.ts
2081
2098
  import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
2099
+ var PromptUrl = "/api/v1/prompt";
2100
+ var PromptsUrl = "/api/v1/prompts";
2101
+ var PromptClient = class extends ApiClient7 {
2102
+ constructor(options) {
2103
+ super(options);
2104
+ }
2105
+ /** Fetches all Prompts for a project */
2106
+ async get(options) {
2107
+ const { projectId } = this.options;
2108
+ const fetchUri = this.createUrl(PromptUrl, { ...options, projectId });
2109
+ return await this.apiClient(fetchUri);
2110
+ }
2111
+ /** Fetches all Prompts for a project */
2112
+ async getList(options) {
2113
+ const { projectId } = this.options;
2114
+ const fetchUri = this.createUrl(PromptsUrl, { ...options, projectId });
2115
+ return await this.apiClient(fetchUri);
2116
+ }
2117
+ /** Updates or creates (based on id) a Prompt */
2118
+ async upsert(body) {
2119
+ const fetchUri = this.createUrl(PromptUrl);
2120
+ await this.apiClient(fetchUri, {
2121
+ method: "PUT",
2122
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2123
+ expectNoContent: true
2124
+ });
2125
+ }
2126
+ /** Deletes a Prompt */
2127
+ async remove(body) {
2128
+ const fetchUri = this.createUrl(PromptUrl);
2129
+ await this.apiClient(fetchUri, {
2130
+ method: "DELETE",
2131
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2132
+ expectNoContent: true
2133
+ });
2134
+ }
2135
+ };
2136
+
2137
+ // src/RouteClient.ts
2138
+ import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2082
2139
  var ROUTE_URL = "/api/v1/route";
2083
- var RouteClient = class extends ApiClient7 {
2140
+ var RouteClient = class extends ApiClient8 {
2084
2141
  constructor(options) {
2085
2142
  var _a;
2086
2143
  if (!options.limitPolicy) {
@@ -2196,6 +2253,9 @@ var isComponentPlaceholderId = (id) => {
2196
2253
  if (id === PLACEHOLDER_ID) {
2197
2254
  return true;
2198
2255
  }
2256
+ if (typeof id !== "string") {
2257
+ return false;
2258
+ }
2199
2259
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2200
2260
  };
2201
2261
  var generateComponentPlaceholderId = (randomId, sdkVersion) => {
@@ -2423,11 +2483,8 @@ export {
2423
2483
  DataTypeClient,
2424
2484
  EDGE_CACHE_DISABLED,
2425
2485
  EDGE_DEFAULT_CACHE_TTL,
2426
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2427
2486
  EDGE_MAX_CACHE_TTL,
2428
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2429
2487
  EDGE_MIN_CACHE_TTL,
2430
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2431
2488
  EMPTY_COMPOSITION,
2432
2489
  EnhancerBuilder,
2433
2490
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2438,7 +2495,9 @@ export {
2438
2495
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2439
2496
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2440
2497
  PLACEHOLDER_ID,
2498
+ PromptClient,
2441
2499
  RouteClient,
2500
+ SECRET_QUERY_STRING_PARAM,
2442
2501
  UncachedCanvasClient,
2443
2502
  UncachedCategoryClient,
2444
2503
  UncachedContentClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.61.1-alpha.10+8aa257167",
3
+ "version": "19.61.1-alpha.13+9ea7c72e6",
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,7 +38,8 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/context": "19.61.1-alpha.10+8aa257167",
41
+ "@uniformdev/assets": "19.61.1-alpha.13+9ea7c72e6",
42
+ "@uniformdev/context": "19.61.1-alpha.13+9ea7c72e6",
42
43
  "immer": "9.0.21"
43
44
  },
44
45
  "files": [
@@ -47,5 +48,5 @@
47
48
  "publishConfig": {
48
49
  "access": "public"
49
50
  },
50
- "gitHead": "8aa2571675505a90ba544863f87621dd90750c3a"
51
+ "gitHead": "9ea7c72e685bf1dd690149aa40a9b7a443d2ad28"
51
52
  }