pict-section-recordset 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Steven Velozo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # PICT RecordSet Section
2
+
3
+ A PICT section that provides basic CRUD views (Create, Read, Update and Delete)
4
+ based on stable providers and configurations.
5
+
6
+ ## The Noble Provider
7
+
8
+ The only thing that's really required for this to operate is a Record/Record
9
+ Set provider... and given a Meadow Endpoint, the `/1.0/Entity/Schema` endpoint
10
+ can be used to programmatically create a functional provider.
11
+
12
+
@@ -0,0 +1,7 @@
1
+ const libParseCSV = require('../utility/csvparser/ParseCSV-Program.js');
2
+
3
+ // This command takes the `TabularManifestCSV.csv` file and imports it into a JSON file
4
+ //libParseCSV.run(['node', 'Harness.js', 'import']);
5
+ // This command takes the `data/MathExampleForm.json` file and injects any sidecare files in the `input_data` folder into the JSON file
6
+ //libParseCSV.run(['node', 'Harness.js', 'inject']);
7
+ libParseCSV.run(['node', 'Harness.js', 'intersect']);
@@ -0,0 +1,15 @@
1
+ # Example Applications
2
+
3
+ These applications exercise the library from very basic to complex.
4
+
5
+ ## The Basics
6
+
7
+ These forms are meant to provide simple configuration-based test
8
+ suites for the framework.
9
+
10
+ ### Simple RecordSet
11
+
12
+ The most basic example. Some lists, etc. for Book and Author
13
+ records.
14
+
15
+ http://localhost:9090/simple_entity/dist/index.html
@@ -0,0 +1,82 @@
1
+ const libFable = require('fable');
2
+
3
+ const defaultFableSettings = (
4
+ {
5
+ Product:'PictSectionFormExampleServer',
6
+ ProductVersion: '1.0.0',
7
+ APIServerPort: 9090,
8
+
9
+ OratorHTTPProxyDestinationURL: 'http://127.0.0.1:8086/'
10
+ });
11
+
12
+ // Initialize Fable
13
+ let _Fable = new libFable(defaultFableSettings);
14
+
15
+ // Now initialize the Restify ServiceServer Fable Service
16
+ _Fable.serviceManager.addServiceType('OratorServiceServer', require('orator-serviceserver-restify'));
17
+ _Fable.serviceManager.instantiateServiceProvider('OratorServiceServer',
18
+ {
19
+ RestifyConfiguration: { strictNext: true }
20
+ });
21
+
22
+ // Now add the orator service to Fable
23
+ _Fable.serviceManager.addServiceType('Orator', require('orator'));
24
+ let _Orator = _Fable.serviceManager.instantiateServiceProvider('Orator', {});
25
+
26
+ let tmpAnticipate = _Fable.newAnticipate();
27
+
28
+ // Initialize the Orator server
29
+ tmpAnticipate.anticipate(_Orator.initialize.bind(_Orator));
30
+
31
+ // Create a simple custom endpoint on the server.
32
+ tmpAnticipate.anticipate(
33
+ (fStageComplete)=>
34
+ {
35
+ // Create an endpoint. This can also be done after the service is started.
36
+ _Orator.serviceServer.get
37
+ (
38
+ '/1.0/test/:hash',
39
+ (pRequest, pResponse, fNext) =>
40
+ {
41
+ // Send back the request parameters
42
+ pResponse.send(pRequest.params);
43
+ _Orator.fable.log.info(`Endpoint sent parameters object:`, pRequest.params);
44
+ return fNext();
45
+ }
46
+ );
47
+ return fStageComplete();
48
+ });
49
+
50
+ tmpAnticipate.anticipate(
51
+ (fStageComplete) =>
52
+ {
53
+ _Orator.addStaticRoute(`${__dirname}/`);
54
+ return fStageComplete();
55
+ }
56
+ )
57
+
58
+ // Add the http proxy service
59
+ const libOratorHTTPProxy = require(`orator-http-proxy`);
60
+ _Fable.serviceManager.addServiceType('OratorHTTPProxy', libOratorHTTPProxy);
61
+ _Fable.serviceManager.instantiateServiceProvider('OratorHTTPProxy', {LogLevel: 2});
62
+ // Proxy all /1.0/ requests to the locally-running bookstore service (you need to run this from https://github.com/stevenvelozo/retold-harness ... it's a one-liner to start the service)
63
+ tmpAnticipate.anticipate(
64
+ (fNext)=>
65
+ {
66
+ _Fable.OratorHTTPProxy.connectProxyRoutes();
67
+ return fNext();
68
+ });
69
+
70
+
71
+ // Now start the service server.
72
+ tmpAnticipate.anticipate(_Orator.startService.bind(_Orator));
73
+
74
+ tmpAnticipate.wait(
75
+ (pError)=>
76
+ {
77
+ if (pError)
78
+ {
79
+ _Fable.log.error('Error initializing Orator Service Server: '+pError.message, pError);
80
+ }
81
+ _Fable.log.info('Orator Service Server Initialized.');
82
+ });
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Example Pict-Section-Form Applications</title>
7
+ </head>
8
+ <body>
9
+ <h1>Examples</h1>
10
+ <ul>
11
+ <li><a href="debug/index.html">Debug Harness (must build from debug folder)</a></li>
12
+ <li><a href="simple_form/dist/index.html">Simple Form</a></li>
13
+ <li><a href="simple_table/dist/index.html">Simple Table</a></li>
14
+ <li><a href="complex_table/dist/index.html">Complex Grid</a></li>
15
+ <li><a href="complex_tuigrid/dist/index.html">Complex Grid (using Toast UI Grid)</a></li>
16
+ <li><a href="gradebook/dist/index.html">Gradebook Linked Set Exercises</a></li>
17
+ <li><a href="postcard_example/dist/index.html">PostKard Custom App</a></li>
18
+ </ul>
19
+ </body>
20
+ </html>
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "example_applications",
3
+ "version": "1.0.0",
4
+ "description": "Simple static server and API pass-through to Bookstore API.",
5
+ "main": "ServeExamples.js",
6
+ "scripts": {
7
+ "start": "node ServeExamples.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "orator": "^5.0.1",
13
+ "orator-http-proxy": "^1.0.1",
14
+ "orator-serviceserver-restify": "^2.0.3"
15
+ }
16
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "GulpExecutions": [
3
+ {
4
+ "Hash": "default",
5
+ "Name": "Default standard build.",
6
+ "BuildFileLabel": "",
7
+ "BrowsersListRC": "since 2022"
8
+ }]
9
+ }
@@ -0,0 +1,8 @@
1
+ # Minimum Viable Record Set Forms Edit Application
2
+
3
+ To run this, install dependencies in the root of this repository with a `npm install`
4
+ and then navigate to this folder and run `npm run build` to build the dist files
5
+ (which are not checked in). Then, you should be able to open dist/index.html from
6
+ your favorite browser.
7
+
8
+ This form exercises a configuration-only form that has CRUD for the Book entity.
@@ -0,0 +1,33 @@
1
+ const libPictRecordSet = require('../../source/Pict-Section-RecordSet.js');
2
+ //const libPictSectionForm = require('pict-section-recordset');
3
+
4
+ module.exports = libPictRecordSet.PictRecordSetApplication;
5
+
6
+ module.exports.default_configuration.pict_configuration = (
7
+ {
8
+ "Product": "Simple Record Set",
9
+ "DefaultRecordSetConfigurations":
10
+ [
11
+ {
12
+ "RecordSet": "Book",
13
+
14
+ "RecordSetType": "MeadowEndpoint", // Could be "Custom" which would require a provider to already be created for the record set.
15
+ "RecordSetMeadowEntity": "Book", // This leverages the /Schema endpoint to get the record set columns.
16
+
17
+ "RecordSetURLPrefix": "http://datadebase.com:8086/1.0/"
18
+ },
19
+ {
20
+ "RecordSet": "Author",
21
+
22
+ "RecordSetType": "MeadowEndpoint",
23
+ "RecordSetMeadowEntity": "Author",
24
+
25
+ "RecordSetURLPrefix": "http://datadebase.com:8086/1.0/"
26
+ },
27
+ {
28
+ "RecordSet": "RandomizedValues",
29
+
30
+ "RecordSetType": "Custom" // This means the `PS-RSP-RandomizedValues` provider will be checked for to get records.
31
+ }
32
+ ]
33
+ });
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Simple.</title>
5
+ <style id="PICT-CSS"></style>
6
+ <script src="./pict.min.js" type="text/javascript"></script>
7
+ <script type="text/javascript">Pict.safeOnDocumentReady(() => { Pict.safeLoadPictApplication(SimpleApplication, 1)});</script>
8
+ </head>
9
+ <body>
10
+ <div id="Pict-Form-Container"></div>
11
+ <script src="./simple_application.min.js" type="text/javascript"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "simple_application",
3
+ "version": "1.0.0",
4
+ "description": "The most basic forms application ever!",
5
+ "main": "Simple-RecordSet-Application.js",
6
+ "scripts": {
7
+ "start": "node Simple-RecordSet-Application.js",
8
+ "build": "npx quack build && npx quack copy"
9
+ },
10
+ "author": "steven",
11
+ "license": "MIT",
12
+ "devDependencies": {
13
+ },
14
+ "copyFilesSettings": {
15
+ "whenFileExists": "overwrite"
16
+ },
17
+ "copyFiles": [
18
+ {
19
+ "from": "./html/*",
20
+ "to": "./dist/"
21
+ },
22
+ {
23
+ "from": "../../node_modules/pict/dist/*",
24
+ "to": "./dist/"
25
+ }
26
+ ]
27
+ }
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "pict-section-recordset",
3
+ "version": "1.0.0",
4
+ "description": "Pict dynamic record set management views",
5
+ "main": "source/Pict-Section-RecordSet.js",
6
+ "directories": {
7
+ "test": "test"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/stevenvelozo/pict-section-recordset.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/stevenvelozo/pict-section-recordset/issues"
15
+ },
16
+ "homepage": "https://github.com/stevenvelozo/pict-section-recordset#readme",
17
+ "scripts": {
18
+ "start": "node source/Pict-Section-RecordSet.js",
19
+ "tests": "npx mocha -u tdd --exit -R spec --grep",
20
+ "coverage": "npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",
21
+ "build": "npx quack build",
22
+ "test": "npx mocha -u tdd -R spec",
23
+ "lint": "eslint source/**",
24
+ "types": "tsc -p ."
25
+ },
26
+ "types": "types/source/Pict-Section-RecordSet.d.ts",
27
+ "author": "steven velozo <steven@velozo.com>",
28
+ "license": "MIT",
29
+ "devDependencies": {
30
+ "@eslint/js": "^9.21.0",
31
+ "browser-env": "^3.3.0",
32
+ "eslint": "^9.21.0",
33
+ "jquery": "^3.7.1",
34
+ "pict": "^1.0.237",
35
+ "pict-application": "^1.0.24",
36
+ "pict-service-commandlineutility": "^1.0.15",
37
+ "quackage": "^1.0.40",
38
+ "typescript": "^5.7.3"
39
+ },
40
+ "dependencies": {
41
+ "fable-serviceproviderbase": "^3.0.15",
42
+ "pict-provider": "^1.0.3",
43
+ "pict-template": "^1.0.10",
44
+ "pict-view": "^1.0.59"
45
+ },
46
+ "mocha": {
47
+ "diff": true,
48
+ "extension": [
49
+ "js"
50
+ ],
51
+ "package": "./package.json",
52
+ "reporter": "spec",
53
+ "slow": "75",
54
+ "timeout": "5000",
55
+ "ui": "tdd",
56
+ "watch-files": [
57
+ "source/**/*.js",
58
+ "test/**/*.js"
59
+ ],
60
+ "watch-ignore": [
61
+ "lib/vendor"
62
+ ]
63
+ }
64
+ }
@@ -0,0 +1,8 @@
1
+ // The container for all the Pict-Section-Form related code.
2
+
3
+ // The main dynamic view class
4
+ module.exports = require('./Pict-Section-RecordSet.js');
5
+ //module.exports.default_configuration = require('./views/Pict-View-DynamicForm-DefaultConfiguration.json');
6
+
7
+ // The application container
8
+ module.exports.PictRecordSetApplication = require('./application/Pict-Application-RecordSet.js');
@@ -0,0 +1,39 @@
1
+ const libPictApplication = require('pict-application');
2
+
3
+ const libPictSectionRecordSet = require('../Pict-Section-RecordSet.js');
4
+
5
+ /**
6
+ * Represents a PictSectionFormApplication.
7
+ *
8
+ * This is the automagic controller for a dyncamic form application.
9
+ *
10
+ * @class
11
+ * @extends libPictApplication
12
+ */
13
+ class PictSectionFormApplication extends libPictApplication
14
+ {
15
+ constructor(pFable, pOptions, pServiceHash)
16
+ {
17
+ super(pFable, pOptions, pServiceHash);
18
+
19
+ /** @type {import('pict') & import('fable')} */
20
+ this.pict;
21
+ // Add the pict recordset meta controller service
22
+ this.pict.addServiceType('PictSectionRecordSet', libPictSectionRecordSet);
23
+ }
24
+ };
25
+
26
+ module.exports = PictSectionFormApplication
27
+
28
+ module.exports.default_configuration = (
29
+ {
30
+ "Name": "A Simple Pict RecordSet Application",
31
+ "Hash": "PictRecordSetApplication",
32
+
33
+ //"MainViewportViewIdentifier": "PictRecordSetPrimaryView",
34
+
35
+ "pict_configuration":
36
+ {
37
+ "Product": "DefaultPictRecordSetApplication",
38
+ }
39
+ });
@@ -0,0 +1,95 @@
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
+ libBrowserEnv();
9
+
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 libPictSectionRecordSet.PictRecordSetApplication
20
+ {
21
+ constructor(pFable, pOptions, pServiceHash)
22
+ {
23
+ super(pFable, pOptions, pServiceHash);
24
+
25
+ this.pict.addView('DoNothingView', {}, DoNothingView);
26
+ }
27
+
28
+ /**
29
+ * @param {function} fDone - Callback that finishes the test
30
+ */
31
+ set testDone(fDone)
32
+ {
33
+ this._testDone = fDone;
34
+ }
35
+
36
+ onAfterInitialize()
37
+ {
38
+ this.solve();
39
+ this._testDone();
40
+ return super.onAfterInitialize();
41
+ }
42
+ }
43
+
44
+ class DoNothingView extends libPictView
45
+ {
46
+ constructor(pPict, pOptions)
47
+ {
48
+ super(pPict, pOptions);
49
+ }
50
+ }
51
+
52
+ suite
53
+ (
54
+ 'PictSectionRecordSet Basic',
55
+ () =>
56
+ {
57
+ setup(() => { });
58
+
59
+ suite
60
+ (
61
+ 'Basic Basic Tests',
62
+ () =>
63
+ {
64
+ test(
65
+ 'Basic Initialization',
66
+ (fDone) =>
67
+ {
68
+ let _Pict = new libPict();
69
+ _Pict.LogNoisiness = 1;
70
+ let _PictEnvironment = new libPict.EnvironmentObject(_Pict);
71
+
72
+ let _Application = new DoNothingApplication(_Pict, {});
73
+
74
+ Expect(_Application).to.be.an('object', 'Application should be an object.');
75
+ Expect(_Application).to.be.an.instanceof(libPictSectionRecordSet.PictRecordSetApplication, 'Application should be an instance of PictRecordSetApplication.');
76
+
77
+
78
+ // let _PictSectionRecordSet = _Pict.addView(tmpViewHash, tmpViewConfiguration, libPictSectionRecordSet);
79
+
80
+ // Expect(_PictSectionRecordSet).to.be.an('object');
81
+
82
+ // // Test package anthropology
83
+ // Expect(_PictSectionRecordSet._PackageFableServiceProvider).to.be.an('object', 'Fable should have a _PackageFableServiceProvider object.');
84
+ // Expect(_PictSectionRecordSet._PackageFableServiceProvider.name).equal('fable-serviceproviderbase', 'Fable _PackageFableServiceProvider.package.name should be set.');
85
+ // Expect(_PictSectionRecordSet._PackagePictView).to.be.an('object', 'Should have a _PackagePictView object.');
86
+ // Expect(_PictSectionRecordSet._PackagePictView.name).to.equal('pict-view', '_PackagePictView.package.name should be set.');
87
+ // Expect(_PictSectionRecordSet._Package).to.be.an('object', 'Should have a _Package object.');
88
+ // Expect(_PictSectionRecordSet._Package.name).to.equal('pict-section-recordset', '_Package.package.name should be set.');
89
+
90
+ return fDone();
91
+ }
92
+ );
93
+ });
94
+ }
95
+ );
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ declare const _exports: any;
2
+ export = _exports;
3
+ //# sourceMappingURL=Pict-Section-RecordSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pict-Section-RecordSet.d.ts","sourceRoot":"","sources":["../source/Pict-Section-RecordSet.js"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ export = PictSectionFormApplication;
2
+ /**
3
+ * Represents a PictSectionFormApplication.
4
+ *
5
+ * This is the automagic controller for a dyncamic form application.
6
+ *
7
+ * @class
8
+ * @extends libPictApplication
9
+ */
10
+ declare class PictSectionFormApplication extends libPictApplication {
11
+ constructor(pFable: any, pOptions: any, pServiceHash: any);
12
+ }
13
+ declare namespace PictSectionFormApplication {
14
+ export { default_configuration };
15
+ }
16
+ import libPictApplication = require("pict-application");
17
+ declare namespace default_configuration {
18
+ let Name: string;
19
+ let Hash: string;
20
+ namespace pict_configuration {
21
+ let Product: string;
22
+ }
23
+ }
24
+ //# sourceMappingURL=Pict-Application-RecordSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pict-Application-RecordSet.d.ts","sourceRoot":"","sources":["../../source/application/Pict-Application-RecordSet.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH;IAEC,2DAQC;CACD"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=RecordSet-RecordProvider-Base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordSet-RecordProvider-Base.d.ts","sourceRoot":"","sources":["../../source/providers/RecordSet-RecordProvider-Base.js"],"names":[],"mappings":""}