@onetype/framework 2.0.47 → 2.0.49
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/addons/core/clients/back/grpc/addon.js +1 -0
- package/addons/core/clients/back/grpc/item/functions/connect.js +3 -1
- package/addons/core/commands/back/functions/grpc/client.js +2 -1
- package/addons/core/commands/back/functions/grpc/server.js +3 -1
- package/addons/core/servers/back/grpc/addon.js +2 -0
- package/addons/core/servers/back/grpc/item/functions/start.js +13 -1
- package/addons/render/pages/front/styles/page.css +1 -2
- package/addons/render/transforms/js/functions/runtime.js +4 -2
- package/addons/render/transforms/js/item/functions/run.js +7 -0
- package/lib/src/mixins/data.js +22 -2
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ const clientsGRPC = onetype.Addon('clients.grpc', (addon) =>
|
|
|
6
6
|
addon.Field('instance', ['object']);
|
|
7
7
|
addon.Field('host', ['string', 'localhost']);
|
|
8
8
|
addon.Field('port', ['number', 50000]);
|
|
9
|
+
addon.Field('secure', ['boolean', true]);
|
|
9
10
|
addon.Field('timeout', ['number', 5]);
|
|
10
11
|
addon.Field('metadata', ['object', {}]);
|
|
11
12
|
|
|
@@ -31,7 +31,9 @@ clientsGRPC.Fn('item.connect', async function(item)
|
|
|
31
31
|
|
|
32
32
|
const universalPackage = grpc.loadPackageDefinition(definition).universal;
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const credentials = item.Get('secure') ? grpc.credentials.createSsl() : grpc.credentials.createInsecure();
|
|
35
|
+
|
|
36
|
+
const client = new universalPackage.UniversalService(`${item.Get('host')}:${item.Get('port')}`, credentials, {
|
|
35
37
|
'grpc.max_send_message_length': 1024 * 1024 * 100,
|
|
36
38
|
'grpc.max_receive_message_length': 1024 * 1024 * 100,
|
|
37
39
|
'grpc.keepalive_time_ms': 30000,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import commands from '#commands/core/addon.js';
|
|
2
2
|
|
|
3
|
-
commands.Fn('grpc.client', async function(host, port, metadata = {}, prefix = 'remote', bidirectional = false, callbacks = {})
|
|
3
|
+
commands.Fn('grpc.client', async function(host, port, metadata = {}, prefix = 'remote', bidirectional = false, callbacks = {}, options = {})
|
|
4
4
|
{
|
|
5
5
|
const grpcClients = (await import('#clients/grpc/load.js')).default;
|
|
6
6
|
const store = new Set();
|
|
@@ -18,6 +18,7 @@ commands.Fn('grpc.client', async function(host, port, metadata = {}, prefix = 'r
|
|
|
18
18
|
{
|
|
19
19
|
host,
|
|
20
20
|
port,
|
|
21
|
+
secure: options.secure !== false,
|
|
21
22
|
metadata,
|
|
22
23
|
onConnect: function(client)
|
|
23
24
|
{
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import commands from '#commands/core/addon.js';
|
|
2
2
|
|
|
3
|
-
commands.Fn('grpc.server', async function(port = 50000, callbacks = {})
|
|
3
|
+
commands.Fn('grpc.server', async function(port = 50000, callbacks = {}, options = {})
|
|
4
4
|
{
|
|
5
5
|
const grpcServers = (await import('#servers/grpc/load.js')).default;
|
|
6
6
|
const server = grpcServers.Item({
|
|
7
7
|
port: port,
|
|
8
|
+
secure: options.secure === true,
|
|
9
|
+
cert: options.cert,
|
|
8
10
|
onStart: function()
|
|
9
11
|
{
|
|
10
12
|
callbacks['onStart'] && callbacks['onStart']();
|
|
@@ -6,6 +6,8 @@ const serversGRPC = onetype.Addon('servers.grpc', (addon) =>
|
|
|
6
6
|
addon.Field('instance', ['object']);
|
|
7
7
|
addon.Field('port', ['number', 50000]);
|
|
8
8
|
addon.Field('host', ['string', '0.0.0.0']);
|
|
9
|
+
addon.Field('secure', ['boolean', false]);
|
|
10
|
+
addon.Field('cert', ['object']);
|
|
9
11
|
|
|
10
12
|
addon.Field('onError', ['function']);
|
|
11
13
|
addon.Field('onStart', ['function']);
|
|
@@ -42,7 +42,19 @@ serversGRPC.Fn('item.start', async function(item)
|
|
|
42
42
|
stream: (...data) => item.Fn('stream', ...data)
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
let credentials = grpc.ServerCredentials.createInsecure();
|
|
46
|
+
|
|
47
|
+
if(item.Get('secure'))
|
|
48
|
+
{
|
|
49
|
+
const cert = item.Get('cert') || {};
|
|
50
|
+
|
|
51
|
+
credentials = grpc.ServerCredentials.createSsl(cert.ca || null, [{
|
|
52
|
+
private_key: cert.key,
|
|
53
|
+
cert_chain: cert.cert
|
|
54
|
+
}], cert.checkClientCertificate || false);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
server.bindAsync(`${item.Get('host')}:${item.Get('port')}`, credentials, (error) =>
|
|
46
58
|
{
|
|
47
59
|
if(error)
|
|
48
60
|
{
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
transforms.Fn('runtime', function()
|
|
2
2
|
{
|
|
3
|
+
this.methods.pending = new WeakSet();
|
|
4
|
+
|
|
3
5
|
this.methods.process = (node) =>
|
|
4
6
|
{
|
|
5
7
|
const id = node.getAttribute('ot');
|
|
6
8
|
|
|
7
|
-
if(!id || node.hasAttribute('ot-init'))
|
|
9
|
+
if(!id || node.hasAttribute('ot-init') || this.methods.pending.has(node))
|
|
8
10
|
{
|
|
9
11
|
return;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
this.methods.pending.add(node);
|
|
13
15
|
transforms.Fn('run', id, node);
|
|
14
16
|
};
|
|
15
17
|
|
|
@@ -7,6 +7,13 @@ transforms.Fn('item.run', function(item, node, data = null)
|
|
|
7
7
|
|
|
8
8
|
item.Fn('load').then(() =>
|
|
9
9
|
{
|
|
10
|
+
if(!document.contains(node))
|
|
11
|
+
{
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
node.setAttribute('ot-init', '');
|
|
16
|
+
|
|
10
17
|
const context = {
|
|
11
18
|
scroll: { progress: 0, direction: 'down', speed: 0, top: 0, bottom: 0, visible: false },
|
|
12
19
|
hover: { active: false, x: 0, y: 0, offset: 0 },
|
package/lib/src/mixins/data.js
CHANGED
|
@@ -160,12 +160,32 @@ const OneTypeData =
|
|
|
160
160
|
{
|
|
161
161
|
if (value === undefined || value === null)
|
|
162
162
|
{
|
|
163
|
-
return defaultValue;
|
|
163
|
+
return this.DataCloneDefault(defaultValue);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
if (typeof value !== typeof defaultValue || Array.isArray(value) !== Array.isArray(defaultValue))
|
|
167
167
|
{
|
|
168
|
-
return defaultValue;
|
|
168
|
+
return this.DataCloneDefault(defaultValue);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return value;
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
DataCloneDefault(value)
|
|
175
|
+
{
|
|
176
|
+
if (value === null || value === undefined)
|
|
177
|
+
{
|
|
178
|
+
return value;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (Array.isArray(value))
|
|
182
|
+
{
|
|
183
|
+
return value.slice();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (typeof value === 'object')
|
|
187
|
+
{
|
|
188
|
+
return { ...value };
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
return value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onetype/framework",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.49",
|
|
4
4
|
"description": "OneType Framework — Full-stack isomorphic JavaScript framework built from scratch. One addon abstraction powers databases, servers, commands, pages, directives, queues, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/load.js",
|