@prismatic-io/spectral 9.0.2 → 9.0.4

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.
@@ -17,6 +17,7 @@ const path_1 = __importDefault(require("path"));
17
17
  const helpers_1 = require("./helpers");
18
18
  const createTemplate_1 = require("../utils/createTemplate");
19
19
  const createStaticFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, signature, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) {
20
+ var _b, _c, _d, _e;
20
21
  if (verbose) {
21
22
  console.info("Creating static files...");
22
23
  }
@@ -52,22 +53,22 @@ const createStaticFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ c
52
53
  label: component.display.label,
53
54
  description: component.display.description,
54
55
  isPublic: Boolean(component.public),
55
- action: Object.keys(component.actions).length
56
+ action: Object.keys((_b = component.actions) !== null && _b !== void 0 ? _b : {}).length
56
57
  ? {
57
58
  key: Object.keys(component.actions)[0],
58
59
  }
59
60
  : null,
60
- trigger: Object.keys(component.triggers).length
61
+ trigger: Object.keys((_c = component.triggers) !== null && _c !== void 0 ? _c : {}).length
61
62
  ? {
62
63
  key: Object.keys(component.triggers)[0],
63
64
  }
64
65
  : null,
65
- connection: component.connections.length
66
+ connection: ((_d = component.connections) !== null && _d !== void 0 ? _d : []).length
66
67
  ? {
67
68
  key: component.connections[0].key,
68
69
  }
69
70
  : null,
70
- dataSource: Object.keys(component.dataSources).length
71
+ dataSource: Object.keys((_e = component.dataSources) !== null && _e !== void 0 ? _e : {}).length
71
72
  ? {
72
73
  key: Object.keys(component.dataSources)[0],
73
74
  type: component.dataSources[Object.keys(component.dataSources)[0]].dataSourceType,
@@ -57,7 +57,11 @@ exports.INPUT_TYPE_MAP = {
57
57
  };
58
58
  const getInputValueType = (input) => {
59
59
  const valueType = input.model
60
- ? input.model.map((choice) => `"${choice.value}"`).join(" | ")
60
+ ? input.model
61
+ .map((choice) => {
62
+ return `\`${choice.value.replaceAll("\r", "\\r").replaceAll("\n", "\\n")}\``;
63
+ })
64
+ .join(" | ")
61
65
  : exports.INPUT_TYPE_MAP[input.type] || "never";
62
66
  if (input.collection === "keyvaluelist") {
63
67
  return `Record<string, ${valueType}> | Array<{key: string, value: ${valueType}}>`;
@@ -334,8 +334,8 @@ const convertConfigVar = (key, configVar, referenceKey, componentRegistry) => {
334
334
  description,
335
335
  key,
336
336
  dataType: "connection",
337
- connection: Object.assign(Object.assign({}, ref), { template,
338
- onPremiseConnectionConfig }),
337
+ onPremiseConnectionConfig,
338
+ connection: Object.assign(Object.assign({}, ref), { template }),
339
339
  inputs,
340
340
  orgOnly,
341
341
  meta,
@@ -7,7 +7,6 @@ export type ComponentReference = {
7
7
  };
8
8
  key: string;
9
9
  template?: string;
10
- onPremiseConnectionConfig?: string;
11
10
  } | {
12
11
  component: {
13
12
  key: string;
@@ -16,7 +15,6 @@ export type ComponentReference = {
16
15
  };
17
16
  key: string;
18
17
  template?: string;
19
- onPremiseConnectionConfig?: string;
20
18
  };
21
19
  export type Input = {
22
20
  name?: string | Input;
@@ -35,6 +33,7 @@ export interface ConnectionRequiredConfigVariable {
35
33
  description?: string;
36
34
  orgOnly?: boolean;
37
35
  dataType: "connection";
36
+ onPremiseConnectionConfig?: string;
38
37
  connection: ComponentReference;
39
38
  inputs?: Record<string, Input>;
40
39
  meta?: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "9.0.2",
3
+ "version": "9.0.4",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": ["prismatic"],
6
6
  "main": "dist/index.js",
@@ -48,6 +48,7 @@
48
48
  "jest-mock": "29.7.0",
49
49
  "lodash": "4.17.21",
50
50
  "object-sizeof": "^2.6.4",
51
+ "prettier": "2.6.2",
51
52
  "safe-stable-stringify": "2.3.1",
52
53
  "serialize-error": "8.1.0",
53
54
  "url-join": "5.0.0",