attlaz-client 1.57.0 → 1.58.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.
@@ -9,6 +9,15 @@ export declare class RunnerPool {
9
9
  configuration: RunnerPoolConfiguration;
10
10
  state: State;
11
11
  static parse(raw: any): RunnerPool;
12
+ /**
13
+ * Coerce a raw wire value into a ResolvedValue<T> envelope. Accepts `{value, source}`
14
+ * as-is; falls back to `{value: defaultValue, source: null}` when the input is null,
15
+ * undefined, or missing the envelope shape, and appends the field name to `missing`
16
+ * so the caller can log a single batched warning. The `value` itself isn't type-
17
+ * validated — if T is `string | null` and the server sends a number, that's a
18
+ * server-side bug, not something this layer can fix.
19
+ */
20
+ private static parseResolved;
12
21
  }
13
22
  export type QueueSpecificationType = 'flow_run';
14
23
  export type ConfigurationSource = 'RunnerPool' | 'ProjectEnvironment' | 'Workspace' | 'Zone';
@@ -30,19 +30,48 @@ export class RunnerPool {
30
30
  queueSpecification.queueIdentifier = raw.queue_identifier;
31
31
  queueSpecification.deploymentIdentifier = raw.deployment_identifier;
32
32
  queueSpecification.type = raw.type;
33
+ // Per-field defensive parsing. Each entry falls back to a default ResolvedValue
34
+ // if the server didn't send it or sent a malformed shape — keeps the UI alive
35
+ // when wire contracts drift (e.g. the API auto-strips `_id` so `image_id` arrives
36
+ // as `image`; we hit that 2026-05-17). Missing/malformed fields are collected and
37
+ // logged together as a single console.warn so server-side regressions stay visible.
38
+ const config = raw.configuration ?? {};
39
+ const missing = [];
40
+ if (raw.configuration === undefined || raw.configuration === null) {
41
+ missing.push('(entire configuration object)');
42
+ }
33
43
  queueSpecification.configuration = {
34
- enabled: raw.configuration.enabled,
35
- minRunners: raw.configuration.min_runners,
36
- maxRunners: raw.configuration.max_runners,
37
- cpuLimit: raw.configuration.cpu_limit,
38
- memoryLimit: raw.configuration.memory_limit,
39
- imageId: raw.configuration.image_id,
40
- runnerEndpoint: raw.configuration.runner_endpoint,
41
- runnerTokenId: raw.configuration.runner_token,
42
- codeEndpoint: raw.configuration.code_endpoint,
43
- codeTokenId: raw.configuration.code_token,
44
+ enabled: RunnerPool.parseResolved(config.enabled, false, 'enabled', missing),
45
+ minRunners: RunnerPool.parseResolved(config.min_runners, 0, 'min_runners', missing),
46
+ maxRunners: RunnerPool.parseResolved(config.max_runners, 0, 'max_runners', missing),
47
+ cpuLimit: RunnerPool.parseResolved(config.cpu_limit, null, 'cpu_limit', missing),
48
+ memoryLimit: RunnerPool.parseResolved(config.memory_limit, null, 'memory_limit', missing),
49
+ // API strips `_id` suffix from snake_case keys, so `image_id` → `image` on the wire.
50
+ imageId: RunnerPool.parseResolved(config.image, null, 'image', missing),
51
+ runnerEndpoint: RunnerPool.parseResolved(config.runner_endpoint, null, 'runner_endpoint', missing),
52
+ runnerTokenId: RunnerPool.parseResolved(config.runner_token, null, 'runner_token', missing),
53
+ codeEndpoint: RunnerPool.parseResolved(config.code_endpoint, null, 'code_endpoint', missing),
54
+ codeTokenId: RunnerPool.parseResolved(config.code_token, null, 'code_token', missing),
44
55
  };
56
+ if (missing.length > 0) {
57
+ console.warn('RunnerPool.parse: pool "' + queueSpecification.id + '" has missing or malformed configuration fields', { fields: missing });
58
+ }
45
59
  queueSpecification.state = State.fromString(raw.state);
46
60
  return queueSpecification;
47
61
  }
62
+ /**
63
+ * Coerce a raw wire value into a ResolvedValue<T> envelope. Accepts `{value, source}`
64
+ * as-is; falls back to `{value: defaultValue, source: null}` when the input is null,
65
+ * undefined, or missing the envelope shape, and appends the field name to `missing`
66
+ * so the caller can log a single batched warning. The `value` itself isn't type-
67
+ * validated — if T is `string | null` and the server sends a number, that's a
68
+ * server-side bug, not something this layer can fix.
69
+ */
70
+ static parseResolved(raw, defaultValue, fieldName, missing) {
71
+ if (raw !== null && typeof raw === 'object' && 'value' in raw && 'source' in raw) {
72
+ return raw;
73
+ }
74
+ missing.push(fieldName);
75
+ return { value: defaultValue, source: null };
76
+ }
48
77
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.56.0";
1
+ export declare const VERSION = "1.58.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.56.0";
1
+ export const VERSION = "1.58.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.57.0",
3
+ "version": "1.58.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "@typescript-eslint/eslint-plugin": "^8.1.0",
55
55
  "@typescript-eslint/parser": "^8.1.0",
56
56
  "eslint": "^9.39.4",
57
- "eslint-config-attlaz-base": "^1.6.0",
57
+ "eslint-config-attlaz-base": "^1.7.1",
58
58
  "eslint-import-resolver-typescript": "^4.4.4",
59
59
  "eslint-plugin-import": "^2.32.0",
60
60
  "eslint-plugin-jsdoc": "^62.9.0",