@howone/sdk 0.1.25 → 0.1.26
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/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1223,12 +1223,32 @@ function createClient(opts) {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
} catch (_e) {
|
|
1225
1225
|
}
|
|
1226
|
+
const workflowRequestWrapped = ai ? {
|
|
1227
|
+
get: ai.get.bind(ai),
|
|
1228
|
+
post: (config) => {
|
|
1229
|
+
const modifiedConfig = { ...config };
|
|
1230
|
+
if (opts?.projectId && modifiedConfig.url) {
|
|
1231
|
+
const workflowPattern = /^\/?(?:workflow\/)?([^\/]+)\/execute/;
|
|
1232
|
+
const match = modifiedConfig.url.match(workflowPattern);
|
|
1233
|
+
if (match) {
|
|
1234
|
+
const workflowId = match[1];
|
|
1235
|
+
modifiedConfig.url = `/workflow/${opts.projectId}/${workflowId}/execute`;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return ai.post(modifiedConfig);
|
|
1239
|
+
},
|
|
1240
|
+
put: ai.put.bind(ai),
|
|
1241
|
+
delete: ai.delete.bind(ai),
|
|
1242
|
+
request: ai.request.bind(ai),
|
|
1243
|
+
cancelRequest: ai.cancelRequest?.bind(ai),
|
|
1244
|
+
cancelAllRequests: ai.cancelAllRequests?.bind(ai)
|
|
1245
|
+
} : ai;
|
|
1226
1246
|
return {
|
|
1227
1247
|
// expose projectId so consumers can read it from the client instance
|
|
1228
1248
|
projectId: opts?.projectId ?? null,
|
|
1229
1249
|
request: bizWrapped,
|
|
1230
1250
|
aiRequest: ai,
|
|
1231
|
-
workflowRequest:
|
|
1251
|
+
workflowRequest: workflowRequestWrapped,
|
|
1232
1252
|
// artifact helpers using artifacts-client
|
|
1233
1253
|
artifacts: createArtifactsClient(biz),
|
|
1234
1254
|
me: async () => {
|