great 1.1.0 → 1.2.0
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 +137 -43
- package/dist/accounts/create.d.ts +1 -1
- package/dist/accounts/create.js +2 -4
- package/dist/accounts/create.js.map +1 -1
- package/dist/accounts/index.d.ts +1 -1
- package/dist/accounts/index.js +2 -4
- package/dist/accounts/index.js.map +1 -1
- package/dist/clone/index.d.ts +4 -2
- package/dist/clone/index.js +19 -43
- package/dist/clone/index.js.map +1 -1
- package/dist/config/index.js +4 -30
- package/dist/config/index.js.map +1 -1
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.js +54 -14
- package/dist/deploy/index.js.map +1 -1
- package/dist/env/index.d.ts +12 -0
- package/dist/env/index.js +131 -0
- package/dist/env/index.js.map +1 -0
- package/dist/explode/transform.d.ts +1 -1
- package/dist/explode/transform.js +3 -1
- package/dist/explode/transform.js.map +1 -1
- package/dist/generated/operations.d.ts +617 -0
- package/dist/generated/operations.js +2 -0
- package/dist/generated/operations.js.map +1 -0
- package/dist/generated/schema.d.ts +965 -0
- package/dist/generated/{graphql.js → schema.js} +13 -1
- package/dist/generated/schema.js.map +1 -0
- package/dist/implode/index.js +22 -43
- package/dist/implode/index.js.map +1 -1
- package/dist/implode/transform.d.ts +3 -5
- package/dist/implode/transform.js +10 -10
- package/dist/implode/transform.js.map +1 -1
- package/dist/{integrations/describe.d.ts → import/index.d.ts} +4 -1
- package/dist/import/index.js +43 -0
- package/dist/import/index.js.map +1 -0
- package/dist/include/index.d.ts +10 -0
- package/dist/include/index.js +41 -0
- package/dist/include/index.js.map +1 -0
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/init/index.js +8 -16
- package/dist/init/index.js.map +1 -1
- package/dist/integrations/create.d.ts +1 -1
- package/dist/integrations/create.js +2 -4
- package/dist/integrations/create.js.map +1 -1
- package/dist/integrations/list.d.ts +1 -1
- package/dist/integrations/list.js +2 -4
- package/dist/integrations/list.js.map +1 -1
- package/dist/migrate/index.d.ts +5 -0
- package/dist/migrate/index.js +101 -0
- package/dist/migrate/index.js.map +1 -0
- package/dist/pull/index.d.ts +4 -2
- package/dist/pull/index.js +25 -44
- package/dist/pull/index.js.map +1 -1
- package/dist/push/index.d.ts +1 -1
- package/dist/push/index.js +333 -96
- package/dist/push/index.js.map +1 -1
- package/dist/rename/index.d.ts +8 -0
- package/dist/rename/index.js +109 -0
- package/dist/rename/index.js.map +1 -0
- package/dist/repl/dispatch.d.ts +8 -2
- package/dist/repl/dispatch.js +43 -29
- package/dist/repl/dispatch.js.map +1 -1
- package/dist/repl/dispatchAndLoad.d.ts +7 -0
- package/dist/repl/dispatchAndLoad.js +35 -0
- package/dist/repl/dispatchAndLoad.js.map +1 -0
- package/dist/repl/help.js +8 -1
- package/dist/repl/help.js.map +1 -1
- package/dist/repl/index.d.ts +1 -1
- package/dist/repl/index.js +29 -9
- package/dist/repl/index.js.map +1 -1
- package/dist/repl/load.d.ts +8 -0
- package/dist/repl/load.js +53 -0
- package/dist/repl/load.js.map +1 -0
- package/dist/run/index.d.ts +4 -5
- package/dist/run/index.js +4 -6
- package/dist/run/index.js.map +1 -1
- package/dist/status/index.d.ts +1 -1
- package/dist/status/index.js +5 -7
- package/dist/status/index.js.map +1 -1
- package/dist/utils/config.d.ts +9 -2
- package/dist/utils/config.js +39 -6
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/createIntegrationFromFile.d.ts +2 -0
- package/dist/utils/createIntegrationFromFile.js +14 -33
- package/dist/utils/createIntegrationFromFile.js.map +1 -1
- package/dist/utils/detectPullConflicts.d.ts +8 -0
- package/dist/utils/detectPullConflicts.js +65 -0
- package/dist/utils/detectPullConflicts.js.map +1 -0
- package/dist/utils/dispatch.d.ts +1 -1
- package/dist/utils/dispatch.js +3 -2
- package/dist/utils/dispatch.js.map +1 -1
- package/dist/utils/elementFiles.d.ts +13 -0
- package/dist/utils/elementFiles.js +76 -0
- package/dist/utils/elementFiles.js.map +1 -0
- package/dist/utils/fetchIntegrationDefinition.d.ts +8 -0
- package/dist/utils/fetchIntegrationDefinition.js +58 -0
- package/dist/utils/fetchIntegrationDefinition.js.map +1 -0
- package/dist/utils/fetchLocal.d.ts +3 -1
- package/dist/utils/fetchLocal.js +11 -9
- package/dist/utils/fetchLocal.js.map +1 -1
- package/dist/utils/fetchSession.d.ts +1 -1
- package/dist/utils/fetchSession.js +2 -1
- package/dist/utils/fetchSession.js.map +1 -1
- package/dist/utils/graphqlClient.d.ts +3 -0
- package/dist/utils/graphqlClient.js +3 -0
- package/dist/utils/graphqlClient.js.map +1 -1
- package/dist/utils/graphqlError.d.ts +1 -0
- package/dist/utils/graphqlError.js +13 -1
- package/dist/utils/graphqlError.js.map +1 -1
- package/dist/utils/greatFile.d.ts +40 -0
- package/dist/utils/greatFile.js +66 -0
- package/dist/utils/greatFile.js.map +1 -0
- package/dist/utils/hashContent.js +1 -1
- package/dist/utils/hashContent.js.map +1 -1
- package/dist/utils/integrationType.d.ts +3 -0
- package/dist/utils/integrationType.js +15 -0
- package/dist/utils/integrationType.js.map +1 -0
- package/dist/utils/resolveAccount.d.ts +3 -2
- package/dist/utils/resolveAccount.js +11 -1
- package/dist/utils/resolveAccount.js.map +1 -1
- package/dist/utils/resolveElement.d.ts +1 -1
- package/dist/utils/resolveElementInclude.d.ts +3 -0
- package/dist/utils/resolveElementInclude.js +28 -0
- package/dist/utils/resolveElementInclude.js.map +1 -0
- package/dist/utils/resolveIntegration.d.ts +4 -2
- package/dist/utils/resolveIntegration.js +7 -3
- package/dist/utils/resolveIntegration.js.map +1 -1
- package/dist/utils/resolveTemplateImport.d.ts +3 -0
- package/dist/utils/resolveTemplateImport.js +31 -0
- package/dist/utils/resolveTemplateImport.js.map +1 -0
- package/dist/utils/response.d.ts +3 -0
- package/dist/utils/response.js +24 -0
- package/dist/utils/response.js.map +1 -0
- package/dist/utils/saveIntegration.d.ts +8 -4
- package/dist/utils/saveIntegration.js +76 -34
- package/dist/utils/saveIntegration.js.map +1 -1
- package/dist/utils/token.js +1 -1
- package/dist/utils/token.js.map +1 -1
- package/dist/utils/url.d.ts +1 -0
- package/dist/utils/url.js +10 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/writeShadowElement.d.ts +26 -0
- package/dist/utils/writeShadowElement.js +119 -0
- package/dist/utils/writeShadowElement.js.map +1 -0
- package/dist/{value → values}/get.d.ts +1 -1
- package/dist/{value → values}/get.js +7 -8
- package/dist/values/get.js.map +1 -0
- package/dist/{value → values}/index.js +13 -1
- package/dist/values/index.js.map +1 -0
- package/dist/{value → values}/list.js +10 -9
- package/dist/values/list.js.map +1 -0
- package/dist/{value → values}/set.d.ts +1 -1
- package/dist/{value → values}/set.js +9 -9
- package/dist/values/set.js.map +1 -0
- package/dist/values/unset.d.ts +8 -0
- package/dist/values/unset.js +61 -0
- package/dist/values/unset.js.map +1 -0
- package/dist/whoami/fetchSession.d.ts +3 -3
- package/dist/whoami/fetchSession.js +2 -4
- package/dist/whoami/fetchSession.js.map +1 -1
- package/dist/whoami/index.d.ts +1 -1
- package/package.json +14 -14
- package/dist/create/account.d.ts +0 -2
- package/dist/create/account.js +0 -40
- package/dist/create/account.js.map +0 -1
- package/dist/create/integration.d.ts +0 -4
- package/dist/create/integration.js +0 -73
- package/dist/create/integration.js.map +0 -1
- package/dist/create/utils.d.ts +0 -4
- package/dist/create/utils.js +0 -8
- package/dist/create/utils.js.map +0 -1
- package/dist/generated/graphql.d.ts +0 -1867
- package/dist/generated/graphql.js.map +0 -1
- package/dist/integrations/describe.js +0 -51
- package/dist/integrations/describe.js.map +0 -1
- package/dist/projects/describe.d.ts +0 -5
- package/dist/projects/describe.js +0 -51
- package/dist/projects/describe.js.map +0 -1
- package/dist/projects/index.d.ts +0 -5
- package/dist/projects/index.js +0 -83
- package/dist/projects/index.js.map +0 -1
- package/dist/repl/fetchUserAndIntegration.d.ts +0 -10
- package/dist/repl/fetchUserAndIntegration.js +0 -73
- package/dist/repl/fetchUserAndIntegration.js.map +0 -1
- package/dist/utils/apiUrl.d.ts +0 -1
- package/dist/utils/apiUrl.js +0 -7
- package/dist/utils/apiUrl.js.map +0 -1
- package/dist/utils/callApi.d.ts +0 -5
- package/dist/utils/callApi.js +0 -17
- package/dist/utils/callApi.js.map +0 -1
- package/dist/utils/fetchAccount.d.ts +0 -10
- package/dist/utils/fetchAccount.js +0 -60
- package/dist/utils/fetchAccount.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/fetchUserAndIntegration.d.ts +0 -9
- package/dist/utils/fetchUserAndIntegration.js +0 -48
- package/dist/utils/fetchUserAndIntegration.js.map +0 -1
- package/dist/utils/graphqlRequestClient.d.ts +0 -10
- package/dist/utils/graphqlRequestClient.js +0 -20
- package/dist/utils/graphqlRequestClient.js.map +0 -1
- package/dist/utils/saveProject.d.ts +0 -8
- package/dist/utils/saveProject.js +0 -93
- package/dist/utils/saveProject.js.map +0 -1
- package/dist/utils/session.d.ts +0 -9
- package/dist/utils/session.js +0 -17
- package/dist/utils/session.js.map +0 -1
- package/dist/value/get.js.map +0 -1
- package/dist/value/index.js.map +0 -1
- package/dist/value/list.js.map +0 -1
- package/dist/value/set.js.map +0 -1
- /package/dist/{value → values}/index.d.ts +0 -0
- /package/dist/{value → values}/list.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
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,8BAAe,CAAA;IACf,gCAAi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D,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAiSD,MAAM,CAAN,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;AACvB,CAAC,EAHW,MAAM,KAAN,MAAM,QAGjB;AAiED,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,+BAAmB,CAAA;IACnB,yBAAa,CAAA;AACf,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import columnify from 'columnify';
|
|
3
|
-
import { gql } from 'graphql-tag';
|
|
4
|
-
import { createGraphQLClient, } from '../utils/graphqlClient.js';
|
|
5
|
-
import { handleGraphQLError } from '../utils/graphqlError.js';
|
|
6
|
-
const IntegrationQueryDocument = gql `
|
|
7
|
-
query Integration($id: ID!) {
|
|
8
|
-
integration(id: $id) {
|
|
9
|
-
id
|
|
10
|
-
name
|
|
11
|
-
description
|
|
12
|
-
status
|
|
13
|
-
createdAt
|
|
14
|
-
updatedAt
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
const prepareDetails = (integration) => ({
|
|
19
|
-
id: integration.id,
|
|
20
|
-
name: integration.name,
|
|
21
|
-
description: integration.description ?? '',
|
|
22
|
-
status: integration.status,
|
|
23
|
-
createdAt: integration.createdAt,
|
|
24
|
-
updatedAt: integration.updatedAt,
|
|
25
|
-
});
|
|
26
|
-
export const action = (log, apiToken, client) => async function integrationDescribe(integrationId) {
|
|
27
|
-
if (!integrationId) {
|
|
28
|
-
log(chalk.red('Integration id is required'));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const graphqlClient = client ?? createGraphQLClient(apiToken);
|
|
32
|
-
const result = await graphqlClient.request(IntegrationQueryDocument, { id: integrationId });
|
|
33
|
-
if (result.error) {
|
|
34
|
-
handleGraphQLError(result.error, log);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const integration = result.data?.integration;
|
|
38
|
-
if (integration) {
|
|
39
|
-
const details = prepareDetails(integration);
|
|
40
|
-
log(columnify(details, { columns: ['key', 'value'] }));
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
log(chalk.white('No integration.'));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export default (program, apiToken) => program
|
|
47
|
-
.command('describe')
|
|
48
|
-
.description('show integration details')
|
|
49
|
-
.argument('[integration]', 'id of the integration. if not given, the id of the local integration is used')
|
|
50
|
-
.action(action(console.log, apiToken));
|
|
51
|
-
//# sourceMappingURL=describe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/integrations/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EACL,mBAAmB,GAEpB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAI7D,MAAM,wBAAwB,GAAG,GAAG,CAAA;;;;;;;;;;;CAWnC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,WAOvB,EAAE,EAAE,CAAC,CAAC;IACL,EAAE,EAAE,WAAW,CAAC,EAAE;IAClB,IAAI,EAAE,WAAW,CAAC,IAAI;IACtB,WAAW,EAAE,WAAW,CAAC,WAAW,IAAI,EAAE;IAC1C,MAAM,EAAE,WAAW,CAAC,MAAM;IAC1B,SAAS,EAAE,WAAW,CAAC,SAAS;IAChC,SAAS,EAAE,WAAW,CAAC,SAAS;CACjC,CAAC,CAAA;AAEF,M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} from 'commander';
|
|
2
|
-
import type { Client } from 'urql';
|
|
3
|
-
export declare const action: (log: (message: string) => void, apiToken?: string, client?: Client) => (projectId?: string) => Promise<void>;
|
|
4
|
-
declare const _default: (program: Command, apiToken?: string) => Command;
|
|
5
|
-
export default _default;
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
const IntegrationQueryDocument = gql `
|
|
7
|
-
query Integration($id: ID!) {
|
|
8
|
-
integration(id: $id) {
|
|
9
|
-
id
|
|
10
|
-
name
|
|
11
|
-
description
|
|
12
|
-
status
|
|
13
|
-
createdAt
|
|
14
|
-
updatedAt
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
const prepareDetails = (integration) => ({
|
|
19
|
-
id: integration.id,
|
|
20
|
-
name: integration.name,
|
|
21
|
-
description: integration.description ?? '',
|
|
22
|
-
status: integration.status,
|
|
23
|
-
createdAt: integration.createdAt,
|
|
24
|
-
updatedAt: integration.updatedAt,
|
|
25
|
-
});
|
|
26
|
-
export const action = (log, apiToken, client) => async function projectDescribe(projectId) {
|
|
27
|
-
if (!projectId) {
|
|
28
|
-
log(chalk.red('Project ID is required'));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const graphqlClient = client ?? createGraphQLClient(apiToken);
|
|
32
|
-
const result = await graphqlClient.query(IntegrationQueryDocument, { id: projectId });
|
|
33
|
-
if (result.error) {
|
|
34
|
-
handleGraphQLError(result.error, log);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const integration = result.data?.integration;
|
|
38
|
-
if (integration) {
|
|
39
|
-
const details = prepareDetails(integration);
|
|
40
|
-
log(columnify(details, { columns: ['key', 'value'] }));
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
log(chalk.white('No project.'));
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
export default (program, apiToken) => program
|
|
47
|
-
.command('describe')
|
|
48
|
-
.description('show project details')
|
|
49
|
-
.argument('[project]', 'id of the project. if not given, the id of the local project is used')
|
|
50
|
-
.action(action(console.log, apiToken));
|
|
51
|
-
//# sourceMappingURL=describe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/projects/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAI7D,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,MAAM,wBAAwB,GAAG,GAAG,CAAA;;;;;;;;;;;CAWnC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,WAOvB,EAAE,EAAE,CAAC,CAAC;IACL,EAAE,EAAE,WAAW,CAAC,EAAE;IAClB,IAAI,EAAE,WAAW,CAAC,IAAI;IACtB,WAAW,EAAE,WAAW,CAAC,WAAW,IAAI,EAAE;IAC1C,MAAM,EAAE,WAAW,CAAC,MAAM;IAC1B,SAAS,EAAE,WAAW,CAAC,SAAS;IAChC,SAAS,EAAE,WAAW,CAAC,SAAS;CACjC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,GAA8B,EAC9B,QAAiB,EACjB,MAAe,EACf,EAAE,CACF,KAAK,UAAU,eAAe,CAAC,SAAkB;IAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAA;QACxC,OAAM;IACR,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAA;IAC7D,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,KAAK,CACtC,wBAAwB,EACxB,EAAE,EAAE,EAAE,SAAS,EAAE,CAClB,CAAA;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QACrC,OAAM;IACR,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,WAAW,CAAA;IAC5C,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,CAAC,CAAA;QAC3C,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAA;IACxD,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAA;IACjC,CAAC;AACH,CAAC,CAAA;AAEH,eAAe,CAAC,OAAgB,EAAE,QAAiB,EAAE,EAAE,CACrD,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,sBAAsB,CAAC;KACnC,QAAQ,CACP,WAAW,EACX,sEAAsE,CACvE;KACA,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA"}
|
package/dist/projects/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Command } from 'commander';
|
|
2
|
-
import type { Client } from 'urql';
|
|
3
|
-
export declare const action: (log: (message: string) => void, apiToken?: string, client?: Client) => (accountId?: string) => Promise<void>;
|
|
4
|
-
declare const _default: (program: Command, apiToken?: string) => void;
|
|
5
|
-
export default _default;
|
package/dist/projects/index.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
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 describe from './describe.js';
|
|
6
|
-
import { gql } from 'graphql-tag';
|
|
7
|
-
const IntegrationsQueryDocument = gql `
|
|
8
|
-
query Integrations {
|
|
9
|
-
integrations(orderBy: name, direction: asc) {
|
|
10
|
-
totalCount
|
|
11
|
-
nodes {
|
|
12
|
-
id
|
|
13
|
-
name
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
const IntegrationsForAccountQueryDocument = gql `
|
|
19
|
-
query IntegrationsForAccount($accountId: ID!) {
|
|
20
|
-
account(id: $accountId) {
|
|
21
|
-
integrations {
|
|
22
|
-
totalCount
|
|
23
|
-
nodes {
|
|
24
|
-
id
|
|
25
|
-
name
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
export const action = (log, apiToken, client) => async function projectList(accountId) {
|
|
32
|
-
const graphqlClient = client ?? createGraphQLClient(apiToken);
|
|
33
|
-
if (accountId) {
|
|
34
|
-
const result = await graphqlClient.query(IntegrationsForAccountQueryDocument, { accountId });
|
|
35
|
-
if (result.error) {
|
|
36
|
-
handleGraphQLError(result.error, log);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const projects = result.data?.account?.integrations?.nodes;
|
|
40
|
-
const count = result.data?.account?.integrations?.totalCount;
|
|
41
|
-
if (Array.isArray(projects) && projects.length > 0) {
|
|
42
|
-
log(columnify(projects, { columns: ['name', 'id'] }));
|
|
43
|
-
if (count) {
|
|
44
|
-
log(`\n${count} ${count === 1 ? 'project' : 'projects'}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
log(chalk.white('No projects.'));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
const result = await graphqlClient.query(IntegrationsQueryDocument, {});
|
|
53
|
-
if (result.error) {
|
|
54
|
-
handleGraphQLError(result.error, log);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const projects = result.data?.integrations?.nodes;
|
|
58
|
-
const count = result.data?.integrations?.totalCount;
|
|
59
|
-
if (Array.isArray(projects) && projects.length > 0) {
|
|
60
|
-
log(columnify(projects, { columns: ['name', 'id'] }));
|
|
61
|
-
if (count) {
|
|
62
|
-
log(`\n${count} ${count === 1 ? 'project' : 'projects'}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
log(chalk.white('No projects.'));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
export default (program, apiToken) => {
|
|
71
|
-
const projects = program
|
|
72
|
-
.command('projects')
|
|
73
|
-
.description('commands for projects, run `great projects --help` to see options. `great projects` is also a shortcut for `great projects list`')
|
|
74
|
-
.argument('[account]', 'id of an account to fetch projects for, or leave it out to fetch all projects')
|
|
75
|
-
.action(action(console.log, apiToken));
|
|
76
|
-
projects
|
|
77
|
-
.command('list')
|
|
78
|
-
.description('list all projects you have access to')
|
|
79
|
-
.argument('[account]', 'id of an account to fetch projects for, or leave it out to fetch all projects')
|
|
80
|
-
.action(action(console.log, apiToken));
|
|
81
|
-
describe(projects, apiToken);
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/projects/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,QAAQ,MAAM,eAAe,CAAA;AAOpC,OAAO,EAAE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AsC,CAAC;SACnD,QAAQ,CACP,WAAW,EACX,+EAA+E,CAChF;SACA,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA;IAExC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAC9B,CAAC,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type GraphQLRequestClient } from '../utils/graphqlClient.js';
|
|
2
|
-
export declare const UserAndIntegrationQueryDocument: import("graphql/index.js").DocumentNode;
|
|
3
|
-
export declare const UserAndIntegrationByKeyQueryDocument: import("graphql/index.js").DocumentNode;
|
|
4
|
-
export interface UserAndIntegrationResult {
|
|
5
|
-
integrationId: string;
|
|
6
|
-
integrationName?: string;
|
|
7
|
-
userName?: string;
|
|
8
|
-
error?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function fetchUserAndIntegration(identifier: string, accountId: string | undefined, apiToken?: string, client?: GraphQLRequestClient): Promise<UserAndIntegrationResult>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { createGraphQLClient, } from '../utils/graphqlClient.js';
|
|
3
|
-
export const UserAndIntegrationQueryDocument = gql `
|
|
4
|
-
query UserAndIntegration($id: ID!) {
|
|
5
|
-
session {
|
|
6
|
-
user {
|
|
7
|
-
id
|
|
8
|
-
name
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
integration(id: $id) {
|
|
12
|
-
id
|
|
13
|
-
name
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
export const UserAndIntegrationByKeyQueryDocument = gql `
|
|
18
|
-
query UserAndIntegrationByKey($accountId: ID!, $key: ID!) {
|
|
19
|
-
session {
|
|
20
|
-
user {
|
|
21
|
-
id
|
|
22
|
-
name
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
integrationByKey(accountId: $accountId, key: $key) {
|
|
26
|
-
id
|
|
27
|
-
name
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
export async function fetchUserAndIntegration(identifier, accountId, apiToken, client) {
|
|
32
|
-
const graphqlClient = client ?? createGraphQLClient(apiToken);
|
|
33
|
-
try {
|
|
34
|
-
if (accountId) {
|
|
35
|
-
const result = await graphqlClient.request(UserAndIntegrationByKeyQueryDocument, { accountId, key: identifier });
|
|
36
|
-
const integration = result.data?.integrationByKey;
|
|
37
|
-
if (!integration) {
|
|
38
|
-
return {
|
|
39
|
-
integrationId: '',
|
|
40
|
-
error: `Integration with key "${identifier}" not found in account "${accountId}"`,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
integrationId: integration.id,
|
|
45
|
-
integrationName: integration.name,
|
|
46
|
-
userName: result.data?.session?.user?.name,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const result = await graphqlClient.request(UserAndIntegrationQueryDocument, { id: identifier });
|
|
51
|
-
const integration = result.data?.integration;
|
|
52
|
-
if (!integration) {
|
|
53
|
-
return {
|
|
54
|
-
integrationId: '',
|
|
55
|
-
error: `Integration with id "${identifier}" not found`,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
integrationId: integration.id,
|
|
60
|
-
integrationName: integration.name,
|
|
61
|
-
userName: result.data?.session?.user?.name,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
67
|
-
return {
|
|
68
|
-
integrationId: '',
|
|
69
|
-
error: `Could not fetch integration: ${errorMessage}`,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=fetchUserAndIntegration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchUserAndIntegration.js","sourceRoot":"","sources":["../../src/repl/fet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CAAC;gBACjB,OAAO;oBACL,aAAa,EAAE,EAAE;oBACjB,KAAK,EAAE,wBAAwB,UAAU,aAAa;iBACvD,CAAA;YACH,CAAC;YAED,OAAO;gBACL,aAAa,EAAE,WAAW,CAAC,EAAE;gBAC7B,eAAe,EAAE,WAAW,CAAC,IAAI;gBACjC,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;aAC3C,CAAA;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3E,OAAO;YACL,aAAa,EAAE,EAAE;YACjB,KAAK,EAAE,gCAAgC,YAAY,EAAE;SACtD,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/dist/utils/apiUrl.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getApiUrl(path: string, baseUrl?: string): string;
|
package/dist/utils/apiUrl.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { getApiBaseUrl } from './config.js';
|
|
2
|
-
export function getApiUrl(path, baseUrl) {
|
|
3
|
-
const api = baseUrl ?? getApiBaseUrl();
|
|
4
|
-
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
5
|
-
return `${api}${normalizedPath}`;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=apiUrl.js.map
|
package/dist/utils/apiUrl.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiUrl.js","sourceRoot":"","sources":["../../src/utils/apiUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,OAAgB;IACtD,MAAM,GAAG,GAAG,OAAO,IAAI,aAAa,EAAE,CAAA;IAEtC,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAA;IAC/D,OAAO,GAAG,GAAG,GAAG,cAAc,EAAE,CAAA;AAClC,CAAC"}
|
package/dist/utils/callApi.d.ts
DELETED
package/dist/utils/callApi.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import ky from 'ky';
|
|
2
|
-
export default async function callApi(uri, token) {
|
|
3
|
-
if (!token) {
|
|
4
|
-
return {
|
|
5
|
-
status: 'noaccess',
|
|
6
|
-
error: 'Not logged in. Run `great login`',
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
const response = await ky
|
|
10
|
-
.get(uri, {
|
|
11
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
12
|
-
throwHttpErrors: false,
|
|
13
|
-
})
|
|
14
|
-
.json();
|
|
15
|
-
return response;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=callApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callApi.js","sourceRoot":"","sources":["../../src/utils/callApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AAOnB,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,OAAO,CACnC,GAAW,EACX,KAAc;IAEd,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,KAAK,EAAE,kCAAkC;SACrC,CAAA;IACR,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,EAAE;SACtB,GAAG,CAAC,GAAG,EAAE;QACR,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;QAC7C,eAAe,EAAE,KAAK;KACvB,CAAC;SACD,IAAI,EAAK,CAAA;IACZ,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type GraphQLRequestClient } from './graphqlClient.js';
|
|
2
|
-
export interface AccountResult {
|
|
3
|
-
account?: {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
key: string;
|
|
7
|
-
};
|
|
8
|
-
error?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function fetchAccount(accountId: string, apiToken?: string, client?: GraphQLRequestClient, baseUrl?: string): Promise<AccountResult>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { createGraphQLClient, } from './graphqlClient.js';
|
|
3
|
-
const AccountByIdQueryDocument = gql `
|
|
4
|
-
query AccountById($id: ID!) {
|
|
5
|
-
account(id: $id) {
|
|
6
|
-
id
|
|
7
|
-
name
|
|
8
|
-
key
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
12
|
-
const AccountByKeyQueryDocument = gql `
|
|
13
|
-
query AccountByKey($key: ID!) {
|
|
14
|
-
accountByKey(key: $key) {
|
|
15
|
-
id
|
|
16
|
-
name
|
|
17
|
-
key
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
function isNotFoundError(error) {
|
|
22
|
-
const errorWithResponse = error;
|
|
23
|
-
if (errorWithResponse.response?.errors) {
|
|
24
|
-
return errorWithResponse.response.errors.some((err) => err.extensions?.code === 'NOT_FOUND');
|
|
25
|
-
}
|
|
26
|
-
return error?.message?.includes('NOT_FOUND');
|
|
27
|
-
}
|
|
28
|
-
export async function fetchAccount(accountId, apiToken, client, baseUrl) {
|
|
29
|
-
const graphqlClient = client ?? createGraphQLClient(apiToken, baseUrl);
|
|
30
|
-
try {
|
|
31
|
-
const idResult = await graphqlClient.request(AccountByIdQueryDocument, { id: accountId });
|
|
32
|
-
if (idResult.error && !isNotFoundError(idResult.error)) {
|
|
33
|
-
return {
|
|
34
|
-
error: `Could not fetch account: ${idResult.error.message}`,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
if (idResult.data?.account) {
|
|
38
|
-
return { account: idResult.data.account };
|
|
39
|
-
}
|
|
40
|
-
const keyResult = await graphqlClient.request(AccountByKeyQueryDocument, { key: accountId });
|
|
41
|
-
if (keyResult.error && !isNotFoundError(keyResult.error)) {
|
|
42
|
-
return {
|
|
43
|
-
error: `Could not fetch account: ${keyResult.error.message}`,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
if (keyResult.data?.accountByKey) {
|
|
47
|
-
return { account: keyResult.data.accountByKey };
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
error: `Account "${accountId}" not found`,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
55
|
-
return {
|
|
56
|
-
error: `Could not fetch account: ${errorMessage}`,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=fetchAccount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchAccount.js","sourceRoot":"","sources":["../../src/utils/fetchAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EACL,mBAAmB,GAEpB,MAAM,oBAAoB,CAAA;AAM3B,MAAM,wBAAwB,GAAG,GAAG,CAAA;;;;;;;;CAQnC,CAAA;AAED,MAAM,yBAAyB,GAAG,GAAG,CAAA;;;;;;;;CAQpC,CAAA;AAWD,SAAS,eAAe,CAAC,KAAY;IAEnC,MAAM,iBAAiB,GAAG,KAIzB,CAAA;IAED,IAAI,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QACvC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAC3C,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,KAAK,WAAW,CAC9C,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A;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3E,OAAO;YACL,KAAK,EAAE,4BAA4B,YAAY,EAAE;SAClD,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function fetchIdFromIndex(): any;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
export function fetchIdFromIndex() {
|
|
3
|
-
try {
|
|
4
|
-
const content = fs.readFileSync('index.json', 'utf8');
|
|
5
|
-
const index = JSON.parse(content);
|
|
6
|
-
return index.id;
|
|
7
|
-
}
|
|
8
|
-
catch {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=fetchLocalProject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchLocalProject.js","sourceRoot":"","sources":["../../src/utils/fetchLocalProject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AAExB,MAAM,UAAU,gBAAgB;IAC9B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjC,OAAO,KAAK,CAAC,EAAE,CAAA;IACjB,CAAC;IAAC,MAAM,CAAC;QAEP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type GraphQLRequestClient } from './graphqlClient.js';
|
|
2
|
-
export declare const SessionQueryDocument: import("graphql/index.js").DocumentNode;
|
|
3
|
-
export interface UserAndIntegrationResult {
|
|
4
|
-
integrationId: string;
|
|
5
|
-
integrationName?: string;
|
|
6
|
-
userName?: string;
|
|
7
|
-
error?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function fetchUserAndIntegration(identifier: string, accountId: string | undefined, apiToken?: string, client?: GraphQLRequestClient, baseUrl?: string): Promise<UserAndIntegrationResult>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-tag';
|
|
2
|
-
import { createGraphQLClient, } from './graphqlClient.js';
|
|
3
|
-
import { resolveIntegration } from './resolveIntegration.js';
|
|
4
|
-
export const SessionQueryDocument = gql `
|
|
5
|
-
query Session {
|
|
6
|
-
session {
|
|
7
|
-
user {
|
|
8
|
-
id
|
|
9
|
-
name
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
export async function fetchUserAndIntegration(identifier, accountId, apiToken, client, baseUrl) {
|
|
15
|
-
const graphqlClient = client ?? createGraphQLClient(apiToken, baseUrl);
|
|
16
|
-
const integrationResult = await resolveIntegration(identifier, accountId, apiToken, client, baseUrl);
|
|
17
|
-
if (integrationResult.error) {
|
|
18
|
-
return {
|
|
19
|
-
integrationId: '',
|
|
20
|
-
error: integrationResult.error,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
const sessionResult = await graphqlClient.request(SessionQueryDocument, {});
|
|
25
|
-
if (sessionResult.error) {
|
|
26
|
-
const errorMessage = sessionResult.error.message || String(sessionResult.error);
|
|
27
|
-
return {
|
|
28
|
-
integrationId: integrationResult.integrationId,
|
|
29
|
-
integrationName: integrationResult.integrationName,
|
|
30
|
-
error: errorMessage,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
integrationId: integrationResult.integrationId,
|
|
35
|
-
integrationName: integrationResult.integrationName,
|
|
36
|
-
userName: sessionResult.data?.session?.user?.name,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
41
|
-
return {
|
|
42
|
-
integrationId: integrationResult.integrationId,
|
|
43
|
-
integrationName: integrationResult.integrationName,
|
|
44
|
-
error: `Could not fetch session: ${errorMessage}`,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=fetchUserAndIntegration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchUserAndIntegration.js","sourceRoot":"","sources":["../../src/utils/fetchUserAndIntegration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,OAAO,EACL,mBAAmB,GAEpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;;;;;;;;;CAStC,CAAA;AASD,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,UAAkB,EAClB,SAA6B,EAC7B,QAAiB,EACjB,MAA6B,EAC7B,OAAgB;IAEhB,MAAM,aAAa,GAAG,MAAM,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAGtE,MAAM,iBAAiB,GAAG,MAAM,kBAAkB,CAChD,UAAU,EACV,SAAS,EACT,QAAQ,EACR,MAAM,EACN,OAAO,CACR,CAAA;IAGD,IAAI,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC5B,OAAO;YACL,aAAa,EAAE,EAAE;YACjB,KAAK,EAAE,iBAAiB,CAAC,KAAK;SAC/B,CAAA;IACH,CAAC;IAGD,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,OAAO,CAC/C,oBAAoB,EACpB,EAAE,CACH,CAAA;QAGD,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;YACxB,MAAM,YAAY,GAChB,aAAa,CAAC,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;YAC5D,OAAO;gBACL,aAAa,EAAE,iBAAiB,CAAC,aAAa;gBAC9C,eAAe,EAAE,iBAAiB,CAAC,eAAe;gBAClD,KAAK,EAAE,YAAY;aACpB,CAAA;QACH,CAAC;QAED,OAAO;YACL,aAAa,EAAE,iBAAiB,CAAC,aAAa;YAC9C,eAAe,EAAE,iBAAiB,CAAC,eAAe;YAClD,QAAQ,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;SAClD,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3E,OAAO;YACL,aAAa,EAAE,iBAAiB,CAAC,aAAa;YAC9C,eAAe,EAAE,iBAAiB,CAAC,eAAe;YAClD,KAAK,EAAE,4BAA4B,YAAY,EAAE;SAClD,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { RequestDocument, Variables } from 'graphql-request';
|
|
2
|
-
interface RequestResult<T> {
|
|
3
|
-
data?: T;
|
|
4
|
-
error?: Error;
|
|
5
|
-
}
|
|
6
|
-
export interface GraphQLRequestClient {
|
|
7
|
-
request: <T, V extends Variables = Variables>(document: RequestDocument, variables: V) => Promise<RequestResult<T>>;
|
|
8
|
-
}
|
|
9
|
-
export declare function createGraphQLRequestClient(token?: string): GraphQLRequestClient;
|
|
10
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GraphQLClient } from 'graphql-request';
|
|
2
|
-
import { getApiBaseUrl } from './config.js';
|
|
3
|
-
export function createGraphQLRequestClient(token) {
|
|
4
|
-
const graphQLUrl = `${getApiBaseUrl()}/graphql`;
|
|
5
|
-
const client = new GraphQLClient(graphQLUrl, {
|
|
6
|
-
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
|
7
|
-
});
|
|
8
|
-
return {
|
|
9
|
-
request: async (document, variables) => {
|
|
10
|
-
try {
|
|
11
|
-
const data = await client.request(document, variables);
|
|
12
|
-
return { data };
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
return { error: error };
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=graphqlRequestClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphqlRequestClient.js","sourceRoot":"","sources":["../../src/utils/graphqlRequestClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAe3C,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,MAAM,UAAU,GAAG,GAAG,aAAa,EAAE,UAAU,CAAA;IAE/C,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,UAAU,EAAE;QAC3C,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;KAC3D,CAAC,CAAA;IAEF,OAAO;QACL,OAAO,EAAE,KAAK,EACZ,QAAyB,EACzB,SAAY,EACe,EAAE;YAC7B,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAI,QAAQ,EAAE,SAAS,CAAC,CAAA;gBACzD,OAAO,EAAE,IAAI,EAAE,CAAA;YACjB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,EAAE,KAAK,EAAE,KAAc,EAAE,CAAA;YAClC,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import type { IntegrationDefinitionQuery } from '../generated/graphql.js';
|
|
3
|
-
export type FileSystem = Pick<typeof fs, 'writeFileSync' | 'mkdirSync' | 'existsSync'>;
|
|
4
|
-
type Integration = NonNullable<IntegrationDefinitionQuery['integration']>;
|
|
5
|
-
type ActiveVersion = NonNullable<Integration['active']>;
|
|
6
|
-
type IntegrationMeta = Pick<Integration, 'id' | 'name' | 'description' | 'status'>;
|
|
7
|
-
export default function saveProject(integration: IntegrationMeta, active: ActiveVersion, root?: string, fsImpl?: FileSystem): void;
|
|
8
|
-
export {};
|