Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

instant-cli

Package Overview
Dependencies
Maintainers
0
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

instant-cli - npm Package Compare versions

Comparing version 0.14.29 to 0.14.30

104

index.js

@@ -393,4 +393,29 @@ // @ts-check

}
if (job.job_type === "index") {
return `adding index to ${job.attr_name}`;
}
if (job.job_type === "remove-index") {
return `removing index from ${job.attr_name}`;
}
if (job.job_type === "unique") {
return `adding uniqueness constraint to ${job.attr_name}`;
}
if (job.job_type === "remove-unique") {
return `removing uniqueness constraint from ${job.attr_name}`;
}
}
function truncate(s, maxLen) {
if (s.length > maxLen) {
return `${s.substr(0, maxLen - 3)}...`;
}
return s;
}
function formatSamples(triples_samples) {
return triples_samples.slice(0, 3).map((t) => {
return { ...t, value: truncate(JSON.stringify(t.value), 32) };
});
}
function indexingJobCompletedMessage(job) {

@@ -405,9 +430,7 @@ const actionMessage = indexingJobCompletedActionMessage(job);

if (job.job_status === "errored") {
if (
job.error === "invalid-triple-error" &&
job.invalid_triples_sample?.length
) {
if (job.invalid_triples_sample?.length) {
const [etype, label] = job.attr_name.split(".");
const longestValue = job.invalid_triples_sample.slice(0, 3).reduce(
(acc, { value }) => Math.max(acc, JSON.stringify(value).length),
const samples = formatSamples(job.invalid_triples_sample);
const longestValue = samples.reduce(
(acc, { value }) => Math.max(acc, value.length),
// Start with length of label

@@ -418,6 +441,12 @@ label.length,

let msg = `${chalk.red("INVALID DATA")} ${actionMessage}.\n`;
if (job.invalid_unique_value) {
msg += ` Found multiple entities with value ${truncate(JSON.stringify(job.invalid_unique_value), 64)}.\n`;
}
if (job.error === "triple-too-large-error") {
msg += ` Some of the existing data is too large to index.\n`;
}
msg += ` First few examples:\n`;
msg += ` ${chalk.bold("id")}${" ".repeat(35)}| ${chalk.bold(label)}${" ".repeat(longestValue - label.length)} | ${chalk.bold("type")}\n`;
msg += ` ${"-".repeat(37)}|${"-".repeat(longestValue + 2)}|--------\n`;
for (const triple of job.invalid_triples_sample.slice(0, 3)) {
for (const triple of samples) {
const urlParams = new URLSearchParams({

@@ -437,3 +466,3 @@ s: "main",

});
msg += ` ${link} | ${triple.value}${" ".repeat(longestValue - JSON.stringify(triple.value).length)} | ${triple.json_type}\n`;
msg += ` ${link} | ${triple.value}${" ".repeat(longestValue - triple.value.length)} | ${triple.json_type}\n`;
}

@@ -446,2 +475,31 @@ return msg;

function joinInSentence(items) {
if (items.length === 0) {
return "";
}
if (items.length === 1) {
return items[0];
}
if (items.length === 2) {
return `${items[0]} and ${items[1]}`;
}
return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
}
function jobGroupDescription(jobs) {
const actions = new Set();
const jobActions = {
"check-data-type": "updating types",
"remove-data-type": "updating types",
index: "updating indexes",
"remove-index": "updating indexes",
unique: "updating uniqueness constraints",
"remove-unique": "updating uniqueness constraints",
};
for (const job of jobs) {
actions.add(jobActions[job.job_type]);
}
return joinInSentence([...actions].sort()) || "updating schema";
}
async function waitForIndexingJobsToFinish(appId, data) {

@@ -453,3 +511,3 @@ const spinner = ora({

let jobs = data.jobs;
let waitMs = 1;
let waitMs = 20;
let lastUpdatedAt = new Date(0);

@@ -498,3 +556,3 @@

);
spinner.text = `checking data types ${percent}%`;
spinner.text = `${jobGroupDescription(jobs)} ${percent}%`;
}

@@ -549,2 +607,3 @@ if (completedMessages.length) {

check_types: !opts?.skipCheckTypes,
supports_background_updates: true,
},

@@ -599,2 +658,26 @@ });

}
case "index": {
console.log("%s on %s", chalk.green("ADD INDEX"), attrFwdName(attr));
break;
}
case "remove-index": {
console.log("%s on %s", chalk.red("REMOVE INDEX"), attrFwdName(attr));
break;
}
case "unique": {
console.log(
"%s to %s",
chalk.green("ADD UNIQUE CONSTRAINT"),
attrFwdName(attr),
);
break;
}
case "remove-unique": {
console.log(
"%s from %s",
chalk.red("REMOVE UNIQUE CONSTRAINT"),
attrFwdName(attr),
);
break;
}
}

@@ -614,2 +697,3 @@ }

check_types: !opts?.skipCheckTypes,
supports_background_updates: true,
},

@@ -616,0 +700,0 @@ });

2

package.json
{
"name": "instant-cli",
"type": "module",
"version": "v0.14.29",
"version": "v0.14.30",
"description": "Instant's CLI",

@@ -6,0 +6,0 @@ "scripts": {

// Autogenerated by publish_packages.clj
const version = "v0.14.29";
const version = "v0.14.30";
export default version;
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