cursedbelt-core 2.1.0 → 2.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 (158) hide show
  1. package/dist/core/activity/index.d.ts +2 -2
  2. package/dist/core/activity/index.js +1 -1
  3. package/dist/core/activity/model.d.ts +2 -2
  4. package/dist/core/analytics/index.d.ts +2 -2
  5. package/dist/core/analytics/index.js +2 -2
  6. package/dist/core/category/index.d.ts +3 -3
  7. package/dist/core/category/index.js +2 -2
  8. package/dist/core/category/memoryStore.d.ts +1 -1
  9. package/dist/core/category/memoryStore.js +1 -1
  10. package/dist/core/category/tree.d.ts +1 -1
  11. package/dist/core/colorScheme/index.d.ts +1 -1
  12. package/dist/core/colorScheme/index.js +1 -1
  13. package/dist/core/folder-tree/actions.d.ts +1 -1
  14. package/dist/core/folder-tree/actions.js +1 -1
  15. package/dist/core/folder-tree/index.d.ts +3 -3
  16. package/dist/core/folder-tree/index.js +3 -3
  17. package/dist/core/folder-tree/tree.js +1 -1
  18. package/dist/core/master-lock/index.d.ts +4 -4
  19. package/dist/core/master-lock/index.js +4 -4
  20. package/dist/core/master-lock/wire.d.ts +1 -1
  21. package/dist/core/media/ffmpeg.d.ts +1 -1
  22. package/dist/core/media/format.d.ts +1 -1
  23. package/dist/core/media/index.d.ts +12 -12
  24. package/dist/core/media/index.js +11 -11
  25. package/dist/core/media/mediaItem.d.ts +1 -1
  26. package/dist/core/media/renderPlan.d.ts +1 -1
  27. package/dist/core/media/renderPlan.js +1 -1
  28. package/dist/core/media/validate.d.ts +1 -1
  29. package/dist/core/media/validate.js +1 -1
  30. package/dist/core/navigation/coverageTest.d.ts +1 -1
  31. package/dist/core/navigation/coverageTest.js +1 -1
  32. package/dist/core/navigation/index.d.ts +6 -6
  33. package/dist/core/navigation/index.js +6 -6
  34. package/dist/core/navigation/migrateNavPreferences.d.ts +1 -1
  35. package/dist/core/navigation/navigationSelectors.d.ts +1 -1
  36. package/dist/core/navigation/navigationSelectors.js +1 -1
  37. package/dist/core/navigation/searchCatalogue.d.ts +1 -1
  38. package/dist/core/offline/shellWorker.d.ts +185 -0
  39. package/dist/core/offline/shellWorker.js +200 -0
  40. package/dist/core/palette/fuzzyRank.d.ts +1 -1
  41. package/dist/core/palette/index.d.ts +3 -3
  42. package/dist/core/palette/index.js +3 -3
  43. package/dist/core/sharing/index.d.ts +2 -2
  44. package/dist/core/sharing/index.js +1 -1
  45. package/dist/core/tokens/registry.d.ts +2 -2
  46. package/dist/core/tokens/registry.js +1 -1
  47. package/dist/core/uiScale/index.d.ts +2 -2
  48. package/dist/core/uiScale/index.js +2 -2
  49. package/dist/core/uiScale/uiScaleStore.js +1 -1
  50. package/dist/core/wire/__fixtures__/rowsMarshalWorker.js +1 -1
  51. package/dist/core/wire/index.d.ts +4 -4
  52. package/dist/core/wire/index.js +4 -4
  53. package/dist/core/wire/ingress.d.ts +1 -1
  54. package/dist/core/wire/ingress.js +3 -3
  55. package/dist/core/wire/marshalWorker.d.ts +1 -1
  56. package/dist/core/wire/marshalWorker.js +2 -2
  57. package/dist/core/wire/marshalling.js +1 -1
  58. package/dist/ctgr/chunkAccumulator.d.ts +1 -1
  59. package/dist/ctgr/chunkAccumulator.js +2 -2
  60. package/dist/ctgr/chunkStore.d.ts +1 -1
  61. package/dist/ctgr/chunkStore.js +2 -2
  62. package/dist/ctgr/codec.d.ts +1 -1
  63. package/dist/ctgr/codec.js +5 -5
  64. package/dist/ctgr/index.d.ts +9 -9
  65. package/dist/ctgr/index.js +9 -9
  66. package/dist/ctgr/v0compat.d.ts +1 -1
  67. package/dist/ctgr/v0compat.js +2 -2
  68. package/dist/index.d.ts +2 -2
  69. package/dist/index.js +2 -2
  70. package/dist/testing/index.d.ts +3 -3
  71. package/dist/testing/index.js +3 -3
  72. package/package.json +8 -2
  73. package/src/config/appConfig.spec.ts +1 -1
  74. package/src/core/activity/index.ts +2 -2
  75. package/src/core/activity/model.ts +2 -2
  76. package/src/core/analytics/index.ts +2 -2
  77. package/src/core/analytics/range.spec.ts +1 -1
  78. package/src/core/analytics/schedule.spec.ts +1 -1
  79. package/src/core/category/category.spec.ts +1 -1
  80. package/src/core/category/index.ts +3 -3
  81. package/src/core/category/memoryStore.ts +2 -2
  82. package/src/core/category/tree.ts +1 -1
  83. package/src/core/color.spec.ts +1 -1
  84. package/src/core/colorScheme/colorScheme.spec.ts +1 -1
  85. package/src/core/colorScheme/index.ts +1 -1
  86. package/src/core/download.spec.ts +1 -1
  87. package/src/core/duplicates/index.spec.ts +1 -1
  88. package/src/core/events/ccEventBus.spec.ts +1 -1
  89. package/src/core/file-tree/fileTreeModel.spec.ts +1 -1
  90. package/src/core/folder-tree/actions.spec.ts +2 -2
  91. package/src/core/folder-tree/actions.ts +2 -2
  92. package/src/core/folder-tree/index.ts +3 -3
  93. package/src/core/folder-tree/path.spec.ts +1 -1
  94. package/src/core/folder-tree/tree.spec.ts +1 -1
  95. package/src/core/folder-tree/tree.ts +1 -1
  96. package/src/core/master-lock/index.ts +4 -4
  97. package/src/core/master-lock/kdf.spec.ts +2 -2
  98. package/src/core/master-lock/presence.spec.ts +1 -1
  99. package/src/core/master-lock/wire.spec.ts +1 -1
  100. package/src/core/master-lock/wire.ts +1 -1
  101. package/src/core/media/bgRemoval.spec.ts +1 -1
  102. package/src/core/media/ffmpeg.spec.ts +2 -2
  103. package/src/core/media/ffmpeg.ts +1 -1
  104. package/src/core/media/format.spec.ts +1 -1
  105. package/src/core/media/format.ts +1 -1
  106. package/src/core/media/index.ts +12 -12
  107. package/src/core/media/mediaItem.spec.ts +2 -2
  108. package/src/core/media/mediaItem.ts +1 -1
  109. package/src/core/media/renderPlan.spec.ts +1 -1
  110. package/src/core/media/renderPlan.ts +2 -2
  111. package/src/core/media/segment.spec.ts +1 -1
  112. package/src/core/media/size.spec.ts +1 -1
  113. package/src/core/media/trim.spec.ts +1 -1
  114. package/src/core/media/validate.spec.ts +2 -2
  115. package/src/core/media/validate.ts +2 -2
  116. package/src/core/media/videoCuts.spec.ts +1 -1
  117. package/src/core/navigation/coverageTest.ts +2 -2
  118. package/src/core/navigation/index.ts +6 -6
  119. package/src/core/navigation/migrateNavPreferences.ts +1 -1
  120. package/src/core/navigation/navigation.spec.ts +1 -1
  121. package/src/core/navigation/navigationSelectors.ts +1 -1
  122. package/src/core/navigation/searchCatalogue.ts +1 -1
  123. package/src/core/net/reconnectSchedule.spec.ts +1 -1
  124. package/src/core/offline/shellWorker.spec.ts +392 -0
  125. package/src/core/offline/shellWorker.ts +346 -0
  126. package/src/core/offline/shellWorker.webworker.spec.ts +80 -0
  127. package/src/core/palette/fuzzyRank.ts +1 -1
  128. package/src/core/palette/index.ts +3 -3
  129. package/src/core/palette/palette.spec.ts +4 -4
  130. package/src/core/schema/projection.spec.ts +1 -1
  131. package/src/core/sharing/index.ts +2 -2
  132. package/src/core/sharing/model.spec.ts +1 -1
  133. package/src/core/tokens/registry.spec.ts +1 -1
  134. package/src/core/tokens/registry.ts +2 -2
  135. package/src/core/uiScale/index.ts +2 -2
  136. package/src/core/uiScale/uiScale.spec.ts +1 -1
  137. package/src/core/uiScale/uiScaleStore.ts +1 -1
  138. package/src/core/wire/__fixtures__/rowsMarshalWorker.ts +1 -1
  139. package/src/core/wire/index.ts +4 -4
  140. package/src/core/wire/ingress.spec.ts +2 -2
  141. package/src/core/wire/ingress.ts +3 -3
  142. package/src/core/wire/marshalWorker.spec.ts +2 -2
  143. package/src/core/wire/marshalWorker.ts +2 -2
  144. package/src/core/wire/marshalling.spec.ts +1 -1
  145. package/src/core/wire/marshalling.ts +1 -1
  146. package/src/core/wire/wireHub.spec.ts +1 -1
  147. package/src/ctgr/chunkAccumulator.ts +3 -3
  148. package/src/ctgr/chunkStore.spec.ts +2 -2
  149. package/src/ctgr/chunkStore.ts +3 -3
  150. package/src/ctgr/codec.spec.ts +4 -4
  151. package/src/ctgr/codec.ts +5 -5
  152. package/src/ctgr/index.ts +9 -9
  153. package/src/ctgr/v0compat.spec.ts +2 -2
  154. package/src/ctgr/v0compat.ts +3 -3
  155. package/src/index.ts +2 -2
  156. package/src/leafSubpathsImportNothing.spec.ts +5 -0
  157. package/src/testTmpRoot.spec.ts +1 -1
  158. package/src/testing/index.ts +3 -3
@@ -9,7 +9,7 @@ import {
9
9
  MARSHALLER_WORKER_OFFLOAD_BYTES,
10
10
  marshalInbound,
11
11
  payloadBytes,
12
- } from './marshalling';
12
+ } from './marshalling.js';
13
13
 
14
14
  const schema = z.object({ rows: z.array(z.object({ id: z.string() })) });
15
15
 
@@ -15,7 +15,7 @@
15
15
  * the work is offloaded to a Worker (structured-clone in, validated result out).
16
16
  */
17
17
  import type { z } from 'zod';
18
- import { AppError } from '../../shared/errors';
18
+ import { AppError } from '../../shared/errors.js';
19
19
 
20
20
  /** Above this, `validate` + `transform` are offloaded to a Worker (02 §7.1). */
21
21
  export const MARSHALLER_WORKER_OFFLOAD_BYTES = 512 * 1024;
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
- import { createInstanceRuntime, createWireHub, type WireEnvelope } from './wireHub';
2
+ import { createInstanceRuntime, createWireHub, type WireEnvelope } from './wireHub.js';
3
3
 
4
4
  const envelope = <T>(rev: number, payload: T, scope?: string): WireEnvelope<T> => ({ rev, at: rev, payload, scope });
5
5
 
@@ -62,9 +62,9 @@
62
62
  * - The service itself is a singleton; do NOT create multiple instances per server or request thread
63
63
  */
64
64
 
65
- import { decodePayload, type ParsedChunk, parseChunk } from './codec';
66
- import { sha256Hex } from './digest';
67
- import type { CtgrDecoded, CtgrMethod } from './types';
65
+ import { decodePayload, type ParsedChunk, parseChunk } from './codec.js';
66
+ import { sha256Hex } from './digest.js';
67
+ import type { CtgrDecoded, CtgrMethod } from './types.js';
68
68
 
69
69
  /**
70
70
  * Configuration for ChunkAccumulator resource limits and timing behavior.
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
- import { ChunkStore } from './chunkStore';
3
- import { encodeRequest } from './codec';
2
+ import { ChunkStore } from './chunkStore.js';
3
+ import { encodeRequest } from './codec.js';
4
4
 
5
5
  const bigBody = { data: 'y'.repeat(8000), tag: 'multi' };
6
6
  // gzip disabled (high threshold) so the chunk count is deterministic — 'y'*8000 would
@@ -9,9 +9,9 @@
9
9
  * It NEVER throws: a malformed/corrupt/oversized payload returns an `Error` the
10
10
  * middleware maps to a 400; an intermediate chunk returns `false` (→ 202).
11
11
  */
12
- import { decodePayload, type ParsedChunk, parseChunk } from './codec';
13
- import { sha256Hex } from './digest';
14
- import type { CtgrDecoded, CtgrMethod } from './types';
12
+ import { decodePayload, type ParsedChunk, parseChunk } from './codec.js';
13
+ import { sha256Hex } from './digest.js';
14
+ import type { CtgrDecoded, CtgrMethod } from './types.js';
15
15
 
16
16
  export interface ChunkStoreOpts {
17
17
  /** Max concurrent in-flight (incomplete) payloads. Default 200. */
@@ -1,8 +1,8 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
- import { toBase64 } from './base64url';
3
- import { ChunkStore } from './chunkStore';
4
- import { decodePayload, decodeRequest, encodeRequest, extractFiles, parseChunk } from './codec';
5
- import { ABBREV_TO_METHOD } from './types';
2
+ import { toBase64 } from './base64url.js';
3
+ import { ChunkStore } from './chunkStore.js';
4
+ import { decodePayload, decodeRequest, encodeRequest, extractFiles, parseChunk } from './codec.js';
5
+ import { ABBREV_TO_METHOD } from './types.js';
6
6
 
7
7
  const paramsOf = (url: string) => Object.fromEntries(new URL(url, 'http://x').searchParams);
8
8
 
package/src/ctgr/codec.ts CHANGED
@@ -11,10 +11,10 @@
11
11
  * double-base64'd and whose swap/reverse was trivially-reversible obfuscation, not
12
12
  * protection — the real protection (getOnly JWT claim + CSRF guard) is unchanged.
13
13
  */
14
- import { fromBase64, fromBase64url, toBase64url } from './base64url';
15
- import { gunzip, gzip } from './compress';
16
- import { crc32 } from './crc32';
17
- import { sha256Hex } from './digest';
14
+ import { fromBase64, fromBase64url, toBase64url } from './base64url.js';
15
+ import { gunzip, gzip } from './compress.js';
16
+ import { crc32 } from './crc32.js';
17
+ import { sha256Hex } from './digest.js';
18
18
  import {
19
19
  ABBREV_TO_METHOD,
20
20
  CTGR_WIRE_VERSION,
@@ -27,7 +27,7 @@ import {
27
27
  METHOD_TO_ABBREV,
28
28
  type SerializedFile,
29
29
  type UploadedFile,
30
- } from './types';
30
+ } from './types.js';
31
31
 
32
32
  const DEFAULT_CHUNK_SIZE = 1800;
33
33
  const DEFAULT_GZIP_THRESHOLD = 1024;
package/src/ctgr/index.ts CHANGED
@@ -6,12 +6,12 @@
6
6
  * The ChunkAccumulator is the primary abstraction for multi-chunk payload assembly;
7
7
  * ChunkStore is kept for backward compatibility (they are identical implementations).
8
8
  */
9
- export { fromBase64, fromBase64url, toBase64, toBase64url } from './base64url';
9
+ export { fromBase64, fromBase64url, toBase64, toBase64url } from './base64url.js';
10
10
  export {
11
11
  ChunkAccumulator,
12
12
  type ChunkAccumulatorConfig,
13
- } from './chunkAccumulator';
14
- export { ChunkStore, type ChunkStoreOpts } from './chunkStore';
13
+ } from './chunkAccumulator.js';
14
+ export { ChunkStore, type ChunkStoreOpts } from './chunkStore.js';
15
15
  export {
16
16
  decodePayload,
17
17
  decodeRequest,
@@ -19,10 +19,10 @@ export {
19
19
  extractFiles,
20
20
  type ParsedChunk,
21
21
  parseChunk,
22
- } from './codec';
23
- export { gunzip, gzip } from './compress';
24
- export { crc32 } from './crc32';
25
- export { sha256Hex } from './digest';
22
+ } from './codec.js';
23
+ export { gunzip, gzip } from './compress.js';
24
+ export { crc32 } from './crc32.js';
25
+ export { sha256Hex } from './digest.js';
26
26
  export {
27
27
  ABBREV_TO_METHOD,
28
28
  CTGR_WIRE_VERSION,
@@ -35,5 +35,5 @@ export {
35
35
  METHOD_TO_ABBREV,
36
36
  type SerializedFile,
37
37
  type UploadedFile,
38
- } from './types';
39
- export { decodeV0Payload, V0ChunkStore, type V0ChunkStoreOpts } from './v0compat';
38
+ } from './types.js';
39
+ export { decodeV0Payload, V0ChunkStore, type V0ChunkStoreOpts } from './v0compat.js';
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
- import { toBase64 } from './base64url';
3
- import { decodeV0Payload, V0ChunkStore } from './v0compat';
2
+ import { toBase64 } from './base64url.js';
3
+ import { decodeV0Payload, V0ChunkStore } from './v0compat.js';
4
4
 
5
5
  // Mirror the legacy client encode pipeline exactly: encode→reverse→swap→encode→swap,
6
6
  // where `encode` is standard base64 of the UTF-8 bytes. Used to prove the v1 server's
@@ -9,9 +9,9 @@
9
9
  * heuristic, since v1 always sets `_cv=1`. v0 carried the method only in the path
10
10
  * (`/ctgr<XX>`), so the middleware passes the path-derived method in.
11
11
  */
12
- import { fromBase64 } from './base64url';
13
- import { extractFiles } from './codec';
14
- import type { CtgrDecoded, CtgrMethod } from './types';
12
+ import { fromBase64 } from './base64url.js';
13
+ import { extractFiles } from './codec.js';
14
+ import type { CtgrDecoded, CtgrMethod } from './types.js';
15
15
 
16
16
  const decodeBase64Utf8 = (str: string): string => new TextDecoder().decode(fromBase64(str));
17
17
  const reverseString = (str: string): string => str.split('').reverse().join('');
package/src/index.ts CHANGED
@@ -14,7 +14,7 @@ export const VERSION = '1.0.0';
14
14
 
15
15
  // The two root-level conveniences the pre-split "." barrel actually served:
16
16
  // the WCAG readable-foreground picker and the baked marketing-copy contract.
17
- export { contrastText } from './core/color';
17
+ export { contrastText } from './core/color.js';
18
18
  export {
19
19
  isSiteCopyKey,
20
20
  SITE_COPY_BAKED_ONLY,
@@ -22,4 +22,4 @@ export {
22
22
  SITE_COPY_KEYS,
23
23
  SITE_COPY_MAX_VALUE_LENGTH,
24
24
  type SiteCopyKey,
25
- } from './core/site/siteCopy';
25
+ } from './core/site/siteCopy.js';
@@ -108,6 +108,11 @@ const LEAVES = [
108
108
  /** Wire-format types + the method⇄abbreviation maps. Trivially isomorphic on purpose. */
109
109
  evaluates: 'METHOD_TO_ABBREV',
110
110
  },
111
+ {
112
+ subpath: './offline/shell-worker',
113
+ /** Bundled into an app's service worker, where every byte ships on every install. */
114
+ evaluates: 'installShellWorker',
115
+ },
111
116
  ] as const;
112
117
 
113
118
  /**
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'bun:test';
2
2
  import { isAbsolute, resolve, sep } from 'node:path';
3
- import { resolveTestTmpRoot } from '../scripts/testTmpRoot';
3
+ import { resolveTestTmpRoot } from '../scripts/testTmpRoot.js';
4
4
 
5
5
  /**
6
6
  * 🔴 THE CHECKER CANNOT SEE THIS ONE, WHICH IS WHY IT IS A TEST.
@@ -6,6 +6,6 @@
6
6
  // can `import { installCheapDomInspect } from "cursedbelt-core/testing"` instead of
7
7
  // keeping a ~60-line hand-port of domInspect.ts — the file already lived here,
8
8
  // it just had no export.
9
- export { installCheapDomInspect } from "./domInspect";
10
- export { asBody, bytesResponse, bytesStream } from "./bytes";
11
- export { type FetchImpl, fakeFetch } from "./fakeFetch";
9
+ export { installCheapDomInspect } from "./domInspect.js";
10
+ export { asBody, bytesResponse, bytesStream } from "./bytes.js";
11
+ export { type FetchImpl, fakeFetch } from "./fakeFetch.js";