@prismatic-io/spectral 4.0.6 → 5.0.0-rc.0

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/README.md CHANGED
@@ -14,22 +14,23 @@ Please see our [documentation](https://prismatic.io/docs/custom-components/writi
14
14
 
15
15
  ## What is Prismatic?
16
16
 
17
- Prismatic is the embedded integration platform for B2B software companies. It's the easiest way to build integrations and provide a first-class integration experience to your customers.
17
+ Prismatic is the integration platform for B2B software companies. It's the quickest way to build integrations to the other apps your customers use and to add a native integration marketplace to your product.
18
18
 
19
- Prismatic reduces integration effort and empowers every role with exactly what they need, so you can spend less time on integrations and more time on core product innovation.
19
+ Prismatic significantly reduces overall integration effort and enables non-dev teams to take on more of the integration workload, so that you can deliver integrations faster and spend more time on core product innovation.
20
20
 
21
21
  With Prismatic, you can:
22
22
 
23
- - Build reusable [integrations](https://prismatic.io/docs/integrations) in an intuitive low-code integration designer
24
- - Easily deploy customer-specific integration [instances](https://prismatic.io/docs/instances) with unique configurations and credentials
25
- - Run your integrations in a purpose-built environment
26
- - Provide better support with built-in [logging](https://prismatic.io/docs/logging) and [alerting](https://prismatic.io/docs/monitoring-and-alerting)
27
- - Embed a white-labeled customer integration portal with an [integration marketplace](https://prismatic.io/docs/integration-marketplace/) and customer self-service tools
28
- - Mold the platform to your product, industry, and the way you build software
23
+ - Build reusable [integrations](https://prismatic.io/docs/integrations) in a low-code integration designer that's tailored for your product
24
+ - Use [pre-built components](https://prismatic.io/docs/components/component-catalog) to handle most of your integrations' functionality, and write [custom components](https://prismatic.io/docs/custom-components/writing-custom-components) when needed
25
+ - Quickly add an [integration marketplace](https://prismatic.io/docs/integration-marketplace) to your product so customers can explore, activate, and monitor integrations
26
+ - Easily deploy customer-specific integration [instances](https://prismatic.io/docs/instances) with unique configurations and connections
27
+ - Provide better support with tools like [logging](https://prismatic.io/docs/logging) and [alerting](https://prismatic.io/docs/monitoring-and-alerting)
28
+ - Run your integrations in a purpose-built environment designed for security and scalability
29
+ - Use powerful dev tools to mold the platform to your product, industry, and the way you build software
29
30
 
30
31
  ## Who uses Prismatic?
31
32
 
32
- Prismatic is for B2B (business-to-business) software companies, meaning software companies that provide applications used by businesses. It's a good fit for products/teams at any stage, including early stage SaaS, established SaaS, and legacy or on-prem systems.
33
+ Prismatic is for B2B (business-to-business) software companies, meaning software companies that provide applications used by businesses. It's a good fit for products/teams ranging from early-stage and growing SaaS startups to large, established software companies looking to improve the way they do integrations.
33
34
 
34
35
  Many B2B software teams serve customers in niche vertical markets, and we designed Prismatic with that in mind. We provide powerful and flexible tools so you can build exactly the integrations your customers need, no matter who your customers are, no matter what systems you need to connect to, no matter how "non-standard" your integration scenario.
35
36
 
@@ -0,0 +1,11 @@
1
+ import { Connection } from ".";
2
+ export declare class SpectralError extends Error {
3
+ isSpectralError: boolean;
4
+ constructor(message: string);
5
+ }
6
+ export declare class ConnectionError extends SpectralError {
7
+ connection: Connection;
8
+ constructor(connection: Connection, message: string);
9
+ }
10
+ export declare const isSpectralError: (payload: unknown) => payload is SpectralError;
11
+ export declare const isConnectionError: (payload: unknown) => payload is ConnectionError;
package/dist/errors.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isConnectionError = exports.isSpectralError = exports.ConnectionError = exports.SpectralError = void 0;
4
+ class SpectralError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.isSpectralError = true;
8
+ this.name = this.constructor.name;
9
+ Error.captureStackTrace(this, this.constructor);
10
+ }
11
+ }
12
+ exports.SpectralError = SpectralError;
13
+ class ConnectionError extends SpectralError {
14
+ constructor(connection, message) {
15
+ super(message);
16
+ this.connection = connection;
17
+ }
18
+ }
19
+ exports.ConnectionError = ConnectionError;
20
+ const isSpectralError = (payload) => Boolean(payload &&
21
+ typeof payload === "object" &&
22
+ "isSpectralError" in payload &&
23
+ payload.isSpectralError === true);
24
+ exports.isSpectralError = isSpectralError;
25
+ const isConnectionError = (payload) => exports.isSpectralError(payload) && "connection" in payload;
26
+ exports.isConnectionError = isConnectionError;
package/dist/index.d.ts CHANGED
@@ -7,20 +7,17 @@
7
7
  * Both component author-facing types and server types that
8
8
  * the Prismatic API expects are imported here.
9
9
  */
10
- import { ActionDefinition, InputFieldDefinition, ActionPerformReturn, Inputs, TriggerDefinition, TriggerResult } from "./types";
10
+ import { ActionDefinition, InputFieldDefinition, ActionPerformReturn, ComponentDefinition, ConnectionFieldDefinition, Inputs, TriggerDefinition, TriggerResult } from "./types";
11
11
  import { Component } from "./types/server-types";
12
12
  /**
13
13
  * This function creates a component object that can be
14
14
  * imported into the Prismatic API. For information on using
15
15
  * this function to write custom components, see
16
16
  * https://prismatic.io/docs/custom-components/writing-custom-components/#exporting-a-component.
17
- * @param definition A ComponentDefinition type object, including display infromation, unique key, authorization information, and a set of actions the component implements.
17
+ * @param definition A ComponentDefinition type object, including display infromation, unique key, and a set of actions the component implements.
18
18
  * @returns This function returns a component object that has the shape the Prismatic API expects.
19
19
  */
20
- export declare const component: <T extends boolean>(definition: Omit<Component<T>, "actions" | "triggers"> & {
21
- actions?: Record<string, ActionDefinition<any, boolean, ActionPerformReturn<boolean, any>>> | undefined;
22
- triggers?: Record<string, TriggerDefinition<any, boolean, TriggerResult<boolean>>> | undefined;
23
- }) => Component<T>;
20
+ export declare const component: <T extends boolean>(definition: ComponentDefinition<T>) => Component<T>;
24
21
  /**
25
22
  * This function creates an action object that can be referenced
26
23
  * by a custom component. It helps ensure that the shape of the
@@ -49,6 +46,16 @@ export declare const trigger: <T extends Inputs, AllowsBranching extends boolean
49
46
  * @returns This function validates the shape of the `definition` object provided, and returns the same input object.
50
47
  */
51
48
  export declare const input: <T extends InputFieldDefinition>(definition: T) => T;
49
+ /**
50
+ * For information on writing custom component connections, see
51
+ * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
52
+ * @param definition A ConnectionfieldDefinition 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.
53
+ * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
54
+ */
55
+ export declare const connection: <T extends Omit<ConnectionFieldDefinition, "type">>(definition: T) => T & {
56
+ type: "connection";
57
+ };
52
58
  export { default as util } from "./util";
53
59
  export * from "./types";
54
60
  export { default as testing } from "./testing";
61
+ export * from "./errors";
package/dist/index.js CHANGED
@@ -18,7 +18,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.testing = exports.util = exports.input = exports.trigger = exports.action = exports.component = void 0;
21
+ exports.testing = exports.util = exports.connection = exports.input = exports.trigger = exports.action = exports.component = void 0;
22
+ const convertInput = (key, input) => {
23
+ var _a;
24
+ if ("inputs" in input) {
25
+ return Object.assign(Object.assign({}, input), { key, inputs: Object.entries((_a = input.inputs) !== null && _a !== void 0 ? _a : {}).map(([key, value]) => convertInput(key, value)) });
26
+ }
27
+ return Object.assign(Object.assign({}, input), { key });
28
+ };
22
29
  /**
23
30
  * This is a helper function for component() to convert an
24
31
  * action defined in TypeScript into an action object that
@@ -29,9 +36,7 @@ exports.testing = exports.util = exports.input = exports.trigger = exports.actio
29
36
  */
30
37
  const convertAction = (actionKey, action) => {
31
38
  var _a;
32
- const items = Object.entries((_a = action.inputs) !== null && _a !== void 0 ? _a : {});
33
- const inputDefinitions = items.map(([key, value]) => (Object.assign({ key }, (typeof value === "object" ? value : {}))));
34
- return Object.assign(Object.assign({}, action), { key: actionKey, inputs: inputDefinitions, perform: action.perform, examplePayload: action.examplePayload });
39
+ return (Object.assign(Object.assign({}, action), { key: actionKey, inputs: Object.entries((_a = action.inputs) !== null && _a !== void 0 ? _a : {}).map(([key, value]) => convertInput(key, value)), perform: action.perform, examplePayload: action.examplePayload }));
35
40
  };
36
41
  /**
37
42
  * This is a helper function for component() to convert a
@@ -43,24 +48,29 @@ const convertAction = (actionKey, action) => {
43
48
  */
44
49
  const convertTrigger = (triggerKey, trigger) => {
45
50
  var _a;
46
- const items = Object.entries((_a = trigger.inputs) !== null && _a !== void 0 ? _a : {});
47
- const inputDefinitions = items.map(([key, value]) => (Object.assign({ key }, (typeof value === "object" ? value : {}))));
48
- return Object.assign(Object.assign({}, trigger), { key: triggerKey, inputs: inputDefinitions, perform: trigger.perform, examplePayload: trigger.examplePayload || undefined });
51
+ return (Object.assign(Object.assign({}, trigger), { key: triggerKey, inputs: Object.entries((_a = trigger.inputs) !== null && _a !== void 0 ? _a : {}).map(([key, value]) => convertInput(key, value)), perform: trigger.perform, examplePayload: trigger.examplePayload || undefined }));
52
+ };
53
+ const convertConnection = (connectionKey, connection) => {
54
+ var _a;
55
+ return (Object.assign(Object.assign({}, connection), { key: connectionKey, inputs: Object.entries((_a = connection.inputs) !== null && _a !== void 0 ? _a : {}).map(([key, value]) => convertInput(key, value)) }));
49
56
  };
50
57
  /**
51
58
  * This function creates a component object that can be
52
59
  * imported into the Prismatic API. For information on using
53
60
  * this function to write custom components, see
54
61
  * https://prismatic.io/docs/custom-components/writing-custom-components/#exporting-a-component.
55
- * @param definition A ComponentDefinition type object, including display infromation, unique key, authorization information, and a set of actions the component implements.
62
+ * @param definition A ComponentDefinition type object, including display infromation, unique key, and a set of actions the component implements.
56
63
  * @returns This function returns a component object that has the shape the Prismatic API expects.
57
64
  */
58
- const component = (definition) => (Object.assign(Object.assign({ version: "placeholder" }, definition), { documentationUrl: definition.documentationUrl || null, actions: Object.fromEntries(Object.entries(definition.actions || {}).map(([actionKey, action]) => [
65
+ const component = (definition) => (Object.assign(Object.assign({}, definition), { documentationUrl: definition.documentationUrl || null, actions: Object.fromEntries(Object.entries(definition.actions || {}).map(([actionKey, action]) => [
59
66
  actionKey,
60
67
  convertAction(actionKey, action),
61
68
  ])), triggers: Object.fromEntries(Object.entries(definition.triggers || {}).map(([triggerKey, trigger]) => [
62
69
  triggerKey,
63
70
  convertTrigger(triggerKey, trigger),
71
+ ])), connections: Object.fromEntries(Object.entries(definition.connections || {}).map(([connectionKey, connection]) => [
72
+ connectionKey,
73
+ convertConnection(connectionKey, connection),
64
74
  ])) }));
65
75
  exports.component = component;
66
76
  /**
@@ -94,8 +104,17 @@ exports.trigger = trigger;
94
104
  */
95
105
  const input = (definition) => definition;
96
106
  exports.input = input;
107
+ /**
108
+ * For information on writing custom component connections, see
109
+ * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
110
+ * @param definition A ConnectionfieldDefinition 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.
111
+ * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
112
+ */
113
+ const connection = (definition) => (Object.assign(Object.assign({}, definition), { type: "connection" }));
114
+ exports.connection = connection;
97
115
  var util_1 = require("./util");
98
116
  Object.defineProperty(exports, "util", { enumerable: true, get: function () { return __importDefault(util_1).default; } });
99
117
  __exportStar(require("./types"), exports);
100
118
  var testing_1 = require("./testing");
101
119
  Object.defineProperty(exports, "testing", { enumerable: true, get: function () { return __importDefault(testing_1).default; } });
120
+ __exportStar(require("./errors"), exports);
package/dist/testing.d.ts CHANGED
@@ -5,30 +5,8 @@
5
5
  * https://prismatic.io/docs/custom-components/writing-custom-components/#testing-a-component
6
6
  */
7
7
  /** */
8
- import { ActionContext, ActionLogger, ActionDefinition, ActionInputParameters, Credential, BasicCredential, ApiKeyCredential, ApiKeySecretCredential, PrivateKeyCredential, OAuth2Credential, ActionPerformReturn, AuthorizationMethod, Inputs, TriggerDefinition, TriggerResult, TriggerPayload } from "./types";
9
- /**
10
- * Get an array of available authorization methods that a custom component can use.
11
- * @param except Return authorization methods _except for_ those in this array.
12
- * @returns This function returns an array of available authorization methods.
13
- */
14
- export declare const getAuthorizationMethods: (except?: ("basic" | "api_key" | "api_key_secret" | "private_key" | "oauth2" | "oauth2_client_credentials")[] | undefined) => AuthorizationMethod[];
15
- /** Utility functions to generate the different types of Credentials for testing. */
16
- export declare const credentials: {
17
- /** Return a BasicCredential assembled from provided username and password. */
18
- basic: (username: string, password: string) => BasicCredential;
19
- /** Return a ApiKeyCredential assembled from provided key. */
20
- apiKey: (key: string) => ApiKeyCredential;
21
- /** Return a ApiKeySecretCredential assembled from provided key and secret. */
22
- apiKeySecret: (key: string, secret: string) => ApiKeySecretCredential;
23
- /** Return a PrivateKeyCredential assembled from provided username and privateKey. */
24
- privateKey: (username: string, privateKey: string) => PrivateKeyCredential;
25
- /** Return a OAuth2Credential assembled from provided token and optional redirectUri. */
26
- oauth2: (token: string, redirectUri?: string, tokenUri?: string, clientId?: string, clientSecret?: string, headers?: {}) => OAuth2Credential;
27
- /** Return a OAuth2Credential assembled from provided token. */
28
- oauth2ClientCredentials: (token: string, redirectUri?: string, tokenUri?: string, clientId?: string, clientSecret?: string, headers?: {}) => OAuth2Credential;
29
- /** Returns an arbitrary Credential using method. Generally used for testing negative support cases. */
30
- generate: (method: AuthorizationMethod) => Credential;
31
- };
8
+ import { ActionContext, ActionLogger, ActionDefinition, ActionInputParameters, ConnectionFieldDefinition, Connection, ActionPerformReturn, Inputs, TriggerDefinition, TriggerResult, TriggerPayload } from "./types";
9
+ export declare const createConnection: <T extends ConnectionFieldDefinition>({ connectionKey }: T, values: { [Property in keyof T["inputs"]]: unknown; }) => Connection<T>;
32
10
  /**
33
11
  * Pre-built mock of ActionLogger. Suitable for asserting logs are created as expected.
34
12
  * See https://prismatic.io/docs/custom-components/writing-custom-components/#verifying-correct-logging-in-action-tests for information on testing correct logging behavior in your custom component.
@@ -60,22 +38,5 @@ declare const _default: {
60
38
  invoke: <T extends Inputs, AllowsBranching extends boolean, ReturnData extends ActionPerformReturn<AllowsBranching, unknown>>(actionBase: ActionDefinition<T, AllowsBranching, ReturnData> | Record<string, ActionDefinition<T, AllowsBranching, ReturnData>>, params: ActionInputParameters<T>, context?: Partial<ActionContext> | undefined) => Promise<InvokeReturn<ReturnData>>;
61
39
  invokeTrigger: <T_1 extends Inputs, AllowsBranching_1 extends boolean, Result extends TriggerResult<AllowsBranching_1>>(triggerBase: TriggerDefinition<T_1, AllowsBranching_1, Result> | Record<string, TriggerDefinition<T_1, AllowsBranching_1, Result>>, context?: Partial<ActionContext> | undefined, payload?: TriggerPayload | undefined, params?: ActionInputParameters<T_1> | undefined) => Promise<InvokeReturn<Result>>;
62
40
  loggerMock: () => ActionLogger;
63
- getAuthorizationMethods: (except?: ("basic" | "api_key" | "api_key_secret" | "private_key" | "oauth2" | "oauth2_client_credentials")[] | undefined) => ("basic" | "api_key" | "api_key_secret" | "private_key" | "oauth2" | "oauth2_client_credentials")[];
64
- credentials: {
65
- /** Return a BasicCredential assembled from provided username and password. */
66
- basic: (username: string, password: string) => BasicCredential;
67
- /** Return a ApiKeyCredential assembled from provided key. */
68
- apiKey: (key: string) => ApiKeyCredential;
69
- /** Return a ApiKeySecretCredential assembled from provided key and secret. */
70
- apiKeySecret: (key: string, secret: string) => ApiKeySecretCredential;
71
- /** Return a PrivateKeyCredential assembled from provided username and privateKey. */
72
- privateKey: (username: string, privateKey: string) => PrivateKeyCredential;
73
- /** Return a OAuth2Credential assembled from provided token and optional redirectUri. */
74
- oauth2: (token: string, redirectUri?: string, tokenUri?: string, clientId?: string, clientSecret?: string, headers?: {}) => OAuth2Credential;
75
- /** Return a OAuth2Credential assembled from provided token. */
76
- oauth2ClientCredentials: (token: string, redirectUri?: string, tokenUri?: string, clientId?: string, clientSecret?: string, headers?: {}) => OAuth2Credential;
77
- /** Returns an arbitrary Credential using method. Generally used for testing negative support cases. */
78
- generate: (method: "basic" | "api_key" | "api_key_secret" | "private_key" | "oauth2" | "oauth2_client_credentials") => Credential;
79
- };
80
41
  };
81
42
  export default _default;
package/dist/testing.js CHANGED
@@ -15,85 +15,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15
15
  });
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.invokeTrigger = exports.defaultTriggerPayload = exports.invoke = exports.loggerMock = exports.credentials = exports.getAuthorizationMethods = void 0;
19
- /** */
20
- const types_1 = require("./types");
18
+ exports.invokeTrigger = exports.defaultTriggerPayload = exports.invoke = exports.loggerMock = exports.createConnection = void 0;
21
19
  const jest_mock_1 = require("jest-mock");
22
- /**
23
- * Get an array of available authorization methods that a custom component can use.
24
- * @param except Return authorization methods _except for_ those in this array.
25
- * @returns This function returns an array of available authorization methods.
26
- */
27
- const getAuthorizationMethods = (except) => {
28
- if (except === undefined) {
29
- return types_1.AvailableAuthorizationMethods;
30
- }
31
- return types_1.AvailableAuthorizationMethods.filter((m) => !except.includes(m));
32
- };
33
- exports.getAuthorizationMethods = getAuthorizationMethods;
34
- /** Utility functions to generate the different types of Credentials for testing. */
35
- exports.credentials = {
36
- /** Return a BasicCredential assembled from provided username and password. */
37
- basic: (username, password) => ({
38
- authorizationMethod: "basic",
39
- fields: {
40
- username,
41
- password,
42
- },
43
- }),
44
- /** Return a ApiKeyCredential assembled from provided key. */
45
- apiKey: (key) => ({
46
- authorizationMethod: "api_key",
47
- fields: { api_key: key },
48
- }),
49
- /** Return a ApiKeySecretCredential assembled from provided key and secret. */
50
- apiKeySecret: (key, secret) => ({
51
- authorizationMethod: "api_key_secret",
52
- fields: {
53
- api_key: key,
54
- api_secret: secret,
55
- },
56
- }),
57
- /** Return a PrivateKeyCredential assembled from provided username and privateKey. */
58
- privateKey: (username, privateKey) => ({
59
- authorizationMethod: "private_key",
60
- fields: {
61
- username,
62
- private_key: privateKey,
63
- },
64
- }),
65
- /** Return a OAuth2Credential assembled from provided token and optional redirectUri. */
66
- oauth2: (token, redirectUri = "", tokenUri = "", clientId = "", clientSecret = "", headers = {}) => ({
67
- authorizationMethod: "oauth2",
68
- redirectUri,
69
- fields: {
70
- client_id: clientId,
71
- client_secret: clientSecret,
72
- token_uri: tokenUri,
73
- headers,
74
- },
75
- token: { access_token: token, token_type: "bearer" },
76
- context: {},
77
- }),
78
- /** Return a OAuth2Credential assembled from provided token. */
79
- oauth2ClientCredentials: (token, redirectUri = "", tokenUri = "", clientId = "", clientSecret = "", headers = {}) => ({
80
- authorizationMethod: "oauth2_client_credentials",
81
- redirectUri: redirectUri,
82
- fields: {
83
- client_id: clientId,
84
- client_secret: clientSecret,
85
- token_uri: tokenUri,
86
- headers,
87
- },
88
- token: { access_token: token, token_type: "bearer" },
89
- context: {},
90
- }),
91
- /** Returns an arbitrary Credential using method. Generally used for testing negative support cases. */
92
- generate: (method) => ({
93
- authorizationMethod: method,
94
- fields: {},
95
- }),
96
- };
20
+ const createConnection = ({ connectionKey }, values) => ({
21
+ instanceConfigVarId: "",
22
+ key: connectionKey,
23
+ fields: values,
24
+ });
25
+ exports.createConnection = createConnection;
97
26
  /**
98
27
  * Pre-built mock of ActionLogger. Suitable for asserting logs are created as expected.
99
28
  * See https://prismatic.io/docs/custom-components/writing-custom-components/#verifying-correct-logging-in-action-tests for information on testing correct logging behavior in your custom component.
@@ -114,7 +43,7 @@ exports.loggerMock = loggerMock;
114
43
  */
115
44
  const invoke = (actionBase, params, context) => __awaiter(void 0, void 0, void 0, function* () {
116
45
  const action = (actionBase.perform ? actionBase : Object.values(actionBase)[0]);
117
- const realizedContext = Object.assign({ credential: undefined, logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
46
+ const realizedContext = Object.assign({ logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
118
47
  const result = yield action.perform(realizedContext, params);
119
48
  return {
120
49
  result,
@@ -141,6 +70,9 @@ const defaultTriggerPayload = () => {
141
70
  webhookUrls: {
142
71
  "Flow 1": "https://example.com",
143
72
  },
73
+ webhookApiKeys: {
74
+ "Flow 1": ["example-123", "example-456"],
75
+ },
144
76
  customer: {
145
77
  name: "Customer 1",
146
78
  externalId: "1234",
@@ -156,7 +88,7 @@ exports.defaultTriggerPayload = defaultTriggerPayload;
156
88
  */
157
89
  const invokeTrigger = (triggerBase, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () {
158
90
  const trigger = (triggerBase.perform ? triggerBase : Object.values(triggerBase)[0]);
159
- const realizedContext = Object.assign({ credential: undefined, logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
91
+ const realizedContext = Object.assign({ logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
160
92
  const realizedPayload = Object.assign(Object.assign({}, exports.defaultTriggerPayload()), payload);
161
93
  const realizedParams = params || {};
162
94
  const result = yield trigger.perform(realizedContext, realizedPayload, realizedParams);
@@ -170,6 +102,4 @@ exports.default = {
170
102
  invoke: exports.invoke,
171
103
  invokeTrigger: exports.invokeTrigger,
172
104
  loggerMock: exports.loggerMock,
173
- getAuthorizationMethods: exports.getAuthorizationMethods,
174
- credentials: exports.credentials,
175
105
  };
@@ -1,4 +1,4 @@
1
- import { ActionPerformReturn, ActionDisplayDefinition, ActionPerformFunction, AuthorizationDefinition, Inputs } from ".";
1
+ import { ActionPerformReturn, ActionDisplayDefinition, ActionPerformFunction, Inputs } from ".";
2
2
  /**
3
3
  * ActionDefinition is the type of the object that is passed in to `action` function to
4
4
  * define a component action.
@@ -10,8 +10,6 @@ export interface ActionDefinition<T extends Inputs, AllowsBranching extends bool
10
10
  perform: ActionPerformFunction<T, AllowsBranching, ReturnData>;
11
11
  /** InputFields to present in the Prismatic interface for configuration of this Action. */
12
12
  inputs: T;
13
- /** Specifies Authorization settings, if applicable */
14
- authorization?: AuthorizationDefinition;
15
13
  /** Optional attribute that specifies whether an Action will terminate execution.*/
16
14
  terminateExecution?: boolean;
17
15
  /** Determines whether an Action will allow Conditional Branching.*/
@@ -1,14 +1,14 @@
1
- import { InputFieldDefinition, Inputs, InputFieldTypeMap } from ".";
1
+ import { InputFieldDefinition, Inputs, InputFieldTypeMap, Connection, ConnectionFieldDefinition } from ".";
2
2
  /**
3
3
  * Collection of input parameters.
4
4
  * Inputs can be static values, references to config variables, or
5
- * references to previou steps' outputs.
5
+ * references to previous steps' outputs.
6
6
  */
7
- export declare type ActionInputParameters<T extends Inputs> = T extends Record<string, InputFieldDefinition> ? {
8
- [K in keyof T]: ExtractValue<T[K]>;
9
- } : never;
7
+ export declare type ActionInputParameters<TInputs extends Inputs> = {
8
+ [Property in keyof TInputs]: TInputs[Property] extends ConnectionFieldDefinition ? Connection<TInputs[Property]> : ExtractValue<TInputs[Property]>;
9
+ };
10
10
  export declare type ExtractValue<TValue extends InputFieldDefinition> = MapCollectionValues<InputFieldTypeMap[TValue["type"]], TValue["collection"]>;
11
- export declare type MapCollectionValues<TValue, TCollection extends InputFieldDefinition["collection"] | undefined> = TCollection extends "keyvaluelist" ? KeyValuePair<TValue>[] | undefined : TCollection extends "valuelist" ? TValue[] | undefined : TValue;
11
+ export declare type MapCollectionValues<TType, TCollection extends InputFieldDefinition["collection"] | undefined> = TCollection extends "keyvaluelist" ? KeyValuePair<TType>[] | undefined : TCollection extends "valuelist" ? TType[] | undefined : TType;
12
12
  /**
13
13
  * KeyValuePair input parameter type.
14
14
  * This allows users to input multiple keys / values as an input.
@@ -1,10 +1,8 @@
1
- import { Credential, Inputs, ActionPerformReturn, ActionInputParameters, ActionLogger } from ".";
1
+ import { Inputs, ActionPerformReturn, ActionInputParameters, ActionLogger } from ".";
2
2
  /** Definition of the function to perform when an Action is invoked. */
3
3
  export declare type ActionPerformFunction<T extends Inputs, AllowsBranching extends boolean, ReturnData extends ActionPerformReturn<AllowsBranching, unknown>> = (context: ActionContext, params: ActionInputParameters<T>) => Promise<ReturnData>;
4
4
  /** Context provided to perform method containing helpers and contextual data */
5
5
  export interface ActionContext {
6
- /** Credential for the action, optional since not all actions will require a credential */
7
- credential?: Credential;
8
6
  /** Logger for permanent logging; console calls are also captured */
9
7
  logger: ActionLogger;
10
8
  /** A key/value store that may be used to store small amounts of data that is persisted between Instance executions */
@@ -0,0 +1,7 @@
1
+ import { Component } from "./server-types";
2
+ import { ActionPerformReturn, ActionDefinition, TriggerDefinition, TriggerResult, ConnectionFieldDefinition } from ".";
3
+ export declare type ComponentDefinition<T extends boolean> = Omit<Component<T>, "actions" | "triggers" | "connections"> & {
4
+ actions?: Record<string, ActionDefinition<any, boolean, ActionPerformReturn<boolean, any>>>;
5
+ triggers?: Record<string, TriggerDefinition<any, boolean, TriggerResult<boolean>>>;
6
+ connections?: Record<string, ConnectionFieldDefinition>;
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,4 +9,5 @@ export declare type InputFieldTypeMap = {
9
9
  boolean: unknown;
10
10
  code: unknown;
11
11
  conditional: ConditionalExpression;
12
+ connection: never;
12
13
  };
@@ -1,12 +1,12 @@
1
1
  import { InputFieldType } from ".";
2
2
  export declare type Inputs = Record<string, InputFieldDefinition>;
3
- export declare type InputFieldDefinition = DefaultInputFieldDefinition | CodeInputFieldDefinition;
4
- /** Defines attributes of a InputField. */
5
- export interface DefaultInputFieldDefinition {
3
+ export declare type ConnectionInputs = Record<string, DefaultInputFieldDefinition & {
4
+ shown?: boolean;
5
+ }>;
6
+ export declare type InputFieldDefinition = DefaultInputFieldDefinition | CodeInputFieldDefinition | ConnectionFieldDefinition;
7
+ interface BaseInputFieldDefinition {
6
8
  /** Interface label of the InputField. */
7
9
  label: string;
8
- /** Data type the InputField will collect. */
9
- type: InputFieldType;
10
10
  /** Collection type of the InputField */
11
11
  collection?: InputFieldCollection;
12
12
  /** Text to show as the InputField placeholder. */
@@ -22,10 +22,39 @@ export interface DefaultInputFieldDefinition {
22
22
  /** Dictates possible choices for the input. */
23
23
  model?: InputFieldChoice[];
24
24
  }
25
- export interface CodeInputFieldDefinition extends DefaultInputFieldDefinition {
26
- type: "code";
25
+ /** Defines attributes of a InputField. */
26
+ export interface DefaultInputFieldDefinition extends BaseInputFieldDefinition {
27
+ type: Exclude<InputFieldType, "code" | "connection">;
28
+ }
29
+ /** Defines attributes of a CodeInputField. */
30
+ export interface CodeInputFieldDefinition extends BaseInputFieldDefinition {
31
+ type: Extract<InputFieldType, "code">;
27
32
  language?: string;
28
33
  }
34
+ export declare enum OAuth2Type {
35
+ ClientCredentials = "client_credentials",
36
+ AuthorizationCode = "authorization_code"
37
+ }
38
+ /** Defines attributes of a ConnectionField. */
39
+ export interface ConnectionFieldDefinition extends BaseInputFieldDefinition {
40
+ type: Extract<InputFieldType, "connection">;
41
+ connectionKey: string;
42
+ oauth2Type?: OAuth2Type;
43
+ iconPath?: string;
44
+ inputs: ConnectionInputs;
45
+ }
46
+ export interface Connection<TField extends ConnectionFieldDefinition = ConnectionFieldDefinition> {
47
+ /** Key of the Connection type. */
48
+ key: TField["connectionKey"];
49
+ /** Identifier for the Config Variable hosting this Connection. */
50
+ instanceConfigVarId: string;
51
+ /** Field values supplied to this Connection. */
52
+ fields: {
53
+ [Property in keyof TField["inputs"]]: unknown;
54
+ };
55
+ token?: Record<string, unknown>;
56
+ context?: Record<string, unknown>;
57
+ }
29
58
  /** Defines a single Choice option for a InputField. */
30
59
  export interface InputFieldChoice {
31
60
  /** Label to display for this Choice. */
@@ -35,3 +64,4 @@ export interface InputFieldChoice {
35
64
  }
36
65
  /** InputField collection enumeration */
37
66
  export declare type InputFieldCollection = "valuelist" | "keyvaluelist";
67
+ export {};
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuth2Type = void 0;
4
+ var OAuth2Type;
5
+ (function (OAuth2Type) {
6
+ OAuth2Type["ClientCredentials"] = "client_credentials";
7
+ OAuth2Type["AuthorizationCode"] = "authorization_code";
8
+ })(OAuth2Type = exports.OAuth2Type || (exports.OAuth2Type = {}));
@@ -1,4 +1,4 @@
1
- import { TriggerResult, ActionDisplayDefinition, TriggerPerformFunction, AuthorizationDefinition, Inputs } from ".";
1
+ import { TriggerResult, ActionDisplayDefinition, TriggerPerformFunction, Inputs } from ".";
2
2
  declare const optionChoices: readonly ["invalid", "valid", "required"];
3
3
  export declare type TriggerOptionChoice = typeof optionChoices[number];
4
4
  export declare const TriggerOptionChoices: TriggerOptionChoice[];
@@ -17,8 +17,6 @@ export interface TriggerDefinition<T extends Inputs, AllowsBranching extends boo
17
17
  scheduleSupport: TriggerOptionChoice;
18
18
  /** Specifies whether this Trigger supports synchronous responses to an Integration webhook request. */
19
19
  synchronousResponseSupport: TriggerOptionChoice;
20
- /** Specifies Authorization settings, if applicable */
21
- authorization?: AuthorizationDefinition;
22
20
  /** Optional attribute that specifies whether this Trigger will terminate execution. */
23
21
  terminateExecution?: boolean;
24
22
  /** Determines whether this Trigger allows Conditional Branching. */
@@ -14,9 +14,14 @@ export interface TriggerPayload {
14
14
  data: unknown;
15
15
  contentType?: string;
16
16
  };
17
+ /** The webhook URLs assigned to this integration's flows upon instance deploy */
17
18
  webhookUrls: {
18
19
  [key: string]: string;
19
20
  };
21
+ /** The optional API keys assigned to the flows of this integration. These may be unique per integration instance and per flow. */
22
+ webhookApiKeys: {
23
+ [key: string]: string[];
24
+ };
20
25
  customer: {
21
26
  externalId: string | null;
22
27
  name: string | null;
@@ -2,9 +2,8 @@
2
2
  * This file exports types from all other files in types/, so users can simply
3
3
  * `import { DesiredType } from "@prismatic-io/spectral"`
4
4
  */
5
- export * from "./Credential";
6
- export * from "./AuthorizationDefinition";
7
5
  export * from "./ActionDefinition";
6
+ export * from "./ComponentDefinition";
8
7
  export * from "./Inputs";
9
8
  export * from "./ActionPerformReturn";
10
9
  export * from "./DisplayDefinition";
@@ -27,9 +27,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.serverTypes = void 0;
30
- __exportStar(require("./Credential"), exports);
31
- __exportStar(require("./AuthorizationDefinition"), exports);
32
30
  __exportStar(require("./ActionDefinition"), exports);
31
+ __exportStar(require("./ComponentDefinition"), exports);
33
32
  __exportStar(require("./Inputs"), exports);
34
33
  __exportStar(require("./ActionPerformReturn"), exports);
35
34
  __exportStar(require("./DisplayDefinition"), exports);
@@ -6,29 +6,29 @@
6
6
  */
7
7
  /// <reference types="node" />
8
8
  /** Import shared types from types/ */
9
+ import { OAuth2Type } from ".";
9
10
  import { ActionContext } from "./ActionPerformFunction";
10
- import { AuthorizationDefinition } from "./AuthorizationDefinition";
11
11
  import { ActionDisplayDefinition, ComponentDisplayDefinition } from "./DisplayDefinition";
12
12
  import { InputFieldChoice, InputFieldCollection } from "./Inputs";
13
13
  import { TriggerOptionChoice } from "./TriggerDefinition";
14
14
  import { TriggerPayload as _TriggerPayload } from "./TriggerPayload";
15
15
  import { TriggerBaseResult, TriggerBranchingResult } from "./TriggerResult";
16
16
  /** Defines attributes of a Component. */
17
- interface ComponentBase<T extends boolean> {
17
+ interface ComponentBase<TPublic extends boolean> {
18
18
  /** Specifies unique key for this Component. */
19
19
  key: string;
20
20
  /** Specifies if this Component is available for all Organizations or only your own @default false */
21
- public?: T;
21
+ public?: TPublic;
22
22
  /** Defines how the Component is displayed in the Prismatic interface. */
23
- display: ComponentDisplayDefinition<T>;
24
- /** @deprecated Version of the Component. */
25
- version?: string;
23
+ display: ComponentDisplayDefinition<TPublic>;
26
24
  /** Specifies the supported Actions of this Component. */
27
25
  actions?: Record<string, Action>;
28
26
  /** Specifies the supported Triggers of this Component. */
29
27
  triggers?: Record<string, Trigger>;
28
+ /** Specifies the supported Connections of this Component. */
29
+ connections?: Record<string, ConnectionField>;
30
30
  }
31
- export declare type Component<T extends boolean> = ComponentBase<T> & (T extends true ? {
31
+ export declare type Component<TPublic extends boolean> = ComponentBase<TPublic> & (TPublic extends true ? {
32
32
  /** Specified the URL for the Component Documentation. */
33
33
  documentationUrl: string;
34
34
  } : {
@@ -43,8 +43,6 @@ interface BaseAction {
43
43
  display: ActionDisplayDefinition;
44
44
  /** InputFields to present in the Prismatic interface for configuration of this Action. */
45
45
  inputs: InputField[];
46
- /** Specifies Authorization settings, if applicable */
47
- authorization?: AuthorizationDefinition;
48
46
  /** Optional attribute that specifies whether an Action will terminate execution. */
49
47
  terminateExecution?: boolean;
50
48
  /** Determines whether an Action will allow Conditional Branching. */
@@ -118,7 +116,7 @@ export declare type TriggerResult = TriggerBranchingResult | TriggerBaseResult |
118
116
  /** Definition of the function to perform when a Trigger is invoked. */
119
117
  export declare type TriggerPerformFunction = (context: ActionContext, payload: TriggerPayload, params: ActionInputParameters) => Promise<TriggerResult>;
120
118
  export declare type TriggerPayload = _TriggerPayload;
121
- export declare type InputField = DefaultInputField | CodeInputField;
119
+ export declare type InputField = DefaultInputField | CodeInputField | ConnectionField;
122
120
  /** Defines attributes of a InputField. */
123
121
  interface DefaultInputField {
124
122
  /** Unique identifier of the InputField. Must be unique within an Action. */
@@ -146,8 +144,17 @@ interface CodeInputField extends DefaultInputField {
146
144
  type: "code";
147
145
  language?: string;
148
146
  }
147
+ export interface ConnectionField extends DefaultInputField {
148
+ type: "connection";
149
+ key: string;
150
+ oauth2Type?: OAuth2Type;
151
+ iconPath?: string;
152
+ inputs: (Exclude<InputField, ConnectionField> & {
153
+ shown?: boolean;
154
+ })[];
155
+ }
149
156
  /** InputField type enumeration. */
150
- export declare type InputFieldType = "string" | "text" | "password" | "boolean" | "code" | "data" | "conditional";
157
+ export declare type InputFieldType = "string" | "text" | "password" | "boolean" | "code" | "data" | "conditional" | "connection";
151
158
  /** Binary data payload */
152
159
  export interface DataPayload {
153
160
  /** Raw binary data as a Buffer */
package/dist/util.d.ts CHANGED
@@ -5,6 +5,16 @@
5
5
  */
6
6
  import { DataPayload } from "./types/server-types";
7
7
  import { KeyValuePair } from "./types";
8
+ /**
9
+ * This function returns a lower cased version of the headers passed to it.
10
+ *
11
+ * - `lowerCaseHeaders({"Content-Type": "Application/JSON"}) will return {"content-type": "Application/JSON"}`
12
+ * - `lowerCaseHeaders({"Cache-Control": "max-age=604800"}) will return {"cache-control": "max-age=604800"}`
13
+ * - `lowerCaseHeaders({"Accept-Language": "en-us"}) will return {"accept-language": "en-us"}`
14
+ * @param headers The headers to convert to lower case
15
+ * @returns This function returns a header object
16
+ * */
17
+ export declare const lowerCaseHeaders: (headers: Record<string, string>) => Record<string, string>;
8
18
  declare const _default: {
9
19
  types: {
10
20
  isBool: (value: unknown) => value is boolean;
@@ -25,6 +35,7 @@ declare const _default: {
25
35
  toString: (value: unknown, defaultValue?: string) => string;
26
36
  keyValPairListToObject: (kvpList?: KeyValuePair<unknown>[]) => Record<string, unknown>;
27
37
  isJSON: (value: string) => boolean;
38
+ lowerCaseHeaders: (headers: Record<string, string>) => Record<string, string>;
28
39
  };
29
40
  docs: {
30
41
  formatJsonExample: (input: unknown) => string;
package/dist/util.js CHANGED
@@ -8,6 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.lowerCaseHeaders = void 0;
11
12
  /** */
12
13
  const parseISO_1 = __importDefault(require("date-fns/parseISO"));
13
14
  const isValid_1 = __importDefault(require("date-fns/isValid"));
@@ -97,7 +98,7 @@ const toInt = (value, defaultValue) => {
97
98
  * - `util.types.isBool("5.5")` will return `true`, since the string `"5.5"` can easily be coerced into a number.
98
99
  * - `util.types.isBool("Hello")` will return `false`, since `"Hello"` is not a number.
99
100
  *
100
- * @param value The varible to test.
101
+ * @param value The variable to test.
101
102
  * @returns This function returns true if `value` can easily be coerced into a number, and false otherwise.
102
103
  */
103
104
  const isNumber = (value) => !Number.isNaN(Number(value));
@@ -310,6 +311,19 @@ const isJSON = (value) => {
310
311
  return false;
311
312
  }
312
313
  };
314
+ /**
315
+ * This function returns a lower cased version of the headers passed to it.
316
+ *
317
+ * - `lowerCaseHeaders({"Content-Type": "Application/JSON"}) will return {"content-type": "Application/JSON"}`
318
+ * - `lowerCaseHeaders({"Cache-Control": "max-age=604800"}) will return {"cache-control": "max-age=604800"}`
319
+ * - `lowerCaseHeaders({"Accept-Language": "en-us"}) will return {"accept-language": "en-us"}`
320
+ * @param headers The headers to convert to lower case
321
+ * @returns This function returns a header object
322
+ * */
323
+ const lowerCaseHeaders = (headers) => Object.entries(headers).reduce((result, [key, val]) => {
324
+ return Object.assign(Object.assign({}, result), { [key.toLowerCase()]: val });
325
+ }, {});
326
+ exports.lowerCaseHeaders = lowerCaseHeaders;
313
327
  exports.default = {
314
328
  types: {
315
329
  isBool,
@@ -330,6 +344,7 @@ exports.default = {
330
344
  toString,
331
345
  keyValPairListToObject,
332
346
  isJSON,
347
+ lowerCaseHeaders: exports.lowerCaseHeaders,
333
348
  },
334
349
  docs: {
335
350
  formatJsonExample,
package/dist/util.test.js CHANGED
@@ -283,4 +283,23 @@ describe("util", () => {
283
283
  }));
284
284
  });
285
285
  });
286
+ const validJSON = fast_check_1.default.jsonObject().map((x) => JSON.stringify(x));
287
+ const invalidJSON = fast_check_1.default.constantFrom("", "['']", "someString", null, undefined);
288
+ describe("JSON", () => {
289
+ it("returns true in the case of actual JSON", () => {
290
+ fast_check_1.default.assert(fast_check_1.default.property(validJSON, (v) => {
291
+ expect(util_1.default.types.isJSON(v)).toStrictEqual(true);
292
+ }));
293
+ });
294
+ it("returns false in the case of invalid JSON", () => {
295
+ fast_check_1.default.assert(fast_check_1.default.property(invalidJSON, (v) => {
296
+ expect(util_1.default.types.isJSON(util_1.default.types.toString(v))).toStrictEqual(false);
297
+ }));
298
+ });
299
+ describe("JSON", () => {
300
+ it("returns true in the case of actual JSON", () => {
301
+ expect(util_1.default.types.lowerCaseHeaders({ "Content-Type": "Application/Json" })).toStrictEqual({ "content-type": "Application/Json" });
302
+ });
303
+ });
304
+ });
286
305
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "4.0.6",
3
+ "version": "5.0.0-rc.0",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"
@@ -1,14 +0,0 @@
1
- /** Authorization settings for a component */
2
- export interface AuthorizationDefinition {
3
- /** Whether authorization is required */
4
- required: boolean;
5
- /** Supported authorization methods */
6
- methods: AuthorizationMethod[];
7
- }
8
- declare const authorizationMethods: readonly ["basic", "api_key", "api_key_secret", "private_key", "oauth2", "oauth2_client_credentials"];
9
- export declare type AuthorizationMethod = typeof authorizationMethods[number];
10
- export declare const AvailableAuthorizationMethods: AuthorizationMethod[];
11
- declare const oauth2AuthorizationMethods: readonly ["oauth2", "oauth2_client_credentials"];
12
- export declare type OAuth2AuthorizationMethod = typeof oauth2AuthorizationMethods[number];
13
- export declare const AvailableOAuth2AuthorizationMethods: OAuth2AuthorizationMethod[];
14
- export {};
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AvailableOAuth2AuthorizationMethods = exports.AvailableAuthorizationMethods = void 0;
4
- const authorizationMethods = [
5
- "basic",
6
- "api_key",
7
- "api_key_secret",
8
- "private_key",
9
- "oauth2",
10
- "oauth2_client_credentials",
11
- ];
12
- exports.AvailableAuthorizationMethods = [
13
- ...authorizationMethods,
14
- ];
15
- const oauth2AuthorizationMethods = [
16
- "oauth2",
17
- "oauth2_client_credentials",
18
- ];
19
- exports.AvailableOAuth2AuthorizationMethods = [...oauth2AuthorizationMethods];
@@ -1,58 +0,0 @@
1
- /**
2
- * Types defined in this file describe the shape of credentials
3
- * that can be passed to actions' perform functions.
4
- * Read about the credential object at:
5
- * https://prismatic.io/docs/custom-components/writing-custom-components#contextcredential
6
- */
7
- /** */
8
- import { OAuth2AuthorizationMethod } from ".";
9
- export declare type Credential = BasicCredential | ApiKeyCredential | ApiKeySecretCredential | PrivateKeyCredential | OAuth2Credential;
10
- export interface BasicCredential {
11
- authorizationMethod: "basic";
12
- fields: {
13
- username: string;
14
- password: string;
15
- };
16
- }
17
- export interface ApiKeyCredential {
18
- authorizationMethod: "api_key";
19
- fields: {
20
- api_key: string;
21
- };
22
- }
23
- export interface ApiKeySecretCredential {
24
- authorizationMethod: "api_key_secret";
25
- fields: {
26
- api_key: string;
27
- api_secret: string;
28
- };
29
- }
30
- export interface PrivateKeyCredential {
31
- authorizationMethod: "private_key";
32
- fields: {
33
- username: string;
34
- private_key: string;
35
- };
36
- }
37
- export interface OAuth2Credential {
38
- authorizationMethod: OAuth2AuthorizationMethod;
39
- redirectUri: string;
40
- fields: {
41
- client_id: string;
42
- client_secret: string;
43
- token_uri: string;
44
- auth_uri?: string;
45
- scopes?: string;
46
- headers?: Record<string, string>;
47
- };
48
- token: {
49
- access_token: string;
50
- token_type: string;
51
- refresh_token?: string;
52
- expires_in?: string;
53
- [key: string]: string | undefined;
54
- };
55
- context: {
56
- [key: string]: string;
57
- };
58
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Types defined in this file describe the shape of credentials
4
- * that can be passed to actions' perform functions.
5
- * Read about the credential object at:
6
- * https://prismatic.io/docs/custom-components/writing-custom-components#contextcredential
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });