pict-section-recordset 1.23.0 → 1.23.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-recordset",
3
- "version": "1.23.0",
3
+ "version": "1.23.1",
4
4
  "description": "Pict dynamic record set management views",
5
5
  "main": "source/Pict-Section-RecordSet.js",
6
6
  "files": [
@@ -37,10 +37,10 @@
37
37
  "browser-env": "^3.3.0",
38
38
  "eslint": "^9.28.0",
39
39
  "jquery": "^3.7.1",
40
- "pict": "^1.0.384",
40
+ "pict": "^1.0.389",
41
41
  "pict-application": "^1.0.34",
42
42
  "pict-docuserve": "^1.4.19",
43
- "pict-service-commandlineutility": "^1.0.19",
43
+ "pict-service-commandlineutility": "^1.0.20",
44
44
  "quackage": "^1.3.0",
45
45
  "typescript": "^5.9.3"
46
46
  },
@@ -48,7 +48,7 @@
48
48
  "fable-serviceproviderbase": "^3.0.19",
49
49
  "pict-provider": "^1.0.13",
50
50
  "pict-router": "^1.0.10",
51
- "pict-section-form": "^1.1.9",
51
+ "pict-section-form": "^1.3.2",
52
52
  "pict-template": "^1.0.15",
53
53
  "pict-view": "^1.0.68",
54
54
  "sinon": "^21.0.1"
@@ -101,7 +101,8 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
101
101
  return tmpCallback(new Error('RecordSet provider cannot resolve a distinct request (missing Entity or rest client).'), []);
102
102
  }
103
103
  const tmpURL = `${this.options.URLPrefix || ''}${this.options.Entity}s/Distinct/${pColumn}${tmpOptions.Filter ? `/FilteredTo/${tmpOptions.Filter}` : ''}`;
104
- this.entityProvider.restClient.getJSON(tmpURL, (pError, pResponse, pBody) =>
104
+ const tmpEntityProvider = this.entityProvider;
105
+ const fHandleDistinctResult = (pError, pResponse, pBody) =>
105
106
  {
106
107
  if (pError || (pResponse && pResponse.statusCode > 299) || !Array.isArray(pBody))
107
108
  {
@@ -112,6 +113,25 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
112
113
  const tmpValues = [ ...new Set(pBody.map((pRecord) => pRecord && pRecord[pColumn]).filter((pValue) => pValue != null)) ];
113
114
  this._scopeDistinctCache[tmpCacheKey] = tmpValues;
114
115
  return tmpCallback(null, tmpValues);
116
+ };
117
+ // Route through POST /:Entity/Query (Distinct mode) when the endpoint
118
+ // supports it — a long /FilteredTo/ stanza on the Distinct GET is the same
119
+ // URI-length hazard the Query route exists to sidestep. Falls back to GET.
120
+ const fResolveSupport = (typeof tmpEntityProvider.resolveEntityQuerySupport === 'function')
121
+ ? tmpEntityProvider.resolveEntityQuerySupport.bind(tmpEntityProvider)
122
+ : (pEntity, pPrefix, fCb) => { return fCb(null, false); };
123
+ fResolveSupport(this.options.Entity, this.options.URLPrefix, (pSupportError, pSupportsQuery) =>
124
+ {
125
+ if (pSupportsQuery)
126
+ {
127
+ const tmpBody = { Distinct: true, Columns: pColumn };
128
+ if (tmpOptions.Filter)
129
+ {
130
+ tmpBody.Filter = tmpOptions.Filter;
131
+ }
132
+ return tmpEntityProvider.restClient.postJSON({ url: `${this.options.URLPrefix || ''}${this.options.Entity}s/Query`, body: tmpBody }, fHandleDistinctResult);
133
+ }
134
+ return tmpEntityProvider.restClient.getJSON(tmpURL, fHandleDistinctResult);
115
135
  });
116
136
  }
117
137
 
@@ -1006,6 +1026,13 @@ class MeadowEndpointsRecordSetProvider extends libRecordSetProviderBase
1006
1026
  return fCallback(error);
1007
1027
  }
1008
1028
  this._Schema = result;
1029
+ // The schema response carries the endpoint's version/capability
1030
+ // metadata; seed the entity provider's capability cache from it so
1031
+ // reads avoid a redundant capability probe.
1032
+ if (this.entityProvider && typeof this.entityProvider.primeEntityCapabilityFromSchema === 'function')
1033
+ {
1034
+ this.entityProvider.primeEntityCapabilityFromSchema(this.options.Entity, result, this.options.URLPrefix);
1035
+ }
1009
1036
  return fCallback(null);
1010
1037
  });
1011
1038
  }).catch((error) =>