attlaz-client 1.21.14 → 1.22.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/dist/Client.d.ts CHANGED
@@ -31,6 +31,7 @@ import { SearchEndpoint } from './Service/SearchEndpoint.js';
31
31
  import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
32
32
  import { AccessTokenEndpoint } from './Service/AccessTokenEndpoint.js';
33
33
  import { AdapterConnectionEndpoint } from './Service/AdapterConnectionEndpoint.js';
34
+ import { CollectionsEndpoint } from './Service/CollectionsEndpoint.js';
34
35
  export declare class Client {
35
36
  private readonly endpoints;
36
37
  private httpClient;
@@ -81,6 +82,7 @@ export declare class Client {
81
82
  getSearchEndpoint(): SearchEndpoint;
82
83
  getUserActionEndpoint(): UserActionEndpoint;
83
84
  getAccessTokenEndpoint(): AccessTokenEndpoint;
85
+ getCollectionsEndpoint(): CollectionsEndpoint;
84
86
  getFirewallEndpoint(): FirewallEndpoint;
85
87
  private getEndpoint;
86
88
  getVersion(): string;
package/dist/Client.js CHANGED
@@ -33,6 +33,7 @@ import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
33
33
  import { AccessTokenEndpoint } from './Service/AccessTokenEndpoint.js';
34
34
  import { AdapterConnectionEndpoint } from './Service/AdapterConnectionEndpoint.js';
35
35
  import { VERSION } from './version.js';
36
+ import { CollectionsEndpoint } from './Service/CollectionsEndpoint.js';
36
37
  export class Client {
37
38
  endpoints;
38
39
  httpClient;
@@ -68,6 +69,7 @@ export class Client {
68
69
  WorkerEndpoint,
69
70
  WorkspaceEndpoint,
70
71
  WorkspaceMemberEndpoint,
72
+ CollectionsEndpoint,
71
73
  };
72
74
  apiEndpoint = 'https://api.attlaz.com';
73
75
  parseConfig(config) {
@@ -214,6 +216,9 @@ export class Client {
214
216
  getAccessTokenEndpoint() {
215
217
  return this.getEndpoint('accesstoken', this.Store.AccessTokenEndpoint);
216
218
  }
219
+ getCollectionsEndpoint() {
220
+ return this.getEndpoint('collections', this.Store.CollectionsEndpoint);
221
+ }
217
222
  // TODO: this should be in a separate API?
218
223
  getFirewallEndpoint() {
219
224
  return this.getEndpoint('firewall', this.Store.FirewallEndpoint);
@@ -0,0 +1,12 @@
1
+ export declare class Collection {
2
+ id: string;
3
+ project: string;
4
+ name: string;
5
+ properties: {
6
+ id: string;
7
+ name: string;
8
+ type: string;
9
+ options: string[];
10
+ }[];
11
+ static parse(raw: Record<string, unknown>): Collection;
12
+ }
@@ -0,0 +1,15 @@
1
+ export class Collection {
2
+ id;
3
+ project;
4
+ name;
5
+ properties;
6
+ // records: CollectionRecord[];
7
+ static parse(raw) {
8
+ const collection = new Collection();
9
+ collection.id = raw.id;
10
+ collection.project = raw.project;
11
+ collection.name = raw.name;
12
+ collection.properties = raw.properties;
13
+ return collection;
14
+ }
15
+ }
@@ -0,0 +1,6 @@
1
+ export declare class CollectionRecord {
2
+ id: string;
3
+ collection: string;
4
+ properties: Record<string, unknown>;
5
+ static parse(raw: Record<string, unknown>): CollectionRecord;
6
+ }
@@ -0,0 +1,12 @@
1
+ export class CollectionRecord {
2
+ id;
3
+ collection;
4
+ properties;
5
+ static parse(raw) {
6
+ const record = new CollectionRecord();
7
+ record.id = raw.id;
8
+ record.collection = raw.collection;
9
+ record.properties = raw.properties;
10
+ return record;
11
+ }
12
+ }
@@ -4,5 +4,5 @@ export declare class StorageItemInformation {
4
4
  created: Date | null;
5
5
  updated: Date | null;
6
6
  expiration: Date | null;
7
- static parse(raw: any): StorageItemInformation;
7
+ static parse(raw: Record<string, unknown>): StorageItemInformation;
8
8
  }
@@ -0,0 +1,11 @@
1
+ import { CollectionResult } from '../Model/Result/CollectionResult.js';
2
+ import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
3
+ import { Collection } from '../Model/Collections/Collection.js';
4
+ import { Endpoint } from './Endpoint.js';
5
+ import { CollectionRecord } from '../Model/Collections/CollectionRecord.js';
6
+ export declare class CollectionsEndpoint extends Endpoint {
7
+ getAll(projectId: string, pagination: CursorPagination): Promise<CollectionResult<Collection>>;
8
+ getById(collectionId: string): Promise<Collection | null>;
9
+ getRecords(collectionId: string, pagination: CursorPagination): Promise<CollectionResult<CollectionRecord>>;
10
+ addRecord(collectionId: string, properties: unknown): Promise<CollectionRecord>;
11
+ }
@@ -0,0 +1,54 @@
1
+ import { QueryString } from '../Http/Data/QueryString.js';
2
+ import { Collection } from '../Model/Collections/Collection.js';
3
+ import { Endpoint } from './Endpoint.js';
4
+ import { CollectionRecord } from '../Model/Collections/CollectionRecord.js';
5
+ export class CollectionsEndpoint extends Endpoint {
6
+ async getAll(projectId, pagination) {
7
+ const qs = new QueryString('/projects/' + projectId + '/collections');
8
+ qs.addPagination(pagination);
9
+ return await this.requestCollection(qs, Collection.parse);
10
+ }
11
+ async getById(collectionId) {
12
+ try {
13
+ const qs = new QueryString('/collections/' + collectionId + '');
14
+ const result = await this.requestObject(qs, null, Collection.parse);
15
+ return result.getData();
16
+ }
17
+ catch (error) {
18
+ if (this.httpClient.isDebugEnabled()) {
19
+ console.error('Failed to load Collection by id: ', error);
20
+ }
21
+ throw error;
22
+ }
23
+ }
24
+ async getRecords(collectionId, pagination) {
25
+ try {
26
+ const qs = new QueryString('/collections/' + collectionId + '/records');
27
+ qs.addPagination(pagination);
28
+ return await this.requestCollection(qs, CollectionRecord.parse);
29
+ }
30
+ catch (error) {
31
+ if (this.httpClient.isDebugEnabled()) {
32
+ console.error('Failed to load Collection by id: ', error);
33
+ }
34
+ throw error;
35
+ }
36
+ }
37
+ async addRecord(collectionId, properties) {
38
+ try {
39
+ const qs = new QueryString('/collections/' + collectionId + '');
40
+ const result = await this.requestObject(qs, { properties }, CollectionRecord.parse, 'POST');
41
+ const updatedWorkspace = result.getData();
42
+ if (updatedWorkspace === null) {
43
+ throw new Error('CollectionRecord not created');
44
+ }
45
+ return updatedWorkspace;
46
+ }
47
+ catch (error) {
48
+ if (this.httpClient.isDebugEnabled()) {
49
+ console.error('Failed to save CollectionRecord: ', error);
50
+ }
51
+ throw error;
52
+ }
53
+ }
54
+ }
@@ -3,11 +3,12 @@ import { StorageInformation } from '../Model/Storage/StorageInformation.js';
3
3
  import { StorageItem } from '../Model/Storage/StorageItem.js';
4
4
  import { StorageItemInformation } from '../Model/Storage/StorageItemInformation.js';
5
5
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
6
+ import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
6
7
  import { Endpoint } from './Endpoint.js';
7
8
  export declare class StorageEndpoint extends Endpoint {
8
9
  getInformation(projectEnvironmentId: string, storageType: StorageType): Promise<StorageInformation | null>;
9
10
  clearPool(projectEnvironmentId: string, storageType: StorageType, poolKey: string): Promise<boolean>;
10
- getPoolItemsInformation(projectEnvironmentId: string, storageType: StorageType, poolKey: string): Promise<CollectionResult<StorageItemInformation>>;
11
+ getPoolItemsInformation(projectEnvironmentId: string, storageType: StorageType, poolKey: string, pagination?: CursorPagination | null): Promise<CollectionResult<StorageItemInformation>>;
11
12
  getItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItemKey: string): Promise<StorageItem | null>;
12
13
  setItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItem: StorageItem): Promise<StorageItem>;
13
14
  deleteItem(projectEnvironmentId: string, storageType: StorageType, poolKey: string, storageItemKey: string): Promise<boolean>;
@@ -1,6 +1,7 @@
1
1
  import { StorageInformation } from '../Model/Storage/StorageInformation.js';
2
2
  import { StorageItem } from '../Model/Storage/StorageItem.js';
3
3
  import { StorageItemInformation } from '../Model/Storage/StorageItemInformation.js';
4
+ import { QueryString } from '../Http/Data/QueryString.js';
4
5
  import { Endpoint } from './Endpoint.js';
5
6
  export class StorageEndpoint extends Endpoint {
6
7
  async getInformation(projectEnvironmentId, storageType) {
@@ -43,10 +44,11 @@ export class StorageEndpoint extends Endpoint {
43
44
  throw ex;
44
45
  }
45
46
  }
46
- async getPoolItemsInformation(projectEnvironmentId, storageType, poolKey) {
47
- const cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items';
47
+ async getPoolItemsInformation(projectEnvironmentId, storageType, poolKey, pagination = null) {
48
+ const qs = new QueryString('/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + poolKey + '/items');
49
+ qs.addPagination(pagination);
48
50
  try {
49
- const result = await this.requestCollection(cmd, StorageItemInformation.parse, null, 'GET');
51
+ const result = await this.requestCollection(qs, StorageItemInformation.parse, null, 'GET');
50
52
  return result;
51
53
  }
52
54
  catch (ex) {
package/dist/index.d.ts CHANGED
@@ -28,6 +28,8 @@ export { AdapterCategory } from './Model/Adapter/AdapterCategory.js';
28
28
  export { AdapterConnectionStatus } from './Model/Adapter/AdapterConnectionStatus.js';
29
29
  export { AdapterConnectionConfigurationValue } from './Model/Adapter/AdapterConnectionConfigurationValue.js';
30
30
  export { AdapterConnectionEvent } from './Model/Adapter/AdapterConnectionEvent.js';
31
+ export { Collection } from './Model/Collections/Collection.js';
32
+ export { CollectionRecord } from './Model/Collections/CollectionRecord.js';
31
33
  export { EventType } from './Model/Event/EventType.js';
32
34
  export { HealthAlert } from './Model/HealthAlert/HealthAlert.js';
33
35
  export { HealthAlertStatus } from './Model/HealthAlert/HealthAlertStatus.js';
@@ -148,5 +150,6 @@ export { UserEndpoint } from './Service/UserEndpoint.js';
148
150
  export { WorkerConfigEndpoint } from './Service/WorkerConfigEndpoint.js';
149
151
  export { WorkerEndpoint } from './Service/WorkerEndpoint.js';
150
152
  export { HealthAlertEndpoint } from './Service/HealthAlertEndpoint.js';
153
+ export { CollectionsEndpoint } from './Service/CollectionsEndpoint.js';
151
154
  export { Client } from './Client.js';
152
155
  export { Utils } from './Utils.js';
package/dist/index.js CHANGED
@@ -23,6 +23,8 @@ export { AdapterCategory } from './Model/Adapter/AdapterCategory.js';
23
23
  export { AdapterConnectionStatus } from './Model/Adapter/AdapterConnectionStatus.js';
24
24
  export { AdapterConnectionConfigurationValue } from './Model/Adapter/AdapterConnectionConfigurationValue.js';
25
25
  export { AdapterConnectionEvent } from './Model/Adapter/AdapterConnectionEvent.js';
26
+ export { Collection } from './Model/Collections/Collection.js';
27
+ export { CollectionRecord } from './Model/Collections/CollectionRecord.js';
26
28
  export { EventType } from './Model/Event/EventType.js';
27
29
  export { HealthAlert } from './Model/HealthAlert/HealthAlert.js';
28
30
  export { HealthAlertStatus } from './Model/HealthAlert/HealthAlertStatus.js';
@@ -143,5 +145,6 @@ export { UserEndpoint } from './Service/UserEndpoint.js';
143
145
  export { WorkerConfigEndpoint } from './Service/WorkerConfigEndpoint.js';
144
146
  export { WorkerEndpoint } from './Service/WorkerEndpoint.js';
145
147
  export { HealthAlertEndpoint } from './Service/HealthAlertEndpoint.js';
148
+ export { CollectionsEndpoint } from './Service/CollectionsEndpoint.js';
146
149
  export { Client } from './Client.js';
147
150
  export { Utils } from './Utils.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.21.13";
1
+ export declare const VERSION = "1.22.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.21.13";
1
+ export const VERSION = "1.22.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.21.14",
3
+ "version": "1.22.1",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -42,29 +42,29 @@
42
42
  "registry": "https://registry.npmjs.org"
43
43
  },
44
44
  "dependencies": {
45
- "axios": "^1.7.7",
45
+ "axios": "^1.7.9",
46
46
  "axios-oauth-client": "^2.2.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/jest": "^29.5.2",
50
- "@types/node": "^22.1.0",
51
- "dotenv": "^16.3.1",
52
- "eslint-config-attlaz-base": "^1.0.17",
53
- "eslint": "^9.14.0",
54
- "eslint-import-resolver-typescript": "^3.6.1",
55
- "eslint-plugin-import": "^2.27.5",
56
- "eslint-plugin-jsdoc": "^50.1.0",
57
- "eslint-plugin-prefer-arrow": "^1.2.3",
58
- "eslint-plugin-promise": "^7.1.0",
49
+ "@types/jest": "^29.5.14",
50
+ "@types/node": "^22.10.5",
59
51
  "@typescript-eslint/eslint-plugin": "^8.1.0",
60
52
  "@typescript-eslint/parser": "^8.1.0",
61
- "jest": "^29.5.0",
53
+ "dotenv": "^16.4.7",
54
+ "eslint": "^9.17.0",
55
+ "eslint-config-attlaz-base": "^1.2.0",
56
+ "eslint-import-resolver-typescript": "^3.7.0",
57
+ "eslint-plugin-import": "^2.31.0",
58
+ "eslint-plugin-jsdoc": "^50.6.1",
59
+ "eslint-plugin-prefer-arrow": "^1.2.3",
60
+ "eslint-plugin-promise": "^7.2.1",
61
+ "jest": "^29.7.0",
62
62
  "rimraf": "^6.0.1",
63
63
  "rollup-plugin-commonjs": "^10.1.0",
64
64
  "rollup-plugin-node-resolve": "^5.2.0",
65
65
  "rollup-plugin-typescript": "^1.0.1",
66
- "ts-jest": "^29.1.0",
67
- "typescript": "^5.6.3"
66
+ "ts-jest": "^29.2.5",
67
+ "typescript": "^5.7.2"
68
68
  },
69
69
  "directories": {
70
70
  "test": "test"