mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
Implements the full client surface natively in @hanzo/base. No more
'pocketbase': '^0.26.5' dependency, no compat-via-reexport, no
wrapper. The npm package now stands alone.
Native additions to core/:
- core/types.ts: CollectionField, CollectionModel, RecordModel
(admin UI schema types — were imported from 'pocketbase' before)
- core/auth-stores.ts: LocalAuthStore (localStorage-backed),
AsyncAuthStore (any async backend), BaseAuthStore type alias
- core/tokens.ts: getTokenPayload, isTokenExpired, cookieParse,
cookieSerialize, normalizeUnknownQueryParams
- core/index.ts: default export = BaseClient so
`import Base from '@hanzo/base'` works as a drop-in for the
upstream default
compat/index.ts: re-exports from our own core/ (not from upstream
pocketbase). The exports surface is identical, so consumers
migrating an existing app only need to change the specifier:
- import Base, { LocalAuthStore } from 'pocketbase'
+ import Base, { LocalAuthStore } from '@hanzo/base/compat'
ui-react/ migration:
- src/lib/base.ts: import { BaseClient } from '@hanzo/base';
new BaseClient(url) (was: import PocketBase from 'pocketbase')
- 4 routes files: CollectionModel/CollectionField/RecordModel
now imported from '@hanzo/base'
- PocketBase mentions in comments rewritten to 'Hanzo Base'
package.json: removed 'pocketbase' from dependencies entirely.
The published @hanzo/base npm package now has zero runtime deps
(only react as optional peer).
Build verified: tsup ESM build + DTS both pass.
70 lines
1.4 KiB
JSON
70 lines
1.4 KiB
JSON
{
|
|
"name": "@hanzo/base",
|
|
"version": "0.2.0",
|
|
"description": "Hanzo Base SDK - Reactive queries, CRDT, realtime, and Base-compatible client",
|
|
"type": "module",
|
|
"main": "./dist/core/index.js",
|
|
"module": "./dist/core/index.js",
|
|
"types": "./dist/core/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"import": "./dist/core/index.js",
|
|
"types": "./dist/core/index.d.ts"
|
|
},
|
|
"./compat": {
|
|
"import": "./dist/compat/index.js",
|
|
"types": "./dist/compat/index.d.ts"
|
|
},
|
|
"./react": {
|
|
"import": "./dist/react/index.js",
|
|
"types": "./dist/react/index.d.ts"
|
|
},
|
|
"./crdt": {
|
|
"import": "./dist/crdt/index.js",
|
|
"types": "./dist/crdt/index.d.ts"
|
|
}
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"src"
|
|
],
|
|
"scripts": {
|
|
"build": "tsup",
|
|
"dev": "tsup --watch",
|
|
"typecheck": "tsc --noEmit",
|
|
"clean": "rm -rf dist",
|
|
"prepublishOnly": "npm run build"
|
|
},
|
|
"dependencies": {},
|
|
"devDependencies": {
|
|
"@types/react": "^19.0.0",
|
|
"react": "^19.0.0",
|
|
"tsup": "^8.0.0",
|
|
"typescript": "^5.4.0"
|
|
},
|
|
"peerDependencies": {
|
|
"react": ">=18.0.0"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"react": {
|
|
"optional": true
|
|
}
|
|
},
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/hanzoai/base.git",
|
|
"directory": "sdk/base-js"
|
|
},
|
|
"keywords": [
|
|
"hanzo",
|
|
"base",
|
|
"sdk",
|
|
"backend",
|
|
"realtime",
|
|
"reactive",
|
|
"crdt",
|
|
"hanzo-base"
|
|
]
|
|
}
|