@capgo/cli 4.2.8 → 4.2.12

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/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [4.2.12](https://github.com/Cap-go/CLI/compare/v4.2.11...v4.2.12) (2024-03-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * types issue ([ad9afa1](https://github.com/Cap-go/CLI/commit/ad9afa184f35863ba0d9f942bed133ee68e9661a))
11
+
12
+ ### [4.2.11](https://github.com/Cap-go/CLI/compare/v4.2.10...v4.2.11) (2024-03-25)
13
+
14
+ ### [4.2.10](https://github.com/Cap-go/CLI/compare/v4.2.9...v4.2.10) (2024-03-25)
15
+
16
+ ### [4.2.9](https://github.com/Cap-go/CLI/compare/v4.2.8...v4.2.9) (2024-03-23)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * empty list issue ([dac8617](https://github.com/Cap-go/CLI/commit/dac86177c55c71bd3ad3bbbca7833ba30d461c33))
22
+
5
23
  ### [4.2.8](https://github.com/Cap-go/CLI/compare/v4.2.7...v4.2.8) (2024-03-23)
6
24
 
7
25
  ### [4.2.7](https://github.com/Cap-go/CLI/compare/v4.2.6...v4.2.7) (2024-03-23)
package/dist/index.js CHANGED
@@ -61137,7 +61137,7 @@ var {
61137
61137
  // package.json
61138
61138
  var package_default = {
61139
61139
  name: "@capgo/cli",
61140
- version: "4.2.8",
61140
+ version: "4.2.12",
61141
61141
  description: "A CLI to upload to capgo servers",
61142
61142
  main: "dist/index.js",
61143
61143
  bin: {
@@ -62621,8 +62621,8 @@ async function verifyUser(supabase, apikey, keymod = ["all"]) {
62621
62621
  }
62622
62622
  return userId;
62623
62623
  }
62624
- async function requireUpdateMetadata(supabase, channel2) {
62625
- const { data, error } = await supabase.from("channels").select("disableAutoUpdate").eq("name", channel2).limit(1);
62624
+ async function requireUpdateMetadata(supabase, channel2, appId) {
62625
+ const { data, error } = await supabase.from("channels").select("disableAutoUpdate").eq("name", channel2).eq("app_id", appId).limit(1);
62626
62626
  if (error) {
62627
62627
  f2.error(`Cannot check if disableAutoUpdate is required ${formatError(error)}`);
62628
62628
  program.error("");
@@ -63493,7 +63493,7 @@ async function uploadBundle(appid, options, shouldExit = true) {
63493
63493
  const userId = await verifyUser(supabase, options.apikey, ["write", "all", "upload"]);
63494
63494
  const permissions = await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appid, 2 /* upload */);
63495
63495
  await checkPlanValid(supabase, userId, options.apikey, appid, true);
63496
- const updateMetadataRequired = await requireUpdateMetadata(supabase, channel2);
63496
+ const updateMetadataRequired = await requireUpdateMetadata(supabase, channel2, appid);
63497
63497
  const { data: channelData, error: channelError } = await supabase.from("channels").select("version ( minUpdateVersion, native_packages )").eq("name", channel2).eq("app_id", appid).single();
63498
63498
  let localDependencies = void 0;
63499
63499
  let finalCompatibility;
@@ -64346,6 +64346,10 @@ async function deleteSpecificVersion(supabase, appid, _userId, bundle2) {
64346
64346
  await deleteAppVersion(supabase, appid, bundle2);
64347
64347
  }
64348
64348
  function displayBundles(data) {
64349
+ if (!data.length) {
64350
+ f2.error("No bundle found");
64351
+ process.exit(1);
64352
+ }
64349
64353
  const t = new import_console_table_printer2.Table({
64350
64354
  title: "Bundles",
64351
64355
  charLength: { "\u274C": 2, "\u2705": 2 }
@@ -64756,6 +64760,10 @@ async function currentBundle(channel2, appId, options) {
64756
64760
  var import_node_process25 = __toESM(require("node:process"));
64757
64761
  var import_console_table_printer3 = __toESM(require_dist18());
64758
64762
  function displayApp(data) {
64763
+ if (!data.length) {
64764
+ f2.error("No apps found");
64765
+ import_node_process25.default.exit(1);
64766
+ }
64759
64767
  const t = new import_console_table_printer3.Table({
64760
64768
  title: "Apps",
64761
64769
  charLength: { "\u274C": 2, "\u2705": 2 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.2.8",
3
+ "version": "4.2.12",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -33,6 +33,11 @@ export async function deleteSpecificVersion(supabase: SupabaseClient<Database>,
33
33
  }
34
34
 
35
35
  export function displayBundles(data: (Database['public']['Tables']['app_versions']['Row'] & { keep?: string })[]) {
36
+ if (!data.length) {
37
+ p.log.error('No bundle found')
38
+ // eslint-disable-next-line node/prefer-global/process
39
+ process.exit(1)
40
+ }
36
41
  const t = new Table({
37
42
  title: 'Bundles',
38
43
  charLength: { '❌': 2, '✅': 2 },
package/src/app/list.ts CHANGED
@@ -9,6 +9,10 @@ import { createSupabaseClient, findSavedKey, getHumanDate, verifyUser } from '..
9
9
  import { checkLatest } from '../api/update'
10
10
 
11
11
  function displayApp(data: Database['public']['Tables']['apps']['Row'][]) {
12
+ if (!data.length) {
13
+ p.log.error('No apps found')
14
+ process.exit(1)
15
+ }
12
16
  const t = new Table({
13
17
  title: 'Apps',
14
18
  charLength: { '❌': 2, '✅': 2 },
@@ -121,7 +121,7 @@ export async function uploadBundle(appid: string, options: Options, shouldExit =
121
121
  const permissions = await checkAppExistsAndHasPermissionOrgErr(supabase, options.apikey, appid, OrganizationPerm.upload)
122
122
  await checkPlanValid(supabase, userId, options.apikey, appid, true)
123
123
 
124
- const updateMetadataRequired = await requireUpdateMetadata(supabase, channel)
124
+ const updateMetadataRequired = await requireUpdateMetadata(supabase, channel, appid)
125
125
 
126
126
  // Check compatibility here
127
127
  const { data: channelData, error: channelError } = await supabase
@@ -164,10 +164,12 @@ export interface Database {
164
164
  minUpdateVersion: string | null
165
165
  name: string
166
166
  native_packages: Json[] | null
167
+ owner_org: string
168
+ r2_path: string | null
167
169
  session_key: string | null
168
170
  storage_provider: string
169
171
  updated_at: string | null
170
- user_id: string
172
+ user_id: string | null
171
173
  }
172
174
  Insert: {
173
175
  app_id: string
@@ -180,10 +182,12 @@ export interface Database {
180
182
  minUpdateVersion?: string | null
181
183
  name: string
182
184
  native_packages?: Json[] | null
185
+ owner_org: string
186
+ r2_path?: string | null
183
187
  session_key?: string | null
184
188
  storage_provider?: string
185
189
  updated_at?: string | null
186
- user_id: string
190
+ user_id?: string | null
187
191
  }
188
192
  Update: {
189
193
  app_id?: string
@@ -196,10 +200,12 @@ export interface Database {
196
200
  minUpdateVersion?: string | null
197
201
  name?: string
198
202
  native_packages?: Json[] | null
203
+ owner_org?: string
204
+ r2_path?: string | null
199
205
  session_key?: string | null
200
206
  storage_provider?: string
201
207
  updated_at?: string | null
202
- user_id?: string
208
+ user_id?: string | null
203
209
  }
204
210
  Relationships: [
205
211
  {
@@ -210,10 +216,10 @@ export interface Database {
210
216
  referencedColumns: ['app_id']
211
217
  },
212
218
  {
213
- foreignKeyName: 'app_versions_user_id_fkey'
214
- columns: ['user_id']
219
+ foreignKeyName: 'owner_org_id_fkey'
220
+ columns: ['owner_org']
215
221
  isOneToOne: false
216
- referencedRelation: 'users'
222
+ referencedRelation: 'orgs'
217
223
  referencedColumns: ['id']
218
224
  },
219
225
  ]
@@ -227,10 +233,10 @@ export interface Database {
227
233
  fails: number | null
228
234
  id: number
229
235
  installs: number | null
236
+ owner_org: string
230
237
  size: number
231
238
  uninstalls: number | null
232
239
  updated_at: string | null
233
- user_id: string
234
240
  }
235
241
  Insert: {
236
242
  app_id: string
@@ -240,10 +246,10 @@ export interface Database {
240
246
  fails?: number | null
241
247
  id?: number
242
248
  installs?: number | null
249
+ owner_org: string
243
250
  size: number
244
251
  uninstalls?: number | null
245
252
  updated_at?: string | null
246
- user_id: string
247
253
  }
248
254
  Update: {
249
255
  app_id?: string
@@ -253,10 +259,10 @@ export interface Database {
253
259
  fails?: number | null
254
260
  id?: number
255
261
  installs?: number | null
262
+ owner_org?: string
256
263
  size?: number
257
264
  uninstalls?: number | null
258
265
  updated_at?: string | null
259
- user_id?: string
260
266
  }
261
267
  Relationships: [
262
268
  {
@@ -274,10 +280,10 @@ export interface Database {
274
280
  referencedColumns: ['id']
275
281
  },
276
282
  {
277
- foreignKeyName: 'app_versions_meta_user_id_fkey'
278
- columns: ['user_id']
283
+ foreignKeyName: 'owner_org_id_fkey'
284
+ columns: ['owner_org']
279
285
  isOneToOne: false
280
- referencedRelation: 'users'
286
+ referencedRelation: 'orgs'
281
287
  referencedColumns: ['id']
282
288
  },
283
289
  ]
@@ -290,9 +296,10 @@ export interface Database {
290
296
  id: string | null
291
297
  last_version: string | null
292
298
  name: string | null
299
+ owner_org: string
293
300
  retention: number
294
301
  updated_at: string | null
295
- user_id: string
302
+ user_id: string | null
296
303
  }
297
304
  Insert: {
298
305
  app_id: string
@@ -301,9 +308,10 @@ export interface Database {
301
308
  id?: string | null
302
309
  last_version?: string | null
303
310
  name?: string | null
311
+ owner_org: string
304
312
  retention?: number
305
313
  updated_at?: string | null
306
- user_id: string
314
+ user_id?: string | null
307
315
  }
308
316
  Update: {
309
317
  app_id?: string
@@ -312,9 +320,10 @@ export interface Database {
312
320
  id?: string | null
313
321
  last_version?: string | null
314
322
  name?: string | null
323
+ owner_org?: string
315
324
  retention?: number
316
325
  updated_at?: string | null
317
- user_id?: string
326
+ user_id?: string | null
318
327
  }
319
328
  Relationships: [
320
329
  {
@@ -324,34 +333,53 @@ export interface Database {
324
333
  referencedRelation: 'users'
325
334
  referencedColumns: ['id']
326
335
  },
336
+ {
337
+ foreignKeyName: 'owner_org_id_fkey'
338
+ columns: ['owner_org']
339
+ isOneToOne: false
340
+ referencedRelation: 'orgs'
341
+ referencedColumns: ['id']
342
+ },
327
343
  ]
328
344
  }
345
+ auth_uid: {
346
+ Row: {
347
+ uid: string | null
348
+ }
349
+ Insert: {
350
+ uid?: string | null
351
+ }
352
+ Update: {
353
+ uid?: string | null
354
+ }
355
+ Relationships: []
356
+ }
329
357
  channel_devices: {
330
358
  Row: {
331
359
  app_id: string
332
360
  channel_id: number
333
361
  created_at: string | null
334
- created_by: string
335
362
  device_id: string
336
363
  id: number
364
+ owner_org: string
337
365
  updated_at: string
338
366
  }
339
367
  Insert: {
340
368
  app_id: string
341
369
  channel_id: number
342
370
  created_at?: string | null
343
- created_by: string
344
371
  device_id: string
345
372
  id?: number
373
+ owner_org: string
346
374
  updated_at?: string
347
375
  }
348
376
  Update: {
349
377
  app_id?: string
350
378
  channel_id?: number
351
379
  created_at?: string | null
352
- created_by?: string
353
380
  device_id?: string
354
381
  id?: number
382
+ owner_org?: string
355
383
  updated_at?: string
356
384
  }
357
385
  Relationships: [
@@ -370,10 +398,10 @@ export interface Database {
370
398
  referencedColumns: ['id']
371
399
  },
372
400
  {
373
- foreignKeyName: 'channel_devices_created_by_fkey'
374
- columns: ['created_by']
401
+ foreignKeyName: 'owner_org_id_fkey'
402
+ columns: ['owner_org']
375
403
  isOneToOne: false
376
- referencedRelation: 'users'
404
+ referencedRelation: 'orgs'
377
405
  referencedColumns: ['id']
378
406
  },
379
407
  ]
@@ -387,7 +415,7 @@ export interface Database {
387
415
  app_id: string
388
416
  beta: boolean
389
417
  created_at: string
390
- created_by: string
418
+ created_by: string | null
391
419
  disableAutoUpdate: Database['public']['Enums']['disable_update']
392
420
  disableAutoUpdateUnderNative: boolean
393
421
  enable_progressive_deploy: boolean
@@ -395,6 +423,7 @@ export interface Database {
395
423
  id: number
396
424
  ios: boolean
397
425
  name: string
426
+ owner_org: string
398
427
  public: boolean
399
428
  secondaryVersionPercentage: number
400
429
  secondVersion: number | null
@@ -409,7 +438,7 @@ export interface Database {
409
438
  app_id: string
410
439
  beta?: boolean
411
440
  created_at?: string
412
- created_by: string
441
+ created_by?: string | null
413
442
  disableAutoUpdate?: Database['public']['Enums']['disable_update']
414
443
  disableAutoUpdateUnderNative?: boolean
415
444
  enable_progressive_deploy?: boolean
@@ -417,6 +446,7 @@ export interface Database {
417
446
  id?: number
418
447
  ios?: boolean
419
448
  name: string
449
+ owner_org: string
420
450
  public?: boolean
421
451
  secondaryVersionPercentage?: number
422
452
  secondVersion?: number | null
@@ -431,7 +461,7 @@ export interface Database {
431
461
  app_id?: string
432
462
  beta?: boolean
433
463
  created_at?: string
434
- created_by?: string
464
+ created_by?: string | null
435
465
  disableAutoUpdate?: Database['public']['Enums']['disable_update']
436
466
  disableAutoUpdateUnderNative?: boolean
437
467
  enable_progressive_deploy?: boolean
@@ -439,6 +469,7 @@ export interface Database {
439
469
  id?: number
440
470
  ios?: boolean
441
471
  name?: string
472
+ owner_org?: string
442
473
  public?: boolean
443
474
  secondaryVersionPercentage?: number
444
475
  secondVersion?: number | null
@@ -453,13 +484,6 @@ export interface Database {
453
484
  referencedRelation: 'apps'
454
485
  referencedColumns: ['app_id']
455
486
  },
456
- {
457
- foreignKeyName: 'channels_created_by_fkey'
458
- columns: ['created_by']
459
- isOneToOne: false
460
- referencedRelation: 'users'
461
- referencedColumns: ['id']
462
- },
463
487
  {
464
488
  foreignKeyName: 'channels_secondVersion_fkey'
465
489
  columns: ['secondVersion']
@@ -474,6 +498,13 @@ export interface Database {
474
498
  referencedRelation: 'app_versions'
475
499
  referencedColumns: ['id']
476
500
  },
501
+ {
502
+ foreignKeyName: 'owner_org_id_fkey'
503
+ columns: ['owner_org']
504
+ isOneToOne: false
505
+ referencedRelation: 'orgs'
506
+ referencedColumns: ['id']
507
+ },
477
508
  ]
478
509
  }
479
510
  clickhouse_app_usage: {
@@ -515,6 +546,129 @@ export interface Database {
515
546
  }
516
547
  Relationships: []
517
548
  }
549
+ clickhouse_app_usage_parm: {
550
+ Row: {
551
+ _app_list: string | null
552
+ _end_date: string | null
553
+ _start_date: string | null
554
+ app_id: string | null
555
+ bandwidth: number | null
556
+ date: string | null
557
+ fail: number | null
558
+ get: number | null
559
+ install: number | null
560
+ mau: number | null
561
+ storage_added: number | null
562
+ storage_deleted: number | null
563
+ uninstall: number | null
564
+ }
565
+ Insert: {
566
+ _app_list?: string | null
567
+ _end_date?: string | null
568
+ _start_date?: string | null
569
+ app_id?: string | null
570
+ bandwidth?: number | null
571
+ date?: string | null
572
+ fail?: number | null
573
+ get?: number | null
574
+ install?: number | null
575
+ mau?: number | null
576
+ storage_added?: number | null
577
+ storage_deleted?: number | null
578
+ uninstall?: number | null
579
+ }
580
+ Update: {
581
+ _app_list?: string | null
582
+ _end_date?: string | null
583
+ _start_date?: string | null
584
+ app_id?: string | null
585
+ bandwidth?: number | null
586
+ date?: string | null
587
+ fail?: number | null
588
+ get?: number | null
589
+ install?: number | null
590
+ mau?: number | null
591
+ storage_added?: number | null
592
+ storage_deleted?: number | null
593
+ uninstall?: number | null
594
+ }
595
+ Relationships: []
596
+ }
597
+ clickhouse_devices: {
598
+ Row: {
599
+ app_id: string | null
600
+ created_at: string | null
601
+ custom_id: string | null
602
+ device_id: string | null
603
+ is_emulator: boolean | null
604
+ is_prod: boolean | null
605
+ os_version: string | null
606
+ platform: string | null
607
+ plugin_version: string | null
608
+ updated_at: string | null
609
+ version: number | null
610
+ version_build: string | null
611
+ }
612
+ Insert: {
613
+ app_id?: string | null
614
+ created_at?: string | null
615
+ custom_id?: string | null
616
+ device_id?: string | null
617
+ is_emulator?: boolean | null
618
+ is_prod?: boolean | null
619
+ os_version?: string | null
620
+ platform?: string | null
621
+ plugin_version?: string | null
622
+ updated_at?: string | null
623
+ version?: number | null
624
+ version_build?: string | null
625
+ }
626
+ Update: {
627
+ app_id?: string | null
628
+ created_at?: string | null
629
+ custom_id?: string | null
630
+ device_id?: string | null
631
+ is_emulator?: boolean | null
632
+ is_prod?: boolean | null
633
+ os_version?: string | null
634
+ platform?: string | null
635
+ plugin_version?: string | null
636
+ updated_at?: string | null
637
+ version?: number | null
638
+ version_build?: string | null
639
+ }
640
+ Relationships: []
641
+ }
642
+ clickhouse_logs: {
643
+ Row: {
644
+ action: string | null
645
+ app_id: string | null
646
+ created_at: string | null
647
+ device_id: string | null
648
+ platform: string | null
649
+ version: number | null
650
+ version_build: string | null
651
+ }
652
+ Insert: {
653
+ action?: string | null
654
+ app_id?: string | null
655
+ created_at?: string | null
656
+ device_id?: string | null
657
+ platform?: string | null
658
+ version?: number | null
659
+ version_build?: string | null
660
+ }
661
+ Update: {
662
+ action?: string | null
663
+ app_id?: string | null
664
+ created_at?: string | null
665
+ device_id?: string | null
666
+ platform?: string | null
667
+ version?: number | null
668
+ version_build?: string | null
669
+ }
670
+ Relationships: []
671
+ }
518
672
  cycle_info: {
519
673
  Row: {
520
674
  subscription_anchor_end: string | null
@@ -597,27 +751,27 @@ export interface Database {
597
751
  Row: {
598
752
  app_id: string
599
753
  created_at: string | null
600
- created_by: string | null
601
754
  device_id: string
602
755
  id: number
756
+ owner_org: string
603
757
  updated_at: string | null
604
758
  version: number
605
759
  }
606
760
  Insert: {
607
761
  app_id: string
608
762
  created_at?: string | null
609
- created_by?: string | null
610
763
  device_id: string
611
764
  id?: number
765
+ owner_org: string
612
766
  updated_at?: string | null
613
767
  version: number
614
768
  }
615
769
  Update: {
616
770
  app_id?: string
617
771
  created_at?: string | null
618
- created_by?: string | null
619
772
  device_id?: string
620
773
  id?: number
774
+ owner_org?: string
621
775
  updated_at?: string | null
622
776
  version?: number
623
777
  }
@@ -630,17 +784,17 @@ export interface Database {
630
784
  referencedColumns: ['app_id']
631
785
  },
632
786
  {
633
- foreignKeyName: 'devices_override_created_by_fkey'
634
- columns: ['created_by']
787
+ foreignKeyName: 'devices_override_version_fkey'
788
+ columns: ['version']
635
789
  isOneToOne: false
636
- referencedRelation: 'users'
790
+ referencedRelation: 'app_versions'
637
791
  referencedColumns: ['id']
638
792
  },
639
793
  {
640
- foreignKeyName: 'devices_override_version_fkey'
641
- columns: ['version']
794
+ foreignKeyName: 'owner_org_id_fkey'
795
+ columns: ['owner_org']
642
796
  isOneToOne: false
643
- referencedRelation: 'app_versions'
797
+ referencedRelation: 'orgs'
644
798
  referencedColumns: ['id']
645
799
  },
646
800
  ]
@@ -966,105 +1120,6 @@ export interface Database {
966
1120
  }
967
1121
  Relationships: []
968
1122
  }
969
- store_apps: {
970
- Row: {
971
- app_id: string
972
- capacitor: boolean
973
- capgo: boolean
974
- category: string
975
- cordova: boolean
976
- created_at: string | null
977
- developer: string
978
- developer_email: string
979
- developer_id: string | null
980
- error_get_framework: string
981
- error_get_info: string
982
- error_get_similar: string
983
- flutter: boolean
984
- free: boolean
985
- icon: string
986
- installs: number
987
- kotlin: boolean
988
- lang: string | null
989
- native_script: boolean
990
- onprem: boolean
991
- react_native: boolean
992
- score: number
993
- summary: string
994
- title: string
995
- to_get_framework: boolean
996
- to_get_info: boolean
997
- to_get_similar: boolean
998
- updated_at: string
999
- updates: number
1000
- url: string
1001
- }
1002
- Insert: {
1003
- app_id: string
1004
- capacitor?: boolean
1005
- capgo?: boolean
1006
- category?: string
1007
- cordova?: boolean
1008
- created_at?: string | null
1009
- developer?: string
1010
- developer_email?: string
1011
- developer_id?: string | null
1012
- error_get_framework?: string
1013
- error_get_info?: string
1014
- error_get_similar?: string
1015
- flutter?: boolean
1016
- free?: boolean
1017
- icon?: string
1018
- installs?: number
1019
- kotlin?: boolean
1020
- lang?: string | null
1021
- native_script?: boolean
1022
- onprem?: boolean
1023
- react_native?: boolean
1024
- score?: number
1025
- summary?: string
1026
- title?: string
1027
- to_get_framework?: boolean
1028
- to_get_info?: boolean
1029
- to_get_similar?: boolean
1030
- updated_at?: string
1031
- updates?: number
1032
- url?: string
1033
- }
1034
- Update: {
1035
- app_id?: string
1036
- capacitor?: boolean
1037
- capgo?: boolean
1038
- category?: string
1039
- cordova?: boolean
1040
- created_at?: string | null
1041
- developer?: string
1042
- developer_email?: string
1043
- developer_id?: string | null
1044
- error_get_framework?: string
1045
- error_get_info?: string
1046
- error_get_similar?: string
1047
- flutter?: boolean
1048
- free?: boolean
1049
- icon?: string
1050
- installs?: number
1051
- kotlin?: boolean
1052
- lang?: string | null
1053
- native_script?: boolean
1054
- onprem?: boolean
1055
- react_native?: boolean
1056
- score?: number
1057
- summary?: string
1058
- title?: string
1059
- to_get_framework?: boolean
1060
- to_get_info?: boolean
1061
- to_get_similar?: boolean
1062
- updated_at?: string
1063
- updates?: number
1064
- url?: string
1065
- }
1066
- Relationships: []
1067
- }
1068
1123
  stripe_info: {
1069
1124
  Row: {
1070
1125
  created_at: string
@@ -1275,10 +1330,6 @@ export interface Database {
1275
1330
  }
1276
1331
  Returns: number
1277
1332
  }
1278
- count_all_apps: {
1279
- Args: Record<PropertyKey, never>
1280
- Returns: number
1281
- }
1282
1333
  count_all_need_upgrade: {
1283
1334
  Args: Record<PropertyKey, never>
1284
1335
  Returns: number
@@ -1309,10 +1360,6 @@ export interface Database {
1309
1360
  Args: Record<PropertyKey, never>
1310
1361
  Returns: number
1311
1362
  }
1312
- count_all_updates: {
1313
- Args: Record<PropertyKey, never>
1314
- Returns: number
1315
- }
1316
1363
  create_partitions: {
1317
1364
  Args: {
1318
1365
  start_date: string
@@ -1440,6 +1487,23 @@ export interface Database {
1440
1487
  Args: Record<PropertyKey, never>
1441
1488
  Returns: string
1442
1489
  }
1490
+ get_identity:
1491
+ | {
1492
+ Args: Record<PropertyKey, never>
1493
+ Returns: string
1494
+ }
1495
+ | {
1496
+ Args: {
1497
+ keymode: Database['public']['Enums']['key_mode'][]
1498
+ }
1499
+ Returns: string
1500
+ }
1501
+ get_identity_apikey_only: {
1502
+ Args: {
1503
+ keymode: Database['public']['Enums']['key_mode'][]
1504
+ }
1505
+ Returns: string
1506
+ }
1443
1507
  get_infos: {
1444
1508
  Args: {
1445
1509
  appid: string
@@ -1491,6 +1555,7 @@ export interface Database {
1491
1555
  uid: string
1492
1556
  email: string
1493
1557
  image_url: string
1558
+ role: Database['public']['Enums']['user_min_right']
1494
1559
  }[]
1495
1560
  }
1496
1561
  get_org_perm_for_apikey: {
@@ -1528,6 +1593,43 @@ export interface Database {
1528
1593
  is_canceled: boolean
1529
1594
  }[]
1530
1595
  }
1596
+ get_orgs_v4:
1597
+ | {
1598
+ Args: Record<PropertyKey, never>
1599
+ Returns: {
1600
+ gid: string
1601
+ created_by: string
1602
+ logo: string
1603
+ name: string
1604
+ role: string
1605
+ paying: boolean
1606
+ trial_left: number
1607
+ can_use_more: boolean
1608
+ is_canceled: boolean
1609
+ app_count: number
1610
+ subscription_start: string
1611
+ subscription_end: string
1612
+ }[]
1613
+ }
1614
+ | {
1615
+ Args: {
1616
+ userid: string
1617
+ }
1618
+ Returns: {
1619
+ gid: string
1620
+ created_by: string
1621
+ logo: string
1622
+ name: string
1623
+ role: string
1624
+ paying: boolean
1625
+ trial_left: number
1626
+ can_use_more: boolean
1627
+ is_canceled: boolean
1628
+ app_count: number
1629
+ subscription_start: string
1630
+ subscription_end: string
1631
+ }[]
1632
+ }
1531
1633
  get_plan_usage_percent: {
1532
1634
  Args: {
1533
1635
  userid: string
@@ -1548,6 +1650,13 @@ export interface Database {
1548
1650
  }
1549
1651
  Returns: number
1550
1652
  }
1653
+ get_total_app_storage_size_orgs: {
1654
+ Args: {
1655
+ org_id: string
1656
+ app_id: string
1657
+ }
1658
+ Returns: number
1659
+ }
1551
1660
  get_total_stats_v5: {
1552
1661
  Args: {
1553
1662
  userid: string
@@ -1582,6 +1691,12 @@ export interface Database {
1582
1691
  }
1583
1692
  Returns: number
1584
1693
  }
1694
+ get_total_storage_size_org: {
1695
+ Args: {
1696
+ org_id: string
1697
+ }
1698
+ Returns: number
1699
+ }
1585
1700
  get_usage_mode_and_last_saved: {
1586
1701
  Args: Record<PropertyKey, never>
1587
1702
  Returns: {
@@ -1632,6 +1747,14 @@ export interface Database {
1632
1747
  }
1633
1748
  Returns: boolean
1634
1749
  }
1750
+ has_app_right_userid: {
1751
+ Args: {
1752
+ appid: string
1753
+ right: Database['public']['Enums']['user_min_right']
1754
+ userid: string
1755
+ }
1756
+ Returns: boolean
1757
+ }
1635
1758
  has_min_right: {
1636
1759
  Args: {
1637
1760
  _userid: string
@@ -1656,13 +1779,6 @@ export interface Database {
1656
1779
  }
1657
1780
  Returns: number
1658
1781
  }
1659
- increment_store: {
1660
- Args: {
1661
- app_id: string
1662
- updates: number
1663
- }
1664
- Returns: undefined
1665
- }
1666
1782
  invite_user_to_org: {
1667
1783
  Args: {
1668
1784
  email: string
@@ -1948,10 +2064,12 @@ export interface Database {
1948
2064
  | 'invite_upload'
1949
2065
  | 'invite_write'
1950
2066
  | 'invite_admin'
2067
+ | 'invite_super_admin'
1951
2068
  | 'read'
1952
2069
  | 'upload'
1953
2070
  | 'write'
1954
2071
  | 'admin'
2072
+ | 'super_admin'
1955
2073
  user_role: 'read' | 'upload' | 'write' | 'admin'
1956
2074
  }
1957
2075
  CompositeTypes: {
package/src/utils.ts CHANGED
@@ -498,11 +498,12 @@ export async function verifyUser(supabase: SupabaseClient<Database>, apikey: str
498
498
  return userId
499
499
  }
500
500
 
501
- export async function requireUpdateMetadata(supabase: SupabaseClient<Database>, channel: string): Promise<boolean> {
501
+ export async function requireUpdateMetadata(supabase: SupabaseClient<Database>, channel: string, appId: string): Promise<boolean> {
502
502
  const { data, error } = await supabase
503
503
  .from('channels')
504
504
  .select('disableAutoUpdate')
505
505
  .eq('name', channel)
506
+ .eq('app_id', appId)
506
507
  .limit(1)
507
508
 
508
509
  if (error) {