@girs/nice-0.1 0.1.0-4.0.0-beta.2 → 0.1.0-4.0.0-beta.3

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.
Files changed (3) hide show
  1. package/README.md +1 -19
  2. package/nice-0.1.d.ts +73 -24
  3. package/package.json +5 -6
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/nice-0.1)
6
6
 
7
7
 
8
- GJS TypeScript type definitions for Nice-0.1, generated from library version 0.1.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.2.
8
+ GJS TypeScript type definitions for Nice-0.1, generated from library version 0.1.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.3.
9
9
 
10
10
 
11
11
  ## Install
@@ -22,11 +22,6 @@ You can import this package into your project like this:
22
22
  import Nice from '@girs/nice-0.1';
23
23
  ```
24
24
 
25
- Or if you prefer CommonJS, you can also use this:
26
- ```ts
27
- const Nice = require('@girs/nice-0.1');
28
- ```
29
-
30
25
  ### Ambient Modules
31
26
 
32
27
  You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
@@ -81,19 +76,6 @@ Now you have also type support for this, too:
81
76
  const Nice = imports.gi.Nice;
82
77
  ```
83
78
 
84
-
85
- ### ESM vs. CommonJS
86
-
87
- GJS supports two different import syntaxes. The new modern ESM syntax and the old global imports syntax.
88
-
89
- In TypeScript projects for GJS and GNOME Shell extensions, you have the flexibility to use `ESM` syntax and then decide the import syntax for your bundled file. If your bundler is configured to use `CommonJS`, it will convert to the GJS-specific global imports syntax, like `const moduleName = imports.gi[moduleName]`. This is different from the traditional `require` syntax seen in Node.js. The global imports syntax is chosen because it aligns with the CommonJS format supported by NPM, which is used for the generated type definitions and this package.
90
-
91
- On the other hand, if you configure your bundler to use ESM, it will retain the ESM import syntax. It's crucial to ensure that your bundler is set up to correctly translate and bundle these imports into either CommonJS or ESM format, depending on your project's requirements.
92
-
93
- This approach is particularly important due to the `@girs` types, which include both `*.cjs `files, using the GJS global imports syntax, and `*.js` files, which utilize the ESM syntax. By appropriately setting up your bundler, you can control which syntax—CommonJS or ESM—is used in your project. The choice of CommonJS in this context is also due to the similarity between the GJS-specific global imports and CommonJS syntax, allowing for easier management and bundling in these specific types of projects.
94
-
95
- Since GNOME Shell 45, you should only use ESM, even for GNOME Shell extensions. Before that, extensions had to use the global import syntax, unlike normal GJS applications, where ESM has been available for some time.
96
-
97
79
  ### Bundle
98
80
 
99
81
  Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
package/nice-0.1.d.ts CHANGED
@@ -14,7 +14,6 @@ import './nice-0.1-ambient.d.ts';
14
14
  import type Gio from '@girs/gio-2.0';
15
15
  import type GObject from '@girs/gobject-2.0';
16
16
  import type GLib from '@girs/glib-2.0';
17
- import type GModule from '@girs/gmodule-2.0';
18
17
 
19
18
  export namespace Nice {
20
19
  /**
@@ -39,7 +38,7 @@ export namespace Nice {
39
38
  TCP_SO,
40
39
  }
41
40
  /**
42
- * An enum represneting the type of a candidate
41
+ * An enum representing the type of a candidate
43
42
  */
44
43
  enum CandidateType {
45
44
  /**
@@ -47,7 +46,7 @@ export namespace Nice {
47
46
  */
48
47
  HOST,
49
48
  /**
50
- * A server reflexive candidate
49
+ * A server reflexive candidate (or a NAT-assisted candidate)
51
50
  */
52
51
  SERVER_REFLEXIVE,
53
52
  /**
@@ -343,9 +342,8 @@ export namespace Nice {
343
342
  TLS,
344
343
  }
345
344
  /**
346
- * A hard limit for the number of remote candidates. This
347
- * limit is enforced to protect against malevolent remote
348
- * clients.
345
+ * Was a limit on the number of remote candidates one can set, but is
346
+ * no longer used by libnice itself.
349
347
  */
350
348
  const AGENT_MAX_REMOTE_CANDIDATES: number;
351
349
  /**
@@ -405,6 +403,13 @@ export namespace Nice {
405
403
  * @param with_stun Also enable STUN debugging messages
406
404
  */
407
405
  function debug_enable(with_stun: boolean): void;
406
+ /**
407
+ * Returns the interface index match the local address passed. This can
408
+ * by used for APIs that need a specific address.
409
+ * @param addr A #NiceAddress for a local interface
410
+ * @returns The interface index or 0 on error
411
+ */
412
+ function interfaces_get_if_index_by_addr(addr: Address): number;
408
413
  /**
409
414
  * Retrieves the IP address of an interface by its name. If this fails, %NULL
410
415
  * is returned.
@@ -437,6 +442,10 @@ export namespace Nice {
437
442
  * the other value.
438
443
  */
439
444
  enum AgentOption {
445
+ /**
446
+ * No enabled options (Since: 0.1.19)
447
+ */
448
+ NONE,
440
449
  /**
441
450
  * Enables regular nomination, default
442
451
  * is aggrssive mode (see #NiceNominationMode).
@@ -463,6 +472,10 @@ export namespace Nice {
463
472
  * Enable RFC 7675 consent freshness support. (Since: 0.1.19)
464
473
  */
465
474
  CONSENT_FRESHNESS,
475
+ /**
476
+ * Use bytestream mode for reliable TCP connections. (Since: 0.1.20)
477
+ */
478
+ BYTESTREAM_TCP,
466
479
  }
467
480
  module Agent {
468
481
  // Signal callback interfaces
@@ -539,6 +552,8 @@ export namespace Nice {
539
552
  mainContext: any;
540
553
  max_connectivity_checks: number;
541
554
  maxConnectivityChecks: number;
555
+ proxy_extra_headers: GLib.HashTable<string, string>;
556
+ proxyExtraHeaders: GLib.HashTable<string, string>;
542
557
  proxy_ip: string;
543
558
  proxyIp: string;
544
559
  proxy_password: string;
@@ -580,7 +595,7 @@ export namespace Nice {
580
595
  // Own properties of Nice.Agent
581
596
 
582
597
  /**
583
- * This property defines whether receive/send over a TCP or pseudo-TCP, in
598
+ * This property defines whether receive/send operations over a TCP socket, in
584
599
  * reliable mode, are considered as packetized or as bytestream.
585
600
  * In unreliable mode, every send/recv is considered as packetized, and
586
601
  * this property is ignored and cannot be set.
@@ -590,19 +605,16 @@ export namespace Nice {
590
605
  * </para>
591
606
  * If the property is %TRUE, the stream is considered in bytestream mode
592
607
  * and data can be read with any receive size. If the property is %FALSE, then
593
- * the stream is considred packetized and each receive will return one packet
608
+ * the stream is considered packetized and each receive will return one packet
594
609
  * of the same size as what was sent from the peer. If in packetized mode,
595
610
  * then doing a receive with a size smaller than the packet, will cause the
596
611
  * remaining bytes in the packet to be dropped, breaking the reliability
597
612
  * of the stream.
598
- * <para>
599
- * This property is currently read-only, and will become read/write once
600
- * bytestream mode will be supported.
601
- * </para>
602
613
  */
603
614
  get bytestream_tcp(): boolean;
615
+ set bytestream_tcp(val: boolean);
604
616
  /**
605
- * This property defines whether receive/send over a TCP or pseudo-TCP, in
617
+ * This property defines whether receive/send operations over a TCP socket, in
606
618
  * reliable mode, are considered as packetized or as bytestream.
607
619
  * In unreliable mode, every send/recv is considered as packetized, and
608
620
  * this property is ignored and cannot be set.
@@ -612,17 +624,14 @@ export namespace Nice {
612
624
  * </para>
613
625
  * If the property is %TRUE, the stream is considered in bytestream mode
614
626
  * and data can be read with any receive size. If the property is %FALSE, then
615
- * the stream is considred packetized and each receive will return one packet
627
+ * the stream is considered packetized and each receive will return one packet
616
628
  * of the same size as what was sent from the peer. If in packetized mode,
617
629
  * then doing a receive with a size smaller than the packet, will cause the
618
630
  * remaining bytes in the packet to be dropped, breaking the reliability
619
631
  * of the stream.
620
- * <para>
621
- * This property is currently read-only, and will become read/write once
622
- * bytestream mode will be supported.
623
- * </para>
624
632
  */
625
633
  get bytestreamTcp(): boolean;
634
+ set bytestreamTcp(val: boolean);
626
635
  /**
627
636
  * The Nice agent can work in various compatibility modes depending on
628
637
  * what the application/peer needs.
@@ -883,6 +892,20 @@ export namespace Nice {
883
892
  set max_connectivity_checks(val: number);
884
893
  get maxConnectivityChecks(): number;
885
894
  set maxConnectivityChecks(val: number);
895
+ /**
896
+ * Optional extra headers to append to the HTTP proxy CONNECT request.
897
+ * Provided as key/value-pairs in hash table corresponding to
898
+ * header-name/header-value.
899
+ */
900
+ get proxy_extra_headers(): GLib.HashTable<string, string>;
901
+ set proxy_extra_headers(val: GLib.HashTable<string, string>);
902
+ /**
903
+ * Optional extra headers to append to the HTTP proxy CONNECT request.
904
+ * Provided as key/value-pairs in hash table corresponding to
905
+ * header-name/header-value.
906
+ */
907
+ get proxyExtraHeaders(): GLib.HashTable<string, string>;
908
+ set proxyExtraHeaders(val: GLib.HashTable<string, string>);
886
909
  /**
887
910
  * The proxy server IP used to bypass a proxy firewall
888
911
  */
@@ -1750,7 +1773,7 @@ export namespace Nice {
1750
1773
  * discovery process; one TCP and one UDP, for example.
1751
1774
  * @param stream_id The ID of the stream
1752
1775
  * @param component_id The ID of the component
1753
- * @param server_ip The IP address of the TURN server
1776
+ * @param server_ip The address of the TURN server
1754
1777
  * @param server_port The port of the TURN server
1755
1778
  * @param username The TURN username to use for the allocate
1756
1779
  * @param password The TURN password to use for the allocate
@@ -2151,8 +2174,11 @@ export namespace Nice {
2151
2174
 
2152
2175
  // Constructors of Nice.Address
2153
2176
 
2177
+ constructor(properties?: Partial<{}>);
2154
2178
  _init(...args: any[]): void;
2155
2179
 
2180
+ static ['new'](): Address;
2181
+
2156
2182
  // Own methods of Nice.Address
2157
2183
 
2158
2184
  /**
@@ -2160,6 +2186,16 @@ export namespace Nice {
2160
2186
  * @param sin The sockaddr to fill
2161
2187
  */
2162
2188
  copy_to_sockaddr(sin?: any | null): void;
2189
+ /**
2190
+ * Creates a new #NiceAddress with the same address as `addr`
2191
+ * @returns The new #NiceAddress
2192
+ */
2193
+ dup(): Address;
2194
+ /**
2195
+ * Transforms the address `addr` into a newly allocated human readable string
2196
+ * @returns the address string
2197
+ */
2198
+ dup_string(): string;
2163
2199
  /**
2164
2200
  * Compares two #NiceAddress structures to see if they contain the same address
2165
2201
  * and the same port.
@@ -2192,6 +2228,11 @@ export namespace Nice {
2192
2228
  * @returns 4 for IPv4, 6 for IPv6 and 0 for undefined address
2193
2229
  */
2194
2230
  ip_version(): number;
2231
+ /**
2232
+ * Verifies if the address in `addr` is a link-local address or not
2233
+ * @returns %TRUE if @addr is a link-local address, %FALSE otherwise
2234
+ */
2235
+ is_linklocal(): boolean;
2195
2236
  /**
2196
2237
  * Verifies if the address in `addr` is a private address or not
2197
2238
  * @returns %TRUE if @addr is a private address, %FALSE otherwise
@@ -2242,11 +2283,6 @@ export namespace Nice {
2242
2283
  * @param port The port to set
2243
2284
  */
2244
2285
  set_port(port: number): void;
2245
- /**
2246
- * Transforms the address `addr` into a human readable string
2247
- * @param dst The string to fill
2248
- */
2249
- to_string(dst: string): void;
2250
2286
  }
2251
2287
 
2252
2288
  type AgentClass = typeof Agent;
@@ -2315,6 +2351,19 @@ export namespace Nice {
2315
2351
  * Frees a #NiceCandidate
2316
2352
  */
2317
2353
  free(): void;
2354
+ /**
2355
+ * In case the given candidate is relayed through a TURN server, use this utility function to get
2356
+ * its address.
2357
+ * @param addr The #NiceAddress to fill
2358
+ */
2359
+ relay_address(addr: Address): void;
2360
+ /**
2361
+ * In case the given candidate server-reflexive, use this utility function to get its address. The
2362
+ * address will be filled only if the candidate was generated using an STUN server.
2363
+ * @param addr The #NiceAddress to fill
2364
+ * @returns TRUE if it's a STUN created ICE candidate, or FALSE if the reflexed's server was not STUN.
2365
+ */
2366
+ stun_server_address(addr: Address): boolean;
2318
2367
  }
2319
2368
 
2320
2369
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/nice-0.1",
3
- "version": "0.1.0-4.0.0-beta.2",
3
+ "version": "0.1.0-4.0.0-beta.3",
4
4
  "description": "GJS TypeScript type definitions for Nice-0.1, generated from library version 0.1.0",
5
5
  "type": "module",
6
6
  "module": "nice-0.1.js",
@@ -26,11 +26,10 @@
26
26
  "test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit nice-0.1.d.ts"
27
27
  },
28
28
  "dependencies": {
29
- "@girs/gio-2.0": "^2.80.0-4.0.0-beta.2",
30
- "@girs/gjs": "^4.0.0-beta.2",
31
- "@girs/glib-2.0": "^2.80.0-4.0.0-beta.2",
32
- "@girs/gmodule-2.0": "^2.0.0-4.0.0-beta.2",
33
- "@girs/gobject-2.0": "^2.80.0-4.0.0-beta.2"
29
+ "@girs/gio-2.0": "^2.80.0-4.0.0-beta.3",
30
+ "@girs/gjs": "^4.0.0-beta.3",
31
+ "@girs/glib-2.0": "^2.80.0-4.0.0-beta.3",
32
+ "@girs/gobject-2.0": "^2.80.0-4.0.0-beta.3"
34
33
  },
35
34
  "devDependencies": {
36
35
  "typescript": "*"