@postrun/js 3.3.0 → 4.0.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/chunk-VCOKMHAJ.js +3205 -0
- package/dist/chunk-VCOKMHAJ.js.map +1 -0
- package/dist/chunk-YP26OO5J.js +1437 -0
- package/dist/chunk-YP26OO5J.js.map +1 -0
- package/dist/index.cjs +1543 -7311
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +88 -904
- package/dist/index.d.ts +88 -904
- package/dist/index.js +51 -48
- package/dist/index.js.map +1 -1
- package/dist/query.cjs +258 -3401
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +3267 -31911
- package/dist/query.d.ts +3267 -31911
- package/dist/query.js +258 -3250
- package/dist/query.js.map +1 -1
- package/dist/schemas/index.cjs +598 -5233
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +11261 -15569
- package/dist/schemas/index.d.ts +11261 -15569
- package/dist/schemas/index.js +1 -27
- package/dist/schemas/index.js.map +1 -1
- package/dist/server.cjs +586 -4713
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +2 -2
- package/dist/types.gen-DjaUEnXO.d.cts +10571 -0
- package/dist/types.gen-DjaUEnXO.d.ts +10571 -0
- package/package.json +1 -1
- package/dist/chunk-62WCSNZ4.js +0 -7393
- package/dist/chunk-62WCSNZ4.js.map +0 -1
- package/dist/chunk-W37M2JFI.js +0 -2980
- package/dist/chunk-W37M2JFI.js.map +0 -1
- package/dist/types.gen-D7Xl9jUZ.d.cts +0 -37417
- package/dist/types.gen-D7Xl9jUZ.d.ts +0 -37417
|
@@ -0,0 +1,1437 @@
|
|
|
1
|
+
import { zErrorCode } from './chunk-VCOKMHAJ.js';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
|
|
4
|
+
var ProblemSchema = z.object({
|
|
5
|
+
type: z.string().optional(),
|
|
6
|
+
title: z.string().optional(),
|
|
7
|
+
status: z.number().optional(),
|
|
8
|
+
code: z.string().optional(),
|
|
9
|
+
detail: z.string().optional(),
|
|
10
|
+
// RFC 9457 calls the occurrence id `instance`; our bodies emit it as
|
|
11
|
+
// `request_id`. Tolerate both, preferring `request_id`.
|
|
12
|
+
request_id: z.string().optional(),
|
|
13
|
+
instance: z.string().optional(),
|
|
14
|
+
errors: z.array(z.object({ field: z.string(), code: z.string(), detail: z.string() })).optional()
|
|
15
|
+
});
|
|
16
|
+
var PostrunError = class extends Error {
|
|
17
|
+
status;
|
|
18
|
+
/** The machine-readable code to branch on (closed union), if the body had one. */
|
|
19
|
+
code;
|
|
20
|
+
/** The request id for support/debugging (our `request_id`, or RFC `instance`). */
|
|
21
|
+
request_id;
|
|
22
|
+
/** Per-field validation problems on a 422, surfaced for convenience. */
|
|
23
|
+
fieldErrors;
|
|
24
|
+
problem;
|
|
25
|
+
constructor(status, rawProblem) {
|
|
26
|
+
const problem = ProblemSchema.safeParse(rawProblem).data;
|
|
27
|
+
super(problem?.detail ?? problem?.title ?? `Postrun API error (${status})`);
|
|
28
|
+
this.name = "PostrunError";
|
|
29
|
+
this.status = status;
|
|
30
|
+
this.code = zErrorCode.safeParse(problem?.code).data;
|
|
31
|
+
this.request_id = problem?.request_id ?? problem?.instance;
|
|
32
|
+
this.fieldErrors = problem?.errors ?? [];
|
|
33
|
+
this.problem = problem;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/client/core/bodySerializer.gen.ts
|
|
38
|
+
var jsonBodySerializer = {
|
|
39
|
+
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// src/client/core/serverSentEvents.gen.ts
|
|
43
|
+
function createSseClient({
|
|
44
|
+
onRequest,
|
|
45
|
+
onSseError,
|
|
46
|
+
onSseEvent,
|
|
47
|
+
responseTransformer,
|
|
48
|
+
responseValidator,
|
|
49
|
+
sseDefaultRetryDelay,
|
|
50
|
+
sseMaxRetryAttempts,
|
|
51
|
+
sseMaxRetryDelay,
|
|
52
|
+
sseSleepFn,
|
|
53
|
+
url,
|
|
54
|
+
...options
|
|
55
|
+
}) {
|
|
56
|
+
let lastEventId;
|
|
57
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
58
|
+
const createStream = async function* () {
|
|
59
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
60
|
+
let attempt = 0;
|
|
61
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
62
|
+
while (true) {
|
|
63
|
+
if (signal.aborted) break;
|
|
64
|
+
attempt++;
|
|
65
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
66
|
+
if (lastEventId !== void 0) {
|
|
67
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const requestInit = {
|
|
71
|
+
redirect: "follow",
|
|
72
|
+
...options,
|
|
73
|
+
body: options.serializedBody,
|
|
74
|
+
headers,
|
|
75
|
+
signal
|
|
76
|
+
};
|
|
77
|
+
let request = new Request(url, requestInit);
|
|
78
|
+
if (onRequest) {
|
|
79
|
+
request = await onRequest(url, requestInit);
|
|
80
|
+
}
|
|
81
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
82
|
+
const response = await _fetch(request);
|
|
83
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
84
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
85
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
86
|
+
let buffer = "";
|
|
87
|
+
const abortHandler = () => {
|
|
88
|
+
try {
|
|
89
|
+
reader.cancel();
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
signal.addEventListener("abort", abortHandler);
|
|
94
|
+
try {
|
|
95
|
+
while (true) {
|
|
96
|
+
const { done, value } = await reader.read();
|
|
97
|
+
if (done) break;
|
|
98
|
+
buffer += value;
|
|
99
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
100
|
+
const chunks = buffer.split("\n\n");
|
|
101
|
+
buffer = chunks.pop() ?? "";
|
|
102
|
+
for (const chunk of chunks) {
|
|
103
|
+
const lines = chunk.split("\n");
|
|
104
|
+
const dataLines = [];
|
|
105
|
+
let eventName;
|
|
106
|
+
for (const line of lines) {
|
|
107
|
+
if (line.startsWith("data:")) {
|
|
108
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
109
|
+
} else if (line.startsWith("event:")) {
|
|
110
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
111
|
+
} else if (line.startsWith("id:")) {
|
|
112
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
113
|
+
} else if (line.startsWith("retry:")) {
|
|
114
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
115
|
+
if (!Number.isNaN(parsed)) {
|
|
116
|
+
retryDelay = parsed;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
let data;
|
|
121
|
+
let parsedJson = false;
|
|
122
|
+
if (dataLines.length) {
|
|
123
|
+
const rawData = dataLines.join("\n");
|
|
124
|
+
try {
|
|
125
|
+
data = JSON.parse(rawData);
|
|
126
|
+
parsedJson = true;
|
|
127
|
+
} catch {
|
|
128
|
+
data = rawData;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (parsedJson) {
|
|
132
|
+
if (responseValidator) {
|
|
133
|
+
await responseValidator(data);
|
|
134
|
+
}
|
|
135
|
+
if (responseTransformer) {
|
|
136
|
+
data = await responseTransformer(data);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
onSseEvent?.({
|
|
140
|
+
data,
|
|
141
|
+
event: eventName,
|
|
142
|
+
id: lastEventId,
|
|
143
|
+
retry: retryDelay
|
|
144
|
+
});
|
|
145
|
+
if (dataLines.length) {
|
|
146
|
+
yield data;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
} finally {
|
|
151
|
+
signal.removeEventListener("abort", abortHandler);
|
|
152
|
+
reader.releaseLock();
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
} catch (error) {
|
|
156
|
+
onSseError?.(error);
|
|
157
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
161
|
+
await sleep(backoff);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const stream = createStream();
|
|
166
|
+
return { stream };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/client/core/pathSerializer.gen.ts
|
|
170
|
+
var separatorArrayExplode = (style) => {
|
|
171
|
+
switch (style) {
|
|
172
|
+
case "label":
|
|
173
|
+
return ".";
|
|
174
|
+
case "matrix":
|
|
175
|
+
return ";";
|
|
176
|
+
case "simple":
|
|
177
|
+
return ",";
|
|
178
|
+
default:
|
|
179
|
+
return "&";
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
var separatorArrayNoExplode = (style) => {
|
|
183
|
+
switch (style) {
|
|
184
|
+
case "form":
|
|
185
|
+
return ",";
|
|
186
|
+
case "pipeDelimited":
|
|
187
|
+
return "|";
|
|
188
|
+
case "spaceDelimited":
|
|
189
|
+
return "%20";
|
|
190
|
+
default:
|
|
191
|
+
return ",";
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var separatorObjectExplode = (style) => {
|
|
195
|
+
switch (style) {
|
|
196
|
+
case "label":
|
|
197
|
+
return ".";
|
|
198
|
+
case "matrix":
|
|
199
|
+
return ";";
|
|
200
|
+
case "simple":
|
|
201
|
+
return ",";
|
|
202
|
+
default:
|
|
203
|
+
return "&";
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
var serializeArrayParam = ({
|
|
207
|
+
allowReserved,
|
|
208
|
+
explode,
|
|
209
|
+
name,
|
|
210
|
+
style,
|
|
211
|
+
value
|
|
212
|
+
}) => {
|
|
213
|
+
if (!explode) {
|
|
214
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
215
|
+
switch (style) {
|
|
216
|
+
case "label":
|
|
217
|
+
return `.${joinedValues2}`;
|
|
218
|
+
case "matrix":
|
|
219
|
+
return `;${name}=${joinedValues2}`;
|
|
220
|
+
case "simple":
|
|
221
|
+
return joinedValues2;
|
|
222
|
+
default:
|
|
223
|
+
return `${name}=${joinedValues2}`;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const separator = separatorArrayExplode(style);
|
|
227
|
+
const joinedValues = value.map((v) => {
|
|
228
|
+
if (style === "label" || style === "simple") {
|
|
229
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
230
|
+
}
|
|
231
|
+
return serializePrimitiveParam({
|
|
232
|
+
allowReserved,
|
|
233
|
+
name,
|
|
234
|
+
value: v
|
|
235
|
+
});
|
|
236
|
+
}).join(separator);
|
|
237
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
238
|
+
};
|
|
239
|
+
var serializePrimitiveParam = ({
|
|
240
|
+
allowReserved,
|
|
241
|
+
name,
|
|
242
|
+
value
|
|
243
|
+
}) => {
|
|
244
|
+
if (value === void 0 || value === null) {
|
|
245
|
+
return "";
|
|
246
|
+
}
|
|
247
|
+
if (typeof value === "object") {
|
|
248
|
+
throw new Error(
|
|
249
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
253
|
+
};
|
|
254
|
+
var serializeObjectParam = ({
|
|
255
|
+
allowReserved,
|
|
256
|
+
explode,
|
|
257
|
+
name,
|
|
258
|
+
style,
|
|
259
|
+
value,
|
|
260
|
+
valueOnly
|
|
261
|
+
}) => {
|
|
262
|
+
if (value instanceof Date) {
|
|
263
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
264
|
+
}
|
|
265
|
+
if (style !== "deepObject" && !explode) {
|
|
266
|
+
let values = [];
|
|
267
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
268
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
269
|
+
});
|
|
270
|
+
const joinedValues2 = values.join(",");
|
|
271
|
+
switch (style) {
|
|
272
|
+
case "form":
|
|
273
|
+
return `${name}=${joinedValues2}`;
|
|
274
|
+
case "label":
|
|
275
|
+
return `.${joinedValues2}`;
|
|
276
|
+
case "matrix":
|
|
277
|
+
return `;${name}=${joinedValues2}`;
|
|
278
|
+
default:
|
|
279
|
+
return joinedValues2;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const separator = separatorObjectExplode(style);
|
|
283
|
+
const joinedValues = Object.entries(value).map(
|
|
284
|
+
([key, v]) => serializePrimitiveParam({
|
|
285
|
+
allowReserved,
|
|
286
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
287
|
+
value: v
|
|
288
|
+
})
|
|
289
|
+
).join(separator);
|
|
290
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// src/client/core/utils.gen.ts
|
|
294
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
295
|
+
var defaultPathSerializer = ({ path, url: _url }) => {
|
|
296
|
+
let url = _url;
|
|
297
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
298
|
+
if (matches) {
|
|
299
|
+
for (const match of matches) {
|
|
300
|
+
let explode = false;
|
|
301
|
+
let name = match.substring(1, match.length - 1);
|
|
302
|
+
let style = "simple";
|
|
303
|
+
if (name.endsWith("*")) {
|
|
304
|
+
explode = true;
|
|
305
|
+
name = name.substring(0, name.length - 1);
|
|
306
|
+
}
|
|
307
|
+
if (name.startsWith(".")) {
|
|
308
|
+
name = name.substring(1);
|
|
309
|
+
style = "label";
|
|
310
|
+
} else if (name.startsWith(";")) {
|
|
311
|
+
name = name.substring(1);
|
|
312
|
+
style = "matrix";
|
|
313
|
+
}
|
|
314
|
+
const value = path[name];
|
|
315
|
+
if (value === void 0 || value === null) {
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
if (Array.isArray(value)) {
|
|
319
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
if (typeof value === "object") {
|
|
323
|
+
url = url.replace(
|
|
324
|
+
match,
|
|
325
|
+
serializeObjectParam({
|
|
326
|
+
explode,
|
|
327
|
+
name,
|
|
328
|
+
style,
|
|
329
|
+
value,
|
|
330
|
+
valueOnly: true
|
|
331
|
+
})
|
|
332
|
+
);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (style === "matrix") {
|
|
336
|
+
url = url.replace(
|
|
337
|
+
match,
|
|
338
|
+
`;${serializePrimitiveParam({
|
|
339
|
+
name,
|
|
340
|
+
value
|
|
341
|
+
})}`
|
|
342
|
+
);
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
const replaceValue = encodeURIComponent(
|
|
346
|
+
style === "label" ? `.${value}` : value
|
|
347
|
+
);
|
|
348
|
+
url = url.replace(match, replaceValue);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return url;
|
|
352
|
+
};
|
|
353
|
+
var getUrl = ({
|
|
354
|
+
baseUrl,
|
|
355
|
+
path,
|
|
356
|
+
query,
|
|
357
|
+
querySerializer,
|
|
358
|
+
url: _url
|
|
359
|
+
}) => {
|
|
360
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
361
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
362
|
+
if (path) {
|
|
363
|
+
url = defaultPathSerializer({ path, url });
|
|
364
|
+
}
|
|
365
|
+
let search = query ? querySerializer(query) : "";
|
|
366
|
+
if (search.startsWith("?")) {
|
|
367
|
+
search = search.substring(1);
|
|
368
|
+
}
|
|
369
|
+
if (search) {
|
|
370
|
+
url += `?${search}`;
|
|
371
|
+
}
|
|
372
|
+
return url;
|
|
373
|
+
};
|
|
374
|
+
function getValidRequestBody(options) {
|
|
375
|
+
const hasBody = options.body !== void 0;
|
|
376
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
377
|
+
if (isSerializedBody) {
|
|
378
|
+
if ("serializedBody" in options) {
|
|
379
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
380
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
381
|
+
}
|
|
382
|
+
return options.body !== "" ? options.body : null;
|
|
383
|
+
}
|
|
384
|
+
if (hasBody) {
|
|
385
|
+
return options.body;
|
|
386
|
+
}
|
|
387
|
+
return void 0;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// src/client/core/auth.gen.ts
|
|
391
|
+
var getAuthToken = async (auth, callback) => {
|
|
392
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
393
|
+
if (!token) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (auth.scheme === "bearer") {
|
|
397
|
+
return `Bearer ${token}`;
|
|
398
|
+
}
|
|
399
|
+
if (auth.scheme === "basic") {
|
|
400
|
+
return `Basic ${btoa(token)}`;
|
|
401
|
+
}
|
|
402
|
+
return token;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// src/client/client/utils.gen.ts
|
|
406
|
+
var createQuerySerializer = ({
|
|
407
|
+
parameters = {},
|
|
408
|
+
...args
|
|
409
|
+
} = {}) => {
|
|
410
|
+
const querySerializer = (queryParams) => {
|
|
411
|
+
const search = [];
|
|
412
|
+
if (queryParams && typeof queryParams === "object") {
|
|
413
|
+
for (const name in queryParams) {
|
|
414
|
+
const value = queryParams[name];
|
|
415
|
+
if (value === void 0 || value === null) {
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
const options = parameters[name] || args;
|
|
419
|
+
if (Array.isArray(value)) {
|
|
420
|
+
const serializedArray = serializeArrayParam({
|
|
421
|
+
allowReserved: options.allowReserved,
|
|
422
|
+
explode: true,
|
|
423
|
+
name,
|
|
424
|
+
style: "form",
|
|
425
|
+
value,
|
|
426
|
+
...options.array
|
|
427
|
+
});
|
|
428
|
+
if (serializedArray) search.push(serializedArray);
|
|
429
|
+
} else if (typeof value === "object") {
|
|
430
|
+
const serializedObject = serializeObjectParam({
|
|
431
|
+
allowReserved: options.allowReserved,
|
|
432
|
+
explode: true,
|
|
433
|
+
name,
|
|
434
|
+
style: "deepObject",
|
|
435
|
+
value,
|
|
436
|
+
...options.object
|
|
437
|
+
});
|
|
438
|
+
if (serializedObject) search.push(serializedObject);
|
|
439
|
+
} else {
|
|
440
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
441
|
+
allowReserved: options.allowReserved,
|
|
442
|
+
name,
|
|
443
|
+
value
|
|
444
|
+
});
|
|
445
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return search.join("&");
|
|
450
|
+
};
|
|
451
|
+
return querySerializer;
|
|
452
|
+
};
|
|
453
|
+
var getParseAs = (contentType) => {
|
|
454
|
+
if (!contentType) {
|
|
455
|
+
return "stream";
|
|
456
|
+
}
|
|
457
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
458
|
+
if (!cleanContent) {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
462
|
+
return "json";
|
|
463
|
+
}
|
|
464
|
+
if (cleanContent === "multipart/form-data") {
|
|
465
|
+
return "formData";
|
|
466
|
+
}
|
|
467
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
468
|
+
return "blob";
|
|
469
|
+
}
|
|
470
|
+
if (cleanContent.startsWith("text/")) {
|
|
471
|
+
return "text";
|
|
472
|
+
}
|
|
473
|
+
return;
|
|
474
|
+
};
|
|
475
|
+
var checkForExistence = (options, name) => {
|
|
476
|
+
if (!name) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
return false;
|
|
483
|
+
};
|
|
484
|
+
async function setAuthParams(options) {
|
|
485
|
+
for (const auth of options.security ?? []) {
|
|
486
|
+
if (checkForExistence(options, auth.name)) {
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
const token = await getAuthToken(auth, options.auth);
|
|
490
|
+
if (!token) {
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
const name = auth.name ?? "Authorization";
|
|
494
|
+
switch (auth.in) {
|
|
495
|
+
case "query":
|
|
496
|
+
if (!options.query) {
|
|
497
|
+
options.query = {};
|
|
498
|
+
}
|
|
499
|
+
options.query[name] = token;
|
|
500
|
+
break;
|
|
501
|
+
case "cookie":
|
|
502
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
503
|
+
break;
|
|
504
|
+
case "header":
|
|
505
|
+
default:
|
|
506
|
+
options.headers.set(name, token);
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
var buildUrl = (options) => getUrl({
|
|
512
|
+
baseUrl: options.baseUrl,
|
|
513
|
+
path: options.path,
|
|
514
|
+
query: options.query,
|
|
515
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
516
|
+
url: options.url
|
|
517
|
+
});
|
|
518
|
+
var mergeConfigs = (a, b) => {
|
|
519
|
+
const config = { ...a, ...b };
|
|
520
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
521
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
522
|
+
}
|
|
523
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
524
|
+
return config;
|
|
525
|
+
};
|
|
526
|
+
var headersEntries = (headers) => {
|
|
527
|
+
const entries = [];
|
|
528
|
+
headers.forEach((value, key) => {
|
|
529
|
+
entries.push([key, value]);
|
|
530
|
+
});
|
|
531
|
+
return entries;
|
|
532
|
+
};
|
|
533
|
+
var mergeHeaders = (...headers) => {
|
|
534
|
+
const mergedHeaders = new Headers();
|
|
535
|
+
for (const header of headers) {
|
|
536
|
+
if (!header) {
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
540
|
+
for (const [key, value] of iterator) {
|
|
541
|
+
if (value === null) {
|
|
542
|
+
mergedHeaders.delete(key);
|
|
543
|
+
} else if (Array.isArray(value)) {
|
|
544
|
+
for (const v of value) {
|
|
545
|
+
mergedHeaders.append(key, v);
|
|
546
|
+
}
|
|
547
|
+
} else if (value !== void 0) {
|
|
548
|
+
mergedHeaders.set(
|
|
549
|
+
key,
|
|
550
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return mergedHeaders;
|
|
556
|
+
};
|
|
557
|
+
var Interceptors = class {
|
|
558
|
+
fns = [];
|
|
559
|
+
clear() {
|
|
560
|
+
this.fns = [];
|
|
561
|
+
}
|
|
562
|
+
eject(id) {
|
|
563
|
+
const index = this.getInterceptorIndex(id);
|
|
564
|
+
if (this.fns[index]) {
|
|
565
|
+
this.fns[index] = null;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
exists(id) {
|
|
569
|
+
const index = this.getInterceptorIndex(id);
|
|
570
|
+
return Boolean(this.fns[index]);
|
|
571
|
+
}
|
|
572
|
+
getInterceptorIndex(id) {
|
|
573
|
+
if (typeof id === "number") {
|
|
574
|
+
return this.fns[id] ? id : -1;
|
|
575
|
+
}
|
|
576
|
+
return this.fns.indexOf(id);
|
|
577
|
+
}
|
|
578
|
+
update(id, fn) {
|
|
579
|
+
const index = this.getInterceptorIndex(id);
|
|
580
|
+
if (this.fns[index]) {
|
|
581
|
+
this.fns[index] = fn;
|
|
582
|
+
return id;
|
|
583
|
+
}
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
use(fn) {
|
|
587
|
+
this.fns.push(fn);
|
|
588
|
+
return this.fns.length - 1;
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
var createInterceptors = () => ({
|
|
592
|
+
error: new Interceptors(),
|
|
593
|
+
request: new Interceptors(),
|
|
594
|
+
response: new Interceptors()
|
|
595
|
+
});
|
|
596
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
597
|
+
allowReserved: false,
|
|
598
|
+
array: {
|
|
599
|
+
explode: true,
|
|
600
|
+
style: "form"
|
|
601
|
+
},
|
|
602
|
+
object: {
|
|
603
|
+
explode: true,
|
|
604
|
+
style: "deepObject"
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
var defaultHeaders = {
|
|
608
|
+
"Content-Type": "application/json"
|
|
609
|
+
};
|
|
610
|
+
var createConfig = (override = {}) => ({
|
|
611
|
+
...jsonBodySerializer,
|
|
612
|
+
headers: defaultHeaders,
|
|
613
|
+
parseAs: "auto",
|
|
614
|
+
querySerializer: defaultQuerySerializer,
|
|
615
|
+
...override
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
// src/client/client/client.gen.ts
|
|
619
|
+
var createClient = (config = {}) => {
|
|
620
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
621
|
+
const getConfig = () => ({ ..._config });
|
|
622
|
+
const setConfig = (config2) => {
|
|
623
|
+
_config = mergeConfigs(_config, config2);
|
|
624
|
+
return getConfig();
|
|
625
|
+
};
|
|
626
|
+
const interceptors = createInterceptors();
|
|
627
|
+
const beforeRequest = async (options) => {
|
|
628
|
+
const opts = {
|
|
629
|
+
..._config,
|
|
630
|
+
...options,
|
|
631
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
632
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
633
|
+
serializedBody: void 0
|
|
634
|
+
};
|
|
635
|
+
if (opts.security) {
|
|
636
|
+
await setAuthParams(opts);
|
|
637
|
+
}
|
|
638
|
+
if (opts.requestValidator) {
|
|
639
|
+
await opts.requestValidator(opts);
|
|
640
|
+
}
|
|
641
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
642
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
643
|
+
}
|
|
644
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
645
|
+
opts.headers.delete("Content-Type");
|
|
646
|
+
}
|
|
647
|
+
const resolvedOpts = opts;
|
|
648
|
+
const url = buildUrl(resolvedOpts);
|
|
649
|
+
return { opts: resolvedOpts, url };
|
|
650
|
+
};
|
|
651
|
+
const request = async (options) => {
|
|
652
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
653
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
654
|
+
let request2;
|
|
655
|
+
let response;
|
|
656
|
+
try {
|
|
657
|
+
const { opts, url } = await beforeRequest(options);
|
|
658
|
+
const requestInit = {
|
|
659
|
+
redirect: "follow",
|
|
660
|
+
...opts,
|
|
661
|
+
body: getValidRequestBody(opts)
|
|
662
|
+
};
|
|
663
|
+
request2 = new Request(url, requestInit);
|
|
664
|
+
for (const fn of interceptors.request.fns) {
|
|
665
|
+
if (fn) {
|
|
666
|
+
request2 = await fn(request2, opts);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
const _fetch = opts.fetch;
|
|
670
|
+
response = await _fetch(request2);
|
|
671
|
+
for (const fn of interceptors.response.fns) {
|
|
672
|
+
if (fn) {
|
|
673
|
+
response = await fn(response, request2, opts);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
const result = {
|
|
677
|
+
request: request2,
|
|
678
|
+
response
|
|
679
|
+
};
|
|
680
|
+
if (response.ok) {
|
|
681
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
682
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
683
|
+
let emptyData;
|
|
684
|
+
switch (parseAs) {
|
|
685
|
+
case "arrayBuffer":
|
|
686
|
+
case "blob":
|
|
687
|
+
case "text":
|
|
688
|
+
emptyData = await response[parseAs]();
|
|
689
|
+
break;
|
|
690
|
+
case "formData":
|
|
691
|
+
emptyData = new FormData();
|
|
692
|
+
break;
|
|
693
|
+
case "stream":
|
|
694
|
+
emptyData = response.body;
|
|
695
|
+
break;
|
|
696
|
+
case "json":
|
|
697
|
+
default:
|
|
698
|
+
emptyData = {};
|
|
699
|
+
break;
|
|
700
|
+
}
|
|
701
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
702
|
+
data: emptyData,
|
|
703
|
+
...result
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
let data;
|
|
707
|
+
switch (parseAs) {
|
|
708
|
+
case "arrayBuffer":
|
|
709
|
+
case "blob":
|
|
710
|
+
case "formData":
|
|
711
|
+
case "text":
|
|
712
|
+
data = await response[parseAs]();
|
|
713
|
+
break;
|
|
714
|
+
case "json": {
|
|
715
|
+
const text = await response.text();
|
|
716
|
+
data = text ? JSON.parse(text) : {};
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
case "stream":
|
|
720
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
721
|
+
data: response.body,
|
|
722
|
+
...result
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
if (parseAs === "json") {
|
|
726
|
+
if (opts.responseValidator) {
|
|
727
|
+
await opts.responseValidator(data);
|
|
728
|
+
}
|
|
729
|
+
if (opts.responseTransformer) {
|
|
730
|
+
data = await opts.responseTransformer(data);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return opts.responseStyle === "data" ? data : {
|
|
734
|
+
data,
|
|
735
|
+
...result
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
const textError = await response.text();
|
|
739
|
+
let jsonError;
|
|
740
|
+
try {
|
|
741
|
+
jsonError = JSON.parse(textError);
|
|
742
|
+
} catch {
|
|
743
|
+
}
|
|
744
|
+
throw jsonError ?? textError;
|
|
745
|
+
} catch (error) {
|
|
746
|
+
let finalError = error;
|
|
747
|
+
for (const fn of interceptors.error.fns) {
|
|
748
|
+
if (fn) {
|
|
749
|
+
finalError = await fn(finalError, response, request2, options);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
finalError = finalError || {};
|
|
753
|
+
if (throwOnError) {
|
|
754
|
+
throw finalError;
|
|
755
|
+
}
|
|
756
|
+
return responseStyle === "data" ? void 0 : {
|
|
757
|
+
error: finalError,
|
|
758
|
+
request: request2,
|
|
759
|
+
response
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
764
|
+
const makeSseFn = (method) => async (options) => {
|
|
765
|
+
const { opts, url } = await beforeRequest(options);
|
|
766
|
+
return createSseClient({
|
|
767
|
+
...opts,
|
|
768
|
+
body: opts.body,
|
|
769
|
+
method,
|
|
770
|
+
onRequest: async (url2, init) => {
|
|
771
|
+
let request2 = new Request(url2, init);
|
|
772
|
+
for (const fn of interceptors.request.fns) {
|
|
773
|
+
if (fn) {
|
|
774
|
+
request2 = await fn(request2, opts);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return request2;
|
|
778
|
+
},
|
|
779
|
+
serializedBody: getValidRequestBody(opts),
|
|
780
|
+
url
|
|
781
|
+
});
|
|
782
|
+
};
|
|
783
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
784
|
+
return {
|
|
785
|
+
buildUrl: _buildUrl,
|
|
786
|
+
connect: makeMethodFn("CONNECT"),
|
|
787
|
+
delete: makeMethodFn("DELETE"),
|
|
788
|
+
get: makeMethodFn("GET"),
|
|
789
|
+
getConfig,
|
|
790
|
+
head: makeMethodFn("HEAD"),
|
|
791
|
+
interceptors,
|
|
792
|
+
options: makeMethodFn("OPTIONS"),
|
|
793
|
+
patch: makeMethodFn("PATCH"),
|
|
794
|
+
post: makeMethodFn("POST"),
|
|
795
|
+
put: makeMethodFn("PUT"),
|
|
796
|
+
request,
|
|
797
|
+
setConfig,
|
|
798
|
+
sse: {
|
|
799
|
+
connect: makeSseFn("CONNECT"),
|
|
800
|
+
delete: makeSseFn("DELETE"),
|
|
801
|
+
get: makeSseFn("GET"),
|
|
802
|
+
head: makeSseFn("HEAD"),
|
|
803
|
+
options: makeSseFn("OPTIONS"),
|
|
804
|
+
patch: makeSseFn("PATCH"),
|
|
805
|
+
post: makeSseFn("POST"),
|
|
806
|
+
put: makeSseFn("PUT"),
|
|
807
|
+
trace: makeSseFn("TRACE")
|
|
808
|
+
},
|
|
809
|
+
trace: makeMethodFn("TRACE")
|
|
810
|
+
};
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
// src/token-cache.ts
|
|
814
|
+
function createTokenCache(getToken) {
|
|
815
|
+
let cached;
|
|
816
|
+
let inFlight;
|
|
817
|
+
const mint = () => {
|
|
818
|
+
if (!inFlight) {
|
|
819
|
+
inFlight = Promise.resolve().then(getToken).then((token) => {
|
|
820
|
+
cached = token;
|
|
821
|
+
return token;
|
|
822
|
+
}).finally(() => {
|
|
823
|
+
inFlight = void 0;
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
return inFlight;
|
|
827
|
+
};
|
|
828
|
+
return {
|
|
829
|
+
current() {
|
|
830
|
+
return cached !== void 0 ? Promise.resolve(cached) : mint();
|
|
831
|
+
},
|
|
832
|
+
refresh() {
|
|
833
|
+
cached = void 0;
|
|
834
|
+
return mint();
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
// src/client.ts
|
|
840
|
+
var DEFAULT_BASE_URL = "https://api.postrun.ai/v1";
|
|
841
|
+
var UNAUTHORIZED = 401;
|
|
842
|
+
function createRetryingFetch(tokenCache) {
|
|
843
|
+
const realFetch = (...args) => globalThis.fetch(...args);
|
|
844
|
+
return async (input, init) => {
|
|
845
|
+
const request = new Request(input, init);
|
|
846
|
+
const retryable = request.clone();
|
|
847
|
+
const response = await realFetch(request);
|
|
848
|
+
if (response.status !== UNAUTHORIZED) {
|
|
849
|
+
return response;
|
|
850
|
+
}
|
|
851
|
+
try {
|
|
852
|
+
const token = await tokenCache.refresh();
|
|
853
|
+
const headers = new Headers(retryable.headers);
|
|
854
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
855
|
+
return await realFetch(new Request(retryable, { headers }));
|
|
856
|
+
} catch {
|
|
857
|
+
return response;
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
function appendScalar(parts, key, value) {
|
|
862
|
+
parts.push(
|
|
863
|
+
`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
function serializeQuery(query) {
|
|
867
|
+
const parts = [];
|
|
868
|
+
for (const [key, value] of Object.entries(query)) {
|
|
869
|
+
if (value === void 0 || value === null) {
|
|
870
|
+
continue;
|
|
871
|
+
}
|
|
872
|
+
if (Array.isArray(value)) {
|
|
873
|
+
for (const item of value) {
|
|
874
|
+
if (item !== void 0 && item !== null) {
|
|
875
|
+
appendScalar(parts, key, item);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
} else if (typeof value === "object") {
|
|
879
|
+
appendScalar(parts, key, JSON.stringify(value));
|
|
880
|
+
} else {
|
|
881
|
+
appendScalar(parts, key, value);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return parts.join("&");
|
|
885
|
+
}
|
|
886
|
+
function createPostrunClient(options) {
|
|
887
|
+
const tokenCache = createTokenCache(options.getToken);
|
|
888
|
+
const client2 = createClient(
|
|
889
|
+
createConfig({
|
|
890
|
+
baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
|
|
891
|
+
auth: () => tokenCache.current(),
|
|
892
|
+
fetch: createRetryingFetch(tokenCache),
|
|
893
|
+
querySerializer: serializeQuery,
|
|
894
|
+
throwOnError: true
|
|
895
|
+
})
|
|
896
|
+
);
|
|
897
|
+
client2.interceptors.error.use(
|
|
898
|
+
(error, response) => error instanceof PostrunError ? error : new PostrunError(response?.status ?? 0, error)
|
|
899
|
+
);
|
|
900
|
+
return client2;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
// src/client/client.gen.ts
|
|
904
|
+
var client = createClient(createConfig({ baseUrl: "https://api.postrun.ai/v1", throwOnError: true }));
|
|
905
|
+
|
|
906
|
+
// src/client/sdk.gen.ts
|
|
907
|
+
var profilesList = (options) => (options?.client ?? client).get({
|
|
908
|
+
security: [{
|
|
909
|
+
key: "secretKey",
|
|
910
|
+
scheme: "bearer",
|
|
911
|
+
type: "http"
|
|
912
|
+
}, {
|
|
913
|
+
key: "frontendToken",
|
|
914
|
+
scheme: "bearer",
|
|
915
|
+
type: "http"
|
|
916
|
+
}],
|
|
917
|
+
url: "/profiles",
|
|
918
|
+
...options
|
|
919
|
+
});
|
|
920
|
+
var profilesCreate = (options) => (options.client ?? client).post({
|
|
921
|
+
security: [{
|
|
922
|
+
key: "secretKey",
|
|
923
|
+
scheme: "bearer",
|
|
924
|
+
type: "http"
|
|
925
|
+
}, {
|
|
926
|
+
key: "frontendToken",
|
|
927
|
+
scheme: "bearer",
|
|
928
|
+
type: "http"
|
|
929
|
+
}],
|
|
930
|
+
url: "/profiles",
|
|
931
|
+
...options,
|
|
932
|
+
headers: {
|
|
933
|
+
"Content-Type": "application/json",
|
|
934
|
+
...options.headers
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
var profilesDelete = (options) => (options.client ?? client).delete({
|
|
938
|
+
security: [{
|
|
939
|
+
key: "secretKey",
|
|
940
|
+
scheme: "bearer",
|
|
941
|
+
type: "http"
|
|
942
|
+
}, {
|
|
943
|
+
key: "frontendToken",
|
|
944
|
+
scheme: "bearer",
|
|
945
|
+
type: "http"
|
|
946
|
+
}],
|
|
947
|
+
url: "/profiles/{id}",
|
|
948
|
+
...options
|
|
949
|
+
});
|
|
950
|
+
var profilesGet = (options) => (options.client ?? client).get({
|
|
951
|
+
security: [{
|
|
952
|
+
key: "secretKey",
|
|
953
|
+
scheme: "bearer",
|
|
954
|
+
type: "http"
|
|
955
|
+
}, {
|
|
956
|
+
key: "frontendToken",
|
|
957
|
+
scheme: "bearer",
|
|
958
|
+
type: "http"
|
|
959
|
+
}],
|
|
960
|
+
url: "/profiles/{id}",
|
|
961
|
+
...options
|
|
962
|
+
});
|
|
963
|
+
var profilesUpdate = (options) => (options.client ?? client).patch({
|
|
964
|
+
security: [{
|
|
965
|
+
key: "secretKey",
|
|
966
|
+
scheme: "bearer",
|
|
967
|
+
type: "http"
|
|
968
|
+
}, {
|
|
969
|
+
key: "frontendToken",
|
|
970
|
+
scheme: "bearer",
|
|
971
|
+
type: "http"
|
|
972
|
+
}],
|
|
973
|
+
url: "/profiles/{id}",
|
|
974
|
+
...options,
|
|
975
|
+
headers: {
|
|
976
|
+
"Content-Type": "application/json",
|
|
977
|
+
...options.headers
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
var connectionsListByProfile = (options) => (options.client ?? client).get({
|
|
981
|
+
security: [{
|
|
982
|
+
key: "secretKey",
|
|
983
|
+
scheme: "bearer",
|
|
984
|
+
type: "http"
|
|
985
|
+
}, {
|
|
986
|
+
key: "frontendToken",
|
|
987
|
+
scheme: "bearer",
|
|
988
|
+
type: "http"
|
|
989
|
+
}],
|
|
990
|
+
url: "/profiles/{id}/connections",
|
|
991
|
+
...options
|
|
992
|
+
});
|
|
993
|
+
var connectionsDelete = (options) => (options.client ?? client).delete({
|
|
994
|
+
security: [{
|
|
995
|
+
key: "secretKey",
|
|
996
|
+
scheme: "bearer",
|
|
997
|
+
type: "http"
|
|
998
|
+
}, {
|
|
999
|
+
key: "frontendToken",
|
|
1000
|
+
scheme: "bearer",
|
|
1001
|
+
type: "http"
|
|
1002
|
+
}],
|
|
1003
|
+
url: "/connections/{id}",
|
|
1004
|
+
...options
|
|
1005
|
+
});
|
|
1006
|
+
var connectionsGet = (options) => (options.client ?? client).get({
|
|
1007
|
+
security: [{
|
|
1008
|
+
key: "secretKey",
|
|
1009
|
+
scheme: "bearer",
|
|
1010
|
+
type: "http"
|
|
1011
|
+
}, {
|
|
1012
|
+
key: "frontendToken",
|
|
1013
|
+
scheme: "bearer",
|
|
1014
|
+
type: "http"
|
|
1015
|
+
}],
|
|
1016
|
+
url: "/connections/{id}",
|
|
1017
|
+
...options
|
|
1018
|
+
});
|
|
1019
|
+
var connectionsSelect = (options) => (options.client ?? client).patch({
|
|
1020
|
+
security: [{
|
|
1021
|
+
key: "secretKey",
|
|
1022
|
+
scheme: "bearer",
|
|
1023
|
+
type: "http"
|
|
1024
|
+
}, {
|
|
1025
|
+
key: "frontendToken",
|
|
1026
|
+
scheme: "bearer",
|
|
1027
|
+
type: "http"
|
|
1028
|
+
}],
|
|
1029
|
+
url: "/connections/{id}",
|
|
1030
|
+
...options,
|
|
1031
|
+
headers: {
|
|
1032
|
+
"Content-Type": "application/json",
|
|
1033
|
+
...options.headers
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
var connectionsListAccounts = (options) => (options.client ?? client).get({
|
|
1037
|
+
security: [{
|
|
1038
|
+
key: "secretKey",
|
|
1039
|
+
scheme: "bearer",
|
|
1040
|
+
type: "http"
|
|
1041
|
+
}, {
|
|
1042
|
+
key: "frontendToken",
|
|
1043
|
+
scheme: "bearer",
|
|
1044
|
+
type: "http"
|
|
1045
|
+
}],
|
|
1046
|
+
url: "/connections/{id}/accounts",
|
|
1047
|
+
...options
|
|
1048
|
+
});
|
|
1049
|
+
var connectionsConnect = (options) => (options.client ?? client).post({
|
|
1050
|
+
security: [{
|
|
1051
|
+
key: "secretKey",
|
|
1052
|
+
scheme: "bearer",
|
|
1053
|
+
type: "http"
|
|
1054
|
+
}, {
|
|
1055
|
+
key: "frontendToken",
|
|
1056
|
+
scheme: "bearer",
|
|
1057
|
+
type: "http"
|
|
1058
|
+
}],
|
|
1059
|
+
url: "/profiles/{id}/connect",
|
|
1060
|
+
...options,
|
|
1061
|
+
headers: {
|
|
1062
|
+
"Content-Type": "application/json",
|
|
1063
|
+
...options.headers
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
var mediaList = (options) => (options?.client ?? client).get({
|
|
1067
|
+
security: [{
|
|
1068
|
+
key: "secretKey",
|
|
1069
|
+
scheme: "bearer",
|
|
1070
|
+
type: "http"
|
|
1071
|
+
}, {
|
|
1072
|
+
key: "frontendToken",
|
|
1073
|
+
scheme: "bearer",
|
|
1074
|
+
type: "http"
|
|
1075
|
+
}],
|
|
1076
|
+
url: "/media",
|
|
1077
|
+
...options
|
|
1078
|
+
});
|
|
1079
|
+
var mediaCreate = (options) => (options.client ?? client).post({
|
|
1080
|
+
security: [{
|
|
1081
|
+
key: "secretKey",
|
|
1082
|
+
scheme: "bearer",
|
|
1083
|
+
type: "http"
|
|
1084
|
+
}, {
|
|
1085
|
+
key: "frontendToken",
|
|
1086
|
+
scheme: "bearer",
|
|
1087
|
+
type: "http"
|
|
1088
|
+
}],
|
|
1089
|
+
url: "/media",
|
|
1090
|
+
...options,
|
|
1091
|
+
headers: {
|
|
1092
|
+
"Content-Type": "application/json",
|
|
1093
|
+
...options.headers
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
var mediaDelete = (options) => (options.client ?? client).delete({
|
|
1097
|
+
security: [{
|
|
1098
|
+
key: "secretKey",
|
|
1099
|
+
scheme: "bearer",
|
|
1100
|
+
type: "http"
|
|
1101
|
+
}, {
|
|
1102
|
+
key: "frontendToken",
|
|
1103
|
+
scheme: "bearer",
|
|
1104
|
+
type: "http"
|
|
1105
|
+
}],
|
|
1106
|
+
url: "/media/{id}",
|
|
1107
|
+
...options
|
|
1108
|
+
});
|
|
1109
|
+
var mediaGet = (options) => (options.client ?? client).get({
|
|
1110
|
+
security: [{
|
|
1111
|
+
key: "secretKey",
|
|
1112
|
+
scheme: "bearer",
|
|
1113
|
+
type: "http"
|
|
1114
|
+
}, {
|
|
1115
|
+
key: "frontendToken",
|
|
1116
|
+
scheme: "bearer",
|
|
1117
|
+
type: "http"
|
|
1118
|
+
}],
|
|
1119
|
+
url: "/media/{id}",
|
|
1120
|
+
...options
|
|
1121
|
+
});
|
|
1122
|
+
var mediaUpdate = (options) => (options.client ?? client).patch({
|
|
1123
|
+
security: [{
|
|
1124
|
+
key: "secretKey",
|
|
1125
|
+
scheme: "bearer",
|
|
1126
|
+
type: "http"
|
|
1127
|
+
}, {
|
|
1128
|
+
key: "frontendToken",
|
|
1129
|
+
scheme: "bearer",
|
|
1130
|
+
type: "http"
|
|
1131
|
+
}],
|
|
1132
|
+
url: "/media/{id}",
|
|
1133
|
+
...options,
|
|
1134
|
+
headers: {
|
|
1135
|
+
"Content-Type": "application/json",
|
|
1136
|
+
...options.headers
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
var mediaSignPart = (options) => (options.client ?? client).post({
|
|
1140
|
+
security: [{
|
|
1141
|
+
key: "secretKey",
|
|
1142
|
+
scheme: "bearer",
|
|
1143
|
+
type: "http"
|
|
1144
|
+
}, {
|
|
1145
|
+
key: "frontendToken",
|
|
1146
|
+
scheme: "bearer",
|
|
1147
|
+
type: "http"
|
|
1148
|
+
}],
|
|
1149
|
+
url: "/media/{id}/multipart/sign",
|
|
1150
|
+
...options,
|
|
1151
|
+
headers: {
|
|
1152
|
+
"Content-Type": "application/json",
|
|
1153
|
+
...options.headers
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1156
|
+
var mediaListParts = (options) => (options.client ?? client).get({
|
|
1157
|
+
security: [{
|
|
1158
|
+
key: "secretKey",
|
|
1159
|
+
scheme: "bearer",
|
|
1160
|
+
type: "http"
|
|
1161
|
+
}, {
|
|
1162
|
+
key: "frontendToken",
|
|
1163
|
+
scheme: "bearer",
|
|
1164
|
+
type: "http"
|
|
1165
|
+
}],
|
|
1166
|
+
url: "/media/{id}/multipart/parts",
|
|
1167
|
+
...options
|
|
1168
|
+
});
|
|
1169
|
+
var mediaComplete = (options) => (options.client ?? client).post({
|
|
1170
|
+
security: [{
|
|
1171
|
+
key: "secretKey",
|
|
1172
|
+
scheme: "bearer",
|
|
1173
|
+
type: "http"
|
|
1174
|
+
}, {
|
|
1175
|
+
key: "frontendToken",
|
|
1176
|
+
scheme: "bearer",
|
|
1177
|
+
type: "http"
|
|
1178
|
+
}],
|
|
1179
|
+
url: "/media/{id}/multipart/complete",
|
|
1180
|
+
...options,
|
|
1181
|
+
headers: {
|
|
1182
|
+
"Content-Type": "application/json",
|
|
1183
|
+
...options.headers
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
var mediaAbort = (options) => (options.client ?? client).post({
|
|
1187
|
+
security: [{
|
|
1188
|
+
key: "secretKey",
|
|
1189
|
+
scheme: "bearer",
|
|
1190
|
+
type: "http"
|
|
1191
|
+
}, {
|
|
1192
|
+
key: "frontendToken",
|
|
1193
|
+
scheme: "bearer",
|
|
1194
|
+
type: "http"
|
|
1195
|
+
}],
|
|
1196
|
+
url: "/media/{id}/multipart/abort",
|
|
1197
|
+
...options
|
|
1198
|
+
});
|
|
1199
|
+
var postsList = (options) => (options?.client ?? client).get({
|
|
1200
|
+
security: [{
|
|
1201
|
+
key: "secretKey",
|
|
1202
|
+
scheme: "bearer",
|
|
1203
|
+
type: "http"
|
|
1204
|
+
}, {
|
|
1205
|
+
key: "frontendToken",
|
|
1206
|
+
scheme: "bearer",
|
|
1207
|
+
type: "http"
|
|
1208
|
+
}],
|
|
1209
|
+
url: "/posts",
|
|
1210
|
+
...options
|
|
1211
|
+
});
|
|
1212
|
+
var postsCreate = (options) => (options.client ?? client).post({
|
|
1213
|
+
security: [{
|
|
1214
|
+
key: "secretKey",
|
|
1215
|
+
scheme: "bearer",
|
|
1216
|
+
type: "http"
|
|
1217
|
+
}, {
|
|
1218
|
+
key: "frontendToken",
|
|
1219
|
+
scheme: "bearer",
|
|
1220
|
+
type: "http"
|
|
1221
|
+
}],
|
|
1222
|
+
url: "/posts",
|
|
1223
|
+
...options,
|
|
1224
|
+
headers: {
|
|
1225
|
+
"Content-Type": "application/json",
|
|
1226
|
+
...options.headers
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
var postsDelete = (options) => (options.client ?? client).delete({
|
|
1230
|
+
security: [{
|
|
1231
|
+
key: "secretKey",
|
|
1232
|
+
scheme: "bearer",
|
|
1233
|
+
type: "http"
|
|
1234
|
+
}, {
|
|
1235
|
+
key: "frontendToken",
|
|
1236
|
+
scheme: "bearer",
|
|
1237
|
+
type: "http"
|
|
1238
|
+
}],
|
|
1239
|
+
url: "/posts/{id}",
|
|
1240
|
+
...options
|
|
1241
|
+
});
|
|
1242
|
+
var postsGet = (options) => (options.client ?? client).get({
|
|
1243
|
+
security: [{
|
|
1244
|
+
key: "secretKey",
|
|
1245
|
+
scheme: "bearer",
|
|
1246
|
+
type: "http"
|
|
1247
|
+
}, {
|
|
1248
|
+
key: "frontendToken",
|
|
1249
|
+
scheme: "bearer",
|
|
1250
|
+
type: "http"
|
|
1251
|
+
}],
|
|
1252
|
+
url: "/posts/{id}",
|
|
1253
|
+
...options
|
|
1254
|
+
});
|
|
1255
|
+
var postsUpdate = (options) => (options.client ?? client).patch({
|
|
1256
|
+
security: [{
|
|
1257
|
+
key: "secretKey",
|
|
1258
|
+
scheme: "bearer",
|
|
1259
|
+
type: "http"
|
|
1260
|
+
}, {
|
|
1261
|
+
key: "frontendToken",
|
|
1262
|
+
scheme: "bearer",
|
|
1263
|
+
type: "http"
|
|
1264
|
+
}],
|
|
1265
|
+
url: "/posts/{id}",
|
|
1266
|
+
...options,
|
|
1267
|
+
headers: {
|
|
1268
|
+
"Content-Type": "application/json",
|
|
1269
|
+
...options.headers
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
var postsRetry = (options) => (options.client ?? client).post({
|
|
1273
|
+
security: [{
|
|
1274
|
+
key: "secretKey",
|
|
1275
|
+
scheme: "bearer",
|
|
1276
|
+
type: "http"
|
|
1277
|
+
}, {
|
|
1278
|
+
key: "frontendToken",
|
|
1279
|
+
scheme: "bearer",
|
|
1280
|
+
type: "http"
|
|
1281
|
+
}],
|
|
1282
|
+
url: "/posts/{id}/retry",
|
|
1283
|
+
...options,
|
|
1284
|
+
headers: {
|
|
1285
|
+
"Content-Type": "application/json",
|
|
1286
|
+
...options.headers
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
var postsValidate = (options) => (options.client ?? client).post({
|
|
1290
|
+
security: [{
|
|
1291
|
+
key: "secretKey",
|
|
1292
|
+
scheme: "bearer",
|
|
1293
|
+
type: "http"
|
|
1294
|
+
}, {
|
|
1295
|
+
key: "frontendToken",
|
|
1296
|
+
scheme: "bearer",
|
|
1297
|
+
type: "http"
|
|
1298
|
+
}],
|
|
1299
|
+
url: "/posts/validate",
|
|
1300
|
+
...options,
|
|
1301
|
+
headers: {
|
|
1302
|
+
"Content-Type": "application/json",
|
|
1303
|
+
...options.headers
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
var tiktokCreatorInfo = (options) => (options.client ?? client).get({
|
|
1307
|
+
security: [{
|
|
1308
|
+
key: "secretKey",
|
|
1309
|
+
scheme: "bearer",
|
|
1310
|
+
type: "http"
|
|
1311
|
+
}, {
|
|
1312
|
+
key: "frontendToken",
|
|
1313
|
+
scheme: "bearer",
|
|
1314
|
+
type: "http"
|
|
1315
|
+
}],
|
|
1316
|
+
url: "/connections/{id}/tiktok/creator-info",
|
|
1317
|
+
...options
|
|
1318
|
+
});
|
|
1319
|
+
var logsList = (options) => (options?.client ?? client).get({
|
|
1320
|
+
security: [{
|
|
1321
|
+
key: "secretKey",
|
|
1322
|
+
scheme: "bearer",
|
|
1323
|
+
type: "http"
|
|
1324
|
+
}],
|
|
1325
|
+
url: "/logs",
|
|
1326
|
+
...options
|
|
1327
|
+
});
|
|
1328
|
+
var logsGet = (options) => (options.client ?? client).get({
|
|
1329
|
+
security: [{
|
|
1330
|
+
key: "secretKey",
|
|
1331
|
+
scheme: "bearer",
|
|
1332
|
+
type: "http"
|
|
1333
|
+
}],
|
|
1334
|
+
url: "/logs/{id}",
|
|
1335
|
+
...options
|
|
1336
|
+
});
|
|
1337
|
+
var webhooksListEndpoints = (options) => (options?.client ?? client).get({
|
|
1338
|
+
security: [{
|
|
1339
|
+
key: "secretKey",
|
|
1340
|
+
scheme: "bearer",
|
|
1341
|
+
type: "http"
|
|
1342
|
+
}],
|
|
1343
|
+
url: "/webhooks/endpoints",
|
|
1344
|
+
...options
|
|
1345
|
+
});
|
|
1346
|
+
var webhooksCreateEndpoint = (options) => (options.client ?? client).post({
|
|
1347
|
+
security: [{
|
|
1348
|
+
key: "secretKey",
|
|
1349
|
+
scheme: "bearer",
|
|
1350
|
+
type: "http"
|
|
1351
|
+
}],
|
|
1352
|
+
url: "/webhooks/endpoints",
|
|
1353
|
+
...options,
|
|
1354
|
+
headers: {
|
|
1355
|
+
"Content-Type": "application/json",
|
|
1356
|
+
...options.headers
|
|
1357
|
+
}
|
|
1358
|
+
});
|
|
1359
|
+
var webhooksDeleteEndpoint = (options) => (options.client ?? client).delete({
|
|
1360
|
+
security: [{
|
|
1361
|
+
key: "secretKey",
|
|
1362
|
+
scheme: "bearer",
|
|
1363
|
+
type: "http"
|
|
1364
|
+
}],
|
|
1365
|
+
url: "/webhooks/endpoints/{id}",
|
|
1366
|
+
...options
|
|
1367
|
+
});
|
|
1368
|
+
var webhooksGetEndpoint = (options) => (options.client ?? client).get({
|
|
1369
|
+
security: [{
|
|
1370
|
+
key: "secretKey",
|
|
1371
|
+
scheme: "bearer",
|
|
1372
|
+
type: "http"
|
|
1373
|
+
}],
|
|
1374
|
+
url: "/webhooks/endpoints/{id}",
|
|
1375
|
+
...options
|
|
1376
|
+
});
|
|
1377
|
+
var webhooksUpdateEndpoint = (options) => (options.client ?? client).patch({
|
|
1378
|
+
security: [{
|
|
1379
|
+
key: "secretKey",
|
|
1380
|
+
scheme: "bearer",
|
|
1381
|
+
type: "http"
|
|
1382
|
+
}],
|
|
1383
|
+
url: "/webhooks/endpoints/{id}",
|
|
1384
|
+
...options,
|
|
1385
|
+
headers: {
|
|
1386
|
+
"Content-Type": "application/json",
|
|
1387
|
+
...options.headers
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
var webhooksCreatePortal = (options) => (options?.client ?? client).post({
|
|
1391
|
+
security: [{
|
|
1392
|
+
key: "secretKey",
|
|
1393
|
+
scheme: "bearer",
|
|
1394
|
+
type: "http"
|
|
1395
|
+
}],
|
|
1396
|
+
url: "/webhooks/portal",
|
|
1397
|
+
...options
|
|
1398
|
+
});
|
|
1399
|
+
var webhooksListEventTypes = (options) => (options?.client ?? client).get({
|
|
1400
|
+
security: [{
|
|
1401
|
+
key: "secretKey",
|
|
1402
|
+
scheme: "bearer",
|
|
1403
|
+
type: "http"
|
|
1404
|
+
}],
|
|
1405
|
+
url: "/webhooks/event-types",
|
|
1406
|
+
...options
|
|
1407
|
+
});
|
|
1408
|
+
var webhooksPing = (options) => (options.client ?? client).post({
|
|
1409
|
+
security: [{
|
|
1410
|
+
key: "secretKey",
|
|
1411
|
+
scheme: "bearer",
|
|
1412
|
+
type: "http"
|
|
1413
|
+
}],
|
|
1414
|
+
url: "/webhooks/ping",
|
|
1415
|
+
...options,
|
|
1416
|
+
headers: {
|
|
1417
|
+
"Content-Type": "application/json",
|
|
1418
|
+
...options.headers
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
var tokensMint = (options) => (options.client ?? client).post({
|
|
1422
|
+
security: [{
|
|
1423
|
+
key: "secretKey",
|
|
1424
|
+
scheme: "bearer",
|
|
1425
|
+
type: "http"
|
|
1426
|
+
}],
|
|
1427
|
+
url: "/tokens",
|
|
1428
|
+
...options,
|
|
1429
|
+
headers: {
|
|
1430
|
+
"Content-Type": "application/json",
|
|
1431
|
+
...options.headers
|
|
1432
|
+
}
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
export { PostrunError, connectionsConnect, connectionsDelete, connectionsGet, connectionsListAccounts, connectionsListByProfile, connectionsSelect, createPostrunClient, logsGet, logsList, mediaAbort, mediaComplete, mediaCreate, mediaDelete, mediaGet, mediaList, mediaListParts, mediaSignPart, mediaUpdate, postsCreate, postsDelete, postsGet, postsList, postsRetry, postsUpdate, postsValidate, profilesCreate, profilesDelete, profilesGet, profilesList, profilesUpdate, tiktokCreatorInfo, tokensMint, webhooksCreateEndpoint, webhooksCreatePortal, webhooksDeleteEndpoint, webhooksGetEndpoint, webhooksListEndpoints, webhooksListEventTypes, webhooksPing, webhooksUpdateEndpoint };
|
|
1436
|
+
//# sourceMappingURL=chunk-YP26OO5J.js.map
|
|
1437
|
+
//# sourceMappingURL=chunk-YP26OO5J.js.map
|