@tiga-ipc/mmap 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 TigaIpc contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # @tiga-ipc/mmap
2
+
3
+ `@tiga-ipc/mmap` is the Node.js package for the Tiga memory-mapped IPC protocol.
4
+
5
+ It provides a small CommonJS wrapper around the native `index.node` addon and exposes the current Tiga channel APIs:
6
+
7
+ - `initialized()`
8
+ - `tigaWrite(name, message, options?)`
9
+ - `tigaRead(name, options?)`
10
+ - `tigaInvoke(requestName, responseName, method, data, options?)`
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm install @tiga-ipc/mmap
16
+ ```
17
+
18
+ Current package scope:
19
+
20
+ - Windows only
21
+ - File-backed mapping usage
22
+ - `mappingDirectory` must be passed explicitly by the caller
23
+
24
+ ## Usage
25
+
26
+ ```js
27
+ const { tigaInvoke, tigaWrite, tigaRead } = require('@tiga-ipc/mmap');
28
+
29
+ const mappingDirectory = 'C:\\temp\\tiga-ipc';
30
+
31
+ const reply = tigaInvoke(
32
+ 'sample.req.client-a',
33
+ 'sample.resp.client-a',
34
+ 'echo',
35
+ 'hello from node',
36
+ {
37
+ mappingDirectory,
38
+ timeoutMs: 3000,
39
+ },
40
+ );
41
+
42
+ console.log(reply);
43
+
44
+ tigaWrite('sample.events', 'event payload', {
45
+ mappingDirectory,
46
+ mediaType: 'text/plain',
47
+ });
48
+
49
+ const result = tigaRead('sample.events', {
50
+ mappingDirectory,
51
+ lastId: 0,
52
+ });
53
+
54
+ console.log(result.lastId, result.entries.length);
55
+ ```
56
+
57
+ ## API
58
+
59
+ ### `tigaWrite(name, message, options?)`
60
+
61
+ - `name: string`
62
+ - `message: Buffer | string`
63
+ - `options?.mappingDirectory: string`
64
+ - `options?.mediaType?: string`
65
+
66
+ Returns a short write result string from the native addon.
67
+
68
+ ### `tigaRead(name, options?)`
69
+
70
+ - `name: string`
71
+ - `options?.mappingDirectory: string`
72
+ - `options?.lastId?: number`
73
+
74
+ Returns:
75
+
76
+ ```ts
77
+ interface TigaReadResult {
78
+ lastId: number;
79
+ entries: Array<{
80
+ id: number;
81
+ message: Buffer;
82
+ mediaType?: string;
83
+ }>;
84
+ }
85
+ ```
86
+
87
+ ### `tigaInvoke(requestName, responseName, method, data, options?)`
88
+
89
+ - `requestName: string`
90
+ - `responseName: string`
91
+ - `method: string`
92
+ - `data: string`
93
+ - `options?.mappingDirectory: string`
94
+ - `options?.timeoutMs?: number`
95
+
96
+ Returns the response payload string.
97
+
98
+ ## Notes
99
+
100
+ - This package intentionally uses the current `tiga*` API only. The old generic `write/read` export surface is not part of the published package entry.
101
+ - The native binary is packaged as `index.node`, so publish from a Windows environment after rebuilding the addon you want to ship.
102
+ - For repository examples and cross-language smoke tests, see the monorepo root README and `examples/`.
103
+
104
+ ## License
105
+
106
+ MIT
package/index.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ export declare function initialized(): string
7
+ export interface TigaReadResult {
8
+ lastId: number
9
+ entries: Array<TigaEntry>
10
+ }
11
+ export interface TigaEntry {
12
+ id: number
13
+ message: Buffer
14
+ mediaType?: string
15
+ }
16
+ export interface TigaChannelOptions {
17
+ mappingDirectory?: string
18
+ }
19
+ export interface TigaWriteOptions extends TigaChannelOptions {
20
+ mediaType?: string | null
21
+ }
22
+ export interface TigaReadOptions extends TigaChannelOptions {
23
+ lastId?: number
24
+ }
25
+ export interface TigaInvokeOptions extends TigaChannelOptions {
26
+ timeoutMs?: number
27
+ }
28
+ export declare function tigaWrite(name: string, message: Buffer | string, options?: TigaWriteOptions): string
29
+ export declare function tigaRead(name: string, options?: TigaReadOptions): TigaReadResult
30
+ export declare function tigaInvoke(requestName: string, responseName: string, method: string, data: string, options?: TigaInvokeOptions): string
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ const binding = require('./index.node');
2
+
3
+ module.exports = {
4
+ initialized: binding.initialized,
5
+ tigaWrite: binding.tigaWrite,
6
+ tigaRead: binding.tigaRead,
7
+ tigaInvoke: binding.tigaInvoke,
8
+ };
package/index.node ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@tiga-ipc/mmap",
3
+ "version": "0.1.0",
4
+ "description": "Windows memory-mapped IPC bindings for Tiga channels.",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "require": "./index.js",
11
+ "default": "./index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "LICENSE",
16
+ "README.md",
17
+ "index.js",
18
+ "index.d.ts",
19
+ "index.node"
20
+ ],
21
+ "os": [
22
+ "win32"
23
+ ],
24
+ "scripts": {
25
+ "test": "cargo test",
26
+ "cargo-build": "npx @napi-rs/cli build",
27
+ "cross-build": "npx @napi-rs/cli build",
28
+ "debug": "npm run cargo-build --",
29
+ "build": "npm run cargo-build -- --release",
30
+ "cross": "npm run cross-build -- --release",
31
+ "prepack": "node -e \"require('fs').accessSync('index.node')\""
32
+ },
33
+ "keywords": [
34
+ "ipc",
35
+ "mmap",
36
+ "memory-mapped-file",
37
+ "napi-rs",
38
+ "tiga"
39
+ ],
40
+ "author": "TigaIpc contributors",
41
+ "license": "MIT",
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/sugarbearr/TigaIpc.git",
48
+ "directory": "nodejs/mmap-napi"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/sugarbearr/TigaIpc/issues"
52
+ },
53
+ "homepage": "https://github.com/sugarbearr/TigaIpc",
54
+ "devDependencies": {
55
+ "@napi-rs/cli": "^2.18.0"
56
+ }
57
+ }