@cellaware/utils 4.1.5 → 4.2.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.
@@ -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, text: string): Promise<any>;
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;
@@ -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, text) {
81
+ export async function functionFetchText(url, method, key, principal, body) {
82
82
  const headers = {
83
- 'Content-Type': 'application/text',
84
- 'Accept': 'application/json',
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 chatwmsFunctionQuery(path: string, method: string, principal: string, query: string): Promise<any>;
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;
@@ -3,9 +3,9 @@ export function chatwmsFunctionFetch(path, method, principal, body) {
3
3
  const url = `${process.env['CHATWMS_URL']}/${path}`;
4
4
  return functionFetchJson(url, method, process.env['CHATWMS_KEY'] ?? '', principal, body);
5
5
  }
6
- export function chatwmsFunctionQuery(path, method, principal, query) {
6
+ export function chatwmsFunctionFetchText(path, method, principal, body) {
7
7
  const url = `${process.env['CHATWMS_URL']}/${path}`;
8
- return functionFetchText(url, method, process.env['CHATWMS_KEY'] ?? '', principal, query);
8
+ return functionFetchText(url, method, process.env['CHATWMS_KEY'] ?? '', principal, body);
9
9
  }
10
10
  export function chatwmsFunctionStream(path, method, principal, body) {
11
11
  const url = `${process.env['CHATWMS_URL']}/${path}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "4.1.5",
3
+ "version": "4.2.0",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",