skedyul 1.7.6 → 1.7.7
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/dist/.build-stamp +1 -1
- package/dist/cli/index.js +108 -0
- package/dist/config/app-config.d.ts +5 -1
- package/dist/config/define.d.ts +34 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/types/batch-operation.d.ts +145 -0
- package/dist/config/types/index.d.ts +1 -0
- package/dist/dedicated/server.js +108 -0
- package/dist/esm/index.mjs +144 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +149 -1
- package/dist/schemas.d.ts +53 -0
- package/dist/server/index.d.ts +3 -2
- package/dist/server/route-handlers/handlers.d.ts +4 -0
- package/dist/server/route-handlers/index.d.ts +1 -1
- package/dist/server/route-handlers/types.d.ts +2 -1
- package/dist/server.js +108 -0
- package/dist/serverless/server.mjs +108 -0
- package/dist/types/batch-operation.d.ts +47 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -1901,6 +1901,31 @@ var SetupStepDefinitionSchema = z8.object({
|
|
|
1901
1901
|
listenToEnv: z8.boolean().optional(),
|
|
1902
1902
|
capabilities: z8.array(z8.string()).optional()
|
|
1903
1903
|
});
|
|
1904
|
+
var BatchPaginationSchema = z8.object({
|
|
1905
|
+
hasMore: z8.boolean(),
|
|
1906
|
+
page: z8.number().int().optional(),
|
|
1907
|
+
total: z8.number().int().optional(),
|
|
1908
|
+
nextCursor: z8.union([z8.string(), z8.number()]).optional(),
|
|
1909
|
+
limit: z8.number().int().positive().optional()
|
|
1910
|
+
});
|
|
1911
|
+
var BatchOperationSetupResultSchema = z8.object({
|
|
1912
|
+
state: z8.record(z8.string(), z8.unknown()).optional(),
|
|
1913
|
+
total: z8.number().int().nonnegative().optional()
|
|
1914
|
+
});
|
|
1915
|
+
var BatchOperationIterateResultSchema = z8.object({
|
|
1916
|
+
items: z8.array(z8.record(z8.string(), z8.unknown())),
|
|
1917
|
+
pagination: BatchPaginationSchema,
|
|
1918
|
+
state: z8.record(z8.string(), z8.unknown()).optional()
|
|
1919
|
+
});
|
|
1920
|
+
var BatchOperationDefinitionSchema = z8.object({
|
|
1921
|
+
handle: z8.string(),
|
|
1922
|
+
label: z8.string(),
|
|
1923
|
+
description: z8.string().optional(),
|
|
1924
|
+
entity: z8.string(),
|
|
1925
|
+
maxConcurrent: z8.number().int().positive().optional(),
|
|
1926
|
+
pageSize: z8.number().int().positive().optional(),
|
|
1927
|
+
icon: z8.string().optional()
|
|
1928
|
+
});
|
|
1904
1929
|
var ProvisionConfigSchema = z8.object({
|
|
1905
1930
|
env: EnvSchemaSchema.optional(),
|
|
1906
1931
|
/** INTERNAL model definitions (app-owned, not visible to users) */
|
|
@@ -1915,7 +1940,9 @@ var ProvisionConfigSchema = z8.object({
|
|
|
1915
1940
|
navigation: NavigationConfigSchema.optional(),
|
|
1916
1941
|
pages: z8.array(PageDefinitionSchema).optional(),
|
|
1917
1942
|
/** Install setup checklist steps (opt-in) */
|
|
1918
|
-
setup: z8.array(SetupStepDefinitionSchema).optional()
|
|
1943
|
+
setup: z8.array(SetupStepDefinitionSchema).optional(),
|
|
1944
|
+
/** Batch operations for imports, syncs, and long-running tasks */
|
|
1945
|
+
batchOperations: z8.array(BatchOperationDefinitionSchema).optional()
|
|
1919
1946
|
});
|
|
1920
1947
|
var SkedyulConfigSchema = z8.object({
|
|
1921
1948
|
name: z8.string(),
|
|
@@ -5437,6 +5464,107 @@ async function handleMcpBatchRoute(req, ctx) {
|
|
|
5437
5464
|
}
|
|
5438
5465
|
};
|
|
5439
5466
|
}
|
|
5467
|
+
async function handleBatchOperationRoute(req, ctx) {
|
|
5468
|
+
const bodyResult = parseJsonBody(req);
|
|
5469
|
+
if (!bodyResult.success) {
|
|
5470
|
+
return bodyResult.error;
|
|
5471
|
+
}
|
|
5472
|
+
const body = bodyResult.data;
|
|
5473
|
+
const registry = ctx.batchOperationRegistry;
|
|
5474
|
+
if (!registry) {
|
|
5475
|
+
return {
|
|
5476
|
+
status: 404,
|
|
5477
|
+
body: {
|
|
5478
|
+
success: false,
|
|
5479
|
+
error: "No batch operations registered"
|
|
5480
|
+
}
|
|
5481
|
+
};
|
|
5482
|
+
}
|
|
5483
|
+
const operation = registry[body.handle];
|
|
5484
|
+
if (!operation) {
|
|
5485
|
+
return {
|
|
5486
|
+
status: 404,
|
|
5487
|
+
body: {
|
|
5488
|
+
success: false,
|
|
5489
|
+
error: `Batch operation not found: ${body.handle}`
|
|
5490
|
+
}
|
|
5491
|
+
};
|
|
5492
|
+
}
|
|
5493
|
+
const log = {
|
|
5494
|
+
info: (message, meta) => {
|
|
5495
|
+
console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
5496
|
+
},
|
|
5497
|
+
warn: (message, meta) => {
|
|
5498
|
+
console.warn(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
5499
|
+
},
|
|
5500
|
+
error: (message, meta) => {
|
|
5501
|
+
console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
5502
|
+
}
|
|
5503
|
+
};
|
|
5504
|
+
try {
|
|
5505
|
+
if (body.method === "setup") {
|
|
5506
|
+
if (!operation.setup) {
|
|
5507
|
+
return {
|
|
5508
|
+
status: 200,
|
|
5509
|
+
body: {
|
|
5510
|
+
success: true,
|
|
5511
|
+
result: { state: {}, total: void 0 }
|
|
5512
|
+
}
|
|
5513
|
+
};
|
|
5514
|
+
}
|
|
5515
|
+
const result = await operation.setup({
|
|
5516
|
+
workplaceId: body.workplaceId,
|
|
5517
|
+
appInstallationId: body.appInstallationId,
|
|
5518
|
+
appId: body.appId,
|
|
5519
|
+
input: body.input,
|
|
5520
|
+
log
|
|
5521
|
+
});
|
|
5522
|
+
return {
|
|
5523
|
+
status: 200,
|
|
5524
|
+
body: {
|
|
5525
|
+
success: true,
|
|
5526
|
+
result
|
|
5527
|
+
}
|
|
5528
|
+
};
|
|
5529
|
+
}
|
|
5530
|
+
if (body.method === "iterate") {
|
|
5531
|
+
const result = await operation.iterate({
|
|
5532
|
+
workplaceId: body.workplaceId,
|
|
5533
|
+
appInstallationId: body.appInstallationId,
|
|
5534
|
+
appId: body.appId,
|
|
5535
|
+
input: body.input,
|
|
5536
|
+
state: body.state,
|
|
5537
|
+
page: body.page,
|
|
5538
|
+
cursor: body.cursor,
|
|
5539
|
+
limit: body.limit,
|
|
5540
|
+
log
|
|
5541
|
+
});
|
|
5542
|
+
return {
|
|
5543
|
+
status: 200,
|
|
5544
|
+
body: {
|
|
5545
|
+
success: true,
|
|
5546
|
+
result
|
|
5547
|
+
}
|
|
5548
|
+
};
|
|
5549
|
+
}
|
|
5550
|
+
return {
|
|
5551
|
+
status: 400,
|
|
5552
|
+
body: {
|
|
5553
|
+
success: false,
|
|
5554
|
+
error: `Unknown method: ${body.method}`
|
|
5555
|
+
}
|
|
5556
|
+
};
|
|
5557
|
+
} catch (err) {
|
|
5558
|
+
log.error("Batch operation failed", { error: err });
|
|
5559
|
+
return {
|
|
5560
|
+
status: 500,
|
|
5561
|
+
body: {
|
|
5562
|
+
success: false,
|
|
5563
|
+
error: err instanceof Error ? err.message : String(err)
|
|
5564
|
+
}
|
|
5565
|
+
};
|
|
5566
|
+
}
|
|
5567
|
+
}
|
|
5440
5568
|
function createNotFoundResponse() {
|
|
5441
5569
|
return {
|
|
5442
5570
|
status: 404,
|
|
@@ -5516,6 +5644,9 @@ async function routeRequest(req, ctx) {
|
|
|
5516
5644
|
if (req.path === "/mcp/batch" && req.method === "POST") {
|
|
5517
5645
|
return handleMcpBatchRoute(req, ctx);
|
|
5518
5646
|
}
|
|
5647
|
+
if (req.path === "/batch-operation" && req.method === "POST") {
|
|
5648
|
+
return handleBatchOperationRoute(req, ctx);
|
|
5649
|
+
}
|
|
5519
5650
|
return createNotFoundResponse();
|
|
5520
5651
|
} catch (err) {
|
|
5521
5652
|
return createErrorResponse2(err);
|
|
@@ -5557,11 +5688,13 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
5557
5688
|
const defaultHeaders = getDefaultHeaders(config.cors);
|
|
5558
5689
|
const registry = config.tools;
|
|
5559
5690
|
const webhookRegistry = config.webhooks;
|
|
5691
|
+
const batchOperationRegistry = config.batchOperations;
|
|
5560
5692
|
const ctx = {
|
|
5561
5693
|
config,
|
|
5562
5694
|
tools,
|
|
5563
5695
|
registry,
|
|
5564
5696
|
webhookRegistry,
|
|
5697
|
+
batchOperationRegistry,
|
|
5565
5698
|
callTool,
|
|
5566
5699
|
state,
|
|
5567
5700
|
mcpServer,
|
|
@@ -5676,12 +5809,14 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
|
|
|
5676
5809
|
const defaultHeaders = getDefaultHeaders(config.cors);
|
|
5677
5810
|
const registry = config.tools;
|
|
5678
5811
|
const webhookRegistry = config.webhooks;
|
|
5812
|
+
const batchOperationRegistry = config.batchOperations;
|
|
5679
5813
|
let hasLoggedStartup = false;
|
|
5680
5814
|
const ctx = {
|
|
5681
5815
|
config,
|
|
5682
5816
|
tools,
|
|
5683
5817
|
registry,
|
|
5684
5818
|
webhookRegistry,
|
|
5819
|
+
batchOperationRegistry,
|
|
5685
5820
|
callTool,
|
|
5686
5821
|
state,
|
|
5687
5822
|
mcpServer,
|
|
@@ -5979,6 +6114,9 @@ function defineNavigation(navigation) {
|
|
|
5979
6114
|
function defineSetupStep(step) {
|
|
5980
6115
|
return step;
|
|
5981
6116
|
}
|
|
6117
|
+
function defineBatchOperation(operation) {
|
|
6118
|
+
return operation;
|
|
6119
|
+
}
|
|
5982
6120
|
|
|
5983
6121
|
// src/config/schema-loader.ts
|
|
5984
6122
|
import * as fs4 from "fs";
|
|
@@ -8423,6 +8561,10 @@ export {
|
|
|
8423
8561
|
AssociationSchema,
|
|
8424
8562
|
AuthenticationError,
|
|
8425
8563
|
BaseEventPayloadSchema,
|
|
8564
|
+
BatchOperationDefinitionSchema,
|
|
8565
|
+
BatchOperationIterateResultSchema,
|
|
8566
|
+
BatchOperationSetupResultSchema,
|
|
8567
|
+
BatchPaginationSchema,
|
|
8426
8568
|
BreadcrumbItemSchema,
|
|
8427
8569
|
CRMCardinalitySchema,
|
|
8428
8570
|
CRMContextSchema2 as CRMContextSchema,
|
|
@@ -8675,6 +8817,7 @@ export {
|
|
|
8675
8817
|
src_default as default,
|
|
8676
8818
|
defaultShouldRetry,
|
|
8677
8819
|
defineAgent,
|
|
8820
|
+
defineBatchOperation,
|
|
8678
8821
|
defineChannel,
|
|
8679
8822
|
defineConfig,
|
|
8680
8823
|
defineEntity,
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const _default: {
|
|
|
16
16
|
z: typeof z;
|
|
17
17
|
};
|
|
18
18
|
export default _default;
|
|
19
|
-
export { defineConfig, defineModel, defineEntity, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, defineSetupStep, getAllEnvKeys, getRequiredInstallEnvKeys, } from './config';
|
|
19
|
+
export { defineConfig, defineModel, defineEntity, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, defineSetupStep, defineBatchOperation, getAllEnvKeys, getRequiredInstallEnvKeys, } from './config';
|
|
20
20
|
export { queuedFetch, requeue, resolveQueue, createQueueHandle, queuedFetchResponse, registerQueueConfig, runWithRateLimitExecutionContext, getRateLimitExecutionContext, defaultShouldRetry, QueueContextError, QueueNotFoundError, QueuedFetchExhaustedError, RequeueOutsideContextError, RateLimitBackendError, RateLimitExceededError, } from './ratelimit';
|
|
21
21
|
export type { QueueInput, QueueSelector, Lease, QueueLimits, ResolvedQueue, RateLimitExecutionContext, RateLimitBackend, QueueScope, QueueConfig, SerializableQueueConfig, QueueRegistry, } from './ratelimit';
|
|
22
22
|
export { sequencer, allow as sequencerAllow, acquire as sequencerAcquire, release as sequencerRelease, resolveSequencer, createSequencerHandle, registerSequencerConfig, clearRegisteredSequencerConfig, getSequencerConfig, getSequencerDefinitions, resetSequencerBackendForTests, memorySequencerBackend, platformSequencerBackend, SequencerContextError, SequencerNotFoundError, SequencerBackendError, SequencerLockError, } from './sequencer';
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,10 @@ __export(index_exports, {
|
|
|
42
42
|
AssociationSchema: () => AssociationSchema,
|
|
43
43
|
AuthenticationError: () => AuthenticationError,
|
|
44
44
|
BaseEventPayloadSchema: () => BaseEventPayloadSchema,
|
|
45
|
+
BatchOperationDefinitionSchema: () => BatchOperationDefinitionSchema,
|
|
46
|
+
BatchOperationIterateResultSchema: () => BatchOperationIterateResultSchema,
|
|
47
|
+
BatchOperationSetupResultSchema: () => BatchOperationSetupResultSchema,
|
|
48
|
+
BatchPaginationSchema: () => BatchPaginationSchema,
|
|
45
49
|
BreadcrumbItemSchema: () => BreadcrumbItemSchema,
|
|
46
50
|
CRMCardinalitySchema: () => CRMCardinalitySchema,
|
|
47
51
|
CRMContextSchema: () => CRMContextSchema2,
|
|
@@ -294,6 +298,7 @@ __export(index_exports, {
|
|
|
294
298
|
default: () => index_default,
|
|
295
299
|
defaultShouldRetry: () => defaultShouldRetry,
|
|
296
300
|
defineAgent: () => defineAgent,
|
|
301
|
+
defineBatchOperation: () => defineBatchOperation,
|
|
297
302
|
defineChannel: () => defineChannel,
|
|
298
303
|
defineConfig: () => defineConfig,
|
|
299
304
|
defineEntity: () => defineEntity,
|
|
@@ -2275,6 +2280,31 @@ var SetupStepDefinitionSchema = import_v48.z.object({
|
|
|
2275
2280
|
listenToEnv: import_v48.z.boolean().optional(),
|
|
2276
2281
|
capabilities: import_v48.z.array(import_v48.z.string()).optional()
|
|
2277
2282
|
});
|
|
2283
|
+
var BatchPaginationSchema = import_v48.z.object({
|
|
2284
|
+
hasMore: import_v48.z.boolean(),
|
|
2285
|
+
page: import_v48.z.number().int().optional(),
|
|
2286
|
+
total: import_v48.z.number().int().optional(),
|
|
2287
|
+
nextCursor: import_v48.z.union([import_v48.z.string(), import_v48.z.number()]).optional(),
|
|
2288
|
+
limit: import_v48.z.number().int().positive().optional()
|
|
2289
|
+
});
|
|
2290
|
+
var BatchOperationSetupResultSchema = import_v48.z.object({
|
|
2291
|
+
state: import_v48.z.record(import_v48.z.string(), import_v48.z.unknown()).optional(),
|
|
2292
|
+
total: import_v48.z.number().int().nonnegative().optional()
|
|
2293
|
+
});
|
|
2294
|
+
var BatchOperationIterateResultSchema = import_v48.z.object({
|
|
2295
|
+
items: import_v48.z.array(import_v48.z.record(import_v48.z.string(), import_v48.z.unknown())),
|
|
2296
|
+
pagination: BatchPaginationSchema,
|
|
2297
|
+
state: import_v48.z.record(import_v48.z.string(), import_v48.z.unknown()).optional()
|
|
2298
|
+
});
|
|
2299
|
+
var BatchOperationDefinitionSchema = import_v48.z.object({
|
|
2300
|
+
handle: import_v48.z.string(),
|
|
2301
|
+
label: import_v48.z.string(),
|
|
2302
|
+
description: import_v48.z.string().optional(),
|
|
2303
|
+
entity: import_v48.z.string(),
|
|
2304
|
+
maxConcurrent: import_v48.z.number().int().positive().optional(),
|
|
2305
|
+
pageSize: import_v48.z.number().int().positive().optional(),
|
|
2306
|
+
icon: import_v48.z.string().optional()
|
|
2307
|
+
});
|
|
2278
2308
|
var ProvisionConfigSchema = import_v48.z.object({
|
|
2279
2309
|
env: EnvSchemaSchema.optional(),
|
|
2280
2310
|
/** INTERNAL model definitions (app-owned, not visible to users) */
|
|
@@ -2289,7 +2319,9 @@ var ProvisionConfigSchema = import_v48.z.object({
|
|
|
2289
2319
|
navigation: NavigationConfigSchema.optional(),
|
|
2290
2320
|
pages: import_v48.z.array(PageDefinitionSchema).optional(),
|
|
2291
2321
|
/** Install setup checklist steps (opt-in) */
|
|
2292
|
-
setup: import_v48.z.array(SetupStepDefinitionSchema).optional()
|
|
2322
|
+
setup: import_v48.z.array(SetupStepDefinitionSchema).optional(),
|
|
2323
|
+
/** Batch operations for imports, syncs, and long-running tasks */
|
|
2324
|
+
batchOperations: import_v48.z.array(BatchOperationDefinitionSchema).optional()
|
|
2293
2325
|
});
|
|
2294
2326
|
var SkedyulConfigSchema = import_v48.z.object({
|
|
2295
2327
|
name: import_v48.z.string(),
|
|
@@ -5811,6 +5843,107 @@ async function handleMcpBatchRoute(req, ctx) {
|
|
|
5811
5843
|
}
|
|
5812
5844
|
};
|
|
5813
5845
|
}
|
|
5846
|
+
async function handleBatchOperationRoute(req, ctx) {
|
|
5847
|
+
const bodyResult = parseJsonBody(req);
|
|
5848
|
+
if (!bodyResult.success) {
|
|
5849
|
+
return bodyResult.error;
|
|
5850
|
+
}
|
|
5851
|
+
const body = bodyResult.data;
|
|
5852
|
+
const registry = ctx.batchOperationRegistry;
|
|
5853
|
+
if (!registry) {
|
|
5854
|
+
return {
|
|
5855
|
+
status: 404,
|
|
5856
|
+
body: {
|
|
5857
|
+
success: false,
|
|
5858
|
+
error: "No batch operations registered"
|
|
5859
|
+
}
|
|
5860
|
+
};
|
|
5861
|
+
}
|
|
5862
|
+
const operation = registry[body.handle];
|
|
5863
|
+
if (!operation) {
|
|
5864
|
+
return {
|
|
5865
|
+
status: 404,
|
|
5866
|
+
body: {
|
|
5867
|
+
success: false,
|
|
5868
|
+
error: `Batch operation not found: ${body.handle}`
|
|
5869
|
+
}
|
|
5870
|
+
};
|
|
5871
|
+
}
|
|
5872
|
+
const log = {
|
|
5873
|
+
info: (message, meta) => {
|
|
5874
|
+
console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
5875
|
+
},
|
|
5876
|
+
warn: (message, meta) => {
|
|
5877
|
+
console.warn(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
5878
|
+
},
|
|
5879
|
+
error: (message, meta) => {
|
|
5880
|
+
console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
5881
|
+
}
|
|
5882
|
+
};
|
|
5883
|
+
try {
|
|
5884
|
+
if (body.method === "setup") {
|
|
5885
|
+
if (!operation.setup) {
|
|
5886
|
+
return {
|
|
5887
|
+
status: 200,
|
|
5888
|
+
body: {
|
|
5889
|
+
success: true,
|
|
5890
|
+
result: { state: {}, total: void 0 }
|
|
5891
|
+
}
|
|
5892
|
+
};
|
|
5893
|
+
}
|
|
5894
|
+
const result = await operation.setup({
|
|
5895
|
+
workplaceId: body.workplaceId,
|
|
5896
|
+
appInstallationId: body.appInstallationId,
|
|
5897
|
+
appId: body.appId,
|
|
5898
|
+
input: body.input,
|
|
5899
|
+
log
|
|
5900
|
+
});
|
|
5901
|
+
return {
|
|
5902
|
+
status: 200,
|
|
5903
|
+
body: {
|
|
5904
|
+
success: true,
|
|
5905
|
+
result
|
|
5906
|
+
}
|
|
5907
|
+
};
|
|
5908
|
+
}
|
|
5909
|
+
if (body.method === "iterate") {
|
|
5910
|
+
const result = await operation.iterate({
|
|
5911
|
+
workplaceId: body.workplaceId,
|
|
5912
|
+
appInstallationId: body.appInstallationId,
|
|
5913
|
+
appId: body.appId,
|
|
5914
|
+
input: body.input,
|
|
5915
|
+
state: body.state,
|
|
5916
|
+
page: body.page,
|
|
5917
|
+
cursor: body.cursor,
|
|
5918
|
+
limit: body.limit,
|
|
5919
|
+
log
|
|
5920
|
+
});
|
|
5921
|
+
return {
|
|
5922
|
+
status: 200,
|
|
5923
|
+
body: {
|
|
5924
|
+
success: true,
|
|
5925
|
+
result
|
|
5926
|
+
}
|
|
5927
|
+
};
|
|
5928
|
+
}
|
|
5929
|
+
return {
|
|
5930
|
+
status: 400,
|
|
5931
|
+
body: {
|
|
5932
|
+
success: false,
|
|
5933
|
+
error: `Unknown method: ${body.method}`
|
|
5934
|
+
}
|
|
5935
|
+
};
|
|
5936
|
+
} catch (err) {
|
|
5937
|
+
log.error("Batch operation failed", { error: err });
|
|
5938
|
+
return {
|
|
5939
|
+
status: 500,
|
|
5940
|
+
body: {
|
|
5941
|
+
success: false,
|
|
5942
|
+
error: err instanceof Error ? err.message : String(err)
|
|
5943
|
+
}
|
|
5944
|
+
};
|
|
5945
|
+
}
|
|
5946
|
+
}
|
|
5814
5947
|
function createNotFoundResponse() {
|
|
5815
5948
|
return {
|
|
5816
5949
|
status: 404,
|
|
@@ -5890,6 +6023,9 @@ async function routeRequest(req, ctx) {
|
|
|
5890
6023
|
if (req.path === "/mcp/batch" && req.method === "POST") {
|
|
5891
6024
|
return handleMcpBatchRoute(req, ctx);
|
|
5892
6025
|
}
|
|
6026
|
+
if (req.path === "/batch-operation" && req.method === "POST") {
|
|
6027
|
+
return handleBatchOperationRoute(req, ctx);
|
|
6028
|
+
}
|
|
5893
6029
|
return createNotFoundResponse();
|
|
5894
6030
|
} catch (err) {
|
|
5895
6031
|
return createErrorResponse2(err);
|
|
@@ -5931,11 +6067,13 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
5931
6067
|
const defaultHeaders = getDefaultHeaders(config.cors);
|
|
5932
6068
|
const registry = config.tools;
|
|
5933
6069
|
const webhookRegistry = config.webhooks;
|
|
6070
|
+
const batchOperationRegistry = config.batchOperations;
|
|
5934
6071
|
const ctx = {
|
|
5935
6072
|
config,
|
|
5936
6073
|
tools,
|
|
5937
6074
|
registry,
|
|
5938
6075
|
webhookRegistry,
|
|
6076
|
+
batchOperationRegistry,
|
|
5939
6077
|
callTool,
|
|
5940
6078
|
state,
|
|
5941
6079
|
mcpServer,
|
|
@@ -6050,12 +6188,14 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
|
|
|
6050
6188
|
const defaultHeaders = getDefaultHeaders(config.cors);
|
|
6051
6189
|
const registry = config.tools;
|
|
6052
6190
|
const webhookRegistry = config.webhooks;
|
|
6191
|
+
const batchOperationRegistry = config.batchOperations;
|
|
6053
6192
|
let hasLoggedStartup = false;
|
|
6054
6193
|
const ctx = {
|
|
6055
6194
|
config,
|
|
6056
6195
|
tools,
|
|
6057
6196
|
registry,
|
|
6058
6197
|
webhookRegistry,
|
|
6198
|
+
batchOperationRegistry,
|
|
6059
6199
|
callTool,
|
|
6060
6200
|
state,
|
|
6061
6201
|
mcpServer,
|
|
@@ -6353,6 +6493,9 @@ function defineNavigation(navigation) {
|
|
|
6353
6493
|
function defineSetupStep(step) {
|
|
6354
6494
|
return step;
|
|
6355
6495
|
}
|
|
6496
|
+
function defineBatchOperation(operation) {
|
|
6497
|
+
return operation;
|
|
6498
|
+
}
|
|
6356
6499
|
|
|
6357
6500
|
// src/config/schema-loader.ts
|
|
6358
6501
|
var fs4 = __toESM(require("fs"));
|
|
@@ -8798,6 +8941,10 @@ var index_default = { z: import_v414.z };
|
|
|
8798
8941
|
AssociationSchema,
|
|
8799
8942
|
AuthenticationError,
|
|
8800
8943
|
BaseEventPayloadSchema,
|
|
8944
|
+
BatchOperationDefinitionSchema,
|
|
8945
|
+
BatchOperationIterateResultSchema,
|
|
8946
|
+
BatchOperationSetupResultSchema,
|
|
8947
|
+
BatchPaginationSchema,
|
|
8801
8948
|
BreadcrumbItemSchema,
|
|
8802
8949
|
CRMCardinalitySchema,
|
|
8803
8950
|
CRMContextSchema,
|
|
@@ -9049,6 +9196,7 @@ var index_default = { z: import_v414.z };
|
|
|
9049
9196
|
cron,
|
|
9050
9197
|
defaultShouldRetry,
|
|
9051
9198
|
defineAgent,
|
|
9199
|
+
defineBatchOperation,
|
|
9052
9200
|
defineChannel,
|
|
9053
9201
|
defineConfig,
|
|
9054
9202
|
defineEntity,
|
package/dist/schemas.d.ts
CHANGED
|
@@ -3357,6 +3357,37 @@ export declare const SetupStepDefinitionSchema: z.ZodObject<{
|
|
|
3357
3357
|
listenToEnv: z.ZodOptional<z.ZodBoolean>;
|
|
3358
3358
|
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3359
3359
|
}, z.core.$strip>;
|
|
3360
|
+
export declare const BatchPaginationSchema: z.ZodObject<{
|
|
3361
|
+
hasMore: z.ZodBoolean;
|
|
3362
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
3363
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
3364
|
+
nextCursor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
3365
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
3366
|
+
}, z.core.$strip>;
|
|
3367
|
+
export declare const BatchOperationSetupResultSchema: z.ZodObject<{
|
|
3368
|
+
state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3369
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
3370
|
+
}, z.core.$strip>;
|
|
3371
|
+
export declare const BatchOperationIterateResultSchema: z.ZodObject<{
|
|
3372
|
+
items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3373
|
+
pagination: z.ZodObject<{
|
|
3374
|
+
hasMore: z.ZodBoolean;
|
|
3375
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
3376
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
3377
|
+
nextCursor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
3378
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
3379
|
+
}, z.core.$strip>;
|
|
3380
|
+
state: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3381
|
+
}, z.core.$strip>;
|
|
3382
|
+
export declare const BatchOperationDefinitionSchema: z.ZodObject<{
|
|
3383
|
+
handle: z.ZodString;
|
|
3384
|
+
label: z.ZodString;
|
|
3385
|
+
description: z.ZodOptional<z.ZodString>;
|
|
3386
|
+
entity: z.ZodString;
|
|
3387
|
+
maxConcurrent: z.ZodOptional<z.ZodNumber>;
|
|
3388
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
3389
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
3390
|
+
}, z.core.$strip>;
|
|
3360
3391
|
export declare const ProvisionConfigSchema: z.ZodObject<{
|
|
3361
3392
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
3362
3393
|
label: z.ZodString;
|
|
@@ -4161,6 +4192,15 @@ export declare const ProvisionConfigSchema: z.ZodObject<{
|
|
|
4161
4192
|
listenToEnv: z.ZodOptional<z.ZodBoolean>;
|
|
4162
4193
|
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4163
4194
|
}, z.core.$strip>>>;
|
|
4195
|
+
batchOperations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4196
|
+
handle: z.ZodString;
|
|
4197
|
+
label: z.ZodString;
|
|
4198
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4199
|
+
entity: z.ZodString;
|
|
4200
|
+
maxConcurrent: z.ZodOptional<z.ZodNumber>;
|
|
4201
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
4202
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
4203
|
+
}, z.core.$strip>>>;
|
|
4164
4204
|
}, z.core.$strip>;
|
|
4165
4205
|
export declare const SkedyulConfigSchema: z.ZodObject<{
|
|
4166
4206
|
name: z.ZodString;
|
|
@@ -4976,6 +5016,15 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
|
|
|
4976
5016
|
listenToEnv: z.ZodOptional<z.ZodBoolean>;
|
|
4977
5017
|
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4978
5018
|
}, z.core.$strip>>>;
|
|
5019
|
+
batchOperations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
5020
|
+
handle: z.ZodString;
|
|
5021
|
+
label: z.ZodString;
|
|
5022
|
+
description: z.ZodOptional<z.ZodString>;
|
|
5023
|
+
entity: z.ZodString;
|
|
5024
|
+
maxConcurrent: z.ZodOptional<z.ZodNumber>;
|
|
5025
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
5026
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
5027
|
+
}, z.core.$strip>>>;
|
|
4979
5028
|
}, z.core.$strip>, z.ZodUnknown]>>;
|
|
4980
5029
|
agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4981
5030
|
handle: z.ZodString;
|
|
@@ -5039,6 +5088,10 @@ export type InstallConfig = z.infer<typeof InstallConfigSchema>;
|
|
|
5039
5088
|
export type ProvisionConfig = z.infer<typeof ProvisionConfigSchema>;
|
|
5040
5089
|
export type SetupStepKind = z.infer<typeof SetupStepKindSchema>;
|
|
5041
5090
|
export type SetupStepDefinition = z.infer<typeof SetupStepDefinitionSchema>;
|
|
5091
|
+
export type BatchPagination = z.infer<typeof BatchPaginationSchema>;
|
|
5092
|
+
export type BatchOperationSetupResult = z.infer<typeof BatchOperationSetupResultSchema>;
|
|
5093
|
+
export type BatchOperationIterateResult = z.infer<typeof BatchOperationIterateResultSchema>;
|
|
5094
|
+
export type BatchOperationDefinition = z.infer<typeof BatchOperationDefinitionSchema>;
|
|
5042
5095
|
export type FormV2StyleProps = z.infer<typeof FormV2StylePropsSchema>;
|
|
5043
5096
|
export type FieldSettingButtonProps = z.infer<typeof FieldSettingButtonPropsSchema>;
|
|
5044
5097
|
export type RelationshipExtension = z.infer<typeof RelationshipExtensionSchema>;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DedicatedServerInstance, ServerlessServerInstance, SkedyulServerInstance, ToolRegistry, WebhookRegistry } from '../types';
|
|
1
|
+
import type { DedicatedServerInstance, ServerlessServerInstance, SkedyulServerInstance, ToolRegistry, WebhookRegistry, BatchOperationRegistry } from '../types';
|
|
2
2
|
import type { SkedyulConfig } from '../config/app-config';
|
|
3
3
|
export type { RequestState, CoreMethod, ToolCallArgs } from './types';
|
|
4
4
|
export { normalizeBilling, toJsonSchema, isToolSchemaWithJson, getZodSchema, getJsonSchemaFromToolSchema, parseJsonRecord, parseNumberEnv, mergeRuntimeEnv, readRawRequestBody, parseJSONBody, sendJSON, sendHTML, getDefaultHeaders, createResponse, getListeningPort, } from './utils';
|
|
@@ -15,9 +15,10 @@ export type { UnifiedRequest, UnifiedResponse, RouteContext } from './route-hand
|
|
|
15
15
|
* Runtime config type - SkedyulConfig with resolved registries (not promises).
|
|
16
16
|
* This is what server.create() expects at runtime.
|
|
17
17
|
*/
|
|
18
|
-
export type RuntimeSkedyulConfig = Omit<SkedyulConfig, 'tools' | 'webhooks'> & {
|
|
18
|
+
export type RuntimeSkedyulConfig = Omit<SkedyulConfig, 'tools' | 'webhooks' | 'batchOperations'> & {
|
|
19
19
|
tools: ToolRegistry;
|
|
20
20
|
webhooks?: WebhookRegistry;
|
|
21
|
+
batchOperations?: BatchOperationRegistry;
|
|
21
22
|
};
|
|
22
23
|
export declare function createSkedyulServer(config: RuntimeSkedyulConfig & {
|
|
23
24
|
computeLayer: 'dedicated';
|
|
@@ -60,6 +60,10 @@ export declare function handleMcpRoute(req: UnifiedRequest, ctx: RouteContext):
|
|
|
60
60
|
* This is used by the message outbox processor for efficient batched delivery.
|
|
61
61
|
*/
|
|
62
62
|
export declare function handleMcpBatchRoute(req: UnifiedRequest, ctx: RouteContext): Promise<UnifiedResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Handle /batch-operation route for invoking batch operation setup/iterate.
|
|
65
|
+
*/
|
|
66
|
+
export declare function handleBatchOperationRoute(req: UnifiedRequest, ctx: RouteContext): Promise<UnifiedResponse>;
|
|
63
67
|
/**
|
|
64
68
|
* Create a 404 Not Found response in JSON-RPC format.
|
|
65
69
|
*/
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type { UnifiedRequest, UnifiedResponse, RouteContext, CallToolFn, ParsedJsonRpcBody, SkedyulToolCallArgs, ParseResult, } from './types';
|
|
8
8
|
export { fromLambdaEvent, toLambdaResponse, parseJsonBody, parseJsonRpcBody, getHeader, getContentType, parseBodyByContentType, } from './adapters';
|
|
9
|
-
export { handleHealthRoute, handleConfigRoute, handleCoreRoute, handleCoreWebhookRoute, handleEstimateRoute, handleInstallRoute, handleUninstallRoute, handleProvisionRoute, handleSetupRevalidateRoute, handleOAuthCallbackRoute, handleWebhookRoute, handleMcpRoute, createNotFoundResponse, createOptionsResponse, createErrorResponse, } from './handlers';
|
|
9
|
+
export { handleHealthRoute, handleConfigRoute, handleCoreRoute, handleCoreWebhookRoute, handleEstimateRoute, handleInstallRoute, handleUninstallRoute, handleProvisionRoute, handleSetupRevalidateRoute, handleOAuthCallbackRoute, handleWebhookRoute, handleMcpRoute, handleBatchOperationRoute, createNotFoundResponse, createOptionsResponse, createErrorResponse, } from './handlers';
|
|
10
10
|
export { routeRequest } from './router';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* allowing route handlers to be transport-agnostic.
|
|
6
6
|
*/
|
|
7
7
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
|
-
import type { ToolCallResponse, ToolMetadata, ToolRegistry, WebhookRegistry, InvocationContext } from '../../types';
|
|
8
|
+
import type { ToolCallResponse, ToolMetadata, ToolRegistry, WebhookRegistry, BatchOperationRegistry, InvocationContext } from '../../types';
|
|
9
9
|
import type { RuntimeSkedyulConfig } from '../index';
|
|
10
10
|
import type { RequestState } from '../types';
|
|
11
11
|
/**
|
|
@@ -39,6 +39,7 @@ export interface RouteContext {
|
|
|
39
39
|
tools: ToolMetadata[];
|
|
40
40
|
registry: ToolRegistry;
|
|
41
41
|
webhookRegistry?: WebhookRegistry;
|
|
42
|
+
batchOperationRegistry?: BatchOperationRegistry;
|
|
42
43
|
callTool: CallToolFn;
|
|
43
44
|
state: RequestState;
|
|
44
45
|
mcpServer: McpServer;
|