webpipe-js 2.0.9 → 2.0.10
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/index.cjs +51 -50
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +51 -50
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -463,40 +463,6 @@ var Parser = class {
|
|
|
463
463
|
if (dispatchStep) return dispatchStep;
|
|
464
464
|
return this.parseRegularStep();
|
|
465
465
|
}
|
|
466
|
-
parseDispatchStep() {
|
|
467
|
-
this.skipWhitespaceOnly();
|
|
468
|
-
this.expect("|>");
|
|
469
|
-
this.skipInlineSpaces();
|
|
470
|
-
this.expect("dispatch");
|
|
471
|
-
this.skipSpaces();
|
|
472
|
-
const cases = [];
|
|
473
|
-
while (true) {
|
|
474
|
-
const dispatchCase = this.tryParse(() => this.parseDispatchCase());
|
|
475
|
-
if (!dispatchCase) break;
|
|
476
|
-
cases.push(dispatchCase);
|
|
477
|
-
}
|
|
478
|
-
const defaultBranch = this.tryParse(() => this.parseDispatchDefault());
|
|
479
|
-
return { kind: "Dispatch", cases, default: defaultBranch || void 0 };
|
|
480
|
-
}
|
|
481
|
-
parseDispatchCase() {
|
|
482
|
-
this.skipSpaces();
|
|
483
|
-
this.expect("case");
|
|
484
|
-
this.skipInlineSpaces();
|
|
485
|
-
const condition = this.parseTag();
|
|
486
|
-
this.skipInlineSpaces();
|
|
487
|
-
this.expect(":");
|
|
488
|
-
this.skipSpaces();
|
|
489
|
-
const pipeline = this.parsePipeline();
|
|
490
|
-
return { condition, pipeline };
|
|
491
|
-
}
|
|
492
|
-
parseDispatchDefault() {
|
|
493
|
-
this.skipSpaces();
|
|
494
|
-
this.expect("default");
|
|
495
|
-
this.skipInlineSpaces();
|
|
496
|
-
this.expect(":");
|
|
497
|
-
this.skipSpaces();
|
|
498
|
-
return this.parsePipeline();
|
|
499
|
-
}
|
|
500
466
|
parseRegularStep() {
|
|
501
467
|
this.skipWhitespaceOnly();
|
|
502
468
|
this.expect("|>");
|
|
@@ -593,6 +559,41 @@ var Parser = class {
|
|
|
593
559
|
});
|
|
594
560
|
return { kind: "If", condition, thenBranch, elseBranch: elseBranch || void 0 };
|
|
595
561
|
}
|
|
562
|
+
parseDispatchStep() {
|
|
563
|
+
this.skipWhitespaceOnly();
|
|
564
|
+
this.expect("|>");
|
|
565
|
+
this.skipInlineSpaces();
|
|
566
|
+
this.expect("dispatch");
|
|
567
|
+
this.skipSpaces();
|
|
568
|
+
const branches = [];
|
|
569
|
+
while (true) {
|
|
570
|
+
const branch = this.tryParse(() => this.parseDispatchBranch());
|
|
571
|
+
if (!branch) break;
|
|
572
|
+
branches.push(branch);
|
|
573
|
+
this.skipSpaces();
|
|
574
|
+
}
|
|
575
|
+
const defaultBranch = this.tryParse(() => {
|
|
576
|
+
this.expect("default:");
|
|
577
|
+
this.skipSpaces();
|
|
578
|
+
return this.parseIfPipeline("end");
|
|
579
|
+
});
|
|
580
|
+
this.skipSpaces();
|
|
581
|
+
this.tryParse(() => {
|
|
582
|
+
this.expect("end");
|
|
583
|
+
return true;
|
|
584
|
+
});
|
|
585
|
+
return { kind: "Dispatch", branches, default: defaultBranch || void 0 };
|
|
586
|
+
}
|
|
587
|
+
parseDispatchBranch() {
|
|
588
|
+
this.skipSpaces();
|
|
589
|
+
this.expect("case");
|
|
590
|
+
this.skipInlineSpaces();
|
|
591
|
+
const tag = this.parseTag();
|
|
592
|
+
this.expect(":");
|
|
593
|
+
this.skipSpaces();
|
|
594
|
+
const pipeline = this.parseIfPipeline("case", "default:", "end");
|
|
595
|
+
return { tag, pipeline };
|
|
596
|
+
}
|
|
596
597
|
parseIfPipeline(...stopKeywords) {
|
|
597
598
|
const steps = [];
|
|
598
599
|
while (true) {
|
|
@@ -1126,22 +1127,7 @@ function formatPipelineStep(step, indent = " ") {
|
|
|
1126
1127
|
});
|
|
1127
1128
|
});
|
|
1128
1129
|
return lines.join("\n");
|
|
1129
|
-
} else if (step.kind === "
|
|
1130
|
-
const lines = [`${indent}|> dispatch`];
|
|
1131
|
-
step.cases.forEach((dispatchCase) => {
|
|
1132
|
-
lines.push(`${indent} case ${formatTag(dispatchCase.condition)}:`);
|
|
1133
|
-
dispatchCase.pipeline.steps.forEach((caseStep) => {
|
|
1134
|
-
lines.push(formatPipelineStep(caseStep, indent + " "));
|
|
1135
|
-
});
|
|
1136
|
-
});
|
|
1137
|
-
if (step.default) {
|
|
1138
|
-
lines.push(`${indent} default:`);
|
|
1139
|
-
step.default.steps.forEach((defaultStep) => {
|
|
1140
|
-
lines.push(formatPipelineStep(defaultStep, indent + " "));
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
return lines.join("\n");
|
|
1144
|
-
} else {
|
|
1130
|
+
} else if (step.kind === "If") {
|
|
1145
1131
|
const lines = [`${indent}|> if`];
|
|
1146
1132
|
step.condition.steps.forEach((condStep) => {
|
|
1147
1133
|
lines.push(formatPipelineStep(condStep, indent + " "));
|
|
@@ -1157,6 +1143,21 @@ function formatPipelineStep(step, indent = " ") {
|
|
|
1157
1143
|
});
|
|
1158
1144
|
}
|
|
1159
1145
|
return lines.join("\n");
|
|
1146
|
+
} else {
|
|
1147
|
+
const lines = [`${indent}|> dispatch`];
|
|
1148
|
+
step.branches.forEach((branch) => {
|
|
1149
|
+
lines.push(`${indent} case ${formatTag(branch.tag)}:`);
|
|
1150
|
+
branch.pipeline.steps.forEach((branchStep) => {
|
|
1151
|
+
lines.push(formatPipelineStep(branchStep, indent + " "));
|
|
1152
|
+
});
|
|
1153
|
+
});
|
|
1154
|
+
if (step.default) {
|
|
1155
|
+
lines.push(`${indent} default:`);
|
|
1156
|
+
step.default.steps.forEach((defaultStep) => {
|
|
1157
|
+
lines.push(formatPipelineStep(defaultStep, indent + " "));
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
return lines.join("\n");
|
|
1160
1161
|
}
|
|
1161
1162
|
}
|
|
1162
1163
|
function formatStepConfig(config, configType) {
|
package/dist/index.d.cts
CHANGED
|
@@ -110,11 +110,11 @@ type PipelineStep = {
|
|
|
110
110
|
elseBranch?: Pipeline;
|
|
111
111
|
} | {
|
|
112
112
|
kind: 'Dispatch';
|
|
113
|
-
|
|
113
|
+
branches: DispatchBranch[];
|
|
114
114
|
default?: Pipeline;
|
|
115
115
|
};
|
|
116
|
-
interface
|
|
117
|
-
|
|
116
|
+
interface DispatchBranch {
|
|
117
|
+
tag: Tag;
|
|
118
118
|
pipeline: Pipeline;
|
|
119
119
|
}
|
|
120
120
|
interface ResultBranch {
|
|
@@ -208,4 +208,4 @@ declare function formatTag(tag: Tag): string;
|
|
|
208
208
|
declare function formatPipelineRef(ref: PipelineRef): string[];
|
|
209
209
|
declare function formatWhen(when: When): string;
|
|
210
210
|
|
|
211
|
-
export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type
|
|
211
|
+
export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type GraphQLSchema, type It, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type Tag, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTags, formatWhen, getPipelineRanges, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printVariable };
|
package/dist/index.d.ts
CHANGED
|
@@ -110,11 +110,11 @@ type PipelineStep = {
|
|
|
110
110
|
elseBranch?: Pipeline;
|
|
111
111
|
} | {
|
|
112
112
|
kind: 'Dispatch';
|
|
113
|
-
|
|
113
|
+
branches: DispatchBranch[];
|
|
114
114
|
default?: Pipeline;
|
|
115
115
|
};
|
|
116
|
-
interface
|
|
117
|
-
|
|
116
|
+
interface DispatchBranch {
|
|
117
|
+
tag: Tag;
|
|
118
118
|
pipeline: Pipeline;
|
|
119
119
|
}
|
|
120
120
|
interface ResultBranch {
|
|
@@ -208,4 +208,4 @@ declare function formatTag(tag: Tag): string;
|
|
|
208
208
|
declare function formatPipelineRef(ref: PipelineRef): string[];
|
|
209
209
|
declare function formatWhen(when: When): string;
|
|
210
210
|
|
|
211
|
-
export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type
|
|
211
|
+
export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type GraphQLSchema, type It, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type Tag, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTags, formatWhen, getPipelineRanges, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printVariable };
|
package/dist/index.mjs
CHANGED
|
@@ -414,40 +414,6 @@ var Parser = class {
|
|
|
414
414
|
if (dispatchStep) return dispatchStep;
|
|
415
415
|
return this.parseRegularStep();
|
|
416
416
|
}
|
|
417
|
-
parseDispatchStep() {
|
|
418
|
-
this.skipWhitespaceOnly();
|
|
419
|
-
this.expect("|>");
|
|
420
|
-
this.skipInlineSpaces();
|
|
421
|
-
this.expect("dispatch");
|
|
422
|
-
this.skipSpaces();
|
|
423
|
-
const cases = [];
|
|
424
|
-
while (true) {
|
|
425
|
-
const dispatchCase = this.tryParse(() => this.parseDispatchCase());
|
|
426
|
-
if (!dispatchCase) break;
|
|
427
|
-
cases.push(dispatchCase);
|
|
428
|
-
}
|
|
429
|
-
const defaultBranch = this.tryParse(() => this.parseDispatchDefault());
|
|
430
|
-
return { kind: "Dispatch", cases, default: defaultBranch || void 0 };
|
|
431
|
-
}
|
|
432
|
-
parseDispatchCase() {
|
|
433
|
-
this.skipSpaces();
|
|
434
|
-
this.expect("case");
|
|
435
|
-
this.skipInlineSpaces();
|
|
436
|
-
const condition = this.parseTag();
|
|
437
|
-
this.skipInlineSpaces();
|
|
438
|
-
this.expect(":");
|
|
439
|
-
this.skipSpaces();
|
|
440
|
-
const pipeline = this.parsePipeline();
|
|
441
|
-
return { condition, pipeline };
|
|
442
|
-
}
|
|
443
|
-
parseDispatchDefault() {
|
|
444
|
-
this.skipSpaces();
|
|
445
|
-
this.expect("default");
|
|
446
|
-
this.skipInlineSpaces();
|
|
447
|
-
this.expect(":");
|
|
448
|
-
this.skipSpaces();
|
|
449
|
-
return this.parsePipeline();
|
|
450
|
-
}
|
|
451
417
|
parseRegularStep() {
|
|
452
418
|
this.skipWhitespaceOnly();
|
|
453
419
|
this.expect("|>");
|
|
@@ -544,6 +510,41 @@ var Parser = class {
|
|
|
544
510
|
});
|
|
545
511
|
return { kind: "If", condition, thenBranch, elseBranch: elseBranch || void 0 };
|
|
546
512
|
}
|
|
513
|
+
parseDispatchStep() {
|
|
514
|
+
this.skipWhitespaceOnly();
|
|
515
|
+
this.expect("|>");
|
|
516
|
+
this.skipInlineSpaces();
|
|
517
|
+
this.expect("dispatch");
|
|
518
|
+
this.skipSpaces();
|
|
519
|
+
const branches = [];
|
|
520
|
+
while (true) {
|
|
521
|
+
const branch = this.tryParse(() => this.parseDispatchBranch());
|
|
522
|
+
if (!branch) break;
|
|
523
|
+
branches.push(branch);
|
|
524
|
+
this.skipSpaces();
|
|
525
|
+
}
|
|
526
|
+
const defaultBranch = this.tryParse(() => {
|
|
527
|
+
this.expect("default:");
|
|
528
|
+
this.skipSpaces();
|
|
529
|
+
return this.parseIfPipeline("end");
|
|
530
|
+
});
|
|
531
|
+
this.skipSpaces();
|
|
532
|
+
this.tryParse(() => {
|
|
533
|
+
this.expect("end");
|
|
534
|
+
return true;
|
|
535
|
+
});
|
|
536
|
+
return { kind: "Dispatch", branches, default: defaultBranch || void 0 };
|
|
537
|
+
}
|
|
538
|
+
parseDispatchBranch() {
|
|
539
|
+
this.skipSpaces();
|
|
540
|
+
this.expect("case");
|
|
541
|
+
this.skipInlineSpaces();
|
|
542
|
+
const tag = this.parseTag();
|
|
543
|
+
this.expect(":");
|
|
544
|
+
this.skipSpaces();
|
|
545
|
+
const pipeline = this.parseIfPipeline("case", "default:", "end");
|
|
546
|
+
return { tag, pipeline };
|
|
547
|
+
}
|
|
547
548
|
parseIfPipeline(...stopKeywords) {
|
|
548
549
|
const steps = [];
|
|
549
550
|
while (true) {
|
|
@@ -1077,22 +1078,7 @@ function formatPipelineStep(step, indent = " ") {
|
|
|
1077
1078
|
});
|
|
1078
1079
|
});
|
|
1079
1080
|
return lines.join("\n");
|
|
1080
|
-
} else if (step.kind === "
|
|
1081
|
-
const lines = [`${indent}|> dispatch`];
|
|
1082
|
-
step.cases.forEach((dispatchCase) => {
|
|
1083
|
-
lines.push(`${indent} case ${formatTag(dispatchCase.condition)}:`);
|
|
1084
|
-
dispatchCase.pipeline.steps.forEach((caseStep) => {
|
|
1085
|
-
lines.push(formatPipelineStep(caseStep, indent + " "));
|
|
1086
|
-
});
|
|
1087
|
-
});
|
|
1088
|
-
if (step.default) {
|
|
1089
|
-
lines.push(`${indent} default:`);
|
|
1090
|
-
step.default.steps.forEach((defaultStep) => {
|
|
1091
|
-
lines.push(formatPipelineStep(defaultStep, indent + " "));
|
|
1092
|
-
});
|
|
1093
|
-
}
|
|
1094
|
-
return lines.join("\n");
|
|
1095
|
-
} else {
|
|
1081
|
+
} else if (step.kind === "If") {
|
|
1096
1082
|
const lines = [`${indent}|> if`];
|
|
1097
1083
|
step.condition.steps.forEach((condStep) => {
|
|
1098
1084
|
lines.push(formatPipelineStep(condStep, indent + " "));
|
|
@@ -1108,6 +1094,21 @@ function formatPipelineStep(step, indent = " ") {
|
|
|
1108
1094
|
});
|
|
1109
1095
|
}
|
|
1110
1096
|
return lines.join("\n");
|
|
1097
|
+
} else {
|
|
1098
|
+
const lines = [`${indent}|> dispatch`];
|
|
1099
|
+
step.branches.forEach((branch) => {
|
|
1100
|
+
lines.push(`${indent} case ${formatTag(branch.tag)}:`);
|
|
1101
|
+
branch.pipeline.steps.forEach((branchStep) => {
|
|
1102
|
+
lines.push(formatPipelineStep(branchStep, indent + " "));
|
|
1103
|
+
});
|
|
1104
|
+
});
|
|
1105
|
+
if (step.default) {
|
|
1106
|
+
lines.push(`${indent} default:`);
|
|
1107
|
+
step.default.steps.forEach((defaultStep) => {
|
|
1108
|
+
lines.push(formatPipelineStep(defaultStep, indent + " "));
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
return lines.join("\n");
|
|
1111
1112
|
}
|
|
1112
1113
|
}
|
|
1113
1114
|
function formatStepConfig(config, configType) {
|