skedyul 1.7.7 → 1.7.8
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 +37 -16
- package/dist/config/define.d.ts +2 -0
- package/dist/config/types/batch-operation.d.ts +7 -0
- package/dist/dedicated/server.js +37 -16
- package/dist/esm/index.mjs +37 -16
- package/dist/index.js +37 -16
- package/dist/server/route-handlers/handlers.d.ts +3 -0
- package/dist/server.js +37 -16
- package/dist/serverless/server.mjs +37 -16
- package/package.json +1 -1
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1785985393398
|
package/dist/cli/index.js
CHANGED
|
@@ -4684,6 +4684,17 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
4684
4684
|
}
|
|
4685
4685
|
};
|
|
4686
4686
|
}
|
|
4687
|
+
const context = body.context;
|
|
4688
|
+
if (!context?.workplaceId || !context?.appInstallationId || !context?.appId) {
|
|
4689
|
+
return {
|
|
4690
|
+
status: 400,
|
|
4691
|
+
body: {
|
|
4692
|
+
success: false,
|
|
4693
|
+
error: "Missing context (workplaceId, appInstallationId, and appId required)"
|
|
4694
|
+
}
|
|
4695
|
+
};
|
|
4696
|
+
}
|
|
4697
|
+
const env = body.env ?? {};
|
|
4687
4698
|
const log = {
|
|
4688
4699
|
info: (message, meta) => {
|
|
4689
4700
|
console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
@@ -4695,6 +4706,10 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
4695
4706
|
console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
4696
4707
|
}
|
|
4697
4708
|
};
|
|
4709
|
+
const requestConfig = {
|
|
4710
|
+
baseUrl: env.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? "",
|
|
4711
|
+
apiToken: env.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? ""
|
|
4712
|
+
};
|
|
4698
4713
|
try {
|
|
4699
4714
|
if (body.method === "setup") {
|
|
4700
4715
|
if (!operation.setup) {
|
|
@@ -4706,12 +4721,15 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
4706
4721
|
}
|
|
4707
4722
|
};
|
|
4708
4723
|
}
|
|
4709
|
-
const result = await
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4724
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
4725
|
+
return operation.setup({
|
|
4726
|
+
workplaceId: context.workplaceId,
|
|
4727
|
+
appInstallationId: context.appInstallationId,
|
|
4728
|
+
appId: context.appId,
|
|
4729
|
+
input: body.input,
|
|
4730
|
+
env,
|
|
4731
|
+
log
|
|
4732
|
+
});
|
|
4715
4733
|
});
|
|
4716
4734
|
return {
|
|
4717
4735
|
status: 200,
|
|
@@ -4722,16 +4740,19 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
4722
4740
|
};
|
|
4723
4741
|
}
|
|
4724
4742
|
if (body.method === "iterate") {
|
|
4725
|
-
const result = await
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4743
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
4744
|
+
return operation.iterate({
|
|
4745
|
+
workplaceId: context.workplaceId,
|
|
4746
|
+
appInstallationId: context.appInstallationId,
|
|
4747
|
+
appId: context.appId,
|
|
4748
|
+
input: body.input,
|
|
4749
|
+
state: body.state,
|
|
4750
|
+
page: body.page,
|
|
4751
|
+
cursor: body.cursor,
|
|
4752
|
+
limit: body.limit,
|
|
4753
|
+
env,
|
|
4754
|
+
log
|
|
4755
|
+
});
|
|
4735
4756
|
});
|
|
4736
4757
|
return {
|
|
4737
4758
|
status: 200,
|
package/dist/config/define.d.ts
CHANGED
|
@@ -183,7 +183,9 @@ export declare function defineSetupStep(step: SetupStepDefinition): SetupStepDef
|
|
|
183
183
|
* return { total: count }
|
|
184
184
|
* },
|
|
185
185
|
* iterate: async (ctx) => {
|
|
186
|
+
* const apiKey = ctx.env.GLOFOX_API_KEY
|
|
186
187
|
* const { data, pagination } = await glofox.getMembers({
|
|
188
|
+
* apiKey,
|
|
187
189
|
* limit: ctx.limit,
|
|
188
190
|
* offset: ctx.cursor ?? 0,
|
|
189
191
|
* })
|
|
@@ -55,6 +55,11 @@ export interface BatchOperationContext {
|
|
|
55
55
|
input?: Record<string, unknown>;
|
|
56
56
|
/** State from previous setup or iterate call */
|
|
57
57
|
state?: Record<string, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Runtime environment variables from the platform invoke
|
|
60
|
+
* (APP_INSTALL overrides + SKEDYUL_API_TOKEN / SKEDYUL_API_URL).
|
|
61
|
+
*/
|
|
62
|
+
env: Record<string, string>;
|
|
58
63
|
/** Logger instance */
|
|
59
64
|
log: {
|
|
60
65
|
info: (message: string, meta?: Record<string, unknown>) => void;
|
|
@@ -90,7 +95,9 @@ export type BatchOperationIterateFn = (ctx: BatchOperationContext & {
|
|
|
90
95
|
* return { total: count }
|
|
91
96
|
* },
|
|
92
97
|
* iterate: async (ctx) => {
|
|
98
|
+
* const apiKey = ctx.env.GLOFOX_API_KEY
|
|
93
99
|
* const { data, pagination } = await glofox.getMembers({
|
|
100
|
+
* apiKey,
|
|
94
101
|
* limit: ctx.limit,
|
|
95
102
|
* offset: ctx.cursor ?? 0,
|
|
96
103
|
* })
|
package/dist/dedicated/server.js
CHANGED
|
@@ -2014,6 +2014,17 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2014
2014
|
}
|
|
2015
2015
|
};
|
|
2016
2016
|
}
|
|
2017
|
+
const context = body.context;
|
|
2018
|
+
if (!context?.workplaceId || !context?.appInstallationId || !context?.appId) {
|
|
2019
|
+
return {
|
|
2020
|
+
status: 400,
|
|
2021
|
+
body: {
|
|
2022
|
+
success: false,
|
|
2023
|
+
error: "Missing context (workplaceId, appInstallationId, and appId required)"
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
const env = body.env ?? {};
|
|
2017
2028
|
const log = {
|
|
2018
2029
|
info: (message, meta) => {
|
|
2019
2030
|
console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
@@ -2025,6 +2036,10 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2025
2036
|
console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
2026
2037
|
}
|
|
2027
2038
|
};
|
|
2039
|
+
const requestConfig = {
|
|
2040
|
+
baseUrl: env.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? "",
|
|
2041
|
+
apiToken: env.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? ""
|
|
2042
|
+
};
|
|
2028
2043
|
try {
|
|
2029
2044
|
if (body.method === "setup") {
|
|
2030
2045
|
if (!operation.setup) {
|
|
@@ -2036,12 +2051,15 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2036
2051
|
}
|
|
2037
2052
|
};
|
|
2038
2053
|
}
|
|
2039
|
-
const result = await
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2054
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
2055
|
+
return operation.setup({
|
|
2056
|
+
workplaceId: context.workplaceId,
|
|
2057
|
+
appInstallationId: context.appInstallationId,
|
|
2058
|
+
appId: context.appId,
|
|
2059
|
+
input: body.input,
|
|
2060
|
+
env,
|
|
2061
|
+
log
|
|
2062
|
+
});
|
|
2045
2063
|
});
|
|
2046
2064
|
return {
|
|
2047
2065
|
status: 200,
|
|
@@ -2052,16 +2070,19 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2052
2070
|
};
|
|
2053
2071
|
}
|
|
2054
2072
|
if (body.method === "iterate") {
|
|
2055
|
-
const result = await
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2073
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
2074
|
+
return operation.iterate({
|
|
2075
|
+
workplaceId: context.workplaceId,
|
|
2076
|
+
appInstallationId: context.appInstallationId,
|
|
2077
|
+
appId: context.appId,
|
|
2078
|
+
input: body.input,
|
|
2079
|
+
state: body.state,
|
|
2080
|
+
page: body.page,
|
|
2081
|
+
cursor: body.cursor,
|
|
2082
|
+
limit: body.limit,
|
|
2083
|
+
env,
|
|
2084
|
+
log
|
|
2085
|
+
});
|
|
2065
2086
|
});
|
|
2066
2087
|
return {
|
|
2067
2088
|
status: 200,
|
package/dist/esm/index.mjs
CHANGED
|
@@ -5490,6 +5490,17 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
5490
5490
|
}
|
|
5491
5491
|
};
|
|
5492
5492
|
}
|
|
5493
|
+
const context = body.context;
|
|
5494
|
+
if (!context?.workplaceId || !context?.appInstallationId || !context?.appId) {
|
|
5495
|
+
return {
|
|
5496
|
+
status: 400,
|
|
5497
|
+
body: {
|
|
5498
|
+
success: false,
|
|
5499
|
+
error: "Missing context (workplaceId, appInstallationId, and appId required)"
|
|
5500
|
+
}
|
|
5501
|
+
};
|
|
5502
|
+
}
|
|
5503
|
+
const env = body.env ?? {};
|
|
5493
5504
|
const log = {
|
|
5494
5505
|
info: (message, meta) => {
|
|
5495
5506
|
console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
@@ -5501,6 +5512,10 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
5501
5512
|
console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
5502
5513
|
}
|
|
5503
5514
|
};
|
|
5515
|
+
const requestConfig = {
|
|
5516
|
+
baseUrl: env.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? "",
|
|
5517
|
+
apiToken: env.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? ""
|
|
5518
|
+
};
|
|
5504
5519
|
try {
|
|
5505
5520
|
if (body.method === "setup") {
|
|
5506
5521
|
if (!operation.setup) {
|
|
@@ -5512,12 +5527,15 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
5512
5527
|
}
|
|
5513
5528
|
};
|
|
5514
5529
|
}
|
|
5515
|
-
const result = await
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5530
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
5531
|
+
return operation.setup({
|
|
5532
|
+
workplaceId: context.workplaceId,
|
|
5533
|
+
appInstallationId: context.appInstallationId,
|
|
5534
|
+
appId: context.appId,
|
|
5535
|
+
input: body.input,
|
|
5536
|
+
env,
|
|
5537
|
+
log
|
|
5538
|
+
});
|
|
5521
5539
|
});
|
|
5522
5540
|
return {
|
|
5523
5541
|
status: 200,
|
|
@@ -5528,16 +5546,19 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
5528
5546
|
};
|
|
5529
5547
|
}
|
|
5530
5548
|
if (body.method === "iterate") {
|
|
5531
|
-
const result = await
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5549
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
5550
|
+
return operation.iterate({
|
|
5551
|
+
workplaceId: context.workplaceId,
|
|
5552
|
+
appInstallationId: context.appInstallationId,
|
|
5553
|
+
appId: context.appId,
|
|
5554
|
+
input: body.input,
|
|
5555
|
+
state: body.state,
|
|
5556
|
+
page: body.page,
|
|
5557
|
+
cursor: body.cursor,
|
|
5558
|
+
limit: body.limit,
|
|
5559
|
+
env,
|
|
5560
|
+
log
|
|
5561
|
+
});
|
|
5541
5562
|
});
|
|
5542
5563
|
return {
|
|
5543
5564
|
status: 200,
|
package/dist/index.js
CHANGED
|
@@ -5869,6 +5869,17 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
5869
5869
|
}
|
|
5870
5870
|
};
|
|
5871
5871
|
}
|
|
5872
|
+
const context = body.context;
|
|
5873
|
+
if (!context?.workplaceId || !context?.appInstallationId || !context?.appId) {
|
|
5874
|
+
return {
|
|
5875
|
+
status: 400,
|
|
5876
|
+
body: {
|
|
5877
|
+
success: false,
|
|
5878
|
+
error: "Missing context (workplaceId, appInstallationId, and appId required)"
|
|
5879
|
+
}
|
|
5880
|
+
};
|
|
5881
|
+
}
|
|
5882
|
+
const env = body.env ?? {};
|
|
5872
5883
|
const log = {
|
|
5873
5884
|
info: (message, meta) => {
|
|
5874
5885
|
console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
@@ -5880,6 +5891,10 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
5880
5891
|
console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
5881
5892
|
}
|
|
5882
5893
|
};
|
|
5894
|
+
const requestConfig = {
|
|
5895
|
+
baseUrl: env.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? "",
|
|
5896
|
+
apiToken: env.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? ""
|
|
5897
|
+
};
|
|
5883
5898
|
try {
|
|
5884
5899
|
if (body.method === "setup") {
|
|
5885
5900
|
if (!operation.setup) {
|
|
@@ -5891,12 +5906,15 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
5891
5906
|
}
|
|
5892
5907
|
};
|
|
5893
5908
|
}
|
|
5894
|
-
const result = await
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5909
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
5910
|
+
return operation.setup({
|
|
5911
|
+
workplaceId: context.workplaceId,
|
|
5912
|
+
appInstallationId: context.appInstallationId,
|
|
5913
|
+
appId: context.appId,
|
|
5914
|
+
input: body.input,
|
|
5915
|
+
env,
|
|
5916
|
+
log
|
|
5917
|
+
});
|
|
5900
5918
|
});
|
|
5901
5919
|
return {
|
|
5902
5920
|
status: 200,
|
|
@@ -5907,16 +5925,19 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
5907
5925
|
};
|
|
5908
5926
|
}
|
|
5909
5927
|
if (body.method === "iterate") {
|
|
5910
|
-
const result = await
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5928
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
5929
|
+
return operation.iterate({
|
|
5930
|
+
workplaceId: context.workplaceId,
|
|
5931
|
+
appInstallationId: context.appInstallationId,
|
|
5932
|
+
appId: context.appId,
|
|
5933
|
+
input: body.input,
|
|
5934
|
+
state: body.state,
|
|
5935
|
+
page: body.page,
|
|
5936
|
+
cursor: body.cursor,
|
|
5937
|
+
limit: body.limit,
|
|
5938
|
+
env,
|
|
5939
|
+
log
|
|
5940
|
+
});
|
|
5920
5941
|
});
|
|
5921
5942
|
return {
|
|
5922
5943
|
status: 200,
|
|
@@ -62,6 +62,9 @@ export declare function handleMcpRoute(req: UnifiedRequest, ctx: RouteContext):
|
|
|
62
62
|
export declare function handleMcpBatchRoute(req: UnifiedRequest, ctx: RouteContext): Promise<UnifiedResponse>;
|
|
63
63
|
/**
|
|
64
64
|
* Handle /batch-operation route for invoking batch operation setup/iterate.
|
|
65
|
+
*
|
|
66
|
+
* Mirrors tool/install handlers: platform passes env + context in the body;
|
|
67
|
+
* we wrap handlers in runWithConfig so SDK clients (instance.*, etc.) work.
|
|
65
68
|
*/
|
|
66
69
|
export declare function handleBatchOperationRoute(req: UnifiedRequest, ctx: RouteContext): Promise<UnifiedResponse>;
|
|
67
70
|
/**
|
package/dist/server.js
CHANGED
|
@@ -2014,6 +2014,17 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2014
2014
|
}
|
|
2015
2015
|
};
|
|
2016
2016
|
}
|
|
2017
|
+
const context = body.context;
|
|
2018
|
+
if (!context?.workplaceId || !context?.appInstallationId || !context?.appId) {
|
|
2019
|
+
return {
|
|
2020
|
+
status: 400,
|
|
2021
|
+
body: {
|
|
2022
|
+
success: false,
|
|
2023
|
+
error: "Missing context (workplaceId, appInstallationId, and appId required)"
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
const env = body.env ?? {};
|
|
2017
2028
|
const log = {
|
|
2018
2029
|
info: (message, meta) => {
|
|
2019
2030
|
console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
@@ -2025,6 +2036,10 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2025
2036
|
console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
2026
2037
|
}
|
|
2027
2038
|
};
|
|
2039
|
+
const requestConfig = {
|
|
2040
|
+
baseUrl: env.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? "",
|
|
2041
|
+
apiToken: env.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? ""
|
|
2042
|
+
};
|
|
2028
2043
|
try {
|
|
2029
2044
|
if (body.method === "setup") {
|
|
2030
2045
|
if (!operation.setup) {
|
|
@@ -2036,12 +2051,15 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2036
2051
|
}
|
|
2037
2052
|
};
|
|
2038
2053
|
}
|
|
2039
|
-
const result = await
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2054
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
2055
|
+
return operation.setup({
|
|
2056
|
+
workplaceId: context.workplaceId,
|
|
2057
|
+
appInstallationId: context.appInstallationId,
|
|
2058
|
+
appId: context.appId,
|
|
2059
|
+
input: body.input,
|
|
2060
|
+
env,
|
|
2061
|
+
log
|
|
2062
|
+
});
|
|
2045
2063
|
});
|
|
2046
2064
|
return {
|
|
2047
2065
|
status: 200,
|
|
@@ -2052,16 +2070,19 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2052
2070
|
};
|
|
2053
2071
|
}
|
|
2054
2072
|
if (body.method === "iterate") {
|
|
2055
|
-
const result = await
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2073
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
2074
|
+
return operation.iterate({
|
|
2075
|
+
workplaceId: context.workplaceId,
|
|
2076
|
+
appInstallationId: context.appInstallationId,
|
|
2077
|
+
appId: context.appId,
|
|
2078
|
+
input: body.input,
|
|
2079
|
+
state: body.state,
|
|
2080
|
+
page: body.page,
|
|
2081
|
+
cursor: body.cursor,
|
|
2082
|
+
limit: body.limit,
|
|
2083
|
+
env,
|
|
2084
|
+
log
|
|
2085
|
+
});
|
|
2065
2086
|
});
|
|
2066
2087
|
return {
|
|
2067
2088
|
status: 200,
|
|
@@ -1975,6 +1975,17 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
};
|
|
1977
1977
|
}
|
|
1978
|
+
const context = body.context;
|
|
1979
|
+
if (!context?.workplaceId || !context?.appInstallationId || !context?.appId) {
|
|
1980
|
+
return {
|
|
1981
|
+
status: 400,
|
|
1982
|
+
body: {
|
|
1983
|
+
success: false,
|
|
1984
|
+
error: "Missing context (workplaceId, appInstallationId, and appId required)"
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1988
|
+
const env = body.env ?? {};
|
|
1978
1989
|
const log = {
|
|
1979
1990
|
info: (message, meta) => {
|
|
1980
1991
|
console.log(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
@@ -1986,6 +1997,10 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
1986
1997
|
console.error(`[batch:${body.handle}] ${message}`, meta ?? "");
|
|
1987
1998
|
}
|
|
1988
1999
|
};
|
|
2000
|
+
const requestConfig = {
|
|
2001
|
+
baseUrl: env.SKEDYUL_API_URL ?? process.env.SKEDYUL_API_URL ?? "",
|
|
2002
|
+
apiToken: env.SKEDYUL_API_TOKEN ?? process.env.SKEDYUL_API_TOKEN ?? ""
|
|
2003
|
+
};
|
|
1989
2004
|
try {
|
|
1990
2005
|
if (body.method === "setup") {
|
|
1991
2006
|
if (!operation.setup) {
|
|
@@ -1997,12 +2012,15 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
1997
2012
|
}
|
|
1998
2013
|
};
|
|
1999
2014
|
}
|
|
2000
|
-
const result = await
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2015
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
2016
|
+
return operation.setup({
|
|
2017
|
+
workplaceId: context.workplaceId,
|
|
2018
|
+
appInstallationId: context.appInstallationId,
|
|
2019
|
+
appId: context.appId,
|
|
2020
|
+
input: body.input,
|
|
2021
|
+
env,
|
|
2022
|
+
log
|
|
2023
|
+
});
|
|
2006
2024
|
});
|
|
2007
2025
|
return {
|
|
2008
2026
|
status: 200,
|
|
@@ -2013,16 +2031,19 @@ async function handleBatchOperationRoute(req, ctx) {
|
|
|
2013
2031
|
};
|
|
2014
2032
|
}
|
|
2015
2033
|
if (body.method === "iterate") {
|
|
2016
|
-
const result = await
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2034
|
+
const result = await runWithConfig(requestConfig, async () => {
|
|
2035
|
+
return operation.iterate({
|
|
2036
|
+
workplaceId: context.workplaceId,
|
|
2037
|
+
appInstallationId: context.appInstallationId,
|
|
2038
|
+
appId: context.appId,
|
|
2039
|
+
input: body.input,
|
|
2040
|
+
state: body.state,
|
|
2041
|
+
page: body.page,
|
|
2042
|
+
cursor: body.cursor,
|
|
2043
|
+
limit: body.limit,
|
|
2044
|
+
env,
|
|
2045
|
+
log
|
|
2046
|
+
});
|
|
2026
2047
|
});
|
|
2027
2048
|
return {
|
|
2028
2049
|
status: 200,
|