@prismatic-io/spectral 9.0.1 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/http/index.d.ts +2 -2
- package/dist/clients/http/index.js +5 -9
- package/dist/clients/http/inputs.js +2 -7
- package/dist/conditionalLogic/index.d.ts +1 -1
- package/dist/conditionalLogic/index.js +5 -10
- package/dist/conditionalLogic/types.d.ts +5 -5
- package/dist/conditionalLogic/types.js +3 -3
- package/dist/generators/componentManifest/cli.d.ts +0 -1
- package/dist/generators/componentManifest/cli.js +2 -8
- package/dist/generators/componentManifest/createActions.js +6 -6
- package/dist/generators/componentManifest/createConnections.js +6 -6
- package/dist/generators/componentManifest/createDataSources.js +6 -6
- package/dist/generators/componentManifest/createStaticFiles.js +6 -7
- package/dist/generators/componentManifest/createTriggers.js +6 -6
- package/dist/generators/componentManifest/docBlock.js +1 -3
- package/dist/generators/componentManifest/getImports.d.ts +1 -1
- package/dist/generators/componentManifest/getInputs.d.ts +4 -4
- package/dist/generators/componentManifest/getInputs.js +2 -3
- package/dist/generators/componentManifest/helpers.d.ts +1 -1
- package/dist/generators/componentManifest/index.js +1 -1
- package/dist/generators/componentManifest/templates/actions/action.ts.ejs +1 -1
- package/dist/generators/componentManifest/templates/connections/connection.ts.ejs +1 -1
- package/dist/generators/componentManifest/templates/dataSources/dataSource.ts.ejs +1 -1
- package/dist/generators/componentManifest/templates/partials/performArgs.ejs +1 -1
- package/dist/generators/componentManifest/templates/triggers/trigger.ts.ejs +1 -1
- package/dist/generators/utils/createDependencyImports.d.ts +1 -1
- package/dist/generators/utils/createDependencyImports.js +1 -1
- package/dist/generators/utils/createFlagHelpText.d.ts +1 -1
- package/dist/generators/utils/createFlagHelpText.js +1 -1
- package/dist/generators/utils/createTemplate.js +2 -2
- package/dist/generators/utils/getComponentSignatureWithPrism.js +1 -1
- package/dist/generators/utils/getFlagBooleanValue.d.ts +2 -2
- package/dist/generators/utils/getFlagBooleanValue.js +2 -2
- package/dist/generators/utils/getFlagStringValue.d.ts +2 -2
- package/dist/generators/utils/getFlagStringValue.js +2 -2
- package/dist/index.d.ts +2 -16
- package/dist/serverTypes/convertComponent.js +1 -3
- package/dist/serverTypes/convertIntegration.js +33 -42
- package/dist/serverTypes/index.d.ts +11 -12
- package/dist/serverTypes/index.js +1 -1
- package/dist/serverTypes/integration.d.ts +3 -3
- package/dist/serverTypes/perform.d.ts +3 -3
- package/dist/testing.d.ts +17 -45
- package/dist/testing.js +4 -4
- package/dist/types/ActionInputParameters.d.ts +2 -2
- package/dist/types/ActionLogger.d.ts +1 -1
- package/dist/types/ActionPerformFunction.d.ts +2 -2
- package/dist/types/ActionPerformReturn.d.ts +1 -1
- package/dist/types/ComponentDefinition.d.ts +2 -2
- package/dist/types/ComponentRegistry.d.ts +16 -23
- package/dist/types/ConfigPages.d.ts +4 -4
- package/dist/types/ConfigVars.d.ts +44 -131
- package/dist/types/ConnectionDefinition.d.ts +2 -2
- package/dist/types/ConnectionDefinition.js +2 -2
- package/dist/types/DataPayload.d.ts +0 -1
- package/dist/types/DataSourcePerformFunction.d.ts +2 -2
- package/dist/types/DataSourceResult.d.ts +5 -5
- package/dist/types/DisplayDefinition.d.ts +2 -2
- package/dist/types/Inputs.d.ts +22 -22
- package/dist/types/IntegrationDefinition.d.ts +7 -7
- package/dist/types/TriggerDefinition.d.ts +1 -1
- package/dist/types/TriggerEventFunction.d.ts +2 -2
- package/dist/types/TriggerPerformFunction.d.ts +1 -1
- package/dist/types/TriggerResult.d.ts +1 -1
- package/dist/types/utils.d.ts +3 -3
- package/dist/util.d.ts +6 -6
- package/dist/util.js +4 -11
- package/package.json +9 -20
|
@@ -3,7 +3,7 @@ import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
|
3
3
|
import { IAxiosRetryConfig } from "axios-retry";
|
|
4
4
|
import { ActionInputParameters } from "../../types";
|
|
5
5
|
import { inputs } from "./inputs";
|
|
6
|
-
export
|
|
6
|
+
export type HttpClient = AxiosInstance;
|
|
7
7
|
interface RetryConfig extends Omit<IAxiosRetryConfig, "retryDelay"> {
|
|
8
8
|
retryDelay?: IAxiosRetryConfig["retryDelay"] | number;
|
|
9
9
|
retryAllErrors?: boolean;
|
|
@@ -20,7 +20,7 @@ export interface ClientProps {
|
|
|
20
20
|
}
|
|
21
21
|
export declare const createClient: ({ baseUrl, responseType, headers, timeout, params, debug, retryConfig, }: ClientProps) => HttpClient;
|
|
22
22
|
export declare const handleErrors: (error: unknown) => unknown;
|
|
23
|
-
|
|
23
|
+
type SendRawRequestValues = ActionInputParameters<typeof inputs>;
|
|
24
24
|
export declare const sendRawRequest: (baseUrl: string, values: SendRawRequestValues, authorizationHeaders?: Record<string, string>) => Promise<AxiosResponse>;
|
|
25
25
|
export declare const buildRawRequestAction: (baseUrl: string, label?: string, description?: string) => import("../..").ActionDefinition<{
|
|
26
26
|
url: {
|
|
@@ -99,8 +99,8 @@ const createClient = ({ baseUrl, responseType, headers, timeout, params, debug =
|
|
|
99
99
|
headers,
|
|
100
100
|
timeout,
|
|
101
101
|
params,
|
|
102
|
-
maxContentLength:
|
|
103
|
-
maxBodyLength:
|
|
102
|
+
maxContentLength: Number.POSITIVE_INFINITY,
|
|
103
|
+
maxBodyLength: Number.POSITIVE_INFINITY,
|
|
104
104
|
});
|
|
105
105
|
if (debug) {
|
|
106
106
|
client.interceptors.request.use((request) => {
|
|
@@ -113,9 +113,7 @@ const createClient = ({ baseUrl, responseType, headers, timeout, params, debug =
|
|
|
113
113
|
headers,
|
|
114
114
|
method,
|
|
115
115
|
timeout,
|
|
116
|
-
data: dataSize > 1024 * 10 || Buffer.isBuffer(data)
|
|
117
|
-
? `<data (${dataSize} bytes)>`
|
|
118
|
-
: data,
|
|
116
|
+
data: dataSize > 1024 * 10 || Buffer.isBuffer(data) ? `<data (${dataSize} bytes)>` : data,
|
|
119
117
|
}, true, true));
|
|
120
118
|
return request;
|
|
121
119
|
});
|
|
@@ -127,9 +125,7 @@ const createClient = ({ baseUrl, responseType, headers, timeout, params, debug =
|
|
|
127
125
|
headers,
|
|
128
126
|
status,
|
|
129
127
|
statusText,
|
|
130
|
-
data: dataSize > 1024 * 10 || Buffer.isBuffer(data)
|
|
131
|
-
? `<data (${dataSize} bytes)>`
|
|
132
|
-
: data,
|
|
128
|
+
data: dataSize > 1024 * 10 || Buffer.isBuffer(data) ? `<data (${dataSize} bytes)>` : data,
|
|
133
129
|
}, true, true));
|
|
134
130
|
return response;
|
|
135
131
|
});
|
|
@@ -154,7 +150,7 @@ const handleErrors = (error) => {
|
|
|
154
150
|
return error;
|
|
155
151
|
};
|
|
156
152
|
exports.handleErrors = handleErrors;
|
|
157
|
-
const sendRawRequest = (
|
|
153
|
+
const sendRawRequest = (baseUrl_1, values_1, ...args_1) => __awaiter(void 0, [baseUrl_1, values_1, ...args_1], void 0, function* (baseUrl, values, authorizationHeaders = {}) {
|
|
158
154
|
if (values.data && (!(0, lodash_1.isEmpty)(values.formData) || !(0, lodash_1.isEmpty)(values.fileData))) {
|
|
159
155
|
throw new Error("Cannot specify both Data and File/Form Data.");
|
|
160
156
|
}
|
|
@@ -14,12 +14,7 @@ const supportedMethods = [
|
|
|
14
14
|
"PUT",
|
|
15
15
|
"UNLINK",
|
|
16
16
|
];
|
|
17
|
-
const supportedResponseTypes = [
|
|
18
|
-
"arraybuffer",
|
|
19
|
-
"document",
|
|
20
|
-
"json",
|
|
21
|
-
"text",
|
|
22
|
-
];
|
|
17
|
+
const supportedResponseTypes = ["arraybuffer", "document", "json", "text"];
|
|
23
18
|
exports.url = (0, __1.input)({
|
|
24
19
|
label: "URL",
|
|
25
20
|
placeholder: "URL to call",
|
|
@@ -142,7 +137,7 @@ exports.fileDataFileNames = (0, __1.input)({
|
|
|
142
137
|
collection: "keyvaluelist",
|
|
143
138
|
required: false,
|
|
144
139
|
comments: "File names to apply to the file data inputs. Keys must match the file data keys above.",
|
|
145
|
-
clean: (values) => values ? __1.util.types.keyValPairListToObject(values) : undefined,
|
|
140
|
+
clean: (values) => (values ? __1.util.types.keyValPairListToObject(values) : undefined),
|
|
146
141
|
});
|
|
147
142
|
exports.debugRequest = (0, __1.input)({
|
|
148
143
|
label: "Debug Request",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConditionalExpression } from "./types";
|
|
2
|
-
export
|
|
2
|
+
export type ValidationResult = [boolean] | [boolean, string];
|
|
3
3
|
export declare const validate: (expression: ConditionalExpression) => ValidationResult;
|
|
4
4
|
/** Convert stringified objects/values back to their native value, all other
|
|
5
5
|
* values just pass through unaltered. */
|
|
@@ -23,7 +23,7 @@ const date_fns_1 = require("date-fns");
|
|
|
23
23
|
const lodash_1 = __importDefault(require("lodash"));
|
|
24
24
|
const util_1 = __importDefault(require("../util"));
|
|
25
25
|
const validate = (expression) => {
|
|
26
|
-
if (!(expression
|
|
26
|
+
if (!Array.isArray(expression)) {
|
|
27
27
|
return [false, `Invalid expression syntax: '${expression}'`];
|
|
28
28
|
}
|
|
29
29
|
const [operator] = expression;
|
|
@@ -67,8 +67,7 @@ const contains = (container, containee) => {
|
|
|
67
67
|
if (typeof container === "object" && container !== null) {
|
|
68
68
|
if (Array.isArray(container)) {
|
|
69
69
|
// Array member check.
|
|
70
|
-
return
|
|
71
|
-
container.includes((0, exports.parseValue)(containee)));
|
|
70
|
+
return container.includes(containee) || container.includes((0, exports.parseValue)(containee));
|
|
72
71
|
}
|
|
73
72
|
// Object attribute check (set membership).
|
|
74
73
|
return Object.prototype.hasOwnProperty.call(container, `${containee}`);
|
|
@@ -164,9 +163,9 @@ const evaluate = (expression) => {
|
|
|
164
163
|
}
|
|
165
164
|
return !left;
|
|
166
165
|
case types_1.UnaryOperator.doesNotExist:
|
|
167
|
-
return [undefined, null, 0, NaN, false, ""].includes(left);
|
|
166
|
+
return [undefined, null, 0, Number.NaN, false, ""].includes(left);
|
|
168
167
|
case types_1.UnaryOperator.exists:
|
|
169
|
-
return ![undefined, null, 0, NaN, false, ""].includes(left);
|
|
168
|
+
return ![undefined, null, 0, Number.NaN, false, ""].includes(left);
|
|
170
169
|
case types_1.UnaryOperator.isEmpty:
|
|
171
170
|
if (Array.isArray(left)) {
|
|
172
171
|
return left.length === 0;
|
|
@@ -199,11 +198,7 @@ const evaluate = (expression) => {
|
|
|
199
198
|
// attempt to convert numeric, array, or object strings as json to native objects,
|
|
200
199
|
// otherwise fall back to original value
|
|
201
200
|
if (operator in
|
|
202
|
-
[
|
|
203
|
-
types_1.BinaryOperator.dateTimeAfter,
|
|
204
|
-
types_1.BinaryOperator.dateTimeBefore,
|
|
205
|
-
types_1.BinaryOperator.dateTimeSame,
|
|
206
|
-
]) {
|
|
201
|
+
[types_1.BinaryOperator.dateTimeAfter, types_1.BinaryOperator.dateTimeBefore, types_1.BinaryOperator.dateTimeSame]) {
|
|
207
202
|
left = (0, exports.parseDate)(leftTerm);
|
|
208
203
|
right = (0, exports.parseDate)(rightTerm);
|
|
209
204
|
}
|
|
@@ -57,7 +57,7 @@ export declare const BinaryOperatorPhrase: {
|
|
|
57
57
|
dateTimeBefore: string;
|
|
58
58
|
dateTimeSame: string;
|
|
59
59
|
};
|
|
60
|
-
export
|
|
60
|
+
export type TermOperator = UnaryOperator | BinaryOperator;
|
|
61
61
|
export declare const TermOperatorPhrase: {
|
|
62
62
|
equal: string;
|
|
63
63
|
exactlyMatches: string;
|
|
@@ -83,10 +83,10 @@ export declare const TermOperatorPhrase: {
|
|
|
83
83
|
isEmpty: string;
|
|
84
84
|
isNotEmpty: string;
|
|
85
85
|
};
|
|
86
|
-
export
|
|
87
|
-
export
|
|
88
|
-
export
|
|
86
|
+
export type Term = unknown;
|
|
87
|
+
export type TermExpression = [TermOperator, Term, Term?];
|
|
88
|
+
export type BooleanExpression = [
|
|
89
89
|
BooleanOperator.and | BooleanOperator.or,
|
|
90
90
|
...ConditionalExpression[]
|
|
91
91
|
];
|
|
92
|
-
export
|
|
92
|
+
export type ConditionalExpression = TermExpression | BooleanExpression;
|
|
@@ -7,7 +7,7 @@ var BooleanOperator;
|
|
|
7
7
|
(function (BooleanOperator) {
|
|
8
8
|
BooleanOperator["and"] = "and";
|
|
9
9
|
BooleanOperator["or"] = "or";
|
|
10
|
-
})(BooleanOperator
|
|
10
|
+
})(BooleanOperator || (exports.BooleanOperator = BooleanOperator = {}));
|
|
11
11
|
exports.BooleanOperatorPhrase = Object.keys(BooleanOperator);
|
|
12
12
|
var UnaryOperator;
|
|
13
13
|
(function (UnaryOperator) {
|
|
@@ -17,7 +17,7 @@ var UnaryOperator;
|
|
|
17
17
|
UnaryOperator["exists"] = "exists";
|
|
18
18
|
UnaryOperator["isEmpty"] = "isEmpty";
|
|
19
19
|
UnaryOperator["isNotEmpty"] = "isNotEmpty";
|
|
20
|
-
})(UnaryOperator
|
|
20
|
+
})(UnaryOperator || (exports.UnaryOperator = UnaryOperator = {}));
|
|
21
21
|
exports.UnaryOperatorPhrase = {
|
|
22
22
|
[UnaryOperator.isTrue]: "is true",
|
|
23
23
|
[UnaryOperator.isFalse]: "is false",
|
|
@@ -45,7 +45,7 @@ var BinaryOperator;
|
|
|
45
45
|
BinaryOperator["dateTimeAfter"] = "dateTimeAfter";
|
|
46
46
|
BinaryOperator["dateTimeBefore"] = "dateTimeBefore";
|
|
47
47
|
BinaryOperator["dateTimeSame"] = "dateTimeSame";
|
|
48
|
-
})(BinaryOperator
|
|
48
|
+
})(BinaryOperator || (exports.BinaryOperator = BinaryOperator = {}));
|
|
49
49
|
exports.BinaryOperatorPhrase = {
|
|
50
50
|
[BinaryOperator.equal]: "equals",
|
|
51
51
|
[BinaryOperator.exactlyMatches]: "exactly matches",
|
|
@@ -104,11 +104,7 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
104
104
|
const component = require(componentDistDir).default;
|
|
105
105
|
if (!component ||
|
|
106
106
|
!(0, util_1.isObjectWithTruthyKeys)(component, ["key", "display"]) ||
|
|
107
|
-
!(0, util_1.isObjectWithOneTruthyKey)(component, [
|
|
108
|
-
"actions",
|
|
109
|
-
"connections",
|
|
110
|
-
"dataSources",
|
|
111
|
-
])) {
|
|
107
|
+
!(0, util_1.isObjectWithOneTruthyKey)(component, ["actions", "connections", "dataSources"])) {
|
|
112
108
|
console.error("Component is invalid.");
|
|
113
109
|
process.exit(1);
|
|
114
110
|
}
|
|
@@ -127,9 +123,7 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
127
123
|
sourceDir: path_1.default.join(__dirname, "templates"),
|
|
128
124
|
destinationDir: flags.output_dir.value
|
|
129
125
|
? flags.output_dir.value
|
|
130
|
-
: path_1.default.join(componentDir, "..", flags.name.value
|
|
131
|
-
? flags.name.value
|
|
132
|
-
: `${path_1.default.basename(componentDir)}-manifest`),
|
|
126
|
+
: path_1.default.join(componentDir, "..", flags.name.value ? flags.name.value : `${path_1.default.basename(componentDir)}-manifest`),
|
|
133
127
|
registry: (_b = flags.registry.value) !== null && _b !== void 0 ? _b : null,
|
|
134
128
|
});
|
|
135
129
|
});
|
|
@@ -18,13 +18,13 @@ const getInputs_1 = require("./getInputs");
|
|
|
18
18
|
const getImports_1 = require("./getImports");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
|
20
20
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
21
|
-
const createActions = (
|
|
22
|
-
var
|
|
21
|
+
const createActions = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
22
|
+
var _b, _c;
|
|
23
23
|
if (verbose) {
|
|
24
24
|
console.info("Creating actions...");
|
|
25
25
|
}
|
|
26
26
|
const actionIndex = yield renderActionsIndex({
|
|
27
|
-
actions: Object.entries((
|
|
27
|
+
actions: Object.entries((_b = component.actions) !== null && _b !== void 0 ? _b : {}).map(([actionKey, action]) => {
|
|
28
28
|
return {
|
|
29
29
|
key: action.key || actionKey,
|
|
30
30
|
};
|
|
@@ -34,7 +34,7 @@ const createActions = ({ component, dryRun, verbose, sourceDir, destinationDir,
|
|
|
34
34
|
sourceDir,
|
|
35
35
|
destinationDir,
|
|
36
36
|
});
|
|
37
|
-
const actions = yield Promise.all(Object.entries((
|
|
37
|
+
const actions = yield Promise.all(Object.entries((_c = component.actions) !== null && _c !== void 0 ? _c : {}).map((_a) => __awaiter(void 0, [_a], void 0, function* ([actionKey, action]) {
|
|
38
38
|
const inputs = (0, getInputs_1.getInputs)({
|
|
39
39
|
inputs: action.inputs,
|
|
40
40
|
});
|
|
@@ -62,7 +62,7 @@ const createActions = ({ component, dryRun, verbose, sourceDir, destinationDir,
|
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
exports.createActions = createActions;
|
|
65
|
-
const renderActionsIndex = (
|
|
65
|
+
const renderActionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ actions, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
66
66
|
return yield (0, createTemplate_1.createTemplate)({
|
|
67
67
|
source: path_1.default.join(sourceDir, "actions", "index.ts.ejs"),
|
|
68
68
|
destination: path_1.default.join(destinationDir, "actions", "index.ts"),
|
|
@@ -73,7 +73,7 @@ const renderActionsIndex = ({ actions, dryRun, verbose, sourceDir, destinationDi
|
|
|
73
73
|
verbose,
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
-
const renderAction = (
|
|
76
|
+
const renderAction = (_a) => __awaiter(void 0, [_a], void 0, function* ({ action, dryRun, imports, verbose, sourceDir, destinationDir, }) {
|
|
77
77
|
return yield (0, createTemplate_1.createTemplate)({
|
|
78
78
|
source: path_1.default.join(sourceDir, "actions", "action.ts.ejs"),
|
|
79
79
|
destination: path_1.default.join(destinationDir, "actions", `${action.key}.ts`),
|
|
@@ -18,13 +18,13 @@ const getInputs_1 = require("./getInputs");
|
|
|
18
18
|
const getImports_1 = require("./getImports");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
|
20
20
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
21
|
-
const createConnections = (
|
|
22
|
-
var
|
|
21
|
+
const createConnections = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
22
|
+
var _b, _c;
|
|
23
23
|
if (verbose) {
|
|
24
24
|
console.info("Creating connections...");
|
|
25
25
|
}
|
|
26
26
|
const connectionIndex = yield renderConnectionsIndex({
|
|
27
|
-
connections: ((
|
|
27
|
+
connections: ((_b = component.connections) !== null && _b !== void 0 ? _b : []).map((connection) => {
|
|
28
28
|
return {
|
|
29
29
|
key: connection.key,
|
|
30
30
|
};
|
|
@@ -34,7 +34,7 @@ const createConnections = ({ component, dryRun, verbose, sourceDir, destinationD
|
|
|
34
34
|
sourceDir,
|
|
35
35
|
destinationDir,
|
|
36
36
|
});
|
|
37
|
-
const connections = yield Promise.all(((
|
|
37
|
+
const connections = yield Promise.all(((_c = component.connections) !== null && _c !== void 0 ? _c : []).map((connection) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
38
|
const inputs = (0, getInputs_1.getInputs)({
|
|
39
39
|
inputs: connection.inputs,
|
|
40
40
|
});
|
|
@@ -64,7 +64,7 @@ const createConnections = ({ component, dryRun, verbose, sourceDir, destinationD
|
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
exports.createConnections = createConnections;
|
|
67
|
-
const renderConnectionsIndex = (
|
|
67
|
+
const renderConnectionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ connections, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
68
68
|
return yield (0, createTemplate_1.createTemplate)({
|
|
69
69
|
source: path_1.default.join(sourceDir, "connections", "index.ts.ejs"),
|
|
70
70
|
destination: path_1.default.join(destinationDir, "connections", "index.ts"),
|
|
@@ -75,7 +75,7 @@ const renderConnectionsIndex = ({ connections, dryRun, verbose, sourceDir, desti
|
|
|
75
75
|
verbose,
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
|
-
const renderConnection = (
|
|
78
|
+
const renderConnection = (_a) => __awaiter(void 0, [_a], void 0, function* ({ connection, dryRun, imports, verbose, sourceDir, destinationDir, }) {
|
|
79
79
|
return yield (0, createTemplate_1.createTemplate)({
|
|
80
80
|
source: path_1.default.join(sourceDir, "connections", "connection.ts.ejs"),
|
|
81
81
|
destination: path_1.default.join(destinationDir, "connections", `${connection.key}.ts`),
|
|
@@ -18,13 +18,13 @@ const getInputs_1 = require("./getInputs");
|
|
|
18
18
|
const getImports_1 = require("./getImports");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
|
20
20
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
21
|
-
const createDataSources = (
|
|
22
|
-
var
|
|
21
|
+
const createDataSources = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
22
|
+
var _b, _c;
|
|
23
23
|
if (verbose) {
|
|
24
24
|
console.info("Creating data sources...");
|
|
25
25
|
}
|
|
26
26
|
const dataSourceIndex = yield renderDataSourcesIndex({
|
|
27
|
-
dataSources: Object.entries((
|
|
27
|
+
dataSources: Object.entries((_b = component.dataSources) !== null && _b !== void 0 ? _b : {}).map(([dataSourceKey, dataSource]) => {
|
|
28
28
|
return {
|
|
29
29
|
key: dataSource.key || dataSourceKey,
|
|
30
30
|
};
|
|
@@ -34,7 +34,7 @@ const createDataSources = ({ component, dryRun, verbose, sourceDir, destinationD
|
|
|
34
34
|
sourceDir,
|
|
35
35
|
destinationDir,
|
|
36
36
|
});
|
|
37
|
-
const dataSources = yield Promise.all(Object.entries((
|
|
37
|
+
const dataSources = yield Promise.all(Object.entries((_c = component.dataSources) !== null && _c !== void 0 ? _c : {}).map((_a) => __awaiter(void 0, [_a], void 0, function* ([dataSourceKey, dataSource]) {
|
|
38
38
|
const inputs = (0, getInputs_1.getInputs)({
|
|
39
39
|
inputs: dataSource.inputs,
|
|
40
40
|
});
|
|
@@ -63,7 +63,7 @@ const createDataSources = ({ component, dryRun, verbose, sourceDir, destinationD
|
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
exports.createDataSources = createDataSources;
|
|
66
|
-
const renderDataSourcesIndex = (
|
|
66
|
+
const renderDataSourcesIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dataSources, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
67
67
|
return yield (0, createTemplate_1.createTemplate)({
|
|
68
68
|
source: path_1.default.join(sourceDir, "dataSources", "index.ts.ejs"),
|
|
69
69
|
destination: path_1.default.join(destinationDir, "dataSources", "index.ts"),
|
|
@@ -74,7 +74,7 @@ const renderDataSourcesIndex = ({ dataSources, dryRun, verbose, sourceDir, desti
|
|
|
74
74
|
verbose,
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
|
-
const renderDataSource = (
|
|
77
|
+
const renderDataSource = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dataSource, dryRun, imports, verbose, sourceDir, destinationDir, }) {
|
|
78
78
|
return yield (0, createTemplate_1.createTemplate)({
|
|
79
79
|
source: path_1.default.join(sourceDir, "dataSources", "dataSource.ts.ejs"),
|
|
80
80
|
destination: path_1.default.join(destinationDir, "dataSources", `${dataSource.key}.ts`),
|
|
@@ -16,7 +16,7 @@ exports.renderReadme = exports.renderTsConfig = exports.renderPackageJson = expo
|
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const helpers_1 = require("./helpers");
|
|
18
18
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
19
|
-
const createStaticFiles = ({ component, dryRun, signature, packageName, dependencies, verbose, sourceDir, destinationDir, registry, })
|
|
19
|
+
const createStaticFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, signature, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) {
|
|
20
20
|
if (verbose) {
|
|
21
21
|
console.info("Creating static files...");
|
|
22
22
|
}
|
|
@@ -70,8 +70,7 @@ const createStaticFiles = ({ component, dryRun, signature, packageName, dependen
|
|
|
70
70
|
dataSource: Object.keys(component.dataSources).length
|
|
71
71
|
? {
|
|
72
72
|
key: Object.keys(component.dataSources)[0],
|
|
73
|
-
type: component.dataSources[Object.keys(component.dataSources)[0]]
|
|
74
|
-
.dataSourceType,
|
|
73
|
+
type: component.dataSources[Object.keys(component.dataSources)[0]].dataSourceType,
|
|
75
74
|
}
|
|
76
75
|
: null,
|
|
77
76
|
},
|
|
@@ -92,7 +91,7 @@ const createStaticFiles = ({ component, dryRun, signature, packageName, dependen
|
|
|
92
91
|
});
|
|
93
92
|
});
|
|
94
93
|
exports.createStaticFiles = createStaticFiles;
|
|
95
|
-
const renderIndex = (
|
|
94
|
+
const renderIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
96
95
|
return yield (0, createTemplate_1.createTemplate)({
|
|
97
96
|
source: path_1.default.join(sourceDir, "index.ts.ejs"),
|
|
98
97
|
destination: path_1.default.join(destinationDir, "src", "index.ts"),
|
|
@@ -104,7 +103,7 @@ const renderIndex = ({ component, dryRun, verbose, sourceDir, destinationDir, })
|
|
|
104
103
|
});
|
|
105
104
|
});
|
|
106
105
|
exports.renderIndex = renderIndex;
|
|
107
|
-
const renderPackageJson = ({ dryRun, packageName, dependencies, verbose, sourceDir, destinationDir, registry, })
|
|
106
|
+
const renderPackageJson = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) {
|
|
108
107
|
return yield (0, createTemplate_1.createTemplate)({
|
|
109
108
|
source: path_1.default.join(sourceDir, "package.json.ejs"),
|
|
110
109
|
destination: path_1.default.join(destinationDir, "package.json"),
|
|
@@ -120,7 +119,7 @@ const renderPackageJson = ({ dryRun, packageName, dependencies, verbose, sourceD
|
|
|
120
119
|
});
|
|
121
120
|
});
|
|
122
121
|
exports.renderPackageJson = renderPackageJson;
|
|
123
|
-
const renderTsConfig = (
|
|
122
|
+
const renderTsConfig = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, verbose, sourceDir, destinationDir, }) {
|
|
124
123
|
return yield (0, createTemplate_1.createTemplate)({
|
|
125
124
|
source: path_1.default.join(sourceDir, "tsconfig.json.ejs"),
|
|
126
125
|
destination: path_1.default.join(destinationDir, "tsconfig.json"),
|
|
@@ -129,7 +128,7 @@ const renderTsConfig = ({ dryRun, verbose, sourceDir, destinationDir, }) => __aw
|
|
|
129
128
|
});
|
|
130
129
|
});
|
|
131
130
|
exports.renderTsConfig = renderTsConfig;
|
|
132
|
-
const renderReadme = (
|
|
131
|
+
const renderReadme = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, packageName, verbose, sourceDir, destinationDir, }) {
|
|
133
132
|
return yield (0, createTemplate_1.createTemplate)({
|
|
134
133
|
source: path_1.default.join(sourceDir, "README.md.ejs"),
|
|
135
134
|
destination: path_1.default.join(destinationDir, "README.md"),
|
|
@@ -18,13 +18,13 @@ const getInputs_1 = require("./getInputs");
|
|
|
18
18
|
const getImports_1 = require("./getImports");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
|
20
20
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
21
|
-
const createTriggers = (
|
|
22
|
-
var
|
|
21
|
+
const createTriggers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
22
|
+
var _b, _c;
|
|
23
23
|
if (verbose) {
|
|
24
24
|
console.info("Creating triggers...");
|
|
25
25
|
}
|
|
26
26
|
const triggersIndex = yield renderTriggersIndex({
|
|
27
|
-
triggers: Object.entries((
|
|
27
|
+
triggers: Object.entries((_b = component.triggers) !== null && _b !== void 0 ? _b : {}).map(([triggerKey, trigger]) => {
|
|
28
28
|
return {
|
|
29
29
|
key: trigger.key || triggerKey,
|
|
30
30
|
};
|
|
@@ -34,7 +34,7 @@ const createTriggers = ({ component, dryRun, verbose, sourceDir, destinationDir,
|
|
|
34
34
|
sourceDir,
|
|
35
35
|
destinationDir,
|
|
36
36
|
});
|
|
37
|
-
const triggers = yield Promise.all(Object.entries((
|
|
37
|
+
const triggers = yield Promise.all(Object.entries((_c = component.triggers) !== null && _c !== void 0 ? _c : {}).map((_a) => __awaiter(void 0, [_a], void 0, function* ([triggerKey, trigger]) {
|
|
38
38
|
const inputs = (0, getInputs_1.getInputs)({
|
|
39
39
|
inputs: trigger.inputs,
|
|
40
40
|
});
|
|
@@ -62,7 +62,7 @@ const createTriggers = ({ component, dryRun, verbose, sourceDir, destinationDir,
|
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
exports.createTriggers = createTriggers;
|
|
65
|
-
const renderTriggersIndex = (
|
|
65
|
+
const renderTriggersIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ triggers, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
66
66
|
return yield (0, createTemplate_1.createTemplate)({
|
|
67
67
|
source: path_1.default.join(sourceDir, "triggers", "index.ts.ejs"),
|
|
68
68
|
destination: path_1.default.join(destinationDir, "triggers", "index.ts"),
|
|
@@ -73,7 +73,7 @@ const renderTriggersIndex = ({ triggers, dryRun, verbose, sourceDir, destination
|
|
|
73
73
|
verbose,
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
-
const renderTrigger = (
|
|
76
|
+
const renderTrigger = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, imports, trigger, verbose, sourceDir, destinationDir, }) {
|
|
77
77
|
return yield (0, createTemplate_1.createTemplate)({
|
|
78
78
|
source: path_1.default.join(sourceDir, "triggers", "trigger.ts.ejs"),
|
|
79
79
|
destination: path_1.default.join(destinationDir, "triggers", `${trigger.key}.ts`),
|
|
@@ -33,8 +33,6 @@ const addPunctuation = (value) => {
|
|
|
33
33
|
if (typeof value === "undefined" || value === null || value === "") {
|
|
34
34
|
return "";
|
|
35
35
|
}
|
|
36
|
-
return value.endsWith(".") || value.endsWith("!") || value.endsWith("?")
|
|
37
|
-
? value
|
|
38
|
-
: value + ".";
|
|
36
|
+
return value.endsWith(".") || value.endsWith("!") || value.endsWith("?") ? value : `${value}.`;
|
|
39
37
|
};
|
|
40
38
|
exports.addPunctuation = addPunctuation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Input as InputBase } from "../../serverTypes";
|
|
2
2
|
import type { InputFieldDefinition } from "../../types/Inputs";
|
|
3
|
-
export
|
|
3
|
+
export type ServerTypeInput = InputBase & {
|
|
4
4
|
onPremControlled?: boolean;
|
|
5
5
|
shown?: boolean;
|
|
6
6
|
};
|
|
@@ -12,11 +12,11 @@ export interface Input {
|
|
|
12
12
|
docBlock: string;
|
|
13
13
|
required: boolean | undefined;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type ValueType = string | {
|
|
16
16
|
type: string;
|
|
17
17
|
module: string;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type DocBlock = {
|
|
20
20
|
inputKey?: string;
|
|
21
21
|
propertyKey: keyof ServerTypeInput;
|
|
22
22
|
propertyValue?: unknown;
|
|
@@ -26,6 +26,6 @@ interface GetInputsProps {
|
|
|
26
26
|
inputs: ServerTypeInput[];
|
|
27
27
|
docBlock?: (input: ServerTypeInput) => string;
|
|
28
28
|
}
|
|
29
|
-
export declare const getInputs: ({ inputs, docBlock
|
|
29
|
+
export declare const getInputs: ({ inputs, docBlock }: GetInputsProps) => Input[];
|
|
30
30
|
export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"], ValueType>;
|
|
31
31
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.INPUT_TYPE_MAP = exports.getInputs = void 0;
|
|
4
4
|
const docBlock_1 = require("./docBlock");
|
|
5
|
-
const getInputs = ({ inputs, docBlock = docBlock_1.DOC_BLOCK_DEFAULT
|
|
5
|
+
const getInputs = ({ inputs, docBlock = docBlock_1.DOC_BLOCK_DEFAULT }) => {
|
|
6
6
|
return inputs.reduce((acc, input) => {
|
|
7
7
|
if ((typeof input.shown === "boolean" && input.shown === false) ||
|
|
8
8
|
input.type === "dynamicObjectSelection" ||
|
|
@@ -16,8 +16,7 @@ const getInputs = ({ inputs, docBlock = docBlock_1.DOC_BLOCK_DEFAULT, }) => {
|
|
|
16
16
|
label: input.label,
|
|
17
17
|
inputType: input.type,
|
|
18
18
|
valueType: getInputValueType(input),
|
|
19
|
-
required: input.required &&
|
|
20
|
-
(input.default === undefined || input.default === ""),
|
|
19
|
+
required: input.required && (input.default === undefined || input.default === ""),
|
|
21
20
|
collection: input.collection,
|
|
22
21
|
onPremControlled: input.onPremiseControlled || input.onPremControlled,
|
|
23
22
|
docBlock: docBlock(input),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const helpers: {
|
|
2
|
-
createDependencyImports: ({ imports
|
|
2
|
+
createDependencyImports: ({ imports }: import("../utils/createDependencyImports").CreateDependencyImportsProps) => string[];
|
|
3
3
|
capitalizeFirstLetter: (value: string) => string;
|
|
4
4
|
generatePackageJsonVersion: () => string;
|
|
5
5
|
};
|
|
@@ -21,7 +21,7 @@ const createStaticFiles_1 = require("./createStaticFiles");
|
|
|
21
21
|
const createTriggers_1 = require("./createTriggers");
|
|
22
22
|
const removeComponentManifest_1 = require("./removeComponentManifest");
|
|
23
23
|
const getComponentSignatureWithPrism_1 = require("../utils/getComponentSignatureWithPrism");
|
|
24
|
-
const createComponentManifest = ({ component, dryRun, skipSignatureVerify, packageName, dependencies, verbose, sourceDir, destinationDir, registry, })
|
|
24
|
+
const createComponentManifest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, skipSignatureVerify, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) {
|
|
25
25
|
const signature = yield (0, getComponentSignatureWithPrism_1.getComponentSignatureWithPrism)({
|
|
26
26
|
skipSignatureVerify,
|
|
27
27
|
});
|
|
@@ -7,7 +7,7 @@ export interface <%= helpers.capitalizeFirstLetter(dataSource.key) %>Values {
|
|
|
7
7
|
/**
|
|
8
8
|
* <%= dataSource.label %>
|
|
9
9
|
*
|
|
10
|
-
* @description
|
|
10
|
+
* @description <%- dataSource.description %>
|
|
11
11
|
*/
|
|
12
12
|
export const <%= dataSource.key %> = {
|
|
13
13
|
perform: (
|
|
@@ -7,7 +7,7 @@ export interface <%= helpers.capitalizeFirstLetter(trigger.key) %>Values {
|
|
|
7
7
|
/**
|
|
8
8
|
* <%= trigger.label %>
|
|
9
9
|
*
|
|
10
|
-
* @description
|
|
10
|
+
* @description <%- trigger.description %>
|
|
11
11
|
*/
|
|
12
12
|
export const <%= trigger.key %> = {
|
|
13
13
|
perform: <TReturn>(
|
|
@@ -2,4 +2,4 @@ import type { Imports } from "../componentManifest/getImports";
|
|
|
2
2
|
export interface CreateDependencyImportsProps {
|
|
3
3
|
imports: Imports;
|
|
4
4
|
}
|
|
5
|
-
export declare const createDependencyImports: ({ imports
|
|
5
|
+
export declare const createDependencyImports: ({ imports }: CreateDependencyImportsProps) => string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createDependencyImports = void 0;
|
|
4
|
-
const createDependencyImports = ({ imports
|
|
4
|
+
const createDependencyImports = ({ imports }) => {
|
|
5
5
|
return Object.entries(imports).map(([module, types]) => {
|
|
6
6
|
return `import type { ${types.join(", ")} } from "${module}";`;
|
|
7
7
|
});
|
|
@@ -8,5 +8,5 @@ interface CreateFlagHelpTextProps {
|
|
|
8
8
|
};
|
|
9
9
|
command: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const createFlagHelpText: ({ flags, command
|
|
11
|
+
export declare const createFlagHelpText: ({ flags, command }: CreateFlagHelpTextProps) => void;
|
|
12
12
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createFlagHelpText = void 0;
|
|
4
|
-
const createFlagHelpText = ({ flags, command
|
|
4
|
+
const createFlagHelpText = ({ flags, command }) => {
|
|
5
5
|
console.log(`Usage: ${command} [options]\n`);
|
|
6
6
|
console.log("Options:");
|
|
7
7
|
let longestFlag = 0;
|