@honua/react 0.1.7-beta.0 → 0.1.9-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 (131) hide show
  1. package/control-plane/admin-client.d.ts +87 -0
  2. package/control-plane/admin-client.d.ts.map +1 -0
  3. package/control-plane/admin-client.js +169 -0
  4. package/control-plane/client.d.ts.map +1 -1
  5. package/control-plane/client.js +21 -3
  6. package/control-plane/commands/catalog.d.ts +133 -0
  7. package/control-plane/commands/catalog.d.ts.map +1 -0
  8. package/control-plane/commands/catalog.js +353 -0
  9. package/control-plane/commands/errors.d.ts +96 -0
  10. package/control-plane/commands/errors.d.ts.map +1 -0
  11. package/control-plane/commands/errors.js +130 -0
  12. package/control-plane/commands/identity.d.ts +71 -0
  13. package/control-plane/commands/identity.d.ts.map +1 -0
  14. package/control-plane/commands/identity.js +0 -0
  15. package/control-plane/commands/index.d.ts +39 -0
  16. package/control-plane/commands/index.d.ts.map +1 -0
  17. package/control-plane/commands/index.js +34 -0
  18. package/control-plane/commands/runtime.d.ts +146 -0
  19. package/control-plane/commands/runtime.d.ts.map +1 -0
  20. package/control-plane/commands/runtime.js +318 -0
  21. package/control-plane/commands/types.d.ts +226 -0
  22. package/control-plane/commands/types.d.ts.map +1 -0
  23. package/control-plane/commands/types.js +30 -0
  24. package/control-plane/commands/validate.d.ts +27 -0
  25. package/control-plane/commands/validate.d.ts.map +1 -0
  26. package/control-plane/commands/validate.js +132 -0
  27. package/control-plane/generated/admin-api.d.ts +30263 -0
  28. package/control-plane/generated/admin-api.d.ts.map +1 -0
  29. package/control-plane/generated/admin-api.js +5 -0
  30. package/control-plane/generated/admin-operations.d.ts +4053 -0
  31. package/control-plane/generated/admin-operations.d.ts.map +1 -0
  32. package/control-plane/generated/admin-operations.js +820 -0
  33. package/control-plane/index.d.ts +11 -0
  34. package/control-plane/index.d.ts.map +1 -1
  35. package/control-plane/index.js +8 -0
  36. package/control-plane/types.d.ts +14 -0
  37. package/control-plane/types.d.ts.map +1 -1
  38. package/core/client.js +1 -1
  39. package/core/credential-redaction.d.ts +163 -0
  40. package/core/credential-redaction.d.ts.map +1 -0
  41. package/core/credential-redaction.js +389 -0
  42. package/core/error-classifications.d.ts +15 -0
  43. package/core/error-classifications.d.ts.map +1 -1
  44. package/core/error-classifications.js +15 -0
  45. package/core/error-code-registry.d.ts +15 -0
  46. package/core/error-code-registry.d.ts.map +1 -1
  47. package/core/error-code-registry.js +15 -0
  48. package/core/grpc-adapter.d.ts +2 -2
  49. package/core/grpc-adapter.d.ts.map +1 -1
  50. package/core/grpc-adapter.js +30 -6
  51. package/core/job-run-errors.d.ts +10 -0
  52. package/core/job-run-errors.d.ts.map +1 -0
  53. package/core/job-run-errors.js +14 -0
  54. package/core/job-run-lifecycle.d.ts +34 -0
  55. package/core/job-run-lifecycle.d.ts.map +1 -0
  56. package/core/job-run-lifecycle.js +193 -0
  57. package/core/ogc-processes.d.ts +38 -31
  58. package/core/ogc-processes.d.ts.map +1 -1
  59. package/core/ogc-processes.js +123 -173
  60. package/core/process-runner.js +15 -100
  61. package/core/surfaces.d.ts +2 -8
  62. package/core/surfaces.d.ts.map +1 -1
  63. package/core/surfaces.js +21 -112
  64. package/core/types.d.ts +7 -6
  65. package/core/types.d.ts.map +1 -1
  66. package/gen/geospatial/v1/common_pb.d.ts +514 -0
  67. package/gen/geospatial/v1/common_pb.d.ts.map +1 -0
  68. package/gen/geospatial/v1/common_pb.js +335 -0
  69. package/gen/geospatial/v1/execution_types_pb.d.ts +1186 -0
  70. package/gen/geospatial/v1/execution_types_pb.d.ts.map +1 -0
  71. package/gen/geospatial/v1/execution_types_pb.js +396 -0
  72. package/gen/geospatial/v1/feature_service_pb.d.ts +403 -0
  73. package/gen/geospatial/v1/feature_service_pb.d.ts.map +1 -0
  74. package/gen/geospatial/v1/feature_service_pb.js +47 -0
  75. package/gen/geospatial/v1/index.d.ts +5 -0
  76. package/gen/geospatial/v1/index.d.ts.map +1 -0
  77. package/gen/geospatial/v1/index.js +9 -0
  78. package/gen/geospatial/v1/spatial_types_pb.d.ts +285 -0
  79. package/gen/geospatial/v1/spatial_types_pb.d.ts.map +1 -0
  80. package/gen/geospatial/v1/spatial_types_pb.js +58 -0
  81. package/gen/geospatial/v1/workspace_artifact_types_pb.d.ts +379 -0
  82. package/gen/geospatial/v1/workspace_artifact_types_pb.d.ts.map +1 -0
  83. package/gen/geospatial/v1/workspace_artifact_types_pb.js +151 -0
  84. package/generated-app/projection.d.ts.map +1 -1
  85. package/generated-app/projection.js +10 -1
  86. package/package.json +2 -2
  87. package/query-planner/grpc.d.ts +4 -4
  88. package/query-planner/grpc.d.ts.map +1 -1
  89. package/query-planner/grpc.js +11 -11
  90. package/query-planner/types.d.ts +4 -4
  91. package/query-planner/types.d.ts.map +1 -1
  92. package/runtime/errors.d.ts +1 -1
  93. package/runtime/errors.d.ts.map +1 -1
  94. package/runtime/errors.js +2 -0
  95. package/runtime/generated/map-package-schema-meta.d.ts +11 -0
  96. package/runtime/generated/map-package-schema-meta.d.ts.map +1 -0
  97. package/runtime/generated/map-package-schema-meta.js +12 -0
  98. package/runtime/generated/map-package-schema-validator.d.ts +16 -0
  99. package/runtime/generated/map-package-schema-validator.d.ts.map +1 -0
  100. package/runtime/generated/map-package-schema-validator.js +1422 -0
  101. package/runtime/index.d.ts +5 -1
  102. package/runtime/index.d.ts.map +1 -1
  103. package/runtime/index.js +6 -0
  104. package/runtime/map-package-export.d.ts +151 -0
  105. package/runtime/map-package-export.d.ts.map +1 -0
  106. package/runtime/map-package-export.js +636 -0
  107. package/runtime/map-package-validation.d.ts +21 -1
  108. package/runtime/map-package-validation.d.ts.map +1 -1
  109. package/runtime/map-package-validation.js +132 -95
  110. package/runtime/map-package.d.ts +80 -0
  111. package/runtime/map-package.d.ts.map +1 -1
  112. package/studio/chart-spec.d.ts +6 -6
  113. package/studio/chart-spec.d.ts.map +1 -1
  114. package/studio/chart-spec.js +6 -6
  115. package/studio/index.d.ts +17 -7
  116. package/studio/index.d.ts.map +1 -1
  117. package/studio/index.js +15 -5
  118. package/studio/lifecycle-client.d.ts +262 -22
  119. package/studio/lifecycle-client.d.ts.map +1 -1
  120. package/studio/lifecycle-client.js +524 -24
  121. package/studio/lifecycle-errors.d.ts +8 -2
  122. package/studio/lifecycle-errors.d.ts.map +1 -1
  123. package/studio/lifecycle-errors.js +6 -1
  124. package/studio/lifecycle-types.d.ts +228 -8
  125. package/studio/lifecycle-types.d.ts.map +1 -1
  126. package/studio/publication-status.d.ts +55 -0
  127. package/studio/publication-status.d.ts.map +1 -0
  128. package/studio/publication-status.js +103 -0
  129. package/gen/honua/v1/feature_service_pb.d.ts +0 -918
  130. package/gen/honua/v1/feature_service_pb.d.ts.map +0 -1
  131. package/gen/honua/v1/feature_service_pb.js +0 -375
@@ -0,0 +1,87 @@
1
+ import type { operations } from "./generated/admin-api.js";
2
+ import { type AdminOperationId } from "./generated/admin-operations.js";
3
+ type Operation<Id extends AdminOperationId> = operations[Id];
4
+ type OperationParameters<Id extends AdminOperationId> = Operation<Id> extends {
5
+ parameters: infer Parameters;
6
+ } ? Parameters : never;
7
+ type ParameterValue<Id extends AdminOperationId, Kind extends "header" | "path" | "query"> = OperationParameters<Id> extends {
8
+ [Key in Kind]?: infer Value;
9
+ } ? Exclude<Value, undefined> : never;
10
+ type RequiredRequestBody<Id extends AdminOperationId> = Operation<Id> extends {
11
+ requestBody: infer RequestBody;
12
+ } ? RequestBody : never;
13
+ type OptionalRequestBody<Id extends AdminOperationId> = Operation<Id> extends {
14
+ requestBody?: infer RequestBody;
15
+ } ? Exclude<RequestBody, undefined> : never;
16
+ type RequestBodyContent<RequestBody> = RequestBody extends {
17
+ content: infer Content;
18
+ } ? Content : never;
19
+ type ContentValue<Content> = Content extends Record<PropertyKey, unknown> ? Content[keyof Content] : never;
20
+ export type AdminOperationRequestBody<Id extends AdminOperationId> = ContentValue<RequestBodyContent<RequiredRequestBody<Id> | OptionalRequestBody<Id>>>;
21
+ export type AdminOperationContentType<Id extends AdminOperationId> = Extract<keyof RequestBodyContent<RequiredRequestBody<Id> | OptionalRequestBody<Id>>, string>;
22
+ type OptionalField<Name extends string, Value> = [Value] extends [never] ? {
23
+ readonly [Key in Name]?: never;
24
+ } : {
25
+ readonly [Key in Name]?: Value;
26
+ };
27
+ type RequiredField<Name extends string, Value> = [Value] extends [never] ? {
28
+ readonly [Key in Name]?: never;
29
+ } : {
30
+ readonly [Key in Name]: Value;
31
+ };
32
+ type BodyField<Id extends AdminOperationId> = [RequiredRequestBody<Id>] extends [never] ? [OptionalRequestBody<Id>] extends [never] ? {
33
+ readonly body?: never;
34
+ readonly contentType?: never;
35
+ } : {
36
+ readonly body?: AdminOperationRequestBody<Id>;
37
+ readonly contentType?: AdminOperationContentType<Id>;
38
+ } : {
39
+ readonly body: AdminOperationRequestBody<Id>;
40
+ readonly contentType?: AdminOperationContentType<Id>;
41
+ };
42
+ export type AdminOperationRequest<Id extends AdminOperationId> = RequiredField<"path", ParameterValue<Id, "path">> & OptionalField<"query", ParameterValue<Id, "query">> & OptionalField<"headers", ParameterValue<Id, "header"> & HeadersInit> & BodyField<Id> & {
43
+ readonly signal?: AbortSignal;
44
+ };
45
+ type SuccessStatus<Status> = Status extends number ? `${Status}` extends `2${string}` ? Status : never : Status extends `${2}${string}` ? Status : never;
46
+ type ResponseContent<Response> = Response extends {
47
+ content: infer Content;
48
+ } ? ContentValue<Content> : undefined;
49
+ type SuccessResponsePayload<Responses> = {
50
+ [Status in keyof Responses]: SuccessStatus<Status> extends never ? never : ResponseContent<Responses[Status]>;
51
+ }[keyof Responses];
52
+ export type AdminOperationResponse<Id extends AdminOperationId> = Operation<Id> extends {
53
+ responses: infer Responses;
54
+ } ? SuccessResponsePayload<Responses> : never;
55
+ export interface AdminClientOptions {
56
+ readonly baseUrl: string;
57
+ /** Scoped API key; sent as `X-API-Key`. */
58
+ readonly apiKey?: string;
59
+ /** Root/admin key. Takes precedence over `apiKey`. */
60
+ readonly adminKey?: string;
61
+ readonly basePath?: string;
62
+ readonly fetchFn?: typeof fetch;
63
+ readonly headers?: HeadersInit;
64
+ }
65
+ export interface AdminOperationResult<Id extends AdminOperationId> {
66
+ readonly operationId: Id;
67
+ readonly data: AdminOperationResponse<Id>;
68
+ readonly response: Response;
69
+ }
70
+ export declare class HonuaAdminApiError extends Error {
71
+ readonly operationId: AdminOperationId;
72
+ readonly statusCode: number;
73
+ readonly body: unknown;
74
+ constructor(operationId: AdminOperationId, response: Response, body: unknown);
75
+ }
76
+ /**
77
+ * Complete generated Admin REST client. Curated clients may wrap this surface,
78
+ * but every operation in the pinned OpenAPI contract remains callable here.
79
+ */
80
+ export declare class HonuaAdminClient {
81
+ #private;
82
+ constructor(options: AdminClientOptions);
83
+ call<Id extends AdminOperationId>(operationId: Id, request: AdminOperationRequest<Id>): Promise<AdminOperationResult<Id>>;
84
+ }
85
+ export declare function createHonuaAdminClient(options: AdminClientOptions): HonuaAdminClient;
86
+ export {};
87
+ //# sourceMappingURL=admin-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-client.d.ts","sourceRoot":"","sources":["../../../src/control-plane/admin-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAyC,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAE/G,KAAK,SAAS,CAAC,EAAE,SAAS,gBAAgB,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AAC7D,KAAK,mBAAmB,CAAC,EAAE,SAAS,gBAAgB,IAAI,SAAS,CAAC,EAAE,CAAC,SAAS;IAC5E,UAAU,EAAE,MAAM,UAAU,CAAC;CAC9B,GACG,UAAU,GACV,KAAK,CAAC;AACV,KAAK,cAAc,CACjB,EAAE,SAAS,gBAAgB,EAC3B,IAAI,SAAS,QAAQ,GAAG,MAAM,GAAG,OAAO,IACtC,mBAAmB,CAAC,EAAE,CAAC,SAAS;KAAG,GAAG,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,CAAC,WAAW,EAAE,EAAE,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,SAAgB,WAAW,EAAE,gBAAgB,CAAC;IAC9C,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,IAAI,EAAE,OAAO,CAAC;gBAEX,WAAW,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;CAOpF;AAED;;;GAGG;AACH,qBAAa,gBAAgB;;gBAOR,OAAO,EAAE,kBAAkB;IAmBjC,IAAI,CAAC,EAAE,SAAS,gBAAgB,EAC3C,WAAW,EAAE,EAAE,EACf,OAAO,EAAE,qBAAqB,CAAC,EAAE,CAAC,GACjC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;CA0BrC;AAOD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,gBAAgB,CAEpF"}
@@ -0,0 +1,169 @@
1
+ import { trimTrailingSlashes } from "../core/path-utils.js";
2
+ import { ADMIN_API_BASE_PATH, ADMIN_OPERATIONS } from "./generated/admin-operations.js";
3
+ export class HonuaAdminApiError extends Error {
4
+ operationId;
5
+ statusCode;
6
+ body;
7
+ constructor(operationId, response, body) {
8
+ super(`Admin operation ${operationId} failed with HTTP ${response.status}.`);
9
+ this.name = "HonuaAdminApiError";
10
+ this.operationId = operationId;
11
+ this.statusCode = response.status;
12
+ this.body = body;
13
+ }
14
+ }
15
+ /**
16
+ * Complete generated Admin REST client. Curated clients may wrap this surface,
17
+ * but every operation in the pinned OpenAPI contract remains callable here.
18
+ */
19
+ export class HonuaAdminClient {
20
+ #baseUrl;
21
+ #basePath;
22
+ #fetch;
23
+ #headers;
24
+ #credential;
25
+ constructor(options) {
26
+ const baseUrl = new URL(options.baseUrl);
27
+ if (baseUrl.protocol !== "http:" && baseUrl.protocol !== "https:") {
28
+ throw new Error("Admin client baseUrl must use http or https.");
29
+ }
30
+ if (baseUrl.username || baseUrl.password || baseUrl.search || baseUrl.hash) {
31
+ throw new Error("Admin client baseUrl must not include credentials, query parameters, or a fragment.");
32
+ }
33
+ if (baseUrl.protocol === "http:" && !isLoopbackHost(baseUrl.hostname)) {
34
+ throw new Error("Admin client requires HTTPS except for exact loopback HTTP development endpoints.");
35
+ }
36
+ this.#baseUrl = baseUrl.toString().replace(/\/+$/, "");
37
+ this.#basePath = normalizeBasePath(options.basePath ?? ADMIN_API_BASE_PATH);
38
+ this.#fetch = options.fetchFn ?? fetch;
39
+ this.#headers = new Headers(options.headers);
40
+ this.#credential = options.adminKey ?? options.apiKey;
41
+ if (this.#credential)
42
+ this.#headers.set("X-API-Key", this.#credential);
43
+ }
44
+ async call(operationId, request) {
45
+ const descriptor = ADMIN_OPERATIONS[operationId];
46
+ const path = interpolatePath(descriptor.path, request.path);
47
+ const url = new URL(`${this.#baseUrl}${this.#basePath}${path}`);
48
+ appendQuery(url, request.query);
49
+ const headers = new Headers(this.#headers);
50
+ mergeHeaders(headers, request.headers);
51
+ if (this.#credential)
52
+ headers.set("X-API-Key", this.#credential);
53
+ const body = encodeBody(request.body, request.contentType, headers, descriptor.requestContentTypes);
54
+ const response = await this.#fetch(url, {
55
+ method: descriptor.method,
56
+ headers,
57
+ body,
58
+ signal: request.signal,
59
+ redirect: "manual",
60
+ });
61
+ const data = await readResponse(response);
62
+ if (!response.ok)
63
+ throw new HonuaAdminApiError(operationId, response, data);
64
+ return { operationId, data: data, response };
65
+ }
66
+ }
67
+ function isLoopbackHost(hostname) {
68
+ const normalized = hostname.toLowerCase();
69
+ return normalized === "localhost" || normalized === "127.0.0.1" || normalized === "::1" || normalized === "[::1]";
70
+ }
71
+ export function createHonuaAdminClient(options) {
72
+ return new HonuaAdminClient(options);
73
+ }
74
+ function normalizeBasePath(value) {
75
+ const rooted = value.startsWith("/") ? value : `/${value}`;
76
+ return trimTrailingSlashes(rooted);
77
+ }
78
+ function interpolatePath(template, parameters) {
79
+ const used = new Set();
80
+ const path = template.replace(/\{([^}]+)\}/g, (_match, name) => {
81
+ const value = parameters?.[name];
82
+ if (value === undefined || value === null || value === "") {
83
+ throw new Error(`Missing required admin path parameter: ${name}`);
84
+ }
85
+ used.add(name);
86
+ return encodeURIComponent(String(value));
87
+ });
88
+ for (const name of Object.keys(parameters ?? {})) {
89
+ if (!used.has(name))
90
+ throw new Error(`Unknown admin path parameter for ${template}: ${name}`);
91
+ }
92
+ return path;
93
+ }
94
+ function appendQuery(url, query) {
95
+ for (const [name, value] of Object.entries(query ?? {})) {
96
+ if (value === undefined || value === null)
97
+ continue;
98
+ if (Array.isArray(value)) {
99
+ for (const item of value)
100
+ url.searchParams.append(name, String(item));
101
+ }
102
+ else {
103
+ url.searchParams.set(name, String(value));
104
+ }
105
+ }
106
+ }
107
+ function mergeHeaders(target, source) {
108
+ if (!source)
109
+ return;
110
+ for (const [name, value] of new Headers(source))
111
+ target.set(name, value);
112
+ }
113
+ function encodeBody(value, contentType, headers, declaredContentTypes) {
114
+ if (value === undefined)
115
+ return null;
116
+ const selected = contentType ?? defaultRequestContentType(declaredContentTypes);
117
+ if (selected === "multipart/form-data")
118
+ return toFormData(value);
119
+ headers.set("Content-Type", selected);
120
+ if (selected.includes("json"))
121
+ return JSON.stringify(value);
122
+ if (typeof value === "string" ||
123
+ value instanceof Uint8Array ||
124
+ value instanceof Blob ||
125
+ value instanceof FormData ||
126
+ value instanceof URLSearchParams) {
127
+ return value;
128
+ }
129
+ return String(value);
130
+ }
131
+ function defaultRequestContentType(declaredContentTypes) {
132
+ if (declaredContentTypes.includes("application/json"))
133
+ return "application/json";
134
+ return declaredContentTypes[0] ?? "application/json";
135
+ }
136
+ function toFormData(value) {
137
+ if (value instanceof FormData)
138
+ return value;
139
+ if (typeof value !== "object" || value === null)
140
+ throw new Error("multipart/form-data body must be an object.");
141
+ const form = new FormData();
142
+ for (const [name, field] of Object.entries(value)) {
143
+ if (field === undefined || field === null)
144
+ continue;
145
+ if (Array.isArray(field)) {
146
+ for (const item of field)
147
+ form.append(name, formValue(item));
148
+ }
149
+ else {
150
+ form.append(name, formValue(field));
151
+ }
152
+ }
153
+ return form;
154
+ }
155
+ function formValue(value) {
156
+ if (value instanceof Blob)
157
+ return value;
158
+ return typeof value === "string" ? value : JSON.stringify(value);
159
+ }
160
+ async function readResponse(response) {
161
+ if (response.status === 204)
162
+ return undefined;
163
+ const contentType = response.headers.get("content-type") ?? "";
164
+ if (contentType.includes("json"))
165
+ return response.json();
166
+ if (contentType.startsWith("text/") || contentType.includes("xml"))
167
+ return response.text();
168
+ return response.arrayBuffer();
169
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/control-plane/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAE3B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC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AAqB,CAAC,qBAAqB,CAAC,CAAC,CAAC;CAGlF;AAED,qBAAa,sBAAsB;;gBAGd,YAAY,EAAE,uBAAuB;IAIjD,IAAI,CACT,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,sBAAsB,CAAC,CAAC,CAAC;CAKnF;AAED,qBAAa,kBAAkB;;gBAGV,YAAY,EAAE,uBAAuB;IAIjD,gBAAgB,CACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,iBAAiB,EAC1B,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;CAOxD;AAED,qBAAa,0BAA0B;;gBAKlB,YAAY,EAAE,uBAAuB,EAAE,UAAU,EAAE,2BAA2B,EAAE,IAAI,EAAE,MAAM;IAMxG,IAAI,CAAC,OAAO,GAAE,+BAAoC,GAAG,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;CAGnH"}
@@ -33,6 +33,8 @@ export class HonuaControlPlaneClient {
33
33
  return this.requestJson("raw", request.method ?? "GET", request.path, request.body, {
34
34
  signal: request.signal,
35
35
  headers: request.headers,
36
+ idempotencyKey: request.idempotencyKey,
37
+ ifMatch: request.ifMatch,
36
38
  okStatuses: request.okStatuses,
37
39
  });
38
40
  }
@@ -51,7 +53,7 @@ export class HonuaControlPlaneClient {
51
53
  async requestJson(capability, method, path, body, options = {}) {
52
54
  try {
53
55
  const response = await this.#client.pipelineFetch(method, this.resolvePath(path), {
54
- headers: jsonHeaders(options.headers),
56
+ headers: jsonHeaders(options),
55
57
  body: body === undefined ? null : JSON.stringify(body),
56
58
  }, options.signal, options.okStatuses ? { okStatuses: options.okStatuses } : {});
57
59
  if (response.status === 204)
@@ -277,17 +279,33 @@ function withManifestQuery(path, environment, workspaceId) {
277
279
  const query = params.toString();
278
280
  return query ? `${path}?${query}` : path;
279
281
  }
280
- function jsonHeaders(headers) {
282
+ /**
283
+ * Base JSON headers plus the concurrency/idempotency options every request
284
+ * option bag can carry.
285
+ *
286
+ * The option-level `idempotencyKey`/`ifMatch` are applied **after** raw
287
+ * `headers`, so a raw `Idempotency-Key`/`If-Match` entry cannot silently
288
+ * replace the value the caller passed as an option — the command layer records
289
+ * that value on its receipt, and a receipt that disagrees with the wire is
290
+ * worse than no receipt. Per-request `ifMatch` on a resource-client method is
291
+ * folded into `headers` by {@link withIfMatch} and still applies whenever the
292
+ * option-level shorthand is absent, which is every existing call site.
293
+ */
294
+ function jsonHeaders(options) {
281
295
  return {
282
296
  Accept: "application/json",
283
297
  "Content-Type": "application/json",
284
- ...headersToRecord(headers),
298
+ ...headersToRecord(options.headers),
299
+ ...(options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}),
300
+ ...(options.ifMatch ? { "If-Match": options.ifMatch } : {}),
285
301
  };
286
302
  }
287
303
  function listHeaders(options) {
288
304
  const headers = {
289
305
  Accept: "application/json",
290
306
  ...headersToRecord(options.headers),
307
+ ...(options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}),
308
+ ...(options.ifMatch ? { "If-Match": options.ifMatch } : {}),
291
309
  };
292
310
  if (options.validator?.etag)
293
311
  headers["If-None-Match"] = options.validator.etag;
@@ -0,0 +1,133 @@
1
+ /**
2
+ * The 2026.1 command catalog: real commands over the existing control-plane and
3
+ * Studio resource clients.
4
+ *
5
+ * These four cover one end-to-end slice of the terminal release journey —
6
+ * probe a connection, start an import, publish a map package, and save a Studio
7
+ * draft as an immutable version — and exercise every capability the shared
8
+ * layer promises: idempotency, dry run, cancellation, validation, typed errors,
9
+ * and deterministic receipts. Each command owns its own sequencing, which is
10
+ * why `studio.draft.saveVersion` performs the optimistic-generation check here
11
+ * rather than in four transports.
12
+ *
13
+ * ## Where the concurrency check is bracketed, not atomic
14
+ *
15
+ * `studio.draft.saveVersion` cannot make its generation check atomic with the
16
+ * write, because the Studio lifecycle API offers nothing to make it atomic
17
+ * with: `POST /package-drafts/{draftId}/content-versions` takes no request body
18
+ * (`HonuaStudioDraftsClient.createContentVersion`, and the pinned contract
19
+ * fixture `test/fixtures/studio-lifecycle/content-version-create.v1.json`) and
20
+ * `HonuaStudioRequestOptions` has no `ifMatch` — unlike its control-plane
21
+ * sibling `HonuaControlPlaneRequestOptions`. The one optimistic-concurrency
22
+ * primitive in the surface is the `generation` field on the
23
+ * `PUT /package-drafts/{draftId}` *body* (`StudioPackageDraftReplaceRequest`),
24
+ * which this route has no analogue for.
25
+ *
26
+ * So the command brackets the write instead of pretending the check was
27
+ * atomic: it reads the generation before, re-reads it after, and raises a
28
+ * `conflict` naming the version it created if the draft moved at any point.
29
+ * `generation` is documented to increment on every successful `PUT`
30
+ * (`StudioPackageDraft`), so no concurrent edit can slip through the bracket
31
+ * unseen. When honua-server grows a real precondition on this route, the
32
+ * bracket collapses into it and the second read goes away.
33
+ *
34
+ * @experimental
35
+ * @module
36
+ */
37
+ import type { HonuaMapPackage } from "../../runtime/index.js";
38
+ import type { StudioContentVersion } from "../../studio/lifecycle-types.js";
39
+ import type { HonuaControlPlaneJob, HonuaPublishMapPackageResponse } from "../types.js";
40
+ import type { HonuaCommand } from "./types.js";
41
+ /** Input for {@link connectionTestCommand}. */
42
+ export interface ConnectionTestInput {
43
+ /** Existing connection to probe. */
44
+ readonly connectionId: string;
45
+ /** Workspace the connection belongs to, when the deployment scopes them. */
46
+ readonly workspaceId?: string;
47
+ }
48
+ /** Server probe result. Left open: the probe payload is deployment-specific. */
49
+ export interface ConnectionTestOutput {
50
+ readonly ok?: boolean;
51
+ readonly status?: string;
52
+ readonly detail?: string;
53
+ readonly [extra: string]: unknown;
54
+ }
55
+ /**
56
+ * `POST /connections/{connectionId}/test` — probe a stored connection.
57
+ *
58
+ * Modelled as an `action` rather than a `read` so repeated probes carry an
59
+ * `Idempotency-Key` and collapse server-side; the probe itself does not mutate
60
+ * the connection.
61
+ */
62
+ export declare const connectionTestCommand: HonuaCommand<ConnectionTestInput, ConnectionTestOutput>;
63
+ /**
64
+ * Input for {@link importCreateCommand}.
65
+ *
66
+ * The server's own `dryRun` request field is deliberately not exposed: dry run
67
+ * is a command-layer concept here, and two spellings of it would let one
68
+ * transport preview while another executed.
69
+ */
70
+ export interface ImportCreateInput {
71
+ readonly sourceKind: string;
72
+ readonly sourceUrl?: string;
73
+ readonly connectionId?: string;
74
+ readonly workspaceId?: string;
75
+ readonly title?: string;
76
+ readonly options?: Record<string, unknown>;
77
+ }
78
+ /** `POST /imports` — enqueue an import job. */
79
+ export declare const importCreateCommand: HonuaCommand<ImportCreateInput, HonuaControlPlaneJob>;
80
+ /**
81
+ * Input for {@link mapPackagePublishCommand}.
82
+ *
83
+ * There is no approval field, and the schema is closed: publication approval is
84
+ * a server decision, and no transport may express one. The optimistic-
85
+ * concurrency validator travels on `HonuaCommandInvocation.ifMatch`, not in the
86
+ * input, so it can never become part of the idempotency identity.
87
+ */
88
+ export interface MapPackagePublishInput {
89
+ /** Hosted map the package belongs to. */
90
+ readonly mapId?: string;
91
+ readonly workspaceId?: string;
92
+ /** The `honua_map_package.v1` document to publish. */
93
+ readonly package: HonuaMapPackage;
94
+ /** Publication message recorded with the version. */
95
+ readonly message?: string;
96
+ }
97
+ /** `POST /packages` — publish a map package version. */
98
+ export declare const mapPackagePublishCommand: HonuaCommand<MapPackagePublishInput, HonuaPublishMapPackageResponse>;
99
+ /** Input for {@link studioDraftSaveVersionCommand}. */
100
+ export interface StudioDraftSaveVersionInput {
101
+ readonly draftId: string;
102
+ /**
103
+ * Last-seen draft `generation`. When supplied, the command brackets the write
104
+ * with a generation read on each side and fails with a `conflict` error if
105
+ * the draft moved — the optimistic-concurrency sequencing every transport
106
+ * would otherwise reimplement.
107
+ *
108
+ * The check is *detected*, not *enforced*: the route accepts no precondition,
109
+ * so a concurrent edit surfaces as a loud conflict naming the version that
110
+ * was created rather than as a rejected write. See this module's
111
+ * "Where the concurrency check is bracketed, not atomic".
112
+ */
113
+ readonly generation?: number;
114
+ }
115
+ /** `POST /package-drafts/{draftId}/content-versions` — save a draft as an immutable version. */
116
+ export declare const studioDraftSaveVersionCommand: HonuaCommand<StudioDraftSaveVersionInput, StudioContentVersion>;
117
+ /** Every command id in the 2026.1 catalog, in registry order. */
118
+ export declare const HONUA_COMMAND_IDS: readonly ["connection.test", "import.create", "map-package.publish", "studio.draft.saveVersion"];
119
+ /** One of {@link HONUA_COMMAND_IDS}. */
120
+ export type HonuaCommandId = (typeof HONUA_COMMAND_IDS)[number];
121
+ /**
122
+ * The shared registry every transport dispatches through. MCP tool schemas,
123
+ * CLI help, Studio clients, and JS methods all project from these entries.
124
+ */
125
+ export declare const HONUA_COMMANDS: {
126
+ readonly "connection.test": HonuaCommand<ConnectionTestInput, ConnectionTestOutput>;
127
+ readonly "import.create": HonuaCommand<ImportCreateInput, HonuaControlPlaneJob>;
128
+ readonly "map-package.publish": HonuaCommand<MapPackagePublishInput, HonuaPublishMapPackageResponse>;
129
+ readonly "studio.draft.saveVersion": HonuaCommand<StudioDraftSaveVersionInput, StudioContentVersion>;
130
+ };
131
+ /** Type guard narrowing an arbitrary string to a registered command id. */
132
+ export declare function isHonuaCommandId(value: string): value is HonuaCommandId;
133
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../src/control-plane/commands/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EACV,oBAAoB,EAGpB,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAmB,YAAY,EAA2B,MAAM,YAAY,CAAC;AAMzF,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,QAAQ,CAAC,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