frameio 3.2.2 → 4.1.1
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/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/files/client/Client.js +77 -77
- package/dist/cjs/api/resources/folders/client/Client.js +56 -56
- 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 +6 -2
- package/dist/cjs/api/resources/versionStacks/client/Client.js +48 -44
- 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/AuditLogwithIncludes.d.ts +4 -0
- package/dist/cjs/api/types/AuditLogwithIncludes.js +4 -0
- package/dist/cjs/api/types/Filters.d.ts +4 -0
- package/dist/cjs/api/types/Filters.js +4 -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/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/files/client/Client.mjs +78 -78
- package/dist/esm/api/resources/folders/client/Client.mjs +57 -57
- 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 +6 -2
- package/dist/esm/api/resources/versionStacks/client/Client.mjs +49 -45
- 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/AuditLogwithIncludes.d.mts +4 -0
- package/dist/esm/api/types/AuditLogwithIncludes.mjs +4 -0
- package/dist/esm/api/types/Filters.d.mts +4 -0
- package/dist/esm/api/types/Filters.mjs +4 -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 +1 -1
- package/reference.md +14 -10
|
@@ -84,22 +84,22 @@ class WorkspacesClient {
|
|
|
84
84
|
}
|
|
85
85
|
__show(account_id_1, workspace_id_1) {
|
|
86
86
|
return __awaiter(this, arguments, void 0, function* (account_id, workspace_id, request = {}, requestOptions) {
|
|
87
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
88
88
|
const { include } = request;
|
|
89
89
|
const _queryParams = {
|
|
90
90
|
include: include != null ? include : undefined,
|
|
91
91
|
};
|
|
92
92
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
93
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
94
|
-
const _response = yield ((
|
|
95
|
-
url: core.url.join((
|
|
93
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "user-agent": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.userAgent) !== null && _b !== void 0 ? _b : "frameio-ts" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
94
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
95
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.FrameioEnvironment.Default, `v4/accounts/${core.url.encodePathParam(account_id)}/workspaces/${core.url.encodePathParam(workspace_id)}`),
|
|
96
96
|
method: "GET",
|
|
97
97
|
headers: _headers,
|
|
98
98
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
99
|
-
timeoutMs: ((
|
|
100
|
-
maxRetries: (
|
|
99
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
100
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
101
101
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
102
|
-
fetchFn: (
|
|
102
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
103
103
|
logging: this._options.logging,
|
|
104
104
|
});
|
|
105
105
|
if (_response.ok) {
|
|
@@ -158,18 +158,18 @@ class WorkspacesClient {
|
|
|
158
158
|
}
|
|
159
159
|
__delete(account_id, workspace_id, requestOptions) {
|
|
160
160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
161
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
162
162
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
163
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
164
|
-
const _response = yield ((
|
|
165
|
-
url: core.url.join((
|
|
163
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "user-agent": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.userAgent) !== null && _b !== void 0 ? _b : "frameio-ts" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
164
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
165
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.FrameioEnvironment.Default, `v4/accounts/${core.url.encodePathParam(account_id)}/workspaces/${core.url.encodePathParam(workspace_id)}`),
|
|
166
166
|
method: "DELETE",
|
|
167
167
|
headers: _headers,
|
|
168
168
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
169
|
-
timeoutMs: ((
|
|
170
|
-
maxRetries: (
|
|
169
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
170
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
171
171
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
172
|
-
fetchFn: (
|
|
172
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
173
173
|
logging: this._options.logging,
|
|
174
174
|
});
|
|
175
175
|
if (_response.ok) {
|
|
@@ -230,21 +230,21 @@ class WorkspacesClient {
|
|
|
230
230
|
}
|
|
231
231
|
__update(account_id, workspace_id, request, requestOptions) {
|
|
232
232
|
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
233
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
234
234
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
235
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
236
|
-
const _response = yield ((
|
|
237
|
-
url: core.url.join((
|
|
235
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "user-agent": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.userAgent) !== null && _b !== void 0 ? _b : "frameio-ts" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
236
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
237
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.FrameioEnvironment.Default, `v4/accounts/${core.url.encodePathParam(account_id)}/workspaces/${core.url.encodePathParam(workspace_id)}`),
|
|
238
238
|
method: "PATCH",
|
|
239
239
|
headers: _headers,
|
|
240
240
|
contentType: "application/json",
|
|
241
241
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
242
242
|
requestType: "json",
|
|
243
243
|
body: request,
|
|
244
|
-
timeoutMs: ((
|
|
245
|
-
maxRetries: (
|
|
244
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
245
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
246
246
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
247
|
-
fetchFn: (
|
|
247
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
248
248
|
logging: this._options.logging,
|
|
249
249
|
});
|
|
250
250
|
if (_response.ok) {
|
|
@@ -304,17 +304,17 @@ class WorkspacesClient {
|
|
|
304
304
|
return __awaiter(this, arguments, void 0, function* (account_id, _request = {}, requestOptions) {
|
|
305
305
|
var _a, _b;
|
|
306
306
|
const list = core.HttpResponsePromise.interceptFunction((_requestUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
307
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
307
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
308
308
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
309
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
310
|
-
const _response = yield ((
|
|
309
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "user-agent": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.userAgent) !== null && _b !== void 0 ? _b : "frameio-ts" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
310
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
311
311
|
url: _requestUrl,
|
|
312
312
|
method: "GET",
|
|
313
313
|
headers: _headers,
|
|
314
|
-
timeoutMs: ((
|
|
315
|
-
maxRetries: (
|
|
314
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
315
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
316
316
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
317
|
-
fetchFn: (
|
|
317
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
318
318
|
logging: this._options.logging,
|
|
319
319
|
});
|
|
320
320
|
if (_response.ok) {
|
|
@@ -389,21 +389,21 @@ class WorkspacesClient {
|
|
|
389
389
|
}
|
|
390
390
|
__create(account_id, request, requestOptions) {
|
|
391
391
|
return __awaiter(this, void 0, void 0, function* () {
|
|
392
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
392
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
393
393
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
394
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
395
|
-
const _response = yield ((
|
|
396
|
-
url: core.url.join((
|
|
394
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "user-agent": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.userAgent) !== null && _b !== void 0 ? _b : "frameio-ts" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
395
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
396
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.FrameioEnvironment.Default, `v4/accounts/${core.url.encodePathParam(account_id)}/workspaces`),
|
|
397
397
|
method: "POST",
|
|
398
398
|
headers: _headers,
|
|
399
399
|
contentType: "application/json",
|
|
400
400
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
401
401
|
requestType: "json",
|
|
402
402
|
body: request,
|
|
403
|
-
timeoutMs: ((
|
|
404
|
-
maxRetries: (
|
|
403
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
404
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
405
405
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
406
|
-
fetchFn: (
|
|
406
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
407
407
|
logging: this._options.logging,
|
|
408
408
|
});
|
|
409
409
|
if (_response.ok) {
|
|
@@ -10,8 +10,6 @@ export interface Account {
|
|
|
10
10
|
id: string;
|
|
11
11
|
/** The account image url */
|
|
12
12
|
image?: string | undefined;
|
|
13
|
-
/** Whether mounted storage is enabled for this account */
|
|
14
|
-
mounted_storage_enabled?: boolean | undefined;
|
|
15
13
|
/** Account User Roles */
|
|
16
14
|
roles: Account.Roles.Item[];
|
|
17
15
|
/** The number of bytes of non-archived storage in the account. Value is nil when there is no limit */
|
|
@@ -179,6 +179,9 @@ export declare namespace AuditLogwithIncludes {
|
|
|
179
179
|
readonly ShareCreated: "share_created";
|
|
180
180
|
readonly ShareDeleted: "share_deleted";
|
|
181
181
|
readonly ShareInvitesSent: "share_invites_sent";
|
|
182
|
+
readonly ShareListCreated: "share_list_created";
|
|
183
|
+
readonly ShareListDeleted: "share_list_deleted";
|
|
184
|
+
readonly ShareListUpdated: "share_list_updated";
|
|
182
185
|
readonly ShareReviewersAdded: "share_reviewers_added";
|
|
183
186
|
readonly ShareReviewersRemoved: "share_reviewers_removed";
|
|
184
187
|
readonly ShareUpdated: "share_updated";
|
|
@@ -260,6 +263,7 @@ export declare namespace AuditLogwithIncludes {
|
|
|
260
263
|
readonly Reviewer: "reviewer";
|
|
261
264
|
readonly SbwmTemplate: "sbwm_template";
|
|
262
265
|
readonly Share: "share";
|
|
266
|
+
readonly ShareList: "share_list";
|
|
263
267
|
readonly Subscription: "subscription";
|
|
264
268
|
readonly SubscriptionLineItem: "subscription_line_item";
|
|
265
269
|
readonly Team: "team";
|
|
@@ -168,6 +168,9 @@ var AuditLogwithIncludes;
|
|
|
168
168
|
ShareCreated: "share_created",
|
|
169
169
|
ShareDeleted: "share_deleted",
|
|
170
170
|
ShareInvitesSent: "share_invites_sent",
|
|
171
|
+
ShareListCreated: "share_list_created",
|
|
172
|
+
ShareListDeleted: "share_list_deleted",
|
|
173
|
+
ShareListUpdated: "share_list_updated",
|
|
171
174
|
ShareReviewersAdded: "share_reviewers_added",
|
|
172
175
|
ShareReviewersRemoved: "share_reviewers_removed",
|
|
173
176
|
ShareUpdated: "share_updated",
|
|
@@ -248,6 +251,7 @@ var AuditLogwithIncludes;
|
|
|
248
251
|
Reviewer: "reviewer",
|
|
249
252
|
SbwmTemplate: "sbwm_template",
|
|
250
253
|
Share: "share",
|
|
254
|
+
ShareList: "share_list",
|
|
251
255
|
Subscription: "subscription",
|
|
252
256
|
SubscriptionLineItem: "subscription_line_item",
|
|
253
257
|
Team: "team",
|
|
@@ -187,6 +187,9 @@ export declare namespace Filters {
|
|
|
187
187
|
readonly ShareCreated: "share_created";
|
|
188
188
|
readonly ShareDeleted: "share_deleted";
|
|
189
189
|
readonly ShareInvitesSent: "share_invites_sent";
|
|
190
|
+
readonly ShareListCreated: "share_list_created";
|
|
191
|
+
readonly ShareListDeleted: "share_list_deleted";
|
|
192
|
+
readonly ShareListUpdated: "share_list_updated";
|
|
190
193
|
readonly ShareReviewersAdded: "share_reviewers_added";
|
|
191
194
|
readonly ShareReviewersRemoved: "share_reviewers_removed";
|
|
192
195
|
readonly ShareUpdated: "share_updated";
|
|
@@ -269,6 +272,7 @@ export declare namespace Filters {
|
|
|
269
272
|
readonly Reviewer: "reviewer";
|
|
270
273
|
readonly SbwmTemplate: "sbwm_template";
|
|
271
274
|
readonly Share: "share";
|
|
275
|
+
readonly ShareList: "share_list";
|
|
272
276
|
readonly Subscription: "subscription";
|
|
273
277
|
readonly SubscriptionLineItem: "subscription_line_item";
|
|
274
278
|
readonly Team: "team";
|
|
@@ -169,6 +169,9 @@ var Filters;
|
|
|
169
169
|
ShareCreated: "share_created",
|
|
170
170
|
ShareDeleted: "share_deleted",
|
|
171
171
|
ShareInvitesSent: "share_invites_sent",
|
|
172
|
+
ShareListCreated: "share_list_created",
|
|
173
|
+
ShareListDeleted: "share_list_deleted",
|
|
174
|
+
ShareListUpdated: "share_list_updated",
|
|
172
175
|
ShareReviewersAdded: "share_reviewers_added",
|
|
173
176
|
ShareReviewersRemoved: "share_reviewers_removed",
|
|
174
177
|
ShareUpdated: "share_updated",
|
|
@@ -250,6 +253,7 @@ var Filters;
|
|
|
250
253
|
Reviewer: "reviewer",
|
|
251
254
|
SbwmTemplate: "sbwm_template",
|
|
252
255
|
Share: "share",
|
|
256
|
+
ShareList: "share_list",
|
|
253
257
|
Subscription: "subscription",
|
|
254
258
|
SubscriptionLineItem: "subscription_line_item",
|
|
255
259
|
Team: "team",
|
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
|
+
}
|