@prismatic-io/spectral 10.4.3 → 10.4.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.
|
@@ -54,15 +54,27 @@ const convertConfigPages = (pages, userLevelConfigured) => {
|
|
|
54
54
|
return [];
|
|
55
55
|
}
|
|
56
56
|
return Object.entries(pages).map(([name, { tagline, elements }]) => (Object.assign(Object.assign({ name,
|
|
57
|
-
tagline }, (userLevelConfigured ? { userLevelConfigured } : {})), { elements: Object.entries(elements).map(([key, value]) =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
tagline }, (userLevelConfigured ? { userLevelConfigured } : {})), { elements: Object.entries(elements).map(([key, value]) => {
|
|
58
|
+
if (typeof value === "string") {
|
|
59
|
+
return {
|
|
60
|
+
type: "htmlElement",
|
|
61
|
+
value,
|
|
62
|
+
};
|
|
61
63
|
}
|
|
62
|
-
|
|
64
|
+
else if (value &&
|
|
65
|
+
typeof value === "object" &&
|
|
66
|
+
"dataType" in value &&
|
|
67
|
+
value.dataType === "htmlElement") {
|
|
68
|
+
return {
|
|
69
|
+
type: "htmlElement",
|
|
70
|
+
value: key,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
63
74
|
type: "configVar",
|
|
64
75
|
value: key,
|
|
65
|
-
}
|
|
76
|
+
};
|
|
77
|
+
}) })));
|
|
66
78
|
};
|
|
67
79
|
const codeNativeIntegrationYaml = ({ name, description, category, documentation, version, labels, endpointType, triggerPreprocessFlowConfig, flows, configPages, userLevelConfigPages, scopedConfigVars, componentRegistry = {}, }, referenceKey, configVars) => {
|
|
68
80
|
// Find the preprocess flow config on the flow, if one exists.
|
|
@@ -88,7 +100,12 @@ const codeNativeIntegrationYaml = ({ name, description, category, documentation,
|
|
|
88
100
|
}
|
|
89
101
|
return Object.assign(Object.assign({}, acc), { [key]: value });
|
|
90
102
|
}, Object.assign({}, (configVars !== null && configVars !== void 0 ? configVars : {})));
|
|
91
|
-
const requiredConfigVars =
|
|
103
|
+
const requiredConfigVars = [];
|
|
104
|
+
Object.entries(configVarMap).forEach(([key, configVar]) => {
|
|
105
|
+
if (!(0, types_1.isHtmlElementConfigVar)(configVar)) {
|
|
106
|
+
requiredConfigVars.push((0, exports.convertConfigVar)(key, configVar, referenceKey, componentRegistry));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
92
109
|
// Transform the IntegrationDefinition into the structure that is appropriate
|
|
93
110
|
// for generating YAML, which will then be used by the Prismatic API to import
|
|
94
111
|
// the integration as a Code Native Integration.
|
|
@@ -2,7 +2,7 @@ import { ValidationMode } from "@jsonforms/core";
|
|
|
2
2
|
import { type DataSourceDefinition, type ConnectionDefinition, type Inputs, type DataSourceType, type Connection, type JSONForm, type ObjectFieldMap, type ObjectSelection, type ConfigVarResultCollection, type Schedule, type CollectionDataSourceType, type DataSourceReference, type ConfigPage, type ConfigPages, type ConfigPageElement, type ComponentRegistryDataSource, type ComponentRegistryConnection, type UserLevelConfigPages, type OrganizationActivatedConnectionConfigVar, type ScopedConfigVarMap } from ".";
|
|
3
3
|
import type { Prettify, UnionToIntersection } from "./utils";
|
|
4
4
|
/** Supported data types for Config Vars. */
|
|
5
|
-
export type ConfigVarDataType = "string" | "date" | "timestamp" | "picklist" | "code" | "boolean" | "number" | "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm";
|
|
5
|
+
export type ConfigVarDataType = "string" | "date" | "timestamp" | "picklist" | "code" | "boolean" | "number" | "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm" | "htmlElement";
|
|
6
6
|
type ConfigVarDataTypeDefaultValueMap<TMap extends Record<ConfigVarDataType, unknown> = {
|
|
7
7
|
string: string;
|
|
8
8
|
date: string;
|
|
@@ -15,6 +15,7 @@ type ConfigVarDataTypeDefaultValueMap<TMap extends Record<ConfigVarDataType, unk
|
|
|
15
15
|
objectSelection: ObjectSelection;
|
|
16
16
|
objectFieldMap: ObjectFieldMap;
|
|
17
17
|
jsonForm: JSONForm;
|
|
18
|
+
htmlElement: string;
|
|
18
19
|
}> = TMap;
|
|
19
20
|
type ConfigVarDataTypeRuntimeValueMap<TMap extends Record<ConfigVarDataType, unknown> = {
|
|
20
21
|
string: string;
|
|
@@ -28,6 +29,7 @@ type ConfigVarDataTypeRuntimeValueMap<TMap extends Record<ConfigVarDataType, unk
|
|
|
28
29
|
objectSelection: ObjectSelection;
|
|
29
30
|
objectFieldMap: ObjectFieldMap;
|
|
30
31
|
jsonForm: unknown;
|
|
32
|
+
htmlElement: string;
|
|
31
33
|
}> = TMap;
|
|
32
34
|
/** Choices of collection types for multi-value Config Vars. */
|
|
33
35
|
export type CollectionType = "valuelist" | "keyvaluelist";
|
|
@@ -112,7 +114,8 @@ type JsonFormConfigVar = CreateStandardConfigVar<"jsonForm"> & {
|
|
|
112
114
|
type JsonFormDataSourceDefinitionConfigVar = DataSourceDefinitionConfigVar & {
|
|
113
115
|
validationMode?: ValidationMode;
|
|
114
116
|
};
|
|
115
|
-
|
|
117
|
+
type HtmlElementConfigVar = CreateStandardConfigVar<"htmlElement">;
|
|
118
|
+
export type StandardConfigVar = StringConfigVar | DateConfigVar | TimestampConfigVar | PicklistConfigVar | CodeConfigVar | BooleanConfigVar | NumberConfigVar | ScheduleConfigVar | ObjectSelectionConfigVar | ObjectFieldMapConfigVar | JsonFormConfigVar | HtmlElementConfigVar;
|
|
116
119
|
type BaseDataSourceConfigVar<TDataSourceType extends DataSourceType = DataSourceType> = TDataSourceType extends CollectionDataSourceType ? {
|
|
117
120
|
dataSourceType: TDataSourceType;
|
|
118
121
|
collectionType?: CollectionType | undefined;
|
|
@@ -181,6 +184,7 @@ type ExtractScopedConfigVars<TScopedConfigVarMap extends {
|
|
|
181
184
|
[Key in keyof TScopedConfigVarMap as Key extends string ? TScopedConfigVarMap[Key] extends OrganizationActivatedConnectionConfigVar ? Key : never : never]: Connection;
|
|
182
185
|
} : never : never : never : never;
|
|
183
186
|
export type ConfigVars = Prettify<UnionToIntersection<ExtractConfigVars<ConfigPages>>> & Prettify<UnionToIntersection<ExtractConfigVars<UserLevelConfigPages>>> & Prettify<UnionToIntersection<ExtractScopedConfigVars<ScopedConfigVarMap>>>;
|
|
187
|
+
export declare const isHtmlElementConfigVar: (cv: ConfigVar) => cv is HtmlElementConfigVar;
|
|
184
188
|
export declare const isCodeConfigVar: (cv: ConfigVar) => cv is CodeConfigVar;
|
|
185
189
|
export declare const isScheduleConfigVar: (cv: ConfigVar) => cv is ScheduleConfigVar;
|
|
186
190
|
export declare const isJsonFormConfigVar: (cv: ConfigVar) => cv is JsonFormConfigVar;
|
package/dist/types/ConfigVars.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isConnectionReferenceConfigVar = exports.isConnectionDefinitionConfigVar = exports.isDataSourceReferenceConfigVar = exports.isDataSourceDefinitionConfigVar = exports.isJsonFormDataSourceConfigVar = exports.isJsonFormConfigVar = exports.isScheduleConfigVar = exports.isCodeConfigVar = void 0;
|
|
3
|
+
exports.isConnectionReferenceConfigVar = exports.isConnectionDefinitionConfigVar = exports.isDataSourceReferenceConfigVar = exports.isDataSourceDefinitionConfigVar = exports.isJsonFormDataSourceConfigVar = exports.isJsonFormConfigVar = exports.isScheduleConfigVar = exports.isCodeConfigVar = exports.isHtmlElementConfigVar = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
|
+
const isHtmlElementConfigVar = (cv) => "dataType" in cv && cv.dataType === "htmlElement";
|
|
6
|
+
exports.isHtmlElementConfigVar = isHtmlElementConfigVar;
|
|
5
7
|
const isCodeConfigVar = (cv) => "dataType" in cv && cv.dataType === "code";
|
|
6
8
|
exports.isCodeConfigVar = isCodeConfigVar;
|
|
7
9
|
const isScheduleConfigVar = (cv) => "dataType" in cv && cv.dataType === "schedule";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismatic-io/spectral",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.4",
|
|
4
4
|
"description": "Utility library for building Prismatic connectors and code-native integrations",
|
|
5
5
|
"keywords": ["prismatic"],
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"files": ["dist/"],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@jsonforms/core": "3.0.0",
|
|
42
|
-
"axios": "1.
|
|
43
|
-
"axios-retry": "
|
|
42
|
+
"axios": "1.8.3",
|
|
43
|
+
"axios-retry": "4.5.0",
|
|
44
44
|
"date-fns": "2.30.0",
|
|
45
45
|
"ejs": "^3.1.10",
|
|
46
46
|
"form-data": "4.0.0",
|