@healthcloudai/hc-ams 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/index.cjs +315 -0
- package/dist/index.d.cts +124 -0
- package/dist/index.d.ts +124 -0
- package/dist/index.js +281 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# HealthCloud AMS SDK for NodeJS / TypeScript
|
|
2
|
+
|
|
3
|
+
Typed access to AMS Services' public application-agent discovery endpoint.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @healthcloudai/hc-ams
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { HCAmsSDK } from "@healthcloudai/hc-ams";
|
|
15
|
+
|
|
16
|
+
const sdk = new HCAmsSDK({ environment: "dev" });
|
|
17
|
+
|
|
18
|
+
const agents = await sdk.ams.getAgentsForTenant("<TENANT_ID>");
|
|
19
|
+
// { public: [...], orchestrator: [...] }
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Authentication
|
|
23
|
+
|
|
24
|
+
`ams.getAgentsForTenant` is public and requires no access token.
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
| Option | Description |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `environment` | `"dev"` \| `"uat"` \| `"prod"` — resolves the AMS base URL (`{env-}amsservices.health.cloud/api/ams`, no prefix for `prod`). |
|
|
31
|
+
| `tenantId` | Optional default tenant ID for future methods. |
|
|
32
|
+
| `accessToken` | Optional bearer token for future authenticated methods. |
|
|
33
|
+
| `baseUrlOverride` | Overrides the resolved AMS base URL (e.g. for local/staging testing). |
|
|
34
|
+
| `timeout` | Request timeout in milliseconds. Defaults to 30000. |
|
|
35
|
+
|
|
36
|
+
## Scope
|
|
37
|
+
|
|
38
|
+
This is an initial, minimal package: it currently ships only `AmsClient.getAgentsForTenant`. Real-time (WebSocket) agent endpoints are intentionally out of scope for this release.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AmsClient: () => AmsClient,
|
|
24
|
+
DEFAULT_TIMEOUT_MS: () => DEFAULT_TIMEOUT_MS,
|
|
25
|
+
HCAmsSDK: () => HCAmsSDK,
|
|
26
|
+
SDKError: () => SDKError,
|
|
27
|
+
SERVICE_NAME: () => SERVICE_NAME,
|
|
28
|
+
assertEnvironment: () => assertEnvironment,
|
|
29
|
+
assertTimeout: () => assertTimeout,
|
|
30
|
+
resolveBaseUrl: () => resolveBaseUrl
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(index_exports);
|
|
33
|
+
|
|
34
|
+
// src/config/SDKConfig.ts
|
|
35
|
+
var SERVICE_NAME = "ams";
|
|
36
|
+
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
37
|
+
function resolveBaseUrl(environment) {
|
|
38
|
+
const prefix = environment === "prod" ? "" : `${environment}-`;
|
|
39
|
+
return `https://${prefix}amsservices.health.cloud/api/ams`;
|
|
40
|
+
}
|
|
41
|
+
function assertEnvironment(environment) {
|
|
42
|
+
if (environment !== "dev" && environment !== "uat" && environment !== "prod") {
|
|
43
|
+
throw new Error(`Unsupported HealthCloud environment: "${environment}"`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function assertTimeout(timeout, label = "timeout") {
|
|
47
|
+
if (typeof timeout !== "number" || !Number.isFinite(timeout) || timeout <= 0) {
|
|
48
|
+
throw new Error(`Invalid HealthCloud SDK ${label}: expected a positive number of milliseconds, got ${String(timeout)}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/errors/SDKError.ts
|
|
53
|
+
var SDKError = class extends Error {
|
|
54
|
+
constructor(params) {
|
|
55
|
+
super(params.message);
|
|
56
|
+
this.name = "SDKError";
|
|
57
|
+
this.statusCode = params.statusCode;
|
|
58
|
+
this.response = params.response;
|
|
59
|
+
this.cause = params.cause;
|
|
60
|
+
}
|
|
61
|
+
toString() {
|
|
62
|
+
return `[SDKError ${this.statusCode}] ${this.message}`;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/http/HttpClient.ts
|
|
67
|
+
var HttpClient = class {
|
|
68
|
+
constructor(state) {
|
|
69
|
+
this.state = state;
|
|
70
|
+
}
|
|
71
|
+
async request(method, path, options = {}) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const url = this.buildUrl(path, options);
|
|
74
|
+
const headers = this.buildHeaders(options);
|
|
75
|
+
const init = { method, headers };
|
|
76
|
+
if (method !== "GET" && method !== "DELETE" && options.body !== void 0) {
|
|
77
|
+
init.body = this.serializeBody(options.body, headers);
|
|
78
|
+
}
|
|
79
|
+
const timeoutMs = (_b = (_a = options.timeoutMs) != null ? _a : this.state.timeout) != null ? _b : DEFAULT_TIMEOUT_MS;
|
|
80
|
+
assertTimeout(timeoutMs, options.timeoutMs !== void 0 ? "timeoutMs" : "timeout");
|
|
81
|
+
let didTimeout = false;
|
|
82
|
+
const controller = new AbortController();
|
|
83
|
+
init.signal = controller.signal;
|
|
84
|
+
const timer = setTimeout(() => {
|
|
85
|
+
didTimeout = true;
|
|
86
|
+
controller.abort();
|
|
87
|
+
}, timeoutMs);
|
|
88
|
+
let response;
|
|
89
|
+
let payload;
|
|
90
|
+
try {
|
|
91
|
+
response = await fetch(url, init);
|
|
92
|
+
payload = await this.parseResponse(response);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
if (didTimeout) {
|
|
95
|
+
throw new SDKError({
|
|
96
|
+
message: `Request timed out after ${timeoutMs}ms: ${method} ${path}`,
|
|
97
|
+
statusCode: 0,
|
|
98
|
+
cause: error
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (error instanceof SDKError) {
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
throw new SDKError({
|
|
105
|
+
message: error instanceof Error ? error.message : "Network request failed.",
|
|
106
|
+
statusCode: 0,
|
|
107
|
+
cause: error
|
|
108
|
+
});
|
|
109
|
+
} finally {
|
|
110
|
+
clearTimeout(timer);
|
|
111
|
+
}
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
throw new SDKError({
|
|
114
|
+
message: this.resolveErrorMessage(response, payload),
|
|
115
|
+
statusCode: response.status,
|
|
116
|
+
response: payload
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return payload;
|
|
120
|
+
}
|
|
121
|
+
buildHeaders(options) {
|
|
122
|
+
var _a;
|
|
123
|
+
const headers = {
|
|
124
|
+
Accept: "application/json",
|
|
125
|
+
...(_a = options.headers) != null ? _a : {}
|
|
126
|
+
};
|
|
127
|
+
if (options.auth !== false) {
|
|
128
|
+
if (!this.state.accessToken) {
|
|
129
|
+
throw new SDKError({
|
|
130
|
+
message: "Access token is required. Call sdk.setAccessToken(...).",
|
|
131
|
+
statusCode: 401
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
headers.Authorization = `Bearer ${this.state.accessToken}`;
|
|
135
|
+
}
|
|
136
|
+
return headers;
|
|
137
|
+
}
|
|
138
|
+
buildUrl(path, options) {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
const normalizedPath = this.resolvePath(path, (_a = options.pathParams) != null ? _a : {});
|
|
141
|
+
const base = (_b = this.state.baseUrlOverride) != null ? _b : resolveBaseUrl(this.state.environment);
|
|
142
|
+
const url = new URL(`${base}${normalizedPath}`);
|
|
143
|
+
if (options.query) {
|
|
144
|
+
for (const [key, value] of Object.entries(options.query)) {
|
|
145
|
+
this.appendQuery(url, key, value);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return url.toString();
|
|
149
|
+
}
|
|
150
|
+
resolvePath(path, pathParams) {
|
|
151
|
+
const withLeadingSlash = path.startsWith("/") ? path : `/${path}`;
|
|
152
|
+
return withLeadingSlash.replace(/\{([^}]+)\}/g, (_match, rawKey) => {
|
|
153
|
+
const value = pathParams[rawKey];
|
|
154
|
+
if (value === void 0 || value === null || value === "") {
|
|
155
|
+
throw new SDKError({
|
|
156
|
+
message: `Path parameter "${rawKey}" is required.`,
|
|
157
|
+
statusCode: 0
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return encodeURIComponent(String(value));
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
appendQuery(url, key, value) {
|
|
164
|
+
if (Array.isArray(value)) {
|
|
165
|
+
for (const item of value) {
|
|
166
|
+
this.appendQuery(url, key, item);
|
|
167
|
+
}
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (value !== void 0 && value !== null && value !== "") {
|
|
171
|
+
url.searchParams.append(key, String(value));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
serializeBody(body, headers) {
|
|
175
|
+
if (typeof body === "string") {
|
|
176
|
+
return body;
|
|
177
|
+
}
|
|
178
|
+
if (typeof URLSearchParams !== "undefined" && body instanceof URLSearchParams) {
|
|
179
|
+
return body;
|
|
180
|
+
}
|
|
181
|
+
if (typeof FormData !== "undefined" && body instanceof FormData) {
|
|
182
|
+
return body;
|
|
183
|
+
}
|
|
184
|
+
if (typeof Blob !== "undefined" && body instanceof Blob) {
|
|
185
|
+
return body;
|
|
186
|
+
}
|
|
187
|
+
if (typeof ArrayBuffer !== "undefined" && body instanceof ArrayBuffer) {
|
|
188
|
+
return body;
|
|
189
|
+
}
|
|
190
|
+
if (!this.hasHeader(headers, "Content-Type")) {
|
|
191
|
+
headers["Content-Type"] = "application/json";
|
|
192
|
+
}
|
|
193
|
+
return JSON.stringify(body);
|
|
194
|
+
}
|
|
195
|
+
async parseResponse(response) {
|
|
196
|
+
var _a;
|
|
197
|
+
if (response.status === 204) {
|
|
198
|
+
return void 0;
|
|
199
|
+
}
|
|
200
|
+
const text = await response.text();
|
|
201
|
+
if (!text) {
|
|
202
|
+
return void 0;
|
|
203
|
+
}
|
|
204
|
+
const contentType = (_a = response.headers.get("content-type")) != null ? _a : "";
|
|
205
|
+
if (contentType.includes("application/json") || text.startsWith("{") || text.startsWith("[")) {
|
|
206
|
+
try {
|
|
207
|
+
return JSON.parse(text);
|
|
208
|
+
} catch {
|
|
209
|
+
return text;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return text;
|
|
213
|
+
}
|
|
214
|
+
resolveErrorMessage(response, payload) {
|
|
215
|
+
const backendMessage = this.readMessage(payload);
|
|
216
|
+
if (backendMessage) {
|
|
217
|
+
return backendMessage;
|
|
218
|
+
}
|
|
219
|
+
return response.statusText || `HealthCloud API request failed with HTTP ${response.status}.`;
|
|
220
|
+
}
|
|
221
|
+
readMessage(payload) {
|
|
222
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
223
|
+
return void 0;
|
|
224
|
+
}
|
|
225
|
+
for (const key of ["message", "error", "ErrorMessage", "Message", "detail"]) {
|
|
226
|
+
const value = payload[key];
|
|
227
|
+
if (typeof value === "string" && value.trim()) {
|
|
228
|
+
return value;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return void 0;
|
|
232
|
+
}
|
|
233
|
+
hasHeader(headers, headerName) {
|
|
234
|
+
const normalized = headerName.toLowerCase();
|
|
235
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === normalized);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// src/clients/BaseServiceClient.ts
|
|
240
|
+
var BaseServiceClient = class {
|
|
241
|
+
constructor(http) {
|
|
242
|
+
this.http = http;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Low-level escape hatch — allows consumers to call any path without
|
|
246
|
+
* waiting for a typed SDK method to be added. The response shape is
|
|
247
|
+
* intentionally generic since this targets undocumented/future paths; the
|
|
248
|
+
* caller must supply `TResponse` once the path's contract is known.
|
|
249
|
+
*/
|
|
250
|
+
request(method, path, options = {}) {
|
|
251
|
+
return this.send(method, path, options);
|
|
252
|
+
}
|
|
253
|
+
send(method, path, options = {}) {
|
|
254
|
+
return this.http.request(method, path, options);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// src/clients/AmsClient.ts
|
|
259
|
+
var AmsClient = class extends BaseServiceClient {
|
|
260
|
+
constructor(http) {
|
|
261
|
+
super(http);
|
|
262
|
+
}
|
|
263
|
+
/** GET /application/agents/{tenant_id} (public; no access token required). */
|
|
264
|
+
getAgentsForTenant(tenantId) {
|
|
265
|
+
return this.send("GET", "/application/agents/{tenant_id}", {
|
|
266
|
+
pathParams: { tenant_id: tenantId },
|
|
267
|
+
auth: false
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
// src/HCAmsSDK.ts
|
|
273
|
+
var HCAmsSDK = class {
|
|
274
|
+
constructor(config) {
|
|
275
|
+
var _a, _b;
|
|
276
|
+
assertEnvironment(config.environment);
|
|
277
|
+
assertTimeout((_a = config.timeout) != null ? _a : DEFAULT_TIMEOUT_MS);
|
|
278
|
+
this.state = {
|
|
279
|
+
environment: config.environment,
|
|
280
|
+
tenantId: config.tenantId,
|
|
281
|
+
accessToken: config.accessToken,
|
|
282
|
+
baseUrlOverride: config.baseUrlOverride,
|
|
283
|
+
timeout: (_b = config.timeout) != null ? _b : DEFAULT_TIMEOUT_MS
|
|
284
|
+
};
|
|
285
|
+
this.http = new HttpClient(this.state);
|
|
286
|
+
this.ams = new AmsClient(this.http);
|
|
287
|
+
}
|
|
288
|
+
/** Get the current runtime environment. */
|
|
289
|
+
get environment() {
|
|
290
|
+
return this.state.environment;
|
|
291
|
+
}
|
|
292
|
+
/** Get the configured tenant ID. */
|
|
293
|
+
get tenantId() {
|
|
294
|
+
return this.state.tenantId;
|
|
295
|
+
}
|
|
296
|
+
/** Set or update the access token for authenticated requests. */
|
|
297
|
+
setAccessToken(token) {
|
|
298
|
+
this.state.accessToken = token;
|
|
299
|
+
}
|
|
300
|
+
/** Clear the current access token. */
|
|
301
|
+
clearAccessToken() {
|
|
302
|
+
this.state.accessToken = void 0;
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
306
|
+
0 && (module.exports = {
|
|
307
|
+
AmsClient,
|
|
308
|
+
DEFAULT_TIMEOUT_MS,
|
|
309
|
+
HCAmsSDK,
|
|
310
|
+
SDKError,
|
|
311
|
+
SERVICE_NAME,
|
|
312
|
+
assertEnvironment,
|
|
313
|
+
assertTimeout,
|
|
314
|
+
resolveBaseUrl
|
|
315
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
type Environment = "dev" | "uat" | "prod";
|
|
2
|
+
/** The AMS service name used for URL resolution. */
|
|
3
|
+
declare const SERVICE_NAME: "ams";
|
|
4
|
+
type AmsServiceName = typeof SERVICE_NAME;
|
|
5
|
+
interface AmsSDKConfig {
|
|
6
|
+
environment: Environment;
|
|
7
|
+
tenantId?: string;
|
|
8
|
+
accessToken?: string;
|
|
9
|
+
/** Overrides the resolved AMS base URL for this SDK instance. */
|
|
10
|
+
baseUrlOverride?: string;
|
|
11
|
+
/** Request timeout in milliseconds. Defaults to 30000 (30s). */
|
|
12
|
+
timeout?: number;
|
|
13
|
+
}
|
|
14
|
+
interface SDKRuntimeState {
|
|
15
|
+
environment: Environment;
|
|
16
|
+
tenantId?: string;
|
|
17
|
+
accessToken?: string;
|
|
18
|
+
baseUrlOverride?: string;
|
|
19
|
+
timeout: number;
|
|
20
|
+
}
|
|
21
|
+
declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
22
|
+
/**
|
|
23
|
+
* AMS Services hosts itself at `{env-}amsservices.health.cloud/api/ams`,
|
|
24
|
+
* unlike the `{env-}api-<service>.health.cloud` pattern other HealthCloud
|
|
25
|
+
* services use — mirrors `resolveBaseUrl` in packages/npm/src/config/SDKConfig.ts.
|
|
26
|
+
*/
|
|
27
|
+
declare function resolveBaseUrl(environment: Environment): string;
|
|
28
|
+
declare function assertEnvironment(environment: Environment): void;
|
|
29
|
+
declare function assertTimeout(timeout: number, label?: string): void;
|
|
30
|
+
|
|
31
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
32
|
+
type QueryParamPrimitive = string | number | boolean | null | undefined;
|
|
33
|
+
type QueryParamValue = QueryParamPrimitive | QueryParamPrimitive[];
|
|
34
|
+
type QueryParams = Record<string, QueryParamValue>;
|
|
35
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
36
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
37
|
+
interface JsonObject {
|
|
38
|
+
[key: string]: JsonValue;
|
|
39
|
+
}
|
|
40
|
+
type HttpRequestBody = JsonPrimitive | object | FormData | Blob | ArrayBuffer | URLSearchParams;
|
|
41
|
+
interface HttpRequestOptions {
|
|
42
|
+
pathParams?: Record<string, string | number>;
|
|
43
|
+
query?: QueryParams;
|
|
44
|
+
body?: HttpRequestBody;
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
auth?: boolean;
|
|
47
|
+
/** Overrides the SDK-configured timeout for this request. */
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare class HttpClient {
|
|
52
|
+
private readonly state;
|
|
53
|
+
constructor(state: SDKRuntimeState);
|
|
54
|
+
request<TResponse>(method: HttpMethod, path: string, options?: HttpRequestOptions): Promise<TResponse>;
|
|
55
|
+
private buildHeaders;
|
|
56
|
+
private buildUrl;
|
|
57
|
+
private resolvePath;
|
|
58
|
+
private appendQuery;
|
|
59
|
+
private serializeBody;
|
|
60
|
+
private parseResponse;
|
|
61
|
+
private resolveErrorMessage;
|
|
62
|
+
private readMessage;
|
|
63
|
+
private hasHeader;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Agent identifiers grouped by AMS category. The currently documented keys
|
|
68
|
+
* are `public` and `orchestrator`; the OpenAPI contract permits new groups.
|
|
69
|
+
*/
|
|
70
|
+
type AmsApplicationAgentsResponse = Record<string, string[]> & {
|
|
71
|
+
public?: string[];
|
|
72
|
+
orchestrator?: string[];
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
declare abstract class BaseServiceClient {
|
|
76
|
+
protected readonly http: HttpClient;
|
|
77
|
+
constructor(http: HttpClient);
|
|
78
|
+
/**
|
|
79
|
+
* Low-level escape hatch — allows consumers to call any path without
|
|
80
|
+
* waiting for a typed SDK method to be added. The response shape is
|
|
81
|
+
* intentionally generic since this targets undocumented/future paths; the
|
|
82
|
+
* caller must supply `TResponse` once the path's contract is known.
|
|
83
|
+
*/
|
|
84
|
+
request<TResponse = JsonValue | undefined>(method: HttpMethod, path: string, options?: HttpRequestOptions): Promise<TResponse>;
|
|
85
|
+
protected send<TResponse>(method: HttpMethod, path: string, options?: HttpRequestOptions): Promise<TResponse>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Public application-agent discovery methods hosted by AMS Services. */
|
|
89
|
+
declare class AmsClient extends BaseServiceClient {
|
|
90
|
+
constructor(http: HttpClient);
|
|
91
|
+
/** GET /application/agents/{tenant_id} (public; no access token required). */
|
|
92
|
+
getAgentsForTenant<TResponse = AmsApplicationAgentsResponse>(tenantId: string): Promise<TResponse>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare class HCAmsSDK {
|
|
96
|
+
private readonly state;
|
|
97
|
+
private readonly http;
|
|
98
|
+
/** AMS application-agent discovery. */
|
|
99
|
+
readonly ams: AmsClient;
|
|
100
|
+
constructor(config: AmsSDKConfig);
|
|
101
|
+
/** Get the current runtime environment. */
|
|
102
|
+
get environment(): string;
|
|
103
|
+
/** Get the configured tenant ID. */
|
|
104
|
+
get tenantId(): string | undefined;
|
|
105
|
+
/** Set or update the access token for authenticated requests. */
|
|
106
|
+
setAccessToken(token: string): void;
|
|
107
|
+
/** Clear the current access token. */
|
|
108
|
+
clearAccessToken(): void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare class SDKError extends Error {
|
|
112
|
+
readonly statusCode: number;
|
|
113
|
+
readonly response?: unknown;
|
|
114
|
+
readonly cause?: unknown;
|
|
115
|
+
constructor(params: {
|
|
116
|
+
message: string;
|
|
117
|
+
statusCode: number;
|
|
118
|
+
response?: unknown;
|
|
119
|
+
cause?: unknown;
|
|
120
|
+
});
|
|
121
|
+
toString(): string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { type AmsApplicationAgentsResponse, AmsClient, type AmsSDKConfig, type AmsServiceName, DEFAULT_TIMEOUT_MS, type Environment, HCAmsSDK, type HttpMethod, type HttpRequestBody, type HttpRequestOptions, type JsonObject, type JsonPrimitive, type JsonValue, type QueryParamPrimitive, type QueryParamValue, type QueryParams, SDKError, type SDKRuntimeState, SERVICE_NAME, assertEnvironment, assertTimeout, resolveBaseUrl };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
type Environment = "dev" | "uat" | "prod";
|
|
2
|
+
/** The AMS service name used for URL resolution. */
|
|
3
|
+
declare const SERVICE_NAME: "ams";
|
|
4
|
+
type AmsServiceName = typeof SERVICE_NAME;
|
|
5
|
+
interface AmsSDKConfig {
|
|
6
|
+
environment: Environment;
|
|
7
|
+
tenantId?: string;
|
|
8
|
+
accessToken?: string;
|
|
9
|
+
/** Overrides the resolved AMS base URL for this SDK instance. */
|
|
10
|
+
baseUrlOverride?: string;
|
|
11
|
+
/** Request timeout in milliseconds. Defaults to 30000 (30s). */
|
|
12
|
+
timeout?: number;
|
|
13
|
+
}
|
|
14
|
+
interface SDKRuntimeState {
|
|
15
|
+
environment: Environment;
|
|
16
|
+
tenantId?: string;
|
|
17
|
+
accessToken?: string;
|
|
18
|
+
baseUrlOverride?: string;
|
|
19
|
+
timeout: number;
|
|
20
|
+
}
|
|
21
|
+
declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
22
|
+
/**
|
|
23
|
+
* AMS Services hosts itself at `{env-}amsservices.health.cloud/api/ams`,
|
|
24
|
+
* unlike the `{env-}api-<service>.health.cloud` pattern other HealthCloud
|
|
25
|
+
* services use — mirrors `resolveBaseUrl` in packages/npm/src/config/SDKConfig.ts.
|
|
26
|
+
*/
|
|
27
|
+
declare function resolveBaseUrl(environment: Environment): string;
|
|
28
|
+
declare function assertEnvironment(environment: Environment): void;
|
|
29
|
+
declare function assertTimeout(timeout: number, label?: string): void;
|
|
30
|
+
|
|
31
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
32
|
+
type QueryParamPrimitive = string | number | boolean | null | undefined;
|
|
33
|
+
type QueryParamValue = QueryParamPrimitive | QueryParamPrimitive[];
|
|
34
|
+
type QueryParams = Record<string, QueryParamValue>;
|
|
35
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
36
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
37
|
+
interface JsonObject {
|
|
38
|
+
[key: string]: JsonValue;
|
|
39
|
+
}
|
|
40
|
+
type HttpRequestBody = JsonPrimitive | object | FormData | Blob | ArrayBuffer | URLSearchParams;
|
|
41
|
+
interface HttpRequestOptions {
|
|
42
|
+
pathParams?: Record<string, string | number>;
|
|
43
|
+
query?: QueryParams;
|
|
44
|
+
body?: HttpRequestBody;
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
auth?: boolean;
|
|
47
|
+
/** Overrides the SDK-configured timeout for this request. */
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare class HttpClient {
|
|
52
|
+
private readonly state;
|
|
53
|
+
constructor(state: SDKRuntimeState);
|
|
54
|
+
request<TResponse>(method: HttpMethod, path: string, options?: HttpRequestOptions): Promise<TResponse>;
|
|
55
|
+
private buildHeaders;
|
|
56
|
+
private buildUrl;
|
|
57
|
+
private resolvePath;
|
|
58
|
+
private appendQuery;
|
|
59
|
+
private serializeBody;
|
|
60
|
+
private parseResponse;
|
|
61
|
+
private resolveErrorMessage;
|
|
62
|
+
private readMessage;
|
|
63
|
+
private hasHeader;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Agent identifiers grouped by AMS category. The currently documented keys
|
|
68
|
+
* are `public` and `orchestrator`; the OpenAPI contract permits new groups.
|
|
69
|
+
*/
|
|
70
|
+
type AmsApplicationAgentsResponse = Record<string, string[]> & {
|
|
71
|
+
public?: string[];
|
|
72
|
+
orchestrator?: string[];
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
declare abstract class BaseServiceClient {
|
|
76
|
+
protected readonly http: HttpClient;
|
|
77
|
+
constructor(http: HttpClient);
|
|
78
|
+
/**
|
|
79
|
+
* Low-level escape hatch — allows consumers to call any path without
|
|
80
|
+
* waiting for a typed SDK method to be added. The response shape is
|
|
81
|
+
* intentionally generic since this targets undocumented/future paths; the
|
|
82
|
+
* caller must supply `TResponse` once the path's contract is known.
|
|
83
|
+
*/
|
|
84
|
+
request<TResponse = JsonValue | undefined>(method: HttpMethod, path: string, options?: HttpRequestOptions): Promise<TResponse>;
|
|
85
|
+
protected send<TResponse>(method: HttpMethod, path: string, options?: HttpRequestOptions): Promise<TResponse>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Public application-agent discovery methods hosted by AMS Services. */
|
|
89
|
+
declare class AmsClient extends BaseServiceClient {
|
|
90
|
+
constructor(http: HttpClient);
|
|
91
|
+
/** GET /application/agents/{tenant_id} (public; no access token required). */
|
|
92
|
+
getAgentsForTenant<TResponse = AmsApplicationAgentsResponse>(tenantId: string): Promise<TResponse>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare class HCAmsSDK {
|
|
96
|
+
private readonly state;
|
|
97
|
+
private readonly http;
|
|
98
|
+
/** AMS application-agent discovery. */
|
|
99
|
+
readonly ams: AmsClient;
|
|
100
|
+
constructor(config: AmsSDKConfig);
|
|
101
|
+
/** Get the current runtime environment. */
|
|
102
|
+
get environment(): string;
|
|
103
|
+
/** Get the configured tenant ID. */
|
|
104
|
+
get tenantId(): string | undefined;
|
|
105
|
+
/** Set or update the access token for authenticated requests. */
|
|
106
|
+
setAccessToken(token: string): void;
|
|
107
|
+
/** Clear the current access token. */
|
|
108
|
+
clearAccessToken(): void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare class SDKError extends Error {
|
|
112
|
+
readonly statusCode: number;
|
|
113
|
+
readonly response?: unknown;
|
|
114
|
+
readonly cause?: unknown;
|
|
115
|
+
constructor(params: {
|
|
116
|
+
message: string;
|
|
117
|
+
statusCode: number;
|
|
118
|
+
response?: unknown;
|
|
119
|
+
cause?: unknown;
|
|
120
|
+
});
|
|
121
|
+
toString(): string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { type AmsApplicationAgentsResponse, AmsClient, type AmsSDKConfig, type AmsServiceName, DEFAULT_TIMEOUT_MS, type Environment, HCAmsSDK, type HttpMethod, type HttpRequestBody, type HttpRequestOptions, type JsonObject, type JsonPrimitive, type JsonValue, type QueryParamPrimitive, type QueryParamValue, type QueryParams, SDKError, type SDKRuntimeState, SERVICE_NAME, assertEnvironment, assertTimeout, resolveBaseUrl };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// src/config/SDKConfig.ts
|
|
2
|
+
var SERVICE_NAME = "ams";
|
|
3
|
+
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
4
|
+
function resolveBaseUrl(environment) {
|
|
5
|
+
const prefix = environment === "prod" ? "" : `${environment}-`;
|
|
6
|
+
return `https://${prefix}amsservices.health.cloud/api/ams`;
|
|
7
|
+
}
|
|
8
|
+
function assertEnvironment(environment) {
|
|
9
|
+
if (environment !== "dev" && environment !== "uat" && environment !== "prod") {
|
|
10
|
+
throw new Error(`Unsupported HealthCloud environment: "${environment}"`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function assertTimeout(timeout, label = "timeout") {
|
|
14
|
+
if (typeof timeout !== "number" || !Number.isFinite(timeout) || timeout <= 0) {
|
|
15
|
+
throw new Error(`Invalid HealthCloud SDK ${label}: expected a positive number of milliseconds, got ${String(timeout)}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/errors/SDKError.ts
|
|
20
|
+
var SDKError = class extends Error {
|
|
21
|
+
constructor(params) {
|
|
22
|
+
super(params.message);
|
|
23
|
+
this.name = "SDKError";
|
|
24
|
+
this.statusCode = params.statusCode;
|
|
25
|
+
this.response = params.response;
|
|
26
|
+
this.cause = params.cause;
|
|
27
|
+
}
|
|
28
|
+
toString() {
|
|
29
|
+
return `[SDKError ${this.statusCode}] ${this.message}`;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/http/HttpClient.ts
|
|
34
|
+
var HttpClient = class {
|
|
35
|
+
constructor(state) {
|
|
36
|
+
this.state = state;
|
|
37
|
+
}
|
|
38
|
+
async request(method, path, options = {}) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const url = this.buildUrl(path, options);
|
|
41
|
+
const headers = this.buildHeaders(options);
|
|
42
|
+
const init = { method, headers };
|
|
43
|
+
if (method !== "GET" && method !== "DELETE" && options.body !== void 0) {
|
|
44
|
+
init.body = this.serializeBody(options.body, headers);
|
|
45
|
+
}
|
|
46
|
+
const timeoutMs = (_b = (_a = options.timeoutMs) != null ? _a : this.state.timeout) != null ? _b : DEFAULT_TIMEOUT_MS;
|
|
47
|
+
assertTimeout(timeoutMs, options.timeoutMs !== void 0 ? "timeoutMs" : "timeout");
|
|
48
|
+
let didTimeout = false;
|
|
49
|
+
const controller = new AbortController();
|
|
50
|
+
init.signal = controller.signal;
|
|
51
|
+
const timer = setTimeout(() => {
|
|
52
|
+
didTimeout = true;
|
|
53
|
+
controller.abort();
|
|
54
|
+
}, timeoutMs);
|
|
55
|
+
let response;
|
|
56
|
+
let payload;
|
|
57
|
+
try {
|
|
58
|
+
response = await fetch(url, init);
|
|
59
|
+
payload = await this.parseResponse(response);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (didTimeout) {
|
|
62
|
+
throw new SDKError({
|
|
63
|
+
message: `Request timed out after ${timeoutMs}ms: ${method} ${path}`,
|
|
64
|
+
statusCode: 0,
|
|
65
|
+
cause: error
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (error instanceof SDKError) {
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
throw new SDKError({
|
|
72
|
+
message: error instanceof Error ? error.message : "Network request failed.",
|
|
73
|
+
statusCode: 0,
|
|
74
|
+
cause: error
|
|
75
|
+
});
|
|
76
|
+
} finally {
|
|
77
|
+
clearTimeout(timer);
|
|
78
|
+
}
|
|
79
|
+
if (!response.ok) {
|
|
80
|
+
throw new SDKError({
|
|
81
|
+
message: this.resolveErrorMessage(response, payload),
|
|
82
|
+
statusCode: response.status,
|
|
83
|
+
response: payload
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return payload;
|
|
87
|
+
}
|
|
88
|
+
buildHeaders(options) {
|
|
89
|
+
var _a;
|
|
90
|
+
const headers = {
|
|
91
|
+
Accept: "application/json",
|
|
92
|
+
...(_a = options.headers) != null ? _a : {}
|
|
93
|
+
};
|
|
94
|
+
if (options.auth !== false) {
|
|
95
|
+
if (!this.state.accessToken) {
|
|
96
|
+
throw new SDKError({
|
|
97
|
+
message: "Access token is required. Call sdk.setAccessToken(...).",
|
|
98
|
+
statusCode: 401
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
headers.Authorization = `Bearer ${this.state.accessToken}`;
|
|
102
|
+
}
|
|
103
|
+
return headers;
|
|
104
|
+
}
|
|
105
|
+
buildUrl(path, options) {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
const normalizedPath = this.resolvePath(path, (_a = options.pathParams) != null ? _a : {});
|
|
108
|
+
const base = (_b = this.state.baseUrlOverride) != null ? _b : resolveBaseUrl(this.state.environment);
|
|
109
|
+
const url = new URL(`${base}${normalizedPath}`);
|
|
110
|
+
if (options.query) {
|
|
111
|
+
for (const [key, value] of Object.entries(options.query)) {
|
|
112
|
+
this.appendQuery(url, key, value);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return url.toString();
|
|
116
|
+
}
|
|
117
|
+
resolvePath(path, pathParams) {
|
|
118
|
+
const withLeadingSlash = path.startsWith("/") ? path : `/${path}`;
|
|
119
|
+
return withLeadingSlash.replace(/\{([^}]+)\}/g, (_match, rawKey) => {
|
|
120
|
+
const value = pathParams[rawKey];
|
|
121
|
+
if (value === void 0 || value === null || value === "") {
|
|
122
|
+
throw new SDKError({
|
|
123
|
+
message: `Path parameter "${rawKey}" is required.`,
|
|
124
|
+
statusCode: 0
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return encodeURIComponent(String(value));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
appendQuery(url, key, value) {
|
|
131
|
+
if (Array.isArray(value)) {
|
|
132
|
+
for (const item of value) {
|
|
133
|
+
this.appendQuery(url, key, item);
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (value !== void 0 && value !== null && value !== "") {
|
|
138
|
+
url.searchParams.append(key, String(value));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
serializeBody(body, headers) {
|
|
142
|
+
if (typeof body === "string") {
|
|
143
|
+
return body;
|
|
144
|
+
}
|
|
145
|
+
if (typeof URLSearchParams !== "undefined" && body instanceof URLSearchParams) {
|
|
146
|
+
return body;
|
|
147
|
+
}
|
|
148
|
+
if (typeof FormData !== "undefined" && body instanceof FormData) {
|
|
149
|
+
return body;
|
|
150
|
+
}
|
|
151
|
+
if (typeof Blob !== "undefined" && body instanceof Blob) {
|
|
152
|
+
return body;
|
|
153
|
+
}
|
|
154
|
+
if (typeof ArrayBuffer !== "undefined" && body instanceof ArrayBuffer) {
|
|
155
|
+
return body;
|
|
156
|
+
}
|
|
157
|
+
if (!this.hasHeader(headers, "Content-Type")) {
|
|
158
|
+
headers["Content-Type"] = "application/json";
|
|
159
|
+
}
|
|
160
|
+
return JSON.stringify(body);
|
|
161
|
+
}
|
|
162
|
+
async parseResponse(response) {
|
|
163
|
+
var _a;
|
|
164
|
+
if (response.status === 204) {
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
const text = await response.text();
|
|
168
|
+
if (!text) {
|
|
169
|
+
return void 0;
|
|
170
|
+
}
|
|
171
|
+
const contentType = (_a = response.headers.get("content-type")) != null ? _a : "";
|
|
172
|
+
if (contentType.includes("application/json") || text.startsWith("{") || text.startsWith("[")) {
|
|
173
|
+
try {
|
|
174
|
+
return JSON.parse(text);
|
|
175
|
+
} catch {
|
|
176
|
+
return text;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return text;
|
|
180
|
+
}
|
|
181
|
+
resolveErrorMessage(response, payload) {
|
|
182
|
+
const backendMessage = this.readMessage(payload);
|
|
183
|
+
if (backendMessage) {
|
|
184
|
+
return backendMessage;
|
|
185
|
+
}
|
|
186
|
+
return response.statusText || `HealthCloud API request failed with HTTP ${response.status}.`;
|
|
187
|
+
}
|
|
188
|
+
readMessage(payload) {
|
|
189
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
190
|
+
return void 0;
|
|
191
|
+
}
|
|
192
|
+
for (const key of ["message", "error", "ErrorMessage", "Message", "detail"]) {
|
|
193
|
+
const value = payload[key];
|
|
194
|
+
if (typeof value === "string" && value.trim()) {
|
|
195
|
+
return value;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return void 0;
|
|
199
|
+
}
|
|
200
|
+
hasHeader(headers, headerName) {
|
|
201
|
+
const normalized = headerName.toLowerCase();
|
|
202
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === normalized);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// src/clients/BaseServiceClient.ts
|
|
207
|
+
var BaseServiceClient = class {
|
|
208
|
+
constructor(http) {
|
|
209
|
+
this.http = http;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Low-level escape hatch — allows consumers to call any path without
|
|
213
|
+
* waiting for a typed SDK method to be added. The response shape is
|
|
214
|
+
* intentionally generic since this targets undocumented/future paths; the
|
|
215
|
+
* caller must supply `TResponse` once the path's contract is known.
|
|
216
|
+
*/
|
|
217
|
+
request(method, path, options = {}) {
|
|
218
|
+
return this.send(method, path, options);
|
|
219
|
+
}
|
|
220
|
+
send(method, path, options = {}) {
|
|
221
|
+
return this.http.request(method, path, options);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// src/clients/AmsClient.ts
|
|
226
|
+
var AmsClient = class extends BaseServiceClient {
|
|
227
|
+
constructor(http) {
|
|
228
|
+
super(http);
|
|
229
|
+
}
|
|
230
|
+
/** GET /application/agents/{tenant_id} (public; no access token required). */
|
|
231
|
+
getAgentsForTenant(tenantId) {
|
|
232
|
+
return this.send("GET", "/application/agents/{tenant_id}", {
|
|
233
|
+
pathParams: { tenant_id: tenantId },
|
|
234
|
+
auth: false
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// src/HCAmsSDK.ts
|
|
240
|
+
var HCAmsSDK = class {
|
|
241
|
+
constructor(config) {
|
|
242
|
+
var _a, _b;
|
|
243
|
+
assertEnvironment(config.environment);
|
|
244
|
+
assertTimeout((_a = config.timeout) != null ? _a : DEFAULT_TIMEOUT_MS);
|
|
245
|
+
this.state = {
|
|
246
|
+
environment: config.environment,
|
|
247
|
+
tenantId: config.tenantId,
|
|
248
|
+
accessToken: config.accessToken,
|
|
249
|
+
baseUrlOverride: config.baseUrlOverride,
|
|
250
|
+
timeout: (_b = config.timeout) != null ? _b : DEFAULT_TIMEOUT_MS
|
|
251
|
+
};
|
|
252
|
+
this.http = new HttpClient(this.state);
|
|
253
|
+
this.ams = new AmsClient(this.http);
|
|
254
|
+
}
|
|
255
|
+
/** Get the current runtime environment. */
|
|
256
|
+
get environment() {
|
|
257
|
+
return this.state.environment;
|
|
258
|
+
}
|
|
259
|
+
/** Get the configured tenant ID. */
|
|
260
|
+
get tenantId() {
|
|
261
|
+
return this.state.tenantId;
|
|
262
|
+
}
|
|
263
|
+
/** Set or update the access token for authenticated requests. */
|
|
264
|
+
setAccessToken(token) {
|
|
265
|
+
this.state.accessToken = token;
|
|
266
|
+
}
|
|
267
|
+
/** Clear the current access token. */
|
|
268
|
+
clearAccessToken() {
|
|
269
|
+
this.state.accessToken = void 0;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
export {
|
|
273
|
+
AmsClient,
|
|
274
|
+
DEFAULT_TIMEOUT_MS,
|
|
275
|
+
HCAmsSDK,
|
|
276
|
+
SDKError,
|
|
277
|
+
SERVICE_NAME,
|
|
278
|
+
assertEnvironment,
|
|
279
|
+
assertTimeout,
|
|
280
|
+
resolveBaseUrl
|
|
281
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@healthcloudai/hc-ams",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "HealthCloud AMS SDK — application-agent discovery for AMS Services.",
|
|
5
|
+
"author": "Healthcheck Systems Inc",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/healthcloudservices/healthcloud-sdk.git",
|
|
10
|
+
"directory": "packages/npm-ams"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"health-cloud",
|
|
14
|
+
"healthcloud",
|
|
15
|
+
"ams",
|
|
16
|
+
"agents",
|
|
17
|
+
"typescript",
|
|
18
|
+
"sdk"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "dist/index.cjs",
|
|
22
|
+
"module": "dist/index.js",
|
|
23
|
+
"types": "dist/index.d.ts",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"registry": "https://registry.npmjs.org"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"require": "./dist/index.cjs"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
40
|
+
"dev": "tsup src/index.ts --watch",
|
|
41
|
+
"lint": "eslint src",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"test:watch": "vitest",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@eslint/js": "^10.0.1",
|
|
49
|
+
"@types/node": "^24.0.0",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^8.70.0",
|
|
51
|
+
"@typescript-eslint/parser": "^8.70.0",
|
|
52
|
+
"eslint": "^10.11.0",
|
|
53
|
+
"tsup": "^8.0.0",
|
|
54
|
+
"tsx": "^4.23.13",
|
|
55
|
+
"typescript": "^5.3.0",
|
|
56
|
+
"vitest": "^5.0.0"
|
|
57
|
+
}
|
|
58
|
+
}
|