@prismatic-io/spectral 7.2.0 → 7.3.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/dist/serverTypes/index.d.ts +4 -0
- package/dist/testing.js +1 -0
- package/dist/types/ActionPerformFunction.d.ts +3 -1
- package/dist/types/ActionPerformReturn.d.ts +2 -0
- package/dist/types/TriggerResult.d.ts +2 -0
- package/dist/util.d.ts +14 -3
- package/dist/util.js +25 -5
- package/package.json +1 -1
|
@@ -49,6 +49,7 @@ export interface ActionContext {
|
|
|
49
49
|
instanceState: Record<string, unknown>;
|
|
50
50
|
crossFlowState: Record<string, unknown>;
|
|
51
51
|
executionState: Record<string, unknown>;
|
|
52
|
+
integrationState: Record<string, unknown>;
|
|
52
53
|
stepId: string;
|
|
53
54
|
executionId: string;
|
|
54
55
|
webhookUrls: Record<string, string>;
|
|
@@ -89,6 +90,7 @@ interface TriggerBaseResult {
|
|
|
89
90
|
instanceState?: Record<string, unknown>;
|
|
90
91
|
crossFlowState?: Record<string, unknown>;
|
|
91
92
|
executionState?: Record<string, unknown>;
|
|
93
|
+
integrationState?: Record<string, unknown>;
|
|
92
94
|
failed?: boolean;
|
|
93
95
|
error?: Record<string, unknown>;
|
|
94
96
|
}
|
|
@@ -169,6 +171,7 @@ interface ServerPerformDataStructureReturn {
|
|
|
169
171
|
instanceState?: Record<string, unknown>;
|
|
170
172
|
crossFlowState?: Record<string, unknown>;
|
|
171
173
|
executionState?: Record<string, unknown>;
|
|
174
|
+
integrationState?: Record<string, unknown>;
|
|
172
175
|
failed?: boolean;
|
|
173
176
|
error?: Record<string, unknown>;
|
|
174
177
|
}
|
|
@@ -179,6 +182,7 @@ interface ServerPerformDataReturn {
|
|
|
179
182
|
instanceState?: Record<string, unknown>;
|
|
180
183
|
crossFlowState?: Record<string, unknown>;
|
|
181
184
|
executionState?: Record<string, unknown>;
|
|
185
|
+
integrationState?: Record<string, unknown>;
|
|
182
186
|
failed?: boolean;
|
|
183
187
|
error?: Record<string, unknown>;
|
|
184
188
|
}
|
package/dist/testing.js
CHANGED
|
@@ -7,10 +7,12 @@ export interface ActionContext {
|
|
|
7
7
|
logger: ActionLogger;
|
|
8
8
|
/** A a flow-specific key/value store that may be used to store small amounts of data that is persisted between Instance executions */
|
|
9
9
|
instanceState: Record<string, unknown>;
|
|
10
|
-
/**
|
|
10
|
+
/** A key/value store that is shared between flows on an Instance that may be used to store small amounts of data that is persisted between Instance executions */
|
|
11
11
|
crossFlowState: Record<string, unknown>;
|
|
12
12
|
/** A key/value store that may be used to store small amounts of data for use later during the execution */
|
|
13
13
|
executionState: Record<string, unknown>;
|
|
14
|
+
/** A key/value store that is shared between all flows of an Instance for any version of an Integration that may be used to store small amounts of data that is persisted between Instance executions */
|
|
15
|
+
integrationState: Record<string, unknown>;
|
|
14
16
|
/** A unique id that corresponds to the step on the Integration */
|
|
15
17
|
stepId: string;
|
|
16
18
|
/** A unique id that corresponds to the specific execution of the Integration */
|
|
@@ -12,6 +12,8 @@ export interface ActionPerformDataReturn<ReturnData> {
|
|
|
12
12
|
crossFlowState?: Record<string, unknown>;
|
|
13
13
|
/** An optional object, the keys and values of which will be persisted in the executionState and available for the duration of the execution */
|
|
14
14
|
executionState?: Record<string, unknown>;
|
|
15
|
+
/** An optional object, the keys and values of which will be persisted in the integrationState and available in any flow of an Instance for any version of an Integration for subsequent actions and executions */
|
|
16
|
+
integrationState?: Record<string, unknown>;
|
|
15
17
|
/** A field populated by the Prismatic platform which indicates whether the action failed with an error during execution. */
|
|
16
18
|
failed?: boolean;
|
|
17
19
|
/** A field populated by the Prismatic platform which may refer to an object that contains data about any error that resulted in failure. */
|
|
@@ -12,6 +12,8 @@ export interface TriggerBaseResult {
|
|
|
12
12
|
crossFlowState?: Record<string, unknown>;
|
|
13
13
|
/** An optional object, the keys and values of which will be persisted in the executionState and available for the duration of the execution */
|
|
14
14
|
executionState?: Record<string, unknown>;
|
|
15
|
+
/** An optional object, the keys and values of which will be persisted in the integrationState and available in any flow of an Instance for any version of an Integration for subsequent actions and executions */
|
|
16
|
+
integrationState?: Record<string, unknown>;
|
|
15
17
|
/** A field populated by the Prismatic platform which indicates whether the trigger failed with an error during execution. */
|
|
16
18
|
failed?: boolean;
|
|
17
19
|
/** A field populated by the Prismatic platform which may refer to an object that contains data about any error that resulted in failure. */
|
package/dist/util.d.ts
CHANGED
|
@@ -7,13 +7,23 @@ import { KeyValuePair, DataPayload, ObjectSelection, ObjectFieldMap, JSONForm, C
|
|
|
7
7
|
/**
|
|
8
8
|
* This function returns a lower cased version of the headers passed to it.
|
|
9
9
|
*
|
|
10
|
-
* - `lowerCaseHeaders({"Content-Type": "Application/JSON"}) will return {"content-type": "Application/JSON"}`
|
|
11
|
-
* - `lowerCaseHeaders({"Cache-Control": "max-age=604800"}) will return {"cache-control": "max-age=604800"}`
|
|
12
|
-
* - `lowerCaseHeaders({"Accept-Language": "en-us"}) will return {"accept-language": "en-us"}`
|
|
10
|
+
* - `lowerCaseHeaders({"Content-Type": "Application/JSON"})` will return `{"content-type": "Application/JSON"}`
|
|
11
|
+
* - `lowerCaseHeaders({"Cache-Control": "max-age=604800"})` will return `{"cache-control": "max-age=604800"}`
|
|
12
|
+
* - `lowerCaseHeaders({"Accept-Language": "en-us"})` will return `{"accept-language": "en-us"}`
|
|
13
13
|
* @param headers The headers to convert to lower case
|
|
14
14
|
* @returns This function returns a header object
|
|
15
15
|
* */
|
|
16
16
|
export declare const lowerCaseHeaders: (headers: Record<string, string>) => Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* This function parses a JSON string (if JSON) and returns an object, or returns the object.
|
|
19
|
+
*
|
|
20
|
+
* - `toObject('{"foo":"bar","baz":123}')` will return object `{foo: "bar", baz: 123}`
|
|
21
|
+
* - `toObject({foo:"bar",baz:123})` will return object `{foo: "bar", baz: 123}`
|
|
22
|
+
*
|
|
23
|
+
* @param value The JSON string or object to convert
|
|
24
|
+
* @returns This function returns an object, parsing JSON as necessary
|
|
25
|
+
*/
|
|
26
|
+
export declare const toObject: (value: unknown) => object;
|
|
17
27
|
declare const _default: {
|
|
18
28
|
types: {
|
|
19
29
|
isBool: (value: unknown) => value is boolean;
|
|
@@ -47,6 +57,7 @@ declare const _default: {
|
|
|
47
57
|
isSchedule: (value: unknown) => boolean;
|
|
48
58
|
isConnection: (value: unknown) => value is ConnectionDefinition;
|
|
49
59
|
isElement: (value: unknown) => value is Element;
|
|
60
|
+
toObject: (value: unknown) => object;
|
|
50
61
|
};
|
|
51
62
|
};
|
|
52
63
|
export default _default;
|
package/dist/util.js
CHANGED
|
@@ -8,7 +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
|
+
exports.toObject = exports.lowerCaseHeaders = void 0;
|
|
12
12
|
/** */
|
|
13
13
|
const parseISO_1 = __importDefault(require("date-fns/parseISO"));
|
|
14
14
|
const isValid_1 = __importDefault(require("date-fns/isValid"));
|
|
@@ -449,7 +449,8 @@ const isJSON = (value) => {
|
|
|
449
449
|
return false;
|
|
450
450
|
}
|
|
451
451
|
};
|
|
452
|
-
/**
|
|
452
|
+
/**
|
|
453
|
+
* This function accepts an arbitrary object/value and safely serializes it (handles cyclic references).
|
|
453
454
|
*
|
|
454
455
|
* @param value Arbitrary object/value to serialize.
|
|
455
456
|
* @returns JSON serialized text that can be safely logged.
|
|
@@ -461,9 +462,9 @@ const toJSON = (value) => {
|
|
|
461
462
|
/**
|
|
462
463
|
* This function returns a lower cased version of the headers passed to it.
|
|
463
464
|
*
|
|
464
|
-
* - `lowerCaseHeaders({"Content-Type": "Application/JSON"}) will return {"content-type": "Application/JSON"}`
|
|
465
|
-
* - `lowerCaseHeaders({"Cache-Control": "max-age=604800"}) will return {"cache-control": "max-age=604800"}`
|
|
466
|
-
* - `lowerCaseHeaders({"Accept-Language": "en-us"}) will return {"accept-language": "en-us"}`
|
|
465
|
+
* - `lowerCaseHeaders({"Content-Type": "Application/JSON"})` will return `{"content-type": "Application/JSON"}`
|
|
466
|
+
* - `lowerCaseHeaders({"Cache-Control": "max-age=604800"})` will return `{"cache-control": "max-age=604800"}`
|
|
467
|
+
* - `lowerCaseHeaders({"Accept-Language": "en-us"})` will return `{"accept-language": "en-us"}`
|
|
467
468
|
* @param headers The headers to convert to lower case
|
|
468
469
|
* @returns This function returns a header object
|
|
469
470
|
* */
|
|
@@ -471,6 +472,24 @@ const lowerCaseHeaders = (headers) => Object.entries(headers).reduce((result, [k
|
|
|
471
472
|
return Object.assign(Object.assign({}, result), { [key.toLowerCase()]: val });
|
|
472
473
|
}, {});
|
|
473
474
|
exports.lowerCaseHeaders = lowerCaseHeaders;
|
|
475
|
+
/**
|
|
476
|
+
* This function parses a JSON string (if JSON) and returns an object, or returns the object.
|
|
477
|
+
*
|
|
478
|
+
* - `toObject('{"foo":"bar","baz":123}')` will return object `{foo: "bar", baz: 123}`
|
|
479
|
+
* - `toObject({foo:"bar",baz:123})` will return object `{foo: "bar", baz: 123}`
|
|
480
|
+
*
|
|
481
|
+
* @param value The JSON string or object to convert
|
|
482
|
+
* @returns This function returns an object, parsing JSON as necessary
|
|
483
|
+
*/
|
|
484
|
+
const toObject = (value) => {
|
|
485
|
+
if (typeof value === "string" && isJSON(value)) {
|
|
486
|
+
return JSON.parse(value);
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
return value;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
exports.toObject = toObject;
|
|
474
493
|
exports.default = {
|
|
475
494
|
types: {
|
|
476
495
|
isBool,
|
|
@@ -504,5 +523,6 @@ exports.default = {
|
|
|
504
523
|
isSchedule,
|
|
505
524
|
isConnection,
|
|
506
525
|
isElement,
|
|
526
|
+
toObject: exports.toObject,
|
|
507
527
|
},
|
|
508
528
|
};
|