@meistrari/tela-sdk-js 2.2.0 → 2.3.0
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.cjs +10 -8
- package/dist/index.d.cts +9 -3
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.mjs +10 -8
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ const z__default = /*#__PURE__*/_interopDefaultCompat(z);
|
|
|
24
24
|
const z__namespace = /*#__PURE__*/_interopNamespaceCompat(z);
|
|
25
25
|
const Emittery__default = /*#__PURE__*/_interopDefaultCompat(Emittery);
|
|
26
26
|
|
|
27
|
-
const version = "2.
|
|
27
|
+
const version = "2.3.0";
|
|
28
28
|
|
|
29
29
|
var __defProp$7 = Object.defineProperty;
|
|
30
30
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -753,7 +753,7 @@ async function defaultParseResponse(props) {
|
|
|
753
753
|
if (isJSON) {
|
|
754
754
|
const json = await response.json();
|
|
755
755
|
debug("response", response.status, response.url, response.headers, json);
|
|
756
|
-
return transformObjectFromSnakeCaseToCamelCase(json, DEFAULT_FIELDS_TRANSFORMATION_EXCLUSIONS);
|
|
756
|
+
return transformObjectFromSnakeCaseToCamelCase({ ...json, headers: response.headers.toJSON() }, DEFAULT_FIELDS_TRANSFORMATION_EXCLUSIONS);
|
|
757
757
|
}
|
|
758
758
|
const text = await response.text();
|
|
759
759
|
debug("response", response.status, response.url, response.headers, text);
|
|
@@ -1883,7 +1883,8 @@ class CanvasExecution extends Emittery__default {
|
|
|
1883
1883
|
versionId: this._params.versionId,
|
|
1884
1884
|
messages: this._params.messages,
|
|
1885
1885
|
tags: this._params.tags,
|
|
1886
|
-
label: this._params.label
|
|
1886
|
+
label: this._params.label,
|
|
1887
|
+
webhook_url: this._params.webhookUrl
|
|
1887
1888
|
};
|
|
1888
1889
|
if (this._params.override && this._outputSchema instanceof z__default.ZodType) {
|
|
1889
1890
|
return {
|
|
@@ -1938,11 +1939,11 @@ class CanvasExecution extends Emittery__default {
|
|
|
1938
1939
|
}).then((response) => {
|
|
1939
1940
|
this._id = response.id;
|
|
1940
1941
|
this._rawResultValue = response;
|
|
1941
|
-
return getResultFromPollingResponse(response);
|
|
1942
|
-
}).then((content) => {
|
|
1942
|
+
return { content: getResultFromPollingResponse(response), response };
|
|
1943
|
+
}).then(({ content, response }) => {
|
|
1943
1944
|
const validatedContent = this._skipResultValidation || !(this._outputSchema instanceof z__default.ZodType) ? content : this._outputSchema.parse(content);
|
|
1944
1945
|
this.status = "succeeded";
|
|
1945
|
-
this.emit("success", validatedContent);
|
|
1946
|
+
this.emit("success", { ...validatedContent, headers: response?.headers ?? {} });
|
|
1946
1947
|
return validatedContent;
|
|
1947
1948
|
}).catch((error) => {
|
|
1948
1949
|
this.status = "failed";
|
|
@@ -1979,7 +1980,8 @@ class CanvasExecution extends Emittery__default {
|
|
|
1979
1980
|
id: response.id,
|
|
1980
1981
|
status: response.status,
|
|
1981
1982
|
outputContent: response.output_content,
|
|
1982
|
-
rawOutput: response.raw_output
|
|
1983
|
+
rawOutput: response.raw_output,
|
|
1984
|
+
headers: response.headers
|
|
1983
1985
|
});
|
|
1984
1986
|
return response;
|
|
1985
1987
|
});
|
|
@@ -2044,7 +2046,7 @@ class CanvasExecution extends Emittery__default {
|
|
|
2044
2046
|
};
|
|
2045
2047
|
}
|
|
2046
2048
|
this._rawResultValue = response;
|
|
2047
|
-
this.emit("success", getResultFromPollingResponse(response));
|
|
2049
|
+
this.emit("success", { ...getResultFromPollingResponse(response), headers: response?.headers ?? {} });
|
|
2048
2050
|
return {
|
|
2049
2051
|
done: response.status === "succeeded",
|
|
2050
2052
|
value: getResultFromPollingResponse(response)
|
package/dist/index.d.cts
CHANGED
|
@@ -663,8 +663,12 @@ type ExecutionParams = AsyncExecutionParams | StreamExecutionParams | SyncExecut
|
|
|
663
663
|
*/
|
|
664
664
|
type CanvasExecutionResult<TParams, TOutput = unknown> = TParams extends StreamExecutionParams ? AsyncGenerator<Partial<TOutput>> : Promise<TOutput>;
|
|
665
665
|
type CanvasExecutionEvents<TOutput> = {
|
|
666
|
-
poll: AsyncCompletionPollingResult<TOutput
|
|
667
|
-
|
|
666
|
+
poll: AsyncCompletionPollingResult<TOutput> & {
|
|
667
|
+
headers: Record<string, string>;
|
|
668
|
+
};
|
|
669
|
+
success: TOutput & {
|
|
670
|
+
headers: Record<string, string>;
|
|
671
|
+
};
|
|
668
672
|
error: ExecutionFailedError;
|
|
669
673
|
statusChange: ExecutionStatus;
|
|
670
674
|
};
|
|
@@ -867,7 +871,9 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
867
871
|
*
|
|
868
872
|
* @returns A promise or async generator depending on execution mode.
|
|
869
873
|
*/
|
|
870
|
-
start(): Promise<CanvasExecutionResult<TParams, TOutput>> | AsyncGenerator<Partial<TOutput>, any, any> | Promise<AsyncGenerator<Partial<TOutput>, any, any>> | Promise<AsyncCompletionCreateResult
|
|
874
|
+
start(): Promise<CanvasExecutionResult<TParams, TOutput>> | AsyncGenerator<Partial<TOutput>, any, any> | Promise<AsyncGenerator<Partial<TOutput>, any, any>> | Promise<AsyncCompletionCreateResult & {
|
|
875
|
+
headers: Record<string, string>;
|
|
876
|
+
}>;
|
|
871
877
|
/**
|
|
872
878
|
* Gets the execution result. For async executions, automatically starts polling.
|
|
873
879
|
* For sync executions, returns the result promise. For streams, returns the generator.
|
package/dist/index.d.mts
CHANGED
|
@@ -663,8 +663,12 @@ type ExecutionParams = AsyncExecutionParams | StreamExecutionParams | SyncExecut
|
|
|
663
663
|
*/
|
|
664
664
|
type CanvasExecutionResult<TParams, TOutput = unknown> = TParams extends StreamExecutionParams ? AsyncGenerator<Partial<TOutput>> : Promise<TOutput>;
|
|
665
665
|
type CanvasExecutionEvents<TOutput> = {
|
|
666
|
-
poll: AsyncCompletionPollingResult<TOutput
|
|
667
|
-
|
|
666
|
+
poll: AsyncCompletionPollingResult<TOutput> & {
|
|
667
|
+
headers: Record<string, string>;
|
|
668
|
+
};
|
|
669
|
+
success: TOutput & {
|
|
670
|
+
headers: Record<string, string>;
|
|
671
|
+
};
|
|
668
672
|
error: ExecutionFailedError;
|
|
669
673
|
statusChange: ExecutionStatus;
|
|
670
674
|
};
|
|
@@ -867,7 +871,9 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
867
871
|
*
|
|
868
872
|
* @returns A promise or async generator depending on execution mode.
|
|
869
873
|
*/
|
|
870
|
-
start(): Promise<CanvasExecutionResult<TParams, TOutput>> | AsyncGenerator<Partial<TOutput>, any, any> | Promise<AsyncGenerator<Partial<TOutput>, any, any>> | Promise<AsyncCompletionCreateResult
|
|
874
|
+
start(): Promise<CanvasExecutionResult<TParams, TOutput>> | AsyncGenerator<Partial<TOutput>, any, any> | Promise<AsyncGenerator<Partial<TOutput>, any, any>> | Promise<AsyncCompletionCreateResult & {
|
|
875
|
+
headers: Record<string, string>;
|
|
876
|
+
}>;
|
|
871
877
|
/**
|
|
872
878
|
* Gets the execution result. For async executions, automatically starts polling.
|
|
873
879
|
* For sync executions, returns the result promise. For streams, returns the generator.
|
package/dist/index.d.ts
CHANGED
|
@@ -663,8 +663,12 @@ type ExecutionParams = AsyncExecutionParams | StreamExecutionParams | SyncExecut
|
|
|
663
663
|
*/
|
|
664
664
|
type CanvasExecutionResult<TParams, TOutput = unknown> = TParams extends StreamExecutionParams ? AsyncGenerator<Partial<TOutput>> : Promise<TOutput>;
|
|
665
665
|
type CanvasExecutionEvents<TOutput> = {
|
|
666
|
-
poll: AsyncCompletionPollingResult<TOutput
|
|
667
|
-
|
|
666
|
+
poll: AsyncCompletionPollingResult<TOutput> & {
|
|
667
|
+
headers: Record<string, string>;
|
|
668
|
+
};
|
|
669
|
+
success: TOutput & {
|
|
670
|
+
headers: Record<string, string>;
|
|
671
|
+
};
|
|
668
672
|
error: ExecutionFailedError;
|
|
669
673
|
statusChange: ExecutionStatus;
|
|
670
674
|
};
|
|
@@ -867,7 +871,9 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
867
871
|
*
|
|
868
872
|
* @returns A promise or async generator depending on execution mode.
|
|
869
873
|
*/
|
|
870
|
-
start(): Promise<CanvasExecutionResult<TParams, TOutput>> | AsyncGenerator<Partial<TOutput>, any, any> | Promise<AsyncGenerator<Partial<TOutput>, any, any>> | Promise<AsyncCompletionCreateResult
|
|
874
|
+
start(): Promise<CanvasExecutionResult<TParams, TOutput>> | AsyncGenerator<Partial<TOutput>, any, any> | Promise<AsyncGenerator<Partial<TOutput>, any, any>> | Promise<AsyncCompletionCreateResult & {
|
|
875
|
+
headers: Record<string, string>;
|
|
876
|
+
}>;
|
|
871
877
|
/**
|
|
872
878
|
* Gets the execution result. For async executions, automatically starts polling.
|
|
873
879
|
* For sync executions, returns the result promise. For streams, returns the generator.
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as z from 'zod';
|
|
|
4
4
|
import z__default, { z as z$1, ZodError } from 'zod';
|
|
5
5
|
import Emittery from 'emittery';
|
|
6
6
|
|
|
7
|
-
const version = "2.
|
|
7
|
+
const version = "2.3.0";
|
|
8
8
|
|
|
9
9
|
var __defProp$7 = Object.defineProperty;
|
|
10
10
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -733,7 +733,7 @@ async function defaultParseResponse(props) {
|
|
|
733
733
|
if (isJSON) {
|
|
734
734
|
const json = await response.json();
|
|
735
735
|
debug("response", response.status, response.url, response.headers, json);
|
|
736
|
-
return transformObjectFromSnakeCaseToCamelCase(json, DEFAULT_FIELDS_TRANSFORMATION_EXCLUSIONS);
|
|
736
|
+
return transformObjectFromSnakeCaseToCamelCase({ ...json, headers: response.headers.toJSON() }, DEFAULT_FIELDS_TRANSFORMATION_EXCLUSIONS);
|
|
737
737
|
}
|
|
738
738
|
const text = await response.text();
|
|
739
739
|
debug("response", response.status, response.url, response.headers, text);
|
|
@@ -1863,7 +1863,8 @@ class CanvasExecution extends Emittery {
|
|
|
1863
1863
|
versionId: this._params.versionId,
|
|
1864
1864
|
messages: this._params.messages,
|
|
1865
1865
|
tags: this._params.tags,
|
|
1866
|
-
label: this._params.label
|
|
1866
|
+
label: this._params.label,
|
|
1867
|
+
webhook_url: this._params.webhookUrl
|
|
1867
1868
|
};
|
|
1868
1869
|
if (this._params.override && this._outputSchema instanceof z__default.ZodType) {
|
|
1869
1870
|
return {
|
|
@@ -1918,11 +1919,11 @@ class CanvasExecution extends Emittery {
|
|
|
1918
1919
|
}).then((response) => {
|
|
1919
1920
|
this._id = response.id;
|
|
1920
1921
|
this._rawResultValue = response;
|
|
1921
|
-
return getResultFromPollingResponse(response);
|
|
1922
|
-
}).then((content) => {
|
|
1922
|
+
return { content: getResultFromPollingResponse(response), response };
|
|
1923
|
+
}).then(({ content, response }) => {
|
|
1923
1924
|
const validatedContent = this._skipResultValidation || !(this._outputSchema instanceof z__default.ZodType) ? content : this._outputSchema.parse(content);
|
|
1924
1925
|
this.status = "succeeded";
|
|
1925
|
-
this.emit("success", validatedContent);
|
|
1926
|
+
this.emit("success", { ...validatedContent, headers: response?.headers ?? {} });
|
|
1926
1927
|
return validatedContent;
|
|
1927
1928
|
}).catch((error) => {
|
|
1928
1929
|
this.status = "failed";
|
|
@@ -1959,7 +1960,8 @@ class CanvasExecution extends Emittery {
|
|
|
1959
1960
|
id: response.id,
|
|
1960
1961
|
status: response.status,
|
|
1961
1962
|
outputContent: response.output_content,
|
|
1962
|
-
rawOutput: response.raw_output
|
|
1963
|
+
rawOutput: response.raw_output,
|
|
1964
|
+
headers: response.headers
|
|
1963
1965
|
});
|
|
1964
1966
|
return response;
|
|
1965
1967
|
});
|
|
@@ -2024,7 +2026,7 @@ class CanvasExecution extends Emittery {
|
|
|
2024
2026
|
};
|
|
2025
2027
|
}
|
|
2026
2028
|
this._rawResultValue = response;
|
|
2027
|
-
this.emit("success", getResultFromPollingResponse(response));
|
|
2029
|
+
this.emit("success", { ...getResultFromPollingResponse(response), headers: response?.headers ?? {} });
|
|
2028
2030
|
return {
|
|
2029
2031
|
done: response.status === "succeeded",
|
|
2030
2032
|
value: getResultFromPollingResponse(response)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meistrari/tela-sdk-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/meistrari/tela-sdk-js.git"
|
|
@@ -70,4 +70,4 @@
|
|
|
70
70
|
},
|
|
71
71
|
"type": "module",
|
|
72
72
|
"types": "dist/index.d.ts"
|
|
73
|
-
}
|
|
73
|
+
}
|