diff --git a/.snaplet/.gitignore b/.snaplet/.gitignore deleted file mode 100644 index 0e4cac673..000000000 --- a/.snaplet/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -id_rsa -snapshots diff --git a/.snaplet/config.json b/.snaplet/config.json deleted file mode 100644 index a120d1cdb..000000000 --- a/.snaplet/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projectId": "clnag5zv700ezlyu5rumcywau", - "sourceDatabaseUrl": "postgresql://postgres:postgres@localhost:54322/postgres", - "targetDatabaseUrl": "postgresql://postgres:postgres@localhost:54322/postgres", - "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvR+BEAXcKLtSOfVl16Vl\np7alDJiHRftuT9F0kqlRN0jUOM41H/GhKpQCi6sO/UiK7pC34Ab5GwKgssglrTs4\n+C/4+TDUkQTXzDIWq5T2uZ6O9cNunrS7D6oJhn1y59Uf6VkCsH29k5+1Wa7XYQ+W\nBScRPxdAnJR1RTESSq0kVSSd8iFrffjvGDbV4UvBWoPTt5GBmlFKvTvR8VF4fvA6\nVoLEeO9KKWqko0lvNCGZaMLB9ZT1eiiCAvZnI0wZzHu8L8/sIx7SdDqQW0VJr0AN\nz1Lok0CHCWu8QxXtr9e9M17FzDw7g4dTMs4D7HTtmSv+nx5AGc0fe6W6Hp3ua4uV\njxVW4fh56/Ne3WSvUPCBb3hR+gKRSt5q8FWuHcleJ9f7/8mhl2YBUIINHRjFJtyG\nRDZhPncrn56982RA4fzQKk6cMDe1PoI8WRMHIVwCFQxmbM4GKQKn/I5HLeuTR50s\nnqNdS8VPTrxj8pnseLE9C/OWD2CJmQGWm1I1dnTlbKEvAgMBAAE=\n-----END PUBLIC KEY-----\n" -} \ No newline at end of file diff --git a/.snaplet/fingerprint.json b/.snaplet/fingerprint.json deleted file mode 100644 index c375400fa..000000000 --- a/.snaplet/fingerprint.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "_http_response": { - "id": { "options": {} }, - "status_code": { "options": {} }, - "created": { "options": {} } - }, - "audit_log_entries": { "created_at": { "options": {} } }, - "buckets": { - "created_at": { "options": { "minYear": 2023, "maxYear": 2023 } }, - "updated_at": { "options": { "minYear": 2023, "maxYear": 2023 } }, - "file_size_limit": { "options": { "min": 2097152, "max": 2097152 } } - }, - "chain_addresses": { "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } } }, - "distribution_shares": { - "id": { "options": { "min": 1, "max": 5788463 } }, - "amount": { "options": { "min": 96237, "max": 74752954 } }, - "hodler_pool_amount": { "options": { "min": 96237, "max": 64914760 } }, - "bonus_pool_amount": { "options": { "min": 0, "max": 26161590 } }, - "fixed_pool_amount": { "options": { "min": 10000, "max": 60000 } }, - "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "updated_at": { "options": { "minYear": 2023, "maxYear": 2024 } } - }, - "distribution_verification_values": { - "fixed_value": { "options": { "min": 0, "max": 10000 } }, - "bips_value": { "options": { "min": 0, "max": 500 } }, - "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "updated_at": { "options": { "minYear": 2023, "maxYear": 2024 } } - }, - "distribution_verifications": { - "metadata": { - "schema": { - "$schema": "http://json-schema.org/draft-06/schema#", - "$ref": "#/definitions/Metadata", - "definitions": { - "Metadata": { - "type": "object", - "additionalProperties": false, - "properties": { - "tag": { "type": "string" }, - "referred_id": { "type": "string", "format": "uuid" } - }, - "required": ["tag"], - "title": "Metadata" - } - } - } - }, - "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } } - }, - "distributions": { - "number": { "options": { "min": 1, "max": 3 } }, - "amount": { "options": { "min": 900000000, "max": 1000000000 } }, - "hodler_pool_bips": { "options": { "min": 6500, "max": 6500 } }, - "bonus_pool_bips": { "options": { "min": 3500, "max": 3500 } }, - "fixed_pool_bips": { "options": { "min": 1000, "max": 1000 } }, - "qualification_start": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "qualification_end": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "claim_end": { "options": { "minYear": 2024, "maxYear": 2024 } }, - "snapshot_id": { "options": { "min": 1, "max": 2 } }, - "hodler_min_balance": { "options": { "min": 1000000, "max": 2000000 } }, - "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "updated_at": { "options": { "minYear": 2023, "maxYear": 2024 } } - }, - "feature_info": {}, - "flow_state": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "hooks": { - "hook_table_id": { "options": {} }, - "created_at": { "options": {} }, - "request_id": { "options": {} } - }, - "http_request_queue": { "id": { "options": {} }, "timeout_milliseconds": { "options": {} } }, - "identities": { - "last_sign_in_at": { "options": {} }, - "created_at": { "options": {} }, - "updated_at": { "options": {} } - }, - "instances": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "key": { - "created": { "options": {} }, - "expires": { "options": {} }, - "key_id": { "options": {} } - }, - "mfa_amr_claims": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "mfa_challenges": { "created_at": { "options": {} }, "verified_at": { "options": {} } }, - "mfa_factors": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "storage_migrations": { "executed_at": { "options": { "minYear": 2024, "maxYear": 2024 } } }, - "supabase_functions_migrations": { - "inserted_at": { "options": { "minYear": 2024, "maxYear": 2024 } } - }, - "objects": { - "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "updated_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "last_accessed_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "metadata": { - "schema": { - "$schema": "http://json-schema.org/draft-06/schema#", - "$ref": "#/definitions/Metadata", - "definitions": { - "Metadata": { - "type": "object", - "additionalProperties": false, - "properties": { - "eTag": { "type": "string" }, - "size": { "type": "integer" }, - "mimetype": { "type": "string" }, - "cacheControl": { "type": "string" }, - "lastModified": { "type": "string", "format": "date-time" }, - "contentLength": { "type": "integer" }, - "httpStatusCode": { "type": "integer" } - }, - "required": [ - "cacheControl", - "contentLength", - "eTag", - "httpStatusCode", - "lastModified", - "mimetype", - "size" - ], - "title": "Metadata" - } - } - } - } - }, - "profiles": {}, - "receipts": { "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } } }, - "referrals": {}, - "refresh_tokens": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "saml_providers": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "saml_relay_states": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "auth_schema_migrations": {}, - "supabase_migrations_schema_migrations": {}, - "secrets": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "send_account_credentials": { "key_slot": { "options": {} }, "created_at": { "options": {} } }, - "send_accounts": { - "chain_id": { "options": {} }, - "created_at": { "options": {} }, - "updated_at": { "options": {} }, - "deleted_at": { "options": {} } - }, - "send_transfer_logs": { - "value": { "options": { "min": 1, "max": 100000000000 } }, - "block_number": { "options": { "min": 17579999, "max": 19059449 } }, - "block_timestamp": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } } - }, - "sessions": { - "created_at": { "options": {} }, - "updated_at": { "options": {} }, - "not_after": { "options": {} } - }, - "sso_domains": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "sso_providers": { "created_at": { "options": {} }, "updated_at": { "options": {} } }, - "tag_receipts": {}, - "tag_reservations": { "created_at": { "options": { "minYear": 2023, "maxYear": 2023 } } }, - "tags": { "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } } }, - "users": { - "email_confirmed_at": { "options": {} }, - "invited_at": { "options": {} }, - "confirmation_sent_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "recovery_sent_at": { "options": {} }, - "email_change_sent_at": { "options": {} }, - "last_sign_in_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "raw_app_meta_data": { - "schema": { - "$schema": "http://json-schema.org/draft-06/schema#", - "$ref": "#/definitions/RawAppMetaData", - "definitions": { - "RawAppMetaData": { - "type": "object", - "additionalProperties": false, - "properties": { - "provider": { "type": "string" }, - "providers": { "type": "array", "items": { "type": "string" } } - }, - "required": ["provider", "providers"], - "title": "RawAppMetaData" - } - } - } - }, - "raw_user_meta_data": { - "schema": { - "$schema": "http://json-schema.org/draft-06/schema#", - "$ref": "#/definitions/RawUserMetaData", - "definitions": { - "RawUserMetaData": { - "type": "object", - "additionalProperties": false, - "title": "RawUserMetaData" - } - } - } - }, - "created_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "updated_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "phone_confirmed_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "phone_change_sent_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "confirmed_at": { "options": { "minYear": 2023, "maxYear": 2024 } }, - "email_change_confirm_status": { "options": { "min": 0, "max": 0 } }, - "banned_until": { "options": {} }, - "reauthentication_sent_at": { "options": {} }, - "deleted_at": { "options": {} } - }, - "webauthn_credentials": { - "sign_count": { "options": {} }, - "created_at": { "options": {} }, - "updated_at": { "options": {} }, - "deleted_at": { "options": {} } - } -} diff --git a/package.json b/package.json index 0bbf0ba5e..3ae346903 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "@biomejs/biome": "^1.6.3", "dotenv-cli": "^7.3.0", "lefthook": "^1.5.5", - "snaplet": "^0.42.1", "zx": "^8.1.2" } } diff --git a/packages/snaplet/.snaplet/config.json b/packages/snaplet/.snaplet/config.json index a25c325f9..e519a22fc 100644 --- a/packages/snaplet/.snaplet/config.json +++ b/packages/snaplet/.snaplet/config.json @@ -1,3 +1,5 @@ { - "adapter": "pg" -} \ No newline at end of file + "adapter": "pg", + "targetDatabaseUrl": "postgresql://postgres:postgres@localhost:54322/postgres", + "sourceDatabaseUrl": "postgresql://postgres:postgres@localhost:54322/postgres" +} diff --git a/packages/snaplet/.snaplet/dataModel.json b/packages/snaplet/.snaplet/dataModel.json index 83c6728ce..c52467d0f 100644 --- a/packages/snaplet/.snaplet/dataModel.json +++ b/packages/snaplet/.snaplet/dataModel.json @@ -1003,7 +1003,7 @@ "isGenerated": false, "sequence": false, "hasDefaultValue": false, - "isId": true, + "isId": false, "maxLength": null }, { @@ -1052,14 +1052,6 @@ ], "nullNotDistinct": false }, - { - "name": "distribution_shares_distribution_id_index_uindex", - "fields": [ - "distribution_id", - "index" - ], - "nullNotDistinct": false - }, { "name": "distribution_shares_user_id_idx", "fields": [ @@ -1662,13 +1654,6 @@ } ], "uniqueConstraints": [ - { - "name": "distributions_number_key", - "fields": [ - "number" - ], - "nullNotDistinct": false - }, { "name": "distributions_pkey", "fields": [ @@ -5269,6 +5254,50 @@ } ] }, + "seed_files": { + "id": "supabase_migrations.seed_files", + "schemaName": "supabase_migrations", + "tableName": "seed_files", + "fields": [ + { + "id": "supabase_migrations.seed_files.path", + "name": "path", + "columnName": "path", + "type": "text", + "isRequired": true, + "kind": "scalar", + "isList": false, + "isGenerated": false, + "sequence": false, + "hasDefaultValue": false, + "isId": true, + "maxLength": null + }, + { + "id": "supabase_migrations.seed_files.hash", + "name": "hash", + "columnName": "hash", + "type": "text", + "isRequired": true, + "kind": "scalar", + "isList": false, + "isGenerated": false, + "sequence": false, + "hasDefaultValue": false, + "isId": false, + "maxLength": null + } + ], + "uniqueConstraints": [ + { + "name": "seed_files_pkey", + "fields": [ + "path" + ], + "nullNotDistinct": false + } + ] + }, "send_account_created": { "id": "public.send_account_created", "schemaName": "public", @@ -5588,14 +5617,6 @@ "credential_id" ], "nullNotDistinct": false - }, - { - "name": "send_account_credentials_account_id_key_slot_key", - "fields": [ - "account_id", - "key_slot" - ], - "nullNotDistinct": false } ] }, @@ -7238,18 +7259,6 @@ "id" ], "nullNotDistinct": false - }, - { - "name": "u_send_token_transfers", - "fields": [ - "abi_idx", - "block_num", - "ig_name", - "log_idx", - "src_name", - "tx_idx" - ], - "nullNotDistinct": false } ] }, diff --git a/.snaplet/snaplet-client.d.ts b/packages/snaplet/.snaplet/snaplet-client.d.ts similarity index 60% rename from .snaplet/snaplet-client.d.ts rename to packages/snaplet/.snaplet/snaplet-client.d.ts index 849bf9c39..c80b84d3e 100644 --- a/.snaplet/snaplet-client.d.ts +++ b/packages/snaplet/.snaplet/snaplet-client.d.ts @@ -14,6 +14,19 @@ type Inflection = { oppositeBaseNameMap?: Record; }; type Override = { + _http_response?: { + name?: string; + fields?: { + id?: string; + status_code?: string; + content_type?: string; + headers?: string; + content?: string; + timed_out?: string; + error_msg?: string; + created?: string; + }; + } activity?: { name?: string; fields?: { @@ -28,6 +41,27 @@ type Override = { users_activity_to_user_idTousers?: string; }; } + affiliate_stats?: { + name?: string; + fields?: { + paymaster_tx_count?: string; + user_id?: string; + id?: string; + created_at?: string; + updated_at?: string; + profiles?: string; + }; + } + audit_log_entries?: { + name?: string; + fields?: { + instance_id?: string; + id?: string; + payload?: string; + created_at?: string; + ip_address?: string; + }; + } buckets?: { name?: string; fields?: { @@ -42,6 +76,8 @@ type Override = { allowed_mime_types?: string; owner_id?: string; objects?: string; + s3_multipart_uploads?: string; + s3_multipart_uploads_parts?: string; }; } chain_addresses?: { @@ -89,6 +125,9 @@ type Override = { distribution_id?: string; created_at?: string; updated_at?: string; + multiplier_min?: string; + multiplier_max?: string; + multiplier_step?: string; distributions?: string; }; } @@ -101,6 +140,7 @@ type Override = { type?: string; metadata?: string; created_at?: string; + weight?: string; users?: string; distributions?: string; }; @@ -129,6 +169,33 @@ type Override = { distribution_verifications?: string; }; } + feature_info?: { + name?: string; + fields?: { + feature?: string; + schema_name?: string; + proname?: string; + obj_identity?: string; + }; + } + flow_state?: { + name?: string; + fields?: { + id?: string; + user_id?: string; + auth_code?: string; + code_challenge_method?: string; + code_challenge?: string; + provider_type?: string; + provider_access_token?: string; + provider_refresh_token?: string; + created_at?: string; + updated_at?: string; + authentication_method?: string; + auth_code_issued_at?: string; + saml_relay_states?: string; + }; + } hooks?: { name?: string; fields?: { @@ -139,6 +206,83 @@ type Override = { request_id?: string; }; } + http_request_queue?: { + name?: string; + fields?: { + id?: string; + method?: string; + url?: string; + headers?: string; + body?: string; + timeout_milliseconds?: string; + }; + } + identities?: { + name?: string; + fields?: { + provider_id?: string; + user_id?: string; + identity_data?: string; + provider?: string; + last_sign_in_at?: string; + created_at?: string; + updated_at?: string; + email?: string; + id?: string; + users?: string; + }; + } + ig_updates?: { + name?: string; + fields?: { + name?: string; + src_name?: string; + backfill?: string; + num?: string; + latency?: string; + nrows?: string; + stop?: string; + }; + } + instances?: { + name?: string; + fields?: { + id?: string; + uuid?: string; + raw_base_config?: string; + created_at?: string; + updated_at?: string; + }; + } + integrations?: { + name?: string; + fields?: { + name?: string; + conf?: string; + }; + } + key?: { + name?: string; + fields?: { + id?: string; + status?: string; + created?: string; + expires?: string; + key_type?: string; + key_id?: string; + key_context?: string; + name?: string; + associated_data?: string; + raw_key?: string; + raw_key_nonce?: string; + parent_key?: string; + comment?: string; + user_data?: string; + key?: string; + key?: string; + secrets?: string; + }; + } leaderboard_referrals_all_time?: { name?: string; fields?: { @@ -149,6 +293,59 @@ type Override = { users?: string; }; } + messages?: { + name?: string; + fields?: { + id?: string; + topic?: string; + extension?: string; + inserted_at?: string; + updated_at?: string; + }; + } + mfa_amr_claims?: { + name?: string; + fields?: { + session_id?: string; + created_at?: string; + updated_at?: string; + authentication_method?: string; + id?: string; + sessions?: string; + }; + } + mfa_challenges?: { + name?: string; + fields?: { + id?: string; + factor_id?: string; + created_at?: string; + verified_at?: string; + ip_address?: string; + otp_code?: string; + web_authn_session_data?: string; + mfa_factors?: string; + }; + } + mfa_factors?: { + name?: string; + fields?: { + id?: string; + user_id?: string; + friendly_name?: string; + factor_type?: string; + status?: string; + created_at?: string; + updated_at?: string; + secret?: string; + phone?: string; + last_challenged_at?: string; + web_authn_credential?: string; + web_authn_aaguid?: string; + users?: string; + mfa_challenges?: string; + }; + } storage_migrations?: { name?: string; fields?: { @@ -179,9 +376,23 @@ type Override = { path_tokens?: string; version?: string; owner_id?: string; + user_metadata?: string; buckets?: string; }; } + one_time_tokens?: { + name?: string; + fields?: { + id?: string; + user_id?: string; + token_type?: string; + token_hash?: string; + relates_to?: string; + created_at?: string; + updated_at?: string; + users?: string; + }; + } profiles?: { name?: string; fields?: { @@ -193,6 +404,7 @@ type Override = { is_public?: string; send_id?: string; users?: string; + affiliate_stats?: string; referrals_referrals_referred_idToprofiles?: string; referrals_referrals_referrer_idToprofiles?: string; }; @@ -220,12 +432,97 @@ type Override = { tags?: string; }; } + refresh_tokens?: { + name?: string; + fields?: { + instance_id?: string; + id?: string; + token?: string; + user_id?: string; + revoked?: string; + created_at?: string; + updated_at?: string; + parent?: string; + session_id?: string; + sessions?: string; + }; + } + s3_multipart_uploads?: { + name?: string; + fields?: { + id?: string; + in_progress_size?: string; + upload_signature?: string; + bucket_id?: string; + key?: string; + version?: string; + owner_id?: string; + created_at?: string; + user_metadata?: string; + buckets?: string; + s3_multipart_uploads_parts?: string; + }; + } + s3_multipart_uploads_parts?: { + name?: string; + fields?: { + id?: string; + upload_id?: string; + size?: string; + part_number?: string; + bucket_id?: string; + key?: string; + etag?: string; + owner_id?: string; + version?: string; + created_at?: string; + buckets?: string; + s3_multipart_uploads?: string; + }; + } + saml_providers?: { + name?: string; + fields?: { + id?: string; + sso_provider_id?: string; + entity_id?: string; + metadata_xml?: string; + metadata_url?: string; + attribute_mapping?: string; + created_at?: string; + updated_at?: string; + name_id_format?: string; + sso_providers?: string; + }; + } + saml_relay_states?: { + name?: string; + fields?: { + id?: string; + sso_provider_id?: string; + request_id?: string; + for_email?: string; + redirect_to?: string; + created_at?: string; + updated_at?: string; + flow_state_id?: string; + flow_state?: string; + sso_providers?: string; + }; + } auth_schema_migrations?: { name?: string; fields?: { version?: string; }; } + realtime_schema_migrations?: { + name?: string; + fields?: { + version?: string; + inserted_at?: string; + }; + } supabase_migrations_schema_migrations?: { name?: string; fields?: { @@ -234,6 +531,27 @@ type Override = { name?: string; }; } + secrets?: { + name?: string; + fields?: { + id?: string; + name?: string; + description?: string; + secret?: string; + key_id?: string; + nonce?: string; + created_at?: string; + updated_at?: string; + key?: string; + }; + } + seed_files?: { + name?: string; + fields?: { + path?: string; + hash?: string; + }; + } send_account_created?: { name?: string; fields?: { @@ -425,6 +743,68 @@ type Override = { abi_idx?: string; }; } + sessions?: { + name?: string; + fields?: { + id?: string; + user_id?: string; + created_at?: string; + updated_at?: string; + factor_id?: string; + aal?: string; + not_after?: string; + refreshed_at?: string; + user_agent?: string; + ip?: string; + tag?: string; + users?: string; + mfa_amr_claims?: string; + refresh_tokens?: string; + }; + } + sources?: { + name?: string; + fields?: { + name?: string; + chain_id?: string; + url?: string; + }; + } + sso_domains?: { + name?: string; + fields?: { + id?: string; + sso_provider_id?: string; + domain?: string; + created_at?: string; + updated_at?: string; + sso_providers?: string; + }; + } + sso_providers?: { + name?: string; + fields?: { + id?: string; + resource_id?: string; + created_at?: string; + updated_at?: string; + saml_providers?: string; + saml_relay_states?: string; + sso_domains?: string; + }; + } + subscription?: { + name?: string; + fields?: { + id?: string; + subscription_id?: string; + entity?: string; + filters?: string; + claims?: string; + claims_role?: string; + created_at?: string; + }; + } tag_receipts?: { name?: string; fields?: { @@ -456,6 +836,23 @@ type Override = { tag_receipts?: string; }; } + task_updates?: { + name?: string; + fields?: { + num?: string; + hash?: string; + insert_at?: string; + src_hash?: string; + src_num?: string; + nblocks?: string; + nrows?: string; + latency?: string; + src_name?: string; + stop?: string; + chain_id?: string; + ig_name?: string; + }; + } users?: { name?: string; fields?: { @@ -494,6 +891,10 @@ type Override = { is_sso_user?: string; deleted_at?: string; is_anonymous?: string; + identities?: string; + mfa_factors?: string; + one_time_tokens?: string; + sessions?: string; leaderboard_referrals_all_time?: string; activity_activity_from_user_idTousers?: string; activity_activity_to_user_idTousers?: string; @@ -549,6 +950,12 @@ interface FingerprintNumberField { } } export interface Fingerprint { + HttpResponses?: { + id?: FingerprintNumberField; + statusCode?: FingerprintNumberField; + headers?: FingerprintJsonField; + created?: FingerprintDateField; + } activities?: { id?: FingerprintNumberField; data?: FingerprintJsonField; @@ -556,11 +963,23 @@ export interface Fingerprint { fromUser?: FingerprintRelationField; toUser?: FingerprintRelationField; } + affiliateStats?: { + paymasterTxCount?: FingerprintNumberField; + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + user?: FingerprintRelationField; + } + auditLogEntries?: { + payload?: FingerprintJsonField; + createdAt?: FingerprintDateField; + } buckets?: { createdAt?: FingerprintDateField; updatedAt?: FingerprintDateField; fileSizeLimit?: FingerprintNumberField; objects?: FingerprintRelationField; + s3MultipartUploads?: FingerprintRelationField; + s3MultipartUploadsParts?: FingerprintRelationField; } chainAddresses?: { createdAt?: FingerprintDateField; @@ -590,6 +1009,9 @@ export interface Fingerprint { distributionId?: FingerprintNumberField; createdAt?: FingerprintDateField; updatedAt?: FingerprintDateField; + multiplierMin?: FingerprintNumberField; + multiplierMax?: FingerprintNumberField; + multiplierStep?: FingerprintNumberField; distribution?: FingerprintRelationField; } distributionVerifications?: { @@ -597,6 +1019,7 @@ export interface Fingerprint { distributionId?: FingerprintNumberField; metadata?: FingerprintJsonField; createdAt?: FingerprintDateField; + weight?: FingerprintNumberField; user?: FingerprintRelationField; distribution?: FingerprintRelationField; } @@ -619,18 +1042,83 @@ export interface Fingerprint { distributionVerificationValues?: FingerprintRelationField; distributionVerifications?: FingerprintRelationField; } + featureInfos?: { + + } + flowStates?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + authCodeIssuedAt?: FingerprintDateField; + samlRelayStates?: FingerprintRelationField; + } hooks?: { id?: FingerprintNumberField; hookTableId?: FingerprintNumberField; createdAt?: FingerprintDateField; requestId?: FingerprintNumberField; } + httpRequestQueues?: { + id?: FingerprintNumberField; + headers?: FingerprintJsonField; + timeoutMilliseconds?: FingerprintNumberField; + } + identities?: { + identityData?: FingerprintJsonField; + lastSignInAt?: FingerprintDateField; + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + user?: FingerprintRelationField; + } + igUpdates?: { + num?: FingerprintNumberField; + nrows?: FingerprintNumberField; + stop?: FingerprintNumberField; + } + instances?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + } + integrations?: { + conf?: FingerprintJsonField; + } + keys?: { + created?: FingerprintDateField; + expires?: FingerprintDateField; + keyId?: FingerprintNumberField; + keysByParentKey?: FingerprintRelationField; + keysByParentKey?: FingerprintRelationField; + secrets?: FingerprintRelationField; + } leaderboardReferralsAllTimes?: { referrals?: FingerprintNumberField; rewardsUsdc?: FingerprintNumberField; updatedAt?: FingerprintDateField; user?: FingerprintRelationField; } + messages?: { + id?: FingerprintNumberField; + insertedAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + } + mfaAmrClaims?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + session?: FingerprintRelationField; + } + mfaChallenges?: { + createdAt?: FingerprintDateField; + verifiedAt?: FingerprintDateField; + webAuthnSessionData?: FingerprintJsonField; + factor?: FingerprintRelationField; + } + mfaFactors?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + lastChallengedAt?: FingerprintDateField; + webAuthnCredential?: FingerprintJsonField; + user?: FingerprintRelationField; + mfaChallengesByFactorId?: FingerprintRelationField; + } storageMigrations?: { id?: FingerprintNumberField; executedAt?: FingerprintDateField; @@ -643,11 +1131,18 @@ export interface Fingerprint { updatedAt?: FingerprintDateField; lastAccessedAt?: FingerprintDateField; metadata?: FingerprintJsonField; + userMetadata?: FingerprintJsonField; bucket?: FingerprintRelationField; } + oneTimeTokens?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + user?: FingerprintRelationField; + } profiles?: { sendId?: FingerprintNumberField; i?: FingerprintRelationField; + affiliateStatsByUserId?: FingerprintRelationField; referralsByReferredId?: FingerprintRelationField; referralsByReferrerId?: FingerprintRelationField; } @@ -662,11 +1157,55 @@ export interface Fingerprint { referrer?: FingerprintRelationField; tagByTag?: FingerprintRelationField; } + refreshTokens?: { + id?: FingerprintNumberField; + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + session?: FingerprintRelationField; + } + s3MultipartUploads?: { + inProgressSize?: FingerprintNumberField; + createdAt?: FingerprintDateField; + userMetadata?: FingerprintJsonField; + bucket?: FingerprintRelationField; + s3MultipartUploadsPartsByUploadId?: FingerprintRelationField; + } + s3MultipartUploadsParts?: { + size?: FingerprintNumberField; + partNumber?: FingerprintNumberField; + createdAt?: FingerprintDateField; + bucket?: FingerprintRelationField; + upload?: FingerprintRelationField; + } + samlProviders?: { + attributeMapping?: FingerprintJsonField; + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + ssoProvider?: FingerprintRelationField; + } + samlRelayStates?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + flowState?: FingerprintRelationField; + ssoProvider?: FingerprintRelationField; + } authSchemaMigrations?: { + } + realtimeSchemaMigrations?: { + version?: FingerprintNumberField; + insertedAt?: FingerprintDateField; } supabaseMigrationsSchemaMigrations?: { + } + secrets?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + key?: FingerprintRelationField; + } + seedFiles?: { + } sendAccountCreateds?: { chainId?: FingerprintNumberField; @@ -765,6 +1304,35 @@ export interface Fingerprint { logIdx?: FingerprintNumberField; abiIdx?: FingerprintNumberField; } + sessions?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + notAfter?: FingerprintDateField; + refreshedAt?: FingerprintDateField; + user?: FingerprintRelationField; + mfaAmrClaims?: FingerprintRelationField; + refreshTokens?: FingerprintRelationField; + } + sources?: { + chainId?: FingerprintNumberField; + } + ssoDomains?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + ssoProvider?: FingerprintRelationField; + } + ssoProviders?: { + createdAt?: FingerprintDateField; + updatedAt?: FingerprintDateField; + samlProviders?: FingerprintRelationField; + samlRelayStates?: FingerprintRelationField; + ssoDomains?: FingerprintRelationField; + } + subscriptions?: { + id?: FingerprintNumberField; + claims?: FingerprintJsonField; + createdAt?: FingerprintDateField; + } tagReceipts?: { id?: FingerprintNumberField; createdAt?: FingerprintDateField; @@ -779,6 +1347,15 @@ export interface Fingerprint { referralsByTag?: FingerprintRelationField; tagReceipts?: FingerprintRelationField; } + taskUpdates?: { + num?: FingerprintNumberField; + insertAt?: FingerprintDateField; + srcNum?: FingerprintNumberField; + nblocks?: FingerprintNumberField; + nrows?: FingerprintNumberField; + stop?: FingerprintNumberField; + chainId?: FingerprintNumberField; + } users?: { emailConfirmedAt?: FingerprintDateField; invitedAt?: FingerprintDateField; @@ -797,6 +1374,10 @@ export interface Fingerprint { bannedUntil?: FingerprintDateField; reauthenticationSentAt?: FingerprintDateField; deletedAt?: FingerprintDateField; + identities?: FingerprintRelationField; + mfaFactors?: FingerprintRelationField; + oneTimeTokens?: FingerprintRelationField; + sessions?: FingerprintRelationField; leaderboardReferralsAllTimes?: FingerprintRelationField; activitiesByFromUserId?: FingerprintRelationField; activitiesByToUserId?: FingerprintRelationField; diff --git a/.snaplet/snaplet.d.ts b/packages/snaplet/.snaplet/snaplet.d.ts similarity index 83% rename from .snaplet/snaplet.d.ts rename to packages/snaplet/.snaplet/snaplet.d.ts index 628ae8731..c224de5f1 100644 --- a/.snaplet/snaplet.d.ts +++ b/packages/snaplet/.snaplet/snaplet.d.ts @@ -5,7 +5,7 @@ type Json = Nested; type Enum_auth_aal_level = 'aal1' | 'aal2' | 'aal3'; type Enum_auth_code_challenge_method = 'plain' | 's256'; type Enum_auth_factor_status = 'unverified' | 'verified'; -type Enum_auth_factor_type = 'totp' | 'webauthn'; +type Enum_auth_factor_type = 'phone' | 'totp' | 'webauthn'; type Enum_auth_one_time_token_type = 'confirmation_token' | 'email_change_token_current' | 'email_change_token_new' | 'phone_change_token' | 'reauthentication_token' | 'recovery_token'; type Enum_net_request_status = 'ERROR' | 'PENDING' | 'SUCCESS'; type Enum_pgsodium_key_status = 'default' | 'expired' | 'invalid' | 'valid'; @@ -15,7 +15,10 @@ type Enum_pgtle_pg_tle_features = 'clientauth' | 'passcheck'; type Enum_public_key_type_enum = 'ES256'; type Enum_public_lookup_type_enum = 'address' | 'phone' | 'refcode' | 'sendid' | 'tag'; type Enum_public_tag_status = 'confirmed' | 'pending'; -type Enum_public_verification_type = 'tag_referral' | 'tag_registration'; +type Enum_public_verification_type = 'create_passkey' | 'send_one_hundred' | 'send_streak' | 'send_ten' | 'tag_referral' | 'tag_registration' | 'total_tag_referrals'; +type Enum_public_verification_value_mode = 'aggregate' | 'individual'; +type Enum_realtime_action = 'DELETE' | 'ERROR' | 'INSERT' | 'TRUNCATE' | 'UPDATE'; +type Enum_realtime_equality_op = 'eq' | 'gt' | 'gte' | 'in' | 'lt' | 'lte' | 'neq'; interface Table_net_http_response { id: number | null; status_code: number | null; @@ -35,6 +38,13 @@ interface Table_public_activity { data: Json | null; created_at: string; } +interface Table_public_affiliate_stats { + paymaster_tx_count: number; + user_id: string | null; + id: string; + created_at: string; + updated_at: string; +} interface Table_auth_audit_log_entries { instance_id: string | null; id: string; @@ -85,6 +95,9 @@ interface Table_public_distribution_verification_values { distribution_id: number; created_at: string; updated_at: string; + multiplier_min: number; + multiplier_max: number; + multiplier_step: number; } interface Table_public_distribution_verifications { id: number; @@ -93,6 +106,7 @@ interface Table_public_distribution_verifications { type: Enum_public_verification_type; metadata: Json | null; created_at: string; + weight: number; } interface Table_public_distributions { id: number; @@ -199,6 +213,13 @@ interface Table_private_leaderboard_referrals_all_time { rewards_usdc: number | null; updated_at: string | null; } +interface Table_realtime_messages { + id: number; + topic: string; + extension: string; + inserted_at: string; + updated_at: string; +} interface Table_auth_mfa_amr_claims { session_id: string; created_at: string; @@ -212,6 +233,8 @@ interface Table_auth_mfa_challenges { created_at: string; verified_at: string | null; ip_address: string; + otp_code: string | null; + web_authn_session_data: Json | null; } interface Table_auth_mfa_factors { id: string; @@ -222,6 +245,10 @@ interface Table_auth_mfa_factors { created_at: string; updated_at: string; secret: string | null; + phone: string | null; + last_challenged_at: string | null; + web_authn_credential: Json | null; + web_authn_aaguid: string | null; } interface Table_storage_migrations { id: number; @@ -244,6 +271,7 @@ interface Table_storage_objects { metadata: Json | null; version: string | null; owner_id: string | null; + user_metadata: Json | null; } interface Table_auth_one_time_tokens { id: string; @@ -296,6 +324,7 @@ interface Table_storage_s_3_multipart_uploads { version: string; owner_id: string | null; created_at: string; + user_metadata: Json | null; } interface Table_storage_s_3_multipart_uploads_parts { id: string; @@ -333,6 +362,10 @@ interface Table_auth_saml_relay_states { interface Table_auth_schema_migrations { version: string; } +interface Table_realtime_schema_migrations { + version: number; + inserted_at: string | null; +} interface Table_supabase_migrations_schema_migrations { version: string; statements: string[] | null; @@ -348,6 +381,10 @@ interface Table_vault_secrets { created_at: string; updated_at: string; } +interface Table_supabase_migrations_seed_files { + path: string; + hash: string; +} interface Table_public_send_account_created { chain_id: number; log_addr: string; @@ -525,6 +562,34 @@ interface Table_auth_sso_providers { created_at: string | null; updated_at: string | null; } +interface Table_realtime_subscription { + id: number; + subscription_id: string; + /** + * We couldn't determine the type of this column. The type might be coming from an unknown extension + * or be specific to your database. Please if it's a common used type report this issue so we can fix it! + * Otherwise, please manually type this column by casting it to the correct type. + * @example + * Here is a cast example for copycat use: + * ``` + * copycat.scramble(row.unknownColumn as string) + * ``` + */ + entity: unknown; + /** + * We couldn't determine the type of this column. The type might be coming from an unknown extension + * or be specific to your database. Please if it's a common used type report this issue so we can fix it! + * Otherwise, please manually type this column by casting it to the correct type. + * @example + * Here is a cast example for copycat use: + * ``` + * copycat.scramble(row.unknownColumn as string) + * ``` + */ + filters: unknown[]; + claims: Json; + created_at: string; +} interface Table_public_tag_receipts { tag_name: string; hash: string | null; @@ -606,12 +671,6 @@ interface Table_public_webauthn_credentials { created_at: string; updated_at: string; deleted_at: string | null; -} -interface Schema_analytics { - -} -interface Schema_realtime { - } interface Schema_auth { audit_log_entries: Table_auth_audit_log_entries; @@ -661,6 +720,7 @@ interface Schema_private { } interface Schema_public { activity: Table_public_activity; + affiliate_stats: Table_public_affiliate_stats; chain_addresses: Table_public_chain_addresses; challenges: Table_public_challenges; distribution_shares: Table_public_distribution_shares; @@ -687,7 +747,9 @@ interface Schema_public { webauthn_credentials: Table_public_webauthn_credentials; } interface Schema_realtime { - + messages: Table_realtime_messages; + schema_migrations: Table_realtime_schema_migrations; + subscription: Table_realtime_subscription; } interface Schema_shovel { ig_updates: Table_shovel_ig_updates; @@ -708,13 +770,12 @@ interface Schema_supabase_functions { } interface Schema_supabase_migrations { schema_migrations: Table_supabase_migrations_schema_migrations; + seed_files: Table_supabase_migrations_seed_files; } interface Schema_vault { secrets: Table_vault_secrets; } interface Database { - _analytics: Schema__analytics; - _realtime: Schema__realtime; auth: Schema_auth; dbdev: Schema_dbdev; extensions: Schema_extensions; @@ -750,6 +811,20 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: | {}; + + }; + "public.affiliate_stats": { + parent: { + affiliate_stats_user_id_fkey: "public.profiles"; + }; + children: { + + }; + parentDestinationsTables: "public.profiles" | {}; + childDestinationsTables: | {}; + }; "storage.buckets": { parent: { @@ -760,6 +835,9 @@ interface Tables_relationships { s3_multipart_uploads_bucket_id_fkey: "storage.s3_multipart_uploads"; s3_multipart_uploads_parts_bucket_id_fkey: "storage.s3_multipart_uploads_parts"; }; + parentDestinationsTables: | {}; + childDestinationsTables: "storage.objects" | "storage.s3_multipart_uploads" | "storage.s3_multipart_uploads_parts" | {}; + }; "public.chain_addresses": { parent: { @@ -768,6 +846,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: | {}; + }; "public.distribution_shares": { parent: { @@ -777,6 +858,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.users" | "public.distributions" | {}; + childDestinationsTables: | {}; + }; "public.distribution_verification_values": { parent: { @@ -785,6 +869,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "public.distributions" | {}; + childDestinationsTables: | {}; + }; "public.distribution_verifications": { parent: { @@ -794,6 +881,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.users" | "public.distributions" | {}; + childDestinationsTables: | {}; + }; "public.distributions": { parent: { @@ -804,6 +894,9 @@ interface Tables_relationships { distribution_verification_values_distribution_id_fkey: "public.distribution_verification_values"; distribution_verifications_distribution_id_fkey: "public.distribution_verifications"; }; + parentDestinationsTables: | {}; + childDestinationsTables: "public.distribution_shares" | "public.distribution_verification_values" | "public.distribution_verifications" | {}; + }; "auth.flow_state": { parent: { @@ -812,6 +905,9 @@ interface Tables_relationships { children: { saml_relay_states_flow_state_id_fkey: "auth.saml_relay_states"; }; + parentDestinationsTables: | {}; + childDestinationsTables: "auth.saml_relay_states" | {}; + }; "auth.identities": { parent: { @@ -820,6 +916,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: | {}; + }; "pgsodium.key": { parent: { @@ -829,6 +928,9 @@ interface Tables_relationships { key_parent_key_fkey: "pgsodium.key"; secrets_key_id_fkey: "vault.secrets"; }; + parentDestinationsTables: "pgsodium.key" | {}; + childDestinationsTables: "pgsodium.key" | "vault.secrets" | {}; + }; "private.leaderboard_referrals_all_time": { parent: { @@ -837,6 +939,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: | {}; + }; "auth.mfa_amr_claims": { parent: { @@ -845,6 +950,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.sessions" | {}; + childDestinationsTables: | {}; + }; "auth.mfa_challenges": { parent: { @@ -853,6 +961,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.mfa_factors" | {}; + childDestinationsTables: | {}; + }; "auth.mfa_factors": { parent: { @@ -861,6 +972,9 @@ interface Tables_relationships { children: { mfa_challenges_auth_factor_id_fkey: "auth.mfa_challenges"; }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: "auth.mfa_challenges" | {}; + }; "storage.objects": { parent: { @@ -869,6 +983,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "storage.buckets" | {}; + childDestinationsTables: | {}; + }; "auth.one_time_tokens": { parent: { @@ -877,15 +994,22 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: | {}; + }; "public.profiles": { parent: { profiles_id_fkey: "auth.users"; }; children: { + affiliate_stats_user_id_fkey: "public.affiliate_stats"; referrals_referred_id_fkey: "public.referrals"; referrals_referrer_id_fkey: "public.referrals"; }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: "public.affiliate_stats" | "public.referrals" | {}; + }; "public.receipts": { parent: { @@ -894,6 +1018,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: | {}; + }; "public.referrals": { parent: { @@ -904,6 +1031,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "public.profiles" | "public.tags" | {}; + childDestinationsTables: | {}; + }; "auth.refresh_tokens": { parent: { @@ -912,6 +1042,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.sessions" | {}; + childDestinationsTables: | {}; + }; "storage.s3_multipart_uploads": { parent: { @@ -920,6 +1053,9 @@ interface Tables_relationships { children: { s3_multipart_uploads_parts_upload_id_fkey: "storage.s3_multipart_uploads_parts"; }; + parentDestinationsTables: "storage.buckets" | {}; + childDestinationsTables: "storage.s3_multipart_uploads_parts" | {}; + }; "storage.s3_multipart_uploads_parts": { parent: { @@ -929,6 +1065,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "storage.buckets" | "storage.s3_multipart_uploads" | {}; + childDestinationsTables: | {}; + }; "auth.saml_providers": { parent: { @@ -937,6 +1076,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.sso_providers" | {}; + childDestinationsTables: | {}; + }; "auth.saml_relay_states": { parent: { @@ -946,6 +1088,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.flow_state" | "auth.sso_providers" | {}; + childDestinationsTables: | {}; + }; "vault.secrets": { parent: { @@ -954,6 +1099,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "pgsodium.key" | {}; + childDestinationsTables: | {}; + }; "public.send_account_credentials": { parent: { @@ -963,6 +1111,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "public.send_accounts" | "public.webauthn_credentials" | {}; + childDestinationsTables: | {}; + }; "public.send_accounts": { parent: { @@ -971,6 +1122,9 @@ interface Tables_relationships { children: { account_credentials_account_id_fkey: "public.send_account_credentials"; }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: "public.send_account_credentials" | {}; + }; "auth.sessions": { parent: { @@ -980,6 +1134,9 @@ interface Tables_relationships { mfa_amr_claims_session_id_fkey: "auth.mfa_amr_claims"; refresh_tokens_session_id_fkey: "auth.refresh_tokens"; }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: "auth.mfa_amr_claims" | "auth.refresh_tokens" | {}; + }; "auth.sso_domains": { parent: { @@ -988,6 +1145,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "auth.sso_providers" | {}; + childDestinationsTables: | {}; + }; "auth.sso_providers": { parent: { @@ -998,6 +1158,9 @@ interface Tables_relationships { saml_relay_states_sso_provider_id_fkey: "auth.saml_relay_states"; sso_domains_sso_provider_id_fkey: "auth.sso_domains"; }; + parentDestinationsTables: | {}; + childDestinationsTables: "auth.saml_providers" | "auth.saml_relay_states" | "auth.sso_domains" | {}; + }; "public.tag_receipts": { parent: { @@ -1006,6 +1169,9 @@ interface Tables_relationships { children: { }; + parentDestinationsTables: "public.tags" | {}; + childDestinationsTables: | {}; + }; "public.tags": { parent: { @@ -1015,6 +1181,9 @@ interface Tables_relationships { referrals_tag_fkey: "public.referrals"; tag_receipts_tag_name_fkey: "public.tag_receipts"; }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: "public.referrals" | "public.tag_receipts" | {}; + }; "auth.users": { parent: { @@ -1037,6 +1206,9 @@ interface Tables_relationships { tags_user_id_fkey: "public.tags"; webauthn_credentials_user_id_fkey: "public.webauthn_credentials"; }; + parentDestinationsTables: | {}; + childDestinationsTables: "auth.identities" | "auth.mfa_factors" | "auth.one_time_tokens" | "auth.sessions" | "private.leaderboard_referrals_all_time" | "public.activity" | "public.chain_addresses" | "public.distribution_shares" | "public.distribution_verifications" | "public.profiles" | "public.receipts" | "public.send_accounts" | "public.tags" | "public.webauthn_credentials" | {}; + }; "public.webauthn_credentials": { parent: { @@ -1045,6 +1217,9 @@ interface Tables_relationships { children: { account_credentials_credential_id_fkey: "public.send_account_credentials"; }; + parentDestinationsTables: "auth.users" | {}; + childDestinationsTables: "public.send_account_credentials" | {}; + }; } //#endregion @@ -1265,7 +1440,8 @@ type SubsetTarget = { type GetSelectedTableChildrenKeys = keyof Tables_relationships[TTable]['children'] type GetSelectedTableParentKeys = keyof Tables_relationships[TTable]['parent'] -type GetSelectedTableRelationsKeys = GetSelectedTableChildrenKeys | GetSelectedTableParentKeys +type GetRelationDestinationKey = Tables_relationships[TTable]['parentDestinationsTables'] | Tables_relationships[TTable]['childDestinationsTables'] +type GetSelectedTableRelationsKeys = GetSelectedTableChildrenKeys | GetSelectedTableParentKeys | GetRelationDestinationKey type SelectedTablesWithRelationsIds = TSelectedTable extends keyof Tables_relationships ? TSelectedTable : never /** @@ -1275,7 +1451,12 @@ type FollowNullableRelationsOptions = // Type can be a global boolean definition boolean // Or can be a mix of $default and table specific definition - | { $default: boolean } & ({ + | { + $default: boolean | + { + [Key in GetSelectedTableRelationsKeys> | '$default']?: boolean + } + } & ({ // If it's a table specific definition and the table has relationships [TTable in SelectedTablesWithRelationsIds]?: // It's either a boolean or a mix of $default and relationship specific definition @@ -1293,7 +1474,12 @@ type MaxCyclesLoopOptions = // Type can be a global number definition number // Or can be a mix of $default and table specific definition -| { $default: number } & ({ +| { + $default: number | + { + [Key in GetSelectedTableRelationsKeys> | '$default']?: number + } + } & ({ // If it's a table specific definition and the table has relationships [TTable in SelectedTablesWithRelationsIds]?: // It's either a number or a mix of $default and relationship specific definition @@ -1311,7 +1497,12 @@ type MaxChildrenPerNodeOptions = // Type can be a global number definition number // Or can be a mix of $default and table specific definition -| { $default: number } & ({ +| { + $default: number | + { + [Key in GetSelectedTableRelationsKeys> | '$default']?: number + } + } & ({ // If it's a table specific definition and the table has relationships [TTable in SelectedTablesWithRelationsIds]?: // It's either a number or a mix of $default and relationship specific definition @@ -1379,6 +1570,15 @@ type SubsetConfig = { * By default, the algorithm will not sort the tasks. */ taskSortAlgorithm?: "children" | "idsCount"; + + /** + * Specifies whether to consider all targets collectively ('together'), + * or one target at a time ('sequential') when the traversal algorithm is + * determining the next steps. + * + * By default, the 'together' will be used. + */ + traversalMode?: "sequential" | "together"; } //#endregion diff --git a/packages/snaplet/bin/snaplet.ts b/packages/snaplet/bin/snaplet.ts index 77d352a79..1b1526717 100644 --- a/packages/snaplet/bin/snaplet.ts +++ b/packages/snaplet/bin/snaplet.ts @@ -80,8 +80,10 @@ if (argv.restore) { process.exit(1) } ) + console.log(chalk.green('Done restoring database')) if (rmMigs) { // now migrate the database with the latest migrations + console.log(chalk.blue('Migrating database after restoring snapshot...')) await $`git checkout ${prjRoot}/supabase/migrations`.catch((e) => { console.log(chalk.red('Error checking out migrations:'), e) process.exit(1) @@ -90,8 +92,11 @@ if (argv.restore) { console.log(chalk.red('Error migrating database:'), e) process.exit(1) }) + console.log(chalk.green('Done migrating database')) process.exit(0) } + console.log(chalk.green('Done restoring database')) + process.exit(0) } if (argv.onboardUsers) { diff --git a/packages/snaplet/snaplet.config.ts b/packages/snaplet/snaplet.config.ts index 6f272ffe4..3440d93c6 100644 --- a/packages/snaplet/snaplet.config.ts +++ b/packages/snaplet/snaplet.config.ts @@ -52,22 +52,29 @@ export default defineConfig({ // @ts-ignore pgtap: false, public: { - // activity: false, + challenges: false, + activity: false, + send_account_transfers: false, + send_token_transfers: false, + receipts: false, + tag_receipts: false, }, }, // TODO: figure out how much data we need to snapshot // subset: { // targets: [ - // // { - // // table: "public.activity", - // // orderBy: `"activity"."created_at" desc`, - // // percent: 10 - // // }, - // // { - // // table: "public.send_account_transfers", - // // orderBy: `"send_account_transfers"."block_num" desc`, - // // percent: 5 - // // } + // { + // table: 'public.activity', + // orderBy: `"activity"."created_at" desc`, + // where: `"activity"."created_at" > current_date - interval '31 day'`, + // }, + // { + // table: 'public.send_account_transfers', + // orderBy: `"send_account_transfers"."block_num" desc`, + // // 30 days of transfers + // // avg 2 sec block time means 86400 / 2 = 43200 blocks per day + // where: `"send_account_transfers"."block_time" > (43200 * 31)`, + // }, // ], // }, transform: { @@ -89,6 +96,7 @@ export default defineConfig({ } return { + ...row, email: copycat.email(row.email, { limit: 255, }), @@ -99,34 +107,45 @@ export default defineConfig({ }, storage: { buckets: ({ row }) => { - return {} + return row }, objects: ({ row }) => { - return {} + return row }, }, public: { profiles: ({ row }) => { return { + ...row, name: copycat.fullName(row.name), about: copycat.sentence(row.about), referral_code: copycat.scramble(row.referral_code), } }, + send_accounts: ({ row }) => { + return row + }, send_account_transfers: ({ row }) => { - return {} + return row }, send_account_created: ({ row }) => { - return {} + return row }, send_token_transfers: ({ row }) => { - return {} + return row }, tags: ({ row }) => { - return { - // name: tagName(copycat.username(row.name)), - } + return row + }, + distributions: ({ row }) => { + return row + }, + distribution_shares: ({ row }) => { + return row + }, + distribution_verification_values: ({ row }) => { + return row }, distribution_verifications: ({ row }) => { if (row.metadata === null) { @@ -146,19 +165,13 @@ export default defineConfig({ } }, referrals: ({ row }) => { - return { - // tag: tagName(row.tag), - } + return row }, tag_receipts: ({ row }) => { - return { - // tag_name: tagName(row.tag_name), - } + return row }, tag_reservations: ({ row }) => { - return { - // tag_name: tagName(row.tag_name), - } + return row }, }, }, diff --git a/supabase/migrations/20241117152730_fix_profile_lookup_tag_ilike.sql b/supabase/migrations/20241117152730_fix_profile_lookup_tag_ilike.sql new file mode 100644 index 000000000..da0fb0c91 --- /dev/null +++ b/supabase/migrations/20241117152730_fix_profile_lookup_tag_ilike.sql @@ -0,0 +1,44 @@ +set check_function_bodies = off; + +CREATE OR REPLACE FUNCTION public.profile_lookup(lookup_type lookup_type_enum, identifier text) + RETURNS TABLE(id uuid, avatar_url text, name text, about text, refcode text, tag citext, address citext, chain_id integer, is_public boolean, sendid integer, all_tags text[]) + LANGUAGE plpgsql + IMMUTABLE SECURITY DEFINER +AS $function$ +begin + if identifier is null or identifier = '' then raise exception 'identifier cannot be null or empty'; end if; + if lookup_type is null then raise exception 'lookup_type cannot be null'; end if; + return query -- + select case when p.id = ( select auth.uid() ) then p.id end as id, + p.avatar_url::text as avatar_url, + p.name::text as tag, + p.about::text as about, + p.referral_code as refcode, + t.name as tag, + sa.address as address, + sa.chain_id as chain_id, + case when current_setting('role')::text = 'service_role' then p.is_public + when p.is_public then true + else false end as is_public, + p.send_id as sendid, + ( select array_agg(t.name::text) + from tags t + where t.user_id = p.id and t.status = 'confirmed'::tag_status ) as all_tags + from profiles p + join auth.users a on a.id = p.id + left join tags t on t.user_id = p.id and t.status = 'confirmed'::tag_status + left join send_accounts sa on sa.user_id = p.id + where ((lookup_type = 'sendid' and p.send_id::text = identifier) or + (lookup_type = 'tag' and t.name = identifier) or + (lookup_type = 'refcode' and p.referral_code = identifier) or + (lookup_type = 'address' and sa.address = identifier) or + (lookup_type = 'phone' and a.phone::text = identifier)) + and (p.is_public -- allow public profiles to be returned + or ( select auth.uid() ) is not null -- allow profiles to be returned if the user is authenticated + or current_setting('role')::text = 'service_role') -- allow public profiles to be returned to service role + limit 1; +end; +$function$ +; + + diff --git a/supabase/migrations/20241117152731_add_indexes.sql b/supabase/migrations/20241117152731_add_indexes.sql new file mode 100644 index 000000000..f2d3d8ea1 --- /dev/null +++ b/supabase/migrations/20241117152731_add_indexes.sql @@ -0,0 +1,25 @@ +-- create missing block number and time indexes + +create index concurrently send_account_created_account_block_num on send_account_created (block_num); +create index concurrently send_account_created_account_block_time on send_account_created (block_time); + +create index concurrently send_account_receives_block_num on send_account_receives (block_num); +create index concurrently send_account_receives_block_time on send_account_receives (block_time); + +create index concurrently send_account_signing_key_added_block_num on send_account_signing_key_added (block_num); +create index concurrently send_account_signing_key_added_block_time on send_account_signing_key_added (block_time); + +create index concurrently send_account_signing_key_removed_block_num on send_account_signing_key_removed (block_num); +create index concurrently send_account_signing_key_removed_block_time on send_account_signing_key_removed (block_time); + +-- create index concurrently send_revenues_safe_receives_block_num on send_revenues_safe_receives (block_num); +create index concurrently send_revenues_safe_receives_block_time on send_revenues_safe_receives (block_time); + +create index concurrently send_account_transfers_block_num on send_account_transfers (block_num); +create index concurrently send_account_transfers_block_time on send_account_transfers (block_time); + +create index concurrently send_token_transfers_block_num on send_token_transfers (block_num); +create index concurrently send_token_transfers_block_time on send_token_transfers (block_time); + +create index concurrently sendtag_checkout_receipts_block_num on sendtag_checkout_receipts (block_num); +create index concurrently sendtag_checkout_receipts_block_time on sendtag_checkout_receipts (block_time); diff --git a/supabase/tests/profile_lookup_test.sql b/supabase/tests/profile_lookup_test.sql index fa66a9f78..1bdc69516 100644 --- a/supabase/tests/profile_lookup_test.sql +++ b/supabase/tests/profile_lookup_test.sql @@ -1,5 +1,5 @@ BEGIN; -SELECT plan(9); +SELECT plan(10); CREATE EXTENSION "basejump-supabase_test_helpers"; SELECT tests.create_supabase_user('valid_tag_user'); SELECT tests.authenticate_as_service_role(); @@ -12,6 +12,17 @@ VALUES ( 1, '\\x00112233445566778899AABBCCDDEEFF' ); +SELECT tests.create_supabase_user('kennyl'); +SELECT tests.authenticate_as_service_role(); +INSERT INTO tags (user_id, name, status) +VALUES (tests.get_supabase_uid('kennyl'), 'kennyl', 'confirmed'); +INSERT INTO send_accounts (user_id, address, chain_id, init_code) +VALUES ( + tests.get_supabase_uid('kennyl'), + '0xb0b0000000000000000000000000000000000000', + 1, + '\\x00112233445566778899AABBCCDDEEFF' +); DO $$ DECLARE send_id int; @@ -92,6 +103,15 @@ SELECT throws_ok($$ SELECT throws_ok($$ SELECT public.profile_lookup('invalid_lookup_type', 'valid_tag') $$, 'invalid input value for enum lookup_type_enum: "invalid_lookup_type"', 'Test invalid lookup_type profile_lookup call'); +-- Test looking up kenny_ does not return kennyl +SELECT tests.authenticate_as_service_role(); +SELECT results_eq($$ + SELECT + count(*) FROM public.profile_lookup('tag', 'kenny_') $$, $$ + VALUES ( + 0::bigint + ) $$, 'Test looking up kenny_ does not return kennyl'); + SELECT * FROM finish(); diff --git a/yarn.lock b/yarn.lock index 843236574..6f6e20ccb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31408,7 +31408,6 @@ __metadata: eslint: "npm:^8.46.0" lefthook: "npm:^1.5.5" node-gyp: "npm:^9.3.1" - snaplet: "npm:^0.42.1" turbo: "npm:^2.0.3" typescript: "npm:^5.5.3" zx: "npm:^8.1.2" @@ -31854,15 +31853,6 @@ __metadata: languageName: node linkType: hard -"snaplet@npm:^0.42.1": - version: 0.42.1 - resolution: "snaplet@npm:0.42.1" - bin: - snaplet: bin/snaplet.js - checksum: 10/2a79ff70ec40864d4cffaf69d196f1777a99b38489d158609d9b7c09d05d396ca9fc76463f75710922048b98ba960cbe307f2978d575244672bc4bf53c7bf4a7 - languageName: node - linkType: hard - "socket.io-client@npm:^4.5.1": version: 4.7.4 resolution: "socket.io-client@npm:4.7.4"