@ifc-lite/flow-nodes 0.11.1 → 0.12.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 +22 -0
- package/dist/csv-parse.d.ts +1 -1
- package/dist/csv-parse.d.ts.map +1 -1
- package/dist/csv-parse.js +12 -3
- package/dist/csv-parse.js.map +1 -1
- package/dist/influx-query.d.ts +22 -0
- package/dist/influx-query.d.ts.map +1 -0
- package/dist/influx-query.js +64 -0
- package/dist/influx-query.js.map +1 -0
- package/dist/influx-table.d.ts +8 -0
- package/dist/influx-table.d.ts.map +1 -0
- package/dist/influx-table.js +79 -0
- package/dist/influx-table.js.map +1 -0
- package/dist/influx.d.ts +41 -0
- package/dist/influx.d.ts.map +1 -0
- package/dist/influx.js +183 -0
- package/dist/influx.js.map +1 -0
- package/package.json +12 -7
package/README.md
CHANGED
|
@@ -185,3 +185,25 @@ or confirmed absence releases the retained local completion. No completion
|
|
|
185
185
|
identity is evicted to make room. Reads synchronize the visible receipt or proof's
|
|
186
186
|
directory before acknowledging it; an unresolved directory-sync fault refuses
|
|
187
187
|
recovery and subsequent creates without discarding the existing record.
|
|
188
|
+
|
|
189
|
+
## Experimental InfluxDB 2 adapters
|
|
190
|
+
|
|
191
|
+
The pure TypeScript `@ifc-lite/flow-nodes/influx` entry point shares query
|
|
192
|
+
construction, CSV validation and latest-per-series reduction between the
|
|
193
|
+
headless recipe and viewer. `queryRequest(selection)` generates Flux for one
|
|
194
|
+
numeric field, at most 24 hours and 10,000 samples; it requests one extra sample
|
|
195
|
+
so overflow fails explicitly. HTTPS is required except `http://localhost` for
|
|
196
|
+
development. `parseInfluxCsv(csv, selection)` returns separate history and latest
|
|
197
|
+
tables. Malformed CSV, error tables, nonnumeric readings, conflicting timestamps
|
|
198
|
+
and overflow throw. This is the generated plain-CSV contract, not an arbitrary
|
|
199
|
+
annotated Flux parser or an InfluxDB 3 adapter.
|
|
200
|
+
|
|
201
|
+
`fetchInfluxReadings(selection, token, transport?, signal?)` uses a direct POST
|
|
202
|
+
with a 15-second timeout and 2 MiB response limit. It never stores credentials,
|
|
203
|
+
follows redirects or exposes upstream error bodies. `redactInfluxError` removes
|
|
204
|
+
literal and URL-encoded token occurrences from diagnostics. Callers own secret
|
|
205
|
+
entry and lifetime. `matchInfluxSeries(latest, targets)` matches exact `GlobalId`
|
|
206
|
+
strings and preserves both multiple-series and multiple-entity ambiguity.
|
|
207
|
+
|
|
208
|
+
The viewer's Experimental panel calls these adapters directly. It does not run
|
|
209
|
+
a secret-bearing Flow graph: `BROWSER_FEATURES.secrets` remains empty.
|
package/dist/csv-parse.d.ts
CHANGED
|
@@ -22,5 +22,5 @@ export interface CsvParseResult {
|
|
|
22
22
|
/** Parse CSV text into a header row and data rows. Blank trailing rows (a
|
|
23
23
|
* file ending in a newline) are dropped; a genuinely blank line elsewhere
|
|
24
24
|
* is kept as a one-empty-field row and reported like any other mismatch. */
|
|
25
|
-
export declare function parseCsvText(text: string, delimiter?: string): CsvParseResult;
|
|
25
|
+
export declare function parseCsvText(text: string, delimiter?: string, strict?: boolean): CsvParseResult;
|
|
26
26
|
//# sourceMappingURL=csv-parse.d.ts.map
|
package/dist/csv-parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv-parse.d.ts","sourceRoot":"","sources":["../src/csv-parse.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,oEAAoE;IACpE,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;CACvC;
|
|
1
|
+
{"version":3,"file":"csv-parse.d.ts","sourceRoot":"","sources":["../src/csv-parse.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,oEAAoE;IACpE,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;CACvC;AAsED;;6EAE6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAM,EAAE,MAAM,UAAQ,GAAG,cAAc,CAW1F"}
|
package/dist/csv-parse.js
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
/** Split raw CSV text into fields per physical row, honouring quoting. */
|
|
5
|
-
function splitRows(text, delimiter) {
|
|
5
|
+
function splitRows(text, delimiter, strict) {
|
|
6
6
|
const rows = [];
|
|
7
7
|
let field = '';
|
|
8
8
|
let row = [];
|
|
9
9
|
let inQuotes = false;
|
|
10
|
+
let afterQuote = false;
|
|
10
11
|
let i = 0;
|
|
11
12
|
const n = text.length;
|
|
12
13
|
const pushField = () => {
|
|
13
14
|
row.push(field);
|
|
14
15
|
field = '';
|
|
16
|
+
afterQuote = false;
|
|
15
17
|
};
|
|
16
18
|
const pushRow = () => {
|
|
17
19
|
pushField();
|
|
@@ -28,6 +30,7 @@ function splitRows(text, delimiter) {
|
|
|
28
30
|
continue;
|
|
29
31
|
}
|
|
30
32
|
inQuotes = false;
|
|
33
|
+
afterQuote = true;
|
|
31
34
|
i += 1;
|
|
32
35
|
continue;
|
|
33
36
|
}
|
|
@@ -35,6 +38,10 @@ function splitRows(text, delimiter) {
|
|
|
35
38
|
i += 1;
|
|
36
39
|
continue;
|
|
37
40
|
}
|
|
41
|
+
if (strict && afterQuote && ch !== delimiter && ch !== '\r' && ch !== '\n')
|
|
42
|
+
throw new Error('Malformed CSV quoting');
|
|
43
|
+
if (strict && ch === '"' && field.length > 0)
|
|
44
|
+
throw new Error('Malformed CSV quoting');
|
|
38
45
|
if (ch === '"' && field.length === 0) {
|
|
39
46
|
inQuotes = true;
|
|
40
47
|
i += 1;
|
|
@@ -58,6 +65,8 @@ function splitRows(text, delimiter) {
|
|
|
58
65
|
field += ch;
|
|
59
66
|
i += 1;
|
|
60
67
|
}
|
|
68
|
+
if (strict && inQuotes)
|
|
69
|
+
throw new Error('Unclosed CSV quote');
|
|
61
70
|
// A trailing field/row with no terminating newline is still real content.
|
|
62
71
|
if (field.length > 0 || row.length > 0)
|
|
63
72
|
pushRow();
|
|
@@ -66,13 +75,13 @@ function splitRows(text, delimiter) {
|
|
|
66
75
|
/** Parse CSV text into a header row and data rows. Blank trailing rows (a
|
|
67
76
|
* file ending in a newline) are dropped; a genuinely blank line elsewhere
|
|
68
77
|
* is kept as a one-empty-field row and reported like any other mismatch. */
|
|
69
|
-
export function parseCsvText(text, delimiter = ',') {
|
|
78
|
+
export function parseCsvText(text, delimiter = ',', strict = false) {
|
|
70
79
|
// Excel's "CSV UTF-8" export starts with a byte-order mark. Left in, it
|
|
71
80
|
// becomes part of the first header ("\uFEFFGlobalId"), so the default
|
|
72
81
|
// GlobalId key is not found — and a quoted first header keeps its quotes.
|
|
73
82
|
if (text.charCodeAt(0) === 0xfeff)
|
|
74
83
|
text = text.slice(1);
|
|
75
|
-
const all = splitRows(text, delimiter).filter((r, idx, arr) => !(idx === arr.length - 1 && r.length === 1 && r[0] === ''));
|
|
84
|
+
const all = splitRows(text, delimiter, strict).filter((r, idx, arr) => !(idx === arr.length - 1 && r.length === 1 && r[0] === ''));
|
|
76
85
|
if (all.length === 0)
|
|
77
86
|
return { header: [], rows: [] };
|
|
78
87
|
const [header, ...dataRows] = all;
|
package/dist/csv-parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv-parse.js","sourceRoot":"","sources":["../src/csv-parse.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA0B/D,0EAA0E;AAC1E,SAAS,SAAS,CAAC,IAAY,EAAE,SAAiB;
|
|
1
|
+
{"version":3,"file":"csv-parse.js","sourceRoot":"","sources":["../src/csv-parse.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA0B/D,0EAA0E;AAC1E,SAAS,SAAS,CAAC,IAAY,EAAE,SAAiB,EAAE,MAAe;IACjE,MAAM,IAAI,GAAe,EAAE,CAAC;IAC5B,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,GAAG,GAAa,EAAE,CAAC;IACvB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACtB,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChB,KAAK,GAAG,EAAE,CAAC;QACX,UAAU,GAAG,KAAK,CAAC;IACrB,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,SAAS,EAAE,CAAC;QACZ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACf,GAAG,GAAG,EAAE,CAAC;IACX,CAAC,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;gBACf,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBACxB,KAAK,IAAI,GAAG,CAAC;oBACb,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22 @@
|
|
|
1
|
+
/** Bounded read-only InfluxDB 2 query contract for #8090. */
|
|
2
|
+
export interface InfluxSelection {
|
|
3
|
+
url: string;
|
|
4
|
+
org: string;
|
|
5
|
+
bucket: string;
|
|
6
|
+
measurement: string;
|
|
7
|
+
field: string;
|
|
8
|
+
guidTag: string;
|
|
9
|
+
tags?: Record<string, string>;
|
|
10
|
+
minutes?: number;
|
|
11
|
+
maxSamples?: number;
|
|
12
|
+
unit: string;
|
|
13
|
+
}
|
|
14
|
+
/** Validated sample cap shared by the query limit and the response check. */
|
|
15
|
+
export declare function influxSampleCap(selection: InfluxSelection): number;
|
|
16
|
+
export declare function queryRequest(selection: InfluxSelection): {
|
|
17
|
+
url: string;
|
|
18
|
+
hostname: string;
|
|
19
|
+
maxSamples: number;
|
|
20
|
+
body: string;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=influx-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influx-query.d.ts","sourceRoot":"","sources":["../src/influx-query.ts"],"names":[],"mappings":"AAIA,6DAA6D;AAC7D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAWD,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAIlE;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,eAAe;;;;;EAsCtD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
// Flux interpolates ${...} inside strings. Reject that syntax rather than
|
|
5
|
+
// accepting an expression disguised as a bucket, field, or tag value.
|
|
6
|
+
function literal(value) {
|
|
7
|
+
if (typeof value !== 'string' || !value || [...value].some(character => character.charCodeAt(0) < 0x20) || /\$\{|\{\{secret:/.test(value)) {
|
|
8
|
+
throw new Error('Influx selection contains an empty, control, interpolation, or secret-reference value');
|
|
9
|
+
}
|
|
10
|
+
return JSON.stringify(value);
|
|
11
|
+
}
|
|
12
|
+
/** Validated sample cap shared by the query limit and the response check. */
|
|
13
|
+
export function influxSampleCap(selection) {
|
|
14
|
+
const maxSamples = selection.maxSamples ?? 1000;
|
|
15
|
+
if (!Number.isInteger(maxSamples) || maxSamples < 1 || maxSamples > 10000)
|
|
16
|
+
throw new Error('maxSamples must be 1..10000');
|
|
17
|
+
return maxSamples;
|
|
18
|
+
}
|
|
19
|
+
export function queryRequest(selection) {
|
|
20
|
+
let url;
|
|
21
|
+
try {
|
|
22
|
+
url = new URL(selection.url);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw new Error('Invalid InfluxDB base URL');
|
|
26
|
+
}
|
|
27
|
+
if ((url.protocol !== 'https:' && !(url.protocol === 'http:' && url.hostname === 'localhost')) || url.username || url.password || url.search || url.hash) {
|
|
28
|
+
throw new Error('Use an HTTPS (or http://localhost) InfluxDB base URL without credentials, query, or fragment');
|
|
29
|
+
}
|
|
30
|
+
literal(selection.org);
|
|
31
|
+
// unit is a display label, never interpolated into the Flux query.
|
|
32
|
+
const minutes = selection.minutes ?? 60;
|
|
33
|
+
const maxSamples = influxSampleCap(selection);
|
|
34
|
+
if (!Number.isInteger(minutes) || minutes < 1 || minutes > 1440)
|
|
35
|
+
throw new Error('minutes must be 1..1440');
|
|
36
|
+
const tags = Object.entries(selection.tags ?? {});
|
|
37
|
+
if (tags.length > 16)
|
|
38
|
+
throw new Error('At most 16 tag predicates are supported');
|
|
39
|
+
const guidTag = literal(selection.guidTag);
|
|
40
|
+
if (['result', 'table', 'error', 'reference'].includes(selection.guidTag) || selection.guidTag.startsWith('_')) {
|
|
41
|
+
throw new Error('guidTag must be a tag, not an InfluxDB result column');
|
|
42
|
+
}
|
|
43
|
+
const query = [
|
|
44
|
+
`from(bucket: ${literal(selection.bucket)})`,
|
|
45
|
+
` |> range(start: -${minutes}m)`,
|
|
46
|
+
` |> filter(fn: (r) => r._measurement == ${literal(selection.measurement)} and r._field == ${literal(selection.field)})`,
|
|
47
|
+
` |> filter(fn: (r) => exists r[${guidTag}])`,
|
|
48
|
+
...tags.map(([key, value]) => ` |> filter(fn: (r) => r[${literal(key)}] == ${literal(value)})`),
|
|
49
|
+
// One table makes ordinary table.readCsv usable: no annotated CSV parser
|
|
50
|
+
// or repeated table headers. Keep every tag column for series identity.
|
|
51
|
+
' |> group(columns: [])',
|
|
52
|
+
' |> sort(columns: ["_time"], desc: true)',
|
|
53
|
+
` |> limit(n: ${maxSamples + 1})`,
|
|
54
|
+
].join('\n');
|
|
55
|
+
url.pathname = `${url.pathname.replace(/\/$/, '')}/api/v2/query`;
|
|
56
|
+
url.searchParams.set('org', selection.org);
|
|
57
|
+
return {
|
|
58
|
+
url: url.href,
|
|
59
|
+
hostname: url.hostname,
|
|
60
|
+
maxSamples,
|
|
61
|
+
body: JSON.stringify({ query, dialect: { header: true, annotations: [], dateTimeFormat: 'RFC3339Nano' } }),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=influx-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influx-query.js","sourceRoot":"","sources":["../src/influx-query.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAgB/D,0EAA0E;AAC1E,sEAAsE;AACtE,SAAS,OAAO,CAAC,KAAa;I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EAAyE;QACzE,wEAAwE;QACxE,yBAAyB;QACzB,2CAA2C;QAC3C,iBAAiB,UAAU,GAAG,CAAC,GAAG;KACnC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,GAAG,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC;IACjE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC3C,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,UAAU;QACV,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,cAAc,EAAE,aAAa,EAAE,EAAE,CAAC;KAC3G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Table } from '@ifc-lite/flow';
|
|
2
|
+
import { type InfluxSelection } from './influx-query.js';
|
|
3
|
+
/** Influx CSV has a leading unnamed annotation column, even with annotations
|
|
4
|
+
* disabled. Flow tables require named columns; remove only that empty envelope. */
|
|
5
|
+
export declare function dataTable(table: Table): Table;
|
|
6
|
+
/** Several samples are history; several tag sets for one GUID are ambiguity. */
|
|
7
|
+
export declare function latestPerSeries(table: Table, selection: InfluxSelection): Table;
|
|
8
|
+
//# sourceMappingURL=influx-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influx-table.d.ts","sourceRoot":"","sources":["../src/influx-table.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAI1E;mFACmF;AACnF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAS7C;AAaD,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,GAAG,KAAK,CAqC/E"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { influxSampleCap } from './influx-query.js';
|
|
5
|
+
const reserved = new Set(['', 'result', 'table', '_start', '_stop', '_time', '_value']);
|
|
6
|
+
/** Influx CSV has a leading unnamed annotation column, even with annotations
|
|
7
|
+
* disabled. Flow tables require named columns; remove only that empty envelope. */
|
|
8
|
+
export function dataTable(table) {
|
|
9
|
+
if (table.columns[0]?.name !== '')
|
|
10
|
+
return table;
|
|
11
|
+
if (table.rows.some(row => row[''] !== '') || table.columns.slice(1).some(column => column.name === '')) {
|
|
12
|
+
throw new Error('Invalid InfluxDB CSV envelope');
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
columns: table.columns.slice(1), key: table.key,
|
|
16
|
+
rows: table.rows.map(row => Object.fromEntries(Object.entries(row).filter(([name]) => name !== ''))),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Preserve ns precision for ordering while retaining the original timestamp. */
|
|
20
|
+
function timestamp(value) {
|
|
21
|
+
if (typeof value !== 'string')
|
|
22
|
+
throw new Error('Missing timestamp');
|
|
23
|
+
const match = /^(\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d)(?:\.(\d{1,9}))?Z$/.exec(value);
|
|
24
|
+
const seconds = match ? Date.parse(`${match[1]}Z`) : NaN;
|
|
25
|
+
if (!match || !Number.isFinite(seconds) || new Date(seconds).toISOString().slice(0, 19) !== match[1]) {
|
|
26
|
+
throw new Error('Expected an RFC3339 UTC timestamp');
|
|
27
|
+
}
|
|
28
|
+
return BigInt(seconds) * 1000000n + BigInt((match[2] ?? '').padEnd(9, '0'));
|
|
29
|
+
}
|
|
30
|
+
/** Several samples are history; several tag sets for one GUID are ambiguity. */
|
|
31
|
+
export function latestPerSeries(table, selection) {
|
|
32
|
+
table = dataTable(table);
|
|
33
|
+
const maxSamples = influxSampleCap(selection);
|
|
34
|
+
if (table.rows.length > maxSamples)
|
|
35
|
+
throw new Error('Sample cap exceeded; narrow the time range or tag filters');
|
|
36
|
+
if (table.rows.length === 0 && table.columns.length === 0) {
|
|
37
|
+
return { columns: [{ name: selection.guidTag, type: 'identifier' }], rows: [], key: selection.guidTag };
|
|
38
|
+
}
|
|
39
|
+
const columns = table.columns.map(column => column.name);
|
|
40
|
+
// Flux error tables carry error/reference and no _value; a data table may have an `error` tag column.
|
|
41
|
+
if (!columns.includes('_value') && (columns.includes('error') || columns.includes('reference')))
|
|
42
|
+
throw new Error('InfluxDB returned an error table');
|
|
43
|
+
if (new Set(columns).size !== columns.length)
|
|
44
|
+
throw new Error('Duplicate CSV columns');
|
|
45
|
+
for (const required of ['_time', '_value', '_measurement', '_field', selection.guidTag]) {
|
|
46
|
+
if (!columns.includes(required))
|
|
47
|
+
throw new Error(`InfluxDB response lacks ${required}`);
|
|
48
|
+
}
|
|
49
|
+
const identityColumns = columns.filter(name => !reserved.has(name)).sort();
|
|
50
|
+
const valuesAtTime = new Map();
|
|
51
|
+
const latest = new Map();
|
|
52
|
+
for (const row of table.rows) {
|
|
53
|
+
const raw = row._value;
|
|
54
|
+
const value = typeof raw === 'string' && /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/.test(raw) ? Number(raw) : NaN;
|
|
55
|
+
if (!Number.isFinite(value))
|
|
56
|
+
throw new Error('Expected a finite numeric reading');
|
|
57
|
+
if (row._measurement !== selection.measurement || row._field !== selection.field)
|
|
58
|
+
throw new Error('Unexpected measurement or field');
|
|
59
|
+
if (typeof row[selection.guidTag] !== 'string' || !row[selection.guidTag])
|
|
60
|
+
throw new Error('Missing IFC GUID tag');
|
|
61
|
+
const time = timestamp(row._time);
|
|
62
|
+
const key = JSON.stringify(identityColumns.map(column => [column, row[column]]));
|
|
63
|
+
const sampleKey = JSON.stringify([key, String(time)]);
|
|
64
|
+
const seenValue = valuesAtTime.get(sampleKey);
|
|
65
|
+
if (seenValue !== undefined && seenValue !== value)
|
|
66
|
+
throw new Error('Conflicting values at one series timestamp');
|
|
67
|
+
valuesAtTime.set(sampleKey, value);
|
|
68
|
+
const previous = latest.get(key);
|
|
69
|
+
if (!previous || time > previous.time)
|
|
70
|
+
latest.set(key, { row: { ...row, _value: value }, time });
|
|
71
|
+
else if (time === previous.time && value !== previous.row._value)
|
|
72
|
+
throw new Error('Conflicting values at one series timestamp');
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
columns: table.columns.map(column => column.name === '_value' ? { ...column, type: 'real' } : column),
|
|
76
|
+
rows: [...latest.values()].map(item => item.row), key: selection.guidTag,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=influx-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influx-table.js","sourceRoot":"","sources":["../src/influx-table.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAG/D,OAAO,EAAE,eAAe,EAAwB,MAAM,mBAAmB,CAAC;AAE1E,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExF;mFACmF;AACnF,MAAM,UAAU,SAAS,CAAC,KAAY;IACpC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAChD,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK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AI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,OAAO;KACzE,CAAC;AACJ,CAAC"}
|
package/dist/influx.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Pure InfluxDB 2 adapters shared by the headless recipe and viewer (#8090).
|
|
2
|
+
* No Flow execution, DOM, storage or environment access. */
|
|
3
|
+
import type { Row, Table } from '@ifc-lite/flow';
|
|
4
|
+
import { queryRequest, type InfluxSelection } from './influx-query.js';
|
|
5
|
+
import { dataTable, latestPerSeries } from './influx-table.js';
|
|
6
|
+
export { queryRequest, dataTable, latestPerSeries };
|
|
7
|
+
export type { InfluxSelection };
|
|
8
|
+
/** True when `value` carries the raw or URI-encoded token. Percent-escape hex
|
|
9
|
+
* digits are case-insensitive, so `%2f` matches `%2F` as well. */
|
|
10
|
+
export declare function containsInfluxToken(value: string, token: string): boolean;
|
|
11
|
+
export declare function redactInfluxError(error: unknown, token: string): string;
|
|
12
|
+
/** `token` is required so every caller states which credential must not be echoed back. */
|
|
13
|
+
export declare function parseInfluxCsv(csv: string, selection: InfluxSelection, token: string): {
|
|
14
|
+
history: Table;
|
|
15
|
+
latest: Table;
|
|
16
|
+
};
|
|
17
|
+
export declare class InfluxRequestError extends Error {
|
|
18
|
+
readonly kind: 'config' | 'network' | 'http' | 'data';
|
|
19
|
+
constructor(kind: 'config' | 'network' | 'http' | 'data', message: string);
|
|
20
|
+
}
|
|
21
|
+
/** True when any selection value or tag (sent in the URL or Flux body) carries the token. */
|
|
22
|
+
export declare function selectionContainsToken(selection: InfluxSelection, token: string): boolean;
|
|
23
|
+
/** Request/response byte and time bounds supplement the server-side sample cap.
|
|
24
|
+
* Never surface response bodies or transport exception messages (may echo auth). */
|
|
25
|
+
export declare function fetchInfluxReadings(selection: InfluxSelection, token: string, transport?: typeof fetch, signal?: AbortSignal): Promise<{
|
|
26
|
+
history: Table;
|
|
27
|
+
latest: Table;
|
|
28
|
+
}>;
|
|
29
|
+
/** Matching keeps model-space identity; duplicate GUIDs across models and
|
|
30
|
+
* competing series are both ambiguous, never resolved to a first match. */
|
|
31
|
+
export declare function matchInfluxSeries<T extends {
|
|
32
|
+
GlobalId: string;
|
|
33
|
+
}>(latest: Table, targets: readonly T[]): {
|
|
34
|
+
matched: {
|
|
35
|
+
row: Row;
|
|
36
|
+
target: T;
|
|
37
|
+
}[];
|
|
38
|
+
unmatched: Readonly<Record<string, import("@ifc-lite/flow").Scalar>>[];
|
|
39
|
+
ambiguous: Readonly<Record<string, import("@ifc-lite/flow").Scalar>>[];
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=influx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"influx.d.ts","sourceRoot":"","sources":["../src/influx.ts"],"names":[],"mappings":"AAIA;4DAC4D;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,CAAC;AAMhC;kEACkE;AAClE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAYzE;AAWD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,KAAK,CAAA;CAAE,CAExH;AAoBD,qBAAa,kBAAmB,SAAQ,KAAK;IAC/B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM;gBAA5C,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM;CAInF;AAED,6FAA6F;AAC7F,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGzF;AAED;oFACoF;AACpF,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,GAAE,OAAO,KAAa,EAAE,MAAM,CAAC,EAAE,WAAW;aAjCzC,KAAK;YAAU,KAAK;GA4FpH;AAED;2EAC2E;AAC3E,wBAAgB,iBAAiB,CAAC,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE;;aAYxE,GAAG;gBAAU,CAAC;;;;EAU3C"}
|
package/dist/influx.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { parseCsvText } from './csv-parse.js';
|
|
5
|
+
import { queryRequest } from './influx-query.js';
|
|
6
|
+
import { dataTable, latestPerSeries } from './influx-table.js';
|
|
7
|
+
export { queryRequest, dataTable, latestPerSeries };
|
|
8
|
+
function influxTokenForms(token) {
|
|
9
|
+
return token ? [...new Set([token, encodeURIComponent(token)])] : [];
|
|
10
|
+
}
|
|
11
|
+
/** True when `value` carries the raw or URI-encoded token. Percent-escape hex
|
|
12
|
+
* digits are case-insensitive, so `%2f` matches `%2F` as well. */
|
|
13
|
+
export function containsInfluxToken(value, token) {
|
|
14
|
+
if (!token)
|
|
15
|
+
return false;
|
|
16
|
+
if (value.includes(token))
|
|
17
|
+
return true;
|
|
18
|
+
const encoded = encodeURIComponent(token);
|
|
19
|
+
if (encoded !== token && value.toLowerCase().includes(encoded.toLowerCase()))
|
|
20
|
+
return true;
|
|
21
|
+
// Partially or noncanonically encoded forms (e.g. `secret%2Fa+b`) decode to the token.
|
|
22
|
+
if (!value.includes('%'))
|
|
23
|
+
return false;
|
|
24
|
+
// Decode each run of valid escapes on its own so an unrelated stray `%` cannot hide one.
|
|
25
|
+
const decoded = value.replace(/(?:%[0-9a-fA-F]{2})+/g, run => {
|
|
26
|
+
try {
|
|
27
|
+
return decodeURIComponent(run);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return run;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return decoded.includes(token);
|
|
34
|
+
}
|
|
35
|
+
/** Share raw/URI-encoded redaction for every surfaced error. */
|
|
36
|
+
function redactInfluxText(message, token) {
|
|
37
|
+
for (const secret of influxTokenForms(token)) {
|
|
38
|
+
message = message.split(secret).join('[REDACTED]');
|
|
39
|
+
}
|
|
40
|
+
// Same detection as containsInfluxToken: drop the whole message if any other encoding survives.
|
|
41
|
+
return containsInfluxToken(message, token) ? 'InfluxDB request failed ([REDACTED])' : message;
|
|
42
|
+
}
|
|
43
|
+
export function redactInfluxError(error, token) {
|
|
44
|
+
return redactInfluxText(error instanceof Error ? error.message : 'InfluxDB request failed', token);
|
|
45
|
+
}
|
|
46
|
+
/** `token` is required so every caller states which credential must not be echoed back. */
|
|
47
|
+
export function parseInfluxCsv(csv, selection, token) {
|
|
48
|
+
return parseInfluxResponse(csv, selection, token);
|
|
49
|
+
}
|
|
50
|
+
function parseInfluxResponse(csv, selection, token) {
|
|
51
|
+
if (new TextEncoder().encode(csv).length > 2 * 1024 * 1024)
|
|
52
|
+
throw new Error('InfluxDB response exceeds 2 MiB');
|
|
53
|
+
const parsed = parseCsvText(csv, ',', true);
|
|
54
|
+
const containsToken = (cell) => containsInfluxToken(cell, token);
|
|
55
|
+
// Decode CSV escaping first, then reject before grouping can change identity.
|
|
56
|
+
if (token && (parsed.header.some(containsToken) || parsed.rows.some(row => row.fields.some(containsToken)))) {
|
|
57
|
+
throw new InfluxRequestError('data', redactInfluxText('InfluxDB response contains credentials', token));
|
|
58
|
+
}
|
|
59
|
+
if (parsed.rows.some(row => row.fieldCountMismatch))
|
|
60
|
+
throw new Error('Malformed or multi-table CSV response');
|
|
61
|
+
const table = {
|
|
62
|
+
key: selection.guidTag,
|
|
63
|
+
columns: parsed.header.map(name => ({ name, type: 'string' })),
|
|
64
|
+
rows: parsed.rows.map(row => Object.fromEntries(parsed.header.map((name, i) => [name, row.fields[i]]))),
|
|
65
|
+
};
|
|
66
|
+
const history = dataTable(table);
|
|
67
|
+
return { history, latest: latestPerSeries(history, selection) };
|
|
68
|
+
}
|
|
69
|
+
export class InfluxRequestError extends Error {
|
|
70
|
+
kind;
|
|
71
|
+
constructor(kind, message) {
|
|
72
|
+
super(message);
|
|
73
|
+
this.kind = kind;
|
|
74
|
+
this.name = 'InfluxRequestError';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** True when any selection value or tag (sent in the URL or Flux body) carries the token. */
|
|
78
|
+
export function selectionContainsToken(selection, token) {
|
|
79
|
+
const publicValues = [...Object.values(selection), ...Object.entries(selection.tags ?? {}).flat()];
|
|
80
|
+
return publicValues.some(value => typeof value === 'string' && containsInfluxToken(value, token));
|
|
81
|
+
}
|
|
82
|
+
/** Request/response byte and time bounds supplement the server-side sample cap.
|
|
83
|
+
* Never surface response bodies or transport exception messages (may echo auth). */
|
|
84
|
+
export async function fetchInfluxReadings(selection, token, transport = fetch, signal) {
|
|
85
|
+
let request;
|
|
86
|
+
try {
|
|
87
|
+
if (token.length < 6 || /[\r\n]/.test(token))
|
|
88
|
+
throw new Error('Enter a valid token');
|
|
89
|
+
if (selectionContainsToken(selection, token))
|
|
90
|
+
throw new Error('Keep the token only in the password input');
|
|
91
|
+
request = queryRequest(selection);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
throw new InfluxRequestError('config', redactInfluxError(error, token));
|
|
95
|
+
}
|
|
96
|
+
const controller = new AbortController();
|
|
97
|
+
const abort = () => controller.abort();
|
|
98
|
+
signal?.addEventListener('abort', abort, { once: true });
|
|
99
|
+
if (signal?.aborted)
|
|
100
|
+
abort();
|
|
101
|
+
const timer = setTimeout(abort, 15000);
|
|
102
|
+
try {
|
|
103
|
+
let response;
|
|
104
|
+
try {
|
|
105
|
+
response = await transport(request.url, {
|
|
106
|
+
method: 'POST', headers: { Authorization: `Token ${token}`, 'Content-Type': 'application/json', Accept: 'application/csv' },
|
|
107
|
+
body: request.body, signal: controller.signal, credentials: 'omit', redirect: 'error', referrerPolicy: 'no-referrer',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
throw new InfluxRequestError('network', 'CORS or network error: the server must allow the viewer origin, or use a fixed-upstream gateway.');
|
|
112
|
+
}
|
|
113
|
+
if (!response.ok) {
|
|
114
|
+
await response.body?.cancel();
|
|
115
|
+
throw new InfluxRequestError('http', `InfluxDB query failed (HTTP ${response.status})`);
|
|
116
|
+
}
|
|
117
|
+
let csv = '';
|
|
118
|
+
try {
|
|
119
|
+
const reader = response.body?.getReader();
|
|
120
|
+
if (reader) {
|
|
121
|
+
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
122
|
+
let bytes = 0;
|
|
123
|
+
try {
|
|
124
|
+
while (true) {
|
|
125
|
+
const { done, value } = await reader.read();
|
|
126
|
+
if (done)
|
|
127
|
+
break;
|
|
128
|
+
bytes += value.byteLength;
|
|
129
|
+
if (bytes > 2 * 1024 * 1024)
|
|
130
|
+
throw new Error('InfluxDB response exceeds 2 MiB');
|
|
131
|
+
csv += decoder.decode(value, { stream: true });
|
|
132
|
+
}
|
|
133
|
+
csv += decoder.decode();
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
await reader.cancel();
|
|
137
|
+
reader.releaseLock();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return parseInfluxResponse(csv, selection, token);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
// Parser errors contain only fixed validation messages; transport stream
|
|
144
|
+
// exceptions may contain anything, so do not publish their text.
|
|
145
|
+
if (error instanceof InfluxRequestError)
|
|
146
|
+
throw error;
|
|
147
|
+
throw new InfluxRequestError('data', 'Invalid, truncated, oversized or nonnumeric InfluxDB response');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
clearTimeout(timer);
|
|
152
|
+
signal?.removeEventListener('abort', abort);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** Matching keeps model-space identity; duplicate GUIDs across models and
|
|
156
|
+
* competing series are both ambiguous, never resolved to a first match. */
|
|
157
|
+
export function matchInfluxSeries(latest, targets) {
|
|
158
|
+
const byGuid = new Map();
|
|
159
|
+
for (const target of targets) {
|
|
160
|
+
const list = byGuid.get(target.GlobalId) ?? [];
|
|
161
|
+
list.push(target);
|
|
162
|
+
byGuid.set(target.GlobalId, list);
|
|
163
|
+
}
|
|
164
|
+
const counts = new Map();
|
|
165
|
+
for (const row of latest.rows) {
|
|
166
|
+
const guid = String(row[latest.key]);
|
|
167
|
+
counts.set(guid, (counts.get(guid) ?? 0) + 1);
|
|
168
|
+
}
|
|
169
|
+
const matched = [];
|
|
170
|
+
const unmatched = [], ambiguous = [];
|
|
171
|
+
for (const row of latest.rows) {
|
|
172
|
+
const guid = String(row[latest.key]);
|
|
173
|
+
const candidates = byGuid.get(guid) ?? [];
|
|
174
|
+
if (!candidates.length)
|
|
175
|
+
unmatched.push(row);
|
|
176
|
+
else if (candidates.length !== 1 || counts.get(guid) !== 1)
|
|
177
|
+
ambiguous.push(row);
|
|
178
|
+
else
|
|
179
|
+
matched.push({ row, target: candidates[0] });
|
|
180
|
+
}
|
|
181
|
+
return { matched, unmat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E,SAAS,EAAE,CAAC;AAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/flow-nodes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Standard node library for @ifc-lite/flow over the ifc-lite SDK: model reads and writes, tables, viewer, and a sandboxed Script node",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,23 +25,28 @@
|
|
|
25
25
|
"types": "./dist/bcf-publication-node.d.ts",
|
|
26
26
|
"import": "./dist/bcf-publication-node.js",
|
|
27
27
|
"default": "./dist/bcf-publication-node.js"
|
|
28
|
+
},
|
|
29
|
+
"./influx": {
|
|
30
|
+
"types": "./dist/influx.d.ts",
|
|
31
|
+
"import": "./dist/influx.js",
|
|
32
|
+
"default": "./dist/influx.js"
|
|
28
33
|
}
|
|
29
34
|
},
|
|
30
35
|
"dependencies": {
|
|
31
36
|
"exceljs": "^4.4.0",
|
|
32
37
|
"@ifc-lite/ai": "^0.2.0",
|
|
33
|
-
"@ifc-lite/bcf-api": "^0.3.0",
|
|
34
38
|
"@ifc-lite/data": "^6.4.0",
|
|
39
|
+
"@ifc-lite/bcf-api": "^0.3.0",
|
|
40
|
+
"@ifc-lite/export": "^4.13.2",
|
|
35
41
|
"@ifc-lite/documents-api": "^0.2.1",
|
|
36
|
-
"@ifc-lite/export": "^4.13.1",
|
|
37
42
|
"@ifc-lite/extensions": "^0.12.0",
|
|
38
43
|
"@ifc-lite/flow": "^0.7.1",
|
|
39
|
-
"@ifc-lite/ids": "^3.4.2",
|
|
40
44
|
"@ifc-lite/mutations": "^3.2.0",
|
|
41
|
-
"@ifc-lite/ids-authoring": "^0.3.
|
|
45
|
+
"@ifc-lite/ids-authoring": "^0.3.3",
|
|
46
|
+
"@ifc-lite/ids": "^3.4.3",
|
|
42
47
|
"@ifc-lite/query": "^2.5.3",
|
|
43
|
-
"@ifc-lite/
|
|
44
|
-
"@ifc-lite/
|
|
48
|
+
"@ifc-lite/sandbox": "^2.12.1",
|
|
49
|
+
"@ifc-lite/sdk": "^9.6.0"
|
|
45
50
|
},
|
|
46
51
|
"devDependencies": {
|
|
47
52
|
"@types/node": "^26.6.4",
|