Skip to content

Commit 7517a12

Browse files
committed
fix for process.env in the browser
1 parent b6c13bf commit 7517a12

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

etc/astra-db-ts.api.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -872,9 +872,8 @@ export class DataAPIDate implements TableCodec<typeof DataAPIDate> {
872872
static now(): DataAPIDate;
873873
static ofEpochDay(epochDays: number): DataAPIDate;
874874
static ofYearDay(year: number, dayOfYear: number): DataAPIDate;
875-
// @beta
875+
plus(duration: DataAPIDuration | string): DataAPIDate;
876876
toDate(base?: Date | DataAPITime): Date;
877-
// @beta
878877
toDateUTC(base?: Date | DataAPITime): Date;
879878
toString(): string;
880879
static utcnow(): DataAPIDate;
@@ -920,15 +919,10 @@ export class DataAPIDuration implements TableCodec<typeof DataAPIDuration> {
920919
readonly months: number;
921920
readonly nanoseconds: bigint;
922921
negate(): DataAPIDuration;
923-
// (undocumented)
924922
static readonly NS_PER_HOUR = 3600000000000n;
925-
// (undocumented)
926923
static readonly NS_PER_MIN = 60000000000n;
927-
// (undocumented)
928924
static readonly NS_PER_MS = 1000000n;
929-
// (undocumented)
930925
static readonly NS_PER_SEC = 1000000000n;
931-
// (undocumented)
932926
static readonly NS_PER_US = 1000n;
933927
plus(other: DataAPIDuration): DataAPIDuration | null;
934928
toHours(): number;
@@ -1052,9 +1046,7 @@ export class DataAPITime implements TableCodec<typeof DataAPITime> {
10521046
static ofNanoOfDay(nanoOfDay: number): DataAPITime;
10531047
static ofSecondOfDay(secondOfDay: number): DataAPITime;
10541048
readonly seconds: number;
1055-
// @beta
10561049
toDate(base?: Date | DataAPIDate): Date;
1057-
// @beta
10581050
toDateUTC(base?: Date | DataAPIDate): Date;
10591051
toString(): string;
10601052
static utcnow(): DataAPITime;
@@ -1948,8 +1940,6 @@ export interface TableDesCtx extends BaseDesCtx<TableCodecSerDesFns> {
19481940
// (undocumented)
19491941
next: never;
19501942
// (undocumented)
1951-
populateSparseData: boolean;
1952-
// (undocumented)
19531943
tableSchema: ListTableColumnDefinitions;
19541944
}
19551945

@@ -2145,14 +2135,6 @@ export class TooManyDocumentsToCountError extends DataAPIError {
21452135
readonly limit: number;
21462136
}
21472137

2148-
// @public
2149-
export class TooManyRowsToCountError extends DataAPIError {
2150-
// @internal
2151-
constructor(limit: number, hitServerLimit: boolean);
2152-
readonly hitServerLimit: boolean;
2153-
readonly limit: number;
2154-
}
2155-
21562138
// @public (undocumented)
21572139
export type TypeCodec<Fns extends CodecSerDesFns> = Pick<Fns, 'deserialize'> & {
21582140
type: string;

src/lib/utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { DataAPIEnvironment, nullish } from '@/src/lib/types';
1616
import { DataAPIEnvironments } from '@/src/lib/constants';
1717
import JBI from 'json-bigint';
1818
import { SomeDoc } from '@/src/documents';
19-
import process from 'node:process';
2019
import BigNumber from 'bignumber.js';
2120

2221
/**
@@ -130,7 +129,7 @@ const env = getJSEnv();
130129
/**
131130
* @internal
132131
*/
133-
export const forJSEnv = (process.env.CLIENT_DYNAMIC_JS_ENV_CHECK)
132+
export const forJSEnv = (typeof process !== 'undefined' && typeof process.env === 'object' && process.env.CLIENT_DYNAMIC_JS_ENV_CHECK)
134133
? <Args extends any[], R>(fns: JSEnvs<(...args: Args) => R>): (...args: Args) => R => (...args: Args) => fns[getJSEnv()](...args)
135134
: <Args extends any[], R>(fns: JSEnvs<(...args: Args) => R>): (...args: Args) => R => fns[env];
136135

0 commit comments

Comments
 (0)