Skip to content

Commit

Permalink
Update build config
Browse files Browse the repository at this point in the history
  • Loading branch information
ogzhanolguncu committed Jan 11, 2024
1 parent 1de47e1 commit f269a72
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
RequesterConfig,
UpstashRequest,
UpstashResponse,
} from "@http/index";
} from "@http";
import * as core from "./src/vector";

export type { Requester, UpstashRequest, UpstashResponse };
Expand Down
16 changes: 13 additions & 3 deletions src/commands/command.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { UpstashError } from "@error/index";
import { Requester } from "@http/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 @@ -11,7 +18,10 @@ 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
17 changes: 11 additions & 6 deletions src/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ResetCommand,
UpsertCommand,
} from "@commands/client";
import { Requester } from "@http/index";
import { Requester } from "@http";

export type CommandArgs<TCommand extends new (_args: any) => any> =
ConstructorParameters<TCommand>[0];
Expand All @@ -32,10 +32,15 @@ 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);
}
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
Expand All @@ -19,7 +18,7 @@
],
"paths": {
"@commands/*": ["./src/commands/*"],
"@http/*": ["./src/http/*"],
"@http": ["./src/http/index.ts"],
"@utils/*": ["./src/utils/*"],
"@error/*": ["./src/error/*"]
}
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["src/index.ts"],
entry: ["./index.ts"],
format: ["cjs", "esm"],
sourcemap: false,
clean: true,
Expand Down

0 comments on commit f269a72

Please sign in to comment.