Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
stratumn-agent-client
Advanced tools
<!-- Polyfill for browser compatibility -->
<script src="https://libs.stratumn.com/babel-polyfill.min.js"></script>
<!-- Actual Stratumn SDK -->
<script src="https://libs.stratumn.com/stratumn-agent-client.min.js"></script>
If you want a specific version, include https://libs.stratumn.com/stratumn-agent-client-{version}.min.js
instead (for instance https://libs.stratumn.com/stratumn-agent-client-1.0.2.min.js
).
$ npm install stratumn-agent-client
var AgentClient = require('stratumn-agent-client');
AgentClient.getAgent('http://localhost:3000')
.then(function(agent) {
console.log(agent);
// { processes: {
// firstProcess: {
// name: "first",
// processInfo: {...}
// storeInfo: {...}
// },
// secondProcess: {
// ...
// }
// }
// }
// Create a new map, you can pass arguments to init
var firstProcess = agent.processes.firstProcess;
return firstProcess.createMap('My conversation');
})
.then(function(segment) {
// You can call an action like a regular function
return segment.addMessage('Hello, World');
})
.then(function(segment) {
console.log(segment.link);
console.log(segment.meta);
})
.catch(function(err) {
// Handle errors
});
Returns a promise that resolves with an agent client targetting the agent server available at url
.
AgentClient
.getAgent('http://localhost:3000')
.then(function(agent) {
console.log(agent);
})
.catch(function(err) {
// Handle errors
});
Returns a promise that resolves with an agent client targetting the agent object created previously.
const agentObj = create();
AgentClient
.getAgent(agentObj)
.then(function(agent) {
console.log(agent);
})
.catch(function(err) {
// Handle errors
});
Returns a promise that resolves with the agent and segment from a given raw object.
AgentClient
.fromSegment(someRawSegment)
.then(function(res) {
console.log(res.agent);
console.log(res.segment);
})
.catch(function(err) {
// Handle errors
});
Returns a promise that resolves with a the first segment of a map.
AgentClient
.getAgent('http://localhost:3000')
.then(function(agent) {
const process = agent.processes.firstProcess;
return process.createMap('A new map');
})
.then(function(segment) {
console.log(segment);
})
.catch(function(err) {
// Handle errors
});
Returns a promise that resolves with an existing segment.
AgentClient
.getAgent('http://localhost:3000')
.then(function(agent) {
const process = agent.processes.firstProcess;
return process.getSegment('aee5427');
})
.then(function(segment) {
console.log(segment);
})
.catch(function(err) {
// Handle errors
});
Returns a promise that resolves with existing segments.
Available options are:
offset
: offset of first returned segmentslimit
: limit number of returned segments, if -1 load all segmentsbatchSize
: size of each batch when loading all segments (default 20)mapIds
: return segments with specified map IDprevLinkHash
: return segments with specified previous link hashtags
: return segments that contains all the tags (array)AgentClient
.getAgent('http://localhost:3000')
.then(function(agent) {
const process = agent.processes.firstProcess;
return process.findSegments({ tags: ['tag1', 'tag2'], offset: 20, limit: 10 });
})
.then(function(segments) {
console.log(segments);
})
.catch(function(err) {
// Handle errors
});
Returns a promise that resolves with existing map IDs.
Available options are:
offset
: offset of first returned map IDlimit
: limit number of returned map IDAgentClient
.getAgent('http://localhost:3000')
.then(function(agent) {
const process = agent.processes.firstProcess;
return process.getMapIds({ offset: 20, limit: 10 });
})
.then(function(mapIDs) {
console.log(mapIDs);
})
.catch(function(err) {
// Handle errors
});
Returns a promise that resolves with the previous segment.
AgentClient
.getAgent('http://localhost:3000')
.then(function(agent) {
const process = agent.processes.firstProcess;
return process.getSegment('aee5427');
})
.then(function(segment) {
return segment.getPrev();
})
.then(function(segment) {
console.log(segment);
})
.catch(function(err) {
// Handle errors
});
Executes an action and returns a promise that resolves with a new segment.
AgentClient
.getAgent('http://localhost:3000')
.then(function(agent) {
const process = agent.processes.firstProcess;
return process.getSegment('aee5427');
})
.then(function(segment) {
return segment.addMessage('Hello, World!');
})
.then(function(segment) {
console.log(segment);
})
.catch(function(err) {
// Handle errors
});
Install dependencies:
$ npm install
Build:
$ npm run build
Test:
$ npm test
Test coverage:
$ npm run test:cov
$ open coverage/lcov-report/index.html
Lint:
$ npm run lint
Lint and test:
$ npm run check
Bump version:
$ npm version major|minor|patch
Publish:
$ npm publish
FAQs
Stratumn Indigo agent client library
The npm package stratumn-agent-client receives a total of 22 weekly downloads. As such, stratumn-agent-client popularity was classified as not popular.
We found that stratumn-agent-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.