From f45fa169df390b313379c0e2268d29e7da318fb7 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 5 Jun 2024 12:59:05 +0200 Subject: [PATCH 1/3] feat(dbdb): config supabase caching and data setups --- .gitmodules | 3 + lib/hypercerts-indexer | 1 + package.json | 10 +- src/types/supabaseCaching.ts | 1941 +++++++++++++++++----------------- supabase/config.toml | 16 +- 5 files changed, 1017 insertions(+), 954 deletions(-) create mode 100644 .gitmodules create mode 160000 lib/hypercerts-indexer diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0658eb7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/hypercerts-indexer"] + path = lib/hypercerts-indexer + url = https://github.com/hypercerts-org/hypercerts-indexer diff --git a/lib/hypercerts-indexer b/lib/hypercerts-indexer new file mode 160000 index 0000000..0df7a2f --- /dev/null +++ b/lib/hypercerts-indexer @@ -0,0 +1 @@ +Subproject commit 0df7a2f012c3107b0b85e5e95416eecc1e2d5884 diff --git a/package.json b/package.json index 8304c43..152814d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,15 @@ "dev": "nodemon", "build": "rimraf dist && tsoa spec-and-routes && swc src --out-dir dist --copy-files", "start": "node -r dotenv/config dist/src/index.js", - "supabase:types": "supabase gen types typescript --local > ./src/types/supabaseData.ts", + "supabase:reset:all": "concurrently \"npm run supabase:reset:data\" \"npm run supabase:reset:cache\"", + "supabase:start:all": "concurrently \"npm run supabase:start:data\" \"npm run supabase:start:cache\"", + "supabase:types:all": "concurrently \"npm run supabase:types:data\" \"npm run supabase:types:cache\"", + "supabase:reset:cache": "supabase db reset --workdir ./lib/hypercerts-indexer", + "supabase:reset:data": "supabase db reset --workdir ./", + "supabase:start:cache": "supabase start --workdir ./lib/hypercerts-indexer", + "supabase:start:data": "supabase start", + "supabase:types:cache": "supabase gen types typescript --local --workdir ./lib/hypercerts-indexer > ./src/types/supabaseCaching.ts", + "supabase:types:data": "supabase gen types typescript --local > ./src/types/supabaseData.ts", "lint": "eslint", "test": "vitest" }, diff --git a/src/types/supabaseCaching.ts b/src/types/supabaseCaching.ts index 6aeb3a7..be17eed 100644 --- a/src/types/supabaseCaching.ts +++ b/src/types/supabaseCaching.ts @@ -1,975 +1,1026 @@ export type Json = - | string - | number - | boolean - | null - | { [key: string]: Json | undefined } - | Json[] + | string + | number + | boolean + | null + | { [key: string]: Json | undefined } + | Json[] -export type CachingDatabase = { - graphql_public: { - Tables: { - [_ in never]: never - } - Views: { - [_ in never]: never - } - Functions: { - graphql: { - Args: { - operationName?: string - query?: string - variables?: Json - extensions?: Json - } - Returns: Json - } +export type Database = { + graphql_public: { + Tables: { + [_ in never]: never + } + Views: { + [_ in never]: never + } + Functions: { + graphql: { + Args: { + operationName?: string + query?: string + variables?: Json + extensions?: Json + } + Returns: Json + } + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never + } + } + public: { + Tables: { + allow_list_data: { + Row: { + data: Json | null + id: string + parsed: boolean | null + root: string | null + uri: string | null + } + Insert: { + data?: Json | null + id?: string + parsed?: boolean | null + root?: string | null + uri?: string | null + } + Update: { + data?: Json | null + id?: string + parsed?: boolean | null + root?: string | null + uri?: string | null + } + Relationships: [] + } + attestations: { + Row: { + attestation: Json + attester: string + block_timestamp: number + chain_id: number | null + claims_id: string | null + contract_address: string | null + data: Json + id: string + recipient: string + supported_schemas_id: string + token_id: number | null + uid: string + } + Insert: { + attestation: Json + attester: string + block_timestamp: number + chain_id?: number | null + claims_id?: string | null + contract_address?: string | null + data: Json + id?: string + recipient: string + supported_schemas_id: string + token_id?: number | null + uid: string + } + Update: { + attestation?: Json + attester?: string + block_timestamp?: number + chain_id?: number | null + claims_id?: string | null + contract_address?: string | null + data?: Json + id?: string + recipient?: string + supported_schemas_id?: string + token_id?: number | null + uid?: string + } + Relationships: [ + { + foreignKeyName: "attestations_claims_id_fkey" + columns: ["claims_id"] + isOneToOne: false + referencedRelation: "claims" + referencedColumns: ["id"] + }, + { + foreignKeyName: "attestations_claims_id_fkey" + columns: ["claims_id"] + isOneToOne: false + referencedRelation: "hypercert_allowlists_with_claim" + referencedColumns: ["claim_id"] + }, + { + foreignKeyName: "attestations_supported_schemas_id_fkey" + columns: ["supported_schemas_id"] + isOneToOne: false + referencedRelation: "supported_schemas" + referencedColumns: ["id"] + }, + ] + } + claims: { + Row: { + block_number: number | null + contracts_id: string + creator_address: string | null + hypercert_id: string | null + id: string + owner_address: string | null + token_id: number + units: number | null + uri: string | null + value: number | null + claim_attestation_count: number | null + } + Insert: { + block_number?: number | null + contracts_id: string + creator_address?: string | null + hypercert_id?: string | null + id?: string + owner_address?: string | null + token_id: number + units?: number | null + uri?: string | null + value?: number | null + } + Update: { + block_number?: number | null + contracts_id?: string + creator_address?: string | null + hypercert_id?: string | null + id?: string + owner_address?: string | null + token_id?: number + units?: number | null + uri?: string | null + value?: number | null + } + Relationships: [ + { + foreignKeyName: "claims_contracts_id_fkey" + columns: ["contracts_id"] + isOneToOne: false + referencedRelation: "contracts" + referencedColumns: ["id"] + }, + { + foreignKeyName: "claims_uri_fkey" + columns: ["uri"] + isOneToOne: false + referencedRelation: "metadata" + referencedColumns: ["uri"] + }, + ] + } + contract_events: { + Row: { + contracts_id: string + events_id: string + last_block_indexed: number | null + } + Insert: { + contracts_id: string + events_id: string + last_block_indexed?: number | null + } + Update: { + contracts_id?: string + events_id?: string + last_block_indexed?: number | null + } + Relationships: [ + { + foreignKeyName: "contract_events_contracts_id_fkey" + columns: ["contracts_id"] + isOneToOne: false + referencedRelation: "contracts" + referencedColumns: ["id"] + }, + { + foreignKeyName: "contract_events_events_id_fkey" + columns: ["events_id"] + isOneToOne: false + referencedRelation: "events" + referencedColumns: ["id"] + }, + ] + } + contracts: { + Row: { + chain_id: number + contract_address: string + id: string + start_block: number | null + } + Insert: { + chain_id: number + contract_address: string + id?: string + start_block?: number | null + } + Update: { + chain_id?: number + contract_address?: string + id?: string + start_block?: number | null + } + Relationships: [] + } + events: { + Row: { + abi: string + id: string + name: string + } + Insert: { + abi: string + id?: string + name: string + } + Update: { + abi?: string + id?: string + name?: string + } + Relationships: [] + } + fractions: { + Row: { + claims_id: string + creation_block_timestamp: number | null + hypercert_id: string | null + id: string + last_block_update_timestamp: number | null + owner_address: string | null + token_id: number + units: number | null + value: number | null + } + Insert: { + claims_id: string + creation_block_timestamp?: number | null + hypercert_id?: string | null + id?: string + last_block_update_timestamp?: number | null + owner_address?: string | null + token_id: number + units?: number | null + value?: number | null + } + Update: { + claims_id?: string + creation_block_timestamp?: number | null + hypercert_id?: string | null + id?: string + last_block_update_timestamp?: number | null + owner_address?: string | null + token_id?: number + units?: number | null + value?: number | null } - Enums: { - [_ in never]: never + Relationships: [ + { + foreignKeyName: "fractions_claims_id_fkey" + columns: ["claims_id"] + isOneToOne: false + referencedRelation: "claims" + referencedColumns: ["id"] + }, + { + foreignKeyName: "fractions_claims_id_fkey" + columns: ["claims_id"] + isOneToOne: false + referencedRelation: "hypercert_allowlists_with_claim" + referencedColumns: ["claim_id"] + }, + ] + } + hypercert_allow_list_records: { + Row: { + claimed: boolean + entry: number + hypercert_allow_lists_id: string + id: string + leaf: string + proof: Json + units: number + user_address: string } - CompositeTypes: { - [_ in never]: never + Insert: { + claimed?: boolean + entry: number + hypercert_allow_lists_id: string + id?: string + leaf?: string + proof?: Json + units: number + user_address: string } + Update: { + claimed?: boolean + entry?: number + hypercert_allow_lists_id?: string + id?: string + leaf?: string + proof?: Json + units?: number + user_address?: string + } + Relationships: [ + { + foreignKeyName: "hypercert_allow_list_records_hypercert_allow_lists_id_fkey" + columns: ["hypercert_allow_lists_id"] + isOneToOne: false + referencedRelation: "hypercert_allow_lists" + referencedColumns: ["id"] + }, + { + foreignKeyName: "hypercert_allow_list_records_hypercert_allow_lists_id_fkey" + columns: ["hypercert_allow_lists_id"] + isOneToOne: false + referencedRelation: "hypercert_allowlists_with_claim" + referencedColumns: ["hypercert_allow_list_id"] + }, + ] + } + hypercert_allow_lists: { + Row: { + allow_list_data_id: string | null + claims_id: string + id: string + parsed: boolean | null + root: string | null + } + Insert: { + allow_list_data_id?: string | null + claims_id: string + id?: string + parsed?: boolean | null + root?: string | null + } + Update: { + allow_list_data_id?: string | null + claims_id?: string + id?: string + parsed?: boolean | null + root?: string | null + } + Relationships: [ + { + foreignKeyName: "hypercert_allow_lists_allow_list_data_id_fkey" + columns: ["allow_list_data_id"] + isOneToOne: false + referencedRelation: "allow_list_data" + referencedColumns: ["id"] + }, + { + foreignKeyName: "hypercert_allow_lists_claims_id_fkey" + columns: ["claims_id"] + isOneToOne: true + referencedRelation: "claims" + referencedColumns: ["id"] + }, + { + foreignKeyName: "hypercert_allow_lists_claims_id_fkey" + columns: ["claims_id"] + isOneToOne: true + referencedRelation: "hypercert_allowlists_with_claim" + referencedColumns: ["claim_id"] + }, + ] + } + metadata: { + Row: { + allow_list_uri: string | null + contributors: string[] | null + description: string | null + external_url: string | null + id: string + image: string | null + impact_scope: string[] | null + impact_timeframe_from: number | null + impact_timeframe_to: number | null + name: string | null + parsed: boolean | null + properties: Json | null + rights: string[] | null + uri: string | null + work_scope: string[] | null + work_timeframe_from: number | null + work_timeframe_to: number | null + } + Insert: { + allow_list_uri?: string | null + contributors?: string[] | null + description?: string | null + external_url?: string | null + id?: string + image?: string | null + impact_scope?: string[] | null + impact_timeframe_from?: number | null + impact_timeframe_to?: number | null + name?: string | null + parsed?: boolean | null + properties?: Json | null + rights?: string[] | null + uri?: string | null + work_scope?: string[] | null + work_timeframe_from?: number | null + work_timeframe_to?: number | null + } + Update: { + allow_list_uri?: string | null + contributors?: string[] | null + description?: string | null + external_url?: string | null + id?: string + image?: string | null + impact_scope?: string[] | null + impact_timeframe_from?: number | null + impact_timeframe_to?: number | null + name?: string | null + parsed?: boolean | null + properties?: Json | null + rights?: string[] | null + uri?: string | null + work_scope?: string[] | null + work_timeframe_from?: number | null + work_timeframe_to?: number | null + } + Relationships: [ + { + foreignKeyName: "metadata_allow_list_uri_fkey" + columns: ["allow_list_uri"] + isOneToOne: false + referencedRelation: "allow_list_data" + referencedColumns: ["uri"] + }, + ] + } + supported_schemas: { + Row: { + chain_id: number + id: string + last_block_indexed: number | null + resolver: string | null + revocable: boolean | null + schema: string | null + uid: string + } + Insert: { + chain_id: number + id?: string + last_block_indexed?: number | null + resolver?: string | null + revocable?: boolean | null + schema?: string | null + uid: string + } + Update: { + chain_id?: number + id?: string + last_block_indexed?: number | null + resolver?: string | null + revocable?: boolean | null + schema?: string | null + uid?: string + } + Relationships: [] + } } - public: { - Tables: { - allow_list_data: { - Row: { - data: Json | null - id: string - parsed: boolean | null - root: string | null - uri: string | null - } - Insert: { - data?: Json | null - id?: string - parsed?: boolean | null - root?: string | null - uri?: string | null - } - Update: { - data?: Json | null - id?: string - parsed?: boolean | null - root?: string | null - uri?: string | null - } - Relationships: [] - } - attestations: { - Row: { - attestation: Json - attester: string - block_timestamp: number - chain_id: number | null - claims_id: string | null - contract_address: string | null - data: Json - id: string - recipient: string - supported_schemas_id: string - token_id: number | null - uid: string - } - Insert: { - attestation: Json - attester: string - block_timestamp: number - chain_id?: number | null - claims_id?: string | null - contract_address?: string | null - data: Json - id?: string - recipient: string - supported_schemas_id: string - token_id?: number | null - uid: string - } - Update: { - attestation?: Json - attester?: string - block_timestamp?: number - chain_id?: number | null - claims_id?: string | null - contract_address?: string | null - data?: Json - id?: string - recipient?: string - supported_schemas_id?: string - token_id?: number | null - uid?: string - } - Relationships: [ - { - foreignKeyName: "attestations_claims_id_fkey" - columns: ["claims_id"] - isOneToOne: false - referencedRelation: "claims" - referencedColumns: ["id"] - }, - { - foreignKeyName: "attestations_supported_schemas_id_fkey" - columns: ["supported_schemas_id"] - isOneToOne: false - referencedRelation: "supported_schemas" - referencedColumns: ["id"] - }, - ] - } - claims: { - Row: { - contracts_id: string - creation_block_timestamp: number | null - hypercert_id: string | null - id: string - last_block_update_timestamp: number | null - owner_address: string | null - token_id: number - units: number | null - uri: string | null - value: number | null - claim_attestation_count: number | null - } - Insert: { - contracts_id: string - creation_block_timestamp?: number | null - hypercert_id?: string | null - id?: string - last_block_update_timestamp?: number | null - owner_address?: string | null - token_id: number - units?: number | null - uri?: string | null - value?: number | null - } - Update: { - contracts_id?: string - creation_block_timestamp?: number | null - hypercert_id?: string | null - id?: string - last_block_update_timestamp?: number | null - owner_address?: string | null - token_id?: number - units?: number | null - uri?: string | null - value?: number | null - } - Relationships: [ - { - foreignKeyName: "claims_contracts_id_fkey" - columns: ["contracts_id"] - isOneToOne: false - referencedRelation: "contracts" - referencedColumns: ["id"] - }, - { - foreignKeyName: "claims_uri_fkey" - columns: ["uri"] - isOneToOne: false - referencedRelation: "metadata" - referencedColumns: ["uri"] - }, - ] - } - contract_events: { - Row: { - contracts_id: string - events_id: string - last_block_indexed: number | null - } - Insert: { - contracts_id: string - events_id: string - last_block_indexed?: number | null - } - Update: { - contracts_id?: string - events_id?: string - last_block_indexed?: number | null - } - Relationships: [ - { - foreignKeyName: "contract_events_contracts_id_fkey" - columns: ["contracts_id"] - isOneToOne: false - referencedRelation: "contracts" - referencedColumns: ["id"] - }, - { - foreignKeyName: "contract_events_events_id_fkey" - columns: ["events_id"] - isOneToOne: false - referencedRelation: "events" - referencedColumns: ["id"] - }, - ] - } - contracts: { - Row: { - chain_id: number - contract_address: string - id: string - start_block: number | null - } - Insert: { - chain_id: number - contract_address: string - id?: string - start_block?: number | null - } - Update: { - chain_id?: number - contract_address?: string - id?: string - start_block?: number | null - } - Relationships: [] - } - events: { - Row: { - abi: string - id: string - name: string - } - Insert: { - abi: string - id?: string - name: string - } - Update: { - abi?: string - id?: string - name?: string - } - Relationships: [] - } - fractions: { - Row: { - claims_id: string - creation_block_timestamp: number | null - hypercert_id: string | null - id: string - last_block_update_timestamp: number | null - owner_address: string | null - token_id: number - units: number | null - value: number | null - } - Insert: { - claims_id: string - creation_block_timestamp?: number | null - hypercert_id?: string | null - id?: string - last_block_update_timestamp?: number | null - owner_address?: string | null - token_id: number - units?: number | null - value?: number | null - } - Update: { - claims_id?: string - creation_block_timestamp?: number | null - hypercert_id?: string | null - id?: string - last_block_update_timestamp?: number | null - owner_address?: string | null - token_id?: number - units?: number | null - value?: number | null - } - Relationships: [ - { - foreignKeyName: "fractions_claims_id_fkey" - columns: ["claims_id"] - isOneToOne: false - referencedRelation: "claims" - referencedColumns: ["id"] - }, - ] - } - hypercert_allow_list_records: { - Row: { - claimed: boolean - entry: number - hypercert_allow_lists_id: string - id: string - leaf: string - proof: Json - units: number - user_address: string - } - Insert: { - claimed?: boolean - entry: number - hypercert_allow_lists_id: string - id?: string - leaf?: string - proof?: Json - units: number - user_address: string - } - Update: { - claimed?: boolean - entry?: number - hypercert_allow_lists_id?: string - id?: string - leaf?: string - proof?: Json - units?: number - user_address?: string - } - Relationships: [ - { - foreignKeyName: "hypercert_allow_list_records_hypercert_allow_lists_id_fkey" - columns: ["hypercert_allow_lists_id"] - isOneToOne: false - referencedRelation: "hypercert_allow_lists" - referencedColumns: ["id"] - }, - ] - } - hypercert_allow_lists: { - Row: { - allow_list_data_id: string | null - claims_id: string - id: string - parsed: boolean | null - root: string | null - } - Insert: { - allow_list_data_id?: string | null - claims_id: string - id?: string - parsed?: boolean | null - root?: string | null - } - Update: { - allow_list_data_id?: string | null - claims_id?: string - id?: string - parsed?: boolean | null - root?: string | null - } - Relationships: [ - { - foreignKeyName: "hypercert_allow_lists_allow_list_data_id_fkey" - columns: ["allow_list_data_id"] - isOneToOne: false - referencedRelation: "allow_list_data" - referencedColumns: ["id"] - }, - { - foreignKeyName: "hypercert_allow_lists_claims_id_fkey" - columns: ["claims_id"] - isOneToOne: true - referencedRelation: "claims" - referencedColumns: ["id"] - }, - ] - } - metadata: { - Row: { - allow_list_uri: string | null - contributors: string[] | null - description: string | null - external_url: string | null - id: string - image: string | null - impact_scope: string[] | null - impact_timeframe_from: number | null - impact_timeframe_to: number | null - name: string | null - parsed: boolean | null - properties: Json | null - rights: string[] | null - uri: string | null - work_scope: string[] | null - work_timeframe_from: number | null - work_timeframe_to: number | null - } - Insert: { - allow_list_uri?: string | null - contributors?: string[] | null - description?: string | null - external_url?: string | null - id?: string - image?: string | null - impact_scope?: string[] | null - impact_timeframe_from?: number | null - impact_timeframe_to?: number | null - name?: string | null - parsed?: boolean | null - properties?: Json | null - rights?: string[] | null - uri?: string | null - work_scope?: string[] | null - work_timeframe_from?: number | null - work_timeframe_to?: number | null - } - Update: { - allow_list_uri?: string | null - contributors?: string[] | null - description?: string | null - external_url?: string | null - id?: string - image?: string | null - impact_scope?: string[] | null - impact_timeframe_from?: number | null - impact_timeframe_to?: number | null - name?: string | null - parsed?: boolean | null - properties?: Json | null - rights?: string[] | null - uri?: string | null - work_scope?: string[] | null - work_timeframe_from?: number | null - work_timeframe_to?: number | null - } - Relationships: [ - { - foreignKeyName: "metadata_allow_list_uri_fkey" - columns: ["allow_list_uri"] - isOneToOne: false - referencedRelation: "allow_list_data" - referencedColumns: ["uri"] - }, - ] - } - supported_schemas: { - Row: { - chain_id: number - eas_schema_id: string - id: string - last_block_indexed: number | null - resolver: string | null - revocable: boolean | null - schema: string | null - } - Insert: { - chain_id: number - eas_schema_id: string - id?: string - last_block_indexed?: number | null - resolver?: string | null - revocable?: boolean | null - schema?: string | null - } - Update: { - chain_id?: number - eas_schema_id?: string - id?: string - last_block_indexed?: number | null - resolver?: string | null - revocable?: boolean | null - schema?: string | null - } - Relationships: [] - } + Views: { + hypercert_allow_list_records_with_token_id: { + Row: { + claimed: boolean | null + entry: number | null + id: string | null + leaf: string | null + token_id: number | null + user_address: string | null } - Views: { - [_ in never]: never + Relationships: [] + } + hypercert_allowlists_with_claim: { + Row: { + block_number: number | null + claim_id: string | null + hypercert_allow_list_id: string | null + hypercert_id: string | null } - Functions: { - claim_attestation_count: { - Args: { - "": unknown - } - Returns: number - } - get_missing_metadata_uris: { - Args: Record - Returns: { - missing_uri: string - }[] - } - get_or_create_claim: - | { - Args: { - p_chain_id: number - p_contract_address: string - p_token_id: number - } - Returns: string - } - | { - Args: { - p_contracts_id: string - p_token_id: number - } - Returns: { - contracts_id: string - creation_block_timestamp: number | null - hypercert_id: string | null - id: string - last_block_update_timestamp: number | null - owner_address: string | null - token_id: number - units: number | null - uri: string | null - value: number | null - } - } - get_unparsed_hypercert_allow_lists: { - Args: Record - Returns: { - claim_id: string - al_data_id: string - data: Json - }[] - } - store_allow_list_records: { - Args: { - _claims_id: string - _allow_list_data_id: string - _records: Json[] - } - Returns: undefined - } - store_fraction: { - Args: { - _fractions: CachingDatabase["public"]["CompositeTypes"]["fraction_type"][] - } - Returns: { - fraction_id: string - }[] - } - store_hypercert_allow_list_roots: { - Args: { - p_hc_allow_list_roots: CachingDatabase["public"]["CompositeTypes"]["hc_allow_list_root_type"][] - } - Returns: undefined - } - transfer_fractions_batch: { - Args: { - p_transfers: CachingDatabase["public"]["CompositeTypes"]["transfer_fractions_type"][] - } - Returns: undefined - } - transfer_units_batch: { - Args: { - p_transfers: CachingDatabase["public"]["CompositeTypes"]["transfer_units_type"][] - } - Returns: undefined - } + Relationships: [] + } + } + Functions: { + claim_attestation_count: { + Args: { + "": unknown } - Enums: { - [_ in never]: never - } - CompositeTypes: { - fraction_type: { - claims_id: string | null - token_id: number | null - creation_block_timestamp: number | null - last_block_update_timestamp: number | null - owner_address: string | null - value: number | null - } - hc_allow_list_root_type: { - contract_id: string | null - token_id: number | null - root: string | null + Returns: number + } + get_missing_metadata_uris: { + Args: Record + Returns: { + missing_uri: string + }[] + } + get_or_create_claim: + | { + Args: { + p_chain_id: number + p_contract_address: string + p_token_id: number } - transfer_fractions_type: { - claims_id: string | null - token_id: number | null - from_owner_address: string | null - to_owner_address: string | null - block_timestamp: number | null - value: number | null + Returns: string + } + | { + Args: { + p_contracts_id: string + p_token_id: number } - transfer_units_type: { - claim_id: string | null - from_token_id: number | null - to_token_id: number | null - block_timestamp: number | null - units_transferred: number | null + Returns: { + block_number: number | null + contracts_id: string + creator_address: string | null + hypercert_id: string | null + id: string + owner_address: string | null + token_id: number + units: number | null + uri: string | null + value: number | null } + } + get_unparsed_hypercert_allow_lists: { + Args: Record + Returns: { + claim_id: string + al_data_id: string + data: Json + }[] + } + store_allow_list_records: { + Args: { + _claims_id: string + _allow_list_data_id: string + _records: Json[] + } + Returns: undefined + } + store_fraction: { + Args: { + _fractions: Database["public"]["CompositeTypes"]["fraction_type"][] } + Returns: { + fraction_id: string + }[] + } + store_hypercert_allow_list_roots: { + Args: { + p_hc_allow_list_roots: Database["public"]["CompositeTypes"]["hc_allow_list_root_type"][] + } + Returns: undefined + } + transfer_fractions_batch: { + Args: { + p_transfers: Database["public"]["CompositeTypes"]["transfer_fractions_type"][] + } + Returns: undefined + } + transfer_units_batch: { + Args: { + p_transfers: Database["public"]["CompositeTypes"]["transfer_units_type"][] + } + Returns: undefined + } } - storage: { - Tables: { - buckets: { - Row: { - allowed_mime_types: string[] | null - avif_autodetection: boolean | null - created_at: string | null - file_size_limit: number | null - id: string - name: string - owner: string | null - owner_id: string | null - public: boolean | null - updated_at: string | null - } - Insert: { - allowed_mime_types?: string[] | null - avif_autodetection?: boolean | null - created_at?: string | null - file_size_limit?: number | null - id: string - name: string - owner?: string | null - owner_id?: string | null - public?: boolean | null - updated_at?: string | null - } - Update: { - allowed_mime_types?: string[] | null - avif_autodetection?: boolean | null - created_at?: string | null - file_size_limit?: number | null - id?: string - name?: string - owner?: string | null - owner_id?: string | null - public?: boolean | null - updated_at?: string | null - } - Relationships: [] - } - migrations: { - Row: { - executed_at: string | null - hash: string - id: number - name: string - } - Insert: { - executed_at?: string | null - hash: string - id: number - name: string - } - Update: { - executed_at?: string | null - hash?: string - id?: number - name?: string - } - Relationships: [] - } - objects: { - Row: { - bucket_id: string | null - created_at: string | null - id: string - last_accessed_at: string | null - metadata: Json | null - name: string | null - owner: string | null - owner_id: string | null - path_tokens: string[] | null - updated_at: string | null - version: string | null - } - Insert: { - bucket_id?: string | null - created_at?: string | null - id?: string - last_accessed_at?: string | null - metadata?: Json | null - name?: string | null - owner?: string | null - owner_id?: string | null - path_tokens?: string[] | null - updated_at?: string | null - version?: string | null - } - Update: { - bucket_id?: string | null - created_at?: string | null - id?: string - last_accessed_at?: string | null - metadata?: Json | null - name?: string | null - owner?: string | null - owner_id?: string | null - path_tokens?: string[] | null - updated_at?: string | null - version?: string | null - } - Relationships: [ - { - foreignKeyName: "objects_bucketId_fkey" - columns: ["bucket_id"] - isOneToOne: false - referencedRelation: "buckets" - referencedColumns: ["id"] - }, - ] - } - s3_multipart_uploads: { - Row: { - bucket_id: string - created_at: string - id: string - in_progress_size: number - key: string - owner_id: string | null - upload_signature: string - version: string - } - Insert: { - bucket_id: string - created_at?: string - id: string - in_progress_size?: number - key: string - owner_id?: string | null - upload_signature: string - version: string - } - Update: { - bucket_id?: string - created_at?: string - id?: string - in_progress_size?: number - key?: string - owner_id?: string | null - upload_signature?: string - version?: string - } - Relationships: [ - { - foreignKeyName: "s3_multipart_uploads_bucket_id_fkey" - columns: ["bucket_id"] - isOneToOne: false - referencedRelation: "buckets" - referencedColumns: ["id"] - }, - ] - } - s3_multipart_uploads_parts: { - Row: { - bucket_id: string - created_at: string - etag: string - id: string - key: string - owner_id: string | null - part_number: number - size: number - upload_id: string - version: string - } - Insert: { - bucket_id: string - created_at?: string - etag: string - id?: string - key: string - owner_id?: string | null - part_number: number - size?: number - upload_id: string - version: string - } - Update: { - bucket_id?: string - created_at?: string - etag?: string - id?: string - key?: string - owner_id?: string | null - part_number?: number - size?: number - upload_id?: string - version?: string - } - Relationships: [ - { - foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey" - columns: ["bucket_id"] - isOneToOne: false - referencedRelation: "buckets" - referencedColumns: ["id"] - }, - { - foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey" - columns: ["upload_id"] - isOneToOne: false - referencedRelation: "s3_multipart_uploads" - referencedColumns: ["id"] - }, - ] - } + Enums: { + [_ in never]: never + } + CompositeTypes: { + fraction_type: { + claims_id: string | null + token_id: number | null + creation_block_timestamp: number | null + last_block_update_timestamp: number | null + owner_address: string | null + value: number | null + } + hc_allow_list_root_type: { + contract_id: string | null + token_id: number | null + root: string | null + } + transfer_fractions_type: { + claims_id: string | null + token_id: number | null + from_owner_address: string | null + to_owner_address: string | null + block_timestamp: number | null + value: number | null + } + transfer_units_type: { + claim_id: string | null + from_token_id: number | null + to_token_id: number | null + block_timestamp: number | null + units_transferred: number | null + } + } + } + storage: { + Tables: { + buckets: { + Row: { + allowed_mime_types: string[] | null + avif_autodetection: boolean | null + created_at: string | null + file_size_limit: number | null + id: string + name: string + owner: string | null + owner_id: string | null + public: boolean | null + updated_at: string | null } - Views: { - [_ in never]: never - } - Functions: { - can_insert_object: { - Args: { - bucketid: string - name: string - owner: string - metadata: Json - } - Returns: undefined - } - extension: { - Args: { - name: string - } - Returns: string - } - filename: { - Args: { - name: string - } - Returns: string - } - foldername: { - Args: { - name: string - } - Returns: string[] - } - get_size_by_bucket: { - Args: Record - Returns: { - size: number - bucket_id: string - }[] - } - list_multipart_uploads_with_delimiter: { - Args: { - bucket_id: string - prefix_param: string - delimiter_param: string - max_keys?: number - next_key_token?: string - next_upload_token?: string - } - Returns: { - key: string - id: string - created_at: string - }[] - } - list_objects_with_delimiter: { - Args: { - bucket_id: string - prefix_param: string - delimiter_param: string - max_keys?: number - start_after?: string - next_token?: string - } - Returns: { - name: string - id: string - metadata: Json - updated_at: string - }[] - } - search: { - Args: { - prefix: string - bucketname: string - limits?: number - levels?: number - offsets?: number - search?: string - sortcolumn?: string - sortorder?: string - } - Returns: { - name: string - id: string - updated_at: string - created_at: string - last_accessed_at: string - metadata: Json - }[] - } + Insert: { + allowed_mime_types?: string[] | null + avif_autodetection?: boolean | null + created_at?: string | null + file_size_limit?: number | null + id: string + name: string + owner?: string | null + owner_id?: string | null + public?: boolean | null + updated_at?: string | null + } + Update: { + allowed_mime_types?: string[] | null + avif_autodetection?: boolean | null + created_at?: string | null + file_size_limit?: number | null + id?: string + name?: string + owner?: string | null + owner_id?: string | null + public?: boolean | null + updated_at?: string | null + } + Relationships: [] + } + migrations: { + Row: { + executed_at: string | null + hash: string + id: number + name: string } - Enums: { - [_ in never]: never + Insert: { + executed_at?: string | null + hash: string + id: number + name: string } - CompositeTypes: { - [_ in never]: never + Update: { + executed_at?: string | null + hash?: string + id?: number + name?: string } + Relationships: [] + } + objects: { + Row: { + bucket_id: string | null + created_at: string | null + id: string + last_accessed_at: string | null + metadata: Json | null + name: string | null + owner: string | null + owner_id: string | null + path_tokens: string[] | null + updated_at: string | null + version: string | null + } + Insert: { + bucket_id?: string | null + created_at?: string | null + id?: string + last_accessed_at?: string | null + metadata?: Json | null + name?: string | null + owner?: string | null + owner_id?: string | null + path_tokens?: string[] | null + updated_at?: string | null + version?: string | null + } + Update: { + bucket_id?: string | null + created_at?: string | null + id?: string + last_accessed_at?: string | null + metadata?: Json | null + name?: string | null + owner?: string | null + owner_id?: string | null + path_tokens?: string[] | null + updated_at?: string | null + version?: string | null + } + Relationships: [ + { + foreignKeyName: "objects_bucketId_fkey" + columns: ["bucket_id"] + isOneToOne: false + referencedRelation: "buckets" + referencedColumns: ["id"] + }, + ] + } + s3_multipart_uploads: { + Row: { + bucket_id: string + created_at: string + id: string + in_progress_size: number + key: string + owner_id: string | null + upload_signature: string + version: string + } + Insert: { + bucket_id: string + created_at?: string + id: string + in_progress_size?: number + key: string + owner_id?: string | null + upload_signature: string + version: string + } + Update: { + bucket_id?: string + created_at?: string + id?: string + in_progress_size?: number + key?: string + owner_id?: string | null + upload_signature?: string + version?: string + } + Relationships: [ + { + foreignKeyName: "s3_multipart_uploads_bucket_id_fkey" + columns: ["bucket_id"] + isOneToOne: false + referencedRelation: "buckets" + referencedColumns: ["id"] + }, + ] + } + s3_multipart_uploads_parts: { + Row: { + bucket_id: string + created_at: string + etag: string + id: string + key: string + owner_id: string | null + part_number: number + size: number + upload_id: string + version: string + } + Insert: { + bucket_id: string + created_at?: string + etag: string + id?: string + key: string + owner_id?: string | null + part_number: number + size?: number + upload_id: string + version: string + } + Update: { + bucket_id?: string + created_at?: string + etag?: string + id?: string + key?: string + owner_id?: string | null + part_number?: number + size?: number + upload_id?: string + version?: string + } + Relationships: [ + { + foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey" + columns: ["bucket_id"] + isOneToOne: false + referencedRelation: "buckets" + referencedColumns: ["id"] + }, + { + foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey" + columns: ["upload_id"] + isOneToOne: false + referencedRelation: "s3_multipart_uploads" + referencedColumns: ["id"] + }, + ] + } + } + Views: { + [_ in never]: never + } + Functions: { + can_insert_object: { + Args: { + bucketid: string + name: string + owner: string + metadata: Json + } + Returns: undefined + } + extension: { + Args: { + name: string + } + Returns: string + } + filename: { + Args: { + name: string + } + Returns: string + } + foldername: { + Args: { + name: string + } + Returns: string[] + } + get_size_by_bucket: { + Args: Record + Returns: { + size: number + bucket_id: string + }[] + } + list_multipart_uploads_with_delimiter: { + Args: { + bucket_id: string + prefix_param: string + delimiter_param: string + max_keys?: number + next_key_token?: string + next_upload_token?: string + } + Returns: { + key: string + id: string + created_at: string + }[] + } + list_objects_with_delimiter: { + Args: { + bucket_id: string + prefix_param: string + delimiter_param: string + max_keys?: number + start_after?: string + next_token?: string + } + Returns: { + name: string + id: string + metadata: Json + updated_at: string + }[] + } + search: { + Args: { + prefix: string + bucketname: string + limits?: number + levels?: number + offsets?: number + search?: string + sortcolumn?: string + sortorder?: string + } + Returns: { + name: string + id: string + updated_at: string + created_at: string + last_accessed_at: string + metadata: Json + }[] + } + } + Enums: { + [_ in never]: never + } + CompositeTypes: { + [_ in never]: never } + } } -type PublicSchema = CachingDatabase[Extract] +type PublicSchema = Database[Extract] export type Tables< - PublicTableNameOrOptions extends | keyof (PublicSchema["Tables"] & PublicSchema["Views"]) - | { schema: keyof CachingDatabase }, - TableName extends PublicTableNameOrOptions extends { schema: keyof CachingDatabase } - ? keyof (CachingDatabase[PublicTableNameOrOptions["schema"]]["Tables"] & - CachingDatabase[PublicTableNameOrOptions["schema"]]["Views"]) - : never = never, -> = PublicTableNameOrOptions extends { schema: keyof CachingDatabase } - ? (CachingDatabase[PublicTableNameOrOptions["schema"]]["Tables"] & - CachingDatabase[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { - Row: infer R - } - ? R - : never - : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & - PublicSchema["Views"]) - ? (PublicSchema["Tables"] & - PublicSchema["Views"])[PublicTableNameOrOptions] extends { - Row: infer R - } - ? R - : never - : never + PublicTableNameOrOptions extends + | keyof (PublicSchema["Tables"] & PublicSchema["Views"]) + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"]) + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & + Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { + Row: infer R + } + ? R + : never + : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & + PublicSchema["Views"]) + ? (PublicSchema["Tables"] & + PublicSchema["Views"])[PublicTableNameOrOptions] extends { + Row: infer R + } + ? R + : never + : never export type TablesInsert< - PublicTableNameOrOptions extends | keyof PublicSchema["Tables"] - | { schema: keyof CachingDatabase }, - TableName extends PublicTableNameOrOptions extends { schema: keyof CachingDatabase } - ? keyof CachingDatabase[PublicTableNameOrOptions["schema"]]["Tables"] - : never = never, -> = PublicTableNameOrOptions extends { schema: keyof CachingDatabase } - ? CachingDatabase[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { - Insert: infer I - } - ? I - : never - : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] - ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { - Insert: infer I - } - ? I - : never - : never + PublicTableNameOrOptions extends + | keyof PublicSchema["Tables"] + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Insert: infer I + } + ? I + : never + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Insert: infer I + } + ? I + : never + : never export type TablesUpdate< - PublicTableNameOrOptions extends | keyof PublicSchema["Tables"] - | { schema: keyof CachingDatabase }, - TableName extends PublicTableNameOrOptions extends { schema: keyof CachingDatabase } - ? keyof CachingDatabase[PublicTableNameOrOptions["schema"]]["Tables"] - : never = never, -> = PublicTableNameOrOptions extends { schema: keyof CachingDatabase } - ? CachingDatabase[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { - Update: infer U - } - ? U - : never - : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] - ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { - Update: infer U - } - ? U - : never - : never + PublicTableNameOrOptions extends + | keyof PublicSchema["Tables"] + | { schema: keyof Database }, + TableName extends PublicTableNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] + : never = never, +> = PublicTableNameOrOptions extends { schema: keyof Database } + ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { + Update: infer U + } + ? U + : never + : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] + ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { + Update: infer U + } + ? U + : never + : never export type Enums< - PublicEnumNameOrOptions extends | keyof PublicSchema["Enums"] - | { schema: keyof CachingDatabase }, - EnumName extends PublicEnumNameOrOptions extends { schema: keyof CachingDatabase } - ? keyof CachingDatabase[PublicEnumNameOrOptions["schema"]]["Enums"] - : never = never, -> = PublicEnumNameOrOptions extends { schema: keyof CachingDatabase } - ? CachingDatabase[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] - : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] - ? PublicSchema["Enums"][PublicEnumNameOrOptions] - : never + PublicEnumNameOrOptions extends + | keyof PublicSchema["Enums"] + | { schema: keyof Database }, + EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } + ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] + : never = never, +> = PublicEnumNameOrOptions extends { schema: keyof Database } + ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] + : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] + ? PublicSchema["Enums"][PublicEnumNameOrOptions] + : never diff --git a/supabase/config.toml b/supabase/config.toml index 5230433..970befb 100644 --- a/supabase/config.toml +++ b/supabase/config.toml @@ -5,7 +5,7 @@ project_id = "hyperboards" [api] enabled = true # Port to use for the API URL. -port = 54321 +port = 64321 # Schemas to expose in your API. Tables, views and stored procedures in this schema will get API # endpoints. public and storage are always included. schemas = ["public", "storage", "graphql_public"] @@ -17,9 +17,9 @@ max_rows = 1000 [db] # Port to use for the local database URL. -port = 54322 +port = 64322 # Port used by db diff command to initialise the shadow database. -shadow_port = 54320 +shadow_port = 64320 # The database major version to use. This has to be the same as your remote database's. Run `SHOW # server_version;` on the remote database to check. major_version = 15 @@ -27,7 +27,7 @@ major_version = 15 [db.pooler] enabled = false # Port to use for the local connection pooler. -port = 54329 +port = 64329 # Specifies when a server connection can be reused by other clients. # Configure one of the supported pooler modes: `transaction`, `session`. pool_mode = "transaction" @@ -44,7 +44,7 @@ enabled = true [studio] enabled = true # Port to use for Supabase Studio. -port = 54323 +port = 64323 # External URL of the API server that frontend connects to. api_url = "http://localhost" @@ -53,7 +53,7 @@ api_url = "http://localhost" [inbucket] enabled = true # Port to use for the email testing server web interface. -port = 54324 +port = 64324 # Uncomment to expose additional ports for testing user applications that send emails. # smtp_port = 54325 # pop3_port = 54326 @@ -128,7 +128,7 @@ url = "" [analytics] enabled = false -port = 54327 -vector_port = 54328 +port = 64327 +vector_port = 64328 # Configure one of the supported backends: `postgres`, `bigquery`. backend = "postgres" From 8fb2ec0212ea53e6081b2b5c3dca307ace004748 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 5 Jun 2024 13:17:35 +0200 Subject: [PATCH 2/3] feat(dbdb): db integration scripts --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index 152814d..8d0fb45 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "dev": "nodemon", "build": "rimraf dist && tsoa spec-and-routes && swc src --out-dir dist --copy-files", "start": "node -r dotenv/config dist/src/index.js", + "integration": "concurrently \"pnpm --dir ./lib/hypercerts-indexer run dev\" \"pnpm run dev\"", "supabase:reset:all": "concurrently \"npm run supabase:reset:data\" \"npm run supabase:reset:cache\"", "supabase:start:all": "concurrently \"npm run supabase:start:data\" \"npm run supabase:start:cache\"", "supabase:types:all": "concurrently \"npm run supabase:types:data\" \"npm run supabase:types:cache\"", @@ -16,6 +17,7 @@ "supabase:start:data": "supabase start", "supabase:types:cache": "supabase gen types typescript --local --workdir ./lib/hypercerts-indexer > ./src/types/supabaseCaching.ts", "supabase:types:data": "supabase gen types typescript --local > ./src/types/supabaseData.ts", + "preintegration": "pnpm --dir ./lib/hypercerts-indexer i", "lint": "eslint", "test": "vitest" }, From cc375320c4c68b867961493503fdd558b8f80f9a Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 5 Jun 2024 13:30:44 +0200 Subject: [PATCH 3/3] feat(dbdb): pretty logs and update seed port --- package.json | 8 ++++---- seed.config.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8d0fb45..366656a 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "dev": "nodemon", "build": "rimraf dist && tsoa spec-and-routes && swc src --out-dir dist --copy-files", "start": "node -r dotenv/config dist/src/index.js", - "integration": "concurrently \"pnpm --dir ./lib/hypercerts-indexer run dev\" \"pnpm run dev\"", - "supabase:reset:all": "concurrently \"npm run supabase:reset:data\" \"npm run supabase:reset:cache\"", - "supabase:start:all": "concurrently \"npm run supabase:start:data\" \"npm run supabase:start:cache\"", - "supabase:types:all": "concurrently \"npm run supabase:types:data\" \"npm run supabase:types:cache\"", + "integration": "concurrently -c \"green,blue\" --names \"CACHE,DATA\" \"pnpm --dir ./lib/hypercerts-indexer run dev\" \"pnpm run dev\"", + "supabase:reset:all": "concurrently -c \"blue,green\" --names \"DATA,CACHE\" \"npm run supabase:reset:data\" \"npm run supabase:reset:cache\"", + "supabase:start:all": "concurrently -c \"blue,green\" --names \"DATA,CACHE\" \"npm run supabase:start:data\" \"npm run supabase:start:cache\"", + "supabase:types:all": "concurrently -c \"blue,green\" --names \"DATA,CACHE\" \"npm run supabase:types:data\" \"npm run supabase:types:cache\"", "supabase:reset:cache": "supabase db reset --workdir ./lib/hypercerts-indexer", "supabase:reset:data": "supabase db reset --workdir ./", "supabase:start:cache": "supabase start --workdir ./lib/hypercerts-indexer", diff --git a/seed.config.ts b/seed.config.ts index 241d4cb..9405514 100644 --- a/seed.config.ts +++ b/seed.config.ts @@ -4,7 +4,7 @@ import postgres from "postgres"; export default defineConfig({ adapter: () => { - const client = postgres("postgresql://postgres:postgres@localhost:54322/postgres"); + const client = postgres("postgresql://postgres:postgres@localhost:64322/postgres"); return new SeedPostgres(client); }, }); \ No newline at end of file