@prismatic-io/prism 5.2.10 → 6.0.0-preview1
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/lib/index.js +32973 -5
- package/lib/run.js +365 -0
- package/lib/templates/action/action.ts.ejs +33 -0
- package/lib/templates/component/assets/icon.png.ejs +0 -0
- package/lib/templates/component/jest.config.js.ejs +4 -0
- package/lib/templates/component/package.json.ejs +6 -0
- package/lib/templates/component/src/client.ts.ejs +10 -0
- package/lib/templates/component/src/index.test.ts.ejs +47 -0
- package/lib/templates/component/src/index.ts.ejs +19 -0
- package/lib/templates/component/tsconfig.json.ejs +12 -0
- package/lib/templates/component/webpack.config.js.ejs +36 -0
- package/lib/templates/connection/basic.ts.ejs +25 -0
- package/lib/templates/connection/oauth.ts.ejs +65 -0
- package/lib/templates/dataSource/dataSource.ts.ejs +34 -0
- package/lib/templates/flow/flow.ts.ejs +37 -0
- package/lib/templates/formats/assets/icon.png.ejs +0 -0
- package/lib/templates/formats/jest.config.js.ejs +4 -0
- package/lib/templates/formats/tsconfig.json.ejs +12 -0
- package/lib/templates/formats/webpack.config.js.ejs +36 -0
- package/lib/templates/integration/assets/icon.png.ejs +0 -0
- package/lib/templates/integration/basic.ts.ejs +29 -0
- package/lib/templates/integration/jest.config.js.ejs +4 -0
- package/lib/templates/integration/oauth.ts.ejs +69 -0
- package/lib/templates/integration/package.json.ejs +6 -0
- package/lib/templates/integration/src/client.ts.ejs +10 -0
- package/lib/templates/integration/src/index.test.ts.ejs +18 -0
- package/lib/templates/integration/src/index.ts.ejs +11 -0
- package/lib/templates/integration/tsconfig.json.ejs +12 -0
- package/lib/templates/integration/webpack.config.js.ejs +36 -0
- package/lib/templates/trigger/trigger.ts.ejs +19 -0
- package/oclif.manifest.json +3153 -2451
- package/package.json +56 -60
- package/bin/run +0 -12
- package/lib/auth.js +0 -323
- package/lib/commands/alerts/events/list.js +0 -56
- package/lib/commands/alerts/groups/create.js +0 -58
- package/lib/commands/alerts/groups/delete.js +0 -35
- package/lib/commands/alerts/groups/list.js +0 -44
- package/lib/commands/alerts/monitors/clear.js +0 -35
- package/lib/commands/alerts/monitors/create.js +0 -102
- package/lib/commands/alerts/monitors/delete.js +0 -35
- package/lib/commands/alerts/monitors/list.js +0 -63
- package/lib/commands/alerts/triggers/list.js +0 -31
- package/lib/commands/alerts/webhooks/create.js +0 -67
- package/lib/commands/alerts/webhooks/delete.js +0 -35
- package/lib/commands/alerts/webhooks/list.js +0 -57
- package/lib/commands/components/actions/list.js +0 -96
- package/lib/commands/components/data-sources/list.js +0 -114
- package/lib/commands/components/delete.js +0 -35
- package/lib/commands/components/dev/run.js +0 -83
- package/lib/commands/components/dev/test.js +0 -266
- package/lib/commands/components/init/action.js +0 -12
- package/lib/commands/components/init/component.js +0 -12
- package/lib/commands/components/init/connection.js +0 -12
- package/lib/commands/components/init/dataSource.js +0 -12
- package/lib/commands/components/init/index.js +0 -126
- package/lib/commands/components/init/trigger.js +0 -12
- package/lib/commands/components/list.js +0 -95
- package/lib/commands/components/publish.js +0 -62
- package/lib/commands/components/triggers/list.js +0 -96
- package/lib/commands/customers/create.js +0 -72
- package/lib/commands/customers/credentials/create.js +0 -68
- package/lib/commands/customers/credentials/delete.js +0 -35
- package/lib/commands/customers/credentials/list.js +0 -56
- package/lib/commands/customers/credentials/update.js +0 -58
- package/lib/commands/customers/delete.js +0 -35
- package/lib/commands/customers/list.js +0 -51
- package/lib/commands/customers/update.js +0 -82
- package/lib/commands/customers/users/create.js +0 -67
- package/lib/commands/customers/users/delete.js +0 -35
- package/lib/commands/customers/users/list.js +0 -65
- package/lib/commands/customers/users/roles.js +0 -33
- package/lib/commands/customers/users/update.js +0 -76
- package/lib/commands/executions/step-result/get.js +0 -73
- package/lib/commands/instances/config-vars/list.js +0 -83
- package/lib/commands/instances/create.js +0 -84
- package/lib/commands/instances/delete.js +0 -35
- package/lib/commands/instances/deploy.js +0 -43
- package/lib/commands/instances/disable.js +0 -36
- package/lib/commands/instances/enable.js +0 -36
- package/lib/commands/instances/flow-configs/list.js +0 -62
- package/lib/commands/instances/flow-configs/test.js +0 -127
- package/lib/commands/instances/list.js +0 -86
- package/lib/commands/instances/update.js +0 -99
- package/lib/commands/integrations/available.js +0 -47
- package/lib/commands/integrations/create.js +0 -58
- package/lib/commands/integrations/delete.js +0 -35
- package/lib/commands/integrations/export.js +0 -29
- package/lib/commands/integrations/flows/list.js +0 -61
- package/lib/commands/integrations/flows/test.js +0 -124
- package/lib/commands/integrations/fork.js +0 -56
- package/lib/commands/integrations/import.js +0 -54
- package/lib/commands/integrations/init/flow.js +0 -12
- package/lib/commands/integrations/init/index.js +0 -45
- package/lib/commands/integrations/init/integration.js +0 -12
- package/lib/commands/integrations/list.js +0 -96
- package/lib/commands/integrations/marketplace.js +0 -80
- package/lib/commands/integrations/open.js +0 -18
- package/lib/commands/integrations/publish.js +0 -44
- package/lib/commands/integrations/update.js +0 -75
- package/lib/commands/integrations/versions/index.js +0 -83
- package/lib/commands/login.js +0 -33
- package/lib/commands/logout.js +0 -23
- package/lib/commands/logs/severities/list.js +0 -29
- package/lib/commands/me/index.js +0 -22
- package/lib/commands/me/token/revoke.js +0 -12
- package/lib/commands/me/token.js +0 -25
- package/lib/commands/on-prem-resources/delete.js +0 -35
- package/lib/commands/on-prem-resources/list.js +0 -69
- package/lib/commands/on-prem-resources/registration-jwt.js +0 -81
- package/lib/commands/organization/credentials/create.js +0 -60
- package/lib/commands/organization/credentials/delete.js +0 -35
- package/lib/commands/organization/credentials/list.js +0 -45
- package/lib/commands/organization/credentials/update.js +0 -58
- package/lib/commands/organization/signingKeys/delete.js +0 -35
- package/lib/commands/organization/signingKeys/generate.js +0 -22
- package/lib/commands/organization/signingKeys/import.js +0 -40
- package/lib/commands/organization/signingKeys/list.js +0 -36
- package/lib/commands/organization/update.js +0 -37
- package/lib/commands/organization/updateAvatarUrl.js +0 -47
- package/lib/commands/organization/users/create.js +0 -51
- package/lib/commands/organization/users/delete.js +0 -35
- package/lib/commands/organization/users/list.js +0 -60
- package/lib/commands/organization/users/roles.js +0 -33
- package/lib/commands/organization/users/update.js +0 -66
- package/lib/commands/translations/list.js +0 -35
- package/lib/config.js +0 -39
- package/lib/errors.js +0 -55
- package/lib/fields.js +0 -12
- package/lib/fs.js +0 -23
- package/lib/generate/action.js +0 -208
- package/lib/generate/index.js +0 -54
- package/lib/generate/input.js +0 -93
- package/lib/generate/parse.js +0 -59
- package/lib/generate/sourceFile.js +0 -90
- package/lib/generate/util.js +0 -17
- package/lib/graphql.js +0 -42
- package/lib/queries.graphql.js +0 -43
- package/lib/types.js +0 -6
- package/lib/utils/avatar.js +0 -48
- package/lib/utils/component/deleteByKey.js +0 -36
- package/lib/utils/component/publish.js +0 -247
- package/lib/utils/component/query.js +0 -23
- package/lib/utils/date.js +0 -14
- package/lib/utils/execution/logs.js +0 -86
- package/lib/utils/execution/stepResults.js +0 -87
- package/lib/utils/generate.js +0 -50
- package/lib/utils/import.js +0 -21
- package/lib/utils/integration/definition.js +0 -101
- package/lib/utils/integration/export.js +0 -36
- package/lib/utils/integration/import.js +0 -179
- package/lib/utils/integration/invoke.js +0 -81
- package/lib/utils/integration/open.js +0 -37
- package/lib/utils/integration/query.js +0 -59
- package/lib/utils/process.js +0 -15
- package/lib/utils/serialize.js +0 -8
- package/lib/utils/translations/processDataForTranslations.js +0 -132
- package/lib/utils/user/query.js +0 -26
- package/lib/yeoman.js +0 -27
- /package/{bin → lib}/run.cmd +0 -0
package/lib/generate/input.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.writeInputs = exports.getActionMethodInputProperties = void 0;
|
|
7
|
-
const ts_morph_1 = require("ts-morph");
|
|
8
|
-
const camelcase_1 = __importDefault(require("camelcase"));
|
|
9
|
-
const getActionMethodInputProperties = (parameter, parameterTypeDefinition) => {
|
|
10
|
-
const paramName = parameter.getName();
|
|
11
|
-
const propertyStructures = [];
|
|
12
|
-
if (parameterTypeDefinition) {
|
|
13
|
-
const paramDefinition = parameterTypeDefinition.getInterfaceOrThrow((0, camelcase_1.default)(!paramName.includes("Param") ? paramName : paramName.split("Param")[0], { pascalCase: true }));
|
|
14
|
-
const paramProperties = paramDefinition.getProperties();
|
|
15
|
-
paramProperties.forEach((property) => {
|
|
16
|
-
// If its a single numeric the import of the input field will fail
|
|
17
|
-
// Assume single character inputs just suck
|
|
18
|
-
// and set it as a modified field
|
|
19
|
-
const [propertyName, modified] = property.getName().length !== 1
|
|
20
|
-
? [property.getName(), false]
|
|
21
|
-
: [`param${property.getName()}`, true];
|
|
22
|
-
const propertyType = property.getType().getText(property);
|
|
23
|
-
const propertyStructure = {
|
|
24
|
-
propertyName,
|
|
25
|
-
modified,
|
|
26
|
-
originalName: property.getName(),
|
|
27
|
-
type: ["string", "boolean"].includes(propertyType)
|
|
28
|
-
? propertyType
|
|
29
|
-
: "data",
|
|
30
|
-
required: property.getType().isNullable(),
|
|
31
|
-
inputFieldName: propertyName,
|
|
32
|
-
};
|
|
33
|
-
propertyStructures.push(propertyStructure);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
const propertyType = parameter.getType().getText(parameter);
|
|
38
|
-
const propertyStructure = {
|
|
39
|
-
propertyName: parameter.getName(),
|
|
40
|
-
modified: false,
|
|
41
|
-
originalName: parameter.getName(),
|
|
42
|
-
type: ["string", "boolean"].includes(propertyType)
|
|
43
|
-
? propertyType
|
|
44
|
-
: "data",
|
|
45
|
-
required: parameter.getType().isNullable(),
|
|
46
|
-
inputFieldName: `${parameter.getName()}InputField`,
|
|
47
|
-
};
|
|
48
|
-
propertyStructures.push(propertyStructure);
|
|
49
|
-
}
|
|
50
|
-
return propertyStructures;
|
|
51
|
-
};
|
|
52
|
-
exports.getActionMethodInputProperties = getActionMethodInputProperties;
|
|
53
|
-
const writeInputs = async ({ inputsFile }, inputs) => {
|
|
54
|
-
inputs.forEach((propertyStructure) => {
|
|
55
|
-
const placeholder = inputsFile.addVariableStatement({
|
|
56
|
-
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
57
|
-
declarations: [
|
|
58
|
-
{ name: "genericActionInput", initializer: ts_morph_1.Writers.object({}) },
|
|
59
|
-
],
|
|
60
|
-
});
|
|
61
|
-
const object = placeholder
|
|
62
|
-
.getDeclarations()[0]
|
|
63
|
-
.getInitializer();
|
|
64
|
-
object.addPropertyAssignments([
|
|
65
|
-
{
|
|
66
|
-
name: "label",
|
|
67
|
-
initializer: `"${(0, camelcase_1.default)(propertyStructure.propertyName, {
|
|
68
|
-
pascalCase: true,
|
|
69
|
-
})}"`,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: "type",
|
|
73
|
-
initializer: `"${propertyStructure.type}"`,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "required",
|
|
77
|
-
initializer: `${propertyStructure.required}`,
|
|
78
|
-
},
|
|
79
|
-
]);
|
|
80
|
-
inputsFile.addVariableStatement({
|
|
81
|
-
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
82
|
-
declarations: [
|
|
83
|
-
{
|
|
84
|
-
name: propertyStructure.propertyName,
|
|
85
|
-
initializer: `input(${object.print()})`,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
isExported: true,
|
|
89
|
-
});
|
|
90
|
-
placeholder.remove();
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
exports.writeInputs = writeInputs;
|
package/lib/generate/parse.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getActionMethods = exports.getParamTypeDefinition = void 0;
|
|
30
|
-
const path = __importStar(require("path"));
|
|
31
|
-
const camelcase_1 = __importDefault(require("camelcase"));
|
|
32
|
-
const getWSDLClientMethods = (clientPath, clientInterface, componentProject) => {
|
|
33
|
-
try {
|
|
34
|
-
const wsdlClientSource = componentProject.getSourceFileOrThrow(clientPath);
|
|
35
|
-
// Gather all the methods being translated to actions
|
|
36
|
-
const wsdlClientInterface = wsdlClientSource.getInterfaceOrThrow(clientInterface);
|
|
37
|
-
return wsdlClientInterface === null || wsdlClientInterface === void 0 ? void 0 : wsdlClientInterface.getMethods();
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
console.error("Unable to find methods for Action Generation.");
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const getParamTypeDefinition = (project, parameter) => {
|
|
45
|
-
const { componentProject, projectRoot, definitionDirectory } = project;
|
|
46
|
-
const paramName = parameter.getName();
|
|
47
|
-
return componentProject.getSourceFile(path.join(projectRoot, definitionDirectory, "definitions", `${(0, camelcase_1.default)(!paramName.includes("Param") ? paramName : paramName.split("Param")[0], {
|
|
48
|
-
pascalCase: true,
|
|
49
|
-
})}.ts`));
|
|
50
|
-
};
|
|
51
|
-
exports.getParamTypeDefinition = getParamTypeDefinition;
|
|
52
|
-
// Gather the methods that will be translated to actions
|
|
53
|
-
const getActionMethods = (projectStructure) => {
|
|
54
|
-
const { projectRoot, componentProject, projectTemplateName, definitionDirectory, } = projectStructure;
|
|
55
|
-
return {
|
|
56
|
-
createClientAsync: getWSDLClientMethods(path.join(projectRoot, definitionDirectory, "client.ts"), `${(0, camelcase_1.default)(projectTemplateName, { pascalCase: true })}Client`, componentProject),
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
exports.getActionMethods = getActionMethods;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.initializeProject = void 0;
|
|
30
|
-
const camelcase_1 = __importDefault(require("camelcase"));
|
|
31
|
-
const ts_morph_1 = require("ts-morph");
|
|
32
|
-
const path = __importStar(require("path"));
|
|
33
|
-
const initializeActionFile = (componentProject, projectRoot) => {
|
|
34
|
-
const actionFile = componentProject.createSourceFile(path.join(projectRoot, "src", "actions.ts"), undefined, { overwrite: true });
|
|
35
|
-
actionFile.addImportDeclaration({
|
|
36
|
-
moduleSpecifier: "@prismatic-io/spectral",
|
|
37
|
-
namedImports: [{ name: "action" }],
|
|
38
|
-
});
|
|
39
|
-
return actionFile;
|
|
40
|
-
};
|
|
41
|
-
const initializeInputsFile = (componentProject, projectRoot) => {
|
|
42
|
-
const inputsFile = componentProject.createSourceFile(path.join(projectRoot, "src", "inputs.ts"), undefined, { overwrite: true });
|
|
43
|
-
inputsFile.addImportDeclaration({
|
|
44
|
-
moduleSpecifier: "@prismatic-io/spectral",
|
|
45
|
-
namedImports: [{ name: "input" }],
|
|
46
|
-
});
|
|
47
|
-
return inputsFile;
|
|
48
|
-
};
|
|
49
|
-
const copyTemplateFileToProject = (componentProject, projectRoot, projectTemplatePath, fileName) => {
|
|
50
|
-
componentProject.addSourceFileAtPath(projectTemplatePath);
|
|
51
|
-
const templateFile = componentProject.getSourceFileOrThrow(projectTemplatePath);
|
|
52
|
-
templateFile.copy(path.join(process.cwd(), projectRoot, fileName));
|
|
53
|
-
};
|
|
54
|
-
const initializeWSDL = ({ projectRoot, projectTemplateName, projectTemplatePath, componentProject, actionFile, }) => {
|
|
55
|
-
const wsdlProjectLocation = path.join(projectRoot, `${projectTemplateName}.wsdl`);
|
|
56
|
-
// Copy the wsdl used for generation to the project root
|
|
57
|
-
copyTemplateFileToProject(componentProject, projectRoot, projectTemplatePath, `${projectTemplateName}.wsdl`);
|
|
58
|
-
actionFile.addImportDeclaration({
|
|
59
|
-
defaultImport: `* as path`,
|
|
60
|
-
moduleSpecifier: "path",
|
|
61
|
-
});
|
|
62
|
-
// Return the relative path of the WSDL
|
|
63
|
-
return path.relative(path.join(projectRoot, "src"), wsdlProjectLocation);
|
|
64
|
-
};
|
|
65
|
-
const projectTypeSetup = (project) => {
|
|
66
|
-
const wsdlPath = initializeWSDL(project);
|
|
67
|
-
// Update the WSDL Path to be in our component project
|
|
68
|
-
project.projectTemplatePath = wsdlPath;
|
|
69
|
-
};
|
|
70
|
-
const initializeProject = (projectRoot, projectTemplateName, projectTemplatePath) => {
|
|
71
|
-
const componentProject = new ts_morph_1.Project({
|
|
72
|
-
tsConfigFilePath: path.join(projectRoot, "tsconfig.json"),
|
|
73
|
-
});
|
|
74
|
-
componentProject.addSourceFilesAtPaths(path.join(projectRoot, "**/*"));
|
|
75
|
-
const actionFile = initializeActionFile(componentProject, projectRoot);
|
|
76
|
-
const inputsFile = initializeInputsFile(componentProject, projectRoot);
|
|
77
|
-
const project = {
|
|
78
|
-
projectRoot,
|
|
79
|
-
projectTemplateName: (0, camelcase_1.default)(projectTemplateName),
|
|
80
|
-
definitionDirectory: (0, camelcase_1.default)(projectTemplateName).toLowerCase(),
|
|
81
|
-
projectTemplatePath,
|
|
82
|
-
componentProject,
|
|
83
|
-
actionFile,
|
|
84
|
-
inputsFile,
|
|
85
|
-
};
|
|
86
|
-
// Setup type specific project details
|
|
87
|
-
projectTypeSetup(project);
|
|
88
|
-
return project;
|
|
89
|
-
};
|
|
90
|
-
exports.initializeProject = initializeProject;
|
package/lib/generate/util.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createDescription = void 0;
|
|
7
|
-
const striptags_1 = __importDefault(require("striptags"));
|
|
8
|
-
const createDescription = (text) => {
|
|
9
|
-
if (!text) {
|
|
10
|
-
return "";
|
|
11
|
-
}
|
|
12
|
-
const strippedText = (0, striptags_1.default)(text);
|
|
13
|
-
const [nonEmptyLine] = strippedText.split("\n").filter((t) => t.trim() != "");
|
|
14
|
-
const [fragment] = nonEmptyLine.split(/[.!?]/g);
|
|
15
|
-
return fragment.replace(/`/g, "'");
|
|
16
|
-
};
|
|
17
|
-
exports.createDescription = createDescription;
|
package/lib/graphql.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gql = exports.gqlRequest = void 0;
|
|
4
|
-
const url_1 = require("url");
|
|
5
|
-
const graphql_request_1 = require("graphql-request");
|
|
6
|
-
const auth_1 = require("./auth");
|
|
7
|
-
const isErrored = (result) => {
|
|
8
|
-
if (!(Boolean(result) &&
|
|
9
|
-
typeof result === "object" &&
|
|
10
|
-
result !== null &&
|
|
11
|
-
"errors" in result)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
const assumed = result;
|
|
15
|
-
return Boolean(assumed.errors) && assumed.errors.length > 0;
|
|
16
|
-
};
|
|
17
|
-
const formatError = (field, messages) => {
|
|
18
|
-
const message = messages.join("\n");
|
|
19
|
-
if (field === "__all__") {
|
|
20
|
-
return message;
|
|
21
|
-
}
|
|
22
|
-
return `${field}: ${message}`;
|
|
23
|
-
};
|
|
24
|
-
const gqlRequest = async ({ document, variables, }) => {
|
|
25
|
-
const accessToken = await (0, auth_1.getAccessToken)();
|
|
26
|
-
const url = new url_1.URL("/api", auth_1.prismaticUrl).toString();
|
|
27
|
-
const result = await (0, graphql_request_1.request)(url, document, variables, {
|
|
28
|
-
Authorization: `Bearer ${accessToken}`,
|
|
29
|
-
"Prismatic-Client": "prism",
|
|
30
|
-
});
|
|
31
|
-
const errors = Object.values(result)
|
|
32
|
-
.filter(isErrored)
|
|
33
|
-
.flatMap(({ errors }) => errors)
|
|
34
|
-
.map(({ field, messages }) => formatError(field, messages));
|
|
35
|
-
if (errors.length > 0) {
|
|
36
|
-
throw new Error(errors.join("\n"));
|
|
37
|
-
}
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
exports.gqlRequest = gqlRequest;
|
|
41
|
-
var graphql_request_2 = require("graphql-request");
|
|
42
|
-
Object.defineProperty(exports, "gql", { enumerable: true, get: function () { return graphql_request_2.gql; } });
|
package/lib/queries.graphql.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_MARKETPLACE_INTEGRATIONS_TRANSLATIONS = void 0;
|
|
4
|
-
const graphql_1 = require("./graphql");
|
|
5
|
-
exports.GET_MARKETPLACE_INTEGRATIONS_TRANSLATIONS = (0, graphql_1.gql) `
|
|
6
|
-
fragment IntegrationTranslation on Integration {
|
|
7
|
-
name
|
|
8
|
-
description
|
|
9
|
-
definition
|
|
10
|
-
category
|
|
11
|
-
overview
|
|
12
|
-
configPages
|
|
13
|
-
requiredConfigVariables {
|
|
14
|
-
nodes {
|
|
15
|
-
key
|
|
16
|
-
description
|
|
17
|
-
inputs {
|
|
18
|
-
nodes {
|
|
19
|
-
name
|
|
20
|
-
meta
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
query MarketplaceTranslations {
|
|
27
|
-
marketplaceIntegrations {
|
|
28
|
-
nodes {
|
|
29
|
-
id
|
|
30
|
-
...IntegrationTranslation
|
|
31
|
-
instances(isSystem: false) {
|
|
32
|
-
nodes {
|
|
33
|
-
id
|
|
34
|
-
name
|
|
35
|
-
integration {
|
|
36
|
-
...IntegrationTranslation
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`;
|
package/lib/types.js
DELETED
package/lib/utils/avatar.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.uploadAvatar = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const fs_1 = require("../fs");
|
|
9
|
-
const graphql_1 = require("../graphql");
|
|
10
|
-
const mime_types_1 = __importDefault(require("mime-types"));
|
|
11
|
-
const path_1 = require("path");
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param objectId The Prismatic ID of the object to set the avatar for (integration ID, user ID, etc)
|
|
15
|
-
* @param iconPath The path to the icon file
|
|
16
|
-
* @returns The media URL for the file that was uploaded
|
|
17
|
-
*/
|
|
18
|
-
const uploadAvatar = async (objectId, iconPath) => {
|
|
19
|
-
const { uploadMedia: { uploadUrl, objectUrl }, } = await (0, graphql_1.gqlRequest)({
|
|
20
|
-
document: (0, graphql_1.gql) `
|
|
21
|
-
query getPresignedUrl(
|
|
22
|
-
$objectId: ID!
|
|
23
|
-
$fileName: String!
|
|
24
|
-
$mediaType: MediaType!
|
|
25
|
-
) {
|
|
26
|
-
uploadMedia(
|
|
27
|
-
objectId: $objectId
|
|
28
|
-
fileName: $fileName
|
|
29
|
-
mediaType: $mediaType
|
|
30
|
-
) {
|
|
31
|
-
uploadUrl
|
|
32
|
-
objectUrl
|
|
33
|
-
error
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`,
|
|
37
|
-
variables: {
|
|
38
|
-
objectId,
|
|
39
|
-
fileName: (0, path_1.basename)(iconPath),
|
|
40
|
-
mediaType: "AVATAR",
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
await axios_1.default.put(uploadUrl, await fs_1.fs.readFile(iconPath), {
|
|
44
|
-
headers: { "Content-Type": mime_types_1.default.contentType((0, path_1.extname)(iconPath)) },
|
|
45
|
-
});
|
|
46
|
-
return objectUrl;
|
|
47
|
-
};
|
|
48
|
-
exports.uploadAvatar = uploadAvatar;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteComponentByKey = void 0;
|
|
4
|
-
const graphql_1 = require("../../graphql");
|
|
5
|
-
const deleteComponentByKey = async (key) => {
|
|
6
|
-
// Fetch a component by key
|
|
7
|
-
const result = await (0, graphql_1.gqlRequest)({
|
|
8
|
-
document: (0, graphql_1.gql) `
|
|
9
|
-
query component($key: String!) {
|
|
10
|
-
components(key: $key, public: false) {
|
|
11
|
-
nodes {
|
|
12
|
-
id
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`,
|
|
17
|
-
variables: {
|
|
18
|
-
key,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
// Delete the component by ID
|
|
22
|
-
await (0, graphql_1.gqlRequest)({
|
|
23
|
-
document: (0, graphql_1.gql) `
|
|
24
|
-
mutation deleteComponent($id: ID!) {
|
|
25
|
-
deleteComponent(input: { id: $id }) {
|
|
26
|
-
errors {
|
|
27
|
-
field
|
|
28
|
-
messages
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`,
|
|
33
|
-
variables: { id: result.components.nodes[0].id },
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
exports.deleteComponentByKey = deleteComponentByKey;
|