Skip to content

Commit

Permalink
fix(jetstream): exported ApiError (#105)
Browse files Browse the repository at this point in the history
change(kv): removed deprecated KV apis (`KvRemove` - `remove(k)=>Promise<void>`, `close()=>Promise<void>`) and options (`maxBucketSize`, `placementCluster`, `bucket_location`)
fix(obj): exported ObjectWatchInfo type
change(obj): removed deprecated `ObjectStoreInfo` - use `ObjectStoreStatus`

Signed-off-by: Alberto Ricart <[email protected]>
  • Loading branch information
aricart authored Nov 1, 2024
1 parent 914363e commit 2a914d6
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 41 deletions.
1 change: 1 addition & 0 deletions jetstream/src/internal_mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export type {
export type { StreamNames } from "./jsbaseclient_api.ts";
export type {
AccountLimits,
ApiError,
ApiPagedRequest,
ClusterInfo,
ConsumerConfig,
Expand Down
1 change: 1 addition & 0 deletions jetstream/src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type {
AbortOnMissingResource,
AccountLimits,
Advisory,
ApiError,
ApiPagedRequest,
Bind,
BoundPushConsumerOptions,
Expand Down
12 changes: 1 addition & 11 deletions kv/src/kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ import type {
KvEntry,
KvOptions,
KvPutOptions,
KvRemove,
KvStatus,
KvWatchEntry,
KvWatchOptions,
Expand Down Expand Up @@ -263,7 +262,7 @@ export class Kvm {
}
}

export class Bucket implements KV, KvRemove {
export class Bucket implements KV {
js: JetStreamClient;
jsm: JetStreamManager;
stream!: string;
Expand Down Expand Up @@ -328,20 +327,11 @@ export class Bucket implements KV, KvRemove {
this.stream = sc.name = opts.streamName ?? this.bucketName();
sc.retention = RetentionPolicy.Limits;
sc.max_msgs_per_subject = bo.history;
if (bo.maxBucketSize) {
bo.max_bytes = bo.maxBucketSize;
}
if (bo.max_bytes) {
sc.max_bytes = bo.max_bytes;
}
sc.max_msg_size = bo.maxValueSize;
sc.storage = bo.storage;
const location = opts.placementCluster ?? "";
if (location) {
opts.placement = {} as Placement;
opts.placement.cluster = location;
opts.placement.tags = [];
}
if (opts.placement) {
sc.placement = opts.placement;
}
Expand Down
27 changes: 1 addition & 26 deletions kv/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ export interface KvLimits {
* The maximum number of bytes on the KV
*/
max_bytes: number;
/**
* @deprecated use max_bytes
*/
maxBucketSize: number;

/**
* The maximum size of a value on the KV
*/
Expand Down Expand Up @@ -121,10 +118,6 @@ export interface KvLimits {
* List of Stream names to replicate into this KV
*/
sources?: StreamSource[];
/**
* @deprecated: use placement
*/
placementCluster: string;

/**
* deprecated: use storage
Expand All @@ -149,12 +142,6 @@ export interface KvStatus extends KvLimits {
*/
values: number;

/**
* @deprecated
* FIXME: remove this on 1.8
*/
bucket_location: string;

/**
* The StreamInfo backing up the KV
*/
Expand Down Expand Up @@ -203,13 +190,6 @@ export interface KvOptions extends KvLimits {
metadata?: Record<string, string>;
}

/**
* @deprecated use purge(k)
*/
export interface KvRemove {
remove(k: string): Promise<void>;
}

export enum KvWatchInclude {
/**
* Include the last value for all the keys
Expand Down Expand Up @@ -281,11 +261,6 @@ export interface RoKV {
opts?: KvWatchOptions,
): Promise<QueuedIterator<KvWatchEntry>>;

/**
* @deprecated - this api is removed.
*/
close(): Promise<void>;

/**
* Returns information about the Kv
*/
Expand Down
1 change: 1 addition & 0 deletions obj/src/internal_mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type {
ObjectStoreOptions,
ObjectStorePutOpts,
ObjectStoreStatus,
ObjectWatchInfo,
Placement,
} from "./types.ts";

Expand Down
1 change: 1 addition & 0 deletions obj/src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type {
ObjectStoreOptions,
ObjectStorePutOpts,
ObjectStoreStatus,
ObjectWatchInfo,
Placement,
} from "./internal_mod.ts";

Expand Down
5 changes: 1 addition & 4 deletions obj/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ export type ObjectStoreStatus = {
*/
compression: boolean;
};
/**
* @deprecated {@link ObjectStoreStatus}
*/
export type ObjectStoreInfo = ObjectStoreStatus;

export type ObjectStoreOptions = {
/**
* A description for the object store
Expand Down

0 comments on commit 2a914d6

Please sign in to comment.