@cellaware/utils 4.1.5 → 4.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/azure/function.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Readable } from "stream";
|
|
|
2
2
|
export declare const AZURE_HEADER_FUNCTION_KEY = "x-functions-key";
|
|
3
3
|
export declare const AZURE_HEADER_PRINCIPAL = "x-ms-client-principal";
|
|
4
4
|
export declare function functionFetchJson(url: string, method: string, key: string, principal: string, body?: any): Promise<any>;
|
|
5
|
-
export declare function functionFetchText(url: string, method: string, key: string, principal: string,
|
|
5
|
+
export declare function functionFetchText(url: string, method: string, key: string, principal: string, body?: any): Promise<any>;
|
|
6
6
|
export declare function functionStreamJson(url: string, method: string, key: string, principal: string, body: any, errorBody: any): Promise<{
|
|
7
7
|
headers: {
|
|
8
8
|
"Content-Type": string;
|
package/dist/azure/function.js
CHANGED
|
@@ -78,18 +78,20 @@ export async function functionFetchJson(url, method, key, principal, body) {
|
|
|
78
78
|
}
|
|
79
79
|
return functionFetch(url, req);
|
|
80
80
|
}
|
|
81
|
-
export async function functionFetchText(url, method, key, principal,
|
|
81
|
+
export async function functionFetchText(url, method, key, principal, body) {
|
|
82
82
|
const headers = {
|
|
83
|
-
'Content-Type': 'application/
|
|
84
|
-
'Accept': 'application/
|
|
83
|
+
'Content-Type': 'application/json',
|
|
84
|
+
'Accept': 'application/text',
|
|
85
85
|
'x-functions-key': key,
|
|
86
86
|
'x-ms-client-principal': principal
|
|
87
87
|
};
|
|
88
88
|
let req = {
|
|
89
89
|
method,
|
|
90
|
-
headers
|
|
91
|
-
body: text
|
|
90
|
+
headers
|
|
92
91
|
};
|
|
92
|
+
if (body != null) {
|
|
93
|
+
req.body = JSON.stringify(body);
|
|
94
|
+
}
|
|
93
95
|
return functionFetch(url, req);
|
|
94
96
|
}
|
|
95
97
|
export async function functionStreamJson(url, method, key, principal, body, errorBody) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function chatwmsFunctionFetch(path: string, method: string, principal: string, body?: any): Promise<any>;
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function chatwmsFunctionFetchText(path: string, method: string, principal: string, body?: any): Promise<any>;
|
|
3
3
|
export declare function chatwmsFunctionStream(path: string, method: string, principal: string, body?: any): Promise<{
|
|
4
4
|
headers: {
|
|
5
5
|
"Content-Type": string;
|
|
@@ -8,3 +8,13 @@ export declare function chatwmsFunctionStream(path: string, method: string, prin
|
|
|
8
8
|
};
|
|
9
9
|
body: import("stream").Readable;
|
|
10
10
|
}>;
|
|
11
|
+
export declare function chatwmsGatewayFunctionFetch(url: string, method: string, key: string, principal: string, body?: any): Promise<any>;
|
|
12
|
+
export declare function chatwmsGatewayFunctionFetchText(url: string, method: string, key: string, principal: string, body?: any): Promise<any>;
|
|
13
|
+
export declare function chatwmsGatewayFunctionStream(url: string, method: string, key: string, principal: string, body?: any): Promise<{
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": string;
|
|
16
|
+
"Cache-Control": string;
|
|
17
|
+
"Transfer-Encoding": string;
|
|
18
|
+
};
|
|
19
|
+
body: import("stream").Readable;
|
|
20
|
+
}>;
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { functionFetchJson, functionFetchText, functionStreamJson } from "../../azure/function.js";
|
|
2
|
+
const STREAM_ERROR_BODY = {
|
|
3
|
+
answer: 'chatwms-unavailable-error',
|
|
4
|
+
error: 'chatwms-unavailable-error'
|
|
5
|
+
};
|
|
2
6
|
export function chatwmsFunctionFetch(path, method, principal, body) {
|
|
3
7
|
const url = `${process.env['CHATWMS_URL']}/${path}`;
|
|
4
8
|
return functionFetchJson(url, method, process.env['CHATWMS_KEY'] ?? '', principal, body);
|
|
5
9
|
}
|
|
6
|
-
export function
|
|
10
|
+
export function chatwmsFunctionFetchText(path, method, principal, body) {
|
|
7
11
|
const url = `${process.env['CHATWMS_URL']}/${path}`;
|
|
8
|
-
return functionFetchText(url, method, process.env['CHATWMS_KEY'] ?? '', principal,
|
|
12
|
+
return functionFetchText(url, method, process.env['CHATWMS_KEY'] ?? '', principal, body);
|
|
9
13
|
}
|
|
10
14
|
export function chatwmsFunctionStream(path, method, principal, body) {
|
|
11
15
|
const url = `${process.env['CHATWMS_URL']}/${path}`;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
return functionStreamJson(url, method, process.env['CHATWMS_KEY'] ?? '', principal, body, STREAM_ERROR_BODY);
|
|
17
|
+
}
|
|
18
|
+
export function chatwmsGatewayFunctionFetch(url, method, key, principal, body) {
|
|
19
|
+
return functionFetchJson(url, method, key, principal, body);
|
|
20
|
+
}
|
|
21
|
+
export function chatwmsGatewayFunctionFetchText(url, method, key, principal, body) {
|
|
22
|
+
return functionFetchText(url, method, key, principal, body);
|
|
23
|
+
}
|
|
24
|
+
export function chatwmsGatewayFunctionStream(url, method, key, principal, body) {
|
|
25
|
+
return functionStreamJson(url, method, key, principal, body, STREAM_ERROR_BODY);
|
|
17
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|