@attlaz/client 1.123.0 → 1.126.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.
@@ -17,9 +17,16 @@ export declare class CrawlJob {
17
17
  * it never looked for most products, so its silence about them proves nothing.
18
18
  */
19
19
  isPartial: boolean;
20
- /** Progress (populated by list endpoints): total pages and how many have been processed. */
20
+ /**
21
+ * Progress (populated by list endpoints): total pages and how many reached a terminal state.
22
+ *
23
+ * `failed` is part of `processed`, not separate from it — a finished crawl has
24
+ * `processed === total` whether or not pages failed, so `failed > 0` is the only thing that
25
+ * distinguishes a crawl that lost pages from a clean one.
26
+ */
21
27
  total: number;
22
28
  processed: number;
29
+ failed: number;
23
30
  constructor(id: string, vendorId: string);
24
31
  static parse(raw: ApiRecord): CrawlJob;
25
32
  }
@@ -15,9 +15,16 @@ export class CrawlJob {
15
15
  * it never looked for most products, so its silence about them proves nothing.
16
16
  */
17
17
  isPartial = false;
18
- /** Progress (populated by list endpoints): total pages and how many have been processed. */
18
+ /**
19
+ * Progress (populated by list endpoints): total pages and how many reached a terminal state.
20
+ *
21
+ * `failed` is part of `processed`, not separate from it — a finished crawl has
22
+ * `processed === total` whether or not pages failed, so `failed > 0` is the only thing that
23
+ * distinguishes a crawl that lost pages from a clean one.
24
+ */
19
25
  total = 0;
20
26
  processed = 0;
27
+ failed = 0;
21
28
  constructor(id, vendorId) {
22
29
  this.id = id;
23
30
  this.vendorId = vendorId;
@@ -35,6 +42,7 @@ export class CrawlJob {
35
42
  job.isPartial = raw.is_partial === true;
36
43
  job.total = Number(raw.total ?? 0);
37
44
  job.processed = Number(raw.processed ?? 0);
45
+ job.failed = Number(raw.failed ?? 0);
38
46
  return job;
39
47
  }
40
48
  }
@@ -1,6 +1,24 @@
1
+ /**
2
+ * Our vocabulary, not RabbitMQ's — `rabbit_state` carries what it actually said. Keeping the union
3
+ * small is what lets a consumer switch on it exhaustively; keeping the raw value is what stops the
4
+ * mapping from losing information.
5
+ */
6
+ export type QueueState =
7
+ /** The queue exists and is serving. RabbitMQ's running, idle and flow all land here. */
8
+ 'running'
9
+ /** The queue exists but RabbitMQ reports it as down, crashed, stopped, minority or terminated. */
10
+ | 'degraded'
11
+ /** The queue exists and RabbitMQ reported a state we don't recognise. See `rabbit_state`. */
12
+ | 'unknown'
13
+ /** RabbitMQ answered, and there is no such queue. */
14
+ | 'nonexisting'
15
+ /** We could not ask RabbitMQ, or could not read its answer. Not the same as nonexisting. */
16
+ | 'unreachable';
1
17
  export declare class QueueStatus {
2
18
  name: string;
3
- state: 'nonexisting' | 'running';
19
+ state: QueueState;
20
+ /** Verbatim RabbitMQ state; null when it never answered. */
21
+ rabbit_state: string | null;
4
22
  vhost: string;
5
23
  messages_ready: number;
6
24
  messages_handling: number;
@@ -1,6 +1,8 @@
1
1
  export class QueueStatus {
2
2
  name;
3
3
  state;
4
+ /** Verbatim RabbitMQ state; null when it never answered. */
5
+ rabbit_state = null;
4
6
  vhost;
5
7
  messages_ready = 0;
6
8
  messages_handling = 0;
@@ -11,11 +11,15 @@ export declare class CodeDeploy {
11
11
  started: Date | null;
12
12
  finished: Date | null;
13
13
  status: CodeDeployStatus;
14
- archiveChecksum: string | null;
15
- archiveType: string | null;
16
- archiveSize: number | null;
17
- checksum: string | null;
18
- size: number | null;
14
+ /** The deliverable — the archive today, possibly an image later. */
15
+ artifactChecksum: string | null;
16
+ artifactFormat: string | null;
17
+ artifactSize: number | null;
18
+ /** Null while the artifact is still served; set once it is withdrawn. */
19
+ artifactRetiredAt: Date | null;
20
+ /** The built directory the artifact was made from. */
21
+ buildChecksum: string | null;
22
+ buildSize: number | null;
19
23
  storageBucketId: string | null;
20
24
  storageItemId: string | null;
21
25
  commits: ProjectDeployCommit[];
@@ -11,11 +11,15 @@ export class CodeDeploy {
11
11
  started = null;
12
12
  finished = null;
13
13
  status = CodeDeployStatus.Unknown;
14
- archiveChecksum = null;
15
- archiveType = null;
16
- archiveSize = null;
17
- checksum = null;
18
- size = null;
14
+ /** The deliverable — the archive today, possibly an image later. */
15
+ artifactChecksum = null;
16
+ artifactFormat = null;
17
+ artifactSize = null;
18
+ /** Null while the artifact is still served; set once it is withdrawn. */
19
+ artifactRetiredAt = null;
20
+ /** The built directory the artifact was made from. */
21
+ buildChecksum = null;
22
+ buildSize = null;
19
23
  storageBucketId = null;
20
24
  storageItemId = null;
21
25
  commits = [];
@@ -33,11 +37,14 @@ export class CodeDeploy {
33
37
  projectDeploy.started = rawCodeDeploy.started === null ? null : Utils.parseRawDate(rawCodeDeploy.started);
34
38
  projectDeploy.finished = rawCodeDeploy.finished === null ? null : Utils.parseRawDate(rawCodeDeploy.finished);
35
39
  projectDeploy.status = CodeDeployStatus.fromString(rawCodeDeploy.status);
36
- projectDeploy.archiveChecksum = rawCodeDeploy.archive_checksum;
37
- projectDeploy.archiveType = rawCodeDeploy.archive_type;
38
- projectDeploy.archiveSize = rawCodeDeploy.archive_size === null ? null : Utils.parseInt(rawCodeDeploy.archive_size);
39
- projectDeploy.checksum = rawCodeDeploy.checksum;
40
- projectDeploy.size = rawCodeDeploy.size === null ? null : Utils.parseInt(rawCodeDeploy.size);
40
+ projectDeploy.artifactChecksum = rawCodeDeploy.artifact_checksum;
41
+ projectDeploy.artifactFormat = rawCodeDeploy.artifact_format;
42
+ const rawArtifactSize = rawCodeDeploy.artifact_size;
43
+ projectDeploy.artifactSize = rawArtifactSize === null || rawArtifactSize === undefined ? null : Utils.parseInt(rawArtifactSize);
44
+ projectDeploy.artifactRetiredAt = rawCodeDeploy.artifact_retired_at === null || rawCodeDeploy.artifact_retired_at === undefined ? null : new Date(rawCodeDeploy.artifact_retired_at);
45
+ projectDeploy.buildChecksum = rawCodeDeploy.build_checksum;
46
+ const rawBuildSize = rawCodeDeploy.build_size;
47
+ projectDeploy.buildSize = rawBuildSize === null || rawBuildSize === undefined ? null : Utils.parseInt(rawBuildSize);
41
48
  projectDeploy.storageBucketId = rawCodeDeploy.storage_bucket;
42
49
  projectDeploy.storageItemId = rawCodeDeploy.storage_item;
43
50
  projectDeploy.commitHash = rawCodeDeploy.commit_hash;
@@ -12,5 +12,10 @@ export declare class SourcesAccountEndpoint extends Endpoint {
12
12
  getCodeSourceById(codeSourceId: string): Promise<CodeSource | null>;
13
13
  getRepositories(codeSourceAccountId: string, pagination?: CursorPagination | null): Promise<CollectionResult<SourcesAccountRepository>>;
14
14
  getRepositoryBranches(codeSourceAccountId: string, repositoryKey: string, pagination?: CursorPagination | null): Promise<CollectionResult<SourcesAccountRepositoryBranch>>;
15
+ /**
16
+ * Create an unconnected code source account. Connecting it — attaching a provider token — is a
17
+ * separate step against the created account.
18
+ */
19
+ createCodeSourceAccount(workspaceId: string, type: string): Promise<CodeSourceAccount>;
15
20
  saveCodeSource(codeSource: CodeSource): Promise<CodeSource>;
16
21
  }
@@ -66,6 +66,29 @@ export class SourcesAccountEndpoint extends Endpoint {
66
66
  const rawBranches = await this.requestCollection(queryString, SourcesAccountRepositoryBranch.parse);
67
67
  return rawBranches;
68
68
  }
69
+ /**
70
+ * Create an unconnected code source account. Connecting it — attaching a provider token — is a
71
+ * separate step against the created account.
72
+ */
73
+ async createCodeSourceAccount(workspaceId, type) {
74
+ try {
75
+ const result = await this.requestObject('/codesourceaccounts/', {
76
+ workspace: workspaceId,
77
+ type: type,
78
+ }, CodeSourceAccount.parse, 'POST');
79
+ const createdCodeSourceAccount = result.getData();
80
+ if (createdCodeSourceAccount === null) {
81
+ throw new Error('Unable to create code source account: wrong response from API');
82
+ }
83
+ return createdCodeSourceAccount;
84
+ }
85
+ catch (ex) {
86
+ if (this.httpClient.isDebugEnabled()) {
87
+ console.error('Failed to create code source account: ', ex);
88
+ }
89
+ throw ex;
90
+ }
91
+ }
69
92
  async saveCodeSource(codeSource) {
70
93
  try {
71
94
  const url = '/codesources/';
package/dist/index.d.ts CHANGED
@@ -194,7 +194,7 @@ export { DataValueCollection } from './Model/DataValueCollection.js';
194
194
  export { EntityType } from './Model/EntityType.js';
195
195
  export { InboxMessage } from './Model/Inbox/InboxMessage.js';
196
196
  /** Infrastructure Status **/
197
- export { QueueStatus } from './Model/InfrastructureStatus/QueueStatus.js';
197
+ export { QueueState, QueueStatus } from './Model/InfrastructureStatus/QueueStatus.js';
198
198
  export { RunnersStatus } from './Model/InfrastructureStatus/RunnersStatus.js';
199
199
  export { StorageStatus } from './Model/InfrastructureStatus/StorageStatus.js';
200
200
  export { State } from './Model/State.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.122.0";
1
+ export declare const VERSION = "1.126.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.122.0";
1
+ export const VERSION = "1.126.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attlaz/client",
3
- "version": "1.123.0",
3
+ "version": "1.126.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -38,33 +38,32 @@
38
38
  "scripts": {
39
39
  "prebuild": "npm run setversion",
40
40
  "prepublishOnly": "npm run typecheck && npm test",
41
- "prepare": "npm run clean && tsc --project tsconfig.build.json && npm run setversion",
42
- "build": "npm run clean && tsc -p tsconfig.build.json",
41
+ "prepare": "npm run clean && npm run tsc -- --project tsconfig.build.json && npm run setversion",
42
+ "build": "npm run clean && npm run tsc -- -p tsconfig.build.json",
43
43
  "setversion": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
44
44
  "clean": "rimraf dist",
45
45
  "scan": "docker run -v .:/path zricethezav/gitleaks:latest detect --source=\"/path\" ",
46
46
  "test": "vitest run --mode unit",
47
- "typecheck": "tsc --project tsconfig.json --noEmit",
47
+ "typecheck": "npm run tsc -- --project tsconfig.json --noEmit",
48
48
  "test-integration": "vitest run --mode integration",
49
- "test-live": "vitest --mode unit"
49
+ "test-live": "vitest --mode unit",
50
+ "tsc": "node node_modules/@typescript/native/bin/tsc",
51
+ "typecheck:ts6": "tsc6 --project tsconfig.json --noEmit"
50
52
  },
51
53
  "publishConfig": {
52
54
  "access": "public",
53
55
  "registry": "https://registry.npmjs.org"
54
56
  },
55
57
  "devDependencies": {
56
- "@types/node": "^26.4.0",
57
- "@typescript-eslint/eslint-plugin": "^8.59.3",
58
- "@typescript-eslint/parser": "^8.59.3",
59
- "eslint": "^9.39.5",
60
- "eslint-config-attlaz-base": "^1.8.0",
58
+ "@types/node": "^26.5.0",
59
+ "@typescript/native": "npm:typescript@^7.0.2",
60
+ "eslint": "^10.10.0",
61
+ "eslint-config-attlaz-base": "^1.9.1",
61
62
  "eslint-import-resolver-typescript": "^4.4.5",
62
- "eslint-plugin-import": "^2.32.0",
63
- "eslint-plugin-jsdoc": "^62.9.0",
64
- "eslint-plugin-prefer-arrow": "^1.2.3",
65
- "eslint-plugin-promise": "^7.3.0",
63
+ "eslint-plugin-barrel-files": "^3.0.1",
64
+ "eslint-plugin-import-x": "^4.17.1",
66
65
  "rimraf": "^6.1.3",
67
- "typescript": "^6.0.3",
66
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
68
67
  "vitest": "^4.1.11"
69
68
  },
70
69
  "directories": {