@leaflow/sdk 0.0.0-dev.510.g8eb7f2e → 0.0.0-dev.516.g28eeab9
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/account/v1/generated/functions.d.ts +117 -1
- package/dist/account/v1/generated/functions.js +104 -0
- package/dist/account/v1/generated/models.d.ts +85 -0
- package/dist/account/v1/generated/models.js +9 -0
- package/dist/account/v1/generated/schemas.zod.d.ts +68 -0
- package/dist/account/v1/generated/schemas.zod.js +76 -0
- package/dist/account/v1/generated/validators/acceptConsentsRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/acceptConsentsRequestBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/acceptInvitationByTokenRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/acceptInvitationByTokenRequestBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/acceptedInvitationResponseBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/acceptedInvitationResponseBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/accountDeletionObjectionResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/accountDeletionObjectionResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/accountDeletionResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/accountDeletionResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/accountDeletionState.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/accountDeletionState.zod.js +18 -0
- package/dist/account/v1/generated/validators/accountResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/accountResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/agreementListResponseBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/agreementListResponseBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/agreementResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/agreementResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/applicationResource.zod.d.ts +60 -0
- package/dist/account/v1/generated/validators/applicationResource.zod.js +60 -0
- package/dist/account/v1/generated/validators/authorizeApplicationRequestBody.zod.d.ts +55 -0
- package/dist/account/v1/generated/validators/authorizeApplicationRequestBody.zod.js +53 -0
- package/dist/account/v1/generated/validators/authorizedApplicationResource.zod.d.ts +93 -0
- package/dist/account/v1/generated/validators/authorizedApplicationResource.zod.js +59 -0
- package/dist/account/v1/generated/validators/consentBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/consentBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/consentListResponseBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/consentListResponseBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/consentResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/consentResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/countryOption.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/countryOption.zod.js +18 -0
- package/dist/account/v1/generated/validators/createProjectRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/createProjectRequestBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/createSSHKeyRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/createSSHKeyRequestBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/cursorPagination.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/cursorPagination.zod.js +18 -0
- package/dist/account/v1/generated/validators/error.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/error.zod.js +18 -0
- package/dist/account/v1/generated/validators/errorStatus.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/errorStatus.zod.js +18 -0
- package/dist/account/v1/generated/validators/fieldViolation.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/fieldViolation.zod.js +18 -0
- package/dist/account/v1/generated/validators/grantResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/grantResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/identityVerificationResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/identityVerificationResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/invitationPreviewResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/invitationPreviewResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/invitationResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/invitationResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/languageOption.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/languageOption.zod.js +18 -0
- package/dist/account/v1/generated/validators/lengthAwarePageAuthorizedApplicationResource.zod.d.ts +98 -0
- package/dist/account/v1/generated/validators/lengthAwarePageAuthorizedApplicationResource.zod.js +55 -0
- package/dist/account/v1/generated/validators/lengthAwarePageInvitationResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/lengthAwarePageInvitationResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/lengthAwarePageProjectAccessResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/lengthAwarePageProjectAccessResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/lengthAwarePageSSHKeyResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/lengthAwarePageSSHKeyResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/listAuthorizedApplicationsParams.zod.d.ts +59 -0
- package/dist/account/v1/generated/validators/listAuthorizedApplicationsParams.zod.js +65 -0
- package/dist/account/v1/generated/validators/listMyInvitationsParams.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/listMyInvitationsParams.zod.js +18 -0
- package/dist/account/v1/generated/validators/listProjectsParams.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/listProjectsParams.zod.js +18 -0
- package/dist/account/v1/generated/validators/listSshKeysParams.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/listSshKeysParams.zod.js +18 -0
- package/dist/account/v1/generated/validators/locale.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/locale.zod.js +18 -0
- package/dist/account/v1/generated/validators/localeOptionsResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/localeOptionsResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/offsetPagination.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/offsetPagination.zod.js +18 -0
- package/dist/account/v1/generated/validators/previewInvitationByTokenParams.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/previewInvitationByTokenParams.zod.js +18 -0
- package/dist/account/v1/generated/validators/projectAccessList.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/projectAccessList.zod.js +18 -0
- package/dist/account/v1/generated/validators/projectAccessResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/projectAccessResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/projectResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/projectResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/projectSlugAvailabilityResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/projectSlugAvailabilityResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/projectStatus.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/projectStatus.zod.js +18 -0
- package/dist/account/v1/generated/validators/projectTraitResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/projectTraitResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/registerRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/registerRequestBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/renameSSHKeyRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/renameSSHKeyRequestBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/requestAccountDeletionParams.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/requestAccountDeletionParams.zod.js +18 -0
- package/dist/account/v1/generated/validators/resourceRefResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/resourceRefResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/ruleResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/ruleResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/sSHKeyResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/sSHKeyResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/scopedTokenResponseBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/scopedTokenResponseBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/searchProjectsRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/searchProjectsRequestBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/settingsResource.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/settingsResource.zod.js +18 -0
- package/dist/account/v1/generated/validators/submitIdentityVerificationRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/submitIdentityVerificationRequestBody.zod.js +18 -0
- package/dist/account/v1/generated/validators/updateAccountRequestBody.zod.d.ts +18 -0
- package/dist/account/v1/generated/validators/updateAccountRequestBody.zod.js +18 -0
- package/dist/compute/v2/generated/functions.d.ts +4 -2
- package/dist/compute/v2/generated/functions.js +3 -18
- package/dist/compute/v2/generated/models.d.ts +28 -8
- package/dist/compute/v2/generated/schemas.zod.d.ts +6 -3
- package/dist/compute/v2/generated/schemas.zod.js +2 -2
- package/dist/compute/v2/generated/validators/createInstanceRequestBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/createInstanceRequestBody.zod.js +4 -0
- package/dist/compute/v2/generated/validators/createInstanceResponseBody.zod.d.ts +3 -0
- package/dist/compute/v2/generated/validators/createLaunchTemplateRequestBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/createLaunchTemplateResponseBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/createPrivateImageResponseBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/deleteInstanceResponseBody.zod.d.ts +3 -0
- package/dist/compute/v2/generated/validators/deletePrivateImageResponseBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/instance.zod.d.ts +3 -0
- package/dist/compute/v2/generated/validators/instance.zod.js +10 -0
- package/dist/compute/v2/generated/validators/instanceListResponseBody.zod.d.ts +3 -0
- package/dist/compute/v2/generated/validators/launchTemplateVersion.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/launchTemplateVersion.zod.js +4 -0
- package/dist/compute/v2/generated/validators/launchTemplateVersionListResponseBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/newLaunchTemplateVersion.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/newLaunchTemplateVersion.zod.js +4 -0
- package/dist/compute/v2/generated/validators/privateImageListResponseBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/privateImageResource.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/privateImageResource.zod.js +3 -0
- package/dist/compute/v2/generated/validators/publicImageListResponseBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/publicImageResource.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/publicImageResource.zod.js +3 -0
- package/dist/compute/v2/generated/validators/rebuildInstanceRequestBody.zod.d.ts +1 -0
- package/dist/compute/v2/generated/validators/rebuildInstanceRequestBody.zod.js +4 -0
- package/dist/compute/v2/generated/validators/rebuildInstanceResponseBody.zod.d.ts +3 -0
- package/dist/compute/v2/generated/validators/rescueInstanceResponseBody.zod.d.ts +3 -0
- package/dist/compute/v2/generated/validators/updateInstanceResponseBody.zod.d.ts +3 -0
- package/dist/iam/v1/generated/functions.d.ts +9 -2
- package/dist/iam/v1/generated/functions.js +9 -2
- package/dist/iam/v1/generated/models.d.ts +1 -1
- package/dist/iam/v1/generated/schemas.zod.d.ts +9 -2
- package/dist/iam/v1/generated/schemas.zod.js +9 -2
- package/dist/iam/v1/generated/validators/createApplicationRequestBody.zod.js +1 -1
- package/dist/proto/leaflow/fleet/filetransfer/v1/filetransfer_pb.d.ts +12 -3
- package/dist/proto/leaflow/fleet/filetransfer/v1/filetransfer_pb.js +1 -1
- package/dist/proto/leaflow/fleet/virtualdesktop/datatransfer/v1/datatransfer_pb.d.ts +38 -1
- package/dist/routes.d.ts +32 -0
- package/dist/routes.js +36 -0
- package/package.json +1 -1
- package/dist/compute/v2/generated/validators/rescueInstanceRequestBody.zod.d.ts +0 -42
- package/dist/compute/v2/generated/validators/rescueInstanceRequestBody.zod.js +0 -44
|
@@ -16,6 +16,24 @@
|
|
|
16
16
|
*
|
|
17
17
|
* A scoped token cannot be renewed. Repeat step 2 for a new one, and sign in again at auth.leaflow.net once the access token itself has expired.
|
|
18
18
|
*
|
|
19
|
+
* ## Applications
|
|
20
|
+
*
|
|
21
|
+
* An application registered by a project signs its users in at auth.leaflow.net in the same manner as any other OAuth client. To call the Leaflow API on behalf of a user, the application requests the `iam` scope, and the user must then authorize the application for each project in which it is to act:
|
|
22
|
+
*
|
|
23
|
+
* 1. The application directs the user to the authorization page of the console:
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* https://console.leaflow.net/applications/authorize?client_id=<client_id>&redirect_uri=<redirect_uri>&state=<state>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* All three parameters are required. The `redirect_uri` is URL-encoded and must exactly match one of the redirect URIs registered for the application; a custom scheme registered for a public application is accepted in the same way. If a parameter is missing, if the `redirect_uri` does not match, or if the application does not exist or is not active, the page reports the problem to the user and does not redirect. A user who is not signed in, or who has not yet completed registration and accepted the agreements, does so first and then returns to the page.
|
|
30
|
+
* 2. The user selects a project and confirms the authorization. The console calls `POST /account/v1/me/authorized-applications` and returns the user to the `redirect_uri` with the query parameters `project_id` and `state`. If the user declines, the console returns the user to the `redirect_uri` with `error=access_denied` and `state`. In both cases the existing query parameters of the `redirect_uri` are retained, and a parameter of the same name is replaced. The application must verify that `state` equals the value it supplied before it uses the response.
|
|
31
|
+
* 3. The application exchanges its access token for a scoped token at `POST /account/v1/projects/{projectId}/scoped-tokens`, as described in the preceding section.
|
|
32
|
+
*
|
|
33
|
+
* Within an authorized project, the application holds exactly the permissions of the user in that project and none beyond them. The user may revoke an authorization at any time at https://console.leaflow.net/account/applications, and an authorization ends when the user leaves the project.
|
|
34
|
+
*
|
|
35
|
+
* An access token issued to an application is accepted only by `create-scoped-token`, `list-authorized-applications` and `revoke-authorized-application`. Every other endpoint rejects it with 403 `APPLICATION_TOKEN_NOT_ACCEPTED`; consequently, an application cannot authorize itself.
|
|
36
|
+
*
|
|
19
37
|
* ## SSH keys
|
|
20
38
|
*
|
|
21
39
|
* The SSH keys of an account belong to its holder rather than to any project, and a key is active on one account at most. Keys shared by a project, such as one used by CI, belong to the project instead and are managed through the IAM API.
|
|
@@ -27,7 +45,7 @@
|
|
|
27
45
|
* Looking up slugs and claiming custom slugs are rate limited per account. A request over the limit fails with 429, and `meta.retry_after_seconds` on the error states how many seconds to wait before retrying.
|
|
28
46
|
* OpenAPI spec version: 1.0.0
|
|
29
47
|
*/
|
|
30
|
-
import type { AcceptConsentsRequestBody, AcceptInvitationByTokenRequestBody, AcceptedInvitationResponseBody, AccountDeletionResource, AccountResource, AgreementListResponseBody, ConsentListResponseBody, CreateProjectRequestBody, CreateSSHKeyRequestBody, Error, IdentityVerificationResource, InvitationPreviewResource, LengthAwarePageInvitationResource, LengthAwarePageProjectAccessResource, LengthAwarePageSSHKeyResource, ListMyInvitationsParams, ListProjectsParams, ListSshKeysParams, LocaleOptionsResource, PreviewInvitationByTokenParams, ProjectAccessList, ProjectAccessResource, ProjectSlugAvailabilityResource, RegisterRequestBody, RenameSSHKeyRequestBody, RequestAccountDeletionParams, SSHKeyResource, ScopedTokenResponseBody, SearchProjectsRequestBody, SettingsResource, SubmitIdentityVerificationRequestBody, UpdateAccountRequestBody } from "./models.js";
|
|
48
|
+
import type { AcceptConsentsRequestBody, AcceptInvitationByTokenRequestBody, AcceptedInvitationResponseBody, AccountDeletionResource, AccountResource, AgreementListResponseBody, ApplicationResource, AuthorizeApplicationRequestBody, AuthorizedApplicationResource, ConsentListResponseBody, CreateProjectRequestBody, CreateSSHKeyRequestBody, Error, IdentityVerificationResource, InvitationPreviewResource, LengthAwarePageAuthorizedApplicationResource, LengthAwarePageInvitationResource, LengthAwarePageProjectAccessResource, LengthAwarePageSSHKeyResource, ListAuthorizedApplicationsParams, ListMyInvitationsParams, ListProjectsParams, ListSshKeysParams, LocaleOptionsResource, PreviewInvitationByTokenParams, ProjectAccessList, ProjectAccessResource, ProjectSlugAvailabilityResource, RegisterRequestBody, RenameSSHKeyRequestBody, RequestAccountDeletionParams, SSHKeyResource, ScopedTokenResponseBody, SearchProjectsRequestBody, SettingsResource, SubmitIdentityVerificationRequestBody, UpdateAccountRequestBody } from "./models.js";
|
|
31
49
|
export type HTTPStatusCode1xx = 100 | 101 | 102 | 103;
|
|
32
50
|
export type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;
|
|
33
51
|
export type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;
|
|
@@ -438,6 +456,102 @@ export declare const getRevokeSshKeyUrl: (keyId: string) => string;
|
|
|
438
456
|
* @summary Revoke an SSH key of the current account
|
|
439
457
|
*/
|
|
440
458
|
export declare const revokeSshKey: (keyId: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<revokeSshKeyResponse>;
|
|
459
|
+
export type getApplicationResponse200 = {
|
|
460
|
+
data: ApplicationResource;
|
|
461
|
+
status: 200;
|
|
462
|
+
};
|
|
463
|
+
export type getApplicationResponseDefault = {
|
|
464
|
+
data: Error;
|
|
465
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
466
|
+
};
|
|
467
|
+
export type getApplicationResponseSuccess = getApplicationResponse200 & {
|
|
468
|
+
headers: Headers;
|
|
469
|
+
};
|
|
470
|
+
export type getApplicationResponseError = getApplicationResponseDefault & {
|
|
471
|
+
headers: Headers;
|
|
472
|
+
};
|
|
473
|
+
export type getApplicationResponse = getApplicationResponseSuccess | getApplicationResponseError;
|
|
474
|
+
export declare const getGetApplicationUrl: (clientId: string) => string;
|
|
475
|
+
/**
|
|
476
|
+
* Returns the application requesting authorization, so that the authorization page can identify the requester. Any authenticated account may read it, since the `client_id` is part of every authorization request.
|
|
477
|
+
*
|
|
478
|
+
* A deleted application is reported as not found. A disabled application is returned with `status` `DISABLED` and cannot be authorized.
|
|
479
|
+
*
|
|
480
|
+
* The authorization page returns the user only to a `redirect_uri` that exactly matches one of `redirect_uris`; if none matches, the user is not redirected.
|
|
481
|
+
* @summary Get an application by its client ID
|
|
482
|
+
*/
|
|
483
|
+
export declare const getApplication: (clientId: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getApplicationResponse>;
|
|
484
|
+
export type listAuthorizedApplicationsResponse200 = {
|
|
485
|
+
data: LengthAwarePageAuthorizedApplicationResource;
|
|
486
|
+
status: 200;
|
|
487
|
+
};
|
|
488
|
+
export type listAuthorizedApplicationsResponseDefault = {
|
|
489
|
+
data: Error;
|
|
490
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
491
|
+
};
|
|
492
|
+
export type listAuthorizedApplicationsResponseSuccess = listAuthorizedApplicationsResponse200 & {
|
|
493
|
+
headers: Headers;
|
|
494
|
+
};
|
|
495
|
+
export type listAuthorizedApplicationsResponseError = listAuthorizedApplicationsResponseDefault & {
|
|
496
|
+
headers: Headers;
|
|
497
|
+
};
|
|
498
|
+
export type listAuthorizedApplicationsResponse = listAuthorizedApplicationsResponseSuccess | listAuthorizedApplicationsResponseError;
|
|
499
|
+
export declare const getListAuthorizedApplicationsUrl: (params?: ListAuthorizedApplicationsParams) => string;
|
|
500
|
+
/**
|
|
501
|
+
* Returns one item for each application and project, most recent first. An authorization is omitted once it has been revoked, once the membership under which it was granted has ended, or once the application has been deleted.
|
|
502
|
+
*
|
|
503
|
+
* When called with an access token issued to an application, only the authorizations of that application are returned.
|
|
504
|
+
* @summary List the applications the current account has authorized
|
|
505
|
+
*/
|
|
506
|
+
export declare const listAuthorizedApplications: (params?: ListAuthorizedApplicationsParams, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listAuthorizedApplicationsResponse>;
|
|
507
|
+
export type authorizeApplicationResponse201 = {
|
|
508
|
+
data: AuthorizedApplicationResource;
|
|
509
|
+
status: 201;
|
|
510
|
+
};
|
|
511
|
+
export type authorizeApplicationResponseDefault = {
|
|
512
|
+
data: Error;
|
|
513
|
+
status: Exclude<HTTPStatusCodes, 201>;
|
|
514
|
+
};
|
|
515
|
+
export type authorizeApplicationResponseSuccess = authorizeApplicationResponse201 & {
|
|
516
|
+
headers: Headers;
|
|
517
|
+
};
|
|
518
|
+
export type authorizeApplicationResponseError = authorizeApplicationResponseDefault & {
|
|
519
|
+
headers: Headers;
|
|
520
|
+
};
|
|
521
|
+
export type authorizeApplicationResponse = authorizeApplicationResponseSuccess | authorizeApplicationResponseError;
|
|
522
|
+
export declare const getAuthorizeApplicationUrl: () => string;
|
|
523
|
+
/**
|
|
524
|
+
* Permits the application to exchange the access tokens of this account for scoped tokens of the project. Within the project, the application then holds exactly the permissions of this account and none beyond them.
|
|
525
|
+
*
|
|
526
|
+
* The caller must be a member of the project. Repeating the request returns the existing authorization. Authorizing a disabled application fails with 412 `APPLICATION_DISABLED`.
|
|
527
|
+
*
|
|
528
|
+
* An access token issued to an application is rejected, so that an application cannot authorize itself.
|
|
529
|
+
* @summary Authorize an application to act in a project
|
|
530
|
+
*/
|
|
531
|
+
export declare const authorizeApplication: (authorizeApplicationRequestBody: AuthorizeApplicationRequestBody, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<authorizeApplicationResponse>;
|
|
532
|
+
export type revokeAuthorizedApplicationResponse200 = {
|
|
533
|
+
data: AuthorizedApplicationResource;
|
|
534
|
+
status: 200;
|
|
535
|
+
};
|
|
536
|
+
export type revokeAuthorizedApplicationResponseDefault = {
|
|
537
|
+
data: Error;
|
|
538
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
539
|
+
};
|
|
540
|
+
export type revokeAuthorizedApplicationResponseSuccess = revokeAuthorizedApplicationResponse200 & {
|
|
541
|
+
headers: Headers;
|
|
542
|
+
};
|
|
543
|
+
export type revokeAuthorizedApplicationResponseError = revokeAuthorizedApplicationResponseDefault & {
|
|
544
|
+
headers: Headers;
|
|
545
|
+
};
|
|
546
|
+
export type revokeAuthorizedApplicationResponse = revokeAuthorizedApplicationResponseSuccess | revokeAuthorizedApplicationResponseError;
|
|
547
|
+
export declare const getRevokeAuthorizedApplicationUrl: (authorizationId: string) => string;
|
|
548
|
+
/**
|
|
549
|
+
* After revocation, the application can no longer exchange tokens for the project. A scoped token already issued to it remains valid until it expires. Repeating the request returns the same authorization.
|
|
550
|
+
*
|
|
551
|
+
* When called with an access token issued to an application, only the authorizations of that application can be revoked; this allows an application to disconnect itself.
|
|
552
|
+
* @summary Revoke an application's authorization
|
|
553
|
+
*/
|
|
554
|
+
export declare const revokeAuthorizedApplication: (authorizationId: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<revokeAuthorizedApplicationResponse>;
|
|
441
555
|
export type listMyInvitationsResponse200 = {
|
|
442
556
|
data: LengthAwarePageInvitationResource;
|
|
443
557
|
status: 200;
|
|
@@ -701,6 +815,8 @@ export declare const getCreateScopedTokenUrl: (projectId: string) => string;
|
|
|
701
815
|
* A scoped token states identity only — the user and the project — and **carries no permissions**. Permissions are evaluated on every request, so a change of role takes effect immediately rather than at the next expiry.
|
|
702
816
|
*
|
|
703
817
|
* A project that is suspended, banned or being deleted still issues tokens; those states restrict writes, and the project remains readable.
|
|
818
|
+
*
|
|
819
|
+
* An access token issued to an application is exchanged only for a project for which the user has authorized that application. Otherwise, the exchange fails with 403 `APPLICATION_AUTHORIZATION_REQUIRED`, whose `meta` contains the `client_id` and the `project_id`; the application should then direct the user to the authorization page. For a disabled application the exchange fails with 412 `APPLICATION_DISABLED`, and for a deleted application with 404 `APPLICATION_NOT_FOUND`, even if its access token has not yet expired.
|
|
704
820
|
* @summary Exchange the access token for a scoped token
|
|
705
821
|
*/
|
|
706
822
|
export declare const createScopedToken: (projectId: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createScopedTokenResponse>;
|
|
@@ -432,6 +432,108 @@ export const revokeSshKey = async (keyId, options, fetchFn) => {
|
|
|
432
432
|
const data = body ? JSON.parse(body) : {};
|
|
433
433
|
return { data, status: res.status, headers: res.headers };
|
|
434
434
|
};
|
|
435
|
+
export const getGetApplicationUrl = (clientId) => {
|
|
436
|
+
return `https://account.leaflow.cloud/account/v1/applications/${encodeURIComponent(String(clientId))}`;
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* Returns the application requesting authorization, so that the authorization page can identify the requester. Any authenticated account may read it, since the `client_id` is part of every authorization request.
|
|
440
|
+
*
|
|
441
|
+
* A deleted application is reported as not found. A disabled application is returned with `status` `DISABLED` and cannot be authorized.
|
|
442
|
+
*
|
|
443
|
+
* The authorization page returns the user only to a `redirect_uri` that exactly matches one of `redirect_uris`; if none matches, the user is not redirected.
|
|
444
|
+
* @summary Get an application by its client ID
|
|
445
|
+
*/
|
|
446
|
+
export const getApplication = async (clientId, options, fetchFn) => {
|
|
447
|
+
const res = await (fetchFn ?? fetch)(getGetApplicationUrl(clientId), {
|
|
448
|
+
...options,
|
|
449
|
+
method: "GET",
|
|
450
|
+
});
|
|
451
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
452
|
+
const data = body ? JSON.parse(body) : {};
|
|
453
|
+
return { data, status: res.status, headers: res.headers };
|
|
454
|
+
};
|
|
455
|
+
export const getListAuthorizedApplicationsUrl = (params) => {
|
|
456
|
+
const normalizedParams = new URLSearchParams();
|
|
457
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
458
|
+
if (value !== undefined) {
|
|
459
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
const stringifiedParams = normalizedParams.toString();
|
|
463
|
+
return stringifiedParams.length > 0
|
|
464
|
+
? `https://account.leaflow.cloud/account/v1/me/authorized-applications?${stringifiedParams}`
|
|
465
|
+
: `https://account.leaflow.cloud/account/v1/me/authorized-applications`;
|
|
466
|
+
};
|
|
467
|
+
/**
|
|
468
|
+
* Returns one item for each application and project, most recent first. An authorization is omitted once it has been revoked, once the membership under which it was granted has ended, or once the application has been deleted.
|
|
469
|
+
*
|
|
470
|
+
* When called with an access token issued to an application, only the authorizations of that application are returned.
|
|
471
|
+
* @summary List the applications the current account has authorized
|
|
472
|
+
*/
|
|
473
|
+
export const listAuthorizedApplications = async (params, options, fetchFn) => {
|
|
474
|
+
const res = await (fetchFn ?? fetch)(getListAuthorizedApplicationsUrl(params), {
|
|
475
|
+
...options,
|
|
476
|
+
method: "GET",
|
|
477
|
+
});
|
|
478
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
479
|
+
const data = body ? JSON.parse(body) : {};
|
|
480
|
+
return { data, status: res.status, headers: res.headers };
|
|
481
|
+
};
|
|
482
|
+
export const getAuthorizeApplicationUrl = () => {
|
|
483
|
+
return `https://account.leaflow.cloud/account/v1/me/authorized-applications`;
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* Permits the application to exchange the access tokens of this account for scoped tokens of the project. Within the project, the application then holds exactly the permissions of this account and none beyond them.
|
|
487
|
+
*
|
|
488
|
+
* The caller must be a member of the project. Repeating the request returns the existing authorization. Authorizing a disabled application fails with 412 `APPLICATION_DISABLED`.
|
|
489
|
+
*
|
|
490
|
+
* An access token issued to an application is rejected, so that an application cannot authorize itself.
|
|
491
|
+
* @summary Authorize an application to act in a project
|
|
492
|
+
*/
|
|
493
|
+
export const authorizeApplication = async (authorizeApplicationRequestBody, options, fetchFn) => {
|
|
494
|
+
const getHeaders = (h) => {
|
|
495
|
+
if (!h)
|
|
496
|
+
return {};
|
|
497
|
+
if (h instanceof Headers)
|
|
498
|
+
return Object.fromEntries(h.entries());
|
|
499
|
+
if (Symbol.iterator in h) {
|
|
500
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
501
|
+
}
|
|
502
|
+
const headers = {};
|
|
503
|
+
for (const [name, value] of Object.entries(h)) {
|
|
504
|
+
if (value !== undefined)
|
|
505
|
+
headers[name] = value;
|
|
506
|
+
}
|
|
507
|
+
return headers;
|
|
508
|
+
};
|
|
509
|
+
const res = await (fetchFn ?? fetch)(getAuthorizeApplicationUrl(), {
|
|
510
|
+
...options,
|
|
511
|
+
method: "POST",
|
|
512
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
513
|
+
body: JSON.stringify(authorizeApplicationRequestBody),
|
|
514
|
+
});
|
|
515
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
516
|
+
const data = body ? JSON.parse(body) : {};
|
|
517
|
+
return { data, status: res.status, headers: res.headers };
|
|
518
|
+
};
|
|
519
|
+
export const getRevokeAuthorizedApplicationUrl = (authorizationId) => {
|
|
520
|
+
return `https://account.leaflow.cloud/account/v1/me/authorized-applications/${encodeURIComponent(String(authorizationId))}`;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* After revocation, the application can no longer exchange tokens for the project. A scoped token already issued to it remains valid until it expires. Repeating the request returns the same authorization.
|
|
524
|
+
*
|
|
525
|
+
* When called with an access token issued to an application, only the authorizations of that application can be revoked; this allows an application to disconnect itself.
|
|
526
|
+
* @summary Revoke an application's authorization
|
|
527
|
+
*/
|
|
528
|
+
export const revokeAuthorizedApplication = async (authorizationId, options, fetchFn) => {
|
|
529
|
+
const res = await (fetchFn ?? fetch)(getRevokeAuthorizedApplicationUrl(authorizationId), {
|
|
530
|
+
...options,
|
|
531
|
+
method: "DELETE",
|
|
532
|
+
});
|
|
533
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
534
|
+
const data = body ? JSON.parse(body) : {};
|
|
535
|
+
return { data, status: res.status, headers: res.headers };
|
|
536
|
+
};
|
|
435
537
|
export const getListMyInvitationsUrl = (params) => {
|
|
436
538
|
const normalizedParams = new URLSearchParams();
|
|
437
539
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -710,6 +812,8 @@ export const getCreateScopedTokenUrl = (projectId) => {
|
|
|
710
812
|
* A scoped token states identity only — the user and the project — and **carries no permissions**. Permissions are evaluated on every request, so a change of role takes effect immediately rather than at the next expiry.
|
|
711
813
|
*
|
|
712
814
|
* A project that is suspended, banned or being deleted still issues tokens; those states restrict writes, and the project remains readable.
|
|
815
|
+
*
|
|
816
|
+
* An access token issued to an application is exchanged only for a project for which the user has authorized that application. Otherwise, the exchange fails with 403 `APPLICATION_AUTHORIZATION_REQUIRED`, whose `meta` contains the `client_id` and the `project_id`; the application should then direct the user to the authorization page. For a disabled application the exchange fails with 412 `APPLICATION_DISABLED`, and for a deleted application with 404 `APPLICATION_NOT_FOUND`, even if its access token has not yet expired.
|
|
713
817
|
* @summary Exchange the access token for a scoped token
|
|
714
818
|
*/
|
|
715
819
|
export const createScopedToken = async (projectId, options, fetchFn) => {
|
|
@@ -16,6 +16,24 @@
|
|
|
16
16
|
*
|
|
17
17
|
* A scoped token cannot be renewed. Repeat step 2 for a new one, and sign in again at auth.leaflow.net once the access token itself has expired.
|
|
18
18
|
*
|
|
19
|
+
* ## Applications
|
|
20
|
+
*
|
|
21
|
+
* An application registered by a project signs its users in at auth.leaflow.net in the same manner as any other OAuth client. To call the Leaflow API on behalf of a user, the application requests the `iam` scope, and the user must then authorize the application for each project in which it is to act:
|
|
22
|
+
*
|
|
23
|
+
* 1. The application directs the user to the authorization page of the console:
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* https://console.leaflow.net/applications/authorize?client_id=<client_id>&redirect_uri=<redirect_uri>&state=<state>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* All three parameters are required. The `redirect_uri` is URL-encoded and must exactly match one of the redirect URIs registered for the application; a custom scheme registered for a public application is accepted in the same way. If a parameter is missing, if the `redirect_uri` does not match, or if the application does not exist or is not active, the page reports the problem to the user and does not redirect. A user who is not signed in, or who has not yet completed registration and accepted the agreements, does so first and then returns to the page.
|
|
30
|
+
* 2. The user selects a project and confirms the authorization. The console calls `POST /account/v1/me/authorized-applications` and returns the user to the `redirect_uri` with the query parameters `project_id` and `state`. If the user declines, the console returns the user to the `redirect_uri` with `error=access_denied` and `state`. In both cases the existing query parameters of the `redirect_uri` are retained, and a parameter of the same name is replaced. The application must verify that `state` equals the value it supplied before it uses the response.
|
|
31
|
+
* 3. The application exchanges its access token for a scoped token at `POST /account/v1/projects/{projectId}/scoped-tokens`, as described in the preceding section.
|
|
32
|
+
*
|
|
33
|
+
* Within an authorized project, the application holds exactly the permissions of the user in that project and none beyond them. The user may revoke an authorization at any time at https://console.leaflow.net/account/applications, and an authorization ends when the user leaves the project.
|
|
34
|
+
*
|
|
35
|
+
* An access token issued to an application is accepted only by `create-scoped-token`, `list-authorized-applications` and `revoke-authorized-application`. Every other endpoint rejects it with 403 `APPLICATION_TOKEN_NOT_ACCEPTED`; consequently, an application cannot authorize itself.
|
|
36
|
+
*
|
|
19
37
|
* ## SSH keys
|
|
20
38
|
*
|
|
21
39
|
* The SSH keys of an account belong to its holder rather than to any project, and a key is active on one account at most. Keys shared by a project, such as one used by CI, belong to the project instead and are managed through the IAM API.
|
|
@@ -416,6 +434,59 @@ export interface RenameSSHKeyRequestBody {
|
|
|
416
434
|
*/
|
|
417
435
|
name: string;
|
|
418
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* `ARCHIVED` appears only within an authorization, after the application has been deleted
|
|
439
|
+
*/
|
|
440
|
+
export type ApplicationResourceStatus = (typeof ApplicationResourceStatus)[keyof typeof ApplicationResourceStatus];
|
|
441
|
+
export declare const ApplicationResourceStatus: {
|
|
442
|
+
readonly ACTIVE: "ACTIVE";
|
|
443
|
+
readonly DISABLED: "DISABLED";
|
|
444
|
+
readonly ARCHIVED: "ARCHIVED";
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* An application, as presented to an account that is asked to authorize it
|
|
448
|
+
*/
|
|
449
|
+
export interface ApplicationResource {
|
|
450
|
+
client_id: string;
|
|
451
|
+
name: string;
|
|
452
|
+
/** The URIs to which the user may be returned; a `redirect_uri` must match one of them exactly */
|
|
453
|
+
redirect_uris: string[];
|
|
454
|
+
/** `ARCHIVED` appears only within an authorization, after the application has been deleted */
|
|
455
|
+
status: ApplicationResourceStatus;
|
|
456
|
+
}
|
|
457
|
+
export type AuthorizedApplicationResourceStatus = (typeof AuthorizedApplicationResourceStatus)[keyof typeof AuthorizedApplicationResourceStatus];
|
|
458
|
+
export declare const AuthorizedApplicationResourceStatus: {
|
|
459
|
+
readonly ACTIVE: "ACTIVE";
|
|
460
|
+
readonly REVOKED: "REVOKED";
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* An application that the account has authorized to act in one of its projects
|
|
464
|
+
*/
|
|
465
|
+
export interface AuthorizedApplicationResource {
|
|
466
|
+
id: string;
|
|
467
|
+
application: ApplicationResource;
|
|
468
|
+
project: ProjectResource;
|
|
469
|
+
status: AuthorizedApplicationResourceStatus;
|
|
470
|
+
created_at: string;
|
|
471
|
+
}
|
|
472
|
+
export interface LengthAwarePageAuthorizedApplicationResource {
|
|
473
|
+
/** The items in this page */
|
|
474
|
+
items: AuthorizedApplicationResource[];
|
|
475
|
+
/** Maximum number of items in this page, echoing the request */
|
|
476
|
+
limit: number;
|
|
477
|
+
/** Number of items skipped, echoing the request */
|
|
478
|
+
offset: number;
|
|
479
|
+
/** Total number of matches, not only this page */
|
|
480
|
+
total: number;
|
|
481
|
+
}
|
|
482
|
+
export interface AuthorizeApplicationRequestBody {
|
|
483
|
+
/**
|
|
484
|
+
* @minLength 1
|
|
485
|
+
* @maxLength 255
|
|
486
|
+
*/
|
|
487
|
+
client_id: string;
|
|
488
|
+
project_id: string;
|
|
489
|
+
}
|
|
419
490
|
/**
|
|
420
491
|
* What an invitation states before it is accepted. It carries neither the invitation id nor the full recipient address; the invitations listed against the current account are returned by `list-my-invitations`
|
|
421
492
|
*/
|
|
@@ -648,6 +719,20 @@ export declare const ListSshKeysStatus: {
|
|
|
648
719
|
readonly ACTIVE: "ACTIVE";
|
|
649
720
|
readonly REVOKED: "REVOKED";
|
|
650
721
|
};
|
|
722
|
+
export type ListAuthorizedApplicationsParams = {
|
|
723
|
+
/**
|
|
724
|
+
* Items returned in this page. Defaults to 50; at most 200.
|
|
725
|
+
* @minimum 1
|
|
726
|
+
* @maximum 200
|
|
727
|
+
*/
|
|
728
|
+
limit?: number;
|
|
729
|
+
/**
|
|
730
|
+
* Items to skip. Defaults to 0; at most 10000.
|
|
731
|
+
* @minimum 0
|
|
732
|
+
* @maximum 10000
|
|
733
|
+
*/
|
|
734
|
+
offset?: number;
|
|
735
|
+
};
|
|
651
736
|
export type ListMyInvitationsParams = {
|
|
652
737
|
/**
|
|
653
738
|
* Items returned in this page. Defaults to 50; at most 200.
|
|
@@ -64,6 +64,15 @@ export const SSHKeyResourceStatus = {
|
|
|
64
64
|
ACTIVE: "ACTIVE",
|
|
65
65
|
REVOKED: "REVOKED",
|
|
66
66
|
};
|
|
67
|
+
export const ApplicationResourceStatus = {
|
|
68
|
+
ACTIVE: "ACTIVE",
|
|
69
|
+
DISABLED: "DISABLED",
|
|
70
|
+
ARCHIVED: "ARCHIVED",
|
|
71
|
+
};
|
|
72
|
+
export const AuthorizedApplicationResourceStatus = {
|
|
73
|
+
ACTIVE: "ACTIVE",
|
|
74
|
+
REVOKED: "REVOKED",
|
|
75
|
+
};
|
|
67
76
|
export const RuleResourceEffect = {
|
|
68
77
|
allow: "allow",
|
|
69
78
|
deny: "deny",
|
|
@@ -16,6 +16,24 @@
|
|
|
16
16
|
*
|
|
17
17
|
* A scoped token cannot be renewed. Repeat step 2 for a new one, and sign in again at auth.leaflow.net once the access token itself has expired.
|
|
18
18
|
*
|
|
19
|
+
* ## Applications
|
|
20
|
+
*
|
|
21
|
+
* An application registered by a project signs its users in at auth.leaflow.net in the same manner as any other OAuth client. To call the Leaflow API on behalf of a user, the application requests the `iam` scope, and the user must then authorize the application for each project in which it is to act:
|
|
22
|
+
*
|
|
23
|
+
* 1. The application directs the user to the authorization page of the console:
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* https://console.leaflow.net/applications/authorize?client_id=<client_id>&redirect_uri=<redirect_uri>&state=<state>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* All three parameters are required. The `redirect_uri` is URL-encoded and must exactly match one of the redirect URIs registered for the application; a custom scheme registered for a public application is accepted in the same way. If a parameter is missing, if the `redirect_uri` does not match, or if the application does not exist or is not active, the page reports the problem to the user and does not redirect. A user who is not signed in, or who has not yet completed registration and accepted the agreements, does so first and then returns to the page.
|
|
30
|
+
* 2. The user selects a project and confirms the authorization. The console calls `POST /account/v1/me/authorized-applications` and returns the user to the `redirect_uri` with the query parameters `project_id` and `state`. If the user declines, the console returns the user to the `redirect_uri` with `error=access_denied` and `state`. In both cases the existing query parameters of the `redirect_uri` are retained, and a parameter of the same name is replaced. The application must verify that `state` equals the value it supplied before it uses the response.
|
|
31
|
+
* 3. The application exchanges its access token for a scoped token at `POST /account/v1/projects/{projectId}/scoped-tokens`, as described in the preceding section.
|
|
32
|
+
*
|
|
33
|
+
* Within an authorized project, the application holds exactly the permissions of the user in that project and none beyond them. The user may revoke an authorization at any time at https://console.leaflow.net/account/applications, and an authorization ends when the user leaves the project.
|
|
34
|
+
*
|
|
35
|
+
* An access token issued to an application is accepted only by `create-scoped-token`, `list-authorized-applications` and `revoke-authorized-application`. Every other endpoint rejects it with 403 `APPLICATION_TOKEN_NOT_ACCEPTED`; consequently, an application cannot authorize itself.
|
|
36
|
+
*
|
|
19
37
|
* ## SSH keys
|
|
20
38
|
*
|
|
21
39
|
* The SSH keys of an account belong to its holder rather than to any project, and a key is active on one account at most. Keys shared by a project, such as one used by CI, belong to the project instead and are managed through the IAM API.
|
|
@@ -150,6 +168,54 @@ export declare const RenameSshKeyBody: zod.ZodObject<{
|
|
|
150
168
|
export declare const RevokeSshKeyParams: zod.ZodObject<{
|
|
151
169
|
keyId: zod.ZodUUID;
|
|
152
170
|
}, zod.z.core.$strict>;
|
|
171
|
+
/**
|
|
172
|
+
* Returns the application requesting authorization, so that the authorization page can identify the requester. Any authenticated account may read it, since the `client_id` is part of every authorization request.
|
|
173
|
+
*
|
|
174
|
+
* A deleted application is reported as not found. A disabled application is returned with `status` `DISABLED` and cannot be authorized.
|
|
175
|
+
*
|
|
176
|
+
* The authorization page returns the user only to a `redirect_uri` that exactly matches one of `redirect_uris`; if none matches, the user is not redirected.
|
|
177
|
+
* @summary Get an application by its client ID
|
|
178
|
+
*/
|
|
179
|
+
export declare const getApplicationPathClientIdMax = 255;
|
|
180
|
+
export declare const GetApplicationParams: zod.ZodObject<{
|
|
181
|
+
clientId: zod.ZodString;
|
|
182
|
+
}, zod.z.core.$strict>;
|
|
183
|
+
/**
|
|
184
|
+
* Returns one item for each application and project, most recent first. An authorization is omitted once it has been revoked, once the membership under which it was granted has ended, or once the application has been deleted.
|
|
185
|
+
*
|
|
186
|
+
* When called with an access token issued to an application, only the authorizations of that application are returned.
|
|
187
|
+
* @summary List the applications the current account has authorized
|
|
188
|
+
*/
|
|
189
|
+
export declare const listAuthorizedApplicationsQueryLimitDefault = 50;
|
|
190
|
+
export declare const listAuthorizedApplicationsQueryLimitMax = 200;
|
|
191
|
+
export declare const listAuthorizedApplicationsQueryOffsetDefault = 0;
|
|
192
|
+
export declare const listAuthorizedApplicationsQueryOffsetMin = 0;
|
|
193
|
+
export declare const listAuthorizedApplicationsQueryOffsetMax = 10000;
|
|
194
|
+
export declare const ListAuthorizedApplicationsQueryParams: zod.ZodObject<{
|
|
195
|
+
limit: zod.ZodDefault<zod.ZodInt>;
|
|
196
|
+
offset: zod.ZodDefault<zod.ZodInt>;
|
|
197
|
+
}, zod.z.core.$strict>;
|
|
198
|
+
/**
|
|
199
|
+
* Permits the application to exchange the access tokens of this account for scoped tokens of the project. Within the project, the application then holds exactly the permissions of this account and none beyond them.
|
|
200
|
+
*
|
|
201
|
+
* The caller must be a member of the project. Repeating the request returns the existing authorization. Authorizing a disabled application fails with 412 `APPLICATION_DISABLED`.
|
|
202
|
+
*
|
|
203
|
+
* An access token issued to an application is rejected, so that an application cannot authorize itself.
|
|
204
|
+
* @summary Authorize an application to act in a project
|
|
205
|
+
*/
|
|
206
|
+
export declare const AuthorizeApplicationBody: zod.ZodObject<{
|
|
207
|
+
client_id: zod.ZodString;
|
|
208
|
+
project_id: zod.ZodUUID;
|
|
209
|
+
}, zod.z.core.$strict>;
|
|
210
|
+
/**
|
|
211
|
+
* After revocation, the application can no longer exchange tokens for the project. A scoped token already issued to it remains valid until it expires. Repeating the request returns the same authorization.
|
|
212
|
+
*
|
|
213
|
+
* When called with an access token issued to an application, only the authorizations of that application can be revoked; this allows an application to disconnect itself.
|
|
214
|
+
* @summary Revoke an application's authorization
|
|
215
|
+
*/
|
|
216
|
+
export declare const RevokeAuthorizedApplicationParams: zod.ZodObject<{
|
|
217
|
+
authorizationId: zod.ZodUUID;
|
|
218
|
+
}, zod.z.core.$strict>;
|
|
153
219
|
/**
|
|
154
220
|
* Matched against the email address of the current account.
|
|
155
221
|
* @summary List invitations addressed to the caller
|
|
@@ -271,6 +337,8 @@ export declare const GetProjectSlugAvailabilityParams: zod.ZodObject<{
|
|
|
271
337
|
* A scoped token states identity only — the user and the project — and **carries no permissions**. Permissions are evaluated on every request, so a change of role takes effect immediately rather than at the next expiry.
|
|
272
338
|
*
|
|
273
339
|
* A project that is suspended, banned or being deleted still issues tokens; those states restrict writes, and the project remains readable.
|
|
340
|
+
*
|
|
341
|
+
* An access token issued to an application is exchanged only for a project for which the user has authorized that application. Otherwise, the exchange fails with 403 `APPLICATION_AUTHORIZATION_REQUIRED`, whose `meta` contains the `client_id` and the `project_id`; the application should then direct the user to the authorization page. For a disabled application the exchange fails with 412 `APPLICATION_DISABLED`, and for a deleted application with 404 `APPLICATION_NOT_FOUND`, even if its access token has not yet expired.
|
|
274
342
|
* @summary Exchange the access token for a scoped token
|
|
275
343
|
*/
|
|
276
344
|
export declare const CreateScopedTokenParams: zod.ZodObject<{
|
|
@@ -16,6 +16,24 @@
|
|
|
16
16
|
*
|
|
17
17
|
* A scoped token cannot be renewed. Repeat step 2 for a new one, and sign in again at auth.leaflow.net once the access token itself has expired.
|
|
18
18
|
*
|
|
19
|
+
* ## Applications
|
|
20
|
+
*
|
|
21
|
+
* An application registered by a project signs its users in at auth.leaflow.net in the same manner as any other OAuth client. To call the Leaflow API on behalf of a user, the application requests the `iam` scope, and the user must then authorize the application for each project in which it is to act:
|
|
22
|
+
*
|
|
23
|
+
* 1. The application directs the user to the authorization page of the console:
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* https://console.leaflow.net/applications/authorize?client_id=<client_id>&redirect_uri=<redirect_uri>&state=<state>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* All three parameters are required. The `redirect_uri` is URL-encoded and must exactly match one of the redirect URIs registered for the application; a custom scheme registered for a public application is accepted in the same way. If a parameter is missing, if the `redirect_uri` does not match, or if the application does not exist or is not active, the page reports the problem to the user and does not redirect. A user who is not signed in, or who has not yet completed registration and accepted the agreements, does so first and then returns to the page.
|
|
30
|
+
* 2. The user selects a project and confirms the authorization. The console calls `POST /account/v1/me/authorized-applications` and returns the user to the `redirect_uri` with the query parameters `project_id` and `state`. If the user declines, the console returns the user to the `redirect_uri` with `error=access_denied` and `state`. In both cases the existing query parameters of the `redirect_uri` are retained, and a parameter of the same name is replaced. The application must verify that `state` equals the value it supplied before it uses the response.
|
|
31
|
+
* 3. The application exchanges its access token for a scoped token at `POST /account/v1/projects/{projectId}/scoped-tokens`, as described in the preceding section.
|
|
32
|
+
*
|
|
33
|
+
* Within an authorized project, the application holds exactly the permissions of the user in that project and none beyond them. The user may revoke an authorization at any time at https://console.leaflow.net/account/applications, and an authorization ends when the user leaves the project.
|
|
34
|
+
*
|
|
35
|
+
* An access token issued to an application is accepted only by `create-scoped-token`, `list-authorized-applications` and `revoke-authorized-application`. Every other endpoint rejects it with 403 `APPLICATION_TOKEN_NOT_ACCEPTED`; consequently, an application cannot authorize itself.
|
|
36
|
+
*
|
|
19
37
|
* ## SSH keys
|
|
20
38
|
*
|
|
21
39
|
* The SSH keys of an account belong to its holder rather than to any project, and a key is active on one account at most. Keys shared by a project, such as one used by CI, belong to the project instead and are managed through the IAM API.
|
|
@@ -30,6 +48,7 @@
|
|
|
30
48
|
import * as zod from "zod";
|
|
31
49
|
import { AcceptConsentsRequestBody } from "./validators/acceptConsentsRequestBody.zod.js";
|
|
32
50
|
import { AcceptInvitationByTokenRequestBody } from "./validators/acceptInvitationByTokenRequestBody.zod.js";
|
|
51
|
+
import { AuthorizeApplicationRequestBody } from "./validators/authorizeApplicationRequestBody.zod.js";
|
|
33
52
|
import { CreateProjectRequestBody } from "./validators/createProjectRequestBody.zod.js";
|
|
34
53
|
import { CreateSSHKeyRequestBody } from "./validators/createSSHKeyRequestBody.zod.js";
|
|
35
54
|
import { RegisterRequestBody } from "./validators/registerRequestBody.zod.js";
|
|
@@ -131,6 +150,61 @@ export const RenameSshKeyBody = RenameSSHKeyRequestBody;
|
|
|
131
150
|
export const RevokeSshKeyParams = zod.strictObject({
|
|
132
151
|
keyId: zod.uuid(),
|
|
133
152
|
});
|
|
153
|
+
/**
|
|
154
|
+
* Returns the application requesting authorization, so that the authorization page can identify the requester. Any authenticated account may read it, since the `client_id` is part of every authorization request.
|
|
155
|
+
*
|
|
156
|
+
* A deleted application is reported as not found. A disabled application is returned with `status` `DISABLED` and cannot be authorized.
|
|
157
|
+
*
|
|
158
|
+
* The authorization page returns the user only to a `redirect_uri` that exactly matches one of `redirect_uris`; if none matches, the user is not redirected.
|
|
159
|
+
* @summary Get an application by its client ID
|
|
160
|
+
*/
|
|
161
|
+
export const getApplicationPathClientIdMax = 255;
|
|
162
|
+
export const GetApplicationParams = zod.strictObject({
|
|
163
|
+
clientId: zod.string().min(1).max(getApplicationPathClientIdMax),
|
|
164
|
+
});
|
|
165
|
+
/**
|
|
166
|
+
* Returns one item for each application and project, most recent first. An authorization is omitted once it has been revoked, once the membership under which it was granted has ended, or once the application has been deleted.
|
|
167
|
+
*
|
|
168
|
+
* When called with an access token issued to an application, only the authorizations of that application are returned.
|
|
169
|
+
* @summary List the applications the current account has authorized
|
|
170
|
+
*/
|
|
171
|
+
export const listAuthorizedApplicationsQueryLimitDefault = 50;
|
|
172
|
+
export const listAuthorizedApplicationsQueryLimitMax = 200;
|
|
173
|
+
export const listAuthorizedApplicationsQueryOffsetDefault = 0;
|
|
174
|
+
export const listAuthorizedApplicationsQueryOffsetMin = 0;
|
|
175
|
+
export const listAuthorizedApplicationsQueryOffsetMax = 10000;
|
|
176
|
+
export const ListAuthorizedApplicationsQueryParams = zod.strictObject({
|
|
177
|
+
limit: zod
|
|
178
|
+
.int()
|
|
179
|
+
.min(1)
|
|
180
|
+
.max(listAuthorizedApplicationsQueryLimitMax)
|
|
181
|
+
.default(listAuthorizedApplicationsQueryLimitDefault)
|
|
182
|
+
.describe("Items returned in this page. Defaults to 50; at most 200."),
|
|
183
|
+
offset: zod
|
|
184
|
+
.int()
|
|
185
|
+
.min(listAuthorizedApplicationsQueryOffsetMin)
|
|
186
|
+
.max(listAuthorizedApplicationsQueryOffsetMax)
|
|
187
|
+
.default(listAuthorizedApplicationsQueryOffsetDefault)
|
|
188
|
+
.describe("Items to skip. Defaults to 0; at most 10000."),
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* Permits the application to exchange the access tokens of this account for scoped tokens of the project. Within the project, the application then holds exactly the permissions of this account and none beyond them.
|
|
192
|
+
*
|
|
193
|
+
* The caller must be a member of the project. Repeating the request returns the existing authorization. Authorizing a disabled application fails with 412 `APPLICATION_DISABLED`.
|
|
194
|
+
*
|
|
195
|
+
* An access token issued to an application is rejected, so that an application cannot authorize itself.
|
|
196
|
+
* @summary Authorize an application to act in a project
|
|
197
|
+
*/
|
|
198
|
+
export const AuthorizeApplicationBody = AuthorizeApplicationRequestBody;
|
|
199
|
+
/**
|
|
200
|
+
* After revocation, the application can no longer exchange tokens for the project. A scoped token already issued to it remains valid until it expires. Repeating the request returns the same authorization.
|
|
201
|
+
*
|
|
202
|
+
* When called with an access token issued to an application, only the authorizations of that application can be revoked; this allows an application to disconnect itself.
|
|
203
|
+
* @summary Revoke an application's authorization
|
|
204
|
+
*/
|
|
205
|
+
export const RevokeAuthorizedApplicationParams = zod.strictObject({
|
|
206
|
+
authorizationId: zod.uuid(),
|
|
207
|
+
});
|
|
134
208
|
/**
|
|
135
209
|
* Matched against the email address of the current account.
|
|
136
210
|
* @summary List invitations addressed to the caller
|
|
@@ -274,6 +348,8 @@ export const GetProjectSlugAvailabilityParams = zod.strictObject({
|
|
|
274
348
|
* A scoped token states identity only — the user and the project — and **carries no permissions**. Permissions are evaluated on every request, so a change of role takes effect immediately rather than at the next expiry.
|
|
275
349
|
*
|
|
276
350
|
* A project that is suspended, banned or being deleted still issues tokens; those states restrict writes, and the project remains readable.
|
|
351
|
+
*
|
|
352
|
+
* An access token issued to an application is exchanged only for a project for which the user has authorized that application. Otherwise, the exchange fails with 403 `APPLICATION_AUTHORIZATION_REQUIRED`, whose `meta` contains the `client_id` and the `project_id`; the application should then direct the user to the authorization page. For a disabled application the exchange fails with 412 `APPLICATION_DISABLED`, and for a deleted application with 404 `APPLICATION_NOT_FOUND`, even if its access token has not yet expired.
|
|
277
353
|
* @summary Exchange the access token for a scoped token
|
|
278
354
|
*/
|
|
279
355
|
export const CreateScopedTokenParams = zod.strictObject({
|
|
@@ -16,6 +16,24 @@
|
|
|
16
16
|
*
|
|
17
17
|
* A scoped token cannot be renewed. Repeat step 2 for a new one, and sign in again at auth.leaflow.net once the access token itself has expired.
|
|
18
18
|
*
|
|
19
|
+
* ## Applications
|
|
20
|
+
*
|
|
21
|
+
* An application registered by a project signs its users in at auth.leaflow.net in the same manner as any other OAuth client. To call the Leaflow API on behalf of a user, the application requests the `iam` scope, and the user must then authorize the application for each project in which it is to act:
|
|
22
|
+
*
|
|
23
|
+
* 1. The application directs the user to the authorization page of the console:
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* https://console.leaflow.net/applications/authorize?client_id=<client_id>&redirect_uri=<redirect_uri>&state=<state>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* All three parameters are required. The `redirect_uri` is URL-encoded and must exactly match one of the redirect URIs registered for the application; a custom scheme registered for a public application is accepted in the same way. If a parameter is missing, if the `redirect_uri` does not match, or if the application does not exist or is not active, the page reports the problem to the user and does not redirect. A user who is not signed in, or who has not yet completed registration and accepted the agreements, does so first and then returns to the page.
|
|
30
|
+
* 2. The user selects a project and confirms the authorization. The console calls `POST /account/v1/me/authorized-applications` and returns the user to the `redirect_uri` with the query parameters `project_id` and `state`. If the user declines, the console returns the user to the `redirect_uri` with `error=access_denied` and `state`. In both cases the existing query parameters of the `redirect_uri` are retained, and a parameter of the same name is replaced. The application must verify that `state` equals the value it supplied before it uses the response.
|
|
31
|
+
* 3. The application exchanges its access token for a scoped token at `POST /account/v1/projects/{projectId}/scoped-tokens`, as described in the preceding section.
|
|
32
|
+
*
|
|
33
|
+
* Within an authorized project, the application holds exactly the permissions of the user in that project and none beyond them. The user may revoke an authorization at any time at https://console.leaflow.net/account/applications, and an authorization ends when the user leaves the project.
|
|
34
|
+
*
|
|
35
|
+
* An access token issued to an application is accepted only by `create-scoped-token`, `list-authorized-applications` and `revoke-authorized-application`. Every other endpoint rejects it with 403 `APPLICATION_TOKEN_NOT_ACCEPTED`; consequently, an application cannot authorize itself.
|
|
36
|
+
*
|
|
19
37
|
* ## SSH keys
|
|
20
38
|
*
|
|
21
39
|
* The SSH keys of an account belong to its holder rather than to any project, and a key is active on one account at most. Keys shared by a project, such as one used by CI, belong to the project instead and are managed through the IAM API.
|
|
@@ -16,6 +16,24 @@
|
|
|
16
16
|
*
|
|
17
17
|
* A scoped token cannot be renewed. Repeat step 2 for a new one, and sign in again at auth.leaflow.net once the access token itself has expired.
|
|
18
18
|
*
|
|
19
|
+
* ## Applications
|
|
20
|
+
*
|
|
21
|
+
* An application registered by a project signs its users in at auth.leaflow.net in the same manner as any other OAuth client. To call the Leaflow API on behalf of a user, the application requests the `iam` scope, and the user must then authorize the application for each project in which it is to act:
|
|
22
|
+
*
|
|
23
|
+
* 1. The application directs the user to the authorization page of the console:
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* https://console.leaflow.net/applications/authorize?client_id=<client_id>&redirect_uri=<redirect_uri>&state=<state>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* All three parameters are required. The `redirect_uri` is URL-encoded and must exactly match one of the redirect URIs registered for the application; a custom scheme registered for a public application is accepted in the same way. If a parameter is missing, if the `redirect_uri` does not match, or if the application does not exist or is not active, the page reports the problem to the user and does not redirect. A user who is not signed in, or who has not yet completed registration and accepted the agreements, does so first and then returns to the page.
|
|
30
|
+
* 2. The user selects a project and confirms the authorization. The console calls `POST /account/v1/me/authorized-applications` and returns the user to the `redirect_uri` with the query parameters `project_id` and `state`. If the user declines, the console returns the user to the `redirect_uri` with `error=access_denied` and `state`. In both cases the existing query parameters of the `redirect_uri` are retained, and a parameter of the same name is replaced. The application must verify that `state` equals the value it supplied before it uses the response.
|
|
31
|
+
* 3. The application exchanges its access token for a scoped token at `POST /account/v1/projects/{projectId}/scoped-tokens`, as described in the preceding section.
|
|
32
|
+
*
|
|
33
|
+
* Within an authorized project, the application holds exactly the permissions of the user in that project and none beyond them. The user may revoke an authorization at any time at https://console.leaflow.net/account/applications, and an authorization ends when the user leaves the project.
|
|
34
|
+
*
|
|
35
|
+
* An access token issued to an application is accepted only by `create-scoped-token`, `list-authorized-applications` and `revoke-authorized-application`. Every other endpoint rejects it with 403 `APPLICATION_TOKEN_NOT_ACCEPTED`; consequently, an application cannot authorize itself.
|
|
36
|
+
*
|
|
19
37
|
* ## SSH keys
|
|
20
38
|
*
|
|
21
39
|
* The SSH keys of an account belong to its holder rather than to any project, and a key is active on one account at most. Keys shared by a project, such as one used by CI, belong to the project instead and are managed through the IAM API.
|