Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"useTabs": true,
"printWidth": 80,
"ignorePatterns": ["**/dist", "**/build", "**/node_modules", "**/.claude"],
"ignorePatterns": [
"**/dist",
"**/build",
"**/node_modules",
"**/.claude",
"__tests__/__snapshots__"
],
"sortPackageJson": {
"sortScripts": true
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { UndefinedOnPartialDeep } from "type-fest";

export type ListThingsCommandQuery = {
size?: `${number}` | string;
flag?: "true" | "false" | string;
nested?: {
"count"?: `${number}` | string;
};
};
export type ListThingsCommandInput = ListThingsCommandQuery;
export type ListThingsCommandOutput = string | undefined;
export type InputListThingsCommandResponse = UndefinedOnPartialDeep<ListThingsCommandOutput>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as v from "valibot";

export const inputOnlySchema = v.string();
export const onlySchema = v.pipe(v.string(), v.trim());
export const inputGetThingCommandResponseSchema = inputOnlySchema;
export const getThingCommandResponseSchema = onlySchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as v from "valibot";

export const inputOnlySchema = v.string();
export const onlySchema = v.pipe(v.string(), v.trim());
export const inputGetThingCommandResponseSchema = inputOnlySchema;
export const getThingCommandResponseSchema = onlySchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as v from "valibot";

export const inputOnlySchema = v.union([v.string(), v.number()]);
export const onlySchema = v.union([v.pipe(v.string(), v.trim()), v.number()]);
export const inputGetThingCommandResponseSchema = inputOnlySchema;
export const getThingCommandResponseSchema = onlySchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as v from "valibot";

export const inputConfigSchema = v.objectWithRest(
{
"name": v.optional(v.string())
,
}, v.number());
export const configSchema = v.objectWithRest(
{
"name": v.exactOptional(v.pipe(v.string(), v.trim()))
,
}, v.number());
export const inputGetThingCommandResponseSchema = inputConfigSchema;
export const getThingCommandResponseSchema = configSchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as v from "valibot";

export const inputOpenSchema = v.looseObject(
{
"a": v.optional(v.string())
,
});
export const openSchema = v.looseObject(
{
"a": v.exactOptional(v.pipe(v.string(), v.trim()))
,
});
export const inputGetThingCommandResponseSchema = inputOpenSchema;
export const getThingCommandResponseSchema = openSchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as v from "valibot";

export const inputOpenSchema = v.strictObject(
{
"a": v.optional(v.string())
,
});
export const openSchema = v.strictObject(
{
"a": v.exactOptional(v.pipe(v.string(), v.trim()))
,
});
export const inputGetThingCommandResponseSchema = inputOpenSchema;
export const getThingCommandResponseSchema = openSchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as v from "valibot";

export const inputOpenSchema = v.objectWithRest(
{
"a": v.optional(v.string())
,
}, v.string());
export const openSchema = v.objectWithRest(
{
"a": v.exactOptional(v.pipe(v.string(), v.trim()))
,
}, v.pipe(v.string(), v.trim()));
export const inputGetThingCommandResponseSchema = inputOpenSchema;
export const getThingCommandResponseSchema = openSchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as v from "valibot";

export const inputOpenSchema = v.looseObject(
{
"a": v.optional(v.string())
,
});
export const openSchema = v.looseObject(
{
"a": v.exactOptional(v.pipe(v.string(), v.trim()))
,
});
export const inputGetThingCommandResponseSchema = inputOpenSchema;
export const getThingCommandResponseSchema = openSchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as v from "valibot";

export const inputOpenSchema = v.looseObject(
{
"name": v.optional(v.string())
,
});
export const openSchema = v.looseObject(
{
"name": v.exactOptional(v.pipe(v.string(), v.trim()))
,
});
export const inputGetThingCommandResponseSchema = inputOpenSchema;
export const getThingCommandResponseSchema = openSchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { UndefinedOnPartialDeep } from "type-fest";

export type Labels = Record<string | number, string>;
export type GetThingCommandInput = never;
export type InputGetThingCommandResponse = UndefinedOnPartialDeep<Labels>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as v from "valibot";

export const inputLabelsSchema = v.record(v.string(), v.string());
export const labelsSchema = inputLabelsSchema;
export const inputGetThingCommandResponseSchema = inputLabelsSchema;
export const getThingCommandResponseSchema = labelsSchema;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { RestServiceClient, type RestServiceClientConfig } from "@block65/rest-client";
import type { UndefinedOnPartialDeep } from "type-fest";
import type { AlphaCommandOutput, BetaCommandOutput, GammaCommandOutput, WithBodyCommandInput, WithBodyCommandOutput, WithQueryCommandInput, WithQueryCommandOutput } from "./types.js";

export { ResponseValidationError } from "@block65/rest-client";

type AllInputs = UndefinedOnPartialDeep<WithBodyCommandInput> | UndefinedOnPartialDeep<WithQueryCommandInput>;
type AllOutputs = AlphaCommandOutput | BetaCommandOutput | GammaCommandOutput | WithBodyCommandOutput | WithQueryCommandOutput;

export class TestRestClient extends RestServiceClient<AllInputs, AllOutputs> {
constructor(baseUrl: string | URL = new URL('https://api.example.com/'), config?: RestServiceClientConfig) {
super(baseUrl, config);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Command, stripUndefined, jsonStringify } from "@block65/rest-client";
import type { UndefinedOnPartialDeep } from "type-fest";
import type { PluginPullCommandQuery, PluginPullCommandInput, PluginPullCommandOutput } from "./types.js";


/**
* PluginPullCommand
*
*/
export class PluginPullCommand extends Command<UndefinedOnPartialDeep<PluginPullCommandInput>, PluginPullCommandOutput, PluginPullCommandQuery> {
public override method = "post" as const;

constructor(input: UndefinedOnPartialDeep<PluginPullCommandInput>) {
const {remote, body } = input;
super("/plugins/pull", jsonStringify(body), stripUndefined({remote}));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { UndefinedOnPartialDeep } from "type-fest";

export type PluginPullCommandQuery = {
remote: string;
};
type PluginPullCommandJsonBody = readonly (string)[];
export type PluginPullCommandBody = PluginPullCommandJsonBody;
type PluginPullCommandBodyWrapper = {
body: PluginPullCommandJsonBody;
};
export type PluginPullCommandInput = PluginPullCommandBodyWrapper & PluginPullCommandQuery;
export type PluginPullCommandOutput = string | undefined;
export type InputPluginPullCommandResponse = UndefinedOnPartialDeep<PluginPullCommandOutput>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Jsonifiable, UndefinedOnPartialDeep } from "type-fest";

export type Empty = Record<string | number, Jsonifiable>;
export type GetThingCommandInput = never;
export type InputGetThingCommandResponse = UndefinedOnPartialDeep<Empty>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Command } from "@block65/rest-client";
import type { UndefinedOnPartialDeep } from "type-fest";
import type { SystemAuthCommandInput, SystemAuthCommandOutput } from "./types.js";


/**
* SystemAuthCommand
*
*/
export class SystemAuthCommand extends Command<UndefinedOnPartialDeep<SystemAuthCommandInput>, SystemAuthCommandOutput> {
public override method = "post" as const;

constructor() {
super("/auth");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { UndefinedOnPartialDeep } from "type-fest";

type CreateContainerCommandJsonBody = {
"tty"?: boolean;
"retries"?: number;
"health"?: {
"interval"?: bigint;
"enabled"?: boolean;
};
"sizes"?: readonly (number)[];
};
export type CreateContainerCommandBody = CreateContainerCommandJsonBody;
export type CreateContainerCommandInput = CreateContainerCommandJsonBody;
export type CreateContainerCommandOutput = string | undefined;
export type InputCreateContainerCommandResponse = UndefinedOnPartialDeep<CreateContainerCommandOutput>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { RestServiceClient, type RestServiceClientConfig } from "@block65/rest-client";
import type { UndefinedOnPartialDeep } from "type-fest";
import type { OneCommandInput, OneCommandOutput } from "./types.js";

export { ResponseValidationError } from "@block65/rest-client";

type AllInputs = UndefinedOnPartialDeep<OneCommandInput>;
type AllOutputs = OneCommandOutput;

export class TestRestClient extends RestServiceClient<AllInputs, AllOutputs> {
constructor(baseUrl: string | URL = new URL('https://api.example.com/'), config?: RestServiceClientConfig) {
super(baseUrl, config);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { UndefinedOnPartialDeep } from "type-fest";

export type SearchCommandQuery = {
limit?: `${number}`;
filter?: {
"age"?: `${number}`;
"big"?: `${bigint}`;
"active"?: "true" | "false";
"label"?: string;
};
ids?: readonly (`${number}`)[];
};
export type SearchCommandInput = SearchCommandQuery;
export type SearchCommandOutput = string | undefined;
export type InputSearchCommandResponse = UndefinedOnPartialDeep<SearchCommandOutput>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { UndefinedOnPartialDeep } from "type-fest";

export type ListFilesCommandQuery = {
purpose?: string;
limit?: `${number}`;
};
export type ListFilesCommandInput = ListFilesCommandQuery;
export type ListFilesCommandOutput = string | undefined;
export type InputListFilesCommandResponse = UndefinedOnPartialDeep<ListFilesCommandOutput>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { UndefinedOnPartialDeep } from "type-fest";

type CreateBatchJsonBody = {
"input_file_id"?: string;
};
export type CreateBatchCommandBody = CreateBatchJsonBody;
export type CreateBatchCommandInput = CreateBatchJsonBody;
export type CreateBatchCommandOutput = string | undefined;
export type InputCreateBatchCommandResponse = UndefinedOnPartialDeep<CreateBatchCommandOutput>;
Loading
Loading