@azerothian/infisical 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/dist/index.js ADDED
@@ -0,0 +1,2839 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ AdminResource: () => AdminResource,
34
+ AppConnectionsResource: () => AppConnectionsResource,
35
+ AuthManager: () => AuthManager,
36
+ AuthMethod: () => AuthMethod,
37
+ AuthState: () => AuthState,
38
+ AuthenticationError: () => AuthenticationError,
39
+ BadRequestError: () => BadRequestError,
40
+ CaType: () => CaType,
41
+ CertExtendedKeyUsage: () => CertExtendedKeyUsage,
42
+ CertKeyUsage: () => CertKeyUsage,
43
+ ForbiddenError: () => ForbiddenError,
44
+ HttpClient: () => HttpClient,
45
+ IdentitiesResource: () => IdentitiesResource,
46
+ IdentityAccessTokensResource: () => IdentityAccessTokensResource,
47
+ IdentityAlicloudAuthResource: () => IdentityAlicloudAuthResource,
48
+ IdentityAwsAuthResource: () => IdentityAwsAuthResource,
49
+ IdentityAzureAuthResource: () => IdentityAzureAuthResource,
50
+ IdentityGcpAuthResource: () => IdentityGcpAuthResource,
51
+ IdentityJwtAuthResource: () => IdentityJwtAuthResource,
52
+ IdentityKubernetesAuthResource: () => IdentityKubernetesAuthResource,
53
+ IdentityLdapAuthResource: () => IdentityLdapAuthResource,
54
+ IdentityOciAuthResource: () => IdentityOciAuthResource,
55
+ IdentityOidcAuthResource: () => IdentityOidcAuthResource,
56
+ IdentityTlsCertAuthResource: () => IdentityTlsCertAuthResource,
57
+ IdentityTokenAuthResource: () => IdentityTokenAuthResource,
58
+ IdentityUniversalAuthResource: () => IdentityUniversalAuthResource,
59
+ InfisicalApiError: () => InfisicalApiError,
60
+ InfisicalClient: () => InfisicalClient,
61
+ InfisicalNetworkError: () => InfisicalNetworkError,
62
+ IntegrationAuthResource: () => IntegrationAuthResource,
63
+ InternalServerError: () => InternalServerError,
64
+ JwtSignatureAlgorithm: () => JwtSignatureAlgorithm,
65
+ KmsResource: () => KmsResource,
66
+ MfaMethod: () => MfaMethod,
67
+ MfaResource: () => MfaResource,
68
+ MfaSessionStatus: () => MfaSessionStatus,
69
+ MfaSessionsResource: () => MfaSessionsResource,
70
+ NotFoundError: () => NotFoundError,
71
+ OrderByDirection: () => OrderByDirection,
72
+ OrgAdminResource: () => OrgAdminResource,
73
+ OrgIdentityOrderBy: () => OrgIdentityOrderBy,
74
+ OrgMembershipStatus: () => OrgMembershipStatus,
75
+ OrganizationIdentitiesResource: () => OrganizationIdentitiesResource,
76
+ OrganizationsResource: () => OrganizationsResource,
77
+ PasswordResource: () => PasswordResource,
78
+ PkiAlertChannelType: () => PkiAlertChannelType,
79
+ PkiAlertEventType: () => PkiAlertEventType,
80
+ PkiAlertsResource: () => PkiAlertsResource,
81
+ PkiCaResource: () => PkiCaResource,
82
+ PkiCertificatesResource: () => PkiCertificatesResource,
83
+ PkiTemplatesResource: () => PkiTemplatesResource,
84
+ ProjectsResource: () => ProjectsResource,
85
+ RESOURCE_AUTH_MODES: () => RESOURCE_AUTH_MODES,
86
+ RateLimitError: () => RateLimitError,
87
+ SecretFoldersResource: () => SecretFoldersResource,
88
+ SecretImportsResource: () => SecretImportsResource,
89
+ SecretSharingResource: () => SecretSharingResource,
90
+ SecretSyncsResource: () => SecretSyncsResource,
91
+ SecretTagsResource: () => SecretTagsResource,
92
+ SecretsResource: () => SecretsResource,
93
+ ServiceTokensResource: () => ServiceTokensResource,
94
+ UnauthorizedError: () => UnauthorizedError,
95
+ UsersResource: () => UsersResource,
96
+ ValidationError: () => ValidationError,
97
+ WebhooksResource: () => WebhooksResource
98
+ });
99
+ module.exports = __toCommonJS(index_exports);
100
+
101
+ // src/errors.ts
102
+ var InfisicalApiError = class extends Error {
103
+ statusCode;
104
+ requestId;
105
+ errorType;
106
+ details;
107
+ constructor(message, options) {
108
+ super(message);
109
+ this.name = "InfisicalApiError";
110
+ this.statusCode = options.statusCode;
111
+ this.requestId = options.requestId;
112
+ this.errorType = options.errorType;
113
+ this.details = options.details;
114
+ }
115
+ };
116
+ var BadRequestError = class extends InfisicalApiError {
117
+ constructor(message, options) {
118
+ super(message, { statusCode: 400, ...options });
119
+ this.name = "BadRequestError";
120
+ }
121
+ };
122
+ var UnauthorizedError = class extends InfisicalApiError {
123
+ constructor(message, options) {
124
+ super(message, { statusCode: 401, ...options });
125
+ this.name = "UnauthorizedError";
126
+ }
127
+ };
128
+ var ForbiddenError = class extends InfisicalApiError {
129
+ constructor(message, options) {
130
+ super(message, { statusCode: 403, ...options });
131
+ this.name = "ForbiddenError";
132
+ }
133
+ };
134
+ var NotFoundError = class extends InfisicalApiError {
135
+ constructor(message, options) {
136
+ super(message, { statusCode: 404, ...options });
137
+ this.name = "NotFoundError";
138
+ }
139
+ };
140
+ var ValidationError = class extends InfisicalApiError {
141
+ constructor(message, options) {
142
+ super(message, { statusCode: 422, ...options });
143
+ this.name = "ValidationError";
144
+ }
145
+ };
146
+ var RateLimitError = class extends InfisicalApiError {
147
+ constructor(message, options) {
148
+ super(message, { statusCode: 429, ...options });
149
+ this.name = "RateLimitError";
150
+ }
151
+ };
152
+ var InternalServerError = class extends InfisicalApiError {
153
+ constructor(message, options) {
154
+ super(message, { statusCode: 500, ...options });
155
+ this.name = "InternalServerError";
156
+ }
157
+ };
158
+ var AuthenticationError = class extends Error {
159
+ currentMode;
160
+ allowedModes;
161
+ constructor(message, options) {
162
+ super(message);
163
+ this.name = "AuthenticationError";
164
+ this.currentMode = options.currentMode;
165
+ this.allowedModes = options.allowedModes;
166
+ }
167
+ };
168
+ var InfisicalNetworkError = class extends Error {
169
+ cause;
170
+ constructor(message, options) {
171
+ super(message);
172
+ this.name = "InfisicalNetworkError";
173
+ this.cause = options?.cause;
174
+ }
175
+ };
176
+
177
+ // src/http.ts
178
+ function buildQueryString(params) {
179
+ if (!params) return "";
180
+ const entries = [];
181
+ for (const [key, value] of Object.entries(params)) {
182
+ if (value === void 0 || value === null) continue;
183
+ if (Array.isArray(value)) {
184
+ for (const item of value) {
185
+ entries.push(
186
+ `${encodeURIComponent(key)}=${encodeURIComponent(String(item))}`
187
+ );
188
+ }
189
+ } else {
190
+ entries.push(
191
+ `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`
192
+ );
193
+ }
194
+ }
195
+ return entries.length > 0 ? `?${entries.join("&")}` : "";
196
+ }
197
+ function getAuthHeader(auth) {
198
+ switch (auth.mode) {
199
+ case "jwt":
200
+ return { Authorization: `Bearer ${auth.token}` };
201
+ case "apiKey":
202
+ return { "X-API-KEY": auth.apiKey };
203
+ case "serviceToken":
204
+ return { Authorization: `Bearer ${auth.serviceToken}` };
205
+ case "identityAccessToken":
206
+ return { Authorization: `Bearer ${auth.accessToken}` };
207
+ }
208
+ }
209
+ function createApiError(statusCode, body, requestId) {
210
+ const message = body?.["message"] ?? body?.["error"] ?? `Request failed with status ${statusCode}`;
211
+ const opts = {
212
+ requestId,
213
+ errorType: body?.["type"],
214
+ details: body?.["details"] ?? body
215
+ };
216
+ switch (statusCode) {
217
+ case 400:
218
+ return new BadRequestError(message, opts);
219
+ case 401:
220
+ return new UnauthorizedError(message, opts);
221
+ case 403:
222
+ return new ForbiddenError(message, opts);
223
+ case 404:
224
+ return new NotFoundError(message, opts);
225
+ case 422:
226
+ return new ValidationError(message, opts);
227
+ case 429:
228
+ return new RateLimitError(message, opts);
229
+ case 500:
230
+ return new InternalServerError(message, opts);
231
+ default:
232
+ return new InfisicalApiError(message, { statusCode, ...opts });
233
+ }
234
+ }
235
+ function isAbortError(error) {
236
+ return error instanceof Error && (error.name === "AbortError" || typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError");
237
+ }
238
+ var HttpClient = class {
239
+ config;
240
+ constructor(config) {
241
+ this.config = config;
242
+ }
243
+ async request(method, path, options) {
244
+ if (!options?.skipAuth) {
245
+ await this.config.authState.ensureValid();
246
+ }
247
+ const prefix = path.startsWith("/api/") ? "" : "/api/v2";
248
+ const url = `${this.config.baseUrl}${prefix}${path}${buildQueryString(options?.query)}`;
249
+ const controller = new AbortController();
250
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
251
+ const headers = {
252
+ "Content-Type": "application/json",
253
+ Accept: "application/json",
254
+ ...!options?.skipAuth && this.config.authState.current ? getAuthHeader(this.config.authState.current) : {},
255
+ ...this.config.headers,
256
+ ...options?.headers
257
+ };
258
+ let response;
259
+ try {
260
+ response = await this.config.fetch(url, {
261
+ method,
262
+ headers,
263
+ body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
264
+ signal: controller.signal
265
+ });
266
+ } catch (error) {
267
+ if (isAbortError(error)) {
268
+ throw new InfisicalNetworkError(
269
+ `Request timed out after ${this.config.timeout}ms`,
270
+ { cause: error }
271
+ );
272
+ }
273
+ throw new InfisicalNetworkError("Network request failed", {
274
+ cause: error instanceof Error ? error : new Error(String(error))
275
+ });
276
+ } finally {
277
+ clearTimeout(timeoutId);
278
+ }
279
+ const requestId = response.headers.get("x-request-id") ?? void 0;
280
+ if (!response.ok) {
281
+ if (response.status === 401 && !options?.skipAuth && this.config.authState.canRenew) {
282
+ await this.config.authState.forceRenew();
283
+ const retryHeaders = {
284
+ "Content-Type": "application/json",
285
+ Accept: "application/json",
286
+ ...this.config.authState.current ? getAuthHeader(this.config.authState.current) : {},
287
+ ...this.config.headers,
288
+ ...options?.headers
289
+ };
290
+ const retryController = new AbortController();
291
+ const retryTimeoutId = setTimeout(
292
+ () => retryController.abort(),
293
+ this.config.timeout
294
+ );
295
+ let retryResponse;
296
+ try {
297
+ retryResponse = await this.config.fetch(url, {
298
+ method,
299
+ headers: retryHeaders,
300
+ body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
301
+ signal: retryController.signal
302
+ });
303
+ } catch (error) {
304
+ if (isAbortError(error)) {
305
+ throw new InfisicalNetworkError(
306
+ `Request timed out after ${this.config.timeout}ms`,
307
+ { cause: error }
308
+ );
309
+ }
310
+ throw new InfisicalNetworkError("Network request failed", {
311
+ cause: error instanceof Error ? error : new Error(String(error))
312
+ });
313
+ } finally {
314
+ clearTimeout(retryTimeoutId);
315
+ }
316
+ const retryRequestId = retryResponse.headers.get("x-request-id") ?? void 0;
317
+ if (!retryResponse.ok) {
318
+ let retryBody = null;
319
+ try {
320
+ retryBody = await retryResponse.json();
321
+ } catch {
322
+ const text2 = await retryResponse.text().catch(() => "Unknown error");
323
+ retryBody = { message: text2 };
324
+ }
325
+ throw createApiError(retryResponse.status, retryBody, retryRequestId);
326
+ }
327
+ if (retryResponse.status === 204) {
328
+ return void 0;
329
+ }
330
+ const retryText = await retryResponse.text();
331
+ if (!retryText) return void 0;
332
+ return JSON.parse(retryText);
333
+ }
334
+ let body = null;
335
+ try {
336
+ body = await response.json();
337
+ } catch {
338
+ const text2 = await response.text().catch(() => "Unknown error");
339
+ body = { message: text2 };
340
+ }
341
+ throw createApiError(response.status, body, requestId);
342
+ }
343
+ if (response.status === 204) {
344
+ return void 0;
345
+ }
346
+ const text = await response.text();
347
+ if (!text) return void 0;
348
+ return JSON.parse(text);
349
+ }
350
+ async get(path, query) {
351
+ return this.request("GET", path, { query });
352
+ }
353
+ async post(path, body, query) {
354
+ return this.request("POST", path, { body, query });
355
+ }
356
+ async postNoAuth(path, body, query) {
357
+ return this.request("POST", path, { body, query, skipAuth: true });
358
+ }
359
+ async put(path, body, query) {
360
+ return this.request("PUT", path, { body, query });
361
+ }
362
+ async patch(path, body, query) {
363
+ return this.request("PATCH", path, { body, query });
364
+ }
365
+ async delete(path, body, query) {
366
+ return this.request("DELETE", path, { body, query });
367
+ }
368
+ };
369
+
370
+ // src/client.ts
371
+ var import_cross_fetch = __toESM(require("cross-fetch"));
372
+
373
+ // src/auth-state.ts
374
+ var AuthState = class {
375
+ _auth = null;
376
+ _expiresAt = null;
377
+ _renewFn = null;
378
+ _renewPromise = null;
379
+ setAuth(auth, expiresIn) {
380
+ this._auth = auth;
381
+ this._expiresAt = expiresIn != null ? Date.now() + expiresIn * 1e3 : null;
382
+ }
383
+ clearAuth() {
384
+ this._auth = null;
385
+ this._expiresAt = null;
386
+ this._renewFn = null;
387
+ this._renewPromise = null;
388
+ }
389
+ setRenewFn(fn) {
390
+ this._renewFn = fn;
391
+ }
392
+ get current() {
393
+ return this._auth;
394
+ }
395
+ get isAuthenticated() {
396
+ return this._auth !== null;
397
+ }
398
+ get mode() {
399
+ return this._auth?.mode ?? null;
400
+ }
401
+ get canRenew() {
402
+ return this._renewFn !== null;
403
+ }
404
+ async forceRenew() {
405
+ if (!this._renewFn) return;
406
+ if (this._renewPromise) {
407
+ await this._renewPromise;
408
+ return;
409
+ }
410
+ this._renewPromise = this._renew();
411
+ try {
412
+ await this._renewPromise;
413
+ } finally {
414
+ this._renewPromise = null;
415
+ }
416
+ }
417
+ async ensureValid() {
418
+ if (!this._auth) return;
419
+ if (this._expiresAt === null || this._renewFn === null) return;
420
+ if (Date.now() >= this._expiresAt - 3e4) {
421
+ if (this._renewPromise) {
422
+ await this._renewPromise;
423
+ return;
424
+ }
425
+ this._renewPromise = this._renew();
426
+ try {
427
+ await this._renewPromise;
428
+ } finally {
429
+ this._renewPromise = null;
430
+ }
431
+ }
432
+ }
433
+ async _renew() {
434
+ const result = await this._renewFn();
435
+ this.setAuth(result.auth, result.expiresIn);
436
+ }
437
+ };
438
+
439
+ // src/auth-manager.ts
440
+ var AuthManager = class {
441
+ authState;
442
+ resources;
443
+ constructor(authState, resources) {
444
+ this.authState = authState;
445
+ this.resources = resources;
446
+ }
447
+ async login(params) {
448
+ const resolvedParams = typeof params === "function" ? await params() : params;
449
+ const loginFn = this.resolveLoginFn(resolvedParams);
450
+ const response = await loginFn();
451
+ this.authState.setAuth(
452
+ { mode: "identityAccessToken", accessToken: response.accessToken },
453
+ response.expiresIn
454
+ );
455
+ this.authState.setRenewFn(async () => {
456
+ const renewParams = typeof params === "function" ? await params() : params;
457
+ const response2 = await this.resolveLoginFn(renewParams)();
458
+ return {
459
+ auth: { mode: "identityAccessToken", accessToken: response2.accessToken },
460
+ expiresIn: response2.expiresIn
461
+ };
462
+ });
463
+ return response;
464
+ }
465
+ resolveLoginFn(params) {
466
+ if ("universalAuth" in params) {
467
+ return () => this.resources.universal.login(params.universalAuth);
468
+ }
469
+ if ("tokenAuth" in params) {
470
+ return () => this.resources.token.login(params.tokenAuth);
471
+ }
472
+ if ("awsAuth" in params) {
473
+ return () => this.resources.aws.login(params.awsAuth);
474
+ }
475
+ if ("gcpAuth" in params) {
476
+ return () => this.resources.gcp.login(params.gcpAuth);
477
+ }
478
+ if ("azureAuth" in params) {
479
+ return () => this.resources.azure.login(params.azureAuth);
480
+ }
481
+ if ("kubernetesAuth" in params) {
482
+ return () => this.resources.kubernetes.login(params.kubernetesAuth);
483
+ }
484
+ if ("oidcAuth" in params) {
485
+ return () => this.resources.oidc.login(params.oidcAuth);
486
+ }
487
+ if ("jwtAuth" in params) {
488
+ return () => this.resources.jwt.login(params.jwtAuth);
489
+ }
490
+ if ("ldapAuth" in params) {
491
+ return () => this.resources.ldap.login(params.ldapAuth);
492
+ }
493
+ if ("tlsCertAuth" in params) {
494
+ return () => this.resources.tlsCert.login(params.tlsCertAuth);
495
+ }
496
+ if ("ociAuth" in params) {
497
+ return () => this.resources.oci.login(params.ociAuth);
498
+ }
499
+ if ("alicloudAuth" in params) {
500
+ return () => this.resources.alicloud.login(params.alicloudAuth);
501
+ }
502
+ throw new Error("Invalid login params: no recognized auth method key");
503
+ }
504
+ };
505
+
506
+ // src/types/auth-modes.ts
507
+ var RESOURCE_AUTH_MODES = {
508
+ secrets: ["jwt", "serviceToken", "identityAccessToken"],
509
+ secretFolders: ["jwt", "serviceToken", "identityAccessToken"],
510
+ secretImports: ["jwt", "serviceToken", "identityAccessToken"],
511
+ projects: ["jwt", "identityAccessToken"],
512
+ organizations: ["jwt", "identityAccessToken"],
513
+ organizationIdentities: ["jwt", "identityAccessToken"],
514
+ identities: ["jwt", "identityAccessToken"],
515
+ identityAuth: ["jwt", "identityAccessToken"],
516
+ identityAccessTokens: ["jwt", "identityAccessToken"],
517
+ pki: ["jwt", "identityAccessToken"],
518
+ kms: ["jwt", "identityAccessToken"],
519
+ secretTags: ["jwt", "identityAccessToken"],
520
+ appConnections: ["jwt", "identityAccessToken"],
521
+ secretSyncs: ["jwt", "identityAccessToken"],
522
+ integrationAuth: ["jwt", "identityAccessToken"],
523
+ admin: ["jwt"],
524
+ orgAdmin: ["jwt"],
525
+ secretSharing: ["jwt"],
526
+ webhooks: ["jwt"],
527
+ users: ["jwt"],
528
+ mfa: ["jwt"],
529
+ mfaSessions: ["jwt"],
530
+ serviceTokens: ["jwt"],
531
+ password: ["jwt"]
532
+ };
533
+
534
+ // src/resources/base.ts
535
+ var BaseResource = class {
536
+ http;
537
+ authState;
538
+ authCategory;
539
+ constructor(http, authState, authCategory) {
540
+ this.http = http;
541
+ this.authState = authState;
542
+ this.authCategory = authCategory;
543
+ }
544
+ requireAuth() {
545
+ const mode = this.authState.mode;
546
+ if (!mode) {
547
+ throw new AuthenticationError(
548
+ "Not authenticated. Call client.login() first.",
549
+ { currentMode: null, allowedModes: RESOURCE_AUTH_MODES[this.authCategory] }
550
+ );
551
+ }
552
+ const allowed = RESOURCE_AUTH_MODES[this.authCategory];
553
+ if (!allowed.includes(mode)) {
554
+ throw new AuthenticationError(
555
+ `Auth mode "${mode}" is not allowed for ${this.authCategory}. Allowed modes: ${allowed.join(", ")}`,
556
+ { currentMode: mode, allowedModes: allowed }
557
+ );
558
+ }
559
+ }
560
+ };
561
+
562
+ // src/resources/mfa.ts
563
+ var MfaResource = class extends BaseResource {
564
+ constructor(http, authState) {
565
+ super(http, authState, "mfa");
566
+ }
567
+ async resendToken() {
568
+ this.requireAuth();
569
+ return this.http.post("/auth/mfa/send");
570
+ }
571
+ async checkTotp() {
572
+ this.requireAuth();
573
+ return this.http.get("/auth/mfa/check/totp");
574
+ }
575
+ async checkWebAuthn() {
576
+ this.requireAuth();
577
+ return this.http.get("/auth/mfa/check/webauthn");
578
+ }
579
+ async verify(params) {
580
+ this.requireAuth();
581
+ return this.http.post("/auth/mfa/verify", params);
582
+ }
583
+ async verifyRecoveryCode(params) {
584
+ this.requireAuth();
585
+ return this.http.post(
586
+ "/auth/mfa/verify/recovery-code",
587
+ params
588
+ );
589
+ }
590
+ };
591
+
592
+ // src/resources/mfa-sessions.ts
593
+ var MfaSessionsResource = class extends BaseResource {
594
+ constructor(http, authState) {
595
+ super(http, authState, "mfaSessions");
596
+ }
597
+ async verify(params) {
598
+ this.requireAuth();
599
+ const { mfaSessionId, ...body } = params;
600
+ return this.http.post(
601
+ `/mfa-sessions/${encodeURIComponent(mfaSessionId)}/verify`,
602
+ body
603
+ );
604
+ }
605
+ async getStatus(params) {
606
+ this.requireAuth();
607
+ return this.http.get(
608
+ `/mfa-sessions/${encodeURIComponent(params.mfaSessionId)}/status`
609
+ );
610
+ }
611
+ };
612
+
613
+ // src/resources/users.ts
614
+ var UsersResource = class extends BaseResource {
615
+ constructor(http, authState) {
616
+ super(http, authState, "users");
617
+ }
618
+ async sendEmailVerificationCode(params) {
619
+ this.requireAuth();
620
+ await this.http.post("/users/me/emails/code", params);
621
+ }
622
+ async verifyEmailVerificationCode(params) {
623
+ this.requireAuth();
624
+ await this.http.post("/users/me/emails/verify", params);
625
+ }
626
+ async updateMfa(params) {
627
+ this.requireAuth();
628
+ return this.http.patch("/users/me/mfa", params);
629
+ }
630
+ async updateName(params) {
631
+ this.requireAuth();
632
+ return this.http.patch("/users/me/name", params);
633
+ }
634
+ async updateAuthMethods(params) {
635
+ this.requireAuth();
636
+ return this.http.put(
637
+ "/users/me/auth-methods",
638
+ params
639
+ );
640
+ }
641
+ async requestEmailChangeOtp(params) {
642
+ this.requireAuth();
643
+ return this.http.post(
644
+ "/users/me/email-change/otp",
645
+ params
646
+ );
647
+ }
648
+ async updateEmail(params) {
649
+ this.requireAuth();
650
+ return this.http.patch("/users/me/email", params);
651
+ }
652
+ async listOrganizations() {
653
+ this.requireAuth();
654
+ return this.http.get(
655
+ "/users/me/organizations"
656
+ );
657
+ }
658
+ async listApiKeys() {
659
+ this.requireAuth();
660
+ return this.http.get("/users/me/api-keys");
661
+ }
662
+ async createApiKey(params) {
663
+ this.requireAuth();
664
+ return this.http.post("/users/me/api-keys", params);
665
+ }
666
+ async deleteApiKey(apiKeyDataId) {
667
+ this.requireAuth();
668
+ return this.http.delete(
669
+ `/users/me/api-keys/${encodeURIComponent(apiKeyDataId)}`
670
+ );
671
+ }
672
+ async listSessions() {
673
+ this.requireAuth();
674
+ return this.http.get("/users/me/sessions");
675
+ }
676
+ async revokeAllSessions() {
677
+ this.requireAuth();
678
+ return this.http.delete("/users/me/sessions");
679
+ }
680
+ async revokeSession(sessionId) {
681
+ this.requireAuth();
682
+ return this.http.delete(
683
+ `/users/me/sessions/${encodeURIComponent(sessionId)}`
684
+ );
685
+ }
686
+ async getMe() {
687
+ this.requireAuth();
688
+ return this.http.get("/users/me");
689
+ }
690
+ async deleteMe() {
691
+ this.requireAuth();
692
+ return this.http.delete("/users/me");
693
+ }
694
+ };
695
+
696
+ // src/resources/password.ts
697
+ var PasswordResource = class extends BaseResource {
698
+ constructor(http, authState) {
699
+ super(http, authState, "password");
700
+ }
701
+ async reset(params) {
702
+ this.requireAuth();
703
+ await this.http.post("/password/password-reset", params);
704
+ }
705
+ async resetAuthenticated(params) {
706
+ this.requireAuth();
707
+ await this.http.post("/password/user/password-reset", params);
708
+ }
709
+ };
710
+
711
+ // src/resources/service-tokens.ts
712
+ var ServiceTokensResource = class extends BaseResource {
713
+ constructor(http, authState) {
714
+ super(http, authState, "serviceTokens");
715
+ }
716
+ async get() {
717
+ this.requireAuth();
718
+ return this.http.get("/service-token");
719
+ }
720
+ async create(params) {
721
+ this.requireAuth();
722
+ return this.http.post(
723
+ "/service-token",
724
+ params
725
+ );
726
+ }
727
+ async delete(serviceTokenId) {
728
+ this.requireAuth();
729
+ return this.http.delete(
730
+ `/service-token/${encodeURIComponent(serviceTokenId)}`
731
+ );
732
+ }
733
+ };
734
+
735
+ // src/resources/organizations.ts
736
+ var OrganizationsResource = class extends BaseResource {
737
+ constructor(http, authState) {
738
+ super(http, authState, "organizations");
739
+ }
740
+ async list() {
741
+ this.requireAuth();
742
+ return this.http.get("/api/v1/organization");
743
+ }
744
+ async listMemberships(params) {
745
+ this.requireAuth();
746
+ return this.http.get(
747
+ `/organizations/${encodeURIComponent(params.orgId)}/memberships`
748
+ );
749
+ }
750
+ async listProjects(params) {
751
+ this.requireAuth();
752
+ return this.http.get(
753
+ `/organizations/${encodeURIComponent(params.orgId)}/workspaces`
754
+ );
755
+ }
756
+ async getMembership(params) {
757
+ this.requireAuth();
758
+ return this.http.get(
759
+ `/organizations/${encodeURIComponent(params.orgId)}/memberships/${encodeURIComponent(params.membershipId)}`
760
+ );
761
+ }
762
+ async updateMembership(params) {
763
+ this.requireAuth();
764
+ const { orgId, membershipId, ...body } = params;
765
+ return this.http.patch(
766
+ `/organizations/${encodeURIComponent(orgId)}/memberships/${encodeURIComponent(membershipId)}`,
767
+ body
768
+ );
769
+ }
770
+ async deleteMembership(params) {
771
+ this.requireAuth();
772
+ return this.http.delete(
773
+ `/organizations/${encodeURIComponent(params.orgId)}/memberships/${encodeURIComponent(params.membershipId)}`
774
+ );
775
+ }
776
+ async bulkDeleteMemberships(params) {
777
+ this.requireAuth();
778
+ const { orgId, ...body } = params;
779
+ return this.http.delete(
780
+ `/organizations/${encodeURIComponent(orgId)}/memberships`,
781
+ body
782
+ );
783
+ }
784
+ async listProjectMembershipsByOrgMembership(params) {
785
+ this.requireAuth();
786
+ return this.http.get(
787
+ `/organizations/${encodeURIComponent(params.orgId)}/memberships/${encodeURIComponent(params.membershipId)}/project-memberships`
788
+ );
789
+ }
790
+ async create(params) {
791
+ this.requireAuth();
792
+ return this.http.post(
793
+ "/organizations",
794
+ params
795
+ );
796
+ }
797
+ async delete(params) {
798
+ this.requireAuth();
799
+ return this.http.delete(
800
+ `/organizations/${encodeURIComponent(params.orgId)}`
801
+ );
802
+ }
803
+ async upgradePrivilegeSystem() {
804
+ this.requireAuth();
805
+ return this.http.post(
806
+ "/organizations/privilege-system-upgrade"
807
+ );
808
+ }
809
+ };
810
+
811
+ // src/resources/organization-identities.ts
812
+ var OrganizationIdentitiesResource = class extends BaseResource {
813
+ constructor(http, authState) {
814
+ super(http, authState, "organizationIdentities");
815
+ }
816
+ async list(params) {
817
+ this.requireAuth();
818
+ const { orgId, ...query } = params;
819
+ return this.http.get(
820
+ `/organizations/${encodeURIComponent(orgId)}/identity-memberships`,
821
+ { ...query }
822
+ );
823
+ }
824
+ };
825
+
826
+ // src/resources/secret-folders.ts
827
+ var SecretFoldersResource = class extends BaseResource {
828
+ constructor(http, authState) {
829
+ super(http, authState, "secretFolders");
830
+ }
831
+ async create(params) {
832
+ this.requireAuth();
833
+ return this.http.post("/folders", params);
834
+ }
835
+ async update(params) {
836
+ this.requireAuth();
837
+ const { folderId, ...body } = params;
838
+ return this.http.patch(
839
+ `/folders/${encodeURIComponent(folderId)}`,
840
+ body
841
+ );
842
+ }
843
+ async updateBatch(params) {
844
+ this.requireAuth();
845
+ return this.http.patch(
846
+ "/folders/batch",
847
+ params
848
+ );
849
+ }
850
+ async delete(params) {
851
+ this.requireAuth();
852
+ const { folderIdOrName, ...body } = params;
853
+ return this.http.delete(
854
+ `/folders/${encodeURIComponent(folderIdOrName)}`,
855
+ body
856
+ );
857
+ }
858
+ async list(params) {
859
+ this.requireAuth();
860
+ return this.http.get(
861
+ "/folders",
862
+ { ...params }
863
+ );
864
+ }
865
+ async getById(params) {
866
+ this.requireAuth();
867
+ return this.http.get(
868
+ `/folders/${encodeURIComponent(params.id)}`
869
+ );
870
+ }
871
+ };
872
+
873
+ // src/resources/secret-imports.ts
874
+ var SecretImportsResource = class extends BaseResource {
875
+ constructor(http, authState) {
876
+ super(http, authState, "secretImports");
877
+ }
878
+ async create(params) {
879
+ this.requireAuth();
880
+ return this.http.post(
881
+ "/secret-imports",
882
+ params
883
+ );
884
+ }
885
+ async update(params) {
886
+ this.requireAuth();
887
+ const { secretImportId, ...body } = params;
888
+ return this.http.patch(
889
+ `/secret-imports/${encodeURIComponent(secretImportId)}`,
890
+ body
891
+ );
892
+ }
893
+ async delete(params) {
894
+ this.requireAuth();
895
+ const { secretImportId, ...body } = params;
896
+ return this.http.delete(
897
+ `/secret-imports/${encodeURIComponent(secretImportId)}`,
898
+ body
899
+ );
900
+ }
901
+ async resyncReplication(params) {
902
+ this.requireAuth();
903
+ const { secretImportId, ...body } = params;
904
+ return this.http.post(
905
+ `/secret-imports/${encodeURIComponent(secretImportId)}/replication-resync`,
906
+ body
907
+ );
908
+ }
909
+ async list(params) {
910
+ this.requireAuth();
911
+ return this.http.get(
912
+ "/secret-imports",
913
+ { ...params }
914
+ );
915
+ }
916
+ async get(params) {
917
+ this.requireAuth();
918
+ return this.http.get(
919
+ `/secret-imports/${encodeURIComponent(params.secretImportId)}`
920
+ );
921
+ }
922
+ async getRawSecrets(params) {
923
+ this.requireAuth();
924
+ return this.http.get(
925
+ "/secret-imports/secrets",
926
+ { ...params }
927
+ );
928
+ }
929
+ };
930
+
931
+ // src/resources/pki-ca.ts
932
+ var PkiCaResource = class extends BaseResource {
933
+ constructor(http, authState) {
934
+ super(http, authState, "pki");
935
+ }
936
+ async list(params) {
937
+ this.requireAuth();
938
+ return this.http.get(
939
+ "/pki/ca",
940
+ { ...params }
941
+ );
942
+ }
943
+ async get(params) {
944
+ this.requireAuth();
945
+ return this.http.get(
946
+ `/api/v1/pki/ca/${encodeURIComponent(params.caId)}`
947
+ );
948
+ }
949
+ async create(params) {
950
+ this.requireAuth();
951
+ return this.http.post(
952
+ "/api/v1/pki/ca",
953
+ params
954
+ );
955
+ }
956
+ async update(params) {
957
+ this.requireAuth();
958
+ const { caId, ...body } = params;
959
+ return this.http.patch(
960
+ `/api/v1/pki/ca/${encodeURIComponent(caId)}`,
961
+ body
962
+ );
963
+ }
964
+ async delete(params) {
965
+ this.requireAuth();
966
+ return this.http.delete(
967
+ `/api/v1/pki/ca/${encodeURIComponent(params.caId)}`
968
+ );
969
+ }
970
+ async getCsr(params) {
971
+ this.requireAuth();
972
+ return this.http.get(
973
+ `/api/v1/pki/ca/${encodeURIComponent(params.caId)}/csr`
974
+ );
975
+ }
976
+ async getCertificate(params) {
977
+ this.requireAuth();
978
+ return this.http.get(
979
+ `/api/v1/pki/ca/${encodeURIComponent(params.caId)}/certificate`
980
+ );
981
+ }
982
+ async listCertificates(params) {
983
+ this.requireAuth();
984
+ return this.http.get(
985
+ `/api/v1/pki/ca/${encodeURIComponent(params.caId)}/ca-certificates`
986
+ );
987
+ }
988
+ async getCrls(params) {
989
+ this.requireAuth();
990
+ return this.http.get(
991
+ `/api/v1/pki/ca/${encodeURIComponent(params.caId)}/crls`
992
+ );
993
+ }
994
+ async renew(params) {
995
+ this.requireAuth();
996
+ const { caId, ...body } = params;
997
+ return this.http.post(
998
+ `/api/v1/pki/ca/${encodeURIComponent(caId)}/renew`,
999
+ body
1000
+ );
1001
+ }
1002
+ async signIntermediate(params) {
1003
+ this.requireAuth();
1004
+ const { caId, ...body } = params;
1005
+ return this.http.post(
1006
+ `/api/v1/pki/ca/${encodeURIComponent(caId)}/sign-intermediate`,
1007
+ body
1008
+ );
1009
+ }
1010
+ };
1011
+
1012
+ // src/resources/pki-templates.ts
1013
+ var PkiTemplatesResource = class extends BaseResource {
1014
+ constructor(http, authState) {
1015
+ super(http, authState, "pki");
1016
+ }
1017
+ async create(params) {
1018
+ this.requireAuth();
1019
+ return this.http.post(
1020
+ "/pki/certificate-templates",
1021
+ params
1022
+ );
1023
+ }
1024
+ async update(params) {
1025
+ this.requireAuth();
1026
+ const { templateName, ...body } = params;
1027
+ return this.http.patch(
1028
+ `/pki/certificate-templates/${encodeURIComponent(templateName)}`,
1029
+ body
1030
+ );
1031
+ }
1032
+ async delete(params) {
1033
+ this.requireAuth();
1034
+ const { templateName, ...body } = params;
1035
+ return this.http.delete(
1036
+ `/pki/certificate-templates/${encodeURIComponent(templateName)}`,
1037
+ body
1038
+ );
1039
+ }
1040
+ async get(params) {
1041
+ this.requireAuth();
1042
+ const { templateName, ...query } = params;
1043
+ return this.http.get(
1044
+ `/pki/certificate-templates/${encodeURIComponent(templateName)}`,
1045
+ { ...query }
1046
+ );
1047
+ }
1048
+ async list(params) {
1049
+ this.requireAuth();
1050
+ return this.http.get(
1051
+ "/pki/certificate-templates",
1052
+ { ...params }
1053
+ );
1054
+ }
1055
+ async issueCertificate(params) {
1056
+ this.requireAuth();
1057
+ const { templateName, ...body } = params;
1058
+ return this.http.post(
1059
+ `/pki/certificate-templates/${encodeURIComponent(templateName)}/issue-certificate`,
1060
+ body
1061
+ );
1062
+ }
1063
+ async signCertificate(params) {
1064
+ this.requireAuth();
1065
+ const { templateName, ...body } = params;
1066
+ return this.http.post(
1067
+ `/pki/certificate-templates/${encodeURIComponent(templateName)}/sign-certificate`,
1068
+ body
1069
+ );
1070
+ }
1071
+ };
1072
+
1073
+ // src/resources/pki-alerts.ts
1074
+ var PkiAlertsResource = class extends BaseResource {
1075
+ constructor(http, authState) {
1076
+ super(http, authState, "pki");
1077
+ }
1078
+ async create(params) {
1079
+ this.requireAuth();
1080
+ return this.http.post("/pki/alerts", params);
1081
+ }
1082
+ async list(params) {
1083
+ this.requireAuth();
1084
+ return this.http.get(
1085
+ "/pki/alerts",
1086
+ { ...params }
1087
+ );
1088
+ }
1089
+ async get(params) {
1090
+ this.requireAuth();
1091
+ return this.http.get(
1092
+ `/pki/alerts/${encodeURIComponent(params.alertId)}`
1093
+ );
1094
+ }
1095
+ async update(params) {
1096
+ this.requireAuth();
1097
+ const { alertId, ...body } = params;
1098
+ return this.http.patch(
1099
+ `/pki/alerts/${encodeURIComponent(alertId)}`,
1100
+ body
1101
+ );
1102
+ }
1103
+ async delete(params) {
1104
+ this.requireAuth();
1105
+ return this.http.delete(
1106
+ `/pki/alerts/${encodeURIComponent(params.alertId)}`
1107
+ );
1108
+ }
1109
+ async listCertificates(params) {
1110
+ this.requireAuth();
1111
+ const { alertId, ...query } = params;
1112
+ return this.http.get(
1113
+ `/pki/alerts/${encodeURIComponent(alertId)}/certificates`,
1114
+ { ...query }
1115
+ );
1116
+ }
1117
+ async previewCertificates(params) {
1118
+ this.requireAuth();
1119
+ return this.http.post(
1120
+ "/pki/alerts/preview/certificates",
1121
+ params
1122
+ );
1123
+ }
1124
+ };
1125
+
1126
+ // src/resources/pki-certificates.ts
1127
+ var PkiCertificatesResource = class extends BaseResource {
1128
+ constructor(http, authState) {
1129
+ super(http, authState, "pki");
1130
+ }
1131
+ async create(params) {
1132
+ this.requireAuth();
1133
+ return this.http.post(
1134
+ "/api/v1/pki/certificates",
1135
+ params
1136
+ );
1137
+ }
1138
+ async get(params) {
1139
+ this.requireAuth();
1140
+ return this.http.get(
1141
+ `/api/v1/pki/certificates/${encodeURIComponent(params.certificateId)}`
1142
+ );
1143
+ }
1144
+ async getBody(params) {
1145
+ this.requireAuth();
1146
+ return this.http.get(
1147
+ `/api/v1/pki/certificates/${encodeURIComponent(params.certificateId)}/certificate`
1148
+ );
1149
+ }
1150
+ async getBundle(params) {
1151
+ this.requireAuth();
1152
+ return this.http.get(
1153
+ `/api/v1/pki/certificates/${encodeURIComponent(params.certificateId)}/bundle`
1154
+ );
1155
+ }
1156
+ async getPrivateKey(params) {
1157
+ this.requireAuth();
1158
+ return this.http.get(
1159
+ `/api/v1/pki/certificates/${encodeURIComponent(params.certificateId)}/private-key`
1160
+ );
1161
+ }
1162
+ async renew(params) {
1163
+ this.requireAuth();
1164
+ const { certificateId, ...body } = params;
1165
+ return this.http.post(
1166
+ `/api/v1/pki/certificates/${encodeURIComponent(certificateId)}/renew`,
1167
+ body
1168
+ );
1169
+ }
1170
+ async revoke(params) {
1171
+ this.requireAuth();
1172
+ const { certificateId, ...body } = params;
1173
+ return this.http.post(
1174
+ `/api/v1/pki/certificates/${encodeURIComponent(certificateId)}/revoke`,
1175
+ body
1176
+ );
1177
+ }
1178
+ async delete(params) {
1179
+ this.requireAuth();
1180
+ return this.http.delete(
1181
+ `/api/v1/pki/certificates/${encodeURIComponent(params.certificateId)}`
1182
+ );
1183
+ }
1184
+ async updateConfig(params) {
1185
+ this.requireAuth();
1186
+ const { certificateId, ...body } = params;
1187
+ return this.http.patch(
1188
+ `/api/v1/pki/certificates/${encodeURIComponent(certificateId)}/config`,
1189
+ body
1190
+ );
1191
+ }
1192
+ };
1193
+
1194
+ // src/resources/secret-tags.ts
1195
+ var SecretTagsResource = class extends BaseResource {
1196
+ constructor(http, authState) {
1197
+ super(http, authState, "secretTags");
1198
+ }
1199
+ async list(params) {
1200
+ this.requireAuth();
1201
+ return this.http.get(
1202
+ `/api/v1/${encodeURIComponent(params.projectId)}/tags`
1203
+ );
1204
+ }
1205
+ async getById(params) {
1206
+ this.requireAuth();
1207
+ return this.http.get(
1208
+ `/api/v1/${encodeURIComponent(params.projectId)}/tags/${encodeURIComponent(params.tagId)}`
1209
+ );
1210
+ }
1211
+ async getBySlug(params) {
1212
+ this.requireAuth();
1213
+ return this.http.get(
1214
+ `/api/v1/${encodeURIComponent(params.projectId)}/tags/slug/${encodeURIComponent(params.tagSlug)}`
1215
+ );
1216
+ }
1217
+ async create(params) {
1218
+ this.requireAuth();
1219
+ const { projectId, ...body } = params;
1220
+ return this.http.post(
1221
+ `/api/v1/${encodeURIComponent(projectId)}/tags`,
1222
+ body
1223
+ );
1224
+ }
1225
+ async update(params) {
1226
+ this.requireAuth();
1227
+ const { projectId, tagId, ...body } = params;
1228
+ return this.http.patch(
1229
+ `/api/v1/${encodeURIComponent(projectId)}/tags/${encodeURIComponent(tagId)}`,
1230
+ body
1231
+ );
1232
+ }
1233
+ async delete(params) {
1234
+ this.requireAuth();
1235
+ return this.http.delete(
1236
+ `/api/v1/${encodeURIComponent(params.projectId)}/tags/${encodeURIComponent(params.tagId)}`
1237
+ );
1238
+ }
1239
+ };
1240
+
1241
+ // src/resources/identities.ts
1242
+ var IdentitiesResource = class extends BaseResource {
1243
+ constructor(http, authState) {
1244
+ super(http, authState, "identities");
1245
+ }
1246
+ async create(params) {
1247
+ this.requireAuth();
1248
+ return this.http.post(
1249
+ "/api/v1/identities",
1250
+ params
1251
+ );
1252
+ }
1253
+ async update(params) {
1254
+ this.requireAuth();
1255
+ const { identityId, ...body } = params;
1256
+ return this.http.patch(
1257
+ `/api/v1/identities/${encodeURIComponent(identityId)}`,
1258
+ body
1259
+ );
1260
+ }
1261
+ async delete(params) {
1262
+ this.requireAuth();
1263
+ return this.http.delete(
1264
+ `/api/v1/identities/${encodeURIComponent(params.identityId)}`
1265
+ );
1266
+ }
1267
+ async get(params) {
1268
+ this.requireAuth();
1269
+ return this.http.get(
1270
+ `/api/v1/identities/${encodeURIComponent(params.identityId)}`
1271
+ );
1272
+ }
1273
+ async listProjectMemberships(params) {
1274
+ this.requireAuth();
1275
+ return this.http.get(
1276
+ `/api/v1/identities/${encodeURIComponent(params.identityId)}/identity-memberships`
1277
+ );
1278
+ }
1279
+ async search(params) {
1280
+ this.requireAuth();
1281
+ const { organizationId, ...query } = params;
1282
+ return this.http.get(
1283
+ `/api/v1/organizations/${encodeURIComponent(organizationId)}/identities`,
1284
+ { ...query }
1285
+ );
1286
+ }
1287
+ };
1288
+
1289
+ // src/resources/identity-access-tokens.ts
1290
+ var IdentityAccessTokensResource = class extends BaseResource {
1291
+ constructor(http, authState) {
1292
+ super(http, authState, "identityAccessTokens");
1293
+ }
1294
+ async renew(params) {
1295
+ this.requireAuth();
1296
+ return this.http.post(
1297
+ "/api/v1/auth/token/renew",
1298
+ params
1299
+ );
1300
+ }
1301
+ async revoke(params) {
1302
+ this.requireAuth();
1303
+ return this.http.post(
1304
+ "/api/v1/auth/token/revoke",
1305
+ params
1306
+ );
1307
+ }
1308
+ };
1309
+
1310
+ // src/resources/identity-universal-auth.ts
1311
+ var IdentityUniversalAuthResource = class extends BaseResource {
1312
+ constructor(http, authState) {
1313
+ super(http, authState, "identityAuth");
1314
+ }
1315
+ async login(params) {
1316
+ return this.http.postNoAuth(
1317
+ "/api/v1/auth/universal-auth/login",
1318
+ params
1319
+ );
1320
+ }
1321
+ async attach(params) {
1322
+ this.requireAuth();
1323
+ const { identityId, ...body } = params;
1324
+ return this.http.post(
1325
+ `/api/v1/auth/universal-auth/identities/${encodeURIComponent(identityId)}`,
1326
+ body
1327
+ );
1328
+ }
1329
+ async update(params) {
1330
+ this.requireAuth();
1331
+ const { identityId, ...body } = params;
1332
+ return this.http.patch(
1333
+ `/api/v1/auth/universal-auth/identities/${encodeURIComponent(identityId)}`,
1334
+ body
1335
+ );
1336
+ }
1337
+ async get(params) {
1338
+ this.requireAuth();
1339
+ return this.http.get(
1340
+ `/api/v1/auth/universal-auth/identities/${encodeURIComponent(params.identityId)}`
1341
+ );
1342
+ }
1343
+ async revoke(params) {
1344
+ this.requireAuth();
1345
+ return this.http.delete(
1346
+ `/api/v1/auth/universal-auth/identities/${encodeURIComponent(params.identityId)}`
1347
+ );
1348
+ }
1349
+ async createClientSecret(params) {
1350
+ this.requireAuth();
1351
+ const { identityId, ...body } = params;
1352
+ return this.http.post(
1353
+ `/api/v1/auth/universal-auth/identities/${encodeURIComponent(identityId)}/client-secrets`,
1354
+ body
1355
+ );
1356
+ }
1357
+ async listClientSecrets(params) {
1358
+ this.requireAuth();
1359
+ return this.http.get(
1360
+ `/api/v1/auth/universal-auth/identities/${encodeURIComponent(params.identityId)}/client-secrets`
1361
+ );
1362
+ }
1363
+ async getClientSecret(params) {
1364
+ this.requireAuth();
1365
+ return this.http.get(
1366
+ `/api/v1/auth/universal-auth/identities/${encodeURIComponent(params.identityId)}/client-secrets/${encodeURIComponent(params.clientSecretId)}`
1367
+ );
1368
+ }
1369
+ async revokeClientSecret(params) {
1370
+ this.requireAuth();
1371
+ return this.http.delete(
1372
+ `/api/v1/auth/universal-auth/identities/${encodeURIComponent(params.identityId)}/client-secrets/${encodeURIComponent(params.clientSecretId)}`
1373
+ );
1374
+ }
1375
+ };
1376
+
1377
+ // src/resources/identity-token-auth.ts
1378
+ var IdentityTokenAuthResource = class extends BaseResource {
1379
+ constructor(http, authState) {
1380
+ super(http, authState, "identityAuth");
1381
+ }
1382
+ async login(params) {
1383
+ return this.http.postNoAuth(
1384
+ "/api/v1/auth/token/login",
1385
+ params
1386
+ );
1387
+ }
1388
+ async attach(params) {
1389
+ this.requireAuth();
1390
+ const { identityId, ...body } = params;
1391
+ return this.http.post(
1392
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(identityId)}`,
1393
+ body
1394
+ );
1395
+ }
1396
+ async update(params) {
1397
+ this.requireAuth();
1398
+ const { identityId, ...body } = params;
1399
+ return this.http.patch(
1400
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(identityId)}`,
1401
+ body
1402
+ );
1403
+ }
1404
+ async get(params) {
1405
+ this.requireAuth();
1406
+ return this.http.get(
1407
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(params.identityId)}`
1408
+ );
1409
+ }
1410
+ async revoke(params) {
1411
+ this.requireAuth();
1412
+ return this.http.delete(
1413
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(params.identityId)}`
1414
+ );
1415
+ }
1416
+ async createToken(params) {
1417
+ this.requireAuth();
1418
+ const { identityId, ...body } = params;
1419
+ return this.http.post(
1420
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(identityId)}/tokens`,
1421
+ body
1422
+ );
1423
+ }
1424
+ async listTokens(params) {
1425
+ this.requireAuth();
1426
+ const { identityId, ...query } = params;
1427
+ return this.http.get(
1428
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(identityId)}/tokens`,
1429
+ { ...query }
1430
+ );
1431
+ }
1432
+ async getToken(params) {
1433
+ this.requireAuth();
1434
+ return this.http.get(
1435
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(params.identityId)}/tokens/${encodeURIComponent(params.tokenId)}`
1436
+ );
1437
+ }
1438
+ async updateToken(params) {
1439
+ this.requireAuth();
1440
+ const { identityId, tokenId, ...body } = params;
1441
+ return this.http.patch(
1442
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(identityId)}/tokens/${encodeURIComponent(tokenId)}`,
1443
+ body
1444
+ );
1445
+ }
1446
+ async revokeToken(params) {
1447
+ this.requireAuth();
1448
+ return this.http.delete(
1449
+ `/api/v1/auth/token-auth/identities/${encodeURIComponent(params.identityId)}/tokens/${encodeURIComponent(params.tokenId)}`
1450
+ );
1451
+ }
1452
+ };
1453
+
1454
+ // src/resources/identity-aws-auth.ts
1455
+ var IdentityAwsAuthResource = class extends BaseResource {
1456
+ constructor(http, authState) {
1457
+ super(http, authState, "identityAuth");
1458
+ }
1459
+ async login(params) {
1460
+ return this.http.postNoAuth(
1461
+ "/api/v1/auth/aws-auth/login",
1462
+ params
1463
+ );
1464
+ }
1465
+ async attach(params) {
1466
+ this.requireAuth();
1467
+ const { identityId, ...body } = params;
1468
+ return this.http.post(
1469
+ `/api/v1/auth/aws-auth/identities/${encodeURIComponent(identityId)}`,
1470
+ body
1471
+ );
1472
+ }
1473
+ async update(params) {
1474
+ this.requireAuth();
1475
+ const { identityId, ...body } = params;
1476
+ return this.http.patch(
1477
+ `/api/v1/auth/aws-auth/identities/${encodeURIComponent(identityId)}`,
1478
+ body
1479
+ );
1480
+ }
1481
+ async get(params) {
1482
+ this.requireAuth();
1483
+ return this.http.get(
1484
+ `/api/v1/auth/aws-auth/identities/${encodeURIComponent(params.identityId)}`
1485
+ );
1486
+ }
1487
+ async revoke(params) {
1488
+ this.requireAuth();
1489
+ return this.http.delete(
1490
+ `/api/v1/auth/aws-auth/identities/${encodeURIComponent(params.identityId)}`
1491
+ );
1492
+ }
1493
+ };
1494
+
1495
+ // src/resources/identity-gcp-auth.ts
1496
+ var IdentityGcpAuthResource = class extends BaseResource {
1497
+ constructor(http, authState) {
1498
+ super(http, authState, "identityAuth");
1499
+ }
1500
+ async login(params) {
1501
+ return this.http.postNoAuth(
1502
+ "/api/v1/auth/gcp-auth/login",
1503
+ params
1504
+ );
1505
+ }
1506
+ async attach(params) {
1507
+ this.requireAuth();
1508
+ const { identityId, ...body } = params;
1509
+ return this.http.post(
1510
+ `/api/v1/auth/gcp-auth/identities/${encodeURIComponent(identityId)}`,
1511
+ body
1512
+ );
1513
+ }
1514
+ async update(params) {
1515
+ this.requireAuth();
1516
+ const { identityId, ...body } = params;
1517
+ return this.http.patch(
1518
+ `/api/v1/auth/gcp-auth/identities/${encodeURIComponent(identityId)}`,
1519
+ body
1520
+ );
1521
+ }
1522
+ async get(params) {
1523
+ this.requireAuth();
1524
+ return this.http.get(
1525
+ `/api/v1/auth/gcp-auth/identities/${encodeURIComponent(params.identityId)}`
1526
+ );
1527
+ }
1528
+ async revoke(params) {
1529
+ this.requireAuth();
1530
+ return this.http.delete(
1531
+ `/api/v1/auth/gcp-auth/identities/${encodeURIComponent(params.identityId)}`
1532
+ );
1533
+ }
1534
+ };
1535
+
1536
+ // src/resources/identity-azure-auth.ts
1537
+ var IdentityAzureAuthResource = class extends BaseResource {
1538
+ constructor(http, authState) {
1539
+ super(http, authState, "identityAuth");
1540
+ }
1541
+ async login(params) {
1542
+ return this.http.postNoAuth(
1543
+ "/api/v1/auth/azure-auth/login",
1544
+ params
1545
+ );
1546
+ }
1547
+ async attach(params) {
1548
+ this.requireAuth();
1549
+ const { identityId, ...body } = params;
1550
+ return this.http.post(
1551
+ `/api/v1/auth/azure-auth/identities/${encodeURIComponent(identityId)}`,
1552
+ body
1553
+ );
1554
+ }
1555
+ async update(params) {
1556
+ this.requireAuth();
1557
+ const { identityId, ...body } = params;
1558
+ return this.http.patch(
1559
+ `/api/v1/auth/azure-auth/identities/${encodeURIComponent(identityId)}`,
1560
+ body
1561
+ );
1562
+ }
1563
+ async get(params) {
1564
+ this.requireAuth();
1565
+ return this.http.get(
1566
+ `/api/v1/auth/azure-auth/identities/${encodeURIComponent(params.identityId)}`
1567
+ );
1568
+ }
1569
+ async revoke(params) {
1570
+ this.requireAuth();
1571
+ return this.http.delete(
1572
+ `/api/v1/auth/azure-auth/identities/${encodeURIComponent(params.identityId)}`
1573
+ );
1574
+ }
1575
+ };
1576
+
1577
+ // src/resources/identity-kubernetes-auth.ts
1578
+ var IdentityKubernetesAuthResource = class extends BaseResource {
1579
+ constructor(http, authState) {
1580
+ super(http, authState, "identityAuth");
1581
+ }
1582
+ async login(params) {
1583
+ return this.http.postNoAuth(
1584
+ "/api/v1/auth/kubernetes-auth/login",
1585
+ params
1586
+ );
1587
+ }
1588
+ async attach(params) {
1589
+ this.requireAuth();
1590
+ const { identityId, ...body } = params;
1591
+ return this.http.post(
1592
+ `/api/v1/auth/kubernetes-auth/identities/${encodeURIComponent(identityId)}`,
1593
+ body
1594
+ );
1595
+ }
1596
+ async update(params) {
1597
+ this.requireAuth();
1598
+ const { identityId, ...body } = params;
1599
+ return this.http.patch(
1600
+ `/api/v1/auth/kubernetes-auth/identities/${encodeURIComponent(identityId)}`,
1601
+ body
1602
+ );
1603
+ }
1604
+ async get(params) {
1605
+ this.requireAuth();
1606
+ return this.http.get(
1607
+ `/api/v1/auth/kubernetes-auth/identities/${encodeURIComponent(params.identityId)}`
1608
+ );
1609
+ }
1610
+ async revoke(params) {
1611
+ this.requireAuth();
1612
+ return this.http.delete(
1613
+ `/api/v1/auth/kubernetes-auth/identities/${encodeURIComponent(params.identityId)}`
1614
+ );
1615
+ }
1616
+ };
1617
+
1618
+ // src/resources/identity-oidc-auth.ts
1619
+ var IdentityOidcAuthResource = class extends BaseResource {
1620
+ constructor(http, authState) {
1621
+ super(http, authState, "identityAuth");
1622
+ }
1623
+ async login(params) {
1624
+ return this.http.postNoAuth(
1625
+ "/api/v1/auth/oidc-auth/login",
1626
+ params
1627
+ );
1628
+ }
1629
+ async attach(params) {
1630
+ this.requireAuth();
1631
+ const { identityId, ...body } = params;
1632
+ return this.http.post(
1633
+ `/api/v1/auth/oidc-auth/identities/${encodeURIComponent(identityId)}`,
1634
+ body
1635
+ );
1636
+ }
1637
+ async update(params) {
1638
+ this.requireAuth();
1639
+ const { identityId, ...body } = params;
1640
+ return this.http.patch(
1641
+ `/api/v1/auth/oidc-auth/identities/${encodeURIComponent(identityId)}`,
1642
+ body
1643
+ );
1644
+ }
1645
+ async get(params) {
1646
+ this.requireAuth();
1647
+ return this.http.get(
1648
+ `/api/v1/auth/oidc-auth/identities/${encodeURIComponent(params.identityId)}`
1649
+ );
1650
+ }
1651
+ async revoke(params) {
1652
+ this.requireAuth();
1653
+ return this.http.delete(
1654
+ `/api/v1/auth/oidc-auth/identities/${encodeURIComponent(params.identityId)}`
1655
+ );
1656
+ }
1657
+ };
1658
+
1659
+ // src/resources/identity-jwt-auth.ts
1660
+ var IdentityJwtAuthResource = class extends BaseResource {
1661
+ constructor(http, authState) {
1662
+ super(http, authState, "identityAuth");
1663
+ }
1664
+ async login(params) {
1665
+ return this.http.postNoAuth(
1666
+ "/api/v1/auth/jwt-auth/login",
1667
+ params
1668
+ );
1669
+ }
1670
+ async attach(params) {
1671
+ this.requireAuth();
1672
+ const { identityId, ...body } = params;
1673
+ return this.http.post(
1674
+ `/api/v1/auth/jwt-auth/identities/${encodeURIComponent(identityId)}`,
1675
+ body
1676
+ );
1677
+ }
1678
+ async update(params) {
1679
+ this.requireAuth();
1680
+ const { identityId, ...body } = params;
1681
+ return this.http.patch(
1682
+ `/api/v1/auth/jwt-auth/identities/${encodeURIComponent(identityId)}`,
1683
+ body
1684
+ );
1685
+ }
1686
+ async get(params) {
1687
+ this.requireAuth();
1688
+ return this.http.get(
1689
+ `/api/v1/auth/jwt-auth/identities/${encodeURIComponent(params.identityId)}`
1690
+ );
1691
+ }
1692
+ async revoke(params) {
1693
+ this.requireAuth();
1694
+ return this.http.delete(
1695
+ `/api/v1/auth/jwt-auth/identities/${encodeURIComponent(params.identityId)}`
1696
+ );
1697
+ }
1698
+ };
1699
+
1700
+ // src/resources/identity-ldap-auth.ts
1701
+ var IdentityLdapAuthResource = class extends BaseResource {
1702
+ constructor(http, authState) {
1703
+ super(http, authState, "identityAuth");
1704
+ }
1705
+ async login(params) {
1706
+ return this.http.postNoAuth(
1707
+ "/api/v1/auth/ldap-auth/login",
1708
+ params
1709
+ );
1710
+ }
1711
+ async attach(params) {
1712
+ this.requireAuth();
1713
+ const { identityId, ...body } = params;
1714
+ return this.http.post(
1715
+ `/api/v1/auth/ldap-auth/identities/${encodeURIComponent(identityId)}`,
1716
+ body
1717
+ );
1718
+ }
1719
+ async update(params) {
1720
+ this.requireAuth();
1721
+ const { identityId, ...body } = params;
1722
+ return this.http.patch(
1723
+ `/api/v1/auth/ldap-auth/identities/${encodeURIComponent(identityId)}`,
1724
+ body
1725
+ );
1726
+ }
1727
+ async get(params) {
1728
+ this.requireAuth();
1729
+ return this.http.get(
1730
+ `/api/v1/auth/ldap-auth/identities/${encodeURIComponent(params.identityId)}`
1731
+ );
1732
+ }
1733
+ async revoke(params) {
1734
+ this.requireAuth();
1735
+ return this.http.delete(
1736
+ `/api/v1/auth/ldap-auth/identities/${encodeURIComponent(params.identityId)}`
1737
+ );
1738
+ }
1739
+ };
1740
+
1741
+ // src/resources/identity-tls-cert-auth.ts
1742
+ var IdentityTlsCertAuthResource = class extends BaseResource {
1743
+ constructor(http, authState) {
1744
+ super(http, authState, "identityAuth");
1745
+ }
1746
+ async login(params) {
1747
+ return this.http.postNoAuth(
1748
+ "/api/v1/auth/tls-cert-auth/login",
1749
+ params
1750
+ );
1751
+ }
1752
+ async attach(params) {
1753
+ this.requireAuth();
1754
+ const { identityId, ...body } = params;
1755
+ return this.http.post(
1756
+ `/api/v1/auth/tls-cert-auth/identities/${encodeURIComponent(identityId)}`,
1757
+ body
1758
+ );
1759
+ }
1760
+ async update(params) {
1761
+ this.requireAuth();
1762
+ const { identityId, ...body } = params;
1763
+ return this.http.patch(
1764
+ `/api/v1/auth/tls-cert-auth/identities/${encodeURIComponent(identityId)}`,
1765
+ body
1766
+ );
1767
+ }
1768
+ async get(params) {
1769
+ this.requireAuth();
1770
+ return this.http.get(
1771
+ `/api/v1/auth/tls-cert-auth/identities/${encodeURIComponent(params.identityId)}`
1772
+ );
1773
+ }
1774
+ async revoke(params) {
1775
+ this.requireAuth();
1776
+ return this.http.delete(
1777
+ `/api/v1/auth/tls-cert-auth/identities/${encodeURIComponent(params.identityId)}`
1778
+ );
1779
+ }
1780
+ };
1781
+
1782
+ // src/resources/identity-oci-auth.ts
1783
+ var IdentityOciAuthResource = class extends BaseResource {
1784
+ constructor(http, authState) {
1785
+ super(http, authState, "identityAuth");
1786
+ }
1787
+ async login(params) {
1788
+ return this.http.postNoAuth(
1789
+ "/api/v1/auth/oci-auth/login",
1790
+ params
1791
+ );
1792
+ }
1793
+ async attach(params) {
1794
+ this.requireAuth();
1795
+ const { identityId, ...body } = params;
1796
+ return this.http.post(
1797
+ `/api/v1/auth/oci-auth/identities/${encodeURIComponent(identityId)}`,
1798
+ body
1799
+ );
1800
+ }
1801
+ async update(params) {
1802
+ this.requireAuth();
1803
+ const { identityId, ...body } = params;
1804
+ return this.http.patch(
1805
+ `/api/v1/auth/oci-auth/identities/${encodeURIComponent(identityId)}`,
1806
+ body
1807
+ );
1808
+ }
1809
+ async get(params) {
1810
+ this.requireAuth();
1811
+ return this.http.get(
1812
+ `/api/v1/auth/oci-auth/identities/${encodeURIComponent(params.identityId)}`
1813
+ );
1814
+ }
1815
+ async revoke(params) {
1816
+ this.requireAuth();
1817
+ return this.http.delete(
1818
+ `/api/v1/auth/oci-auth/identities/${encodeURIComponent(params.identityId)}`
1819
+ );
1820
+ }
1821
+ };
1822
+
1823
+ // src/resources/identity-alicloud-auth.ts
1824
+ var IdentityAlicloudAuthResource = class extends BaseResource {
1825
+ constructor(http, authState) {
1826
+ super(http, authState, "identityAuth");
1827
+ }
1828
+ async login(params) {
1829
+ return this.http.postNoAuth(
1830
+ "/api/v1/auth/alicloud-auth/login",
1831
+ params
1832
+ );
1833
+ }
1834
+ async attach(params) {
1835
+ this.requireAuth();
1836
+ const { identityId, ...body } = params;
1837
+ return this.http.post(
1838
+ `/api/v1/auth/alicloud-auth/identities/${encodeURIComponent(identityId)}`,
1839
+ body
1840
+ );
1841
+ }
1842
+ async update(params) {
1843
+ this.requireAuth();
1844
+ const { identityId, ...body } = params;
1845
+ return this.http.patch(
1846
+ `/api/v1/auth/alicloud-auth/identities/${encodeURIComponent(identityId)}`,
1847
+ body
1848
+ );
1849
+ }
1850
+ async get(params) {
1851
+ this.requireAuth();
1852
+ return this.http.get(
1853
+ `/api/v1/auth/alicloud-auth/identities/${encodeURIComponent(params.identityId)}`
1854
+ );
1855
+ }
1856
+ async revoke(params) {
1857
+ this.requireAuth();
1858
+ return this.http.delete(
1859
+ `/api/v1/auth/alicloud-auth/identities/${encodeURIComponent(params.identityId)}`
1860
+ );
1861
+ }
1862
+ };
1863
+
1864
+ // src/resources/projects.ts
1865
+ var ProjectsResource = class extends BaseResource {
1866
+ constructor(http, authState) {
1867
+ super(http, authState, "projects");
1868
+ }
1869
+ async create(params) {
1870
+ this.requireAuth();
1871
+ return this.http.post(
1872
+ "/api/v1/projects",
1873
+ params
1874
+ );
1875
+ }
1876
+ async list(params) {
1877
+ this.requireAuth();
1878
+ return this.http.get(
1879
+ "/api/v1/projects",
1880
+ { ...params }
1881
+ );
1882
+ }
1883
+ async get(params) {
1884
+ this.requireAuth();
1885
+ return this.http.get(
1886
+ `/api/v1/workspace/${encodeURIComponent(params.projectId)}`
1887
+ );
1888
+ }
1889
+ async getBySlug(params) {
1890
+ this.requireAuth();
1891
+ return this.http.get(
1892
+ `/api/v1/projects/slug/${encodeURIComponent(params.slug)}`
1893
+ );
1894
+ }
1895
+ async update(params) {
1896
+ this.requireAuth();
1897
+ const { projectId, ...body } = params;
1898
+ return this.http.patch(
1899
+ `/api/v1/workspace/${encodeURIComponent(projectId)}`,
1900
+ body
1901
+ );
1902
+ }
1903
+ async delete(params) {
1904
+ this.requireAuth();
1905
+ return this.http.delete(
1906
+ `/api/v1/workspace/${encodeURIComponent(params.projectId)}`
1907
+ );
1908
+ }
1909
+ async listMemberships(params) {
1910
+ this.requireAuth();
1911
+ return this.http.get(
1912
+ `/api/v1/workspace/${encodeURIComponent(params.projectId)}/memberships`
1913
+ );
1914
+ }
1915
+ async listEnvironments(params) {
1916
+ this.requireAuth();
1917
+ return this.http.get(
1918
+ `/api/v1/workspace/${encodeURIComponent(params.projectId)}/environments`
1919
+ );
1920
+ }
1921
+ async createEnvironment(params) {
1922
+ this.requireAuth();
1923
+ const { projectId, ...body } = params;
1924
+ return this.http.post(
1925
+ `/api/v1/workspace/${encodeURIComponent(projectId)}/environments`,
1926
+ body
1927
+ );
1928
+ }
1929
+ async updateEnvironment(params) {
1930
+ this.requireAuth();
1931
+ const { projectId, environmentId, ...body } = params;
1932
+ return this.http.patch(
1933
+ `/api/v1/workspace/${encodeURIComponent(projectId)}/environments/${encodeURIComponent(environmentId)}`,
1934
+ body
1935
+ );
1936
+ }
1937
+ async deleteEnvironment(params) {
1938
+ this.requireAuth();
1939
+ return this.http.delete(
1940
+ `/api/v1/workspace/${encodeURIComponent(params.projectId)}/environments/${encodeURIComponent(params.environmentId)}`
1941
+ );
1942
+ }
1943
+ async listRoles(params) {
1944
+ this.requireAuth();
1945
+ return this.http.get(
1946
+ `/api/v1/workspace/${encodeURIComponent(params.projectId)}/roles`
1947
+ );
1948
+ }
1949
+ async listTags(params) {
1950
+ this.requireAuth();
1951
+ return this.http.get(
1952
+ `/api/v1/workspace/${encodeURIComponent(params.projectId)}/tags`
1953
+ );
1954
+ }
1955
+ };
1956
+
1957
+ // src/resources/webhooks.ts
1958
+ var WebhooksResource = class extends BaseResource {
1959
+ constructor(http, authState) {
1960
+ super(http, authState, "webhooks");
1961
+ }
1962
+ async create(params) {
1963
+ this.requireAuth();
1964
+ return this.http.post(
1965
+ "/api/v1/webhooks",
1966
+ params
1967
+ );
1968
+ }
1969
+ async update(params) {
1970
+ this.requireAuth();
1971
+ const { webhookId, ...body } = params;
1972
+ return this.http.patch(
1973
+ `/api/v1/webhooks/${encodeURIComponent(webhookId)}`,
1974
+ body
1975
+ );
1976
+ }
1977
+ async delete(params) {
1978
+ this.requireAuth();
1979
+ return this.http.delete(
1980
+ `/api/v1/webhooks/${encodeURIComponent(params.webhookId)}`
1981
+ );
1982
+ }
1983
+ async list(params) {
1984
+ this.requireAuth();
1985
+ return this.http.get(
1986
+ "/api/v1/webhooks",
1987
+ { ...params }
1988
+ );
1989
+ }
1990
+ async test(params) {
1991
+ this.requireAuth();
1992
+ return this.http.post(
1993
+ `/api/v1/webhooks/${encodeURIComponent(params.webhookId)}/test`
1994
+ );
1995
+ }
1996
+ };
1997
+
1998
+ // src/resources/secret-sharing.ts
1999
+ var SecretSharingResource = class extends BaseResource {
2000
+ constructor(http, authState) {
2001
+ super(http, authState, "secretSharing");
2002
+ }
2003
+ async create(params) {
2004
+ this.requireAuth();
2005
+ return this.http.post(
2006
+ "/api/v1/secret-sharing",
2007
+ params
2008
+ );
2009
+ }
2010
+ async get(params) {
2011
+ this.requireAuth();
2012
+ return this.http.get(
2013
+ `/api/v1/secret-sharing/${encodeURIComponent(params.sharedSecretId)}`,
2014
+ { hashedHex: params.hashedHex }
2015
+ );
2016
+ }
2017
+ async delete(params) {
2018
+ this.requireAuth();
2019
+ return this.http.delete(
2020
+ `/api/v1/secret-sharing/${encodeURIComponent(params.sharedSecretId)}`
2021
+ );
2022
+ }
2023
+ async list() {
2024
+ this.requireAuth();
2025
+ return this.http.get(
2026
+ "/api/v1/secret-sharing"
2027
+ );
2028
+ }
2029
+ };
2030
+
2031
+ // src/resources/secrets.ts
2032
+ var SecretsResource = class extends BaseResource {
2033
+ constructor(http, authState) {
2034
+ super(http, authState, "secrets");
2035
+ }
2036
+ async getAccessList(params) {
2037
+ this.requireAuth();
2038
+ const { secretName, ...query } = params;
2039
+ return this.http.get(
2040
+ `/api/v1/secrets/${encodeURIComponent(secretName)}/access-list`,
2041
+ { ...query }
2042
+ );
2043
+ }
2044
+ async list(params) {
2045
+ this.requireAuth();
2046
+ return this.http.get(
2047
+ "/api/v4/secrets",
2048
+ { ...params }
2049
+ );
2050
+ }
2051
+ async getByName(params) {
2052
+ this.requireAuth();
2053
+ const { secretName, ...query } = params;
2054
+ return this.http.get(
2055
+ `/api/v4/secrets/${encodeURIComponent(secretName)}`,
2056
+ { ...query }
2057
+ );
2058
+ }
2059
+ async getById(params) {
2060
+ this.requireAuth();
2061
+ return this.http.get(
2062
+ `/api/v4/secrets/id/${encodeURIComponent(params.secretId)}`
2063
+ );
2064
+ }
2065
+ async create(params) {
2066
+ this.requireAuth();
2067
+ const { secretName, ...body } = params;
2068
+ return this.http.post(
2069
+ `/api/v4/secrets/${encodeURIComponent(secretName)}`,
2070
+ body
2071
+ );
2072
+ }
2073
+ async update(params) {
2074
+ this.requireAuth();
2075
+ const { secretName, ...body } = params;
2076
+ return this.http.patch(
2077
+ `/api/v4/secrets/${encodeURIComponent(secretName)}`,
2078
+ body
2079
+ );
2080
+ }
2081
+ async delete(params) {
2082
+ this.requireAuth();
2083
+ const { secretName, ...body } = params;
2084
+ return this.http.delete(
2085
+ `/api/v4/secrets/${encodeURIComponent(secretName)}`,
2086
+ body
2087
+ );
2088
+ }
2089
+ async batchCreate(params) {
2090
+ this.requireAuth();
2091
+ return this.http.post(
2092
+ "/api/v4/secrets/batch",
2093
+ params
2094
+ );
2095
+ }
2096
+ async batchUpdate(params) {
2097
+ this.requireAuth();
2098
+ return this.http.patch(
2099
+ "/api/v4/secrets/batch",
2100
+ params
2101
+ );
2102
+ }
2103
+ async batchDelete(params) {
2104
+ this.requireAuth();
2105
+ return this.http.delete(
2106
+ "/api/v4/secrets/batch",
2107
+ params
2108
+ );
2109
+ }
2110
+ async move(params) {
2111
+ this.requireAuth();
2112
+ return this.http.post(
2113
+ "/api/v4/secrets/move",
2114
+ params
2115
+ );
2116
+ }
2117
+ };
2118
+
2119
+ // src/resources/kms.ts
2120
+ var KmsResource = class extends BaseResource {
2121
+ constructor(http, authState) {
2122
+ super(http, authState, "kms");
2123
+ }
2124
+ async createKey(params) {
2125
+ this.requireAuth();
2126
+ return this.http.post(
2127
+ "/api/v1/kms/keys",
2128
+ params
2129
+ );
2130
+ }
2131
+ async updateKey(params) {
2132
+ this.requireAuth();
2133
+ const { keyId, ...body } = params;
2134
+ return this.http.patch(
2135
+ `/api/v1/kms/keys/${encodeURIComponent(keyId)}`,
2136
+ body
2137
+ );
2138
+ }
2139
+ async deleteKey(params) {
2140
+ this.requireAuth();
2141
+ return this.http.delete(
2142
+ `/api/v1/kms/keys/${encodeURIComponent(params.keyId)}`
2143
+ );
2144
+ }
2145
+ async getKey(params) {
2146
+ this.requireAuth();
2147
+ return this.http.get(
2148
+ `/api/v1/kms/keys/${encodeURIComponent(params.keyId)}`
2149
+ );
2150
+ }
2151
+ async listKeys(params) {
2152
+ this.requireAuth();
2153
+ return this.http.get(
2154
+ "/api/v1/kms/keys",
2155
+ { ...params }
2156
+ );
2157
+ }
2158
+ async encrypt(params) {
2159
+ this.requireAuth();
2160
+ const { keyId, ...body } = params;
2161
+ return this.http.post(
2162
+ `/api/v1/kms/keys/${encodeURIComponent(keyId)}/encrypt`,
2163
+ body
2164
+ );
2165
+ }
2166
+ async decrypt(params) {
2167
+ this.requireAuth();
2168
+ const { keyId, ...body } = params;
2169
+ return this.http.post(
2170
+ `/api/v1/kms/keys/${encodeURIComponent(keyId)}/decrypt`,
2171
+ body
2172
+ );
2173
+ }
2174
+ async getKeyByName(params) {
2175
+ this.requireAuth();
2176
+ const { keyName, ...query } = params;
2177
+ return this.http.get(
2178
+ `/api/v1/kms/keys/key-name/${encodeURIComponent(keyName)}`,
2179
+ { ...query }
2180
+ );
2181
+ }
2182
+ async getPublicKey(params) {
2183
+ this.requireAuth();
2184
+ return this.http.get(
2185
+ `/api/v1/kms/keys/${encodeURIComponent(params.keyId)}/public-key`
2186
+ );
2187
+ }
2188
+ async getPrivateKey(params) {
2189
+ this.requireAuth();
2190
+ return this.http.get(
2191
+ `/api/v1/kms/keys/${encodeURIComponent(params.keyId)}/private-key`
2192
+ );
2193
+ }
2194
+ async listSigningAlgorithms(params) {
2195
+ this.requireAuth();
2196
+ return this.http.get(
2197
+ `/api/v1/kms/keys/${encodeURIComponent(params.keyId)}/signing-algorithms`
2198
+ );
2199
+ }
2200
+ async sign(params) {
2201
+ this.requireAuth();
2202
+ const { keyId, ...body } = params;
2203
+ return this.http.post(
2204
+ `/api/v1/kms/keys/${encodeURIComponent(keyId)}/sign`,
2205
+ body
2206
+ );
2207
+ }
2208
+ async verify(params) {
2209
+ this.requireAuth();
2210
+ const { keyId, ...body } = params;
2211
+ return this.http.post(
2212
+ `/api/v1/kms/keys/${encodeURIComponent(keyId)}/verify`,
2213
+ body
2214
+ );
2215
+ }
2216
+ };
2217
+
2218
+ // src/resources/integration-auth.ts
2219
+ var IntegrationAuthResource = class extends BaseResource {
2220
+ constructor(http, authState) {
2221
+ super(http, authState, "integrationAuth");
2222
+ }
2223
+ async create(params) {
2224
+ this.requireAuth();
2225
+ return this.http.post(
2226
+ "/api/v1/integration-auth/access-token",
2227
+ params
2228
+ );
2229
+ }
2230
+ async get(params) {
2231
+ this.requireAuth();
2232
+ return this.http.get(
2233
+ `/api/v1/integration-auth/${encodeURIComponent(params.integrationAuthId)}`
2234
+ );
2235
+ }
2236
+ async delete(params) {
2237
+ this.requireAuth();
2238
+ return this.http.delete(
2239
+ `/api/v1/integration-auth/${encodeURIComponent(params.integrationAuthId)}`
2240
+ );
2241
+ }
2242
+ async list(params) {
2243
+ this.requireAuth();
2244
+ return this.http.get(
2245
+ "/api/v1/integration-auth",
2246
+ { ...params }
2247
+ );
2248
+ }
2249
+ };
2250
+
2251
+ // src/resources/app-connections.ts
2252
+ var AppConnectionsResource = class extends BaseResource {
2253
+ constructor(http, authState) {
2254
+ super(http, authState, "appConnections");
2255
+ }
2256
+ async create(params) {
2257
+ this.requireAuth();
2258
+ const { app, ...body } = params;
2259
+ return this.http.post(
2260
+ `/api/v1/app-connections/${encodeURIComponent(app)}`,
2261
+ body
2262
+ );
2263
+ }
2264
+ async update(params) {
2265
+ this.requireAuth();
2266
+ const { app, connectionId, ...body } = params;
2267
+ return this.http.patch(
2268
+ `/api/v1/app-connections/${encodeURIComponent(app)}/${encodeURIComponent(connectionId)}`,
2269
+ body
2270
+ );
2271
+ }
2272
+ async delete(params) {
2273
+ this.requireAuth();
2274
+ return this.http.delete(
2275
+ `/api/v1/app-connections/${encodeURIComponent(params.app)}/${encodeURIComponent(params.connectionId)}`
2276
+ );
2277
+ }
2278
+ async get(params) {
2279
+ this.requireAuth();
2280
+ return this.http.get(
2281
+ `/api/v1/app-connections/${encodeURIComponent(params.app)}/${encodeURIComponent(params.connectionId)}`
2282
+ );
2283
+ }
2284
+ async list(params) {
2285
+ this.requireAuth();
2286
+ return this.http.get(
2287
+ `/api/v1/app-connections/${encodeURIComponent(params.app)}`
2288
+ );
2289
+ }
2290
+ async getByName(params) {
2291
+ this.requireAuth();
2292
+ return this.http.get(
2293
+ `/api/v1/app-connections/${encodeURIComponent(params.app)}/connection-name/${encodeURIComponent(params.connectionName)}`
2294
+ );
2295
+ }
2296
+ async checkAvailability(params) {
2297
+ this.requireAuth();
2298
+ return this.http.get(
2299
+ `/api/v1/app-connections/${encodeURIComponent(params.app)}/available`
2300
+ );
2301
+ }
2302
+ async listAll() {
2303
+ this.requireAuth();
2304
+ return this.http.get(
2305
+ "/api/v1/app-connections/list"
2306
+ );
2307
+ }
2308
+ };
2309
+
2310
+ // src/resources/secret-syncs.ts
2311
+ var SecretSyncsResource = class extends BaseResource {
2312
+ constructor(http, authState) {
2313
+ super(http, authState, "secretSyncs");
2314
+ }
2315
+ async create(params) {
2316
+ this.requireAuth();
2317
+ const { destination, ...body } = params;
2318
+ return this.http.post(
2319
+ `/api/v1/secret-syncs/${encodeURIComponent(destination)}`,
2320
+ body
2321
+ );
2322
+ }
2323
+ async update(params) {
2324
+ this.requireAuth();
2325
+ const { destination, syncId, ...body } = params;
2326
+ return this.http.patch(
2327
+ `/api/v1/secret-syncs/${encodeURIComponent(destination)}/${encodeURIComponent(syncId)}`,
2328
+ body
2329
+ );
2330
+ }
2331
+ async delete(params) {
2332
+ this.requireAuth();
2333
+ const { destination, syncId, ...body } = params;
2334
+ return this.http.delete(
2335
+ `/api/v1/secret-syncs/${encodeURIComponent(destination)}/${encodeURIComponent(syncId)}`,
2336
+ body
2337
+ );
2338
+ }
2339
+ async get(params) {
2340
+ this.requireAuth();
2341
+ return this.http.get(
2342
+ `/api/v1/secret-syncs/${encodeURIComponent(params.destination)}/${encodeURIComponent(params.syncId)}`
2343
+ );
2344
+ }
2345
+ async list(params) {
2346
+ this.requireAuth();
2347
+ const { destination, ...query } = params;
2348
+ return this.http.get(
2349
+ `/api/v1/secret-syncs/${encodeURIComponent(destination)}`,
2350
+ { ...query }
2351
+ );
2352
+ }
2353
+ async trigger(params) {
2354
+ this.requireAuth();
2355
+ return this.http.post(
2356
+ `/api/v1/secret-syncs/${encodeURIComponent(params.destination)}/${encodeURIComponent(params.syncId)}/sync`
2357
+ );
2358
+ }
2359
+ async importSecrets(params) {
2360
+ this.requireAuth();
2361
+ return this.http.post(
2362
+ `/api/v1/secret-syncs/${encodeURIComponent(params.destination)}/${encodeURIComponent(params.syncId)}/import-secrets`
2363
+ );
2364
+ }
2365
+ async removeSecrets(params) {
2366
+ this.requireAuth();
2367
+ return this.http.post(
2368
+ `/api/v1/secret-syncs/${encodeURIComponent(params.destination)}/${encodeURIComponent(params.syncId)}/remove-secrets`
2369
+ );
2370
+ }
2371
+ async getByName(params) {
2372
+ this.requireAuth();
2373
+ return this.http.get(
2374
+ `/api/v1/secret-syncs/${encodeURIComponent(params.destination)}/sync-name/${encodeURIComponent(params.syncName)}`
2375
+ );
2376
+ }
2377
+ };
2378
+
2379
+ // src/resources/admin.ts
2380
+ var AdminResource = class extends BaseResource {
2381
+ constructor(http, authState) {
2382
+ super(http, authState, "admin");
2383
+ }
2384
+ // Bootstrap & Signup
2385
+ async bootstrap(params) {
2386
+ return this.http.postNoAuth("/api/v1/admin/bootstrap", params);
2387
+ }
2388
+ async signup(params) {
2389
+ this.requireAuth();
2390
+ return this.http.post("/api/v1/admin/signup", params);
2391
+ }
2392
+ // Config
2393
+ async getConfig() {
2394
+ this.requireAuth();
2395
+ return this.http.get("/api/v1/admin/config");
2396
+ }
2397
+ async updateConfig(params) {
2398
+ this.requireAuth();
2399
+ return this.http.patch("/api/v1/admin/config", params);
2400
+ }
2401
+ // User Management
2402
+ async listUsers(params) {
2403
+ this.requireAuth();
2404
+ return this.http.get(
2405
+ "/api/v1/admin/user-management/users",
2406
+ { ...params }
2407
+ );
2408
+ }
2409
+ async deleteUser(params) {
2410
+ this.requireAuth();
2411
+ return this.http.delete(
2412
+ `/api/v1/admin/user-management/users/${encodeURIComponent(params.userId)}`
2413
+ );
2414
+ }
2415
+ async deleteUsers(params) {
2416
+ this.requireAuth();
2417
+ return this.http.delete(
2418
+ "/api/v1/admin/user-management/users",
2419
+ params
2420
+ );
2421
+ }
2422
+ async grantAdminAccess(params) {
2423
+ this.requireAuth();
2424
+ return this.http.patch(
2425
+ `/api/v1/admin/user-management/users/${encodeURIComponent(params.userId)}/admin-access`
2426
+ );
2427
+ }
2428
+ async revokeAdminAccess(params) {
2429
+ this.requireAuth();
2430
+ return this.http.delete(
2431
+ `/api/v1/admin/user-management/users/${encodeURIComponent(params.userId)}/admin-access`
2432
+ );
2433
+ }
2434
+ // Organization Management
2435
+ async listOrganizations(params) {
2436
+ this.requireAuth();
2437
+ return this.http.get(
2438
+ "/api/v1/admin/organization-management/organizations",
2439
+ { ...params }
2440
+ );
2441
+ }
2442
+ async createOrganization(params) {
2443
+ this.requireAuth();
2444
+ return this.http.post(
2445
+ "/api/v1/admin/organization-management/organizations",
2446
+ params
2447
+ );
2448
+ }
2449
+ async deleteOrganization(params) {
2450
+ this.requireAuth();
2451
+ return this.http.delete(
2452
+ `/api/v1/admin/organization-management/organizations/${encodeURIComponent(params.organizationId)}`
2453
+ );
2454
+ }
2455
+ async deleteOrgMembership(params) {
2456
+ this.requireAuth();
2457
+ return this.http.delete(
2458
+ `/api/v1/admin/organization-management/organizations/${encodeURIComponent(params.organizationId)}/memberships/${encodeURIComponent(params.membershipId)}`
2459
+ );
2460
+ }
2461
+ async resendOrgInvite(params) {
2462
+ this.requireAuth();
2463
+ return this.http.post(
2464
+ `/api/v1/admin/organization-management/organizations/${encodeURIComponent(params.organizationId)}/memberships/${encodeURIComponent(params.membershipId)}/resend-invite`
2465
+ );
2466
+ }
2467
+ async joinOrganization(params) {
2468
+ this.requireAuth();
2469
+ return this.http.post(
2470
+ `/api/v1/admin/organization-management/organizations/${encodeURIComponent(params.organizationId)}/access`
2471
+ );
2472
+ }
2473
+ // Identity Management
2474
+ async listIdentities(params) {
2475
+ this.requireAuth();
2476
+ return this.http.get(
2477
+ "/api/v1/admin/identity-management/identities",
2478
+ { ...params }
2479
+ );
2480
+ }
2481
+ async grantIdentitySuperAdmin(params) {
2482
+ this.requireAuth();
2483
+ return this.http.patch(
2484
+ `/api/v1/admin/identity-management/identities/${encodeURIComponent(params.identityId)}/super-admin-access`
2485
+ );
2486
+ }
2487
+ async revokeIdentitySuperAdmin(params) {
2488
+ this.requireAuth();
2489
+ return this.http.delete(
2490
+ `/api/v1/admin/identity-management/identities/${encodeURIComponent(params.identityId)}/super-admin-access`
2491
+ );
2492
+ }
2493
+ // Integrations
2494
+ async getIntegrations() {
2495
+ this.requireAuth();
2496
+ return this.http.get("/api/v1/admin/integrations");
2497
+ }
2498
+ // Encryption
2499
+ async getEncryptionStrategies() {
2500
+ this.requireAuth();
2501
+ return this.http.get("/api/v1/admin/encryption-strategies");
2502
+ }
2503
+ async updateEncryptionStrategy(params) {
2504
+ this.requireAuth();
2505
+ return this.http.patch(
2506
+ "/api/v1/admin/encryption-strategies",
2507
+ params
2508
+ );
2509
+ }
2510
+ // Environment Overrides
2511
+ async getEnvOverrides() {
2512
+ this.requireAuth();
2513
+ return this.http.get("/api/v1/admin/env-overrides");
2514
+ }
2515
+ // Cache
2516
+ async invalidateCache(params) {
2517
+ this.requireAuth();
2518
+ return this.http.post("/api/v1/admin/invalidate-cache", params);
2519
+ }
2520
+ async getCacheStatus() {
2521
+ this.requireAuth();
2522
+ return this.http.get("/api/v1/admin/invalidating-cache-status");
2523
+ }
2524
+ // Usage Report
2525
+ async generateUsageReport() {
2526
+ this.requireAuth();
2527
+ return this.http.post("/api/v1/admin/usage-report/generate");
2528
+ }
2529
+ };
2530
+
2531
+ // src/resources/org-admin.ts
2532
+ var OrgAdminResource = class extends BaseResource {
2533
+ constructor(http, authState) {
2534
+ super(http, authState, "orgAdmin");
2535
+ }
2536
+ async listProjects(params) {
2537
+ this.requireAuth();
2538
+ return this.http.get(
2539
+ "/api/v1/org-admin/projects",
2540
+ { ...params }
2541
+ );
2542
+ }
2543
+ async grantProjectAccess(params) {
2544
+ this.requireAuth();
2545
+ return this.http.post(
2546
+ `/api/v1/org-admin/projects/${encodeURIComponent(params.projectId)}/grant-admin-access`
2547
+ );
2548
+ }
2549
+ };
2550
+
2551
+ // src/client.ts
2552
+ var InfisicalClient = class {
2553
+ mfa;
2554
+ mfaSessions;
2555
+ users;
2556
+ password;
2557
+ serviceTokens;
2558
+ organizations;
2559
+ organizationIdentities;
2560
+ secretFolders;
2561
+ secretImports;
2562
+ pki;
2563
+ secretTags;
2564
+ identities;
2565
+ identityAccessTokens;
2566
+ identityAuth;
2567
+ projects;
2568
+ webhooks;
2569
+ secretSharing;
2570
+ secrets;
2571
+ kms;
2572
+ integrationAuth;
2573
+ appConnections;
2574
+ secretSyncs;
2575
+ admin;
2576
+ orgAdmin;
2577
+ _authState;
2578
+ _authManager;
2579
+ constructor(config = {}) {
2580
+ this._authState = new AuthState();
2581
+ const http = new HttpClient({
2582
+ baseUrl: config.baseUrl ?? "https://app.infisical.com",
2583
+ authState: this._authState,
2584
+ fetch: config.fetch ?? import_cross_fetch.default,
2585
+ timeout: config.timeout ?? 3e4,
2586
+ headers: config.headers
2587
+ });
2588
+ const as = this._authState;
2589
+ this.mfa = new MfaResource(http, as);
2590
+ this.mfaSessions = new MfaSessionsResource(http, as);
2591
+ this.users = new UsersResource(http, as);
2592
+ this.password = new PasswordResource(http, as);
2593
+ this.serviceTokens = new ServiceTokensResource(http, as);
2594
+ this.organizations = new OrganizationsResource(http, as);
2595
+ this.organizationIdentities = new OrganizationIdentitiesResource(http, as);
2596
+ this.secretFolders = new SecretFoldersResource(http, as);
2597
+ this.secretImports = new SecretImportsResource(http, as);
2598
+ this.pki = {
2599
+ ca: new PkiCaResource(http, as),
2600
+ templates: new PkiTemplatesResource(http, as),
2601
+ alerts: new PkiAlertsResource(http, as),
2602
+ certificates: new PkiCertificatesResource(http, as)
2603
+ };
2604
+ this.secretTags = new SecretTagsResource(http, as);
2605
+ this.identities = new IdentitiesResource(http, as);
2606
+ this.identityAccessTokens = new IdentityAccessTokensResource(http, as);
2607
+ const identityAuthResources = {
2608
+ universal: new IdentityUniversalAuthResource(http, as),
2609
+ token: new IdentityTokenAuthResource(http, as),
2610
+ aws: new IdentityAwsAuthResource(http, as),
2611
+ gcp: new IdentityGcpAuthResource(http, as),
2612
+ azure: new IdentityAzureAuthResource(http, as),
2613
+ kubernetes: new IdentityKubernetesAuthResource(http, as),
2614
+ oidc: new IdentityOidcAuthResource(http, as),
2615
+ jwt: new IdentityJwtAuthResource(http, as),
2616
+ ldap: new IdentityLdapAuthResource(http, as),
2617
+ tlsCert: new IdentityTlsCertAuthResource(http, as),
2618
+ oci: new IdentityOciAuthResource(http, as),
2619
+ alicloud: new IdentityAlicloudAuthResource(http, as)
2620
+ };
2621
+ this.identityAuth = identityAuthResources;
2622
+ this._authManager = new AuthManager(this._authState, identityAuthResources);
2623
+ this.projects = new ProjectsResource(http, as);
2624
+ this.webhooks = new WebhooksResource(http, as);
2625
+ this.secretSharing = new SecretSharingResource(http, as);
2626
+ this.secrets = new SecretsResource(http, as);
2627
+ this.kms = new KmsResource(http, as);
2628
+ this.integrationAuth = new IntegrationAuthResource(http, as);
2629
+ this.appConnections = new AppConnectionsResource(http, as);
2630
+ this.secretSyncs = new SecretSyncsResource(http, as);
2631
+ this.admin = new AdminResource(http, as);
2632
+ this.orgAdmin = new OrgAdminResource(http, as);
2633
+ }
2634
+ async login(params) {
2635
+ return this._authManager.login(params);
2636
+ }
2637
+ /**
2638
+ * Set a pre-existing identity access token directly (e.g., from external auth).
2639
+ * This bypasses the login flow and sets the token directly on the auth state.
2640
+ */
2641
+ setAccessToken(accessToken, expiresIn, renewFn) {
2642
+ this._authState.setAuth(
2643
+ { mode: "identityAccessToken", accessToken },
2644
+ expiresIn
2645
+ );
2646
+ if (renewFn) {
2647
+ this._authState.setRenewFn(async () => {
2648
+ const result = await renewFn();
2649
+ return {
2650
+ auth: { mode: "identityAccessToken", accessToken: result.accessToken },
2651
+ expiresIn: result.expiresIn
2652
+ };
2653
+ });
2654
+ }
2655
+ }
2656
+ /**
2657
+ * Set a pre-existing JWT token directly (e.g., from bootstrap or user login).
2658
+ * Use this for admin operations that require JWT auth mode.
2659
+ */
2660
+ setJwtToken(token, expiresIn, renewFn) {
2661
+ this._authState.setAuth(
2662
+ { mode: "jwt", token },
2663
+ expiresIn
2664
+ );
2665
+ if (renewFn) {
2666
+ this._authState.setRenewFn(async () => {
2667
+ const result = await renewFn();
2668
+ return {
2669
+ auth: { mode: "jwt", token: result.token },
2670
+ expiresIn: result.expiresIn
2671
+ };
2672
+ });
2673
+ }
2674
+ }
2675
+ get isAuthenticated() {
2676
+ return this._authState.isAuthenticated;
2677
+ }
2678
+ get authMode() {
2679
+ return this._authState.mode;
2680
+ }
2681
+ logout() {
2682
+ this._authState.clearAuth();
2683
+ }
2684
+ };
2685
+
2686
+ // src/types/common.ts
2687
+ var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
2688
+ AuthMethod2["EMAIL"] = "email";
2689
+ AuthMethod2["GOOGLE"] = "google";
2690
+ AuthMethod2["GITHUB"] = "github";
2691
+ AuthMethod2["GITLAB"] = "gitlab";
2692
+ return AuthMethod2;
2693
+ })(AuthMethod || {});
2694
+ var MfaMethod = /* @__PURE__ */ ((MfaMethod2) => {
2695
+ MfaMethod2["EMAIL"] = "email";
2696
+ MfaMethod2["TOTP"] = "totp";
2697
+ MfaMethod2["WEBAUTHN"] = "webauthn";
2698
+ return MfaMethod2;
2699
+ })(MfaMethod || {});
2700
+ var OrgMembershipStatus = /* @__PURE__ */ ((OrgMembershipStatus2) => {
2701
+ OrgMembershipStatus2["Accepted"] = "accepted";
2702
+ OrgMembershipStatus2["Invited"] = "invited";
2703
+ return OrgMembershipStatus2;
2704
+ })(OrgMembershipStatus || {});
2705
+ var OrgIdentityOrderBy = /* @__PURE__ */ ((OrgIdentityOrderBy2) => {
2706
+ OrgIdentityOrderBy2["Name"] = "name";
2707
+ return OrgIdentityOrderBy2;
2708
+ })(OrgIdentityOrderBy || {});
2709
+ var OrderByDirection = /* @__PURE__ */ ((OrderByDirection2) => {
2710
+ OrderByDirection2["ASC"] = "asc";
2711
+ OrderByDirection2["DESC"] = "desc";
2712
+ return OrderByDirection2;
2713
+ })(OrderByDirection || {});
2714
+ var MfaSessionStatus = /* @__PURE__ */ ((MfaSessionStatus2) => {
2715
+ MfaSessionStatus2["PENDING"] = "pending";
2716
+ MfaSessionStatus2["VERIFIED"] = "verified";
2717
+ MfaSessionStatus2["EXPIRED"] = "expired";
2718
+ return MfaSessionStatus2;
2719
+ })(MfaSessionStatus || {});
2720
+ var PkiAlertEventType = /* @__PURE__ */ ((PkiAlertEventType2) => {
2721
+ PkiAlertEventType2["EXPIRING"] = "expiring";
2722
+ return PkiAlertEventType2;
2723
+ })(PkiAlertEventType || {});
2724
+ var PkiAlertChannelType = /* @__PURE__ */ ((PkiAlertChannelType2) => {
2725
+ PkiAlertChannelType2["EMAIL"] = "email";
2726
+ PkiAlertChannelType2["WEBHOOK"] = "webhook";
2727
+ PkiAlertChannelType2["SLACK"] = "slack";
2728
+ PkiAlertChannelType2["PAGERDUTY"] = "pagerduty";
2729
+ return PkiAlertChannelType2;
2730
+ })(PkiAlertChannelType || {});
2731
+ var CertKeyUsage = /* @__PURE__ */ ((CertKeyUsage2) => {
2732
+ CertKeyUsage2["DIGITAL_SIGNATURE"] = "digitalSignature";
2733
+ CertKeyUsage2["KEY_ENCIPHERMENT"] = "keyEncipherment";
2734
+ CertKeyUsage2["DATA_ENCIPHERMENT"] = "dataEncipherment";
2735
+ CertKeyUsage2["KEY_AGREEMENT"] = "keyAgreement";
2736
+ CertKeyUsage2["KEY_CERT_SIGN"] = "keyCertSign";
2737
+ CertKeyUsage2["CRL_SIGN"] = "cRLSign";
2738
+ CertKeyUsage2["NON_REPUDIATION"] = "nonRepudiation";
2739
+ CertKeyUsage2["ENCIPHER_ONLY"] = "encipherOnly";
2740
+ CertKeyUsage2["DECIPHER_ONLY"] = "decipherOnly";
2741
+ return CertKeyUsage2;
2742
+ })(CertKeyUsage || {});
2743
+ var CertExtendedKeyUsage = /* @__PURE__ */ ((CertExtendedKeyUsage2) => {
2744
+ CertExtendedKeyUsage2["SERVER_AUTH"] = "serverAuth";
2745
+ CertExtendedKeyUsage2["CLIENT_AUTH"] = "clientAuth";
2746
+ CertExtendedKeyUsage2["CODE_SIGNING"] = "codeSigning";
2747
+ CertExtendedKeyUsage2["EMAIL_PROTECTION"] = "emailProtection";
2748
+ CertExtendedKeyUsage2["TIME_STAMPING"] = "timeStamping";
2749
+ CertExtendedKeyUsage2["OCSP_SIGNING"] = "ocspSigning";
2750
+ return CertExtendedKeyUsage2;
2751
+ })(CertExtendedKeyUsage || {});
2752
+ var CaType = /* @__PURE__ */ ((CaType2) => {
2753
+ CaType2["INTERNAL"] = "internal";
2754
+ CaType2["ACME"] = "acme";
2755
+ CaType2["AZURE_AD_CS"] = "azure-ad-cs";
2756
+ return CaType2;
2757
+ })(CaType || {});
2758
+ var JwtSignatureAlgorithm = /* @__PURE__ */ ((JwtSignatureAlgorithm2) => {
2759
+ JwtSignatureAlgorithm2["RS256"] = "RS256";
2760
+ JwtSignatureAlgorithm2["RS384"] = "RS384";
2761
+ JwtSignatureAlgorithm2["RS512"] = "RS512";
2762
+ JwtSignatureAlgorithm2["ES256"] = "ES256";
2763
+ JwtSignatureAlgorithm2["ES384"] = "ES384";
2764
+ JwtSignatureAlgorithm2["ES512"] = "ES512";
2765
+ JwtSignatureAlgorithm2["PS256"] = "PS256";
2766
+ JwtSignatureAlgorithm2["PS384"] = "PS384";
2767
+ JwtSignatureAlgorithm2["PS512"] = "PS512";
2768
+ JwtSignatureAlgorithm2["EdDSA"] = "EdDSA";
2769
+ return JwtSignatureAlgorithm2;
2770
+ })(JwtSignatureAlgorithm || {});
2771
+ // Annotate the CommonJS export names for ESM import in node:
2772
+ 0 && (module.exports = {
2773
+ AdminResource,
2774
+ AppConnectionsResource,
2775
+ AuthManager,
2776
+ AuthMethod,
2777
+ AuthState,
2778
+ AuthenticationError,
2779
+ BadRequestError,
2780
+ CaType,
2781
+ CertExtendedKeyUsage,
2782
+ CertKeyUsage,
2783
+ ForbiddenError,
2784
+ HttpClient,
2785
+ IdentitiesResource,
2786
+ IdentityAccessTokensResource,
2787
+ IdentityAlicloudAuthResource,
2788
+ IdentityAwsAuthResource,
2789
+ IdentityAzureAuthResource,
2790
+ IdentityGcpAuthResource,
2791
+ IdentityJwtAuthResource,
2792
+ IdentityKubernetesAuthResource,
2793
+ IdentityLdapAuthResource,
2794
+ IdentityOciAuthResource,
2795
+ IdentityOidcAuthResource,
2796
+ IdentityTlsCertAuthResource,
2797
+ IdentityTokenAuthResource,
2798
+ IdentityUniversalAuthResource,
2799
+ InfisicalApiError,
2800
+ InfisicalClient,
2801
+ InfisicalNetworkError,
2802
+ IntegrationAuthResource,
2803
+ InternalServerError,
2804
+ JwtSignatureAlgorithm,
2805
+ KmsResource,
2806
+ MfaMethod,
2807
+ MfaResource,
2808
+ MfaSessionStatus,
2809
+ MfaSessionsResource,
2810
+ NotFoundError,
2811
+ OrderByDirection,
2812
+ OrgAdminResource,
2813
+ OrgIdentityOrderBy,
2814
+ OrgMembershipStatus,
2815
+ OrganizationIdentitiesResource,
2816
+ OrganizationsResource,
2817
+ PasswordResource,
2818
+ PkiAlertChannelType,
2819
+ PkiAlertEventType,
2820
+ PkiAlertsResource,
2821
+ PkiCaResource,
2822
+ PkiCertificatesResource,
2823
+ PkiTemplatesResource,
2824
+ ProjectsResource,
2825
+ RESOURCE_AUTH_MODES,
2826
+ RateLimitError,
2827
+ SecretFoldersResource,
2828
+ SecretImportsResource,
2829
+ SecretSharingResource,
2830
+ SecretSyncsResource,
2831
+ SecretTagsResource,
2832
+ SecretsResource,
2833
+ ServiceTokensResource,
2834
+ UnauthorizedError,
2835
+ UsersResource,
2836
+ ValidationError,
2837
+ WebhooksResource
2838
+ });
2839
+ //# sourceMappingURL=index.js.map