@interval/sdk
Advanced tools
Comparing version 0.22.0 to 0.23.0
@@ -456,7 +456,7 @@ "use strict"; | ||
} | ||
const { actionName: actionSlug, transactionId } = inputs; | ||
const actionHandler = __classPrivateFieldGet(this, _IntervalClient_actionHandlers, "f")[actionSlug]; | ||
const { action, transactionId } = inputs; | ||
const actionHandler = __classPrivateFieldGet(this, _IntervalClient_actionHandlers, "f")[action.slug]; | ||
__classPrivateFieldGet(this, _IntervalClient_instances, "a", _IntervalClient_log_get).debug(actionHandler); | ||
if (!actionHandler) { | ||
__classPrivateFieldGet(this, _IntervalClient_instances, "a", _IntervalClient_log_get).debug('No actionHandler called', actionSlug); | ||
__classPrivateFieldGet(this, _IntervalClient_instances, "a", _IntervalClient_log_get).debug('No actionHandler called', action.slug); | ||
return; | ||
@@ -492,5 +492,3 @@ } | ||
organization: this.organization, | ||
action: { | ||
slug: actionSlug, | ||
}, | ||
action, | ||
log: (...args) => __classPrivateFieldGet(this, _IntervalClient_instances, "m", _IntervalClient_sendLog).call(this, transactionId, logIndex++, ...args), | ||
@@ -563,6 +561,6 @@ notify: async (config) => { | ||
case 'CANCELED': | ||
__classPrivateFieldGet(this, _IntervalClient_instances, "a", _IntervalClient_log_get).prod('Transaction canceled for action', actionSlug); | ||
__classPrivateFieldGet(this, _IntervalClient_instances, "a", _IntervalClient_log_get).prod('Transaction canceled for action', action.slug); | ||
break; | ||
case 'TRANSACTION_CLOSED': | ||
__classPrivateFieldGet(this, _IntervalClient_instances, "a", _IntervalClient_log_get).prod('Attempted to make IO call after transaction already closed in action', actionSlug); | ||
__classPrivateFieldGet(this, _IntervalClient_instances, "a", _IntervalClient_log_get).prod('Attempted to make IO call after transaction already closed in action', action.slug); | ||
break; | ||
@@ -569,0 +567,0 @@ } |
@@ -88,4 +88,4 @@ /// <reference types="node" /> | ||
initialResults?: Result[] | undefined; | ||
renderResult: (result: Result) => string | { | ||
label: string; | ||
renderResult: (result: Result) => string | number | boolean | Date | { | ||
label: string | number | boolean | Date; | ||
description?: string | undefined; | ||
@@ -102,3 +102,3 @@ imageUrl?: string | undefined; | ||
value: string; | ||
label: string; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
@@ -142,7 +142,7 @@ }, Result>; | ||
select: { | ||
single: <Option extends string | { | ||
single: <Option extends string | number | boolean | Date | { | ||
description?: string | null | undefined; | ||
imageUrl?: string | null | undefined; | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}>(label: string, props: Omit<{ | ||
@@ -153,4 +153,4 @@ helpText?: string | undefined; | ||
imageUrl?: string | null | undefined; | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
} | undefined; | ||
@@ -161,4 +161,4 @@ searchable?: boolean | undefined; | ||
imageUrl?: string | null | undefined; | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
@@ -173,4 +173,4 @@ }, "options" | "defaultValue"> & { | ||
imageUrl?: string | null | undefined; | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
} | undefined; | ||
@@ -181,14 +181,14 @@ searchable?: boolean | undefined; | ||
imageUrl?: string | null | undefined; | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
}, Option>; | ||
multiple: <Option_1 extends string | { | ||
value: string; | ||
label: string; | ||
multiple: <Option_1 extends string | number | boolean | Date | { | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}>(label: string, props: Omit<{ | ||
helpText?: string | undefined; | ||
defaultValue?: { | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[] | undefined; | ||
@@ -198,4 +198,4 @@ minSelections?: number | undefined; | ||
options: { | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
@@ -208,4 +208,4 @@ }, "options" | "defaultValue"> & { | ||
defaultValue?: { | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[] | undefined; | ||
@@ -215,4 +215,4 @@ minSelections?: number | undefined; | ||
options: { | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
@@ -224,2 +224,3 @@ }, Option_1[]>; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -238,2 +239,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -246,2 +248,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -266,2 +269,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -274,2 +278,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -288,6 +293,6 @@ label: string; | ||
} & ({ | ||
href: string; | ||
url: string; | ||
} | { | ||
action: string; | ||
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined; | ||
action: string; | ||
}), null>; | ||
@@ -309,2 +314,3 @@ object: DisplayIOComponentFunction<"DISPLAY_OBJECT", { | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -317,2 +323,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -336,2 +343,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -344,2 +352,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -346,0 +355,0 @@ label: string; |
@@ -39,2 +39,3 @@ "use strict"; | ||
const selectMultiple_1 = __importDefault(require("../components/selectMultiple")); | ||
const displayLink_1 = __importDefault(require("../components/displayLink")); | ||
const inputDate_1 = require("../components/inputDate"); | ||
@@ -258,3 +259,5 @@ const upload_1 = require("../components/upload"); | ||
markdown: this.createIOMethod('DISPLAY_MARKDOWN'), | ||
link: this.createIOMethod('DISPLAY_LINK'), | ||
link: this.createIOMethod('DISPLAY_LINK', { | ||
componentDef: displayLink_1.default, | ||
}), | ||
object: this.createIOMethod('DISPLAY_OBJECT'), | ||
@@ -261,0 +264,0 @@ table: this.createIOMethod('DISPLAY_TABLE', { |
@@ -6,2 +6,11 @@ "use strict"; | ||
const component = (methodName, label, initialProps, handleStateChange) => { | ||
const schema = ioSchema_1.ioSchema[methodName]; | ||
try { | ||
initialProps = schema.props.parse(initialProps !== null && initialProps !== void 0 ? initialProps : {}); | ||
} | ||
catch (err) { | ||
console.error(`Invalid props found for IO call with label "${label}":`); | ||
console.error(err); | ||
throw err; | ||
} | ||
const instance = { | ||
@@ -20,3 +29,2 @@ methodName, | ||
}); | ||
const schema = ioSchema_1.ioSchema[methodName]; | ||
function setReturnValue(value) { | ||
@@ -23,0 +31,0 @@ const returnSchema = instance.isOptional |
import type { T_IO_RETURNS, T_IO_STATE } from '../ioSchema'; | ||
declare type RenderResultDef = string | { | ||
label: string; | ||
declare type RenderResultDef = string | number | boolean | Date | { | ||
label: string | number | boolean | Date; | ||
description?: string; | ||
@@ -21,3 +21,3 @@ imageUrl?: string; | ||
value: string; | ||
label: string; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
@@ -31,3 +31,3 @@ }; | ||
value: string; | ||
label: string; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
@@ -34,0 +34,0 @@ }>; |
import { z } from 'zod'; | ||
import { T_IO_PROPS, T_IO_RETURNS, labelValue } from '../ioSchema'; | ||
import { T_IO_PROPS, T_IO_RETURNS, labelValue, primitiveValue } from '../ioSchema'; | ||
import Logger from '../classes/Logger'; | ||
declare type SelectMultipleProps<Option extends z.infer<typeof labelValue> | string> = Omit<T_IO_PROPS<'SELECT_MULTIPLE'>, 'options' | 'defaultValue'> & { | ||
declare type SelectMultipleProps<Option extends z.infer<typeof labelValue> | z.infer<typeof primitiveValue>> = Omit<T_IO_PROPS<'SELECT_MULTIPLE'>, 'options' | 'defaultValue'> & { | ||
options: Option[]; | ||
defaultValue?: Option[]; | ||
}; | ||
export default function selectMultiple(logger: Logger): <Option extends string | { | ||
value: string; | ||
label: string; | ||
export default function selectMultiple(logger: Logger): <Option extends string | number | boolean | Date | { | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}>(props: SelectMultipleProps<Option>) => { | ||
props: { | ||
defaultValue: { | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[] | undefined; | ||
options: { | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
@@ -21,0 +21,0 @@ helpText?: string | undefined; |
@@ -7,4 +7,7 @@ "use strict"; | ||
var _a; | ||
const normalizedOptions = props.options.map(option => { | ||
if (typeof option === 'string') { | ||
function normalizeOption(option) { | ||
if (typeof option === 'string' || | ||
typeof option === 'number' || | ||
typeof option === 'boolean' || | ||
option instanceof Date) { | ||
return { | ||
@@ -18,16 +21,17 @@ label: option, | ||
} | ||
}); | ||
const optionMap = new Map(normalizedOptions.map((o, i) => [o.value, props.options[i]])); | ||
let defaultValue = (_a = props.defaultValue) === null || _a === void 0 ? void 0 : _a.map(d => { | ||
if (typeof d === 'string') { | ||
return { | ||
label: d, | ||
value: d, | ||
}; | ||
} | ||
function getComparisonValue(value) { | ||
if (value instanceof Date) { | ||
return `date:${value.valueOf()}`; | ||
} | ||
else { | ||
return d; | ||
} | ||
}); | ||
if (defaultValue && defaultValue.every(val => !optionMap.has(val.value))) { | ||
return `${typeof value}:${value}`; | ||
} | ||
const normalizedOptions = props.options.map(option => normalizeOption(option)); | ||
const optionMap = new Map(normalizedOptions.map((o, i) => [ | ||
getComparisonValue(o.value), | ||
props.options[i], | ||
])); | ||
let defaultValue = (_a = props.defaultValue) === null || _a === void 0 ? void 0 : _a.map(d => normalizeOption(d)); | ||
if (defaultValue && | ||
defaultValue.every(val => !optionMap.has(getComparisonValue(val.value)))) { | ||
logger.warn('The defaultValue property must be a subset of the provided options, the provided defaultValue will be discarded.'); | ||
@@ -44,3 +48,3 @@ defaultValue = []; | ||
getValue(response) { | ||
return response.map(r => optionMap.get(r.value)); | ||
return response.map(r => optionMap.get(getComparisonValue(r.value))); | ||
}, | ||
@@ -47,0 +51,0 @@ }; |
import { z } from 'zod'; | ||
import { T_IO_PROPS, T_IO_RETURNS, richSelectOption } from '../ioSchema'; | ||
import { T_IO_PROPS, T_IO_RETURNS, richSelectOption, primitiveValue } from '../ioSchema'; | ||
import Logger from '../classes/Logger'; | ||
declare type SelectSingleProps<Option extends z.infer<typeof richSelectOption> | string> = Omit<T_IO_PROPS<'SELECT_SINGLE'>, 'options' | 'defaultValue'> & { | ||
declare type SelectSingleProps<Option extends z.infer<typeof richSelectOption> | z.infer<typeof primitiveValue>> = Omit<T_IO_PROPS<'SELECT_SINGLE'>, 'options' | 'defaultValue'> & { | ||
options: Option[]; | ||
defaultValue?: Option; | ||
}; | ||
export default function selectSingle(logger: Logger): <Option extends string | { | ||
export default function selectSingle(logger: Logger): <Option extends string | number | boolean | Date | { | ||
description?: string | null | undefined; | ||
imageUrl?: string | null | undefined; | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}>(props: SelectSingleProps<Option>) => { | ||
@@ -18,4 +18,4 @@ props: { | ||
imageUrl?: string | null | undefined; | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
} | undefined; | ||
@@ -25,4 +25,4 @@ options: { | ||
imageUrl?: string | null | undefined; | ||
value: string; | ||
label: string; | ||
value: string | number | boolean | Date; | ||
label: string | number | boolean | Date; | ||
}[]; | ||
@@ -29,0 +29,0 @@ helpText?: string | undefined; |
@@ -6,4 +6,7 @@ "use strict"; | ||
return (props) => { | ||
const normalizedOptions = props.options.map(option => { | ||
if (typeof option === 'string') { | ||
function normalizeOption(option) { | ||
if (typeof option === 'string' || | ||
typeof option === 'number' || | ||
typeof option === 'boolean' || | ||
option instanceof Date) { | ||
return { | ||
@@ -17,12 +20,20 @@ label: option, | ||
} | ||
}); | ||
const optionMap = new Map(normalizedOptions.map((o, i) => [o.value, props.options[i]])); | ||
} | ||
function getComparisonValue(value) { | ||
if (value instanceof Date) { | ||
return `date:${value.valueOf()}`; | ||
} | ||
return `${typeof value}:${value}`; | ||
} | ||
const normalizedOptions = props.options.map(option => normalizeOption(option)); | ||
const optionMap = new Map(normalizedOptions.map((o, i) => [ | ||
getComparisonValue(o.value), | ||
props.options[i], | ||
])); | ||
const stripper = ioSchema_1.richSelectOption.strip(); | ||
let defaultValue = typeof props.defaultValue === 'string' | ||
? { | ||
label: props.defaultValue, | ||
value: props.defaultValue, | ||
} | ||
: props.defaultValue; | ||
if (defaultValue && !optionMap.has(defaultValue.value)) { | ||
let defaultValue = props.defaultValue | ||
? normalizeOption(props.defaultValue) | ||
: undefined; | ||
if (defaultValue && | ||
!optionMap.has(getComparisonValue(defaultValue.value))) { | ||
logger.warn('The defaultValue property must be a value in the provided options, the provided defaultValue will be discarded.'); | ||
@@ -38,3 +49,3 @@ defaultValue = undefined; | ||
getValue(response) { | ||
return optionMap.get(response.value); | ||
return optionMap.get(getComparisonValue(response.value)); | ||
}, | ||
@@ -41,0 +52,0 @@ }; |
@@ -8,8 +8,8 @@ import { z } from 'zod'; | ||
value?: CellValue; | ||
} & ({} | { | ||
href: string; | ||
} & ({ | ||
url: string; | ||
} | { | ||
action: string; | ||
params?: z.infer<typeof serializableRecord>; | ||
})) | CellValue; | ||
} | {})) | CellValue; | ||
export interface Column<Row> extends z.input<typeof tableColumn> { | ||
@@ -23,2 +23,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -37,2 +38,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -45,2 +47,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -60,2 +63,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -68,2 +72,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -80,8 +85,9 @@ label: string; | ||
} & ({ | ||
href?: string | undefined; | ||
url: string; | ||
} | { | ||
href: string; | ||
} | { | ||
params: Record<string, string | number | bigint | boolean | Date | null | undefined>; | ||
href: never; | ||
action: string; | ||
})) | null | undefined; | ||
} | {})) | null | undefined; | ||
}[]; | ||
@@ -104,2 +110,3 @@ helpText?: string | undefined; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -112,2 +119,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -127,2 +135,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -135,2 +144,3 @@ label: string; | ||
href?: string | undefined; | ||
url?: string | undefined; | ||
action?: string | undefined; | ||
@@ -147,8 +157,9 @@ label: string; | ||
} & ({ | ||
href?: string | undefined; | ||
url: string; | ||
} | { | ||
href: string; | ||
} | { | ||
params: Record<string, string | number | bigint | boolean | Date | null | undefined>; | ||
href: never; | ||
action: string; | ||
})) | null | undefined; | ||
} | {})) | null | undefined; | ||
}[]; | ||
@@ -155,0 +166,0 @@ helpText?: string | undefined; |
@@ -6,4 +6,3 @@ /// <reference types="node" /> | ||
import { HttpRequestBody, LambdaRequestPayload, LambdaResponse } from './utils/http'; | ||
export { ActionGroup, io, ctx, IntervalError }; | ||
export default class ExperimentalInterval extends Interval { | ||
declare class ExperimentalInterval extends Interval { | ||
#private; | ||
@@ -15,1 +14,3 @@ use(prefix: string, group: ActionGroup): void; | ||
} | ||
export { ActionGroup, io, ctx, IntervalError, ExperimentalInterval as Interval }; | ||
export default ExperimentalInterval; |
@@ -35,3 +35,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IntervalError = exports.ctx = exports.io = exports.ActionGroup = void 0; | ||
exports.Interval = exports.IntervalError = exports.ctx = exports.io = exports.ActionGroup = void 0; | ||
const node_fetch_1 = __importDefault(require("node-fetch")); | ||
@@ -152,3 +152,3 @@ const _1 = __importStar(require(".")); | ||
} | ||
exports.default = ExperimentalInterval; | ||
exports.Interval = ExperimentalInterval; | ||
_ExperimentalInterval_instances = new WeakSet(), _ExperimentalInterval_respondToRequest = | ||
@@ -215,1 +215,2 @@ /** | ||
}; | ||
exports.default = ExperimentalInterval; |
@@ -799,2 +799,12 @@ import { z } from 'zod'; | ||
actionName: z.ZodString; | ||
action: z.ZodObject<{ | ||
slug: z.ZodString; | ||
url: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
url: string; | ||
slug: string; | ||
}, { | ||
url: string; | ||
slug: string; | ||
}>; | ||
environment: z.ZodEnum<["live", "development"]>; | ||
@@ -820,2 +830,6 @@ user: z.ZodObject<{ | ||
transactionId: string; | ||
action: { | ||
url: string; | ||
slug: string; | ||
}; | ||
environment: "live" | "development"; | ||
@@ -832,2 +846,6 @@ actionName: string; | ||
transactionId: string; | ||
action: { | ||
url: string; | ||
slug: string; | ||
}; | ||
environment: "live" | "development"; | ||
@@ -834,0 +852,0 @@ actionName: string; |
@@ -288,4 +288,8 @@ "use strict"; | ||
// Actually slug, for backward compatibility | ||
// TODO: Change to slug in breaking release | ||
// TODO: Remove breaking release, superfluous with slug below | ||
actionName: zod_1.z.string(), | ||
action: zod_1.z.object({ | ||
slug: zod_1.z.string(), | ||
url: zod_1.z.string(), | ||
}), | ||
environment: exports.actionEnvironment, | ||
@@ -292,0 +296,0 @@ user: zod_1.z.object({ |
@@ -86,2 +86,4 @@ import { z } from 'zod'; | ||
helpText?: string | undefined; | ||
minSelections?: number | undefined; | ||
maxSelections?: number | undefined; | ||
options: { | ||
@@ -97,4 +99,8 @@ value: string; | ||
helpText?: string | undefined; | ||
minSelections?: number | undefined; | ||
maxSelections?: number | undefined; | ||
data: (Record<string, string | number | boolean | Date | { | ||
value?: string | number | boolean | Date | null | undefined; | ||
action?: string | undefined; | ||
params?: Record<string, string | number | boolean | Date | null | undefined> | undefined; | ||
href?: string | undefined; | ||
@@ -105,2 +111,4 @@ label: string; | ||
value?: string | number | boolean | Date | null | undefined; | ||
action?: string | undefined; | ||
params?: Record<string, string | number | boolean | Date | null | undefined> | undefined; | ||
href?: string | undefined; | ||
@@ -114,10 +122,17 @@ label: string; | ||
label: string; | ||
render: (args_0: any, ...args_1: unknown[]) => string | number | boolean | Date | { | ||
render: (args_0: any, ...args_1: unknown[]) => string | number | boolean | Date | ({ | ||
value?: string | number | boolean | Date | null | undefined; | ||
label?: string | null | undefined; | ||
} & ({ | ||
href?: string | undefined; | ||
} | null | undefined; | ||
} | { | ||
action: string; | ||
params: Record<string, string | number | boolean | Date | null | undefined>; | ||
href: never; | ||
})) | null | undefined; | ||
}[] | undefined; | ||
data: (Record<string, string | number | boolean | Date | { | ||
value?: string | number | boolean | Date | null | undefined; | ||
action?: string | undefined; | ||
params?: Record<string, string | number | boolean | Date | null | undefined> | undefined; | ||
href?: string | undefined; | ||
@@ -131,2 +146,3 @@ label: string; | ||
markdown: IOComponentFunction<"DISPLAY_MARKDOWN", null>; | ||
link: IOComponentFunction<"DISPLAY_LINK", null>; | ||
object: IOComponentFunction<"DISPLAY_OBJECT", null>; | ||
@@ -138,4 +154,8 @@ table: <Props_3 extends Omit<{ | ||
helpText?: string | undefined; | ||
minSelections?: number | undefined; | ||
maxSelections?: number | undefined; | ||
data: (Record<string, string | number | boolean | Date | { | ||
value?: string | number | boolean | Date | null | undefined; | ||
action?: string | undefined; | ||
params?: Record<string, string | number | boolean | Date | null | undefined> | undefined; | ||
href?: string | undefined; | ||
@@ -146,2 +166,4 @@ label: string; | ||
value?: string | number | boolean | Date | null | undefined; | ||
action?: string | undefined; | ||
params?: Record<string, string | number | boolean | Date | null | undefined> | undefined; | ||
href?: string | undefined; | ||
@@ -155,10 +177,17 @@ label: string; | ||
label: string; | ||
render: (args_0: any, ...args_1: unknown[]) => string | number | boolean | Date | { | ||
render: (args_0: any, ...args_1: unknown[]) => string | number | boolean | Date | ({ | ||
value?: string | number | boolean | Date | null | undefined; | ||
label?: string | null | undefined; | ||
} & ({ | ||
href?: string | undefined; | ||
} | null | undefined; | ||
} | { | ||
action: string; | ||
params: Record<string, string | number | boolean | Date | null | undefined>; | ||
href: never; | ||
})) | null | undefined; | ||
}[] | undefined; | ||
data: (Record<string, string | number | boolean | Date | { | ||
value?: string | number | boolean | Date | null | undefined; | ||
action?: string | undefined; | ||
params?: Record<string, string | number | boolean | Date | null | undefined> | undefined; | ||
href?: string | undefined; | ||
@@ -165,0 +194,0 @@ label: string; |
@@ -205,2 +205,3 @@ "use strict"; | ||
markdown: aliasComponentName('DISPLAY_MARKDOWN'), | ||
link: aliasComponentName('DISPLAY_LINK'), | ||
object: aliasComponentName('DISPLAY_OBJECT'), | ||
@@ -207,0 +208,0 @@ table: (0, table_1.displayTable)(ioPromiseConstructor), |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ioSchema = exports.resolvesImmediately = exports.dateTimeObject = exports.timeObject = exports.dateObject = exports.currencyCode = exports.CURRENCIES = exports.internalTableColumn = exports.tableColumn = exports.internalTableRow = exports.newInternalTableRow = exports.tableRow = exports.tableRowValue = exports.serializableRecord = exports.serializableSchema = exports.deserializableRecord = exports.deserializableSchema = exports.richSelectOption = exports.labelValue = exports.typeValue = exports.IO_RESPONSE = exports.IO_RENDER = void 0; | ||
exports.ioSchema = exports.resolvesImmediately = exports.dateTimeObject = exports.timeObject = exports.dateObject = exports.currencyCode = exports.CURRENCIES = exports.internalTableColumn = exports.tableColumn = exports.internalTableRow = exports.newInternalTableRow = exports.tableRow = exports.tableRowValue = exports.serializableRecord = exports.serializableSchema = exports.deserializableRecord = exports.deserializableSchema = exports.richSelectOption = exports.labelValue = exports.primitiveValue = exports.typeValue = exports.IO_RESPONSE = exports.IO_RENDER = void 0; | ||
const zod_1 = require("zod"); | ||
@@ -40,6 +40,13 @@ exports.IO_RENDER = zod_1.z.object({ | ||
]); | ||
exports.primitiveValue = zod_1.z.union([ | ||
zod_1.z.string(), | ||
zod_1.z.number(), | ||
zod_1.z.boolean(), | ||
zod_1.z.date(), | ||
]); | ||
const objectLiteralSchema = exports.primitiveValue.nullish(); | ||
exports.labelValue = zod_1.z | ||
.object({ | ||
label: zod_1.z.string(), | ||
value: zod_1.z.string(), | ||
label: exports.primitiveValue, | ||
value: exports.primitiveValue, | ||
}) | ||
@@ -49,4 +56,4 @@ .passthrough(); | ||
.object({ | ||
label: zod_1.z.string(), | ||
value: zod_1.z.string(), | ||
label: exports.primitiveValue, | ||
value: exports.primitiveValue, | ||
description: zod_1.z.string().nullish(), | ||
@@ -56,10 +63,2 @@ imageUrl: zod_1.z.string().nullish(), | ||
.passthrough(); | ||
const objectLiteralSchema = zod_1.z.union([ | ||
zod_1.z.string(), | ||
zod_1.z.number(), | ||
zod_1.z.boolean(), | ||
zod_1.z.null(), | ||
zod_1.z.date(), | ||
zod_1.z.undefined(), | ||
]); | ||
const keyValueObject = zod_1.z.lazy(() => zod_1.z.union([ | ||
@@ -107,2 +106,3 @@ objectLiteralSchema, | ||
href: zod_1.z.string().optional(), | ||
url: zod_1.z.string().optional(), | ||
action: zod_1.z.string().optional(), | ||
@@ -149,9 +149,12 @@ params: exports.serializableRecord.optional(), | ||
zod_1.z.object({ | ||
href: zod_1.z.string().optional(), | ||
url: zod_1.z.string(), | ||
}), | ||
zod_1.z.object({ | ||
href: zod_1.z.never(), | ||
href: zod_1.z.string(), | ||
}), | ||
zod_1.z.object({ | ||
action: zod_1.z.string(), | ||
params: exports.serializableRecord, | ||
}), | ||
zod_1.z.object({}), | ||
])), | ||
@@ -306,3 +309,8 @@ zod_1.z.string(), | ||
props: zod_1.z.object({ | ||
results: zod_1.z.array(exports.richSelectOption), | ||
results: zod_1.z.array(zod_1.z.object({ | ||
value: zod_1.z.string(), | ||
label: exports.primitiveValue, | ||
description: zod_1.z.string().nullish(), | ||
imageUrl: zod_1.z.string().nullish(), | ||
})), | ||
placeholder: zod_1.z.optional(zod_1.z.string()), | ||
@@ -371,11 +379,8 @@ helpText: zod_1.z.optional(zod_1.z.string()), | ||
zod_1.z.object({ | ||
href: zod_1.z | ||
.string() | ||
.url() | ||
.refine(url => url.startsWith('https://') || | ||
url.startsWith('http://localhost:'), { | ||
message: 'Only absolute HTTPS URLs are supported', | ||
}), | ||
url: zod_1.z.string().url(), | ||
}), | ||
zod_1.z.object({ | ||
href: zod_1.z.string().url(), | ||
}), | ||
zod_1.z.object({ | ||
action: zod_1.z.string(), | ||
@@ -382,0 +387,0 @@ params: exports.serializableRecord.optional(), |
@@ -20,2 +20,3 @@ import type { z } from 'zod'; | ||
slug: string; | ||
url: string; | ||
}; | ||
@@ -22,0 +23,0 @@ }; |
{ | ||
"name": "@interval/sdk", | ||
"version": "0.22.0", | ||
"version": "0.23.0", | ||
"homepage": "https://interval.com", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
506687
77
11399