@milaboratories/pframes-rs-node 1.0.43 → 1.0.45

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.
@@ -1,128 +1,128 @@
1
- var C = Object.defineProperty;
2
- var F = (i, e, t) => e in i ? C(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var S = (i, e, t) => F(i, typeof e != "symbol" ? e + "" : e, t);
1
+ var F = Object.defineProperty;
2
+ var I = (i, t, e) => t in i ? F(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var S = (i, t, e) => I(i, typeof t != "symbol" ? t + "" : t, e);
4
4
  import f from "humanize-duration";
5
- import { ulid as h } from "ulid";
6
- import { createRequire as I } from "node:module";
7
- import D, { dirname as j, resolve as E } from "node:path";
8
- import { fileURLToPath as M } from "node:url";
9
- import J from "@mapbox/node-pre-gyp";
10
- import { createHash as N } from "node:crypto";
11
- import g from "node:fs";
12
- import { Readable as b, Writable as O } from "node:stream";
13
- const T = import.meta.url, U = j(M(T)), R = I(T), { find: k } = J, u = R(
14
- k(E(U, "../package.json"))
5
+ import { ulid as l } from "ulid";
6
+ import { createRequire as j } from "node:module";
7
+ import T, { dirname as E, resolve as M } from "node:path";
8
+ import { fileURLToPath as J } from "node:url";
9
+ import N from "@mapbox/node-pre-gyp";
10
+ import { createHash as O } from "node:crypto";
11
+ import p from "node:fs";
12
+ import { Readable as b, Writable as U } from "node:stream";
13
+ const C = import.meta.url, R = E(J(C)), k = j(C), { find: v } = N, u = k(
14
+ v(M(R, "../package.json"))
15
15
  );
16
16
  async function P(i) {
17
17
  try {
18
- return await g.promises.access(i), !0;
18
+ return await p.promises.access(i), !0;
19
19
  } catch {
20
20
  return !1;
21
21
  }
22
22
  }
23
- async function v(i) {
24
- await P(i) || await g.promises.mkdir(i, { recursive: !0 });
23
+ async function A(i) {
24
+ await P(i) || await p.promises.mkdir(i, { recursive: !0 });
25
25
  }
26
- async function A(i, e) {
27
- const t = `${i}.tmp`;
28
- await P(t) && await g.promises.rm(t, { recursive: !0 });
29
- const r = typeof e == "string" ? Buffer.from(e, "utf8") : e, o = b.from(r), s = g.createWriteStream(t, { flags: "wx" });
30
- await b.toWeb(o).pipeTo(O.toWeb(s)), await g.promises.rename(t, i);
26
+ async function x(i, t) {
27
+ const e = `${i}.tmp`;
28
+ await P(e) && await p.promises.rm(e, { recursive: !0 });
29
+ const r = typeof t == "string" ? Buffer.from(t, "utf8") : t, s = b.from(r), a = p.createWriteStream(e, { flags: "wx" });
30
+ await b.toWeb(s).pipeTo(U.toWeb(a)), await p.promises.rename(e, i);
31
31
  }
32
- function l(i) {
33
- return N("sha256").update(i).digest("hex");
32
+ function d(i) {
33
+ return O("sha256").update(i).digest("hex");
34
34
  }
35
- function y(i) {
35
+ function q(i) {
36
36
  return i.type === "column" ? {
37
37
  ...i,
38
- id: l(i.id)
38
+ id: d(i.id)
39
39
  } : i;
40
40
  }
41
- function q(i) {
41
+ function y(i) {
42
42
  return {
43
43
  ...i,
44
- column: y(i.column)
44
+ column: q(i.column)
45
45
  };
46
46
  }
47
- function x(i) {
47
+ function B(i) {
48
48
  return {
49
49
  ...i,
50
- columnId: l(i.columnId),
51
- filters: i.filters.map(q)
50
+ columnId: d(i.columnId),
51
+ filters: i.filters.map(y)
52
52
  };
53
53
  }
54
- function B(i) {
54
+ function V(i) {
55
55
  return {
56
56
  ...i,
57
- column: y(i.column)
57
+ column: q(i.column)
58
58
  };
59
59
  }
60
- function p(i) {
61
- const e = i.type;
62
- switch (e) {
60
+ function g(i) {
61
+ const t = i.type;
62
+ switch (t) {
63
63
  case "column":
64
64
  return {
65
65
  ...i,
66
- columnId: l(i.columnId)
66
+ columnId: d(i.columnId)
67
67
  };
68
68
  case "slicedColumn":
69
69
  return {
70
70
  ...i,
71
- columnId: l(i.columnId),
72
- newId: l(i.newId)
71
+ columnId: d(i.columnId),
72
+ newId: d(i.newId)
73
73
  };
74
74
  case "inlineColumn":
75
75
  return {
76
76
  ...i,
77
- newId: l(i.newId)
77
+ newId: d(i.newId)
78
78
  };
79
79
  case "inner":
80
80
  return {
81
81
  ...i,
82
- entries: i.entries.map(p)
82
+ entries: i.entries.map(g)
83
83
  };
84
84
  case "full":
85
85
  return {
86
86
  ...i,
87
- entries: i.entries.map(p)
87
+ entries: i.entries.map(g)
88
88
  };
89
89
  case "outer":
90
90
  return {
91
91
  ...i,
92
- primary: p(i.primary),
93
- secondary: i.secondary.map(p)
92
+ primary: g(i.primary),
93
+ secondary: i.secondary.map(g)
94
94
  };
95
95
  default:
96
- throw new Error(`Unsupported join entry type: ${e}`);
96
+ throw new Error(`Unsupported join entry type: ${t}`);
97
97
  }
98
98
  }
99
- function V(i) {
99
+ function _(i) {
100
100
  return {
101
101
  ...i,
102
- src: p(i.src),
103
- filters: i.filters.map(q)
102
+ src: g(i.src),
103
+ filters: i.filters.map(y)
104
104
  };
105
105
  }
106
- async function a(i, e, t) {
106
+ async function o(i, t, e) {
107
107
  if (process.env.MI_DUMP_PFRAMES_RS)
108
108
  try {
109
- const r = i.map((n) => encodeURIComponent(n)), o = D.join(
109
+ const r = i.map((n) => encodeURIComponent(n)), s = T.join(
110
110
  process.env.MI_DUMP_PFRAMES_RS,
111
111
  ...r.slice(0, -1)
112
112
  );
113
- await v(o);
114
- const s = D.join(process.env.MI_DUMP_PFRAMES_RS, ...r), m = ArrayBuffer.isView(e) ? e : JSON.stringify(e, null, 2);
115
- await A(s, m);
113
+ await A(s);
114
+ const a = T.join(process.env.MI_DUMP_PFRAMES_RS, ...r), m = ArrayBuffer.isView(t) ? t : JSON.stringify(t, null, 2);
115
+ await x(a, m);
116
116
  } catch (r) {
117
- t == null || t("warn", `error while dumping PFrames data: ${r}`);
117
+ e == null || e("warn", `error while dumping PFrames data: ${r}`);
118
118
  }
119
119
  }
120
- let _ = class {
121
- constructor(e, t) {
122
- S(this, "id", h());
120
+ let G = class {
121
+ constructor(t, e) {
122
+ S(this, "id", l());
123
123
  S(this, "frame");
124
124
  var r;
125
- this.logger = t, a(
125
+ this.logger = e, o(
126
126
  [`${this.id}`, `${this.id}.json`],
127
127
  {
128
128
  timeStamp: Date.now(),
@@ -131,144 +131,144 @@ let _ = class {
131
131
  this.logger
132
132
  );
133
133
  try {
134
- this.frame = u.pFrameCreate(e, t), (r = this.logger) == null || r.call(this, "info", `PFrame ${this.id} created`);
135
- } catch (o) {
134
+ this.frame = u.pFrameCreate(t, e), (r = this.logger) == null || r.call(this, "info", `PFrame ${this.id} created`);
135
+ } catch (s) {
136
136
  throw new Error(
137
- `PFrame ${this.id} creation failed, logger: ${t == null ? void 0 : t.toString()}, error:
138
- ${o.toString()}`
137
+ `PFrame ${this.id} creation failed, logger: ${e == null ? void 0 : e.toString()}, error:
138
+ ${s.toString()}`
139
139
  );
140
140
  }
141
141
  }
142
142
  static async pprofDump() {
143
143
  return u.pprofDump();
144
144
  }
145
- addColumnSpec(e, t) {
146
- const r = h();
147
- a(
145
+ addColumnSpec(t, e) {
146
+ const r = l();
147
+ o(
148
148
  [`${this.id}`, `${r}.json`],
149
149
  {
150
150
  timeStamp: Date.now(),
151
151
  requestType: "addColumnSpec",
152
152
  requestData: {
153
- columnId: l(e),
154
- columnSpec: t
153
+ columnId: d(t),
154
+ columnSpec: e
155
155
  }
156
156
  },
157
157
  this.logger
158
- ), a(
159
- [`${this.id}`, "data", `${l(e)}.spec`],
158
+ ), o(
159
+ [`${this.id}`, "data", `${d(t)}.spec`],
160
160
  {
161
- ...t
161
+ ...e
162
162
  },
163
163
  this.logger
164
164
  );
165
165
  try {
166
- return u.pFrameAddColumnSpec(this.frame, e, t);
167
- } catch (o) {
166
+ return u.pFrameAddColumnSpec(this.frame, t, e);
167
+ } catch (s) {
168
168
  throw new Error(
169
- `PFrame ${this.id} addColumnSpec request ${r} failed, columnId: ${JSON.stringify(e)}, columnSpec: ${JSON.stringify(t)}, error:
170
- ${o.toString()}`
169
+ `PFrame ${this.id} addColumnSpec request ${r} failed, columnId: ${JSON.stringify(t)}, columnSpec: ${JSON.stringify(e)}, error:
170
+ ${s.toString()}`
171
171
  );
172
172
  }
173
173
  }
174
- setDataSource(e) {
175
- const t = h();
176
- a(
177
- [`${this.id}`, `${t}.json`],
174
+ setDataSource(t) {
175
+ const e = l();
176
+ o(
177
+ [`${this.id}`, `${e}.json`],
178
178
  {
179
179
  timeStamp: Date.now(),
180
180
  requestType: "setDataSource"
181
181
  },
182
182
  this.logger
183
183
  );
184
- let r = {
185
- preloadBlob: async (o) => {
184
+ const r = {
185
+ preloadBlob: async (s) => {
186
186
  var n;
187
- const s = h();
188
- a(
189
- [`${this.id}`, `${s}.json`],
187
+ const a = l();
188
+ o(
189
+ [`${this.id}`, `${a}.json`],
190
190
  {
191
191
  timeStamp: Date.now(),
192
192
  requestType: "preloadBlob",
193
193
  requestData: {
194
- blobIds: o
194
+ blobIds: s
195
195
  }
196
196
  },
197
197
  this.logger
198
198
  );
199
199
  const m = performance.now();
200
200
  try {
201
- return e.preloadBlob(o);
201
+ return await t.preloadBlob(s);
202
202
  } finally {
203
- const c = performance.now();
203
+ const h = performance.now();
204
204
  (n = this.logger) == null || n.call(
205
205
  this,
206
206
  "info",
207
- `PFrame ${this.id} preloaded ${o.length} blobs ${JSON.stringify(o)}, took ${f(Math.round(c - m))}`
207
+ `PFrame ${this.id} preloaded ${s.length} blobs ${JSON.stringify(s)}, took ${f(Math.round(h - m))}`
208
208
  );
209
209
  }
210
210
  },
211
- resolveBlobContent: async (o) => {
211
+ resolveBlobContent: async (s) => {
212
212
  var n;
213
- const s = h();
214
- a(
215
- [`${this.id}`, `${s}.json`],
213
+ const a = l();
214
+ o(
215
+ [`${this.id}`, `${a}.json`],
216
216
  {
217
217
  timeStamp: Date.now(),
218
218
  requestType: "resolveBlobContent",
219
219
  requestData: {
220
- blobId: o
220
+ blobId: s
221
221
  }
222
222
  },
223
223
  this.logger
224
224
  );
225
- const m = await e.resolveBlobContent(o);
226
- return (n = this.logger) == null || n.call(this, "info", `PFrame ${this.id} resolved blob ${o}`), a([`${this.id}`, "data", `${o}`], m, this.logger), m;
225
+ const m = await t.resolveBlobContent(s);
226
+ return (n = this.logger) == null || n.call(this, "info", `PFrame ${this.id} resolved blob ${s}`), o([`${this.id}`, "data", `${s}`], m, this.logger), m;
227
227
  }
228
228
  };
229
229
  try {
230
230
  return u.pFrameSetDataSource(this.frame, r);
231
- } catch (o) {
231
+ } catch (s) {
232
232
  throw new Error(
233
- `PFrame ${this.id} setDataSource request ${t} failed, dataSource: ${e.toString()}, error:
234
- ${o.toString()}`
233
+ `PFrame ${this.id} setDataSource request ${e} failed, dataSource: ${t.toString()}, error:
234
+ ${s.toString()}`
235
235
  );
236
236
  }
237
237
  }
238
- setColumnData(e, t) {
239
- const r = h();
240
- a(
238
+ setColumnData(t, e) {
239
+ const r = l();
240
+ o(
241
241
  [`${this.id}`, `${r}.json`],
242
242
  {
243
243
  timeStamp: Date.now(),
244
244
  requestType: "setColumnData",
245
245
  requestData: {
246
- columnId: l(e),
247
- dataInfo: t
246
+ columnId: d(t),
247
+ dataInfo: e
248
248
  }
249
249
  },
250
250
  this.logger
251
- ), a(
252
- [`${this.id}`, "data", `${l(e)}.datainfo`],
251
+ ), o(
252
+ [`${this.id}`, "data", `${d(t)}.datainfo`],
253
253
  {
254
- ...t
254
+ ...e
255
255
  },
256
256
  this.logger
257
257
  );
258
258
  try {
259
- return u.pFrameSetColumnData(this.frame, e, t);
260
- } catch (o) {
259
+ return u.pFrameSetColumnData(this.frame, t, e);
260
+ } catch (s) {
261
261
  throw new Error(
262
- `PFrame ${this.id} setColumnData request ${r} failed, columnId: ${JSON.stringify(e)}, dataInfo: ${JSON.stringify(t)}, error:
263
- ${o.toString()}`
262
+ `PFrame ${this.id} setColumnData request ${r} failed, columnId: ${JSON.stringify(t)}, dataInfo: ${JSON.stringify(e)}, error:
263
+ ${s.toString()}`
264
264
  );
265
265
  }
266
266
  }
267
267
  dispose() {
268
- var t;
269
- const e = h();
270
- a(
271
- [`${this.id}`, `${e}.json`],
268
+ var e;
269
+ const t = l();
270
+ o(
271
+ [`${this.id}`, `${t}.json`],
272
272
  {
273
273
  timeStamp: Date.now(),
274
274
  requestType: "dispose"
@@ -276,10 +276,10 @@ ${o.toString()}`
276
276
  this.logger
277
277
  );
278
278
  try {
279
- u.pFrameDispose(this.frame), (t = this.logger) == null || t.call(this, "info", `PFrame ${this.id} disposed`);
279
+ u.pFrameDispose(this.frame), (e = this.logger) == null || e.call(this, "info", `PFrame ${this.id} disposed`);
280
280
  } catch (r) {
281
281
  throw new Error(
282
- `PFrame ${this.id} dispose request ${e} failed, error:
282
+ `PFrame ${this.id} dispose request ${t} failed, error:
283
283
  ${r.toString()}`
284
284
  );
285
285
  }
@@ -287,406 +287,395 @@ ${r.toString()}`
287
287
  [Symbol.dispose]() {
288
288
  this.dispose();
289
289
  }
290
- async findColumns(e) {
291
- var o;
292
- const t = h();
293
- a(
294
- [`${this.id}`, `${t}.json`],
290
+ async findColumns(t) {
291
+ var s;
292
+ const e = l();
293
+ o(
294
+ [`${this.id}`, `${e}.json`],
295
295
  {
296
296
  timeStamp: Date.now(),
297
297
  requestType: "findColumns",
298
- requestData: e
298
+ requestData: t
299
299
  },
300
300
  this.logger
301
301
  );
302
302
  const r = performance.now();
303
303
  try {
304
- return await u.pFrameFindColumns(this.frame, e);
305
- } catch (s) {
304
+ return await u.pFrameFindColumns(this.frame, t);
305
+ } catch (a) {
306
306
  throw new Error(
307
- `PFrame ${this.id} findColumns request ${t} failed, request: ${JSON.stringify(e)}, error:
308
- ${s.toString()}`
307
+ `PFrame ${this.id} findColumns request ${e} failed, request: ${JSON.stringify(t)}, error:
308
+ ${a.toString()}`
309
309
  );
310
310
  } finally {
311
- const s = performance.now();
312
- (o = this.logger) == null || o.call(
311
+ const a = performance.now();
312
+ (s = this.logger) == null || s.call(
313
313
  this,
314
314
  "info",
315
- `PFrame ${this.id} findColumns request ${t} took ${f(Math.round(s - r))}`
315
+ `PFrame ${this.id} findColumns request ${e} took ${f(Math.round(a - r))}`
316
316
  );
317
317
  }
318
318
  }
319
- async deleteColumn(e) {
320
- var o;
321
- const t = h();
322
- a(
323
- [`${this.id}`, `${t}.json`],
319
+ async deleteColumn(t) {
320
+ var s;
321
+ const e = l();
322
+ o(
323
+ [`${this.id}`, `${e}.json`],
324
324
  {
325
325
  timeStamp: Date.now(),
326
326
  requestType: "deleteColumn",
327
- requestData: e
327
+ requestData: t
328
328
  },
329
329
  this.logger
330
330
  );
331
331
  const r = performance.now();
332
332
  try {
333
- return await u.pFrameDeleteColumn(this.frame, e);
334
- } catch (s) {
333
+ return await u.pFrameDeleteColumn(this.frame, t);
334
+ } catch (a) {
335
335
  throw new Error(
336
- `PFrame ${this.id} deleteColumn request ${t} failed, request: ${JSON.stringify(e)}, error:
337
- ${s.toString()}`
336
+ `PFrame ${this.id} deleteColumn request ${e} failed, request: ${JSON.stringify(t)}, error:
337
+ ${a.toString()}`
338
338
  );
339
339
  } finally {
340
- const s = performance.now();
341
- (o = this.logger) == null || o.call(
340
+ const a = performance.now();
341
+ (s = this.logger) == null || s.call(
342
342
  this,
343
343
  "info",
344
- `PFrame ${this.id} deleteColumn request ${t} took ${f(Math.round(s - r))}`
344
+ `PFrame ${this.id} deleteColumn request ${e} took ${f(Math.round(a - r))}`
345
345
  );
346
346
  }
347
347
  }
348
- async getColumnSpec(e) {
349
- var o;
350
- const t = h();
351
- a(
352
- [`${this.id}`, `${t}.json`],
348
+ async getColumnSpec(t) {
349
+ var s;
350
+ const e = l();
351
+ o(
352
+ [`${this.id}`, `${e}.json`],
353
353
  {
354
354
  timeStamp: Date.now(),
355
355
  requestType: "getColumnSpec",
356
356
  requestData: {
357
- columnId: l(e)
357
+ columnId: d(t)
358
358
  }
359
359
  },
360
360
  this.logger
361
361
  );
362
362
  const r = performance.now();
363
363
  try {
364
- return await u.pFrameGetColumnSpec(this.frame, e);
365
- } catch (s) {
364
+ return await u.pFrameGetColumnSpec(this.frame, t);
365
+ } catch (a) {
366
366
  throw new Error(
367
- `PFrame ${this.id} getColumnSpec request ${t} failed, columnId: ${JSON.stringify(e)}, error:
368
- ${s.toString()}`
367
+ `PFrame ${this.id} getColumnSpec request ${e} failed, columnId: ${JSON.stringify(t)}, error:
368
+ ${a.toString()}`
369
369
  );
370
370
  } finally {
371
- const s = performance.now();
372
- (o = this.logger) == null || o.call(
371
+ const a = performance.now();
372
+ (s = this.logger) == null || s.call(
373
373
  this,
374
374
  "info",
375
- `PFrame ${this.id} getColumnSpec request ${t} took ${f(Math.round(s - r))}`
375
+ `PFrame ${this.id} getColumnSpec request ${e} took ${f(Math.round(a - r))}`
376
376
  );
377
377
  }
378
378
  }
379
379
  async listColumns() {
380
380
  var r;
381
- const e = h();
382
- a(
383
- [`${this.id}`, `${e}.json`],
381
+ const t = l();
382
+ o(
383
+ [`${this.id}`, `${t}.json`],
384
384
  {
385
385
  timeStamp: Date.now(),
386
386
  requestType: "listColumns"
387
387
  },
388
388
  this.logger
389
389
  );
390
- const t = performance.now();
390
+ const e = performance.now();
391
391
  try {
392
392
  return await u.pFrameListColumns(this.frame);
393
- } catch (o) {
393
+ } catch (s) {
394
394
  throw new Error(
395
- `PFrame ${this.id} listColumns request ${e} failed, error:
396
- ${o.toString()}`
395
+ `PFrame ${this.id} listColumns request ${t} failed, error:
396
+ ${s.toString()}`
397
397
  );
398
398
  } finally {
399
- const o = performance.now();
399
+ const s = performance.now();
400
400
  (r = this.logger) == null || r.call(
401
401
  this,
402
402
  "info",
403
- `PFrame ${this.id} listColumns request ${e} took ${f(Math.round(o - t))}`
403
+ `PFrame ${this.id} listColumns request ${t} took ${f(Math.round(s - e))}`
404
404
  );
405
405
  }
406
406
  }
407
- async createTable(e, t) {
408
- var m, n;
409
- const r = h(), o = {
407
+ createTable(t) {
408
+ var a, m;
409
+ const e = l(), r = {
410
410
  timeStamp: Date.now(),
411
411
  requestType: "createTable",
412
- requestData: V(e)
412
+ requestData: _(t)
413
413
  };
414
- a([`${this.id}`, `${r}.json`], o, this.logger), a(
415
- [`${this.id}`, `${r}`, `${r}.json`],
416
- o,
414
+ o([`${this.id}`, `${e}.json`], r, this.logger), o(
415
+ [`${this.id}`, `${e}`, `${e}.json`],
416
+ r,
417
417
  this.logger
418
- ), (m = this.logger) == null || m.call(
418
+ ), (a = this.logger) == null || a.call(
419
419
  this,
420
420
  "info",
421
- `PFrame ${this.id} createTable request ${r} started`
421
+ `PFrame ${this.id} createTable request ${e} started`
422
422
  );
423
423
  const s = performance.now();
424
424
  try {
425
- t == null || t.throwIfAborted();
426
- const c = await u.pFrameCreateTable(
425
+ const n = u.pFrameCreateTable(
427
426
  this.frame,
428
- r,
429
427
  e,
430
428
  t
431
429
  );
432
- return new w(this, r, c);
433
- } catch (c) {
430
+ return new w(this, e, n);
431
+ } catch (n) {
434
432
  throw new Error(
435
- `PFrame ${this.id} createTable request ${r} failed, request: ${JSON.stringify(e)}, error:
436
- ${c.toString()}`
433
+ `PFrame ${this.id} createTable request ${e} failed, request: ${JSON.stringify(t)}, error:
434
+ ${n.toString()}`
437
435
  );
438
436
  } finally {
439
- const c = performance.now();
440
- (n = this.logger) == null || n.call(
437
+ const n = performance.now();
438
+ (m = this.logger) == null || m.call(
441
439
  this,
442
440
  "info",
443
- `PFrame ${this.id} createTable request ${r} finished, took ${f(Math.round(c - s))}`
441
+ `PFrame ${this.id} createTable request ${e} finished, took ${f(Math.round(n - s))}`
444
442
  );
445
443
  }
446
444
  }
447
- async getUniqueValues(e, t) {
448
- var s, m;
449
- const r = h();
450
- a(
445
+ async getUniqueValues(t, e) {
446
+ var a, m, n;
447
+ const r = l();
448
+ o(
451
449
  [`${this.id}`, `${r}.json`],
452
450
  {
453
451
  timeStamp: Date.now(),
454
452
  requestType: "getUniqueValues",
455
- requestData: x(e)
453
+ requestData: B(t)
456
454
  },
457
455
  this.logger
458
- ), (s = this.logger) == null || s.call(
456
+ ), (a = this.logger) == null || a.call(
459
457
  this,
460
458
  "info",
461
459
  `PFrame ${this.id} getUniqueValues request ${r} started`
462
460
  );
463
- const o = performance.now();
461
+ const s = performance.now();
464
462
  try {
465
- return t == null || t.throwIfAborted(), await u.pFrameGetUniqueValues(
463
+ return (m = e == null ? void 0 : e.signal) == null || m.throwIfAborted(), await u.pFrameGetUniqueValues(
466
464
  this.frame,
467
465
  r,
468
- e,
469
- t
466
+ t,
467
+ e == null ? void 0 : e.signal
470
468
  );
471
- } catch (n) {
469
+ } catch (h) {
472
470
  throw new Error(
473
- `PFrame ${this.id} getUniqueValues request ${r} failed, request: ${JSON.stringify(e)}, error:
474
- ${n.toString()}`
471
+ `PFrame ${this.id} getUniqueValues request ${r} failed, request: ${JSON.stringify(t)}, error:
472
+ ${h.toString()}`
475
473
  );
476
474
  } finally {
477
- const n = performance.now();
478
- (m = this.logger) == null || m.call(
475
+ const h = performance.now();
476
+ (n = this.logger) == null || n.call(
479
477
  this,
480
478
  "info",
481
- `PFrame ${this.id} getUniqueValues request ${r} finished, took ${f(Math.round(n - o))}`
479
+ `PFrame ${this.id} getUniqueValues request ${r} finished, took ${f(Math.round(h - s))}`
482
480
  );
483
481
  }
484
482
  }
485
483
  };
486
484
  class w {
487
- constructor(e, t, r) {
488
- var o, s;
489
- this.frame = e, this.id = t, this.table = r, (s = (o = this.frame).logger) == null || s.call(o, "info", `PTable ${this.id} created`);
485
+ constructor(t, e, r) {
486
+ var s, a;
487
+ this.frame = t, this.id = e, this.table = r, (a = (s = this.frame).logger) == null || a.call(s, "info", `PTable ${this.id} created`);
490
488
  }
491
- getShape() {
492
- const e = h();
493
- a(
494
- [`${this.frame.id}`, `${this.id}`, `${e}.json`],
489
+ getSpec() {
490
+ const t = l();
491
+ o(
492
+ [`${this.frame.id}`, `${this.id}`, `${t}.json`],
495
493
  {
496
494
  timeStamp: Date.now(),
497
- requestType: "getShape"
495
+ requestType: "getSpec"
498
496
  },
499
497
  this.frame.logger
500
498
  );
501
499
  try {
502
- return u.pTableGetShape(this.table);
503
- } catch (t) {
500
+ return u.pTableGetSpec(this.table);
501
+ } catch (e) {
504
502
  throw new Error(
505
- `PTable ${this.id} getShape request ${e} failed, error:
506
- ${t.toString()}`
503
+ `PTable ${this.id} getSpec request ${t} failed, error:
504
+ ${e.toString()}`
507
505
  );
508
506
  }
509
507
  }
510
- getSpec() {
511
- const e = h();
512
- a(
508
+ getColumnIndices(t) {
509
+ const e = l();
510
+ o(
513
511
  [`${this.frame.id}`, `${this.id}`, `${e}.json`],
514
512
  {
515
513
  timeStamp: Date.now(),
516
- requestType: "getSpec"
514
+ requestType: "getColumnIndices",
515
+ requestData: {
516
+ columnIds: t.map(q)
517
+ }
517
518
  },
518
519
  this.frame.logger
519
520
  );
520
521
  try {
521
- return u.pTableGetSpec(this.table);
522
- } catch (t) {
522
+ return u.pTableGetColumnIndices(this.table, t);
523
+ } catch (r) {
523
524
  throw new Error(
524
- `PTable ${this.id} getSpec request ${e} failed, error:
525
- ${t.toString()}`
525
+ `PTable ${this.id} getColumnIndices request ${e} failed, columnIds: ${JSON.stringify(t)}, error:
526
+ ${r.toString()}`
526
527
  );
527
528
  }
528
529
  }
529
- getColumnIndices(e) {
530
- const t = h();
531
- a(
532
- [`${this.frame.id}`, `${this.id}`, `${t}.json`],
530
+ async getShape(t) {
531
+ const e = l();
532
+ o(
533
+ [`${this.frame.id}`, `${this.id}`, `${e}.json`],
533
534
  {
534
535
  timeStamp: Date.now(),
535
- requestType: "getColumnIndices",
536
- requestData: {
537
- columnIds: e.map(y)
538
- }
536
+ requestType: "getShape"
539
537
  },
540
538
  this.frame.logger
541
539
  );
542
540
  try {
543
- return u.pTableGetColumnIndices(this.table, e);
541
+ return await u.pTableGetShape(this.table, t == null ? void 0 : t.signal);
544
542
  } catch (r) {
545
543
  throw new Error(
546
- `PTable ${this.id} getColumnIndices request ${t} failed, columnIds: ${JSON.stringify(e)}, error:
544
+ `PTable ${this.id} getShape request ${e} failed, error:
547
545
  ${r.toString()}`
548
546
  );
549
547
  }
550
548
  }
551
- async getData(e, t, r) {
552
- var m, n, c, $;
553
- const o = h();
554
- a(
555
- [`${this.frame.id}`, `${this.id}`, `${o}.json`],
549
+ async getData(t, e) {
550
+ var m, n, h, c, D;
551
+ const r = l();
552
+ o(
553
+ [`${this.frame.id}`, `${this.id}`, `${r}.json`],
556
554
  {
557
555
  timeStamp: Date.now(),
558
556
  requestType: "getData",
559
557
  requestData: {
560
- columnIndices: e,
561
- range: t ?? null
558
+ columnIndices: t,
559
+ range: (e == null ? void 0 : e.range) ?? null
562
560
  }
563
561
  },
564
562
  this.frame.logger
565
563
  ), (n = (m = this.frame).logger) == null || n.call(
566
564
  m,
567
565
  "info",
568
- `PTable ${this.id} getData request ${o} started`
566
+ `PTable ${this.id} getData request ${r} started`
569
567
  );
570
- const s = performance.now();
568
+ let s = 0;
569
+ const a = performance.now();
571
570
  try {
572
- return r == null || r.throwIfAborted(), await u.pTableGetData(
571
+ (h = e == null ? void 0 : e.signal) == null || h.throwIfAborted();
572
+ const $ = await u.pTableGetData(
573
573
  this.table,
574
- o,
575
- e,
574
+ r,
576
575
  t,
577
- r
576
+ e == null ? void 0 : e.range,
577
+ e == null ? void 0 : e.signal
578
578
  );
579
- } catch (d) {
579
+ return s = $[0].data.length, $;
580
+ } catch ($) {
580
581
  throw new Error(
581
- `PTable ${this.id} getData request ${o} failed, columnIndices: ${JSON.stringify(e)}, range: ${t ? JSON.stringify(t) : void 0}, error:
582
- ${d.toString()}`
582
+ `PTable ${this.id} getData request ${r} failed, columnIndices: ${JSON.stringify(t)}, range: ${e != null && e.range ? JSON.stringify(e.range) : void 0}, error:
583
+ ${$.toString()}`
583
584
  );
584
585
  } finally {
585
- const d = performance.now();
586
- ($ = (c = this.frame).logger) == null || $.call(
586
+ const $ = performance.now();
587
+ (D = (c = this.frame).logger) == null || D.call(
587
588
  c,
588
589
  "info",
589
- `PTable ${this.id} getData request ${o} finished, took ${f(Math.round(d - s))}`
590
+ `PTable ${this.id} getData request ${r} finished, took ${f(Math.round($ - a))} (${s} rows)`
590
591
  );
591
592
  }
592
593
  }
593
- async filter(e, t) {
594
- var m, n, c, $;
595
- const r = h(), o = {
594
+ filter(t) {
595
+ var a, m, n, h;
596
+ const e = l(), r = {
596
597
  timeStamp: Date.now(),
597
598
  table: this.id,
598
599
  requestType: "filter",
599
600
  requestData: {
600
- filters: e.map(q)
601
+ filters: t.map(y)
601
602
  }
602
603
  };
603
- a(
604
- [`${this.frame.id}`, `${r}.json`],
605
- o,
604
+ o(
605
+ [`${this.frame.id}`, `${e}.json`],
606
+ r,
606
607
  this.frame.logger
607
- ), a(
608
- [`${this.frame.id}`, `${r}`, `${r}.json`],
609
- o,
608
+ ), o(
609
+ [`${this.frame.id}`, `${e}`, `${e}.json`],
610
+ r,
610
611
  this.frame.logger
611
- ), (n = (m = this.frame).logger) == null || n.call(
612
- m,
612
+ ), (m = (a = this.frame).logger) == null || m.call(
613
+ a,
613
614
  "info",
614
- `PTable ${this.id} filter request ${r} started`
615
+ `PTable ${this.id} filter request ${e} started`
615
616
  );
616
617
  const s = performance.now();
617
618
  try {
618
- t == null || t.throwIfAborted();
619
- const d = await u.pTableFilter(
620
- this.table,
621
- r,
622
- e,
623
- t
624
- );
625
- return new w(this.frame, r, d);
626
- } catch (d) {
619
+ const c = u.pTableFilter(this.table, e, t);
620
+ return new w(this.frame, e, c);
621
+ } catch (c) {
627
622
  throw new Error(
628
- `PTable ${this.id} filter request ${r} failed, request: ${JSON.stringify(e)}, error:
629
- ${d.toString()}`
623
+ `PTable ${this.id} filter request ${e} failed, request: ${JSON.stringify(t)}, error:
624
+ ${c.toString()}`
630
625
  );
631
626
  } finally {
632
- const d = performance.now();
633
- ($ = (c = this.frame).logger) == null || $.call(
634
- c,
627
+ const c = performance.now();
628
+ (h = (n = this.frame).logger) == null || h.call(
629
+ n,
635
630
  "info",
636
- `PTable ${this.id} filter request ${r} finished, took ${f(Math.round(d - s))}`
631
+ `PTable ${this.id} filter request ${e} finished, took ${f(Math.round(c - s))}`
637
632
  );
638
633
  }
639
634
  }
640
- async sort(e, t) {
641
- var m, n, c, $;
642
- const r = h(), o = {
635
+ sort(t) {
636
+ var a, m, n, h;
637
+ const e = l(), r = {
643
638
  timeStamp: Date.now(),
644
639
  table: this.id,
645
640
  requestType: "sort",
646
- requestData: e.map(B)
641
+ requestData: t.map(V)
647
642
  };
648
- a(
649
- [`${this.frame.id}`, `${r}.json`],
650
- o,
643
+ o(
644
+ [`${this.frame.id}`, `${e}.json`],
645
+ r,
651
646
  this.frame.logger
652
- ), a(
653
- [`${this.frame.id}`, `${r}`, `${r}.json`],
654
- o,
647
+ ), o(
648
+ [`${this.frame.id}`, `${e}`, `${e}.json`],
649
+ r,
655
650
  this.frame.logger
656
- ), (n = (m = this.frame).logger) == null || n.call(
657
- m,
651
+ ), (m = (a = this.frame).logger) == null || m.call(
652
+ a,
658
653
  "info",
659
- `PTable ${this.id} sort request ${r} started`
654
+ `PTable ${this.id} sort request ${e} started`
660
655
  );
661
656
  const s = performance.now();
662
657
  try {
663
- t == null || t.throwIfAborted();
664
- const d = await u.pTableSort(
665
- this.table,
666
- r,
667
- e,
668
- t
669
- );
670
- return new w(this.frame, r, d);
671
- } catch (d) {
658
+ const c = u.pTableSort(this.table, e, t);
659
+ return new w(this.frame, e, c);
660
+ } catch (c) {
672
661
  throw new Error(
673
- `PTable ${this.id} sort request ${r} failed, request: ${JSON.stringify(e)}, error:
674
- ${d.toString()}`
662
+ `PTable ${this.id} sort request ${e} failed, request: ${JSON.stringify(t)}, error:
663
+ ${c.toString()}`
675
664
  );
676
665
  } finally {
677
- const d = performance.now();
678
- ($ = (c = this.frame).logger) == null || $.call(
679
- c,
666
+ const c = performance.now();
667
+ (h = (n = this.frame).logger) == null || h.call(
668
+ n,
680
669
  "info",
681
- `PTable ${this.id} sort request ${r} finished, took ${f(Math.round(d - s))}`
670
+ `PTable ${this.id} sort request ${e} finished, took ${f(Math.round(c - s))}`
682
671
  );
683
672
  }
684
673
  }
685
674
  dispose() {
686
- var t, r;
687
- const e = h();
688
- a(
689
- [`${this.frame.id}`, `${this.id}`, `${e}.json`],
675
+ var e, r;
676
+ const t = l();
677
+ o(
678
+ [`${this.frame.id}`, `${this.id}`, `${t}.json`],
690
679
  {
691
680
  timeStamp: Date.now(),
692
681
  requestType: "dispose"
@@ -694,11 +683,11 @@ ${d.toString()}`
694
683
  this.frame.logger
695
684
  );
696
685
  try {
697
- u.pTableDispose(this.table), (r = (t = this.frame).logger) == null || r.call(t, "info", `PTable ${this.id} disposed`);
698
- } catch (o) {
686
+ u.pTableDispose(this.table), (r = (e = this.frame).logger) == null || r.call(e, "info", `PTable ${this.id} disposed`);
687
+ } catch (s) {
699
688
  throw new Error(
700
- `PTable ${this.id} dispose request ${e} failed, error:
701
- ${o.toString()}`
689
+ `PTable ${this.id} dispose request ${t} failed, error:
690
+ ${s.toString()}`
702
691
  );
703
692
  }
704
693
  }
@@ -706,8 +695,8 @@ ${o.toString()}`
706
695
  this.dispose();
707
696
  }
708
697
  }
709
- const te = _;
698
+ const re = G;
710
699
  export {
711
- te as PFrame
700
+ re as PFrame
712
701
  };
713
702
  //# sourceMappingURL=index.mjs.map