pict-section-recordset 1.0.70 → 1.2.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/package.json +5 -1
- package/source/providers/Filter-Data-Provider.js +16 -5
- package/source/views/Filter-PersistenceView.js +150 -35
- package/source/views/RecordSet-Filters.js +230 -28
- package/source/views/filters/RecordSet-Filter-Base.js +86 -8
- package/source/views/read/RecordSet-Read.js +308 -2
- package/types/providers/Filter-Data-Provider.d.ts +1 -1
- package/types/providers/Filter-Data-Provider.d.ts.map +1 -1
- package/types/views/Filter-PersistenceView.d.ts +23 -2
- package/types/views/Filter-PersistenceView.d.ts.map +1 -1
- package/types/views/RecordSet-Filters.d.ts +26 -1
- package/types/views/RecordSet-Filters.d.ts.map +1 -1
- package/types/views/filters/RecordSet-Filter-Base.d.ts +14 -0
- package/types/views/filters/RecordSet-Filter-Base.d.ts.map +1 -1
- package/types/views/list/RecordSet-List.d.ts.map +1 -1
- package/types/views/read/RecordSet-Read.d.ts +51 -0
- package/types/views/read/RecordSet-Read.d.ts.map +1 -1
- package/.vscode/launch.json +0 -46
- package/CONTRIBUTING.md +0 -50
- package/debug/Harness.js +0 -0
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -76
- package/docs/_brand.json +0 -18
- package/docs/_cover.md +0 -11
- package/docs/_sidebar.md +0 -19
- package/docs/_version.json +0 -7
- package/docs/api-reference.md +0 -233
- package/docs/filters.md +0 -151
- package/docs/index.html +0 -38
- package/docs/record-providers.md +0 -155
- package/docs/retold-catalog.json +0 -87
- package/docs/retold-keyword-index.json +0 -5227
- package/docs/views/create/README.md +0 -181
- package/docs/views/dashboard/README.md +0 -308
- package/docs/views/list/README.md +0 -260
- package/docs/views/read/README.md +0 -216
- package/eslint.config.mjs +0 -10
- package/example_applications/README.md +0 -39
- package/example_applications/ServeExamples.js +0 -82
- package/example_applications/bookstore/.quackage.json +0 -9
- package/example_applications/bookstore/Bookstore-Application-Configuration.json +0 -4
- package/example_applications/bookstore/Bookstore-Application.js +0 -671
- package/example_applications/bookstore/css/bookstore.css +0 -729
- package/example_applications/bookstore/css/pure.min.css +0 -11
- package/example_applications/bookstore/html/index.html +0 -46
- package/example_applications/bookstore/package.json +0 -34
- package/example_applications/bookstore/providers/PictRouter-Bookstore.json +0 -32
- package/example_applications/bookstore/views/PictView-Bookstore-Content-About.json +0 -21
- package/example_applications/bookstore/views/PictView-Bookstore-Content-Legal.json +0 -21
- package/example_applications/bookstore/views/PictView-Bookstore-Dashboard.js +0 -147
- package/example_applications/bookstore/views/PictView-Bookstore-Layout.js +0 -85
- package/example_applications/bookstore/views/PictView-Bookstore-Login.js +0 -58
- package/example_applications/bookstore/views/PictView-Bookstore-Navigation.js +0 -228
- package/example_applications/index.html +0 -50
- package/example_applications/mocks/book-edit-view.html +0 -173
- package/example_applications/mocks/book-read-view.html +0 -166
- package/example_applications/mocks/list-view.html +0 -185
- package/example_applications/package.json +0 -16
- package/example_applications/simple_entity/.quackage.json +0 -9
- package/example_applications/simple_entity/README-Simple-RecordSet.md +0 -8
- package/example_applications/simple_entity/Simple-RecordSet-Application.js +0 -887
- package/example_applications/simple_entity/html/index.html +0 -207
- package/example_applications/simple_entity/package.json +0 -27
- package/test/PictSectionRecordSet-Basic_tests.js +0 -205
- package/test/PictSectionRecordSet-Filter-Data-Provider_tests.js +0 -263
- package/test/PictSectionRecordSet-Filter-InstanceViews-Render_tests.js +0 -328
- package/test/PictSectionRecordSet-RecordProvider-Meadow_tests.js +0 -216
- package/tsconfig.build.json +0 -16
- package/tsconfig.json +0 -16
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Unit tests for PictSectionRecordSet Basic
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// This is temporary, but enables unit tests
|
|
7
|
-
const libBrowserEnv = require('browser-env');
|
|
8
|
-
|
|
9
|
-
const libPictApplication = require('pict-application');
|
|
10
|
-
const libPictView = require('pict-view');
|
|
11
|
-
|
|
12
|
-
const Chai = require('chai');
|
|
13
|
-
const Expect = Chai.expect;
|
|
14
|
-
|
|
15
|
-
const libPict = require('pict');
|
|
16
|
-
|
|
17
|
-
const libPictSectionRecordSet = require('../source/Pict-Section-RecordSet.js');
|
|
18
|
-
|
|
19
|
-
class DoNothingApplication extends libPictApplication
|
|
20
|
-
{
|
|
21
|
-
constructor(pFable, pOptions, pServiceHash)
|
|
22
|
-
{
|
|
23
|
-
pOptions.AutoRenderMainViewportViewAfterInitialize = false;
|
|
24
|
-
pOptions.AutoRenderViewsAfterInitialize = false;
|
|
25
|
-
super(pFable, pOptions, pServiceHash);
|
|
26
|
-
|
|
27
|
-
let resolveFunc;
|
|
28
|
-
/** @type {Promise & { resolve?: () => void }} */
|
|
29
|
-
this._initialized = new Promise(function (resolve)
|
|
30
|
-
{
|
|
31
|
-
resolveFunc = resolve;
|
|
32
|
-
});
|
|
33
|
-
this._initialized.resolve = resolveFunc;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get iniitalized()
|
|
37
|
-
{
|
|
38
|
-
return this._initialized;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
onAfterInitialize()
|
|
42
|
-
{
|
|
43
|
-
this._initialized.resolve();
|
|
44
|
-
return super.onAfterInitialize();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
class DoNothingView extends libPictView
|
|
49
|
-
{
|
|
50
|
-
constructor(pPict, pOptions)
|
|
51
|
-
{
|
|
52
|
-
super(pPict, pOptions);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
suite
|
|
57
|
-
(
|
|
58
|
-
'PictSectionRecordSet RecordProvider MeadowEndpoints Tests',
|
|
59
|
-
() =>
|
|
60
|
-
{
|
|
61
|
-
setup(() =>
|
|
62
|
-
{
|
|
63
|
-
libBrowserEnv({ url: 'http://localhost/' });
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
suite
|
|
67
|
-
(
|
|
68
|
-
'Basic Basic Tests',
|
|
69
|
-
() =>
|
|
70
|
-
{
|
|
71
|
-
let _Pict;
|
|
72
|
-
setup(async () =>
|
|
73
|
-
{
|
|
74
|
-
_Pict = new libPict();
|
|
75
|
-
_Pict.LogNoisiness = 2;
|
|
76
|
-
let _PictEnvironment = new libPict.EnvironmentObject(_Pict);
|
|
77
|
-
|
|
78
|
-
let _Application = new DoNothingApplication(_Pict, {});
|
|
79
|
-
_Pict.addProvider('BooksProvider', { Entity: 'Book', URLPrefix: 'http://localhost:8086/1.0/' }, require('../source/providers/RecordSet-RecordProvider-MeadowEndpoints.js'));
|
|
80
|
-
await new Promise((resolve, reject) => _Application.initializeAsync((error) =>
|
|
81
|
-
{
|
|
82
|
-
if (error)
|
|
83
|
-
{
|
|
84
|
-
return reject(error);
|
|
85
|
-
}
|
|
86
|
-
resolve();
|
|
87
|
-
}));
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test('getRecord by ID', async () =>
|
|
91
|
-
{
|
|
92
|
-
const book = await _Pict.providers.BooksProvider.getRecord(1);
|
|
93
|
-
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
94
|
-
Expect(book).to.have.property('IDBook', 1, 'Book should have an id of 1.');
|
|
95
|
-
Expect(book).to.have.property('GUIDBook', 'ca811611-59c9-4b4a-9864-df5145f7785d', 'Book should have a guid of "ca811611-59c9-4b4a-9864-df5145f7785d".');
|
|
96
|
-
Expect(book.Title).to.equal('Angels & Demons', 'Book should have a title of "Angels & Demons".');
|
|
97
|
-
}); // ca811611-59c9-4b4a-9864-df5145f7785d
|
|
98
|
-
|
|
99
|
-
test('getRecord by GUID', async () =>
|
|
100
|
-
{
|
|
101
|
-
const book = await _Pict.providers.BooksProvider.getRecord('ca811611-59c9-4b4a-9864-df5145f7785d');
|
|
102
|
-
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
103
|
-
Expect(book).to.have.property('IDBook', 1, 'Book should have an id of 1.');
|
|
104
|
-
Expect(book).to.have.property('GUIDBook', 'ca811611-59c9-4b4a-9864-df5145f7785d', 'Book should have a guid of "ca811611-59c9-4b4a-9864-df5145f7785d".');
|
|
105
|
-
Expect(book.Title).to.equal('Angels & Demons', 'Book should have a title of "Angels & Demons".');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('getRecords with no options', async () =>
|
|
109
|
-
{
|
|
110
|
-
const { Records: books } = await _Pict.providers.BooksProvider.getRecords({ });
|
|
111
|
-
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
112
|
-
Expect(books.length).to.equal(250, 'Books should have one record.');
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
test('getRecords with pagination', async () =>
|
|
116
|
-
{
|
|
117
|
-
const { Records: books } = await _Pict.providers.BooksProvider.getRecords({ Offset: 1, PageSize: 1 });
|
|
118
|
-
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
119
|
-
Expect(books.length).to.equal(1, 'Books should have one record.');
|
|
120
|
-
const book = books[0];
|
|
121
|
-
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
122
|
-
Expect(book).to.have.property('IDBook', 2, 'Book should have an id of 2.');
|
|
123
|
-
Expect(book).to.have.property('GUIDBook', 'c854b3f1-539a-47fa-acca-c1b90629c220', 'Book should have a guid of "c854b3f1-539a-47fa-acca-c1b90629c220".');
|
|
124
|
-
Expect(book.Title).to.equal(`Harry Potter and the Philosopher's Stone`, `Book should have a title of "Harry Potter and the Philosopher's Stone".`);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
test('getRecords with filter', async () =>
|
|
128
|
-
{
|
|
129
|
-
const { Records: books } = await _Pict.providers.BooksProvider.getRecords({ FilterString: 'FBV~ISBN~GE~804139024~FSF~ISBN~ASC~0' });
|
|
130
|
-
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
131
|
-
const book = books[0];
|
|
132
|
-
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
133
|
-
Expect(book.ISBN).to.equal('804139024', 'Book should have an ISBN of "804139024".');
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
test('getRecordSetCount', async () =>
|
|
137
|
-
{
|
|
138
|
-
const { Count: count } = await _Pict.providers.BooksProvider.getRecordSetCount({ });
|
|
139
|
-
Expect(count).to.be.greaterThan(0, 'Count should be greater than 0.');
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test('getRecordSetCount with filter', async () =>
|
|
143
|
-
{
|
|
144
|
-
const { Count: count } = await _Pict.providers.BooksProvider.getRecordSetCount({ FilterString: 'FBV~ISBN~GE~804139024~FSF~ISBN~ASC~0' });
|
|
145
|
-
Expect(count).to.be.greaterThan(0, 'Count should be greater than 0.');
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test('getRecordSetCount with filter to one record', async () =>
|
|
149
|
-
{
|
|
150
|
-
const { Count: count } = await _Pict.providers.BooksProvider.getRecordSetCount({ FilterString: 'FBV~ISBN~EQ~804139024' });
|
|
151
|
-
Expect(count).to.equal(1, 'Count should be equal to 1.');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
test('getRecordsInline with no options', async () =>
|
|
155
|
-
{
|
|
156
|
-
const { Records: books } = await _Pict.providers.BooksProvider.getRecordsInline();
|
|
157
|
-
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
158
|
-
Expect(books.length).to.equal(250, 'Books should have one record.');
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
test('getRecordsInline with pagination', async () =>
|
|
162
|
-
{
|
|
163
|
-
const { Records: books } = await _Pict.providers.BooksProvider.getRecordsInline('', 1, 1);
|
|
164
|
-
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
165
|
-
Expect(books.length).to.equal(1, 'Books should have one record.');
|
|
166
|
-
const book = books[0];
|
|
167
|
-
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
168
|
-
Expect(book).to.have.property('IDBook', 2, 'Book should have an id of 2.');
|
|
169
|
-
Expect(book).to.have.property('GUIDBook', 'c854b3f1-539a-47fa-acca-c1b90629c220', 'Book should have a guid of "c854b3f1-539a-47fa-acca-c1b90629c220".');
|
|
170
|
-
Expect(book.Title).to.equal(`Harry Potter and the Philosopher's Stone`, `Book should have a title of "Harry Potter and the Philosopher's Stone".`);
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
test('getRecordsInline with filter', async () =>
|
|
174
|
-
{
|
|
175
|
-
const { Records: books } = await _Pict.providers.BooksProvider.getRecordsInline('FBV~ISBN~GE~804139024~FSF~ISBN~ASC~0');
|
|
176
|
-
Expect(books).to.be.an('array', 'Books should be an array.');
|
|
177
|
-
const book = books[0];
|
|
178
|
-
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
179
|
-
Expect(book.ISBN).to.equal('804139024', 'Book should have an ISBN of "804139024".');
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
test('createRecord and deleteRecord', async () =>
|
|
183
|
-
{
|
|
184
|
-
const book = await _Pict.providers.BooksProvider.createRecord({ Title: 'Test Book', ISBN: '1234567890' });
|
|
185
|
-
Expect(book).to.be.an('object', 'Book should be an object.');
|
|
186
|
-
Expect(book.IDBook).to.be.greaterThan(0, 'Book should have an id greater than 0.');
|
|
187
|
-
book.Title = 'Test Book 2';
|
|
188
|
-
const updartedBook = await _Pict.providers.BooksProvider.updateRecord(book);
|
|
189
|
-
Expect(updartedBook).to.be.an('object', 'Book should be an object.');
|
|
190
|
-
Expect(updartedBook.IDBook).to.equal(book.IDBook, 'Book should have the same id.');
|
|
191
|
-
Expect(updartedBook.Title).to.equal('Test Book 2', 'Book should have a title of "Test Book 2".');
|
|
192
|
-
await _Pict.providers.BooksProvider.deleteRecord(book);
|
|
193
|
-
const existenceCheck = await _Pict.providers.BooksProvider.getRecord(book.IDBook);
|
|
194
|
-
Expect(existenceCheck.Error).to.equal('Record not Found');
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
test('recordSchema', async () =>
|
|
198
|
-
{
|
|
199
|
-
const schema = await _Pict.providers.BooksProvider.getRecordSchema();
|
|
200
|
-
Expect(schema).to.be.an('object', 'Schema should be an object.');
|
|
201
|
-
Expect(Object.keys(schema).length).to.be.greaterThan(0, 'Schema should have properties.');
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test('temp', async () =>
|
|
205
|
-
{
|
|
206
|
-
const libPictDynamicFormDependencyManager = require('pict-section-form').PictDynamicFormDependencyManager;
|
|
207
|
-
_Pict.addAndInstantiateSingletonService('PictDynamicFormDependencyManager', libPictDynamicFormDependencyManager.default_configuration, libPictDynamicFormDependencyManager);
|
|
208
|
-
const filterView = new (require('../source/views/RecordSet-Filters.js'))(_Pict);
|
|
209
|
-
const ser = await filterView.serializeFilterExperience([ { Type: 'fake', Value: 'valyou' } ]);
|
|
210
|
-
const deser = await filterView.deserializeFilterExperience(ser);
|
|
211
|
-
Expect(deser).to.be.an('array', 'Deserialized filter experience should be an array.');
|
|
212
|
-
Expect(deser).to.deep.equal([ { Type: 'fake', Value: 'valyou' } ], 'Deserialized filter experience should match the original.');
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
);
|
package/tsconfig.build.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"include": ["source"],
|
|
3
|
-
"compilerOptions":
|
|
4
|
-
{
|
|
5
|
-
"target": "es2019",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"checkJs": true,
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"emitDeclarationOnly": true,
|
|
11
|
-
"outDir": "types",
|
|
12
|
-
"declarationMap": true,
|
|
13
|
-
"module": "commonjs",
|
|
14
|
-
"resolveJsonModule": true
|
|
15
|
-
}
|
|
16
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"include": ["source", "test"],
|
|
3
|
-
"compilerOptions":
|
|
4
|
-
{
|
|
5
|
-
"target": "es2019",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"checkJs": true,
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"emitDeclarationOnly": true,
|
|
11
|
-
"outDir": "types",
|
|
12
|
-
"declarationMap": true,
|
|
13
|
-
"module": "commonjs",
|
|
14
|
-
"resolveJsonModule": true
|
|
15
|
-
}
|
|
16
|
-
}
|