@girs/gom-1.0 1.0.0-4.0.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.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+
2
+ # Gom-1.0
3
+
4
+ ![version](https://img.shields.io/npm/v/@girs/gom-1.0)
5
+ ![downloads/week](https://img.shields.io/npm/dw/@girs/gom-1.0)
6
+
7
+
8
+ GJS TypeScript type definitions for Gom-1.0, generated from library version 1.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0.
9
+
10
+
11
+ ## Install
12
+
13
+ To use this type definitions, install them with NPM:
14
+ ```bash
15
+ npm install @girs/gom-1.0
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ You can import this package into your project like this:
21
+ ```ts
22
+ import Gom from '@girs/gom-1.0';
23
+ ```
24
+
25
+ Or if you prefer CommonJS, you can also use this:
26
+ ```ts
27
+ const Gom = require('@girs/gom-1.0');
28
+ ```
29
+
30
+ ### Ambient Modules
31
+
32
+ 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.
33
+ For this you need to include `@girs/gom-1.0` or `@girs/gom-1.0/ambient` in your `tsconfig` or entry point Typescript file:
34
+
35
+ `index.ts`:
36
+ ```ts
37
+ import '@girs/gom-1.0'
38
+ ```
39
+
40
+ `tsconfig.json`:
41
+ ```json
42
+ {
43
+ "compilerOptions": {
44
+ ...
45
+ },
46
+ "include": ["@girs/gom-1.0"],
47
+ ...
48
+ }
49
+ ```
50
+
51
+ Now you can import the ambient module with TypeScript support:
52
+
53
+ ```ts
54
+ import Gom from 'gi://Gom?version=1.0';
55
+ ```
56
+
57
+ ### Global import
58
+
59
+ You can also import the module with Typescript support using the global `imports.gi` object of GJS.
60
+ For this you need to include `@girs/gom-1.0` or `@girs/gom-1.0/import` in your `tsconfig` or entry point Typescript file:
61
+
62
+ `index.ts`:
63
+ ```ts
64
+ import '@girs/gom-1.0'
65
+ ```
66
+
67
+ `tsconfig.json`:
68
+ ```json
69
+ {
70
+ "compilerOptions": {
71
+ ...
72
+ },
73
+ "include": ["@girs/gom-1.0"],
74
+ ...
75
+ }
76
+ ```
77
+
78
+ Now you have also type support for this, too:
79
+
80
+ ```ts
81
+ const Gom = imports.gi.Gom;
82
+ ```
83
+
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
+ ### Bundle
98
+
99
+ 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).
100
+
101
+ ## Other packages
102
+
103
+ All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
104
+
@@ -0,0 +1,12 @@
1
+
2
+ declare module 'gi://Gom?version=1.0' {
3
+ import Gom from '@girs/gom-1.0';
4
+ export default Gom;
5
+ }
6
+
7
+ declare module 'gi://Gom' {
8
+ import Gom10 from 'gi://Gom?version=1.0';
9
+ export default Gom10;
10
+ }
11
+
12
+
@@ -0,0 +1,2 @@
1
+ export {}
2
+
@@ -0,0 +1,12 @@
1
+
2
+ import Gom10 from '@girs/gom-1.0';
3
+
4
+ declare global {
5
+ export interface GjsGiImports {
6
+ Gom: typeof Gom10;
7
+ }
8
+ }
9
+
10
+ export default GjsGiImports;
11
+
12
+
@@ -0,0 +1,3 @@
1
+ const gi = globalThis.imports?.gi || {};
2
+ export default gi;
3
+
package/gom-1.0.d.ts ADDED
@@ -0,0 +1,784 @@
1
+ /*
2
+ * Type Definitions for Gjs (https://gjs.guide/)
3
+ *
4
+ * These type definitions are automatically generated, do not edit them by hand.
5
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
6
+ */
7
+
8
+ import './gom-1.0-ambient.d.ts';
9
+
10
+ /**
11
+ * Gom-1.0
12
+ */
13
+
14
+ import type Gio from '@girs/gio-2.0';
15
+ import type GObject from '@girs/gobject-2.0';
16
+ import type GLib from '@girs/glib-2.0';
17
+
18
+ export namespace Gom {
19
+ class Error extends GLib.Error {
20
+ static $gtype: GObject.GType<Error>;
21
+
22
+ // Static fields of Gom.Error
23
+
24
+ static ADAPTER_OPEN: number;
25
+ static COMMAND_NO_SQL: number;
26
+ static COMMAND_SQLITE: number;
27
+ static REPOSITORY_EMPTY_RESULT: number;
28
+ static RESOURCE_CURSOR: number;
29
+
30
+ // Constructors of Gom.Error
31
+
32
+ constructor(options: { message: string; code: number });
33
+ _init(...args: any[]): void;
34
+
35
+ // Own static methods of Gom.Error
36
+
37
+ static quark(): GLib.Quark;
38
+ }
39
+
40
+ enum FilterMode {
41
+ SQL,
42
+ OR,
43
+ AND,
44
+ EQ,
45
+ NEQ,
46
+ GT,
47
+ GTE,
48
+ LT,
49
+ LTE,
50
+ LIKE,
51
+ GLOB,
52
+ IS_NULL,
53
+ IS_NOT_NULL,
54
+ }
55
+ enum SortingMode {
56
+ ASCENDING,
57
+ DESCENDING,
58
+ }
59
+ function error_quark(): GLib.Quark;
60
+ interface AdapterCallback {
61
+ (adapter: Adapter): void;
62
+ }
63
+ interface RepositoryMigrator {
64
+ (repository: Repository, adapter: Adapter, version: number): boolean;
65
+ }
66
+ interface ResourceFromBytesFunc {
67
+ (bytes: GLib.Bytes | Uint8Array, value: GObject.Value | any): void;
68
+ }
69
+ interface ResourceToBytesFunc {
70
+ (value: GObject.Value | any): GLib.Bytes;
71
+ }
72
+ module Adapter {
73
+ // Constructor properties interface
74
+
75
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
76
+ }
77
+
78
+ class Adapter extends GObject.Object {
79
+ static $gtype: GObject.GType<Adapter>;
80
+
81
+ // Constructors of Gom.Adapter
82
+
83
+ constructor(properties?: Partial<Adapter.ConstructorProps>, ...args: any[]);
84
+
85
+ _init(...args: any[]): void;
86
+
87
+ static ['new'](): Adapter;
88
+
89
+ // Own methods of Gom.Adapter
90
+
91
+ close_async(callback?: Gio.AsyncReadyCallback<this> | null): void;
92
+ close_finish(result: Gio.AsyncResult): boolean;
93
+ close_sync(): boolean;
94
+ /**
95
+ * This is a helper function to make simple execution of SQL easier.
96
+ * It is primarily meant for things like "BEGIN;" and "COMMIT;".
97
+ *
98
+ * This MUST be called from within a write transaction using
99
+ * gom_adapter_queue_write().
100
+ * @param sql SQL to execute.
101
+ * @returns %TRUE if successful;
102
+ */
103
+ execute_sql(sql: string): boolean;
104
+ /**
105
+ * Fetches the sqlite3 structure used by the adapter.
106
+ * @returns A handle to the #sqlite3 structure. Side effects: None.
107
+ */
108
+ get_handle(): any | null;
109
+ /**
110
+ * Opens the database pointed to by `uri`. `uri` can be in any format understood
111
+ * by SQLite. See <ulink type="http" url="http://www.sqlite.org/c3ref/open.html">http://www.sqlite.org/c3ref/open.html</ulink>
112
+ * for details.
113
+ * @param uri a URI understood by SQLite
114
+ * @param callback the function to call when the operation finished, or %NULL
115
+ */
116
+ open_async(uri: string, callback?: Gio.AsyncReadyCallback<this> | null): void;
117
+ open_finish(result: Gio.AsyncResult): boolean;
118
+ open_sync(uri: string): boolean;
119
+ /**
120
+ * Queues a callback to be executed within the SQLite thread. The callback is
121
+ * expected to perform reads only.
122
+ * @param callback A callback to execute read queries on SQLite.
123
+ */
124
+ queue_read(callback: AdapterCallback): void;
125
+ /**
126
+ * Queues a callback to be executed within the SQLite thwrite. The callback can
127
+ * perform reads and writes.
128
+ * @param callback A callback to execute write queries on SQLite.
129
+ */
130
+ queue_write(callback: AdapterCallback): void;
131
+ }
132
+
133
+ module Command {
134
+ // Constructor properties interface
135
+
136
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
137
+ adapter: Adapter;
138
+ sql: string;
139
+ }
140
+ }
141
+
142
+ class Command extends GObject.Object {
143
+ static $gtype: GObject.GType<Command>;
144
+
145
+ // Own properties of Gom.Command
146
+
147
+ get adapter(): Adapter;
148
+ set sql(val: string);
149
+
150
+ // Constructors of Gom.Command
151
+
152
+ constructor(properties?: Partial<Command.ConstructorProps>, ...args: any[]);
153
+
154
+ _init(...args: any[]): void;
155
+
156
+ // Own methods of Gom.Command
157
+
158
+ execute(cursor: Cursor): boolean;
159
+ get_param_index(param_name: string): number;
160
+ reset(): void;
161
+ set_param(param: number, value: GObject.Value | any): void;
162
+ set_param_double(param: number, value: number): void;
163
+ set_param_float(param: number, value: number): void;
164
+ set_param_int(param: number, value: number): void;
165
+ set_param_int64(param: number, value: number): void;
166
+ set_param_string(param: number, value: string): void;
167
+ set_param_uint(param: number, value: number): void;
168
+ set_param_uint64(param: number, value: number): void;
169
+ set_sql(sql: string): void;
170
+ }
171
+
172
+ module CommandBuilder {
173
+ // Constructor properties interface
174
+
175
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
176
+ adapter: Adapter;
177
+ filter: Filter;
178
+ limit: number;
179
+ m2m_table: string;
180
+ m2mTable: string;
181
+ m2m_type: GObject.GType;
182
+ m2mType: GObject.GType;
183
+ offset: number;
184
+ resource_type: GObject.GType;
185
+ resourceType: GObject.GType;
186
+ sorting: Sorting;
187
+ }
188
+ }
189
+
190
+ class CommandBuilder extends GObject.Object {
191
+ static $gtype: GObject.GType<CommandBuilder>;
192
+
193
+ // Own properties of Gom.CommandBuilder
194
+
195
+ get adapter(): Adapter;
196
+ get filter(): Filter;
197
+ set filter(val: Filter);
198
+ get limit(): number;
199
+ set limit(val: number);
200
+ get m2m_table(): string;
201
+ get m2mTable(): string;
202
+ get m2m_type(): GObject.GType;
203
+ get m2mType(): GObject.GType;
204
+ get offset(): number;
205
+ set offset(val: number);
206
+ get resource_type(): GObject.GType;
207
+ set resource_type(val: GObject.GType);
208
+ get resourceType(): GObject.GType;
209
+ set resourceType(val: GObject.GType);
210
+ get sorting(): Sorting;
211
+ set sorting(val: Sorting);
212
+
213
+ // Constructors of Gom.CommandBuilder
214
+
215
+ constructor(properties?: Partial<CommandBuilder.ConstructorProps>, ...args: any[]);
216
+
217
+ _init(...args: any[]): void;
218
+
219
+ // Own methods of Gom.CommandBuilder
220
+
221
+ /**
222
+ * Builds a new command that will count the number of rows matching the
223
+ * current query parameters.
224
+ * @returns A #GomCommand.
225
+ */
226
+ build_count(): Command;
227
+ /**
228
+ * Builds a list of #GomCommand to update the table for the
229
+ * resource_type associated with `builder` up to `version`.
230
+ * @param version the version of the database.
231
+ * @returns A #GList of #GomCommand.
232
+ */
233
+ build_create(version: number): Command[];
234
+ /**
235
+ * Builds a new #GomCommand to delete the rows matching the current query
236
+ * params.
237
+ * @returns A #GomCommand.
238
+ */
239
+ build_delete(): Command;
240
+ /**
241
+ * Builds a new #GomCommand that will insert the parameters of the resource
242
+ * into the underlying database.
243
+ * @param resource a #GomResource
244
+ * @returns A #GomCommand.
245
+ */
246
+ build_insert(resource: Resource): Command;
247
+ /**
248
+ * Builds a #GomCommand that will select all the rows matching the current
249
+ * query params.
250
+ * @returns A #GomCommand.
251
+ */
252
+ build_select(): Command;
253
+ /**
254
+ * Builds a new #GomCommand that will update the contents stored for `resource`
255
+ * in the underlying database.
256
+ * @param resource a #GomResource
257
+ * @returns A #GomCommand.
258
+ */
259
+ build_update(resource: Resource): Command;
260
+ }
261
+
262
+ module Cursor {
263
+ // Constructor properties interface
264
+
265
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
266
+ statement: any;
267
+ }
268
+ }
269
+
270
+ class Cursor extends GObject.Object {
271
+ static $gtype: GObject.GType<Cursor>;
272
+
273
+ // Own properties of Gom.Cursor
274
+
275
+ get statement(): any;
276
+
277
+ // Constructors of Gom.Cursor
278
+
279
+ constructor(properties?: Partial<Cursor.ConstructorProps>, ...args: any[]);
280
+
281
+ _init(...args: any[]): void;
282
+
283
+ // Own methods of Gom.Cursor
284
+
285
+ get_column(column: number, value: GObject.Value | any): void;
286
+ get_column_boolean(column: number): boolean;
287
+ get_column_double(column: number): number;
288
+ get_column_float(column: number): number;
289
+ get_column_int(column: number): number;
290
+ get_column_int64(column: number): number;
291
+ get_column_name(column: number): string;
292
+ get_column_string(column: number): string;
293
+ get_column_uint(column: number): number;
294
+ get_column_uint64(column: number): number;
295
+ get_n_columns(): number;
296
+ next(): boolean;
297
+ }
298
+
299
+ module Filter {
300
+ // Constructor properties interface
301
+
302
+ interface ConstructorProps extends GObject.InitiallyUnowned.ConstructorProps {
303
+ mode: FilterMode;
304
+ sql: string;
305
+ }
306
+ }
307
+
308
+ class Filter extends GObject.InitiallyUnowned {
309
+ static $gtype: GObject.GType<Filter>;
310
+
311
+ // Own properties of Gom.Filter
312
+
313
+ get mode(): FilterMode;
314
+ set sql(val: string);
315
+
316
+ // Constructors of Gom.Filter
317
+
318
+ constructor(properties?: Partial<Filter.ConstructorProps>, ...args: any[]);
319
+
320
+ _init(...args: any[]): void;
321
+
322
+ static new_and(left: Filter, right: Filter): Filter;
323
+
324
+ static new_and_fullv(filter_array: Filter): Filter;
325
+
326
+ static new_eq(resource_type: GObject.GType, property_name: string, value: GObject.Value | any): Filter;
327
+
328
+ static new_glob(resource_type: GObject.GType, property_name: string, value: GObject.Value | any): Filter;
329
+
330
+ static new_gt(resource_type: GObject.GType, property_name: string, value: GObject.Value | any): Filter;
331
+
332
+ static new_gte(resource_type: GObject.GType, property_name: string, value: GObject.Value | any): Filter;
333
+
334
+ static new_is_not_null(resource_type: GObject.GType, property_name: string): Filter;
335
+
336
+ static new_is_null(resource_type: GObject.GType, property_name: string): Filter;
337
+
338
+ static new_like(resource_type: GObject.GType, property_name: string, value: GObject.Value | any): Filter;
339
+
340
+ static new_lt(resource_type: GObject.GType, property_name: string, value: GObject.Value | any): Filter;
341
+
342
+ static new_lte(resource_type: GObject.GType, property_name: string, value: GObject.Value | any): Filter;
343
+
344
+ static new_neq(resource_type: GObject.GType, property_name: string, value: GObject.Value | any): Filter;
345
+
346
+ static new_or(left: Filter, right: Filter): Filter;
347
+
348
+ static new_or_fullv(filter_array: Filter): Filter;
349
+
350
+ static new_sql(sql: string, values: (GObject.Value | any)[]): Filter;
351
+
352
+ // Own methods of Gom.Filter
353
+
354
+ get_sql(table_map: { [key: string]: any } | GLib.HashTable<any, any>): string;
355
+ /**
356
+ * Fetches the list of values that should be applied in order when building
357
+ * the #GomCommand.
358
+ * @returns An array of values for the SQL.
359
+ */
360
+ get_values(): unknown[];
361
+ }
362
+
363
+ module Repository {
364
+ // Constructor properties interface
365
+
366
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
367
+ adapter: Adapter;
368
+ }
369
+ }
370
+
371
+ class Repository extends GObject.Object {
372
+ static $gtype: GObject.GType<Repository>;
373
+
374
+ // Own properties of Gom.Repository
375
+
376
+ get adapter(): Adapter;
377
+
378
+ // Constructors of Gom.Repository
379
+
380
+ constructor(properties?: Partial<Repository.ConstructorProps>, ...args: any[]);
381
+
382
+ _init(...args: any[]): void;
383
+
384
+ static ['new'](adapter: Adapter): Repository;
385
+
386
+ // Own methods of Gom.Repository
387
+
388
+ /**
389
+ * Performs an automatic migration on the underlying database. See
390
+ * gom_repository_automatic_migrate_sync() for details.
391
+ *
392
+ * Upon completion, `callback` will be executed and it must call
393
+ * gom_repository_automatic_migrate_finish().
394
+ * @param version The version to migrate to.
395
+ * @param object_types a #GList of #GType
396
+ * @param callback A callback to execute upon completion.
397
+ */
398
+ automatic_migrate_async(
399
+ version: number,
400
+ object_types: GObject.GType[],
401
+ callback?: Gio.AsyncReadyCallback<this> | null,
402
+ ): void;
403
+ automatic_migrate_finish(result: Gio.AsyncResult): boolean;
404
+ /**
405
+ * Performs an automatic migration on the underlying database. For
406
+ * each of the #GType passed in `object_types,` the table will be
407
+ * created if necessary, and each of the columns corresponding to
408
+ * properties will be added if needed.
409
+ * @param version The version to migrate to.
410
+ * @param object_types a #GList of #GType
411
+ * @returns #TRUE in case of success.
412
+ */
413
+ automatic_migrate_sync(version: number, object_types: GObject.GType[]): boolean;
414
+ find_async(resource_type: GObject.GType, filter: Filter, callback?: Gio.AsyncReadyCallback<this> | null): void;
415
+ /**
416
+ * Completes an asynchronous request to fetch a group of resources.
417
+ * @param result A #GAsyncResult.
418
+ * @returns A #GomResourceGroup.
419
+ */
420
+ find_finish(result: Gio.AsyncResult): ResourceGroup;
421
+ find_one_async(
422
+ resource_type: GObject.GType,
423
+ filter: Filter,
424
+ callback?: Gio.AsyncReadyCallback<this> | null,
425
+ ): void;
426
+ /**
427
+ * Completes an asynchronous request to find a single resource in the
428
+ * repository. See gom_repository_find_one_async() for more info.
429
+ * @param result A #GAsyncResult.
430
+ * @returns A #GomResource if successful, otherwise %NULL.
431
+ */
432
+ find_one_finish(result: Gio.AsyncResult): Resource;
433
+ /**
434
+ * Synchronous version of gom_repository_find_async().
435
+ * @param resource_type A #GType of the resource to lookup.
436
+ * @param filter A #GomFilter to apply to your search.
437
+ * @returns A #GomResource or %NULL.
438
+ */
439
+ find_one_sync(resource_type: GObject.GType, filter?: Filter | null): Resource;
440
+ find_sorted_async(
441
+ resource_type: GObject.GType,
442
+ filter: Filter,
443
+ sorting: Sorting,
444
+ callback?: Gio.AsyncReadyCallback<this> | null,
445
+ ): void;
446
+ /**
447
+ * Synchronously queries the #GomRepository for objects matching the
448
+ * requested query. This must only be run from a callback provided to
449
+ * gom_adapter_queue_read().
450
+ * @param resource_type The #GType of the resources to query.
451
+ * @param filter An optional filter for the query.
452
+ * @param sorting An optional #GomSorting to order the query results.
453
+ * @returns A #GomResourceGroup or %NULL.
454
+ */
455
+ find_sorted_sync(resource_type: GObject.GType, filter?: Filter | null, sorting?: Sorting | null): ResourceGroup;
456
+ /**
457
+ * Synchronously queries the #GomRepository for objects matching the
458
+ * requested query. This must only be run from a callback provided to
459
+ * gom_adapter_queue_read().
460
+ * @param resource_type The #GType of the resources to query.
461
+ * @param filter An optional filter for the query.
462
+ * @returns A #GomResourceGroup or %NULL.
463
+ */
464
+ find_sync(resource_type: GObject.GType, filter?: Filter | null): ResourceGroup;
465
+ /**
466
+ * Fetches the underlying adapter.
467
+ * @returns A #GomAdapter.
468
+ */
469
+ get_adapter(): Adapter;
470
+ /**
471
+ * Asynchronously performs a migration on the underlying database. This will
472
+ * call `migrator` from the SQLite thread for each migration to perform.
473
+ *
474
+ * Upon completion, `callback` will be executed and it must call
475
+ * gom_repository_migrate_finish().
476
+ * @param version The version to migrate to.
477
+ * @param migrator A function to perform the migrations.
478
+ * @param callback A callback to execute upon completion.
479
+ */
480
+ migrate_async(
481
+ version: number,
482
+ migrator: RepositoryMigrator,
483
+ callback?: Gio.AsyncReadyCallback<this> | null,
484
+ ): void;
485
+ migrate_finish(result: Gio.AsyncResult): boolean;
486
+ /**
487
+ * Performs a migration on the underlying database. This will
488
+ * call `migrator` from the SQLite thread for each migration to perform.
489
+ * @param version The version to migrate to.
490
+ * @param migrator A function to perform the migrations.
491
+ * @returns #TRUE in case of success.
492
+ */
493
+ migrate_sync(version: number, migrator: RepositoryMigrator): boolean;
494
+ }
495
+
496
+ module Resource {
497
+ // Constructor properties interface
498
+
499
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
500
+ repository: Repository;
501
+ }
502
+ }
503
+
504
+ abstract class Resource extends GObject.Object {
505
+ static $gtype: GObject.GType<Resource>;
506
+
507
+ // Own properties of Gom.Resource
508
+
509
+ get repository(): Repository;
510
+ set repository(val: Repository);
511
+
512
+ // Constructors of Gom.Resource
513
+
514
+ constructor(properties?: Partial<Resource.ConstructorProps>, ...args: any[]);
515
+
516
+ _init(...args: any[]): void;
517
+
518
+ // Own static methods of Gom.Resource
519
+
520
+ static from_bytes_func_quark(): GLib.Quark;
521
+ static new_in_version_quark(): GLib.Quark;
522
+ static not_mapped_quark(): GLib.Quark;
523
+ static notnull(): GLib.Quark;
524
+ static ref_property_name(): GLib.Quark;
525
+ static ref_table_class(): GLib.Quark;
526
+ static to_bytes_func_quark(): GLib.Quark;
527
+ static unique(): GLib.Quark;
528
+ static set_notnull(property_name: string): void;
529
+ static set_primary_key(primary_key: string): void;
530
+ static set_property_from_bytes(property_name: string, from_bytes_func: ResourceFromBytesFunc): void;
531
+ static set_property_new_in_version(property_name: string, version: number): void;
532
+ static set_property_set_mapped(property_name: string, is_mapped: boolean): void;
533
+ static set_property_to_bytes(property_name: string, to_bytes_func: ResourceToBytesFunc): void;
534
+ static set_reference(property_name: string, ref_table_name: string, ref_property_name: string): void;
535
+ static set_table(table: string): void;
536
+ static set_unique(property_name: string): void;
537
+
538
+ // Own methods of Gom.Resource
539
+
540
+ delete_async(callback?: Gio.AsyncReadyCallback<this> | null): void;
541
+ delete_finish(result: Gio.AsyncResult): boolean;
542
+ /**
543
+ * Synchronously deletes a resource. This may only be called from inside a
544
+ * callback to gom_adapter_queue_write().
545
+ * @returns %TRUE if successful; otherwise %FALSE and @error is set.
546
+ */
547
+ delete_sync(): boolean;
548
+ fetch_m2m_async(
549
+ resource_type: GObject.GType,
550
+ m2m_table: string,
551
+ filter: Filter,
552
+ callback?: Gio.AsyncReadyCallback<this> | null,
553
+ ): void;
554
+ /**
555
+ * Completes the asynchronous request to fetch a group of resources that
556
+ * are related to the resource through a many-to-many table.
557
+ * @param result A #GAsyncResult.
558
+ * @returns A #GomResourceGroup.
559
+ */
560
+ fetch_m2m_finish(result: Gio.AsyncResult): ResourceGroup;
561
+ save_async(callback?: Gio.AsyncReadyCallback<this> | null): void;
562
+ save_finish(result: Gio.AsyncResult): boolean;
563
+ save_sync(): boolean;
564
+ }
565
+
566
+ module ResourceGroup {
567
+ // Constructor properties interface
568
+
569
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
570
+ count: number;
571
+ filter: Filter;
572
+ is_writable: boolean;
573
+ isWritable: boolean;
574
+ m2m_table: string;
575
+ m2mTable: string;
576
+ m2m_type: GObject.GType;
577
+ m2mType: GObject.GType;
578
+ repository: Repository;
579
+ resource_type: GObject.GType;
580
+ resourceType: GObject.GType;
581
+ sorting: Sorting;
582
+ }
583
+ }
584
+
585
+ class ResourceGroup extends GObject.Object {
586
+ static $gtype: GObject.GType<ResourceGroup>;
587
+
588
+ // Own properties of Gom.ResourceGroup
589
+
590
+ get count(): number;
591
+ get filter(): Filter;
592
+ get is_writable(): boolean;
593
+ get isWritable(): boolean;
594
+ get m2m_table(): string;
595
+ get m2mTable(): string;
596
+ get m2m_type(): GObject.GType;
597
+ get m2mType(): GObject.GType;
598
+ get repository(): Repository;
599
+ get resource_type(): GObject.GType;
600
+ get resourceType(): GObject.GType;
601
+ get sorting(): Sorting;
602
+
603
+ // Constructors of Gom.ResourceGroup
604
+
605
+ constructor(properties?: Partial<ResourceGroup.ConstructorProps>, ...args: any[]);
606
+
607
+ _init(...args: any[]): void;
608
+
609
+ static ['new'](repository: Repository): ResourceGroup;
610
+
611
+ // Own methods of Gom.ResourceGroup
612
+
613
+ append(resource: Resource): boolean;
614
+ delete_async(callback?: Gio.AsyncReadyCallback<this> | null): void;
615
+ delete_finish(result: Gio.AsyncResult): boolean;
616
+ delete_sync(): boolean;
617
+ fetch_async(index_: number, count: number, callback?: Gio.AsyncReadyCallback<this> | null): void;
618
+ fetch_finish(result: Gio.AsyncResult): boolean;
619
+ /**
620
+ * Fetches a sequence of resources from the group synchronously. This must
621
+ * be called from an adapter read callback using gom_adapter_queue_read().
622
+ * @param index_ The first index to fetch.
623
+ * @param count The number of indexes to fetch.
624
+ * @returns %TRUE if successful; otherwise %FALSE and @error is set.
625
+ */
626
+ fetch_sync(index_: number, count: number): boolean;
627
+ get_count(): number;
628
+ /**
629
+ * Fetches the resource at `index_`. You must have loaded that resource by
630
+ * calling gom_resource_group_fetch_async() with a range inclusive of the
631
+ * index.
632
+ * @param index_ The index of the resource.
633
+ * @returns A #GomResource.
634
+ */
635
+ get_index(index_: number): Resource;
636
+ get_m2m_table(): string;
637
+ write_async(callback?: Gio.AsyncReadyCallback<this> | null): void;
638
+ write_finish(result: Gio.AsyncResult): boolean;
639
+ write_sync(): boolean;
640
+ }
641
+
642
+ module Sorting {
643
+ // Constructor properties interface
644
+
645
+ interface ConstructorProps extends GObject.InitiallyUnowned.ConstructorProps {}
646
+ }
647
+
648
+ class Sorting extends GObject.InitiallyUnowned {
649
+ static $gtype: GObject.GType<Sorting>;
650
+
651
+ // Constructors of Gom.Sorting
652
+
653
+ constructor(properties?: Partial<Sorting.ConstructorProps>, ...args: any[]);
654
+
655
+ _init(...args: any[]): void;
656
+
657
+ // Own methods of Gom.Sorting
658
+
659
+ /**
660
+ * Add a new ORDER BY clause to the sorting object.
661
+ *
662
+ * This allows chaining ORDER BY clauses, adding them one at a time, rather
663
+ * than passing them all to the constructor.
664
+ *
665
+ * Example:
666
+ *
667
+ * ```c
668
+ * GomSorting *sorting = g_object_new (GOM_TYPE_SORTING, NULL);
669
+ * gom_sorting_add (sorting, EPISODE_TYPE_RESOURCE, "season-number",
670
+ * GOM_SORTING_DESCENDING);
671
+ * gom_sorting_add (sorting, EPISODE_TYPE_RESOURCE, "episode-number",
672
+ * GOM_SORTING_ASCENDING);
673
+ * ```
674
+ *
675
+ *
676
+ * The above example maps to the following SQL statement:
677
+ *
678
+ * ```<!-- language="SQL" -->
679
+ * ORDER BY 'episodes'.'season-number' DESC, 'episodes'.'episode-number'
680
+ * ```
681
+ *
682
+ * @param resource_type A subclass of #GomResource.
683
+ * @param property_name A string.
684
+ * @param sorting_mode A #GomSortingMode.
685
+ */
686
+ add(resource_type: GObject.GType, property_name: string, sorting_mode: SortingMode): void;
687
+ get_sql(table_map: { [key: string]: any } | GLib.HashTable<any, any>): string;
688
+ }
689
+
690
+ type AdapterClass = typeof Adapter;
691
+ abstract class AdapterPrivate {
692
+ static $gtype: GObject.GType<AdapterPrivate>;
693
+
694
+ // Constructors of Gom.AdapterPrivate
695
+
696
+ _init(...args: any[]): void;
697
+ }
698
+
699
+ type CommandBuilderClass = typeof CommandBuilder;
700
+ abstract class CommandBuilderPrivate {
701
+ static $gtype: GObject.GType<CommandBuilderPrivate>;
702
+
703
+ // Constructors of Gom.CommandBuilderPrivate
704
+
705
+ _init(...args: any[]): void;
706
+ }
707
+
708
+ type CommandClass = typeof Command;
709
+ abstract class CommandPrivate {
710
+ static $gtype: GObject.GType<CommandPrivate>;
711
+
712
+ // Constructors of Gom.CommandPrivate
713
+
714
+ _init(...args: any[]): void;
715
+ }
716
+
717
+ type CursorClass = typeof Cursor;
718
+ abstract class CursorPrivate {
719
+ static $gtype: GObject.GType<CursorPrivate>;
720
+
721
+ // Constructors of Gom.CursorPrivate
722
+
723
+ _init(...args: any[]): void;
724
+ }
725
+
726
+ type FilterClass = typeof Filter;
727
+ abstract class FilterPrivate {
728
+ static $gtype: GObject.GType<FilterPrivate>;
729
+
730
+ // Constructors of Gom.FilterPrivate
731
+
732
+ _init(...args: any[]): void;
733
+ }
734
+
735
+ type RepositoryClass = typeof Repository;
736
+ abstract class RepositoryPrivate {
737
+ static $gtype: GObject.GType<RepositoryPrivate>;
738
+
739
+ // Constructors of Gom.RepositoryPrivate
740
+
741
+ _init(...args: any[]): void;
742
+ }
743
+
744
+ type ResourceClass = typeof Resource;
745
+ type ResourceGroupClass = typeof ResourceGroup;
746
+ abstract class ResourceGroupPrivate {
747
+ static $gtype: GObject.GType<ResourceGroupPrivate>;
748
+
749
+ // Constructors of Gom.ResourceGroupPrivate
750
+
751
+ _init(...args: any[]): void;
752
+ }
753
+
754
+ abstract class ResourcePrivate {
755
+ static $gtype: GObject.GType<ResourcePrivate>;
756
+
757
+ // Constructors of Gom.ResourcePrivate
758
+
759
+ _init(...args: any[]): void;
760
+ }
761
+
762
+ type SortingClass = typeof Sorting;
763
+ abstract class SortingPrivate {
764
+ static $gtype: GObject.GType<SortingPrivate>;
765
+
766
+ // Constructors of Gom.SortingPrivate
767
+
768
+ _init(...args: any[]): void;
769
+ }
770
+
771
+ /**
772
+ * Name of the imported GIR library
773
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
774
+ */
775
+ const __name__: string;
776
+ /**
777
+ * Version of the imported GIR library
778
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
779
+ */
780
+ const __version__: string;
781
+ }
782
+
783
+ export default Gom;
784
+ // END
package/gom-1.0.js ADDED
@@ -0,0 +1,6 @@
1
+
2
+ // @ts-expect-error
3
+ import Gom from 'gi://Gom?version=1.0';
4
+ export { Gom };
5
+ export default Gom;
6
+
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@girs/gom-1.0",
3
+ "version": "1.0.0-4.0.0",
4
+ "description": "GJS TypeScript type definitions for Gom-1.0, generated from library version 1.0.0",
5
+ "type": "module",
6
+ "module": "gom-1.0.js",
7
+ "main": "gom-1.0.js",
8
+ "exports": {
9
+ "./ambient": {
10
+ "types": "./gom-1.0-ambient.d.ts",
11
+ "import": "./gom-1.0-ambient.js",
12
+ "default": "./gom-1.0-ambient.js"
13
+ },
14
+ "./import": {
15
+ "types": "./gom-1.0-import.d.ts",
16
+ "import": "./gom-1.0-import.js",
17
+ "default": "./gom-1.0-import.js"
18
+ },
19
+ ".": {
20
+ "types": "./gom-1.0.d.ts",
21
+ "import": "./gom-1.0.js",
22
+ "default": "./gom-1.0.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "test": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit gom-1.0.d.ts"
27
+ },
28
+ "dependencies": {
29
+ "@girs/gio-2.0": "^2.77.0-4.0.0-beta.1",
30
+ "@girs/gjs": "^4.0.0-beta.1",
31
+ "@girs/glib-2.0": "^2.77.0-4.0.0-beta.1",
32
+ "@girs/gobject-2.0": "^2.77.0-4.0.0-beta.1"
33
+ },
34
+ "devDependencies": {
35
+ "typescript": "*"
36
+ },
37
+ "keywords": [
38
+ "Gir",
39
+ "TypeScript",
40
+ "types",
41
+ "GObject-Introspection",
42
+ "GJS",
43
+ "Gom-1.0"
44
+ ],
45
+ "author": "ts-for-gir",
46
+ "license": "MIT",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/gjsify/ts-for-gir.git"
50
+ },
51
+ "bugs": {
52
+ "url": "https://github.com/gjsify/ts-for-gir/issues"
53
+ },
54
+ "homepage": "https://github.com/gjsify/types/tree/main/gom-1.0#readme"
55
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ // General settings for code interpretation
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "lib": ["ESNext"],
7
+ "types": [],
8
+ "experimentalDecorators": true,
9
+ "moduleResolution": "node",
10
+ "noEmit": true,
11
+ "noEmitOnError": false,
12
+ "baseUrl": "./",
13
+ "rootDir": ".",
14
+ // General settings for code generation
15
+ "removeComments": false,
16
+ "inlineSourceMap": false,
17
+ "inlineSources": false,
18
+ "newLine": "LF"
19
+ },
20
+ "include": ["./gom-1.0.d.ts"]
21
+ }
22
+
23
+
package/typedoc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "entryPoints": ["./gom-1.0.d.ts"],
3
+ "readme": "./README.md",
4
+ "name": "Gom-1.0",
5
+ "tsconfig": "./tsconfig.json"
6
+ }
7
+