@xemahq/workload-runtime-api-client 0.1.1 → 0.3.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 (110) hide show
  1. package/LICENSE +175 -1
  2. package/README.md +62 -0
  3. package/dist/custom-fetch.d.ts +23 -28
  4. package/dist/custom-fetch.js +20 -46
  5. package/dist/endpoints/runner-operations/runner-operations.d.ts +14 -0
  6. package/dist/endpoints/runner-operations/runner-operations.js +75 -0
  7. package/dist/index.d.ts +1 -5
  8. package/dist/index.js +2 -6
  9. package/dist/models/index.d.ts +11 -34
  10. package/dist/models/index.js +11 -34
  11. package/dist/models/paginationMeta.d.ts +2 -2
  12. package/dist/models/paginationMeta.js +2 -2
  13. package/dist/models/runnerJobDeliveryState.d.ts +17 -0
  14. package/dist/models/runnerJobDeliveryState.js +19 -0
  15. package/dist/models/runnerJobManagementControllerListParams.d.ts +14 -0
  16. package/dist/models/{runnerJobsControllerListState.d.ts → runnerJobManagementControllerListState.d.ts} +4 -4
  17. package/dist/models/{runnerJobsControllerListState.js → runnerJobManagementControllerListState.js} +4 -4
  18. package/dist/models/runnerJobState.d.ts +2 -2
  19. package/dist/models/runnerJobState.js +2 -2
  20. package/dist/models/runnerJobSummaryDto.d.ts +27 -0
  21. package/dist/models/runnerJobSummaryDtoPaginatedEnvelope.d.ts +13 -0
  22. package/dist/models/{workloadsControllerListKind.d.ts → runnerWorkloadManagementControllerListKind.d.ts} +6 -4
  23. package/dist/models/{workloadsControllerListKind.js → runnerWorkloadManagementControllerListKind.js} +6 -4
  24. package/dist/models/runnerWorkloadManagementControllerListParams.d.ts +17 -0
  25. package/dist/models/{workloadsControllerListState.d.ts → runnerWorkloadManagementControllerListState.d.ts} +4 -4
  26. package/dist/models/{workloadsControllerListState.js → runnerWorkloadManagementControllerListState.js} +4 -4
  27. package/dist/models/runnerWorkloadSummaryDto.d.ts +22 -0
  28. package/dist/models/runnerWorkloadSummaryDtoDataEnvelope.d.ts +11 -0
  29. package/dist/models/runnerWorkloadSummaryDtoPaginatedEnvelope.d.ts +13 -0
  30. package/dist/models/workloadHealthConditionDto.d.ts +3 -3
  31. package/dist/models/workloadHealthConditionDtoStatus.d.ts +2 -2
  32. package/dist/models/workloadHealthConditionDtoStatus.js +2 -2
  33. package/dist/models/workloadHealthSnapshotDto.d.ts +3 -3
  34. package/dist/models/workloadKind.d.ts +4 -2
  35. package/dist/models/workloadKind.js +4 -2
  36. package/dist/models/workloadState.d.ts +2 -2
  37. package/dist/models/workloadState.js +2 -2
  38. package/package.json +18 -2
  39. package/dist/endpoints/health/health.d.ts +0 -15
  40. package/dist/endpoints/health/health.js +0 -53
  41. package/dist/endpoints/internal/internal.d.ts +0 -6
  42. package/dist/endpoints/internal/internal.js +0 -26
  43. package/dist/endpoints/internal-/342/200/224-build-container-image/internal-/342/200/224-build-container-image.d.ts +0 -14
  44. package/dist/endpoints/internal-/342/200/224-build-container-image/internal-/342/200/224-build-container-image.js +0 -21
  45. package/dist/endpoints/runner-jobs/runner-jobs.d.ts +0 -37
  46. package/dist/endpoints/runner-jobs/runner-jobs.js +0 -101
  47. package/dist/endpoints/workloads/workloads.d.ts +0 -45
  48. package/dist/endpoints/workloads/workloads.js +0 -125
  49. package/dist/models/createRunnerJobDto.d.ts +0 -27
  50. package/dist/models/createRunnerJobDto.js +0 -9
  51. package/dist/models/runKanikoRequestDto.d.ts +0 -30
  52. package/dist/models/runKanikoRequestDtoBuildArgs.d.ts +0 -10
  53. package/dist/models/runKanikoRequestDtoBuildArgs.js +0 -9
  54. package/dist/models/runKanikoResponseDto.d.ts +0 -13
  55. package/dist/models/runKanikoResponseDto.js +0 -9
  56. package/dist/models/runnerJobDto.d.ts +0 -30
  57. package/dist/models/runnerJobDtoOutput.d.ts +0 -14
  58. package/dist/models/runnerJobDtoOutput.js +0 -9
  59. package/dist/models/runnerJobDtoPaginatedEnvelope.d.ts +0 -13
  60. package/dist/models/runnerJobReportDto.d.ts +0 -23
  61. package/dist/models/runnerJobReportDtoOutput.d.ts +0 -13
  62. package/dist/models/runnerJobReportDtoOutput.js +0 -9
  63. package/dist/models/runnerJobsControllerListParams.d.ts +0 -14
  64. package/dist/models/workloadConnectionInfoDto.d.ts +0 -12
  65. package/dist/models/workloadConnectionInfoDto.js +0 -9
  66. package/dist/models/workloadDescriptorDto.d.ts +0 -33
  67. package/dist/models/workloadDescriptorDtoCapabilitiesItem.d.ts +0 -12
  68. package/dist/models/workloadDescriptorDtoCapabilitiesItemKind.d.ts +0 -14
  69. package/dist/models/workloadDescriptorDtoCapabilitiesItemKind.js +0 -16
  70. package/dist/models/workloadDescriptorDtoSpec.d.ts +0 -13
  71. package/dist/models/workloadDescriptorDtoSpec.js +0 -9
  72. package/dist/models/workloadEndpointDto.d.ts +0 -11
  73. package/dist/models/workloadEndpointDto.js +0 -9
  74. package/dist/models/workloadGatewayRouteDto.d.ts +0 -22
  75. package/dist/models/workloadGatewayRouteDto.js +0 -2
  76. package/dist/models/workloadGatewayRouteDtoAuthParams.d.ts +0 -13
  77. package/dist/models/workloadGatewayRouteDtoAuthParams.js +0 -9
  78. package/dist/models/workloadGatewayRouteDtoAuthScheme.d.ts +0 -14
  79. package/dist/models/workloadGatewayRouteDtoAuthScheme.js +0 -13
  80. package/dist/models/workloadIngressSourceDto.d.ts +0 -11
  81. package/dist/models/workloadIngressSourceDto.js +0 -9
  82. package/dist/models/workloadInstanceDto.d.ts +0 -36
  83. package/dist/models/workloadInstanceDto.js +0 -2
  84. package/dist/models/workloadInstanceDtoPaginatedEnvelope.d.ts +0 -13
  85. package/dist/models/workloadInstanceDtoPaginatedEnvelope.js +0 -2
  86. package/dist/models/workloadInstanceDtoSubjectLabels.d.ts +0 -10
  87. package/dist/models/workloadInstanceDtoSubjectLabels.js +0 -9
  88. package/dist/models/workloadLifecycleDto.d.ts +0 -12
  89. package/dist/models/workloadLifecycleDto.js +0 -9
  90. package/dist/models/workloadNetworkDto.d.ts +0 -12
  91. package/dist/models/workloadNetworkDto.js +0 -2
  92. package/dist/models/workloadNodeAffinityDto.d.ts +0 -10
  93. package/dist/models/workloadNodeAffinityDto.js +0 -9
  94. package/dist/models/workloadTarget.d.ts +0 -11
  95. package/dist/models/workloadTarget.js +0 -13
  96. package/dist/models/workloadTenancyDto.d.ts +0 -15
  97. package/dist/models/workloadTenancyDto.js +0 -2
  98. package/dist/models/workloadTenancyDtoSubjectLabels.d.ts +0 -10
  99. package/dist/models/workloadTenancyDtoSubjectLabels.js +0 -9
  100. package/dist/models/workloadVolumeMountDto.d.ts +0 -16
  101. package/dist/models/workloadVolumeMountDto.js +0 -9
  102. package/dist/models/workloadsControllerListParams.d.ts +0 -18
  103. package/dist/models/workloadsControllerListParams.js +0 -2
  104. /package/dist/models/{runKanikoRequestDto.js → runnerJobManagementControllerListParams.js} +0 -0
  105. /package/dist/models/{runnerJobDto.js → runnerJobSummaryDto.js} +0 -0
  106. /package/dist/models/{runnerJobDtoPaginatedEnvelope.js → runnerJobSummaryDtoPaginatedEnvelope.js} +0 -0
  107. /package/dist/models/{runnerJobReportDto.js → runnerWorkloadManagementControllerListParams.js} +0 -0
  108. /package/dist/models/{runnerJobsControllerListParams.js → runnerWorkloadSummaryDto.js} +0 -0
  109. /package/dist/models/{workloadDescriptorDto.js → runnerWorkloadSummaryDtoDataEnvelope.js} +0 -0
  110. /package/dist/models/{workloadDescriptorDtoCapabilitiesItem.js → runnerWorkloadSummaryDtoPaginatedEnvelope.js} +0 -0
package/LICENSE CHANGED
@@ -1 +1,175 @@
1
- Copyright (c) 2026 Xema. All rights reserved.
1
+ Xema Business Source License 1.1
2
+
3
+ License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: Neuralchowder Inc.
11
+
12
+ Licensed Work: Xema. The Licensed Work is (c) 2026 Neuralchowder Inc.
13
+
14
+ The Licensed Work includes, without limitation, Xema Core, Xema Runtime,
15
+ Xema Kernel, Xema control plane, Xema application runtime, Xema biome
16
+ runtime, Xema biome registry, Xema store services, Xema orchestration
17
+ services, Xema agents, Xema skills, Xema memory services, Xema APIs, Xema
18
+ user interfaces, Xema command-line tools, Xema deployment artifacts, Xema
19
+ templates, Xema specifications, Xema schemas, Xema manifests, Xema
20
+ documentation, Xema examples, and all source code, object code, binaries,
21
+ packages, modules, configuration files, manifests, schemas, examples,
22
+ templates, documentation, and derivative works included in or distributed
23
+ as part of the Xema software project.
24
+
25
+ The Licensed Work does not include any third-party software, libraries,
26
+ dependencies, packages, assets, or components that are distributed with the
27
+ Licensed Work but are governed by their own separate license terms. Such
28
+ third-party materials remain subject to their respective licenses.
29
+
30
+ A specific file, package, component, or directory may state that it is
31
+ governed by a different license. In that case, that specific file, package,
32
+ component, or directory is governed by the license expressly stated therein.
33
+
34
+ Additional Use Grant:
35
+
36
+ You may make production use of the Licensed Work, provided that your use
37
+ does not include offering, providing, making available, distributing,
38
+ hosting, managing, embedding, reselling, white-labeling, sublicensing,
39
+ commercializing, or otherwise making the Licensed Work, or any modified
40
+ version or derivative work of the Licensed Work, available to Third Parties
41
+ as part of a Competitive Offering.
42
+
43
+ The following definitions and clarifications form part of, and govern
44
+ the interpretation of, the Additional Use Grant set out above.
45
+
46
+ 1. "Production Use" means any use of the Licensed Work other than for
47
+ development, testing, evaluation, demonstration, experimentation,
48
+ benchmarking, or other non-production purposes.
49
+
50
+ 2. "Affiliate" means any entity that, directly or indirectly,
51
+ controls, is controlled by, or is under common control with you,
52
+ where "control" means ownership of more than fifty percent (50%) of
53
+ the voting interests of the entity, or the power to direct its
54
+ management.
55
+
56
+ 3. "Third Party" means any natural person or legal entity other than
57
+ you and your Affiliates.
58
+
59
+ 4. "Competitive Offering" means any product or service, made available
60
+ to one or more Third Parties for a fee or other consideration
61
+ (including without limitation on a paid, subscription,
62
+ advertising-supported, hosted, or managed-service basis), that is
63
+ offered or marketed as, or that competes with, a software platform,
64
+ runtime, orchestration system, agent or automation system,
65
+ extension or distribution marketplace, or other software system
66
+ that provides, in substantial part, the same or substantially
67
+ similar capabilities as those provided by the Licensed Work. A
68
+ product or service is a Competitive Offering whether the Licensed
69
+ Work is provided in whole or in part, alone or bundled with other
70
+ software, and whether modified or unmodified.
71
+
72
+ 5. Providing, hosting, or managing the Licensed Work for a Third Party,
73
+ or otherwise making the Licensed Work available to a Third Party as
74
+ a hosted or managed service such that the Third Party obtains the
75
+ principal value or functionality of the Licensed Work, is a
76
+ Competitive Offering and is not permitted by the Additional Use
77
+ Grant.
78
+
79
+ 6. Subject to the foregoing, the Additional Use Grant permits you to
80
+ make Production Use of the Licensed Work for your own internal
81
+ business purposes and to build, operate, and provide your own
82
+ products and services to Third Parties, provided that the Licensed
83
+ Work itself (whether modified or unmodified) is not the product or
84
+ service, and is not a Competitive Offering, made available to those
85
+ Third Parties.
86
+
87
+ 7. You may modify the Licensed Work and create derivative works for
88
+ any purpose permitted by this License. Any Production Use of such
89
+ modified or derivative works remains subject to the same
90
+ restrictions as the Licensed Work, including the prohibition on
91
+ Competitive Offerings.
92
+
93
+ 8. Use of the Licensed Work by your own employees, contractors, and
94
+ agents, acting on your behalf and for your benefit, is not by
95
+ itself making the Licensed Work available to a Third Party.
96
+
97
+ 9. Embedding or distributing the Licensed Work as a component of your
98
+ own product or service is permitted only where the Licensed Work
99
+ does not constitute the principal value of that product or service
100
+ and the product or service is not a Competitive Offering.
101
+
102
+ 10. Nothing in this Additional Use Grant grants any right to use any
103
+ name, trademark, service mark, or logo of the Licensor or its
104
+ Affiliates, except as reasonably required for customary
105
+ attribution.
106
+
107
+ 11. The rights stated in this Additional Use Grant are the maximum
108
+ rights granted for Production Use prior to the Change Date. Any
109
+ Production Use not expressly permitted requires a separate
110
+ commercial license from the Licensor.
111
+
112
+ 12. If any provision of this Additional Use Grant is held invalid or
113
+ unenforceable, that provision shall be limited or eliminated to
114
+ the minimum extent necessary so that the remainder of this
115
+ Additional Use Grant, and of this License, remains in full force
116
+ and effect. The Licensor reserves all rights not expressly granted
117
+ by this License.
118
+
119
+
120
+ Change Date: Four years from the date the specific version of the Licensed
121
+ Work is first publicly released by Licensor.
122
+
123
+ Change License: Mozilla Public License, Version 2.0
124
+
125
+ For information about alternative licensing arrangements, commercial
126
+ licensing, enterprise licensing, OEM licensing, appliance licensing, managed
127
+ service licensing, cloud provider licensing, or other commercial use of the
128
+ Licensed Work, please contact: licensing@neuralchowder.com
129
+
130
+ -----------------------------------------------------------------------------
131
+
132
+ Notice
133
+
134
+ Business Source License 1.1
135
+
136
+ Terms
137
+
138
+ The Licensor hereby grants you the right to copy, modify, create derivative
139
+ works, redistribute, and make non-production use of the Licensed Work. The
140
+ Licensor may make an Additional Use Grant, above, permitting limited
141
+ production use.
142
+
143
+ Effective on the Change Date, or the fourth anniversary of the first publicly
144
+ available distribution of a specific version of the Licensed Work under this
145
+ License, whichever comes first, the Licensor hereby grants you rights under
146
+ the terms of the Change License, and the rights granted in the paragraph above
147
+ terminate.
148
+
149
+ If your use of the Licensed Work does not comply with the requirements
150
+ currently in effect as described in this License, you must purchase a
151
+ commercial license from the Licensor, its affiliated entities, or authorized
152
+ resellers, or you must refrain from using the Licensed Work.
153
+
154
+ All copies of the original and modified Licensed Work, and derivative works of
155
+ the Licensed Work, are subject to this License. This License applies separately
156
+ for each version of the Licensed Work and the Change Date may vary for each
157
+ version of the Licensed Work released by Licensor.
158
+
159
+ You must conspicuously display this License on each original or modified copy
160
+ of the Licensed Work. If you receive the Licensed Work in original or modified
161
+ form from a third party, the terms and conditions set forth in this License
162
+ apply to your use of that work.
163
+
164
+ Any use of the Licensed Work in violation of this License will automatically
165
+ terminate your rights under this License for the current and all other
166
+ versions of the Licensed Work.
167
+
168
+ This License does not grant you any right in any trademark or logo of Licensor
169
+ or its affiliates, provided that you may use a trademark or logo of Licensor
170
+ as expressly required by this License.
171
+
172
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN
173
+ "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS
174
+ OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS
175
+ FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ <!-- Generated by @xemahq/api-client-generator. Do not edit by hand. -->
2
+ <p align="center">
3
+ <svg width="680" height="120" viewBox="0 0 680 120" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="@xemahq/workload-runtime-api-client">
4
+ <rect width="680" height="120" rx="14" fill="#0B1020"/>
5
+ <g transform="translate(28,34)">
6
+ <path d="M26 0 L52 15 L52 45 L26 60 L0 45 L0 15 Z" fill="#14B8A6" opacity="0.18"/>
7
+ <path d="M26 12 L41 21 L41 39 L26 48 L11 39 L11 21 Z" fill="#14B8A6"/>
8
+ </g>
9
+ <text x="92" y="52" font-family="ui-monospace,SFMono-Regular,Menlo,monospace" font-size="22" fill="#F8FAFC" font-weight="700">@xemahq/workload-runtime-api-client</text>
10
+ <text x="92" y="80" font-family="ui-sans-serif,system-ui,sans-serif" font-size="15" fill="#94A3B8">Typed, generated HTTP client for the Workload Runtime API.</text>
11
+ <text x="652" y="105" text-anchor="end" font-family="ui-sans-serif,system-ui,sans-serif" font-size="12" fill="#475569">xema.dev</text>
12
+ </svg>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://xema.dev">Website</a> &middot;
17
+ <a href="https://www.npmjs.com/package/@xemahq/workload-runtime-api-client">npm</a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <img alt="npm" src="https://img.shields.io/npm/v/%40xemahq%2Fworkload-runtime-api-client?color=2563eb&label=npm">
22
+ <img alt="license" src="https://img.shields.io/npm/l/%40xemahq%2Fworkload-runtime-api-client?color=10b981">
23
+ <img alt="types" src="https://img.shields.io/npm/types/%40xemahq%2Fworkload-runtime-api-client?color=3178c6">
24
+ </p>
25
+
26
+ # @xemahq/workload-runtime-api-client
27
+
28
+ > Typed, generated HTTP client for the Workload Runtime API.
29
+
30
+ ## Overview
31
+
32
+ Auto-generated TypeScript client for the **Workload Runtime API**. It exports typed
33
+ request functions and response models that mirror the service's OpenAPI surface,
34
+ so callers get end-to-end type safety without hand-writing HTTP calls. This
35
+ package is produced by `@xemahq/api-client-generator` and regenerated whenever
36
+ the service's API changes — do not edit it by hand.
37
+
38
+ ## When to use it
39
+
40
+ - Use it from any TypeScript service or app that calls the Workload Runtime API over HTTP.
41
+ - You get compile-time types for every endpoint and payload; regenerate to pick
42
+ up API changes rather than editing the client.
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pnpm add @xemahq/workload-runtime-api-client
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ ```ts
53
+ // Every endpoint function and response model is exported from the package root.
54
+ import * as client from '@xemahq/workload-runtime-api-client';
55
+ ```
56
+
57
+ Call the typed endpoint functions; request and response shapes are fully typed
58
+ from the service's OpenAPI spec.
59
+
60
+ ## License
61
+
62
+ Proprietary — &copy; Xema. All rights reserved. — [xema.dev](https://xema.dev)
@@ -3,41 +3,19 @@
3
3
  *
4
4
  * Consumers must call `configureClient()` before using any endpoint function.
5
5
  * The baseUrl is prepended to the relative paths generated by Orval.
6
- *
7
- * Features:
8
- * - Automatic bearer-token injection via `getAuthToken` callback
9
- * - Per-request header injection via `getHeaders` callback
10
- * - Automatic 401 handling via `onUnauthorized` callback (single retry)
11
- * - Exponential-backoff retry for transient failures (429, 502, 503, 504)
12
- * - Typed `ClientError` for non-2xx responses
13
- * - Per-call header overrides (take precedence over global headers)
14
- *
15
- * @example
16
- * configureClient({
17
- * baseUrl: 'http://governance-api:3400',
18
- * getAuthToken: () => identityBootstrapService.getAccessToken(),
19
- * getHeaders: () => ({ 'X-Org-Id': orgId, 'X-Correlation-Id': crypto.randomUUID() }),
20
- * });
21
6
  */
22
7
  export interface ClientConfig {
23
- /**
24
- * Static base URL (e.g. 'http://localhost:3140') — no trailing slash.
25
- * Mutually exclusive with `baseUrlResolver`; exactly one MUST be set.
26
- */
8
+ /** Static base URL (e.g. 'http://localhost:3140') — no trailing slash. */
27
9
  baseUrl?: string;
28
- /**
29
- * Per-request base-URL resolver. When set, the peer URL is resolved from
30
- * the service registry on EVERY request (boot-order-safe). Wired by
31
- * `configureOrvalClientResolved` from `@xemahq/platform-common`.
32
- */
10
+ /** Per-request base-URL resolver (service-registry-safe). */
33
11
  baseUrlResolver?: () => string | Promise<string>;
34
- /** Optional async callback to get an auth token. Auto-sets Authorization header on every request. */
12
+ /** Optional async callback to get an auth token. */
35
13
  getAuthToken?: () => Promise<string>;
36
- /** Optional callback returning headers to inject on every request. Per-call headers take precedence. */
14
+ /** Optional callback returning headers to inject on every request. */
37
15
  getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
38
- /** Optional callback invoked on 401 before a single retry (e.g. force-refresh auth token). */
16
+ /** Optional callback invoked on 401 before a single retry. */
39
17
  onUnauthorized?: () => Promise<void>;
40
- /** Maximum retry attempts for transient failures (default: 3). Set to 0 to disable retries. */
18
+ /** Maximum retry attempts for transient failures (default: 3). */
41
19
  maxRetries?: number;
42
20
  }
43
21
  export declare class ClientError extends Error {
@@ -48,5 +26,22 @@ export declare class ClientError extends Error {
48
26
  }
49
27
  export declare function configureClient(config: ClientConfig): void;
50
28
  export declare function getClientConfig(): ClientConfig;
29
+ /**
30
+ * Returns the response body EXACTLY as the service sent it.
31
+ *
32
+ * Xema platform services wrap every 2xx payload in a `{ data: T }` envelope
33
+ * (`{ data: T[], pagination }` for lists) via the global
34
+ * ResponseEnvelopeInterceptor. That envelope is part of the wire contract, so
35
+ * controllers document it with the `@ApiDataResponse` / `@ApiDataArrayResponse`
36
+ * / `@ApiPaginatedResponse` family and the generated types describe it —
37
+ * consumers read `.data`.
38
+ *
39
+ * This client therefore does NOT peel the envelope. It used to, which made the
40
+ * transport contradict the published schema: any endpoint documented honestly
41
+ * returned `undefined` from `.data` at runtime. Do not re-introduce an unwrap
42
+ * here — fix the controller's decorator instead.
43
+ *
44
+ * Only 2xx bodies are returned: non-2xx is surfaced as a thrown ClientError.
45
+ */
51
46
  export declare const customFetch: <T>(url: string, options: RequestInit) => Promise<T>;
52
47
  export default customFetch;
@@ -4,21 +4,6 @@
4
4
  *
5
5
  * Consumers must call `configureClient()` before using any endpoint function.
6
6
  * The baseUrl is prepended to the relative paths generated by Orval.
7
- *
8
- * Features:
9
- * - Automatic bearer-token injection via `getAuthToken` callback
10
- * - Per-request header injection via `getHeaders` callback
11
- * - Automatic 401 handling via `onUnauthorized` callback (single retry)
12
- * - Exponential-backoff retry for transient failures (429, 502, 503, 504)
13
- * - Typed `ClientError` for non-2xx responses
14
- * - Per-call header overrides (take precedence over global headers)
15
- *
16
- * @example
17
- * configureClient({
18
- * baseUrl: 'http://governance-api:3400',
19
- * getAuthToken: () => identityBootstrapService.getAccessToken(),
20
- * getHeaders: () => ({ 'X-Org-Id': orgId, 'X-Correlation-Id': crypto.randomUUID() }),
21
- * });
22
7
  */
23
8
  Object.defineProperty(exports, "__esModule", { value: true });
24
9
  exports.customFetch = exports.ClientError = void 0;
@@ -50,7 +35,6 @@ function getClientConfig() {
50
35
  const RETRYABLE_STATUSES = [429, 502, 503, 504];
51
36
  async function buildHeaders(config, callerHeaders) {
52
37
  const headers = new Headers(callerHeaders);
53
- // Global headers from config (caller-provided headers take precedence)
54
38
  if (config.getHeaders) {
55
39
  const globalHeaders = await Promise.resolve(config.getHeaders());
56
40
  for (const [key, value] of Object.entries(globalHeaders)) {
@@ -59,13 +43,29 @@ async function buildHeaders(config, callerHeaders) {
59
43
  }
60
44
  }
61
45
  }
62
- // Auth token (caller or global headers take precedence)
63
46
  if (config.getAuthToken && !headers.has('Authorization')) {
64
47
  const token = await config.getAuthToken();
65
48
  headers.set('Authorization', `Bearer ${token}`);
66
49
  }
67
50
  return headers;
68
51
  }
52
+ /**
53
+ * Returns the response body EXACTLY as the service sent it.
54
+ *
55
+ * Xema platform services wrap every 2xx payload in a `{ data: T }` envelope
56
+ * (`{ data: T[], pagination }` for lists) via the global
57
+ * ResponseEnvelopeInterceptor. That envelope is part of the wire contract, so
58
+ * controllers document it with the `@ApiDataResponse` / `@ApiDataArrayResponse`
59
+ * / `@ApiPaginatedResponse` family and the generated types describe it —
60
+ * consumers read `.data`.
61
+ *
62
+ * This client therefore does NOT peel the envelope. It used to, which made the
63
+ * transport contradict the published schema: any endpoint documented honestly
64
+ * returned `undefined` from `.data` at runtime. Do not re-introduce an unwrap
65
+ * here — fix the controller's decorator instead.
66
+ *
67
+ * Only 2xx bodies are returned: non-2xx is surfaced as a thrown ClientError.
68
+ */
69
69
  const customFetch = async (url, options) => {
70
70
  const config = getClientConfig();
71
71
  const base = config.baseUrlResolver
@@ -83,7 +83,6 @@ const customFetch = async (url, options) => {
83
83
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
84
84
  try {
85
85
  const response = await fetch(fullUrl, requestInit);
86
- // 401 — invoke onUnauthorized and retry once (outside the transient retry loop)
87
86
  if (response.status === 401 && config.onUnauthorized && attempt === 0) {
88
87
  await config.onUnauthorized();
89
88
  const refreshedHeaders = await buildHeaders(config, options.headers);
@@ -92,17 +91,15 @@ const customFetch = async (url, options) => {
92
91
  if (retryResponse.status >= 400) {
93
92
  throw new ClientError(retryResponse.status, fullUrl, retryBody);
94
93
  }
95
- return unwrapEnvelope(retryBody);
94
+ return retryBody;
96
95
  }
97
- // Non-retryable status — return or throw
98
96
  if (!RETRYABLE_STATUSES.includes(response.status) || attempt >= maxRetries) {
99
97
  const body = await parseBody(response);
100
98
  if (response.status >= 400) {
101
99
  throw new ClientError(response.status, fullUrl, body);
102
100
  }
103
- return unwrapEnvelope(body);
101
+ return body;
104
102
  }
105
- // Retryable — wait and retry
106
103
  const retryAfter = parseRetryAfter(response.headers.get('Retry-After'));
107
104
  const waitMs = retryAfter ?? addJitter(delay);
108
105
  await sleep(waitMs);
@@ -110,7 +107,7 @@ const customFetch = async (url, options) => {
110
107
  }
111
108
  catch (error) {
112
109
  if (error instanceof ClientError)
113
- throw error; // Don't retry client errors
110
+ throw error;
114
111
  lastError = error instanceof Error ? error : new Error(String(error));
115
112
  if (attempt >= maxRetries)
116
113
  throw lastError;
@@ -122,29 +119,6 @@ const customFetch = async (url, options) => {
122
119
  throw lastError ?? new Error(`All retries exhausted for ${fullUrl}`);
123
120
  };
124
121
  exports.customFetch = customFetch;
125
- /**
126
- * The server wraps every non-`@RawResponse()` payload in `{ data: T }`
127
- * via `ResponseEnvelopeInterceptor` (see platform-common). Orval's
128
- * generated types describe the INNER `T` (because the controllers
129
- * declare their return type as `T`, not `{ data: T }`), so the client
130
- * must peel `data` to keep types and wire shape consistent. Paginated
131
- * lists return `{ data: T[], pagination: {...} }` and consumers read
132
- * both fields — keep that envelope intact (detected by the presence
133
- * of `pagination`). Anything without a `data` field is returned as-is.
134
- */
135
- function unwrapEnvelope(body) {
136
- if (body === null ||
137
- typeof body !== 'object' ||
138
- Array.isArray(body) ||
139
- !('data' in body)) {
140
- return body;
141
- }
142
- const envelope = body;
143
- if ('pagination' in envelope) {
144
- return envelope;
145
- }
146
- return envelope.data;
147
- }
148
122
  async function parseBody(response) {
149
123
  const contentType = response.headers.get('content-type');
150
124
  if (contentType?.includes('application/json')) {
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generated by orval v8.16.0 🍺
3
+ * Do not edit manually.
4
+ * Workload Runtime API
5
+ * Declarative workload scheduling for biome sidecars, biome APIs,
6
+ * OpenAPI spec version: 0.1.0
7
+ */
8
+ import type { RunnerJobManagementControllerListParams, RunnerJobSummaryDtoPaginatedEnvelope, RunnerWorkloadManagementControllerListParams, RunnerWorkloadSummaryDtoDataEnvelope, RunnerWorkloadSummaryDtoPaginatedEnvelope } from '../../models';
9
+ export declare const getRunnerWorkloadManagementControllerListUrl: (params?: RunnerWorkloadManagementControllerListParams) => string;
10
+ export declare const runnerWorkloadManagementControllerList: (params?: RunnerWorkloadManagementControllerListParams, options?: RequestInit) => Promise<RunnerWorkloadSummaryDtoPaginatedEnvelope>;
11
+ export declare const getRunnerWorkloadManagementControllerRefreshHealthUrl: (id: string) => string;
12
+ export declare const runnerWorkloadManagementControllerRefreshHealth: (id: string, options?: RequestInit) => Promise<RunnerWorkloadSummaryDtoDataEnvelope>;
13
+ export declare const getRunnerJobManagementControllerListUrl: (params?: RunnerJobManagementControllerListParams) => string;
14
+ export declare const runnerJobManagementControllerList: (params?: RunnerJobManagementControllerListParams, options?: RequestInit) => Promise<RunnerJobSummaryDtoPaginatedEnvelope>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runnerJobManagementControllerList = exports.getRunnerJobManagementControllerListUrl = exports.runnerWorkloadManagementControllerRefreshHealth = exports.getRunnerWorkloadManagementControllerRefreshHealthUrl = exports.runnerWorkloadManagementControllerList = exports.getRunnerWorkloadManagementControllerListUrl = void 0;
4
+ const custom_fetch_1 = require("../../custom-fetch");
5
+ const getRunnerWorkloadManagementControllerListUrl = (params) => {
6
+ const normalizedParams = new URLSearchParams();
7
+ Object.entries(params || {}).forEach(([key, value]) => {
8
+ if (value === undefined)
9
+ return;
10
+ if (value === null) {
11
+ normalizedParams.append(key, 'null');
12
+ return;
13
+ }
14
+ if (Array.isArray(value)) {
15
+ for (const item of value) {
16
+ if (item === undefined || item === null)
17
+ continue;
18
+ normalizedParams.append(key, item.toString());
19
+ }
20
+ return;
21
+ }
22
+ normalizedParams.append(key, value.toString());
23
+ });
24
+ const stringifiedParams = normalizedParams.toString();
25
+ return stringifiedParams.length > 0 ? `/bff/runner-operations/workloads?${stringifiedParams}` : `/bff/runner-operations/workloads`;
26
+ };
27
+ exports.getRunnerWorkloadManagementControllerListUrl = getRunnerWorkloadManagementControllerListUrl;
28
+ const runnerWorkloadManagementControllerList = async (params, options) => {
29
+ return (0, custom_fetch_1.customFetch)((0, exports.getRunnerWorkloadManagementControllerListUrl)(params), {
30
+ ...options,
31
+ method: 'GET'
32
+ });
33
+ };
34
+ exports.runnerWorkloadManagementControllerList = runnerWorkloadManagementControllerList;
35
+ const getRunnerWorkloadManagementControllerRefreshHealthUrl = (id) => {
36
+ return `/bff/runner-operations/workloads/${id}/refresh-health`;
37
+ };
38
+ exports.getRunnerWorkloadManagementControllerRefreshHealthUrl = getRunnerWorkloadManagementControllerRefreshHealthUrl;
39
+ const runnerWorkloadManagementControllerRefreshHealth = async (id, options) => {
40
+ return (0, custom_fetch_1.customFetch)((0, exports.getRunnerWorkloadManagementControllerRefreshHealthUrl)(id), {
41
+ ...options,
42
+ method: 'POST'
43
+ });
44
+ };
45
+ exports.runnerWorkloadManagementControllerRefreshHealth = runnerWorkloadManagementControllerRefreshHealth;
46
+ const getRunnerJobManagementControllerListUrl = (params) => {
47
+ const normalizedParams = new URLSearchParams();
48
+ Object.entries(params || {}).forEach(([key, value]) => {
49
+ if (value === undefined)
50
+ return;
51
+ if (value === null) {
52
+ normalizedParams.append(key, 'null');
53
+ return;
54
+ }
55
+ if (Array.isArray(value)) {
56
+ for (const item of value) {
57
+ if (item === undefined || item === null)
58
+ continue;
59
+ normalizedParams.append(key, item.toString());
60
+ }
61
+ return;
62
+ }
63
+ normalizedParams.append(key, value.toString());
64
+ });
65
+ const stringifiedParams = normalizedParams.toString();
66
+ return stringifiedParams.length > 0 ? `/bff/runner-operations/jobs?${stringifiedParams}` : `/bff/runner-operations/jobs`;
67
+ };
68
+ exports.getRunnerJobManagementControllerListUrl = getRunnerJobManagementControllerListUrl;
69
+ const runnerJobManagementControllerList = async (params, options) => {
70
+ return (0, custom_fetch_1.customFetch)((0, exports.getRunnerJobManagementControllerListUrl)(params), {
71
+ ...options,
72
+ method: 'GET'
73
+ });
74
+ };
75
+ exports.runnerJobManagementControllerList = runnerJobManagementControllerList;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,3 @@
1
1
  export { configureClient, getClientConfig, ClientError, customFetch, type ClientConfig } from './custom-fetch';
2
2
  export * from './models';
3
- export * from './endpoints/health/health';
4
- export * from './endpoints/internal/internal';
5
- export * from './endpoints/internal-—-build-container-image/internal-—-build-container-image';
6
- export * from './endpoints/runner-jobs/runner-jobs';
7
- export * from './endpoints/workloads/workloads';
3
+ export * from './endpoints/runner-operations/runner-operations';
package/dist/index.js CHANGED
@@ -15,15 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.customFetch = exports.ClientError = exports.getClientConfig = exports.configureClient = void 0;
18
- // Auto-generated by scripts/build-client-index.js — do not edit manually.
18
+ // Auto-generated by @xemahq/api-client-generator — do not edit manually.
19
19
  var custom_fetch_1 = require("./custom-fetch");
20
20
  Object.defineProperty(exports, "configureClient", { enumerable: true, get: function () { return custom_fetch_1.configureClient; } });
21
21
  Object.defineProperty(exports, "getClientConfig", { enumerable: true, get: function () { return custom_fetch_1.getClientConfig; } });
22
22
  Object.defineProperty(exports, "ClientError", { enumerable: true, get: function () { return custom_fetch_1.ClientError; } });
23
23
  Object.defineProperty(exports, "customFetch", { enumerable: true, get: function () { return custom_fetch_1.customFetch; } });
24
24
  __exportStar(require("./models"), exports);
25
- __exportStar(require("./endpoints/health/health"), exports);
26
- __exportStar(require("./endpoints/internal/internal"), exports);
27
- __exportStar(require("./endpoints/internal-\u2014-build-container-image/internal-\u2014-build-container-image"), exports);
28
- __exportStar(require("./endpoints/runner-jobs/runner-jobs"), exports);
29
- __exportStar(require("./endpoints/workloads/workloads"), exports);
25
+ __exportStar(require("./endpoints/runner-operations/runner-operations"), exports);
@@ -1,41 +1,18 @@
1
- export * from './createRunnerJobDto';
2
1
  export * from './paginationMeta';
3
- export * from './runKanikoRequestDto';
4
- export * from './runKanikoRequestDtoBuildArgs';
5
- export * from './runKanikoResponseDto';
6
- export * from './runnerJobDto';
7
- export * from './runnerJobDtoOutput';
8
- export * from './runnerJobDtoPaginatedEnvelope';
9
- export * from './runnerJobReportDto';
10
- export * from './runnerJobReportDtoOutput';
2
+ export * from './runnerJobDeliveryState';
3
+ export * from './runnerJobManagementControllerListParams';
4
+ export * from './runnerJobManagementControllerListState';
11
5
  export * from './runnerJobState';
12
- export * from './runnerJobsControllerListParams';
13
- export * from './runnerJobsControllerListState';
14
- export * from './workloadConnectionInfoDto';
15
- export * from './workloadDescriptorDto';
16
- export * from './workloadDescriptorDtoCapabilitiesItem';
17
- export * from './workloadDescriptorDtoCapabilitiesItemKind';
18
- export * from './workloadDescriptorDtoSpec';
19
- export * from './workloadEndpointDto';
20
- export * from './workloadGatewayRouteDto';
21
- export * from './workloadGatewayRouteDtoAuthParams';
22
- export * from './workloadGatewayRouteDtoAuthScheme';
6
+ export * from './runnerJobSummaryDto';
7
+ export * from './runnerJobSummaryDtoPaginatedEnvelope';
8
+ export * from './runnerWorkloadManagementControllerListKind';
9
+ export * from './runnerWorkloadManagementControllerListParams';
10
+ export * from './runnerWorkloadManagementControllerListState';
11
+ export * from './runnerWorkloadSummaryDto';
12
+ export * from './runnerWorkloadSummaryDtoDataEnvelope';
13
+ export * from './runnerWorkloadSummaryDtoPaginatedEnvelope';
23
14
  export * from './workloadHealthConditionDto';
24
15
  export * from './workloadHealthConditionDtoStatus';
25
16
  export * from './workloadHealthSnapshotDto';
26
- export * from './workloadIngressSourceDto';
27
- export * from './workloadInstanceDto';
28
- export * from './workloadInstanceDtoPaginatedEnvelope';
29
- export * from './workloadInstanceDtoSubjectLabels';
30
17
  export * from './workloadKind';
31
- export * from './workloadLifecycleDto';
32
- export * from './workloadNetworkDto';
33
- export * from './workloadNodeAffinityDto';
34
18
  export * from './workloadState';
35
- export * from './workloadTarget';
36
- export * from './workloadTenancyDto';
37
- export * from './workloadTenancyDtoSubjectLabels';
38
- export * from './workloadVolumeMountDto';
39
- export * from './workloadsControllerListKind';
40
- export * from './workloadsControllerListParams';
41
- export * from './workloadsControllerListState';