Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
@memori.ai/memori-api-client
Advanced tools
React library to integrate a Memori in your app or website
TypeScript client to integrate with Memori API.
yarn add @memori.ai/memori-api-client
npm install @memori.ai/memori-api-client
Every method has JSDoc annotations with usage and description and typings information.
See examples for Node (TypeScript) and React.
import memoriApiClient from '@memori.ai/memori-api-client';
const memori = memoriApiClient('https://backend.memori.ai');
(async () => {
const { sessionID, currentState, ...response } = await memori.initSession(
'768b9654-e781-4c3c-81fa-ae1529d1bfbe'
);
const {
currentState: dialogState,
...resp
} = await memori.postTextEnteredEvent(sessionID, 'Ciao, Memori!');
})();
For the specification of the APIs, see the typings or the documentation from the dashboard if you are allowed to see it.
import memoriApiClient from '@memori.ai/memori-api-client';
const memori = memoriApiClient('https://backend.memori.ai');
memori.constants.allowedMediaTypes; // list of allowed media types in asset upload
memori.constants.anonTag; // tag for anonymous users
There is a helper method parsing media urls from the DB, handling different cases
const memori = memoriApiClient('https://backend.memori.ai');
memori.asset.getResourceUrl({
type: 'avatar',
resourceURI: '768b9654-e781-4c3c-81fa-ae1529d1bfbe.png',
mediaType: 'image/png',
sessionId: 'be2e4a44-890b-483b-a26a-f6e122f36e2b',
});
Experimental
Bundled with this client there is a TTS utility that can be used to synthesize text to speech.
const memori = memoriApiClient('https://backend.memori.ai');
// Needs Azure Speech API key
// See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform?pivots=programming-language-javascript
// Second parameter is for debug mode
const speechSdk = memori.speech(AZURE_COGNITIVE_SERVICES_TTS_KEY, true);
// Requires the language code of the text to be spoken
// And the voice type (female or male)
const speech = speechSdk('it', 'FEMALE');
speech.speak('Ciao, Memori!', () => {
console.log('spoken');
});
speech.isSpeaking();
speech.stopSpeaking();
Experimental
There is also a speech recognition utility.
// Same as for the TTS
const speech = speechSdk('it', 'FEMALE');
speech.recognize(transcript => {
console.log('Recognized ', transcript);
});
speech.isRecognizing();
speech.stopRecognizing();
To run TSDX, use:
npm start # or yarn start
This builds to /dist
and runs the project in watch mode so any edits you save inside src
causes a rebuild to /dist
.
To do a one-off build, use npm run build
or yarn build
.
To run tests, use npm test
or yarn test
.
Code quality is set up with prettier
, husky
, and lint-staged
.
You can run prettier with npm format
or yarn format
.
You can run linter with npm lint
or yarn lint
.
You can run type checking with npm typecheck
or yarn typecheck
.
Jest tests are set up to run with npm test
or yarn test
.
size-limit
is set up to calculate the real cost of your library with npm run size
and visualize the bundle with npm run analyze
.
TSDX uses Rollup as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.
tsconfig.json
is set up to interpret dom
and esnext
types, as well as react
for jsx
.
You can run type checking with npm typecheck
or yarn typecheck
.
Two actions are added by default:
main
which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrixsize
which comments cost comparison of your library on every pull request using size-limit
Please see the main tsdx
optimizations docs. In particular, know that you can take advantage of development-only optimizations:
// ./types/index.d.ts
declare var __DEV__: boolean;
// inside your code...
if (__DEV__) {
console.log('foo');
}
You can also choose to install and use invariant and warning functions.
CJS, ESModules, and UMD module formats are supported.
The appropriate paths are configured in package.json
and dist/index.js
accordingly. Please report if any issues are found.
We use commmitlint for commit message validation based on Conventional Commits.
Changelog and release management with release-it, using convential changelog.
FAQs
React library to integrate a Memori in your app or website
The npm package @memori.ai/memori-api-client receives a total of 201 weekly downloads. As such, @memori.ai/memori-api-client popularity was classified as not popular.
We found that @memori.ai/memori-api-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.