@willwade/aac-processors 0.0.8 → 0.0.9

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 CHANGED
@@ -58,6 +58,37 @@ npm run build
58
58
 
59
59
  ---
60
60
 
61
+ ## Using with Electron
62
+
63
+ `better-sqlite3` is a native module and must be rebuilt against Electron's Node.js runtime. If you see a `NODE_MODULE_VERSION` mismatch error, rebuild after installing dependencies:
64
+
65
+ ```bash
66
+ npm install
67
+ npx electron-rebuild
68
+ ```
69
+
70
+ Or add a postinstall hook so the rebuild happens automatically:
71
+
72
+ ```json
73
+ {
74
+ "scripts": {
75
+ "postinstall": "electron-builder install-app-deps"
76
+ }
77
+ }
78
+ ```
79
+
80
+ This step is only required for Electron apps; regular Node.js consumers do not need it.
81
+
82
+ ---
83
+
84
+ ## Windows Data Paths
85
+
86
+ - **Grid 3 history**: `C:\Users\Public\Documents\Smartbox\Grid 3\Users\{username}\{langCode}\Phrases\history.sqlite`
87
+ - **Grid 3 vocabularies**: `C:\Users\Public\Documents\Smartbox\Grid 3\Users\{username}\Grid Sets\`
88
+ - **Snap vocabularies**: `C:\Users\{username}\AppData\Roaming\Tobii Dynavox\Snap Scene\Users\{userId}\` (`.sps`/`.spb`)
89
+
90
+ ---
91
+
61
92
  ## 🔧 Quick Start
62
93
 
63
94
  ### Basic Usage (TypeScript/ES6)
@@ -79,6 +79,8 @@ export declare function getCommonDocumentsPath(): string;
79
79
  * Find all Grid3 user data paths
80
80
  * Searches for users and language codes in the Grid3 directory structure
81
81
  * C:\Users\Public\Documents\Smartbox\Grid 3\Users\{UserName}\{langCode}\Phrases\history.sqlite
82
+ * Grid set/vocabulary archives live alongside users at:
83
+ * C:\Users\Public\Documents\Smartbox\Grid 3\Users\{UserName}\Grid Sets\
82
84
  * @returns Array of Grid3 user path information
83
85
  */
84
86
  export declare function findGrid3UserPaths(): Grid3UserPath[];
@@ -197,6 +197,8 @@ function getCommonDocumentsPath() {
197
197
  * Find all Grid3 user data paths
198
198
  * Searches for users and language codes in the Grid3 directory structure
199
199
  * C:\Users\Public\Documents\Smartbox\Grid 3\Users\{UserName}\{langCode}\Phrases\history.sqlite
200
+ * Grid set/vocabulary archives live alongside users at:
201
+ * C:\Users\Public\Documents\Smartbox\Grid 3\Users\{UserName}\Grid Sets\
200
202
  * @returns Array of Grid3 user path information
201
203
  */
202
204
  function findGrid3UserPaths() {
@@ -307,6 +309,8 @@ function findGrid3Vocabularies(userName) {
307
309
  * @returns Path to history.sqlite or null if not found
308
310
  */
309
311
  function findGrid3UserHistory(userName, langCode) {
312
+ if (!userName)
313
+ return null;
310
314
  const normalizedUser = userName.toLowerCase();
311
315
  const normalizedLang = langCode?.toLowerCase();
312
316
  const match = findGrid3UserPaths().find((u) => u.userName.toLowerCase() === normalizedUser &&
@@ -363,13 +367,26 @@ function readGrid3History(historyDbPath) {
363
367
  const events = new Map();
364
368
  for (const row of rows) {
365
369
  const phraseId = row.PhraseId;
366
- const contentText = parseGrid3ContentXml(String(row.ContentXml ?? row.TextValue ?? ''));
370
+ const rawContentSource = [row.ContentXml, row.TextValue].find((candidate) => {
371
+ if (candidate === null || candidate === undefined)
372
+ return false;
373
+ const asString = String(candidate);
374
+ return asString.trim().length > 0;
375
+ });
376
+ if (rawContentSource === undefined) {
377
+ continue; // Skip history rows with no usable text content
378
+ }
379
+ const rawContentText = String(rawContentSource);
380
+ const contentText = parseGrid3ContentXml(rawContentText);
381
+ const rawXml = typeof row.ContentXml === 'string' && row.ContentXml.trim().length > 0
382
+ ? row.ContentXml
383
+ : undefined;
367
384
  const entry = events.get(phraseId) ??
368
385
  {
369
386
  id: `grid:${phraseId}`,
370
387
  content: contentText,
371
388
  occurrences: [],
372
- rawXml: row.ContentXml,
389
+ rawXml,
373
390
  };
374
391
  entry.occurrences.push({
375
392
  timestamp: (0, dotnetTicks_1.dotNetTicksToDate)(BigInt(row.TickValue ?? 0)),
@@ -56,6 +56,8 @@ export declare function findSnapPackages(packageNamePattern?: string): SnapPacka
56
56
  export declare function findSnapPackagePath(packageNamePattern?: string): string | null;
57
57
  /**
58
58
  * Find Snap user directories and their vocab files (.sps/.spb)
59
+ * Typical path:
60
+ * C:\Users\{username}\AppData\Roaming\Tobii Dynavox\Snap Scene\Users\{userId}\
59
61
  * @param packageNamePattern Optional package filter (default TobiiDynavox)
60
62
  * @returns Array of user info with vocab paths
61
63
  */
@@ -155,6 +155,8 @@ function findSnapPackagePath(packageNamePattern = 'TobiiDynavox') {
155
155
  }
156
156
  /**
157
157
  * Find Snap user directories and their vocab files (.sps/.spb)
158
+ * Typical path:
159
+ * C:\Users\{username}\AppData\Roaming\Tobii Dynavox\Snap Scene\Users\{userId}\
158
160
  * @param packageNamePattern Optional package filter (default TobiiDynavox)
159
161
  * @returns Array of user info with vocab paths
160
162
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willwade/aac-processors",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "A comprehensive TypeScript library for processing AAC (Augmentative and Alternative Communication) file formats with translation support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",