was-teaching-server 0.10.0 → 0.11.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 (47) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +23 -11
  3. package/dist/backends/filesystem.d.ts +86 -2
  4. package/dist/backends/filesystem.d.ts.map +1 -1
  5. package/dist/backends/filesystem.js +220 -21
  6. package/dist/backends/filesystem.js.map +1 -1
  7. package/dist/backends/postgres.d.ts +74 -2
  8. package/dist/backends/postgres.d.ts.map +1 -1
  9. package/dist/backends/postgres.js +175 -13
  10. package/dist/backends/postgres.js.map +1 -1
  11. package/dist/backends/postgresSchema.d.ts.map +1 -1
  12. package/dist/backends/postgresSchema.js +69 -82
  13. package/dist/backends/postgresSchema.js.map +1 -1
  14. package/dist/errors.d.ts +13 -9
  15. package/dist/errors.d.ts.map +1 -1
  16. package/dist/errors.js +22 -12
  17. package/dist/errors.js.map +1 -1
  18. package/dist/lib/equalityIndex.d.ts +334 -0
  19. package/dist/lib/equalityIndex.d.ts.map +1 -0
  20. package/dist/lib/equalityIndex.js +552 -0
  21. package/dist/lib/equalityIndex.js.map +1 -0
  22. package/dist/plugin.d.ts.map +1 -1
  23. package/dist/plugin.js +5 -2
  24. package/dist/plugin.js.map +1 -1
  25. package/dist/requests/CollectionRequest.d.ts +22 -5
  26. package/dist/requests/CollectionRequest.d.ts.map +1 -1
  27. package/dist/requests/CollectionRequest.js +192 -11
  28. package/dist/requests/CollectionRequest.js.map +1 -1
  29. package/dist/requests/ResourceRequest.d.ts.map +1 -1
  30. package/dist/requests/ResourceRequest.js +20 -0
  31. package/dist/requests/ResourceRequest.js.map +1 -1
  32. package/dist/requests/SpaceRequest.d.ts +1 -0
  33. package/dist/requests/SpaceRequest.d.ts.map +1 -1
  34. package/dist/requests/SpaceRequest.js +21 -1
  35. package/dist/requests/SpaceRequest.js.map +1 -1
  36. package/dist/types.d.ts +84 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +19 -18
  39. package/src/backends/filesystem.ts +286 -18
  40. package/src/backends/postgres.ts +247 -11
  41. package/src/errors.ts +25 -12
  42. package/src/lib/equalityIndex.ts +769 -0
  43. package/src/plugin.ts +5 -2
  44. package/src/requests/CollectionRequest.ts +221 -12
  45. package/src/requests/ResourceRequest.ts +20 -0
  46. package/src/requests/SpaceRequest.ts +25 -1
  47. package/src/types.ts +97 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,73 @@
1
1
  # History
2
2
 
3
+ ## 0.11.0 - 2026-07-19
4
+
5
+ ### Added
6
+
7
+ - **The `equality` query profile (the `equality-query` backend feature).** A
8
+ plaintext Collection can now declare which top-level attributes the server
9
+ extracts and indexes, and answer server-side equality queries over them at
10
+ `POST /space/{spaceId}/{collectionId}/query` with `{ "profile": "equality" }`.
11
+ The body carries exactly one of `equals` (a disjunction of `{ name: value }`
12
+ conjunctions) or `has` (attributes that must be present), plus optional
13
+ `count`, `limit`, and an opaque `cursor`; matching is strict JSON equality
14
+ (`"1"` never matches `1`; a multi-valued array attribute matches any element)
15
+ and a query naming an attribute the Collection does not declare is rejected
16
+ fail-closed (`invalid-request-body`, 400). The response is a
17
+ `{ documents: [{ id, data?, custom? }], hasMore, cursor? }` page in ascending
18
+ Resource-id order (`data` for JSON Resources, `custom` for any Resource with
19
+ custom metadata -- so blob Resources are queryable through their `custom`
20
+ tags), or `{ count }`. Unlike the client-computed `blinded-index` profile, the
21
+ server does the extraction, so a plain Resource write is immediately
22
+ queryable; the profile is capability-or-policy readable like List Collection,
23
+ and an encrypted Collection answers `unsupported-operation` (501). Both
24
+ first-party backends evaluate through one shared module so their semantics
25
+ cannot drift.
26
+ - **The `indexes` Collection Description property.** A plaintext Collection opts
27
+ in by declaring `indexes`: an array of attribute-name strings, or objects
28
+ `{ name, source: "content" | "custom", unique: true }` where `source` (default
29
+ `content`) names where the attribute is extracted from -- a JSON Resource's
30
+ content, or any Resource's `custom` metadata object. Declared names must be
31
+ unique across the array. Unlike `encryption`, `indexes` is updatable (entries
32
+ may be added or removed); it MUST NOT be combined with an `encryption` marker
33
+ (rejected `invalid-request-body`, 400, in both directions). An entry marked
34
+ `unique: true` claims per-Collection uniqueness for that attribute's
35
+ `(name, value)` pairs: a content or metadata write whose extracted value is
36
+ already held by a different Resource is rejected with `id-conflict` (409),
37
+ enforced atomically with the write; adding a unique claim to a Collection
38
+ whose stored Resources already violate it is likewise rejected (409).
39
+ - **The GET `filter[attr]=value` equality filter on List Collection.**
40
+ `GET /space/{spaceId}/{collectionId}/?filter[attr]=value` runs the equality
41
+ profile over the same machinery from the anonymous, HTTP-cacheable listing
42
+ endpoint: it answers the same document page. Every filter attribute must be
43
+ declared in the Collection's `indexes` (fail-closed 400); on a `PublicCanRead`
44
+ Collection the filter query needs no capability, so a cache can serve it.
45
+
46
+ ## 0.10.2 - TBD
47
+
48
+ ### Changed
49
+
50
+ - Protocol conformance testing now uses the extracted
51
+ `@interop/was-conformance-suite` package (devDependency) instead of the
52
+ in-tree `conformance/` directory, which has been removed. `pnpm conformance`
53
+ now runs the package's `was-conformance` CLI (URL passed positionally;
54
+ `TEST_SERVER_URL` / `TEST_ONBOARDING_TOKEN` env vars still work as fallbacks),
55
+ and `pnpm conformance:local` still spins up a matched local server but
56
+ delegates the test run to the CLI, forwarding any extra arguments. CI now
57
+ exercises the production build against the CLI twice -- open provisioning and
58
+ onboarding-token-gated -- and uploads the JSON conformance reports as build
59
+ artifacts.
60
+
61
+ ## 0.10.1 - 2026-07-19
62
+
63
+ ### Fixed
64
+
65
+ - CORS registration now sets `exposedHeaders: ['Location', 'ETag', 'Link']`, so
66
+ browser-based clients can read the `Location` header on space/resource
67
+ creation, `ETag` for metaVersion concurrency, and `Link` for pagination and
68
+ policy linkset discovery. Previously these were blocked by the default CORS
69
+ response-header allowlist, breaking browser wallets.
70
+
3
71
  ## 0.10.0 - 2026-07-19
4
72
 
5
73
  ### Added
package/README.md CHANGED
@@ -272,30 +272,42 @@ reusable.
272
272
 
273
273
  ### Conformance Tests
274
274
 
275
- The `conformance/` suite runs against any external WAS server. The server's
276
- `SERVER_URL` and the test's `TEST_SERVER_URL` **must be byte-for-byte
277
- identical** (including host and port) ZCap `invocationTarget` URLs embed the
278
- full host:port, so even `localhost` vs `127.0.0.1` or a port mismatch will make
279
- delegated-access tests 404.
275
+ Protocol conformance testing lives in its own package,
276
+ [`@interop/was-conformance-suite`](https://github.com/interop-alliance/was-conformance-suite),
277
+ which ships a `was-conformance` CLI that runs against any WAS server by URL
278
+ (installed here as a devDependency). The URL passed to the CLI and the server's
279
+ `SERVER_URL` **must be byte-for-byte identical** (including host and port) —
280
+ ZCap `invocationTarget` URLs embed the full host:port, so even `localhost` vs
281
+ `127.0.0.1` or a port mismatch will make delegated-access tests 404.
280
282
 
281
283
  For a local run, `pnpm conformance:local` does the whole dance for you: it spins
282
- up the server on a fixed local URL, waits until it answers, runs the suite with
283
- a matching `TEST_SERVER_URL`, and tears the server down afterward (even if the
284
- suite fails) — so the two URLs can't drift out of sync.
284
+ up the server on a fixed local URL, waits until it answers, runs the CLI against
285
+ that same URL, and tears the server down afterward (even if the suite fails) —
286
+ so the two URLs can't drift out of sync.
285
287
 
286
288
  ```bash
287
289
  # One-shot local run (recommended). Override the port with PORT=... if 3002 is
288
- # taken; the server and test URLs are both derived from it, so they stay in sync.
290
+ # taken; the server and CLI URLs are both derived from it, so they stay in
291
+ # sync. Arguments after -- are forwarded to the CLI.
289
292
  pnpm conformance:local
293
+ pnpm conformance:local -- --grep chunk --reporter json
290
294
 
291
295
  # Against an already-running or external server. Start it with a matching
292
296
  # SERVER_URL, then in another shell:
293
- TEST_SERVER_URL=https://was.example.com pnpm conformance
297
+ pnpm conformance https://was.example.com
294
298
 
295
299
  # With an onboarding token, for servers that require one for POST /spaces/:
296
- TEST_SERVER_URL=https://was.example.com TEST_ONBOARDING_TOKEN=abc123 pnpm conformance
300
+ pnpm conformance https://was.example.com --token abc123
301
+
302
+ # TEST_SERVER_URL / TEST_ONBOARDING_TOKEN env vars still work as fallbacks:
303
+ TEST_SERVER_URL=https://was.example.com pnpm conformance
297
304
  ```
298
305
 
306
+ Useful CLI options: `-s/--suite <id>`, `-g/--grep <pattern>`,
307
+ `--include-optional` / `--skip-optional`, `-r json`, `--timeout <ms>`,
308
+ `--fail-fast`. Exit codes: `0` conformant, `1` failures, `2` usage error or
309
+ server unreachable.
310
+
299
311
  ## Security
300
312
 
301
313
  This is an experimental research server.
@@ -1,6 +1,7 @@
1
1
  import { Transform, type Readable } from 'node:stream';
2
2
  import type { FastifyBaseLogger } from 'fastify';
3
3
  import type { BlindedIndexQuery, BlindedIndexQueryPage } from '../lib/blindedIndex.js';
4
+ import type { EqualityQuery, EqualityQueryPage, EqualityValue, NormalizedIndexDeclaration } from '../lib/equalityIndex.js';
4
5
  import type { SpaceDescription, CollectionDescription, CollectionSummary, CollectionResourcesList, ResourceResult, ResourceMetadata, ResourceMetadataCustom, ResourceInput, ImportStats, PolicyDocument, BackendDescriptor, BackendUsage, CollectionUsage, StorageBackend, StoredBackendRecord, KeystoreConfig, KmsKeyRecord, RevocationRecord, RevocationScope, CapabilitySummary, IDID } from '../types.js';
5
6
  /**
6
7
  * The on-disk shape of a Resource's metadata sidecar (`.meta.<resourceId>.json`,
@@ -590,13 +591,14 @@ export declare class FileSystemBackend implements StorageBackend {
590
591
  * @param [options.ifNoneMatch] {boolean} `If-None-Match: *` (create-if-absent)
591
592
  * @returns {Promise<{ version: number }>} the Resource's new version
592
593
  */
593
- writeResource({ spaceId, collectionId, resourceId, input, createdBy, epoch, ifMatch, ifNoneMatch }: {
594
+ writeResource({ spaceId, collectionId, resourceId, input, createdBy, epoch, uniqueIndexes, ifMatch, ifNoneMatch }: {
594
595
  spaceId: string;
595
596
  collectionId: string;
596
597
  resourceId: string;
597
598
  input: ResourceInput;
598
599
  createdBy?: IDID;
599
600
  epoch?: string;
601
+ uniqueIndexes?: NormalizedIndexDeclaration[];
600
602
  ifMatch?: string;
601
603
  ifNoneMatch?: boolean;
602
604
  }): Promise<{
@@ -786,12 +788,13 @@ export declare class FileSystemBackend implements StorageBackend {
786
788
  * @returns {Promise<{ metaVersion: number } | undefined>} the new
787
789
  * `metaVersion`, or `undefined` when the Resource does not exist
788
790
  */
789
- writeResourceMetadata({ spaceId, collectionId, resourceId, custom, epoch, ifMatch, ifNoneMatch }: {
791
+ writeResourceMetadata({ spaceId, collectionId, resourceId, custom, epoch, uniqueIndexes, ifMatch, ifNoneMatch }: {
790
792
  spaceId: string;
791
793
  collectionId: string;
792
794
  resourceId: string;
793
795
  custom: ResourceMetadataCustom | Record<string, unknown>;
794
796
  epoch?: string;
797
+ uniqueIndexes?: NormalizedIndexDeclaration[];
795
798
  ifMatch?: string;
796
799
  ifNoneMatch?: boolean;
797
800
  }): Promise<{
@@ -1052,6 +1055,87 @@ export declare class FileSystemBackend implements StorageBackend {
1052
1055
  * @returns {Promise<Array<{ resourceId: string, document: unknown }>>}
1053
1056
  */
1054
1057
  private _readJsonCandidates;
1058
+ /**
1059
+ * Plaintext equality query (the `equality` query profile; see the
1060
+ * `StorageBackend.queryByEquality` contract). Reads every live Resource of
1061
+ * the Collection -- JSON Resources carrying parsed `content`, blobs carrying
1062
+ * only their sidecar `custom` -- and hands the candidates to the shared
1063
+ * evaluator (`lib/equalityIndex.ts`) for extraction, matching, ordering, and
1064
+ * cursor pagination. O(n) over the Collection per call, with every JSON body
1065
+ * read -- deliberate for this teaching backend; a materialized backend would
1066
+ * answer from an attribute index. Tombstones are excluded naturally (no live
1067
+ * content file).
1068
+ * @param options {object}
1069
+ * @param options.spaceId {string}
1070
+ * @param options.collectionId {string}
1071
+ * @param options.query {EqualityQuery}
1072
+ * @param options.indexes {NormalizedIndexDeclaration[]} the normalized
1073
+ * declared indexes (the request layer resolves them from the description)
1074
+ * @param [options.count] {boolean} return only the match count
1075
+ * @param [options.limit] {number} requested page size
1076
+ * @param [options.cursor] {string} opaque cursor from a prior page
1077
+ * @returns {Promise<{ count: number } | EqualityQueryPage>}
1078
+ */
1079
+ queryByEquality({ spaceId, collectionId, query, indexes, count, limit, cursor }: {
1080
+ spaceId: string;
1081
+ collectionId: string;
1082
+ query: EqualityQuery;
1083
+ indexes: NormalizedIndexDeclaration[];
1084
+ count?: boolean;
1085
+ limit?: number;
1086
+ cursor?: string;
1087
+ }): Promise<{
1088
+ count: number;
1089
+ } | EqualityQueryPage>;
1090
+ /**
1091
+ * Declare-time uniqueness scan for the `equality` profile (see the
1092
+ * `StorageBackend.findEqualityUniqueViolation` contract): reads the
1093
+ * Collection's live Resources and delegates to the shared scan, which reports
1094
+ * the first `(name, value)` claimed by two different Resources under the given
1095
+ * `unique` declarations (or `undefined` when none is).
1096
+ * @param options {object}
1097
+ * @param options.spaceId {string}
1098
+ * @param options.collectionId {string}
1099
+ * @param options.indexes {NormalizedIndexDeclaration[]}
1100
+ * @returns {Promise<{ name: string, value: EqualityValue } | undefined>}
1101
+ */
1102
+ findEqualityUniqueViolation({ spaceId, collectionId, indexes }: {
1103
+ spaceId: string;
1104
+ collectionId: string;
1105
+ indexes: NormalizedIndexDeclaration[];
1106
+ }): Promise<{
1107
+ name: string;
1108
+ value: EqualityValue;
1109
+ } | undefined>;
1110
+ /**
1111
+ * Reads every live Resource of a Collection as an equality candidate -- the
1112
+ * candidate set for the equality query and the plaintext unique-attribute
1113
+ * conflict scans. Unlike `_readJsonCandidates` this INCLUDES blob Resources
1114
+ * (a blob is queryable through its `custom`-sourced attributes): each entry
1115
+ * resolves `{ resourceId, content?, custom? }`, where `content` is the parsed
1116
+ * JSON of a JSON-typed representation (the blob content read is skipped, and
1117
+ * unparsable JSON is dropped, as in `_readJsonCandidates`) and `custom` is the
1118
+ * `.meta.` sidecar's `custom` when present. Tombstones are excluded naturally
1119
+ * (no live `r.` content file); an optional excluded Resource is skipped. An
1120
+ * absent Collection dir resolves empty.
1121
+ * @param options {object}
1122
+ * @param options.spaceId {string}
1123
+ * @param options.collectionId {string}
1124
+ * @param [options.excludeResourceId] {string} omit this Resource (a conflict
1125
+ * scan excludes the Resource being written)
1126
+ * @returns {Promise<EqualityCandidate[]>}
1127
+ */
1128
+ private _readEqualityCandidates;
1129
+ /**
1130
+ * Reads and parses a single Resource's stored JSON content, or resolves
1131
+ * `undefined` when the Resource is absent, a blob, or unparsable JSON -- the
1132
+ * content side of a custom-sourced unique-attribute claim on a metadata write.
1133
+ * @param options {object}
1134
+ * @param options.collectionDir {string}
1135
+ * @param options.resourceId {string}
1136
+ * @returns {Promise<unknown>}
1137
+ */
1138
+ private _readResourceJsonContent;
1055
1139
  /**
1056
1140
  * Builds the on-disk path for a policy document. Stored as a dot-file keyed by
1057
1141
  * the entity id, alongside the matching `.space.` / `.collection.` description:
@@ -1 +1 @@
1
- {"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/backends/filesystem.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AAItD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AA2DhD,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,wBAAwB,CAAA;AAM/B,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,IAAI,EACL,MAAM,aAAa,CAAA;AAsBpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IAMjB,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,OAAO,CAAC,EAAE,M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AY,EACb,EAAE;QACD,KAAK,EAAE,eAAe,CAAA;QACtB,SAAS,EAAE,MAAM,CAAA;QACjB,YAAY,EAAE,MAAM,CAAA;KACrB,GAAG,MAAM;IAYV;;;;;;;;;OASG;IACG,gBAAgB,CAAC,EACrB,KAAK,EACL,MAAM,EACP,EAAE;QACD,KAAK,EAAE,eAAe,CAAA;QACtB,MAAM,EAAE,gBAAgB,CAAA;KACzB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCjB;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,EACd,KAAK,EACL,YAAY,EACb,EAAE;QACD,KAAK,EAAE,eAAe,CAAA;QACtB,YAAY,EAAE,iBAAiB,EAAE,CAAA;KAClC,GAAG,OAAO,CAAC,OAAO,CAAC;CA0BrB"}
1
+ {"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/backends/filesystem.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AAItD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AA2DhD,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,wBAAwB,CAAA;AAM/B,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAEjB,aAAa,EACb,0BAA0B,EAC3B,MAAM,yBAAyB,CAAA;AAMhC,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,IAAI,EACL,MAAM,aAAa,CAAA;AAsBpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,UAAU,WAA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C,EACrB,KAAK,EACL,MAAM,EACP,EAAE;QACD,KAAK,EAAE,eAAe,CAAA;QACtB,MAAM,EAAE,gBAAgB,CAAA;KACzB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCjB;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,EACd,KAAK,EACL,YAAY,EACb,EAAE;QACD,KAAK,EAAE,eAAe,CAAA;QACtB,YAAY,EAAE,iBAAiB,EAAE,CAAA;KAClC,GAAG,OAAO,CAAC,OAAO,CAAC;CA0BrB"}
@@ -32,6 +32,7 @@ import { normalizeDescriptionWrite } from '../lib/collectionDescription.js';
32
32
  import { atomicWriteFile, atomicCreateFile, tempPathFor, commitTempFile } from '../lib/atomicFile.js';
33
33
  import { DEFAULT_PAGE_SIZE, clampPageSize } from '../lib/pagination.js';
34
34
  import { runBlindedIndexQuery, collectUniqueBlindedTerms, assertNoUniqueBlindedConflict } from '../lib/blindedIndex.js';
35
+ import { runEqualityQuery, assertNoUniqueEqualityConflict, findEqualityUniqueViolation } from '../lib/equalityIndex.js';
35
36
  import { assertWritePrecondition, assertMetaWritePrecondition, assertCollectionWritePrecondition } from '../lib/preconditions.js';
36
37
  const { Store: MetadataJsonStore } = jsonfs;
37
38
  const execFileAsync = promisify(execFile);
@@ -232,10 +233,14 @@ export class FileSystemBackend {
232
233
  // Resources, and conditional (`If-Match`) Collection Description writes.
233
234
  // `chunked-streams`: chunk addressing (`/{resourceId}/chunks/{n}`) for a
234
235
  // large Resource, each chunk stored opaquely (bytes + content-type).
236
+ // `equality-query`: serves the `equality` profile -- server-extracted
237
+ // plaintext attribute equality over a Collection's declared `indexes`
238
+ // (`queryByEquality`), plus the GET `filter[attr]=value` equality filter.
235
239
  features: [
236
240
  'conditional-writes',
237
241
  'changes-query',
238
242
  'blinded-index-query',
243
+ 'equality-query',
239
244
  'key-epochs',
240
245
  'chunked-streams'
241
246
  ]
@@ -1529,7 +1534,7 @@ export class FileSystemBackend {
1529
1534
  * @param [options.ifNoneMatch] {boolean} `If-None-Match: *` (create-if-absent)
1530
1535
  * @returns {Promise<{ version: number }>} the Resource's new version
1531
1536
  */
1532
- async writeResource({ spaceId, collectionId, resourceId, input, createdBy, epoch, ifMatch, ifNoneMatch }) {
1537
+ async writeResource({ spaceId, collectionId, resourceId, input, createdBy, epoch, uniqueIndexes, ifMatch, ifNoneMatch }) {
1533
1538
  const collectionDir = this._collectionDir({ spaceId, collectionId });
1534
1539
  const lockKey = this._resourceLockKey({
1535
1540
  spaceId,
@@ -1546,26 +1551,53 @@ export class FileSystemBackend {
1546
1551
  ifMatch,
1547
1552
  ifNoneMatch
1548
1553
  }));
1549
- // The EDV unique-attribute invariant (`unique: true` blinded attributes;
1550
- // the `blinded-index-query` feature): a write claiming a unique blinded
1551
- // triple must not collide with another live document's claim. Only a
1552
- // unique-carrying JSON write can create a new claim, so only such writes
1553
- // pay for it: they serialize per Collection (the outer lock, so two racing
1554
- // claimants cannot both pass the scan), evaluate the conflict against the
1555
- // Collection's other live JSON documents, then take the ordinary
1556
- // per-Resource lock nested inside. Distinct-key nesting cannot deadlock:
1557
- // plain writes never hold a Resource key while waiting on a Collection key.
1558
- if (input.kind === 'json' &&
1559
- collectUniqueBlindedTerms({ document: input.data }).length > 0) {
1554
+ // Two unique-attribute invariants can force a write to serialize on the
1555
+ // Collection lock before it takes its per-Resource lock: the EDV blinded
1556
+ // one (`unique: true` blinded attributes; the `blinded-index-query`
1557
+ // feature) and the plaintext equality one (a Collection's `unique`-declared
1558
+ // `indexes`; the `equality-query` feature). Only a JSON content write can
1559
+ // create either claim, so only such writes pay for it: they serialize per
1560
+ // Collection (the outer lock, so two racing claimants cannot both pass the
1561
+ // scan), evaluate the conflict against the Collection's other live
1562
+ // documents, then take the ordinary per-Resource lock nested inside.
1563
+ // Distinct-key nesting cannot deadlock: plain writes never hold a Resource
1564
+ // key while waiting on a Collection key. The two conditions are unified so a
1565
+ // write carrying both claims acquires the Collection lock exactly once.
1566
+ const blindedUnique = input.kind === 'json' &&
1567
+ collectUniqueBlindedTerms({ document: input.data }).length > 0;
1568
+ const equalityUnique = input.kind === 'json' &&
1569
+ uniqueIndexes !== undefined &&
1570
+ uniqueIndexes.length > 0;
1571
+ if (blindedUnique || equalityUnique) {
1560
1572
  return this._writeMutex.run(this._collectionLockKey({ spaceId, collectionId }), async () => {
1561
- assertNoUniqueBlindedConflict({
1562
- document: input.data,
1563
- candidates: await this._readJsonCandidates({
1564
- spaceId,
1565
- collectionId,
1566
- excludeResourceId: resourceId
1567
- })
1568
- });
1573
+ if (blindedUnique) {
1574
+ assertNoUniqueBlindedConflict({
1575
+ document: input.kind === 'json' ? input.data : undefined,
1576
+ candidates: await this._readJsonCandidates({
1577
+ spaceId,
1578
+ collectionId,
1579
+ excludeResourceId: resourceId
1580
+ })
1581
+ });
1582
+ }
1583
+ if (equalityUnique) {
1584
+ // A content write does not change the Resource's `custom`, so the
1585
+ // custom side of the claim comes from the CURRENT stored sidecar.
1586
+ const priorSidecar = await this._readMetaSidecar({
1587
+ collectionDir,
1588
+ resourceId
1589
+ });
1590
+ assertNoUniqueEqualityConflict({
1591
+ indexes: uniqueIndexes,
1592
+ content: input.kind === 'json' ? input.data : undefined,
1593
+ custom: priorSidecar?.custom,
1594
+ candidates: await this._readEqualityCandidates({
1595
+ spaceId,
1596
+ collectionId,
1597
+ excludeResourceId: resourceId
1598
+ })
1599
+ });
1600
+ }
1569
1601
  return write();
1570
1602
  });
1571
1603
  }
@@ -1978,7 +2010,7 @@ export class FileSystemBackend {
1978
2010
  * @returns {Promise<{ metaVersion: number } | undefined>} the new
1979
2011
  * `metaVersion`, or `undefined` when the Resource does not exist
1980
2012
  */
1981
- async writeResourceMetadata({ spaceId, collectionId, resourceId, custom, epoch, ifMatch, ifNoneMatch }) {
2013
+ async writeResourceMetadata({ spaceId, collectionId, resourceId, custom, epoch, uniqueIndexes, ifMatch, ifNoneMatch }) {
1982
2014
  const collectionDir = this._collectionDir({ spaceId, collectionId });
1983
2015
  const writeMeta = async () => {
1984
2016
  const filePath = await this._findFile({ collectionDir, resourceId });
@@ -2035,6 +2067,32 @@ export class FileSystemBackend {
2035
2067
  });
2036
2068
  return { metaVersion };
2037
2069
  };
2070
+ // A metadata write can create a plaintext equality unique claim for a
2071
+ // `custom`-sourced attribute (the `equality-query` feature). When the
2072
+ // Collection declares any unique index, serialize on the Collection lock and
2073
+ // scan for a conflict -- content is the Resource's stored JSON content
2074
+ // (unchanged by a metadata write), custom is the incoming value this write
2075
+ // sets -- before taking the per-Resource lock nested inside. Distinct-key
2076
+ // nesting cannot deadlock (plain writes never hold a Resource key while
2077
+ // waiting on a Collection key).
2078
+ if (uniqueIndexes !== undefined && uniqueIndexes.length > 0) {
2079
+ return this._writeMutex.run(this._collectionLockKey({ spaceId, collectionId }), async () => {
2080
+ assertNoUniqueEqualityConflict({
2081
+ indexes: uniqueIndexes,
2082
+ content: await this._readResourceJsonContent({
2083
+ collectionDir,
2084
+ resourceId
2085
+ }),
2086
+ custom,
2087
+ candidates: await this._readEqualityCandidates({
2088
+ spaceId,
2089
+ collectionId,
2090
+ excludeResourceId: resourceId
2091
+ })
2092
+ });
2093
+ return this._writeMutex.run(this._resourceLockKey({ spaceId, collectionId, resourceId }), writeMeta);
2094
+ });
2095
+ }
2038
2096
  return this._writeMutex.run(this._resourceLockKey({ spaceId, collectionId, resourceId }), writeMeta);
2039
2097
  }
2040
2098
  /**
@@ -2690,6 +2748,147 @@ export class FileSystemBackend {
2690
2748
  }
2691
2749
  }))).filter(candidate => candidate !== undefined);
2692
2750
  }
2751
+ /**
2752
+ * Plaintext equality query (the `equality` query profile; see the
2753
+ * `StorageBackend.queryByEquality` contract). Reads every live Resource of
2754
+ * the Collection -- JSON Resources carrying parsed `content`, blobs carrying
2755
+ * only their sidecar `custom` -- and hands the candidates to the shared
2756
+ * evaluator (`lib/equalityIndex.ts`) for extraction, matching, ordering, and
2757
+ * cursor pagination. O(n) over the Collection per call, with every JSON body
2758
+ * read -- deliberate for this teaching backend; a materialized backend would
2759
+ * answer from an attribute index. Tombstones are excluded naturally (no live
2760
+ * content file).
2761
+ * @param options {object}
2762
+ * @param options.spaceId {string}
2763
+ * @param options.collectionId {string}
2764
+ * @param options.query {EqualityQuery}
2765
+ * @param options.indexes {NormalizedIndexDeclaration[]} the normalized
2766
+ * declared indexes (the request layer resolves them from the description)
2767
+ * @param [options.count] {boolean} return only the match count
2768
+ * @param [options.limit] {number} requested page size
2769
+ * @param [options.cursor] {string} opaque cursor from a prior page
2770
+ * @returns {Promise<{ count: number } | EqualityQueryPage>}
2771
+ */
2772
+ async queryByEquality({ spaceId, collectionId, query, indexes, count, limit, cursor }) {
2773
+ const candidates = await this._readEqualityCandidates({
2774
+ spaceId,
2775
+ collectionId
2776
+ });
2777
+ return runEqualityQuery({
2778
+ candidates,
2779
+ query,
2780
+ indexes,
2781
+ count,
2782
+ limit,
2783
+ cursor
2784
+ });
2785
+ }
2786
+ /**
2787
+ * Declare-time uniqueness scan for the `equality` profile (see the
2788
+ * `StorageBackend.findEqualityUniqueViolation` contract): reads the
2789
+ * Collection's live Resources and delegates to the shared scan, which reports
2790
+ * the first `(name, value)` claimed by two different Resources under the given
2791
+ * `unique` declarations (or `undefined` when none is).
2792
+ * @param options {object}
2793
+ * @param options.spaceId {string}
2794
+ * @param options.collectionId {string}
2795
+ * @param options.indexes {NormalizedIndexDeclaration[]}
2796
+ * @returns {Promise<{ name: string, value: EqualityValue } | undefined>}
2797
+ */
2798
+ async findEqualityUniqueViolation({ spaceId, collectionId, indexes }) {
2799
+ const candidates = await this._readEqualityCandidates({
2800
+ spaceId,
2801
+ collectionId
2802
+ });
2803
+ return findEqualityUniqueViolation({ indexes, candidates });
2804
+ }
2805
+ /**
2806
+ * Reads every live Resource of a Collection as an equality candidate -- the
2807
+ * candidate set for the equality query and the plaintext unique-attribute
2808
+ * conflict scans. Unlike `_readJsonCandidates` this INCLUDES blob Resources
2809
+ * (a blob is queryable through its `custom`-sourced attributes): each entry
2810
+ * resolves `{ resourceId, content?, custom? }`, where `content` is the parsed
2811
+ * JSON of a JSON-typed representation (the blob content read is skipped, and
2812
+ * unparsable JSON is dropped, as in `_readJsonCandidates`) and `custom` is the
2813
+ * `.meta.` sidecar's `custom` when present. Tombstones are excluded naturally
2814
+ * (no live `r.` content file); an optional excluded Resource is skipped. An
2815
+ * absent Collection dir resolves empty.
2816
+ * @param options {object}
2817
+ * @param options.spaceId {string}
2818
+ * @param options.collectionId {string}
2819
+ * @param [options.excludeResourceId] {string} omit this Resource (a conflict
2820
+ * scan excludes the Resource being written)
2821
+ * @returns {Promise<EqualityCandidate[]>}
2822
+ */
2823
+ async _readEqualityCandidates({ spaceId, collectionId, excludeResourceId }) {
2824
+ const collectionDir = this._collectionDir({ spaceId, collectionId });
2825
+ let entries = [];
2826
+ try {
2827
+ entries = await fs.promises.readdir(collectionDir, {
2828
+ withFileTypes: true
2829
+ });
2830
+ }
2831
+ catch (err) {
2832
+ if (err.code !== 'ENOENT') {
2833
+ throw err;
2834
+ }
2835
+ }
2836
+ return await Promise.all(entries
2837
+ .filter(entry => entry.isFile() && entry.name.startsWith('r.'))
2838
+ .map(entry => ({
2839
+ fileName: entry.name,
2840
+ ...parseResourceFileName(entry.name)
2841
+ }))
2842
+ .filter(({ resourceId }) => resourceId !== excludeResourceId)
2843
+ .map(async ({ resourceId, fileName, contentType }) => {
2844
+ // Parse the content only for a JSON representation; a blob contributes
2845
+ // no content-sourced attributes (its `custom` still makes it
2846
+ // queryable). Unparsable JSON is treated as no content.
2847
+ let content;
2848
+ if (isJson({ contentType })) {
2849
+ try {
2850
+ content = JSON.parse(await fs.promises.readFile(path.join(collectionDir, fileName), 'utf8'));
2851
+ }
2852
+ catch {
2853
+ content = undefined;
2854
+ }
2855
+ }
2856
+ const sidecar = await this._readMetaSidecar({
2857
+ collectionDir,
2858
+ resourceId
2859
+ });
2860
+ return {
2861
+ resourceId,
2862
+ ...(content !== undefined && { content }),
2863
+ ...(sidecar?.custom !== undefined && { custom: sidecar.custom })
2864
+ };
2865
+ }));
2866
+ }
2867
+ /**
2868
+ * Reads and parses a single Resource's stored JSON content, or resolves
2869
+ * `undefined` when the Resource is absent, a blob, or unparsable JSON -- the
2870
+ * content side of a custom-sourced unique-attribute claim on a metadata write.
2871
+ * @param options {object}
2872
+ * @param options.collectionDir {string}
2873
+ * @param options.resourceId {string}
2874
+ * @returns {Promise<unknown>}
2875
+ */
2876
+ async _readResourceJsonContent({ collectionDir, resourceId }) {
2877
+ const filePath = await this._findFile({ collectionDir, resourceId });
2878
+ if (!filePath) {
2879
+ return undefined;
2880
+ }
2881
+ const { contentType } = parseResourceFileName(path.basename(filePath));
2882
+ if (!isJson({ contentType })) {
2883
+ return undefined;
2884
+ }
2885
+ try {
2886
+ return JSON.parse(await fs.promises.readFile(filePath, 'utf8'));
2887
+ }
2888
+ catch {
2889
+ return undefined;
2890
+ }
2891
+ }
2693
2892
  // Policies
2694
2893
  /**
2695
2894
  * Builds the on-disk path for a policy document. Stored as a dot-file keyed by