@yodaos-pkg/aix 0.11.0 → 0.12.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 +45 -2
- package/index.d.ts +17 -2
- package/index.js +41 -2
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/pkg/README.md +45 -2
- package/pkg/aix_web.d.ts +2 -0
- package/pkg/aix_web.js +11 -1
- package/pkg/aix_web_bg.wasm +0 -0
- package/pkg/aix_web_bg.wasm.d.ts +1 -0
- package/pkg/package.json +1 -1
- package/pkg-reader/README.md +45 -2
- package/pkg-reader/aix_web.d.ts +2 -0
- package/pkg-reader/aix_web.js +11 -1
- package/pkg-reader/aix_web_bg.wasm +0 -0
- package/pkg-reader/aix_web_bg.wasm.d.ts +1 -0
- package/pkg-reader/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,8 +32,9 @@ async function fromFile(file: File) {
|
|
|
32
32
|
|
|
33
33
|
## WASM Loading
|
|
34
34
|
|
|
35
|
-
`AIX.From()` and all instance methods initialize a separate reader-only WASM.
|
|
35
|
+
By default, `AIX.From()` and all instance methods initialize a separate reader-only WASM.
|
|
36
36
|
They do not load image codecs, script minification, or source/schema checking.
|
|
37
|
+
The optional `AIX.From(data, limits, true)` check also loads the full tooling module.
|
|
37
38
|
The first pack, optimize, or source-check call lazily loads the full module;
|
|
38
39
|
concurrent tooling calls share initialization. Existing reader instances remain
|
|
39
40
|
valid after tooling loads, and tooling-only calls do not fetch reader WASM.
|
|
@@ -74,6 +75,35 @@ separate budgets. This policy applies to readers, not `AIX.optimize`.
|
|
|
74
75
|
Direct WASM consumers can call `AixReaderWasm.with_limits(data, limits)` using
|
|
75
76
|
the same fields. The existing `new AixReaderWasm(data)` constructor is unchanged.
|
|
76
77
|
|
|
78
|
+
## Open and Check
|
|
79
|
+
|
|
80
|
+
Pass `true` as the third `AIX.From` argument to run the source checker before
|
|
81
|
+
receiving the package. The second argument remains the optional read limits;
|
|
82
|
+
pass `undefined` there when no limits are needed.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { AIX, AixCheckError } from '@yodaos-pkg/aix';
|
|
86
|
+
|
|
87
|
+
async function openCheckedPackage(file: File) {
|
|
88
|
+
try {
|
|
89
|
+
return await AIX.From(file, undefined, true);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (error instanceof AixCheckError) console.table(error.diagnostics);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Warnings alone pass. Error diagnostics reject with the exported `AixCheckError`
|
|
98
|
+
(`name: 'AixCheckError'`), an `Error` subclass with the complete `CheckReport` in
|
|
99
|
+
`report` and the same diagnostic array in `diagnostics`, including warnings.
|
|
100
|
+
The check uses `checkFromSource` on the package's source files without running
|
|
101
|
+
project code. It adds work and retains extracted check inputs; read limits still
|
|
102
|
+
apply but do not bound total checker memory. Archive, extraction, loading, and
|
|
103
|
+
collection failures retain their original operation errors rather than a check
|
|
104
|
+
report. Omitting the third argument or passing `false` preserves the existing
|
|
105
|
+
reader-only behavior.
|
|
106
|
+
|
|
77
107
|
## Check Source Files
|
|
78
108
|
|
|
79
109
|
The Web SDK and npm CLI use the same complete in-memory check engine:
|
|
@@ -218,8 +248,10 @@ files and wants to invoke the low-level packer directly.
|
|
|
218
248
|
|
|
219
249
|
The main class to interact with an AIX package.
|
|
220
250
|
|
|
221
|
-
#### `static async From(data: Uint8Array | File): Promise<AIX>`
|
|
251
|
+
#### `static async From(data: Uint8Array | File, limits?: AixReadLimits, check?: boolean): Promise<AIX>`
|
|
222
252
|
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.
|
|
253
|
+
`check` defaults to `false`. Set it to `true` to check before returning and reject
|
|
254
|
+
with `AixCheckError` when errors are reported; see [Open and Check](#open-and-check).
|
|
223
255
|
```typescript
|
|
224
256
|
// From Uint8Array
|
|
225
257
|
const aix = await AIX.From(new Uint8Array(buffer));
|
|
@@ -254,6 +286,17 @@ Extracts the navigation bar title from the `app.json`.
|
|
|
254
286
|
const title = aix.getTitle();
|
|
255
287
|
```
|
|
256
288
|
|
|
289
|
+
#### `getPermissions(): string[]`
|
|
290
|
+
Returns the permission names declared in `app.json.permissions`, preserving their
|
|
291
|
+
order, duplicates, and custom names. An omitted or empty list returns `[]`.
|
|
292
|
+
Throws if `app.json` is missing, unreadable, invalid, or `permissions` is not an
|
|
293
|
+
array of strings. This reads declarations without querying authorization or
|
|
294
|
+
prompting for access.
|
|
295
|
+
```typescript
|
|
296
|
+
const permissions = aix.getPermissions();
|
|
297
|
+
// e.g. ['GEOLOCATION', 'CAMERA']
|
|
298
|
+
```
|
|
299
|
+
|
|
257
300
|
#### `getPages(): PageInfo[]`
|
|
258
301
|
Returns information about all pages defined in the package, including their paths, titles, and data schemas.
|
|
259
302
|
```typescript
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import type { CheckOptions, CheckReport } from './check/types.js';
|
|
1
|
+
import type { CheckDiagnostic, CheckOptions, CheckReport } from './check/types.js';
|
|
2
2
|
export type { CheckDiagnostic, CheckOptions, CheckProgressEvent, CheckReport, CheckResult } from './check/types.js';
|
|
3
|
+
/** A package failed the optional source check in AIX.From(). */
|
|
4
|
+
export declare class AixCheckError extends Error {
|
|
5
|
+
readonly report: CheckReport;
|
|
6
|
+
constructor(report: CheckReport);
|
|
7
|
+
/** All check diagnostics, including warnings. */
|
|
8
|
+
get diagnostics(): CheckDiagnostic[];
|
|
9
|
+
}
|
|
3
10
|
export interface AixInputFile {
|
|
4
11
|
path: string;
|
|
5
12
|
data: Uint8Array;
|
|
@@ -132,8 +139,10 @@ export declare class AIX {
|
|
|
132
139
|
* Values must be non-negative safe integers. Without limits, retains the
|
|
133
140
|
* historical unlimited policy. Input bytes and caller-retained copies are
|
|
134
141
|
* outside these budgets.
|
|
142
|
+
* @param check Run the source checker before returning; defaults to false.
|
|
143
|
+
* Error diagnostics reject with AixCheckError; warnings alone are accepted.
|
|
135
144
|
*/
|
|
136
|
-
static From(data: Uint8Array | File, limits?: AixReadLimits): Promise<AIX>;
|
|
145
|
+
static From(data: Uint8Array | File, limits?: AixReadLimits, check?: boolean): Promise<AIX>;
|
|
137
146
|
static pack(files: AixInputFile[], options?: PackOptions): Promise<PackResult>;
|
|
138
147
|
/**
|
|
139
148
|
* Packs an in-memory application source tree.
|
|
@@ -165,6 +174,12 @@ export declare class AIX {
|
|
|
165
174
|
* Get the title from app.json.
|
|
166
175
|
*/
|
|
167
176
|
getTitle(): string | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Get permission names declared in app.json, in declaration order.
|
|
179
|
+
* Missing declarations return []; invalid configuration throws.
|
|
180
|
+
* This does not query runtime or device authorization.
|
|
181
|
+
*/
|
|
182
|
+
getPermissions(): string[];
|
|
168
183
|
/**
|
|
169
184
|
* Get all pages from app.json and pages/*.json.
|
|
170
185
|
*/
|
package/index.js
CHANGED
|
@@ -18,6 +18,19 @@ function loadTooling() {
|
|
|
18
18
|
throw error;
|
|
19
19
|
}));
|
|
20
20
|
}
|
|
21
|
+
/** A package failed the optional source check in AIX.From(). */
|
|
22
|
+
export class AixCheckError extends Error {
|
|
23
|
+
constructor(report) {
|
|
24
|
+
const count = report.diagnostics.filter(diagnostic => diagnostic.severity === 'error').length;
|
|
25
|
+
super(`AIX check failed with ${count} ${count === 1 ? 'error' : 'errors'}`);
|
|
26
|
+
this.report = report;
|
|
27
|
+
this.name = 'AixCheckError';
|
|
28
|
+
}
|
|
29
|
+
/** All check diagnostics, including warnings. */
|
|
30
|
+
get diagnostics() {
|
|
31
|
+
return this.report.diagnostics;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
21
34
|
function generateBuildId() {
|
|
22
35
|
const cryptoApi = globalThis.crypto;
|
|
23
36
|
if (typeof cryptoApi?.randomUUID === 'function') {
|
|
@@ -68,8 +81,10 @@ export class AIX {
|
|
|
68
81
|
* Values must be non-negative safe integers. Without limits, retains the
|
|
69
82
|
* historical unlimited policy. Input bytes and caller-retained copies are
|
|
70
83
|
* outside these budgets.
|
|
84
|
+
* @param check Run the source checker before returning; defaults to false.
|
|
85
|
+
* Error diagnostics reject with AixCheckError; warnings alone are accepted.
|
|
71
86
|
*/
|
|
72
|
-
static async From(data, limits) {
|
|
87
|
+
static async From(data, limits, check = false) {
|
|
73
88
|
await initializeReader();
|
|
74
89
|
let buffer;
|
|
75
90
|
if (data instanceof Uint8Array) {
|
|
@@ -82,7 +97,23 @@ export class AIX {
|
|
|
82
97
|
const reader = limits === undefined
|
|
83
98
|
? new AixReaderWasm(buffer)
|
|
84
99
|
: AixReaderWasm.with_limits(buffer, limits);
|
|
85
|
-
|
|
100
|
+
try {
|
|
101
|
+
if (check) {
|
|
102
|
+
const files = reader.list()
|
|
103
|
+
.filter(entry => !entry.name.endsWith('/') && entry.name !== 'VERSION'
|
|
104
|
+
&& !entry.name.startsWith('META-INF/aix/'))
|
|
105
|
+
.map(entry => ({ path: entry.name, data: reader.read_file(entry.name) }));
|
|
106
|
+
const report = await AIX.checkFromSource(files);
|
|
107
|
+
if (report.diagnostics.some(diagnostic => diagnostic.severity === 'error')) {
|
|
108
|
+
throw new AixCheckError(report);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return new AIX(reader);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
reader.free();
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
86
117
|
}
|
|
87
118
|
static async pack(files, options) {
|
|
88
119
|
const tooling = await loadTooling();
|
|
@@ -154,6 +185,14 @@ export class AIX {
|
|
|
154
185
|
getTitle() {
|
|
155
186
|
return this.reader.get_title();
|
|
156
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Get permission names declared in app.json, in declaration order.
|
|
190
|
+
* Missing declarations return []; invalid configuration throws.
|
|
191
|
+
* This does not query runtime or device authorization.
|
|
192
|
+
*/
|
|
193
|
+
getPermissions() {
|
|
194
|
+
return this.reader.get_permissions();
|
|
195
|
+
}
|
|
157
196
|
/**
|
|
158
197
|
* Get all pages from app.json and pages/*.json.
|
|
159
198
|
*/
|
package/jsr.json
CHANGED
package/package.json
CHANGED
package/pkg/README.md
CHANGED
|
@@ -32,8 +32,9 @@ async function fromFile(file: File) {
|
|
|
32
32
|
|
|
33
33
|
## WASM Loading
|
|
34
34
|
|
|
35
|
-
`AIX.From()` and all instance methods initialize a separate reader-only WASM.
|
|
35
|
+
By default, `AIX.From()` and all instance methods initialize a separate reader-only WASM.
|
|
36
36
|
They do not load image codecs, script minification, or source/schema checking.
|
|
37
|
+
The optional `AIX.From(data, limits, true)` check also loads the full tooling module.
|
|
37
38
|
The first pack, optimize, or source-check call lazily loads the full module;
|
|
38
39
|
concurrent tooling calls share initialization. Existing reader instances remain
|
|
39
40
|
valid after tooling loads, and tooling-only calls do not fetch reader WASM.
|
|
@@ -74,6 +75,35 @@ separate budgets. This policy applies to readers, not `AIX.optimize`.
|
|
|
74
75
|
Direct WASM consumers can call `AixReaderWasm.with_limits(data, limits)` using
|
|
75
76
|
the same fields. The existing `new AixReaderWasm(data)` constructor is unchanged.
|
|
76
77
|
|
|
78
|
+
## Open and Check
|
|
79
|
+
|
|
80
|
+
Pass `true` as the third `AIX.From` argument to run the source checker before
|
|
81
|
+
receiving the package. The second argument remains the optional read limits;
|
|
82
|
+
pass `undefined` there when no limits are needed.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { AIX, AixCheckError } from '@yodaos-pkg/aix';
|
|
86
|
+
|
|
87
|
+
async function openCheckedPackage(file: File) {
|
|
88
|
+
try {
|
|
89
|
+
return await AIX.From(file, undefined, true);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (error instanceof AixCheckError) console.table(error.diagnostics);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Warnings alone pass. Error diagnostics reject with the exported `AixCheckError`
|
|
98
|
+
(`name: 'AixCheckError'`), an `Error` subclass with the complete `CheckReport` in
|
|
99
|
+
`report` and the same diagnostic array in `diagnostics`, including warnings.
|
|
100
|
+
The check uses `checkFromSource` on the package's source files without running
|
|
101
|
+
project code. It adds work and retains extracted check inputs; read limits still
|
|
102
|
+
apply but do not bound total checker memory. Archive, extraction, loading, and
|
|
103
|
+
collection failures retain their original operation errors rather than a check
|
|
104
|
+
report. Omitting the third argument or passing `false` preserves the existing
|
|
105
|
+
reader-only behavior.
|
|
106
|
+
|
|
77
107
|
## Check Source Files
|
|
78
108
|
|
|
79
109
|
The Web SDK and npm CLI use the same complete in-memory check engine:
|
|
@@ -218,8 +248,10 @@ files and wants to invoke the low-level packer directly.
|
|
|
218
248
|
|
|
219
249
|
The main class to interact with an AIX package.
|
|
220
250
|
|
|
221
|
-
#### `static async From(data: Uint8Array | File): Promise<AIX>`
|
|
251
|
+
#### `static async From(data: Uint8Array | File, limits?: AixReadLimits, check?: boolean): Promise<AIX>`
|
|
222
252
|
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.
|
|
253
|
+
`check` defaults to `false`. Set it to `true` to check before returning and reject
|
|
254
|
+
with `AixCheckError` when errors are reported; see [Open and Check](#open-and-check).
|
|
223
255
|
```typescript
|
|
224
256
|
// From Uint8Array
|
|
225
257
|
const aix = await AIX.From(new Uint8Array(buffer));
|
|
@@ -254,6 +286,17 @@ Extracts the navigation bar title from the `app.json`.
|
|
|
254
286
|
const title = aix.getTitle();
|
|
255
287
|
```
|
|
256
288
|
|
|
289
|
+
#### `getPermissions(): string[]`
|
|
290
|
+
Returns the permission names declared in `app.json.permissions`, preserving their
|
|
291
|
+
order, duplicates, and custom names. An omitted or empty list returns `[]`.
|
|
292
|
+
Throws if `app.json` is missing, unreadable, invalid, or `permissions` is not an
|
|
293
|
+
array of strings. This reads declarations without querying authorization or
|
|
294
|
+
prompting for access.
|
|
295
|
+
```typescript
|
|
296
|
+
const permissions = aix.getPermissions();
|
|
297
|
+
// e.g. ['GEOLOCATION', 'CAMERA']
|
|
298
|
+
```
|
|
299
|
+
|
|
257
300
|
#### `getPages(): PageInfo[]`
|
|
258
301
|
Returns information about all pages defined in the package, including their paths, titles, and data schemas.
|
|
259
302
|
```typescript
|
package/pkg/aix_web.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export class AixReaderWasm {
|
|
|
15
15
|
[Symbol.dispose](): void;
|
|
16
16
|
get_agent_id(): string | undefined;
|
|
17
17
|
get_pages(): any;
|
|
18
|
+
get_permissions(): any;
|
|
18
19
|
get_title(): string | undefined;
|
|
19
20
|
get_tools(): any;
|
|
20
21
|
get_version(): string | undefined;
|
|
@@ -89,6 +90,7 @@ export interface InitOutput {
|
|
|
89
90
|
readonly __wbg_aixreaderwasm_free: (a: number, b: number) => void;
|
|
90
91
|
readonly aixreaderwasm_get_agent_id: (a: number) => [number, number, number, number];
|
|
91
92
|
readonly aixreaderwasm_get_pages: (a: number) => [number, number, number];
|
|
93
|
+
readonly aixreaderwasm_get_permissions: (a: number) => [number, number, number];
|
|
92
94
|
readonly aixreaderwasm_get_title: (a: number) => [number, number];
|
|
93
95
|
readonly aixreaderwasm_get_tools: (a: number) => [number, number, number];
|
|
94
96
|
readonly aixreaderwasm_get_version: (a: number) => [number, number];
|
package/pkg/aix_web.js
CHANGED
|
@@ -89,6 +89,16 @@ export class AixReaderWasm {
|
|
|
89
89
|
}
|
|
90
90
|
return takeFromExternrefTable0(ret[0]);
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* @returns {any}
|
|
94
|
+
*/
|
|
95
|
+
get_permissions() {
|
|
96
|
+
const ret = wasm.aixreaderwasm_get_permissions(this.__wbg_ptr);
|
|
97
|
+
if (ret[2]) {
|
|
98
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
99
|
+
}
|
|
100
|
+
return takeFromExternrefTable0(ret[0]);
|
|
101
|
+
}
|
|
92
102
|
/**
|
|
93
103
|
* @returns {string | undefined}
|
|
94
104
|
*/
|
|
@@ -596,7 +606,7 @@ function __wbg_get_imports() {
|
|
|
596
606
|
const ret = arg0.value;
|
|
597
607
|
return ret;
|
|
598
608
|
},
|
|
599
|
-
|
|
609
|
+
__wbg_warn_39ca83586ceb77e8: function(arg0, arg1) {
|
|
600
610
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
601
611
|
},
|
|
602
612
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
package/pkg/aix_web_bg.wasm
CHANGED
|
Binary file
|
package/pkg/aix_web_bg.wasm.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export const prepare_aix_check: (a: any) => [number, number, number];
|
|
|
19
19
|
export const __wbg_aixreaderwasm_free: (a: number, b: number) => void;
|
|
20
20
|
export const aixreaderwasm_get_agent_id: (a: number) => [number, number, number, number];
|
|
21
21
|
export const aixreaderwasm_get_pages: (a: number) => [number, number, number];
|
|
22
|
+
export const aixreaderwasm_get_permissions: (a: number) => [number, number, number];
|
|
22
23
|
export const aixreaderwasm_get_title: (a: number) => [number, number];
|
|
23
24
|
export const aixreaderwasm_get_tools: (a: number) => [number, number, number];
|
|
24
25
|
export const aixreaderwasm_get_version: (a: number) => [number, number];
|
package/pkg/package.json
CHANGED
package/pkg-reader/README.md
CHANGED
|
@@ -32,8 +32,9 @@ async function fromFile(file: File) {
|
|
|
32
32
|
|
|
33
33
|
## WASM Loading
|
|
34
34
|
|
|
35
|
-
`AIX.From()` and all instance methods initialize a separate reader-only WASM.
|
|
35
|
+
By default, `AIX.From()` and all instance methods initialize a separate reader-only WASM.
|
|
36
36
|
They do not load image codecs, script minification, or source/schema checking.
|
|
37
|
+
The optional `AIX.From(data, limits, true)` check also loads the full tooling module.
|
|
37
38
|
The first pack, optimize, or source-check call lazily loads the full module;
|
|
38
39
|
concurrent tooling calls share initialization. Existing reader instances remain
|
|
39
40
|
valid after tooling loads, and tooling-only calls do not fetch reader WASM.
|
|
@@ -74,6 +75,35 @@ separate budgets. This policy applies to readers, not `AIX.optimize`.
|
|
|
74
75
|
Direct WASM consumers can call `AixReaderWasm.with_limits(data, limits)` using
|
|
75
76
|
the same fields. The existing `new AixReaderWasm(data)` constructor is unchanged.
|
|
76
77
|
|
|
78
|
+
## Open and Check
|
|
79
|
+
|
|
80
|
+
Pass `true` as the third `AIX.From` argument to run the source checker before
|
|
81
|
+
receiving the package. The second argument remains the optional read limits;
|
|
82
|
+
pass `undefined` there when no limits are needed.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { AIX, AixCheckError } from '@yodaos-pkg/aix';
|
|
86
|
+
|
|
87
|
+
async function openCheckedPackage(file: File) {
|
|
88
|
+
try {
|
|
89
|
+
return await AIX.From(file, undefined, true);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (error instanceof AixCheckError) console.table(error.diagnostics);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Warnings alone pass. Error diagnostics reject with the exported `AixCheckError`
|
|
98
|
+
(`name: 'AixCheckError'`), an `Error` subclass with the complete `CheckReport` in
|
|
99
|
+
`report` and the same diagnostic array in `diagnostics`, including warnings.
|
|
100
|
+
The check uses `checkFromSource` on the package's source files without running
|
|
101
|
+
project code. It adds work and retains extracted check inputs; read limits still
|
|
102
|
+
apply but do not bound total checker memory. Archive, extraction, loading, and
|
|
103
|
+
collection failures retain their original operation errors rather than a check
|
|
104
|
+
report. Omitting the third argument or passing `false` preserves the existing
|
|
105
|
+
reader-only behavior.
|
|
106
|
+
|
|
77
107
|
## Check Source Files
|
|
78
108
|
|
|
79
109
|
The Web SDK and npm CLI use the same complete in-memory check engine:
|
|
@@ -218,8 +248,10 @@ files and wants to invoke the low-level packer directly.
|
|
|
218
248
|
|
|
219
249
|
The main class to interact with an AIX package.
|
|
220
250
|
|
|
221
|
-
#### `static async From(data: Uint8Array | File): Promise<AIX>`
|
|
251
|
+
#### `static async From(data: Uint8Array | File, limits?: AixReadLimits, check?: boolean): Promise<AIX>`
|
|
222
252
|
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.
|
|
253
|
+
`check` defaults to `false`. Set it to `true` to check before returning and reject
|
|
254
|
+
with `AixCheckError` when errors are reported; see [Open and Check](#open-and-check).
|
|
223
255
|
```typescript
|
|
224
256
|
// From Uint8Array
|
|
225
257
|
const aix = await AIX.From(new Uint8Array(buffer));
|
|
@@ -254,6 +286,17 @@ Extracts the navigation bar title from the `app.json`.
|
|
|
254
286
|
const title = aix.getTitle();
|
|
255
287
|
```
|
|
256
288
|
|
|
289
|
+
#### `getPermissions(): string[]`
|
|
290
|
+
Returns the permission names declared in `app.json.permissions`, preserving their
|
|
291
|
+
order, duplicates, and custom names. An omitted or empty list returns `[]`.
|
|
292
|
+
Throws if `app.json` is missing, unreadable, invalid, or `permissions` is not an
|
|
293
|
+
array of strings. This reads declarations without querying authorization or
|
|
294
|
+
prompting for access.
|
|
295
|
+
```typescript
|
|
296
|
+
const permissions = aix.getPermissions();
|
|
297
|
+
// e.g. ['GEOLOCATION', 'CAMERA']
|
|
298
|
+
```
|
|
299
|
+
|
|
257
300
|
#### `getPages(): PageInfo[]`
|
|
258
301
|
Returns information about all pages defined in the package, including their paths, titles, and data schemas.
|
|
259
302
|
```typescript
|
package/pkg-reader/aix_web.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export class AixReaderWasm {
|
|
|
6
6
|
[Symbol.dispose](): void;
|
|
7
7
|
get_agent_id(): string | undefined;
|
|
8
8
|
get_pages(): any;
|
|
9
|
+
get_permissions(): any;
|
|
9
10
|
get_title(): string | undefined;
|
|
10
11
|
get_tools(): any;
|
|
11
12
|
get_version(): string | undefined;
|
|
@@ -34,6 +35,7 @@ export interface InitOutput {
|
|
|
34
35
|
readonly __wbg_aixreaderwasm_free: (a: number, b: number) => void;
|
|
35
36
|
readonly aixreaderwasm_get_agent_id: (a: number) => [number, number, number, number];
|
|
36
37
|
readonly aixreaderwasm_get_pages: (a: number) => [number, number, number];
|
|
38
|
+
readonly aixreaderwasm_get_permissions: (a: number) => [number, number, number];
|
|
37
39
|
readonly aixreaderwasm_get_title: (a: number) => [number, number];
|
|
38
40
|
readonly aixreaderwasm_get_tools: (a: number) => [number, number, number];
|
|
39
41
|
readonly aixreaderwasm_get_version: (a: number) => [number, number];
|
package/pkg-reader/aix_web.js
CHANGED
|
@@ -42,6 +42,16 @@ export class AixReaderWasm {
|
|
|
42
42
|
}
|
|
43
43
|
return takeFromExternrefTable0(ret[0]);
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* @returns {any}
|
|
47
|
+
*/
|
|
48
|
+
get_permissions() {
|
|
49
|
+
const ret = wasm.aixreaderwasm_get_permissions(this.__wbg_ptr);
|
|
50
|
+
if (ret[2]) {
|
|
51
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
52
|
+
}
|
|
53
|
+
return takeFromExternrefTable0(ret[0]);
|
|
54
|
+
}
|
|
45
55
|
/**
|
|
46
56
|
* @returns {string | undefined}
|
|
47
57
|
*/
|
|
@@ -333,7 +343,7 @@ function __wbg_get_imports() {
|
|
|
333
343
|
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
334
344
|
arg0[arg1 >>> 0] = arg2;
|
|
335
345
|
},
|
|
336
|
-
|
|
346
|
+
__wbg_warn_39ca83586ceb77e8: function(arg0, arg1) {
|
|
337
347
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
338
348
|
},
|
|
339
349
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
Binary file
|
|
@@ -4,6 +4,7 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const __wbg_aixreaderwasm_free: (a: number, b: number) => void;
|
|
5
5
|
export const aixreaderwasm_get_agent_id: (a: number) => [number, number, number, number];
|
|
6
6
|
export const aixreaderwasm_get_pages: (a: number) => [number, number, number];
|
|
7
|
+
export const aixreaderwasm_get_permissions: (a: number) => [number, number, number];
|
|
7
8
|
export const aixreaderwasm_get_title: (a: number) => [number, number];
|
|
8
9
|
export const aixreaderwasm_get_tools: (a: number) => [number, number, number];
|
|
9
10
|
export const aixreaderwasm_get_version: (a: number) => [number, number];
|