@moddable/typings 9.0.1 → 9.5.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.
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "captiveportal" {
22
+ export type CaptivePortalPhase = "initializing" | "ready" | "connected" | "waiting" |
23
+ "connecting" | "provisioned" | "failed";
24
+
25
+ export interface CaptivePortalAccess {
26
+ SSID: string;
27
+ password?: string;
28
+ }
29
+
30
+ export interface CaptivePortalCredentials {
31
+ SSID: string;
32
+ password?: string;
33
+ channel?: number;
34
+ secure?: boolean;
35
+ }
36
+
37
+ export interface CaptivePortalNetwork {
38
+ SSID: string;
39
+ RSSI: number;
40
+ channel: number;
41
+ security?: string;
42
+ }
43
+
44
+ export interface CaptivePortalPage {
45
+ content: string | ArrayBuffer | HostBuffer;
46
+ mimeType: string;
47
+ }
48
+
49
+ export interface CaptivePortalOptions {
50
+ onPage: (this: void, path: string) => CaptivePortalPage | undefined;
51
+
52
+ onStatus?: (this: void, phase: CaptivePortalPhase, detail?: CaptivePortalAccess | CaptivePortalCredentials) => void;
53
+ onInfo?: (this: void, msg: any) => void;
54
+ onClose?: (this: void) => void;
55
+ onError?: (this: void, error: Error) => void;
56
+
57
+ SSID?: string;
58
+ password?: string;
59
+ channel?: number;
60
+ }
61
+
62
+ class CaptivePortal {
63
+ constructor(options: CaptivePortalOptions);
64
+
65
+ close(): void;
66
+
67
+ readonly SSID: string | undefined;
68
+ }
69
+
70
+ export default CaptivePortal;
71
+ }
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "data/location/nmea" {
22
+ interface NMEATalker {
23
+ readonly GP: "GPS";
24
+ readonly GN: "GNSS";
25
+ readonly GL: "GLONASS";
26
+ readonly GA: "Galileo";
27
+ readonly GB: "BeiDou";
28
+ readonly BD: "BeiDou";
29
+ readonly QZ: "QZSS";
30
+ readonly P: "Proprietary";
31
+ readonly [id: string]: string | undefined;
32
+ }
33
+
34
+ interface NMEASatellite {
35
+ prn: number;
36
+ elevation: number | null;
37
+ azimuth: number | null;
38
+ snr: number | null;
39
+ }
40
+
41
+ interface NMEASentence {
42
+ type: string;
43
+ talker: string;
44
+ system: string;
45
+ raw: string;
46
+ time?: string | null;
47
+ date?: string | null;
48
+ latitude?: number | null;
49
+ longitude?: number | null;
50
+ altitude?: number | null;
51
+ geoidSeparation?: number | null;
52
+ quality?: number;
53
+ satellites?: number | NMEASatellite[];
54
+ hdop?: number | null;
55
+ pdop?: number | null;
56
+ vdop?: number | null;
57
+ speed?: number | null;
58
+ course?: number | null;
59
+ status?: string | null;
60
+ mode?: string | null;
61
+ fix?: boolean;
62
+ fixType?: number;
63
+ satellitesUsed?: number[];
64
+ totalMessages?: number;
65
+ messageNumber?: number;
66
+ satellitesInView?: number;
67
+ day?: number | null;
68
+ month?: number | null;
69
+ year?: number | null;
70
+ fields?: string[];
71
+ [key: string]: unknown;
72
+ }
73
+
74
+ interface NMEALocationUpdate {
75
+ latitude?: number;
76
+ longitude?: number;
77
+ altitude?: number;
78
+ accuracy?: number;
79
+ heading?: number;
80
+ speed?: number;
81
+ fix?: boolean;
82
+ }
83
+
84
+ class NMEA {
85
+ constructor(onParsed?: (parsed: NMEASentence) => void);
86
+ push(data: number | ArrayBuffer | ArrayBufferView): NMEASentence | undefined;
87
+
88
+ static readonly Talker: NMEATalker;
89
+ static readonly identification: {
90
+ readonly model: string;
91
+ readonly classification: string;
92
+ readonly description: string;
93
+ };
94
+ static parse(sentence: string | ArrayBuffer | ArrayBufferView): NMEASentence | null;
95
+ static validateChecksum(sentence: string | ArrayBuffer | ArrayBufferView): Uint8Array | null;
96
+ static toDecimalDegrees(value: string, hemi: string): number | null;
97
+ static checksum(payload: string): string;
98
+ static format(payload: string): string;
99
+ static location(parsed: NMEASentence | null | undefined): NMEALocationUpdate | undefined;
100
+ }
101
+
102
+ export { NMEA as default, NMEA };
103
+ }
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "data/location/ubx" {
22
+ interface UBXMessage {
23
+ type: string;
24
+ class?: number;
25
+ id?: number;
26
+ payloadLength?: number;
27
+ latitude?: number;
28
+ longitude?: number;
29
+ altitude?: number;
30
+ accuracy?: number;
31
+ altitudeAccuracy?: number;
32
+ speed?: number;
33
+ course?: number;
34
+ pdop?: number;
35
+ satellites?: number;
36
+ fixType?: number;
37
+ fix?: boolean;
38
+ status?: string;
39
+ quality?: number;
40
+ [key: string]: unknown;
41
+ }
42
+
43
+ interface UBXLocationUpdate {
44
+ latitude?: number;
45
+ longitude?: number;
46
+ altitude?: number;
47
+ accuracy?: number;
48
+ altitudeAccuracy?: number;
49
+ heading?: number;
50
+ speed?: number;
51
+ fix: boolean;
52
+ }
53
+
54
+ class UBX {
55
+ constructor(onParsed?: (parsed: UBXMessage) => void);
56
+ push(data: number | ArrayBuffer | ArrayBufferView): UBXMessage | undefined;
57
+
58
+ static readonly SYNC1: 0xb5;
59
+ static readonly SYNC2: 0x62;
60
+ static readonly CLASS_NAV: 0x01;
61
+ static readonly ID_NAV_PVT: 0x07;
62
+ static readonly CLASS_CFG: 0x06;
63
+ static readonly ID_CFG_MSG: 0x01;
64
+ static readonly identification: {
65
+ readonly model: string;
66
+ readonly classification: string;
67
+ readonly description: string;
68
+ };
69
+ static checksum(bytes: Uint8Array, offset: number, length: number): [number, number];
70
+ static format(msgClass: number, msgId: number, payload?: ArrayBuffer | ArrayBufferView): ArrayBuffer;
71
+ static parse(frame: ArrayBuffer | ArrayBufferView): UBXMessage | null;
72
+ static parseNAVPVT(view: DataView): UBXMessage | null;
73
+ static location(parsed: UBXMessage | null | undefined): UBXLocationUpdate | undefined;
74
+ static setup(): ArrayBuffer[];
75
+ }
76
+
77
+ export { UBX as default, UBX };
78
+ }
@@ -0,0 +1,102 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "embedded:sensor/Barometer-Humidity-Temperature/BME280" {
22
+ interface BME280IO {
23
+ write(buffer: ArrayBuffer | ArrayBufferView, stop?: boolean): void;
24
+ read(buffer: ArrayBuffer | ArrayBufferView): void;
25
+ close(): void;
26
+ }
27
+
28
+ interface BME280SensorOptions {
29
+ io: new (options: object) => BME280IO;
30
+ address?: number;
31
+ hz?: number;
32
+ data?: number | string;
33
+ clock?: number | string;
34
+ [key: string]: unknown;
35
+ }
36
+
37
+ interface BME280Options {
38
+ sensor: BME280SensorOptions;
39
+ target?: unknown;
40
+ }
41
+
42
+ interface BME280Configuration {
43
+ mode?: number;
44
+ temperatureSampling?: number;
45
+ pressureSampling?: number;
46
+ humiditySampling?: number;
47
+ filter?: number;
48
+ standbyDuration?: number;
49
+ }
50
+
51
+ interface BME280Sample {
52
+ thermometer: { temperature: number };
53
+ hygrometer: { humidity?: number };
54
+ barometer: { pressure: number };
55
+ }
56
+
57
+ interface BME280ConfigConstants {
58
+ readonly Sampling: {
59
+ readonly SKIPPED: 0x00;
60
+ readonly X1: 0x01;
61
+ readonly X2: 0x02;
62
+ readonly X4: 0x03;
63
+ readonly X8: 0x04;
64
+ readonly X16: 0x05;
65
+ };
66
+ readonly Filter: {
67
+ readonly OFF: 0x00;
68
+ readonly X2: 0x01;
69
+ readonly X4: 0x02;
70
+ readonly X8: 0x03;
71
+ readonly X16: 0x04;
72
+ };
73
+ readonly Mode: {
74
+ readonly SLEEP: 0x00;
75
+ readonly FORCED: 0x01;
76
+ readonly NORMAL: 0x03;
77
+ };
78
+ readonly Standby: {
79
+ readonly MS_0_5: 0x00;
80
+ readonly MS_62_5: 0x01;
81
+ readonly MS_125: 0x02;
82
+ readonly MS_250: 0x03;
83
+ readonly MS_500: 0x04;
84
+ readonly MS_1000: 0x05;
85
+ readonly MS_10: 0x06;
86
+ readonly MS_20: 0x07;
87
+ };
88
+ }
89
+
90
+ class BME280 {
91
+ constructor(options: BME280Options);
92
+ configure(options: BME280Configuration): void;
93
+ sample(): BME280Sample;
94
+ close(): void;
95
+ target?: unknown;
96
+ }
97
+ interface BME280 extends Disposable {}
98
+
99
+ const Config: BME280ConfigConstants;
100
+
101
+ export { BME280 as default, BME280, Config };
102
+ }
@@ -0,0 +1,96 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "embedded:sensor/Location/GPS" {
22
+ interface GPSSensorIO {
23
+ write(value: ByteBuffer, stop?: boolean): void;
24
+ writeRead?(writeBuffer: ByteBuffer, readByteLength: number, stop?: boolean): ArrayBuffer;
25
+ read?(byteLength?: number): number | ArrayBuffer | undefined;
26
+ close(): void;
27
+ }
28
+
29
+ interface GPSSensorOptions {
30
+ io: new (options: object) => GPSSensorIO;
31
+ address?: number;
32
+ hz?: number;
33
+ data?: number | string;
34
+ clock?: number | string;
35
+ receive?: number | string;
36
+ transmit?: number | string;
37
+ baud?: number;
38
+ port?: number | string;
39
+ [key: string]: unknown;
40
+ }
41
+
42
+ interface GPSProtocol {
43
+ new (onParsed?: (parsed: object) => void): {
44
+ push(data: number | ArrayBuffer | ArrayBufferView): object | undefined;
45
+ };
46
+ location(parsed: object | null | undefined): object | undefined;
47
+ identification: {
48
+ model: string;
49
+ classification: string;
50
+ description: string;
51
+ };
52
+ setup?(): ArrayBuffer[];
53
+ }
54
+
55
+ interface GPSOptions {
56
+ sensor: GPSSensorOptions;
57
+ protocol: GPSProtocol;
58
+ onSample?: (this: GPS) => void;
59
+ onError?: (this: GPS, error: Error) => void;
60
+ target?: unknown;
61
+ }
62
+
63
+ /** enableHighAccuracy is accepted for Location API alignment; currently a no-op. */
64
+ interface GPSConfiguration {
65
+ enableHighAccuracy?: boolean;
66
+ timeout?: number;
67
+ maximumAge?: number;
68
+ }
69
+
70
+ interface GPSSample {
71
+ latitude: number;
72
+ longitude: number;
73
+ altitude?: number;
74
+ accuracy?: number;
75
+ altitudeAccuracy?: number;
76
+ heading?: number;
77
+ speed?: number;
78
+ timestamp?: number;
79
+ }
80
+
81
+ class GPS {
82
+ constructor(options: GPSOptions);
83
+ configure(options: GPSConfiguration): void;
84
+ sample(): GPSSample | undefined;
85
+ close(): void;
86
+ readonly identification: {
87
+ model: string;
88
+ classification: string;
89
+ description: string;
90
+ };
91
+ target?: unknown;
92
+ }
93
+ interface GPS extends Disposable {}
94
+
95
+ export { GPS as default, GPS };
96
+ }
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "embedded:sensor/Location/IP" {
22
+ interface IPHTTPOptions {
23
+ io: new (options: object) => {
24
+ request(options: object): {
25
+ read(byteLength?: number): ArrayBuffer | undefined;
26
+ };
27
+ close(): void;
28
+ };
29
+ host: string;
30
+ path?: string;
31
+ port?: number;
32
+ [key: string]: unknown;
33
+ }
34
+
35
+ interface IPOptions {
36
+ http?: IPHTTPOptions;
37
+ onSample?: (this: IP) => void;
38
+ onError?: (this: IP, error: Error) => void;
39
+ target?: unknown;
40
+ }
41
+
42
+ interface IPSample {
43
+ latitude: number;
44
+ longitude: number;
45
+ altitude?: number;
46
+ accuracy?: number;
47
+ timestamp?: number;
48
+ timezone?: number;
49
+ dst?: boolean;
50
+ }
51
+
52
+ class IP {
53
+ constructor(options: IPOptions);
54
+ configure(options?: object): void;
55
+ sample(): IPSample | undefined;
56
+ close(): void;
57
+ readonly identification: {
58
+ model: string;
59
+ classification: string;
60
+ description: string;
61
+ };
62
+ target?: unknown;
63
+ }
64
+ interface IP extends Disposable {}
65
+
66
+ export { IP as default, IP };
67
+ }
@@ -22,7 +22,7 @@ declare module "embedded:io/smbus" {
22
22
  import I2C from "embedded:io/i2c"
23
23
 
24
24
  class SMBus extends I2C {
25
- constructor(options: ConstructorParameters<typeof I2C> & {
25
+ constructor(options: ConstructorParameters<typeof I2C>[0] & {
26
26
  stop?: boolean;
27
27
  });
28
28
  readUint8(register: number): number;
@@ -19,18 +19,12 @@
19
19
  */
20
20
 
21
21
  declare module "embedded:io/system" {
22
- import Timer from "timer";
23
22
  /**
24
- * @experimetnal
23
+ * @experimental
25
24
  */
26
25
  class System {
27
26
  static deepSleep(us: number, mode: number): void;
28
27
  static restart(): void;
29
- static resolve(name: string, callback: (name: string, ip: string) => void) : void;
30
- static setTimeout: typeof Timer.set;
31
- static clearTimeout: typeof Timer.clear;
32
- static setInterval: typeof Timer.repeat;
33
- static clearInterval: typeof Timer.clear;
34
28
  }
35
29
  export default System;
36
30
  }
@@ -41,7 +41,8 @@ declare module "embedded:network/http/client" {
41
41
  export interface HTTPRequest {
42
42
  read(byteLength?: number): ArrayBuffer|undefined;
43
43
  read(buffer: ByteBuffer): void;
44
- write(value: ByteBuffer|undefined): void;
44
+ write(): number;
45
+ write(value: ByteBuffer|undefined): number;
45
46
  }
46
47
 
47
48
  class HTTPClient {
@@ -26,6 +26,7 @@ declare module "embedded:network/http/server" {
26
26
  method: string;
27
27
  path: string;
28
28
  headers: Map<string, string>;
29
+ query: string;
29
30
  }
30
31
 
31
32
  export interface HTTPResponse {
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2025 Moddable Tech, Inc.
2
+ * Copyright (c) 2025-2026 Moddable Tech, Inc.
3
3
  *
4
4
  * This file is part of the Moddable SDK Tools.
5
5
  *
@@ -61,6 +61,7 @@ declare module "embedded:network/websocket/client" {
61
61
  read(buffer: ByteBuffer): number;
62
62
 
63
63
  format: "buffer" | "number";
64
+ protocol: string | undefined;
64
65
  target?: any;
65
66
 
66
67
  static readonly text: 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "9.0.1",
3
+ "version": "9.5.0",
4
4
  "main": "",
5
5
  "types": "xs",
6
6
  "typesVersions": {
package/xs.d.ts CHANGED
@@ -91,7 +91,8 @@ interface Math {
91
91
  idiv(a: number, b: number): number
92
92
  imod(a: number, b: number): number
93
93
  imuldiv(a: number, b: number, c: number): number
94
- irandom(a: number, b: number): number
94
+ irandom(min: number, max: number): number
95
+ irandom(max: number): number
95
96
  irem(a: number, b: number): number
96
97
  mod(a: number, b: number): number
97
98
  }