Replace RPC-to-string adapters and processCoreRequestMessage (~470 lines) with
typed handlers in core-swarm-handlers.js. Autopass invite wire now uses
invite.deliver RPC only; p2ns.core-invite protomux channel is removed.
- Add core-rpc-contract.js (METHODS, INVITE_STATUS) and core-swarm-handlers.js
with shared processInviteWire for deliver, relay, and pairing
- core-rpc.js: deliverInviteWire via invite.deliver; invite.request returns
{ status, reason, inviteId }; invite.ack carries optional inviteId
- p2ns.js: register native handlers; slim p2ns.core-request (lifecycle only);
proactive invite ack tracks inviteId; fix missing invite.queued handler
- proxy-server: channel-manager + shared handlers (no p2ns.core-invite strings)
- Tests: core-swarm-handlers.test.js, core-invite-rpc-integration.js; extend test:core-rpc
- Docs: PLUGIN_SDK RPC table; consensus.removeDomain in longform/RESTAPI/glossary
35 lines
1.6 KiB
JavaScript
35 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Integration checks for core RPC invite cutover (static / optional live).
|
|
* Run: node test-scripts/core-invite-rpc-integration.js
|
|
* Live multi-peer: CORE_INVITE_INTEGRATION_LIVE=1 node test-scripts/core-invite-rpc-integration.js
|
|
*/
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
function staticChecks() {
|
|
const p2ns = fs.readFileSync(path.join(__dirname, '../p2ns.js'), 'utf8');
|
|
const coreRpc = fs.readFileSync(path.join(__dirname, '../includes/core/core-rpc.js'), 'utf8');
|
|
const handlers = fs.readFileSync(path.join(__dirname, '../includes/core/core-swarm-handlers.js'), 'utf8');
|
|
|
|
assert.ok(handlers.includes('onInviteDeliver'), 'handlers must implement onInviteDeliver');
|
|
assert.ok(coreRpc.includes('INVITE_DELIVER'), 'core-rpc must expose invite.deliver');
|
|
assert.ok(coreRpc.includes('rpcEvent') && coreRpc.includes('inviteWire'), 'deliverInviteWire uses RPC');
|
|
assert.ok(!p2ns.includes('processCoreRequestMessage'));
|
|
assert.ok(!p2ns.includes('relay_invite_request:'));
|
|
|
|
const proxy = fs.readFileSync(path.join(__dirname, '../proxy-server/p2ns_proxy_server.js'), 'utf8');
|
|
assert.ok(!proxy.includes('p2ns.core-invite'), 'proxy must not use legacy invite channel');
|
|
assert.ok(proxy.includes('createCoreSwarmHandlers'));
|
|
}
|
|
|
|
staticChecks();
|
|
|
|
if (process.env.CORE_INVITE_INTEGRATION_LIVE === '1') {
|
|
console.log('core-invite-rpc-integration: live mode not automated in CI — run two-node manual test');
|
|
} else {
|
|
console.log('core-invite-rpc-integration: static checks ok (set CORE_INVITE_INTEGRATION_LIVE=1 for live hint)');
|
|
}
|