@prismatic-io/spectral 8.1.4 → 8.1.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/index.d.ts CHANGED
@@ -3,7 +3,7 @@
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, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, ConfigPages, OnPremiseConnectionDefinition, ScheduleConfigVar, ComponentSelector } from "./types";
6
+ import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, ConfigPages, OnPremConnectionDefinition, ScheduleConfigVar, ComponentSelector } from "./types";
7
7
  import { convertComponent } from "./serverTypes/convert";
8
8
  import { convertIntegration } from "./serverTypes/convertIntegration";
9
9
  /**
@@ -128,10 +128,10 @@ export declare const connection: <T extends DefaultConnectionDefinition>(definit
128
128
  /**
129
129
  * For information on writing custom component connections using on-premise resources, see
130
130
  * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
131
- * @param definition An OnPremiseConnectionDefinition 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.
131
+ * @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.
132
132
  * @returns This function validates the shape of the `definition` object provided and returns the same connection object.
133
133
  */
134
- export declare const onPremiseConnection: <T extends OnPremiseConnectionDefinition>(definition: T) => T;
134
+ export declare const onPremConnection: <T extends OnPremConnectionDefinition>(definition: T) => T;
135
135
  /**
136
136
  * For information on writing custom component connections, see
137
137
  * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
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.testing = exports.util = exports.oauth2Connection = exports.onPremiseConnection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = exports.connectionConfigVar = exports.dataSourceConfigVar = exports.configVar = exports.reference = exports.configPage = exports.flow = exports.integration = void 0;
25
+ exports.testing = exports.util = exports.oauth2Connection = exports.onPremConnection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = exports.connectionConfigVar = exports.dataSourceConfigVar = exports.configVar = exports.reference = exports.configPage = exports.flow = exports.integration = void 0;
26
26
  const convert_1 = require("./serverTypes/convert");
27
27
  const convertIntegration_1 = require("./serverTypes/convertIntegration");
28
28
  /**
@@ -153,11 +153,11 @@ exports.connection = connection;
153
153
  /**
154
154
  * For information on writing custom component connections using on-premise resources, see
155
155
  * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
156
- * @param definition An OnPremiseConnectionDefinition 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.
156
+ * @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.
157
157
  * @returns This function validates the shape of the `definition` object provided and returns the same connection object.
158
158
  */
159
- const onPremiseConnection = (definition) => definition;
160
- exports.onPremiseConnection = onPremiseConnection;
159
+ const onPremConnection = (definition) => definition;
160
+ exports.onPremConnection = onPremConnection;
161
161
  /**
162
162
  * For information on writing custom component connections, see
163
163
  * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
@@ -1,4 +1,4 @@
1
- import { InputFieldDefinition, ComponentDefinition } from "../types";
1
+ import { InputFieldDefinition, ComponentDefinition, OnPremConnectionInput } from "../types";
2
2
  import { Component as ServerComponent, Input as ServerInput } from ".";
3
- export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition) => ServerInput;
3
+ export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition | OnPremConnectionInput) => ServerInput;
4
4
  export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
@@ -14,13 +14,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.convertComponent = exports.convertInput = void 0;
15
15
  const types_1 = require("../types");
16
16
  const perform_1 = require("./perform");
17
+ const lodash_1 = require("lodash");
17
18
  const convertInput = (key, _a) => {
18
19
  var { default: defaultValue, type, label, collection } = _a, rest = __rest(_a, ["default", "type", "label", "collection"]);
19
20
  const keyLabel = collection === "keyvaluelist" && typeof label === "object"
20
21
  ? label.key
21
22
  : undefined;
22
- return Object.assign(Object.assign({}, rest), { key,
23
- type, default: defaultValue !== null && defaultValue !== void 0 ? defaultValue : types_1.InputFieldDefaultMap[type], collection, label: typeof label === "string" ? label : label.value, keyLabel });
23
+ return Object.assign(Object.assign({}, (0, lodash_1.omit)(rest, ["onPremControlled"])), { key,
24
+ 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 });
24
25
  };
25
26
  exports.convertInput = convertInput;
26
27
  const convertAction = (actionKey, _a, hooks) => {
@@ -195,7 +195,7 @@ const convertConfigVar = (key, configVar, referenceKey) => {
195
195
  }
196
196
  if ((0, types_1.isConnectionReferenceConfigVar)(configVar)) {
197
197
  const { ref, inputs } = convertComponentReference(configVar.connection);
198
- return Object.assign(Object.assign({}, (0, lodash_1.pick)(configVar, ["stableKey", "description", "orgOnly"])), { key, dataType: "connection", connection: ref, inputs });
198
+ return Object.assign(Object.assign({}, (0, lodash_1.pick)(configVar, ["stableKey", "description", "orgOnly"])), { key, dataType: "connection", connection: Object.assign(Object.assign({}, ref), { template: configVar.connection.template }), inputs });
199
199
  }
200
200
  const result = (0, lodash_1.assign)({ meta, key }, (0, lodash_1.pick)(configVar, [
201
201
  "stableKey",
@@ -174,7 +174,7 @@ export interface Connection {
174
174
  iconPath?: string;
175
175
  inputs: (Input & {
176
176
  shown?: boolean;
177
- onPremiseControlled?: boolean;
177
+ onPremControlled?: boolean;
178
178
  })[];
179
179
  }
180
180
  export interface ConnectionValue {
@@ -235,4 +235,5 @@ export interface Input {
235
235
  required?: boolean;
236
236
  model?: InputFieldChoice[];
237
237
  language?: string;
238
+ onPremiseControlled?: boolean;
238
239
  }
@@ -6,6 +6,7 @@ export interface ComponentReference {
6
6
  isPublic: boolean;
7
7
  };
8
8
  key: string;
9
+ template?: string;
9
10
  }
10
11
  export declare type Input = {
11
12
  name?: string;
@@ -1,4 +1,4 @@
1
- import { ConnectionInput } from ".";
1
+ import { ConnectionInput, OnPremConnectionInput } from ".";
2
2
  export declare enum OAuth2Type {
3
3
  ClientCredentials = "client_credentials",
4
4
  AuthorizationCode = "authorization_code"
@@ -19,13 +19,10 @@ export interface DefaultConnectionDefinition extends BaseConnectionDefinition {
19
19
  [key: string]: ConnectionInput;
20
20
  };
21
21
  }
22
- declare type OnPremiseConnectionInput = ConnectionInput & {
23
- onPremiseControlled: true;
24
- };
25
- export interface OnPremiseConnectionDefinition extends BaseConnectionDefinition {
22
+ export interface OnPremConnectionDefinition extends BaseConnectionDefinition {
26
23
  inputs: {
27
- host: OnPremiseConnectionInput;
28
- port: OnPremiseConnectionInput;
24
+ host: OnPremConnectionInput;
25
+ port: OnPremConnectionInput;
29
26
  [key: string]: ConnectionInput;
30
27
  };
31
28
  }
@@ -53,5 +50,5 @@ interface OAuth2ClientCredentialConnectionDefinition extends BaseConnectionDefin
53
50
  };
54
51
  }
55
52
  export declare type OAuth2ConnectionDefinition = OAuth2AuthorizationCodeConnectionDefinition | OAuth2ClientCredentialConnectionDefinition;
56
- export declare type ConnectionDefinition = DefaultConnectionDefinition | OnPremiseConnectionDefinition | OAuth2ConnectionDefinition;
53
+ export declare type ConnectionDefinition = DefaultConnectionDefinition | OnPremConnectionDefinition | OAuth2ConnectionDefinition;
57
54
  export {};
@@ -56,7 +56,7 @@ export declare type JSONForm = {
56
56
  /**
57
57
  * Optional default data to use in the inputs of your form
58
58
  */
59
- data?: Record<string, unknown>;
59
+ data?: Record<string, unknown> | unknown[];
60
60
  };
61
61
  export declare type DynamicObjectSelection = string;
62
62
  export declare type DynamicFieldSelection = string;
@@ -67,6 +67,9 @@ export declare type Inputs = Record<string, InputFieldDefinition>;
67
67
  export declare type ConnectionInput = (StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField) & {
68
68
  shown?: boolean;
69
69
  };
70
+ export declare type OnPremConnectionInput = ConnectionInput & {
71
+ onPremControlled: true;
72
+ };
70
73
  export declare type InputFieldDefinition = StringInputField | DataInputField | TextInputField | PasswordInputField | BooleanInputField | CodeInputField | ConditionalInputField | ConnectionInputField | ObjectSelectionInputField | ObjectFieldMapInputField | JSONFormInputField | DynamicObjectSelectionInputField | DynamicFieldSelectionInputField;
71
74
  export declare type InputCleanFunction<TValue, TResult = TValue> = (value: TValue) => TResult;
72
75
  interface BaseInputField {
@@ -118,7 +118,9 @@ declare type DataSourceReferenceConfigVar<TComponents extends ComponentSelector<
118
118
  export declare type DataSourceConfigVar<TComponents extends ComponentSelector<any>> = DataSourceDefinitionConfigVar | DataSourceReferenceConfigVar<TComponents>;
119
119
  declare type ConnectionDefinitionConfigVar = BaseConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">;
120
120
  declare type ConnectionReferenceConfigVar<TComponents extends ComponentSelector<any>> = BaseConfigVar & {
121
- connection: ToComponentReferences<"connection", TComponents>;
121
+ connection: ToComponentReferences<"connection", TComponents> & {
122
+ template?: string;
123
+ };
122
124
  };
123
125
  /** Defines attributes of a Config Var that represents a Connection. */
124
126
  export declare type ConnectionConfigVar<TComponents extends ComponentSelector<any>> = ConnectionDefinitionConfigVar | ConnectionReferenceConfigVar<TComponents>;
@@ -216,6 +218,7 @@ export interface ComponentReference<TValueType, TConfigPages extends ConfigPages
216
218
  values?: {
217
219
  [key: string]: ValueReference<TValueType, TConfigPages>;
218
220
  };
221
+ template?: string;
219
222
  }
220
223
  export declare const isComponentReference: (ref: unknown) => ref is ComponentReference<any, ConfigPages<any>>;
221
224
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "8.1.4",
3
+ "version": "8.1.6",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"