angular-odata 0.154.0 → 0.156.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 -15
- package/fesm2022/angular-odata.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/apigen/angular/base.d.ts +6 -4
- package/schematics/apigen/angular/base.js +23 -5
- package/schematics/apigen/angular/base.js.map +1 -1
- package/schematics/apigen/angular/model.js +10 -4
- package/schematics/apigen/angular/model.js.map +1 -1
- package/schematics/apigen/angular/package.js +2 -2
- package/schematics/apigen/angular/package.js.map +1 -1
- package/schematics/apigen/files/collection/__fileName__.ts +2 -2
- package/schematics/apigen/files/entityset-service/__fileName__.ts +2 -2
- package/schematics/apigen/files/model/__fileName__.ts +2 -2
- package/types/angular-odata.d.ts +10 -8
|
@@ -10864,7 +10864,9 @@ class ODataCollection {
|
|
|
10864
10864
|
const resource = this.resource();
|
|
10865
10865
|
if (!(resource instanceof ODataEntitySetResource))
|
|
10866
10866
|
return throwError(() => new Error("callFunction: Can't call function without ODataEntitySetResource"));
|
|
10867
|
-
|
|
10867
|
+
let func = resource.function(name);
|
|
10868
|
+
if (options.query !== undefined)
|
|
10869
|
+
func = func.query(options.query);
|
|
10868
10870
|
switch (responseType) {
|
|
10869
10871
|
case 'property':
|
|
10870
10872
|
return this._request(func.callProperty(params, options), (resp) => resp);
|
|
@@ -10881,7 +10883,9 @@ class ODataCollection {
|
|
|
10881
10883
|
if (!(resource instanceof ODataEntitySetResource)) {
|
|
10882
10884
|
return throwError(() => new Error(`callAction: Can't call action without ODataEntitySetResource`));
|
|
10883
10885
|
}
|
|
10884
|
-
|
|
10886
|
+
let action = resource.action(name);
|
|
10887
|
+
if (options.query !== undefined)
|
|
10888
|
+
action = action.query(options.query);
|
|
10885
10889
|
switch (responseType) {
|
|
10886
10890
|
case 'property':
|
|
10887
10891
|
return this._request(action.callProperty(params, options), (resp) => resp);
|
|
@@ -11368,7 +11372,9 @@ class ODataModel {
|
|
|
11368
11372
|
const resource = this.resource();
|
|
11369
11373
|
if (!(resource instanceof ODataEntityResource) || !resource.hasKey())
|
|
11370
11374
|
return throwError(() => new Error("callFunction: Can't call function without ODataEntityResource with key"));
|
|
11371
|
-
|
|
11375
|
+
let func = resource.function(name);
|
|
11376
|
+
if (options.query !== undefined)
|
|
11377
|
+
func = func.query(options.query);
|
|
11372
11378
|
switch (responseType) {
|
|
11373
11379
|
case 'property':
|
|
11374
11380
|
return this._request(func.callProperty(params, options), (resp) => resp);
|
|
@@ -11388,7 +11394,9 @@ class ODataModel {
|
|
|
11388
11394
|
const resource = this.resource();
|
|
11389
11395
|
if (!(resource instanceof ODataEntityResource) || !resource.hasKey())
|
|
11390
11396
|
return throwError(() => new Error("callAction: Can't call action without ODataEntityResource with key"));
|
|
11391
|
-
|
|
11397
|
+
let action = resource.action(name);
|
|
11398
|
+
if (options.query !== undefined)
|
|
11399
|
+
action = action.query(options.query);
|
|
11392
11400
|
switch (responseType) {
|
|
11393
11401
|
case 'property':
|
|
11394
11402
|
return this._request(action.callProperty(params, options), (resp) => resp);
|
|
@@ -11414,8 +11422,9 @@ class ODataModel {
|
|
|
11414
11422
|
});
|
|
11415
11423
|
}
|
|
11416
11424
|
fetchNavigationProperty(name, responseType, options = {}) {
|
|
11417
|
-
|
|
11418
|
-
|
|
11425
|
+
let nav = this.navigationProperty(name);
|
|
11426
|
+
if (options.query !== undefined)
|
|
11427
|
+
nav = nav.query(options.query);
|
|
11419
11428
|
switch (responseType) {
|
|
11420
11429
|
case 'model':
|
|
11421
11430
|
return nav.fetchModel(options);
|
|
@@ -11428,24 +11437,27 @@ class ODataModel {
|
|
|
11428
11437
|
if (!field)
|
|
11429
11438
|
throw Error(`fetchAttribute: Can't find attribute ${name}`);
|
|
11430
11439
|
if (field.isStructuredType() && field.collection) {
|
|
11431
|
-
|
|
11432
|
-
|
|
11440
|
+
let collection = field.collectionFactory({ parent: this });
|
|
11441
|
+
if (options.query !== undefined)
|
|
11442
|
+
collection = collection.query(options.query);
|
|
11433
11443
|
return this._request(collection.fetch(options), () => {
|
|
11434
11444
|
this.assign({ [name]: collection });
|
|
11435
11445
|
return collection;
|
|
11436
11446
|
});
|
|
11437
11447
|
}
|
|
11438
11448
|
else if (field.isStructuredType()) {
|
|
11439
|
-
|
|
11440
|
-
|
|
11449
|
+
let model = field.modelFactory({ parent: this });
|
|
11450
|
+
if (options.query !== undefined)
|
|
11451
|
+
model = model.query(options.query);
|
|
11441
11452
|
return this._request(model.fetch(options), () => {
|
|
11442
11453
|
this.assign({ [name]: model });
|
|
11443
11454
|
return model;
|
|
11444
11455
|
});
|
|
11445
11456
|
}
|
|
11446
11457
|
else {
|
|
11447
|
-
|
|
11448
|
-
|
|
11458
|
+
let prop = field.resourceFactory(this.resource());
|
|
11459
|
+
if (options.query !== undefined)
|
|
11460
|
+
prop = prop.query(options.query);
|
|
11449
11461
|
return this._request(prop.fetchProperty(options), (resp) => {
|
|
11450
11462
|
this.assign({ [name]: resp });
|
|
11451
11463
|
return resp;
|
|
@@ -13793,21 +13805,24 @@ class ODataBaseService {
|
|
|
13793
13805
|
return this.client.apiFor(this.apiNameOrEntityType);
|
|
13794
13806
|
}
|
|
13795
13807
|
callFunction(params, resource, responseType, options = {}) {
|
|
13796
|
-
|
|
13808
|
+
if (options.query !== undefined)
|
|
13809
|
+
resource = resource.query(options.query);
|
|
13797
13810
|
return resource.call(params, {
|
|
13798
13811
|
responseType: responseType,
|
|
13799
13812
|
...options,
|
|
13800
13813
|
});
|
|
13801
13814
|
}
|
|
13802
13815
|
callAction(params, resource, responseType, options = {}) {
|
|
13803
|
-
|
|
13816
|
+
if (options.query !== undefined)
|
|
13817
|
+
resource = resource.query(options.query);
|
|
13804
13818
|
return resource.call(params, {
|
|
13805
13819
|
responseType: responseType,
|
|
13806
13820
|
...options,
|
|
13807
13821
|
});
|
|
13808
13822
|
}
|
|
13809
13823
|
fetchNavigationProperty(resource, responseType, options = {}) {
|
|
13810
|
-
|
|
13824
|
+
if (options.query !== undefined)
|
|
13825
|
+
resource = resource.query(options.query);
|
|
13811
13826
|
return resource.fetch({ responseType: responseType, ...options });
|
|
13812
13827
|
}
|
|
13813
13828
|
}
|