@prismatic-io/spectral 7.6.7 → 7.7.0

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.
@@ -117,12 +117,19 @@ const evaluate = (expression) => {
117
117
  const [operator] = expression;
118
118
  if (operator in types_1.BooleanOperator) {
119
119
  const predicates = expression.slice(1);
120
- const results = predicates.map(exports.evaluate);
121
120
  switch (operator) {
122
121
  case types_1.BooleanOperator.and:
123
- return results.reduce((previous, current) => previous && current, true);
122
+ for (const predicate of predicates) {
123
+ if (!(0, exports.evaluate)(predicate))
124
+ return false;
125
+ }
126
+ return true;
124
127
  case types_1.BooleanOperator.or:
125
- return results.reduce((previous, current) => previous || current, false);
128
+ for (const predicate of predicates) {
129
+ if ((0, exports.evaluate)(predicate))
130
+ return true;
131
+ }
132
+ return false;
126
133
  default:
127
134
  throw new Error(`Invalid operator: '${operator}'`);
128
135
  }
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ import { convertComponent } from "./serverTypes/convert";
13
13
  * @param definition A ComponentDefinition type object, including display information, unique key, and a set of actions the component implements.
14
14
  * @returns This function returns a component object that has the shape the Prismatic API expects.
15
15
  */
16
- export declare const component: <T extends boolean>(definition: ComponentDefinition<T>) => ReturnType<typeof convertComponent>;
16
+ export declare const component: <TPublic extends boolean, TKey extends string>(definition: ComponentDefinition<TPublic, TKey>) => ReturnType<typeof convertComponent>;
17
17
  /**
18
18
  * This function creates an action object that can be referenced
19
19
  * by a custom component. It helps ensure that the shape of the
@@ -1,3 +1,3 @@
1
1
  import { ComponentDefinition } from "../types";
2
2
  import { Component as ServerComponent } from ".";
3
- export declare const convertComponent: <TPublic extends boolean>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic>) => ServerComponent;
3
+ export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
@@ -5,9 +5,9 @@ export interface ComponentHooks {
5
5
  error?: ErrorHandler;
6
6
  }
7
7
  /** Defines attributes of a Component. */
8
- export declare type ComponentDefinition<TPublic extends boolean> = {
8
+ export declare type ComponentDefinition<TPublic extends boolean, TKey extends string> = {
9
9
  /** Specifies unique key for this Component. */
10
- key: string;
10
+ key: TKey;
11
11
  /** Specifies if this Component is available for all Organizations or only your own @default false */
12
12
  public?: TPublic;
13
13
  /** Defines how the Component is displayed in the Prismatic interface. */
@@ -24,7 +24,7 @@ export declare type ComponentDefinition<TPublic extends boolean> = {
24
24
  hooks?: ComponentHooks;
25
25
  } & (TPublic extends true ? {
26
26
  /** Specified the URL for the Component Documentation. */
27
- documentationUrl: string;
27
+ documentationUrl: `https://prismatic.io/docs/components/${TKey}/`;
28
28
  } : {
29
29
  documentationUrl?: string;
30
30
  });
@@ -134,8 +134,8 @@ export interface CodeInputField extends BaseInputField {
134
134
  collection?: InputFieldCollection;
135
135
  /** Default value for this field. */
136
136
  default?: unknown;
137
- /** Code language of this field. */
138
- language?: string;
137
+ /** Code language for syntax highlighting. For no syntax highlighting, choose "plaintext" */
138
+ language: "css" | "graphql" | "handlebars" | "hcl" | "html" | "javascript" | "json" | "liquid" | "markdown" | "mysql" | "pgsql" | "plaintext" | "sql" | "typescript" | "xml" | "yaml";
139
139
  /** Dictates possible choices for the input. */
140
140
  model?: InputFieldChoice[];
141
141
  /** Clean function */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "7.6.7",
3
+ "version": "7.7.0",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"