@magentrix-corp/magentrix-cli 1.3.16 → 1.3.17
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/LICENSE +25 -25
- package/README.md +1166 -1166
- package/actions/autopublish.old.js +293 -293
- package/actions/config.js +182 -182
- package/actions/create.js +466 -466
- package/actions/help.js +164 -164
- package/actions/iris/buildStage.js +874 -874
- package/actions/iris/delete.js +256 -256
- package/actions/iris/dev.js +391 -391
- package/actions/iris/index.js +6 -6
- package/actions/iris/link.js +375 -375
- package/actions/iris/recover.js +268 -268
- package/actions/main.js +80 -80
- package/actions/publish.js +1420 -1420
- package/actions/pull.js +684 -684
- package/actions/setup.js +148 -148
- package/actions/status.js +17 -17
- package/actions/update.js +248 -248
- package/bin/magentrix.js +393 -393
- package/package.json +55 -55
- package/utils/assetPaths.js +158 -158
- package/utils/autopublishLock.js +77 -77
- package/utils/cacher.js +206 -206
- package/utils/cli/checkInstanceUrl.js +76 -74
- package/utils/cli/helpers/compare.js +282 -282
- package/utils/cli/helpers/ensureApiKey.js +63 -63
- package/utils/cli/helpers/ensureCredentials.js +68 -68
- package/utils/cli/helpers/ensureInstanceUrl.js +75 -75
- package/utils/cli/writeRecords.js +262 -262
- package/utils/compare.js +135 -135
- package/utils/compress.js +17 -17
- package/utils/config.js +527 -527
- package/utils/debug.js +144 -144
- package/utils/diagnostics/testPublishLogic.js +96 -96
- package/utils/diff.js +49 -49
- package/utils/downloadAssets.js +291 -291
- package/utils/filetag.js +115 -115
- package/utils/hash.js +14 -14
- package/utils/iris/backup.js +411 -411
- package/utils/iris/builder.js +541 -541
- package/utils/iris/config-reader.js +664 -664
- package/utils/iris/deleteHelper.js +150 -150
- package/utils/iris/errors.js +537 -537
- package/utils/iris/linker.js +601 -601
- package/utils/iris/lock.js +360 -360
- package/utils/iris/validation.js +360 -360
- package/utils/iris/validator.js +281 -281
- package/utils/iris/zipper.js +248 -248
- package/utils/logger.js +291 -291
- package/utils/magentrix/api/assets.js +220 -220
- package/utils/magentrix/api/auth.js +107 -107
- package/utils/magentrix/api/createEntity.js +61 -61
- package/utils/magentrix/api/deleteEntity.js +55 -55
- package/utils/magentrix/api/iris.js +251 -251
- package/utils/magentrix/api/meqlQuery.js +36 -36
- package/utils/magentrix/api/retrieveEntity.js +86 -86
- package/utils/magentrix/api/updateEntity.js +66 -66
- package/utils/magentrix/fetch.js +168 -168
- package/utils/merge.js +22 -22
- package/utils/permissionError.js +70 -70
- package/utils/preferences.js +40 -40
- package/utils/progress.js +469 -469
- package/utils/spinner.js +43 -43
- package/utils/template.js +52 -52
- package/utils/updateFileBase.js +121 -121
- package/utils/workspaces.js +108 -108
- package/vars/config.js +11 -11
- package/vars/global.js +50 -50
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { fetchMagentrix } from "../fetch.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new ActiveClass or ActivePage entity in Magentrix via the REST API.
|
|
5
|
-
*
|
|
6
|
-
* @async
|
|
7
|
-
* @function createEntity
|
|
8
|
-
* @param {string} instanceUrl - The base URL of the Magentrix instance.
|
|
9
|
-
* @param {string} token - The OAuth2 bearer token for authentication.
|
|
10
|
-
* @param {string} entityName - The Magentrix entity type. Allowed: 'ActiveClass' or 'ActivePage' (case-insensitive).
|
|
11
|
-
* @param {Object} data - The entity data to create. Must include 'Name' and 'Type'.
|
|
12
|
-
* @returns {Promise<Object>} The response data from Magentrix API if successful.
|
|
13
|
-
* @throws {Error} Throws if required parameters are missing, entityName is invalid, or if required fields in data are missing.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* const entity = await createEntity('https://your.magentrix.com', 'yourToken', 'ActiveClass', {
|
|
17
|
-
* Name: "MyNewClass",
|
|
18
|
-
* Body: "...",
|
|
19
|
-
* Description: "A test class",
|
|
20
|
-
* Type: "Class"
|
|
21
|
-
* });
|
|
22
|
-
*/
|
|
23
|
-
export const createEntity = async (instanceUrl, token, entityName, data) => {
|
|
24
|
-
// --- Validate required parameters ---
|
|
25
|
-
if (!instanceUrl || !token) {
|
|
26
|
-
throw new Error('Missing required Magentrix instanceUrl or token');
|
|
27
|
-
}
|
|
28
|
-
if (!entityName || typeof entityName !== 'string') {
|
|
29
|
-
throw new Error("Missing required 'entityName' (must be 'ActiveClass' or 'ActivePage')");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Allowed entity types
|
|
33
|
-
const allowedEntities = ['activeclass', 'activepage'];
|
|
34
|
-
const entity = entityName.trim().toLowerCase();
|
|
35
|
-
if (!allowedEntities.includes(entity)) {
|
|
36
|
-
throw new Error("Invalid 'entityName'. Allowed values: 'ActiveClass' or 'ActivePage'");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Validate data object and required fields
|
|
40
|
-
if (!data || typeof data !== 'object') {
|
|
41
|
-
throw new Error('Missing required data object for entity creation');
|
|
42
|
-
}
|
|
43
|
-
if (!data.Name) {
|
|
44
|
-
throw new Error("Missing required field: 'Name' in data");
|
|
45
|
-
}
|
|
46
|
-
if (!data.Type) {
|
|
47
|
-
throw new Error("Missing required field: 'Type' in data");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const response = await fetchMagentrix({
|
|
51
|
-
instanceUrl,
|
|
52
|
-
token,
|
|
53
|
-
path: `/api/3.0/entity/${entity}`,
|
|
54
|
-
method: "POST",
|
|
55
|
-
body: data,
|
|
56
|
-
returnErrorObject: true
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// --- Success: return parsed response ---
|
|
60
|
-
return response;
|
|
61
|
-
};
|
|
1
|
+
import { fetchMagentrix } from "../fetch.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new ActiveClass or ActivePage entity in Magentrix via the REST API.
|
|
5
|
+
*
|
|
6
|
+
* @async
|
|
7
|
+
* @function createEntity
|
|
8
|
+
* @param {string} instanceUrl - The base URL of the Magentrix instance.
|
|
9
|
+
* @param {string} token - The OAuth2 bearer token for authentication.
|
|
10
|
+
* @param {string} entityName - The Magentrix entity type. Allowed: 'ActiveClass' or 'ActivePage' (case-insensitive).
|
|
11
|
+
* @param {Object} data - The entity data to create. Must include 'Name' and 'Type'.
|
|
12
|
+
* @returns {Promise<Object>} The response data from Magentrix API if successful.
|
|
13
|
+
* @throws {Error} Throws if required parameters are missing, entityName is invalid, or if required fields in data are missing.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const entity = await createEntity('https://your.magentrix.com', 'yourToken', 'ActiveClass', {
|
|
17
|
+
* Name: "MyNewClass",
|
|
18
|
+
* Body: "...",
|
|
19
|
+
* Description: "A test class",
|
|
20
|
+
* Type: "Class"
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
export const createEntity = async (instanceUrl, token, entityName, data) => {
|
|
24
|
+
// --- Validate required parameters ---
|
|
25
|
+
if (!instanceUrl || !token) {
|
|
26
|
+
throw new Error('Missing required Magentrix instanceUrl or token');
|
|
27
|
+
}
|
|
28
|
+
if (!entityName || typeof entityName !== 'string') {
|
|
29
|
+
throw new Error("Missing required 'entityName' (must be 'ActiveClass' or 'ActivePage')");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Allowed entity types
|
|
33
|
+
const allowedEntities = ['activeclass', 'activepage'];
|
|
34
|
+
const entity = entityName.trim().toLowerCase();
|
|
35
|
+
if (!allowedEntities.includes(entity)) {
|
|
36
|
+
throw new Error("Invalid 'entityName'. Allowed values: 'ActiveClass' or 'ActivePage'");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Validate data object and required fields
|
|
40
|
+
if (!data || typeof data !== 'object') {
|
|
41
|
+
throw new Error('Missing required data object for entity creation');
|
|
42
|
+
}
|
|
43
|
+
if (!data.Name) {
|
|
44
|
+
throw new Error("Missing required field: 'Name' in data");
|
|
45
|
+
}
|
|
46
|
+
if (!data.Type) {
|
|
47
|
+
throw new Error("Missing required field: 'Type' in data");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const response = await fetchMagentrix({
|
|
51
|
+
instanceUrl,
|
|
52
|
+
token,
|
|
53
|
+
path: `/api/3.0/entity/${entity}`,
|
|
54
|
+
method: "POST",
|
|
55
|
+
body: data,
|
|
56
|
+
returnErrorObject: true
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// --- Success: return parsed response ---
|
|
60
|
+
return response;
|
|
61
|
+
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { fetchMagentrix } from "../fetch.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Deletes an existing ActiveClass or ActivePage entity in Magentrix via the REST API.
|
|
5
|
-
*
|
|
6
|
-
* @async
|
|
7
|
-
* @function deleteEntity
|
|
8
|
-
* @param {string} instanceUrl - The base URL of the Magentrix instance (e.g. "https://your.magentrix.com").
|
|
9
|
-
* @param {string} token - The OAuth2 bearer token for authentication.
|
|
10
|
-
* @param {string} entityName - The Magentrix entity type. Allowed: "ActiveClass" or "ActivePage" (case-insensitive).
|
|
11
|
-
* @param {string} recordId - The unique Magentrix record ID of the entity to delete.
|
|
12
|
-
* @returns {Promise<Object>} The API response object, or an error object if the deletion fails.
|
|
13
|
-
* @throws {Error} If required parameters are missing or invalid.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* const deleted = await deleteEntity(
|
|
17
|
-
* "https://your.magentrix.com",
|
|
18
|
-
* "yourToken",
|
|
19
|
-
* "ActiveClass",
|
|
20
|
-
* "06bdc45e-8222-44f5-9ed2-40f5a7bc6cb3"
|
|
21
|
-
* );
|
|
22
|
-
*/
|
|
23
|
-
export const deleteEntity = async (instanceUrl, token, entityName, recordId) => {
|
|
24
|
-
// --- Validate required parameters ---
|
|
25
|
-
if (!instanceUrl || typeof instanceUrl !== 'string') {
|
|
26
|
-
throw new Error('Missing or invalid Magentrix instanceUrl');
|
|
27
|
-
}
|
|
28
|
-
if (!token || typeof token !== 'string') {
|
|
29
|
-
throw new Error('Missing or invalid Magentrix token');
|
|
30
|
-
}
|
|
31
|
-
if (!entityName || typeof entityName !== 'string') {
|
|
32
|
-
throw new Error("Missing or invalid 'entityName' (must be 'ActiveClass' or 'ActivePage')");
|
|
33
|
-
}
|
|
34
|
-
if (!recordId || typeof recordId !== 'string') {
|
|
35
|
-
throw new Error("Missing or invalid 'recordId' (must be a Magentrix record GUID string)");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// --- Validate entity type ---
|
|
39
|
-
const allowedEntities = ['activeclass', 'activepage'];
|
|
40
|
-
const entity = entityName.trim().toLowerCase();
|
|
41
|
-
if (!allowedEntities.includes(entity)) {
|
|
42
|
-
throw new Error("Invalid 'entityName'. Allowed: 'ActiveClass' or 'ActivePage'");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// --- Make DELETE request to Magentrix API ---
|
|
46
|
-
const response = await fetchMagentrix({
|
|
47
|
-
instanceUrl,
|
|
48
|
-
token,
|
|
49
|
-
path: `/api/3.0/entity/${entity}/${recordId}`,
|
|
50
|
-
method: "DELETE",
|
|
51
|
-
returnErrorObject: true
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return response;
|
|
55
|
-
};
|
|
1
|
+
import { fetchMagentrix } from "../fetch.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deletes an existing ActiveClass or ActivePage entity in Magentrix via the REST API.
|
|
5
|
+
*
|
|
6
|
+
* @async
|
|
7
|
+
* @function deleteEntity
|
|
8
|
+
* @param {string} instanceUrl - The base URL of the Magentrix instance (e.g. "https://your.magentrix.com").
|
|
9
|
+
* @param {string} token - The OAuth2 bearer token for authentication.
|
|
10
|
+
* @param {string} entityName - The Magentrix entity type. Allowed: "ActiveClass" or "ActivePage" (case-insensitive).
|
|
11
|
+
* @param {string} recordId - The unique Magentrix record ID of the entity to delete.
|
|
12
|
+
* @returns {Promise<Object>} The API response object, or an error object if the deletion fails.
|
|
13
|
+
* @throws {Error} If required parameters are missing or invalid.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const deleted = await deleteEntity(
|
|
17
|
+
* "https://your.magentrix.com",
|
|
18
|
+
* "yourToken",
|
|
19
|
+
* "ActiveClass",
|
|
20
|
+
* "06bdc45e-8222-44f5-9ed2-40f5a7bc6cb3"
|
|
21
|
+
* );
|
|
22
|
+
*/
|
|
23
|
+
export const deleteEntity = async (instanceUrl, token, entityName, recordId) => {
|
|
24
|
+
// --- Validate required parameters ---
|
|
25
|
+
if (!instanceUrl || typeof instanceUrl !== 'string') {
|
|
26
|
+
throw new Error('Missing or invalid Magentrix instanceUrl');
|
|
27
|
+
}
|
|
28
|
+
if (!token || typeof token !== 'string') {
|
|
29
|
+
throw new Error('Missing or invalid Magentrix token');
|
|
30
|
+
}
|
|
31
|
+
if (!entityName || typeof entityName !== 'string') {
|
|
32
|
+
throw new Error("Missing or invalid 'entityName' (must be 'ActiveClass' or 'ActivePage')");
|
|
33
|
+
}
|
|
34
|
+
if (!recordId || typeof recordId !== 'string') {
|
|
35
|
+
throw new Error("Missing or invalid 'recordId' (must be a Magentrix record GUID string)");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// --- Validate entity type ---
|
|
39
|
+
const allowedEntities = ['activeclass', 'activepage'];
|
|
40
|
+
const entity = entityName.trim().toLowerCase();
|
|
41
|
+
if (!allowedEntities.includes(entity)) {
|
|
42
|
+
throw new Error("Invalid 'entityName'. Allowed: 'ActiveClass' or 'ActivePage'");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// --- Make DELETE request to Magentrix API ---
|
|
46
|
+
const response = await fetchMagentrix({
|
|
47
|
+
instanceUrl,
|
|
48
|
+
token,
|
|
49
|
+
path: `/api/3.0/entity/${entity}/${recordId}`,
|
|
50
|
+
method: "DELETE",
|
|
51
|
+
returnErrorObject: true
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return response;
|
|
55
|
+
};
|