connoropolous-hc-redux-middleware
Advanced tools
Comparing version 1.1.15 to 1.1.16
@@ -13,2 +13,11 @@ /// <reference types="node" /> | ||
}; | ||
export declare function cellIdToString(cellId: CellId): string; | ||
export declare function cellIdFromString(str: string): { | ||
hash: Buffer; | ||
hash_type: Buffer; | ||
}[]; | ||
export interface HcPayload { | ||
payload: any; | ||
cellIdString: string; | ||
} | ||
/** | ||
@@ -19,5 +28,5 @@ * | ||
*/ | ||
export declare const createZomeCallAsyncAction: <ParamType, ReturnType_1>(cell_id: CellId, zome_name: string, fn_name: string, provenance: AgentPubKey) => import("typesafe-actions/dist/create-async-action").AsyncActionBuilder<string, string, string, ParamType, ReturnType_1, Error> & { | ||
create: (param: ParamType) => any; | ||
sig: (param: ParamType) => Promise<ReturnType_1>; | ||
export declare const createZomeCallAsyncAction: (zome_name: string, fn_name: string) => import("typesafe-actions/dist/create-async-action").AsyncActionBuilder<string, string, string, unknown, unknown, unknown> & { | ||
create: (param: HcPayload) => any; | ||
sig: (param: HcPayload) => Promise<any>; | ||
}; | ||
@@ -24,0 +33,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createAdminAsyncAction = exports.createZomeCallAsyncAction = exports.hashFromString = exports.hashToString = void 0; | ||
exports.createAdminAsyncAction = exports.createZomeCallAsyncAction = exports.cellIdFromString = exports.cellIdToString = exports.hashFromString = exports.hashToString = void 0; | ||
const typesafe_actions_1 = require("typesafe-actions"); | ||
const DIV = '[:divider:]'; | ||
const HASH_DIVIDER = '[:hash_divider:]'; | ||
function hashToString(hash) { | ||
return hash.hash_type.toString('hex') + DIV + hash.hash.toString('hex'); | ||
// nodejs | ||
if (typeof process === 'object') { | ||
return (hash.hash_type.toString('hex') + HASH_DIVIDER + hash.hash.toString('hex')); | ||
} | ||
// browser | ||
else { | ||
return hash.hash_type.toString() + HASH_DIVIDER + hash.hash.toString(); | ||
} | ||
} | ||
exports.hashToString = hashToString; | ||
function hashFromString(str) { | ||
const [hashtypestring, hashstring] = str.split(DIV); | ||
return { | ||
hash: Buffer.from(hashstring, 'hex'), | ||
hash_type: Buffer.from(hashtypestring, 'hex') | ||
}; | ||
const [hashtypestring, hashstring] = str.split(HASH_DIVIDER); | ||
// nodejs | ||
if (typeof process === 'object') { | ||
return { | ||
hash: Buffer.from(hashstring, 'hex'), | ||
hash_type: Buffer.from(hashtypestring, 'hex') | ||
}; | ||
} | ||
// browser | ||
else { | ||
return { | ||
hash: Buffer.from(hashstring.split(',')), | ||
hash_type: Buffer.from(hashtypestring.split(',')) | ||
}; | ||
} | ||
} | ||
exports.hashFromString = hashFromString; | ||
const CELL_ID_DIVIDER = '[:cell_id_divider:]'; | ||
function cellIdToString(cellId) { | ||
// [DnaHash, AgentPubKey] | ||
return hashToString(cellId[0]) + CELL_ID_DIVIDER + hashToString(cellId[1]); | ||
} | ||
exports.cellIdToString = cellIdToString; | ||
function cellIdFromString(str) { | ||
// [DnaHash, AgentPubKey] | ||
const [dnahashstring, agentpubkeyhashstring] = str.split(CELL_ID_DIVIDER); | ||
return [hashFromString(dnahashstring), hashFromString(agentpubkeyhashstring)]; | ||
} | ||
exports.cellIdFromString = cellIdFromString; | ||
/** | ||
@@ -23,8 +52,10 @@ * | ||
*/ | ||
exports.createZomeCallAsyncAction = (cell_id, zome_name, fn_name, provenance) => { | ||
const callString = [`${hashToString(cell_id[0])}${hashToString(cell_id[1])}`, zome_name, fn_name].join('/'); | ||
const action = typesafe_actions_1.createAsyncAction(callString, callString + '_SUCCESS', callString + '_FAILURE')(); | ||
exports.createZomeCallAsyncAction = (zome_name, fn_name) => { | ||
const callString = [zome_name, fn_name].join('/'); | ||
const asyncActionCreator = typesafe_actions_1.createAsyncAction(callString, callString + '_SUCCESS', callString + '_FAILURE'); | ||
const action = asyncActionCreator(); | ||
const newAction = action; | ||
// the action creators that are produced | ||
newAction.create = (payload) => { | ||
newAction.create = (param) => { | ||
const cell_id = cellIdFromString(param.cellIdString); | ||
return { | ||
@@ -37,5 +68,5 @@ type: callString, | ||
fn_name, | ||
provenance | ||
provenance: cell_id[1] // AgentPubKey | ||
}, | ||
payload | ||
payload: param.payload | ||
}; | ||
@@ -67,2 +98,2 @@ }; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uQ3JlYXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvYWN0aW9uQ3JlYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSx1REFBcUQ7QUFRckQsTUFBTSxHQUFHLEdBQUcsYUFBYSxDQUFBO0FBQ3pCLFNBQWdCLFlBQVksQ0FBQyxJQUFVO0lBQ3JDLE9BQU8sSUFBSSxDQUFDLFNBQVMsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDLEdBQUcsR0FBRyxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDO0FBQzFFLENBQUM7QUFGRCxvQ0FFQztBQUVELFNBQWdCLGNBQWMsQ0FBQyxHQUFXO0lBQ3hDLE1BQU0sQ0FBQyxjQUFjLEVBQUUsVUFBVSxDQUFDLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUNuRCxPQUFPO1FBQ0wsSUFBSSxFQUFFLE1BQU0sQ0FBQyxJQUFJLENBQUMsVUFBVSxFQUFFLEtBQUssQ0FBQztRQUNwQyxTQUFTLEVBQUUsTUFBTSxDQUFDLElBQUksQ0FBQyxjQUFjLEVBQUUsS0FBSyxDQUFDO0tBQzlDLENBQUE7QUFDSCxDQUFDO0FBTkQsd0NBTUM7QUFFRDs7OztHQUlHO0FBQ1UsUUFBQSx5QkFBeUIsR0FBRyxDQUN2QyxPQUFlLEVBQ2YsU0FBaUIsRUFDakIsT0FBZSxFQUNmLFVBQXVCLEVBQ3ZC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BQSxzQkFBc0IsR0FBRyxDQUNwQyxPQUFlLEVBQ2YsRUFBRTtJQUNGLE1BQU0sVUFBVSxHQUFHLE9BQU8sQ0FBQztJQUUzQixNQUFNLE1BQU0sR0FBRyxvQ0FBaUIsQ0FDOUIsVUFBVSxFQUNWLFVBQVUsR0FBRyxVQUFVLEVBQ3ZCLFVBQVUsR0FBRyxVQUFVLENBQ3hCLEVBQWdDLENBQUM7SUFFbEMsTUFBTSxTQUFTLEdBQUcsTUFHakIsQ0FBQztJQUVGLHdDQUF3QztJQUN4QyxTQUFTLENBQUMsTUFBTSxHQUFHLENBQUMsTUFBaUIsRUFBRSxFQUFFO1FBQ3ZDLE9BQU87WUFDTCxJQUFJLEVBQUUsVUFBVTtZQUNoQixJQUFJLEVBQUU7Z0JBQ0osYUFBYSxFQUFFLElBQUk7Z0JBQ25CLFVBQVU7YUFDWDtZQUNELE9BQU8sRUFBRSxNQUFNO1NBQ2hCLENBQUM7SUFDSixDQUFDLENBQUM7SUFFRixPQUFPLFNBQVMsQ0FBQztBQUNuQixDQUFDLENBQUMifQ== |
@@ -10,2 +10,3 @@ "use strict"; | ||
const actionCreator_1 = require("./actionCreator"); | ||
const conductor_api_1 = require("@holochain/conductor-api"); | ||
const urlConfig = { | ||
@@ -24,128 +25,56 @@ appUrl: 'ws://localhost:8888', | ||
}; | ||
ava_1.default('It passes non-holochain actions to the next reducer', async (t) => { | ||
let { next, invoke } = create(); | ||
const nonHolochainAction = { type: 'not-holochain-action' }; | ||
await invoke(nonHolochainAction); | ||
t.true(next.calledWith(nonHolochainAction)); | ||
}); | ||
ava_1.default('It passes holochain actions and dispatches new action on success', async (t) => { | ||
let { next, invoke, store } = create(); | ||
const profile = { | ||
first_name: 'c', | ||
last_name: 't', | ||
handle: 'ct', | ||
status: 'Online', | ||
avatar_url: 'test', | ||
address: '123123' | ||
}; | ||
const actionCreator = actionCreator_1.createZomeCallAsyncAction(cell_id, 'acorn_profiles', 'create_whoami', cell_id[1]); | ||
const result = await invoke(actionCreator.create(profile)); | ||
t.deepEqual(result.entry, profile); | ||
t.true(next.calledWith(actionCreator.create(profile))); | ||
t.true(store.dispatch.calledWith(actionCreator.success(result))); | ||
}); | ||
ava_1.default('It passes holochain actions and dispatches new error action on holochain error. Err is unwrapped ', async (t) => { | ||
let { next, invoke, store } = create(); | ||
const actionCreator = actionCreator_1.createZomeCallAsyncAction(cell_id, 'acorn_profiles', 'create_whoami', cell_id[1]); | ||
try { | ||
await invoke(actionCreator.create(null)); | ||
} | ||
catch (result) { | ||
const e = new Error(JSON.stringify({ | ||
type: 'Error', | ||
data: { | ||
type: 'RibosomeError', | ||
data: 'Wasm error while working with Ribosome: Zome("failed to deserialize args: FromBytes(\\"invalid type: unit value, expected struct Profile\\")")' | ||
} | ||
})); | ||
t.deepEqual(result, e); | ||
t.true(next.calledWith(actionCreator.create(null))); | ||
t.deepEqual(store.dispatch.lastCall.args[0], actionCreator.failure(e)); | ||
} | ||
}); | ||
const cell_id = [ | ||
{ | ||
hash: Buffer.from([ | ||
0x54, | ||
0x6c, | ||
0x93, | ||
0x85, | ||
0x9e, | ||
0x32, | ||
0xa6, | ||
0xa3, | ||
0x1f, | ||
0xb4, | ||
0x0d, | ||
0x4c, | ||
0x75, | ||
0x8d, | ||
0x5e, | ||
0xcd, | ||
0x26, | ||
0xdf, | ||
0x72, | ||
0xd3, | ||
0xe2, | ||
0xd8, | ||
0x87, | ||
0xde, | ||
0x14, | ||
0xe9, | ||
0x79, | ||
0x78, | ||
0x49, | ||
0x20, | ||
0x95, | ||
0x36, | ||
0x64, | ||
0x3f, | ||
0x6b, | ||
0xc2, | ||
]), | ||
hash_type: Buffer.from([0x84, 0x2d, 0x24]), | ||
}, | ||
// AgentPubKey | ||
{ | ||
hash: Buffer.from([ | ||
0xec, | ||
0xbb, | ||
0x43, | ||
0x93, | ||
0xb9, | ||
0x00, | ||
0xae, | ||
0x42, | ||
0x76, | ||
0x7e, | ||
0x48, | ||
0xcc, | ||
0x44, | ||
0x26, | ||
0x7a, | ||
0xc0, | ||
0xc4, | ||
0x02, | ||
0xb3, | ||
0x0d, | ||
0x80, | ||
0x33, | ||
0x16, | ||
0x8a, | ||
0xc4, | ||
0xff, | ||
0x1e, | ||
0xb1, | ||
0xa3, | ||
0x57, | ||
0x38, | ||
0x4e, | ||
0xa7, | ||
0x48, | ||
0x2f, | ||
0x88, | ||
]), | ||
hash_type: Buffer.from([0x84, 0x20, 0x24]), | ||
}, | ||
]; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlkZGxld2FyZS50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9taWRkbGV3YXJlLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSw4Q0FBdUI7QUFDdkIsa0RBQTBCO0FBRTFCLDZDQUFtRDtBQUNuRCxtREFJeUI7QUFFekIsTUFBTSxTQUFTLEdBQUc7SUFDaEIsTUFBTSxFQUFFLHFCQUFxQjtJQUM3QixRQUFRLEVBQUUscUJBQXFCO0NBQ2hDLENBQUM7QUFFRixNQUFNLE1BQU0sR0FBRyxHQUFHLEVBQUU7SUFDbEIsTUFBTSxLQUFLLEdBQUc7UUFDWixRQUFRLEVBQUUsZUFBSyxDQUFDLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDO1FBQy9CLFFBQVEsRUFBRSxlQUFLLENBQUMsR0FBRyxFQUFFO0tBQ3RCLENBQUM7SUFDRixNQUFNLElBQUksR0FBRyxlQUFLLENBQUMsR0FBRyxFQUFFLENBQUM7SUFDekIsTUFBTSxNQUFNLEdBQUcsQ0FBQyxNQUFXLEVBQUUsRUFBRSxDQUM3QixnQ0FBbUIsQ0FBQyxTQUFTLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FB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QzNDO0lBQ0QsY0FBYztJQUNkO1FBQ0UsSUFBSSxFQUFFLE1BQU0sQ0FBQyxJQUFJLENBQUM7WUFDaEIsSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1lBQ0osSUFBSTtZQUNKLElBQUk7WUFDSixJQUFJO1NBQ0wsQ0FBQztRQUNGLFNBQVMsRUFBRSxNQUFNLENBQUMsSUFBSSxDQUFDLENBQUMsSUFBSSxFQUFFLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQztLQUMzQztDQUNGLENBQUEifQ== | ||
(async () => { | ||
const client = await conductor_api_1.AppWebsocket.connect('ws://localhost:8888'); | ||
const app_info = await client.appInfo({ app_id: 'test-app' }); | ||
const cell_id = app_info.cell_data[0][0]; | ||
ava_1.default('It passes non-holochain actions to the next reducer', async (t) => { | ||
let { next, invoke } = create(); | ||
const nonHolochainAction = { type: 'not-holochain-action' }; | ||
await invoke(nonHolochainAction); | ||
t.true(next.calledWith(nonHolochainAction)); | ||
}); | ||
ava_1.default('It passes holochain actions and dispatches new action on success', async (t) => { | ||
let { next, invoke, store } = create(); | ||
const profile = { | ||
first_name: 'c', | ||
last_name: 't', | ||
handle: 'ct', | ||
status: 'Online', | ||
avatar_url: 'test', | ||
address: '123123' | ||
}; | ||
const actionCreator = actionCreator_1.createZomeCallAsyncAction('acorn_profiles', 'create_whoami'); | ||
const param = { | ||
cellIdString: actionCreator_1.cellIdToString(cell_id), | ||
payload: profile | ||
}; | ||
const result = await invoke(actionCreator.create(param)); | ||
t.deepEqual(result.entry, profile); | ||
t.true(next.calledWith(actionCreator.create(param))); | ||
t.true(store.dispatch.calledWith(actionCreator.success(result))); | ||
}); | ||
ava_1.default('It passes holochain actions and dispatches new error action on holochain error. Err is unwrapped ', async (t) => { | ||
let { next, invoke, store } = create(); | ||
const actionCreator = actionCreator_1.createZomeCallAsyncAction('acorn_profiles', 'create_whoami'); | ||
const param = { | ||
cellIdString: actionCreator_1.cellIdToString(cell_id), | ||
payload: null | ||
}; | ||
try { | ||
await invoke(actionCreator.create(param)); | ||
} | ||
catch (result) { | ||
const e = new Error(JSON.stringify({ | ||
type: 'Error', | ||
data: { | ||
type: 'RibosomeError', | ||
data: 'Wasm error while working with Ribosome: Zome("failed to deserialize args: FromBytes(\\"invalid type: unit value, expected struct Profile\\")")' | ||
} | ||
})); | ||
t.deepEqual(result, e); | ||
t.true(next.calledWith(actionCreator.create(param))); | ||
t.deepEqual(store.dispatch.lastCall.args[0], actionCreator.failure(e)); | ||
} | ||
}); | ||
})(); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlkZGxld2FyZS50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9taWRkbGV3YXJlLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSw4Q0FBdUI7QUFDdkIsa0RBQTBCO0FBRTFCLDZDQUFtRDtBQUNuRCxtREFNeUI7QUFDekIsNERBQXdEO0FBRXhELE1BQU0sU0FBUyxHQUFHO0lBQ2hCLE1BQU0sRUFBRSxxQkFBcUI7SUFDN0IsUUFBUSxFQUFFLHFCQUFxQjtDQU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BQWEsQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ3JELENBQUMsQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxFQUFFLGFBQWEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztTQUN4RTtJQUNILENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQyxDQUFDLEVBQUUsQ0FBQyJ9 |
@@ -5,2 +5,4 @@ # Changelog | ||
### [1.1.16](https://github.com/holochain/hc-redux-middleware/compare/v1.1.15...v1.1.16) (2020-10-07) | ||
### [1.1.15](https://github.com/holochain/hc-redux-middleware/compare/v1.1.14...v1.1.15) (2020-10-07) | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "connoropolous-hc-redux-middleware", | ||
"version": "1.1.15", | ||
"version": "1.1.16", | ||
"description": "Redux middleware for seamless integration with Holochain", | ||
@@ -5,0 +5,0 @@ "main": "build/main/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30197
283