@capgo/cli 3.14.4 → 3.14.6

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/src/utils.ts CHANGED
@@ -339,6 +339,26 @@ export const verifyUser = async (supabase: SupabaseClient<Database>, apikey: str
339
339
  return userId;
340
340
  }
341
341
 
342
+ export const requireUpdateMetadata = async (supabase: SupabaseClient<Database>, channel: string): Promise<boolean> => {
343
+ const { data, error } = await supabase
344
+ .from('channels')
345
+ .select('disableAutoUpdate')
346
+ .eq('name', channel)
347
+ .limit(1)
348
+
349
+ if (error) {
350
+ p.log.error(`Cannot check if disableAutoUpdate is required ${JSON.stringify(error)}`);
351
+ program.error('')
352
+ }
353
+
354
+ // Channel does not exist and the default is never 'version_number'
355
+ if (data.length === 0)
356
+ return false
357
+
358
+ const { disableAutoUpdate } = (data[0])
359
+ return disableAutoUpdate === 'version_number'
360
+ }
361
+
342
362
  export const getHumanDate = (createdA: string | null) => {
343
363
  const date = new Date(createdA || '');
344
364
  return date.toLocaleString();