@uniformdev/canvas 19.60.1-alpha.6 → 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, {
@@ -977,13 +995,10 @@ var EMPTY_COMPOSITION = {
977
995
  _name: "An empty composition used for contextual editing",
978
996
  type: "_empty_composition_type"
979
997
  };
980
- var EDGE_MIN_CACHE_TTL = 15;
981
- var EDGE_MAX_CACHE_TTL = 600;
998
+ var EDGE_MIN_CACHE_TTL = 10;
999
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
982
1000
  var EDGE_DEFAULT_CACHE_TTL = 30;
983
1001
  var EDGE_CACHE_DISABLED = -1;
984
- var EDGE_MIN_L2_CACHE_TTL_IN_HOURS = 1;
985
- var EDGE_MAX_L2_CACHE_TTL_IN_HOURS = 4 * 7 * 24;
986
- var EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS = 24;
987
1002
 
988
1003
  // src/utils/entryConverter.ts
989
1004
  function convertEntryToPutEntry(entry) {
@@ -992,6 +1007,7 @@ function convertEntryToPutEntry(entry) {
992
1007
  type: entry.entry.type,
993
1008
  _dataResources: entry.entry._dataResources,
994
1009
  _id: entry.entry._id,
1010
+ _name: entry.entry._name,
995
1011
  _slug: entry.entry._slug,
996
1012
  fields: entry.entry.fields
997
1013
  },
@@ -2078,10 +2094,50 @@ function subscribeToComposition({
2078
2094
  };
2079
2095
  }
2080
2096
 
2081
- // src/RouteClient.ts
2097
+ // src/PromptClient.ts
2082
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";
2083
2139
  var ROUTE_URL = "/api/v1/route";
2084
- var RouteClient = class extends ApiClient7 {
2140
+ var RouteClient = class extends ApiClient8 {
2085
2141
  constructor(options) {
2086
2142
  var _a;
2087
2143
  if (!options.limitPolicy) {
@@ -2197,6 +2253,9 @@ var isComponentPlaceholderId = (id) => {
2197
2253
  if (id === PLACEHOLDER_ID) {
2198
2254
  return true;
2199
2255
  }
2256
+ if (typeof id !== "string") {
2257
+ return false;
2258
+ }
2200
2259
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2201
2260
  };
2202
2261
  var generateComponentPlaceholderId = (randomId, sdkVersion) => {
@@ -2424,11 +2483,8 @@ export {
2424
2483
  DataTypeClient,
2425
2484
  EDGE_CACHE_DISABLED,
2426
2485
  EDGE_DEFAULT_CACHE_TTL,
2427
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2428
2486
  EDGE_MAX_CACHE_TTL,
2429
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2430
2487
  EDGE_MIN_CACHE_TTL,
2431
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2432
2488
  EMPTY_COMPOSITION,
2433
2489
  EnhancerBuilder,
2434
2490
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2439,6 +2495,7 @@ export {
2439
2495
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2440
2496
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2441
2497
  PLACEHOLDER_ID,
2498
+ PromptClient,
2442
2499
  RouteClient,
2443
2500
  SECRET_QUERY_STRING_PARAM,
2444
2501
  UncachedCanvasClient,
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,6 +321,7 @@ __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,
328
326
  SECRET_QUERY_STRING_PARAM: () => SECRET_QUERY_STRING_PARAM,
329
327
  UncachedCanvasClient: () => UncachedCanvasClient,
@@ -592,10 +590,20 @@ var CanvasClient = class extends import_api2.ApiClient {
592
590
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
593
591
  }
594
592
  /** Fetches lists of Canvas compositions, optionally by type */
595
- async getCompositionList(options) {
593
+ async getCompositionList(params = {}) {
596
594
  const { projectId } = this.options;
597
- const fetchUri = this.createUrl(CANVAS_URL, { ...options, projectId });
598
- 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);
599
607
  }
600
608
  getCompositionByNodePath(options) {
601
609
  return this.getOneComposition(options);
@@ -613,12 +621,12 @@ var CanvasClient = class extends import_api2.ApiClient {
613
621
  return this.getOneComposition(options);
614
622
  }
615
623
  /** Fetches historical versions of a composition or pattern */
616
- async unstable_getCompositionHistory(options) {
617
- const edgeUrl = this.createUrl("/api/v1/canvas-history", {
624
+ async getCompositionHistory(options) {
625
+ const historyUrl = this.createUrl("/api/v1/canvas-history", {
618
626
  ...options,
619
627
  projectId: this.options.projectId
620
628
  });
621
- return this.apiClient(edgeUrl);
629
+ return this.apiClient(historyUrl);
622
630
  }
623
631
  getOneComposition({
624
632
  skipDataResolution,
@@ -660,7 +668,7 @@ var CanvasClient = class extends import_api2.ApiClient {
660
668
  async getComponentDefinitions(options) {
661
669
  const { projectId } = this.options;
662
670
  const fetchUri = this.createUrl("/api/v1/canvas-definitions", { ...options, projectId });
663
- return await this.apiClient(fetchUri);
671
+ return this.apiClient(fetchUri);
664
672
  }
665
673
  /** Updates or creates a Canvas component definition */
666
674
  async updateComponentDefinition(body) {
@@ -813,6 +821,14 @@ var _ContentClient = class _ContentClient extends import_api5.ApiClient {
813
821
  const fetchUri = skipDataResolution ? this.createUrl(__privateGet(_ContentClient, _entriesUrl), { ...params, projectId }) : this.createUrl(__privateGet(_ContentClient, _entriesUrl), this.getEdgeOptions(params), this.edgeApiHost);
814
822
  return this.apiClient(fetchUri);
815
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
+ }
816
832
  async upsertContentType(body) {
817
833
  const fetchUri = this.createUrl(__privateGet(_ContentClient, _contentTypesUrl));
818
834
  await this.apiClient(fetchUri, {
@@ -1091,13 +1107,10 @@ var EMPTY_COMPOSITION = {
1091
1107
  _name: "An empty composition used for contextual editing",
1092
1108
  type: "_empty_composition_type"
1093
1109
  };
1094
- var EDGE_MIN_CACHE_TTL = 15;
1095
- var EDGE_MAX_CACHE_TTL = 600;
1110
+ var EDGE_MIN_CACHE_TTL = 10;
1111
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1096
1112
  var EDGE_DEFAULT_CACHE_TTL = 30;
1097
1113
  var EDGE_CACHE_DISABLED = -1;
1098
- var EDGE_MIN_L2_CACHE_TTL_IN_HOURS = 1;
1099
- var EDGE_MAX_L2_CACHE_TTL_IN_HOURS = 4 * 7 * 24;
1100
- var EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS = 24;
1101
1114
 
1102
1115
  // src/utils/entryConverter.ts
1103
1116
  function convertEntryToPutEntry(entry) {
@@ -1106,6 +1119,7 @@ function convertEntryToPutEntry(entry) {
1106
1119
  type: entry.entry.type,
1107
1120
  _dataResources: entry.entry._dataResources,
1108
1121
  _id: entry.entry._id,
1122
+ _name: entry.entry._name,
1109
1123
  _slug: entry.entry._slug,
1110
1124
  fields: entry.entry.fields
1111
1125
  },
@@ -2192,10 +2206,50 @@ function subscribeToComposition({
2192
2206
  };
2193
2207
  }
2194
2208
 
2195
- // src/RouteClient.ts
2209
+ // src/PromptClient.ts
2196
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");
2197
2251
  var ROUTE_URL = "/api/v1/route";
2198
- var RouteClient = class extends import_api8.ApiClient {
2252
+ var RouteClient = class extends import_api9.ApiClient {
2199
2253
  constructor(options) {
2200
2254
  var _a;
2201
2255
  if (!options.limitPolicy) {
@@ -2311,6 +2365,9 @@ var isComponentPlaceholderId = (id) => {
2311
2365
  if (id === PLACEHOLDER_ID) {
2312
2366
  return true;
2313
2367
  }
2368
+ if (typeof id !== "string") {
2369
+ return false;
2370
+ }
2314
2371
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2315
2372
  };
2316
2373
  var generateComponentPlaceholderId = (randomId, sdkVersion) => {
@@ -2503,8 +2560,8 @@ function handleRichTextNodeBinding(object, options) {
2503
2560
  }
2504
2561
 
2505
2562
  // src/index.ts
2506
- var import_api9 = require("@uniformdev/context/api");
2507
- var CanvasClientError = import_api9.ApiClientError;
2563
+ var import_api10 = require("@uniformdev/context/api");
2564
+ var CanvasClientError = import_api10.ApiClientError;
2508
2565
  // Annotate the CommonJS export names for ESM import in node:
2509
2566
  0 && (module.exports = {
2510
2567
  ATTRIBUTE_COMPONENT_ID,
@@ -2539,11 +2596,8 @@ var CanvasClientError = import_api9.ApiClientError;
2539
2596
  DataTypeClient,
2540
2597
  EDGE_CACHE_DISABLED,
2541
2598
  EDGE_DEFAULT_CACHE_TTL,
2542
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2543
2599
  EDGE_MAX_CACHE_TTL,
2544
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2545
2600
  EDGE_MIN_CACHE_TTL,
2546
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2547
2601
  EMPTY_COMPOSITION,
2548
2602
  EnhancerBuilder,
2549
2603
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2554,6 +2608,7 @@ var CanvasClientError = import_api9.ApiClientError;
2554
2608
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2555
2609
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2556
2610
  PLACEHOLDER_ID,
2611
+ PromptClient,
2557
2612
  RouteClient,
2558
2613
  SECRET_QUERY_STRING_PARAM,
2559
2614
  UncachedCanvasClient,
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, {
@@ -977,13 +995,10 @@ var EMPTY_COMPOSITION = {
977
995
  _name: "An empty composition used for contextual editing",
978
996
  type: "_empty_composition_type"
979
997
  };
980
- var EDGE_MIN_CACHE_TTL = 15;
981
- var EDGE_MAX_CACHE_TTL = 600;
998
+ var EDGE_MIN_CACHE_TTL = 10;
999
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
982
1000
  var EDGE_DEFAULT_CACHE_TTL = 30;
983
1001
  var EDGE_CACHE_DISABLED = -1;
984
- var EDGE_MIN_L2_CACHE_TTL_IN_HOURS = 1;
985
- var EDGE_MAX_L2_CACHE_TTL_IN_HOURS = 4 * 7 * 24;
986
- var EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS = 24;
987
1002
 
988
1003
  // src/utils/entryConverter.ts
989
1004
  function convertEntryToPutEntry(entry) {
@@ -992,6 +1007,7 @@ function convertEntryToPutEntry(entry) {
992
1007
  type: entry.entry.type,
993
1008
  _dataResources: entry.entry._dataResources,
994
1009
  _id: entry.entry._id,
1010
+ _name: entry.entry._name,
995
1011
  _slug: entry.entry._slug,
996
1012
  fields: entry.entry.fields
997
1013
  },
@@ -2078,10 +2094,50 @@ function subscribeToComposition({
2078
2094
  };
2079
2095
  }
2080
2096
 
2081
- // src/RouteClient.ts
2097
+ // src/PromptClient.ts
2082
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";
2083
2139
  var ROUTE_URL = "/api/v1/route";
2084
- var RouteClient = class extends ApiClient7 {
2140
+ var RouteClient = class extends ApiClient8 {
2085
2141
  constructor(options) {
2086
2142
  var _a;
2087
2143
  if (!options.limitPolicy) {
@@ -2197,6 +2253,9 @@ var isComponentPlaceholderId = (id) => {
2197
2253
  if (id === PLACEHOLDER_ID) {
2198
2254
  return true;
2199
2255
  }
2256
+ if (typeof id !== "string") {
2257
+ return false;
2258
+ }
2200
2259
  return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
2201
2260
  };
2202
2261
  var generateComponentPlaceholderId = (randomId, sdkVersion) => {
@@ -2424,11 +2483,8 @@ export {
2424
2483
  DataTypeClient,
2425
2484
  EDGE_CACHE_DISABLED,
2426
2485
  EDGE_DEFAULT_CACHE_TTL,
2427
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2428
2486
  EDGE_MAX_CACHE_TTL,
2429
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2430
2487
  EDGE_MIN_CACHE_TTL,
2431
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2432
2488
  EMPTY_COMPOSITION,
2433
2489
  EnhancerBuilder,
2434
2490
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2439,6 +2495,7 @@ export {
2439
2495
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2440
2496
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2441
2497
  PLACEHOLDER_ID,
2498
+ PromptClient,
2442
2499
  RouteClient,
2443
2500
  SECRET_QUERY_STRING_PARAM,
2444
2501
  UncachedCanvasClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.60.1-alpha.6+ac384b46c",
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.60.1-alpha.6+ac384b46c",
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": "ac384b46c7694dbecf4983cb04cd66dc8904c5fa"
51
+ "gitHead": "9ea7c72e685bf1dd690149aa40a9b7a443d2ad28"
51
52
  }