pict-section-recordset 1.0.9 → 1.0.11
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 +3 -3
- package/source/providers/RecordSet-RecordProvider-MeadowEndpoints.js +43 -45
- package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts +5 -25
- package/types/providers/RecordSet-RecordProvider-MeadowEndpoints.d.ts.map +1 -1
- package/types/views/list/RecordSet-List.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pict-section-recordset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Pict dynamic record set management views",
|
|
5
5
|
"main": "source/Pict-Section-RecordSet.js",
|
|
6
6
|
"directories": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"browser-env": "^3.3.0",
|
|
34
34
|
"eslint": "^9.27.0",
|
|
35
35
|
"jquery": "^3.7.1",
|
|
36
|
-
"pict": "^1.0.
|
|
36
|
+
"pict": "^1.0.257",
|
|
37
37
|
"pict-application": "^1.0.25",
|
|
38
38
|
"pict-service-commandlineutility": "^1.0.15",
|
|
39
39
|
"quackage": "^1.0.41",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"fable-serviceproviderbase": "^3.0.15",
|
|
44
44
|
"pict-provider": "^1.0.3",
|
|
45
45
|
"pict-router": "^1.0.3",
|
|
46
|
-
"pict-section-form": "^1.0.
|
|
46
|
+
"pict-section-form": "^1.0.95",
|
|
47
47
|
"pict-template": "^1.0.10",
|
|
48
48
|
"pict-view": "^1.0.60"
|
|
49
49
|
},
|
|
@@ -2,20 +2,8 @@
|
|
|
2
2
|
const libRecordSetProviderBase = require('./RecordSet-RecordProvider-Base.js');
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @typedef {(error?: Error, result?: any) => void} RestClientCallback
|
|
6
|
-
*
|
|
7
5
|
* @typedef {import('./RecordSet-RecordProvider-Base.js').RecordSetFilter} RecordSetFilter
|
|
8
6
|
* @typedef {import('./RecordSet-RecordProvider-Base.js').RecordSetResult} RecordSetResult
|
|
9
|
-
*
|
|
10
|
-
* @typedef {{
|
|
11
|
-
* getJSON(pOptionsOrURL: string | Record<string, any>, fCallback: RestClientCallback): void,
|
|
12
|
-
* putJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
13
|
-
* postJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
14
|
-
* patchJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
15
|
-
* headJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
16
|
-
* delJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
17
|
-
* getRawText(pOptionsOrURL: string | Record<string, any>, fCallback: RestClientCallback): void,
|
|
18
|
-
* }} RestClient
|
|
19
7
|
*/
|
|
20
8
|
|
|
21
9
|
/**
|
|
@@ -45,10 +33,17 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
45
33
|
this._Schema = { };
|
|
46
34
|
}
|
|
47
35
|
|
|
48
|
-
/** @
|
|
49
|
-
get
|
|
36
|
+
/** @return {import('pict/types/source/Pict-Meadow-EntityProvider.js')} */
|
|
37
|
+
get entityProvider()
|
|
50
38
|
{
|
|
51
|
-
|
|
39
|
+
/** @type {import('pict/types/source/Pict-Meadow-EntityProvider.js')} */
|
|
40
|
+
//TODO: figure out a pattern to share this with other consumers, to consolidate cache
|
|
41
|
+
this._EntityProvider = this.pict.instantiateServiceProviderWithoutRegistration('EntityProvider');
|
|
42
|
+
if (this.options.URLPrefix)
|
|
43
|
+
{
|
|
44
|
+
this._EntityProvider.options.urlPrefix = this.options.URLPrefix;
|
|
45
|
+
}
|
|
46
|
+
return this._EntityProvider;
|
|
52
47
|
}
|
|
53
48
|
|
|
54
49
|
/**
|
|
@@ -78,13 +73,13 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
78
73
|
}
|
|
79
74
|
return new Promise((resolve, reject) =>
|
|
80
75
|
{
|
|
81
|
-
this.
|
|
76
|
+
this.entityProvider.getEntity(this.options.Entity, pIDOrGuid, (pError, pResult) =>
|
|
82
77
|
{
|
|
83
|
-
if (
|
|
78
|
+
if (pError)
|
|
84
79
|
{
|
|
85
|
-
return reject(
|
|
80
|
+
return reject(pError);
|
|
86
81
|
}
|
|
87
|
-
resolve(
|
|
82
|
+
resolve(pResult);
|
|
88
83
|
});
|
|
89
84
|
});
|
|
90
85
|
}
|
|
@@ -106,13 +101,17 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
106
101
|
}
|
|
107
102
|
return new Promise((resolve, reject) =>
|
|
108
103
|
{
|
|
109
|
-
this.
|
|
104
|
+
this.entityProvider.getEntitySet(this.options.Entity, `FBV~GUID${this.options.Entity}~EQ~${encodeURIComponent(pGuid)}`, (pError, pResult) =>
|
|
110
105
|
{
|
|
111
|
-
if (
|
|
106
|
+
if (pError)
|
|
112
107
|
{
|
|
113
|
-
return reject(
|
|
108
|
+
return reject(pError);
|
|
114
109
|
}
|
|
115
|
-
|
|
110
|
+
if (pResult.length > 1)
|
|
111
|
+
{
|
|
112
|
+
this.pict.log.error(`Multiple ${this.options.Entity} records found for GUID ${pGuid}`, { Records: pResult });
|
|
113
|
+
}
|
|
114
|
+
resolve(pResult[0]);
|
|
116
115
|
});
|
|
117
116
|
});
|
|
118
117
|
}
|
|
@@ -129,22 +128,21 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
129
128
|
{
|
|
130
129
|
throw new Error('Entity is not defined in the provider options.');
|
|
131
130
|
}
|
|
131
|
+
const tmpEntity = pOptions.Entity || this.options.Entity;
|
|
132
132
|
if (this.pict.LogNoisiness > 1)
|
|
133
133
|
{
|
|
134
|
-
this.pict.log.info(`Reading ${
|
|
134
|
+
this.pict.log.info(`Reading ${tmpEntity} records`, { Options: pOptions });
|
|
135
135
|
}
|
|
136
|
-
const filterString = pOptions.FilterString ? `/FilteredTo/${pOptions.FilterString}` : '';
|
|
137
|
-
const pagination = `/${pOptions.Offset || 0}/${pOptions.PageSize || 250}`;
|
|
138
|
-
//TODO: lite support / other variants?
|
|
139
136
|
return new Promise((resolve, reject) =>
|
|
140
137
|
{
|
|
141
|
-
|
|
138
|
+
// using a space here, otherwise you get a `//` in the URL which breaks some stuff
|
|
139
|
+
this.entityProvider.getEntitySetPage(tmpEntity, pOptions.FilterString ? pOptions.FilterString : ' ', pOptions.Offset || 0, pOptions.PageSize || 250, (pError, pResult) =>
|
|
142
140
|
{
|
|
143
|
-
if (
|
|
141
|
+
if (pError)
|
|
144
142
|
{
|
|
145
|
-
return reject(
|
|
143
|
+
return reject(pError);
|
|
146
144
|
}
|
|
147
|
-
resolve({ Records:
|
|
145
|
+
resolve({ Records: pResult, Facets: { } });
|
|
148
146
|
});
|
|
149
147
|
});
|
|
150
148
|
}
|
|
@@ -173,21 +171,21 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
173
171
|
{
|
|
174
172
|
throw new Error('Entity is not defined in the provider options.');
|
|
175
173
|
}
|
|
174
|
+
const tmpEntity = pOptions.Entity || this.options.Entity;
|
|
176
175
|
if (this.pict.LogNoisiness > 1)
|
|
177
176
|
{
|
|
178
|
-
this.pict.log.info(`Counting ${
|
|
177
|
+
this.pict.log.info(`Counting ${tmpEntity} records`, { Options: pOptions });
|
|
179
178
|
}
|
|
180
|
-
const filterString = pOptions.FilterString ? `/FilteredTo/${pOptions.FilterString}` : '';
|
|
181
179
|
//TODO: lite support / other variants?
|
|
182
180
|
return new Promise((resolve, reject) =>
|
|
183
181
|
{
|
|
184
|
-
this.
|
|
182
|
+
this.entityProvider.getEntitySetRecordCount(tmpEntity, pOptions.FilterString, (pError, pCount) =>
|
|
185
183
|
{
|
|
186
|
-
if (
|
|
184
|
+
if (pError)
|
|
187
185
|
{
|
|
188
|
-
return reject(
|
|
186
|
+
return reject(pError);
|
|
189
187
|
}
|
|
190
|
-
resolve(
|
|
188
|
+
resolve({ Count: pCount });
|
|
191
189
|
});
|
|
192
190
|
});
|
|
193
191
|
}
|
|
@@ -201,11 +199,11 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
201
199
|
{
|
|
202
200
|
return new Promise((resolve, reject) =>
|
|
203
201
|
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this.restClient.postJSON({
|
|
202
|
+
if (this.pict.LogNoisiness > 1)
|
|
203
|
+
{
|
|
204
|
+
this.pict.log.info(`Creating record ${this.options.Entity}`, { Record: pRecord });
|
|
205
|
+
}
|
|
206
|
+
this.entityProvider.restClient.postJSON({
|
|
209
207
|
url: `${this.options.URLPrefix}${this.options.Entity}`,
|
|
210
208
|
body: pRecord,
|
|
211
209
|
}, (error, response, result) =>
|
|
@@ -232,7 +230,7 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
232
230
|
}
|
|
233
231
|
return new Promise((resolve, reject) =>
|
|
234
232
|
{
|
|
235
|
-
this.restClient.putJSON({
|
|
233
|
+
this.entityProvider.restClient.putJSON({
|
|
236
234
|
url: `${this.options.URLPrefix}${this.options.Entity}`,
|
|
237
235
|
body: pRecord,
|
|
238
236
|
}, (error, response, result) =>
|
|
@@ -259,7 +257,7 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
259
257
|
}
|
|
260
258
|
return new Promise((resolve, reject) =>
|
|
261
259
|
{
|
|
262
|
-
this.restClient.delJSON({
|
|
260
|
+
this.entityProvider.restClient.delJSON({
|
|
263
261
|
url: `${this.options.URLPrefix}${this.options.Entity}/${pRecord[`ID${this.options.Entity}`]}`,
|
|
264
262
|
body: pRecord,
|
|
265
263
|
}, (error, response, result) =>
|
|
@@ -329,7 +327,7 @@ class RecordSetProvider extends libRecordSetProviderBase
|
|
|
329
327
|
{
|
|
330
328
|
return fCallback();
|
|
331
329
|
}
|
|
332
|
-
this.restClient.getJSON(`${this.options.URLPrefix}${this.options.Entity}/Schema`, (error, response, result) =>
|
|
330
|
+
this.entityProvider.restClient.getJSON(`${this.options.URLPrefix}${this.options.Entity}/Schema`, (error, response, result) =>
|
|
333
331
|
{
|
|
334
332
|
if (error)
|
|
335
333
|
{
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
export = RecordSetProvider;
|
|
2
2
|
/**
|
|
3
|
-
* @typedef {(error?: Error, result?: any) => void} RestClientCallback
|
|
4
|
-
*
|
|
5
3
|
* @typedef {import('./RecordSet-RecordProvider-Base.js').RecordSetFilter} RecordSetFilter
|
|
6
4
|
* @typedef {import('./RecordSet-RecordProvider-Base.js').RecordSetResult} RecordSetResult
|
|
7
|
-
*
|
|
8
|
-
* @typedef {{
|
|
9
|
-
* getJSON(pOptionsOrURL: string | Record<string, any>, fCallback: RestClientCallback): void,
|
|
10
|
-
* putJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
11
|
-
* postJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
12
|
-
* patchJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
13
|
-
* headJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
14
|
-
* delJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void,
|
|
15
|
-
* getRawText(pOptionsOrURL: string | Record<string, any>, fCallback: RestClientCallback): void,
|
|
16
|
-
* }} RestClient
|
|
17
5
|
*/
|
|
18
6
|
/**
|
|
19
7
|
* Class representing a data change detection provider for Pict dynamic forms.
|
|
@@ -24,8 +12,10 @@ declare class RecordSetProvider extends libRecordSetProviderBase {
|
|
|
24
12
|
pict: any & import("pict");
|
|
25
13
|
/** @type {Record<string, any>} */
|
|
26
14
|
_Schema: Record<string, any>;
|
|
27
|
-
/** @
|
|
28
|
-
get
|
|
15
|
+
/** @return {import('pict/types/source/Pict-Meadow-EntityProvider.js')} */
|
|
16
|
+
get entityProvider(): import("pict/types/source/Pict-Meadow-EntityProvider.js");
|
|
17
|
+
/** @type {import('pict/types/source/Pict-Meadow-EntityProvider.js')} */
|
|
18
|
+
_EntityProvider: import("pict/types/source/Pict-Meadow-EntityProvider.js");
|
|
29
19
|
/**
|
|
30
20
|
* @typedef {(error?: Error, result?: T) => void} RecordSetCallback
|
|
31
21
|
* @template T = Record<string, any>
|
|
@@ -85,19 +75,9 @@ declare class RecordSetProvider extends libRecordSetProviderBase {
|
|
|
85
75
|
getRecordSchema(): Promise<Record<string, any>>;
|
|
86
76
|
}
|
|
87
77
|
declare namespace RecordSetProvider {
|
|
88
|
-
export {
|
|
78
|
+
export { RecordSetFilter, RecordSetResult };
|
|
89
79
|
}
|
|
90
80
|
import libRecordSetProviderBase = require("./RecordSet-RecordProvider-Base.js");
|
|
91
|
-
type RestClientCallback = (error?: Error, result?: any) => void;
|
|
92
81
|
type RecordSetFilter = import("./RecordSet-RecordProvider-Base.js").RecordSetFilter;
|
|
93
82
|
type RecordSetResult = import("./RecordSet-RecordProvider-Base.js").RecordSetResult;
|
|
94
|
-
type RestClient = {
|
|
95
|
-
getJSON(pOptionsOrURL: string | Record<string, any>, fCallback: RestClientCallback): void;
|
|
96
|
-
putJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void;
|
|
97
|
-
postJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void;
|
|
98
|
-
patchJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void;
|
|
99
|
-
headJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void;
|
|
100
|
-
delJSON(pOptions: Record<string, any>, fCallback: RestClientCallback): void;
|
|
101
|
-
getRawText(pOptionsOrURL: string | Record<string, any>, fCallback: RestClientCallback): void;
|
|
102
|
-
};
|
|
103
83
|
//# sourceMappingURL=RecordSet-RecordProvider-MeadowEndpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordSet-RecordProvider-MeadowEndpoints.d.ts","sourceRoot":"","sources":["../../source/providers/RecordSet-RecordProvider-MeadowEndpoints.js"],"names":[],"mappings":";AAGA
|
|
1
|
+
{"version":3,"file":"RecordSet-RecordProvider-MeadowEndpoints.d.ts","sourceRoot":"","sources":["../../source/providers/RecordSet-RecordProvider-MeadowEndpoints.js"],"names":[],"mappings":";AAGA;;;GAGG;AAEH;;;GAGG;AACH;IAgBE,+CAA+C;IAC/C,MADW,GAAe,GAAG,OAAO,MAAM,CAAC,CAClC;IAET,kCAAkC;IAClC,SADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACZ;IAGnB,0EAA0E;IAC1E,sBADa,OAAO,iDAAiD,CAAC,CAWrE;IARA,wEAAwE;IAExE,iBAFW,OAAO,iDAAiD,CAAC,CAE4B;IAQjG;;;OAGG;IAEH;;;;OAIG;IACH,qBAFW,MAAM,GAAC,MAAM,gBA4BvB;IAED;;;;OAIG;IACH,uBAFW,MAAM,GAAC,MAAM,gBA2BvB;IA8CD;;;;OAIG;IACH,4BAFW,eAAe,gBAyBzB;IAED;;;;OAIG;IACH,sBAFW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBAsB7B;IAED;;;;OAIG;IACH,sBAFW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBAsB7B;IAED;;;;OAIG;IACH,sBAFW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBAsB7B;IAED;;;;OAIG;IACH,sBAFW,MAAM,GAAC,MAAM,gBAKvB;IAaD;;;;OAIG;IACH,qBAFW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBAK7B;IAcD;;OAEG;IACH,6BAFW,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,QA2BjC;IAED,gDAcC;CACD;;;;;uBArWY,OAAO,oCAAoC,EAAE,eAAe;uBAC5D,OAAO,oCAAoC,EAAE,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordSet-List.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List.js"],"names":[],"mappings":";AAyEA;IAOE;;;;;;;;MAQC;IAGF,uCAuBC;IAED,+DAuBC;IAWD,8CAGC;IAED,sDAkCC;IA9BA,iCAUC;IAsBF,
|
|
1
|
+
{"version":3,"file":"RecordSet-List.d.ts","sourceRoot":"","sources":["../../../source/views/list/RecordSet-List.js"],"names":[],"mappings":";AAyEA;IAOE;;;;;;;;MAQC;IAGF,uCAuBC;IAED,+DAuBC;IAWD,8CAGC;IAED,sDAkCC;IA9BA,iCAUC;IAsBF,iIAmJC;CAwBD"}
|