@agility/management-sdk 0.1.37 → 0.1.39
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/.github/workflows/npm-publish.yml +61 -0
- package/README.md +396 -371
- package/dist/apiMethods/instanceMethods.d.ts +13 -0
- package/dist/apiMethods/instanceMethods.js +48 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/exception.d.ts +4 -0
- package/dist/models/exception.js +17 -1
- package/dist/models/fetchApiStatus.d.ts +38 -0
- package/dist/models/fetchApiStatus.js +2 -0
- package/docs/asset-methods.md +381 -381
- package/docs/auth-component.md +360 -360
- package/docs/auth.md +593 -593
- package/docs/batch-methods.md +243 -243
- package/docs/cicd.md +606 -606
- package/docs/container-methods.md +267 -267
- package/docs/content-methods.md +491 -491
- package/docs/instance-methods.md +185 -105
- package/docs/instance-user-methods.md +230 -230
- package/docs/model-methods.md +433 -433
- package/docs/multi-instance-operations.md +191 -191
- package/docs/page-methods.md +737 -737
- package/docs/server-user-methods.md +279 -279
- package/docs/webhook-methods.md +451 -451
- package/license.txt +20 -20
- package/package.json +42 -41
- package/tsconfig.json +14 -14
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { Options } from "../models/options";
|
|
2
2
|
import { ClientInstance } from "./clientInstance";
|
|
3
3
|
import { Locales } from "../models/locales";
|
|
4
|
+
import { FetchApiStatus, FetchApiSyncMode } from "../models/fetchApiStatus";
|
|
4
5
|
export declare class InstanceMethods {
|
|
5
6
|
_options: Options;
|
|
6
7
|
_clientInstance: ClientInstance;
|
|
7
8
|
constructor(options: Options);
|
|
8
9
|
getLocales(guid: string): Promise<Locales[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the Fetch API sync status for an instance.
|
|
12
|
+
* Use this to check if changes made via the Management API have propagated to the Fetch API CDNs.
|
|
13
|
+
* This is particularly useful after large batch operations or batch workflows to verify
|
|
14
|
+
* that content changes are available on the CDN before proceeding with dependent operations.
|
|
15
|
+
*
|
|
16
|
+
* @param guid - The website GUID
|
|
17
|
+
* @param mode - Sync mode: 'fetch' (live/published content) or 'preview' (preview content). Defaults to 'fetch'.
|
|
18
|
+
* @param waitForCompletion - If true, polls until sync is complete. Defaults to false.
|
|
19
|
+
* @returns The sync status including whether a sync is in progress and version information
|
|
20
|
+
*/
|
|
21
|
+
getFetchApiStatus(guid: string, mode?: FetchApiSyncMode, waitForCompletion?: boolean): Promise<FetchApiStatus>;
|
|
9
22
|
}
|
|
@@ -64,6 +64,54 @@ var InstanceMethods = /** @class */ (function () {
|
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Gets the Fetch API sync status for an instance.
|
|
69
|
+
* Use this to check if changes made via the Management API have propagated to the Fetch API CDNs.
|
|
70
|
+
* This is particularly useful after large batch operations or batch workflows to verify
|
|
71
|
+
* that content changes are available on the CDN before proceeding with dependent operations.
|
|
72
|
+
*
|
|
73
|
+
* @param guid - The website GUID
|
|
74
|
+
* @param mode - Sync mode: 'fetch' (live/published content) or 'preview' (preview content). Defaults to 'fetch'.
|
|
75
|
+
* @param waitForCompletion - If true, polls until sync is complete. Defaults to false.
|
|
76
|
+
* @returns The sync status including whether a sync is in progress and version information
|
|
77
|
+
*/
|
|
78
|
+
InstanceMethods.prototype.getFetchApiStatus = function (guid_1) {
|
|
79
|
+
return __awaiter(this, arguments, void 0, function (guid, mode, waitForCompletion) {
|
|
80
|
+
var apiPath, resp, resp, status_1, err_2;
|
|
81
|
+
if (mode === void 0) { mode = 'fetch'; }
|
|
82
|
+
if (waitForCompletion === void 0) { waitForCompletion = false; }
|
|
83
|
+
return __generator(this, function (_a) {
|
|
84
|
+
switch (_a.label) {
|
|
85
|
+
case 0:
|
|
86
|
+
_a.trys.push([0, 6, , 7]);
|
|
87
|
+
apiPath = "fetch-api-status?mode=".concat(mode);
|
|
88
|
+
if (!!waitForCompletion) return [3 /*break*/, 2];
|
|
89
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
90
|
+
case 1:
|
|
91
|
+
resp = _a.sent();
|
|
92
|
+
return [2 /*return*/, resp.data];
|
|
93
|
+
case 2:
|
|
94
|
+
if (!true) return [3 /*break*/, 5];
|
|
95
|
+
return [4 /*yield*/, this._clientInstance.executeGet(apiPath, guid, this._options.token)];
|
|
96
|
+
case 3:
|
|
97
|
+
resp = _a.sent();
|
|
98
|
+
status_1 = resp.data;
|
|
99
|
+
if (!status_1.inProgress) {
|
|
100
|
+
return [2 /*return*/, status_1];
|
|
101
|
+
}
|
|
102
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 2000); })];
|
|
103
|
+
case 4:
|
|
104
|
+
_a.sent();
|
|
105
|
+
return [3 /*break*/, 2];
|
|
106
|
+
case 5: return [3 /*break*/, 7];
|
|
107
|
+
case 6:
|
|
108
|
+
err_2 = _a.sent();
|
|
109
|
+
throw new exception_1.Exception("Unable to retrieve Fetch API status.", err_2);
|
|
110
|
+
case 7: return [2 /*return*/];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
67
115
|
return InstanceMethods;
|
|
68
116
|
}());
|
|
69
117
|
exports.InstanceMethods = InstanceMethods;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./models/contentItem";
|
|
|
8
8
|
export * from "./models/contentViewColumn";
|
|
9
9
|
export * from "./models/instanceRole";
|
|
10
10
|
export * from "./models/locales";
|
|
11
|
+
export * from "./models/fetchApiStatus";
|
|
11
12
|
export * from "./models/instanceUser";
|
|
12
13
|
export * from "./models/media";
|
|
13
14
|
export * from "./models/model";
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __exportStar(require("./models/contentItem"), exports);
|
|
|
24
24
|
__exportStar(require("./models/contentViewColumn"), exports);
|
|
25
25
|
__exportStar(require("./models/instanceRole"), exports);
|
|
26
26
|
__exportStar(require("./models/locales"), exports);
|
|
27
|
+
__exportStar(require("./models/fetchApiStatus"), exports);
|
|
27
28
|
__exportStar(require("./models/instanceUser"), exports);
|
|
28
29
|
__exportStar(require("./models/media"), exports);
|
|
29
30
|
__exportStar(require("./models/model"), exports);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare class Exception extends Error {
|
|
2
2
|
constructor(message: string, inner?: Error);
|
|
3
3
|
innerError?: Error;
|
|
4
|
+
/** HTTP status code from the underlying response, when available. */
|
|
5
|
+
statusCode?: number;
|
|
6
|
+
/** Raw response body from the underlying response, when available. */
|
|
7
|
+
responseData?: unknown;
|
|
4
8
|
}
|
package/dist/models/exception.js
CHANGED
|
@@ -19,8 +19,24 @@ exports.Exception = void 0;
|
|
|
19
19
|
var Exception = /** @class */ (function (_super) {
|
|
20
20
|
__extends(Exception, _super);
|
|
21
21
|
function Exception(message, inner) {
|
|
22
|
-
var _this =
|
|
22
|
+
var _this = this;
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
var anyErr = inner;
|
|
25
|
+
var status = (_a = anyErr === null || anyErr === void 0 ? void 0 : anyErr.response) === null || _a === void 0 ? void 0 : _a.status;
|
|
26
|
+
var data = (_b = anyErr === null || anyErr === void 0 ? void 0 : anyErr.response) === null || _b === void 0 ? void 0 : _b.data;
|
|
27
|
+
var detail = data
|
|
28
|
+
? (typeof data === "string"
|
|
29
|
+
? data
|
|
30
|
+
: ((_d = (_c = data.exceptionMessage) !== null && _c !== void 0 ? _c : data.message) !== null && _d !== void 0 ? _d : JSON.stringify(data)))
|
|
31
|
+
: anyErr === null || anyErr === void 0 ? void 0 : anyErr.message;
|
|
32
|
+
// Surface the server's status + response body in the message. The Management API
|
|
33
|
+
// (and other callers) only read Error.message, so folding the response detail in here
|
|
34
|
+
// turns an opaque "Unable to save the container" into
|
|
35
|
+
// "Unable to save the container (HTTP 500): <server message>".
|
|
36
|
+
_this = _super.call(this, detail ? "".concat(message).concat(status ? " (HTTP ".concat(status, ")") : "", ": ").concat(detail) : message) || this;
|
|
23
37
|
_this.innerError = inner;
|
|
38
|
+
_this.statusCode = status;
|
|
39
|
+
_this.responseData = data;
|
|
24
40
|
return _this;
|
|
25
41
|
}
|
|
26
42
|
return Exception;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the sync status of the Fetch API CDN for an instance.
|
|
3
|
+
* Used to check if changes made via the Management API have propagated to the Fetch API CDNs.
|
|
4
|
+
*/
|
|
5
|
+
export interface FetchApiStatus {
|
|
6
|
+
/** Record timestamp */
|
|
7
|
+
timestamp?: string;
|
|
8
|
+
/** When the sync completed */
|
|
9
|
+
completionTime?: string;
|
|
10
|
+
/** Error message if sync failed */
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
/** Indicates if a content sync is currently in progress */
|
|
13
|
+
inProgress: boolean;
|
|
14
|
+
/** Number of items affected by the sync */
|
|
15
|
+
itemsAffected: number;
|
|
16
|
+
/** Last content version ID synced */
|
|
17
|
+
lastContentVersionID: number;
|
|
18
|
+
/** Last deleted content version ID synced */
|
|
19
|
+
lastDeletedContentVersionID: number;
|
|
20
|
+
/** Last deleted page version ID synced */
|
|
21
|
+
lastDeletedPageVersionID: number;
|
|
22
|
+
/** Lease ID for the sync operation */
|
|
23
|
+
leaseID?: string;
|
|
24
|
+
/** Maximum change date processed */
|
|
25
|
+
maxChangeDate?: string;
|
|
26
|
+
/** Maximum content model date processed */
|
|
27
|
+
maxContentModelDate?: string;
|
|
28
|
+
/** Push type (1 = Preview, 2 = Fetch/Live) */
|
|
29
|
+
pushType: number;
|
|
30
|
+
/** When the sync started */
|
|
31
|
+
startTime?: string;
|
|
32
|
+
/** The website name */
|
|
33
|
+
websiteName?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sync mode for checking Fetch API status
|
|
37
|
+
*/
|
|
38
|
+
export type FetchApiSyncMode = 'fetch' | 'preview';
|