@meistrari/tela-sdk-js 2.2.1 → 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 +8 -7
- 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 +8 -7
- package/package.json +1 -1
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);
|
|
@@ -1939,11 +1939,11 @@ class CanvasExecution extends Emittery__default {
|
|
|
1939
1939
|
}).then((response) => {
|
|
1940
1940
|
this._id = response.id;
|
|
1941
1941
|
this._rawResultValue = response;
|
|
1942
|
-
return getResultFromPollingResponse(response);
|
|
1943
|
-
}).then((content) => {
|
|
1942
|
+
return { content: getResultFromPollingResponse(response), response };
|
|
1943
|
+
}).then(({ content, response }) => {
|
|
1944
1944
|
const validatedContent = this._skipResultValidation || !(this._outputSchema instanceof z__default.ZodType) ? content : this._outputSchema.parse(content);
|
|
1945
1945
|
this.status = "succeeded";
|
|
1946
|
-
this.emit("success", validatedContent);
|
|
1946
|
+
this.emit("success", { ...validatedContent, headers: response?.headers ?? {} });
|
|
1947
1947
|
return validatedContent;
|
|
1948
1948
|
}).catch((error) => {
|
|
1949
1949
|
this.status = "failed";
|
|
@@ -1980,7 +1980,8 @@ class CanvasExecution extends Emittery__default {
|
|
|
1980
1980
|
id: response.id,
|
|
1981
1981
|
status: response.status,
|
|
1982
1982
|
outputContent: response.output_content,
|
|
1983
|
-
rawOutput: response.raw_output
|
|
1983
|
+
rawOutput: response.raw_output,
|
|
1984
|
+
headers: response.headers
|
|
1984
1985
|
});
|
|
1985
1986
|
return response;
|
|
1986
1987
|
});
|
|
@@ -2045,7 +2046,7 @@ class CanvasExecution extends Emittery__default {
|
|
|
2045
2046
|
};
|
|
2046
2047
|
}
|
|
2047
2048
|
this._rawResultValue = response;
|
|
2048
|
-
this.emit("success", getResultFromPollingResponse(response));
|
|
2049
|
+
this.emit("success", { ...getResultFromPollingResponse(response), headers: response?.headers ?? {} });
|
|
2049
2050
|
return {
|
|
2050
2051
|
done: response.status === "succeeded",
|
|
2051
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);
|
|
@@ -1919,11 +1919,11 @@ class CanvasExecution extends Emittery {
|
|
|
1919
1919
|
}).then((response) => {
|
|
1920
1920
|
this._id = response.id;
|
|
1921
1921
|
this._rawResultValue = response;
|
|
1922
|
-
return getResultFromPollingResponse(response);
|
|
1923
|
-
}).then((content) => {
|
|
1922
|
+
return { content: getResultFromPollingResponse(response), response };
|
|
1923
|
+
}).then(({ content, response }) => {
|
|
1924
1924
|
const validatedContent = this._skipResultValidation || !(this._outputSchema instanceof z__default.ZodType) ? content : this._outputSchema.parse(content);
|
|
1925
1925
|
this.status = "succeeded";
|
|
1926
|
-
this.emit("success", validatedContent);
|
|
1926
|
+
this.emit("success", { ...validatedContent, headers: response?.headers ?? {} });
|
|
1927
1927
|
return validatedContent;
|
|
1928
1928
|
}).catch((error) => {
|
|
1929
1929
|
this.status = "failed";
|
|
@@ -1960,7 +1960,8 @@ class CanvasExecution extends Emittery {
|
|
|
1960
1960
|
id: response.id,
|
|
1961
1961
|
status: response.status,
|
|
1962
1962
|
outputContent: response.output_content,
|
|
1963
|
-
rawOutput: response.raw_output
|
|
1963
|
+
rawOutput: response.raw_output,
|
|
1964
|
+
headers: response.headers
|
|
1964
1965
|
});
|
|
1965
1966
|
return response;
|
|
1966
1967
|
});
|
|
@@ -2025,7 +2026,7 @@ class CanvasExecution extends Emittery {
|
|
|
2025
2026
|
};
|
|
2026
2027
|
}
|
|
2027
2028
|
this._rawResultValue = response;
|
|
2028
|
-
this.emit("success", getResultFromPollingResponse(response));
|
|
2029
|
+
this.emit("success", { ...getResultFromPollingResponse(response), headers: response?.headers ?? {} });
|
|
2029
2030
|
return {
|
|
2030
2031
|
done: response.status === "succeeded",
|
|
2031
2032
|
value: getResultFromPollingResponse(response)
|