@astrale-os/kernel-client 0.6.0-beta.43 → 0.6.0-beta.45

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.
@@ -31,8 +31,11 @@ export function createSchema(call, limits) {
31
31
  return decoded;
32
32
  },
33
33
  async uninstall(request, options) {
34
- const output = value(await call(invocation(UNINSTALL_PATH, request), lifecycleOptions(options, admittedLimits.lifecycleTimeoutMs)));
35
- return acceptOutput(uninstallOutput, output);
34
+ const snapshot = snapshotUninstallRequest(request);
35
+ const output = value(await call(invocation(UNINSTALL_PATH, snapshot), lifecycleOptions(options, admittedLimits.lifecycleTimeoutMs)));
36
+ const receipt = acceptOutput(uninstallOutput, output);
37
+ proveUninstallReceipt(snapshot, receipt);
38
+ return receipt;
36
39
  },
37
40
  async inspect(origin, options) {
38
41
  return introspect(call, admittedLimits, { kind: 'inspect', origin }, options);
@@ -42,6 +45,26 @@ export function createSchema(call, limits) {
42
45
  },
43
46
  });
44
47
  }
48
+ function snapshotUninstallRequest(request) {
49
+ return Object.freeze({
50
+ operation: request.operation,
51
+ domains: Object.freeze([...new Set(request.domains)].sort(compare)),
52
+ data: Object.freeze({ mode: request.data.mode }),
53
+ });
54
+ }
55
+ function proveUninstallReceipt(request, receipt) {
56
+ if (receipt.operation !== request.operation) {
57
+ throw new TypeError('Schema uninstall result does not match the requested operation.');
58
+ }
59
+ const actual = receipt.transitions.map((transition) => transition.intent.origin);
60
+ if (actual.length !== request.domains.length ||
61
+ actual.some((origin, index) => origin !== request.domains[index])) {
62
+ throw new TypeError('Schema uninstall result does not match the requested Domains.');
63
+ }
64
+ }
65
+ function compare(left, right) {
66
+ return left < right ? -1 : left > right ? 1 : 0;
67
+ }
45
68
  function installationResultLimit(maximumDomainBytes, roots) {
46
69
  const perDomain = maximumDomainBytes + 4_096;
47
70
  if (roots > Math.floor((Number.MAX_SAFE_INTEGER - 4_096) / perDomain)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-client",
3
- "version": "0.6.0-beta.43",
3
+ "version": "0.6.0-beta.45",
4
4
  "description": "Universal Client — protocol-first, transport-agnostic",
5
5
  "keywords": [
6
6
  "astrale",
@@ -65,14 +65,14 @@
65
65
  "access": "public"
66
66
  },
67
67
  "dependencies": {
68
- "@astrale-os/kernel-core": "0.9.0-beta.32",
69
- "@astrale-os/kernel-dsl": "0.2.0-beta.24",
70
- "@astrale-os/kernel-protocol": "0.5.0-beta.35",
68
+ "@astrale-os/kernel-core": "0.9.0-beta.34",
69
+ "@astrale-os/kernel-dsl": "0.2.0-beta.25",
70
+ "@astrale-os/kernel-protocol": "0.5.0-beta.37",
71
71
  "@tanstack/pacer": "0.20.1",
72
72
  "msgpackr": "^2.0.5"
73
73
  },
74
74
  "devDependencies": {
75
- "@astrale-os/kernel-server": "0.5.0-beta.37",
75
+ "@astrale-os/kernel-server": "0.5.0-beta.39",
76
76
  "@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
77
77
  "@types/node": "^22.0.0",
78
78
  "typescript": "7.0.2",