@prismatic-io/spectral
Advanced tools
Comparing version 9.0.5 to 9.0.6
@@ -20,3 +20,2 @@ "use strict"; | ||
const fs_extra_1 = require("fs-extra"); | ||
const lodash_1 = require("lodash"); | ||
const index_1 = require("./index"); | ||
@@ -117,3 +116,3 @@ const createFlagHelpText_1 = require("../utils/createFlagHelpText"); | ||
skipSignatureVerify: flags.skip_signature_verify.value, | ||
packageName: (_a = flags.name.value) !== null && _a !== void 0 ? _a : `@component-manifests/${(0, lodash_1.kebabCase)(component.key)}`, | ||
packageName: (_a = flags.name.value) !== null && _a !== void 0 ? _a : `@component-manifests/${component.key}`, | ||
dependencies: { | ||
@@ -120,0 +119,0 @@ spectral: packageJson.version, |
@@ -21,2 +21,4 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createTypeInterface_1 = require("../utils/createTypeInterface"); | ||
const createImport_1 = require("../utils/createImport"); | ||
const createActions = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
@@ -28,5 +30,6 @@ var _b, _c; | ||
const actionIndex = yield renderActionsIndex({ | ||
actions: Object.entries((_b = component.actions) !== null && _b !== void 0 ? _b : {}).map(([actionKey, action]) => { | ||
imports: Object.entries((_b = component.actions) !== null && _b !== void 0 ? _b : {}).map(([actionKey, action]) => { | ||
var _a; | ||
return { | ||
key: action.key || actionKey, | ||
import: (0, createImport_1.createImport)((_a = action.key) !== null && _a !== void 0 ? _a : actionKey), | ||
}; | ||
@@ -40,2 +43,3 @@ }), | ||
const actions = yield Promise.all(Object.entries((_c = component.actions) !== null && _c !== void 0 ? _c : {}).map((_a) => __awaiter(void 0, [_a], void 0, function* ([actionKey, action]) { | ||
var _b, _c; | ||
const inputs = (0, getInputs_1.getInputs)({ | ||
@@ -47,2 +51,4 @@ inputs: action.inputs, | ||
action: { | ||
typeInterface: (0, createTypeInterface_1.createTypeInterface)((_b = action.key) !== null && _b !== void 0 ? _b : actionKey), | ||
import: (0, createImport_1.createImport)((_c = action.key) !== null && _c !== void 0 ? _c : actionKey), | ||
key: action.key || actionKey, | ||
@@ -69,3 +75,3 @@ label: action.display.description, | ||
exports.createActions = createActions; | ||
const renderActionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ actions, dryRun, verbose, sourceDir, destinationDir, }) { | ||
const renderActionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ imports, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -75,3 +81,3 @@ source: path_1.default.join(sourceDir, "actions", "index.ts.ejs"), | ||
data: { | ||
actions, | ||
imports, | ||
}, | ||
@@ -85,3 +91,3 @@ dryRun, | ||
source: path_1.default.join(sourceDir, "actions", "action.ts.ejs"), | ||
destination: path_1.default.join(destinationDir, "actions", `${action.key}.ts`), | ||
destination: path_1.default.join(destinationDir, "actions", `${action.import}.ts`), | ||
data: { | ||
@@ -88,0 +94,0 @@ action, |
@@ -21,2 +21,4 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createTypeInterface_1 = require("../utils/createTypeInterface"); | ||
const createImport_1 = require("../utils/createImport"); | ||
const createConnections = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
@@ -28,5 +30,5 @@ var _b, _c; | ||
const connectionIndex = yield renderConnectionsIndex({ | ||
connections: ((_b = component.connections) !== null && _b !== void 0 ? _b : []).map((connection) => { | ||
imports: ((_b = component.connections) !== null && _b !== void 0 ? _b : []).map((connection) => { | ||
return { | ||
key: connection.key, | ||
import: (0, createImport_1.createImport)(connection.key), | ||
}; | ||
@@ -47,2 +49,4 @@ }), | ||
connection: { | ||
typeInterface: (0, createTypeInterface_1.createTypeInterface)(connection.key), | ||
import: (0, createImport_1.createImport)(connection.key), | ||
key: connection.key, | ||
@@ -70,3 +74,3 @@ label: connection.label, | ||
exports.createConnections = createConnections; | ||
const renderConnectionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ connections, dryRun, verbose, sourceDir, destinationDir, }) { | ||
const renderConnectionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ imports, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -76,3 +80,3 @@ source: path_1.default.join(sourceDir, "connections", "index.ts.ejs"), | ||
data: { | ||
connections, | ||
imports, | ||
}, | ||
@@ -86,3 +90,3 @@ dryRun, | ||
source: path_1.default.join(sourceDir, "connections", "connection.ts.ejs"), | ||
destination: path_1.default.join(destinationDir, "connections", `${connection.key}.ts`), | ||
destination: path_1.default.join(destinationDir, "connections", `${connection.import}.ts`), | ||
data: { | ||
@@ -89,0 +93,0 @@ connection, |
@@ -21,2 +21,4 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createTypeInterface_1 = require("../utils/createTypeInterface"); | ||
const createImport_1 = require("../utils/createImport"); | ||
const createDataSources = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
@@ -28,5 +30,5 @@ var _b, _c; | ||
const dataSourceIndex = yield renderDataSourcesIndex({ | ||
dataSources: Object.entries((_b = component.dataSources) !== null && _b !== void 0 ? _b : {}).map(([dataSourceKey, dataSource]) => { | ||
imports: Object.entries((_b = component.dataSources) !== null && _b !== void 0 ? _b : {}).map(([dataSourceKey, dataSource]) => { | ||
return { | ||
key: dataSource.key || dataSourceKey, | ||
import: (0, createImport_1.createImport)(dataSource.key || dataSourceKey), | ||
}; | ||
@@ -46,2 +48,4 @@ }), | ||
dataSource: { | ||
type: (0, createTypeInterface_1.createTypeInterface)(dataSource.key || dataSourceKey), | ||
import: (0, createImport_1.createImport)(dataSource.key || dataSourceKey), | ||
key: dataSource.key || dataSourceKey, | ||
@@ -69,3 +73,3 @@ label: dataSource.display.label, | ||
exports.createDataSources = createDataSources; | ||
const renderDataSourcesIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dataSources, dryRun, verbose, sourceDir, destinationDir, }) { | ||
const renderDataSourcesIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ imports, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -75,3 +79,3 @@ source: path_1.default.join(sourceDir, "dataSources", "index.ts.ejs"), | ||
data: { | ||
dataSources, | ||
imports, | ||
}, | ||
@@ -85,3 +89,3 @@ dryRun, | ||
source: path_1.default.join(sourceDir, "dataSources", "dataSource.ts.ejs"), | ||
destination: path_1.default.join(destinationDir, "dataSources", `${dataSource.key}.ts`), | ||
destination: path_1.default.join(destinationDir, "dataSources", `${dataSource.import}.ts`), | ||
data: { | ||
@@ -88,0 +92,0 @@ dataSource, |
@@ -21,2 +21,4 @@ "use strict"; | ||
const createTemplate_1 = require("../utils/createTemplate"); | ||
const createTypeInterface_1 = require("../utils/createTypeInterface"); | ||
const createImport_1 = require("../utils/createImport"); | ||
const createTriggers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) { | ||
@@ -28,5 +30,5 @@ var _b, _c; | ||
const triggersIndex = yield renderTriggersIndex({ | ||
triggers: Object.entries((_b = component.triggers) !== null && _b !== void 0 ? _b : {}).map(([triggerKey, trigger]) => { | ||
imports: Object.entries((_b = component.triggers) !== null && _b !== void 0 ? _b : {}).map(([triggerKey, trigger]) => { | ||
return { | ||
key: trigger.key || triggerKey, | ||
import: (0, createImport_1.createImport)(trigger.key || triggerKey), | ||
}; | ||
@@ -46,2 +48,4 @@ }), | ||
trigger: { | ||
typeInterface: (0, createTypeInterface_1.createTypeInterface)(trigger.key || triggerKey), | ||
import: (0, createImport_1.createImport)(trigger.key || triggerKey), | ||
key: trigger.key || triggerKey, | ||
@@ -68,3 +72,3 @@ label: trigger.display.description, | ||
exports.createTriggers = createTriggers; | ||
const renderTriggersIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ triggers, dryRun, verbose, sourceDir, destinationDir, }) { | ||
const renderTriggersIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ imports, dryRun, verbose, sourceDir, destinationDir, }) { | ||
return yield (0, createTemplate_1.createTemplate)({ | ||
@@ -74,3 +78,3 @@ source: path_1.default.join(sourceDir, "triggers", "index.ts.ejs"), | ||
data: { | ||
triggers, | ||
imports, | ||
}, | ||
@@ -84,3 +88,3 @@ dryRun, | ||
source: path_1.default.join(sourceDir, "triggers", "trigger.ts.ejs"), | ||
destination: path_1.default.join(destinationDir, "triggers", `${trigger.key}.ts`), | ||
destination: path_1.default.join(destinationDir, "triggers", `${trigger.import}.ts`), | ||
data: { | ||
@@ -87,0 +91,0 @@ helpers: helpers_1.helpers, |
@@ -5,2 +5,3 @@ export declare const helpers: { | ||
generatePackageJsonVersion: () => string; | ||
formatType: (key: string) => string; | ||
}; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const createDependencyImports_1 = require("../utils/createDependencyImports"); | ||
const formatType_1 = require("../utils/formatType"); | ||
const generatePackageJsonVersion_1 = require("../utils/generatePackageJsonVersion"); | ||
@@ -12,2 +13,3 @@ exports.helpers = { | ||
generatePackageJsonVersion: generatePackageJsonVersion_1.generatePackageJsonVersion, | ||
formatType: formatType_1.formatType, | ||
}; |
@@ -159,3 +159,3 @@ "use strict"; | ||
const convertComponentReference = (componentReference, componentRegistry, referenceType) => { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
const manifest = componentRegistry[componentReference.component]; | ||
@@ -165,2 +165,6 @@ if (!manifest) { | ||
} | ||
const manifestEntry = manifest[referenceType][componentReference.key]; | ||
if (!manifestEntry) { | ||
throw new Error(`Component with key "${componentReference.component}" does not have an entry with key "${componentReference.key}" in the component registry.`); | ||
} | ||
const ref = { | ||
@@ -172,6 +176,6 @@ component: { | ||
}, | ||
key: componentReference.key, | ||
// older versions of the manifest did not contain a key so we fall back to the componentReference key | ||
key: (_b = manifestEntry.key) !== null && _b !== void 0 ? _b : componentReference.key, | ||
}; | ||
const manifestEntry = manifest[referenceType][componentReference.key]; | ||
const inputs = Object.entries((_b = componentReference.values) !== null && _b !== void 0 ? _b : {}).reduce((result, [key, value]) => { | ||
const inputs = Object.entries((_c = componentReference.values) !== null && _c !== void 0 ? _c : {}).reduce((result, [key, value]) => { | ||
const manifestEntryInput = manifestEntry.inputs[key]; | ||
@@ -403,5 +407,6 @@ const type = manifestEntryInput.collection | ||
const componentMethods = Object.entries(componentRegistry).reduce((accumulator, [registryComponentKey, { key: componentKey, actions, public: isPublic, signature }]) => { | ||
const componentActions = Object.entries(actions).reduce((actionsAccumulator, [actionKey, action]) => { | ||
const componentActions = Object.entries(actions).reduce((actionsAccumulator, [registryActionKey, action]) => { | ||
// 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 | ||
@@ -419,6 +424,7 @@ const transformedValues = Object.entries(values).reduce((transformedAccumulator, [inputKey, inputValue]) => { | ||
}, | ||
key: actionKey, | ||
// older versions of manifests did not contain action.key so we fall back to the registry key | ||
key: (_a = action.key) !== null && _a !== void 0 ? _a : registryActionKey, | ||
}, context, transformedValues); | ||
}); | ||
return Object.assign(Object.assign({}, actionsAccumulator), { [actionKey]: invokeAction }); | ||
return Object.assign(Object.assign({}, actionsAccumulator), { [registryActionKey]: invokeAction }); | ||
}, {}); | ||
@@ -425,0 +431,0 @@ return Object.assign(Object.assign({}, accumulator), { [registryComponentKey]: componentActions }); |
@@ -18,2 +18,3 @@ import { CollectionType, DataSourceType, InputFieldType } from "."; | ||
export interface ComponentManifestAction { | ||
key: string; | ||
perform: (values: any) => Promise<unknown>; | ||
@@ -23,2 +24,3 @@ inputs: Record<string, BaseInput>; | ||
export interface ComponentManifestTrigger { | ||
key: string; | ||
perform: (values: any) => Promise<unknown>; | ||
@@ -28,2 +30,3 @@ inputs: Record<string, BaseInput>; | ||
export interface ComponentManifestDataSource { | ||
key: string; | ||
perform: (values: any) => Promise<unknown>; | ||
@@ -34,2 +37,3 @@ dataSourceType: DataSourceType; | ||
export interface ComponentManifestConnection { | ||
key: string; | ||
perform: (values: any) => Promise<unknown>; | ||
@@ -36,0 +40,0 @@ onPremAvailable?: boolean; |
{ | ||
"name": "@prismatic-io/spectral", | ||
"version": "9.0.5", | ||
"version": "9.0.6", | ||
"description": "Utility library for building Prismatic components", | ||
@@ -5,0 +5,0 @@ "keywords": ["prismatic"], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
305405
158
6329
1