Socket
Socket
Sign inDemoInstall

kourou

Package Overview
Dependencies
215
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.25.1 to 0.25.2

1

lib/commands/collection/export.d.ts

@@ -23,2 +23,3 @@ import { flags } from "@oclif/command";

scrollTTL: flags.IOptionFlag<string>;
type: flags.IOptionFlag<string>;
};

@@ -25,0 +26,0 @@ static args: {

15

lib/commands/collection/export.js

@@ -25,6 +25,12 @@ "use strict";

const count = await this.sdk.document.count(this.args.index, this.args.collection, { query });
this.logInfo(`Dumping ${count} of ${countAll} documents from collection "${this.args.index}:${this.args.collection}" in ${exportPath} ...`);
this.logInfo(`Dumping collection "${this.args.index}:${this.args.collection}" in ${exportPath} ...`);
fs_1.default.mkdirSync(exportPath, { recursive: true });
await (0, dump_collection_1.dumpCollectionMappings)(this.sdk, this.args.index, this.args.collection, exportPath, this.flags.format);
await (0, dump_collection_1.dumpCollectionData)(this.sdk, this.args.index, this.args.collection, Number(this.flags["batch-size"]), exportPath, query, this.flags.format, fields, this.flags.scrollTTL);
if (this.flags.type === "all" || this.flags.type === "mappings") {
this.logInfo(`Dumping collection mappings ...`);
await (0, dump_collection_1.dumpCollectionMappings)(this.sdk, this.args.index, this.args.collection, exportPath, this.flags.format);
}
if (this.flags.type === "all" || this.flags.type === "data") {
this.logInfo(`Dumping collection ${count} of ${countAll} documents ...`);
await (0, dump_collection_1.dumpCollectionData)(this.sdk, this.args.index, this.args.collection, Number(this.flags["batch-size"]), exportPath, query, this.flags.format, fields, this.flags.scrollTTL);
}
this.logOk(`Collection ${this.args.index}:${this.args.collection} dumped`);

@@ -64,2 +70,5 @@ }

default: "20s",
}), type: command_1.flags.string({
description: "Type of the export: all, mappings, data",
default: "all",
}) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({

@@ -66,0 +75,0 @@ description: "Kuzzle protocol (http or websocket)",

@@ -8,2 +8,3 @@ import { flags } from "@oclif/command";

protocol: flags.IOptionFlag<string>;
type: flags.IOptionFlag<string>;
host: flags.IOptionFlag<string>;

@@ -10,0 +11,0 @@ port: flags.IOptionFlag<string>;

@@ -22,7 +22,14 @@ "use strict";

try {
if (collection.type !== "realtime") {
if (collection.type === "realtime") {
continue;
}
if (this.flags.type === "all" || this.flags.type === "mappings") {
this.logInfo(`Dumping collection "${collection.name}" mappings ...`);
await (0, dump_collection_1.dumpCollectionMappings)(this.sdk, this.args.index, collection.name, exportPath, this.flags.format);
}
if (this.flags.type === "all" || this.flags.type === "data") {
this.logInfo(`Dumping collection "${collection.name}" documents ...`);
await (0, dump_collection_1.dumpCollectionData)(this.sdk, this.args.index, collection.name, Number(this.flags["batch-size"]), exportPath, query, this.flags.format, this.flags.scrollTTL);
cli_ux_1.default.action.stop();
}
cli_ux_1.default.action.stop();
}

@@ -57,2 +64,5 @@ catch (error) {

default: "ws",
}), type: command_1.flags.string({
description: "Type of the export: all, mappings, data",
default: "all",
}) });

@@ -59,0 +69,0 @@ IndexExport.args = [{ name: "index", description: "Index name", required: true }];

@@ -18,3 +18,11 @@ "use strict";

*/
this.allColors = [chalk_1.default.red, chalk_1.default.green, chalk_1.default.yellow, chalk_1.default.blue, chalk_1.default.magenta, chalk_1.default.cyan, chalk_1.default.gray];
this.allColors = [
chalk_1.default.red,
chalk_1.default.green,
chalk_1.default.yellow,
chalk_1.default.blue,
chalk_1.default.magenta,
chalk_1.default.cyan,
chalk_1.default.gray,
];
/**

@@ -38,4 +46,8 @@ * Available colors for pod names.

// Parse the time arguments
const since = this.flags.since ? chrono.parseDate(this.flags.since).toISOString() : undefined;
const until = this.flags.until ? chrono.parseDate(this.flags.until).toISOString() : undefined;
const since = this.flags.since
? chrono.parseDate(this.flags.since).toISOString()
: undefined;
const until = this.flags.until
? chrono.parseDate(this.flags.until).toISOString()
: undefined;
// Perform the streamed request

@@ -68,3 +80,2 @@ const incomingMessage = await this.paas.queryHttpStream({

if (!data.content || !data.podName) {
this.logKo(line);
continue;

@@ -75,3 +86,5 @@ }

// Display the log
const timestamp = this.flags.timestamp ? `[${new Date(data.timeStamp).toLocaleString()}] ` : "";
const timestamp = this.flags.timestamp
? `[${new Date(data.timeStamp).toLocaleString()}] `
: "";
const name = podColor(`${data.podName}${separator}`);

@@ -81,3 +94,3 @@ this.log(`${timestamp}${name}| ${data.content}`);

catch (error) {
this.logKo(`Unable to parse the following line: ${line}`);
this.logKo(`Error while parsing log: ${error} (Received: "${line}")`);
}

@@ -114,3 +127,3 @@ }

const end = 10;
let max = { name: '', length: 0 };
let max = { name: "", length: 0 };
for (const name of names) {

@@ -121,3 +134,5 @@ if (max.length < name.length) {

}
return currentName === max.name ? end : end + (max.length - currentName.length);
return currentName === max.name
? end
: end + (max.length - currentName.length);
}

@@ -124,0 +139,0 @@ /**

@@ -84,2 +84,3 @@ "use strict";

async dump() {
fs_1.default.mkdirSync(this.collectionDir, { recursive: true });
this.filename = path_1.default.join(this.collectionDir, `documents.${this.fileExtension}`);

@@ -86,0 +87,0 @@ this.writeStream = fs_1.default.createWriteStream(this.filename);

@@ -167,3 +167,3 @@ "use strict";

headers: {
"Authorization": `Bearer ${this.sdk.jwt}`,
Authorization: `Bearer ${this.sdk.jwt}`,
"Content-Length": Buffer.byteLength(body),

@@ -170,0 +170,0 @@ "Content-Type": "application/json",

@@ -9,3 +9,3 @@ "use strict";

function handleError(log, dumpFile, error) {
if (error.status === 206) {
if (error.errors) {
const errorFile = `${dumpFile

@@ -16,8 +16,6 @@ .split(".")

const writeStream = fs_1.default.createWriteStream(errorFile, { flags: "a" });
const serialize = ndjson_1.default.stringify().pipe(writeStream);
serialize.on("data", (line) => writeStream.write(line));
for (const partialError of error.errors) {
serialize.write(partialError);
writeStream.write(JSON.stringify(partialError) + '\n');
}
serialize.end();
writeStream.end();
log(chalk_1.default.red(`[X] Error importing ${dumpFile}. See errors in ${errorFile}`));

@@ -36,2 +34,3 @@ }

collection: "",
strict: true,
body: {

@@ -96,4 +95,4 @@ documents: [{}],

.query(mWriteRequest)
.then(() => {
total += mWriteRequest.body.documents.length;
.then((response) => {
total += response.result.successes.length;
process.stdout.write(` ${total} documents imported`);

@@ -100,0 +99,0 @@ process.stdout.write("\r");

{
"name": "kourou",
"description": "The CLI that helps you manage your Kuzzle instances",
"version": "0.25.1",
"version": "0.25.2",
"author": "The Kuzzle Team <support@kuzzle.io>",

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

@@ -29,3 +29,3 @@ # kourou

$ kourou (-v|--version|version)
kourou/0.25.1 linux-x64 node-v16.15.0
kourou/0.25.2 linux-x64 node-v14.20.0
$ kourou --help [COMMAND]

@@ -510,2 +510,5 @@ USAGE

--type=type
[default: all] Type of the export: all, mappings, data
--username=username

@@ -943,2 +946,4 @@ [default: anonymous] Kuzzle username (local strategy)

--type=type [default: all] Type of the export: all, mappings, data
--username=username [default: anonymous] Kuzzle username (local strategy)

@@ -945,0 +950,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc