@honua/react 0.1.7-beta.0 → 0.1.10-beta.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 (249) hide show
  1. package/control-plane/admin-client.d.ts +89 -0
  2. package/control-plane/admin-client.d.ts.map +1 -0
  3. package/control-plane/admin-client.js +200 -0
  4. package/control-plane/client.d.ts +1 -1
  5. package/control-plane/client.d.ts.map +1 -1
  6. package/control-plane/client.js +145 -11
  7. package/control-plane/commands/catalog.d.ts +133 -0
  8. package/control-plane/commands/catalog.d.ts.map +1 -0
  9. package/control-plane/commands/catalog.js +365 -0
  10. package/control-plane/commands/errors.d.ts +96 -0
  11. package/control-plane/commands/errors.d.ts.map +1 -0
  12. package/control-plane/commands/errors.js +130 -0
  13. package/control-plane/commands/identity.d.ts +71 -0
  14. package/control-plane/commands/identity.d.ts.map +1 -0
  15. package/control-plane/commands/identity.js +0 -0
  16. package/control-plane/commands/index.d.ts +39 -0
  17. package/control-plane/commands/index.d.ts.map +1 -0
  18. package/control-plane/commands/index.js +34 -0
  19. package/control-plane/commands/runtime.d.ts +146 -0
  20. package/control-plane/commands/runtime.d.ts.map +1 -0
  21. package/control-plane/commands/runtime.js +330 -0
  22. package/control-plane/commands/types.d.ts +228 -0
  23. package/control-plane/commands/types.d.ts.map +1 -0
  24. package/control-plane/commands/types.js +30 -0
  25. package/control-plane/commands/validate.d.ts +27 -0
  26. package/control-plane/commands/validate.d.ts.map +1 -0
  27. package/control-plane/commands/validate.js +132 -0
  28. package/control-plane/generated/admin-api.d.ts +30265 -0
  29. package/control-plane/generated/admin-api.d.ts.map +1 -0
  30. package/control-plane/generated/admin-api.js +5 -0
  31. package/control-plane/generated/admin-operations.d.ts +4053 -0
  32. package/control-plane/generated/admin-operations.d.ts.map +1 -0
  33. package/control-plane/generated/admin-operations.js +820 -0
  34. package/control-plane/index.d.ts +11 -0
  35. package/control-plane/index.d.ts.map +1 -1
  36. package/control-plane/index.js +8 -0
  37. package/control-plane/types.d.ts +14 -0
  38. package/control-plane/types.d.ts.map +1 -1
  39. package/core/client.d.ts.map +1 -1
  40. package/core/client.js +29 -31
  41. package/core/credential-redaction.d.ts +163 -0
  42. package/core/credential-redaction.d.ts.map +1 -0
  43. package/core/credential-redaction.js +389 -0
  44. package/core/error-classifications.d.ts +15 -0
  45. package/core/error-classifications.d.ts.map +1 -1
  46. package/core/error-classifications.js +15 -0
  47. package/core/error-code-registry.d.ts +15 -0
  48. package/core/error-code-registry.d.ts.map +1 -1
  49. package/core/error-code-registry.js +15 -0
  50. package/core/error-envelope.d.ts +31 -0
  51. package/core/error-envelope.d.ts.map +1 -1
  52. package/core/error-envelope.js +11 -0
  53. package/core/errors.d.ts +15 -3
  54. package/core/errors.d.ts.map +1 -1
  55. package/core/errors.js +254 -2
  56. package/core/geometry-input-sr.d.ts +3 -0
  57. package/core/geometry-input-sr.d.ts.map +1 -0
  58. package/core/geometry-input-sr.js +28 -0
  59. package/core/geoservices.d.ts.map +1 -1
  60. package/core/geoservices.js +33 -6
  61. package/core/grpc-adapter.d.ts +2 -2
  62. package/core/grpc-adapter.d.ts.map +1 -1
  63. package/core/grpc-adapter.js +41 -9
  64. package/core/job-run-errors.d.ts +10 -0
  65. package/core/job-run-errors.d.ts.map +1 -0
  66. package/core/job-run-errors.js +14 -0
  67. package/core/job-run-lifecycle.d.ts +34 -0
  68. package/core/job-run-lifecycle.d.ts.map +1 -0
  69. package/core/job-run-lifecycle.js +193 -0
  70. package/core/ogc-processes.d.ts +38 -31
  71. package/core/ogc-processes.d.ts.map +1 -1
  72. package/core/ogc-processes.js +123 -173
  73. package/core/pbf-decoder.d.ts.map +1 -1
  74. package/core/pbf-decoder.js +16 -4
  75. package/core/process-runner.js +15 -100
  76. package/core/protocol-transport.d.ts +6 -1
  77. package/core/protocol-transport.d.ts.map +1 -1
  78. package/core/request-pipeline.d.ts +6 -3
  79. package/core/request-pipeline.d.ts.map +1 -1
  80. package/core/request-pipeline.js +28 -11
  81. package/core/spatial-filter.d.ts +4 -4
  82. package/core/spatial-filter.d.ts.map +1 -1
  83. package/core/spatial-filter.js +7 -7
  84. package/core/surfaces.d.ts +2 -8
  85. package/core/surfaces.d.ts.map +1 -1
  86. package/core/surfaces.js +21 -112
  87. package/core/types.d.ts +21 -9
  88. package/core/types.d.ts.map +1 -1
  89. package/esri-compat/class-breaks-renderer.d.ts +2 -0
  90. package/esri-compat/class-breaks-renderer.d.ts.map +1 -1
  91. package/esri-compat/class-breaks-renderer.js +7 -0
  92. package/esri-compat/controls.d.ts +10 -1
  93. package/esri-compat/controls.d.ts.map +1 -1
  94. package/esri-compat/controls.js +86 -2
  95. package/esri-compat/directions.d.ts +35 -0
  96. package/esri-compat/directions.d.ts.map +1 -1
  97. package/esri-compat/directions.js +153 -2
  98. package/esri-compat/expand.d.ts +1 -0
  99. package/esri-compat/expand.d.ts.map +1 -1
  100. package/esri-compat/expand.js +61 -0
  101. package/esri-compat/feature-layer.d.ts +29 -4
  102. package/esri-compat/feature-layer.d.ts.map +1 -1
  103. package/esri-compat/feature-layer.js +335 -13
  104. package/esri-compat/geometry-engine.d.ts +4 -0
  105. package/esri-compat/geometry-engine.d.ts.map +1 -1
  106. package/esri-compat/geometry-engine.js +8 -1
  107. package/esri-compat/graphic.d.ts +7 -4
  108. package/esri-compat/graphic.d.ts.map +1 -1
  109. package/esri-compat/legend.d.ts +2 -1
  110. package/esri-compat/legend.d.ts.map +1 -1
  111. package/esri-compat/legend.js +15 -0
  112. package/esri-compat/map-view-mount.d.ts +48 -0
  113. package/esri-compat/map-view-mount.d.ts.map +1 -0
  114. package/esri-compat/map-view-mount.js +344 -0
  115. package/esri-compat/map-view.d.ts +38 -6
  116. package/esri-compat/map-view.d.ts.map +1 -1
  117. package/esri-compat/map-view.js +467 -33
  118. package/esri-compat/portal.d.ts +2 -0
  119. package/esri-compat/portal.d.ts.map +1 -1
  120. package/esri-compat/portal.js +7 -2
  121. package/esri-compat/renderer-objects.d.ts +7 -2
  122. package/esri-compat/renderer-objects.d.ts.map +1 -1
  123. package/esri-compat/renderer-objects.js +16 -5
  124. package/esri-compat/route-layer.d.ts +8 -0
  125. package/esri-compat/route-layer.d.ts.map +1 -1
  126. package/esri-compat/route-layer.js +24 -4
  127. package/esri-compat/route-task.d.ts +5 -1
  128. package/esri-compat/route-task.d.ts.map +1 -1
  129. package/esri-compat/route-task.js +119 -7
  130. package/esri-compat/scene-view.d.ts.map +1 -1
  131. package/esri-compat/scene-view.js +1 -0
  132. package/esri-compat/search.d.ts +2 -1
  133. package/esri-compat/search.d.ts.map +1 -1
  134. package/esri-compat/search.js +52 -2
  135. package/esri-compat/unique-value-renderer.d.ts +2 -0
  136. package/esri-compat/unique-value-renderer.d.ts.map +1 -1
  137. package/esri-compat/unique-value-renderer.js +7 -0
  138. package/esri-compat/web-map.d.ts +10 -0
  139. package/esri-compat/web-map.d.ts.map +1 -1
  140. package/esri-compat/web-map.js +102 -0
  141. package/gen/geospatial/v1/common_pb.d.ts +514 -0
  142. package/gen/geospatial/v1/common_pb.d.ts.map +1 -0
  143. package/gen/geospatial/v1/common_pb.js +335 -0
  144. package/gen/geospatial/v1/execution_types_pb.d.ts +1186 -0
  145. package/gen/geospatial/v1/execution_types_pb.d.ts.map +1 -0
  146. package/gen/geospatial/v1/execution_types_pb.js +396 -0
  147. package/gen/geospatial/v1/feature_service_pb.d.ts +403 -0
  148. package/gen/geospatial/v1/feature_service_pb.d.ts.map +1 -0
  149. package/gen/geospatial/v1/feature_service_pb.js +47 -0
  150. package/gen/geospatial/v1/index.d.ts +5 -0
  151. package/gen/geospatial/v1/index.d.ts.map +1 -0
  152. package/gen/geospatial/v1/index.js +9 -0
  153. package/gen/geospatial/v1/spatial_types_pb.d.ts +285 -0
  154. package/gen/geospatial/v1/spatial_types_pb.d.ts.map +1 -0
  155. package/gen/geospatial/v1/spatial_types_pb.js +58 -0
  156. package/gen/geospatial/v1/workspace_artifact_types_pb.d.ts +379 -0
  157. package/gen/geospatial/v1/workspace_artifact_types_pb.d.ts.map +1 -0
  158. package/gen/geospatial/v1/workspace_artifact_types_pb.js +151 -0
  159. package/generated-app/projection.d.ts.map +1 -1
  160. package/generated-app/projection.js +10 -1
  161. package/map/webmap-maplibre.d.ts +2 -1
  162. package/map/webmap-maplibre.d.ts.map +1 -1
  163. package/map/webmap-maplibre.js +3 -0
  164. package/package.json +3 -3
  165. package/query-planner/geoservices.d.ts.map +1 -1
  166. package/query-planner/geoservices.js +2 -0
  167. package/query-planner/grpc.d.ts +4 -4
  168. package/query-planner/grpc.d.ts.map +1 -1
  169. package/query-planner/grpc.js +11 -11
  170. package/query-planner/types.d.ts +6 -4
  171. package/query-planner/types.d.ts.map +1 -1
  172. package/realtime/honua-server.d.ts +4 -0
  173. package/realtime/honua-server.d.ts.map +1 -1
  174. package/realtime/honua-server.js +10 -0
  175. package/realtime/resumable.js +9 -0
  176. package/realtime/types.d.ts +8 -0
  177. package/realtime/types.d.ts.map +1 -1
  178. package/runtime/errors.d.ts +1 -1
  179. package/runtime/errors.d.ts.map +1 -1
  180. package/runtime/errors.js +2 -0
  181. package/runtime/generated/map-package-schema-meta.d.ts +11 -0
  182. package/runtime/generated/map-package-schema-meta.d.ts.map +1 -0
  183. package/runtime/generated/map-package-schema-meta.js +12 -0
  184. package/runtime/generated/map-package-schema-validator.d.ts +16 -0
  185. package/runtime/generated/map-package-schema-validator.d.ts.map +1 -0
  186. package/runtime/generated/map-package-schema-validator.js +1422 -0
  187. package/runtime/index.d.ts +5 -1
  188. package/runtime/index.d.ts.map +1 -1
  189. package/runtime/index.js +6 -0
  190. package/runtime/map-package-export.d.ts +151 -0
  191. package/runtime/map-package-export.d.ts.map +1 -0
  192. package/runtime/map-package-export.js +636 -0
  193. package/runtime/map-package-validation.d.ts +21 -1
  194. package/runtime/map-package-validation.d.ts.map +1 -1
  195. package/runtime/map-package-validation.js +132 -95
  196. package/runtime/map-package.d.ts +80 -0
  197. package/runtime/map-package.d.ts.map +1 -1
  198. package/studio/capability-manifest.d.ts +10 -0
  199. package/studio/capability-manifest.d.ts.map +1 -1
  200. package/studio/capability-manifest.js +38 -0
  201. package/studio/chart-spec.d.ts +6 -6
  202. package/studio/chart-spec.d.ts.map +1 -1
  203. package/studio/chart-spec.js +6 -6
  204. package/studio/command-adapter.d.ts +35 -0
  205. package/studio/command-adapter.d.ts.map +1 -0
  206. package/studio/command-adapter.js +36 -0
  207. package/studio/generated/studio-api.d.ts +1062 -0
  208. package/studio/generated/studio-api.d.ts.map +1 -0
  209. package/studio/generated/studio-api.js +4 -0
  210. package/studio/index.d.ts +25 -13
  211. package/studio/index.d.ts.map +1 -1
  212. package/studio/index.js +21 -10
  213. package/studio/lifecycle-client.d.ts +262 -22
  214. package/studio/lifecycle-client.d.ts.map +1 -1
  215. package/studio/lifecycle-client.js +543 -24
  216. package/studio/lifecycle-errors.d.ts +8 -2
  217. package/studio/lifecycle-errors.d.ts.map +1 -1
  218. package/studio/lifecycle-errors.js +6 -1
  219. package/studio/lifecycle-types.d.ts +237 -38
  220. package/studio/lifecycle-types.d.ts.map +1 -1
  221. package/studio/lifecycle-types.js +5 -12
  222. package/studio/publication-status.d.ts +55 -0
  223. package/studio/publication-status.d.ts.map +1 -0
  224. package/studio/publication-status.js +103 -0
  225. package/studio/types.d.ts +37 -7
  226. package/studio/types.d.ts.map +1 -1
  227. package/studio/types.js +5 -3
  228. package/studio/validate.d.ts.map +1 -1
  229. package/studio/validate.js +104 -7
  230. package/style/renderers.d.ts +6 -1
  231. package/style/renderers.d.ts.map +1 -1
  232. package/style/renderers.js +11 -6
  233. package/style/visual-variables.d.ts +43 -0
  234. package/style/visual-variables.d.ts.map +1 -0
  235. package/style/visual-variables.js +183 -0
  236. package/webmap/convert-layer.d.ts +2 -1
  237. package/webmap/convert-layer.d.ts.map +1 -1
  238. package/webmap/convert-layer.js +20 -3
  239. package/webmap/convert-renderer.d.ts +10 -3
  240. package/webmap/convert-renderer.d.ts.map +1 -1
  241. package/webmap/convert-renderer.js +190 -36
  242. package/webmap/index.d.ts +1 -0
  243. package/webmap/index.d.ts.map +1 -1
  244. package/webmap/parse.d.ts +2 -1
  245. package/webmap/parse.d.ts.map +1 -1
  246. package/webmap/parse.js +1 -1
  247. package/gen/honua/v1/feature_service_pb.d.ts +0 -918
  248. package/gen/honua/v1/feature_service_pb.d.ts.map +0 -1
  249. package/gen/honua/v1/feature_service_pb.js +0 -375
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Typed failure taxonomy for the shared control-plane command layer.
3
+ *
4
+ * Every transport surfaces the *same* five discriminants for the same
5
+ * underlying failure, so a negative RBAC or cross-tenant test written once
6
+ * behaves identically from the CLI, MCP, Studio, and direct JS.
7
+ *
8
+ * Like {@link ../../studio/lifecycle-errors.js | HonuaStudioError} and
9
+ * `HonuaCollaborationError`, this module intentionally does not join the
10
+ * central `HonuaSdkError` registry (`src/core/error-code-registry.ts`):
11
+ * `control-plane` is an `@experimental`, not-yet-semver-covered domain and a
12
+ * registry migration is scoped separately.
13
+ *
14
+ * @experimental
15
+ * @module
16
+ */
17
+ import { HonuaHttpError } from "../../core/errors.js";
18
+ const RETRYABLE_KINDS = new Set(["conflict", "transport"]);
19
+ /**
20
+ * The single error type every command raises. Callers branch on `.kind`
21
+ * rather than on HTTP status numbers or transport-specific error classes.
22
+ */
23
+ export class HonuaCommandError extends Error {
24
+ kind;
25
+ commandId;
26
+ correlationId;
27
+ idempotencyKey;
28
+ statusCode;
29
+ problem;
30
+ issues;
31
+ /** `conflict` and `transport` are worth retrying; the rest are terminal. */
32
+ retryable;
33
+ constructor(kind, commandId, message, options = {}) {
34
+ super(message, "cause" in options ? { cause: options.cause } : undefined);
35
+ this.name = "HonuaCommandError";
36
+ this.kind = kind;
37
+ this.commandId = commandId;
38
+ this.correlationId = options.correlationId;
39
+ this.idempotencyKey = options.idempotencyKey;
40
+ this.statusCode = options.statusCode;
41
+ this.problem = options.problem;
42
+ this.issues = options.issues;
43
+ this.retryable = RETRYABLE_KINDS.has(kind);
44
+ }
45
+ /** Safe JSON projection: no message, stack, cause, or response body. */
46
+ toJSON() {
47
+ return {
48
+ kind: "honua.command.error.v1",
49
+ errorKind: this.kind,
50
+ commandId: this.commandId,
51
+ retryable: this.retryable,
52
+ ...(this.correlationId ? { correlationId: this.correlationId } : {}),
53
+ ...(this.idempotencyKey ? { idempotencyKey: this.idempotencyKey } : {}),
54
+ ...(this.statusCode !== undefined ? { statusCode: this.statusCode } : {}),
55
+ ...(this.issues ? { issues: this.issues } : {}),
56
+ };
57
+ }
58
+ }
59
+ /** Type guard for {@link HonuaCommandError}. */
60
+ export function isHonuaCommandError(error) {
61
+ return error instanceof HonuaCommandError;
62
+ }
63
+ /** True when the failure is an optimistic-concurrency loss worth reloading and retrying. */
64
+ export function isHonuaCommandConflict(error) {
65
+ return isHonuaCommandError(error) && error.kind === "conflict";
66
+ }
67
+ /** Map an HTTP status code onto the command taxonomy. */
68
+ export function classifyCommandStatus(statusCode) {
69
+ if (statusCode === 400 || statusCode === 422)
70
+ return "validation";
71
+ if (statusCode === 401 || statusCode === 403)
72
+ return "authorization";
73
+ if (statusCode === 409 || statusCode === 412 || statusCode === 428)
74
+ return "conflict";
75
+ return "transport";
76
+ }
77
+ /**
78
+ * Normalize anything thrown beneath a command into a {@link HonuaCommandError}.
79
+ *
80
+ * Recognizes `AbortError`/`AbortSignal.reason` (→ `cancelled`), `HonuaHttpError`
81
+ * and any structurally equivalent error carrying `statusCode` (→ the status
82
+ * classification, which also covers `HonuaStudioError`'s `409`
83
+ * `generation-conflict`), and falls back to `transport`.
84
+ */
85
+ export function toHonuaCommandError(error, commandId, context) {
86
+ if (isHonuaCommandError(error))
87
+ return error;
88
+ const base = {
89
+ cause: error,
90
+ correlationId: context.correlationId,
91
+ idempotencyKey: context.idempotencyKey,
92
+ };
93
+ if (isAbortLike(error) || context.signal?.aborted === true) {
94
+ return new HonuaCommandError("cancelled", commandId, `Command ${commandId} was cancelled by the caller.`, base);
95
+ }
96
+ const statusCode = httpStatusOf(error);
97
+ if (statusCode !== undefined) {
98
+ const kind = classifyCommandStatus(statusCode);
99
+ return new HonuaCommandError(kind, commandId, `Command ${commandId} failed with HTTP ${statusCode}.`, {
100
+ ...base,
101
+ statusCode,
102
+ ...(problemOf(error) ? { problem: problemOf(error) } : {}),
103
+ });
104
+ }
105
+ return new HonuaCommandError("transport", commandId, `Command ${commandId} failed before a response was read.`, base);
106
+ }
107
+ function isAbortLike(error) {
108
+ if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError")
109
+ return true;
110
+ return error instanceof Error && error.name === "AbortError";
111
+ }
112
+ /**
113
+ * Read an HTTP status off `HonuaHttpError` or any structurally equivalent
114
+ * error. Studio's `HonuaStudioError` is matched structurally on purpose — it
115
+ * ships in a different split package, so `instanceof` is not reliable.
116
+ */
117
+ function httpStatusOf(error) {
118
+ if (error instanceof HonuaHttpError)
119
+ return error.statusCode;
120
+ if (typeof error !== "object" || error === null)
121
+ return undefined;
122
+ const statusCode = error.statusCode;
123
+ return typeof statusCode === "number" && Number.isInteger(statusCode) ? statusCode : undefined;
124
+ }
125
+ function problemOf(error) {
126
+ if (typeof error !== "object" || error === null)
127
+ return undefined;
128
+ const problem = error.problem;
129
+ return typeof problem === "object" && problem !== null ? problem : undefined;
130
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Deterministic identity primitives for command receipts.
3
+ *
4
+ * A receipt has to be reproducible: the same command with the same input and
5
+ * the same tenant must yield the same `idempotencyKey`, `correlationId`, and
6
+ * `auditKey` regardless of which transport issued it, which process it ran in,
7
+ * or when. Nothing here reads the clock, the network, or a random source.
8
+ *
9
+ * The canonical serializer mirrors `canonicalJson` in `src/offline/digest.ts`
10
+ * (sorted own keys, no `undefined` members); it is redeclared rather than
11
+ * imported so the control-plane split package does not depend on the offline
12
+ * module. The hash is a 128-bit FNV-1a variant: an identity key, deliberately
13
+ * **not** a security primitive — nothing authorizes on it.
14
+ *
15
+ * @experimental
16
+ * @module
17
+ */
18
+ import type { HonuaCommandIdentity, HonuaCommandReceipt } from "./types.js";
19
+ /**
20
+ * Serialize `value` with sorted own keys, dropping `undefined` members.
21
+ *
22
+ * Dropping (rather than throwing on) `undefined` matches how the command layer
23
+ * builds inputs: optional fields are routinely absent, and an absent field and
24
+ * an explicit `undefined` must hash the same so a CLI adapter that always sets
25
+ * every flag key agrees with a JS caller that omits them.
26
+ */
27
+ export declare function canonicalCommandJson(value: unknown): string;
28
+ /**
29
+ * 128-bit FNV-1a over UTF-16 code units, rendered as 32 lowercase hex digits.
30
+ *
31
+ * Four independently seeded 32-bit lanes. Stable across engines and platforms
32
+ * because it never touches `TextEncoder`, `crypto`, or locale-sensitive APIs.
33
+ */
34
+ export declare function commandDigest(text: string): string;
35
+ /**
36
+ * Derive the `Idempotency-Key` for a command invocation.
37
+ *
38
+ * Bound to the command id, the canonicalized input, and the tenant echo — so
39
+ * the *same* logical request retried from any transport collapses to one
40
+ * server-side effect, while the same input under a different tenant does not.
41
+ */
42
+ export declare function deriveIdempotencyKey(commandId: string, input: unknown, identity: HonuaCommandIdentity): string;
43
+ /**
44
+ * Derive a correlation id from the idempotency key.
45
+ *
46
+ * Deterministic on purpose: a random trace id would make receipts differ
47
+ * between transports and break the audit join the issue asks for. Callers that
48
+ * already own a trace id pass it in and this is not used.
49
+ */
50
+ export declare function deriveCorrelationId(commandId: string, idempotencyKey: string): string;
51
+ /** Normalize a claimed identity: trimmed values, sorted deduplicated scopes, no empty keys. */
52
+ export declare function normalizeCommandIdentity(identity: HonuaCommandIdentity | undefined): HonuaCommandIdentity;
53
+ /**
54
+ * The transport-independent projection of a receipt.
55
+ *
56
+ * Everything a server-side audit join needs, minus the one field that is
57
+ * allowed to differ between two equivalent calls (`transport`) and minus the
58
+ * `auditKey` itself.
59
+ */
60
+ export declare function honuaCommandReceiptProjection(receipt: HonuaCommandReceipt): Record<string, unknown>;
61
+ /**
62
+ * Stable join key for a receipt. Equal for equivalent CLI, MCP, Studio, and JS
63
+ * calls; changes whenever any recorded field of the invocation changes.
64
+ */
65
+ export declare function honuaCommandAuditKey(receipt: HonuaCommandReceipt): string;
66
+ /**
67
+ * Canonical, byte-stable serialization of a receipt — sorted keys, no
68
+ * `undefined`. Use this when persisting a receipt or comparing two of them.
69
+ */
70
+ export declare function serializeHonuaCommandReceipt(receipt: HonuaCommandReceipt): string;
71
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../src/control-plane/commands/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAU5E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAY3D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASlD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,GAAG,MAAM,CAO9G;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAErF;AAED,+FAA+F;AAC/F,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,GAAG,oBAAoB,CAUzG;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGnG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAEzE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAEjF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Shared, idempotent application commands for the Honua control plane.
3
+ *
4
+ * One typed command layer behind every surface. The CLI, the MCP server,
5
+ * Studio, and direct JS all call {@link HonuaCommandRuntime.execute} with the
6
+ * same {@link HonuaCommand} objects and get back the same deterministic
7
+ * {@link HonuaCommandReceipt}; transports adapt input and output only.
8
+ *
9
+ * ```ts
10
+ * import {
11
+ * createHonuaCommandRuntime,
12
+ * mapPackagePublishCommand,
13
+ * } from "@honua/sdk-js/control-plane";
14
+ *
15
+ * const runtime = createHonuaCommandRuntime({ client });
16
+ * const receipt = await runtime.execute(
17
+ * mapPackagePublishCommand,
18
+ * { mapId: "map-ops", package: mapPackage },
19
+ * { transport: "sdk", identity: { actor: "user-1", tenantId: "acme" } },
20
+ * );
21
+ * receipt.auditKey; // identical for the equivalent `honua map publish` call
22
+ * ```
23
+ *
24
+ * @experimental Reachable from the experimental
25
+ * `@honua/sdk-js/control-plane` entrypoint; not yet covered by the SDK's
26
+ * semver contract.
27
+ * @module
28
+ */
29
+ export { HONUA_COMMANDS, HONUA_COMMAND_IDS, connectionTestCommand, importCreateCommand, isHonuaCommandId, mapPackagePublishCommand, studioDraftSaveVersionCommand, } from "./catalog.js";
30
+ export type { ConnectionTestInput, ConnectionTestOutput, HonuaCommandId, ImportCreateInput, MapPackagePublishInput, StudioDraftSaveVersionInput, } from "./catalog.js";
31
+ export { HonuaCommandError, classifyCommandStatus, isHonuaCommandConflict, isHonuaCommandError, toHonuaCommandError, } from "./errors.js";
32
+ export type { HonuaCommandErrorKind, HonuaCommandErrorOptions, HonuaCommandValidationIssue, SerializedHonuaCommandError, } from "./errors.js";
33
+ export { canonicalCommandJson, commandDigest, deriveCorrelationId, deriveIdempotencyKey, honuaCommandAuditKey, honuaCommandReceiptProjection, normalizeCommandIdentity, serializeHonuaCommandReceipt, } from "./identity.js";
34
+ export { HONUA_COMMAND_OWNED_HEADERS, HONUA_COMMAND_RESERVED_HEADERS, HonuaCommandRuntime, assertNoAuthorityOverride, assertNoCommandKeyOverride, createHonuaCommandRuntime, } from "./runtime.js";
35
+ export type { HonuaCommandInvocation, HonuaCommandRuntimeOptions } from "./runtime.js";
36
+ export { HONUA_COMMAND_RECEIPT_KIND, HONUA_COMMAND_TRANSPORTS } from "./types.js";
37
+ export type { HonuaAnyCommand, HonuaCommand, HonuaCommandContext, HonuaCommandIdentity, HonuaCommandJsonSchema, HonuaCommandMode, HonuaCommandOutcome, HonuaCommandPlan, HonuaCommandReceipt, HonuaCommandResourceRef, HonuaCommandStatus, HonuaCommandTransport, } from "./types.js";
38
+ export { validateCommandInput } from "./validate.js";
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/control-plane/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,mBAAmB,EACnB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAClF,YAAY,EACV,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Shared, idempotent application commands for the Honua control plane.
3
+ *
4
+ * One typed command layer behind every surface. The CLI, the MCP server,
5
+ * Studio, and direct JS all call {@link HonuaCommandRuntime.execute} with the
6
+ * same {@link HonuaCommand} objects and get back the same deterministic
7
+ * {@link HonuaCommandReceipt}; transports adapt input and output only.
8
+ *
9
+ * ```ts
10
+ * import {
11
+ * createHonuaCommandRuntime,
12
+ * mapPackagePublishCommand,
13
+ * } from "@honua/sdk-js/control-plane";
14
+ *
15
+ * const runtime = createHonuaCommandRuntime({ client });
16
+ * const receipt = await runtime.execute(
17
+ * mapPackagePublishCommand,
18
+ * { mapId: "map-ops", package: mapPackage },
19
+ * { transport: "sdk", identity: { actor: "user-1", tenantId: "acme" } },
20
+ * );
21
+ * receipt.auditKey; // identical for the equivalent `honua map publish` call
22
+ * ```
23
+ *
24
+ * @experimental Reachable from the experimental
25
+ * `@honua/sdk-js/control-plane` entrypoint; not yet covered by the SDK's
26
+ * semver contract.
27
+ * @module
28
+ */
29
+ export { HONUA_COMMANDS, HONUA_COMMAND_IDS, connectionTestCommand, importCreateCommand, isHonuaCommandId, mapPackagePublishCommand, studioDraftSaveVersionCommand, } from "./catalog.js";
30
+ export { HonuaCommandError, classifyCommandStatus, isHonuaCommandConflict, isHonuaCommandError, toHonuaCommandError, } from "./errors.js";
31
+ export { canonicalCommandJson, commandDigest, deriveCorrelationId, deriveIdempotencyKey, honuaCommandAuditKey, honuaCommandReceiptProjection, normalizeCommandIdentity, serializeHonuaCommandReceipt, } from "./identity.js";
32
+ export { HONUA_COMMAND_OWNED_HEADERS, HONUA_COMMAND_RESERVED_HEADERS, HonuaCommandRuntime, assertNoAuthorityOverride, assertNoCommandKeyOverride, createHonuaCommandRuntime, } from "./runtime.js";
33
+ export { HONUA_COMMAND_RECEIPT_KIND, HONUA_COMMAND_TRANSPORTS } from "./types.js";
34
+ export { validateCommandInput } from "./validate.js";
@@ -0,0 +1,146 @@
1
+ /**
2
+ * The one place a command actually runs.
3
+ *
4
+ * `HonuaCommandRuntime.execute` owns everything that must be identical across
5
+ * transports: authority-header refusal, schema validation, idempotency-key and
6
+ * correlation-id derivation, dry-run short-circuiting, cancellation, error
7
+ * normalization, and receipt assembly. A transport contributes argument
8
+ * parsing on the way in and rendering on the way out — nothing else.
9
+ *
10
+ * ## Security contract
11
+ *
12
+ * - **No shared administrator credential.** The runtime is built from a
13
+ * {@link HonuaControlPlaneClient} (and optionally a Studio lifecycle client),
14
+ * both of which carry the *caller's own* credential from the `HonuaClient`
15
+ * they were constructed with. There is no admin-key path here and no
16
+ * `HonuaAdminClient` dependency.
17
+ * - **No client-side authorization bypass.** Caller-supplied per-call headers
18
+ * are screened against {@link HONUA_COMMAND_RESERVED_HEADERS}; any attempt to
19
+ * set a credential, actor, tenant, policy, or approver header fails with an
20
+ * `authorization` {@link HonuaCommandError} *before* the command runs, on
21
+ * every transport. The claimed {@link HonuaCommandIdentity} is echoed onto
22
+ * the receipt and never placed on the wire.
23
+ * - **No caller-owned request identity.** The same screen refuses
24
+ * {@link HONUA_COMMAND_OWNED_HEADERS} — the `Idempotency-Key`, `If-Match`, and `X-Correlation-ID`
25
+ * the runtime derives and records on the receipt. Both screens compare
26
+ * header names case-insensitively, so `Idempotency-Key`, `idempotency-key`,
27
+ * and `IDEMPOTENCY-KEY` are the same header to them. Without this a caller
28
+ * could put one key on the wire while the receipt and the invocation record
29
+ * claimed another, breaking retry collapsing and the audit join.
30
+ * - **No self-approval.** Command input schemas are closed, so no transport can
31
+ * introduce an approval field the others lack; every receipt records
32
+ * `authorization: "server-enforced"`.
33
+ * - **No credential in the receipt's rendered fields.** A receipt is built to be
34
+ * persisted and printed, so the plan's human-readable `summary` goes through
35
+ * the SDK's one credential recognizer before it is recorded — an import's
36
+ * presigned `sourceUrl` must not outlive its request in an audit log.
37
+ *
38
+ * @experimental
39
+ * @module
40
+ */
41
+ import type { HonuaClient } from "../../core/client.js";
42
+ import type { HonuaStudioLifecycleClient } from "../../studio/lifecycle-client.js";
43
+ import { HonuaControlPlaneClient } from "../client.js";
44
+ import { type HonuaCommand, type HonuaCommandIdentity, type HonuaCommandReceipt, type HonuaCommandTransport } from "./types.js";
45
+ /**
46
+ * Headers a caller may never set on a command invocation.
47
+ *
48
+ * Two families: credential headers (which would let a transport swap in a
49
+ * different — possibly shared administrator — identity) and authority headers
50
+ * (which would let a transport assert an actor, tenant, policy decision, or
51
+ * approval the server did not derive itself). Compared case-insensitively.
52
+ */
53
+ export declare const HONUA_COMMAND_RESERVED_HEADERS: readonly ["authorization", "proxy-authorization", "cookie", "x-api-key", "x-honua-api-key", "x-honua-admin-key", "x-honua-actor", "x-honua-act-as", "x-honua-impersonate", "x-honua-tenant", "x-honua-tenant-id", "x-honua-scope", "x-honua-scopes", "x-honua-policy-decision", "x-honua-approver", "x-honua-approved-by", "x-forwarded-user", "x-forwarded-access-token"];
54
+ /**
55
+ * Headers the runtime derives and records on the receipt.
56
+ *
57
+ * A caller-supplied value would put a different key on the wire
58
+ * than the receipt claims, which breaks exactly the two guarantees the receipt
59
+ * exists to provide: that a retry collapses to one server-side effect, and that
60
+ * an audit join can match a receipt to the request it describes. Callers set
61
+ * these through {@link HonuaCommandInvocation.idempotencyKey},
62
+ * {@link HonuaCommandInvocation.ifMatch}, and {@link HonuaCommandInvocation.correlationId}, which are recorded.
63
+ */
64
+ export declare const HONUA_COMMAND_OWNED_HEADERS: readonly ["idempotency-key", "if-match", "x-correlation-id"];
65
+ /** Options accepted by every {@link HonuaCommandRuntime.execute} call. */
66
+ export interface HonuaCommandInvocation {
67
+ /** Surface issuing the call. Recorded on the receipt; never trusted. */
68
+ readonly transport: HonuaCommandTransport;
69
+ /** Acting identity and tenant echo. Never sent as headers. */
70
+ readonly identity?: HonuaCommandIdentity;
71
+ /** Explicit `Idempotency-Key`; derived deterministically from the input when omitted. */
72
+ readonly idempotencyKey?: string;
73
+ /** Explicit server correlation id (1–64 ASCII letters, digits, `-_.:`); derived when omitted. */
74
+ readonly correlationId?: string;
75
+ /** Preview only — the runtime returns the plan and never calls `execute`. */
76
+ readonly dryRun?: boolean;
77
+ /** Optimistic-concurrency validator, sent as `If-Match`. */
78
+ readonly ifMatch?: string;
79
+ /** Cancellation. An abort surfaces as a `cancelled` {@link HonuaCommandError}. */
80
+ readonly signal?: AbortSignal;
81
+ /** Extra request headers. Reserved credential/authority headers are refused. */
82
+ readonly headers?: HeadersInit;
83
+ }
84
+ /** Constructor options for {@link createHonuaCommandRuntime}. */
85
+ export interface HonuaCommandRuntimeOptions {
86
+ /**
87
+ * Transport client. Its credential *is* the acting identity — the runtime
88
+ * never adds one of its own.
89
+ */
90
+ readonly client?: HonuaClient;
91
+ /** Pre-built control-plane client; constructed from `client` when omitted. */
92
+ readonly controlPlane?: HonuaControlPlaneClient;
93
+ /**
94
+ * Studio lifecycle client. Supplied by the host because Studio ships in a
95
+ * different split package; `studio.*` commands fail with a `transport` error
96
+ * when it is absent.
97
+ */
98
+ readonly studio?: HonuaStudioLifecycleClient;
99
+ /** Default identity echo, overridable per invocation. */
100
+ readonly identity?: HonuaCommandIdentity;
101
+ }
102
+ /** Build a {@link HonuaCommandRuntime}. */
103
+ export declare function createHonuaCommandRuntime(options: HonuaCommandRuntimeOptions): HonuaCommandRuntime;
104
+ /**
105
+ * Executes {@link HonuaCommand}s. One instance per connection; share it across
106
+ * every transport a process hosts.
107
+ *
108
+ * @experimental
109
+ */
110
+ export declare class HonuaCommandRuntime {
111
+ #private;
112
+ constructor(options: HonuaCommandRuntimeOptions);
113
+ get controlPlane(): HonuaControlPlaneClient;
114
+ get studio(): HonuaStudioLifecycleClient | undefined;
115
+ /**
116
+ * Validate, plan, and (unless `dryRun`) execute `command`, returning a
117
+ * deterministic {@link HonuaCommandReceipt}.
118
+ *
119
+ * @throws {HonuaCommandError} for every failure mode, already classified.
120
+ */
121
+ execute<TInput, TOutput>(command: HonuaCommand<TInput, TOutput>, input: TInput, invocation: HonuaCommandInvocation): Promise<HonuaCommandReceipt<TOutput>>;
122
+ }
123
+ /**
124
+ * Refuse a caller-supplied credential or authority header.
125
+ *
126
+ * Exported so a transport can screen its own header pass-through before it
127
+ * builds an invocation, but the runtime applies it unconditionally — a
128
+ * transport that forgets cannot weaken the guarantee.
129
+ */
130
+ export declare function assertNoAuthorityOverride(commandId: string, headers: HeadersInit | undefined, context?: {
131
+ readonly correlationId?: string;
132
+ readonly idempotencyKey?: string;
133
+ }): void;
134
+ /**
135
+ * Refuse a caller-supplied value for a header the runtime derives.
136
+ *
137
+ * Classified `validation` rather than `authorization`: this is caller misuse of
138
+ * the invocation contract, not an attempt to assert authority. Use
139
+ * {@link HonuaCommandInvocation.idempotencyKey} / `.ifMatch` instead, so the
140
+ * value that travels is the value the receipt records.
141
+ */
142
+ export declare function assertNoCommandKeyOverride(commandId: string, headers: HeadersInit | undefined, context?: {
143
+ readonly correlationId?: string;
144
+ readonly idempotencyKey?: string;
145
+ }): void;
146
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/control-plane/commands/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAUvD,OAAO,EAGL,KAAK,YAAY,EAEjB,KAAK,oBAAoB,EAEzB,KAAK,mBAAmB,EAExB,KAAK,qBAAqB,EAC3B,MAAM,YAAY,CAAC;AAGpB;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,4WAmBjC,CAAC;AAIX;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,8DAA+D,CAAC;AAIxG,0EAA0E;AAC1E,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;IAC1C,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IACzC,yFAAyF;IACzF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,iGAAiG;IACjG,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;CAChC;AAED,iEAAiE;AACjE,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,uBAAuB,CAAC;IAChD;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,0BAA0B,CAAC;IAC7C,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CAC1C;AAED,2CAA2C;AAC3C,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CAElG;AAED;;;;;GAKG;AACH,qBAAa,mBAAmB;;gBAKX,OAAO,EAAE,0BAA0B;IAWtD,IAAW,YAAY,IAAI,uBAAuB,CAEjD;IAED,IAAW,MAAM,IAAI,0BAA0B,GAAG,SAAS,CAE1D;IAED;;;;;OAKG;IACU,OAAO,CAAC,MAAM,EAAE,OAAO,EAClC,OAAO,EAAE,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,sBAAsB,GACjC,OAAO,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;CAyGzC;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,OAAO,GAAE;IAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAO,GAClF,IAAI,CAUN;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,OAAO,GAAE;IAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAO,GAClF,IAAI,CAgBN"}