Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@interval/sdk

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interval/sdk - npm Package Compare versions

Comparing version 0.20.0 to 0.21.0

74

dist/classes/IOClient.d.ts

@@ -7,3 +7,3 @@ /// <reference types="node" />

import { IOPromise } from './IOPromise';
import { IORenderSender, ResponseHandlerFn, MaybeOptionalGroupIOPromise, GroupIOPromise, OptionalGroupIOPromise, IOComponentFunction, ExclusiveIOComponentFunction, IOComponentDefinition } from '../types';
import { IORenderSender, ResponseHandlerFn, MaybeOptionalGroupIOPromise, GroupIOPromise, OptionalGroupIOPromise, IOComponentFunction, ExclusiveIOComponentFunction, IOComponentDefinition, RequiredPropsIOComponentFunction, RequiredPropsExclusiveIOComponentFunction } from '../types';
interface ClientConfig {

@@ -50,3 +50,4 @@ logger: Logger;

group(ioPromises: MaybeOptionalGroupIOPromise[]): Promise<ReturnType<MaybeOptionalGroupIOPromise['getValue']>>;
createIOMethod<MethodName extends T_IO_METHOD_NAMES, Props extends object = T_IO_PROPS<MethodName>, Output = T_IO_RETURNS<MethodName>>(methodName: MethodName, componentDef?: IOComponentDefinition<MethodName, Props, Output>): IOComponentFunction<MethodName, Props, Output>;
createIOMethod<MethodName extends T_IO_METHOD_NAMES, Props extends object = T_IO_PROPS<MethodName>, Output = T_IO_RETURNS<MethodName>>(methodName: MethodName, propsRequired?: false, componentDef?: IOComponentDefinition<MethodName, Props, Output>): IOComponentFunction<MethodName, Props, Output>;
createIOMethod<MethodName extends T_IO_METHOD_NAMES, Props extends object = T_IO_PROPS<MethodName>, Output = T_IO_RETURNS<MethodName>>(methodName: MethodName, propsRequired?: true, componentDef?: IOComponentDefinition<MethodName, Props, Output>): RequiredPropsIOComponentFunction<MethodName, Props, Output>;
/**

@@ -56,3 +57,4 @@ * A very thin wrapper function that converts an IOPromise to an

*/
makeExclusive<MethodName extends T_IO_METHOD_NAMES, Props, Output>(inner: IOComponentFunction<MethodName, Props, Output>): ExclusiveIOComponentFunction<MethodName, Props, Output>;
makeExclusive<MethodName extends T_IO_METHOD_NAMES, Props, Output>(inner: IOComponentFunction<MethodName, Props, Output>, propsRequired?: false): ExclusiveIOComponentFunction<MethodName, Props, Output>;
makeExclusive<MethodName extends T_IO_METHOD_NAMES, Props, Output>(inner: IOComponentFunction<MethodName, Props, Output>, propsRequired?: true): RequiredPropsExclusiveIOComponentFunction<MethodName, Props, Output>;
/**

@@ -69,3 +71,3 @@ * The namespace of IO functions available in action handlers.

}, boolean>;
search: <Result = any>(label: string, props?: {
search: <Result = any>(label: string, props: {
placeholder?: string | undefined;

@@ -80,3 +82,3 @@ helpText?: string | undefined;

onSearch: (query: string) => Promise<Result[]>;
} | undefined) => IOPromise<"SEARCH", {
}) => IOPromise<"SEARCH", {
helpText?: string | undefined;

@@ -127,3 +129,8 @@ placeholder?: string | undefined;

select: {
single: <Props extends {
single: <Option extends string | {
description?: string | null | undefined;
imageUrl?: string | null | undefined;
value: string;
label: string;
}>(label: string, props: Omit<{
helpText?: string | undefined;

@@ -143,3 +150,6 @@ defaultValue?: {

}[];
}>(label: string, props?: Props | undefined) => IOPromise<"SELECT_SINGLE", {
}, "options" | "defaultValue"> & {
options: Option[];
defaultValue?: Option | undefined;
}) => IOPromise<"SELECT_SINGLE", {
helpText?: string | undefined;

@@ -159,4 +169,7 @@ defaultValue?: {

}[];
}, Props["options"][0]>;
multiple: <Props_1 extends {
}, Option>;
multiple: <Option_1 extends string | {
value: string;
label: string;
}>(label: string, props: Omit<{
helpText?: string | undefined;

@@ -173,3 +186,6 @@ defaultValue?: {

}[];
}>(label: string, props?: Props_1 | undefined) => IOPromise<"SELECT_MULTIPLE", {
}, "options" | "defaultValue"> & {
options: Option_1[];
defaultValue?: Option_1[] | undefined;
}) => IOPromise<"SELECT_MULTIPLE", {
helpText?: string | undefined;

@@ -186,3 +202,3 @@ defaultValue?: {

}[];
}, Props_1["options"]>;
}, Option_1[]>;
table: <Row extends Record<string, string | number | bigint | boolean | Date | {

@@ -194,3 +210,3 @@ value?: string | number | boolean | Date | null | undefined;

label: string;
} | null | undefined> | {} = any>(label: string, props?: (Omit<{
} | null | undefined> | {} = any>(label: string, props: Omit<{
helpText?: string | undefined;

@@ -220,4 +236,4 @@ columns?: {

data: Row[];
columns?: import("../components/table").Column<Row>[] | undefined;
}) | undefined) => IOPromise<"SELECT_TABLE", {
columns?: (string | import("../components/table").Column<Row>)[] | undefined;
}) => IOPromise<"SELECT_TABLE", {
helpText?: string | undefined;

@@ -263,3 +279,3 @@ columns?: {

}, null>;
table: <Row_1 = any>(label: string, props?: (Omit<{
table: <Row_1 = any>(label: string, props: Omit<{
helpText?: string | undefined;

@@ -288,4 +304,4 @@ columns?: {

data: Row_1[];
columns?: import("../components/table").Column<Row_1>[] | undefined;
}) | undefined) => IOPromise<"DISPLAY_TABLE", {
columns?: (string | import("../components/table").Column<Row_1>)[] | undefined;
}) => IOPromise<"DISPLAY_TABLE", {
helpText?: string | undefined;

@@ -315,3 +331,3 @@ columns?: {

experimental: {
spreadsheet: <Columns extends Record<string, "string" | "string?" | "number" | "number?" | "boolean" | "boolean?">>(label: string, props?: (Omit<{
spreadsheet: <Columns extends Record<string, "string" | "string?" | "number" | "number?" | "boolean" | "boolean?">>(label: string, props: Omit<{
helpText?: string | undefined;

@@ -330,3 +346,3 @@ defaultValue?: Record<string, string | number | boolean | null | undefined>[] | undefined;

}[Columns[key]]>; }[] | undefined;
}) | undefined) => IOPromise<"INPUT_SPREADSHEET", {
}) => IOPromise<"INPUT_SPREADSHEET", {
helpText?: string | undefined;

@@ -343,22 +359,2 @@ defaultValue?: Record<string, string | number | boolean | null | undefined>[] | undefined;

}[Columns[key_1]]>; }[]>;
findAndSelectUser: IOComponentFunction<"SELECT_USER", {
userList: {
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}[];
} & {
onSearch: (query: string) => Promise<{
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}[]>;
}, {
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}>;
date: IOComponentFunction<"INPUT_DATE", Omit<{

@@ -365,0 +361,0 @@ helpText?: string | undefined;

@@ -36,3 +36,2 @@ "use strict";

const table_1 = require("../components/table");
const selectUser_1 = __importDefault(require("../components/selectUser"));
const selectSingle_1 = __importDefault(require("../components/selectSingle"));

@@ -43,2 +42,3 @@ const search_1 = __importDefault(require("../components/search"));

const upload_1 = require("../components/upload");
const deserialize_1 = require("../utils/deserialize");
/**

@@ -81,3 +81,3 @@ * The client class that handles IO calls for a given transaction.

.map(({ props, ...renderInfo }) => {
const { json, meta } = superjson.serialize(props);
const { json, meta } = superjson.serialize((0, deserialize_1.stripUndefined)(props));
return {

@@ -156,3 +156,3 @@ ...renderInfo,

}
createIOMethod(methodName, componentDef) {
createIOMethod(methodName, _propsRequired = false, componentDef) {
return (label, props) => {

@@ -184,7 +184,3 @@ let internalProps = props ? props : {};

}
/**
* A very thin wrapper function that converts an IOPromise to an
* ExclusiveIOPromise, which cannot be rendered in a group.
*/
makeExclusive(inner) {
makeExclusive(inner, _propsRequired = false) {
return (label, props) => {

@@ -201,3 +197,3 @@ return new IOPromise_1.ExclusiveIOPromise(inner(label, props));

confirm: this.makeExclusive(this.createIOMethod('CONFIRM')),
search: this.createIOMethod('SEARCH', search_1.default),
search: this.createIOMethod('SEARCH', true, search_1.default),
input: {

@@ -211,5 +207,5 @@ text: this.createIOMethod('INPUT_TEXT'),

select: {
single: this.createIOMethod('SELECT_SINGLE', selectSingle_1.default),
multiple: this.createIOMethod('SELECT_MULTIPLE', selectMultiple_1.default),
table: this.createIOMethod('SELECT_TABLE', table_1.selectTable),
single: this.createIOMethod('SELECT_SINGLE', true, selectSingle_1.default),
multiple: this.createIOMethod('SELECT_MULTIPLE', true, selectMultiple_1.default),
table: this.createIOMethod('SELECT_TABLE', true, (0, table_1.selectTable)(this.logger)),
},

@@ -221,12 +217,11 @@ display: {

object: this.createIOMethod('DISPLAY_OBJECT'),
table: this.createIOMethod('DISPLAY_TABLE', table_1.displayTable),
table: this.createIOMethod('DISPLAY_TABLE', true, (0, table_1.displayTable)(this.logger)),
},
experimental: {
spreadsheet: this.createIOMethod('INPUT_SPREADSHEET', spreadsheet_1.default),
findAndSelectUser: this.createIOMethod('SELECT_USER', selectUser_1.default),
date: this.createIOMethod('INPUT_DATE', inputDate_1.date),
spreadsheet: this.createIOMethod('INPUT_SPREADSHEET', true, spreadsheet_1.default),
date: this.createIOMethod('INPUT_DATE', false, inputDate_1.date),
time: this.createIOMethod('INPUT_TIME'),
datetime: this.createIOMethod('INPUT_DATETIME', inputDate_1.datetime),
datetime: this.createIOMethod('INPUT_DATETIME', false, inputDate_1.datetime),
input: {
file: this.createIOMethod('UPLOAD_FILE', upload_1.file),
file: this.createIOMethod('UPLOAD_FILE', false, upload_1.file),
},

@@ -233,0 +228,0 @@ },

@@ -31,3 +31,5 @@ import { T_IO_METHOD_NAMES, T_IO_PROPS, T_IO_STATE } from '../ioSchema';

get component(): IOComponent<MethodName>;
optional(): OptionalIOPromise<MethodName, Props, Output>;
optional(isOptional?: true): OptionalIOPromise<MethodName, Props, Output>;
optional(isOptional?: false): IOPromise<MethodName, Props, Output>;
optional(isOptional?: boolean): OptionalIOPromise<MethodName, Props, Output> | IOPromise<MethodName, Props, Output>;
}

@@ -34,0 +36,0 @@ /**

@@ -43,4 +43,4 @@ "use strict";

}
optional() {
return new OptionalIOPromise(this);
optional(isOptional = true) {
return isOptional ? new OptionalIOPromise(this) : this;
}

@@ -47,0 +47,0 @@ }

@@ -7,3 +7,3 @@ import type { T_IO_RETURNS, T_IO_STATE } from '../ioSchema';

};
export default function search<Result = any>({ onSearch, initialResults, placeholder, renderResult, helpText, }: {
export default function search<Result = any>({ onSearch, initialResults, renderResult, ...rest }: {
placeholder?: string;

@@ -10,0 +10,0 @@ helpText?: string;

@@ -7,3 +7,3 @@ "use strict";

const IOError_1 = __importDefault(require("../classes/IOError"));
function search({ onSearch, initialResults = [], placeholder, renderResult, helpText, }) {
function search({ onSearch, initialResults = [], renderResult, ...rest }) {
// We maintain the last two batches of results to avoid race conditions regarding

@@ -32,4 +32,3 @@ // host-side searching and client-side selection.

const props = {
placeholder,
helpText,
...rest,
results: renderResults(initialResults),

@@ -36,0 +35,0 @@ };

@@ -1,4 +0,9 @@

import { T_IO_PROPS, T_IO_RETURNS } from '../ioSchema';
export default function selectMultiple<Props extends T_IO_PROPS<'SELECT_MULTIPLE'>>(props: Props): {
props: Props & {
import { z } from 'zod';
import { T_IO_PROPS, T_IO_RETURNS, labelValue } from '../ioSchema';
declare type SelectMultipleProps<Option extends z.infer<typeof labelValue> | string> = Omit<T_IO_PROPS<'SELECT_MULTIPLE'>, 'options' | 'defaultValue'> & {
options: Option[];
defaultValue?: Option[];
};
export default function selectMultiple<Option extends z.infer<typeof labelValue> | string>(props: SelectMultipleProps<Option>): {
props: {
defaultValue: {

@@ -12,4 +17,8 @@ value: string;

}[];
helpText?: string | undefined;
minSelections?: number | undefined;
maxSelections?: number | undefined;
};
getValue(response: T_IO_RETURNS<'SELECT_MULTIPLE'>): Props["options"];
getValue(response: T_IO_RETURNS<'SELECT_MULTIPLE'>): Option[];
};
export {};

@@ -6,3 +6,25 @@ "use strict";

var _a;
const optionMap = new Map(props.options.map(o => [o.value, o]));
const normalizedOptions = props.options.map(option => {
if (typeof option === 'string') {
return {
label: option,
value: option,
};
}
else {
return option;
}
});
const optionMap = new Map(normalizedOptions.map((o, i) => [o.value, props.options[i]]));
const defaultValue = (_a = props.defaultValue) === null || _a === void 0 ? void 0 : _a.map(d => {
if (typeof d === 'string') {
return {
label: d,
value: d,
};
}
else {
return d;
}
});
const stripper = ioSchema_1.labelValue.strip();

@@ -12,4 +34,4 @@ return {

...props,
defaultValue: (_a = props.defaultValue) === null || _a === void 0 ? void 0 : _a.map(o => stripper.parse(o)),
options: props.options.map(o => stripper.parse(o)),
defaultValue: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.map(o => stripper.parse(o)),
options: normalizedOptions.map(o => stripper.parse(o)),
},

@@ -16,0 +38,0 @@ getValue(response) {

@@ -1,4 +0,9 @@

import { T_IO_PROPS, T_IO_RETURNS } from '../ioSchema';
export default function selectSingle<Props extends T_IO_PROPS<'SELECT_SINGLE'>>(props: Props): {
props: Props & {
import { z } from 'zod';
import { T_IO_PROPS, T_IO_RETURNS, richSelectOption } from '../ioSchema';
declare type SelectSingleProps<Option extends z.infer<typeof richSelectOption> | string> = Omit<T_IO_PROPS<'SELECT_SINGLE'>, 'options' | 'defaultValue'> & {
options: Option[];
defaultValue?: Option;
};
export default function selectSingle<Option extends z.infer<typeof richSelectOption> | string>(props: SelectSingleProps<Option>): {
props: {
defaultValue: {

@@ -16,4 +21,7 @@ description?: string | null | undefined;

}[];
helpText?: string | undefined;
searchable?: boolean | undefined;
};
getValue(response: T_IO_RETURNS<'SELECT_SINGLE'>): Props["options"][0];
getValue(response: T_IO_RETURNS<'SELECT_SINGLE'>): Option;
};
export {};

@@ -5,11 +5,26 @@ "use strict";

function selectSingle(props) {
const optionMap = new Map(props.options.map(o => [o.value, o]));
const normalizedOptions = props.options.map(option => {
if (typeof option === 'string') {
return {
label: option,
value: option,
};
}
else {
return option;
}
});
const optionMap = new Map(normalizedOptions.map((o, i) => [o.value, props.options[i]]));
const stripper = ioSchema_1.richSelectOption.strip();
const defaultValue = typeof props.defaultValue === 'string'
? {
label: props.defaultValue,
value: props.defaultValue,
}
: props.defaultValue;
return {
props: {
...props,
defaultValue: props.defaultValue
? stripper.parse(props.defaultValue)
: undefined,
options: props.options.map(o => stripper.parse(o)),
defaultValue: defaultValue ? stripper.parse(defaultValue) : undefined,
options: normalizedOptions.map(o => stripper.parse(o)),
},

@@ -16,0 +31,0 @@ getValue(response) {

import { z } from 'zod';
import { T_IO_PROPS, tableColumn, tableRow, T_IO_RETURNS, serializableRecord } from '../ioSchema';
import { T_IO_PROPS, tableColumn, T_IO_RETURNS, serializableRecord } from '../ioSchema';
import Logger from '../classes/Logger';
export declare type CellValue = string | number | boolean | null | Date | undefined;

@@ -17,6 +18,35 @@ export declare type ColumnResult = ({

}
export declare function selectTable<Row extends z.input<typeof tableRow> = any>(props: Omit<T_IO_PROPS<'SELECT_TABLE'>, 'data' | 'columns'> & {
export declare function selectTable(logger: Logger): <Row extends Record<string, string | number | bigint | boolean | Date | {
value?: string | number | boolean | Date | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;
href?: string | undefined;
action?: string | undefined;
label: string;
} | null | undefined> | {} = any>(props: Omit<{
helpText?: string | undefined;
columns?: {
label: string;
}[] | undefined;
minSelections?: number | undefined;
maxSelections?: number | undefined;
data: (Record<string, string | number | bigint | boolean | Date | {
value?: string | number | boolean | Date | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;
href?: string | undefined;
action?: string | undefined;
label: string;
} | null | undefined> | {} | {
data: Record<string, string | number | bigint | boolean | Date | {
value?: string | number | boolean | Date | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;
href?: string | undefined;
action?: string | undefined;
label: string;
} | null | undefined> | {};
key: string;
})[];
}, "data" | "columns"> & {
data: Row[];
columns?: Column<Row>[];
}): {
columns?: (string | Column<Row>)[] | undefined;
}) => {
props: {

@@ -58,6 +88,28 @@ data: (Record<string, string | number | bigint | boolean | Date | {

};
export declare function displayTable<Row = any>(props: Omit<T_IO_PROPS<'DISPLAY_TABLE'>, 'data' | 'columns'> & {
export declare function displayTable(logger: Logger): <Row = any>(props: Omit<{
helpText?: string | undefined;
columns?: {
label: string;
}[] | undefined;
orientation?: "vertical" | "horizontal" | undefined;
data: (Record<string, string | number | bigint | boolean | Date | {
value?: string | number | boolean | Date | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;
href?: string | undefined;
action?: string | undefined;
label: string;
} | null | undefined> | {} | {
data: Record<string, string | number | bigint | boolean | Date | {
value?: string | number | boolean | Date | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;
href?: string | undefined;
action?: string | undefined;
label: string;
} | null | undefined> | {};
key: string;
})[];
}, "data" | "columns"> & {
data: Row[];
columns?: Column<Row>[];
}): {
columns?: (string | Column<Row>)[] | undefined;
}) => {
props: {

@@ -64,0 +116,0 @@ data: (Record<string, string | number | bigint | boolean | Date | {

@@ -5,26 +5,33 @@ "use strict";

const table_1 = require("../utils/table");
function selectTable(props) {
const columns = (0, table_1.columnsBuilder)(props);
const data = props.data.map((row, idx) => (0, table_1.tableRowSerializer)(idx, row, columns));
return {
props: { ...props, data, columns },
getValue(response) {
const indices = response.map(row => Number(row.key));
const rows = props.data.filter((_, idx) => indices.includes(idx));
return rows;
},
function missingColumnMessage(component) {
return (column) => `Provided column "${column}" not found in data for ${component}`;
}
function selectTable(logger) {
return function (props) {
const columns = (0, table_1.columnsBuilder)(props, column => logger.error(missingColumnMessage('io.select.table')(column)));
const data = props.data.map((row, idx) => (0, table_1.tableRowSerializer)(idx, row, columns));
return {
props: { ...props, data, columns },
getValue(response) {
const indices = response.map(row => Number(row.key));
const rows = props.data.filter((_, idx) => indices.includes(idx));
return rows;
},
};
};
}
exports.selectTable = selectTable;
function displayTable(props) {
const columns = (0, table_1.columnsBuilder)(props);
const data = props.data.map((row, idx) => (0, table_1.tableRowSerializer)(idx, row, columns));
return {
props: {
...props,
data,
columns,
},
function displayTable(logger) {
return function displayTable(props) {
const columns = (0, table_1.columnsBuilder)(props, column => logger.error(missingColumnMessage('io.display.table')(column)));
const data = props.data.map((row, idx) => (0, table_1.tableRowSerializer)(idx, row, columns));
return {
props: {
...props,
data,
columns,
},
};
};
}
exports.displayTable = displayTable;

@@ -69,7 +69,13 @@ import { z } from 'zod';

slug: z.ZodString;
name: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
backgroundable: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;
slug: string;
}, {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;

@@ -223,7 +229,13 @@ slug: string;

slug: z.ZodString;
name: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
backgroundable: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;
slug: string;
}, {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;

@@ -237,2 +249,4 @@ slug: string;

actions: {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;

@@ -246,2 +260,4 @@ slug: string;

actions: {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;

@@ -484,7 +500,13 @@ slug: string;

slug: z.ZodString;
name: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
backgroundable: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;
slug: string;
}, {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;

@@ -495,2 +517,4 @@ slug: string;

actions: {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;

@@ -501,2 +525,4 @@ slug: string;

actions: {
description?: string | undefined;
name?: string | undefined;
backgroundable?: boolean | undefined;

@@ -503,0 +529,0 @@ slug: string;

@@ -32,2 +32,4 @@ "use strict";

slug: zod_1.z.string(),
name: zod_1.z.string().optional(),
description: zod_1.z.string().optional(),
backgroundable: zod_1.z.boolean().optional(),

@@ -34,0 +36,0 @@ });

@@ -1218,59 +1218,2 @@ import { z } from 'zod';

};
SELECT_USER: {
props: z.ZodObject<{
userList: z.ZodArray<z.ZodObject<{
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
name: z.ZodString;
email: z.ZodOptional<z.ZodString>;
imageUrl: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}, {
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
userList: {
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}[];
}, {
userList: {
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}[];
}>;
state: z.ZodObject<{
queryTerm: z.ZodString;
}, "strip", z.ZodTypeAny, {
queryTerm: string;
}, {
queryTerm: string;
}>;
returns: z.ZodObject<{
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
name: z.ZodString;
email: z.ZodOptional<z.ZodString>;
imageUrl: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}, {
imageUrl?: string | undefined;
email?: string | undefined;
id: string | number;
name: string;
}>;
};
DISPLAY_HEADING: {

@@ -1277,0 +1220,0 @@ props: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;

@@ -348,19 +348,2 @@ "use strict";

},
SELECT_USER: {
props: zod_1.z.object({
userList: zod_1.z.array(zod_1.z.object({
id: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
name: zod_1.z.string(),
email: zod_1.z.string().optional(),
imageUrl: zod_1.z.string().optional(),
})),
}),
state: zod_1.z.object({ queryTerm: zod_1.z.string() }),
returns: zod_1.z.object({
id: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
name: zod_1.z.string(),
email: zod_1.z.string().optional(),
imageUrl: zod_1.z.string().optional(),
}),
},
DISPLAY_HEADING: {

@@ -367,0 +350,0 @@ props: zod_1.z.object({}),

@@ -11,3 +11,3 @@ "use strict";

const writeFile = util_1.default.promisify(fs_1.default.writeFile);
const removeFile = util_1.default.promisify(fs_1.default.rm);
const removeFile = util_1.default.promisify(fs_1.default.unlink);
const readFile = util_1.default.promisify(fs_1.default.readFile);

@@ -14,0 +14,0 @@ /*

@@ -32,4 +32,8 @@ import type { z } from 'zod';

backgroundable?: boolean;
name?: string;
description?: string;
}
export declare type IntervalActionDefinition = IntervalActionHandler | ExplicitIntervalActionDefinition;
export declare type RequiredPropsIOComponentFunction<MethodName extends T_IO_METHOD_NAMES, Props, Output = ComponentReturnValue<MethodName>> = (label: string, props: Props) => IOPromise<MethodName, T_IO_PROPS<MethodName>, Output>;
export declare type RequiredPropsExclusiveIOComponentFunction<MethodName extends T_IO_METHOD_NAMES, Props, Output = ComponentReturnValue<MethodName>> = (label: string, props: Props) => ExclusiveIOPromise<MethodName, T_IO_PROPS<MethodName>, Output>;
export declare type IOComponentFunction<MethodName extends T_IO_METHOD_NAMES, Props, Output = ComponentReturnValue<MethodName>> = (label: string, props?: Props) => IOPromise<MethodName, T_IO_PROPS<MethodName>, Output>;

@@ -36,0 +40,0 @@ export declare type ExclusiveIOComponentFunction<MethodName extends T_IO_METHOD_NAMES, Props, Output = ComponentReturnValue<MethodName>> = (label: string, props?: Props) => ExclusiveIOPromise<MethodName, T_IO_PROPS<MethodName>, Output>;

export declare function serializeDates<V extends any>(record: Record<string, V>): Record<string, Exclude<V, Date> | string>;
export declare function deserializeDates<V extends any>(record: Record<string, V>): Record<string, V | Date>;
export declare function stripUndefined<K extends string | number | symbol, V, T extends Record<K, V> | undefined>(obj: T): T;
"use strict";
// TODO: Remove this when all active SDKs support superjson
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserializeDates = exports.serializeDates = void 0;
exports.stripUndefined = exports.deserializeDates = exports.serializeDates = void 0;
function serializeDates(record) {

@@ -61,1 +61,13 @@ const ret = {};

exports.deserializeDates = deserializeDates;
function stripUndefined(obj) {
if (!obj)
return obj;
const newObj = { ...obj };
for (const [key, val] of Object.entries(newObj)) {
if (val === undefined) {
delete newObj[key];
}
}
return newObj;
}
exports.stripUndefined = stripUndefined;

@@ -7,5 +7,5 @@ import { tableColumn, internalTableColumn, tableRow, internalTableRow } from '../ioSchema';

export declare function columnsBuilder(props: {
columns?: z.infer<typeof tableColumn>[];
columns?: (z.infer<typeof tableColumn> | string)[];
data: z.infer<typeof tableRow>[];
}): z.infer<typeof tableColumn>[];
}, logMissingColumn: (column: string) => void): z.infer<typeof tableColumn>[];
/**

@@ -12,0 +12,0 @@ * Removes the `render` function from column defs before sending data up to the server.

@@ -7,5 +7,6 @@ "use strict";

*/
function columnsBuilder(props) {
function columnsBuilder(props, logMissingColumn) {
const dataColumns = new Set(props.data.flatMap(record => Object.keys(record)));
if (!props.columns) {
const labels = Array.from(new Set(props.data.flatMap(record => Object.keys(record))).values());
const labels = Array.from(dataColumns.values());
return labels.map(label => ({

@@ -16,3 +17,16 @@ label,

}
return props.columns;
return props.columns.map(column => {
if (typeof column === 'string') {
if (!dataColumns.has(column)) {
logMissingColumn(column);
}
return {
label: column,
renderCell: row => row[column],
};
}
else {
return column;
}
});
}

@@ -19,0 +33,0 @@ exports.columnsBuilder = columnsBuilder;

{
"name": "@interval/sdk",
"version": "0.20.0",
"version": "0.21.0",
"license": "MIT",
"engines": {
"node": ">=14"
"node": ">=12.17.0"
},

@@ -8,0 +8,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc