@prismatic-io/spectral 9.0.0-rc.6 → 9.0.0-rc.8

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.
@@ -26,26 +26,7 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  var _a, _b;
27
27
  const componentDir = process.cwd();
28
28
  const componentDistDir = path_1.default.join(componentDir, "dist", "index.js");
29
- if (!componentDir) {
30
- console.error("Please run this script using npm or yarn.");
31
- process.exit(1);
32
- }
33
- if (!(0, fs_extra_1.existsSync)(componentDistDir)) {
34
- console.error("Component build directory `dist` does not exist. Please verify that the component has been built.");
35
- process.exit(1);
36
- }
37
- const component = require(componentDistDir).default;
38
- if (!component ||
39
- !(0, util_1.isObjectWithTruthyKeys)(component, ["key", "display"]) ||
40
- !(0, util_1.isObjectWithOneTruthyKey)(component, [
41
- "actions",
42
- "connections",
43
- "dataSources",
44
- ])) {
45
- console.error("Component is invalid.");
46
- process.exit(1);
47
- }
48
- const args = process.argv.slice(3);
29
+ const args = process.argv.slice(2);
49
30
  const flags = {
50
31
  name: {
51
32
  flag: ["--name", "-n"],
@@ -111,6 +92,25 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
111
92
  });
112
93
  process.exit(0);
113
94
  }
95
+ if (!componentDir) {
96
+ console.error("Please run this script using npm or yarn.");
97
+ process.exit(1);
98
+ }
99
+ if (!(0, fs_extra_1.existsSync)(componentDistDir)) {
100
+ console.error("Component build directory `dist` does not exist. Please verify that the component has been built.");
101
+ process.exit(1);
102
+ }
103
+ const component = require(componentDistDir).default;
104
+ if (!component ||
105
+ !(0, util_1.isObjectWithTruthyKeys)(component, ["key", "display"]) ||
106
+ !(0, util_1.isObjectWithOneTruthyKey)(component, [
107
+ "actions",
108
+ "connections",
109
+ "dataSources",
110
+ ])) {
111
+ console.error("Component is invalid.");
112
+ process.exit(1);
113
+ }
114
114
  const packageJson = (0, fs_extra_1.readJsonSync)(path_1.default.join(__dirname, "../../../package.json"));
115
115
  yield (0, index_1.createComponentManifest)({
116
116
  component,
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  interface CreateActionsProps {
3
3
  component: Component;
4
4
  dryRun: boolean;
@@ -18,11 +18,19 @@ const getInputs_1 = require("./getInputs");
18
18
  const getImports_1 = require("./getImports");
19
19
  const helpers_1 = require("./helpers");
20
20
  const createTemplate_1 = require("../utils/createTemplate");
21
- const DOCUMENT_PROPERTIES = [
22
- "comments",
23
- "default",
24
- "example",
25
- "placeholder",
21
+ const DOC_BLOCK = [
22
+ {
23
+ propertyKey: "comments",
24
+ },
25
+ {
26
+ propertyKey: "default",
27
+ },
28
+ {
29
+ propertyKey: "example",
30
+ },
31
+ {
32
+ propertyKey: "placeholder",
33
+ },
26
34
  ];
27
35
  const createActions = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () {
28
36
  var _a, _b;
@@ -43,7 +51,7 @@ const createActions = ({ component, dryRun, verbose, sourceDir, destinationDir,
43
51
  const actions = yield Promise.all(Object.entries((_b = component.actions) !== null && _b !== void 0 ? _b : {}).map(([actionKey, action]) => __awaiter(void 0, void 0, void 0, function* () {
44
52
  const inputs = (0, getInputs_1.getInputs)({
45
53
  inputs: action.inputs,
46
- documentProperties: DOCUMENT_PROPERTIES,
54
+ docBlock: DOC_BLOCK,
47
55
  });
48
56
  const imports = (0, getImports_1.getImports)({ inputs });
49
57
  return yield renderAction({
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  interface CreateConnectionsProps {
3
3
  component: Component;
4
4
  dryRun: boolean;
@@ -18,11 +18,29 @@ const getInputs_1 = require("./getInputs");
18
18
  const getImports_1 = require("./getImports");
19
19
  const helpers_1 = require("./helpers");
20
20
  const createTemplate_1 = require("../utils/createTemplate");
21
- const DOCUMENT_PROPERTIES = [
22
- "comments",
23
- "default",
24
- "example",
25
- "placeholder",
21
+ const DOC_BLOCK = [
22
+ {
23
+ propertyKey: "comments",
24
+ },
25
+ {
26
+ propertyKey: "default",
27
+ },
28
+ {
29
+ propertyKey: "example",
30
+ },
31
+ {
32
+ propertyKey: "placeholder",
33
+ },
34
+ {
35
+ propertyKey: "onPremControlled",
36
+ propertyValue: true,
37
+ output: "This input will be supplied when using an on prem resource.",
38
+ },
39
+ {
40
+ propertyKey: "onPremiseControlled",
41
+ propertyValue: true,
42
+ output: "This input will be supplied when using an on prem resource.",
43
+ },
26
44
  ];
27
45
  const createConnections = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () {
28
46
  var _a, _b;
@@ -43,15 +61,17 @@ const createConnections = ({ component, dryRun, verbose, sourceDir, destinationD
43
61
  const connections = yield Promise.all(((_b = component.connections) !== null && _b !== void 0 ? _b : []).map((connection) => __awaiter(void 0, void 0, void 0, function* () {
44
62
  const inputs = (0, getInputs_1.getInputs)({
45
63
  inputs: connection.inputs,
46
- documentProperties: DOCUMENT_PROPERTIES,
64
+ docBlock: DOC_BLOCK,
47
65
  });
48
66
  const imports = (0, getImports_1.getImports)({ inputs });
67
+ const onPremAvailable = connection.inputs.some((input) => input.onPremControlled || input.onPremiseControlled);
49
68
  return yield renderConnection({
50
69
  connection: {
51
70
  key: connection.key,
52
71
  label: connection.label,
53
72
  comments: connection.comments,
54
73
  inputs,
74
+ onPremAvailable,
55
75
  },
56
76
  imports,
57
77
  dryRun,
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  interface CreateDataSourcesProps {
3
3
  component: Component;
4
4
  dryRun: boolean;
@@ -18,11 +18,19 @@ const getInputs_1 = require("./getInputs");
18
18
  const getImports_1 = require("./getImports");
19
19
  const helpers_1 = require("./helpers");
20
20
  const createTemplate_1 = require("../utils/createTemplate");
21
- const DOCUMENT_PROPERTIES = [
22
- "comments",
23
- "default",
24
- "example",
25
- "placeholder",
21
+ const DOC_BLOCK = [
22
+ {
23
+ propertyKey: "comments",
24
+ },
25
+ {
26
+ propertyKey: "default",
27
+ },
28
+ {
29
+ propertyKey: "example",
30
+ },
31
+ {
32
+ propertyKey: "placeholder",
33
+ },
26
34
  ];
27
35
  const createDataSources = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () {
28
36
  var _a, _b;
@@ -43,7 +51,7 @@ const createDataSources = ({ component, dryRun, verbose, sourceDir, destinationD
43
51
  const dataSources = yield Promise.all(Object.entries((_b = component.dataSources) !== null && _b !== void 0 ? _b : {}).map(([dataSourceKey, dataSource]) => __awaiter(void 0, void 0, void 0, function* () {
44
52
  const inputs = (0, getInputs_1.getInputs)({
45
53
  inputs: dataSource.inputs,
46
- documentProperties: DOCUMENT_PROPERTIES,
54
+ docBlock: DOC_BLOCK,
47
55
  });
48
56
  const imports = (0, getImports_1.getImports)({ inputs });
49
57
  return yield renderDataSource({
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  export interface PackageDependencies {
3
3
  spectral: string;
4
4
  dependencies: Record<string, string>;
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  interface CreateTriggersProps {
3
3
  component: Component;
4
4
  dryRun: boolean;
@@ -18,11 +18,19 @@ const getInputs_1 = require("./getInputs");
18
18
  const getImports_1 = require("./getImports");
19
19
  const helpers_1 = require("./helpers");
20
20
  const createTemplate_1 = require("../utils/createTemplate");
21
- const DOCUMENT_PROPERTIES = [
22
- "comments",
23
- "default",
24
- "example",
25
- "placeholder",
21
+ const DOC_BLOCK = [
22
+ {
23
+ propertyKey: "comments",
24
+ },
25
+ {
26
+ propertyKey: "default",
27
+ },
28
+ {
29
+ propertyKey: "example",
30
+ },
31
+ {
32
+ propertyKey: "placeholder",
33
+ },
26
34
  ];
27
35
  const createTriggers = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () {
28
36
  var _a, _b;
@@ -43,7 +51,7 @@ const createTriggers = ({ component, dryRun, verbose, sourceDir, destinationDir,
43
51
  const triggers = yield Promise.all(Object.entries((_b = component.triggers) !== null && _b !== void 0 ? _b : {}).map(([triggerKey, trigger]) => __awaiter(void 0, void 0, void 0, function* () {
44
52
  const inputs = (0, getInputs_1.getInputs)({
45
53
  inputs: trigger.inputs,
46
- documentProperties: DOCUMENT_PROPERTIES,
54
+ docBlock: DOC_BLOCK,
47
55
  });
48
56
  const imports = (0, getImports_1.getImports)({ inputs });
49
57
  return yield renderTrigger({
@@ -1,4 +1,4 @@
1
- import { Input } from "./getInputs";
1
+ import type { Input } from "./getInputs";
2
2
  export declare type Imports = Record<string, string[]>;
3
3
  interface GetImportsProps {
4
4
  inputs: Input[];
@@ -1,5 +1,8 @@
1
- import { Input as ServerTypeInput } from "../../serverTypes";
2
- import { InputFieldDefinition } from "../../types/Inputs";
1
+ import type { Input as InputBase } from "../../serverTypes";
2
+ import type { InputFieldDefinition } from "../../types/Inputs";
3
+ declare type ServerTypeInput = InputBase & {
4
+ onPremControlled?: boolean;
5
+ };
3
6
  export interface Input {
4
7
  key: string;
5
8
  label: string;
@@ -14,10 +17,16 @@ export declare type InputType = string | {
14
17
  type: string;
15
18
  module: string;
16
19
  };
20
+ export declare type DocBlock = {
21
+ inputKey?: string;
22
+ propertyKey: keyof ServerTypeInput;
23
+ propertyValue?: unknown;
24
+ output?: string;
25
+ }[];
17
26
  interface GetInputsProps {
18
27
  inputs: ServerTypeInput[];
19
- documentProperties: (keyof ServerTypeInput)[];
28
+ docBlock: DocBlock;
20
29
  }
21
- export declare const getInputs: ({ inputs, documentProperties, }: GetInputsProps) => Input[];
30
+ export declare const getInputs: ({ inputs, docBlock }: GetInputsProps) => Input[];
22
31
  export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"], InputType>;
23
32
  export {};
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.INPUT_TYPE_MAP = exports.getInputs = void 0;
4
- const getInputs = ({ inputs, documentProperties, }) => {
4
+ const getInputs = ({ inputs, docBlock }) => {
5
5
  return inputs.map((input) => {
6
6
  return {
7
7
  key: input.key,
@@ -10,20 +10,36 @@ const getInputs = ({ inputs, documentProperties, }) => {
10
10
  required: input.required,
11
11
  collection: input.collection,
12
12
  inputType: input.type,
13
- properties: documentProperties.reduce((acc, key) => {
14
- const value = input[key]
15
- ? JSON.stringify(input[key])
16
- .replace(/(^"|"$)|(^'|'$)/g, "")
17
- .trim()
18
- : null;
19
- if (typeof value === "undefined" || value === null || value === "") {
13
+ onPremiseControlled: input.onPremiseControlled || input.onPremControlled,
14
+ properties: docBlock.reduce((acc, { propertyKey, inputKey, propertyValue, output }) => {
15
+ if (inputKey && inputKey !== input.key) {
16
+ return acc;
17
+ }
18
+ if (output &&
19
+ (input[propertyKey] === propertyValue ||
20
+ typeof propertyValue === "undefined")) {
21
+ return [
22
+ ...acc,
23
+ {
24
+ key: propertyKey,
25
+ value: output,
26
+ },
27
+ ];
28
+ }
29
+ if (typeof input[propertyKey] === "undefined" ||
30
+ input[propertyKey] === null ||
31
+ input[propertyKey] === "" ||
32
+ (typeof propertyValue !== "undefined" &&
33
+ input[propertyKey] !== propertyValue)) {
20
34
  return acc;
21
35
  }
22
36
  return [
23
37
  ...acc,
24
38
  {
25
- key,
26
- value,
39
+ key: propertyKey,
40
+ value: JSON.stringify(input[propertyKey])
41
+ .replace(/(^"|"$)|(^'|'$)/g, "")
42
+ .trim(),
27
43
  },
28
44
  ];
29
45
  }, []),
@@ -1,5 +1,5 @@
1
- import { PackageDependencies } from "./createStaticFiles";
2
- import { Component } from "../../serverTypes";
1
+ import { type PackageDependencies } from "./createStaticFiles";
2
+ import type { Component } from "../../serverTypes";
3
3
  interface CreateComponentManifestProps {
4
4
  component: Component;
5
5
  dryRun: boolean;
@@ -13,6 +13,9 @@ export const <%= connection.key %> = {
13
13
  perform: (
14
14
  _values: <%= helpers.capitalizeFirstLetter(connection.key) %>Values
15
15
  ): Promise<void> => Promise.resolve(),
16
+ <%_ if (connection.onPremAvailable) { -%>
17
+ onPremAvailable: true,
18
+ <%_ } -%>
16
19
  inputs: {
17
20
  <%- include('../partials/inputs.ejs', { inputs: connection.inputs }) -%>
18
21
  }
@@ -12,8 +12,8 @@
12
12
  <%_ if (input.required) { -%>
13
13
  required: <%= input.required %>,
14
14
  <%_ } -%>
15
- <%_ if (typeof input.onPremiseControlled !== "undefined") { -%>
16
- onPremiseControlled: <%= input.onPremiseControlled %>,
15
+ <%_ if (typeof input.onPremControlled !== "undefined") { -%>
16
+ onPremControlled: <%= input.onPremControlled %>,
17
17
  <%_ } -%>
18
18
  },
19
19
  <% }); -%>
@@ -1,4 +1,4 @@
1
- import { Imports } from "../componentManifest/getImports";
1
+ import type { Imports } from "../componentManifest/getImports";
2
2
  export interface CreateDependencyImportsProps {
3
3
  imports: Imports;
4
4
  }
@@ -31,34 +31,35 @@ const types_1 = require("../types");
31
31
  const convert_1 = require("./convert");
32
32
  const integration_1 = require("./integration");
33
33
  const convertIntegration = (definition) => {
34
- var _a;
34
+ var _a, _b;
35
35
  // Generate a unique reference key that will be used to reference the
36
36
  // actions, triggers, data sources, and connections that are created
37
37
  // inline as part of the integration definition.
38
38
  const referenceKey = (0, uuid_1.v4)();
39
- const configVars = Object.values((_a = definition.configPages) !== null && _a !== void 0 ? _a : {}).reduce((acc, configPage) => Object.entries(configPage.elements).reduce((acc, [key, element]) => {
39
+ const configVars = Object.values({
40
+ configPages: (_a = definition.configPages) !== null && _a !== void 0 ? _a : {},
41
+ userLevelConfigPages: (_b = definition.userLevelConfigPages) !== null && _b !== void 0 ? _b : {},
42
+ }).reduce((acc, configPages) => (Object.assign(Object.assign({}, acc), Object.values(configPages).reduce((acc, configPage) => Object.entries(configPage.elements).reduce((acc, [key, element]) => {
40
43
  // "string" elements are HTML elements and should be ignored.
41
44
  if (typeof element === "string") {
42
45
  return acc;
43
46
  }
44
47
  if (key in acc) {
45
- throw new Error('Duplicate config var key "' + key + '"');
48
+ throw new Error(`Duplicate config var key: "${key}"`);
46
49
  }
47
50
  return Object.assign(Object.assign({}, acc), { [key]: element });
48
- }, acc), {});
51
+ }, acc), {}))), {});
49
52
  const cniComponent = codeNativeIntegrationComponent(definition, referenceKey, configVars);
50
53
  const cniYaml = codeNativeIntegrationYaml(definition, referenceKey, configVars);
51
54
  return Object.assign(Object.assign({}, cniComponent), { codeNativeIntegrationYAML: cniYaml });
52
55
  };
53
56
  exports.convertIntegration = convertIntegration;
54
- const convertConfigPages = (pages) => {
57
+ const convertConfigPages = (pages, userLevelConfigured) => {
55
58
  if (!pages || !Object.keys(pages).length) {
56
- return;
59
+ return [];
57
60
  }
58
- return Object.entries(pages).map(([name, { tagline, elements }]) => ({
59
- name,
60
- tagline,
61
- elements: Object.entries(elements).map(([key, value]) => typeof value === "string"
61
+ return Object.entries(pages).map(([name, { tagline, elements }]) => (Object.assign(Object.assign({ name,
62
+ tagline }, (userLevelConfigured ? { userLevelConfigured } : {})), { elements: Object.entries(elements).map(([key, value]) => typeof value === "string"
62
63
  ? {
63
64
  type: "htmlElement",
64
65
  value,
@@ -66,10 +67,9 @@ const convertConfigPages = (pages) => {
66
67
  : {
67
68
  type: "configVar",
68
69
  value: key,
69
- }),
70
- }));
70
+ }) })));
71
71
  };
72
- const codeNativeIntegrationYaml = ({ name, description, category, documentation, version, labels, endpointType, triggerPreprocessFlowConfig, flows, configPages, componentRegistry = {}, }, referenceKey, configVars) => {
72
+ const codeNativeIntegrationYaml = ({ name, description, category, documentation, version, labels, endpointType, triggerPreprocessFlowConfig, flows, configPages, userLevelConfigPages, componentRegistry = {}, }, referenceKey, configVars) => {
73
73
  // Find the preprocess flow config on the flow, if one exists.
74
74
  const preprocessFlows = flows.filter((flow) => flow.preprocessFlowConfig);
75
75
  // Do some validation of preprocess flow configs.
@@ -110,7 +110,10 @@ const codeNativeIntegrationYaml = ({ name, description, category, documentation,
110
110
  externalCustomerUserIdField: fieldNameToReferenceInput(hasPreprocessFlow ? "onExecution" : "payload", preprocessFlowConfig === null || preprocessFlowConfig === void 0 ? void 0 : preprocessFlowConfig.externalCustomerUserIdField),
111
111
  flowNameField: fieldNameToReferenceInput(hasPreprocessFlow ? "onExecution" : "payload", preprocessFlowConfig === null || preprocessFlowConfig === void 0 ? void 0 : preprocessFlowConfig.flowNameField),
112
112
  flows: flows.map((flow) => convertFlow(flow, componentRegistry, referenceKey)),
113
- configPages: convertConfigPages(configPages !== null && configPages !== void 0 ? configPages : {}),
113
+ configPages: [
114
+ ...convertConfigPages(configPages, false),
115
+ ...convertConfigPages(userLevelConfigPages, true),
116
+ ],
114
117
  };
115
118
  return yaml_1.default.stringify(result);
116
119
  };
@@ -157,16 +160,17 @@ const convertConfigVarPermissionAndVisibility = ({ permissionAndVisibilityType,
157
160
  };
158
161
  };
159
162
  const convertComponentReference = (componentReference, componentRegistry) => {
160
- var _a, _b, _c;
163
+ var _a, _b;
164
+ const manifest = componentRegistry[componentReference.component];
161
165
  const ref = {
162
166
  component: {
163
- key: componentReference.component,
164
- signature: (_b = (_a = componentRegistry[componentReference.component]) === null || _a === void 0 ? void 0 : _a.signature) !== null && _b !== void 0 ? _b : "",
165
- isPublic: componentReference.isPublic,
167
+ key: manifest.key,
168
+ signature: (_a = manifest.signature) !== null && _a !== void 0 ? _a : "",
169
+ isPublic: manifest.public,
166
170
  },
167
171
  key: componentReference.key,
168
172
  };
169
- const inputs = Object.entries((_c = componentReference.values) !== null && _c !== void 0 ? _c : {}).reduce((result, [key, value]) => {
173
+ const inputs = Object.entries((_b = componentReference.values) !== null && _b !== void 0 ? _b : {}).reduce((result, [key, value]) => {
170
174
  if ("value" in value) {
171
175
  const type = value.value instanceof Object ? "complex" : "value";
172
176
  const valueExpr = value.value instanceof Object && !Array.isArray(value.value)
@@ -28,6 +28,20 @@ export interface IntegrationDefinitionComponentRegistry {
28
28
  */
29
29
  export interface IntegrationDefinitionConfigPages {
30
30
  }
31
+ /**
32
+ * Root UserLevelConfigPages type exposed for augmentation.
33
+ *
34
+ * The expected interface when augmenting is:
35
+ *
36
+ * ```ts
37
+ * interface IntegrationDefinitionUserLevelConfigPages {
38
+ * [key: string]: ConfigPage
39
+ * }
40
+ * ```
41
+ *
42
+ */
43
+ export interface IntegrationDefinitionUserLevelConfigPages {
44
+ }
31
45
  /** Defines attributes of a Code-Native Integration. */
32
46
  export declare type IntegrationDefinition = {
33
47
  /** The unique name for this Integration. */
@@ -55,6 +69,8 @@ export declare type IntegrationDefinition = {
55
69
  flows: Flow[];
56
70
  /** Config Wizard Pages for this Integration. */
57
71
  configPages?: ConfigPages;
72
+ /** User Level Config Wizard Pages for this Integration. */
73
+ userLevelConfigPages?: UserLevelConfigPages;
58
74
  componentRegistry?: ComponentRegistry;
59
75
  };
60
76
  /** Defines attributes of a Flow of a Code-Native Integration. */
@@ -239,14 +255,19 @@ export declare const isDataSourceReferenceConfigVar: (cv: ConfigVar) => cv is Da
239
255
  export declare const isConnectionDefinitionConfigVar: (cv: ConfigVar) => cv is ConnectionDefinitionConfigVar;
240
256
  export declare const isConnectionReferenceConfigVar: (cv: ConfigVar) => cv is ConnectionReferenceConfigVar;
241
257
  export declare type ConfigPageElement = string | ConfigVar;
242
- export declare type ConfigPages = keyof IntegrationDefinitionConfigPages extends never ? {
258
+ declare type CreateConfigPages<TIntegrationDefinitionConfigPages> = keyof TIntegrationDefinitionConfigPages extends never ? {
243
259
  [key: string]: ConfigPage;
244
- } : UnionToIntersection<keyof IntegrationDefinitionConfigPages extends infer TPageName ? TPageName extends keyof IntegrationDefinitionConfigPages ? IntegrationDefinitionConfigPages[TPageName] extends ConfigPage ? {
245
- [Key in TPageName]: IntegrationDefinitionConfigPages[TPageName];
260
+ } : UnionToIntersection<keyof TIntegrationDefinitionConfigPages extends infer TPageName ? TPageName extends keyof TIntegrationDefinitionConfigPages ? TIntegrationDefinitionConfigPages[TPageName] extends ConfigPage ? {
261
+ [Key in TPageName]: TIntegrationDefinitionConfigPages[TPageName];
246
262
  } : never : never : never>;
247
- export declare type ConfigVars = Prettify<UnionToIntersection<keyof ConfigPages extends infer TPageName ? TPageName extends keyof ConfigPages ? ConfigPages[TPageName] extends infer TConfigPage ? TConfigPage extends ConfigPage ? {
263
+ export declare type ConfigPages = CreateConfigPages<IntegrationDefinitionConfigPages>;
264
+ export declare type UserLevelConfigPages = CreateConfigPages<IntegrationDefinitionUserLevelConfigPages>;
265
+ declare type ExtractConfigVars<TConfigPages extends {
266
+ [key: string]: ConfigPage;
267
+ }> = keyof TConfigPages extends infer TPageName ? TPageName extends keyof TConfigPages ? TConfigPages[TPageName] extends infer TConfigPage ? TConfigPage extends ConfigPage ? {
248
268
  [Key in keyof TConfigPage["elements"] as Key extends string ? TConfigPage["elements"][Key] extends ConfigVar ? Key : never : never]: ElementToRuntimeType<TConfigPage["elements"][Key]>;
249
- } : never : never : never : never>>;
269
+ } : never : never : never : never;
270
+ export declare type ConfigVars = Prettify<UnionToIntersection<ExtractConfigVars<ConfigPages> | ExtractConfigVars<UserLevelConfigPages>>>;
250
271
  export declare type ToDataSourceRuntimeType<TType extends DataSourceType> = TType extends "jsonForm" ? JSONForm : TType extends "objectSelection" ? ObjectSelection : TType extends "objectFieldMap" ? ObjectFieldMap : string;
251
272
  export declare type ElementToRuntimeType<TElement extends ConfigPageElement> = TElement extends ConnectionConfigVar ? Connection : TElement extends DataSourceConfigVar ? ToDataSourceRuntimeType<TElement["dataSourceType"]> : TElement extends ScheduleConfigVar ? Schedule : TElement extends StandardConfigVar ? string : never;
252
273
  /** Defines attributes of a Config Wizard Page used when deploying an Instance of an Integration. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "9.0.0-rc.6",
3
+ "version": "9.0.0-rc.8",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"