@stigmer/react 3.2.3 → 3.3.0
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/agent/steps/ReviewStep.d.ts.map +1 -1
- package/agent/steps/ReviewStep.js +2 -3
- package/agent/steps/ReviewStep.js.map +1 -1
- package/billing/BaselineEditor.d.ts +9 -0
- package/billing/BaselineEditor.d.ts.map +1 -0
- package/billing/BaselineEditor.js +253 -0
- package/billing/BaselineEditor.js.map +1 -0
- package/billing/ModelCatalogPanel.d.ts +28 -0
- package/billing/ModelCatalogPanel.d.ts.map +1 -0
- package/billing/ModelCatalogPanel.js +102 -0
- package/billing/ModelCatalogPanel.js.map +1 -0
- package/billing/ModelGovernanceDetail.d.ts +8 -0
- package/billing/ModelGovernanceDetail.d.ts.map +1 -0
- package/billing/ModelGovernanceDetail.js +64 -0
- package/billing/ModelGovernanceDetail.js.map +1 -0
- package/billing/OperatorAccessNotice.d.ts +12 -0
- package/billing/OperatorAccessNotice.d.ts.map +1 -0
- package/billing/OperatorAccessNotice.js +15 -0
- package/billing/OperatorAccessNotice.js.map +1 -0
- package/billing/PricingGovernanceConsole.d.ts +57 -0
- package/billing/PricingGovernanceConsole.d.ts.map +1 -0
- package/billing/PricingGovernanceConsole.js +164 -0
- package/billing/PricingGovernanceConsole.js.map +1 -0
- package/billing/PricingGovernancePanel.d.ts +26 -0
- package/billing/PricingGovernancePanel.d.ts.map +1 -0
- package/billing/PricingGovernancePanel.js +64 -0
- package/billing/PricingGovernancePanel.js.map +1 -0
- package/billing/RetireConfirm.d.ts +9 -0
- package/billing/RetireConfirm.d.ts.map +1 -0
- package/billing/RetireConfirm.js +19 -0
- package/billing/RetireConfirm.js.map +1 -0
- package/billing/form-primitives.d.ts +18 -0
- package/billing/form-primitives.d.ts.map +1 -0
- package/billing/form-primitives.js +19 -0
- package/billing/form-primitives.js.map +1 -0
- package/billing/governance-primitives.d.ts +33 -0
- package/billing/governance-primitives.d.ts.map +1 -0
- package/billing/governance-primitives.js +43 -0
- package/billing/governance-primitives.js.map +1 -0
- package/billing/index.d.ts +18 -0
- package/billing/index.d.ts.map +1 -1
- package/billing/index.js +9 -0
- package/billing/index.js.map +1 -1
- package/billing/pricing-format.d.ts +12 -0
- package/billing/pricing-format.d.ts.map +1 -0
- package/billing/pricing-format.js +50 -0
- package/billing/pricing-format.js.map +1 -0
- package/billing/useDecidePricingOverride.d.ts +46 -0
- package/billing/useDecidePricingOverride.d.ts.map +1 -0
- package/billing/useDecidePricingOverride.js +44 -0
- package/billing/useDecidePricingOverride.js.map +1 -0
- package/billing/useModelGovernanceView.d.ts +103 -0
- package/billing/useModelGovernanceView.d.ts.map +1 -0
- package/billing/useModelGovernanceView.js +144 -0
- package/billing/useModelGovernanceView.js.map +1 -0
- package/billing/useModelPricingBaselines.d.ts +40 -0
- package/billing/useModelPricingBaselines.d.ts.map +1 -0
- package/billing/useModelPricingBaselines.js +32 -0
- package/billing/useModelPricingBaselines.js.map +1 -0
- package/billing/usePricingGovernance.d.ts +39 -0
- package/billing/usePricingGovernance.d.ts.map +1 -0
- package/billing/usePricingGovernance.js +31 -0
- package/billing/usePricingGovernance.js.map +1 -0
- package/billing/useRetireModelPricingBaseline.d.ts +31 -0
- package/billing/useRetireModelPricingBaseline.d.ts.map +1 -0
- package/billing/useRetireModelPricingBaseline.js +36 -0
- package/billing/useRetireModelPricingBaseline.js.map +1 -0
- package/billing/useUpsertModelPricingBaseline.d.ts +38 -0
- package/billing/useUpsertModelPricingBaseline.d.ts.map +1 -0
- package/billing/useUpsertModelPricingBaseline.js +37 -0
- package/billing/useUpsertModelPricingBaseline.js.map +1 -0
- package/channel/AgentChannelsPanel.d.ts.map +1 -1
- package/channel/AgentChannelsPanel.js +11 -5
- package/channel/AgentChannelsPanel.js.map +1 -1
- package/composer/SessionComposer.d.ts +1 -1
- package/cursor-accounts/CursorAccountEditor.d.ts +28 -0
- package/cursor-accounts/CursorAccountEditor.d.ts.map +1 -0
- package/cursor-accounts/CursorAccountEditor.js +51 -0
- package/cursor-accounts/CursorAccountEditor.js.map +1 -0
- package/cursor-accounts/CursorAccountsAccessNotice.d.ts +11 -0
- package/cursor-accounts/CursorAccountsAccessNotice.d.ts.map +1 -0
- package/cursor-accounts/CursorAccountsAccessNotice.js +14 -0
- package/cursor-accounts/CursorAccountsAccessNotice.js.map +1 -0
- package/cursor-accounts/CursorAccountsConsole.d.ts +28 -0
- package/cursor-accounts/CursorAccountsConsole.d.ts.map +1 -0
- package/cursor-accounts/CursorAccountsConsole.js +275 -0
- package/cursor-accounts/CursorAccountsConsole.js.map +1 -0
- package/cursor-accounts/cursor-account-format.d.ts +10 -0
- package/cursor-accounts/cursor-account-format.d.ts.map +1 -0
- package/cursor-accounts/cursor-account-format.js +26 -0
- package/cursor-accounts/cursor-account-format.js.map +1 -0
- package/cursor-accounts/index.d.ts +18 -0
- package/cursor-accounts/index.d.ts.map +1 -0
- package/cursor-accounts/index.js +13 -0
- package/cursor-accounts/index.js.map +1 -0
- package/cursor-accounts/useCursorAccountView.d.ts +30 -0
- package/cursor-accounts/useCursorAccountView.d.ts.map +1 -0
- package/cursor-accounts/useCursorAccountView.js +25 -0
- package/cursor-accounts/useCursorAccountView.js.map +1 -0
- package/cursor-accounts/useCursorAccounts.d.ts +33 -0
- package/cursor-accounts/useCursorAccounts.d.ts.map +1 -0
- package/cursor-accounts/useCursorAccounts.js +25 -0
- package/cursor-accounts/useCursorAccounts.js.map +1 -0
- package/cursor-accounts/useCursorMemberKeyActions.d.ts +49 -0
- package/cursor-accounts/useCursorMemberKeyActions.d.ts.map +1 -0
- package/cursor-accounts/useCursorMemberKeyActions.js +38 -0
- package/cursor-accounts/useCursorMemberKeyActions.js.map +1 -0
- package/cursor-accounts/useDeleteCursorAccount.d.ts +30 -0
- package/cursor-accounts/useDeleteCursorAccount.d.ts.map +1 -0
- package/cursor-accounts/useDeleteCursorAccount.js +32 -0
- package/cursor-accounts/useDeleteCursorAccount.js.map +1 -0
- package/cursor-accounts/useSyncCursorAccount.d.ts +23 -0
- package/cursor-accounts/useSyncCursorAccount.d.ts.map +1 -0
- package/cursor-accounts/useSyncCursorAccount.js +31 -0
- package/cursor-accounts/useSyncCursorAccount.js.map +1 -0
- package/cursor-accounts/useUpsertCursorAccount.d.ts +26 -0
- package/cursor-accounts/useUpsertCursorAccount.d.ts.map +1 -0
- package/cursor-accounts/useUpsertCursorAccount.js +34 -0
- package/cursor-accounts/useUpsertCursorAccount.js.map +1 -0
- package/datastore/CollectionRecordsBrowser.d.ts +34 -0
- package/datastore/CollectionRecordsBrowser.d.ts.map +1 -0
- package/datastore/CollectionRecordsBrowser.js +209 -0
- package/datastore/CollectionRecordsBrowser.js.map +1 -0
- package/datastore/CollectionSchemaView.d.ts +29 -0
- package/datastore/CollectionSchemaView.d.ts.map +1 -0
- package/datastore/CollectionSchemaView.js +93 -0
- package/datastore/CollectionSchemaView.js.map +1 -0
- package/datastore/DatastoreDetailView.d.ts +44 -0
- package/datastore/DatastoreDetailView.d.ts.map +1 -0
- package/datastore/DatastoreDetailView.js +76 -0
- package/datastore/DatastoreDetailView.js.map +1 -0
- package/datastore/DatastoreSyncReport.d.ts +19 -0
- package/datastore/DatastoreSyncReport.d.ts.map +1 -0
- package/datastore/DatastoreSyncReport.js +45 -0
- package/datastore/DatastoreSyncReport.js.map +1 -0
- package/datastore/DeleteDatastoreDialog.d.ts +35 -0
- package/datastore/DeleteDatastoreDialog.d.ts.map +1 -0
- package/datastore/DeleteDatastoreDialog.js +90 -0
- package/datastore/DeleteDatastoreDialog.js.map +1 -0
- package/datastore/FieldValueControl.d.ts +55 -0
- package/datastore/FieldValueControl.d.ts.map +1 -0
- package/datastore/FieldValueControl.js +138 -0
- package/datastore/FieldValueControl.js.map +1 -0
- package/datastore/RecordFilterBuilder.d.ts +30 -0
- package/datastore/RecordFilterBuilder.d.ts.map +1 -0
- package/datastore/RecordFilterBuilder.js +122 -0
- package/datastore/RecordFilterBuilder.js.map +1 -0
- package/datastore/RecordFormPanel.d.ts +45 -0
- package/datastore/RecordFormPanel.d.ts.map +1 -0
- package/datastore/RecordFormPanel.js +215 -0
- package/datastore/RecordFormPanel.js.map +1 -0
- package/datastore/index.d.ts +43 -0
- package/datastore/index.d.ts.map +1 -0
- package/datastore/index.js +22 -0
- package/datastore/index.js.map +1 -0
- package/datastore/recordFilter.d.ts +54 -0
- package/datastore/recordFilter.d.ts.map +1 -0
- package/datastore/recordFilter.js +93 -0
- package/datastore/recordFilter.js.map +1 -0
- package/datastore/recordValues.d.ts +85 -0
- package/datastore/recordValues.d.ts.map +1 -0
- package/datastore/recordValues.js +282 -0
- package/datastore/recordValues.js.map +1 -0
- package/datastore/useDatastore.d.ts +39 -0
- package/datastore/useDatastore.d.ts.map +1 -0
- package/datastore/useDatastore.js +44 -0
- package/datastore/useDatastore.js.map +1 -0
- package/datastore/useDatastoreCount.d.ts +48 -0
- package/datastore/useDatastoreCount.d.ts.map +1 -0
- package/datastore/useDatastoreCount.js +27 -0
- package/datastore/useDatastoreCount.js.map +1 -0
- package/datastore/useDatastoreDescription.d.ts +54 -0
- package/datastore/useDatastoreDescription.d.ts.map +1 -0
- package/datastore/useDatastoreDescription.js +50 -0
- package/datastore/useDatastoreDescription.js.map +1 -0
- package/datastore/useDatastoreList.d.ts +57 -0
- package/datastore/useDatastoreList.d.ts.map +1 -0
- package/datastore/useDatastoreList.js +29 -0
- package/datastore/useDatastoreList.js.map +1 -0
- package/datastore/useDatastoreSearch.d.ts +19 -0
- package/datastore/useDatastoreSearch.d.ts.map +1 -0
- package/datastore/useDatastoreSearch.js +22 -0
- package/datastore/useDatastoreSearch.js.map +1 -0
- package/datastore/useDeleteDatastore.d.ts +53 -0
- package/datastore/useDeleteDatastore.d.ts.map +1 -0
- package/datastore/useDeleteDatastore.js +40 -0
- package/datastore/useDeleteDatastore.js.map +1 -0
- package/datastore/useDeleteRecord.d.ts +34 -0
- package/datastore/useDeleteRecord.d.ts.map +1 -0
- package/datastore/useDeleteRecord.js +43 -0
- package/datastore/useDeleteRecord.js.map +1 -0
- package/datastore/useInsertRecord.d.ts +50 -0
- package/datastore/useInsertRecord.d.ts.map +1 -0
- package/datastore/useInsertRecord.js +55 -0
- package/datastore/useInsertRecord.js.map +1 -0
- package/datastore/useRecordCollection.d.ts +104 -0
- package/datastore/useRecordCollection.d.ts.map +1 -0
- package/datastore/useRecordCollection.js +136 -0
- package/datastore/useRecordCollection.js.map +1 -0
- package/datastore/useRecordList.d.ts +66 -0
- package/datastore/useRecordList.d.ts.map +1 -0
- package/datastore/useRecordList.js +58 -0
- package/datastore/useRecordList.js.map +1 -0
- package/datastore/useUpdateRecord.d.ts +52 -0
- package/datastore/useUpdateRecord.d.ts.map +1 -0
- package/datastore/useUpdateRecord.js +55 -0
- package/datastore/useUpdateRecord.js.map +1 -0
- package/environment/EnvironmentListPanel.d.ts.map +1 -1
- package/environment/EnvironmentListPanel.js +12 -7
- package/environment/EnvironmentListPanel.js.map +1 -1
- package/iam-policy/index.d.ts +1 -1
- package/iam-policy/index.d.ts.map +1 -1
- package/iam-policy/index.js.map +1 -1
- package/iam-policy/useCheckPermission.d.ts +32 -11
- package/iam-policy/useCheckPermission.d.ts.map +1 -1
- package/iam-policy/useCheckPermission.js +24 -19
- package/iam-policy/useCheckPermission.js.map +1 -1
- package/index.d.ts +12 -6
- package/index.d.ts.map +1 -1
- package/index.js +14 -3
- package/index.js.map +1 -1
- package/library/index.d.ts +0 -7
- package/library/index.d.ts.map +1 -1
- package/library/index.js +0 -4
- package/library/index.js.map +1 -1
- package/library/useApplyResource.d.ts +12 -12
- package/library/useApplyResource.d.ts.map +1 -1
- package/library/useApplyResource.js +16 -25
- package/library/useApplyResource.js.map +1 -1
- package/library/useExportResource.d.ts +13 -9
- package/library/useExportResource.d.ts.map +1 -1
- package/library/useExportResource.js +18 -36
- package/library/useExportResource.js.map +1 -1
- package/manifest/ApplyManifestDialog.d.ts +48 -0
- package/manifest/ApplyManifestDialog.d.ts.map +1 -0
- package/manifest/ApplyManifestDialog.js +135 -0
- package/manifest/ApplyManifestDialog.js.map +1 -0
- package/manifest/EditResourceYamlDialog.d.ts +51 -0
- package/manifest/EditResourceYamlDialog.d.ts.map +1 -0
- package/manifest/EditResourceYamlDialog.js +104 -0
- package/manifest/EditResourceYamlDialog.js.map +1 -0
- package/manifest/RedactedSecretsNotice.d.ts +14 -0
- package/manifest/RedactedSecretsNotice.d.ts.map +1 -0
- package/manifest/RedactedSecretsNotice.js +14 -0
- package/manifest/RedactedSecretsNotice.js.map +1 -0
- package/manifest/YamlEditor.d.ts +44 -0
- package/manifest/YamlEditor.d.ts.map +1 -0
- package/manifest/YamlEditor.js +216 -0
- package/manifest/YamlEditor.js.map +1 -0
- package/manifest/index.d.ts +13 -0
- package/manifest/index.d.ts.map +1 -0
- package/manifest/index.js +13 -0
- package/manifest/index.js.map +1 -0
- package/manifest/useApplyManifest.d.ts +82 -0
- package/manifest/useApplyManifest.d.ts.map +1 -0
- package/manifest/useApplyManifest.js +180 -0
- package/manifest/useApplyManifest.js.map +1 -0
- package/manifest/useEditResourceYaml.d.ts +106 -0
- package/manifest/useEditResourceYaml.d.ts.map +1 -0
- package/manifest/useEditResourceYaml.js +168 -0
- package/manifest/useEditResourceYaml.js.map +1 -0
- package/mcp-server/steps/ReviewStep.d.ts.map +1 -1
- package/mcp-server/steps/ReviewStep.js +2 -3
- package/mcp-server/steps/ReviewStep.js.map +1 -1
- package/package.json +4 -4
- package/resource-creation/templates/workflow-templates.js +4 -4
- package/session/useEditSessionPrep.js +3 -3
- package/session/useEditSessionPrep.js.map +1 -1
- package/settings/index.d.ts +2 -1
- package/settings/index.d.ts.map +1 -1
- package/settings/index.js +2 -1
- package/settings/index.js.map +1 -1
- package/settings/settings-nav.d.ts +22 -0
- package/settings/settings-nav.d.ts.map +1 -1
- package/settings/settings-nav.js +32 -1
- package/settings/settings-nav.js.map +1 -1
- package/settings/useSettingsNavGroups.d.ts +29 -0
- package/settings/useSettingsNavGroups.d.ts.map +1 -0
- package/settings/useSettingsNavGroups.js +61 -0
- package/settings/useSettingsNavGroups.js.map +1 -0
- package/src/agent/steps/ReviewStep.tsx +2 -3
- package/src/billing/BaselineEditor.tsx +619 -0
- package/src/billing/ModelCatalogPanel.tsx +283 -0
- package/src/billing/ModelGovernanceDetail.tsx +289 -0
- package/src/billing/OperatorAccessNotice.tsx +32 -0
- package/src/billing/PricingGovernanceConsole.tsx +465 -0
- package/src/billing/PricingGovernancePanel.tsx +166 -0
- package/src/billing/RetireConfirm.tsx +82 -0
- package/src/billing/__tests__/ModelCatalogPanel.test.tsx +253 -0
- package/src/billing/__tests__/PricingGovernanceConsole.test.tsx +410 -0
- package/src/billing/__tests__/useModelGovernanceView.test.tsx +308 -0
- package/src/billing/form-primitives.tsx +68 -0
- package/src/billing/governance-primitives.tsx +133 -0
- package/src/billing/index.ts +37 -0
- package/src/billing/pricing-format.ts +53 -0
- package/src/billing/useDecidePricingOverride.ts +78 -0
- package/src/billing/useModelGovernanceView.ts +290 -0
- package/src/billing/useModelPricingBaselines.ts +69 -0
- package/src/billing/usePricingGovernance.ts +57 -0
- package/src/billing/useRetireModelPricingBaseline.ts +65 -0
- package/src/billing/useUpsertModelPricingBaseline.ts +72 -0
- package/src/channel/AgentChannelsPanel.tsx +27 -1
- package/src/composer/SessionComposer.tsx +1 -1
- package/src/cursor-accounts/CursorAccountEditor.tsx +181 -0
- package/src/cursor-accounts/CursorAccountsAccessNotice.tsx +36 -0
- package/src/cursor-accounts/CursorAccountsConsole.tsx +810 -0
- package/src/cursor-accounts/__tests__/CursorAccountsConsole.test.tsx +384 -0
- package/src/cursor-accounts/cursor-account-format.ts +29 -0
- package/src/cursor-accounts/index.ts +29 -0
- package/src/cursor-accounts/useCursorAccountView.ts +49 -0
- package/src/cursor-accounts/useCursorAccounts.ts +49 -0
- package/src/cursor-accounts/useCursorMemberKeyActions.ts +106 -0
- package/src/cursor-accounts/useDeleteCursorAccount.ts +62 -0
- package/src/cursor-accounts/useSyncCursorAccount.ts +54 -0
- package/src/cursor-accounts/useUpsertCursorAccount.ts +57 -0
- package/src/datastore/CollectionRecordsBrowser.tsx +544 -0
- package/src/datastore/CollectionSchemaView.tsx +247 -0
- package/src/datastore/DatastoreDetailView.tsx +201 -0
- package/src/datastore/DatastoreSyncReport.tsx +105 -0
- package/src/datastore/DeleteDatastoreDialog.tsx +202 -0
- package/src/datastore/FieldValueControl.tsx +289 -0
- package/src/datastore/RecordFilterBuilder.tsx +411 -0
- package/src/datastore/RecordFormPanel.tsx +432 -0
- package/src/datastore/__tests__/CollectionRecordsBrowser.test.tsx +207 -0
- package/src/datastore/__tests__/DeleteDatastoreDialog.test.tsx +133 -0
- package/src/datastore/__tests__/FieldValueControl.test.tsx +160 -0
- package/src/datastore/__tests__/RecordFilterBuilder.test.tsx +141 -0
- package/src/datastore/__tests__/RecordFormPanel.test.tsx +227 -0
- package/src/datastore/__tests__/recordFilter.test.ts +156 -0
- package/src/datastore/__tests__/recordMutations.test.tsx +195 -0
- package/src/datastore/__tests__/recordValues.test.ts +359 -0
- package/src/datastore/__tests__/schemaAndSyncViews.test.tsx +142 -0
- package/src/datastore/__tests__/useDatastoreDescription.test.tsx +143 -0
- package/src/datastore/__tests__/useRecordCollection.test.tsx +250 -0
- package/src/datastore/__tests__/useRecordList.test.tsx +85 -0
- package/src/datastore/index.ts +111 -0
- package/src/datastore/recordFilter.ts +140 -0
- package/src/datastore/recordValues.ts +327 -0
- package/src/datastore/useDatastore.ts +67 -0
- package/src/datastore/useDatastoreCount.ts +67 -0
- package/src/datastore/useDatastoreDescription.ts +90 -0
- package/src/datastore/useDatastoreList.ts +79 -0
- package/src/datastore/useDatastoreSearch.ts +39 -0
- package/src/datastore/useDeleteDatastore.ts +87 -0
- package/src/datastore/useDeleteRecord.ts +77 -0
- package/src/datastore/useInsertRecord.ts +92 -0
- package/src/datastore/useRecordCollection.ts +256 -0
- package/src/datastore/useRecordList.ts +131 -0
- package/src/datastore/useUpdateRecord.ts +95 -0
- package/src/environment/EnvironmentListPanel.tsx +24 -0
- package/src/execution/__tests__/useArtifactInspection.test.tsx +12 -2
- package/src/iam-policy/__tests__/useCheckPermission.test.tsx +221 -0
- package/src/iam-policy/index.ts +1 -0
- package/src/iam-policy/useCheckPermission.ts +45 -19
- package/src/index.ts +163 -13
- package/src/library/index.ts +0 -20
- package/src/library/useApplyResource.ts +27 -34
- package/src/library/useExportResource.ts +21 -40
- package/src/manifest/ApplyManifestDialog.tsx +315 -0
- package/src/manifest/EditResourceYamlDialog.tsx +265 -0
- package/src/manifest/RedactedSecretsNotice.tsx +30 -0
- package/src/manifest/YamlEditor.tsx +272 -0
- package/src/manifest/__tests__/EditResourceYamlDialog.test.tsx +118 -0
- package/src/manifest/__tests__/useApplyManifest.test.tsx +237 -0
- package/src/manifest/__tests__/useEditResourceYaml.test.tsx +252 -0
- package/src/manifest/index.ts +33 -0
- package/src/manifest/useApplyManifest.ts +270 -0
- package/src/manifest/useEditResourceYaml.ts +273 -0
- package/src/mcp-server/steps/ReviewStep.tsx +2 -3
- package/src/resource-creation/templates/workflow-templates.ts +4 -4
- package/src/session/useEditSessionPrep.ts +3 -3
- package/src/settings/__tests__/useSettingsNavGroups.test.tsx +138 -0
- package/src/settings/index.ts +5 -1
- package/src/settings/settings-nav.ts +43 -0
- package/src/settings/useSettingsNavGroups.ts +81 -0
- package/src/workflow/WorkflowYamlEditor.tsx +6 -270
- package/styles.css +1 -1
- package/workflow/CanvasTransitionEdge.d.ts +1 -1
- package/workflow/WorkflowYamlEditor.d.ts +2 -42
- package/workflow/WorkflowYamlEditor.d.ts.map +1 -1
- package/workflow/WorkflowYamlEditor.js +5 -214
- package/workflow/WorkflowYamlEditor.js.map +1 -1
- package/library/ImportResourceDialog.d.ts +0 -43
- package/library/ImportResourceDialog.d.ts.map +0 -1
- package/library/ImportResourceDialog.js +0 -90
- package/library/ImportResourceDialog.js.map +0 -1
- package/library/parse-resource-yaml.d.ts +0 -63
- package/library/parse-resource-yaml.d.ts.map +0 -1
- package/library/parse-resource-yaml.js +0 -407
- package/library/parse-resource-yaml.js.map +0 -1
- package/library/serialize-resource-yaml.d.ts +0 -103
- package/library/serialize-resource-yaml.d.ts.map +0 -1
- package/library/serialize-resource-yaml.js +0 -565
- package/library/serialize-resource-yaml.js.map +0 -1
- package/library/useImportResource.d.ts +0 -84
- package/library/useImportResource.d.ts.map +0 -1
- package/library/useImportResource.js +0 -188
- package/library/useImportResource.js.map +0 -1
- package/src/library/ImportResourceDialog.tsx +0 -227
- package/src/library/parse-resource-yaml.ts +0 -630
- package/src/library/serialize-resource-yaml.ts +0 -756
- package/src/library/useImportResource.ts +0 -253
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import type { Datastore } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/api_pb";
|
|
5
|
+
import { useStigmer } from "../hooks.js";
|
|
6
|
+
import { toError } from "../internal/toError.js";
|
|
7
|
+
|
|
8
|
+
/** Arguments for {@link UseDeleteDatastoreReturn.deleteDatastore}. */
|
|
9
|
+
export interface DeleteDatastoreArgs {
|
|
10
|
+
/** Datastore resource id (`dst_…`). */
|
|
11
|
+
readonly resourceId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Acknowledgment that the datastore's records will be destroyed.
|
|
14
|
+
* Required for non-empty datastores (the server's GuardNonEmpty
|
|
15
|
+
* rejects without it, reporting record and collection counts);
|
|
16
|
+
* meaningless for empty ones. `DeleteDatastoreDialog` arms it only
|
|
17
|
+
* after the operator types the datastore slug.
|
|
18
|
+
*/
|
|
19
|
+
readonly force?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Return value of {@link useDeleteDatastore}. */
|
|
23
|
+
export interface UseDeleteDatastoreReturn {
|
|
24
|
+
/**
|
|
25
|
+
* Delete a datastore through its two server guards (DD-003), in
|
|
26
|
+
* order:
|
|
27
|
+
*
|
|
28
|
+
* 1. **Agent-reference block** — a datastore referenced by any
|
|
29
|
+
* agent's `datastore_usages` cannot be deleted, force or not; the
|
|
30
|
+
* `FAILED_PRECONDITION` names the referencing agents (detach
|
|
31
|
+
* first).
|
|
32
|
+
* 2. **Non-empty acknowledgment** — held records require `force`;
|
|
33
|
+
* without it the error reports current record/collection counts.
|
|
34
|
+
*
|
|
35
|
+
* Rejects — and sets `error` — when a guard refuses; the message is
|
|
36
|
+
* the server's authoritative text with fresh counts, so on drift the
|
|
37
|
+
* dialog re-renders the guard rather than pre-empting it (DD-008
|
|
38
|
+
* invariant 6).
|
|
39
|
+
*/
|
|
40
|
+
readonly deleteDatastore: (args: DeleteDatastoreArgs) => Promise<Datastore>;
|
|
41
|
+
/** `true` while the delete is in flight. */
|
|
42
|
+
readonly isDeleting: boolean;
|
|
43
|
+
/** Error from the last refused or failed delete, or `null` when healthy. */
|
|
44
|
+
readonly error: Error | null;
|
|
45
|
+
/** Reset `error` to `null`. */
|
|
46
|
+
readonly clearError: () => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Behavior hook for the platform's only record-destroying resource
|
|
51
|
+
* delete.
|
|
52
|
+
*
|
|
53
|
+
* Deliberately domain-local rather than a new arm in the generic
|
|
54
|
+
* `useDeleteResource` kind-switch: datastore deletion carries an
|
|
55
|
+
* acknowledgment protocol (`force`) and guard-error rendering that the
|
|
56
|
+
* generic one-shot delete contract must not absorb (DD-003 — extending
|
|
57
|
+
* it would leak record-destruction semantics platform-wide). No
|
|
58
|
+
* success/failure toasts here; `DeleteDatastoreDialog` owns the UX.
|
|
59
|
+
*/
|
|
60
|
+
export function useDeleteDatastore(): UseDeleteDatastoreReturn {
|
|
61
|
+
const stigmer = useStigmer();
|
|
62
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
63
|
+
const [error, setError] = useState<Error | null>(null);
|
|
64
|
+
|
|
65
|
+
const clearError = useCallback(() => setError(null), []);
|
|
66
|
+
|
|
67
|
+
const deleteDatastore = useCallback(
|
|
68
|
+
async (args: DeleteDatastoreArgs): Promise<Datastore> => {
|
|
69
|
+
setIsDeleting(true);
|
|
70
|
+
setError(null);
|
|
71
|
+
try {
|
|
72
|
+
return await stigmer.datastore.delete({
|
|
73
|
+
resourceId: args.resourceId,
|
|
74
|
+
force: args.force,
|
|
75
|
+
});
|
|
76
|
+
} catch (err) {
|
|
77
|
+
setError(toError(err));
|
|
78
|
+
throw err;
|
|
79
|
+
} finally {
|
|
80
|
+
setIsDeleting(false);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
[stigmer],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return { deleteDatastore, isDeleting, error, clearError };
|
|
87
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { create } from "@bufbuild/protobuf";
|
|
5
|
+
import {
|
|
6
|
+
DeleteRecordRequestSchema,
|
|
7
|
+
type RecordEnvelope,
|
|
8
|
+
} from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
|
|
9
|
+
import { useStigmer } from "../hooks.js";
|
|
10
|
+
import { toError } from "../internal/toError.js";
|
|
11
|
+
import type { RecordScope } from "./useRecordList.js";
|
|
12
|
+
|
|
13
|
+
/** Arguments for a single record delete. */
|
|
14
|
+
export interface DeleteRecordArgs extends RecordScope {
|
|
15
|
+
/** Record id (`dsr_…`). */
|
|
16
|
+
readonly id: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Return value of {@link useDeleteRecord}. */
|
|
20
|
+
export interface UseDeleteRecordReturn {
|
|
21
|
+
/**
|
|
22
|
+
* Delete one record by id. Resolves with the deleted record's final
|
|
23
|
+
* envelope (usable for an undo-by-reinsert growth path). Rejects —
|
|
24
|
+
* and sets `error` — on denial; the error's message is the server's
|
|
25
|
+
* relayable text, byte-for-byte.
|
|
26
|
+
*/
|
|
27
|
+
readonly deleteRecord: (args: DeleteRecordArgs) => Promise<RecordEnvelope>;
|
|
28
|
+
/** `true` while the delete is in flight. */
|
|
29
|
+
readonly isDeleting: boolean;
|
|
30
|
+
/** Error from the last failed delete, or `null` when healthy. */
|
|
31
|
+
readonly error: Error | null;
|
|
32
|
+
/** Reset `error` to `null`. */
|
|
33
|
+
readonly clearError: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Behavior hook that wraps `datastore.deleteRecord()` with loading and
|
|
38
|
+
* error state.
|
|
39
|
+
*
|
|
40
|
+
* Record deletes are id-addressed with a blast radius of one — the
|
|
41
|
+
* standard destructive confirm suffices (DD-008 SD-4). Deleting the
|
|
42
|
+
* datastore itself is a different, guarded operation: see
|
|
43
|
+
* {@link useDeleteDatastore}.
|
|
44
|
+
*/
|
|
45
|
+
export function useDeleteRecord(): UseDeleteRecordReturn {
|
|
46
|
+
const stigmer = useStigmer();
|
|
47
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
48
|
+
const [error, setError] = useState<Error | null>(null);
|
|
49
|
+
|
|
50
|
+
const clearError = useCallback(() => setError(null), []);
|
|
51
|
+
|
|
52
|
+
const deleteRecord = useCallback(
|
|
53
|
+
async (args: DeleteRecordArgs): Promise<RecordEnvelope> => {
|
|
54
|
+
setIsDeleting(true);
|
|
55
|
+
setError(null);
|
|
56
|
+
try {
|
|
57
|
+
return await stigmer.datastore.deleteRecord(
|
|
58
|
+
create(DeleteRecordRequestSchema, {
|
|
59
|
+
org: args.org,
|
|
60
|
+
datastore: args.datastore,
|
|
61
|
+
collection: args.collection,
|
|
62
|
+
partition: args.partition ?? "",
|
|
63
|
+
id: args.id,
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
setError(toError(err));
|
|
68
|
+
throw err;
|
|
69
|
+
} finally {
|
|
70
|
+
setIsDeleting(false);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[stigmer],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return { deleteRecord, isDeleting, error, clearError };
|
|
77
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { create, type JsonObject } from "@bufbuild/protobuf";
|
|
5
|
+
import {
|
|
6
|
+
InsertRecordRequestSchema,
|
|
7
|
+
type RecordEnvelope,
|
|
8
|
+
} from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
|
|
9
|
+
import { useStigmer } from "../hooks.js";
|
|
10
|
+
import { toError } from "../internal/toError.js";
|
|
11
|
+
import type { RecordScope } from "./useRecordList.js";
|
|
12
|
+
|
|
13
|
+
/** Arguments for a single record insert. */
|
|
14
|
+
export interface InsertRecordArgs extends RecordScope {
|
|
15
|
+
/**
|
|
16
|
+
* Declared field values in their canonical encodings (DD-004). System
|
|
17
|
+
* field names (`id`, `created_at`, …) are rejected by the server.
|
|
18
|
+
*/
|
|
19
|
+
readonly record: JsonObject;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Return value of {@link useInsertRecord}. */
|
|
23
|
+
export interface UseInsertRecordReturn {
|
|
24
|
+
/**
|
|
25
|
+
* Insert one record. Resolves with the server-stamped envelope (id,
|
|
26
|
+
* timestamps, attribution). Rejects — and sets `error` — on denial or
|
|
27
|
+
* constraint violation; the error's message is the server's relayable
|
|
28
|
+
* text, byte-for-byte (render it verbatim, DD-008 invariant 4).
|
|
29
|
+
*/
|
|
30
|
+
readonly insertRecord: (args: InsertRecordArgs) => Promise<RecordEnvelope>;
|
|
31
|
+
/** `true` while the insert is in flight. */
|
|
32
|
+
readonly isInserting: boolean;
|
|
33
|
+
/** Error from the last failed insert, or `null` when healthy. */
|
|
34
|
+
readonly error: Error | null;
|
|
35
|
+
/** Reset `error` to `null`. */
|
|
36
|
+
readonly clearError: () => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Behavior hook that wraps `datastore.insertRecord()` with loading and
|
|
41
|
+
* error state.
|
|
42
|
+
*
|
|
43
|
+
* Constraint violations (`ALREADY_EXISTS` for uniques,
|
|
44
|
+
* `FAILED_PRECONDITION` for checks) carry the constraint's declared
|
|
45
|
+
* message plus a `google.rpc.ErrorInfo` naming the constraint — use
|
|
46
|
+
* `getRecordConstraint` from `@stigmer/sdk` to place the message next
|
|
47
|
+
* to the fields it covers.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* const { insertRecord, isInserting, error } = useInsertRecord();
|
|
52
|
+
* await insertRecord({
|
|
53
|
+
* org: "acme",
|
|
54
|
+
* datastore: "clinic",
|
|
55
|
+
* collection: "bookings",
|
|
56
|
+
* record: { slot_date: "2026-07-22", slot_time: "09:30:00" },
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export function useInsertRecord(): UseInsertRecordReturn {
|
|
61
|
+
const stigmer = useStigmer();
|
|
62
|
+
const [isInserting, setIsInserting] = useState(false);
|
|
63
|
+
const [error, setError] = useState<Error | null>(null);
|
|
64
|
+
|
|
65
|
+
const clearError = useCallback(() => setError(null), []);
|
|
66
|
+
|
|
67
|
+
const insertRecord = useCallback(
|
|
68
|
+
async (args: InsertRecordArgs): Promise<RecordEnvelope> => {
|
|
69
|
+
setIsInserting(true);
|
|
70
|
+
setError(null);
|
|
71
|
+
try {
|
|
72
|
+
return await stigmer.datastore.insertRecord(
|
|
73
|
+
create(InsertRecordRequestSchema, {
|
|
74
|
+
org: args.org,
|
|
75
|
+
datastore: args.datastore,
|
|
76
|
+
collection: args.collection,
|
|
77
|
+
partition: args.partition ?? "",
|
|
78
|
+
record: args.record,
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
81
|
+
} catch (err) {
|
|
82
|
+
setError(toError(err));
|
|
83
|
+
throw err;
|
|
84
|
+
} finally {
|
|
85
|
+
setIsInserting(false);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[stigmer],
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return { insertRecord, isInserting, error, clearError };
|
|
92
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
4
|
+
import {
|
|
5
|
+
getCoreRowModel,
|
|
6
|
+
useReactTable,
|
|
7
|
+
type ColumnDef,
|
|
8
|
+
type SortingState,
|
|
9
|
+
type Table,
|
|
10
|
+
} from "@tanstack/react-table";
|
|
11
|
+
import { create, toJsonString } from "@bufbuild/protobuf";
|
|
12
|
+
import {
|
|
13
|
+
FindRecordsRequestSchema,
|
|
14
|
+
RecordFilterSchema,
|
|
15
|
+
RecordOrderBySchema,
|
|
16
|
+
RecordSortDirection,
|
|
17
|
+
type RecordEnvelope,
|
|
18
|
+
type RecordFilter,
|
|
19
|
+
} from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
|
|
20
|
+
import { useStigmer } from "../hooks.js";
|
|
21
|
+
import { useFetch } from "../internal/useFetch.js";
|
|
22
|
+
import type { SortDirection, SortValue, WorkbenchColumnDef } from "../resource-workbench/types.js";
|
|
23
|
+
|
|
24
|
+
/** Column definition for the records grid — a row is a {@link RecordEnvelope}. */
|
|
25
|
+
export type RecordColumnDef = WorkbenchColumnDef<RecordEnvelope>;
|
|
26
|
+
|
|
27
|
+
/** Options for {@link useRecordCollection}. */
|
|
28
|
+
export interface UseRecordCollectionOptions {
|
|
29
|
+
/** Organization slug. Pass `null` to disable fetching. */
|
|
30
|
+
readonly org: string | null;
|
|
31
|
+
/** Datastore slug. Pass `null` to disable fetching. */
|
|
32
|
+
readonly datastore: string | null;
|
|
33
|
+
/** Collection name. Pass `null` to disable fetching. */
|
|
34
|
+
readonly collection: string | null;
|
|
35
|
+
/** Data partition. Empty or omitted means `"default"` (DD-010). */
|
|
36
|
+
readonly partition?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Typed AND-only filter in the proto shape (DD-005 grammar). The hook
|
|
39
|
+
* adds no grammar — anything expressible here is exactly what
|
|
40
|
+
* `findRecords` serves (DD-008 invariant 1).
|
|
41
|
+
*/
|
|
42
|
+
readonly filter?: RecordFilter;
|
|
43
|
+
/** Current page number (1-indexed). @default 1 */
|
|
44
|
+
readonly page?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Page size, 1–100 (the RPC max — one surface, one limit).
|
|
47
|
+
* @default 25 (the RPC default)
|
|
48
|
+
*/
|
|
49
|
+
readonly pageSize?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Active sort: `id` is a sortable field name (declared non-json
|
|
52
|
+
* field, or system `id`/`created_at`/`updated_at`). `null` keeps the
|
|
53
|
+
* server default (`created_at` desc, `id` tiebreak).
|
|
54
|
+
*/
|
|
55
|
+
readonly sort?: SortValue | null;
|
|
56
|
+
/** Called when the user changes the sort via a column header click. */
|
|
57
|
+
readonly onSortChange?: (sort: SortValue | null) => void;
|
|
58
|
+
/** Column definitions for the grid, converted to TanStack columns internally. */
|
|
59
|
+
readonly columns?: readonly RecordColumnDef[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Return value of {@link useRecordCollection}. */
|
|
63
|
+
export interface UseRecordCollectionReturn {
|
|
64
|
+
/** Records in the current page. */
|
|
65
|
+
readonly records: readonly RecordEnvelope[];
|
|
66
|
+
/** Total records matching the filter (across all pages). */
|
|
67
|
+
readonly total: number;
|
|
68
|
+
/** Total number of pages at the current page size. */
|
|
69
|
+
readonly totalPages: number;
|
|
70
|
+
/** The current page number (mirrors input). */
|
|
71
|
+
readonly currentPage: number;
|
|
72
|
+
/** `true` during the initial fetch (no data yet). */
|
|
73
|
+
readonly isLoading: boolean;
|
|
74
|
+
/** `true` during a background refetch while stale data is shown. */
|
|
75
|
+
readonly isRefetching: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Error from the last failed fetch, or `null`. A record-layer
|
|
78
|
+
* `PERMISSION_DENIED` lands here carrying the server's relayable
|
|
79
|
+
* message verbatim — render it as the denied panel, never a silently
|
|
80
|
+
* empty grid (DD-008 SD-3).
|
|
81
|
+
*/
|
|
82
|
+
readonly error: Error | null;
|
|
83
|
+
/** Imperatively trigger a refetch (e.g. after a record write). */
|
|
84
|
+
readonly refetch: () => void;
|
|
85
|
+
/**
|
|
86
|
+
* The TanStack Table instance for `ResourceTable` (or custom
|
|
87
|
+
* renderers). `null` when no columns are provided.
|
|
88
|
+
*/
|
|
89
|
+
readonly table: Table<RecordEnvelope> | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const DEFAULT_PAGE_SIZE = 25;
|
|
93
|
+
const MAX_PAGE_SIZE = 100;
|
|
94
|
+
|
|
95
|
+
interface RecordCollectionData {
|
|
96
|
+
readonly records: readonly RecordEnvelope[];
|
|
97
|
+
readonly total: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const INITIAL_DATA: RecordCollectionData = { records: [], total: 0 };
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Headless hook that manages records-grid state: `findRecords` fetching,
|
|
104
|
+
* server-side sort, and RPC limit/offset pagination.
|
|
105
|
+
*
|
|
106
|
+
* The deliberate sibling of `useResourceCollection` (DD-008 SD-2):
|
|
107
|
+
* same headless shape — `useFetch` underneath, TanStack table with
|
|
108
|
+
* `manualPagination`/`manualSorting`, controlled sort via
|
|
109
|
+
* `sort`/`onSortChange` — but the record data contract, which the
|
|
110
|
+
* resource collection structurally cannot carry (its fetch path is
|
|
111
|
+
* hardcoded to `ListParams`/`SearchResult`). Mirrored, not retrofitted,
|
|
112
|
+
* so the SDK stays learnable; the produced table feeds the same
|
|
113
|
+
* presentational `ResourceTable`.
|
|
114
|
+
*
|
|
115
|
+
* Everything is server-side: filtering (the typed proto filter),
|
|
116
|
+
* sorting (single-field `order_by`), and pagination (limit/offset,
|
|
117
|
+
* default 25, max 100). The hook performs no client-side filtering or
|
|
118
|
+
* sorting — one query surface (DD-008 invariant 1).
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* const collection = useRecordCollection({
|
|
123
|
+
* org: "acme",
|
|
124
|
+
* datastore: "clinic",
|
|
125
|
+
* collection: "bookings",
|
|
126
|
+
* partition,
|
|
127
|
+
* filter,
|
|
128
|
+
* page,
|
|
129
|
+
* sort,
|
|
130
|
+
* onSortChange: setSort,
|
|
131
|
+
* columns: recordColumns,
|
|
132
|
+
* });
|
|
133
|
+
* return <ResourceTable table={collection.table} />;
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export function useRecordCollection(
|
|
137
|
+
options: UseRecordCollectionOptions,
|
|
138
|
+
): UseRecordCollectionReturn {
|
|
139
|
+
const {
|
|
140
|
+
org,
|
|
141
|
+
datastore,
|
|
142
|
+
collection,
|
|
143
|
+
partition = "",
|
|
144
|
+
filter,
|
|
145
|
+
page = 1,
|
|
146
|
+
pageSize = DEFAULT_PAGE_SIZE,
|
|
147
|
+
sort = null,
|
|
148
|
+
onSortChange,
|
|
149
|
+
columns = [],
|
|
150
|
+
} = options;
|
|
151
|
+
|
|
152
|
+
const stigmer = useStigmer();
|
|
153
|
+
|
|
154
|
+
const limit = Math.min(Math.max(pageSize, 1), MAX_PAGE_SIZE);
|
|
155
|
+
const offset = (Math.max(page, 1) - 1) * limit;
|
|
156
|
+
|
|
157
|
+
// Proto messages are typically rebuilt each render; serialized JSON is
|
|
158
|
+
// the stable identity for dependency comparison.
|
|
159
|
+
const filterKey = filter ? toJsonString(RecordFilterSchema, filter) : "";
|
|
160
|
+
|
|
161
|
+
const orderBy = useMemo(() => {
|
|
162
|
+
if (!sort) return undefined;
|
|
163
|
+
return create(RecordOrderBySchema, {
|
|
164
|
+
field: sort.id,
|
|
165
|
+
direction: sort.direction === "desc" ? RecordSortDirection.desc : RecordSortDirection.asc,
|
|
166
|
+
});
|
|
167
|
+
}, [sort]);
|
|
168
|
+
const orderByKey = orderBy ? toJsonString(RecordOrderBySchema, orderBy) : "";
|
|
169
|
+
|
|
170
|
+
// --- Data fetching via useFetch -----------------------------------------
|
|
171
|
+
const { data, isLoading, isRefetching, error, refetch } = useFetch<RecordCollectionData>(
|
|
172
|
+
org && datastore && collection
|
|
173
|
+
? async () => {
|
|
174
|
+
const result = await stigmer.datastore.findRecords(
|
|
175
|
+
create(FindRecordsRequestSchema, {
|
|
176
|
+
org,
|
|
177
|
+
datastore,
|
|
178
|
+
collection,
|
|
179
|
+
partition,
|
|
180
|
+
filter,
|
|
181
|
+
orderBy,
|
|
182
|
+
limit,
|
|
183
|
+
offset,
|
|
184
|
+
}),
|
|
185
|
+
);
|
|
186
|
+
return { records: result.records, total: result.total };
|
|
187
|
+
}
|
|
188
|
+
: null,
|
|
189
|
+
[org, datastore, collection, partition, filterKey, orderByKey, limit, offset, stigmer],
|
|
190
|
+
INITIAL_DATA,
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
// --- TanStack Table sorting bridge --------------------------------------
|
|
194
|
+
const sortingState: SortingState = useMemo(() => {
|
|
195
|
+
if (!sort) return [];
|
|
196
|
+
return [{ id: sort.id, desc: sort.direction === "desc" }];
|
|
197
|
+
}, [sort]);
|
|
198
|
+
|
|
199
|
+
const onSortChangeRef = useRef(onSortChange);
|
|
200
|
+
onSortChangeRef.current = onSortChange;
|
|
201
|
+
|
|
202
|
+
const handleSortingChange = useCallback(
|
|
203
|
+
(updater: SortingState | ((prev: SortingState) => SortingState)) => {
|
|
204
|
+
const next = typeof updater === "function" ? updater(sortingState) : updater;
|
|
205
|
+
if (next.length === 0) {
|
|
206
|
+
onSortChangeRef.current?.(null);
|
|
207
|
+
} else {
|
|
208
|
+
const col = next[0];
|
|
209
|
+
onSortChangeRef.current?.({
|
|
210
|
+
id: col.id,
|
|
211
|
+
direction: (col.desc ? "desc" : "asc") as SortDirection,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
[sortingState],
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
// --- TanStack Table column conversion -----------------------------------
|
|
219
|
+
const tanstackColumns = useMemo<ColumnDef<RecordEnvelope, unknown>[]>(() => {
|
|
220
|
+
return columns.map((col) => ({
|
|
221
|
+
id: col.id,
|
|
222
|
+
header: col.header,
|
|
223
|
+
cell: (info) => col.cell(info.row.original),
|
|
224
|
+
enableSorting: col.sortable ?? false,
|
|
225
|
+
size: col.minWidth,
|
|
226
|
+
minSize: col.minWidth,
|
|
227
|
+
}));
|
|
228
|
+
}, [columns]);
|
|
229
|
+
|
|
230
|
+
// --- TanStack Table instance -------------------------------------------
|
|
231
|
+
// No getSortedRowModel: sorting is entirely server-side (manualSorting)
|
|
232
|
+
// and the page arrives in server order — a client sort model would be
|
|
233
|
+
// dead code implying a second sorting authority.
|
|
234
|
+
const table = useReactTable<RecordEnvelope>({
|
|
235
|
+
data: data.records as RecordEnvelope[],
|
|
236
|
+
columns: tanstackColumns,
|
|
237
|
+
state: { sorting: sortingState },
|
|
238
|
+
onSortingChange: handleSortingChange,
|
|
239
|
+
getCoreRowModel: getCoreRowModel(),
|
|
240
|
+
getRowId: (row) => row.id,
|
|
241
|
+
manualPagination: true,
|
|
242
|
+
manualSorting: true,
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
return {
|
|
246
|
+
records: data.records,
|
|
247
|
+
total: data.total,
|
|
248
|
+
totalPages: Math.ceil(data.total / limit),
|
|
249
|
+
currentPage: page,
|
|
250
|
+
isLoading,
|
|
251
|
+
isRefetching,
|
|
252
|
+
error,
|
|
253
|
+
refetch,
|
|
254
|
+
table: tanstackColumns.length > 0 ? table : null,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { create, toJsonString } from "@bufbuild/protobuf";
|
|
4
|
+
import {
|
|
5
|
+
FindRecordsRequestSchema,
|
|
6
|
+
RecordFilterSchema,
|
|
7
|
+
RecordOrderBySchema,
|
|
8
|
+
type RecordEnvelope,
|
|
9
|
+
type RecordFilter,
|
|
10
|
+
type RecordOrderBy,
|
|
11
|
+
} from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
|
|
12
|
+
import { useStigmer } from "../hooks.js";
|
|
13
|
+
import { useFetch } from "../internal/useFetch.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Addressing shared by every record read/write: which datastore, which
|
|
17
|
+
* collection, and which data partition (DD-010 — every record operation
|
|
18
|
+
* is partition-scoped; empty means the `"default"` partition).
|
|
19
|
+
*/
|
|
20
|
+
export interface RecordScope {
|
|
21
|
+
/** Organization slug. Required for cloud direct callers; OSS defaults it. */
|
|
22
|
+
readonly org: string;
|
|
23
|
+
/** Datastore slug. */
|
|
24
|
+
readonly datastore: string;
|
|
25
|
+
/** Collection name. */
|
|
26
|
+
readonly collection: string;
|
|
27
|
+
/** Data partition. Empty or omitted means `"default"`. */
|
|
28
|
+
readonly partition?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Query parameters for {@link useRecordList}. */
|
|
32
|
+
export interface UseRecordListParams extends RecordScope {
|
|
33
|
+
/**
|
|
34
|
+
* Typed AND-only filter in the proto shape (DD-005 grammar). The hook
|
|
35
|
+
* adds no grammar of its own — anything expressible here is exactly
|
|
36
|
+
* what `findRecords` serves.
|
|
37
|
+
*/
|
|
38
|
+
readonly filter?: RecordFilter;
|
|
39
|
+
/** Sort directive. Omitted keeps the default: `created_at` desc, `id` tiebreak. */
|
|
40
|
+
readonly orderBy?: RecordOrderBy;
|
|
41
|
+
/** Page size, 1–100. Zero or omitted applies the RPC default of 25. */
|
|
42
|
+
readonly limit?: number;
|
|
43
|
+
/** Row offset for pagination. */
|
|
44
|
+
readonly offset?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Return value of {@link useRecordList}. */
|
|
48
|
+
export interface UseRecordListReturn {
|
|
49
|
+
/** Records in the current page. */
|
|
50
|
+
readonly records: readonly RecordEnvelope[];
|
|
51
|
+
/** Total records matching the filter (across all pages). */
|
|
52
|
+
readonly total: number;
|
|
53
|
+
/** `true` while the initial fetch is in flight. */
|
|
54
|
+
readonly isLoading: boolean;
|
|
55
|
+
/** `true` while a background refetch is in flight. */
|
|
56
|
+
readonly isRefetching: boolean;
|
|
57
|
+
/** Error from the last failed request, or `null` when healthy. */
|
|
58
|
+
readonly error: Error | null;
|
|
59
|
+
/** Discard cached data and re-fetch the current page from the server. */
|
|
60
|
+
readonly refetch: () => void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface RecordListData {
|
|
64
|
+
readonly records: readonly RecordEnvelope[];
|
|
65
|
+
readonly total: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const INITIAL_DATA: RecordListData = { records: [], total: 0 };
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Data hook that fetches a page of records via `findRecords` — the one
|
|
72
|
+
* query surface (DD-008 invariant 1): server-side filtering with the
|
|
73
|
+
* DD-005 grammar, RPC limit/offset pagination, no client-side
|
|
74
|
+
* filtering.
|
|
75
|
+
*
|
|
76
|
+
* A record-layer `PERMISSION_DENIED` (caller holds no read grant on the
|
|
77
|
+
* collection) surfaces as `error` carrying the server's relayable
|
|
78
|
+
* message verbatim; consumers render it as the denied panel, never a
|
|
79
|
+
* silently empty grid.
|
|
80
|
+
*
|
|
81
|
+
* Pass `null` to skip fetching (stable no-op) — e.g. while the
|
|
82
|
+
* collection is not yet selected.
|
|
83
|
+
*
|
|
84
|
+
* For the full grid experience (TanStack table, sort bridge, page
|
|
85
|
+
* state), use {@link useRecordCollection}, which builds on the same
|
|
86
|
+
* RPC.
|
|
87
|
+
*/
|
|
88
|
+
export function useRecordList(
|
|
89
|
+
params: UseRecordListParams | null,
|
|
90
|
+
): UseRecordListReturn {
|
|
91
|
+
const stigmer = useStigmer();
|
|
92
|
+
|
|
93
|
+
// Proto messages are typically rebuilt each render; serialized JSON is
|
|
94
|
+
// the stable identity for dependency comparison.
|
|
95
|
+
const filterKey = params?.filter ? toJsonString(RecordFilterSchema, params.filter) : "";
|
|
96
|
+
const orderByKey = params?.orderBy ? toJsonString(RecordOrderBySchema, params.orderBy) : "";
|
|
97
|
+
|
|
98
|
+
const { data, isLoading, isRefetching, error, refetch } = useFetch<RecordListData>(
|
|
99
|
+
params
|
|
100
|
+
? async () => {
|
|
101
|
+
const result = await stigmer.datastore.findRecords(
|
|
102
|
+
create(FindRecordsRequestSchema, {
|
|
103
|
+
org: params.org,
|
|
104
|
+
datastore: params.datastore,
|
|
105
|
+
collection: params.collection,
|
|
106
|
+
partition: params.partition ?? "",
|
|
107
|
+
filter: params.filter,
|
|
108
|
+
orderBy: params.orderBy,
|
|
109
|
+
limit: params.limit ?? 0,
|
|
110
|
+
offset: params.offset ?? 0,
|
|
111
|
+
}),
|
|
112
|
+
);
|
|
113
|
+
return { records: result.records, total: result.total };
|
|
114
|
+
}
|
|
115
|
+
: null,
|
|
116
|
+
[
|
|
117
|
+
params?.org,
|
|
118
|
+
params?.datastore,
|
|
119
|
+
params?.collection,
|
|
120
|
+
params?.partition,
|
|
121
|
+
filterKey,
|
|
122
|
+
orderByKey,
|
|
123
|
+
params?.limit,
|
|
124
|
+
params?.offset,
|
|
125
|
+
stigmer,
|
|
126
|
+
],
|
|
127
|
+
INITIAL_DATA,
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return { records: data.records, total: data.total, isLoading, isRefetching, error, refetch };
|
|
131
|
+
}
|