@upstash/qstash 2.7.5 → 2.7.6-canary
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/chunk-B3NB4QLV.mjs +2920 -0
- package/chunk-IJ3475FO.mjs +403 -0
- package/chunk-IJ5AEYLN.js +1 -0
- package/chunk-NMSGEGBP.js +403 -0
- package/chunk-S7JMIMW4.mjs +0 -0
- package/chunk-WQZ4U6LJ.js +2920 -0
- package/{dist/workflow/index.d.mts → client-aUVEwn93.d.mts} +868 -800
- package/{dist/nextjs/index.d.mts → client-aUVEwn93.d.ts} +871 -743
- package/cloudflare.d.mts +33 -0
- package/cloudflare.d.ts +33 -0
- package/cloudflare.js +37 -0
- package/cloudflare.mjs +37 -0
- package/h3.d.mts +17 -0
- package/h3.d.ts +17 -0
- package/h3.js +10 -0
- package/h3.mjs +10 -0
- package/hono.d.mts +25 -0
- package/hono.d.ts +25 -0
- package/hono.js +22 -0
- package/hono.mjs +22 -0
- package/index.d.mts +54 -0
- package/index.d.ts +54 -0
- package/index.js +41 -0
- package/index.mjs +41 -0
- package/nextjs.d.mts +38 -0
- package/nextjs.d.ts +38 -0
- package/nextjs.js +178 -0
- package/nextjs.mjs +178 -0
- package/nuxt.d.mts +12 -0
- package/nuxt.d.ts +12 -0
- package/nuxt.js +11 -0
- package/nuxt.mjs +11 -0
- package/package.json +1 -1
- package/solidjs.d.mts +22 -0
- package/solidjs.d.ts +22 -0
- package/solidjs.js +56 -0
- package/solidjs.mjs +56 -0
- package/svelte.d.mts +24 -0
- package/svelte.d.ts +24 -0
- package/svelte.js +53 -0
- package/svelte.mjs +53 -0
- package/workflow.d.mts +2 -0
- package/workflow.d.ts +2 -0
- package/workflow.js +18 -0
- package/workflow.mjs +18 -0
- package/dist/base/index.d.mts +0 -1279
- package/dist/base/index.mjs +0 -2
- package/dist/cloudflare/index.d.mts +0 -1652
- package/dist/cloudflare/index.mjs +0 -11
- package/dist/h3/index.d.mts +0 -1637
- package/dist/h3/index.mjs +0 -11
- package/dist/hono/index.d.mts +0 -1645
- package/dist/hono/index.mjs +0 -11
- package/dist/nextjs/index.mjs +0 -11
- package/dist/solidjs/index.d.mts +0 -1642
- package/dist/solidjs/index.mjs +0 -11
- package/dist/svelte/index.d.mts +0 -1644
- package/dist/svelte/index.mjs +0 -11
- package/dist/workflow/index.mjs +0 -11
package/cloudflare.d.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-aUVEwn93.mjs';
|
|
2
|
+
import 'neverthrow';
|
|
3
|
+
|
|
4
|
+
type WorkflowBindings = {
|
|
5
|
+
QSTASH_TOKEN: string;
|
|
6
|
+
QSTASH_URL?: string;
|
|
7
|
+
QSTASH_CURRENT_SIGNING_KEY?: string;
|
|
8
|
+
QSTASH_NEXT_SIGNING_KEY?: string;
|
|
9
|
+
UPSTASH_WORKFLOW_URL?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Cloudflare Pages Function arguments
|
|
13
|
+
*/
|
|
14
|
+
type PagesHandlerArgs = [{
|
|
15
|
+
request: Request;
|
|
16
|
+
env: Record<string, string | undefined>;
|
|
17
|
+
}];
|
|
18
|
+
/**
|
|
19
|
+
* Cloudflare Worker arguments
|
|
20
|
+
*/
|
|
21
|
+
type WorkersHandlerArgs = [Request, Record<string, string | undefined>];
|
|
22
|
+
/**
|
|
23
|
+
* Serve method to serve a QStash workflow in a Nextjs project
|
|
24
|
+
*
|
|
25
|
+
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
26
|
+
*
|
|
27
|
+
* @param routeFunction workflow function
|
|
28
|
+
* @param options workflow options
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((...args: PagesHandlerArgs | WorkersHandlerArgs) => Promise<Response>);
|
|
32
|
+
|
|
33
|
+
export { type PagesHandlerArgs, type WorkersHandlerArgs, type WorkflowBindings, serve };
|
package/cloudflare.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-aUVEwn93.js';
|
|
2
|
+
import 'neverthrow';
|
|
3
|
+
|
|
4
|
+
type WorkflowBindings = {
|
|
5
|
+
QSTASH_TOKEN: string;
|
|
6
|
+
QSTASH_URL?: string;
|
|
7
|
+
QSTASH_CURRENT_SIGNING_KEY?: string;
|
|
8
|
+
QSTASH_NEXT_SIGNING_KEY?: string;
|
|
9
|
+
UPSTASH_WORKFLOW_URL?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Cloudflare Pages Function arguments
|
|
13
|
+
*/
|
|
14
|
+
type PagesHandlerArgs = [{
|
|
15
|
+
request: Request;
|
|
16
|
+
env: Record<string, string | undefined>;
|
|
17
|
+
}];
|
|
18
|
+
/**
|
|
19
|
+
* Cloudflare Worker arguments
|
|
20
|
+
*/
|
|
21
|
+
type WorkersHandlerArgs = [Request, Record<string, string | undefined>];
|
|
22
|
+
/**
|
|
23
|
+
* Serve method to serve a QStash workflow in a Nextjs project
|
|
24
|
+
*
|
|
25
|
+
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
26
|
+
*
|
|
27
|
+
* @param routeFunction workflow function
|
|
28
|
+
* @param options workflow options
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((...args: PagesHandlerArgs | WorkersHandlerArgs) => Promise<Response>);
|
|
32
|
+
|
|
33
|
+
export { type PagesHandlerArgs, type WorkersHandlerArgs, type WorkflowBindings, serve };
|
package/cloudflare.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkWQZ4U6LJjs = require('./chunk-WQZ4U6LJ.js');
|
|
4
|
+
|
|
5
|
+
// platforms/cloudflare.ts
|
|
6
|
+
var getArgs = (args) => {
|
|
7
|
+
if (!Array.isArray(args) || args.length === 0) {
|
|
8
|
+
throw new Error("No arguments passed to serve handler");
|
|
9
|
+
}
|
|
10
|
+
if (typeof args[0] === "object" && "request" in args[0] && "env" in args[0]) {
|
|
11
|
+
return {
|
|
12
|
+
request: args[0].request,
|
|
13
|
+
env: args[0].env
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (args.length > 1 && typeof args[1] === "object") {
|
|
17
|
+
return {
|
|
18
|
+
request: args[0],
|
|
19
|
+
env: args[1]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
throw new Error("Could not derive handler arguments from input. Please check how serve is used.");
|
|
23
|
+
};
|
|
24
|
+
var serve2 = (routeFunction, options) => {
|
|
25
|
+
const handler = async (...args) => {
|
|
26
|
+
const { request, env } = getArgs(args);
|
|
27
|
+
const serveHandler = _chunkWQZ4U6LJjs.serve.call(void 0, routeFunction, {
|
|
28
|
+
env,
|
|
29
|
+
...options
|
|
30
|
+
});
|
|
31
|
+
return await serveHandler(request);
|
|
32
|
+
};
|
|
33
|
+
return handler;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
exports.serve = serve2;
|
package/cloudflare.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
serve
|
|
3
|
+
} from "./chunk-B3NB4QLV.mjs";
|
|
4
|
+
|
|
5
|
+
// platforms/cloudflare.ts
|
|
6
|
+
var getArgs = (args) => {
|
|
7
|
+
if (!Array.isArray(args) || args.length === 0) {
|
|
8
|
+
throw new Error("No arguments passed to serve handler");
|
|
9
|
+
}
|
|
10
|
+
if (typeof args[0] === "object" && "request" in args[0] && "env" in args[0]) {
|
|
11
|
+
return {
|
|
12
|
+
request: args[0].request,
|
|
13
|
+
env: args[0].env
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (args.length > 1 && typeof args[1] === "object") {
|
|
17
|
+
return {
|
|
18
|
+
request: args[0],
|
|
19
|
+
env: args[1]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
throw new Error("Could not derive handler arguments from input. Please check how serve is used.");
|
|
23
|
+
};
|
|
24
|
+
var serve2 = (routeFunction, options) => {
|
|
25
|
+
const handler = async (...args) => {
|
|
26
|
+
const { request, env } = getArgs(args);
|
|
27
|
+
const serveHandler = serve(routeFunction, {
|
|
28
|
+
env,
|
|
29
|
+
...options
|
|
30
|
+
});
|
|
31
|
+
return await serveHandler(request);
|
|
32
|
+
};
|
|
33
|
+
return handler;
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
serve2 as serve
|
|
37
|
+
};
|
package/h3.d.mts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as h3 from 'h3';
|
|
2
|
+
import { H3Event } from 'h3';
|
|
3
|
+
import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-aUVEwn93.mjs';
|
|
4
|
+
import 'neverthrow';
|
|
5
|
+
|
|
6
|
+
type VerifySignatureConfig = {
|
|
7
|
+
currentSigningKey?: string;
|
|
8
|
+
nextSigningKey?: string;
|
|
9
|
+
clockTolerance?: number;
|
|
10
|
+
};
|
|
11
|
+
declare const verifySignatureH3: (handler: (event: H3Event) => Promise<unknown>, config?: VerifySignatureConfig) => h3.EventHandler<h3.EventHandlerRequest, Promise<unknown>>;
|
|
12
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => h3.EventHandler<h3.EventHandlerRequest, Promise<Response | {
|
|
13
|
+
status: number;
|
|
14
|
+
body: string;
|
|
15
|
+
}>>;
|
|
16
|
+
|
|
17
|
+
export { serve, verifySignatureH3 };
|
package/h3.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as h3 from 'h3';
|
|
2
|
+
import { H3Event } from 'h3';
|
|
3
|
+
import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-aUVEwn93.js';
|
|
4
|
+
import 'neverthrow';
|
|
5
|
+
|
|
6
|
+
type VerifySignatureConfig = {
|
|
7
|
+
currentSigningKey?: string;
|
|
8
|
+
nextSigningKey?: string;
|
|
9
|
+
clockTolerance?: number;
|
|
10
|
+
};
|
|
11
|
+
declare const verifySignatureH3: (handler: (event: H3Event) => Promise<unknown>, config?: VerifySignatureConfig) => h3.EventHandler<h3.EventHandlerRequest, Promise<unknown>>;
|
|
12
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => h3.EventHandler<h3.EventHandlerRequest, Promise<Response | {
|
|
13
|
+
status: number;
|
|
14
|
+
body: string;
|
|
15
|
+
}>>;
|
|
16
|
+
|
|
17
|
+
export { serve, verifySignatureH3 };
|
package/h3.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkNMSGEGBPjs = require('./chunk-NMSGEGBP.js');
|
|
5
|
+
require('./chunk-IJ5AEYLN.js');
|
|
6
|
+
require('./chunk-WQZ4U6LJ.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.serve = _chunkNMSGEGBPjs.serve; exports.verifySignatureH3 = _chunkNMSGEGBPjs.verifySignatureH3;
|
package/h3.mjs
ADDED
package/hono.d.mts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Context } from 'hono';
|
|
2
|
+
import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-aUVEwn93.mjs';
|
|
3
|
+
import 'neverthrow';
|
|
4
|
+
|
|
5
|
+
type WorkflowBindings = {
|
|
6
|
+
QSTASH_TOKEN: string;
|
|
7
|
+
QSTASH_URL?: string;
|
|
8
|
+
QSTASH_CURRENT_SIGNING_KEY?: string;
|
|
9
|
+
QSTASH_NEXT_SIGNING_KEY?: string;
|
|
10
|
+
UPSTASH_WORKFLOW_URL?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Serve method to serve a QStash workflow in a Nextjs project
|
|
14
|
+
*
|
|
15
|
+
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
16
|
+
*
|
|
17
|
+
* @param routeFunction workflow function
|
|
18
|
+
* @param options workflow options
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((context: Context<{
|
|
22
|
+
Bindings: TBindings;
|
|
23
|
+
}>) => Promise<Response>);
|
|
24
|
+
|
|
25
|
+
export { type WorkflowBindings, serve };
|
package/hono.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Context } from 'hono';
|
|
2
|
+
import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-aUVEwn93.js';
|
|
3
|
+
import 'neverthrow';
|
|
4
|
+
|
|
5
|
+
type WorkflowBindings = {
|
|
6
|
+
QSTASH_TOKEN: string;
|
|
7
|
+
QSTASH_URL?: string;
|
|
8
|
+
QSTASH_CURRENT_SIGNING_KEY?: string;
|
|
9
|
+
QSTASH_NEXT_SIGNING_KEY?: string;
|
|
10
|
+
UPSTASH_WORKFLOW_URL?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Serve method to serve a QStash workflow in a Nextjs project
|
|
14
|
+
*
|
|
15
|
+
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
16
|
+
*
|
|
17
|
+
* @param routeFunction workflow function
|
|
18
|
+
* @param options workflow options
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
declare const serve: <TInitialPayload = unknown, TBindings extends WorkflowBindings = WorkflowBindings>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => ((context: Context<{
|
|
22
|
+
Bindings: TBindings;
|
|
23
|
+
}>) => Promise<Response>);
|
|
24
|
+
|
|
25
|
+
export { type WorkflowBindings, serve };
|
package/hono.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkWQZ4U6LJjs = require('./chunk-WQZ4U6LJ.js');
|
|
4
|
+
|
|
5
|
+
// platforms/hono.ts
|
|
6
|
+
var serve2 = (routeFunction, options) => {
|
|
7
|
+
const handler = async (context) => {
|
|
8
|
+
const environment = context.env;
|
|
9
|
+
const request = context.req.raw;
|
|
10
|
+
const serveHandler = _chunkWQZ4U6LJjs.serve.call(void 0, routeFunction, {
|
|
11
|
+
// when hono is used without cf workers, it sends a DebugHTTPServer
|
|
12
|
+
// object in `context.env`. don't pass env if this is the case:
|
|
13
|
+
env: "QSTASH_TOKEN" in environment ? environment : void 0,
|
|
14
|
+
...options
|
|
15
|
+
});
|
|
16
|
+
return await serveHandler(request);
|
|
17
|
+
};
|
|
18
|
+
return handler;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.serve = serve2;
|
package/hono.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
serve
|
|
3
|
+
} from "./chunk-B3NB4QLV.mjs";
|
|
4
|
+
|
|
5
|
+
// platforms/hono.ts
|
|
6
|
+
var serve2 = (routeFunction, options) => {
|
|
7
|
+
const handler = async (context) => {
|
|
8
|
+
const environment = context.env;
|
|
9
|
+
const request = context.req.raw;
|
|
10
|
+
const serveHandler = serve(routeFunction, {
|
|
11
|
+
// when hono is used without cf workers, it sends a DebugHTTPServer
|
|
12
|
+
// object in `context.env`. don't pass env if this is the case:
|
|
13
|
+
env: "QSTASH_TOKEN" in environment ? environment : void 0,
|
|
14
|
+
...options
|
|
15
|
+
});
|
|
16
|
+
return await serveHandler(request);
|
|
17
|
+
};
|
|
18
|
+
return handler;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
serve2 as serve
|
|
22
|
+
};
|
package/index.d.mts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-aUVEwn93.mjs';
|
|
2
|
+
export { A as AddEndpointsRequest, $ as AnalyticsConfig, a0 as AnalyticsSetup, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, a1 as setupAnalytics, Z as upstash } from './client-aUVEwn93.mjs';
|
|
3
|
+
import 'neverthrow';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Result of 500 Internal Server Error
|
|
7
|
+
*/
|
|
8
|
+
declare class QstashError extends Error {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
declare class QstashRatelimitError extends QstashError {
|
|
12
|
+
limit: string | null;
|
|
13
|
+
remaining: string | null;
|
|
14
|
+
reset: string | null;
|
|
15
|
+
constructor(args: RateLimit);
|
|
16
|
+
}
|
|
17
|
+
declare class QstashChatRatelimitError extends QstashError {
|
|
18
|
+
limitRequests: string | null;
|
|
19
|
+
limitTokens: string | null;
|
|
20
|
+
remainingRequests: string | null;
|
|
21
|
+
remainingTokens: string | null;
|
|
22
|
+
resetRequests: string | null;
|
|
23
|
+
resetTokens: string | null;
|
|
24
|
+
constructor(args: ChatRateLimit);
|
|
25
|
+
}
|
|
26
|
+
declare class QstashDailyRatelimitError extends QstashError {
|
|
27
|
+
limit: string | null;
|
|
28
|
+
remaining: string | null;
|
|
29
|
+
reset: string | null;
|
|
30
|
+
constructor(args: RateLimit);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Error raised during Workflow execution
|
|
34
|
+
*/
|
|
35
|
+
declare class QStashWorkflowError extends QstashError {
|
|
36
|
+
constructor(message: string);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Raised when the workflow executes a function and aborts
|
|
40
|
+
*/
|
|
41
|
+
declare class QStashWorkflowAbort extends Error {
|
|
42
|
+
stepInfo?: Step;
|
|
43
|
+
stepName: string;
|
|
44
|
+
constructor(stepName: string, stepInfo?: Step);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Formats an unknown error to match the FailureFunctionPayload format
|
|
48
|
+
*
|
|
49
|
+
* @param error
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
declare const formatWorkflowError: (error: unknown) => FailureFunctionPayload;
|
|
53
|
+
|
|
54
|
+
export { ChatRateLimit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, RateLimit, formatWorkflowError };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { R as RateLimit, C as ChatRateLimit, S as Step, F as FailureFunctionPayload } from './client-aUVEwn93.js';
|
|
2
|
+
export { A as AddEndpointsRequest, $ as AnalyticsConfig, a0 as AnalyticsSetup, B as BodyInit, y as Chat, D as ChatCompletion, I as ChatCompletionChunk, z as ChatCompletionMessage, T as ChatRequest, f as Client, n as CreateScheduleRequest, p as Endpoint, t as Event, u as EventPayload, E as EventsRequest, v as GetEventsPayload, G as GetEventsResponse, H as HTTPMethods, w as HeadersInit, M as Message, k as MessagePayload, l as Messages, O as OpenAIChatModel, N as PromptChatRequest, _ as ProviderReturnType, P as PublishBatchRequest, e as PublishJsonRequest, d as PublishRequest, j as PublishResponse, g as PublishToApiResponse, i as PublishToUrlGroupsResponse, h as PublishToUrlResponse, Q as QueueRequest, c as Receiver, a as ReceiverConfig, q as RemoveEndpointsRequest, x as RequestOptions, m as Schedule, o as Schedules, b as SignatureError, s as State, K as StreamDisabled, J as StreamEnabled, L as StreamParameter, U as UrlGroup, r as UrlGroups, V as VerifyRequest, W as WithCursor, X as custom, Y as openai, a1 as setupAnalytics, Z as upstash } from './client-aUVEwn93.js';
|
|
3
|
+
import 'neverthrow';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Result of 500 Internal Server Error
|
|
7
|
+
*/
|
|
8
|
+
declare class QstashError extends Error {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
declare class QstashRatelimitError extends QstashError {
|
|
12
|
+
limit: string | null;
|
|
13
|
+
remaining: string | null;
|
|
14
|
+
reset: string | null;
|
|
15
|
+
constructor(args: RateLimit);
|
|
16
|
+
}
|
|
17
|
+
declare class QstashChatRatelimitError extends QstashError {
|
|
18
|
+
limitRequests: string | null;
|
|
19
|
+
limitTokens: string | null;
|
|
20
|
+
remainingRequests: string | null;
|
|
21
|
+
remainingTokens: string | null;
|
|
22
|
+
resetRequests: string | null;
|
|
23
|
+
resetTokens: string | null;
|
|
24
|
+
constructor(args: ChatRateLimit);
|
|
25
|
+
}
|
|
26
|
+
declare class QstashDailyRatelimitError extends QstashError {
|
|
27
|
+
limit: string | null;
|
|
28
|
+
remaining: string | null;
|
|
29
|
+
reset: string | null;
|
|
30
|
+
constructor(args: RateLimit);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Error raised during Workflow execution
|
|
34
|
+
*/
|
|
35
|
+
declare class QStashWorkflowError extends QstashError {
|
|
36
|
+
constructor(message: string);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Raised when the workflow executes a function and aborts
|
|
40
|
+
*/
|
|
41
|
+
declare class QStashWorkflowAbort extends Error {
|
|
42
|
+
stepInfo?: Step;
|
|
43
|
+
stepName: string;
|
|
44
|
+
constructor(stepName: string, stepInfo?: Step);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Formats an unknown error to match the FailureFunctionPayload format
|
|
48
|
+
*
|
|
49
|
+
* @param error
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
declare const formatWorkflowError: (error: unknown) => FailureFunctionPayload;
|
|
53
|
+
|
|
54
|
+
export { ChatRateLimit, QStashWorkflowAbort, QStashWorkflowError, QstashChatRatelimitError, QstashDailyRatelimitError, QstashError, QstashRatelimitError, RateLimit, formatWorkflowError };
|
package/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-IJ5AEYLN.js');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkWQZ4U6LJjs = require('./chunk-WQZ4U6LJ.js');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
exports.Chat = _chunkWQZ4U6LJjs.Chat; exports.Client = _chunkWQZ4U6LJjs.Client; exports.Messages = _chunkWQZ4U6LJjs.Messages; exports.QStashWorkflowAbort = _chunkWQZ4U6LJjs.QStashWorkflowAbort; exports.QStashWorkflowError = _chunkWQZ4U6LJjs.QStashWorkflowError; exports.QstashChatRatelimitError = _chunkWQZ4U6LJjs.QstashChatRatelimitError; exports.QstashDailyRatelimitError = _chunkWQZ4U6LJjs.QstashDailyRatelimitError; exports.QstashError = _chunkWQZ4U6LJjs.QstashError; exports.QstashRatelimitError = _chunkWQZ4U6LJjs.QstashRatelimitError; exports.Receiver = _chunkWQZ4U6LJjs.Receiver; exports.Schedules = _chunkWQZ4U6LJjs.Schedules; exports.SignatureError = _chunkWQZ4U6LJjs.SignatureError; exports.UrlGroups = _chunkWQZ4U6LJjs.UrlGroups; exports.custom = _chunkWQZ4U6LJjs.custom; exports.formatWorkflowError = _chunkWQZ4U6LJjs.formatWorkflowError; exports.openai = _chunkWQZ4U6LJjs.openai; exports.setupAnalytics = _chunkWQZ4U6LJjs.setupAnalytics; exports.upstash = _chunkWQZ4U6LJjs.upstash;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import "./chunk-S7JMIMW4.mjs";
|
|
2
|
+
import {
|
|
3
|
+
Chat,
|
|
4
|
+
Client,
|
|
5
|
+
Messages,
|
|
6
|
+
QStashWorkflowAbort,
|
|
7
|
+
QStashWorkflowError,
|
|
8
|
+
QstashChatRatelimitError,
|
|
9
|
+
QstashDailyRatelimitError,
|
|
10
|
+
QstashError,
|
|
11
|
+
QstashRatelimitError,
|
|
12
|
+
Receiver,
|
|
13
|
+
Schedules,
|
|
14
|
+
SignatureError,
|
|
15
|
+
UrlGroups,
|
|
16
|
+
custom,
|
|
17
|
+
formatWorkflowError,
|
|
18
|
+
openai,
|
|
19
|
+
setupAnalytics,
|
|
20
|
+
upstash
|
|
21
|
+
} from "./chunk-B3NB4QLV.mjs";
|
|
22
|
+
export {
|
|
23
|
+
Chat,
|
|
24
|
+
Client,
|
|
25
|
+
Messages,
|
|
26
|
+
QStashWorkflowAbort,
|
|
27
|
+
QStashWorkflowError,
|
|
28
|
+
QstashChatRatelimitError,
|
|
29
|
+
QstashDailyRatelimitError,
|
|
30
|
+
QstashError,
|
|
31
|
+
QstashRatelimitError,
|
|
32
|
+
Receiver,
|
|
33
|
+
Schedules,
|
|
34
|
+
SignatureError,
|
|
35
|
+
UrlGroups,
|
|
36
|
+
custom,
|
|
37
|
+
formatWorkflowError,
|
|
38
|
+
openai,
|
|
39
|
+
setupAnalytics,
|
|
40
|
+
upstash
|
|
41
|
+
};
|
package/nextjs.d.mts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NextApiHandler } from 'next';
|
|
2
|
+
import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
|
|
3
|
+
import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-aUVEwn93.mjs';
|
|
4
|
+
import 'neverthrow';
|
|
5
|
+
|
|
6
|
+
type VerifySignatureConfig = {
|
|
7
|
+
currentSigningKey?: string;
|
|
8
|
+
nextSigningKey?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The url of this api route, including the protocol.
|
|
11
|
+
*
|
|
12
|
+
* If you omit this, the url will be automatically determined by checking the `VERCEL_URL` env variable and assuming `https`
|
|
13
|
+
*/
|
|
14
|
+
url?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Number of seconds to tolerate when checking `nbf` and `exp` claims, to deal with small clock differences among different servers
|
|
17
|
+
*
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
clockTolerance?: number;
|
|
21
|
+
};
|
|
22
|
+
declare function verifySignature(handler: NextApiHandler, config?: VerifySignatureConfig): NextApiHandler;
|
|
23
|
+
declare function verifySignatureEdge(handler: (request: NextRequest, nfe?: NextFetchEvent) => NextResponse | Promise<NextResponse>, config?: VerifySignatureConfig): (request: NextRequest, nfe: NextFetchEvent) => Promise<NextResponse<unknown>>;
|
|
24
|
+
type VerifySignatureAppRouterResponse = NextResponse | Promise<NextResponse> | Response | Promise<Response>;
|
|
25
|
+
declare function verifySignatureAppRouter(handler: ((request: Request, params?: unknown) => VerifySignatureAppRouterResponse) | ((request: NextRequest, params?: unknown) => VerifySignatureAppRouterResponse), config?: VerifySignatureConfig): (request: NextRequest | Request, params?: unknown) => Promise<Response>;
|
|
26
|
+
/**
|
|
27
|
+
* Serve method to serve a QStash workflow in a Nextjs project
|
|
28
|
+
*
|
|
29
|
+
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
30
|
+
*
|
|
31
|
+
* @param routeFunction workflow function
|
|
32
|
+
* @param options workflow options
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<NextResponse, TInitialPayload>, "onStepFinish">) => ((request: Request) => Promise<NextResponse>);
|
|
36
|
+
declare const servePagesRouter: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => NextApiHandler;
|
|
37
|
+
|
|
38
|
+
export { type VerifySignatureConfig, serve, servePagesRouter, verifySignature, verifySignatureAppRouter, verifySignatureEdge };
|
package/nextjs.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NextApiHandler } from 'next';
|
|
2
|
+
import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
|
|
3
|
+
import { a2 as RouteFunction, a3 as WorkflowServeOptions } from './client-aUVEwn93.js';
|
|
4
|
+
import 'neverthrow';
|
|
5
|
+
|
|
6
|
+
type VerifySignatureConfig = {
|
|
7
|
+
currentSigningKey?: string;
|
|
8
|
+
nextSigningKey?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The url of this api route, including the protocol.
|
|
11
|
+
*
|
|
12
|
+
* If you omit this, the url will be automatically determined by checking the `VERCEL_URL` env variable and assuming `https`
|
|
13
|
+
*/
|
|
14
|
+
url?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Number of seconds to tolerate when checking `nbf` and `exp` claims, to deal with small clock differences among different servers
|
|
17
|
+
*
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
clockTolerance?: number;
|
|
21
|
+
};
|
|
22
|
+
declare function verifySignature(handler: NextApiHandler, config?: VerifySignatureConfig): NextApiHandler;
|
|
23
|
+
declare function verifySignatureEdge(handler: (request: NextRequest, nfe?: NextFetchEvent) => NextResponse | Promise<NextResponse>, config?: VerifySignatureConfig): (request: NextRequest, nfe: NextFetchEvent) => Promise<NextResponse<unknown>>;
|
|
24
|
+
type VerifySignatureAppRouterResponse = NextResponse | Promise<NextResponse> | Response | Promise<Response>;
|
|
25
|
+
declare function verifySignatureAppRouter(handler: ((request: Request, params?: unknown) => VerifySignatureAppRouterResponse) | ((request: NextRequest, params?: unknown) => VerifySignatureAppRouterResponse), config?: VerifySignatureConfig): (request: NextRequest | Request, params?: unknown) => Promise<Response>;
|
|
26
|
+
/**
|
|
27
|
+
* Serve method to serve a QStash workflow in a Nextjs project
|
|
28
|
+
*
|
|
29
|
+
* See for options https://upstash.com/docs/qstash/workflows/basics/serve
|
|
30
|
+
*
|
|
31
|
+
* @param routeFunction workflow function
|
|
32
|
+
* @param options workflow options
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
declare const serve: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<NextResponse, TInitialPayload>, "onStepFinish">) => ((request: Request) => Promise<NextResponse>);
|
|
36
|
+
declare const servePagesRouter: <TInitialPayload = unknown>(routeFunction: RouteFunction<TInitialPayload>, options?: Omit<WorkflowServeOptions<Response, TInitialPayload>, "onStepFinish">) => NextApiHandler;
|
|
37
|
+
|
|
38
|
+
export { type VerifySignatureConfig, serve, servePagesRouter, verifySignature, verifySignatureAppRouter, verifySignatureEdge };
|