@odata2ts/http-client-api 0.6.3 → 0.6.4
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/CHANGELOG.md +7 -0
- package/lib/ODataHttpClient.d.ts +13 -2
- package/lib/ODataHttpClient.js.map +1 -1
- package/lib/ODataHttpClientOptions.d.ts +12 -0
- package/lib/ODataHttpClientOptions.js +3 -0
- package/lib/ODataHttpClientOptions.js.map +1 -0
- package/lib/ODataHttpDataTypes.d.ts +5 -0
- package/lib/ODataHttpDataTypes.js +10 -0
- package/lib/ODataHttpDataTypes.js.map +1 -0
- package/lib/ODataHttpMethods.d.ts +8 -0
- package/lib/ODataHttpMethods.js +18 -0
- package/lib/ODataHttpMethods.js.map +1 -0
- package/lib/ODataRequestConfig.d.ts +10 -0
- package/lib/ODataRequestConfig.js +3 -0
- package/lib/ODataRequestConfig.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.6.4](https://github.com/odata2ts/http-client/compare/@odata2ts/http-client-api-v0.6.3...@odata2ts/http-client-api-v0.6.4) (2026-06-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* create blob request ([#28](https://github.com/odata2ts/http-client/issues/28)) ([4cc238d](https://github.com/odata2ts/http-client/commit/4cc238d3fbe07c09d56732b4b12d0b1b875a3ef5))
|
|
12
|
+
|
|
6
13
|
## [0.6.3](https://github.com/odata2ts/http-client/compare/@odata2ts/http-client-api@0.6.2...@odata2ts/http-client-api-v0.6.3) (2025-03-26)
|
|
7
14
|
|
|
8
15
|
|
package/lib/ODataHttpClient.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { ODataRequestConfig } from "./ODataRequestConfig";
|
|
1
2
|
import { ODataResponse } from "./ODataResponseModel";
|
|
2
3
|
/**
|
|
3
4
|
* Retrieves the configuration type for the given HTTP client.
|
|
4
5
|
*/
|
|
5
|
-
export type ODataHttpClientConfig<ClientType extends ODataHttpClient
|
|
6
|
-
export interface ODataHttpClient<RequestConfig =
|
|
6
|
+
export type ODataHttpClientConfig<ClientType extends ODataHttpClient<any>> = ClientType extends ODataHttpClient<infer Config> ? Config : never;
|
|
7
|
+
export interface ODataHttpClient<RequestConfig extends ODataRequestConfig = ODataRequestConfig> {
|
|
7
8
|
/**
|
|
8
9
|
* Create a model or collection entry.
|
|
9
10
|
*
|
|
@@ -59,6 +60,16 @@ export interface ODataHttpClient<RequestConfig = any> {
|
|
|
59
60
|
* @param additionalHeaders
|
|
60
61
|
*/
|
|
61
62
|
getStream(url: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ReadableStream>;
|
|
63
|
+
/**
|
|
64
|
+
* Creates binary data (Edm.Stream).
|
|
65
|
+
*
|
|
66
|
+
* @param url
|
|
67
|
+
* @param data
|
|
68
|
+
* @param mimeType
|
|
69
|
+
* @param requestConfig
|
|
70
|
+
* @param additionalHeaders
|
|
71
|
+
*/
|
|
72
|
+
createBlob(url: string, data: Blob, mimeType: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<void | Blob>;
|
|
62
73
|
/**
|
|
63
74
|
* Updates binary data (Edm.Stream).
|
|
64
75
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ODataHttpClient.js","sourceRoot":"","sources":["../src/ODataHttpClient.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataResponse } from \"./ODataResponseModel\";\n\n/**\n * Retrieves the configuration type for the given HTTP client.\n */\nexport type ODataHttpClientConfig<ClientType extends ODataHttpClient
|
|
1
|
+
{"version":3,"file":"ODataHttpClient.js","sourceRoot":"","sources":["../src/ODataHttpClient.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataRequestConfig } from \"./ODataRequestConfig\";\nimport { ODataResponse } from \"./ODataResponseModel\";\n\n/**\n * Retrieves the configuration type for the given HTTP client.\n */\nexport type ODataHttpClientConfig<ClientType extends ODataHttpClient<any>> =\n ClientType extends ODataHttpClient<infer Config> ? Config : never;\n\nexport interface ODataHttpClient<RequestConfig extends ODataRequestConfig = ODataRequestConfig> {\n /**\n * Create a model or collection entry.\n *\n * @param url\n * @param data\n * @param requestConfig\n * @param additionalHeaders\n */\n post<ResponseModel>(\n url: string,\n data: any,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>,\n ): ODataResponse<ResponseModel>;\n\n get<ResponseModel>(\n url: string,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>,\n ): ODataResponse<ResponseModel>;\n\n /**\n * Replace a model.\n *\n * @param url\n * @param data\n * @param requestConfig\n * @param additionalHeaders\n */\n put<ResponseModel>(\n url: string,\n data: any,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>,\n ): ODataResponse<ResponseModel>;\n\n /**\n * Partially update a model.\n *\n * @param url\n * @param data\n * @param requestConfig\n * @param additionalHeaders\n */\n patch<ResponseModel>(\n url: string,\n data: any,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>,\n ): ODataResponse<ResponseModel>;\n\n /**\n * Delete a model or collection.\n *\n * @param url\n * @param requestConfig\n * @param additionalHeaders\n */\n delete(url: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<void>;\n\n /**\n * Get binary data (Edm.Stream) as Blob.\n *\n * @param url\n * @param requestConfig\n * @param additionalHeaders\n */\n getBlob(url: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<Blob>;\n\n /**\n * Get binary data (Edm.Stream) as ReadableStream.\n *\n * Cannot be supported by HTTP clients based on XmlHttpRequest, e.g. axios.\n * Should throw an error in this case.\n *\n * @param url\n * @param requestConfig\n * @param additionalHeaders\n */\n getStream(\n url: string,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>,\n ): ODataResponse<ReadableStream>;\n\n /**\n * Creates binary data (Edm.Stream).\n *\n * @param url\n * @param data\n * @param mimeType\n * @param requestConfig\n * @param additionalHeaders\n */\n createBlob(\n url: string,\n data: Blob,\n mimeType: string,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>,\n ): ODataResponse<void | Blob>;\n\n /**\n * Updates binary data (Edm.Stream).\n *\n * @param url\n * @param data\n * @param mimeType\n * @param requestConfig\n * @param additionalHeaders\n */\n updateBlob(\n url: string,\n data: Blob,\n mimeType: string,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>,\n ): ODataResponse<void | Blob>;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ODataHttpClientOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Enable automatic CSRF token handling.
|
|
4
|
+
*/
|
|
5
|
+
useCsrfProtection?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Specify the URL from which the token is fetched.
|
|
8
|
+
* This could be any path to your OData service, since the token is exchanged via HTTP request headers.
|
|
9
|
+
* However, it should be a fast response and usually the root URL to the OData service is a good choice.
|
|
10
|
+
*/
|
|
11
|
+
csrfTokenFetchUrl?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ODataHttpClientOptions.js","sourceRoot":"","sources":["../src/ODataHttpClientOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface ODataHttpClientOptions {\n /**\n * Enable automatic CSRF token handling.\n */\n useCsrfProtection?: boolean;\n /**\n * Specify the URL from which the token is fetched.\n * This could be any path to your OData service, since the token is exchanged via HTTP request headers.\n * However, it should be a fast response and usually the root URL to the OData service is a good choice.\n */\n csrfTokenFetchUrl?: string;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ODataHttpDataTypes = void 0;
|
|
4
|
+
var ODataHttpDataTypes;
|
|
5
|
+
(function (ODataHttpDataTypes) {
|
|
6
|
+
ODataHttpDataTypes["JSON"] = "json";
|
|
7
|
+
ODataHttpDataTypes["BLOB"] = "blob";
|
|
8
|
+
ODataHttpDataTypes["STREAM"] = "stream";
|
|
9
|
+
})(ODataHttpDataTypes = exports.ODataHttpDataTypes || (exports.ODataHttpDataTypes = {}));
|
|
10
|
+
//# sourceMappingURL=ODataHttpDataTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ODataHttpDataTypes.js","sourceRoot":"","sources":["../src/ODataHttpDataTypes.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,mCAAa,CAAA;IACb,uCAAiB,CAAA;AACnB,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B","sourcesContent":["export enum ODataHttpDataTypes {\n JSON = \"json\",\n BLOB = \"blob\",\n STREAM = \"stream\",\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DATA_MANIPULATION_METHODS = exports.ODataHttpMethods = void 0;
|
|
4
|
+
var ODataHttpMethods;
|
|
5
|
+
(function (ODataHttpMethods) {
|
|
6
|
+
ODataHttpMethods["Get"] = "GET";
|
|
7
|
+
ODataHttpMethods["Post"] = "POST";
|
|
8
|
+
ODataHttpMethods["Put"] = "PUT";
|
|
9
|
+
ODataHttpMethods["Patch"] = "PATCH";
|
|
10
|
+
ODataHttpMethods["Delete"] = "DELETE";
|
|
11
|
+
})(ODataHttpMethods = exports.ODataHttpMethods || (exports.ODataHttpMethods = {}));
|
|
12
|
+
exports.DATA_MANIPULATION_METHODS = [
|
|
13
|
+
ODataHttpMethods.Post,
|
|
14
|
+
ODataHttpMethods.Put,
|
|
15
|
+
ODataHttpMethods.Patch,
|
|
16
|
+
ODataHttpMethods.Delete,
|
|
17
|
+
];
|
|
18
|
+
//# sourceMappingURL=ODataHttpMethods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ODataHttpMethods.js","sourceRoot":"","sources":["../src/ODataHttpMethods.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,iCAAa,CAAA;IACb,+BAAW,CAAA;IACX,mCAAe,CAAA;IACf,qCAAiB,CAAA;AACnB,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B;AAEY,QAAA,yBAAyB,GAAG;IACvC,gBAAgB,CAAC,IAAI;IACrB,gBAAgB,CAAC,GAAG;IACpB,gBAAgB,CAAC,KAAK;IACtB,gBAAgB,CAAC,MAAM;CACxB,CAAC","sourcesContent":["export enum ODataHttpMethods {\n Get = \"GET\",\n Post = \"POST\",\n Put = \"PUT\",\n Patch = \"PATCH\",\n Delete = \"DELETE\",\n}\n\nexport const DATA_MANIPULATION_METHODS = [\n ODataHttpMethods.Post,\n ODataHttpMethods.Put,\n ODataHttpMethods.Patch,\n ODataHttpMethods.Delete,\n];\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ODataRequestConfig {
|
|
2
|
+
/**
|
|
3
|
+
* The request headers as plain key value pair.
|
|
4
|
+
*/
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Additional URL query params.
|
|
8
|
+
*/
|
|
9
|
+
params?: Record<string, string | number | boolean | Array<string | number | boolean>>;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ODataRequestConfig.js","sourceRoot":"","sources":["../src/ODataRequestConfig.ts"],"names":[],"mappings":"","sourcesContent":["export interface ODataRequestConfig {\n /**\n * The request headers as plain key value pair.\n */\n headers?: Record<string, string>;\n /**\n * Additional URL query params.\n */\n params?: Record<string, string | number | boolean | Array<string | number | boolean>>;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,5 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./ODataResponseModel"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./ODataHttpClient"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./ODataHttpClientOptions"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./ODataHttpMethods"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./ODataRequestConfig"), exports);
|
|
6
9
|
tslib_1.__exportStar(require("./ODataClientError"), exports);
|
|
7
10
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,4DAAkC;AAClC,6DAAmC","sourcesContent":["export * from \"./ODataResponseModel\";\nexport * from \"./ODataHttpClient\";\nexport * from \"./ODataClientError\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,4DAAkC;AAClC,mEAAyC;AACzC,6DAAmC;AACnC,+DAAqC;AACrC,6DAAmC","sourcesContent":["export * from \"./ODataResponseModel\";\nexport * from \"./ODataHttpClient\";\nexport * from \"./ODataHttpClientOptions\";\nexport * from \"./ODataHttpMethods\";\nexport * from \"./ODataRequestConfig\";\nexport * from \"./ODataClientError\";\n"]}
|