@walkeros/cli 4.0.0 → 4.0.1-next-1778068549946
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/CHANGELOG.md +50 -0
- package/README.md +68 -9
- package/dist/cli.js +1155 -979
- package/dist/examples/README.md +3 -3
- package/dist/examples/flow-complete.json +4 -6
- package/dist/examples/flow-complete.md +8 -10
- package/dist/examples/index.js +4 -6
- package/dist/examples/index.js.map +1 -1
- package/dist/index.d.ts +6 -21
- package/dist/index.js +69 -27
- package/dist/index.js.map +1 -1
- package/examples/README.md +3 -3
- package/examples/flow-complete.json +4 -6
- package/examples/flow-complete.md +8 -10
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -745,6 +745,49 @@ var init_package_path = __esm({
|
|
|
745
745
|
}
|
|
746
746
|
});
|
|
747
747
|
|
|
748
|
+
// src/core/import-specifier.ts
|
|
749
|
+
var toFileImportSpecifier;
|
|
750
|
+
var init_import_specifier = __esm({
|
|
751
|
+
"src/core/import-specifier.ts"() {
|
|
752
|
+
"use strict";
|
|
753
|
+
toFileImportSpecifier = (absPath) => absPath.replace(/\\/g, "/");
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
// src/core/parse-component-ref.ts
|
|
758
|
+
function isAllowedPrefix(value, allowed) {
|
|
759
|
+
return allowed.includes(value);
|
|
760
|
+
}
|
|
761
|
+
function parseComponentRef(input, options) {
|
|
762
|
+
const { allowed, messages = {} } = options;
|
|
763
|
+
const allowedList = allowed.join(" | ");
|
|
764
|
+
const parts = input.split(".");
|
|
765
|
+
if (parts.length < 2) {
|
|
766
|
+
const msg = messages.invalidFormat ? messages.invalidFormat(input) : `Invalid target "${input}". Expected <kind>.<name> where kind is ${allowedList}.`;
|
|
767
|
+
throw new Error(msg);
|
|
768
|
+
}
|
|
769
|
+
const prefix = parts[0];
|
|
770
|
+
const name = parts[1];
|
|
771
|
+
if (!name) {
|
|
772
|
+
const msg = messages.missingName ? messages.missingName(input, prefix) : `Invalid target "${input}". Missing name after "${prefix}."`;
|
|
773
|
+
throw new Error(msg);
|
|
774
|
+
}
|
|
775
|
+
if (!isAllowedPrefix(prefix, allowed)) {
|
|
776
|
+
const msg = messages.invalidPrefix ? messages.invalidPrefix(prefix) : `Invalid kind "${prefix}". Expected ${allowedList}.`;
|
|
777
|
+
throw new Error(msg);
|
|
778
|
+
}
|
|
779
|
+
return {
|
|
780
|
+
prefix,
|
|
781
|
+
name,
|
|
782
|
+
rest: parts.slice(2)
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
var init_parse_component_ref = __esm({
|
|
786
|
+
"src/core/parse-component-ref.ts"() {
|
|
787
|
+
"use strict";
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
|
|
748
791
|
// src/core/index.ts
|
|
749
792
|
var init_core = __esm({
|
|
750
793
|
"src/core/index.ts"() {
|
|
@@ -763,6 +806,8 @@ var init_core = __esm({
|
|
|
763
806
|
init_sse();
|
|
764
807
|
init_event_validation();
|
|
765
808
|
init_package_path();
|
|
809
|
+
init_import_specifier();
|
|
810
|
+
init_parse_component_ref();
|
|
766
811
|
}
|
|
767
812
|
});
|
|
768
813
|
|
|
@@ -2369,7 +2414,8 @@ ${userCode}
|
|
|
2369
2414
|
export { startFlow };`;
|
|
2370
2415
|
}
|
|
2371
2416
|
function generateServerEntry(stage1Path, dataPayload) {
|
|
2372
|
-
|
|
2417
|
+
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
2418
|
+
return `import { startFlow, wireConfig } from '${stage1Specifier}';
|
|
2373
2419
|
|
|
2374
2420
|
const __configData = ${dataPayload};
|
|
2375
2421
|
|
|
@@ -2418,7 +2464,8 @@ function generateWebEntry(stage1Path, dataPayload, options = {}) {
|
|
|
2418
2464
|
env.document = env.document ?? (typeof document !== 'undefined' ? document : undefined);
|
|
2419
2465
|
}
|
|
2420
2466
|
}` : "";
|
|
2421
|
-
|
|
2467
|
+
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
2468
|
+
return `import { startFlow, wireConfig } from '${stage1Specifier}';
|
|
2422
2469
|
|
|
2423
2470
|
const __configData = ${dataPayload};
|
|
2424
2471
|
|
|
@@ -2505,7 +2552,8 @@ function generateWrapEntry(stage1Path, options = {}) {
|
|
|
2505
2552
|
env.document = env.document ?? (typeof document !== 'undefined' ? document : undefined);
|
|
2506
2553
|
}
|
|
2507
2554
|
}` : "";
|
|
2508
|
-
|
|
2555
|
+
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
2556
|
+
return `import { startFlow, wireConfig, __configData } from '${stage1Specifier}';
|
|
2509
2557
|
|
|
2510
2558
|
(async () => {${preflightBlock}
|
|
2511
2559
|
const config = wireConfig(__configData);${envBlock}
|
|
@@ -2513,7 +2561,8 @@ function generateWrapEntry(stage1Path, options = {}) {
|
|
|
2513
2561
|
})();`;
|
|
2514
2562
|
}
|
|
2515
2563
|
function generateWrapEntryServer(stage1Path) {
|
|
2516
|
-
|
|
2564
|
+
const stage1Specifier = toFileImportSpecifier(stage1Path);
|
|
2565
|
+
return `import { startFlow, wireConfig, __configData } from '${stage1Specifier}';
|
|
2517
2566
|
|
|
2518
2567
|
export default async function(context = {}) {
|
|
2519
2568
|
const config = wireConfig(__configData);
|
|
@@ -2610,6 +2659,7 @@ var init_bundler = __esm({
|
|
|
2610
2659
|
init_config_classifier();
|
|
2611
2660
|
init_package_manager();
|
|
2612
2661
|
init_tmp();
|
|
2662
|
+
init_import_specifier();
|
|
2613
2663
|
init_build_cache();
|
|
2614
2664
|
VALID_JS_IDENTIFIER = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
2615
2665
|
}
|
|
@@ -3123,6 +3173,8 @@ import {
|
|
|
3123
3173
|
} from "@walkeros/collector";
|
|
3124
3174
|
|
|
3125
3175
|
// src/commands/push/overrides.ts
|
|
3176
|
+
init_parse_component_ref();
|
|
3177
|
+
var STEP_KINDS = ["source", "destination", "transformer"];
|
|
3126
3178
|
function buildOverrides(flags, flowConfig) {
|
|
3127
3179
|
const simulateFlags = flags.simulate ?? [];
|
|
3128
3180
|
const mockFlags = flags.mock ?? [];
|
|
@@ -3217,32 +3269,22 @@ function buildOverrides(flags, flowConfig) {
|
|
|
3217
3269
|
return overrides;
|
|
3218
3270
|
}
|
|
3219
3271
|
function parseStep(step) {
|
|
3220
|
-
const
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
`Invalid step format: "${
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
);
|
|
3231
|
-
}
|
|
3232
|
-
const name = parts[1];
|
|
3233
|
-
if (!name) {
|
|
3234
|
-
throw new Error(
|
|
3235
|
-
`Invalid step format: "${step}". Missing name after "${prefix}."`
|
|
3236
|
-
);
|
|
3237
|
-
}
|
|
3238
|
-
if (parts.length >= 4) {
|
|
3239
|
-
const chainType = parts[2];
|
|
3272
|
+
const { prefix, name, rest } = parseComponentRef(step, {
|
|
3273
|
+
allowed: STEP_KINDS,
|
|
3274
|
+
messages: {
|
|
3275
|
+
invalidFormat: (input) => `Invalid step format: "${input}". Expected "source.NAME" or "destination.NAME"`,
|
|
3276
|
+
invalidPrefix: (p) => `Unsupported step type: "${p}". Use "source", "destination", or "transformer"`,
|
|
3277
|
+
missingName: (input, p) => `Invalid step format: "${input}". Missing name after "${p}."`
|
|
3278
|
+
}
|
|
3279
|
+
});
|
|
3280
|
+
if (rest.length >= 2) {
|
|
3281
|
+
const chainType = rest[0];
|
|
3240
3282
|
if (chainType !== "before" && chainType !== "next") {
|
|
3241
3283
|
throw new Error(
|
|
3242
3284
|
`Invalid chain type: "${chainType}". Use "before" or "next"`
|
|
3243
3285
|
);
|
|
3244
3286
|
}
|
|
3245
|
-
const transformerId =
|
|
3287
|
+
const transformerId = rest[1];
|
|
3246
3288
|
if (!transformerId) {
|
|
3247
3289
|
throw new Error(
|
|
3248
3290
|
`Invalid step format: "${step}". Missing transformer name after "${chainType}."`
|
|
@@ -3250,7 +3292,7 @@ function parseStep(step) {
|
|
|
3250
3292
|
}
|
|
3251
3293
|
return { type: prefix, name, chainType, transformerId };
|
|
3252
3294
|
}
|
|
3253
|
-
if (
|
|
3295
|
+
if (rest.length === 1) {
|
|
3254
3296
|
throw new Error(
|
|
3255
3297
|
`Invalid step format: "${step}". Specify a transformer: "${step}.TRANSFORMER_NAME"`
|
|
3256
3298
|
);
|
|
@@ -5871,7 +5913,7 @@ function validateMapping(input) {
|
|
|
5871
5913
|
// src/commands/validate/validators/entry.ts
|
|
5872
5914
|
import Ajv from "ajv";
|
|
5873
5915
|
import { fetchPackageSchema } from "@walkeros/core";
|
|
5874
|
-
var CLIENT_HEADER = "walkeros-cli/4.0.
|
|
5916
|
+
var CLIENT_HEADER = "walkeros-cli/4.0.1-next-1778068549946";
|
|
5875
5917
|
var SECTIONS = ["destinations", "sources", "transformers"];
|
|
5876
5918
|
function resolveEntry(path19, flowConfig) {
|
|
5877
5919
|
const flows = flowConfig.flows;
|