@milaboratories/pframes-rs-node 1.1.4 → 1.1.6
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/addon-def.ts +2 -2
- package/export/tests/pframes.test.ts +19 -19
- package/export/wrapper.ts +2 -2
- package/export_dist/addon-def.d.ts +40 -0
- package/export_dist/addon-def.d.ts.map +1 -0
- package/export_dist/addon.cjs +24 -0
- package/export_dist/addon.cjs.map +1 -0
- package/export_dist/addon.d.ts +4 -0
- package/export_dist/addon.d.ts.map +1 -0
- package/export_dist/addon.js +21 -0
- package/export_dist/addon.js.map +1 -0
- package/export_dist/dump.cjs +113 -0
- package/export_dist/dump.cjs.map +1 -0
- package/export_dist/dump.d.ts +12 -0
- package/export_dist/dump.d.ts.map +1 -0
- package/export_dist/dump.js +105 -0
- package/export_dist/dump.js.map +1 -0
- package/export_dist/export.cjs +15 -0
- package/export_dist/export.cjs.map +1 -0
- package/export_dist/export.d.ts +3 -0
- package/export_dist/export.d.ts.map +1 -0
- package/export_dist/export.js +13 -0
- package/export_dist/export.js.map +1 -0
- package/export_dist/index.cjs +13 -0
- package/export_dist/index.cjs.map +1 -0
- package/export_dist/index.d.ts +3 -0
- package/export_dist/index.d.ts.map +1 -0
- package/export_dist/index.js +3 -0
- package/export_dist/index.js.map +1 -0
- package/export_dist/tests/pframes.test.d.ts +2 -0
- package/export_dist/tests/pframes.test.d.ts.map +1 -0
- package/export_dist/tests/setup.d.ts +2 -0
- package/export_dist/tests/setup.d.ts.map +1 -0
- package/export_dist/wrapper.cjs +542 -0
- package/export_dist/wrapper.cjs.map +1 -0
- package/export_dist/wrapper.d.ts +51 -0
- package/export_dist/wrapper.d.ts.map +1 -0
- package/export_dist/wrapper.js +539 -0
- package/export_dist/wrapper.js.map +1 -0
- package/package.json +19 -19
package/export/addon-def.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
TableRange,
|
|
12
12
|
UniqueValuesRequest,
|
|
13
13
|
UniqueValuesResponse,
|
|
14
|
-
|
|
14
|
+
DataQuery,
|
|
15
15
|
} from "@milaboratories/pl-model-common";
|
|
16
16
|
import type { PFrameInternal } from "@milaboratories/pl-model-middle-layer";
|
|
17
17
|
|
|
@@ -68,7 +68,7 @@ interface NodeFrame {
|
|
|
68
68
|
id: PFrameInternal.PTableId,
|
|
69
69
|
request: {
|
|
70
70
|
tableSpec: PTableColumnSpec[];
|
|
71
|
-
dataQuery:
|
|
71
|
+
dataQuery: DataQuery;
|
|
72
72
|
},
|
|
73
73
|
) => NodeTableSymbol;
|
|
74
74
|
pFrameGetUniqueValues: (
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
PTableColumnSpec,
|
|
16
16
|
PTableSorting,
|
|
17
17
|
PTableVector,
|
|
18
|
-
|
|
18
|
+
DataQuery,
|
|
19
19
|
UniqueValuesResponse,
|
|
20
20
|
} from "@milaboratories/pl-model-common";
|
|
21
21
|
import { PFrameFactory } from "..";
|
|
@@ -371,7 +371,7 @@ describe("PFrame Table Creation", () => {
|
|
|
371
371
|
await expect(table.getShape()).rejects.toThrow();
|
|
372
372
|
});
|
|
373
373
|
|
|
374
|
-
//
|
|
374
|
+
// DataQuery requests for createTableV2 tests
|
|
375
375
|
const createTableV2Requests = {
|
|
376
376
|
request1: {
|
|
377
377
|
tableSpec: [
|
|
@@ -391,7 +391,7 @@ describe("PFrame Table Creation", () => {
|
|
|
391
391
|
},
|
|
392
392
|
},
|
|
393
393
|
] as PTableColumnSpec[],
|
|
394
|
-
dataQuery: { type: "column",
|
|
394
|
+
dataQuery: { type: "column", column: "column" } as DataQuery,
|
|
395
395
|
},
|
|
396
396
|
request2: {
|
|
397
397
|
tableSpec: [
|
|
@@ -411,7 +411,7 @@ describe("PFrame Table Creation", () => {
|
|
|
411
411
|
},
|
|
412
412
|
},
|
|
413
413
|
] as PTableColumnSpec[],
|
|
414
|
-
dataQuery: { type: "column",
|
|
414
|
+
dataQuery: { type: "column", column: "column" } as DataQuery,
|
|
415
415
|
},
|
|
416
416
|
request3: {
|
|
417
417
|
tableSpec: [
|
|
@@ -431,7 +431,7 @@ describe("PFrame Table Creation", () => {
|
|
|
431
431
|
},
|
|
432
432
|
},
|
|
433
433
|
] as PTableColumnSpec[],
|
|
434
|
-
dataQuery: { type: "column",
|
|
434
|
+
dataQuery: { type: "column", column: "column" } as DataQuery,
|
|
435
435
|
},
|
|
436
436
|
request4: {
|
|
437
437
|
tableSpec: [
|
|
@@ -451,17 +451,17 @@ describe("PFrame Table Creation", () => {
|
|
|
451
451
|
},
|
|
452
452
|
},
|
|
453
453
|
] as PTableColumnSpec[],
|
|
454
|
-
dataQuery: { type: "column",
|
|
454
|
+
dataQuery: { type: "column", column: "column" } as DataQuery,
|
|
455
455
|
},
|
|
456
456
|
};
|
|
457
457
|
|
|
458
458
|
test.concurrent("create_table_by_data_query_1", async ({ expect }) => {
|
|
459
459
|
const testCase = "create_table_request_1";
|
|
460
460
|
const expectedResponse = createTableExpectedResponses.request1;
|
|
461
|
-
const
|
|
461
|
+
const DataqueryRequest = createTableV2Requests.request1;
|
|
462
462
|
|
|
463
463
|
using pframe = await readPFrame(testCase);
|
|
464
|
-
using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId,
|
|
464
|
+
using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId, DataqueryRequest);
|
|
465
465
|
|
|
466
466
|
const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
|
|
467
467
|
const actualResponse = await table.getData(columnIndices);
|
|
@@ -471,10 +471,10 @@ describe("PFrame Table Creation", () => {
|
|
|
471
471
|
test.concurrent("create_table_by_data_query_2", async ({ expect }) => {
|
|
472
472
|
const testCase = "create_table_request_2";
|
|
473
473
|
const expectedResponse = createTableExpectedResponses.request2;
|
|
474
|
-
const
|
|
474
|
+
const DataqueryRequest = createTableV2Requests.request2;
|
|
475
475
|
|
|
476
476
|
using pframe = await readPFrame(testCase);
|
|
477
|
-
using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId,
|
|
477
|
+
using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId, DataqueryRequest);
|
|
478
478
|
|
|
479
479
|
const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
|
|
480
480
|
const actualResponse = await table.getData(columnIndices);
|
|
@@ -484,10 +484,10 @@ describe("PFrame Table Creation", () => {
|
|
|
484
484
|
test.concurrent("create_table_by_data_query_3", async ({ expect }) => {
|
|
485
485
|
const testCase = "create_table_request_3";
|
|
486
486
|
const expectedResponse = createTableExpectedResponses.request3;
|
|
487
|
-
const
|
|
487
|
+
const DataqueryRequest = createTableV2Requests.request3;
|
|
488
488
|
|
|
489
489
|
using pframe = await readPFrame(testCase);
|
|
490
|
-
using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId,
|
|
490
|
+
using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId, DataqueryRequest);
|
|
491
491
|
|
|
492
492
|
const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
|
|
493
493
|
const actualResponse = await table.getData(columnIndices);
|
|
@@ -497,10 +497,10 @@ describe("PFrame Table Creation", () => {
|
|
|
497
497
|
test.concurrent("create_table_by_data_query_4", async ({ expect }) => {
|
|
498
498
|
const testCase = "create_table_request_4";
|
|
499
499
|
const expectedResponse = createTableExpectedResponses.request4;
|
|
500
|
-
const
|
|
500
|
+
const DataqueryRequest = createTableV2Requests.request4;
|
|
501
501
|
|
|
502
502
|
using pframe = await readPFrame(testCase);
|
|
503
|
-
using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId,
|
|
503
|
+
using table = pframe.createTableV2(ulid() as PFrameInternal.PTableId, DataqueryRequest);
|
|
504
504
|
|
|
505
505
|
const columnIndices = Array.from({ length: table.getSpec().length }, (_, i) => i);
|
|
506
506
|
const actualResponse = await table.getData(columnIndices);
|
|
@@ -524,8 +524,8 @@ describe("PFrame Table Creation", () => {
|
|
|
524
524
|
pframe.addColumnSpec(columnId, columnSpec);
|
|
525
525
|
await pframe.setColumnData(columnId, dataInfo);
|
|
526
526
|
|
|
527
|
-
// Construct
|
|
528
|
-
const
|
|
527
|
+
// Construct DataQuery request for the failing column
|
|
528
|
+
const DataqueryRequest = {
|
|
529
529
|
tableSpec: [
|
|
530
530
|
{
|
|
531
531
|
type: "axis",
|
|
@@ -545,13 +545,13 @@ describe("PFrame Table Creation", () => {
|
|
|
545
545
|
] as PTableColumnSpec[],
|
|
546
546
|
dataQuery: {
|
|
547
547
|
type: "column",
|
|
548
|
-
|
|
549
|
-
} as
|
|
548
|
+
column: "column",
|
|
549
|
+
} as DataQuery,
|
|
550
550
|
};
|
|
551
551
|
|
|
552
552
|
using table = (pframe as unknown as PFrame).createTableV2(
|
|
553
553
|
ulid() as PFrameInternal.PTableId,
|
|
554
|
-
|
|
554
|
+
DataqueryRequest,
|
|
555
555
|
);
|
|
556
556
|
|
|
557
557
|
await expect(table.getShape()).rejects.toThrow();
|
package/export/wrapper.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type TableRange,
|
|
15
15
|
type UniqueValuesRequest,
|
|
16
16
|
type UniqueValuesResponse,
|
|
17
|
-
type
|
|
17
|
+
type DataQuery,
|
|
18
18
|
ensureError,
|
|
19
19
|
isAbortError,
|
|
20
20
|
} from "@milaboratories/pl-model-common";
|
|
@@ -427,7 +427,7 @@ export class PFrame implements PFrameInternal.PFrameV13 {
|
|
|
427
427
|
requestId: PFrameInternal.PTableId,
|
|
428
428
|
request: {
|
|
429
429
|
tableSpec: PTableColumnSpec[];
|
|
430
|
-
dataQuery:
|
|
430
|
+
dataQuery: DataQuery;
|
|
431
431
|
},
|
|
432
432
|
): PTable {
|
|
433
433
|
const timer = PerfTimer.start();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PColumnInfo, PColumnSpec, PObjectId, PTableColumnId, PTableColumnSpec, PTableRecordFilter, PTableShape, PTableSorting, PTableVector, TableRange, UniqueValuesRequest, UniqueValuesResponse, DataQuery } from "@milaboratories/pl-model-common";
|
|
2
|
+
import type { PFrameInternal } from "@milaboratories/pl-model-middle-layer";
|
|
3
|
+
export interface NodeFrameSymbol extends Symbol {
|
|
4
|
+
}
|
|
5
|
+
export interface NodeTableSymbol extends Symbol {
|
|
6
|
+
}
|
|
7
|
+
interface HeapProfiler {
|
|
8
|
+
pprofDump: () => Promise<Uint8Array>;
|
|
9
|
+
}
|
|
10
|
+
interface NodeFrame {
|
|
11
|
+
pFrameCreate: (spillPath: string, logger: PFrameInternal.Logger | undefined) => NodeFrameSymbol;
|
|
12
|
+
pFrameAddColumnSpec: (pFrame: NodeFrameSymbol, columnId: PObjectId, columnSpec: PColumnSpec) => void;
|
|
13
|
+
pFrameSetDataSource: (pFrame: NodeFrameSymbol, dataSource: PFrameInternal.PFrameDataSourceV2) => void;
|
|
14
|
+
pFrameSetColumnData: (pFrame: NodeFrameSymbol, columnId: PObjectId, dataInfo: PFrameInternal.DataInfo<PFrameInternal.PFrameBlobId>, signal: AbortSignal | undefined) => Promise<void>;
|
|
15
|
+
pFrameDispose: (pFrame: NodeFrameSymbol) => void;
|
|
16
|
+
pFrameFindColumns: (pFrame: NodeFrameSymbol, request: PFrameInternal.FindColumnsRequest) => Promise<PFrameInternal.FindColumnsResponse>;
|
|
17
|
+
pFrameDeleteColumn: (pFrame: NodeFrameSymbol, request: PFrameInternal.DeleteColumnFromColumnsRequest) => Promise<PFrameInternal.DeleteColumnFromColumnsResponse>;
|
|
18
|
+
pFrameGetColumnSpec: (pFrame: NodeFrameSymbol, columnId: PObjectId) => Promise<PColumnSpec | null>;
|
|
19
|
+
pFrameListColumns: (pFrame: NodeFrameSymbol) => Promise<PColumnInfo[]>;
|
|
20
|
+
pFrameCreateTable: (pFrame: NodeFrameSymbol, id: PFrameInternal.PTableId, request: PFrameInternal.CreateTableRequestV4) => NodeTableSymbol;
|
|
21
|
+
pFrameCreateTableV2: (pFrame: NodeFrameSymbol, id: PFrameInternal.PTableId, request: {
|
|
22
|
+
tableSpec: PTableColumnSpec[];
|
|
23
|
+
dataQuery: DataQuery;
|
|
24
|
+
}) => NodeTableSymbol;
|
|
25
|
+
pFrameGetUniqueValues: (pFrame: NodeFrameSymbol, id: PFrameInternal.PTableId, request: UniqueValuesRequest, signal: AbortSignal | undefined) => Promise<UniqueValuesResponse>;
|
|
26
|
+
}
|
|
27
|
+
interface NodeTable {
|
|
28
|
+
pTableGetSpec: (boxed: NodeTableSymbol) => PTableColumnSpec[];
|
|
29
|
+
pTableGetColumnIndices: (boxed: NodeTableSymbol, columnIds: PTableColumnId[]) => number[];
|
|
30
|
+
pTableGetFootprint: (boxed: NodeTableSymbol, signal: AbortSignal | undefined) => Promise<number>;
|
|
31
|
+
pTableGetShape: (boxed: NodeTableSymbol, signal: AbortSignal | undefined) => Promise<PTableShape>;
|
|
32
|
+
pTableGetData: (boxed: NodeTableSymbol, id: PFrameInternal.PTableId, columnIndices: number[], range: TableRange | undefined, signal: AbortSignal | undefined) => Promise<PTableVector[]>;
|
|
33
|
+
pTableFilter: (boxed: NodeTableSymbol, id: PFrameInternal.PTableId, request: PTableRecordFilter[]) => NodeTableSymbol;
|
|
34
|
+
pTableSort: (boxed: NodeTableSymbol, id: PFrameInternal.PTableId, request: PTableSorting[]) => NodeTableSymbol;
|
|
35
|
+
pTableDispose: (boxed: NodeTableSymbol) => void;
|
|
36
|
+
}
|
|
37
|
+
export interface AddonSymbol extends Symbol, HeapProfiler, NodeFrame, NodeTable {
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=addon-def.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addon-def.d.ts","sourceRoot":"","sources":["../export/addon-def.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,UAAU,EACV,mBAAmB,EAC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WAAW,GAAG,SAAS,KAC5B,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAC7B,YAAY,EAAE,CACZ,KAAK,EAAE,eAAe,EACtB,EAAE,EAAE,cAAc,CAAC,QAAQ,EAC3B,OAAO,EAAE,kBAAkB,EAAE,KAC1B,eAAe,CAAC;IACrB,UAAU,EAAE,CACV,KAAK,EAAE,eAAe,EACtB,EAAE,EAAE,cAAc,CAAC,QAAQ,EAC3B,OAAO,EAAE,aAAa,EAAE,KACrB,eAAe,CAAC;IACrB,aAAa,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,WAEf,SAAQ,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS;CAAG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var node_module = require('node:module');
|
|
4
|
+
var node_path = require('node:path');
|
|
5
|
+
var node_url = require('node:url');
|
|
6
|
+
var gyp = require('@mapbox/node-pre-gyp');
|
|
7
|
+
|
|
8
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
|
+
const nodeFileUrl = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('addon.cjs', document.baseURI).href));
|
|
10
|
+
const nodeDirname = node_path.dirname(node_url.fileURLToPath(nodeFileUrl));
|
|
11
|
+
const nodeRequire = node_module.createRequire(nodeFileUrl);
|
|
12
|
+
const { find: findAddon } = gyp;
|
|
13
|
+
// Pre-gyp reads binary section from package.json and constructs a path to addon
|
|
14
|
+
// https://github.com/mapbox/node-pre-gyp/blob/a541932680034f5de9e7365ef8d9a0d7a11cc1a9/lib/package.js#L35
|
|
15
|
+
// Require calls dlopen under the hood
|
|
16
|
+
// https://nodejs.org/api/process.html#processdlopenmodule-filename-flags
|
|
17
|
+
// DLOpen then searches for napi_register_module_v1 in addon export table
|
|
18
|
+
// https://github.com/search?q=repo%3Anodejs%2Fnode%20NAPI_MODULE_INITIALIZER&type=code
|
|
19
|
+
// And neon exports napi_register_module_v1 from #[neon::main]
|
|
20
|
+
// https://github.com/neon-bindings/neon/blob/b1728fa21e968ccde9611ac9955cf6d638be16e6/crates/neon/src/context/internal.rs#L76
|
|
21
|
+
const AddonSymbol = nodeRequire(findAddon(node_path.resolve(nodeDirname, "../package.json")));
|
|
22
|
+
|
|
23
|
+
exports.AddonSymbol = AddonSymbol;
|
|
24
|
+
//# sourceMappingURL=addon.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addon.cjs","sources":["../export/addon.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport gyp from \"@mapbox/node-pre-gyp\";\nimport type { AddonSymbol } from \"./addon-def\";\n\nconst nodeFileUrl = import.meta.url;\nconst nodeDirname = dirname(fileURLToPath(nodeFileUrl));\nconst nodeRequire = createRequire(nodeFileUrl);\n\nconst { find: findAddon } = gyp;\n\n// Pre-gyp reads binary section from package.json and constructs a path to addon\n// https://github.com/mapbox/node-pre-gyp/blob/a541932680034f5de9e7365ef8d9a0d7a11cc1a9/lib/package.js#L35\n// Require calls dlopen under the hood\n// https://nodejs.org/api/process.html#processdlopenmodule-filename-flags\n// DLOpen then searches for napi_register_module_v1 in addon export table\n// https://github.com/search?q=repo%3Anodejs%2Fnode%20NAPI_MODULE_INITIALIZER&type=code\n// And neon exports napi_register_module_v1 from #[neon::main]\n// https://github.com/neon-bindings/neon/blob/b1728fa21e968ccde9611ac9955cf6d638be16e6/crates/neon/src/context/internal.rs#L76\nconst AddonSymbol = nodeRequire(findAddon(resolve(nodeDirname, \"../package.json\"))) as AddonSymbol;\n\nexport { AddonSymbol };\n"],"names":["dirname","fileURLToPath","createRequire","resolve"],"mappings":";;;;;;;;AAMA,MAAM,WAAW,GAAG,2PAAe;AACnC,MAAM,WAAW,GAAGA,iBAAO,CAACC,sBAAa,CAAC,WAAW,CAAC,CAAC;AACvD,MAAM,WAAW,GAAGC,yBAAa,CAAC,WAAW,CAAC;AAE9C,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS,CAACC,iBAAO,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addon.d.ts","sourceRoot":"","sources":["../export/addon.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgB/C,QAAA,MAAM,WAAW,EAAsE,WAAW,CAAC;AAEnG,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import gyp from '@mapbox/node-pre-gyp';
|
|
5
|
+
|
|
6
|
+
const nodeFileUrl = import.meta.url;
|
|
7
|
+
const nodeDirname = dirname(fileURLToPath(nodeFileUrl));
|
|
8
|
+
const nodeRequire = createRequire(nodeFileUrl);
|
|
9
|
+
const { find: findAddon } = gyp;
|
|
10
|
+
// Pre-gyp reads binary section from package.json and constructs a path to addon
|
|
11
|
+
// https://github.com/mapbox/node-pre-gyp/blob/a541932680034f5de9e7365ef8d9a0d7a11cc1a9/lib/package.js#L35
|
|
12
|
+
// Require calls dlopen under the hood
|
|
13
|
+
// https://nodejs.org/api/process.html#processdlopenmodule-filename-flags
|
|
14
|
+
// DLOpen then searches for napi_register_module_v1 in addon export table
|
|
15
|
+
// https://github.com/search?q=repo%3Anodejs%2Fnode%20NAPI_MODULE_INITIALIZER&type=code
|
|
16
|
+
// And neon exports napi_register_module_v1 from #[neon::main]
|
|
17
|
+
// https://github.com/neon-bindings/neon/blob/b1728fa21e968ccde9611ac9955cf6d638be16e6/crates/neon/src/context/internal.rs#L76
|
|
18
|
+
const AddonSymbol = nodeRequire(findAddon(resolve(nodeDirname, "../package.json")));
|
|
19
|
+
|
|
20
|
+
export { AddonSymbol };
|
|
21
|
+
//# sourceMappingURL=addon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addon.js","sources":["../export/addon.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport gyp from \"@mapbox/node-pre-gyp\";\nimport type { AddonSymbol } from \"./addon-def\";\n\nconst nodeFileUrl = import.meta.url;\nconst nodeDirname = dirname(fileURLToPath(nodeFileUrl));\nconst nodeRequire = createRequire(nodeFileUrl);\n\nconst { find: findAddon } = gyp;\n\n// Pre-gyp reads binary section from package.json and constructs a path to addon\n// https://github.com/mapbox/node-pre-gyp/blob/a541932680034f5de9e7365ef8d9a0d7a11cc1a9/lib/package.js#L35\n// Require calls dlopen under the hood\n// https://nodejs.org/api/process.html#processdlopenmodule-filename-flags\n// DLOpen then searches for napi_register_module_v1 in addon export table\n// https://github.com/search?q=repo%3Anodejs%2Fnode%20NAPI_MODULE_INITIALIZER&type=code\n// And neon exports napi_register_module_v1 from #[neon::main]\n// https://github.com/neon-bindings/neon/blob/b1728fa21e968ccde9611ac9955cf6d638be16e6/crates/neon/src/context/internal.rs#L76\nconst AddonSymbol = nodeRequire(findAddon(resolve(nodeDirname, \"../package.json\"))) as AddonSymbol;\n\nexport { AddonSymbol };\n"],"names":[],"mappings":";;;;;AAMA,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG;AACnC,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;AACvD,MAAM,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;AAE9C,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;;;;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var node_crypto = require('node:crypto');
|
|
4
|
+
var node_fs = require('node:fs');
|
|
5
|
+
var node_path = require('node:path');
|
|
6
|
+
|
|
7
|
+
function hashColumnId(columnId) {
|
|
8
|
+
return node_crypto.createHash("sha256").update(columnId).digest("hex");
|
|
9
|
+
}
|
|
10
|
+
function hashTableColumnId(tableId) {
|
|
11
|
+
if (tableId.type === "column") {
|
|
12
|
+
return {
|
|
13
|
+
...tableId,
|
|
14
|
+
id: hashColumnId(tableId.id),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return tableId;
|
|
18
|
+
}
|
|
19
|
+
function hashFilterColumnId(filter) {
|
|
20
|
+
return {
|
|
21
|
+
...filter,
|
|
22
|
+
column: hashTableColumnId(filter.column),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function hashUniqueValuesRequestColumnId(request) {
|
|
26
|
+
return {
|
|
27
|
+
...request,
|
|
28
|
+
columnId: hashColumnId(request.columnId),
|
|
29
|
+
filters: request.filters.map(hashFilterColumnId),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function hashSortingColumnId(sorting) {
|
|
33
|
+
return {
|
|
34
|
+
...sorting,
|
|
35
|
+
column: hashTableColumnId(sorting.column),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function hashJoinEntryColumnId(entry) {
|
|
39
|
+
const type = entry.type;
|
|
40
|
+
switch (type) {
|
|
41
|
+
case "column":
|
|
42
|
+
return {
|
|
43
|
+
...entry,
|
|
44
|
+
columnId: hashColumnId(entry.columnId),
|
|
45
|
+
};
|
|
46
|
+
case "slicedColumn":
|
|
47
|
+
return {
|
|
48
|
+
...entry,
|
|
49
|
+
columnId: hashColumnId(entry.columnId),
|
|
50
|
+
newId: hashColumnId(entry.newId),
|
|
51
|
+
};
|
|
52
|
+
case "artificialColumn":
|
|
53
|
+
return {
|
|
54
|
+
...entry,
|
|
55
|
+
columnId: hashColumnId(entry.columnId),
|
|
56
|
+
newId: hashColumnId(entry.newId),
|
|
57
|
+
};
|
|
58
|
+
case "inlineColumn":
|
|
59
|
+
return {
|
|
60
|
+
...entry,
|
|
61
|
+
newId: hashColumnId(entry.newId),
|
|
62
|
+
};
|
|
63
|
+
case "inner":
|
|
64
|
+
return {
|
|
65
|
+
...entry,
|
|
66
|
+
entries: entry.entries.map(hashJoinEntryColumnId),
|
|
67
|
+
};
|
|
68
|
+
case "full":
|
|
69
|
+
return {
|
|
70
|
+
...entry,
|
|
71
|
+
entries: entry.entries.map(hashJoinEntryColumnId),
|
|
72
|
+
};
|
|
73
|
+
case "outer":
|
|
74
|
+
return {
|
|
75
|
+
...entry,
|
|
76
|
+
primary: hashJoinEntryColumnId(entry.primary),
|
|
77
|
+
secondary: entry.secondary.map(hashJoinEntryColumnId),
|
|
78
|
+
};
|
|
79
|
+
default:
|
|
80
|
+
throw new Error(`Unsupported join entry type: ${type}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function hashCreateTableRequestColumnId(request) {
|
|
84
|
+
return {
|
|
85
|
+
...request,
|
|
86
|
+
src: hashJoinEntryColumnId(request.src),
|
|
87
|
+
filters: request.filters.map(hashFilterColumnId),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async function dump(relativePath, data, logger) {
|
|
91
|
+
if (!process.env.MI_DUMP_PFRAMES_RS)
|
|
92
|
+
return;
|
|
93
|
+
try {
|
|
94
|
+
const relativeUri = relativePath.map((part) => encodeURIComponent(part));
|
|
95
|
+
const fileDir = node_path.join(process.env.MI_DUMP_PFRAMES_RS, ...relativeUri.slice(0, -1));
|
|
96
|
+
await node_fs.promises.mkdir(fileDir, { recursive: true });
|
|
97
|
+
const filePath = node_path.join(process.env.MI_DUMP_PFRAMES_RS, ...relativeUri);
|
|
98
|
+
const fileData = ArrayBuffer.isView(data) ? data : JSON.stringify(data, null, 2);
|
|
99
|
+
await node_fs.promises.writeFile(filePath, fileData, { flag: "wx" });
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
logger?.("warn", `error while dumping PFrames data: ${error}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
exports.dump = dump;
|
|
107
|
+
exports.hashColumnId = hashColumnId;
|
|
108
|
+
exports.hashCreateTableRequestColumnId = hashCreateTableRequestColumnId;
|
|
109
|
+
exports.hashFilterColumnId = hashFilterColumnId;
|
|
110
|
+
exports.hashSortingColumnId = hashSortingColumnId;
|
|
111
|
+
exports.hashTableColumnId = hashTableColumnId;
|
|
112
|
+
exports.hashUniqueValuesRequestColumnId = hashUniqueValuesRequestColumnId;
|
|
113
|
+
//# sourceMappingURL=dump.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dump.cjs","sources":["../export/dump.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { promises as fs } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type {\n PObjectId,\n PTableColumnId,\n PTableRecordFilter,\n PTableSorting,\n UniqueValuesRequest,\n} from \"@milaboratories/pl-model-common\";\n\nexport function hashColumnId(columnId: PObjectId): PObjectId {\n return createHash(\"sha256\").update(columnId).digest(\"hex\") as PObjectId;\n}\n\nexport function hashTableColumnId(tableId: PTableColumnId): PTableColumnId {\n if (tableId.type === \"column\") {\n return {\n ...tableId,\n id: hashColumnId(tableId.id),\n };\n }\n return tableId;\n}\n\nexport function hashFilterColumnId(filter: PTableRecordFilter): PTableRecordFilter {\n return {\n ...filter,\n column: hashTableColumnId(filter.column),\n };\n}\n\nexport function hashUniqueValuesRequestColumnId(request: UniqueValuesRequest): UniqueValuesRequest {\n return {\n ...request,\n columnId: hashColumnId(request.columnId),\n filters: request.filters.map(hashFilterColumnId),\n };\n}\n\nexport function hashSortingColumnId(sorting: PTableSorting): PTableSorting {\n return {\n ...sorting,\n column: hashTableColumnId(sorting.column),\n };\n}\n\nfunction hashJoinEntryColumnId(entry: PFrameInternal.JoinEntryV4): PFrameInternal.JoinEntryV4 {\n const type = entry.type;\n switch (type) {\n case \"column\":\n return {\n ...entry,\n columnId: hashColumnId(entry.columnId),\n };\n case \"slicedColumn\":\n return {\n ...entry,\n columnId: hashColumnId(entry.columnId),\n newId: hashColumnId(entry.newId),\n };\n case \"artificialColumn\":\n return {\n ...entry,\n columnId: hashColumnId(entry.columnId),\n newId: hashColumnId(entry.newId),\n };\n case \"inlineColumn\":\n return {\n ...entry,\n newId: hashColumnId(entry.newId),\n };\n case \"inner\":\n return {\n ...entry,\n entries: entry.entries.map(hashJoinEntryColumnId),\n };\n case \"full\":\n return {\n ...entry,\n entries: entry.entries.map(hashJoinEntryColumnId),\n };\n case \"outer\":\n return {\n ...entry,\n primary: hashJoinEntryColumnId(entry.primary),\n secondary: entry.secondary.map(hashJoinEntryColumnId),\n };\n default:\n throw new Error(`Unsupported join entry type: ${type}`);\n }\n}\n\nexport function hashCreateTableRequestColumnId(\n request: PFrameInternal.CreateTableRequestV4,\n): PFrameInternal.CreateTableRequestV4 {\n return {\n ...request,\n src: hashJoinEntryColumnId(request.src),\n filters: request.filters.map(hashFilterColumnId),\n };\n}\n\nexport async function dump(\n relativePath: string[],\n data: { [key: string]: string | number | boolean | object } | Uint8Array,\n logger?: PFrameInternal.Logger,\n): Promise<void> {\n if (!process.env.MI_DUMP_PFRAMES_RS) return;\n try {\n const relativeUri = relativePath.map((part) => encodeURIComponent(part));\n const fileDir = join(process.env.MI_DUMP_PFRAMES_RS, ...relativeUri.slice(0, -1));\n await fs.mkdir(fileDir, { recursive: true });\n\n const filePath = join(process.env.MI_DUMP_PFRAMES_RS, ...relativeUri);\n const fileData = ArrayBuffer.isView(data) ? data : JSON.stringify(data, null, 2);\n await fs.writeFile(filePath, fileData, { flag: \"wx\" });\n } catch (error: unknown) {\n logger?.(\"warn\", `error while dumping PFrames data: ${error}`);\n }\n}\n"],"names":["createHash","join","fs"],"mappings":";;;;;;AAYM,SAAU,YAAY,CAAC,QAAmB,EAAA;AAC9C,IAAA,OAAOA,sBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAc;AACzE;AAEM,SAAU,iBAAiB,CAAC,OAAuB,EAAA;AACvD,IAAA,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC7B,OAAO;AACL,YAAA,GAAG,OAAO;AACV,YAAA,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;SAC7B;IACH;AACA,IAAA,OAAO,OAAO;AAChB;AAEM,SAAU,kBAAkB,CAAC,MAA0B,EAAA;IAC3D,OAAO;AACL,QAAA,GAAG,MAAM;AACT,QAAA,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC;KACzC;AACH;AAEM,SAAU,+BAA+B,CAAC,OAA4B,EAAA;IAC1E,OAAO;AACL,QAAA,GAAG,OAAO;AACV,QAAA,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC;QACxC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;KACjD;AACH;AAEM,SAAU,mBAAmB,CAAC,OAAsB,EAAA;IACxD,OAAO;AACL,QAAA,GAAG,OAAO;AACV,QAAA,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC;KAC1C;AACH;AAEA,SAAS,qBAAqB,CAAC,KAAiC,EAAA;AAC9D,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI;IACvB,QAA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umnId, PTableRecordFilter, PTableSorting, UniqueValuesRequest } from "@milaboratories/pl-model-common";
|
|
3
|
+
export declare function hashColumnId(columnId: PObjectId): PObjectId;
|
|
4
|
+
export declare function hashTableColumnId(tableId: PTableColumnId): PTableColumnId;
|
|
5
|
+
export declare function hashFilterColumnId(filter: PTableRecordFilter): PTableRecordFilter;
|
|
6
|
+
export declare function hashUniqueValuesRequestColumnId(request: UniqueValuesRequest): UniqueValuesRequest;
|
|
7
|
+
export declare function hashSortingColumnId(sorting: PTableSorting): PTableSorting;
|
|
8
|
+
export declare function hashCreateTableRequestColumnId(request: PFrameInternal.CreateTableRequestV4): PFrameInternal.CreateTableRequestV4;
|
|
9
|
+
export declare function dump(relativePath: string[], data: {
|
|
10
|
+
[key: string]: string | number | boolean | object;
|
|
11
|
+
} | Uint8Array, logger?: PFrameInternal.Logger): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=dump.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dump.d.ts","sourceRoot":"","sources":["../export/dump.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAEzC,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAE3D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAQzE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAKjF;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,mBAAmB,GAAG,mBAAmB,CAMjG;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAKzE;AAgDD,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,cAAc,CAAC,oBAAoB,GAC3C,cAAc,CAAC,oBAAoB,CAMrC;AAED,wBAAsB,IAAI,CACxB,YAAY,EAAE,MAAM,EAAE,EACtB,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;CAAE,GAAG,UAAU,EACxE,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,GAC7B,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { promises } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
function hashColumnId(columnId) {
|
|
6
|
+
return createHash("sha256").update(columnId).digest("hex");
|
|
7
|
+
}
|
|
8
|
+
function hashTableColumnId(tableId) {
|
|
9
|
+
if (tableId.type === "column") {
|
|
10
|
+
return {
|
|
11
|
+
...tableId,
|
|
12
|
+
id: hashColumnId(tableId.id),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return tableId;
|
|
16
|
+
}
|
|
17
|
+
function hashFilterColumnId(filter) {
|
|
18
|
+
return {
|
|
19
|
+
...filter,
|
|
20
|
+
column: hashTableColumnId(filter.column),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function hashUniqueValuesRequestColumnId(request) {
|
|
24
|
+
return {
|
|
25
|
+
...request,
|
|
26
|
+
columnId: hashColumnId(request.columnId),
|
|
27
|
+
filters: request.filters.map(hashFilterColumnId),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function hashSortingColumnId(sorting) {
|
|
31
|
+
return {
|
|
32
|
+
...sorting,
|
|
33
|
+
column: hashTableColumnId(sorting.column),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function hashJoinEntryColumnId(entry) {
|
|
37
|
+
const type = entry.type;
|
|
38
|
+
switch (type) {
|
|
39
|
+
case "column":
|
|
40
|
+
return {
|
|
41
|
+
...entry,
|
|
42
|
+
columnId: hashColumnId(entry.columnId),
|
|
43
|
+
};
|
|
44
|
+
case "slicedColumn":
|
|
45
|
+
return {
|
|
46
|
+
...entry,
|
|
47
|
+
columnId: hashColumnId(entry.columnId),
|
|
48
|
+
newId: hashColumnId(entry.newId),
|
|
49
|
+
};
|
|
50
|
+
case "artificialColumn":
|
|
51
|
+
return {
|
|
52
|
+
...entry,
|
|
53
|
+
columnId: hashColumnId(entry.columnId),
|
|
54
|
+
newId: hashColumnId(entry.newId),
|
|
55
|
+
};
|
|
56
|
+
case "inlineColumn":
|
|
57
|
+
return {
|
|
58
|
+
...entry,
|
|
59
|
+
newId: hashColumnId(entry.newId),
|
|
60
|
+
};
|
|
61
|
+
case "inner":
|
|
62
|
+
return {
|
|
63
|
+
...entry,
|
|
64
|
+
entries: entry.entries.map(hashJoinEntryColumnId),
|
|
65
|
+
};
|
|
66
|
+
case "full":
|
|
67
|
+
return {
|
|
68
|
+
...entry,
|
|
69
|
+
entries: entry.entries.map(hashJoinEntryColumnId),
|
|
70
|
+
};
|
|
71
|
+
case "outer":
|
|
72
|
+
return {
|
|
73
|
+
...entry,
|
|
74
|
+
primary: hashJoinEntryColumnId(entry.primary),
|
|
75
|
+
secondary: entry.secondary.map(hashJoinEntryColumnId),
|
|
76
|
+
};
|
|
77
|
+
default:
|
|
78
|
+
throw new Error(`Unsupported join entry type: ${type}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function hashCreateTableRequestColumnId(request) {
|
|
82
|
+
return {
|
|
83
|
+
...request,
|
|
84
|
+
src: hashJoinEntryColumnId(request.src),
|
|
85
|
+
filters: request.filters.map(hashFilterColumnId),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
async function dump(relativePath, data, logger) {
|
|
89
|
+
if (!process.env.MI_DUMP_PFRAMES_RS)
|
|
90
|
+
return;
|
|
91
|
+
try {
|
|
92
|
+
const relativeUri = relativePath.map((part) => encodeURIComponent(part));
|
|
93
|
+
const fileDir = join(process.env.MI_DUMP_PFRAMES_RS, ...relativeUri.slice(0, -1));
|
|
94
|
+
await promises.mkdir(fileDir, { recursive: true });
|
|
95
|
+
const filePath = join(process.env.MI_DUMP_PFRAMES_RS, ...relativeUri);
|
|
96
|
+
const fileData = ArrayBuffer.isView(data) ? data : JSON.stringify(data, null, 2);
|
|
97
|
+
await promises.writeFile(filePath, fileData, { flag: "wx" });
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
logger?.("warn", `error while dumping PFrames data: ${error}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { dump, hashColumnId, hashCreateTableRequestColumnId, hashFilterColumnId, hashSortingColumnId, hashTableColumnId, hashUniqueValuesRequestColumnId };
|
|
105
|
+
//# sourceMappingURL=dump.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dump.js","sources":["../export/dump.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { promises as fs } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport type {\n PObjectId,\n PTableColumnId,\n PTableRecordFilter,\n PTableSorting,\n UniqueValuesRequest,\n} from \"@milaboratories/pl-model-common\";\n\nexport function hashColumnId(columnId: PObjectId): PObjectId {\n return createHash(\"sha256\").update(columnId).digest(\"hex\") as PObjectId;\n}\n\nexport function hashTableColumnId(tableId: PTableColumnId): PTableColumnId {\n if (tableId.type === \"column\") {\n return {\n ...tableId,\n id: hashColumnId(tableId.id),\n };\n }\n return tableId;\n}\n\nexport function hashFilterColumnId(filter: PTableRecordFilter): PTableRecordFilter {\n return {\n ...filter,\n column: hashTableColumnId(filter.column),\n };\n}\n\nexport function hashUniqueValuesRequestColumnId(request: UniqueValuesRequest): UniqueValuesRequest {\n return {\n ...request,\n columnId: hashColumnId(request.columnId),\n filters: request.filters.map(hashFilterColumnId),\n };\n}\n\nexport function hashSortingColumnId(sorting: PTableSorting): PTableSorting {\n return {\n ...sorting,\n column: hashTableColumnId(sorting.column),\n };\n}\n\nfunction hashJoinEntryColumnId(entry: PFrameInternal.JoinEntryV4): PFrameInternal.JoinEntryV4 {\n const type = entry.type;\n switch (type) {\n case \"column\":\n return {\n ...entry,\n columnId: hashColumnId(entry.columnId),\n };\n case \"slicedColumn\":\n return {\n ...entry,\n columnId: hashColumnId(entry.columnId),\n newId: hashColumnId(entry.newId),\n };\n case \"artificialColumn\":\n return {\n ...entry,\n columnId: hashColumnId(entry.columnId),\n newId: hashColumnId(entry.newId),\n };\n case \"inlineColumn\":\n return {\n ...entry,\n newId: hashColumnId(entry.newId),\n };\n case \"inner\":\n return {\n ...entry,\n entries: entry.entries.map(hashJoinEntryColumnId),\n };\n case \"full\":\n return {\n ...entry,\n entries: entry.entries.map(hashJoinEntryColumnId),\n };\n case \"outer\":\n return {\n ...entry,\n primary: hashJoinEntryColumnId(entry.primary),\n secondary: entry.secondary.map(hashJoinEntryColumnId),\n };\n default:\n throw new Error(`Unsupported join entry type: ${type}`);\n }\n}\n\nexport function hashCreateTableRequestColumnId(\n request: PFrameInternal.CreateTableRequestV4,\n): PFrameInternal.CreateTableRequestV4 {\n return {\n ...request,\n src: hashJoinEntryColumnId(request.src),\n filters: request.filters.map(hashFilterColumnId),\n };\n}\n\nexport async function dump(\n relativePath: string[],\n data: { [key: string]: string | number | boolean | object } | Uint8Array,\n logger?: PFrameInternal.Logger,\n): Promise<void> {\n if (!process.env.MI_DUMP_PFRAMES_RS) return;\n try {\n const relativeUri = relativePath.map((part) => encodeURIComponent(part));\n const fileDir = join(process.env.MI_DUMP_PFRAMES_RS, ...relativeUri.slice(0, -1));\n await fs.mkdir(fileDir, { recursive: true });\n\n const filePath = join(process.env.MI_DUMP_PFRAMES_RS, ...relativeUri);\n const fileData = ArrayBuffer.isView(data) ? data : JSON.stringify(data, null, 2);\n await fs.writeFile(filePath, fileData, { flag: \"wx\" });\n } catch (error: unknown) {\n logger?.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AEO,eAAe,IAAI,CACxB,YAAsB,EACtB,IAAwE,EACxE,MAA8B,EAAA;AAE9B,IAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAAE;AACrC,IAAA,IAAI;AACF,QAAA,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACxE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjF,QAAA,MAAMA,QAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAE5C,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,WAAW,CAAC;QACrE,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAChF,QAAA,MAAMA,QAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxD;IAAE,OAAO,KAAc,EAAE;QACvB,MAAM,GAAG,MAAM,EAAE,qCAAqC,KAAK,CAAA,CAAE,CAAC;IAChE;AACF;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var wrapper = require('./wrapper.cjs');
|
|
4
|
+
|
|
5
|
+
const PFrameFactory = {
|
|
6
|
+
createPFrame: (options) => {
|
|
7
|
+
return new wrapper.PFrame(options);
|
|
8
|
+
},
|
|
9
|
+
pprofDump: async () => {
|
|
10
|
+
return await wrapper.pprofDump();
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.PFrameFactory = PFrameFactory;
|
|
15
|
+
//# sourceMappingURL=export.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.cjs","sources":["../export/export.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport { PFrame, pprofDump } from \"./wrapper\";\n\nexport const PFrameFactory: PFrameInternal.PFrameFactoryV4 = {\n createPFrame: (options: PFrameInternal.PFrameOptionsV2): PFrameInternal.PFrameV13 => {\n return new PFrame(options);\n },\n pprofDump: async (): Promise<Uint8Array> => {\n return await pprofDump();\n },\n};\n"],"names":["PFrame","pprofDump"],"mappings":";;;;AAGO,MAAM,aAAa,GAAmC;AAC3D,IAAA,YAAY,EAAE,CAAC,OAAuC,KAA8B;AAClF,QAAA,OAAO,IAAIA,cAAM,CAAC,OAAO,CAAC;IAC5B,CAAC;IACD,SAAS,EAAE,YAAgC;QACzC,OAAO,MAAMC,iBAAS,EAAE;IAC1B,CAAC;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../export/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAG5E,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,eAO1C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { pprofDump, PFrame } from './wrapper.js';
|
|
2
|
+
|
|
3
|
+
const PFrameFactory = {
|
|
4
|
+
createPFrame: (options) => {
|
|
5
|
+
return new PFrame(options);
|
|
6
|
+
},
|
|
7
|
+
pprofDump: async () => {
|
|
8
|
+
return await pprofDump();
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { PFrameFactory };
|
|
13
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sources":["../export/export.ts"],"sourcesContent":["import type { PFrameInternal } from \"@milaboratories/pl-model-middle-layer\";\nimport { PFrame, pprofDump } from \"./wrapper\";\n\nexport const PFrameFactory: PFrameInternal.PFrameFactoryV4 = {\n createPFrame: (options: PFrameInternal.PFrameOptionsV2): PFrameInternal.PFrameV13 => {\n return new PFrame(options);\n },\n pprofDump: async (): Promise<Uint8Array> => {\n return await pprofDump();\n },\n};\n"],"names":[],"mappings":";;AAGO,MAAM,aAAa,GAAmC;AAC3D,IAAA,YAAY,EAAE,CAAC,OAAuC,KAA8B;AAClF,QAAA,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC;IAC5B,CAAC;IACD,SAAS,EAAE,YAAgC;QACzC,OAAO,MAAM,SAAS,EAAE;IAC1B,CAAC;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _export = require('./export.cjs');
|
|
4
|
+
var pframesRsServ = require('@milaboratories/pframes-rs-serv');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.PFrameFactory = _export.PFrameFactory;
|
|
9
|
+
Object.defineProperty(exports, "HttpHelpers", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return pframesRsServ.HttpHelpers; }
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../export/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|