@prismatic-io/spectral 5.0.0-rc.1 → 5.0.0-rc.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.
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * Both component author-facing types and server types that
8
8
  * the Prismatic API expects are imported here.
9
9
  */
10
- import { ActionDefinition, InputFieldDefinition, ActionPerformReturn, ComponentDefinition, ConnectionDefinition, Inputs, TriggerDefinition, TriggerResult } from "./types";
10
+ import { ActionDefinition, InputFieldDefinition, ActionPerformReturn, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, TriggerResult } from "./types";
11
11
  import { Component } from "./types/server-types";
12
12
  /**
13
13
  * This function creates a component object that can be
@@ -49,10 +49,17 @@ export declare const input: <T extends InputFieldDefinition>(definition: T) => T
49
49
  /**
50
50
  * For information on writing custom component connections, see
51
51
  * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
52
- * @param definition A ConnectionfieldDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
52
+ * @param definition A DefaultConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
53
53
  * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
54
54
  */
55
- export declare const connection: <T extends ConnectionDefinition>(definition: T) => T;
55
+ export declare const connection: <T extends DefaultConnectionDefinition>(definition: T) => T;
56
+ /**
57
+ * For information on writing custom component connections, see
58
+ * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
59
+ * @param definition An OAuth2ConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
60
+ * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
61
+ */
62
+ export declare const oauth2Connection: <T extends OAuth2ConnectionDefinition>(definition: T) => T;
56
63
  export { default as util } from "./util";
57
64
  export * from "./types";
58
65
  export { default as testing } from "./testing";
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.testing = exports.util = exports.connection = exports.input = exports.trigger = exports.action = exports.component = void 0;
21
+ exports.testing = exports.util = exports.oauth2Connection = exports.connection = exports.input = exports.trigger = exports.action = exports.component = void 0;
22
22
  const convertInput = (key, input) => (Object.assign(Object.assign({}, input), { key }));
23
23
  /**
24
24
  * This is a helper function for component() to convert an
@@ -98,11 +98,19 @@ exports.input = input;
98
98
  /**
99
99
  * For information on writing custom component connections, see
100
100
  * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
101
- * @param definition A ConnectionfieldDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
101
+ * @param definition A DefaultConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
102
102
  * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
103
103
  */
104
104
  const connection = (definition) => definition;
105
105
  exports.connection = connection;
106
+ /**
107
+ * For information on writing custom component connections, see
108
+ * https://prismatic.io/docs/custom-components/writing-custom-components/#adding-connections.
109
+ * @param definition An OAuth2ConnectionDefinition object that describes the type of a connection for a custom component action or trigger, and information on how it should be displayed in the Prismatic WebApp.
110
+ * @returns This functions validates the shape of the `definition` object provided and returns the same connection object.
111
+ */
112
+ const oauth2Connection = (definition) => definition;
113
+ exports.oauth2Connection = oauth2Connection;
106
114
  var util_1 = require("./util");
107
115
  Object.defineProperty(exports, "util", { enumerable: true, get: function () { return __importDefault(util_1).default; } });
108
116
  __exportStar(require("./types"), exports);
@@ -1,9 +1,41 @@
1
- import { ConnectionInputs, OAuth2Type } from ".";
2
- export interface ConnectionDefinition {
1
+ import { ConnectionInput } from ".";
2
+ export declare enum OAuth2Type {
3
+ ClientCredentials = "client_credentials",
4
+ AuthorizationCode = "authorization_code"
5
+ }
6
+ interface BaseConnectionDefinition {
3
7
  key: string;
4
8
  label: string;
5
9
  comments?: string;
6
- oauth2Type?: OAuth2Type;
7
10
  iconPath?: string;
8
- inputs: ConnectionInputs;
11
+ oauth2Type?: OAuth2Type;
12
+ }
13
+ export interface DefaultConnectionDefinition extends BaseConnectionDefinition {
14
+ inputs: {
15
+ [key: string]: ConnectionInput;
16
+ };
17
+ }
18
+ interface OAuth2AuthorizationCodeConnectionDefinition extends BaseConnectionDefinition {
19
+ oauth2Type: OAuth2Type.AuthorizationCode;
20
+ inputs: {
21
+ authorizeUrl: ConnectionInput;
22
+ tokenUrl: ConnectionInput;
23
+ scopes: ConnectionInput;
24
+ clientId: ConnectionInput;
25
+ clientSecret: ConnectionInput;
26
+ [key: string]: ConnectionInput;
27
+ };
28
+ }
29
+ interface OAuth2ClientCredentialConnectionDefinition extends BaseConnectionDefinition {
30
+ oauth2Type: OAuth2Type.ClientCredentials;
31
+ inputs: {
32
+ tokenUrl: ConnectionInput;
33
+ scopes: ConnectionInput;
34
+ clientId: ConnectionInput;
35
+ clientSecret: ConnectionInput;
36
+ [key: string]: ConnectionInput;
37
+ };
9
38
  }
39
+ export declare type OAuth2ConnectionDefinition = OAuth2AuthorizationCodeConnectionDefinition | OAuth2ClientCredentialConnectionDefinition;
40
+ export declare type ConnectionDefinition = DefaultConnectionDefinition | OAuth2AuthorizationCodeConnectionDefinition | OAuth2ClientCredentialConnectionDefinition;
41
+ export {};
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuth2Type = void 0;
4
+ var OAuth2Type;
5
+ (function (OAuth2Type) {
6
+ OAuth2Type["ClientCredentials"] = "client_credentials";
7
+ OAuth2Type["AuthorizationCode"] = "authorization_code";
8
+ })(OAuth2Type = exports.OAuth2Type || (exports.OAuth2Type = {}));
@@ -1,8 +1,8 @@
1
1
  import { InputFieldType } from ".";
2
2
  export declare type Inputs = Record<string, InputFieldDefinition>;
3
- export declare type ConnectionInputs = Record<string, DefaultInputFieldDefinition & {
3
+ export declare type ConnectionInput = DefaultInputFieldDefinition & {
4
4
  shown?: boolean;
5
- }>;
5
+ };
6
6
  export declare type InputFieldDefinition = DefaultInputFieldDefinition | CodeInputFieldDefinition;
7
7
  interface BaseInputFieldDefinition {
8
8
  /** Interface label of the InputField. */
@@ -31,10 +31,6 @@ export interface CodeInputFieldDefinition extends BaseInputFieldDefinition {
31
31
  type: Extract<InputFieldType, "code">;
32
32
  language?: string;
33
33
  }
34
- export declare enum OAuth2Type {
35
- ClientCredentials = "client_credentials",
36
- AuthorizationCode = "authorization_code"
37
- }
38
34
  export interface Connection {
39
35
  /** Key of the Connection type. */
40
36
  key: string;
@@ -1,8 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OAuth2Type = void 0;
4
- var OAuth2Type;
5
- (function (OAuth2Type) {
6
- OAuth2Type["ClientCredentials"] = "client_credentials";
7
- OAuth2Type["AuthorizationCode"] = "authorization_code";
8
- })(OAuth2Type = exports.OAuth2Type || (exports.OAuth2Type = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.0-rc.2",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"