@milaboratories/pframes-rs-node 1.0.57 → 1.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -5
- package/export/addon-def.ts +0 -1
- package/export/dump.ts +13 -14
- package/export/export.ts +10 -10
- package/export/index.ts +2 -1
- package/export/wrapper.ts +143 -132
- package/export_dist/addon-def.d.ts +1 -1
- package/export_dist/addon-def.d.ts.map +1 -1
- package/export_dist/addon.cjs +24 -0
- package/export_dist/addon.cjs.map +1 -0
- package/export_dist/addon.d.ts +1 -1
- package/export_dist/addon.js +21 -0
- package/export_dist/addon.js.map +1 -0
- package/export_dist/dump.cjs +133 -0
- package/export_dist/dump.cjs.map +1 -0
- package/export_dist/dump.d.ts +1 -1
- package/export_dist/dump.d.ts.map +1 -1
- package/export_dist/dump.js +125 -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 +2 -6
- package/export_dist/export.d.ts.map +1 -1
- 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 +2 -1
- package/export_dist/index.d.ts.map +1 -1
- package/export_dist/index.js +2 -21
- package/export_dist/index.js.map +1 -1
- package/export_dist/wrapper.cjs +511 -0
- package/export_dist/wrapper.cjs.map +1 -0
- package/export_dist/wrapper.d.ts +32 -10
- package/export_dist/wrapper.d.ts.map +1 -1
- package/export_dist/wrapper.js +508 -0
- package/export_dist/wrapper.js.map +1 -0
- package/package.json +34 -33
- package/export_dist/index.mjs +0 -765
- package/export_dist/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,35 +1,46 @@
|
|
|
1
1
|
# PFrames Node.js native addon
|
|
2
|
+
|
|
2
3
|
## Usage
|
|
4
|
+
>
|
|
3
5
|
> [!TIP]
|
|
4
|
-
> Install using `
|
|
6
|
+
> Install using `pnpm install @milaboratories/pframes-rs-node` command.
|
|
5
7
|
> Check [tests](tests/pframes.test.ts) for usage examples.
|
|
8
|
+
>
|
|
6
9
|
## Build instructions
|
|
10
|
+
|
|
7
11
|
### Build steps
|
|
12
|
+
|
|
8
13
|
```sh
|
|
9
|
-
|
|
14
|
+
pnpm run build
|
|
10
15
|
```
|
|
11
16
|
|
|
12
17
|
### Artifacts
|
|
18
|
+
|
|
13
19
|
NodeJS Native Addon is places in `dist` folder.
|
|
14
|
-
Use `
|
|
20
|
+
Use `pnpm run pack` to prepare an archive (last output line is its path) and upload it to AWS S3.
|
|
15
21
|
|
|
16
22
|
Export wrapper is placed in `export_dist` folder.
|
|
17
|
-
Use `
|
|
23
|
+
Use `pnpm publish` to publish NodeJS package.
|
|
18
24
|
|
|
19
25
|
## Debugging
|
|
26
|
+
|
|
20
27
|
### Prerequisites
|
|
28
|
+
|
|
21
29
|
Debugging is only supported using VSCode with the following extencions installed (check `@recommended` section in VScode for more suggestions):
|
|
30
|
+
|
|
22
31
|
- [C/C++](vscode:extension/ms-vscode.cpptools)
|
|
23
32
|
- [CodeLLDB](vscode:extension/vadimcn.vscode-lldb)
|
|
24
33
|
- [rust-analyzer](vscode:extension/rust-lang.rust-analyzer)
|
|
25
34
|
|
|
26
35
|
### Launching debug session
|
|
36
|
+
|
|
27
37
|
1. Clone and build the latest `platforma-desktop-v2` (`git clean -dffx && npm i && npm run build`)
|
|
28
38
|
2. Set the correct RELATIVE path to `platforma-desktop-v2` in `.vscode/settings.json` variable `platformaDesktopPath` (default is `../platforma-desktop-v2`)
|
|
29
|
-
3. Build this package by following the build steps from above (for faster build use `
|
|
39
|
+
3. Build this package by following the build steps from above (for faster build use `pnpm run dev-build`)
|
|
30
40
|
4. Use VSCode launch configuration for your platform to start debug session ([VSCode debugging guide](https://code.visualstudio.com/docs/debugtest/debugging))
|
|
31
41
|
|
|
32
42
|
### Performance profiling
|
|
43
|
+
|
|
33
44
|
1. Clone and build the latest `platforma-desktop-v2`
|
|
34
45
|
2. Set the correct RELATIVE path to `platforma-desktop-v2` in `.vscode/settings.json` variable `platformaDesktopPath`
|
|
35
46
|
3. Build this package by following the build steps from above
|
|
@@ -39,5 +50,6 @@ Debugging is only supported using VSCode with the following extencions installed
|
|
|
39
50
|
(Warning! Firefox profiler does not work in Safari and with AdBlock enabled)
|
|
40
51
|
|
|
41
52
|
### Dump pframes requests
|
|
53
|
+
|
|
42
54
|
1. Run `platforma-desktop-v2` with `MI_DUMP_PFRAMES_RS=/absolute/path/to/dump/requests npm run dev`
|
|
43
55
|
2. Archive the `/absolute/path/to/dump/requests` folder and pass to the developer
|
package/export/addon-def.ts
CHANGED
package/export/dump.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import fs from 'node:fs';
|
|
2
|
+
import { createWriteStream, promises as fs } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { Readable
|
|
4
|
+
import { Readable } from 'node:stream';
|
|
5
|
+
import { pipeline } from 'node:stream/promises';
|
|
5
6
|
import type { PFrameInternal } from '@milaboratories/pl-model-middle-layer';
|
|
6
7
|
import {
|
|
7
8
|
PObjectId,
|
|
@@ -11,18 +12,16 @@ import {
|
|
|
11
12
|
UniqueValuesRequest
|
|
12
13
|
} from '@milaboratories/pl-model-common';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
15
|
+
function fileExists(path: string): Promise<boolean> {
|
|
16
|
+
return fs
|
|
17
|
+
.access(path)
|
|
18
|
+
.then(() => true)
|
|
19
|
+
.catch(() => false);
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
async function ensureDirExists(fileOrDir: string): Promise<void> {
|
|
24
23
|
if (!(await fileExists(fileOrDir))) {
|
|
25
|
-
await fs.
|
|
24
|
+
await fs.mkdir(fileOrDir, { recursive: true });
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -32,15 +31,15 @@ async function writeFile(
|
|
|
32
31
|
): Promise<void> {
|
|
33
32
|
const tempPath = `${filePath}.tmp`;
|
|
34
33
|
if (await fileExists(tempPath)) {
|
|
35
|
-
await fs.
|
|
34
|
+
await fs.rm(tempPath, { recursive: true });
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
const buffer = typeof data === 'string' ? Buffer.from(data, 'utf8') : data;
|
|
39
38
|
const source = Readable.from(buffer);
|
|
40
|
-
const destination =
|
|
41
|
-
await
|
|
39
|
+
const destination = createWriteStream(tempPath, { flags: 'wx' });
|
|
40
|
+
await pipeline(source, destination);
|
|
42
41
|
|
|
43
|
-
await fs.
|
|
42
|
+
await fs.rename(tempPath, filePath);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
export function hashColumnId(columnId: PObjectId): PObjectId {
|
package/export/export.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { PFrameInternal } from '@milaboratories/pl-model-middle-layer';
|
|
2
|
-
import { PFrame
|
|
2
|
+
import { PFrame, pprofDump } from './wrapper';
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
pprofDump: ()
|
|
4
|
+
export const PFrameFactory: PFrameInternal.PFrameFactory = {
|
|
5
|
+
createPFrame: (
|
|
6
|
+
options: PFrameInternal.PFrameOptions
|
|
7
|
+
): PFrameInternal.PFrameV10 => {
|
|
8
|
+
return new PFrame(options);
|
|
9
|
+
},
|
|
10
|
+
pprofDump: async (): Promise<Uint8Array> => {
|
|
11
|
+
return await pprofDump();
|
|
12
|
+
}
|
|
11
13
|
};
|
|
12
|
-
|
|
13
|
-
export const PFrame: PFrame = PFrameImpl;
|
package/export/index.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { PFrameFactory } from './export';
|
|
2
|
+
export { HttpHelpers } from '@milaboratories/pframes-rs-serv';
|