@prismatic-io/spectral 10.18.6-preview.0 → 10.18.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/http/index.d.ts +1 -1
- package/dist/clients/http/index.js +17 -7
- package/dist/conditionalLogic/index.d.ts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/generators/cniComponentManifest/index.d.ts +1 -1
- package/dist/generators/cniComponentManifest/index.js +17 -7
- package/dist/generators/cniComponentManifest/types.d.ts +3 -3
- package/dist/generators/componentManifest/createActions.d.ts +1 -1
- package/dist/generators/componentManifest/createConnections.d.ts +1 -1
- package/dist/generators/componentManifest/createDataSources.d.ts +1 -1
- package/dist/generators/componentManifest/createStaticFiles.d.ts +1 -1
- package/dist/generators/componentManifest/createTriggers.d.ts +1 -1
- package/dist/generators/componentManifest/docBlock.d.ts +1 -1
- package/dist/generators/componentManifest/getInputs.js +0 -3
- package/dist/generators/componentManifest/index.d.ts +1 -1
- package/dist/index.d.ts +1 -22
- package/dist/index.js +1 -19
- package/dist/serverTypes/asyncContext.d.ts +1 -1
- package/dist/serverTypes/context.d.ts +2 -2
- package/dist/serverTypes/convertComponent.d.ts +4 -4
- package/dist/serverTypes/convertComponent.js +11 -15
- package/dist/serverTypes/convertIntegration.d.ts +3 -3
- package/dist/serverTypes/index.d.ts +1 -3
- package/dist/serverTypes/perform.d.ts +1 -1
- package/dist/types/ActionInputParameters.d.ts +2 -17
- package/dist/types/Inputs.d.ts +1 -12
- package/dist/types/Inputs.js +0 -1
- package/dist/types/TriggerResult.d.ts +2 -2
- package/dist/types/typeExportComponent.js +17 -7
- package/dist/util.d.ts +1 -1
- package/package.json +13 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
-
import { IAxiosRetryConfig } from "axios-retry";
|
|
2
|
+
import { type IAxiosRetryConfig } from "axios-retry";
|
|
3
3
|
import type { ActionInputParameters } from "../../types/ActionInputParameters";
|
|
4
4
|
import { inputs } from "./inputs";
|
|
5
5
|
export type HttpClient = AxiosInstance;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConditionalExpression } from "./types";
|
|
1
|
+
import { type ConditionalExpression } from "./types";
|
|
2
2
|
export type ValidationResult = [boolean] | [boolean, string];
|
|
3
3
|
export declare const validate: (expression: ConditionalExpression) => ValidationResult;
|
|
4
4
|
/** Convert stringified objects/values back to their native value, all other
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
2
|
-
import { FormattedAction, FormattedDataSource, FormattedTrigger } from "./types";
|
|
2
|
+
import type { FormattedAction, FormattedDataSource, FormattedTrigger } from "./types";
|
|
3
3
|
export declare const fetchComponentDataForManifest: <TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>>({ componentKey, isPrivate, }: {
|
|
4
4
|
componentKey: string;
|
|
5
5
|
isPrivate: boolean;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Action, Component, DataSource, Trigger, TriggerPayload } from "../../serverTypes";
|
|
2
|
-
import { ConfigVarResultCollection, Inputs } from "../../types";
|
|
3
|
-
import { TriggerResult } from "../../types/TriggerResult";
|
|
1
|
+
import type { Action, Component, DataSource, Trigger, TriggerPayload } from "../../serverTypes";
|
|
2
|
+
import type { ConfigVarResultCollection, Inputs } from "../../types";
|
|
3
|
+
import type { TriggerResult } from "../../types/TriggerResult";
|
|
4
4
|
export interface ComponentNode {
|
|
5
5
|
id: string;
|
|
6
6
|
label: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
1
|
+
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
2
2
|
import type { ComponentForManifest } from "../cniComponentManifest/types";
|
|
3
3
|
interface CreateActionsProps<TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>> {
|
|
4
4
|
component: ComponentForManifest<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
1
|
+
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
2
2
|
import type { ComponentForManifest } from "../cniComponentManifest/types";
|
|
3
3
|
interface CreateConnectionsProps<TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>> {
|
|
4
4
|
component: ComponentForManifest<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
1
|
+
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
2
2
|
import type { ComponentForManifest } from "../cniComponentManifest/types";
|
|
3
3
|
interface CreateDataSourcesProps<TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>> {
|
|
4
4
|
component: ComponentForManifest<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from "../../serverTypes";
|
|
2
|
-
import { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
2
|
+
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
3
3
|
export interface PackageDependencies {
|
|
4
4
|
spectral: string;
|
|
5
5
|
dependencies: Record<string, string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
1
|
+
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
2
2
|
import type { ComponentForManifest } from "../cniComponentManifest/types";
|
|
3
3
|
interface CreateTriggersProps<TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>> {
|
|
4
4
|
component: ComponentForManifest<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>;
|
|
@@ -68,9 +68,6 @@ exports.INPUT_TYPE_MAP = {
|
|
|
68
68
|
timestamp: "string",
|
|
69
69
|
flow: "string",
|
|
70
70
|
template: "string",
|
|
71
|
-
// TODO: emit a typed record matching the declared children once the
|
|
72
|
-
// code-native action-calling type generator handles structuredObject.
|
|
73
|
-
structuredObject: "unknown",
|
|
74
71
|
};
|
|
75
72
|
const getInputValueType = (input) => {
|
|
76
73
|
const inputType = exports.INPUT_TYPE_MAP[input.type];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from "../../serverTypes";
|
|
2
|
-
import { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
2
|
+
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
3
3
|
import { type PackageDependencies } from "./createStaticFiles";
|
|
4
4
|
interface CreateComponentManifestProps<TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>> {
|
|
5
5
|
component: Component<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { convertComponent } from "./serverTypes/convertComponent";
|
|
7
7
|
import { convertIntegration } from "./serverTypes/convertIntegration";
|
|
8
|
-
import { ActionDefinition, ActionPerformReturn, ComponentDefinition, ComponentManifest, ConfigPage, ConfigVarResultCollection, ConnectionConfigVar, CustomerActivatedConnectionConfigVar, DataSourceConfigVar, DataSourceDefinition, DataSourceType, DefaultConnectionDefinition, Flow, InputFieldDefinition, Inputs, IntegrationDefinition, OAuth2ConnectionDefinition, OnPremConnectionDefinition, OrganizationActivatedConnectionConfigVar, StandardConfigVar,
|
|
8
|
+
import type { ActionDefinition, ActionPerformReturn, ComponentDefinition, ComponentManifest, ConfigPage, ConfigVarResultCollection, ConnectionConfigVar, CustomerActivatedConnectionConfigVar, DataSourceConfigVar, DataSourceDefinition, DataSourceType, DefaultConnectionDefinition, Flow, InputFieldDefinition, Inputs, IntegrationDefinition, OAuth2ConnectionDefinition, OnPremConnectionDefinition, OrganizationActivatedConnectionConfigVar, StandardConfigVar, TriggerDefinition, TriggerPayload, TriggerResult } from "./types";
|
|
9
9
|
import type { PollingTriggerDefinition } from "./types/PollingTriggerDefinition";
|
|
10
10
|
/**
|
|
11
11
|
* This function creates a code-native integration object that can be
|
|
@@ -512,27 +512,6 @@ export declare const dataSource: <TInputs extends Inputs, TConfigVars extends Co
|
|
|
512
512
|
* });
|
|
513
513
|
*/
|
|
514
514
|
export declare const input: <T extends InputFieldDefinition>(definition: T) => T;
|
|
515
|
-
/**
|
|
516
|
-
* Groups related primitive inputs under a single named container. Children
|
|
517
|
-
* may not themselves be structuredObject inputs (the type signature enforces
|
|
518
|
-
* this at compile time).
|
|
519
|
-
*
|
|
520
|
-
* @example
|
|
521
|
-
* import { input, structuredObjectInput } from "@prismatic-io/spectral";
|
|
522
|
-
*
|
|
523
|
-
* const name = structuredObjectInput({
|
|
524
|
-
* label: "Name",
|
|
525
|
-
* inputs: {
|
|
526
|
-
* first: input({ type: "string", label: "First Name", required: true }),
|
|
527
|
-
* last: input({ type: "string", label: "Last Name", required: true }),
|
|
528
|
-
* },
|
|
529
|
-
* });
|
|
530
|
-
*/
|
|
531
|
-
export declare const structuredObjectInput: <T extends Omit<StructuredObjectInputField, "type"> & {
|
|
532
|
-
type?: never;
|
|
533
|
-
}>(definition: T) => T & {
|
|
534
|
-
type: "structuredObject";
|
|
535
|
-
};
|
|
536
515
|
/**
|
|
537
516
|
* This function creates a connection that can be used by a code-native integration
|
|
538
517
|
* or custom component. Connections define the fields (API keys, tokens, etc.) needed
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.util = exports.testing = exports.componentManifests = exports.oauth2Connection = exports.onPremConnection = exports.connection = exports.
|
|
25
|
+
exports.util = exports.testing = exports.componentManifests = exports.oauth2Connection = exports.onPremConnection = exports.connection = exports.input = exports.dataSource = exports.pollingTrigger = exports.trigger = exports.action = exports.component = exports.componentManifest = exports.organizationActivatedConnection = exports.customerActivatedConnection = exports.connectionConfigVar = exports.dataSourceConfigVar = exports.configVar = exports.configPage = exports.flow = exports.integration = void 0;
|
|
26
26
|
const serverTypes_1 = require("./serverTypes");
|
|
27
27
|
const convertComponent_1 = require("./serverTypes/convertComponent");
|
|
28
28
|
const convertIntegration_1 = require("./serverTypes/convertIntegration");
|
|
@@ -557,24 +557,6 @@ exports.dataSource = dataSource;
|
|
|
557
557
|
*/
|
|
558
558
|
const input = (definition) => definition;
|
|
559
559
|
exports.input = input;
|
|
560
|
-
/**
|
|
561
|
-
* Groups related primitive inputs under a single named container. Children
|
|
562
|
-
* may not themselves be structuredObject inputs (the type signature enforces
|
|
563
|
-
* this at compile time).
|
|
564
|
-
*
|
|
565
|
-
* @example
|
|
566
|
-
* import { input, structuredObjectInput } from "@prismatic-io/spectral";
|
|
567
|
-
*
|
|
568
|
-
* const name = structuredObjectInput({
|
|
569
|
-
* label: "Name",
|
|
570
|
-
* inputs: {
|
|
571
|
-
* first: input({ type: "string", label: "First Name", required: true }),
|
|
572
|
-
* last: input({ type: "string", label: "Last Name", required: true }),
|
|
573
|
-
* },
|
|
574
|
-
* });
|
|
575
|
-
*/
|
|
576
|
-
const structuredObjectInput = (definition) => (Object.assign(Object.assign({}, definition), { type: "structuredObject" }));
|
|
577
|
-
exports.structuredObjectInput = structuredObjectInput;
|
|
578
560
|
/**
|
|
579
561
|
* This function creates a connection that can be used by a code-native integration
|
|
580
562
|
* or custom component. Connections define the fields (API keys, tokens, etc.) needed
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentRegistry, Inputs, IntegrationDefinition, TriggerPayload, TriggerResult } from "../types";
|
|
1
|
+
import type { ComponentRegistry, Inputs, IntegrationDefinition, TriggerPayload, TriggerResult } from "../types";
|
|
2
2
|
import type { ActionContext } from "../types/ActionPerformFunction";
|
|
3
3
|
export declare function runWithContext<T>(context: ActionContext, fn: () => T | Promise<T>): T | Promise<T>;
|
|
4
4
|
export declare function requireContext(): ActionContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActionContext, ComponentManifest, ComponentRegistry, ConfigVarResultCollection, DebugContext, FlowInvoker } from "../types";
|
|
2
|
-
import { ActionContext as ServerActionContext } from ".";
|
|
1
|
+
import type { ActionContext, ComponentManifest, ComponentRegistry, ConfigVarResultCollection, DebugContext, FlowInvoker } from "../types";
|
|
2
|
+
import type { ActionContext as ServerActionContext } from ".";
|
|
3
3
|
export declare function createCNIContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TComponentActions extends Record<string, ComponentManifest["actions"]> = Record<string, ComponentManifest["actions"]>, TFlows extends string[] = string[]>(context: ActionContext<TConfigVars, TComponentActions, TFlows>, componentRegistry: ComponentRegistry): ActionContext<TConfigVars, TComponentActions, TFlows>;
|
|
4
4
|
export declare function createDebugContext(context: ServerActionContext): DebugContext;
|
|
5
5
|
export declare function logDebugResults(context: ActionContext): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ComponentDefinition, ComponentHooks, ConfigVarResultCollection, ConnectionDefinition, ConnectionInput, ConnectionTemplateInputField, InputFieldDefinition, Inputs, OnPremConnectionInput, TriggerDefinition, TriggerPayload, TriggerResult } from "../types";
|
|
2
|
-
import { PollingTriggerDefinition } from "../types/PollingTriggerDefinition";
|
|
3
|
-
import { Component as ServerComponent, Connection as ServerConnection, Input as ServerInput, Trigger as ServerTrigger } from ".";
|
|
4
|
-
export declare const convertInput: (key: string,
|
|
1
|
+
import { type ComponentDefinition, type ComponentHooks, type ConfigVarResultCollection, type ConnectionDefinition, type ConnectionInput, type ConnectionTemplateInputField, type InputFieldDefinition, type Inputs, type OnPremConnectionInput, type TriggerDefinition, type TriggerPayload, type TriggerResult } from "../types";
|
|
2
|
+
import { type PollingTriggerDefinition } from "../types/PollingTriggerDefinition";
|
|
3
|
+
import type { Component as ServerComponent, Connection as ServerConnection, Input as ServerInput, Trigger as ServerTrigger } from ".";
|
|
4
|
+
export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition | OnPremConnectionInput | ConnectionInput) => ServerInput;
|
|
5
5
|
export declare const _isValidTemplateValue: (template: string, inputs: {
|
|
6
6
|
[key: string]: ConnectionInput | ConnectionTemplateInputField;
|
|
7
7
|
}) => {
|
|
@@ -19,22 +19,16 @@ const omit_1 = __importDefault(require("lodash/omit"));
|
|
|
19
19
|
const types_1 = require("../types");
|
|
20
20
|
const PollingTriggerDefinition_1 = require("../types/PollingTriggerDefinition");
|
|
21
21
|
const perform_1 = require("./perform");
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
// Cast: union members don't all carry `default`/`collection`/`inputs`;
|
|
25
|
-
// runtime guards below handle the differences.
|
|
26
|
-
const _a = definition, { default: defaultValue, type, label, collection, inputs: childInputs } = _a, rest = __rest(_a, ["default", "type", "label", "collection", "inputs"]);
|
|
22
|
+
const convertInput = (key, _a) => {
|
|
23
|
+
var { default: defaultValue, type, label, collection } = _a, rest = __rest(_a, ["default", "type", "label", "collection"]);
|
|
27
24
|
const keyLabel = collection === "keyvaluelist" && typeof label === "object" ? label.key : undefined;
|
|
28
|
-
const nestedInputs = type === "structuredObject" && childInputs
|
|
29
|
-
? Object.entries(childInputs).map(([childKey, childDef]) => (0, exports.convertInput)(childKey, childDef))
|
|
30
|
-
: undefined;
|
|
31
25
|
return Object.assign(Object.assign({}, (0, omit_1.default)(rest, [
|
|
32
26
|
"onPremControlled",
|
|
33
27
|
"permissionAndVisibilityType",
|
|
34
28
|
"visibleToOrgDeployer",
|
|
35
29
|
"writeOnly",
|
|
36
30
|
])), { key,
|
|
37
|
-
type, default: defaultValue !== null && defaultValue !== void 0 ? defaultValue : types_1.InputFieldDefaultMap[type], collection, label: typeof label === "string" ? label : label.value, keyLabel, onPremiseControlled:
|
|
31
|
+
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 });
|
|
38
32
|
};
|
|
39
33
|
exports.convertInput = convertInput;
|
|
40
34
|
const TEMPLATE_VALUE_REGEX = /{{#(\w+)}}/g;
|
|
@@ -79,7 +73,7 @@ exports.convertTemplateInput = convertTemplateInput;
|
|
|
79
73
|
const convertAction = (actionKey, _a, hooks) => {
|
|
80
74
|
var { inputs = {}, perform } = _a, action = __rest(_a, ["inputs", "perform"]);
|
|
81
75
|
const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
|
|
82
|
-
const inputCleaners = Object.entries(inputs).reduce((result, [key,
|
|
76
|
+
const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});
|
|
83
77
|
return Object.assign(Object.assign({}, action), { key: actionKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {
|
|
84
78
|
inputCleaners,
|
|
85
79
|
errorHandler: hooks === null || hooks === void 0 ? void 0 : hooks.error,
|
|
@@ -90,15 +84,17 @@ const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
|
90
84
|
const { onInstanceDeploy, onInstanceDelete } = trigger;
|
|
91
85
|
const webhookLifecycleHandlers = "webhookLifecycleHandlers" in trigger ? trigger.webhookLifecycleHandlers : undefined;
|
|
92
86
|
const inputs = (_a = trigger.inputs) !== null && _a !== void 0 ? _a : {};
|
|
87
|
+
const isPollingTrigger = (0, PollingTriggerDefinition_1.isPollingTriggerDefinition)(trigger);
|
|
93
88
|
const triggerInputKeys = Object.keys(inputs);
|
|
94
89
|
const convertedTriggerInputs = Object.entries(inputs).map(([key, value]) => {
|
|
95
90
|
return (0, exports.convertInput)(key, value);
|
|
96
91
|
});
|
|
97
|
-
const triggerInputCleaners = Object.entries(inputs).reduce((result, [key,
|
|
92
|
+
const triggerInputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});
|
|
98
93
|
let scheduleSupport = "scheduleSupport" in trigger ? trigger.scheduleSupport : "invalid";
|
|
99
94
|
let convertedActionInputs = [];
|
|
100
95
|
let performToUse;
|
|
101
|
-
if (
|
|
96
|
+
if (isPollingTrigger) {
|
|
97
|
+
// Pull inputs up from the action and make them available on the trigger
|
|
102
98
|
const { pollAction: action } = trigger;
|
|
103
99
|
let actionInputCleaners = {};
|
|
104
100
|
scheduleSupport = "required";
|
|
@@ -110,7 +106,7 @@ const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
|
110
106
|
accum.push((0, exports.convertInput)(key, value));
|
|
111
107
|
return accum;
|
|
112
108
|
}, []);
|
|
113
|
-
actionInputCleaners = Object.entries(action.inputs).reduce((result, [key,
|
|
109
|
+
actionInputCleaners = Object.entries(action.inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});
|
|
114
110
|
}
|
|
115
111
|
const combinedCleaners = Object.assign({}, actionInputCleaners, triggerInputCleaners);
|
|
116
112
|
performToUse = (0, perform_1.createPollingPerform)(trigger, {
|
|
@@ -128,7 +124,7 @@ const convertTrigger = (triggerKey, trigger, hooks) => {
|
|
|
128
124
|
? trigger.synchronousResponseSupport
|
|
129
125
|
: scheduleSupport === "invalid"
|
|
130
126
|
? "valid"
|
|
131
|
-
: "invalid" }), (
|
|
127
|
+
: "invalid" }), (isPollingTrigger ? { isPollingTrigger: true } : {}));
|
|
132
128
|
if (onInstanceDeploy) {
|
|
133
129
|
result.onInstanceDeploy = (0, perform_1.createPerform)(onInstanceDeploy, {
|
|
134
130
|
inputCleaners: triggerInputCleaners,
|
|
@@ -162,7 +158,7 @@ exports.convertTrigger = convertTrigger;
|
|
|
162
158
|
const convertDataSource = (dataSourceKey, _a, hooks) => {
|
|
163
159
|
var { inputs = {}, perform } = _a, dataSource = __rest(_a, ["inputs", "perform"]);
|
|
164
160
|
const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
|
|
165
|
-
const inputCleaners = Object.entries(inputs).reduce((result, [key,
|
|
161
|
+
const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});
|
|
166
162
|
return Object.assign(Object.assign({}, dataSource), { key: dataSourceKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {
|
|
167
163
|
inputCleaners,
|
|
168
164
|
errorHandler: hooks === null || hooks === void 0 ? void 0 : hooks.error,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CollectionType, ComponentRegistry, ConfigPages, ConfigVar, ConfigVarResultCollection, Flow, Inputs, IntegrationDefinition, QueueConfig, StandardQueueConfig, TriggerResult as TriggerPerformResult, TriggerReference } from "../types";
|
|
2
|
-
import { ActionContext, Component as ServerComponent, TriggerPayload, TriggerResult } from ".";
|
|
3
|
-
import { ComponentReference as ServerComponentReference, ConfigPage as ServerConfigPage, RequiredConfigVariable as ServerRequiredConfigVariable } from "./integration";
|
|
1
|
+
import { type CollectionType, type ComponentRegistry, type ConfigPages, type ConfigVar, type ConfigVarResultCollection, type Flow, type Inputs, type IntegrationDefinition, type QueueConfig, type StandardQueueConfig, type TriggerResult as TriggerPerformResult, type TriggerReference } from "../types";
|
|
2
|
+
import type { ActionContext, Component as ServerComponent, TriggerPayload, TriggerResult } from ".";
|
|
3
|
+
import { type ComponentReference as ServerComponentReference, type ConfigPage as ServerConfigPage, type RequiredConfigVariable as ServerRequiredConfigVariable } from "./integration";
|
|
4
4
|
export declare const CONCURRENCY_LIMIT_MAX = 15;
|
|
5
5
|
export declare const CONCURRENCY_LIMIT_MIN = 2;
|
|
6
6
|
export declare const convertIntegration: <TInputs extends Inputs, TActionInputs extends Inputs, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerPerformResult<TAllowsBranching, TPayload> = TriggerPerformResult<TAllowsBranching, TPayload>>(definition: IntegrationDefinition<TInputs, TActionInputs, TPayload, TAllowsBranching, TResult>) => ServerComponent<TInputs, TActionInputs, ConfigVarResultCollection, TPayload, TAllowsBranching, TResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentManifest, ConfigVarResultCollection, CustomerAttributes, DataSourceResultType, DataSourceType, DebugContext, ExecutionFrame, FlowAttributes, FlowInvoker, FlowSchemas, Inputs, InstanceAttributes, IntegrationAttributes, PollingTriggerPerformFunction, TriggerEventFunctionReturn, TriggerPerformFunction, TriggerResult as TriggerPerformResult, UserAttributes } from "../types";
|
|
1
|
+
import type { ComponentManifest, ConfigVarResultCollection, CustomerAttributes, DataSourceResultType, DataSourceType, DebugContext, ExecutionFrame, FlowAttributes, FlowInvoker, FlowSchemas, Inputs, InstanceAttributes, IntegrationAttributes, PollingTriggerPerformFunction, TriggerEventFunctionReturn, TriggerPerformFunction, TriggerResult as TriggerPerformResult, UserAttributes } from "../types";
|
|
2
2
|
import type { CNIPollingPerformFunction, ComponentRefTriggerPerformFunction } from "./triggerTypes";
|
|
3
3
|
interface DisplayDefinition {
|
|
4
4
|
label: string;
|
|
@@ -262,7 +262,5 @@ export interface Input {
|
|
|
262
262
|
onPremiseControlled?: boolean;
|
|
263
263
|
dataSource?: string;
|
|
264
264
|
shown?: boolean;
|
|
265
|
-
/** Nested child inputs; populated only when `type === "structuredObject"`. */
|
|
266
|
-
inputs?: Input[];
|
|
267
265
|
}
|
|
268
266
|
export * from "./asyncContext";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ActionContext, ComponentRegistry, ConfigVarResultCollection, ErrorHandler, Inputs, PollingContext, PollingTriggerDefinition, PollingTriggerPerformFunction, TriggerPayload, TriggerPerformFunction, TriggerReference, TriggerResult } from "../types";
|
|
2
|
-
import { ComponentReference as ServerComponentReference } from "./integration";
|
|
2
|
+
import type { ComponentReference as ServerComponentReference } from "./integration";
|
|
3
3
|
import type { CNIPollingPerformFunction, ComponentRefTriggerPerformFunction } from "./triggerTypes";
|
|
4
4
|
export type PerformFn = (...args: any[]) => Promise<any>;
|
|
5
5
|
interface CreatePollingContext {
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
import type { ConditionalExpression } from "./conditional-logic";
|
|
2
|
-
import type { Connection, InputCleanFunction, InputFieldCollection, Inputs, KeyValuePair
|
|
3
|
-
/** Resolves a single InputFieldDefinition's runtime value type. structuredObject
|
|
4
|
-
* resolves to `unknown` until the per-field record-type recursion lands. */
|
|
5
|
-
type InputValue<T> = T extends StructuredObjectInputField ? unknown : T extends {
|
|
6
|
-
clean: InputCleanFunction<any>;
|
|
7
|
-
} ? ReturnType<T["clean"]> : T extends {
|
|
8
|
-
type: "connection";
|
|
9
|
-
collection?: InputFieldCollection;
|
|
10
|
-
} ? ExtractValue<Connection, T["collection"]> : T extends {
|
|
11
|
-
type: "conditional";
|
|
12
|
-
collection?: InputFieldCollection;
|
|
13
|
-
} ? ExtractValue<ConditionalExpression, T["collection"]> : T extends {
|
|
14
|
-
default?: unknown;
|
|
15
|
-
collection?: InputFieldCollection;
|
|
16
|
-
} ? ExtractValue<T["default"], T["collection"]> : unknown;
|
|
2
|
+
import type { Connection, InputCleanFunction, InputFieldCollection, Inputs, KeyValuePair } from "./Inputs";
|
|
17
3
|
/**
|
|
18
4
|
* Collection of input parameters.
|
|
19
5
|
* Inputs can be static values, references to config variables, or
|
|
20
6
|
* references to previous steps' outputs.
|
|
21
7
|
*/
|
|
22
8
|
export type ActionInputParameters<TInputs extends Inputs> = {
|
|
23
|
-
[Property in keyof TInputs]:
|
|
9
|
+
[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"]>;
|
|
24
10
|
};
|
|
25
11
|
export type ExtractValue<TType, TCollection extends InputFieldCollection | undefined> = TCollection extends "keyvaluelist" ? KeyValuePair<TType>[] : TCollection extends "valuelist" ? TType[] : TType;
|
|
26
|
-
export {};
|
package/dist/types/Inputs.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ export type OnPremConnectionInput = {
|
|
|
83
83
|
*/
|
|
84
84
|
onPremControlled: true;
|
|
85
85
|
} & ConnectionInput;
|
|
86
|
-
export type InputFieldDefinition = StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField | CodeInputField | ConditionalInputField | ConnectionInputField | ConnectionTemplateInputField | ObjectSelectionInputField | ObjectFieldMapInputField | JSONFormInputField | DynamicObjectSelectionInputField | DynamicFieldSelectionInputField | DateInputField | DateTimeInputField | FlowInputField
|
|
86
|
+
export type InputFieldDefinition = StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField | CodeInputField | ConditionalInputField | ConnectionInputField | ConnectionTemplateInputField | ObjectSelectionInputField | ObjectFieldMapInputField | JSONFormInputField | DynamicObjectSelectionInputField | DynamicFieldSelectionInputField | DateInputField | DateTimeInputField | FlowInputField;
|
|
87
87
|
export type InputCleanFunction<TValue, TResult = TValue> = (value: TValue) => TResult;
|
|
88
88
|
interface BaseInputField {
|
|
89
89
|
/** Name of this field to present in the UI. */
|
|
@@ -289,17 +289,6 @@ export type DateTimeInputField = BaseInputField & {
|
|
|
289
289
|
/** Clean function. */
|
|
290
290
|
clean?: InputCleanFunction<unknown>;
|
|
291
291
|
} & CollectionOptions<string>;
|
|
292
|
-
/** `InputFieldDefinition` minus `StructuredObjectInputField`; used to cap
|
|
293
|
-
* structuredObject nesting at one level. */
|
|
294
|
-
export type LeafInputFieldDefinition = Exclude<InputFieldDefinition, StructuredObjectInputField>;
|
|
295
|
-
/** Groups related primitive inputs under a single named container.
|
|
296
|
-
* Nesting is capped at one level. */
|
|
297
|
-
export type StructuredObjectInputField = Omit<BaseInputField, "dataSource"> & {
|
|
298
|
-
/** Data type the input will collect. */
|
|
299
|
-
type: "structuredObject";
|
|
300
|
-
/** Nested input fields keyed by their local key. */
|
|
301
|
-
inputs: Record<string, LeafInputFieldDefinition>;
|
|
302
|
-
};
|
|
303
292
|
/** Defines a single Choice option for a InputField. */
|
|
304
293
|
export interface InputFieldChoice {
|
|
305
294
|
/** Label to display for this Choice. */
|
package/dist/types/Inputs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpResponse } from "./HttpResponse";
|
|
2
|
-
import { TriggerPayload } from "./TriggerPayload";
|
|
1
|
+
import type { HttpResponse } from "./HttpResponse";
|
|
2
|
+
import type { TriggerPayload } from "./TriggerPayload";
|
|
3
3
|
/** Represents the result of a Trigger action. */
|
|
4
4
|
export interface TriggerBaseResult<TPayload extends TriggerPayload> {
|
|
5
5
|
/** The payload in the request that invoked the Integration, which is returned as a result for later use. */
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
37
|
};
|
package/dist/util.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Many functions in the `util` module are used to coerce data into a particular type, and can be accessed through `util.types`.
|
|
4
4
|
* For example, `util.types.toInt("5.5")` will return an integer, `5`.
|
|
5
5
|
*/
|
|
6
|
-
import { ConnectionDefinition, DataPayload, Element, JSONForm, KeyValuePair, ObjectFieldMap, ObjectSelection } from "./types";
|
|
6
|
+
import type { ConnectionDefinition, DataPayload, Element, JSONForm, KeyValuePair, ObjectFieldMap, ObjectSelection } from "./types";
|
|
7
7
|
export declare const isObjectWithOneTruthyKey: (value: unknown, keys: string[]) => boolean;
|
|
8
8
|
export declare const isObjectWithTruthyKeys: (value: unknown, keys: string[]) => boolean;
|
|
9
9
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismatic-io/spectral",
|
|
3
|
-
"version": "10.18.6
|
|
3
|
+
"version": "10.18.6",
|
|
4
4
|
"description": "Utility library for building Prismatic connectors and code-native integrations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prismatic"
|
|
@@ -42,34 +42,34 @@
|
|
|
42
42
|
"dist/"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"axios": "^1.
|
|
45
|
+
"axios": "^1.16.1",
|
|
46
46
|
"axios-retry": "^4.5.0",
|
|
47
47
|
"date-fns": "^4.1.0",
|
|
48
|
-
"ejs": "^
|
|
48
|
+
"ejs": "^5.0.2",
|
|
49
49
|
"form-data": "^4.0.5",
|
|
50
|
-
"fs-extra": "^11.
|
|
51
|
-
"jest-mock": "^30.
|
|
50
|
+
"fs-extra": "^11.3.5",
|
|
51
|
+
"jest-mock": "^30.4.1",
|
|
52
52
|
"lodash": "^4.18.1",
|
|
53
53
|
"object-sizeof": "^2.6.4",
|
|
54
54
|
"prettier": "^3.8.3",
|
|
55
55
|
"safe-stable-stringify": "^2.5.0",
|
|
56
56
|
"valid-url": "1.0.9",
|
|
57
|
-
"yaml": "^2.
|
|
57
|
+
"yaml": "^2.9.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@biomejs/biome": "^2.4.
|
|
61
|
-
"@fast-check/vitest": "^0.4.
|
|
60
|
+
"@biomejs/biome": "^2.4.15",
|
|
61
|
+
"@fast-check/vitest": "^0.4.1",
|
|
62
62
|
"@types/ejs": "3.1.5",
|
|
63
63
|
"@types/fs-extra": "11.0.4",
|
|
64
64
|
"@types/lodash": "^4.17.24",
|
|
65
|
-
"@types/node": "^
|
|
65
|
+
"@types/node": "^25.7.0",
|
|
66
66
|
"@types/prettier": "^3.0.0",
|
|
67
67
|
"@types/sax": "^1.2.7",
|
|
68
68
|
"@types/valid-url": "^1.0.7",
|
|
69
|
-
"@vitest/ui": "^4.1.
|
|
69
|
+
"@vitest/ui": "^4.1.6",
|
|
70
70
|
"copyfiles": "2.4.1",
|
|
71
|
-
"fast-check": "^4.
|
|
72
|
-
"typescript": "
|
|
73
|
-
"vitest": "^4.1.
|
|
71
|
+
"fast-check": "^4.8.0",
|
|
72
|
+
"typescript": "6.0.3",
|
|
73
|
+
"vitest": "^4.1.6"
|
|
74
74
|
}
|
|
75
75
|
}
|