@tryhuset/foundation-utils 4.84.2 → 4.84.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryhuset/foundation-utils",
3
- "version": "4.84.2",
3
+ "version": "4.84.3",
4
4
  "description": "Public utility CLI tools for Foundation server framework. Provides generic tools for database and Docker management.",
5
5
  "author": "TRY Creative Tech <creativetech@try.no>",
6
6
  "license": "MIT",
@@ -17,10 +17,6 @@
17
17
  "type": "git",
18
18
  "url": "git+https://github.com/tryhuset/foundation-server.git"
19
19
  },
20
- "publishConfig": {
21
- "access": "public",
22
- "registry": "https://registry.npmjs.org/"
23
- },
24
20
  "engines": {
25
21
  "node": ">=22"
26
22
  },
@@ -1,8 +0,0 @@
1
- /**
2
- * Ends all active sessions in the Foundation database by updating
3
- * sessions with null endedAt to have the current date.
4
- * @param options.env - Optional path to .env file to load before reading STORAGE_URL
5
- */
6
- export declare const dbEnd: (options?: {
7
- env?: string;
8
- }) => Promise<void>;
@@ -1,51 +0,0 @@
1
- /**
2
- * Handles managing the Foundation database.
3
- * This command will handle any necessary database operations.
4
- *
5
- * Currently supports:
6
- * - Updating sessions with null endedAt to have the current date
7
- */
8
- import { MongoClient } from 'mongodb';
9
- import inquirer from 'inquirer';
10
- import { exitProcess } from '../utils/processExit.js';
11
- import { loadEnv } from '../utils/loadEnv.js';
12
- import { getDbConfig } from '../utils/dbConfig.js';
13
- /**
14
- * Ends all active sessions in the Foundation database by updating
15
- * sessions with null endedAt to have the current date.
16
- * @param options.env - Optional path to .env file to load before reading STORAGE_URL
17
- */
18
- export const dbEnd = async (options) => {
19
- loadEnv(options?.env);
20
- const { storageUrl, dbCollection } = getDbConfig();
21
- if (!storageUrl) {
22
- console.error('STORAGE_URL environment variable not set');
23
- exitProcess(1);
24
- }
25
- try {
26
- const { confirm } = await inquirer.prompt([
27
- {
28
- type: 'confirm',
29
- name: 'confirm',
30
- message: 'This will update all sessions with null endedAt to have the current date. Continue?',
31
- default: false
32
- }
33
- ]);
34
- if (!confirm) {
35
- console.log('Operation cancelled');
36
- exitProcess(0);
37
- }
38
- const client = await MongoClient.connect(storageUrl);
39
- const db = client.db();
40
- const result = await db
41
- .collection(dbCollection)
42
- .updateMany({ endedAt: null }, { $set: { endedAt: new Date() } });
43
- console.log(`Updated ${result.modifiedCount} sessions`);
44
- await client.close();
45
- }
46
- catch (error) {
47
- console.error('Failed to update sessions:', error);
48
- exitProcess(1);
49
- }
50
- };
51
- //# sourceMappingURL=dbEnd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dbEnd.js","sourceRoot":"","sources":["../../../src/commands/dbEnd.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,OAA0B,EAAE,EAAE;IACxD,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,WAAW,EAAE,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC1D,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACxC;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS;gBACf,OAAO,EACL,qFAAqF;gBACvF,OAAO,EAAE,KAAK;aACf;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,WAAW,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,UAAW,CAAC,CAAC;QACtD,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,EAAE,CAAC;QAEvB,MAAM,MAAM,GAAG,MAAM,EAAE;aACpB,UAAU,CAAC,YAAY,CAAC;aACxB,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAEpE,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,aAAa,WAAW,CAAC,CAAC;QACxD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACH,CAAC,CAAC"}
@@ -1,12 +0,0 @@
1
- interface DbExportOptions {
2
- env?: string;
3
- path: string;
4
- }
5
- /**
6
- * Exports the database to a mongodump backup directory.
7
- * Requires mongodump to be installed (MongoDB Database Tools).
8
- * @param options.env - Optional path to .env file
9
- * @param options.path - Path to the output directory for the dump
10
- */
11
- export declare const dbExport: (options: DbExportOptions) => Promise<void>;
12
- export {};
@@ -1,37 +0,0 @@
1
- /**
2
- * Exports the Foundation database to a mongodump backup.
3
- */
4
- import { execSync } from 'child_process';
5
- import { mkdirSync, existsSync } from 'fs';
6
- import { exitProcess } from '../utils/processExit.js';
7
- import { loadEnv } from '../utils/loadEnv.js';
8
- import { getDbConfig } from '../utils/dbConfig.js';
9
- /**
10
- * Exports the database to a mongodump backup directory.
11
- * Requires mongodump to be installed (MongoDB Database Tools).
12
- * @param options.env - Optional path to .env file
13
- * @param options.path - Path to the output directory for the dump
14
- */
15
- export const dbExport = async (options) => {
16
- loadEnv(options?.env);
17
- const { storageUrl } = getDbConfig();
18
- if (!storageUrl) {
19
- console.error('STORAGE_URL environment variable not set');
20
- exitProcess(1);
21
- }
22
- const outPath = options.path;
23
- try {
24
- if (!existsSync(outPath)) {
25
- mkdirSync(outPath, { recursive: true });
26
- }
27
- execSync(`mongodump --uri="${storageUrl}" --out="${outPath}"`, {
28
- stdio: 'inherit'
29
- });
30
- console.log(`Export completed to ${outPath}`);
31
- }
32
- catch (error) {
33
- console.error('Failed to export:', error);
34
- exitProcess(1);
35
- }
36
- };
37
- //# sourceMappingURL=dbExport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dbExport.js","sourceRoot":"","sources":["../../../src/commands/dbExport.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAwB,EAAE,EAAE;IACzD,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAC;IAErC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC1D,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7B,IAAI,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC;QAED,QAAQ,CAAC,oBAAoB,UAAU,YAAY,OAAO,GAAG,EAAE;YAC7D,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAC1C,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACH,CAAC,CAAC"}
@@ -1,14 +0,0 @@
1
- interface DbImportOptions {
2
- env?: string;
3
- path: string;
4
- force?: boolean;
5
- }
6
- /**
7
- * Imports the database from a mongodump backup directory.
8
- * Requires mongorestore to be installed (MongoDB Database Tools).
9
- * @param options.env - Optional path to .env file
10
- * @param options.path - Path to the dump directory (output of mongodump)
11
- * @param options.force - Skip confirmation prompt
12
- */
13
- export declare const dbImport: (options: DbImportOptions) => Promise<void>;
14
- export {};
@@ -1,54 +0,0 @@
1
- /**
2
- * Imports the Foundation database from a mongodump backup.
3
- */
4
- import { execSync } from 'child_process';
5
- import { existsSync } from 'fs';
6
- import inquirer from 'inquirer';
7
- import { exitProcess } from '../utils/processExit.js';
8
- import { loadEnv } from '../utils/loadEnv.js';
9
- import { getDbConfig } from '../utils/dbConfig.js';
10
- /**
11
- * Imports the database from a mongodump backup directory.
12
- * Requires mongorestore to be installed (MongoDB Database Tools).
13
- * @param options.env - Optional path to .env file
14
- * @param options.path - Path to the dump directory (output of mongodump)
15
- * @param options.force - Skip confirmation prompt
16
- */
17
- export const dbImport = async (options) => {
18
- loadEnv(options?.env);
19
- const { storageUrl } = getDbConfig();
20
- if (!storageUrl) {
21
- console.error('STORAGE_URL environment variable not set');
22
- exitProcess(1);
23
- }
24
- const dumpPath = options.path;
25
- if (!existsSync(dumpPath)) {
26
- console.error(`Dump path not found: ${dumpPath}`);
27
- exitProcess(1);
28
- }
29
- try {
30
- if (!options.force) {
31
- const { confirm } = await inquirer.prompt([
32
- {
33
- type: 'confirm',
34
- name: 'confirm',
35
- message: `Import database from ${dumpPath}? This will overwrite existing data.`,
36
- default: false
37
- }
38
- ]);
39
- if (!confirm) {
40
- console.log('Operation cancelled');
41
- exitProcess(0);
42
- }
43
- }
44
- execSync(`mongorestore --uri="${storageUrl}" "${dumpPath}"`, {
45
- stdio: 'inherit'
46
- });
47
- console.log('Import completed');
48
- }
49
- catch (error) {
50
- console.error('Failed to import:', error);
51
- exitProcess(1);
52
- }
53
- };
54
- //# sourceMappingURL=dbImport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dbImport.js","sourceRoot":"","sources":["../../../src/commands/dbImport.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,OAAwB,EAAE,EAAE;IACzD,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAC;IAErC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC1D,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAE9B,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,KAAK,CAAC,wBAAwB,QAAQ,EAAE,CAAC,CAAC;QAClD,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;gBACxC;oBACE,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE,wBAAwB,QAAQ,sCAAsC;oBAC/E,OAAO,EAAE,KAAK;iBACf;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;gBACnC,WAAW,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;QAED,QAAQ,CAAC,uBAAuB,UAAU,MAAM,QAAQ,GAAG,EAAE;YAC3D,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAC1C,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACH,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- interface DbListOptions {
2
- env?: string;
3
- limit?: number;
4
- active?: boolean;
5
- fields?: string[];
6
- }
7
- /**
8
- * Lists sessions in the Foundation database.
9
- * @param options.env - Optional path to .env file
10
- * @param options.limit - Max number of sessions to show (default 50)
11
- * @param options.active - Only show active sessions (endedAt null)
12
- * @param options.fields - Additional fields to show (comma-separated). Missing fields show '-'.
13
- */
14
- export declare const dbList: (options?: DbListOptions) => Promise<void>;
15
- export {};
@@ -1,76 +0,0 @@
1
- /**
2
- * Lists sessions in the Foundation database.
3
- */
4
- import { MongoClient } from 'mongodb';
5
- import { exitProcess } from '../utils/processExit.js';
6
- import { loadEnv } from '../utils/loadEnv.js';
7
- import { getDbConfig } from '../utils/dbConfig.js';
8
- const formatFieldValue = (value) => {
9
- if (value === null || value === undefined)
10
- return '-';
11
- if (value instanceof Date)
12
- return value.toISOString();
13
- if (typeof value === 'object')
14
- return JSON.stringify(value);
15
- return String(value);
16
- };
17
- /**
18
- * Lists sessions in the Foundation database.
19
- * @param options.env - Optional path to .env file
20
- * @param options.limit - Max number of sessions to show (default 50)
21
- * @param options.active - Only show active sessions (endedAt null)
22
- * @param options.fields - Additional fields to show (comma-separated). Missing fields show '-'.
23
- */
24
- export const dbList = async (options) => {
25
- loadEnv(options?.env);
26
- const { storageUrl, dbCollection } = getDbConfig();
27
- if (!storageUrl) {
28
- console.error('STORAGE_URL environment variable not set');
29
- exitProcess(1);
30
- }
31
- const extraFields = options?.fields ?? [];
32
- const project = { id: 1, name: 1, startedAt: 1, endedAt: 1 };
33
- for (const f of extraFields) {
34
- if (f.trim())
35
- project[f.trim()] = 1;
36
- }
37
- try {
38
- const client = await MongoClient.connect(storageUrl);
39
- const db = client.db();
40
- const filter = {};
41
- if (options?.active) {
42
- filter.endedAt = null;
43
- }
44
- const limit = options?.limit ?? 50;
45
- const sessions = await db
46
- .collection(dbCollection)
47
- .find(filter)
48
- .sort({ startedAt: -1 })
49
- .limit(limit)
50
- .project(project)
51
- .toArray();
52
- await client.close();
53
- if (sessions.length === 0) {
54
- console.log('No sessions found');
55
- return;
56
- }
57
- const baseHeaders = ['ID', 'Name', 'Started', 'Ended'];
58
- const headers = [...baseHeaders, ...extraFields.map((f) => f.trim()).filter(Boolean)];
59
- const rows = sessions.map((s) => {
60
- const started = s.startedAt ? new Date(s.startedAt).toISOString() : '-';
61
- const ended = s.endedAt ? new Date(s.endedAt).toISOString() : 'active';
62
- const base = [s.id, String(s.name || '-'), started, ended];
63
- const extras = extraFields.map((f) => formatFieldValue(s[f.trim()]));
64
- return [...base, ...extras].join('\t');
65
- });
66
- console.log(headers.join('\t'));
67
- console.log('-'.repeat(Math.min(80, headers.join('\t').length + 20)));
68
- rows.forEach((r) => console.log(r));
69
- console.log(`\nTotal: ${sessions.length} session(s)`);
70
- }
71
- catch (error) {
72
- console.error('Failed to list sessions:', error);
73
- exitProcess(1);
74
- }
75
- };
76
- //# sourceMappingURL=dbList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dbList.js","sourceRoot":"","sources":["../../../src/commands/dbList.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASnD,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAU,EAAE;IAClD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IACtD,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAuB,EAAE,EAAE;IACtD,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,WAAW,EAAE,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CA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,EAAE,CAAC,CAAC,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,YAAY,QAAQ,CAAC,MAAM,aAAa,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;QACjD,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACH,CAAC,CAAC"}
@@ -1,14 +0,0 @@
1
- interface DbRestoreOptions {
2
- env?: string;
3
- sessionId: string;
4
- force?: boolean;
5
- }
6
- /**
7
- * Restores a session by ID. Ends any active session first, then sets the target session as active.
8
- * Restart the server to pick up the restored session.
9
- * @param options.env - Optional path to .env file
10
- * @param options.sessionId - Session ID to restore (from db list)
11
- * @param options.force - Skip confirmation prompt
12
- */
13
- export declare const dbRestore: (options: DbRestoreOptions) => Promise<void>;
14
- export {};
@@ -1,69 +0,0 @@
1
- /**
2
- * Restores a session by ID, making it active. Ends the current active session if one exists.
3
- */
4
- import { MongoClient } from 'mongodb';
5
- import inquirer from 'inquirer';
6
- import { exitProcess } from '../utils/processExit.js';
7
- import { loadEnv } from '../utils/loadEnv.js';
8
- import { getDbConfig } from '../utils/dbConfig.js';
9
- /**
10
- * Restores a session by ID. Ends any active session first, then sets the target session as active.
11
- * Restart the server to pick up the restored session.
12
- * @param options.env - Optional path to .env file
13
- * @param options.sessionId - Session ID to restore (from db list)
14
- * @param options.force - Skip confirmation prompt
15
- */
16
- export const dbRestore = async (options) => {
17
- loadEnv(options?.env);
18
- const { storageUrl, dbCollection } = getDbConfig();
19
- if (!storageUrl) {
20
- console.error('STORAGE_URL environment variable not set');
21
- exitProcess(1);
22
- }
23
- const sessionId = options.sessionId;
24
- try {
25
- const client = await MongoClient.connect(storageUrl);
26
- const db = client.db();
27
- const collection = db.collection(dbCollection);
28
- const targetSession = await collection.findOne({ id: sessionId });
29
- if (!targetSession) {
30
- console.error(`Session not found: ${sessionId}`);
31
- await client.close();
32
- exitProcess(1);
33
- }
34
- const sessionName = targetSession.name ?? sessionId;
35
- if (!options.force) {
36
- const { confirm } = await inquirer.prompt([
37
- {
38
- type: 'confirm',
39
- name: 'confirm',
40
- message: `Restore session "${sessionName}"? This will end the current active session if one exists.`,
41
- default: false
42
- }
43
- ]);
44
- if (!confirm) {
45
- console.log('Operation cancelled');
46
- await client.close();
47
- exitProcess(0);
48
- }
49
- }
50
- const now = new Date();
51
- const endResult = await collection.updateMany({ id: { $ne: sessionId }, endedAt: null }, { $set: { endedAt: now } });
52
- const restoreResult = await collection.updateOne({ id: sessionId }, { $set: { endedAt: null } });
53
- await client.close();
54
- if (endResult.modifiedCount > 0) {
55
- console.log(`Ended ${endResult.modifiedCount} active session(s)`);
56
- }
57
- if (restoreResult.modifiedCount > 0) {
58
- console.log(`Restored session ${sessionId}. Restart the server to pick it up.`);
59
- }
60
- else {
61
- console.log(`Session ${sessionId} is already active.`);
62
- }
63
- }
64
- catch (error) {
65
- console.error('Failed to restore session:', error);
66
- exitProcess(1);
67
- }
68
- };
69
- //# sourceMappingURL=dbRestore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dbRestore.js","sourceRoot":"","sources":["../../../src/commands/dbRestore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,OAAyB,EAAE,EAAE;IAC3D,OAAO,C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BACrB,WAAW,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QAEvB,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,UAAU,CAC3C,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EACzC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,CAC3B,CAAC;QAEF,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,SAAS,CAC9C,EAAE,EAAE,EAAE,SAAS,EAAE,EACjB,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAC5B,CAAC;QAEF,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QAErB,IAAI,SAAS,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,SAAS,SAAS,CAAC,aAAa,oBAAoB,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,aAAa,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CAAC,oBAAoB,SAAS,qCAAqC,CAAC,CAAC;QAClF,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,WAAW,SAAS,qBAAqB,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,WAAW,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACH,CAAC,CAAC"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Creates a backup of Docker images and optionally updates them
3
- *
4
- * This command provides functionality to:
5
- * - Create backups of current Docker images with tagged references
6
- * - Update Docker images to their latest versions
7
- * - Manage the backup process with various options
8
- * - Create a modified compose file that references the backup tags
9
- * - Restore from a provided backup compose file
10
- * @param options The options for the docker command
11
- * @param options.file The path to the Docker Compose file
12
- * @param options.force Whether to force the operation
13
- * @param options.backupOnly Whether to only create a backup
14
- * @param options.noBackup Whether to not create a backup
15
- * @param options.backupFile The path to a backup compose file to restore from
16
- */
17
- export declare function docker(options: {
18
- file: string;
19
- force?: boolean;
20
- backupOnly?: boolean;
21
- noBackup?: boolean;
22
- backupFile?: string;
23
- }): Promise<void>;
@@ -1,176 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
3
- import { Chalk } from 'chalk';
4
- import inquirer from 'inquirer';
5
- import { exitProcess } from '../../utils/processExit.js';
6
- const chalk = new Chalk();
7
- /**
8
- * Creates a backup of Docker images and optionally updates them
9
- *
10
- * This command provides functionality to:
11
- * - Create backups of current Docker images with tagged references
12
- * - Update Docker images to their latest versions
13
- * - Manage the backup process with various options
14
- * - Create a modified compose file that references the backup tags
15
- * - Restore from a provided backup compose file
16
- * @param options The options for the docker command
17
- * @param options.file The path to the Docker Compose file
18
- * @param options.force Whether to force the operation
19
- * @param options.backupOnly Whether to only create a backup
20
- * @param options.noBackup Whether to not create a backup
21
- * @param options.backupFile The path to a backup compose file to restore from
22
- */
23
- export async function docker(options) {
24
- const { file: COMPOSE_FILE, force, backupOnly, noBackup, backupFile } = options;
25
- // If backupFile is provided, use it instead of the original compose file
26
- const activeComposeFile = backupFile || COMPOSE_FILE;
27
- // Validate compose file exists
28
- if (!existsSync(activeComposeFile)) {
29
- console.error(chalk.red(`Error: Compose file not found at ${activeComposeFile}`));
30
- exitProcess(1);
31
- }
32
- // Configuration
33
- const BACKUP_DIR = './docker_image_backups';
34
- const DATE_FORMAT = new Date().toISOString().replace(/[:.]/g, '').slice(0, 15);
35
- // Check for conflicting options
36
- if (noBackup && backupOnly) {
37
- console.error(chalk.red('Error: Cannot use both --no-backup and --backup-only options together'));
38
- exitProcess(1);
39
- }
40
- if (backupFile && (backupOnly || noBackup)) {
41
- console.error(chalk.red('Error: Cannot use --backup-file with --backup-only or --no-backup options'));
42
- exitProcess(1);
43
- }
44
- // Create backup directory if it doesn't exist
45
- if (!existsSync(BACKUP_DIR)) {
46
- mkdirSync(BACKUP_DIR, { recursive: true });
47
- }
48
- // Confirm the user intention if not forced
49
- if (!force) {
50
- let message = '';
51
- if (backupFile) {
52
- message = `WARNING: This will restart all server processes using backup file: ${backupFile}`;
53
- }
54
- else if (backupOnly) {
55
- message = 'This will create a backup of current Docker images (no system update)';
56
- }
57
- else if (noBackup) {
58
- message = 'WARNING: This will restart all server processes WITHOUT creating a backup';
59
- }
60
- else {
61
- message = 'WARNING: This will restart all server processes';
62
- }
63
- const { confirm } = await inquirer.prompt([
64
- {
65
- type: 'confirm',
66
- name: 'confirm',
67
- message: chalk.yellow(message),
68
- default: false
69
- }
70
- ]);
71
- if (!confirm) {
72
- console.log(chalk.yellow('Operation aborted'));
73
- exitProcess(1);
74
- }
75
- }
76
- // Create a backup of the Docker images (only if not using a backup file)
77
- if (!noBackup && !backupFile) {
78
- console.log(chalk.blue('Creating backup of Docker images...'));
79
- // Read the original compose file
80
- const composeContent = readFileSync(COMPOSE_FILE, 'utf8');
81
- let modifiedComposeContent = composeContent;
82
- // Get list of services
83
- const services = execSync(`docker compose -f "${COMPOSE_FILE}" ps --services`)
84
- .toString()
85
- .trim()
86
- .split('\n');
87
- // Create container info file with image IDs
88
- const imageInfoFile = `${BACKUP_DIR}/image_info_${DATE_FORMAT}.txt`;
89
- let imageInfo = `Docker Images Backup: ${DATE_FORMAT}\n`;
90
- imageInfo += '----------------------------------------------\n';
91
- // For each service, extract the image information and update compose file
92
- for (const service of services) {
93
- console.log(chalk.blue(`Documenting service: ${service}`));
94
- try {
95
- const containerId = execSync(`docker compose -f "${COMPOSE_FILE}" ps -q "${service}"`)
96
- .toString()
97
- .trim();
98
- if (containerId) {
99
- // Get image info
100
- const imageId = execSync(`docker inspect --format='{{.Image}}' "${containerId}"`)
101
- .toString()
102
- .trim();
103
- const imageName = execSync(`docker inspect --format='{{.Config.Image}}' "${containerId}"`)
104
- .toString()
105
- .trim();
106
- imageInfo += `SERVICE: ${service}\n`;
107
- imageInfo += `IMAGE ID: ${imageId}\n`;
108
- imageInfo += `IMAGE NAME: ${imageName}\n`;
109
- imageInfo += '---\n';
110
- // Tag the current image with our backup tag
111
- if (imageName) {
112
- const backupTag = `${imageName.split(':')[0]}:backup_${DATE_FORMAT}`;
113
- console.log(chalk.blue(`Tagging ${imageName} as ${backupTag}`));
114
- execSync(`docker tag "${imageName}" "${backupTag}"`);
115
- imageInfo += `BACKUP TAG: ${backupTag}\n\n`;
116
- // Update the compose file to reference the backup tag
117
- const originalImageRegex = new RegExp(`image:\\s*${imageName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`, 'g');
118
- modifiedComposeContent = modifiedComposeContent.replace(originalImageRegex, `image: ${backupTag}`);
119
- }
120
- }
121
- }
122
- catch {
123
- console.warn(chalk.yellow(`Warning: Could not process service ${service}`));
124
- continue;
125
- }
126
- }
127
- // Write the modified compose file with backup tags
128
- writeFileSync(`${BACKUP_DIR}/docker-compose_${DATE_FORMAT}.yaml`, modifiedComposeContent);
129
- writeFileSync(imageInfoFile, imageInfo);
130
- console.log(chalk.green(`Backup complete. Image information saved to: ${imageInfoFile}`));
131
- console.log(chalk.green(`Modified compose file saved to: ${BACKUP_DIR}/docker-compose_${DATE_FORMAT}.yaml`));
132
- }
133
- // Perform update steps unless this is backup-only mode
134
- if (!backupOnly) {
135
- console.log(chalk.blue('Starting update process...'));
136
- // Take down the current Docker Compose setup
137
- execSync(`docker compose -f "${activeComposeFile}" down`);
138
- // Pull the latest images specified in the Docker Compose file
139
- execSync(`docker compose -f "${activeComposeFile}" pull`);
140
- // Remove the dangling images to not get into a no space left situation
141
- console.log(chalk.blue('Cleaning up dangling images...'));
142
- try {
143
- const cleanupOutput = execSync('docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi').toString();
144
- console.log(cleanupOutput);
145
- }
146
- catch {
147
- // Ignore errors if no dangling images
148
- }
149
- // Start up the Docker Compose setup in detached mode
150
- execSync(`docker compose -f "${activeComposeFile}" up -d`);
151
- console.log(chalk.green('Update completed successfully.'));
152
- }
153
- // Operation summary
154
- if (backupFile) {
155
- console.log(chalk.green(`Restore completed successfully using backup file: ${backupFile}`));
156
- }
157
- else if (backupOnly) {
158
- console.log(chalk.green('Backup-only operation completed successfully.'));
159
- }
160
- else {
161
- if (noBackup) {
162
- console.log(chalk.green('Update completed with no backup.'));
163
- }
164
- else {
165
- console.log(chalk.green('Update completed with backup.'));
166
- }
167
- }
168
- if (!noBackup && !backupFile) {
169
- console.log(chalk.blue('Backup information:'));
170
- console.log(chalk.blue(`Backup location: ${BACKUP_DIR}`));
171
- console.log(chalk.blue(`Backup timestamp: ${DATE_FORMAT}`));
172
- console.log(chalk.blue(`Image info file: ${BACKUP_DIR}/image_info_${DATE_FORMAT}.txt`));
173
- console.log(chalk.blue(`Modified Docker Compose file: ${BACKUP_DIR}/docker-compose_${DATE_FORMAT}.yaml`));
174
- }
175
- }
176
- //# sourceMappingURL=docker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../../src/commands/docker/docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAExE,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;AAE1B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAM5B;IACC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,U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ose file path. Uses default if not provided.
3
- * Logs which file is being used and validates it exists.
4
- */
5
- export declare const resolveComposeFile: (file?: string) => string;
@@ -1,22 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import { Chalk } from 'chalk';
3
- import { exitProcess } from '../../utils/processExit.js';
4
- const chalk = new Chalk();
5
- const DEFAULT_COMPOSE_FILE = './compose.yaml';
6
- /**
7
- * Resolves the compose file path. Uses default if not provided.
8
- * Logs which file is being used and validates it exists.
9
- */
10
- export const resolveComposeFile = (file) => {
11
- const composeFile = file ?? DEFAULT_COMPOSE_FILE;
12
- const isDefault = !file;
13
- if (isDefault) {
14
- console.log(chalk.blue(`Using compose file: ${composeFile} (default)`));
15
- }
16
- if (!existsSync(composeFile)) {
17
- console.error(chalk.red(`Error: Compose file not found at ${composeFile}`));
18
- exitProcess(1);
19
- }
20
- return composeFile;
21
- };
22
- //# sourceMappingURL=resolveComposeFile.js.map