@tolinax/ayoune-cli 2026.3.0 → 2026.3.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/package.json +160 -158
- package/data/defaultActions.js +0 -9
- package/data/modelsAndRights.js +0 -3189
- package/data/modules.js +0 -111
- package/data/operations.js +0 -5
- package/data/services.js +0 -139
- package/index.js +0 -11
- package/lib/api/apiCallHandler.js +0 -68
- package/lib/api/apiClient.js +0 -100
- package/lib/api/auditCallHandler.js +0 -21
- package/lib/api/decodeToken.js +0 -4
- package/lib/api/handleAPIError.js +0 -59
- package/lib/api/login.js +0 -45
- package/lib/commands/createActionsCommand.js +0 -109
- package/lib/commands/createAiCommand.js +0 -188
- package/lib/commands/createAliasCommand.js +0 -106
- package/lib/commands/createAuditCommand.js +0 -49
- package/lib/commands/createBatchCommand.js +0 -304
- package/lib/commands/createCompletionsCommand.js +0 -169
- package/lib/commands/createConfigCommand.js +0 -208
- package/lib/commands/createCopyCommand.js +0 -39
- package/lib/commands/createCreateCommand.js +0 -50
- package/lib/commands/createDeleteCommand.js +0 -98
- package/lib/commands/createDeployCommand.js +0 -666
- package/lib/commands/createDescribeCommand.js +0 -42
- package/lib/commands/createEditCommand.js +0 -43
- package/lib/commands/createEventsCommand.js +0 -60
- package/lib/commands/createExecCommand.js +0 -182
- package/lib/commands/createExportCommand.js +0 -219
- package/lib/commands/createGetCommand.js +0 -47
- package/lib/commands/createJobsCommand.js +0 -168
- package/lib/commands/createListCommand.js +0 -49
- package/lib/commands/createLoginCommand.js +0 -18
- package/lib/commands/createLogoutCommand.js +0 -21
- package/lib/commands/createModulesCommand.js +0 -150
- package/lib/commands/createMonitorCommand.js +0 -283
- package/lib/commands/createPermissionsCommand.js +0 -241
- package/lib/commands/createProgram.js +0 -185
- package/lib/commands/createSearchCommand.js +0 -101
- package/lib/commands/createServicesCommand.js +0 -228
- package/lib/commands/createStorageCommand.js +0 -54
- package/lib/commands/createStreamCommand.js +0 -50
- package/lib/commands/createSyncCommand.js +0 -177
- package/lib/commands/createTemplateCommand.js +0 -238
- package/lib/commands/createUpdateCommand.js +0 -115
- package/lib/commands/createUsersCommand.js +0 -285
- package/lib/commands/createWebhooksCommand.js +0 -156
- package/lib/commands/createWhoAmICommand.js +0 -88
- package/lib/exitCodes.js +0 -6
- package/lib/helpers/addSpacesToCamelCase.js +0 -5
- package/lib/helpers/config.js +0 -6
- package/lib/helpers/configLoader.js +0 -60
- package/lib/helpers/formatDocument.js +0 -176
- package/lib/helpers/handleResponseFormatOptions.js +0 -85
- package/lib/helpers/initializeSettings.js +0 -14
- package/lib/helpers/localStorage.js +0 -4
- package/lib/helpers/makeRandomToken.js +0 -27
- package/lib/helpers/parseInt.js +0 -7
- package/lib/helpers/requireArg.js +0 -9
- package/lib/helpers/saveFile.js +0 -39
- package/lib/models/getCollections.js +0 -15
- package/lib/models/getModelsInModules.js +0 -13
- package/lib/models/getModuleFromCollection.js +0 -7
- package/lib/operations/handleAuditOperation.js +0 -22
- package/lib/operations/handleCollectionOperation.js +0 -91
- package/lib/operations/handleCopySingleOperation.js +0 -22
- package/lib/operations/handleCreateSingleOperation.js +0 -35
- package/lib/operations/handleDeleteSingleOperation.js +0 -14
- package/lib/operations/handleDescribeSingleOperation.js +0 -22
- package/lib/operations/handleEditOperation.js +0 -51
- package/lib/operations/handleEditRawOperation.js +0 -35
- package/lib/operations/handleGetOperation.js +0 -29
- package/lib/operations/handleGetSingleOperation.js +0 -20
- package/lib/operations/handleListOperation.js +0 -63
- package/lib/operations/handleSingleAuditOperation.js +0 -27
- package/lib/prompts/promptAudits.js +0 -15
- package/lib/prompts/promptCollection.js +0 -13
- package/lib/prompts/promptCollectionInModule.js +0 -13
- package/lib/prompts/promptCollectionWithModule.js +0 -15
- package/lib/prompts/promptConfirm.js +0 -12
- package/lib/prompts/promptDefaultAction.js +0 -13
- package/lib/prompts/promptEntry.js +0 -19
- package/lib/prompts/promptFileName.js +0 -12
- package/lib/prompts/promptFilePath.js +0 -18
- package/lib/prompts/promptModule.js +0 -19
- package/lib/prompts/promptName.js +0 -11
- package/lib/prompts/promptOperation.js +0 -13
- package/lib/socket/customerSocketClient.js +0 -13
- package/lib/socket/socketClient.js +0 -12
- package/lib/types.js +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import inquirer from "inquirer";
|
|
2
|
-
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
|
-
import { spinner } from "../../index.js";
|
|
4
|
-
export async function handleEditRawOperation(module, collection, result) {
|
|
5
|
-
const { content } = await inquirer.prompt([
|
|
6
|
-
{
|
|
7
|
-
type: "editor",
|
|
8
|
-
name: "content",
|
|
9
|
-
postfix: ".json",
|
|
10
|
-
message: "Edit",
|
|
11
|
-
default: JSON.stringify(result, null, 4),
|
|
12
|
-
},
|
|
13
|
-
]);
|
|
14
|
-
const contentToSave = JSON.parse(content);
|
|
15
|
-
const { save } = await inquirer.prompt([
|
|
16
|
-
{
|
|
17
|
-
type: "confirm",
|
|
18
|
-
name: "save",
|
|
19
|
-
message: "Save changes",
|
|
20
|
-
},
|
|
21
|
-
]);
|
|
22
|
-
if (save) {
|
|
23
|
-
spinner.start({
|
|
24
|
-
text: `Attempting to save [${contentToSave.name}]`,
|
|
25
|
-
color: "magenta",
|
|
26
|
-
});
|
|
27
|
-
const res = await apiCallHandler(module, collection.toLowerCase(), "put", JSON.parse(content));
|
|
28
|
-
result = res.payload;
|
|
29
|
-
console.log(result);
|
|
30
|
-
spinner.success({
|
|
31
|
-
text: `Saved [${contentToSave.name}] - Took ${res.meta.responseTime} ms`,
|
|
32
|
-
});
|
|
33
|
-
spinner.stop();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Operation handling functions
|
|
2
|
-
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
|
-
import { spinner } from "../../index.js";
|
|
4
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
5
|
-
export async function handleGetOperation(module, collection, opts) {
|
|
6
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7
|
-
spinner.start({
|
|
8
|
-
text: `Getting entries in [${collection}]`,
|
|
9
|
-
color: "magenta",
|
|
10
|
-
});
|
|
11
|
-
let res = await apiCallHandler(module, collection.toLowerCase(), "get", null, {
|
|
12
|
-
page: opts.page,
|
|
13
|
-
responseFormat: opts.responseFormat,
|
|
14
|
-
limit: opts.limit,
|
|
15
|
-
from: opts.from,
|
|
16
|
-
fields: opts.fields,
|
|
17
|
-
hideMeta: opts.hideMeta,
|
|
18
|
-
verbosity: opts.verbosity,
|
|
19
|
-
});
|
|
20
|
-
let { plainResult, result, meta, content } = handleResponseFormatOptions(opts, res);
|
|
21
|
-
const totalEntries = (_b = (_a = meta === null || meta === void 0 ? void 0 : meta.pageInfo) === null || _a === void 0 ? void 0 : _a.totalEntries) !== null && _b !== void 0 ? _b : '?';
|
|
22
|
-
const page = (_d = (_c = meta === null || meta === void 0 ? void 0 : meta.pageInfo) === null || _c === void 0 ? void 0 : _c.page) !== null && _d !== void 0 ? _d : 1;
|
|
23
|
-
const totalPages = (_f = (_e = meta === null || meta === void 0 ? void 0 : meta.pageInfo) === null || _e === void 0 ? void 0 : _e.totalPages) !== null && _f !== void 0 ? _f : '?';
|
|
24
|
-
spinner.success({
|
|
25
|
-
text: `Got ${opts.limit} entries of ${totalEntries} : Page ${page} of ${totalPages}`,
|
|
26
|
-
});
|
|
27
|
-
spinner.stop();
|
|
28
|
-
return { data: plainResult, content, result, meta };
|
|
29
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Operation handling functions
|
|
2
|
-
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
|
-
import { spinner } from "../../index.js";
|
|
4
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
5
|
-
export async function handleGetSingleOperation(module, collection, id, opts) {
|
|
6
|
-
spinner.start({
|
|
7
|
-
text: `Getting entry in [${collection}]`,
|
|
8
|
-
color: "magenta",
|
|
9
|
-
});
|
|
10
|
-
let res = await apiCallHandler(module, `${collection.toLowerCase()}/${id}`, "get", null, {
|
|
11
|
-
responseFormat: "table",
|
|
12
|
-
verbosity: opts.verbosity,
|
|
13
|
-
});
|
|
14
|
-
let { plainResult, result, meta, content } = handleResponseFormatOptions({ ...opts, responseFormat: "table" }, res);
|
|
15
|
-
spinner.success({
|
|
16
|
-
text: `Got entry in ${collection}`,
|
|
17
|
-
});
|
|
18
|
-
spinner.stop();
|
|
19
|
-
return { data: plainResult, content, result, meta };
|
|
20
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// Operation handling functions
|
|
2
|
-
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
|
-
import { spinner } from "../../index.js";
|
|
4
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
5
|
-
async function fetchPage(module, collection, opts) {
|
|
6
|
-
return apiCallHandler(module, collection.toLowerCase(), "get", null, {
|
|
7
|
-
page: opts.page,
|
|
8
|
-
responseFormat: opts.responseFormat,
|
|
9
|
-
limit: opts.limit,
|
|
10
|
-
from: opts.from,
|
|
11
|
-
hideMeta: opts.hideMeta,
|
|
12
|
-
verbosity: opts.verbosity,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
export async function handleListOperation(module, collection, opts) {
|
|
16
|
-
var _a, _b, _c, _d;
|
|
17
|
-
spinner.start({
|
|
18
|
-
text: `Listing entries in [${collection}]`,
|
|
19
|
-
color: "magenta",
|
|
20
|
-
});
|
|
21
|
-
if (opts.all) {
|
|
22
|
-
// Auto-pagination: fetch all pages
|
|
23
|
-
let allPayload = [];
|
|
24
|
-
let page = 1;
|
|
25
|
-
let totalPages = 1;
|
|
26
|
-
let meta = {};
|
|
27
|
-
do {
|
|
28
|
-
const pageOpts = { ...opts, page };
|
|
29
|
-
const res = await fetchPage(module, collection, pageOpts);
|
|
30
|
-
const payload = res.payload;
|
|
31
|
-
meta = res.meta;
|
|
32
|
-
totalPages = (_b = (_a = meta.pageInfo) === null || _a === void 0 ? void 0 : _a.totalPages) !== null && _b !== void 0 ? _b : 1;
|
|
33
|
-
if (Array.isArray(payload)) {
|
|
34
|
-
allPayload = allPayload.concat(payload);
|
|
35
|
-
}
|
|
36
|
-
spinner.update({
|
|
37
|
-
text: `Fetching page ${page} of ${totalPages} (${allPayload.length} entries)`,
|
|
38
|
-
});
|
|
39
|
-
page++;
|
|
40
|
-
} while (page <= totalPages);
|
|
41
|
-
// Build a synthetic response with all data
|
|
42
|
-
const syntheticRes = {
|
|
43
|
-
payload: allPayload,
|
|
44
|
-
meta: { ...meta, pageInfo: { ...meta.pageInfo, page: 1, totalPages: 1, totalEntries: allPayload.length } },
|
|
45
|
-
};
|
|
46
|
-
const { plainResult, result, content } = handleResponseFormatOptions(opts, syntheticRes);
|
|
47
|
-
spinner.success({ text: `Got all ${allPayload.length} entries from ${totalPages} pages` });
|
|
48
|
-
spinner.stop();
|
|
49
|
-
return { data: plainResult, content, result, meta: syntheticRes.meta };
|
|
50
|
-
}
|
|
51
|
-
// Single page fetch
|
|
52
|
-
let res = await fetchPage(module, collection, opts);
|
|
53
|
-
let { plainResult, result, meta, content } = handleResponseFormatOptions(opts, res);
|
|
54
|
-
const total = (_d = (_c = meta.pageInfo) === null || _c === void 0 ? void 0 : _c.totalEntries) !== null && _d !== void 0 ? _d : 0;
|
|
55
|
-
const count = Array.isArray(result) ? result.length : total;
|
|
56
|
-
spinner.success({
|
|
57
|
-
text: total > 0
|
|
58
|
-
? `Got ${count} of ${total} entries : Page ${meta.pageInfo.page} of ${meta.pageInfo.totalPages}`
|
|
59
|
-
: `No entries found in [${collection}]`,
|
|
60
|
-
});
|
|
61
|
-
spinner.stop();
|
|
62
|
-
return { data: plainResult, content, result, meta };
|
|
63
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Operation handling functions
|
|
2
|
-
import { spinner } from "../../index.js";
|
|
3
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
4
|
-
import { localStorage } from "../helpers/localStorage.js";
|
|
5
|
-
import { auditCallHandler } from "../api/auditCallHandler.js";
|
|
6
|
-
export async function handleSingleAuditOperation(collection, id, auditId, opts) {
|
|
7
|
-
spinner.start({
|
|
8
|
-
text: `Getting audit [${auditId}] for [${id}] in [${collection}]`,
|
|
9
|
-
color: "magenta",
|
|
10
|
-
});
|
|
11
|
-
let res = await auditCallHandler(`${collection.toLowerCase()}/${id}/${auditId}`, "get", null, {
|
|
12
|
-
responseFormat: opts.responseFormat,
|
|
13
|
-
verbosity: opts.verbosity,
|
|
14
|
-
});
|
|
15
|
-
let { plainResult, result, meta, content } = handleResponseFormatOptions({ ...opts }, res);
|
|
16
|
-
spinner.success({
|
|
17
|
-
text: `Got audit [${auditId}] for [${id}] in [${collection}]`,
|
|
18
|
-
});
|
|
19
|
-
spinner.stop();
|
|
20
|
-
localStorage.setItem("lastId", result._id);
|
|
21
|
-
return {
|
|
22
|
-
singleData: plainResult,
|
|
23
|
-
singleContent: content,
|
|
24
|
-
singleResult: result,
|
|
25
|
-
singleMeta: meta,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import inquirer from "inquirer";
|
|
2
|
-
export async function promptAudits(result) {
|
|
3
|
-
const { audit } = await inquirer.prompt([
|
|
4
|
-
{
|
|
5
|
-
type: "list",
|
|
6
|
-
name: "audit",
|
|
7
|
-
message: "Choose an audit entry:",
|
|
8
|
-
choices: result.map((el) => ({
|
|
9
|
-
name: `${el.action} at ${el.ts} by ${el._userID.first_name} ${el._userID.last_name}`,
|
|
10
|
-
value: el._id,
|
|
11
|
-
})),
|
|
12
|
-
},
|
|
13
|
-
]);
|
|
14
|
-
return audit;
|
|
15
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import inquirer from "inquirer";
|
|
2
|
-
import { getCollections } from "../models/getCollections.js";
|
|
3
|
-
async function promptCollection() {
|
|
4
|
-
const { collection } = await inquirer.prompt([
|
|
5
|
-
{
|
|
6
|
-
type: "list",
|
|
7
|
-
name: "collection",
|
|
8
|
-
message: "Select a collection:",
|
|
9
|
-
choices: getCollections(),
|
|
10
|
-
},
|
|
11
|
-
]);
|
|
12
|
-
return collection;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import inquirer from "inquirer";
|
|
2
|
-
import { getModelsInModules } from "../models/getModelsInModules.js";
|
|
3
|
-
export async function promptCollectionInModule(module) {
|
|
4
|
-
const { collection } = await inquirer.prompt([
|
|
5
|
-
{
|
|
6
|
-
type: "list",
|
|
7
|
-
name: "collection",
|
|
8
|
-
message: "Select a collection:",
|
|
9
|
-
choices: getModelsInModules(module),
|
|
10
|
-
},
|
|
11
|
-
]);
|
|
12
|
-
return collection;
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { promptModule } from "./promptModule.js";
|
|
2
|
-
import inquirer from "inquirer";
|
|
3
|
-
import { getModelsInModules } from "../models/getModelsInModules.js";
|
|
4
|
-
export async function promptCollectionWithModule() {
|
|
5
|
-
const module = await promptModule();
|
|
6
|
-
const { collection } = await inquirer.prompt([
|
|
7
|
-
{
|
|
8
|
-
type: "list",
|
|
9
|
-
name: "collection",
|
|
10
|
-
message: "Select a collection:",
|
|
11
|
-
choices: getModelsInModules(module),
|
|
12
|
-
},
|
|
13
|
-
]);
|
|
14
|
-
return collection;
|
|
15
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import inquirer from "inquirer";
|
|
2
|
-
import { defaultActions } from "../../data/defaultActions.js";
|
|
3
|
-
export async function promptDefaultAction() {
|
|
4
|
-
const { action } = await inquirer.prompt([
|
|
5
|
-
{
|
|
6
|
-
type: "list",
|
|
7
|
-
name: "action",
|
|
8
|
-
message: "Choose an action:",
|
|
9
|
-
choices: defaultActions,
|
|
10
|
-
},
|
|
11
|
-
]);
|
|
12
|
-
return action;
|
|
13
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import inquirer from "inquirer";
|
|
2
|
-
function getEntryLabel(el) {
|
|
3
|
-
const name = el.name || el.title || el.subject || el.label || el.originalname || el.summary;
|
|
4
|
-
if (name) {
|
|
5
|
-
return `${name} (${el._id})`;
|
|
6
|
-
}
|
|
7
|
-
return el._id;
|
|
8
|
-
}
|
|
9
|
-
export async function promptEntry(result) {
|
|
10
|
-
const { entry } = await inquirer.prompt([
|
|
11
|
-
{
|
|
12
|
-
type: "search-list",
|
|
13
|
-
name: "entry",
|
|
14
|
-
message: "Choose an entry:",
|
|
15
|
-
choices: result.map((el) => ({ name: getEntryLabel(el), value: el._id })),
|
|
16
|
-
},
|
|
17
|
-
]);
|
|
18
|
-
return entry;
|
|
19
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import inquirer from "inquirer";
|
|
2
|
-
import os from "os";
|
|
3
|
-
import path from "path";
|
|
4
|
-
export async function promptFilePath(fp) {
|
|
5
|
-
const { filePath } = await inquirer.prompt([
|
|
6
|
-
{
|
|
7
|
-
type: "fuzzypath",
|
|
8
|
-
name: "filePath",
|
|
9
|
-
message: "Select a target directory:",
|
|
10
|
-
itemType: "directory",
|
|
11
|
-
default: fp,
|
|
12
|
-
rootPath: path.join(os.homedir(), "aYOUne"),
|
|
13
|
-
suggestOnly: false,
|
|
14
|
-
depthLimit: 8,
|
|
15
|
-
},
|
|
16
|
-
]);
|
|
17
|
-
return filePath;
|
|
18
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Prompt functions
|
|
2
|
-
import inquirer from "inquirer";
|
|
3
|
-
import { aYOUneModules } from "../../data/modules.js";
|
|
4
|
-
export async function promptModule() {
|
|
5
|
-
const { module } = await inquirer.prompt([
|
|
6
|
-
{
|
|
7
|
-
type: "list",
|
|
8
|
-
name: "module",
|
|
9
|
-
message: "Select a business module:",
|
|
10
|
-
choices: aYOUneModules.map((el) => {
|
|
11
|
-
return {
|
|
12
|
-
name: el.label,
|
|
13
|
-
value: el.module,
|
|
14
|
-
};
|
|
15
|
-
}),
|
|
16
|
-
},
|
|
17
|
-
]);
|
|
18
|
-
return module;
|
|
19
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import inquirer from "inquirer";
|
|
2
|
-
import { operations } from "../../data/operations.js";
|
|
3
|
-
export async function promptOperation() {
|
|
4
|
-
const { operation } = await inquirer.prompt([
|
|
5
|
-
{
|
|
6
|
-
type: "list",
|
|
7
|
-
name: "operation",
|
|
8
|
-
message: "Choose an operation:",
|
|
9
|
-
choices: operations,
|
|
10
|
-
},
|
|
11
|
-
]);
|
|
12
|
-
return operation;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { io } from "socket.io-client";
|
|
2
|
-
import { config } from "../helpers/config.js";
|
|
3
|
-
export const customerSocket = (user) => {
|
|
4
|
-
return io(config.notifierUrl, {
|
|
5
|
-
autoConnect: true,
|
|
6
|
-
reconnection: true,
|
|
7
|
-
rejectUnauthorized: false,
|
|
8
|
-
query: {
|
|
9
|
-
customer: user._customerID,
|
|
10
|
-
username: user._id,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { io } from "socket.io-client";
|
|
2
|
-
import { config } from "../helpers/config.js";
|
|
3
|
-
export const socket = (token) => {
|
|
4
|
-
return io(config.notifierUrl, {
|
|
5
|
-
autoConnect: true,
|
|
6
|
-
reconnection: true,
|
|
7
|
-
rejectUnauthorized: false,
|
|
8
|
-
query: {
|
|
9
|
-
cli: token,
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
};
|
package/lib/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|