corba.js 0.0.12 → 0.1.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 +70 -83
- package/README.IDL.txt +285 -0
- package/README.md +67 -39
- package/bin/corba-idl +15 -2
- package/lib/idl/idl.cjs +2732 -0
- package/lib/idl/idl.cjs.map +1 -0
- package/lib/idl/src/idl/idl-lexer.d.ts +19 -0
- package/lib/idl/src/idl/idl-node.d.ts +101 -0
- package/lib/idl/src/idl/idl-parser.d.ts +3 -0
- package/lib/idl/src/idl/idl.d.ts +1 -0
- package/lib/idl/src/idl/util.d.ts +25 -0
- package/lib/idl/src/idl/write-interface.d.ts +2 -0
- package/lib/idl/src/idl/write-skeleton.d.ts +2 -0
- package/lib/idl/src/idl/write-stub.d.ts +2 -0
- package/lib/idl/src/idl/write-value.d.ts +2 -0
- package/lib/idl/src/idl/write-valueimpl.d.ts +2 -0
- package/lib/idl/src/idl/write-valuetype.d.ts +2 -0
- package/lib/idl/src/index.d.ts +5 -0
- package/lib/idl/src/net/browser.d.ts +7 -0
- package/lib/idl/src/net/index.d.ts +3 -0
- package/lib/idl/src/net/tcp.d.ts +11 -0
- package/lib/idl/src/net/tls.d.ts +24 -0
- package/lib/idl/src/net/ws.d.ts +42 -0
- package/lib/idl/src/orb/asn1.d.ts +48 -0
- package/lib/idl/src/orb/connection.d.ts +24 -0
- package/lib/idl/src/orb/giop.d.ts +273 -0
- package/lib/idl/src/orb/index.d.ts +3 -0
- package/lib/idl/src/orb/ior.d.ts +89 -0
- package/lib/idl/src/orb/orb.d.ts +143 -0
- package/lib/idl/src/orb/protocol.d.ts +6 -0
- package/lib/idl/src/orb/uint8map.d.ts +14 -0
- package/lib/idl/src/orb/url.d.ts +55 -0
- package/lib/idl/test/access.spec.d.ts +1 -0
- package/lib/idl/test/attribute.spec.d.ts +1 -0
- package/lib/idl/test/basics.spec.d.ts +1 -0
- package/lib/idl/test/disconnect.spec.d.ts +1 -0
- package/lib/idl/test/eventtarget.spec.d.ts +1 -0
- package/lib/idl/test/fake.d.ts +31 -0
- package/lib/idl/test/giop.spec.d.ts +1 -0
- package/lib/idl/test/idl/idl.spec.d.ts +1 -0
- package/lib/idl/test/idl_module.spec.d.ts +1 -0
- package/lib/idl/test/initialreferences.spec.d.ts +1 -0
- package/lib/idl/test/net/tls.spec.d.ts +1 -0
- package/lib/idl/test/net/ws.spec.d.ts +1 -0
- package/lib/idl/test/net/wss.spec.d.ts +1 -0
- package/lib/idl/test/object_by_reference.spec.d.ts +1 -0
- package/lib/idl/test/orb/asn1.spec.d.ts +1 -0
- package/lib/idl/test/orb/url.spec.d.ts +1 -0
- package/lib/idl/test/stub.spec.d.ts +1 -0
- package/lib/idl/test/util.d.ts +5 -0
- package/lib/idl/test/valuetype.spec.d.ts +1 -0
- package/lib/{idl → src/idl}/idl-lexer.d.ts +0 -0
- package/lib/src/idl/idl-lexer.js +234 -0
- package/lib/src/idl/idl-lexer.js.map +1 -0
- package/lib/{idl → src/idl}/idl-node.d.ts +13 -10
- package/lib/{idl → src/idl}/idl-node.js +30 -49
- package/lib/src/idl/idl-node.js.map +1 -0
- package/lib/{idl → src/idl}/idl-parser.d.ts +0 -0
- package/lib/{idl → src/idl}/idl-parser.js +367 -291
- package/lib/src/idl/idl-parser.js.map +1 -0
- package/lib/{idl → src/idl}/idl.d.ts +0 -0
- package/lib/src/idl/idl.js +180 -0
- package/lib/src/idl/idl.js.map +1 -0
- package/lib/src/idl/util.d.ts +25 -0
- package/lib/src/idl/util.js +239 -0
- package/lib/src/idl/util.js.map +1 -0
- package/lib/src/idl/write-interface.d.ts +2 -0
- package/lib/src/idl/write-interface.js +111 -0
- package/lib/src/idl/write-interface.js.map +1 -0
- package/lib/src/idl/write-skeleton.d.ts +2 -0
- package/lib/src/idl/write-skeleton.js +116 -0
- package/lib/src/idl/write-skeleton.js.map +1 -0
- package/lib/src/idl/write-stub.d.ts +2 -0
- package/lib/src/idl/write-stub.js +116 -0
- package/lib/src/idl/write-stub.js.map +1 -0
- package/lib/src/idl/write-value.d.ts +2 -0
- package/lib/src/idl/write-value.js +205 -0
- package/lib/src/idl/write-value.js.map +1 -0
- package/lib/src/idl/write-valueimpl.d.ts +2 -0
- package/lib/src/idl/write-valueimpl.js +158 -0
- package/lib/src/idl/write-valueimpl.js.map +1 -0
- package/lib/src/idl/write-valuetype.d.ts +2 -0
- package/lib/src/idl/write-valuetype.js +98 -0
- package/lib/src/idl/write-valuetype.js.map +1 -0
- package/lib/src/index.d.ts +5 -0
- package/lib/src/index.js +6 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/net/browser.d.ts +7 -0
- package/lib/src/net/browser.js +54 -0
- package/lib/src/net/browser.js.map +1 -0
- package/lib/src/net/index.d.ts +3 -0
- package/lib/src/net/index.js +4 -0
- package/lib/src/net/index.js.map +1 -0
- package/lib/src/net/tcp.d.ts +11 -0
- package/lib/src/net/tcp.js +66 -0
- package/lib/src/net/tcp.js.map +1 -0
- package/lib/src/net/tls.d.ts +24 -0
- package/lib/src/net/tls.js +69 -0
- package/lib/src/net/tls.js.map +1 -0
- package/lib/src/net/ws.d.ts +42 -0
- package/lib/src/net/ws.js +158 -0
- package/lib/src/net/ws.js.map +1 -0
- package/lib/src/orb/asn1.d.ts +48 -0
- package/lib/src/orb/asn1.js +60 -0
- package/lib/src/orb/asn1.js.map +1 -0
- package/lib/src/orb/connection.d.ts +24 -0
- package/lib/src/orb/connection.js +19 -0
- package/lib/src/orb/connection.js.map +1 -0
- package/lib/src/orb/giop.d.ts +273 -0
- package/lib/src/orb/giop.js +1160 -0
- package/lib/src/orb/giop.js.map +1 -0
- package/lib/src/orb/index.d.ts +3 -0
- package/lib/src/orb/index.js +4 -0
- package/lib/src/orb/index.js.map +1 -0
- package/lib/src/orb/ior.d.ts +89 -0
- package/lib/src/orb/ior.js +110 -0
- package/lib/src/orb/ior.js.map +1 -0
- package/lib/src/orb/orb.d.ts +143 -0
- package/lib/src/orb/orb.js +693 -0
- package/lib/src/orb/orb.js.map +1 -0
- package/lib/src/orb/protocol.d.ts +6 -0
- package/lib/src/orb/protocol.js +2 -0
- package/lib/src/orb/protocol.js.map +1 -0
- package/lib/src/orb/uint8map.d.ts +14 -0
- package/lib/src/orb/uint8map.js +48 -0
- package/lib/src/orb/uint8map.js.map +1 -0
- package/lib/src/orb/url.d.ts +55 -0
- package/lib/src/orb/url.js +252 -0
- package/lib/src/orb/url.js.map +1 -0
- package/package.json +48 -24
- package/lib/idl/idl-lexer.js +0 -257
- package/lib/idl/idl-lexer.js.map +0 -1
- package/lib/idl/idl-node.js.map +0 -1
- package/lib/idl/idl-parser.js.map +0 -1
- package/lib/idl/idl.js +0 -946
- package/lib/idl/idl.js.map +0 -1
- package/lib/orb/orb-nodejs.d.ts +0 -7
- package/lib/orb/orb-nodejs.js +0 -111
- package/lib/orb/orb-nodejs.js.map +0 -1
- package/lib/orb/orb.d.ts +0 -62
- package/lib/orb/orb.js +0 -514
- package/lib/orb/orb.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,46 +1,69 @@
|
|
|
1
1
|
# corba.js
|
|
2
2
|
|
|
3
3
|
Welcome to corba.js, an Object Request Broker (ORB) and Interface Definition
|
|
4
|
-
Language (IDL) compiler
|
|
5
|
-
specification.
|
|
4
|
+
Language (IDL) compiler for TypeScript lousily based on the CORBA specification. (ISO/IEC 19500)
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
http://www.corba.org/
|
|
6
|
+
_CORBA is a registered trademark by the Object Management Group. http://www.corba.org/_
|
|
9
7
|
|
|
10
|
-
##
|
|
8
|
+
## What does it do?
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
programming languages being used.
|
|
15
|
-
* After CORBA became more and more complicated through design by committee, CORBA was replaced by SOAP.
|
|
16
|
-
* After SOAP became more and more complicated, SOAP was replaced by REST.
|
|
17
|
-
* With the advent of WebApps and WebSockets, CORBA became feasible again.
|
|
10
|
+
CORBA helps to hide the split of modern WebApps into frontend and backend by making
|
|
11
|
+
remote objects appear like local objects.
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
For this objects, exceptions and data structures (aka DTOs), which need to bridge the
|
|
14
|
+
network, are described in the Interface Definition Language (IDL), which is then
|
|
15
|
+
compiled into code to be used in the application.
|
|
16
|
+
|
|
17
|
+
Data structures can even be pointer based ones like trees or cyclic graphs.
|
|
18
|
+
|
|
19
|
+
Frontend and backend can connect via WebSockets to carry CORBA's binary
|
|
20
|
+
GIOP protocol. In the future there will be also support for WebRTC and/or HTTP/3's
|
|
21
|
+
WebTransport, where the IDL's `oneway` keyword can make use of the unreliable
|
|
22
|
+
transport provided by these UDP based protocols.
|
|
23
|
+
|
|
24
|
+
## What does it not do?
|
|
25
|
+
|
|
26
|
+
CORBA's goal is to make frontend and backend look like one application, which implies tight coupling. Microservices on the other hand are intended to be loosely coupled.
|
|
27
|
+
Here a protocol like REST+JSON, 0MQ+MessagePack, etc. can be a better solution.
|
|
28
|
+
|
|
29
|
+
See also: [REST, SOAP, and CORBA, i.e. How We Got Here](https://greglturnquist.com/2016/05/03/rest-soap-corba-e-got/).
|
|
30
|
+
|
|
31
|
+
## Why?
|
|
32
|
+
|
|
33
|
+
corba.js is written to be used in [workflow](https://github.com/markandre13/workflow#readme) where it handles
|
|
34
|
+
|
|
35
|
+
* the communication between frontend and backend
|
|
36
|
+
* persisting objects to the database
|
|
37
|
+
* persisting objects to files (using CORBA's binary encoding GIOP)
|
|
38
|
+
|
|
39
|
+
In the 90ties CORBA was quite the hype but design-by-committee made it bloated, slow
|
|
40
|
+
and no fun to use. (See [The Rise and Fall of CORBA](https://queue.acm.org/detail.cfm?id=1142044) and [What's Wrong With CORBA](https://wiki.c2.com/?WhatsWrongWithCorba).)
|
|
41
|
+
|
|
42
|
+
Still, stripped to it's core, one finds a fast and lightweight system, which made it ideal for modern WebApps. This might be in part attributed to CORBA's roots in the experimental object oriented [Spring](https://en.wikipedia.org/wiki/Spring_(operating_system)) operating system and some sole individuals undermining the design-by-committee with their expertise. 😁
|
|
43
|
+
|
|
44
|
+
Around 2004 a group developers previously involed with CORBA and the OMG presented a much improved successor of CORBA, the [Internet Communications Engine](https://zeroc.com/products/ice) (ICE), which is also available for JavaScript/TypeScript under the GNU GPLv2.
|
|
45
|
+
|
|
46
|
+
Around 2012, CERN switched from CORBA to [0MQ](https://en.wikipedia.org/wiki/ZeroMQ) and a custom serializer.
|
|
24
47
|
|
|
25
48
|
## Interfaces
|
|
26
49
|
|
|
27
50
|
In the following example, a server will provide an object of type _Server_ and
|
|
28
51
|
the clients an object of type _Client_, which are to be defined in an IDL file:
|
|
29
|
-
```
|
|
52
|
+
```java
|
|
30
53
|
interface Client {
|
|
31
|
-
oneway printMessage(in string message);
|
|
54
|
+
oneway void printMessage(in string message);
|
|
32
55
|
}
|
|
33
56
|
|
|
34
57
|
interface Server {
|
|
35
|
-
oneway registerClient(in Client client);
|
|
58
|
+
oneway void registerClient(in Client client);
|
|
36
59
|
double add(in double a, in double b);
|
|
37
60
|
}
|
|
38
61
|
```
|
|
39
62
|
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
(
|
|
63
|
+
* `oneway` means that the client expects no confirmation that the call has
|
|
64
|
+
reached it's destination.
|
|
65
|
+
* `in` specifies that the argument will not be written into to return data.
|
|
66
|
+
(`out` and `inout` are not implemented by corba.js)
|
|
44
67
|
|
|
45
68
|
For each interface, the IDL compiler will generate stub and skeleton
|
|
46
69
|
classes:
|
|
@@ -139,10 +162,14 @@ Note to self: The narrow() is a classic CORBA function, but I guess we could red
|
|
|
139
162
|
|
|
140
163
|
## Security Model
|
|
141
164
|
|
|
142
|
-
corba.js
|
|
143
|
-
SSL/TLS and by restricting access to objects to
|
|
165
|
+
corba.js 0.0.x did not implement CORBA's security model and instead relies on
|
|
166
|
+
SSL/TLS and by restricting access to objects made public to the peer.
|
|
167
|
+
|
|
168
|
+
corba.js 0.1.x uses CORBA's IIOP protocol currently provides only
|
|
169
|
+
SSL/TLS and password login but no means to restrict access to individual
|
|
170
|
+
objects.
|
|
144
171
|
|
|
145
|
-
|
|
172
|
+
## Bind/Resolve
|
|
146
173
|
|
|
147
174
|
Ie. in the example above the side which provided the implementation
|
|
148
175
|
made the object publicly accessible via
|
|
@@ -152,7 +179,9 @@ made the object publicly accessible via
|
|
|
152
179
|
```
|
|
153
180
|
and the side using the remote object gained access to it via
|
|
154
181
|
```javascript
|
|
155
|
-
|
|
182
|
+
const server = stub.Server.narrow(
|
|
183
|
+
await orb.stringToObject("corbaname::localhost:2809#MyServer")
|
|
184
|
+
)
|
|
156
185
|
```
|
|
157
186
|
### Objects passed by reference
|
|
158
187
|
|
|
@@ -168,20 +197,20 @@ Any further access control must be dealt with by the application.
|
|
|
168
197
|
|
|
169
198
|
The IDL compiler represents IDL types as follows in TypeScript
|
|
170
199
|
|
|
171
|
-
IDL Type
|
|
172
|
-
|
|
173
|
-
boolean
|
|
174
|
-
|
|
175
|
-
string
|
|
176
|
-
sequence<T>
|
|
177
|
-
interface T
|
|
200
|
+
IDL Type | TypeScript Type
|
|
201
|
+
-------------------------------- | ---------------
|
|
202
|
+
boolean | boolean
|
|
203
|
+
octet, short, long float, double | number
|
|
204
|
+
char, string | string
|
|
205
|
+
sequence<T> | Array<T>
|
|
206
|
+
interface T | skel.T, stub.T
|
|
178
207
|
|
|
179
208
|
While IDL interfaces are used to provide communication between objects
|
|
180
209
|
registered at different ORBs, valuetypes can be used to exchange data
|
|
181
210
|
between them. When used as arguments in methods, CORBA will serialize
|
|
182
211
|
and deserialize them based on their IDL description:
|
|
183
212
|
|
|
184
|
-
```
|
|
213
|
+
```java
|
|
185
214
|
valuetype Point {
|
|
186
215
|
public double x, y;
|
|
187
216
|
};
|
|
@@ -240,7 +269,7 @@ instantiate the registered implementation of the class.
|
|
|
240
269
|
Methods in valuetypes may also use types which are not to be meant to
|
|
241
270
|
be exchanged between ORBs. These can be declared as 'native':
|
|
242
271
|
|
|
243
|
-
```
|
|
272
|
+
```java
|
|
244
273
|
native Path;
|
|
245
274
|
|
|
246
275
|
valuetype Figure {
|
|
@@ -249,10 +278,9 @@ be exchanged between ORBs. These can be declared as 'native':
|
|
|
249
278
|
}
|
|
250
279
|
```
|
|
251
280
|
|
|
252
|
-
|
|
281
|
+
_NOTE: corba.js does not implement CORBA's capability to handle pointers, ie. when
|
|
253
282
|
two objects are referencing the same object, two instances of the object will be
|
|
254
|
-
created on the other side instead of one.
|
|
255
|
-
of the Workflow App, it might be implemented for corba.js in the future.
|
|
283
|
+
created on the other side instead of one. This is going to change with the implementation of CORBA's binary encoding GIOP._
|
|
256
284
|
|
|
257
285
|
## IDL
|
|
258
286
|
|
package/bin/corba-idl
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
#!/
|
|
2
|
-
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
tryrun() {
|
|
4
|
+
if test -f "$1" ; then
|
|
5
|
+
exec /usr/bin/env node --enable-source-maps -- $*
|
|
6
|
+
fi
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
tryrun "${0%/*}/../lib/idl/idl.cjs" $*
|
|
10
|
+
tryrun "${0%/*}/../corba.js/lib/idl/idl.cjs" $*
|
|
11
|
+
|
|
12
|
+
echo "${0%/*}"
|
|
13
|
+
|
|
14
|
+
echo "$0: internal error; couldn't find idl.cjs" 1>&2
|
|
15
|
+
exit 1
|