great 0.3.2 → 1.0.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/README.md +119 -13
- package/dist/accounts/create.d.ts +4 -0
- package/dist/accounts/create.js +42 -0
- package/dist/accounts/create.js.map +1 -0
- package/dist/accounts/index.d.ts +5 -2
- package/dist/accounts/index.js +48 -9
- package/dist/accounts/index.js.map +1 -1
- package/dist/clone/index.d.ts +8 -0
- package/dist/clone/index.js +61 -0
- package/dist/clone/index.js.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.js +111 -0
- package/dist/config/index.js.map +1 -0
- package/dist/create/index.d.ts +3 -0
- package/dist/create/index.js +7 -0
- package/dist/create/index.js.map +1 -0
- package/dist/deploy/index.d.ts +11 -0
- package/dist/deploy/index.js +132 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/explode/index.d.ts +5 -0
- package/dist/explode/index.js +32 -0
- package/dist/explode/index.js.map +1 -0
- package/dist/explode/transform.d.ts +30 -0
- package/dist/explode/transform.js +100 -0
- package/dist/explode/transform.js.map +1 -0
- package/dist/explode/unescapeMongo.d.ts +1 -0
- package/dist/explode/unescapeMongo.js +15 -0
- package/dist/explode/unescapeMongo.js.map +1 -0
- package/dist/generated/graphql.d.ts +1784 -0
- package/dist/generated/graphql.js +73 -0
- package/dist/generated/graphql.js.map +1 -0
- package/dist/index.js +29 -4
- package/dist/index.js.map +1 -1
- package/dist/init/index.d.ts +5 -0
- package/dist/init/index.js +46 -0
- package/dist/init/index.js.map +1 -0
- package/dist/integrations/create.d.ts +6 -0
- package/dist/integrations/create.js +70 -0
- package/dist/integrations/create.js.map +1 -0
- package/dist/{projects/describe.d.ts → integrations/index.d.ts} +0 -1
- package/dist/integrations/index.js +23 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/integrations/list.d.ts +7 -0
- package/dist/integrations/list.js +103 -0
- package/dist/integrations/list.js.map +1 -0
- package/dist/login/index.d.ts +6 -0
- package/dist/login/index.js +25 -0
- package/dist/login/index.js.map +1 -0
- package/dist/logout/index.d.ts +6 -0
- package/dist/logout/index.js +11 -0
- package/dist/logout/index.js.map +1 -0
- package/dist/now/index.d.ts +3 -1
- package/dist/now/index.js +11 -2
- package/dist/now/index.js.map +1 -1
- package/dist/pull/index.d.ts +5 -1
- package/dist/pull/index.js +50 -19
- package/dist/pull/index.js.map +1 -1
- package/dist/push/index.d.ts +11 -0
- package/dist/push/index.js +481 -0
- package/dist/push/index.js.map +1 -0
- package/dist/repl/dispatch.d.ts +8 -0
- package/dist/repl/dispatch.js +75 -0
- package/dist/repl/dispatch.js.map +1 -0
- package/dist/repl/help.d.ts +2 -0
- package/dist/repl/help.js +14 -0
- package/dist/repl/help.js.map +1 -0
- package/dist/repl/index.d.ts +10 -0
- package/dist/repl/index.js +92 -0
- package/dist/repl/index.js.map +1 -0
- package/dist/run/index.d.ts +33 -1
- package/dist/run/index.js +109 -40
- package/dist/run/index.js.map +1 -1
- package/dist/status/index.d.ts +10 -0
- package/dist/status/index.js +122 -0
- package/dist/status/index.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/authServer.d.ts +4 -0
- package/dist/utils/authServer.js +49 -0
- package/dist/utils/authServer.js.map +1 -0
- package/dist/utils/config.d.ts +15 -0
- package/dist/utils/config.js +41 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/createIntegrationFromFile.d.ts +22 -0
- package/dist/utils/createIntegrationFromFile.js +116 -0
- package/dist/utils/createIntegrationFromFile.js.map +1 -0
- package/dist/utils/determineNameAndKey.d.ts +4 -0
- package/dist/utils/determineNameAndKey.js +8 -0
- package/dist/utils/determineNameAndKey.js.map +1 -0
- package/dist/utils/dispatch.d.ts +3 -0
- package/dist/utils/dispatch.js +37 -0
- package/dist/utils/dispatch.js.map +1 -0
- package/dist/utils/fetchLocal.d.ts +3 -0
- package/dist/utils/fetchLocal.js +21 -0
- package/dist/utils/fetchLocal.js.map +1 -0
- package/dist/utils/fetchSession.d.ts +7 -0
- package/dist/utils/fetchSession.js +34 -0
- package/dist/utils/fetchSession.js.map +1 -0
- package/dist/utils/graphqlClient.d.ts +10 -0
- package/dist/utils/graphqlClient.js +24 -0
- package/dist/utils/graphqlClient.js.map +1 -0
- package/dist/utils/graphqlError.d.ts +2 -0
- package/dist/utils/graphqlError.js +20 -0
- package/dist/utils/graphqlError.js.map +1 -0
- package/dist/utils/hashContent.d.ts +1 -0
- package/dist/utils/hashContent.js +7 -0
- package/dist/utils/hashContent.js.map +1 -0
- package/dist/utils/jwt.d.ts +6 -0
- package/dist/utils/jwt.js +24 -0
- package/dist/utils/jwt.js.map +1 -0
- package/dist/utils/promptForValue.d.ts +9 -0
- package/dist/utils/promptForValue.js +24 -0
- package/dist/utils/promptForValue.js.map +1 -0
- package/dist/utils/resolveAccount.d.ts +19 -0
- package/dist/utils/resolveAccount.js +75 -0
- package/dist/utils/resolveAccount.js.map +1 -0
- package/dist/utils/resolveElement.d.ts +20 -0
- package/dist/utils/resolveElement.js +67 -0
- package/dist/utils/resolveElement.js.map +1 -0
- package/dist/utils/resolveIntegration.d.ts +9 -0
- package/dist/utils/resolveIntegration.js +71 -0
- package/dist/utils/resolveIntegration.js.map +1 -0
- package/dist/utils/saveIntegration.d.ts +16 -0
- package/dist/utils/saveIntegration.js +117 -0
- package/dist/utils/saveIntegration.js.map +1 -0
- package/dist/utils/token.d.ts +6 -0
- package/dist/utils/token.js +31 -0
- package/dist/utils/token.js.map +1 -0
- package/dist/utils/valueTypes.d.ts +4 -0
- package/dist/utils/valueTypes.js +43 -0
- package/dist/utils/valueTypes.js.map +1 -0
- package/dist/value/get.d.ts +8 -0
- package/dist/value/get.js +50 -0
- package/dist/value/get.js.map +1 -0
- package/dist/{projects → value}/index.d.ts +1 -2
- package/dist/value/index.js +26 -0
- package/dist/value/index.js.map +1 -0
- package/dist/value/list.d.ts +8 -0
- package/dist/value/list.js +122 -0
- package/dist/value/list.js.map +1 -0
- package/dist/value/set.d.ts +12 -0
- package/dist/value/set.js +103 -0
- package/dist/value/set.js.map +1 -0
- package/dist/whoami/fetchSession.d.ts +9 -0
- package/dist/whoami/fetchSession.js +19 -0
- package/dist/whoami/fetchSession.js.map +1 -0
- package/dist/whoami/index.d.ts +9 -1
- package/dist/whoami/index.js +18 -10
- package/dist/whoami/index.js.map +1 -1
- package/package.json +29 -13
- package/.codeclimate.yml +0 -7
- package/.editorconfig +0 -11
- package/.nvmrc +0 -1
- package/.prettierrc.json +0 -6
- package/dist/now/index.test.d.ts +0 -1
- package/dist/now/index.test.js +0 -18
- package/dist/now/index.test.js.map +0 -1
- package/dist/projects/describe.js +0 -44
- package/dist/projects/describe.js.map +0 -1
- package/dist/projects/index.js +0 -39
- package/dist/projects/index.js.map +0 -1
- package/dist/utils/callApi.d.ts +0 -5
- package/dist/utils/callApi.js +0 -20
- package/dist/utils/callApi.js.map +0 -1
- package/dist/utils/fetchLocalProject.d.ts +0 -1
- package/dist/utils/fetchLocalProject.js +0 -12
- package/dist/utils/fetchLocalProject.js.map +0 -1
- package/dist/utils/saveProject.d.ts +0 -2
- package/dist/utils/saveProject.js +0 -68
- package/dist/utils/saveProject.js.map +0 -1
- package/eslint.config.js +0 -27
- package/src/accounts/index.ts +0 -41
- package/src/index.ts +0 -22
- package/src/now/index.test.ts +0 -31
- package/src/now/index.ts +0 -15
- package/src/projects/describe.ts +0 -80
- package/src/projects/index.ts +0 -61
- package/src/pull/index.ts +0 -45
- package/src/run/index.ts +0 -81
- package/src/utils/callApi.ts +0 -29
- package/src/utils/fetchLocalProject.ts +0 -12
- package/src/utils/saveProject.ts +0 -106
- package/src/whoami/index.ts +0 -32
- package/tsconfig.json +0 -28
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export var AccountOrderField;
|
|
2
|
+
(function (AccountOrderField) {
|
|
3
|
+
AccountOrderField["CreatedAt"] = "createdAt";
|
|
4
|
+
AccountOrderField["Name"] = "name";
|
|
5
|
+
AccountOrderField["UpdatedAt"] = "updatedAt";
|
|
6
|
+
})(AccountOrderField || (AccountOrderField = {}));
|
|
7
|
+
export var AccountRole;
|
|
8
|
+
(function (AccountRole) {
|
|
9
|
+
AccountRole["Admin"] = "admin";
|
|
10
|
+
AccountRole["Member"] = "member";
|
|
11
|
+
AccountRole["Owner"] = "owner";
|
|
12
|
+
})(AccountRole || (AccountRole = {}));
|
|
13
|
+
export var Direction;
|
|
14
|
+
(function (Direction) {
|
|
15
|
+
Direction["Asc"] = "asc";
|
|
16
|
+
Direction["Desc"] = "desc";
|
|
17
|
+
})(Direction || (Direction = {}));
|
|
18
|
+
export var ElementType;
|
|
19
|
+
(function (ElementType) {
|
|
20
|
+
ElementType["Auth"] = "auth";
|
|
21
|
+
ElementType["Config"] = "config";
|
|
22
|
+
ElementType["Dictionary"] = "dictionary";
|
|
23
|
+
ElementType["Flow"] = "flow";
|
|
24
|
+
ElementType["Job"] = "job";
|
|
25
|
+
ElementType["Mutation"] = "mutation";
|
|
26
|
+
ElementType["RetryRule"] = "retryRule";
|
|
27
|
+
ElementType["Schema"] = "schema";
|
|
28
|
+
ElementType["Service"] = "service";
|
|
29
|
+
ElementType["Value"] = "value";
|
|
30
|
+
})(ElementType || (ElementType = {}));
|
|
31
|
+
export var IntegrationOrderField;
|
|
32
|
+
(function (IntegrationOrderField) {
|
|
33
|
+
IntegrationOrderField["Account"] = "account";
|
|
34
|
+
IntegrationOrderField["CreatedAt"] = "createdAt";
|
|
35
|
+
IntegrationOrderField["Name"] = "name";
|
|
36
|
+
IntegrationOrderField["UpdatedAt"] = "updatedAt";
|
|
37
|
+
})(IntegrationOrderField || (IntegrationOrderField = {}));
|
|
38
|
+
export var LogStatus;
|
|
39
|
+
(function (LogStatus) {
|
|
40
|
+
LogStatus["Autherror"] = "autherror";
|
|
41
|
+
LogStatus["Badrequest"] = "badrequest";
|
|
42
|
+
LogStatus["Badresponse"] = "badresponse";
|
|
43
|
+
LogStatus["Error"] = "error";
|
|
44
|
+
LogStatus["Noaccess"] = "noaccess";
|
|
45
|
+
LogStatus["Noaction"] = "noaction";
|
|
46
|
+
LogStatus["Notfound"] = "notfound";
|
|
47
|
+
LogStatus["Ok"] = "ok";
|
|
48
|
+
LogStatus["Pending"] = "pending";
|
|
49
|
+
LogStatus["Queued"] = "queued";
|
|
50
|
+
LogStatus["Queuing"] = "queuing";
|
|
51
|
+
LogStatus["Starting"] = "starting";
|
|
52
|
+
LogStatus["Timeout"] = "timeout";
|
|
53
|
+
LogStatus["Toomany"] = "toomany";
|
|
54
|
+
})(LogStatus || (LogStatus = {}));
|
|
55
|
+
export var LogType;
|
|
56
|
+
(function (LogType) {
|
|
57
|
+
LogType["Action"] = "action";
|
|
58
|
+
LogType["Load"] = "load";
|
|
59
|
+
LogType["Response"] = "response";
|
|
60
|
+
LogType["Schedule"] = "schedule";
|
|
61
|
+
LogType["Unload"] = "unload";
|
|
62
|
+
})(LogType || (LogType = {}));
|
|
63
|
+
export var NotificationType;
|
|
64
|
+
(function (NotificationType) {
|
|
65
|
+
NotificationType["Failure"] = "failure";
|
|
66
|
+
NotificationType["Warning"] = "warning";
|
|
67
|
+
})(NotificationType || (NotificationType = {}));
|
|
68
|
+
export var Status;
|
|
69
|
+
(function (Status) {
|
|
70
|
+
Status["Active"] = "active";
|
|
71
|
+
Status["Inactive"] = "inactive";
|
|
72
|
+
})(Status || (Status = {}));
|
|
73
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/generated/graphql.ts"],"names":[],"mappings":"AA8DA,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAE3B,4CAAuB,CAAA;IAEvB,kCAAa,CAAA;IAEb,4CAAuB,CAAA;AACzB,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AAGD,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8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AAP,OAAO,QAMlB;AA6YD,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAmRD,MAAM,CAAN,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;AACvB,CAAC,EAHW,MAAM,KAAN,MAAM,QAGjB"}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { program } from 'commander';
|
|
3
3
|
import accounts from './accounts/index.js';
|
|
4
|
+
import clone from './clone/index.js';
|
|
5
|
+
import config from './config/index.js';
|
|
6
|
+
import create from './create/index.js';
|
|
7
|
+
import deploy from './deploy/index.js';
|
|
8
|
+
import explode from './explode/index.js';
|
|
9
|
+
import init from './init/index.js';
|
|
10
|
+
import login from './login/index.js';
|
|
11
|
+
import logout from './logout/index.js';
|
|
4
12
|
import now from './now/index.js';
|
|
5
|
-
import
|
|
13
|
+
import integrations from './integrations/index.js';
|
|
6
14
|
import pull from './pull/index.js';
|
|
15
|
+
import push from './push/index.js';
|
|
16
|
+
import repl from './repl/index.js';
|
|
7
17
|
import run from './run/index.js';
|
|
18
|
+
import status from './status/index.js';
|
|
19
|
+
import value from './value/index.js';
|
|
8
20
|
import whoami from './whoami/index.js';
|
|
9
|
-
|
|
10
|
-
|
|
21
|
+
import { getStoredToken } from './utils/token.js';
|
|
22
|
+
const apiToken = getStoredToken();
|
|
23
|
+
program.version('0.4.0-alpha.0', '-v, --version').description('Integreat CLI');
|
|
11
24
|
accounts(program, apiToken);
|
|
25
|
+
clone(program, apiToken);
|
|
26
|
+
config(program);
|
|
27
|
+
create(program, apiToken);
|
|
28
|
+
deploy(program, apiToken);
|
|
29
|
+
explode(program);
|
|
30
|
+
init(program);
|
|
31
|
+
login(program);
|
|
32
|
+
logout(program);
|
|
12
33
|
now(program);
|
|
13
|
-
|
|
34
|
+
integrations(program, apiToken);
|
|
14
35
|
pull(program, apiToken);
|
|
36
|
+
push(program, apiToken);
|
|
37
|
+
repl(program, apiToken);
|
|
15
38
|
run(program, apiToken);
|
|
39
|
+
status(program, apiToken);
|
|
40
|
+
value(program, apiToken);
|
|
16
41
|
whoami(program, apiToken);
|
|
17
42
|
program.parse(process.argv);
|
|
18
43
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAC1C,OAAO,GAAG,MAAM,gBAAgB,CAAA;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,MAAM,kBAAkB,CAAA;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,OAAO,MAAM,oBAAoB,CAAA;AACxC,OAAO,IAAI,MAAM,iBAAiB,CAAA;AAClC,OAAO,KAAK,MAAM,kBAAkB,CAAA;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,GAAG,MAAM,gBAAgB,CAAA;AAChC,OAAO,YAAY,MAAM,yBAAyB,CAAA;AAClD,OAAO,IAAI,MAAM,iBAAiB,CAAA;AAClC,OAAO,IAAI,MAAM,iBAAiB,CAAA;AAClC,OAAO,IAAI,MAAM,iBAAiB,CAAA;AAClC,OAAO,GAAG,MAAM,gBAAgB,CAA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|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
export declare const action: (log: (message: string) => void, fsImpl?: typeof fs) => (name?: string) => Promise<void>;
|
|
4
|
+
declare const _default: (program: Command) => Command;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import determineNameAndKey from '../utils/determineNameAndKey.js';
|
|
5
|
+
const FOLDERS = [
|
|
6
|
+
'schemas',
|
|
7
|
+
'services',
|
|
8
|
+
'auths',
|
|
9
|
+
'mutations',
|
|
10
|
+
'dictionaries',
|
|
11
|
+
'jobs',
|
|
12
|
+
'values',
|
|
13
|
+
'flows',
|
|
14
|
+
'retryRules',
|
|
15
|
+
];
|
|
16
|
+
export const action = (log, fsImpl = fs) => async function init(name) {
|
|
17
|
+
if (fsImpl.existsSync('integration.json')) {
|
|
18
|
+
log(chalk.red('integration.json already exists in this directory'));
|
|
19
|
+
log(`Run ${chalk.bold('great pull')} to update from server`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const integrationName = name || path.basename(process.cwd());
|
|
23
|
+
const { name: displayName, key } = determineNameAndKey(integrationName);
|
|
24
|
+
const integrationData = {
|
|
25
|
+
__key: key,
|
|
26
|
+
name: displayName,
|
|
27
|
+
};
|
|
28
|
+
fsImpl.writeFileSync('integration.json', JSON.stringify(integrationData, null, 2));
|
|
29
|
+
for (const folder of FOLDERS) {
|
|
30
|
+
if (!fsImpl.existsSync(folder)) {
|
|
31
|
+
fsImpl.mkdirSync(folder, { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
log(chalk.green('✓ Initialized integration workspace'));
|
|
35
|
+
log(` Name: ${chalk.cyan(displayName)}`);
|
|
36
|
+
log(` Key: ${key}`);
|
|
37
|
+
log('');
|
|
38
|
+
log('Next steps:');
|
|
39
|
+
log(` 1. Create schemas, services, and other elements in their folders`);
|
|
40
|
+
log(` 2. Run ${chalk.bold('great push')} to sync local files to server`);
|
|
41
|
+
};
|
|
42
|
+
export default (program) => program
|
|
43
|
+
.command('init [name]')
|
|
44
|
+
.description('Initialize a new integration workspace (local only, no server interaction)')
|
|
45
|
+
.action(action(console.log));
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,mBAAmB,MAAM,iCAAiC,CAAA;AAEjE,MAAM,OAAO,GAAG;IACd,SAAS;IACT,UAAU;IACV,OAAO;IACP,WAAW;IACX,cAAc;IACd,MAAM;IACN,QAAQ;IACR,OAAO;IACP,YAAY;CACb,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAA8B,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE,CACpE,KAAK,UAAU,IAAI,CAAC,IAAa;IAE/B,IAAI,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC,CAAA;QACnE,GAAG,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,wBAAwB,CAAC,CAAA;QAC5D,OAAM;IACR,CAAC;IAGD,MAAM,eAAe,GAAG,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IAC5D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAA;IAGvE,MAAM,eAAe,GAAG;QACtB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,WAAW;KAClB,CAAA;IAED,MAAM,CAAC,aAAa,CAClB,kBAAkB,EAClB,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,CACzC,CAAA;IAGD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAA;IACvD,GAAG,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;IACzC,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;IACpB,GAAG,CAAC,EAAE,CAAC,CAAA;IACP,GAAG,CAAC,aAAa,CAAC,CAAA;IAClB,GAAG,CAAC,oEAAoE,CAAC,CAAA;IACzE,GAAG,CAAC,YAAY,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,gCAAgC,CAAC,CAAA;AAC3E,CAAC,CAAA;AAEH,eAAe,CAAC,OAAgB,EAAE,EAAE,CAClC,OAAO;KACJ,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CACV,4EAA4E,CAC7E;KACA,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Conf from 'conf';
|
|
2
|
+
import { type GraphQLRequestClient } from '../utils/graphqlClient.js';
|
|
3
|
+
import { type ConfigSchema } from '../utils/config.js';
|
|
4
|
+
export default function createIntegration(log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, config?: Conf<ConfigSchema>): (integrationName?: string, options?: {
|
|
5
|
+
account?: string;
|
|
6
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { createGraphQLClient, } from '../utils/graphqlClient.js';
|
|
3
|
+
import { handleGraphQLError } from '../utils/graphqlError.js';
|
|
4
|
+
import { gql } from 'graphql-tag';
|
|
5
|
+
import determineNameAndKey from '../utils/determineNameAndKey.js';
|
|
6
|
+
import { resolveAccountId } from '../utils/resolveAccount.js';
|
|
7
|
+
import { getApiBaseUrl } from '../utils/config.js';
|
|
8
|
+
const CreateIntegrationMutationDocument = gql `
|
|
9
|
+
mutation CreateIntegration(
|
|
10
|
+
$accountId: ID!
|
|
11
|
+
$name: String!
|
|
12
|
+
$key: ID
|
|
13
|
+
$description: String
|
|
14
|
+
) {
|
|
15
|
+
createIntegration(
|
|
16
|
+
accountId: $accountId
|
|
17
|
+
name: $name
|
|
18
|
+
key: $key
|
|
19
|
+
description: $description
|
|
20
|
+
) {
|
|
21
|
+
id
|
|
22
|
+
key
|
|
23
|
+
name
|
|
24
|
+
createdAt
|
|
25
|
+
description
|
|
26
|
+
status
|
|
27
|
+
account {
|
|
28
|
+
id
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
export default function createIntegration(log, apiToken, client, config) {
|
|
34
|
+
return async function integration(integrationName, options) {
|
|
35
|
+
if (!integrationName) {
|
|
36
|
+
log(chalk.red('Integration name is required'));
|
|
37
|
+
log(`Usage: ${chalk.bold('great create integration <name> -a <account>')}`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const { name, key } = determineNameAndKey(integrationName);
|
|
41
|
+
const apiBaseUrl = getApiBaseUrl(config);
|
|
42
|
+
const graphqlClient = client ?? createGraphQLClient(apiToken, apiBaseUrl);
|
|
43
|
+
const { accountId, error } = await resolveAccountId(options ?? {}, apiToken ?? '', graphqlClient, config);
|
|
44
|
+
if (error) {
|
|
45
|
+
log(chalk.red(error));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!accountId) {
|
|
49
|
+
log(chalk.red('Account is required. Use -a flag to specify account id or key, or set a default with: great config set account <id>'));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const result = await graphqlClient.request(CreateIntegrationMutationDocument, { accountId, name, key });
|
|
53
|
+
if (result.error) {
|
|
54
|
+
handleGraphQLError(result.error, log);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const integration = result.data?.createIntegration;
|
|
58
|
+
if (!integration) {
|
|
59
|
+
log(chalk.red('Failed to create integration'));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
log(chalk.green('✓ Integration created on server'));
|
|
63
|
+
log(` Name: ${chalk.cyan(integration.name)}`);
|
|
64
|
+
log(` ID: ${integration.id}`);
|
|
65
|
+
log(` Key: ${integration.key}`);
|
|
66
|
+
log('');
|
|
67
|
+
log(`To link with local workspace, run ${chalk.bold('great clone')}.`);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/integrations/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EACL,mBAAmB,GAEpB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,mBAAmB,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAA;AAGrE,MAAM,iCAAiC,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;CAwB5C,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,GAA8B,EAC9B,QAAiB,EACjB,MAA6B,EAC7B,MAA2B;IAE3B,OAAO,KAAK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AC,8BAA8B,CAAC,CAAC,CAAA;YAC9C,OAAM;QACR,CAAC;QAGD,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAA;QACnD,GAAG,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC9C,GAAG,CAAC,SAAS,WAAW,CAAC,EAAE,EAAE,CAAC,CAAA;QAC9B,GAAG,CAAC,UAAU,WAAW,CAAC,GAAG,EAAE,CAAC,CAAA;QAChC,GAAG,CAAC,EAAE,CAAC,CAAA;QACP,GAAG,CAAC,qCAAqC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IACxE,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import listIntegrationsAction from './list.js';
|
|
2
|
+
import createIntegrationAction from './create.js';
|
|
3
|
+
export default (program, apiToken) => {
|
|
4
|
+
const integrations = program
|
|
5
|
+
.command('integrations')
|
|
6
|
+
.description('commands for integrations, run `great integrations --help` to see options. `great integrations` is also a shortcut for `great integrations list`')
|
|
7
|
+
.option('-a, --account <id>', 'account id or key (uses default from config if not provided)')
|
|
8
|
+
.option('--all', 'list all integrations, ignoring default account')
|
|
9
|
+
.action(listIntegrationsAction(console.log, apiToken));
|
|
10
|
+
integrations
|
|
11
|
+
.command('list')
|
|
12
|
+
.description('list all integrations you have access to')
|
|
13
|
+
.option('-a, --account <id>', 'account id or key (uses default from config if not provided)')
|
|
14
|
+
.option('--all', 'list all integrations, ignoring default account')
|
|
15
|
+
.action(listIntegrationsAction(console.log, apiToken));
|
|
16
|
+
integrations
|
|
17
|
+
.command('create <name>')
|
|
18
|
+
.description('create a new integration on the server')
|
|
19
|
+
.option('-a, --account <id>', 'account id or key (required, or set default with: great config set account)')
|
|
20
|
+
.action(createIntegrationAction(console.log, apiToken));
|
|
21
|
+
return integrations;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,MAAM,WAAW,CAAA;AAC9C,OAAO,uBAAuB,MAAM,aAAa,CAAA;AAEjD,eAAe,CAAC,OAAgB,EAAE,QAAiB,EAAE,EAAE;IACrD,MAAM,YAAY,GAAG,OAAO;SACzB,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CACV,kJAAkJ,CACnJ;SACA,MAAM,CACL,oBAAoB,EACpB,8DAA8D,CAC/D;SACA,MAAM,CAAC,OAAO,EAAE,iDAAiD,CAAC;SAClE,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA;IAExD,YAAY;SACT,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,0CAA0C,CAAC;SACvD,MAAM,CACL,oBAAoB,EACpB,8DAA8D,CAC/D;SACA,MAAM,CAAC,OAAO,EAAE,iDAAiD,CAAC;SAClE,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA;IAExD,YAAY;SACT,OAAO,CAAC,eAAe,CAAC;SACxB,WAAW,CAAC,wCAAwC,CAAC;SACrD,MAAM,CACL,oBAAoB,EACpB,6EAA6E,CAC9E;SACA,MAAM,CAAC,uBAAuB,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA;IAEzD,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Conf from 'conf';
|
|
2
|
+
import { type GraphQLRequestClient } from '../utils/graphqlClient.js';
|
|
3
|
+
import { type ConfigSchema } from '../utils/config.js';
|
|
4
|
+
export default function listIntegrations(log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, config?: Conf<ConfigSchema>): (options?: {
|
|
5
|
+
account?: string;
|
|
6
|
+
all?: boolean;
|
|
7
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import columnify from 'columnify';
|
|
3
|
+
import { createGraphQLClient, } from '../utils/graphqlClient.js';
|
|
4
|
+
import { handleGraphQLError } from '../utils/graphqlError.js';
|
|
5
|
+
import { gql } from 'graphql-tag';
|
|
6
|
+
import { resolveAccountId } from '../utils/resolveAccount.js';
|
|
7
|
+
import { getApiBaseUrl } from '../utils/config.js';
|
|
8
|
+
const IntegrationsQueryDocument = gql `
|
|
9
|
+
query Integrations {
|
|
10
|
+
integrations(orderBy: name, direction: asc) {
|
|
11
|
+
totalCount
|
|
12
|
+
nodes {
|
|
13
|
+
id
|
|
14
|
+
name
|
|
15
|
+
key
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const IntegrationsForAccountQueryDocument = gql `
|
|
21
|
+
query IntegrationsForAccount($accountId: ID!) {
|
|
22
|
+
account(id: $accountId) {
|
|
23
|
+
name
|
|
24
|
+
integrations {
|
|
25
|
+
totalCount
|
|
26
|
+
nodes {
|
|
27
|
+
id
|
|
28
|
+
name
|
|
29
|
+
key
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
async function fetchAllIntegrations(client, log) {
|
|
36
|
+
const result = await client.request(IntegrationsQueryDocument, {});
|
|
37
|
+
if (result.error) {
|
|
38
|
+
handleGraphQLError(result.error, log);
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
integrations: result.data?.integrations?.nodes ?? [],
|
|
43
|
+
count: result.data?.integrations?.totalCount ?? 0,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async function fetchAccountIntegrations(client, accountId, log) {
|
|
47
|
+
const result = await client.request(IntegrationsForAccountQueryDocument, { accountId });
|
|
48
|
+
if (result.error) {
|
|
49
|
+
handleGraphQLError(result.error, log);
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
integrations: result.data?.account?.integrations?.nodes ?? [],
|
|
54
|
+
count: result.data?.account?.integrations?.totalCount ?? 0,
|
|
55
|
+
accountName: result.data?.account?.name ?? undefined,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function displayIntegrations({ integrations, count, accountName }, log) {
|
|
59
|
+
if (integrations.length > 0) {
|
|
60
|
+
log(columnify(integrations, {
|
|
61
|
+
columns: ['name', 'key', 'id'],
|
|
62
|
+
columnSplitter: ' ',
|
|
63
|
+
config: {
|
|
64
|
+
name: {
|
|
65
|
+
dataTransform: (data) => chalk.cyan(data),
|
|
66
|
+
},
|
|
67
|
+
id: {
|
|
68
|
+
dataTransform: (data) => chalk.grey(data),
|
|
69
|
+
headingTransform: (heading) => chalk.grey(heading.toUpperCase()),
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
const countText = count
|
|
75
|
+
? `${count} ${count === 1 ? 'integration' : 'integrations'}`
|
|
76
|
+
: 'No integrations';
|
|
77
|
+
const suffix = accountName ? ` for ${accountName}` : '';
|
|
78
|
+
log(chalk.white(`\n${countText}${suffix}`));
|
|
79
|
+
}
|
|
80
|
+
export default function listIntegrations(log, apiToken, client, config) {
|
|
81
|
+
return async function integrationsList(options) {
|
|
82
|
+
const apiBaseUrl = getApiBaseUrl(config);
|
|
83
|
+
const graphqlClient = client ?? createGraphQLClient(apiToken, apiBaseUrl);
|
|
84
|
+
let result;
|
|
85
|
+
if (options?.all) {
|
|
86
|
+
result = await fetchAllIntegrations(graphqlClient, log);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const { accountId, error } = await resolveAccountId(options ?? {}, apiToken ?? '', graphqlClient, config);
|
|
90
|
+
if (error) {
|
|
91
|
+
log(chalk.red(error));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
result = accountId
|
|
95
|
+
? await fetchAccountIntegrations(graphqlClient, accountId, log)
|
|
96
|
+
: await fetchAllIntegrations(graphqlClient, log);
|
|
97
|
+
}
|
|
98
|
+
if (result) {
|
|
99
|
+
displayIntegrations(result, log);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/integrations/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EACL,mBAAmB,GAEpB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAK7D,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAA;AAErE,MAAM,yBAAyB,GAAG,GAAG,CAAA;;;;;;;;;;;CAWpC,CAAA;AAED,MAAM,mCAAmC,GAAG,GAAG,CAAA;;;;;;;;;;;;;;CAc9C,CAAA;AAQD,KAAK,UAAU,oBAAoB,CACjC,MAA4B,EAC5B,GAA8B;IAE9B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CACjC,yBAAyB,EACzB,EAAE,CACH,CAAA;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QACrC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO;QACL,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,IAAI,EAAE;QACpD,KAAK,EAAE,MAAM,CAAC,IAAI,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AC,CAAC,MAAM,oBAAoB,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QACpD,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAClC,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import Conf from 'conf';
|
|
3
|
+
import { type ConfigSchema } from '../utils/config.js';
|
|
4
|
+
export declare const action: (log: (message: string) => void, config?: Conf<ConfigSchema>) => () => Promise<void>;
|
|
5
|
+
declare const _default: (program: Command) => Command;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { startAuthFlow } from '../utils/authServer.js';
|
|
3
|
+
import { getAppBaseUrl } from '../utils/config.js';
|
|
4
|
+
import { saveToken } from '../utils/token.js';
|
|
5
|
+
import { getJwtExpiration } from '../utils/jwt.js';
|
|
6
|
+
export const action = (log, config) => async function login() {
|
|
7
|
+
try {
|
|
8
|
+
log(chalk.white('Opening browser for authentication...'));
|
|
9
|
+
const appBaseUrl = getAppBaseUrl(config);
|
|
10
|
+
const authUrl = `${appBaseUrl}/signin?cliCallback={callback}`;
|
|
11
|
+
const { token } = await startAuthFlow(authUrl, appBaseUrl);
|
|
12
|
+
const expiresAt = getJwtExpiration(token);
|
|
13
|
+
saveToken(token, expiresAt, config);
|
|
14
|
+
log(chalk.white('✓ Successfully logged in to Integreat!'));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
18
|
+
log(chalk.red(`Authentication failed: ${message}`));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export default (program) => program
|
|
22
|
+
.command('login')
|
|
23
|
+
.description('log in to Integreat')
|
|
24
|
+
.action(action(console.log));
|
|
25
|
+
//# sourceMappingURL=index.js.map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,OAAO,CAAC;KAChB,WAAW,CAAC,qBAAqB,CAAC;KAClC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import Conf from 'conf';
|
|
3
|
+
import type { ConfigSchema } from '../utils/config.js';
|
|
4
|
+
export declare const action: (log: (message: string) => void, config?: Conf<ConfigSchema>) => () => void;
|
|
5
|
+
declare const _default: (program: Command) => Command;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { clearToken } from '../utils/token.js';
|
|
3
|
+
export const action = (log, config) => function logout() {
|
|
4
|
+
clearToken(config);
|
|
5
|
+
log(chalk.white('✓ Logged out successfully'));
|
|
6
|
+
};
|
|
7
|
+
export default (program) => program
|
|
8
|
+
.command('logout')
|
|
9
|
+
.description('log out of Integreat')
|
|
10
|
+
.action(action(console.log));
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logout/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,GAA8B,EAC9B,MAA2B,EAC3B,EAAE,CACF,SAAS,MAAM;IACb,UAAU,CAAC,MAAM,CAAC,CAAA;IAClB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA;AAEH,eAAe,CAAC,OAAgB,EAAE,EAAE,CAClC,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,sBAAsB,CAAC;KACnC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA"}
|
package/dist/now/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
-
export declare const action: (log: (message: string) => void) => (
|
|
2
|
+
export declare const action: (log: (message: string) => void) => (options: {
|
|
3
|
+
copy?: boolean;
|
|
4
|
+
}) => Promise<void>;
|
|
3
5
|
declare const _default: (program: Command) => Command;
|
|
4
6
|
export default _default;
|
package/dist/now/index.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import clipboardy from 'clipboardy';
|
|
3
|
+
export const action = (log) => async function now(options) {
|
|
4
|
+
const timestamp = String(Date.now());
|
|
5
|
+
if (options.copy) {
|
|
6
|
+
await clipboardy.write(timestamp);
|
|
7
|
+
log(chalk.green('Timestamp copied to clipboard'));
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
log(chalk.white(timestamp));
|
|
11
|
+
}
|
|
4
12
|
};
|
|
5
13
|
export default (program) => program
|
|
6
14
|
.command('now')
|
|
7
15
|
.description('display current time as a Unix time stamp (milliseconds since 1970-01-01')
|
|
16
|
+
.option('-c, --copy', 'copy timestamp to clipboard instead of printing')
|
|
8
17
|
.action(action(console.log));
|
|
9
18
|
//# sourceMappingURL=index.js.map
|
package/dist/now/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/now/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/now/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAA8B,EAAE,EAAE,CACvD,KAAK,UAAU,GAAG,CAAC,OAA2B;IAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAEpC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QACjC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAA;IACnD,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC,CAAA;AAEH,eAAe,CAAC,OAAgB,EAAE,EAAE,CAClC,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CACV,0EAA0E,CAC3E;KACA,MAAM,CAAC,YAAY,EAAE,iDAAiD,CAAC;KACvE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA"}
|
package/dist/pull/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import Conf from 'conf';
|
|
3
|
+
import { type GraphQLRequestClient } from '../utils/graphqlClient.js';
|
|
4
|
+
import { type ConfigSchema } from '../utils/config.js';
|
|
1
5
|
import type { Command } from 'commander';
|
|
2
|
-
export declare const action: (log: (message: string) => void, apiToken?: string) => (
|
|
6
|
+
export declare const action: (log: (message: string) => void, apiToken?: string, client?: GraphQLRequestClient, fsImpl?: typeof fs, config?: Conf<ConfigSchema>) => () => Promise<void>;
|
|
3
7
|
declare const _default: (program: Command, apiToken?: string) => Command;
|
|
4
8
|
export default _default;
|
package/dist/pull/index.js
CHANGED
|
@@ -1,31 +1,62 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import saveIntegration from '../utils/saveIntegration.js';
|
|
3
|
+
import { fetchIdFromFile } from '../utils/fetchLocal.js';
|
|
4
|
+
import { createGraphQLClient, } from '../utils/graphqlClient.js';
|
|
5
|
+
import { handleGraphQLError } from '../utils/graphqlError.js';
|
|
6
|
+
import { getApiBaseUrl } from '../utils/config.js';
|
|
7
|
+
import { gql } from 'graphql-tag';
|
|
8
|
+
const IntegrationDefinitionQueryDocument = gql `
|
|
9
|
+
query IntegrationDefinition($id: ID!) {
|
|
10
|
+
integration(id: $id) {
|
|
11
|
+
id
|
|
12
|
+
key
|
|
13
|
+
name
|
|
14
|
+
description
|
|
15
|
+
status
|
|
16
|
+
account {
|
|
17
|
+
id
|
|
18
|
+
key
|
|
19
|
+
name
|
|
20
|
+
}
|
|
21
|
+
latest {
|
|
22
|
+
timestamp
|
|
23
|
+
elements {
|
|
24
|
+
id
|
|
25
|
+
key
|
|
26
|
+
name
|
|
27
|
+
__typename
|
|
28
|
+
content {
|
|
29
|
+
timestamp
|
|
30
|
+
data
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const action = (log, apiToken, client, fsImpl, config) => async function pullIntegration() {
|
|
38
|
+
const id = fetchIdFromFile(fsImpl);
|
|
7
39
|
if (!id) {
|
|
8
|
-
log(chalk.red('No
|
|
40
|
+
log(chalk.red('No local integration project found'));
|
|
41
|
+
log(`Run ${chalk.bold('great clone <integration-id>')} to clone an integration to a new folder`);
|
|
9
42
|
return;
|
|
10
43
|
}
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
44
|
+
const apiBaseUrl = getApiBaseUrl(config);
|
|
45
|
+
const graphqlClient = client ?? createGraphQLClient(apiToken, apiBaseUrl);
|
|
46
|
+
const result = await graphqlClient.request(IntegrationDefinitionQueryDocument, { id });
|
|
47
|
+
if (result.error) {
|
|
48
|
+
handleGraphQLError(result.error, log);
|
|
15
49
|
return;
|
|
16
50
|
}
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
log(chalk.red('Project has no definitions'));
|
|
51
|
+
const integration = result.data?.integration;
|
|
52
|
+
if (!integration || !integration.latest) {
|
|
53
|
+
log(chalk.red('Integration has no latest version'));
|
|
54
|
+
return;
|
|
24
55
|
}
|
|
56
|
+
saveIntegration(integration, integration.latest, undefined, fsImpl);
|
|
25
57
|
};
|
|
26
58
|
export default (program, apiToken) => program
|
|
27
59
|
.command('pull')
|
|
28
|
-
.description('pull
|
|
29
|
-
.argument('[project]', 'id of the project to pull, will override any id in the local index file')
|
|
60
|
+
.description('pull remote changes to the current integration folder')
|
|
30
61
|
.action(action(console.log, apiToken));
|
|
31
62
|
//# sourceMappingURL=index.js.map
|