Skip to content

Commit e389fa5

Browse files
committed
more documentation & last minute config changes
1 parent 6c92553 commit e389fa5

28 files changed

+501
-84
lines changed

etc/astra-db-ts.api.md

Lines changed: 69 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,25 @@ export class CommandSucceededEvent extends CommandEvent {
265265
readonly resp?: RawDataAPIResponse;
266266
}
267267

268+
// @public
269+
export interface CostInfo {
270+
costPerDayCents: number;
271+
costPerDayMRCents: number;
272+
costPerDayParkedCents: number;
273+
costPerHourCents: number;
274+
costPerHourMRCents: number;
275+
costPerHourParkedCents: number;
276+
costPerMinCents: number;
277+
costPerMinMRCents: number;
278+
costPerMinParkedCents: number;
279+
costPerMonthCents: number;
280+
costPerMonthMRCents: number;
281+
costPerMonthParkedCents: number;
282+
costPerNetworkGbCents: number;
283+
costPerReadGbCents: number;
284+
costPerWrittenGbCents: number;
285+
}
286+
268287
// @public
269288
export interface CreateCollectionOptions<Schema extends SomeDoc> extends WithTimeout, CollectionOptions<Schema>, WithNamespace {
270289
checkExists?: boolean;
@@ -376,13 +395,15 @@ export interface DatabaseInfo {
376395
additionalKeyspaces?: string[];
377396
capacityUnits: number;
378397
cloudProvider?: DatabaseCloudProvider;
398+
datacenters?: DatacenterInfo[];
379399
dbType?: 'vector';
380400
keyspace?: string;
401+
keyspaces?: string[];
381402
name: string;
382-
password: string;
403+
password?: string;
383404
region: string;
384405
tier: DatabaseTier;
385-
user: string;
406+
user?: string;
386407
}
387408

388409
// @public
@@ -402,6 +423,22 @@ export interface DatabaseStorageInfo {
402423
// @public
403424
export type DatabaseTier = 'developer' | 'A5' | 'A10' | 'A20' | 'A40' | 'C10' | 'C20' | 'C40' | 'D10' | 'D20' | 'D40' | 'serverless';
404425

426+
// @public
427+
export interface DatacenterInfo {
428+
capacityUnits: number;
429+
cloudProvider: DatabaseCloudProvider;
430+
dateCreated: string;
431+
id: string;
432+
isPrimary: boolean;
433+
name: string;
434+
region: string;
435+
regionClassification: string;
436+
regionZone: string;
437+
secureBundleUrl: string;
438+
status: string;
439+
tier: DatabaseTier;
440+
}
441+
405442
// @public
406443
export interface DateFilterOps {
407444
$gt?: Date;
@@ -442,15 +479,20 @@ export class Db {
442479

443480
// @public
444481
export abstract class DbAdmin {
445-
// (undocumented)
446482
abstract createNamespace(namespace: string, options?: AdminBlockingOptions): Promise<void>;
447483
abstract db(): Db;
448-
// (undocumented)
449484
abstract dropNamespace(namespace: string, options?: AdminBlockingOptions): Promise<void>;
450-
// (undocumented)
451485
abstract listNamespaces(): Promise<string[]>;
452486
}
453487

488+
// @public
489+
export interface DbMetricsInfo {
490+
errorsTotalCount: number;
491+
liveDataSizeBytes: number;
492+
readRequestsTotalCount: number;
493+
writeRequestsTotalCount: number;
494+
}
495+
454496
// @public
455497
export interface DbSpawnOptions {
456498
dataApiPath?: string;
@@ -489,7 +531,7 @@ export interface DeleteOneModel<TSchema extends SomeDoc> {
489531
export interface DeleteOneOptions extends WithTimeout {
490532
sort?: Sort;
491533
vector?: number[];
492-
// @alpha (undocumented)
534+
// @alpha
493535
vectorize?: string;
494536
}
495537

@@ -568,11 +610,9 @@ export class FindCursor<T, TRaw extends SomeDoc = SomeDoc> {
568610
[Symbol.asyncIterator](): AsyncGenerator<T, void, void>;
569611
// @internal
570612
constructor(namespace: string, httpClient: DataAPIHttpClient, filter: Filter<SomeDoc>, options?: FindOptions);
571-
// (undocumented)
572613
bufferedCount(): number;
573614
clone(): FindCursor<TRaw, TRaw>;
574615
close(): Promise<void>;
575-
// (undocumented)
576616
get closed(): boolean;
577617
filter(filter: Filter<TRaw>): FindCursor<T, TRaw>;
578618
// @deprecated
@@ -581,7 +621,6 @@ export class FindCursor<T, TRaw extends SomeDoc = SomeDoc> {
581621
includeSimilarity(includeSimilarity?: boolean): FindCursor<T, TRaw>;
582622
limit(limit: number): FindCursor<T, TRaw>;
583623
map<R>(mapping: (doc: T) => R): FindCursor<R, TRaw>;
584-
// (undocumented)
585624
get namespace(): string;
586625
next(): Promise<T | null>;
587626
project<R = any, RRaw extends SomeDoc = SomeDoc>(projection: Projection): FindCursor<R, RRaw>;
@@ -598,7 +637,7 @@ export interface FindOneAndDeleteOptions extends WithTimeout {
598637
projection?: Projection;
599638
sort?: Sort;
600639
vector?: number[];
601-
// @alpha (undocumented)
640+
// @alpha
602641
vectorize?: string;
603642
}
604643

@@ -610,7 +649,7 @@ export interface FindOneAndReplaceOptions extends WithTimeout {
610649
sort?: Sort;
611650
upsert?: boolean;
612651
vector?: number[];
613-
// @alpha (undocumented)
652+
// @alpha
614653
vectorize?: string;
615654
}
616655

@@ -622,7 +661,7 @@ export interface FindOneAndUpdateOptions extends WithTimeout {
622661
sort?: Sort;
623662
upsert?: boolean;
624663
vector?: number[];
625-
// @alpha (undocumented)
664+
// @alpha
626665
vectorize?: string;
627666
}
628667

@@ -632,7 +671,7 @@ export interface FindOneOptions extends WithTimeout {
632671
projection?: Projection;
633672
sort?: Sort;
634673
vector?: number[];
635-
// @alpha (undocumented)
674+
// @alpha
636675
vectorize?: string;
637676
}
638677

@@ -644,7 +683,7 @@ export interface FindOptions {
644683
skip?: number;
645684
sort?: Sort;
646685
vector?: number[];
647-
// @alpha (undocumented)
686+
// @alpha
648687
vectorize?: string;
649688
}
650689

@@ -665,14 +704,18 @@ export interface FullCollectionInfo {
665704
// @public
666705
export interface FullDatabaseInfo {
667706
availableActions?: DatabaseAction[];
707+
cost?: CostInfo;
668708
cqlshUrl?: string;
669709
creationTime?: string;
670710
dataEndpointUrl?: string;
671711
grafanaUrl?: string;
672712
graphqlUrl?: string;
673713
id: string;
674714
info: DatabaseInfo;
715+
lastUsageTime?: string;
675716
message?: string;
717+
metrics?: DbMetricsInfo;
718+
observedStatus: DatabaseStatus;
676719
orgId: string;
677720
ownerId: string;
678721
status: DatabaseStatus;
@@ -715,7 +758,7 @@ export type InsertManyOptions = InsertManyUnorderedOptions | InsertManyOrderedOp
715758
export interface InsertManyOrderedOptions extends WithTimeout {
716759
chunkSize?: number;
717760
ordered: true;
718-
// @alpha (undocumented)
761+
// @alpha
719762
vectorize?: (string | null | undefined)[];
720763
vectors?: (number[] | null | undefined)[];
721764
}
@@ -731,7 +774,7 @@ export interface InsertManyUnorderedOptions extends WithTimeout {
731774
chunkSize?: number;
732775
concurrency?: number;
733776
ordered?: false;
734-
// @alpha (undocumented)
777+
// @alpha
735778
vectorize?: (string | null | undefined)[];
736779
vectors?: (number[] | null | undefined)[];
737780
}
@@ -744,7 +787,7 @@ export interface InsertOneModel<TSchema extends SomeDoc> {
744787
// @public
745788
export interface InsertOneOptions extends WithTimeout {
746789
vector?: number[];
747-
// @alpha (undocumented)
790+
// @alpha
748791
vectorize?: string;
749792
}
750793

@@ -835,7 +878,6 @@ export type Projection = Record<string, 1 | 0 | true | false | ProjectionSlice>;
835878

836879
// @public
837880
export interface ProjectionSlice {
838-
// (undocumented)
839881
$slice: number | [number, number];
840882
}
841883

@@ -847,13 +889,10 @@ export type Push<Schema> = {
847889
});
848890
};
849891

850-
// @public (undocumented)
892+
// @public
851893
export interface RawDataAPIResponse {
852-
// (undocumented)
853894
data?: Record<string, any>;
854-
// (undocumented)
855895
errors?: any[];
856-
// (undocumented)
857896
status?: Record<string, any>;
858897
}
859898

@@ -869,7 +908,7 @@ export interface ReplaceOneOptions extends WithTimeout {
869908
sort?: Sort;
870909
upsert?: boolean;
871910
vector?: number[];
872-
// @alpha (undocumented)
911+
// @alpha
873912
vectorize?: string;
874913
}
875914

@@ -884,7 +923,7 @@ export interface RunCommandOptions extends WithNamespace, WithTimeout {
884923
// @public
885924
export type SomeDoc = Record<string, any>;
886925

887-
// @public (undocumented)
926+
// @public
888927
export type SomeId = string | number | bigint | boolean | Date | UUID | ObjectId;
889928

890929
// @public
@@ -894,7 +933,7 @@ export type Sort = Record<string, SortDirection> | {
894933
$vectorize: string;
895934
};
896935

897-
// @public (undocumented)
936+
// @public
898937
export type SortDirection = 1 | -1;
899938

900939
// @public
@@ -948,7 +987,7 @@ export type StrictRename<Schema extends SomeDoc> = {
948987

949988
// @public
950989
export type StrictSort<Schema extends SomeDoc> = {
951-
[K in keyof ToDotNotation<WithId<Schema>>]?: 1 | -1;
990+
[K in keyof ToDotNotation<WithId<Schema>>]?: SortDirection;
952991
} | {
953992
$vector: number[];
954993
} | {
@@ -983,11 +1022,9 @@ export interface StrictUpdateFilter<Schema extends SomeDoc> {
9831022
export type ToDotNotation<Schema extends SomeDoc> = Merge<_ToDotNotation<Schema, ''>>;
9841023

9851024
// @public
986-
export class TooManyDocsToCountError extends DataAPIError {
1025+
export class TooManyDocumentsToCountError extends DataAPIError {
9871026
constructor(limit: number, hitServerLimit: boolean);
988-
// (undocumented)
9891027
readonly hitServerLimit: boolean;
990-
// (undocumented)
9911028
readonly limit: number;
9921029
}
9931030

@@ -1049,7 +1086,7 @@ export interface UpdateOneOptions extends WithTimeout {
10491086
sort?: Sort;
10501087
upsert?: boolean;
10511088
vector?: number[];
1052-
// @alpha (undocumented)
1089+
// @alpha
10531090
vectorize?: string;
10541091
}
10551092

@@ -1082,19 +1119,17 @@ export interface VectorDoc {
10821119
$vector?: number[];
10831120
}
10841121

1085-
// @alpha (undocumented)
1122+
// @alpha
10861123
export interface VectorizeServiceOptions {
1087-
// (undocumented)
10881124
modelName: string;
1089-
// (undocumented)
10901125
provider: string;
10911126
}
10921127

10931128
// @public
10941129
export interface VectorOptions {
10951130
dimension?: number;
10961131
metric?: 'cosine' | 'euclidean' | 'dot_product';
1097-
// @alpha (undocumented)
1132+
// @alpha
10981133
service?: VectorizeServiceOptions;
10991134
}
11001135

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
"lint": "eslint .",
5252
"test": "ts-mocha --paths -p tsconfig.json tests/unit/**/*.test.ts tests/integration/**/*.test.ts tests/integration/**/**/*.test.ts",
5353
"test:all": "env ASTRA_RUN_LONG_TESTS=1 ASTRA_RUN_ADMIN_TESTS=1 ts-mocha --paths -p tsconfig.json tests/unit/**/*.test.ts tests/integration/**/*.test.ts tests/integration/**/**/*.test.ts",
54-
"test:prerelease": "npm run test:all -- -b --exit",
5554
"test:coverage": "nyc npm run test:all -- -b",
5655
"test:types": "tsc --noEmit --skipLibCheck",
56+
"test:prerelease": "npm run lint && npm run test:types && npm run test:all -- -b --exit",
5757
"api-extractor": "api-extractor run -c ./api-extractor.jsonc --local",
5858
"build": "sh ./scripts/build.sh",
5959
"version": "npm run build && git add src/version.ts etc/astra-db-ts.api.md"

src/api/types.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,23 @@ export interface InternalFetchCtx {
5858
}
5959

6060
/**
61+
* The response format of a 2XX-status Data API call
62+
*
6163
* @public
6264
*/
6365
export interface RawDataAPIResponse {
64-
status?: Record<string, any>;
65-
errors?: any[];
66-
data?: Record<string, any>;
66+
/**
67+
* A response data holding documents that were returned as the result of a command.
68+
*/
69+
status?: Record<string, any>,
70+
/**
71+
* Status objects, generally describe the side effects of commands, such as the number of updated or inserted documents.
72+
*/
73+
errors?: any[],
74+
/**
75+
* Array of objects or null (Error)
76+
*/
77+
data?: Record<string, any>,
6778
}
6879

6980
/**

0 commit comments

Comments
 (0)