corba.js 0.1.16 → 0.1.18
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 +3 -3
- package/lib/idl/idl.cjs +27 -11
- package/lib/idl/idl.cjs.map +1 -1
- package/lib/src/idl/cc/write-code.js +12 -1
- package/lib/src/idl/cc/write-code.js.map +1 -1
- package/lib/src/idl/ts/typeIDLtoTS.js +10 -5
- package/lib/src/idl/ts/typeIDLtoTS.js.map +1 -1
- package/lib/src/idl/ts/write-skeleton.js +1 -1
- package/lib/src/idl/ts/write-skeleton.js.map +1 -1
- package/lib/src/idl/ts/write-stub.js +4 -4
- package/lib/src/idl/ts/write-stub.js.map +1 -1
- package/lib/src/orb/giop.js +29 -10
- package/lib/src/orb/giop.js.map +1 -1
- package/lib/src/orb/orb.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -306,10 +306,10 @@ JSON to be lightweight and efficient with some inspiration from JSON-RPC and EJS
|
|
|
306
306
|
|
|
307
307
|
All build stages are setup to run in watch mode for performance reasons.
|
|
308
308
|
|
|
309
|
-
* I ususally run `npm dev:build` in Visual Studio Code's terminal window to
|
|
309
|
+
* I ususally run `npm run dev:build` in Visual Studio Code's terminal window to
|
|
310
310
|
be able to jump from compiler errors directly into the source code.
|
|
311
311
|
|
|
312
|
-
* `npm dev:test` runs all tests in watch mode.
|
|
312
|
+
* `npm run dev:test` runs all tests in watch mode.
|
|
313
313
|
|
|
314
|
-
* `npm dev:test --file=lib/test/valuetype.spec.js` runs a single test file
|
|
314
|
+
* `npm run dev:test --file=lib/test/valuetype.spec.js` runs a single test file
|
|
315
315
|
in watch mode.
|
package/lib/idl/idl.cjs
CHANGED
|
@@ -1698,23 +1698,28 @@ function typeIDLtoTS(type, filetype = FileType.NONE) {
|
|
|
1698
1698
|
let name;
|
|
1699
1699
|
switch (identifierType.type) {
|
|
1700
1700
|
case Type.TKN_VALUETYPE:
|
|
1701
|
-
if (filetype !== FileType.VALUETYPE && filetype !== FileType.VALUE)
|
|
1701
|
+
if (filetype !== FileType.VALUETYPE && filetype !== FileType.VALUE) {
|
|
1702
1702
|
name = `valuetype${absolutePrefix}.${relativeName}`;
|
|
1703
|
-
|
|
1703
|
+
}
|
|
1704
|
+
else {
|
|
1704
1705
|
name = absolutePrefix.length == 0 ? relativeName : `${absolutePrefix.substring(1)}.${relativeName}`;
|
|
1706
|
+
}
|
|
1705
1707
|
break;
|
|
1706
1708
|
case Type.SYN_INTERFACE:
|
|
1707
1709
|
case Type.TKN_ENUM:
|
|
1708
1710
|
case Type.TKN_UNION:
|
|
1709
|
-
if (filetype !== FileType.INTERFACE)
|
|
1711
|
+
if (filetype !== FileType.INTERFACE) {
|
|
1710
1712
|
name = `_interface${absolutePrefix}.${relativeName}`;
|
|
1711
|
-
|
|
1713
|
+
}
|
|
1714
|
+
else {
|
|
1712
1715
|
name = absolutePrefix.length == 0 ? relativeName : `${absolutePrefix.substring(1)}.${relativeName}`;
|
|
1716
|
+
}
|
|
1713
1717
|
break;
|
|
1714
1718
|
case Type.TKN_STRUCT:
|
|
1715
1719
|
name = type.text;
|
|
1716
|
-
if (filetype !== FileType.INTERFACE)
|
|
1720
|
+
if (filetype !== FileType.INTERFACE) {
|
|
1717
1721
|
name = `_interface${absolutePrefix}.${name}`;
|
|
1722
|
+
}
|
|
1718
1723
|
break;
|
|
1719
1724
|
case Type.TKN_NATIVE:
|
|
1720
1725
|
name = absolutePrefix.length == 0 ? relativeName : `${absolutePrefix.substring(1)}.${relativeName}`;
|
|
@@ -2265,7 +2270,7 @@ function writeTSSkeletonDefinitions(out, specification, prefix = "", indent = 0)
|
|
|
2265
2270
|
const readonly = _export.child[0]?.type == Type.TKN_READONLY;
|
|
2266
2271
|
const param_type_spec = _export.child[1];
|
|
2267
2272
|
const attr_declarator = _export.child[2];
|
|
2268
|
-
const type = typeIDLtoTS(param_type_spec, FileType.
|
|
2273
|
+
const type = typeIDLtoTS(param_type_spec, FileType.SKELETON);
|
|
2269
2274
|
for (const n of attr_declarator.child) {
|
|
2270
2275
|
const identifier = n.text;
|
|
2271
2276
|
out.write(` abstract ${identifier}(): Promise<${type}>\n`);
|
|
@@ -2398,12 +2403,12 @@ function writeTSStubDefinitions(out, specification, prefix = "", indent = 0) {
|
|
|
2398
2403
|
const attr_declarator = _export.child[2];
|
|
2399
2404
|
for (const n of attr_declarator.child) {
|
|
2400
2405
|
const identifier = n.text;
|
|
2401
|
-
const type = typeIDLtoTS(param_type_spec, FileType.
|
|
2406
|
+
const type = typeIDLtoTS(param_type_spec, FileType.STUB);
|
|
2402
2407
|
if (readonly) {
|
|
2403
2408
|
out.write(` async ${identifier}(): Promise<${type}> {\n`);
|
|
2404
2409
|
out.write(` return this._orb.twowayCall(this, "_get_${identifier}",\n`);
|
|
2405
2410
|
out.write(` (encoder) => { },\n`);
|
|
2406
|
-
out.write(` (decoder) =>
|
|
2411
|
+
out.write(` (decoder) => ${typeIDLtoGIOPTS(param_type_spec)}\n`);
|
|
2407
2412
|
out.write(` )\n`);
|
|
2408
2413
|
out.write(` }\n`);
|
|
2409
2414
|
}
|
|
@@ -2414,11 +2419,11 @@ function writeTSStubDefinitions(out, specification, prefix = "", indent = 0) {
|
|
|
2414
2419
|
out.write(` if (value === undefined) {\n`);
|
|
2415
2420
|
out.write(` return this._orb.twowayCall(this, "_get_${identifier}",\n`);
|
|
2416
2421
|
out.write(` (encoder) => { },\n`);
|
|
2417
|
-
out.write(` (decoder) =>
|
|
2422
|
+
out.write(` (decoder) => ${typeIDLtoGIOPTS(param_type_spec)}\n`);
|
|
2418
2423
|
out.write(` )\n`);
|
|
2419
2424
|
out.write(` } else {\n`);
|
|
2420
2425
|
out.write(` return this._orb.twowayCall(this, "_set_${identifier}",\n`);
|
|
2421
|
-
out.write(` (encoder) => {
|
|
2426
|
+
out.write(` (encoder) => {${typeIDLtoGIOPTS(param_type_spec, "value")} },\n`);
|
|
2422
2427
|
out.write(` (decoder) => { }\n`);
|
|
2423
2428
|
out.write(` )\n`);
|
|
2424
2429
|
out.write(` }\n`);
|
|
@@ -3730,8 +3735,19 @@ function writeCCCodeDefinitions(out, specification, prefix = "", indent = 0) {
|
|
|
3730
3735
|
out.write(` return std::shared_ptr<${if_identifier}>();\n`);
|
|
3731
3736
|
out.write(` }\n`);
|
|
3732
3737
|
out.write(` std::shared_ptr<CORBA::ORB> orb = ref->get_ORB();\n`);
|
|
3738
|
+
out.write(` auto servant = orb->_narrow_servant(ref);\n`);
|
|
3739
|
+
out.write(` if (servant) {\n`);
|
|
3740
|
+
out.write(` auto impl = std::dynamic_pointer_cast<${if_identifier}>(servant);\n`);
|
|
3741
|
+
out.write(` if (impl) {\n`);
|
|
3742
|
+
out.write(` return impl;\n`);
|
|
3743
|
+
out.write(` }\n`);
|
|
3744
|
+
out.write(` }\n`);
|
|
3733
3745
|
out.write(` auto conn = orb->getConnection(ref->host, ref->port);\n`);
|
|
3734
|
-
out.write(` auto stub =
|
|
3746
|
+
out.write(` auto stub = conn->stubsById[ref->objectKey];\n`);
|
|
3747
|
+
out.write(` if (!stub) {\n`);
|
|
3748
|
+
out.write(` stub = std::make_shared<${if_identifier}_stub>(orb, CORBA::blob_view(ref->objectKey), conn);\n`);
|
|
3749
|
+
out.write(` conn->stubsById[ref->objectKey] = stub;\n`);
|
|
3750
|
+
out.write(` }\n`);
|
|
3735
3751
|
out.write(` return std::dynamic_pointer_cast<${if_identifier}>(stub);\n`);
|
|
3736
3752
|
out.write(` }\n`);
|
|
3737
3753
|
out.write(` auto obj = dynamic_cast<${if_identifier}*>(ptr);\n`);
|