@yodaos-pkg/aix 0.2.0 → 0.3.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/README.md +124 -25
- package/index.d.ts +2 -2
- package/index.js +11 -3
- package/jsr.json +1 -1
- package/package.json +2 -5
- package/pkg/README.md +149 -0
- package/pkg/aix_web.d.ts +56 -0
- package/pkg/aix_web.js +379 -0
- package/pkg/aix_web_bg.wasm +0 -0
- package/pkg/aix_web_bg.wasm.d.ts +17 -0
- package/pkg/package.json +14 -0
package/README.md
CHANGED
|
@@ -1,50 +1,149 @@
|
|
|
1
|
-
# @yodaos-
|
|
1
|
+
# @yodaos-pkg/aix
|
|
2
2
|
|
|
3
|
-
`@yodaos-
|
|
3
|
+
`@yodaos-pkg/aix` is a library for reading and managing **.aix** (AI eXecutable) packages in the web environment using WASM. The `.aix` format is an extension of the [Open Agent Format (OAF)](https://openagentformat.com/spec.html), designed to package AI agents with rich UI/UX capabilities powered by Ink Mini Programs.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @yodaos-pkg/aix
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
Here is a quick example of how to load an `.aix` package:
|
|
8
14
|
|
|
9
15
|
```typescript
|
|
10
|
-
import { AIX } from '@yodaos-
|
|
16
|
+
import { AIX } from '@yodaos-pkg/aix';
|
|
17
|
+
|
|
18
|
+
// Option 1: Load from a URL
|
|
19
|
+
async function fromUrl() {
|
|
20
|
+
const response = await fetch('https://example.com/my-agent.aix');
|
|
21
|
+
const buffer = await response.arrayBuffer();
|
|
22
|
+
const aix = await AIX.From(new Uint8Array(buffer));
|
|
23
|
+
console.log('App Title:', aix.getTitle());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Option 2: Load from a File object (e.g., from an <input type="file">)
|
|
27
|
+
async function fromFile(file: File) {
|
|
28
|
+
const aix = await AIX.From(file);
|
|
29
|
+
console.log('App Title:', aix.getTitle());
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API Reference
|
|
34
|
+
|
|
35
|
+
### `AIX` Class
|
|
36
|
+
|
|
37
|
+
The main class to interact with an AIX package.
|
|
11
38
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
#### `static async From(data: Uint8Array | File): Promise<AIX>`
|
|
40
|
+
Initializes the WASM module and creates an AIX instance from the given `.aix` file content. It supports both `Uint8Array` and the standard Web `File` object.
|
|
41
|
+
```typescript
|
|
42
|
+
// From Uint8Array
|
|
43
|
+
const aix = await AIX.From(new Uint8Array(buffer));
|
|
16
44
|
|
|
17
|
-
//
|
|
18
|
-
const aix = await AIX.
|
|
45
|
+
// From File (Web API)
|
|
46
|
+
const aix = await AIX.From(file);
|
|
47
|
+
```
|
|
19
48
|
|
|
20
|
-
|
|
49
|
+
#### `list(): AixEntry[]`
|
|
50
|
+
Lists all files in the AIX package.
|
|
51
|
+
```typescript
|
|
21
52
|
const files = aix.list();
|
|
22
|
-
|
|
53
|
+
// [{ name: "app.json", size: 123, compressed_size: 45 }, ...]
|
|
54
|
+
```
|
|
23
55
|
|
|
24
|
-
|
|
56
|
+
#### `readFile(name: string): Uint8Array`
|
|
57
|
+
Reads the raw content of a specific file from the package.
|
|
58
|
+
```typescript
|
|
59
|
+
const content = aix.readFile('app.json');
|
|
60
|
+
const text = new TextDecoder().decode(content);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### `getVersion(): string | undefined`
|
|
64
|
+
Returns the version metadata from the `VERSION` file in the package.
|
|
65
|
+
```typescript
|
|
25
66
|
const version = aix.getVersion();
|
|
26
|
-
|
|
67
|
+
```
|
|
27
68
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
69
|
+
#### `getTitle(): string | undefined`
|
|
70
|
+
Extracts the navigation bar title from the `app.json`.
|
|
71
|
+
```typescript
|
|
72
|
+
const title = aix.getTitle();
|
|
32
73
|
```
|
|
33
74
|
|
|
34
|
-
|
|
75
|
+
#### `getPages(): PageInfo[]`
|
|
76
|
+
Returns information about all pages defined in the package, including their paths, titles, and data schemas.
|
|
77
|
+
```typescript
|
|
78
|
+
const pages = aix.getPages();
|
|
79
|
+
/*
|
|
80
|
+
[{
|
|
81
|
+
name: "pages/index/index",
|
|
82
|
+
title: "Home",
|
|
83
|
+
data_schema: { ... }
|
|
84
|
+
}]
|
|
85
|
+
*/
|
|
86
|
+
```
|
|
35
87
|
|
|
36
|
-
|
|
37
|
-
|
|
88
|
+
#### `getTools(): Tool[]`
|
|
89
|
+
Generates a list of OpenAI-compatible tool definitions based on the pages and their schemas.
|
|
90
|
+
```typescript
|
|
91
|
+
const tools = aix.getTools();
|
|
92
|
+
/*
|
|
93
|
+
[{
|
|
94
|
+
type: "function",
|
|
95
|
+
function: {
|
|
96
|
+
name: "pages_index_index",
|
|
97
|
+
description: "Home",
|
|
98
|
+
parameters: { ... }
|
|
99
|
+
}
|
|
100
|
+
}]
|
|
101
|
+
*/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Data Types
|
|
105
|
+
|
|
106
|
+
### `AixEntry`
|
|
107
|
+
```typescript
|
|
108
|
+
interface AixEntry {
|
|
109
|
+
name: string;
|
|
110
|
+
size: number;
|
|
111
|
+
compressed_size: number;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `PageInfo`
|
|
116
|
+
```typescript
|
|
117
|
+
interface PageInfo {
|
|
118
|
+
name: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
data_schema: any;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `Tool`
|
|
125
|
+
OpenAI compatible tool format.
|
|
126
|
+
```typescript
|
|
127
|
+
interface Tool {
|
|
128
|
+
type: string;
|
|
129
|
+
function: {
|
|
130
|
+
name: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
parameters: any;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
38
135
|
```
|
|
39
136
|
|
|
40
137
|
## Build
|
|
41
138
|
|
|
42
|
-
To build the
|
|
139
|
+
To build the library for distribution:
|
|
43
140
|
|
|
44
141
|
```bash
|
|
45
142
|
npm run build
|
|
46
143
|
```
|
|
47
144
|
|
|
48
|
-
|
|
145
|
+
The output will be generated in the `dist` directory, including WASM binaries and TypeScript definitions.
|
|
146
|
+
|
|
147
|
+
## License
|
|
49
148
|
|
|
50
|
-
|
|
149
|
+
MIT
|
package/index.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export declare class AIX {
|
|
|
21
21
|
private constructor();
|
|
22
22
|
/**
|
|
23
23
|
* Initialize the WASM module and create an AIX instance from the given data.
|
|
24
|
-
* @param data The .aix file content as Uint8Array
|
|
24
|
+
* @param data The .aix file content as Uint8Array or File
|
|
25
25
|
*/
|
|
26
|
-
static
|
|
26
|
+
static From(data: Uint8Array | File): Promise<AIX>;
|
|
27
27
|
/**
|
|
28
28
|
* List all files in the AIX package.
|
|
29
29
|
*/
|
package/index.js
CHANGED
|
@@ -5,11 +5,19 @@ export class AIX {
|
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Initialize the WASM module and create an AIX instance from the given data.
|
|
8
|
-
* @param data The .aix file content as Uint8Array
|
|
8
|
+
* @param data The .aix file content as Uint8Array or File
|
|
9
9
|
*/
|
|
10
|
-
static async
|
|
10
|
+
static async From(data) {
|
|
11
11
|
await init();
|
|
12
|
-
|
|
12
|
+
let buffer;
|
|
13
|
+
if (data instanceof Uint8Array) {
|
|
14
|
+
buffer = data;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const arrayBuffer = await data.arrayBuffer();
|
|
18
|
+
buffer = new Uint8Array(arrayBuffer);
|
|
19
|
+
}
|
|
20
|
+
const reader = new AixReaderWasm(buffer);
|
|
13
21
|
return new AIX(reader);
|
|
14
22
|
}
|
|
15
23
|
/**
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yodaos-pkg/aix",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Ink AIX Package Reader",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"*"
|
|
9
9
|
],
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"react": "^18.2.0",
|
|
12
|
-
"react-dom": "^18.2.0"
|
|
13
|
-
},
|
|
10
|
+
"dependencies": {},
|
|
14
11
|
"publishConfig": {
|
|
15
12
|
"access": "public",
|
|
16
13
|
"registry": "https://registry.npmjs.org/"
|
package/pkg/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# @yodaos-pkg/aix
|
|
2
|
+
|
|
3
|
+
`@yodaos-pkg/aix` is a library for reading and managing **.aix** (AI eXecutable) packages in the web environment using WASM. The `.aix` format is an extension of the [Open Agent Format (OAF)](https://openagentformat.com/spec.html), designed to package AI agents with rich UI/UX capabilities powered by Ink Mini Programs.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @yodaos-pkg/aix
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
Here is a quick example of how to load an `.aix` package:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { AIX } from '@yodaos-pkg/aix';
|
|
17
|
+
|
|
18
|
+
// Option 1: Load from a URL
|
|
19
|
+
async function fromUrl() {
|
|
20
|
+
const response = await fetch('https://example.com/my-agent.aix');
|
|
21
|
+
const buffer = await response.arrayBuffer();
|
|
22
|
+
const aix = await AIX.From(new Uint8Array(buffer));
|
|
23
|
+
console.log('App Title:', aix.getTitle());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Option 2: Load from a File object (e.g., from an <input type="file">)
|
|
27
|
+
async function fromFile(file: File) {
|
|
28
|
+
const aix = await AIX.From(file);
|
|
29
|
+
console.log('App Title:', aix.getTitle());
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API Reference
|
|
34
|
+
|
|
35
|
+
### `AIX` Class
|
|
36
|
+
|
|
37
|
+
The main class to interact with an AIX package.
|
|
38
|
+
|
|
39
|
+
#### `static async From(data: Uint8Array | File): Promise<AIX>`
|
|
40
|
+
Initializes the WASM module and creates an AIX instance from the given `.aix` file content. It supports both `Uint8Array` and the standard Web `File` object.
|
|
41
|
+
```typescript
|
|
42
|
+
// From Uint8Array
|
|
43
|
+
const aix = await AIX.From(new Uint8Array(buffer));
|
|
44
|
+
|
|
45
|
+
// From File (Web API)
|
|
46
|
+
const aix = await AIX.From(file);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### `list(): AixEntry[]`
|
|
50
|
+
Lists all files in the AIX package.
|
|
51
|
+
```typescript
|
|
52
|
+
const files = aix.list();
|
|
53
|
+
// [{ name: "app.json", size: 123, compressed_size: 45 }, ...]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### `readFile(name: string): Uint8Array`
|
|
57
|
+
Reads the raw content of a specific file from the package.
|
|
58
|
+
```typescript
|
|
59
|
+
const content = aix.readFile('app.json');
|
|
60
|
+
const text = new TextDecoder().decode(content);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### `getVersion(): string | undefined`
|
|
64
|
+
Returns the version metadata from the `VERSION` file in the package.
|
|
65
|
+
```typescript
|
|
66
|
+
const version = aix.getVersion();
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### `getTitle(): string | undefined`
|
|
70
|
+
Extracts the navigation bar title from the `app.json`.
|
|
71
|
+
```typescript
|
|
72
|
+
const title = aix.getTitle();
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### `getPages(): PageInfo[]`
|
|
76
|
+
Returns information about all pages defined in the package, including their paths, titles, and data schemas.
|
|
77
|
+
```typescript
|
|
78
|
+
const pages = aix.getPages();
|
|
79
|
+
/*
|
|
80
|
+
[{
|
|
81
|
+
name: "pages/index/index",
|
|
82
|
+
title: "Home",
|
|
83
|
+
data_schema: { ... }
|
|
84
|
+
}]
|
|
85
|
+
*/
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### `getTools(): Tool[]`
|
|
89
|
+
Generates a list of OpenAI-compatible tool definitions based on the pages and their schemas.
|
|
90
|
+
```typescript
|
|
91
|
+
const tools = aix.getTools();
|
|
92
|
+
/*
|
|
93
|
+
[{
|
|
94
|
+
type: "function",
|
|
95
|
+
function: {
|
|
96
|
+
name: "pages_index_index",
|
|
97
|
+
description: "Home",
|
|
98
|
+
parameters: { ... }
|
|
99
|
+
}
|
|
100
|
+
}]
|
|
101
|
+
*/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Data Types
|
|
105
|
+
|
|
106
|
+
### `AixEntry`
|
|
107
|
+
```typescript
|
|
108
|
+
interface AixEntry {
|
|
109
|
+
name: string;
|
|
110
|
+
size: number;
|
|
111
|
+
compressed_size: number;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `PageInfo`
|
|
116
|
+
```typescript
|
|
117
|
+
interface PageInfo {
|
|
118
|
+
name: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
data_schema: any;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `Tool`
|
|
125
|
+
OpenAI compatible tool format.
|
|
126
|
+
```typescript
|
|
127
|
+
interface Tool {
|
|
128
|
+
type: string;
|
|
129
|
+
function: {
|
|
130
|
+
name: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
parameters: any;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Build
|
|
138
|
+
|
|
139
|
+
To build the library for distribution:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm run build
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The output will be generated in the `dist` directory, including WASM binaries and TypeScript definitions.
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
MIT
|
package/pkg/aix_web.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class AixReaderWasm {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
get_pages(): any;
|
|
8
|
+
get_title(): string | undefined;
|
|
9
|
+
get_tools(): any;
|
|
10
|
+
get_version(): string | undefined;
|
|
11
|
+
list(): any;
|
|
12
|
+
constructor(data: Uint8Array);
|
|
13
|
+
read_file(name: string): Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
17
|
+
|
|
18
|
+
export interface InitOutput {
|
|
19
|
+
readonly memory: WebAssembly.Memory;
|
|
20
|
+
readonly __wbg_aixreaderwasm_free: (a: number, b: number) => void;
|
|
21
|
+
readonly aixreaderwasm_new: (a: number, b: number) => [number, number, number];
|
|
22
|
+
readonly aixreaderwasm_list: (a: number) => [number, number, number];
|
|
23
|
+
readonly aixreaderwasm_read_file: (a: number, b: number, c: number) => [number, number, number, number];
|
|
24
|
+
readonly aixreaderwasm_get_version: (a: number) => [number, number];
|
|
25
|
+
readonly aixreaderwasm_get_title: (a: number) => [number, number];
|
|
26
|
+
readonly aixreaderwasm_get_pages: (a: number) => [number, number, number];
|
|
27
|
+
readonly aixreaderwasm_get_tools: (a: number) => [number, number, number];
|
|
28
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
29
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
30
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
31
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
32
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
33
|
+
readonly __wbindgen_start: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
40
|
+
* a precompiled `WebAssembly.Module`.
|
|
41
|
+
*
|
|
42
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
43
|
+
*
|
|
44
|
+
* @returns {InitOutput}
|
|
45
|
+
*/
|
|
46
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
50
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
51
|
+
*
|
|
52
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
53
|
+
*
|
|
54
|
+
* @returns {Promise<InitOutput>}
|
|
55
|
+
*/
|
|
56
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/pkg/aix_web.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/* @ts-self-types="./aix_web.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class AixReaderWasm {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
AixReaderWasmFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_aixreaderwasm_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @returns {any}
|
|
16
|
+
*/
|
|
17
|
+
get_pages() {
|
|
18
|
+
const ret = wasm.aixreaderwasm_get_pages(this.__wbg_ptr);
|
|
19
|
+
if (ret[2]) {
|
|
20
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
21
|
+
}
|
|
22
|
+
return takeFromExternrefTable0(ret[0]);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @returns {string | undefined}
|
|
26
|
+
*/
|
|
27
|
+
get_title() {
|
|
28
|
+
const ret = wasm.aixreaderwasm_get_title(this.__wbg_ptr);
|
|
29
|
+
let v1;
|
|
30
|
+
if (ret[0] !== 0) {
|
|
31
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
32
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
33
|
+
}
|
|
34
|
+
return v1;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @returns {any}
|
|
38
|
+
*/
|
|
39
|
+
get_tools() {
|
|
40
|
+
const ret = wasm.aixreaderwasm_get_tools(this.__wbg_ptr);
|
|
41
|
+
if (ret[2]) {
|
|
42
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
43
|
+
}
|
|
44
|
+
return takeFromExternrefTable0(ret[0]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @returns {string | undefined}
|
|
48
|
+
*/
|
|
49
|
+
get_version() {
|
|
50
|
+
const ret = wasm.aixreaderwasm_get_version(this.__wbg_ptr);
|
|
51
|
+
let v1;
|
|
52
|
+
if (ret[0] !== 0) {
|
|
53
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
54
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
55
|
+
}
|
|
56
|
+
return v1;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @returns {any}
|
|
60
|
+
*/
|
|
61
|
+
list() {
|
|
62
|
+
const ret = wasm.aixreaderwasm_list(this.__wbg_ptr);
|
|
63
|
+
if (ret[2]) {
|
|
64
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
65
|
+
}
|
|
66
|
+
return takeFromExternrefTable0(ret[0]);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @param {Uint8Array} data
|
|
70
|
+
*/
|
|
71
|
+
constructor(data) {
|
|
72
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
73
|
+
const len0 = WASM_VECTOR_LEN;
|
|
74
|
+
const ret = wasm.aixreaderwasm_new(ptr0, len0);
|
|
75
|
+
if (ret[2]) {
|
|
76
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
77
|
+
}
|
|
78
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
79
|
+
AixReaderWasmFinalization.register(this, this.__wbg_ptr, this);
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @param {string} name
|
|
84
|
+
* @returns {Uint8Array}
|
|
85
|
+
*/
|
|
86
|
+
read_file(name) {
|
|
87
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
88
|
+
const len0 = WASM_VECTOR_LEN;
|
|
89
|
+
const ret = wasm.aixreaderwasm_read_file(this.__wbg_ptr, ptr0, len0);
|
|
90
|
+
if (ret[3]) {
|
|
91
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
92
|
+
}
|
|
93
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
94
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
95
|
+
return v2;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (Symbol.dispose) AixReaderWasm.prototype[Symbol.dispose] = AixReaderWasm.prototype.free;
|
|
99
|
+
|
|
100
|
+
function __wbg_get_imports() {
|
|
101
|
+
const import0 = {
|
|
102
|
+
__proto__: null,
|
|
103
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
104
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
105
|
+
return ret;
|
|
106
|
+
},
|
|
107
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
108
|
+
const ret = String(arg1);
|
|
109
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
110
|
+
const len1 = WASM_VECTOR_LEN;
|
|
111
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
112
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
113
|
+
},
|
|
114
|
+
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
115
|
+
const ret = typeof(arg0) === 'string';
|
|
116
|
+
return ret;
|
|
117
|
+
},
|
|
118
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
119
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
120
|
+
},
|
|
121
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
122
|
+
const ret = new Object();
|
|
123
|
+
return ret;
|
|
124
|
+
},
|
|
125
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
126
|
+
const ret = new Array();
|
|
127
|
+
return ret;
|
|
128
|
+
},
|
|
129
|
+
__wbg_new_dca287b076112a51: function() {
|
|
130
|
+
const ret = new Map();
|
|
131
|
+
return ret;
|
|
132
|
+
},
|
|
133
|
+
__wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
|
|
134
|
+
const ret = arg0.set(arg1, arg2);
|
|
135
|
+
return ret;
|
|
136
|
+
},
|
|
137
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
138
|
+
arg0[arg1] = arg2;
|
|
139
|
+
},
|
|
140
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
141
|
+
arg0[arg1 >>> 0] = arg2;
|
|
142
|
+
},
|
|
143
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
144
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
145
|
+
const ret = arg0;
|
|
146
|
+
return ret;
|
|
147
|
+
},
|
|
148
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
149
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
150
|
+
const ret = arg0;
|
|
151
|
+
return ret;
|
|
152
|
+
},
|
|
153
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
154
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
155
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
156
|
+
return ret;
|
|
157
|
+
},
|
|
158
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
159
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
160
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
161
|
+
return ret;
|
|
162
|
+
},
|
|
163
|
+
__wbindgen_init_externref_table: function() {
|
|
164
|
+
const table = wasm.__wbindgen_externrefs;
|
|
165
|
+
const offset = table.grow(4);
|
|
166
|
+
table.set(0, undefined);
|
|
167
|
+
table.set(offset + 0, undefined);
|
|
168
|
+
table.set(offset + 1, null);
|
|
169
|
+
table.set(offset + 2, true);
|
|
170
|
+
table.set(offset + 3, false);
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
return {
|
|
174
|
+
__proto__: null,
|
|
175
|
+
"./aix_web_bg.js": import0,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const AixReaderWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
180
|
+
? { register: () => {}, unregister: () => {} }
|
|
181
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_aixreaderwasm_free(ptr >>> 0, 1));
|
|
182
|
+
|
|
183
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
184
|
+
ptr = ptr >>> 0;
|
|
185
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
let cachedDataViewMemory0 = null;
|
|
189
|
+
function getDataViewMemory0() {
|
|
190
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
191
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
192
|
+
}
|
|
193
|
+
return cachedDataViewMemory0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function getStringFromWasm0(ptr, len) {
|
|
197
|
+
ptr = ptr >>> 0;
|
|
198
|
+
return decodeText(ptr, len);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
let cachedUint8ArrayMemory0 = null;
|
|
202
|
+
function getUint8ArrayMemory0() {
|
|
203
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
204
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
205
|
+
}
|
|
206
|
+
return cachedUint8ArrayMemory0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
210
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
211
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
212
|
+
WASM_VECTOR_LEN = arg.length;
|
|
213
|
+
return ptr;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
217
|
+
if (realloc === undefined) {
|
|
218
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
219
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
220
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
221
|
+
WASM_VECTOR_LEN = buf.length;
|
|
222
|
+
return ptr;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
let len = arg.length;
|
|
226
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
227
|
+
|
|
228
|
+
const mem = getUint8ArrayMemory0();
|
|
229
|
+
|
|
230
|
+
let offset = 0;
|
|
231
|
+
|
|
232
|
+
for (; offset < len; offset++) {
|
|
233
|
+
const code = arg.charCodeAt(offset);
|
|
234
|
+
if (code > 0x7F) break;
|
|
235
|
+
mem[ptr + offset] = code;
|
|
236
|
+
}
|
|
237
|
+
if (offset !== len) {
|
|
238
|
+
if (offset !== 0) {
|
|
239
|
+
arg = arg.slice(offset);
|
|
240
|
+
}
|
|
241
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
242
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
243
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
244
|
+
|
|
245
|
+
offset += ret.written;
|
|
246
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
WASM_VECTOR_LEN = offset;
|
|
250
|
+
return ptr;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function takeFromExternrefTable0(idx) {
|
|
254
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
255
|
+
wasm.__externref_table_dealloc(idx);
|
|
256
|
+
return value;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
260
|
+
cachedTextDecoder.decode();
|
|
261
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
262
|
+
let numBytesDecoded = 0;
|
|
263
|
+
function decodeText(ptr, len) {
|
|
264
|
+
numBytesDecoded += len;
|
|
265
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
266
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
267
|
+
cachedTextDecoder.decode();
|
|
268
|
+
numBytesDecoded = len;
|
|
269
|
+
}
|
|
270
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const cachedTextEncoder = new TextEncoder();
|
|
274
|
+
|
|
275
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
276
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
277
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
278
|
+
view.set(buf);
|
|
279
|
+
return {
|
|
280
|
+
read: arg.length,
|
|
281
|
+
written: buf.length
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
let WASM_VECTOR_LEN = 0;
|
|
287
|
+
|
|
288
|
+
let wasmModule, wasm;
|
|
289
|
+
function __wbg_finalize_init(instance, module) {
|
|
290
|
+
wasm = instance.exports;
|
|
291
|
+
wasmModule = module;
|
|
292
|
+
cachedDataViewMemory0 = null;
|
|
293
|
+
cachedUint8ArrayMemory0 = null;
|
|
294
|
+
wasm.__wbindgen_start();
|
|
295
|
+
return wasm;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
async function __wbg_load(module, imports) {
|
|
299
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
300
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
301
|
+
try {
|
|
302
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
303
|
+
} catch (e) {
|
|
304
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
305
|
+
|
|
306
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
307
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
308
|
+
|
|
309
|
+
} else { throw e; }
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const bytes = await module.arrayBuffer();
|
|
314
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
315
|
+
} else {
|
|
316
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
317
|
+
|
|
318
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
319
|
+
return { instance, module };
|
|
320
|
+
} else {
|
|
321
|
+
return instance;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function expectedResponseType(type) {
|
|
326
|
+
switch (type) {
|
|
327
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
328
|
+
}
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function initSync(module) {
|
|
334
|
+
if (wasm !== undefined) return wasm;
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
if (module !== undefined) {
|
|
338
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
339
|
+
({module} = module)
|
|
340
|
+
} else {
|
|
341
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const imports = __wbg_get_imports();
|
|
346
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
347
|
+
module = new WebAssembly.Module(module);
|
|
348
|
+
}
|
|
349
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
350
|
+
return __wbg_finalize_init(instance, module);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
async function __wbg_init(module_or_path) {
|
|
354
|
+
if (wasm !== undefined) return wasm;
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
if (module_or_path !== undefined) {
|
|
358
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
359
|
+
({module_or_path} = module_or_path)
|
|
360
|
+
} else {
|
|
361
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (module_or_path === undefined) {
|
|
366
|
+
module_or_path = new URL('aix_web_bg.wasm', import.meta.url);
|
|
367
|
+
}
|
|
368
|
+
const imports = __wbg_get_imports();
|
|
369
|
+
|
|
370
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
371
|
+
module_or_path = fetch(module_or_path);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
375
|
+
|
|
376
|
+
return __wbg_finalize_init(instance, module);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_aixreaderwasm_free: (a: number, b: number) => void;
|
|
5
|
+
export const aixreaderwasm_new: (a: number, b: number) => [number, number, number];
|
|
6
|
+
export const aixreaderwasm_list: (a: number) => [number, number, number];
|
|
7
|
+
export const aixreaderwasm_read_file: (a: number, b: number, c: number) => [number, number, number, number];
|
|
8
|
+
export const aixreaderwasm_get_version: (a: number) => [number, number];
|
|
9
|
+
export const aixreaderwasm_get_title: (a: number) => [number, number];
|
|
10
|
+
export const aixreaderwasm_get_pages: (a: number) => [number, number, number];
|
|
11
|
+
export const aixreaderwasm_get_tools: (a: number) => [number, number, number];
|
|
12
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
13
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
14
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
15
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
16
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
17
|
+
export const __wbindgen_start: () => void;
|