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