@prismatic-io/spectral 7.10.0 → 8.0.0-preview11

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.
Files changed (40) hide show
  1. package/dist/clients/http/index.d.ts +1 -1
  2. package/dist/clients/soap/index.d.ts +2 -0
  3. package/dist/clients/soap/index.js +18 -0
  4. package/dist/clients/soap/types.d.ts +71 -0
  5. package/dist/clients/soap/types.js +24 -0
  6. package/dist/clients/soap/utils.d.ts +12 -0
  7. package/dist/clients/soap/utils.js +191 -0
  8. package/dist/index.d.ts +41 -12
  9. package/dist/index.js +43 -1
  10. package/dist/serverTypes/convert.d.ts +2 -1
  11. package/dist/serverTypes/convert.js +250 -1
  12. package/dist/serverTypes/index.d.ts +27 -24
  13. package/dist/testing.d.ts +14 -9
  14. package/dist/testing.js +57 -49
  15. package/dist/types/ActionDefinition.d.ts +3 -3
  16. package/dist/types/ActionInputParameters.d.ts +14 -1
  17. package/dist/types/ActionPerformFunction.d.ts +12 -9
  18. package/dist/types/ComponentDefinition.d.ts +2 -2
  19. package/dist/types/{Customer.d.ts → CustomerAttributes.d.ts} +1 -1
  20. package/dist/types/DataSourcePerformFunction.d.ts +4 -4
  21. package/dist/types/{Flow.d.ts → FlowAttributes.d.ts} +1 -1
  22. package/dist/types/Inputs.d.ts +44 -50
  23. package/dist/types/{Instance.d.ts → InstanceAttributes.d.ts} +1 -1
  24. package/dist/types/{Integration.d.ts → IntegrationAttributes.d.ts} +2 -1
  25. package/dist/types/IntegrationDefinition.d.ts +273 -0
  26. package/dist/types/IntegrationDefinition.js +78 -0
  27. package/dist/types/TriggerDefinition.d.ts +5 -5
  28. package/dist/types/TriggerEventFunction.d.ts +2 -2
  29. package/dist/types/TriggerPayload.d.ts +6 -6
  30. package/dist/types/TriggerPerformFunction.d.ts +2 -2
  31. package/dist/types/TriggerResult.d.ts +4 -4
  32. package/dist/types/{User.d.ts → UserAttributes.d.ts} +1 -1
  33. package/dist/types/index.d.ts +6 -5
  34. package/dist/types/index.js +6 -5
  35. package/package.json +6 -4
  36. /package/dist/types/{Customer.js → CustomerAttributes.js} +0 -0
  37. /package/dist/types/{Flow.js → FlowAttributes.js} +0 -0
  38. /package/dist/types/{Instance.js → InstanceAttributes.js} +0 -0
  39. /package/dist/types/{Integration.js → IntegrationAttributes.js} +0 -0
  40. /package/dist/types/{User.js → UserAttributes.js} +0 -0
@@ -162,7 +162,7 @@ export declare const buildRawRequestAction: (baseUrl: string, label?: string, de
162
162
  type: "connection";
163
163
  required: true;
164
164
  };
165
- }, boolean, {
165
+ }, import("../..").ConfigVarResultCollection, boolean, {
166
166
  data: any;
167
167
  }>;
168
168
  export { inputs };
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./utils";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./utils"), exports);
@@ -0,0 +1,71 @@
1
+ import { Connection } from "../../index";
2
+ import { IMTOMAttachments } from "soap";
3
+ /**
4
+ * SOAPConnection takes standard connection fields, and adds an optional `wsdlDefinitionUrl` field.
5
+ */
6
+ export interface SOAPConnection extends Connection {
7
+ fields: {
8
+ [key: string]: unknown;
9
+ wsdlDefinitionUrl?: string;
10
+ };
11
+ }
12
+ /**
13
+ * This function determines if the object presented is a SOAP connection with a `wsdlDefinitionUrl` field.
14
+ * @param connection The connection to test
15
+ * @returns This function returns true if the connection is a SOAPConnection, and false otherwise.
16
+ */
17
+ export declare const isSOAPConnection: (connection: unknown) => connection is SOAPConnection;
18
+ /**
19
+ * SOAP requests return a 4-tuple or 5-tuple with the response first, the XML response second, headers third, and the XML request fourth, and optional message attachments fifth.
20
+ */
21
+ export declare type SOAPResponse = [any, any, any, any, IMTOMAttachments?];
22
+ /**
23
+ * Overload the `soapRequest` function to take a variety of types of arguments.
24
+ */
25
+ export interface SOAPRequest {
26
+ (params: RequestParams): Promise<SOAPResponse>;
27
+ (params: RequestParams, methodParams: Record<string, unknown>): Promise<SOAPResponse>;
28
+ (params: RequestParams, methodParams: undefined): Promise<SOAPResponse>;
29
+ }
30
+ export interface RequestParams {
31
+ wsdlParam: SOAPConnection | string;
32
+ method: string;
33
+ overrides?: ClientOverrides;
34
+ debug?: boolean;
35
+ }
36
+ export interface ClientOverrides {
37
+ endpointURL?: string;
38
+ soapHeaders?: unknown[];
39
+ }
40
+ export interface HeaderPayload {
41
+ [x: string]: any;
42
+ }
43
+ export interface GenerateHeader {
44
+ (wsdlParam: SOAPConnection | string, headerPayload: HeaderPayload, headerOptions: undefined): Promise<string>;
45
+ (wsdlParam: SOAPConnection | string, headerPayload: HeaderPayload, headerOptions: {
46
+ namespace: string;
47
+ xmlns: string;
48
+ }): Promise<string>;
49
+ }
50
+ export interface BasicAuthConnection extends Connection {
51
+ fields: {
52
+ [key: string]: unknown;
53
+ username: unknown;
54
+ password: unknown;
55
+ loginMethod: unknown;
56
+ };
57
+ }
58
+ /**
59
+ * This function determines if the object presented is a Basic Auth connection with `username`, `password`, and `loginMethod` fields.
60
+ * @param connection The connection to test
61
+ * @returns This function returns true if the connection is a SOAPConnection, and false otherwise.
62
+ */
63
+ export declare const isBasicAuthConnection: (connection: Connection) => connection is BasicAuthConnection;
64
+ export interface SOAPAuth {
65
+ (connection: BasicAuthConnection, wsdlDefinition: string): Promise<any>;
66
+ (connection: BasicAuthConnection & SOAPConnection): Promise<any>;
67
+ }
68
+ export interface DescribeWSDL {
69
+ (connection: SOAPConnection): Promise<any>;
70
+ (wsdlDefinition: string): Promise<any>;
71
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBasicAuthConnection = exports.isSOAPConnection = void 0;
4
+ /**
5
+ * This function determines if the object presented is a SOAP connection with a `wsdlDefinitionUrl` field.
6
+ * @param connection The connection to test
7
+ * @returns This function returns true if the connection is a SOAPConnection, and false otherwise.
8
+ */
9
+ const isSOAPConnection = (connection) => {
10
+ if (typeof connection === "object" && connection !== null)
11
+ return "wsdlDefinitionURL" in (connection === null || connection === void 0 ? void 0 : connection.fields);
12
+ return false;
13
+ };
14
+ exports.isSOAPConnection = isSOAPConnection;
15
+ /**
16
+ * This function determines if the object presented is a Basic Auth connection with `username`, `password`, and `loginMethod` fields.
17
+ * @param connection The connection to test
18
+ * @returns This function returns true if the connection is a SOAPConnection, and false otherwise.
19
+ */
20
+ const isBasicAuthConnection = (connection) => {
21
+ const { fields } = connection;
22
+ return ("username" in fields && "password" in fields && "loginMethod" in fields);
23
+ };
24
+ exports.isBasicAuthConnection = isBasicAuthConnection;
@@ -0,0 +1,12 @@
1
+ import { ClientOverrides, GenerateHeader, SOAPAuth, SOAPConnection, SOAPRequest, DescribeWSDL } from "./types";
2
+ import { Client } from "soap";
3
+ declare const _default: {
4
+ describeWSDL: DescribeWSDL;
5
+ generateHeader: GenerateHeader;
6
+ getSOAPAuth: SOAPAuth;
7
+ getSOAPClient: <T extends string | SOAPConnection = string | SOAPConnection>(wsdlParam: T) => Promise<Client>;
8
+ getWSDL: (wsdlDefinitionURL: string) => Promise<string>;
9
+ overrideClientDefaults: (client: Client, overrides: ClientOverrides) => void;
10
+ soapRequest: SOAPRequest;
11
+ };
12
+ export default _default;
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
16
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
17
+ const types_1 = require("./types");
18
+ const index_1 = require("../../index");
19
+ const soap_1 = require("soap");
20
+ const axios_1 = __importDefault(require("axios"));
21
+ const promises_1 = require("fs/promises");
22
+ const uuid_1 = require("uuid");
23
+ const os_1 = __importDefault(require("os"));
24
+ const path_1 = __importDefault(require("path"));
25
+ /**
26
+ * Optionally log out SOAP requests and responses for debugging purposes
27
+ *
28
+ * @param client A SOAP client that generates requests and responses
29
+ */
30
+ const debugRequest = (client) => {
31
+ console.debug(client.lastRequest);
32
+ console.debug(client.lastResponse);
33
+ };
34
+ /**
35
+ * This function takes either the URL of a WSDL or the XML defining a WSDL, and returns an object describing the methods and attributes defined in the WSDL.
36
+ *
37
+ * @param wsdlParam Either the URL where a WSDL is stored, or the XML defining a WSDL.
38
+ * @returns An object containing the methods and attributes defined in a WSDL
39
+ */
40
+ const describeWSDL = (wsdlParam) => __awaiter(void 0, void 0, void 0, function* () {
41
+ const client = yield getSOAPClient((0, types_1.isSOAPConnection)(wsdlParam) ? wsdlParam : index_1.util.types.toString(wsdlParam));
42
+ try {
43
+ const result = client.describe();
44
+ return result;
45
+ }
46
+ catch (error) {
47
+ throw new Error("Unable to parse WSDL Services due to circular references");
48
+ }
49
+ });
50
+ /**
51
+ * Fetch a WSDL from a URL
52
+ * @param wsdlDefinitionURL The URL where the WSDL is stored
53
+ * @returns The WSDL's raw XML
54
+ */
55
+ const getWSDL = (wsdlDefinitionURL) => __awaiter(void 0, void 0, void 0, function* () {
56
+ const httpClient = axios_1.default.create({
57
+ baseURL: wsdlDefinitionURL,
58
+ headers: { "Content-Type": "text/xml" },
59
+ });
60
+ const { data } = yield httpClient.get("");
61
+ return index_1.util.types.toString(data);
62
+ });
63
+ /**
64
+ * Create a SOAP client given a WSDL or SOAPConnection
65
+ * @param wsdlParam a SOAPConnection or XML defining a WSDL
66
+ * @returns An HTTP client configured to query a SOAP-based API
67
+ */
68
+ const getSOAPClient = (wsdlParam) => __awaiter(void 0, void 0, void 0, function* () {
69
+ if (typeof wsdlParam === "string") {
70
+ const wsdl = index_1.util.types.toString(wsdlParam);
71
+ const filePath = path_1.default.join(os_1.default.tmpdir(), `${(0, uuid_1.v4)()}.wsdl`);
72
+ yield (0, promises_1.writeFile)(filePath, wsdl);
73
+ const client = yield (0, soap_1.createClientAsync)(filePath);
74
+ yield (0, promises_1.rm)(filePath);
75
+ return client;
76
+ }
77
+ else if ((0, types_1.isSOAPConnection)(wsdlParam)) {
78
+ const { fields: { wsdlDefinitionURL }, } = wsdlParam;
79
+ if (!wsdlDefinitionURL ||
80
+ !index_1.util.types.isUrl(index_1.util.types.toString(wsdlDefinitionURL))) {
81
+ throw new Error("WSDL Definition or the Connection field 'wsdlDefinitionURL' must be supplied.");
82
+ }
83
+ const client = yield (0, soap_1.createClientAsync)(index_1.util.types.toString(wsdlDefinitionURL));
84
+ return client;
85
+ }
86
+ else {
87
+ throw new Error("WSDL Definition or the Connection field 'wsdlDefinitionURL' must be supplied.");
88
+ }
89
+ });
90
+ /**
91
+ * Override some HTTP client defaults
92
+ * @param client The client to override
93
+ * @param overrides An endpoint URL or SOAP headers to override
94
+ */
95
+ const overrideClientDefaults = (client, overrides) => {
96
+ const { endpointURL, soapHeaders } = overrides;
97
+ if (endpointURL) {
98
+ client.setEndpoint(endpointURL);
99
+ }
100
+ if (soapHeaders) {
101
+ soapHeaders.map((header) => {
102
+ client.addSoapHeader(header);
103
+ });
104
+ }
105
+ };
106
+ /**
107
+ * Make a request to a SOAP-based API
108
+ * @param param0
109
+ * @param methodParams Parameters to pass to the specified SOAP method
110
+ * @returns The results from the SOAP request, including the full XML of the request and response
111
+ */
112
+ const soapRequest = ({ wsdlParam, method, overrides, debug }, methodParams) => __awaiter(void 0, void 0, void 0, function* () {
113
+ const client = yield getSOAPClient((0, types_1.isSOAPConnection)(wsdlParam) ? wsdlParam : index_1.util.types.toString(wsdlParam));
114
+ if (overrides) {
115
+ overrideClientDefaults(client, overrides);
116
+ }
117
+ const requestFunction = client[`${method}Async`];
118
+ let results = undefined;
119
+ try {
120
+ if (typeof methodParams === "object" && methodParams !== null) {
121
+ results = yield requestFunction(methodParams);
122
+ }
123
+ else {
124
+ results = yield requestFunction({});
125
+ }
126
+ if (index_1.util.types.isBool(debug) && debug) {
127
+ debugRequest(client);
128
+ }
129
+ return results;
130
+ }
131
+ catch (error) {
132
+ if (index_1.util.types.isBool(debug) && debug) {
133
+ debugRequest(client);
134
+ }
135
+ console.warn("Please verify that the method you specified exists in the WSDL specification.");
136
+ throw error;
137
+ }
138
+ });
139
+ /**
140
+ * Create a SOAP header
141
+ * @param wsdlParam A SOAPConnection or XML definition of a WSDL
142
+ * @param headerPayload The contents of a header XML node
143
+ * @param headerOptions Attributes for a header XML node, like namespace or xmlns
144
+ * @returns
145
+ */
146
+ const generateHeader = (wsdlParam, headerPayload, headerOptions) => __awaiter(void 0, void 0, void 0, function* () {
147
+ const client = yield getSOAPClient((0, types_1.isSOAPConnection)(wsdlParam) ? wsdlParam : index_1.util.types.toString(wsdlParam));
148
+ let options = [];
149
+ if (headerOptions) {
150
+ options = Object.values(headerOptions);
151
+ }
152
+ const index = client.addSoapHeader(headerPayload, "", ...options);
153
+ return client.getSoapHeaders()[index];
154
+ });
155
+ /**
156
+ * Fetch authentication information for a SOAPConnection
157
+ * @param connection The SOAPConnection
158
+ * @param wsdlDefinition The XML WSDL definition
159
+ * @returns
160
+ */
161
+ const getSOAPAuth = (connection, wsdlDefinition) => __awaiter(void 0, void 0, void 0, function* () {
162
+ if ((0, types_1.isBasicAuthConnection)(connection) && wsdlDefinition) {
163
+ const { fields: { username, password, loginMethod }, } = connection;
164
+ const result = yield soapRequest({
165
+ wsdlParam: index_1.util.types.toString(wsdlDefinition),
166
+ method: index_1.util.types.toString(loginMethod),
167
+ }, { username, password });
168
+ return result;
169
+ }
170
+ else if ((0, types_1.isSOAPConnection)(connection) &&
171
+ (0, types_1.isBasicAuthConnection)(connection)) {
172
+ const { fields: { username, password, loginMethod }, } = connection;
173
+ const result = yield soapRequest({
174
+ wsdlParam: connection,
175
+ method: index_1.util.types.toString(loginMethod),
176
+ }, { username, password });
177
+ return result;
178
+ }
179
+ else {
180
+ throw new Error("Must supply a SOAP Connection or a WSDL Definition");
181
+ }
182
+ });
183
+ exports.default = {
184
+ describeWSDL,
185
+ generateHeader,
186
+ getSOAPAuth,
187
+ getSOAPClient,
188
+ getWSDL,
189
+ overrideClientDefaults,
190
+ soapRequest,
191
+ };
package/dist/index.d.ts CHANGED
@@ -3,8 +3,45 @@
3
3
  * authors create inputs, actions, and components that can
4
4
  * be processed by the Prismatic API.
5
5
  */
6
- import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition } from "./types";
7
- import { convertComponent } from "./serverTypes/convert";
6
+ import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVar, ConfigVarResultCollection, ConfigVarCollection, TriggerPayload } from "./types";
7
+ import { convertComponent, convertIntegration } from "./serverTypes/convert";
8
+ /**
9
+ * This function creates a Integration object that can be
10
+ * imported into the Prismatic API. For information on using
11
+ * this function to write code native integrations, see
12
+ * https://prismatic.io/docs/code-native-integrations/.
13
+ * @param definition An IntegrationDefinition type object.
14
+ * @returns This function returns an integration object that has the shape the Prismatic API expects.
15
+ */
16
+ export declare const integration: <TConfigVar extends Record<string, ConfigVar> = Record<string, ConfigVar>>(definition: IntegrationDefinition<TConfigVar>) => ReturnType<typeof convertIntegration>;
17
+ /**
18
+ * For information on writing Code Native Integrations, see
19
+ * https://prismatic.io/docs/code-native-integrations/#adding-flows.
20
+ * @param definition A Flow type object.
21
+ * @returns This function returns a flow object that has the shape the Prismatic API expects.
22
+ */
23
+ export declare const flow: <TConfigVars extends ConfigVarCollection = ConfigVarCollection, TTriggerPayload extends TriggerPayload = TriggerPayload, T extends Flow<TConfigVars, TTriggerPayload> = Flow<TConfigVars, TTriggerPayload>>(definition: T) => T;
24
+ /**
25
+ * For information on writing Code Native Integrations, see
26
+ * https://prismatic.io/docs/code-native-integrations/#adding-config-pages.
27
+ * @param definition A Config Page type object.
28
+ * @returns This function returns a config page object that has the shape the Prismatic API expects.
29
+ */
30
+ export declare const configPage: <T extends ConfigPage<ConfigVarCollection>>(definition: T) => T;
31
+ /**
32
+ * For information on writing Code Native Integrations, see
33
+ * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
34
+ * @param definition A Config Var type object.
35
+ * @returns This function returns a standard config var object that has the shape the Prismatic API expects.
36
+ */
37
+ export declare const configVar: <T extends StandardConfigVar>(definition: T) => T;
38
+ /**
39
+ * For information on writing Code Native Integrations, see
40
+ * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
41
+ * @param definition A Connection Config Var type object.
42
+ * @returns This function returns a connection config var object that has the shape the Prismatic API expects.
43
+ */
44
+ export declare const connectionConfigVar: <T extends ConnectionConfigVar>(definition: T) => T;
8
45
  /**
9
46
  * This function creates a component object that can be
10
47
  * imported into the Prismatic API. For information on using
@@ -23,7 +60,7 @@ export declare const component: <TPublic extends boolean, TKey extends string>(d
23
60
  * @param definition An ActionDefinition type object that includes UI display information, a function to perform when the action is invoked, and a an object containing inputs for the perform function.
24
61
  * @returns This function validates the shape of the `definition` object provided, and returns the same action object.
25
62
  */
26
- export declare const action: <TInputs extends Inputs, TAllowsBranching extends boolean, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>>(definition: ActionDefinition<TInputs, TAllowsBranching, TReturn>) => ActionDefinition<TInputs, TAllowsBranching, TReturn>;
63
+ export declare const action: <TInputs extends Inputs, TConfigVar extends ConfigVarResultCollection, TAllowsBranching extends boolean, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>>(definition: ActionDefinition<TInputs, TConfigVar, TAllowsBranching, TReturn>) => ActionDefinition<TInputs, TConfigVar, TAllowsBranching, TReturn>;
27
64
  /**
28
65
  * This function creates a trigger object that can be referenced
29
66
  * by a custom component. It helps ensure that the shape of the
@@ -33,7 +70,7 @@ export declare const action: <TInputs extends Inputs, TAllowsBranching extends b
33
70
  * @param definition A TriggerDefinition type object that includes UI display information, a function to perform when the trigger is invoked, and a an object containing inputs for the perform function.
34
71
  * @returns This function validates the shape of the `definition` object provided, and returns the same trigger object.
35
72
  */
36
- export declare const trigger: <TInputs extends Inputs, TAllowsBranching extends boolean, TResult extends TriggerResult<TAllowsBranching>>(definition: TriggerDefinition<TInputs, TAllowsBranching, TResult>) => TriggerDefinition<TInputs, TAllowsBranching, TResult>;
73
+ export declare const trigger: <TInputs extends Inputs, TConfigVar extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>>(definition: TriggerDefinition<TInputs, TConfigVar, TAllowsBranching, TResult>) => TriggerDefinition<TInputs, TConfigVar, TAllowsBranching, TResult>;
37
74
  /**
38
75
  * This function creates a data source object that can be referenced
39
76
  * by a custom component. It helps ensure that the shape of the
@@ -56,14 +93,6 @@ export declare const dataSource: <TInputs extends Inputs, TDataSourceType extend
56
93
  boolean: boolean;
57
94
  number: number;
58
95
  connection: import("./types").Connection;
59
- /**
60
- * This function creates a component object that can be
61
- * imported into the Prismatic API. For information on using
62
- * this function to write custom components, see
63
- * https://prismatic.io/docs/custom-components/writing-custom-components/#exporting-a-component.
64
- * @param definition A ComponentDefinition type object, including display information, unique key, and a set of actions the component implements.
65
- * @returns This function returns a component object that has the shape the Prismatic API expects.
66
- */
67
96
  objectSelection: import("./types").ObjectSelection;
68
97
  objectFieldMap: import("./types").ObjectFieldMap;
69
98
  jsonForm: import("./types").JSONForm;
package/dist/index.js CHANGED
@@ -22,8 +22,50 @@ 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.testing = exports.util = exports.oauth2Connection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = void 0;
25
+ exports.testing = exports.util = exports.oauth2Connection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = exports.connectionConfigVar = exports.configVar = exports.configPage = exports.flow = exports.integration = void 0;
26
26
  const convert_1 = require("./serverTypes/convert");
27
+ /**
28
+ * This function creates a Integration object that can be
29
+ * imported into the Prismatic API. For information on using
30
+ * this function to write code native integrations, see
31
+ * https://prismatic.io/docs/code-native-integrations/.
32
+ * @param definition An IntegrationDefinition type object.
33
+ * @returns This function returns an integration object that has the shape the Prismatic API expects.
34
+ */
35
+ const integration = (definition) => (0, convert_1.convertIntegration)(definition);
36
+ exports.integration = integration;
37
+ /**
38
+ * For information on writing Code Native Integrations, see
39
+ * https://prismatic.io/docs/code-native-integrations/#adding-flows.
40
+ * @param definition A Flow type object.
41
+ * @returns This function returns a flow object that has the shape the Prismatic API expects.
42
+ */
43
+ const flow = (definition) => definition;
44
+ exports.flow = flow;
45
+ /**
46
+ * For information on writing Code Native Integrations, see
47
+ * https://prismatic.io/docs/code-native-integrations/#adding-config-pages.
48
+ * @param definition A Config Page type object.
49
+ * @returns This function returns a config page object that has the shape the Prismatic API expects.
50
+ */
51
+ const configPage = (definition) => definition;
52
+ exports.configPage = configPage;
53
+ /**
54
+ * For information on writing Code Native Integrations, see
55
+ * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
56
+ * @param definition A Config Var type object.
57
+ * @returns This function returns a standard config var object that has the shape the Prismatic API expects.
58
+ */
59
+ const configVar = (definition) => definition;
60
+ exports.configVar = configVar;
61
+ /**
62
+ * For information on writing Code Native Integrations, see
63
+ * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
64
+ * @param definition A Connection Config Var type object.
65
+ * @returns This function returns a connection config var object that has the shape the Prismatic API expects.
66
+ */
67
+ const connectionConfigVar = (definition) => definition;
68
+ exports.connectionConfigVar = connectionConfigVar;
27
69
  /**
28
70
  * This function creates a component object that can be
29
71
  * imported into the Prismatic API. For information on using
@@ -1,3 +1,4 @@
1
- import { ComponentDefinition } from "../types";
1
+ import { ComponentDefinition, IntegrationDefinition } from "../types";
2
2
  import { Component as ServerComponent } from ".";
3
3
  export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
4
+ export declare const convertIntegration: (definition: IntegrationDefinition) => ServerComponent;