Skip to content

Commit

Permalink
Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
ogzhanolguncu committed Jan 11, 2024
1 parent f269a72 commit b4d345f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
14 changes: 2 additions & 12 deletions src/commands/command.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { UpstashError } from "@error/index";
import { Requester } from "@http";

const ENDPOINTS = [
"upsert",
"query",
"delete",
"fetch",
"reset",
"range",
] as const;
const ENDPOINTS = ["upsert", "query", "delete", "fetch", "reset", "range"] as const;

export type EndpointVariants = (typeof ENDPOINTS)[number];
/**
Expand All @@ -18,10 +11,7 @@ export class Command<TResult> {
public readonly payload: Record<string, unknown> | unknown[];
public readonly endpoint: EndpointVariants;

constructor(
command: Record<string, unknown> | unknown[],
endpoint: EndpointVariants
) {
constructor(command: Record<string, unknown> | unknown[], endpoint: EndpointVariants) {
this.payload = command;
this.endpoint = endpoint;
}
Expand Down
15 changes: 5 additions & 10 deletions src/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,10 @@ export class Index {
this.client = client;
}

delete = (args: CommandArgs<typeof DeleteCommand>) =>
new DeleteCommand(args).exec(this.client);
query = (args: CommandArgs<typeof QueryCommand>) =>
new QueryCommand(args).exec(this.client);
upsert = (args: CommandArgs<typeof UpsertCommand>) =>
new UpsertCommand(args).exec(this.client);
fetch = (args: CommandArgs<typeof FetchCommand>) =>
new FetchCommand(args).exec(this.client);
delete = (args: CommandArgs<typeof DeleteCommand>) => new DeleteCommand(args).exec(this.client);
query = (args: CommandArgs<typeof QueryCommand>) => new QueryCommand(args).exec(this.client);
upsert = (args: CommandArgs<typeof UpsertCommand>) => new UpsertCommand(args).exec(this.client);
fetch = (args: CommandArgs<typeof FetchCommand>) => new FetchCommand(args).exec(this.client);
reset = () => new ResetCommand().exec(this.client);
range = (args: CommandArgs<typeof RangeCommand>) =>
new RangeCommand(args).exec(this.client);
range = (args: CommandArgs<typeof RangeCommand>) => new RangeCommand(args).exec(this.client);
}

0 comments on commit b4d345f

Please sign in to comment.