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

@interval/sdk

Package Overview
Dependencies
Maintainers
3
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.38.0-dev1 to 0.38.0

3

dist/classes/IntervalClient.d.ts

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

respondToRequest(requestId: string): Promise<unknown>;
close(): void;
immediatelyClose(): void;
safelyClose(): Promise<void>;
declareHost(httpHostId: string): Promise<void>;

@@ -28,0 +29,0 @@ /**

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

}) => MultipleableIOPromise<"SEARCH", {
defaultValue?: string | undefined;
defaultValue?: string | null | undefined;
disabled?: boolean | undefined;

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

}[];
}, Result, Result>;
}, Result, Result | null>;
/**

@@ -220,3 +220,3 @@ * The namespace for methods to collect user input.

text: InputIOComponentFunction<"INPUT_TEXT", {
defaultValue?: string | undefined;
defaultValue?: string | null | undefined;
disabled?: boolean | undefined;

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

boolean: InputIOComponentFunction<"INPUT_BOOLEAN", {
defaultValue?: boolean | undefined;
defaultValue?: boolean | null | undefined;
disabled?: boolean | undefined;

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

number: InputIOComponentFunction<"INPUT_NUMBER", {
defaultValue?: number | undefined;
defaultValue?: number | null | undefined;
disabled?: boolean | undefined;

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

email: InputIOComponentFunction<"INPUT_EMAIL", {
defaultValue?: string | undefined;
defaultValue?: string | null | undefined;
disabled?: boolean | undefined;

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

richText: InputIOComponentFunction<"INPUT_RICH_TEXT", {
defaultValue?: string | undefined;
defaultValue?: string | null | undefined;
disabled?: boolean | undefined;

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

url: InputIOComponentFunction<"INPUT_URL", {
defaultValue?: string | undefined;
defaultValue?: string | null | undefined;
disabled?: boolean | undefined;

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

day: number;
} | undefined;
} | null | undefined;
disabled?: boolean | undefined;

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

minute: number;
} | undefined;
} | null | undefined;
disabled?: boolean | undefined;

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

minute: number;
} | undefined;
} | null | undefined;
disabled?: boolean | undefined;

@@ -500,4 +500,4 @@ helpText?: string | undefined;

generatePresignedUrls?: ((state: {
type: string;
name: string;
type: string;
}) => Promise<{

@@ -514,5 +514,5 @@ uploadUrl: string;

buffer(): Promise<Buffer>;
name: string;
type: string;
size: number;
name: string;
}>;

@@ -574,3 +574,3 @@ };

value: string | number | boolean | Date;
} | undefined;
} | null | undefined;
disabled?: boolean | undefined;

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

value: string | number | boolean | Date;
}[] | undefined;
}[] | null | undefined;
disabled?: boolean | undefined;

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

*
* Grid items can include a title, description, image, and options menu, and can optionally link to another page, action, or external URL.
* Grid items can include a label, description, image, and options menu, and can optionally link to another page, action, or external URL.
*

@@ -1079,3 +1079,3 @@ * Grid item size can be controlled using the idealColumnWidth property. Interval will calculate a column width that is as close as possible to that number while factoring in gutter size and window width.

* renderItem: row => ({
* title: row.album,
* label: row.album,
* description: row.artist,

@@ -1096,2 +1096,3 @@ * image: {

renderItem: (row: Row_2) => {
label?: string | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;

@@ -1123,2 +1124,3 @@ url?: string | undefined;

}))[] | undefined;
} & {
title?: string | null | undefined;

@@ -1133,2 +1135,3 @@ };

renderItem: (row: Row_2) => {
label?: string | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;

@@ -1160,2 +1163,3 @@ url?: string | undefined;

}))[] | undefined;
} & {
title?: string | null | undefined;

@@ -1174,2 +1178,3 @@ };

data: {
label?: string | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;

@@ -1244,3 +1249,3 @@ url?: string | undefined;

}) => InputIOPromise<"INPUT_SPREADSHEET", {
defaultValue?: Record<string, string | number | boolean | null | undefined>[] | undefined;
defaultValue?: Record<string, string | number | boolean | null | undefined>[] | null | undefined;
helpText?: string | undefined;

@@ -1247,0 +1252,0 @@ columns: Record<string, "string" | "string?" | "number" | "number?" | "boolean" | "boolean?">;

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

*
* Grid items can include a title, description, image, and options menu, and can optionally link to another page, action, or external URL.
* Grid items can include a label, description, image, and options menu, and can optionally link to another page, action, or external URL.
*

@@ -798,3 +798,3 @@ * Grid item size can be controlled using the idealColumnWidth property. Interval will calculate a column width that is as close as possible to that number while factoring in gutter size and window width.

* renderItem: row => ({
* title: row.album,
* label: row.album,
* description: row.artist,

@@ -801,0 +801,0 @@ * image: {

@@ -15,3 +15,3 @@ import { z } from 'zod';

multipleProps?: {
defaultValue?: T_IO_RETURNS<MN>[];
defaultValue?: T_IO_RETURNS<MN>[] | null;
};

@@ -64,3 +64,3 @@ }

multipleProps?: {
defaultValue?: T_IO_RETURNS<MethodName>[];
defaultValue?: T_IO_RETURNS<MethodName>[] | null;
};

@@ -67,0 +67,0 @@ displayResolvesImmediately?: boolean;

@@ -63,3 +63,3 @@ import { T_IO_DISPLAY_METHOD_NAMES, T_IO_INPUT_METHOD_NAMES, T_IO_METHOD_NAMES, T_IO_MULTIPLEABLE_METHOD_NAMES, T_IO_PROPS, T_IO_RETURNS, T_IO_STATE } from '../ioSchema';

defaultValue?: any;
} ? Output : never> extends InputIOPromise<MethodName, Props, Output> {
} ? Output | null : never> extends InputIOPromise<MethodName, Props, Output> {
defaultValueGetter: ((defaultValue: DefaultValue) => T_IO_RETURNS<MethodName>) | undefined;

@@ -78,3 +78,3 @@ constructor({ defaultValueGetter, ...props }: {

multiple({ defaultValue, }?: {
defaultValue?: DefaultValue[];
defaultValue?: DefaultValue[] | null;
}): MultipleIOPromise<MethodName, Props, Output>;

@@ -85,5 +85,5 @@ }

getSingleValue: ((response: ComponentReturnValue<MethodName>) => Output) | undefined;
defaultValue: T_IO_RETURNS<MethodName>[] | undefined;
defaultValue: T_IO_RETURNS<MethodName>[] | undefined | null;
constructor({ defaultValue, valueGetter, ...rest }: {
defaultValue?: T_IO_RETURNS<MethodName>[];
defaultValue?: T_IO_RETURNS<MethodName>[] | null;
renderer: ComponentRenderer<MethodName>;

@@ -108,5 +108,5 @@ methodName: MethodName;

getSingleValue: ((response: ComponentReturnValue<MethodName>) => Output) | undefined;
defaultValue: T_IO_RETURNS<MethodName>[] | undefined;
defaultValue: T_IO_RETURNS<MethodName>[] | undefined | null;
constructor({ defaultValue, valueGetter, ...rest }: {
defaultValue?: T_IO_RETURNS<MethodName>[];
defaultValue?: T_IO_RETURNS<MethodName>[] | null;
renderer: ComponentRenderer<MethodName>;

@@ -113,0 +113,0 @@ methodName: MethodName;

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

transformedDefaultValue = zod_1.z
.array(defaultValueSchema.unwrap())
.array(defaultValueSchema.unwrap().unwrap())
.parse(potentialDefaultValue);

@@ -220,0 +220,0 @@ }

@@ -167,9 +167,9 @@ import { z } from 'zod';

validationErrorMessage: z.ZodNullable<z.ZodOptional<z.ZodString>>;
multipleProps: z.ZodOptional<z.ZodObject<{
defaultValue: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
multipleProps: z.ZodNullable<z.ZodOptional<z.ZodObject<{
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny, "many">>>;
}, "strip", z.ZodTypeAny, {
defaultValue?: any[] | undefined;
defaultValue?: any[] | null | undefined;
}, {
defaultValue?: any[] | undefined;
}>>;
defaultValue?: any[] | null | undefined;
}>>>;
}>, "strip", z.ZodTypeAny, {

@@ -180,4 +180,4 @@ props?: any;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -196,4 +196,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -227,4 +227,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -253,4 +253,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -455,4 +455,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -528,4 +528,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -581,9 +581,9 @@ label: string;

validationErrorMessage: z.ZodNullable<z.ZodOptional<z.ZodString>>;
multipleProps: z.ZodOptional<z.ZodObject<{
defaultValue: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
multipleProps: z.ZodNullable<z.ZodOptional<z.ZodObject<{
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny, "many">>>;
}, "strip", z.ZodTypeAny, {
defaultValue?: any[] | undefined;
defaultValue?: any[] | null | undefined;
}, {
defaultValue?: any[] | undefined;
}>>;
defaultValue?: any[] | null | undefined;
}>>>;
}>, "strip", z.ZodTypeAny, {

@@ -594,4 +594,4 @@ props?: any;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -610,4 +610,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -641,4 +641,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -667,4 +667,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -869,4 +869,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -942,4 +942,4 @@ label: string;

multipleProps?: {
defaultValue?: any[] | undefined;
} | undefined;
defaultValue?: any[] | null | undefined;
} | null | undefined;
methodName: string;

@@ -946,0 +946,0 @@ label: string;

@@ -11,3 +11,9 @@ import Logger from './Logger';

constructor(interval: Interval, endpoint: string, logger: Logger, ctx: Ctx<void>, apiKey?: string);
enqueue(slug: string, { assignee, params }?: Pick<QueuedAction, 'assignee' | 'params'>): Promise<QueuedAction>;
/**
* @deprecated Use `interval.enqueue()` instead.
*/
enqueue(slug: string, args?: Pick<QueuedAction, 'assignee' | 'params'>): Promise<QueuedAction>;
/**
* @deprecated Use `interval.dequeue()` instead.
*/
dequeue(id: string): Promise<QueuedAction>;

@@ -14,0 +20,0 @@ add(slug: string, route: IntervalActionDefinition | Page): void;

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

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _Routes_instances, _Routes_logger, _Routes_apiKey, _Routes_endpoint, _Routes_groupChangeCtx, _Routes_getAddress;
var _Routes_logger, _Routes_apiKey, _Routes_endpoint, _Routes_groupChangeCtx;
Object.defineProperty(exports, "__esModule", { value: true });
const cross_fetch_1 = __importDefault(require("cross-fetch"));
const superjson_1 = __importDefault(require("../utils/superjson"));
const __1 = require("..");
const internalRpcSchema_1 = require("../internalRpcSchema");
/**

@@ -28,3 +22,2 @@ * This is effectively a namespace inside of Interval with a little bit of its own state.

constructor(interval, endpoint, logger, ctx, apiKey) {
_Routes_instances.add(this);
_Routes_logger.set(this, void 0);

@@ -40,78 +33,13 @@ _Routes_apiKey.set(this, void 0);

}
async enqueue(slug, { assignee, params } = {}) {
let body;
try {
const { json, meta } = params
? superjson_1.default.serialize(params)
: { json: undefined, meta: undefined };
body = internalRpcSchema_1.ENQUEUE_ACTION.inputs.parse({
assignee,
slug,
params: json,
paramsMeta: meta,
});
}
catch (err) {
__classPrivateFieldGet(this, _Routes_logger, "f").debug(err);
throw new __1.IntervalError('Invalid input.');
}
const response = await (0, cross_fetch_1.default)(__classPrivateFieldGet(this, _Routes_instances, "m", _Routes_getAddress).call(this, 'enqueue'), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${__classPrivateFieldGet(this, _Routes_apiKey, "f")}`,
},
body: JSON.stringify(body),
})
.then(r => r.json())
.then(r => internalRpcSchema_1.ENQUEUE_ACTION.returns.parseAsync(r))
.catch(err => {
__classPrivateFieldGet(this, _Routes_logger, "f").debug(err);
throw new __1.IntervalError('Received invalid API response.');
});
if (response.type === 'error') {
throw new __1.IntervalError(`There was a problem enqueuing the action: ${response.message}`);
}
return {
id: response.id,
assignee,
params,
};
/**
* @deprecated Use `interval.enqueue()` instead.
*/
async enqueue(slug, args = {}) {
return this.interval.enqueue(slug, args);
}
/**
* @deprecated Use `interval.dequeue()` instead.
*/
async dequeue(id) {
let body;
try {
body = internalRpcSchema_1.DEQUEUE_ACTION.inputs.parse({
id,
});
}
catch (err) {
__classPrivateFieldGet(this, _Routes_logger, "f").debug(err);
throw new __1.IntervalError('Invalid input.');
}
const response = await (0, cross_fetch_1.default)(__classPrivateFieldGet(this, _Routes_instances, "m", _Routes_getAddress).call(this, 'dequeue'), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${__classPrivateFieldGet(this, _Routes_apiKey, "f")}`,
},
body: JSON.stringify(body),
})
.then(r => r.json())
.then(r => internalRpcSchema_1.DEQUEUE_ACTION.returns.parseAsync(r))
.catch(err => {
__classPrivateFieldGet(this, _Routes_logger, "f").debug(err);
throw new __1.IntervalError('Received invalid API response.');
});
if (response.type === 'error') {
throw new __1.IntervalError(`There was a problem enqueuing the action: ${response.message}`);
}
let { type, params, paramsMeta, ...rest } = response;
if (paramsMeta && params) {
params = superjson_1.default.deserialize({ json: params, meta: paramsMeta });
}
return {
...rest,
params,
};
return this.interval.dequeue(id);
}

@@ -151,7 +79,2 @@ add(slug, route) {

exports.default = Routes;
_Routes_logger = new WeakMap(), _Routes_apiKey = new WeakMap(), _Routes_endpoint = new WeakMap(), _Routes_groupChangeCtx = new WeakMap(), _Routes_instances = new WeakSet(), _Routes_getAddress = function _Routes_getAddress(path) {
if (path.startsWith('/')) {
path = path.substring(1);
}
return `${__classPrivateFieldGet(this, _Routes_endpoint, "f")}/${path}`;
};
_Routes_logger = new WeakMap(), _Routes_apiKey = new WeakMap(), _Routes_endpoint = new WeakMap(), _Routes_groupChangeCtx = new WeakMap();

@@ -1,6 +0,6 @@

import { LoadingOptions, LoadingState } from '../internalRpcSchema';
import { BackwardCompatibleLoadingOptions, BackwardCompatibleLoadingState } from '../internalRpcSchema';
import Logger from './Logger';
export interface TransactionLoadingStateConfig {
logger: Logger;
send: (loadingState: LoadingState) => Promise<void>;
send: (loadingState: BackwardCompatibleLoadingState) => Promise<void>;
}

@@ -11,2 +11,3 @@ export default class TransactionLoadingState {

get state(): {
label?: string | undefined;
description?: string | undefined;

@@ -18,3 +19,3 @@ title?: string | undefined;

/**
* Kicks off a loading spinner to provide context during any long-running action work. Can also be called with a single string argument as the title, or with no arguments to display only a spinner.
* Kicks off a loading spinner to provide context during any long-running action work. Can also be called with a single string argument as the label, or with no arguments to display only a spinner.
*

@@ -25,9 +26,9 @@ * **Usage:**

* await ctx.loading.start({
* title: "Reticulating splines...",
* label: "Reticulating splines...",
* });
*
* await ctx.loading.start("Title only shorthand");
* await ctx.loading.start("Label only shorthand");
*```
*/
start(options?: string | LoadingOptions): Promise<void>;
start(options?: string | BackwardCompatibleLoadingOptions): Promise<void>;
/**

@@ -40,3 +41,3 @@ * Updates any existing loading spinner initated with `ctx.loading.start` to dynamically provide new loading information to the action runner.

* await ctx.loading.start({
* title: "Something is loading",
* label: "Something is loading",
* description: "Mapping all the things",

@@ -46,3 +47,3 @@ * });

* await ctx.loading.update({
* title: "Something is loading",
* label: "Something is loading",
* description: "Now reducing all the things",

@@ -52,3 +53,3 @@ * });

*/
update(options?: string | LoadingOptions): Promise<void>;
update(options?: string | BackwardCompatibleLoadingOptions): Promise<void>;
/**

@@ -61,3 +62,3 @@ * Marks a chunk of work as completed to dynamically provide granular loading progress. Can only be used after `ctx.loading.start` was called with `itemsInQueue`.

* await ctx.loading.start({
* title: "Migrating users",
* label: "Migrating users",
* description: "Enabling edit button for selected users",

@@ -64,0 +65,0 @@ * itemsInQueue: 100,

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

/**
* Kicks off a loading spinner to provide context during any long-running action work. Can also be called with a single string argument as the title, or with no arguments to display only a spinner.
* Kicks off a loading spinner to provide context during any long-running action work. Can also be called with a single string argument as the label, or with no arguments to display only a spinner.
*

@@ -37,6 +37,6 @@ * **Usage:**

* await ctx.loading.start({
* title: "Reticulating splines...",
* label: "Reticulating splines...",
* });
*
* await ctx.loading.start("Title only shorthand");
* await ctx.loading.start("Label only shorthand");
*```

@@ -46,3 +46,3 @@ */

if (typeof options === 'string') {
options = { title: options };
options = { label: options };
}

@@ -65,3 +65,3 @@ else if (options === undefined) {

* await ctx.loading.start({
* title: "Something is loading",
* label: "Something is loading",
* description: "Mapping all the things",

@@ -71,3 +71,3 @@ * });

* await ctx.loading.update({
* title: "Something is loading",
* label: "Something is loading",
* description: "Now reducing all the things",

@@ -84,3 +84,3 @@ * });

if (typeof options === 'string') {
options = { title: options };
options = { label: options };
}

@@ -103,3 +103,3 @@ else if (options === undefined) {

* await ctx.loading.start({
* title: "Migrating users",
* label: "Migrating users",
* description: "Enabling edit button for selected users",

@@ -106,0 +106,0 @@ * itemsInQueue: 100,

import { T_IO_PROPS, T_IO_STATE, GridItem } from '../ioSchema';
import { GridDataFetcher } from '../utils/grid';
declare type PublicProps<Row = any> = Omit<T_IO_PROPS<'DISPLAY_GRID'>, 'data' | 'totalRecords' | 'isAsync'> & {
renderItem: (row: Row) => GridItem;
renderItem: (row: Row) => GridItem & {
/** @deprecated Please use `label` instead. */
title?: string | null;
};
} & ({

@@ -21,2 +24,3 @@ data: Row[];

data: {
label?: string | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;

@@ -57,2 +61,3 @@ url?: string | undefined;

data: {
label?: string | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;

@@ -95,2 +100,3 @@ url?: string | undefined;

renderItem: (row: Row) => {
label?: string | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;

@@ -122,2 +128,4 @@ url?: string | undefined;

}))[] | undefined;
} & {
/** @deprecated Please use `label` instead. */
title?: string | null | undefined;

@@ -129,2 +137,3 @@ };

data: {
label?: string | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;

@@ -167,2 +176,3 @@ url?: string | undefined;

renderItem: (row: Row) => {
label?: string | null | undefined;
params?: Record<string, string | number | bigint | boolean | Date | null | undefined> | undefined;

@@ -194,2 +204,4 @@ url?: string | undefined;

}))[] | undefined;
} & {
/** @deprecated Please use `label` instead. */
title?: string | null | undefined;

@@ -196,0 +208,0 @@ };

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

props: {
defaultValue?: string | undefined;
defaultValue?: string | null | undefined;
disabled?: boolean | undefined;

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

@@ -26,5 +26,5 @@ /// <reference types="node" />

buffer(): Promise<Buffer>;
name: string;
type: string;
size: number;
name: string;
};

@@ -31,0 +31,0 @@ onStateChange(newState: T_IO_STATE<'UPLOAD_FILE'>): Promise<{

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

const response = await client.respondToRequest(requestId);
client.close();
client.immediatelyClose();
return response;

@@ -162,5 +162,5 @@ }, _ExperimentalInterval_declareHost = async function _ExperimentalInterval_declareHost(httpHostId) {

const response = await client.declareHost(httpHostId);
client.close();
client.immediatelyClose();
return response;
};
exports.default = ExperimentalInterval;

@@ -55,7 +55,10 @@ import Routes from './classes/Routes';

listen(): Promise<void>;
close(): void | undefined;
immediatelyClose(): void | undefined;
safelyClose(): Promise<void>;
get client(): IntervalClient | undefined;
fetchIceConfig(): Promise<IceConfig>;
notify(config: NotifyConfig): Promise<void>;
enqueue(slug: string, { assignee, params }?: Pick<QueuedAction, 'assignee' | 'params'>): Promise<QueuedAction>;
dequeue(id: string): Promise<QueuedAction>;
}
export { Interval, IOError, IntervalError, Action, Page, BasicLayout as Layout };

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

};
var _Interval_instances, _Interval_logger, _Interval_client, _Interval_apiKey, _Interval_httpEndpoint, _Interval_groupChangeCtx, _Interval_log_get;
var _Interval_instances, _Interval_logger, _Interval_client, _Interval_apiKey, _Interval_httpEndpoint, _Interval_groupChangeCtx, _Interval_log_get, _Interval_getQueueAddress;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -59,2 +59,3 @@ exports.Layout = exports.Page = exports.Action = exports.IntervalError = exports.IOError = exports.Interval = exports.ctx = exports.io = exports.getSomeStore = exports.getPageStore = exports.getActionStore = void 0;

const evt_1 = require("evt");
const superjson_1 = __importDefault(require("./utils/superjson"));
function getActionStore() {

@@ -175,6 +176,10 @@ if (!IntervalClient_1.actionLocalStorage) {

}
close() {
immediatelyClose() {
var _a;
return (_a = __classPrivateFieldGet(this, _Interval_client, "f")) === null || _a === void 0 ? void 0 : _a.close();
return (_a = __classPrivateFieldGet(this, _Interval_client, "f")) === null || _a === void 0 ? void 0 : _a.immediatelyClose();
}
async safelyClose() {
var _a;
return (_a = __classPrivateFieldGet(this, _Interval_client, "f")) === null || _a === void 0 ? void 0 : _a.safelyClose();
}
/* @internal */ get client() {

@@ -244,2 +249,79 @@ return __classPrivateFieldGet(this, _Interval_client, "f");

}
async enqueue(slug, { assignee, params } = {}) {
let body;
try {
const { json, meta } = params
? superjson_1.default.serialize(params)
: { json: undefined, meta: undefined };
body = internalRpcSchema_1.ENQUEUE_ACTION.inputs.parse({
assignee,
slug,
params: json,
paramsMeta: meta,
});
}
catch (err) {
__classPrivateFieldGet(this, _Interval_logger, "f").debug(err);
throw new IntervalError_1.default('Invalid input.');
}
const response = await (0, cross_fetch_1.default)(__classPrivateFieldGet(this, _Interval_instances, "m", _Interval_getQueueAddress).call(this, 'enqueue'), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${__classPrivateFieldGet(this, _Interval_apiKey, "f")}`,
},
body: JSON.stringify(body),
})
.then(r => r.json())
.then(r => internalRpcSchema_1.ENQUEUE_ACTION.returns.parseAsync(r))
.catch(err => {
__classPrivateFieldGet(this, _Interval_logger, "f").debug(err);
throw new IntervalError_1.default('Received invalid API response.');
});
if (response.type === 'error') {
throw new IntervalError_1.default(`There was a problem enqueuing the action: ${response.message}`);
}
return {
id: response.id,
assignee,
params,
};
}
async dequeue(id) {
let body;
try {
body = internalRpcSchema_1.DEQUEUE_ACTION.inputs.parse({
id,
});
}
catch (err) {
__classPrivateFieldGet(this, _Interval_logger, "f").debug(err);
throw new IntervalError_1.default('Invalid input.');
}
const response = await (0, cross_fetch_1.default)(__classPrivateFieldGet(this, _Interval_instances, "m", _Interval_getQueueAddress).call(this, 'dequeue'), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${__classPrivateFieldGet(this, _Interval_apiKey, "f")}`,
},
body: JSON.stringify(body),
})
.then(r => r.json())
.then(r => internalRpcSchema_1.DEQUEUE_ACTION.returns.parseAsync(r))
.catch(err => {
__classPrivateFieldGet(this, _Interval_logger, "f").debug(err);
throw new IntervalError_1.default('Received invalid API response.');
});
if (response.type === 'error') {
throw new IntervalError_1.default(`There was a problem enqueuing the action: ${response.message}`);
}
let { type, params, paramsMeta, ...rest } = response;
if (paramsMeta && params) {
params = superjson_1.default.deserialize({ json: params, meta: paramsMeta });
}
return {
...rest,
params,
};
}
}

@@ -250,2 +332,7 @@ exports.default = Interval;

return __classPrivateFieldGet(this, _Interval_logger, "f");
}, _Interval_getQueueAddress = function _Interval_getQueueAddress(path) {
if (path.startsWith('/')) {
path = path.substring(1);
}
return `${__classPrivateFieldGet(this, _Interval_httpEndpoint, "f")}/api/actions/${path}`;
};

@@ -56,16 +56,16 @@ import { z } from 'zod';

export declare const LOADING_OPTIONS: z.ZodObject<{
title: z.ZodOptional<z.ZodString>;
label: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
itemsInQueue: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
label?: string | undefined;
description?: string | undefined;
title?: string | undefined;
itemsInQueue?: number | undefined;
}, {
label?: string | undefined;
description?: string | undefined;
title?: string | undefined;
itemsInQueue?: number | undefined;
}>;
declare const LOADING_STATE: z.ZodObject<{
title: z.ZodOptional<z.ZodString>;
label: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;

@@ -75,3 +75,23 @@ itemsInQueue: z.ZodOptional<z.ZodNumber>;

}, "strip", z.ZodTypeAny, {
label?: string | undefined;
description?: string | undefined;
itemsInQueue?: number | undefined;
itemsCompleted?: number | undefined;
}, {
label?: string | undefined;
description?: string | undefined;
itemsInQueue?: number | undefined;
itemsCompleted?: number | undefined;
}>;
declare const BACKWARD_COMPATIBLE_LOADING_STATE: z.ZodObject<z.extendShape<{
label: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
itemsInQueue: z.ZodOptional<z.ZodNumber>;
itemsCompleted: z.ZodOptional<z.ZodNumber>;
}, {
/** @deprecated in favor of `label` (for real this time) */
title: z.ZodOptional<z.ZodString>;
}>, "strip", z.ZodTypeAny, {
label?: string | undefined;
description?: string | undefined;
title?: string | undefined;

@@ -81,2 +101,3 @@ itemsInQueue?: number | undefined;

}, {
label?: string | undefined;
description?: string | undefined;

@@ -102,3 +123,8 @@ title?: string | undefined;

export declare type LoadingOptions = z.input<typeof LOADING_OPTIONS>;
export declare type BackwardCompatibleLoadingOptions = LoadingOptions & {
/** @deprecated Please use `label` instead. */
title?: string;
};
export declare type LoadingState = z.input<typeof LOADING_STATE>;
export declare type BackwardCompatibleLoadingState = z.input<typeof BACKWARD_COMPATIBLE_LOADING_STATE>;
export declare const ACCESS_CONTROL_DEFINITION: z.ZodUnion<[z.ZodLiteral<"entire-organization">, z.ZodObject<{

@@ -127,4 +153,4 @@ teams: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;

}, "strip", z.ZodTypeAny, {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -138,4 +164,4 @@ backgroundable?: boolean | undefined;

}, {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -425,4 +451,4 @@ backgroundable?: boolean | undefined;

}, "strip", z.ZodTypeAny, {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -436,4 +462,4 @@ backgroundable?: boolean | undefined;

}, {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -498,4 +524,4 @@ backgroundable?: boolean | undefined;

actions: {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -525,4 +551,4 @@ backgroundable?: boolean | undefined;

actions: {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -812,8 +838,12 @@ backgroundable?: boolean | undefined;

SEND_LOADING_CALL: {
inputs: z.ZodIntersection<z.ZodObject<{
title: z.ZodOptional<z.ZodString>;
inputs: z.ZodIntersection<z.ZodObject<z.extendShape<{
label: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
itemsInQueue: z.ZodOptional<z.ZodNumber>;
itemsCompleted: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
}, {
/** @deprecated in favor of `label` (for real this time) */
title: z.ZodOptional<z.ZodString>;
}>, "strip", z.ZodTypeAny, {
label?: string | undefined;
description?: string | undefined;

@@ -824,2 +854,3 @@ title?: string | undefined;

}, {
label?: string | undefined;
description?: string | undefined;

@@ -831,10 +862,7 @@ title?: string | undefined;

transactionId: z.ZodString;
label: z.ZodOptional<z.ZodString>;
skipClientCall: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
label?: string | undefined;
skipClientCall?: boolean | undefined;
transactionId: string;
}, {
label?: string | undefined;
skipClientCall?: boolean | undefined;

@@ -1075,4 +1103,4 @@ transactionId: string;

}, "strip", z.ZodTypeAny, {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -1086,4 +1114,4 @@ backgroundable?: boolean | undefined;

}, {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -1145,4 +1173,4 @@ backgroundable?: boolean | undefined;

actions: {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -1169,4 +1197,4 @@ backgroundable?: boolean | undefined;

actions: {
description?: string | undefined;
name?: string | undefined;
description?: string | undefined;
groupSlug?: string | undefined;

@@ -1277,2 +1305,21 @@ backgroundable?: boolean | undefined;

};
BEGIN_HOST_SHUTDOWN: {
inputs: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
returns: z.ZodDiscriminatedUnion<"type", z.Primitive, z.ZodObject<{
type: z.ZodLiteral<"success">;
}, "strip", z.ZodTypeAny, {
type: "success";
}, {
type: "success";
}> | z.ZodObject<{
type: z.ZodLiteral<"error">;
message: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
message?: string | undefined;
type: "error";
}, {
message?: string | undefined;
type: "error";
}>>;
};
};

@@ -1359,8 +1406,12 @@ export declare type WSServerSchema = typeof wsServerSchema;

transactionId: z.ZodString;
}, {
title: z.ZodOptional<z.ZodString>;
}, z.extendShape<{
label: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
itemsInQueue: z.ZodOptional<z.ZodNumber>;
itemsCompleted: z.ZodOptional<z.ZodNumber>;
}>, "strip", z.ZodTypeAny, {
}, {
/** @deprecated in favor of `label` (for real this time) */
title: z.ZodOptional<z.ZodString>;
}>>, "strip", z.ZodTypeAny, {
label?: string | undefined;
description?: string | undefined;

@@ -1372,2 +1423,3 @@ title?: string | undefined;

}, {
label?: string | undefined;
description?: string | undefined;

@@ -1785,3 +1837,3 @@ title?: string | undefined;

export declare type HostSchema = typeof hostSchema;
export declare type PeerConnectionInitializer = (inputs: z.infer<typeof INITIALIZE_PEER_CONNECTION['inputs']>) => Promise<z.infer<typeof INITIALIZE_PEER_CONNECTION['returns']>>;
export declare type PeerConnectionInitializer = (inputs: z.infer<(typeof INITIALIZE_PEER_CONNECTION)['inputs']>) => Promise<z.infer<(typeof INITIALIZE_PEER_CONNECTION)['returns']>>;
export {};

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

exports.LOADING_OPTIONS = zod_1.z.object({
title: zod_1.z.string().optional(),
label: zod_1.z.string().optional(),
description: zod_1.z.string().optional(),

@@ -36,3 +36,3 @@ itemsInQueue: zod_1.z.number().int().optional(),

const LOADING_STATE = zod_1.z.object({
title: zod_1.z.string().optional(),
label: zod_1.z.string().optional(),
description: zod_1.z.string().optional(),

@@ -42,2 +42,6 @@ itemsInQueue: zod_1.z.number().int().optional(),

});
const BACKWARD_COMPATIBLE_LOADING_STATE = LOADING_STATE.merge(zod_1.z.object({
/** @deprecated in favor of `label` (for real this time) */
title: zod_1.z.string().optional(),
}));
const SDK_ALERT = zod_1.z.object({

@@ -269,5 +273,4 @@ minSdkVersion: zod_1.z.string(),

SEND_LOADING_CALL: {
inputs: zod_1.z.intersection(LOADING_STATE, zod_1.z.object({
inputs: zod_1.z.intersection(BACKWARD_COMPATIBLE_LOADING_STATE, zod_1.z.object({
transactionId: zod_1.z.string(),
label: zod_1.z.string().optional(),
skipClientCall: zod_1.z.boolean().optional(),

@@ -366,2 +369,16 @@ })),

},
BEGIN_HOST_SHUTDOWN: {
// intentional empty object to allow for future additions
// and to support current `skipClientCall` behavior
inputs: zod_1.z.object({}),
returns: zod_1.z.discriminatedUnion('type', [
zod_1.z.object({
type: zod_1.z.literal('success'),
}),
zod_1.z.object({
type: zod_1.z.literal('error'),
message: zod_1.z.string().optional(),
}),
]),
},
};

@@ -416,3 +433,3 @@ exports.clientSchema = {

})
.merge(LOADING_STATE),
.merge(BACKWARD_COMPATIBLE_LOADING_STATE),
returns: zod_1.z.boolean(),

@@ -419,0 +436,0 @@ },

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ioSchema = exports.metaItemSchema = exports.requiresServer = exports.supportsMultiple = exports.resolvesImmediately = exports.dateTimeObject = exports.timeObject = exports.dateObject = exports.currencyCode = exports.CURRENCIES = exports.internalGridItem = exports.gridItem = exports.internalTableColumn = exports.internalTableRow = exports.legacyLinkSchema = exports.linkSchema = exports.buttonItem = exports.menuItem = exports.tableRow = exports.tableRowValue = exports.advancedPrimitive = exports.richSelectOption = exports.imageSchema = exports.imageSize = exports.serializableRecord = exports.serializableSchema = exports.deserializableRecord = exports.deserializableSchema = exports.labelValue = exports.primitiveValue = exports.typeValue = exports.IO_RESPONSE = exports.IO_RENDER = exports.DISPLAY_RENDER = exports.COMPONENT_TO_RENDER = exports.INPUT_COMPONENT_TO_RENDER = exports.DISPLAY_COMPONENT_TO_RENDER = void 0;
exports.ioSchema = exports.metaItemSchema = exports.requiresServer = exports.supportsMultiple = exports.resolvesImmediately = exports.dateTimeObject = exports.timeObject = exports.dateObject = exports.currencyCode = exports.CURRENCIES = exports.internalGridItem = exports.backwardCompatibleGridItem = exports.gridItem = exports.internalTableColumn = exports.internalTableRow = exports.legacyLinkSchema = exports.linkSchema = exports.buttonItem = exports.menuItem = exports.tableRow = exports.tableRowValue = exports.advancedPrimitive = exports.richSelectOption = exports.imageSchema = exports.imageSize = exports.serializableRecord = exports.serializableSchema = exports.deserializableRecord = exports.deserializableSchema = exports.labelValue = exports.primitiveValue = exports.typeValue = exports.IO_RESPONSE = exports.IO_RENDER = exports.DISPLAY_RENDER = exports.COMPONENT_TO_RENDER = exports.INPUT_COMPONENT_TO_RENDER = exports.DISPLAY_COMPONENT_TO_RENDER = void 0;
const zod_1 = require("zod");

@@ -16,5 +16,7 @@ exports.DISPLAY_COMPONENT_TO_RENDER = zod_1.z.object({

validationErrorMessage: zod_1.z.string().nullish(),
multipleProps: zod_1.z.optional(zod_1.z.object({
defaultValue: zod_1.z.optional(zod_1.z.array(zod_1.z.any())),
})),
multipleProps: zod_1.z
.optional(zod_1.z.object({
defaultValue: zod_1.z.optional(zod_1.z.array(zod_1.z.any())).nullable(),
}))
.nullable(),
}));

@@ -238,3 +240,3 @@ exports.COMPONENT_TO_RENDER = exports.INPUT_COMPONENT_TO_RENDER;

exports.gridItem = zod_1.z.object({
title: zod_1.z.string().nullable().optional(),
label: zod_1.z.string().nullable().optional(),
description: zod_1.z.string().nullable().optional(),

@@ -255,4 +257,8 @@ image: zod_1.z

});
exports.backwardCompatibleGridItem = exports.gridItem.merge(zod_1.z.object({
// @deprecated in favor of label
title: zod_1.z.string().nullable().optional(),
}));
exports.internalGridItem = zod_1.z.object({
data: exports.gridItem,
data: exports.backwardCompatibleGridItem,
key: zod_1.z.string(),

@@ -463,3 +469,3 @@ filterValue: zod_1.z.string().optional(),

placeholder: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()).nullable(),
multiline: zod_1.z.optional(zod_1.z.boolean()),

@@ -478,3 +484,3 @@ lines: zod_1.z.optional(zod_1.z.number()),

placeholder: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()).nullable(),
disabled: zod_1.z.optional(zod_1.z.boolean().default(false)),

@@ -492,3 +498,3 @@ }),

placeholder: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.number()),
defaultValue: zod_1.z.optional(zod_1.z.number()).nullable(),
decimals: zod_1.z.optional(zod_1.z.number().positive().int()),

@@ -505,3 +511,3 @@ currency: zod_1.z.optional(exports.currencyCode),

placeholder: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()).nullable(),
allowedProtocols: zod_1.z.array(zod_1.z.string()).default(['http', 'https']),

@@ -516,3 +522,7 @@ disabled: zod_1.z.optional(zod_1.z.boolean().default(false)),

helpText: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.boolean().default(false),
defaultValue: zod_1.z
.boolean()
.nullable()
.default(false)
.transform(val => !!val),
disabled: zod_1.z.optional(zod_1.z.boolean().default(false)),

@@ -527,3 +537,3 @@ }),

placeholder: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()).nullable(),
disabled: zod_1.z.optional(zod_1.z.boolean().default(false)),

@@ -537,3 +547,3 @@ }),

helpText: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(exports.dateObject),
defaultValue: zod_1.z.optional(exports.dateObject).nullable(),
min: zod_1.z.optional(exports.dateObject),

@@ -549,3 +559,3 @@ max: zod_1.z.optional(exports.dateObject),

helpText: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(exports.timeObject),
defaultValue: zod_1.z.optional(exports.timeObject).nullable(),
min: zod_1.z.optional(exports.timeObject),

@@ -561,3 +571,3 @@ max: zod_1.z.optional(exports.timeObject),

helpText: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(exports.dateTimeObject),
defaultValue: zod_1.z.optional(exports.dateTimeObject).nullable(),
min: zod_1.z.optional(exports.dateTimeObject),

@@ -573,3 +583,3 @@ max: zod_1.z.optional(exports.dateTimeObject),

helpText: zod_1.z.string().optional(),
defaultValue: zod_1.z.optional(zod_1.z.array(exports.deserializableRecord)),
defaultValue: zod_1.z.optional(zod_1.z.array(exports.deserializableRecord)).nullable(),
columns: zod_1.z.record(exports.typeValue),

@@ -618,3 +628,3 @@ }),

results: zod_1.z.array(searchResult),
defaultValue: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(zod_1.z.string()).nullable(),
placeholder: zod_1.z.optional(zod_1.z.string()),

@@ -679,3 +689,3 @@ helpText: zod_1.z.optional(zod_1.z.string()),

helpText: zod_1.z.optional(zod_1.z.string()),
defaultValue: zod_1.z.optional(exports.richSelectOption),
defaultValue: zod_1.z.optional(exports.richSelectOption).nullable(),
searchable: zod_1.z.optional(zod_1.z.boolean()),

@@ -693,3 +703,5 @@ disabled: zod_1.z.optional(zod_1.z.boolean().default(false)),

.array(exports.labelValue)
.default([]),
.nullable()
.default([])
.transform(val => val !== null && val !== void 0 ? val : []),
minSelections: zod_1.z.optional(zod_1.z.number().int().min(0)),

@@ -696,0 +708,0 @@ maxSelections: zod_1.z.optional(zod_1.z.number().positive().int()),

{
"name": "@interval/sdk",
"version": "0.38.0-dev1",
"version": "0.38.0",
"description": "The frontendless framework for high growth companies. Interval automatically generates apps by inlining the UI in your backend code. It's a faster and more maintainable way to build internal tools, rapid prototypes, and more.",

@@ -5,0 +5,0 @@ "homepage": "https://interval.com",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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