angular-odata 0.148.0 → 0.150.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/fesm2022/angular-odata.mjs +30 -28
- package/fesm2022/angular-odata.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/apigen/files/api-config/__fileName__.ts +2 -0
- package/schematics/apigen/files/collection/__fileName__.ts +2 -0
- package/schematics/apigen/files/entity/__fileName__.ts +2 -0
- package/schematics/apigen/files/entitycontainer-service/__fileName__.ts +2 -0
- package/schematics/apigen/files/entityset-service/__fileName__.ts +2 -0
- package/schematics/apigen/files/enum/__fileName__.ts +2 -0
- package/schematics/apigen/files/model/__fileName__.ts +3 -1
- package/schematics/apigen/files/module/__fileName__.ts +2 -0
- package/schematics/apigen/files/singleton-service/__fileName__.ts +2 -0
- package/types/angular-odata.d.ts +16 -2
|
@@ -5934,44 +5934,46 @@ class ODataRequest {
|
|
|
5934
5934
|
this.reportProgress = init.reportProgress;
|
|
5935
5935
|
this.observe = init.observe;
|
|
5936
5936
|
this.context = init.context;
|
|
5937
|
+
// Options
|
|
5938
|
+
const apiOptions = this.api.options;
|
|
5939
|
+
const parserOptions = Objects.merge(apiOptions.parserOptions, init.parserOptions ?? {});
|
|
5937
5940
|
// Response Type
|
|
5938
5941
|
this._responseType = init.responseType;
|
|
5939
5942
|
// The Body
|
|
5940
5943
|
this._body = init.body !== undefined ? init.body : null;
|
|
5941
5944
|
if (this._body !== null)
|
|
5942
|
-
this._body = this.resource.serialize(this._body,
|
|
5943
|
-
this.withCredentials =
|
|
5944
|
-
|
|
5945
|
-
this.fetchPolicy = init.fetchPolicy ?? this.api.options.fetchPolicy;
|
|
5945
|
+
this._body = this.resource.serialize(this._body, parserOptions);
|
|
5946
|
+
this.withCredentials = init.withCredentials ?? apiOptions.withCredentials;
|
|
5947
|
+
this.fetchPolicy = init.fetchPolicy ?? apiOptions.fetchPolicy;
|
|
5946
5948
|
this.maxAge = init.maxAge;
|
|
5947
5949
|
this.bodyQueryOptions = [
|
|
5948
|
-
...(
|
|
5949
|
-
...(init.bodyQueryOptions
|
|
5950
|
+
...(apiOptions.bodyQueryOptions ?? []),
|
|
5951
|
+
...(init.bodyQueryOptions ?? []),
|
|
5950
5952
|
];
|
|
5951
5953
|
// The Path and Params from resource
|
|
5952
|
-
const [resourcePath, resourceParams] = this.resource.pathAndParams(
|
|
5954
|
+
const [resourcePath, resourceParams] = this.resource.pathAndParams(parserOptions);
|
|
5953
5955
|
this._path = resourcePath;
|
|
5954
5956
|
//#region Headers
|
|
5955
5957
|
const customHeaders = {};
|
|
5956
5958
|
if (typeof init.etag === 'string') {
|
|
5957
|
-
if (
|
|
5959
|
+
if (apiOptions.etag.ifMatch && ['PUT', 'PATCH', 'DELETE'].indexOf(this._method) !== -1)
|
|
5958
5960
|
customHeaders[IF_MATCH_HEADER] = init.etag;
|
|
5959
|
-
else if (
|
|
5961
|
+
else if (apiOptions.etag.ifNoneMatch && ['GET'].indexOf(this._method) !== -1)
|
|
5960
5962
|
customHeaders[IF_NONE_MATCH_HEADER] = init.etag;
|
|
5961
5963
|
}
|
|
5962
5964
|
const accept = [];
|
|
5963
5965
|
// Metadata
|
|
5964
|
-
if (
|
|
5965
|
-
accept.push(`odata.metadata=${
|
|
5966
|
+
if (apiOptions.accept?.metadata !== undefined)
|
|
5967
|
+
accept.push(`odata.metadata=${apiOptions.accept?.metadata}`);
|
|
5966
5968
|
// IEEE754
|
|
5967
|
-
if (
|
|
5968
|
-
accept.push(`IEEE754Compatible=${
|
|
5969
|
+
if (apiOptions.accept?.ieee754Compatible !== undefined)
|
|
5970
|
+
accept.push(`IEEE754Compatible=${apiOptions.accept?.ieee754Compatible}`);
|
|
5969
5971
|
// streaming
|
|
5970
|
-
if (
|
|
5971
|
-
accept.push(`streaming=${
|
|
5972
|
+
if (apiOptions.accept?.streaming !== undefined)
|
|
5973
|
+
accept.push(`streaming=${apiOptions.accept?.streaming}`);
|
|
5972
5974
|
// ExponentialDecimals
|
|
5973
|
-
if (
|
|
5974
|
-
accept.push(`ExponentialDecimals=${
|
|
5975
|
+
if (apiOptions.accept?.exponentialDecimals !== undefined)
|
|
5976
|
+
accept.push(`ExponentialDecimals=${apiOptions.accept?.exponentialDecimals}`);
|
|
5975
5977
|
if (accept.length > 0)
|
|
5976
5978
|
customHeaders[ACCEPT] = [
|
|
5977
5979
|
`${APPLICATION_JSON};${accept.join(';')}`,
|
|
@@ -5980,25 +5982,25 @@ class ODataRequest {
|
|
|
5980
5982
|
];
|
|
5981
5983
|
const prefer = [];
|
|
5982
5984
|
// Return
|
|
5983
|
-
if (
|
|
5985
|
+
if (apiOptions.prefer?.return !== undefined &&
|
|
5984
5986
|
['POST', 'PUT', 'PATCH'].indexOf(this._method) !== -1)
|
|
5985
|
-
prefer.push(`return=${
|
|
5987
|
+
prefer.push(`return=${apiOptions.prefer?.return}`);
|
|
5986
5988
|
// MaxPageSize
|
|
5987
|
-
if (
|
|
5988
|
-
prefer.push(`odata.maxpagesize=${
|
|
5989
|
+
if (apiOptions.prefer?.maxPageSize !== undefined && ['GET'].indexOf(this._method) !== -1)
|
|
5990
|
+
prefer.push(`odata.maxpagesize=${apiOptions.prefer?.maxPageSize}`);
|
|
5989
5991
|
// Annotations
|
|
5990
|
-
if (
|
|
5992
|
+
if (apiOptions.prefer?.includeAnnotations !== undefined &&
|
|
5991
5993
|
['GET'].indexOf(this._method) !== -1)
|
|
5992
|
-
prefer.push(`odata.include-annotations=${
|
|
5994
|
+
prefer.push(`odata.include-annotations=${apiOptions.prefer?.includeAnnotations}`);
|
|
5993
5995
|
// Omit Null Values
|
|
5994
|
-
if (
|
|
5996
|
+
if (apiOptions.prefer?.omitNullValues === true && ['GET'].indexOf(this._method) !== -1)
|
|
5995
5997
|
prefer.push(`omit-values=nulls`);
|
|
5996
5998
|
// Continue on Error
|
|
5997
|
-
if (
|
|
5999
|
+
if (apiOptions.prefer?.continueOnError === true && ['POST'].indexOf(this._method) !== -1)
|
|
5998
6000
|
prefer.push(`odata.continue-on-error`);
|
|
5999
6001
|
if (prefer.length > 0)
|
|
6000
6002
|
customHeaders[PREFER] = prefer;
|
|
6001
|
-
this._headers = Http.mergeHttpHeaders(
|
|
6003
|
+
this._headers = Http.mergeHttpHeaders(apiOptions.headers, customHeaders, init.headers || {});
|
|
6002
6004
|
//#endregion
|
|
6003
6005
|
//#region Params
|
|
6004
6006
|
const customParams = {};
|
|
@@ -6011,7 +6013,7 @@ class ODataRequest {
|
|
|
6011
6013
|
if (['GET'].indexOf(this._method) !== -1) {
|
|
6012
6014
|
Object.assign(customParams, resourceParams);
|
|
6013
6015
|
}
|
|
6014
|
-
const params = Http.mergeHttpParams(
|
|
6016
|
+
const params = Http.mergeHttpParams(apiOptions.params, customParams, init.params || {});
|
|
6015
6017
|
this._params =
|
|
6016
6018
|
this._responseType === 'entity'
|
|
6017
6019
|
? Http.withoutHttpParams(params, ['$filter', '$orderby', '$count', '$skip', '$top'])
|
|
@@ -6019,6 +6021,7 @@ class ODataRequest {
|
|
|
6019
6021
|
//#endregion
|
|
6020
6022
|
}
|
|
6021
6023
|
static factory(api, method, resource, options) {
|
|
6024
|
+
// Options
|
|
6022
6025
|
const apiOptions = api.options;
|
|
6023
6026
|
let params = options.params || {};
|
|
6024
6027
|
if (options.withCount) {
|
|
@@ -11359,7 +11362,6 @@ class ODataModel {
|
|
|
11359
11362
|
asEntity(ctx) {
|
|
11360
11363
|
return this._meta.asEntity(this, ctx);
|
|
11361
11364
|
}
|
|
11362
|
-
//#region Callables
|
|
11363
11365
|
callFunction(name, params, responseType, options = {}) {
|
|
11364
11366
|
const resource = this.resource();
|
|
11365
11367
|
if (!(resource instanceof ODataEntityResource) || !resource.hasKey())
|