![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
A simple compatibility layer for dynamodb models to be compatible with the datastar model API
A simple compatibility layer for dynamodb models to be compatible with the datastar model API
npm install dynastar --save
When defining your dynamodb
models,
you use dynastar
to expose them with
a datastar
API. You can optionally pass
functions you would like to attach to the Dynastar class.
const Dynastar = require('dynastar');
const Joi = require('joi');
function defineMyModel(dynamo) {
const model = dynamo.define('mymodel', {
hashKey: 'hashme',
rangeKey: 'ranger',
schema: {
hashme: Joi.string(),
ranger: dynamo.types.timeUUID()
}
});
//
// A sync function must have a length of less than 2 if you want
// to use the AwaitWrap wrapper
//
function exampleSyncFn(data) {
// do something sync
return someSyncResult;
}
function exampleAsyncFn(data, next) {
// do something async
next(null, someAsyncResult);
}
return new Dynastar({ model, hashKey: 'hashme', rangeKey: 'ranger', exampleSyncFn, exampleAsyncFn });
}
const mymodel = defineMyModel(require('dynamodb'));
AwaitWrap
If you would like to enable an await
able model, we have a class for that.
Building on the previous example...
const { AwaitWrap } = require('dynastar');
const myAwaitModel = new AwaitWrap(mymodel);
// In this circumstance we have a sync function and async function that was
// added as "extra" onto the model itself. In this context the sync function
// is left untouched but the async callback function is made to be a `thenable`
// that can be awaited
const asyncResult = await myAwaitModel.exampleAsyncFn(data);
const syncResult = myAwaitModel.exampleSyncFn(data);
Dynastar supports key builders for the hash and range keys. These are useful for combining multiple values into one.
createHashKey
(or simply createKey
) can be used to build a compound hash key.
const Dynastar = require('dynastar');
const Joi = require('joi');
function defineMyModel(dynamo) {
const model = dynamo.define('mymodel', {
hashKey: 'key',
rangeKey: 'ranger',
schema: {
key: Joi.string(),
ranger: Joi.string(),
firstName: Joi.string(),
lastName: Joi.string(),
birthday: Joi.date()
}
});
return new Dynastar({
model,
hashKey: 'key',
rangeKey: 'ranger',
createHashKey: ({ firstName, lastName, birthday }) => `${firstName}!${lastName}!${birthday}`
});
}
createRangeKey
can be used to build a compound range key.
const Dynastar = require('dynastar');
const Joi = require('joi');
function defineMyModel(dynamo) {
const model = dynamo.define('mymodel', {
hashKey: 'hashme',
rangeKey: 'ranger',
schema: {
hashme: Joi.string(),
ranger: Joi.string(),
time: Joi.date().iso(),
uuid: dynamo.types.uuid()
}
});
return new Dynastar({
model,
hashKey: 'hashme',
rangeKey: 'ranger',
createRangeKey: ({ time, uuid }) => `${time}#${uuid}`
});
}
Run localstack locally in one terminal
npm run localstack
Run npm tests
npm test
2.0.1
FAQs
A simple compatibility layer for dynamodb models to be compatible with the datastar model API
We found that dynastar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.