mstate-cli 0.2.4 → 0.2.6
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/dist/index.js +31 -31
- package/package.json +6 -2
- package/rollup.config.mjs +34 -0
- package/src/common/constant.ts +13 -6
- package/src/common/enum.ts +1 -0
- package/src/common/helpers.ts +21 -4
- package/src/common/utils.ts +3 -1
- package/src/handlers/action.handler.ts +15 -2
- package/src/handlers/environment.handler.ts +9 -1
- package/src/handlers/help.handler.ts +4 -0
- package/src/handlers/mobioffice.handler.ts +3 -0
- package/src/handlers/workflow.handler.ts +39 -2
- package/src/index.ts +3 -1
- package/tsconfig.json +4 -2
- package/.vscode/settings.json +0 -3
- package/demo/maintenance_request/actions/add_photo.json +0 -23
- package/demo/maintenance_request/actions/change_assignee.json +0 -57
- package/demo/maintenance_request/actions/change_status.json +0 -57
- package/demo/maintenance_request/actions/create_ticket.json +0 -28
- package/demo/maintenance_request/actions/edit_collaborator.json +0 -57
- package/demo/maintenance_request/actions/handle_update_ticket.json +0 -21
- package/demo/maintenance_request/actions/submit_form.json +0 -140
- package/demo/maintenance_request/environment.json +0 -8
- package/demo/maintenance_request/workflow.json +0 -84
- package/rollup.config.js +0 -23
package/package.json
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "mstate-cli",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.6",
|
4
4
|
"main": "index.js",
|
5
5
|
"bin": {
|
6
6
|
"mstate": "./dist/index.js"
|
7
7
|
},
|
8
8
|
"scripts": {
|
9
|
-
"build": "
|
9
|
+
"build": "rollup -c",
|
10
|
+
"dev": "rollup -c --watch",
|
11
|
+
"prod": "npm run build",
|
10
12
|
"start": "npm run build && node dist/index.js"
|
11
13
|
},
|
12
14
|
"keywords": [
|
@@ -19,6 +21,7 @@
|
|
19
21
|
"license": "ISC",
|
20
22
|
"description": "A CLI tool for maintaining mstate workflows config",
|
21
23
|
"devDependencies": {
|
24
|
+
"@rollup/plugin-alias": "^5.1.1",
|
22
25
|
"@rollup/plugin-commonjs": "^28.0.1",
|
23
26
|
"@rollup/plugin-json": "^6.1.0",
|
24
27
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
@@ -28,6 +31,7 @@
|
|
28
31
|
"@types/crypto-js": "^4.2.2",
|
29
32
|
"@types/express": "^5.0.0",
|
30
33
|
"@types/node": "^22.9.0",
|
34
|
+
"rollup": "^4.18.0",
|
31
35
|
"tslib": "^2.8.1",
|
32
36
|
"typescript": "^5.6.3"
|
33
37
|
},
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import resolve from '@rollup/plugin-node-resolve';
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
3
|
+
import typescript from '@rollup/plugin-typescript';
|
4
|
+
import json from '@rollup/plugin-json';
|
5
|
+
import terser from '@rollup/plugin-terser';
|
6
|
+
import alias from '@rollup/plugin-alias';
|
7
|
+
import { fileURLToPath } from 'url';
|
8
|
+
import path from 'path';
|
9
|
+
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
11
|
+
const __dirname = path.dirname(__filename);
|
12
|
+
|
13
|
+
export default {
|
14
|
+
input: 'src/index.ts', // Your entry file
|
15
|
+
output: {
|
16
|
+
dir: 'dist', // Output directory
|
17
|
+
format: 'cjs', // CommonJS format
|
18
|
+
},
|
19
|
+
plugins: [
|
20
|
+
alias({
|
21
|
+
entries: [
|
22
|
+
{ find: '@shared', replacement: path.resolve(__dirname, '../shared') },
|
23
|
+
],
|
24
|
+
}),
|
25
|
+
resolve(), // Resolves node_modules
|
26
|
+
commonjs(), // Converts CommonJS to ES Modules
|
27
|
+
terser(), // remove spaces and compress build
|
28
|
+
typescript({
|
29
|
+
tsconfig: './tsconfig.json', // Ensure Rollup uses your TypeScript config
|
30
|
+
declaration: false, // Make sure to disable declaration file generation in Rollup
|
31
|
+
}), // Transpile TypeScript
|
32
|
+
json(), // Add JSON plugin
|
33
|
+
],
|
34
|
+
};
|
package/src/common/constant.ts
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
import path from 'path';
|
2
2
|
import os from 'os';
|
3
|
+
import {
|
4
|
+
MOBIOFFICE_API_URL,
|
5
|
+
MSTATE_API_URL,
|
6
|
+
MSTATE_FRONTEND_URL,
|
7
|
+
} from '@shared/constants';
|
3
8
|
|
4
9
|
export const CRED_FOLDER_PATH = path.join(os.homedir(), '.mstate');
|
5
10
|
export const CRED_FILE_PATH = path.join(
|
@@ -7,13 +12,15 @@ export const CRED_FILE_PATH = path.join(
|
|
7
12
|
'.mstate_credentials',
|
8
13
|
);
|
9
14
|
|
15
|
+
export const ENCRYPT_KEY: string = 'THIS_IS_MOBIOFFICE';
|
16
|
+
|
10
17
|
// export const MSTATE_DOMAIN: string = `https://mstate.ai/`;
|
11
|
-
|
12
|
-
export const MSTATE_DOMAIN: string = `https://dev.mstate.ai/`;
|
18
|
+
export const MSTATE_DOMAIN: string = MSTATE_FRONTEND_URL;
|
19
|
+
// export const MSTATE_DOMAIN: string = `https://dev.mstate.ai/`;
|
13
20
|
|
14
|
-
export const MSTATE_URL: string = 'https://dev.mstate.mobioffice.io/api';
|
15
|
-
|
21
|
+
// export const MSTATE_URL: string = 'https://dev.mstate.mobioffice.io/api';
|
22
|
+
export const MSTATE_URL = MSTATE_API_URL;
|
16
23
|
// export const MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
|
17
24
|
|
18
|
-
|
19
|
-
export const MOBIOFFICE_URL: string = 'https://dev-server.mobioffice.io/api';
|
25
|
+
export const MOBIOFFICE_URL: string = MOBIOFFICE_API_URL;
|
26
|
+
// export const MOBIOFFICE_URL: string = 'https://dev-server.mobioffice.io/api';
|
package/src/common/enum.ts
CHANGED
package/src/common/helpers.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import CryptoJS from 'crypto-js';
|
2
|
+
import os from 'os';
|
3
|
+
import { ENCRYPT_KEY } from './constant';
|
2
4
|
|
3
5
|
export function getValueFromArgs(args: string[], key: string) {
|
4
6
|
return args.find((str) => str.includes(key))?.replace(key, '') ?? '';
|
@@ -8,18 +10,33 @@ export function hasFlag(args: string[], flag: string) {
|
|
8
10
|
return args.includes(flag.toUpperCase()) || args.includes(flag.toLowerCase());
|
9
11
|
}
|
10
12
|
|
11
|
-
const ENCRYPT_KEY: string = 'THIS_IS_MOBIOFFICE';
|
12
|
-
|
13
13
|
// Encrypting data
|
14
14
|
export function encryptData(data: any) {
|
15
15
|
const jsonData = JSON.stringify(data);
|
16
|
-
const encryptedData = CryptoJS.AES.encrypt(
|
16
|
+
const encryptedData = CryptoJS.AES.encrypt(
|
17
|
+
jsonData,
|
18
|
+
getEncryptionKey(),
|
19
|
+
).toString();
|
17
20
|
return encryptedData;
|
18
21
|
}
|
19
22
|
|
20
23
|
// Decrypting data
|
21
24
|
export function decryptData<T = any>(encryptedData: string) {
|
22
|
-
const bytes = CryptoJS.AES.decrypt(encryptedData,
|
25
|
+
const bytes = CryptoJS.AES.decrypt(encryptedData, getEncryptionKey());
|
23
26
|
const decryptedData = bytes.toString(CryptoJS.enc.Utf8);
|
24
27
|
return JSON.parse(decryptedData) as T;
|
25
28
|
}
|
29
|
+
|
30
|
+
export function getEncryptionKey() {
|
31
|
+
return ENCRYPT_KEY + getMacID();
|
32
|
+
}
|
33
|
+
|
34
|
+
export function getMacID() {
|
35
|
+
const networkInterfaces = os.networkInterfaces();
|
36
|
+
const macAddresses = Object.values(networkInterfaces)
|
37
|
+
.flat()
|
38
|
+
.filter((details) => !details?.internal)
|
39
|
+
.map((details) => details?.mac);
|
40
|
+
|
41
|
+
return macAddresses[0];
|
42
|
+
}
|
package/src/common/utils.ts
CHANGED
@@ -38,7 +38,7 @@ export function handleUpdateSecretKey(secret: string) {
|
|
38
38
|
flag: 'w',
|
39
39
|
mode: 0o600,
|
40
40
|
});
|
41
|
-
} catch (error) {
|
41
|
+
} catch (error) {}
|
42
42
|
}
|
43
43
|
|
44
44
|
export function getSecretKey() {
|
@@ -62,4 +62,6 @@ export function getSecretKey() {
|
|
62
62
|
}
|
63
63
|
}
|
64
64
|
|
65
|
+
export function getEnv() {}
|
66
|
+
|
65
67
|
//#endregion
|
@@ -7,6 +7,7 @@ import { customLog, getSecretKey } from '../common/utils';
|
|
7
7
|
enum Key {
|
8
8
|
WORKFLOW = 'workflow=',
|
9
9
|
SECRET_KEY = 'secret=',
|
10
|
+
TYPE = 'type=',
|
10
11
|
}
|
11
12
|
|
12
13
|
class ActionHandler {
|
@@ -16,6 +17,7 @@ class ActionHandler {
|
|
16
17
|
const args = process.argv;
|
17
18
|
const workflowName = getValueFromArgs(args, Key.WORKFLOW);
|
18
19
|
const secretKey = getSecretKey();
|
20
|
+
const type = getValueFromArgs(args, Key.TYPE);
|
19
21
|
|
20
22
|
if (!secretKey) {
|
21
23
|
customLog.changeAndThrow(`Parameter secret is required`);
|
@@ -27,7 +29,12 @@ class ActionHandler {
|
|
27
29
|
return;
|
28
30
|
}
|
29
31
|
|
30
|
-
|
32
|
+
let query = `?workflow=${workflowName}`;
|
33
|
+
if (type) {
|
34
|
+
query += `&type=${type}`;
|
35
|
+
}
|
36
|
+
|
37
|
+
const url = `${MSTATE_URL}/action/config/all/${query}`;
|
31
38
|
|
32
39
|
const responseJSON = await fetch(url, {
|
33
40
|
headers: {
|
@@ -68,6 +75,7 @@ class ActionHandler {
|
|
68
75
|
async saveToDB() {
|
69
76
|
const args = process.argv;
|
70
77
|
const workflowName = getValueFromArgs(args, Key.WORKFLOW);
|
78
|
+
const type = getValueFromArgs(args, Key.TYPE);
|
71
79
|
const secretKey = getSecretKey();
|
72
80
|
|
73
81
|
if (!secretKey) {
|
@@ -82,6 +90,11 @@ class ActionHandler {
|
|
82
90
|
|
83
91
|
const folderPath = path.resolve(workflowName, 'actions');
|
84
92
|
|
93
|
+
let query = `?workflow=${workflowName}`;
|
94
|
+
if (type) {
|
95
|
+
query += `&type=${type}`;
|
96
|
+
}
|
97
|
+
|
85
98
|
// loop to every folder to publish workflow
|
86
99
|
fs.readdir(folderPath, (err, files) => {
|
87
100
|
if (!files) return;
|
@@ -90,7 +103,7 @@ class ActionHandler {
|
|
90
103
|
const filePath = path.join(folderPath, fileName);
|
91
104
|
const data = fs.readFileSync(filePath, 'utf8');
|
92
105
|
|
93
|
-
const url = `${MSTATE_URL}/action/config
|
106
|
+
const url = `${MSTATE_URL}/action/config/${query}`;
|
94
107
|
const responseJSON = await fetch(url, {
|
95
108
|
method: 'PUT',
|
96
109
|
headers: {
|
@@ -7,6 +7,7 @@ import { getValueFromArgs } from '../common/helpers';
|
|
7
7
|
enum Key {
|
8
8
|
WORKFLOW = 'workflow=',
|
9
9
|
SECRET_KEY = 'secret=',
|
10
|
+
TYPE = 'type=',
|
10
11
|
}
|
11
12
|
|
12
13
|
class EnvironmentHandler {
|
@@ -16,6 +17,7 @@ class EnvironmentHandler {
|
|
16
17
|
const args = process.argv;
|
17
18
|
const workflowName = getValueFromArgs(args, Key.WORKFLOW);
|
18
19
|
const secretKey = getSecretKey();
|
20
|
+
const type = getValueFromArgs(args, Key.TYPE);
|
19
21
|
|
20
22
|
if (!secretKey) {
|
21
23
|
customLog.changeAndThrow(`Parameter secret is required`);
|
@@ -27,7 +29,11 @@ class EnvironmentHandler {
|
|
27
29
|
return;
|
28
30
|
}
|
29
31
|
|
30
|
-
|
32
|
+
let query = `?workflow=${workflowName}`;
|
33
|
+
if (type) {
|
34
|
+
query += `&type=${type}`;
|
35
|
+
}
|
36
|
+
const url = `${MSTATE_URL}/env/${query}`;
|
31
37
|
|
32
38
|
const responseJSON = await fetch(url, {
|
33
39
|
headers: {
|
@@ -55,6 +61,7 @@ class EnvironmentHandler {
|
|
55
61
|
|
56
62
|
const workflowName = getValueFromArgs(args, Key.WORKFLOW);
|
57
63
|
const secretKey = getSecretKey();
|
64
|
+
const type = getValueFromArgs(args, Key.TYPE);
|
58
65
|
|
59
66
|
if (!secretKey) {
|
60
67
|
customLog.changeAndThrow(`Parameter secret is required`);
|
@@ -82,6 +89,7 @@ class EnvironmentHandler {
|
|
82
89
|
body: JSON.stringify({
|
83
90
|
workflow: workflowName,
|
84
91
|
env: environments,
|
92
|
+
type,
|
85
93
|
}),
|
86
94
|
});
|
87
95
|
|
@@ -11,6 +11,10 @@ class HelpHandler {
|
|
11
11
|
CmdAction.CLONE,
|
12
12
|
'Clone workflow with actions and environments',
|
13
13
|
);
|
14
|
+
customLog.info(
|
15
|
+
CmdAction.COPY,
|
16
|
+
'crete a new workflow by copying the current',
|
17
|
+
);
|
14
18
|
customLog.info(CmdAction.PUSH, 'Update the changes one in cloned workflow');
|
15
19
|
customLog.info(
|
16
20
|
CmdAction.LINK,
|
@@ -9,6 +9,7 @@ enum Key {
|
|
9
9
|
SECRET_KEY = 'secret=',
|
10
10
|
COMPANY_NAME = 'company=',
|
11
11
|
USER_ID = 'user=',
|
12
|
+
TYPE = 'type=',
|
12
13
|
}
|
13
14
|
|
14
15
|
class MobiofficeHandler {
|
@@ -23,6 +24,7 @@ class MobiofficeHandler {
|
|
23
24
|
const secretKey = getSecretKey();
|
24
25
|
const companyName = getValueFromArgs(args, Key.COMPANY_NAME);
|
25
26
|
const user = getValueFromArgs(args, Key.USER_ID);
|
27
|
+
const type = getValueFromArgs(args, Key.TYPE) || 'private';
|
26
28
|
|
27
29
|
if (!workflowName) {
|
28
30
|
customLog.changeAndThrow(`Parameter workflow is required`);
|
@@ -56,6 +58,7 @@ class MobiofficeHandler {
|
|
56
58
|
workflow: workflowName,
|
57
59
|
secret: secretKey,
|
58
60
|
nickname: companyName,
|
61
|
+
type,
|
59
62
|
user,
|
60
63
|
}),
|
61
64
|
});
|
@@ -9,17 +9,19 @@ enum Key {
|
|
9
9
|
FILE = 'file=',
|
10
10
|
SECRET_KEY = 'secret=',
|
11
11
|
WORKFLOW = 'workflow=',
|
12
|
+
TYPE = 'type=',
|
12
13
|
}
|
13
14
|
|
14
15
|
class WorkflowHandler {
|
15
16
|
constructor() {}
|
16
17
|
|
17
|
-
async
|
18
|
+
async addNewWorkflow() {
|
18
19
|
try {
|
19
20
|
const args = process.argv;
|
20
21
|
|
21
22
|
const workflowPath = getValueFromArgs(args, Key.PATH);
|
22
23
|
const file = getValueFromArgs(args, Key.FILE);
|
24
|
+
const type = getValueFromArgs(args, Key.TYPE);
|
23
25
|
const secretKey = getSecretKey();
|
24
26
|
|
25
27
|
if (!file) {
|
@@ -44,6 +46,10 @@ class WorkflowHandler {
|
|
44
46
|
query = '?' + query;
|
45
47
|
}
|
46
48
|
|
49
|
+
if (type) {
|
50
|
+
query += query ? `&type=${type}` : `?type=${type}`;
|
51
|
+
}
|
52
|
+
|
47
53
|
const url = `${MSTATE_URL}/workflow/config/new${query}`;
|
48
54
|
const responseJSON = await fetch(url, {
|
49
55
|
method: 'POST',
|
@@ -72,6 +78,7 @@ class WorkflowHandler {
|
|
72
78
|
const args = process.argv;
|
73
79
|
|
74
80
|
const workflowName = getValueFromArgs(args, Key.WORKFLOW);
|
81
|
+
const type = getValueFromArgs(args, Key.TYPE);
|
75
82
|
const secretKey = getSecretKey();
|
76
83
|
|
77
84
|
if (!secretKey) {
|
@@ -91,6 +98,10 @@ class WorkflowHandler {
|
|
91
98
|
|
92
99
|
let query = `?workflow=${workflowName}`;
|
93
100
|
|
101
|
+
if (type) {
|
102
|
+
query += `&type=${type}`;
|
103
|
+
}
|
104
|
+
|
94
105
|
const url = `${MSTATE_URL}/workflow/config${query}`;
|
95
106
|
const responseJSON = await fetch(url, {
|
96
107
|
method: 'PUT',
|
@@ -118,6 +129,8 @@ class WorkflowHandler {
|
|
118
129
|
const args = process.argv;
|
119
130
|
|
120
131
|
const workflowName = getValueFromArgs(args, Key.WORKFLOW);
|
132
|
+
const type = getValueFromArgs(args, Key.TYPE);
|
133
|
+
|
121
134
|
const secretKey = getSecretKey();
|
122
135
|
|
123
136
|
if (!secretKey) {
|
@@ -129,8 +142,9 @@ class WorkflowHandler {
|
|
129
142
|
customLog.changeAndThrow(`Parameter workflow is required`);
|
130
143
|
return;
|
131
144
|
}
|
145
|
+
const typeQuery = type ? `&type=${type}` : '';
|
132
146
|
|
133
|
-
const url = `${MSTATE_URL}/workflow/config/?workflow=${workflowName}`;
|
147
|
+
const url = `${MSTATE_URL}/workflow/config/?workflow=${workflowName}${typeQuery}`;
|
134
148
|
const responseJSON = await fetch(url, {
|
135
149
|
method: 'GET',
|
136
150
|
headers: {
|
@@ -158,6 +172,29 @@ class WorkflowHandler {
|
|
158
172
|
}
|
159
173
|
}
|
160
174
|
|
175
|
+
async copyWorkflow() {
|
176
|
+
try {
|
177
|
+
const args = process.argv;
|
178
|
+
|
179
|
+
const workflowName = getValueFromArgs(args, Key.WORKFLOW);
|
180
|
+
|
181
|
+
if (!workflowName) {
|
182
|
+
customLog.changeAndThrow(`Parameter workflow is required`);
|
183
|
+
return;
|
184
|
+
}
|
185
|
+
|
186
|
+
const workflowPath = ('/' + workflowName).replace(/\/([^\/]*)$/, '');
|
187
|
+
if (workflowPath) {
|
188
|
+
process.argv.push(`path=${workflowPath.slice(1, workflowPath.length)}`);
|
189
|
+
}
|
190
|
+
process.argv.push(`file=${workflowName + '/workflow.json'}`);
|
191
|
+
|
192
|
+
await this.addNewWorkflow();
|
193
|
+
} catch (error: any) {
|
194
|
+
customLog.changeAndThrow(error.message);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
161
198
|
async resetCache() {
|
162
199
|
const args = process.argv;
|
163
200
|
|
package/src/index.ts
CHANGED
@@ -55,8 +55,10 @@ const [action] = argv.slice(2);
|
|
55
55
|
await environmentHandler.cloneEnvironments();
|
56
56
|
break;
|
57
57
|
case CmdAction.ADD:
|
58
|
-
await workflowHandler.
|
58
|
+
await workflowHandler.addNewWorkflow();
|
59
59
|
break;
|
60
|
+
case CmdAction.COPY:
|
61
|
+
await workflowHandler.copyWorkflow();
|
60
62
|
case CmdAction.PUSH:
|
61
63
|
await workflowHandler.updateWorkflowToDB();
|
62
64
|
await actionHandler.saveToDB();
|
package/tsconfig.json
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
{
|
2
|
+
"extends": "../tsconfig.base.json",
|
2
3
|
"compilerOptions": {
|
3
4
|
"target": "ESNext",
|
4
5
|
"module": "ESNext",
|
5
6
|
"moduleResolution": "Node",
|
6
7
|
"strict": true,
|
7
|
-
"rootDir": "
|
8
|
+
"rootDir": "../",
|
9
|
+
"baseUrl": ".",
|
8
10
|
"esModuleInterop": true,
|
9
11
|
"resolveJsonModule": true,
|
10
12
|
"skipLibCheck": true,
|
11
13
|
"outDir": "./dist",
|
12
14
|
"declaration": true
|
13
15
|
},
|
14
|
-
"include": ["src/**/*.ts"],
|
16
|
+
"include": ["src/**/*.ts", "../shared/**/*"],
|
15
17
|
"exclude": ["node_modules", "dist", ".vscode"]
|
16
18
|
}
|
package/.vscode/settings.json
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "add_photo",
|
3
|
-
"type": "MANUAL",
|
4
|
-
"as": "photo",
|
5
|
-
"meta": {
|
6
|
-
"title": "Add Photo",
|
7
|
-
"startCollectionName": "add_photo",
|
8
|
-
"displayName": "Add Photo",
|
9
|
-
"icon": "https://firebasestorage.googleapis.com/v0/b/mobioffice-dev.appspot.com/o/action_icon%2Fattendances.svg?alt=media&token=dd1766c8-687c-4243-8466-e26b26621dcf",
|
10
|
-
"workflowName": "demo/maintenance_request",
|
11
|
-
"mstate": true,
|
12
|
-
"responseSentToMstate": true,
|
13
|
-
"actionType": "worklog",
|
14
|
-
"name": "add_photo",
|
15
|
-
"showDone": true,
|
16
|
-
"id": "123",
|
17
|
-
"actionHandlerAPI": "",
|
18
|
-
"actionCompleteText": "Photo added Successfully",
|
19
|
-
"require_location": false,
|
20
|
-
"order": 0
|
21
|
-
},
|
22
|
-
"steps": []
|
23
|
-
}
|
@@ -1,57 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "change_assignee",
|
3
|
-
"type": "MANUAL",
|
4
|
-
"as": "assignee",
|
5
|
-
"meta": {
|
6
|
-
"title": "Change Assignee",
|
7
|
-
"startCollectionName": "change_assignee",
|
8
|
-
"displayName": "Change Assignee",
|
9
|
-
"icon": "https://firebasestorage.googleapis.com/v0/b/mobioffice-dev.appspot.com/o/action_icon%2Fattendances.svg?alt=media&token=dd1766c8-687c-4243-8466-e26b26621dcf",
|
10
|
-
"workflowName": "demo/maintenance_request",
|
11
|
-
"mstate": true,
|
12
|
-
"responseSentToMstate": true,
|
13
|
-
"actionType": "worklog",
|
14
|
-
"name": "change_assignee",
|
15
|
-
"showDone": true,
|
16
|
-
"id": "789",
|
17
|
-
"actionHandlerAPI": "",
|
18
|
-
"actionCompleteText": "Assignee Changed Successfully",
|
19
|
-
"require_location": false,
|
20
|
-
"order": 0
|
21
|
-
},
|
22
|
-
"steps": [
|
23
|
-
{
|
24
|
-
"id": "1",
|
25
|
-
"module": "USER_INPUT",
|
26
|
-
"config": {
|
27
|
-
"data": {
|
28
|
-
"id": "1",
|
29
|
-
"buttonActionText": "Next",
|
30
|
-
"fieldType": "dropDown",
|
31
|
-
"field": {
|
32
|
-
"keyForAPI": "data",
|
33
|
-
"isRequired": true,
|
34
|
-
"label": "Select Assignee",
|
35
|
-
"hint": "Select Assignee",
|
36
|
-
"value": "",
|
37
|
-
"request": {
|
38
|
-
"method": "GET",
|
39
|
-
"url": "EVAL -- CONCAT(env.DOUBLE_TICK_URL, '/workspace/GetWorkspaceMembersByWorkspaceID', '?WorkspaceID=', env.DOUBLE_TICK_WORKSPACE_ID)",
|
40
|
-
"headers": {
|
41
|
-
"secret-key": "EVAL -- env.DOUBLE_TICK_SECRET"
|
42
|
-
}
|
43
|
-
},
|
44
|
-
"mapper": {
|
45
|
-
"target": "Table",
|
46
|
-
"id": "ID",
|
47
|
-
"label": "Name"
|
48
|
-
},
|
49
|
-
"placeholder": "Select"
|
50
|
-
},
|
51
|
-
"label": "Select Assignee",
|
52
|
-
"order": 1
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
]
|
57
|
-
}
|
@@ -1,57 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "change_status",
|
3
|
-
"type": "MANUAL",
|
4
|
-
"as": "status",
|
5
|
-
"meta": {
|
6
|
-
"title": "Change Status",
|
7
|
-
"startCollectionName": "change_status",
|
8
|
-
"displayName": "Change Status",
|
9
|
-
"icon": "https://firebasestorage.googleapis.com/v0/b/mobioffice-dev.appspot.com/o/action_icon%2Fattendances.svg?alt=media&token=dd1766c8-687c-4243-8466-e26b26621dcf",
|
10
|
-
"workflowName": "demo/maintenance_request",
|
11
|
-
"mstate": true,
|
12
|
-
"responseSentToMstate": true,
|
13
|
-
"actionType": "worklog",
|
14
|
-
"name": "change_status",
|
15
|
-
"showDone": true,
|
16
|
-
"id": "456",
|
17
|
-
"actionHandlerAPI": "",
|
18
|
-
"actionCompleteText": "Status Changed Successfully",
|
19
|
-
"require_location": false,
|
20
|
-
"order": 0
|
21
|
-
},
|
22
|
-
"steps": [
|
23
|
-
{
|
24
|
-
"id": "1",
|
25
|
-
"module": "USER_INPUT",
|
26
|
-
"config": {
|
27
|
-
"data": {
|
28
|
-
"id": "1",
|
29
|
-
"buttonActionText": "Next",
|
30
|
-
"fieldType": "dropDown",
|
31
|
-
"field": {
|
32
|
-
"keyForAPI": "data",
|
33
|
-
"isRequired": true,
|
34
|
-
"label": "Select Status",
|
35
|
-
"hint": "Select Status",
|
36
|
-
"value": "",
|
37
|
-
"request": {
|
38
|
-
"method": "GET",
|
39
|
-
"url": "EVAL -- CONCAT(env.DOUBLE_TICK_URL, '/workspace/GetStatusByWorkspaceID', '?WorkspaceID=', env.DOUBLE_TICK_WORKSPACE_ID, '&FlowID=', env.DOUBLE_TICK_WORKFLOW_ID)",
|
40
|
-
"headers": {
|
41
|
-
"secret-key": "EVAL -- env.DOUBLE_TICK_SECRET"
|
42
|
-
}
|
43
|
-
},
|
44
|
-
"mapper": {
|
45
|
-
"target": "Table",
|
46
|
-
"id": "ID",
|
47
|
-
"label": "Name"
|
48
|
-
},
|
49
|
-
"placeholder": "Select"
|
50
|
-
},
|
51
|
-
"label": "Select Status",
|
52
|
-
"order": 1
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
]
|
57
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"steps": [
|
3
|
-
{
|
4
|
-
"config": {
|
5
|
-
"as": "ticket",
|
6
|
-
"operation": "create",
|
7
|
-
"secretKey": "EVAL -- env.DOUBLE_TICK_SECRET",
|
8
|
-
"payload": {
|
9
|
-
"workspaceID": "EVAL -- env.DOUBLE_TICK_WORKSPACE_ID",
|
10
|
-
"title": "EVAL -- CONCAT(input.payload.machine.ProjectName , ' | ', input.payload.summary)",
|
11
|
-
"description": "EVAL -- input.payload.summary",
|
12
|
-
"workflow": "EVAL -- env.DOUBLE_TICK_WORKFLOW_ID",
|
13
|
-
"areaID": "EVAL -- input.payload.machine.ID",
|
14
|
-
"LabelIds": "EVAL -- MAP_VALUE(input.payload.reasons, 'ID')",
|
15
|
-
"assignedTo": "EVAL -- OR(input.payload.userDetail.phone, env.DOUBLE_TICK_ADMIN)",
|
16
|
-
"TaskMain": {
|
17
|
-
"ReportedByID": "EVAL -- OR(input.payload.userDetail.phone, env.DOUBLE_TICK_ADMIN)",
|
18
|
-
"StatusID": "EVAL -- env.DOUBLE_TICK_DEFAULT_STATUS_ID"
|
19
|
-
}
|
20
|
-
}
|
21
|
-
},
|
22
|
-
"id": "1",
|
23
|
-
"module": "DOUBLE_TICK"
|
24
|
-
}
|
25
|
-
],
|
26
|
-
"name": "create_ticket",
|
27
|
-
"type": "CHAINED"
|
28
|
-
}
|
@@ -1,57 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "edit_collaborator",
|
3
|
-
"type": "MANUAL",
|
4
|
-
"as": "cc",
|
5
|
-
"meta": {
|
6
|
-
"title": "Edit Collaborator",
|
7
|
-
"startCollectionName": "edit_collaborator",
|
8
|
-
"displayName": "Edit Collaborator",
|
9
|
-
"icon": "https://firebasestorage.googleapis.com/v0/b/mobioffice-dev.appspot.com/o/action_icon%2Fattendances.svg?alt=media&token=dd1766c8-687c-4243-8466-e26b26621dcf",
|
10
|
-
"workflowName": "demo/maintenance_request",
|
11
|
-
"mstate": true,
|
12
|
-
"responseSentToMstate": true,
|
13
|
-
"actionType": "worklog",
|
14
|
-
"name": "edit_collaborator",
|
15
|
-
"showDone": true,
|
16
|
-
"id": "987",
|
17
|
-
"actionHandlerAPI": "",
|
18
|
-
"actionCompleteText": "Collaborator Edited Successfully",
|
19
|
-
"require_location": false,
|
20
|
-
"order": 0
|
21
|
-
},
|
22
|
-
"steps": [
|
23
|
-
{
|
24
|
-
"id": "1",
|
25
|
-
"module": "USER_INPUT",
|
26
|
-
"config": {
|
27
|
-
"data": {
|
28
|
-
"id": "1",
|
29
|
-
"buttonActionText": "Next",
|
30
|
-
"fieldType": "checkBox",
|
31
|
-
"field": {
|
32
|
-
"keyForAPI": "data",
|
33
|
-
"isRequired": true,
|
34
|
-
"label": "Select Collaborator",
|
35
|
-
"hint": "Select Collaborator",
|
36
|
-
"value": "",
|
37
|
-
"request": {
|
38
|
-
"method": "GET",
|
39
|
-
"url": "EVAL -- CONCAT(env.DOUBLE_TICK_URL, '/workspace/GetWorkspaceMembersByWorkspaceID', '?WorkspaceID=', env.DOUBLE_TICK_WORKSPACE_ID)",
|
40
|
-
"headers": {
|
41
|
-
"secret-key": "EVAL -- env.DOUBLE_TICK_SECRET"
|
42
|
-
}
|
43
|
-
},
|
44
|
-
"mapper": {
|
45
|
-
"target": "Table",
|
46
|
-
"id": "ID",
|
47
|
-
"label": "Name"
|
48
|
-
},
|
49
|
-
"placeholder": "Select"
|
50
|
-
},
|
51
|
-
"label": "Select Collaborator",
|
52
|
-
"order": 1
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
]
|
57
|
-
}
|