Skip to content

feat: sync JS client with C++ backend#262

Open
AhmedOsman101 wants to merge 1 commit into
neutralinojs:mainfrom
AhmedOsman101:main
Open

feat: sync JS client with C++ backend#262
AhmedOsman101 wants to merge 1 commit into
neutralinojs:mainfrom
AhmedOsman101:main

Conversation

@AhmedOsman101

Copy link
Copy Markdown

Sync JS Client with C++ Backend

Summary

All 63 C++ API methods, 46 error codes, and 21 injected globals are now declared in the JS client. This PR ships 3 missing functions, 8 type/param fixes, 23 new error codes, and 6 missing Window globals — closing every gap identified in the C++->JS sync audit.

Fixes storage.setData null-crash bug where C++ throws on "data": null (now omits the field).

Changes

Missing Native Functions (3)

  • app.getProcessId()src/api/app.ts
  • window.setBadge(count)src/api/window.ts
  • os.getLocale()src/api/os.ts + LocaleInfo type (src/types/api/os.ts)

Parameter / Return Type Fixes (6)

File Change
src/types/api/os.ts ExecCommandOptions.envs, SpawnedProcessOptions.envs
src/types/api/os.ts KnownPath — added 'desktop' | 'home'
src/types/enums.ts LoggerType — added DEBUG
src/types/api/computer.ts NetworkInterfaceInfo — values are NetworkInterfaceAddress[] (was singular)
src/types/api/clipboard.ts ClipboardImage — added alphaShift, alphaMask

Bug Fix

  • src/api/storage.tssetData no longer sends data: null when value is null/undefined, avoiding C++ nlohmann crash. Uses conditional payload.

Error Codes — 23 new, 46 total (src/types/api/protocol.ts)

Added all codes from C++ errors.h:

  • Filesystem (10 new): NE_FS_REMVERR, NE_FS_NOTADIR, NE_FS_COPYERR, NE_FS_MOVEERR, NE_FS_FILOPER, NE_FS_UNLTOUP, NE_FS_UNLTFOP, NE_FS_UNLCWAT, NE_FS_NOWATID, NE_FS_UNLSTPR, NE_FS_ACSFAIL, NE_FS_CHMDERR, NE_FS_CHWNERR
  • OS (4 new): NE_OS_UNLTOUP, NE_OS_INVNOTA, NE_OS_TRAYIER, NE_OS_UNLTRAS
  • Storage (3 new): NE_ST_NOSTKEX, NE_ST_STKEYRE, NE_ST_NOSTDIR
  • Computer (4 new): NE_CO_UNLTOSC, NE_CO_UNLTOMG, NE_CO_UNLTONI, NE_CO_UNLTOSK
  • Window (1 new): NE_WI_UNBSWSR
  • Resources (5 new): NE_RS_TREEGER, NE_RS_UNBLDRE, NE_RS_NOPATHE, NE_RS_FILEXTF, NE_RS_DIREXTF
  • Server (4 new): NE_SR_UNBSEND, NE_SR_UNBPARS, NE_SR_MPINUSE, NE_SR_NOMTPTH
  • Config (4 new): NE_CF_UNBLDCF, NE_CF_UNBPRCF, NE_CF_UNSUPMD, NE_CF_UNBLWCF

Also organized all codes under named section comments and removed a duplicate NE_ST_STKEYWE.

Missing Window Globals (6)

Added to declare global { interface Window { ... } } in src/index.ts:

  • NL_COMMIT — server commit hash
  • NL_CONFIGFILE — config file path
  • NL_COMPDATA — compilation data
  • NL_LOCALE — system locale
  • NL_SINJECTED — server-side injection flag
  • NL_WSAVSTLOADED — window saved-state loaded flag

- Add missing process, locale, and window badge methods
- Add `envs` field to `ExecCommandOptions` and `SpawnedProcessOptions`
- Add 23 missing error codes + organize with section comments
- Add 6 missing Window globals
- Fix `NetworkInterfaceInfo` value type to array
- Fix `storage.setData` null crash: omit data field when null/undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant