coakka-v2-connector-electron 3.0.0 → 3.1.1
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/CONSUMING.md +9 -14
- package/README.md +18 -27
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/CONSUMING.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Consuming CoAkka Runtime Connector For Electron
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
## Version `3.1.1`
|
|
4
|
+
|
|
5
|
+
Electron `3.1.1` is the first Electron connector release on Core generation
|
|
6
|
+
`3.1`. It installs `coakka-v2-connector-node@3.1.2` as an exact dependency.
|
|
7
|
+
The Node connector includes Core 3.1 r2, build
|
|
8
|
+
`6789dd16210fc01f17cca4d2b66a592d1ac79121`, ABI 1, for macOS ARM64,
|
|
9
|
+
Linux ARM64/x64 and Windows ARM64/x64.
|
|
8
10
|
|
|
9
11
|
Use the package only from the Electron main process and preload boundary:
|
|
10
12
|
|
|
@@ -14,10 +16,8 @@ Use the package only from the Electron main process and preload boundary:
|
|
|
14
16
|
|
|
15
17
|
Do not import the runtime connector directly from renderer code.
|
|
16
18
|
|
|
17
|
-
Use Electron 42 or later and the
|
|
18
|
-
|
|
19
|
-
platforms; applications do not separately install private native dependencies.
|
|
20
|
-
Use a released package/platform combination from the compatibility matrix.
|
|
19
|
+
Use Electron 42 or later and let npm install the declared Node dependency
|
|
20
|
+
when you install the Electron connector.
|
|
21
21
|
|
|
22
22
|
Keep `contextIsolation: true`, `nodeIntegration: false` and `sandbox: true` on
|
|
23
23
|
the application window. Compile your preload source into one CommonJS file
|
|
@@ -49,11 +49,6 @@ input order and are not atomic: completed items are not rolled back on failure.
|
|
|
49
49
|
These intent limits belong to the Electron application boundary; they are
|
|
50
50
|
not a second native capability or configuration table.
|
|
51
51
|
|
|
52
|
-
The qualified Electron 42 package passes its installed main-process,
|
|
53
|
-
sandboxed renderer, File, Stream and shutdown gates on macOS ARM64, Linux
|
|
54
|
-
ARM64/x64 and Windows ARM64/x64. It consumes the exact Node archive selected
|
|
55
|
-
for the same version; registry availability is recorded in the current package ledger.
|
|
56
|
-
|
|
57
52
|
## Shutdown timing
|
|
58
53
|
|
|
59
54
|
Closing retires native work before releasing its resources. Host scheduling
|
package/README.md
CHANGED
|
@@ -18,9 +18,16 @@ to select an exact package and native platform tuple.
|
|
|
18
18
|
Start with the [CoAkka Documentation](https://github.com/phuong-tran/coakka-samples/blob/main/docs/README.md)
|
|
19
19
|
for concepts, integration paths, operations, and runnable samples.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
Use Electron 42 or later. The Electron main process owns the runtime. Preload
|
|
22
|
+
and renderer code use a small intent API over IPC.
|
|
23
|
+
|
|
24
|
+
## Version `3.1.1`
|
|
25
|
+
|
|
26
|
+
Electron `3.1.1` is the first Electron connector release on Core generation
|
|
27
|
+
`3.1`. Its exact dependency `coakka-v2-connector-node@3.1.2` includes Core
|
|
28
|
+
3.1 r2, build `6789dd16210fc01f17cca4d2b66a592d1ac79121`, ABI 1. npm installs
|
|
29
|
+
the Node dependency automatically. Its native images cover macOS ARM64,
|
|
30
|
+
Linux ARM64/x64 and Windows ARM64/x64.
|
|
24
31
|
|
|
25
32
|
## New To CoAkka
|
|
26
33
|
|
|
@@ -36,23 +43,14 @@ Use these public repositories to orient first:
|
|
|
36
43
|
| `coakka-samples` | Runnable examples and code you can inspect first. | https://github.com/phuong-tran/coakka-samples |
|
|
37
44
|
| `coakka-publish` | Released packages, native archives, manifests, checksums, compatibility matrix, and release notes. | https://github.com/phuong-tran/coakka-publish |
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
Install the connector with npm.
|
|
40
47
|
|
|
41
48
|
```sh
|
|
42
|
-
|
|
43
|
-
cd coakka-samples/coakka-runtime/electron/registry-basic
|
|
44
|
-
npm install
|
|
45
|
-
npm start
|
|
49
|
+
npm install coakka-v2-connector-electron@3.1.1
|
|
46
50
|
```
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
That smoke explains the runtime mental model first: keep real HTTP or IPC at
|
|
52
|
-
the app edge, but replace fake backend HTTP used only for work owned by the
|
|
53
|
-
same app or team with a CoAkka target and explicit reply/deadletter behavior.
|
|
54
|
-
|
|
55
|
-
The boundary is intentionally strict:
|
|
52
|
+
The following example routes an intent from a sandboxed window to a named
|
|
53
|
+
handler in the main process and returns the handler's reply to the renderer.
|
|
56
54
|
|
|
57
55
|
- renderer JavaScript sends an intent through `ipcRenderer.invoke`
|
|
58
56
|
- preload exposes only a small `coakka.intent(...)` API
|
|
@@ -176,16 +174,9 @@ process. It requires no host worker-pool tuning and does not allocate one worker
|
|
|
176
174
|
per ask. The Electron wrapper adds no second scheduler or response matcher;
|
|
177
175
|
Core still owns ticket matching, timeout/cancellation and completion notifications.
|
|
178
176
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
See [Consuming](CONSUMING.md) for package and renderer setup. Installed-package
|
|
184
|
-
tests exercise the minified main and bundled preload with the renderer sandbox
|
|
185
|
-
enabled; they do not substitute a source checkout for the packaged dependency.
|
|
186
|
-
|
|
187
|
-
Package metadata records the exact native generation, release channel, and
|
|
188
|
-
supported platform tuple. Contact: `gabrielgun1983@gmail.com`.
|
|
177
|
+
Read the bundled `CONSUMING.md` for preload and renderer setup. The
|
|
178
|
+
[current package ledger](https://github.com/phuong-tran/coakka-samples/blob/main/docs/common/current-packages.md)
|
|
179
|
+
records registry availability.
|
|
189
180
|
|
|
190
181
|
## File Lane
|
|
191
182
|
|
|
@@ -218,7 +209,7 @@ belong to Electron main; renderer code sends validated intent only.
|
|
|
218
209
|
|
|
219
210
|
Connector source, generated bindings, type declarations, examples, and package
|
|
220
211
|
documentation use the [Apache License, Version 2.0](https://github.com/phuong-tran/coakka-samples/blob/main/LICENSE).
|
|
221
|
-
|
|
212
|
+
Native Core files in the Node dependency use the [CoAkka Native Artifact License 1.2](https://github.com/phuong-tran/coakka-samples/blob/main/NATIVE-LICENSE.md).
|
|
222
213
|
Those native terms permit ordinary application and SaaS use but require a
|
|
223
214
|
separate agreement to sell or offer CoAkka itself as managed runtime or
|
|
224
215
|
infrastructure.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { EndpointFlag, RuntimeCapability, RuntimeNetworkMode, RuntimeTcpConnecti
|
|
|
6
6
|
* file paths and bearer grants never cross that boundary implicitly.
|
|
7
7
|
*/
|
|
8
8
|
export { FILE_LANE_DETAIL_MAX_BYTES, FILE_LANE_SHA256_BYTES, LANE_OWNER_GRANTS_FEATURE, FileLane, FileLaneError, FileLaneFlag, FileLaneSecurityMode, FileReceiveGrant, FileTransferDirection, FileTransferResult, FileTransferState, LaneOwnerGrantUnavailableError, STREAM_LANE_DETAIL_MAX_BYTES, STREAM_LANE_MAX_FRAME_BYTES, STREAM_LANE_MAX_WINDOW_BYTES, StreamConsumerDecision, StreamDirection, StreamFrameFlag, StreamLane, StreamLaneError, StreamLaneFlag, StreamLaneSecurityMode, StreamPublishGrant, StreamPressureReason, StreamPressureState, StreamResult, StreamSourceSignal, StreamState, type FileDigest, type FileLaneConfig, type FileLaneSecurityConfig, type FileLaneStats, type FileReceiveSpec, type FileSendSpec, type FileTransferSnapshot, type LaneOwnerConfig, type LaneOwnerEndpoint, type StreamConsumer, type StreamFrameMetadata, type StreamLaneConfig, type StreamLaneSecurityConfig, type StreamLaneStats, type StreamPressureSnapshot, type StreamPublishSpec, type StreamSessionSnapshot, type StreamSource, type StreamSourceFrame, type StreamSubscribeSpec, } from "coakka-v2-connector-node";
|
|
9
|
-
export declare const COAKKA_ELECTRON_CONNECTOR_VERSION = "3.
|
|
9
|
+
export declare const COAKKA_ELECTRON_CONNECTOR_VERSION = "3.1.1";
|
|
10
10
|
export declare const COAKKA_ELECTRON_INTENT_CHANNEL = "coakka:intent";
|
|
11
11
|
export declare const COAKKA_ELECTRON_INTENT_BATCH_CHANNEL = "coakka:intent-batch";
|
|
12
12
|
export interface ElectronIntentPayloadIdentity {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var S=Object.defineProperty;var a=(e,t)=>S(e,"name",{value:t,configurable:!0});import{DeliveryHint as w,NodeRuntimeClient as T,PayloadFormat as y,PayloadIdentity as f,RuntimeHost as I}from"coakka-v2-connector-node";import{EndpointFlag as z,RuntimeCapability as j,RuntimeNetworkMode as k,RuntimeTcpConnectionMode as B,RuntimeTcpSecurityMode as x,RuntimeTlsReloadMode as D,RouteStrategy as J,embeddedNetwork as V,localRoute as $,networkNode as v,outboundOnlyNetwork as K,supportsRuntimeCapabilities as U}from"coakka-v2-connector-node";import{FILE_LANE_DETAIL_MAX_BYTES as Y,FILE_LANE_SHA256_BYTES as G,LANE_OWNER_GRANTS_FEATURE as W,FileLane as Q,FileLaneError as Z,FileLaneFlag as ee,FileLaneSecurityMode as te,FileReceiveGrant as re,FileTransferDirection as ne,FileTransferResult as oe,FileTransferState as ae,LaneOwnerGrantUnavailableError as ie,STREAM_LANE_DETAIL_MAX_BYTES as se,STREAM_LANE_MAX_FRAME_BYTES as ue,STREAM_LANE_MAX_WINDOW_BYTES as le,StreamConsumerDecision as ce,StreamDirection as me,StreamFrameFlag as de,StreamLane as pe,StreamLaneError as he,StreamLaneFlag as ye,StreamLaneSecurityMode as fe,StreamPublishGrant as Ee,StreamPressureReason as Se,StreamPressureState as we,StreamResult as Te,StreamSourceSignal as Ie,StreamState as ge}from"coakka-v2-connector-node";var L="3.
|
|
1
|
+
var S=Object.defineProperty;var a=(e,t)=>S(e,"name",{value:t,configurable:!0});import{DeliveryHint as w,NodeRuntimeClient as T,PayloadFormat as y,PayloadIdentity as f,RuntimeHost as I}from"coakka-v2-connector-node";import{EndpointFlag as z,RuntimeCapability as j,RuntimeNetworkMode as k,RuntimeTcpConnectionMode as B,RuntimeTcpSecurityMode as x,RuntimeTlsReloadMode as D,RouteStrategy as J,embeddedNetwork as V,localRoute as $,networkNode as v,outboundOnlyNetwork as K,supportsRuntimeCapabilities as U}from"coakka-v2-connector-node";import{FILE_LANE_DETAIL_MAX_BYTES as Y,FILE_LANE_SHA256_BYTES as G,LANE_OWNER_GRANTS_FEATURE as W,FileLane as Q,FileLaneError as Z,FileLaneFlag as ee,FileLaneSecurityMode as te,FileReceiveGrant as re,FileTransferDirection as ne,FileTransferResult as oe,FileTransferState as ae,LaneOwnerGrantUnavailableError as ie,STREAM_LANE_DETAIL_MAX_BYTES as se,STREAM_LANE_MAX_FRAME_BYTES as ue,STREAM_LANE_MAX_WINDOW_BYTES as le,StreamConsumerDecision as ce,StreamDirection as me,StreamFrameFlag as de,StreamLane as pe,StreamLaneError as he,StreamLaneFlag as ye,StreamLaneSecurityMode as fe,StreamPublishGrant as Ee,StreamPressureReason as Se,StreamPressureState as we,StreamResult as Te,StreamSourceSignal as Ie,StreamState as ge}from"coakka-v2-connector-node";var L="3.1.1",g="coakka:intent",_="coakka:intent-batch",C=2e3,p=3e4,h=class e{static{a(this,"ElectronRuntimeIntentBridge")}runtimeHost;static start(t){let{runtimeLibPath:r,...n}=t;return new e(I.start(n,r))}handlers=new Map;closed=!1;closePromise=null;constructor(t){this.runtimeHost=t}registerJsonIntentHandler(t,r){this.requireOpen();let n=i(t,"target");if(typeof r!="function")throw new TypeError("Electron intent handler must be a function");this.runtimeHost.registerHandler(n,this.createRuntimeHandler(n),!0),this.handlers.set(n,r)}async handleIntent(t){this.requireOpen();let r=N(t),n=O(r.payloadIdentity),o=await this.runtimeHost.askTyped(r.source,r.target,Buffer.from(JSON.stringify(r.payload)),n,r.timeoutMs??C,r.operation,w.ROUTER_DEFAULT,r.headers??{}),s=new f(o.message_type,o.payload_schema_version,o.payload_format).requireTyped("Electron intent response");if(s.payloadFormat!==y.JSON)throw new Error("Electron intent response payloadFormat must be json");let u=m(JSON.parse(Buffer.from(o.payload).toString("utf8")),"response payload");return{intentId:r.intentId,source:r.source,target:r.target,operation:r.operation,payload:u,payloadIdentity:{messageType:s.messageType,payloadSchemaVersion:s.payloadSchemaVersion,payloadFormat:"json"}}}runtimeInfo(){return this.requireOpen(),this.runtimeHost.runtimeInfo()}connectorStats(){return this.requireOpen(),this.runtimeHost.clientStats()}runtimeStartupConfig(){return this.requireOpen(),this.runtimeHost.runtimeStartupConfig()}runtimeCapabilities(){return this.requireOpen(),this.runtimeHost.runtimeCapabilities()}tcpConnectionConfig(){return this.requireOpen(),this.runtimeHost.tcpConnectionConfig()}tcpSecurityInfo(){return this.requireOpen(),this.runtimeHost.tcpSecurityInfo()}applyTcpConnectionStrategy(t){return this.requireOpen(),this.runtimeHost.applyTcpConnectionStrategy(t)}applyTcpSecurity(t){return this.requireOpen(),this.runtimeHost.applyTcpSecurity(t)}close(){return this.closePromise!=null?this.closePromise:(this.closed=!0,this.handlers.clear(),this.closePromise=this.runtimeHost.close(),this.closePromise)}createRuntimeHandler(t){return async r=>{let n=this.handlers.get(t);if(n==null)throw new Error(`no Electron intent handler registered for target=${t}`);let o=m(JSON.parse(Buffer.from(r.payload).toString("utf8")),"request payload"),s=await n({intentId:r.message_id,source:r.source,target:t,operation:i(r.headers.operation,"request operation"),payload:o,payloadIdentity:{messageType:r.message_type,payloadSchemaVersion:r.payload_schema_version,payloadFormat:"json"},headers:r.headers});return T.makeJsonReplyFromRequestIdentity(r,t,m(s,"handler response payload"))}}requireOpen(){if(this.closed)throw new Error("Electron runtime intent bridge is closed")}};function P(e,t,r){let n=i(r.channel??g,"IPC channel"),o=i(r.batchChannel??_,"IPC batch channel");if(n===o)throw new Error("Electron intent and batch IPC channels must be distinct");if(typeof r.authorize!="function")throw new Error("Electron intent IPC registration requires an authorize policy");let s=t.runtimeStartupConfig().queueCapacity,u=r.maximumBatchSize??Math.min(s,64);if(!Number.isInteger(u)||u<1||u>s||u>256)throw new Error(`maximumBatchSize must be an integer in 1..${Math.min(s,256)}`);e.handle(n,async(c,l)=>{if(await r.authorize(c)!==!0)throw new Error("Electron intent IPC sender is not authorized");return t.handleIntent(l)});try{e.handle(o,async(c,l)=>{if(await r.authorize(c)!==!0)throw new Error("Electron intent IPC sender is not authorized");if(!Array.isArray(l)||l.length<1||l.length>u)throw new Error(`Electron intent batch must contain 1..${u} intents`);let d=[];for(let E of l)d.push(await t.handleIntent(E));return d})}catch(c){throw e.removeHandler(n),c}return()=>{e.removeHandler(n),e.removeHandler(o)}}a(P,"registerElectronIntentIpcHandler");function N(e){if(e==null||typeof e!="object")throw new Error("intent envelope is required");return{intentId:i(e.intentId,"intentId"),source:i(e.source,"source"),target:i(e.target,"target"),operation:i(e.operation,"operation"),payload:m(e.payload,"payload"),payloadIdentity:A(e.payloadIdentity),timeoutMs:R(e.timeoutMs),headers:b(e.headers)}}a(N,"normalizeIntent");function O(e){return new f(e.messageType,e.payloadSchemaVersion??1,y.JSON).requireTyped("Electron intent payloadIdentity")}a(O,"toPayloadIdentity");function A(e){if(e==null||typeof e!="object")throw new Error("payloadIdentity is required");if(e.payloadFormat!=null&&e.payloadFormat!=="json")throw new Error("payloadIdentity.payloadFormat must be json");let t=e.payloadSchemaVersion??1;if(!Number.isInteger(t)||t<1||t>4294967295)throw new Error("payloadIdentity.payloadSchemaVersion must be an integer in 1..4294967295");return{messageType:i(e.messageType,"payloadIdentity.messageType"),payloadSchemaVersion:t,payloadFormat:"json"}}a(A,"requirePayloadIdentity");function m(e,t){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be a JSON object`);return e}a(m,"requireJsonObject");function b(e){if(e==null)return{};let t=Object.create(null);for(let[r,n]of Object.entries(e)){let o=i(r,"header key");if(["method","operation"].includes(o.toLowerCase()))throw new Error(`headers.${o} is reserved by the intent envelope`);if(typeof n!="string")throw new Error(`headers.${o} must be a string`);t[o]=n}return t}a(b,"normalizeHeaders");function R(e){if(e!=null){if(!Number.isInteger(e)||e<1||e>p)throw new Error(`timeoutMs must be an integer in 1..${p}`);return e}}a(R,"normalizeTimeout");function i(e,t){if(typeof e!="string"||e.trim()==="")throw new Error(`${t} is required`);return e}a(i,"requireNonBlank");export{L as COAKKA_ELECTRON_CONNECTOR_VERSION,_ as COAKKA_ELECTRON_INTENT_BATCH_CHANNEL,g as COAKKA_ELECTRON_INTENT_CHANNEL,h as ElectronRuntimeIntentBridge,z as EndpointFlag,Y as FILE_LANE_DETAIL_MAX_BYTES,G as FILE_LANE_SHA256_BYTES,Q as FileLane,Z as FileLaneError,ee as FileLaneFlag,te as FileLaneSecurityMode,re as FileReceiveGrant,ne as FileTransferDirection,oe as FileTransferResult,ae as FileTransferState,W as LANE_OWNER_GRANTS_FEATURE,ie as LaneOwnerGrantUnavailableError,J as RouteStrategy,j as RuntimeCapability,k as RuntimeNetworkMode,B as RuntimeTcpConnectionMode,x as RuntimeTcpSecurityMode,D as RuntimeTlsReloadMode,se as STREAM_LANE_DETAIL_MAX_BYTES,ue as STREAM_LANE_MAX_FRAME_BYTES,le as STREAM_LANE_MAX_WINDOW_BYTES,ce as StreamConsumerDecision,me as StreamDirection,de as StreamFrameFlag,pe as StreamLane,he as StreamLaneError,ye as StreamLaneFlag,fe as StreamLaneSecurityMode,Se as StreamPressureReason,we as StreamPressureState,Ee as StreamPublishGrant,Te as StreamResult,Ie as StreamSourceSignal,ge as StreamState,V as embeddedNetwork,$ as localRoute,v as networkNode,K as outboundOnlyNetwork,P as registerElectronIntentIpcHandler,U as supportsRuntimeCapabilities};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coakka-v2-connector-electron",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Electron connector for CoAkka Runtime, a native-backed polyglot distributed runtime for application-owned work",
|
|
5
5
|
"license": "SEE LICENSE IN PACKAGE-LICENSE.md",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/phuong-tran/coakka-publish.git"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://github.com/phuong-tran/coakka-samples/tree/
|
|
10
|
+
"homepage": "https://github.com/phuong-tran/coakka-samples/tree/main/docs/coakka-runtime",
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/phuong-tran/coakka-samples/issues"
|
|
13
13
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"README.md"
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"coakka-v2-connector-node": "3.
|
|
54
|
+
"coakka-v2-connector-node": "3.1.2"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"electron": ">=42"
|