Socket
Socket
Sign inDemoInstall

@prismatic-io/spectral

Package Overview
Dependencies
Maintainers
8
Versions
172
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.7 to 9.1.0

1

dist/generators/componentManifest/getInputs.d.ts

@@ -14,2 +14,3 @@ import type { Input as InputBase } from "../../serverTypes";

required: boolean | undefined;
default: ServerTypeInput["default"];
}

@@ -16,0 +17,0 @@ export type ValueType = string | {

@@ -5,2 +5,11 @@ "use strict";

const docBlock_1 = require("./docBlock");
const getDefaultValue = (value) => {
if (value === undefined || value === "") {
return value;
}
if (typeof value === "string") {
return value;
}
return JSON.stringify(value);
};
const getInputs = ({ inputs, docBlock = docBlock_1.DOC_BLOCK_DEFAULT }) => {

@@ -24,2 +33,3 @@ return inputs.reduce((acc, input) => {

docBlock: docBlock(input),
default: getDefaultValue(input.default),
},

@@ -26,0 +36,0 @@ ];

2

dist/serverTypes/convertComponent.js

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

const keyLabel = collection === "keyvaluelist" && typeof label === "object" ? label.key : undefined;
return Object.assign(Object.assign({}, (0, lodash_1.omit)(rest, ["onPremControlled"])), { key,
return Object.assign(Object.assign({}, (0, lodash_1.omit)(rest, ["onPremControlled", "permissionAndVisibilityType", "visibleToOrgDeployer"])), { key,
type, default: defaultValue !== null && defaultValue !== void 0 ? defaultValue : types_1.InputFieldDefaultMap[type], collection, label: typeof label === "string" ? label : label.value, keyLabel, onPremiseControlled: ("onPremControlled" in rest && rest.onPremControlled) || undefined });

@@ -24,0 +24,0 @@ };

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

const convertComponentReference = (componentReference, componentRegistry, referenceType) => {
var _a, _b, _c;
var _a, _b;
const manifest = componentRegistry[componentReference.component];

@@ -178,4 +178,8 @@ if (!manifest) {

};
const inputs = Object.entries((_c = componentReference.values) !== null && _c !== void 0 ? _c : {}).reduce((result, [key, value]) => {
const manifestEntryInput = manifestEntry.inputs[key];
const inputs = Object.entries(manifestEntry.inputs).reduce((result, [key, manifestEntryInput]) => {
var _a, _b, _c;
// Retrieve the input value or default to the manifest's default value
const value = (_b = (_a = componentReference.values) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : {
value: (_c = manifestEntryInput.default) !== null && _c !== void 0 ? _c : "",
};
const type = manifestEntryInput.collection

@@ -191,6 +195,8 @@ ? "complex"

type: "value",
value: v,
value: JSON.stringify(v),
}))
: value.value;
const formattedValue = type === "complex" || typeof valueExpr === "string" ? valueExpr : JSON.stringify(valueExpr);
const formattedValue = type === "complex" || typeof valueExpr === "string"
? valueExpr
: JSON.stringify(valueExpr);
const meta = convertInputPermissionAndVisibility((0, lodash_1.pick)(value, ["permissionAndVisibilityType", "visibleToOrgDeployer"]));

@@ -326,2 +332,3 @@ return Object.assign(Object.assign({}, result), { [key]: { type: type, value: formattedValue, meta } });

}
const meta = convertInputPermissionAndVisibility((0, lodash_1.pick)(input, ["permissionAndVisibilityType", "visibleToOrgDeployer"]));
const defaultValue = input.collection ? [] : "";

@@ -331,2 +338,3 @@ return Object.assign(Object.assign({}, result), { [key]: {

value: input.default || defaultValue,
meta,
} });

@@ -410,8 +418,11 @@ }, {}),

const componentActions = Object.entries(actions).reduce((actionsAccumulator, [registryActionKey, action]) => {
const manifestActions = componentRegistry[componentKey].actions[registryActionKey];
// Define the method to be called for the action
const invokeAction = (values) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
// Transform the input values based on the action's inputs
const transformedValues = Object.entries(values).reduce((transformedAccumulator, [inputKey, inputValue]) => {
const { collection } = action.inputs[inputKey];
// Apply defaults directly within the transformation process
const transformedValues = Object.entries(manifestActions.inputs).reduce((transformedAccumulator, [inputKey, inputValueBase]) => {
var _a;
const inputValue = (_a = values[inputKey]) !== null && _a !== void 0 ? _a : inputValueBase.default;
const { collection } = inputValueBase;
return Object.assign(Object.assign({}, transformedAccumulator), { [inputKey]: convertInputValue(inputValue, collection) });

@@ -418,0 +429,0 @@ }, {});

@@ -1,3 +0,3 @@

import { ComponentManifest, PermissionAndVisibilityType } from ".";
import { Prettify, UnionToIntersection } from "./utils";
import type { ComponentManifest, ConfigVarVisibility } from ".";
import type { Prettify, UnionToIntersection } from "./utils";
/**

@@ -22,14 +22,2 @@ * Root ComponentRegistry type exposed for augmentation.

} : never : never>;
export interface ConnectionInputPermissionAndVisibility {
/**
* Optional value that sets the permission and visibility of the Config Var. @default "customer"
*
* "customer" - Customers can view and edit the Config Var.
* "embedded" - Customers cannot view or update the Config Var as the value will be set programmatically.
* "organization" - Customers cannot view or update the Config Var as it will always have a default value or be set by the organization.
*/
permissionAndVisibilityType?: PermissionAndVisibilityType;
/** Optional value that specifies whether this Config Var is visible to an Organization deployer. @default true */
visibleToOrgDeployer?: boolean;
}
export type ConfigVarExpression = {

@@ -46,3 +34,3 @@ configVar: string;

dataSources: ValueExpression<TValue> | ConfigVarExpression;
connections: (ValueExpression<TValue> | ConfigVarExpression) & ConnectionInputPermissionAndVisibility;
connections: (ValueExpression<TValue> | ConfigVarExpression) & ConfigVarVisibility;
}> = TMap;

@@ -49,0 +37,0 @@ export type ComponentReference<TComponentReference extends {

@@ -1,3 +0,3 @@

import { DataSourceDefinition, ConnectionDefinition, Inputs, DataSourceType, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection, Schedule, CollectionDataSourceType, DataSourceReference, ConfigPage, ConfigPages, ConfigPageElement, ComponentRegistryDataSource, ComponentRegistryConnection, UserLevelConfigPages } from ".";
import { Prettify, UnionToIntersection } from "./utils";
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 } from ".";
import type { Prettify, UnionToIntersection } from "./utils";
/** Supported data types for Config Vars. */

@@ -33,10 +33,5 @@ export type ConfigVarDataType = "string" | "date" | "timestamp" | "picklist" | "code" | "boolean" | "number" | "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm";

export type CollectionType = "valuelist" | "keyvaluelist";
type ConfigVarSingleDataType = Extract<ConfigVarDataType, "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm">;
export type PermissionAndVisibilityType = "customer" | "embedded" | "organization";
type ConfigVarSingleDataType = Extract<ConfigVarDataType, "schedule" | "objectSelection" | "objectFieldMap" | "jsonForm">;
/** Common attribute shared by all types of Config Vars. */
type BaseConfigVar = {
/** A unique, unchanging value that is used to maintain identity for the Config Var even if the key changes. */
stableKey: string;
/** Optional description for this Config Var. */
description?: string;
export interface ConfigVarVisibility {
/**

@@ -52,3 +47,22 @@ * Optional value that sets the permission and visibility of the Config Var. @default "customer"

visibleToOrgDeployer?: boolean;
};
}
interface ConfigVarInputVisibility {
/**
* Optional value that sets the permission and visibility of the Config Var Input. @default "customer"
*
* "customer" - Customers can view and edit the Config Var Input.
* "embedded" - Customers cannot view or update the Config Var Input as the value will be set programmatically.
* "organization" - Customers cannot view or update the Config Var Input as it will always have a default value or be set by the organization.
*/
permissionAndVisibilityType?: PermissionAndVisibilityType;
/** Optional value that specifies whether this Config Var Input is visible to an Organization deployer. @default true */
visibleToOrgDeployer?: boolean;
}
/** Common attribute shared by all types of Config Vars. */
type BaseConfigVar = {
/** A unique, unchanging value that is used to maintain identity for the Config Var even if the key changes. */
stableKey: string;
/** Optional description for this Config Var. */
description?: string;
} & ConfigVarVisibility;
type GetDynamicProperties<TValue, TCollectionType extends CollectionType | undefined> = TCollectionType extends undefined ? {

@@ -120,3 +134,7 @@ defaultValue?: TValue;

};
type ConnectionDefinitionConfigVar = BaseConnectionConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">;
type ConnectionDefinitionConfigVar = ConnectionDefinition extends infer TConnectionDefinitionType extends ConnectionDefinition ? TConnectionDefinitionType extends infer TConnectionDefinition extends ConnectionDefinition ? BaseConnectionConfigVar & Omit<TConnectionDefinition, "inputs" | "label" | "comments" | "key"> & {
inputs: {
[Key in keyof TConnectionDefinition["inputs"]]: TConnectionDefinition["inputs"][Key] & ConfigVarInputVisibility;
};
} : never : never;
type OnPremiseConnectionConfigTypeEnum = "allowed" | "disallowed" | "required";

@@ -123,0 +141,0 @@ type ConnectionReferenceConfigVar = ComponentRegistryConnection extends infer TConnectionReference ? TConnectionReference extends ComponentRegistryConnection ? BaseConnectionConfigVar & {

@@ -1,2 +0,2 @@

import { ConnectionInput, OnPremConnectionInput } from ".";
import type { ConnectionInput, OnPremConnectionInput } from ".";
export declare enum OAuth2Type {

@@ -29,4 +29,9 @@ ClientCredentials = "client_credentials",

}
interface OAuth2Config {
overrideGrantType?: string;
allowedTokenParams?: string[];
}
interface OAuth2AuthorizationCodeConnectionDefinition extends BaseConnectionDefinition {
oauth2Type: OAuth2Type.AuthorizationCode;
oauth2Config?: OAuth2Config;
/** The PKCE method (S256 or plain) that this OAuth 2.0 connection uses (if any) */

@@ -33,0 +38,0 @@ oauth2PkceMethod?: OAuth2PkceMethod;

@@ -1,2 +0,2 @@

import { ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, TriggerPayload, ComponentRegistry, TriggerReference, ConfigVars, ConfigPages, UserLevelConfigPages, ValueExpression, ConfigVarExpression } from ".";
import { ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, TriggerPayload, ComponentRegistry, TriggerReference, ConfigVars, ConfigPages, UserLevelConfigPages, ValueExpression, ConfigVarExpression, ActionContext } from ".";
/** Defines attributes of a Code-Native Integration. */

@@ -33,2 +33,17 @@ export type IntegrationDefinition = {

};
export type FlowOnExecution<TTriggerPayload extends TriggerPayload> = ActionPerformFunction<{
onTrigger: {
type: "data";
label: string;
clean: (value: unknown) => {
results: TTriggerPayload;
};
};
}, ConfigVars, {
[Key in keyof ComponentRegistry]: ComponentRegistry[Key]["actions"];
}, false, ActionPerformReturn<false, unknown>>;
export type FlowExecutionContext = ActionContext<ConfigVars, {
[Key in keyof ComponentRegistry]: ComponentRegistry[Key]["actions"];
}>;
export type FlowExecutionContextActions = FlowExecutionContext["components"];
/** Defines attributes of a Flow of a Code-Native Integration. */

@@ -65,13 +80,3 @@ export interface Flow<TTriggerPayload extends TriggerPayload = TriggerPayload> {

/** Specifies the main function for this Flow */
onExecution: ActionPerformFunction<{
onTrigger: {
type: "data";
label: string;
clean: (value: unknown) => {
results: TTriggerPayload;
};
};
}, ConfigVars, {
[Key in keyof ComponentRegistry]: ComponentRegistry[Key]["actions"];
}, false, ActionPerformReturn<false, unknown>>;
onExecution: FlowOnExecution<TTriggerPayload>;
}

@@ -78,0 +83,0 @@ /** Defines attributes of a Preprocess Flow Configuration used by a Flow of an Integration. */

{
"name": "@prismatic-io/spectral",
"version": "9.0.7",
"version": "9.1.0",
"description": "Utility library for building Prismatic components",

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc