@attlaz/client 1.93.0 → 1.95.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.
@@ -12,6 +12,12 @@ export declare class QualityDataset {
12
12
  autoCloseMode: string;
13
13
  config: Record<string, unknown> | null;
14
14
  createdAt: Date | null;
15
+ /**
16
+ * Totals for the overview: how much is being watched, and how much currently needs attention.
17
+ * Only the list endpoint counts them — both stay null when a single dataset is fetched.
18
+ */
19
+ entityCount: number | null;
20
+ openProblemCount: number | null;
15
21
  constructor(id: string, project: string, name: string);
16
22
  static parse(raw: ApiRecord): QualityDataset;
17
23
  }
@@ -11,6 +11,12 @@ export class QualityDataset {
11
11
  autoCloseMode = '';
12
12
  config = null;
13
13
  createdAt = null;
14
+ /**
15
+ * Totals for the overview: how much is being watched, and how much currently needs attention.
16
+ * Only the list endpoint counts them — both stay null when a single dataset is fetched.
17
+ */
18
+ entityCount = null;
19
+ openProblemCount = null;
14
20
  constructor(id, project, name) {
15
21
  this.id = id;
16
22
  this.project = project;
@@ -21,6 +27,8 @@ export class QualityDataset {
21
27
  dataset.autoCloseMode = raw.auto_close_mode ?? '';
22
28
  dataset.config = raw.config ?? null;
23
29
  dataset.createdAt = raw.created_at ? new Date(raw.created_at) : null;
30
+ dataset.entityCount = raw.entity_count === undefined ? null : Number(raw.entity_count);
31
+ dataset.openProblemCount = raw.open_problem_count === undefined ? null : Number(raw.open_problem_count);
24
32
  return dataset;
25
33
  }
26
34
  }
@@ -0,0 +1,29 @@
1
+ import { ApiRecord } from '../../Model/ApiRecord.js';
2
+ /**
3
+ * The catalogue entry behind a problem code — the `/data_quality/definitions` resource.
4
+ *
5
+ * A code is a machine key (`verlichting.ean_invalid_checkdigit`); the definition is what makes it
6
+ * readable, so anything showing a code to a user should resolve it here. Definitions are either
7
+ * platform-owned (`ownerProject` null, shipped by Attlaz) or owned by a project, and a project's
8
+ * own definition takes precedence over a platform one with the same code.
9
+ *
10
+ * `blocking` is orthogonal to `defaultSeverity`: severity is how bad the problem is, blocking is
11
+ * whether the entity can be published to a channel at all.
12
+ */
13
+ export declare class QualityProblemDefinition {
14
+ id: string;
15
+ code: string;
16
+ ownerProject: string | null;
17
+ label: string | null;
18
+ description: string | null;
19
+ dimension: string | null;
20
+ defaultSeverity: string | null;
21
+ blocking: boolean;
22
+ helpUrl: string | null;
23
+ pack: string | null;
24
+ property: string | null;
25
+ constructor(id: string, code: string);
26
+ /** What to show a user for this code: the label when it has one, the raw code otherwise. */
27
+ get displayName(): string;
28
+ static parse(raw: ApiRecord): QualityProblemDefinition;
29
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The catalogue entry behind a problem code — the `/data_quality/definitions` resource.
3
+ *
4
+ * A code is a machine key (`verlichting.ean_invalid_checkdigit`); the definition is what makes it
5
+ * readable, so anything showing a code to a user should resolve it here. Definitions are either
6
+ * platform-owned (`ownerProject` null, shipped by Attlaz) or owned by a project, and a project's
7
+ * own definition takes precedence over a platform one with the same code.
8
+ *
9
+ * `blocking` is orthogonal to `defaultSeverity`: severity is how bad the problem is, blocking is
10
+ * whether the entity can be published to a channel at all.
11
+ */
12
+ export class QualityProblemDefinition {
13
+ id;
14
+ code;
15
+ ownerProject = null;
16
+ label = null;
17
+ description = null;
18
+ dimension = null;
19
+ defaultSeverity = null;
20
+ blocking = false;
21
+ helpUrl = null;
22
+ pack = null;
23
+ property = null;
24
+ constructor(id, code) {
25
+ this.id = id;
26
+ this.code = code;
27
+ }
28
+ /** What to show a user for this code: the label when it has one, the raw code otherwise. */
29
+ get displayName() {
30
+ return this.label ?? this.code;
31
+ }
32
+ static parse(raw) {
33
+ const definition = new QualityProblemDefinition(raw.id, raw.code);
34
+ definition.ownerProject = raw.owner_project ?? null;
35
+ definition.label = raw.label ?? null;
36
+ definition.description = raw.description ?? null;
37
+ definition.dimension = raw.dimension ?? null;
38
+ definition.defaultSeverity = raw.default_severity ?? null;
39
+ definition.blocking = raw.blocking === true;
40
+ definition.helpUrl = raw.help_url ?? null;
41
+ definition.pack = raw.pack ?? null;
42
+ definition.property = raw.property ?? null;
43
+ return definition;
44
+ }
45
+ }
@@ -3,6 +3,7 @@ import { QualityEntity } from '../Model/QualityEntity.js';
3
3
  import { QualityEntityFilters } from '../Model/QualityEntityFilters.js';
4
4
  import { QualityFilterOptions } from '../Model/QualityFilterOptions.js';
5
5
  import { QualityProblem } from '../Model/QualityProblem.js';
6
+ import { QualityProblemDefinition } from '../Model/QualityProblemDefinition.js';
6
7
  import { QualityProblemEvent } from '../Model/QualityProblemEvent.js';
7
8
  import { QualitySummary } from '../Model/QualitySummary.js';
8
9
  import { QualitySuppression } from '../Model/QualitySuppression.js';
@@ -33,6 +34,12 @@ export declare class QualityEndpoint extends Endpoint {
33
34
  getFilterOptions(datasetId: string): Promise<QualityFilterOptions>;
34
35
  /** Both groupings in one call: `counts` by (property, severity) and `codes` for the fix cards. */
35
36
  getSummary(datasetId: string): Promise<QualitySummary>;
37
+ /**
38
+ * The catalogue for a project: the platform's definitions plus the project's own. Use it to turn
39
+ * codes into something readable — `summary`/`filter-options` only carry codes that currently
40
+ * have open problems, so a fully suppressed or resolved code has no label there.
41
+ */
42
+ getDefinitions(projectId: string, pack?: string | null): Promise<CollectionResult<QualityProblemDefinition>>;
36
43
  getSuppressions(datasetId: string): Promise<CollectionResult<QualitySuppression>>;
37
44
  /**
38
45
  * Suppress a code, either on one entity or — with both entity fields omitted — across the whole
@@ -2,6 +2,7 @@ import { QueryString } from '../../Http/Data/QueryString.js';
2
2
  import { QualityDataset } from '../Model/QualityDataset.js';
3
3
  import { QualityEntity } from '../Model/QualityEntity.js';
4
4
  import { QualityProblem } from '../Model/QualityProblem.js';
5
+ import { QualityProblemDefinition } from '../Model/QualityProblemDefinition.js';
5
6
  import { QualityProblemEvent } from '../Model/QualityProblemEvent.js';
6
7
  import { QualitySuppression } from '../Model/QualitySuppression.js';
7
8
  import { Endpoint } from '../../Service/Endpoint.js';
@@ -117,6 +118,20 @@ export class QualityEndpoint extends Endpoint {
117
118
  }), 'GET');
118
119
  return result.getData() ?? { counts: [], codes: [] };
119
120
  }
121
+ // ---- Problem definitions ----
122
+ /**
123
+ * The catalogue for a project: the platform's definitions plus the project's own. Use it to turn
124
+ * codes into something readable — `summary`/`filter-options` only carry codes that currently
125
+ * have open problems, so a fully suppressed or resolved code has no label there.
126
+ */
127
+ async getDefinitions(projectId, pack = null) {
128
+ const queryString = new QueryString('/data_quality/definitions');
129
+ queryString.set('project', projectId);
130
+ if (pack !== null) {
131
+ queryString.set('pack', pack);
132
+ }
133
+ return await this.requestCollection(queryString, QualityProblemDefinition.parse);
134
+ }
120
135
  // ---- Suppressions ----
121
136
  async getSuppressions(datasetId) {
122
137
  return await this.requestCollection('/data_quality/datasets/' + datasetId + '/suppressions', QualitySuppression.parse);
@@ -127,14 +142,18 @@ export class QualityEndpoint extends Endpoint {
127
142
  * is there rather than only on future scans.
128
143
  */
129
144
  async createSuppression(datasetId, suppression) {
130
- const body = { code: suppression.code };
131
- if (suppression.entityType && suppression.entityId) {
132
- body.entity_type = suppression.entityType;
133
- body.entity_id = suppression.entityId;
134
- }
135
- if (suppression.reason) {
136
- body.reason = suppression.reason;
137
- }
145
+ // Both entity keys are always sent, explicitly null for a dataset-wide suppression: the
146
+ // endpoint requires them to be present so that a dropped or renamed key is an error rather
147
+ // than a silent widening to the whole dataset.
148
+ //
149
+ // `entity`, not `entity_id`: formatKey() strips a trailing `_id`, so `entity_id` is not
150
+ // expressible from this client at all.
151
+ const body = {
152
+ code: suppression.code,
153
+ entity_type: suppression.entityType ?? null,
154
+ entity: suppression.entityId ?? null,
155
+ reason: suppression.reason ?? null,
156
+ };
138
157
  const result = await this.requestObject('/data_quality/datasets/' + datasetId + '/suppressions', body, (raw) => ({
139
158
  suppression: raw.id ? QualitySuppression.parse(raw) : null,
140
159
  muted: Number(raw.muted ?? 0),
package/dist/index.d.ts CHANGED
@@ -135,6 +135,7 @@ export { PulseStatisticsEndpoint } from './Pulse/Service/PulseStatisticsEndpoint
135
135
  export { QualityDataset } from './DataQuality/Model/QualityDataset.js';
136
136
  export { QualityEntity } from './DataQuality/Model/QualityEntity.js';
137
137
  export { QualityProblem } from './DataQuality/Model/QualityProblem.js';
138
+ export { QualityProblemDefinition } from './DataQuality/Model/QualityProblemDefinition.js';
138
139
  export { QualityProblemEvent } from './DataQuality/Model/QualityProblemEvent.js';
139
140
  export { QualitySuppression } from './DataQuality/Model/QualitySuppression.js';
140
141
  export { QualityCodeOption } from './DataQuality/Model/QualityCodeOption.js';
package/dist/index.js CHANGED
@@ -108,6 +108,7 @@ export { PulseStatisticsEndpoint } from './Pulse/Service/PulseStatisticsEndpoint
108
108
  export { QualityDataset } from './DataQuality/Model/QualityDataset.js';
109
109
  export { QualityEntity } from './DataQuality/Model/QualityEntity.js';
110
110
  export { QualityProblem } from './DataQuality/Model/QualityProblem.js';
111
+ export { QualityProblemDefinition } from './DataQuality/Model/QualityProblemDefinition.js';
111
112
  export { QualityProblemEvent } from './DataQuality/Model/QualityProblemEvent.js';
112
113
  export { QualitySuppression } from './DataQuality/Model/QualitySuppression.js';
113
114
  export { QualityEndpoint } from './DataQuality/Service/QualityEndpoint.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.93.0";
1
+ export declare const VERSION = "1.94.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.93.0";
1
+ export const VERSION = "1.94.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attlaz/client",
3
- "version": "1.93.0",
3
+ "version": "1.95.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",