@uniformdev/tms-sdk 20.74.6-alpha.3 → 20.74.7
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.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.esm.js +575 -17
- package/dist/index.js +562 -17
- package/dist/index.mjs +575 -17
- package/package.json +5 -5
package/dist/index.mjs
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,421 @@ 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 UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
940
|
+
var ApiClientError = class _ApiClientError extends Error {
|
|
941
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
942
|
+
super(
|
|
943
|
+
`${errorMessage}
|
|
944
|
+
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
945
|
+
);
|
|
946
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
947
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
948
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
949
|
+
__publicField(this, "statusCode", statusCode);
|
|
950
|
+
__publicField(this, "statusText", statusText);
|
|
951
|
+
__publicField(this, "requestId", requestId);
|
|
952
|
+
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
956
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
957
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
958
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
var ApiClient = class _ApiClient {
|
|
962
|
+
constructor(options) {
|
|
963
|
+
__publicField(this, "options");
|
|
964
|
+
var _a, _b, _c, _d, _e;
|
|
965
|
+
if (!options.apiKey && !options.bearerToken) {
|
|
966
|
+
throw new Error("You must provide an API key or a bearer token");
|
|
967
|
+
}
|
|
968
|
+
let leFetch = options.fetch;
|
|
969
|
+
if (!leFetch) {
|
|
970
|
+
if (typeof window !== "undefined") {
|
|
971
|
+
leFetch = window.fetch.bind(window);
|
|
972
|
+
} else if (typeof fetch !== "undefined") {
|
|
973
|
+
leFetch = fetch;
|
|
974
|
+
} else {
|
|
975
|
+
throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
this.options = {
|
|
979
|
+
...options,
|
|
980
|
+
fetch: leFetch,
|
|
981
|
+
apiHost: this.ensureApiHost(options.apiHost),
|
|
982
|
+
apiKey: (_a = options.apiKey) != null ? _a : null,
|
|
983
|
+
projectId: (_b = options.projectId) != null ? _b : null,
|
|
984
|
+
bearerToken: (_c = options.bearerToken) != null ? _c : null,
|
|
985
|
+
limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
|
|
986
|
+
bypassCache: (_e = options.bypassCache) != null ? _e : false
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
async apiClient(fetchUri, options) {
|
|
990
|
+
return (await this.apiClientWithResponse(fetchUri, options)).body;
|
|
991
|
+
}
|
|
992
|
+
async apiClientWithResponse(fetchUri, options) {
|
|
993
|
+
return this.options.limitPolicy(async () => {
|
|
994
|
+
var _a, _b;
|
|
995
|
+
const coreHeaders = this.options.apiKey ? {
|
|
996
|
+
"x-api-key": this.options.apiKey
|
|
997
|
+
} : {
|
|
998
|
+
Authorization: `Bearer ${this.options.bearerToken}`
|
|
999
|
+
};
|
|
1000
|
+
if (this.options.bypassCache) {
|
|
1001
|
+
coreHeaders["x-bypass-cache"] = "true";
|
|
1002
|
+
}
|
|
1003
|
+
const { fetch: fetch2, signal } = this.options;
|
|
1004
|
+
const callApi = () => fetch2(fetchUri.toString(), {
|
|
1005
|
+
...options,
|
|
1006
|
+
signal,
|
|
1007
|
+
headers: {
|
|
1008
|
+
...options == null ? void 0 : options.headers,
|
|
1009
|
+
...coreHeaders
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
const apiResponse = await handleRateLimits(callApi);
|
|
1013
|
+
if (!apiResponse.ok) {
|
|
1014
|
+
let message = "";
|
|
1015
|
+
try {
|
|
1016
|
+
const responseText = await apiResponse.text();
|
|
1017
|
+
try {
|
|
1018
|
+
const parsed = JSON.parse(responseText);
|
|
1019
|
+
if (parsed.errorMessage) {
|
|
1020
|
+
message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
|
|
1021
|
+
} else {
|
|
1022
|
+
message = responseText;
|
|
1023
|
+
}
|
|
1024
|
+
} catch (e) {
|
|
1025
|
+
message = responseText;
|
|
1026
|
+
}
|
|
1027
|
+
} catch (e) {
|
|
1028
|
+
message = `General error`;
|
|
1029
|
+
}
|
|
1030
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
1031
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
1032
|
+
message,
|
|
1033
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
1034
|
+
fetchUri.toString(),
|
|
1035
|
+
apiResponse.status,
|
|
1036
|
+
apiResponse.statusText,
|
|
1037
|
+
_ApiClient.getRequestId(apiResponse)
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
throw new ApiClientError(
|
|
1041
|
+
message,
|
|
1042
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
1043
|
+
fetchUri.toString(),
|
|
1044
|
+
apiResponse.status,
|
|
1045
|
+
apiResponse.statusText,
|
|
1046
|
+
_ApiClient.getRequestId(apiResponse)
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
if (options == null ? void 0 : options.expectNoContent) {
|
|
1050
|
+
return { response: apiResponse, body: null };
|
|
1051
|
+
}
|
|
1052
|
+
return {
|
|
1053
|
+
response: apiResponse,
|
|
1054
|
+
body: await apiResponse.json()
|
|
1055
|
+
};
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
createUrl(path, queryParams, hostOverride) {
|
|
1059
|
+
const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
|
|
1060
|
+
Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
|
|
1061
|
+
var _a;
|
|
1062
|
+
if (typeof value !== "undefined" && value !== null) {
|
|
1063
|
+
url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
return url;
|
|
1067
|
+
}
|
|
1068
|
+
ensureApiHost(apiHost) {
|
|
1069
|
+
if (!apiHost) return "https://uniform.app";
|
|
1070
|
+
if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
|
|
1071
|
+
throw new Error('Your apiHost must start with "http"');
|
|
1072
|
+
}
|
|
1073
|
+
if (apiHost.indexOf("/", 8) > -1) {
|
|
1074
|
+
throw new Error("Your apiHost must not contain a path element after the domain");
|
|
1075
|
+
}
|
|
1076
|
+
if (apiHost.indexOf("?") > -1) {
|
|
1077
|
+
throw new Error("Your apiHost must not contain a query string");
|
|
1078
|
+
}
|
|
1079
|
+
if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
|
|
1080
|
+
apiHost = apiHost.substring(0, apiHost.length - 1);
|
|
1081
|
+
}
|
|
1082
|
+
return apiHost;
|
|
1083
|
+
}
|
|
1084
|
+
static getRequestId(response) {
|
|
1085
|
+
const apigRequestId = response.headers.get("apigw-requestid");
|
|
1086
|
+
if (apigRequestId) {
|
|
1087
|
+
return apigRequestId;
|
|
1088
|
+
}
|
|
1089
|
+
return void 0;
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
async function handleRateLimits(callApi) {
|
|
1093
|
+
var _a;
|
|
1094
|
+
const backoffRetries = 5;
|
|
1095
|
+
let backoffRetriesLeft = backoffRetries;
|
|
1096
|
+
let response;
|
|
1097
|
+
while (backoffRetriesLeft > 0) {
|
|
1098
|
+
response = await callApi();
|
|
1099
|
+
if (response.status !== 429) {
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
let resetWait = 0;
|
|
1103
|
+
try {
|
|
1104
|
+
const responseClone = response.clone();
|
|
1105
|
+
const dateHeader = responseClone.headers.get("date");
|
|
1106
|
+
const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
|
|
1107
|
+
const body = await responseClone.json();
|
|
1108
|
+
const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
|
|
1109
|
+
if (typeof serverTime === "number" && typeof resetTime === "number") {
|
|
1110
|
+
resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
|
|
1111
|
+
}
|
|
1112
|
+
} catch (e) {
|
|
1113
|
+
}
|
|
1114
|
+
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
1115
|
+
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
1116
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
1117
|
+
backoffRetriesLeft -= 1;
|
|
1118
|
+
}
|
|
1119
|
+
return response;
|
|
1120
|
+
}
|
|
1121
|
+
var _url;
|
|
1122
|
+
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
1123
|
+
constructor(options) {
|
|
1124
|
+
super(options);
|
|
1125
|
+
}
|
|
1126
|
+
/** Fetches all aggregates for a project */
|
|
1127
|
+
async get(options) {
|
|
1128
|
+
const { projectId } = this.options;
|
|
1129
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url), { ...options, projectId });
|
|
1130
|
+
return await this.apiClient(fetchUri);
|
|
1131
|
+
}
|
|
1132
|
+
/** Updates or creates (based on id) an Aggregate */
|
|
1133
|
+
async upsert(body) {
|
|
1134
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
1135
|
+
await this.apiClient(fetchUri, {
|
|
1136
|
+
method: "PUT",
|
|
1137
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1138
|
+
expectNoContent: true
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
/** Deletes an Aggregate */
|
|
1142
|
+
async remove(body) {
|
|
1143
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
1144
|
+
await this.apiClient(fetchUri, {
|
|
1145
|
+
method: "DELETE",
|
|
1146
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1147
|
+
expectNoContent: true
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
_url = /* @__PURE__ */ new WeakMap();
|
|
1152
|
+
__privateAdd(_AggregateClient, _url, "/api/v2/aggregate");
|
|
1153
|
+
var _url2;
|
|
1154
|
+
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
1155
|
+
constructor(options) {
|
|
1156
|
+
super(options);
|
|
1157
|
+
}
|
|
1158
|
+
/** Fetches the known score dimensions for a project */
|
|
1159
|
+
async get(options) {
|
|
1160
|
+
const { projectId } = this.options;
|
|
1161
|
+
const fetchUri = this.createUrl(__privateGet(_DimensionClient2, _url2), { ...options, projectId });
|
|
1162
|
+
return await this.apiClient(fetchUri);
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
_url2 = /* @__PURE__ */ new WeakMap();
|
|
1166
|
+
__privateAdd(_DimensionClient, _url2, "/api/v2/dimension");
|
|
1167
|
+
var _url3;
|
|
1168
|
+
var _valueUrl;
|
|
1169
|
+
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
1170
|
+
constructor(options) {
|
|
1171
|
+
super(options);
|
|
1172
|
+
}
|
|
1173
|
+
/** Fetches all enrichments and values for a project, grouped by category */
|
|
1174
|
+
async get(options) {
|
|
1175
|
+
const { projectId } = this.options;
|
|
1176
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
1177
|
+
return await this.apiClient(fetchUri);
|
|
1178
|
+
}
|
|
1179
|
+
/** Updates or creates (based on id) an enrichment category */
|
|
1180
|
+
async upsertCategory(body) {
|
|
1181
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
1182
|
+
await this.apiClient(fetchUri, {
|
|
1183
|
+
method: "PUT",
|
|
1184
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1185
|
+
expectNoContent: true
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
/** Deletes an enrichment category */
|
|
1189
|
+
async removeCategory(body) {
|
|
1190
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
1191
|
+
await this.apiClient(fetchUri, {
|
|
1192
|
+
method: "DELETE",
|
|
1193
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1194
|
+
expectNoContent: true
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
1198
|
+
async upsertValue(body) {
|
|
1199
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
1200
|
+
await this.apiClient(fetchUri, {
|
|
1201
|
+
method: "PUT",
|
|
1202
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1203
|
+
expectNoContent: true
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
1207
|
+
async removeValue(body) {
|
|
1208
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
1209
|
+
await this.apiClient(fetchUri, {
|
|
1210
|
+
method: "DELETE",
|
|
1211
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1212
|
+
expectNoContent: true
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
_url3 = /* @__PURE__ */ new WeakMap();
|
|
1217
|
+
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
1218
|
+
__privateAdd(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
1219
|
+
__privateAdd(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
1220
|
+
var _url4;
|
|
1221
|
+
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
1222
|
+
constructor(options) {
|
|
1223
|
+
super(options);
|
|
1224
|
+
}
|
|
1225
|
+
/** Fetches the Context manifest for a project */
|
|
1226
|
+
async get(options) {
|
|
1227
|
+
const { projectId } = this.options;
|
|
1228
|
+
const fetchUri = this.createUrl(__privateGet(_ManifestClient2, _url4), { ...options, projectId });
|
|
1229
|
+
return await this.apiClient(fetchUri);
|
|
1230
|
+
}
|
|
1231
|
+
/** Publishes the Context manifest for a project */
|
|
1232
|
+
async publish() {
|
|
1233
|
+
const { projectId } = this.options;
|
|
1234
|
+
const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
|
|
1235
|
+
await this.apiClient(fetchUri, {
|
|
1236
|
+
method: "POST",
|
|
1237
|
+
expectNoContent: true
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
_url4 = /* @__PURE__ */ new WeakMap();
|
|
1242
|
+
__privateAdd(_ManifestClient, _url4, "/api/v2/manifest");
|
|
1243
|
+
var _url5;
|
|
1244
|
+
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
1245
|
+
constructor(options) {
|
|
1246
|
+
super(options);
|
|
1247
|
+
}
|
|
1248
|
+
/** Fetches all Quirks for a project */
|
|
1249
|
+
async get(options) {
|
|
1250
|
+
const { projectId } = this.options;
|
|
1251
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5), { ...options, projectId });
|
|
1252
|
+
return await this.apiClient(fetchUri);
|
|
1253
|
+
}
|
|
1254
|
+
/** Updates or creates (based on id) a Quirk */
|
|
1255
|
+
async upsert(body) {
|
|
1256
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
1257
|
+
await this.apiClient(fetchUri, {
|
|
1258
|
+
method: "PUT",
|
|
1259
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1260
|
+
expectNoContent: true
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
/** Deletes a Quirk */
|
|
1264
|
+
async remove(body) {
|
|
1265
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
1266
|
+
await this.apiClient(fetchUri, {
|
|
1267
|
+
method: "DELETE",
|
|
1268
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1269
|
+
expectNoContent: true
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
_url5 = /* @__PURE__ */ new WeakMap();
|
|
1274
|
+
__privateAdd(_QuirkClient, _url5, "/api/v2/quirk");
|
|
1275
|
+
var _url6;
|
|
1276
|
+
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
1277
|
+
constructor(options) {
|
|
1278
|
+
super(options);
|
|
1279
|
+
}
|
|
1280
|
+
/** Fetches all Signals for a project */
|
|
1281
|
+
async get(options) {
|
|
1282
|
+
const { projectId } = this.options;
|
|
1283
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6), { ...options, projectId });
|
|
1284
|
+
return await this.apiClient(fetchUri);
|
|
1285
|
+
}
|
|
1286
|
+
/** Updates or creates (based on id) a Signal */
|
|
1287
|
+
async upsert(body) {
|
|
1288
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
1289
|
+
await this.apiClient(fetchUri, {
|
|
1290
|
+
method: "PUT",
|
|
1291
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1292
|
+
expectNoContent: true
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
/** Deletes a Signal */
|
|
1296
|
+
async remove(body) {
|
|
1297
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
1298
|
+
await this.apiClient(fetchUri, {
|
|
1299
|
+
method: "DELETE",
|
|
1300
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1301
|
+
expectNoContent: true
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
_url6 = /* @__PURE__ */ new WeakMap();
|
|
1306
|
+
__privateAdd(_SignalClient, _url6, "/api/v2/signal");
|
|
1307
|
+
var _url7;
|
|
1308
|
+
var _TestClient = class _TestClient2 extends ApiClient {
|
|
1309
|
+
constructor(options) {
|
|
1310
|
+
super(options);
|
|
1311
|
+
}
|
|
1312
|
+
/** Fetches all Tests for a project */
|
|
1313
|
+
async get(options) {
|
|
1314
|
+
const { projectId } = this.options;
|
|
1315
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7), { ...options, projectId });
|
|
1316
|
+
return await this.apiClient(fetchUri);
|
|
1317
|
+
}
|
|
1318
|
+
/** Updates or creates (based on id) a Test */
|
|
1319
|
+
async upsert(body) {
|
|
1320
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
1321
|
+
await this.apiClient(fetchUri, {
|
|
1322
|
+
method: "PUT",
|
|
1323
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1324
|
+
expectNoContent: true
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
/** Deletes a Test */
|
|
1328
|
+
async remove(body) {
|
|
1329
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
1330
|
+
await this.apiClient(fetchUri, {
|
|
1331
|
+
method: "DELETE",
|
|
1332
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
1333
|
+
expectNoContent: true
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
_url7 = /* @__PURE__ */ new WeakMap();
|
|
1338
|
+
__privateAdd(_TestClient, _url7, "/api/v2/test");
|
|
1339
|
+
|
|
1340
|
+
// src/getCompositionForTranslation.ts
|
|
782
1341
|
var getCompositionForTranslation = async ({
|
|
783
1342
|
canvasClient,
|
|
784
1343
|
compositionId,
|
|
@@ -788,16 +1347,19 @@ var getCompositionForTranslation = async ({
|
|
|
788
1347
|
if (!compositionId) {
|
|
789
1348
|
return void 0;
|
|
790
1349
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
1350
|
+
try {
|
|
1351
|
+
const composition = await canvasClient.get({
|
|
1352
|
+
compositionId,
|
|
1353
|
+
releaseId: releaseId ? releaseId : void 0,
|
|
1354
|
+
state
|
|
1355
|
+
});
|
|
1356
|
+
return composition ? composition : void 0;
|
|
1357
|
+
} catch (error) {
|
|
1358
|
+
if (error instanceof ApiClientError && error.statusCode === 404) {
|
|
1359
|
+
return void 0;
|
|
1360
|
+
}
|
|
1361
|
+
throw error;
|
|
1362
|
+
}
|
|
801
1363
|
};
|
|
802
1364
|
|
|
803
1365
|
// src/getEntryForTranslation.ts
|
|
@@ -812,14 +1374,10 @@ var getEntryForTranslation = async ({
|
|
|
812
1374
|
if (!entryId) {
|
|
813
1375
|
return void 0;
|
|
814
1376
|
}
|
|
815
|
-
const entriesResponse = await contentClient.
|
|
1377
|
+
const entriesResponse = await contentClient.list({
|
|
816
1378
|
entryIDs: [entryId],
|
|
817
1379
|
releaseId: releaseId ? releaseId : void 0,
|
|
818
1380
|
limit: 1,
|
|
819
|
-
withComponentIDs: true,
|
|
820
|
-
skipDataResolution: true,
|
|
821
|
-
skipOverridesResolution: true,
|
|
822
|
-
skipPatternResolution: true,
|
|
823
1381
|
pattern,
|
|
824
1382
|
state
|
|
825
1383
|
});
|
|
@@ -948,7 +1506,7 @@ var defaultUpdateComposition = async ({
|
|
|
948
1506
|
canvasClient,
|
|
949
1507
|
composition
|
|
950
1508
|
}) => {
|
|
951
|
-
await canvasClient.
|
|
1509
|
+
await canvasClient.save(composition);
|
|
952
1510
|
return true;
|
|
953
1511
|
};
|
|
954
1512
|
|
|
@@ -1076,7 +1634,7 @@ var defaultUpdateEntry = async ({
|
|
|
1076
1634
|
contentClient,
|
|
1077
1635
|
entry
|
|
1078
1636
|
}) => {
|
|
1079
|
-
await contentClient.
|
|
1637
|
+
await contentClient.save(entry);
|
|
1080
1638
|
return true;
|
|
1081
1639
|
};
|
|
1082
1640
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/tms-sdk",
|
|
3
|
-
"version": "20.74.
|
|
3
|
+
"version": "20.74.7",
|
|
4
4
|
"description": "Uniform Translation Management System SDK",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@uniformdev/canvas": "20.74.
|
|
36
|
-
"@uniformdev/mesh-sdk": "20.74.
|
|
37
|
-
"@uniformdev/richtext": "20.74.
|
|
35
|
+
"@uniformdev/canvas": "20.74.7",
|
|
36
|
+
"@uniformdev/mesh-sdk": "20.74.7",
|
|
37
|
+
"@uniformdev/richtext": "20.74.7",
|
|
38
38
|
"dequal": "2.0.3",
|
|
39
39
|
"fast-xml-parser": "4.5.5",
|
|
40
40
|
"immer": "10.2.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "97c2206b4a765c62db9a7d125e2de6b77e982e38"
|
|
43
43
|
}
|