@uniformdev/next-app-router 20.81.1-alpha.4.sha-de16ebeee7 → 20.81.1
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/{UniformComposition-T7CRvU1H.d.ts → UniformComposition-DBO-oo7J.d.ts} +8 -2
- package/dist/{UniformComposition-fq7Qfhvp.d.mts → UniformComposition-le6UEB_r.d.mts} +8 -2
- package/dist/cache.d.mts +3 -1
- package/dist/cache.d.ts +3 -1
- package/dist/cache.js +811 -127
- package/dist/cache.mjs +810 -126
- package/dist/client-BElN_CWD.d.mts +786 -0
- package/dist/client-BElN_CWD.d.ts +786 -0
- package/dist/compat.d.mts +4 -2
- package/dist/compat.d.ts +4 -2
- package/dist/component.d.mts +1 -10
- package/dist/component.d.ts +1 -10
- package/dist/component.js +617 -113
- package/dist/component.mjs +640 -112
- package/dist/config/default.js +1 -0
- package/dist/config/default.mjs +1 -0
- package/dist/handler.js +616 -87
- package/dist/handler.mjs +614 -85
- package/dist/index.d.mts +36 -15
- package/dist/index.d.ts +36 -15
- package/dist/index.esm.js +5825 -2175
- package/dist/index.js +5839 -2189
- package/dist/index.mjs +5825 -2175
- package/dist/middleware.d.mts +13 -52
- package/dist/middleware.d.ts +13 -52
- package/dist/middleware.js +5741 -405
- package/dist/middleware.mjs +5774 -415
- package/dist/resolveRouteFromCode-BOvjIvM2.d.ts +18 -0
- package/dist/resolveRouteFromCode-CuJ4JHeb.d.mts +18 -0
- package/package.json +9 -24
- package/dist/edge.d.mts +0 -44
- package/dist/edge.d.ts +0 -44
- package/dist/edge.js +0 -751
- package/dist/edge.mjs +0 -720
- package/dist/resolveRouteFromCode-CId7aItt.d.mts +0 -48
- package/dist/resolveRouteFromCode-CId7aItt.d.ts +0 -48
package/dist/component.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/components/getUniformSlot.ts
|
|
2
146
|
var getUniformSlot = ({ slot, children }) => {
|
|
3
147
|
const resolved = [];
|
|
@@ -22,21 +166,6 @@ var getUniformSlot = ({ slot, children }) => {
|
|
|
22
166
|
return resolved.length > 0 ? resolved : void 0;
|
|
23
167
|
};
|
|
24
168
|
|
|
25
|
-
// src/components/UniformEdgeState.tsx
|
|
26
|
-
import { SERVER_STATE_ID } from "@uniformdev/context";
|
|
27
|
-
import React from "react";
|
|
28
|
-
function UniformEdgeState() {
|
|
29
|
-
return /* @__PURE__ */ React.createElement(
|
|
30
|
-
"script",
|
|
31
|
-
{
|
|
32
|
-
id: SERVER_STATE_ID,
|
|
33
|
-
type: "application/json",
|
|
34
|
-
dangerouslySetInnerHTML: { __html: "" },
|
|
35
|
-
suppressHydrationWarning: true
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
169
|
// src/components/UniformSlot.tsx
|
|
41
170
|
var UniformSlot = ({ slot, children }) => {
|
|
42
171
|
const resolved = [];
|
|
@@ -69,40 +198,440 @@ import {
|
|
|
69
198
|
useUniformContext
|
|
70
199
|
} from "@uniformdev/next-app-router-client";
|
|
71
200
|
|
|
72
|
-
// ../
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
|
76
|
-
import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
|
|
77
|
-
import { rewriteFiltersForApi } from "@uniformdev/context/api";
|
|
78
|
-
import { rewriteFiltersForApi as rewriteFiltersForApi2 } from "@uniformdev/context/api";
|
|
79
|
-
import { ApiClientError as ApiClientError3 } from "@uniformdev/context/api";
|
|
80
|
-
import { rewriteFiltersForApi as rewriteFiltersForApi3 } from "@uniformdev/context/api";
|
|
81
|
-
import { ApiClientError as ApiClientError4 } from "@uniformdev/context/api";
|
|
82
|
-
import { rewriteFiltersForApi as rewriteFiltersForApi4 } from "@uniformdev/context/api";
|
|
83
|
-
import { ApiClient as ApiClient3, rewriteFiltersForApi as rewriteFiltersForApi5 } from "@uniformdev/context/api";
|
|
84
|
-
import { ApiClient as ApiClient4, rewriteFiltersForApi as rewriteFiltersForApi6 } from "@uniformdev/context/api";
|
|
85
|
-
import { ApiClient as ApiClient5 } from "@uniformdev/context/api";
|
|
86
|
-
import { ApiClient as ApiClient6 } from "@uniformdev/context/api";
|
|
87
|
-
import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
|
|
88
|
-
import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
|
|
89
|
-
import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
|
|
90
|
-
import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
|
|
91
|
-
import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
|
|
92
|
-
import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
|
|
93
|
-
import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
|
|
94
|
-
import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
|
|
95
|
-
import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
|
|
96
|
-
import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
|
|
97
|
-
import { ApiClient as ApiClient17 } from "@uniformdev/context/api";
|
|
98
|
-
import { ApiClientError as ApiClientError5 } from "@uniformdev/context/api";
|
|
99
|
-
import { ApiClient as ApiClient18 } from "@uniformdev/context/api";
|
|
201
|
+
// ../context/dist/api/api.mjs
|
|
202
|
+
var import_p_limit = __toESM(require_p_limit(), 1);
|
|
203
|
+
var __defProp2 = Object.defineProperty;
|
|
100
204
|
var __typeError = (msg) => {
|
|
101
205
|
throw TypeError(msg);
|
|
102
206
|
};
|
|
207
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
208
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
103
209
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
104
210
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
105
211
|
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);
|
|
212
|
+
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
213
|
+
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
214
|
+
var ApiClientError = class _ApiClientError extends Error {
|
|
215
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
216
|
+
super(
|
|
217
|
+
`${errorMessage}
|
|
218
|
+
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri}${requestId ? ` Request ID: ${requestId}` : ""})`
|
|
219
|
+
);
|
|
220
|
+
__publicField(this, "errorMessage", errorMessage);
|
|
221
|
+
__publicField(this, "fetchMethod", fetchMethod);
|
|
222
|
+
__publicField(this, "fetchUri", fetchUri);
|
|
223
|
+
__publicField(this, "statusCode", statusCode);
|
|
224
|
+
__publicField(this, "statusText", statusText);
|
|
225
|
+
__publicField(this, "requestId", requestId);
|
|
226
|
+
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
230
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
231
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
232
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
var ApiClient = class _ApiClient {
|
|
236
|
+
constructor(options) {
|
|
237
|
+
__publicField(this, "options");
|
|
238
|
+
var _a, _b, _c, _d, _e;
|
|
239
|
+
if (!options.apiKey && !options.bearerToken) {
|
|
240
|
+
throw new Error("You must provide an API key or a bearer token");
|
|
241
|
+
}
|
|
242
|
+
let leFetch = options.fetch;
|
|
243
|
+
if (!leFetch) {
|
|
244
|
+
if (typeof window !== "undefined") {
|
|
245
|
+
leFetch = window.fetch.bind(window);
|
|
246
|
+
} else if (typeof fetch !== "undefined") {
|
|
247
|
+
leFetch = fetch;
|
|
248
|
+
} else {
|
|
249
|
+
throw new Error("You must provide or polyfill a fetch implementation when not in a browser");
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
this.options = {
|
|
253
|
+
...options,
|
|
254
|
+
fetch: leFetch,
|
|
255
|
+
apiHost: this.ensureApiHost(options.apiHost),
|
|
256
|
+
apiKey: (_a = options.apiKey) != null ? _a : null,
|
|
257
|
+
projectId: (_b = options.projectId) != null ? _b : null,
|
|
258
|
+
bearerToken: (_c = options.bearerToken) != null ? _c : null,
|
|
259
|
+
limitPolicy: (_d = options.limitPolicy) != null ? _d : defaultLimitPolicy,
|
|
260
|
+
bypassCache: (_e = options.bypassCache) != null ? _e : false
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
async apiClient(fetchUri, options) {
|
|
264
|
+
return (await this.apiClientWithResponse(fetchUri, options)).body;
|
|
265
|
+
}
|
|
266
|
+
async apiClientWithResponse(fetchUri, options) {
|
|
267
|
+
return this.options.limitPolicy(async () => {
|
|
268
|
+
var _a, _b;
|
|
269
|
+
const coreHeaders = this.options.apiKey ? {
|
|
270
|
+
"x-api-key": this.options.apiKey
|
|
271
|
+
} : {
|
|
272
|
+
Authorization: `Bearer ${this.options.bearerToken}`
|
|
273
|
+
};
|
|
274
|
+
if (this.options.bypassCache) {
|
|
275
|
+
coreHeaders["x-bypass-cache"] = "true";
|
|
276
|
+
}
|
|
277
|
+
const { fetch: fetch2, signal } = this.options;
|
|
278
|
+
const callApi = () => fetch2(fetchUri.toString(), {
|
|
279
|
+
...options,
|
|
280
|
+
signal,
|
|
281
|
+
headers: {
|
|
282
|
+
...options == null ? void 0 : options.headers,
|
|
283
|
+
...coreHeaders
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
const apiResponse = await handleRateLimits(callApi);
|
|
287
|
+
if (!apiResponse.ok) {
|
|
288
|
+
let message = "";
|
|
289
|
+
try {
|
|
290
|
+
const responseText = await apiResponse.text();
|
|
291
|
+
try {
|
|
292
|
+
const parsed = JSON.parse(responseText);
|
|
293
|
+
if (parsed.errorMessage) {
|
|
294
|
+
message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
|
|
295
|
+
} else {
|
|
296
|
+
message = responseText;
|
|
297
|
+
}
|
|
298
|
+
} catch (e) {
|
|
299
|
+
message = responseText;
|
|
300
|
+
}
|
|
301
|
+
} catch (e) {
|
|
302
|
+
message = `General error`;
|
|
303
|
+
}
|
|
304
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
305
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
306
|
+
message,
|
|
307
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
308
|
+
fetchUri.toString(),
|
|
309
|
+
apiResponse.status,
|
|
310
|
+
apiResponse.statusText,
|
|
311
|
+
_ApiClient.getRequestId(apiResponse)
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
throw new ApiClientError(
|
|
315
|
+
message,
|
|
316
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
317
|
+
fetchUri.toString(),
|
|
318
|
+
apiResponse.status,
|
|
319
|
+
apiResponse.statusText,
|
|
320
|
+
_ApiClient.getRequestId(apiResponse)
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
if (options == null ? void 0 : options.expectNoContent) {
|
|
324
|
+
return { response: apiResponse, body: null };
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
response: apiResponse,
|
|
328
|
+
body: await apiResponse.json()
|
|
329
|
+
};
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
createUrl(path, queryParams, hostOverride) {
|
|
333
|
+
const url = new URL(`${hostOverride != null ? hostOverride : this.options.apiHost}${path}`);
|
|
334
|
+
Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
|
|
335
|
+
var _a;
|
|
336
|
+
if (typeof value !== "undefined" && value !== null) {
|
|
337
|
+
url.searchParams.append(key, Array.isArray(value) ? value.join(",") : (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
return url;
|
|
341
|
+
}
|
|
342
|
+
ensureApiHost(apiHost) {
|
|
343
|
+
if (!apiHost) return "https://uniform.app";
|
|
344
|
+
if (!(apiHost == null ? void 0 : apiHost.startsWith("http"))) {
|
|
345
|
+
throw new Error('Your apiHost must start with "http"');
|
|
346
|
+
}
|
|
347
|
+
if (apiHost.indexOf("/", 8) > -1) {
|
|
348
|
+
throw new Error("Your apiHost must not contain a path element after the domain");
|
|
349
|
+
}
|
|
350
|
+
if (apiHost.indexOf("?") > -1) {
|
|
351
|
+
throw new Error("Your apiHost must not contain a query string");
|
|
352
|
+
}
|
|
353
|
+
if (apiHost == null ? void 0 : apiHost.endsWith("/")) {
|
|
354
|
+
apiHost = apiHost.substring(0, apiHost.length - 1);
|
|
355
|
+
}
|
|
356
|
+
return apiHost;
|
|
357
|
+
}
|
|
358
|
+
static getRequestId(response) {
|
|
359
|
+
const apigRequestId = response.headers.get("apigw-requestid");
|
|
360
|
+
if (apigRequestId) {
|
|
361
|
+
return apigRequestId;
|
|
362
|
+
}
|
|
363
|
+
return void 0;
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
async function handleRateLimits(callApi) {
|
|
367
|
+
var _a;
|
|
368
|
+
const backoffRetries = 5;
|
|
369
|
+
let backoffRetriesLeft = backoffRetries;
|
|
370
|
+
let response;
|
|
371
|
+
while (backoffRetriesLeft > 0) {
|
|
372
|
+
response = await callApi();
|
|
373
|
+
if (response.status !== 429) {
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
let resetWait = 0;
|
|
377
|
+
try {
|
|
378
|
+
const responseClone = response.clone();
|
|
379
|
+
const dateHeader = responseClone.headers.get("date");
|
|
380
|
+
const serverTime = dateHeader ? new Date(dateHeader).getTime() : void 0;
|
|
381
|
+
const body = await responseClone.json();
|
|
382
|
+
const resetTime = (_a = body == null ? void 0 : body.info) == null ? void 0 : _a.reset;
|
|
383
|
+
if (typeof serverTime === "number" && typeof resetTime === "number") {
|
|
384
|
+
resetWait = Math.max(0, Math.min(Math.round(1.1 * (resetTime - serverTime)), 1e4));
|
|
385
|
+
}
|
|
386
|
+
} catch (e) {
|
|
387
|
+
}
|
|
388
|
+
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
389
|
+
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
390
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
391
|
+
backoffRetriesLeft -= 1;
|
|
392
|
+
}
|
|
393
|
+
return response;
|
|
394
|
+
}
|
|
395
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
396
|
+
function rewriteFiltersForApi(filters) {
|
|
397
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
398
|
+
(acc, [key, value]) => {
|
|
399
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
400
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
401
|
+
return {
|
|
402
|
+
...acc,
|
|
403
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
404
|
+
};
|
|
405
|
+
},
|
|
406
|
+
{}
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
var _url;
|
|
410
|
+
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
411
|
+
constructor(options) {
|
|
412
|
+
super(options);
|
|
413
|
+
}
|
|
414
|
+
/** Fetches all aggregates for a project */
|
|
415
|
+
async get(options) {
|
|
416
|
+
const { projectId } = this.options;
|
|
417
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url), { ...options, projectId });
|
|
418
|
+
return await this.apiClient(fetchUri);
|
|
419
|
+
}
|
|
420
|
+
/** Updates or creates (based on id) an Aggregate */
|
|
421
|
+
async upsert(body) {
|
|
422
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
423
|
+
await this.apiClient(fetchUri, {
|
|
424
|
+
method: "PUT",
|
|
425
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
426
|
+
expectNoContent: true
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
/** Deletes an Aggregate */
|
|
430
|
+
async remove(body) {
|
|
431
|
+
const fetchUri = this.createUrl(__privateGet(_AggregateClient2, _url));
|
|
432
|
+
await this.apiClient(fetchUri, {
|
|
433
|
+
method: "DELETE",
|
|
434
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
435
|
+
expectNoContent: true
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
_url = /* @__PURE__ */ new WeakMap();
|
|
440
|
+
__privateAdd(_AggregateClient, _url, "/api/v2/aggregate");
|
|
441
|
+
var _url2;
|
|
442
|
+
var _DimensionClient = class _DimensionClient2 extends ApiClient {
|
|
443
|
+
constructor(options) {
|
|
444
|
+
super(options);
|
|
445
|
+
}
|
|
446
|
+
/** Fetches the known score dimensions for a project */
|
|
447
|
+
async get(options) {
|
|
448
|
+
const { projectId } = this.options;
|
|
449
|
+
const fetchUri = this.createUrl(__privateGet(_DimensionClient2, _url2), { ...options, projectId });
|
|
450
|
+
return await this.apiClient(fetchUri);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
_url2 = /* @__PURE__ */ new WeakMap();
|
|
454
|
+
__privateAdd(_DimensionClient, _url2, "/api/v2/dimension");
|
|
455
|
+
var _url3;
|
|
456
|
+
var _valueUrl;
|
|
457
|
+
var _EnrichmentClient = class _EnrichmentClient2 extends ApiClient {
|
|
458
|
+
constructor(options) {
|
|
459
|
+
super(options);
|
|
460
|
+
}
|
|
461
|
+
/** Fetches all enrichments and values for a project, grouped by category */
|
|
462
|
+
async get(options) {
|
|
463
|
+
const { projectId } = this.options;
|
|
464
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3), { ...options, projectId });
|
|
465
|
+
return await this.apiClient(fetchUri);
|
|
466
|
+
}
|
|
467
|
+
/** Updates or creates (based on id) an enrichment category */
|
|
468
|
+
async upsertCategory(body) {
|
|
469
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
470
|
+
await this.apiClient(fetchUri, {
|
|
471
|
+
method: "PUT",
|
|
472
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
473
|
+
expectNoContent: true
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
/** Deletes an enrichment category */
|
|
477
|
+
async removeCategory(body) {
|
|
478
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _url3));
|
|
479
|
+
await this.apiClient(fetchUri, {
|
|
480
|
+
method: "DELETE",
|
|
481
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
482
|
+
expectNoContent: true
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
/** Updates or creates (based on id) an enrichment value within an enrichment category */
|
|
486
|
+
async upsertValue(body) {
|
|
487
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
488
|
+
await this.apiClient(fetchUri, {
|
|
489
|
+
method: "PUT",
|
|
490
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
491
|
+
expectNoContent: true
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
/** Deletes an enrichment value within an enrichment category. The category is left alone. */
|
|
495
|
+
async removeValue(body) {
|
|
496
|
+
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient2, _valueUrl));
|
|
497
|
+
await this.apiClient(fetchUri, {
|
|
498
|
+
method: "DELETE",
|
|
499
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
500
|
+
expectNoContent: true
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
_url3 = /* @__PURE__ */ new WeakMap();
|
|
505
|
+
_valueUrl = /* @__PURE__ */ new WeakMap();
|
|
506
|
+
__privateAdd(_EnrichmentClient, _url3, "/api/v1/enrichments");
|
|
507
|
+
__privateAdd(_EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
|
508
|
+
var _url4;
|
|
509
|
+
var _ManifestClient = class _ManifestClient2 extends ApiClient {
|
|
510
|
+
constructor(options) {
|
|
511
|
+
super(options);
|
|
512
|
+
}
|
|
513
|
+
/** Fetches the Context manifest for a project */
|
|
514
|
+
async get(options) {
|
|
515
|
+
const { projectId } = this.options;
|
|
516
|
+
const fetchUri = this.createUrl(__privateGet(_ManifestClient2, _url4), { ...options, projectId });
|
|
517
|
+
return await this.apiClient(fetchUri);
|
|
518
|
+
}
|
|
519
|
+
/** Publishes the Context manifest for a project */
|
|
520
|
+
async publish() {
|
|
521
|
+
const { projectId } = this.options;
|
|
522
|
+
const fetchUri = this.createUrl("/api/v1/publish", { siteId: projectId });
|
|
523
|
+
await this.apiClient(fetchUri, {
|
|
524
|
+
method: "POST",
|
|
525
|
+
expectNoContent: true
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
_url4 = /* @__PURE__ */ new WeakMap();
|
|
530
|
+
__privateAdd(_ManifestClient, _url4, "/api/v2/manifest");
|
|
531
|
+
var _url5;
|
|
532
|
+
var _QuirkClient = class _QuirkClient2 extends ApiClient {
|
|
533
|
+
constructor(options) {
|
|
534
|
+
super(options);
|
|
535
|
+
}
|
|
536
|
+
/** Fetches all Quirks for a project */
|
|
537
|
+
async get(options) {
|
|
538
|
+
const { projectId } = this.options;
|
|
539
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5), { ...options, projectId });
|
|
540
|
+
return await this.apiClient(fetchUri);
|
|
541
|
+
}
|
|
542
|
+
/** Updates or creates (based on id) a Quirk */
|
|
543
|
+
async upsert(body) {
|
|
544
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
545
|
+
await this.apiClient(fetchUri, {
|
|
546
|
+
method: "PUT",
|
|
547
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
548
|
+
expectNoContent: true
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
/** Deletes a Quirk */
|
|
552
|
+
async remove(body) {
|
|
553
|
+
const fetchUri = this.createUrl(__privateGet(_QuirkClient2, _url5));
|
|
554
|
+
await this.apiClient(fetchUri, {
|
|
555
|
+
method: "DELETE",
|
|
556
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
557
|
+
expectNoContent: true
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
_url5 = /* @__PURE__ */ new WeakMap();
|
|
562
|
+
__privateAdd(_QuirkClient, _url5, "/api/v2/quirk");
|
|
563
|
+
var _url6;
|
|
564
|
+
var _SignalClient = class _SignalClient2 extends ApiClient {
|
|
565
|
+
constructor(options) {
|
|
566
|
+
super(options);
|
|
567
|
+
}
|
|
568
|
+
/** Fetches all Signals for a project */
|
|
569
|
+
async get(options) {
|
|
570
|
+
const { projectId } = this.options;
|
|
571
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6), { ...options, projectId });
|
|
572
|
+
return await this.apiClient(fetchUri);
|
|
573
|
+
}
|
|
574
|
+
/** Updates or creates (based on id) a Signal */
|
|
575
|
+
async upsert(body) {
|
|
576
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
577
|
+
await this.apiClient(fetchUri, {
|
|
578
|
+
method: "PUT",
|
|
579
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
580
|
+
expectNoContent: true
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
/** Deletes a Signal */
|
|
584
|
+
async remove(body) {
|
|
585
|
+
const fetchUri = this.createUrl(__privateGet(_SignalClient2, _url6));
|
|
586
|
+
await this.apiClient(fetchUri, {
|
|
587
|
+
method: "DELETE",
|
|
588
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
589
|
+
expectNoContent: true
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
_url6 = /* @__PURE__ */ new WeakMap();
|
|
594
|
+
__privateAdd(_SignalClient, _url6, "/api/v2/signal");
|
|
595
|
+
var _url7;
|
|
596
|
+
var _TestClient = class _TestClient2 extends ApiClient {
|
|
597
|
+
constructor(options) {
|
|
598
|
+
super(options);
|
|
599
|
+
}
|
|
600
|
+
/** Fetches all Tests for a project */
|
|
601
|
+
async get(options) {
|
|
602
|
+
const { projectId } = this.options;
|
|
603
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7), { ...options, projectId });
|
|
604
|
+
return await this.apiClient(fetchUri);
|
|
605
|
+
}
|
|
606
|
+
/** Updates or creates (based on id) a Test */
|
|
607
|
+
async upsert(body) {
|
|
608
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
609
|
+
await this.apiClient(fetchUri, {
|
|
610
|
+
method: "PUT",
|
|
611
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
612
|
+
expectNoContent: true
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
/** Deletes a Test */
|
|
616
|
+
async remove(body) {
|
|
617
|
+
const fetchUri = this.createUrl(__privateGet(_TestClient2, _url7));
|
|
618
|
+
await this.apiClient(fetchUri, {
|
|
619
|
+
method: "DELETE",
|
|
620
|
+
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
621
|
+
expectNoContent: true
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
_url7 = /* @__PURE__ */ new WeakMap();
|
|
626
|
+
__privateAdd(_TestClient, _url7, "/api/v2/test");
|
|
627
|
+
|
|
628
|
+
// ../canvas/dist/index.mjs
|
|
629
|
+
var __typeError2 = (msg) => {
|
|
630
|
+
throw TypeError(msg);
|
|
631
|
+
};
|
|
632
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
633
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
634
|
+
var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
106
635
|
var SELECT_QUERY_PREFIX = "select.";
|
|
107
636
|
function appendCsv(out, key, values) {
|
|
108
637
|
if (values === void 0) {
|
|
@@ -153,7 +682,7 @@ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
|
153
682
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
154
683
|
var _contentTypesUrl;
|
|
155
684
|
var _entriesUrl;
|
|
156
|
-
var _ContentClient = class _ContentClient2 extends
|
|
685
|
+
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
157
686
|
constructor(options) {
|
|
158
687
|
var _a;
|
|
159
688
|
super(options);
|
|
@@ -161,16 +690,16 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
|
161
690
|
}
|
|
162
691
|
getContentTypes(options) {
|
|
163
692
|
const { projectId } = this.options;
|
|
164
|
-
const fetchUri = this.createUrl(
|
|
693
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl), { ...options, projectId });
|
|
165
694
|
return this.apiClient(fetchUri);
|
|
166
695
|
}
|
|
167
696
|
getEntries(options) {
|
|
168
697
|
const { projectId } = this.options;
|
|
169
698
|
const { skipDataResolution, filters, select, ...params } = options;
|
|
170
|
-
const rewrittenFilters =
|
|
699
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
171
700
|
const rewrittenSelect = projectionToQuery(select);
|
|
172
701
|
if (skipDataResolution) {
|
|
173
|
-
const url = this.createUrl(
|
|
702
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
174
703
|
...params,
|
|
175
704
|
...rewrittenFilters,
|
|
176
705
|
...rewrittenSelect,
|
|
@@ -179,7 +708,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
|
179
708
|
return this.apiClient(url);
|
|
180
709
|
}
|
|
181
710
|
const edgeUrl = this.createUrl(
|
|
182
|
-
|
|
711
|
+
__privateGet2(_ContentClient2, _entriesUrl),
|
|
183
712
|
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
184
713
|
this.edgeApiHost
|
|
185
714
|
);
|
|
@@ -197,7 +726,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
|
197
726
|
return this.apiClient(historyUrl);
|
|
198
727
|
}
|
|
199
728
|
async upsertContentType(body, opts = {}) {
|
|
200
|
-
const fetchUri = this.createUrl(
|
|
729
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
201
730
|
if (typeof body.contentType.slugSettings === "object" && body.contentType.slugSettings !== null && Object.keys(body.contentType.slugSettings).length === 0) {
|
|
202
731
|
delete body.contentType.slugSettings;
|
|
203
732
|
}
|
|
@@ -209,7 +738,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
|
209
738
|
});
|
|
210
739
|
}
|
|
211
740
|
async upsertEntry(body, options) {
|
|
212
|
-
const fetchUri = this.createUrl(
|
|
741
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
213
742
|
const headers = {};
|
|
214
743
|
if (options == null ? void 0 : options.ifUnmodifiedSince) {
|
|
215
744
|
headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
|
|
@@ -223,7 +752,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
|
223
752
|
return { modified: response.headers.get("x-modified-at") };
|
|
224
753
|
}
|
|
225
754
|
async deleteContentType(body) {
|
|
226
|
-
const fetchUri = this.createUrl(
|
|
755
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _contentTypesUrl));
|
|
227
756
|
await this.apiClient(fetchUri, {
|
|
228
757
|
method: "DELETE",
|
|
229
758
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -231,7 +760,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
|
231
760
|
});
|
|
232
761
|
}
|
|
233
762
|
async deleteEntry(body) {
|
|
234
|
-
const fetchUri = this.createUrl(
|
|
763
|
+
const fetchUri = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl));
|
|
235
764
|
await this.apiClient(fetchUri, {
|
|
236
765
|
method: "DELETE",
|
|
237
766
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -250,17 +779,17 @@ var _ContentClient = class _ContentClient2 extends ApiClient4 {
|
|
|
250
779
|
};
|
|
251
780
|
_contentTypesUrl = /* @__PURE__ */ new WeakMap();
|
|
252
781
|
_entriesUrl = /* @__PURE__ */ new WeakMap();
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
var
|
|
256
|
-
var _DataTypeClient = class _DataTypeClient2 extends
|
|
782
|
+
__privateAdd2(_ContentClient, _contentTypesUrl, "/api/v1/content-types");
|
|
783
|
+
__privateAdd2(_ContentClient, _entriesUrl, "/api/v1/entries");
|
|
784
|
+
var _url8;
|
|
785
|
+
var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
257
786
|
constructor(options) {
|
|
258
787
|
super(options);
|
|
259
788
|
}
|
|
260
789
|
/** Fetches a list of DataTypes for a project */
|
|
261
790
|
async list(options) {
|
|
262
791
|
const { projectId } = this.options;
|
|
263
|
-
const fetchUri = this.createUrl(
|
|
792
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
|
|
264
793
|
return await this.apiClient(fetchUri);
|
|
265
794
|
}
|
|
266
795
|
/** @deprecated Use {@link list} instead. */
|
|
@@ -269,7 +798,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
|
|
|
269
798
|
}
|
|
270
799
|
/** Updates or creates (based on id) a DataType */
|
|
271
800
|
async save(body) {
|
|
272
|
-
const fetchUri = this.createUrl(
|
|
801
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
273
802
|
await this.apiClient(fetchUri, {
|
|
274
803
|
method: "PUT",
|
|
275
804
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -282,7 +811,7 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
|
|
|
282
811
|
}
|
|
283
812
|
/** Deletes a DataType */
|
|
284
813
|
async remove(body) {
|
|
285
|
-
const fetchUri = this.createUrl(
|
|
814
|
+
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
286
815
|
await this.apiClient(fetchUri, {
|
|
287
816
|
method: "DELETE",
|
|
288
817
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
|
@@ -290,10 +819,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient6 {
|
|
|
290
819
|
});
|
|
291
820
|
}
|
|
292
821
|
};
|
|
293
|
-
|
|
294
|
-
|
|
822
|
+
_url8 = /* @__PURE__ */ new WeakMap();
|
|
823
|
+
__privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
295
824
|
var _baseUrl;
|
|
296
|
-
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends
|
|
825
|
+
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
|
|
297
826
|
constructor(options) {
|
|
298
827
|
super(options);
|
|
299
828
|
this.teamId = options.teamId;
|
|
@@ -302,7 +831,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
302
831
|
* Gets a list of property type and hook names for the current team, including public integrations' hooks.
|
|
303
832
|
*/
|
|
304
833
|
get(options) {
|
|
305
|
-
const fetchUri = this.createUrl(
|
|
834
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl), {
|
|
306
835
|
...options,
|
|
307
836
|
teamId: this.teamId
|
|
308
837
|
});
|
|
@@ -312,7 +841,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
312
841
|
* Creates or updates a custom AI property editor on a Mesh app.
|
|
313
842
|
*/
|
|
314
843
|
async deploy(body) {
|
|
315
|
-
const fetchUri = this.createUrl(
|
|
844
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
316
845
|
await this.apiClient(fetchUri, {
|
|
317
846
|
method: "PUT",
|
|
318
847
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -323,7 +852,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
323
852
|
* Removes a custom AI property editor from a Mesh app.
|
|
324
853
|
*/
|
|
325
854
|
async delete(body) {
|
|
326
|
-
const fetchUri = this.createUrl(
|
|
855
|
+
const fetchUri = this.createUrl(__privateGet2(_IntegrationPropertyEditorsClient2, _baseUrl));
|
|
327
856
|
await this.apiClient(fetchUri, {
|
|
328
857
|
method: "DELETE",
|
|
329
858
|
body: JSON.stringify({ ...body, teamId: this.teamId }),
|
|
@@ -332,16 +861,16 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
332
861
|
}
|
|
333
862
|
};
|
|
334
863
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
335
|
-
|
|
336
|
-
var
|
|
864
|
+
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
865
|
+
var _url22;
|
|
337
866
|
var _projectsUrl;
|
|
338
|
-
var _ProjectClient = class _ProjectClient2 extends
|
|
867
|
+
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
339
868
|
constructor(options) {
|
|
340
869
|
super({ ...options, bypassCache: true });
|
|
341
870
|
}
|
|
342
871
|
/** Fetches single Project */
|
|
343
872
|
async get(options) {
|
|
344
|
-
const fetchUri = this.createUrl(
|
|
873
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
345
874
|
return await this.apiClient(fetchUri);
|
|
346
875
|
}
|
|
347
876
|
/**
|
|
@@ -350,7 +879,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
|
|
|
350
879
|
* When omitted, returns all accessible teams and their projects.
|
|
351
880
|
*/
|
|
352
881
|
async list(options) {
|
|
353
|
-
const fetchUri = this.createUrl(
|
|
882
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
354
883
|
return await this.apiClient(fetchUri);
|
|
355
884
|
}
|
|
356
885
|
/** @deprecated Use {@link list} instead. */
|
|
@@ -359,7 +888,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
|
|
|
359
888
|
}
|
|
360
889
|
/** Updates or creates (based on id) a Project */
|
|
361
890
|
async save(body) {
|
|
362
|
-
const fetchUri = this.createUrl(
|
|
891
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
363
892
|
return await this.apiClient(fetchUri, {
|
|
364
893
|
method: "PUT",
|
|
365
894
|
body: JSON.stringify({ ...body })
|
|
@@ -371,7 +900,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
|
|
|
371
900
|
}
|
|
372
901
|
/** Deletes a Project */
|
|
373
902
|
async remove(body) {
|
|
374
|
-
const fetchUri = this.createUrl(
|
|
903
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
375
904
|
await this.apiClient(fetchUri, {
|
|
376
905
|
method: "DELETE",
|
|
377
906
|
body: JSON.stringify({ ...body }),
|
|
@@ -383,10 +912,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient12 {
|
|
|
383
912
|
return this.remove(body);
|
|
384
913
|
}
|
|
385
914
|
};
|
|
386
|
-
|
|
915
|
+
_url22 = /* @__PURE__ */ new WeakMap();
|
|
387
916
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
388
|
-
|
|
389
|
-
|
|
917
|
+
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
918
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
390
919
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
|
391
920
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
|
392
921
|
var ATTRIBUTE_PARAMETER_TYPE = "data-uniform-parameter-type";
|
|
@@ -396,14 +925,14 @@ import {
|
|
|
396
925
|
isRichTextValue,
|
|
397
926
|
isRichTextValueConsideredEmpty
|
|
398
927
|
} from "@uniformdev/richtext";
|
|
399
|
-
import
|
|
928
|
+
import React12 from "react";
|
|
400
929
|
|
|
401
930
|
// src/components/UniformRichTextNode.tsx
|
|
402
931
|
import { isRichTextNode } from "@uniformdev/richtext";
|
|
403
|
-
import
|
|
932
|
+
import React11 from "react";
|
|
404
933
|
|
|
405
934
|
// src/components/nodes/AssetRichTextNode.tsx
|
|
406
|
-
import
|
|
935
|
+
import React from "react";
|
|
407
936
|
var AssetRichTextNode = ({ node }) => {
|
|
408
937
|
var _a, _b;
|
|
409
938
|
const { __asset } = node;
|
|
@@ -411,46 +940,46 @@ var AssetRichTextNode = ({ node }) => {
|
|
|
411
940
|
return null;
|
|
412
941
|
}
|
|
413
942
|
if (__asset.type === "image") {
|
|
414
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ React.createElement("figure", null, /* @__PURE__ */ React.createElement("img", { src: __asset.fields.url.value, alt: (_a = __asset.fields.title) == null ? void 0 : _a.value }), ((_b = __asset.fields.description) == null ? void 0 : _b.value) ? /* @__PURE__ */ React.createElement("figcaption", null, __asset.fields.description.value) : null);
|
|
415
944
|
}
|
|
416
945
|
if (__asset.type === "video") {
|
|
417
|
-
return /* @__PURE__ */
|
|
946
|
+
return /* @__PURE__ */ React.createElement("video", { src: __asset.fields.url.value, controls: true });
|
|
418
947
|
}
|
|
419
948
|
if (__asset.type === "audio") {
|
|
420
|
-
return /* @__PURE__ */
|
|
949
|
+
return /* @__PURE__ */ React.createElement("audio", { src: __asset.fields.url.value, controls: true });
|
|
421
950
|
}
|
|
422
951
|
return null;
|
|
423
952
|
};
|
|
424
953
|
|
|
425
954
|
// src/components/nodes/HeadingRichTextNode.tsx
|
|
426
|
-
import
|
|
955
|
+
import React2 from "react";
|
|
427
956
|
var HeadingRichTextNode = ({ children, node }) => {
|
|
428
957
|
const { tag } = node;
|
|
429
958
|
const HTag = tag != null ? tag : "h1";
|
|
430
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ React2.createElement(HTag, null, children);
|
|
431
960
|
};
|
|
432
961
|
|
|
433
962
|
// src/components/nodes/LinebreakRichTextNode.tsx
|
|
434
|
-
import
|
|
963
|
+
import React3 from "react";
|
|
435
964
|
var LinebreakRichTextNode = () => {
|
|
436
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ React3.createElement("br", null);
|
|
437
966
|
};
|
|
438
967
|
|
|
439
968
|
// src/components/nodes/LinkRichTextNode.tsx
|
|
440
969
|
import { linkParamValueToAnchorProps } from "@uniformdev/richtext";
|
|
441
|
-
import
|
|
970
|
+
import React4 from "react";
|
|
442
971
|
var LinkRichTextNode = ({ children, node }) => {
|
|
443
972
|
const { link } = node;
|
|
444
|
-
return /* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ React4.createElement("a", { ...linkParamValueToAnchorProps(link) }, children);
|
|
445
974
|
};
|
|
446
975
|
|
|
447
976
|
// src/components/nodes/ListItemRichTextNode.tsx
|
|
448
977
|
import { getRichTextListItemValue } from "@uniformdev/richtext";
|
|
449
|
-
import
|
|
978
|
+
import React5 from "react";
|
|
450
979
|
var ListItemRichTextNode = ({ children, node }) => {
|
|
451
980
|
const { value } = node;
|
|
452
981
|
const normalizedValue = getRichTextListItemValue(value);
|
|
453
|
-
return /* @__PURE__ */
|
|
982
|
+
return /* @__PURE__ */ React5.createElement(
|
|
454
983
|
"li",
|
|
455
984
|
{
|
|
456
985
|
value: typeof normalizedValue === "number" && Number.isFinite(normalizedValue) && normalizedValue > 0 ? normalizedValue : void 0
|
|
@@ -461,12 +990,12 @@ var ListItemRichTextNode = ({ children, node }) => {
|
|
|
461
990
|
|
|
462
991
|
// src/components/nodes/ListRichTextNode.tsx
|
|
463
992
|
import { getRichTextListStart } from "@uniformdev/richtext";
|
|
464
|
-
import
|
|
993
|
+
import React6 from "react";
|
|
465
994
|
var ListRichTextNode = ({ children, node }) => {
|
|
466
995
|
const { tag, start } = node;
|
|
467
996
|
const ListTag = tag != null ? tag : "ul";
|
|
468
997
|
const normalizedStart = getRichTextListStart(start);
|
|
469
|
-
return /* @__PURE__ */
|
|
998
|
+
return /* @__PURE__ */ React6.createElement(
|
|
470
999
|
ListTag,
|
|
471
1000
|
{
|
|
472
1001
|
start: typeof normalizedStart === "number" && Number.isFinite(normalizedStart) && normalizedStart > 0 ? normalizedStart : void 0
|
|
@@ -477,10 +1006,10 @@ var ListRichTextNode = ({ children, node }) => {
|
|
|
477
1006
|
|
|
478
1007
|
// src/components/nodes/ParagraphRichTextNode.tsx
|
|
479
1008
|
import { isPureDirection, isPureTextAlign } from "@uniformdev/richtext";
|
|
480
|
-
import
|
|
1009
|
+
import React7 from "react";
|
|
481
1010
|
var ParagraphRichTextNode = ({ children, node }) => {
|
|
482
1011
|
const { format, direction } = node;
|
|
483
|
-
return /* @__PURE__ */
|
|
1012
|
+
return /* @__PURE__ */ React7.createElement(
|
|
484
1013
|
"p",
|
|
485
1014
|
{
|
|
486
1015
|
dir: isPureDirection(direction) ? direction : void 0,
|
|
@@ -492,26 +1021,26 @@ var ParagraphRichTextNode = ({ children, node }) => {
|
|
|
492
1021
|
|
|
493
1022
|
// src/components/nodes/TableCellRichTextNode.tsx
|
|
494
1023
|
import { getRichTextTagFromTableCellHeaderState } from "@uniformdev/richtext";
|
|
495
|
-
import
|
|
1024
|
+
import React8 from "react";
|
|
496
1025
|
var TableCellRichTextNode = ({ children, node }) => {
|
|
497
1026
|
const { headerState } = node;
|
|
498
1027
|
const TableCellTag = getRichTextTagFromTableCellHeaderState(headerState);
|
|
499
|
-
return /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ React8.createElement(TableCellTag, null, children);
|
|
500
1029
|
};
|
|
501
1030
|
|
|
502
1031
|
// src/components/nodes/TabRichTextNode.tsx
|
|
503
|
-
import
|
|
1032
|
+
import React9 from "react";
|
|
504
1033
|
var TabRichTextNode = () => {
|
|
505
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, " ");
|
|
506
1035
|
};
|
|
507
1036
|
|
|
508
1037
|
// src/components/nodes/TextRichTextNode.tsx
|
|
509
1038
|
import { getRichTextTagsFromTextFormat } from "@uniformdev/richtext";
|
|
510
|
-
import
|
|
1039
|
+
import React10 from "react";
|
|
511
1040
|
var TextRichTextNode = ({ node }) => {
|
|
512
1041
|
const { text, format } = node;
|
|
513
1042
|
const tags = getRichTextTagsFromTextFormat(format);
|
|
514
|
-
return /* @__PURE__ */
|
|
1043
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, tags.length > 0 ? tags.reduceRight((children, Tag) => /* @__PURE__ */ React10.createElement(Tag, null, children), text) : text);
|
|
515
1044
|
};
|
|
516
1045
|
|
|
517
1046
|
// src/components/UniformRichTextNode.tsx
|
|
@@ -525,8 +1054,8 @@ function UniformRichTextNode({ node, ...props }) {
|
|
|
525
1054
|
if (!NodeRenderer) {
|
|
526
1055
|
return null;
|
|
527
1056
|
}
|
|
528
|
-
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */
|
|
529
|
-
return /* @__PURE__ */
|
|
1057
|
+
const children = node.children ? node.children.map((childNode, i) => /* @__PURE__ */ React11.createElement(UniformRichTextNode, { ...props, key: i, node: childNode })) : null;
|
|
1058
|
+
return /* @__PURE__ */ React11.createElement(NodeRenderer, { node }, children);
|
|
530
1059
|
}
|
|
531
1060
|
var rendererMap = /* @__PURE__ */ new Map([
|
|
532
1061
|
["heading", HeadingRichTextNode],
|
|
@@ -535,19 +1064,19 @@ var rendererMap = /* @__PURE__ */ new Map([
|
|
|
535
1064
|
["list", ListRichTextNode],
|
|
536
1065
|
["listitem", ListItemRichTextNode],
|
|
537
1066
|
["paragraph", ParagraphRichTextNode],
|
|
538
|
-
["quote", ({ children }) => /* @__PURE__ */
|
|
1067
|
+
["quote", ({ children }) => /* @__PURE__ */ React11.createElement("blockquote", null, children)],
|
|
539
1068
|
[
|
|
540
1069
|
"code",
|
|
541
|
-
({ children }) => /* @__PURE__ */
|
|
1070
|
+
({ children }) => /* @__PURE__ */ React11.createElement("pre", null, /* @__PURE__ */ React11.createElement("code", null, children))
|
|
542
1071
|
],
|
|
543
|
-
["root", ({ children }) => /* @__PURE__ */
|
|
1072
|
+
["root", ({ children }) => /* @__PURE__ */ React11.createElement(React11.Fragment, null, children)],
|
|
544
1073
|
["text", TextRichTextNode],
|
|
545
1074
|
["tab", TabRichTextNode],
|
|
546
1075
|
[
|
|
547
1076
|
"table",
|
|
548
|
-
({ children }) => /* @__PURE__ */
|
|
1077
|
+
({ children }) => /* @__PURE__ */ React11.createElement("table", null, /* @__PURE__ */ React11.createElement("tbody", null, children))
|
|
549
1078
|
],
|
|
550
|
-
["tablerow", ({ children }) => /* @__PURE__ */
|
|
1079
|
+
["tablerow", ({ children }) => /* @__PURE__ */ React11.createElement("tr", null, children)],
|
|
551
1080
|
["tablecell", TableCellRichTextNode],
|
|
552
1081
|
["asset", AssetRichTextNode]
|
|
553
1082
|
]);
|
|
@@ -556,7 +1085,7 @@ var resolveRichTextDefaultRenderer = (node) => {
|
|
|
556
1085
|
};
|
|
557
1086
|
|
|
558
1087
|
// src/components/UniformRichText.tsx
|
|
559
|
-
var UniformRichText =
|
|
1088
|
+
var UniformRichText = React12.forwardRef(function UniformRichText2({
|
|
560
1089
|
component,
|
|
561
1090
|
resolveRichTextRenderer,
|
|
562
1091
|
as: Tag = "div",
|
|
@@ -573,7 +1102,7 @@ var UniformRichText = React13.forwardRef(function UniformRichText2({
|
|
|
573
1102
|
const value = parameter.value;
|
|
574
1103
|
if (!value || !isRichTextValue(value)) return null;
|
|
575
1104
|
if (!isContextualEditing && isRichTextValueConsideredEmpty(value)) return null;
|
|
576
|
-
return Tag === null ? /* @__PURE__ */
|
|
1105
|
+
return Tag === null ? /* @__PURE__ */ React12.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer }) : /* @__PURE__ */ React12.createElement(
|
|
577
1106
|
Tag,
|
|
578
1107
|
{
|
|
579
1108
|
ref,
|
|
@@ -584,18 +1113,17 @@ var UniformRichText = React13.forwardRef(function UniformRichText2({
|
|
|
584
1113
|
[ATTRIBUTE_PARAMETER_TYPE]: "richText"
|
|
585
1114
|
} : {}
|
|
586
1115
|
},
|
|
587
|
-
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */
|
|
1116
|
+
isRichTextValueConsideredEmpty(value) ? /* @__PURE__ */ React12.createElement("p", null, /* @__PURE__ */ React12.createElement("i", null, computedPlaceholder)) : /* @__PURE__ */ React12.createElement(UniformRichTextNode, { node: value.root, resolveRichTextRenderer })
|
|
588
1117
|
);
|
|
589
1118
|
});
|
|
590
1119
|
|
|
591
1120
|
// src/components/UniformText.tsx
|
|
592
1121
|
import { ClientUniformText } from "@uniformdev/next-app-router-client";
|
|
593
|
-
import
|
|
1122
|
+
import React13 from "react";
|
|
594
1123
|
var UniformText = (props) => {
|
|
595
|
-
return /* @__PURE__ */
|
|
1124
|
+
return /* @__PURE__ */ React13.createElement(ClientUniformText, { ...props });
|
|
596
1125
|
};
|
|
597
1126
|
export {
|
|
598
|
-
UniformEdgeState,
|
|
599
1127
|
UniformRichText,
|
|
600
1128
|
UniformSlot,
|
|
601
1129
|
UniformText,
|