@productcraft/heimdall 0.0.1 → 0.1.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/LICENSE +21 -0
- package/README.md +281 -0
- package/dist/index.cjs +1983 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2339 -2827
- package/dist/index.d.ts +2339 -2827
- package/dist/index.js +1972 -4
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,1997 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@productcraft/core');
|
|
4
|
+
var jose = require('jose');
|
|
5
|
+
|
|
6
|
+
// src/index.ts
|
|
7
|
+
|
|
8
|
+
// src/_http.ts
|
|
9
|
+
var HeimdallHttpError = class extends Error {
|
|
10
|
+
status;
|
|
11
|
+
statusText;
|
|
12
|
+
data;
|
|
13
|
+
constructor(response) {
|
|
14
|
+
super(
|
|
15
|
+
`Heimdall request failed: ${response.status} ${response.statusText}`
|
|
16
|
+
);
|
|
17
|
+
this.name = "HeimdallHttpError";
|
|
18
|
+
this.status = response.status;
|
|
19
|
+
this.statusText = response.statusText;
|
|
20
|
+
this.data = response.data;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function applyAuthHeader(headers, auth) {
|
|
24
|
+
if (!auth) return;
|
|
25
|
+
switch (auth.type) {
|
|
26
|
+
case "apiKey":
|
|
27
|
+
headers.set("Authorization", `Bearer ${auth.key}`);
|
|
28
|
+
break;
|
|
29
|
+
case "bearer":
|
|
30
|
+
headers.set("Authorization", `Bearer ${auth.token}`);
|
|
31
|
+
break;
|
|
32
|
+
case "cookie":
|
|
33
|
+
headers.set("Cookie", `auth_token=${auth.value}`);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function buildUrl(baseUrl, path, params) {
|
|
38
|
+
const url = new URL(path, baseUrl);
|
|
39
|
+
if (params && typeof params === "object") {
|
|
40
|
+
for (const [k, v] of Object.entries(params)) {
|
|
41
|
+
if (v === void 0 || v === null) continue;
|
|
42
|
+
if (Array.isArray(v)) {
|
|
43
|
+
for (const item of v) url.searchParams.append(k, String(item));
|
|
44
|
+
} else {
|
|
45
|
+
url.searchParams.set(k, String(v));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return url;
|
|
50
|
+
}
|
|
51
|
+
function makeHeimdallHttpClient(options) {
|
|
52
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
53
|
+
if (!fetchImpl) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
"@productcraft/heimdall: no `fetch` available \u2014 pass `fetch` in the config or run on Node 18+"
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return async function client2(req) {
|
|
59
|
+
const url = buildUrl(req.baseURL ?? options.baseUrl, req.url ?? "", req.params);
|
|
60
|
+
const headers = new Headers(req.headers);
|
|
61
|
+
applyAuthHeader(headers, options.auth);
|
|
62
|
+
const hasBody = req.data !== void 0 && req.method !== "GET" && req.method !== "HEAD";
|
|
63
|
+
const isFormData = typeof FormData !== "undefined" && req.data instanceof FormData;
|
|
64
|
+
if (hasBody && !isFormData && !headers.has("Content-Type")) {
|
|
65
|
+
headers.set("Content-Type", "application/json");
|
|
66
|
+
}
|
|
67
|
+
const body = hasBody ? isFormData ? req.data : JSON.stringify(req.data) : void 0;
|
|
68
|
+
const res = await fetchImpl(url, {
|
|
69
|
+
method: req.method,
|
|
70
|
+
headers,
|
|
71
|
+
body,
|
|
72
|
+
credentials: req.credentials,
|
|
73
|
+
signal: req.signal
|
|
74
|
+
});
|
|
75
|
+
let data = void 0;
|
|
76
|
+
const ctype = res.headers.get("content-type") ?? "";
|
|
77
|
+
if (req.responseType === "text") {
|
|
78
|
+
data = await res.text();
|
|
79
|
+
} else if (req.responseType === "blob") {
|
|
80
|
+
data = await res.blob();
|
|
81
|
+
} else if (req.responseType === "arraybuffer") {
|
|
82
|
+
data = await res.arrayBuffer();
|
|
83
|
+
} else if (ctype.includes("application/json") || ctype.includes("application/problem+json")) {
|
|
84
|
+
data = await res.json().catch(() => void 0);
|
|
85
|
+
} else if (res.status !== 204) {
|
|
86
|
+
const text = await res.text().catch(() => "");
|
|
87
|
+
data = text || void 0;
|
|
88
|
+
}
|
|
89
|
+
const response = {
|
|
90
|
+
data,
|
|
91
|
+
status: res.status,
|
|
92
|
+
statusText: res.statusText,
|
|
93
|
+
headers: res.headers
|
|
94
|
+
};
|
|
95
|
+
if (!res.ok) throw new HeimdallHttpError(response);
|
|
96
|
+
return response;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ../../node_modules/.pnpm/@kubb+plugin-client@4.37.8_@kubb+fabric-core@0.14.0_@kubb+react-fabric@0.14.0/node_modules/@kubb/plugin-client/dist/clients/fetch.js
|
|
101
|
+
var _config = {};
|
|
102
|
+
var getConfig = () => _config;
|
|
103
|
+
var setConfig = (config) => {
|
|
104
|
+
_config = config;
|
|
105
|
+
return getConfig();
|
|
106
|
+
};
|
|
107
|
+
var mergeConfig = (...configs) => {
|
|
108
|
+
return configs.reduce((merged, config) => {
|
|
109
|
+
return {
|
|
110
|
+
...merged,
|
|
111
|
+
...config,
|
|
112
|
+
headers: {
|
|
113
|
+
...Array.isArray(merged.headers) ? Object.fromEntries(merged.headers) : merged.headers,
|
|
114
|
+
...Array.isArray(config.headers) ? Object.fromEntries(config.headers) : config.headers
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}, {});
|
|
118
|
+
};
|
|
119
|
+
var client = async (paramsConfig) => {
|
|
120
|
+
const normalizedParams = new URLSearchParams();
|
|
121
|
+
const config = mergeConfig(getConfig(), paramsConfig);
|
|
122
|
+
Object.entries(config.params || {}).forEach(([key, value]) => {
|
|
123
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
124
|
+
});
|
|
125
|
+
let targetUrl = [config.baseURL, config.url].filter(Boolean).join("");
|
|
126
|
+
if (config.params) targetUrl += `?${normalizedParams}`;
|
|
127
|
+
const response = await fetch(targetUrl, {
|
|
128
|
+
credentials: config.credentials || "same-origin",
|
|
129
|
+
method: config.method?.toUpperCase(),
|
|
130
|
+
body: config.data instanceof FormData ? config.data : JSON.stringify(config.data),
|
|
131
|
+
signal: config.signal,
|
|
132
|
+
headers: config.headers
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
data: [
|
|
136
|
+
204,
|
|
137
|
+
205,
|
|
138
|
+
304
|
|
139
|
+
].includes(response.status) || !response.body ? {} : await response.json(),
|
|
140
|
+
status: response.status,
|
|
141
|
+
statusText: response.statusText,
|
|
142
|
+
headers: response.headers
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
client.getConfig = getConfig;
|
|
146
|
+
client.setConfig = setConfig;
|
|
147
|
+
|
|
148
|
+
// src/_generated/clients/apps/appControllerGetApp.ts
|
|
149
|
+
function getAppControllerGetAppUrl({
|
|
150
|
+
appId
|
|
151
|
+
}) {
|
|
152
|
+
const app_id = appId;
|
|
153
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}` };
|
|
154
|
+
return res;
|
|
155
|
+
}
|
|
156
|
+
async function appControllerGetApp({ appId }, config = {}) {
|
|
157
|
+
const { client: request = client, ...requestConfig } = config;
|
|
158
|
+
const res = await request({
|
|
159
|
+
method: "GET",
|
|
160
|
+
url: getAppControllerGetAppUrl({ appId }).url.toString(),
|
|
161
|
+
...requestConfig
|
|
162
|
+
});
|
|
163
|
+
return res.data;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/_generated/clients/apps/appControllerUpdateApp.ts
|
|
167
|
+
function getAppControllerUpdateAppUrl({
|
|
168
|
+
appId
|
|
169
|
+
}) {
|
|
170
|
+
const app_id = appId;
|
|
171
|
+
const res = { method: "PATCH", url: `/v1/apps/${app_id}` };
|
|
172
|
+
return res;
|
|
173
|
+
}
|
|
174
|
+
async function appControllerUpdateApp({
|
|
175
|
+
appId,
|
|
176
|
+
data
|
|
177
|
+
}, config = {}) {
|
|
178
|
+
const { client: request = client, ...requestConfig } = config;
|
|
179
|
+
const requestData = data;
|
|
180
|
+
const res = await request({
|
|
181
|
+
method: "PATCH",
|
|
182
|
+
url: getAppControllerUpdateAppUrl({ appId }).url.toString(),
|
|
183
|
+
data: requestData,
|
|
184
|
+
...requestConfig
|
|
185
|
+
});
|
|
186
|
+
return res.data;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/_generated/clients/apps/appControllerDeleteApp.ts
|
|
190
|
+
function getAppControllerDeleteAppUrl({
|
|
191
|
+
appId
|
|
192
|
+
}) {
|
|
193
|
+
const app_id = appId;
|
|
194
|
+
const res = { method: "DELETE", url: `/v1/apps/${app_id}` };
|
|
195
|
+
return res;
|
|
196
|
+
}
|
|
197
|
+
async function appControllerDeleteApp({ appId }, config = {}) {
|
|
198
|
+
const { client: request = client, ...requestConfig } = config;
|
|
199
|
+
const res = await request({
|
|
200
|
+
method: "DELETE",
|
|
201
|
+
url: getAppControllerDeleteAppUrl({ appId }).url.toString(),
|
|
202
|
+
...requestConfig
|
|
203
|
+
});
|
|
204
|
+
return res.data;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/_generated/clients/apps/appControllerUpdateAppStatus.ts
|
|
208
|
+
function getAppControllerUpdateAppStatusUrl({
|
|
209
|
+
appId
|
|
210
|
+
}) {
|
|
211
|
+
const app_id = appId;
|
|
212
|
+
const res = { method: "PATCH", url: `/v1/apps/${app_id}/status` };
|
|
213
|
+
return res;
|
|
214
|
+
}
|
|
215
|
+
async function appControllerUpdateAppStatus({
|
|
216
|
+
appId,
|
|
217
|
+
data
|
|
218
|
+
}, config = {}) {
|
|
219
|
+
const { client: request = client, ...requestConfig } = config;
|
|
220
|
+
const requestData = data;
|
|
221
|
+
const res = await request({
|
|
222
|
+
method: "PATCH",
|
|
223
|
+
url: getAppControllerUpdateAppStatusUrl({ appId }).url.toString(),
|
|
224
|
+
data: requestData,
|
|
225
|
+
...requestConfig
|
|
226
|
+
});
|
|
227
|
+
return res.data;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// src/_generated/clients/apps/authConfigControllerGetConfig.ts
|
|
231
|
+
function getAuthConfigControllerGetConfigUrl({
|
|
232
|
+
appId
|
|
233
|
+
}) {
|
|
234
|
+
const app_id = appId;
|
|
235
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/auth-config` };
|
|
236
|
+
return res;
|
|
237
|
+
}
|
|
238
|
+
async function authConfigControllerGetConfig({ appId }, config = {}) {
|
|
239
|
+
const { client: request = client, ...requestConfig } = config;
|
|
240
|
+
const res = await request({
|
|
241
|
+
method: "GET",
|
|
242
|
+
url: getAuthConfigControllerGetConfigUrl({ appId }).url.toString(),
|
|
243
|
+
...requestConfig
|
|
244
|
+
});
|
|
245
|
+
return res.data;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/_generated/clients/apps/authConfigControllerUpdateConfig.ts
|
|
249
|
+
function getAuthConfigControllerUpdateConfigUrl({
|
|
250
|
+
appId
|
|
251
|
+
}) {
|
|
252
|
+
const app_id = appId;
|
|
253
|
+
const res = {
|
|
254
|
+
method: "PATCH",
|
|
255
|
+
url: `/v1/apps/${app_id}/auth-config`
|
|
256
|
+
};
|
|
257
|
+
return res;
|
|
258
|
+
}
|
|
259
|
+
async function authConfigControllerUpdateConfig({
|
|
260
|
+
appId,
|
|
261
|
+
data
|
|
262
|
+
}, config = {}) {
|
|
263
|
+
const { client: request = client, ...requestConfig } = config;
|
|
264
|
+
const requestData = data;
|
|
265
|
+
const res = await request({
|
|
266
|
+
method: "PATCH",
|
|
267
|
+
url: getAuthConfigControllerUpdateConfigUrl({ appId }).url.toString(),
|
|
268
|
+
data: requestData,
|
|
269
|
+
...requestConfig
|
|
270
|
+
});
|
|
271
|
+
return res.data;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// src/_generated/clients/apps/appControllerListInvites.ts
|
|
275
|
+
function getAppControllerListInvitesUrl({
|
|
276
|
+
appId
|
|
277
|
+
}) {
|
|
278
|
+
const app_id = appId;
|
|
279
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/invites` };
|
|
280
|
+
return res;
|
|
281
|
+
}
|
|
282
|
+
async function appControllerListInvites({
|
|
283
|
+
appId,
|
|
284
|
+
params
|
|
285
|
+
}, config = {}) {
|
|
286
|
+
const { client: request = client, ...requestConfig } = config;
|
|
287
|
+
const res = await request({
|
|
288
|
+
method: "GET",
|
|
289
|
+
url: getAppControllerListInvitesUrl({ appId }).url.toString(),
|
|
290
|
+
params,
|
|
291
|
+
...requestConfig
|
|
292
|
+
});
|
|
293
|
+
return res.data;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/_generated/clients/apps/appControllerCreateInvite.ts
|
|
297
|
+
function getAppControllerCreateInviteUrl({
|
|
298
|
+
appId
|
|
299
|
+
}) {
|
|
300
|
+
const app_id = appId;
|
|
301
|
+
const res = { method: "POST", url: `/v1/apps/${app_id}/invites` };
|
|
302
|
+
return res;
|
|
303
|
+
}
|
|
304
|
+
async function appControllerCreateInvite({
|
|
305
|
+
appId,
|
|
306
|
+
data
|
|
307
|
+
}, config = {}) {
|
|
308
|
+
const { client: request = client, ...requestConfig } = config;
|
|
309
|
+
const requestData = data;
|
|
310
|
+
const res = await request({
|
|
311
|
+
method: "POST",
|
|
312
|
+
url: getAppControllerCreateInviteUrl({ appId }).url.toString(),
|
|
313
|
+
data: requestData,
|
|
314
|
+
...requestConfig
|
|
315
|
+
});
|
|
316
|
+
return res.data;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// src/_generated/clients/apps/appControllerRevokeInvite.ts
|
|
320
|
+
function getAppControllerRevokeInviteUrl({
|
|
321
|
+
appId,
|
|
322
|
+
inviteId
|
|
323
|
+
}) {
|
|
324
|
+
const app_id = appId;
|
|
325
|
+
const invite_id = inviteId;
|
|
326
|
+
const res = {
|
|
327
|
+
method: "DELETE",
|
|
328
|
+
url: `/v1/apps/${app_id}/invites/${invite_id}`
|
|
329
|
+
};
|
|
330
|
+
return res;
|
|
331
|
+
}
|
|
332
|
+
async function appControllerRevokeInvite({
|
|
333
|
+
appId,
|
|
334
|
+
inviteId
|
|
335
|
+
}, config = {}) {
|
|
336
|
+
const { client: request = client, ...requestConfig } = config;
|
|
337
|
+
const res = await request({
|
|
338
|
+
method: "DELETE",
|
|
339
|
+
url: getAppControllerRevokeInviteUrl({ appId, inviteId }).url.toString(),
|
|
340
|
+
...requestConfig
|
|
341
|
+
});
|
|
342
|
+
return res.data;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// src/_generated/clients/apps/appControllerListMembers.ts
|
|
346
|
+
function getAppControllerListMembersUrl({
|
|
347
|
+
appId
|
|
348
|
+
}) {
|
|
349
|
+
const app_id = appId;
|
|
350
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/members` };
|
|
351
|
+
return res;
|
|
352
|
+
}
|
|
353
|
+
async function appControllerListMembers({
|
|
354
|
+
appId,
|
|
355
|
+
params
|
|
356
|
+
}, config = {}) {
|
|
357
|
+
const { client: request = client, ...requestConfig } = config;
|
|
358
|
+
const res = await request({
|
|
359
|
+
method: "GET",
|
|
360
|
+
url: getAppControllerListMembersUrl({ appId }).url.toString(),
|
|
361
|
+
params,
|
|
362
|
+
...requestConfig
|
|
363
|
+
});
|
|
364
|
+
return res.data;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// src/_generated/clients/apps/appControllerRemoveMember.ts
|
|
368
|
+
function getAppControllerRemoveMemberUrl({
|
|
369
|
+
appId,
|
|
370
|
+
accountId
|
|
371
|
+
}) {
|
|
372
|
+
const app_id = appId;
|
|
373
|
+
const account_id = accountId;
|
|
374
|
+
const res = {
|
|
375
|
+
method: "DELETE",
|
|
376
|
+
url: `/v1/apps/${app_id}/members/${account_id}`
|
|
377
|
+
};
|
|
378
|
+
return res;
|
|
379
|
+
}
|
|
380
|
+
async function appControllerRemoveMember({
|
|
381
|
+
appId,
|
|
382
|
+
accountId
|
|
383
|
+
}, config = {}) {
|
|
384
|
+
const { client: request = client, ...requestConfig } = config;
|
|
385
|
+
const res = await request({
|
|
386
|
+
method: "DELETE",
|
|
387
|
+
url: getAppControllerRemoveMemberUrl({ appId, accountId }).url.toString(),
|
|
388
|
+
...requestConfig
|
|
389
|
+
});
|
|
390
|
+
return res.data;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// src/_generated/clients/endUsers/endUserControllerListEndUsers.ts
|
|
394
|
+
function getEndUserControllerListEndUsersUrl({
|
|
395
|
+
appId
|
|
396
|
+
}) {
|
|
397
|
+
const app_id = appId;
|
|
398
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/end-users` };
|
|
399
|
+
return res;
|
|
400
|
+
}
|
|
401
|
+
async function endUserControllerListEndUsers({
|
|
402
|
+
appId,
|
|
403
|
+
params
|
|
404
|
+
}, config = {}) {
|
|
405
|
+
const { client: request = client, ...requestConfig } = config;
|
|
406
|
+
const res = await request({
|
|
407
|
+
method: "GET",
|
|
408
|
+
url: getEndUserControllerListEndUsersUrl({ appId }).url.toString(),
|
|
409
|
+
params,
|
|
410
|
+
...requestConfig
|
|
411
|
+
});
|
|
412
|
+
return res.data;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// src/_generated/clients/endUsers/endUserControllerGetEndUser.ts
|
|
416
|
+
function getEndUserControllerGetEndUserUrl({
|
|
417
|
+
appId,
|
|
418
|
+
userId
|
|
419
|
+
}) {
|
|
420
|
+
const app_id = appId;
|
|
421
|
+
const user_id = userId;
|
|
422
|
+
const res = {
|
|
423
|
+
method: "GET",
|
|
424
|
+
url: `/v1/apps/${app_id}/end-users/${user_id}`
|
|
425
|
+
};
|
|
426
|
+
return res;
|
|
427
|
+
}
|
|
428
|
+
async function endUserControllerGetEndUser({
|
|
429
|
+
appId,
|
|
430
|
+
userId
|
|
431
|
+
}, config = {}) {
|
|
432
|
+
const { client: request = client, ...requestConfig } = config;
|
|
433
|
+
const res = await request({
|
|
434
|
+
method: "GET",
|
|
435
|
+
url: getEndUserControllerGetEndUserUrl({ appId, userId }).url.toString(),
|
|
436
|
+
...requestConfig
|
|
437
|
+
});
|
|
438
|
+
return res.data;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// src/_generated/clients/endUsers/endUserControllerUpdateEndUser.ts
|
|
442
|
+
function getEndUserControllerUpdateEndUserUrl({
|
|
443
|
+
appId,
|
|
444
|
+
userId
|
|
445
|
+
}) {
|
|
446
|
+
const app_id = appId;
|
|
447
|
+
const user_id = userId;
|
|
448
|
+
const res = {
|
|
449
|
+
method: "PATCH",
|
|
450
|
+
url: `/v1/apps/${app_id}/end-users/${user_id}`
|
|
451
|
+
};
|
|
452
|
+
return res;
|
|
453
|
+
}
|
|
454
|
+
async function endUserControllerUpdateEndUser({
|
|
455
|
+
appId,
|
|
456
|
+
userId,
|
|
457
|
+
data
|
|
458
|
+
}, config = {}) {
|
|
459
|
+
const { client: request = client, ...requestConfig } = config;
|
|
460
|
+
const requestData = data;
|
|
461
|
+
const res = await request({
|
|
462
|
+
method: "PATCH",
|
|
463
|
+
url: getEndUserControllerUpdateEndUserUrl({ appId, userId }).url.toString(),
|
|
464
|
+
data: requestData,
|
|
465
|
+
...requestConfig
|
|
466
|
+
});
|
|
467
|
+
return res.data;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// src/_generated/clients/endUsers/endUserControllerDeleteEndUser.ts
|
|
471
|
+
function getEndUserControllerDeleteEndUserUrl({
|
|
472
|
+
appId,
|
|
473
|
+
userId
|
|
474
|
+
}) {
|
|
475
|
+
const app_id = appId;
|
|
476
|
+
const user_id = userId;
|
|
477
|
+
const res = {
|
|
478
|
+
method: "DELETE",
|
|
479
|
+
url: `/v1/apps/${app_id}/end-users/${user_id}`
|
|
480
|
+
};
|
|
481
|
+
return res;
|
|
482
|
+
}
|
|
483
|
+
async function endUserControllerDeleteEndUser({
|
|
484
|
+
appId,
|
|
485
|
+
userId
|
|
486
|
+
}, config = {}) {
|
|
487
|
+
const { client: request = client, ...requestConfig } = config;
|
|
488
|
+
const res = await request({
|
|
489
|
+
method: "DELETE",
|
|
490
|
+
url: getEndUserControllerDeleteEndUserUrl({ appId, userId }).url.toString(),
|
|
491
|
+
...requestConfig
|
|
492
|
+
});
|
|
493
|
+
return res.data;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// src/_generated/clients/endUsers/endUserControllerUpdateRole.ts
|
|
497
|
+
function getEndUserControllerUpdateRoleUrl({
|
|
498
|
+
appId,
|
|
499
|
+
userId
|
|
500
|
+
}) {
|
|
501
|
+
const app_id = appId;
|
|
502
|
+
const user_id = userId;
|
|
503
|
+
const res = {
|
|
504
|
+
method: "PATCH",
|
|
505
|
+
url: `/v1/apps/${app_id}/end-users/${user_id}/role`
|
|
506
|
+
};
|
|
507
|
+
return res;
|
|
508
|
+
}
|
|
509
|
+
async function endUserControllerUpdateRole({
|
|
510
|
+
appId,
|
|
511
|
+
userId,
|
|
512
|
+
data
|
|
513
|
+
}, config = {}) {
|
|
514
|
+
const { client: request = client, ...requestConfig } = config;
|
|
515
|
+
const requestData = data;
|
|
516
|
+
const res = await request({
|
|
517
|
+
method: "PATCH",
|
|
518
|
+
url: getEndUserControllerUpdateRoleUrl({ appId, userId }).url.toString(),
|
|
519
|
+
data: requestData,
|
|
520
|
+
...requestConfig
|
|
521
|
+
});
|
|
522
|
+
return res.data;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// src/_generated/clients/endUsers/endUserControllerUpdateStatus.ts
|
|
526
|
+
function getEndUserControllerUpdateStatusUrl({
|
|
527
|
+
appId,
|
|
528
|
+
userId
|
|
529
|
+
}) {
|
|
530
|
+
const app_id = appId;
|
|
531
|
+
const user_id = userId;
|
|
532
|
+
const res = {
|
|
533
|
+
method: "PATCH",
|
|
534
|
+
url: `/v1/apps/${app_id}/end-users/${user_id}/status`
|
|
535
|
+
};
|
|
536
|
+
return res;
|
|
537
|
+
}
|
|
538
|
+
async function endUserControllerUpdateStatus({
|
|
539
|
+
appId,
|
|
540
|
+
userId,
|
|
541
|
+
data
|
|
542
|
+
}, config = {}) {
|
|
543
|
+
const { client: request = client, ...requestConfig } = config;
|
|
544
|
+
const requestData = data;
|
|
545
|
+
const res = await request({
|
|
546
|
+
method: "PATCH",
|
|
547
|
+
url: getEndUserControllerUpdateStatusUrl({ appId, userId }).url.toString(),
|
|
548
|
+
data: requestData,
|
|
549
|
+
...requestConfig
|
|
550
|
+
});
|
|
551
|
+
return res.data;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// src/_generated/clients/roles/roleControllerListRoles.ts
|
|
555
|
+
function getRoleControllerListRolesUrl({
|
|
556
|
+
appId
|
|
557
|
+
}) {
|
|
558
|
+
const app_id = appId;
|
|
559
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/roles` };
|
|
560
|
+
return res;
|
|
561
|
+
}
|
|
562
|
+
async function roleControllerListRoles({
|
|
563
|
+
appId,
|
|
564
|
+
params
|
|
565
|
+
}, config = {}) {
|
|
566
|
+
const { client: request = client, ...requestConfig } = config;
|
|
567
|
+
const res = await request({
|
|
568
|
+
method: "GET",
|
|
569
|
+
url: getRoleControllerListRolesUrl({ appId }).url.toString(),
|
|
570
|
+
params,
|
|
571
|
+
...requestConfig
|
|
572
|
+
});
|
|
573
|
+
return res.data;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// src/_generated/clients/roles/roleControllerCreateRole.ts
|
|
577
|
+
function getRoleControllerCreateRoleUrl({
|
|
578
|
+
appId
|
|
579
|
+
}) {
|
|
580
|
+
const app_id = appId;
|
|
581
|
+
const res = { method: "POST", url: `/v1/apps/${app_id}/roles` };
|
|
582
|
+
return res;
|
|
583
|
+
}
|
|
584
|
+
async function roleControllerCreateRole({
|
|
585
|
+
appId,
|
|
586
|
+
data
|
|
587
|
+
}, config = {}) {
|
|
588
|
+
const { client: request = client, ...requestConfig } = config;
|
|
589
|
+
const requestData = data;
|
|
590
|
+
const res = await request({
|
|
591
|
+
method: "POST",
|
|
592
|
+
url: getRoleControllerCreateRoleUrl({ appId }).url.toString(),
|
|
593
|
+
data: requestData,
|
|
594
|
+
...requestConfig
|
|
595
|
+
});
|
|
596
|
+
return res.data;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// src/_generated/clients/roles/roleControllerAssignRole.ts
|
|
600
|
+
function getRoleControllerAssignRoleUrl({
|
|
601
|
+
appId
|
|
602
|
+
}) {
|
|
603
|
+
const app_id = appId;
|
|
604
|
+
const res = {
|
|
605
|
+
method: "POST",
|
|
606
|
+
url: `/v1/apps/${app_id}/roles/assign`
|
|
607
|
+
};
|
|
608
|
+
return res;
|
|
609
|
+
}
|
|
610
|
+
async function roleControllerAssignRole({
|
|
611
|
+
appId,
|
|
612
|
+
data
|
|
613
|
+
}, config = {}) {
|
|
614
|
+
const { client: request = client, ...requestConfig } = config;
|
|
615
|
+
const requestData = data;
|
|
616
|
+
const res = await request({
|
|
617
|
+
method: "POST",
|
|
618
|
+
url: getRoleControllerAssignRoleUrl({ appId }).url.toString(),
|
|
619
|
+
data: requestData,
|
|
620
|
+
...requestConfig
|
|
621
|
+
});
|
|
622
|
+
return res.data;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// src/_generated/clients/roles/roleControllerSetPermissions.ts
|
|
626
|
+
function getRoleControllerSetPermissionsUrl({
|
|
627
|
+
appId,
|
|
628
|
+
roleName
|
|
629
|
+
}) {
|
|
630
|
+
const app_id = appId;
|
|
631
|
+
const role_name = roleName;
|
|
632
|
+
const res = {
|
|
633
|
+
method: "PUT",
|
|
634
|
+
url: `/v1/apps/${app_id}/roles/${role_name}/permissions`
|
|
635
|
+
};
|
|
636
|
+
return res;
|
|
637
|
+
}
|
|
638
|
+
async function roleControllerSetPermissions({
|
|
639
|
+
appId,
|
|
640
|
+
roleName,
|
|
641
|
+
data
|
|
642
|
+
}, config = {}) {
|
|
643
|
+
const { client: request = client, ...requestConfig } = config;
|
|
644
|
+
const requestData = data;
|
|
645
|
+
const res = await request({
|
|
646
|
+
method: "PUT",
|
|
647
|
+
url: getRoleControllerSetPermissionsUrl({ appId, roleName }).url.toString(),
|
|
648
|
+
data: requestData,
|
|
649
|
+
...requestConfig
|
|
650
|
+
});
|
|
651
|
+
return res.data;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// src/_generated/clients/roles/roleControllerListPermissions.ts
|
|
655
|
+
function getRoleControllerListPermissionsUrl({
|
|
656
|
+
appId
|
|
657
|
+
}) {
|
|
658
|
+
const app_id = appId;
|
|
659
|
+
const res = {
|
|
660
|
+
method: "GET",
|
|
661
|
+
url: `/v1/apps/${app_id}/roles/permissions`
|
|
662
|
+
};
|
|
663
|
+
return res;
|
|
664
|
+
}
|
|
665
|
+
async function roleControllerListPermissions({ appId }, config = {}) {
|
|
666
|
+
const { client: request = client, ...requestConfig } = config;
|
|
667
|
+
const res = await request({
|
|
668
|
+
method: "GET",
|
|
669
|
+
url: getRoleControllerListPermissionsUrl({ appId }).url.toString(),
|
|
670
|
+
...requestConfig
|
|
671
|
+
});
|
|
672
|
+
return res.data;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// src/_generated/clients/permissions/permissionControllerListPermissions.ts
|
|
676
|
+
function getPermissionControllerListPermissionsUrl({
|
|
677
|
+
appId
|
|
678
|
+
}) {
|
|
679
|
+
const app_id = appId;
|
|
680
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/permissions` };
|
|
681
|
+
return res;
|
|
682
|
+
}
|
|
683
|
+
async function permissionControllerListPermissions({ appId }, config = {}) {
|
|
684
|
+
const { client: request = client, ...requestConfig } = config;
|
|
685
|
+
const res = await request({
|
|
686
|
+
method: "GET",
|
|
687
|
+
url: getPermissionControllerListPermissionsUrl({ appId }).url.toString(),
|
|
688
|
+
...requestConfig
|
|
689
|
+
});
|
|
690
|
+
return res.data;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// src/_generated/clients/permissions/permissionControllerCreatePermission.ts
|
|
694
|
+
function getPermissionControllerCreatePermissionUrl({
|
|
695
|
+
appId
|
|
696
|
+
}) {
|
|
697
|
+
const app_id = appId;
|
|
698
|
+
const res = {
|
|
699
|
+
method: "POST",
|
|
700
|
+
url: `/v1/apps/${app_id}/permissions`
|
|
701
|
+
};
|
|
702
|
+
return res;
|
|
703
|
+
}
|
|
704
|
+
async function permissionControllerCreatePermission({
|
|
705
|
+
appId,
|
|
706
|
+
data
|
|
707
|
+
}, config = {}) {
|
|
708
|
+
const { client: request = client, ...requestConfig } = config;
|
|
709
|
+
const requestData = data;
|
|
710
|
+
const res = await request({
|
|
711
|
+
method: "POST",
|
|
712
|
+
url: getPermissionControllerCreatePermissionUrl({ appId }).url.toString(),
|
|
713
|
+
data: requestData,
|
|
714
|
+
...requestConfig
|
|
715
|
+
});
|
|
716
|
+
return res.data;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// src/_generated/clients/permissions/permissionControllerDeletePermission.ts
|
|
720
|
+
function getPermissionControllerDeletePermissionUrl({
|
|
721
|
+
appId,
|
|
722
|
+
permissionKey
|
|
723
|
+
}) {
|
|
724
|
+
const app_id = appId;
|
|
725
|
+
const permission_key = permissionKey;
|
|
726
|
+
const res = {
|
|
727
|
+
method: "DELETE",
|
|
728
|
+
url: `/v1/apps/${app_id}/permissions/${permission_key}`
|
|
729
|
+
};
|
|
730
|
+
return res;
|
|
731
|
+
}
|
|
732
|
+
async function permissionControllerDeletePermission({
|
|
733
|
+
appId,
|
|
734
|
+
permissionKey
|
|
735
|
+
}, config = {}) {
|
|
736
|
+
const { client: request = client, ...requestConfig } = config;
|
|
737
|
+
const res = await request({
|
|
738
|
+
method: "DELETE",
|
|
739
|
+
url: getPermissionControllerDeletePermissionUrl({
|
|
740
|
+
appId,
|
|
741
|
+
permissionKey
|
|
742
|
+
}).url.toString(),
|
|
743
|
+
...requestConfig
|
|
744
|
+
});
|
|
745
|
+
return res.data;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// src/_generated/clients/apiKeys/apiKeyControllerListApiKeys.ts
|
|
749
|
+
function getApiKeyControllerListApiKeysUrl({
|
|
750
|
+
appId
|
|
751
|
+
}) {
|
|
752
|
+
const app_id = appId;
|
|
753
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/api-keys` };
|
|
754
|
+
return res;
|
|
755
|
+
}
|
|
756
|
+
async function apiKeyControllerListApiKeys({ appId }, config = {}) {
|
|
757
|
+
const { client: request = client, ...requestConfig } = config;
|
|
758
|
+
const res = await request({
|
|
759
|
+
method: "GET",
|
|
760
|
+
url: getApiKeyControllerListApiKeysUrl({ appId }).url.toString(),
|
|
761
|
+
...requestConfig
|
|
762
|
+
});
|
|
763
|
+
return res.data;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// src/_generated/clients/apiKeys/apiKeyControllerCreateApiKey.ts
|
|
767
|
+
function getApiKeyControllerCreateApiKeyUrl({
|
|
768
|
+
appId
|
|
769
|
+
}) {
|
|
770
|
+
const app_id = appId;
|
|
771
|
+
const res = { method: "POST", url: `/v1/apps/${app_id}/api-keys` };
|
|
772
|
+
return res;
|
|
773
|
+
}
|
|
774
|
+
async function apiKeyControllerCreateApiKey({
|
|
775
|
+
appId,
|
|
776
|
+
data,
|
|
777
|
+
headers
|
|
778
|
+
}, config = {}) {
|
|
779
|
+
const { client: request = client, ...requestConfig } = config;
|
|
780
|
+
const mappedHeaders = headers ? { "Idempotency-Key": headers.idempotencyKey } : void 0;
|
|
781
|
+
const requestData = data;
|
|
782
|
+
const res = await request({
|
|
783
|
+
method: "POST",
|
|
784
|
+
url: getApiKeyControllerCreateApiKeyUrl({ appId }).url.toString(),
|
|
785
|
+
data: requestData,
|
|
786
|
+
...requestConfig,
|
|
787
|
+
headers: { ...mappedHeaders, ...requestConfig.headers }
|
|
788
|
+
});
|
|
789
|
+
return res.data;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// src/_generated/clients/apiKeys/apiKeyControllerDeleteApiKey.ts
|
|
793
|
+
function getApiKeyControllerDeleteApiKeyUrl({
|
|
794
|
+
appId,
|
|
795
|
+
keyId
|
|
796
|
+
}) {
|
|
797
|
+
const app_id = appId;
|
|
798
|
+
const key_id = keyId;
|
|
799
|
+
const res = {
|
|
800
|
+
method: "DELETE",
|
|
801
|
+
url: `/v1/apps/${app_id}/api-keys/${key_id}`
|
|
802
|
+
};
|
|
803
|
+
return res;
|
|
804
|
+
}
|
|
805
|
+
async function apiKeyControllerDeleteApiKey({
|
|
806
|
+
appId,
|
|
807
|
+
keyId
|
|
808
|
+
}, config = {}) {
|
|
809
|
+
const { client: request = client, ...requestConfig } = config;
|
|
810
|
+
const res = await request({
|
|
811
|
+
method: "DELETE",
|
|
812
|
+
url: getApiKeyControllerDeleteApiKeyUrl({ appId, keyId }).url.toString(),
|
|
813
|
+
...requestConfig
|
|
814
|
+
});
|
|
815
|
+
return res.data;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// src/_generated/clients/credentials/M2MControllerListClients.ts
|
|
819
|
+
function getM2MControllerListClientsUrl({
|
|
820
|
+
appId
|
|
821
|
+
}) {
|
|
822
|
+
const app_id = appId;
|
|
823
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/credentials` };
|
|
824
|
+
return res;
|
|
825
|
+
}
|
|
826
|
+
async function M2MControllerListClients({
|
|
827
|
+
appId,
|
|
828
|
+
params
|
|
829
|
+
}, config = {}) {
|
|
830
|
+
const { client: request = client, ...requestConfig } = config;
|
|
831
|
+
const res = await request({
|
|
832
|
+
method: "GET",
|
|
833
|
+
url: getM2MControllerListClientsUrl({ appId }).url.toString(),
|
|
834
|
+
params,
|
|
835
|
+
...requestConfig
|
|
836
|
+
});
|
|
837
|
+
return res.data;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
// src/_generated/clients/credentials/M2MControllerCreateClient.ts
|
|
841
|
+
function getM2MControllerCreateClientUrl({
|
|
842
|
+
appId
|
|
843
|
+
}) {
|
|
844
|
+
const app_id = appId;
|
|
845
|
+
const res = {
|
|
846
|
+
method: "POST",
|
|
847
|
+
url: `/v1/apps/${app_id}/credentials`
|
|
848
|
+
};
|
|
849
|
+
return res;
|
|
850
|
+
}
|
|
851
|
+
async function M2MControllerCreateClient({
|
|
852
|
+
appId,
|
|
853
|
+
data,
|
|
854
|
+
headers
|
|
855
|
+
}, config = {}) {
|
|
856
|
+
const { client: request = client, ...requestConfig } = config;
|
|
857
|
+
const mappedHeaders = headers ? { "Idempotency-Key": headers.idempotencyKey } : void 0;
|
|
858
|
+
const requestData = data;
|
|
859
|
+
const res = await request({
|
|
860
|
+
method: "POST",
|
|
861
|
+
url: getM2MControllerCreateClientUrl({ appId }).url.toString(),
|
|
862
|
+
data: requestData,
|
|
863
|
+
...requestConfig,
|
|
864
|
+
headers: { ...mappedHeaders, ...requestConfig.headers }
|
|
865
|
+
});
|
|
866
|
+
return res.data;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// src/_generated/clients/credentials/M2MControllerGetClient.ts
|
|
870
|
+
function getM2MControllerGetClientUrl({
|
|
871
|
+
appId,
|
|
872
|
+
clientId
|
|
873
|
+
}) {
|
|
874
|
+
const app_id = appId;
|
|
875
|
+
const client_id = clientId;
|
|
876
|
+
const res = {
|
|
877
|
+
method: "GET",
|
|
878
|
+
url: `/v1/apps/${app_id}/credentials/${client_id}`
|
|
879
|
+
};
|
|
880
|
+
return res;
|
|
881
|
+
}
|
|
882
|
+
async function M2MControllerGetClient({
|
|
883
|
+
appId,
|
|
884
|
+
clientId
|
|
885
|
+
}, config = {}) {
|
|
886
|
+
const { client: request = client, ...requestConfig } = config;
|
|
887
|
+
const res = await request({
|
|
888
|
+
method: "GET",
|
|
889
|
+
url: getM2MControllerGetClientUrl({ appId, clientId }).url.toString(),
|
|
890
|
+
...requestConfig
|
|
891
|
+
});
|
|
892
|
+
return res.data;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// src/_generated/clients/credentials/M2MControllerUpdateClient.ts
|
|
896
|
+
function getM2MControllerUpdateClientUrl({
|
|
897
|
+
appId,
|
|
898
|
+
clientId
|
|
899
|
+
}) {
|
|
900
|
+
const app_id = appId;
|
|
901
|
+
const client_id = clientId;
|
|
902
|
+
const res = {
|
|
903
|
+
method: "PATCH",
|
|
904
|
+
url: `/v1/apps/${app_id}/credentials/${client_id}`
|
|
905
|
+
};
|
|
906
|
+
return res;
|
|
907
|
+
}
|
|
908
|
+
async function M2MControllerUpdateClient({
|
|
909
|
+
appId,
|
|
910
|
+
clientId,
|
|
911
|
+
data
|
|
912
|
+
}, config = {}) {
|
|
913
|
+
const { client: request = client, ...requestConfig } = config;
|
|
914
|
+
const requestData = data;
|
|
915
|
+
const res = await request({
|
|
916
|
+
method: "PATCH",
|
|
917
|
+
url: getM2MControllerUpdateClientUrl({ appId, clientId }).url.toString(),
|
|
918
|
+
data: requestData,
|
|
919
|
+
...requestConfig
|
|
920
|
+
});
|
|
921
|
+
return res.data;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// src/_generated/clients/credentials/M2MControllerDeleteClient.ts
|
|
925
|
+
function getM2MControllerDeleteClientUrl({
|
|
926
|
+
appId,
|
|
927
|
+
clientId
|
|
928
|
+
}) {
|
|
929
|
+
const app_id = appId;
|
|
930
|
+
const client_id = clientId;
|
|
931
|
+
const res = {
|
|
932
|
+
method: "DELETE",
|
|
933
|
+
url: `/v1/apps/${app_id}/credentials/${client_id}`
|
|
934
|
+
};
|
|
935
|
+
return res;
|
|
936
|
+
}
|
|
937
|
+
async function M2MControllerDeleteClient({
|
|
938
|
+
appId,
|
|
939
|
+
clientId
|
|
940
|
+
}, config = {}) {
|
|
941
|
+
const { client: request = client, ...requestConfig } = config;
|
|
942
|
+
const res = await request({
|
|
943
|
+
method: "DELETE",
|
|
944
|
+
url: getM2MControllerDeleteClientUrl({ appId, clientId }).url.toString(),
|
|
945
|
+
...requestConfig
|
|
946
|
+
});
|
|
947
|
+
return res.data;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// src/_generated/clients/credentials/M2MControllerRotateSecret.ts
|
|
951
|
+
function getM2MControllerRotateSecretUrl({
|
|
952
|
+
appId,
|
|
953
|
+
clientId
|
|
954
|
+
}) {
|
|
955
|
+
const app_id = appId;
|
|
956
|
+
const client_id = clientId;
|
|
957
|
+
const res = {
|
|
958
|
+
method: "POST",
|
|
959
|
+
url: `/v1/apps/${app_id}/credentials/${client_id}/rotate`
|
|
960
|
+
};
|
|
961
|
+
return res;
|
|
962
|
+
}
|
|
963
|
+
async function M2MControllerRotateSecret({
|
|
964
|
+
appId,
|
|
965
|
+
clientId
|
|
966
|
+
}, config = {}) {
|
|
967
|
+
const { client: request = client, ...requestConfig } = config;
|
|
968
|
+
const res = await request({
|
|
969
|
+
method: "POST",
|
|
970
|
+
url: getM2MControllerRotateSecretUrl({ appId, clientId }).url.toString(),
|
|
971
|
+
...requestConfig
|
|
972
|
+
});
|
|
973
|
+
return res.data;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
// src/_generated/clients/credentials/M2MControllerSetScopes.ts
|
|
977
|
+
function getM2MControllerSetScopesUrl({
|
|
978
|
+
appId,
|
|
979
|
+
clientId
|
|
980
|
+
}) {
|
|
981
|
+
const app_id = appId;
|
|
982
|
+
const client_id = clientId;
|
|
983
|
+
const res = {
|
|
984
|
+
method: "PUT",
|
|
985
|
+
url: `/v1/apps/${app_id}/credentials/${client_id}/scopes`
|
|
986
|
+
};
|
|
987
|
+
return res;
|
|
988
|
+
}
|
|
989
|
+
async function M2MControllerSetScopes({
|
|
990
|
+
appId,
|
|
991
|
+
clientId,
|
|
992
|
+
data
|
|
993
|
+
}, config = {}) {
|
|
994
|
+
const { client: request = client, ...requestConfig } = config;
|
|
995
|
+
const requestData = data;
|
|
996
|
+
const res = await request({
|
|
997
|
+
method: "PUT",
|
|
998
|
+
url: getM2MControllerSetScopesUrl({ appId, clientId }).url.toString(),
|
|
999
|
+
data: requestData,
|
|
1000
|
+
...requestConfig
|
|
1001
|
+
});
|
|
1002
|
+
return res.data;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// src/_generated/clients/appAudit/appAuditControllerGetAuditLogs.ts
|
|
1006
|
+
function getAppAuditControllerGetAuditLogsUrl({
|
|
1007
|
+
appId
|
|
1008
|
+
}) {
|
|
1009
|
+
const app_id = appId;
|
|
1010
|
+
const res = { method: "GET", url: `/v1/apps/${app_id}/audit-logs` };
|
|
1011
|
+
return res;
|
|
1012
|
+
}
|
|
1013
|
+
async function appAuditControllerGetAuditLogs({
|
|
1014
|
+
appId,
|
|
1015
|
+
params
|
|
1016
|
+
}, config = {}) {
|
|
1017
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1018
|
+
const mappedParams = params ? {
|
|
1019
|
+
limit: params.limit,
|
|
1020
|
+
cursor: params.cursor,
|
|
1021
|
+
action: params.action,
|
|
1022
|
+
actor_id: params.actorId
|
|
1023
|
+
} : void 0;
|
|
1024
|
+
const res = await request({
|
|
1025
|
+
method: "GET",
|
|
1026
|
+
url: getAppAuditControllerGetAuditLogsUrl({ appId }).url.toString(),
|
|
1027
|
+
params: mappedParams,
|
|
1028
|
+
...requestConfig
|
|
1029
|
+
});
|
|
1030
|
+
return res.data;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// src/scopes/app.ts
|
|
1034
|
+
var AppScope = class {
|
|
1035
|
+
/** The appId bound to this scope. */
|
|
1036
|
+
appId;
|
|
1037
|
+
client;
|
|
1038
|
+
constructor(appId, client2) {
|
|
1039
|
+
this.appId = appId;
|
|
1040
|
+
this.client = client2;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Direct HTTP escape hatch used to call endpoints whose spec is buggy
|
|
1044
|
+
* — currently those whose path declares `{appId}` but whose
|
|
1045
|
+
* `parameters[]` omits it, so the kubb-generated code leaves the
|
|
1046
|
+
* URL template unfilled. Tracked upstream; remove once the spec is
|
|
1047
|
+
* fixed and the per-call wrappers can move back to kubb's output.
|
|
1048
|
+
*/
|
|
1049
|
+
async callDirect(method, url, body) {
|
|
1050
|
+
const res = await this.client({ method, url, data: body });
|
|
1051
|
+
return res.data;
|
|
1052
|
+
}
|
|
1053
|
+
// ─────────────────────────────────────────────────────────────
|
|
1054
|
+
// App meta — operations on the app record itself
|
|
1055
|
+
// ─────────────────────────────────────────────────────────────
|
|
1056
|
+
get = () => appControllerGetApp({ appId: this.appId }, { client: this.client });
|
|
1057
|
+
update = (data) => appControllerUpdateApp({ appId: this.appId, data }, { client: this.client });
|
|
1058
|
+
delete = () => appControllerDeleteApp({ appId: this.appId }, { client: this.client });
|
|
1059
|
+
updateStatus = (data) => appControllerUpdateAppStatus(
|
|
1060
|
+
{ appId: this.appId, data },
|
|
1061
|
+
{ client: this.client }
|
|
1062
|
+
);
|
|
1063
|
+
// ─────────────────────────────────────────────────────────────
|
|
1064
|
+
// Auth config (workspace-side config for the app's auth surface)
|
|
1065
|
+
// ─────────────────────────────────────────────────────────────
|
|
1066
|
+
authConfig = {
|
|
1067
|
+
get: () => authConfigControllerGetConfig(
|
|
1068
|
+
{ appId: this.appId },
|
|
1069
|
+
{ client: this.client }
|
|
1070
|
+
),
|
|
1071
|
+
update: (data) => authConfigControllerUpdateConfig(
|
|
1072
|
+
{ appId: this.appId, data },
|
|
1073
|
+
{ client: this.client }
|
|
1074
|
+
)
|
|
1075
|
+
};
|
|
1076
|
+
// ─────────────────────────────────────────────────────────────
|
|
1077
|
+
// Invites (workspace members)
|
|
1078
|
+
// ─────────────────────────────────────────────────────────────
|
|
1079
|
+
invites = {
|
|
1080
|
+
list: (params = {}) => appControllerListInvites(
|
|
1081
|
+
{ appId: this.appId, params },
|
|
1082
|
+
{ client: this.client }
|
|
1083
|
+
),
|
|
1084
|
+
create: (data) => appControllerCreateInvite(
|
|
1085
|
+
{ appId: this.appId, data },
|
|
1086
|
+
{ client: this.client }
|
|
1087
|
+
),
|
|
1088
|
+
revoke: (inviteId) => appControllerRevokeInvite(
|
|
1089
|
+
{ appId: this.appId, inviteId },
|
|
1090
|
+
{ client: this.client }
|
|
1091
|
+
)
|
|
1092
|
+
};
|
|
1093
|
+
// ─────────────────────────────────────────────────────────────
|
|
1094
|
+
// Members (workspace seats on this app)
|
|
1095
|
+
// ─────────────────────────────────────────────────────────────
|
|
1096
|
+
members = {
|
|
1097
|
+
list: (params = {}) => appControllerListMembers(
|
|
1098
|
+
{ appId: this.appId, params },
|
|
1099
|
+
{ client: this.client }
|
|
1100
|
+
),
|
|
1101
|
+
remove: (accountId) => appControllerRemoveMember(
|
|
1102
|
+
{ appId: this.appId, accountId },
|
|
1103
|
+
{ client: this.client }
|
|
1104
|
+
)
|
|
1105
|
+
};
|
|
1106
|
+
// ─────────────────────────────────────────────────────────────
|
|
1107
|
+
// EndUsers (the app's authenticated users — Heimdall's bread + butter)
|
|
1108
|
+
// ─────────────────────────────────────────────────────────────
|
|
1109
|
+
endUsers = {
|
|
1110
|
+
list: (params = {}) => endUserControllerListEndUsers(
|
|
1111
|
+
{ appId: this.appId, params },
|
|
1112
|
+
{ client: this.client }
|
|
1113
|
+
),
|
|
1114
|
+
get: (userId) => endUserControllerGetEndUser(
|
|
1115
|
+
{ appId: this.appId, userId },
|
|
1116
|
+
{ client: this.client }
|
|
1117
|
+
),
|
|
1118
|
+
update: (userId, data) => endUserControllerUpdateEndUser(
|
|
1119
|
+
{ appId: this.appId, userId, data },
|
|
1120
|
+
{ client: this.client }
|
|
1121
|
+
),
|
|
1122
|
+
delete: (userId) => endUserControllerDeleteEndUser(
|
|
1123
|
+
{ appId: this.appId, userId },
|
|
1124
|
+
{ client: this.client }
|
|
1125
|
+
),
|
|
1126
|
+
updateRole: (userId, data) => endUserControllerUpdateRole(
|
|
1127
|
+
{ appId: this.appId, userId, data },
|
|
1128
|
+
{ client: this.client }
|
|
1129
|
+
),
|
|
1130
|
+
updateStatus: (userId, data) => endUserControllerUpdateStatus(
|
|
1131
|
+
{ appId: this.appId, userId, data },
|
|
1132
|
+
{ client: this.client }
|
|
1133
|
+
),
|
|
1134
|
+
/** Spec bug: appId missing in spec params (see callDirect). */
|
|
1135
|
+
revokeAllSessions: (userId) => this.callDirect(
|
|
1136
|
+
"POST",
|
|
1137
|
+
`/v1/apps/${this.appId}/end-users/${userId}/sessions/revoke-all`
|
|
1138
|
+
)
|
|
1139
|
+
};
|
|
1140
|
+
// ─────────────────────────────────────────────────────────────
|
|
1141
|
+
// Roles
|
|
1142
|
+
// ─────────────────────────────────────────────────────────────
|
|
1143
|
+
roles = {
|
|
1144
|
+
list: (params = {}) => roleControllerListRoles(
|
|
1145
|
+
{ appId: this.appId, params },
|
|
1146
|
+
{ client: this.client }
|
|
1147
|
+
),
|
|
1148
|
+
/** Spec bug: appId missing in spec params (see callDirect). */
|
|
1149
|
+
get: (roleName) => this.callDirect("GET", `/v1/apps/${this.appId}/roles/${roleName}`),
|
|
1150
|
+
create: (data) => roleControllerCreateRole(
|
|
1151
|
+
{ appId: this.appId, data },
|
|
1152
|
+
{ client: this.client }
|
|
1153
|
+
),
|
|
1154
|
+
/** Spec bug: appId missing in spec params (see callDirect). */
|
|
1155
|
+
update: (roleName, data) => this.callDirect(
|
|
1156
|
+
"PATCH",
|
|
1157
|
+
`/v1/apps/${this.appId}/roles/${roleName}`,
|
|
1158
|
+
data
|
|
1159
|
+
),
|
|
1160
|
+
/** Spec bug: appId missing in spec params (see callDirect). */
|
|
1161
|
+
delete: (roleName) => this.callDirect("DELETE", `/v1/apps/${this.appId}/roles/${roleName}`),
|
|
1162
|
+
assign: (data) => roleControllerAssignRole(
|
|
1163
|
+
{ appId: this.appId, data },
|
|
1164
|
+
{ client: this.client }
|
|
1165
|
+
),
|
|
1166
|
+
setPermissions: (roleName, data) => roleControllerSetPermissions(
|
|
1167
|
+
{ appId: this.appId, roleName, data },
|
|
1168
|
+
{ client: this.client }
|
|
1169
|
+
),
|
|
1170
|
+
listPermissions: () => roleControllerListPermissions(
|
|
1171
|
+
{ appId: this.appId },
|
|
1172
|
+
{ client: this.client }
|
|
1173
|
+
)
|
|
1174
|
+
};
|
|
1175
|
+
// ─────────────────────────────────────────────────────────────
|
|
1176
|
+
// Permissions catalog
|
|
1177
|
+
// ─────────────────────────────────────────────────────────────
|
|
1178
|
+
permissions = {
|
|
1179
|
+
list: () => permissionControllerListPermissions(
|
|
1180
|
+
{ appId: this.appId },
|
|
1181
|
+
{ client: this.client }
|
|
1182
|
+
),
|
|
1183
|
+
create: (data) => permissionControllerCreatePermission(
|
|
1184
|
+
{ appId: this.appId, data },
|
|
1185
|
+
{ client: this.client }
|
|
1186
|
+
),
|
|
1187
|
+
delete: (permissionKey) => permissionControllerDeletePermission(
|
|
1188
|
+
{ appId: this.appId, permissionKey },
|
|
1189
|
+
{ client: this.client }
|
|
1190
|
+
)
|
|
1191
|
+
};
|
|
1192
|
+
// ─────────────────────────────────────────────────────────────
|
|
1193
|
+
// API keys (server-to-server platform keys for this app)
|
|
1194
|
+
// ─────────────────────────────────────────────────────────────
|
|
1195
|
+
apiKeys = {
|
|
1196
|
+
list: () => apiKeyControllerListApiKeys(
|
|
1197
|
+
{ appId: this.appId },
|
|
1198
|
+
{ client: this.client }
|
|
1199
|
+
),
|
|
1200
|
+
create: (data) => apiKeyControllerCreateApiKey(
|
|
1201
|
+
{ appId: this.appId, data },
|
|
1202
|
+
{ client: this.client }
|
|
1203
|
+
),
|
|
1204
|
+
delete: (keyId) => apiKeyControllerDeleteApiKey(
|
|
1205
|
+
{ appId: this.appId, keyId },
|
|
1206
|
+
{ client: this.client }
|
|
1207
|
+
)
|
|
1208
|
+
};
|
|
1209
|
+
// ─────────────────────────────────────────────────────────────
|
|
1210
|
+
// M2M credentials (client_id + client_secret for service-to-service)
|
|
1211
|
+
// ─────────────────────────────────────────────────────────────
|
|
1212
|
+
credentials = {
|
|
1213
|
+
list: (params = {}) => M2MControllerListClients(
|
|
1214
|
+
{ appId: this.appId, params },
|
|
1215
|
+
{ client: this.client }
|
|
1216
|
+
),
|
|
1217
|
+
create: (data) => M2MControllerCreateClient(
|
|
1218
|
+
{ appId: this.appId, data },
|
|
1219
|
+
{ client: this.client }
|
|
1220
|
+
),
|
|
1221
|
+
get: (clientId) => M2MControllerGetClient(
|
|
1222
|
+
{ appId: this.appId, clientId },
|
|
1223
|
+
{ client: this.client }
|
|
1224
|
+
),
|
|
1225
|
+
update: (clientId, data) => M2MControllerUpdateClient(
|
|
1226
|
+
{ appId: this.appId, clientId, data },
|
|
1227
|
+
{ client: this.client }
|
|
1228
|
+
),
|
|
1229
|
+
delete: (clientId) => M2MControllerDeleteClient(
|
|
1230
|
+
{ appId: this.appId, clientId },
|
|
1231
|
+
{ client: this.client }
|
|
1232
|
+
),
|
|
1233
|
+
rotateSecret: (clientId) => M2MControllerRotateSecret(
|
|
1234
|
+
{ appId: this.appId, clientId },
|
|
1235
|
+
{ client: this.client }
|
|
1236
|
+
),
|
|
1237
|
+
setScopes: (clientId, data) => M2MControllerSetScopes(
|
|
1238
|
+
{ appId: this.appId, clientId, data },
|
|
1239
|
+
{ client: this.client }
|
|
1240
|
+
)
|
|
1241
|
+
};
|
|
1242
|
+
// ─────────────────────────────────────────────────────────────
|
|
1243
|
+
// Audit logs
|
|
1244
|
+
// ─────────────────────────────────────────────────────────────
|
|
1245
|
+
auditLogs = {
|
|
1246
|
+
list: (params = {}) => appAuditControllerGetAuditLogs(
|
|
1247
|
+
{ appId: this.appId, params },
|
|
1248
|
+
{ client: this.client }
|
|
1249
|
+
)
|
|
1250
|
+
};
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
// src/_generated/clients/consumerAuth/consumerAuthControllerSignin.ts
|
|
1254
|
+
function getConsumerAuthControllerSigninUrl({
|
|
1255
|
+
appSlug
|
|
1256
|
+
}) {
|
|
1257
|
+
const app_slug = appSlug;
|
|
1258
|
+
const res = { method: "POST", url: `/${app_slug}/v1/auth/signin` };
|
|
1259
|
+
return res;
|
|
1260
|
+
}
|
|
1261
|
+
async function consumerAuthControllerSignin({
|
|
1262
|
+
appSlug,
|
|
1263
|
+
data
|
|
1264
|
+
}, config = {}) {
|
|
1265
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1266
|
+
const requestData = data;
|
|
1267
|
+
const res = await request({
|
|
1268
|
+
method: "POST",
|
|
1269
|
+
url: getConsumerAuthControllerSigninUrl({ appSlug }).url.toString(),
|
|
1270
|
+
data: requestData,
|
|
1271
|
+
...requestConfig
|
|
1272
|
+
});
|
|
1273
|
+
return res.data;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// src/_generated/clients/consumerAuth/consumerAuthControllerRefresh.ts
|
|
1277
|
+
function getConsumerAuthControllerRefreshUrl({
|
|
1278
|
+
appSlug
|
|
1279
|
+
}) {
|
|
1280
|
+
const app_slug = appSlug;
|
|
1281
|
+
const res = { method: "POST", url: `/${app_slug}/v1/auth/refresh` };
|
|
1282
|
+
return res;
|
|
1283
|
+
}
|
|
1284
|
+
async function consumerAuthControllerRefresh({
|
|
1285
|
+
appSlug,
|
|
1286
|
+
data
|
|
1287
|
+
}, config = {}) {
|
|
1288
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1289
|
+
const requestData = data;
|
|
1290
|
+
const res = await request({
|
|
1291
|
+
method: "POST",
|
|
1292
|
+
url: getConsumerAuthControllerRefreshUrl({ appSlug }).url.toString(),
|
|
1293
|
+
data: requestData,
|
|
1294
|
+
...requestConfig
|
|
1295
|
+
});
|
|
1296
|
+
return res.data;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
// src/_generated/clients/consumerAuth/consumerAuthControllerLogout.ts
|
|
1300
|
+
function getConsumerAuthControllerLogoutUrl({
|
|
1301
|
+
appSlug
|
|
1302
|
+
}) {
|
|
1303
|
+
const app_slug = appSlug;
|
|
1304
|
+
const res = { method: "POST", url: `/${app_slug}/v1/auth/logout` };
|
|
1305
|
+
return res;
|
|
1306
|
+
}
|
|
1307
|
+
async function consumerAuthControllerLogout({
|
|
1308
|
+
appSlug,
|
|
1309
|
+
data
|
|
1310
|
+
}, config = {}) {
|
|
1311
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1312
|
+
const requestData = data;
|
|
1313
|
+
const res = await request({
|
|
1314
|
+
method: "POST",
|
|
1315
|
+
url: getConsumerAuthControllerLogoutUrl({ appSlug }).url.toString(),
|
|
1316
|
+
data: requestData,
|
|
1317
|
+
...requestConfig
|
|
1318
|
+
});
|
|
1319
|
+
return res.data;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
// src/_generated/clients/consumerAuth/consumerAuthControllerRequestPasswordReset.ts
|
|
1323
|
+
function getConsumerAuthControllerRequestPasswordResetUrl({
|
|
1324
|
+
appSlug
|
|
1325
|
+
}) {
|
|
1326
|
+
const app_slug = appSlug;
|
|
1327
|
+
const res = {
|
|
1328
|
+
method: "POST",
|
|
1329
|
+
url: `/${app_slug}/v1/auth/request-password-reset`
|
|
1330
|
+
};
|
|
1331
|
+
return res;
|
|
1332
|
+
}
|
|
1333
|
+
async function consumerAuthControllerRequestPasswordReset({
|
|
1334
|
+
appSlug,
|
|
1335
|
+
data,
|
|
1336
|
+
headers
|
|
1337
|
+
}, config = {}) {
|
|
1338
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1339
|
+
const requestData = data;
|
|
1340
|
+
const res = await request({
|
|
1341
|
+
method: "POST",
|
|
1342
|
+
url: getConsumerAuthControllerRequestPasswordResetUrl({
|
|
1343
|
+
appSlug
|
|
1344
|
+
}).url.toString(),
|
|
1345
|
+
data: requestData,
|
|
1346
|
+
...requestConfig,
|
|
1347
|
+
headers: { ...headers, ...requestConfig.headers }
|
|
1348
|
+
});
|
|
1349
|
+
return res.data;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
// src/_generated/clients/consumerAuth/consumerAuthControllerResetPassword.ts
|
|
1353
|
+
function getConsumerAuthControllerResetPasswordUrl({
|
|
1354
|
+
appSlug
|
|
1355
|
+
}) {
|
|
1356
|
+
const app_slug = appSlug;
|
|
1357
|
+
const res = {
|
|
1358
|
+
method: "POST",
|
|
1359
|
+
url: `/${app_slug}/v1/auth/reset-password`
|
|
1360
|
+
};
|
|
1361
|
+
return res;
|
|
1362
|
+
}
|
|
1363
|
+
async function consumerAuthControllerResetPassword({
|
|
1364
|
+
appSlug,
|
|
1365
|
+
data
|
|
1366
|
+
}, config = {}) {
|
|
1367
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1368
|
+
const requestData = data;
|
|
1369
|
+
const res = await request({
|
|
1370
|
+
method: "POST",
|
|
1371
|
+
url: getConsumerAuthControllerResetPasswordUrl({ appSlug }).url.toString(),
|
|
1372
|
+
data: requestData,
|
|
1373
|
+
...requestConfig
|
|
1374
|
+
});
|
|
1375
|
+
return res.data;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
// src/_generated/clients/consumerOauthSignIn/consumerIdpControllerNativeSignIn.ts
|
|
1379
|
+
function getConsumerIdpControllerNativeSignInUrl({
|
|
1380
|
+
appSlug,
|
|
1381
|
+
provider
|
|
1382
|
+
}) {
|
|
1383
|
+
const app_slug = appSlug;
|
|
1384
|
+
const res = {
|
|
1385
|
+
method: "POST",
|
|
1386
|
+
url: `/${app_slug}/v1/auth/oauth/${provider}`
|
|
1387
|
+
};
|
|
1388
|
+
return res;
|
|
1389
|
+
}
|
|
1390
|
+
async function consumerIdpControllerNativeSignIn({
|
|
1391
|
+
appSlug,
|
|
1392
|
+
provider,
|
|
1393
|
+
data
|
|
1394
|
+
}, config = {}) {
|
|
1395
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1396
|
+
const requestData = data;
|
|
1397
|
+
const res = await request({
|
|
1398
|
+
method: "POST",
|
|
1399
|
+
url: getConsumerIdpControllerNativeSignInUrl({
|
|
1400
|
+
appSlug,
|
|
1401
|
+
provider
|
|
1402
|
+
}).url.toString(),
|
|
1403
|
+
data: requestData,
|
|
1404
|
+
...requestConfig
|
|
1405
|
+
});
|
|
1406
|
+
return res.data;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
// src/_generated/clients/consumerVerify/consumerVerifyControllerVerify.ts
|
|
1410
|
+
function getConsumerVerifyControllerVerifyUrl({
|
|
1411
|
+
appSlug
|
|
1412
|
+
}) {
|
|
1413
|
+
const app_slug = appSlug;
|
|
1414
|
+
const res = { method: "POST", url: `/${app_slug}/v1/verify` };
|
|
1415
|
+
return res;
|
|
1416
|
+
}
|
|
1417
|
+
async function consumerVerifyControllerVerify({
|
|
1418
|
+
appSlug,
|
|
1419
|
+
data
|
|
1420
|
+
}, config = {}) {
|
|
1421
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1422
|
+
const requestData = data;
|
|
1423
|
+
const res = await request({
|
|
1424
|
+
method: "POST",
|
|
1425
|
+
url: getConsumerVerifyControllerVerifyUrl({ appSlug }).url.toString(),
|
|
1426
|
+
data: requestData,
|
|
1427
|
+
...requestConfig
|
|
1428
|
+
});
|
|
1429
|
+
return res.data;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
// src/_generated/clients/consumerVerify/consumerVerifyControllerAuthorize.ts
|
|
1433
|
+
function getConsumerVerifyControllerAuthorizeUrl({
|
|
1434
|
+
appSlug
|
|
1435
|
+
}) {
|
|
1436
|
+
const app_slug = appSlug;
|
|
1437
|
+
const res = { method: "POST", url: `/${app_slug}/v1/authorize` };
|
|
1438
|
+
return res;
|
|
1439
|
+
}
|
|
1440
|
+
async function consumerVerifyControllerAuthorize({
|
|
1441
|
+
appSlug,
|
|
1442
|
+
data
|
|
1443
|
+
}, config = {}) {
|
|
1444
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1445
|
+
const requestData = data;
|
|
1446
|
+
const res = await request({
|
|
1447
|
+
method: "POST",
|
|
1448
|
+
url: getConsumerVerifyControllerAuthorizeUrl({ appSlug }).url.toString(),
|
|
1449
|
+
data: requestData,
|
|
1450
|
+
...requestConfig
|
|
1451
|
+
});
|
|
1452
|
+
return res.data;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// src/_generated/clients/consumerVerify/consumerVerifyControllerAuthorizeBatch.ts
|
|
1456
|
+
function getConsumerVerifyControllerAuthorizeBatchUrl({
|
|
1457
|
+
appSlug
|
|
1458
|
+
}) {
|
|
1459
|
+
const app_slug = appSlug;
|
|
1460
|
+
const res = {
|
|
1461
|
+
method: "POST",
|
|
1462
|
+
url: `/${app_slug}/v1/authorize/batch`
|
|
1463
|
+
};
|
|
1464
|
+
return res;
|
|
1465
|
+
}
|
|
1466
|
+
async function consumerVerifyControllerAuthorizeBatch({
|
|
1467
|
+
appSlug,
|
|
1468
|
+
data
|
|
1469
|
+
}, config = {}) {
|
|
1470
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1471
|
+
const requestData = data;
|
|
1472
|
+
const res = await request({
|
|
1473
|
+
method: "POST",
|
|
1474
|
+
url: getConsumerVerifyControllerAuthorizeBatchUrl({
|
|
1475
|
+
appSlug
|
|
1476
|
+
}).url.toString(),
|
|
1477
|
+
data: requestData,
|
|
1478
|
+
...requestConfig
|
|
1479
|
+
});
|
|
1480
|
+
return res.data;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
// src/_generated/clients/consumerOauthM2m/consumerOAuthControllerClientCredentials.ts
|
|
1484
|
+
function getConsumerOAuthControllerClientCredentialsUrl({
|
|
1485
|
+
appSlug
|
|
1486
|
+
}) {
|
|
1487
|
+
const app_slug = appSlug;
|
|
1488
|
+
const res = { method: "POST", url: `/${app_slug}/v1/oauth/token` };
|
|
1489
|
+
return res;
|
|
1490
|
+
}
|
|
1491
|
+
async function consumerOAuthControllerClientCredentials({
|
|
1492
|
+
appSlug,
|
|
1493
|
+
data
|
|
1494
|
+
}, config = {}) {
|
|
1495
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1496
|
+
const requestData = data;
|
|
1497
|
+
const res = await request({
|
|
1498
|
+
method: "POST",
|
|
1499
|
+
url: getConsumerOAuthControllerClientCredentialsUrl({
|
|
1500
|
+
appSlug
|
|
1501
|
+
}).url.toString(),
|
|
1502
|
+
data: requestData,
|
|
1503
|
+
...requestConfig
|
|
1504
|
+
});
|
|
1505
|
+
return res.data;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
// src/jwt/errors.ts
|
|
1509
|
+
var JwtVerifyError = class extends Error {
|
|
1510
|
+
code;
|
|
1511
|
+
constructor(code, message, options) {
|
|
1512
|
+
super(message, options);
|
|
1513
|
+
this.name = "JwtVerifyError";
|
|
1514
|
+
this.code = code;
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
var JwtInvalidError = class extends JwtVerifyError {
|
|
1518
|
+
constructor(message, options) {
|
|
1519
|
+
super("ERR_JWT_INVALID", message, options);
|
|
1520
|
+
this.name = "JwtInvalidError";
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
var JwtExpiredError = class extends JwtVerifyError {
|
|
1524
|
+
expiredAt;
|
|
1525
|
+
constructor(message, expiredAt, options) {
|
|
1526
|
+
super("ERR_JWT_EXPIRED", message, options);
|
|
1527
|
+
this.name = "JwtExpiredError";
|
|
1528
|
+
this.expiredAt = expiredAt;
|
|
1529
|
+
}
|
|
1530
|
+
};
|
|
1531
|
+
var JwtNotYetValidError = class extends JwtVerifyError {
|
|
1532
|
+
constructor(message, options) {
|
|
1533
|
+
super("ERR_JWT_NOT_YET_VALID", message, options);
|
|
1534
|
+
this.name = "JwtNotYetValidError";
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
var JwtIssuerMismatchError = class extends JwtVerifyError {
|
|
1538
|
+
constructor(message, options) {
|
|
1539
|
+
super("ERR_JWT_ISS_MISMATCH", message, options);
|
|
1540
|
+
this.name = "JwtIssuerMismatchError";
|
|
1541
|
+
}
|
|
1542
|
+
};
|
|
1543
|
+
var JwtAudienceMismatchError = class extends JwtVerifyError {
|
|
1544
|
+
constructor(message, options) {
|
|
1545
|
+
super("ERR_JWT_AUD_MISMATCH", message, options);
|
|
1546
|
+
this.name = "JwtAudienceMismatchError";
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
var JwksKeyNotFoundError = class extends JwtVerifyError {
|
|
1550
|
+
kid;
|
|
1551
|
+
constructor(kid, options) {
|
|
1552
|
+
super(
|
|
1553
|
+
"ERR_JWKS_KID_NOT_FOUND",
|
|
1554
|
+
`JWKS has no key matching kid=${kid ?? "(missing)"}`,
|
|
1555
|
+
options
|
|
1556
|
+
);
|
|
1557
|
+
this.name = "JwksKeyNotFoundError";
|
|
1558
|
+
this.kid = kid;
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
var JwksFetchError = class extends JwtVerifyError {
|
|
1562
|
+
constructor(message, options) {
|
|
1563
|
+
super("ERR_JWKS_FETCH", message, options);
|
|
1564
|
+
this.name = "JwksFetchError";
|
|
1565
|
+
}
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
// src/jwt/jwks-cache.ts
|
|
1569
|
+
var JwksCache = class {
|
|
1570
|
+
url;
|
|
1571
|
+
_jose;
|
|
1572
|
+
constructor(options) {
|
|
1573
|
+
this.url = options.url;
|
|
1574
|
+
const joseOpts = {
|
|
1575
|
+
cacheMaxAge: options.ttlMs ?? 10 * 60 * 1e3,
|
|
1576
|
+
cooldownDuration: options.cooldownMs ?? 3e4,
|
|
1577
|
+
timeoutDuration: options.timeoutMs ?? 5e3
|
|
1578
|
+
};
|
|
1579
|
+
if (options.fetch) {
|
|
1580
|
+
joseOpts[jose.customFetch] = options.fetch;
|
|
1581
|
+
}
|
|
1582
|
+
this._jose = jose.createRemoteJWKSet(
|
|
1583
|
+
options.url,
|
|
1584
|
+
joseOpts
|
|
1585
|
+
);
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Resolve a signing key for a given JWT header.
|
|
1589
|
+
* Bound as an arrow-function field so it can be passed around
|
|
1590
|
+
* (`jose.jwtVerify(token, cache.getKey, ...)`, passport-jwt, etc.)
|
|
1591
|
+
* without losing `this`.
|
|
1592
|
+
*/
|
|
1593
|
+
getKey = async (header, input) => {
|
|
1594
|
+
try {
|
|
1595
|
+
return await this._jose(header, input);
|
|
1596
|
+
} catch (err) {
|
|
1597
|
+
if (err instanceof jose.errors.JWKSNoMatchingKey) {
|
|
1598
|
+
throw new JwksKeyNotFoundError(header?.kid, { cause: err });
|
|
1599
|
+
}
|
|
1600
|
+
if (err instanceof jose.errors.JWKSTimeout || err instanceof jose.errors.JWKSInvalid || err instanceof jose.errors.JOSEError) {
|
|
1601
|
+
throw new JwksFetchError(
|
|
1602
|
+
`Failed to load JWKS from ${this.url.href}: ${err.message}`,
|
|
1603
|
+
{ cause: err }
|
|
1604
|
+
);
|
|
1605
|
+
}
|
|
1606
|
+
throw err;
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
/**
|
|
1610
|
+
* Force a refetch on the next verify. Useful in tests and for
|
|
1611
|
+
* external rotation drills — the normal flow self-heals because
|
|
1612
|
+
* jose auto-refetches on kid miss.
|
|
1613
|
+
*/
|
|
1614
|
+
refresh() {
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
async function verifyHeimdallToken(token, getKey, opts = {}) {
|
|
1618
|
+
try {
|
|
1619
|
+
const { payload } = await jose.jwtVerify(token, getKey, {
|
|
1620
|
+
algorithms: opts.algorithms ?? ["ES256", "RS256", "EdDSA"],
|
|
1621
|
+
issuer: opts.issuer,
|
|
1622
|
+
audience: opts.audience,
|
|
1623
|
+
clockTolerance: opts.clockTolerance ?? 5,
|
|
1624
|
+
requiredClaims: opts.requiredClaims,
|
|
1625
|
+
currentDate: opts.currentDate,
|
|
1626
|
+
maxTokenAge: opts.maxTokenAge
|
|
1627
|
+
});
|
|
1628
|
+
return payload;
|
|
1629
|
+
} catch (err) {
|
|
1630
|
+
throw translateJoseError(err);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
function translateJoseError(err) {
|
|
1634
|
+
if (err instanceof JwksKeyNotFoundError || err instanceof JwksFetchError || err instanceof JwtVerifyError) {
|
|
1635
|
+
return err;
|
|
1636
|
+
}
|
|
1637
|
+
const code = err?.code ?? "";
|
|
1638
|
+
const message = err?.message ?? "JWT verification failed";
|
|
1639
|
+
switch (code) {
|
|
1640
|
+
case "ERR_JWT_EXPIRED":
|
|
1641
|
+
return new JwtExpiredError(message, void 0, { cause: err });
|
|
1642
|
+
case "ERR_JWT_CLAIM_VALIDATION_FAILED": {
|
|
1643
|
+
const claim = err?.claim;
|
|
1644
|
+
if (claim === "iss") return new JwtIssuerMismatchError(message, { cause: err });
|
|
1645
|
+
if (claim === "aud") return new JwtAudienceMismatchError(message, { cause: err });
|
|
1646
|
+
if (claim === "nbf") return new JwtNotYetValidError(message, { cause: err });
|
|
1647
|
+
return new JwtInvalidError(message, { cause: err });
|
|
1648
|
+
}
|
|
1649
|
+
case "ERR_JWS_SIGNATURE_VERIFICATION_FAILED":
|
|
1650
|
+
case "ERR_JWS_INVALID":
|
|
1651
|
+
case "ERR_JWT_INVALID":
|
|
1652
|
+
return new JwtInvalidError(message, { cause: err });
|
|
1653
|
+
default:
|
|
1654
|
+
return new JwtInvalidError(message, { cause: err });
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
// src/scopes/consumer.ts
|
|
1659
|
+
var ConsumerScope = class {
|
|
1660
|
+
/** The appSlug bound to this scope. */
|
|
1661
|
+
appSlug;
|
|
1662
|
+
/** Default iss claim expected on tokens issued by this app's Heimdall instance. */
|
|
1663
|
+
expectedIssuer;
|
|
1664
|
+
/** Default aud claim. Undefined unless the caller sets it (skip aud check). */
|
|
1665
|
+
expectedAudience;
|
|
1666
|
+
/** jose-compatible JWKS resolver. Drop into `jose.jwtVerify`, passport-jwt, etc. */
|
|
1667
|
+
jwks;
|
|
1668
|
+
client;
|
|
1669
|
+
constructor(appSlug, internals, opts = {}) {
|
|
1670
|
+
this.appSlug = appSlug;
|
|
1671
|
+
this.client = internals.client;
|
|
1672
|
+
this.expectedIssuer = `${internals.baseUrl}/${appSlug}`;
|
|
1673
|
+
this.expectedAudience = opts.audience;
|
|
1674
|
+
this.jwks = new JwksCache({
|
|
1675
|
+
url: new URL(`/${appSlug}/v1/.well-known/jwks.json`, internals.baseUrl),
|
|
1676
|
+
ttlMs: opts.jwksTtlMs,
|
|
1677
|
+
fetch: internals.fetch
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Direct HTTP escape hatch for endpoints whose spec is buggy
|
|
1682
|
+
* (path declares `{appSlug}` but parameters[] omits it). Tracked
|
|
1683
|
+
* upstream; remove once the spec is fixed.
|
|
1684
|
+
*/
|
|
1685
|
+
async callDirect(method, url, body, params) {
|
|
1686
|
+
const res = await this.client({ method, url, data: body, params });
|
|
1687
|
+
return res.data;
|
|
1688
|
+
}
|
|
1689
|
+
/** Verify a Heimdall-issued JWT against this app's JWKS. */
|
|
1690
|
+
verifyToken(token, opts = {}) {
|
|
1691
|
+
return verifyHeimdallToken(token, this.jwks.getKey, {
|
|
1692
|
+
issuer: this.expectedIssuer,
|
|
1693
|
+
audience: this.expectedAudience,
|
|
1694
|
+
...opts
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
// ─────────────────────────────────────────────────────────────
|
|
1698
|
+
// Auth — sign-in/up flows, refresh, password reset
|
|
1699
|
+
// ─────────────────────────────────────────────────────────────
|
|
1700
|
+
auth = {
|
|
1701
|
+
signin: (data) => consumerAuthControllerSignin(
|
|
1702
|
+
{ appSlug: this.appSlug, data },
|
|
1703
|
+
{ client: this.client }
|
|
1704
|
+
),
|
|
1705
|
+
/**
|
|
1706
|
+
* Signup may require a Platform API Key when the app has
|
|
1707
|
+
* `signup_requires_pak: true`. Configure that on the Heimdall
|
|
1708
|
+
* instance (`new Heimdall({ auth: { type: "apiKey", key: "..." } })`)
|
|
1709
|
+
* — our HTTP client attaches the Authorization header automatically.
|
|
1710
|
+
*/
|
|
1711
|
+
signup: (data) => this.callDirect(
|
|
1712
|
+
"POST",
|
|
1713
|
+
`/${this.appSlug}/v1/auth/signup`,
|
|
1714
|
+
data
|
|
1715
|
+
),
|
|
1716
|
+
refresh: (data) => consumerAuthControllerRefresh(
|
|
1717
|
+
{ appSlug: this.appSlug, data },
|
|
1718
|
+
{ client: this.client }
|
|
1719
|
+
),
|
|
1720
|
+
logout: (data) => consumerAuthControllerLogout(
|
|
1721
|
+
{ appSlug: this.appSlug, data },
|
|
1722
|
+
{ client: this.client }
|
|
1723
|
+
),
|
|
1724
|
+
/**
|
|
1725
|
+
* PAK-required: caller must instantiate `Heimdall` with
|
|
1726
|
+
* `auth: { type: "apiKey", key: "pcft_live_..." }`. The
|
|
1727
|
+
* kubb-generated `headers.authorization` slot is a stub — the
|
|
1728
|
+
* HTTP client's auth middleware overrides whatever's passed.
|
|
1729
|
+
*/
|
|
1730
|
+
requestReset: (data) => consumerAuthControllerRequestPasswordReset(
|
|
1731
|
+
{ appSlug: this.appSlug, data, headers: { authorization: "" } },
|
|
1732
|
+
{ client: this.client }
|
|
1733
|
+
),
|
|
1734
|
+
resetPassword: (data) => consumerAuthControllerResetPassword(
|
|
1735
|
+
{ appSlug: this.appSlug, data },
|
|
1736
|
+
{ client: this.client }
|
|
1737
|
+
),
|
|
1738
|
+
/**
|
|
1739
|
+
* Sign in / sign up with a provider ID token (native flow).
|
|
1740
|
+
*
|
|
1741
|
+
* Submit the identity token Apple (or Google, once enabled) issued
|
|
1742
|
+
* to a native client (iOS `ASAuthorizationController`, Google
|
|
1743
|
+
* Sign-In for iOS / Android). Heimdall verifies the signature
|
|
1744
|
+
* against the provider's JWKS, pins the issuer, checks the
|
|
1745
|
+
* audience against the app's configured native client ids,
|
|
1746
|
+
* recomputes `sha256(nonce)` and compares to the token's `nonce`
|
|
1747
|
+
* claim, then resolves or creates the EndUser. Same response
|
|
1748
|
+
* shape as `auth.signin`.
|
|
1749
|
+
*
|
|
1750
|
+
* Account linking: when an EndUser already exists with a verified
|
|
1751
|
+
* primary email matching the token's `email` claim, the app's
|
|
1752
|
+
* `oauth_link_policy` decides the outcome:
|
|
1753
|
+
* - `auto` (default): silently link the identity to the existing
|
|
1754
|
+
* account (provider claims `email_verified: true` AND the email
|
|
1755
|
+
* is not an Apple private relay).
|
|
1756
|
+
* - `confirm`: refuse with 409 `link_required`. UI should sign
|
|
1757
|
+
* the user in via their original method to bind.
|
|
1758
|
+
* - `reject`: refuse with 409 `account_exists_with_different_provider`.
|
|
1759
|
+
*
|
|
1760
|
+
* Apple's private-relay emails (`*@privaterelay.appleid.com`) are
|
|
1761
|
+
* persisted as-is on the EndUser's primary email contact and
|
|
1762
|
+
* never participate in auto-link.
|
|
1763
|
+
*
|
|
1764
|
+
* Apple sends the user's display name only on the FIRST sign-in.
|
|
1765
|
+
* Pass it through `user.name` on that call — Heimdall persists it
|
|
1766
|
+
* to the EndUser row. Subsequent sign-ins should omit `user`.
|
|
1767
|
+
*/
|
|
1768
|
+
signinWithProvider: (args) => consumerIdpControllerNativeSignIn(
|
|
1769
|
+
{
|
|
1770
|
+
appSlug: this.appSlug,
|
|
1771
|
+
provider: args.provider,
|
|
1772
|
+
data: { id_token: args.id_token, nonce: args.nonce, user: args.user }
|
|
1773
|
+
},
|
|
1774
|
+
{ client: this.client }
|
|
1775
|
+
)
|
|
1776
|
+
};
|
|
1777
|
+
// ─────────────────────────────────────────────────────────────
|
|
1778
|
+
// Me — the currently-signed-in EndUser's own resources
|
|
1779
|
+
// All six endpoints currently use callDirect to work around spec
|
|
1780
|
+
// bugs in heimdall.json (appSlug missing from parameters[]).
|
|
1781
|
+
// ─────────────────────────────────────────────────────────────
|
|
1782
|
+
me = {
|
|
1783
|
+
getProfile: () => this.callDirect("GET", `/${this.appSlug}/v1/me`),
|
|
1784
|
+
updateProfile: (data) => this.callDirect("PATCH", `/${this.appSlug}/v1/me`, data),
|
|
1785
|
+
listSessions: (params = {}) => this.callDirect(
|
|
1786
|
+
"GET",
|
|
1787
|
+
`/${this.appSlug}/v1/me/sessions`,
|
|
1788
|
+
void 0,
|
|
1789
|
+
params
|
|
1790
|
+
),
|
|
1791
|
+
revokeSession: (id) => this.callDirect("DELETE", `/${this.appSlug}/v1/me/sessions/${id}`),
|
|
1792
|
+
getActivity: (params = {}) => this.callDirect(
|
|
1793
|
+
"GET",
|
|
1794
|
+
`/${this.appSlug}/v1/me/activity`,
|
|
1795
|
+
void 0,
|
|
1796
|
+
params
|
|
1797
|
+
),
|
|
1798
|
+
deleteAccount: () => this.callDirect("DELETE", `/${this.appSlug}/v1/me`)
|
|
1799
|
+
};
|
|
1800
|
+
// ─────────────────────────────────────────────────────────────
|
|
1801
|
+
// Verify — server-to-server token verification + authorization
|
|
1802
|
+
// (typically called by the customer's backend, not the user agent)
|
|
1803
|
+
// ─────────────────────────────────────────────────────────────
|
|
1804
|
+
verify = {
|
|
1805
|
+
verify: (data) => consumerVerifyControllerVerify(
|
|
1806
|
+
{ appSlug: this.appSlug, data },
|
|
1807
|
+
{ client: this.client }
|
|
1808
|
+
),
|
|
1809
|
+
authorize: (data) => consumerVerifyControllerAuthorize(
|
|
1810
|
+
{ appSlug: this.appSlug, data },
|
|
1811
|
+
{ client: this.client }
|
|
1812
|
+
),
|
|
1813
|
+
authorizeBatch: (data) => consumerVerifyControllerAuthorizeBatch(
|
|
1814
|
+
{ appSlug: this.appSlug, data },
|
|
1815
|
+
{ client: this.client }
|
|
1816
|
+
)
|
|
1817
|
+
};
|
|
1818
|
+
// ─────────────────────────────────────────────────────────────
|
|
1819
|
+
// OAuth M2M — client_credentials grant for service-to-service tokens
|
|
1820
|
+
// ─────────────────────────────────────────────────────────────
|
|
1821
|
+
oauth = {
|
|
1822
|
+
clientCredentials: (data) => consumerOAuthControllerClientCredentials(
|
|
1823
|
+
{ appSlug: this.appSlug, data },
|
|
1824
|
+
{ client: this.client }
|
|
1825
|
+
)
|
|
1826
|
+
};
|
|
1827
|
+
};
|
|
1828
|
+
|
|
1829
|
+
// src/_generated/clients/apps/appControllerListMyApps.ts
|
|
1830
|
+
function getAppControllerListMyAppsUrl() {
|
|
1831
|
+
const res = { method: "GET", url: `/v1/apps` };
|
|
1832
|
+
return res;
|
|
1833
|
+
}
|
|
1834
|
+
async function appControllerListMyApps({ params }, config = {}) {
|
|
1835
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1836
|
+
const mappedParams = params ? {
|
|
1837
|
+
limit: params.limit,
|
|
1838
|
+
cursor: params.cursor,
|
|
1839
|
+
workspace_id: params.workspaceId
|
|
1840
|
+
} : void 0;
|
|
1841
|
+
const res = await request({
|
|
1842
|
+
method: "GET",
|
|
1843
|
+
url: getAppControllerListMyAppsUrl().url.toString(),
|
|
1844
|
+
params: mappedParams,
|
|
1845
|
+
...requestConfig
|
|
1846
|
+
});
|
|
1847
|
+
return res.data;
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
// src/_generated/clients/apps/appControllerCreateApp.ts
|
|
1851
|
+
function getAppControllerCreateAppUrl() {
|
|
1852
|
+
const res = { method: "POST", url: `/v1/apps` };
|
|
1853
|
+
return res;
|
|
1854
|
+
}
|
|
1855
|
+
async function appControllerCreateApp({
|
|
1856
|
+
data,
|
|
1857
|
+
headers
|
|
1858
|
+
}, config = {}) {
|
|
1859
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1860
|
+
const mappedHeaders = headers ? { "Idempotency-Key": headers.idempotencyKey } : void 0;
|
|
1861
|
+
const requestData = data;
|
|
1862
|
+
const res = await request({
|
|
1863
|
+
method: "POST",
|
|
1864
|
+
url: getAppControllerCreateAppUrl().url.toString(),
|
|
1865
|
+
data: requestData,
|
|
1866
|
+
...requestConfig,
|
|
1867
|
+
headers: { ...mappedHeaders, ...requestConfig.headers }
|
|
1868
|
+
});
|
|
1869
|
+
return res.data;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
// src/_generated/clients/apps/appControllerAcceptInvite.ts
|
|
1873
|
+
function getAppControllerAcceptInviteUrl() {
|
|
1874
|
+
const res = { method: "POST", url: `/v1/apps/invites/accept` };
|
|
1875
|
+
return res;
|
|
1876
|
+
}
|
|
1877
|
+
async function appControllerAcceptInvite({ data }, config = {}) {
|
|
1878
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1879
|
+
const requestData = data;
|
|
1880
|
+
const res = await request({
|
|
1881
|
+
method: "POST",
|
|
1882
|
+
url: getAppControllerAcceptInviteUrl().url.toString(),
|
|
1883
|
+
data: requestData,
|
|
1884
|
+
...requestConfig
|
|
1885
|
+
});
|
|
1886
|
+
return res.data;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
// src/_generated/clients/platformStats/statsControllerGetMyStats.ts
|
|
1890
|
+
function getStatsControllerGetMyStatsUrl() {
|
|
1891
|
+
const res = { method: "GET", url: `/v1/stats/me` };
|
|
1892
|
+
return res;
|
|
1893
|
+
}
|
|
1894
|
+
async function statsControllerGetMyStats({ params }, config = {}) {
|
|
1895
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1896
|
+
const mappedParams = params ? { workspace_id: params.workspaceId } : void 0;
|
|
1897
|
+
const res = await request({
|
|
1898
|
+
method: "GET",
|
|
1899
|
+
url: getStatsControllerGetMyStatsUrl().url.toString(),
|
|
1900
|
+
params: mappedParams,
|
|
1901
|
+
...requestConfig
|
|
1902
|
+
});
|
|
1903
|
+
return res.data;
|
|
1904
|
+
}
|
|
4
1905
|
|
|
5
1906
|
// src/index.ts
|
|
6
1907
|
var Heimdall = class {
|
|
7
|
-
/** The underlying typed client. v0 surface — every endpoint reachable. */
|
|
8
1908
|
client;
|
|
1909
|
+
baseUrl;
|
|
1910
|
+
fetch;
|
|
1911
|
+
jwtConfig;
|
|
9
1912
|
constructor(config = {}) {
|
|
10
|
-
this.
|
|
1913
|
+
this.baseUrl = config.baseUrl ?? core.PC_BASE_URL.heimdall;
|
|
1914
|
+
this.fetch = config.fetch;
|
|
1915
|
+
this.client = makeHeimdallHttpClient({
|
|
1916
|
+
baseUrl: this.baseUrl,
|
|
1917
|
+
auth: config.auth,
|
|
1918
|
+
fetch: this.fetch
|
|
1919
|
+
});
|
|
1920
|
+
this.jwtConfig = {
|
|
1921
|
+
audience: config.expectedAudience,
|
|
1922
|
+
jwksTtlMs: config.jwksTtlMs
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Returns an `AppScope` bound to the given appId. All operations under
|
|
1927
|
+
* `/v1/apps/{appId}/...` are exposed as resource namespaces on the
|
|
1928
|
+
* returned object.
|
|
1929
|
+
*/
|
|
1930
|
+
app(appId) {
|
|
1931
|
+
return new AppScope(appId, this.client);
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* Returns a `ConsumerScope` bound to the given appSlug. Exposes the
|
|
1935
|
+
* `/{appSlug}/v1/...` surface (sign-in, sign-up, me, verify, oauth)
|
|
1936
|
+
* and the JWT-verify helper for tokens issued by this app.
|
|
1937
|
+
*/
|
|
1938
|
+
consumer(appSlug) {
|
|
1939
|
+
return new ConsumerScope(
|
|
1940
|
+
appSlug,
|
|
1941
|
+
{ client: this.client, baseUrl: this.baseUrl, fetch: this.fetch },
|
|
1942
|
+
this.jwtConfig
|
|
1943
|
+
);
|
|
11
1944
|
}
|
|
1945
|
+
// ─────────────────────────────────────────────────────────────
|
|
1946
|
+
// Workspace-wide apps surface
|
|
1947
|
+
// (other admin operations are under `app(appId).*` once an app exists)
|
|
1948
|
+
// ─────────────────────────────────────────────────────────────
|
|
1949
|
+
apps = {
|
|
1950
|
+
/** List apps the caller's workspace can see. */
|
|
1951
|
+
list: (params = {}) => appControllerListMyApps(
|
|
1952
|
+
{ params },
|
|
1953
|
+
{ client: this.client }
|
|
1954
|
+
),
|
|
1955
|
+
/** Create a new app under the caller's workspace. */
|
|
1956
|
+
create: (data) => appControllerCreateApp({ data }, { client: this.client }),
|
|
1957
|
+
/** Accept a workspace invite to join an existing app. */
|
|
1958
|
+
acceptInvite: (data) => appControllerAcceptInvite({ data }, { client: this.client })
|
|
1959
|
+
};
|
|
1960
|
+
// ─────────────────────────────────────────────────────────────
|
|
1961
|
+
// Platform stats
|
|
1962
|
+
//
|
|
1963
|
+
// Workspace-level IdP admin (`/v1/idp/*`) was removed from the API
|
|
1964
|
+
// when consumer-side OAuth moved to per-app `auth_config_provider`
|
|
1965
|
+
// rows. Configure providers via the per-app auth-config endpoints
|
|
1966
|
+
// (`app(appId).authConfig.*`) and consume them client-side through
|
|
1967
|
+
// `consumer(slug).auth.signinWithProvider({ ... })`.
|
|
1968
|
+
// ─────────────────────────────────────────────────────────────
|
|
1969
|
+
stats = {
|
|
1970
|
+
/**
|
|
1971
|
+
* Get the signed-in PlatformUser's aggregate counts. Pass
|
|
1972
|
+
* `workspaceId` to scope to a single workspace; omit to total
|
|
1973
|
+
* across every workspace the caller belongs to.
|
|
1974
|
+
*/
|
|
1975
|
+
get: (params = {}) => statsControllerGetMyStats(
|
|
1976
|
+
{ params },
|
|
1977
|
+
{ client: this.client }
|
|
1978
|
+
)
|
|
1979
|
+
};
|
|
12
1980
|
};
|
|
13
1981
|
|
|
1982
|
+
exports.AppScope = AppScope;
|
|
1983
|
+
exports.ConsumerScope = ConsumerScope;
|
|
14
1984
|
exports.Heimdall = Heimdall;
|
|
1985
|
+
exports.HeimdallHttpError = HeimdallHttpError;
|
|
1986
|
+
exports.JwksCache = JwksCache;
|
|
1987
|
+
exports.JwksFetchError = JwksFetchError;
|
|
1988
|
+
exports.JwksKeyNotFoundError = JwksKeyNotFoundError;
|
|
1989
|
+
exports.JwtAudienceMismatchError = JwtAudienceMismatchError;
|
|
1990
|
+
exports.JwtExpiredError = JwtExpiredError;
|
|
1991
|
+
exports.JwtInvalidError = JwtInvalidError;
|
|
1992
|
+
exports.JwtIssuerMismatchError = JwtIssuerMismatchError;
|
|
1993
|
+
exports.JwtNotYetValidError = JwtNotYetValidError;
|
|
1994
|
+
exports.JwtVerifyError = JwtVerifyError;
|
|
1995
|
+
exports.verifyHeimdallToken = verifyHeimdallToken;
|
|
15
1996
|
//# sourceMappingURL=index.cjs.map
|
|
16
1997
|
//# sourceMappingURL=index.cjs.map
|