@prismatic-io/spectral 9.0.1 → 9.0.2

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.
Files changed (68) hide show
  1. package/dist/clients/http/index.d.ts +2 -2
  2. package/dist/clients/http/index.js +5 -9
  3. package/dist/clients/http/inputs.js +2 -7
  4. package/dist/conditionalLogic/index.d.ts +1 -1
  5. package/dist/conditionalLogic/index.js +5 -10
  6. package/dist/conditionalLogic/types.d.ts +5 -5
  7. package/dist/conditionalLogic/types.js +3 -3
  8. package/dist/generators/componentManifest/cli.d.ts +0 -1
  9. package/dist/generators/componentManifest/cli.js +2 -8
  10. package/dist/generators/componentManifest/createActions.js +6 -6
  11. package/dist/generators/componentManifest/createConnections.js +6 -6
  12. package/dist/generators/componentManifest/createDataSources.js +6 -6
  13. package/dist/generators/componentManifest/createStaticFiles.js +6 -7
  14. package/dist/generators/componentManifest/createTriggers.js +6 -6
  15. package/dist/generators/componentManifest/docBlock.js +1 -3
  16. package/dist/generators/componentManifest/getImports.d.ts +1 -1
  17. package/dist/generators/componentManifest/getInputs.d.ts +4 -4
  18. package/dist/generators/componentManifest/getInputs.js +2 -3
  19. package/dist/generators/componentManifest/helpers.d.ts +1 -1
  20. package/dist/generators/componentManifest/index.js +1 -1
  21. package/dist/generators/componentManifest/templates/actions/action.ts.ejs +1 -1
  22. package/dist/generators/componentManifest/templates/connections/connection.ts.ejs +1 -1
  23. package/dist/generators/componentManifest/templates/dataSources/dataSource.ts.ejs +1 -1
  24. package/dist/generators/componentManifest/templates/partials/performArgs.ejs +1 -1
  25. package/dist/generators/componentManifest/templates/triggers/trigger.ts.ejs +1 -1
  26. package/dist/generators/utils/createDependencyImports.d.ts +1 -1
  27. package/dist/generators/utils/createDependencyImports.js +1 -1
  28. package/dist/generators/utils/createFlagHelpText.d.ts +1 -1
  29. package/dist/generators/utils/createFlagHelpText.js +1 -1
  30. package/dist/generators/utils/createTemplate.js +2 -2
  31. package/dist/generators/utils/getComponentSignatureWithPrism.js +1 -1
  32. package/dist/generators/utils/getFlagBooleanValue.d.ts +2 -2
  33. package/dist/generators/utils/getFlagBooleanValue.js +2 -2
  34. package/dist/generators/utils/getFlagStringValue.d.ts +2 -2
  35. package/dist/generators/utils/getFlagStringValue.js +2 -2
  36. package/dist/index.d.ts +2 -16
  37. package/dist/serverTypes/convertComponent.js +1 -3
  38. package/dist/serverTypes/convertIntegration.js +33 -42
  39. package/dist/serverTypes/index.d.ts +11 -12
  40. package/dist/serverTypes/index.js +1 -1
  41. package/dist/serverTypes/integration.d.ts +3 -3
  42. package/dist/serverTypes/perform.d.ts +3 -3
  43. package/dist/testing.d.ts +17 -45
  44. package/dist/testing.js +4 -4
  45. package/dist/types/ActionInputParameters.d.ts +2 -2
  46. package/dist/types/ActionLogger.d.ts +1 -1
  47. package/dist/types/ActionPerformFunction.d.ts +2 -2
  48. package/dist/types/ActionPerformReturn.d.ts +1 -1
  49. package/dist/types/ComponentDefinition.d.ts +2 -2
  50. package/dist/types/ComponentRegistry.d.ts +16 -23
  51. package/dist/types/ConfigPages.d.ts +4 -4
  52. package/dist/types/ConfigVars.d.ts +44 -131
  53. package/dist/types/ConnectionDefinition.d.ts +2 -2
  54. package/dist/types/ConnectionDefinition.js +2 -2
  55. package/dist/types/DataPayload.d.ts +0 -1
  56. package/dist/types/DataSourcePerformFunction.d.ts +2 -2
  57. package/dist/types/DataSourceResult.d.ts +5 -5
  58. package/dist/types/DisplayDefinition.d.ts +2 -2
  59. package/dist/types/Inputs.d.ts +22 -22
  60. package/dist/types/IntegrationDefinition.d.ts +7 -7
  61. package/dist/types/TriggerDefinition.d.ts +1 -1
  62. package/dist/types/TriggerEventFunction.d.ts +2 -2
  63. package/dist/types/TriggerPerformFunction.d.ts +1 -1
  64. package/dist/types/TriggerResult.d.ts +1 -1
  65. package/dist/types/utils.d.ts +3 -3
  66. package/dist/util.d.ts +6 -6
  67. package/dist/util.js +4 -11
  68. package/package.json +9 -20
@@ -1,6 +1,6 @@
1
1
  import { ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, TriggerPayload, ComponentRegistry, TriggerReference, ConfigVars, ConfigPages, UserLevelConfigPages, ValueExpression, ConfigVarExpression } from ".";
2
2
  /** Defines attributes of a Code-Native Integration. */
3
- export declare type IntegrationDefinition = {
3
+ export type IntegrationDefinition = {
4
4
  /** The unique name for this Integration. */
5
5
  name: string;
6
6
  /** Optional description for this Integration. */
@@ -74,7 +74,7 @@ export interface Flow<TTriggerPayload extends TriggerPayload = TriggerPayload> {
74
74
  }, false, ActionPerformReturn<false, unknown>>;
75
75
  }
76
76
  /** Defines attributes of a Preprocess Flow Configuration used by a Flow of an Integration. */
77
- export declare type PreprocessFlowConfig = {
77
+ export type PreprocessFlowConfig = {
78
78
  /** Name of the field in the data payload returned by the Preprocess Flow to use for a Flow Name. */
79
79
  flowNameField: string;
80
80
  /** Optional name of the field in the data payload returned by the Preprocess Flow to use for an External Customer Id. */
@@ -83,7 +83,7 @@ export declare type PreprocessFlowConfig = {
83
83
  externalCustomerUserIdField?: string;
84
84
  };
85
85
  /** Defines attributes of a Retry Configuration used by a Flow of an Integration. */
86
- export declare type RetryConfig = {
86
+ export type RetryConfig = {
87
87
  /** The maximum number of retry attempts. Must be between 0 and 10. */
88
88
  maxAttempts: number;
89
89
  /** The delay in minutes to wait between retry attempts. Must be between 0 and 60. */
@@ -94,7 +94,7 @@ export declare type RetryConfig = {
94
94
  uniqueRequestIdField?: string;
95
95
  };
96
96
  /** Defines attributes of a Step Error Configuration used to determine how to handle errors during Flow step execution. */
97
- export declare type StepErrorConfig = {
97
+ export type StepErrorConfig = {
98
98
  /** Defines the type of error handler. */
99
99
  errorHandlerType: StepErrorHandlerType;
100
100
  /** The maximum number of retry attempts. Must be between 0 and 5. */
@@ -107,8 +107,8 @@ export declare type StepErrorConfig = {
107
107
  ignoreFinalError?: boolean;
108
108
  };
109
109
  /** Choices of Endpoint Types that may be used by Instances of an Integration. */
110
- export declare type EndpointType = "flow_specific" | "instance_specific" | "shared_instance";
110
+ export type EndpointType = "flow_specific" | "instance_specific" | "shared_instance";
111
111
  /** Choices of Endpoint Security Types that may be used by endpoints of a Flow. */
112
- export declare type EndpointSecurityType = "unsecured" | "customer_optional" | "customer_required" | "organization";
112
+ export type EndpointSecurityType = "unsecured" | "customer_optional" | "customer_required" | "organization";
113
113
  /** Choices of Step Error Handlers that define the behavior when a step error occurs. */
114
- export declare type StepErrorHandlerType = "fail" | "ignore" | "retry";
114
+ export type StepErrorHandlerType = "fail" | "ignore" | "retry";
@@ -1,6 +1,6 @@
1
1
  import { ActionDisplayDefinition, TriggerPerformFunction, TriggerEventFunction, Inputs, TriggerResult, ConfigVarResultCollection, TriggerPayload } from ".";
2
2
  declare const optionChoices: readonly ["invalid", "valid", "required"];
3
- export declare type TriggerOptionChoice = typeof optionChoices[number];
3
+ export type TriggerOptionChoice = (typeof optionChoices)[number];
4
4
  export declare const TriggerOptionChoices: TriggerOptionChoice[];
5
5
  /**
6
6
  * TriggerDefinition is the type of the object that is passed in to `trigger` function to
@@ -1,5 +1,5 @@
1
1
  import { Inputs, ActionContext, ActionInputParameters, ConfigVarResultCollection } from ".";
2
- export declare type TriggerEventFunctionReturn = {
2
+ export type TriggerEventFunctionReturn = {
3
3
  /** An optional object, the keys and values of which will be persisted in the flow-specific instanceState and available for subsequent actions and executions */
4
4
  instanceState?: Record<string, unknown>;
5
5
  /** An optional object, the keys and values of which will be persisted in the crossFlowState and available in any flow for subsequent actions and executions */
@@ -10,4 +10,4 @@ export declare type TriggerEventFunctionReturn = {
10
10
  integrationState?: Record<string, unknown>;
11
11
  };
12
12
  /** Definition of the function to execute when a Trigger Event occurs. */
13
- export declare type TriggerEventFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection> = (context: ActionContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<void | TriggerEventFunctionReturn>;
13
+ export type TriggerEventFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection> = (context: ActionContext<TConfigVars>, params: ActionInputParameters<TInputs>) => Promise<TriggerEventFunctionReturn | void>;
@@ -1,3 +1,3 @@
1
1
  import { Inputs, TriggerResult, ActionInputParameters, ActionContext, TriggerPayload, ConfigVarResultCollection } from ".";
2
2
  /** Definition of the function to perform when a Trigger is invoked. */
3
- export declare type TriggerPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> = (context: ActionContext<TConfigVars>, payload: TriggerPayload, params: ActionInputParameters<TInputs>) => Promise<TResult>;
3
+ export type TriggerPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> = (context: ActionContext<TConfigVars>, payload: TriggerPayload, params: ActionInputParameters<TInputs>) => Promise<TResult>;
@@ -25,4 +25,4 @@ export interface TriggerBranchingResult<TPayload extends TriggerPayload> extends
25
25
  branch: string;
26
26
  }
27
27
  /** Required return type of all trigger perform functions */
28
- export declare type TriggerResult<AllowsBranching extends boolean | undefined, TPayload extends TriggerPayload> = (AllowsBranching extends true ? TriggerBranchingResult<TPayload> : TriggerBaseResult<TPayload>) | undefined;
28
+ export type TriggerResult<AllowsBranching extends boolean | undefined, TPayload extends TriggerPayload> = (AllowsBranching extends true ? TriggerBranchingResult<TPayload> : TriggerBaseResult<TPayload>) | undefined;
@@ -1,5 +1,5 @@
1
- export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
2
- export declare type Prettify<T> = {
1
+ export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
2
+ export type Prettify<T> = {
3
3
  [K in keyof T]: T[K];
4
4
  };
5
- export declare type ValueOf<T> = T[keyof T];
5
+ export type ValueOf<T> = T[keyof T];
package/dist/util.d.ts CHANGED
@@ -29,13 +29,13 @@ export declare const toObject: (value: unknown) => object;
29
29
  declare const _default: {
30
30
  types: {
31
31
  isBool: (value: unknown) => value is boolean;
32
- toBool: (value: unknown, defaultValue?: boolean | undefined) => boolean;
32
+ toBool: (value: unknown, defaultValue?: boolean) => boolean;
33
33
  isInt: (value: unknown) => value is number;
34
- toInt: (value: unknown, defaultValue?: number | undefined) => number;
34
+ toInt: (value: unknown, defaultValue?: number) => number;
35
35
  isNumber: (value: unknown) => boolean;
36
- toNumber: (value: unknown, defaultValue?: number | undefined) => number;
36
+ toNumber: (value: unknown, defaultValue?: number) => number;
37
37
  isBigInt: (value: unknown) => value is bigint;
38
- toBigInt: (value: unknown) => BigInt;
38
+ toBigInt: (value: unknown) => bigint;
39
39
  isDate: (value: unknown) => value is Date;
40
40
  toDate: (value: unknown) => Date;
41
41
  isUrl: (value: string) => boolean;
@@ -45,7 +45,7 @@ declare const _default: {
45
45
  toData: (value: unknown) => DataPayload;
46
46
  isString: (value: unknown) => value is string;
47
47
  toString: (value: unknown, defaultValue?: string) => string;
48
- keyValPairListToObject: <TValue = unknown>(kvpList: KeyValuePair<unknown>[], valueConverter?: ((value: unknown) => TValue) | undefined) => Record<string, TValue>;
48
+ keyValPairListToObject: <TValue = unknown>(kvpList: KeyValuePair<unknown>[], valueConverter?: (value: unknown) => TValue) => Record<string, TValue>;
49
49
  isJSON: (value: string) => boolean;
50
50
  toJSON: (value: unknown, prettyPrint?: boolean, retainKeyOrder?: boolean) => string;
51
51
  lowerCaseHeaders: (headers: Record<string, string>) => Record<string, string>;
@@ -60,7 +60,7 @@ declare const _default: {
60
60
  isConnection: (value: unknown) => value is ConnectionDefinition;
61
61
  isElement: (value: unknown) => value is Element;
62
62
  toObject: (value: unknown) => object;
63
- cleanObject: (obj: Record<string, unknown>, predicate?: ((v: any) => boolean) | undefined) => Record<string, unknown>;
63
+ cleanObject: (obj: Record<string, unknown>, predicate?: (v: any) => boolean) => Record<string, unknown>;
64
64
  };
65
65
  };
66
66
  export default _default;
package/dist/util.js CHANGED
@@ -44,8 +44,7 @@ const isObjectSelection = (value) => {
44
44
  if (typeof value === "string" && isJSON(value)) {
45
45
  return isObjectSelection(JSON.parse(value));
46
46
  }
47
- return (Array.isArray(value) &&
48
- value.every((item) => (0, exports.isObjectWithTruthyKeys)(item, ["object"])));
47
+ return Array.isArray(value) && value.every((item) => (0, exports.isObjectWithTruthyKeys)(item, ["object"]));
49
48
  };
50
49
  /**
51
50
  * This function coerces a provided value into an ObjectSelection if possible.
@@ -331,7 +330,7 @@ const keyValPairListToObject = (kvpList, valueConverter) => {
331
330
  * @param value The value to test
332
331
  * @returns This function returns true if `value` is a DataPayload object, and false otherwise.
333
332
  */
334
- const isBufferDataPayload = (value) => value instanceof Object && "data" in value && Buffer.isBuffer(value["data"]);
333
+ const isBufferDataPayload = (value) => value instanceof Object && "data" in value && Buffer.isBuffer(value.data);
335
334
  /**
336
335
  * Many libraries for third-party API that handle binary files expect `Buffer` objects.
337
336
  * This function helps to convert strings, Uint8Arrays, and Arrays to a data structure
@@ -428,16 +427,10 @@ const isConnection = (value) => {
428
427
  if (Boolean(value) && typeof value === "object") {
429
428
  const { inputs } = value;
430
429
  if ((0, exports.isObjectWithTruthyKeys)(value, ["key", "label", "oauth2Type"])) {
431
- return ((0, exports.isObjectWithTruthyKeys)(inputs, [
432
- "authorizeUrl",
433
- "tokenUrl",
434
- "clientId",
435
- "clientSecret",
436
- ]) ||
430
+ return ((0, exports.isObjectWithTruthyKeys)(inputs, ["authorizeUrl", "tokenUrl", "clientId", "clientSecret"]) ||
437
431
  (0, exports.isObjectWithTruthyKeys)(inputs, ["tokenUrl", "clientId", "clientSecret"]));
438
432
  }
439
- return ((0, exports.isObjectWithTruthyKeys)(value, ["key", "label"]) &&
440
- typeof inputs === "object");
433
+ return (0, exports.isObjectWithTruthyKeys)(value, ["key", "label"]) && typeof inputs === "object";
441
434
  }
442
435
  return false;
443
436
  };
package/package.json CHANGED
@@ -1,10 +1,8 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "9.0.1",
3
+ "version": "9.0.2",
4
4
  "description": "Utility library for building Prismatic components",
5
- "keywords": [
6
- "prismatic"
7
- ],
5
+ "keywords": ["prismatic"],
8
6
  "main": "dist/index.js",
9
7
  "types": "dist/index.d.ts",
10
8
  "homepage": "https://prismatic.io",
@@ -30,17 +28,15 @@
30
28
  "dev": "tsc -w",
31
29
  "postbuild": "yarn run build:templates",
32
30
  "prepack": "yarn run build",
33
- "format": "yarn run lint-fix && prettier --loglevel error --write 'src/**/*.ts' '*.{ts,js,json}' '!sidebars.{js,jse}'",
34
- "check-format": "prettier --check 'src/**/*.ts' '*.{ts,js,json}' '!sidebars.{js,jse}'",
31
+ "lint": "biome lint .",
32
+ "lint-fix": "biome lint --apply-unsafe .",
33
+ "format": "yarn run lint-fix && biome format --write .",
34
+ "check-format": "biome format .",
35
35
  "check": "yarn run check-format && yarn run lint",
36
- "lint": "eslint --ext .ts .",
37
- "lint-fix": "eslint --fix --ext .ts .",
38
36
  "test": "jest",
39
37
  "docs": "rm -f sidebars.{js,jse} && typedoc"
40
38
  },
41
- "files": [
42
- "dist/"
43
- ],
39
+ "files": ["dist/"],
44
40
  "dependencies": {
45
41
  "@jsonforms/core": "3.0.0",
46
42
  "axios": "1.6.2",
@@ -52,7 +48,6 @@
52
48
  "jest-mock": "29.7.0",
53
49
  "lodash": "4.17.21",
54
50
  "object-sizeof": "^2.6.4",
55
- "prettier": "2.6.2",
56
51
  "safe-stable-stringify": "2.3.1",
57
52
  "serialize-error": "8.1.0",
58
53
  "url-join": "5.0.0",
@@ -61,29 +56,23 @@
61
56
  "yaml": "2.3.4"
62
57
  },
63
58
  "devDependencies": {
59
+ "@biomejs/biome": "1.6.3",
64
60
  "@types/ejs": "3.1.5",
65
61
  "@types/fs-extra": "11.0.4",
66
62
  "@types/jest": "29.5.12",
67
63
  "@types/lodash": "4.17.0",
68
64
  "@types/node": "14.14.35",
69
- "@types/prettier": "2.6.2",
70
65
  "@types/sax": "1.2.4",
71
66
  "@types/url-join": "4.0.1",
72
67
  "@types/uuid": "8.3.4",
73
68
  "@types/valid-url": "1.0.3",
74
- "@typescript-eslint/eslint-plugin": "5.18.0",
75
- "@typescript-eslint/parser": "5.18.0",
76
69
  "copyfiles": "2.4.1",
77
- "eslint": "8.12.0",
78
- "eslint-config-prettier": "8.5.0",
79
- "eslint-plugin-jest": "27.9.0",
80
- "eslint-plugin-prettier": "4.0.0",
81
70
  "fast-check": "2.16.0",
82
71
  "jest": "29.7.0",
83
72
  "ts-jest": "29.1.2",
84
73
  "typedoc": "0.17.7",
85
74
  "typedoc-plugin-markdown": "2.4.2",
86
75
  "typedoc-plugin-remove-references": "0.0.5",
87
- "typescript": "4.6.3"
76
+ "typescript": "5.5.3"
88
77
  }
89
78
  }