Skip to content

Commit 589db60

Browse files
committed
refactor: removed all API request validations.
1 parent 629ef5e commit 589db60

File tree

15 files changed

+13
-244
lines changed

15 files changed

+13
-244
lines changed

.changeset/dry-parents-wink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@squarecloud/api": patch
3+
---
4+
5+
Removed all API request validations.

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assertions/application.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/assertions/backup.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/assertions/common.ts

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import type * as z from "zod";
2-
3-
import type {
4-
APIObjectAssertionProps,
5-
LiteralAssertionProps,
6-
} from "@/types/assertions";
1+
import type { LiteralAssertionProps } from "@/types/assertions";
72
import { SquareCloudAPIError } from "../structures";
83

94
export function assertLiteral({
@@ -21,27 +16,3 @@ export function assertLiteral({
2116
);
2217
}
2318
}
24-
25-
export function assertAPIObject({
26-
schema,
27-
value,
28-
code,
29-
route,
30-
}: APIObjectAssertionProps) {
31-
const name = code.toLowerCase().replaceAll("_", " ");
32-
33-
try {
34-
schema.parse(value);
35-
} catch (err) {
36-
const cause = err.errors?.map((err: z.ZodIssue) => ({
37-
...err,
38-
path: err.path.join(" > "),
39-
}));
40-
41-
throw new SquareCloudAPIError(
42-
`INVALID_API_${code}`,
43-
`Invalid ${name} object received from API ${route}`,
44-
{ cause },
45-
);
46-
}
47-
}

src/assertions/deploy.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/assertions/status.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/assertions/user.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/structures/application/application.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { APIApplication } from "@squarecloud/api-types/v2";
22

3-
import { assertApplication } from "@/assertions/application";
43
import type { SquareCloudAPI } from "@/index";
54
import { BaseApplication } from "./base";
65
import type { WebsiteApplication } from "./website";
@@ -20,7 +19,6 @@ export class Application extends BaseApplication {
2019
public readonly client: SquareCloudAPI,
2120
data: APIApplication,
2221
) {
23-
assertApplication(data);
2422
super(client, { ...data, lang: data.language });
2523
}
2624

src/structures/application/website.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { APIWebsiteApplication } from "@squarecloud/api-types/v2";
22

3-
import { assertWebsiteApplication } from "@/assertions/application";
43
import type { SquareCloudAPI } from "@/index";
54
import { NetworkModule } from "@/modules";
65
import { Application } from "./application";
@@ -28,7 +27,6 @@ export class WebsiteApplication extends Application {
2827
public readonly client: SquareCloudAPI,
2928
data: APIWebsiteApplication,
3029
) {
31-
assertWebsiteApplication(data);
3230
super(client, data);
3331

3432
const { domain, custom } = data;

0 commit comments

Comments
 (0)