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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rehive",
"version": "4.1.3",
"version": "4.1.4",
"description": "SDK for Rehive Platform and Extensions",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
8 changes: 5 additions & 3 deletions src/extensions/alchemy/openapi-ts/client/client.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
...options,
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
headers: mergeHeaders(_config.headers, options.headers),
serializedBody: undefined,
serializedBody: undefined as string | undefined,
};

if (opts.security) {
Expand All @@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
}

if (opts.body !== undefined && opts.bodySerializer) {
opts.serializedBody = opts.bodySerializer(opts.body);
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
}

// remove Content-Type header if body is empty to avoid sending invalid requests
Expand Down Expand Up @@ -258,8 +258,10 @@ export const createClient = (config: Config = {}): Client => {
});
};

const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });

return {
buildUrl,
buildUrl: _buildUrl,
connect: makeMethodFn('CONNECT'),
delete: makeMethodFn('DELETE'),
get: makeMethodFn('GET'),
Expand Down
14 changes: 6 additions & 8 deletions src/extensions/alchemy/openapi-ts/core/bodySerializer.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize

export type QuerySerializer = (query: Record<string, unknown>) => string;

export type BodySerializer = (body: any) => any;
export type BodySerializer = (body: unknown) => unknown;

type QuerySerializerOptionsObject = {
allowReserved?: boolean;
Expand Down Expand Up @@ -39,12 +39,10 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
};

export const formDataBodySerializer = {
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
body: T,
): FormData => {
bodySerializer: (body: unknown): FormData => {
const data = new FormData();

Object.entries(body).forEach(([key, value]) => {
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
if (value === undefined || value === null) {
return;
}
Expand All @@ -60,15 +58,15 @@ export const formDataBodySerializer = {
};

export const jsonBodySerializer = {
bodySerializer: <T>(body: T): string =>
bodySerializer: (body: unknown): string =>
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
};

export const urlSearchParamsBodySerializer = {
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
bodySerializer: (body: unknown): string => {
const data = new URLSearchParams();

Object.entries(body).forEach(([key, value]) => {
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
if (value === undefined || value === null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/alchemy/openapi-ts/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ interface Params {

const stripEmptySlots = (params: Params) => {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Object.keys(value).length) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/extensions/app/openapi-ts/client/client.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
...options,
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
headers: mergeHeaders(_config.headers, options.headers),
serializedBody: undefined,
serializedBody: undefined as string | undefined,
};

if (opts.security) {
Expand All @@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
}

if (opts.body !== undefined && opts.bodySerializer) {
opts.serializedBody = opts.bodySerializer(opts.body);
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
}

// remove Content-Type header if body is empty to avoid sending invalid requests
Expand Down Expand Up @@ -258,8 +258,10 @@ export const createClient = (config: Config = {}): Client => {
});
};

const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });

return {
buildUrl,
buildUrl: _buildUrl,
connect: makeMethodFn('CONNECT'),
delete: makeMethodFn('DELETE'),
get: makeMethodFn('GET'),
Expand Down
14 changes: 6 additions & 8 deletions src/extensions/app/openapi-ts/core/bodySerializer.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize

export type QuerySerializer = (query: Record<string, unknown>) => string;

export type BodySerializer = (body: any) => any;
export type BodySerializer = (body: unknown) => unknown;

type QuerySerializerOptionsObject = {
allowReserved?: boolean;
Expand Down Expand Up @@ -39,12 +39,10 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
};

export const formDataBodySerializer = {
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
body: T,
): FormData => {
bodySerializer: (body: unknown): FormData => {
const data = new FormData();

Object.entries(body).forEach(([key, value]) => {
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
if (value === undefined || value === null) {
return;
}
Expand All @@ -60,15 +58,15 @@ export const formDataBodySerializer = {
};

export const jsonBodySerializer = {
bodySerializer: <T>(body: T): string =>
bodySerializer: (body: unknown): string =>
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
};

export const urlSearchParamsBodySerializer = {
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
bodySerializer: (body: unknown): string => {
const data = new URLSearchParams();

Object.entries(body).forEach(([key, value]) => {
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
if (value === undefined || value === null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/app/openapi-ts/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ interface Params {

const stripEmptySlots = (params: Params) => {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Object.keys(value).length) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/extensions/billing/openapi-ts/client/client.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
...options,
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
headers: mergeHeaders(_config.headers, options.headers),
serializedBody: undefined,
serializedBody: undefined as string | undefined,
};

if (opts.security) {
Expand All @@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
}

if (opts.body !== undefined && opts.bodySerializer) {
opts.serializedBody = opts.bodySerializer(opts.body);
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
}

// remove Content-Type header if body is empty to avoid sending invalid requests
Expand Down Expand Up @@ -258,8 +258,10 @@ export const createClient = (config: Config = {}): Client => {
});
};

const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });

return {
buildUrl,
buildUrl: _buildUrl,
connect: makeMethodFn('CONNECT'),
delete: makeMethodFn('DELETE'),
get: makeMethodFn('GET'),
Expand Down
14 changes: 6 additions & 8 deletions src/extensions/billing/openapi-ts/core/bodySerializer.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize

export type QuerySerializer = (query: Record<string, unknown>) => string;

export type BodySerializer = (body: any) => any;
export type BodySerializer = (body: unknown) => unknown;

type QuerySerializerOptionsObject = {
allowReserved?: boolean;
Expand Down Expand Up @@ -39,12 +39,10 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
};

export const formDataBodySerializer = {
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
body: T,
): FormData => {
bodySerializer: (body: unknown): FormData => {
const data = new FormData();

Object.entries(body).forEach(([key, value]) => {
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
if (value === undefined || value === null) {
return;
}
Expand All @@ -60,15 +58,15 @@ export const formDataBodySerializer = {
};

export const jsonBodySerializer = {
bodySerializer: <T>(body: T): string =>
bodySerializer: (body: unknown): string =>
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
};

export const urlSearchParamsBodySerializer = {
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
bodySerializer: (body: unknown): string => {
const data = new URLSearchParams();

Object.entries(body).forEach(([key, value]) => {
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
if (value === undefined || value === null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/billing/openapi-ts/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ interface Params {

const stripEmptySlots = (params: Params) => {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Object.keys(value).length) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/extensions/bridge/openapi-ts/client/client.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
...options,
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
headers: mergeHeaders(_config.headers, options.headers),
serializedBody: undefined,
serializedBody: undefined as string | undefined,
};

if (opts.security) {
Expand All @@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
}

if (opts.body !== undefined && opts.bodySerializer) {
opts.serializedBody = opts.bodySerializer(opts.body);
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
}

// remove Content-Type header if body is empty to avoid sending invalid requests
Expand Down Expand Up @@ -258,8 +258,10 @@ export const createClient = (config: Config = {}): Client => {
});
};

const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });

return {
buildUrl,
buildUrl: _buildUrl,
connect: makeMethodFn('CONNECT'),
delete: makeMethodFn('DELETE'),
get: makeMethodFn('GET'),
Expand Down
14 changes: 6 additions & 8 deletions src/extensions/bridge/openapi-ts/core/bodySerializer.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize

export type QuerySerializer = (query: Record<string, unknown>) => string;

export type BodySerializer = (body: any) => any;
export type BodySerializer = (body: unknown) => unknown;

type QuerySerializerOptionsObject = {
allowReserved?: boolean;
Expand Down Expand Up @@ -39,12 +39,10 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
};

export const formDataBodySerializer = {
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
body: T,
): FormData => {
bodySerializer: (body: unknown): FormData => {
const data = new FormData();

Object.entries(body).forEach(([key, value]) => {
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
if (value === undefined || value === null) {
return;
}
Expand All @@ -60,15 +58,15 @@ export const formDataBodySerializer = {
};

export const jsonBodySerializer = {
bodySerializer: <T>(body: T): string =>
bodySerializer: (body: unknown): string =>
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
};

export const urlSearchParamsBodySerializer = {
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
bodySerializer: (body: unknown): string => {
const data = new URLSearchParams();

Object.entries(body).forEach(([key, value]) => {
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
if (value === undefined || value === null) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/bridge/openapi-ts/core/params.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ interface Params {

const stripEmptySlots = (params: Params) => {
for (const [slot, value] of Object.entries(params)) {
if (value && typeof value === 'object' && !Object.keys(value).length) {
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
delete params[slot as Slot];
}
}
Expand Down
Loading