New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

onetable-cli

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onetable-cli - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

10

dist/cli.js

@@ -107,3 +107,3 @@ #!/usr/bin/env node

this.config = config;
this.debug(`Using configuration profile ${config.profile}`);
this.debug(`Using configuration profile "${config.profile}"`);
this.log = new Log(config.log, { app: 'migrate', source: 'migrate' });

@@ -127,3 +127,3 @@ if (this.verbosity) {

else {
let endpoint = this.endpoint || cot.endpoint || process.env.DB_ENDPOINT;
let endpoint = this.endpoint || cot.endpoint || cot.aws.endpoint || process.env.DB_ENDPOINT;
let args, location;

@@ -137,3 +137,3 @@ if (endpoint) {

args = cot.aws;
if (Object.keys(args).length == 0) {
if (!args || Object.keys(args).length == 0) {
location = process.env.AWS_PROFILE;

@@ -158,3 +158,3 @@ }

try {
let schema = (await import(path)).default;
let schema = (await import('file:///' + path)).default;
for (let [name, model] of Object.entries(schema.models)) {

@@ -535,3 +535,3 @@ for (let [key, field] of Object.entries(model)) {

this.profile = config.profile;
config.onetable.aws = config.onetable.aws || this.aws;
config.onetable.aws = config.onetable.aws || this.aws || {};
return config;

@@ -538,0 +538,0 @@ }

{
"name": "onetable-cli",
"version": "1.0.5",
"version": "1.0.6",
"type": "module",

@@ -23,3 +23,3 @@ "description": "DynamoDB OneTable CLI",

"scripts": {
"build": "tsc",
"build": "tsc && ./fixup",
"lint": "eslint .",

@@ -26,0 +26,0 @@ "prepare": "npm run build"

@@ -48,7 +48,8 @@ # OneTable Migrate CLI

name: 'your-dynamo-table',
schema: 'schema.js',
schema: 'schema.mjs',
}
```
Set the `name` property to the name of your DynamoDB table. Set the `schema` property to point to your OneTable schema.
Set the `name` property to the name of your DynamoDB table. Set the `schema` property to point to your OneTable schema in a `.mjs` JavaScript file. (yes the extension is `mjs`).
The schema file should use `export default` to export the schema. In this manner, the same schema file can be used for your DynamoDB access layer and for the OneTable CLI. For example:

@@ -58,8 +59,16 @@

export default {
indexes: { },
models: {}
indexes: {
primary: { hash: 'pk', sort: 'sk' },
},
models: {
user: {
pk: { type: String, value: 'user:${email}' },
sk: { type: String, value: 'user:' },
email: { type: String },
}
}
}
```
If you need to have your migrations in a different directory, you can set `onetable.dir` to point to the directory containing the migrations themselves.
If you need to have your migrations in a different directory, you can set the `dir` property to point to the directory containing the migrations themselves.

@@ -66,0 +75,0 @@ Your configuration should match your OneTable configuration with respect to the OneTable `crypto`, `delimiter`, `nulls` and `typeField` settings. If you have these set to non-default settings, add them to your migrate.json to match.

@@ -117,3 +117,3 @@ #!/usr/bin/env node

this.config = config
this.debug(`Using configuration profile ${config.profile}`)
this.debug(`Using configuration profile "${config.profile}"`)

@@ -139,3 +139,3 @@ this.log = new Log(config.log, {app: 'migrate', source: 'migrate'})

} else {
let endpoint = this.endpoint || cot.endpoint || process.env.DB_ENDPOINT
let endpoint = this.endpoint || cot.endpoint || cot.aws.endpoint || process.env.DB_ENDPOINT
let args, location

@@ -148,3 +148,3 @@ if (endpoint) {

args = cot.aws
if (Object.keys(args).length == 0) {
if (!args || Object.keys(args).length == 0) {
location = process.env.AWS_PROFILE

@@ -170,3 +170,3 @@ } else {

try {
let schema = (await import(path)).default
let schema = (await import('file:///' + path)).default
for (let [name, model] of Object.entries(schema.models)) {

@@ -527,3 +527,3 @@ for (let [key, field] of Object.entries(model)) {

this.profile = config.profile
config.onetable.aws = config.onetable.aws || this.aws
config.onetable.aws = config.onetable.aws || this.aws || {}
return config

@@ -530,0 +530,0 @@ }

@@ -339,3 +339,6 @@ /*

console.log(`${time}: ${module}: ${type}: ${message}`)
console.log(JSON.stringify(context, null, 4) + '\n')
if (Object.keys(context).length > 4) {
// More than: message, time, level and type
console.log(JSON.stringify(context, null, 4) + '\n')
}
}

@@ -342,0 +345,0 @@ } catch (err) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc