@undefineds.co/xpod 0.3.67 → 0.3.69

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.
Files changed (47) hide show
  1. package/config/components-ignore.json +1 -0
  2. package/dist/api/ApiServer.d.ts +9 -1
  3. package/dist/api/ApiServer.js +22 -1
  4. package/dist/api/ApiServer.js.map +1 -1
  5. package/dist/api/container/common.js +1 -1
  6. package/dist/api/container/common.js.map +1 -1
  7. package/dist/api/container/routes.js +13 -0
  8. package/dist/api/container/routes.js.map +1 -1
  9. package/dist/api/container/types.d.ts +1 -1
  10. package/dist/api/container/types.js.map +1 -1
  11. package/dist/api/handlers/DeviceNotificationRuntime.d.ts +26 -0
  12. package/dist/api/handlers/DeviceNotificationRuntime.js +77 -0
  13. package/dist/api/handlers/DeviceNotificationRuntime.js.map +1 -0
  14. package/dist/api/handlers/DeviceNotificationTicketHandler.d.ts +50 -0
  15. package/dist/api/handlers/DeviceNotificationTicketHandler.js +130 -0
  16. package/dist/api/handlers/DeviceNotificationTicketHandler.js.map +1 -0
  17. package/dist/api/handlers/DeviceNotificationTicketHandler.jsonld +117 -0
  18. package/dist/api/runs/InngestRunExecutionBackend.d.ts +2 -2
  19. package/dist/api/tasks/InngestTaskScheduler.d.ts +4 -4
  20. package/dist/components/components.jsonld +6 -1
  21. package/dist/components/context.jsonld +122 -0
  22. package/dist/http/DeviceNotificationWebSocketServer.d.ts +29 -0
  23. package/dist/http/DeviceNotificationWebSocketServer.js +138 -0
  24. package/dist/http/DeviceNotificationWebSocketServer.js.map +1 -0
  25. package/dist/http/DeviceNotificationWebSocketServer.jsonld +148 -0
  26. package/dist/index.d.ts +7 -1
  27. package/dist/index.js +13 -2
  28. package/dist/index.js.map +1 -1
  29. package/dist/notifications/DeviceNotificationHub.d.ts +74 -0
  30. package/dist/notifications/DeviceNotificationHub.js +313 -0
  31. package/dist/notifications/DeviceNotificationHub.js.map +1 -0
  32. package/dist/notifications/DeviceNotificationHub.jsonld +258 -0
  33. package/dist/notifications/DeviceNotificationResourceListener.d.ts +21 -0
  34. package/dist/notifications/DeviceNotificationResourceListener.js +38 -0
  35. package/dist/notifications/DeviceNotificationResourceListener.js.map +1 -0
  36. package/dist/notifications/DeviceNotificationResourceListener.jsonld +98 -0
  37. package/dist/notifications/device-notification-protocol.d.ts +56 -0
  38. package/dist/notifications/device-notification-protocol.js +127 -0
  39. package/dist/notifications/device-notification-protocol.js.map +1 -0
  40. package/dist/notifications/device-notification-protocol.jsonld +29 -0
  41. package/dist/notifications/index.d.ts +3 -0
  42. package/dist/notifications/index.js +20 -0
  43. package/dist/notifications/index.js.map +1 -0
  44. package/dist/storage/ObservableResourceStore.d.ts +3 -0
  45. package/dist/storage/ObservableResourceStore.js +17 -1
  46. package/dist/storage/ObservableResourceStore.js.map +1 -1
  47. package/package.json +1 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,yGAAsG;AAoKpG,qHApKO,2EAAoC,OAoKP;AAnKtC,6EAA0E;AAoKxE,kGApKO,qCAAiB,OAoKP;AAnKnB,iGAA8F;AAoK5F,4GApKO,yDAA2B,OAoKP;AAnK7B,mGAAgG;AAoK9F,6GApKO,2DAA4B,OAoKP;AAnK9B,mFAAgF;AAoK9E,qGApKO,2CAAoB,OAoKP;AAnKtB,yEAAsE;AAoKpE,gGApKO,iCAAe,OAoKP;AAnKjB,mFAAgF;AAoK9E,0GApKO,qDAAyB,OAoKP;AAnK3B,8EAA2E;AAqKzE,oGArKO,yCAAmB,OAqKP;AApKrB,0FAA2G;AAqKzG,sGArKO,iDAAqB,OAqKP;AACrB,uGAtK8B,kDAAsB,OAsK9B;AAnIxB,6CAA2B;AAC3B,6CAA2B;AAC3B,gFAA6E;AAkI3E,0GAlIO,qDAAyB,OAkIP;AAjI3B,8EAA2E;AAkIzE,sGA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+CAAsB,OAoIP;AAnIxB,uBAAuB;AACvB,yEAAsE;AAqIpE,oGArIO,yCAAmB,OAqIP;AApIrB,uEAAoE;AAqIlE,mGArIO,uCAAkB,OAqIP;AApIpB,yFAAsF;AAqIpF,4GArIO,yDAA2B,OAqIP;AApI7B,qEAAwE;AAsItE,yGAtIO,6CAAwB,OAsIP;AApI1B,mDAAiC;AACjC,sDAAoC;AA2BpC,uCAAuC;AACvC,sEAAqE;AAA5D,8HAAA,qBAAqB,OAAA","sourcesContent":["import './runtime/configure-drizzle-solid';\nimport { RepresentationPartialConvertingStore } from './storage/RepresentationPartialConvertingStore';\nimport { MinioDataAccessor } from './storage/accessors/MinioDataAccessor';\nimport { QuadstoreSparqlDataAccessor } from './storage/accessors/QuadstoreSparqlDataAccessor';\nimport { QuintStoreSparqlDataAccessor } from './storage/accessors/QuintStoreSparqlDataAccessor';\nimport { SolidRdfDataAccessor } from './storage/accessors/SolidRdfDataAccessor';\nimport { MixDataAccessor } from './storage/accessors/MixDataAccessor';\nimport { ConfigurableLoggerFactory } from './logging/ConfigurableLoggerFactory';\nimport { SubgraphQueryEngine } from './storage/sparql/SubgraphQueryEngine';\nimport { QuadstoreSparqlEngine, QuintstoreSparqlEngine } from './storage/sparql/CompatibilitySparqlEngine';\nexport type { SparqlEngine } from './storage/sparql/SubgraphQueryEngine';\nexport type {\n RdfEngineLike,\n RdfEngineStorageStats,\n RdfDerivedIndexRefreshResult,\n RdfIndexStats,\n RdfIndexSpaceObject,\n RdfIndexMetrics,\n RdfIndexPutOptions,\n RdfPatternQuery,\n RdfQuadIndexOptions,\n RdfQuadIndexScanResult,\n RdfTextIndexLike,\n RdfTextIndexOptions,\n RdfTextIndexSyncLike,\n RdfVectorIndexLike,\n RdfVectorIndexOptions,\n RdfVectorIndexSyncLike,\n RdfShadowBackfillOptions,\n RdfShadowBackfillResult,\n RdfShadowDiff,\n RdfShadowScanResult,\n RdfSourceInput,\n} from './storage/rdf/types';\nexport type { RdfSparqlCompileResult } from './storage/rdf/RdfSparqlAdapter';\nexport type { RdfAccessScope } from './storage/rdf/RdfAccessScope';\nexport type { ShadowRdfQuintStoreOptions } from './storage/rdf/ShadowRdfQuintStore';\nexport type {\n SolidRdfSparqlEngineOptions,\n SolidRdfSparqlFallback,\n} from './storage/rdf/SolidRdfSparqlEngine';\nexport type { PostgresRdfEngineOptions } from './storage/rdf/PostgresRdfEngine';\nexport type { PostgresRdfTextIndexOptions } from './storage/rdf/PostgresRdfTextIndex';\nexport type { PostgresRdfVectorIndexOptions } from './storage/rdf/PostgresRdfVectorIndex';\nexport * from './document';\nexport * from './security';\nimport { SubgraphSparqlHttpHandler } from './http/SubgraphSparqlHttpHandler';\nimport { QuotaAdminHttpHandler } from './http/quota/QuotaAdminHttpHandler';\nimport { SparqlUpdateResourceStore } from './storage/SparqlUpdateResourceStore';\nimport { ClusterIngressRouter } from './http/ClusterIngressRouter';\nimport { ClusterWebSocketConfigurator } from './http/ClusterWebSocketConfigurator';\nimport { EdgeNodeDirectDebugHttpHandler } from './http/EdgeNodeDirectDebugHttpHandler';\nimport { EdgeNodeProxyHttpHandler } from './http/EdgeNodeProxyHttpHandler';\nimport { RouterHttpHandler } from './http/RouterHttpHandler';\nimport { RouterHttpRoute } from './http/RouterHttpRoute';\nimport { TracingHandler } from './http/TracingHandler';\nimport { TerminalHttpHandler } from './http/terminal/TerminalHttpHandler';\nimport { EdgeNodeCertificateHttpHandler } from './http/admin/EdgeNodeCertificateHttpHandler';\nimport { ReservedSuffixIdentifierGenerator } from './pods/ReservedSuffixIdentifierGenerator';\nimport { DrizzleIndexedStorage } from './identity/drizzle/DrizzleIndexedStorage';\nimport { ValidatingIdentityProviderHttpHandler } from './identity/ValidatingIdentityProviderHttpHandler';\nimport { PostgresKeyValueStorage } from './storage/keyvalue/PostgresKeyValueStorage';\nimport { RedisKeyValueStorage } from './storage/keyvalue/RedisKeyValueStorage';\nimport { SqliteKeyValueStorage } from './storage/keyvalue/SqliteKeyValueStorage';\nimport { BaseKeyValueStorage } from './storage/keyvalue/BaseKeyValueStorage';\nimport { DrizzleQuotaService } from './quota/DrizzleQuotaService';\nimport { NoopQuotaService } from './quota/NoopQuotaService';\nimport { HttpEntitlementProvider, NoopEntitlementProvider } from './quota/EntitlementProvider';\nimport { PerAccountQuotaStrategy } from './storage/quota/PerAccountQuotaStrategy';\nimport { TencentDnsProvider } from './dns/tencent/TencentDnsProvider';\nimport { EdgeNodeDnsCoordinator } from './edge/EdgeNodeDnsCoordinator';\nimport { Dns01CertificateProvisioner } from './edge/Dns01CertificateProvisioner';\nimport { SimpleEdgeNodeTunnelManager, NoopEdgeNodeTunnelManager } from './edge/EdgeNodeTunnelManager';\nimport { FrpTunnelManager } from './edge/FrpTunnelManager';\nimport { AcmeCertificateManager } from './edge/acme/AcmeCertificateManager';\nimport { EdgeNodeHealthProbeService } from './edge/EdgeNodeHealthProbeService';\nimport { EdgeNodeAgent } from './edge/EdgeNodeAgent';\nimport { EdgeNodeAgentInitializer } from './edge/EdgeNodeAgentInitializer';\nimport { EdgeNodeCertificateService } from './service/EdgeNodeCertificateService';\nimport { createBandwidthThrottleTransform } from './util/stream/BandwidthThrottleTransform';\nimport { UsageTrackingStore } from './storage/quota/UsageTrackingStore';\nimport { EdgeNodeModeDetector } from './edge/EdgeNodeModeDetector';\nimport { ClusterIdentifierStrategy } from './util/identifiers/ClusterIdentifierStrategy';\nimport { CenterNodeRegistrationService } from './identity/CenterNodeRegistrationService';\nimport { PodRoutingHttpHandler } from './http/PodRoutingHttpHandler';\nimport { ReactAppViewHandler } from './identity/ReactAppViewHandler';\nimport { SqliteQuintStore } from './storage/quint/SqliteQuintStore';\nimport { PgQuintStore } from './storage/quint/PgQuintStore';\nimport { QuintStore } from './storage/quint/types';\nimport { RdfQuadIndex } from './storage/rdf/RdfQuadIndex';\nimport { Rdf3xIndex } from './storage/rdf/Rdf3xIndex';\nimport { RdfTextIndex } from './storage/rdf/RdfTextIndex';\nimport { RdfVectorIndex } from './storage/rdf/RdfVectorIndex';\nimport { PostgresRdfTextIndex } from './storage/rdf/PostgresRdfTextIndex';\nimport { PostgresRdfVectorIndex } from './storage/rdf/PostgresRdfVectorIndex';\nimport { RdfSparqlAdapter } from './storage/rdf/RdfSparqlAdapter';\nimport { RdfTermDictionary } from './storage/rdf/RdfTermDictionary';\nimport { ShadowRdfQuintStore } from './storage/rdf/ShadowRdfQuintStore';\nimport { SolidRdfEngine } from './storage/rdf/SolidRdfEngine';\nimport { PostgresRdfEngine } from './storage/rdf/PostgresRdfEngine';\nimport { SolidRdfSparqlEngine } from './storage/rdf/SolidRdfSparqlEngine';\nimport type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';\n// Vector components\nimport { SqliteVectorStore, PostgresVectorStore } from './storage/vector/index';\nimport { VectorHttpHandler } from './http/vector/VectorHttpHandler';\nimport { ProviderRegistry } from './ai/service/ProviderRegistry';\nimport { ProviderRegistryImpl } from './ai/service/ProviderRegistryImpl';\nimport { EmbeddingService } from './ai/service/EmbeddingService';\nimport { EmbeddingServiceImpl } from './ai/service/EmbeddingServiceImpl';\nimport { CredentialReader } from './ai/service/CredentialReader';\nimport { CredentialReaderImpl } from './ai/service/CredentialReaderImpl';\nimport { VectorStore } from './storage/vector/VectorStore';\n// Tunnel and Subdomain components\nimport { CloudflareTunnelProvider } from './tunnel/CloudflareTunnelProvider';\nimport { LocalTunnelProvider } from './tunnel/LocalTunnelProvider';\nimport { NgrokTunnelProvider } from './tunnel/NgrokTunnelProvider';\nimport { SubdomainService } from './subdomain/SubdomainService';\nimport { UrlAwareRedisLocker } from './storage/locking/UrlAwareRedisLocker';\n// IdP/SP separation components\nimport { MultiDomainIdentifierStrategy } from './util/identifiers/MultiDomainIdentifierStrategy';\nimport { SubdomainPodIdentifierStrategy } from './util/identifiers/SubdomainPodIdentifierStrategy';\nimport { DisabledOidcHandler } from './identity/oidc/DisabledOidcHandler';\nimport { DisabledIdentityProviderHandler } from './identity/oidc/DisabledIdentityProviderHandler';\nimport { AutoDetectOidcHandler } from './identity/oidc/AutoDetectOidcHandler';\nimport { AutoDetectIdentityProviderHandler } from './identity/oidc/AutoDetectIdentityProviderHandler';\nimport { LoopbackClientIdAdapterFactory } from './identity/oidc/LoopbackClientIdAdapterFactory';\nimport { ScopedPickWebIdHandler } from './identity/oidc/ScopedPickWebIdHandler';\n// Provision components\nimport { ProvisionPodCreator } from './provision/ProvisionPodCreator';\nimport { ProvisionCodeCodec } from './provision/ProvisionCodeCodec';\nimport { LocalPodProvisioningService } from './provision/LocalPodProvisioningService';\nimport { SqliteSolidFsSyncJournal } from './solidfs/SolidFsSyncJournal';\n\nexport * from './api/reconciler';\nexport * from './edge/reachability';\n\nexport type {\n DnsProvider,\n ListDnsRecordsInput,\n ListableDnsProvider,\n DeleteDnsRecordInput,\n DnsRecordSummary,\n UpsertDnsRecordInput,\n} from './dns/DnsProvider';\nexport type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';\nexport type { EdgeNodeAgentOptions, EdgeNodeP2PAcceptEvent } from './edge/EdgeNodeAgent';\nexport type { EdgeNodeTunnelManager } from './edge/interfaces/EdgeNodeTunnelManager';\nexport type { QuotaService, AccountQuota } from './quota/QuotaService';\nexport type { EntitlementProvider, AccountEntitlement } from './quota/EntitlementProvider';\n// Tunnel and Subdomain types\nexport type {\n TunnelProvider,\n TunnelConfig,\n TunnelSetupOptions,\n TunnelStatus,\n} from './tunnel/TunnelProvider';\nexport type {\n SubdomainRegistration,\n ConnectivityResult,\n SubdomainServiceOptions,\n} from './subdomain/SubdomainService';\n// Export the new AppStaticAssetHandler\nexport { AppStaticAssetHandler } from './http/AppStaticAssetHandler';\n\nexport {\n RepresentationPartialConvertingStore,\n MinioDataAccessor,\n QuadstoreSparqlDataAccessor,\n QuintStoreSparqlDataAccessor,\n SolidRdfDataAccessor,\n MixDataAccessor,\n ConfigurableLoggerFactory,\n SparqlUpdateResourceStore,\n SubgraphQueryEngine,\n QuadstoreSparqlEngine,\n QuintstoreSparqlEngine,\n SubgraphSparqlHttpHandler,\n QuotaAdminHttpHandler,\n ClusterIngressRouter,\n ClusterWebSocketConfigurator,\n EdgeNodeDirectDebugHttpHandler,\n EdgeNodeProxyHttpHandler,\n RouterHttpHandler,\n RouterHttpRoute,\n TracingHandler,\n EdgeNodeCertificateHttpHandler,\n TerminalHttpHandler,\n ReservedSuffixIdentifierGenerator,\n DrizzleIndexedStorage,\n ValidatingIdentityProviderHttpHandler,\n PostgresKeyValueStorage,\n RedisKeyValueStorage,\n SqliteKeyValueStorage,\n BaseKeyValueStorage,\n DrizzleQuotaService,\n NoopQuotaService,\n HttpEntitlementProvider,\n NoopEntitlementProvider,\n PerAccountQuotaStrategy,\n TencentDnsProvider,\n EdgeNodeDnsCoordinator,\n Dns01CertificateProvisioner,\n SimpleEdgeNodeTunnelManager,\n NoopEdgeNodeTunnelManager,\n FrpTunnelManager,\n EdgeNodeHealthProbeService,\n EdgeNodeAgent,\n EdgeNodeAgentInitializer,\n EdgeNodeCertificateService,\n AcmeCertificateManager,\n EdgeNodeModeDetector,\n ClusterIdentifierStrategy,\n UsageTrackingStore,\n CenterNodeRegistrationService,\n PodRoutingHttpHandler,\n ReactAppViewHandler,\n // Quint exports\n QuintStore,\n SqliteQuintStore,\n PgQuintStore,\n // RDF engine exports\n RdfTermDictionary,\n RdfQuadIndex,\n Rdf3xIndex,\n RdfTextIndex,\n RdfVectorIndex,\n PostgresRdfTextIndex,\n PostgresRdfVectorIndex,\n RdfSparqlAdapter,\n ShadowRdfQuintStore,\n SolidRdfEngine,\n PostgresRdfEngine,\n SolidRdfSparqlEngine,\n // Vector exports\n VectorStore,\n SqliteVectorStore,\n PostgresVectorStore,\n VectorHttpHandler,\n // Embedding exports\n ProviderRegistry,\n ProviderRegistryImpl,\n EmbeddingService,\n EmbeddingServiceImpl,\n CredentialReader,\n CredentialReaderImpl,\n // Tunnel and Subdomain exports\n CloudflareTunnelProvider,\n LocalTunnelProvider,\n NgrokTunnelProvider,\n SubdomainService,\n // IdP/SP separation exports\n MultiDomainIdentifierStrategy,\n SubdomainPodIdentifierStrategy,\n DisabledOidcHandler,\n DisabledIdentityProviderHandler,\n AutoDetectOidcHandler,\n AutoDetectIdentityProviderHandler,\n LoopbackClientIdAdapterFactory,\n ScopedPickWebIdHandler,\n UrlAwareRedisLocker,\n // Provision exports\n ProvisionPodCreator,\n ProvisionCodeCodec,\n LocalPodProvisioningService,\n // SolidFS recovery exports\n SqliteSolidFsSyncJournal,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,yGAAsG;AA0KpG,qHA1KO,2EAAoC,OA0KP;AAzKtC,6EAA0E;AA0KxE,kGA1KO,qCAAiB,OA0KP;AAzKnB,iGAA8F;AA0K5F,4GA1KO,yDAA2B,OA0KP;AAzK7B,mGAAgG;AA0K9F,6GA1KO,2DAA4B,OA0KP;AAzK9B,mFAAgF;AA0K9E,qGA1KO,2CAAoB,OA0KP;AAzKtB,yEAAsE;AA0KpE,gGA1KO,iCAAe,OA0KP;AAzKjB,mFAAgF;AA0K9E,0GA1KO,qDAAyB,OA0KP;AAzK3B,8EAA2E;AA2KzE,oGA3KO,yCAAmB,OA2KP;AA1KrB,0FAA2G;AA2KzG,sGA3KO,iDAAqB,OA2KP;AACrB,uGA5K8B,kDAAsB,OA4K9B;AAzIxB,6CAA2B;AAC3B,6CAA2B;AAC3B,gFAA6E;AAwI3E,0GAxIO,qDAAyB,OAwIP;AAvI3B,8EAA2E;AAwIzE,sGAxIO,6CAAqB,OAwIP;AAvIvB,mFAAgF;AAkI9E,0GAlIO,qDAAyB,OAkIP;AAjI3B,sEAAmE;AAuIjE,qGAvIO,2CAAoB,OAuIP;AAtItB,sFAAmF;AAuIjF,6GAvIO,2DAA4B,OAuIP;AAtI9B,0FAAuF;AAuIrF,+GAvIO,+DAA8B,OAuIP;AAtIhC,8EAA2E;A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GAAgG;AA0I9F,+GA1IO,+DAA8B,OA0IP;AAzIhC,mFAAgF;AA0I9E,uGA1IO,+CAAsB,OA0IP;AAzIxB,uBAAuB;AACvB,yEAAsE;AA2IpE,oGA3IO,yCAAmB,OA2IP;AA1IrB,uEAAoE;AA2IlE,mGA3IO,uCAAkB,OA2IP;AA1IpB,yFAAsF;AA2IpF,4GA3IO,yDAA2B,OA2IP;AA1I7B,qEAAwE;AA4ItE,yGA5IO,6CAAwB,OA4IP;AA1I1B,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AA2BhC,uCAAuC;AACvC,sEAAqE;AAA5D,8HAAA,qBAAqB,OAAA","sourcesContent":["import './runtime/configure-drizzle-solid';\nimport { RepresentationPartialConvertingStore } from './storage/RepresentationPartialConvertingStore';\nimport { MinioDataAccessor } from './storage/accessors/MinioDataAccessor';\nimport { QuadstoreSparqlDataAccessor } from './storage/accessors/QuadstoreSparqlDataAccessor';\nimport { QuintStoreSparqlDataAccessor } from './storage/accessors/QuintStoreSparqlDataAccessor';\nimport { SolidRdfDataAccessor } from './storage/accessors/SolidRdfDataAccessor';\nimport { MixDataAccessor } from './storage/accessors/MixDataAccessor';\nimport { ConfigurableLoggerFactory } from './logging/ConfigurableLoggerFactory';\nimport { SubgraphQueryEngine } from './storage/sparql/SubgraphQueryEngine';\nimport { QuadstoreSparqlEngine, QuintstoreSparqlEngine } from './storage/sparql/CompatibilitySparqlEngine';\nexport type { SparqlEngine } from './storage/sparql/SubgraphQueryEngine';\nexport type {\n RdfEngineLike,\n RdfEngineStorageStats,\n RdfDerivedIndexRefreshResult,\n RdfIndexStats,\n RdfIndexSpaceObject,\n RdfIndexMetrics,\n RdfIndexPutOptions,\n RdfPatternQuery,\n RdfQuadIndexOptions,\n RdfQuadIndexScanResult,\n RdfTextIndexLike,\n RdfTextIndexOptions,\n RdfTextIndexSyncLike,\n RdfVectorIndexLike,\n RdfVectorIndexOptions,\n RdfVectorIndexSyncLike,\n RdfShadowBackfillOptions,\n RdfShadowBackfillResult,\n RdfShadowDiff,\n RdfShadowScanResult,\n RdfSourceInput,\n} from './storage/rdf/types';\nexport type { RdfSparqlCompileResult } from './storage/rdf/RdfSparqlAdapter';\nexport type { RdfAccessScope } from './storage/rdf/RdfAccessScope';\nexport type { ShadowRdfQuintStoreOptions } from './storage/rdf/ShadowRdfQuintStore';\nexport type {\n SolidRdfSparqlEngineOptions,\n SolidRdfSparqlFallback,\n} from './storage/rdf/SolidRdfSparqlEngine';\nexport type { PostgresRdfEngineOptions } from './storage/rdf/PostgresRdfEngine';\nexport type { PostgresRdfTextIndexOptions } from './storage/rdf/PostgresRdfTextIndex';\nexport type { PostgresRdfVectorIndexOptions } from './storage/rdf/PostgresRdfVectorIndex';\nexport * from './document';\nexport * from './security';\nimport { SubgraphSparqlHttpHandler } from './http/SubgraphSparqlHttpHandler';\nimport { QuotaAdminHttpHandler } from './http/quota/QuotaAdminHttpHandler';\nimport { SparqlUpdateResourceStore } from './storage/SparqlUpdateResourceStore';\nimport { ClusterIngressRouter } from './http/ClusterIngressRouter';\nimport { ClusterWebSocketConfigurator } from './http/ClusterWebSocketConfigurator';\nimport { EdgeNodeDirectDebugHttpHandler } from './http/EdgeNodeDirectDebugHttpHandler';\nimport { EdgeNodeProxyHttpHandler } from './http/EdgeNodeProxyHttpHandler';\nimport { RouterHttpHandler } from './http/RouterHttpHandler';\nimport { RouterHttpRoute } from './http/RouterHttpRoute';\nimport { TracingHandler } from './http/TracingHandler';\nimport { TerminalHttpHandler } from './http/terminal/TerminalHttpHandler';\nimport { DeviceNotificationHub } from './notifications/DeviceNotificationHub';\nimport { DeviceNotificationResourceListener } from './notifications/DeviceNotificationResourceListener';\nimport { DeviceNotificationWebSocketServer } from './http/DeviceNotificationWebSocketServer';\nimport { DeviceNotificationTicketHandler } from './api/handlers/DeviceNotificationTicketHandler';\nimport { registerDeviceNotificationRuntime } from './api/handlers/DeviceNotificationRuntime';\nimport { EdgeNodeCertificateHttpHandler } from './http/admin/EdgeNodeCertificateHttpHandler';\nimport { ReservedSuffixIdentifierGenerator } from './pods/ReservedSuffixIdentifierGenerator';\nimport { DrizzleIndexedStorage } from './identity/drizzle/DrizzleIndexedStorage';\nimport { ValidatingIdentityProviderHttpHandler } from './identity/ValidatingIdentityProviderHttpHandler';\nimport { PostgresKeyValueStorage } from './storage/keyvalue/PostgresKeyValueStorage';\nimport { RedisKeyValueStorage } from './storage/keyvalue/RedisKeyValueStorage';\nimport { SqliteKeyValueStorage } from './storage/keyvalue/SqliteKeyValueStorage';\nimport { BaseKeyValueStorage } from './storage/keyvalue/BaseKeyValueStorage';\nimport { DrizzleQuotaService } from './quota/DrizzleQuotaService';\nimport { NoopQuotaService } from './quota/NoopQuotaService';\nimport { HttpEntitlementProvider, NoopEntitlementProvider } from './quota/EntitlementProvider';\nimport { PerAccountQuotaStrategy } from './storage/quota/PerAccountQuotaStrategy';\nimport { TencentDnsProvider } from './dns/tencent/TencentDnsProvider';\nimport { EdgeNodeDnsCoordinator } from './edge/EdgeNodeDnsCoordinator';\nimport { Dns01CertificateProvisioner } from './edge/Dns01CertificateProvisioner';\nimport { SimpleEdgeNodeTunnelManager, NoopEdgeNodeTunnelManager } from './edge/EdgeNodeTunnelManager';\nimport { FrpTunnelManager } from './edge/FrpTunnelManager';\nimport { AcmeCertificateManager } from './edge/acme/AcmeCertificateManager';\nimport { EdgeNodeHealthProbeService } from './edge/EdgeNodeHealthProbeService';\nimport { EdgeNodeAgent } from './edge/EdgeNodeAgent';\nimport { EdgeNodeAgentInitializer } from './edge/EdgeNodeAgentInitializer';\nimport { EdgeNodeCertificateService } from './service/EdgeNodeCertificateService';\nimport { createBandwidthThrottleTransform } from './util/stream/BandwidthThrottleTransform';\nimport { UsageTrackingStore } from './storage/quota/UsageTrackingStore';\nimport { EdgeNodeModeDetector } from './edge/EdgeNodeModeDetector';\nimport { ClusterIdentifierStrategy } from './util/identifiers/ClusterIdentifierStrategy';\nimport { CenterNodeRegistrationService } from './identity/CenterNodeRegistrationService';\nimport { PodRoutingHttpHandler } from './http/PodRoutingHttpHandler';\nimport { ReactAppViewHandler } from './identity/ReactAppViewHandler';\nimport { SqliteQuintStore } from './storage/quint/SqliteQuintStore';\nimport { PgQuintStore } from './storage/quint/PgQuintStore';\nimport { QuintStore } from './storage/quint/types';\nimport { RdfQuadIndex } from './storage/rdf/RdfQuadIndex';\nimport { Rdf3xIndex } from './storage/rdf/Rdf3xIndex';\nimport { RdfTextIndex } from './storage/rdf/RdfTextIndex';\nimport { RdfVectorIndex } from './storage/rdf/RdfVectorIndex';\nimport { PostgresRdfTextIndex } from './storage/rdf/PostgresRdfTextIndex';\nimport { PostgresRdfVectorIndex } from './storage/rdf/PostgresRdfVectorIndex';\nimport { RdfSparqlAdapter } from './storage/rdf/RdfSparqlAdapter';\nimport { RdfTermDictionary } from './storage/rdf/RdfTermDictionary';\nimport { ShadowRdfQuintStore } from './storage/rdf/ShadowRdfQuintStore';\nimport { SolidRdfEngine } from './storage/rdf/SolidRdfEngine';\nimport { PostgresRdfEngine } from './storage/rdf/PostgresRdfEngine';\nimport { SolidRdfSparqlEngine } from './storage/rdf/SolidRdfSparqlEngine';\nimport type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';\n// Vector components\nimport { SqliteVectorStore, PostgresVectorStore } from './storage/vector/index';\nimport { VectorHttpHandler } from './http/vector/VectorHttpHandler';\nimport { ProviderRegistry } from './ai/service/ProviderRegistry';\nimport { ProviderRegistryImpl } from './ai/service/ProviderRegistryImpl';\nimport { EmbeddingService } from './ai/service/EmbeddingService';\nimport { EmbeddingServiceImpl } from './ai/service/EmbeddingServiceImpl';\nimport { CredentialReader } from './ai/service/CredentialReader';\nimport { CredentialReaderImpl } from './ai/service/CredentialReaderImpl';\nimport { VectorStore } from './storage/vector/VectorStore';\n// Tunnel and Subdomain components\nimport { CloudflareTunnelProvider } from './tunnel/CloudflareTunnelProvider';\nimport { LocalTunnelProvider } from './tunnel/LocalTunnelProvider';\nimport { NgrokTunnelProvider } from './tunnel/NgrokTunnelProvider';\nimport { SubdomainService } from './subdomain/SubdomainService';\nimport { UrlAwareRedisLocker } from './storage/locking/UrlAwareRedisLocker';\n// IdP/SP separation components\nimport { MultiDomainIdentifierStrategy } from './util/identifiers/MultiDomainIdentifierStrategy';\nimport { SubdomainPodIdentifierStrategy } from './util/identifiers/SubdomainPodIdentifierStrategy';\nimport { DisabledOidcHandler } from './identity/oidc/DisabledOidcHandler';\nimport { DisabledIdentityProviderHandler } from './identity/oidc/DisabledIdentityProviderHandler';\nimport { AutoDetectOidcHandler } from './identity/oidc/AutoDetectOidcHandler';\nimport { AutoDetectIdentityProviderHandler } from './identity/oidc/AutoDetectIdentityProviderHandler';\nimport { LoopbackClientIdAdapterFactory } from './identity/oidc/LoopbackClientIdAdapterFactory';\nimport { ScopedPickWebIdHandler } from './identity/oidc/ScopedPickWebIdHandler';\n// Provision components\nimport { ProvisionPodCreator } from './provision/ProvisionPodCreator';\nimport { ProvisionCodeCodec } from './provision/ProvisionCodeCodec';\nimport { LocalPodProvisioningService } from './provision/LocalPodProvisioningService';\nimport { SqliteSolidFsSyncJournal } from './solidfs/SolidFsSyncJournal';\n\nexport * from './api/reconciler';\nexport * from './edge/reachability';\nexport * from './notifications';\n\nexport type {\n DnsProvider,\n ListDnsRecordsInput,\n ListableDnsProvider,\n DeleteDnsRecordInput,\n DnsRecordSummary,\n UpsertDnsRecordInput,\n} from './dns/DnsProvider';\nexport type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';\nexport type { EdgeNodeAgentOptions, EdgeNodeP2PAcceptEvent } from './edge/EdgeNodeAgent';\nexport type { EdgeNodeTunnelManager } from './edge/interfaces/EdgeNodeTunnelManager';\nexport type { QuotaService, AccountQuota } from './quota/QuotaService';\nexport type { EntitlementProvider, AccountEntitlement } from './quota/EntitlementProvider';\n// Tunnel and Subdomain types\nexport type {\n TunnelProvider,\n TunnelConfig,\n TunnelSetupOptions,\n TunnelStatus,\n} from './tunnel/TunnelProvider';\nexport type {\n SubdomainRegistration,\n ConnectivityResult,\n SubdomainServiceOptions,\n} from './subdomain/SubdomainService';\n// Export the new AppStaticAssetHandler\nexport { AppStaticAssetHandler } from './http/AppStaticAssetHandler';\n\nexport {\n RepresentationPartialConvertingStore,\n MinioDataAccessor,\n QuadstoreSparqlDataAccessor,\n QuintStoreSparqlDataAccessor,\n SolidRdfDataAccessor,\n MixDataAccessor,\n ConfigurableLoggerFactory,\n SparqlUpdateResourceStore,\n SubgraphQueryEngine,\n QuadstoreSparqlEngine,\n QuintstoreSparqlEngine,\n SubgraphSparqlHttpHandler,\n QuotaAdminHttpHandler,\n ClusterIngressRouter,\n ClusterWebSocketConfigurator,\n EdgeNodeDirectDebugHttpHandler,\n EdgeNodeProxyHttpHandler,\n RouterHttpHandler,\n RouterHttpRoute,\n TracingHandler,\n EdgeNodeCertificateHttpHandler,\n TerminalHttpHandler,\n DeviceNotificationHub,\n DeviceNotificationResourceListener,\n DeviceNotificationWebSocketServer,\n DeviceNotificationTicketHandler,\n registerDeviceNotificationRuntime,\n ReservedSuffixIdentifierGenerator,\n DrizzleIndexedStorage,\n ValidatingIdentityProviderHttpHandler,\n PostgresKeyValueStorage,\n RedisKeyValueStorage,\n SqliteKeyValueStorage,\n BaseKeyValueStorage,\n DrizzleQuotaService,\n NoopQuotaService,\n HttpEntitlementProvider,\n NoopEntitlementProvider,\n PerAccountQuotaStrategy,\n TencentDnsProvider,\n EdgeNodeDnsCoordinator,\n Dns01CertificateProvisioner,\n SimpleEdgeNodeTunnelManager,\n NoopEdgeNodeTunnelManager,\n FrpTunnelManager,\n EdgeNodeHealthProbeService,\n EdgeNodeAgent,\n EdgeNodeAgentInitializer,\n EdgeNodeCertificateService,\n AcmeCertificateManager,\n EdgeNodeModeDetector,\n ClusterIdentifierStrategy,\n UsageTrackingStore,\n CenterNodeRegistrationService,\n PodRoutingHttpHandler,\n ReactAppViewHandler,\n // Quint exports\n QuintStore,\n SqliteQuintStore,\n PgQuintStore,\n // RDF engine exports\n RdfTermDictionary,\n RdfQuadIndex,\n Rdf3xIndex,\n RdfTextIndex,\n RdfVectorIndex,\n PostgresRdfTextIndex,\n PostgresRdfVectorIndex,\n RdfSparqlAdapter,\n ShadowRdfQuintStore,\n SolidRdfEngine,\n PostgresRdfEngine,\n SolidRdfSparqlEngine,\n // Vector exports\n VectorStore,\n SqliteVectorStore,\n PostgresVectorStore,\n VectorHttpHandler,\n // Embedding exports\n ProviderRegistry,\n ProviderRegistryImpl,\n EmbeddingService,\n EmbeddingServiceImpl,\n CredentialReader,\n CredentialReaderImpl,\n // Tunnel and Subdomain exports\n CloudflareTunnelProvider,\n LocalTunnelProvider,\n NgrokTunnelProvider,\n SubdomainService,\n // IdP/SP separation exports\n MultiDomainIdentifierStrategy,\n SubdomainPodIdentifierStrategy,\n DisabledOidcHandler,\n DisabledIdentityProviderHandler,\n AutoDetectOidcHandler,\n AutoDetectIdentityProviderHandler,\n LoopbackClientIdAdapterFactory,\n ScopedPickWebIdHandler,\n UrlAwareRedisLocker,\n // Provision exports\n ProvisionPodCreator,\n ProvisionCodeCodec,\n LocalPodProvisioningService,\n // SolidFS recovery exports\n SqliteSolidFsSyncJournal,\n};\n"]}
@@ -0,0 +1,74 @@
1
+ import type { DeviceNotificationOperation, DeviceNotificationServerFrame } from './device-notification-protocol';
2
+ import type { DeviceNotificationIdentity } from '../api/handlers/DeviceNotificationTicketHandler';
3
+ export interface DeviceNotificationHubOptions {
4
+ origin: string;
5
+ maxTopicsPerConnection?: number;
6
+ maxQueueMessages?: number;
7
+ maxReplayEvents?: number;
8
+ authorizeTopic?: (input: {
9
+ identity: DeviceNotificationIdentity;
10
+ topic: string;
11
+ }) => boolean | Promise<boolean>;
12
+ }
13
+ export interface OpenDeviceNotificationConnectionInput {
14
+ identity: DeviceNotificationIdentity;
15
+ deviceSessionId: string;
16
+ send: (frame: DeviceNotificationServerFrame) => boolean;
17
+ close?: (code: number, reason: string) => void;
18
+ }
19
+ export interface DeviceNotificationConnectionHandle {
20
+ connectionId: string;
21
+ }
22
+ export interface DeviceNotificationPublishInput {
23
+ topic: string;
24
+ object?: string;
25
+ operation: DeviceNotificationOperation;
26
+ }
27
+ type EventFrame = Extract<DeviceNotificationServerFrame, {
28
+ type: 'event';
29
+ }>;
30
+ export declare class DeviceNotificationHub {
31
+ private readonly origin;
32
+ private readonly maxTopicsPerConnection;
33
+ private readonly maxQueueMessages;
34
+ private readonly maxReplayEvents;
35
+ private readonly authorizeTopic;
36
+ private readonly connections;
37
+ private readonly connectionsByDevice;
38
+ private readonly topicMembers;
39
+ private readonly replay;
40
+ private sequence;
41
+ constructor(options: DeviceNotificationHubOptions);
42
+ openConnection(input: OpenDeviceNotificationConnectionInput): DeviceNotificationConnectionHandle;
43
+ hello(connectionId: string, resumeFrom?: number): DeviceNotificationServerFrame;
44
+ registerTopics(connectionId: string, requestId: string, topics: string[]): Promise<DeviceNotificationServerFrame>;
45
+ unregisterTopics(connectionId: string, requestId: string, topics: string[]): Promise<DeviceNotificationServerFrame>;
46
+ ack(connectionId: string, sequence: number): void;
47
+ publish(input: DeviceNotificationPublishInput): EventFrame;
48
+ resume(connectionId: string, resumeFrom: number): EventFrame[] | DeviceNotificationServerFrame;
49
+ closeConnection(connectionId: string, code?: number, reason?: string): void;
50
+ getSeenRequestIds(connectionId: string): Set<string>;
51
+ getTopicMemberCount(topic: string): number;
52
+ getConnectionSnapshot(connectionId: string): {
53
+ topicCount: number;
54
+ topics: string[];
55
+ queueLength: number;
56
+ resyncTopics: string[];
57
+ lastAck: number;
58
+ } | undefined;
59
+ private deliver;
60
+ private deliverPendingResume;
61
+ private enqueue;
62
+ private coalesceEvent;
63
+ private markOverflow;
64
+ private pushReplay;
65
+ private matchingMemberIds;
66
+ private connectionMatches;
67
+ private topicMatches;
68
+ private assertNewRequestId;
69
+ private normalizeTopic;
70
+ private normalizeResource;
71
+ private requireConnection;
72
+ private deviceConnectionKey;
73
+ }
74
+ export {};
@@ -0,0 +1,313 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeviceNotificationHub = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const DEFAULT_MAX_TOPICS_PER_CONNECTION = 100;
6
+ const DEFAULT_MAX_QUEUE_MESSAGES = 256;
7
+ const DEFAULT_MAX_REPLAY_EVENTS = 512;
8
+ class DeviceNotificationHub {
9
+ constructor(options) {
10
+ this.connections = new Map();
11
+ this.connectionsByDevice = new Map();
12
+ this.topicMembers = new Map();
13
+ this.replay = [];
14
+ this.sequence = 0;
15
+ this.origin = new URL(options.origin);
16
+ this.maxTopicsPerConnection = options.maxTopicsPerConnection ?? DEFAULT_MAX_TOPICS_PER_CONNECTION;
17
+ this.maxQueueMessages = options.maxQueueMessages ?? DEFAULT_MAX_QUEUE_MESSAGES;
18
+ this.maxReplayEvents = options.maxReplayEvents ?? DEFAULT_MAX_REPLAY_EVENTS;
19
+ this.authorizeTopic = options.authorizeTopic ?? (() => true);
20
+ }
21
+ openConnection(input) {
22
+ const deviceKey = this.deviceConnectionKey(input.identity, input.deviceSessionId);
23
+ const existingConnectionId = this.connectionsByDevice.get(deviceKey);
24
+ if (existingConnectionId) {
25
+ this.closeConnection(existingConnectionId, 4000, 'Replaced by newer device connection');
26
+ }
27
+ const connectionId = (0, node_crypto_1.randomUUID)();
28
+ this.connections.set(connectionId, {
29
+ connectionId,
30
+ identity: input.identity,
31
+ deviceSessionId: input.deviceSessionId,
32
+ topics: new Set(),
33
+ queue: [],
34
+ resyncTopics: new Set(),
35
+ resyncQueued: new Set(),
36
+ seenRequestIds: new Set(),
37
+ lastAck: 0,
38
+ pendingResumeFrom: undefined,
39
+ send: input.send,
40
+ close: input.close,
41
+ });
42
+ this.connectionsByDevice.set(deviceKey, connectionId);
43
+ return { connectionId };
44
+ }
45
+ hello(connectionId, resumeFrom) {
46
+ const connection = this.requireConnection(connectionId);
47
+ const ready = {
48
+ type: 'ready',
49
+ connectionId,
50
+ sequence: this.sequence,
51
+ };
52
+ this.deliver(connection, ready);
53
+ if (resumeFrom !== undefined) {
54
+ connection.pendingResumeFrom = resumeFrom;
55
+ }
56
+ return ready;
57
+ }
58
+ async registerTopics(connectionId, requestId, topics) {
59
+ const connection = this.requireConnection(connectionId);
60
+ this.assertNewRequestId(connection, requestId);
61
+ const normalizedTopics = topics.map((topic) => this.normalizeTopic(topic));
62
+ if ((new Set([...connection.topics, ...normalizedTopics])).size > this.maxTopicsPerConnection) {
63
+ throw new Error('Too many topics for connection');
64
+ }
65
+ for (const topic of normalizedTopics) {
66
+ if (!await this.authorizeTopic({ identity: connection.identity, topic })) {
67
+ throw new Error(`Topic not authorized: ${topic}`);
68
+ }
69
+ connection.topics.add(topic);
70
+ if (!this.topicMembers.has(topic)) {
71
+ this.topicMembers.set(topic, new Set());
72
+ }
73
+ this.topicMembers.get(topic).add(connectionId);
74
+ }
75
+ const frame = {
76
+ type: 'registered',
77
+ requestId,
78
+ topics: normalizedTopics,
79
+ };
80
+ this.deliver(connection, frame);
81
+ this.deliverPendingResume(connection);
82
+ return frame;
83
+ }
84
+ async unregisterTopics(connectionId, requestId, topics) {
85
+ const connection = this.requireConnection(connectionId);
86
+ this.assertNewRequestId(connection, requestId);
87
+ const normalizedTopics = topics.map((topic) => this.normalizeTopic(topic));
88
+ for (const topic of normalizedTopics) {
89
+ connection.topics.delete(topic);
90
+ const members = this.topicMembers.get(topic);
91
+ members?.delete(connectionId);
92
+ if (members?.size === 0) {
93
+ this.topicMembers.delete(topic);
94
+ }
95
+ }
96
+ const frame = {
97
+ type: 'unregistered',
98
+ requestId,
99
+ topics: normalizedTopics,
100
+ };
101
+ this.deliver(connection, frame);
102
+ return frame;
103
+ }
104
+ ack(connectionId, sequence) {
105
+ const connection = this.requireConnection(connectionId);
106
+ connection.lastAck = Math.max(connection.lastAck, sequence);
107
+ connection.queue = connection.queue.filter((frame) => frame.type !== 'event' || frame.sequence > sequence);
108
+ }
109
+ publish(input) {
110
+ const topic = this.normalizeTopic(input.topic);
111
+ const event = {
112
+ type: 'event',
113
+ sequence: ++this.sequence,
114
+ eventId: `urn:uuid:${(0, node_crypto_1.randomUUID)()}`,
115
+ topic,
116
+ ...(input.object ? { object: this.normalizeResource(input.object) } : {}),
117
+ operation: input.operation,
118
+ emittedAt: new Date().toISOString(),
119
+ };
120
+ this.pushReplay(event);
121
+ const memberIds = this.matchingMemberIds(topic, event.object);
122
+ for (const connectionId of memberIds) {
123
+ const connection = this.connections.get(connectionId);
124
+ if (!connection) {
125
+ continue;
126
+ }
127
+ this.deliver(connection, event);
128
+ }
129
+ return event;
130
+ }
131
+ resume(connectionId, resumeFrom) {
132
+ const connection = this.requireConnection(connectionId);
133
+ if (this.replay.length === 0) {
134
+ return [];
135
+ }
136
+ const oldest = this.replay[0].sequence;
137
+ if (resumeFrom < oldest) {
138
+ return {
139
+ type: 'resync-required',
140
+ topics: [...connection.topics].sort(),
141
+ reason: 'expired',
142
+ };
143
+ }
144
+ return this.replay
145
+ .filter((event) => event.sequence > resumeFrom)
146
+ .filter((event) => this.connectionMatches(connection, event.topic, event.object));
147
+ }
148
+ closeConnection(connectionId, code, reason) {
149
+ const connection = this.connections.get(connectionId);
150
+ if (!connection) {
151
+ return;
152
+ }
153
+ if (code !== undefined && reason !== undefined) {
154
+ connection.close?.(code, reason);
155
+ }
156
+ for (const topic of connection.topics) {
157
+ const members = this.topicMembers.get(topic);
158
+ members?.delete(connectionId);
159
+ if (members?.size === 0) {
160
+ this.topicMembers.delete(topic);
161
+ }
162
+ }
163
+ this.connections.delete(connectionId);
164
+ this.connectionsByDevice.delete(this.deviceConnectionKey(connection.identity, connection.deviceSessionId));
165
+ }
166
+ getSeenRequestIds(connectionId) {
167
+ return this.requireConnection(connectionId).seenRequestIds;
168
+ }
169
+ getTopicMemberCount(topic) {
170
+ return this.topicMembers.get(this.normalizeTopic(topic))?.size ?? 0;
171
+ }
172
+ getConnectionSnapshot(connectionId) {
173
+ const connection = this.connections.get(connectionId);
174
+ if (!connection) {
175
+ return undefined;
176
+ }
177
+ return {
178
+ topicCount: connection.topics.size,
179
+ topics: [...connection.topics].sort(),
180
+ queueLength: connection.queue.length,
181
+ resyncTopics: [...connection.resyncTopics].sort(),
182
+ lastAck: connection.lastAck,
183
+ };
184
+ }
185
+ deliver(connection, frame) {
186
+ if (connection.send(frame)) {
187
+ return;
188
+ }
189
+ this.enqueue(connection, frame);
190
+ }
191
+ deliverPendingResume(connection) {
192
+ if (connection.pendingResumeFrom === undefined) {
193
+ return;
194
+ }
195
+ const resumeFrom = connection.pendingResumeFrom;
196
+ connection.pendingResumeFrom = undefined;
197
+ const replay = this.resume(connection.connectionId, resumeFrom);
198
+ if (Array.isArray(replay)) {
199
+ for (const frame of replay) {
200
+ this.deliver(connection, frame);
201
+ }
202
+ }
203
+ else {
204
+ this.deliver(connection, replay);
205
+ }
206
+ }
207
+ enqueue(connection, frame) {
208
+ if (frame.type === 'event') {
209
+ this.coalesceEvent(connection, frame);
210
+ }
211
+ else {
212
+ connection.queue.push(frame);
213
+ }
214
+ if (connection.queue.length > this.maxQueueMessages) {
215
+ this.markOverflow(connection, frame);
216
+ }
217
+ }
218
+ coalesceEvent(connection, frame) {
219
+ const index = connection.queue.findIndex((queued) => queued.type === 'event' && queued.topic === frame.topic && queued.object === frame.object);
220
+ if (index === -1) {
221
+ connection.queue.push(frame);
222
+ return;
223
+ }
224
+ const previous = connection.queue[index];
225
+ connection.queue[index] = {
226
+ ...frame,
227
+ operation: previous.operation === 'delete' ? 'delete' : frame.operation,
228
+ };
229
+ }
230
+ markOverflow(connection, frame) {
231
+ const topics = frame.type === 'event' ? [frame.topic] : [...connection.topics];
232
+ for (const topic of topics) {
233
+ connection.resyncTopics.add(topic);
234
+ if (!connection.resyncQueued.has(topic)) {
235
+ connection.queue.push({
236
+ type: 'resync-required',
237
+ topics: [topic],
238
+ reason: 'overflow',
239
+ });
240
+ connection.resyncQueued.add(topic);
241
+ }
242
+ }
243
+ while (connection.queue.length > this.maxQueueMessages) {
244
+ const dropped = connection.queue.findIndex((queued) => queued.type === 'event');
245
+ connection.queue.splice(dropped === -1 ? 0 : dropped, 1);
246
+ }
247
+ }
248
+ pushReplay(event) {
249
+ this.replay.push(event);
250
+ while (this.replay.length > this.maxReplayEvents) {
251
+ this.replay.shift();
252
+ }
253
+ }
254
+ matchingMemberIds(topic, object) {
255
+ const ids = new Set();
256
+ for (const [registeredTopic, members] of this.topicMembers) {
257
+ if (this.topicMatches(registeredTopic, topic, object)) {
258
+ for (const member of members) {
259
+ ids.add(member);
260
+ }
261
+ }
262
+ }
263
+ return ids;
264
+ }
265
+ connectionMatches(connection, topic, object) {
266
+ for (const registeredTopic of connection.topics) {
267
+ if (this.topicMatches(registeredTopic, topic, object)) {
268
+ return true;
269
+ }
270
+ }
271
+ return false;
272
+ }
273
+ topicMatches(registeredTopic, eventTopic, object) {
274
+ return eventTopic === registeredTopic ||
275
+ object === registeredTopic ||
276
+ Boolean(object && registeredTopic.endsWith('/') && object.startsWith(registeredTopic));
277
+ }
278
+ assertNewRequestId(connection, requestId) {
279
+ if (connection.seenRequestIds.has(requestId)) {
280
+ throw new Error(`Duplicate requestId: ${requestId}`);
281
+ }
282
+ connection.seenRequestIds.add(requestId);
283
+ }
284
+ normalizeTopic(topic) {
285
+ const url = new URL(topic, this.origin);
286
+ if (url.origin !== this.origin.origin) {
287
+ throw new Error('topic must be same-origin');
288
+ }
289
+ url.hash = '';
290
+ url.search = '';
291
+ return url.toString();
292
+ }
293
+ normalizeResource(resource) {
294
+ const url = new URL(resource, this.origin);
295
+ if (url.origin !== this.origin.origin) {
296
+ throw new Error('resource must be same-origin');
297
+ }
298
+ url.hash = '';
299
+ return url.toString();
300
+ }
301
+ requireConnection(connectionId) {
302
+ const connection = this.connections.get(connectionId);
303
+ if (!connection) {
304
+ throw new Error(`Unknown notification connection: ${connectionId}`);
305
+ }
306
+ return connection;
307
+ }
308
+ deviceConnectionKey(identity, deviceSessionId) {
309
+ return `${identity.webId}\u0000${deviceSessionId}`;
310
+ }
311
+ }
312
+ exports.DeviceNotificationHub = DeviceNotificationHub;
313
+ //# sourceMappingURL=DeviceNotificationHub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceNotificationHub.js","sourceRoot":"","sources":["../../src/notifications/DeviceNotificationHub.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAiDzC,MAAM,iCAAiC,GAAG,GAAG,CAAC;AAC9C,MAAM,0BAA0B,GAAG,GAAG,CAAC;AACvC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAEtC,MAAa,qBAAqB;IAYhC,YAAmB,OAAqC;QANvC,gBAAW,GAAG,IAAI,GAAG,EAA2B,CAAC;QACjD,wBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAC;QAChD,iBAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC9C,WAAM,GAAiB,EAAE,CAAC;QACnC,aAAQ,GAAG,CAAC,CAAC;QAGnB,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,IAAI,iCAAiC,CAAC;QAClG,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,0BAA0B,CAAC;QAC/E,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,yBAAyB,CAAC;QAC5E,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAEM,cAAc,CAAC,KAA4C;QAChE,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;QAClF,MAAM,oBAAoB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACrE,IAAI,oBAAoB,EAA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,MAAM,IAAI,KAAK,CAAC,oCAAoC,YAAY,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAEO,mBAAmB,CAAC,QAAoC,EAAE,eAAuB;QACvF,OAAO,GAAG,QAAQ,CAAC,KAAK,SAAS,eAAe,EAAE,CAAC;IACrD,CAAC;CACF;AAnVD,sDAmVC","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport type {\n DeviceNotificationOperation,\n DeviceNotificationServerFrame,\n} from './device-notification-protocol';\nimport type { DeviceNotificationIdentity } from '../api/handlers/DeviceNotificationTicketHandler';\n\nexport interface DeviceNotificationHubOptions {\n origin: string;\n maxTopicsPerConnection?: number;\n maxQueueMessages?: number;\n maxReplayEvents?: number;\n authorizeTopic?: (input: { identity: DeviceNotificationIdentity; topic: string }) => boolean | Promise<boolean>;\n}\n\nexport interface OpenDeviceNotificationConnectionInput {\n identity: DeviceNotificationIdentity;\n deviceSessionId: string;\n send: (frame: DeviceNotificationServerFrame) => boolean;\n close?: (code: number, reason: string) => void;\n}\n\nexport interface DeviceNotificationConnectionHandle {\n connectionId: string;\n}\n\nexport interface DeviceNotificationPublishInput {\n topic: string;\n object?: string;\n operation: DeviceNotificationOperation;\n}\n\ninterface ConnectionState {\n connectionId: string;\n identity: DeviceNotificationIdentity;\n deviceSessionId: string;\n topics: Set<string>;\n queue: DeviceNotificationServerFrame[];\n resyncTopics: Set<string>;\n resyncQueued: Set<string>;\n seenRequestIds: Set<string>;\n lastAck: number;\n pendingResumeFrom?: number;\n send: (frame: DeviceNotificationServerFrame) => boolean;\n close?: (code: number, reason: string) => void;\n}\n\ntype EventFrame = Extract<DeviceNotificationServerFrame, { type: 'event' }>;\n\nconst DEFAULT_MAX_TOPICS_PER_CONNECTION = 100;\nconst DEFAULT_MAX_QUEUE_MESSAGES = 256;\nconst DEFAULT_MAX_REPLAY_EVENTS = 512;\n\nexport class DeviceNotificationHub {\n private readonly origin: URL;\n private readonly maxTopicsPerConnection: number;\n private readonly maxQueueMessages: number;\n private readonly maxReplayEvents: number;\n private readonly authorizeTopic: (input: { identity: DeviceNotificationIdentity; topic: string }) => boolean | Promise<boolean>;\n private readonly connections = new Map<string, ConnectionState>();\n private readonly connectionsByDevice = new Map<string, string>();\n private readonly topicMembers = new Map<string, Set<string>>();\n private readonly replay: EventFrame[] = [];\n private sequence = 0;\n\n public constructor(options: DeviceNotificationHubOptions) {\n this.origin = new URL(options.origin);\n this.maxTopicsPerConnection = options.maxTopicsPerConnection ?? DEFAULT_MAX_TOPICS_PER_CONNECTION;\n this.maxQueueMessages = options.maxQueueMessages ?? DEFAULT_MAX_QUEUE_MESSAGES;\n this.maxReplayEvents = options.maxReplayEvents ?? DEFAULT_MAX_REPLAY_EVENTS;\n this.authorizeTopic = options.authorizeTopic ?? (() => true);\n }\n\n public openConnection(input: OpenDeviceNotificationConnectionInput): DeviceNotificationConnectionHandle {\n const deviceKey = this.deviceConnectionKey(input.identity, input.deviceSessionId);\n const existingConnectionId = this.connectionsByDevice.get(deviceKey);\n if (existingConnectionId) {\n this.closeConnection(existingConnectionId, 4000, 'Replaced by newer device connection');\n }\n const connectionId = randomUUID();\n this.connections.set(connectionId, {\n connectionId,\n identity: input.identity,\n deviceSessionId: input.deviceSessionId,\n topics: new Set(),\n queue: [],\n resyncTopics: new Set(),\n resyncQueued: new Set(),\n seenRequestIds: new Set(),\n lastAck: 0,\n pendingResumeFrom: undefined,\n send: input.send,\n close: input.close,\n });\n this.connectionsByDevice.set(deviceKey, connectionId);\n return { connectionId };\n }\n\n public hello(connectionId: string, resumeFrom?: number): DeviceNotificationServerFrame {\n const connection = this.requireConnection(connectionId);\n const ready: DeviceNotificationServerFrame = {\n type: 'ready',\n connectionId,\n sequence: this.sequence,\n };\n this.deliver(connection, ready);\n if (resumeFrom !== undefined) {\n connection.pendingResumeFrom = resumeFrom;\n }\n return ready;\n }\n\n public async registerTopics(connectionId: string, requestId: string, topics: string[]): Promise<DeviceNotificationServerFrame> {\n const connection = this.requireConnection(connectionId);\n this.assertNewRequestId(connection, requestId);\n const normalizedTopics = topics.map((topic) => this.normalizeTopic(topic));\n if ((new Set([...connection.topics, ...normalizedTopics])).size > this.maxTopicsPerConnection) {\n throw new Error('Too many topics for connection');\n }\n for (const topic of normalizedTopics) {\n if (!await this.authorizeTopic({ identity: connection.identity, topic })) {\n throw new Error(`Topic not authorized: ${topic}`);\n }\n connection.topics.add(topic);\n if (!this.topicMembers.has(topic)) {\n this.topicMembers.set(topic, new Set());\n }\n this.topicMembers.get(topic)!.add(connectionId);\n }\n const frame: DeviceNotificationServerFrame = {\n type: 'registered',\n requestId,\n topics: normalizedTopics,\n };\n this.deliver(connection, frame);\n this.deliverPendingResume(connection);\n return frame;\n }\n\n public async unregisterTopics(connectionId: string, requestId: string, topics: string[]): Promise<DeviceNotificationServerFrame> {\n const connection = this.requireConnection(connectionId);\n this.assertNewRequestId(connection, requestId);\n const normalizedTopics = topics.map((topic) => this.normalizeTopic(topic));\n for (const topic of normalizedTopics) {\n connection.topics.delete(topic);\n const members = this.topicMembers.get(topic);\n members?.delete(connectionId);\n if (members?.size === 0) {\n this.topicMembers.delete(topic);\n }\n }\n const frame: DeviceNotificationServerFrame = {\n type: 'unregistered',\n requestId,\n topics: normalizedTopics,\n };\n this.deliver(connection, frame);\n return frame;\n }\n\n public ack(connectionId: string, sequence: number): void {\n const connection = this.requireConnection(connectionId);\n connection.lastAck = Math.max(connection.lastAck, sequence);\n connection.queue = connection.queue.filter((frame) => frame.type !== 'event' || frame.sequence > sequence);\n }\n\n public publish(input: DeviceNotificationPublishInput): EventFrame {\n const topic = this.normalizeTopic(input.topic);\n const event: EventFrame = {\n type: 'event',\n sequence: ++this.sequence,\n eventId: `urn:uuid:${randomUUID()}`,\n topic,\n ...(input.object ? { object: this.normalizeResource(input.object) } : {}),\n operation: input.operation,\n emittedAt: new Date().toISOString(),\n };\n this.pushReplay(event);\n const memberIds = this.matchingMemberIds(topic, event.object);\n for (const connectionId of memberIds) {\n const connection = this.connections.get(connectionId);\n if (!connection) {\n continue;\n }\n this.deliver(connection, event);\n }\n return event;\n }\n\n public resume(connectionId: string, resumeFrom: number): EventFrame[] | DeviceNotificationServerFrame {\n const connection = this.requireConnection(connectionId);\n if (this.replay.length === 0) {\n return [];\n }\n const oldest = this.replay[0].sequence;\n if (resumeFrom < oldest) {\n return {\n type: 'resync-required',\n topics: [...connection.topics].sort(),\n reason: 'expired',\n };\n }\n return this.replay\n .filter((event) => event.sequence > resumeFrom)\n .filter((event) => this.connectionMatches(connection, event.topic, event.object));\n }\n\n public closeConnection(connectionId: string, code?: number, reason?: string): void {\n const connection = this.connections.get(connectionId);\n if (!connection) {\n return;\n }\n if (code !== undefined && reason !== undefined) {\n connection.close?.(code, reason);\n }\n for (const topic of connection.topics) {\n const members = this.topicMembers.get(topic);\n members?.delete(connectionId);\n if (members?.size === 0) {\n this.topicMembers.delete(topic);\n }\n }\n this.connections.delete(connectionId);\n this.connectionsByDevice.delete(this.deviceConnectionKey(connection.identity, connection.deviceSessionId));\n }\n\n public getSeenRequestIds(connectionId: string): Set<string> {\n return this.requireConnection(connectionId).seenRequestIds;\n }\n\n public getTopicMemberCount(topic: string): number {\n return this.topicMembers.get(this.normalizeTopic(topic))?.size ?? 0;\n }\n\n public getConnectionSnapshot(connectionId: string): {\n topicCount: number;\n topics: string[];\n queueLength: number;\n resyncTopics: string[];\n lastAck: number;\n } | undefined {\n const connection = this.connections.get(connectionId);\n if (!connection) {\n return undefined;\n }\n return {\n topicCount: connection.topics.size,\n topics: [...connection.topics].sort(),\n queueLength: connection.queue.length,\n resyncTopics: [...connection.resyncTopics].sort(),\n lastAck: connection.lastAck,\n };\n }\n\n private deliver(connection: ConnectionState, frame: DeviceNotificationServerFrame): void {\n if (connection.send(frame)) {\n return;\n }\n this.enqueue(connection, frame);\n }\n\n private deliverPendingResume(connection: ConnectionState): void {\n if (connection.pendingResumeFrom === undefined) {\n return;\n }\n const resumeFrom = connection.pendingResumeFrom;\n connection.pendingResumeFrom = undefined;\n const replay = this.resume(connection.connectionId, resumeFrom);\n if (Array.isArray(replay)) {\n for (const frame of replay) {\n this.deliver(connection, frame);\n }\n } else {\n this.deliver(connection, replay);\n }\n }\n\n private enqueue(connection: ConnectionState, frame: DeviceNotificationServerFrame): void {\n if (frame.type === 'event') {\n this.coalesceEvent(connection, frame);\n } else {\n connection.queue.push(frame);\n }\n if (connection.queue.length > this.maxQueueMessages) {\n this.markOverflow(connection, frame);\n }\n }\n\n private coalesceEvent(connection: ConnectionState, frame: EventFrame): void {\n const index = connection.queue.findIndex((queued) =>\n queued.type === 'event' && queued.topic === frame.topic && queued.object === frame.object);\n if (index === -1) {\n connection.queue.push(frame);\n return;\n }\n const previous = connection.queue[index] as EventFrame;\n connection.queue[index] = {\n ...frame,\n operation: previous.operation === 'delete' ? 'delete' : frame.operation,\n };\n }\n\n private markOverflow(connection: ConnectionState, frame: DeviceNotificationServerFrame): void {\n const topics = frame.type === 'event' ? [frame.topic] : [...connection.topics];\n for (const topic of topics) {\n connection.resyncTopics.add(topic);\n if (!connection.resyncQueued.has(topic)) {\n connection.queue.push({\n type: 'resync-required',\n topics: [topic],\n reason: 'overflow',\n });\n connection.resyncQueued.add(topic);\n }\n }\n while (connection.queue.length > this.maxQueueMessages) {\n const dropped = connection.queue.findIndex((queued) => queued.type === 'event');\n connection.queue.splice(dropped === -1 ? 0 : dropped, 1);\n }\n }\n\n private pushReplay(event: EventFrame): void {\n this.replay.push(event);\n while (this.replay.length > this.maxReplayEvents) {\n this.replay.shift();\n }\n }\n\n private matchingMemberIds(topic: string, object?: string): Set<string> {\n const ids = new Set<string>();\n for (const [registeredTopic, members] of this.topicMembers) {\n if (this.topicMatches(registeredTopic, topic, object)) {\n for (const member of members) {\n ids.add(member);\n }\n }\n }\n return ids;\n }\n\n private connectionMatches(connection: ConnectionState, topic: string, object?: string): boolean {\n for (const registeredTopic of connection.topics) {\n if (this.topicMatches(registeredTopic, topic, object)) {\n return true;\n }\n }\n return false;\n }\n\n private topicMatches(registeredTopic: string, eventTopic: string, object?: string): boolean {\n return eventTopic === registeredTopic ||\n object === registeredTopic ||\n Boolean(object && registeredTopic.endsWith('/') && object.startsWith(registeredTopic));\n }\n\n private assertNewRequestId(connection: ConnectionState, requestId: string): void {\n if (connection.seenRequestIds.has(requestId)) {\n throw new Error(`Duplicate requestId: ${requestId}`);\n }\n connection.seenRequestIds.add(requestId);\n }\n\n private normalizeTopic(topic: string): string {\n const url = new URL(topic, this.origin);\n if (url.origin !== this.origin.origin) {\n throw new Error('topic must be same-origin');\n }\n url.hash = '';\n url.search = '';\n return url.toString();\n }\n\n private normalizeResource(resource: string): string {\n const url = new URL(resource, this.origin);\n if (url.origin !== this.origin.origin) {\n throw new Error('resource must be same-origin');\n }\n url.hash = '';\n return url.toString();\n }\n\n private requireConnection(connectionId: string): ConnectionState {\n const connection = this.connections.get(connectionId);\n if (!connection) {\n throw new Error(`Unknown notification connection: ${connectionId}`);\n }\n return connection;\n }\n\n private deviceConnectionKey(identity: DeviceNotificationIdentity, deviceSessionId: string): string {\n return `${identity.webId}\\u0000${deviceSessionId}`;\n }\n}\n"]}