angular-odata 0.159.0 → 0.160.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.
@@ -1779,11 +1779,13 @@ class ODataAnnotation {
1779
1779
  string;
1780
1780
  bool;
1781
1781
  int;
1782
- permissions;
1783
- properties;
1782
+ values;
1784
1783
  constructor(annot) {
1785
1784
  this.term = annot.term;
1786
- Object.assign(this, annot);
1785
+ this.string = annot.string;
1786
+ this.bool = annot.bool;
1787
+ this.int = annot.int;
1788
+ this.values = annot.values;
1787
1789
  }
1788
1790
  }
1789
1791
  class ODataAnnotatable {
@@ -1813,8 +1815,7 @@ class ODataAnnotatable {
1813
1815
  return (annot.string ||
1814
1816
  annot.bool ||
1815
1817
  annot.int ||
1816
- annot.permissions ||
1817
- annot.properties);
1818
+ annot.values);
1818
1819
  }
1819
1820
  }
1820
1821
 
@@ -5987,7 +5988,8 @@ class ODataRequest {
5987
5988
  if (apiOptions.prefer?.maxPageSize !== undefined && ['GET'].indexOf(this._method) !== -1)
5988
5989
  prefer.push(`odata.maxpagesize=${apiOptions.prefer?.maxPageSize}`);
5989
5990
  // Annotations
5990
- if (apiOptions.prefer?.includeAnnotations !== undefined && ['GET'].indexOf(this._method) !== -1)
5991
+ if (apiOptions.prefer?.includeAnnotations !== undefined &&
5992
+ ['GET'].indexOf(this._method) !== -1)
5991
5993
  prefer.push(`odata.include-annotations=${apiOptions.prefer?.includeAnnotations}`);
5992
5994
  // Omit Null Values
5993
5995
  if (apiOptions.prefer?.omitNullValues === true && ['GET'].indexOf(this._method) !== -1)
@@ -7985,11 +7987,22 @@ class CsdlAnnotation {
7985
7987
  return json;
7986
7988
  }
7987
7989
  toConfig() {
7990
+ var items = undefined;
7991
+ if (Array.isArray(this.Collection) && this.Collection.length > 0) {
7992
+ items = this.Collection.map((m) => m.toConfig()).flat();
7993
+ }
7994
+ else if (Array.isArray(this.Record) && this.Record.length > 0) {
7995
+ items = this.Record.map((m) => m.toConfig()).flat();
7996
+ }
7997
+ else if (Array.isArray(this.EnumMember) && this.EnumMember.length > 0) {
7998
+ items = this.EnumMember.map((m) => m.toConfig());
7999
+ }
7988
8000
  return {
7989
8001
  term: this.Term,
7990
8002
  string: this.String,
7991
8003
  bool: this.Bool,
7992
8004
  int: this.Int,
8005
+ values: items,
7993
8006
  };
7994
8007
  }
7995
8008
  }
@@ -8089,6 +8102,21 @@ class CsdlCollection {
8089
8102
  }
8090
8103
  return json;
8091
8104
  }
8105
+ toConfig() {
8106
+ if (Array.isArray(this.String) && this.String.length > 0) {
8107
+ return this.String.map((s) => s.toConfig());
8108
+ }
8109
+ if (Array.isArray(this.Record) && this.Record.length > 0) {
8110
+ return this.Record.map((r) => r.toConfig()).flat();
8111
+ }
8112
+ if (Array.isArray(this.PropertyPath) && this.PropertyPath.length > 0) {
8113
+ return this.PropertyPath.map((p) => p.toConfig());
8114
+ }
8115
+ if (Array.isArray(this.NavigationPropertyPath) && this.NavigationPropertyPath.length > 0) {
8116
+ return this.NavigationPropertyPath.map((p) => p.toConfig());
8117
+ }
8118
+ return [];
8119
+ }
8092
8120
  }
8093
8121
  class CsdlRecord {
8094
8122
  PropertyValue;
@@ -8102,6 +8130,12 @@ class CsdlRecord {
8102
8130
  }
8103
8131
  return json;
8104
8132
  }
8133
+ toConfig() {
8134
+ if (Array.isArray(this.PropertyValue) && this.PropertyValue.length > 0) {
8135
+ return this.PropertyValue.map((p) => p.toConfig());
8136
+ }
8137
+ return [];
8138
+ }
8105
8139
  }
8106
8140
  class CsdlPropertyValue {
8107
8141
  Name;
@@ -8127,6 +8161,19 @@ class CsdlPropertyValue {
8127
8161
  }
8128
8162
  return json;
8129
8163
  }
8164
+ toConfig() {
8165
+ const config = { name: this.Name };
8166
+ if (this.String !== undefined) {
8167
+ config['string'] = this.String;
8168
+ }
8169
+ if (this.Date !== undefined) {
8170
+ config['date'] = this.Date;
8171
+ }
8172
+ if (Array.isArray(this.EnumMember) && this.EnumMember.length > 0) {
8173
+ config['enumMembers'] = this.EnumMember.map((m) => m.toConfig());
8174
+ }
8175
+ return config;
8176
+ }
8130
8177
  }
8131
8178
  class CsdlEnumMember {
8132
8179
  TextContent;
@@ -8138,6 +8185,9 @@ class CsdlEnumMember {
8138
8185
  TextContent: this.TextContent,
8139
8186
  };
8140
8187
  }
8188
+ toConfig() {
8189
+ return this.TextContent;
8190
+ }
8141
8191
  }
8142
8192
  class CsdlString {
8143
8193
  TextContent;
@@ -8149,6 +8199,9 @@ class CsdlString {
8149
8199
  TextContent: this.TextContent,
8150
8200
  };
8151
8201
  }
8202
+ toConfig() {
8203
+ return this.TextContent;
8204
+ }
8152
8205
  }
8153
8206
  class CsdlPropertyPath {
8154
8207
  TextContent;
@@ -8160,6 +8213,9 @@ class CsdlPropertyPath {
8160
8213
  TextContent: this.TextContent,
8161
8214
  };
8162
8215
  }
8216
+ toConfig() {
8217
+ return this.TextContent;
8218
+ }
8163
8219
  }
8164
8220
  class CsdlNavigationPropertyPath {
8165
8221
  TextContent;
@@ -8171,6 +8227,9 @@ class CsdlNavigationPropertyPath {
8171
8227
  TextContent: this.TextContent,
8172
8228
  };
8173
8229
  }
8230
+ toConfig() {
8231
+ return this.TextContent;
8232
+ }
8174
8233
  }
8175
8234
 
8176
8235
  class CsdlReference extends CsdlAnnotable {
@@ -9085,7 +9144,7 @@ class CsdlSchema {
9085
9144
  return {
9086
9145
  namespace: this.Namespace,
9087
9146
  alias: base?.alias ?? this.Alias,
9088
- annotations: this.Annotations?.map((t) => t.toConfig()),
9147
+ annotations: this.Annotations?.flatMap((t) => t.toConfig()),
9089
9148
  enums: this.EnumType?.map((t) => t.toConfig(base?.enums?.find((cs) => cs.name === t.Name))),
9090
9149
  entities: [
9091
9150
  ...(this.ComplexType ?? []).map((t) => t.toConfig(base?.entities?.find((cs) => cs.name === t.Name))),
@@ -12977,7 +13036,7 @@ class ODataApi {
12977
13036
  });
12978
13037
  return true;
12979
13038
  }
12980
- populate({ schemas, references, models, collections, }) {
13039
+ populate({ schemas, references, models, collections }) {
12981
13040
  const odataSchemas = (schemas ?? []).map((schema) => new ODataSchema(schema, this));
12982
13041
  //TODO: Merge duplicates
12983
13042
  this.schemas = [...this.schemas, ...odataSchemas];