@robosystems/client 0.2.14 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/TableIngestClient.js +5 -4
- package/extensions/TableIngestClient.ts +8 -7
- package/package.json +1 -1
- package/sdk/sdk.gen.d.ts +324 -244
- package/sdk/sdk.gen.js +410 -274
- package/sdk/sdk.gen.ts +404 -268
- package/sdk/types.gen.d.ts +697 -239
- package/sdk/types.gen.ts +736 -253
- package/sdk-extensions/TableIngestClient.js +5 -4
- package/sdk-extensions/TableIngestClient.ts +8 -7
- package/sdk.gen.d.ts +324 -244
- package/sdk.gen.js +410 -274
- package/sdk.gen.ts +404 -268
- package/types.gen.d.ts +697 -239
- package/types.gen.ts +736 -253
package/sdk.gen.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
3
|
import type { Options as ClientOptions, TDataShape, Client } from './client';
|
|
4
|
-
import type { RegisterUserData, RegisterUserResponses, RegisterUserErrors, LoginUserData, LoginUserResponses, LoginUserErrors, LogoutUserData, LogoutUserResponses, GetCurrentAuthUserData, GetCurrentAuthUserResponses, GetCurrentAuthUserErrors, RefreshAuthSessionData, RefreshAuthSessionResponses, RefreshAuthSessionErrors, ResendVerificationEmailData, ResendVerificationEmailResponses, ResendVerificationEmailErrors, VerifyEmailData, VerifyEmailResponses, VerifyEmailErrors, GetPasswordPolicyData, GetPasswordPolicyResponses, CheckPasswordStrengthData, CheckPasswordStrengthResponses, CheckPasswordStrengthErrors, ForgotPasswordData, ForgotPasswordResponses, ForgotPasswordErrors, ValidateResetTokenData, ValidateResetTokenResponses, ValidateResetTokenErrors, ResetPasswordData, ResetPasswordResponses, ResetPasswordErrors, GenerateSsoTokenData, GenerateSsoTokenResponses, GenerateSsoTokenErrors, SsoTokenExchangeData, SsoTokenExchangeResponses, SsoTokenExchangeErrors, CompleteSsoAuthData, CompleteSsoAuthResponses, CompleteSsoAuthErrors, GetCaptchaConfigData, GetCaptchaConfigResponses, GetServiceStatusData, GetServiceStatusResponses, GetCurrentUserData, GetCurrentUserResponses, UpdateUserData, UpdateUserResponses, UpdateUserErrors, UpdateUserPasswordData, UpdateUserPasswordResponses, UpdateUserPasswordErrors, ListUserApiKeysData, ListUserApiKeysResponses, CreateUserApiKeyData, CreateUserApiKeyResponses, CreateUserApiKeyErrors, RevokeUserApiKeyData, RevokeUserApiKeyResponses, RevokeUserApiKeyErrors, UpdateUserApiKeyData, UpdateUserApiKeyResponses, UpdateUserApiKeyErrors, ListUserOrgsData, ListUserOrgsResponses, CreateOrgData, CreateOrgResponses, CreateOrgErrors, GetOrgData, GetOrgResponses, GetOrgErrors, UpdateOrgData, UpdateOrgResponses, UpdateOrgErrors, ListOrgGraphsData, ListOrgGraphsResponses, ListOrgGraphsErrors, ListOrgMembersData, ListOrgMembersResponses, ListOrgMembersErrors, InviteOrgMemberData, InviteOrgMemberResponses, InviteOrgMemberErrors, RemoveOrgMemberData, RemoveOrgMemberResponses, RemoveOrgMemberErrors, UpdateOrgMemberRoleData, UpdateOrgMemberRoleResponses, UpdateOrgMemberRoleErrors, GetOrgLimitsData, GetOrgLimitsResponses, GetOrgLimitsErrors, GetOrgUsageData, GetOrgUsageResponses, GetOrgUsageErrors, ListConnectionsData, ListConnectionsResponses, ListConnectionsErrors, CreateConnectionData, CreateConnectionResponses, CreateConnectionErrors, GetConnectionOptionsData, GetConnectionOptionsResponses, GetConnectionOptionsErrors, ExchangeLinkTokenData, ExchangeLinkTokenResponses, ExchangeLinkTokenErrors, CreateLinkTokenData, CreateLinkTokenResponses, CreateLinkTokenErrors, InitOAuthData, InitOAuthResponses, InitOAuthErrors, OauthCallbackData, OauthCallbackResponses, OauthCallbackErrors, DeleteConnectionData, DeleteConnectionResponses, DeleteConnectionErrors, GetConnectionData, GetConnectionResponses, GetConnectionErrors, SyncConnectionData, SyncConnectionResponses, SyncConnectionErrors, ListAgentsData, ListAgentsResponses, ListAgentsErrors, AutoSelectAgentData, AutoSelectAgentResponses, AutoSelectAgentErrors, GetAgentMetadataData, GetAgentMetadataResponses, GetAgentMetadataErrors, ExecuteSpecificAgentData, ExecuteSpecificAgentResponses, ExecuteSpecificAgentErrors, BatchProcessQueriesData, BatchProcessQueriesResponses, BatchProcessQueriesErrors, RecommendAgentData, RecommendAgentResponses, RecommendAgentErrors, ListMcpToolsData, ListMcpToolsResponses, ListMcpToolsErrors, CallMcpToolData, CallMcpToolResponses, CallMcpToolErrors, ListBackupsData, ListBackupsResponses, ListBackupsErrors, CreateBackupData, CreateBackupResponses, CreateBackupErrors, GetBackupDownloadUrlData, GetBackupDownloadUrlResponses, GetBackupDownloadUrlErrors, RestoreBackupData, RestoreBackupResponses, RestoreBackupErrors, GetBackupStatsData, GetBackupStatsResponses, GetBackupStatsErrors, GetGraphMetricsData, GetGraphMetricsResponses, GetGraphMetricsErrors, GetGraphUsageAnalyticsData, GetGraphUsageAnalyticsResponses, GetGraphUsageAnalyticsErrors, ExecuteCypherQueryData, ExecuteCypherQueryResponses, ExecuteCypherQueryErrors, GetGraphSchemaData, GetGraphSchemaResponses, GetGraphSchemaErrors, ExportGraphSchemaData, ExportGraphSchemaResponses, ExportGraphSchemaErrors, ValidateSchemaData, ValidateSchemaResponses, ValidateSchemaErrors, GetCreditSummaryData, GetCreditSummaryResponses, GetCreditSummaryErrors, ListCreditTransactionsData, ListCreditTransactionsResponses, ListCreditTransactionsErrors, CheckCreditBalanceData, CheckCreditBalanceResponses, CheckCreditBalanceErrors, GetStorageUsageData, GetStorageUsageResponses, GetStorageUsageErrors, CheckStorageLimitsData, CheckStorageLimitsResponses, CheckStorageLimitsErrors, GetDatabaseHealthData, GetDatabaseHealthResponses, GetDatabaseHealthErrors, GetDatabaseInfoData, GetDatabaseInfoResponses, GetDatabaseInfoErrors, GetGraphLimitsData, GetGraphLimitsResponses, GetGraphLimitsErrors, ListSubgraphsData, ListSubgraphsResponses, ListSubgraphsErrors, CreateSubgraphData, CreateSubgraphResponses, CreateSubgraphErrors, DeleteSubgraphData, DeleteSubgraphResponses, DeleteSubgraphErrors, GetSubgraphInfoData, GetSubgraphInfoResponses, GetSubgraphInfoErrors, GetSubgraphQuotaData, GetSubgraphQuotaResponses, GetSubgraphQuotaErrors, GetGraphSubscriptionData, GetGraphSubscriptionResponses, GetGraphSubscriptionErrors, CreateRepositorySubscriptionData, CreateRepositorySubscriptionResponses, CreateRepositorySubscriptionErrors, UpgradeSubscriptionData, UpgradeSubscriptionResponses, UpgradeSubscriptionErrors, ListTablesData, ListTablesResponses, ListTablesErrors,
|
|
4
|
+
import type { RegisterUserData, RegisterUserResponses, RegisterUserErrors, LoginUserData, LoginUserResponses, LoginUserErrors, LogoutUserData, LogoutUserResponses, GetCurrentAuthUserData, GetCurrentAuthUserResponses, GetCurrentAuthUserErrors, RefreshAuthSessionData, RefreshAuthSessionResponses, RefreshAuthSessionErrors, ResendVerificationEmailData, ResendVerificationEmailResponses, ResendVerificationEmailErrors, VerifyEmailData, VerifyEmailResponses, VerifyEmailErrors, GetPasswordPolicyData, GetPasswordPolicyResponses, CheckPasswordStrengthData, CheckPasswordStrengthResponses, CheckPasswordStrengthErrors, ForgotPasswordData, ForgotPasswordResponses, ForgotPasswordErrors, ValidateResetTokenData, ValidateResetTokenResponses, ValidateResetTokenErrors, ResetPasswordData, ResetPasswordResponses, ResetPasswordErrors, GenerateSsoTokenData, GenerateSsoTokenResponses, GenerateSsoTokenErrors, SsoTokenExchangeData, SsoTokenExchangeResponses, SsoTokenExchangeErrors, CompleteSsoAuthData, CompleteSsoAuthResponses, CompleteSsoAuthErrors, GetCaptchaConfigData, GetCaptchaConfigResponses, GetServiceStatusData, GetServiceStatusResponses, GetCurrentUserData, GetCurrentUserResponses, UpdateUserData, UpdateUserResponses, UpdateUserErrors, UpdateUserPasswordData, UpdateUserPasswordResponses, UpdateUserPasswordErrors, ListUserApiKeysData, ListUserApiKeysResponses, CreateUserApiKeyData, CreateUserApiKeyResponses, CreateUserApiKeyErrors, RevokeUserApiKeyData, RevokeUserApiKeyResponses, RevokeUserApiKeyErrors, UpdateUserApiKeyData, UpdateUserApiKeyResponses, UpdateUserApiKeyErrors, ListUserOrgsData, ListUserOrgsResponses, CreateOrgData, CreateOrgResponses, CreateOrgErrors, GetOrgData, GetOrgResponses, GetOrgErrors, UpdateOrgData, UpdateOrgResponses, UpdateOrgErrors, ListOrgGraphsData, ListOrgGraphsResponses, ListOrgGraphsErrors, ListOrgMembersData, ListOrgMembersResponses, ListOrgMembersErrors, InviteOrgMemberData, InviteOrgMemberResponses, InviteOrgMemberErrors, RemoveOrgMemberData, RemoveOrgMemberResponses, RemoveOrgMemberErrors, UpdateOrgMemberRoleData, UpdateOrgMemberRoleResponses, UpdateOrgMemberRoleErrors, GetOrgLimitsData, GetOrgLimitsResponses, GetOrgLimitsErrors, GetOrgUsageData, GetOrgUsageResponses, GetOrgUsageErrors, ListConnectionsData, ListConnectionsResponses, ListConnectionsErrors, CreateConnectionData, CreateConnectionResponses, CreateConnectionErrors, GetConnectionOptionsData, GetConnectionOptionsResponses, GetConnectionOptionsErrors, ExchangeLinkTokenData, ExchangeLinkTokenResponses, ExchangeLinkTokenErrors, CreateLinkTokenData, CreateLinkTokenResponses, CreateLinkTokenErrors, InitOAuthData, InitOAuthResponses, InitOAuthErrors, OauthCallbackData, OauthCallbackResponses, OauthCallbackErrors, DeleteConnectionData, DeleteConnectionResponses, DeleteConnectionErrors, GetConnectionData, GetConnectionResponses, GetConnectionErrors, SyncConnectionData, SyncConnectionResponses, SyncConnectionErrors, ListAgentsData, ListAgentsResponses, ListAgentsErrors, AutoSelectAgentData, AutoSelectAgentResponses, AutoSelectAgentErrors, GetAgentMetadataData, GetAgentMetadataResponses, GetAgentMetadataErrors, ExecuteSpecificAgentData, ExecuteSpecificAgentResponses, ExecuteSpecificAgentErrors, BatchProcessQueriesData, BatchProcessQueriesResponses, BatchProcessQueriesErrors, RecommendAgentData, RecommendAgentResponses, RecommendAgentErrors, ListMcpToolsData, ListMcpToolsResponses, ListMcpToolsErrors, CallMcpToolData, CallMcpToolResponses, CallMcpToolErrors, ListBackupsData, ListBackupsResponses, ListBackupsErrors, CreateBackupData, CreateBackupResponses, CreateBackupErrors, GetBackupDownloadUrlData, GetBackupDownloadUrlResponses, GetBackupDownloadUrlErrors, RestoreBackupData, RestoreBackupResponses, RestoreBackupErrors, GetBackupStatsData, GetBackupStatsResponses, GetBackupStatsErrors, GetGraphMetricsData, GetGraphMetricsResponses, GetGraphMetricsErrors, GetGraphUsageAnalyticsData, GetGraphUsageAnalyticsResponses, GetGraphUsageAnalyticsErrors, ExecuteCypherQueryData, ExecuteCypherQueryResponses, ExecuteCypherQueryErrors, GetGraphSchemaData, GetGraphSchemaResponses, GetGraphSchemaErrors, ExportGraphSchemaData, ExportGraphSchemaResponses, ExportGraphSchemaErrors, ValidateSchemaData, ValidateSchemaResponses, ValidateSchemaErrors, GetCreditSummaryData, GetCreditSummaryResponses, GetCreditSummaryErrors, ListCreditTransactionsData, ListCreditTransactionsResponses, ListCreditTransactionsErrors, CheckCreditBalanceData, CheckCreditBalanceResponses, CheckCreditBalanceErrors, GetStorageUsageData, GetStorageUsageResponses, GetStorageUsageErrors, CheckStorageLimitsData, CheckStorageLimitsResponses, CheckStorageLimitsErrors, GetDatabaseHealthData, GetDatabaseHealthResponses, GetDatabaseHealthErrors, GetDatabaseInfoData, GetDatabaseInfoResponses, GetDatabaseInfoErrors, GetGraphLimitsData, GetGraphLimitsResponses, GetGraphLimitsErrors, ListSubgraphsData, ListSubgraphsResponses, ListSubgraphsErrors, CreateSubgraphData, CreateSubgraphResponses, CreateSubgraphErrors, DeleteSubgraphData, DeleteSubgraphResponses, DeleteSubgraphErrors, GetSubgraphInfoData, GetSubgraphInfoResponses, GetSubgraphInfoErrors, GetSubgraphQuotaData, GetSubgraphQuotaResponses, GetSubgraphQuotaErrors, GetGraphSubscriptionData, GetGraphSubscriptionResponses, GetGraphSubscriptionErrors, CreateRepositorySubscriptionData, CreateRepositorySubscriptionResponses, CreateRepositorySubscriptionErrors, UpgradeSubscriptionData, UpgradeSubscriptionResponses, UpgradeSubscriptionErrors, ListTablesData, ListTablesResponses, ListTablesErrors, QueryTablesData, QueryTablesResponses, QueryTablesErrors, CreateViewData, CreateViewResponses, CreateViewErrors, SaveViewData, SaveViewResponses, SaveViewErrors, GetMaterializationStatusData, GetMaterializationStatusResponses, GetMaterializationStatusErrors, MaterializeGraphData, MaterializeGraphResponses, MaterializeGraphErrors, ListFilesData, ListFilesResponses, ListFilesErrors, CreateFileUploadData, CreateFileUploadResponses, CreateFileUploadErrors, DeleteFileData, DeleteFileResponses, DeleteFileErrors, GetFileData, GetFileResponses, GetFileErrors, UpdateFileData, UpdateFileResponses, UpdateFileErrors, GetGraphsData, GetGraphsResponses, GetGraphsErrors, CreateGraphData, CreateGraphResponses, CreateGraphErrors, GetAvailableExtensionsData, GetAvailableExtensionsResponses, GetAvailableExtensionsErrors, GetAvailableGraphTiersData, GetAvailableGraphTiersResponses, GetAvailableGraphTiersErrors, SelectGraphData, SelectGraphResponses, SelectGraphErrors, GetServiceOfferingsData, GetServiceOfferingsResponses, GetServiceOfferingsErrors, StreamOperationEventsData, StreamOperationEventsResponses, StreamOperationEventsErrors, GetOperationStatusData, GetOperationStatusResponses, GetOperationStatusErrors, CancelOperationData, CancelOperationResponses, CancelOperationErrors, GetOrgBillingCustomerData, GetOrgBillingCustomerResponses, GetOrgBillingCustomerErrors, CreatePortalSessionData, CreatePortalSessionResponses, CreatePortalSessionErrors, ListOrgSubscriptionsData, ListOrgSubscriptionsResponses, ListOrgSubscriptionsErrors, GetOrgSubscriptionData, GetOrgSubscriptionResponses, GetOrgSubscriptionErrors, CancelOrgSubscriptionData, CancelOrgSubscriptionResponses, CancelOrgSubscriptionErrors, ListOrgInvoicesData, ListOrgInvoicesResponses, ListOrgInvoicesErrors, GetOrgUpcomingInvoiceData, GetOrgUpcomingInvoiceResponses, GetOrgUpcomingInvoiceErrors, CreateCheckoutSessionData, CreateCheckoutSessionResponses, CreateCheckoutSessionErrors, GetCheckoutStatusData, GetCheckoutStatusResponses, GetCheckoutStatusErrors } from './types.gen';
|
|
5
5
|
import { client as _heyApiClient } from './client.gen';
|
|
6
6
|
|
|
7
7
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
@@ -1725,11 +1725,14 @@ export const getGraphUsageAnalytics = <ThrowOnError extends boolean = false>(opt
|
|
|
1725
1725
|
};
|
|
1726
1726
|
|
|
1727
1727
|
/**
|
|
1728
|
-
* Execute Cypher Query
|
|
1729
|
-
* Execute a
|
|
1728
|
+
* Execute Cypher Query
|
|
1729
|
+
* Execute a Cypher query with intelligent response optimization.
|
|
1730
1730
|
*
|
|
1731
|
-
* **IMPORTANT:
|
|
1732
|
-
*
|
|
1731
|
+
* **IMPORTANT: Write operations depend on graph type:**
|
|
1732
|
+
* - **Main Graphs**: READ-ONLY. Write operations (CREATE, MERGE, SET, DELETE) are not allowed.
|
|
1733
|
+
* - **Subgraphs**: WRITE-ENABLED. Full Cypher write operations are supported for development and report creation.
|
|
1734
|
+
*
|
|
1735
|
+
* To load data into main graphs, use the staging pipeline:
|
|
1733
1736
|
* 1. Create file upload: `POST /v1/graphs/{graph_id}/tables/{table_name}/files`
|
|
1734
1737
|
* 2. Ingest to graph: `POST /v1/graphs/{graph_id}/tables/ingest`
|
|
1735
1738
|
*
|
|
@@ -2306,7 +2309,7 @@ export const listSubgraphs = <ThrowOnError extends boolean = false>(options: Opt
|
|
|
2306
2309
|
|
|
2307
2310
|
/**
|
|
2308
2311
|
* Create Subgraph
|
|
2309
|
-
* Create a new subgraph within a parent graph.
|
|
2312
|
+
* Create a new subgraph within a parent graph, with optional data forking.
|
|
2310
2313
|
*
|
|
2311
2314
|
* **Requirements:**
|
|
2312
2315
|
* - Valid authentication
|
|
@@ -2316,9 +2319,18 @@ export const listSubgraphs = <ThrowOnError extends boolean = false>(options: Opt
|
|
|
2316
2319
|
* - Must be within subgraph quota limits
|
|
2317
2320
|
* - Subgraph name must be unique within the parent graph
|
|
2318
2321
|
*
|
|
2322
|
+
* **Fork Mode:**
|
|
2323
|
+
* When `fork_parent=true`, the operation:
|
|
2324
|
+
* - Returns immediately with an operation_id for SSE monitoring
|
|
2325
|
+
* - Copies data from parent graph to the new subgraph
|
|
2326
|
+
* - Supports selective forking via metadata.fork_options
|
|
2327
|
+
* - Tracks progress in real-time via SSE
|
|
2328
|
+
*
|
|
2319
2329
|
* **Returns:**
|
|
2320
|
-
* -
|
|
2321
|
-
* -
|
|
2330
|
+
* - Without fork: Immediate SubgraphResponse with created subgraph details
|
|
2331
|
+
* - With fork: Operation response with SSE monitoring endpoint
|
|
2332
|
+
*
|
|
2333
|
+
* **Subgraph ID format:** `{parent_id}_{subgraph_name}` (e.g., kg1234567890abcdef_dev)
|
|
2322
2334
|
*
|
|
2323
2335
|
* **Usage:**
|
|
2324
2336
|
* - Subgraphs share parent's credit pool
|
|
@@ -2614,44 +2626,66 @@ export const listTables = <ThrowOnError extends boolean = false>(options: Option
|
|
|
2614
2626
|
};
|
|
2615
2627
|
|
|
2616
2628
|
/**
|
|
2617
|
-
*
|
|
2618
|
-
*
|
|
2629
|
+
* Query Staging Tables with SQL
|
|
2630
|
+
* Execute SQL queries on DuckDB staging tables for data inspection and validation.
|
|
2631
|
+
*
|
|
2632
|
+
* Query raw staging data directly with SQL before ingestion into the graph database.
|
|
2633
|
+
* Useful for data quality checks, validation, and exploratory analysis.
|
|
2634
|
+
*
|
|
2635
|
+
* **Security Best Practice - Use Parameterized Queries:**
|
|
2636
|
+
* ALWAYS use query parameters instead of string concatenation to prevent SQL injection:
|
|
2637
|
+
* - ✅ SAFE: `SELECT * FROM Entity WHERE type = ? LIMIT ?` with `parameters: ["Company", 100]`
|
|
2638
|
+
* - ❌ UNSAFE: `SELECT * FROM Entity WHERE type = 'Company' LIMIT 100` with user input concatenated into SQL string
|
|
2619
2639
|
*
|
|
2620
|
-
*
|
|
2621
|
-
* file sizes, row counts, and S3 locations. Essential for monitoring upload progress
|
|
2622
|
-
* and validating data before ingestion.
|
|
2640
|
+
* Query parameters provide automatic escaping and type safety. Use `?` placeholders with parameters array.
|
|
2623
2641
|
*
|
|
2624
2642
|
* **Use Cases:**
|
|
2625
|
-
* -
|
|
2626
|
-
* -
|
|
2627
|
-
* -
|
|
2628
|
-
* -
|
|
2629
|
-
* -
|
|
2630
|
-
* - Pre-ingestion validation
|
|
2643
|
+
* - Validate data quality before graph ingestion
|
|
2644
|
+
* - Inspect row-level data for debugging
|
|
2645
|
+
* - Run analytics on staging tables
|
|
2646
|
+
* - Check for duplicates, nulls, or data issues
|
|
2647
|
+
* - Preview data transformations
|
|
2631
2648
|
*
|
|
2632
|
-
* **
|
|
2633
|
-
*
|
|
2634
|
-
*
|
|
2635
|
-
*
|
|
2636
|
-
*
|
|
2637
|
-
* - S3 key for reference
|
|
2649
|
+
* **Workflow:**
|
|
2650
|
+
* 1. Upload data files via `POST /tables/{table_name}/files`
|
|
2651
|
+
* 2. Query staging tables to validate: `POST /tables/query`
|
|
2652
|
+
* 3. Fix any data issues by re-uploading
|
|
2653
|
+
* 4. Ingest validated data: `POST /tables/ingest`
|
|
2638
2654
|
*
|
|
2639
|
-
* **
|
|
2640
|
-
* -
|
|
2641
|
-
* -
|
|
2642
|
-
* -
|
|
2643
|
-
* -
|
|
2644
|
-
* - `failed`: Upload failed
|
|
2655
|
+
* **Supported SQL:**
|
|
2656
|
+
* - Full DuckDB SQL syntax
|
|
2657
|
+
* - SELECT, JOIN, WHERE, GROUP BY, ORDER BY
|
|
2658
|
+
* - Aggregations, window functions, CTEs
|
|
2659
|
+
* - Multiple table joins across staging area
|
|
2645
2660
|
*
|
|
2646
|
-
* **
|
|
2647
|
-
* -
|
|
2648
|
-
* -
|
|
2649
|
-
* -
|
|
2650
|
-
* -
|
|
2651
|
-
* -
|
|
2661
|
+
* **Common Operations:**
|
|
2662
|
+
* - Count rows: `SELECT COUNT(*) FROM Entity`
|
|
2663
|
+
* - Filter by type: `SELECT * FROM Entity WHERE entity_type = ? LIMIT ?` with `parameters: ["Company", 100]`
|
|
2664
|
+
* - Check for nulls: `SELECT * FROM Entity WHERE name IS NULL LIMIT 10`
|
|
2665
|
+
* - Find duplicates: `SELECT identifier, COUNT(*) as cnt FROM Entity GROUP BY identifier HAVING COUNT(*) > 1`
|
|
2666
|
+
* - Filter amounts: `SELECT * FROM Transaction WHERE amount > ? AND date >= ?` with `parameters: [1000, "2024-01-01"]`
|
|
2667
|
+
*
|
|
2668
|
+
* **Limits:**
|
|
2669
|
+
* - Query timeout: 30 seconds
|
|
2670
|
+
* - Result limit: 10,000 rows (use LIMIT clause)
|
|
2671
|
+
* - Read-only: No INSERT, UPDATE, DELETE
|
|
2672
|
+
* - User's tables only: Cannot query other users' data
|
|
2673
|
+
*
|
|
2674
|
+
* **Subgraph Support:**
|
|
2675
|
+
* This endpoint accepts both parent graph IDs and subgraph IDs.
|
|
2676
|
+
* - Parent graph: Use `graph_id` like `kg0123456789abcdef`
|
|
2677
|
+
* - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
|
|
2678
|
+
* Each subgraph has its own independent staging tables.
|
|
2679
|
+
*
|
|
2680
|
+
* **Shared Repositories:**
|
|
2681
|
+
* Shared repositories (SEC, etc.) do not allow direct SQL queries.
|
|
2682
|
+
* Use the graph query endpoint instead: `POST /v1/graphs/{graph_id}/query`
|
|
2683
|
+
*
|
|
2684
|
+
* **Note:**
|
|
2685
|
+
* Staging table queries are included - no credit consumption
|
|
2652
2686
|
*/
|
|
2653
|
-
export const
|
|
2654
|
-
return (options.client ?? _heyApiClient).
|
|
2687
|
+
export const queryTables = <ThrowOnError extends boolean = false>(options: Options<QueryTablesData, ThrowOnError>) => {
|
|
2688
|
+
return (options.client ?? _heyApiClient).post<QueryTablesResponses, QueryTablesErrors, ThrowOnError>({
|
|
2655
2689
|
security: [
|
|
2656
2690
|
{
|
|
2657
2691
|
name: 'X-API-Key',
|
|
@@ -2662,56 +2696,36 @@ export const listTableFiles = <ThrowOnError extends boolean = false>(options: Op
|
|
|
2662
2696
|
type: 'http'
|
|
2663
2697
|
}
|
|
2664
2698
|
],
|
|
2665
|
-
url: '/v1/graphs/{graph_id}/tables/
|
|
2666
|
-
...options
|
|
2699
|
+
url: '/v1/graphs/{graph_id}/tables/query',
|
|
2700
|
+
...options,
|
|
2701
|
+
headers: {
|
|
2702
|
+
'Content-Type': 'application/json',
|
|
2703
|
+
...options.headers
|
|
2704
|
+
}
|
|
2667
2705
|
});
|
|
2668
2706
|
};
|
|
2669
2707
|
|
|
2670
2708
|
/**
|
|
2671
|
-
*
|
|
2672
|
-
* Generate
|
|
2673
|
-
*
|
|
2674
|
-
* Initiates file upload to a staging table by generating a secure, time-limited
|
|
2675
|
-
* presigned S3 URL. Files are uploaded directly to S3, bypassing the API for
|
|
2676
|
-
* optimal performance.
|
|
2677
|
-
*
|
|
2678
|
-
* **Upload Workflow:**
|
|
2679
|
-
* 1. Call this endpoint to get presigned URL
|
|
2680
|
-
* 2. PUT file directly to S3 URL
|
|
2681
|
-
* 3. Call PATCH /tables/files/{file_id} with status='uploaded'
|
|
2682
|
-
* 4. Backend validates file and calculates metrics
|
|
2683
|
-
* 5. File ready for ingestion
|
|
2684
|
-
*
|
|
2685
|
-
* **Supported Formats:**
|
|
2686
|
-
* - Parquet (`application/x-parquet` with `.parquet` extension)
|
|
2687
|
-
* - CSV (`text/csv` with `.csv` extension)
|
|
2688
|
-
* - JSON (`application/json` with `.json` extension)
|
|
2689
|
-
*
|
|
2690
|
-
* **Validation:**
|
|
2691
|
-
* - File extension must match content type
|
|
2692
|
-
* - File name 1-255 characters
|
|
2693
|
-
* - No path traversal characters (.. / \)
|
|
2694
|
-
* - Auto-creates table if it doesn't exist
|
|
2709
|
+
* Create View
|
|
2710
|
+
* Generate financial report view from data source (dual-mode support).
|
|
2695
2711
|
*
|
|
2696
|
-
* **
|
|
2697
|
-
*
|
|
2698
|
-
*
|
|
2712
|
+
* **Mode 1: Transaction Aggregation (generate_from_transactions)**
|
|
2713
|
+
* - Aggregates raw transaction data to trial balance
|
|
2714
|
+
* - Creates facts on-demand
|
|
2715
|
+
* - Shows real-time reporting from source of truth
|
|
2699
2716
|
*
|
|
2700
|
-
* **
|
|
2701
|
-
*
|
|
2702
|
-
* -
|
|
2703
|
-
* -
|
|
2704
|
-
* Each subgraph has completely isolated S3 staging areas and tables. Files uploaded
|
|
2705
|
-
* to one subgraph do not appear in other subgraphs.
|
|
2717
|
+
* **Mode 2: Existing Facts (pivot_existing_facts)**
|
|
2718
|
+
* - Queries existing Fact nodes
|
|
2719
|
+
* - Supports multi-dimensional analysis
|
|
2720
|
+
* - Works with SEC filings and pre-computed facts
|
|
2706
2721
|
*
|
|
2707
|
-
*
|
|
2708
|
-
* -
|
|
2709
|
-
* -
|
|
2710
|
-
* -
|
|
2711
|
-
* - Upload URL generation is included - no credit consumption
|
|
2722
|
+
* Both modes:
|
|
2723
|
+
* - Build FactGrid from data
|
|
2724
|
+
* - Generate pivot table presentation
|
|
2725
|
+
* - Return consistent response format
|
|
2712
2726
|
*/
|
|
2713
|
-
export const
|
|
2714
|
-
return (options.client ?? _heyApiClient).post<
|
|
2727
|
+
export const createView = <ThrowOnError extends boolean = false>(options: Options<CreateViewData, ThrowOnError>) => {
|
|
2728
|
+
return (options.client ?? _heyApiClient).post<CreateViewResponses, CreateViewErrors, ThrowOnError>({
|
|
2715
2729
|
security: [
|
|
2716
2730
|
{
|
|
2717
2731
|
name: 'X-API-Key',
|
|
@@ -2722,7 +2736,7 @@ export const getUploadUrl = <ThrowOnError extends boolean = false>(options: Opti
|
|
|
2722
2736
|
type: 'http'
|
|
2723
2737
|
}
|
|
2724
2738
|
],
|
|
2725
|
-
url: '/v1/graphs/{graph_id}/
|
|
2739
|
+
url: '/v1/graphs/{graph_id}/views',
|
|
2726
2740
|
...options,
|
|
2727
2741
|
headers: {
|
|
2728
2742
|
'Content-Type': 'application/json',
|
|
@@ -2732,41 +2746,39 @@ export const getUploadUrl = <ThrowOnError extends boolean = false>(options: Opti
|
|
|
2732
2746
|
};
|
|
2733
2747
|
|
|
2734
2748
|
/**
|
|
2735
|
-
*
|
|
2736
|
-
*
|
|
2749
|
+
* Save View
|
|
2750
|
+
* Save or update view as materialized report in the graph.
|
|
2737
2751
|
*
|
|
2738
|
-
*
|
|
2739
|
-
*
|
|
2740
|
-
*
|
|
2752
|
+
* Converts computed view results into persistent Report, Fact, and Structure nodes.
|
|
2753
|
+
* This establishes what data exists in the subgraph, which then defines what
|
|
2754
|
+
* needs to be exported for publishing to the parent graph.
|
|
2741
2755
|
*
|
|
2742
|
-
* **
|
|
2743
|
-
* -
|
|
2744
|
-
* -
|
|
2745
|
-
* - Clean up failed uploads
|
|
2746
|
-
* - Fix data quality issues before ingestion
|
|
2747
|
-
* - Manage storage usage
|
|
2756
|
+
* **Create Mode** (no report_id provided):
|
|
2757
|
+
* - Generates new report_id from entity + period + report type
|
|
2758
|
+
* - Creates new Report, Facts, and Structures
|
|
2748
2759
|
*
|
|
2749
|
-
* **
|
|
2750
|
-
*
|
|
2751
|
-
*
|
|
2752
|
-
*
|
|
2753
|
-
*
|
|
2760
|
+
* **Update Mode** (report_id provided):
|
|
2761
|
+
* - Deletes all existing Facts and Structures for the report
|
|
2762
|
+
* - Updates Report metadata
|
|
2763
|
+
* - Creates fresh Facts and Structures from current view
|
|
2764
|
+
* - Useful for refreshing reports with updated data or view configurations
|
|
2754
2765
|
*
|
|
2755
|
-
* **
|
|
2756
|
-
*
|
|
2757
|
-
* - Shared repositories block file deletions
|
|
2758
|
-
* - Full audit trail of deletion operations
|
|
2759
|
-
* - Cannot delete after ingestion to graph
|
|
2766
|
+
* **This is NOT publishing** - it only creates nodes in the subgraph workspace.
|
|
2767
|
+
* Publishing (export → parquet → parent ingest) happens separately.
|
|
2760
2768
|
*
|
|
2761
|
-
*
|
|
2762
|
-
* -
|
|
2763
|
-
* -
|
|
2764
|
-
* -
|
|
2765
|
-
* -
|
|
2766
|
-
*
|
|
2769
|
+
* Creates/Updates:
|
|
2770
|
+
* - Report node with metadata
|
|
2771
|
+
* - Fact nodes with all aspects (period, entity, element, unit)
|
|
2772
|
+
* - PresentationStructure nodes (how facts are displayed)
|
|
2773
|
+
* - CalculationStructure nodes (how facts roll up)
|
|
2774
|
+
*
|
|
2775
|
+
* Returns:
|
|
2776
|
+
* - report_id: Unique identifier used as parquet export prefix
|
|
2777
|
+
* - parquet_export_prefix: Filename prefix for future exports
|
|
2778
|
+
* - All created facts and structures
|
|
2767
2779
|
*/
|
|
2768
|
-
export const
|
|
2769
|
-
return (options.client ?? _heyApiClient).
|
|
2780
|
+
export const saveView = <ThrowOnError extends boolean = false>(options: Options<SaveViewData, ThrowOnError>) => {
|
|
2781
|
+
return (options.client ?? _heyApiClient).post<SaveViewResponses, SaveViewErrors, ThrowOnError>({
|
|
2770
2782
|
security: [
|
|
2771
2783
|
{
|
|
2772
2784
|
name: 'X-API-Key',
|
|
@@ -2777,31 +2789,44 @@ export const deleteFile = <ThrowOnError extends boolean = false>(options: Option
|
|
|
2777
2789
|
type: 'http'
|
|
2778
2790
|
}
|
|
2779
2791
|
],
|
|
2780
|
-
url: '/v1/graphs/{graph_id}/
|
|
2781
|
-
...options
|
|
2792
|
+
url: '/v1/graphs/{graph_id}/views/save',
|
|
2793
|
+
...options,
|
|
2794
|
+
headers: {
|
|
2795
|
+
'Content-Type': 'application/json',
|
|
2796
|
+
...options.headers
|
|
2797
|
+
}
|
|
2782
2798
|
});
|
|
2783
2799
|
};
|
|
2784
2800
|
|
|
2785
2801
|
/**
|
|
2786
|
-
* Get
|
|
2787
|
-
* Get
|
|
2802
|
+
* Get Materialization Status
|
|
2803
|
+
* Get current materialization status for the graph.
|
|
2804
|
+
*
|
|
2805
|
+
* Shows whether the graph is stale (DuckDB has changes not yet in graph database),
|
|
2806
|
+
* when it was last materialized, and how long since last materialization.
|
|
2788
2807
|
*
|
|
2789
|
-
*
|
|
2790
|
-
*
|
|
2791
|
-
*
|
|
2808
|
+
* **Status Information:**
|
|
2809
|
+
* - Whether graph is currently stale
|
|
2810
|
+
* - Reason for staleness if applicable
|
|
2811
|
+
* - When graph became stale
|
|
2812
|
+
* - When graph was last materialized
|
|
2813
|
+
* - Total materialization count
|
|
2814
|
+
* - Hours since last materialization
|
|
2792
2815
|
*
|
|
2793
2816
|
* **Use Cases:**
|
|
2794
|
-
* -
|
|
2795
|
-
* -
|
|
2796
|
-
* -
|
|
2797
|
-
* -
|
|
2798
|
-
* - Track file lifecycle
|
|
2817
|
+
* - Decide if materialization is needed
|
|
2818
|
+
* - Monitor graph freshness
|
|
2819
|
+
* - Track materialization history
|
|
2820
|
+
* - Understand data pipeline state
|
|
2799
2821
|
*
|
|
2800
|
-
* **
|
|
2801
|
-
*
|
|
2822
|
+
* **Important Notes:**
|
|
2823
|
+
* - Stale graph means DuckDB has changes not in graph
|
|
2824
|
+
* - Graph becomes stale after file deletions
|
|
2825
|
+
* - Materialization clears staleness
|
|
2826
|
+
* - Status retrieval is included - no credit consumption
|
|
2802
2827
|
*/
|
|
2803
|
-
export const
|
|
2804
|
-
return (options.client ?? _heyApiClient).get<
|
|
2828
|
+
export const getMaterializationStatus = <ThrowOnError extends boolean = false>(options: Options<GetMaterializationStatusData, ThrowOnError>) => {
|
|
2829
|
+
return (options.client ?? _heyApiClient).get<GetMaterializationStatusResponses, GetMaterializationStatusErrors, ThrowOnError>({
|
|
2805
2830
|
security: [
|
|
2806
2831
|
{
|
|
2807
2832
|
name: 'X-API-Key',
|
|
@@ -2812,52 +2837,67 @@ export const getFileInfo = <ThrowOnError extends boolean = false>(options: Optio
|
|
|
2812
2837
|
type: 'http'
|
|
2813
2838
|
}
|
|
2814
2839
|
],
|
|
2815
|
-
url: '/v1/graphs/{graph_id}/
|
|
2840
|
+
url: '/v1/graphs/{graph_id}/materialize/status',
|
|
2816
2841
|
...options
|
|
2817
2842
|
});
|
|
2818
2843
|
};
|
|
2819
2844
|
|
|
2820
2845
|
/**
|
|
2821
|
-
*
|
|
2822
|
-
*
|
|
2846
|
+
* Materialize Graph from DuckDB
|
|
2847
|
+
* Rebuild entire graph from DuckDB staging tables (materialized view pattern).
|
|
2823
2848
|
*
|
|
2824
|
-
*
|
|
2825
|
-
*
|
|
2826
|
-
*
|
|
2849
|
+
* This endpoint rebuilds the complete graph database from the current state of DuckDB
|
|
2850
|
+
* staging tables. It automatically discovers all tables, ingests them in the correct
|
|
2851
|
+
* order (nodes before relationships), and clears the staleness flag.
|
|
2827
2852
|
*
|
|
2828
|
-
* **
|
|
2829
|
-
* -
|
|
2830
|
-
* -
|
|
2831
|
-
* -
|
|
2832
|
-
*
|
|
2833
|
-
* **What Happens on 'uploaded' Status:**
|
|
2834
|
-
* 1. Verify file exists in S3
|
|
2835
|
-
* 2. Calculate actual file size
|
|
2836
|
-
* 3. Enforce tier storage limits
|
|
2837
|
-
* 4. Calculate or estimate row count
|
|
2838
|
-
* 5. Update table statistics
|
|
2839
|
-
* 6. Register DuckDB external table
|
|
2840
|
-
* 7. File ready for ingestion
|
|
2841
|
-
*
|
|
2842
|
-
* **Row Count Calculation:**
|
|
2843
|
-
* - **Parquet**: Exact count from file metadata
|
|
2844
|
-
* - **CSV**: Count rows (minus header)
|
|
2845
|
-
* - **JSON**: Count array elements
|
|
2846
|
-
* - **Fallback**: Estimate from file size if reading fails
|
|
2847
|
-
*
|
|
2848
|
-
* **Storage Limits:**
|
|
2849
|
-
* Enforced per subscription tier. Returns HTTP 413 if limit exceeded.
|
|
2850
|
-
* Check current usage before large uploads.
|
|
2853
|
+
* **When to Use:**
|
|
2854
|
+
* - After batch uploads (files uploaded with ingest_to_graph=false)
|
|
2855
|
+
* - After cascade file deletions (graph marked stale)
|
|
2856
|
+
* - To ensure graph consistency with DuckDB state
|
|
2857
|
+
* - Periodic full refresh
|
|
2851
2858
|
*
|
|
2852
|
-
* **
|
|
2853
|
-
*
|
|
2854
|
-
*
|
|
2855
|
-
*
|
|
2856
|
-
*
|
|
2857
|
-
*
|
|
2859
|
+
* **What Happens:**
|
|
2860
|
+
* 1. Discovers all tables for the graph from PostgreSQL registry
|
|
2861
|
+
* 2. Sorts tables (nodes before relationships)
|
|
2862
|
+
* 3. Ingests all tables from DuckDB to graph in order
|
|
2863
|
+
* 4. Clears staleness flag on success
|
|
2864
|
+
* 5. Returns detailed materialization report
|
|
2865
|
+
*
|
|
2866
|
+
* **Staleness Check:**
|
|
2867
|
+
* By default, only materializes if graph is stale (after deletions or missed ingestions).
|
|
2868
|
+
* Use `force=true` to rebuild regardless of staleness.
|
|
2869
|
+
*
|
|
2870
|
+
* **Rebuild Feature:**
|
|
2871
|
+
* Setting `rebuild=true` regenerates the entire graph database from scratch:
|
|
2872
|
+
* - Deletes existing graph database
|
|
2873
|
+
* - Recreates with fresh schema from active GraphSchema
|
|
2874
|
+
* - Ingests all data files
|
|
2875
|
+
* - Safe operation - DuckDB is source of truth
|
|
2876
|
+
* - Useful for schema changes or data corrections
|
|
2877
|
+
* - Graph marked as 'rebuilding' during process
|
|
2878
|
+
*
|
|
2879
|
+
* **Table Ordering:**
|
|
2880
|
+
* Node tables (PascalCase) are ingested before relationship tables (UPPERCASE) to
|
|
2881
|
+
* ensure referential integrity.
|
|
2882
|
+
*
|
|
2883
|
+
* **Error Handling:**
|
|
2884
|
+
* With `ignore_errors=true` (default), continues materializing even if individual
|
|
2885
|
+
* rows fail. Failed rows are logged but don't stop the process.
|
|
2886
|
+
*
|
|
2887
|
+
* **Concurrency Control:**
|
|
2888
|
+
* Only one materialization can run per graph at a time. If another materialization is in progress,
|
|
2889
|
+
* you'll receive a 409 Conflict error. The distributed lock automatically expires after
|
|
2890
|
+
* the configured TTL (default: 1 hour) to prevent deadlocks from failed materializations.
|
|
2891
|
+
*
|
|
2892
|
+
* **Performance:**
|
|
2893
|
+
* Full graph materialization can take minutes for large datasets. Consider running
|
|
2894
|
+
* during off-peak hours for production systems.
|
|
2895
|
+
*
|
|
2896
|
+
* **Credits:**
|
|
2897
|
+
* Materialization is included - no credit consumption
|
|
2858
2898
|
*/
|
|
2859
|
-
export const
|
|
2860
|
-
return (options.client ?? _heyApiClient).
|
|
2899
|
+
export const materializeGraph = <ThrowOnError extends boolean = false>(options: Options<MaterializeGraphData, ThrowOnError>) => {
|
|
2900
|
+
return (options.client ?? _heyApiClient).post<MaterializeGraphResponses, MaterializeGraphErrors, ThrowOnError>({
|
|
2861
2901
|
security: [
|
|
2862
2902
|
{
|
|
2863
2903
|
name: 'X-API-Key',
|
|
@@ -2868,7 +2908,7 @@ export const updateFileStatus = <ThrowOnError extends boolean = false>(options:
|
|
|
2868
2908
|
type: 'http'
|
|
2869
2909
|
}
|
|
2870
2910
|
],
|
|
2871
|
-
url: '/v1/graphs/{graph_id}/
|
|
2911
|
+
url: '/v1/graphs/{graph_id}/materialize',
|
|
2872
2912
|
...options,
|
|
2873
2913
|
headers: {
|
|
2874
2914
|
'Content-Type': 'application/json',
|
|
@@ -2878,72 +2918,88 @@ export const updateFileStatus = <ThrowOnError extends boolean = false>(options:
|
|
|
2878
2918
|
};
|
|
2879
2919
|
|
|
2880
2920
|
/**
|
|
2881
|
-
*
|
|
2882
|
-
*
|
|
2921
|
+
* List Files in Graph
|
|
2922
|
+
* List all files in the graph with optional filtering.
|
|
2883
2923
|
*
|
|
2884
|
-
*
|
|
2885
|
-
*
|
|
2924
|
+
* Get a complete inventory of files across all tables or filtered by table name,
|
|
2925
|
+
* status, or other criteria. Files are first-class resources with independent lifecycle.
|
|
2926
|
+
*
|
|
2927
|
+
* **Query Parameters:**
|
|
2928
|
+
* - `table_name` (optional): Filter by table name
|
|
2929
|
+
* - `status` (optional): Filter by upload status (uploaded, pending, failed, etc.)
|
|
2886
2930
|
*
|
|
2887
2931
|
* **Use Cases:**
|
|
2888
|
-
* -
|
|
2889
|
-
* -
|
|
2890
|
-
* -
|
|
2891
|
-
* -
|
|
2932
|
+
* - Monitor file upload progress across all tables
|
|
2933
|
+
* - Verify files are ready for ingestion
|
|
2934
|
+
* - Check file metadata and sizes
|
|
2935
|
+
* - Track storage usage per graph
|
|
2936
|
+
* - Identify failed or incomplete uploads
|
|
2937
|
+
* - Audit file provenance
|
|
2892
2938
|
*
|
|
2893
|
-
* **
|
|
2894
|
-
*
|
|
2895
|
-
*
|
|
2896
|
-
*
|
|
2897
|
-
*
|
|
2898
|
-
*
|
|
2899
|
-
* 6. Per-table results and metrics returned
|
|
2939
|
+
* **Returned Metadata:**
|
|
2940
|
+
* - File ID, name, and format (parquet, csv, json)
|
|
2941
|
+
* - Size in bytes and row count (if available)
|
|
2942
|
+
* - Upload status and timestamps
|
|
2943
|
+
* - DuckDB and graph ingestion status
|
|
2944
|
+
* - Table association
|
|
2900
2945
|
*
|
|
2901
|
-
* **
|
|
2902
|
-
*
|
|
2903
|
-
* - Deletes existing Kuzu database
|
|
2904
|
-
* - Recreates with fresh schema from active GraphSchema
|
|
2905
|
-
* - Ingests all data files
|
|
2906
|
-
* - Safe operation - S3 is source of truth
|
|
2907
|
-
* - Useful for schema changes or data corrections
|
|
2908
|
-
* - Graph marked as 'rebuilding' during process
|
|
2946
|
+
* **File Lifecycle Tracking:**
|
|
2947
|
+
* Multi-layer status across S3 → DuckDB → Graph pipeline
|
|
2909
2948
|
*
|
|
2910
|
-
* **
|
|
2911
|
-
* -
|
|
2912
|
-
* -
|
|
2913
|
-
* -
|
|
2914
|
-
|
|
2915
|
-
|
|
2949
|
+
* **Important Notes:**
|
|
2950
|
+
* - Files are graph-scoped, not table-scoped
|
|
2951
|
+
* - Use table_name parameter to filter by table
|
|
2952
|
+
* - File listing is included - no credit consumption
|
|
2953
|
+
*/
|
|
2954
|
+
export const listFiles = <ThrowOnError extends boolean = false>(options: Options<ListFilesData, ThrowOnError>) => {
|
|
2955
|
+
return (options.client ?? _heyApiClient).get<ListFilesResponses, ListFilesErrors, ThrowOnError>({
|
|
2956
|
+
security: [
|
|
2957
|
+
{
|
|
2958
|
+
name: 'X-API-Key',
|
|
2959
|
+
type: 'apiKey'
|
|
2960
|
+
},
|
|
2961
|
+
{
|
|
2962
|
+
scheme: 'bearer',
|
|
2963
|
+
type: 'http'
|
|
2964
|
+
}
|
|
2965
|
+
],
|
|
2966
|
+
url: '/v1/graphs/{graph_id}/files',
|
|
2967
|
+
...options
|
|
2968
|
+
});
|
|
2969
|
+
};
|
|
2970
|
+
|
|
2971
|
+
/**
|
|
2972
|
+
* Create File Upload
|
|
2973
|
+
* Generate presigned S3 URL for file upload.
|
|
2916
2974
|
*
|
|
2917
|
-
*
|
|
2918
|
-
* -
|
|
2919
|
-
* - Each table timed independently
|
|
2920
|
-
* - Total execution metrics provided
|
|
2921
|
-
* - Scales to thousands of files
|
|
2922
|
-
* - Optimized for large datasets
|
|
2975
|
+
* Initiate file upload by generating a secure, time-limited presigned S3 URL.
|
|
2976
|
+
* Files are first-class resources uploaded directly to S3.
|
|
2923
2977
|
*
|
|
2924
|
-
* **
|
|
2925
|
-
*
|
|
2926
|
-
*
|
|
2927
|
-
*
|
|
2978
|
+
* **Request Body:**
|
|
2979
|
+
* - `file_name`: Name of the file (1-255 characters)
|
|
2980
|
+
* - `file_format`: Format (parquet, csv, json)
|
|
2981
|
+
* - `table_name`: Table to associate file with
|
|
2928
2982
|
*
|
|
2929
|
-
* **
|
|
2930
|
-
*
|
|
2931
|
-
*
|
|
2932
|
-
*
|
|
2933
|
-
*
|
|
2934
|
-
*
|
|
2983
|
+
* **Upload Workflow:**
|
|
2984
|
+
* 1. Call this endpoint to get presigned URL
|
|
2985
|
+
* 2. PUT file directly to S3 URL
|
|
2986
|
+
* 3. Call PATCH /files/{file_id} with status='uploaded'
|
|
2987
|
+
* 4. Backend validates and stages in DuckDB immediately
|
|
2988
|
+
* 5. Background task ingests to graph
|
|
2989
|
+
*
|
|
2990
|
+
* **Supported Formats:**
|
|
2991
|
+
* - Parquet, CSV, JSON
|
|
2992
|
+
*
|
|
2993
|
+
* **Auto-Table Creation:**
|
|
2994
|
+
* Tables are automatically created if they don't exist.
|
|
2935
2995
|
*
|
|
2936
2996
|
* **Important Notes:**
|
|
2937
|
-
* -
|
|
2938
|
-
* -
|
|
2939
|
-
* -
|
|
2940
|
-
* - Monitor progress via per-table results
|
|
2941
|
-
* - Check graph metadata for rebuild status
|
|
2942
|
-
* - Wait for current ingestion to complete before starting another
|
|
2943
|
-
* - Table ingestion is included - no credit consumption
|
|
2997
|
+
* - Presigned URLs expire (default: 1 hour)
|
|
2998
|
+
* - Files are graph-scoped, independent resources
|
|
2999
|
+
* - Upload URL generation is included - no credit consumption
|
|
2944
3000
|
*/
|
|
2945
|
-
export const
|
|
2946
|
-
return (options.client ?? _heyApiClient).post<
|
|
3001
|
+
export const createFileUpload = <ThrowOnError extends boolean = false>(options: Options<CreateFileUploadData, ThrowOnError>) => {
|
|
3002
|
+
return (options.client ?? _heyApiClient).post<CreateFileUploadResponses, CreateFileUploadErrors, ThrowOnError>({
|
|
2947
3003
|
security: [
|
|
2948
3004
|
{
|
|
2949
3005
|
name: 'X-API-Key',
|
|
@@ -2954,7 +3010,7 @@ export const ingestTables = <ThrowOnError extends boolean = false>(options: Opti
|
|
|
2954
3010
|
type: 'http'
|
|
2955
3011
|
}
|
|
2956
3012
|
],
|
|
2957
|
-
url: '/v1/graphs/{graph_id}/
|
|
3013
|
+
url: '/v1/graphs/{graph_id}/files',
|
|
2958
3014
|
...options,
|
|
2959
3015
|
headers: {
|
|
2960
3016
|
'Content-Type': 'application/json',
|
|
@@ -2964,66 +3020,100 @@ export const ingestTables = <ThrowOnError extends boolean = false>(options: Opti
|
|
|
2964
3020
|
};
|
|
2965
3021
|
|
|
2966
3022
|
/**
|
|
2967
|
-
*
|
|
2968
|
-
*
|
|
3023
|
+
* Delete File
|
|
3024
|
+
* Delete file from all layers.
|
|
2969
3025
|
*
|
|
2970
|
-
*
|
|
2971
|
-
*
|
|
3026
|
+
* Remove file from S3, database tracking, and optionally from DuckDB and graph.
|
|
3027
|
+
* Files are deleted by file_id, independent of table context.
|
|
2972
3028
|
*
|
|
2973
|
-
* **
|
|
2974
|
-
*
|
|
2975
|
-
* - ✅ SAFE: `SELECT * FROM Entity WHERE type = ? LIMIT ?` with `parameters: ["Company", 100]`
|
|
2976
|
-
* - ❌ UNSAFE: `SELECT * FROM Entity WHERE type = 'Company' LIMIT 100` with user input concatenated into SQL string
|
|
3029
|
+
* **Query Parameters:**
|
|
3030
|
+
* - `cascade` (optional, default=false): Delete from all layers including DuckDB
|
|
2977
3031
|
*
|
|
2978
|
-
*
|
|
3032
|
+
* **What Happens (cascade=false):**
|
|
3033
|
+
* 1. File deleted from S3
|
|
3034
|
+
* 2. Database record removed
|
|
3035
|
+
* 3. Table statistics updated
|
|
2979
3036
|
*
|
|
2980
|
-
* **
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
2983
|
-
*
|
|
2984
|
-
*
|
|
2985
|
-
*
|
|
3037
|
+
* **What Happens (cascade=true):**
|
|
3038
|
+
* 1. File data deleted from all DuckDB tables (by file_id)
|
|
3039
|
+
* 2. Graph marked as stale
|
|
3040
|
+
* 3. File deleted from S3
|
|
3041
|
+
* 4. Database record removed
|
|
3042
|
+
* 5. Table statistics updated
|
|
2986
3043
|
*
|
|
2987
|
-
* **
|
|
2988
|
-
*
|
|
2989
|
-
*
|
|
2990
|
-
*
|
|
2991
|
-
*
|
|
3044
|
+
* **Use Cases:**
|
|
3045
|
+
* - Remove incorrect or duplicate files
|
|
3046
|
+
* - Clean up failed uploads
|
|
3047
|
+
* - Delete files before graph ingestion
|
|
3048
|
+
* - Surgical data removal with cascade
|
|
2992
3049
|
*
|
|
2993
|
-
* **
|
|
2994
|
-
* -
|
|
2995
|
-
* -
|
|
2996
|
-
* -
|
|
2997
|
-
* - Multiple table joins across staging area
|
|
3050
|
+
* **Security:**
|
|
3051
|
+
* - Write access required
|
|
3052
|
+
* - Shared repositories block deletions
|
|
3053
|
+
* - Full audit trail
|
|
2998
3054
|
*
|
|
2999
|
-
* **
|
|
3000
|
-
* -
|
|
3001
|
-
* -
|
|
3002
|
-
* -
|
|
3003
|
-
|
|
3004
|
-
|
|
3055
|
+
* **Important:**
|
|
3056
|
+
* - Use cascade=true for immediate DuckDB cleanup
|
|
3057
|
+
* - Graph rebuild recommended after cascade deletion
|
|
3058
|
+
* - File deletion is included - no credit consumption
|
|
3059
|
+
*/
|
|
3060
|
+
export const deleteFile = <ThrowOnError extends boolean = false>(options: Options<DeleteFileData, ThrowOnError>) => {
|
|
3061
|
+
return (options.client ?? _heyApiClient).delete<DeleteFileResponses, DeleteFileErrors, ThrowOnError>({
|
|
3062
|
+
security: [
|
|
3063
|
+
{
|
|
3064
|
+
name: 'X-API-Key',
|
|
3065
|
+
type: 'apiKey'
|
|
3066
|
+
},
|
|
3067
|
+
{
|
|
3068
|
+
scheme: 'bearer',
|
|
3069
|
+
type: 'http'
|
|
3070
|
+
}
|
|
3071
|
+
],
|
|
3072
|
+
url: '/v1/graphs/{graph_id}/files/{file_id}',
|
|
3073
|
+
...options
|
|
3074
|
+
});
|
|
3075
|
+
};
|
|
3076
|
+
|
|
3077
|
+
/**
|
|
3078
|
+
* Get File Information
|
|
3079
|
+
* Get detailed information about a specific file.
|
|
3005
3080
|
*
|
|
3006
|
-
*
|
|
3007
|
-
* -
|
|
3008
|
-
* - Result limit: 10,000 rows (use LIMIT clause)
|
|
3009
|
-
* - Read-only: No INSERT, UPDATE, DELETE
|
|
3010
|
-
* - User's tables only: Cannot query other users' data
|
|
3081
|
+
* Retrieve comprehensive metadata for a single file by file_id, independent of
|
|
3082
|
+
* table context. Files are first-class resources with complete lifecycle tracking.
|
|
3011
3083
|
*
|
|
3012
|
-
* **
|
|
3013
|
-
*
|
|
3014
|
-
* -
|
|
3015
|
-
* -
|
|
3016
|
-
*
|
|
3084
|
+
* **Returned Information:**
|
|
3085
|
+
* - File ID, name, format, size
|
|
3086
|
+
* - Upload status and timestamps
|
|
3087
|
+
* - **Enhanced Multi-Layer Status** (new in this version):
|
|
3088
|
+
* - S3 layer: upload_status, uploaded_at, size_bytes, row_count
|
|
3089
|
+
* - DuckDB layer: duckdb_status, duckdb_staged_at, duckdb_row_count
|
|
3090
|
+
* - Graph layer: graph_status, graph_ingested_at
|
|
3091
|
+
* - Table association
|
|
3092
|
+
* - S3 location
|
|
3093
|
+
*
|
|
3094
|
+
* **Multi-Layer Pipeline Visibility:**
|
|
3095
|
+
* The `layers` object provides independent status tracking across the three-tier
|
|
3096
|
+
* data pipeline:
|
|
3097
|
+
* - **S3 (Immutable Source)**: File upload and validation
|
|
3098
|
+
* - **DuckDB (Mutable Staging)**: Immediate queryability with file provenance
|
|
3099
|
+
* - **Graph (Immutable View)**: Optional graph database materialization
|
|
3100
|
+
*
|
|
3101
|
+
* Each layer shows its own status, timestamp, and row count (where applicable),
|
|
3102
|
+
* enabling precise debugging and monitoring of the data ingestion flow.
|
|
3017
3103
|
*
|
|
3018
|
-
* **
|
|
3019
|
-
*
|
|
3020
|
-
*
|
|
3104
|
+
* **Use Cases:**
|
|
3105
|
+
* - Validate file upload completion
|
|
3106
|
+
* - Monitor multi-layer ingestion progress in real-time
|
|
3107
|
+
* - Debug upload or staging issues at specific layers
|
|
3108
|
+
* - Verify file metadata and row counts
|
|
3109
|
+
* - Track file provenance through the pipeline
|
|
3110
|
+
* - Identify bottlenecks in the ingestion process
|
|
3021
3111
|
*
|
|
3022
3112
|
* **Note:**
|
|
3023
|
-
*
|
|
3113
|
+
* File info retrieval is included - no credit consumption
|
|
3024
3114
|
*/
|
|
3025
|
-
export const
|
|
3026
|
-
return (options.client ?? _heyApiClient).
|
|
3115
|
+
export const getFile = <ThrowOnError extends boolean = false>(options: Options<GetFileData, ThrowOnError>) => {
|
|
3116
|
+
return (options.client ?? _heyApiClient).get<GetFileResponses, GetFileErrors, ThrowOnError>({
|
|
3027
3117
|
security: [
|
|
3028
3118
|
{
|
|
3029
3119
|
name: 'X-API-Key',
|
|
@@ -3034,7 +3124,53 @@ export const queryTables = <ThrowOnError extends boolean = false>(options: Optio
|
|
|
3034
3124
|
type: 'http'
|
|
3035
3125
|
}
|
|
3036
3126
|
],
|
|
3037
|
-
url: '/v1/graphs/{graph_id}/
|
|
3127
|
+
url: '/v1/graphs/{graph_id}/files/{file_id}',
|
|
3128
|
+
...options
|
|
3129
|
+
});
|
|
3130
|
+
};
|
|
3131
|
+
|
|
3132
|
+
/**
|
|
3133
|
+
* Update File Status
|
|
3134
|
+
* Update file status and trigger processing.
|
|
3135
|
+
*
|
|
3136
|
+
* Update file status after upload completion. Setting status='uploaded' triggers
|
|
3137
|
+
* immediate DuckDB staging and optional graph ingestion.
|
|
3138
|
+
*
|
|
3139
|
+
* **Request Body:**
|
|
3140
|
+
* - `status`: New status (uploaded, disabled, failed)
|
|
3141
|
+
* - `ingest_to_graph` (optional): If true, auto-ingest to graph after DuckDB staging
|
|
3142
|
+
*
|
|
3143
|
+
* **What Happens (status='uploaded'):**
|
|
3144
|
+
* 1. File validated in S3
|
|
3145
|
+
* 2. Row count calculated
|
|
3146
|
+
* 3. DuckDB staging triggered immediately (Celery task)
|
|
3147
|
+
* 4. If ingest_to_graph=true, graph ingestion queued
|
|
3148
|
+
* 5. File queryable in DuckDB within seconds
|
|
3149
|
+
*
|
|
3150
|
+
* **Use Cases:**
|
|
3151
|
+
* - Signal upload completion
|
|
3152
|
+
* - Trigger immediate DuckDB staging
|
|
3153
|
+
* - Enable/disable files
|
|
3154
|
+
* - Mark failed uploads
|
|
3155
|
+
*
|
|
3156
|
+
* **Important:**
|
|
3157
|
+
* - Files must exist in S3 before marking uploaded
|
|
3158
|
+
* - DuckDB staging happens asynchronously
|
|
3159
|
+
* - Graph ingestion is optional (ingest_to_graph flag)
|
|
3160
|
+
*/
|
|
3161
|
+
export const updateFile = <ThrowOnError extends boolean = false>(options: Options<UpdateFileData, ThrowOnError>) => {
|
|
3162
|
+
return (options.client ?? _heyApiClient).patch<UpdateFileResponses, UpdateFileErrors, ThrowOnError>({
|
|
3163
|
+
security: [
|
|
3164
|
+
{
|
|
3165
|
+
name: 'X-API-Key',
|
|
3166
|
+
type: 'apiKey'
|
|
3167
|
+
},
|
|
3168
|
+
{
|
|
3169
|
+
scheme: 'bearer',
|
|
3170
|
+
type: 'http'
|
|
3171
|
+
}
|
|
3172
|
+
],
|
|
3173
|
+
url: '/v1/graphs/{graph_id}/files/{file_id}',
|
|
3038
3174
|
...options,
|
|
3039
3175
|
headers: {
|
|
3040
3176
|
'Content-Type': 'application/json',
|