@agility/management-sdk 0.1.2 → 0.1.4-beta.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/.cursor/api-documentation-manifest.md +275 -0
- package/.cursor/api-functions-analysis.md +111 -0
- package/.cursor/docs-final-check.md +269 -0
- package/.cursor/manifest.md +153 -0
- package/.env +92 -0
- package/README.md +219 -352
- package/dist/apiClient.d.ts +86 -0
- package/dist/apiClient.js +229 -0
- package/dist/apiClient.js.map +1 -0
- package/dist/apiMethods/assetMethods.d.ts +28 -6
- package/dist/apiMethods/assetMethods.js +346 -74
- package/dist/apiMethods/assetMethods.js.map +1 -0
- package/dist/apiMethods/authMethods.d.ts +239 -0
- package/dist/apiMethods/authMethods.js +604 -0
- package/dist/apiMethods/batchMethods.d.ts +32 -1
- package/dist/apiMethods/batchMethods.js +324 -42
- package/dist/apiMethods/batchMethods.js.map +1 -0
- package/dist/apiMethods/clientInstance.d.ts +58 -4
- package/dist/apiMethods/clientInstance.js +383 -56
- package/dist/apiMethods/clientInstance.js.map +1 -0
- package/dist/apiMethods/containerMethods.d.ts +15 -7
- package/dist/apiMethods/containerMethods.js +199 -83
- package/dist/apiMethods/containerMethods.js.map +1 -0
- package/dist/apiMethods/contentMethods.d.ts +17 -10
- package/dist/apiMethods/contentMethods.js +432 -149
- package/dist/apiMethods/contentMethods.js.map +1 -0
- package/dist/apiMethods/instanceMethods.d.ts +9 -0
- package/dist/apiMethods/instanceMethods.js +69 -0
- package/dist/apiMethods/instanceMethods.js.map +1 -0
- package/dist/apiMethods/instanceUserMethods.d.ts +3 -3
- package/dist/apiMethods/instanceUserMethods.js +93 -39
- package/dist/apiMethods/instanceUserMethods.js.map +1 -0
- package/dist/apiMethods/modelMethods.d.ts +6 -5
- package/dist/apiMethods/modelMethods.js +150 -61
- package/dist/apiMethods/modelMethods.js.map +1 -0
- package/dist/apiMethods/pageMethods.d.ts +21 -9
- package/dist/apiMethods/pageMethods.js +500 -134
- package/dist/apiMethods/pageMethods.js.map +1 -0
- package/dist/apiMethods/serverUserMethods.d.ts +10 -0
- package/dist/apiMethods/serverUserMethods.js +89 -0
- package/dist/apiMethods/serverUserMethods.js.map +1 -0
- package/dist/apiMethods/webhookMethods.d.ts +12 -0
- package/dist/apiMethods/webhookMethods.js +131 -0
- package/dist/apiMethods/webhookMethods.js.map +1 -0
- package/dist/enums/assetGroupingType.d.ts +3 -0
- package/dist/enums/assetGroupingType.js +7 -0
- package/dist/enums/assetGroupingType.js.map +1 -0
- package/dist/enums/batchItemType.d.ts +7 -0
- package/dist/enums/batchItemType.js +11 -0
- package/dist/enums/batchOperationType.js +1 -1
- package/dist/enums/batchOperationType.js.map +1 -0
- package/dist/enums/batchState..js +1 -1
- package/dist/enums/batchState.d.ts +7 -0
- package/dist/enums/batchState.js +12 -0
- package/dist/enums/batchState.js.map +1 -0
- package/dist/enums/pageItemTemplateType.d.ts +4 -0
- package/dist/enums/pageItemTemplateType.js +8 -0
- package/dist/enums/pageItemTemplateType.js.map +1 -0
- package/dist/enums/workflowOperationType.d.ts +26 -0
- package/dist/enums/workflowOperationType.js +30 -0
- package/dist/errors/exception.d.ts +4 -0
- package/dist/errors/exception.js +11 -0
- package/dist/errors/exception.js.map +1 -0
- package/dist/index.d.ts +41 -9
- package/dist/index.js +48 -10
- package/dist/index.js.map +1 -0
- package/dist/models/assetContainer.d.ts +7 -0
- package/dist/models/assetContainer.js +9 -0
- package/dist/models/assetGalleries.d.ts +5 -0
- package/dist/models/assetGalleries.js +9 -0
- package/dist/models/assetMediaGrouping.d.ts +17 -0
- package/dist/models/assetMediaGrouping.js +9 -0
- package/dist/models/assetMediaGroupingMetaData.d.ts +4 -0
- package/dist/models/assetMediaGroupingMetaData.js +9 -0
- package/dist/models/authTokens.d.ts +73 -0
- package/dist/models/authTokens.js +2 -0
- package/dist/models/batch.js +5 -2
- package/dist/models/batchItem.d.ts +1 -0
- package/dist/models/batchItem.js +5 -2
- package/dist/models/batchRequests.d.ts +67 -0
- package/dist/models/batchRequests.js +2 -0
- package/dist/models/batchTypes.d.ts +34 -0
- package/dist/models/batchTypes.js +2 -0
- package/dist/models/container.d.ts +2 -1
- package/dist/models/container.js +5 -2
- package/dist/models/contentDefinitionTypeID.d.ts +17 -0
- package/dist/models/contentDefinitionTypeID.js +21 -0
- package/dist/models/contentItem.js +25 -10
- package/dist/models/contentItemHistory.d.ts +20 -0
- package/dist/models/contentItemHistory.js +15 -0
- package/dist/models/contentListFilterModel.d.ts +26 -0
- package/dist/models/contentListFilterModel.js +33 -0
- package/dist/models/contentSectionDefaultModule.d.ts +7 -0
- package/dist/models/contentSectionDefaultModule.js +9 -0
- package/dist/models/contentSectionDefinition.d.ts +35 -0
- package/dist/models/contentSectionDefinition.js +9 -0
- package/dist/models/contentViewColumn.js +5 -2
- package/dist/models/exception.js +23 -5
- package/dist/models/instanceRole.js +5 -2
- package/dist/models/instanceUser.js +5 -2
- package/dist/models/itemComments.d.ts +14 -0
- package/dist/models/itemComments.js +15 -0
- package/dist/models/listParams.d.ts +9 -0
- package/dist/models/listParams.js +16 -0
- package/dist/models/locales.d.ts +3 -0
- package/dist/models/locales.js +30 -0
- package/dist/models/media.js +10 -4
- package/dist/models/model.js +10 -4
- package/dist/models/notification.js +5 -2
- package/dist/models/options.d.ts +2 -5
- package/dist/models/options.js +4 -20
- package/dist/models/pageHistory.d.ts +21 -0
- package/dist/models/pageHistory.js +15 -0
- package/dist/models/pageItem.js +30 -12
- package/dist/models/pageModel.d.ts +14 -0
- package/dist/models/pageModel.js +9 -0
- package/dist/models/serverUser.d.ts +21 -0
- package/dist/models/serverUser.js +9 -0
- package/dist/models/sharedModule.d.ts +7 -0
- package/dist/models/sharedModule.js +9 -0
- package/dist/models/sitemap.js +10 -4
- package/dist/models/webhook.d.ts +9 -0
- package/dist/models/webhook.js +9 -0
- package/dist/models/websiteListing.d.ts +16 -0
- package/dist/models/websiteListing.js +9 -0
- package/dist/models/websiteUser.js +10 -4
- package/dist/tests/authHelper.d.ts +2 -0
- package/dist/tests/authHelper.js +14 -0
- package/dist/tests/authHelper.js.map +1 -0
- package/dist/tests/config/apiClient.config.d.ts +16 -0
- package/dist/tests/config/apiClient.config.js +84 -0
- package/dist/tests/config/apiClient.config.js.map +1 -0
- package/dist/tests/config/test.config.d.ts +24 -0
- package/dist/tests/config/test.config.js +47 -0
- package/dist/tests/config/test.config.js.map +1 -0
- package/dist/tokenStorage.d.ts +72 -0
- package/dist/tokenStorage.js +366 -0
- package/dist/types/apiResponse.d.ts +13 -0
- package/dist/types/apiResponse.js +3 -0
- package/dist/types/apiResponse.js.map +1 -0
- package/dist/types/assetContainer.d.ts +7 -0
- package/dist/types/assetContainer.js +3 -0
- package/dist/types/assetContainer.js.map +1 -0
- package/dist/types/assetGalleries.d.ts +5 -0
- package/dist/types/assetGalleries.js +3 -0
- package/dist/types/assetGalleries.js.map +1 -0
- package/dist/types/assetMediaGrouping.d.ts +17 -0
- package/dist/types/assetMediaGrouping.js +3 -0
- package/dist/types/assetMediaGrouping.js.map +1 -0
- package/dist/types/assetMediaGroupingMetaData.d.ts +4 -0
- package/dist/types/assetMediaGroupingMetaData.js +3 -0
- package/dist/types/assetMediaGroupingMetaData.js.map +1 -0
- package/dist/types/batch.d.ts +29 -0
- package/dist/types/batch.js +3 -0
- package/dist/types/batch.js.map +1 -0
- package/dist/types/batchItem.d.ts +13 -0
- package/dist/types/batchItem.js +3 -0
- package/dist/types/batchItem.js.map +1 -0
- package/dist/types/container.d.ts +47 -0
- package/dist/types/container.js +3 -0
- package/dist/types/container.js.map +1 -0
- package/dist/types/contentItem.d.ts +37 -0
- package/dist/types/contentItem.js +3 -0
- package/dist/types/contentItem.js.map +1 -0
- package/dist/types/contentItemHistory.d.ts +20 -0
- package/dist/types/contentItemHistory.js +3 -0
- package/dist/types/contentItemHistory.js.map +1 -0
- package/dist/types/contentListFilterModel.d.ts +26 -0
- package/dist/types/contentListFilterModel.js +3 -0
- package/dist/types/contentListFilterModel.js.map +1 -0
- package/dist/types/contentSectionDefaultModule.d.ts +7 -0
- package/dist/types/contentSectionDefaultModule.js +3 -0
- package/dist/types/contentSectionDefaultModule.js.map +1 -0
- package/dist/types/contentSectionDefinition.d.ts +35 -0
- package/dist/types/contentSectionDefinition.js +3 -0
- package/dist/types/contentSectionDefinition.js.map +1 -0
- package/dist/types/contentViewColumn.d.ts +8 -0
- package/dist/types/contentViewColumn.js +3 -0
- package/dist/types/contentViewColumn.js.map +1 -0
- package/dist/types/instanceRole.d.ts +7 -0
- package/dist/types/instanceRole.js +3 -0
- package/dist/types/instanceRole.js.map +1 -0
- package/dist/types/instanceUser.d.ts +14 -0
- package/dist/types/instanceUser.js +3 -0
- package/dist/types/instanceUser.js.map +1 -0
- package/dist/types/itemComments.d.ts +14 -0
- package/dist/types/itemComments.js +3 -0
- package/dist/types/itemComments.js.map +1 -0
- package/dist/types/listParams.d.ts +9 -0
- package/dist/types/listParams.js +3 -0
- package/dist/types/listParams.js.map +1 -0
- package/dist/types/locales.d.ts +1 -0
- package/dist/types/locales.js +3 -0
- package/dist/types/locales.js.map +1 -0
- package/dist/types/media.d.ts +30 -0
- package/dist/types/media.js +3 -0
- package/dist/types/media.js.map +1 -0
- package/dist/types/model.d.ts +30 -0
- package/dist/types/model.js +3 -0
- package/dist/types/model.js.map +1 -0
- package/dist/types/notification.d.ts +13 -0
- package/dist/types/notification.js +3 -0
- package/dist/types/notification.js.map +1 -0
- package/dist/types/options.d.ts +7 -0
- package/dist/types/options.js +3 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/pageHistory.d.ts +21 -0
- package/dist/types/pageHistory.js +3 -0
- package/dist/types/pageHistory.js.map +1 -0
- package/dist/types/pageItem.d.ts +56 -0
- package/dist/types/pageItem.js +3 -0
- package/dist/types/pageItem.js.map +1 -0
- package/dist/types/pageModel.d.ts +14 -0
- package/dist/types/pageModel.js +3 -0
- package/dist/types/pageModel.js.map +1 -0
- package/dist/types/serverUser.d.ts +21 -0
- package/dist/types/serverUser.js +3 -0
- package/dist/types/serverUser.js.map +1 -0
- package/dist/types/sharedModule.d.ts +7 -0
- package/dist/types/sharedModule.js +3 -0
- package/dist/types/sharedModule.js.map +1 -0
- package/dist/types/sitemap.d.ts +20 -0
- package/dist/types/sitemap.js +3 -0
- package/dist/types/sitemap.js.map +1 -0
- package/dist/types/tokenResponseData.d.ts +10 -0
- package/dist/types/tokenResponseData.js +3 -0
- package/dist/types/tokenResponseData.js.map +1 -0
- package/dist/types/webhook.d.ts +9 -0
- package/dist/types/webhook.js +3 -0
- package/dist/types/webhook.js.map +1 -0
- package/dist/types/websiteListing.d.ts +16 -0
- package/dist/types/websiteListing.js +3 -0
- package/dist/types/websiteListing.js.map +1 -0
- package/dist/types/websiteUser.d.ts +22 -0
- package/dist/types/websiteUser.js +3 -0
- package/dist/types/websiteUser.js.map +1 -0
- package/docs/asset-methods.md +382 -0
- package/docs/auth.md +594 -0
- package/docs/batch-methods.md +244 -0
- package/docs/cicd.md +607 -0
- package/docs/container-methods.md +268 -0
- package/docs/content-methods.md +423 -0
- package/docs/instance-methods.md +105 -0
- package/docs/instance-user-methods.md +231 -0
- package/docs/model-methods.md +434 -0
- package/docs/multi-instance-operations.md +192 -0
- package/docs/page-methods.md +671 -0
- package/docs/server-user-methods.md +280 -0
- package/docs/webhook-methods.md +452 -0
- package/package.json +14 -10
- package/tsconfig.json +2 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface StoredTokenData {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
refreshToken?: string;
|
|
4
|
+
expiresAt?: number;
|
|
5
|
+
tokenType?: string;
|
|
6
|
+
scope?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TokenStorageOptions {
|
|
9
|
+
serviceName?: string;
|
|
10
|
+
accountName?: string;
|
|
11
|
+
fallbackToMemory?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Secure token storage using OS-level keychain/credential store
|
|
15
|
+
* Falls back to in-memory storage if keytar is unavailable
|
|
16
|
+
*/
|
|
17
|
+
export declare class TokenStorage {
|
|
18
|
+
private serviceName;
|
|
19
|
+
private accountName;
|
|
20
|
+
private fallbackToMemory;
|
|
21
|
+
private memoryStorage;
|
|
22
|
+
private keytarAvailable;
|
|
23
|
+
constructor(options?: TokenStorageOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Test if keytar is available on this platform
|
|
26
|
+
*/
|
|
27
|
+
private testKeytarAvailability;
|
|
28
|
+
/**
|
|
29
|
+
* Store token data securely
|
|
30
|
+
*/
|
|
31
|
+
setTokens(tokenData: StoredTokenData): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieve token data
|
|
34
|
+
*/
|
|
35
|
+
getTokens(): Promise<StoredTokenData | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Check if stored tokens are expired
|
|
38
|
+
*/
|
|
39
|
+
areTokensExpired(): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Get access token if not expired
|
|
42
|
+
*/
|
|
43
|
+
getValidAccessToken(): Promise<string | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Get refresh token
|
|
46
|
+
*/
|
|
47
|
+
getRefreshToken(): Promise<string | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Update only the access token (keeping refresh token)
|
|
50
|
+
*/
|
|
51
|
+
updateAccessToken(accessToken: string, expiresIn?: number): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all stored tokens
|
|
54
|
+
*/
|
|
55
|
+
clearTokens(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Check if tokens exist (regardless of expiration)
|
|
58
|
+
*/
|
|
59
|
+
hasTokens(): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Get token expiration time
|
|
62
|
+
*/
|
|
63
|
+
getTokenExpiration(): Promise<number | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Calculate time until expiration in seconds
|
|
66
|
+
*/
|
|
67
|
+
getTimeUntilExpiration(): Promise<number>;
|
|
68
|
+
/**
|
|
69
|
+
* Get storage type being used
|
|
70
|
+
*/
|
|
71
|
+
getStorageType(): 'keytar' | 'memory';
|
|
72
|
+
}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
47
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
48
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
50
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
51
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
52
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
56
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
58
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
59
|
+
function step(op) {
|
|
60
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
61
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
62
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
63
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
64
|
+
switch (op[0]) {
|
|
65
|
+
case 0: case 1: t = op; break;
|
|
66
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
67
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
68
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
69
|
+
default:
|
|
70
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
71
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
72
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
73
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
74
|
+
if (t[2]) _.ops.pop();
|
|
75
|
+
_.trys.pop(); continue;
|
|
76
|
+
}
|
|
77
|
+
op = body.call(thisArg, _);
|
|
78
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
79
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
83
|
+
exports.TokenStorage = void 0;
|
|
84
|
+
var keytar = __importStar(require("keytar"));
|
|
85
|
+
/**
|
|
86
|
+
* Secure token storage using OS-level keychain/credential store
|
|
87
|
+
* Falls back to in-memory storage if keytar is unavailable
|
|
88
|
+
*/
|
|
89
|
+
var TokenStorage = /** @class */ (function () {
|
|
90
|
+
function TokenStorage(options) {
|
|
91
|
+
if (options === void 0) { options = {}; }
|
|
92
|
+
this.memoryStorage = new Map();
|
|
93
|
+
this.keytarAvailable = true;
|
|
94
|
+
this.serviceName = options.serviceName || 'agility-cms-management-sdk';
|
|
95
|
+
this.accountName = options.accountName || 'default';
|
|
96
|
+
this.fallbackToMemory = options.fallbackToMemory !== false;
|
|
97
|
+
// Test keytar availability
|
|
98
|
+
this.testKeytarAvailability();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Test if keytar is available on this platform
|
|
102
|
+
*/
|
|
103
|
+
TokenStorage.prototype.testKeytarAvailability = function () {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
+
var error_1;
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0:
|
|
109
|
+
_a.trys.push([0, 2, , 3]);
|
|
110
|
+
// Test keytar by trying to access it
|
|
111
|
+
return [4 /*yield*/, keytar.findCredentials(this.serviceName + '-test')];
|
|
112
|
+
case 1:
|
|
113
|
+
// Test keytar by trying to access it
|
|
114
|
+
_a.sent();
|
|
115
|
+
this.keytarAvailable = true;
|
|
116
|
+
return [3 /*break*/, 3];
|
|
117
|
+
case 2:
|
|
118
|
+
error_1 = _a.sent();
|
|
119
|
+
console.warn('Keytar not available, falling back to memory storage:', error_1);
|
|
120
|
+
this.keytarAvailable = false;
|
|
121
|
+
return [3 /*break*/, 3];
|
|
122
|
+
case 3: return [2 /*return*/];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Store token data securely
|
|
129
|
+
*/
|
|
130
|
+
TokenStorage.prototype.setTokens = function (tokenData) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
132
|
+
var serializedData, error_2;
|
|
133
|
+
return __generator(this, function (_a) {
|
|
134
|
+
switch (_a.label) {
|
|
135
|
+
case 0:
|
|
136
|
+
serializedData = JSON.stringify(tokenData);
|
|
137
|
+
if (!this.keytarAvailable) return [3 /*break*/, 4];
|
|
138
|
+
_a.label = 1;
|
|
139
|
+
case 1:
|
|
140
|
+
_a.trys.push([1, 3, , 4]);
|
|
141
|
+
return [4 /*yield*/, keytar.setPassword(this.serviceName, this.accountName, serializedData)];
|
|
142
|
+
case 2:
|
|
143
|
+
_a.sent();
|
|
144
|
+
return [2 /*return*/];
|
|
145
|
+
case 3:
|
|
146
|
+
error_2 = _a.sent();
|
|
147
|
+
console.warn('Failed to store tokens in keytar:', error_2);
|
|
148
|
+
if (!this.fallbackToMemory) {
|
|
149
|
+
throw error_2;
|
|
150
|
+
}
|
|
151
|
+
return [3 /*break*/, 4];
|
|
152
|
+
case 4:
|
|
153
|
+
// Fallback to memory storage
|
|
154
|
+
this.memoryStorage.set(this.accountName, tokenData);
|
|
155
|
+
return [2 /*return*/];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Retrieve token data
|
|
162
|
+
*/
|
|
163
|
+
TokenStorage.prototype.getTokens = function () {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
165
|
+
var serializedData, error_3;
|
|
166
|
+
return __generator(this, function (_a) {
|
|
167
|
+
switch (_a.label) {
|
|
168
|
+
case 0:
|
|
169
|
+
if (!this.keytarAvailable) return [3 /*break*/, 4];
|
|
170
|
+
_a.label = 1;
|
|
171
|
+
case 1:
|
|
172
|
+
_a.trys.push([1, 3, , 4]);
|
|
173
|
+
return [4 /*yield*/, keytar.getPassword(this.serviceName, this.accountName)];
|
|
174
|
+
case 2:
|
|
175
|
+
serializedData = _a.sent();
|
|
176
|
+
if (serializedData) {
|
|
177
|
+
return [2 /*return*/, JSON.parse(serializedData)];
|
|
178
|
+
}
|
|
179
|
+
return [3 /*break*/, 4];
|
|
180
|
+
case 3:
|
|
181
|
+
error_3 = _a.sent();
|
|
182
|
+
console.warn('Failed to retrieve tokens from keytar:', error_3);
|
|
183
|
+
if (!this.fallbackToMemory) {
|
|
184
|
+
return [2 /*return*/, null];
|
|
185
|
+
}
|
|
186
|
+
return [3 /*break*/, 4];
|
|
187
|
+
case 4:
|
|
188
|
+
// Fallback to memory storage
|
|
189
|
+
return [2 /*return*/, this.memoryStorage.get(this.accountName) || null];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Check if stored tokens are expired
|
|
196
|
+
*/
|
|
197
|
+
TokenStorage.prototype.areTokensExpired = function () {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
+
var tokenData, now, bufferTime;
|
|
200
|
+
return __generator(this, function (_a) {
|
|
201
|
+
switch (_a.label) {
|
|
202
|
+
case 0: return [4 /*yield*/, this.getTokens()];
|
|
203
|
+
case 1:
|
|
204
|
+
tokenData = _a.sent();
|
|
205
|
+
if (!tokenData || !tokenData.expiresAt) {
|
|
206
|
+
return [2 /*return*/, true]; // No tokens or no expiration info = expired
|
|
207
|
+
}
|
|
208
|
+
now = Date.now();
|
|
209
|
+
bufferTime = 60 * 1000;
|
|
210
|
+
return [2 /*return*/, now >= (tokenData.expiresAt - bufferTime)];
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Get access token if not expired
|
|
217
|
+
*/
|
|
218
|
+
TokenStorage.prototype.getValidAccessToken = function () {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
+
var tokenData, isExpired;
|
|
221
|
+
return __generator(this, function (_a) {
|
|
222
|
+
switch (_a.label) {
|
|
223
|
+
case 0: return [4 /*yield*/, this.getTokens()];
|
|
224
|
+
case 1:
|
|
225
|
+
tokenData = _a.sent();
|
|
226
|
+
if (!tokenData) {
|
|
227
|
+
return [2 /*return*/, null];
|
|
228
|
+
}
|
|
229
|
+
return [4 /*yield*/, this.areTokensExpired()];
|
|
230
|
+
case 2:
|
|
231
|
+
isExpired = _a.sent();
|
|
232
|
+
if (isExpired) {
|
|
233
|
+
return [2 /*return*/, null];
|
|
234
|
+
}
|
|
235
|
+
return [2 /*return*/, tokenData.accessToken];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Get refresh token
|
|
242
|
+
*/
|
|
243
|
+
TokenStorage.prototype.getRefreshToken = function () {
|
|
244
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
245
|
+
var tokenData;
|
|
246
|
+
return __generator(this, function (_a) {
|
|
247
|
+
switch (_a.label) {
|
|
248
|
+
case 0: return [4 /*yield*/, this.getTokens()];
|
|
249
|
+
case 1:
|
|
250
|
+
tokenData = _a.sent();
|
|
251
|
+
return [2 /*return*/, (tokenData === null || tokenData === void 0 ? void 0 : tokenData.refreshToken) || null];
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Update only the access token (keeping refresh token)
|
|
258
|
+
*/
|
|
259
|
+
TokenStorage.prototype.updateAccessToken = function (accessToken, expiresIn) {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
261
|
+
var existingData, tokenData;
|
|
262
|
+
return __generator(this, function (_a) {
|
|
263
|
+
switch (_a.label) {
|
|
264
|
+
case 0: return [4 /*yield*/, this.getTokens()];
|
|
265
|
+
case 1:
|
|
266
|
+
existingData = _a.sent();
|
|
267
|
+
tokenData = __assign(__assign({}, existingData), { accessToken: accessToken, expiresAt: expiresIn ? Date.now() + (expiresIn * 1000) : undefined });
|
|
268
|
+
return [4 /*yield*/, this.setTokens(tokenData)];
|
|
269
|
+
case 2:
|
|
270
|
+
_a.sent();
|
|
271
|
+
return [2 /*return*/];
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Clear all stored tokens
|
|
278
|
+
*/
|
|
279
|
+
TokenStorage.prototype.clearTokens = function () {
|
|
280
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
+
var error_4;
|
|
282
|
+
return __generator(this, function (_a) {
|
|
283
|
+
switch (_a.label) {
|
|
284
|
+
case 0:
|
|
285
|
+
if (!this.keytarAvailable) return [3 /*break*/, 4];
|
|
286
|
+
_a.label = 1;
|
|
287
|
+
case 1:
|
|
288
|
+
_a.trys.push([1, 3, , 4]);
|
|
289
|
+
return [4 /*yield*/, keytar.deletePassword(this.serviceName, this.accountName)];
|
|
290
|
+
case 2:
|
|
291
|
+
_a.sent();
|
|
292
|
+
return [3 /*break*/, 4];
|
|
293
|
+
case 3:
|
|
294
|
+
error_4 = _a.sent();
|
|
295
|
+
console.warn('Failed to clear tokens from keytar:', error_4);
|
|
296
|
+
return [3 /*break*/, 4];
|
|
297
|
+
case 4:
|
|
298
|
+
// Also clear memory storage
|
|
299
|
+
this.memoryStorage.delete(this.accountName);
|
|
300
|
+
return [2 /*return*/];
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Check if tokens exist (regardless of expiration)
|
|
307
|
+
*/
|
|
308
|
+
TokenStorage.prototype.hasTokens = function () {
|
|
309
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
310
|
+
var tokenData;
|
|
311
|
+
return __generator(this, function (_a) {
|
|
312
|
+
switch (_a.label) {
|
|
313
|
+
case 0: return [4 /*yield*/, this.getTokens()];
|
|
314
|
+
case 1:
|
|
315
|
+
tokenData = _a.sent();
|
|
316
|
+
return [2 /*return*/, tokenData !== null && !!tokenData.accessToken];
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Get token expiration time
|
|
323
|
+
*/
|
|
324
|
+
TokenStorage.prototype.getTokenExpiration = function () {
|
|
325
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
326
|
+
var tokenData;
|
|
327
|
+
return __generator(this, function (_a) {
|
|
328
|
+
switch (_a.label) {
|
|
329
|
+
case 0: return [4 /*yield*/, this.getTokens()];
|
|
330
|
+
case 1:
|
|
331
|
+
tokenData = _a.sent();
|
|
332
|
+
return [2 /*return*/, (tokenData === null || tokenData === void 0 ? void 0 : tokenData.expiresAt) || null];
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Calculate time until expiration in seconds
|
|
339
|
+
*/
|
|
340
|
+
TokenStorage.prototype.getTimeUntilExpiration = function () {
|
|
341
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
342
|
+
var expiresAt, now, timeUntilExpiration;
|
|
343
|
+
return __generator(this, function (_a) {
|
|
344
|
+
switch (_a.label) {
|
|
345
|
+
case 0: return [4 /*yield*/, this.getTokenExpiration()];
|
|
346
|
+
case 1:
|
|
347
|
+
expiresAt = _a.sent();
|
|
348
|
+
if (!expiresAt) {
|
|
349
|
+
return [2 /*return*/, 0];
|
|
350
|
+
}
|
|
351
|
+
now = Date.now();
|
|
352
|
+
timeUntilExpiration = Math.max(0, expiresAt - now);
|
|
353
|
+
return [2 /*return*/, Math.floor(timeUntilExpiration / 1000)];
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* Get storage type being used
|
|
360
|
+
*/
|
|
361
|
+
TokenStorage.prototype.getStorageType = function () {
|
|
362
|
+
return this.keytarAvailable ? 'keytar' : 'memory';
|
|
363
|
+
};
|
|
364
|
+
return TokenStorage;
|
|
365
|
+
}());
|
|
366
|
+
exports.TokenStorage = TokenStorage;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a generic success or informational message returned by the API.
|
|
3
|
+
*/
|
|
4
|
+
export interface ApiResponseMessage {
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Represents the typical response structure for DELETE operations, often empty or just a status.
|
|
9
|
+
* For simplicity, we can often expect an empty object or potentially a simple message.
|
|
10
|
+
*/
|
|
11
|
+
export interface DeleteResponse {
|
|
12
|
+
message?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiResponse.js","sourceRoot":"","sources":["../../src/types/apiResponse.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetContainer.js","sourceRoot":"","sources":["../../src/types/assetContainer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetGalleries.js","sourceRoot":"","sources":["../../src/types/assetGalleries.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AssetGroupingType } from "../enums/assetGroupingType";
|
|
2
|
+
import { assetMediaGroupingMetaData } from "./assetMediaGroupingMetaData";
|
|
3
|
+
export interface assetMediaGrouping {
|
|
4
|
+
mediaGroupingID: number | null;
|
|
5
|
+
groupingType: AssetGroupingType | null;
|
|
6
|
+
groupingTypeID: number | null;
|
|
7
|
+
name: string | null;
|
|
8
|
+
description: string | null;
|
|
9
|
+
modifiedBy: number | null;
|
|
10
|
+
modifiedByName: string | null;
|
|
11
|
+
modifiedOn: string | null;
|
|
12
|
+
isDeleted: boolean;
|
|
13
|
+
isFolder: boolean;
|
|
14
|
+
metaData: {
|
|
15
|
+
[key: string]: assetMediaGroupingMetaData;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetMediaGrouping.js","sourceRoot":"","sources":["../../src/types/assetMediaGrouping.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetMediaGroupingMetaData.js","sourceRoot":"","sources":["../../src/types/assetMediaGroupingMetaData.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BatchState } from "../enums/batchState";
|
|
2
|
+
import { BatchOperationType } from "../enums/batchOperationType";
|
|
3
|
+
import { BatchItem } from "./batchItem";
|
|
4
|
+
export interface Batch {
|
|
5
|
+
batchID: number | null;
|
|
6
|
+
batchItemID: number | null;
|
|
7
|
+
batchName: string;
|
|
8
|
+
batchState: BatchState;
|
|
9
|
+
operationType: BatchOperationType;
|
|
10
|
+
ownerUserID: number | null;
|
|
11
|
+
createdDate: string;
|
|
12
|
+
modifiedDate: string;
|
|
13
|
+
processDate: string | null;
|
|
14
|
+
queueDate: string | null;
|
|
15
|
+
isPrivate: boolean;
|
|
16
|
+
modifiedByUserID: number;
|
|
17
|
+
queuedByUserID: number | null;
|
|
18
|
+
ownerName: string;
|
|
19
|
+
modifiedByName: string;
|
|
20
|
+
queuedByName: string;
|
|
21
|
+
additionalData: string;
|
|
22
|
+
errorData: string;
|
|
23
|
+
percentComplete: number | null;
|
|
24
|
+
numItemsProcessed: number | null;
|
|
25
|
+
abortYN: boolean | null;
|
|
26
|
+
statusMessage: string;
|
|
27
|
+
batchItemCount: number;
|
|
28
|
+
items: BatchItem[];
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.js","sourceRoot":"","sources":["../../src/types/batch.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface BatchItem {
|
|
2
|
+
batchItemID: number | null;
|
|
3
|
+
batchID: number | null;
|
|
4
|
+
itemTypeName: string;
|
|
5
|
+
itemID: number;
|
|
6
|
+
languageCode: string;
|
|
7
|
+
processedItemVersionID: number | null;
|
|
8
|
+
itemTitle: string;
|
|
9
|
+
itemNull: boolean;
|
|
10
|
+
createdOn: string;
|
|
11
|
+
createdBy: number;
|
|
12
|
+
createdByName: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batchItem.js","sourceRoot":"","sources":["../../src/types/batchItem.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ContentViewColumn } from "./contentViewColumn";
|
|
2
|
+
export interface Container {
|
|
3
|
+
columns: ContentViewColumn[];
|
|
4
|
+
contentViewID: number | null;
|
|
5
|
+
contentDefinitionID: number | null;
|
|
6
|
+
contentDefinitionName: string | null;
|
|
7
|
+
referenceName: string | null;
|
|
8
|
+
contentViewName: string | null;
|
|
9
|
+
contentDefinitionType: number;
|
|
10
|
+
requiresApproval: boolean | null;
|
|
11
|
+
lastModifiedDate: string | null;
|
|
12
|
+
lastModifiedOn: string | null;
|
|
13
|
+
lastModifiedBy: string | null;
|
|
14
|
+
isShared: boolean | null;
|
|
15
|
+
isDynamicPageList: boolean | null;
|
|
16
|
+
disablePublishFromList: boolean | null;
|
|
17
|
+
contentViewCategoryID: number | null;
|
|
18
|
+
contentViewCategoryReferenceName: string | null;
|
|
19
|
+
contentViewCategoryName: string | null;
|
|
20
|
+
title: string | null;
|
|
21
|
+
defaultPage: string | null;
|
|
22
|
+
isPublished: boolean | null;
|
|
23
|
+
schemaTitle: string | null;
|
|
24
|
+
allowClientSideSave: boolean | null;
|
|
25
|
+
defaultSortColumn: string | null;
|
|
26
|
+
defaultSortDirection: string | null;
|
|
27
|
+
usageCount: number | null;
|
|
28
|
+
isDeleted: boolean | null;
|
|
29
|
+
enableRSSOutput: boolean | null;
|
|
30
|
+
enableAPIOutput: boolean | null;
|
|
31
|
+
commentsRecordTypeName: string | null;
|
|
32
|
+
numRowsInListing: number | null;
|
|
33
|
+
contentDefinitionTypeID: number | null;
|
|
34
|
+
fullSyncModDate: string | null;
|
|
35
|
+
confirmSharingOnPublish: boolean | null;
|
|
36
|
+
contentTemplateName: string | null;
|
|
37
|
+
currentUserCanDelete: boolean | null;
|
|
38
|
+
currentUserCanEdit: boolean | null;
|
|
39
|
+
currentUserCanDesign: boolean | null;
|
|
40
|
+
currentUserCanManage: boolean | null;
|
|
41
|
+
currentUserCanContribute: boolean | null;
|
|
42
|
+
currentUserCanPublish: boolean | null;
|
|
43
|
+
defaultListingPage: string | null;
|
|
44
|
+
defaultDetailsPage: string | null;
|
|
45
|
+
defaultDetailsPageQueryString: string;
|
|
46
|
+
isListItem: boolean | null;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../src/types/container.ts"],"names":[],"mappings":""}
|