@uniformdev/canvas 19.61.1 → 19.62.1-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -977,13 +977,10 @@ var EMPTY_COMPOSITION = {
977
977
  _name: "An empty composition used for contextual editing",
978
978
  type: "_empty_composition_type"
979
979
  };
980
- var EDGE_MIN_CACHE_TTL = 15;
981
- var EDGE_MAX_CACHE_TTL = 600;
980
+ var EDGE_MIN_CACHE_TTL = 10;
981
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
982
982
  var EDGE_DEFAULT_CACHE_TTL = 30;
983
983
  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
984
 
988
985
  // src/utils/entryConverter.ts
989
986
  function convertEntryToPutEntry(entry) {
@@ -992,6 +989,7 @@ function convertEntryToPutEntry(entry) {
992
989
  type: entry.entry.type,
993
990
  _dataResources: entry.entry._dataResources,
994
991
  _id: entry.entry._id,
992
+ _name: entry.entry._name,
995
993
  _slug: entry.entry._slug,
996
994
  fields: entry.entry.fields
997
995
  },
@@ -2078,10 +2076,50 @@ function subscribeToComposition({
2078
2076
  };
2079
2077
  }
2080
2078
 
2081
- // src/RouteClient.ts
2079
+ // src/PromptClient.ts
2082
2080
  import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
2081
+ var PromptUrl = "/api/v1/prompt";
2082
+ var PromptsUrl = "/api/v1/prompts";
2083
+ var PromptClient = class extends ApiClient7 {
2084
+ constructor(options) {
2085
+ super(options);
2086
+ }
2087
+ /** Fetches all Prompts for a project */
2088
+ async get(options) {
2089
+ const { projectId } = this.options;
2090
+ const fetchUri = this.createUrl(PromptUrl, { ...options, projectId });
2091
+ return await this.apiClient(fetchUri);
2092
+ }
2093
+ /** Fetches all Prompts for a project */
2094
+ async getList(options) {
2095
+ const { projectId } = this.options;
2096
+ const fetchUri = this.createUrl(PromptsUrl, { ...options, projectId });
2097
+ return await this.apiClient(fetchUri);
2098
+ }
2099
+ /** Updates or creates (based on id) a Prompt */
2100
+ async upsert(body) {
2101
+ const fetchUri = this.createUrl(PromptUrl);
2102
+ await this.apiClient(fetchUri, {
2103
+ method: "PUT",
2104
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2105
+ expectNoContent: true
2106
+ });
2107
+ }
2108
+ /** Deletes a Prompt */
2109
+ async remove(body) {
2110
+ const fetchUri = this.createUrl(PromptUrl);
2111
+ await this.apiClient(fetchUri, {
2112
+ method: "DELETE",
2113
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2114
+ expectNoContent: true
2115
+ });
2116
+ }
2117
+ };
2118
+
2119
+ // src/RouteClient.ts
2120
+ import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2083
2121
  var ROUTE_URL = "/api/v1/route";
2084
- var RouteClient = class extends ApiClient7 {
2122
+ var RouteClient = class extends ApiClient8 {
2085
2123
  constructor(options) {
2086
2124
  var _a;
2087
2125
  if (!options.limitPolicy) {
@@ -2424,11 +2462,8 @@ export {
2424
2462
  DataTypeClient,
2425
2463
  EDGE_CACHE_DISABLED,
2426
2464
  EDGE_DEFAULT_CACHE_TTL,
2427
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2428
2465
  EDGE_MAX_CACHE_TTL,
2429
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2430
2466
  EDGE_MIN_CACHE_TTL,
2431
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2432
2467
  EMPTY_COMPOSITION,
2433
2468
  EnhancerBuilder,
2434
2469
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2439,6 +2474,7 @@ export {
2439
2474
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2440
2475
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2441
2476
  PLACEHOLDER_ID,
2477
+ PromptClient,
2442
2478
  RouteClient,
2443
2479
  SECRET_QUERY_STRING_PARAM,
2444
2480
  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,
@@ -1091,13 +1089,10 @@ var EMPTY_COMPOSITION = {
1091
1089
  _name: "An empty composition used for contextual editing",
1092
1090
  type: "_empty_composition_type"
1093
1091
  };
1094
- var EDGE_MIN_CACHE_TTL = 15;
1095
- var EDGE_MAX_CACHE_TTL = 600;
1092
+ var EDGE_MIN_CACHE_TTL = 10;
1093
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1096
1094
  var EDGE_DEFAULT_CACHE_TTL = 30;
1097
1095
  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
1096
 
1102
1097
  // src/utils/entryConverter.ts
1103
1098
  function convertEntryToPutEntry(entry) {
@@ -1106,6 +1101,7 @@ function convertEntryToPutEntry(entry) {
1106
1101
  type: entry.entry.type,
1107
1102
  _dataResources: entry.entry._dataResources,
1108
1103
  _id: entry.entry._id,
1104
+ _name: entry.entry._name,
1109
1105
  _slug: entry.entry._slug,
1110
1106
  fields: entry.entry.fields
1111
1107
  },
@@ -2192,10 +2188,50 @@ function subscribeToComposition({
2192
2188
  };
2193
2189
  }
2194
2190
 
2195
- // src/RouteClient.ts
2191
+ // src/PromptClient.ts
2196
2192
  var import_api8 = require("@uniformdev/context/api");
2193
+ var PromptUrl = "/api/v1/prompt";
2194
+ var PromptsUrl = "/api/v1/prompts";
2195
+ var PromptClient = class extends import_api8.ApiClient {
2196
+ constructor(options) {
2197
+ super(options);
2198
+ }
2199
+ /** Fetches all Prompts for a project */
2200
+ async get(options) {
2201
+ const { projectId } = this.options;
2202
+ const fetchUri = this.createUrl(PromptUrl, { ...options, projectId });
2203
+ return await this.apiClient(fetchUri);
2204
+ }
2205
+ /** Fetches all Prompts for a project */
2206
+ async getList(options) {
2207
+ const { projectId } = this.options;
2208
+ const fetchUri = this.createUrl(PromptsUrl, { ...options, projectId });
2209
+ return await this.apiClient(fetchUri);
2210
+ }
2211
+ /** Updates or creates (based on id) a Prompt */
2212
+ async upsert(body) {
2213
+ const fetchUri = this.createUrl(PromptUrl);
2214
+ await this.apiClient(fetchUri, {
2215
+ method: "PUT",
2216
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2217
+ expectNoContent: true
2218
+ });
2219
+ }
2220
+ /** Deletes a Prompt */
2221
+ async remove(body) {
2222
+ const fetchUri = this.createUrl(PromptUrl);
2223
+ await this.apiClient(fetchUri, {
2224
+ method: "DELETE",
2225
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2226
+ expectNoContent: true
2227
+ });
2228
+ }
2229
+ };
2230
+
2231
+ // src/RouteClient.ts
2232
+ var import_api9 = require("@uniformdev/context/api");
2197
2233
  var ROUTE_URL = "/api/v1/route";
2198
- var RouteClient = class extends import_api8.ApiClient {
2234
+ var RouteClient = class extends import_api9.ApiClient {
2199
2235
  constructor(options) {
2200
2236
  var _a;
2201
2237
  if (!options.limitPolicy) {
@@ -2503,8 +2539,8 @@ function handleRichTextNodeBinding(object, options) {
2503
2539
  }
2504
2540
 
2505
2541
  // src/index.ts
2506
- var import_api9 = require("@uniformdev/context/api");
2507
- var CanvasClientError = import_api9.ApiClientError;
2542
+ var import_api10 = require("@uniformdev/context/api");
2543
+ var CanvasClientError = import_api10.ApiClientError;
2508
2544
  // Annotate the CommonJS export names for ESM import in node:
2509
2545
  0 && (module.exports = {
2510
2546
  ATTRIBUTE_COMPONENT_ID,
@@ -2539,11 +2575,8 @@ var CanvasClientError = import_api9.ApiClientError;
2539
2575
  DataTypeClient,
2540
2576
  EDGE_CACHE_DISABLED,
2541
2577
  EDGE_DEFAULT_CACHE_TTL,
2542
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2543
2578
  EDGE_MAX_CACHE_TTL,
2544
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2545
2579
  EDGE_MIN_CACHE_TTL,
2546
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2547
2580
  EMPTY_COMPOSITION,
2548
2581
  EnhancerBuilder,
2549
2582
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2554,6 +2587,7 @@ var CanvasClientError = import_api9.ApiClientError;
2554
2587
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2555
2588
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2556
2589
  PLACEHOLDER_ID,
2590
+ PromptClient,
2557
2591
  RouteClient,
2558
2592
  SECRET_QUERY_STRING_PARAM,
2559
2593
  UncachedCanvasClient,
package/dist/index.mjs CHANGED
@@ -977,13 +977,10 @@ var EMPTY_COMPOSITION = {
977
977
  _name: "An empty composition used for contextual editing",
978
978
  type: "_empty_composition_type"
979
979
  };
980
- var EDGE_MIN_CACHE_TTL = 15;
981
- var EDGE_MAX_CACHE_TTL = 600;
980
+ var EDGE_MIN_CACHE_TTL = 10;
981
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
982
982
  var EDGE_DEFAULT_CACHE_TTL = 30;
983
983
  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
984
 
988
985
  // src/utils/entryConverter.ts
989
986
  function convertEntryToPutEntry(entry) {
@@ -992,6 +989,7 @@ function convertEntryToPutEntry(entry) {
992
989
  type: entry.entry.type,
993
990
  _dataResources: entry.entry._dataResources,
994
991
  _id: entry.entry._id,
992
+ _name: entry.entry._name,
995
993
  _slug: entry.entry._slug,
996
994
  fields: entry.entry.fields
997
995
  },
@@ -2078,10 +2076,50 @@ function subscribeToComposition({
2078
2076
  };
2079
2077
  }
2080
2078
 
2081
- // src/RouteClient.ts
2079
+ // src/PromptClient.ts
2082
2080
  import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
2081
+ var PromptUrl = "/api/v1/prompt";
2082
+ var PromptsUrl = "/api/v1/prompts";
2083
+ var PromptClient = class extends ApiClient7 {
2084
+ constructor(options) {
2085
+ super(options);
2086
+ }
2087
+ /** Fetches all Prompts for a project */
2088
+ async get(options) {
2089
+ const { projectId } = this.options;
2090
+ const fetchUri = this.createUrl(PromptUrl, { ...options, projectId });
2091
+ return await this.apiClient(fetchUri);
2092
+ }
2093
+ /** Fetches all Prompts for a project */
2094
+ async getList(options) {
2095
+ const { projectId } = this.options;
2096
+ const fetchUri = this.createUrl(PromptsUrl, { ...options, projectId });
2097
+ return await this.apiClient(fetchUri);
2098
+ }
2099
+ /** Updates or creates (based on id) a Prompt */
2100
+ async upsert(body) {
2101
+ const fetchUri = this.createUrl(PromptUrl);
2102
+ await this.apiClient(fetchUri, {
2103
+ method: "PUT",
2104
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2105
+ expectNoContent: true
2106
+ });
2107
+ }
2108
+ /** Deletes a Prompt */
2109
+ async remove(body) {
2110
+ const fetchUri = this.createUrl(PromptUrl);
2111
+ await this.apiClient(fetchUri, {
2112
+ method: "DELETE",
2113
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2114
+ expectNoContent: true
2115
+ });
2116
+ }
2117
+ };
2118
+
2119
+ // src/RouteClient.ts
2120
+ import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2083
2121
  var ROUTE_URL = "/api/v1/route";
2084
- var RouteClient = class extends ApiClient7 {
2122
+ var RouteClient = class extends ApiClient8 {
2085
2123
  constructor(options) {
2086
2124
  var _a;
2087
2125
  if (!options.limitPolicy) {
@@ -2424,11 +2462,8 @@ export {
2424
2462
  DataTypeClient,
2425
2463
  EDGE_CACHE_DISABLED,
2426
2464
  EDGE_DEFAULT_CACHE_TTL,
2427
- EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS,
2428
2465
  EDGE_MAX_CACHE_TTL,
2429
- EDGE_MAX_L2_CACHE_TTL_IN_HOURS,
2430
2466
  EDGE_MIN_CACHE_TTL,
2431
- EDGE_MIN_L2_CACHE_TTL_IN_HOURS,
2432
2467
  EMPTY_COMPOSITION,
2433
2468
  EnhancerBuilder,
2434
2469
  IN_CONTEXT_EDITOR_COMPONENT_END_ROLE,
@@ -2439,6 +2474,7 @@ export {
2439
2474
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
2440
2475
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
2441
2476
  PLACEHOLDER_ID,
2477
+ PromptClient,
2442
2478
  RouteClient,
2443
2479
  SECRET_QUERY_STRING_PARAM,
2444
2480
  UncachedCanvasClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.61.1",
3
+ "version": "19.62.1-alpha.9+0d26126b8",
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,7 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/context": "19.61.1",
41
+ "@uniformdev/context": "19.62.1-alpha.9+0d26126b8",
42
42
  "immer": "9.0.21"
43
43
  },
44
44
  "files": [
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "01ed7d10fd66f65c79caa4cf87a22080b3d7942b"
50
+ "gitHead": "0d26126b85eaff4639e87677b802bd8cb5e4a1c4"
51
51
  }