lowdata 0.1.0 → 0.2.0

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 (42) hide show
  1. package/README.md +37 -4
  2. package/dist/{client-CqO3Y1J5.d.cts → client-BmsR0Pf6.d.cts} +8 -2
  3. package/dist/{client-BvdWSYIM.d.ts → client-DSKoYUj9.d.ts} +8 -2
  4. package/dist/forms.cjs +29 -11
  5. package/dist/forms.cjs.map +1 -1
  6. package/dist/forms.d.cts +4 -4
  7. package/dist/forms.d.ts +4 -4
  8. package/dist/forms.js +29 -11
  9. package/dist/forms.js.map +1 -1
  10. package/dist/index.cjs +29 -11
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +4 -4
  13. package/dist/index.d.ts +4 -4
  14. package/dist/index.js +29 -11
  15. package/dist/index.js.map +1 -1
  16. package/dist/media.cjs +1 -1
  17. package/dist/media.cjs.map +1 -1
  18. package/dist/media.d.cts +2 -2
  19. package/dist/media.d.ts +2 -2
  20. package/dist/media.js +1 -1
  21. package/dist/media.js.map +1 -1
  22. package/dist/network.cjs +29 -11
  23. package/dist/network.cjs.map +1 -1
  24. package/dist/network.d.cts +7 -6
  25. package/dist/network.d.ts +7 -6
  26. package/dist/network.js +29 -11
  27. package/dist/network.js.map +1 -1
  28. package/dist/{progressiveImage-BhY_K8Dj.d.ts → progressiveImage-BOdic4dJ.d.ts} +1 -1
  29. package/dist/{progressiveImage-BWNdewbi.d.cts → progressiveImage-CDpz_rv3.d.cts} +1 -1
  30. package/dist/react.cjs +29 -11
  31. package/dist/react.cjs.map +1 -1
  32. package/dist/react.d.cts +4 -4
  33. package/dist/react.d.ts +4 -4
  34. package/dist/react.js +29 -11
  35. package/dist/react.js.map +1 -1
  36. package/dist/{retry-C3zL9T5Z.d.cts → retry-BnuESos0.d.cts} +1 -1
  37. package/dist/{retry-D6DfKGOi.d.ts → retry-CnvZhHan.d.ts} +1 -1
  38. package/dist/{types-Bn1BAcch.d.ts → types-1ha2HIfv.d.ts} +1 -1
  39. package/dist/{types-CZDYS-fB.d.cts → types-Cbm1nNDO.d.cts} +1 -1
  40. package/dist/{types--FRrBa-i.d.cts → types-D6fjl8Wy.d.cts} +22 -1
  41. package/dist/{types--FRrBa-i.d.ts → types-D6fjl8Wy.d.ts} +22 -1
  42. package/package.json +22 -2
@@ -35,5 +35,26 @@ interface LowdataRequestError extends Error {
35
35
  attempt: number;
36
36
  retryAfterMs?: number;
37
37
  }
38
+ /**
39
+ * Where an internal, otherwise-silent failure originated:
40
+ * - `'db-open'`: IndexedDB itself couldn't be opened (SSR, unsupported/locked-down browser) —
41
+ * persistence is now permanently disabled for this session; lowdata falls back to an
42
+ * in-memory queue/draft store.
43
+ * - `'db-operation'`: a single IndexedDB operation failed (e.g. a transient
44
+ * `QuotaExceededError`, a blocked transaction) — persistence is still available; only that
45
+ * one call fell back to memory.
46
+ * - `'sync'`: the background sync loop hit an error outside of a single queued item's own
47
+ * retry accounting (e.g. it couldn't acquire the shared database or the cross-tab lock).
48
+ */
49
+ type LowdataErrorScope = 'db-open' | 'db-operation' | 'sync';
50
+ /**
51
+ * Optional escape hatch for otherwise-silent internal failures. lowdata deliberately never lets
52
+ * these throw — a failed background sync or a degraded-to-memory fallback shouldn't crash the
53
+ * host app — but a production app still needs a way to *see* it happened (log it, alert on it),
54
+ * rather than it vanishing into a single `console.warn`.
55
+ */
56
+ type LowdataErrorHandler = (error: unknown, context: {
57
+ scope: LowdataErrorScope;
58
+ }) => void;
38
59
 
39
- export type { ConnectionInfo as C, JitterStrategy as J, LowdataRequestError as L, RequestPriority as R, Unsubscribe as U, ConnectionListener as a, ConnectionQuality as b, RetryBackoffConfig as c };
60
+ export type { ConnectionInfo as C, JitterStrategy as J, LowdataErrorHandler as L, RequestPriority as R, Unsubscribe as U, ConnectionListener as a, ConnectionQuality as b, LowdataErrorScope as c, RetryBackoffConfig as d, LowdataRequestError as e };
@@ -35,5 +35,26 @@ interface LowdataRequestError extends Error {
35
35
  attempt: number;
36
36
  retryAfterMs?: number;
37
37
  }
38
+ /**
39
+ * Where an internal, otherwise-silent failure originated:
40
+ * - `'db-open'`: IndexedDB itself couldn't be opened (SSR, unsupported/locked-down browser) —
41
+ * persistence is now permanently disabled for this session; lowdata falls back to an
42
+ * in-memory queue/draft store.
43
+ * - `'db-operation'`: a single IndexedDB operation failed (e.g. a transient
44
+ * `QuotaExceededError`, a blocked transaction) — persistence is still available; only that
45
+ * one call fell back to memory.
46
+ * - `'sync'`: the background sync loop hit an error outside of a single queued item's own
47
+ * retry accounting (e.g. it couldn't acquire the shared database or the cross-tab lock).
48
+ */
49
+ type LowdataErrorScope = 'db-open' | 'db-operation' | 'sync';
50
+ /**
51
+ * Optional escape hatch for otherwise-silent internal failures. lowdata deliberately never lets
52
+ * these throw — a failed background sync or a degraded-to-memory fallback shouldn't crash the
53
+ * host app — but a production app still needs a way to *see* it happened (log it, alert on it),
54
+ * rather than it vanishing into a single `console.warn`.
55
+ */
56
+ type LowdataErrorHandler = (error: unknown, context: {
57
+ scope: LowdataErrorScope;
58
+ }) => void;
38
59
 
39
- export type { ConnectionInfo as C, JitterStrategy as J, LowdataRequestError as L, RequestPriority as R, Unsubscribe as U, ConnectionListener as a, ConnectionQuality as b, RetryBackoffConfig as c };
60
+ export type { ConnectionInfo as C, JitterStrategy as J, LowdataErrorHandler as L, RequestPriority as R, Unsubscribe as U, ConnectionListener as a, ConnectionQuality as b, LowdataErrorScope as c, RetryBackoffConfig as d, LowdataRequestError as e };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lowdata",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Resilience for the other half of the internet: automatic retries, an offline request queue, and bandwidth-aware media for web apps on poor connections.",
5
5
  "keywords": [
6
6
  "offline",
@@ -16,6 +16,15 @@
16
16
  "pwa"
17
17
  ],
18
18
  "license": "MIT",
19
+ "author": "",
20
+ "homepage": "https://github.com/bassmoses/lowdata#readme",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/bassmoses/lowdata.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/bassmoses/lowdata/issues"
27
+ },
19
28
  "type": "module",
20
29
  "sideEffects": false,
21
30
  "main": "./dist/index.cjs",
@@ -55,17 +64,23 @@
55
64
  "engines": {
56
65
  "node": ">=18"
57
66
  },
67
+ "packageManager": "pnpm@11.9.0",
68
+ "publishConfig": {
69
+ "access": "public"
70
+ },
58
71
  "scripts": {
59
72
  "build": "tsup",
60
73
  "dev": "tsup --watch",
61
74
  "test": "vitest run",
62
75
  "test:watch": "vitest",
63
76
  "test:coverage": "vitest run --coverage",
77
+ "test:e2e": "playwright test",
64
78
  "typecheck": "tsc --noEmit",
65
79
  "lint": "eslint . --ext .ts,.tsx",
66
80
  "format": "prettier --write .",
67
81
  "format:check": "prettier --check .",
68
- "prepublishOnly": "pnpm typecheck && pnpm build && pnpm test"
82
+ "prepublishOnly": "pnpm typecheck && pnpm build && pnpm test",
83
+ "release": "semantic-release"
69
84
  },
70
85
  "peerDependencies": {
71
86
  "react": ">=17"
@@ -76,6 +91,9 @@
76
91
  }
77
92
  },
78
93
  "devDependencies": {
94
+ "@playwright/test": "^1.62.1",
95
+ "@semantic-release/changelog": "^7.0.0",
96
+ "@semantic-release/git": "^11.0.1",
79
97
  "@testing-library/react": "^16.0.1",
80
98
  "@types/node": "^20.16.11",
81
99
  "@types/react": "^18.3.11",
@@ -90,6 +108,8 @@
90
108
  "prettier": "^3.3.3",
91
109
  "react": "^18.3.1",
92
110
  "react-dom": "^18.3.1",
111
+ "semantic-release": "^25.0.9",
112
+ "serve": "^14.2.6",
93
113
  "tsup": "^8.3.0",
94
114
  "typescript": "^5.6.3",
95
115
  "vitest": "^2.1.2"