@prismatic-io/spectral 10.4.4 → 10.5.1

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 (38) hide show
  1. package/dist/clients/http/index.d.ts +37 -0
  2. package/dist/clients/http/index.js +24 -0
  3. package/dist/generators/componentManifest/getInputs.js +1 -0
  4. package/dist/index.d.ts +71 -36
  5. package/dist/index.js +68 -33
  6. package/dist/serverTypes/convertComponent.d.ts +2 -1
  7. package/dist/serverTypes/convertComponent.js +12 -2
  8. package/dist/serverTypes/convertIntegration.js +17 -6
  9. package/dist/serverTypes/index.d.ts +2 -0
  10. package/dist/serverTypes/integration.d.ts +0 -1
  11. package/dist/testing.d.ts +42 -4
  12. package/dist/testing.js +42 -4
  13. package/dist/types/ActionDefinition.d.ts +21 -10
  14. package/dist/types/ActionLogger.d.ts +3 -2
  15. package/dist/types/ActionLogger.js +1 -1
  16. package/dist/types/ActionPerformFunction.d.ts +12 -12
  17. package/dist/types/ActionPerformReturn.d.ts +11 -11
  18. package/dist/types/ComponentDefinition.d.ts +34 -11
  19. package/dist/types/ConfigVars.d.ts +36 -24
  20. package/dist/types/ConnectionDefinition.d.ts +92 -13
  21. package/dist/types/ConnectionDefinition.js +16 -0
  22. package/dist/types/CustomerAttributes.d.ts +6 -0
  23. package/dist/types/DataPayload.d.ts +4 -4
  24. package/dist/types/DataSourceDefinition.d.ts +11 -7
  25. package/dist/types/DataSourcePerformFunction.d.ts +1 -1
  26. package/dist/types/FlowAttributes.d.ts +2 -0
  27. package/dist/types/HttpResponse.d.ts +7 -0
  28. package/dist/types/Inputs.d.ts +82 -57
  29. package/dist/types/Inputs.js +1 -0
  30. package/dist/types/InstanceAttributes.d.ts +3 -1
  31. package/dist/types/IntegrationAttributes.d.ts +4 -1
  32. package/dist/types/IntegrationDefinition.d.ts +78 -41
  33. package/dist/types/TriggerDefinition.d.ts +29 -14
  34. package/dist/types/TriggerEventFunction.d.ts +4 -4
  35. package/dist/types/TriggerPayload.d.ts +6 -2
  36. package/dist/types/TriggerResult.d.ts +6 -6
  37. package/dist/types/UserAttributes.d.ts +11 -1
  38. package/package.json +1 -1
@@ -5,22 +5,59 @@ import { ActionInputParameters } from "../../types";
5
5
  import { inputs } from "./inputs";
6
6
  export type HttpClient = AxiosInstance;
7
7
  interface RetryConfig extends Omit<IAxiosRetryConfig, "retryDelay"> {
8
+ /** The number of milliseconds to wait between retry attempts. */
8
9
  retryDelay?: IAxiosRetryConfig["retryDelay"] | number;
10
+ /**
11
+ * When true, all errors will be retried. When false, specify
12
+ * a retryCondition function to determine when retries should occur.
13
+ */
9
14
  retryAllErrors?: boolean;
15
+ /** When true, double the retry delay after each attempt (e.g. 1000ms, 2000ms, 4000ms, 8000ms, etc.). */
10
16
  useExponentialBackoff?: boolean;
11
17
  }
12
18
  export interface ClientProps {
19
+ /** The API's base URL (e.g. `https://api.acme.com/v2/`). */
13
20
  baseUrl?: string;
21
+ /** The type of response to expect. Set to 'json' to automatically parse a JSON response, or 'arraybuffer' for a binary file. */
14
22
  responseType?: AxiosRequestConfig["responseType"];
23
+ /** Headers to send for all requests (e.g. Authorization header, etc.). */
15
24
  headers?: AxiosRequestConfig["headers"];
25
+ /** URL Search parameters to add to all requests. */
16
26
  params?: Record<string, any>;
27
+ /** The maximum amount of time (in milliseconds) to wait for a response. Defaults to infinity. */
17
28
  timeout?: number;
29
+ /** When enabled, log all HTTP requests and responses. */
18
30
  debug?: boolean;
31
+ /** Configuration used to determine if and how failed HTTP requests should be retried. */
19
32
  retryConfig?: RetryConfig;
20
33
  }
34
+ /**
35
+ * Creates a reusable Axios HTTP client. See
36
+ * https://prismatic.io/docs/custom-connectors/connections/#using-the-built-in-createclient-http-client
37
+ */
21
38
  export declare const createClient: ({ baseUrl, responseType, headers, timeout, params, debug, retryConfig, }: ClientProps) => HttpClient;
39
+ /**
40
+ * A global error handler that examines a thrown error and yields additional
41
+ * information if the error was produced by Spectral's HTTP client. See
42
+ * https://prismatic.io/docs/custom-connectors/error-handling/
43
+ * and
44
+ * https://prismatic.io/docs/custom-connectors/connections/#using-the-built-in-createclient-http-client
45
+ *
46
+ * @param error A JavaScript error to handle
47
+ * @returns An error with data, status and headers if it was an Axios error, or the error otherwise
48
+ */
22
49
  export declare const handleErrors: (error: unknown) => unknown;
23
50
  type SendRawRequestValues = ActionInputParameters<typeof inputs>;
51
+ /**
52
+ * This function allows you to build a generic "Raw Request" action
53
+ * for a custom connector. See
54
+ * https://prismatic.io/docs/integrations/low-code-integration-designer/raw-request-actions/#building-an-http-raw-request-action-in-your-custom-component
55
+ *
56
+ * @param baseUrl The base URL of the API you're integrating with
57
+ * @param values An object comprising the HTTP request you'd like to make
58
+ * @param authorizationHeaders Auth headers to apply to the request
59
+ * @returns The response to the request
60
+ */
24
61
  export declare const sendRawRequest: (baseUrl: string, values: SendRawRequestValues, authorizationHeaders?: Record<string, string>) => Promise<AxiosResponse>;
25
62
  export declare const buildRawRequestAction: (baseUrl: string, label?: string, description?: string) => import("../..").ActionDefinition<{
26
63
  url: {
@@ -96,6 +96,10 @@ const toAxiosRetryConfig = (_a) => {
96
96
  ? retryCondition
97
97
  : axios_retry_1.isNetworkOrIdempotentRequestError }));
98
98
  };
99
+ /**
100
+ * Creates a reusable Axios HTTP client. See
101
+ * https://prismatic.io/docs/custom-connectors/connections/#using-the-built-in-createclient-http-client
102
+ */
99
103
  const createClient = ({ baseUrl, responseType, headers, timeout, params, debug = false, retryConfig, }) => {
100
104
  const client = axios_1.default.create({
101
105
  baseURL: baseUrl,
@@ -142,6 +146,16 @@ const createClient = ({ baseUrl, responseType, headers, timeout, params, debug =
142
146
  return client;
143
147
  };
144
148
  exports.createClient = createClient;
149
+ /**
150
+ * A global error handler that examines a thrown error and yields additional
151
+ * information if the error was produced by Spectral's HTTP client. See
152
+ * https://prismatic.io/docs/custom-connectors/error-handling/
153
+ * and
154
+ * https://prismatic.io/docs/custom-connectors/connections/#using-the-built-in-createclient-http-client
155
+ *
156
+ * @param error A JavaScript error to handle
157
+ * @returns An error with data, status and headers if it was an Axios error, or the error otherwise
158
+ */
145
159
  const handleErrors = (error) => {
146
160
  if (axios_1.default.isAxiosError(error)) {
147
161
  const { message, response } = error;
@@ -155,6 +169,16 @@ const handleErrors = (error) => {
155
169
  return error;
156
170
  };
157
171
  exports.handleErrors = handleErrors;
172
+ /**
173
+ * This function allows you to build a generic "Raw Request" action
174
+ * for a custom connector. See
175
+ * https://prismatic.io/docs/integrations/low-code-integration-designer/raw-request-actions/#building-an-http-raw-request-action-in-your-custom-component
176
+ *
177
+ * @param baseUrl The base URL of the API you're integrating with
178
+ * @param values An object comprising the HTTP request you'd like to make
179
+ * @param authorizationHeaders Auth headers to apply to the request
180
+ * @returns The response to the request
181
+ */
158
182
  const sendRawRequest = (baseUrl_1, values_1, ...args_1) => __awaiter(void 0, [baseUrl_1, values_1, ...args_1], void 0, function* (baseUrl, values, authorizationHeaders = {}) {
159
183
  if (values.data && (!(0, isEmpty_1.default)(values.formData) || !(0, isEmpty_1.default)(values.fileData))) {
160
184
  throw new Error("Cannot specify both Data and File/Form Data.");
@@ -66,6 +66,7 @@ exports.INPUT_TYPE_MAP = {
66
66
  date: "string",
67
67
  timestamp: "string",
68
68
  flow: "string",
69
+ template: "string",
69
70
  };
70
71
  const getInputValueType = (input) => {
71
72
  const inputType = exports.INPUT_TYPE_MAP[input.type];
package/dist/index.d.ts CHANGED
@@ -1,68 +1,87 @@
1
1
  /**
2
- * This module contains functions to help custom component
3
- * authors create inputs, actions, and components that can
4
- * be processed by the Prismatic API.
2
+ * This module contains functions to help custom component and code-native
3
+ * integration authors create inputs, actions, components, and integrations
4
+ * that can run on the Prismatic platform.
5
5
  */
6
- import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, DataSourceType, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, OnPremConnectionDefinition, ComponentManifest, OrganizationActivatedConnectionConfigVar } from "./types";
6
+ import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, DataSourceType, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, OnPremConnectionDefinition, ComponentManifest, OrganizationActivatedConnectionConfigVar, CustomerActivatedConnectionConfigVar } from "./types";
7
7
  import { convertComponent } from "./serverTypes/convertComponent";
8
8
  import { convertIntegration } from "./serverTypes/convertIntegration";
9
9
  import { PollingTriggerDefinition } from "./types/PollingTriggerDefinition";
10
10
  /**
11
- * This function creates a Integration object that can be
12
- * imported into the Prismatic API. For information on using
13
- * this function to write code native integrations, see
14
- * https://prismatic.io/docs/code-native-integrations/.
11
+ * This function creates a code-native integration object that can be
12
+ * imported into Prismatic. For information on using this function to
13
+ * write code-native integrations, see
14
+ * https://prismatic.io/docs/integrations/code-native/.
15
+ *
15
16
  * @param definition An IntegrationDefinition type object.
16
17
  * @returns This function returns an integration object that has the shape the Prismatic API expects.
17
18
  */
18
19
  export declare const integration: <T extends IntegrationDefinition = IntegrationDefinition>(definition: T) => ReturnType<typeof convertIntegration>;
19
20
  /**
20
- * For information on writing Code Native Integrations, see
21
- * https://prismatic.io/docs/code-native-integrations/#adding-flows.
21
+ * This function creates a flow object for use in code-native integrations.
22
+ * For information on writing code-native flows, see
23
+ * https://prismatic.io/docs/integrations/code-native/flows/.
24
+ *
22
25
  * @param definition A Flow type object.
23
26
  * @returns This function returns a flow object that has the shape the Prismatic API expects.
24
27
  */
25
28
  export declare const flow: <TTriggerPayload extends TriggerPayload = TriggerPayload, T extends Flow<TTriggerPayload> = Flow<TTriggerPayload>>(definition: T) => T;
26
29
  /**
27
- * For information on writing Code Native Integrations, see
28
- * https://prismatic.io/docs/code-native-integrations/#adding-config-pages.
30
+ * This function creates a config wizard page object for use in code-native
31
+ * integrations. For information on code-native config wizards, see
32
+ * https://prismatic.io/docs/integrations/code-native/config-wizard/.
33
+ *
29
34
  * @param definition A Config Page type object.
30
35
  * @returns This function returns a config page object that has the shape the Prismatic API expects.
31
36
  */
32
37
  export declare const configPage: <T extends ConfigPage = ConfigPage>(definition: T) => T;
33
38
  /**
34
- * For information on writing Code Native Integrations, see
35
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
39
+ * This function creates a config variable object for code-native integrations.
40
+ * For information on writing code-native integrations, see
41
+ * https://prismatic.io/docs/integrations/code-native/config-wizard/#other-config-variable-types-in-code-native-integrations.
42
+ *
36
43
  * @param definition A Config Var type object.
37
44
  * @returns This function returns a standard config var object that has the shape the Prismatic API expects.
38
45
  */
39
46
  export declare const configVar: <T extends StandardConfigVar>(definition: T) => T;
40
47
  /**
41
- * For information on writing Code Native Integrations, see
42
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
48
+ * This function creates a data source-backed config variable for code-native
49
+ * integrations. For information on code-native data sources, see
50
+ * https://prismatic.io/docs/integrations/code-native/config-wizard/#data-sources-is-code-native-integrations.
51
+ *
43
52
  * @param definition A Data Source Config Var type object.
44
53
  * @returns This function returns a data source config var object that has the shape the Prismatic API expects.
45
54
  */
46
55
  export declare const dataSourceConfigVar: <TDataSourceConfigVar extends DataSourceConfigVar>(definition: TDataSourceConfigVar) => TDataSourceConfigVar;
47
56
  /**
48
- * For information on writing Code Native Integrations, see
49
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
57
+ * This function creates a connection config variable for code-native
58
+ * integrations. For information on writing code-native integrations, see
59
+ * https://prismatic.io/docs/integrations/code-native/config-wizard/#connections-in-code-native-integrations.
60
+ *
50
61
  * @param definition A Connection Config Var type object.
51
62
  * @returns This function returns a connection config var object that has the shape the Prismatic API expects.
52
63
  */
53
64
  export declare const connectionConfigVar: <T extends ConnectionConfigVar = ConnectionConfigVar>(definition: T) => T;
54
65
  /**
55
- * For information on writing Code Native Integrations, see
56
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
66
+ * This function creates a customer-activated connection for code-native
67
+ * integrations. For information on writing code-native integrations, see
68
+ * https://prismatic.io/docs/integrations/code-native/.
69
+ * For information on customer-activated connections, see
70
+ * https://prismatic.io/docs/integrations/connections/integration-agnostic-connections/customer-activated/.
71
+ *
57
72
  * @param definition A Customer-Activated Connection Config Var type object.
58
73
  * @returns This function returns a connection config var object that has the shape the Prismatic API expects.
59
74
  */
60
75
  export declare const customerActivatedConnection: <T extends {
61
76
  stableKey: string;
62
- }>(definition: T) => OrganizationActivatedConnectionConfigVar;
63
- /**
64
- * For information on writing Code Native Integrations, see
65
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
77
+ }>(definition: T) => CustomerActivatedConnectionConfigVar;
78
+ /**
79
+ * This function creates an org-activated connection for code-native
80
+ * integrations. For information on writing code-native integrations, see
81
+ * https://prismatic.io/docs/integrations/code-native/.
82
+ * For information on customer-activated connections, see
83
+ * https://prismatic.io/docs/integrations/connections/integration-agnostic-connections/org-activated-customer/.
84
+ *
66
85
  * @param definition An Organization-Activated Connection Config Var type object.
67
86
  * @returns This function returns a connection config var object that has the shape the Prismatic API expects.
68
87
  */
@@ -70,6 +89,9 @@ export declare const organizationActivatedConnection: <T extends {
70
89
  stableKey: string;
71
90
  }>(definition: T) => OrganizationActivatedConnectionConfigVar;
72
91
  /**
92
+ * Generate a manifest of components that this code-native integration relies on. See
93
+ * https://prismatic.io/docs/integrations/code-native/existing-components/
94
+ *
73
95
  * @param definition A Component Manifest type object.
74
96
  * @returns This function returns a component manifest object that has the shape the Prismatic API expects.
75
97
  */
@@ -78,7 +100,8 @@ export declare const componentManifest: <T extends ComponentManifest>(definition
78
100
  * This function creates a component object that can be
79
101
  * imported into the Prismatic API. For information on using
80
102
  * this function to write custom components, see
81
- * https://prismatic.io/docs/custom-components/writing-custom-components/#exporting-a-component.
103
+ * https://prismatic.io/docs/custom-connectors/.
104
+ *
82
105
  * @param definition A ComponentDefinition type object, including display information, unique key, and a set of actions the component implements.
83
106
  * @returns This function returns a component object that has the shape the Prismatic API expects.
84
107
  */
@@ -88,7 +111,8 @@ export declare const component: <TPublic extends boolean, TKey extends string>(d
88
111
  * by a custom component. It helps ensure that the shape of the
89
112
  * action object conforms to what the Prismatic API expects.
90
113
  * For information on writing custom component actions, see
91
- * https://prismatic.io/docs/custom-components/writing-custom-components/#writing-actions.
114
+ * https://prismatic.io/docs/custom-connectors/actions/.
115
+ *
92
116
  * @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.
93
117
  * @returns This function validates the shape of the `definition` object provided, and returns the same action object.
94
118
  */
@@ -98,14 +122,17 @@ export declare const action: <TInputs extends Inputs, TConfigVars extends Config
98
122
  * by a custom component. It helps ensure that the shape of the
99
123
  * trigger object conforms to what the Prismatic API expects.
100
124
  * For information on writing custom component triggers, see
101
- * https://prismatic.io/docs/custom-components/writing-custom-components/#writing-triggers.
125
+ * https://prismatic.io/docs/custom-connectors/triggers/.
126
+ *
102
127
  * @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.
103
128
  * @returns This function validates the shape of the `definition` object provided, and returns the same trigger object.
104
129
  */
105
130
  export declare const trigger: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>>(definition: TriggerDefinition<TInputs, TConfigVars, TAllowsBranching, TResult>) => TriggerDefinition<TInputs, TConfigVars, TAllowsBranching, TResult>;
106
131
  /**
107
132
  * This function creates a polling trigger object that can be referenced
108
- * by a custom component.
133
+ * by a custom component. See
134
+ * https://prismatic.io/docs/custom-connectors/triggers/#app-event-polling-triggers
135
+ *
109
136
  * @param definition A PollingTriggerDefinition is similar to a TriggerDefinition, except it requires a pollAction instead of a perform. The pollAction, which can be any action defined in the component, will be polled on the defined schedule.
110
137
  * @returns This function validates the shape of the `definition` object provided, and returns the same polling trigger object.
111
138
  */
@@ -115,7 +142,8 @@ export declare const pollingTrigger: <TInputs extends Inputs, TConfigVars extend
115
142
  * by a custom component. It helps ensure that the shape of the
116
143
  * data source object conforms to what the Prismatic API expects.
117
144
  * For information on writing custom component data sources, see
118
- * https://prismatic.io/docs/custom-components/writing-custom-components/#writing-data-sources.
145
+ * https://prismatic.io/docs/custom-connectors/data-sources/.
146
+ *
119
147
  * @param definition A DataSourceDefinition type object that includes UI display information, a function to perform when the data source is invoked, and a an object containing inputs for the perform function.
120
148
  * @returns This function validates the shape of the `definition` object provided, and returns the same data source object.
121
149
  */
@@ -123,28 +151,35 @@ export declare const dataSource: <TInputs extends Inputs, TConfigVars extends Co
123
151
  /**
124
152
  * For information and examples on how to write inputs
125
153
  * for custom component actions and triggers, see
126
- * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-inputs.
154
+ * https://prismatic.io/docs/custom-connectors/actions/#action-inputs.
155
+ *
127
156
  * @param definition An InputFieldDefinition object that describes the type of an input for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
128
157
  * @returns This function validates the shape of the `definition` object provided, and returns the same input object.
129
158
  */
130
159
  export declare const input: <T extends InputFieldDefinition>(definition: T) => T;
131
160
  /**
132
- * For information on writing custom component connections, see
133
- * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
161
+ * This function creates a connection that can be used by a code-native integration
162
+ * or custom component. For information on writing connections, see
163
+ * https://prismatic.io/docs/custom-connectors/connections/.
164
+ *
134
165
  * @param definition A DefaultConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
135
166
  * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
136
167
  */
137
168
  export declare const connection: <T extends DefaultConnectionDefinition>(definition: T) => T;
138
169
  /**
139
- * For information on writing custom component connections using on-premise resources, see
140
- * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
170
+ * This function creates an on-prem connection for a code-native integration or custom component.
171
+ * For information on writing custom component connections using on-prem resources, see
172
+ * https://prismatic.io/docs/integrations/connections/on-prem-agent/#supporting-on-prem-connections-in-a-custom-connector.
173
+ *
141
174
  * @param definition An OnPremConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
142
175
  * @returns This function validates the shape of the `definition` object provided and returns the same connection object.
143
176
  */
144
177
  export declare const onPremConnection: <T extends OnPremConnectionDefinition>(definition: T) => T;
145
178
  /**
146
- * For information on writing custom component connections, see
147
- * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
179
+ * This function creates an OAuth 2.0 connection for a code-native integration or custom component.
180
+ * For information on writing an OAuth 2.0 connection, see
181
+ * https://prismatic.io/docs/custom-connectors/connections/#writing-oauth-20-connections.
182
+ *
148
183
  * @param definition An OAuth2ConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
149
184
  * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
150
185
  */
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /**
3
- * This module contains functions to help custom component
4
- * authors create inputs, actions, and components that can
5
- * be processed by the Prismatic API.
3
+ * This module contains functions to help custom component and code-native
4
+ * integration authors create inputs, actions, components, and integrations
5
+ * that can run on the Prismatic platform.
6
6
  */
7
7
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
8
  if (k2 === undefined) k2 = k;
@@ -26,10 +26,11 @@ exports.testing = exports.util = exports.componentManifests = exports.oauth2Conn
26
26
  const convertComponent_1 = require("./serverTypes/convertComponent");
27
27
  const convertIntegration_1 = require("./serverTypes/convertIntegration");
28
28
  /**
29
- * This function creates a Integration object that can be
30
- * imported into the Prismatic API. For information on using
31
- * this function to write code native integrations, see
32
- * https://prismatic.io/docs/code-native-integrations/.
29
+ * This function creates a code-native integration object that can be
30
+ * imported into Prismatic. For information on using this function to
31
+ * write code-native integrations, see
32
+ * https://prismatic.io/docs/integrations/code-native/.
33
+ *
33
34
  * @param definition An IntegrationDefinition type object.
34
35
  * @returns This function returns an integration object that has the shape the Prismatic API expects.
35
36
  */
@@ -43,48 +44,62 @@ const integration = (definition) => {
43
44
  };
44
45
  exports.integration = integration;
45
46
  /**
46
- * For information on writing Code Native Integrations, see
47
- * https://prismatic.io/docs/code-native-integrations/#adding-flows.
47
+ * This function creates a flow object for use in code-native integrations.
48
+ * For information on writing code-native flows, see
49
+ * https://prismatic.io/docs/integrations/code-native/flows/.
50
+ *
48
51
  * @param definition A Flow type object.
49
52
  * @returns This function returns a flow object that has the shape the Prismatic API expects.
50
53
  */
51
54
  const flow = (definition) => definition;
52
55
  exports.flow = flow;
53
56
  /**
54
- * For information on writing Code Native Integrations, see
55
- * https://prismatic.io/docs/code-native-integrations/#adding-config-pages.
57
+ * This function creates a config wizard page object for use in code-native
58
+ * integrations. For information on code-native config wizards, see
59
+ * https://prismatic.io/docs/integrations/code-native/config-wizard/.
60
+ *
56
61
  * @param definition A Config Page type object.
57
62
  * @returns This function returns a config page object that has the shape the Prismatic API expects.
58
63
  */
59
64
  const configPage = (definition) => definition;
60
65
  exports.configPage = configPage;
61
66
  /**
62
- * For information on writing Code Native Integrations, see
63
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
67
+ * This function creates a config variable object for code-native integrations.
68
+ * For information on writing code-native integrations, see
69
+ * https://prismatic.io/docs/integrations/code-native/config-wizard/#other-config-variable-types-in-code-native-integrations.
70
+ *
64
71
  * @param definition A Config Var type object.
65
72
  * @returns This function returns a standard config var object that has the shape the Prismatic API expects.
66
73
  */
67
74
  const configVar = (definition) => definition;
68
75
  exports.configVar = configVar;
69
76
  /**
70
- * For information on writing Code Native Integrations, see
71
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
77
+ * This function creates a data source-backed config variable for code-native
78
+ * integrations. For information on code-native data sources, see
79
+ * https://prismatic.io/docs/integrations/code-native/config-wizard/#data-sources-is-code-native-integrations.
80
+ *
72
81
  * @param definition A Data Source Config Var type object.
73
82
  * @returns This function returns a data source config var object that has the shape the Prismatic API expects.
74
83
  */
75
84
  const dataSourceConfigVar = (definition) => definition;
76
85
  exports.dataSourceConfigVar = dataSourceConfigVar;
77
86
  /**
78
- * For information on writing Code Native Integrations, see
79
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
87
+ * This function creates a connection config variable for code-native
88
+ * integrations. For information on writing code-native integrations, see
89
+ * https://prismatic.io/docs/integrations/code-native/config-wizard/#connections-in-code-native-integrations.
90
+ *
80
91
  * @param definition A Connection Config Var type object.
81
92
  * @returns This function returns a connection config var object that has the shape the Prismatic API expects.
82
93
  */
83
94
  const connectionConfigVar = (definition) => definition;
84
95
  exports.connectionConfigVar = connectionConfigVar;
85
96
  /**
86
- * For information on writing Code Native Integrations, see
87
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
97
+ * This function creates a customer-activated connection for code-native
98
+ * integrations. For information on writing code-native integrations, see
99
+ * https://prismatic.io/docs/integrations/code-native/.
100
+ * For information on customer-activated connections, see
101
+ * https://prismatic.io/docs/integrations/connections/integration-agnostic-connections/customer-activated/.
102
+ *
88
103
  * @param definition A Customer-Activated Connection Config Var type object.
89
104
  * @returns This function returns a connection config var object that has the shape the Prismatic API expects.
90
105
  */
@@ -93,8 +108,12 @@ const customerActivatedConnection = (definition) => {
93
108
  };
94
109
  exports.customerActivatedConnection = customerActivatedConnection;
95
110
  /**
96
- * For information on writing Code Native Integrations, see
97
- * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
111
+ * This function creates an org-activated connection for code-native
112
+ * integrations. For information on writing code-native integrations, see
113
+ * https://prismatic.io/docs/integrations/code-native/.
114
+ * For information on customer-activated connections, see
115
+ * https://prismatic.io/docs/integrations/connections/integration-agnostic-connections/org-activated-customer/.
116
+ *
98
117
  * @param definition An Organization-Activated Connection Config Var type object.
99
118
  * @returns This function returns a connection config var object that has the shape the Prismatic API expects.
100
119
  */
@@ -103,6 +122,9 @@ const organizationActivatedConnection = (definition) => {
103
122
  };
104
123
  exports.organizationActivatedConnection = organizationActivatedConnection;
105
124
  /**
125
+ * Generate a manifest of components that this code-native integration relies on. See
126
+ * https://prismatic.io/docs/integrations/code-native/existing-components/
127
+ *
106
128
  * @param definition A Component Manifest type object.
107
129
  * @returns This function returns a component manifest object that has the shape the Prismatic API expects.
108
130
  */
@@ -112,7 +134,8 @@ exports.componentManifest = componentManifest;
112
134
  * This function creates a component object that can be
113
135
  * imported into the Prismatic API. For information on using
114
136
  * this function to write custom components, see
115
- * https://prismatic.io/docs/custom-components/writing-custom-components/#exporting-a-component.
137
+ * https://prismatic.io/docs/custom-connectors/.
138
+ *
116
139
  * @param definition A ComponentDefinition type object, including display information, unique key, and a set of actions the component implements.
117
140
  * @returns This function returns a component object that has the shape the Prismatic API expects.
118
141
  */
@@ -123,7 +146,8 @@ exports.component = component;
123
146
  * by a custom component. It helps ensure that the shape of the
124
147
  * action object conforms to what the Prismatic API expects.
125
148
  * For information on writing custom component actions, see
126
- * https://prismatic.io/docs/custom-components/writing-custom-components/#writing-actions.
149
+ * https://prismatic.io/docs/custom-connectors/actions/.
150
+ *
127
151
  * @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.
128
152
  * @returns This function validates the shape of the `definition` object provided, and returns the same action object.
129
153
  */
@@ -134,7 +158,8 @@ exports.action = action;
134
158
  * by a custom component. It helps ensure that the shape of the
135
159
  * trigger object conforms to what the Prismatic API expects.
136
160
  * For information on writing custom component triggers, see
137
- * https://prismatic.io/docs/custom-components/writing-custom-components/#writing-triggers.
161
+ * https://prismatic.io/docs/custom-connectors/triggers/.
162
+ *
138
163
  * @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.
139
164
  * @returns This function validates the shape of the `definition` object provided, and returns the same trigger object.
140
165
  */
@@ -142,7 +167,9 @@ const trigger = (definition) => definition;
142
167
  exports.trigger = trigger;
143
168
  /**
144
169
  * This function creates a polling trigger object that can be referenced
145
- * by a custom component.
170
+ * by a custom component. See
171
+ * https://prismatic.io/docs/custom-connectors/triggers/#app-event-polling-triggers
172
+ *
146
173
  * @param definition A PollingTriggerDefinition is similar to a TriggerDefinition, except it requires a pollAction instead of a perform. The pollAction, which can be any action defined in the component, will be polled on the defined schedule.
147
174
  * @returns This function validates the shape of the `definition` object provided, and returns the same polling trigger object.
148
175
  */
@@ -155,7 +182,8 @@ exports.pollingTrigger = pollingTrigger;
155
182
  * by a custom component. It helps ensure that the shape of the
156
183
  * data source object conforms to what the Prismatic API expects.
157
184
  * For information on writing custom component data sources, see
158
- * https://prismatic.io/docs/custom-components/writing-custom-components/#writing-data-sources.
185
+ * https://prismatic.io/docs/custom-connectors/data-sources/.
186
+ *
159
187
  * @param definition A DataSourceDefinition type object that includes UI display information, a function to perform when the data source is invoked, and a an object containing inputs for the perform function.
160
188
  * @returns This function validates the shape of the `definition` object provided, and returns the same data source object.
161
189
  */
@@ -164,31 +192,38 @@ exports.dataSource = dataSource;
164
192
  /**
165
193
  * For information and examples on how to write inputs
166
194
  * for custom component actions and triggers, see
167
- * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-inputs.
195
+ * https://prismatic.io/docs/custom-connectors/actions/#action-inputs.
196
+ *
168
197
  * @param definition An InputFieldDefinition object that describes the type of an input for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
169
198
  * @returns This function validates the shape of the `definition` object provided, and returns the same input object.
170
199
  */
171
200
  const input = (definition) => definition;
172
201
  exports.input = input;
173
202
  /**
174
- * For information on writing custom component connections, see
175
- * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
203
+ * This function creates a connection that can be used by a code-native integration
204
+ * or custom component. For information on writing connections, see
205
+ * https://prismatic.io/docs/custom-connectors/connections/.
206
+ *
176
207
  * @param definition A DefaultConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
177
208
  * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
178
209
  */
179
210
  const connection = (definition) => definition;
180
211
  exports.connection = connection;
181
212
  /**
182
- * For information on writing custom component connections using on-premise resources, see
183
- * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
213
+ * This function creates an on-prem connection for a code-native integration or custom component.
214
+ * For information on writing custom component connections using on-prem resources, see
215
+ * https://prismatic.io/docs/integrations/connections/on-prem-agent/#supporting-on-prem-connections-in-a-custom-connector.
216
+ *
184
217
  * @param definition An OnPremConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
185
218
  * @returns This function validates the shape of the `definition` object provided and returns the same connection object.
186
219
  */
187
220
  const onPremConnection = (definition) => definition;
188
221
  exports.onPremConnection = onPremConnection;
189
222
  /**
190
- * For information on writing custom component connections, see
191
- * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
223
+ * This function creates an OAuth 2.0 connection for a code-native integration or custom component.
224
+ * For information on writing an OAuth 2.0 connection, see
225
+ * https://prismatic.io/docs/custom-connectors/connections/#writing-oauth-20-connections.
226
+ *
192
227
  * @param definition An OAuth2ConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
193
228
  * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
194
229
  */
@@ -1,7 +1,8 @@
1
- import { InputFieldDefinition, ComponentDefinition, ConnectionDefinition, TriggerDefinition, ComponentHooks, ConfigVarResultCollection, OnPremConnectionInput, TriggerPayload } from "../types";
1
+ import { InputFieldDefinition, ComponentDefinition, ConnectionDefinition, TriggerDefinition, ComponentHooks, ConfigVarResultCollection, OnPremConnectionInput, TriggerPayload, ConnectionTemplateInputField } from "../types";
2
2
  import { Component as ServerComponent, Connection as ServerConnection, Trigger as ServerTrigger, Input as ServerInput } from ".";
3
3
  import { PollingTriggerDefinition } from "../types/PollingTriggerDefinition";
4
4
  export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition | OnPremConnectionInput) => ServerInput;
5
+ export declare const convertTemplateInput: (key: string, { templateValue, label, ...rest }: ConnectionTemplateInputField) => ServerInput;
5
6
  export declare const convertTrigger: (triggerKey: string, trigger: TriggerDefinition<any> | PollingTriggerDefinition<any, ConfigVarResultCollection, TriggerPayload, boolean, any, any>, hooks?: ComponentHooks) => ServerTrigger;
6
7
  export declare const convertConnection: ({ inputs, ...connection }: ConnectionDefinition) => ServerConnection;
7
8
  export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.convertComponent = exports.convertConnection = exports.convertTrigger = exports.convertInput = void 0;
17
+ exports.convertComponent = exports.convertConnection = exports.convertTrigger = exports.convertTemplateInput = exports.convertInput = void 0;
18
18
  const types_1 = require("../types");
19
19
  const perform_1 = require("./perform");
20
20
  const omit_1 = __importDefault(require("lodash/omit"));
@@ -31,6 +31,11 @@ const convertInput = (key, _a) => {
31
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 });
32
32
  };
33
33
  exports.convertInput = convertInput;
34
+ const convertTemplateInput = (key, _a) => {
35
+ var { templateValue, label } = _a, rest = __rest(_a, ["templateValue", "label"]);
36
+ return Object.assign(Object.assign({}, (0, omit_1.default)(rest, ["permissionAndVisibilityType", "visibleToOrgDeployer", "writeOnly"])), { key, type: "template", default: templateValue !== null && templateValue !== void 0 ? templateValue : "", label: typeof label === "string" ? label : label.value, shown: false });
37
+ };
38
+ exports.convertTemplateInput = convertTemplateInput;
34
39
  const convertAction = (actionKey, _a, hooks) => {
35
40
  var { inputs = {}, perform } = _a, action = __rest(_a, ["inputs", "perform"]);
36
41
  const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
@@ -114,8 +119,13 @@ const convertDataSource = (dataSourceKey, _a, hooks) => {
114
119
  };
115
120
  const convertConnection = (_a) => {
116
121
  var { inputs = {} } = _a, connection = __rest(_a, ["inputs"]);
117
- const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
118
122
  const { display: { label, icons, description: comments } } = connection, remaining = __rest(connection, ["display"]);
123
+ const convertedInputs = Object.entries(inputs).map(([key, value]) => {
124
+ if ("templateValue" in value) {
125
+ return (0, exports.convertTemplateInput)(key, value);
126
+ }
127
+ return (0, exports.convertInput)(key, value);
128
+ });
119
129
  return Object.assign(Object.assign({}, remaining), { label,
120
130
  comments, iconPath: icons === null || icons === void 0 ? void 0 : icons.oauth2ConnectionIconPath, avatarIconPath: icons === null || icons === void 0 ? void 0 : icons.avatarPath, inputs: convertedInputs });
121
131
  };