@prismatic-io/spectral 10.18.7-preview.2 → 10.18.7-preview.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.
- package/dist/generators/componentManifest/cli.js +2 -6
- package/dist/generators/componentManifest/createStaticFiles.d.ts +4 -9
- package/dist/generators/componentManifest/createStaticFiles.js +4 -5
- package/dist/generators/componentManifest/index.d.ts +2 -3
- package/dist/generators/componentManifest/index.js +2 -2
- package/dist/generators/componentManifest/templates/package.json.ejs +1 -1
- package/dist/types/Inputs.d.ts +13 -11
- package/package.json +1 -1
|
@@ -117,17 +117,13 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
117
117
|
console.error("Component is invalid.");
|
|
118
118
|
process.exit(1);
|
|
119
119
|
}
|
|
120
|
-
const
|
|
120
|
+
const { version: spectralVersion } = require("../../../package.json");
|
|
121
121
|
yield (0, index_1.createComponentManifest)({
|
|
122
122
|
component,
|
|
123
123
|
dryRun: flags.dry_run.value,
|
|
124
124
|
skipSignatureVerify: flags.skip_signature_verify.value,
|
|
125
125
|
packageName: (_a = flags.name.value) !== null && _a !== void 0 ? _a : `@component-manifests/${component.key}`,
|
|
126
|
-
|
|
127
|
-
spectral: packageJson.version,
|
|
128
|
-
dependencies: packageJson.dependencies,
|
|
129
|
-
devDependencies: packageJson.devDependencies,
|
|
130
|
-
},
|
|
126
|
+
spectralVersion,
|
|
131
127
|
verbose: flags.verbose.value,
|
|
132
128
|
sourceDir: path_1.default.join(__dirname, "templates"),
|
|
133
129
|
destinationDir: flags.output_dir.value
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import type { Component } from "../../serverTypes";
|
|
2
2
|
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
3
|
-
export interface PackageDependencies {
|
|
4
|
-
spectral: string;
|
|
5
|
-
dependencies: Record<string, string>;
|
|
6
|
-
devDependencies: Record<string, string>;
|
|
7
|
-
}
|
|
8
3
|
interface CreateStaticFilesProps<TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>> {
|
|
9
4
|
component: Component<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>;
|
|
10
5
|
dryRun: boolean;
|
|
11
6
|
signature: string | null;
|
|
12
7
|
packageName: string;
|
|
13
|
-
|
|
8
|
+
spectralVersion: string;
|
|
14
9
|
verbose: boolean;
|
|
15
10
|
sourceDir: string;
|
|
16
11
|
destinationDir: string;
|
|
17
12
|
registry: string | null;
|
|
18
13
|
}
|
|
19
|
-
export declare const createStaticFiles: <TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>>({ component, dryRun, signature, packageName,
|
|
14
|
+
export declare const createStaticFiles: <TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>>({ component, dryRun, signature, packageName, spectralVersion, verbose, sourceDir, destinationDir, registry, }: CreateStaticFilesProps<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>) => Promise<{
|
|
20
15
|
index: string | void;
|
|
21
16
|
packageJson: string | void;
|
|
22
17
|
tsConfig: string | void;
|
|
@@ -37,13 +32,13 @@ export declare const renderIndex: ({ component, dryRun, verbose, sourceDir, dest
|
|
|
37
32
|
interface RenderPackageJsonProps {
|
|
38
33
|
dryRun: boolean;
|
|
39
34
|
packageName: string;
|
|
40
|
-
|
|
35
|
+
spectralVersion: string;
|
|
41
36
|
verbose: boolean;
|
|
42
37
|
sourceDir: string;
|
|
43
38
|
destinationDir: string;
|
|
44
39
|
registry: string | null;
|
|
45
40
|
}
|
|
46
|
-
export declare const renderPackageJson: ({ dryRun, packageName,
|
|
41
|
+
export declare const renderPackageJson: ({ dryRun, packageName, spectralVersion, verbose, sourceDir, destinationDir, registry, }: RenderPackageJsonProps) => Promise<string | void>;
|
|
47
42
|
interface RenderTsConfigProps {
|
|
48
43
|
dryRun: boolean;
|
|
49
44
|
verbose: boolean;
|
|
@@ -16,7 +16,7 @@ exports.renderReadme = exports.renderTsConfig = exports.renderPackageJson = expo
|
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
18
18
|
const helpers_1 = require("./helpers");
|
|
19
|
-
const createStaticFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, signature, packageName,
|
|
19
|
+
const createStaticFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, signature, packageName, spectralVersion, verbose, sourceDir, destinationDir, registry, }) {
|
|
20
20
|
var _b, _c, _d, _e;
|
|
21
21
|
if (verbose) {
|
|
22
22
|
console.info("Creating static files...");
|
|
@@ -34,7 +34,7 @@ const createStaticFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ c
|
|
|
34
34
|
});
|
|
35
35
|
const packageJson = yield (0, exports.renderPackageJson)({
|
|
36
36
|
dryRun,
|
|
37
|
-
|
|
37
|
+
spectralVersion,
|
|
38
38
|
packageName,
|
|
39
39
|
verbose,
|
|
40
40
|
sourceDir,
|
|
@@ -104,14 +104,13 @@ const renderIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ compone
|
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
exports.renderIndex = renderIndex;
|
|
107
|
-
const renderPackageJson = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, packageName,
|
|
107
|
+
const renderPackageJson = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, packageName, spectralVersion, verbose, sourceDir, destinationDir, registry, }) {
|
|
108
108
|
return yield (0, createTemplate_1.createTemplate)({
|
|
109
109
|
source: path_1.default.join(sourceDir, "package.json.ejs"),
|
|
110
110
|
destination: path_1.default.join(destinationDir, "package.json"),
|
|
111
111
|
data: {
|
|
112
112
|
packageName,
|
|
113
|
-
spectralVersion
|
|
114
|
-
typescriptVersion: dependencies.devDependencies.typescript,
|
|
113
|
+
spectralVersion,
|
|
115
114
|
helpers: helpers_1.helpers,
|
|
116
115
|
registry,
|
|
117
116
|
},
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { Component } from "../../serverTypes";
|
|
2
2
|
import type { ConfigVarResultCollection, Inputs, TriggerPayload, TriggerResult } from "../../types";
|
|
3
|
-
import { type PackageDependencies } from "./createStaticFiles";
|
|
4
3
|
interface CreateComponentManifestProps<TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>> {
|
|
5
4
|
component: Component<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>;
|
|
6
5
|
dryRun: boolean;
|
|
7
6
|
skipSignatureVerify: boolean;
|
|
8
7
|
packageName: string;
|
|
9
|
-
|
|
8
|
+
spectralVersion: string;
|
|
10
9
|
verbose: boolean;
|
|
11
10
|
sourceDir: string;
|
|
12
11
|
destinationDir: string;
|
|
13
12
|
registry: string | null;
|
|
14
13
|
}
|
|
15
|
-
export declare const createComponentManifest: <TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>>({ component, dryRun, skipSignatureVerify, packageName,
|
|
14
|
+
export declare const createComponentManifest: <TInputs extends Inputs, TActionInputs extends Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TPayload extends TriggerPayload = TriggerPayload, TAllowsBranching extends boolean = boolean, TResult extends TriggerResult<TAllowsBranching, TPayload> = TriggerResult<TAllowsBranching, TPayload>>({ component, dryRun, skipSignatureVerify, packageName, spectralVersion, verbose, sourceDir, destinationDir, registry, }: CreateComponentManifestProps<TInputs, TActionInputs, TConfigVars, TPayload, TAllowsBranching, TResult>) => Promise<void>;
|
|
16
15
|
export {};
|
|
@@ -21,7 +21,7 @@ const createDataSources_1 = require("./createDataSources");
|
|
|
21
21
|
const createStaticFiles_1 = require("./createStaticFiles");
|
|
22
22
|
const createTriggers_1 = require("./createTriggers");
|
|
23
23
|
const removeComponentManifest_1 = require("./removeComponentManifest");
|
|
24
|
-
const createComponentManifest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, skipSignatureVerify, packageName,
|
|
24
|
+
const createComponentManifest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, skipSignatureVerify, packageName, spectralVersion, verbose, sourceDir, destinationDir, registry, }) {
|
|
25
25
|
const signature = yield (0, prism_1.getComponentSignatureWithPrism)({
|
|
26
26
|
skipSignatureVerify,
|
|
27
27
|
});
|
|
@@ -38,7 +38,7 @@ const createComponentManifest = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
38
38
|
dryRun,
|
|
39
39
|
packageName,
|
|
40
40
|
signature,
|
|
41
|
-
|
|
41
|
+
spectralVersion,
|
|
42
42
|
verbose,
|
|
43
43
|
sourceDir,
|
|
44
44
|
destinationDir,
|
package/dist/types/Inputs.d.ts
CHANGED
|
@@ -291,15 +291,19 @@ export type DateTimeInputField = BaseInputField & {
|
|
|
291
291
|
/** Clean function. */
|
|
292
292
|
clean?: InputCleanFunction<unknown>;
|
|
293
293
|
} & CollectionOptions<string>;
|
|
294
|
-
/** `InputFieldDefinition` minus container input types
|
|
295
|
-
*
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
294
|
+
/** `InputFieldDefinition` minus container input types and connection
|
|
295
|
+
* pickers. Connections resolve to config-var references outside the
|
|
296
|
+
* parent's value tree, so they're only valid at the top level — never as
|
|
297
|
+
* a child of a structuredObject or a dynamicObject configuration. */
|
|
298
|
+
export type LeafInputFieldDefinition = Exclude<InputFieldDefinition, StructuredObjectInputField | DynamicObjectInputField | ConnectionInputField | ConnectionTemplateInputField>;
|
|
299
|
+
/** `LeafInputFieldDefinition` plus `StructuredObjectInputField`; used
|
|
300
|
+
* inside a dynamicObject's `configurations.<key>.inputs` to allow leaves
|
|
301
|
+
* and structuredObject children while still rejecting nested
|
|
302
|
+
* dynamicObjects and connection pickers. */
|
|
303
|
+
export type StructuredOrLeafInputFieldDefinition = LeafInputFieldDefinition | StructuredObjectInputField;
|
|
301
304
|
/** Groups related primitive inputs under a single named container.
|
|
302
|
-
* Nesting is capped at one level.
|
|
305
|
+
* Nesting is capped at one level. Connection pickers are rejected as
|
|
306
|
+
* children — they may only appear at the top level. */
|
|
303
307
|
export type StructuredObjectInputField = Omit<BaseInputField, "dataSource"> & {
|
|
304
308
|
/** Data type the input will collect. */
|
|
305
309
|
type: "structuredObject";
|
|
@@ -317,9 +321,7 @@ export interface DynamicObjectConfiguration {
|
|
|
317
321
|
} | string;
|
|
318
322
|
/** Additional text to give guidance to the user when this configuration is selected. */
|
|
319
323
|
comments?: string;
|
|
320
|
-
/** Inputs that become available when this configuration is selected.
|
|
321
|
-
* include leaf inputs and structuredObject inputs; nested dynamicObjects
|
|
322
|
-
* are rejected at the type level. */
|
|
324
|
+
/** Inputs that become available when this configuration is selected. */
|
|
323
325
|
inputs: Record<string, StructuredOrLeafInputFieldDefinition>;
|
|
324
326
|
}
|
|
325
327
|
/** Presents a discriminated set of input groups; the user picks a configuration
|