@tabnas/transduce 0.1.1 → 0.2.0
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/README.md +18 -0
- package/dist/guard.d.ts +1 -3
- package/dist/guard.js +8 -9
- package/dist/guard.js.map +1 -1
- package/dist/lines.d.ts +1 -2
- package/dist/lines.js +46 -89
- package/dist/lines.js.map +1 -1
- package/dist/matcher.d.ts +1 -3
- package/dist/matcher.js +12 -13
- package/dist/matcher.js.map +1 -1
- package/dist/parser-source.d.ts +1 -2
- package/dist/parser-source.js +11 -13
- package/dist/parser-source.js.map +1 -1
- package/dist/route.d.ts +1 -32
- package/dist/route.js +8 -32
- package/dist/route.js.map +1 -1
- package/dist/routers.d.ts +2 -0
- package/dist/routers.js +24 -0
- package/dist/routers.js.map +1 -0
- package/dist/rule-events.d.ts +1 -4
- package/dist/rule-events.js +40 -44
- package/dist/rule-events.js.map +1 -1
- package/dist/scan.d.ts +1 -10
- package/dist/scan.js +4 -17
- package/dist/scan.js.map +1 -1
- package/dist/source.d.ts +1 -4
- package/dist/source.js +20 -22
- package/dist/source.js.map +1 -1
- package/dist/table-from-json.d.ts +1 -5
- package/dist/table-from-json.js +25 -29
- package/dist/table-from-json.js.map +1 -1
- package/dist/transduce.d.ts +23 -19
- package/dist/transduce.js +66 -56
- package/dist/transduce.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -4
- package/src/guard.ts +10 -4
- package/src/lines.ts +45 -6
- package/src/matcher.ts +1 -6
- package/src/parser-source.ts +2 -4
- package/src/route.ts +18 -70
- package/src/routers.ts +64 -0
- package/src/rule-events.ts +17 -7
- package/src/scan.ts +1 -19
- package/src/source.ts +12 -6
- package/src/table-from-json.ts +20 -9
- package/src/transduce.ts +36 -19
- package/dist/datum.d.ts +0 -64
- package/dist/datum.js +0 -391
- package/dist/datum.js.map +0 -1
- package/dist/error.d.ts +0 -43
- package/dist/error.js +0 -169
- package/dist/error.js.map +0 -1
- package/dist/event.d.ts +0 -56
- package/dist/event.js +0 -101
- package/dist/event.js.map +0 -1
- package/dist/json.d.ts +0 -4
- package/dist/json.js +0 -92
- package/dist/json.js.map +0 -1
- package/dist/limits.d.ts +0 -36
- package/dist/limits.js +0 -133
- package/dist/limits.js.map +0 -1
- package/dist/selector.d.ts +0 -40
- package/dist/selector.js +0 -154
- package/dist/selector.js.map +0 -1
- package/dist/sink.d.ts +0 -29
- package/dist/sink.js +0 -184
- package/dist/sink.js.map +0 -1
- package/dist/table.d.ts +0 -81
- package/dist/table.js +0 -141
- package/dist/table.js.map +0 -1
- package/dist/value.d.ts +0 -16
- package/dist/value.js +0 -96
- package/dist/value.js.map +0 -1
- package/src/datum.ts +0 -407
- package/src/error.ts +0 -198
- package/src/event.ts +0 -134
- package/src/json.ts +0 -82
- package/src/limits.ts +0 -165
- package/src/selector.ts +0 -191
- package/src/sink.ts +0 -199
- package/src/table.ts +0 -213
- package/src/value.ts +0 -93
package/dist/table-from-json.js
CHANGED
|
@@ -16,12 +16,8 @@ exports.TableFromJson = void 0;
|
|
|
16
16
|
// before `end`. Rows are projected into schema order by path, so the order
|
|
17
17
|
// of members inside a row never matters, and a number keeps the lexeme the
|
|
18
18
|
// source events carried.
|
|
19
|
-
const
|
|
20
|
-
const error_1 = require("./error");
|
|
21
|
-
const limits_1 = require("./limits");
|
|
19
|
+
const shared_1 = require("@tabnas/alchemy/shared");
|
|
22
20
|
const route_1 = require("./route");
|
|
23
|
-
const selector_1 = require("./selector");
|
|
24
|
-
const table_1 = require("./table");
|
|
25
21
|
// The route sink behind the transducer: it owns the schema state and the
|
|
26
22
|
// table sink.
|
|
27
23
|
class Core {
|
|
@@ -37,7 +33,7 @@ class Core {
|
|
|
37
33
|
}
|
|
38
34
|
bind(columns, from) {
|
|
39
35
|
if (columns.length > this.maxColumns) {
|
|
40
|
-
throw
|
|
36
|
+
throw shared_1.Fail.limit('max_columns', this.maxColumns, `${from} declares ${columns.length} columns, more than ${this.maxColumns}`);
|
|
41
37
|
}
|
|
42
38
|
this.columns.bound = columns;
|
|
43
39
|
}
|
|
@@ -52,19 +48,19 @@ class Core {
|
|
|
52
48
|
const columns = this.columns;
|
|
53
49
|
if ('metadata' !== columns.type) {
|
|
54
50
|
// The router only has a metadata capture when the binding selects one.
|
|
55
|
-
throw
|
|
51
|
+
throw shared_1.Fail.protocol('metadata was delivered to a static schema');
|
|
56
52
|
}
|
|
57
53
|
const at = selected.path.toString();
|
|
58
54
|
if (null !== columns.bound) {
|
|
59
|
-
throw new
|
|
55
|
+
throw new shared_1.Fail('INPUT_ORDER_VIOLATION', `the column metadata at ${at} was selected twice; a table has one schema`).atPath(at);
|
|
60
56
|
}
|
|
61
|
-
const value = selected.value ??
|
|
57
|
+
const value = selected.value ?? shared_1.Datum.null;
|
|
62
58
|
if ('array' !== value.type) {
|
|
63
|
-
throw
|
|
59
|
+
throw shared_1.Fail.input(`the column metadata at ${at} is not an array`).atPath(at);
|
|
64
60
|
}
|
|
65
61
|
const descriptors = value.items;
|
|
66
62
|
if (descriptors.length > this.maxColumns) {
|
|
67
|
-
throw
|
|
63
|
+
throw shared_1.Fail.limit('max_columns', this.maxColumns, `the metadata at ${at} declares ${descriptors.length} columns, more than ` +
|
|
68
64
|
`${this.maxColumns}`).atPath(at);
|
|
69
65
|
}
|
|
70
66
|
const bound = descriptors.map((d, i) => {
|
|
@@ -72,7 +68,7 @@ class Core {
|
|
|
72
68
|
return columns.column(d);
|
|
73
69
|
}
|
|
74
70
|
catch (err) {
|
|
75
|
-
if (err instanceof
|
|
71
|
+
if (err instanceof shared_1.Fail && null == err.path) {
|
|
76
72
|
const p = selected.path.clone();
|
|
77
73
|
p.push(i);
|
|
78
74
|
err.path = p.toString();
|
|
@@ -83,49 +79,49 @@ class Core {
|
|
|
83
79
|
this.bind(bound, 'the metadata');
|
|
84
80
|
}
|
|
85
81
|
row(selected) {
|
|
86
|
-
const row = selected.value ??
|
|
82
|
+
const row = selected.value ?? shared_1.Datum.null;
|
|
87
83
|
if (!this.schemaSent) {
|
|
88
84
|
if ('infer' === this.columns.type && null === this.columns.bound) {
|
|
89
85
|
const at = selected.path.toString();
|
|
90
86
|
if ('object' !== row.type) {
|
|
91
|
-
throw
|
|
87
|
+
throw shared_1.Fail.input(`the first row at ${at} is not an object, so no columns can be inferred from it`).atPath(at);
|
|
92
88
|
}
|
|
93
89
|
// The names are the table's metadata for as long as it lasts, so
|
|
94
90
|
// they are held to the bound a metadata capture is: measured as the
|
|
95
91
|
// array of their strings would be.
|
|
96
|
-
let bytes =
|
|
92
|
+
let bytes = shared_1.NODE_BYTES;
|
|
97
93
|
for (const k of row.members.keys())
|
|
98
|
-
bytes +=
|
|
94
|
+
bytes += shared_1.NODE_BYTES + (0, shared_1.utf8Bytes)(k);
|
|
99
95
|
if (bytes > this.maxMetadataBytes) {
|
|
100
|
-
throw
|
|
96
|
+
throw shared_1.Fail.limit('max_metadata_bytes', this.maxMetadataBytes, `the first row's ${row.members.size} member names take ${bytes} bytes as the ` +
|
|
101
97
|
`table's columns, more than ${this.maxMetadataBytes}`).atPath(at);
|
|
102
98
|
}
|
|
103
|
-
this.bind([...row.members.keys()].map((k) => (0,
|
|
99
|
+
this.bind([...row.members.keys()].map((k) => (0, shared_1.boundColumn)(k, [k])), 'the first row');
|
|
104
100
|
}
|
|
105
101
|
if ('stop' === this.sendSchema())
|
|
106
102
|
return 'stop';
|
|
107
103
|
}
|
|
108
104
|
const columns = this.columns.bound;
|
|
109
105
|
if (null === columns) {
|
|
110
|
-
throw
|
|
106
|
+
throw shared_1.Fail.protocol('a row was projected before its schema was bound');
|
|
111
107
|
}
|
|
112
108
|
const cells = [];
|
|
113
109
|
for (const col of columns) {
|
|
114
|
-
const found = (0,
|
|
110
|
+
const found = (0, shared_1.getPath)(row, col.source);
|
|
115
111
|
if (undefined !== found) {
|
|
116
|
-
cells.push(
|
|
112
|
+
cells.push(shared_1.Cell.fromDatum(found));
|
|
117
113
|
continue;
|
|
118
114
|
}
|
|
119
115
|
switch (col.missing) {
|
|
120
116
|
case 'missing':
|
|
121
|
-
cells.push(
|
|
117
|
+
cells.push(shared_1.Cell.missing);
|
|
122
118
|
break;
|
|
123
119
|
case 'null':
|
|
124
|
-
cells.push(
|
|
120
|
+
cells.push(shared_1.Cell.null);
|
|
125
121
|
break;
|
|
126
122
|
case 'error': {
|
|
127
|
-
const at = new
|
|
128
|
-
throw new
|
|
123
|
+
const at = new shared_1.Path([...selected.path.segments, ...col.source]).toString();
|
|
124
|
+
throw new shared_1.Fail('MISSING_VALUE', `column ${JSON.stringify(col.label)} has no value at ${at}`).atPath(at);
|
|
129
125
|
}
|
|
130
126
|
}
|
|
131
127
|
}
|
|
@@ -134,7 +130,7 @@ class Core {
|
|
|
134
130
|
}
|
|
135
131
|
began(id, _tag) {
|
|
136
132
|
if (id === this.rowId && 'metadata' === this.columns.type && null === this.columns.bound) {
|
|
137
|
-
throw new
|
|
133
|
+
throw new shared_1.Fail('INPUT_ORDER_VIOLATION', `a row began before the column metadata at ${this.columns.selector} had completed; ` +
|
|
138
134
|
`rows must follow their metadata`);
|
|
139
135
|
}
|
|
140
136
|
}
|
|
@@ -149,7 +145,7 @@ class Core {
|
|
|
149
145
|
if (!this.schemaSent) {
|
|
150
146
|
if ('metadata' === this.columns.type && null === this.columns.bound) {
|
|
151
147
|
const at = this.columns.selector.toString();
|
|
152
|
-
throw
|
|
148
|
+
throw shared_1.Fail.input(`the document has no column metadata at ${at}`).atPath(at);
|
|
153
149
|
}
|
|
154
150
|
// No rows: nothing to infer from, so the table is empty.
|
|
155
151
|
if ('infer' === this.columns.type && null === this.columns.bound) {
|
|
@@ -169,7 +165,7 @@ class TableFromJson {
|
|
|
169
165
|
// the metadata selector is refused as the router refuses any overlapping
|
|
170
166
|
// materializations.
|
|
171
167
|
constructor(binding, limits, duplicates, metrics, sink) {
|
|
172
|
-
const rowSpec =
|
|
168
|
+
const rowSpec = shared_1.CaptureSpec.materialize('row', binding.rows).withBudget(limits.max_record_bytes, 'max_record_bytes');
|
|
173
169
|
let columns;
|
|
174
170
|
let specs;
|
|
175
171
|
let metaId = null;
|
|
@@ -187,7 +183,7 @@ class TableFromJson {
|
|
|
187
183
|
bound: null,
|
|
188
184
|
};
|
|
189
185
|
specs = [
|
|
190
|
-
|
|
186
|
+
shared_1.CaptureSpec.materialize('metadata', schema.columns).withBudget(limits.max_metadata_bytes, 'max_metadata_bytes'),
|
|
191
187
|
rowSpec,
|
|
192
188
|
];
|
|
193
189
|
metaId = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-from-json.js","sourceRoot":"","sources":["../src/table-from-json.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AAE5C,wEAAwE;AACxE,OAAO;AACP,EAAE;AACF,mEAAmE;AACnE,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,0EAA0E;AAC1E,2EAA2E;AAC3E,sEAAsE;AACtE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,yBAAyB;AAEzB,
|
|
1
|
+
{"version":3,"file":"table-from-json.js","sourceRoot":"","sources":["../src/table-from-json.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;AAE5C,wEAAwE;AACxE,OAAO;AACP,EAAE;AACF,mEAAmE;AACnE,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,0EAA0E;AAC1E,2EAA2E;AAC3E,sEAAsE;AACtE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,yBAAyB;AAEzB,mDAyB+B;AAE/B,mCAAgC;AAQhC,yEAAyE;AACzE,cAAc;AACd,MAAM,IAAI;IAYR,YACE,IAAO,EACP,KAAgB,EAChB,MAAwB,EACxB,OAAgB,EAChB,MAAc,EACd,OAAgB;QAblB,eAAU,GAAG,KAAK,CAAA;QAehB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,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AAW,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,UAAU,CAC5D,MAAM,CAAC,kBAAkB,EACzB,oBAAoB,CACrB;oBACD,OAAO;iBACR,CAAA;gBACD,MAAM,GAAG,CAAC,CAAA;gBACV,MAAK;YACP,KAAK,OAAO;gBACV,OAAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;gBACxC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAA;gBACjB,MAAK;QACT,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;QAC/E,IAAI,QAAQ,KAAK,OAAO,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;QACtE,IAAI,CAAC,MAAM,GAAG,IAAI,cAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;IACpE,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAA;IACpC,CAAC;IAED,8CAA8C;IAC9C,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,EAAa;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;CACF"}
|
package/dist/transduce.d.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
2
|
-
export { Datum, DatumBuilder, byteSize, fromJSON, fromTabnas, getPath, takePath, toJSON, toText, walkDatum, } from '
|
|
3
|
-
export type { Duplicates } from '
|
|
4
|
-
export { Code, Fail, isFail } from '
|
|
5
|
-
export type { Limit } from '
|
|
6
|
-
export { Ev, eventEquals, eventText, isEnd, isScalar, isStart } from '
|
|
7
|
-
export type { JsonEvent, JsonEventType } from '
|
|
8
|
-
export { isJsonNumber, jsonNumber, jsonString, numberText } from '
|
|
9
|
-
export { AbortFlag, LIMIT_NAMES, Limits, Metrics, NODE_BYTES, utf8Bytes } from '
|
|
1
|
+
export declare const VERSION = "0.2.0";
|
|
2
|
+
export { Datum, DatumBuilder, byteSize, fromJSON, fromTabnas, getPath, takePath, toJSON, toText, walkDatum, } from '@tabnas/alchemy/shared';
|
|
3
|
+
export type { Duplicates } from '@tabnas/alchemy/shared';
|
|
4
|
+
export { Code, Fail, isFail } from '@tabnas/alchemy/shared';
|
|
5
|
+
export type { Limit } from '@tabnas/alchemy/shared';
|
|
6
|
+
export { Ev, eventEquals, eventText, isEnd, isScalar, isStart } from '@tabnas/alchemy/shared';
|
|
7
|
+
export type { JsonEvent, JsonEventType } from '@tabnas/alchemy/shared';
|
|
8
|
+
export { isJsonNumber, jsonNumber, jsonString, numberText } from '@tabnas/alchemy/shared';
|
|
9
|
+
export { AbortFlag, LIMIT_NAMES, Limits, Metrics, NODE_BYTES, utf8Bytes, } from '@tabnas/alchemy/shared';
|
|
10
10
|
export { Matcher } from './matcher';
|
|
11
|
-
export type {
|
|
12
|
-
export {
|
|
13
|
-
export
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
11
|
+
export type { Hit, HitKind } from './matcher';
|
|
12
|
+
export type { CaptureId } from '@tabnas/alchemy/shared';
|
|
13
|
+
export { FnRoute, Router, SelectedRecorder } from './route';
|
|
14
|
+
export { CaptureSpec } from '@tabnas/alchemy/shared';
|
|
15
|
+
export type { Budget, CaptureMode, RouteSink, Selected } from '@tabnas/alchemy/shared';
|
|
16
|
+
export { ScanEmit } from './scan';
|
|
17
|
+
export { Transition } from '@tabnas/alchemy/shared';
|
|
18
|
+
export { Path, Selector, keyText, pathText } from '@tabnas/alchemy/shared';
|
|
19
|
+
export type { Segment, Step } from '@tabnas/alchemy/shared';
|
|
20
|
+
export { CountSink, EventRecorder, FnSink, TreeContract, replay } from '@tabnas/alchemy/shared';
|
|
21
|
+
export type { Flow, Sink } from '@tabnas/alchemy/shared';
|
|
19
22
|
export { Prune, SourceMode, ValueSource, engineFailure, walkValue } from './source';
|
|
20
23
|
export type { Source } from './source';
|
|
21
24
|
export { Guarded } from './guard';
|
|
@@ -23,6 +26,7 @@ export { ParserSource } from './parser-source';
|
|
|
23
26
|
export { DEFAULT_CHUNK_BYTES, LineFormat, LinesSource } from './lines';
|
|
24
27
|
export type { LinesChunk, LinesInput, LinesWriter } from './lines';
|
|
25
28
|
export { INCREMENTAL, capability, isIncremental } from './capability';
|
|
26
|
-
export { Cell, Schema, Table, boundColumn, columnFromMeta } from '
|
|
27
|
-
export type { BoundColumn, ColumnMapper, MissingPolicy, PublicColumn, TableBinding, TableEvent, TableSink, } from '
|
|
29
|
+
export { Cell, Schema, Table, boundColumn, columnFromMeta } from '@tabnas/alchemy/shared';
|
|
30
|
+
export type { BoundColumn, ColumnMapper, MissingPolicy, PublicColumn, TableBinding, TableEvent, TableSink, } from '@tabnas/alchemy/shared';
|
|
28
31
|
export { TableFromJson } from './table-from-json';
|
|
32
|
+
export { routers } from './routers';
|
package/dist/transduce.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Copyright (c) 2026 tabnas, MIT License */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.engineFailure = exports.ValueSource = exports.SourceMode = exports.Prune = exports.replay = exports.TreeContract = exports.FnSink = exports.EventRecorder = exports.CountSink = exports.pathText = exports.keyText = exports.Selector = exports.Path = exports.Transition = exports.ScanEmit = exports.
|
|
5
|
-
exports.TableFromJson = exports.columnFromMeta = exports.boundColumn = exports.Table = exports.Schema = exports.Cell = exports.isIncremental = exports.capability = exports.INCREMENTAL = exports.LinesSource = exports.LineFormat = exports.DEFAULT_CHUNK_BYTES = exports.ParserSource = exports.Guarded = exports.walkValue = void 0;
|
|
4
|
+
exports.engineFailure = exports.ValueSource = exports.SourceMode = exports.Prune = exports.replay = exports.TreeContract = exports.FnSink = exports.EventRecorder = exports.CountSink = exports.pathText = exports.keyText = exports.Selector = exports.Path = exports.Transition = exports.ScanEmit = exports.CaptureSpec = exports.SelectedRecorder = exports.Router = exports.FnRoute = exports.Matcher = exports.utf8Bytes = exports.NODE_BYTES = exports.Metrics = exports.Limits = exports.LIMIT_NAMES = exports.AbortFlag = exports.numberText = exports.jsonString = exports.jsonNumber = exports.isJsonNumber = exports.isStart = exports.isScalar = exports.isEnd = exports.eventText = exports.eventEquals = exports.Ev = exports.isFail = exports.Fail = exports.Code = exports.walkDatum = exports.toText = exports.toJSON = exports.takePath = exports.getPath = exports.fromTabnas = exports.fromJSON = exports.byteSize = exports.DatumBuilder = exports.Datum = exports.VERSION = void 0;
|
|
5
|
+
exports.routers = exports.TableFromJson = exports.columnFromMeta = exports.boundColumn = exports.Table = exports.Schema = exports.Cell = exports.isIncremental = exports.capability = exports.INCREMENTAL = exports.LinesSource = exports.LineFormat = exports.DEFAULT_CHUNK_BYTES = exports.ParserSource = exports.Guarded = exports.walkValue = void 0;
|
|
6
6
|
// Streaming transducers over any tabnas parser.
|
|
7
7
|
//
|
|
8
8
|
// A transducer decides what a source contributes to an output model; a
|
|
@@ -23,63 +23,71 @@ exports.TableFromJson = exports.columnFromMeta = exports.boundColumn = exports.T
|
|
|
23
23
|
// Everything is synchronous and push-based: the parser calls the first
|
|
24
24
|
// sink from inside its own callback, and a slow writer at the end of the
|
|
25
25
|
// chain slows the parse at the start. That is the backpressure.
|
|
26
|
+
//
|
|
27
|
+
// The protocols, `Fail` and its codes, `Limits`, `Metrics`, `Selector`,
|
|
28
|
+
// `Datum` and the captures' types are alchemy's shared types
|
|
29
|
+
// (`@tabnas/alchemy/shared`), which this package imports and re-exports
|
|
30
|
+
// under the names it always exported them by. `routers` is this package's
|
|
31
|
+
// stages as alchemy's `Routers`, for a host to pass to alchemy's `compile`.
|
|
26
32
|
// This package's version, as package.json declares it.
|
|
27
|
-
exports.VERSION = '0.
|
|
28
|
-
var
|
|
29
|
-
Object.defineProperty(exports, "Datum", { enumerable: true, get: function () { return
|
|
30
|
-
Object.defineProperty(exports, "DatumBuilder", { enumerable: true, get: function () { return
|
|
31
|
-
Object.defineProperty(exports, "byteSize", { enumerable: true, get: function () { return
|
|
32
|
-
Object.defineProperty(exports, "fromJSON", { enumerable: true, get: function () { return
|
|
33
|
-
Object.defineProperty(exports, "fromTabnas", { enumerable: true, get: function () { return
|
|
34
|
-
Object.defineProperty(exports, "getPath", { enumerable: true, get: function () { return
|
|
35
|
-
Object.defineProperty(exports, "takePath", { enumerable: true, get: function () { return
|
|
36
|
-
Object.defineProperty(exports, "toJSON", { enumerable: true, get: function () { return
|
|
37
|
-
Object.defineProperty(exports, "toText", { enumerable: true, get: function () { return
|
|
38
|
-
Object.defineProperty(exports, "walkDatum", { enumerable: true, get: function () { return
|
|
39
|
-
var
|
|
40
|
-
Object.defineProperty(exports, "Code", { enumerable: true, get: function () { return
|
|
41
|
-
Object.defineProperty(exports, "Fail", { enumerable: true, get: function () { return
|
|
42
|
-
Object.defineProperty(exports, "isFail", { enumerable: true, get: function () { return
|
|
43
|
-
var
|
|
44
|
-
Object.defineProperty(exports, "Ev", { enumerable: true, get: function () { return
|
|
45
|
-
Object.defineProperty(exports, "eventEquals", { enumerable: true, get: function () { return
|
|
46
|
-
Object.defineProperty(exports, "eventText", { enumerable: true, get: function () { return
|
|
47
|
-
Object.defineProperty(exports, "isEnd", { enumerable: true, get: function () { return
|
|
48
|
-
Object.defineProperty(exports, "isScalar", { enumerable: true, get: function () { return
|
|
49
|
-
Object.defineProperty(exports, "isStart", { enumerable: true, get: function () { return
|
|
50
|
-
var
|
|
51
|
-
Object.defineProperty(exports, "isJsonNumber", { enumerable: true, get: function () { return
|
|
52
|
-
Object.defineProperty(exports, "jsonNumber", { enumerable: true, get: function () { return
|
|
53
|
-
Object.defineProperty(exports, "jsonString", { enumerable: true, get: function () { return
|
|
54
|
-
Object.defineProperty(exports, "numberText", { enumerable: true, get: function () { return
|
|
55
|
-
var
|
|
56
|
-
Object.defineProperty(exports, "AbortFlag", { enumerable: true, get: function () { return
|
|
57
|
-
Object.defineProperty(exports, "LIMIT_NAMES", { enumerable: true, get: function () { return
|
|
58
|
-
Object.defineProperty(exports, "Limits", { enumerable: true, get: function () { return
|
|
59
|
-
Object.defineProperty(exports, "Metrics", { enumerable: true, get: function () { return
|
|
60
|
-
Object.defineProperty(exports, "NODE_BYTES", { enumerable: true, get: function () { return
|
|
61
|
-
Object.defineProperty(exports, "utf8Bytes", { enumerable: true, get: function () { return
|
|
33
|
+
exports.VERSION = '0.2.0';
|
|
34
|
+
var shared_1 = require("@tabnas/alchemy/shared");
|
|
35
|
+
Object.defineProperty(exports, "Datum", { enumerable: true, get: function () { return shared_1.Datum; } });
|
|
36
|
+
Object.defineProperty(exports, "DatumBuilder", { enumerable: true, get: function () { return shared_1.DatumBuilder; } });
|
|
37
|
+
Object.defineProperty(exports, "byteSize", { enumerable: true, get: function () { return shared_1.byteSize; } });
|
|
38
|
+
Object.defineProperty(exports, "fromJSON", { enumerable: true, get: function () { return shared_1.fromJSON; } });
|
|
39
|
+
Object.defineProperty(exports, "fromTabnas", { enumerable: true, get: function () { return shared_1.fromTabnas; } });
|
|
40
|
+
Object.defineProperty(exports, "getPath", { enumerable: true, get: function () { return shared_1.getPath; } });
|
|
41
|
+
Object.defineProperty(exports, "takePath", { enumerable: true, get: function () { return shared_1.takePath; } });
|
|
42
|
+
Object.defineProperty(exports, "toJSON", { enumerable: true, get: function () { return shared_1.toJSON; } });
|
|
43
|
+
Object.defineProperty(exports, "toText", { enumerable: true, get: function () { return shared_1.toText; } });
|
|
44
|
+
Object.defineProperty(exports, "walkDatum", { enumerable: true, get: function () { return shared_1.walkDatum; } });
|
|
45
|
+
var shared_2 = require("@tabnas/alchemy/shared");
|
|
46
|
+
Object.defineProperty(exports, "Code", { enumerable: true, get: function () { return shared_2.Code; } });
|
|
47
|
+
Object.defineProperty(exports, "Fail", { enumerable: true, get: function () { return shared_2.Fail; } });
|
|
48
|
+
Object.defineProperty(exports, "isFail", { enumerable: true, get: function () { return shared_2.isFail; } });
|
|
49
|
+
var shared_3 = require("@tabnas/alchemy/shared");
|
|
50
|
+
Object.defineProperty(exports, "Ev", { enumerable: true, get: function () { return shared_3.Ev; } });
|
|
51
|
+
Object.defineProperty(exports, "eventEquals", { enumerable: true, get: function () { return shared_3.eventEquals; } });
|
|
52
|
+
Object.defineProperty(exports, "eventText", { enumerable: true, get: function () { return shared_3.eventText; } });
|
|
53
|
+
Object.defineProperty(exports, "isEnd", { enumerable: true, get: function () { return shared_3.isEnd; } });
|
|
54
|
+
Object.defineProperty(exports, "isScalar", { enumerable: true, get: function () { return shared_3.isScalar; } });
|
|
55
|
+
Object.defineProperty(exports, "isStart", { enumerable: true, get: function () { return shared_3.isStart; } });
|
|
56
|
+
var shared_4 = require("@tabnas/alchemy/shared");
|
|
57
|
+
Object.defineProperty(exports, "isJsonNumber", { enumerable: true, get: function () { return shared_4.isJsonNumber; } });
|
|
58
|
+
Object.defineProperty(exports, "jsonNumber", { enumerable: true, get: function () { return shared_4.jsonNumber; } });
|
|
59
|
+
Object.defineProperty(exports, "jsonString", { enumerable: true, get: function () { return shared_4.jsonString; } });
|
|
60
|
+
Object.defineProperty(exports, "numberText", { enumerable: true, get: function () { return shared_4.numberText; } });
|
|
61
|
+
var shared_5 = require("@tabnas/alchemy/shared");
|
|
62
|
+
Object.defineProperty(exports, "AbortFlag", { enumerable: true, get: function () { return shared_5.AbortFlag; } });
|
|
63
|
+
Object.defineProperty(exports, "LIMIT_NAMES", { enumerable: true, get: function () { return shared_5.LIMIT_NAMES; } });
|
|
64
|
+
Object.defineProperty(exports, "Limits", { enumerable: true, get: function () { return shared_5.Limits; } });
|
|
65
|
+
Object.defineProperty(exports, "Metrics", { enumerable: true, get: function () { return shared_5.Metrics; } });
|
|
66
|
+
Object.defineProperty(exports, "NODE_BYTES", { enumerable: true, get: function () { return shared_5.NODE_BYTES; } });
|
|
67
|
+
Object.defineProperty(exports, "utf8Bytes", { enumerable: true, get: function () { return shared_5.utf8Bytes; } });
|
|
62
68
|
var matcher_1 = require("./matcher");
|
|
63
69
|
Object.defineProperty(exports, "Matcher", { enumerable: true, get: function () { return matcher_1.Matcher; } });
|
|
64
70
|
var route_1 = require("./route");
|
|
65
|
-
Object.defineProperty(exports, "CaptureSpec", { enumerable: true, get: function () { return route_1.CaptureSpec; } });
|
|
66
71
|
Object.defineProperty(exports, "FnRoute", { enumerable: true, get: function () { return route_1.FnRoute; } });
|
|
67
72
|
Object.defineProperty(exports, "Router", { enumerable: true, get: function () { return route_1.Router; } });
|
|
68
73
|
Object.defineProperty(exports, "SelectedRecorder", { enumerable: true, get: function () { return route_1.SelectedRecorder; } });
|
|
74
|
+
var shared_6 = require("@tabnas/alchemy/shared");
|
|
75
|
+
Object.defineProperty(exports, "CaptureSpec", { enumerable: true, get: function () { return shared_6.CaptureSpec; } });
|
|
69
76
|
var scan_1 = require("./scan");
|
|
70
77
|
Object.defineProperty(exports, "ScanEmit", { enumerable: true, get: function () { return scan_1.ScanEmit; } });
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Object.defineProperty(exports, "
|
|
75
|
-
Object.defineProperty(exports, "
|
|
76
|
-
Object.defineProperty(exports, "
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Object.defineProperty(exports, "
|
|
80
|
-
Object.defineProperty(exports, "
|
|
81
|
-
Object.defineProperty(exports, "
|
|
82
|
-
Object.defineProperty(exports, "
|
|
78
|
+
var shared_7 = require("@tabnas/alchemy/shared");
|
|
79
|
+
Object.defineProperty(exports, "Transition", { enumerable: true, get: function () { return shared_7.Transition; } });
|
|
80
|
+
var shared_8 = require("@tabnas/alchemy/shared");
|
|
81
|
+
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return shared_8.Path; } });
|
|
82
|
+
Object.defineProperty(exports, "Selector", { enumerable: true, get: function () { return shared_8.Selector; } });
|
|
83
|
+
Object.defineProperty(exports, "keyText", { enumerable: true, get: function () { return shared_8.keyText; } });
|
|
84
|
+
Object.defineProperty(exports, "pathText", { enumerable: true, get: function () { return shared_8.pathText; } });
|
|
85
|
+
var shared_9 = require("@tabnas/alchemy/shared");
|
|
86
|
+
Object.defineProperty(exports, "CountSink", { enumerable: true, get: function () { return shared_9.CountSink; } });
|
|
87
|
+
Object.defineProperty(exports, "EventRecorder", { enumerable: true, get: function () { return shared_9.EventRecorder; } });
|
|
88
|
+
Object.defineProperty(exports, "FnSink", { enumerable: true, get: function () { return shared_9.FnSink; } });
|
|
89
|
+
Object.defineProperty(exports, "TreeContract", { enumerable: true, get: function () { return shared_9.TreeContract; } });
|
|
90
|
+
Object.defineProperty(exports, "replay", { enumerable: true, get: function () { return shared_9.replay; } });
|
|
83
91
|
var source_1 = require("./source");
|
|
84
92
|
Object.defineProperty(exports, "Prune", { enumerable: true, get: function () { return source_1.Prune; } });
|
|
85
93
|
Object.defineProperty(exports, "SourceMode", { enumerable: true, get: function () { return source_1.SourceMode; } });
|
|
@@ -98,12 +106,14 @@ var capability_1 = require("./capability");
|
|
|
98
106
|
Object.defineProperty(exports, "INCREMENTAL", { enumerable: true, get: function () { return capability_1.INCREMENTAL; } });
|
|
99
107
|
Object.defineProperty(exports, "capability", { enumerable: true, get: function () { return capability_1.capability; } });
|
|
100
108
|
Object.defineProperty(exports, "isIncremental", { enumerable: true, get: function () { return capability_1.isIncremental; } });
|
|
101
|
-
var
|
|
102
|
-
Object.defineProperty(exports, "Cell", { enumerable: true, get: function () { return
|
|
103
|
-
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return
|
|
104
|
-
Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return
|
|
105
|
-
Object.defineProperty(exports, "boundColumn", { enumerable: true, get: function () { return
|
|
106
|
-
Object.defineProperty(exports, "columnFromMeta", { enumerable: true, get: function () { return
|
|
109
|
+
var shared_10 = require("@tabnas/alchemy/shared");
|
|
110
|
+
Object.defineProperty(exports, "Cell", { enumerable: true, get: function () { return shared_10.Cell; } });
|
|
111
|
+
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return shared_10.Schema; } });
|
|
112
|
+
Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return shared_10.Table; } });
|
|
113
|
+
Object.defineProperty(exports, "boundColumn", { enumerable: true, get: function () { return shared_10.boundColumn; } });
|
|
114
|
+
Object.defineProperty(exports, "columnFromMeta", { enumerable: true, get: function () { return shared_10.columnFromMeta; } });
|
|
107
115
|
var table_from_json_1 = require("./table-from-json");
|
|
108
116
|
Object.defineProperty(exports, "TableFromJson", { enumerable: true, get: function () { return table_from_json_1.TableFromJson; } });
|
|
117
|
+
var routers_1 = require("./routers");
|
|
118
|
+
Object.defineProperty(exports, "routers", { enumerable: true, get: function () { return routers_1.routers; } });
|
|
109
119
|
//# sourceMappingURL=transduce.js.map
|
package/dist/transduce.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transduce.js","sourceRoot":"","sources":["../src/transduce.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;;AAE5C,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,oEAAoE;AACpE,mBAAmB;AACnB,EAAE;AACF,2EAA2E;AAC3E,YAAY;AACZ,0EAA0E;AAC1E,oEAAoE;AACpE,0EAA0E;AAC1E,yDAAyD;AACzD,qEAAqE;AACrE,qCAAqC;AACrC,0EAA0E;AAC1E,mBAAmB;AACnB,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,gEAAgE;
|
|
1
|
+
{"version":3,"file":"transduce.js","sourceRoot":"","sources":["../src/transduce.ts"],"names":[],"mappings":";AAAA,4CAA4C;;;;AAE5C,g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0.2","root":["../src/capability.ts","../src/guard.ts","../src/lines.ts","../src/matcher.ts","../src/parser-source.ts","../src/route.ts","../src/routers.ts","../src/rule-events.ts","../src/scan.ts","../src/source.ts","../src/table-from-json.ts","../src/transduce.ts"],"packageJsons":["../node_modules/@tabnas/alchemy/package.json","../node_modules/@tabnas/csv/package.json","../node_modules/@tabnas/json/package.json","../node_modules/@tabnas/jsonic/package.json","../node_modules/@tabnas/parser/package.json","../node_modules/@types/node/package.json","../node_modules/undici-types/package.json","../package.json"],"missingPackageJsons":["../node_modules/@tabnas/alchemy/dist/package.json","../node_modules/@tabnas/alchemy/dist/shared/package.json","../node_modules/@tabnas/alchemy/shared/package.json","../node_modules/@tabnas/csv/dist/package.json","../node_modules/@tabnas/json/dist/package.json","../node_modules/@tabnas/parser/dist/package.json","../node_modules/@types/assert/package.json","../node_modules/@types/assert/strict/package.json","../node_modules/@types/async_hooks/package.json","../node_modules/@types/buffer/package.json","../node_modules/@types/child_process/package.json","../node_modules/@types/cluster/package.json","../node_modules/@types/console/package.json","../node_modules/@types/constants/package.json","../node_modules/@types/crypto/package.json","../node_modules/@types/dgram/package.json","../node_modules/@types/diagnostics_channel/package.json","../node_modules/@types/dns/package.json","../node_modules/@types/dns/promises/package.json","../node_modules/@types/domain/package.json","../node_modules/@types/events/package.json","../node_modules/@types/fs/package.json","../node_modules/@types/fs/promises/package.json","../node_modules/@types/http/package.json","../node_modules/@types/http2/package.json","../node_modules/@types/https/package.json","../node_modules/@types/inspector/package.json","../node_modules/@types/inspector/promises/package.json","../node_modules/@types/module/package.json","../node_modules/@types/net/package.json","../node_modules/@types/node/assert/package.json","../node_modules/@types/node/dns/package.json","../node_modules/@types/node/fs/package.json","../node_modules/@types/node/inspector/package.json","../node_modules/@types/node/path/package.json","../node_modules/@types/node/readline/package.json","../node_modules/@types/node/stream/package.json","../node_modules/@types/node/test/package.json","../node_modules/@types/node/timers/package.json","../node_modules/@types/node/util/package.json","../node_modules/@types/node/web-globals/package.json","../node_modules/@types/node/zlib/package.json","../node_modules/@types/os/package.json","../node_modules/@types/path/package.json","../node_modules/@types/path/posix/package.json","../node_modules/@types/path/win32/package.json","../node_modules/@types/perf_hooks/package.json","../node_modules/@types/process/package.json","../node_modules/@types/punycode/package.json","../node_modules/@types/querystring/package.json","../node_modules/@types/readline/package.json","../node_modules/@types/readline/promises/package.json","../node_modules/@types/repl/package.json","../node_modules/@types/stream/consumers/package.json","../node_modules/@types/stream/iter/package.json","../node_modules/@types/stream/package.json","../node_modules/@types/stream/promises/package.json","../node_modules/@types/stream/web/package.json","../node_modules/@types/string_decoder/package.json","../node_modules/@types/timers/package.json","../node_modules/@types/timers/promises/package.json","../node_modules/@types/tls/package.json","../node_modules/@types/trace_events/package.json","../node_modules/@types/tty/package.json","../node_modules/@types/url/package.json","../node_modules/@types/util/package.json","../node_modules/@types/util/types/package.json","../node_modules/@types/v8/package.json","../node_modules/@types/vm/package.json","../node_modules/@types/wasi/package.json","../node_modules/@types/worker_threads/package.json","../node_modules/@types/zlib/package.json","../node_modules/assert/package.json","../node_modules/assert/strict/package.json","../node_modules/async_hooks/package.json","../node_modules/buffer/package.json","../node_modules/child_process/package.json","../node_modules/cluster/package.json","../node_modules/console/package.json","../node_modules/constants/package.json","../node_modules/crypto/package.json","../node_modules/dgram/package.json","../node_modules/diagnostics_channel/package.json","../node_modules/dns/package.json","../node_modules/dns/promises/package.json","../node_modules/domain/package.json","../node_modules/events/package.json","../node_modules/fs/package.json","../node_modules/fs/promises/package.json","../node_modules/http/package.json","../node_modules/http2/package.json","../node_modules/https/package.json","../node_modules/inspector/package.json","../node_modules/inspector/promises/package.json","../node_modules/module/package.json","../node_modules/net/package.json","../node_modules/os/package.json","../node_modules/path/package.json","../node_modules/path/posix/package.json","../node_modules/path/win32/package.json","../node_modules/perf_hooks/package.json","../node_modules/process/package.json","../node_modules/punycode/package.json","../node_modules/querystring/package.json","../node_modules/readline/package.json","../node_modules/readline/promises/package.json","../node_modules/repl/package.json","../node_modules/stream/consumers/package.json","../node_modules/stream/iter/package.json","../node_modules/stream/package.json","../node_modules/stream/promises/package.json","../node_modules/stream/web/package.json","../node_modules/string_decoder/package.json","../node_modules/timers/package.json","../node_modules/timers/promises/package.json","../node_modules/tls/package.json","../node_modules/trace_events/package.json","../node_modules/tty/package.json","../node_modules/url/package.json","../node_modules/util/package.json","../node_modules/util/types/package.json","../node_modules/v8/package.json","../node_modules/vm/package.json","../node_modules/wasi/package.json","../node_modules/worker_threads/package.json","../node_modules/zlib/package.json"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tabnas/transduce",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "dist/transduce.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"types": "dist/transduce.d.ts",
|
|
@@ -35,12 +35,20 @@
|
|
|
35
35
|
".": "./dist/transduce.js"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
+
"@tabnas/alchemy": ">=0",
|
|
38
39
|
"@tabnas/csv": ">=0",
|
|
39
|
-
"@tabnas/json": ">=0"
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
"@tabnas/json": ">=0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"@tabnas/csv": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"@tabnas/json": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
42
49
|
},
|
|
43
50
|
"devDependencies": {
|
|
51
|
+
"@tabnas/alchemy": "*",
|
|
44
52
|
"@tabnas/csv": "*",
|
|
45
53
|
"@tabnas/feed": "*",
|
|
46
54
|
"@tabnas/ini": "*",
|
package/src/guard.ts
CHANGED
|
@@ -9,10 +9,16 @@
|
|
|
9
9
|
// as promptly as a parse does; and the source metrics (events, keys,
|
|
10
10
|
// scalars) are counted locally and flushed in one step.
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import {
|
|
13
|
+
AbortFlag,
|
|
14
|
+
Fail,
|
|
15
|
+
Flow,
|
|
16
|
+
JsonEvent,
|
|
17
|
+
Limits,
|
|
18
|
+
Metrics,
|
|
19
|
+
Sink,
|
|
20
|
+
utf8Bytes,
|
|
21
|
+
} from '@tabnas/alchemy/shared'
|
|
16
22
|
|
|
17
23
|
// A sink wrapper that enforces the source limits and counts.
|
|
18
24
|
export class Guarded<S extends Sink> implements Sink {
|
package/src/lines.ts
CHANGED
|
@@ -60,15 +60,54 @@
|
|
|
60
60
|
// the moment it passes the limit, whatever its length, rather than growing
|
|
61
61
|
// a chunk without bound.
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
// The grammars are optional peers. A program that builds no JSON Lines or
|
|
64
|
+
// CSV line source needs neither installed (render reads events, never
|
|
65
|
+
// lines), so each is loaded when a line source starts, not when this
|
|
66
|
+
// package is, and a run without it fails as a usage error naming it.
|
|
67
|
+
type CsvModule = typeof import('@tabnas/csv')
|
|
68
|
+
type JsonModule = typeof import('@tabnas/json')
|
|
69
|
+
|
|
70
|
+
function grammar<T>(name: string, format: string, load: () => T): T {
|
|
71
|
+
try {
|
|
72
|
+
return load()
|
|
73
|
+
} catch (error: any) {
|
|
74
|
+
// Only the grammar itself missing, not something it requires.
|
|
75
|
+
if (
|
|
76
|
+
'MODULE_NOT_FOUND' === error?.code &&
|
|
77
|
+
String(error.message).startsWith(`Cannot find module '${name}'`)
|
|
78
|
+
) {
|
|
79
|
+
throw new TypeError(
|
|
80
|
+
`LinesSource: ${format} needs ${name}, an optional peer of ` +
|
|
81
|
+
`@tabnas/transduce; install it alongside`,
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
throw error
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function makeCsv(options: Record<string, unknown>): any {
|
|
89
|
+
return grammar('@tabnas/csv', 'CSV', (): CsvModule => require('@tabnas/csv')).make(
|
|
90
|
+
options as any,
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function makeJson(): any {
|
|
95
|
+
return grammar('@tabnas/json', 'JSON Lines', (): JsonModule => require('@tabnas/json')).make()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
import {
|
|
99
|
+
AbortFlag,
|
|
100
|
+
Ev,
|
|
101
|
+
Fail,
|
|
102
|
+
Flow,
|
|
103
|
+
Limits,
|
|
104
|
+
Metrics,
|
|
105
|
+
Sink,
|
|
106
|
+
enginePosition,
|
|
107
|
+
} from '@tabnas/alchemy/shared'
|
|
65
108
|
|
|
66
|
-
import { Fail, enginePosition } from './error'
|
|
67
|
-
import { Ev } from './event'
|
|
68
109
|
import { Guarded } from './guard'
|
|
69
|
-
import { AbortFlag, Limits, Metrics } from './limits'
|
|
70
110
|
import { Adapter, notStreamable, prepare } from './rule-events'
|
|
71
|
-
import { Flow, Sink } from './sink'
|
|
72
111
|
import { Prune, Source, engineFailure, walkValue } from './source'
|
|
73
112
|
|
|
74
113
|
// How much of the input one CSV parse holds, at most one record over.
|
package/src/matcher.ts
CHANGED
|
@@ -16,12 +16,7 @@
|
|
|
16
16
|
// of it can therefore trust the sequence. A concrete `Path` is built only
|
|
17
17
|
// on request, for a delivered match or a failure.
|
|
18
18
|
|
|
19
|
-
import { Fail } from '
|
|
20
|
-
import { JsonEvent } from './event'
|
|
21
|
-
import { Path, Segment, Selector } from './selector'
|
|
22
|
-
|
|
23
|
-
// Which selector matched: its position in the list given to the matcher.
|
|
24
|
-
export type CaptureId = number
|
|
19
|
+
import { CaptureId, Fail, JsonEvent, Path, Segment, Selector } from '@tabnas/alchemy/shared'
|
|
25
20
|
|
|
26
21
|
const ROOT = 0
|
|
27
22
|
|