Skip to content

Commit 5f76428

Browse files
committed
refactor: rename cellInColumn to .
1 parent 0875fa8 commit 5f76428

28 files changed

Lines changed: 198 additions & 199 deletions

apps/interpreter/test/assets/broken-model.jv

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ pipeline CarsPipeline {
4848
to car oftype Car;
4949

5050
car: {
51-
name: asText (r cellInColumn "name"),
52-
mpg: asDecimal (r cellInColumn "mpg"),
53-
cyl: asInteger (r cellInColumn 2),
54-
disp: asDecimal (r cellInColumn 3),
55-
hp: asInteger (r cellInColumn "hp"),
56-
drat: asDecimal (r cellInColumn "drat"),
57-
wt: asDecimal (r cellInColumn "wt"),
58-
qsec: asDecimal (r cellInColumn "qsec"),
59-
vs: asInteger (r cellInColumn "vs"),
60-
am: asInteger (r cellInColumn "am"),
61-
gear: asInteger (r cellInColumn "gear"),
62-
carb: asInteger (r cellInColumn "carb")
51+
name: asText (r . "name"),
52+
mpg: asDecimal (r . "mpg"),
53+
cyl: asInteger (r . 2),
54+
disp: asDecimal (r . 3),
55+
hp: asInteger (r . "hp"),
56+
drat: asDecimal (r . "drat"),
57+
wt: asDecimal (r . "wt"),
58+
qsec: asDecimal (r . "qsec"),
59+
vs: asInteger (r . "vs"),
60+
am: asInteger (r . "am"),
61+
gear: asInteger (r . "gear"),
62+
carb: asInteger (r . "carb")
6363
};
6464
}
6565

example/cars.jv

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ pipeline CarsPipeline {
9393
to car oftype Car;
9494

9595
car: {
96-
name: asText (r cellInColumn "name"),
97-
mpg: asDecimal (r cellInColumn "mpg"),
98-
cyl: asInteger (r cellInColumn 2),
99-
disp: asDecimal (r cellInColumn 3),
100-
hp: asInteger (r cellInColumn "hp"),
101-
drat: asDecimal (r cellInColumn "drat"),
102-
wt: asDecimal (r cellInColumn "wt"),
103-
qsec: asDecimal (r cellInColumn "qsec"),
104-
vs: asInteger (r cellInColumn "vs"),
105-
am: asInteger (r cellInColumn "am"),
106-
gear: asInteger (r cellInColumn "gear"),
107-
carb: asInteger (r cellInColumn "carb")
96+
name: asText (r."name"),
97+
mpg: asDecimal (r . "mpg"),
98+
cyl: asInteger (r.2),
99+
disp: asDecimal (r . 3),
100+
hp: asInteger (r . "hp"),
101+
drat: asDecimal (r . "drat"),
102+
wt: asDecimal (r . "wt"),
103+
qsec: asDecimal (r . "qsec"),
104+
vs: asInteger (r . "vs"),
105+
am: asInteger (r . "am"),
106+
gear: asInteger (r . "gear"),
107+
carb: asInteger (r . "carb")
108108
};
109109
}
110110

example/electric-vehicles.jv

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,23 @@ pipeline ElectricVehiclesPipeline {
7474
to ev oftype ElectricVehicle;
7575

7676
ev: {
77-
vin: r cellInColumn "VIN (1-10)",
78-
county: asText (r cellInColumn "County"),
79-
city: asText (r cellInColumn "City"),
80-
state: asText (r cellInColumn "State"),
81-
postal: asText (r cellInColumn "Postal Code"),
82-
modelYear: asInteger (r cellInColumn "Model Year"),
83-
make: asText (r cellInColumn "Make"),
84-
model: asText (r cellInColumn "Model"),
85-
evType: asText (r cellInColumn "Electric Vehicle Type"),
86-
cafvEligibility: asText (r cellInColumn "Clean Alternative Fuel Vehicle (CAFV) Eligibility"),
87-
electricRange: asInteger (r cellInColumn "Electric Range"),
88-
baseMSRP: asInteger (r cellInColumn "Base MSRP"),
89-
legislativeDistrict: asText (r cellInColumn "LegislativeDistrict"),
90-
dolID: asInteger (r cellInColumn "DOL Vehicle ID"),
91-
location: asText (r cellInColumn "Vehicle Location"),
92-
utility: asText (r cellInColumn "Electric Utility"),
93-
censusTract: asText (r cellInColumn "2020 Census Tract"),
77+
vin: r . "VIN (1-10)",
78+
county: asText (r . "County"),
79+
city: asText (r . "City"),
80+
state: asText (r . "State"),
81+
postal: asText (r . "Postal Code"),
82+
modelYear: asInteger (r . "Model Year"),
83+
make: asText (r . "Make"),
84+
model: asText (r . "Model"),
85+
evType: asText (r . "Electric Vehicle Type"),
86+
cafvEligibility: asText (r . "Clean Alternative Fuel Vehicle (CAFV) Eligibility"),
87+
electricRange: asInteger (r . "Electric Range"),
88+
baseMSRP: asInteger (r . "Base MSRP"),
89+
legislativeDistrict: asText (r . "LegislativeDistrict"),
90+
dolID: asInteger (r . "DOL Vehicle ID"),
91+
location: asText (r . "Vehicle Location"),
92+
utility: asText (r . "Electric Utility"),
93+
censusTract: asText (r . "2020 Census Tract"),
9494
};
9595
}
9696

example/gtfs-rt.jv

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ pipeline GtfsRTSimplePipeline {
7575
to tripUpdate oftype TripUpdate;
7676

7777
tripUpdate: {
78-
headerGtfsRealtimeVersion: r cellInColumn "header.gtfs_realtime_version",
79-
headerTimestamp: r cellInColumn "header.timestamp",
80-
headerIncrementality: r cellInColumn "header.incrementality",
81-
entityId: r cellInColumn "entity.id",
82-
entityTripUpdateTripTripId: r cellInColumn "entity.trip_update.trip.trip_id",
83-
entityTripUpdateTripRouteId: r cellInColumn "entity.trip_update.trip.route_id",
84-
entityTripUpdateStopTimeUpdateStopSequence: r cellInColumn "entity.trip_update.stop_time_update.stop_sequence",
85-
entityTripUpdateStopTimeUpdateStopId: r cellInColumn "entity.trip_update.stop_time_update.stop_id",
86-
entityTripUpdateStopTimeUpdateArrivalTime: r cellInColumn "entity.trip_update.stop_time_update.arrival.time",
87-
entityTripUpdateStopTimeUpdateDepartureTime: r cellInColumn "entity.trip_update.stop_time_update.departure.time",
78+
headerGtfsRealtimeVersion: r . "header.gtfs_realtime_version",
79+
headerTimestamp: r . "header.timestamp",
80+
headerIncrementality: r . "header.incrementality",
81+
entityId: r . "entity.id",
82+
entityTripUpdateTripTripId: r . "entity.trip_update.trip.trip_id",
83+
entityTripUpdateTripRouteId: r . "entity.trip_update.trip.route_id",
84+
entityTripUpdateStopTimeUpdateStopSequence: r . "entity.trip_update.stop_time_update.stop_sequence",
85+
entityTripUpdateStopTimeUpdateStopId: r . "entity.trip_update.stop_time_update.stop_id",
86+
entityTripUpdateStopTimeUpdateArrivalTime: r . "entity.trip_update.stop_time_update.arrival.time",
87+
entityTripUpdateStopTimeUpdateDepartureTime: r . "entity.trip_update.stop_time_update.departure.time",
8888
};
8989
}
9090
block TripUpdateTableInterpreter oftype TableInterpreter {
@@ -111,16 +111,16 @@ pipeline GtfsRTSimplePipeline {
111111
to vehiclePosition oftype VehiclePosition;
112112

113113
vehiclePosition: {
114-
headerGtfsRealtimeVersion: r cellInColumn "header.gtfs_realtime_version",
115-
headerTimestamp: r cellInColumn "header.timestamp",
116-
headerIncrementality: r cellInColumn "header.incrementality",
117-
entityId: r cellInColumn "entity.id",
118-
entityVehiclePositionVehicleDescriptorId: r cellInColumn "entity.vehicle_position.vehicle_descriptor.id",
119-
entityVehiclePositionTripTripId: r cellInColumn "entity.vehicle_position.trip.trip_id",
120-
entityVehiclePositionTripRouteId: r cellInColumn "entity.vehicle_position.trip.route_id",
121-
entityVehiclePositionPositionLatitude: r cellInColumn "entity.vehicle_position.position.latitude",
122-
entityVehiclePositionPositionLongitude: r cellInColumn "entity.vehicle_position.position.longitude",
123-
entityVehiclePositionTimestamp: r cellInColumn "entity.vehicle_position.timestamp",
114+
headerGtfsRealtimeVersion: r . "header.gtfs_realtime_version",
115+
headerTimestamp: r . "header.timestamp",
116+
headerIncrementality: r . "header.incrementality",
117+
entityId: r . "entity.id",
118+
entityVehiclePositionVehicleDescriptorId: r . "entity.vehicle_position.vehicle_descriptor.id",
119+
entityVehiclePositionTripTripId: r . "entity.vehicle_position.trip.trip_id",
120+
entityVehiclePositionTripRouteId: r . "entity.vehicle_position.trip.route_id",
121+
entityVehiclePositionPositionLatitude: r . "entity.vehicle_position.position.latitude",
122+
entityVehiclePositionPositionLongitude: r . "entity.vehicle_position.position.longitude",
123+
entityVehiclePositionTimestamp: r . "entity.vehicle_position.timestamp",
124124
};
125125
}
126126
block VehiclePositionTableInterpreter oftype TableInterpreter {
@@ -144,13 +144,13 @@ pipeline GtfsRTSimplePipeline {
144144
to alert oftype Alert;
145145

146146
alert: {
147-
headerGtfsRealtimeVersion: r cellInColumn "header.gtfs_realtime_version",
148-
headerTimestamp: r cellInColumn "header.timestamp",
149-
headerIncrementality: r cellInColumn "header.incrementality",
150-
entityId: r cellInColumn "entity.id",
151-
entityAlertInformedEntityRouteId: r cellInColumn "entity.alert.informed_entity.route_id",
152-
entityAlertHeaderText: r cellInColumn "entity.alert.header_text",
153-
entityAlertDescriptionText: r cellInColumn "entity.alert.description_text",
147+
headerGtfsRealtimeVersion: r . "header.gtfs_realtime_version",
148+
headerTimestamp: r . "header.timestamp",
149+
headerIncrementality: r . "header.incrementality",
150+
entityId: r . "entity.id",
151+
entityAlertInformedEntityRouteId: r . "entity.alert.informed_entity.route_id",
152+
entityAlertHeaderText: r . "entity.alert.header_text",
153+
entityAlertDescriptionText: r . "entity.alert.description_text",
154154
};
155155
}
156156
block AlertTableInterpreter oftype TableInterpreter {

libs/execution/src/lib/transforms/transform-executor.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { strict as assert } from 'assert';
77

88
import {
99
ERROR_TYPEGUARD,
10+
onlyElementOrUndefined,
1011
type InternalErrorValueRepresentation,
1112
type InternalValidValueRepresentation,
1213
InvalidValue,
@@ -64,9 +65,9 @@ export class TransformExecutor {
6465

6566
getOutputAssignment(): TransformOutputAssignment {
6667
const outputAssignments = this.transform.body.outputAssignments;
67-
assert(outputAssignments.length === 1);
68-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
69-
return outputAssignments[0]!;
68+
const outputAssignment = onlyElementOrUndefined(outputAssignments);
69+
assert(outputAssignment !== undefined);
70+
return outputAssignment;
7071
}
7172

7273
executeTransform(

libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-capitalized-header.jv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pipeline TestPipeline {
1717
from r oftype Collection<text>;
1818
to t oftype TestValueType;
1919

20-
t: { Index: asInteger (r cellInColumn "Index"), Name: r cellInColumn "Name", Flag: asBoolean (r cellInColumn "Flag") };
20+
t: { Index: asInteger (r . "Index"), Name: r . "Name", Flag: asBoolean (r . "Flag") };
2121
}
2222

2323
block TestBlock oftype TableInterpreter {

libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-with-header.jv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pipeline TestPipeline {
1717
from r oftype Collection<text>;
1818
to t oftype TestValueType;
1919

20-
t: { index: asInteger (r cellInColumn "index"), name: r cellInColumn "name", flag: asBoolean (r cellInColumn "flag") };
20+
t: { index: asInteger (r . "index"), name: r . "name", flag: asBoolean (r . "flag") };
2121
}
2222

2323
block TestBlock oftype TableInterpreter {

libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-without-header.jv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ pipeline TestPipeline {
1717
from r oftype Collection<text>;
1818
to t oftype TestValueType;
1919

20-
t: { index: asInteger (r cellInColumn 0), name: r cellInColumn 1, flag:
21-
asBoolean (r cellInColumn 2) };
20+
t: { index: asInteger (r . 0), name: r . 1, flag:
21+
asBoolean (r . 2) };
2222
}
2323

2424
block TestBlock oftype TableInterpreter {

libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-value-type-with-header.jv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pipeline TestPipeline {
1717
from r oftype Collection<text>;
1818
to t oftype TestValueType;
1919

20-
t: { index: asInteger (r cellInColumn "index"), name: r cellInColumn "name", flag: asBoolean (r cellInColumn "flag") };
20+
t: { index: asInteger (r . "index"), name: r . "name", flag: asBoolean (r . "flag") };
2121
}
2222

2323
block TestBlock oftype TableInterpreter {

libs/extensions/tabular/exec/test/assets/table-interpreter-executor/valid-wrong-value-type-without-header.jv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ pipeline TestPipeline {
1717
from r oftype Collection<text>;
1818
to t oftype TestValueType;
1919

20-
t: { index: asInteger (r cellInColumn 0), name: r cellInColumn 1, flag:
21-
asBoolean (r cellInColumn 2) };
20+
t: { index: asInteger (r . 0), name: r . 1, flag:
21+
asBoolean (r . 2) };
2222
}
2323

2424
block TestBlock oftype TableInterpreter {

0 commit comments

Comments
 (0)