frameio 3.2.3 → 4.2.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/README.md +159 -4
- package/dist/cjs/BaseClient.d.ts +4 -0
- package/dist/cjs/BaseClient.js +4 -2
- package/dist/cjs/Client.d.ts +6 -0
- package/dist/cjs/Client.js +34 -24
- package/dist/cjs/api/resources/accountPermissions/client/Client.js +6 -6
- package/dist/cjs/api/resources/accounts/client/Client.js +13 -13
- package/dist/cjs/api/resources/comments/client/Client.js +48 -48
- package/dist/cjs/api/resources/customActions/client/Client.d.ts +145 -0
- package/dist/cjs/api/resources/customActions/client/Client.js +443 -0
- package/dist/cjs/api/resources/customActions/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/customActions/client/index.js +17 -0
- package/dist/cjs/api/resources/customActions/client/requests/ActionCreateParams.d.ts +31 -0
- package/dist/cjs/api/resources/customActions/client/requests/ActionCreateParams.js +3 -0
- package/dist/cjs/api/resources/customActions/client/requests/ActionUpdateParams.d.ts +35 -0
- package/dist/cjs/api/resources/customActions/client/requests/ActionUpdateParams.js +3 -0
- package/dist/cjs/api/resources/customActions/client/requests/ActionsIndexRequest.d.ts +21 -0
- package/dist/cjs/api/resources/customActions/client/requests/ActionsIndexRequest.js +3 -0
- package/dist/cjs/api/resources/customActions/client/requests/ActionsShowRequest.d.ts +9 -0
- package/dist/cjs/api/resources/customActions/client/requests/ActionsShowRequest.js +3 -0
- package/dist/cjs/api/resources/customActions/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/customActions/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/customActions/exports.d.ts +2 -0
- package/dist/cjs/api/resources/customActions/exports.js +21 -0
- package/dist/cjs/api/resources/customActions/index.d.ts +1 -0
- package/dist/cjs/api/resources/customActions/index.js +17 -0
- package/dist/cjs/api/resources/files/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/files/client/Client.js +78 -78
- package/dist/cjs/api/resources/folders/client/Client.js +56 -56
- package/dist/cjs/api/resources/groups/client/Client.d.ts +116 -0
- package/dist/cjs/api/resources/groups/client/Client.js +368 -0
- package/dist/cjs/api/resources/groups/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/groups/client/index.js +17 -0
- package/dist/cjs/api/resources/groups/client/requests/CreateGroupParams.d.ts +20 -0
- package/dist/cjs/api/resources/groups/client/requests/CreateGroupParams.js +3 -0
- package/dist/cjs/api/resources/groups/client/requests/GroupsIndexRequest.d.ts +24 -0
- package/dist/cjs/api/resources/groups/client/requests/GroupsIndexRequest.js +3 -0
- package/dist/cjs/api/resources/groups/client/requests/GroupsShowRequest.d.ts +9 -0
- package/dist/cjs/api/resources/groups/client/requests/GroupsShowRequest.js +3 -0
- package/dist/cjs/api/resources/groups/client/requests/UpdateGroupParams.d.ts +20 -0
- package/dist/cjs/api/resources/groups/client/requests/UpdateGroupParams.js +3 -0
- package/dist/cjs/api/resources/groups/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/groups/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/groups/exports.d.ts +2 -0
- package/dist/cjs/api/resources/groups/exports.js +21 -0
- package/dist/cjs/api/resources/groups/index.d.ts +2 -0
- package/dist/cjs/api/resources/groups/index.js +18 -0
- package/dist/cjs/api/resources/groups/types/GroupsIndexRequestSort.d.ts +10 -0
- package/dist/cjs/api/resources/groups/types/GroupsIndexRequestSort.js +13 -0
- package/dist/cjs/api/resources/groups/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/groups/types/index.js +17 -0
- package/dist/cjs/api/resources/index.d.ts +5 -0
- package/dist/cjs/api/resources/index.js +6 -1
- package/dist/cjs/api/resources/metadata/client/Client.d.ts +4 -4
- package/dist/cjs/api/resources/metadata/client/Client.js +18 -18
- package/dist/cjs/api/resources/metadata/client/requests/BulkUpdateMetadataParams.d.ts +4 -4
- package/dist/cjs/api/resources/metadataFields/client/Client.js +28 -28
- package/dist/cjs/api/resources/projectPermissions/client/Client.js +20 -20
- package/dist/cjs/api/resources/projects/client/Client.js +34 -34
- package/dist/cjs/api/resources/shares/client/Client.d.ts +4 -4
- package/dist/cjs/api/resources/shares/client/Client.js +72 -72
- package/dist/cjs/api/resources/shares/client/requests/AddAssetParams.d.ts +1 -1
- package/dist/cjs/api/resources/shares/client/requests/CreateShareParams.d.ts +2 -2
- package/dist/cjs/api/resources/shares/client/requests/UpdateShareParams.d.ts +1 -1
- package/dist/cjs/api/resources/users/client/Client.js +7 -7
- package/dist/cjs/api/resources/versionStacks/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/versionStacks/client/Client.js +43 -43
- package/dist/cjs/api/resources/versionStacks/client/requests/VersionStackCreateParams.d.ts +1 -1
- package/dist/cjs/api/resources/webhooks/client/Client.js +34 -34
- package/dist/cjs/api/resources/workspacePermissions/client/Client.js +20 -20
- package/dist/cjs/api/resources/workspaces/client/Client.js +34 -34
- package/dist/cjs/api/types/Account.d.ts +0 -2
- package/dist/cjs/api/types/Action.d.ts +25 -0
- package/dist/cjs/api/types/Action.js +3 -0
- package/dist/cjs/api/types/ActionCreateResponse.d.ts +13 -0
- package/dist/cjs/api/types/ActionCreateResponse.js +3 -0
- package/dist/cjs/api/types/ActionInclude.d.ts +4 -0
- package/dist/cjs/api/types/ActionInclude.js +3 -0
- package/dist/cjs/api/types/ActionResponse.d.ts +7 -0
- package/dist/cjs/api/types/ActionResponse.js +3 -0
- package/dist/cjs/api/types/ActionWithIncludes.d.ts +4 -0
- package/dist/cjs/api/types/ActionWithIncludes.js +3 -0
- package/dist/cjs/api/types/ActionWithIncludesResponse.d.ts +7 -0
- package/dist/cjs/api/types/ActionWithIncludesResponse.js +3 -0
- package/dist/cjs/api/types/ActionsWithIncludesResponse.d.ts +11 -0
- package/dist/cjs/api/types/ActionsWithIncludesResponse.js +3 -0
- package/dist/cjs/api/types/AuditLogwithIncludes.d.ts +7 -0
- package/dist/cjs/api/types/AuditLogwithIncludes.js +7 -0
- package/dist/cjs/api/types/Filters.d.ts +7 -0
- package/dist/cjs/api/types/Filters.js +7 -0
- package/dist/cjs/api/types/GroupCommon.d.ts +16 -0
- package/dist/cjs/api/types/GroupCommon.js +3 -0
- package/dist/cjs/api/types/GroupCommonWithIncludes.d.ts +4 -0
- package/dist/cjs/api/types/GroupCommonWithIncludes.js +3 -0
- package/dist/cjs/api/types/GroupResponse.d.ts +4 -0
- package/dist/cjs/api/types/GroupResponse.js +3 -0
- package/dist/cjs/api/types/GroupWithIncludes.d.ts +13 -0
- package/dist/cjs/api/types/GroupWithIncludes.js +3 -0
- package/dist/cjs/api/types/GroupWithIncludesResponse.d.ts +4 -0
- package/dist/cjs/api/types/GroupWithIncludesResponse.js +3 -0
- package/dist/cjs/api/types/GroupsInclude.d.ts +4 -0
- package/dist/cjs/api/types/GroupsInclude.js +3 -0
- package/dist/cjs/api/types/GroupsSort.d.ts +10 -0
- package/dist/cjs/api/types/GroupsSort.js +13 -0
- package/dist/cjs/api/types/GroupsWithIncludesResponse.d.ts +8 -0
- package/dist/cjs/api/types/GroupsWithIncludesResponse.js +3 -0
- package/dist/cjs/api/types/SingleUserValue.d.ts +1 -1
- package/dist/cjs/api/types/SyncGroupWithIncludes.d.ts +15 -0
- package/dist/cjs/api/types/SyncGroupWithIncludes.js +14 -0
- package/dist/cjs/api/types/index.d.ts +16 -0
- package/dist/cjs/api/types/index.js +16 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +21 -1
- package/dist/cjs/oauth/BaseAuth.d.ts +66 -0
- package/dist/cjs/oauth/BaseAuth.js +113 -0
- package/dist/cjs/oauth/NativeAppAuth.d.ts +32 -0
- package/dist/cjs/oauth/NativeAppAuth.js +35 -0
- package/dist/cjs/oauth/SPAAuth.d.ts +38 -0
- package/dist/cjs/oauth/SPAAuth.js +96 -0
- package/dist/cjs/oauth/ServerToServerAuth.d.ts +17 -0
- package/dist/cjs/oauth/ServerToServerAuth.js +49 -0
- package/dist/cjs/oauth/TokenManager.d.ts +83 -0
- package/dist/cjs/oauth/TokenManager.js +174 -0
- package/dist/cjs/oauth/WebAppAuth.d.ts +29 -0
- package/dist/cjs/oauth/WebAppAuth.js +88 -0
- package/dist/cjs/oauth/errors.d.ts +41 -0
- package/dist/cjs/oauth/errors.js +83 -0
- package/dist/cjs/oauth/http.d.ts +70 -0
- package/dist/cjs/oauth/http.js +280 -0
- package/dist/cjs/oauth/index.d.ts +34 -0
- package/dist/cjs/oauth/index.js +47 -0
- package/dist/cjs/oauth/logger.d.ts +17 -0
- package/dist/cjs/oauth/logger.js +18 -0
- package/dist/cjs/oauth/pkce.d.ts +30 -0
- package/dist/cjs/oauth/pkce.js +102 -0
- package/dist/cjs/oauth/validation.d.ts +17 -0
- package/dist/cjs/oauth/validation.js +55 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +4 -0
- package/dist/esm/BaseClient.mjs +4 -2
- package/dist/esm/Client.d.mts +6 -0
- package/dist/esm/Client.mjs +10 -0
- package/dist/esm/api/resources/accountPermissions/client/Client.mjs +7 -7
- package/dist/esm/api/resources/accounts/client/Client.mjs +13 -13
- package/dist/esm/api/resources/comments/client/Client.mjs +49 -49
- package/dist/esm/api/resources/customActions/client/Client.d.mts +145 -0
- package/dist/esm/api/resources/customActions/client/Client.mjs +406 -0
- package/dist/esm/api/resources/customActions/client/index.d.mts +1 -0
- package/dist/esm/api/resources/customActions/client/index.mjs +1 -0
- package/dist/esm/api/resources/customActions/client/requests/ActionCreateParams.d.mts +31 -0
- package/dist/esm/api/resources/customActions/client/requests/ActionCreateParams.mjs +2 -0
- package/dist/esm/api/resources/customActions/client/requests/ActionUpdateParams.d.mts +35 -0
- package/dist/esm/api/resources/customActions/client/requests/ActionUpdateParams.mjs +2 -0
- package/dist/esm/api/resources/customActions/client/requests/ActionsIndexRequest.d.mts +21 -0
- package/dist/esm/api/resources/customActions/client/requests/ActionsIndexRequest.mjs +2 -0
- package/dist/esm/api/resources/customActions/client/requests/ActionsShowRequest.d.mts +9 -0
- package/dist/esm/api/resources/customActions/client/requests/ActionsShowRequest.mjs +2 -0
- package/dist/esm/api/resources/customActions/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/customActions/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/customActions/exports.d.mts +2 -0
- package/dist/esm/api/resources/customActions/exports.mjs +3 -0
- package/dist/esm/api/resources/customActions/index.d.mts +1 -0
- package/dist/esm/api/resources/customActions/index.mjs +1 -0
- package/dist/esm/api/resources/files/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/files/client/Client.mjs +79 -79
- package/dist/esm/api/resources/folders/client/Client.mjs +57 -57
- package/dist/esm/api/resources/groups/client/Client.d.mts +116 -0
- package/dist/esm/api/resources/groups/client/Client.mjs +331 -0
- package/dist/esm/api/resources/groups/client/index.d.mts +1 -0
- package/dist/esm/api/resources/groups/client/index.mjs +1 -0
- package/dist/esm/api/resources/groups/client/requests/CreateGroupParams.d.mts +20 -0
- package/dist/esm/api/resources/groups/client/requests/CreateGroupParams.mjs +2 -0
- package/dist/esm/api/resources/groups/client/requests/GroupsIndexRequest.d.mts +24 -0
- package/dist/esm/api/resources/groups/client/requests/GroupsIndexRequest.mjs +2 -0
- package/dist/esm/api/resources/groups/client/requests/GroupsShowRequest.d.mts +9 -0
- package/dist/esm/api/resources/groups/client/requests/GroupsShowRequest.mjs +2 -0
- package/dist/esm/api/resources/groups/client/requests/UpdateGroupParams.d.mts +20 -0
- package/dist/esm/api/resources/groups/client/requests/UpdateGroupParams.mjs +2 -0
- package/dist/esm/api/resources/groups/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/groups/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/groups/exports.d.mts +2 -0
- package/dist/esm/api/resources/groups/exports.mjs +3 -0
- package/dist/esm/api/resources/groups/index.d.mts +2 -0
- package/dist/esm/api/resources/groups/index.mjs +2 -0
- package/dist/esm/api/resources/groups/types/GroupsIndexRequestSort.d.mts +10 -0
- package/dist/esm/api/resources/groups/types/GroupsIndexRequestSort.mjs +10 -0
- package/dist/esm/api/resources/groups/types/index.d.mts +1 -0
- package/dist/esm/api/resources/groups/types/index.mjs +1 -0
- package/dist/esm/api/resources/index.d.mts +5 -0
- package/dist/esm/api/resources/index.mjs +5 -0
- package/dist/esm/api/resources/metadata/client/Client.d.mts +4 -4
- package/dist/esm/api/resources/metadata/client/Client.mjs +19 -19
- package/dist/esm/api/resources/metadata/client/requests/BulkUpdateMetadataParams.d.mts +4 -4
- package/dist/esm/api/resources/metadataFields/client/Client.mjs +29 -29
- package/dist/esm/api/resources/projectPermissions/client/Client.mjs +21 -21
- package/dist/esm/api/resources/projects/client/Client.mjs +35 -35
- package/dist/esm/api/resources/shares/client/Client.d.mts +4 -4
- package/dist/esm/api/resources/shares/client/Client.mjs +73 -73
- package/dist/esm/api/resources/shares/client/requests/AddAssetParams.d.mts +1 -1
- package/dist/esm/api/resources/shares/client/requests/CreateShareParams.d.mts +2 -2
- package/dist/esm/api/resources/shares/client/requests/UpdateShareParams.d.mts +1 -1
- package/dist/esm/api/resources/users/client/Client.mjs +8 -8
- package/dist/esm/api/resources/versionStacks/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/versionStacks/client/Client.mjs +44 -44
- package/dist/esm/api/resources/versionStacks/client/requests/VersionStackCreateParams.d.mts +1 -1
- package/dist/esm/api/resources/webhooks/client/Client.mjs +35 -35
- package/dist/esm/api/resources/workspacePermissions/client/Client.mjs +21 -21
- package/dist/esm/api/resources/workspaces/client/Client.mjs +35 -35
- package/dist/esm/api/types/Account.d.mts +0 -2
- package/dist/esm/api/types/Action.d.mts +25 -0
- package/dist/esm/api/types/Action.mjs +2 -0
- package/dist/esm/api/types/ActionCreateResponse.d.mts +13 -0
- package/dist/esm/api/types/ActionCreateResponse.mjs +2 -0
- package/dist/esm/api/types/ActionInclude.d.mts +4 -0
- package/dist/esm/api/types/ActionInclude.mjs +2 -0
- package/dist/esm/api/types/ActionResponse.d.mts +7 -0
- package/dist/esm/api/types/ActionResponse.mjs +2 -0
- package/dist/esm/api/types/ActionWithIncludes.d.mts +4 -0
- package/dist/esm/api/types/ActionWithIncludes.mjs +2 -0
- package/dist/esm/api/types/ActionWithIncludesResponse.d.mts +7 -0
- package/dist/esm/api/types/ActionWithIncludesResponse.mjs +2 -0
- package/dist/esm/api/types/ActionsWithIncludesResponse.d.mts +11 -0
- package/dist/esm/api/types/ActionsWithIncludesResponse.mjs +2 -0
- package/dist/esm/api/types/AuditLogwithIncludes.d.mts +7 -0
- package/dist/esm/api/types/AuditLogwithIncludes.mjs +7 -0
- package/dist/esm/api/types/Filters.d.mts +7 -0
- package/dist/esm/api/types/Filters.mjs +7 -0
- package/dist/esm/api/types/GroupCommon.d.mts +16 -0
- package/dist/esm/api/types/GroupCommon.mjs +2 -0
- package/dist/esm/api/types/GroupCommonWithIncludes.d.mts +4 -0
- package/dist/esm/api/types/GroupCommonWithIncludes.mjs +2 -0
- package/dist/esm/api/types/GroupResponse.d.mts +4 -0
- package/dist/esm/api/types/GroupResponse.mjs +2 -0
- package/dist/esm/api/types/GroupWithIncludes.d.mts +13 -0
- package/dist/esm/api/types/GroupWithIncludes.mjs +2 -0
- package/dist/esm/api/types/GroupWithIncludesResponse.d.mts +4 -0
- package/dist/esm/api/types/GroupWithIncludesResponse.mjs +2 -0
- package/dist/esm/api/types/GroupsInclude.d.mts +4 -0
- package/dist/esm/api/types/GroupsInclude.mjs +2 -0
- package/dist/esm/api/types/GroupsSort.d.mts +10 -0
- package/dist/esm/api/types/GroupsSort.mjs +10 -0
- package/dist/esm/api/types/GroupsWithIncludesResponse.d.mts +8 -0
- package/dist/esm/api/types/GroupsWithIncludesResponse.mjs +2 -0
- package/dist/esm/api/types/SingleUserValue.d.mts +1 -1
- package/dist/esm/api/types/SyncGroupWithIncludes.d.mts +15 -0
- package/dist/esm/api/types/SyncGroupWithIncludes.mjs +11 -0
- package/dist/esm/api/types/index.d.mts +16 -0
- package/dist/esm/api/types/index.mjs +16 -0
- package/dist/esm/index.d.mts +4 -0
- package/dist/esm/index.mjs +6 -0
- package/dist/esm/oauth/BaseAuth.d.mts +66 -0
- package/dist/esm/oauth/BaseAuth.mjs +109 -0
- package/dist/esm/oauth/NativeAppAuth.d.mts +32 -0
- package/dist/esm/oauth/NativeAppAuth.mjs +31 -0
- package/dist/esm/oauth/SPAAuth.d.mts +38 -0
- package/dist/esm/oauth/SPAAuth.mjs +92 -0
- package/dist/esm/oauth/ServerToServerAuth.d.mts +17 -0
- package/dist/esm/oauth/ServerToServerAuth.mjs +45 -0
- package/dist/esm/oauth/TokenManager.d.mts +83 -0
- package/dist/esm/oauth/TokenManager.mjs +170 -0
- package/dist/esm/oauth/WebAppAuth.d.mts +29 -0
- package/dist/esm/oauth/WebAppAuth.mjs +84 -0
- package/dist/esm/oauth/errors.d.mts +41 -0
- package/dist/esm/oauth/errors.mjs +72 -0
- package/dist/esm/oauth/http.d.mts +70 -0
- package/dist/esm/oauth/http.mjs +274 -0
- package/dist/esm/oauth/index.d.mts +34 -0
- package/dist/esm/oauth/index.mjs +30 -0
- package/dist/esm/oauth/logger.d.mts +17 -0
- package/dist/esm/oauth/logger.mjs +15 -0
- package/dist/esm/oauth/pkce.d.mts +30 -0
- package/dist/esm/oauth/pkce.mjs +98 -0
- package/dist/esm/oauth/validation.d.mts +17 -0
- package/dist/esm/oauth/validation.mjs +51 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +23 -1
- package/reference.md +1318 -586
|
@@ -2,6 +2,13 @@ export * from "./Account.js";
|
|
|
2
2
|
export * from "./AccountsResponse.js";
|
|
3
3
|
export * from "./AccountUserRole.js";
|
|
4
4
|
export * from "./AccountUserRolesResponse.js";
|
|
5
|
+
export * from "./Action.js";
|
|
6
|
+
export * from "./ActionCreateResponse.js";
|
|
7
|
+
export * from "./ActionInclude.js";
|
|
8
|
+
export * from "./ActionResponse.js";
|
|
9
|
+
export * from "./ActionsWithIncludesResponse.js";
|
|
10
|
+
export * from "./ActionWithIncludes.js";
|
|
11
|
+
export * from "./ActionWithIncludesResponse.js";
|
|
5
12
|
export * from "./AddAssetResponse.js";
|
|
6
13
|
export * from "./Anchor.js";
|
|
7
14
|
export * from "./AssetCommon.js";
|
|
@@ -60,6 +67,14 @@ export * from "./FoldersWithIncludesResponse.js";
|
|
|
60
67
|
export * from "./FolderWithIncludes.js";
|
|
61
68
|
export * from "./FolderWithIncludesResponse.js";
|
|
62
69
|
export * from "./Forbidden.js";
|
|
70
|
+
export * from "./GroupCommon.js";
|
|
71
|
+
export * from "./GroupCommonWithIncludes.js";
|
|
72
|
+
export * from "./GroupResponse.js";
|
|
73
|
+
export * from "./GroupsInclude.js";
|
|
74
|
+
export * from "./GroupsSort.js";
|
|
75
|
+
export * from "./GroupsWithIncludesResponse.js";
|
|
76
|
+
export * from "./GroupWithIncludes.js";
|
|
77
|
+
export * from "./GroupWithIncludesResponse.js";
|
|
63
78
|
export * from "./Include.js";
|
|
64
79
|
export * from "./IncludeTotalCount.js";
|
|
65
80
|
export * from "./IntegerValue.js";
|
|
@@ -114,6 +129,7 @@ export * from "./ShareResponse.js";
|
|
|
114
129
|
export * from "./ShareReviewersResponse.js";
|
|
115
130
|
export * from "./SharesResponse.js";
|
|
116
131
|
export * from "./SingleUserValue.js";
|
|
132
|
+
export * from "./SyncGroupWithIncludes.js";
|
|
117
133
|
export * from "./TextDefinition.js";
|
|
118
134
|
export * from "./TextDefinitionParams.js";
|
|
119
135
|
export * from "./TextDefinitionWithIncludes.js";
|
|
@@ -18,6 +18,13 @@ __exportStar(require("./Account.js"), exports);
|
|
|
18
18
|
__exportStar(require("./AccountsResponse.js"), exports);
|
|
19
19
|
__exportStar(require("./AccountUserRole.js"), exports);
|
|
20
20
|
__exportStar(require("./AccountUserRolesResponse.js"), exports);
|
|
21
|
+
__exportStar(require("./Action.js"), exports);
|
|
22
|
+
__exportStar(require("./ActionCreateResponse.js"), exports);
|
|
23
|
+
__exportStar(require("./ActionInclude.js"), exports);
|
|
24
|
+
__exportStar(require("./ActionResponse.js"), exports);
|
|
25
|
+
__exportStar(require("./ActionsWithIncludesResponse.js"), exports);
|
|
26
|
+
__exportStar(require("./ActionWithIncludes.js"), exports);
|
|
27
|
+
__exportStar(require("./ActionWithIncludesResponse.js"), exports);
|
|
21
28
|
__exportStar(require("./AddAssetResponse.js"), exports);
|
|
22
29
|
__exportStar(require("./Anchor.js"), exports);
|
|
23
30
|
__exportStar(require("./AssetCommon.js"), exports);
|
|
@@ -76,6 +83,14 @@ __exportStar(require("./FoldersWithIncludesResponse.js"), exports);
|
|
|
76
83
|
__exportStar(require("./FolderWithIncludes.js"), exports);
|
|
77
84
|
__exportStar(require("./FolderWithIncludesResponse.js"), exports);
|
|
78
85
|
__exportStar(require("./Forbidden.js"), exports);
|
|
86
|
+
__exportStar(require("./GroupCommon.js"), exports);
|
|
87
|
+
__exportStar(require("./GroupCommonWithIncludes.js"), exports);
|
|
88
|
+
__exportStar(require("./GroupResponse.js"), exports);
|
|
89
|
+
__exportStar(require("./GroupsInclude.js"), exports);
|
|
90
|
+
__exportStar(require("./GroupsSort.js"), exports);
|
|
91
|
+
__exportStar(require("./GroupsWithIncludesResponse.js"), exports);
|
|
92
|
+
__exportStar(require("./GroupWithIncludes.js"), exports);
|
|
93
|
+
__exportStar(require("./GroupWithIncludesResponse.js"), exports);
|
|
79
94
|
__exportStar(require("./Include.js"), exports);
|
|
80
95
|
__exportStar(require("./IncludeTotalCount.js"), exports);
|
|
81
96
|
__exportStar(require("./IntegerValue.js"), exports);
|
|
@@ -130,6 +145,7 @@ __exportStar(require("./ShareResponse.js"), exports);
|
|
|
130
145
|
__exportStar(require("./ShareReviewersResponse.js"), exports);
|
|
131
146
|
__exportStar(require("./SharesResponse.js"), exports);
|
|
132
147
|
__exportStar(require("./SingleUserValue.js"), exports);
|
|
148
|
+
__exportStar(require("./SyncGroupWithIncludes.js"), exports);
|
|
133
149
|
__exportStar(require("./TextDefinition.js"), exports);
|
|
134
150
|
__exportStar(require("./TextDefinitionParams.js"), exports);
|
|
135
151
|
__exportStar(require("./TextDefinitionWithIncludes.js"), exports);
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -4,3 +4,7 @@ export { FrameioClient } from "./Client.js";
|
|
|
4
4
|
export { FrameioEnvironment } from "./environments.js";
|
|
5
5
|
export { FrameioError, FrameioTimeoutError } from "./errors/index.js";
|
|
6
6
|
export * from "./exports.js";
|
|
7
|
+
export { ServerToServerAuth, WebAppAuth, SPAAuth, NativeAppAuth } from "./oauth";
|
|
8
|
+
export type { ServerToServerAuthOptions, WebAppAuthOptions, SPAAuthOptions, NativeAppAuthOptions, AuthorizationUrlResult, BaseAuthOptions, Logger, TokenResponse, ExportedTokens, OnTokenRefreshed, } from "./oauth";
|
|
9
|
+
export { FrameioAuthError, AuthenticationError, TokenExpiredError, NetworkError, RateLimitError, PKCEError, ConfigurationError, } from "./oauth";
|
|
10
|
+
export { noopLogger, DEFAULT_IMS_BASE_URL, buildImsUrls } from "./oauth";
|
package/dist/cjs/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.FrameioTimeoutError = exports.FrameioError = exports.FrameioEnvironment = exports.FrameioClient = exports.Frameio = void 0;
|
|
39
|
+
exports.buildImsUrls = exports.DEFAULT_IMS_BASE_URL = exports.noopLogger = exports.ConfigurationError = exports.PKCEError = exports.RateLimitError = exports.NetworkError = exports.TokenExpiredError = exports.AuthenticationError = exports.FrameioAuthError = exports.NativeAppAuth = exports.SPAAuth = exports.WebAppAuth = exports.ServerToServerAuth = exports.FrameioTimeoutError = exports.FrameioError = exports.FrameioEnvironment = exports.FrameioClient = exports.Frameio = void 0;
|
|
40
40
|
exports.Frameio = __importStar(require("./api/index.js"));
|
|
41
41
|
var Client_js_1 = require("./Client.js");
|
|
42
42
|
Object.defineProperty(exports, "FrameioClient", { enumerable: true, get: function () { return Client_js_1.FrameioClient; } });
|
|
@@ -46,3 +46,23 @@ var index_js_1 = require("./errors/index.js");
|
|
|
46
46
|
Object.defineProperty(exports, "FrameioError", { enumerable: true, get: function () { return index_js_1.FrameioError; } });
|
|
47
47
|
Object.defineProperty(exports, "FrameioTimeoutError", { enumerable: true, get: function () { return index_js_1.FrameioTimeoutError; } });
|
|
48
48
|
__exportStar(require("./exports.js"), exports);
|
|
49
|
+
// Auth flows
|
|
50
|
+
var oauth_1 = require("./oauth");
|
|
51
|
+
Object.defineProperty(exports, "ServerToServerAuth", { enumerable: true, get: function () { return oauth_1.ServerToServerAuth; } });
|
|
52
|
+
Object.defineProperty(exports, "WebAppAuth", { enumerable: true, get: function () { return oauth_1.WebAppAuth; } });
|
|
53
|
+
Object.defineProperty(exports, "SPAAuth", { enumerable: true, get: function () { return oauth_1.SPAAuth; } });
|
|
54
|
+
Object.defineProperty(exports, "NativeAppAuth", { enumerable: true, get: function () { return oauth_1.NativeAppAuth; } });
|
|
55
|
+
// Auth errors
|
|
56
|
+
var oauth_2 = require("./oauth");
|
|
57
|
+
Object.defineProperty(exports, "FrameioAuthError", { enumerable: true, get: function () { return oauth_2.FrameioAuthError; } });
|
|
58
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return oauth_2.AuthenticationError; } });
|
|
59
|
+
Object.defineProperty(exports, "TokenExpiredError", { enumerable: true, get: function () { return oauth_2.TokenExpiredError; } });
|
|
60
|
+
Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return oauth_2.NetworkError; } });
|
|
61
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return oauth_2.RateLimitError; } });
|
|
62
|
+
Object.defineProperty(exports, "PKCEError", { enumerable: true, get: function () { return oauth_2.PKCEError; } });
|
|
63
|
+
Object.defineProperty(exports, "ConfigurationError", { enumerable: true, get: function () { return oauth_2.ConfigurationError; } });
|
|
64
|
+
// Auth utilities
|
|
65
|
+
var oauth_3 = require("./oauth");
|
|
66
|
+
Object.defineProperty(exports, "noopLogger", { enumerable: true, get: function () { return oauth_3.noopLogger; } });
|
|
67
|
+
Object.defineProperty(exports, "DEFAULT_IMS_BASE_URL", { enumerable: true, get: function () { return oauth_3.DEFAULT_IMS_BASE_URL; } });
|
|
68
|
+
Object.defineProperty(exports, "buildImsUrls", { enumerable: true, get: function () { return oauth_3.buildImsUrls; } });
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all authentication flows.
|
|
3
|
+
*
|
|
4
|
+
* Provides shared token management methods: `getToken`, `revoke`,
|
|
5
|
+
* `exportTokens`, `importTokens`, and the internal `_storeTokens` helper.
|
|
6
|
+
*
|
|
7
|
+
* Also consolidates shared constructor options and initialization logic.
|
|
8
|
+
*/
|
|
9
|
+
import type { Logger } from "./logger";
|
|
10
|
+
import { TokenManager, type ExportedTokens, type OnTokenRefreshed, type TokenResponse } from "./TokenManager";
|
|
11
|
+
/** Default fallback when Adobe IMS doesn't return expires_in. */
|
|
12
|
+
export declare const DEFAULT_EXPIRES_IN = 86400;
|
|
13
|
+
/** Options shared by all auth flow constructors. */
|
|
14
|
+
export interface BaseAuthOptions {
|
|
15
|
+
clientId: string;
|
|
16
|
+
scopes?: string;
|
|
17
|
+
/** IMS base URL for staging/alternative environments. Default: production. */
|
|
18
|
+
imsBaseUrl?: string;
|
|
19
|
+
/** Custom fetch implementation (for proxy, TLS, etc.). */
|
|
20
|
+
fetch?: typeof fetch;
|
|
21
|
+
onTokenRefreshed?: OnTokenRefreshed;
|
|
22
|
+
/** HTTP request timeout in milliseconds. Default: 30000. */
|
|
23
|
+
timeout?: number;
|
|
24
|
+
/** Maximum retries for transient failures. Default: 2. */
|
|
25
|
+
maxRetries?: number;
|
|
26
|
+
/** Seconds before expiry to trigger proactive refresh. Default: 60. */
|
|
27
|
+
refreshBuffer?: number;
|
|
28
|
+
/** Logger instance for diagnostic output. */
|
|
29
|
+
logger?: Logger;
|
|
30
|
+
}
|
|
31
|
+
export declare abstract class BaseAuth {
|
|
32
|
+
protected readonly _clientId: string;
|
|
33
|
+
protected readonly _clientSecret: string | undefined;
|
|
34
|
+
protected readonly _tokenManager: TokenManager;
|
|
35
|
+
protected readonly _timeout: number;
|
|
36
|
+
protected readonly _logger: Logger;
|
|
37
|
+
protected readonly _maxRetries: number;
|
|
38
|
+
protected readonly _revokeUrl: string;
|
|
39
|
+
protected readonly _authorizeUrl: string;
|
|
40
|
+
protected readonly _tokenUrl: string;
|
|
41
|
+
protected readonly _fetch?: typeof fetch;
|
|
42
|
+
constructor(options: BaseAuthOptions, clientSecret?: string);
|
|
43
|
+
/**
|
|
44
|
+
* Subclasses implement this to perform the actual token refresh.
|
|
45
|
+
* For S2S this re-fetches via client_credentials; for WebApp/SPA
|
|
46
|
+
* this uses the stored refresh_token.
|
|
47
|
+
*/
|
|
48
|
+
protected abstract _refresh(): Promise<TokenResponse>;
|
|
49
|
+
/** Return a valid access token, refreshing if necessary. */
|
|
50
|
+
getToken(): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Revoke the current access and refresh tokens in parallel.
|
|
53
|
+
*
|
|
54
|
+
* Access token revocation may take time to propagate server-side,
|
|
55
|
+
* but refresh token revocation takes effect immediately.
|
|
56
|
+
*/
|
|
57
|
+
revoke(): Promise<void>;
|
|
58
|
+
/** Export current token state for persistence. */
|
|
59
|
+
exportTokens(): ExportedTokens;
|
|
60
|
+
/** Restore token state from a previously exported object. */
|
|
61
|
+
importTokens(data: ExportedTokens): void;
|
|
62
|
+
/** Update the token manager from an Adobe IMS response. */
|
|
63
|
+
protected _storeTokens(result: TokenResponse): void;
|
|
64
|
+
/** Send a token request with the shared options. */
|
|
65
|
+
protected _tokenRequest(data: Record<string, string>): Promise<TokenResponse>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for all authentication flows.
|
|
4
|
+
*
|
|
5
|
+
* Provides shared token management methods: `getToken`, `revoke`,
|
|
6
|
+
* `exportTokens`, `importTokens`, and the internal `_storeTokens` helper.
|
|
7
|
+
*
|
|
8
|
+
* Also consolidates shared constructor options and initialization logic.
|
|
9
|
+
*/
|
|
10
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
11
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
14
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
15
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
16
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.BaseAuth = exports.DEFAULT_EXPIRES_IN = void 0;
|
|
21
|
+
const http_1 = require("./http");
|
|
22
|
+
const errors_1 = require("./errors");
|
|
23
|
+
const logger_1 = require("./logger");
|
|
24
|
+
const TokenManager_1 = require("./TokenManager");
|
|
25
|
+
/** Default fallback when Adobe IMS doesn't return expires_in. */
|
|
26
|
+
exports.DEFAULT_EXPIRES_IN = 86400;
|
|
27
|
+
class BaseAuth {
|
|
28
|
+
constructor(options, clientSecret) {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
if (!options.clientId) {
|
|
31
|
+
throw new errors_1.ConfigurationError("clientId is required");
|
|
32
|
+
}
|
|
33
|
+
this._clientId = options.clientId;
|
|
34
|
+
this._clientSecret = clientSecret;
|
|
35
|
+
this._timeout = (_a = options.timeout) !== null && _a !== void 0 ? _a : http_1.DEFAULT_TIMEOUT;
|
|
36
|
+
this._maxRetries = (_b = options.maxRetries) !== null && _b !== void 0 ? _b : http_1.DEFAULT_MAX_RETRIES;
|
|
37
|
+
this._logger = (_c = options.logger) !== null && _c !== void 0 ? _c : logger_1.noopLogger;
|
|
38
|
+
this._fetch = options.fetch;
|
|
39
|
+
const urls = (0, http_1.buildImsUrls)((_d = options.imsBaseUrl) !== null && _d !== void 0 ? _d : http_1.DEFAULT_IMS_BASE_URL);
|
|
40
|
+
this._authorizeUrl = urls.authorizeUrl;
|
|
41
|
+
this._tokenUrl = urls.tokenUrl;
|
|
42
|
+
this._revokeUrl = urls.revokeUrl;
|
|
43
|
+
this._tokenManager = new TokenManager_1.TokenManager({
|
|
44
|
+
refreshFunc: () => this._refresh(),
|
|
45
|
+
refreshBuffer: options.refreshBuffer,
|
|
46
|
+
onTokenRefreshed: options.onTokenRefreshed,
|
|
47
|
+
logger: this._logger,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// ------------------------------------------------------------------
|
|
51
|
+
// Public API (shared by all flows)
|
|
52
|
+
// ------------------------------------------------------------------
|
|
53
|
+
/** Return a valid access token, refreshing if necessary. */
|
|
54
|
+
getToken() {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
return this._tokenManager.getToken();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Revoke the current access and refresh tokens in parallel.
|
|
61
|
+
*
|
|
62
|
+
* Access token revocation may take time to propagate server-side,
|
|
63
|
+
* but refresh token revocation takes effect immediately.
|
|
64
|
+
*/
|
|
65
|
+
revoke() {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const revokeOpts = {
|
|
68
|
+
timeout: this._timeout,
|
|
69
|
+
logger: this._logger,
|
|
70
|
+
revokeUrl: this._revokeUrl,
|
|
71
|
+
fetch: this._fetch,
|
|
72
|
+
};
|
|
73
|
+
const accessToken = this._tokenManager.accessToken;
|
|
74
|
+
const refreshToken = this._tokenManager.refreshTokenValue;
|
|
75
|
+
const revocations = [];
|
|
76
|
+
if (accessToken) {
|
|
77
|
+
revocations.push((0, http_1.revokeRequest)(accessToken, this._clientId, this._clientSecret, revokeOpts));
|
|
78
|
+
}
|
|
79
|
+
if (refreshToken) {
|
|
80
|
+
revocations.push((0, http_1.revokeRequest)(refreshToken, this._clientId, this._clientSecret, revokeOpts));
|
|
81
|
+
}
|
|
82
|
+
yield Promise.all(revocations);
|
|
83
|
+
this._tokenManager.clear();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** Export current token state for persistence. */
|
|
87
|
+
exportTokens() {
|
|
88
|
+
return this._tokenManager.exportTokens();
|
|
89
|
+
}
|
|
90
|
+
/** Restore token state from a previously exported object. */
|
|
91
|
+
importTokens(data) {
|
|
92
|
+
this._tokenManager.importTokens(data);
|
|
93
|
+
}
|
|
94
|
+
// ------------------------------------------------------------------
|
|
95
|
+
// Helpers
|
|
96
|
+
// ------------------------------------------------------------------
|
|
97
|
+
/** Update the token manager from an Adobe IMS response. */
|
|
98
|
+
_storeTokens(result) {
|
|
99
|
+
var _a;
|
|
100
|
+
this._tokenManager.setTokens(result.access_token, (_a = result.expires_in) !== null && _a !== void 0 ? _a : exports.DEFAULT_EXPIRES_IN, result.refresh_token);
|
|
101
|
+
}
|
|
102
|
+
/** Send a token request with the shared options. */
|
|
103
|
+
_tokenRequest(data) {
|
|
104
|
+
return (0, http_1.tokenRequest)(data, {
|
|
105
|
+
timeout: this._timeout,
|
|
106
|
+
maxRetries: this._maxRetries,
|
|
107
|
+
logger: this._logger,
|
|
108
|
+
tokenUrl: this._tokenUrl,
|
|
109
|
+
fetch: this._fetch,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.BaseAuth = BaseAuth;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native App authentication (authorization_code + PKCE).
|
|
3
|
+
*
|
|
4
|
+
* Use for desktop and mobile applications with custom URI schemes
|
|
5
|
+
* or loopback redirects.
|
|
6
|
+
*/
|
|
7
|
+
import { SPAAuth, type SPAAuthOptions } from "./SPAAuth";
|
|
8
|
+
export type NativeAppAuthOptions = SPAAuthOptions;
|
|
9
|
+
/**
|
|
10
|
+
* Authenticate native (desktop / mobile) apps using PKCE.
|
|
11
|
+
*
|
|
12
|
+
* Functionally identical to {@link SPAAuth} but allows custom URI scheme
|
|
13
|
+
* redirect URIs (e.g. `adobe+<hash>://callback`, `myapp://callback`).
|
|
14
|
+
*
|
|
15
|
+
* The parent {@link SPAAuth} validates that `http://` redirect URIs only
|
|
16
|
+
* target loopback addresses, which is also the correct behavior for native
|
|
17
|
+
* apps. Custom URI schemes and `https://` are always allowed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const auth = new NativeAppAuth({
|
|
22
|
+
* clientId: '...',
|
|
23
|
+
* redirectUri: 'myapp://callback',
|
|
24
|
+
* });
|
|
25
|
+
* const { url, codeVerifier } = await auth.getAuthorizationUrl({ state: 'random' });
|
|
26
|
+
* // open system browser to url ...
|
|
27
|
+
* await auth.exchangeCode({ code: 'CODE', codeVerifier });
|
|
28
|
+
* const client = new FrameioClient({ token: () => auth.getToken() });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class NativeAppAuth extends SPAAuth {
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Native App authentication (authorization_code + PKCE).
|
|
4
|
+
*
|
|
5
|
+
* Use for desktop and mobile applications with custom URI schemes
|
|
6
|
+
* or loopback redirects.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.NativeAppAuth = void 0;
|
|
10
|
+
const SPAAuth_1 = require("./SPAAuth");
|
|
11
|
+
/**
|
|
12
|
+
* Authenticate native (desktop / mobile) apps using PKCE.
|
|
13
|
+
*
|
|
14
|
+
* Functionally identical to {@link SPAAuth} but allows custom URI scheme
|
|
15
|
+
* redirect URIs (e.g. `adobe+<hash>://callback`, `myapp://callback`).
|
|
16
|
+
*
|
|
17
|
+
* The parent {@link SPAAuth} validates that `http://` redirect URIs only
|
|
18
|
+
* target loopback addresses, which is also the correct behavior for native
|
|
19
|
+
* apps. Custom URI schemes and `https://` are always allowed.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const auth = new NativeAppAuth({
|
|
24
|
+
* clientId: '...',
|
|
25
|
+
* redirectUri: 'myapp://callback',
|
|
26
|
+
* });
|
|
27
|
+
* const { url, codeVerifier } = await auth.getAuthorizationUrl({ state: 'random' });
|
|
28
|
+
* // open system browser to url ...
|
|
29
|
+
* await auth.exchangeCode({ code: 'CODE', codeVerifier });
|
|
30
|
+
* const client = new FrameioClient({ token: () => auth.getToken() });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
class NativeAppAuth extends SPAAuth_1.SPAAuth {
|
|
34
|
+
}
|
|
35
|
+
exports.NativeAppAuth = NativeAppAuth;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single Page App authentication (authorization_code + PKCE).
|
|
3
|
+
*
|
|
4
|
+
* Use for browser-based apps that cannot store a client secret.
|
|
5
|
+
*/
|
|
6
|
+
import { BaseAuth, type BaseAuthOptions } from "./BaseAuth";
|
|
7
|
+
import type { TokenResponse } from "./TokenManager";
|
|
8
|
+
/** Returned by `getAuthorizationUrl` — contains the URL and PKCE verifier. */
|
|
9
|
+
export interface AuthorizationUrlResult {
|
|
10
|
+
url: string;
|
|
11
|
+
codeVerifier: string;
|
|
12
|
+
}
|
|
13
|
+
export type SPAAuthOptions = BaseAuthOptions & {
|
|
14
|
+
redirectUri: string;
|
|
15
|
+
};
|
|
16
|
+
export declare class SPAAuth extends BaseAuth {
|
|
17
|
+
protected readonly _redirectUri: string;
|
|
18
|
+
protected readonly _scopes: string;
|
|
19
|
+
constructor(options: SPAAuthOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Build the Adobe IMS authorization URL with PKCE challenge.
|
|
22
|
+
*
|
|
23
|
+
* @returns Object with `url` and `codeVerifier` (store the verifier for exchange).
|
|
24
|
+
*/
|
|
25
|
+
getAuthorizationUrl(options: {
|
|
26
|
+
state: string;
|
|
27
|
+
}): Promise<AuthorizationUrlResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Exchange an authorization code + PKCE verifier for tokens.
|
|
30
|
+
*/
|
|
31
|
+
exchangeCode(options: {
|
|
32
|
+
code: string;
|
|
33
|
+
codeVerifier: string;
|
|
34
|
+
}): Promise<TokenResponse>;
|
|
35
|
+
/** Manually trigger a token refresh. */
|
|
36
|
+
refresh(): Promise<TokenResponse>;
|
|
37
|
+
protected _refresh(): Promise<TokenResponse>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Single Page App authentication (authorization_code + PKCE).
|
|
4
|
+
*
|
|
5
|
+
* Use for browser-based apps that cannot store a client secret.
|
|
6
|
+
*/
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.SPAAuth = void 0;
|
|
18
|
+
const BaseAuth_1 = require("./BaseAuth");
|
|
19
|
+
const errors_1 = require("./errors");
|
|
20
|
+
const http_1 = require("./http");
|
|
21
|
+
const pkce_1 = require("./pkce");
|
|
22
|
+
const validation_1 = require("./validation");
|
|
23
|
+
class SPAAuth extends BaseAuth_1.BaseAuth {
|
|
24
|
+
constructor(options) {
|
|
25
|
+
var _a;
|
|
26
|
+
if (!options.redirectUri) {
|
|
27
|
+
throw new errors_1.ConfigurationError("redirectUri is required");
|
|
28
|
+
}
|
|
29
|
+
(0, validation_1.validateRedirectUriScheme)(options.redirectUri);
|
|
30
|
+
super(options);
|
|
31
|
+
this._redirectUri = options.redirectUri;
|
|
32
|
+
this._scopes = (_a = options.scopes) !== null && _a !== void 0 ? _a : http_1.DEFAULT_SCOPES;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build the Adobe IMS authorization URL with PKCE challenge.
|
|
36
|
+
*
|
|
37
|
+
* @returns Object with `url` and `codeVerifier` (store the verifier for exchange).
|
|
38
|
+
*/
|
|
39
|
+
getAuthorizationUrl(options) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const codeVerifier = (0, pkce_1.generateCodeVerifier)();
|
|
42
|
+
const codeChallenge = yield (0, pkce_1.generateCodeChallenge)(codeVerifier);
|
|
43
|
+
const params = new URLSearchParams({
|
|
44
|
+
client_id: this._clientId,
|
|
45
|
+
redirect_uri: this._redirectUri,
|
|
46
|
+
scope: this._scopes,
|
|
47
|
+
response_type: "code",
|
|
48
|
+
state: options.state,
|
|
49
|
+
code_challenge: codeChallenge,
|
|
50
|
+
code_challenge_method: "S256",
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
url: `${this._authorizeUrl}?${params.toString()}`,
|
|
54
|
+
codeVerifier,
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Exchange an authorization code + PKCE verifier for tokens.
|
|
60
|
+
*/
|
|
61
|
+
exchangeCode(options) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const result = yield this._tokenRequest({
|
|
64
|
+
grant_type: "authorization_code",
|
|
65
|
+
client_id: this._clientId,
|
|
66
|
+
code: options.code,
|
|
67
|
+
redirect_uri: this._redirectUri,
|
|
68
|
+
code_verifier: options.codeVerifier,
|
|
69
|
+
});
|
|
70
|
+
this._storeTokens(result);
|
|
71
|
+
return result;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** Manually trigger a token refresh. */
|
|
75
|
+
refresh() {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const result = yield this._refresh();
|
|
78
|
+
this._storeTokens(result);
|
|
79
|
+
return result;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
_refresh() {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const refreshTok = this._tokenManager.refreshTokenValue;
|
|
85
|
+
if (!refreshTok) {
|
|
86
|
+
throw new errors_1.ConfigurationError("No refresh token available. Call exchangeCode() first.");
|
|
87
|
+
}
|
|
88
|
+
return this._tokenRequest({
|
|
89
|
+
grant_type: "refresh_token",
|
|
90
|
+
client_id: this._clientId,
|
|
91
|
+
refresh_token: refreshTok,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.SPAAuth = SPAAuth;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-to-Server authentication (client_credentials grant).
|
|
3
|
+
*
|
|
4
|
+
* Use for backend services and scripts with no user interaction.
|
|
5
|
+
*/
|
|
6
|
+
import { BaseAuth, type BaseAuthOptions } from "./BaseAuth";
|
|
7
|
+
import type { TokenResponse } from "./TokenManager";
|
|
8
|
+
export interface ServerToServerAuthOptions extends BaseAuthOptions {
|
|
9
|
+
clientSecret: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class ServerToServerAuth extends BaseAuth {
|
|
12
|
+
private readonly _scopes;
|
|
13
|
+
constructor(options: ServerToServerAuthOptions);
|
|
14
|
+
/** Explicitly fetch a new access token. */
|
|
15
|
+
authenticate(): Promise<TokenResponse>;
|
|
16
|
+
protected _refresh(): Promise<TokenResponse>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Server-to-Server authentication (client_credentials grant).
|
|
4
|
+
*
|
|
5
|
+
* Use for backend services and scripts with no user interaction.
|
|
6
|
+
*/
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ServerToServerAuth = void 0;
|
|
18
|
+
const BaseAuth_1 = require("./BaseAuth");
|
|
19
|
+
const errors_1 = require("./errors");
|
|
20
|
+
const http_1 = require("./http");
|
|
21
|
+
class ServerToServerAuth extends BaseAuth_1.BaseAuth {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
var _a;
|
|
24
|
+
if (!options.clientSecret) {
|
|
25
|
+
throw new errors_1.ConfigurationError("clientSecret is required");
|
|
26
|
+
}
|
|
27
|
+
super(options, options.clientSecret);
|
|
28
|
+
this._scopes = (_a = options.scopes) !== null && _a !== void 0 ? _a : http_1.S2S_SCOPES;
|
|
29
|
+
}
|
|
30
|
+
/** Explicitly fetch a new access token. */
|
|
31
|
+
authenticate() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const result = yield this._refresh();
|
|
34
|
+
this._storeTokens(result);
|
|
35
|
+
return result;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
_refresh() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return this._tokenRequest({
|
|
41
|
+
grant_type: "client_credentials",
|
|
42
|
+
client_id: this._clientId,
|
|
43
|
+
client_secret: this._clientSecret,
|
|
44
|
+
scope: this._scopes,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.ServerToServerAuth = ServerToServerAuth;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token lifecycle manager — the core of frameio-auth-sdk.
|
|
3
|
+
*
|
|
4
|
+
* Stores access/refresh tokens, checks expiry with a configurable buffer,
|
|
5
|
+
* and coordinates async-safe automatic refresh.
|
|
6
|
+
*/
|
|
7
|
+
import type { Logger } from "./logger";
|
|
8
|
+
/** Shape returned by refresh functions and token endpoints. */
|
|
9
|
+
export interface TokenResponse {
|
|
10
|
+
access_token: string;
|
|
11
|
+
expires_in: number;
|
|
12
|
+
refresh_token?: string;
|
|
13
|
+
token_type?: string;
|
|
14
|
+
scope?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Serialised token state for persistence. */
|
|
17
|
+
export interface ExportedTokens {
|
|
18
|
+
access_token: string | null;
|
|
19
|
+
refresh_token: string | null;
|
|
20
|
+
expires_at: number;
|
|
21
|
+
}
|
|
22
|
+
/** A function that performs the actual token refresh / fetch. */
|
|
23
|
+
export type RefreshFunction = () => Promise<TokenResponse>;
|
|
24
|
+
/** Optional callback fired after every successful token refresh. */
|
|
25
|
+
export type OnTokenRefreshed = (tokens: ExportedTokens) => void;
|
|
26
|
+
export interface TokenManagerOptions {
|
|
27
|
+
refreshFunc: RefreshFunction;
|
|
28
|
+
/** Seconds before actual expiry to trigger proactive refresh. Default: 60. */
|
|
29
|
+
refreshBuffer?: number;
|
|
30
|
+
/** Called after every successful refresh. */
|
|
31
|
+
onTokenRefreshed?: OnTokenRefreshed;
|
|
32
|
+
/** Logger instance for diagnostic output. */
|
|
33
|
+
logger?: Logger;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Manages token storage, expiry detection, and auto-refresh.
|
|
37
|
+
*
|
|
38
|
+
* Pass `manager.getToken` (bound) to the Frame.io SDK:
|
|
39
|
+
* ```ts
|
|
40
|
+
* const client = new FrameioClient({ token: () => auth.getToken() });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare class TokenManager {
|
|
44
|
+
private _refreshFunc;
|
|
45
|
+
private _refreshBuffer;
|
|
46
|
+
private _onTokenRefreshed?;
|
|
47
|
+
private _logger;
|
|
48
|
+
private _accessToken;
|
|
49
|
+
private _refreshToken;
|
|
50
|
+
private _expiresAt;
|
|
51
|
+
/** In-flight refresh promise for deduplication. */
|
|
52
|
+
private _refreshPromise;
|
|
53
|
+
/** Set by clear() to prevent an in-flight refresh from restoring tokens. */
|
|
54
|
+
private _revoked;
|
|
55
|
+
constructor(options: TokenManagerOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Return a valid access token, refreshing if necessary.
|
|
58
|
+
*
|
|
59
|
+
* Safe to call concurrently — only one refresh request will fire.
|
|
60
|
+
*/
|
|
61
|
+
getToken(): Promise<string>;
|
|
62
|
+
get accessToken(): string | null;
|
|
63
|
+
get refreshTokenValue(): string | null;
|
|
64
|
+
get expiresAt(): number;
|
|
65
|
+
get isExpired(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Manually set token data (e.g. after initial code exchange).
|
|
68
|
+
*/
|
|
69
|
+
setTokens(accessToken: string, expiresIn: number, refreshToken?: string): void;
|
|
70
|
+
/** Export current token state for persistence. */
|
|
71
|
+
exportTokens(): ExportedTokens;
|
|
72
|
+
/** Restore token state from a previously exported object. */
|
|
73
|
+
importTokens(data: ExportedTokens): void;
|
|
74
|
+
/** Clear all stored tokens and cancel any in-flight refresh. */
|
|
75
|
+
clear(): void;
|
|
76
|
+
private _isTokenValid;
|
|
77
|
+
/**
|
|
78
|
+
* Async-safe refresh: if a refresh is already in flight, await the
|
|
79
|
+
* existing promise instead of firing a second request.
|
|
80
|
+
*/
|
|
81
|
+
private _doRefresh;
|
|
82
|
+
private _executeRefresh;
|
|
83
|
+
}
|