@prismatic-io/spectral
Advanced tools
Comparing version 9.0.1 to 9.0.2
@@ -6,3 +6,3 @@ import { AxiosResponse } from "axios"; | ||
import { inputs } from "./inputs"; | ||
export declare type HttpClient = AxiosInstance; | ||
export type HttpClient = AxiosInstance; | ||
interface RetryConfig extends Omit<IAxiosRetryConfig, "retryDelay"> { | ||
@@ -24,3 +24,3 @@ retryDelay?: IAxiosRetryConfig["retryDelay"] | number; | ||
export declare const handleErrors: (error: unknown) => unknown; | ||
declare type SendRawRequestValues = ActionInputParameters<typeof inputs>; | ||
type SendRawRequestValues = ActionInputParameters<typeof inputs>; | ||
export declare const sendRawRequest: (baseUrl: string, values: SendRawRequestValues, authorizationHeaders?: Record<string, string>) => Promise<AxiosResponse>; | ||
@@ -27,0 +27,0 @@ export declare const buildRawRequestAction: (baseUrl: string, label?: string, description?: string) => import("../..").ActionDefinition<{ |
@@ -102,4 +102,4 @@ "use strict"; | ||
params, | ||
maxContentLength: Infinity, | ||
maxBodyLength: Infinity, | ||
maxContentLength: Number.POSITIVE_INFINITY, | ||
maxBodyLength: Number.POSITIVE_INFINITY, | ||
}); | ||
@@ -117,5 +117,3 @@ if (debug) { | ||
timeout, | ||
data: dataSize > 1024 * 10 || Buffer.isBuffer(data) | ||
? `<data (${dataSize} bytes)>` | ||
: data, | ||
data: dataSize > 1024 * 10 || Buffer.isBuffer(data) ? `<data (${dataSize} bytes)>` : data, | ||
}, true, true)); | ||
@@ -132,5 +130,3 @@ return request; | ||
statusText, | ||
data: dataSize > 1024 * 10 || Buffer.isBuffer(data) | ||
? `<data (${dataSize} bytes)>` | ||
: data, | ||
data: dataSize > 1024 * 10 || Buffer.isBuffer(data) ? `<data (${dataSize} bytes)>` : data, | ||
}, true, true)); | ||
@@ -160,3 +156,3 @@ return response; | ||
exports.handleErrors = handleErrors; | ||
const sendRawRequest = (baseUrl, values, authorizationHeaders = {}) => __awaiter(void 0, void 0, void 0, function* () { | ||
const sendRawRequest = (baseUrl_1, values_1, ...args_1) => __awaiter(void 0, [baseUrl_1, values_1, ...args_1], void 0, function* (baseUrl, values, authorizationHeaders = {}) { | ||
if (values.data && (!(0, lodash_1.isEmpty)(values.formData) || !(0, lodash_1.isEmpty)(values.fileData))) { | ||
@@ -163,0 +159,0 @@ throw new Error("Cannot specify both Data and File/Form Data."); |
@@ -17,8 +17,3 @@ "use strict"; | ||
]; | ||
const supportedResponseTypes = [ | ||
"arraybuffer", | ||
"document", | ||
"json", | ||
"text", | ||
]; | ||
const supportedResponseTypes = ["arraybuffer", "document", "json", "text"]; | ||
exports.url = (0, __1.input)({ | ||
@@ -146,3 +141,3 @@ label: "URL", | ||
comments: "File names to apply to the file data inputs. Keys must match the file data keys above.", | ||
clean: (values) => values ? __1.util.types.keyValPairListToObject(values) : undefined, | ||
clean: (values) => (values ? __1.util.types.keyValPairListToObject(values) : undefined), | ||
}); | ||
@@ -149,0 +144,0 @@ exports.debugRequest = (0, __1.input)({ |
import { ConditionalExpression } from "./types"; | ||
export declare type ValidationResult = [boolean] | [boolean, string]; | ||
export type ValidationResult = [boolean] | [boolean, string]; | ||
export declare const validate: (expression: ConditionalExpression) => ValidationResult; | ||
@@ -4,0 +4,0 @@ /** Convert stringified objects/values back to their native value, all other |
@@ -26,3 +26,3 @@ "use strict"; | ||
const validate = (expression) => { | ||
if (!(expression instanceof Array)) { | ||
if (!Array.isArray(expression)) { | ||
return [false, `Invalid expression syntax: '${expression}'`]; | ||
@@ -71,4 +71,3 @@ } | ||
// Array member check. | ||
return (container.includes(containee) || | ||
container.includes((0, exports.parseValue)(containee))); | ||
return container.includes(containee) || container.includes((0, exports.parseValue)(containee)); | ||
} | ||
@@ -169,5 +168,5 @@ // Object attribute check (set membership). | ||
case types_1.UnaryOperator.doesNotExist: | ||
return [undefined, null, 0, NaN, false, ""].includes(left); | ||
return [undefined, null, 0, Number.NaN, false, ""].includes(left); | ||
case types_1.UnaryOperator.exists: | ||
return ![undefined, null, 0, NaN, false, ""].includes(left); | ||
return ![undefined, null, 0, Number.NaN, false, ""].includes(left); | ||
case types_1.UnaryOperator.isEmpty: | ||
@@ -205,7 +204,3 @@ if (Array.isArray(left)) { | ||
if (operator in | ||
[ | ||
types_1.BinaryOperator.dateTimeAfter, | ||
types_1.BinaryOperator.dateTimeBefore, | ||
types_1.BinaryOperator.dateTimeSame, | ||
]) { | ||
[types_1.BinaryOperator.dateTimeAfter, types_1.BinaryOperator.dateTimeBefore, types_1.BinaryOperator.dateTimeSame]) { | ||
left = (0, exports.parseDate)(leftTerm); | ||
@@ -212,0 +207,0 @@ right = (0, exports.parseDate)(rightTerm); |
@@ -60,3 +60,3 @@ export declare enum BooleanOperator { | ||
}; | ||
export declare type TermOperator = UnaryOperator | BinaryOperator; | ||
export type TermOperator = UnaryOperator | BinaryOperator; | ||
export declare const TermOperatorPhrase: { | ||
@@ -87,8 +87,8 @@ equal: string; | ||
}; | ||
export declare type Term = unknown; | ||
export declare type TermExpression = [TermOperator, Term, Term?]; | ||
export declare type BooleanExpression = [ | ||
export type Term = unknown; | ||
export type TermExpression = [TermOperator, Term, Term?]; | ||
export type BooleanExpression = [ | ||
BooleanOperator.and | BooleanOperator.or, | ||
...ConditionalExpression[] | ||
]; | ||
export declare type ConditionalExpression = TermExpression | BooleanExpression; | ||
export type ConditionalExpression = TermExpression | BooleanExpression; |
@@ -10,3 +10,3 @@ "use strict"; | ||
BooleanOperator["or"] = "or"; | ||
})(BooleanOperator = exports.BooleanOperator || (exports.BooleanOperator = {})); | ||
})(BooleanOperator || (exports.BooleanOperator = BooleanOperator = {})); | ||
exports.BooleanOperatorPhrase = Object.keys(BooleanOperator); | ||
@@ -21,3 +21,3 @@ var UnaryOperator; | ||
UnaryOperator["isNotEmpty"] = "isNotEmpty"; | ||
})(UnaryOperator = exports.UnaryOperator || (exports.UnaryOperator = {})); | ||
})(UnaryOperator || (exports.UnaryOperator = UnaryOperator = {})); | ||
exports.UnaryOperatorPhrase = { | ||
@@ -50,3 +50,3 @@ [UnaryOperator.isTrue]: "is true", | ||
BinaryOperator["dateTimeSame"] = "dateTimeSame"; | ||
})(BinaryOperator = exports.BinaryOperator || (exports.BinaryOperator = {})); | ||
})(BinaryOperator || (exports.BinaryOperator = BinaryOperator = {})); | ||
exports.BinaryOperatorPhrase = { | ||
@@ -53,0 +53,0 @@ [BinaryOperator.equal]: "equals", |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
export declare const runMain: (process: NodeJS.Process) => Promise<void>; |
@@ -107,7 +107,3 @@ "use strict"; | ||
!(0, util_1.isObjectWithTruthyKeys)(component, ["key", "display"]) || | ||
!(0, util_1.isObjectWithOneTruthyKey)(component, [ | ||
"actions", | ||
"connections", | ||
"dataSources", | ||
])) { | ||
!(0, util_1.isObjectWithOneTruthyKey)(component, ["actions", "connections", "dataSources"])) { | ||
console.error("Component is invalid."); | ||
@@ -131,5 +127,3 @@ process.exit(1); | ||
? flags.output_dir.value | ||
: path_1.default.join(componentDir, "..", flags.name.value | ||
? flags.name.value | ||
: `${path_1.default.basename(componentDir)}-manifest`), | ||
: path_1.default.join(componentDir, "..", flags.name.value ? flags.name.value : `${path_1.default.basename(componentDir)}-manifest`), | ||
registry: (_b = flags.registry.value) !== null && _b !== void 0 ? _b : null, | ||
@@ -136,0 +130,0 @@ }); |
@@ -21,4 +21,4 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createActions = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
var _a, _b; | ||
const createActions = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
var _b, _c; | ||
if (verbose) { | ||
@@ -28,3 +28,3 @@ console.info("Creating actions..."); | ||
const actionIndex = yield renderActionsIndex({ | ||
actions: Object.entries((_a = component.actions) !== null && _a !== void 0 ? _a : {}).map(([actionKey, action]) => { | ||
actions: Object.entries((_b = component.actions) !== null && _b !== void 0 ? _b : {}).map(([actionKey, action]) => { | ||
return { | ||
@@ -39,3 +39,3 @@ key: action.key || actionKey, | ||
}); | ||
const actions = yield Promise.all(Object.entries((_b = component.actions) !== null && _b !== void 0 ? _b : {}).map(([actionKey, action]) => __awaiter(void 0, void 0, void 0, function* () { | ||
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]) { | ||
const inputs = (0, getInputs_1.getInputs)({ | ||
@@ -68,3 +68,3 @@ inputs: action.inputs, | ||
exports.createActions = createActions; | ||
const renderActionsIndex = ({ actions, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderActionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ actions, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -80,3 +80,3 @@ source: path_1.default.join(sourceDir, "actions", "index.ts.ejs"), | ||
}); | ||
const renderAction = ({ action, dryRun, imports, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderAction = (_a) => __awaiter(void 0, [_a], void 0, function* ({ action, dryRun, imports, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -83,0 +83,0 @@ source: path_1.default.join(sourceDir, "actions", "action.ts.ejs"), |
@@ -21,4 +21,4 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createConnections = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
var _a, _b; | ||
const createConnections = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
var _b, _c; | ||
if (verbose) { | ||
@@ -28,3 +28,3 @@ console.info("Creating connections..."); | ||
const connectionIndex = yield renderConnectionsIndex({ | ||
connections: ((_a = component.connections) !== null && _a !== void 0 ? _a : []).map((connection) => { | ||
connections: ((_b = component.connections) !== null && _b !== void 0 ? _b : []).map((connection) => { | ||
return { | ||
@@ -39,3 +39,3 @@ key: connection.key, | ||
}); | ||
const connections = yield Promise.all(((_b = component.connections) !== null && _b !== void 0 ? _b : []).map((connection) => __awaiter(void 0, void 0, void 0, function* () { | ||
const connections = yield Promise.all(((_c = component.connections) !== null && _c !== void 0 ? _c : []).map((connection) => __awaiter(void 0, void 0, void 0, function* () { | ||
const inputs = (0, getInputs_1.getInputs)({ | ||
@@ -70,3 +70,3 @@ inputs: connection.inputs, | ||
exports.createConnections = createConnections; | ||
const renderConnectionsIndex = ({ connections, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderConnectionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ connections, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -82,3 +82,3 @@ source: path_1.default.join(sourceDir, "connections", "index.ts.ejs"), | ||
}); | ||
const renderConnection = ({ connection, dryRun, imports, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderConnection = (_a) => __awaiter(void 0, [_a], void 0, function* ({ connection, dryRun, imports, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -85,0 +85,0 @@ source: path_1.default.join(sourceDir, "connections", "connection.ts.ejs"), |
@@ -21,4 +21,4 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createDataSources = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
var _a, _b; | ||
const createDataSources = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
var _b, _c; | ||
if (verbose) { | ||
@@ -28,3 +28,3 @@ console.info("Creating data sources..."); | ||
const dataSourceIndex = yield renderDataSourcesIndex({ | ||
dataSources: Object.entries((_a = component.dataSources) !== null && _a !== void 0 ? _a : {}).map(([dataSourceKey, dataSource]) => { | ||
dataSources: Object.entries((_b = component.dataSources) !== null && _b !== void 0 ? _b : {}).map(([dataSourceKey, dataSource]) => { | ||
return { | ||
@@ -39,3 +39,3 @@ key: dataSource.key || dataSourceKey, | ||
}); | ||
const dataSources = yield Promise.all(Object.entries((_b = component.dataSources) !== null && _b !== void 0 ? _b : {}).map(([dataSourceKey, dataSource]) => __awaiter(void 0, void 0, void 0, function* () { | ||
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]) { | ||
const inputs = (0, getInputs_1.getInputs)({ | ||
@@ -69,3 +69,3 @@ inputs: dataSource.inputs, | ||
exports.createDataSources = createDataSources; | ||
const renderDataSourcesIndex = ({ dataSources, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderDataSourcesIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dataSources, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -81,3 +81,3 @@ source: path_1.default.join(sourceDir, "dataSources", "index.ts.ejs"), | ||
}); | ||
const renderDataSource = ({ dataSource, dryRun, imports, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderDataSource = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dataSource, dryRun, imports, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -84,0 +84,0 @@ source: path_1.default.join(sourceDir, "dataSources", "dataSource.ts.ejs"), |
@@ -19,3 +19,3 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createStaticFiles = ({ component, dryRun, signature, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const createStaticFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, signature, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) { | ||
if (verbose) { | ||
@@ -74,4 +74,3 @@ console.info("Creating static files..."); | ||
key: Object.keys(component.dataSources)[0], | ||
type: component.dataSources[Object.keys(component.dataSources)[0]] | ||
.dataSourceType, | ||
type: component.dataSources[Object.keys(component.dataSources)[0]].dataSourceType, | ||
} | ||
@@ -97,3 +96,3 @@ : null, | ||
exports.createStaticFiles = createStaticFiles; | ||
const renderIndex = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -110,3 +109,3 @@ source: path_1.default.join(sourceDir, "index.ts.ejs"), | ||
exports.renderIndex = renderIndex; | ||
const renderPackageJson = ({ dryRun, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderPackageJson = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -127,3 +126,3 @@ source: path_1.default.join(sourceDir, "package.json.ejs"), | ||
exports.renderPackageJson = renderPackageJson; | ||
const renderTsConfig = ({ dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderTsConfig = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -137,3 +136,3 @@ source: path_1.default.join(sourceDir, "tsconfig.json.ejs"), | ||
exports.renderTsConfig = renderTsConfig; | ||
const renderReadme = ({ component, dryRun, packageName, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderReadme = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, packageName, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -140,0 +139,0 @@ source: path_1.default.join(sourceDir, "README.md.ejs"), |
@@ -21,4 +21,4 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createTriggers = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
var _a, _b; | ||
const createTriggers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
var _b, _c; | ||
if (verbose) { | ||
@@ -28,3 +28,3 @@ console.info("Creating triggers..."); | ||
const triggersIndex = yield renderTriggersIndex({ | ||
triggers: Object.entries((_a = component.triggers) !== null && _a !== void 0 ? _a : {}).map(([triggerKey, trigger]) => { | ||
triggers: Object.entries((_b = component.triggers) !== null && _b !== void 0 ? _b : {}).map(([triggerKey, trigger]) => { | ||
return { | ||
@@ -39,3 +39,3 @@ key: trigger.key || triggerKey, | ||
}); | ||
const triggers = yield Promise.all(Object.entries((_b = component.triggers) !== null && _b !== void 0 ? _b : {}).map(([triggerKey, trigger]) => __awaiter(void 0, void 0, void 0, function* () { | ||
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]) { | ||
const inputs = (0, getInputs_1.getInputs)({ | ||
@@ -68,3 +68,3 @@ inputs: trigger.inputs, | ||
exports.createTriggers = createTriggers; | ||
const renderTriggersIndex = ({ triggers, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderTriggersIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ triggers, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -80,3 +80,3 @@ source: path_1.default.join(sourceDir, "triggers", "index.ts.ejs"), | ||
}); | ||
const renderTrigger = ({ dryRun, imports, trigger, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const renderTrigger = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, imports, trigger, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -83,0 +83,0 @@ source: path_1.default.join(sourceDir, "triggers", "trigger.ts.ejs"), |
@@ -36,6 +36,4 @@ "use strict"; | ||
} | ||
return value.endsWith(".") || value.endsWith("!") || value.endsWith("?") | ||
? value | ||
: value + "."; | ||
return value.endsWith(".") || value.endsWith("!") || value.endsWith("?") ? value : `${value}.`; | ||
}; | ||
exports.addPunctuation = addPunctuation; |
import type { Input } from "./getInputs"; | ||
export declare type Imports = Record<string, string[]>; | ||
export type Imports = Record<string, string[]>; | ||
interface GetImportsProps { | ||
@@ -4,0 +4,0 @@ inputs: Input[]; |
import type { Input as InputBase } from "../../serverTypes"; | ||
import type { InputFieldDefinition } from "../../types/Inputs"; | ||
export declare type ServerTypeInput = InputBase & { | ||
export type ServerTypeInput = InputBase & { | ||
onPremControlled?: boolean; | ||
@@ -15,7 +15,7 @@ shown?: boolean; | ||
} | ||
export declare type ValueType = string | { | ||
export type ValueType = string | { | ||
type: string; | ||
module: string; | ||
}; | ||
export declare type DocBlock = { | ||
export type DocBlock = { | ||
inputKey?: string; | ||
@@ -30,4 +30,4 @@ propertyKey: keyof ServerTypeInput; | ||
} | ||
export declare const getInputs: ({ inputs, docBlock, }: GetInputsProps) => Input[]; | ||
export declare const getInputs: ({ inputs, docBlock }: GetInputsProps) => Input[]; | ||
export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"], ValueType>; | ||
export {}; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const docBlock_1 = require("./docBlock"); | ||
const getInputs = ({ inputs, docBlock = docBlock_1.DOC_BLOCK_DEFAULT, }) => { | ||
const getInputs = ({ inputs, docBlock = docBlock_1.DOC_BLOCK_DEFAULT }) => { | ||
return inputs.reduce((acc, input) => { | ||
@@ -20,4 +20,3 @@ if ((typeof input.shown === "boolean" && input.shown === false) || | ||
valueType: getInputValueType(input), | ||
required: input.required && | ||
(input.default === undefined || input.default === ""), | ||
required: input.required && (input.default === undefined || input.default === ""), | ||
collection: input.collection, | ||
@@ -24,0 +23,0 @@ onPremControlled: input.onPremiseControlled || input.onPremControlled, |
export declare const helpers: { | ||
createDependencyImports: ({ imports, }: import("../utils/createDependencyImports").CreateDependencyImportsProps) => string[]; | ||
createDependencyImports: ({ imports }: import("../utils/createDependencyImports").CreateDependencyImportsProps) => string[]; | ||
capitalizeFirstLetter: (value: string) => string; | ||
generatePackageJsonVersion: () => string; | ||
}; |
@@ -24,3 +24,3 @@ "use strict"; | ||
const getComponentSignatureWithPrism_1 = require("../utils/getComponentSignatureWithPrism"); | ||
const createComponentManifest = ({ component, dryRun, skipSignatureVerify, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const createComponentManifest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, skipSignatureVerify, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) { | ||
const signature = yield (0, getComponentSignatureWithPrism_1.getComponentSignatureWithPrism)({ | ||
@@ -27,0 +27,0 @@ skipSignatureVerify, |
@@ -5,2 +5,2 @@ import type { Imports } from "../componentManifest/getImports"; | ||
} | ||
export declare const createDependencyImports: ({ imports, }: CreateDependencyImportsProps) => string[]; | ||
export declare const createDependencyImports: ({ imports }: CreateDependencyImportsProps) => string[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createDependencyImports = void 0; | ||
const createDependencyImports = ({ imports, }) => { | ||
const createDependencyImports = ({ imports }) => { | ||
return Object.entries(imports).map(([module, types]) => { | ||
@@ -6,0 +6,0 @@ return `import type { ${types.join(", ")} } from "${module}";`; |
@@ -11,3 +11,3 @@ interface CreateFlagHelpTextProps { | ||
} | ||
export declare const createFlagHelpText: ({ flags, command, }: CreateFlagHelpTextProps) => void; | ||
export declare const createFlagHelpText: ({ flags, command }: CreateFlagHelpTextProps) => void; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createFlagHelpText = void 0; | ||
const createFlagHelpText = ({ flags, command, }) => { | ||
const createFlagHelpText = ({ flags, command }) => { | ||
console.log(`Usage: ${command} [options]\n`); | ||
@@ -6,0 +6,0 @@ console.log("Options:"); |
@@ -20,3 +20,3 @@ "use strict"; | ||
const prettier_1 = require("prettier"); | ||
const createTemplate = ({ source, destination = source.replace(/\.ejs$/, ""), data = {}, dryRun, verbose, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const createTemplate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ source, destination = source.replace(/\.ejs$/, ""), data = {}, dryRun, verbose, }) { | ||
if (!source) { | ||
@@ -29,3 +29,3 @@ throw new Error("Source is required"); | ||
const formattedRender = [".ts", ".js"].includes(path_1.default.extname(destination)) | ||
? (0, prettier_1.format)(render, { | ||
? yield (0, prettier_1.format)(render, { | ||
parser: "typescript", | ||
@@ -32,0 +32,0 @@ }) |
@@ -16,3 +16,3 @@ "use strict"; | ||
const exec = (0, util_1.promisify)(child_process_1.exec); | ||
const getComponentSignatureWithPrism = ({ skipSignatureVerify, }) => __awaiter(void 0, void 0, void 0, function* () { | ||
const getComponentSignatureWithPrism = (_a) => __awaiter(void 0, [_a], void 0, function* ({ skipSignatureVerify, }) { | ||
if (!(yield isPrismAvailable())) { | ||
@@ -19,0 +19,0 @@ console.log("Prism must be installed."); |
@@ -5,3 +5,3 @@ interface GetFlagBooleanValueProps { | ||
} | ||
export declare const getFlagBooleanValue: ({ args, flag, }: GetFlagBooleanValueProps) => boolean; | ||
export declare const getFlagBooleanValue: ({ args, flag }: GetFlagBooleanValueProps) => boolean; | ||
interface GetFlagsBooleanValueProps { | ||
@@ -11,3 +11,3 @@ args: string[]; | ||
} | ||
export declare const getFlagsBooleanValue: ({ args, flags, }: GetFlagsBooleanValueProps) => boolean; | ||
export declare const getFlagsBooleanValue: ({ args, flags }: GetFlagsBooleanValueProps) => boolean; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getFlagsBooleanValue = exports.getFlagBooleanValue = void 0; | ||
const getFlagBooleanValue = ({ args, flag, }) => { | ||
const getFlagBooleanValue = ({ args, flag }) => { | ||
return args.includes(flag); | ||
}; | ||
exports.getFlagBooleanValue = getFlagBooleanValue; | ||
const getFlagsBooleanValue = ({ args, flags, }) => { | ||
const getFlagsBooleanValue = ({ args, flags }) => { | ||
return flags.reduce((acc, flag) => { | ||
@@ -10,0 +10,0 @@ const value = (0, exports.getFlagBooleanValue)({ args, flag }); |
@@ -5,3 +5,3 @@ interface GetFlagStringValueProps { | ||
} | ||
export declare const getFlagStringValue: ({ args, flag, }: GetFlagStringValueProps) => string | null; | ||
export declare const getFlagStringValue: ({ args, flag }: GetFlagStringValueProps) => string | null; | ||
interface GetFlagsStringValueProps { | ||
@@ -11,3 +11,3 @@ args: string[]; | ||
} | ||
export declare const getFlagsStringValue: ({ args, flags, }: GetFlagsStringValueProps) => string | null; | ||
export declare const getFlagsStringValue: ({ args, flags }: GetFlagsStringValueProps) => string | null; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getFlagsStringValue = exports.getFlagStringValue = void 0; | ||
const getFlagStringValue = ({ args, flag, }) => { | ||
const getFlagStringValue = ({ args, flag }) => { | ||
const flagIndex = args.indexOf(flag); | ||
@@ -16,3 +16,3 @@ if (flagIndex === -1) { | ||
exports.getFlagStringValue = getFlagStringValue; | ||
const getFlagsStringValue = ({ args, flags, }) => { | ||
const getFlagsStringValue = ({ args, flags }) => { | ||
return flags.reduce((acc, flag) => { | ||
@@ -19,0 +19,0 @@ const value = (0, exports.getFlagStringValue)({ args, flag }); |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, OnPremConnectionDefinition, ComponentManifest } from "./types"; | ||
import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, DataSourceType, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, OnPremConnectionDefinition, ComponentManifest } from "./types"; | ||
import { convertComponent } from "./serverTypes/convertComponent"; | ||
@@ -97,17 +97,3 @@ import { convertIntegration } from "./serverTypes/convertIntegration"; | ||
*/ | ||
export declare const dataSource: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends keyof { | ||
string: string; | ||
date: string; | ||
timestamp: string; | ||
picklist: string[] | import("./types").Element[]; | ||
schedule: { | ||
value: string; | ||
}; | ||
code: string; | ||
boolean: boolean; | ||
number: number; | ||
objectSelection: import("./types").ObjectSelection; | ||
objectFieldMap: import("./types").ObjectFieldMap; | ||
jsonForm: import("./types").JSONForm; | ||
}>(definition: DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>) => DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>; | ||
export declare const dataSource: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType>(definition: DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>) => DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>; | ||
/** | ||
@@ -114,0 +100,0 @@ * For information and examples on how to write inputs |
@@ -20,5 +20,3 @@ "use strict"; | ||
var { default: defaultValue, type, label, collection } = _a, rest = __rest(_a, ["default", "type", "label", "collection"]); | ||
const keyLabel = collection === "keyvaluelist" && typeof label === "object" | ||
? label.key | ||
: undefined; | ||
const keyLabel = collection === "keyvaluelist" && typeof label === "object" ? label.key : undefined; | ||
return Object.assign(Object.assign({}, (0, lodash_1.omit)(rest, ["onPremControlled"])), { key, | ||
@@ -25,0 +23,0 @@ type, default: defaultValue !== null && defaultValue !== void 0 ? defaultValue : types_1.InputFieldDefaultMap[type], collection, label: typeof label === "string" ? label : label.value, keyLabel, onPremiseControlled: ("onPremControlled" in rest && rest.onPremControlled) || undefined }); |
@@ -86,8 +86,4 @@ "use strict"; | ||
: triggerPreprocessFlowConfig; | ||
const nonPreprocessFlowTypes = [ | ||
"instance_specific", | ||
"shared_instance", | ||
]; | ||
if (nonPreprocessFlowTypes.includes(endpointType || "flow_specific") && | ||
!preprocessFlowConfig) { | ||
const nonPreprocessFlowTypes = ["instance_specific", "shared_instance"]; | ||
if (nonPreprocessFlowTypes.includes(endpointType || "flow_specific") && !preprocessFlowConfig) { | ||
throw new Error("Integration with specified EndpointType must define either a Trigger Preprocess Flow Config or a Preprocess Flow."); | ||
@@ -163,3 +159,3 @@ } | ||
}; | ||
const convertComponentReference = (componentReference, componentRegistry) => { | ||
const convertComponentReference = (componentReference, componentRegistry, referenceType) => { | ||
var _a, _b; | ||
@@ -178,6 +174,12 @@ const manifest = componentRegistry[componentReference.component]; | ||
}; | ||
const manifestEntry = manifest[referenceType][componentReference.key]; | ||
const inputs = Object.entries((_b = componentReference.values) !== null && _b !== void 0 ? _b : {}).reduce((result, [key, value]) => { | ||
const manifestEntryInput = manifestEntry.inputs[key]; | ||
const type = manifestEntryInput.collection | ||
? "complex" | ||
: "value" in value | ||
? "value" | ||
: "configVar"; | ||
if ("value" in value) { | ||
const type = value.value instanceof Object ? "complex" : "value"; | ||
const valueExpr = value.value instanceof Object && !Array.isArray(value.value) | ||
const valueExpr = manifestEntryInput.collection === "keyvaluelist" && value.value instanceof Object | ||
? Object.entries(value.value).map(([k, v]) => ({ | ||
@@ -189,7 +191,5 @@ name: { type: "value", value: k }, | ||
: value.value; | ||
const meta = convertInputPermissionAndVisibility((0, lodash_1.pick)(value, [ | ||
"permissionAndVisibilityType", | ||
"visibleToOrgDeployer", | ||
])); | ||
return Object.assign(Object.assign({}, result), { [key]: { type: type, value: valueExpr, meta } }); | ||
const formattedValue = type === "complex" || typeof valueExpr === "string" ? valueExpr : JSON.stringify(valueExpr); | ||
const meta = convertInputPermissionAndVisibility((0, lodash_1.pick)(value, ["permissionAndVisibilityType", "visibleToOrgDeployer"])); | ||
return Object.assign(Object.assign({}, result), { [key]: { type: type, value: formattedValue, meta } }); | ||
} | ||
@@ -226,9 +226,9 @@ if ("configVar" in value) { | ||
const result = Object.assign({}, flow); | ||
delete result.onTrigger; | ||
delete result.trigger; | ||
delete result.onInstanceDeploy; | ||
delete result.onInstanceDelete; | ||
delete result.onExecution; | ||
delete result.preprocessFlowConfig; | ||
delete result.errorConfig; | ||
result.onTrigger = undefined; | ||
result.trigger = undefined; | ||
result.onInstanceDeploy = undefined; | ||
result.onInstanceDelete = undefined; | ||
result.onExecution = undefined; | ||
result.preprocessFlowConfig = undefined; | ||
result.errorConfig = undefined; | ||
const triggerStep = { | ||
@@ -248,3 +248,3 @@ name: "On Trigger", | ||
else if ((0, types_1.isComponentReference)(flow.onTrigger)) { | ||
const { ref, inputs } = convertComponentReference(flow.onTrigger, componentRegistry); | ||
const { ref, inputs } = convertComponentReference(flow.onTrigger, componentRegistry, "triggers"); | ||
triggerStep.action = ref; | ||
@@ -278,3 +278,3 @@ triggerStep.inputs = inputs; | ||
}; | ||
delete result.schedule; | ||
result.schedule = undefined; | ||
} | ||
@@ -305,3 +305,3 @@ const actionStep = { | ||
key, | ||
value, | ||
value: typeof value === "string" ? value : JSON.stringify(value), | ||
})); | ||
@@ -313,6 +313,3 @@ }; | ||
if ((0, types_1.isConnectionDefinitionConfigVar)(configVar)) { | ||
const { stableKey, description } = (0, lodash_1.pick)(configVar, [ | ||
"stableKey", | ||
"description", | ||
]); | ||
const { stableKey, description } = (0, lodash_1.pick)(configVar, ["stableKey", "description"]); | ||
return { | ||
@@ -342,3 +339,3 @@ stableKey, | ||
if ((0, types_1.isConnectionReferenceConfigVar)(configVar)) { | ||
const { ref, inputs } = convertComponentReference(configVar.connection, componentRegistry); | ||
const { ref, inputs } = convertComponentReference(configVar.connection, componentRegistry, "connections"); | ||
const { stableKey = "", description, connection: { template, onPremiseConnectionConfig }, } = (0, lodash_1.pick)(configVar, ["stableKey", "description", "connection"]); | ||
@@ -385,5 +382,4 @@ return { | ||
if ((0, types_1.isDataSourceReferenceConfigVar)(configVar)) { | ||
const { ref, inputs } = convertComponentReference(configVar.dataSource, componentRegistry); | ||
result.dataType = | ||
componentRegistry[ref.component.key]["dataSources"][ref.key]["dataSourceType"]; | ||
const { ref, inputs } = convertComponentReference(configVar.dataSource, componentRegistry, "dataSources"); | ||
result.dataType = componentRegistry[ref.component.key].dataSources[ref.key].dataSourceType; | ||
result.dataSource = ref; | ||
@@ -395,5 +391,3 @@ result.inputs = inputs; | ||
/** Maps the step name field to a fully qualified input. */ | ||
const fieldNameToReferenceInput = (stepName, fieldName) => fieldName | ||
? { type: "reference", value: `${stepName}.results.${fieldName}` } | ||
: undefined; | ||
const fieldNameToReferenceInput = (stepName, fieldName) => fieldName ? { type: "reference", value: `${stepName}.results.${fieldName}` } : undefined; | ||
/** Actions and Triggers will be scoped to their flow by combining the flow | ||
@@ -407,5 +401,3 @@ * name and the function name. This is to ensure that the keys are unique | ||
.split(" ") | ||
.map((w, i) => i === 0 | ||
? w.toLowerCase() | ||
: w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()) | ||
.map((w, i) => i === 0 ? w.toLowerCase() : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()) | ||
.join(""); | ||
@@ -418,6 +410,5 @@ return `${flowKey}_${functionName}`; | ||
_components } = context, remainingContext = __rest(context, ["_components"]); | ||
const invoke = _components | ||
.invoke; | ||
const invoke = _components.invoke; | ||
// Construct the component methods from the component registry | ||
const componentMethods = Object.entries(componentRegistry).reduce((accumulator, [registryComponentKey, { key: componentKey, actions, public: isPublic, signature },]) => { | ||
const componentMethods = Object.entries(componentRegistry).reduce((accumulator, [registryComponentKey, { key: componentKey, actions, public: isPublic, signature }]) => { | ||
const componentActions = Object.entries(actions).reduce((actionsAccumulator, [actionKey, action]) => { | ||
@@ -449,3 +440,3 @@ // Define the method to be called for the action | ||
* Code Native integration. */ | ||
const codeNativeIntegrationComponent = ({ name, iconPath, description, flows = [], componentRegistry = {}, }, referenceKey, configVars) => { | ||
const codeNativeIntegrationComponent = ({ name, iconPath, description, flows = [], componentRegistry = {} }, referenceKey, configVars) => { | ||
const convertedActions = flows.reduce((result, { name, onExecution }) => { | ||
@@ -452,0 +443,0 @@ const key = flowFunctionKey(name, "onExecution"); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { InstanceAttributes, CustomerAttributes, DataSourceType, DataSourceResultType, UserAttributes, TriggerEventFunctionReturn, IntegrationAttributes, FlowAttributes, ConfigVarResultCollection, ComponentManifest } from "../types"; | ||
@@ -41,3 +40,3 @@ interface DisplayDefinition { | ||
} | ||
export declare type ActionLoggerFunction = (...args: unknown[]) => void; | ||
export type ActionLoggerFunction = (...args: unknown[]) => void; | ||
export interface ActionLogger { | ||
@@ -52,3 +51,3 @@ metric: ActionLoggerFunction; | ||
} | ||
export declare type ActionContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TComponentActions extends Record<string, ComponentManifest["actions"]> = Record<string, ComponentManifest["actions"]>> = { | ||
export type ActionContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TComponentActions extends Record<string, ComponentManifest["actions"]> = Record<string, ComponentManifest["actions"]>> = { | ||
logger: ActionLogger; | ||
@@ -77,3 +76,3 @@ instanceState: Record<string, unknown>; | ||
}; | ||
declare type TriggerOptionChoice = "invalid" | "valid" | "required"; | ||
type TriggerOptionChoice = "invalid" | "valid" | "required"; | ||
export interface TriggerPayload { | ||
@@ -121,6 +120,6 @@ headers: Record<string, string>; | ||
} | ||
export declare type TriggerResult = TriggerBranchingResult | TriggerBaseResult | undefined; | ||
export declare type TriggerPerformFunction = (context: ActionContext, payload: TriggerPayload, params: Record<string, unknown>) => Promise<TriggerResult>; | ||
export declare type TriggerEventFunctionResult = TriggerEventFunctionReturn | void; | ||
export declare type TriggerEventFunction = (context: ActionContext, params: Record<string, unknown>) => Promise<TriggerEventFunctionResult>; | ||
export type TriggerResult = TriggerBranchingResult | TriggerBaseResult | undefined; | ||
export type TriggerPerformFunction = (context: ActionContext, payload: TriggerPayload, params: Record<string, unknown>) => Promise<TriggerResult>; | ||
export type TriggerEventFunctionResult = TriggerEventFunctionReturn | void; | ||
export type TriggerEventFunction = (context: ActionContext, params: Record<string, unknown>) => Promise<TriggerEventFunctionResult>; | ||
export interface Trigger { | ||
@@ -155,3 +154,3 @@ key: string; | ||
} | ||
export declare type DataSourceResult = { | ||
export type DataSourceResult = { | ||
result: DataSourceResultType; | ||
@@ -163,3 +162,3 @@ supplementalData?: { | ||
}; | ||
export declare type DataSourcePerformFunction = (context: DataSourceContext, params: Record<string, unknown>) => Promise<DataSourceResult>; | ||
export type DataSourcePerformFunction = (context: DataSourceContext, params: Record<string, unknown>) => Promise<DataSourceResult>; | ||
export interface DataSource { | ||
@@ -230,4 +229,4 @@ key: string; | ||
} | ||
export declare type ActionPerformReturn = ServerPerformDataStructureReturn | ServerPerformBranchingDataStructureReturn | ServerPerformDataReturn | ServerPerformBranchingDataReturn | undefined; | ||
export declare type ActionPerformFunction = (context: ActionContext, params: Record<string, unknown>) => Promise<ActionPerformReturn>; | ||
export type ActionPerformReturn = ServerPerformDataStructureReturn | ServerPerformBranchingDataStructureReturn | ServerPerformDataReturn | ServerPerformBranchingDataReturn | undefined; | ||
export type ActionPerformFunction = (context: ActionContext, params: Record<string, unknown>) => Promise<ActionPerformReturn>; | ||
interface InputFieldChoice { | ||
@@ -234,0 +233,0 @@ label: string; |
@@ -8,2 +8,2 @@ "use strict"; | ||
OAuth2Type["AuthorizationCode"] = "authorization_code"; | ||
})(OAuth2Type = exports.OAuth2Type || (exports.OAuth2Type = {})); | ||
})(OAuth2Type || (exports.OAuth2Type = OAuth2Type = {})); |
export declare const DefinitionVersion = 7; | ||
export declare type ComponentReference = { | ||
export type ComponentReference = { | ||
component: { | ||
@@ -21,3 +21,3 @@ key: string; | ||
}; | ||
export declare type Input = { | ||
export type Input = { | ||
name?: string | Input; | ||
@@ -59,3 +59,3 @@ type: "value" | "reference" | "configVar" | "template"; | ||
} | ||
export declare type RequiredConfigVariable = DefaultRequiredConfigVariable | ConnectionRequiredConfigVariable; | ||
export type RequiredConfigVariable = DefaultRequiredConfigVariable | ConnectionRequiredConfigVariable; | ||
export interface ConfigPage { | ||
@@ -62,0 +62,0 @@ name: string; |
import { ErrorHandler } from "../types"; | ||
declare type PerformFn = (...args: any[]) => Promise<any>; | ||
export declare type CleanFn = (...args: any[]) => any; | ||
export declare type InputCleaners = Record<string, CleanFn | undefined>; | ||
type PerformFn = (...args: any[]) => Promise<any>; | ||
export type CleanFn = (...args: any[]) => any; | ||
export type InputCleaners = Record<string, CleanFn | undefined>; | ||
interface CreatePerformProps { | ||
@@ -6,0 +6,0 @@ inputCleaners: InputCleaners; |
@@ -8,4 +8,4 @@ /** | ||
import { TriggerPayload, TriggerResult, ConnectionValue, ActionLogger, Component, ActionContext, ActionPerformReturn, DataSourceResult, DataSourceContext } from "./serverTypes"; | ||
import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceResult as InvokeDataSourceResult, TriggerEventFunctionReturn, Flow, ConfigVarResultCollection } from "./types"; | ||
export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>, tokenValues?: Record<string, unknown> | undefined) => ConnectionValue; | ||
import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceType, DataSourceResult as InvokeDataSourceResult, TriggerEventFunctionReturn, Flow, ConfigVarResultCollection } from "./types"; | ||
export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>, tokenValues?: Record<string, unknown>) => ConnectionValue; | ||
export declare const defaultConnectionValueEnvironmentVariable = "PRISMATIC_CONNECTION_VALUE"; | ||
@@ -31,3 +31,3 @@ export declare const connectionValue: (envVarKey?: string) => ConnectionValue; | ||
*/ | ||
export declare const invoke: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform, }: ActionDefinition<TInputs, TConfigVars, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext<TConfigVars, Record<string, Record<string, import("./types").ComponentManifestAction>>>> | undefined) => Promise<InvokeReturn<TReturn>>; | ||
export declare const invoke: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform }: ActionDefinition<TInputs, TConfigVars, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext<TConfigVars>>) => Promise<InvokeReturn<TReturn>>; | ||
export declare const defaultTriggerPayload: () => TriggerPayload; | ||
@@ -40,3 +40,3 @@ /** | ||
*/ | ||
export declare const invokeTrigger: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching, TriggerPayload>>({ perform, }: TriggerDefinition<TInputs, TConfigVars, TAllowsBranching, TResult>, context?: Partial<ActionContext<TConfigVars, Record<string, Record<string, import("./types").ComponentManifestAction>>>> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<TInputs> | undefined) => Promise<InvokeReturn<TResult>>; | ||
export declare const invokeTrigger: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching, TriggerPayload>>({ perform }: TriggerDefinition<TInputs, TConfigVars, TAllowsBranching, TResult>, context?: Partial<ActionContext<TConfigVars>>, payload?: TriggerPayload, params?: ActionInputParameters<TInputs>) => Promise<InvokeReturn<TResult>>; | ||
/** | ||
@@ -47,20 +47,6 @@ * Invokes specified DataSourceDefinition perform function using supplied params. | ||
*/ | ||
export declare const invokeDataSource: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends keyof { | ||
string: string; | ||
date: string; | ||
timestamp: string; | ||
picklist: string[] | import("./types").Element[]; | ||
schedule: { | ||
value: string; | ||
}; | ||
code: string; | ||
boolean: boolean; | ||
number: number; | ||
objectSelection: import("./types").ObjectSelection; | ||
objectFieldMap: import("./types").ObjectFieldMap; | ||
jsonForm: import("./types").JSONForm; | ||
}>({ perform }: DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>, params: ActionInputParameters<TInputs>, context?: Partial<DataSourceContext<TConfigVars>> | undefined) => Promise<InvokeDataSourceResult<TDataSourceType>>; | ||
declare type TestConnectionValue = Pick<ConnectionValue, "fields" | "context" | "token">; | ||
declare type TestConfigVarValues = Record<string, string | TestConnectionValue>; | ||
declare type ToTestValues<TConfigVars extends ConfigVarResultCollection> = { | ||
export declare const invokeDataSource: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType>({ perform }: DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>, params: ActionInputParameters<TInputs>, context?: Partial<DataSourceContext<TConfigVars>>) => Promise<InvokeDataSourceResult<TDataSourceType>>; | ||
type TestConnectionValue = Pick<ConnectionValue, "fields" | "context" | "token">; | ||
type TestConfigVarValues = Record<string, string | TestConnectionValue>; | ||
type ToTestValues<TConfigVars extends ConfigVarResultCollection> = { | ||
[K in keyof TConfigVars]: TConfigVars[K] extends ConnectionDefinition ? TestConnectionValue : string; | ||
@@ -72,6 +58,6 @@ }; | ||
*/ | ||
export declare const invokeFlow: <TConfigVars extends import("./types/utils").Prettify<{} & {}> = import("./types/utils").Prettify<{} & {}>, TConfigVarValues extends TestConfigVarValues = ToTestValues<TConfigVars>>(flow: Flow, { configVars, context, payload, }?: { | ||
configVars?: TConfigVarValues | undefined; | ||
context?: Partial<ActionContext<TConfigVars, Record<string, Record<string, import("./types").ComponentManifestAction>>>> | undefined; | ||
payload?: Partial<TriggerPayload> | undefined; | ||
export declare const invokeFlow: <TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TConfigVarValues extends TestConfigVarValues = ToTestValues<TConfigVars>>(flow: Flow, { configVars, context, payload, }?: { | ||
configVars?: TConfigVarValues; | ||
context?: Partial<ActionContext<TConfigVars>>; | ||
payload?: Partial<TriggerPayload>; | ||
}) => Promise<InvokeReturn<InvokeActionPerformReturn<false, unknown>>>; | ||
@@ -84,4 +70,4 @@ export declare class ComponentTestHarness<TComponent extends Component> { | ||
trigger<TConfigVars extends ConfigVarResultCollection>(key: string, payload?: TriggerPayload, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<TriggerResult>; | ||
triggerOnInstanceDeploy<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<void | TriggerEventFunctionReturn>; | ||
triggerOnInstanceDelete<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<void | TriggerEventFunctionReturn>; | ||
triggerOnInstanceDeploy<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<TriggerEventFunctionReturn | void>; | ||
triggerOnInstanceDelete<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<TriggerEventFunctionReturn | void>; | ||
action<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<ActionPerformReturn>; | ||
@@ -93,21 +79,7 @@ dataSource<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<DataSourceContext<TConfigVars>>): Promise<DataSourceResult>; | ||
loggerMock: () => ActionLogger; | ||
invoke: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform, }: ActionDefinition<TInputs, TConfigVars, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext<TConfigVars, Record<string, Record<string, import("./types").ComponentManifestAction>>>> | undefined) => Promise<InvokeReturn<TReturn>>; | ||
invokeTrigger: <TInputs_1 extends Inputs, TConfigVars_1 extends ConfigVarResultCollection, TAllowsBranching_1 extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching_1, TriggerPayload>>({ perform, }: TriggerDefinition<TInputs_1, TConfigVars_1, TAllowsBranching_1, TResult>, context?: Partial<ActionContext<TConfigVars_1, Record<string, Record<string, import("./types").ComponentManifestAction>>>> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<TInputs_1> | undefined) => Promise<InvokeReturn<TResult>>; | ||
invoke: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends InvokeActionPerformReturn<TAllowsBranching, unknown>>({ perform }: ActionDefinition<TInputs, TConfigVars, TAllowsBranching, TReturn>, params: ActionInputParameters<TInputs>, context?: Partial<ActionContext<TConfigVars>>) => Promise<InvokeReturn<TReturn>>; | ||
invokeTrigger: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends InvokeTriggerResult<TAllowsBranching, TriggerPayload>>({ perform }: TriggerDefinition<TInputs, TConfigVars, TAllowsBranching, TResult>, context?: Partial<ActionContext<TConfigVars>>, payload?: TriggerPayload, params?: ActionInputParameters<TInputs>) => Promise<InvokeReturn<TResult>>; | ||
createHarness: <TComponent extends Component>(component: TComponent) => ComponentTestHarness<TComponent>; | ||
invokeDataSource: <TInputs_2 extends Inputs, TConfigVars_2 extends ConfigVarResultCollection, TDataSourceType extends keyof { | ||
string: string; | ||
date: string; | ||
timestamp: string; | ||
picklist: string[] | import("./types").Element[]; | ||
schedule: { | ||
value: string; | ||
}; | ||
code: string; | ||
boolean: boolean; | ||
number: number; | ||
objectSelection: import("./types").ObjectSelection; | ||
objectFieldMap: import("./types").ObjectFieldMap; | ||
jsonForm: import("./types").JSONForm; | ||
}>({ perform }: DataSourceDefinition<TInputs_2, TConfigVars_2, TDataSourceType>, params: ActionInputParameters<TInputs_2>, context?: Partial<DataSourceContext<TConfigVars_2>> | undefined) => Promise<InvokeDataSourceResult<TDataSourceType>>; | ||
invokeDataSource: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType>({ perform }: DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>, params: ActionInputParameters<TInputs>, context?: Partial<DataSourceContext<TConfigVars>>) => Promise<InvokeDataSourceResult<TDataSourceType>>; | ||
}; | ||
export default _default; |
@@ -99,3 +99,3 @@ "use strict"; | ||
*/ | ||
const invoke = ({ perform, }, params, context) => __awaiter(void 0, void 0, void 0, function* () { | ||
const invoke = (_a, params_1, context_1) => __awaiter(void 0, [_a, params_1, context_1], void 0, function* ({ perform }, params, context) { | ||
const realizedContext = createActionContext(context); | ||
@@ -169,3 +169,3 @@ const result = yield perform(realizedContext, params); | ||
*/ | ||
const invokeTrigger = ({ perform, }, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () { | ||
const invokeTrigger = (_a, context_1, payload_1, params_1) => __awaiter(void 0, [_a, context_1, payload_1, params_1], void 0, function* ({ perform }, context, payload, params) { | ||
const realizedContext = createActionContext(context); | ||
@@ -186,3 +186,3 @@ const realizedPayload = Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload); | ||
*/ | ||
const invokeDataSource = ({ perform }, params, context) => __awaiter(void 0, void 0, void 0, function* () { | ||
const invokeDataSource = (_a, params_1, context_1) => __awaiter(void 0, [_a, params_1, context_1], void 0, function* ({ perform }, params, context) { | ||
const realizedContext = createDataSourceContext(context); | ||
@@ -206,3 +206,3 @@ const result = yield perform(realizedContext, params); | ||
*/ | ||
const invokeFlow = (flow, { configVars, context, payload, } = {}) => __awaiter(void 0, void 0, void 0, function* () { | ||
const invokeFlow = (flow_1, ...args_1) => __awaiter(void 0, [flow_1, ...args_1], void 0, function* (flow, { configVars, context, payload, } = {}) { | ||
const realizedConfigVars = createConfigVars(configVars); | ||
@@ -209,0 +209,0 @@ const realizedContext = createActionContext(Object.assign(Object.assign({}, context), { configVars: realizedConfigVars })); |
@@ -9,5 +9,5 @@ import { Inputs } from "."; | ||
*/ | ||
export declare type ActionInputParameters<TInputs extends Inputs> = { | ||
export type ActionInputParameters<TInputs extends Inputs> = { | ||
[Property in keyof TInputs]: TInputs[Property]["clean"] extends InputCleanFunction<any> ? ReturnType<TInputs[Property]["clean"]> : TInputs[Property]["type"] extends "connection" ? ExtractValue<Connection, TInputs[Property]["collection"]> : TInputs[Property]["type"] extends "conditional" ? ExtractValue<ConditionalExpression, TInputs[Property]["collection"]> : ExtractValue<TInputs[Property]["default"], TInputs[Property]["collection"]>; | ||
}; | ||
export declare type ExtractValue<TType, TCollection extends InputFieldCollection | undefined> = TCollection extends "keyvaluelist" ? KeyValuePair<TType>[] : TCollection extends "valuelist" ? TType[] : TType; | ||
export type ExtractValue<TType, TCollection extends InputFieldCollection | undefined> = TCollection extends "keyvaluelist" ? KeyValuePair<TType>[] : TCollection extends "valuelist" ? TType[] : TType; |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type ActionLoggerFunction = (...args: unknown[]) => void; | ||
export type ActionLoggerFunction = (...args: unknown[]) => void; | ||
/** | ||
@@ -13,0 +13,0 @@ * An object containing logger functions. |
import { Inputs, ConfigVarResultCollection, ActionPerformReturn, ActionInputParameters, ActionLogger, InstanceAttributes, CustomerAttributes, UserAttributes, IntegrationAttributes, FlowAttributes, ComponentManifest } from "."; | ||
/** Definition of the function to perform when an Action is invoked. */ | ||
export declare type ActionPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TComponentActions extends Record<string, ComponentManifest["actions"]>, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext<TConfigVars, TComponentActions>, params: ActionInputParameters<TInputs>) => Promise<TReturn>; | ||
export type ActionPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TComponentActions extends Record<string, ComponentManifest["actions"]>, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext<TConfigVars, TComponentActions>, params: ActionInputParameters<TInputs>) => Promise<TReturn>; | ||
/** Context provided to perform method containing helpers and contextual data */ | ||
export declare type ActionContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TComponentActions extends Record<string, ComponentManifest["actions"]> = Record<string, ComponentManifest["actions"]>> = { | ||
export type ActionContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TComponentActions extends Record<string, ComponentManifest["actions"]> = Record<string, ComponentManifest["actions"]>> = { | ||
/** Logger for permanent logging; console calls are also captured */ | ||
@@ -7,0 +7,0 @@ logger: ActionLogger; |
@@ -31,2 +31,2 @@ /** Used to represent a binary or serialized data return as content type must be specified */ | ||
/** Required return type of all action perform functions */ | ||
export declare type ActionPerformReturn<AllowsBranching extends boolean | undefined, ReturnData> = (AllowsBranching extends true ? ActionPerformBranchingDataReturn<ReturnData> : ActionPerformDataReturn<ReturnData>) | undefined; | ||
export type ActionPerformReturn<AllowsBranching extends boolean | undefined, ReturnData> = (AllowsBranching extends true ? ActionPerformBranchingDataReturn<ReturnData> : ActionPerformDataReturn<ReturnData>) | undefined; |
import { ActionDefinition, ConnectionDefinition, ComponentDisplayDefinition, TriggerDefinition, DataSourceDefinition } from "."; | ||
export declare type ErrorHandler = (error: unknown) => unknown; | ||
export type ErrorHandler = (error: unknown) => unknown; | ||
export interface ComponentHooks { | ||
@@ -8,3 +8,3 @@ /** Defines a global error handler that automatically wraps the component's action/trigger perform functions. */ | ||
/** Defines attributes of a Component. */ | ||
export declare type ComponentDefinition<TPublic extends boolean, TKey extends string> = { | ||
export type ComponentDefinition<TPublic extends boolean, TKey extends string> = { | ||
/** Specifies unique key for this Component. */ | ||
@@ -11,0 +11,0 @@ key: TKey; |
@@ -17,3 +17,3 @@ import { ComponentManifest, PermissionAndVisibilityType } from "."; | ||
} | ||
export declare type ComponentRegistry = keyof IntegrationDefinitionComponentRegistry extends never ? { | ||
export type ComponentRegistry = keyof IntegrationDefinitionComponentRegistry extends never ? { | ||
[key: string]: ComponentManifest; | ||
@@ -35,10 +35,10 @@ } : UnionToIntersection<keyof IntegrationDefinitionComponentRegistry extends infer TComponentKey ? TComponentKey extends keyof IntegrationDefinitionComponentRegistry ? { | ||
} | ||
export declare type ConfigVarExpression = { | ||
export type ConfigVarExpression = { | ||
configVar: string; | ||
}; | ||
export declare type ValueExpression<TValueType = unknown> = { | ||
export type ValueExpression<TValueType = unknown> = { | ||
value: TValueType; | ||
}; | ||
declare type ComponentReferenceType = Extract<keyof ComponentManifest, "actions" | "triggers" | "dataSources" | "connections">; | ||
declare type ComponentReferenceTypeValueMap<TValue, TMap extends Record<ComponentReferenceType, unknown> = { | ||
type ComponentReferenceType = Extract<keyof ComponentManifest, "actions" | "triggers" | "dataSources" | "connections">; | ||
type ComponentReferenceTypeValueMap<TValue, TMap extends Record<ComponentReferenceType, unknown> = { | ||
actions: ValueExpression<TValue>; | ||
@@ -49,3 +49,3 @@ triggers: ValueExpression<TValue> | ConfigVarExpression; | ||
}> = TMap; | ||
export declare type ComponentReference<TComponentReference extends { | ||
export type ComponentReference<TComponentReference extends { | ||
component: string; | ||
@@ -65,11 +65,4 @@ key: string; | ||
}> = TComponentReference; | ||
export declare const isComponentReference: (ref: unknown) => ref is { | ||
component: string; | ||
key: string; | ||
values?: { | ||
[key: string]: ConfigVarExpression | ValueExpression<unknown>; | ||
} | undefined; | ||
template?: string | undefined; | ||
}; | ||
declare type ComponentRegistryFunctionsByType = UnionToIntersection<ComponentReferenceType extends infer TComponentReferenceType ? TComponentReferenceType extends Extract<keyof ComponentManifest, "actions" | "triggers" | "dataSources" | "connections"> ? { | ||
export declare const isComponentReference: (ref: unknown) => ref is ComponentReference; | ||
type ComponentRegistryFunctionsByType = UnionToIntersection<ComponentReferenceType extends infer TComponentReferenceType ? TComponentReferenceType extends Extract<keyof ComponentManifest, "actions" | "triggers" | "dataSources" | "connections"> ? { | ||
[Key in TComponentReferenceType]: keyof ComponentRegistry extends infer TComponentKey ? TComponentKey extends keyof ComponentRegistry ? TComponentKey extends string ? TComponentReferenceType extends keyof ComponentRegistry[TComponentKey] ? keyof ComponentRegistry[TComponentKey][TComponentReferenceType] extends infer TComponentPropertyKey ? TComponentPropertyKey extends keyof ComponentRegistry[TComponentKey][TComponentReferenceType] ? TComponentPropertyKey extends string ? "perform" extends keyof ComponentRegistry[TComponentKey][TComponentReferenceType][TComponentPropertyKey] ? ComponentRegistry[TComponentKey][TComponentReferenceType][TComponentPropertyKey]["perform"] extends (...args: any[]) => any ? Parameters<ComponentRegistry[TComponentKey][TComponentReferenceType][TComponentPropertyKey]["perform"]>[0] extends infer TInputs ? Prettify<Omit<ComponentRegistry[TComponentKey][TComponentReferenceType][TComponentPropertyKey], "perform"> & { | ||
@@ -85,10 +78,10 @@ reference: ComponentReference<{ | ||
} : never : never>; | ||
export declare type ComponentRegistryTrigger = ComponentRegistryFunctionsByType["triggers"]; | ||
export declare type TriggerReference = ComponentRegistryTrigger["reference"]; | ||
export declare type ComponentRegistryAction = ComponentRegistryFunctionsByType["actions"]; | ||
export declare type ActionReference = ComponentRegistryAction["reference"]; | ||
export declare type ComponentRegistryDataSource = ComponentRegistryFunctionsByType["dataSources"]; | ||
export declare type DataSourceReference = ComponentRegistryDataSource["reference"]; | ||
export declare type ComponentRegistryConnection = ComponentRegistryFunctionsByType["connections"]; | ||
export declare type ConnectionReference = ComponentRegistryConnection["reference"]; | ||
export type ComponentRegistryTrigger = ComponentRegistryFunctionsByType["triggers"]; | ||
export type TriggerReference = ComponentRegistryTrigger["reference"]; | ||
export type ComponentRegistryAction = ComponentRegistryFunctionsByType["actions"]; | ||
export type ActionReference = ComponentRegistryAction["reference"]; | ||
export type ComponentRegistryDataSource = ComponentRegistryFunctionsByType["dataSources"]; | ||
export type DataSourceReference = ComponentRegistryDataSource["reference"]; | ||
export type ComponentRegistryConnection = ComponentRegistryFunctionsByType["connections"]; | ||
export type ConnectionReference = ComponentRegistryConnection["reference"]; | ||
export {}; |
@@ -31,4 +31,4 @@ import { ConfigVar } from "."; | ||
} | ||
export declare type ConfigPageElement = string | ConfigVar; | ||
declare type CreateConfigPages<TIntegrationDefinitionConfigPages> = keyof TIntegrationDefinitionConfigPages extends never ? { | ||
export type ConfigPageElement = string | ConfigVar; | ||
type CreateConfigPages<TIntegrationDefinitionConfigPages> = keyof TIntegrationDefinitionConfigPages extends never ? { | ||
[key: string]: ConfigPage; | ||
@@ -38,4 +38,4 @@ } : UnionToIntersection<keyof TIntegrationDefinitionConfigPages extends infer TPageName ? TPageName extends keyof TIntegrationDefinitionConfigPages ? TIntegrationDefinitionConfigPages[TPageName] extends ConfigPage ? { | ||
} : never : never : never>; | ||
export declare type ConfigPages = CreateConfigPages<IntegrationDefinitionConfigPages>; | ||
export declare type UserLevelConfigPages = CreateConfigPages<IntegrationDefinitionUserLevelConfigPages>; | ||
export type ConfigPages = CreateConfigPages<IntegrationDefinitionConfigPages>; | ||
export type UserLevelConfigPages = CreateConfigPages<IntegrationDefinitionUserLevelConfigPages>; | ||
/** Defines attributes of a Config Wizard Page used when deploying an Instance of an Integration. */ | ||
@@ -42,0 +42,0 @@ export interface ConfigPage { |
@@ -1,6 +0,6 @@ | ||
import { DataSourceDefinition, ConnectionDefinition, Inputs, DataSourceType, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule, CollectionDataSourceType, DataSourceReference, ConfigPage, ConfigPages, UserLevelConfigPages, ConfigPageElement, ComponentRegistryDataSource, ComponentRegistryConnection } from "."; | ||
import { DataSourceDefinition, ConnectionDefinition, Inputs, DataSourceType, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule, CollectionDataSourceType, DataSourceReference, ConfigPage, ConfigPages, ConfigPageElement, ComponentRegistryDataSource, ComponentRegistryConnection } from "."; | ||
import { Prettify, UnionToIntersection } from "./utils"; | ||
/** Supported data types for Config Vars. */ | ||
export declare type ConfigVarDataType = "string" | "date" | "timestamp" | "picklist" | "code" | "boolean" | "number" | "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm"; | ||
declare type ConfigVarDataTypeDefaultValueMap<TMap extends Record<ConfigVarDataType, unknown> = { | ||
export type ConfigVarDataType = "string" | "date" | "timestamp" | "picklist" | "code" | "boolean" | "number" | "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm"; | ||
type ConfigVarDataTypeDefaultValueMap<TMap extends Record<ConfigVarDataType, unknown> = { | ||
string: string; | ||
@@ -18,3 +18,3 @@ date: string; | ||
}> = TMap; | ||
declare type ConfigVarDataTypeRuntimeValueMap<TMap extends Record<ConfigVarDataType, unknown> = { | ||
type ConfigVarDataTypeRuntimeValueMap<TMap extends Record<ConfigVarDataType, unknown> = { | ||
string: string; | ||
@@ -33,7 +33,7 @@ date: string; | ||
/** Choices of collection types for multi-value Config Vars. */ | ||
export declare type CollectionType = "valuelist" | "keyvaluelist"; | ||
export declare type PermissionAndVisibilityType = "customer" | "embedded" | "organization"; | ||
declare type ConfigVarSingleDataType = Extract<ConfigVarDataType, "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm">; | ||
export type CollectionType = "valuelist" | "keyvaluelist"; | ||
export type PermissionAndVisibilityType = "customer" | "embedded" | "organization"; | ||
type ConfigVarSingleDataType = Extract<ConfigVarDataType, "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm">; | ||
/** Common attribute shared by all types of Config Vars. */ | ||
declare type BaseConfigVar = { | ||
type BaseConfigVar = { | ||
/** A unique, unchanging value that is used to maintain identity for the Config Var even if the key changes. */ | ||
@@ -54,3 +54,3 @@ stableKey: string; | ||
}; | ||
declare type GetDynamicProperties<TValue, TCollectionType extends CollectionType | undefined> = TCollectionType extends undefined ? { | ||
type GetDynamicProperties<TValue, TCollectionType extends CollectionType | undefined> = TCollectionType extends undefined ? { | ||
defaultValue?: TValue; | ||
@@ -71,11 +71,11 @@ /** Optional value to specify the type of collection if the Config Var is multi-value. */ | ||
}; | ||
declare type StandardConfigVarDynamicProperties<TDataType extends ConfigVarDataType> = CollectionType | undefined extends infer TCollectionType ? TCollectionType extends CollectionType | undefined ? TDataType extends ConfigVarSingleDataType ? TCollectionType extends undefined ? GetDynamicProperties<ConfigVarDataTypeDefaultValueMap[TDataType], undefined> : never : GetDynamicProperties<ConfigVarDataTypeDefaultValueMap[TDataType], TCollectionType> : never : never; | ||
declare type CreateStandardConfigVar<TDataType extends ConfigVarDataType> = BaseConfigVar & StandardConfigVarDynamicProperties<TDataType> & { | ||
type StandardConfigVarDynamicProperties<TDataType extends ConfigVarDataType> = CollectionType | undefined extends infer TCollectionType ? TCollectionType extends CollectionType | undefined ? TDataType extends ConfigVarSingleDataType ? TCollectionType extends undefined ? GetDynamicProperties<ConfigVarDataTypeDefaultValueMap[TDataType], undefined> : never : GetDynamicProperties<ConfigVarDataTypeDefaultValueMap[TDataType], TCollectionType> : never : never; | ||
type CreateStandardConfigVar<TDataType extends ConfigVarDataType> = BaseConfigVar & StandardConfigVarDynamicProperties<TDataType> & { | ||
/** The data type of the Config Var. */ | ||
dataType: TDataType; | ||
}; | ||
declare type StringConfigVar = CreateStandardConfigVar<"string">; | ||
declare type DateConfigVar = CreateStandardConfigVar<"date">; | ||
declare type TimestampConfigVar = CreateStandardConfigVar<"timestamp">; | ||
declare type PicklistConfigVar = CreateStandardConfigVar<"picklist"> & { | ||
type StringConfigVar = CreateStandardConfigVar<"string">; | ||
type DateConfigVar = CreateStandardConfigVar<"date">; | ||
type TimestampConfigVar = CreateStandardConfigVar<"timestamp">; | ||
type PicklistConfigVar = CreateStandardConfigVar<"picklist"> & { | ||
/** List of picklist values. */ | ||
@@ -85,18 +85,18 @@ pickList: string[]; | ||
/** Choices of programming languages that may be used for Config Var code values. */ | ||
export declare type CodeLanguageType = "json" | "xml" | "html"; | ||
declare type CodeConfigVar = CreateStandardConfigVar<"code"> & { | ||
export type CodeLanguageType = "json" | "xml" | "html"; | ||
type CodeConfigVar = CreateStandardConfigVar<"code"> & { | ||
/** Value to specify the type of language of a code Config Var. */ | ||
codeLanguage: CodeLanguageType; | ||
}; | ||
declare type BooleanConfigVar = CreateStandardConfigVar<"boolean">; | ||
declare type NumberConfigVar = CreateStandardConfigVar<"number">; | ||
declare type ScheduleConfigVar = CreateStandardConfigVar<"schedule"> & { | ||
type BooleanConfigVar = CreateStandardConfigVar<"boolean">; | ||
type NumberConfigVar = CreateStandardConfigVar<"number">; | ||
type ScheduleConfigVar = CreateStandardConfigVar<"schedule"> & { | ||
/** Optional timezone for the schedule. */ | ||
timeZone?: string; | ||
}; | ||
declare type ObjectSelectionConfigVar = CreateStandardConfigVar<"objectSelection">; | ||
declare type ObjectFieldMapConfigVar = CreateStandardConfigVar<"objectFieldMap">; | ||
declare type JsonFormConfigVar = CreateStandardConfigVar<"jsonForm">; | ||
export declare type StandardConfigVar = StringConfigVar | DateConfigVar | TimestampConfigVar | PicklistConfigVar | CodeConfigVar | BooleanConfigVar | NumberConfigVar | ScheduleConfigVar | ObjectSelectionConfigVar | ObjectFieldMapConfigVar | JsonFormConfigVar; | ||
declare type BaseDataSourceConfigVar<TDataSourceType extends DataSourceType = DataSourceType> = TDataSourceType extends CollectionDataSourceType ? { | ||
type ObjectSelectionConfigVar = CreateStandardConfigVar<"objectSelection">; | ||
type ObjectFieldMapConfigVar = CreateStandardConfigVar<"objectFieldMap">; | ||
type JsonFormConfigVar = CreateStandardConfigVar<"jsonForm">; | ||
export type StandardConfigVar = StringConfigVar | DateConfigVar | TimestampConfigVar | PicklistConfigVar | CodeConfigVar | BooleanConfigVar | NumberConfigVar | ScheduleConfigVar | ObjectSelectionConfigVar | ObjectFieldMapConfigVar | JsonFormConfigVar; | ||
type BaseDataSourceConfigVar<TDataSourceType extends DataSourceType = DataSourceType> = TDataSourceType extends CollectionDataSourceType ? { | ||
dataSourceType: TDataSourceType; | ||
@@ -114,14 +114,14 @@ collectionType?: CollectionType | undefined; | ||
}); | ||
declare type DataSourceDefinitionConfigVar = DataSourceType extends infer TDataSourceType ? TDataSourceType extends DataSourceType ? BaseDataSourceConfigVar<TDataSourceType> & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, TDataSourceType>, "display" | "inputs" | "examplePayload" | "detailDataSource"> : never : never; | ||
declare type DataSourceReferenceConfigVar = ComponentRegistryDataSource extends infer TDataSourceReference ? TDataSourceReference extends ComponentRegistryDataSource ? Omit<BaseDataSourceConfigVar<TDataSourceReference["dataSourceType"]>, "dataSourceType"> & { | ||
type DataSourceDefinitionConfigVar = DataSourceType extends infer TDataSourceType ? TDataSourceType extends DataSourceType ? BaseDataSourceConfigVar<TDataSourceType> & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, TDataSourceType>, "display" | "inputs" | "examplePayload" | "detailDataSource"> : never : never; | ||
type DataSourceReferenceConfigVar = ComponentRegistryDataSource extends infer TDataSourceReference extends ComponentRegistryDataSource ? Omit<BaseDataSourceConfigVar<TDataSourceReference["dataSourceType"]>, "dataSourceType"> & { | ||
dataSource: TDataSourceReference["reference"]; | ||
} : never : never; | ||
} : never; | ||
/** Defines attributes of a data source Config Var. */ | ||
export declare type DataSourceConfigVar = DataSourceDefinitionConfigVar | DataSourceReferenceConfigVar; | ||
declare type BaseConnectionConfigVar = BaseConfigVar & { | ||
export type DataSourceConfigVar = DataSourceDefinitionConfigVar | DataSourceReferenceConfigVar; | ||
type BaseConnectionConfigVar = BaseConfigVar & { | ||
dataType: "connection"; | ||
}; | ||
declare type ConnectionDefinitionConfigVar = BaseConnectionConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">; | ||
declare type OnPremiseConnectionConfigTypeEnum = "allowed" | "disallowed" | "required"; | ||
declare type ConnectionReferenceConfigVar = ComponentRegistryConnection extends infer TConnectionReference ? TConnectionReference extends ComponentRegistryConnection ? BaseConnectionConfigVar & { | ||
type ConnectionDefinitionConfigVar = BaseConnectionConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">; | ||
type OnPremiseConnectionConfigTypeEnum = "allowed" | "disallowed" | "required"; | ||
type ConnectionReferenceConfigVar = ComponentRegistryConnection extends infer TConnectionReference ? TConnectionReference extends ComponentRegistryConnection ? BaseConnectionConfigVar & { | ||
connection: TConnectionReference["reference"] & ("onPremAvailable" extends keyof TConnectionReference ? TConnectionReference["onPremAvailable"] extends true ? { | ||
@@ -139,12 +139,12 @@ template?: string; | ||
/** Defines attributes of a Config Var that represents a Connection. */ | ||
export declare type ConnectionConfigVar = ConnectionDefinitionConfigVar | ConnectionReferenceConfigVar; | ||
export declare type ConfigVar = StandardConfigVar | DataSourceConfigVar | ConnectionConfigVar; | ||
declare type WithCollectionType<TValue, TCollectionType extends CollectionType | undefined> = undefined | unknown extends TCollectionType ? TValue : TCollectionType extends "valuelist" ? TValue[] : Array<{ | ||
export type ConnectionConfigVar = ConnectionDefinitionConfigVar | ConnectionReferenceConfigVar; | ||
export type ConfigVar = StandardConfigVar | DataSourceConfigVar | ConnectionConfigVar; | ||
type WithCollectionType<TValue, TCollectionType extends CollectionType | undefined> = undefined | unknown extends TCollectionType ? TValue : TCollectionType extends "valuelist" ? TValue[] : Array<{ | ||
key: string; | ||
value: TValue; | ||
}>; | ||
declare type GetDataSourceReference<TComponent extends DataSourceReference["component"], TKey extends DataSourceReference["key"]> = ComponentRegistryDataSource extends infer TDataSourceReference ? TDataSourceReference extends ComponentRegistryDataSource ? TComponent extends TDataSourceReference["reference"]["component"] ? TKey extends TDataSourceReference["reference"]["key"] ? TDataSourceReference : never : never : never : never; | ||
declare type DataSourceToRuntimeType<TElement extends ConfigPageElement> = TElement extends DataSourceDefinitionConfigVar ? TElement["dataSourceType"] extends infer TType ? TType extends DataSourceType ? ConfigVarDataTypeRuntimeValueMap[TType] : never : never : TElement extends DataSourceReferenceConfigVar ? GetDataSourceReference<TElement["dataSource"]["component"], TElement["dataSource"]["key"]>["dataSourceType"] extends infer TType ? TType extends DataSourceType ? ConfigVarDataTypeRuntimeValueMap[TType] : never : never : never; | ||
declare type ElementToRuntimeType<TElement extends ConfigPageElement> = TElement extends ConfigVar ? TElement extends ConnectionConfigVar ? Connection : TElement extends StandardConfigVar ? WithCollectionType<ConfigVarDataTypeRuntimeValueMap[TElement["dataType"]], TElement["collectionType"]> : TElement extends DataSourceConfigVar ? WithCollectionType<DataSourceToRuntimeType<TElement>, TElement["collectionType"]> : never : never; | ||
declare type ExtractConfigVars<TConfigPages extends { | ||
type GetDataSourceReference<TComponent extends DataSourceReference["component"], TKey extends DataSourceReference["key"]> = ComponentRegistryDataSource extends infer TDataSourceReference ? TDataSourceReference extends ComponentRegistryDataSource ? TComponent extends TDataSourceReference["reference"]["component"] ? TKey extends TDataSourceReference["reference"]["key"] ? TDataSourceReference : never : never : never : never; | ||
type DataSourceToRuntimeType<TElement extends ConfigPageElement> = TElement extends DataSourceDefinitionConfigVar ? TElement["dataSourceType"] extends infer TType ? TType extends DataSourceType ? ConfigVarDataTypeRuntimeValueMap[TType] : never : never : TElement extends DataSourceReferenceConfigVar ? GetDataSourceReference<TElement["dataSource"]["component"], TElement["dataSource"]["key"]>["dataSourceType"] extends infer TType ? TType extends DataSourceType ? ConfigVarDataTypeRuntimeValueMap[TType] : never : never : never; | ||
type ElementToRuntimeType<TElement extends ConfigPageElement> = TElement extends ConfigVar ? TElement extends ConnectionConfigVar ? Connection : TElement extends StandardConfigVar ? WithCollectionType<ConfigVarDataTypeRuntimeValueMap[TElement["dataType"]], TElement["collectionType"]> : TElement extends DataSourceConfigVar ? WithCollectionType<DataSourceToRuntimeType<TElement>, TElement["collectionType"]> : never : never; | ||
type ExtractConfigVars<TConfigPages extends { | ||
[key: string]: ConfigPage; | ||
@@ -154,96 +154,9 @@ }> = keyof TConfigPages extends infer TPageName ? TPageName extends keyof TConfigPages ? TConfigPages[TPageName] extends infer TConfigPage ? TConfigPage extends ConfigPage ? { | ||
} : never : never : never : never; | ||
export declare type ConfigVars = Prettify<UnionToIntersection<ExtractConfigVars<ConfigPages> | ExtractConfigVars<UserLevelConfigPages>>>; | ||
export type ConfigVars = Prettify<UnionToIntersection<ExtractConfigVars<ConfigPages>>>; | ||
export declare const isCodeConfigVar: (cv: ConfigVar) => cv is CodeConfigVar; | ||
export declare const isScheduleConfigVar: (cv: ConfigVar) => cv is ScheduleConfigVar; | ||
export declare const isDataSourceDefinitionConfigVar: (cv: ConfigVar) => cv is ({ | ||
dataSourceType: "string"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "string">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | ({ | ||
dataSourceType: "number"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "number">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | ({ | ||
dataSourceType: "boolean"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "boolean">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | ({ | ||
dataSourceType: "code"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "code">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | (BaseConfigVar & { | ||
dataSourceType: "objectSelection"; | ||
collectionType?: undefined; | ||
} & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "objectSelection">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | (BaseConfigVar & { | ||
dataSourceType: "objectFieldMap"; | ||
collectionType?: undefined; | ||
} & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "objectFieldMap">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | (BaseConfigVar & { | ||
dataSourceType: "jsonForm"; | ||
collectionType?: undefined; | ||
} & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "jsonForm">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | ({ | ||
dataSourceType: "date"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "date">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | ({ | ||
dataSourceType: "timestamp"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "timestamp">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | ({ | ||
dataSourceType: "picklist"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "picklist">, "display" | "inputs" | "examplePayload" | "detailDataSource">) | ({ | ||
dataSourceType: "schedule"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, "schedule">, "display" | "inputs" | "examplePayload" | "detailDataSource">); | ||
export declare const isDataSourceReferenceConfigVar: (cv: unknown) => cv is Omit<({ | ||
dataSourceType: "string"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar) | ({ | ||
dataSourceType: "number"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar) | ({ | ||
dataSourceType: "boolean"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar) | ({ | ||
dataSourceType: "code"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar) | (BaseConfigVar & { | ||
dataSourceType: "objectSelection"; | ||
collectionType?: undefined; | ||
}) | (BaseConfigVar & { | ||
dataSourceType: "objectFieldMap"; | ||
collectionType?: undefined; | ||
}) | (BaseConfigVar & { | ||
dataSourceType: "jsonForm"; | ||
collectionType?: undefined; | ||
}) | ({ | ||
dataSourceType: "date"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar) | ({ | ||
dataSourceType: "timestamp"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar) | ({ | ||
dataSourceType: "picklist"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar) | ({ | ||
dataSourceType: "schedule"; | ||
collectionType?: CollectionType | undefined; | ||
} & BaseConfigVar), "dataSourceType"> & { | ||
dataSource: { | ||
component: string; | ||
key: string; | ||
values: { | ||
[x: string]: import("./ComponentRegistry").ConfigVarExpression | import("./ComponentRegistry").ValueExpression<any>; | ||
}; | ||
}; | ||
}; | ||
export declare const isDataSourceDefinitionConfigVar: (cv: ConfigVar) => cv is DataSourceDefinitionConfigVar; | ||
export declare const isDataSourceReferenceConfigVar: (cv: unknown) => cv is DataSourceReferenceConfigVar; | ||
export declare const isConnectionDefinitionConfigVar: (cv: ConfigVar) => cv is ConnectionDefinitionConfigVar; | ||
export declare const isConnectionReferenceConfigVar: (cv: unknown) => cv is BaseConfigVar & { | ||
dataType: "connection"; | ||
} & { | ||
connection: { | ||
component: string; | ||
key: string; | ||
values: { | ||
[x: string]: (import("./ComponentRegistry").ConfigVarExpression | import("./ComponentRegistry").ValueExpression<any>) & import("./ComponentRegistry").ConnectionInputPermissionAndVisibility; | ||
}; | ||
} & { | ||
template?: string | undefined; | ||
onPremiseConnectionConfig?: undefined; | ||
}; | ||
}; | ||
export declare const isConnectionReferenceConfigVar: (cv: unknown) => cv is ConnectionReferenceConfigVar; | ||
export {}; |
@@ -52,4 +52,4 @@ import { ConnectionInput, OnPremConnectionInput } from "."; | ||
} | ||
export declare type OAuth2ConnectionDefinition = OAuth2AuthorizationCodeConnectionDefinition | OAuth2ClientCredentialConnectionDefinition; | ||
export declare type ConnectionDefinition = DefaultConnectionDefinition | OnPremConnectionDefinition | OAuth2ConnectionDefinition; | ||
export type OAuth2ConnectionDefinition = OAuth2AuthorizationCodeConnectionDefinition | OAuth2ClientCredentialConnectionDefinition; | ||
export type ConnectionDefinition = DefaultConnectionDefinition | OnPremConnectionDefinition | OAuth2ConnectionDefinition; | ||
export {}; |
@@ -8,3 +8,3 @@ "use strict"; | ||
OAuth2Type["AuthorizationCode"] = "authorization_code"; | ||
})(OAuth2Type = exports.OAuth2Type || (exports.OAuth2Type = {})); | ||
})(OAuth2Type || (exports.OAuth2Type = OAuth2Type = {})); | ||
var OAuth2PkceMethod; | ||
@@ -14,2 +14,2 @@ (function (OAuth2PkceMethod) { | ||
OAuth2PkceMethod["S256"] = "S256"; | ||
})(OAuth2PkceMethod = exports.OAuth2PkceMethod || (exports.OAuth2PkceMethod = {})); | ||
})(OAuth2PkceMethod || (exports.OAuth2PkceMethod = OAuth2PkceMethod = {})); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
/** Binary data payload */ | ||
@@ -3,0 +2,0 @@ export interface DataPayload { |
import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters, ConfigVarResultCollection, ActionContext } from "."; | ||
/** Context provided to perform method containing helpers and contextual data */ | ||
export declare type DataSourceContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection> = Pick<ActionContext<TConfigVars>, "logger" | "customer" | "instance" | "user" | "configVars">; | ||
export type DataSourceContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection> = Pick<ActionContext<TConfigVars>, "logger" | "customer" | "instance" | "user" | "configVars">; | ||
/** Definition of the function to perform when a Data Source is invoked. */ | ||
export declare type DataSourcePerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType> = (context: DataSourceContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<DataSourceResult<TDataSourceType>>; | ||
export type DataSourcePerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends DataSourceType> = (context: DataSourceContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<DataSourceResult<TDataSourceType>>; |
import { ObjectSelection, ObjectFieldMap, JSONForm, Element } from "./Inputs"; | ||
/** The type of field that is appropriate for rendering the data that is the result of the data source perform function. */ | ||
declare type DataSourceTypeMap = { | ||
type DataSourceTypeMap = { | ||
string: string; | ||
@@ -18,7 +18,7 @@ date: string; | ||
}; | ||
export declare type DataSourceType = keyof DataSourceTypeMap; | ||
export declare type CollectionDataSourceType = Exclude<DataSourceType, "objectSelection" | "objectFieldMap" | "jsonForm">; | ||
export declare type DataSourceResultType = DataSourceTypeMap[DataSourceType]; | ||
export type DataSourceType = keyof DataSourceTypeMap; | ||
export type CollectionDataSourceType = Exclude<DataSourceType, "objectSelection" | "objectFieldMap" | "jsonForm">; | ||
export type DataSourceResultType = DataSourceTypeMap[DataSourceType]; | ||
/** Represents the result of a Data Source action. */ | ||
export declare type DataSourceResult<TDataSourceType extends DataSourceType> = { | ||
export type DataSourceResult<TDataSourceType extends DataSourceType> = { | ||
/** The resulting data that is returned from the data source. */ | ||
@@ -25,0 +25,0 @@ result: DataSourceTypeMap[TDataSourceType]; |
@@ -11,3 +11,3 @@ /** | ||
} | ||
declare type PublicComponentCategory = "Application Connectors" | "Data Platforms" | "Helpers" | "Logic" | "Triggers"; | ||
type PublicComponentCategory = "Application Connectors" | "Data Platforms" | "Helpers" | "Logic" | "Triggers"; | ||
interface ExtraDisplayDefinitionFields<TPublic extends boolean> { | ||
@@ -20,3 +20,3 @@ /** Path to icon to use for this Component. Path should be relative to the built component source. */ | ||
/** Component extensions for display properties. */ | ||
export declare type ComponentDisplayDefinition<TPublic extends boolean> = TPublic extends true ? DisplayDefinition & Required<ExtraDisplayDefinitionFields<TPublic>> : DisplayDefinition & ExtraDisplayDefinitionFields<TPublic>; | ||
export type ComponentDisplayDefinition<TPublic extends boolean> = TPublic extends true ? DisplayDefinition & Required<ExtraDisplayDefinitionFields<TPublic>> : DisplayDefinition & ExtraDisplayDefinitionFields<TPublic>; | ||
/** Action-specific Display attributes. */ | ||
@@ -23,0 +23,0 @@ export interface ActionDisplayDefinition extends DisplayDefinition { |
@@ -16,7 +16,7 @@ import { ConditionalExpression } from "./conditional-logic"; | ||
} | ||
export declare type Element = { | ||
export type Element = { | ||
key: string; | ||
label?: string; | ||
}; | ||
export declare type ObjectSelection = { | ||
export type ObjectSelection = { | ||
object: Element; | ||
@@ -26,3 +26,3 @@ fields?: Element[]; | ||
}[]; | ||
export declare type ObjectFieldMap = { | ||
export type ObjectFieldMap = { | ||
fields: { | ||
@@ -40,3 +40,3 @@ field: Element; | ||
}; | ||
export declare type Schedule = { | ||
export type Schedule = { | ||
value: string; | ||
@@ -46,3 +46,3 @@ schedule_type: string; | ||
}; | ||
export declare type JSONForm = { | ||
export type JSONForm = { | ||
/** | ||
@@ -65,16 +65,16 @@ * The data/JSON schema defines the underlying data to | ||
}; | ||
export declare type DynamicObjectSelection = string; | ||
export declare type DynamicFieldSelection = string; | ||
export type DynamicObjectSelection = string; | ||
export type DynamicFieldSelection = string; | ||
/** InputField type enumeration. */ | ||
export declare type InputFieldType = InputFieldDefinition["type"]; | ||
export type InputFieldType = InputFieldDefinition["type"]; | ||
export declare const InputFieldDefaultMap: Record<InputFieldType, string | undefined>; | ||
export declare type Inputs = Record<string, InputFieldDefinition>; | ||
export declare type ConnectionInput = (StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField) & { | ||
export type Inputs = Record<string, InputFieldDefinition>; | ||
export type ConnectionInput = (StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField) & { | ||
shown?: boolean; | ||
}; | ||
export declare type OnPremConnectionInput = { | ||
export type OnPremConnectionInput = { | ||
onPremControlled: true; | ||
} & ConnectionInput; | ||
export declare type InputFieldDefinition = StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField | CodeInputField | ConditionalInputField | ConnectionInputField | ObjectSelectionInputField | ObjectFieldMapInputField | JSONFormInputField | DynamicObjectSelectionInputField | DynamicFieldSelectionInputField; | ||
export declare type InputCleanFunction<TValue, TResult = TValue> = (value: TValue) => TResult; | ||
export type InputFieldDefinition = StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField | CodeInputField | ConditionalInputField | ConnectionInputField | ObjectSelectionInputField | ObjectFieldMapInputField | JSONFormInputField | DynamicObjectSelectionInputField | DynamicFieldSelectionInputField; | ||
export type InputCleanFunction<TValue, TResult = TValue> = (value: TValue) => TResult; | ||
interface BaseInputField { | ||
@@ -95,3 +95,3 @@ /** Interface label of the InputField. */ | ||
} | ||
declare type CollectionOptions<T> = SingleValue<T> | ValueListCollection<T> | KeyValueListCollection<T>; | ||
type CollectionOptions<T> = SingleValue<T> | ValueListCollection<T> | KeyValueListCollection<T>; | ||
interface SingleValue<T> { | ||
@@ -115,3 +115,3 @@ /** Collection type of the InputField */ | ||
} | ||
export declare type StringInputField = BaseInputField & { | ||
export type StringInputField = BaseInputField & { | ||
/** Data type the InputField will collect. */ | ||
@@ -124,3 +124,3 @@ type: "string"; | ||
} & CollectionOptions<string>; | ||
export declare type DataInputField = BaseInputField & { | ||
export type DataInputField = BaseInputField & { | ||
/** Data type the InputField will collect. */ | ||
@@ -133,3 +133,3 @@ type: "data"; | ||
} & CollectionOptions<string>; | ||
export declare type TextInputField = BaseInputField & { | ||
export type TextInputField = BaseInputField & { | ||
/** Data type the InputField will collect. */ | ||
@@ -142,3 +142,3 @@ type: "text"; | ||
} & CollectionOptions<string>; | ||
export declare type PasswordInputField = BaseInputField & { | ||
export type PasswordInputField = BaseInputField & { | ||
/** Data type the InputField will collect. */ | ||
@@ -151,3 +151,3 @@ type: "password"; | ||
} & CollectionOptions<string>; | ||
export declare type BooleanInputField = BaseInputField & { | ||
export type BooleanInputField = BaseInputField & { | ||
/** Data type the InputField will collect. */ | ||
@@ -161,3 +161,3 @@ type: "boolean"; | ||
/** Defines attributes of a CodeInputField. */ | ||
export declare type CodeInputField = BaseInputField & { | ||
export type CodeInputField = BaseInputField & { | ||
/** Data type the InputField will collect. */ | ||
@@ -269,5 +269,5 @@ type: "code"; | ||
/** InputField collection enumeration */ | ||
export declare type InputFieldCollection = "valuelist" | "keyvaluelist"; | ||
export type InputFieldCollection = "valuelist" | "keyvaluelist"; | ||
/** Config variable result collection */ | ||
export declare type ConfigVarResultCollection = Record<string, string | Schedule | Connection | unknown | ObjectSelection | ObjectFieldMap>; | ||
export type ConfigVarResultCollection = Record<string, string | Schedule | Connection | unknown | ObjectSelection | ObjectFieldMap>; | ||
export {}; |
import { ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, TriggerPayload, ComponentRegistry, TriggerReference, ConfigVars, ConfigPages, UserLevelConfigPages, ValueExpression, ConfigVarExpression } from "."; | ||
/** Defines attributes of a Code-Native Integration. */ | ||
export declare type IntegrationDefinition = { | ||
export type IntegrationDefinition = { | ||
/** The unique name for this Integration. */ | ||
@@ -77,3 +77,3 @@ name: string; | ||
/** Defines attributes of a Preprocess Flow Configuration used by a Flow of an Integration. */ | ||
export declare type PreprocessFlowConfig = { | ||
export type PreprocessFlowConfig = { | ||
/** Name of the field in the data payload returned by the Preprocess Flow to use for a Flow Name. */ | ||
@@ -87,3 +87,3 @@ flowNameField: string; | ||
/** Defines attributes of a Retry Configuration used by a Flow of an Integration. */ | ||
export declare type RetryConfig = { | ||
export type RetryConfig = { | ||
/** The maximum number of retry attempts. Must be between 0 and 10. */ | ||
@@ -99,3 +99,3 @@ maxAttempts: number; | ||
/** Defines attributes of a Step Error Configuration used to determine how to handle errors during Flow step execution. */ | ||
export declare type StepErrorConfig = { | ||
export type StepErrorConfig = { | ||
/** Defines the type of error handler. */ | ||
@@ -113,6 +113,6 @@ errorHandlerType: StepErrorHandlerType; | ||
/** Choices of Endpoint Types that may be used by Instances of an Integration. */ | ||
export declare type EndpointType = "flow_specific" | "instance_specific" | "shared_instance"; | ||
export type EndpointType = "flow_specific" | "instance_specific" | "shared_instance"; | ||
/** Choices of Endpoint Security Types that may be used by endpoints of a Flow. */ | ||
export declare type EndpointSecurityType = "unsecured" | "customer_optional" | "customer_required" | "organization"; | ||
export type EndpointSecurityType = "unsecured" | "customer_optional" | "customer_required" | "organization"; | ||
/** Choices of Step Error Handlers that define the behavior when a step error occurs. */ | ||
export declare type StepErrorHandlerType = "fail" | "ignore" | "retry"; | ||
export type StepErrorHandlerType = "fail" | "ignore" | "retry"; |
import { ActionDisplayDefinition, TriggerPerformFunction, TriggerEventFunction, Inputs, TriggerResult, ConfigVarResultCollection, TriggerPayload } from "."; | ||
declare const optionChoices: readonly ["invalid", "valid", "required"]; | ||
export declare type TriggerOptionChoice = typeof optionChoices[number]; | ||
export type TriggerOptionChoice = (typeof optionChoices)[number]; | ||
export declare const TriggerOptionChoices: TriggerOptionChoice[]; | ||
@@ -5,0 +5,0 @@ /** |
import { Inputs, ActionContext, ActionInputParameters, ConfigVarResultCollection } from "."; | ||
export declare type TriggerEventFunctionReturn = { | ||
export type TriggerEventFunctionReturn = { | ||
/** An optional object, the keys and values of which will be persisted in the flow-specific instanceState and available for subsequent actions and executions */ | ||
@@ -13,2 +13,2 @@ instanceState?: Record<string, unknown>; | ||
/** Definition of the function to execute when a Trigger Event occurs. */ | ||
export declare type TriggerEventFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection> = (context: ActionContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<void | TriggerEventFunctionReturn>; | ||
export type TriggerEventFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection> = (context: ActionContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<TriggerEventFunctionReturn | void>; |
import { Inputs, TriggerResult, ActionInputParameters, ActionContext, TriggerPayload, ConfigVarResultCollection } from "."; | ||
/** Definition of the function to perform when a Trigger is invoked. */ | ||
export declare type TriggerPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> = (context: ActionContext<TConfigVars>, payload: TriggerPayload, params: ActionInputParameters<TInputs>) => Promise<TResult>; | ||
export type TriggerPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> = (context: ActionContext<TConfigVars>, payload: TriggerPayload, params: ActionInputParameters<TInputs>) => Promise<TResult>; |
@@ -28,2 +28,2 @@ import { TriggerPayload } from "./TriggerPayload"; | ||
/** Required return type of all trigger perform functions */ | ||
export declare type TriggerResult<AllowsBranching extends boolean | undefined, TPayload extends TriggerPayload> = (AllowsBranching extends true ? TriggerBranchingResult<TPayload> : TriggerBaseResult<TPayload>) | undefined; | ||
export type TriggerResult<AllowsBranching extends boolean | undefined, TPayload extends TriggerPayload> = (AllowsBranching extends true ? TriggerBranchingResult<TPayload> : TriggerBaseResult<TPayload>) | undefined; |
@@ -1,5 +0,5 @@ | ||
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | ||
export declare type Prettify<T> = { | ||
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | ||
export type Prettify<T> = { | ||
[K in keyof T]: T[K]; | ||
}; | ||
export declare type ValueOf<T> = T[keyof T]; | ||
export type ValueOf<T> = T[keyof T]; |
@@ -32,9 +32,9 @@ /** | ||
isBool: (value: unknown) => value is boolean; | ||
toBool: (value: unknown, defaultValue?: boolean | undefined) => boolean; | ||
toBool: (value: unknown, defaultValue?: boolean) => boolean; | ||
isInt: (value: unknown) => value is number; | ||
toInt: (value: unknown, defaultValue?: number | undefined) => number; | ||
toInt: (value: unknown, defaultValue?: number) => number; | ||
isNumber: (value: unknown) => boolean; | ||
toNumber: (value: unknown, defaultValue?: number | undefined) => number; | ||
toNumber: (value: unknown, defaultValue?: number) => number; | ||
isBigInt: (value: unknown) => value is bigint; | ||
toBigInt: (value: unknown) => BigInt; | ||
toBigInt: (value: unknown) => bigint; | ||
isDate: (value: unknown) => value is Date; | ||
@@ -49,3 +49,3 @@ toDate: (value: unknown) => Date; | ||
toString: (value: unknown, defaultValue?: string) => string; | ||
keyValPairListToObject: <TValue = unknown>(kvpList: KeyValuePair<unknown>[], valueConverter?: ((value: unknown) => TValue) | undefined) => Record<string, TValue>; | ||
keyValPairListToObject: <TValue = unknown>(kvpList: KeyValuePair<unknown>[], valueConverter?: (value: unknown) => TValue) => Record<string, TValue>; | ||
isJSON: (value: string) => boolean; | ||
@@ -65,5 +65,5 @@ toJSON: (value: unknown, prettyPrint?: boolean, retainKeyOrder?: boolean) => string; | ||
toObject: (value: unknown) => object; | ||
cleanObject: (obj: Record<string, unknown>, predicate?: ((v: any) => boolean) | undefined) => Record<string, unknown>; | ||
cleanObject: (obj: Record<string, unknown>, predicate?: (v: any) => boolean) => Record<string, unknown>; | ||
}; | ||
}; | ||
export default _default; |
@@ -47,4 +47,3 @@ "use strict"; | ||
} | ||
return (Array.isArray(value) && | ||
value.every((item) => (0, exports.isObjectWithTruthyKeys)(item, ["object"]))); | ||
return Array.isArray(value) && value.every((item) => (0, exports.isObjectWithTruthyKeys)(item, ["object"])); | ||
}; | ||
@@ -335,3 +334,3 @@ /** | ||
*/ | ||
const isBufferDataPayload = (value) => value instanceof Object && "data" in value && Buffer.isBuffer(value["data"]); | ||
const isBufferDataPayload = (value) => value instanceof Object && "data" in value && Buffer.isBuffer(value.data); | ||
/** | ||
@@ -433,12 +432,6 @@ * Many libraries for third-party API that handle binary files expect `Buffer` objects. | ||
if ((0, exports.isObjectWithTruthyKeys)(value, ["key", "label", "oauth2Type"])) { | ||
return ((0, exports.isObjectWithTruthyKeys)(inputs, [ | ||
"authorizeUrl", | ||
"tokenUrl", | ||
"clientId", | ||
"clientSecret", | ||
]) || | ||
return ((0, exports.isObjectWithTruthyKeys)(inputs, ["authorizeUrl", "tokenUrl", "clientId", "clientSecret"]) || | ||
(0, exports.isObjectWithTruthyKeys)(inputs, ["tokenUrl", "clientId", "clientSecret"])); | ||
} | ||
return ((0, exports.isObjectWithTruthyKeys)(value, ["key", "label"]) && | ||
typeof inputs === "object"); | ||
return (0, exports.isObjectWithTruthyKeys)(value, ["key", "label"]) && typeof inputs === "object"; | ||
} | ||
@@ -445,0 +438,0 @@ return false; |
{ | ||
"name": "@prismatic-io/spectral", | ||
"version": "9.0.1", | ||
"version": "9.0.2", | ||
"description": "Utility library for building Prismatic components", | ||
"keywords": [ | ||
"prismatic" | ||
], | ||
"keywords": ["prismatic"], | ||
"main": "dist/index.js", | ||
@@ -33,13 +31,11 @@ "types": "dist/index.d.ts", | ||
"prepack": "yarn run build", | ||
"format": "yarn run lint-fix && prettier --loglevel error --write 'src/**/*.ts' '*.{ts,js,json}' '!sidebars.{js,jse}'", | ||
"check-format": "prettier --check 'src/**/*.ts' '*.{ts,js,json}' '!sidebars.{js,jse}'", | ||
"lint": "biome lint .", | ||
"lint-fix": "biome lint --apply-unsafe .", | ||
"format": "yarn run lint-fix && biome format --write .", | ||
"check-format": "biome format .", | ||
"check": "yarn run check-format && yarn run lint", | ||
"lint": "eslint --ext .ts .", | ||
"lint-fix": "eslint --fix --ext .ts .", | ||
"test": "jest", | ||
"docs": "rm -f sidebars.{js,jse} && typedoc" | ||
}, | ||
"files": [ | ||
"dist/" | ||
], | ||
"files": ["dist/"], | ||
"dependencies": { | ||
@@ -56,3 +52,2 @@ "@jsonforms/core": "3.0.0", | ||
"object-sizeof": "^2.6.4", | ||
"prettier": "2.6.2", | ||
"safe-stable-stringify": "2.3.1", | ||
@@ -66,2 +61,3 @@ "serialize-error": "8.1.0", | ||
"devDependencies": { | ||
"@biomejs/biome": "1.6.3", | ||
"@types/ejs": "3.1.5", | ||
@@ -72,3 +68,2 @@ "@types/fs-extra": "11.0.4", | ||
"@types/node": "14.14.35", | ||
"@types/prettier": "2.6.2", | ||
"@types/sax": "1.2.4", | ||
@@ -78,9 +73,3 @@ "@types/url-join": "4.0.1", | ||
"@types/valid-url": "1.0.3", | ||
"@typescript-eslint/eslint-plugin": "5.18.0", | ||
"@typescript-eslint/parser": "5.18.0", | ||
"copyfiles": "2.4.1", | ||
"eslint": "8.12.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-jest": "27.9.0", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"fast-check": "2.16.0", | ||
@@ -92,4 +81,4 @@ "jest": "29.7.0", | ||
"typedoc-plugin-remove-references": "0.0.5", | ||
"typescript": "4.6.3" | ||
"typescript": "5.5.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16
18
301644
6274
- Removedprettier@2.6.2
- Removedprettier@2.6.2(transitive)