jsgui3-server 0.0.80 → 0.0.83
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/README.md +8 -1
- package/bundler/bundle.js +11 -0
- package/bundler/bundler.js +9 -0
- package/bundler/js-bundler.js +189 -0
- package/bundler/webpage-bundler.js +284 -0
- package/bundler/website-bundler.js +23 -0
- package/controls/README.md +8 -0
- package/controls/page/admin.js +75 -0
- package/controls/panel/admin.js +11 -0
- package/examples/controls/html-server-combo-box.js +5 -5
- package/examples/html-server.js +3 -0
- package/examples/square_box.js +35 -0
- package/examples/square_box_client.js +91 -0
- package/module.js +8 -0
- package/{single-control-server.js → old/_single-control-server.js} +157 -96
- package/old/single-control-server.js +108 -158
- package/{single-page-app.js → old/single-page-app.js} +2 -0
- package/{examples/demos → old}/square_box.js +1 -1
- package/package.json +10 -9
- package/page-context.js +1 -1
- package/publishing/http-css-publisher.js +0 -0
- package/publishing/{function-publisher.js → http-function-publisher.js} +12 -2
- package/publishing/http-html-page-publisher.js +5 -0
- package/publishing/http-html-publisher.js +25 -0
- package/publishing/http-jpeg-publisher.js +0 -0
- package/publishing/http-js-publisher.js +25 -0
- package/publishing/{observable-publisher.js → http-observable-publisher.js} +12 -6
- package/publishing/http-png-publisher.js +0 -0
- package/publishing/http-publisher.js +52 -0
- package/publishing/{resource-publisher.js → http-resource-publisher.js} +20 -1
- package/publishing/http-svg-publisher.js +0 -0
- package/publishing/http-webpage-publisher.js +112 -0
- package/publishing/http-website-publisher.js +262 -0
- package/publishing/notes.md +1 -0
- package/resources/README.md +16 -0
- package/resources/_old_website-resource.js +507 -0
- package/resources/compile/server-resource-compilation.js +41 -0
- package/resources/data-resource.js +14 -0
- package/resources/fs-resource.js +2 -4
- package/resources/jsbuilder/test/test_ast_node.js +0 -63
- package/resources/jsbuilder/test/test_project.js +1 -0
- package/resources/notes.txt +11 -0
- package/resources/server-installed-tools.js +29 -0
- package/resources/server-resource-pool.js +1 -44
- package/resources/website-css-resource.js +1 -1
- package/resources/website-javascript-resource.js +165 -34
- package/resources/website-resource.js +62 -294
- package/resources/website-static-html-resource.js +19 -16
- package/resources/website-template-html-resource.js +231 -0
- package/roadmap.md +46 -0
- package/server.js +711 -18
- package/website/webpage.js +169 -0
- package/website/website-group.js +16 -0
- package/website/website.js +227 -0
|
@@ -21,54 +21,26 @@ const each = jsgui.each;
|
|
|
21
21
|
//console.log('post require jsgui');
|
|
22
22
|
//var Start_Stop_Toggle_Button = require('../controls/start-stop-toggle-button');
|
|
23
23
|
const is_array = jsgui.is_array;
|
|
24
|
-
var Server = require('
|
|
25
|
-
var Website_Resource = require('
|
|
24
|
+
var Server = require('../server');
|
|
25
|
+
var Website_Resource = require('../resources/website-resource');
|
|
26
26
|
var port = 80;
|
|
27
27
|
//console.log('!!Server', !!Server);
|
|
28
28
|
//console.log('Object.keys(Server)', Object.keys(Server));
|
|
29
|
-
var Server_Page_Context = require('
|
|
29
|
+
var Server_Page_Context = require('../page-context');
|
|
30
30
|
|
|
31
31
|
// js_mode option
|
|
32
32
|
// compress
|
|
33
33
|
// debug
|
|
34
34
|
// (standard)
|
|
35
35
|
|
|
36
|
-
//
|
|
36
|
+
// Assumes port 80 for the moment, but want control over ports.
|
|
37
|
+
// May have / need dedicated websocket port, maybe https, secure websocket?
|
|
37
38
|
|
|
39
|
+
// Will need to be done in a very different way, if at all.
|
|
40
|
+
// jsgui3-server is now written to (more) easily publish a single control as a web page.
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var server = new Server({
|
|
42
|
-
'*': {
|
|
43
|
-
'name': 'html-server'
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
*/
|
|
48
|
-
/*
|
|
49
|
-
var resource_pool = root_server.resource_pool;
|
|
50
|
-
// link these getters with the resource pool resource getters?
|
|
51
|
-
let app_server = resource_pool['HTML Server'];
|
|
52
|
-
//console.log('app_server', app_server);
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
//console.log('app_server.resource_names', app_server.resource_names);
|
|
56
|
-
//console.log('!!app_server.resource_pool', !!app_server.resource_pool);
|
|
57
|
-
let js = app_server.resource_pool['Site JavaScript'];
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
//console.log('Server', Server);
|
|
61
|
-
|
|
62
|
-
// And choose the CSS file / files to send it.
|
|
63
|
-
// Could send basic jsgui css by default
|
|
64
|
-
// Then there would be app css on top of that.
|
|
65
|
-
|
|
66
|
-
// Authenticated_Server?
|
|
67
|
-
// Has got authentication mechanisms as a wrapper for the controls inside.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// Want to be able to set up icons as well.
|
|
71
|
-
|
|
42
|
+
// Some code concerning cutting out client code could help.
|
|
43
|
+
// However, proper bundling may be better.
|
|
72
44
|
|
|
73
45
|
|
|
74
46
|
class Single_Control_Server extends Server {
|
|
@@ -95,12 +67,16 @@ class Single_Control_Server extends Server {
|
|
|
95
67
|
throw 'Single_Control_Server needs a Ctrl property'
|
|
96
68
|
}
|
|
97
69
|
}
|
|
70
|
+
|
|
71
|
+
|
|
98
72
|
if (spec.js_mode) this.js_mode = spec.js_mode;
|
|
99
73
|
if (spec.js_client) this.js_client = spec.js_client;
|
|
100
|
-
|
|
101
|
-
// an obj
|
|
74
|
+
if (spec.context_data) this.context_data = spec.context_data;
|
|
102
75
|
if (spec.css) this.css = spec.css;
|
|
103
|
-
|
|
76
|
+
|
|
77
|
+
// Not handling icons in the spec(yet). Now using load_icon_set.
|
|
78
|
+
//if (spec.icons) this.icons = spec.icons;
|
|
79
|
+
|
|
104
80
|
if (spec.include_server_ref_in_page_context) {
|
|
105
81
|
this.include_server_ref_in_page_context = spec.include_server_ref_in_page_context;
|
|
106
82
|
}
|
|
@@ -118,13 +94,11 @@ class Single_Control_Server extends Server {
|
|
|
118
94
|
var app = new Website_Resource({
|
|
119
95
|
'name': 'html-server'
|
|
120
96
|
});
|
|
121
|
-
|
|
122
97
|
// will need to keep access to the server?
|
|
123
98
|
// server_page_context keeping access to the server?
|
|
124
99
|
|
|
125
100
|
// some place to keep variables on the server.
|
|
126
101
|
// Especially when we are not coding any / much server-side logic.
|
|
127
|
-
|
|
128
102
|
// server.shared
|
|
129
103
|
// want an object that is shared between all server instances.
|
|
130
104
|
|
|
@@ -132,7 +106,6 @@ class Single_Control_Server extends Server {
|
|
|
132
106
|
|
|
133
107
|
// Maybe make something like Resource_Pool but simpler?
|
|
134
108
|
// Less prescriptive, but allowing a more complex api...?
|
|
135
|
-
|
|
136
109
|
// page_context.shared
|
|
137
110
|
// shared with the server
|
|
138
111
|
// shared with all page contexts.
|
|
@@ -146,11 +119,18 @@ class Single_Control_Server extends Server {
|
|
|
146
119
|
}
|
|
147
120
|
|
|
148
121
|
// Could start it up with a client_js reference
|
|
122
|
+
// be able to chose the port(s) as well?
|
|
123
|
+
|
|
124
|
+
// HTTPS and other protocols?
|
|
149
125
|
|
|
150
126
|
'start' (callback) {
|
|
127
|
+
|
|
128
|
+
const {context_data} = this;
|
|
129
|
+
|
|
130
|
+
// Want the right lower level abstractions for this. And similar.
|
|
131
|
+
|
|
151
132
|
//throw 'stop';
|
|
152
133
|
//var resource_pool = this.resource_pool;
|
|
153
|
-
|
|
154
134
|
var resource_pool = this.app_server.resource_pool;
|
|
155
135
|
var server_router = this.resource_pool.get_resource('Server Router');
|
|
156
136
|
// Build the client js and include that.
|
|
@@ -162,80 +142,49 @@ class Single_Control_Server extends Server {
|
|
|
162
142
|
let js = this.app_server.resource_pool['Site JavaScript'];
|
|
163
143
|
let css = this.app_server.resource_pool['Site CSS'];
|
|
164
144
|
let imgs = this.app_server.resource_pool['Site Images'];
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
// will look into the resource publisher to see what is published.
|
|
169
|
-
|
|
170
|
-
// serve package with replacement options.
|
|
171
|
-
// // the activate app function.
|
|
172
|
-
// Can be put into place in the served JS.
|
|
173
|
-
|
|
174
|
-
// with replacement option within serve_package
|
|
175
|
-
|
|
176
145
|
let o_serve_package = {
|
|
177
146
|
//'babel': 'mini'
|
|
178
147
|
}
|
|
179
148
|
|
|
180
|
-
//
|
|
181
|
-
// Activation should be defined
|
|
182
|
-
// Or there is some default activation in the client.js
|
|
183
|
-
// It has the maps of controls and Controls
|
|
184
|
-
// Then can activate these controls.
|
|
185
|
-
// There should maybe be some more data services in the client.
|
|
186
|
-
// Could make the client more miniature and modular once it works, and then incorporate react.
|
|
187
|
-
// Data-Resource would be general enough to work on both.
|
|
188
|
-
// The client data resources could then direct their requests to the server ones.
|
|
189
|
-
// Could make a resource-pool for both client and server
|
|
190
|
-
|
|
191
|
-
//console.log('this.activate_app', this.activate_app);
|
|
192
|
-
//throw 'stop';
|
|
193
|
-
|
|
194
|
-
// Should do this before the babel compilation. Think that's the sequence anyway.
|
|
195
|
-
// Not sure why it's not working.
|
|
149
|
+
// Other way(s) of doing this now.
|
|
196
150
|
if (this.activate_app) {
|
|
197
151
|
o_serve_package.replace = {
|
|
198
152
|
'/* -- ACTIVATE-APP -- */': this.activate_app.toString()
|
|
199
153
|
}
|
|
200
154
|
//
|
|
201
155
|
}
|
|
202
|
-
// want it to serve with debug code map
|
|
203
|
-
// for the moment
|
|
204
|
-
// want that to be easier to do with a --debug option.
|
|
205
|
-
// should read command line options.
|
|
206
156
|
o_serve_package.js_mode = 'mini';
|
|
207
157
|
if (this.js_mode) {
|
|
208
158
|
o_serve_package.js_mode = this.js_mode;
|
|
209
159
|
} else {
|
|
210
160
|
//o_serve_package.babel = 'mini';
|
|
211
161
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
162
|
+
if (this.css) {
|
|
163
|
+
each(this.css, (path, serve_as) => {
|
|
164
|
+
css.serve(serve_as, path);
|
|
165
|
+
})
|
|
166
|
+
}
|
|
215
167
|
|
|
216
|
-
|
|
168
|
+
|
|
169
|
+
// css.serve_package_css
|
|
170
|
+
// will get the css from that package?
|
|
171
|
+
// or extract the css from the classes in the package directly?
|
|
217
172
|
|
|
218
|
-
// Minifying currently breaks it.
|
|
219
173
|
|
|
220
|
-
|
|
174
|
+
let js_client = this.client_package || this.js_client || 'jsgui3-client';
|
|
221
175
|
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
//
|
|
176
|
+
// The removal of server code / recompilation shouldnt make a difference in cases where we give it client-side js to start with.
|
|
177
|
+
// Have the case of the actual client-side js being given with no transformation needed.
|
|
178
|
+
// Can detect whether there is any server-side code and transformation(s) needed...?
|
|
225
179
|
|
|
226
180
|
|
|
227
181
|
|
|
228
182
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
//
|
|
232
|
-
//
|
|
233
|
-
|
|
234
|
-
each(this.css, (path, serve_as) => {
|
|
235
|
-
css.serve(serve_as, path);
|
|
236
|
-
})
|
|
237
|
-
}
|
|
238
|
-
let js_client = this.client_package || this.js_client || 'jsgui3-client';
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
//console.log('js_client', js_client);
|
|
186
|
+
//throw 'stop';
|
|
187
|
+
|
|
239
188
|
js.serve_package('/js/app.js', js_client, o_serve_package, (err, served) => {
|
|
240
189
|
//var resource_pool = this.resource_pool;
|
|
241
190
|
//console.log('server_router', server_router);
|
|
@@ -243,10 +192,9 @@ class Single_Control_Server extends Server {
|
|
|
243
192
|
if (!server_router) {
|
|
244
193
|
throw 'no server_router';
|
|
245
194
|
}
|
|
246
|
-
|
|
195
|
+
const routing_tree = server_router.routing_tree;
|
|
247
196
|
routing_tree.set('/', (req, res) => {
|
|
248
197
|
//console.log('root path / request');
|
|
249
|
-
|
|
250
198
|
const o_spc = {
|
|
251
199
|
'req': req,
|
|
252
200
|
'res': res,
|
|
@@ -254,10 +202,11 @@ class Single_Control_Server extends Server {
|
|
|
254
202
|
}
|
|
255
203
|
|
|
256
204
|
if (this.include_server_ref_in_page_context) o_spc.server = this;
|
|
257
|
-
|
|
258
|
-
|
|
259
205
|
var server_page_context = new Server_Page_Context(o_spc);
|
|
260
|
-
|
|
206
|
+
// then merge the context data :)
|
|
207
|
+
if (this.context_data) {
|
|
208
|
+
Object.assign(server_page_context, this.context_data);
|
|
209
|
+
}
|
|
261
210
|
// and .server property?
|
|
262
211
|
// a different way to get the server info to the components is needed.
|
|
263
212
|
|
|
@@ -266,46 +215,20 @@ class Single_Control_Server extends Server {
|
|
|
266
215
|
'context': server_page_context
|
|
267
216
|
});
|
|
268
217
|
hd.include_client_css();
|
|
269
|
-
hd.include_css('/css/basic.css')
|
|
218
|
+
hd.include_css('/css/basic.css');
|
|
219
|
+
hd.include_css('/css/controls.css');
|
|
270
220
|
|
|
221
|
+
// include compiled css too.
|
|
222
|
+
// not much of it yet.
|
|
223
|
+
|
|
224
|
+
// Will be a separate CSS file, generated upon app start.
|
|
271
225
|
if (this.css) {
|
|
272
226
|
each(this.css, (path, serve_as) => {
|
|
273
227
|
//css.serve(serve_as, path);
|
|
274
228
|
hd.include_css('/css/' + serve_as);
|
|
275
229
|
});
|
|
276
230
|
}
|
|
277
|
-
|
|
278
|
-
// include a js script block, having it set up the
|
|
279
|
-
// not include_client_js
|
|
280
|
-
|
|
281
|
-
// .include_client_config_js()
|
|
282
|
-
// will get the resource config from the resource publisher.
|
|
283
|
-
|
|
284
|
-
// including data on published resources in the initial html download would be very useful.
|
|
285
|
-
// auto event wiring, so that controls that rely on having this data will have it available.
|
|
286
|
-
|
|
287
|
-
// Want to get this to work, then greatly slim down the codebase, or at least delete comments, use some more syntactic sugar.
|
|
288
|
-
|
|
289
|
-
// Calling 'publish' would be a good method.
|
|
290
|
-
//console.log('this.app_server.map_resource_publishers', this.app_server.map_resource_publishers);
|
|
291
|
-
//console.log('this.app_server.def_resource_publishers', this.app_server.def_resource_publishers);
|
|
292
|
-
|
|
293
|
-
// a script block where we assign the resource publishers.
|
|
294
|
-
// tell the client what resources are available on the server.
|
|
295
|
-
|
|
296
|
-
// include a js script block.
|
|
297
|
-
// jsgui.register_server_resources({...})
|
|
298
|
-
// o_def
|
|
299
|
-
// an object that describes how the resources are published.
|
|
300
|
-
|
|
301
|
-
// app_server.def_resource_publishers
|
|
302
|
-
// the urls
|
|
303
|
-
// what data it provides / its schema.
|
|
304
|
-
// a def from each of the publishers
|
|
305
|
-
// with a schema similar to graphql?
|
|
306
|
-
|
|
307
|
-
//throw 'stop';
|
|
308
|
-
|
|
231
|
+
|
|
309
232
|
var body = hd.body;
|
|
310
233
|
let o_params = this.params || {};
|
|
311
234
|
Object.assign(o_params, {
|
|
@@ -317,10 +240,7 @@ class Single_Control_Server extends Server {
|
|
|
317
240
|
ctrl.active();
|
|
318
241
|
//var ctrl2 = new jsgui.Control({});
|
|
319
242
|
body.add(ctrl);
|
|
320
|
-
|
|
321
|
-
let resources_script = new jsgui.script({
|
|
322
|
-
context: server_page_context
|
|
323
|
-
});
|
|
243
|
+
|
|
324
244
|
// it will be a client-side function.
|
|
325
245
|
|
|
326
246
|
// Should not use 'add' here.
|
|
@@ -332,31 +252,57 @@ class Single_Control_Server extends Server {
|
|
|
332
252
|
hd.include_js('/js/app.js');
|
|
333
253
|
|
|
334
254
|
// Would this be a place to register icons?
|
|
255
|
+
// and register client data.
|
|
335
256
|
|
|
257
|
+
// If we have the client data, we merge these items into the context.
|
|
258
|
+
// register_context_data
|
|
259
|
+
// because the page_context js object won't have been created yet...
|
|
336
260
|
|
|
337
|
-
|
|
338
|
-
|
|
261
|
+
// create the different statements.
|
|
262
|
+
// only put that resources_script in if there is something worth doing.
|
|
339
263
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
// Setting jsgui.context on the client-side does make sense.
|
|
343
|
-
// There would only be one context per instance of jsgui on the client.
|
|
264
|
+
// Or even do the CSS compilation and property removal from the JS file, all at the same time?
|
|
265
|
+
// Maybe could do it from reference to the client controls too.
|
|
344
266
|
|
|
345
|
-
|
|
346
|
-
|
|
267
|
+
// Will work out a fairly simple way to compile together tha CSS.
|
|
268
|
+
// May have a few methods available, make use of them in different ways / at different levels.
|
|
347
269
|
|
|
348
|
-
|
|
349
|
-
|
|
270
|
+
let statement_rsr;
|
|
271
|
+
let statement_context_data;
|
|
272
|
+
let statements = [];
|
|
350
273
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
// can be non-local, but api will localise its use.
|
|
274
|
+
// Some data will be sent to the client each time.
|
|
275
|
+
// Could possibly deliver some kind of token as well to represent the user.
|
|
354
276
|
|
|
355
|
-
|
|
356
|
-
|
|
277
|
+
// Number of entries in this.app_server.def_resource_publishers
|
|
278
|
+
|
|
279
|
+
if (this.app_server.def_resource_publishers) {
|
|
280
|
+
const c = Object.keys(this.app_server.def_resource_publishers).length;
|
|
281
|
+
if (c > 0) {
|
|
282
|
+
statement_rsr = `jsgui.register_server_resources(${JSON.stringify(this.app_server.def_resource_publishers)});`;
|
|
283
|
+
statements.push(statement_rsr);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (context_data) {
|
|
288
|
+
const c = Object.keys(context_data).length;
|
|
289
|
+
if (c > 0) {
|
|
290
|
+
statement_context_data = `jsgui.register_context_data(${JSON.stringify(context_data)});`;
|
|
291
|
+
statements.push(statement_context_data);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
357
294
|
|
|
358
|
-
|
|
359
|
-
|
|
295
|
+
if (statements.length > 0) {
|
|
296
|
+
let resources_script = new jsgui.script({
|
|
297
|
+
context: server_page_context
|
|
298
|
+
});
|
|
299
|
+
const strc = new jsgui.String_Control({
|
|
300
|
+
context: server_page_context,
|
|
301
|
+
text: statements.join('')
|
|
302
|
+
});
|
|
303
|
+
resources_script.add(strc);
|
|
304
|
+
body.add(resources_script);
|
|
305
|
+
}
|
|
360
306
|
|
|
361
307
|
hd.all_html_render(function (err, deferred_html) {
|
|
362
308
|
if (err) {
|
|
@@ -390,11 +336,15 @@ class Single_Control_Server extends Server {
|
|
|
390
336
|
load_icon_set(path, map_icons) {
|
|
391
337
|
// will load each icon into the image resource.
|
|
392
338
|
// sequential way of doing this?
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
339
|
+
// need to register an image / icon by name within the image resource.
|
|
340
|
+
// different version support too?
|
|
341
|
+
// track original versions with name.
|
|
342
|
+
let site_images = this.app_server.resource_pool['Site Images'];
|
|
343
|
+
//console.log('load_icon_set');
|
|
344
|
+
//console.log('site_images', site_images);
|
|
345
|
+
// site_images.load_icon_set?
|
|
346
|
+
// read each of them from disk individually?
|
|
347
|
+
site_images.load_icon_set(path, map_icons);
|
|
398
348
|
}
|
|
399
349
|
}
|
|
400
350
|
|
package/package.json
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"main": "module.js",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@babel/core": "^7.17.
|
|
7
|
-
"@babel/parser": "7.17.
|
|
8
|
-
"@babel/generator": "^7.17.
|
|
6
|
+
"@babel/core": "^7.17.9",
|
|
7
|
+
"@babel/parser": "7.17.9",
|
|
8
|
+
"@babel/generator": "^7.17.9",
|
|
9
9
|
"babel-plugin-transform-runtime": "^6.23.0",
|
|
10
10
|
"babel-preset-minify": "^0.5.1",
|
|
11
11
|
"browserify": "17.0.0",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"cookies": "^0.8.0",
|
|
14
14
|
"fnl": "^0.0.21",
|
|
15
15
|
"fnlfs": "^0.0.24",
|
|
16
|
-
"jsgui3-client": "^0.0.
|
|
17
|
-
"jsgui3-html": "0.0.
|
|
18
|
-
|
|
16
|
+
"jsgui3-client": "^0.0.67",
|
|
17
|
+
"jsgui3-html": "0.0.95",
|
|
18
|
+
|
|
19
19
|
"multiparty": "^4.2.3",
|
|
20
20
|
"ncp": "^2.0.0",
|
|
21
|
-
"obext": "0.0.
|
|
21
|
+
"obext": "0.0.23",
|
|
22
22
|
"rimraf": "^3.0.2",
|
|
23
23
|
"stream-to-array": "^2.3.0",
|
|
24
24
|
"url-parse": "^1.5.10"
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"babel-plugin-transform-class": "^0.3.0",
|
|
30
30
|
"babel-plugin-transform-es2015-classes": "^6.24.1",
|
|
31
31
|
"babel-plugin-transform-es2015-object-super": "^6.24.1",
|
|
32
|
-
"iltorb": "^2.4.3"
|
|
32
|
+
"iltorb": "^2.4.3",
|
|
33
|
+
"lang-mini": "^0.0.25"
|
|
33
34
|
},
|
|
34
35
|
"engines": {
|
|
35
36
|
"node": ">=15.0.0"
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"type": "git",
|
|
41
42
|
"url": "https://github.com/metabench/jsgui3-server.git"
|
|
42
43
|
},
|
|
43
|
-
"version": "0.0.
|
|
44
|
+
"version": "0.0.83"
|
|
44
45
|
}
|
package/page-context.js
CHANGED
|
File without changes
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
const jsgui = require('jsgui3-html');
|
|
2
|
+
|
|
3
|
+
const HTTP_Publisher = require('./http-publisher');
|
|
4
|
+
|
|
2
5
|
const {
|
|
3
6
|
Evented_Class, tf
|
|
4
7
|
} = jsgui;
|
|
@@ -7,6 +10,10 @@ const {
|
|
|
7
10
|
observable
|
|
8
11
|
} = require('fnl');
|
|
9
12
|
|
|
13
|
+
// Publishing could use a lower level HTTP_Handling.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
10
17
|
// May need a lot more work for flexibility and auth
|
|
11
18
|
// Maybe can use middleware.
|
|
12
19
|
|
|
@@ -20,8 +27,11 @@ const {
|
|
|
20
27
|
|
|
21
28
|
// Use some more general, lower level HTTP?
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Function_Publisher extends HTTP_Publisher {
|
|
24
33
|
constructor(spec) {
|
|
34
|
+
super(spec);
|
|
25
35
|
//let fn = this.fn = spec;
|
|
26
36
|
// attach a spec to the function?
|
|
27
37
|
// including a schema or params list for the fn?
|
|
@@ -120,7 +130,7 @@ class Function_Publisher {
|
|
|
120
130
|
const fn_res = fn(obj_input);
|
|
121
131
|
const tfr = tf(fn_res);
|
|
122
132
|
|
|
123
|
-
console.log('tfr', tfr);
|
|
133
|
+
//console.log('tfr', tfr);
|
|
124
134
|
|
|
125
135
|
if (tfr === 'p') {
|
|
126
136
|
// promise
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// Publishes the HTML format.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const HTTP_Publisher = require('./http-publisher');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HTTP_HTML_Publisher extends HTTP_Publisher {
|
|
10
|
+
constructor(spec) {
|
|
11
|
+
super(spec);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Will publish HTML documents over HTTP, but seems as though it would need to be configured / called with
|
|
15
|
+
// something to render as well as a rendering engine and parameters.
|
|
16
|
+
|
|
17
|
+
// compilation = rendering? not exactly.
|
|
18
|
+
|
|
19
|
+
// handle_http()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = HTTP_HTML_Publisher;
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// Publishes the HTML format.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const HTTP_Publisher = require('./http-publisher');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HTTP_JS_Publisher extends HTTP_Publisher {
|
|
10
|
+
constructor(spec) {
|
|
11
|
+
super(spec);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Will publish HTML documents over HTTP, but seems as though it would need to be configured / called with
|
|
15
|
+
// something to render as well as a rendering engine and parameters.
|
|
16
|
+
|
|
17
|
+
// compilation = rendering? not exactly.
|
|
18
|
+
|
|
19
|
+
// handle_http()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = HTTP_JS_Publisher;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const jsgui = require('jsgui3-html');
|
|
2
|
+
|
|
2
3
|
const {
|
|
3
4
|
Evented_Class
|
|
4
5
|
} = jsgui;
|
|
@@ -7,6 +8,8 @@ const {
|
|
|
7
8
|
observable
|
|
8
9
|
} = require('fnl');
|
|
9
10
|
|
|
11
|
+
const HTTP_Publisher = require('./http-publisher');
|
|
12
|
+
|
|
10
13
|
// Evented_Class_Publisher?
|
|
11
14
|
// Evented_Publisher
|
|
12
15
|
|
|
@@ -17,20 +20,23 @@ const {
|
|
|
17
20
|
// Seems simple, would work with a single process auth provider, then could have centralised auth and token issuance and checking.
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class Observable_Publisher {
|
|
23
|
+
class Observable_Publisher extends HTTP_Publisher {
|
|
25
24
|
constructor(spec) {
|
|
25
|
+
super(spec);
|
|
26
26
|
let obs, schema;
|
|
27
27
|
// needs to hook into the server though...
|
|
28
28
|
if (spec.next && spec.complete && spec.error) {
|
|
29
29
|
obs = spec;
|
|
30
30
|
} else {
|
|
31
31
|
|
|
32
|
+
if (spec.obs) {
|
|
33
|
+
obs = spec.obs;
|
|
34
|
+
} else {
|
|
35
|
+
throw 'No observable found.';
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
//let {schema} = spec;
|
|
33
|
-
|
|
39
|
+
|
|
34
40
|
schema = spec.schema;
|
|
35
41
|
|
|
36
42
|
//console.trace();
|
|
File without changes
|