@robosystems/client 0.2.13 → 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/sdk/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, ListTableFilesData, ListTableFilesResponses, ListTableFilesErrors, GetUploadUrlData, GetUploadUrlResponses, GetUploadUrlErrors, DeleteFileData, DeleteFileResponses, DeleteFileErrors, GetFileInfoData, GetFileInfoResponses, GetFileInfoErrors, UpdateFileStatusData, UpdateFileStatusResponses, UpdateFileStatusErrors, IngestTablesData, IngestTablesResponses, IngestTablesErrors, QueryTablesData, QueryTablesResponses, QueryTablesErrors, 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';
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> & {
@@ -1116,6 +1116,13 @@ export const listAgents = <ThrowOnError extends boolean = false>(options: Option
1116
1116
  * - Leverage conversation history for contextual understanding
1117
1117
  * - Enable RAG for knowledge base enrichment
1118
1118
  *
1119
+ * **Subgraph Support:**
1120
+ * This endpoint accepts both parent graph IDs and subgraph IDs.
1121
+ * - Parent graph: Use `graph_id` like `kg0123456789abcdef`
1122
+ * - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
1123
+ * Agents operate on the specified graph/subgraph's data independently. RAG enrichment
1124
+ * and knowledge base search are scoped to the specific graph/subgraph.
1125
+ *
1119
1126
  * See request/response examples in the "Examples" dropdown below.
1120
1127
  */
1121
1128
  export const autoSelectAgent = <ThrowOnError extends boolean = false>(options: Options<AutoSelectAgentData, ThrowOnError>) => {
@@ -1300,6 +1307,13 @@ export const recommendAgent = <ThrowOnError extends boolean = false>(options: Op
1300
1307
  * - User permissions and subscription tier
1301
1308
  * - Backend capabilities (Kuzu, Neo4j, etc.)
1302
1309
  *
1310
+ * **Subgraph Support:**
1311
+ * This endpoint accepts both parent graph IDs and subgraph IDs.
1312
+ * - Parent graph: Use `graph_id` like `kg0123456789abcdef`
1313
+ * - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
1314
+ * The returned tool list is identical for parent graphs and subgraphs, as all
1315
+ * MCP tools work uniformly across graph boundaries.
1316
+ *
1303
1317
  * **Note:**
1304
1318
  * MCP tool listing is included - no credit consumption required.
1305
1319
  */
@@ -1354,6 +1368,13 @@ export const listMcpTools = <ThrowOnError extends boolean = false>(options: Opti
1354
1368
  * - `408 Request Timeout`: Tool execution exceeded timeout
1355
1369
  * - Clients should implement exponential backoff on errors
1356
1370
  *
1371
+ * **Subgraph Support:**
1372
+ * This endpoint accepts both parent graph IDs and subgraph IDs.
1373
+ * - Parent graph: Use `graph_id` like `kg0123456789abcdef`
1374
+ * - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
1375
+ * MCP tools operate on the specified graph/subgraph independently. Each subgraph
1376
+ * has its own schema, data, and can be queried separately via MCP.
1377
+ *
1357
1378
  * **Credit Model:**
1358
1379
  * MCP tool execution is included - no credit consumption required. Database
1359
1380
  * operations (queries, schema inspection, analytics) are completely free.
@@ -1704,11 +1725,14 @@ export const getGraphUsageAnalytics = <ThrowOnError extends boolean = false>(opt
1704
1725
  };
1705
1726
 
1706
1727
  /**
1707
- * Execute Cypher Query (Read-Only)
1708
- * Execute a read-only Cypher query with intelligent response optimization.
1728
+ * Execute Cypher Query
1729
+ * Execute a Cypher query with intelligent response optimization.
1709
1730
  *
1710
- * **IMPORTANT: This endpoint is READ-ONLY.** Write operations (CREATE, MERGE, SET, DELETE) are not allowed.
1711
- * To load data into your graph, use the staging pipeline:
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:
1712
1736
  * 1. Create file upload: `POST /v1/graphs/{graph_id}/tables/{table_name}/files`
1713
1737
  * 2. Ingest to graph: `POST /v1/graphs/{graph_id}/tables/ingest`
1714
1738
  *
@@ -1761,6 +1785,12 @@ export const getGraphUsageAnalytics = <ThrowOnError extends boolean = false>(opt
1761
1785
  * - `503 Service Unavailable`: Circuit breaker open or SSE disabled
1762
1786
  * - Clients should implement exponential backoff
1763
1787
  *
1788
+ * **Subgraph Support:**
1789
+ * This endpoint accepts both parent graph IDs and subgraph IDs.
1790
+ * - Parent graph: Use `graph_id` like `kg0123456789abcdef`
1791
+ * - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
1792
+ * Subgraphs share the same instance as their parent graph and have independent data.
1793
+ *
1764
1794
  * **Note:**
1765
1795
  * Query operations are included - no credit consumption required.
1766
1796
  * Queue position is based on subscription tier for priority.
@@ -1823,6 +1853,14 @@ export const executeCypherQuery = <ThrowOnError extends boolean = false>(options
1823
1853
  * Property discovery is limited to 10 properties per node type for performance.
1824
1854
  * For complete schema definitions, use `/schema/export`.
1825
1855
  *
1856
+ * ## Subgraph Support
1857
+ *
1858
+ * This endpoint accepts both parent graph IDs and subgraph IDs.
1859
+ * - Parent graph: Use `graph_id` like `kg0123456789abcdef`
1860
+ * - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
1861
+ * Each subgraph has independent schema and data. The returned schema reflects
1862
+ * only the specified graph/subgraph's actual structure.
1863
+ *
1826
1864
  * This operation is included - no credit consumption required.
1827
1865
  */
1828
1866
  export const getGraphSchema = <ThrowOnError extends boolean = false>(options: Options<GetGraphSchemaData, ThrowOnError>) => {
@@ -1932,6 +1970,13 @@ export const exportGraphSchema = <ThrowOnError extends boolean = false>(options:
1932
1970
  * - Performance problems
1933
1971
  * - Naming conflicts
1934
1972
  *
1973
+ * **Subgraph Support:**
1974
+ * This endpoint accepts both parent graph IDs and subgraph IDs.
1975
+ * - Parent graph: Use `graph_id` like `kg0123456789abcdef`
1976
+ * - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
1977
+ * Schema validation is performed against the specified graph/subgraph's current
1978
+ * schema and data structure.
1979
+ *
1935
1980
  * This operation is included - no credit consumption required.
1936
1981
  */
1937
1982
  export const validateSchema = <ThrowOnError extends boolean = false>(options: Options<ValidateSchemaData, ThrowOnError>) => {
@@ -2128,6 +2173,13 @@ export const checkStorageLimits = <ThrowOnError extends boolean = false>(options
2128
2173
  * - **Resource Usage**: Memory and storage consumption
2129
2174
  * - **Alerts**: Active warnings or issues
2130
2175
  *
2176
+ * **Subgraph Support:**
2177
+ * This endpoint accepts both parent graph IDs and subgraph IDs.
2178
+ * - Parent graph: Use `graph_id` like `kg0123456789abcdef`
2179
+ * - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
2180
+ * Health metrics are specific to the requested graph/subgraph. Subgraphs share the
2181
+ * same physical instance as their parent but have independent health indicators.
2182
+ *
2131
2183
  * This endpoint provides essential monitoring data for operational visibility.
2132
2184
  */
2133
2185
  export const getDatabaseHealth = <ThrowOnError extends boolean = false>(options: Options<GetDatabaseHealthData, ThrowOnError>) => {
@@ -2166,6 +2218,13 @@ export const getDatabaseHealth = <ThrowOnError extends boolean = false>(options:
2166
2218
  * - **Backup Status**: Backup availability and recency
2167
2219
  * - **Timestamps**: Creation and modification dates
2168
2220
  *
2221
+ * **Subgraph Support:**
2222
+ * This endpoint accepts both parent graph IDs and subgraph IDs.
2223
+ * - Parent graph: Use `graph_id` like `kg0123456789abcdef`
2224
+ * - Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
2225
+ * Returned metrics are specific to the requested graph/subgraph. Subgraphs have
2226
+ * independent size, node/relationship counts, and backup status.
2227
+ *
2169
2228
  * This endpoint provides essential database information for capacity planning and monitoring.
2170
2229
  */
2171
2230
  export const getDatabaseInfo = <ThrowOnError extends boolean = false>(options: Options<GetDatabaseInfoData, ThrowOnError>) => {
@@ -2199,7 +2258,7 @@ export const getDatabaseInfo = <ThrowOnError extends boolean = false>(options: O
2199
2258
  *
2200
2259
  * This unified endpoint provides all limits in one place for easier client integration.
2201
2260
  *
2202
- * **Note**: Limits vary based on subscription tier (Standard, Enterprise, Premium).
2261
+ * **Note**: Limits vary based on subscription tier (kuzu-standard, kuzu-large, kuzu-xlarge).
2203
2262
  */
2204
2263
  export const getGraphLimits = <ThrowOnError extends boolean = false>(options: Options<GetGraphLimitsData, ThrowOnError>) => {
2205
2264
  return (options.client ?? _heyApiClient).get<GetGraphLimitsResponses, GetGraphLimitsErrors, ThrowOnError>({
@@ -2250,7 +2309,7 @@ export const listSubgraphs = <ThrowOnError extends boolean = false>(options: Opt
2250
2309
 
2251
2310
  /**
2252
2311
  * Create Subgraph
2253
- * Create a new subgraph within a parent graph.
2312
+ * Create a new subgraph within a parent graph, with optional data forking.
2254
2313
  *
2255
2314
  * **Requirements:**
2256
2315
  * - Valid authentication
@@ -2260,8 +2319,23 @@ export const listSubgraphs = <ThrowOnError extends boolean = false>(options: Opt
2260
2319
  * - Must be within subgraph quota limits
2261
2320
  * - Subgraph name must be unique within the parent graph
2262
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
+ *
2263
2329
  * **Returns:**
2264
- * - Created subgraph details including its unique ID
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)
2334
+ *
2335
+ * **Usage:**
2336
+ * - Subgraphs share parent's credit pool
2337
+ * - Subgraph ID can be used in all standard `/v1/graphs/{graph_id}*` endpoints
2338
+ * - Permissions inherited from parent graph
2265
2339
  */
2266
2340
  export const createSubgraph = <ThrowOnError extends boolean = false>(options: Options<CreateSubgraphData, ThrowOnError>) => {
2267
2341
  return (options.client ?? _heyApiClient).post<CreateSubgraphResponses, CreateSubgraphErrors, ThrowOnError>({
@@ -2291,6 +2365,7 @@ export const createSubgraph = <ThrowOnError extends boolean = false>(options: Op
2291
2365
  * **Requirements:**
2292
2366
  * - Must be a valid subgraph (not parent graph)
2293
2367
  * - User must have admin access to parent graph
2368
+ * - Subgraph name must be alphanumeric (1-20 characters)
2294
2369
  * - Optional backup before deletion
2295
2370
  *
2296
2371
  * **Deletion Options:**
@@ -2304,6 +2379,11 @@ export const createSubgraph = <ThrowOnError extends boolean = false>(options: Op
2304
2379
  * **Backup Location:**
2305
2380
  * If backup requested, stored in S3 Kuzu database bucket at:
2306
2381
  * `s3://{kuzu_s3_bucket}/{instance_id}/{database_name}_{timestamp}.backup`
2382
+ *
2383
+ * **Notes:**
2384
+ * - Use the subgraph name (e.g., 'dev', 'staging') not the full subgraph ID
2385
+ * - Deletion does not affect parent graph's credit pool or permissions
2386
+ * - Backup creation consumes credits from parent graph's allocation
2307
2387
  */
2308
2388
  export const deleteSubgraph = <ThrowOnError extends boolean = false>(options: Options<DeleteSubgraphData, ThrowOnError>) => {
2309
2389
  return (options.client ?? _heyApiClient).delete<DeleteSubgraphResponses, DeleteSubgraphErrors, ThrowOnError>({
@@ -2317,7 +2397,7 @@ export const deleteSubgraph = <ThrowOnError extends boolean = false>(options: Op
2317
2397
  type: 'http'
2318
2398
  }
2319
2399
  ],
2320
- url: '/v1/graphs/{graph_id}/subgraphs/{subgraph_id}',
2400
+ url: '/v1/graphs/{graph_id}/subgraphs/{subgraph_name}',
2321
2401
  ...options,
2322
2402
  headers: {
2323
2403
  'Content-Type': 'application/json',
@@ -2332,6 +2412,7 @@ export const deleteSubgraph = <ThrowOnError extends boolean = false>(options: Op
2332
2412
  *
2333
2413
  * **Requirements:**
2334
2414
  * - User must have read access to parent graph
2415
+ * - Subgraph name must be alphanumeric (1-20 characters)
2335
2416
  *
2336
2417
  * **Response includes:**
2337
2418
  * - Full subgraph metadata
@@ -2347,6 +2428,10 @@ export const deleteSubgraph = <ThrowOnError extends boolean = false>(options: Op
2347
2428
  * - Edge count
2348
2429
  * - Database size on disk
2349
2430
  * - Schema information
2431
+ *
2432
+ * **Note:**
2433
+ * Use the subgraph name (e.g., 'dev', 'staging') not the full subgraph ID.
2434
+ * The full ID is returned in the response (e.g., 'kg0123456789abcdef_dev').
2350
2435
  */
2351
2436
  export const getSubgraphInfo = <ThrowOnError extends boolean = false>(options: Options<GetSubgraphInfoData, ThrowOnError>) => {
2352
2437
  return (options.client ?? _heyApiClient).get<GetSubgraphInfoResponses, GetSubgraphInfoErrors, ThrowOnError>({
@@ -2360,7 +2445,7 @@ export const getSubgraphInfo = <ThrowOnError extends boolean = false>(options: O
2360
2445
  type: 'http'
2361
2446
  }
2362
2447
  ],
2363
- url: '/v1/graphs/{graph_id}/subgraphs/{subgraph_id}/info',
2448
+ url: '/v1/graphs/{graph_id}/subgraphs/{subgraph_name}/info',
2364
2449
  ...options
2365
2450
  });
2366
2451
  };
@@ -2541,44 +2626,66 @@ export const listTables = <ThrowOnError extends boolean = false>(options: Option
2541
2626
  };
2542
2627
 
2543
2628
  /**
2544
- * List Files in Staging Table
2545
- * List all files uploaded to a staging table with comprehensive metadata.
2629
+ * Query Staging Tables with SQL
2630
+ * Execute SQL queries on DuckDB staging tables for data inspection and validation.
2546
2631
  *
2547
- * Get a complete inventory of all files in a staging table, including upload status,
2548
- * file sizes, row counts, and S3 locations. Essential for monitoring upload progress
2549
- * and validating data before ingestion.
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
2639
+ *
2640
+ * Query parameters provide automatic escaping and type safety. Use `?` placeholders with parameters array.
2550
2641
  *
2551
2642
  * **Use Cases:**
2552
- * - Monitor file upload progress
2553
- * - Verify files are ready for ingestion
2554
- * - Check file formats and sizes
2555
- * - Track storage usage per table
2556
- * - Identify failed or incomplete uploads
2557
- * - 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
2558
2648
  *
2559
- * **Returned Metadata:**
2560
- * - File ID, name, and format (parquet, csv, json)
2561
- * - Size in bytes and row count (if available)
2562
- * - Upload status and method
2563
- * - Creation and upload timestamps
2564
- * - 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`
2565
2654
  *
2566
- * **Upload Status Values:**
2567
- * - `pending`: Upload URL generated, awaiting upload
2568
- * - `uploaded`: Successfully uploaded, ready for ingestion
2569
- * - `disabled`: Excluded from ingestion
2570
- * - `archived`: Soft deleted
2571
- * - `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
2572
2660
  *
2573
- * **Important Notes:**
2574
- * - Only `uploaded` files are ingested
2575
- * - Check `row_count` to estimate data volume
2576
- * - Use `total_size_bytes` for storage monitoring
2577
- * - Files with `failed` status should be deleted and re-uploaded
2578
- * - File listing is included - no credit consumption
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
2579
2686
  */
2580
- export const listTableFiles = <ThrowOnError extends boolean = false>(options: Options<ListTableFilesData, ThrowOnError>) => {
2581
- return (options.client ?? _heyApiClient).get<ListTableFilesResponses, ListTableFilesErrors, ThrowOnError>({
2687
+ export const queryTables = <ThrowOnError extends boolean = false>(options: Options<QueryTablesData, ThrowOnError>) => {
2688
+ return (options.client ?? _heyApiClient).post<QueryTablesResponses, QueryTablesErrors, ThrowOnError>({
2582
2689
  security: [
2583
2690
  {
2584
2691
  name: 'X-API-Key',
@@ -2589,49 +2696,36 @@ export const listTableFiles = <ThrowOnError extends boolean = false>(options: Op
2589
2696
  type: 'http'
2590
2697
  }
2591
2698
  ],
2592
- url: '/v1/graphs/{graph_id}/tables/{table_name}/files',
2593
- ...options
2699
+ url: '/v1/graphs/{graph_id}/tables/query',
2700
+ ...options,
2701
+ headers: {
2702
+ 'Content-Type': 'application/json',
2703
+ ...options.headers
2704
+ }
2594
2705
  });
2595
2706
  };
2596
2707
 
2597
2708
  /**
2598
- * Get File Upload URL
2599
- * Generate a presigned S3 URL for secure file upload.
2600
- *
2601
- * Initiates file upload to a staging table by generating a secure, time-limited
2602
- * presigned S3 URL. Files are uploaded directly to S3, bypassing the API for
2603
- * optimal performance.
2604
- *
2605
- * **Upload Workflow:**
2606
- * 1. Call this endpoint to get presigned URL
2607
- * 2. PUT file directly to S3 URL
2608
- * 3. Call PATCH /tables/files/{file_id} with status='uploaded'
2609
- * 4. Backend validates file and calculates metrics
2610
- * 5. File ready for ingestion
2611
- *
2612
- * **Supported Formats:**
2613
- * - Parquet (`application/x-parquet` with `.parquet` extension)
2614
- * - CSV (`text/csv` with `.csv` extension)
2615
- * - JSON (`application/json` with `.json` extension)
2709
+ * Create View
2710
+ * Generate financial report view from data source (dual-mode support).
2616
2711
  *
2617
- * **Validation:**
2618
- * - File extension must match content type
2619
- * - File name 1-255 characters
2620
- * - No path traversal characters (.. / \)
2621
- * - Auto-creates table if it doesn't exist
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
2622
2716
  *
2623
- * **Auto-Table Creation:**
2624
- * Tables are automatically created on first file upload with type inferred from name
2625
- * (e.g., "Transaction" relationship) and empty schema populated during ingestion.
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
2626
2721
  *
2627
- * **Important Notes:**
2628
- * - Presigned URLs expire (default: 1 hour)
2629
- * - Use appropriate Content-Type header when uploading to S3
2630
- * - File extension must match content type
2631
- * - 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
2632
2726
  */
2633
- export const getUploadUrl = <ThrowOnError extends boolean = false>(options: Options<GetUploadUrlData, ThrowOnError>) => {
2634
- return (options.client ?? _heyApiClient).post<GetUploadUrlResponses, GetUploadUrlErrors, ThrowOnError>({
2727
+ export const createView = <ThrowOnError extends boolean = false>(options: Options<CreateViewData, ThrowOnError>) => {
2728
+ return (options.client ?? _heyApiClient).post<CreateViewResponses, CreateViewErrors, ThrowOnError>({
2635
2729
  security: [
2636
2730
  {
2637
2731
  name: 'X-API-Key',
@@ -2642,7 +2736,7 @@ export const getUploadUrl = <ThrowOnError extends boolean = false>(options: Opti
2642
2736
  type: 'http'
2643
2737
  }
2644
2738
  ],
2645
- url: '/v1/graphs/{graph_id}/tables/{table_name}/files',
2739
+ url: '/v1/graphs/{graph_id}/views',
2646
2740
  ...options,
2647
2741
  headers: {
2648
2742
  'Content-Type': 'application/json',
@@ -2652,41 +2746,39 @@ export const getUploadUrl = <ThrowOnError extends boolean = false>(options: Opti
2652
2746
  };
2653
2747
 
2654
2748
  /**
2655
- * Delete File from Staging
2656
- * Delete a file from S3 storage and database tracking.
2749
+ * Save View
2750
+ * Save or update view as materialized report in the graph.
2657
2751
  *
2658
- * Remove unwanted, duplicate, or incorrect files from staging tables before ingestion.
2659
- * The file is deleted from both S3 and database tracking, and table statistics
2660
- * are automatically recalculated.
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.
2661
2755
  *
2662
- * **Use Cases:**
2663
- * - Remove duplicate uploads
2664
- * - Delete files with incorrect data
2665
- * - Clean up failed uploads
2666
- * - Fix data quality issues before ingestion
2667
- * - 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
2668
2759
  *
2669
- * **What Happens:**
2670
- * 1. File deleted from S3 storage
2671
- * 2. Database tracking record removed
2672
- * 3. Table statistics recalculated (file count, size, row count)
2673
- * 4. DuckDB automatically excludes file from future queries
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
2674
2765
  *
2675
- * **Security:**
2676
- * - Write access required (verified via auth)
2677
- * - Shared repositories block file deletions
2678
- * - Full audit trail of deletion operations
2679
- * - 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.
2680
2768
  *
2681
- * **Important Notes:**
2682
- * - Delete files before ingestion for best results
2683
- * - Table statistics update automatically
2684
- * - No need to refresh DuckDB - exclusion is automatic
2685
- * - Consider re-uploading corrected version after deletion
2686
- * - File deletion is included - no credit consumption
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
2687
2779
  */
2688
- export const deleteFile = <ThrowOnError extends boolean = false>(options: Options<DeleteFileData, ThrowOnError>) => {
2689
- return (options.client ?? _heyApiClient).delete<DeleteFileResponses, DeleteFileErrors, ThrowOnError>({
2780
+ export const saveView = <ThrowOnError extends boolean = false>(options: Options<SaveViewData, ThrowOnError>) => {
2781
+ return (options.client ?? _heyApiClient).post<SaveViewResponses, SaveViewErrors, ThrowOnError>({
2690
2782
  security: [
2691
2783
  {
2692
2784
  name: 'X-API-Key',
@@ -2697,31 +2789,44 @@ export const deleteFile = <ThrowOnError extends boolean = false>(options: Option
2697
2789
  type: 'http'
2698
2790
  }
2699
2791
  ],
2700
- url: '/v1/graphs/{graph_id}/tables/files/{file_id}',
2701
- ...options
2792
+ url: '/v1/graphs/{graph_id}/views/save',
2793
+ ...options,
2794
+ headers: {
2795
+ 'Content-Type': 'application/json',
2796
+ ...options.headers
2797
+ }
2702
2798
  });
2703
2799
  };
2704
2800
 
2705
2801
  /**
2706
- * Get File Information
2707
- * Get detailed information about a specific file.
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.
2708
2807
  *
2709
- * Retrieve comprehensive metadata for a single file, including upload status,
2710
- * size, row count, and timestamps. Useful for validating individual files
2711
- * before ingestion.
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
2712
2815
  *
2713
2816
  * **Use Cases:**
2714
- * - Validate file upload completion
2715
- * - Check file metadata before ingestion
2716
- * - Debug upload issues
2717
- * - Verify file format and size
2718
- * - Track file lifecycle
2817
+ * - Decide if materialization is needed
2818
+ * - Monitor graph freshness
2819
+ * - Track materialization history
2820
+ * - Understand data pipeline state
2719
2821
  *
2720
- * **Note:**
2721
- * File info retrieval is included - no credit consumption
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
2722
2827
  */
2723
- export const getFileInfo = <ThrowOnError extends boolean = false>(options: Options<GetFileInfoData, ThrowOnError>) => {
2724
- return (options.client ?? _heyApiClient).get<GetFileInfoResponses, GetFileInfoErrors, ThrowOnError>({
2828
+ export const getMaterializationStatus = <ThrowOnError extends boolean = false>(options: Options<GetMaterializationStatusData, ThrowOnError>) => {
2829
+ return (options.client ?? _heyApiClient).get<GetMaterializationStatusResponses, GetMaterializationStatusErrors, ThrowOnError>({
2725
2830
  security: [
2726
2831
  {
2727
2832
  name: 'X-API-Key',
@@ -2732,52 +2837,67 @@ export const getFileInfo = <ThrowOnError extends boolean = false>(options: Optio
2732
2837
  type: 'http'
2733
2838
  }
2734
2839
  ],
2735
- url: '/v1/graphs/{graph_id}/tables/files/{file_id}',
2840
+ url: '/v1/graphs/{graph_id}/materialize/status',
2736
2841
  ...options
2737
2842
  });
2738
2843
  };
2739
2844
 
2740
2845
  /**
2741
- * Update File Upload Status
2742
- * Update file status after upload completes.
2846
+ * Materialize Graph from DuckDB
2847
+ * Rebuild entire graph from DuckDB staging tables (materialized view pattern).
2743
2848
  *
2744
- * Marks files as uploaded after successful S3 upload. The backend validates
2745
- * the file, calculates size and row count, enforces storage limits, and
2746
- * registers the DuckDB table for queries.
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.
2747
2852
  *
2748
- * **Status Values:**
2749
- * - `uploaded`: File successfully uploaded to S3 (triggers validation)
2750
- * - `disabled`: Exclude file from ingestion
2751
- * - `archived`: Soft delete file
2752
- *
2753
- * **What Happens on 'uploaded' Status:**
2754
- * 1. Verify file exists in S3
2755
- * 2. Calculate actual file size
2756
- * 3. Enforce tier storage limits
2757
- * 4. Calculate or estimate row count
2758
- * 5. Update table statistics
2759
- * 6. Register DuckDB external table
2760
- * 7. File ready for ingestion
2761
- *
2762
- * **Row Count Calculation:**
2763
- * - **Parquet**: Exact count from file metadata
2764
- * - **CSV**: Count rows (minus header)
2765
- * - **JSON**: Count array elements
2766
- * - **Fallback**: Estimate from file size if reading fails
2767
- *
2768
- * **Storage Limits:**
2769
- * Enforced per subscription tier. Returns HTTP 413 if limit exceeded.
2770
- * 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
2771
2858
  *
2772
- * **Important Notes:**
2773
- * - Always call this after S3 upload completes
2774
- * - Check response for actual row count
2775
- * - Storage limit errors (413) mean tier upgrade needed
2776
- * - DuckDB registration failures are non-fatal (retried later)
2777
- * - Status updates are included - no credit consumption
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
2778
2898
  */
2779
- export const updateFileStatus = <ThrowOnError extends boolean = false>(options: Options<UpdateFileStatusData, ThrowOnError>) => {
2780
- return (options.client ?? _heyApiClient).patch<UpdateFileStatusResponses, UpdateFileStatusErrors, ThrowOnError>({
2899
+ export const materializeGraph = <ThrowOnError extends boolean = false>(options: Options<MaterializeGraphData, ThrowOnError>) => {
2900
+ return (options.client ?? _heyApiClient).post<MaterializeGraphResponses, MaterializeGraphErrors, ThrowOnError>({
2781
2901
  security: [
2782
2902
  {
2783
2903
  name: 'X-API-Key',
@@ -2788,7 +2908,7 @@ export const updateFileStatus = <ThrowOnError extends boolean = false>(options:
2788
2908
  type: 'http'
2789
2909
  }
2790
2910
  ],
2791
- url: '/v1/graphs/{graph_id}/tables/files/{file_id}',
2911
+ url: '/v1/graphs/{graph_id}/materialize',
2792
2912
  ...options,
2793
2913
  headers: {
2794
2914
  'Content-Type': 'application/json',
@@ -2798,65 +2918,88 @@ export const updateFileStatus = <ThrowOnError extends boolean = false>(options:
2798
2918
  };
2799
2919
 
2800
2920
  /**
2801
- * Ingest Tables to Graph
2802
- * Load all files from S3 into DuckDB staging tables and ingest into Kuzu graph database.
2921
+ * List Files in Graph
2922
+ * List all files in the graph with optional filtering.
2803
2923
  *
2804
- * Orchestrates the complete data pipeline from S3 staging files into the Kuzu graph database.
2805
- * Processes all tables in a single bulk operation with comprehensive error handling and metrics.
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.)
2806
2930
  *
2807
2931
  * **Use Cases:**
2808
- * - Initial graph population from uploaded data
2809
- * - Incremental data updates with new files
2810
- * - Complete database rebuild from source files
2811
- * - Recovery from failed ingestion attempts
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
2812
2938
  *
2813
- * **Workflow:**
2814
- * 1. Upload data files via `POST /tables/{table_name}/files`
2815
- * 2. Files are validated and marked as 'uploaded'
2816
- * 3. Trigger ingestion: `POST /tables/ingest`
2817
- * 4. DuckDB staging tables created from S3 patterns
2818
- * 5. Data copied row-by-row from DuckDB to Kuzu
2819
- * 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
2820
2945
  *
2821
- * **Rebuild Feature:**
2822
- * Setting `rebuild=true` regenerates the entire graph database from scratch:
2823
- * - Deletes existing Kuzu database
2824
- * - Recreates with fresh schema from active GraphSchema
2825
- * - Ingests all data files
2826
- * - Safe operation - S3 is source of truth
2827
- * - Useful for schema changes or data corrections
2828
- * - Graph marked as 'rebuilding' during process
2946
+ * **File Lifecycle Tracking:**
2947
+ * Multi-layer status across S3 DuckDB Graph pipeline
2829
2948
  *
2830
- * **Error Handling:**
2831
- * - Per-table error isolation with `ignore_errors` flag
2832
- * - Partial success support (some tables succeed, some fail)
2833
- * - Detailed error reporting per table
2834
- * - Graph status tracking throughout process
2835
- * - Automatic failure recovery and cleanup
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.
2836
2974
  *
2837
- * **Performance:**
2838
- * - Processes all tables in sequence
2839
- * - Each table timed independently
2840
- * - Total execution metrics provided
2841
- * - Scales to thousands of files
2842
- * - 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.
2843
2977
  *
2844
- * **Concurrency Control:**
2845
- * Only one ingestion can run per graph at a time. If another ingestion is in progress,
2846
- * you'll receive a 409 Conflict error. The distributed lock automatically expires after
2847
- * the configured TTL (default: 1 hour) to prevent deadlocks from failed ingestions.
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
2982
+ *
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.
2848
2995
  *
2849
2996
  * **Important Notes:**
2850
- * - Only files with 'uploaded' status are processed
2851
- * - Tables with no uploaded files are skipped
2852
- * - Use `ignore_errors=false` for strict validation
2853
- * - Monitor progress via per-table results
2854
- * - Check graph metadata for rebuild status
2855
- * - Wait for current ingestion to complete before starting another
2856
- * - 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
2857
3000
  */
2858
- export const ingestTables = <ThrowOnError extends boolean = false>(options: Options<IngestTablesData, ThrowOnError>) => {
2859
- return (options.client ?? _heyApiClient).post<IngestTablesResponses, IngestTablesErrors, ThrowOnError>({
3001
+ export const createFileUpload = <ThrowOnError extends boolean = false>(options: Options<CreateFileUploadData, ThrowOnError>) => {
3002
+ return (options.client ?? _heyApiClient).post<CreateFileUploadResponses, CreateFileUploadErrors, ThrowOnError>({
2860
3003
  security: [
2861
3004
  {
2862
3005
  name: 'X-API-Key',
@@ -2867,7 +3010,7 @@ export const ingestTables = <ThrowOnError extends boolean = false>(options: Opti
2867
3010
  type: 'http'
2868
3011
  }
2869
3012
  ],
2870
- url: '/v1/graphs/{graph_id}/tables/ingest',
3013
+ url: '/v1/graphs/{graph_id}/files',
2871
3014
  ...options,
2872
3015
  headers: {
2873
3016
  'Content-Type': 'application/json',
@@ -2877,60 +3020,100 @@ export const ingestTables = <ThrowOnError extends boolean = false>(options: Opti
2877
3020
  };
2878
3021
 
2879
3022
  /**
2880
- * Query Staging Tables with SQL
2881
- * Execute SQL queries on DuckDB staging tables for data inspection and validation.
3023
+ * Delete File
3024
+ * Delete file from all layers.
2882
3025
  *
2883
- * Query raw staging data directly with SQL before ingestion into the graph database.
2884
- * Useful for data quality checks, validation, and exploratory analysis.
3026
+ * Remove file from S3, database tracking, and optionally from DuckDB and graph.
3027
+ * Files are deleted by file_id, independent of table context.
2885
3028
  *
2886
- * **Security Best Practice - Use Parameterized Queries:**
2887
- * ALWAYS use query parameters instead of string concatenation to prevent SQL injection:
2888
- * - ✅ SAFE: `SELECT * FROM Entity WHERE type = ? LIMIT ?` with `parameters: ["Company", 100]`
2889
- * - ❌ 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
2890
3031
  *
2891
- * Query parameters provide automatic escaping and type safety. Use `?` placeholders with parameters array.
3032
+ * **What Happens (cascade=false):**
3033
+ * 1. File deleted from S3
3034
+ * 2. Database record removed
3035
+ * 3. Table statistics updated
3036
+ *
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
2892
3043
  *
2893
3044
  * **Use Cases:**
2894
- * - Validate data quality before graph ingestion
2895
- * - Inspect row-level data for debugging
2896
- * - Run analytics on staging tables
2897
- * - Check for duplicates, nulls, or data issues
2898
- * - Preview data transformations
3045
+ * - Remove incorrect or duplicate files
3046
+ * - Clean up failed uploads
3047
+ * - Delete files before graph ingestion
3048
+ * - Surgical data removal with cascade
2899
3049
  *
2900
- * **Workflow:**
2901
- * 1. Upload data files via `POST /tables/{table_name}/files`
2902
- * 2. Query staging tables to validate: `POST /tables/query`
2903
- * 3. Fix any data issues by re-uploading
2904
- * 4. Ingest validated data: `POST /tables/ingest`
3050
+ * **Security:**
3051
+ * - Write access required
3052
+ * - Shared repositories block deletions
3053
+ * - Full audit trail
2905
3054
  *
2906
- * **Supported SQL:**
2907
- * - Full DuckDB SQL syntax
2908
- * - SELECT, JOIN, WHERE, GROUP BY, ORDER BY
2909
- * - Aggregations, window functions, CTEs
2910
- * - Multiple table joins across staging area
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.
2911
3080
  *
2912
- * **Common Operations:**
2913
- * - Count rows: `SELECT COUNT(*) FROM Entity`
2914
- * - Filter by type: `SELECT * FROM Entity WHERE entity_type = ? LIMIT ?` with `parameters: ["Company", 100]`
2915
- * - Check for nulls: `SELECT * FROM Entity WHERE name IS NULL LIMIT 10`
2916
- * - Find duplicates: `SELECT identifier, COUNT(*) as cnt FROM Entity GROUP BY identifier HAVING COUNT(*) > 1`
2917
- * - Filter amounts: `SELECT * FROM Transaction WHERE amount > ? AND date >= ?` with `parameters: [1000, "2024-01-01"]`
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.
2918
3083
  *
2919
- * **Limits:**
2920
- * - Query timeout: 30 seconds
2921
- * - Result limit: 10,000 rows (use LIMIT clause)
2922
- * - Read-only: No INSERT, UPDATE, DELETE
2923
- * - User's tables only: Cannot query other users' data
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.
2924
3103
  *
2925
- * **Shared Repositories:**
2926
- * Shared repositories (SEC, etc.) do not allow direct SQL queries.
2927
- * Use the graph query endpoint instead: `POST /v1/graphs/{graph_id}/query`
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
2928
3111
  *
2929
3112
  * **Note:**
2930
- * Staging table queries are included - no credit consumption
3113
+ * File info retrieval is included - no credit consumption
2931
3114
  */
2932
- export const queryTables = <ThrowOnError extends boolean = false>(options: Options<QueryTablesData, ThrowOnError>) => {
2933
- return (options.client ?? _heyApiClient).post<QueryTablesResponses, QueryTablesErrors, ThrowOnError>({
3115
+ export const getFile = <ThrowOnError extends boolean = false>(options: Options<GetFileData, ThrowOnError>) => {
3116
+ return (options.client ?? _heyApiClient).get<GetFileResponses, GetFileErrors, ThrowOnError>({
2934
3117
  security: [
2935
3118
  {
2936
3119
  name: 'X-API-Key',
@@ -2941,7 +3124,53 @@ export const queryTables = <ThrowOnError extends boolean = false>(options: Optio
2941
3124
  type: 'http'
2942
3125
  }
2943
3126
  ],
2944
- url: '/v1/graphs/{graph_id}/tables/query',
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}',
2945
3174
  ...options,
2946
3175
  headers: {
2947
3176
  'Content-Type': 'application/json',