@milaboratories/pframes-rs-node 1.0.51 → 1.0.53
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/export/wrapper.ts +71 -41
- package/export_dist/index.js +21 -20
- package/export_dist/index.js.map +1 -1
- package/export_dist/index.mjs +250 -234
- package/export_dist/index.mjs.map +1 -1
- package/export_dist/wrapper.d.ts.map +1 -1
- package/package.json +3 -3
package/export/wrapper.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import humanizeDuration from 'humanize-duration';
|
|
2
2
|
import { ulid } from 'ulid';
|
|
3
3
|
import {
|
|
4
|
+
AbortError,
|
|
4
5
|
DataInfo,
|
|
5
6
|
PColumnInfo,
|
|
6
7
|
PColumnSpec,
|
|
8
|
+
PFrameError,
|
|
7
9
|
PObjectId,
|
|
8
10
|
PTableColumnId,
|
|
9
11
|
PTableColumnSpec,
|
|
@@ -13,7 +15,9 @@ import {
|
|
|
13
15
|
PTableVector,
|
|
14
16
|
TableRange,
|
|
15
17
|
UniqueValuesRequest,
|
|
16
|
-
UniqueValuesResponse
|
|
18
|
+
UniqueValuesResponse,
|
|
19
|
+
ensureError,
|
|
20
|
+
isAbortError
|
|
17
21
|
} from '@milaboratories/pl-model-common';
|
|
18
22
|
import type { PFrameInternal } from '@milaboratories/pl-model-middle-layer';
|
|
19
23
|
import type {
|
|
@@ -24,8 +28,8 @@ import type {
|
|
|
24
28
|
} from './addon-def';
|
|
25
29
|
import { AddonSymbol } from './addon';
|
|
26
30
|
import {
|
|
27
|
-
hashColumnId,
|
|
28
31
|
dump,
|
|
32
|
+
hashColumnId,
|
|
29
33
|
hashTableColumnId,
|
|
30
34
|
hashFilterColumnId,
|
|
31
35
|
hashUniqueValuesRequestColumnId,
|
|
@@ -38,7 +42,13 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
38
42
|
private readonly frame: NodeFrameSymbol;
|
|
39
43
|
|
|
40
44
|
static async pprofDump(): Promise<Uint8Array> {
|
|
41
|
-
|
|
45
|
+
try {
|
|
46
|
+
return await AddonSymbol.pprofDump();
|
|
47
|
+
} catch (err: unknown) {
|
|
48
|
+
throw new PFrameError(
|
|
49
|
+
`PFrame pprofDump failed, ` + `error:\n` + `${ensureError(err).message}`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
constructor(
|
|
@@ -58,11 +68,11 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
58
68
|
this.frame = AddonSymbol.pFrameCreate(spillPath, logger);
|
|
59
69
|
this.logger?.('info', `PFrame ${this.id} created`);
|
|
60
70
|
} catch (err: unknown) {
|
|
61
|
-
throw new
|
|
71
|
+
throw new PFrameError(
|
|
62
72
|
`PFrame ${this.id} creation failed, ` +
|
|
63
73
|
`logger: ${logger?.toString()}, ` +
|
|
64
74
|
`error:\n` +
|
|
65
|
-
`${(err
|
|
75
|
+
`${ensureError(err).message}`
|
|
66
76
|
);
|
|
67
77
|
}
|
|
68
78
|
}
|
|
@@ -93,12 +103,12 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
93
103
|
try {
|
|
94
104
|
return AddonSymbol.pFrameAddColumnSpec(this.frame, columnId, columnSpec);
|
|
95
105
|
} catch (err: unknown) {
|
|
96
|
-
throw new
|
|
106
|
+
throw new PFrameError(
|
|
97
107
|
`PFrame ${this.id} addColumnSpec request ${requestId} failed, ` +
|
|
98
108
|
`columnId: ${JSON.stringify(columnId)}, ` +
|
|
99
109
|
`columnSpec: ${JSON.stringify(columnSpec)}, ` +
|
|
100
110
|
`error:\n` +
|
|
101
|
-
`${(err
|
|
111
|
+
`${ensureError(err).message}`
|
|
102
112
|
);
|
|
103
113
|
}
|
|
104
114
|
}
|
|
@@ -173,11 +183,11 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
173
183
|
try {
|
|
174
184
|
return AddonSymbol.pFrameSetDataSource(this.frame, wrappedDataSource);
|
|
175
185
|
} catch (err: unknown) {
|
|
176
|
-
throw new
|
|
186
|
+
throw new PFrameError(
|
|
177
187
|
`PFrame ${this.id} setDataSource request ${requestId} failed, ` +
|
|
178
188
|
`dataSource: ${dataSource.toString()}, ` +
|
|
179
189
|
`error:\n` +
|
|
180
|
-
`${(err
|
|
190
|
+
`${ensureError(err).message}`
|
|
181
191
|
);
|
|
182
192
|
}
|
|
183
193
|
}
|
|
@@ -211,12 +221,12 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
211
221
|
try {
|
|
212
222
|
return AddonSymbol.pFrameSetColumnData(this.frame, columnId, dataInfo);
|
|
213
223
|
} catch (err: unknown) {
|
|
214
|
-
throw new
|
|
224
|
+
throw new PFrameError(
|
|
215
225
|
`PFrame ${this.id} setColumnData request ${requestId} failed, ` +
|
|
216
226
|
`columnId: ${JSON.stringify(columnId)}, ` +
|
|
217
227
|
`dataInfo: ${JSON.stringify(dataInfo)}, ` +
|
|
218
228
|
`error:\n` +
|
|
219
|
-
`${(err
|
|
229
|
+
`${ensureError(err).message}`
|
|
220
230
|
);
|
|
221
231
|
}
|
|
222
232
|
}
|
|
@@ -236,10 +246,10 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
236
246
|
AddonSymbol.pFrameDispose(this.frame);
|
|
237
247
|
this.logger?.('info', `PFrame ${this.id} disposed`);
|
|
238
248
|
} catch (err: unknown) {
|
|
239
|
-
throw new
|
|
249
|
+
throw new PFrameError(
|
|
240
250
|
`PFrame ${this.id} dispose request ${requestId} failed, ` +
|
|
241
251
|
`error:\n` +
|
|
242
|
-
`${(err
|
|
252
|
+
`${ensureError(err).message}`
|
|
243
253
|
);
|
|
244
254
|
}
|
|
245
255
|
}
|
|
@@ -266,11 +276,11 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
266
276
|
try {
|
|
267
277
|
return await AddonSymbol.pFrameFindColumns(this.frame, request);
|
|
268
278
|
} catch (err: unknown) {
|
|
269
|
-
throw new
|
|
279
|
+
throw new PFrameError(
|
|
270
280
|
`PFrame ${this.id} findColumns request ${requestId} failed, ` +
|
|
271
281
|
`request: ${JSON.stringify(request)}, ` +
|
|
272
282
|
`error:\n` +
|
|
273
|
-
`${(err
|
|
283
|
+
`${ensureError(err).message}`
|
|
274
284
|
);
|
|
275
285
|
} finally {
|
|
276
286
|
const t1 = performance.now();
|
|
@@ -299,11 +309,11 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
299
309
|
try {
|
|
300
310
|
return await AddonSymbol.pFrameDeleteColumn(this.frame, request);
|
|
301
311
|
} catch (err: unknown) {
|
|
302
|
-
throw new
|
|
312
|
+
throw new PFrameError(
|
|
303
313
|
`PFrame ${this.id} deleteColumn request ${requestId} failed, ` +
|
|
304
314
|
`request: ${JSON.stringify(request)}, ` +
|
|
305
315
|
`error:\n` +
|
|
306
|
-
`${(err
|
|
316
|
+
`${ensureError(err).message}`
|
|
307
317
|
);
|
|
308
318
|
} finally {
|
|
309
319
|
const t1 = performance.now();
|
|
@@ -332,11 +342,11 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
332
342
|
try {
|
|
333
343
|
return await AddonSymbol.pFrameGetColumnSpec(this.frame, columnId);
|
|
334
344
|
} catch (err: unknown) {
|
|
335
|
-
throw new
|
|
345
|
+
throw new PFrameError(
|
|
336
346
|
`PFrame ${this.id} getColumnSpec request ${requestId} failed, ` +
|
|
337
347
|
`columnId: ${JSON.stringify(columnId)}, ` +
|
|
338
348
|
`error:\n` +
|
|
339
|
-
`${(err
|
|
349
|
+
`${ensureError(err).message}`
|
|
340
350
|
);
|
|
341
351
|
} finally {
|
|
342
352
|
const t1 = performance.now();
|
|
@@ -362,10 +372,10 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
362
372
|
try {
|
|
363
373
|
return await AddonSymbol.pFrameListColumns(this.frame);
|
|
364
374
|
} catch (err: unknown) {
|
|
365
|
-
throw new
|
|
375
|
+
throw new PFrameError(
|
|
366
376
|
`PFrame ${this.id} listColumns request ${requestId} failed, ` +
|
|
367
377
|
`error:\n` +
|
|
368
|
-
`${(err
|
|
378
|
+
`${ensureError(err).message}`
|
|
369
379
|
);
|
|
370
380
|
} finally {
|
|
371
381
|
const t1 = performance.now();
|
|
@@ -401,11 +411,11 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
401
411
|
);
|
|
402
412
|
return new PTable(this, requestId, boxed);
|
|
403
413
|
} catch (err: unknown) {
|
|
404
|
-
throw new
|
|
414
|
+
throw new PFrameError(
|
|
405
415
|
`PFrame ${this.id} createTable request ${requestId} failed, ` +
|
|
406
416
|
`request: ${JSON.stringify(request)}, ` +
|
|
407
417
|
`error:\n` +
|
|
408
|
-
`${(err
|
|
418
|
+
`${ensureError(err).message}`
|
|
409
419
|
);
|
|
410
420
|
} finally {
|
|
411
421
|
const t1 = performance.now();
|
|
@@ -447,11 +457,16 @@ export class PFrame implements PFrameInternal.PFrameV8 {
|
|
|
447
457
|
ops?.signal
|
|
448
458
|
);
|
|
449
459
|
} catch (err: unknown) {
|
|
450
|
-
|
|
460
|
+
if (isAbortError(err)) {
|
|
461
|
+
throw new AbortError(
|
|
462
|
+
`PFrame ${this.id} getUniqueValues request ${requestId} cancelled`
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
throw new PFrameError(
|
|
451
466
|
`PFrame ${this.id} getUniqueValues request ${requestId} failed, ` +
|
|
452
467
|
`request: ${JSON.stringify(request)}, ` +
|
|
453
468
|
`error:\n` +
|
|
454
|
-
`${(err
|
|
469
|
+
`${ensureError(err).message}`
|
|
455
470
|
);
|
|
456
471
|
} finally {
|
|
457
472
|
const t1 = performance.now();
|
|
@@ -486,10 +501,10 @@ class PTable implements PFrameInternal.PTableV6 {
|
|
|
486
501
|
try {
|
|
487
502
|
return AddonSymbol.pTableGetSpec(this.table);
|
|
488
503
|
} catch (err: unknown) {
|
|
489
|
-
throw new
|
|
504
|
+
throw new PFrameError(
|
|
490
505
|
`PTable ${this.id} getSpec request ${requestId} failed, ` +
|
|
491
506
|
`error:\n` +
|
|
492
|
-
`${(err
|
|
507
|
+
`${ensureError(err).message}`
|
|
493
508
|
);
|
|
494
509
|
}
|
|
495
510
|
}
|
|
@@ -511,11 +526,11 @@ class PTable implements PFrameInternal.PTableV6 {
|
|
|
511
526
|
try {
|
|
512
527
|
return AddonSymbol.pTableGetColumnIndices(this.table, columnIds);
|
|
513
528
|
} catch (err: unknown) {
|
|
514
|
-
throw new
|
|
529
|
+
throw new PFrameError(
|
|
515
530
|
`PTable ${this.id} getColumnIndices request ${requestId} failed, ` +
|
|
516
531
|
`columnIds: ${JSON.stringify(columnIds)}, ` +
|
|
517
532
|
`error:\n` +
|
|
518
|
-
`${(err
|
|
533
|
+
`${ensureError(err).message}`
|
|
519
534
|
);
|
|
520
535
|
}
|
|
521
536
|
}
|
|
@@ -547,10 +562,15 @@ class PTable implements PFrameInternal.PTableV6 {
|
|
|
547
562
|
ops?.signal
|
|
548
563
|
);
|
|
549
564
|
} catch (err: unknown) {
|
|
550
|
-
|
|
565
|
+
if (isAbortError(err)) {
|
|
566
|
+
throw new AbortError(
|
|
567
|
+
`PTable ${this.id} getFootprint request ${requestId} cancelled`
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
throw new PFrameError(
|
|
551
571
|
`PTable ${this.id} getFootprint request ${requestId} failed, ` +
|
|
552
572
|
`error:\n` +
|
|
553
|
-
`${(err
|
|
573
|
+
`${ensureError(err).message}`
|
|
554
574
|
);
|
|
555
575
|
} finally {
|
|
556
576
|
const t1 = performance.now();
|
|
@@ -581,10 +601,15 @@ class PTable implements PFrameInternal.PTableV6 {
|
|
|
581
601
|
ops?.signal?.throwIfAborted();
|
|
582
602
|
return await AddonSymbol.pTableGetShape(this.table, ops?.signal);
|
|
583
603
|
} catch (err: unknown) {
|
|
584
|
-
|
|
604
|
+
if (isAbortError(err)) {
|
|
605
|
+
throw new AbortError(
|
|
606
|
+
`PTable ${this.id} getShape request ${requestId} cancelled`
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
throw new PFrameError(
|
|
585
610
|
`PTable ${this.id} getShape request ${requestId} failed, ` +
|
|
586
611
|
`error:\n` +
|
|
587
|
-
`${(err
|
|
612
|
+
`${ensureError(err).message}`
|
|
588
613
|
);
|
|
589
614
|
} finally {
|
|
590
615
|
const t1 = performance.now();
|
|
@@ -634,12 +659,17 @@ class PTable implements PFrameInternal.PTableV6 {
|
|
|
634
659
|
rowCount = result[0].data.length;
|
|
635
660
|
return result;
|
|
636
661
|
} catch (err: unknown) {
|
|
637
|
-
|
|
662
|
+
if (isAbortError(err)) {
|
|
663
|
+
throw new AbortError(
|
|
664
|
+
`PTable ${this.id} getData request ${requestId} cancelled`
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
throw new PFrameError(
|
|
638
668
|
`PTable ${this.id} getData request ${requestId} failed, ` +
|
|
639
669
|
`columnIndices: ${JSON.stringify(columnIndices)}, ` +
|
|
640
670
|
`range: ${ops?.range ? JSON.stringify(ops.range) : undefined}, ` +
|
|
641
671
|
`error:\n` +
|
|
642
|
-
`${(err
|
|
672
|
+
`${ensureError(err).message}`
|
|
643
673
|
);
|
|
644
674
|
} finally {
|
|
645
675
|
const t1 = performance.now();
|
|
@@ -676,11 +706,11 @@ class PTable implements PFrameInternal.PTableV6 {
|
|
|
676
706
|
const boxed = AddonSymbol.pTableFilter(this.table, requestId, request);
|
|
677
707
|
return new PTable(this.frame, requestId, boxed);
|
|
678
708
|
} catch (err: unknown) {
|
|
679
|
-
throw new
|
|
709
|
+
throw new PFrameError(
|
|
680
710
|
`PTable ${this.id} filter request ${requestId} failed, ` +
|
|
681
711
|
`request: ${JSON.stringify(request)}, ` +
|
|
682
712
|
`error:\n` +
|
|
683
|
-
`${(err
|
|
713
|
+
`${ensureError(err).message}`
|
|
684
714
|
);
|
|
685
715
|
} finally {
|
|
686
716
|
const t1 = performance.now();
|
|
@@ -715,11 +745,11 @@ class PTable implements PFrameInternal.PTableV6 {
|
|
|
715
745
|
const boxed = AddonSymbol.pTableSort(this.table, requestId, request);
|
|
716
746
|
return new PTable(this.frame, requestId, boxed);
|
|
717
747
|
} catch (err: unknown) {
|
|
718
|
-
throw new
|
|
748
|
+
throw new PFrameError(
|
|
719
749
|
`PTable ${this.id} sort request ${requestId} failed, ` +
|
|
720
750
|
`request: ${JSON.stringify(request)}, ` +
|
|
721
751
|
`error:\n` +
|
|
722
|
-
`${(err
|
|
752
|
+
`${ensureError(err).message}`
|
|
723
753
|
);
|
|
724
754
|
} finally {
|
|
725
755
|
const t1 = performance.now();
|
|
@@ -745,10 +775,10 @@ class PTable implements PFrameInternal.PTableV6 {
|
|
|
745
775
|
AddonSymbol.pTableDispose(this.table);
|
|
746
776
|
this.frame.logger?.('info', `PTable ${this.id} disposed`);
|
|
747
777
|
} catch (err: unknown) {
|
|
748
|
-
throw new
|
|
778
|
+
throw new PFrameError(
|
|
749
779
|
`PTable ${this.id} dispose request ${requestId} failed, ` +
|
|
750
780
|
`error:\n` +
|
|
751
|
-
`${(err
|
|
781
|
+
`${ensureError(err).message}`
|
|
752
782
|
);
|
|
753
783
|
}
|
|
754
784
|
}
|
package/export_dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
"use strict";var I=Object.defineProperty;var j=(
|
|
2
|
-
${
|
|
3
|
-
${
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
${
|
|
7
|
-
${a.
|
|
8
|
-
${a.
|
|
9
|
-
${a.
|
|
10
|
-
${
|
|
11
|
-
${
|
|
12
|
-
${
|
|
13
|
-
${
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
1
|
+
"use strict";var I=Object.defineProperty;var j=(s,r,e)=>r in s?I(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var P=(s,r,e)=>j(s,typeof r!="symbol"?r+"":r,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("humanize-duration"),m=require("ulid"),a=require("@milaboratories/pl-model-common"),M=require("node:module"),q=require("node:path"),U=require("node:url"),A=require("@mapbox/node-pre-gyp"),R=require("node:crypto"),p=require("node:fs"),S=require("node:stream");var F=typeof document<"u"?document.currentScript:null;const E=typeof document>"u"?require("url").pathToFileURL(__filename).href:F&&F.tagName.toUpperCase()==="SCRIPT"&&F.src||new URL("index.js",document.baseURI).href,J=q.dirname(U.fileURLToPath(E)),N=M.createRequire(E),{find:O}=A,d=N(O(q.resolve(J,"../package.json")));async function C(s){try{return await p.promises.access(s),!0}catch{return!1}}async function k(s){await C(s)||await p.promises.mkdir(s,{recursive:!0})}async function v(s,r){const e=`${s}.tmp`;await C(e)&&await p.promises.rm(e,{recursive:!0});const t=typeof r=="string"?Buffer.from(r,"utf8"):r,i=S.Readable.from(t),n=p.createWriteStream(e,{flags:"wx"});await S.Readable.toWeb(i).pipeTo(S.Writable.toWeb(n)),await p.promises.rename(e,s)}function $(s){return R.createHash("sha256").update(s).digest("hex")}function b(s){return s.type==="column"?{...s,id:$(s.id)}:s}function D(s){return{...s,column:b(s.column)}}function _(s){return{...s,columnId:$(s.columnId),filters:s.filters.map(D)}}function B(s){return{...s,column:b(s.column)}}function w(s){const r=s.type;switch(r){case"column":return{...s,columnId:$(s.columnId)};case"slicedColumn":return{...s,columnId:$(s.columnId),newId:$(s.newId)};case"inlineColumn":return{...s,newId:$(s.newId)};case"inner":return{...s,entries:s.entries.map(w)};case"full":return{...s,entries:s.entries.map(w)};case"outer":return{...s,primary:w(s.primary),secondary:s.secondary.map(w)};default:throw new Error(`Unsupported join entry type: ${r}`)}}function V(s){return{...s,src:w(s.src),filters:s.filters.map(D)}}async function l(s,r,e){if(process.env.MI_DUMP_PFRAMES_RS)try{const t=s.map(o=>encodeURIComponent(o)),i=q.join(process.env.MI_DUMP_PFRAMES_RS,...t.slice(0,-1));await k(i);const n=q.join(process.env.MI_DUMP_PFRAMES_RS,...t),u=ArrayBuffer.isView(r)?r:JSON.stringify(r,null,2);await v(n,u)}catch(t){e==null||e("warn",`error while dumping PFrames data: ${t}`)}}let x=class{constructor(r,e){P(this,"id",m.ulid());P(this,"frame");var t;this.logger=e,l([`${this.id}`,`${this.id}.json`],{timeStamp:Date.now(),requestType:"create"},this.logger);try{this.frame=d.pFrameCreate(r,e),(t=this.logger)==null||t.call(this,"info",`PFrame ${this.id} created`)}catch(i){throw new a.PFrameError(`PFrame ${this.id} creation failed, logger: ${e==null?void 0:e.toString()}, error:
|
|
2
|
+
${a.ensureError(i).message}`)}}static async pprofDump(){try{return await d.pprofDump()}catch(r){throw new a.PFrameError(`PFrame pprofDump failed, error:
|
|
3
|
+
${a.ensureError(r).message}`)}}addColumnSpec(r,e){const t=m.ulid();l([`${this.id}`,`${t}.json`],{timeStamp:Date.now(),requestType:"addColumnSpec",requestData:{columnId:$(r),columnSpec:e}},this.logger),l([`${this.id}`,"data",`${$(r)}.spec`],{...e},this.logger);try{return d.pFrameAddColumnSpec(this.frame,r,e)}catch(i){throw new a.PFrameError(`PFrame ${this.id} addColumnSpec request ${t} failed, columnId: ${JSON.stringify(r)}, columnSpec: ${JSON.stringify(e)}, error:
|
|
4
|
+
${a.ensureError(i).message}`)}}setDataSource(r){const e=m.ulid();l([`${this.id}`,`${e}.json`],{timeStamp:Date.now(),requestType:"setDataSource"},this.logger);const t={preloadBlob:async i=>{var o,h;const n=m.ulid();l([`${this.id}`,`${n}.json`],{timeStamp:Date.now(),requestType:"preloadBlob",requestData:{blobIds:i}},this.logger),(o=this.logger)==null||o.call(this,"info",`PFrame ${this.id} preloadBlob started, blobIds: ${JSON.stringify(i)}`);const u=performance.now();try{return await r.preloadBlob(i)}finally{const c=performance.now();(h=this.logger)==null||h.call(this,"info",`PFrame ${this.id} preloadBlob finished, took ${f(Math.round(c-u))} (${i.length} blobs)`)}},resolveBlobContent:async i=>{var o;const n=m.ulid();l([`${this.id}`,`${n}.json`],{timeStamp:Date.now(),requestType:"resolveBlobContent",requestData:{blobId:i}},this.logger);const u=await r.resolveBlobContent(i);return(o=this.logger)==null||o.call(this,"info",`PFrame ${this.id} resolved blob ${i}`),l([`${this.id}`,"data",`${i}`],u,this.logger),u}};try{return d.pFrameSetDataSource(this.frame,t)}catch(i){throw new a.PFrameError(`PFrame ${this.id} setDataSource request ${e} failed, dataSource: ${r.toString()}, error:
|
|
5
|
+
${a.ensureError(i).message}`)}}setColumnData(r,e){const t=m.ulid();l([`${this.id}`,`${t}.json`],{timeStamp:Date.now(),requestType:"setColumnData",requestData:{columnId:$(r),dataInfo:e}},this.logger),l([`${this.id}`,"data",`${$(r)}.datainfo`],{...e},this.logger);try{return d.pFrameSetColumnData(this.frame,r,e)}catch(i){throw new a.PFrameError(`PFrame ${this.id} setColumnData request ${t} failed, columnId: ${JSON.stringify(r)}, dataInfo: ${JSON.stringify(e)}, error:
|
|
6
|
+
${a.ensureError(i).message}`)}}dispose(){var e;const r=m.ulid();l([`${this.id}`,`${r}.json`],{timeStamp:Date.now(),requestType:"dispose"},this.logger);try{d.pFrameDispose(this.frame),(e=this.logger)==null||e.call(this,"info",`PFrame ${this.id} disposed`)}catch(t){throw new a.PFrameError(`PFrame ${this.id} dispose request ${r} failed, error:
|
|
7
|
+
${a.ensureError(t).message}`)}}[Symbol.dispose](){this.dispose()}async findColumns(r){var i;const e=m.ulid();l([`${this.id}`,`${e}.json`],{timeStamp:Date.now(),requestType:"findColumns",requestData:r},this.logger);const t=performance.now();try{return await d.pFrameFindColumns(this.frame,r)}catch(n){throw new a.PFrameError(`PFrame ${this.id} findColumns request ${e} failed, request: ${JSON.stringify(r)}, error:
|
|
8
|
+
${a.ensureError(n).message}`)}finally{const n=performance.now();(i=this.logger)==null||i.call(this,"info",`PFrame ${this.id} findColumns request ${e} took ${f(Math.round(n-t))}`)}}async deleteColumn(r){var i;const e=m.ulid();l([`${this.id}`,`${e}.json`],{timeStamp:Date.now(),requestType:"deleteColumn",requestData:r},this.logger);const t=performance.now();try{return await d.pFrameDeleteColumn(this.frame,r)}catch(n){throw new a.PFrameError(`PFrame ${this.id} deleteColumn request ${e} failed, request: ${JSON.stringify(r)}, error:
|
|
9
|
+
${a.ensureError(n).message}`)}finally{const n=performance.now();(i=this.logger)==null||i.call(this,"info",`PFrame ${this.id} deleteColumn request ${e} took ${f(Math.round(n-t))}`)}}async getColumnSpec(r){var i;const e=m.ulid();l([`${this.id}`,`${e}.json`],{timeStamp:Date.now(),requestType:"getColumnSpec",requestData:{columnId:$(r)}},this.logger);const t=performance.now();try{return await d.pFrameGetColumnSpec(this.frame,r)}catch(n){throw new a.PFrameError(`PFrame ${this.id} getColumnSpec request ${e} failed, columnId: ${JSON.stringify(r)}, error:
|
|
10
|
+
${a.ensureError(n).message}`)}finally{const n=performance.now();(i=this.logger)==null||i.call(this,"info",`PFrame ${this.id} getColumnSpec request ${e} took ${f(Math.round(n-t))}`)}}async listColumns(){var t;const r=m.ulid();l([`${this.id}`,`${r}.json`],{timeStamp:Date.now(),requestType:"listColumns"},this.logger);const e=performance.now();try{return await d.pFrameListColumns(this.frame)}catch(i){throw new a.PFrameError(`PFrame ${this.id} listColumns request ${r} failed, error:
|
|
11
|
+
${a.ensureError(i).message}`)}finally{const i=performance.now();(t=this.logger)==null||t.call(this,"info",`PFrame ${this.id} listColumns request ${r} took ${f(Math.round(i-e))}`)}}createTable(r){var n;const e=m.ulid(),t={timeStamp:Date.now(),requestType:"createTable",requestData:V(r)};l([`${this.id}`,`${e}.json`],t,this.logger),l([`${this.id}`,`${e}`,`${e}.json`],t,this.logger);const i=performance.now();try{const u=d.pFrameCreateTable(this.frame,e,r);return new y(this,e,u)}catch(u){throw new a.PFrameError(`PFrame ${this.id} createTable request ${e} failed, request: ${JSON.stringify(r)}, error:
|
|
12
|
+
${a.ensureError(u).message}`)}finally{const u=performance.now();(n=this.logger)==null||n.call(this,"info",`PFrame ${this.id} createTable request ${e} took ${f(Math.round(u-i))}`)}}async getUniqueValues(r,e){var n,u,o;const t=m.ulid();l([`${this.id}`,`${t}.json`],{timeStamp:Date.now(),requestType:"getUniqueValues",requestData:_(r)},this.logger),(n=this.logger)==null||n.call(this,"info",`PFrame ${this.id} getUniqueValues request ${t} started`);const i=performance.now();try{return(u=e==null?void 0:e.signal)==null||u.throwIfAborted(),await d.pFrameGetUniqueValues(this.frame,t,r,e==null?void 0:e.signal)}catch(h){throw a.isAbortError(h)?new a.AbortError(`PFrame ${this.id} getUniqueValues request ${t} cancelled`):new a.PFrameError(`PFrame ${this.id} getUniqueValues request ${t} failed, request: ${JSON.stringify(r)}, error:
|
|
13
|
+
${a.ensureError(h).message}`)}finally{const h=performance.now();(o=this.logger)==null||o.call(this,"info",`PFrame ${this.id} getUniqueValues request ${t} finished, took ${f(Math.round(h-i))}`)}}};class y{constructor(r,e,t){var i,n;this.frame=r,this.id=e,this.table=t,(n=(i=this.frame).logger)==null||n.call(i,"info",`PTable ${this.id} created`)}getSpec(){const r=m.ulid();l([`${this.frame.id}`,`${this.id}`,`${r}.json`],{timeStamp:Date.now(),requestType:"getSpec"},this.frame.logger);try{return d.pTableGetSpec(this.table)}catch(e){throw new a.PFrameError(`PTable ${this.id} getSpec request ${r} failed, error:
|
|
14
|
+
${a.ensureError(e).message}`)}}getColumnIndices(r){const e=m.ulid();l([`${this.frame.id}`,`${this.id}`,`${e}.json`],{timeStamp:Date.now(),requestType:"getColumnIndices",requestData:{columnIds:r.map(b)}},this.frame.logger);try{return d.pTableGetColumnIndices(this.table,r)}catch(t){throw new a.PFrameError(`PTable ${this.id} getColumnIndices request ${e} failed, columnIds: ${JSON.stringify(r)}, error:
|
|
15
|
+
${a.ensureError(t).message}`)}}async getFootprint(r){var i,n,u,o,h;const e=m.ulid();l([`${this.frame.id}`,`${this.id}`,`${e}.json`],{timeStamp:Date.now(),requestType:"getFootprint"},this.frame.logger),(n=(i=this.frame).logger)==null||n.call(i,"info",`PTable ${this.id} getFootprint request ${e} started`);const t=performance.now();try{return(u=r==null?void 0:r.signal)==null||u.throwIfAborted(),await d.pTableGetFootprint(this.table,(r==null?void 0:r.withPredecessors)??!1,r==null?void 0:r.signal)}catch(c){throw a.isAbortError(c)?new a.AbortError(`PTable ${this.id} getFootprint request ${e} cancelled`):new a.PFrameError(`PTable ${this.id} getFootprint request ${e} failed, error:
|
|
16
|
+
${a.ensureError(c).message}`)}finally{const c=performance.now();(h=(o=this.frame).logger)==null||h.call(o,"info",`PTable ${this.id} getFootprint request ${e} finished, took ${f(Math.round(c-t))}`)}}async getShape(r){var i,n,u,o,h;const e=m.ulid();l([`${this.frame.id}`,`${this.id}`,`${e}.json`],{timeStamp:Date.now(),requestType:"getShape"},this.frame.logger),(n=(i=this.frame).logger)==null||n.call(i,"info",`PTable ${this.id} getShape request ${e} started`);const t=performance.now();try{return(u=r==null?void 0:r.signal)==null||u.throwIfAborted(),await d.pTableGetShape(this.table,r==null?void 0:r.signal)}catch(c){throw a.isAbortError(c)?new a.AbortError(`PTable ${this.id} getShape request ${e} cancelled`):new a.PFrameError(`PTable ${this.id} getShape request ${e} failed, error:
|
|
17
|
+
${a.ensureError(c).message}`)}finally{const c=performance.now();(h=(o=this.frame).logger)==null||h.call(o,"info",`PTable ${this.id} getShape request ${e} finished, took ${f(Math.round(c-t))}`)}}async getData(r,e){var u,o,h,c,T;const t=m.ulid();l([`${this.frame.id}`,`${this.id}`,`${t}.json`],{timeStamp:Date.now(),requestType:"getData",requestData:{columnIndices:r,range:(e==null?void 0:e.range)??null}},this.frame.logger),(o=(u=this.frame).logger)==null||o.call(u,"info",`PTable ${this.id} getData request ${t} started`);let i=0;const n=performance.now();try{(h=e==null?void 0:e.signal)==null||h.throwIfAborted();const g=await d.pTableGetData(this.table,t,r,e==null?void 0:e.range,e==null?void 0:e.signal);return i=g[0].data.length,g}catch(g){throw a.isAbortError(g)?new a.AbortError(`PTable ${this.id} getData request ${t} cancelled`):new a.PFrameError(`PTable ${this.id} getData request ${t} failed, columnIndices: ${JSON.stringify(r)}, range: ${e!=null&&e.range?JSON.stringify(e.range):void 0}, error:
|
|
18
|
+
${a.ensureError(g).message}`)}finally{const g=performance.now();(T=(c=this.frame).logger)==null||T.call(c,"info",`PTable ${this.id} getData request ${t} finished, took ${f(Math.round(g-n))} (${i} rows)`)}}filter(r){var n,u;const e=m.ulid(),t={timeStamp:Date.now(),table:this.id,requestType:"filter",requestData:{filters:r.map(D)}};l([`${this.frame.id}`,`${e}.json`],t,this.frame.logger),l([`${this.frame.id}`,`${e}`,`${e}.json`],t,this.frame.logger);const i=performance.now();try{const o=d.pTableFilter(this.table,e,r);return new y(this.frame,e,o)}catch(o){throw new a.PFrameError(`PTable ${this.id} filter request ${e} failed, request: ${JSON.stringify(r)}, error:
|
|
19
|
+
${a.ensureError(o).message}`)}finally{const o=performance.now();(u=(n=this.frame).logger)==null||u.call(n,"info",`PTable ${this.id} filter request ${e} took ${f(Math.round(o-i))}`)}}sort(r){var n,u;const e=m.ulid(),t={timeStamp:Date.now(),table:this.id,requestType:"sort",requestData:r.map(B)};l([`${this.frame.id}`,`${e}.json`],t,this.frame.logger),l([`${this.frame.id}`,`${e}`,`${e}.json`],t,this.frame.logger);const i=performance.now();try{const o=d.pTableSort(this.table,e,r);return new y(this.frame,e,o)}catch(o){throw new a.PFrameError(`PTable ${this.id} sort request ${e} failed, request: ${JSON.stringify(r)}, error:
|
|
20
|
+
${a.ensureError(o).message}`)}finally{const o=performance.now();(u=(n=this.frame).logger)==null||u.call(n,"info",`PTable ${this.id} sort request ${e} took ${f(Math.round(o-i))}`)}}dispose(){var e,t;const r=m.ulid();l([`${this.frame.id}`,`${this.id}`,`${r}.json`],{timeStamp:Date.now(),requestType:"dispose"},this.frame.logger);try{d.pTableDispose(this.table),(t=(e=this.frame).logger)==null||t.call(e,"info",`PTable ${this.id} disposed`)}catch(i){throw new a.PFrameError(`PTable ${this.id} dispose request ${r} failed, error:
|
|
21
|
+
${a.ensureError(i).message}`)}}[Symbol.dispose](){this.dispose()}}const G=x;exports.PFrame=G;
|
|
21
22
|
//# sourceMappingURL=index.js.map
|