Skip to content

Commit 52c4295

Browse files
authored
Last-minute 1.5 changes (#72)
* fxied *Namespace commands in DataAPIDbAdmin * deprecate bulkWrite * deprecate db.collections() * add warnings to events * documented FetchH2 & FetchNative + udpated build report * added some missing docuemntation * changed scripts to use "/usr/bin/env sh" * added -stargate option to tests * added tests for legacy namespace admin fucntions * made all tags "NOT-"-able
1 parent 8e346b1 commit 52c4295

24 files changed

+190
-61
lines changed

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default [
3636

3737
parserOptions: {
3838
project: ['./tsconfig.json'],
39-
tsconfigRootDir: '/home/me/work/astra-db-ts',
39+
tsconfigRootDir: __dirname,
4040
},
4141
},
4242

etc/astra-db-ts.api.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ export class AdminCommandStartedEvent extends AdminCommandEvent {
5656
// @public
5757
export class AdminCommandSucceededEvent extends AdminCommandEvent {
5858
// @internal
59-
constructor(info: DevOpsAPIRequestInfo, longRunning: boolean, data: Record<string, any> | undefined, started: number);
59+
constructor(info: DevOpsAPIRequestInfo, longRunning: boolean, data: Record<string, any> | undefined, warnings: string[], started: number);
6060
readonly duration: number;
6161
readonly resBody?: Record<string, any>;
62+
readonly warnings: string[];
6263
}
6364

6465
// @public
@@ -187,6 +188,7 @@ export class Collection<Schema extends SomeDoc = SomeDoc> {
187188
//
188189
// @internal
189190
constructor(db: Db, httpClient: DataAPIHttpClient, name: string, opts: CollectionSpawnOptions | undefined);
191+
// @deprecated
190192
bulkWrite(operations: AnyBulkWriteOperation<Schema>[], options?: BulkWriteOptions): Promise<BulkWriteResult<Schema>>;
191193
readonly collectionName: string;
192194
countDocuments(filter: Filter<Schema>, upperBound: number, options?: WithTimeout): Promise<number>;
@@ -294,9 +296,10 @@ export class CommandStartedEvent extends CommandEvent {
294296
// @public
295297
export class CommandSucceededEvent extends CommandEvent {
296298
// @internal
297-
constructor(info: DataAPIRequestInfo, reply: RawDataAPIResponse, started: number);
299+
constructor(info: DataAPIRequestInfo, reply: RawDataAPIResponse, warnings: string[], started: number);
298300
readonly duration: number;
299301
readonly resp?: RawDataAPIResponse;
302+
readonly warnings: string[];
300303
}
301304

302305
// @public
@@ -566,6 +569,7 @@ export class Db {
566569
environment: Exclude<DataAPIEnvironment, 'astra'>;
567570
}): DataAPIDbAdmin;
568571
collection<Schema extends SomeDoc = SomeDoc>(name: string, options?: CollectionSpawnOptions): Collection<Schema>;
572+
// @deprecated
569573
collections(options?: WithKeyspace & WithTimeout): Promise<Collection[]>;
570574
command(command: Record<string, any>, options?: RunCommandOptions): Promise<RawDataAPIResponse>;
571575
createCollection<Schema extends SomeDoc = SomeDoc>(collectionName: string, options?: CreateCollectionOptions<Schema>): Promise<Collection<Schema>>;
@@ -619,6 +623,9 @@ export interface DbSpawnOptions {
619623
token?: string | TokenProvider | null;
620624
}
621625

626+
// @public
627+
export const DEFAULT_KEYSPACE = "default_keyspace";
628+
622629
// @public
623630
export interface DefaultHttpClientOptions {
624631
client?: 'default';
@@ -799,12 +806,25 @@ export interface FetcherResponseInfo {
799806
url: string;
800807
}
801808

809+
// @public
810+
export class FetchH2 implements Fetcher {
811+
constructor(options: DefaultHttpClientOptions | undefined, preferHttp2: boolean);
812+
close(): Promise<void>;
813+
fetch(info: FetcherRequestInfo): Promise<FetcherResponseInfo>;
814+
}
815+
802816
// @public
803817
export interface FetchHttpClientOptions {
804818
client: 'fetch';
805819
maxTimeMS?: number;
806820
}
807821

822+
// @public
823+
export class FetchNative implements Fetcher {
824+
close(): Promise<void>;
825+
fetch(info: FetcherRequestInfo): Promise<FetcherResponseInfo>;
826+
}
827+
808828
// @public
809829
export type Filter<Schema extends SomeDoc> = {
810830
[K in keyof NoId<Schema>]?: FilterExpr<NoId<Schema>[K]>;

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/sh
1+
#!/usr/bin/env sh
22

33
# Cleans the previous build
44
rm -rf ./dist

scripts/check-licensing.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/sh
1+
#!/usr/bin/env sh
22

33
# Lists out all the files which don't contain the necessary license notice
44
find tests/ src/ -type f -exec grep -L "^// Copyright DataStax, Inc." {} +

scripts/list-embedding-providers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/sh
1+
#!/usr/bin/env sh
22

33
# Errors on using unbound variables
44
set -u

scripts/repl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/sh
1+
#!/usr/bin/env sh
22

33
# Properly sources the .env file to bring env variables into scope
44
if [ -f .env ]; then

scripts/start-stargate-4-tests.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#!/usr/bin/sh
2-
3-
echo "Copy paste the following into your .env file:"
4-
echo "CLIENT_DB_URL=http://localhost:8181"
5-
echo "CLIENT_DB_TOKEN=Cassandra:Y2Fzc2FuZHJh:Y2Fzc2FuZHJh"
6-
echo "CLIENT_DB_ENVIRONMENT=dse"
7-
echo
1+
#!/usr/bin/env sh
82

93
docker-compose -f scripts/utils/docker-compose-stargate.yml up

scripts/test.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/sh
1+
#!/usr/bin/env sh
22

33
# Properly sources the .env file to bring env variables into scope
44
if [ -f .env ]; then
@@ -80,11 +80,14 @@ while [ $# -gt 0 ]; do
8080
shift
8181
environment="$1"
8282
;;
83+
"-stargate")
84+
stargate=1
85+
;;
8386
*)
8487
echo "Invalid flag $1"
8588
echo ""
8689
echo "Usage:"
87-
echo "scripts/test.sh [-all | -light | -coverage] [-fand | -for] [-f/F <filter>]+ [-g/G <regex>]+ [-w/W <vectorize_whitelist>] [-b | -bail] [-R | -no-report] [-c <http_client>] [-e <environment>]"
90+
echo "scripts/test.sh [-all | -light | -coverage] [-for] [-f/F <filter>]+ [-g/G <regex>]+ [-w/W <vectorize_whitelist>] [-b | -bail] [-R | -no-report] [-c <http_client>] [-e <environment>] [-stargate]"
8891
echo "or"
8992
echo "scripts/test.sh [-lint] [-tc]"
9093
exit
@@ -159,6 +162,10 @@ if [ -n "$environment" ]; then
159162
export CLIENT_DB_ENVIRONMENT="$environment"
160163
fi
161164

165+
if [ -n "$stargate" ]; then
166+
export USING_LOCAL_STARGATE=1
167+
fi
168+
162169
# Get embedding providers, if desired, to build the vectorize part of the command
163170
if [ -n "$CLIENT_RUN_VECTORIZE_TESTS" ] && [ "$test_type" != 'code' ]; then
164171
CLIENT_VECTORIZE_PROVIDERS=$(bash scripts/list-embedding-providers.sh | jq -c)

scripts/update-example-client-dep.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/sh
1+
#!/usr/bin/env sh
22

33
# Convenience script which auto-updates the `astra-db-ts` dependencies in all of the examples/ to use either:
44
# - the local astra-db-ts for testing purposes (which should always be reverted before merging)

scripts/utils/docker-compose-stargate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '2'
22

33
services:
44
coordinator:
5-
image: stargateio/coordinator-dse-next:v2.1.0-BETA-12
5+
image: stargateio/coordinator-dse-next:v2.1.0-BETA-16
66
networks:
77
- stargate
88
ports:
@@ -24,7 +24,7 @@ services:
2424
retries: 10
2525

2626
data-api:
27-
image: stargateio/data-api:v1.0.14
27+
image: stargateio/data-api:v1
2828
depends_on:
2929
coordinator:
3030
condition: service_healthy

0 commit comments

Comments
 (0)