Take one down, patch it around,

127 little bug in the code...
This commit is contained in:
Pavel Murygin
2023-02-08 01:47:35 +04:00
parent b84336a92d
commit ba0ed1be72
67 changed files with 290 additions and 204 deletions

View File

@ -29,8 +29,8 @@
"repository": "https://github.com/fluencelabs/fluence-js",
"author": "Fluence Labs",
"license": "Apache-2.0",
"dependencies": {},
"devDependencies": {
"@fluencelabs/js-peer": "workspace:*"
}
"dependencies": {
"@fluencelabs/interface": "workspace:*"
},
"devDependencies": {}
}

View File

@ -14,15 +14,13 @@
* limitations under the License.
*/
import { IFluencePeer, isFluencePeer } from '@fluencelabs/js-peer/dist/interfaces/index';
import { FnConfig, FunctionCallDef, ServiceDef } from '@fluencelabs/js-peer/dist/js-peer/compilerSupport/interface';
import { registerServiceImpl } from '@fluencelabs/js-peer/dist/js-peer/compilerSupport/registerService';
import { callFunctionImpl, getArgumentTypes } from '@fluencelabs/js-peer/dist/js-peer/compilerSupport/callFunction';
import type { IFluencePeer, CallParams, FnConfig, FunctionCallDef, ServiceDef } from '@fluencelabs/interface';
import { getArgumentTypes } from '@fluencelabs/interface';
import { isFluencePeer } from '@fluencelabs/interface';
import { getDefaultPeer } from '../index.js';
export type { IFluencePeer } from '@fluencelabs/js-peer/dist/interfaces/index';
export type { CallParams } from '@fluencelabs/js-peer/dist/interfaces/commonTypes';
export type { IFluencePeer, CallParams } from '@fluencelabs/interface';
export {
ArrayType,
@ -44,9 +42,7 @@ export {
StructType,
TopType,
UnlabeledProductType,
} from '@fluencelabs/js-peer/dist/js-peer/compilerSupport/interface';
export { callFunctionImpl } from '@fluencelabs/js-peer/dist/js-peer/compilerSupport/callFunction';
export { registerServiceImpl } from '@fluencelabs/js-peer/dist/js-peer/compilerSupport/registerService';
} from '@fluencelabs/interface';
/**
* Convenience function to support Aqua `func` generation backend
@ -58,7 +54,12 @@ export { registerServiceImpl } from '@fluencelabs/js-peer/dist/js-peer/compilerS
*/
export const callFunction = async (rawFnArgs: Array<any>, def: FunctionCallDef, script: string): Promise<unknown> => {
const { args, peer, config } = await extractFunctionArgs(rawFnArgs, def);
return callFunctionImpl(def, script, config || {}, peer, args);
return peer.compilerSupport.callFunction({
args,
def,
script,
config: config || {},
});
};
/**
@ -70,8 +71,11 @@ export const callFunction = async (rawFnArgs: Array<any>, def: FunctionCallDef,
*/
export const registerService = async (args: any[], def: ServiceDef): Promise<unknown> => {
const { peer, service, serviceId } = await extractServiceArgs(args, def.defaultServiceId);
return registerServiceImpl(peer, def, serviceId, service);
return peer.compilerSupport.registerService({
def,
service,
serviceId,
});
};
/**

View File

@ -38,6 +38,4 @@ export {
UnlabeledProductType as UnlabeledProductType$$,
callFunction as callFunction$$,
registerService as registerService$$,
registerServiceImpl as registerServiceImpl$$,
callFunctionImpl as callFunctionImpl$$,
} from './v3';

View File

@ -1,5 +1,4 @@
import type { IFluencePeer } from '@fluencelabs/js-peer/dist/interfaces/index.js';
import type { PeerConfig } from '@fluencelabs/js-peer/dist/interfaces/peerConfig';
import type { IFluencePeer, PeerConfig } from '@fluencelabs/interface';
const getPeerFromGlobalThis = (): IFluencePeer | undefined => {
// @ts-ignore