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.26.0 to 0.26.1

8

lib/commands/app/scaffold.d.ts
import { flags } from "@oclif/command";
import { Kommand } from "../../common";
export default class AppScaffold extends Kommand {
templatesDir: string;
static initSdk: boolean;

@@ -16,3 +17,8 @@ static description: string;

runSafe(): Promise<void>;
cloneTemplate(flavor: string, destination: string): Promise<void>;
getRepo(flavor: string): "template-kuzzle-project" | "template-kiotp-project";
checkDestination(destination: string): Promise<void>;
prepareTemplate(): Promise<void>;
cloneTemplate(flavor: string): Promise<void>;
copyTemplate(destination: string): Promise<void>;
cleanup(): Promise<void>;
}

@@ -10,2 +10,6 @@ "use strict";

class AppScaffold extends common_1.Kommand {
constructor() {
super(...arguments);
this.templatesDir = "/tmp/kuzzle-templates";
}
async runSafe() {

@@ -16,17 +20,65 @@ const destination = this.args.destination;

{
title: "Creating and rendering application files",
task: async () => this.cloneTemplate(flavor, destination),
title: "Checking destination",
task: async () => this.checkDestination(destination),
},
{
title: "Prepare temporary folder",
task: async () => this.prepareTemplate(),
},
{
title: "Cloning template repository",
task: async () => this.cloneTemplate(flavor)
}, {
title: "Copying template files",
task: async () => this.copyTemplate(destination)
},
{
title: "Cleaning up",
task: async () => this.cleanup()
}
]);
await tasks.run();
this.log("");
this.logOk(`Scaffolding complete! Use ${chalk_1.default.grey(`cd ${destination} && npm run docker npm install`)} install dependencies and then ${chalk_1.default.grey(`npm run docker:dev`)} to run your application!`);
this.logOk(`Scaffolding complete!`);
this.logOk(`Use ${chalk_1.default.blue.bold(`cd ${destination} && docker compose up -d`)} to start your Kuzzle stack.`);
}
async cloneTemplate(flavor, destination) {
const templatesDir = "/tmp/project-templates";
await (0, execute_1.execute)("rm", "-rf", templatesDir);
await (0, execute_1.execute)("git", "clone", "--depth=1", "https://github.com/kuzzleio/project-templates", "--branch", flavor, "--single-branch", templatesDir);
await (0, execute_1.execute)("cp", "-r", `${templatesDir}/${flavor}`, `${destination}/`);
await (0, execute_1.execute)("rm", "-rf", templatesDir);
getRepo(flavor) {
console.log(flavor);
switch (flavor) {
case "generic":
return "template-kuzzle-project";
case "iot":
return "template-kiotp-project";
default:
return "template-kuzzle-project";
}
}
async checkDestination(destination) {
let process;
try {
process = await (0, execute_1.execute)("test", "-d", destination);
}
catch (error) {
if (error.result.exitCode === 1) {
// Destination directory does not exist
return;
}
}
if (process.exitCode === 0) {
throw new Error(`Destination directory ${destination} already exists.`);
}
}
async prepareTemplate() {
await (0, execute_1.execute)("rm", "-rf", this.templatesDir);
}
async cloneTemplate(flavor) {
const repo = this.getRepo(flavor);
await (0, execute_1.execute)("git", "clone", "--depth=1", `https://github.com/kuzzleio/${repo}`, "--branch", "master", "--single-branch", this.templatesDir);
}
async copyTemplate(destination) {
await (0, execute_1.execute)("cp", "-r", `${this.templatesDir}/`, `${destination}/`);
}
async cleanup() {
await (0, execute_1.execute)("rm", "-rf", this.templatesDir);
}
}

@@ -40,4 +92,3 @@ exports.default = AppScaffold;

default: "generic",
description: `Template flavor ("generic", "iot-backend", "iot-console").
Those can be found here: https://github.com/kuzzleio/project-templates`,
description: `Template flavor ("generic", "iot").`,
}),

@@ -44,0 +95,0 @@ };

6

lib/commands/app/start-services.js

@@ -50,5 +50,5 @@ "use strict";

this.log(chalk_1.default.grey("\nTo watch the logs, run"));
this.log(chalk_1.default.grey(` docker-compose -f ${docoFilename} logs -f\n`));
this.log(" Elasticsearch port: 9200");
this.log(" Redis port: 6379");
this.log(chalk_1.default.blue.bold(` docker-compose -f ${docoFilename} logs -f\n`));
this.log(` Elasticsearch port: ${chalk_1.default.bold("9200")}`);
this.log(` Redis port: ${chalk_1.default.bold("6379")}`);
}

@@ -55,0 +55,0 @@ catch (error) {

@@ -61,2 +61,23 @@ "use strict";

});
// Don't continue if an error occurred
if (incomingMessage.statusCode !== 200) {
return new Promise((_, reject) => {
// Collect the whole response body
let responseBody = "";
incomingMessage.on("data", (buffer) => {
responseBody += buffer.toString();
});
incomingMessage.on("end", () => {
let response;
try {
response = JSON.parse(responseBody);
}
catch (error) {
reject(new Error("An error occurred while parsing the error response body from Kuzzle"));
return;
}
reject(response.error);
});
});
}
// Read the response line by line

@@ -63,0 +84,0 @@ const lineStream = readline.createInterface({

@@ -15,4 +15,5 @@ import { flags } from "@oclif/command";

}[];
static examples: string[];
runSafe(): Promise<void>;
}
export default PaasSnapshotsCat;

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

];
PaasSnapshotsCat.examples = ["kourou paas:snapshots:cat --project paas-project-myproject api main"];
exports.default = PaasSnapshotsCat;

@@ -15,4 +15,5 @@ import { flags } from "@oclif/command";

}[];
static examples: string[];
runSafe(): Promise<void>;
}
export default PaasSnapshotsDump;

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

}
PaasSnapshotsDump.description = "List all snapshots for a given kuzzle application in a environment";
PaasSnapshotsDump.description = "Create a new snapshot of the current application state";
PaasSnapshotsDump.flags = {

@@ -46,2 +46,3 @@ help: command_1.flags.help(),

];
PaasSnapshotsDump.examples = ["kourou paas:snapshots:dump --project paas-project-myproject api main"];
exports.default = PaasSnapshotsDump;

@@ -15,4 +15,5 @@ import { flags } from "@oclif/command";

}[];
static examples: string[];
runSafe(): Promise<void>;
}
export default PaasSnapshotsRestore;

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

}
PaasSnapshotsRestore.description = "List all snapshots for a given kuzzle application in a environment";
PaasSnapshotsRestore.description = "Restore a snapshot of the current application state";
PaasSnapshotsRestore.flags = {

@@ -54,2 +54,3 @@ help: command_1.flags.help(),

];
PaasSnapshotsRestore.examples = ["kourou paas:snapshots:restore --project paas-project-myproject api main snapshot-id"];
exports.default = PaasSnapshotsRestore;

@@ -33,5 +33,3 @@ "use strict";

let stderr = "";
// eslint-disable-next-line
process.stdout.on("data", (data) => (stdout += data.toString()));
// eslint-disable-next-line
process.stderr.on("data", (data) => (stderr += data.toString()));

@@ -38,0 +36,0 @@ const executor = new Promise((resolve, reject) => {

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

headers: {
Accept: "application/json",
"Accept-Encoding": "identity",
Authorization: `Bearer ${this.sdk.jwt}`,
Connection: "keep-alive",
"Content-Length": Buffer.byteLength(body),

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

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

@@ -40,3 +40,3 @@ "bin": {

"node-fetch": "^2.6.7",
"production": "0.0.2",
"production": "^0.0.2",
"strip-json-comments": "^3.1.1",

@@ -43,0 +43,0 @@ "tar": "^6.1.11",

@@ -30,3 +30,3 @@ # kourou

$ kourou (-v|--version|version)
kourou/0.26.0 linux-x64 node-v14.21.2
kourou/0.26.1 darwin-arm64 node-v18.17.1
$ kourou --help [COMMAND]

@@ -130,68 +130,60 @@ USAGE

<!-- commands -->
- [kourou](#kourou)
- [Usage](#usage)
- [Connect and authenticate to Kuzzle API](#connect-and-authenticate-to-kuzzle-api)
- [User impersonation](#user-impersonation)
- [Automatic command infering for API actions](#automatic-command-infering-for-api-actions)
- [Commands](#commands)
- [`kourou api-key:check TOKEN`](#kourou-api-keycheck-token)
- [`kourou api-key:create USER`](#kourou-api-keycreate-user)
- [`kourou api-key:delete USER ID`](#kourou-api-keydelete-user-id)
- [`kourou api-key:search USER`](#kourou-api-keysearch-user)
- [`kourou app:debug-proxy`](#kourou-appdebug-proxy)
- [`kourou app:doctor`](#kourou-appdoctor)
- [`kourou app:scaffold DESTINATION`](#kourou-appscaffold-destination)
- [`kourou app:start-services`](#kourou-appstart-services)
- [`kourou autocomplete [SHELL]`](#kourou-autocomplete-shell)
- [`kourou collection:create INDEX COLLECTION [BODY]`](#kourou-collectioncreate-index-collection-body)
- [`kourou collection:export INDEX COLLECTION`](#kourou-collectionexport-index-collection)
- [`kourou collection:import PATH`](#kourou-collectionimport-path)
- [`kourou collection:migrate SCRIPT PATH`](#kourou-collectionmigrate-script-path)
- [`kourou config:diff FIRST SECOND`](#kourou-configdiff-first-second)
- [`kourou document:search INDEX COLLECTION [QUERY]`](#kourou-documentsearch-index-collection-query)
- [`kourou es:aliases:cat`](#kourou-esaliasescat)
- [`kourou es:indices:cat`](#kourou-esindicescat)
- [`kourou es:indices:get INDEX ID`](#kourou-esindicesget-index-id)
- [`kourou es:indices:insert INDEX`](#kourou-esindicesinsert-index)
- [`kourou es:migrate`](#kourou-esmigrate)
- [`kourou es:snapshot:create REPOSITORY NAME`](#kourou-essnapshotcreate-repository-name)
- [`kourou es:snapshot:create-repository REPOSITORY LOCATION`](#kourou-essnapshotcreate-repository-repository-location)
- [`kourou es:snapshot:list REPOSITORY`](#kourou-essnapshotlist-repository)
- [`kourou file:decrypt FILE`](#kourou-filedecrypt-file)
- [`kourou file:encrypt FILE`](#kourou-fileencrypt-file)
- [`kourou file:test FILE`](#kourou-filetest-file)
- [`kourou help [COMMAND]`](#kourou-help-command)
- [`kourou import PATH`](#kourou-import-path)
- [`kourou index:export INDEX`](#kourou-indexexport-index)
- [`kourou index:import PATH`](#kourou-indeximport-path)
- [`kourou instance:kill`](#kourou-instancekill)
- [`kourou instance:list`](#kourou-instancelist)
- [`kourou instance:logs`](#kourou-instancelogs)
- [`kourou instance:spawn`](#kourou-instancespawn)
- [`kourou paas:deploy ENVIRONMENT APPLICATIONID IMAGE`](#kourou-paasdeploy-environment-applicationid-image)
- [`kourou paas:init PROJECT`](#kourou-paasinit-project)
- [`kourou paas:login`](#kourou-paaslogin)
- [`kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID`](#kourou-paassnapshotscat-environment-applicationid)
- [`kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID`](#kourou-paassnapshotsdump-environment-applicationid)
- [`kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID`](#kourou-paassnapshotsrestore-environment-applicationid-snapshotid)
- [`kourou profile:export`](#kourou-profileexport)
- [`kourou profile:import PATH`](#kourou-profileimport-path)
- [`kourou realtime:subscribe INDEX COLLECTION [FILTERS]`](#kourou-realtimesubscribe-index-collection-filters)
- [`kourou redis:list-keys [MATCH]`](#kourou-redislist-keys-match)
- [`kourou role:export`](#kourou-roleexport)
- [`kourou role:import PATH`](#kourou-roleimport-path)
- [`kourou sdk:execute [CODE]`](#kourou-sdkexecute-code)
- [`kourou sdk:query CONTROLLER:ACTION`](#kourou-sdkquery-controlleraction)
- [`kourou user:export`](#kourou-userexport)
- [`kourou user:export-mappings`](#kourou-userexport-mappings)
- [`kourou user:import PATH`](#kourou-userimport-path)
- [`kourou user:import-mappings PATH`](#kourou-userimport-mappings-path)
- [`kourou vault:add SECRETS-FILE KEY VALUE`](#kourou-vaultadd-secrets-file-key-value)
- [`kourou vault:decrypt FILE`](#kourou-vaultdecrypt-file)
- [`kourou vault:encrypt FILE`](#kourou-vaultencrypt-file)
- [`kourou vault:show SECRETS-FILE [KEY]`](#kourou-vaultshow-secrets-file-key)
- [`kourou vault:test SECRETS-FILE`](#kourou-vaulttest-secrets-file)
- [Where does this weird name come from?](#where-does-this-weird-name-come-from)
- [Have fun with a quine](#have-fun-with-a-quine)
- [Telemetry](#telemetry)
* [`kourou api-key:check TOKEN`](#kourou-api-keycheck-token)
* [`kourou api-key:create USER`](#kourou-api-keycreate-user)
* [`kourou api-key:delete USER ID`](#kourou-api-keydelete-user-id)
* [`kourou api-key:search USER`](#kourou-api-keysearch-user)
* [`kourou app:debug-proxy`](#kourou-appdebug-proxy)
* [`kourou app:doctor`](#kourou-appdoctor)
* [`kourou app:scaffold DESTINATION`](#kourou-appscaffold-destination)
* [`kourou app:start-services`](#kourou-appstart-services)
* [`kourou autocomplete [SHELL]`](#kourou-autocomplete-shell)
* [`kourou collection:create INDEX COLLECTION [BODY]`](#kourou-collectioncreate-index-collection-body)
* [`kourou collection:export INDEX COLLECTION`](#kourou-collectionexport-index-collection)
* [`kourou collection:import PATH`](#kourou-collectionimport-path)
* [`kourou collection:migrate SCRIPT PATH`](#kourou-collectionmigrate-script-path)
* [`kourou config:diff FIRST SECOND`](#kourou-configdiff-first-second)
* [`kourou document:search INDEX COLLECTION [QUERY]`](#kourou-documentsearch-index-collection-query)
* [`kourou es:aliases:cat`](#kourou-esaliasescat)
* [`kourou es:indices:cat`](#kourou-esindicescat)
* [`kourou es:indices:get INDEX ID`](#kourou-esindicesget-index-id)
* [`kourou es:indices:insert INDEX`](#kourou-esindicesinsert-index)
* [`kourou es:migrate`](#kourou-esmigrate)
* [`kourou es:snapshot:create REPOSITORY NAME`](#kourou-essnapshotcreate-repository-name)
* [`kourou es:snapshot:create-repository REPOSITORY LOCATION`](#kourou-essnapshotcreate-repository-repository-location)
* [`kourou es:snapshot:list REPOSITORY`](#kourou-essnapshotlist-repository)
* [`kourou file:decrypt FILE`](#kourou-filedecrypt-file)
* [`kourou file:encrypt FILE`](#kourou-fileencrypt-file)
* [`kourou file:test FILE`](#kourou-filetest-file)
* [`kourou help [COMMAND]`](#kourou-help-command)
* [`kourou import PATH`](#kourou-import-path)
* [`kourou index:export INDEX`](#kourou-indexexport-index)
* [`kourou index:import PATH`](#kourou-indeximport-path)
* [`kourou instance:kill`](#kourou-instancekill)
* [`kourou instance:list`](#kourou-instancelist)
* [`kourou instance:logs`](#kourou-instancelogs)
* [`kourou instance:spawn`](#kourou-instancespawn)
* [`kourou paas:deploy ENVIRONMENT APPLICATIONID IMAGE`](#kourou-paasdeploy-environment-applicationid-image)
* [`kourou paas:init PROJECT`](#kourou-paasinit-project)
* [`kourou paas:login`](#kourou-paaslogin)
* [`kourou paas:logs ENVIRONMENT APPLICATION`](#kourou-paaslogs-environment-application)
* [`kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID`](#kourou-paassnapshotscat-environment-applicationid)
* [`kourou paas:snapshots:dump ENVIRONMENT APPLICATIONID`](#kourou-paassnapshotsdump-environment-applicationid)
* [`kourou paas:snapshots:restore ENVIRONMENT APPLICATIONID SNAPSHOTID`](#kourou-paassnapshotsrestore-environment-applicationid-snapshotid)
* [`kourou profile:export`](#kourou-profileexport)
* [`kourou profile:import PATH`](#kourou-profileimport-path)
* [`kourou realtime:subscribe INDEX COLLECTION [FILTERS]`](#kourou-realtimesubscribe-index-collection-filters)
* [`kourou redis:list-keys [MATCH]`](#kourou-redislist-keys-match)
* [`kourou role:export`](#kourou-roleexport)
* [`kourou role:import PATH`](#kourou-roleimport-path)
* [`kourou sdk:execute [CODE]`](#kourou-sdkexecute-code)
* [`kourou sdk:query CONTROLLER:ACTION`](#kourou-sdkquery-controlleraction)
* [`kourou user:export`](#kourou-userexport)
* [`kourou user:export-mappings`](#kourou-userexport-mappings)
* [`kourou user:import PATH`](#kourou-userimport-path)
* [`kourou user:import-mappings PATH`](#kourou-userimport-mappings-path)
* [`kourou vault:add SECRETS-FILE KEY VALUE`](#kourou-vaultadd-secrets-file-key-value)
* [`kourou vault:decrypt FILE`](#kourou-vaultdecrypt-file)
* [`kourou vault:encrypt FILE`](#kourou-vaultencrypt-file)
* [`kourou vault:show SECRETS-FILE [KEY]`](#kourou-vaultshow-secrets-file-key)
* [`kourou vault:test SECRETS-FILE`](#kourou-vaulttest-secrets-file)

@@ -382,5 +374,3 @@ ## `kourou api-key:check TOKEN`

OPTIONS
--flavor=flavor [default: generic] Template flavor ("generic", "iot-backend", "iot-console").
Those can be found here: https://github.com/kuzzleio/project-templates
--flavor=flavor [default: generic] Template flavor ("generic", "iot").
--help show CLI help

@@ -427,3 +417,3 @@ ```

_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.3.0/src/commands/autocomplete/index.ts)_
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.3.10/src/commands/autocomplete/index.ts)_

@@ -892,3 +882,3 @@ ## `kourou collection:create INDEX COLLECTION [BODY]`

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.2/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.18/src/commands/help.ts)_

@@ -1116,2 +1106,27 @@ ## `kourou import PATH`

## `kourou paas:logs ENVIRONMENT APPLICATION`
Show logs of the targeted application
```
USAGE
$ kourou paas:logs ENVIRONMENT APPLICATION
ARGUMENTS
ENVIRONMENT Kuzzle PaaS environment
APPLICATION Kuzzle PaaS application
OPTIONS
-f, --follow Follow log output
-n, --tail=tail Number of lines to show from the end of the logs
-t, --timestamp Show timestamp
--help show CLI help
--podName=podName Name of the pod to show logs from
--project=project Current PaaS project
--since=since Display logs from a specific absolute (e.g. 2022/12/02 09:41) or relative (e.g. a minute ago) time
--until=until Display logs until a specific absolute (e.g. 2022/12/02 09:41) or relative (e.g. a minute ago) time
```
_See code: [src/commands/paas/logs.ts](src/commands/paas/logs.ts)_
## `kourou paas:snapshots:cat ENVIRONMENT APPLICATIONID`

@@ -1133,2 +1148,5 @@

--token=token Authentication token
EXAMPLE
kourou paas:snapshots:cat --project paas-project-myproject api main
```

@@ -1140,3 +1158,3 @@

List all snapshots for a given kuzzle application in a environment
Create a new snapshot of the current application state

@@ -1155,2 +1173,5 @@ ```

--token=token Authentication token
EXAMPLE
kourou paas:snapshots:dump --project paas-project-myproject api main
```

@@ -1162,3 +1183,3 @@

List all snapshots for a given kuzzle application in a environment
Restore a snapshot of the current application state

@@ -1178,2 +1199,5 @@ ```

--token=token Authentication token
EXAMPLE
kourou paas:snapshots:restore --project paas-project-myproject api main snapshot-id
```

@@ -1180,0 +1204,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