@prismatic-io/spectral 8.1.0-preview3 → 8.1.0-preview4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/testing.d.ts CHANGED
@@ -7,6 +7,8 @@
7
7
  import { TriggerPayload, TriggerResult, ConnectionValue, ActionLogger, Component, ActionContext, ActionPerformReturn, DataSourceResult, DataSourceContext } from "./serverTypes";
8
8
  import { ConnectionDefinition, ActionDefinition, TriggerDefinition, Inputs, ActionInputParameters, DataSourceDefinition, ActionPerformReturn as InvokeActionPerformReturn, TriggerResult as InvokeTriggerResult, DataSourceResult as InvokeDataSourceResult, TriggerEventFunctionReturn, Flow, ConfigVarResultCollection, ConfigPages, ComponentSelector } from "./types";
9
9
  export declare const createConnection: <T extends ConnectionDefinition>({ key }: T, values: Record<string, unknown>, tokenValues?: Record<string, unknown> | undefined) => ConnectionValue;
10
+ export declare const defaultConnectionValueEnvironmentVariable = "PRISMATIC_CONNECTION_VALUE";
11
+ export declare const connectionValue: (envVarKey?: string) => ConnectionValue;
10
12
  /**
11
13
  * Pre-built mock of ActionLogger. Suitable for asserting logs are created as expected.
12
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.
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.createConnection = void 0;
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;
19
19
  const jest_mock_1 = require("jest-mock");
20
20
  const createConnection = ({ key }, values, tokenValues) => ({
21
21
  configVarKey: "",
@@ -24,6 +24,16 @@ const createConnection = ({ key }, values, tokenValues) => ({
24
24
  token: tokenValues,
25
25
  });
26
26
  exports.createConnection = createConnection;
27
+ exports.defaultConnectionValueEnvironmentVariable = "PRISMATIC_CONNECTION_VALUE";
28
+ const connectionValue = (envVarKey = exports.defaultConnectionValueEnvironmentVariable) => {
29
+ const value = process.env[envVarKey];
30
+ if (!value) {
31
+ throw new Error("Unable to find connection value.");
32
+ }
33
+ const result = Object.assign(Object.assign({}, JSON.parse(value)), { key: "" });
34
+ return result;
35
+ };
36
+ exports.connectionValue = connectionValue;
27
37
  /**
28
38
  * Pre-built mock of ActionLogger. Suitable for asserting logs are created as expected.
29
39
  * 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "8.1.0-preview3",
3
+ "version": "8.1.0-preview4",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"