@uniformdev/tms-sdk 20.72.2 → 20.72.3-alpha.14

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
@@ -1,3 +1,147 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // ../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js
28
+ var require_yocto_queue = __commonJS({
29
+ "../../node_modules/.pnpm/yocto-queue@0.1.0/node_modules/yocto-queue/index.js"(exports, module) {
30
+ "use strict";
31
+ var Node = class {
32
+ /// value;
33
+ /// next;
34
+ constructor(value) {
35
+ this.value = value;
36
+ this.next = void 0;
37
+ }
38
+ };
39
+ var Queue = class {
40
+ // TODO: Use private class fields when targeting Node.js 12.
41
+ // #_head;
42
+ // #_tail;
43
+ // #_size;
44
+ constructor() {
45
+ this.clear();
46
+ }
47
+ enqueue(value) {
48
+ const node = new Node(value);
49
+ if (this._head) {
50
+ this._tail.next = node;
51
+ this._tail = node;
52
+ } else {
53
+ this._head = node;
54
+ this._tail = node;
55
+ }
56
+ this._size++;
57
+ }
58
+ dequeue() {
59
+ const current = this._head;
60
+ if (!current) {
61
+ return;
62
+ }
63
+ this._head = this._head.next;
64
+ this._size--;
65
+ return current.value;
66
+ }
67
+ clear() {
68
+ this._head = void 0;
69
+ this._tail = void 0;
70
+ this._size = 0;
71
+ }
72
+ get size() {
73
+ return this._size;
74
+ }
75
+ *[Symbol.iterator]() {
76
+ let current = this._head;
77
+ while (current) {
78
+ yield current.value;
79
+ current = current.next;
80
+ }
81
+ }
82
+ };
83
+ module.exports = Queue;
84
+ }
85
+ });
86
+
87
+ // ../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js
88
+ var require_p_limit = __commonJS({
89
+ "../../node_modules/.pnpm/p-limit@3.1.0/node_modules/p-limit/index.js"(exports, module) {
90
+ "use strict";
91
+ var Queue = require_yocto_queue();
92
+ var pLimit2 = (concurrency) => {
93
+ if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
94
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
95
+ }
96
+ const queue = new Queue();
97
+ let activeCount = 0;
98
+ const next = () => {
99
+ activeCount--;
100
+ if (queue.size > 0) {
101
+ queue.dequeue()();
102
+ }
103
+ };
104
+ const run = async (fn, resolve, ...args) => {
105
+ activeCount++;
106
+ const result = (async () => fn(...args))();
107
+ resolve(result);
108
+ try {
109
+ await result;
110
+ } catch (e) {
111
+ }
112
+ next();
113
+ };
114
+ const enqueue = (fn, resolve, ...args) => {
115
+ queue.enqueue(run.bind(null, fn, resolve, ...args));
116
+ (async () => {
117
+ await Promise.resolve();
118
+ if (activeCount < concurrency && queue.size > 0) {
119
+ queue.dequeue()();
120
+ }
121
+ })();
122
+ };
123
+ const generator = (fn, ...args) => new Promise((resolve) => {
124
+ enqueue(fn, resolve, ...args);
125
+ });
126
+ Object.defineProperties(generator, {
127
+ activeCount: {
128
+ get: () => activeCount
129
+ },
130
+ pendingCount: {
131
+ get: () => queue.size
132
+ },
133
+ clearQueue: {
134
+ value: () => {
135
+ queue.clear();
136
+ }
137
+ }
138
+ });
139
+ return generator;
140
+ };
141
+ module.exports = pLimit2;
142
+ }
143
+ });
144
+
1
145
  // src/collectTranslationPayload.ts
2
146
  import {
3
147
  bindVariables,
@@ -779,6 +923,404 @@ var preprocessTargetValue = (parameter, value) => {
779
923
 
780
924
  // src/getCompositionForTranslation.ts
781
925
  import { CANVAS_DRAFT_STATE } from "@uniformdev/canvas";
926
+
927
+ // ../context/dist/api/api.mjs
928
+ var import_p_limit = __toESM(require_p_limit(), 1);
929
+ var __defProp2 = Object.defineProperty;
930
+ var __typeError = (msg) => {
931
+ throw TypeError(msg);
932
+ };
933
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
934
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
935
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
936
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
937
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
938
+ var defaultLimitPolicy = (0, import_p_limit.default)(6);
939
+ var ApiClientError = class _ApiClientError extends Error {
940
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
941
+ super(
942
+ `${errorMessage}
943
+ ${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
944
+ );
945
+ __publicField(this, "errorMessage", errorMessage);
946
+ __publicField(this, "fetchMethod", fetchMethod);
947
+ __publicField(this, "fetchUri", fetchUri);
948
+ __publicField(this, "statusCode", statusCode);
949
+ __publicField(this, "statusText", statusText);
950
+ __publicField(this, "requestId", requestId);
951
+ Object.setPrototypeOf(this, _ApiClientError.prototype);
952
+ }
953
+ };
954
+ var ApiClient = class _ApiClient {
955
+ constructor(options) {
956
+ __publicField(this, "options");
957
+ var _a, _b, _c, _d, _e;
958
+ if (!options.apiKey && !options.bearerToken) {
959
+ throw new Error("You must provide an API key or a bearer token");
960
+ }
961
+ let leFetch = options.fetch;
962
+ if (!leFetch) {
963
+ if (typeof window !== "undefined") {
964
+ leFetch = window.fetch.bind(window);
965
+ } else if (typeof fetch !== "undefined") {
966
+ leFetch = fetch;
967
+ } else {
968
+ throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
969
+ }
970
+ }
971
+ this.options = {
972
+ ...options,
973
+ fetch: leFetch,
974
+ apiHost: this.ensureApiHost(options.apiHost),
975
+ apiKey: (_a = options.apiKey) != null ? _a : null,
976
+ projectId: (_b = options.projectId) != null ? _b : null,
977
+ bearerToken: (_c = options.bearerToken) != null ? _c : null,
978
+ limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
979
+ bypassCache: (_e = options.bypassCache) != null ? _e : false
980
+ };
981
+ }
982
+ async apiClient(fetchUri, options) {
983
+ return (await this.apiClientWithResponse(fetchUri, options)).body;
984
+ }
985
+ async apiClientWithResponse(fetchUri, options) {
986
+ return this.options.limitPolicy(async () => {
987
+ var _a;
988
+ const coreHeaders = this.options.apiKey ? {
989
+ "x-api-key": this.options.apiKey
990
+ } : {
991
+ Authorization: `Bearer ${this.options.bearerToken}`
992
+ };
993
+ if (this.options.bypassCache) {
994
+ coreHeaders["x-bypass-cache"] = "true";
995
+ }
996
+ const { fetch: fetch2, signal } = this.options;
997
+ const callApi = () => fetch2(fetchUri.toString(), {
998
+ ...options,
999
+ signal,
1000
+ headers: {
1001
+ ...options == null ? void 0 : options.headers,
1002
+ ...coreHeaders
1003
+ }
1004
+ });
1005
+ const apiResponse = await handleRateLimits(callApi);
1006
+ if (!apiResponse.ok) {
1007
+ let message = "";
1008
+ try {
1009
+ const responseText = await apiResponse.text();
1010
+ try {
1011
+ const parsed = JSON.parse(responseText);
1012
+ if (parsed.errorMessage) {
1013
+ message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
1014
+ } else {
1015
+ message = responseText;
1016
+ }
1017
+ } catch (e) {
1018
+ message = responseText;
1019
+ }
1020
+ } catch (e) {
1021
+ message = `General error`;
1022
+ }
1023
+ throw new ApiClientError(
1024
+ message,
1025
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
1026
+ fetchUri.toString(),
1027
+ apiResponse.status,
1028
+ apiResponse.statusText,
1029
+ _ApiClient.getRequestId(apiResponse)
1030
+ );
1031
+ }
1032
+ if (options == null ? void 0 : options.expectNoContent) {
1033
+ return { response: apiResponse, body: null };
1034
+ }
1035
+ return {
1036
+ response: apiResponse,
1037
+ body: await apiResponse.json()
1038
+ };
1039
+ });
1040
+ }
1041
+ createUrl(path, queryParams, hostOverride) {
1042
+ const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
1043
+ Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
1044
+ var _a;
1045
+ if (typeof value !== "undefined" && value !== null) {
1046
+ url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
1047
+ }
1048
+ });
1049
+ return url;
1050
+ }
1051
+ ensureApiHost(apiHost) {
1052
+ if (!apiHost) return "https://uniform.app";
1053
+ if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
1054
+ throw new Error('Your apiHost must start with "http"');
1055
+ }
1056
+ if (apiHost.indexOf("/", 8) > -1) {
1057
+ throw new Error("Your apiHost must not contain a path element after the domain");
1058
+ }
1059
+ if (apiHost.indexOf("?") > -1) {
1060
+ throw new Error("Your apiHost must not contain a query string");
1061
+ }
1062
+ if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
1063
+ apiHost = apiHost.substring(0, apiHost.length - 1);
1064
+ }
1065
+ return apiHost;
1066
+ }
1067
+ static getRequestId(response) {
1068
+ const apigRequestId = response.headers.get("apigw-requestid");
1069
+ if (apigRequestId) {
1070
+ return apigRequestId;
1071
+ }
1072
+ return void 0;
1073
+ }
1074
+ };
1075
+ async function handleRateLimits(callApi) {
1076
+ var _a;
1077
+ const backoffRetries = 5;
1078
+ let backoffRetriesLeft = backoffRetries;
1079
+ let response;
1080
+ while (backoffRetriesLeft > 0) {
1081
+ response = await callApi();
1082
+ if (response.status !== 429) {
1083
+ break;
1084
+ }
1085
+ let resetWait = 0;
1086
+ try {
1087
+ const responseClone = response.clone();
1088
+ const dateHeader = responseClone.headers.get("date");
1089
+ const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
1090
+ const body = await responseClone.json();
1091
+ const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
1092
+ if (typeof serverTime === "number" && typeof resetTime === "number") {
1093
+ resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
1094
+ }
1095
+ } catch (e) {
1096
+ }
1097
+ const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
1098
+ const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
1099
+ await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
1100
+ backoffRetriesLeft -= 1;
1101
+ }
1102
+ return response;
1103
+ }
1104
+ var _url;
1105
+ var _AggregateClient = class _AggregateClient2 extends ApiClient {
1106
+ constructor(options) {
1107
+ super(options);
1108
+ }
1109
+ /** Fetches all aggregates for a project */
1110
+ async get(options) {
1111
+ const { projectId } = this.options;
1112
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url), { ...options, projectId });
1113
+ return await this.apiClient(fetchUri);
1114
+ }
1115
+ /** Updates or creates (based on id) an Aggregate */
1116
+ async upsert(body) {
1117
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
1118
+ await this.apiClient(fetchUri, {
1119
+ method: "PUT",
1120
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1121
+ expectNoContent: true
1122
+ });
1123
+ }
1124
+ /** Deletes an Aggregate */
1125
+ async remove(body) {
1126
+ const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
1127
+ await this.apiClient(fetchUri, {
1128
+ method: "DELETE",
1129
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1130
+ expectNoContent: true
1131
+ });
1132
+ }
1133
+ };
1134
+ _url = /* @__PURE__ */ new WeakMap();
1135
+ __privateAdd(_AggregateClient, _url, "/api/v2/aggregate");
1136
+ var _url2;
1137
+ var _DimensionClient = class _DimensionClient2 extends ApiClient {
1138
+ constructor(options) {
1139
+ super(options);
1140
+ }
1141
+ /** Fetches the known score dimensions for a project */
1142
+ async get(options) {
1143
+ const { projectId } = this.options;
1144
+ const fetchUri = this.createUrl(__privateGet(_DimensionClient2, _url2), { ...options, projectId });
1145
+ return await this.apiClient(fetchUri);
1146
+ }
1147
+ };
1148
+ _url2 = /* @__PURE__ */ new WeakMap();
1149
+ __privateAdd(_DimensionClient, _url2, "/api/v2/dimension");
1150
+ var _url3;
1151
+ var _valueUrl;
1152
+ var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
1153
+ constructor(options) {
1154
+ super(options);
1155
+ }
1156
+ /** Fetches all enrichments and values for a project, grouped by category */
1157
+ async get(options) {
1158
+ const { projectId } = this.options;
1159
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3), { ...options, projectId });
1160
+ return await this.apiClient(fetchUri);
1161
+ }
1162
+ /** Updates or creates (based on id) an enrichment category */
1163
+ async upsertCategory(body) {
1164
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
1165
+ await this.apiClient(fetchUri, {
1166
+ method: "PUT",
1167
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1168
+ expectNoContent: true
1169
+ });
1170
+ }
1171
+ /** Deletes an enrichment category */
1172
+ async removeCategory(body) {
1173
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
1174
+ await this.apiClient(fetchUri, {
1175
+ method: "DELETE",
1176
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1177
+ expectNoContent: true
1178
+ });
1179
+ }
1180
+ /** Updates or creates (based on id) an enrichment value within an enrichment category */
1181
+ async upsertValue(body) {
1182
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
1183
+ await this.apiClient(fetchUri, {
1184
+ method: "PUT",
1185
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1186
+ expectNoContent: true
1187
+ });
1188
+ }
1189
+ /** Deletes an enrichment value within an enrichment category. The category is left alone. */
1190
+ async removeValue(body) {
1191
+ const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
1192
+ await this.apiClient(fetchUri, {
1193
+ method: "DELETE",
1194
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1195
+ expectNoContent: true
1196
+ });
1197
+ }
1198
+ };
1199
+ _url3 = /* @__PURE__ */ new WeakMap();
1200
+ _valueUrl = /* @__PURE__ */ new WeakMap();
1201
+ __privateAdd(_EnrichmentClient, _url3, "/api/v1/enrichments");
1202
+ __privateAdd(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
1203
+ var _url4;
1204
+ var _ManifestClient = class _ManifestClient2 extends ApiClient {
1205
+ constructor(options) {
1206
+ super(options);
1207
+ }
1208
+ /** Fetches the Context manifest for a project */
1209
+ async get(options) {
1210
+ const { projectId } = this.options;
1211
+ const fetchUri = this.createUrl(__privateGet(_ManifestClient2, _url4), { ...options, projectId });
1212
+ return await this.apiClient(fetchUri);
1213
+ }
1214
+ /** Publishes the Context manifest for a project */
1215
+ async publish() {
1216
+ const { projectId } = this.options;
1217
+ const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
1218
+ await this.apiClient(fetchUri, {
1219
+ method: "POST",
1220
+ expectNoContent: true
1221
+ });
1222
+ }
1223
+ };
1224
+ _url4 = /* @__PURE__ */ new WeakMap();
1225
+ __privateAdd(_ManifestClient, _url4, "/api/v2/manifest");
1226
+ var _url5;
1227
+ var _QuirkClient = class _QuirkClient2 extends ApiClient {
1228
+ constructor(options) {
1229
+ super(options);
1230
+ }
1231
+ /** Fetches all Quirks for a project */
1232
+ async get(options) {
1233
+ const { projectId } = this.options;
1234
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5), { ...options, projectId });
1235
+ return await this.apiClient(fetchUri);
1236
+ }
1237
+ /** Updates or creates (based on id) a Quirk */
1238
+ async upsert(body) {
1239
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
1240
+ await this.apiClient(fetchUri, {
1241
+ method: "PUT",
1242
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1243
+ expectNoContent: true
1244
+ });
1245
+ }
1246
+ /** Deletes a Quirk */
1247
+ async remove(body) {
1248
+ const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
1249
+ await this.apiClient(fetchUri, {
1250
+ method: "DELETE",
1251
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1252
+ expectNoContent: true
1253
+ });
1254
+ }
1255
+ };
1256
+ _url5 = /* @__PURE__ */ new WeakMap();
1257
+ __privateAdd(_QuirkClient, _url5, "/api/v2/quirk");
1258
+ var _url6;
1259
+ var _SignalClient = class _SignalClient2 extends ApiClient {
1260
+ constructor(options) {
1261
+ super(options);
1262
+ }
1263
+ /** Fetches all Signals for a project */
1264
+ async get(options) {
1265
+ const { projectId } = this.options;
1266
+ const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6), { ...options, projectId });
1267
+ return await this.apiClient(fetchUri);
1268
+ }
1269
+ /** Updates or creates (based on id) a Signal */
1270
+ async upsert(body) {
1271
+ const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
1272
+ await this.apiClient(fetchUri, {
1273
+ method: "PUT",
1274
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1275
+ expectNoContent: true
1276
+ });
1277
+ }
1278
+ /** Deletes a Signal */
1279
+ async remove(body) {
1280
+ const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
1281
+ await this.apiClient(fetchUri, {
1282
+ method: "DELETE",
1283
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1284
+ expectNoContent: true
1285
+ });
1286
+ }
1287
+ };
1288
+ _url6 = /* @__PURE__ */ new WeakMap();
1289
+ __privateAdd(_SignalClient, _url6, "/api/v2/signal");
1290
+ var _url7;
1291
+ var _TestClient = class _TestClient2 extends ApiClient {
1292
+ constructor(options) {
1293
+ super(options);
1294
+ }
1295
+ /** Fetches all Tests for a project */
1296
+ async get(options) {
1297
+ const { projectId } = this.options;
1298
+ const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7), { ...options, projectId });
1299
+ return await this.apiClient(fetchUri);
1300
+ }
1301
+ /** Updates or creates (based on id) a Test */
1302
+ async upsert(body) {
1303
+ const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
1304
+ await this.apiClient(fetchUri, {
1305
+ method: "PUT",
1306
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1307
+ expectNoContent: true
1308
+ });
1309
+ }
1310
+ /** Deletes a Test */
1311
+ async remove(body) {
1312
+ const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
1313
+ await this.apiClient(fetchUri, {
1314
+ method: "DELETE",
1315
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1316
+ expectNoContent: true
1317
+ });
1318
+ }
1319
+ };
1320
+ _url7 = /* @__PURE__ */ new WeakMap();
1321
+ __privateAdd(_TestClient, _url7, "/api/v2/test");
1322
+
1323
+ // src/getCompositionForTranslation.ts
782
1324
  var getCompositionForTranslation = async ({
783
1325
  canvasClient,
784
1326
  compositionId,
@@ -788,16 +1330,19 @@ var getCompositionForTranslation = async ({
788
1330
  if (!compositionId) {
789
1331
  return void 0;
790
1332
  }
791
- const composition = await canvasClient.getCompositionById({
792
- compositionId,
793
- releaseId: releaseId ? releaseId : void 0,
794
- withComponentIDs: true,
795
- skipDataResolution: true,
796
- skipOverridesResolution: true,
797
- skipPatternResolution: true,
798
- state
799
- });
800
- return composition ? composition : void 0;
1333
+ try {
1334
+ const composition = await canvasClient.get({
1335
+ compositionId,
1336
+ releaseId: releaseId ? releaseId : void 0,
1337
+ state
1338
+ });
1339
+ return composition ? composition : void 0;
1340
+ } catch (error) {
1341
+ if (error instanceof ApiClientError && error.statusCode === 404) {
1342
+ return void 0;
1343
+ }
1344
+ throw error;
1345
+ }
801
1346
  };
802
1347
 
803
1348
  // src/getEntryForTranslation.ts
@@ -812,14 +1357,10 @@ var getEntryForTranslation = async ({
812
1357
  if (!entryId) {
813
1358
  return void 0;
814
1359
  }
815
- const entriesResponse = await contentClient.getEntries({
1360
+ const entriesResponse = await contentClient.list({
816
1361
  entryIDs: [entryId],
817
1362
  releaseId: releaseId ? releaseId : void 0,
818
1363
  limit: 1,
819
- withComponentIDs: true,
820
- skipDataResolution: true,
821
- skipOverridesResolution: true,
822
- skipPatternResolution: true,
823
1364
  pattern,
824
1365
  state
825
1366
  });
@@ -948,7 +1489,7 @@ var defaultUpdateComposition = async ({
948
1489
  canvasClient,
949
1490
  composition
950
1491
  }) => {
951
- await canvasClient.updateComposition(composition);
1492
+ await canvasClient.save(composition);
952
1493
  return true;
953
1494
  };
954
1495
 
@@ -1076,7 +1617,7 @@ var defaultUpdateEntry = async ({
1076
1617
  contentClient,
1077
1618
  entry
1078
1619
  }) => {
1079
- await contentClient.upsertEntry(entry);
1620
+ await contentClient.save(entry);
1080
1621
  return true;
1081
1622
  };
1082
1623