@prismatic-io/spectral 4.0.8 → 5.0.0-rc.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.
- package/README.md +10 -9
- package/dist/errors.d.ts +11 -0
- package/dist/errors.js +26 -0
- package/dist/index.d.ts +11 -6
- package/dist/index.js +20 -10
- package/dist/testing.d.ts +2 -41
- package/dist/testing.js +10 -83
- package/dist/types/ActionDefinition.d.ts +1 -3
- package/dist/types/ActionInputParameters.d.ts +4 -4
- package/dist/types/ActionPerformFunction.d.ts +1 -3
- package/dist/types/ComponentDefinition.d.ts +7 -0
- package/dist/types/ComponentDefinition.js +2 -0
- package/dist/types/ConnectionDefinition.d.ts +9 -0
- package/dist/types/ConnectionDefinition.js +2 -0
- package/dist/types/InputFieldType.d.ts +2 -0
- package/dist/types/Inputs.d.ts +28 -6
- package/dist/types/Inputs.js +6 -0
- package/dist/types/TriggerDefinition.d.ts +1 -3
- package/dist/types/TriggerPayload.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/types/server-types.d.ts +18 -10
- package/package.json +1 -1
- package/dist/types/AuthorizationDefinition.d.ts +0 -14
- package/dist/types/AuthorizationDefinition.js +0 -19
- package/dist/types/Credential.d.ts +0 -58
- package/dist/types/Credential.js +0 -8
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
|
|
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
|
|
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
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
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
|
|
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
|
|
package/dist/errors.d.ts
ADDED
|
@@ -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, ConnectionDefinition, 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,
|
|
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:
|
|
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,14 @@ 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 ConnectionDefinition>(definition: T) => T;
|
|
52
56
|
export { default as util } from "./util";
|
|
53
57
|
export * from "./types";
|
|
54
58
|
export { default as testing } from "./testing";
|
|
59
|
+
export * from "./errors";
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,8 @@ 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) => (Object.assign(Object.assign({}, input), { key }));
|
|
22
23
|
/**
|
|
23
24
|
* This is a helper function for component() to convert an
|
|
24
25
|
* action defined in TypeScript into an action object that
|
|
@@ -29,9 +30,7 @@ exports.testing = exports.util = exports.input = exports.trigger = exports.actio
|
|
|
29
30
|
*/
|
|
30
31
|
const convertAction = (actionKey, action) => {
|
|
31
32
|
var _a;
|
|
32
|
-
|
|
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 });
|
|
33
|
+
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
34
|
};
|
|
36
35
|
/**
|
|
37
36
|
* This is a helper function for component() to convert a
|
|
@@ -43,25 +42,27 @@ const convertAction = (actionKey, action) => {
|
|
|
43
42
|
*/
|
|
44
43
|
const convertTrigger = (triggerKey, trigger) => {
|
|
45
44
|
var _a;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
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 }));
|
|
46
|
+
};
|
|
47
|
+
const convertConnection = (connection) => {
|
|
48
|
+
var _a;
|
|
49
|
+
return (Object.assign(Object.assign({}, connection), { inputs: Object.entries((_a = connection.inputs) !== null && _a !== void 0 ? _a : {}).map(([key, value]) => convertInput(key, value)) }));
|
|
49
50
|
};
|
|
50
51
|
/**
|
|
51
52
|
* This function creates a component object that can be
|
|
52
53
|
* imported into the Prismatic API. For information on using
|
|
53
54
|
* this function to write custom components, see
|
|
54
55
|
* https://prismatic.io/docs/custom-components/writing-custom-components/#exporting-a-component.
|
|
55
|
-
* @param definition A ComponentDefinition type object, including display infromation, unique key,
|
|
56
|
+
* @param definition A ComponentDefinition type object, including display infromation, unique key, and a set of actions the component implements.
|
|
56
57
|
* @returns This function returns a component object that has the shape the Prismatic API expects.
|
|
57
58
|
*/
|
|
58
|
-
const component = (definition) => (Object.assign(Object.assign({
|
|
59
|
+
const component = (definition) => (Object.assign(Object.assign({}, definition), { documentationUrl: definition.documentationUrl || null, actions: Object.fromEntries(Object.entries(definition.actions || {}).map(([actionKey, action]) => [
|
|
59
60
|
actionKey,
|
|
60
61
|
convertAction(actionKey, action),
|
|
61
62
|
])), triggers: Object.fromEntries(Object.entries(definition.triggers || {}).map(([triggerKey, trigger]) => [
|
|
62
63
|
triggerKey,
|
|
63
64
|
convertTrigger(triggerKey, trigger),
|
|
64
|
-
])) }));
|
|
65
|
+
])), connections: (definition.connections || []).map(convertConnection) }));
|
|
65
66
|
exports.component = component;
|
|
66
67
|
/**
|
|
67
68
|
* This function creates an action object that can be referenced
|
|
@@ -94,8 +95,17 @@ exports.trigger = trigger;
|
|
|
94
95
|
*/
|
|
95
96
|
const input = (definition) => definition;
|
|
96
97
|
exports.input = input;
|
|
98
|
+
/**
|
|
99
|
+
* For information on writing custom component connections, see
|
|
100
|
+
* https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
|
|
101
|
+
* @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.
|
|
102
|
+
* @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
|
|
103
|
+
*/
|
|
104
|
+
const connection = (definition) => definition;
|
|
105
|
+
exports.connection = connection;
|
|
97
106
|
var util_1 = require("./util");
|
|
98
107
|
Object.defineProperty(exports, "util", { enumerable: true, get: function () { return __importDefault(util_1).default; } });
|
|
99
108
|
__exportStar(require("./types"), exports);
|
|
100
109
|
var testing_1 = require("./testing");
|
|
101
110
|
Object.defineProperty(exports, "testing", { enumerable: true, get: function () { return __importDefault(testing_1).default; } });
|
|
111
|
+
__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,
|
|
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, ConnectionDefinition, Connection, ActionPerformReturn, Inputs, TriggerDefinition, TriggerResult, TriggerPayload } from "./types";
|
|
9
|
+
export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>) => Connection;
|
|
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.
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 = ({ key }, values) => ({
|
|
21
|
+
instanceConfigVarId: "",
|
|
22
|
+
key,
|
|
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({
|
|
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,
|
|
@@ -142,7 +71,7 @@ const defaultTriggerPayload = () => {
|
|
|
142
71
|
"Flow 1": "https://example.com",
|
|
143
72
|
},
|
|
144
73
|
webhookApiKeys: {
|
|
145
|
-
"Flow 1": "example-123",
|
|
74
|
+
"Flow 1": ["example-123", "example-456"],
|
|
146
75
|
},
|
|
147
76
|
customer: {
|
|
148
77
|
name: "Customer 1",
|
|
@@ -159,7 +88,7 @@ exports.defaultTriggerPayload = defaultTriggerPayload;
|
|
|
159
88
|
*/
|
|
160
89
|
const invokeTrigger = (triggerBase, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
161
90
|
const trigger = (triggerBase.perform ? triggerBase : Object.values(triggerBase)[0]);
|
|
162
|
-
const realizedContext = Object.assign({
|
|
91
|
+
const realizedContext = Object.assign({ logger: exports.loggerMock(), instanceState: {}, stepId: "mockStepId", executionId: "mockExecutionId" }, context);
|
|
163
92
|
const realizedPayload = Object.assign(Object.assign({}, exports.defaultTriggerPayload()), payload);
|
|
164
93
|
const realizedParams = params || {};
|
|
165
94
|
const result = yield trigger.perform(realizedContext, realizedPayload, realizedParams);
|
|
@@ -173,6 +102,4 @@ exports.default = {
|
|
|
173
102
|
invoke: exports.invoke,
|
|
174
103
|
invokeTrigger: exports.invokeTrigger,
|
|
175
104
|
loggerMock: exports.loggerMock,
|
|
176
|
-
getAuthorizationMethods: exports.getAuthorizationMethods,
|
|
177
|
-
credentials: exports.credentials,
|
|
178
105
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionPerformReturn, ActionDisplayDefinition, ActionPerformFunction,
|
|
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.*/
|
|
@@ -2,13 +2,13 @@ import { InputFieldDefinition, Inputs, InputFieldTypeMap } from ".";
|
|
|
2
2
|
/**
|
|
3
3
|
* Collection of input parameters.
|
|
4
4
|
* Inputs can be static values, references to config variables, or
|
|
5
|
-
* references to
|
|
5
|
+
* references to previous steps' outputs.
|
|
6
6
|
*/
|
|
7
|
-
export declare type ActionInputParameters<
|
|
8
|
-
[
|
|
7
|
+
export declare type ActionInputParameters<TInputs extends Inputs> = TInputs extends Record<string, InputFieldDefinition> ? {
|
|
8
|
+
[Property in keyof TInputs]: ExtractValue<TInputs[Property]>;
|
|
9
9
|
} : never;
|
|
10
10
|
export declare type ExtractValue<TValue extends InputFieldDefinition> = MapCollectionValues<InputFieldTypeMap[TValue["type"]], TValue["collection"]>;
|
|
11
|
-
export declare type MapCollectionValues<
|
|
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 {
|
|
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, ConnectionDefinition, TriggerDefinition, TriggerResult } 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?: ConnectionDefinition[];
|
|
7
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Connection } from ".";
|
|
1
2
|
import { ConditionalExpression } from "./conditional-logic";
|
|
2
3
|
/** InputField type enumeration. */
|
|
3
4
|
export declare type InputFieldType = keyof InputFieldTypeMap;
|
|
@@ -9,4 +10,5 @@ export declare type InputFieldTypeMap = {
|
|
|
9
10
|
boolean: unknown;
|
|
10
11
|
code: unknown;
|
|
11
12
|
conditional: ConditionalExpression;
|
|
13
|
+
connection: Connection;
|
|
12
14
|
};
|
package/dist/types/Inputs.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { InputFieldType } from ".";
|
|
2
2
|
export declare type Inputs = Record<string, InputFieldDefinition>;
|
|
3
|
+
export declare type ConnectionInputs = Record<string, DefaultInputFieldDefinition & {
|
|
4
|
+
shown?: boolean;
|
|
5
|
+
}>;
|
|
3
6
|
export declare type InputFieldDefinition = DefaultInputFieldDefinition | CodeInputFieldDefinition;
|
|
4
|
-
|
|
5
|
-
export interface DefaultInputFieldDefinition {
|
|
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,31 @@ export interface DefaultInputFieldDefinition {
|
|
|
22
22
|
/** Dictates possible choices for the input. */
|
|
23
23
|
model?: InputFieldChoice[];
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/** Defines attributes of a InputField. */
|
|
26
|
+
export interface DefaultInputFieldDefinition extends BaseInputFieldDefinition {
|
|
27
|
+
type: Exclude<InputFieldType, "code">;
|
|
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
|
+
export interface Connection {
|
|
39
|
+
/** Key of the Connection type. */
|
|
40
|
+
key: string;
|
|
41
|
+
/** Identifier for the Config Variable hosting this Connection. */
|
|
42
|
+
instanceConfigVarId: string;
|
|
43
|
+
/** Field values supplied to this Connection. */
|
|
44
|
+
fields: {
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
};
|
|
47
|
+
token?: Record<string, unknown>;
|
|
48
|
+
context?: Record<string, unknown>;
|
|
49
|
+
}
|
|
29
50
|
/** Defines a single Choice option for a InputField. */
|
|
30
51
|
export interface InputFieldChoice {
|
|
31
52
|
/** Label to display for this Choice. */
|
|
@@ -35,3 +56,4 @@ export interface InputFieldChoice {
|
|
|
35
56
|
}
|
|
36
57
|
/** InputField collection enumeration */
|
|
37
58
|
export declare type InputFieldCollection = "valuelist" | "keyvaluelist";
|
|
59
|
+
export {};
|
package/dist/types/Inputs.js
CHANGED
|
@@ -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,
|
|
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. */
|
|
@@ -20,7 +20,7 @@ export interface TriggerPayload {
|
|
|
20
20
|
};
|
|
21
21
|
/** The optional API keys assigned to the flows of this integration. These may be unique per integration instance and per flow. */
|
|
22
22
|
webhookApiKeys: {
|
|
23
|
-
[key: string]: string;
|
|
23
|
+
[key: string]: string[];
|
|
24
24
|
};
|
|
25
25
|
customer: {
|
|
26
26
|
externalId: string | null;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
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";
|
|
7
|
+
export * from "./ConnectionDefinition";
|
|
8
8
|
export * from "./Inputs";
|
|
9
9
|
export * from "./ActionPerformReturn";
|
|
10
10
|
export * from "./DisplayDefinition";
|
package/dist/types/index.js
CHANGED
|
@@ -27,9 +27,9 @@ 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);
|
|
32
|
+
__exportStar(require("./ConnectionDefinition"), exports);
|
|
33
33
|
__exportStar(require("./Inputs"), exports);
|
|
34
34
|
__exportStar(require("./ActionPerformReturn"), exports);
|
|
35
35
|
__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<
|
|
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?:
|
|
21
|
+
public?: TPublic;
|
|
22
22
|
/** Defines how the Component is displayed in the Prismatic interface. */
|
|
23
|
-
display: ComponentDisplayDefinition<
|
|
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?: Connection[];
|
|
30
30
|
}
|
|
31
|
-
export declare type Component<
|
|
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. */
|
|
@@ -74,6 +72,16 @@ export interface Trigger extends BaseAction {
|
|
|
74
72
|
/** Specifies if this Trigger appears in the list of 'common' Triggers. Only configurable by Prismatic. @default false */
|
|
75
73
|
isCommonTrigger?: boolean;
|
|
76
74
|
}
|
|
75
|
+
export interface Connection {
|
|
76
|
+
key: string;
|
|
77
|
+
label: string;
|
|
78
|
+
comments?: string;
|
|
79
|
+
oauth2Type?: OAuth2Type;
|
|
80
|
+
iconPath?: string;
|
|
81
|
+
inputs: (InputField & {
|
|
82
|
+
shown?: boolean;
|
|
83
|
+
})[];
|
|
84
|
+
}
|
|
77
85
|
/** Collection of input parameters provided by the user or previous steps' outputs */
|
|
78
86
|
interface ActionInputParameters {
|
|
79
87
|
[key: string]: unknown;
|
|
@@ -147,7 +155,7 @@ interface CodeInputField extends DefaultInputField {
|
|
|
147
155
|
language?: string;
|
|
148
156
|
}
|
|
149
157
|
/** InputField type enumeration. */
|
|
150
|
-
export declare type InputFieldType = "string" | "text" | "password" | "boolean" | "code" | "data" | "conditional";
|
|
158
|
+
export declare type InputFieldType = "string" | "text" | "password" | "boolean" | "code" | "data" | "conditional" | "connection";
|
|
151
159
|
/** Binary data payload */
|
|
152
160
|
export interface DataPayload {
|
|
153
161
|
/** Raw binary data as a Buffer */
|
package/package.json
CHANGED
|
@@ -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
|
-
}
|
package/dist/types/Credential.js
DELETED
|
@@ -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 });
|