@inixiative/signet 0.11.0 → 0.11.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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/events.ts +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inixiative/signet",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Present Kingdom Signets: the wire contracts, DPoP proofs, device pairing and a renewing client shared by Kingdom, Archive, Foundry and Oracle.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -35,7 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@asteasolutions/zod-to-openapi": "^9.1.0",
37
37
  "@biomejs/biome": "2.5.2",
38
- "@inixiative/config": "^0.5.170",
38
+ "@inixiative/config": "^0.5.171",
39
39
  "@types/bun": "1.4.4",
40
40
  "lefthook": "2.1.9",
41
41
  "typescript": "6.0.3",
package/src/events.ts CHANGED
@@ -96,7 +96,19 @@ export const selectEvent = (lens: EventsLens, event: IntegrationEvent): Selected
96
96
  ) as SelectedEvent;
97
97
  };
98
98
 
99
- const sameJson = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b);
99
+ /** JSON with object keys sorted at every depth: a condition read back from jsonb reorders them. */
100
+ const canonical = (value: unknown): unknown =>
101
+ Array.isArray(value)
102
+ ? value.map(canonical)
103
+ : value !== null && typeof value === 'object'
104
+ ? Object.fromEntries(
105
+ Object.keys(value)
106
+ .sort()
107
+ .map((key) => [key, canonical((value as Record<string, unknown>)[key])]),
108
+ )
109
+ : value;
110
+ const sameJson = (a: unknown, b: unknown) =>
111
+ JSON.stringify(canonical(a)) === JSON.stringify(canonical(b));
100
112
 
101
113
  /**
102
114
  * `granted` reaches nothing `requested` doesn't. Conservative and structural, since this package