@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.d.mts
CHANGED
|
@@ -389,7 +389,15 @@ declare function createClient(opts?: {
|
|
|
389
389
|
cancelAllRequests: () => void;
|
|
390
390
|
};
|
|
391
391
|
aiRequest: Request;
|
|
392
|
-
workflowRequest:
|
|
392
|
+
workflowRequest: {
|
|
393
|
+
get: <T = any>(config: RequestConfig<T>) => Promise<T>;
|
|
394
|
+
post: (config: RequestConfig) => Promise<AxiosResponse<any, any>>;
|
|
395
|
+
put: <T = any>(config: RequestConfig<T>) => Promise<T>;
|
|
396
|
+
delete: <T = any>(config: RequestConfig<T>) => Promise<T>;
|
|
397
|
+
request: <T = any>(config: RequestConfig<T>) => Promise<T>;
|
|
398
|
+
cancelRequest: (url: string) => void;
|
|
399
|
+
cancelAllRequests: () => void;
|
|
400
|
+
};
|
|
393
401
|
artifacts: {
|
|
394
402
|
create(input: ArtifactCreateInput): Promise<Artifact>;
|
|
395
403
|
list(query?: ArtifactListQuery): Promise<Artifact[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -389,7 +389,15 @@ declare function createClient(opts?: {
|
|
|
389
389
|
cancelAllRequests: () => void;
|
|
390
390
|
};
|
|
391
391
|
aiRequest: Request;
|
|
392
|
-
workflowRequest:
|
|
392
|
+
workflowRequest: {
|
|
393
|
+
get: <T = any>(config: RequestConfig<T>) => Promise<T>;
|
|
394
|
+
post: (config: RequestConfig) => Promise<AxiosResponse<any, any>>;
|
|
395
|
+
put: <T = any>(config: RequestConfig<T>) => Promise<T>;
|
|
396
|
+
delete: <T = any>(config: RequestConfig<T>) => Promise<T>;
|
|
397
|
+
request: <T = any>(config: RequestConfig<T>) => Promise<T>;
|
|
398
|
+
cancelRequest: (url: string) => void;
|
|
399
|
+
cancelAllRequests: () => void;
|
|
400
|
+
};
|
|
393
401
|
artifacts: {
|
|
394
402
|
create(input: ArtifactCreateInput): Promise<Artifact>;
|
|
395
403
|
list(query?: ArtifactListQuery): Promise<Artifact[]>;
|
package/dist/index.js
CHANGED
|
@@ -1283,12 +1283,32 @@ function createClient(opts) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
} catch (_e) {
|
|
1285
1285
|
}
|
|
1286
|
+
const workflowRequestWrapped = ai ? {
|
|
1287
|
+
get: ai.get.bind(ai),
|
|
1288
|
+
post: (config) => {
|
|
1289
|
+
const modifiedConfig = { ...config };
|
|
1290
|
+
if (opts?.projectId && modifiedConfig.url) {
|
|
1291
|
+
const workflowPattern = /^\/?(?:workflow\/)?([^\/]+)\/execute/;
|
|
1292
|
+
const match = modifiedConfig.url.match(workflowPattern);
|
|
1293
|
+
if (match) {
|
|
1294
|
+
const workflowId = match[1];
|
|
1295
|
+
modifiedConfig.url = `/workflow/${opts.projectId}/${workflowId}/execute`;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
return ai.post(modifiedConfig);
|
|
1299
|
+
},
|
|
1300
|
+
put: ai.put.bind(ai),
|
|
1301
|
+
delete: ai.delete.bind(ai),
|
|
1302
|
+
request: ai.request.bind(ai),
|
|
1303
|
+
cancelRequest: ai.cancelRequest?.bind(ai),
|
|
1304
|
+
cancelAllRequests: ai.cancelAllRequests?.bind(ai)
|
|
1305
|
+
} : ai;
|
|
1286
1306
|
return {
|
|
1287
1307
|
// expose projectId so consumers can read it from the client instance
|
|
1288
1308
|
projectId: opts?.projectId ?? null,
|
|
1289
1309
|
request: bizWrapped,
|
|
1290
1310
|
aiRequest: ai,
|
|
1291
|
-
workflowRequest:
|
|
1311
|
+
workflowRequest: workflowRequestWrapped,
|
|
1292
1312
|
// artifact helpers using artifacts-client
|
|
1293
1313
|
artifacts: createArtifactsClient(biz),
|
|
1294
1314
|
me: async () => {
|