nap-sdk 0.2.2 → 0.2.4
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/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/native.d.ts +1 -0
- package/dist/native.d.ts.map +1 -1
- package/index.d.ts +27 -0
- package/nap-sdk.darwin-arm64.node +0 -0
- package/nap-sdk.linux-x64-gnu.node +0 -0
- package/nap-sdk.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,16 @@ export declare function parseUri(uri: string): Record<string, unknown>;
|
|
|
2
2
|
export declare function parseManifest(yamlStr: string): Record<string, unknown>;
|
|
3
3
|
export declare function resolve(uri: string, repoPath?: string): Record<string, unknown>;
|
|
4
4
|
export declare function version(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Ingest raw media bytes into the content-addressed storage engine.
|
|
7
|
+
*
|
|
8
|
+
* The storage backend is determined by the ``NAP_STORAGE_BACKEND``
|
|
9
|
+
* environment variable at the Rust layer (``local`` or ``s3``).
|
|
10
|
+
*
|
|
11
|
+
* @param data - Raw bytes of the media asset (image, audio, mesh, etc.).
|
|
12
|
+
* @param format - File extension without a leading dot (e.g. ``"png"``,
|
|
13
|
+
* ``"jpg"``, ``"wav"``, ``"glb"``).
|
|
14
|
+
* @returns A Promise resolving to the content-addressed hash ``sha256:<hex>``.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ingestMedia(data: Buffer, format: string): Promise<string>;
|
|
5
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE7D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEtE;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAK/E;AAED,wBAAgB,OAAO,IAAI,MAAM,CAEhC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE7D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEtE;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAK/E;AAED,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE/E"}
|
package/dist/index.js
CHANGED
|
@@ -16,3 +16,17 @@ export function resolve(uri, repoPath) {
|
|
|
16
16
|
export function version() {
|
|
17
17
|
return native.version();
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Ingest raw media bytes into the content-addressed storage engine.
|
|
21
|
+
*
|
|
22
|
+
* The storage backend is determined by the ``NAP_STORAGE_BACKEND``
|
|
23
|
+
* environment variable at the Rust layer (``local`` or ``s3``).
|
|
24
|
+
*
|
|
25
|
+
* @param data - Raw bytes of the media asset (image, audio, mesh, etc.).
|
|
26
|
+
* @param format - File extension without a leading dot (e.g. ``"png"``,
|
|
27
|
+
* ``"jpg"``, ``"wav"``, ``"glb"``).
|
|
28
|
+
* @returns A Promise resolving to the content-addressed hash ``sha256:<hex>``.
|
|
29
|
+
*/
|
|
30
|
+
export async function ingestMedia(data, format) {
|
|
31
|
+
return native.ingestMedia(data, format);
|
|
32
|
+
}
|
package/dist/native.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ interface NativeBindings {
|
|
|
3
3
|
parseManifest(yamlStr: string): string;
|
|
4
4
|
resolve(uri: string, repoPath: string): string;
|
|
5
5
|
version(): string;
|
|
6
|
+
ingestMedia(data: Buffer, format: string): Promise<string>;
|
|
6
7
|
}
|
|
7
8
|
declare const native: NativeBindings;
|
|
8
9
|
export default native;
|
package/dist/native.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAEA,UAAU,cAAc;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACvC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/C,OAAO,IAAI,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAEA,UAAU,cAAc;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACvC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/C,OAAO,IAAI,MAAM,CAAC;IAClB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5D;AAGD,QAAA,MAAM,MAAM,EAA8B,cAAc,CAAC;AAEzD,eAAe,MAAM,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -7,3 +7,30 @@ export declare function parseUri(uriStr: string): string
|
|
|
7
7
|
export declare function parseManifest(yamlStr: string): string
|
|
8
8
|
export declare function resolve(uriStr: string, repoBasePath: string): string
|
|
9
9
|
export declare function version(): string
|
|
10
|
+
/**
|
|
11
|
+
* Ingest raw media bytes into the content-addressed storage engine.
|
|
12
|
+
*
|
|
13
|
+
* This is an async function returning a JavaScript Promise. The storage
|
|
14
|
+
* backend is determined at runtime by the ``NAP_STORAGE_BACKEND``
|
|
15
|
+
* environment variable.
|
|
16
|
+
*
|
|
17
|
+
* ## Memory Safety (NAPI Buffer Ownership)
|
|
18
|
+
*
|
|
19
|
+
* The incoming [`Buffer`] is **copied** to an owned `Vec<u8>` **before**
|
|
20
|
+
* crossing the await boundary. Holding a raw pointer to a V8 `ArrayBuffer`
|
|
21
|
+
* across an await point is unsafe because Node's garbage collector may
|
|
22
|
+
* invalidate or relocate the backing store. By cloning eagerly we avoid
|
|
23
|
+
* use-after-free and data races.
|
|
24
|
+
*
|
|
25
|
+
* # Arguments
|
|
26
|
+
*
|
|
27
|
+
* * `data` — Raw bytes of the media asset (image, audio, mesh, etc.),
|
|
28
|
+
* passed as a Node.js `Buffer`.
|
|
29
|
+
* * `format` — File extension without a leading dot (e.g. `"png"`,
|
|
30
|
+
* `"jpg"`, `"wav"`, `"glb"`).
|
|
31
|
+
*
|
|
32
|
+
* # Returns
|
|
33
|
+
*
|
|
34
|
+
* A Promise resolving to the content-addressed hash `sha256:<hex>`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ingestMedia(data: Buffer, format: string): Promise<string>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|