@girs/avahi-0.6 4.3.0 → 4.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.
Files changed (3) hide show
  1. package/README.md +36 -41
  2. package/avahi-0.6.d.ts +72 -50
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -4,82 +4,77 @@
4
4
  ![version](https://img.shields.io/npm/v/@girs/avahi-0.6)
5
5
  ![downloads/week](https://img.shields.io/npm/dw/@girs/avahi-0.6)
6
6
 
7
+ GJS TypeScript type definitions for Avahi-0.6 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.5.0.
7
8
 
8
- GJS TypeScript type definitions for Avahi-0.6 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.3.0.
9
+ This package contains type declarations only. It ships no runtime code, so it adds
10
+ nothing to your program and works with any bundler or none at all.
9
11
 
10
12
  ## Install
11
13
 
12
- Install the type definitions with npm:
13
14
  ```bash
14
15
  npm install @girs/avahi-0.6
15
16
  ```
16
17
 
17
- ## Usage
18
+ Any package manager works. The package has no dependencies beyond other `@girs/*`
19
+ type packages.
20
+
21
+ ## What it exports
22
+
23
+ | Import | What you get |
24
+ |---|---|
25
+ | `@girs/avahi-0.6` | the namespace as a default export, plus the ambient and global declarations |
26
+ | `@girs/avahi-0.6/ambient` | only the `gi://` module declarations |
27
+ | `@girs/avahi-0.6/import` | only the `imports.gi` declarations |
28
+ | `@girs/avahi-0.6/avahi-0.6` | the namespace, without the side-effecting declarations |
29
+
30
+ ## Three ways to import
31
+
32
+ Which one you use depends on how you write imports elsewhere, not on your toolchain.
33
+
34
+ ### As a module
18
35
 
19
- Import it like any other module:
20
36
  ```ts
21
37
  import Avahi from '@girs/avahi-0.6';
22
38
  ```
23
39
 
24
- ### Ambient Modules
40
+ ### As `gi://`
25
41
 
26
- [Ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) let you write the same import you would in plain JavaScript.
27
- For this you need to include `@girs/avahi-0.6` or `@girs/avahi-0.6/ambient` in your `tsconfig` or entry point Typescript file:
42
+ GJS resolves `gi://` at runtime. To give it types, reference the package once, either
43
+ from your entry point or from `tsconfig.json`:
28
44
 
29
- `index.ts`:
30
45
  ```ts
31
- import '@girs/avahi-0.6'
46
+ import '@girs/avahi-0.6';
32
47
  ```
33
48
 
34
- `tsconfig.json`:
35
49
  ```json
36
- {
37
- "compilerOptions": {
38
- ...
39
- },
40
- "include": ["@girs/avahi-0.6"],
41
- ...
42
- }
50
+ { "include": ["@girs/avahi-0.6"] }
43
51
  ```
44
52
 
45
- The ambient module now resolves with types:
53
+ Then the runtime spelling type-checks:
46
54
 
47
55
  ```ts
48
56
  import Avahi from 'gi://Avahi?version=0.6';
49
57
  ```
50
58
 
51
- ### Global import
52
-
53
- GJS's global `imports.gi` works too, with types.
54
- For this you need to include `@girs/avahi-0.6` or `@girs/avahi-0.6/import` in your `tsconfig` or entry point Typescript file:
59
+ Referencing `@girs/avahi-0.6/ambient` instead pulls in these declarations
60
+ alone. See [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules).
55
61
 
56
- `index.ts`:
57
- ```ts
58
- import '@girs/avahi-0.6'
59
- ```
60
-
61
- `tsconfig.json`:
62
- ```json
63
- {
64
- "compilerOptions": {
65
- ...
66
- },
67
- "include": ["@girs/avahi-0.6"],
68
- ...
69
- }
70
- ```
62
+ ### As `imports.gi`
71
63
 
72
- That form carries types as well:
64
+ GJS's global object works the same way, via `@girs/avahi-0.6/import`:
73
65
 
74
66
  ```ts
75
67
  const Avahi = imports.gi.Avahi;
76
68
  ```
77
69
 
78
- ### Bundle
70
+ ## Building
79
71
 
80
- Most projects want a bundler. [esbuild](https://esbuild.github.io/) is the smallest thing that works; the [examples directory](https://github.com/gjsify/ts-for-gir/tree/main/examples) has setups for several others.
72
+ The declarations need no build step. If you bundle, every bundler works, since there is
73
+ no runtime code to resolve. The [examples](https://github.com/gjsify/ts-for-gir/tree/main/examples)
74
+ show working setups for several.
81
75
 
82
76
  ## Other packages
83
77
 
84
- All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
78
+ Every pre-generated package is at [gjsify/types](https://github.com/gjsify/types).
79
+
85
80
 
package/avahi-0.6.d.ts CHANGED
@@ -33,11 +33,11 @@ export namespace Avahi {
33
33
  * @gir-type Enum
34
34
  */
35
35
  enum BrowserEvent {
36
- GA_BROWSER_NEW,
37
- GA_BROWSER_REMOVE,
38
- GA_BROWSER_CACHE_EXHAUSTED,
39
- GA_BROWSER_ALL_FOR_NOW,
40
- GA_BROWSER_FAILURE,
36
+ GA_BROWSER_NEW = 0,
37
+ GA_BROWSER_REMOVE = 1,
38
+ GA_BROWSER_CACHE_EXHAUSTED = 2,
39
+ GA_BROWSER_ALL_FOR_NOW = 3,
40
+ GA_BROWSER_FAILURE = 4,
41
41
  }
42
42
 
43
43
 
@@ -52,9 +52,9 @@ export namespace Avahi {
52
52
  * @gir-type Enum
53
53
  */
54
54
  enum ClientFlags {
55
- GA_CLIENT_FLAG_NO_FLAGS,
56
- GA_CLIENT_FLAG_IGNORE_USER_CONFIG,
57
- GA_CLIENT_FLAG_NO_FAIL,
55
+ GA_CLIENT_FLAG_NO_FLAGS = 0,
56
+ GA_CLIENT_FLAG_IGNORE_USER_CONFIG = 1,
57
+ GA_CLIENT_FLAG_NO_FAIL = 2,
58
58
  }
59
59
 
60
60
 
@@ -69,12 +69,12 @@ export namespace Avahi {
69
69
  * @gir-type Enum
70
70
  */
71
71
  enum ClientState {
72
- GA_CLIENT_STATE_NOT_STARTED,
73
- GA_CLIENT_STATE_S_REGISTERING,
74
- GA_CLIENT_STATE_S_RUNNING,
75
- GA_CLIENT_STATE_S_COLLISION,
76
- GA_CLIENT_STATE_FAILURE,
77
- GA_CLIENT_STATE_CONNECTING,
72
+ GA_CLIENT_STATE_NOT_STARTED = -1,
73
+ GA_CLIENT_STATE_S_REGISTERING = 1,
74
+ GA_CLIENT_STATE_S_RUNNING = 2,
75
+ GA_CLIENT_STATE_S_COLLISION = 3,
76
+ GA_CLIENT_STATE_FAILURE = 100,
77
+ GA_CLIENT_STATE_CONNECTING = 101,
78
78
  }
79
79
 
80
80
 
@@ -89,11 +89,11 @@ export namespace Avahi {
89
89
  * @gir-type Enum
90
90
  */
91
91
  enum EntryGroupState {
92
- GA_ENTRY_GROUP_STATE_UNCOMMITED,
93
- GA_ENTRY_GROUP_STATE_REGISTERING,
94
- GA_ENTRY_GROUP_STATE_ESTABLISHED,
95
- GA_ENTRY_GROUP_STATE_COLLISTION,
96
- GA_ENTRY_GROUP_STATE_FAILURE,
92
+ GA_ENTRY_GROUP_STATE_UNCOMMITED = 0,
93
+ GA_ENTRY_GROUP_STATE_REGISTERING = 1,
94
+ GA_ENTRY_GROUP_STATE_ESTABLISHED = 2,
95
+ GA_ENTRY_GROUP_STATE_COLLISTION = 3,
96
+ GA_ENTRY_GROUP_STATE_FAILURE = 4,
97
97
  }
98
98
 
99
99
 
@@ -108,11 +108,11 @@ export namespace Avahi {
108
108
  * @gir-type Enum
109
109
  */
110
110
  enum LookupFlags {
111
- GA_LOOKUP_NO_FLAGS,
112
- GA_LOOKUP_USE_WIDE_AREA,
113
- GA_LOOKUP_USE_MULTICAST,
114
- GA_LOOKUP_NO_TXT,
115
- GA_LOOKUP_NO_ADDRESS,
111
+ GA_LOOKUP_NO_FLAGS = 0,
112
+ GA_LOOKUP_USE_WIDE_AREA = 1,
113
+ GA_LOOKUP_USE_MULTICAST = 2,
114
+ GA_LOOKUP_NO_TXT = 4,
115
+ GA_LOOKUP_NO_ADDRESS = 8,
116
116
  }
117
117
 
118
118
 
@@ -127,12 +127,12 @@ export namespace Avahi {
127
127
  * @gir-type Enum
128
128
  */
129
129
  enum LookupResultFlags {
130
- GA_LOOKUP_RESULT_CACHED,
131
- GA_LOOKUP_RESULT_WIDE_AREA,
132
- GA_LOOKUP_RESULT_MULTICAST,
133
- GA_LOOKUP_RESULT_LOCAL,
134
- GA_LOOKUP_RESULT_OUR_OWN,
135
- GA_LOOKUP_RESULT_STATIC,
130
+ GA_LOOKUP_RESULT_CACHED = 1,
131
+ GA_LOOKUP_RESULT_WIDE_AREA = 2,
132
+ GA_LOOKUP_RESULT_MULTICAST = 4,
133
+ GA_LOOKUP_RESULT_LOCAL = 8,
134
+ GA_LOOKUP_RESULT_OUR_OWN = 16,
135
+ GA_LOOKUP_RESULT_STATIC = 32,
136
136
  }
137
137
 
138
138
 
@@ -147,9 +147,9 @@ export namespace Avahi {
147
147
  * @gir-type Enum
148
148
  */
149
149
  enum Protocol {
150
- GA_PROTOCOL_INET,
151
- GA_PROTOCOL_INET6,
152
- GA_PROTOCOL_UNSPEC,
150
+ GA_PROTOCOL_INET = 0,
151
+ GA_PROTOCOL_INET6 = 1,
152
+ GA_PROTOCOL_UNSPEC = -1,
153
153
  }
154
154
 
155
155
 
@@ -164,8 +164,8 @@ export namespace Avahi {
164
164
  * @gir-type Enum
165
165
  */
166
166
  enum ResolverEvent {
167
- GA_RESOLVER_FOUND,
168
- GA_RESOLVER_FAILURE,
167
+ GA_RESOLVER_FOUND = 0,
168
+ GA_RESOLVER_FAILURE = 1,
169
169
  }
170
170
 
171
171
 
@@ -179,7 +179,7 @@ export namespace Avahi {
179
179
  * @detailed
180
180
  * @run-last
181
181
  */
182
- "state-changed": (arg0: ClientState) => void;
182
+ "state-changed": (object: ClientState) => void;
183
183
  "notify::flags": (pspec: GObject.ParamSpec) => void;
184
184
  "notify::state": (pspec: GObject.ParamSpec) => void;
185
185
  /**
@@ -187,14 +187,14 @@ export namespace Avahi {
187
187
  * @detailed
188
188
  * @run-last
189
189
  */
190
- "state-changed::flags": (arg0: ClientState) => void;
190
+ "state-changed::flags": (object: ClientState) => void;
191
191
  /**
192
192
  * @signal
193
193
  * @detailed
194
194
  * @run-last
195
195
  */
196
- "state-changed::state": (arg0: ClientState) => void;
197
- [key: `state-changed::${string}`]: (arg0: ClientState) => void;
196
+ "state-changed::state": (object: ClientState) => void;
197
+ [key: `state-changed::${string}`]: (object: ClientState) => void;
198
198
  }
199
199
 
200
200
  // Constructor properties interface
@@ -253,10 +253,14 @@ export namespace Avahi {
253
253
  emit(signal: string, ...args: any[]): void;
254
254
 
255
255
  // Methods
256
+ /**
257
+ * @throws GLib.Error
258
+ */
256
259
  start(): boolean;
257
260
 
258
261
  /**
259
262
  * @param context
263
+ * @throws GLib.Error
260
264
  */
261
265
  start_in_context(context: GLib.MainContext): boolean;
262
266
  }
@@ -270,15 +274,15 @@ export namespace Avahi {
270
274
  * @detailed
271
275
  * @run-last
272
276
  */
273
- "state-changed": (arg0: EntryGroupState) => void;
277
+ "state-changed": (object: EntryGroupState) => void;
274
278
  "notify::state": (pspec: GObject.ParamSpec) => void;
275
279
  /**
276
280
  * @signal
277
281
  * @detailed
278
282
  * @run-last
279
283
  */
280
- "state-changed::state": (arg0: EntryGroupState) => void;
281
- [key: `state-changed::${string}`]: (arg0: EntryGroupState) => void;
284
+ "state-changed::state": (object: EntryGroupState) => void;
285
+ [key: `state-changed::${string}`]: (object: EntryGroupState) => void;
282
286
  }
283
287
 
284
288
  // Constructor properties interface
@@ -337,6 +341,7 @@ export namespace Avahi {
337
341
  * @param ttl
338
342
  * @param rdata
339
343
  * @param size
344
+ * @throws GLib.Error
340
345
  */
341
346
  add_record(flags: AvahiCore.PublishFlags, name: string, type: number, ttl: number, rdata: null, size: bigint | number): boolean;
342
347
 
@@ -350,16 +355,24 @@ export namespace Avahi {
350
355
  * @param ttl
351
356
  * @param rdata
352
357
  * @param size
358
+ * @throws GLib.Error
353
359
  */
354
360
  add_record_full(_interface: AvahiCore.IfIndex, protocol: AvahiCore.Protocol, flags: AvahiCore.PublishFlags, name: string, clazz: number, type: number, ttl: number, rdata: null, size: bigint | number): boolean;
355
361
 
356
362
  /**
357
363
  * @param client
364
+ * @throws GLib.Error
358
365
  */
359
366
  attach(client: Client): boolean;
360
367
 
368
+ /**
369
+ * @throws GLib.Error
370
+ */
361
371
  commit(): boolean;
362
372
 
373
+ /**
374
+ * @throws GLib.Error
375
+ */
363
376
  reset(): boolean;
364
377
  }
365
378
 
@@ -381,17 +394,17 @@ export namespace Avahi {
381
394
  * @signal
382
395
  * @run-last
383
396
  */
384
- failure: (arg0: null) => void;
397
+ failure: (object: null) => void;
385
398
  /**
386
399
  * @signal
387
400
  * @run-last
388
401
  */
389
- "new-record": (arg0: number, arg1: Protocol, arg2: string, arg3: number, arg4: number, arg5: null, arg6: number, arg7: LookupResultFlags) => void;
402
+ "new-record": (object: number, p0: Protocol, p1: string, p2: number, p3: number, p4: null, p5: number, p6: LookupResultFlags) => void;
390
403
  /**
391
404
  * @signal
392
405
  * @run-last
393
406
  */
394
- "removed-record": (arg0: number, arg1: Protocol, arg2: string, arg3: number, arg4: number, arg5: null, arg6: number, arg7: LookupResultFlags) => void;
407
+ "removed-record": (object: number, p0: Protocol, p1: string, p2: number, p3: number, p4: null, p5: number, p6: LookupResultFlags) => void;
395
408
  "notify::class": (pspec: GObject.ParamSpec) => void;
396
409
  "notify::flags": (pspec: GObject.ParamSpec) => void;
397
410
  "notify::interface": (pspec: GObject.ParamSpec) => void;
@@ -488,6 +501,7 @@ export namespace Avahi {
488
501
  // Methods
489
502
  /**
490
503
  * @param client
504
+ * @throws GLib.Error
491
505
  */
492
506
  attach(client: Client): boolean;
493
507
  }
@@ -510,17 +524,17 @@ export namespace Avahi {
510
524
  * @signal
511
525
  * @run-last
512
526
  */
513
- failure: (arg0: null) => void;
527
+ failure: (object: null) => void;
514
528
  /**
515
529
  * @signal
516
530
  * @run-last
517
531
  */
518
- "new-service": (arg0: number, arg1: Protocol, arg2: string, arg3: string, arg4: string, arg5: LookupResultFlags) => void;
532
+ "new-service": (object: number, p0: Protocol, p1: string, p2: string, p3: string, p4: LookupResultFlags) => void;
519
533
  /**
520
534
  * @signal
521
535
  * @run-last
522
536
  */
523
- "removed-service": (arg0: number, arg1: Protocol, arg2: string, arg3: string, arg4: string, arg5: LookupResultFlags) => void;
537
+ "removed-service": (object: number, p0: Protocol, p1: string, p2: string, p3: string, p4: LookupResultFlags) => void;
524
538
  "notify::domain": (pspec: GObject.ParamSpec) => void;
525
539
  "notify::flags": (pspec: GObject.ParamSpec) => void;
526
540
  "notify::interface": (pspec: GObject.ParamSpec) => void;
@@ -609,6 +623,7 @@ export namespace Avahi {
609
623
  // Methods
610
624
  /**
611
625
  * @param client
626
+ * @throws GLib.Error
612
627
  */
613
628
  attach(client: Client): boolean;
614
629
  }
@@ -621,12 +636,12 @@ export namespace Avahi {
621
636
  * @signal
622
637
  * @run-last
623
638
  */
624
- failure: (arg0: null) => void;
639
+ failure: (object: null) => void;
625
640
  /**
626
641
  * @signal
627
642
  * @run-last
628
643
  */
629
- found: (arg0: number, arg1: Protocol, arg2: string, arg3: string, arg4: string, arg5: string, arg6: null, arg7: number, arg8: null, arg9: LookupResultFlags) => void;
644
+ found: (object: number, p0: Protocol, p1: string, p2: string, p3: string, p4: string, p5: null, p6: number, p7: null, p8: LookupResultFlags) => void;
630
645
  "notify::aprotocol": (pspec: GObject.ParamSpec) => void;
631
646
  "notify::domain": (pspec: GObject.ParamSpec) => void;
632
647
  "notify::flags": (pspec: GObject.ParamSpec) => void;
@@ -729,6 +744,7 @@ export namespace Avahi {
729
744
  // Methods
730
745
  /**
731
746
  * @param client
747
+ * @throws GLib.Error
732
748
  */
733
749
  attach(client: Client): boolean;
734
750
 
@@ -778,12 +794,14 @@ export namespace Avahi {
778
794
 
779
795
  /**
780
796
  * @param key
797
+ * @throws GLib.Error
781
798
  */
782
799
  remove_key(key: string): boolean;
783
800
 
784
801
  /**
785
802
  * @param key
786
803
  * @param value
804
+ * @throws GLib.Error
787
805
  */
788
806
  set(key: string, value: string): boolean;
789
807
 
@@ -791,9 +809,13 @@ export namespace Avahi {
791
809
  * @param key
792
810
  * @param value
793
811
  * @param size
812
+ * @throws GLib.Error
794
813
  */
795
814
  set_arbitrary(key: string, value: number, size: bigint | number): boolean;
796
815
 
816
+ /**
817
+ * @throws GLib.Error
818
+ */
797
819
  thaw(): boolean;
798
820
  }
799
821
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girs/avahi-0.6",
3
- "version": "4.3.0",
3
+ "version": "4.5.0",
4
4
  "description": "GJS TypeScript type definitions for Avahi-0.6",
5
5
  "type": "module",
6
6
  "module": "avahi-0.6.js",
@@ -31,10 +31,10 @@
31
31
  "test": "tsc --project tsconfig.json"
32
32
  },
33
33
  "dependencies": {
34
- "@girs/gjs": "^4.3.0",
35
- "@girs/gobject-2.0": "^4.3.0",
36
- "@girs/glib-2.0": "^4.3.0",
37
- "@girs/avahicore-0.6": "^4.3.0" },
34
+ "@girs/gjs": "^4.5.0",
35
+ "@girs/gobject-2.0": "^4.5.0",
36
+ "@girs/glib-2.0": "^4.5.0",
37
+ "@girs/avahicore-0.6": "^4.5.0" },
38
38
  "devDependencies": {
39
39
  "typescript": "*"
40
40
  },