@undefineds.co/xpod 0.4.10 → 0.4.12
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/config/components-ignore.json +5 -1
- package/config/notifications.json +68 -0
- package/config/xpod.base.json +9 -11
- package/dist/ai/service/AiCredentialSecret.d.ts +30 -0
- package/dist/ai/service/AiCredentialSecret.js +120 -0
- package/dist/ai/service/CredentialReaderImpl.d.ts +18 -0
- package/dist/ai/service/CredentialReaderImpl.js +81 -5
- package/dist/ai/service/CredentialReaderImpl.jsonld +42 -2
- package/dist/ai/service/EmbeddingModelPolicy.d.ts +79 -0
- package/dist/ai/service/EmbeddingModelPolicy.js +134 -0
- package/dist/ai/service/EmbeddingProviderError.js +6 -0
- package/dist/ai/service/EmbeddingServiceImpl.d.ts +13 -1
- package/dist/ai/service/EmbeddingServiceImpl.js +18 -5
- package/dist/ai/service/EmbeddingServiceImpl.jsonld +35 -0
- package/dist/ai/service/index.d.ts +2 -0
- package/dist/ai/service/index.js +2 -0
- package/dist/api/ai-gateway/connect/index.d.ts +20 -2
- package/dist/api/ai-gateway/connect/index.js +162 -16
- package/dist/api/ai-gateway/credentials/AiCredentialSecretDecoder.d.ts +12 -0
- package/dist/api/ai-gateway/credentials/AiCredentialSecretDecoder.js +30 -0
- package/dist/api/ai-gateway/errors.d.ts +1 -1
- package/dist/api/ai-gateway/models/GatewayEmbeddingModelCatalog.d.ts +11 -0
- package/dist/api/ai-gateway/models/GatewayEmbeddingModelCatalog.js +31 -0
- package/dist/api/ai-gateway/models/PodModelSelectionRepository.js +7 -3
- package/dist/api/ai-gateway/models/ProviderCustomModelsService.d.ts +18 -0
- package/dist/api/ai-gateway/models/ProviderCustomModelsService.js +23 -0
- package/dist/api/ai-gateway/models/ProviderModelDiscoveryAdapters.d.ts +3 -1
- package/dist/api/ai-gateway/models/ProviderModelDiscoveryAdapters.js +2 -45
- package/dist/api/ai-gateway/models/ProviderModelSelectionService.d.ts +10 -0
- package/dist/api/ai-gateway/models/ProviderModelSelectionService.js +57 -20
- package/dist/api/ai-gateway/models/ProviderModelType.d.ts +28 -0
- package/dist/api/ai-gateway/models/ProviderModelType.js +34 -0
- package/dist/api/ai-gateway/models/ProviderModelsAdapter.d.ts +10 -0
- package/dist/api/ai-gateway/models/ProviderModelsAdapter.js +3 -4
- package/dist/api/ai-gateway/models/index.d.ts +1 -0
- package/dist/api/ai-gateway/models/index.js +3 -1
- package/dist/api/ai-gateway/providers/CustomRuntimeAdapter.d.ts +7 -0
- package/dist/api/ai-gateway/providers/CustomRuntimeAdapter.js +9 -2
- package/dist/api/ai-gateway/providers/ModelsDevCatalog.d.ts +7 -1
- package/dist/api/ai-gateway/providers/ModelsDevCatalog.js +4 -10
- package/dist/api/ai-gateway/providers/ProviderRegistry.d.ts +107 -0
- package/dist/api/ai-gateway/providers/ProviderRegistry.js +244 -21
- package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.d.ts +5 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.js +5 -1
- package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.d.ts +12 -4
- package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.js +11 -11
- package/dist/api/ai-gateway/routing/ModelRouter.d.ts +14 -0
- package/dist/api/ai-gateway/routing/ModelRouter.js +43 -4
- package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.d.ts +9 -1
- package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.js +3 -27
- package/dist/api/auth/ClientCredentialsAuthenticator.d.ts +0 -1
- package/dist/api/auth/ClientCredentialsAuthenticator.js +0 -3
- package/dist/api/auth/index.d.ts +1 -0
- package/dist/api/auth/index.js +1 -1
- package/dist/api/chatkit/pod-store.d.ts +31 -0
- package/dist/api/chatkit/pod-store.js +132 -8
- package/dist/api/container/common.js +24 -4
- package/dist/api/container/routes.js +17 -2
- package/dist/api/container/types.d.ts +3 -1
- package/dist/api/handlers/AdminHandler.d.ts +13 -0
- package/dist/api/handlers/AdminHandler.js +47 -18
- package/dist/api/handlers/AiConfigHandler.d.ts +6 -0
- package/dist/api/handlers/AiConfigHandler.js +28 -0
- package/dist/api/handlers/AiGatewayManagementHandler.js +36 -0
- package/dist/api/runs/RdfRunContextRetriever.d.ts +14 -0
- package/dist/api/runs/RdfRunContextRetriever.js +41 -5
- package/dist/api/runtime.js +2 -1
- package/dist/cli/commands/secret.d.ts +1 -0
- package/dist/cli/commands/secret.js +25 -7
- package/dist/components/components.jsonld +3 -1
- package/dist/components/context.jsonld +53 -1
- package/dist/http/SubgraphSparqlHttpHandler.d.ts +59 -2
- package/dist/http/SubgraphSparqlHttpHandler.js +145 -13
- package/dist/http/SubgraphSparqlHttpHandler.jsonld +37 -0
- package/dist/identity/drizzle/AccountRoleRepository.d.ts +30 -2
- package/dist/identity/drizzle/AccountRoleRepository.js +163 -15
- package/dist/identity/drizzle/EdgeNodeRepository.d.ts +0 -12
- package/dist/identity/drizzle/EdgeNodeRepository.js +5 -13
- package/dist/identity/drizzle/PodLookupRepository.d.ts +58 -4
- package/dist/identity/drizzle/PodLookupRepository.js +248 -105
- package/dist/identity/drizzle/db.d.ts +19 -0
- package/dist/identity/drizzle/db.js +39 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -3
- package/dist/logging/log-file.d.ts +17 -0
- package/dist/logging/log-file.js +69 -0
- package/dist/main.js +2 -1
- package/dist/notifications/NotificationChannelSweeper.d.ts +50 -0
- package/dist/notifications/NotificationChannelSweeper.js +131 -0
- package/dist/notifications/NotificationChannelSweeper.jsonld +136 -0
- package/dist/notifications/ReclaimingWebSocket2023Storer.d.ts +25 -0
- package/dist/notifications/ReclaimingWebSocket2023Storer.js +56 -0
- package/dist/notifications/ReclaimingWebSocket2023Storer.jsonld +77 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +2 -0
- package/dist/runtime/Proxy.d.ts +37 -0
- package/dist/runtime/Proxy.js +88 -16
- package/dist/runtime/bootstrap.js +2 -1
- package/dist/runtime/upgrade/BunNativeUpgradeRelay.d.ts +116 -0
- package/dist/runtime/upgrade/BunNativeUpgradeRelay.js +423 -0
- package/dist/runtime/upgrade/UpgradeHandshake.d.ts +63 -0
- package/dist/runtime/upgrade/UpgradeHandshake.js +199 -0
- package/dist/runtime/upgrade/WebSocketFrames.d.ts +67 -0
- package/dist/runtime/upgrade/WebSocketFrames.js +224 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.js +8 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.d.ts +11 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.js +27 -10
- package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.d.ts +7 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +13 -11
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.js +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsList.js +10 -6
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.d.ts +15 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.js +29 -3
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMainHeader.js +18 -3
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +16 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +92 -20
- package/node_modules/@undefineds.co/ai-connections/dist/AiCopyButton.d.ts +35 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiCopyButton.js +45 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.js +71 -11
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialRow.js +9 -7
- package/node_modules/@undefineds.co/ai-connections/dist/AiEndpointList.d.ts +23 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiEndpointList.js +24 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +13 -4
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +35 -38
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.d.ts +21 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.js +51 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiInfoTooltip.d.ts +15 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiInfoTooltip.js +16 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiModelCatalog.d.ts +175 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiModelCatalog.js +133 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.js +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.js +13 -64
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.d.ts +21 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.js +12 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiRowAction.d.ts +15 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiRowAction.js +12 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.js +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.d.ts +7 -0
- package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.js +6 -0
- package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.d.ts +36 -5
- package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.js +52 -9
- package/node_modules/@undefineds.co/ai-connections/dist/client/normalize.js +30 -3
- package/node_modules/@undefineds.co/ai-connections/dist/client/types.d.ts +21 -1
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/base-adapter.d.ts +1 -3
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/base-adapter.js +3 -7
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/index.cjs +9 -7
- package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.d.ts +46 -0
- package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.js +231 -0
- package/node_modules/@undefineds.co/ai-connections/dist/collections.d.ts +119 -0
- package/node_modules/@undefineds.co/ai-connections/dist/collections.js +173 -0
- package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +71 -5
- package/node_modules/@undefineds.co/ai-connections/dist/controller.js +285 -16
- package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.d.ts +5 -0
- package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.js +8 -3
- package/node_modules/@undefineds.co/ai-connections/dist/credential-storage.d.ts +59 -0
- package/node_modules/@undefineds.co/ai-connections/dist/credential-storage.js +131 -0
- package/node_modules/@undefineds.co/ai-connections/dist/endpoint-urls.d.ts +15 -0
- package/node_modules/@undefineds.co/ai-connections/dist/endpoint-urls.js +20 -0
- package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.d.ts +14 -0
- package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.js +20 -0
- package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +8 -0
- package/node_modules/@undefineds.co/ai-connections/dist/index.js +8 -0
- package/node_modules/@undefineds.co/ai-connections/dist/manifest.js +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.d.ts +14 -0
- package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.js +17 -0
- package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.cjs +68 -1
- package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.d.ts +75 -1
- package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.js +119 -0
- package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.d.ts +5 -0
- package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.js +5 -0
- package/node_modules/@undefineds.co/ai-connections/dist/service-access.js +2 -27
- package/node_modules/@undefineds.co/ai-connections/package.json +1 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/manifest.d.ts +1 -1
- package/node_modules/@undefineds.co/extension-sdk/dist/manifest.js +2 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/web.d.ts +150 -0
- package/node_modules/@undefineds.co/extension-sdk/package.json +2 -1
- package/node_modules/@undefineds.co/models/README.md +1 -1
- package/node_modules/@undefineds.co/models/dist/ai-config/index.d.ts +3 -3
- package/node_modules/@undefineds.co/models/dist/ai-gateway.schema.d.ts +5 -0
- package/node_modules/@undefineds.co/models/dist/ai-gateway.schema.js +9 -0
- package/node_modules/@undefineds.co/models/dist/ai-runtime.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/approval.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/audit.presentation.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/capture.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/chat-project.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/chat.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/control-request.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/conversation-share.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/credential.schema.d.ts +12 -0
- package/node_modules/@undefineds.co/models/dist/credential.schema.js +15 -1
- package/node_modules/@undefineds.co/models/dist/discovery/index.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/discovery/providers.json +248 -7
- package/node_modules/@undefineds.co/models/dist/discovery/types.d.ts +31 -0
- package/node_modules/@undefineds.co/models/dist/extension/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/favorite/index.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/fixtures/contracts-chat-contact.d.ts +5 -5
- package/node_modules/@undefineds.co/models/dist/import/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/index.d.ts +73 -73
- package/node_modules/@undefineds.co/models/dist/index.js +1 -1
- package/node_modules/@undefineds.co/models/dist/input-request.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/knowledge/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/message.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/namespaces.js +5 -0
- package/node_modules/@undefineds.co/models/dist/pod-storage-descriptor.d.ts +4815 -26
- package/node_modules/@undefineds.co/models/dist/pod-storage-descriptor.js +482 -132
- package/node_modules/@undefineds.co/models/dist/schema.d.ts +4 -0
- package/node_modules/@undefineds.co/models/dist/session/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/settings/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/sidecar/persistence-mapping.d.ts +5 -5
- package/node_modules/@undefineds.co/models/dist/thread.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/types/message-block.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/vocab/_namespaces.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/vocab/index.d.ts +10 -10
- package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.d.ts +1 -0
- package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.js +1 -0
- package/node_modules/@undefineds.co/models/package.json +4 -2
- package/node_modules/@undefineds.co/pod-collections/README.md +71 -0
- package/node_modules/@undefineds.co/pod-collections/dist/diff.d.ts +85 -0
- package/node_modules/@undefineds.co/pod-collections/dist/diff.js +166 -0
- package/node_modules/@undefineds.co/pod-collections/dist/feed.d.ts +17 -0
- package/node_modules/@undefineds.co/pod-collections/dist/feed.js +27 -0
- package/node_modules/@undefineds.co/pod-collections/dist/index.cjs +1042 -0
- package/node_modules/@undefineds.co/pod-collections/dist/index.d.ts +37 -0
- package/node_modules/@undefineds.co/pod-collections/dist/index.js +89 -0
- package/node_modules/@undefineds.co/pod-collections/dist/layout.d.ts +75 -0
- package/node_modules/@undefineds.co/pod-collections/dist/layout.js +173 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mapping.d.ts +78 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mapping.js +287 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mutations.d.ts +83 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mutations.js +273 -0
- package/node_modules/@undefineds.co/pod-collections/dist/react.d.ts +21 -0
- package/node_modules/@undefineds.co/pod-collections/dist/react.js +22 -0
- package/node_modules/@undefineds.co/pod-collections/dist/read.d.ts +65 -0
- package/node_modules/@undefineds.co/pod-collections/dist/read.js +31 -0
- package/node_modules/@undefineds.co/pod-collections/dist/sync.d.ts +66 -0
- package/node_modules/@undefineds.co/pod-collections/dist/sync.js +260 -0
- package/node_modules/@undefineds.co/pod-collections/dist/types.d.ts +155 -0
- package/node_modules/@undefineds.co/pod-collections/dist/types.js +9 -0
- package/node_modules/@undefineds.co/pod-collections/package.json +42 -0
- package/node_modules/@undefineds.co/shared-ui/dist/index.d.ts +0 -1
- package/node_modules/@undefineds.co/shared-ui/dist/index.js +0 -1
- package/package.json +15 -7
- package/static/app/assets/main.css +1 -1
- package/static/app/assets/main.js +12 -13
- package/static/auth-callback/assets/AiConfigContext-DnQs1ZpW.js +1 -0
- package/static/auth-callback/assets/AiConfigPage-DOtvlxH0.js +1 -0
- package/static/auth-callback/assets/DocumentProcessingPanel-BS2voQgL.js +1 -0
- package/static/auth-callback/assets/IndexLifecyclePanel-Cvt0cJtN.js +1 -0
- package/static/auth-callback/assets/{IndexSubjectPanel-C4YG0whI.js → IndexSubjectPanel-Dhf01GqF.js} +1 -1
- package/static/auth-callback/assets/ModelAssignmentsPanel-BJutWaAF.js +1 -0
- package/static/auth-callback/assets/ModelsPage-BRS0sje3.js +11 -0
- package/static/auth-callback/assets/{NetworkPage-Cbdn_P1e.js → NetworkPage-B3qBfANA.js} +2 -2
- package/static/auth-callback/assets/{PaneListHeader-jy70Q00L.js → PaneListHeader-QQeJGTp4.js} +1 -1
- package/static/auth-callback/assets/SearchIndexingPanel-MyNUSEwT.js +1 -0
- package/static/auth-callback/assets/{StatusSubjectPanel-hfjoB5aS.js → StatusSubjectPanel-DQkEVsFs.js} +1 -1
- package/static/{settings/assets/StatusWorkspace-CKD_Rzdr.js → auth-callback/assets/StatusWorkspace-Dkv63Uwk.js} +1 -1
- package/static/auth-callback/assets/SystemSettingsPage-TIsUfX5d.js +1 -0
- package/static/auth-callback/assets/SystemSettingsSubjectPanel-BJWEt2-7.js +33 -0
- package/static/auth-callback/assets/XpodAiConnectionsPodStore-BJiXm-PF.js +3 -0
- package/static/auth-callback/assets/{activity-BcsZZxxw.js → activity-5hNeNKnL.js} +1 -1
- package/static/auth-callback/assets/admin-C6qCRFiY.js +1 -0
- package/static/auth-callback/assets/ai-connections-CryuHGKW.js +1 -0
- package/static/auth-callback/assets/{auth-callback-atKg_oig.js → auth-callback-CAFZ3R0B.js} +80 -84
- package/static/auth-callback/assets/auth-callback-rk080mvG.css +1 -0
- package/static/auth-callback/assets/{badge-BWbRHThQ.js → badge-CAIPI0CB.js} +1 -1
- package/static/auth-callback/assets/collection-runtime-D9s7h9YA.js +1 -0
- package/static/auth-callback/assets/dialog-BjA109aX.js +1 -0
- package/static/auth-callback/assets/{download-BmvG1Vya.js → download-B3Up5W2G.js} +1 -1
- package/static/auth-callback/assets/{external-link-DZ34d3g3.js → external-link-BTXgSPzB.js} +1 -1
- package/static/auth-callback/assets/index-BppXlxcp.js +41 -0
- package/static/auth-callback/assets/index-CirW4CJf.js +1 -0
- package/static/auth-callback/assets/index-DlLYWOhw.js +4 -0
- package/static/auth-callback/assets/{index-browser-B9Z7GU-T.js → index-browser-DtU38ni3.js} +1 -1
- package/static/auth-callback/assets/{key-round-tjP76Se-.js → key-round-CQCOrZ7x.js} +1 -1
- package/static/auth-callback/assets/layout-DB3pMyTl.js +1 -0
- package/static/auth-callback/assets/pod-collections-host-KnnGFZHL.js +8 -0
- package/static/auth-callback/assets/{rotate-ccw-C_L5ZLx1.js → rotate-ccw-C1zM2KtS.js} +1 -1
- package/static/auth-callback/assets/settings-projection-CUkyprDQ.js +1 -0
- package/static/auth-callback/assets/{skeleton-C7tGDQIs.js → skeleton-Cqp7_M9-.js} +1 -1
- package/static/auth-callback/assets/{waypoints-VMNQlWdU.js → waypoints-Bj6gAUSQ.js} +1 -1
- package/static/auth-callback/assets/{workspace-layout-SAp6BtYK.js → workspace-layout-DK8mDzrY.js} +1 -1
- package/static/auth-callback/auth-callback.html +2 -2
- package/static/dashboard/assets/AiConfigContext-BsE7MqX8.js +1 -0
- package/static/dashboard/assets/AiConfigPage-DvM-lRXa.js +1 -0
- package/static/dashboard/assets/DocumentProcessingPanel-BPfdlfuf.js +1 -0
- package/static/dashboard/assets/IndexLifecyclePanel--m0AGxvh.js +1 -0
- package/static/dashboard/assets/{IndexSubjectPanel-DQFPP6-p.js → IndexSubjectPanel-Bb7m1k3d.js} +1 -1
- package/static/dashboard/assets/ModelAssignmentsPanel-BLi_zbMa.js +1 -0
- package/static/dashboard/assets/ModelsPage-CxdpgnfR.js +11 -0
- package/static/dashboard/assets/{NetworkPage-CHQ3YxIB.js → NetworkPage-BAIPw-D_.js} +2 -2
- package/static/dashboard/assets/{PaneListHeader-DsXemAdR.js → PaneListHeader-BBCMei0r.js} +1 -1
- package/static/dashboard/assets/SearchIndexingPanel-Ck4Y-xjR.js +1 -0
- package/static/dashboard/assets/{StatusSubjectPanel-D3PGEYT4.js → StatusSubjectPanel-D1KWfAXE.js} +1 -1
- package/static/dashboard/assets/{StatusWorkspace-BcpePYUW.js → StatusWorkspace-JbA5gzXx.js} +1 -1
- package/static/dashboard/assets/SystemSettingsPage-BbwQWsSR.js +1 -0
- package/static/dashboard/assets/SystemSettingsSubjectPanel-N117nMt5.js +33 -0
- package/static/dashboard/assets/XpodAiConnectionsPodStore-CdDOb4SV.js +18 -0
- package/static/dashboard/assets/{activity-j5zrznu-.js → activity-DX1I96o_.js} +1 -1
- package/static/dashboard/assets/admin-C6qCRFiY.js +1 -0
- package/static/dashboard/assets/ai-connections-DwCRqOQa.js +1 -0
- package/static/dashboard/assets/{badge-CzeBdG7h.js → badge-k2vhtDqH.js} +1 -1
- package/static/dashboard/assets/collection-runtime-BFQ8teQJ.js +1 -0
- package/static/dashboard/assets/{dashboard-D-xANHk1.js → dashboard-DWZ-fmCT.js} +105 -109
- package/static/dashboard/assets/dashboard-rk080mvG.css +1 -0
- package/static/dashboard/assets/dialog-1CCw-iHT.js +1 -0
- package/static/dashboard/assets/{download-IcNdEZWi.js → download-C6-SNY1q.js} +1 -1
- package/static/dashboard/assets/{external-link-DxBxK8Vu.js → external-link-BgPcZ_j2.js} +1 -1
- package/static/dashboard/assets/index-6LcIUIYO.js +1 -0
- package/static/dashboard/assets/index-D7A8U6Pt.js +41 -0
- package/static/dashboard/assets/index-UD6QOE7H.js +4 -0
- package/static/dashboard/assets/{key-round-D1K7warM.js → key-round-BOd7Jo0Q.js} +1 -1
- package/static/dashboard/assets/layout-DB3pMyTl.js +1 -0
- package/static/dashboard/assets/pod-collections-host-KnnGFZHL.js +8 -0
- package/static/dashboard/assets/{rotate-ccw-CcN1N6p9.js → rotate-ccw-CCgJqsvx.js} +1 -1
- package/static/dashboard/assets/settings-projection-CUkyprDQ.js +1 -0
- package/static/dashboard/assets/{skeleton-CKnmJMUH.js → skeleton-Bc7abAn5.js} +1 -1
- package/static/dashboard/assets/{waypoints-DuZPO_wu.js → waypoints-s-opmJxx.js} +1 -1
- package/static/dashboard/assets/{workspace-layout-BUj3wZ_m.js → workspace-layout-DqIQeTBV.js} +1 -1
- package/static/dashboard/dashboard.html +2 -2
- package/static/settings/assets/AiConfigContext-BB9KZySa.js +1 -0
- package/static/settings/assets/AiConfigPage-DGSXUkLs.js +1 -0
- package/static/settings/assets/DocumentProcessingPanel-Da2Re6Rg.js +1 -0
- package/static/settings/assets/IndexLifecyclePanel-BSZuIzgr.js +1 -0
- package/static/settings/assets/{IndexSubjectPanel-73sM16Ma.js → IndexSubjectPanel-CFd0ay-r.js} +1 -1
- package/static/settings/assets/ModelAssignmentsPanel-CSAryvWJ.js +1 -0
- package/static/settings/assets/ModelsPage-BQwCwLHU.js +11 -0
- package/static/settings/assets/{NetworkPage-i6j-M2RY.js → NetworkPage-BKymvsQc.js} +2 -2
- package/static/settings/assets/{PaneListHeader-DpqC0jd5.js → PaneListHeader-Bjh3hRdQ.js} +1 -1
- package/static/settings/assets/SearchIndexingPanel-MjKL5QLU.js +1 -0
- package/static/settings/assets/{StatusSubjectPanel-Dv4q3PGh.js → StatusSubjectPanel-Bvl6K4mx.js} +1 -1
- package/static/settings/assets/StatusWorkspace-B0NzrP--.js +1 -0
- package/static/settings/assets/SystemSettingsPage-D2z6Z4FE.js +1 -0
- package/static/settings/assets/SystemSettingsSubjectPanel-4sxma4X4.js +33 -0
- package/static/settings/assets/XpodAiConnectionsPodStore-BkNQ8fZx.js +3 -0
- package/static/settings/assets/{activity-DaFkk8f3.js → activity-CgJJGpjx.js} +1 -1
- package/static/settings/assets/admin-C6qCRFiY.js +1 -0
- package/static/settings/assets/ai-connections-CryuHGKW.js +1 -0
- package/static/settings/assets/{badge-d5SHdc-x.js → badge-C4NypVyT.js} +1 -1
- package/static/settings/assets/collection-runtime-CTLCDxAi.js +1 -0
- package/static/settings/assets/dialog-Csq0vWUi.js +1 -0
- package/static/settings/assets/{download-CpkwomDr.js → download-DaLJJ-Wp.js} +1 -1
- package/static/settings/assets/{external-link-_4YT42Mf.js → external-link--w_iW5Au.js} +1 -1
- package/static/settings/assets/index-B0mQa59b.js +4 -0
- package/static/settings/assets/index-BukHiu4y.js +1 -0
- package/static/settings/assets/index-COmVnZi2.js +41 -0
- package/static/settings/assets/{index-browser-B06xjBdZ.js → index-browser-BGpvHwD0.js} +1 -1
- package/static/settings/assets/{key-round-Dlqmp1Kq.js → key-round-Bk4YRjBu.js} +1 -1
- package/static/settings/assets/layout-DB3pMyTl.js +1 -0
- package/static/settings/assets/pod-collections-host-KnnGFZHL.js +8 -0
- package/static/settings/assets/{rotate-ccw-TAY65xWT.js → rotate-ccw-TCabbqsr.js} +1 -1
- package/static/settings/assets/{settings-ExBXGgbj.js → settings-CJWpdbNC.js} +105 -109
- package/static/settings/assets/settings-projection-CUkyprDQ.js +1 -0
- package/static/settings/assets/settings-rk080mvG.css +1 -0
- package/static/settings/assets/{skeleton-DKIWjNr9.js → skeleton-JDHYVe7t.js} +1 -1
- package/static/settings/assets/{waypoints-9erLIxyR.js → waypoints-DDvEl-MU.js} +1 -1
- package/static/settings/assets/{workspace-layout-CYXfYIa3.js → workspace-layout-DV5QU30U.js} +1 -1
- package/static/settings/settings.html +2 -2
- package/node_modules/@undefineds.co/shared-ui/dist/oidc-consent.d.ts +0 -54
- package/node_modules/@undefineds.co/shared-ui/dist/oidc-consent.js +0 -21
- package/static/auth-callback/assets/AiConfigContext-C81deMM9.js +0 -1
- package/static/auth-callback/assets/AiConfigPage-evWI8T56.js +0 -1
- package/static/auth-callback/assets/DocumentProcessingPanel-B9GrDEMe.js +0 -1
- package/static/auth-callback/assets/IndexLifecyclePanel-qCo8ABQZ.js +0 -1
- package/static/auth-callback/assets/ModelAssignmentsPanel-DG7Lxh3t.js +0 -1
- package/static/auth-callback/assets/ModelsPage-CgEuqE6p.js +0 -10
- package/static/auth-callback/assets/SearchIndexingPanel-ByU3u7kp.js +0 -1
- package/static/auth-callback/assets/StatusWorkspace-BZd617sV.js +0 -1
- package/static/auth-callback/assets/SystemSettingsPage-BirzWAQM.js +0 -1
- package/static/auth-callback/assets/SystemSettingsSubjectPanel-CmsVWNCx.js +0 -31
- package/static/auth-callback/assets/admin-BU4m6Ko2.js +0 -1
- package/static/auth-callback/assets/ai-connections-CHNTKemd.js +0 -1
- package/static/auth-callback/assets/auth-callback-C_7MUXJb.css +0 -1
- package/static/auth-callback/assets/index-BpV1hsqs.js +0 -4
- package/static/auth-callback/assets/index-D9oE6FXK.js +0 -41
- package/static/dashboard/assets/AiConfigContext-De-OtAWo.js +0 -1
- package/static/dashboard/assets/AiConfigPage-macP4Mop.js +0 -1
- package/static/dashboard/assets/DocumentProcessingPanel-C5ObvCCl.js +0 -1
- package/static/dashboard/assets/IndexLifecyclePanel-xVNa2l40.js +0 -1
- package/static/dashboard/assets/ModelAssignmentsPanel-DMOATFpQ.js +0 -1
- package/static/dashboard/assets/ModelsPage-91UbnETA.js +0 -25
- package/static/dashboard/assets/SearchIndexingPanel-Dh70PNFZ.js +0 -1
- package/static/dashboard/assets/SystemSettingsPage-BiN5GcKx.js +0 -1
- package/static/dashboard/assets/SystemSettingsSubjectPanel-B9QrSiFp.js +0 -31
- package/static/dashboard/assets/admin-BU4m6Ko2.js +0 -1
- package/static/dashboard/assets/ai-connections-CHNTKemd.js +0 -1
- package/static/dashboard/assets/dashboard-C_7MUXJb.css +0 -1
- package/static/dashboard/assets/index-FWZ-s52O.js +0 -41
- package/static/dashboard/assets/index-ZiQZ96oC.js +0 -4
- package/static/settings/assets/AiConfigContext-C0cQMPfG.js +0 -1
- package/static/settings/assets/AiConfigPage-CPhB4iFb.js +0 -1
- package/static/settings/assets/DocumentProcessingPanel-sYI7OpuH.js +0 -1
- package/static/settings/assets/IndexLifecyclePanel-yj8iyiT8.js +0 -1
- package/static/settings/assets/ModelAssignmentsPanel-BFIgUX5v.js +0 -1
- package/static/settings/assets/ModelsPage-BdppXl7E.js +0 -10
- package/static/settings/assets/SearchIndexingPanel-BlPnrkT3.js +0 -1
- package/static/settings/assets/SystemSettingsPage-CiOm2NzV.js +0 -1
- package/static/settings/assets/SystemSettingsSubjectPanel-Cd-GECon.js +0 -31
- package/static/settings/assets/admin-BU4m6Ko2.js +0 -1
- package/static/settings/assets/ai-connections-CHNTKemd.js +0 -1
- package/static/settings/assets/index-BFi9yn7_.js +0 -41
- package/static/settings/assets/index-BGgEhIUy.js +0 -4
- package/static/settings/assets/settings-C_7MUXJb.css +0 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PodModelDescriptor } from '@undefineds.co/models';
|
|
2
|
+
import type { PodCollection, PodCollectionOptions, PodRowConflict, PodSyncState, RowOf } from './types.js';
|
|
3
|
+
export type { PodCollection, PodCollectionOptions, PodDocumentFeed, PodRowConflict, PodSyncState, PodSubjectRow, PodFieldValue, RowOf, } from './types.js';
|
|
4
|
+
export type { PodLayoutInput, PodLayoutScope } from './layout.js';
|
|
5
|
+
export type { PodRdfTerm } from './mapping.js';
|
|
6
|
+
export { PodCollectionError } from './types.js';
|
|
7
|
+
export type { PodFieldBinding } from './mapping.js';
|
|
8
|
+
export { DEFAULT_COALESCE_MS, DEFAULT_CONFIRM_RETRIES } from './sync.js';
|
|
9
|
+
/**
|
|
10
|
+
* 声明一个 Pod 表集合(§2)。
|
|
11
|
+
*
|
|
12
|
+
* 表是一个**文档**,行是文档里的**主语**:schema 全部来自 models 的 descriptor
|
|
13
|
+
* (`storage.base` / `resourceIdPattern` / `fields` / `class`),消费方不手写 topic、
|
|
14
|
+
* 不手写字段映射、不手写 refetch。集合定义本身就是「开启订阅」的声明(D3),
|
|
15
|
+
* 所以这里 `startSync: true`:配置了 feed 就是活表,没有 feed 就退化为
|
|
16
|
+
* 「读一次 + 显式 `refresh()`」,永不轮询(N1)。
|
|
17
|
+
*/
|
|
18
|
+
export declare function definePodCollection<D extends PodModelDescriptor>(descriptor: D, options: PodCollectionOptions<D>): PodCollection<RowOf<D>>;
|
|
19
|
+
/** 行键冲突类型再导出,便于 applet 写 `onConflict` 回调签名。 */
|
|
20
|
+
export type PodConflict<R extends object> = PodRowConflict<R>;
|
|
21
|
+
export { conditionalDocumentRead, sessionFetchOf } from './read.js';
|
|
22
|
+
export { resolveTableDocument, rowKeyOf, subjectIriForRow, resourceIdForRow } from './layout.js';
|
|
23
|
+
export { coerceFieldValue, descriptorFieldsWithoutColumn, fieldBindings, mapSubjectRows, projectionFieldOrder, tableColumnsWithoutDescriptorField, valueToTerm, writeOnlyFields, } from './mapping.js';
|
|
24
|
+
export { computeDocumentDiff, projectionHash, stripVirtualProps } from './diff.js';
|
|
25
|
+
/**
|
|
26
|
+
* 内部观测面(不在 `PodCollection` 接口里):宿主能力用它读取同步状态,
|
|
27
|
+
* 测试用它驱动库的 `truncate()`。类型上显式标注,避免 applet 依赖。
|
|
28
|
+
*/
|
|
29
|
+
export interface PodCollectionInternals {
|
|
30
|
+
syncState(): PodSyncState;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
/** @internal 仅测试:调用库的 `truncate()`(清空 syncedData 与 row metadata)。 */
|
|
33
|
+
truncateForTest(): void;
|
|
34
|
+
}
|
|
35
|
+
export declare function podCollectionInternals<R extends {
|
|
36
|
+
id: string;
|
|
37
|
+
}>(collection: PodCollection<R>): PodCollectionInternals;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createCollection } from '@tanstack/db';
|
|
2
|
+
import { resolveTableDocument } from './layout.js';
|
|
3
|
+
import { assertDescriptorTableAlignment } from './mapping.js';
|
|
4
|
+
import { createMutationHandlers, createPendingWrites } from './mutations.js';
|
|
5
|
+
import { createPodSync } from './sync.js';
|
|
6
|
+
import { PodCollectionError } from './types.js';
|
|
7
|
+
export { PodCollectionError } from './types.js';
|
|
8
|
+
export { DEFAULT_COALESCE_MS, DEFAULT_CONFIRM_RETRIES } from './sync.js';
|
|
9
|
+
/**
|
|
10
|
+
* 声明一个 Pod 表集合(§2)。
|
|
11
|
+
*
|
|
12
|
+
* 表是一个**文档**,行是文档里的**主语**:schema 全部来自 models 的 descriptor
|
|
13
|
+
* (`storage.base` / `resourceIdPattern` / `fields` / `class`),消费方不手写 topic、
|
|
14
|
+
* 不手写字段映射、不手写 refetch。集合定义本身就是「开启订阅」的声明(D3),
|
|
15
|
+
* 所以这里 `startSync: true`:配置了 feed 就是活表,没有 feed 就退化为
|
|
16
|
+
* 「读一次 + 显式 `refresh()`」,永不轮询(N1)。
|
|
17
|
+
*/
|
|
18
|
+
export function definePodCollection(descriptor, options) {
|
|
19
|
+
assertDescriptorTableAlignment(descriptor, options.table);
|
|
20
|
+
const document = resolveTableDocument(descriptor, {
|
|
21
|
+
podUrl: options.podUrl,
|
|
22
|
+
document: options.document,
|
|
23
|
+
scope: options.scope,
|
|
24
|
+
});
|
|
25
|
+
const pending = createPendingWrites(options.onConflict);
|
|
26
|
+
let collection;
|
|
27
|
+
const engine = createPodSync({
|
|
28
|
+
descriptor,
|
|
29
|
+
table: options.table,
|
|
30
|
+
database: options.database,
|
|
31
|
+
podUrl: options.podUrl,
|
|
32
|
+
document,
|
|
33
|
+
feed: options.feed,
|
|
34
|
+
coalesceMs: options.coalesceMs,
|
|
35
|
+
confirmRetries: options.confirmRetries,
|
|
36
|
+
pending,
|
|
37
|
+
collection: () => collection,
|
|
38
|
+
});
|
|
39
|
+
const handlers = createMutationHandlers({
|
|
40
|
+
descriptor,
|
|
41
|
+
table: options.table,
|
|
42
|
+
database: options.database,
|
|
43
|
+
podUrl: options.podUrl,
|
|
44
|
+
document,
|
|
45
|
+
pending,
|
|
46
|
+
confirm: (key) => engine.confirmPending(key),
|
|
47
|
+
});
|
|
48
|
+
const created = createCollection({
|
|
49
|
+
// 集合 id 由 descriptor 与文档决定:一个表一个文档就是一个集合。
|
|
50
|
+
id: `pod-collection:${descriptor.uri}:${document}`,
|
|
51
|
+
// §2.7:键取行标识(`resourceIdPattern` 的键 slot),不取 `uniqueBy` ——
|
|
52
|
+
// 后者是语义唯一键,与存储布局的键 slot 不保证同形(`aiModelDescriptor`:
|
|
53
|
+
// `uniqueBy: ['id']` 但键 slot 是 `key`)。
|
|
54
|
+
getKey: (row) => row.id,
|
|
55
|
+
// §3.2:diff 的产物是整行投影,`partial` 表达不了「谓词被移除」。
|
|
56
|
+
sync: { sync: engine.sync, rowUpdateMode: 'full' },
|
|
57
|
+
startSync: true,
|
|
58
|
+
onInsert: handlers.onInsert,
|
|
59
|
+
onUpdate: handlers.onUpdate,
|
|
60
|
+
onDelete: handlers.onDelete,
|
|
61
|
+
});
|
|
62
|
+
collection = created;
|
|
63
|
+
return Object.assign(created, {
|
|
64
|
+
tableDocument: document,
|
|
65
|
+
pendingKeys: pending.keys,
|
|
66
|
+
conflicts: pending.conflicts,
|
|
67
|
+
refresh: () => engine.refresh(),
|
|
68
|
+
/**
|
|
69
|
+
* @internal 同步状态(§1.5 N1 的 `unavailable` / §3.4 的降级)。
|
|
70
|
+
* 不进 `PodCollection` 接口:宿主能力的接线在下一期(§6.4)。
|
|
71
|
+
*/
|
|
72
|
+
syncState: () => engine.state(),
|
|
73
|
+
/** @internal 释放订阅与定时器(宿主 capability 的 `dispose()`,§6.4-6)。 */
|
|
74
|
+
dispose: () => engine.dispose(),
|
|
75
|
+
/** @internal 测试钩子:库的 `truncate()`。 */
|
|
76
|
+
truncateForTest: () => engine.truncate(),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export { conditionalDocumentRead, sessionFetchOf } from './read.js';
|
|
80
|
+
export { resolveTableDocument, rowKeyOf, subjectIriForRow, resourceIdForRow } from './layout.js';
|
|
81
|
+
export { coerceFieldValue, descriptorFieldsWithoutColumn, fieldBindings, mapSubjectRows, projectionFieldOrder, tableColumnsWithoutDescriptorField, valueToTerm, writeOnlyFields, } from './mapping.js';
|
|
82
|
+
export { computeDocumentDiff, projectionHash, stripVirtualProps } from './diff.js';
|
|
83
|
+
export function podCollectionInternals(collection) {
|
|
84
|
+
const internals = collection;
|
|
85
|
+
if (typeof internals.syncState !== 'function' || typeof internals.dispose !== 'function') {
|
|
86
|
+
throw new PodCollectionError('collection_not_from_define', 'collection was not created by definePodCollection()');
|
|
87
|
+
}
|
|
88
|
+
return internals;
|
|
89
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { PodModelDescriptor } from '@undefineds.co/models';
|
|
2
|
+
import type { PodSubjectRow } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* topic 推导与行 IRI ↔ 键(`docs/pod-collections.md` §2.3、§2.7)。
|
|
5
|
+
*
|
|
6
|
+
* 只读 descriptor 的 `storage.base` / `storage.resourceIdPattern`:本文件里没有
|
|
7
|
+
* 任何表清单、字段映射表或布局常量(N2)。三种形状:
|
|
8
|
+
*
|
|
9
|
+
* | `storage.base` | `resourceIdPattern` | 文档(topic) |
|
|
10
|
+
* |----------------------------|----------------------------|------------------------------------|
|
|
11
|
+
* | 文档(`…/credentials.ttl`) | `#{id}` | base 本身 |
|
|
12
|
+
* | 容器(`…/providers/`) | `{key}.ttl` | `base + key + '.ttl'` |
|
|
13
|
+
* | 容器(`…/providers/`) | `{isProvidedBy.doc}#{key}` | 行所属 provider 的文档(scope 决定) |
|
|
14
|
+
*
|
|
15
|
+
* 第四种形状(`base = '/.data/'` + `{id}`,一行一文档)不在本期范围(§1.2)。
|
|
16
|
+
*/
|
|
17
|
+
export interface PodLayoutScope {
|
|
18
|
+
provider?: string;
|
|
19
|
+
instanceId?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PodLayoutInput {
|
|
22
|
+
podUrl: string;
|
|
23
|
+
/** 显式文档(绝对 URL 或相对 podUrl 的路径)。给了就不再推导。 */
|
|
24
|
+
document?: string;
|
|
25
|
+
scope?: PodLayoutScope;
|
|
26
|
+
}
|
|
27
|
+
/** 绝对 URL 直接用;否则按 podUrl 解析(相对路径不要求前导 `/`)。 */
|
|
28
|
+
export declare function resolvePodUrl(podUrl: string, value: string): string;
|
|
29
|
+
export declare function templateVariables(pattern: string): string[];
|
|
30
|
+
/** 行键 slot(模式里最后一个模板变量)的名字。 */
|
|
31
|
+
export declare function rowKeyVariable(pattern: string): string;
|
|
32
|
+
/** `storage.base` 本身就是一个文档(最后一段带扩展名),而不是容器。 */
|
|
33
|
+
export declare function isDocumentBase(base: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 文档(topic)解析。三种形状见文件头;无法机械推导时抛
|
|
36
|
+
* `layout_document_required`,不猜布局。
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveTableDocument(descriptor: PodModelDescriptor, input: PodLayoutInput): string;
|
|
39
|
+
/** 文档 URL 相对 podUrl 的 resource id(例如 `settings/credentials.ttl`)。 */
|
|
40
|
+
export declare function documentResourceId(documentUrl: string, podUrl: string): string;
|
|
41
|
+
/** 文档在表 base 下的相对 id(表列 `id` 的文档段),例如 `credentials.ttl`。 */
|
|
42
|
+
export declare function documentKeyOf(descriptor: PodModelDescriptor, documentUrl: string, podUrl: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* 表列 `id`(base-relative resource id)的值:
|
|
45
|
+
* `settings/credentials.ttl` + base `/settings/` + `#{id}` → `credentials.ttl#{key}`。
|
|
46
|
+
* ORM 的 `updateById` / `deleteById` 收的就是这个值。
|
|
47
|
+
*/
|
|
48
|
+
export declare function resourceIdForRow(descriptor: PodModelDescriptor, documentUrl: string, podUrl: string, key: string): string;
|
|
49
|
+
/** 行主语 IRI:文档 + fragment slot(行就是文档时等于文档 URL)。 */
|
|
50
|
+
export declare function subjectIriForRow(descriptor: PodModelDescriptor, documentUrl: string, key: string): string;
|
|
51
|
+
/** 行所属文档(去掉 fragment)。 */
|
|
52
|
+
export declare function documentOfIri(iri: string): string;
|
|
53
|
+
/** 行主语 IRI:drizzle-solid 行上的 `@id` / `uri` / `subject`。 */
|
|
54
|
+
export declare function rowSubjectIriOf(row: PodSubjectRow): string | undefined;
|
|
55
|
+
/** 行 resource id(drizzle-solid 的虚列 `id`)。 */
|
|
56
|
+
export declare function rowResourceIdOf(row: PodSubjectRow): string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* 从行上取行键:把 `resourceIdPattern` 编译成正则,最后一个模板变量就是键。
|
|
59
|
+
* `#{id}` → fragment;`{key}.ttl` → 文件名;`{isProvidedBy.doc}#{key}` → fragment;
|
|
60
|
+
* `{yyyy}/{MM}/{dd}.ttl#{id}` → fragment。
|
|
61
|
+
* 与 §2.7 一致:键只取行标识 slot,**不取 `uniqueBy`**。0.2.57 起 credential 的
|
|
62
|
+
* `uniqueBy` 是真实列 `['id']`(旧值 `['service','providerId','secretType']` 引用了
|
|
63
|
+
* 不存在的列且不唯一),但两者语义不同:`uniqueBy` 是语义唯一键,键 slot 是存储布局。
|
|
64
|
+
* 官方 descriptor 已经出现不同形的情形 —— `aiModelDescriptor` 的 `uniqueBy` 也是
|
|
65
|
+
* `['id']`,而它的键 slot 叫 `key`(`{isProvidedBy.doc}#{key}`),且 `id` 并不是一个
|
|
66
|
+
* 有谓词列的字段。所以键只能从 `resourceIdPattern` 取。
|
|
67
|
+
*/
|
|
68
|
+
export declare function rowKeyOf(descriptor: PodModelDescriptor, row: PodSubjectRow): string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* 模板 → 正则:字面量先切出来再转义,模板变量替换成捕获组(最后一个变量是键)。
|
|
71
|
+
* 不能「先整体转义再替换变量」—— 那会把变量前的转义反斜杠留在原处,生成非法正则。
|
|
72
|
+
*/
|
|
73
|
+
export declare function compileRowKeyPattern(pattern: string): RegExp;
|
|
74
|
+
/** 行是否属于该文档(一个表 = 一个文档;§2.3、§3.4)。 */
|
|
75
|
+
export declare function rowBelongsToDocument(descriptor: PodModelDescriptor, documentUrl: string, podUrl: string, row: PodSubjectRow): boolean;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { PodCollectionError } from './types.js';
|
|
2
|
+
const TEMPLATE_VARIABLE = /\{([^{}]+)\}/gu;
|
|
3
|
+
function escapeRegExp(value) {
|
|
4
|
+
return value.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
5
|
+
}
|
|
6
|
+
function normalizePodUrl(podUrl) {
|
|
7
|
+
return podUrl.endsWith('/') ? podUrl : `${podUrl}/`;
|
|
8
|
+
}
|
|
9
|
+
/** 绝对 URL 直接用;否则按 podUrl 解析(相对路径不要求前导 `/`)。 */
|
|
10
|
+
export function resolvePodUrl(podUrl, value) {
|
|
11
|
+
if (/^[a-z][a-z0-9+.-]*:/iu.test(value))
|
|
12
|
+
return value;
|
|
13
|
+
return new URL(value.replace(/^\/+/u, ''), normalizePodUrl(podUrl)).toString();
|
|
14
|
+
}
|
|
15
|
+
export function templateVariables(pattern) {
|
|
16
|
+
return [...pattern.matchAll(TEMPLATE_VARIABLE)].map((match) => match[1]);
|
|
17
|
+
}
|
|
18
|
+
/** 行键 slot(模式里最后一个模板变量)的名字。 */
|
|
19
|
+
export function rowKeyVariable(pattern) {
|
|
20
|
+
const last = templateVariables(pattern).at(-1);
|
|
21
|
+
if (!last) {
|
|
22
|
+
throw new PodCollectionError('layout_pattern_without_key', `resourceIdPattern "${pattern}" has no {…} key slot`);
|
|
23
|
+
}
|
|
24
|
+
return last;
|
|
25
|
+
}
|
|
26
|
+
function splitOnKeySlot(pattern) {
|
|
27
|
+
const slot = `{${rowKeyVariable(pattern)}}`;
|
|
28
|
+
const index = pattern.lastIndexOf(slot);
|
|
29
|
+
return { head: pattern.slice(0, index), tail: pattern.slice(index + slot.length), slot };
|
|
30
|
+
}
|
|
31
|
+
/** `storage.base` 本身就是一个文档(最后一段带扩展名),而不是容器。 */
|
|
32
|
+
export function isDocumentBase(base) {
|
|
33
|
+
const lastSegment = base.replace(/\/+$/u, '').split('/').pop() ?? '';
|
|
34
|
+
return lastSegment.includes('.');
|
|
35
|
+
}
|
|
36
|
+
function baseDirectory(base) {
|
|
37
|
+
if (base.endsWith('/'))
|
|
38
|
+
return base;
|
|
39
|
+
const slash = base.lastIndexOf('/');
|
|
40
|
+
return slash < 0 ? '/' : base.slice(0, slash + 1);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 文档(topic)解析。三种形状见文件头;无法机械推导时抛
|
|
44
|
+
* `layout_document_required`,不猜布局。
|
|
45
|
+
*/
|
|
46
|
+
export function resolveTableDocument(descriptor, input) {
|
|
47
|
+
const podUrl = normalizePodUrl(input.podUrl);
|
|
48
|
+
if (input.document)
|
|
49
|
+
return resolvePodUrl(podUrl, input.document);
|
|
50
|
+
const base = descriptor.storage.base;
|
|
51
|
+
const pattern = descriptor.storage.resourceIdPattern;
|
|
52
|
+
if (!base || !pattern) {
|
|
53
|
+
throw new PodCollectionError('layout_missing_storage', `descriptor ${descriptor.uri} has no storage.base / resourceIdPattern`);
|
|
54
|
+
}
|
|
55
|
+
// 形状 1:base 本身是文档,行是文档里的主语。
|
|
56
|
+
if (isDocumentBase(base))
|
|
57
|
+
return resolvePodUrl(podUrl, base);
|
|
58
|
+
// 形状 2:base 是容器,行键就是文档名(`{key}.ttl`,键 slot 前只有字面量)。
|
|
59
|
+
const { head, tail } = splitOnKeySlot(pattern);
|
|
60
|
+
if (!pattern.includes('#') && templateVariables(head).length === 0) {
|
|
61
|
+
const key = input.scope?.instanceId ?? input.scope?.provider;
|
|
62
|
+
if (!key) {
|
|
63
|
+
throw new PodCollectionError('layout_document_required', `descriptor ${descriptor.uri} stores one document per row key (${pattern}); pass document or scope`);
|
|
64
|
+
}
|
|
65
|
+
return resolvePodUrl(podUrl, `${base}${head}${key}${tail}`);
|
|
66
|
+
}
|
|
67
|
+
// 形状 3:文档由另一个模板变量(如 `{isProvidedBy.doc}`)决定,descriptor 推不出来。
|
|
68
|
+
throw new PodCollectionError('layout_document_required', `descriptor ${descriptor.uri} stores rows across documents (${base}${pattern}); pass document explicitly`);
|
|
69
|
+
}
|
|
70
|
+
/** 文档 URL 相对 podUrl 的 resource id(例如 `settings/credentials.ttl`)。 */
|
|
71
|
+
export function documentResourceId(documentUrl, podUrl) {
|
|
72
|
+
const root = normalizePodUrl(podUrl);
|
|
73
|
+
if (documentUrl.startsWith(root))
|
|
74
|
+
return documentUrl.slice(root.length);
|
|
75
|
+
return documentUrl.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/iu, '').replace(/^\/+/u, '');
|
|
76
|
+
}
|
|
77
|
+
/** 文档在表 base 下的相对 id(表列 `id` 的文档段),例如 `credentials.ttl`。 */
|
|
78
|
+
export function documentKeyOf(descriptor, documentUrl, podUrl) {
|
|
79
|
+
const relative = documentResourceId(documentUrl, podUrl);
|
|
80
|
+
const baseDir = baseDirectory(descriptor.storage.base).replace(/^\/+/u, '');
|
|
81
|
+
const key = relative.startsWith(baseDir) ? relative.slice(baseDir.length) : relative;
|
|
82
|
+
if (!key) {
|
|
83
|
+
throw new PodCollectionError('layout_document_outside_base', `document ${documentUrl} is not under ${descriptor.storage.base}`);
|
|
84
|
+
}
|
|
85
|
+
return key;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 表列 `id`(base-relative resource id)的值:
|
|
89
|
+
* `settings/credentials.ttl` + base `/settings/` + `#{id}` → `credentials.ttl#{key}`。
|
|
90
|
+
* ORM 的 `updateById` / `deleteById` 收的就是这个值。
|
|
91
|
+
*/
|
|
92
|
+
export function resourceIdForRow(descriptor, documentUrl, podUrl, key) {
|
|
93
|
+
const pattern = descriptor.storage.resourceIdPattern;
|
|
94
|
+
const documentKey = documentKeyOf(descriptor, documentUrl, podUrl);
|
|
95
|
+
const { head, tail, slot } = splitOnKeySlot(pattern);
|
|
96
|
+
if (templateVariables(pattern).length > 1) {
|
|
97
|
+
throw new PodCollectionError('layout_document_required', `resourceIdPattern "${pattern}" has template variables this layer cannot fill`);
|
|
98
|
+
}
|
|
99
|
+
if (pattern.startsWith('#'))
|
|
100
|
+
return `${documentKey}${pattern.replace(slot, key)}`;
|
|
101
|
+
return `${head}${key}${tail}`;
|
|
102
|
+
}
|
|
103
|
+
/** 行主语 IRI:文档 + fragment slot(行就是文档时等于文档 URL)。 */
|
|
104
|
+
export function subjectIriForRow(descriptor, documentUrl, key) {
|
|
105
|
+
return descriptor.storage.resourceIdPattern.includes('#') ? `${documentUrl}#${key}` : documentUrl;
|
|
106
|
+
}
|
|
107
|
+
/** 行所属文档(去掉 fragment)。 */
|
|
108
|
+
export function documentOfIri(iri) {
|
|
109
|
+
const hash = iri.indexOf('#');
|
|
110
|
+
return hash < 0 ? iri : iri.slice(0, hash);
|
|
111
|
+
}
|
|
112
|
+
/** 行主语 IRI:drizzle-solid 行上的 `@id` / `uri` / `subject`。 */
|
|
113
|
+
export function rowSubjectIriOf(row) {
|
|
114
|
+
for (const candidate of [row['@id'], row.uri, row.subject]) {
|
|
115
|
+
if (typeof candidate === 'string' && candidate.length > 0)
|
|
116
|
+
return candidate;
|
|
117
|
+
}
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
/** 行 resource id(drizzle-solid 的虚列 `id`)。 */
|
|
121
|
+
export function rowResourceIdOf(row) {
|
|
122
|
+
return typeof row.id === 'string' && row.id.length > 0 ? row.id : undefined;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 从行上取行键:把 `resourceIdPattern` 编译成正则,最后一个模板变量就是键。
|
|
126
|
+
* `#{id}` → fragment;`{key}.ttl` → 文件名;`{isProvidedBy.doc}#{key}` → fragment;
|
|
127
|
+
* `{yyyy}/{MM}/{dd}.ttl#{id}` → fragment。
|
|
128
|
+
* 与 §2.7 一致:键只取行标识 slot,**不取 `uniqueBy`**。0.2.57 起 credential 的
|
|
129
|
+
* `uniqueBy` 是真实列 `['id']`(旧值 `['service','providerId','secretType']` 引用了
|
|
130
|
+
* 不存在的列且不唯一),但两者语义不同:`uniqueBy` 是语义唯一键,键 slot 是存储布局。
|
|
131
|
+
* 官方 descriptor 已经出现不同形的情形 —— `aiModelDescriptor` 的 `uniqueBy` 也是
|
|
132
|
+
* `['id']`,而它的键 slot 叫 `key`(`{isProvidedBy.doc}#{key}`),且 `id` 并不是一个
|
|
133
|
+
* 有谓词列的字段。所以键只能从 `resourceIdPattern` 取。
|
|
134
|
+
*/
|
|
135
|
+
export function rowKeyOf(descriptor, row) {
|
|
136
|
+
const resourceId = rowResourceIdOf(row);
|
|
137
|
+
if (!resourceId)
|
|
138
|
+
return undefined;
|
|
139
|
+
return compileRowKeyPattern(descriptor.storage.resourceIdPattern).exec(resourceId)?.[1];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* 模板 → 正则:字面量先切出来再转义,模板变量替换成捕获组(最后一个变量是键)。
|
|
143
|
+
* 不能「先整体转义再替换变量」—— 那会把变量前的转义反斜杠留在原处,生成非法正则。
|
|
144
|
+
*/
|
|
145
|
+
export function compileRowKeyPattern(pattern) {
|
|
146
|
+
const matches = [...pattern.matchAll(TEMPLATE_VARIABLE)];
|
|
147
|
+
const last = matches.at(-1);
|
|
148
|
+
if (!last) {
|
|
149
|
+
throw new PodCollectionError('layout_pattern_without_key', `resourceIdPattern "${pattern}" has no {…} key slot`);
|
|
150
|
+
}
|
|
151
|
+
let source = '^[\\s\\S]*?';
|
|
152
|
+
let cursor = 0;
|
|
153
|
+
for (const match of matches) {
|
|
154
|
+
const index = match.index ?? 0;
|
|
155
|
+
source += escapeRegExp(pattern.slice(cursor, index));
|
|
156
|
+
source += match === last ? '([\\s\\S]+)' : '[\\s\\S]*?';
|
|
157
|
+
cursor = index + match[0].length;
|
|
158
|
+
}
|
|
159
|
+
source += `${escapeRegExp(pattern.slice(cursor))}$`;
|
|
160
|
+
return new RegExp(source, 'u');
|
|
161
|
+
}
|
|
162
|
+
/** 行是否属于该文档(一个表 = 一个文档;§2.3、§3.4)。 */
|
|
163
|
+
export function rowBelongsToDocument(descriptor, documentUrl, podUrl, row) {
|
|
164
|
+
const document = documentOfIri(documentUrl);
|
|
165
|
+
const subject = rowSubjectIriOf(row);
|
|
166
|
+
if (subject)
|
|
167
|
+
return documentOfIri(subject) === document;
|
|
168
|
+
const resourceId = rowResourceIdOf(row);
|
|
169
|
+
if (!resourceId)
|
|
170
|
+
return false;
|
|
171
|
+
const documentKey = documentKeyOf(descriptor, documentUrl, podUrl);
|
|
172
|
+
return documentOfIri(resourceId).endsWith(documentKey);
|
|
173
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { AnyPodTable } from '@undefineds.co/drizzle-solid';
|
|
2
|
+
import type { PodModelDescriptor, PodModelFieldDescriptor } from '@undefineds.co/models';
|
|
3
|
+
import type { PodSubjectRow, RowOf } from './types.js';
|
|
4
|
+
/** RDF term(只覆盖本层会产生的两种)。 */
|
|
5
|
+
export interface PodRdfTerm {
|
|
6
|
+
termType: 'NamedNode' | 'Literal';
|
|
7
|
+
value: string;
|
|
8
|
+
datatype?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PodFieldBinding {
|
|
11
|
+
field: string;
|
|
12
|
+
descriptor: PodModelFieldDescriptor;
|
|
13
|
+
/** 承载该字段的表列;descriptor 声明了但表里没有对应谓词时为 undefined。 */
|
|
14
|
+
column: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** 表列 → 谓词(跳过 `@id` 虚列)。 */
|
|
17
|
+
export declare function tableColumnPredicates(table: AnyPodTable): Map<string, string>;
|
|
18
|
+
/** descriptor 字段 → 承载它的表列(按谓词,不按字段名)。 */
|
|
19
|
+
export declare function fieldBindings(descriptor: PodModelDescriptor, table: AnyPodTable): Map<string, PodFieldBinding>;
|
|
20
|
+
/**
|
|
21
|
+
* 行标识字段:`resourceIdPattern` 的 `{…}` 键 slot 名(`#{id}` → `id`)。
|
|
22
|
+
* 它由 drizzle-solid 的虚列 `id` / `@id` 承载,不落在任何谓词列上。
|
|
23
|
+
*/
|
|
24
|
+
export declare function identityFieldOf(descriptor: PodModelDescriptor): string;
|
|
25
|
+
/**
|
|
26
|
+
* descriptor 声明了、但表里找不到对应谓词的字段(§2.7 的漂移面)。
|
|
27
|
+
* 行标识字段不算:它由行本身承载(`mapSubjectRows` 用行键填它)。
|
|
28
|
+
*/
|
|
29
|
+
export declare function descriptorFieldsWithoutColumn(descriptor: PodModelDescriptor, table: AnyPodTable): string[];
|
|
30
|
+
/** 表里有、但 descriptor 没声明的列(§2.7 的漂移面)。 */
|
|
31
|
+
export declare function tableColumnsWithoutDescriptorField(descriptor: PodModelDescriptor, table: AnyPodTable): string[];
|
|
32
|
+
/**
|
|
33
|
+
* 类过滤的显式化(§2.4 边界 2):行准入以 descriptor 的 `class` 为准,而 drizzle 的
|
|
34
|
+
* 读把它编译成 `?subject rdf:type <class>`(表 options 的 `type`)。两者必须同源,
|
|
35
|
+
* 否则读回来的行与 descriptor 不是一套 schema —— 抛错而不是静默接受。
|
|
36
|
+
*/
|
|
37
|
+
export declare function assertDescriptorTableAlignment(descriptor: PodModelDescriptor, table: AnyPodTable): void;
|
|
38
|
+
/**
|
|
39
|
+
* 只写字段(`secret: true`):**写入可以带、读取永远读不回**。
|
|
40
|
+
*
|
|
41
|
+
* §2.1 把投影定义为「descriptor 的非 secret 字段」,所以这些字段既不在
|
|
42
|
+
* `mapSubjectRows()` 的行里,也不可能出现在服务端投影里。这个集合是那条规则的
|
|
43
|
+
* 唯一来源:读写两侧(`mapSubjectRows()` 与 §4.2 的确认协议)都从它取,避免
|
|
44
|
+
* 「哪边算 secret」出现第二份判断。
|
|
45
|
+
*
|
|
46
|
+
* 特别注意它与「descriptor 声明了但表里没有列」的字段(§2.7 的漂移面)不是一回事:
|
|
47
|
+
* 后者是**可读**字段,只是当前不可投影,语义上仍要求出现在服务端行里。
|
|
48
|
+
*/
|
|
49
|
+
export declare function writeOnlyFields(descriptor: PodModelDescriptor): ReadonlySet<string>;
|
|
50
|
+
/**
|
|
51
|
+
* 投影后的字段顺序:按谓词排序(§3.2 的投影哈希要求确定性,与字段声明顺序无关)。
|
|
52
|
+
*/
|
|
53
|
+
export declare function projectionFieldOrder(descriptor: PodModelDescriptor): string[];
|
|
54
|
+
/** 值 → 行字段值;同时接受 drizzle-solid 已解码的值与 RDF term(§2.4)。 */
|
|
55
|
+
export declare function coerceFieldValue(field: PodModelFieldDescriptor, input: unknown): unknown;
|
|
56
|
+
/** 值 → RDF term(§2.4;datatype 规则见文件头)。 */
|
|
57
|
+
export declare function valueToTerm(field: PodModelFieldDescriptor, value: unknown): PodRdfTerm | undefined;
|
|
58
|
+
/** array 字段:每个元素一个 term(每元素一条三元组,§2.4)。 */
|
|
59
|
+
export declare function valuesToTerms(field: PodModelFieldDescriptor, value: unknown): PodRdfTerm[];
|
|
60
|
+
/**
|
|
61
|
+
* 主语行 → 集合行(`RowOf<D>`):只投影 descriptor 的非 `secret` 字段,
|
|
62
|
+
* `secret: true` 的字段默认不出现在行里(§2.1)。文档归属由读原语(`read.ts`)
|
|
63
|
+
* 决定,这里只做投影与键提取。
|
|
64
|
+
*/
|
|
65
|
+
export declare function mapSubjectRows<D extends PodModelDescriptor>(descriptor: D, table: AnyPodTable, subjects: readonly PodSubjectRow[]): RowOf<D>[];
|
|
66
|
+
/**
|
|
67
|
+
* 集合行 → drizzle 写负载(列名 → 值),供 `insert().values()` / `updateById()`。
|
|
68
|
+
* `array + uri` 字段由调用方走 `writeField()` 的 PATCH 旁路,不进 ORM(§4.1)。
|
|
69
|
+
* 返回的负载总是包含行标识列 `id`(表列 `id` 是 base-relative resource id)。
|
|
70
|
+
*/
|
|
71
|
+
export declare function descriptorRowToColumnValues(descriptor: PodModelDescriptor, table: AnyPodTable, row: Record<string, unknown>, options: {
|
|
72
|
+
resourceId: string;
|
|
73
|
+
includeField?: (field: string) => boolean;
|
|
74
|
+
}): Record<string, unknown>;
|
|
75
|
+
/** 该字段是否走 §4.1 的 PATCH 旁路:`array: true` + `type: 'uri'`。 */
|
|
76
|
+
export declare function isUriArrayField(field: PodModelFieldDescriptor): boolean;
|
|
77
|
+
/** descriptor 里所有走 PATCH 旁路的字段。 */
|
|
78
|
+
export declare function uriArrayFields(descriptor: PodModelDescriptor): string[];
|