Socket
Socket
Sign inDemoInstall

@prismatic-io/spectral

Package Overview
Dependencies
Maintainers
0
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prismatic-io/spectral - npm Package Compare versions

Comparing version 9.0.0-rc.6 to 9.0.0-rc.7

31

dist/serverTypes/convertIntegration.js

@@ -34,3 +34,3 @@ "use strict";

const convertIntegration = (definition) => {
var _a;
var _a, _b;
// Generate a unique reference key that will be used to reference the

@@ -40,3 +40,6 @@ // actions, triggers, data sources, and connections that are created

const referenceKey = (0, uuid_1.v4)();
const configVars = Object.values((_a = definition.configPages) !== null && _a !== void 0 ? _a : {}).reduce((acc, configPage) => Object.entries(configPage.elements).reduce((acc, [key, element]) => {
const configVars = Object.values({
configPages: (_a = definition.configPages) !== null && _a !== void 0 ? _a : {},
userLevelConfigPages: (_b = definition.userLevelConfigPages) !== null && _b !== void 0 ? _b : {},
}).reduce((acc, configPages) => (Object.assign(Object.assign({}, acc), Object.values(configPages).reduce((acc, configPage) => Object.entries(configPage.elements).reduce((acc, [key, element]) => {
// "string" elements are HTML elements and should be ignored.

@@ -47,6 +50,6 @@ if (typeof element === "string") {

if (key in acc) {
throw new Error('Duplicate config var key "' + key + '"');
throw new Error(`Duplicate config var key: "${key}"`);
}
return Object.assign(Object.assign({}, acc), { [key]: element });
}, acc), {});
}, acc), {}))), {});
const cniComponent = codeNativeIntegrationComponent(definition, referenceKey, configVars);

@@ -57,10 +60,8 @@ const cniYaml = codeNativeIntegrationYaml(definition, referenceKey, configVars);

exports.convertIntegration = convertIntegration;
const convertConfigPages = (pages) => {
const convertConfigPages = (pages, userLevelConfigured) => {
if (!pages || !Object.keys(pages).length) {
return;
return [];
}
return Object.entries(pages).map(([name, { tagline, elements }]) => ({
name,
tagline,
elements: Object.entries(elements).map(([key, value]) => typeof value === "string"
return Object.entries(pages).map(([name, { tagline, elements }]) => (Object.assign(Object.assign({ name,
tagline }, (userLevelConfigured ? { userLevelConfigured } : {})), { elements: Object.entries(elements).map(([key, value]) => typeof value === "string"
? {

@@ -73,6 +74,5 @@ type: "htmlElement",

value: key,
}),
}));
}) })));
};
const codeNativeIntegrationYaml = ({ name, description, category, documentation, version, labels, endpointType, triggerPreprocessFlowConfig, flows, configPages, componentRegistry = {}, }, referenceKey, configVars) => {
const codeNativeIntegrationYaml = ({ name, description, category, documentation, version, labels, endpointType, triggerPreprocessFlowConfig, flows, configPages, userLevelConfigPages, componentRegistry = {}, }, referenceKey, configVars) => {
// Find the preprocess flow config on the flow, if one exists.

@@ -118,3 +118,6 @@ const preprocessFlows = flows.filter((flow) => flow.preprocessFlowConfig);

flows: flows.map((flow) => convertFlow(flow, componentRegistry, referenceKey)),
configPages: convertConfigPages(configPages !== null && configPages !== void 0 ? configPages : {}),
configPages: [
...convertConfigPages(configPages, false),
...convertConfigPages(userLevelConfigPages, true),
],
};

@@ -121,0 +124,0 @@ return yaml_1.default.stringify(result);

@@ -31,2 +31,16 @@ import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule, CollectionDataSourceType, ComponentManifest } from ".";

}
/**
* Root UserLevelConfigPages type exposed for augmentation.
*
* The expected interface when augmenting is:
*
* ```ts
* interface IntegrationDefinitionUserLevelConfigPages {
* [key: string]: ConfigPage
* }
* ```
*
*/
export interface IntegrationDefinitionUserLevelConfigPages {
}
/** Defines attributes of a Code-Native Integration. */

@@ -59,2 +73,4 @@ export declare type IntegrationDefinition = {

configPages?: ConfigPages;
/** User Level Config Wizard Pages for this Integration. */
userLevelConfigPages?: UserLevelConfigPages;
componentRegistry?: ComponentRegistry;

@@ -244,10 +260,15 @@ };

export declare type ConfigPageElement = string | ConfigVar;
export declare type ConfigPages = keyof IntegrationDefinitionConfigPages extends never ? {
declare type CreateConfigPages<TIntegrationDefinitionConfigPages> = keyof TIntegrationDefinitionConfigPages extends never ? {
[key: string]: ConfigPage;
} : UnionToIntersection<keyof IntegrationDefinitionConfigPages extends infer TPageName ? TPageName extends keyof IntegrationDefinitionConfigPages ? IntegrationDefinitionConfigPages[TPageName] extends ConfigPage ? {
[Key in TPageName]: IntegrationDefinitionConfigPages[TPageName];
} : UnionToIntersection<keyof TIntegrationDefinitionConfigPages extends infer TPageName ? TPageName extends keyof TIntegrationDefinitionConfigPages ? TIntegrationDefinitionConfigPages[TPageName] extends ConfigPage ? {
[Key in TPageName]: TIntegrationDefinitionConfigPages[TPageName];
} : never : never : never>;
export declare type ConfigVars = Prettify<UnionToIntersection<keyof ConfigPages extends infer TPageName ? TPageName extends keyof ConfigPages ? ConfigPages[TPageName] extends infer TConfigPage ? TConfigPage extends ConfigPage ? {
export declare type ConfigPages = CreateConfigPages<IntegrationDefinitionConfigPages>;
export declare type UserLevelConfigPages = CreateConfigPages<IntegrationDefinitionUserLevelConfigPages>;
declare type ExtractConfigVars<TConfigPages extends {
[key: string]: ConfigPage;
}> = keyof TConfigPages extends infer TPageName ? TPageName extends keyof TConfigPages ? TConfigPages[TPageName] extends infer TConfigPage ? TConfigPage extends ConfigPage ? {
[Key in keyof TConfigPage["elements"] as Key extends string ? TConfigPage["elements"][Key] extends ConfigVar ? Key : never : never]: ElementToRuntimeType<TConfigPage["elements"][Key]>;
} : never : never : never : never>>;
} : never : never : never : never;
export declare type ConfigVars = Prettify<UnionToIntersection<ExtractConfigVars<ConfigPages> | ExtractConfigVars<UserLevelConfigPages>>>;
export declare type ToDataSourceRuntimeType<TType extends DataSourceType> = TType extends "jsonForm" ? JSONForm : TType extends "objectSelection" ? ObjectSelection : TType extends "objectFieldMap" ? ObjectFieldMap : string;

@@ -254,0 +275,0 @@ 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;

{
"name": "@prismatic-io/spectral",
"version": "9.0.0-rc.6",
"version": "9.0.0-rc.7",
"description": "Utility library for building Prismatic components",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc