@silverprotocol/core 0.12.5 → 1.0.0-rc.1

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 (51) hide show
  1. package/README.md +17 -9
  2. package/dist/agjson.d.ts +594 -594
  3. package/dist/agjson.d.ts.map +1 -1
  4. package/dist/agjson.js +25 -14
  5. package/dist/agjson.js.map +1 -1
  6. package/dist/atomic-push.js.map +1 -1
  7. package/dist/copy-json.d.ts +27 -4
  8. package/dist/copy-json.d.ts.map +1 -1
  9. package/dist/copy-json.js +111 -1
  10. package/dist/copy-json.js.map +1 -1
  11. package/dist/depth.d.ts +0 -8
  12. package/dist/depth.d.ts.map +1 -1
  13. package/dist/depth.js +0 -9
  14. package/dist/depth.js.map +1 -1
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/ingest.d.ts +2 -2
  20. package/dist/ingest.js +4 -4
  21. package/dist/ingest.js.map +1 -1
  22. package/dist/json-patch.d.ts.map +1 -1
  23. package/dist/json-patch.js +5 -1
  24. package/dist/json-patch.js.map +1 -1
  25. package/dist/persist.js.map +1 -1
  26. package/dist/record.js +2 -2
  27. package/dist/record.js.map +1 -1
  28. package/dist/reduce.d.ts +1 -1
  29. package/dist/reduce.d.ts.map +1 -1
  30. package/dist/reduce.js +277 -113
  31. package/dist/reduce.js.map +1 -1
  32. package/dist/stream-assembler.d.ts +6 -7
  33. package/dist/stream-assembler.d.ts.map +1 -1
  34. package/dist/stream-assembler.js +21 -18
  35. package/dist/stream-assembler.js.map +1 -1
  36. package/dist/wire.d.ts +21 -3
  37. package/dist/wire.d.ts.map +1 -1
  38. package/dist/wire.js +34 -5
  39. package/dist/wire.js.map +1 -1
  40. package/package.json +1 -1
  41. package/src/agjson.ts +36 -25
  42. package/src/atomic-push.ts +2 -2
  43. package/src/copy-json.ts +107 -4
  44. package/src/depth.ts +0 -10
  45. package/src/index.ts +1 -0
  46. package/src/ingest.ts +4 -4
  47. package/src/json-patch.ts +5 -1
  48. package/src/record.ts +2 -2
  49. package/src/reduce.ts +256 -112
  50. package/src/stream-assembler.ts +21 -18
  51. package/src/wire.ts +36 -6
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  <p align="center">
13
13
  <a href="https://www.npmjs.com/package/@silverprotocol/core"><img src="https://img.shields.io/npm/v/%40silverprotocol%2Fcore?color=0a7"></a>
14
14
  <a href="https://github.com/silverprotocol/AgJSON/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue"></a>
15
- <a href="https://silverprotocol.io/AgJSON"><img src="https://img.shields.io/badge/spec-1.0.0--draft.8-6ee7ff"></a>
15
+ <a href="https://silverprotocol.io/AgJSON"><img src="https://img.shields.io/badge/spec-1.0.0--rc.1-6ee7ff"></a>
16
16
  </p>
17
17
 
18
18
  ---
@@ -69,7 +69,8 @@ console.log(AGJSON_VERSION, messages);
69
69
  ```
70
70
 
71
71
  `ingestAgEvents` validates raw wire objects against `AgEvent` and never throws
72
- (the consumer posture). Unknown fields pass through at every depth. An event it
72
+ (the consumer posture). Unknown fields pass through at every depth, less an own
73
+ `__proto__` member, which it drops (SPEC §13.7). An event it
73
74
  cannot validate (a newer event type, an unknown enum value, a malformed known
74
75
  type) is not folded: it rides in place as `{type: "ext.agjson.ignored", seq,
75
76
  ignoredType, raw}`, which keeps its `seq` slot so the `Reducer` never mistakes it
@@ -77,7 +78,7 @@ for a gap. `raw` is for live inspection only; don't persist it. Input that is no
77
78
  an event at all (not an object, no string `type`, no number `seq`) returns
78
79
  nothing and goes to the optional `onReject` callback. `Reducer` folds the
79
80
  validated stream into the normative snapshot; `AGJSON_VERSION` is the wire
80
- version this build implements (`1.0.0-draft.8`).
81
+ version this build implements (`1.0.0-rc.1`).
81
82
 
82
83
  ### Stored records and inputs
83
84
 
@@ -99,7 +100,8 @@ if (!checked.ok) return reply(400, { code: checked.code, path: checked.path });
99
100
  omitted whole, and a record that fails is omitted from its array. Each report
100
101
  carries its `path`, the element's `type` when it has one, and the verbatim
101
102
  value, so inserting every report back at its index rebuilds the stored
102
- record. Unknown fields pass through at every depth; nothing is coerced. What
103
+ record. Unknown fields pass through at every depth, less an own `__proto__`
104
+ member; nothing is coerced. What
103
105
  they return is a view: keep storing and forwarding the record as received,
104
106
  never the view. A record carried inside an event keeps the event rule above:
105
107
  a `messages.snapshot` with one unknown block is ignored whole, so it cannot
@@ -115,7 +117,8 @@ if (!checked.ok) return reply(400, { code: checked.code, path: checked.path });
115
117
  `protocol` other than `"agjson"`. It judges `protocol` first, then `version`,
116
118
  then the rest; it checks the envelope members whatever the `kind`, and when
117
119
  the rest has both kinds of problem the class is `malformed`. An accepted
118
- input comes back with its unknown fields intact.
120
+ input comes back with its unknown fields intact, less an own `__proto__`
121
+ member.
119
122
  - `validateHitlAnswer` rejects an answer whose `status` is not a defined one
120
123
  (`unknown-status`), so an unrecognized status is never read as a grant.
121
124
 
@@ -160,6 +163,11 @@ replaces the record whole, `_meta` included, and a `patch` replaces `_meta`
160
163
  only when the write carries one. A member of the write that the record does
161
164
  not declare is not carried.
162
165
 
166
+ `Reducer.push` folds each event less an own `__proto__` member at any depth
167
+ (SPEC §13.7), so no state, memory or block value in the result holds one. A host
168
+ that seeds a fold from its own store copies the stored value with `copyJson`,
169
+ which drops the member the same way and returns only ordinary objects.
170
+
163
171
  ## Produce AgJSON
164
172
 
165
173
  Turn a framework's native stream into AgJSON with its normalizer — the output is
@@ -190,10 +198,10 @@ they may change in a minor release. Two kinds are tagged:
190
198
  (`NORMALIZER_ERROR_MESSAGE`, `normalizerErrorCode`), and the JSON-safety
191
199
  helpers with their issue types and markers (`toJsonValue*`, `isJsonValue`,
192
200
  `JsonSafeIssue*`, `JSON_SAFE_*`).
193
- - **In the framework packages, an exported type that restates the upstream
194
- SDK's native shapes.** It follows the package's peer range. Each package's
195
- own API (its `createXNormalizer()`, the options it takes and its helpers)
196
- carries the 1.x promise.
201
+ - **In the framework packages, an exported type or value that restates the
202
+ upstream SDK's native shapes or values.** It follows the package's peer
203
+ range. Each package's own API (its `createXNormalizer()`, the options it
204
+ takes and its helpers) carries the 1.x promise.
197
205
 
198
206
  ## Learn more
199
207