Bridges entered a crash loop after the dev Pryv (demo.datasafe.dev) started returning :_system:account (level none) as the first entry in accessInfo().permissions, pushing the real { streamId: 'bridge', level: 'manage' } entry to index 1. The previous check looked at permissions[0] only and also read settings.mainStreamId before it had been assigned (so the comparison was effectively against null, and the error message read … on stream null).
src/lib/bridgeAccount.ts: assignsettings.mainStreamId(and derived stream IDs) before the access check, then verify by searching the fullpermissionsarray for an entry matchingmainStreamIdwithlevel === 'manage'instead of relying on index0.
No API change. Bumps patch.
Public helper for bridges to provision their {appId}-app/ subtree on a user account in one call, replacing per-bridge boilerplate.
import { ensureAppStreamsTree } from 'lib-bridge-js';
const { appStreamId, subStreamIds } = await ensureAppStreamsTree(hdsConnection, {
appId: 'bridge-mira',
baseName: 'Mira App',
parentId: 'bridge-mira', // optional: child of an existing base stream
subStreams: [
{ suffix: 'notes', name: 'Notes' }, // → bridge-mira-app-notes
{ suffix: 'chat', name: 'Chat', // → bridge-mira-app-chat
clientData: { hdsCustomField: { /* ... */ } } // optional clientData per substream
}
]
});- Idempotent — tolerates
item-already-existsonstreams.create. - Returns
{ appStreamId: '${appId}-app', subStreamIds: { suffix: fullId, ... } }so callers can attachclientData.appStreamIdon the bridge access (viaappTemplates.ensureBridgeAccess) and post events to specific substreams. - Validates
appIdand substreamsuffixare non-empty strings. - 9 tests in
tests/appStreams.test.tscovering root-only / parentId / baseName / substreams / clientData passthrough / idempotency / hard-error rejection / input validation.
Closes Plan 25's final import to Plan 45 Phase 9. bridge-mira will be the first consumer (separate commit there).
- Updated hds-lib dependency to 0.2.0 (converter engine support)
- Removed
dist/from git (rebuilt byprepareon install) - Added re-exports for bridge consumers (pryv, Router, ShortUniqueId, initHDSModel, getHDSModel)
- Exported
getLoggerfor plugin use
- Shared cluster cache abstraction (memored)
/statusroute returning name, version, uptime from package.json- Build step with separate test export
exportsfield for ESM resolution
- Upgraded to Node 24
- Removed legacy auto-run from
start.ts - Replaced boiler (github fork) with
@pryv/boiler@^1.2.6from npm - Renamed from bridge-hds to lib-bridge-js
- Migrated to TypeScript with ESM
- Fixed TypeScript migration issues
- Aligned linting configuration
- Added backloop.dev support
- Updated HDSLib dependency
- Updated to new
getModelsyntax - Removed superagent, using HDSService directly
- Account connection access for plugins
- Conversion system for data transformation
- Removed direct pryv package, relying on embedded pryv in hds-lib
- Plugin version tracking
userApiEndpointsaccessor- Status warning support
- User existence check during onboarding
- Initial release
- Generic partner bridge framework for HDS
- Plugin-based architecture with OO design
- User onboarding flow with partner authentication
- Webhook support for real-time data sync
- Stream structure and permission configuration
- Bridge access creation and management
- Data sample routes for testing
- Test suite with local server capture
- Comprehensive documentation with flow diagrams