Skip to content

Commit 50c066d

Browse files
authored
chore: Align storage collection types (#805)
### Description - Add `username?: string;` for each collection item - Add `& {unnamed: boolean;}` for each `...CollectionClientListResult` Previously, `...CollectionClientListResult` types were inconsistent. Now they are consistently `PaginatedList<StorageType> & {unnamed: boolean;};` ### Issues Closes: #796
1 parent e96c5be commit 50c066d

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

src/resource_clients/dataset.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ export interface Dataset {
235235
name?: string;
236236
title?: string;
237237
userId: string;
238+
username?: string;
238239
createdAt: Date;
239240
modifiedAt: Date;
240241
accessedAt: Date;

src/resource_clients/dataset_collection.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import ow from 'ow';
22

33
import type { ApiClientSubResourceOptions } from '../base/api_client';
44
import { ResourceCollectionClient } from '../base/resource_collection_client';
5-
import type { PaginatedIterator, PaginatedList, PaginationOptions } from '../utils';
5+
import type { PaginatedList, PaginationOptions } from '../utils';
66
import type { Dataset } from './dataset';
77

88
export class DatasetCollectionClient extends ResourceCollectionClient {
@@ -32,7 +32,9 @@ export class DatasetCollectionClient extends ResourceCollectionClient {
3232
* for await (const singleItem of client.list(options)) {...}
3333
* ```
3434
*/
35-
list(options: DatasetCollectionClientListOptions = {}): PaginatedIterator<Dataset> {
35+
list(
36+
options: DatasetCollectionClientListOptions = {},
37+
): Promise<DatasetCollectionClientListResult> & AsyncIterable<Dataset> {
3638
ow(
3739
options,
3840
ow.object.exactShape({
@@ -66,4 +68,4 @@ export interface DatasetCollectionClientGetOrCreateOptions {
6668
schema?: Record<string, unknown>;
6769
}
6870

69-
export type DatasetCollectionClientListResult = PaginatedList<Dataset>;
71+
export type DatasetCollectionClientListResult = PaginatedList<Dataset> & { unnamed: boolean };

src/resource_clients/key_value_store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ export interface KeyValueStore {
328328
name?: string;
329329
title?: string;
330330
userId: string;
331+
username?: string;
331332
createdAt: Date;
332333
modifiedAt: Date;
333334
accessedAt: Date;

src/resource_clients/key_value_store_collection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class KeyValueStoreCollectionClient extends ResourceCollectionClient {
3434
*/
3535
list(
3636
options: KeyValueStoreCollectionClientListOptions = {},
37-
): Promise<PaginatedList<KeyValueStoreCollectionListResult>> & AsyncIterable<KeyValueStore> {
37+
): Promise<KeyValueStoreCollectionListResult> & AsyncIterable<KeyValueStore> {
3838
ow(
3939
options,
4040
ow.object.exactShape({
@@ -71,4 +71,4 @@ export interface KeyValueStoreCollectionClientGetOrCreateOptions {
7171
schema?: Record<string, unknown>;
7272
}
7373

74-
export type KeyValueStoreCollectionListResult = Omit<KeyValueStore, 'stats'> & { username?: string };
74+
export type KeyValueStoreCollectionListResult = PaginatedList<KeyValueStore> & { unnamed: boolean };

src/resource_clients/request_queue.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ export interface RequestQueue {
558558
name?: string;
559559
title?: string;
560560
userId: string;
561+
username?: string;
561562
createdAt: Date;
562563
modifiedAt: Date;
563564
accessedAt: Date;

src/resource_clients/request_queue_collection.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,4 @@ export interface RequestQueueCollectionListOptions extends PaginationOptions {
6363
desc?: boolean;
6464
}
6565

66-
export type RequestQueueCollectionListResult = PaginatedList<RequestQueue & { username?: string }> & {
67-
unnamed: boolean;
68-
};
66+
export type RequestQueueCollectionListResult = PaginatedList<RequestQueue> & { unnamed: boolean };

0 commit comments

Comments
 (0)