You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pryv): access versioning support — v3.1.0 (Plan 66 Phase H)
New utilities, typed error, and Connection helpers for the composite
access reference format introduced by open-pryv.io ≥ 2.0.0-pre.X
(Plan 66).
Utils
- pryv.utils.parseAccessRef(ref) → { base, serial | null }
Parses both bare cuid (never-updated access) and composite
`<base>:<serial>` (versioned access). Throws on malformed input.
- pryv.utils.serializeAccessRef({ base, serial }) → string
Inverse helper.
Typed error
- pryv.StaleAccessIdError extends PryvError. Surfaced when the
server responds with 409 stale-resource on accesses.update or
accesses.delete. Carries { provided, currentSerial } in .data so
callers can refetch + retry.
Connection helpers
- connection.updateAccess(id, changes) — wrapper around
accesses.update. Translates the 409 stale-resource response into
StaleAccessIdError automatically.
- connection.getAccessWithHistory(id) — wrapper around
accesses.getOne?includeHistory=true. Returns
{ access, current?, history?: [...] }.
Wire-format compatibility
- Older servers still return bare cuids; parseAccessRef yields
{ base, serial: null } in that case so callers can use it
unconditionally. The new utilities are pure JS — no server
dependency for the helpers themselves.
Tests
- 6 new utils.test.js cases: [UTLF]-[UTLK] covering parse, serialize,
round-trip, validation, and the StaleAccessIdError class. All
passing.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,20 @@
2
2
3
3
<!-- Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -->
4
4
5
+
## [3.1.0]
6
+
7
+
Plan 66 (open-pryv.io ≥ 2.0.0-pre.X): access versioning.
8
+
9
+
### Added
10
+
-`pryv.utils.parseAccessRef(ref) → { base, serial | null }` — parses the wire-format access reference. Bare cuid → `{ base, serial: null }`, composite `<base>:<serial>` → `{ base, serial: <int> }`. Throws on malformed input.
11
+
-`pryv.utils.serializeAccessRef({ base, serial }) → string` — inverse helper.
12
+
-`pryv.StaleAccessIdError` — typed error (extends `PryvError`) surfaced when the server responds with `409 stale-resource` on `accesses.update` / `accesses.delete`. Carries `{ provided, currentSerial }` in `.data` so callers can refetch + retry.
13
+
-`connection.updateAccess(id, changes)` — convenience wrapper around `accesses.update`. Automatically translates the server's 409 response into `StaleAccessIdError`.
- Wire-format compatibility: every `access.id` / `access.createdBy` / `access.modifiedBy` returned by a Plan-66-capable server is parseable with `parseAccessRef`. Older servers still return bare cuids — `parseAccessRef` returns `{ base, serial: null }` for those, so callers can use the helper unconditionally.
* @property {pryv.utils} utils - Exposes some utils for HTTP calls and tools to manipulate Pryv's API endpoints
12
12
* @property {pryv.PryvError} PryvError - Custom error class with innerObject + structured API-error fields
13
+
* @property {pryv.MfaRequiredError} MfaRequiredError - Thrown by Service.login when the platform returns an mfaToken instead of a token. Carries `.mfaToken`.
14
+
* @property {pryv.StaleAccessIdError} StaleAccessIdError - Plan 66: thrown when a Pryv.io server rejects an `accesses.update` / `accesses.delete` with a 409 stale-resource. Refetch + retry.
13
15
* @property {Object} ERRORS - Catalogue of Pryv API error ids (mirrors open-pryv.io/components/errors)
0 commit comments