@arcadeai/design-system 1.5.0 → 1.6.0
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/{arcade-CadnNaba.js → arcade-DzMbb7xi.js} +520 -594
- package/dist/components/index.js +302 -300
- package/dist/components/ui/atoms/icons/codesandbox.d.ts +3 -0
- package/dist/components/ui/atoms/icons/codesandbox.js +26 -0
- package/dist/components/ui/atoms/icons/index.d.ts +1 -0
- package/dist/components/ui/atoms/icons/index.js +182 -180
- package/dist/components/ui/atoms/icons/jira.js +1 -10
- package/dist/components/ui/atoms/icons/utils.d.ts +0 -13
- package/dist/components/ui/atoms/icons/utils.js +22 -30
- package/dist/components/ui/atoms/index.js +285 -283
- package/dist/components/ui/index.js +302 -300
- package/dist/components/ui/molecules/index.js +1 -1
- package/dist/components/ui/molecules/requirement-badges.js +4 -5
- package/dist/components/ui/molecules/toolkit-card.js +1 -1
- package/dist/components/ui/molecules/toolkit-picker-trigger.js +29 -32
- package/dist/components/ui/molecules/toolkit-selection-summary.js +1 -1
- package/dist/components/ui/organisms/toolkit-picker/components/search-input.js +3 -4
- package/dist/components/ui/organisms/toolkit-picker/components/select-button.js +5 -6
- package/dist/components/ui/organisms/toolkit-picker/components/toolkit-card-with-selection.js +1 -1
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.d.ts +11 -3
- package/dist/components/ui/organisms/toolkit-picker/hooks/use-toolkit-picker.js +141 -99
- package/dist/components/ui/organisms/toolkit-picker/index.d.ts +2 -0
- package/dist/components/ui/organisms/toolkit-picker/index.js +3 -2
- package/dist/components/ui/organisms/toolkit-picker/mocks/toolkit-collection.d.ts +2 -0
- package/dist/components/ui/organisms/toolkit-picker/mocks/toolkit-collection.js +247 -55
- package/dist/components/ui/organisms/toolkit-picker/toolkit-picker.js +1 -1
- package/dist/lib/arcade/arcade.d.ts +1 -1
- package/dist/lib/arcade/arcade.js +3 -2
- package/dist/lib/arcade/arcade.test.js +1 -1
- package/dist/main.js +351 -343
- package/dist/metadata/constants.d.ts +1 -0
- package/dist/metadata/constants.js +4 -0
- package/dist/metadata/index.d.ts +3 -0
- package/dist/metadata/index.js +17 -11
- package/dist/metadata/oauth-providers.d.ts +21 -13
- package/dist/metadata/oauth-providers.js +98 -72
- package/dist/metadata/toolkits.d.ts +1 -21
- package/dist/metadata/toolkits.js +443 -273
- package/dist/metadata/types.d.ts +40 -0
- package/dist/metadata/types.js +1 -0
- package/dist/metadata/utils.d.ts +16 -0
- package/dist/metadata/utils.js +11 -0
- package/dist/{toolkit-card-UG1sZ0Le.js → toolkit-card-CHiL03EY.js} +2 -3
- package/dist/web-sgv-FK6q.js +84 -0
- package/package.json +1 -1
|
@@ -1,99 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (ye)
|
|
6
|
-
throw new Error(`you must \`import '@arcadeai/arcadejs/shims/${t.kind}'\` before importing anything else from @arcadeai/arcadejs`);
|
|
7
|
-
if (D)
|
|
8
|
-
throw new Error(`can't \`import '@arcadeai/arcadejs/shims/${t.kind}'\` after \`import '@arcadeai/arcadejs/shims/${D}'\``);
|
|
9
|
-
ye = e.auto, D = t.kind, Re = t.fetch, t.Request, t.Response, t.Headers, t.FormData, t.Blob, Y = t.File, t.ReadableStream, t.getMultipartRequestOptions, Se = t.getDefaultAgent, Ee = t.fileFromPath, t.isFsReadStream;
|
|
10
|
-
}
|
|
11
|
-
class rt {
|
|
12
|
-
constructor(e) {
|
|
13
|
-
this.body = e;
|
|
14
|
-
}
|
|
15
|
-
get [Symbol.toStringTag]() {
|
|
16
|
-
return "MultipartBody";
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function ke({ manuallyImported: t } = {}) {
|
|
20
|
-
const e = t ? "You may need to use polyfills" : "Add one of these imports before your first `import … from '@arcadeai/arcadejs'`:\n- `import '@arcadeai/arcadejs/shims/node'` (if you're running on Node)\n- `import '@arcadeai/arcadejs/shims/web'` (otherwise)\n";
|
|
21
|
-
let r, n, s, o;
|
|
22
|
-
try {
|
|
23
|
-
r = fetch, n = Request, s = Response, o = Headers;
|
|
24
|
-
} catch (i) {
|
|
25
|
-
throw new Error(`this environment is missing the following Web Fetch API type: ${i.message}. ${e}`);
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
kind: "web",
|
|
29
|
-
fetch: r,
|
|
30
|
-
Request: n,
|
|
31
|
-
Response: s,
|
|
32
|
-
Headers: o,
|
|
33
|
-
FormData: (
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
typeof FormData < "u" ? FormData : class {
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
constructor() {
|
|
38
|
-
throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
Blob: typeof Blob < "u" ? Blob : class {
|
|
43
|
-
constructor() {
|
|
44
|
-
throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
File: (
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
typeof File < "u" ? File : class {
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
constructor() {
|
|
52
|
-
throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
),
|
|
56
|
-
ReadableStream: (
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
typeof ReadableStream < "u" ? ReadableStream : class {
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
constructor() {
|
|
61
|
-
throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
getMultipartRequestOptions: async (i, l) => ({
|
|
66
|
-
...l,
|
|
67
|
-
body: new rt(i)
|
|
68
|
-
}),
|
|
69
|
-
getDefaultAgent: (i) => {
|
|
70
|
-
},
|
|
71
|
-
fileFromPath: () => {
|
|
72
|
-
throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/ArcadeAI/arcade-js#file-uploads");
|
|
73
|
-
},
|
|
74
|
-
isFsReadStream: (i) => !1
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
Pe(ke({ manuallyImported: !0 }));
|
|
78
|
-
const Z = "RFC3986", ee = {
|
|
1
|
+
import { k as _e, s as Qe, g as Ge, F as de, f as Je, a as Ye, b as Ze } from "./web-sgv-FK6q.js";
|
|
2
|
+
import { TOOLKIT_CATALOGUE as et } from "./metadata/toolkits.js";
|
|
3
|
+
import { r as he } from "./utils-Db4QWi-E.js";
|
|
4
|
+
const J = "RFC3986", Y = {
|
|
79
5
|
RFC1738: (t) => String(t).replace(/%20/g, "+"),
|
|
80
6
|
RFC3986: (t) => String(t)
|
|
81
|
-
},
|
|
7
|
+
}, tt = "RFC1738", nt = Array.isArray, _ = (() => {
|
|
82
8
|
const t = [];
|
|
83
9
|
for (let e = 0; e < 256; ++e)
|
|
84
10
|
t.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase());
|
|
85
11
|
return t;
|
|
86
|
-
})(),
|
|
12
|
+
})(), W = 1024, rt = (t, e, n, r, s) => {
|
|
87
13
|
if (t.length === 0)
|
|
88
14
|
return t;
|
|
89
15
|
let o = t;
|
|
90
|
-
if (typeof t == "symbol" ? o = Symbol.prototype.toString.call(t) : typeof t != "string" && (o = String(t)),
|
|
16
|
+
if (typeof t == "symbol" ? o = Symbol.prototype.toString.call(t) : typeof t != "string" && (o = String(t)), n === "iso-8859-1")
|
|
91
17
|
return escape(o).replace(/%u[0-9a-f]{4}/gi, function(l) {
|
|
92
18
|
return "%26%23" + parseInt(l.slice(2), 16) + "%3B";
|
|
93
19
|
});
|
|
94
20
|
let i = "";
|
|
95
|
-
for (let l = 0; l < o.length; l +=
|
|
96
|
-
const c = o.length >=
|
|
21
|
+
for (let l = 0; l < o.length; l += W) {
|
|
22
|
+
const c = o.length >= W ? o.slice(l, l + W) : o, u = [];
|
|
97
23
|
for (let p = 0; p < c.length; ++p) {
|
|
98
24
|
let a = c.charCodeAt(p);
|
|
99
25
|
if (a === 45 || // -
|
|
@@ -103,7 +29,7 @@ const Z = "RFC3986", ee = {
|
|
|
103
29
|
a >= 48 && a <= 57 || // 0-9
|
|
104
30
|
a >= 65 && a <= 90 || // a-z
|
|
105
31
|
a >= 97 && a <= 122 || // A-Z
|
|
106
|
-
s ===
|
|
32
|
+
s === tt && (a === 40 || a === 41)) {
|
|
107
33
|
u[u.length] = c.charAt(p);
|
|
108
34
|
continue;
|
|
109
35
|
}
|
|
@@ -125,19 +51,19 @@ const Z = "RFC3986", ee = {
|
|
|
125
51
|
}
|
|
126
52
|
return i;
|
|
127
53
|
};
|
|
128
|
-
function
|
|
54
|
+
function st(t) {
|
|
129
55
|
return !t || typeof t != "object" ? !1 : !!(t.constructor && t.constructor.isBuffer && t.constructor.isBuffer(t));
|
|
130
56
|
}
|
|
131
|
-
function
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
134
|
-
for (let
|
|
135
|
-
|
|
136
|
-
return
|
|
57
|
+
function pe(t, e) {
|
|
58
|
+
if (nt(t)) {
|
|
59
|
+
const n = [];
|
|
60
|
+
for (let r = 0; r < t.length; r += 1)
|
|
61
|
+
n.push(e(t[r]));
|
|
62
|
+
return n;
|
|
137
63
|
}
|
|
138
64
|
return e(t);
|
|
139
65
|
}
|
|
140
|
-
const
|
|
66
|
+
const ot = Object.prototype.hasOwnProperty, Ae = {
|
|
141
67
|
brackets(t) {
|
|
142
68
|
return String(t) + "[]";
|
|
143
69
|
},
|
|
@@ -148,9 +74,9 @@ const at = Object.prototype.hasOwnProperty, Te = {
|
|
|
148
74
|
repeat(t) {
|
|
149
75
|
return String(t);
|
|
150
76
|
}
|
|
151
|
-
}, A = Array.isArray,
|
|
152
|
-
|
|
153
|
-
},
|
|
77
|
+
}, A = Array.isArray, it = Array.prototype.push, Se = function(t, e) {
|
|
78
|
+
it.apply(t, A(e) ? e : [e]);
|
|
79
|
+
}, at = Date.prototype.toISOString, y = {
|
|
154
80
|
addQueryPrefix: !1,
|
|
155
81
|
allowDots: !1,
|
|
156
82
|
allowEmptyArrays: !1,
|
|
@@ -160,103 +86,103 @@ const at = Object.prototype.hasOwnProperty, Te = {
|
|
|
160
86
|
delimiter: "&",
|
|
161
87
|
encode: !0,
|
|
162
88
|
encodeDotInKeys: !1,
|
|
163
|
-
encoder:
|
|
89
|
+
encoder: rt,
|
|
164
90
|
encodeValuesOnly: !1,
|
|
165
|
-
format:
|
|
166
|
-
formatter:
|
|
91
|
+
format: J,
|
|
92
|
+
formatter: Y[J],
|
|
167
93
|
/** @deprecated */
|
|
168
94
|
indices: !1,
|
|
169
95
|
serializeDate(t) {
|
|
170
|
-
return
|
|
96
|
+
return at.call(t);
|
|
171
97
|
},
|
|
172
98
|
skipNulls: !1,
|
|
173
99
|
strictNullHandling: !1
|
|
174
100
|
};
|
|
175
|
-
function
|
|
101
|
+
function ct(t) {
|
|
176
102
|
return typeof t == "string" || typeof t == "number" || typeof t == "boolean" || typeof t == "symbol" || typeof t == "bigint";
|
|
177
103
|
}
|
|
178
|
-
const
|
|
179
|
-
function
|
|
180
|
-
let f = t,
|
|
181
|
-
for (; (
|
|
182
|
-
const g =
|
|
183
|
-
if (
|
|
184
|
-
if (g ===
|
|
104
|
+
const V = {};
|
|
105
|
+
function Re(t, e, n, r, s, o, i, l, c, u, p, a, h, m, b, E, S, z) {
|
|
106
|
+
let f = t, D = z, U = 0, ce = !1;
|
|
107
|
+
for (; (D = D.get(V)) !== void 0 && !ce; ) {
|
|
108
|
+
const g = D.get(t);
|
|
109
|
+
if (U += 1, typeof g < "u") {
|
|
110
|
+
if (g === U)
|
|
185
111
|
throw new RangeError("Cyclic object value");
|
|
186
|
-
|
|
112
|
+
ce = !0;
|
|
187
113
|
}
|
|
188
|
-
typeof
|
|
114
|
+
typeof D.get(V) > "u" && (U = 0);
|
|
189
115
|
}
|
|
190
|
-
if (typeof u == "function" ? f = u(e, f) : f instanceof Date ? f = h?.(f) :
|
|
116
|
+
if (typeof u == "function" ? f = u(e, f) : f instanceof Date ? f = h?.(f) : n === "comma" && A(f) && (f = pe(f, function(g) {
|
|
191
117
|
return g instanceof Date ? h?.(g) : g;
|
|
192
118
|
})), f === null) {
|
|
193
119
|
if (o)
|
|
194
120
|
return c && !E ? (
|
|
195
121
|
// @ts-expect-error
|
|
196
|
-
c(e, y.encoder,
|
|
122
|
+
c(e, y.encoder, S, "key", m)
|
|
197
123
|
) : e;
|
|
198
124
|
f = "";
|
|
199
125
|
}
|
|
200
|
-
if (
|
|
126
|
+
if (ct(f) || st(f)) {
|
|
201
127
|
if (c) {
|
|
202
|
-
const g = E ? e : c(e, y.encoder,
|
|
128
|
+
const g = E ? e : c(e, y.encoder, S, "key", m);
|
|
203
129
|
return [
|
|
204
|
-
|
|
205
|
-
|
|
130
|
+
b?.(g) + "=" + // @ts-expect-error
|
|
131
|
+
b?.(c(f, y.encoder, S, "value", m))
|
|
206
132
|
];
|
|
207
133
|
}
|
|
208
|
-
return [
|
|
134
|
+
return [b?.(e) + "=" + b?.(String(f))];
|
|
209
135
|
}
|
|
210
|
-
const
|
|
136
|
+
const X = [];
|
|
211
137
|
if (typeof f > "u")
|
|
212
|
-
return
|
|
138
|
+
return X;
|
|
213
139
|
let I;
|
|
214
|
-
if (
|
|
215
|
-
E && c && (f =
|
|
140
|
+
if (n === "comma" && A(f))
|
|
141
|
+
E && c && (f = pe(f, c)), I = [{ value: f.length > 0 ? f.join(",") || null : void 0 }];
|
|
216
142
|
else if (A(u))
|
|
217
143
|
I = u;
|
|
218
144
|
else {
|
|
219
145
|
const g = Object.keys(f);
|
|
220
146
|
I = p ? g.sort(p) : g;
|
|
221
147
|
}
|
|
222
|
-
const
|
|
148
|
+
const ue = l ? String(e).replace(/\./g, "%2E") : String(e), $ = r && A(f) && f.length === 1 ? ue + "[]" : ue;
|
|
223
149
|
if (s && A(f) && f.length === 0)
|
|
224
|
-
return
|
|
150
|
+
return $ + "[]";
|
|
225
151
|
for (let g = 0; g < I.length; ++g) {
|
|
226
|
-
const k = I[g],
|
|
152
|
+
const k = I[g], le = (
|
|
227
153
|
// @ts-ignore
|
|
228
154
|
typeof k == "object" && typeof k.value < "u" ? k.value : f[k]
|
|
229
155
|
);
|
|
230
|
-
if (i &&
|
|
156
|
+
if (i && le === null)
|
|
231
157
|
continue;
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
r,
|
|
158
|
+
const K = a && l ? k.replace(/\./g, "%2E") : k, Ve = A(f) ? typeof n == "function" ? n($, K) : $ : $ + (a ? "." + K : "[" + K + "]");
|
|
159
|
+
z.set(t, U);
|
|
160
|
+
const fe = /* @__PURE__ */ new WeakMap();
|
|
161
|
+
fe.set(V, z), Se(X, Re(
|
|
162
|
+
le,
|
|
163
|
+
Ve,
|
|
239
164
|
n,
|
|
165
|
+
r,
|
|
240
166
|
s,
|
|
241
167
|
o,
|
|
242
168
|
i,
|
|
243
169
|
l,
|
|
244
170
|
// @ts-ignore
|
|
245
|
-
|
|
171
|
+
n === "comma" && E && A(f) ? null : c,
|
|
246
172
|
u,
|
|
247
173
|
p,
|
|
248
174
|
a,
|
|
249
175
|
h,
|
|
250
176
|
m,
|
|
251
|
-
|
|
177
|
+
b,
|
|
252
178
|
E,
|
|
253
|
-
|
|
254
|
-
|
|
179
|
+
S,
|
|
180
|
+
fe
|
|
255
181
|
));
|
|
256
182
|
}
|
|
257
|
-
return
|
|
183
|
+
return X;
|
|
258
184
|
}
|
|
259
|
-
function
|
|
185
|
+
function ut(t = y) {
|
|
260
186
|
if (typeof t.allowEmptyArrays < "u" && typeof t.allowEmptyArrays != "boolean")
|
|
261
187
|
throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
|
|
262
188
|
if (typeof t.encodeDotInKeys < "u" && typeof t.encodeDotInKeys != "boolean")
|
|
@@ -266,17 +192,17 @@ function ft(t = y) {
|
|
|
266
192
|
const e = t.charset || y.charset;
|
|
267
193
|
if (typeof t.charset < "u" && t.charset !== "utf-8" && t.charset !== "iso-8859-1")
|
|
268
194
|
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
|
269
|
-
let
|
|
195
|
+
let n = J;
|
|
270
196
|
if (typeof t.format < "u") {
|
|
271
|
-
if (!
|
|
197
|
+
if (!ot.call(Y, t.format))
|
|
272
198
|
throw new TypeError("Unknown format option provided.");
|
|
273
|
-
|
|
199
|
+
n = t.format;
|
|
274
200
|
}
|
|
275
|
-
const
|
|
201
|
+
const r = Y[n];
|
|
276
202
|
let s = y.filter;
|
|
277
203
|
(typeof t.filter == "function" || A(t.filter)) && (s = t.filter);
|
|
278
204
|
let o;
|
|
279
|
-
if (t.arrayFormat && t.arrayFormat in
|
|
205
|
+
if (t.arrayFormat && t.arrayFormat in Ae ? o = t.arrayFormat : "indices" in t ? o = t.indices ? "indices" : "repeat" : o = y.arrayFormat, "commaRoundTrip" in t && typeof t.commaRoundTrip != "boolean")
|
|
280
206
|
throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
|
|
281
207
|
const i = typeof t.allowDots > "u" ? t.encodeDotInKeys ? !0 : y.allowDots : !!t.allowDots;
|
|
282
208
|
return {
|
|
@@ -294,8 +220,8 @@ function ft(t = y) {
|
|
|
294
220
|
encoder: typeof t.encoder == "function" ? t.encoder : y.encoder,
|
|
295
221
|
encodeValuesOnly: typeof t.encodeValuesOnly == "boolean" ? t.encodeValuesOnly : y.encodeValuesOnly,
|
|
296
222
|
filter: s,
|
|
297
|
-
format:
|
|
298
|
-
formatter:
|
|
223
|
+
format: n,
|
|
224
|
+
formatter: r,
|
|
299
225
|
serializeDate: typeof t.serializeDate == "function" ? t.serializeDate : y.serializeDate,
|
|
300
226
|
skipNulls: typeof t.skipNulls == "boolean" ? t.skipNulls : y.skipNulls,
|
|
301
227
|
// @ts-ignore
|
|
@@ -303,175 +229,175 @@ function ft(t = y) {
|
|
|
303
229
|
strictNullHandling: typeof t.strictNullHandling == "boolean" ? t.strictNullHandling : y.strictNullHandling
|
|
304
230
|
};
|
|
305
231
|
}
|
|
306
|
-
function
|
|
307
|
-
let
|
|
308
|
-
const
|
|
232
|
+
function lt(t, e = {}) {
|
|
233
|
+
let n = t;
|
|
234
|
+
const r = ut(e);
|
|
309
235
|
let s, o;
|
|
310
|
-
typeof
|
|
236
|
+
typeof r.filter == "function" ? (o = r.filter, n = o("", n)) : A(r.filter) && (o = r.filter, s = o);
|
|
311
237
|
const i = [];
|
|
312
|
-
if (typeof
|
|
238
|
+
if (typeof n != "object" || n === null)
|
|
313
239
|
return "";
|
|
314
|
-
const l =
|
|
315
|
-
s || (s = Object.keys(
|
|
240
|
+
const l = Ae[r.arrayFormat], c = l === "comma" && r.commaRoundTrip;
|
|
241
|
+
s || (s = Object.keys(n)), r.sort && s.sort(r.sort);
|
|
316
242
|
const u = /* @__PURE__ */ new WeakMap();
|
|
317
243
|
for (let h = 0; h < s.length; ++h) {
|
|
318
244
|
const m = s[h];
|
|
319
|
-
|
|
320
|
-
|
|
245
|
+
r.skipNulls && n[m] === null || Se(i, Re(
|
|
246
|
+
n[m],
|
|
321
247
|
m,
|
|
322
248
|
// @ts-expect-error
|
|
323
249
|
l,
|
|
324
250
|
c,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
251
|
+
r.allowEmptyArrays,
|
|
252
|
+
r.strictNullHandling,
|
|
253
|
+
r.skipNulls,
|
|
254
|
+
r.encodeDotInKeys,
|
|
255
|
+
r.encode ? r.encoder : null,
|
|
256
|
+
r.filter,
|
|
257
|
+
r.sort,
|
|
258
|
+
r.allowDots,
|
|
259
|
+
r.serializeDate,
|
|
260
|
+
r.format,
|
|
261
|
+
r.formatter,
|
|
262
|
+
r.encodeValuesOnly,
|
|
263
|
+
r.charset,
|
|
338
264
|
u
|
|
339
265
|
));
|
|
340
266
|
}
|
|
341
|
-
const p = i.join(
|
|
342
|
-
let a =
|
|
343
|
-
return
|
|
267
|
+
const p = i.join(r.delimiter);
|
|
268
|
+
let a = r.addQueryPrefix === !0 ? "?" : "";
|
|
269
|
+
return r.charsetSentinel && (r.charset === "iso-8859-1" ? a += "utf8=%26%2310003%3B&" : a += "utf8=%E2%9C%93&"), p.length > 0 ? a + p : "";
|
|
344
270
|
}
|
|
345
271
|
const T = "1.9.1";
|
|
346
272
|
class P extends Error {
|
|
347
273
|
}
|
|
348
274
|
class w extends P {
|
|
349
|
-
constructor(e,
|
|
350
|
-
super(`${w.makeMessage(e,
|
|
275
|
+
constructor(e, n, r, s) {
|
|
276
|
+
super(`${w.makeMessage(e, n, r)}`), this.status = e, this.headers = s, this.error = n;
|
|
351
277
|
}
|
|
352
|
-
static makeMessage(e,
|
|
353
|
-
const s =
|
|
278
|
+
static makeMessage(e, n, r) {
|
|
279
|
+
const s = n?.message ? typeof n.message == "string" ? n.message : JSON.stringify(n.message) : n ? JSON.stringify(n) : r;
|
|
354
280
|
return e && s ? `${e} ${s}` : e ? `${e} status code (no body)` : s || "(no status code or body)";
|
|
355
281
|
}
|
|
356
|
-
static generate(e,
|
|
282
|
+
static generate(e, n, r, s) {
|
|
357
283
|
if (!e || !s)
|
|
358
|
-
return new
|
|
359
|
-
const o =
|
|
360
|
-
return e === 400 ? new
|
|
284
|
+
return new F({ message: r, cause: ee(n) });
|
|
285
|
+
const o = n;
|
|
286
|
+
return e === 400 ? new Pe(e, o, r, s) : e === 401 ? new ke(e, o, r, s) : e === 403 ? new Te(e, o, r, s) : e === 404 ? new Ce(e, o, r, s) : e === 409 ? new ve(e, o, r, s) : e === 422 ? new Ie(e, o, r, s) : e === 429 ? new Le(e, o, r, s) : e >= 500 ? new Oe(e, o, r, s) : new w(e, o, r, s);
|
|
361
287
|
}
|
|
362
288
|
}
|
|
363
|
-
class
|
|
289
|
+
class Z extends w {
|
|
364
290
|
constructor({ message: e } = {}) {
|
|
365
291
|
super(void 0, void 0, e || "Request was aborted.", void 0);
|
|
366
292
|
}
|
|
367
293
|
}
|
|
368
|
-
class
|
|
369
|
-
constructor({ message: e, cause:
|
|
370
|
-
super(void 0, void 0, e || "Connection error.", void 0),
|
|
294
|
+
class F extends w {
|
|
295
|
+
constructor({ message: e, cause: n }) {
|
|
296
|
+
super(void 0, void 0, e || "Connection error.", void 0), n && (this.cause = n);
|
|
371
297
|
}
|
|
372
298
|
}
|
|
373
|
-
class
|
|
299
|
+
class Ee extends F {
|
|
374
300
|
constructor({ message: e } = {}) {
|
|
375
301
|
super({ message: e ?? "Request timed out." });
|
|
376
302
|
}
|
|
377
303
|
}
|
|
378
|
-
class
|
|
304
|
+
class Pe extends w {
|
|
379
305
|
}
|
|
380
|
-
class
|
|
306
|
+
class ke extends w {
|
|
381
307
|
}
|
|
382
|
-
class
|
|
308
|
+
class Te extends w {
|
|
383
309
|
}
|
|
384
|
-
class
|
|
310
|
+
class Ce extends w {
|
|
385
311
|
}
|
|
386
|
-
class
|
|
312
|
+
class ve extends w {
|
|
387
313
|
}
|
|
388
|
-
class
|
|
314
|
+
class Ie extends w {
|
|
389
315
|
}
|
|
390
|
-
class
|
|
316
|
+
class Le extends w {
|
|
391
317
|
}
|
|
392
|
-
class
|
|
318
|
+
class Oe extends w {
|
|
393
319
|
}
|
|
394
|
-
const
|
|
395
|
-
|
|
320
|
+
const De = () => {
|
|
321
|
+
_e || Qe(Ge(), { auto: !0 });
|
|
396
322
|
};
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
async function
|
|
400
|
-
if (t = await t,
|
|
323
|
+
De();
|
|
324
|
+
const ft = (t) => t != null && typeof t == "object" && typeof t.url == "string" && typeof t.blob == "function", dt = (t) => t != null && typeof t == "object" && typeof t.name == "string" && typeof t.lastModified == "number" && q(t), q = (t) => t != null && typeof t == "object" && typeof t.size == "number" && typeof t.type == "string" && typeof t.text == "function" && typeof t.slice == "function" && typeof t.arrayBuffer == "function";
|
|
325
|
+
async function ht(t, e, n) {
|
|
326
|
+
if (t = await t, dt(t))
|
|
401
327
|
return t;
|
|
402
|
-
if (
|
|
328
|
+
if (ft(t)) {
|
|
403
329
|
const s = await t.blob();
|
|
404
330
|
e || (e = new URL(t.url).pathname.split(/[\\/]/).pop() ?? "unknown_file");
|
|
405
|
-
const o =
|
|
406
|
-
return new
|
|
331
|
+
const o = q(s) ? [await s.arrayBuffer()] : [s];
|
|
332
|
+
return new de(o, e, n);
|
|
407
333
|
}
|
|
408
|
-
const
|
|
409
|
-
if (e || (e =
|
|
410
|
-
const s =
|
|
411
|
-
typeof s == "string" && (
|
|
334
|
+
const r = await pt(t);
|
|
335
|
+
if (e || (e = mt(t) ?? "unknown_file"), !n?.type) {
|
|
336
|
+
const s = r[0]?.type;
|
|
337
|
+
typeof s == "string" && (n = { ...n, type: s });
|
|
412
338
|
}
|
|
413
|
-
return new
|
|
339
|
+
return new de(r, e, n);
|
|
414
340
|
}
|
|
415
|
-
async function
|
|
341
|
+
async function pt(t) {
|
|
416
342
|
let e = [];
|
|
417
343
|
if (typeof t == "string" || ArrayBuffer.isView(t) || // includes Uint8Array, Buffer, etc.
|
|
418
344
|
t instanceof ArrayBuffer)
|
|
419
345
|
e.push(t);
|
|
420
|
-
else if (
|
|
346
|
+
else if (q(t))
|
|
421
347
|
e.push(await t.arrayBuffer());
|
|
422
|
-
else if (
|
|
423
|
-
for await (const
|
|
424
|
-
e.push(
|
|
348
|
+
else if (gt(t))
|
|
349
|
+
for await (const n of t)
|
|
350
|
+
e.push(n);
|
|
425
351
|
else
|
|
426
|
-
throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${
|
|
352
|
+
throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${yt(t)}`);
|
|
427
353
|
return e;
|
|
428
354
|
}
|
|
429
|
-
function
|
|
430
|
-
return `[${Object.getOwnPropertyNames(t).map((
|
|
355
|
+
function yt(t) {
|
|
356
|
+
return `[${Object.getOwnPropertyNames(t).map((n) => `"${n}"`).join(", ")}]`;
|
|
431
357
|
}
|
|
432
|
-
function
|
|
433
|
-
return
|
|
434
|
-
|
|
358
|
+
function mt(t) {
|
|
359
|
+
return Q(t.name) || Q(t.filename) || // For fs.ReadStream
|
|
360
|
+
Q(t.path)?.split(/[\\/]/).pop();
|
|
435
361
|
}
|
|
436
|
-
const
|
|
362
|
+
const Q = (t) => {
|
|
437
363
|
if (typeof t == "string")
|
|
438
364
|
return t;
|
|
439
365
|
if (typeof Buffer < "u" && t instanceof Buffer)
|
|
440
366
|
return String(t);
|
|
441
|
-
},
|
|
442
|
-
var
|
|
443
|
-
if (
|
|
444
|
-
if (
|
|
367
|
+
}, gt = (t) => t != null && typeof t == "object" && typeof t[Symbol.asyncIterator] == "function", ye = (t) => t && typeof t == "object" && t.body && t[Symbol.toStringTag] === "MultipartBody";
|
|
368
|
+
var Ue = function(t, e, n, r, s) {
|
|
369
|
+
if (r === "m") throw new TypeError("Private method is not writable");
|
|
370
|
+
if (r === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
|
|
445
371
|
if (typeof e == "function" ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
446
|
-
return
|
|
447
|
-
},
|
|
448
|
-
if (
|
|
449
|
-
if (typeof e == "function" ? t !== e || !
|
|
450
|
-
return
|
|
451
|
-
}, M,
|
|
452
|
-
|
|
453
|
-
async function
|
|
372
|
+
return r === "a" ? s.call(t, n) : s ? s.value = n : e.set(t, n), n;
|
|
373
|
+
}, $e = function(t, e, n, r) {
|
|
374
|
+
if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
|
|
375
|
+
if (typeof e == "function" ? t !== e || !r : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
376
|
+
return n === "m" ? r : n === "a" ? r.call(t) : r ? r.value : e.get(t);
|
|
377
|
+
}, M, j;
|
|
378
|
+
De();
|
|
379
|
+
async function je(t) {
|
|
454
380
|
const { response: e } = t;
|
|
455
381
|
if (e.status === 204)
|
|
456
382
|
return null;
|
|
457
383
|
if (t.options.__binaryResponse)
|
|
458
384
|
return e;
|
|
459
|
-
const
|
|
460
|
-
if (
|
|
385
|
+
const r = e.headers.get("content-type")?.split(";")[0]?.trim();
|
|
386
|
+
if (r?.includes("application/json") || r?.endsWith("+json")) {
|
|
461
387
|
const i = await e.json();
|
|
462
388
|
return L("response", e.status, e.url, e.headers, i), i;
|
|
463
389
|
}
|
|
464
390
|
const o = await e.text();
|
|
465
391
|
return L("response", e.status, e.url, e.headers, o), o;
|
|
466
392
|
}
|
|
467
|
-
class
|
|
468
|
-
constructor(e,
|
|
469
|
-
super((
|
|
470
|
-
|
|
471
|
-
}), this.responsePromise = e, this.parseResponse =
|
|
393
|
+
class B extends Promise {
|
|
394
|
+
constructor(e, n = je) {
|
|
395
|
+
super((r) => {
|
|
396
|
+
r(null);
|
|
397
|
+
}), this.responsePromise = e, this.parseResponse = n;
|
|
472
398
|
}
|
|
473
399
|
_thenUnwrap(e) {
|
|
474
|
-
return new
|
|
400
|
+
return new B(this.responsePromise, async (n) => e(await this.parseResponse(n), n));
|
|
475
401
|
}
|
|
476
402
|
/**
|
|
477
403
|
* Gets the raw `Response` instance instead of parsing the response
|
|
@@ -503,14 +429,14 @@ class H extends Promise {
|
|
|
503
429
|
* - `import '@arcadeai/arcadejs/shims/web'` (otherwise)
|
|
504
430
|
*/
|
|
505
431
|
async withResponse() {
|
|
506
|
-
const [e,
|
|
507
|
-
return { data: e, response:
|
|
432
|
+
const [e, n] = await Promise.all([this.parse(), this.asResponse()]);
|
|
433
|
+
return { data: e, response: n };
|
|
508
434
|
}
|
|
509
435
|
parse() {
|
|
510
436
|
return this.parsedPromise || (this.parsedPromise = this.responsePromise.then(this.parseResponse)), this.parsedPromise;
|
|
511
437
|
}
|
|
512
|
-
then(e,
|
|
513
|
-
return this.parse().then(e,
|
|
438
|
+
then(e, n) {
|
|
439
|
+
return this.parse().then(e, n);
|
|
514
440
|
}
|
|
515
441
|
catch(e) {
|
|
516
442
|
return this.parse().catch(e);
|
|
@@ -519,17 +445,17 @@ class H extends Promise {
|
|
|
519
445
|
return this.parse().finally(e);
|
|
520
446
|
}
|
|
521
447
|
}
|
|
522
|
-
class
|
|
448
|
+
class wt {
|
|
523
449
|
constructor({
|
|
524
450
|
baseURL: e,
|
|
525
|
-
baseURLOverridden:
|
|
526
|
-
maxRetries:
|
|
451
|
+
baseURLOverridden: n,
|
|
452
|
+
maxRetries: r = 2,
|
|
527
453
|
timeout: s = 6e4,
|
|
528
454
|
// 1 minute
|
|
529
455
|
httpAgent: o,
|
|
530
456
|
fetch: i
|
|
531
457
|
}) {
|
|
532
|
-
M.set(this, void 0), this.baseURL = e,
|
|
458
|
+
M.set(this, void 0), this.baseURL = e, Ue(this, M, n, "f"), this.maxRetries = G("maxRetries", r), this.timeout = G("timeout", s), this.httpAgent = o, this.fetch = i ?? Je;
|
|
533
459
|
}
|
|
534
460
|
authHeaders(e) {
|
|
535
461
|
return {};
|
|
@@ -547,41 +473,41 @@ class xt {
|
|
|
547
473
|
Accept: "application/json",
|
|
548
474
|
...["head", "get"].includes(e.method) ? {} : { "Content-Type": "application/json" },
|
|
549
475
|
"User-Agent": this.getUserAgent(),
|
|
550
|
-
...
|
|
476
|
+
...Et(),
|
|
551
477
|
...this.authHeaders(e)
|
|
552
478
|
};
|
|
553
479
|
}
|
|
554
480
|
/**
|
|
555
481
|
* Override this to add your own headers validation:
|
|
556
482
|
*/
|
|
557
|
-
validateHeaders(e,
|
|
483
|
+
validateHeaders(e, n) {
|
|
558
484
|
}
|
|
559
485
|
defaultIdempotencyKey() {
|
|
560
|
-
return `stainless-node-retry-${
|
|
486
|
+
return `stainless-node-retry-${vt()}`;
|
|
561
487
|
}
|
|
562
|
-
get(e,
|
|
563
|
-
return this.methodRequest("get", e,
|
|
488
|
+
get(e, n) {
|
|
489
|
+
return this.methodRequest("get", e, n);
|
|
564
490
|
}
|
|
565
|
-
post(e,
|
|
566
|
-
return this.methodRequest("post", e,
|
|
491
|
+
post(e, n) {
|
|
492
|
+
return this.methodRequest("post", e, n);
|
|
567
493
|
}
|
|
568
|
-
patch(e,
|
|
569
|
-
return this.methodRequest("patch", e,
|
|
494
|
+
patch(e, n) {
|
|
495
|
+
return this.methodRequest("patch", e, n);
|
|
570
496
|
}
|
|
571
|
-
put(e,
|
|
572
|
-
return this.methodRequest("put", e,
|
|
497
|
+
put(e, n) {
|
|
498
|
+
return this.methodRequest("put", e, n);
|
|
573
499
|
}
|
|
574
|
-
delete(e,
|
|
575
|
-
return this.methodRequest("delete", e,
|
|
500
|
+
delete(e, n) {
|
|
501
|
+
return this.methodRequest("delete", e, n);
|
|
576
502
|
}
|
|
577
|
-
methodRequest(e,
|
|
578
|
-
return this.request(Promise.resolve(
|
|
579
|
-
const o = s &&
|
|
580
|
-
return { method: e, path:
|
|
503
|
+
methodRequest(e, n, r) {
|
|
504
|
+
return this.request(Promise.resolve(r).then(async (s) => {
|
|
505
|
+
const o = s && q(s?.body) ? new DataView(await s.body.arrayBuffer()) : s?.body instanceof DataView ? s.body : s?.body instanceof ArrayBuffer ? new DataView(s.body) : s && ArrayBuffer.isView(s?.body) ? new DataView(s.body.buffer) : s?.body;
|
|
506
|
+
return { method: e, path: n, ...s, body: o };
|
|
581
507
|
}));
|
|
582
508
|
}
|
|
583
|
-
getAPIList(e,
|
|
584
|
-
return this.requestAPIList(
|
|
509
|
+
getAPIList(e, n, r) {
|
|
510
|
+
return this.requestAPIList(n, { method: "get", path: e, ...r });
|
|
585
511
|
}
|
|
586
512
|
calculateContentLength(e) {
|
|
587
513
|
if (typeof e == "string") {
|
|
@@ -593,27 +519,27 @@ class xt {
|
|
|
593
519
|
return e.byteLength.toString();
|
|
594
520
|
return null;
|
|
595
521
|
}
|
|
596
|
-
async buildRequest(e, { retryCount:
|
|
597
|
-
const
|
|
598
|
-
"timeout" in
|
|
599
|
-
const h =
|
|
522
|
+
async buildRequest(e, { retryCount: n = 0 } = {}) {
|
|
523
|
+
const r = { ...e }, { method: s, path: o, query: i, defaultBaseURL: l, headers: c = {} } = r, u = ArrayBuffer.isView(r.body) || r.__binaryRequest && typeof r.body == "string" ? r.body : ye(r.body) ? r.body.body : r.body ? JSON.stringify(r.body, null, 2) : null, p = this.calculateContentLength(u), a = this.buildURL(o, i, l);
|
|
524
|
+
"timeout" in r && G("timeout", r.timeout), r.timeout = r.timeout ?? this.timeout;
|
|
525
|
+
const h = r.httpAgent ?? this.httpAgent ?? Ye(a), m = r.timeout + 1e3;
|
|
600
526
|
typeof h?.options?.timeout == "number" && m > (h.options.timeout ?? 0) && (h.options.timeout = m), this.idempotencyHeader && s !== "get" && (e.idempotencyKey || (e.idempotencyKey = this.defaultIdempotencyKey()), c[this.idempotencyHeader] = e.idempotencyKey);
|
|
601
|
-
const
|
|
527
|
+
const b = this.buildHeaders({ options: r, headers: c, contentLength: p, retryCount: n });
|
|
602
528
|
return { req: {
|
|
603
529
|
method: s,
|
|
604
530
|
...u && { body: u },
|
|
605
|
-
headers:
|
|
531
|
+
headers: b,
|
|
606
532
|
...h && { agent: h },
|
|
607
533
|
// @ts-ignore node-fetch uses a custom AbortSignal type that is
|
|
608
534
|
// not compatible with standard web types
|
|
609
|
-
signal:
|
|
610
|
-
}, url: a, timeout:
|
|
535
|
+
signal: r.signal ?? null
|
|
536
|
+
}, url: a, timeout: r.timeout };
|
|
611
537
|
}
|
|
612
|
-
buildHeaders({ options: e, headers:
|
|
538
|
+
buildHeaders({ options: e, headers: n, contentLength: r, retryCount: s }) {
|
|
613
539
|
const o = {};
|
|
614
|
-
|
|
540
|
+
r && (o["content-length"] = r);
|
|
615
541
|
const i = this.defaultHeaders(e);
|
|
616
|
-
return
|
|
542
|
+
return be(o, i), be(o, n), ye(e.body) && _e !== "node" && delete o["content-type"], N(i, "x-stainless-retry-count") === void 0 && N(n, "x-stainless-retry-count") === void 0 && (o["x-stainless-retry-count"] = String(s)), N(i, "x-stainless-timeout") === void 0 && N(n, "x-stainless-timeout") === void 0 && e.timeout && (o["x-stainless-timeout"] = String(Math.trunc(e.timeout / 1e3))), this.validateHeaders(o, n), o;
|
|
617
543
|
}
|
|
618
544
|
/**
|
|
619
545
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
@@ -626,65 +552,65 @@ class xt {
|
|
|
626
552
|
* This is useful for cases where you want to add certain headers based off of
|
|
627
553
|
* the request properties, e.g. `method` or `url`.
|
|
628
554
|
*/
|
|
629
|
-
async prepareRequest(e, { url:
|
|
555
|
+
async prepareRequest(e, { url: n, options: r }) {
|
|
630
556
|
}
|
|
631
557
|
parseHeaders(e) {
|
|
632
|
-
return e ? Symbol.iterator in e ? Object.fromEntries(Array.from(e).map((
|
|
558
|
+
return e ? Symbol.iterator in e ? Object.fromEntries(Array.from(e).map((n) => [...n])) : { ...e } : {};
|
|
633
559
|
}
|
|
634
|
-
makeStatusError(e,
|
|
635
|
-
return w.generate(e,
|
|
560
|
+
makeStatusError(e, n, r, s) {
|
|
561
|
+
return w.generate(e, n, r, s);
|
|
636
562
|
}
|
|
637
|
-
request(e,
|
|
638
|
-
return new
|
|
563
|
+
request(e, n = null) {
|
|
564
|
+
return new B(this.makeRequest(e, n));
|
|
639
565
|
}
|
|
640
|
-
async makeRequest(e,
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
const { req: o, url: i, timeout: l } = await this.buildRequest(
|
|
644
|
-
retryCount: s -
|
|
566
|
+
async makeRequest(e, n) {
|
|
567
|
+
const r = await e, s = r.maxRetries ?? this.maxRetries;
|
|
568
|
+
n == null && (n = s), await this.prepareOptions(r);
|
|
569
|
+
const { req: o, url: i, timeout: l } = await this.buildRequest(r, {
|
|
570
|
+
retryCount: s - n
|
|
645
571
|
});
|
|
646
|
-
if (await this.prepareRequest(o, { url: i, options:
|
|
647
|
-
throw new
|
|
648
|
-
const c = new AbortController(), u = await this.fetchWithTimeout(i, o, l, c).catch(
|
|
572
|
+
if (await this.prepareRequest(o, { url: i, options: r }), L("request", i, r, o.headers), r.signal?.aborted)
|
|
573
|
+
throw new Z();
|
|
574
|
+
const c = new AbortController(), u = await this.fetchWithTimeout(i, o, l, c).catch(ee);
|
|
649
575
|
if (u instanceof Error) {
|
|
650
|
-
if (
|
|
651
|
-
throw new
|
|
652
|
-
if (
|
|
653
|
-
return this.retryRequest(
|
|
654
|
-
throw u.name === "AbortError" ? new
|
|
576
|
+
if (r.signal?.aborted)
|
|
577
|
+
throw new Z();
|
|
578
|
+
if (n)
|
|
579
|
+
return this.retryRequest(r, n);
|
|
580
|
+
throw u.name === "AbortError" ? new Ee() : new F({ cause: u });
|
|
655
581
|
}
|
|
656
|
-
const p =
|
|
582
|
+
const p = _t(u.headers);
|
|
657
583
|
if (!u.ok) {
|
|
658
|
-
if (
|
|
659
|
-
const
|
|
660
|
-
return L(`response (error; ${
|
|
584
|
+
if (n && this.shouldRetry(u)) {
|
|
585
|
+
const S = `retrying, ${n} attempts remaining`;
|
|
586
|
+
return L(`response (error; ${S})`, u.status, i, p), this.retryRequest(r, n, p);
|
|
661
587
|
}
|
|
662
|
-
const a = await u.text().catch((
|
|
663
|
-
throw L(`response (error; ${
|
|
588
|
+
const a = await u.text().catch((S) => ee(S).message), h = Pt(a), m = h ? void 0 : a;
|
|
589
|
+
throw L(`response (error; ${n ? "(error; no more retries left)" : "(error; not retryable)"})`, u.status, i, p, m), this.makeStatusError(u.status, h, m, p);
|
|
664
590
|
}
|
|
665
|
-
return { response: u, options:
|
|
591
|
+
return { response: u, options: r, controller: c };
|
|
666
592
|
}
|
|
667
|
-
requestAPIList(e,
|
|
668
|
-
const
|
|
669
|
-
return new
|
|
593
|
+
requestAPIList(e, n) {
|
|
594
|
+
const r = this.makeRequest(n, null);
|
|
595
|
+
return new bt(this, r, e);
|
|
670
596
|
}
|
|
671
|
-
buildURL(e,
|
|
672
|
-
const s =
|
|
673
|
-
return
|
|
597
|
+
buildURL(e, n, r) {
|
|
598
|
+
const s = !$e(this, M, "f") && r || this.baseURL, o = Tt(e) ? new URL(e) : new URL(s + (s.endsWith("/") && e.startsWith("/") ? e.slice(1) : e)), i = this.defaultQuery();
|
|
599
|
+
return Ne(i) || (n = { ...i, ...n }), typeof n == "object" && n && !Array.isArray(n) && (o.search = this.stringifyQuery(n)), o.toString();
|
|
674
600
|
}
|
|
675
601
|
stringifyQuery(e) {
|
|
676
|
-
return Object.entries(e).filter(([
|
|
677
|
-
if (typeof
|
|
678
|
-
return `${encodeURIComponent(
|
|
679
|
-
if (
|
|
680
|
-
return `${encodeURIComponent(
|
|
681
|
-
throw new P(`Cannot stringify type ${typeof
|
|
602
|
+
return Object.entries(e).filter(([n, r]) => typeof r < "u").map(([n, r]) => {
|
|
603
|
+
if (typeof r == "string" || typeof r == "number" || typeof r == "boolean")
|
|
604
|
+
return `${encodeURIComponent(n)}=${encodeURIComponent(r)}`;
|
|
605
|
+
if (r === null)
|
|
606
|
+
return `${encodeURIComponent(n)}=`;
|
|
607
|
+
throw new P(`Cannot stringify type ${typeof r}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`);
|
|
682
608
|
}).join("&");
|
|
683
609
|
}
|
|
684
|
-
async fetchWithTimeout(e,
|
|
685
|
-
const { signal: o, ...i } =
|
|
610
|
+
async fetchWithTimeout(e, n, r, s) {
|
|
611
|
+
const { signal: o, ...i } = n || {};
|
|
686
612
|
o && o.addEventListener("abort", () => s.abort());
|
|
687
|
-
const l = setTimeout(() => s.abort(),
|
|
613
|
+
const l = setTimeout(() => s.abort(), r), c = {
|
|
688
614
|
signal: s.signal,
|
|
689
615
|
...i
|
|
690
616
|
};
|
|
@@ -694,29 +620,29 @@ class xt {
|
|
|
694
620
|
});
|
|
695
621
|
}
|
|
696
622
|
shouldRetry(e) {
|
|
697
|
-
const
|
|
698
|
-
return
|
|
623
|
+
const n = e.headers.get("x-should-retry");
|
|
624
|
+
return n === "true" ? !0 : n === "false" ? !1 : e.status === 408 || e.status === 409 || e.status === 429 || e.status >= 500;
|
|
699
625
|
}
|
|
700
|
-
async retryRequest(e,
|
|
626
|
+
async retryRequest(e, n, r) {
|
|
701
627
|
let s;
|
|
702
|
-
const o =
|
|
628
|
+
const o = r?.["retry-after-ms"];
|
|
703
629
|
if (o) {
|
|
704
630
|
const l = parseFloat(o);
|
|
705
631
|
Number.isNaN(l) || (s = l);
|
|
706
632
|
}
|
|
707
|
-
const i =
|
|
633
|
+
const i = r?.["retry-after"];
|
|
708
634
|
if (i && !s) {
|
|
709
635
|
const l = parseFloat(i);
|
|
710
636
|
Number.isNaN(l) ? s = Date.parse(i) - Date.now() : s = l * 1e3;
|
|
711
637
|
}
|
|
712
638
|
if (!(s && 0 <= s && s < 60 * 1e3)) {
|
|
713
639
|
const l = e.maxRetries ?? this.maxRetries;
|
|
714
|
-
s = this.calculateDefaultRetryTimeoutMillis(
|
|
640
|
+
s = this.calculateDefaultRetryTimeoutMillis(n, l);
|
|
715
641
|
}
|
|
716
|
-
return await
|
|
642
|
+
return await Ct(s), this.makeRequest(e, n - 1);
|
|
717
643
|
}
|
|
718
|
-
calculateDefaultRetryTimeoutMillis(e,
|
|
719
|
-
const o =
|
|
644
|
+
calculateDefaultRetryTimeoutMillis(e, n) {
|
|
645
|
+
const o = n - e, i = Math.min(0.5 * Math.pow(2, o), 8), l = 1 - Math.random() * 0.25;
|
|
720
646
|
return i * l * 1e3;
|
|
721
647
|
}
|
|
722
648
|
getUserAgent() {
|
|
@@ -724,9 +650,9 @@ class xt {
|
|
|
724
650
|
}
|
|
725
651
|
}
|
|
726
652
|
M = /* @__PURE__ */ new WeakMap();
|
|
727
|
-
class
|
|
728
|
-
constructor(e,
|
|
729
|
-
|
|
653
|
+
class xt {
|
|
654
|
+
constructor(e, n, r, s) {
|
|
655
|
+
j.set(this, void 0), Ue(this, j, e, "f"), this.options = s, this.response = n, this.body = r;
|
|
730
656
|
}
|
|
731
657
|
hasNextPage() {
|
|
732
658
|
return this.getPaginatedItems().length ? this.nextPageInfo() != null : !1;
|
|
@@ -735,31 +661,31 @@ class _t {
|
|
|
735
661
|
const e = this.nextPageInfo();
|
|
736
662
|
if (!e)
|
|
737
663
|
throw new P("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");
|
|
738
|
-
const
|
|
739
|
-
if ("params" in e && typeof
|
|
740
|
-
|
|
664
|
+
const n = { ...this.options };
|
|
665
|
+
if ("params" in e && typeof n.query == "object")
|
|
666
|
+
n.query = { ...n.query, ...e.params };
|
|
741
667
|
else if ("url" in e) {
|
|
742
|
-
const
|
|
743
|
-
for (const [s, o] of
|
|
668
|
+
const r = [...Object.entries(n.query || {}), ...e.url.searchParams.entries()];
|
|
669
|
+
for (const [s, o] of r)
|
|
744
670
|
e.url.searchParams.set(s, o);
|
|
745
|
-
|
|
671
|
+
n.query = void 0, n.path = e.url.toString();
|
|
746
672
|
}
|
|
747
|
-
return await
|
|
673
|
+
return await $e(this, j, "f").requestAPIList(this.constructor, n);
|
|
748
674
|
}
|
|
749
675
|
async *iterPages() {
|
|
750
676
|
let e = this;
|
|
751
677
|
for (yield e; e.hasNextPage(); )
|
|
752
678
|
e = await e.getNextPage(), yield e;
|
|
753
679
|
}
|
|
754
|
-
async *[(
|
|
680
|
+
async *[(j = /* @__PURE__ */ new WeakMap(), Symbol.asyncIterator)]() {
|
|
755
681
|
for await (const e of this.iterPages())
|
|
756
|
-
for (const
|
|
757
|
-
yield
|
|
682
|
+
for (const n of e.getPaginatedItems())
|
|
683
|
+
yield n;
|
|
758
684
|
}
|
|
759
685
|
}
|
|
760
|
-
class
|
|
761
|
-
constructor(e,
|
|
762
|
-
super(
|
|
686
|
+
class bt extends B {
|
|
687
|
+
constructor(e, n, r) {
|
|
688
|
+
super(n, async (s) => new r(e, s.response, await je(s), s.options));
|
|
763
689
|
}
|
|
764
690
|
/**
|
|
765
691
|
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
@@ -770,19 +696,19 @@ class At extends H {
|
|
|
770
696
|
*/
|
|
771
697
|
async *[Symbol.asyncIterator]() {
|
|
772
698
|
const e = await this;
|
|
773
|
-
for await (const
|
|
774
|
-
yield
|
|
699
|
+
for await (const n of e)
|
|
700
|
+
yield n;
|
|
775
701
|
}
|
|
776
702
|
}
|
|
777
|
-
const
|
|
703
|
+
const _t = (t) => new Proxy(Object.fromEntries(
|
|
778
704
|
// @ts-ignore
|
|
779
705
|
t.entries()
|
|
780
706
|
), {
|
|
781
|
-
get(e,
|
|
782
|
-
const
|
|
783
|
-
return e[
|
|
707
|
+
get(e, n) {
|
|
708
|
+
const r = n.toString();
|
|
709
|
+
return e[r.toLowerCase()] || e[r];
|
|
784
710
|
}
|
|
785
|
-
}),
|
|
711
|
+
}), At = {
|
|
786
712
|
method: !0,
|
|
787
713
|
path: !0,
|
|
788
714
|
query: !0,
|
|
@@ -797,13 +723,13 @@ const Rt = (t) => new Proxy(Object.fromEntries(
|
|
|
797
723
|
idempotencyKey: !0,
|
|
798
724
|
__binaryRequest: !0,
|
|
799
725
|
__binaryResponse: !0
|
|
800
|
-
},
|
|
726
|
+
}, R = (t) => typeof t == "object" && t !== null && !Ne(t) && Object.keys(t).every((e) => Me(At, e)), St = () => {
|
|
801
727
|
if (typeof Deno < "u" && Deno.build != null)
|
|
802
728
|
return {
|
|
803
729
|
"X-Stainless-Lang": "js",
|
|
804
730
|
"X-Stainless-Package-Version": T,
|
|
805
|
-
"X-Stainless-OS":
|
|
806
|
-
"X-Stainless-Arch":
|
|
731
|
+
"X-Stainless-OS": ge(Deno.build.os),
|
|
732
|
+
"X-Stainless-Arch": me(Deno.build.arch),
|
|
807
733
|
"X-Stainless-Runtime": "deno",
|
|
808
734
|
"X-Stainless-Runtime-Version": typeof Deno.version == "string" ? Deno.version : Deno.version?.deno ?? "unknown"
|
|
809
735
|
};
|
|
@@ -820,12 +746,12 @@ const Rt = (t) => new Proxy(Object.fromEntries(
|
|
|
820
746
|
return {
|
|
821
747
|
"X-Stainless-Lang": "js",
|
|
822
748
|
"X-Stainless-Package-Version": T,
|
|
823
|
-
"X-Stainless-OS":
|
|
824
|
-
"X-Stainless-Arch":
|
|
749
|
+
"X-Stainless-OS": ge(process.platform),
|
|
750
|
+
"X-Stainless-Arch": me(process.arch),
|
|
825
751
|
"X-Stainless-Runtime": "node",
|
|
826
752
|
"X-Stainless-Runtime-Version": process.version
|
|
827
753
|
};
|
|
828
|
-
const t =
|
|
754
|
+
const t = Rt();
|
|
829
755
|
return t ? {
|
|
830
756
|
"X-Stainless-Lang": "js",
|
|
831
757
|
"X-Stainless-Package-Version": T,
|
|
@@ -842,7 +768,7 @@ const Rt = (t) => new Proxy(Object.fromEntries(
|
|
|
842
768
|
"X-Stainless-Runtime-Version": "unknown"
|
|
843
769
|
};
|
|
844
770
|
};
|
|
845
|
-
function
|
|
771
|
+
function Rt() {
|
|
846
772
|
if (typeof navigator > "u" || !navigator)
|
|
847
773
|
return null;
|
|
848
774
|
const t = [
|
|
@@ -853,30 +779,30 @@ function Pt() {
|
|
|
853
779
|
{ key: "firefox", pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
|
854
780
|
{ key: "safari", pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ }
|
|
855
781
|
];
|
|
856
|
-
for (const { key: e, pattern:
|
|
857
|
-
const
|
|
858
|
-
if (
|
|
859
|
-
const s =
|
|
782
|
+
for (const { key: e, pattern: n } of t) {
|
|
783
|
+
const r = n.exec(navigator.userAgent);
|
|
784
|
+
if (r) {
|
|
785
|
+
const s = r[1] || 0, o = r[2] || 0, i = r[3] || 0;
|
|
860
786
|
return { browser: e, version: `${s}.${o}.${i}` };
|
|
861
787
|
}
|
|
862
788
|
}
|
|
863
789
|
return null;
|
|
864
790
|
}
|
|
865
|
-
const
|
|
866
|
-
let
|
|
867
|
-
const
|
|
791
|
+
const me = (t) => t === "x32" ? "x32" : t === "x86_64" || t === "x64" ? "x64" : t === "arm" ? "arm" : t === "aarch64" || t === "arm64" ? "arm64" : t ? `other:${t}` : "unknown", ge = (t) => (t = t.toLowerCase(), t.includes("ios") ? "iOS" : t === "android" ? "Android" : t === "darwin" ? "MacOS" : t === "win32" ? "Windows" : t === "freebsd" ? "FreeBSD" : t === "openbsd" ? "OpenBSD" : t === "linux" ? "Linux" : t ? `Other:${t}` : "Unknown");
|
|
792
|
+
let we;
|
|
793
|
+
const Et = () => we ?? (we = St()), Pt = (t) => {
|
|
868
794
|
try {
|
|
869
795
|
return JSON.parse(t);
|
|
870
796
|
} catch {
|
|
871
797
|
return;
|
|
872
798
|
}
|
|
873
|
-
},
|
|
799
|
+
}, kt = /^[a-z][a-z0-9+.-]*:/i, Tt = (t) => kt.test(t), Ct = (t) => new Promise((e) => setTimeout(e, t)), G = (t, e) => {
|
|
874
800
|
if (typeof e != "number" || !Number.isInteger(e))
|
|
875
801
|
throw new P(`${t} must be an integer`);
|
|
876
802
|
if (e < 0)
|
|
877
803
|
throw new P(`${t} must be a positive integer`);
|
|
878
804
|
return e;
|
|
879
|
-
},
|
|
805
|
+
}, ee = (t) => {
|
|
880
806
|
if (t instanceof Error)
|
|
881
807
|
return t;
|
|
882
808
|
if (typeof t == "object" && t !== null)
|
|
@@ -885,56 +811,56 @@ const kt = () => xe ?? (xe = Et()), Tt = (t) => {
|
|
|
885
811
|
} catch {
|
|
886
812
|
}
|
|
887
813
|
return new Error(t);
|
|
888
|
-
},
|
|
814
|
+
}, xe = (t) => {
|
|
889
815
|
if (typeof process < "u")
|
|
890
816
|
return process.env?.[t]?.trim() ?? void 0;
|
|
891
817
|
if (typeof Deno < "u")
|
|
892
818
|
return Deno.env?.get?.(t)?.trim();
|
|
893
819
|
};
|
|
894
|
-
function
|
|
820
|
+
function Ne(t) {
|
|
895
821
|
if (!t)
|
|
896
822
|
return !0;
|
|
897
823
|
for (const e in t)
|
|
898
824
|
return !1;
|
|
899
825
|
return !0;
|
|
900
826
|
}
|
|
901
|
-
function
|
|
827
|
+
function Me(t, e) {
|
|
902
828
|
return Object.prototype.hasOwnProperty.call(t, e);
|
|
903
829
|
}
|
|
904
|
-
function
|
|
905
|
-
for (const
|
|
906
|
-
if (!
|
|
830
|
+
function be(t, e) {
|
|
831
|
+
for (const n in e) {
|
|
832
|
+
if (!Me(e, n))
|
|
907
833
|
continue;
|
|
908
|
-
const
|
|
909
|
-
if (!
|
|
834
|
+
const r = n.toLowerCase();
|
|
835
|
+
if (!r)
|
|
910
836
|
continue;
|
|
911
|
-
const s = e[
|
|
912
|
-
s === null ? delete t[
|
|
837
|
+
const s = e[n];
|
|
838
|
+
s === null ? delete t[r] : s !== void 0 && (t[r] = s);
|
|
913
839
|
}
|
|
914
840
|
}
|
|
915
841
|
function L(t, ...e) {
|
|
916
842
|
typeof process < "u" && process?.env?.DEBUG === "true" && console.log(`Arcade:DEBUG:${t}`, ...e);
|
|
917
843
|
}
|
|
918
|
-
const
|
|
844
|
+
const vt = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
919
845
|
const e = Math.random() * 16 | 0;
|
|
920
846
|
return (t === "x" ? e : e & 3 | 8).toString(16);
|
|
921
|
-
}),
|
|
922
|
-
const
|
|
923
|
-
if (
|
|
924
|
-
const
|
|
925
|
-
for (const s of [e,
|
|
847
|
+
}), It = (t) => typeof t?.get == "function", N = (t, e) => {
|
|
848
|
+
const n = e.toLowerCase();
|
|
849
|
+
if (It(t)) {
|
|
850
|
+
const r = e[0]?.toUpperCase() + e.substring(1).replace(/([^\w])(\w)/g, (s, o, i) => o + i.toUpperCase());
|
|
851
|
+
for (const s of [e, n, e.toUpperCase(), r]) {
|
|
926
852
|
const o = t.get(s);
|
|
927
853
|
if (o)
|
|
928
854
|
return o;
|
|
929
855
|
}
|
|
930
856
|
}
|
|
931
|
-
for (const [
|
|
932
|
-
if (
|
|
857
|
+
for (const [r, s] of Object.entries(t))
|
|
858
|
+
if (r.toLowerCase() === n)
|
|
933
859
|
return Array.isArray(s) ? (s.length <= 1 || console.warn(`Received ${s.length} entries for the ${e} header, using the first entry.`), s[0]) : s;
|
|
934
860
|
};
|
|
935
|
-
class O extends
|
|
936
|
-
constructor(e,
|
|
937
|
-
super(e,
|
|
861
|
+
class O extends xt {
|
|
862
|
+
constructor(e, n, r, s) {
|
|
863
|
+
super(e, n, r, s), this.items = r.items || [], this.total_count = r.total_count || 0, this.offset = r.offset || 0;
|
|
938
864
|
}
|
|
939
865
|
getPaginatedItems() {
|
|
940
866
|
return this.items ?? [];
|
|
@@ -946,28 +872,28 @@ class O extends _t {
|
|
|
946
872
|
return null;
|
|
947
873
|
if ("params" in e)
|
|
948
874
|
return e.params;
|
|
949
|
-
const
|
|
950
|
-
return Object.keys(
|
|
875
|
+
const n = Object.fromEntries(e.url.searchParams);
|
|
876
|
+
return Object.keys(n).length ? n : null;
|
|
951
877
|
}
|
|
952
878
|
nextPageInfo() {
|
|
953
879
|
const e = this.offset;
|
|
954
880
|
if (!e)
|
|
955
881
|
return null;
|
|
956
|
-
const
|
|
957
|
-
return s &&
|
|
882
|
+
const n = this.getPaginatedItems().length, r = e + n, s = this.total_count;
|
|
883
|
+
return s && r < s ? { params: { offset: r } } : null;
|
|
958
884
|
}
|
|
959
885
|
}
|
|
960
|
-
class
|
|
886
|
+
class x {
|
|
961
887
|
constructor(e) {
|
|
962
888
|
this._client = e;
|
|
963
889
|
}
|
|
964
890
|
}
|
|
965
|
-
class
|
|
891
|
+
class Fe extends x {
|
|
966
892
|
/**
|
|
967
893
|
* Create a new auth provider
|
|
968
894
|
*/
|
|
969
|
-
create(e,
|
|
970
|
-
return this._client.post("/v1/admin/auth_providers", { body: e, ...
|
|
895
|
+
create(e, n) {
|
|
896
|
+
return this._client.post("/v1/admin/auth_providers", { body: e, ...n });
|
|
971
897
|
}
|
|
972
898
|
/**
|
|
973
899
|
* List a page of auth providers that are available to the caller
|
|
@@ -978,23 +904,23 @@ class Ke extends b {
|
|
|
978
904
|
/**
|
|
979
905
|
* Delete a specific auth provider
|
|
980
906
|
*/
|
|
981
|
-
delete(e,
|
|
982
|
-
return this._client.delete(`/v1/admin/auth_providers/${e}`,
|
|
907
|
+
delete(e, n) {
|
|
908
|
+
return this._client.delete(`/v1/admin/auth_providers/${e}`, n);
|
|
983
909
|
}
|
|
984
910
|
/**
|
|
985
911
|
* Get the details of a specific auth provider
|
|
986
912
|
*/
|
|
987
|
-
get(e,
|
|
988
|
-
return this._client.get(`/v1/admin/auth_providers/${e}`,
|
|
913
|
+
get(e, n) {
|
|
914
|
+
return this._client.get(`/v1/admin/auth_providers/${e}`, n);
|
|
989
915
|
}
|
|
990
916
|
/**
|
|
991
917
|
* Patch an existing auth provider
|
|
992
918
|
*/
|
|
993
|
-
patch(e,
|
|
994
|
-
return this._client.patch(`/v1/admin/auth_providers/${e}`, { body:
|
|
919
|
+
patch(e, n, r) {
|
|
920
|
+
return this._client.patch(`/v1/admin/auth_providers/${e}`, { body: n, ...r });
|
|
995
921
|
}
|
|
996
922
|
}
|
|
997
|
-
class
|
|
923
|
+
class qe extends x {
|
|
998
924
|
/**
|
|
999
925
|
* List all secrets that are visible to the caller
|
|
1000
926
|
*/
|
|
@@ -1004,49 +930,49 @@ class We extends b {
|
|
|
1004
930
|
/**
|
|
1005
931
|
* Delete a secret by its ID
|
|
1006
932
|
*/
|
|
1007
|
-
delete(e,
|
|
933
|
+
delete(e, n) {
|
|
1008
934
|
return this._client.delete(`/v1/admin/secrets/${e}`, {
|
|
1009
|
-
...
|
|
1010
|
-
headers: { Accept: "*/*", ...
|
|
935
|
+
...n,
|
|
936
|
+
headers: { Accept: "*/*", ...n?.headers }
|
|
1011
937
|
});
|
|
1012
938
|
}
|
|
1013
939
|
}
|
|
1014
|
-
class
|
|
1015
|
-
list(e = {},
|
|
1016
|
-
return
|
|
940
|
+
class te extends x {
|
|
941
|
+
list(e = {}, n) {
|
|
942
|
+
return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/admin/user_connections", ne, {
|
|
1017
943
|
query: e,
|
|
1018
|
-
...
|
|
944
|
+
...n
|
|
1019
945
|
});
|
|
1020
946
|
}
|
|
1021
947
|
/**
|
|
1022
948
|
* Delete a user/auth provider connection
|
|
1023
949
|
*/
|
|
1024
|
-
delete(e,
|
|
950
|
+
delete(e, n) {
|
|
1025
951
|
return this._client.delete(`/v1/admin/user_connections/${e}`, {
|
|
1026
|
-
...
|
|
1027
|
-
headers: { Accept: "*/*", ...
|
|
952
|
+
...n,
|
|
953
|
+
headers: { Accept: "*/*", ...n?.headers }
|
|
1028
954
|
});
|
|
1029
955
|
}
|
|
1030
956
|
}
|
|
1031
|
-
class
|
|
957
|
+
class ne extends O {
|
|
1032
958
|
}
|
|
1033
|
-
|
|
1034
|
-
class
|
|
959
|
+
te.UserConnectionResponsesOffsetPage = ne;
|
|
960
|
+
class C extends x {
|
|
1035
961
|
constructor() {
|
|
1036
|
-
super(...arguments), this.userConnections = new
|
|
962
|
+
super(...arguments), this.userConnections = new te(this._client), this.authProviders = new Fe(this._client), this.secrets = new qe(this._client);
|
|
1037
963
|
}
|
|
1038
964
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
const
|
|
1044
|
-
class
|
|
965
|
+
C.UserConnections = te;
|
|
966
|
+
C.UserConnectionResponsesOffsetPage = ne;
|
|
967
|
+
C.AuthProviders = Fe;
|
|
968
|
+
C.Secrets = qe;
|
|
969
|
+
const Lt = 45;
|
|
970
|
+
class Ot extends Error {
|
|
1045
971
|
constructor(e) {
|
|
1046
972
|
super(e), this.name = "AuthorizationError";
|
|
1047
973
|
}
|
|
1048
974
|
}
|
|
1049
|
-
class
|
|
975
|
+
class Be extends x {
|
|
1050
976
|
/**
|
|
1051
977
|
* Starts the authorization process for a given provider and scopes.
|
|
1052
978
|
* @param userId - The user ID for which authorization is being requested
|
|
@@ -1061,9 +987,9 @@ class Ve extends b {
|
|
|
1061
987
|
* const authResponse = await client.auth.start("user@example.com", "github");
|
|
1062
988
|
* ```
|
|
1063
989
|
*/
|
|
1064
|
-
start(e,
|
|
1065
|
-
const { providerType: s = "oauth2", scopes: o = [] } =
|
|
1066
|
-
provider_id:
|
|
990
|
+
start(e, n, r = {}) {
|
|
991
|
+
const { providerType: s = "oauth2", scopes: o = [] } = r, i = {
|
|
992
|
+
provider_id: n,
|
|
1067
993
|
provider_type: s,
|
|
1068
994
|
oauth2: {
|
|
1069
995
|
scopes: o
|
|
@@ -1077,22 +1003,22 @@ class Ve extends b {
|
|
|
1077
1003
|
/**
|
|
1078
1004
|
* Starts the authorization process for given authorization requirements
|
|
1079
1005
|
*/
|
|
1080
|
-
authorize(e,
|
|
1081
|
-
return this._client.post("/v1/auth/authorize", { body: e, ...
|
|
1006
|
+
authorize(e, n) {
|
|
1007
|
+
return this._client.post("/v1/auth/authorize", { body: e, ...n });
|
|
1082
1008
|
}
|
|
1083
1009
|
/**
|
|
1084
1010
|
* Confirms a user's details during an authorization flow
|
|
1085
1011
|
*/
|
|
1086
|
-
confirmUser(e,
|
|
1087
|
-
return this._client.post("/v1/auth/confirm_user", { body: e, ...
|
|
1012
|
+
confirmUser(e, n) {
|
|
1013
|
+
return this._client.post("/v1/auth/confirm_user", { body: e, ...n });
|
|
1088
1014
|
}
|
|
1089
1015
|
/**
|
|
1090
1016
|
* Checks the status of an ongoing authorization process for a specific tool. If
|
|
1091
1017
|
* 'wait' param is present, does not respond until either the auth status becomes
|
|
1092
1018
|
* completed or the timeout is reached.
|
|
1093
1019
|
*/
|
|
1094
|
-
status(e,
|
|
1095
|
-
return this._client.get("/v1/auth/status", { query: e, ...
|
|
1020
|
+
status(e, n) {
|
|
1021
|
+
return this._client.get("/v1/auth/status", { query: e, ...n });
|
|
1096
1022
|
}
|
|
1097
1023
|
/**
|
|
1098
1024
|
* Waits for the authorization process to complete.
|
|
@@ -1114,37 +1040,37 @@ class Ve extends b {
|
|
|
1114
1040
|
* ```
|
|
1115
1041
|
*/
|
|
1116
1042
|
async waitForCompletion(e) {
|
|
1117
|
-
let
|
|
1043
|
+
let n, r;
|
|
1118
1044
|
if (typeof e == "string")
|
|
1119
|
-
|
|
1045
|
+
n = e, r = { status: "pending" };
|
|
1120
1046
|
else {
|
|
1121
1047
|
if (!e.id)
|
|
1122
|
-
throw new
|
|
1123
|
-
|
|
1048
|
+
throw new Ot("Authorization ID is required");
|
|
1049
|
+
n = e.id, r = e;
|
|
1124
1050
|
}
|
|
1125
|
-
for (;
|
|
1126
|
-
|
|
1127
|
-
id:
|
|
1128
|
-
wait:
|
|
1051
|
+
for (; r.status !== "completed"; )
|
|
1052
|
+
r = await this.status({
|
|
1053
|
+
id: n,
|
|
1054
|
+
wait: Lt
|
|
1129
1055
|
});
|
|
1130
|
-
return
|
|
1056
|
+
return r;
|
|
1131
1057
|
}
|
|
1132
1058
|
}
|
|
1133
|
-
class
|
|
1059
|
+
class He extends x {
|
|
1134
1060
|
/**
|
|
1135
1061
|
* Talk to different LLM Chat APIs via OpenAI's API
|
|
1136
1062
|
*/
|
|
1137
|
-
create(e,
|
|
1138
|
-
return this._client.post("/v1/chat/completions", { body: e, ...
|
|
1063
|
+
create(e, n) {
|
|
1064
|
+
return this._client.post("/v1/chat/completions", { body: e, ...n });
|
|
1139
1065
|
}
|
|
1140
1066
|
}
|
|
1141
|
-
class
|
|
1067
|
+
class re extends x {
|
|
1142
1068
|
constructor() {
|
|
1143
|
-
super(...arguments), this.completions = new
|
|
1069
|
+
super(...arguments), this.completions = new He(this._client);
|
|
1144
1070
|
}
|
|
1145
1071
|
}
|
|
1146
|
-
|
|
1147
|
-
class
|
|
1072
|
+
re.Completions = He;
|
|
1073
|
+
class ze extends x {
|
|
1148
1074
|
/**
|
|
1149
1075
|
* Engine Health
|
|
1150
1076
|
*/
|
|
@@ -1152,111 +1078,111 @@ class Ge extends b {
|
|
|
1152
1078
|
return this._client.get("/v1/health", e);
|
|
1153
1079
|
}
|
|
1154
1080
|
}
|
|
1155
|
-
class
|
|
1156
|
-
list(e = {},
|
|
1157
|
-
return
|
|
1081
|
+
class se extends x {
|
|
1082
|
+
list(e = {}, n) {
|
|
1083
|
+
return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/formatted_tools", oe, {
|
|
1158
1084
|
query: e,
|
|
1159
|
-
...
|
|
1085
|
+
...n
|
|
1160
1086
|
});
|
|
1161
1087
|
}
|
|
1162
|
-
get(e,
|
|
1163
|
-
return
|
|
1088
|
+
get(e, n = {}, r) {
|
|
1089
|
+
return R(n) ? this.get(e, {}, n) : this._client.get(`/v1/formatted_tools/${e}`, { query: n, ...r });
|
|
1164
1090
|
}
|
|
1165
1091
|
}
|
|
1166
|
-
class
|
|
1092
|
+
class oe extends O {
|
|
1167
1093
|
}
|
|
1168
|
-
|
|
1169
|
-
class
|
|
1170
|
-
list(e = {},
|
|
1171
|
-
return
|
|
1094
|
+
se.FormattedListResponsesOffsetPage = oe;
|
|
1095
|
+
class Xe extends x {
|
|
1096
|
+
list(e = {}, n) {
|
|
1097
|
+
return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/scheduled_tools", Dt, { query: e, ...n });
|
|
1172
1098
|
}
|
|
1173
1099
|
/**
|
|
1174
1100
|
* Returns the details for a specific scheduled tool execution
|
|
1175
1101
|
*/
|
|
1176
|
-
get(e,
|
|
1177
|
-
return this._client.get(`/v1/scheduled_tools/${e}`,
|
|
1102
|
+
get(e, n) {
|
|
1103
|
+
return this._client.get(`/v1/scheduled_tools/${e}`, n);
|
|
1178
1104
|
}
|
|
1179
1105
|
}
|
|
1180
|
-
class
|
|
1106
|
+
class v extends x {
|
|
1181
1107
|
constructor() {
|
|
1182
|
-
super(...arguments), this.scheduled = new
|
|
1108
|
+
super(...arguments), this.scheduled = new Xe(this._client), this.formatted = new se(this._client);
|
|
1183
1109
|
}
|
|
1184
|
-
list(e = {},
|
|
1185
|
-
return
|
|
1110
|
+
list(e = {}, n) {
|
|
1111
|
+
return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/tools", H, { query: e, ...n });
|
|
1186
1112
|
}
|
|
1187
1113
|
/**
|
|
1188
1114
|
* Authorizes a user for a specific tool by name
|
|
1189
1115
|
*/
|
|
1190
|
-
authorize(e,
|
|
1191
|
-
return this._client.post("/v1/tools/authorize", { body: e, ...
|
|
1116
|
+
authorize(e, n) {
|
|
1117
|
+
return this._client.post("/v1/tools/authorize", { body: e, ...n });
|
|
1192
1118
|
}
|
|
1193
1119
|
/**
|
|
1194
1120
|
* Executes a tool by name and arguments
|
|
1195
1121
|
*/
|
|
1196
|
-
execute(e,
|
|
1197
|
-
return this._client.post("/v1/tools/execute", { body: e, ...
|
|
1122
|
+
execute(e, n) {
|
|
1123
|
+
return this._client.post("/v1/tools/execute", { body: e, ...n });
|
|
1198
1124
|
}
|
|
1199
|
-
get(e,
|
|
1200
|
-
return
|
|
1125
|
+
get(e, n = {}, r) {
|
|
1126
|
+
return R(n) ? this.get(e, {}, n) : this._client.get(`/v1/tools/${e}`, { query: n, ...r });
|
|
1201
1127
|
}
|
|
1202
1128
|
}
|
|
1203
|
-
class
|
|
1129
|
+
class H extends O {
|
|
1204
1130
|
}
|
|
1205
|
-
class
|
|
1131
|
+
class Dt extends O {
|
|
1206
1132
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
class
|
|
1133
|
+
v.ToolDefinitionsOffsetPage = H;
|
|
1134
|
+
v.Scheduled = Xe;
|
|
1135
|
+
v.Formatted = se;
|
|
1136
|
+
v.FormattedListResponsesOffsetPage = oe;
|
|
1137
|
+
class ie extends x {
|
|
1212
1138
|
/**
|
|
1213
1139
|
* Create a worker
|
|
1214
1140
|
*/
|
|
1215
|
-
create(e,
|
|
1216
|
-
return this._client.post("/v1/workers", { body: e, ...
|
|
1141
|
+
create(e, n) {
|
|
1142
|
+
return this._client.post("/v1/workers", { body: e, ...n });
|
|
1217
1143
|
}
|
|
1218
1144
|
/**
|
|
1219
1145
|
* Update a worker
|
|
1220
1146
|
*/
|
|
1221
|
-
update(e,
|
|
1222
|
-
return this._client.patch(`/v1/workers/${e}`, { body:
|
|
1147
|
+
update(e, n, r) {
|
|
1148
|
+
return this._client.patch(`/v1/workers/${e}`, { body: n, ...r });
|
|
1223
1149
|
}
|
|
1224
|
-
list(e = {},
|
|
1225
|
-
return
|
|
1150
|
+
list(e = {}, n) {
|
|
1151
|
+
return R(e) ? this.list({}, e) : this._client.getAPIList("/v1/workers", ae, { query: e, ...n });
|
|
1226
1152
|
}
|
|
1227
1153
|
/**
|
|
1228
1154
|
* Delete a worker
|
|
1229
1155
|
*/
|
|
1230
|
-
delete(e,
|
|
1156
|
+
delete(e, n) {
|
|
1231
1157
|
return this._client.delete(`/v1/workers/${e}`, {
|
|
1232
|
-
...
|
|
1233
|
-
headers: { Accept: "*/*", ...
|
|
1158
|
+
...n,
|
|
1159
|
+
headers: { Accept: "*/*", ...n?.headers }
|
|
1234
1160
|
});
|
|
1235
1161
|
}
|
|
1236
1162
|
/**
|
|
1237
1163
|
* Get a worker by ID
|
|
1238
1164
|
*/
|
|
1239
|
-
get(e,
|
|
1240
|
-
return this._client.get(`/v1/workers/${e}`,
|
|
1165
|
+
get(e, n) {
|
|
1166
|
+
return this._client.get(`/v1/workers/${e}`, n);
|
|
1241
1167
|
}
|
|
1242
1168
|
/**
|
|
1243
1169
|
* Get the health of a worker
|
|
1244
1170
|
*/
|
|
1245
|
-
health(e,
|
|
1246
|
-
return this._client.get(`/v1/workers/${e}/health`,
|
|
1171
|
+
health(e, n) {
|
|
1172
|
+
return this._client.get(`/v1/workers/${e}/health`, n);
|
|
1247
1173
|
}
|
|
1248
|
-
tools(e,
|
|
1249
|
-
return
|
|
1250
|
-
query:
|
|
1251
|
-
...
|
|
1174
|
+
tools(e, n = {}, r) {
|
|
1175
|
+
return R(n) ? this.tools(e, {}, n) : this._client.getAPIList(`/v1/workers/${e}/tools`, H, {
|
|
1176
|
+
query: n,
|
|
1177
|
+
...r
|
|
1252
1178
|
});
|
|
1253
1179
|
}
|
|
1254
1180
|
}
|
|
1255
|
-
class
|
|
1181
|
+
class ae extends O {
|
|
1256
1182
|
}
|
|
1257
|
-
|
|
1258
|
-
var
|
|
1259
|
-
class d extends
|
|
1183
|
+
ie.WorkerResponsesOffsetPage = ae;
|
|
1184
|
+
var Ke, We;
|
|
1185
|
+
class d extends wt {
|
|
1260
1186
|
/**
|
|
1261
1187
|
* API Client for interfacing with the Arcade API.
|
|
1262
1188
|
*
|
|
@@ -1269,12 +1195,12 @@ class d extends xt {
|
|
|
1269
1195
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
1270
1196
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
1271
1197
|
*/
|
|
1272
|
-
constructor({ baseURL: e =
|
|
1273
|
-
if (
|
|
1198
|
+
constructor({ baseURL: e = xe("ARCADE_BASE_URL"), apiKey: n = xe("ARCADE_API_KEY"), ...r } = {}) {
|
|
1199
|
+
if (n === void 0)
|
|
1274
1200
|
throw new P("The ARCADE_API_KEY environment variable is missing or empty; either provide it, or instantiate the Arcade client with an apiKey option, like new Arcade({ apiKey: 'My API Key' }).");
|
|
1275
1201
|
const s = {
|
|
1276
|
-
apiKey:
|
|
1277
|
-
...
|
|
1202
|
+
apiKey: n,
|
|
1203
|
+
...r,
|
|
1278
1204
|
baseURL: e || "https://api.arcade.dev"
|
|
1279
1205
|
};
|
|
1280
1206
|
super({
|
|
@@ -1284,7 +1210,7 @@ class d extends xt {
|
|
|
1284
1210
|
httpAgent: s.httpAgent,
|
|
1285
1211
|
maxRetries: s.maxRetries,
|
|
1286
1212
|
fetch: s.fetch
|
|
1287
|
-
}),
|
|
1213
|
+
}), Ke.add(this), this.admin = new C(this), this.auth = new Be(this), this.health = new ze(this), this.chat = new re(this), this.tools = new v(this), this.workers = new ie(this), this._options = s, this.idempotencyHeader = "Idempotency-Key", this.apiKey = n;
|
|
1288
1214
|
}
|
|
1289
1215
|
defaultQuery() {
|
|
1290
1216
|
return this._options.defaultQuery;
|
|
@@ -1299,43 +1225,43 @@ class d extends xt {
|
|
|
1299
1225
|
return { Authorization: this.apiKey };
|
|
1300
1226
|
}
|
|
1301
1227
|
stringifyQuery(e) {
|
|
1302
|
-
return
|
|
1228
|
+
return lt(e, { arrayFormat: "comma" });
|
|
1303
1229
|
}
|
|
1304
1230
|
}
|
|
1305
|
-
|
|
1306
|
-
d.Arcade =
|
|
1231
|
+
We = d, Ke = /* @__PURE__ */ new WeakSet();
|
|
1232
|
+
d.Arcade = We;
|
|
1307
1233
|
d.DEFAULT_TIMEOUT = 6e4;
|
|
1308
1234
|
d.ArcadeError = P;
|
|
1309
1235
|
d.APIError = w;
|
|
1310
|
-
d.APIConnectionError =
|
|
1311
|
-
d.APIConnectionTimeoutError =
|
|
1312
|
-
d.APIUserAbortError =
|
|
1313
|
-
d.NotFoundError =
|
|
1314
|
-
d.ConflictError =
|
|
1315
|
-
d.RateLimitError =
|
|
1316
|
-
d.BadRequestError =
|
|
1317
|
-
d.AuthenticationError =
|
|
1318
|
-
d.InternalServerError =
|
|
1319
|
-
d.PermissionDeniedError =
|
|
1320
|
-
d.UnprocessableEntityError =
|
|
1321
|
-
d.toFile =
|
|
1322
|
-
d.fileFromPath =
|
|
1323
|
-
d.Admin =
|
|
1324
|
-
d.Auth =
|
|
1325
|
-
d.Health =
|
|
1326
|
-
d.Chat =
|
|
1327
|
-
d.Tools =
|
|
1328
|
-
d.ToolDefinitionsOffsetPage =
|
|
1329
|
-
d.Workers =
|
|
1330
|
-
d.WorkerResponsesOffsetPage =
|
|
1331
|
-
const
|
|
1332
|
-
class
|
|
1236
|
+
d.APIConnectionError = F;
|
|
1237
|
+
d.APIConnectionTimeoutError = Ee;
|
|
1238
|
+
d.APIUserAbortError = Z;
|
|
1239
|
+
d.NotFoundError = Ce;
|
|
1240
|
+
d.ConflictError = ve;
|
|
1241
|
+
d.RateLimitError = Le;
|
|
1242
|
+
d.BadRequestError = Pe;
|
|
1243
|
+
d.AuthenticationError = ke;
|
|
1244
|
+
d.InternalServerError = Oe;
|
|
1245
|
+
d.PermissionDeniedError = Te;
|
|
1246
|
+
d.UnprocessableEntityError = Ie;
|
|
1247
|
+
d.toFile = ht;
|
|
1248
|
+
d.fileFromPath = Ze;
|
|
1249
|
+
d.Admin = C;
|
|
1250
|
+
d.Auth = Be;
|
|
1251
|
+
d.Health = ze;
|
|
1252
|
+
d.Chat = re;
|
|
1253
|
+
d.Tools = v;
|
|
1254
|
+
d.ToolDefinitionsOffsetPage = H;
|
|
1255
|
+
d.Workers = ie;
|
|
1256
|
+
d.WorkerResponsesOffsetPage = ae;
|
|
1257
|
+
const Ut = /[._\-\s]+/, $t = /([a-z])([A-Z])/g, jt = /\s+/;
|
|
1258
|
+
class qt {
|
|
1333
1259
|
#e;
|
|
1334
1260
|
constructor(e) {
|
|
1335
|
-
const { accessToken:
|
|
1336
|
-
s && (c["Arcade-Client-Id"] = s), !l &&
|
|
1261
|
+
const { accessToken: n, apiKey: r, arcadeClientId: s, baseURL: o } = e, i = r ?? he("ARCADE_API_KEY"), l = !!i, c = {};
|
|
1262
|
+
s && (c["Arcade-Client-Id"] = s), !l && n && (c.Authorization = `Bearer ${n}`);
|
|
1337
1263
|
const u = {
|
|
1338
|
-
baseURL: o ??
|
|
1264
|
+
baseURL: o ?? he("ARCADE_BASE_URL"),
|
|
1339
1265
|
defaultHeaders: c,
|
|
1340
1266
|
apiKey: i ?? ""
|
|
1341
1267
|
};
|
|
@@ -1345,28 +1271,28 @@ class Kt {
|
|
|
1345
1271
|
return new d(e);
|
|
1346
1272
|
}
|
|
1347
1273
|
async getAllTools(e = {}) {
|
|
1348
|
-
const { limit:
|
|
1274
|
+
const { limit: n = 1e3, offset: r = 0, toolkit: s } = e;
|
|
1349
1275
|
return (await this.#e.tools.list({
|
|
1350
|
-
limit:
|
|
1351
|
-
offset:
|
|
1276
|
+
limit: n,
|
|
1277
|
+
offset: r,
|
|
1352
1278
|
toolkit: s
|
|
1353
1279
|
})).items;
|
|
1354
1280
|
}
|
|
1355
1281
|
async groupToolsBy(e) {
|
|
1356
|
-
const
|
|
1357
|
-
for (const s of
|
|
1282
|
+
const n = await this.getAllTools(), r = /* @__PURE__ */ new Map();
|
|
1283
|
+
for (const s of n) {
|
|
1358
1284
|
const o = s[e];
|
|
1359
|
-
typeof o == "string" &&
|
|
1285
|
+
typeof o == "string" && r.set(o, s);
|
|
1360
1286
|
}
|
|
1361
|
-
return
|
|
1287
|
+
return r;
|
|
1362
1288
|
}
|
|
1363
1289
|
async getToolkits() {
|
|
1364
|
-
const e = await this.getAllTools(),
|
|
1365
|
-
for (const
|
|
1366
|
-
const s =
|
|
1367
|
-
let o =
|
|
1290
|
+
const e = await this.getAllTools(), n = /* @__PURE__ */ new Map();
|
|
1291
|
+
for (const r of e) {
|
|
1292
|
+
const s = r.toolkit.name;
|
|
1293
|
+
let o = n.get(s);
|
|
1368
1294
|
o || (o = {
|
|
1369
|
-
...
|
|
1295
|
+
...r.toolkit,
|
|
1370
1296
|
tools: [],
|
|
1371
1297
|
requirements: {
|
|
1372
1298
|
met: !0,
|
|
@@ -1374,9 +1300,9 @@ class Kt {
|
|
|
1374
1300
|
authorization: [],
|
|
1375
1301
|
scopes: {}
|
|
1376
1302
|
}
|
|
1377
|
-
},
|
|
1303
|
+
}, n.set(s, o)), o.tools.push(r), r.requirements && this.applyToolRequirements(o, r.requirements);
|
|
1378
1304
|
}
|
|
1379
|
-
return
|
|
1305
|
+
return n;
|
|
1380
1306
|
}
|
|
1381
1307
|
async getToolsForToolkit(e) {
|
|
1382
1308
|
return (await this.#e.tools.list({
|
|
@@ -1384,81 +1310,81 @@ class Kt {
|
|
|
1384
1310
|
limit: 1e3
|
|
1385
1311
|
})).items;
|
|
1386
1312
|
}
|
|
1387
|
-
applyToolRequirements(e,
|
|
1388
|
-
if (!
|
|
1313
|
+
applyToolRequirements(e, n) {
|
|
1314
|
+
if (!n)
|
|
1389
1315
|
return;
|
|
1390
1316
|
e.requirements.secrets = this.mergeSecrets(
|
|
1391
|
-
|
|
1317
|
+
n.secrets ?? [],
|
|
1392
1318
|
e.requirements.secrets ?? []
|
|
1393
1319
|
), e.requirements.authorization = this.mergeAuthorizations(
|
|
1394
|
-
|
|
1320
|
+
n.authorization,
|
|
1395
1321
|
e.requirements.authorization ?? []
|
|
1396
1322
|
);
|
|
1397
|
-
const
|
|
1398
|
-
|
|
1399
|
-
|
|
1323
|
+
const r = n.authorization?.provider_id, s = n.authorization?.oauth2?.scopes ?? [];
|
|
1324
|
+
r && s.length && (e.requirements.scopes = this.mergeScopes(
|
|
1325
|
+
r,
|
|
1400
1326
|
s,
|
|
1401
1327
|
e.requirements.scopes ?? {}
|
|
1402
|
-
)), e.requirements.met = !!(e.requirements.met && (
|
|
1328
|
+
)), e.requirements.met = !!(e.requirements.met && (n.met ?? !0));
|
|
1403
1329
|
}
|
|
1404
|
-
mergeSecrets(e = [],
|
|
1330
|
+
mergeSecrets(e = [], n = []) {
|
|
1405
1331
|
if (e.length === 0)
|
|
1406
|
-
return
|
|
1407
|
-
const
|
|
1408
|
-
for (const s of
|
|
1409
|
-
|
|
1332
|
+
return n;
|
|
1333
|
+
const r = /* @__PURE__ */ new Map();
|
|
1334
|
+
for (const s of n)
|
|
1335
|
+
r.set(s.key, { ...s });
|
|
1410
1336
|
for (const s of e) {
|
|
1411
|
-
const o =
|
|
1337
|
+
const o = r.get(s.key);
|
|
1412
1338
|
if (!o) {
|
|
1413
|
-
|
|
1339
|
+
r.set(s.key, { ...s });
|
|
1414
1340
|
continue;
|
|
1415
1341
|
}
|
|
1416
1342
|
const i = !!(o.met || s.met), l = s.status_reason ?? o.status_reason;
|
|
1417
|
-
|
|
1343
|
+
r.set(s.key, { key: s.key, met: i, status_reason: l });
|
|
1418
1344
|
}
|
|
1419
|
-
return Array.from(
|
|
1345
|
+
return Array.from(r.values());
|
|
1420
1346
|
}
|
|
1421
|
-
mergeAuthorizations(e,
|
|
1347
|
+
mergeAuthorizations(e, n = []) {
|
|
1422
1348
|
if (!e?.provider_id)
|
|
1423
|
-
return
|
|
1424
|
-
const
|
|
1349
|
+
return n;
|
|
1350
|
+
const r = new Map(n.map((i) => [i.provider_id, { ...i }])), s = r.get(e.provider_id);
|
|
1425
1351
|
if (!s)
|
|
1426
|
-
return
|
|
1352
|
+
return r.set(e.provider_id, { ...e }), Array.from(r.values());
|
|
1427
1353
|
const o = new Set(s.oauth2?.scopes ?? []);
|
|
1428
1354
|
for (const i of e.oauth2?.scopes ?? [])
|
|
1429
1355
|
o.add(i);
|
|
1430
|
-
return
|
|
1356
|
+
return r.set(e.provider_id, {
|
|
1431
1357
|
...s,
|
|
1432
1358
|
oauth2: {
|
|
1433
1359
|
...s.oauth2 ?? {},
|
|
1434
1360
|
scopes: Array.from(o)
|
|
1435
1361
|
}
|
|
1436
|
-
}), Array.from(
|
|
1362
|
+
}), Array.from(r.values());
|
|
1437
1363
|
}
|
|
1438
|
-
mergeScopes(e,
|
|
1439
|
-
if (!e ||
|
|
1440
|
-
return
|
|
1441
|
-
const s = new Set(
|
|
1442
|
-
for (const o of
|
|
1364
|
+
mergeScopes(e, n = [], r = {}) {
|
|
1365
|
+
if (!e || n.length === 0)
|
|
1366
|
+
return r;
|
|
1367
|
+
const s = new Set(r[e] ?? []);
|
|
1368
|
+
for (const o of n)
|
|
1443
1369
|
s.add(o);
|
|
1444
|
-
return { ...
|
|
1370
|
+
return { ...r, [e]: Array.from(s) };
|
|
1445
1371
|
}
|
|
1446
1372
|
/**
|
|
1447
1373
|
* Pre-compute requirements summary for optimal UI performance.
|
|
1448
1374
|
* This eliminates the need for runtime transformation in UI components.
|
|
1449
1375
|
*/
|
|
1450
1376
|
computeRequirementsSummary(e) {
|
|
1451
|
-
const
|
|
1377
|
+
const n = e?.secrets?.length ? {
|
|
1452
1378
|
configured: e.secrets.filter((s) => s.met === !0).map((s) => s.key),
|
|
1453
1379
|
pending: e.secrets.filter((s) => s.met === !1).map((s) => s.key)
|
|
1454
|
-
} : void 0,
|
|
1380
|
+
} : void 0, r = e?.authorization?.length ? {
|
|
1455
1381
|
providers: e.authorization.filter((s) => s.provider_id || s.id).map((s) => ({
|
|
1456
1382
|
id: s.provider_id || s.id || "",
|
|
1457
1383
|
status: s.status,
|
|
1458
1384
|
scopes: s.oauth2?.scopes || []
|
|
1459
1385
|
}))
|
|
1460
1386
|
} : void 0;
|
|
1461
|
-
return { secrets:
|
|
1387
|
+
return { secrets: n, oauth: r };
|
|
1462
1388
|
}
|
|
1463
1389
|
/**
|
|
1464
1390
|
* Process raw toolkit data into an optimized collection with pre-computed search indices.
|
|
@@ -1470,7 +1396,7 @@ class Kt {
|
|
|
1470
1396
|
* - Toolkit/tool mapping for quick relationships
|
|
1471
1397
|
*/
|
|
1472
1398
|
async getProcessedToolkitCollection() {
|
|
1473
|
-
const e = await this.getToolkits(),
|
|
1399
|
+
const e = await this.getToolkits(), n = [], r = [], s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = {
|
|
1474
1400
|
toolkitsByName: /* @__PURE__ */ new Map(),
|
|
1475
1401
|
toolsByName: /* @__PURE__ */ new Map()
|
|
1476
1402
|
};
|
|
@@ -1485,9 +1411,9 @@ class Kt {
|
|
|
1485
1411
|
...c,
|
|
1486
1412
|
searchableText: u,
|
|
1487
1413
|
requirementsSummary: p,
|
|
1488
|
-
metadata:
|
|
1414
|
+
metadata: et[c.name]
|
|
1489
1415
|
};
|
|
1490
|
-
|
|
1416
|
+
n.push(a), s.set(l, a), i.toolkitsByName.set(l.toLowerCase(), a);
|
|
1491
1417
|
for (const h of c.tools) {
|
|
1492
1418
|
const m = this.normalizeText([
|
|
1493
1419
|
h.name,
|
|
@@ -1495,19 +1421,19 @@ class Kt {
|
|
|
1495
1421
|
h.description ?? "",
|
|
1496
1422
|
c.name,
|
|
1497
1423
|
c.description ?? ""
|
|
1498
|
-
]),
|
|
1424
|
+
]), b = {
|
|
1499
1425
|
...h,
|
|
1500
1426
|
searchableText: m
|
|
1501
1427
|
};
|
|
1502
|
-
|
|
1428
|
+
r.push(b), o.set(h.fully_qualified_name, l), i.toolsByName.set(
|
|
1503
1429
|
h.fully_qualified_name.toLowerCase(),
|
|
1504
|
-
|
|
1430
|
+
b
|
|
1505
1431
|
);
|
|
1506
1432
|
}
|
|
1507
1433
|
}
|
|
1508
1434
|
return {
|
|
1509
|
-
toolkits:
|
|
1510
|
-
tools:
|
|
1435
|
+
toolkits: n,
|
|
1436
|
+
tools: r,
|
|
1511
1437
|
toolkitMap: s,
|
|
1512
1438
|
toolToToolkitMap: o,
|
|
1513
1439
|
searchIndex: i
|
|
@@ -1519,25 +1445,25 @@ class Kt {
|
|
|
1519
1445
|
* Handles camelCase, snake_case, kebab-case, and dot.notation.
|
|
1520
1446
|
*/
|
|
1521
1447
|
normalizeText(e) {
|
|
1522
|
-
const
|
|
1523
|
-
for (const
|
|
1524
|
-
if (!
|
|
1448
|
+
const n = /* @__PURE__ */ new Set();
|
|
1449
|
+
for (const r of e) {
|
|
1450
|
+
if (!r)
|
|
1525
1451
|
continue;
|
|
1526
|
-
const s =
|
|
1527
|
-
|
|
1528
|
-
const o =
|
|
1452
|
+
const s = r.toLowerCase();
|
|
1453
|
+
n.add(s);
|
|
1454
|
+
const o = r.split(Ut);
|
|
1529
1455
|
for (const i of o) {
|
|
1530
1456
|
if (i.length <= 1)
|
|
1531
1457
|
continue;
|
|
1532
|
-
const c = i.replace(
|
|
1458
|
+
const c = i.replace($t, "$1 $2").split(jt);
|
|
1533
1459
|
for (const u of c)
|
|
1534
|
-
u.length > 1 &&
|
|
1460
|
+
u.length > 1 && n.add(u.toLowerCase());
|
|
1535
1461
|
}
|
|
1536
1462
|
}
|
|
1537
|
-
return Array.from(
|
|
1463
|
+
return Array.from(n).join(" ");
|
|
1538
1464
|
}
|
|
1539
1465
|
}
|
|
1540
1466
|
export {
|
|
1541
|
-
|
|
1467
|
+
qt as A,
|
|
1542
1468
|
d as a
|
|
1543
1469
|
};
|