@wefunder/sdk 0.1.0-beta.1 → 0.1.0-beta.10
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/README.md +190 -114
- package/dist/index.cjs +1588 -672
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7033 -1946
- package/dist/index.d.ts +7033 -1946
- package/dist/index.js +1575 -669
- package/dist/index.js.map +1 -1
- package/examples_manifest.json +67 -0
- package/package.json +12 -9
package/dist/index.js
CHANGED
|
@@ -4,8 +4,819 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/
|
|
8
|
-
|
|
7
|
+
// src/generated/core/bodySerializer.gen.ts
|
|
8
|
+
var jsonBodySerializer = {
|
|
9
|
+
bodySerializer: (body) => JSON.stringify(
|
|
10
|
+
body,
|
|
11
|
+
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
12
|
+
)
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/generated/core/params.gen.ts
|
|
16
|
+
var extraPrefixesMap = {
|
|
17
|
+
$body_: "body",
|
|
18
|
+
$headers_: "headers",
|
|
19
|
+
$path_: "path",
|
|
20
|
+
$query_: "query"
|
|
21
|
+
};
|
|
22
|
+
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
23
|
+
|
|
24
|
+
// src/generated/core/serverSentEvents.gen.ts
|
|
25
|
+
function createSseClient({
|
|
26
|
+
onRequest,
|
|
27
|
+
onSseError,
|
|
28
|
+
onSseEvent,
|
|
29
|
+
responseTransformer,
|
|
30
|
+
responseValidator,
|
|
31
|
+
sseDefaultRetryDelay,
|
|
32
|
+
sseMaxRetryAttempts,
|
|
33
|
+
sseMaxRetryDelay,
|
|
34
|
+
sseSleepFn,
|
|
35
|
+
url,
|
|
36
|
+
...options
|
|
37
|
+
}) {
|
|
38
|
+
let lastEventId;
|
|
39
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
40
|
+
const createStream = async function* () {
|
|
41
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
42
|
+
let attempt = 0;
|
|
43
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
44
|
+
while (true) {
|
|
45
|
+
if (signal.aborted) break;
|
|
46
|
+
attempt++;
|
|
47
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
48
|
+
if (lastEventId !== void 0) {
|
|
49
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const requestInit = {
|
|
53
|
+
redirect: "follow",
|
|
54
|
+
...options,
|
|
55
|
+
body: options.serializedBody,
|
|
56
|
+
headers,
|
|
57
|
+
signal
|
|
58
|
+
};
|
|
59
|
+
let request = new Request(url, requestInit);
|
|
60
|
+
if (onRequest) {
|
|
61
|
+
request = await onRequest(url, requestInit);
|
|
62
|
+
}
|
|
63
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
64
|
+
const response = await _fetch(request);
|
|
65
|
+
if (!response.ok)
|
|
66
|
+
throw new Error(
|
|
67
|
+
`SSE failed: ${response.status} ${response.statusText}`
|
|
68
|
+
);
|
|
69
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
70
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
71
|
+
let buffer = "";
|
|
72
|
+
const abortHandler = () => {
|
|
73
|
+
try {
|
|
74
|
+
reader.cancel();
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
signal.addEventListener("abort", abortHandler);
|
|
79
|
+
try {
|
|
80
|
+
while (true) {
|
|
81
|
+
const { done, value } = await reader.read();
|
|
82
|
+
if (done) break;
|
|
83
|
+
buffer += value;
|
|
84
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
85
|
+
const chunks = buffer.split("\n\n");
|
|
86
|
+
buffer = chunks.pop() ?? "";
|
|
87
|
+
for (const chunk of chunks) {
|
|
88
|
+
const lines = chunk.split("\n");
|
|
89
|
+
const dataLines = [];
|
|
90
|
+
let eventName;
|
|
91
|
+
for (const line of lines) {
|
|
92
|
+
if (line.startsWith("data:")) {
|
|
93
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
94
|
+
} else if (line.startsWith("event:")) {
|
|
95
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
96
|
+
} else if (line.startsWith("id:")) {
|
|
97
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
98
|
+
} else if (line.startsWith("retry:")) {
|
|
99
|
+
const parsed = Number.parseInt(
|
|
100
|
+
line.replace(/^retry:\s*/, ""),
|
|
101
|
+
10
|
|
102
|
+
);
|
|
103
|
+
if (!Number.isNaN(parsed)) {
|
|
104
|
+
retryDelay = parsed;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
let data;
|
|
109
|
+
let parsedJson = false;
|
|
110
|
+
if (dataLines.length) {
|
|
111
|
+
const rawData = dataLines.join("\n");
|
|
112
|
+
try {
|
|
113
|
+
data = JSON.parse(rawData);
|
|
114
|
+
parsedJson = true;
|
|
115
|
+
} catch {
|
|
116
|
+
data = rawData;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (parsedJson) {
|
|
120
|
+
if (responseValidator) {
|
|
121
|
+
await responseValidator(data);
|
|
122
|
+
}
|
|
123
|
+
if (responseTransformer) {
|
|
124
|
+
data = await responseTransformer(data);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
onSseEvent?.({
|
|
128
|
+
data,
|
|
129
|
+
event: eventName,
|
|
130
|
+
id: lastEventId,
|
|
131
|
+
retry: retryDelay
|
|
132
|
+
});
|
|
133
|
+
if (dataLines.length) {
|
|
134
|
+
yield data;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
} finally {
|
|
139
|
+
signal.removeEventListener("abort", abortHandler);
|
|
140
|
+
reader.releaseLock();
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
} catch (error) {
|
|
144
|
+
onSseError?.(error);
|
|
145
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
const backoff = Math.min(
|
|
149
|
+
retryDelay * 2 ** (attempt - 1),
|
|
150
|
+
sseMaxRetryDelay ?? 3e4
|
|
151
|
+
);
|
|
152
|
+
await sleep(backoff);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const stream = createStream();
|
|
157
|
+
return { stream };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/generated/core/pathSerializer.gen.ts
|
|
161
|
+
var separatorArrayExplode = (style) => {
|
|
162
|
+
switch (style) {
|
|
163
|
+
case "label":
|
|
164
|
+
return ".";
|
|
165
|
+
case "matrix":
|
|
166
|
+
return ";";
|
|
167
|
+
case "simple":
|
|
168
|
+
return ",";
|
|
169
|
+
default:
|
|
170
|
+
return "&";
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var separatorArrayNoExplode = (style) => {
|
|
174
|
+
switch (style) {
|
|
175
|
+
case "form":
|
|
176
|
+
return ",";
|
|
177
|
+
case "pipeDelimited":
|
|
178
|
+
return "|";
|
|
179
|
+
case "spaceDelimited":
|
|
180
|
+
return "%20";
|
|
181
|
+
default:
|
|
182
|
+
return ",";
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
var separatorObjectExplode = (style) => {
|
|
186
|
+
switch (style) {
|
|
187
|
+
case "label":
|
|
188
|
+
return ".";
|
|
189
|
+
case "matrix":
|
|
190
|
+
return ";";
|
|
191
|
+
case "simple":
|
|
192
|
+
return ",";
|
|
193
|
+
default:
|
|
194
|
+
return "&";
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
var serializeArrayParam = ({
|
|
198
|
+
allowReserved,
|
|
199
|
+
explode,
|
|
200
|
+
name,
|
|
201
|
+
style,
|
|
202
|
+
value
|
|
203
|
+
}) => {
|
|
204
|
+
if (!explode) {
|
|
205
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
206
|
+
switch (style) {
|
|
207
|
+
case "label":
|
|
208
|
+
return `.${joinedValues2}`;
|
|
209
|
+
case "matrix":
|
|
210
|
+
return `;${name}=${joinedValues2}`;
|
|
211
|
+
case "simple":
|
|
212
|
+
return joinedValues2;
|
|
213
|
+
default:
|
|
214
|
+
return `${name}=${joinedValues2}`;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const separator = separatorArrayExplode(style);
|
|
218
|
+
const joinedValues = value.map((v) => {
|
|
219
|
+
if (style === "label" || style === "simple") {
|
|
220
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
221
|
+
}
|
|
222
|
+
return serializePrimitiveParam({
|
|
223
|
+
allowReserved,
|
|
224
|
+
name,
|
|
225
|
+
value: v
|
|
226
|
+
});
|
|
227
|
+
}).join(separator);
|
|
228
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
229
|
+
};
|
|
230
|
+
var serializePrimitiveParam = ({
|
|
231
|
+
allowReserved,
|
|
232
|
+
name,
|
|
233
|
+
value
|
|
234
|
+
}) => {
|
|
235
|
+
if (value === void 0 || value === null) {
|
|
236
|
+
return "";
|
|
237
|
+
}
|
|
238
|
+
if (typeof value === "object") {
|
|
239
|
+
throw new Error(
|
|
240
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
244
|
+
};
|
|
245
|
+
var serializeObjectParam = ({
|
|
246
|
+
allowReserved,
|
|
247
|
+
explode,
|
|
248
|
+
name,
|
|
249
|
+
style,
|
|
250
|
+
value,
|
|
251
|
+
valueOnly
|
|
252
|
+
}) => {
|
|
253
|
+
if (value instanceof Date) {
|
|
254
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
255
|
+
}
|
|
256
|
+
if (style !== "deepObject" && !explode) {
|
|
257
|
+
let values = [];
|
|
258
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
259
|
+
values = [
|
|
260
|
+
...values,
|
|
261
|
+
key,
|
|
262
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
263
|
+
];
|
|
264
|
+
});
|
|
265
|
+
const joinedValues2 = values.join(",");
|
|
266
|
+
switch (style) {
|
|
267
|
+
case "form":
|
|
268
|
+
return `${name}=${joinedValues2}`;
|
|
269
|
+
case "label":
|
|
270
|
+
return `.${joinedValues2}`;
|
|
271
|
+
case "matrix":
|
|
272
|
+
return `;${name}=${joinedValues2}`;
|
|
273
|
+
default:
|
|
274
|
+
return joinedValues2;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const separator = separatorObjectExplode(style);
|
|
278
|
+
const joinedValues = Object.entries(value).map(
|
|
279
|
+
([key, v]) => serializePrimitiveParam({
|
|
280
|
+
allowReserved,
|
|
281
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
282
|
+
value: v
|
|
283
|
+
})
|
|
284
|
+
).join(separator);
|
|
285
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
// src/generated/core/utils.gen.ts
|
|
289
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
290
|
+
var defaultPathSerializer = ({
|
|
291
|
+
path,
|
|
292
|
+
url: _url
|
|
293
|
+
}) => {
|
|
294
|
+
let url = _url;
|
|
295
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
296
|
+
if (matches) {
|
|
297
|
+
for (const match of matches) {
|
|
298
|
+
let explode = false;
|
|
299
|
+
let name = match.substring(1, match.length - 1);
|
|
300
|
+
let style = "simple";
|
|
301
|
+
if (name.endsWith("*")) {
|
|
302
|
+
explode = true;
|
|
303
|
+
name = name.substring(0, name.length - 1);
|
|
304
|
+
}
|
|
305
|
+
if (name.startsWith(".")) {
|
|
306
|
+
name = name.substring(1);
|
|
307
|
+
style = "label";
|
|
308
|
+
} else if (name.startsWith(";")) {
|
|
309
|
+
name = name.substring(1);
|
|
310
|
+
style = "matrix";
|
|
311
|
+
}
|
|
312
|
+
const value = path[name];
|
|
313
|
+
if (value === void 0 || value === null) {
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
if (Array.isArray(value)) {
|
|
317
|
+
url = url.replace(
|
|
318
|
+
match,
|
|
319
|
+
serializeArrayParam({ explode, name, style, value })
|
|
320
|
+
);
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if (typeof value === "object") {
|
|
324
|
+
url = url.replace(
|
|
325
|
+
match,
|
|
326
|
+
serializeObjectParam({
|
|
327
|
+
explode,
|
|
328
|
+
name,
|
|
329
|
+
style,
|
|
330
|
+
value,
|
|
331
|
+
valueOnly: true
|
|
332
|
+
})
|
|
333
|
+
);
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (style === "matrix") {
|
|
337
|
+
url = url.replace(
|
|
338
|
+
match,
|
|
339
|
+
`;${serializePrimitiveParam({
|
|
340
|
+
name,
|
|
341
|
+
value
|
|
342
|
+
})}`
|
|
343
|
+
);
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
const replaceValue = encodeURIComponent(
|
|
347
|
+
style === "label" ? `.${value}` : value
|
|
348
|
+
);
|
|
349
|
+
url = url.replace(match, replaceValue);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return url;
|
|
353
|
+
};
|
|
354
|
+
var getUrl = ({
|
|
355
|
+
baseUrl,
|
|
356
|
+
path,
|
|
357
|
+
query,
|
|
358
|
+
querySerializer,
|
|
359
|
+
url: _url
|
|
360
|
+
}) => {
|
|
361
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
362
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
363
|
+
if (path) {
|
|
364
|
+
url = defaultPathSerializer({ path, url });
|
|
365
|
+
}
|
|
366
|
+
let search = query ? querySerializer(query) : "";
|
|
367
|
+
if (search.startsWith("?")) {
|
|
368
|
+
search = search.substring(1);
|
|
369
|
+
}
|
|
370
|
+
if (search) {
|
|
371
|
+
url += `?${search}`;
|
|
372
|
+
}
|
|
373
|
+
return url;
|
|
374
|
+
};
|
|
375
|
+
function getValidRequestBody(options) {
|
|
376
|
+
const hasBody = options.body !== void 0;
|
|
377
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
378
|
+
if (isSerializedBody) {
|
|
379
|
+
if ("serializedBody" in options) {
|
|
380
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
381
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
382
|
+
}
|
|
383
|
+
return options.body !== "" ? options.body : null;
|
|
384
|
+
}
|
|
385
|
+
if (hasBody) {
|
|
386
|
+
return options.body;
|
|
387
|
+
}
|
|
388
|
+
return void 0;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// src/generated/core/auth.gen.ts
|
|
392
|
+
var getAuthToken = async (auth, callback) => {
|
|
393
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
394
|
+
if (!token) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (auth.scheme === "bearer") {
|
|
398
|
+
return `Bearer ${token}`;
|
|
399
|
+
}
|
|
400
|
+
if (auth.scheme === "basic") {
|
|
401
|
+
return `Basic ${btoa(token)}`;
|
|
402
|
+
}
|
|
403
|
+
return token;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// src/generated/client/utils.gen.ts
|
|
407
|
+
var createQuerySerializer = ({
|
|
408
|
+
parameters = {},
|
|
409
|
+
...args
|
|
410
|
+
} = {}) => {
|
|
411
|
+
const querySerializer = (queryParams) => {
|
|
412
|
+
const search = [];
|
|
413
|
+
if (queryParams && typeof queryParams === "object") {
|
|
414
|
+
for (const name in queryParams) {
|
|
415
|
+
const value = queryParams[name];
|
|
416
|
+
if (value === void 0 || value === null) {
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
419
|
+
const options = parameters[name] || args;
|
|
420
|
+
if (Array.isArray(value)) {
|
|
421
|
+
const serializedArray = serializeArrayParam({
|
|
422
|
+
allowReserved: options.allowReserved,
|
|
423
|
+
explode: true,
|
|
424
|
+
name,
|
|
425
|
+
style: "form",
|
|
426
|
+
value,
|
|
427
|
+
...options.array
|
|
428
|
+
});
|
|
429
|
+
if (serializedArray) search.push(serializedArray);
|
|
430
|
+
} else if (typeof value === "object") {
|
|
431
|
+
const serializedObject = serializeObjectParam({
|
|
432
|
+
allowReserved: options.allowReserved,
|
|
433
|
+
explode: true,
|
|
434
|
+
name,
|
|
435
|
+
style: "deepObject",
|
|
436
|
+
value,
|
|
437
|
+
...options.object
|
|
438
|
+
});
|
|
439
|
+
if (serializedObject) search.push(serializedObject);
|
|
440
|
+
} else {
|
|
441
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
442
|
+
allowReserved: options.allowReserved,
|
|
443
|
+
name,
|
|
444
|
+
value
|
|
445
|
+
});
|
|
446
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return search.join("&");
|
|
451
|
+
};
|
|
452
|
+
return querySerializer;
|
|
453
|
+
};
|
|
454
|
+
var getParseAs = (contentType) => {
|
|
455
|
+
if (!contentType) {
|
|
456
|
+
return "stream";
|
|
457
|
+
}
|
|
458
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
459
|
+
if (!cleanContent) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
463
|
+
return "json";
|
|
464
|
+
}
|
|
465
|
+
if (cleanContent === "multipart/form-data") {
|
|
466
|
+
return "formData";
|
|
467
|
+
}
|
|
468
|
+
if (["application/", "audio/", "image/", "video/"].some(
|
|
469
|
+
(type) => cleanContent.startsWith(type)
|
|
470
|
+
)) {
|
|
471
|
+
return "blob";
|
|
472
|
+
}
|
|
473
|
+
if (cleanContent.startsWith("text/")) {
|
|
474
|
+
return "text";
|
|
475
|
+
}
|
|
476
|
+
return;
|
|
477
|
+
};
|
|
478
|
+
var checkForExistence = (options, name) => {
|
|
479
|
+
if (!name) {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
483
|
+
return true;
|
|
484
|
+
}
|
|
485
|
+
return false;
|
|
486
|
+
};
|
|
487
|
+
async function setAuthParams(options) {
|
|
488
|
+
for (const auth of options.security ?? []) {
|
|
489
|
+
if (checkForExistence(options, auth.name)) {
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
const token = await getAuthToken(auth, options.auth);
|
|
493
|
+
if (!token) {
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
const name = auth.name ?? "Authorization";
|
|
497
|
+
switch (auth.in) {
|
|
498
|
+
case "query":
|
|
499
|
+
if (!options.query) {
|
|
500
|
+
options.query = {};
|
|
501
|
+
}
|
|
502
|
+
options.query[name] = token;
|
|
503
|
+
break;
|
|
504
|
+
case "cookie":
|
|
505
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
506
|
+
break;
|
|
507
|
+
case "header":
|
|
508
|
+
default:
|
|
509
|
+
options.headers.set(name, token);
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
var buildUrl = (options) => getUrl({
|
|
515
|
+
baseUrl: options.baseUrl,
|
|
516
|
+
path: options.path,
|
|
517
|
+
query: options.query,
|
|
518
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
519
|
+
url: options.url
|
|
520
|
+
});
|
|
521
|
+
var mergeConfigs = (a, b) => {
|
|
522
|
+
const config = { ...a, ...b };
|
|
523
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
524
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
525
|
+
}
|
|
526
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
527
|
+
return config;
|
|
528
|
+
};
|
|
529
|
+
var headersEntries = (headers) => {
|
|
530
|
+
const entries = [];
|
|
531
|
+
headers.forEach((value, key) => {
|
|
532
|
+
entries.push([key, value]);
|
|
533
|
+
});
|
|
534
|
+
return entries;
|
|
535
|
+
};
|
|
536
|
+
var mergeHeaders = (...headers) => {
|
|
537
|
+
const mergedHeaders = new Headers();
|
|
538
|
+
for (const header of headers) {
|
|
539
|
+
if (!header) {
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
543
|
+
for (const [key, value] of iterator) {
|
|
544
|
+
if (value === null) {
|
|
545
|
+
mergedHeaders.delete(key);
|
|
546
|
+
} else if (Array.isArray(value)) {
|
|
547
|
+
for (const v of value) {
|
|
548
|
+
mergedHeaders.append(key, v);
|
|
549
|
+
}
|
|
550
|
+
} else if (value !== void 0) {
|
|
551
|
+
mergedHeaders.set(
|
|
552
|
+
key,
|
|
553
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return mergedHeaders;
|
|
559
|
+
};
|
|
560
|
+
var Interceptors = class {
|
|
561
|
+
fns = [];
|
|
562
|
+
clear() {
|
|
563
|
+
this.fns = [];
|
|
564
|
+
}
|
|
565
|
+
eject(id) {
|
|
566
|
+
const index = this.getInterceptorIndex(id);
|
|
567
|
+
if (this.fns[index]) {
|
|
568
|
+
this.fns[index] = null;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
exists(id) {
|
|
572
|
+
const index = this.getInterceptorIndex(id);
|
|
573
|
+
return Boolean(this.fns[index]);
|
|
574
|
+
}
|
|
575
|
+
getInterceptorIndex(id) {
|
|
576
|
+
if (typeof id === "number") {
|
|
577
|
+
return this.fns[id] ? id : -1;
|
|
578
|
+
}
|
|
579
|
+
return this.fns.indexOf(id);
|
|
580
|
+
}
|
|
581
|
+
update(id, fn) {
|
|
582
|
+
const index = this.getInterceptorIndex(id);
|
|
583
|
+
if (this.fns[index]) {
|
|
584
|
+
this.fns[index] = fn;
|
|
585
|
+
return id;
|
|
586
|
+
}
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
use(fn) {
|
|
590
|
+
this.fns.push(fn);
|
|
591
|
+
return this.fns.length - 1;
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
var createInterceptors = () => ({
|
|
595
|
+
error: new Interceptors(),
|
|
596
|
+
request: new Interceptors(),
|
|
597
|
+
response: new Interceptors()
|
|
598
|
+
});
|
|
599
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
600
|
+
allowReserved: false,
|
|
601
|
+
array: {
|
|
602
|
+
explode: true,
|
|
603
|
+
style: "form"
|
|
604
|
+
},
|
|
605
|
+
object: {
|
|
606
|
+
explode: true,
|
|
607
|
+
style: "deepObject"
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
var defaultHeaders = {
|
|
611
|
+
"Content-Type": "application/json"
|
|
612
|
+
};
|
|
613
|
+
var createConfig = (override = {}) => ({
|
|
614
|
+
...jsonBodySerializer,
|
|
615
|
+
headers: defaultHeaders,
|
|
616
|
+
parseAs: "auto",
|
|
617
|
+
querySerializer: defaultQuerySerializer,
|
|
618
|
+
...override
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
// src/generated/client/client.gen.ts
|
|
622
|
+
var createClient = (config = {}) => {
|
|
623
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
624
|
+
const getConfig = () => ({ ..._config });
|
|
625
|
+
const setConfig = (config2) => {
|
|
626
|
+
_config = mergeConfigs(_config, config2);
|
|
627
|
+
return getConfig();
|
|
628
|
+
};
|
|
629
|
+
const interceptors = createInterceptors();
|
|
630
|
+
const beforeRequest = async (options) => {
|
|
631
|
+
const opts = {
|
|
632
|
+
..._config,
|
|
633
|
+
...options,
|
|
634
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
635
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
636
|
+
serializedBody: void 0
|
|
637
|
+
};
|
|
638
|
+
if (opts.security) {
|
|
639
|
+
await setAuthParams(opts);
|
|
640
|
+
}
|
|
641
|
+
if (opts.requestValidator) {
|
|
642
|
+
await opts.requestValidator(opts);
|
|
643
|
+
}
|
|
644
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
645
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
646
|
+
}
|
|
647
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
648
|
+
opts.headers.delete("Content-Type");
|
|
649
|
+
}
|
|
650
|
+
const resolvedOpts = opts;
|
|
651
|
+
const url = buildUrl(resolvedOpts);
|
|
652
|
+
return { opts: resolvedOpts, url };
|
|
653
|
+
};
|
|
654
|
+
const request = async (options) => {
|
|
655
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
656
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
657
|
+
let request2;
|
|
658
|
+
let response;
|
|
659
|
+
try {
|
|
660
|
+
const { opts, url } = await beforeRequest(options);
|
|
661
|
+
const requestInit = {
|
|
662
|
+
redirect: "follow",
|
|
663
|
+
...opts,
|
|
664
|
+
body: getValidRequestBody(opts)
|
|
665
|
+
};
|
|
666
|
+
request2 = new Request(url, requestInit);
|
|
667
|
+
for (const fn of interceptors.request.fns) {
|
|
668
|
+
if (fn) {
|
|
669
|
+
request2 = await fn(request2, opts);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
const _fetch = opts.fetch;
|
|
673
|
+
response = await _fetch(request2);
|
|
674
|
+
for (const fn of interceptors.response.fns) {
|
|
675
|
+
if (fn) {
|
|
676
|
+
response = await fn(response, request2, opts);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
const result = {
|
|
680
|
+
request: request2,
|
|
681
|
+
response
|
|
682
|
+
};
|
|
683
|
+
if (response.ok) {
|
|
684
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
685
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
686
|
+
let emptyData;
|
|
687
|
+
switch (parseAs) {
|
|
688
|
+
case "arrayBuffer":
|
|
689
|
+
case "blob":
|
|
690
|
+
case "text":
|
|
691
|
+
emptyData = await response[parseAs]();
|
|
692
|
+
break;
|
|
693
|
+
case "formData":
|
|
694
|
+
emptyData = new FormData();
|
|
695
|
+
break;
|
|
696
|
+
case "stream":
|
|
697
|
+
emptyData = response.body;
|
|
698
|
+
break;
|
|
699
|
+
case "json":
|
|
700
|
+
default:
|
|
701
|
+
emptyData = {};
|
|
702
|
+
break;
|
|
703
|
+
}
|
|
704
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
705
|
+
data: emptyData,
|
|
706
|
+
...result
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
let data;
|
|
710
|
+
switch (parseAs) {
|
|
711
|
+
case "arrayBuffer":
|
|
712
|
+
case "blob":
|
|
713
|
+
case "formData":
|
|
714
|
+
case "text":
|
|
715
|
+
data = await response[parseAs]();
|
|
716
|
+
break;
|
|
717
|
+
case "json": {
|
|
718
|
+
const text = await response.text();
|
|
719
|
+
data = text ? JSON.parse(text) : {};
|
|
720
|
+
break;
|
|
721
|
+
}
|
|
722
|
+
case "stream":
|
|
723
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
724
|
+
data: response.body,
|
|
725
|
+
...result
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
if (parseAs === "json") {
|
|
729
|
+
if (opts.responseValidator) {
|
|
730
|
+
await opts.responseValidator(data);
|
|
731
|
+
}
|
|
732
|
+
if (opts.responseTransformer) {
|
|
733
|
+
data = await opts.responseTransformer(data);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return opts.responseStyle === "data" ? data : {
|
|
737
|
+
data,
|
|
738
|
+
...result
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
const textError = await response.text();
|
|
742
|
+
let jsonError;
|
|
743
|
+
try {
|
|
744
|
+
jsonError = JSON.parse(textError);
|
|
745
|
+
} catch {
|
|
746
|
+
}
|
|
747
|
+
throw jsonError ?? textError;
|
|
748
|
+
} catch (error) {
|
|
749
|
+
let finalError = error;
|
|
750
|
+
for (const fn of interceptors.error.fns) {
|
|
751
|
+
if (fn) {
|
|
752
|
+
finalError = await fn(
|
|
753
|
+
finalError,
|
|
754
|
+
response,
|
|
755
|
+
request2,
|
|
756
|
+
options
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
finalError = finalError || {};
|
|
761
|
+
if (throwOnError) {
|
|
762
|
+
throw finalError;
|
|
763
|
+
}
|
|
764
|
+
return responseStyle === "data" ? void 0 : {
|
|
765
|
+
error: finalError,
|
|
766
|
+
request: request2,
|
|
767
|
+
response
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
772
|
+
const makeSseFn = (method) => async (options) => {
|
|
773
|
+
const { opts, url } = await beforeRequest(options);
|
|
774
|
+
return createSseClient({
|
|
775
|
+
...opts,
|
|
776
|
+
body: opts.body,
|
|
777
|
+
method,
|
|
778
|
+
onRequest: async (url2, init) => {
|
|
779
|
+
let request2 = new Request(url2, init);
|
|
780
|
+
for (const fn of interceptors.request.fns) {
|
|
781
|
+
if (fn) {
|
|
782
|
+
request2 = await fn(request2, opts);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return request2;
|
|
786
|
+
},
|
|
787
|
+
serializedBody: getValidRequestBody(opts),
|
|
788
|
+
url
|
|
789
|
+
});
|
|
790
|
+
};
|
|
791
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
792
|
+
return {
|
|
793
|
+
buildUrl: _buildUrl,
|
|
794
|
+
connect: makeMethodFn("CONNECT"),
|
|
795
|
+
delete: makeMethodFn("DELETE"),
|
|
796
|
+
get: makeMethodFn("GET"),
|
|
797
|
+
getConfig,
|
|
798
|
+
head: makeMethodFn("HEAD"),
|
|
799
|
+
interceptors,
|
|
800
|
+
options: makeMethodFn("OPTIONS"),
|
|
801
|
+
patch: makeMethodFn("PATCH"),
|
|
802
|
+
post: makeMethodFn("POST"),
|
|
803
|
+
put: makeMethodFn("PUT"),
|
|
804
|
+
request,
|
|
805
|
+
setConfig,
|
|
806
|
+
sse: {
|
|
807
|
+
connect: makeSseFn("CONNECT"),
|
|
808
|
+
delete: makeSseFn("DELETE"),
|
|
809
|
+
get: makeSseFn("GET"),
|
|
810
|
+
head: makeSseFn("HEAD"),
|
|
811
|
+
options: makeSseFn("OPTIONS"),
|
|
812
|
+
patch: makeSseFn("PATCH"),
|
|
813
|
+
post: makeSseFn("POST"),
|
|
814
|
+
put: makeSseFn("PUT"),
|
|
815
|
+
trace: makeSseFn("TRACE")
|
|
816
|
+
},
|
|
817
|
+
trace: makeMethodFn("TRACE")
|
|
818
|
+
};
|
|
819
|
+
};
|
|
9
820
|
|
|
10
821
|
// src/http.ts
|
|
11
822
|
var IDEMPOTENT = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
@@ -27,13 +838,6 @@ function backoffMs(attempt, opts, random) {
|
|
|
27
838
|
const jitter = exp * 0.5 * random();
|
|
28
839
|
return Math.min(exp + jitter, opts.maxDelayMs);
|
|
29
840
|
}
|
|
30
|
-
function withBearer(input, init, token) {
|
|
31
|
-
const headers = new Headers(
|
|
32
|
-
init?.headers ?? (input instanceof Request ? input.headers : void 0)
|
|
33
|
-
);
|
|
34
|
-
headers.set("Authorization", `Bearer ${token}`);
|
|
35
|
-
return { ...init, headers };
|
|
36
|
-
}
|
|
37
841
|
function createFetch(deps) {
|
|
38
842
|
const baseFetch = deps.fetch ?? fetch;
|
|
39
843
|
const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
@@ -47,21 +851,37 @@ function createFetch(deps) {
|
|
|
47
851
|
return async function wrappedFetch(input, init) {
|
|
48
852
|
const method = methodOf(input, init);
|
|
49
853
|
const idempotent = IDEMPOTENT.has(method);
|
|
854
|
+
const isRequest = input instanceof Request;
|
|
50
855
|
let refreshed = false;
|
|
51
856
|
let attempt = 0;
|
|
857
|
+
let retryToken;
|
|
858
|
+
const dispatch = (authToken) => {
|
|
859
|
+
if (isRequest) {
|
|
860
|
+
const fresh = input.clone();
|
|
861
|
+
if (authToken === void 0) return baseFetch(fresh);
|
|
862
|
+
const headers = new Headers(fresh.headers);
|
|
863
|
+
headers.set("Authorization", `Bearer ${authToken}`);
|
|
864
|
+
return baseFetch(new Request(fresh, { headers }));
|
|
865
|
+
}
|
|
866
|
+
const nextInit = authToken === void 0 ? init : (() => {
|
|
867
|
+
const headers = new Headers(init?.headers);
|
|
868
|
+
headers.set("Authorization", `Bearer ${authToken}`);
|
|
869
|
+
return { ...init, headers };
|
|
870
|
+
})();
|
|
871
|
+
return baseFetch(input, nextInit);
|
|
872
|
+
};
|
|
52
873
|
for (; ; ) {
|
|
53
874
|
let response;
|
|
54
875
|
let networkError;
|
|
55
876
|
try {
|
|
56
|
-
response = await
|
|
877
|
+
response = await dispatch(retryToken);
|
|
57
878
|
} catch (err) {
|
|
58
879
|
networkError = err;
|
|
59
880
|
}
|
|
60
|
-
|
|
61
|
-
if (response?.status === 401 && !refreshed && replayable && deps.tokenManager?.canRefresh) {
|
|
881
|
+
if (response?.status === 401 && !refreshed && deps.tokenManager?.canRefresh) {
|
|
62
882
|
refreshed = true;
|
|
63
883
|
const next = await deps.tokenManager.refresh();
|
|
64
|
-
|
|
884
|
+
retryToken = next.accessToken;
|
|
65
885
|
continue;
|
|
66
886
|
}
|
|
67
887
|
if (response?.status === 429 && attempt < retry.maxRetries) {
|
|
@@ -84,10 +904,11 @@ function createFetch(deps) {
|
|
|
84
904
|
// src/oauth.ts
|
|
85
905
|
import { createHash, randomBytes } from "crypto";
|
|
86
906
|
var DEFAULT_AUTHORIZE_BASE_URL = "https://wefunder.com/oauth";
|
|
87
|
-
var
|
|
907
|
+
var SANDBOX_AUTHORIZE_BASE_URL = "https://oauth.wefunder-sandbox.com/oauth";
|
|
908
|
+
var DEFAULT_TOKEN_BASE_URL = "https://api.wefunder.com/oauth";
|
|
88
909
|
var DEFAULT_OAUTH_BASE_URL = DEFAULT_AUTHORIZE_BASE_URL;
|
|
89
|
-
function
|
|
90
|
-
return
|
|
910
|
+
function defaultAuthorizeBase(clientId) {
|
|
911
|
+
return clientId.startsWith("pk_test_") ? SANDBOX_AUTHORIZE_BASE_URL : DEFAULT_AUTHORIZE_BASE_URL;
|
|
91
912
|
}
|
|
92
913
|
function resolveTokenBase(o) {
|
|
93
914
|
return o.tokenBaseUrl ?? o.oauthBaseUrl ?? DEFAULT_TOKEN_BASE_URL;
|
|
@@ -127,7 +948,7 @@ function generatePkce() {
|
|
|
127
948
|
return { codeVerifier, codeChallenge, codeChallengeMethod: "S256" };
|
|
128
949
|
}
|
|
129
950
|
function createAuthorizationUrl(opts) {
|
|
130
|
-
const base =
|
|
951
|
+
const base = opts.authorizeBaseUrl ?? opts.oauthBaseUrl ?? defaultAuthorizeBase(opts.clientId);
|
|
131
952
|
const q = new URLSearchParams({
|
|
132
953
|
response_type: "code",
|
|
133
954
|
client_id: opts.clientId,
|
|
@@ -315,21 +1136,36 @@ var sdk_gen_exports = {};
|
|
|
315
1136
|
__export(sdk_gen_exports, {
|
|
316
1137
|
approveSyndicateMember: () => approveSyndicateMember,
|
|
317
1138
|
closeSyndicateDeal: () => closeSyndicateDeal,
|
|
1139
|
+
createInstallation: () => createInstallation,
|
|
1140
|
+
createInstallationToken: () => createInstallationToken,
|
|
318
1141
|
createIntent: () => createIntent,
|
|
319
1142
|
createPartnerInvite: () => createPartnerInvite,
|
|
1143
|
+
createWebhookEndpoint: () => createWebhookEndpoint,
|
|
320
1144
|
createWebhookSubscription: () => createWebhookSubscription,
|
|
1145
|
+
deleteWebhookEndpoint: () => deleteWebhookEndpoint,
|
|
321
1146
|
deleteWebhookSubscription: () => deleteWebhookSubscription,
|
|
322
1147
|
demoteSyndicateMember: () => demoteSyndicateMember,
|
|
323
1148
|
exportSyndicateMembersCsv: () => exportSyndicateMembersCsv,
|
|
324
1149
|
finalizeSyndicateDeal: () => finalizeSyndicateDeal,
|
|
1150
|
+
followCompany: () => followCompany,
|
|
325
1151
|
getAttributionMe: () => getAttributionMe,
|
|
326
1152
|
getAttributionStats: () => getAttributionStats,
|
|
1153
|
+
getCompany: () => getCompany,
|
|
1154
|
+
getCompanyDisclosures: () => getCompanyDisclosures,
|
|
1155
|
+
getCompanyPitch: () => getCompanyPitch,
|
|
1156
|
+
getCompanyUpdate: () => getCompanyUpdate,
|
|
327
1157
|
getCurrentUser: () => getCurrentUser,
|
|
1158
|
+
getInstallation: () => getInstallation,
|
|
328
1159
|
getIntent: () => getIntent,
|
|
1160
|
+
getInvestment: () => getInvestment,
|
|
329
1161
|
getOffering: () => getOffering,
|
|
1162
|
+
getOfferingStats: () => getOfferingStats,
|
|
1163
|
+
getPortfolio: () => getPortfolio,
|
|
330
1164
|
getSyndicate: () => getSyndicate,
|
|
331
1165
|
getSyndicateDeal: () => getSyndicateDeal,
|
|
1166
|
+
getSyndicatePortfolio: () => getSyndicatePortfolio,
|
|
332
1167
|
getSyndicateStatistics: () => getSyndicateStatistics,
|
|
1168
|
+
getWebhookEndpoint: () => getWebhookEndpoint,
|
|
333
1169
|
getWebhookSubscription: () => getWebhookSubscription,
|
|
334
1170
|
hideSyndicateMember: () => hideSyndicateMember,
|
|
335
1171
|
inviteSyndicateMember: () => inviteSyndicateMember,
|
|
@@ -337,19 +1173,31 @@ __export(sdk_gen_exports, {
|
|
|
337
1173
|
listAttributedInvestments: () => listAttributedInvestments,
|
|
338
1174
|
listAttributionCampaigns: () => listAttributionCampaigns,
|
|
339
1175
|
listCampaigns: () => listCampaigns,
|
|
1176
|
+
listCompanyInvestmentChanges: () => listCompanyInvestmentChanges,
|
|
1177
|
+
listCompanyQuestions: () => listCompanyQuestions,
|
|
1178
|
+
listCompanyUpdates: () => listCompanyUpdates,
|
|
340
1179
|
listConnectedApps: () => listConnectedApps,
|
|
1180
|
+
listEligibleInstallTargets: () => listEligibleInstallTargets,
|
|
1181
|
+
listFollowedCompanies: () => listFollowedCompanies,
|
|
1182
|
+
listInstallations: () => listInstallations,
|
|
341
1183
|
listIntents: () => listIntents,
|
|
342
1184
|
listInvestments: () => listInvestments,
|
|
1185
|
+
listMyCompanies: () => listMyCompanies,
|
|
343
1186
|
listOfferings: () => listOfferings,
|
|
344
1187
|
listPartnerInvites: () => listPartnerInvites,
|
|
1188
|
+
listPortfolioPositions: () => listPortfolioPositions,
|
|
345
1189
|
listSyndicateDealInvestors: () => listSyndicateDealInvestors,
|
|
346
1190
|
listSyndicateDeals: () => listSyndicateDeals,
|
|
347
1191
|
listSyndicateMemberInvestments: () => listSyndicateMemberInvestments,
|
|
348
1192
|
listSyndicateMembers: () => listSyndicateMembers,
|
|
1193
|
+
listSyndicatePortfolioPositions: () => listSyndicatePortfolioPositions,
|
|
349
1194
|
listSyndicates: () => listSyndicates,
|
|
1195
|
+
listWebhookEndpoints: () => listWebhookEndpoints,
|
|
350
1196
|
listWebhookSubscriptions: () => listWebhookSubscriptions,
|
|
1197
|
+
previewIntent: () => previewIntent,
|
|
351
1198
|
promoteSyndicateMember: () => promoteSyndicateMember,
|
|
352
1199
|
reactivateWebhookSubscription: () => reactivateWebhookSubscription,
|
|
1200
|
+
reenableWebhookEndpoint: () => reenableWebhookEndpoint,
|
|
353
1201
|
regenerateWebhookSecret: () => regenerateWebhookSecret,
|
|
354
1202
|
registerAsPartner: () => registerAsPartner,
|
|
355
1203
|
removeSyndicateMember: () => removeSyndicateMember,
|
|
@@ -357,628 +1205,500 @@ __export(sdk_gen_exports, {
|
|
|
357
1205
|
resendSyndicateInvite: () => resendSyndicateInvite,
|
|
358
1206
|
restoreSyndicateMember: () => restoreSyndicateMember,
|
|
359
1207
|
revokeConnectedApp: () => revokeConnectedApp,
|
|
1208
|
+
revokeInstallation: () => revokeInstallation,
|
|
360
1209
|
revokePartnerInvite: () => revokePartnerInvite,
|
|
1210
|
+
rotateWebhookEndpointSecret: () => rotateWebhookEndpointSecret,
|
|
1211
|
+
searchCompanies: () => searchCompanies,
|
|
1212
|
+
testWebhookEndpoint: () => testWebhookEndpoint,
|
|
361
1213
|
testWebhookSubscription: () => testWebhookSubscription,
|
|
1214
|
+
unfollowCompany: () => unfollowCompany,
|
|
362
1215
|
updateSyndicate: () => updateSyndicate,
|
|
363
|
-
updateSyndicateMember: () => updateSyndicateMember
|
|
1216
|
+
updateSyndicateMember: () => updateSyndicateMember,
|
|
1217
|
+
updateWebhookEndpoint: () => updateWebhookEndpoint
|
|
364
1218
|
});
|
|
365
1219
|
|
|
366
1220
|
// src/generated/client.gen.ts
|
|
367
|
-
|
|
368
|
-
|
|
1221
|
+
var client = createClient(
|
|
1222
|
+
createConfig({ baseUrl: "https://api.wefunder.com" })
|
|
1223
|
+
);
|
|
369
1224
|
|
|
370
1225
|
// src/generated/sdk.gen.ts
|
|
371
|
-
var listOfferings = (options) => {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
{
|
|
375
|
-
|
|
376
|
-
type: "http"
|
|
377
|
-
}
|
|
378
|
-
],
|
|
379
|
-
url: "/explore",
|
|
380
|
-
...options
|
|
381
|
-
});
|
|
382
|
-
};
|
|
383
|
-
var getOffering = (options) => {
|
|
384
|
-
return (options.client ?? client).get({
|
|
385
|
-
security: [
|
|
386
|
-
{
|
|
387
|
-
scheme: "bearer",
|
|
388
|
-
type: "http"
|
|
389
|
-
}
|
|
390
|
-
],
|
|
391
|
-
url: "/offerings/{external_id}",
|
|
392
|
-
...options
|
|
393
|
-
});
|
|
394
|
-
};
|
|
395
|
-
var getCurrentUser = (options) => {
|
|
396
|
-
return (options?.client ?? client).get({
|
|
397
|
-
security: [
|
|
398
|
-
{
|
|
399
|
-
scheme: "bearer",
|
|
400
|
-
type: "http"
|
|
401
|
-
}
|
|
402
|
-
],
|
|
403
|
-
url: "/users/me",
|
|
404
|
-
...options
|
|
405
|
-
});
|
|
406
|
-
};
|
|
407
|
-
var listInvestments = (options) => {
|
|
408
|
-
return (options?.client ?? client).get({
|
|
409
|
-
security: [
|
|
410
|
-
{
|
|
411
|
-
scheme: "bearer",
|
|
412
|
-
type: "http"
|
|
413
|
-
}
|
|
414
|
-
],
|
|
415
|
-
url: "/investments",
|
|
416
|
-
...options
|
|
417
|
-
});
|
|
418
|
-
};
|
|
419
|
-
var listCampaigns = (options) => {
|
|
420
|
-
return (options?.client ?? client).get({
|
|
421
|
-
security: [
|
|
422
|
-
{
|
|
423
|
-
scheme: "bearer",
|
|
424
|
-
type: "http"
|
|
425
|
-
}
|
|
426
|
-
],
|
|
427
|
-
url: "/campaigns",
|
|
428
|
-
...options
|
|
429
|
-
});
|
|
430
|
-
};
|
|
431
|
-
var listSyndicates = (options) => {
|
|
432
|
-
return (options?.client ?? client).get({
|
|
433
|
-
security: [
|
|
434
|
-
{
|
|
435
|
-
scheme: "bearer",
|
|
436
|
-
type: "http"
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
url: "/syndicates",
|
|
440
|
-
...options
|
|
441
|
-
});
|
|
442
|
-
};
|
|
443
|
-
var getSyndicate = (options) => {
|
|
444
|
-
return (options.client ?? client).get({
|
|
445
|
-
security: [
|
|
446
|
-
{
|
|
447
|
-
scheme: "bearer",
|
|
448
|
-
type: "http"
|
|
449
|
-
}
|
|
450
|
-
],
|
|
451
|
-
url: "/syndicates/{syndicate_id}",
|
|
452
|
-
...options
|
|
453
|
-
});
|
|
454
|
-
};
|
|
455
|
-
var updateSyndicate = (options) => {
|
|
456
|
-
return (options.client ?? client).patch({
|
|
457
|
-
security: [
|
|
458
|
-
{
|
|
459
|
-
scheme: "bearer",
|
|
460
|
-
type: "http"
|
|
461
|
-
}
|
|
462
|
-
],
|
|
463
|
-
url: "/syndicates/{syndicate_id}",
|
|
464
|
-
...options,
|
|
465
|
-
headers: {
|
|
466
|
-
"Content-Type": "application/json",
|
|
467
|
-
...options?.headers
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
};
|
|
471
|
-
var listSyndicateMembers = (options) => {
|
|
472
|
-
return (options.client ?? client).get({
|
|
473
|
-
security: [
|
|
474
|
-
{
|
|
475
|
-
scheme: "bearer",
|
|
476
|
-
type: "http"
|
|
477
|
-
}
|
|
478
|
-
],
|
|
479
|
-
url: "/syndicates/{syndicate_id}/members",
|
|
480
|
-
...options
|
|
481
|
-
});
|
|
482
|
-
};
|
|
483
|
-
var inviteSyndicateMember = (options) => {
|
|
484
|
-
return (options.client ?? client).post({
|
|
485
|
-
security: [
|
|
486
|
-
{
|
|
487
|
-
scheme: "bearer",
|
|
488
|
-
type: "http"
|
|
489
|
-
}
|
|
490
|
-
],
|
|
491
|
-
url: "/syndicates/{syndicate_id}/members/invite",
|
|
492
|
-
...options,
|
|
493
|
-
headers: {
|
|
494
|
-
"Content-Type": "application/json",
|
|
495
|
-
...options?.headers
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
};
|
|
499
|
-
var removeSyndicateMember = (options) => {
|
|
500
|
-
return (options.client ?? client).delete({
|
|
501
|
-
security: [
|
|
502
|
-
{
|
|
503
|
-
scheme: "bearer",
|
|
504
|
-
type: "http"
|
|
505
|
-
}
|
|
506
|
-
],
|
|
507
|
-
url: "/syndicates/{syndicate_id}/members/{member_id}",
|
|
508
|
-
...options
|
|
509
|
-
});
|
|
510
|
-
};
|
|
511
|
-
var updateSyndicateMember = (options) => {
|
|
512
|
-
return (options.client ?? client).patch({
|
|
513
|
-
security: [
|
|
514
|
-
{
|
|
515
|
-
scheme: "bearer",
|
|
516
|
-
type: "http"
|
|
517
|
-
}
|
|
518
|
-
],
|
|
519
|
-
url: "/syndicates/{syndicate_id}/members/{member_id}",
|
|
520
|
-
...options,
|
|
521
|
-
headers: {
|
|
522
|
-
"Content-Type": "application/json",
|
|
523
|
-
...options?.headers
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
};
|
|
527
|
-
var approveSyndicateMember = (options) => {
|
|
528
|
-
return (options.client ?? client).post({
|
|
529
|
-
security: [
|
|
530
|
-
{
|
|
531
|
-
scheme: "bearer",
|
|
532
|
-
type: "http"
|
|
533
|
-
}
|
|
534
|
-
],
|
|
535
|
-
url: "/syndicates/{syndicate_id}/members/{member_id}/approve",
|
|
536
|
-
...options
|
|
537
|
-
});
|
|
538
|
-
};
|
|
539
|
-
var hideSyndicateMember = (options) => {
|
|
540
|
-
return (options.client ?? client).post({
|
|
541
|
-
security: [
|
|
542
|
-
{
|
|
543
|
-
scheme: "bearer",
|
|
544
|
-
type: "http"
|
|
545
|
-
}
|
|
546
|
-
],
|
|
547
|
-
url: "/syndicates/{syndicate_id}/members/{member_id}/hide",
|
|
548
|
-
...options
|
|
549
|
-
});
|
|
550
|
-
};
|
|
551
|
-
var promoteSyndicateMember = (options) => {
|
|
552
|
-
return (options.client ?? client).post({
|
|
553
|
-
security: [
|
|
554
|
-
{
|
|
555
|
-
scheme: "bearer",
|
|
556
|
-
type: "http"
|
|
557
|
-
}
|
|
558
|
-
],
|
|
559
|
-
url: "/syndicates/{syndicate_id}/members/{member_id}/promote",
|
|
560
|
-
...options
|
|
561
|
-
});
|
|
562
|
-
};
|
|
563
|
-
var demoteSyndicateMember = (options) => {
|
|
564
|
-
return (options.client ?? client).post({
|
|
565
|
-
security: [
|
|
566
|
-
{
|
|
567
|
-
scheme: "bearer",
|
|
568
|
-
type: "http"
|
|
569
|
-
}
|
|
570
|
-
],
|
|
571
|
-
url: "/syndicates/{syndicate_id}/members/{member_id}/demote",
|
|
572
|
-
...options
|
|
573
|
-
});
|
|
574
|
-
};
|
|
575
|
-
var restoreSyndicateMember = (options) => {
|
|
576
|
-
return (options.client ?? client).post({
|
|
577
|
-
security: [
|
|
578
|
-
{
|
|
579
|
-
scheme: "bearer",
|
|
580
|
-
type: "http"
|
|
581
|
-
}
|
|
582
|
-
],
|
|
583
|
-
url: "/syndicates/{syndicate_id}/members/{member_id}/restore",
|
|
584
|
-
...options
|
|
585
|
-
});
|
|
586
|
-
};
|
|
587
|
-
var resendSyndicateInvite = (options) => {
|
|
588
|
-
return (options.client ?? client).post({
|
|
589
|
-
security: [
|
|
590
|
-
{
|
|
591
|
-
scheme: "bearer",
|
|
592
|
-
type: "http"
|
|
593
|
-
}
|
|
594
|
-
],
|
|
595
|
-
url: "/syndicates/{syndicate_id}/members/{member_id}/resend_invite",
|
|
596
|
-
...options
|
|
597
|
-
});
|
|
598
|
-
};
|
|
599
|
-
var reorderSyndicateMembers = (options) => {
|
|
600
|
-
return (options.client ?? client).post({
|
|
601
|
-
security: [
|
|
602
|
-
{
|
|
603
|
-
scheme: "bearer",
|
|
604
|
-
type: "http"
|
|
605
|
-
}
|
|
606
|
-
],
|
|
607
|
-
url: "/syndicates/{syndicate_id}/members/reorder",
|
|
608
|
-
...options,
|
|
609
|
-
headers: {
|
|
610
|
-
"Content-Type": "application/json",
|
|
611
|
-
...options?.headers
|
|
1226
|
+
var listOfferings = (options) => (options?.client ?? client).get({
|
|
1227
|
+
querySerializer: {
|
|
1228
|
+
parameters: {
|
|
1229
|
+
industry: { array: { explode: false } },
|
|
1230
|
+
business_model: { array: { explode: false } }
|
|
612
1231
|
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
};
|
|
639
|
-
var
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
};
|
|
699
|
-
var
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
...options
|
|
949
|
-
}
|
|
950
|
-
};
|
|
951
|
-
var
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
}
|
|
978
|
-
|
|
1232
|
+
},
|
|
1233
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1234
|
+
url: "/explore",
|
|
1235
|
+
...options
|
|
1236
|
+
});
|
|
1237
|
+
var getOffering = (options) => (options.client ?? client).get({
|
|
1238
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1239
|
+
url: "/offerings/{external_id}",
|
|
1240
|
+
...options
|
|
1241
|
+
});
|
|
1242
|
+
var getCompanyDisclosures = (options) => (options.client ?? client).get({
|
|
1243
|
+
querySerializer: {
|
|
1244
|
+
parameters: { sections: { array: { explode: false } } }
|
|
1245
|
+
},
|
|
1246
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1247
|
+
url: "/companies/{id}/disclosures",
|
|
1248
|
+
...options
|
|
1249
|
+
});
|
|
1250
|
+
var getCompanyPitch = (options) => (options.client ?? client).get({
|
|
1251
|
+
querySerializer: {
|
|
1252
|
+
parameters: { sections: { array: { explode: false } } }
|
|
1253
|
+
},
|
|
1254
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1255
|
+
url: "/companies/{id}/pitch",
|
|
1256
|
+
...options
|
|
1257
|
+
});
|
|
1258
|
+
var listCompanyUpdates = (options) => (options.client ?? client).get({
|
|
1259
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1260
|
+
url: "/companies/{id}/updates",
|
|
1261
|
+
...options
|
|
1262
|
+
});
|
|
1263
|
+
var getCompanyUpdate = (options) => (options.client ?? client).get({
|
|
1264
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1265
|
+
url: "/companies/{id}/updates/{update_id}",
|
|
1266
|
+
...options
|
|
1267
|
+
});
|
|
1268
|
+
var listCompanyQuestions = (options) => (options.client ?? client).get({
|
|
1269
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1270
|
+
url: "/companies/{id}/questions",
|
|
1271
|
+
...options
|
|
1272
|
+
});
|
|
1273
|
+
var searchCompanies = (options) => (options.client ?? client).get({
|
|
1274
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1275
|
+
url: "/companies/search",
|
|
1276
|
+
...options
|
|
1277
|
+
});
|
|
1278
|
+
var getCompany = (options) => (options.client ?? client).get({
|
|
1279
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1280
|
+
url: "/companies/{id}",
|
|
1281
|
+
...options
|
|
1282
|
+
});
|
|
1283
|
+
var getCurrentUser = (options) => (options?.client ?? client).get({
|
|
1284
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1285
|
+
url: "/users/me",
|
|
1286
|
+
...options
|
|
1287
|
+
});
|
|
1288
|
+
var listMyCompanies = (options) => (options?.client ?? client).get({
|
|
1289
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1290
|
+
url: "/users/me/companies",
|
|
1291
|
+
...options
|
|
1292
|
+
});
|
|
1293
|
+
var listFollowedCompanies = (options) => (options?.client ?? client).get({
|
|
1294
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1295
|
+
url: "/users/me/follows",
|
|
1296
|
+
...options
|
|
1297
|
+
});
|
|
1298
|
+
var unfollowCompany = (options) => (options.client ?? client).delete({
|
|
1299
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1300
|
+
url: "/users/me/follows/{company_id}",
|
|
1301
|
+
...options
|
|
1302
|
+
});
|
|
1303
|
+
var followCompany = (options) => (options.client ?? client).put({
|
|
1304
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1305
|
+
url: "/users/me/follows/{company_id}",
|
|
1306
|
+
...options
|
|
1307
|
+
});
|
|
1308
|
+
var listInvestments = (options) => (options?.client ?? client).get({
|
|
1309
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1310
|
+
url: "/investments",
|
|
1311
|
+
...options
|
|
1312
|
+
});
|
|
1313
|
+
var getInvestment = (options) => (options.client ?? client).get({
|
|
1314
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1315
|
+
url: "/investments/{id}",
|
|
1316
|
+
...options
|
|
1317
|
+
});
|
|
1318
|
+
var getOfferingStats = (options) => (options.client ?? client).get({
|
|
1319
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1320
|
+
url: "/offerings/{offering_id}/stats",
|
|
1321
|
+
...options
|
|
1322
|
+
});
|
|
1323
|
+
var listCompanyInvestmentChanges = (options) => (options.client ?? client).get({
|
|
1324
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1325
|
+
url: "/companies/{company_id}/investments/changes",
|
|
1326
|
+
...options
|
|
1327
|
+
});
|
|
1328
|
+
var getPortfolio = (options) => (options?.client ?? client).get({
|
|
1329
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1330
|
+
url: "/portfolio",
|
|
1331
|
+
...options
|
|
1332
|
+
});
|
|
1333
|
+
var listPortfolioPositions = (options) => (options?.client ?? client).get({
|
|
1334
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1335
|
+
url: "/portfolio/positions",
|
|
1336
|
+
...options
|
|
1337
|
+
});
|
|
1338
|
+
var listCampaigns = (options) => (options?.client ?? client).get({
|
|
1339
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1340
|
+
url: "/campaigns",
|
|
1341
|
+
...options
|
|
1342
|
+
});
|
|
1343
|
+
var listSyndicates = (options) => (options?.client ?? client).get({
|
|
1344
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1345
|
+
url: "/syndicates",
|
|
1346
|
+
...options
|
|
1347
|
+
});
|
|
1348
|
+
var getSyndicate = (options) => (options.client ?? client).get({
|
|
1349
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1350
|
+
url: "/syndicates/{syndicate_id}",
|
|
1351
|
+
...options
|
|
1352
|
+
});
|
|
1353
|
+
var updateSyndicate = (options) => (options.client ?? client).patch({
|
|
1354
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1355
|
+
url: "/syndicates/{syndicate_id}",
|
|
1356
|
+
...options,
|
|
1357
|
+
headers: {
|
|
1358
|
+
"Content-Type": "application/json",
|
|
1359
|
+
...options.headers
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
var listSyndicateMembers = (options) => (options.client ?? client).get({
|
|
1363
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1364
|
+
url: "/syndicates/{syndicate_id}/members",
|
|
1365
|
+
...options
|
|
1366
|
+
});
|
|
1367
|
+
var inviteSyndicateMember = (options) => (options.client ?? client).post({
|
|
1368
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1369
|
+
url: "/syndicates/{syndicate_id}/members/invite",
|
|
1370
|
+
...options,
|
|
1371
|
+
headers: {
|
|
1372
|
+
"Content-Type": "application/json",
|
|
1373
|
+
...options.headers
|
|
1374
|
+
}
|
|
1375
|
+
});
|
|
1376
|
+
var removeSyndicateMember = (options) => (options.client ?? client).delete({
|
|
1377
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1378
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}",
|
|
1379
|
+
...options
|
|
1380
|
+
});
|
|
1381
|
+
var updateSyndicateMember = (options) => (options.client ?? client).patch({
|
|
1382
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1383
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}",
|
|
1384
|
+
...options,
|
|
1385
|
+
headers: {
|
|
1386
|
+
"Content-Type": "application/json",
|
|
1387
|
+
...options.headers
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
var approveSyndicateMember = (options) => (options.client ?? client).post({
|
|
1391
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1392
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}/approve",
|
|
1393
|
+
...options
|
|
1394
|
+
});
|
|
1395
|
+
var hideSyndicateMember = (options) => (options.client ?? client).post({
|
|
1396
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1397
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}/hide",
|
|
1398
|
+
...options
|
|
1399
|
+
});
|
|
1400
|
+
var promoteSyndicateMember = (options) => (options.client ?? client).post({
|
|
1401
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1402
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}/promote",
|
|
1403
|
+
...options
|
|
1404
|
+
});
|
|
1405
|
+
var demoteSyndicateMember = (options) => (options.client ?? client).post({
|
|
1406
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1407
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}/demote",
|
|
1408
|
+
...options
|
|
1409
|
+
});
|
|
1410
|
+
var restoreSyndicateMember = (options) => (options.client ?? client).post({
|
|
1411
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1412
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}/restore",
|
|
1413
|
+
...options
|
|
1414
|
+
});
|
|
1415
|
+
var resendSyndicateInvite = (options) => (options.client ?? client).post({
|
|
1416
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1417
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}/resend_invite",
|
|
1418
|
+
...options
|
|
1419
|
+
});
|
|
1420
|
+
var reorderSyndicateMembers = (options) => (options.client ?? client).post({
|
|
1421
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1422
|
+
url: "/syndicates/{syndicate_id}/members/reorder",
|
|
1423
|
+
...options,
|
|
1424
|
+
headers: {
|
|
1425
|
+
"Content-Type": "application/json",
|
|
1426
|
+
...options.headers
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
var exportSyndicateMembersCsv = (options) => (options.client ?? client).post({
|
|
1430
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1431
|
+
url: "/syndicates/{syndicate_id}/members/export_csv",
|
|
1432
|
+
...options
|
|
1433
|
+
});
|
|
1434
|
+
var listSyndicateDeals = (options) => (options.client ?? client).get({
|
|
1435
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1436
|
+
url: "/syndicates/{syndicate_id}/deals",
|
|
1437
|
+
...options
|
|
1438
|
+
});
|
|
1439
|
+
var getSyndicateDeal = (options) => (options.client ?? client).get({
|
|
1440
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1441
|
+
url: "/syndicates/{syndicate_id}/deals/{fundraise_id}",
|
|
1442
|
+
...options
|
|
1443
|
+
});
|
|
1444
|
+
var listSyndicateDealInvestors = (options) => (options.client ?? client).get({
|
|
1445
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1446
|
+
url: "/syndicates/{syndicate_id}/deals/{fundraise_id}/investors",
|
|
1447
|
+
...options
|
|
1448
|
+
});
|
|
1449
|
+
var listSyndicateMemberInvestments = (options) => (options.client ?? client).get({
|
|
1450
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1451
|
+
url: "/syndicates/{syndicate_id}/members/{member_id}/investments",
|
|
1452
|
+
...options
|
|
1453
|
+
});
|
|
1454
|
+
var getSyndicateStatistics = (options) => (options.client ?? client).get({
|
|
1455
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1456
|
+
url: "/syndicates/{syndicate_id}/statistics",
|
|
1457
|
+
...options
|
|
1458
|
+
});
|
|
1459
|
+
var getSyndicatePortfolio = (options) => (options.client ?? client).get({
|
|
1460
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1461
|
+
url: "/syndicates/{syndicate_id}/portfolio",
|
|
1462
|
+
...options
|
|
1463
|
+
});
|
|
1464
|
+
var listSyndicatePortfolioPositions = (options) => (options.client ?? client).get({
|
|
1465
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1466
|
+
url: "/syndicates/{syndicate_id}/portfolio/positions",
|
|
1467
|
+
...options
|
|
1468
|
+
});
|
|
1469
|
+
var closeSyndicateDeal = (options) => (options.client ?? client).post({
|
|
1470
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1471
|
+
url: "/syndicates/{syndicate_id}/deals/{fundraise_id}/close",
|
|
1472
|
+
...options
|
|
1473
|
+
});
|
|
1474
|
+
var finalizeSyndicateDeal = (options) => (options.client ?? client).post({
|
|
1475
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1476
|
+
url: "/syndicates/{syndicate_id}/deals/{fundraise_id}/finalize",
|
|
1477
|
+
...options
|
|
1478
|
+
});
|
|
1479
|
+
var previewIntent = (options) => (options.client ?? client).post({
|
|
1480
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1481
|
+
url: "/intents/preview",
|
|
1482
|
+
...options,
|
|
1483
|
+
headers: {
|
|
1484
|
+
"Content-Type": "application/json",
|
|
1485
|
+
...options.headers
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
var listIntents = (options) => (options?.client ?? client).get({
|
|
1489
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1490
|
+
url: "/intents",
|
|
1491
|
+
...options
|
|
1492
|
+
});
|
|
1493
|
+
var createIntent = (options) => (options.client ?? client).post({
|
|
1494
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1495
|
+
url: "/intents",
|
|
1496
|
+
...options,
|
|
1497
|
+
headers: {
|
|
1498
|
+
"Content-Type": "application/json",
|
|
1499
|
+
...options.headers
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
var getIntent = (options) => (options.client ?? client).get({
|
|
1503
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1504
|
+
url: "/intents/{intent_id}",
|
|
1505
|
+
...options
|
|
1506
|
+
});
|
|
1507
|
+
var listActivity = (options) => (options?.client ?? client).get({
|
|
1508
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1509
|
+
url: "/activity",
|
|
1510
|
+
...options
|
|
1511
|
+
});
|
|
1512
|
+
var listConnectedApps = (options) => (options?.client ?? client).get({
|
|
1513
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1514
|
+
url: "/connected-apps",
|
|
1515
|
+
...options
|
|
1516
|
+
});
|
|
1517
|
+
var revokeConnectedApp = (options) => (options.client ?? client).delete({
|
|
1518
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1519
|
+
url: "/connected-apps/{app_id}",
|
|
1520
|
+
...options
|
|
1521
|
+
});
|
|
1522
|
+
var getAttributionStats = (options) => (options.client ?? client).get({
|
|
1523
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1524
|
+
url: "/campaigns/{campaign_id}/attribution/stats",
|
|
1525
|
+
...options
|
|
1526
|
+
});
|
|
1527
|
+
var listAttributedInvestments = (options) => (options.client ?? client).get({
|
|
1528
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1529
|
+
url: "/campaigns/{campaign_id}/attribution/investments",
|
|
1530
|
+
...options
|
|
1531
|
+
});
|
|
1532
|
+
var listInstallations = (options) => (options?.client ?? client).get({
|
|
1533
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1534
|
+
url: "/installations",
|
|
1535
|
+
...options
|
|
1536
|
+
});
|
|
1537
|
+
var createInstallation = (options) => (options.client ?? client).post({
|
|
1538
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1539
|
+
url: "/installations",
|
|
1540
|
+
...options,
|
|
1541
|
+
headers: {
|
|
1542
|
+
"Content-Type": "application/json",
|
|
1543
|
+
...options.headers
|
|
1544
|
+
}
|
|
1545
|
+
});
|
|
1546
|
+
var listEligibleInstallTargets = (options) => (options?.client ?? client).get({
|
|
1547
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1548
|
+
url: "/installations/eligible",
|
|
1549
|
+
...options
|
|
1550
|
+
});
|
|
1551
|
+
var revokeInstallation = (options) => (options.client ?? client).delete({
|
|
1552
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1553
|
+
url: "/installations/{external_id}",
|
|
1554
|
+
...options
|
|
1555
|
+
});
|
|
1556
|
+
var getInstallation = (options) => (options.client ?? client).get({
|
|
1557
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1558
|
+
url: "/installations/{external_id}",
|
|
1559
|
+
...options
|
|
1560
|
+
});
|
|
1561
|
+
var createInstallationToken = (options) => (options.client ?? client).post({
|
|
1562
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1563
|
+
url: "/installations/{external_id}/tokens",
|
|
1564
|
+
...options,
|
|
1565
|
+
headers: {
|
|
1566
|
+
"Content-Type": "application/json",
|
|
1567
|
+
...options.headers
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
var listWebhookEndpoints = (options) => (options?.client ?? client).get({
|
|
1571
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1572
|
+
url: "/webhook_endpoints",
|
|
1573
|
+
...options
|
|
1574
|
+
});
|
|
1575
|
+
var createWebhookEndpoint = (options) => (options.client ?? client).post({
|
|
1576
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1577
|
+
url: "/webhook_endpoints",
|
|
1578
|
+
...options,
|
|
1579
|
+
headers: {
|
|
1580
|
+
"Content-Type": "application/json",
|
|
1581
|
+
...options.headers
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
var deleteWebhookEndpoint = (options) => (options.client ?? client).delete({
|
|
1585
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1586
|
+
url: "/webhook_endpoints/{external_id}",
|
|
1587
|
+
...options
|
|
1588
|
+
});
|
|
1589
|
+
var getWebhookEndpoint = (options) => (options.client ?? client).get({
|
|
1590
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1591
|
+
url: "/webhook_endpoints/{external_id}",
|
|
1592
|
+
...options
|
|
1593
|
+
});
|
|
1594
|
+
var updateWebhookEndpoint = (options) => (options.client ?? client).patch({
|
|
1595
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1596
|
+
url: "/webhook_endpoints/{external_id}",
|
|
1597
|
+
...options,
|
|
1598
|
+
headers: {
|
|
1599
|
+
"Content-Type": "application/json",
|
|
1600
|
+
...options.headers
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
var rotateWebhookEndpointSecret = (options) => (options.client ?? client).post({
|
|
1604
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1605
|
+
url: "/webhook_endpoints/{external_id}/rotate_secret",
|
|
1606
|
+
...options
|
|
1607
|
+
});
|
|
1608
|
+
var reenableWebhookEndpoint = (options) => (options.client ?? client).post({
|
|
1609
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1610
|
+
url: "/webhook_endpoints/{external_id}/reenable",
|
|
1611
|
+
...options
|
|
1612
|
+
});
|
|
1613
|
+
var testWebhookEndpoint = (options) => (options.client ?? client).post({
|
|
1614
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1615
|
+
url: "/webhook_endpoints/{external_id}/test",
|
|
1616
|
+
...options,
|
|
1617
|
+
headers: {
|
|
1618
|
+
"Content-Type": "application/json",
|
|
1619
|
+
...options.headers
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
var listWebhookSubscriptions = (options) => (options.client ?? client).get({
|
|
1623
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1624
|
+
url: "/campaigns/{campaign_id}/attribution/webhooks",
|
|
1625
|
+
...options
|
|
1626
|
+
});
|
|
1627
|
+
var createWebhookSubscription = (options) => (options.client ?? client).post({
|
|
1628
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1629
|
+
url: "/campaigns/{campaign_id}/attribution/webhooks",
|
|
1630
|
+
...options,
|
|
1631
|
+
headers: {
|
|
1632
|
+
"Content-Type": "application/json",
|
|
1633
|
+
...options.headers
|
|
1634
|
+
}
|
|
1635
|
+
});
|
|
1636
|
+
var deleteWebhookSubscription = (options) => (options.client ?? client).delete({
|
|
1637
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1638
|
+
url: "/campaigns/{campaign_id}/attribution/webhooks/{webhook_id}",
|
|
1639
|
+
...options
|
|
1640
|
+
});
|
|
1641
|
+
var getWebhookSubscription = (options) => (options.client ?? client).get({
|
|
1642
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1643
|
+
url: "/campaigns/{campaign_id}/attribution/webhooks/{webhook_id}",
|
|
1644
|
+
...options
|
|
1645
|
+
});
|
|
1646
|
+
var testWebhookSubscription = (options) => (options.client ?? client).post({
|
|
1647
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1648
|
+
url: "/campaigns/{campaign_id}/attribution/webhooks/{webhook_id}/test",
|
|
1649
|
+
...options
|
|
1650
|
+
});
|
|
1651
|
+
var regenerateWebhookSecret = (options) => (options.client ?? client).post({
|
|
1652
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1653
|
+
url: "/campaigns/{campaign_id}/attribution/webhooks/{webhook_id}/regenerate_secret",
|
|
1654
|
+
...options
|
|
1655
|
+
});
|
|
1656
|
+
var reactivateWebhookSubscription = (options) => (options.client ?? client).post({
|
|
1657
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1658
|
+
url: "/campaigns/{campaign_id}/attribution/webhooks/{webhook_id}/reactivate",
|
|
1659
|
+
...options
|
|
1660
|
+
});
|
|
1661
|
+
var getAttributionMe = (options) => (options?.client ?? client).get({
|
|
1662
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1663
|
+
url: "/attribution/me",
|
|
1664
|
+
...options
|
|
1665
|
+
});
|
|
1666
|
+
var listAttributionCampaigns = (options) => (options?.client ?? client).get({
|
|
1667
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1668
|
+
url: "/attribution/campaigns",
|
|
1669
|
+
...options
|
|
1670
|
+
});
|
|
1671
|
+
var registerAsPartner = (options) => (options.client ?? client).post({
|
|
1672
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1673
|
+
url: "/attribution/partners/register",
|
|
1674
|
+
...options,
|
|
1675
|
+
headers: {
|
|
1676
|
+
"Content-Type": "application/json",
|
|
1677
|
+
...options.headers
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
var listPartnerInvites = (options) => (options?.client ?? client).get({
|
|
1681
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1682
|
+
url: "/attribution/invites",
|
|
1683
|
+
...options
|
|
1684
|
+
});
|
|
1685
|
+
var createPartnerInvite = (options) => (options.client ?? client).post({
|
|
1686
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1687
|
+
url: "/attribution/invites",
|
|
1688
|
+
...options,
|
|
1689
|
+
headers: {
|
|
1690
|
+
"Content-Type": "application/json",
|
|
1691
|
+
...options.headers
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
var revokePartnerInvite = (options) => (options.client ?? client).delete({
|
|
1695
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1696
|
+
url: "/attribution/invites/{token}",
|
|
1697
|
+
...options
|
|
1698
|
+
});
|
|
979
1699
|
|
|
980
1700
|
// src/client.ts
|
|
981
|
-
var DEFAULT_API_BASE_URL = "https://api.wefunder.com
|
|
1701
|
+
var DEFAULT_API_BASE_URL = "https://api.wefunder.com";
|
|
982
1702
|
var DEFAULT_API_VERSION = "2025-01-15";
|
|
983
1703
|
function modeForToken(token) {
|
|
984
1704
|
if (token.startsWith("at_live_")) return "live";
|
|
@@ -1025,7 +1745,7 @@ var Wefunder = class _Wefunder {
|
|
|
1025
1745
|
random: opts.random,
|
|
1026
1746
|
retry: opts.retry
|
|
1027
1747
|
});
|
|
1028
|
-
this.#client =
|
|
1748
|
+
this.#client = createClient({
|
|
1029
1749
|
baseUrl: opts.baseUrl ?? DEFAULT_API_BASE_URL,
|
|
1030
1750
|
headers: { "Wefunder-Version": opts.apiVersion ?? DEFAULT_API_VERSION },
|
|
1031
1751
|
auth: () => this.#tokens.getAccessToken(),
|
|
@@ -1116,10 +1836,27 @@ var Wefunder = class _Wefunder {
|
|
|
1116
1836
|
getOffering({ client: this.#client, path: { external_id: externalId } })
|
|
1117
1837
|
)
|
|
1118
1838
|
};
|
|
1839
|
+
/**
|
|
1840
|
+
* Investments (`read:investments`). `list` is a bootstrap listing; pass `updated_since`
|
|
1841
|
+
* or a saved `cursor` for sync mode (`meta.mode === "delta"`). Persist `meta.next_cursor`
|
|
1842
|
+
* from your last page — it is always present — and resume from it next time.
|
|
1843
|
+
*/
|
|
1119
1844
|
investments = {
|
|
1120
1845
|
list: this.#page(listInvestments),
|
|
1121
|
-
all: () => paginate((cursor) => this.investments.list({ cursor })),
|
|
1122
|
-
collect: () => collect((cursor) => this.investments.list({ cursor }))
|
|
1846
|
+
all: (query) => paginate((cursor) => this.investments.list({ ...query, cursor })),
|
|
1847
|
+
collect: (query) => collect((cursor) => this.investments.list({ ...query, cursor })),
|
|
1848
|
+
/** The current record (not the published projection) for one investment (`inv_…`). */
|
|
1849
|
+
get: (id) => this.#unwrapData(getInvestment({ client: this.#client, path: { id } }))
|
|
1850
|
+
};
|
|
1851
|
+
portfolio = {
|
|
1852
|
+
get: (query) => this.#unwrapData(getPortfolio({ client: this.#client, query })),
|
|
1853
|
+
positions: {
|
|
1854
|
+
list: this.#page(
|
|
1855
|
+
listPortfolioPositions
|
|
1856
|
+
),
|
|
1857
|
+
all: (query) => paginate((cursor) => this.portfolio.positions.list({ ...query, cursor })),
|
|
1858
|
+
collect: (query) => collect((cursor) => this.portfolio.positions.list({ ...query, cursor }))
|
|
1859
|
+
}
|
|
1123
1860
|
};
|
|
1124
1861
|
campaigns = {
|
|
1125
1862
|
list: this.#page(listCampaigns),
|
|
@@ -1128,28 +1865,87 @@ var Wefunder = class _Wefunder {
|
|
|
1128
1865
|
};
|
|
1129
1866
|
syndicates = {
|
|
1130
1867
|
list: this.#page(listSyndicates),
|
|
1131
|
-
all: () => paginate((cursor) => this.syndicates.list({ cursor })),
|
|
1868
|
+
all: (query) => paginate((cursor) => this.syndicates.list({ ...query, cursor })),
|
|
1132
1869
|
get: (id) => this.#unwrapData(getSyndicate({ client: this.#client, path: { id } }))
|
|
1133
1870
|
};
|
|
1134
1871
|
intents = {
|
|
1135
1872
|
list: this.#page(listIntents),
|
|
1136
|
-
all: () => paginate((cursor) => this.intents.list({ cursor })),
|
|
1873
|
+
all: (query) => paginate((cursor) => this.intents.list({ ...query, cursor })),
|
|
1137
1874
|
get: (id) => this.#unwrapData(getIntent({ client: this.#client, path: { id } }))
|
|
1138
1875
|
};
|
|
1139
1876
|
attribution = {
|
|
1140
1877
|
me: () => this.#unwrapData(getAttributionMe({ client: this.#client }))
|
|
1141
1878
|
};
|
|
1879
|
+
/**
|
|
1880
|
+
* Webhook endpoints (`/webhook_endpoints`, scopes `read:webhooks` / `write:webhooks`).
|
|
1881
|
+
* Endpoints belong to your application and are managed through the LIVE API —
|
|
1882
|
+
* create sandbox receivers there with `mode: "test"`; they're mirrored into
|
|
1883
|
+
* sandbox. The signing `secret` is returned ONLY by `create` and `rotateSecret`.
|
|
1884
|
+
* Verify deliveries with `constructEvent` (see the webhooks module).
|
|
1885
|
+
*/
|
|
1886
|
+
webhookEndpoints = {
|
|
1887
|
+
/** All of your app's endpoints (secret omitted). `meta.quota` is the per-app limit. */
|
|
1888
|
+
list: () => this.#unwrap(listWebhookEndpoints({ client: this.#client })),
|
|
1889
|
+
get: (id) => this.#unwrapData(
|
|
1890
|
+
getWebhookEndpoint({ client: this.#client, path: { external_id: id } })
|
|
1891
|
+
),
|
|
1892
|
+
/** Store `attributes.secret` from the result — it is never shown again. */
|
|
1893
|
+
create: (input) => this.#unwrapData(createWebhookEndpoint({ client: this.#client, body: input })),
|
|
1894
|
+
/** `events` replaces the subscription list wholesale (no merge); omit to leave unchanged. */
|
|
1895
|
+
update: (id, input) => this.#unwrapData(
|
|
1896
|
+
updateWebhookEndpoint({ client: this.#client, path: { external_id: id }, body: input })
|
|
1897
|
+
),
|
|
1898
|
+
/** Stops deliveries immediately. Removal is permanent — create a new endpoint to resume. */
|
|
1899
|
+
remove: (id) => this.#unwrapData(
|
|
1900
|
+
deleteWebhookEndpoint({ client: this.#client, path: { external_id: id } })
|
|
1901
|
+
),
|
|
1902
|
+
/**
|
|
1903
|
+
* New secret (shown once). The old one keeps signing for a 24h overlap — deliveries
|
|
1904
|
+
* carry a `v1` for both, and `constructEvent` accepts either.
|
|
1905
|
+
*/
|
|
1906
|
+
rotateSecret: (id) => this.#unwrapData(
|
|
1907
|
+
rotateWebhookEndpointSecret({ client: this.#client, path: { external_id: id } })
|
|
1908
|
+
),
|
|
1909
|
+
/** Recover an auto-disabled endpoint after fixing your server. Idempotent. */
|
|
1910
|
+
reenable: (id) => this.#unwrapData(
|
|
1911
|
+
reenableWebhookEndpoint({ client: this.#client, path: { external_id: id } })
|
|
1912
|
+
),
|
|
1913
|
+
/**
|
|
1914
|
+
* POST a real, signed example event at the endpoint (production envelope + signature)
|
|
1915
|
+
* and report the outcome inline. Defaults to the endpoint's first subscribed event.
|
|
1916
|
+
* Doesn't affect delivery health. Rate-limited to 10/min per endpoint.
|
|
1917
|
+
*/
|
|
1918
|
+
test: (id, event) => this.#unwrapData(
|
|
1919
|
+
testWebhookEndpoint({
|
|
1920
|
+
client: this.#client,
|
|
1921
|
+
path: { external_id: id },
|
|
1922
|
+
body: event ? { event } : void 0
|
|
1923
|
+
})
|
|
1924
|
+
)
|
|
1925
|
+
};
|
|
1142
1926
|
};
|
|
1143
1927
|
|
|
1144
1928
|
// src/webhooks.ts
|
|
1145
1929
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
1146
|
-
var SIGNATURE_HEADER = "
|
|
1147
|
-
var
|
|
1148
|
-
var
|
|
1149
|
-
var
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1930
|
+
var SIGNATURE_HEADER = "wefunder-signature";
|
|
1931
|
+
var DEFAULT_TOLERANCE_SECONDS = 300;
|
|
1932
|
+
var LEGACY_SIGNATURE_HEADER = "x-wefunder-signature";
|
|
1933
|
+
var LEGACY_TIMESTAMP_HEADER = "x-wefunder-timestamp";
|
|
1934
|
+
var LEGACY_EVENT_HEADER = "x-wefunder-event";
|
|
1935
|
+
var LEGACY_DELIVERY_ID_HEADER = "x-wefunder-delivery-id";
|
|
1936
|
+
var WebhookSignatureError = class extends Error {
|
|
1937
|
+
reason;
|
|
1938
|
+
constructor(reason, message) {
|
|
1939
|
+
super(message);
|
|
1940
|
+
this.name = "WebhookSignatureError";
|
|
1941
|
+
this.reason = reason;
|
|
1942
|
+
}
|
|
1943
|
+
};
|
|
1944
|
+
function bodyBuffer(payload) {
|
|
1945
|
+
return typeof payload === "string" ? Buffer.from(payload, "utf8") : Buffer.from(payload);
|
|
1946
|
+
}
|
|
1947
|
+
function computeWebhookSignature(secret, timestamp, payload) {
|
|
1948
|
+
return createHmac("sha256", secret).update(`${timestamp}.`).update(bodyBuffer(payload)).digest("hex");
|
|
1153
1949
|
}
|
|
1154
1950
|
function constantTimeEqual(a, b) {
|
|
1155
1951
|
const ab = Buffer.from(a);
|
|
@@ -1157,65 +1953,175 @@ function constantTimeEqual(a, b) {
|
|
|
1157
1953
|
if (ab.length !== bb.length) return false;
|
|
1158
1954
|
return timingSafeEqual(ab, bb);
|
|
1159
1955
|
}
|
|
1956
|
+
function parseSignatureHeader(header) {
|
|
1957
|
+
let timestamp;
|
|
1958
|
+
const signatures = [];
|
|
1959
|
+
for (const part of header.split(",")) {
|
|
1960
|
+
const eq = part.indexOf("=");
|
|
1961
|
+
if (eq < 0) continue;
|
|
1962
|
+
const key = part.slice(0, eq).trim();
|
|
1963
|
+
const value = part.slice(eq + 1).trim();
|
|
1964
|
+
if (key === "t") {
|
|
1965
|
+
if (!/^\d+$/.test(value)) return null;
|
|
1966
|
+
timestamp = Number(value);
|
|
1967
|
+
} else if (key === "v1" && value) {
|
|
1968
|
+
signatures.push(value);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
if (timestamp === void 0 || signatures.length === 0) return null;
|
|
1972
|
+
return { timestamp, signatures };
|
|
1973
|
+
}
|
|
1974
|
+
function signWebhook(opts) {
|
|
1975
|
+
const t = opts.timestamp ?? Math.floor(Date.now() / 1e3);
|
|
1976
|
+
const secrets = [opts.secret, ...opts.additionalSecrets ?? []];
|
|
1977
|
+
const entries = secrets.map((s) => `v1=${computeWebhookSignature(s, t, opts.payload)}`);
|
|
1978
|
+
return [`t=${t}`, ...entries].join(",");
|
|
1979
|
+
}
|
|
1980
|
+
function checkWebhookSignature(opts) {
|
|
1981
|
+
const parsed = parseSignatureHeader(opts.header);
|
|
1982
|
+
if (!parsed) return "malformed_header";
|
|
1983
|
+
const tolerance = opts.toleranceSeconds ?? DEFAULT_TOLERANCE_SECONDS;
|
|
1984
|
+
if (tolerance > 0) {
|
|
1985
|
+
const nowSec = (opts.now ?? Date.now)() / 1e3;
|
|
1986
|
+
if (Math.abs(nowSec - parsed.timestamp) > tolerance) return "timestamp_out_of_tolerance";
|
|
1987
|
+
}
|
|
1988
|
+
const expected = computeWebhookSignature(opts.secret, parsed.timestamp, opts.payload);
|
|
1989
|
+
return parsed.signatures.some((sig) => constantTimeEqual(sig, expected)) ? null : "signature_mismatch";
|
|
1990
|
+
}
|
|
1160
1991
|
function verifyWebhook(opts) {
|
|
1161
|
-
|
|
1162
|
-
|
|
1992
|
+
if ("header" in opts) return checkWebhookSignature(opts) === null;
|
|
1993
|
+
return verifyLegacyWebhook(opts);
|
|
1994
|
+
}
|
|
1995
|
+
function verifyLegacyWebhook(opts) {
|
|
1996
|
+
const tolerance = opts.toleranceSeconds ?? DEFAULT_TOLERANCE_SECONDS;
|
|
1163
1997
|
const ts = Number(opts.timestamp);
|
|
1164
1998
|
if (!Number.isFinite(ts)) return false;
|
|
1165
|
-
if (tolerance > 0 && Math.abs(now / 1e3 - ts) > tolerance) return false;
|
|
1166
|
-
const expected =
|
|
1999
|
+
if (tolerance > 0 && Math.abs((opts.now ?? Date.now)() / 1e3 - ts) > tolerance) return false;
|
|
2000
|
+
const expected = `sha256=${computeWebhookSignature(opts.secret, opts.timestamp, opts.payload)}`;
|
|
1167
2001
|
return constantTimeEqual(opts.signature, expected);
|
|
1168
2002
|
}
|
|
1169
|
-
function
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
2003
|
+
function headerGetter(headers) {
|
|
2004
|
+
if (typeof headers === "string") {
|
|
2005
|
+
return (name) => name === SIGNATURE_HEADER ? headers : void 0;
|
|
2006
|
+
}
|
|
2007
|
+
if (headers instanceof Headers) return (name) => headers.get(name) ?? void 0;
|
|
2008
|
+
return (name) => {
|
|
2009
|
+
let v = headers[name];
|
|
2010
|
+
if (v === void 0) {
|
|
2011
|
+
const hit = Object.keys(headers).find((k) => k.toLowerCase() === name);
|
|
2012
|
+
if (hit) v = headers[hit];
|
|
2013
|
+
}
|
|
1173
2014
|
return Array.isArray(v) ? v[0] : v;
|
|
1174
2015
|
};
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
2016
|
+
}
|
|
2017
|
+
function constructEvent(payload, headers, secret, opts) {
|
|
2018
|
+
const get = headerGetter(headers);
|
|
2019
|
+
const header = get(SIGNATURE_HEADER);
|
|
2020
|
+
if (!header) {
|
|
2021
|
+
const legacySig = get(LEGACY_SIGNATURE_HEADER);
|
|
2022
|
+
const legacyTs = get(LEGACY_TIMESTAMP_HEADER);
|
|
2023
|
+
if (legacySig && legacyTs) return constructLegacyEvent(payload, get, legacySig, legacyTs, secret, opts);
|
|
2024
|
+
throw new WebhookSignatureError("missing_header", describeFailure("missing_header"));
|
|
2025
|
+
}
|
|
2026
|
+
const failure = checkWebhookSignature({ payload, header, secret, ...opts });
|
|
2027
|
+
if (failure) throw new WebhookSignatureError(failure, describeFailure(failure));
|
|
2028
|
+
const parsed = parseSignatureHeader(header);
|
|
2029
|
+
const env = parseEnvelope(payload);
|
|
1189
2030
|
return {
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
2031
|
+
id: String(env.id ?? ""),
|
|
2032
|
+
event: String(env.event ?? ""),
|
|
2033
|
+
created_at: String(env.created_at ?? ""),
|
|
2034
|
+
mode: env.mode === "test" ? "test" : "live",
|
|
2035
|
+
data: env.data,
|
|
2036
|
+
timestamp: parsed.timestamp
|
|
1194
2037
|
};
|
|
1195
2038
|
}
|
|
2039
|
+
function constructLegacyEvent(payload, get, signature, timestamp, secret, opts) {
|
|
2040
|
+
if (!verifyLegacyWebhook({ payload, signature, timestamp, secret, ...opts })) {
|
|
2041
|
+
throw new WebhookSignatureError("signature_mismatch", describeFailure("signature_mismatch"));
|
|
2042
|
+
}
|
|
2043
|
+
const env = parseEnvelope(payload);
|
|
2044
|
+
return {
|
|
2045
|
+
id: String(env.id ?? get(LEGACY_DELIVERY_ID_HEADER) ?? ""),
|
|
2046
|
+
event: String(env.event ?? get(LEGACY_EVENT_HEADER) ?? ""),
|
|
2047
|
+
created_at: String(env.created_at ?? ""),
|
|
2048
|
+
mode: env.mode === "test" ? "test" : "live",
|
|
2049
|
+
data: env.data ?? env,
|
|
2050
|
+
timestamp: Number(timestamp)
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
function parseEnvelope(payload) {
|
|
2054
|
+
try {
|
|
2055
|
+
const parsed = JSON.parse(bodyBuffer(payload).toString("utf8"));
|
|
2056
|
+
if (parsed === null || typeof parsed !== "object") throw new Error("not an object");
|
|
2057
|
+
return parsed;
|
|
2058
|
+
} catch {
|
|
2059
|
+
throw new WebhookSignatureError("invalid_payload", describeFailure("invalid_payload"));
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
function describeFailure(reason) {
|
|
2063
|
+
switch (reason) {
|
|
2064
|
+
case "missing_header":
|
|
2065
|
+
return "Missing Wefunder-Signature header";
|
|
2066
|
+
case "malformed_header":
|
|
2067
|
+
return "Wefunder-Signature header is malformed (expected t=<unix>,v1=<hex>)";
|
|
2068
|
+
case "timestamp_out_of_tolerance":
|
|
2069
|
+
return "Webhook timestamp is outside the replay tolerance";
|
|
2070
|
+
case "signature_mismatch":
|
|
2071
|
+
return "Webhook signature verification failed";
|
|
2072
|
+
case "invalid_payload":
|
|
2073
|
+
return "Webhook body is not a JSON object";
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
async function constructEventFromRequest(request, secret, opts) {
|
|
2077
|
+
const payload = await request.text();
|
|
2078
|
+
return constructEvent(payload, request.headers, secret, opts);
|
|
2079
|
+
}
|
|
2080
|
+
async function dispatchWebhook(event, handlers) {
|
|
2081
|
+
const specific = event.event === "default" ? void 0 : handlers[event.event];
|
|
2082
|
+
if (specific) {
|
|
2083
|
+
await specific(event);
|
|
2084
|
+
return true;
|
|
2085
|
+
}
|
|
2086
|
+
if (handlers.default) {
|
|
2087
|
+
await handlers.default(event);
|
|
2088
|
+
return true;
|
|
2089
|
+
}
|
|
2090
|
+
return false;
|
|
2091
|
+
}
|
|
1196
2092
|
export {
|
|
1197
2093
|
DEFAULT_API_BASE_URL,
|
|
1198
2094
|
DEFAULT_API_VERSION,
|
|
1199
2095
|
DEFAULT_AUTHORIZE_BASE_URL,
|
|
1200
2096
|
DEFAULT_OAUTH_BASE_URL,
|
|
1201
2097
|
DEFAULT_TOKEN_BASE_URL,
|
|
1202
|
-
|
|
1203
|
-
|
|
2098
|
+
DEFAULT_TOLERANCE_SECONDS,
|
|
2099
|
+
LEGACY_DELIVERY_ID_HEADER,
|
|
2100
|
+
LEGACY_EVENT_HEADER,
|
|
2101
|
+
LEGACY_SIGNATURE_HEADER,
|
|
2102
|
+
LEGACY_TIMESTAMP_HEADER,
|
|
1204
2103
|
REQUEST_ID_HEADER,
|
|
2104
|
+
SANDBOX_AUTHORIZE_BASE_URL,
|
|
1205
2105
|
SIGNATURE_HEADER,
|
|
1206
|
-
|
|
2106
|
+
WebhookSignatureError,
|
|
1207
2107
|
Wefunder,
|
|
1208
2108
|
WefunderAuthError,
|
|
1209
2109
|
WefunderError,
|
|
2110
|
+
checkWebhookSignature,
|
|
1210
2111
|
clientCredentialsGrant,
|
|
1211
2112
|
collect,
|
|
2113
|
+
computeWebhookSignature,
|
|
1212
2114
|
constructEvent,
|
|
2115
|
+
constructEventFromRequest,
|
|
1213
2116
|
createAuthorizationUrl,
|
|
2117
|
+
dispatchWebhook,
|
|
1214
2118
|
exchangeCode,
|
|
1215
2119
|
generatePkce,
|
|
1216
2120
|
modeForToken,
|
|
1217
2121
|
paginate,
|
|
2122
|
+
parseSignatureHeader,
|
|
1218
2123
|
refreshToken,
|
|
2124
|
+
signWebhook,
|
|
1219
2125
|
verifyWebhook
|
|
1220
2126
|
};
|
|
1221
2127
|
//# sourceMappingURL=index.js.map
|