@prismatic-io/spectral 10.3.1 → 10.3.3
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/LICENSE +1 -1
- package/README.md +24 -27
- package/dist/serverTypes/perform.js +1 -1
- package/dist/testing.d.ts +20 -3
- package/dist/testing.js +28 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://prismatic.io/favicon-48x48.png" />
|
|
3
|
+
<h1>@prismatic-io/spectral</h1>
|
|
4
|
+
</div>
|
|
2
5
|
|
|
3
|
-
This repository contains code for Prismatic's TypeScript library, `spectral`, which is used to build custom Prismatic
|
|
6
|
+
This repository contains code for Prismatic's TypeScript library, `spectral`, which is used to build custom Prismatic connectors and code-native integrations.
|
|
4
7
|
|
|
5
8
|
## Using Spectral
|
|
6
9
|
|
|
@@ -10,47 +13,41 @@ To install spectral, run:
|
|
|
10
13
|
npm install @prismatic-io/spectral
|
|
11
14
|
```
|
|
12
15
|
|
|
13
|
-
Please see our [documentation](https://prismatic.io/docs/custom-
|
|
16
|
+
Please see our [documentation](https://prismatic.io/docs/custom-connectors/) on writing and publishing custom connectors for Prismatic's platform.
|
|
14
17
|
|
|
15
18
|
## What is Prismatic?
|
|
16
19
|
|
|
17
|
-
Prismatic is the
|
|
20
|
+
Prismatic is the leading embedded iPaaS, enabling B2B SaaS teams to ship product integrations faster and with less dev time. The only embedded iPaaS that empowers both developers and non-developers with tools for the complete integration lifecycle, Prismatic includes low-code and code-native building options, deployment and management tooling, and self-serve customer tools.
|
|
18
21
|
|
|
19
|
-
Prismatic
|
|
22
|
+
Prismatic's unparalleled versatility lets teams deliver any integration from simple to complex in one powerful platform. SaaS companies worldwide, from startups to Fortune 500s, trust Prismatic to help connect their products to the other products their customers use.
|
|
20
23
|
|
|
21
24
|
With Prismatic, you can:
|
|
22
25
|
|
|
23
|
-
- Build
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- Run
|
|
29
|
-
-
|
|
26
|
+
- Build [integrations](https://prismatic.io/docs/integrations/) using our [intuitive low-code designer](https://prismatic.io/docs/integrations/low-code-integration-designer/) or [code-native](https://prismatic.io/docs/integrations/code-native/) approach in your preferred IDE
|
|
27
|
+
- Leverage pre-built [connectors](https://prismatic.io/docs/components/) for common integration tasks, or develop custom connectors using our TypeScript SDK
|
|
28
|
+
- Embed a native [integration marketplace](https://prismatic.io/docs/embed/) in your product for customer self-service
|
|
29
|
+
- Configure and deploy customer-specific integration instances with powerful configuration tools
|
|
30
|
+
- Support customers efficiently with comprehensive [logging, monitoring, and alerting](https://prismatic.io/docs/monitor-instances/)
|
|
31
|
+
- Run integrations in a secure, scalable infrastructure designed for B2B SaaS
|
|
32
|
+
- Customize the platform to fit your product, industry, and development workflows
|
|
30
33
|
|
|
31
34
|
## Who uses Prismatic?
|
|
32
35
|
|
|
33
|
-
Prismatic is for B2B
|
|
36
|
+
Prismatic is built for B2B software companies that need to provide integrations to their customers. Whether you're a growing SaaS startup or an established enterprise, Prismatic's platform scales with your integration needs.
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
Our platform is particularly powerful for teams serving specialized vertical markets. We provide the flexibility and tools to build exactly the integrations your customers need, regardless of the systems you're connecting to or how unique your integration requirements may be.
|
|
36
39
|
|
|
37
40
|
## What kind of integrations can you build using Prismatic?
|
|
38
41
|
|
|
39
|
-
Prismatic supports integrations
|
|
40
|
-
Teams use it to build integrations between applications of all kinds, SaaS or legacy, with or without a modern API, regardless of protocol or data format.
|
|
41
|
-
Here are some example use cases:
|
|
42
|
+
Prismatic supports integrations of any complexity - from simple data syncs to sophisticated, industry-specific solutions. Teams use it to build integrations between any type of system, whether modern SaaS or legacy with standard or custom protocols. Here are some example use cases:
|
|
42
43
|
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
44
|
+
- Connect your product with customers' ERPs, CRMs, and other business systems
|
|
45
|
+
- Process data from multiple sources with customer-specific transformation requirements
|
|
46
|
+
- Automate workflows with customizable triggers, actions, and schedules
|
|
47
|
+
- Handle complex authentication flows and data mapping scenarios
|
|
46
48
|
|
|
47
|
-
For information on the Prismatic platform, check out our [website](https://prismatic.io) and [docs](https://prismatic.io/docs).
|
|
48
|
-
|
|
49
|
-
## Building Spectral Locally
|
|
50
|
-
|
|
51
|
-
To build spectral locally, you'll need `yarn` and `node` installed.
|
|
52
|
-
Run `yarn build` to build the package, or `yarn pack` to build a tarball that can be used in custom components for testing changes to spectral.
|
|
49
|
+
For information on the Prismatic platform, check out our [website](https://prismatic.io/) and [docs](https://prismatic.io/docs/).
|
|
53
50
|
|
|
54
51
|
## License
|
|
55
52
|
|
|
56
|
-
This repository is
|
|
53
|
+
This repository is MIT licensed.
|
|
@@ -46,7 +46,7 @@ const createInvokeFlow = (context, options = {}) => {
|
|
|
46
46
|
return (flowName, data, config, source) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
47
|
var _a;
|
|
48
48
|
const sourceToUse = options.isCNI ? source : undefined;
|
|
49
|
-
return yield axios_1.default.post(context.webhookUrls[flowName], data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, ((_a = config === null || config === void 0 ? void 0 : config.headers) !== null && _a !== void 0 ? _a : {})), { "prismatic-invoked-by": formatExecutionFrameHeaders(context.executionFrame, sourceToUse) }) }));
|
|
49
|
+
return yield axios_1.default.post(context.webhookUrls[flowName], data, Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, ((_a = config === null || config === void 0 ? void 0 : config.headers) !== null && _a !== void 0 ? _a : {})), { "prismatic-invoked-by": formatExecutionFrameHeaders(context.executionFrame, sourceToUse), "prismatic-invoke-type": "Cross Flow" }) }));
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
exports.createInvokeFlow = createInvokeFlow;
|
package/dist/testing.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* information on unit testing, check out our docs:
|
|
5
5
|
* https://prismatic.io/docs/custom-components/writing-custom-components/#testing-a-component
|
|
6
6
|
*/
|
|
7
|
-
import { TriggerPayload, TriggerResult, ConnectionValue, ActionLogger, Component,
|
|
8
|
-
import { ActionContext, ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceType, DataSourceResult as InvokeDataSourceResult, TriggerEventFunctionReturn, Flow, ConfigVarResultCollection } from "./types";
|
|
7
|
+
import { ActionPerformReturn as ServerActionPerformReturn, TriggerPayload, TriggerResult, ConnectionValue, ActionLogger, Component, DataSourceResult, DataSourceContext } from "./serverTypes";
|
|
8
|
+
import { ActionContext, ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceType, DataSourceResult as InvokeDataSourceResult, TriggerEventFunctionReturn, Flow, ConfigVarResultCollection, ComponentManifest } from "./types";
|
|
9
9
|
export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>, tokenValues?: Record<string, unknown>) => ConnectionValue;
|
|
10
10
|
export declare const defaultConnectionValueEnvironmentVariable = "PRISMATIC_CONNECTION_VALUE";
|
|
11
11
|
export declare const connectionValue: (envVarKey?: string) => ConnectionValue;
|
|
@@ -14,6 +14,23 @@ export declare const connectionValue: (envVarKey?: string) => ConnectionValue;
|
|
|
14
14
|
* 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.
|
|
15
15
|
*/
|
|
16
16
|
export declare const loggerMock: () => ActionLogger;
|
|
17
|
+
/**
|
|
18
|
+
* Creates basic component mocks based on the CNI's component registry.
|
|
19
|
+
* You may pass mock overrides in the second argument, e.g.:
|
|
20
|
+
*
|
|
21
|
+
* createMockContextComponents(myManifest, {
|
|
22
|
+
* actions: {
|
|
23
|
+
* myComponentName: {
|
|
24
|
+
* myComponentAction: () => Promise.resolve({ data: "my test data "}),
|
|
25
|
+
* }
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
export declare const createMockContextComponents: <TMockAction extends () => Promise<any>>(registry: Record<string, {
|
|
30
|
+
actions: ComponentManifest["actions"];
|
|
31
|
+
}>, mocks?: {
|
|
32
|
+
actions: Record<string, Record<string, TMockAction>>;
|
|
33
|
+
}) => Record<string, Record<string, TMockAction>>;
|
|
17
34
|
/**
|
|
18
35
|
* The type of data returned by an `invoke()` function used for unit testing component actions and triggers.
|
|
19
36
|
*/
|
|
@@ -64,7 +81,7 @@ export declare class ComponentTestHarness<TComponent extends Component> {
|
|
|
64
81
|
trigger<TConfigVars extends ConfigVarResultCollection>(key: string, payload?: TriggerPayload, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<TriggerResult>;
|
|
65
82
|
triggerOnInstanceDeploy<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<TriggerEventFunctionReturn | void>;
|
|
66
83
|
triggerOnInstanceDelete<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<TriggerEventFunctionReturn | void>;
|
|
67
|
-
action<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<
|
|
84
|
+
action<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<ActionContext<TConfigVars>>): Promise<ServerActionPerformReturn>;
|
|
68
85
|
dataSource<TConfigVars extends ConfigVarResultCollection>(key: string, params?: Record<string, unknown>, context?: Partial<DataSourceContext<TConfigVars>>): Promise<DataSourceResult>;
|
|
69
86
|
}
|
|
70
87
|
export declare const createHarness: <TComponent extends Component>(component: TComponent) => ComponentTestHarness<TComponent>;
|
package/dist/testing.js
CHANGED
|
@@ -15,7 +15,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createHarness = exports.ComponentTestHarness = exports.invokeFlow = exports.invokeDataSource = exports.invokeTrigger = exports.defaultTriggerPayload = exports.invoke = exports.loggerMock = exports.connectionValue = exports.defaultConnectionValueEnvironmentVariable = exports.createConnection = void 0;
|
|
18
|
+
exports.createHarness = exports.ComponentTestHarness = exports.invokeFlow = exports.invokeDataSource = exports.invokeTrigger = exports.defaultTriggerPayload = exports.invoke = exports.createMockContextComponents = exports.loggerMock = exports.connectionValue = exports.defaultConnectionValueEnvironmentVariable = exports.createConnection = void 0;
|
|
19
19
|
const jest_mock_1 = require("jest-mock");
|
|
20
20
|
const createConnection = ({ key }, values, tokenValues) => ({
|
|
21
21
|
configVarKey: "",
|
|
@@ -53,6 +53,33 @@ function invokeFlowTest(flowName, data, config) {
|
|
|
53
53
|
return Promise.resolve({});
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates basic component mocks based on the CNI's component registry.
|
|
58
|
+
* You may pass mock overrides in the second argument, e.g.:
|
|
59
|
+
*
|
|
60
|
+
* createMockContextComponents(myManifest, {
|
|
61
|
+
* actions: {
|
|
62
|
+
* myComponentName: {
|
|
63
|
+
* myComponentAction: () => Promise.resolve({ data: "my test data "}),
|
|
64
|
+
* }
|
|
65
|
+
* },
|
|
66
|
+
* });
|
|
67
|
+
*/
|
|
68
|
+
const createMockContextComponents = (registry, mocks = { actions: {} }) => {
|
|
69
|
+
const components = Object.keys(registry).reduce((accum, componentKey) => {
|
|
70
|
+
var _a;
|
|
71
|
+
const mockActions = Object.keys(registry[componentKey].actions).reduce((actionAccum, actionKey) => {
|
|
72
|
+
actionAccum[actionKey] = (() => {
|
|
73
|
+
return Promise.resolve({ data: null });
|
|
74
|
+
});
|
|
75
|
+
return actionAccum;
|
|
76
|
+
}, {});
|
|
77
|
+
accum[componentKey] = Object.assign(Object.assign({}, mockActions), ((_a = mocks.actions[componentKey]) !== null && _a !== void 0 ? _a : {}));
|
|
78
|
+
return accum;
|
|
79
|
+
}, {});
|
|
80
|
+
return components;
|
|
81
|
+
};
|
|
82
|
+
exports.createMockContextComponents = createMockContextComponents;
|
|
56
83
|
const createActionContext = (context) => {
|
|
57
84
|
return Object.assign({ logger: (0, exports.loggerMock)(), instanceState: {}, crossFlowState: {}, executionState: {}, integrationState: {}, configVars: {}, components: {}, stepId: "mockStepId", executionId: "mockExecutionId", webhookUrls: {
|
|
58
85
|
"Flow 1": "https://example.com",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismatic-io/spectral",
|
|
3
|
-
"version": "10.3.
|
|
4
|
-
"description": "Utility library for building Prismatic
|
|
3
|
+
"version": "10.3.3",
|
|
4
|
+
"description": "Utility library for building Prismatic connectors and code-native integrations",
|
|
5
5
|
"keywords": ["prismatic"],
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|