farseer-cli 1.9.0 → 1.10.0
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/README.md +37 -33
- package/dist/commands/app.js +9 -35
- package/dist/commands/app.js.map +2 -2
- package/dist/commands/apps.js +3 -9
- package/dist/commands/apps.js.map +2 -2
- package/dist/commands/cells.js +3 -11
- package/dist/commands/cells.js.map +2 -2
- package/dist/commands/config.js +4 -4
- package/dist/commands/config.js.map +2 -2
- package/dist/commands/dashboards.js +3 -11
- package/dist/commands/dashboards.js.map +2 -2
- package/dist/commands/diff.js +3 -7
- package/dist/commands/diff.js.map +2 -2
- package/dist/commands/dimensions.js +9 -31
- package/dist/commands/dimensions.js.map +2 -2
- package/dist/commands/files.js +4 -9
- package/dist/commands/files.js.map +2 -2
- package/dist/commands/formula.js +2 -6
- package/dist/commands/formula.js.map +2 -2
- package/dist/commands/list.js +4 -9
- package/dist/commands/list.js.map +2 -2
- package/dist/commands/model.js +2 -8
- package/dist/commands/model.js.map +2 -2
- package/dist/commands/pull.js +16 -9
- package/dist/commands/pull.js.map +2 -2
- package/dist/commands/push.js +5 -9
- package/dist/commands/push.js.map +2 -2
- package/dist/commands/refresh.js +3 -8
- package/dist/commands/refresh.js.map +2 -2
- package/dist/commands/run.js +3 -6
- package/dist/commands/run.js.map +2 -2
- package/dist/commands/sheets.js +5 -21
- package/dist/commands/sheets.js.map +2 -2
- package/dist/commands/status.js +4 -9
- package/dist/commands/status.js.map +2 -2
- package/dist/commands/variables.js +8 -30
- package/dist/commands/variables.js.map +2 -2
- package/dist/commands/whoami.js +11 -0
- package/dist/commands/whoami.js.map +2 -2
- package/dist/index.js +22 -23
- package/dist/index.js.map +2 -2
- package/dist/mcp/resources/documentation.js +1 -1
- package/dist/mcp/resources/documentation.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/appTools.js +10 -30
- package/dist/mcp/tools/appTools.js.map +2 -2
- package/dist/mcp/tools/cellTools.js +2 -6
- package/dist/mcp/tools/cellTools.js.map +2 -2
- package/dist/mcp/tools/dashboardTools.js +22 -66
- package/dist/mcp/tools/dashboardTools.js.map +2 -2
- package/dist/mcp/tools/dataTools.js +9 -25
- package/dist/mcp/tools/dataTools.js.map +2 -2
- package/dist/mcp/tools/folderTools.js +4 -12
- package/dist/mcp/tools/folderTools.js.map +2 -2
- package/dist/mcp/tools/modelTools.js +30 -84
- package/dist/mcp/tools/modelTools.js.map +2 -2
- package/dist/mcp/tools/runTools.js +4 -12
- package/dist/mcp/tools/runTools.js.map +2 -2
- package/dist/mcp/tools/sheetTools.js +20 -60
- package/dist/mcp/tools/sheetTools.js.map +2 -2
- package/dist/mcp/tools/syncTools.js +8 -30
- package/dist/mcp/tools/syncTools.js.map +2 -2
- package/dist/mcp/utils/helpers.js +4 -17
- package/dist/mcp/utils/helpers.js.map +2 -2
- package/dist/mcp/utils/launchPin.js.map +2 -2
- package/dist/services/configService.js +0 -45
- package/dist/services/configService.js.map +2 -2
- package/dist/services/farseerFactory.js +79 -0
- package/dist/services/farseerFactory.js.map +3 -3
- package/dist/services/preflight.js +115 -0
- package/dist/services/preflight.js.map +7 -0
- package/dist/utils/fileValidation.js +1 -0
- package/dist/utils/fileValidation.js.map +2 -2
- package/dist/utils/helpers.js +42 -48
- package/dist/utils/helpers.js.map +2 -2
- package/dist/utils/workspace.js +1 -1
- package/dist/utils/workspace.js.map +2 -2
- package/docs/api-reference.md +3 -3
- package/docs/arquero-patterns.md +1 -1
- package/docs/cli-guide.md +14 -9
- package/docs/how-farseer-works.md +1 -1
- package/docs/import-workflows.md +3 -3
- package/docs/new-app-template.md +1 -1
- package/docs/query-formulas.md +1 -1
- package/package.json +1 -1
- package/dist/commands/checkout.js +0 -189
- package/dist/commands/checkout.js.map +0 -7
package/dist/commands/list.js
CHANGED
|
@@ -23,22 +23,17 @@ __export(list_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(list_exports);
|
|
24
24
|
var import_logger = require("../utils/logger");
|
|
25
25
|
var import_farseerFactory = require("../services/farseerFactory");
|
|
26
|
-
var
|
|
26
|
+
var import_preflight = require("../services/preflight");
|
|
27
27
|
function registerListCommand(program) {
|
|
28
28
|
program.command("list [arg1] [arg2]").description('[DEPRECATED] Use "farseer files list" instead').option("--all", "List all files (default: only scripts .ts, .js)").action(async (arg1, arg2, options) => {
|
|
29
29
|
import_logger.logger.warning('Deprecation: "farseer list" is deprecated. Use "farseer files list" instead.');
|
|
30
30
|
console.log();
|
|
31
|
-
const {
|
|
32
|
-
const
|
|
33
|
-
if (!result) {
|
|
34
|
-
(0, import_farseerFactory.showLoginPrompt)(tenant);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
const authLabel = result.authType === "apiKey" ? "API key" : "browser login";
|
|
31
|
+
const { tenant, client, authType } = await (0, import_preflight.preflight)(arg1, arg2);
|
|
32
|
+
const authLabel = authType === "apiKey" ? "API key" : "browser login";
|
|
38
33
|
import_logger.logger.info(`Fetching files from ${tenant} (using ${authLabel})...`);
|
|
39
34
|
let files;
|
|
40
35
|
try {
|
|
41
|
-
files = await
|
|
36
|
+
files = await client.listFiles();
|
|
42
37
|
} catch (error) {
|
|
43
38
|
if ((0, import_farseerFactory.isAuthError)(error)) {
|
|
44
39
|
(0, import_farseerFactory.showLoginPrompt)(tenant);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/list.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { logger } from '../utils/logger';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AACvB,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { logger } from '../utils/logger';\nimport { showLoginPrompt, isAuthError, DEFAULT_SCRIPT_EXTENSIONS } from '../services/farseerFactory';\nimport { preflight } from '../services/preflight';\n\nexport function registerListCommand(program: Command): void {\n program\n .command('list [arg1] [arg2]')\n .description('[DEPRECATED] Use \"farseer files list\" instead')\n .option('--all', 'List all files (default: only scripts .ts, .js)')\n .action(async (arg1, arg2, options) => {\n logger.warning('Deprecation: \"farseer list\" is deprecated. Use \"farseer files list\" instead.');\n console.log();\n const { tenant, client, authType } = await preflight(arg1, arg2);\n const authLabel = authType === 'apiKey' ? 'API key' : 'browser login';\n logger.info(`Fetching files from ${tenant} (using ${authLabel})...`);\n\n let files;\n try {\n files = await client.listFiles();\n } catch (error) {\n if (isAuthError(error)) {\n showLoginPrompt(tenant);\n } else {\n logger.error('Failed to list files.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n }\n process.exit(1);\n }\n\n // Filter to scripts only unless --all is specified\n if (!options.all) {\n files = files.filter((f) =>\n DEFAULT_SCRIPT_EXTENSIONS.some((ext) => f.name.toLowerCase().endsWith(ext)),\n );\n }\n\n if (files.length === 0) {\n logger.warning('No files found in Files/');\n logger.dim(\n options.all\n ? 'The folder might be empty or does not exist.'\n : 'No script files (.ts, .js) found. Use --all to see all files.',\n );\n return;\n }\n\n logger.header(`Files on ${tenant} (Files/)`);\n\n // Group by directory\n const grouped: Record<string, string[]> = {};\n\n for (const file of files) {\n const parts = file.path.split('/');\n const fileName = parts.pop()!;\n const dir = parts.length > 0 ? parts.join('/') + '/' : '';\n\n if (!grouped[dir]) {\n grouped[dir] = [];\n }\n grouped[dir].push(fileName);\n }\n\n // Sort directories\n const dirs = Object.keys(grouped).sort();\n\n for (const dir of dirs) {\n if (dir) {\n console.log(` ${dir}`);\n }\n\n const dirFiles = grouped[dir].sort();\n for (const file of dirFiles) {\n const prefix = dir ? ' ' : ' ';\n console.log(`${prefix}${file}`);\n }\n }\n\n console.log();\n logger.dim(`Total: ${files.length} file(s)`);\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAA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AAC,QAAQ,GAAG,GAAG;AACf,gBAAQ,GAAG,IAAI,CAAC;AAAA,MACpB;AACA,cAAQ,GAAG,EAAE,KAAK,QAAQ;AAAA,IAC9B;AAGA,UAAM,OAAO,OAAO,KAAK,OAAO,EAAE,KAAK;AAEvC,eAAW,OAAO,MAAM;AACpB,UAAI,KAAK;AACL,gBAAQ,IAAI,KAAK,GAAG,EAAE;AAAA,MAC1B;AAEA,YAAM,WAAW,QAAQ,GAAG,EAAE,KAAK;AACnC,iBAAW,QAAQ,UAAU;AACzB,cAAM,SAAS,MAAM,SAAS;AAC9B,gBAAQ,IAAI,GAAG,MAAM,GAAG,IAAI,EAAE;AAAA,MAClC;AAAA,IACJ;AAEA,YAAQ,IAAI;AACZ,yBAAO,IAAI,UAAU,MAAM,MAAM,UAAU;AAAA,EAC/C,CAAC;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/model.js
CHANGED
|
@@ -23,16 +23,10 @@ __export(model_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(model_exports);
|
|
24
24
|
var import_logger = require("../utils/logger");
|
|
25
25
|
var import_farseerFactory = require("../services/farseerFactory");
|
|
26
|
-
var
|
|
26
|
+
var import_preflight = require("../services/preflight");
|
|
27
27
|
function registerModelCommand(program) {
|
|
28
28
|
program.command("model [tenant]").description("Export and display the model structure (dimensions, variables)").option("--json", "Output raw JSON").option("--tables", "Show only dimension tables").option("--variables", "Show only variables").option("--variable <name>", "Show details for specific variable").option("--table <name>", "Show details for specific dimension table").action(async (tenantArg, options) => {
|
|
29
|
-
const {
|
|
30
|
-
const result = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
31
|
-
if (!result) {
|
|
32
|
-
(0, import_farseerFactory.showLoginPrompt)(tenant);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
const api = result.client;
|
|
29
|
+
const { tenant, client: api } = await (0, import_preflight.preflight)(tenantArg);
|
|
36
30
|
try {
|
|
37
31
|
let model;
|
|
38
32
|
if (options.variable || options.variables) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/model.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { logger } from '../utils/logger';\nimport { getFarseerClientWithFallback, showLoginPrompt, isAuthError } from '../services/farseerFactory';\nimport { resolveTenantWithOrgMapping } from '../utils/helpers';\n\nexport function registerModelCommand(program: Command): void {\n program\n .command('model [tenant]')\n .description('Export and display the model structure (dimensions, variables)')\n .option('--json', 'Output raw JSON')\n .option('--tables', 'Show only dimension tables')\n .option('--variables', 'Show only variables')\n .option('--variable <name>', 'Show details for specific variable')\n .option('--table <name>', 'Show details for specific dimension table')\n .action(async (tenantArg, options) => {\n const { organisation, tenant } = resolveTenantWithOrgMapping(tenantArg);\n const result = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!result) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const api = result.client;\n\n try {\n // Pick the smallest scope that satisfies the requested\n // output. An unscoped DTAB+DMEM+VAR fetch breaks the\n // response limit on large tenants; `--json` is the\n // worst case because it asks for the whole thing.\n let model;\n if (options.variable || options.variables) {\n model = await api.exportModel({ types: ['VAR'] });\n } else if (options.table) {\n // Single-table member fetch via entities API.\n // `/model/export` with `tableGids` 500s for some\n // tables on large tenants (separate backend bug);\n // the entities path is reliable.\n const table = await api.loadDimensionTableWithMembers(options.table);\n if (!table) {\n logger.error(`Table \"${options.table}\" not found.`);\n const summary = await api.exportModel({ types: ['DTAB'] });\n logger.dim('Available tables:');\n summary.tables.slice(0, 10).forEach((t) => logger.dim(` - ${t.name}`));\n if (summary.tables.length > 10) {\n logger.dim(` ... and ${summary.tables.length - 10} more`);\n }\n process.exit(1);\n }\n model = {\n tables: [table],\n variables: [],\n dependencies: { tables: [], members: [], variables: [] },\n };\n } else if (options.tables) {\n model = await api.exportModel({ types: ['DTAB'] });\n } else {\n // Default summary view \u2014 counts of tables /\n // variables and a name preview, no member rows.\n model = await api.exportModel({ types: ['DTAB', 'VAR'] });\n }\n\n // Raw JSON output\n if (options.json) {\n console.log(JSON.stringify(model, null, 2));\n return;\n }\n\n // Specific variable details\n if (options.variable) {\n const variable = model.variables.find(\n (v) => v.name.toLowerCase() === options.variable.toLowerCase(),\n );\n if (!variable) {\n logger.error(`Variable \"${options.variable}\" not found.`);\n logger.dim('Available variables:');\n model.variables.slice(0, 10).forEach((v) => logger.dim(` - ${v.name}`));\n if (model.variables.length > 10) {\n logger.dim(` ... and ${model.variables.length - 10} more`);\n }\n process.exit(1);\n }\n\n logger.header(`Variable: ${variable.name}`);\n console.log();\n if (variable.description) {\n console.log(` Description: ${variable.description}`);\n }\n if (variable.formula) {\n console.log(` Formula: ${variable.formula}`);\n }\n console.log(` Dimensions: ${variable.tables.join(', ')}`);\n if (variable.members.length > 0) {\n console.log(` Specific members: ${variable.members.join(', ')}`);\n }\n console.log(` Roll-up type: ${variable.rollupType}`);\n console.log(` Data type: ${variable.dataType}`);\n if (variable.numberFormat) {\n console.log(\n ` Format: ${variable.numberFormat.type}${variable.numberFormat.formatString ? ` (${variable.numberFormat.formatString})` : ''}`,\n );\n }\n console.log(` Readonly: ${variable.readonly}`);\n console.log(` Calculate on demand: ${variable.calculateOnDemand}`);\n if (variable.folderPath) {\n console.log(` Folder: ${variable.folderPath.join(' / ')}`);\n }\n return;\n }\n\n // Specific table details. The dispatch above already\n // resolved name \u2192 single-table fetch and exited if the\n // table didn't exist, so model.tables is exactly [target].\n if (options.table) {\n const table = model.tables[0];\n\n logger.header(`Dimension Table: ${table.name}`);\n console.log();\n console.log(` Columns:`);\n table.columns.forEach((col, i) => {\n let colInfo = ` ${i + 1}. ${col.type}`;\n if (col.name) colInfo += ` (${col.name})`;\n if (col.foreignKeyTableName) colInfo += ` \u2192 ${col.foreignKeyTableName}`;\n console.log(colInfo);\n });\n console.log(` Members: ${table.rows.length}`);\n if (table.folderPath) {\n console.log(` Folder: ${table.folderPath.join(' / ')}`);\n }\n if (table.rows.length > 0) {\n console.log(` Sample members:`);\n table.rows.slice(0, 5).forEach((row) => {\n console.log(` - ${row[0]}`);\n });\n if (table.rows.length > 5) {\n console.log(` ... and ${table.rows.length - 5} more`);\n }\n }\n return;\n }\n\n // Tables only\n if (options.tables) {\n logger.header(`Dimension Tables (${model.tables.length})`);\n console.log();\n for (const table of model.tables) {\n const fkColumns = table.columns.filter((c) => c.type === 'FOREIGN_KEY');\n let info = ` \uD83D\uDCCB ${table.name}`;\n if (fkColumns.length > 0) {\n info += ` \u2192 ${fkColumns.map((c) => c.foreignKeyTableName).join(', ')}`;\n }\n console.log(info);\n }\n logger.dim('Run with --table <name> to see members for a specific table.');\n return;\n }\n\n // Variables only\n if (options.variables) {\n logger.header(`Variables (${model.variables.length})`);\n console.log();\n for (const variable of model.variables) {\n console.log(` \uD83D\uDCCA ${variable.name}`);\n console.log(` Dimensions: ${variable.tables.join(', ')}`);\n if (variable.formula) {\n console.log(\n ` Formula: ${variable.formula.substring(0, 50)}${variable.formula.length > 50 ? '...' : ''}`,\n );\n }\n console.log();\n }\n return;\n }\n\n // Default: summary\n logger.header(`Model Summary for ${tenant}`);\n console.log();\n console.log(` Dimension Tables: ${model.tables.length}`);\n console.log(` Variables: ${model.variables.length}`);\n console.log();\n\n logger.dim('Dimension Tables:');\n model.tables.slice(0, 10).forEach((t) => {\n logger.dim(` - ${t.name}`);\n });\n if (model.tables.length > 10) {\n logger.dim(` ... and ${model.tables.length - 10} more`);\n }\n console.log();\n\n logger.dim('Variables (first 10):');\n model.variables.slice(0, 10).forEach((v) => {\n logger.dim(` - ${v.name} [${v.tables.join(', ')}]`);\n });\n if (model.variables.length > 10) {\n logger.dim(` ... and ${model.variables.length - 10} more`);\n }\n console.log();\n\n logger.dim('Use --tables, --variables, --table <name>, or --variable <name> for details.');\n logger.dim('Use --json for raw JSON output.');\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n\n if (isAuthError(error)) {\n showLoginPrompt(tenant);\n } else if (errorMessage.includes('404')) {\n logger.error(`Tenant \"${tenant}\" not found or not accessible.`);\n logger.dim('Check that the tenant name is correct.');\n } else if (errorMessage.includes('ENOTFOUND') || errorMessage.includes('ECONNREFUSED')) {\n logger.error('Failed to connect to Farseer.');\n logger.dim('Check your network connection.');\n } else {\n logger.error('Failed to export model.');\n logger.dim(errorMessage);\n }\n process.exit(1);\n }\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AACvB,
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { logger } from '../utils/logger';\nimport { showLoginPrompt, isAuthError } from '../services/farseerFactory';\nimport { preflight } from '../services/preflight';\n\nexport function registerModelCommand(program: Command): void {\n program\n .command('model [tenant]')\n .description('Export and display the model structure (dimensions, variables)')\n .option('--json', 'Output raw JSON')\n .option('--tables', 'Show only dimension tables')\n .option('--variables', 'Show only variables')\n .option('--variable <name>', 'Show details for specific variable')\n .option('--table <name>', 'Show details for specific dimension table')\n .action(async (tenantArg, options) => {\n const { tenant, client: api } = await preflight(tenantArg);\n\n try {\n // Pick the smallest scope that satisfies the requested\n // output. An unscoped DTAB+DMEM+VAR fetch breaks the\n // response limit on large tenants; `--json` is the\n // worst case because it asks for the whole thing.\n let model;\n if (options.variable || options.variables) {\n model = await api.exportModel({ types: ['VAR'] });\n } else if (options.table) {\n // Single-table member fetch via entities API.\n // `/model/export` with `tableGids` 500s for some\n // tables on large tenants (separate backend bug);\n // the entities path is reliable.\n const table = await api.loadDimensionTableWithMembers(options.table);\n if (!table) {\n logger.error(`Table \"${options.table}\" not found.`);\n const summary = await api.exportModel({ types: ['DTAB'] });\n logger.dim('Available tables:');\n summary.tables.slice(0, 10).forEach((t) => logger.dim(` - ${t.name}`));\n if (summary.tables.length > 10) {\n logger.dim(` ... and ${summary.tables.length - 10} more`);\n }\n process.exit(1);\n }\n model = {\n tables: [table],\n variables: [],\n dependencies: { tables: [], members: [], variables: [] },\n };\n } else if (options.tables) {\n model = await api.exportModel({ types: ['DTAB'] });\n } else {\n // Default summary view \u2014 counts of tables /\n // variables and a name preview, no member rows.\n model = await api.exportModel({ types: ['DTAB', 'VAR'] });\n }\n\n // Raw JSON output\n if (options.json) {\n console.log(JSON.stringify(model, null, 2));\n return;\n }\n\n // Specific variable details\n if (options.variable) {\n const variable = model.variables.find(\n (v) => v.name.toLowerCase() === options.variable.toLowerCase(),\n );\n if (!variable) {\n logger.error(`Variable \"${options.variable}\" not found.`);\n logger.dim('Available variables:');\n model.variables.slice(0, 10).forEach((v) => logger.dim(` - ${v.name}`));\n if (model.variables.length > 10) {\n logger.dim(` ... and ${model.variables.length - 10} more`);\n }\n process.exit(1);\n }\n\n logger.header(`Variable: ${variable.name}`);\n console.log();\n if (variable.description) {\n console.log(` Description: ${variable.description}`);\n }\n if (variable.formula) {\n console.log(` Formula: ${variable.formula}`);\n }\n console.log(` Dimensions: ${variable.tables.join(', ')}`);\n if (variable.members.length > 0) {\n console.log(` Specific members: ${variable.members.join(', ')}`);\n }\n console.log(` Roll-up type: ${variable.rollupType}`);\n console.log(` Data type: ${variable.dataType}`);\n if (variable.numberFormat) {\n console.log(\n ` Format: ${variable.numberFormat.type}${variable.numberFormat.formatString ? ` (${variable.numberFormat.formatString})` : ''}`,\n );\n }\n console.log(` Readonly: ${variable.readonly}`);\n console.log(` Calculate on demand: ${variable.calculateOnDemand}`);\n if (variable.folderPath) {\n console.log(` Folder: ${variable.folderPath.join(' / ')}`);\n }\n return;\n }\n\n // Specific table details. The dispatch above already\n // resolved name \u2192 single-table fetch and exited if the\n // table didn't exist, so model.tables is exactly [target].\n if (options.table) {\n const table = model.tables[0];\n\n logger.header(`Dimension Table: ${table.name}`);\n console.log();\n console.log(` Columns:`);\n table.columns.forEach((col, i) => {\n let colInfo = ` ${i + 1}. ${col.type}`;\n if (col.name) colInfo += ` (${col.name})`;\n if (col.foreignKeyTableName) colInfo += ` \u2192 ${col.foreignKeyTableName}`;\n console.log(colInfo);\n });\n console.log(` Members: ${table.rows.length}`);\n if (table.folderPath) {\n console.log(` Folder: ${table.folderPath.join(' / ')}`);\n }\n if (table.rows.length > 0) {\n console.log(` Sample members:`);\n table.rows.slice(0, 5).forEach((row) => {\n console.log(` - ${row[0]}`);\n });\n if (table.rows.length > 5) {\n console.log(` ... and ${table.rows.length - 5} more`);\n }\n }\n return;\n }\n\n // Tables only\n if (options.tables) {\n logger.header(`Dimension Tables (${model.tables.length})`);\n console.log();\n for (const table of model.tables) {\n const fkColumns = table.columns.filter((c) => c.type === 'FOREIGN_KEY');\n let info = ` \uD83D\uDCCB ${table.name}`;\n if (fkColumns.length > 0) {\n info += ` \u2192 ${fkColumns.map((c) => c.foreignKeyTableName).join(', ')}`;\n }\n console.log(info);\n }\n logger.dim('Run with --table <name> to see members for a specific table.');\n return;\n }\n\n // Variables only\n if (options.variables) {\n logger.header(`Variables (${model.variables.length})`);\n console.log();\n for (const variable of model.variables) {\n console.log(` \uD83D\uDCCA ${variable.name}`);\n console.log(` Dimensions: ${variable.tables.join(', ')}`);\n if (variable.formula) {\n console.log(\n ` Formula: ${variable.formula.substring(0, 50)}${variable.formula.length > 50 ? '...' : ''}`,\n );\n }\n console.log();\n }\n return;\n }\n\n // Default: summary\n logger.header(`Model Summary for ${tenant}`);\n console.log();\n console.log(` Dimension Tables: ${model.tables.length}`);\n console.log(` Variables: ${model.variables.length}`);\n console.log();\n\n logger.dim('Dimension Tables:');\n model.tables.slice(0, 10).forEach((t) => {\n logger.dim(` - ${t.name}`);\n });\n if (model.tables.length > 10) {\n logger.dim(` ... and ${model.tables.length - 10} more`);\n }\n console.log();\n\n logger.dim('Variables (first 10):');\n model.variables.slice(0, 10).forEach((v) => {\n logger.dim(` - ${v.name} [${v.tables.join(', ')}]`);\n });\n if (model.variables.length > 10) {\n logger.dim(` ... and ${model.variables.length - 10} more`);\n }\n console.log();\n\n logger.dim('Use --tables, --variables, --table <name>, or --variable <name> for details.');\n logger.dim('Use --json for raw JSON output.');\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n\n if (isAuthError(error)) {\n showLoginPrompt(tenant);\n } else if (errorMessage.includes('404')) {\n logger.error(`Tenant \"${tenant}\" not found or not accessible.`);\n logger.dim('Check that the tenant name is correct.');\n } else if (errorMessage.includes('ENOTFOUND') || errorMessage.includes('ECONNREFUSED')) {\n logger.error('Failed to connect to Farseer.');\n logger.dim('Check your network connection.');\n } else {\n logger.error('Failed to export model.');\n logger.dim(errorMessage);\n }\n process.exit(1);\n }\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AACvB,4BAA6C;AAC7C,uBAA0B;AAEnB,SAAS,qBAAqB,SAAwB;AACzD,UACK,QAAQ,gBAAgB,EACxB,YAAY,gEAAgE,EAC5E,OAAO,UAAU,iBAAiB,EAClC,OAAO,YAAY,4BAA4B,EAC/C,OAAO,eAAe,qBAAqB,EAC3C,OAAO,qBAAqB,oCAAoC,EAChE,OAAO,kBAAkB,2CAA2C,EACpE,OAAO,OAAO,WAAW,YAAY;AAClC,UAAM,EAAE,QAAQ,QAAQ,IAAI,IAAI,UAAM,4BAAU,SAAS;AAEzD,QAAI;AAKA,UAAI;AACJ,UAAI,QAAQ,YAAY,QAAQ,WAAW;AACvC,gBAAQ,MAAM,IAAI,YAAY,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;AAAA,MACpD,WAAW,QAAQ,OAAO;AAKtB,cAAM,QAAQ,MAAM,IAAI,8BAA8B,QAAQ,KAAK;AACnE,YAAI,CAAC,OAAO;AACR,+BAAO,MAAM,UAAU,QAAQ,KAAK,cAAc;AAClD,gBAAM,UAAU,MAAM,IAAI,YAAY,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AACzD,+BAAO,IAAI,mBAAmB;AAC9B,kBAAQ,OAAO,MA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,SAAS,WAAW,KAAK,aAAa,SAAS,cAAc,GAAG;AACpF,6BAAO,MAAM,+BAA+B;AAC5C,6BAAO,IAAI,gCAAgC;AAAA,MAC/C,OAAO;AACH,6BAAO,MAAM,yBAAyB;AACtC,6BAAO,IAAI,YAAY;AAAA,MAC3B;AACA,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/commands/pull.js
CHANGED
|
@@ -35,7 +35,7 @@ var import_chalk = __toESM(require("chalk"));
|
|
|
35
35
|
var import_inquirer = __toESM(require("inquirer"));
|
|
36
36
|
var import_logger = require("../utils/logger");
|
|
37
37
|
var import_fileLogger = require("../utils/fileLogger");
|
|
38
|
-
var
|
|
38
|
+
var import_preflight = require("../services/preflight");
|
|
39
39
|
var import_syncService = require("../services/syncService");
|
|
40
40
|
var import_appSyncService = require("../services/appSyncService");
|
|
41
41
|
var import_helpers = require("../utils/helpers");
|
|
@@ -59,13 +59,8 @@ function registerPullCommand(program) {
|
|
|
59
59
|
"-y, --yes",
|
|
60
60
|
"Skip confirmation when local has uncommitted changes OR remote has deletions that would remove local files/apps (ignored under --force)"
|
|
61
61
|
).option("--include-ext <ext>", "Include extra file extension (repeatable)", import_cliOptions.collectValues, []).option("--include-folder <folder>", "Include all files in folder (repeatable)", import_cliOptions.collectValues, []).action(async (arg1, arg2, options) => {
|
|
62
|
-
const { organisation, tenant } = (0,
|
|
63
|
-
const
|
|
64
|
-
if (!clientResult) {
|
|
65
|
-
(0, import_farseerFactory.showLoginPrompt)(tenant);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
const syncService = new import_syncService.SyncService(tenant, clientResult.client);
|
|
62
|
+
const { organisation, tenant, client } = await (0, import_preflight.preflight)(arg1, arg2);
|
|
63
|
+
const syncService = new import_syncService.SyncService(tenant, client);
|
|
69
64
|
const tenantDir = (0, import_helpers.getTenantDir)(tenant);
|
|
70
65
|
(0, import_helpers.ensureDirectoryExists)(tenantDir);
|
|
71
66
|
(0, import_workspace.ensureGitignoreEntries)(path.join(tenantDir, ".gitignore"));
|
|
@@ -83,6 +78,16 @@ function registerPullCommand(program) {
|
|
|
83
78
|
};
|
|
84
79
|
const filesDir = (0, import_helpers.getTenantFilesDir)(tenant);
|
|
85
80
|
const folderInitialised = fs.existsSync(filesDir);
|
|
81
|
+
const printShellHint = () => {
|
|
82
|
+
if (folderInitialised) return;
|
|
83
|
+
console.log();
|
|
84
|
+
import_logger.logger.success(`Workspace ready for ${import_chalk.default.bold(tenant)}.`);
|
|
85
|
+
import_logger.logger.dim("To target this tenant in this shell, set:");
|
|
86
|
+
import_logger.logger.info(
|
|
87
|
+
organisation === tenant ? ` export FARSEER_TENANT=${tenant}` : ` export FARSEER_TENANT=${tenant} FARSEER_ORG=${organisation}`
|
|
88
|
+
);
|
|
89
|
+
import_logger.logger.dim(`Or pass it explicitly each time: farseer status ${tenant}`);
|
|
90
|
+
};
|
|
86
91
|
let preStatus = null;
|
|
87
92
|
let preStatusError = null;
|
|
88
93
|
if (folderInitialised) {
|
|
@@ -93,7 +98,7 @@ function registerPullCommand(program) {
|
|
|
93
98
|
import_logger.logger.dim(`Could not compute pre-pull status: ${preStatusError.message}`);
|
|
94
99
|
}
|
|
95
100
|
}
|
|
96
|
-
const appSyncService = new import_appSyncService.AppSyncService(tenant,
|
|
101
|
+
const appSyncService = new import_appSyncService.AppSyncService(tenant, client);
|
|
97
102
|
let appDeletions = [];
|
|
98
103
|
try {
|
|
99
104
|
appDeletions = await appSyncService.getRemoteDeletions();
|
|
@@ -277,6 +282,7 @@ function registerPullCommand(program) {
|
|
|
277
282
|
hasChanges = hasChanges || appResult.created.length > 0 || appResult.updated.length > 0 || appResult.deleted.length > 0;
|
|
278
283
|
if (!hasChanges) {
|
|
279
284
|
import_logger.logger.success("Already up to date.");
|
|
285
|
+
printShellHint();
|
|
280
286
|
return;
|
|
281
287
|
}
|
|
282
288
|
console.log();
|
|
@@ -288,6 +294,7 @@ function registerPullCommand(program) {
|
|
|
288
294
|
import_logger.logger.dim(
|
|
289
295
|
`Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`
|
|
290
296
|
);
|
|
297
|
+
printShellHint();
|
|
291
298
|
} catch (error) {
|
|
292
299
|
import_fileLogger.fileLogger.error("pull", error);
|
|
293
300
|
import_logger.logger.error("Pull failed.");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/pull.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport inquirer from 'inquirer';\nimport { logger } from '../utils/logger';\nimport { fileLogger } from '../utils/fileLogger';\nimport { getFarseerClientWithFallback, showLoginPrompt } from '../services/farseerFactory';\nimport { SyncService, ConflictResolutions, SyncStatus } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport {\n getTenantDir,\n getTenantFilesDir,\n ensureDirectoryExists,\n resolveTenantWithOrgMapping,\n appendToAuditLog,\n AuditLogEntry,\n safeResolveWithinBase,\n} from '../utils/helpers';\nimport { formatClientError } from '../utils/errorFormatter';\nimport { isLikelyTextFile } from '../utils/fileValidation';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\nimport { FARSEER_CLIENT_URL, FARSEER_CLIENT_AXIOS_URL } from '../utils/constants';\nimport { ensureGitignoreEntries } from '../utils/workspace';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Pull semantics:\n *\n * farseer pull\n * 1. Show local-vs-remote diff. If you have unsynced local edits OR\n * remote has deletions that would remove local files/apps, the\n * command stops here and asks for confirmation before doing\n * anything (we don't merge or delete silently).\n * 2. Apply remote-side changes (downloads, deletions, modifications).\n * Per-file conflicts are resolved interactively.\n *\n * farseer pull --force\n * Hard reset to remote. After it runs, the working tree mirrors what's\n * on remote: any file that exists locally but not on remote is deleted,\n * remote versions overwrite local edits, deletions are accepted. Always\n * asks for confirmation because the operation is destructive.\n */\nexport function registerPullCommand(program: Command): void {\n program\n .command('pull [org] [tenant]')\n .description(\n 'Pull files from Farseer instance to local\\n\\nUsage: pull <org> <tenant> OR pull <tenant> (if org is known)',\n )\n .option(\n '--all',\n 'Pull every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist). Data files (.csv, .xlsx, .parquet, \u2026) are backend-accepted but excluded from default \u2014 opt in via --include-ext .csv or `farseer config include --ext .csv`.',\n )\n .option(\n '--force',\n 'Hard reset local to remote within the current sync scope: overwrite local edits, delete local-only files. Files outside scope (data files like .csv on a default run without --include-ext .csv) are NOT touched. Always asks for confirmation.',\n )\n .option(\n '-y, --yes',\n 'Skip confirmation when local has uncommitted changes OR remote has deletions that would remove local files/apps (ignored under --force)',\n )\n .option('--include-ext <ext>', 'Include extra file extension (repeatable)', collectValues, [])\n .option('--include-folder <folder>', 'Include all files in folder (repeatable)', collectValues, [])\n .action(async (arg1, arg2, options) => {\n const { organisation, tenant } = resolveTenantWithOrgMapping(arg1, arg2);\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const syncService = new SyncService(tenant, clientResult.client);\n\n const tenantDir = getTenantDir(tenant);\n ensureDirectoryExists(tenantDir);\n\n // Ensure .gitignore covers `.farseer-sync.json` on every direct\n // pull, not only checkout-driven pulls. A workspace that\n // initializes with `farseer pull` (no prior checkout, or\n // `checkout --no-pull` then `pull`) would otherwise commit the\n // per-machine baseline and reproduce the cross-machine drift\n // bug the gitignore exists to prevent.\n ensureGitignoreEntries(path.join(tenantDir, '.gitignore'));\n\n await createDefaultPackageJson(tenantDir, tenant);\n\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const filterOptions = {\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n };\n const syncOptions = {\n all: options.all,\n force: options.force,\n ...filterOptions,\n };\n\n // Step 1: Inspect current state. We do this BEFORE mutating\n // anything so the user can decide whether to bail.\n const filesDir = getTenantFilesDir(tenant);\n const folderInitialised = fs.existsSync(filesDir);\n let preStatus: SyncStatus | null = null;\n let preStatusError: Error | null = null;\n if (folderInitialised) {\n try {\n preStatus = await syncService.getStatus({ ...filterOptions, all: options.all, deep: false });\n } catch (error) {\n preStatusError = error as Error;\n logger.dim(`Could not compute pre-pull status: ${preStatusError.message}`);\n }\n }\n\n // Preview app deletions too. Without this the destructive\n // prompt only covers files and the user discovers (post-pull)\n // that an app JSON was wiped because someone deleted the app\n // on remote. Uses listApps only \u2014 no per-app fetch \u2014 so this\n // doesn't double the network cost of the apps pull below.\n //\n // Best-effort: a failure here shouldn't block the pull. Worst\n // case the user gets the legacy behaviour (silent app\n // deletion) on this run.\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n let appDeletions: string[] = [];\n try {\n appDeletions = await appSyncService.getRemoteDeletions();\n } catch (error) {\n logger.dim(`Could not compute pre-pull app deletions: ${(error as Error).message}`);\n }\n\n const localChanges = preStatus\n ? preStatus.addedLocally.length +\n preStatus.modifiedLocally.length +\n preStatus.deletedLocally.length +\n preStatus.conflicts.length\n : 0;\n const remoteDeletions = (preStatus?.deletedRemotely.length ?? 0) + appDeletions.length;\n\n // Step 2: Decide whether to confirm. The matrix:\n // --force \u2192 always confirm (destructive reset).\n // local edits OR remote deletions \u2192 confirm unless -y.\n // clean tree, no deletes \u2192 just go.\n //\n // Remote deletions are gated because pull would silently\n // remove a previously-synced local file/app if someone deleted\n // it on remote \u2014 a real script could vanish without warning.\n // Local edits stay gated for the existing reason: we don't\n // want to merge into a dirty tree without an opt-in.\n if (options.force) {\n console.log();\n console.log(chalk.red.bold('--force will hard-reset local to match remote.'));\n if (preStatus) {\n summarisePreStatus(preStatus);\n } else if (preStatusError) {\n // Without a local diff we'd be confirming a destructive\n // mirror operation blind. Refuse rather than press on \u2014\n // the cost of failing here is one re-run; the cost of\n // pressing on is silent loss of in-progress files.\n console.log(\n chalk.red(\n 'Cannot show what will be lost \u2014 pre-pull status failed (see line above). Refusing to --force without visibility.',\n ),\n );\n logger.dim('Re-run after the underlying issue clears, or use a non-force pull to merge.');\n process.exit(1);\n } else {\n // Folder isn't initialised yet \u2014 first --force pull on a\n // brand-new tenant. Nothing local to lose; proceed.\n logger.dim('No local files yet \u2014 nothing to discard.');\n }\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: `Discard local changes and reset ${tenant} to remote?`,\n default: false,\n },\n ]);\n if (!confirm.proceed) {\n logger.info('Pull cancelled.');\n return;\n }\n } else if ((localChanges > 0 || remoteDeletions > 0) && !options.yes) {\n console.log();\n if (localChanges > 0) {\n logger.warning(`Local has ${localChanges} unsynced change(s).`);\n summarisePreStatus(preStatus!);\n logger.dim('Pull will keep your edits and merge remote-side changes around them.');\n }\n if (remoteDeletions > 0) {\n logger.warning(`Pull will remove ${remoteDeletions} local item(s) that were deleted on remote:`);\n summariseRemoteDeletions(preStatus?.deletedRemotely ?? [], appDeletions);\n logger.dim('Decline to abort and keep your local copies (you can push them back to restore).');\n }\n if (localChanges > 0 && remoteDeletions === 0) {\n logger.dim('To wipe local and reset to remote: re-run with --force.');\n }\n const promptMessage =\n remoteDeletions > 0 && localChanges > 0\n ? `Continue pull (merge into dirty tree AND delete ${remoteDeletions} local item(s))?`\n : remoteDeletions > 0\n ? `Continue pull and delete ${remoteDeletions} local item(s)?`\n : `Continue pulling into a dirty working tree?`;\n // Dirty-tree-only keeps the soft default (Enter = continue\n // merge). The moment remote deletions are on the table we\n // flip to default-false: a wrong \"yes\" wipes local items\n // for good, same calculus as `pull --force` below.\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: promptMessage,\n default: remoteDeletions === 0,\n },\n ]);\n if (!confirm.proceed) {\n logger.info('Pull cancelled.');\n return;\n }\n }\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Files \u2550\u2550\u2550'));\n logger.info(`Pulling files from ${tenant}...`);\n\n try {\n let result = await syncService.pull(syncOptions);\n\n // Conflicts: prompt per file (only when not --force).\n if (result.conflicts.length > 0 && !options.force) {\n console.log();\n console.log(chalk.red.bold(`${result.conflicts.length} conflict(s) detected:`));\n console.log();\n for (const conflict of result.conflicts) {\n console.log(chalk.red(` ! ${conflict.filePath}`));\n console.log(chalk.dim(` ${conflict.description}`));\n }\n console.log();\n\n const resolutions: ConflictResolutions = {};\n for (const conflict of result.conflicts) {\n let choices: { name: string; value: string }[];\n if (conflict.type === 'local_modified_remote_deleted') {\n choices = [\n { name: 'Keep local (keep your modified file)', value: 'keep_local' },\n { name: 'Accept deletion (delete local file)', value: 'keep_remote' },\n ];\n } else if (conflict.type === 'local_deleted_remote_modified') {\n choices = [\n { name: \"Keep deleted (don't restore file)\", value: 'keep_local' },\n { name: 'Restore remote version', value: 'keep_remote' },\n ];\n } else {\n choices = [\n { name: 'Keep local version', value: 'keep_local' },\n { name: 'Use remote version (overwrite local)', value: 'keep_remote' },\n { name: 'Keep both (save remote as .remote file)', value: 'keep_both' },\n ];\n // Only offer git-style merge for files we know\n // are text. Binary blobs would just get\n // corrupted by UTF-8 splicing. The service has\n // a defensive fallback for binary anyway, but\n // not showing the option avoids the confusing\n // \"I picked merge_markers but got keep_both\"\n // experience.\n if (isLikelyTextFile(conflict.filePath)) {\n choices.push({\n name: 'Merge with markers (git-style \u2014 edit file, then push to finish)',\n value: 'merge_markers',\n });\n }\n }\n const answer = await inquirer.prompt([\n {\n type: 'list',\n name: 'resolution',\n message: `${conflict.filePath} - ${conflict.description}`,\n choices,\n },\n ]);\n resolutions[conflict.filePath] = answer.resolution;\n }\n result = await syncService.pull({ ...syncOptions, conflictResolutions: resolutions });\n }\n\n if (result.downloaded.length > 0) {\n console.log(chalk.green('Downloaded:'));\n for (const file of result.downloaded) console.log(chalk.green(` + ${file}`));\n }\n\n if (result.deleted.length > 0) {\n console.log(chalk.red('Deleted (removed from remote):'));\n for (const file of result.deleted) console.log(chalk.red(` - ${file}`));\n }\n\n if (result.conflictFilesWritten.length > 0) {\n console.log(chalk.yellow('Conflict files created:'));\n for (const file of result.conflictFilesWritten) console.log(chalk.yellow(` ~ ${file}`));\n if (result.conflictFilesWritten.some((f) => f.includes('(merge markers)'))) {\n console.log();\n logger.dim('Files marked with \"(merge markers)\" contain git-style <<<<<<</=======/>>>>>>>');\n logger.dim('blocks. Open them, pick which version to keep, remove the marker lines,');\n logger.dim(`then run \\`farseer push ${tenant}\\` to upload the resolved version.`);\n }\n }\n\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} (${result.unchanged.length} unchanged)`,\n );\n\n // --force extra: also delete any local-only files. The\n // service-level pull keeps `local_new` files unchanged\n // (it's the right default for a non-destructive pull),\n // but --force at the command layer means \"mirror remote\",\n // so remove those locally.\n let extraLocalDeletes: string[] = [];\n if (options.force) {\n // Forward `--all` so `pull --force --all` wipes every\n // local-only file in scope, not just those that match\n // the default sync scope.\n extraLocalDeletes = await wipeLocalOnly(syncService, filesDir, {\n ...filterOptions,\n all: options.all,\n });\n if (extraLocalDeletes.length > 0) {\n console.log(chalk.red('Local-only files removed (mirror remote):'));\n for (const file of extraLocalDeletes) console.log(chalk.red(` - ${file}`));\n }\n }\n\n // Audit log\n if (result.downloaded.length > 0) {\n const syncState = syncService.loadSyncState();\n const auditEntries: AuditLogEntry[] = result.downloaded.map((filePath) => ({\n operation: 'pulled' as const,\n filePath,\n uploadTime: syncState.files[filePath]?.metadata?.uploadTime,\n uploaderEmail: syncState.files[filePath]?.metadata?.uploaderEmail,\n uploaderName: syncState.files[filePath]?.metadata?.uploaderName,\n }));\n appendToAuditLog(tenant, auditEntries);\n }\n\n let hasChanges =\n result.downloaded.length > 0 || result.deleted.length > 0 || extraLocalDeletes.length > 0;\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Apps \u2550\u2550\u2550'));\n logger.info(`Pulling apps from ${tenant}...`);\n\n const appResult = await appSyncService.pull();\n\n if (appResult.created.length > 0) {\n console.log(chalk.green('New apps:'));\n for (const app of appResult.created) console.log(chalk.green(` + ${app}`));\n }\n if (appResult.updated.length > 0) {\n console.log(chalk.yellow('Updated apps:'));\n for (const app of appResult.updated) console.log(chalk.yellow(` ~ ${app}`));\n }\n if (appResult.deleted.length > 0) {\n console.log(chalk.red('Deleted apps (removed from remote):'));\n for (const app of appResult.deleted) console.log(chalk.red(` - ${app}`));\n }\n\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n\n hasChanges =\n hasChanges ||\n appResult.created.length > 0 ||\n appResult.updated.length > 0 ||\n appResult.deleted.length > 0;\n\n if (!hasChanges) {\n logger.success('Already up to date.');\n return;\n }\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Summary \u2550\u2550\u2550'));\n logger.success('Pull complete!');\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} ${\n extraLocalDeletes.length > 0 ? `(${extraLocalDeletes.length} local-only removed) ` : ''\n }(${result.unchanged.length} unchanged)`,\n );\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n } catch (error) {\n fileLogger.error('pull', error);\n logger.error('Pull failed.');\n logger.error(await formatClientError(error));\n const logPath = fileLogger.getLogPath();\n if (logPath) {\n logger.dim(`Debug log: ${logPath}`);\n }\n process.exit(1);\n }\n });\n}\n\n/**\n * Print actual paths (not just counts) so the user can see what local\n * changes a `pull --force` is about to overwrite. Counts alone hid the\n * destructive blast radius: under `--force --all` someone could lose\n * dozens of in-progress files without knowing which ones. Cap at\n * MAX_PATHS_PER_SECTION per section to avoid scrollback floods on huge\n * trees \u2014 anything beyond that collapses into \"+ N more\".\n */\nfunction summarisePreStatus(status: SyncStatus): void {\n const MAX_PATHS_PER_SECTION = 20;\n const renderSection = (label: string, paths: string[], color: (s: string) => string) => {\n if (paths.length === 0) return;\n console.log(color(` ${label} (${paths.length}):`));\n const visible = paths.slice(0, MAX_PATHS_PER_SECTION);\n for (const p of visible) console.log(color(` ${p}`));\n if (paths.length > MAX_PATHS_PER_SECTION) {\n console.log(chalk.dim(` ... and ${paths.length - MAX_PATHS_PER_SECTION} more`));\n }\n };\n renderSection('+ new local file(s)', status.addedLocally, chalk.green);\n renderSection('M locally modified file(s)', status.modifiedLocally, chalk.yellow);\n renderSection('- locally deleted file(s)', status.deletedLocally, chalk.red);\n if (status.conflicts.length > 0) {\n const conflictPaths = status.conflicts.map((c) => c.filePath);\n renderSection('! conflict(s)', conflictPaths, chalk.red.bold);\n }\n console.log();\n}\n\n/**\n * Print the file + app paths that pull is about to delete because remote\n * removed them. Same cap as `summarisePreStatus` so a huge purge doesn't\n * flood the scrollback \u2014 the user still gets the count above.\n */\nfunction summariseRemoteDeletions(deletedFiles: string[], deletedApps: string[]): void {\n const MAX_PATHS_PER_SECTION = 20;\n const renderSection = (label: string, paths: string[]) => {\n if (paths.length === 0) return;\n console.log(chalk.red(` ${label} (${paths.length}):`));\n const visible = paths.slice(0, MAX_PATHS_PER_SECTION);\n for (const p of visible) console.log(chalk.red(` - ${p}`));\n if (paths.length > MAX_PATHS_PER_SECTION) {\n console.log(chalk.dim(` ... and ${paths.length - MAX_PATHS_PER_SECTION} more`));\n }\n };\n renderSection('file(s) deleted on remote', deletedFiles);\n renderSection('app(s) deleted on remote', deletedApps);\n console.log();\n}\n\n/**\n * Hard-reset helper for `pull --force`. Removes local files that have no\n * remote counterpart (the regular pull keeps them \u2014 see service comment).\n * Cleans up the syncState entry too so the next status doesn't show ghosts.\n */\nasync function wipeLocalOnly(\n syncService: SyncService,\n filesDir: string,\n filterOptions: { all?: boolean; includeExtensions?: string[]; includeFolders?: string[] },\n): Promise<string[]> {\n // `all` matters: under `pull --force --all` the user expects every\n // local-only file to be wiped, not just files in the default sync\n // scope. Without it, getStatus filters down to the curated developer\n // files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden\n // directories and the folder blocklist, so the wipe loop never sees\n // anything those rules exclude.\n const status = await syncService.getStatus({ ...filterOptions, deep: false });\n const removed: string[] = [];\n const failed: { file: string; reason: string }[] = [];\n const syncState = syncService.loadSyncState();\n for (const file of status.addedLocally) {\n const fullPath = safeResolveWithinBase(filesDir, file);\n if (fs.existsSync(fullPath)) {\n // Wrap each unlink so a single permission error / file lock\n // doesn't strand the rest of the wipe. syncState is saved\n // incrementally as each unlink succeeds so a mid-run failure\n // leaves a consistent record for the next run, and the failed\n // list is surfaced at the end for manual cleanup.\n try {\n fs.unlinkSync(fullPath);\n removed.push(file);\n delete syncState.files[file];\n syncService.saveSyncState(syncState);\n } catch (err) {\n failed.push({ file, reason: err instanceof Error ? err.message : String(err) });\n }\n } else {\n // File was already gone \u2014 just drop the syncState entry.\n delete syncState.files[file];\n syncService.saveSyncState(syncState);\n }\n }\n if (failed.length > 0) {\n logger.warning(`${failed.length} local-only file(s) could not be removed:`);\n for (const f of failed) logger.dim(` ${f.file} \u2014 ${f.reason}`);\n }\n return removed;\n}\n\nasync function createDefaultPackageJson(tenantDir: string, tenant: string): Promise<void> {\n const packageJsonPath = path.join(tenantDir, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n return;\n }\n\n const packageJson = {\n name: `farseer-scripts-${tenant}`,\n version: '1.0.0',\n description: `Farseer App scripts for ${tenant}`,\n main: 'src/index.ts',\n scripts: {},\n keywords: ['farseer', 'scripts', tenant],\n author: 'Farseer',\n license: 'ISC',\n dependencies: {\n '@google-cloud/bigquery': '^7.9.0',\n '@google-cloud/storage': '^7.12.1',\n '@googleapis/sheets': '^5.0.5',\n '@sendgrid/mail': '^7.7.0',\n '@types/node-forge': '^1.3.11',\n '@xmldom/xmldom': '^0.9.8',\n arquero: '^5.4.1',\n axios: '^1.10.0',\n 'axios-retry': '^3.9.1',\n 'basic-ftp': '^5.0.5',\n 'client-oauth2': '^4.3.3',\n 'csv-parser': '^3.0.0',\n dotenv: '^16.4.5',\n 'draft-js': '^0.11.7',\n exceljs: '^4.4.0',\n 'farseer-client': FARSEER_CLIENT_URL,\n 'farseer-client-axios': FARSEER_CLIENT_AXIOS_URL,\n 'fast-xml-parser': '^4.5.0',\n 'form-data': '^4.0.0',\n googleapis: '^144.0.0',\n heapdump: '^0.3.15',\n 'image-size': '^1.1.1',\n jszip: '^3.10.1',\n 'lossless-json': '^4.0.1',\n mssql: '^10.0.4',\n 'node-fetch': '^2.7.0',\n 'node-forge': '^1.3.1',\n 'node-sp-auth': '^3.0.8',\n numeral: '^2.0.6',\n oracledb: '^6.6.0',\n papaparse: '^5.5.1',\n pdfkit: '^0.14.0',\n pdfmake: '^0.2.20',\n soap: '^1.1.11',\n 'ssh2-sftp-client': '^11.0.0',\n 'strong-soap': '^4.1.13',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n undici: '^6.19.8',\n uuid: '^11.1.0',\n winston: '^3.17.0',\n xlsx: 'https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz',\n 'xml-crypto': '^6.1.2',\n },\n devDependencies: {\n '@types/draft-js': '^0.11.18',\n '@types/heapdump': '^0.3.4',\n '@types/mssql': '^9.1.5',\n '@types/node': '^18.19.50',\n '@types/node-fetch': '^2.6.11',\n '@types/numeral': '^2.0.5',\n '@types/oracledb': '^6.5.3',\n '@types/papaparse': '^5.3.15',\n '@types/pdfmake': '^0.2.11',\n '@types/soap': '^0.18.0',\n '@types/ssh2-sftp-client': '^9.0.4',\n '@types/tough-cookie': '^4.0.5',\n '@types/uuid': '^10.0.0',\n '@types/xmldom': '^0.1.34',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n },\n };\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');\n logger.dim(`Created package.json for ${tenant}`);\n}\n"],
|
|
5
|
-
"mappings":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AAc;AAAA,MACd,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,kBAAkB;AAAA,MAClB,wBAAwB;AAAA,MACxB,mBAAmB;AAAA,MACnB,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,cAAc;AAAA,MACd,OAAO;AAAA,MACP,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,cAAc;AAAA,MACd,cAAc;AAAA,MACd,gBAAgB;AAAA,MAChB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,oBAAoB;AAAA,MACpB,eAAe;AAAA,MACf,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,MACN,cAAc;AAAA,IAClB;AAAA,IACA,iBAAiB;AAAA,MACb,mBAAmB;AAAA,MACnB,mBAAmB;AAAA,MACnB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,qBAAqB;AAAA,MACrB,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,MAClB,eAAe;AAAA,MACf,2BAA2B;AAAA,MAC3B,uBAAuB;AAAA,MACvB,eAAe;AAAA,MACf,iBAAiB;AAAA,MACjB,WAAW;AAAA,MACX,YAAY;AAAA,IAChB;AAAA,EACJ;AAEA,KAAG,cAAc,iBAAiB,KAAK,UAAU,aAAa,MAAM,CAAC,GAAG,OAAO;AAC/E,uBAAO,IAAI,4BAA4B,MAAM,EAAE;AACnD;",
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport inquirer from 'inquirer';\nimport { logger } from '../utils/logger';\nimport { fileLogger } from '../utils/fileLogger';\nimport { preflight } from '../services/preflight';\nimport { SyncService, ConflictResolutions, SyncStatus } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport {\n getTenantDir,\n getTenantFilesDir,\n ensureDirectoryExists,\n appendToAuditLog,\n AuditLogEntry,\n safeResolveWithinBase,\n} from '../utils/helpers';\nimport { formatClientError } from '../utils/errorFormatter';\nimport { isLikelyTextFile } from '../utils/fileValidation';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\nimport { FARSEER_CLIENT_URL, FARSEER_CLIENT_AXIOS_URL } from '../utils/constants';\nimport { ensureGitignoreEntries } from '../utils/workspace';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n/**\n * Pull semantics:\n *\n * farseer pull\n * 1. Show local-vs-remote diff. If you have unsynced local edits OR\n * remote has deletions that would remove local files/apps, the\n * command stops here and asks for confirmation before doing\n * anything (we don't merge or delete silently).\n * 2. Apply remote-side changes (downloads, deletions, modifications).\n * Per-file conflicts are resolved interactively.\n *\n * farseer pull --force\n * Hard reset to remote. After it runs, the working tree mirrors what's\n * on remote: any file that exists locally but not on remote is deleted,\n * remote versions overwrite local edits, deletions are accepted. Always\n * asks for confirmation because the operation is destructive.\n */\nexport function registerPullCommand(program: Command): void {\n program\n .command('pull [org] [tenant]')\n .description(\n 'Pull files from Farseer instance to local\\n\\nUsage: pull <org> <tenant> OR pull <tenant> (if org is known)',\n )\n .option(\n '--all',\n 'Pull every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist). Data files (.csv, .xlsx, .parquet, \u2026) are backend-accepted but excluded from default \u2014 opt in via --include-ext .csv or `farseer config include --ext .csv`.',\n )\n .option(\n '--force',\n 'Hard reset local to remote within the current sync scope: overwrite local edits, delete local-only files. Files outside scope (data files like .csv on a default run without --include-ext .csv) are NOT touched. Always asks for confirmation.',\n )\n .option(\n '-y, --yes',\n 'Skip confirmation when local has uncommitted changes OR remote has deletions that would remove local files/apps (ignored under --force)',\n )\n .option('--include-ext <ext>', 'Include extra file extension (repeatable)', collectValues, [])\n .option('--include-folder <folder>', 'Include all files in folder (repeatable)', collectValues, [])\n .action(async (arg1, arg2, options) => {\n // preflight resolves the target, authenticates, and confirms the\n // org owns the tenant (the guard that used to live only in\n // `checkout`). pull is the setup path now, so scaffolding follows.\n const { organisation, tenant, client } = await preflight(arg1, arg2);\n\n const syncService = new SyncService(tenant, client);\n\n const tenantDir = getTenantDir(tenant);\n ensureDirectoryExists(tenantDir);\n\n // Ensure .gitignore covers `.farseer-sync.json` on the first pull\n // into a fresh workspace. Without it, a workspace initialized by\n // `farseer pull` would commit the per-machine baseline and\n // reproduce the cross-machine drift bug the gitignore prevents.\n ensureGitignoreEntries(path.join(tenantDir, '.gitignore'));\n\n await createDefaultPackageJson(tenantDir, tenant);\n\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const filterOptions = {\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n };\n const syncOptions = {\n all: options.all,\n force: options.force,\n ...filterOptions,\n };\n\n // Step 1: Inspect current state. We do this BEFORE mutating\n // anything so the user can decide whether to bail.\n const filesDir = getTenantFilesDir(tenant);\n const folderInitialised = fs.existsSync(filesDir);\n\n // With `checkout` gone, a first pull IS the setup \u2014 so it has to\n // close by naming the one step the CLI can't do itself: a child\n // process can't export into the shell that launched it. Gated on a\n // fresh workspace; on every routine pull this would just be noise.\n const printShellHint = (): void => {\n if (folderInitialised) return;\n console.log();\n logger.success(`Workspace ready for ${chalk.bold(tenant)}.`);\n logger.dim('To target this tenant in this shell, set:');\n logger.info(\n organisation === tenant\n ? ` export FARSEER_TENANT=${tenant}`\n : ` export FARSEER_TENANT=${tenant} FARSEER_ORG=${organisation}`,\n );\n logger.dim(`Or pass it explicitly each time: farseer status ${tenant}`);\n };\n\n let preStatus: SyncStatus | null = null;\n let preStatusError: Error | null = null;\n if (folderInitialised) {\n try {\n preStatus = await syncService.getStatus({ ...filterOptions, all: options.all, deep: false });\n } catch (error) {\n preStatusError = error as Error;\n logger.dim(`Could not compute pre-pull status: ${preStatusError.message}`);\n }\n }\n\n // Preview app deletions too. Without this the destructive\n // prompt only covers files and the user discovers (post-pull)\n // that an app JSON was wiped because someone deleted the app\n // on remote. Uses listApps only \u2014 no per-app fetch \u2014 so this\n // doesn't double the network cost of the apps pull below.\n //\n // Best-effort: a failure here shouldn't block the pull. Worst\n // case the user gets the legacy behaviour (silent app\n // deletion) on this run.\n const appSyncService = new AppSyncService(tenant, client);\n let appDeletions: string[] = [];\n try {\n appDeletions = await appSyncService.getRemoteDeletions();\n } catch (error) {\n logger.dim(`Could not compute pre-pull app deletions: ${(error as Error).message}`);\n }\n\n const localChanges = preStatus\n ? preStatus.addedLocally.length +\n preStatus.modifiedLocally.length +\n preStatus.deletedLocally.length +\n preStatus.conflicts.length\n : 0;\n const remoteDeletions = (preStatus?.deletedRemotely.length ?? 0) + appDeletions.length;\n\n // Step 2: Decide whether to confirm. The matrix:\n // --force \u2192 always confirm (destructive reset).\n // local edits OR remote deletions \u2192 confirm unless -y.\n // clean tree, no deletes \u2192 just go.\n //\n // Remote deletions are gated because pull would silently\n // remove a previously-synced local file/app if someone deleted\n // it on remote \u2014 a real script could vanish without warning.\n // Local edits stay gated for the existing reason: we don't\n // want to merge into a dirty tree without an opt-in.\n if (options.force) {\n console.log();\n console.log(chalk.red.bold('--force will hard-reset local to match remote.'));\n if (preStatus) {\n summarisePreStatus(preStatus);\n } else if (preStatusError) {\n // Without a local diff we'd be confirming a destructive\n // mirror operation blind. Refuse rather than press on \u2014\n // the cost of failing here is one re-run; the cost of\n // pressing on is silent loss of in-progress files.\n console.log(\n chalk.red(\n 'Cannot show what will be lost \u2014 pre-pull status failed (see line above). Refusing to --force without visibility.',\n ),\n );\n logger.dim('Re-run after the underlying issue clears, or use a non-force pull to merge.');\n process.exit(1);\n } else {\n // Folder isn't initialised yet \u2014 first --force pull on a\n // brand-new tenant. Nothing local to lose; proceed.\n logger.dim('No local files yet \u2014 nothing to discard.');\n }\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: `Discard local changes and reset ${tenant} to remote?`,\n default: false,\n },\n ]);\n if (!confirm.proceed) {\n logger.info('Pull cancelled.');\n return;\n }\n } else if ((localChanges > 0 || remoteDeletions > 0) && !options.yes) {\n console.log();\n if (localChanges > 0) {\n logger.warning(`Local has ${localChanges} unsynced change(s).`);\n summarisePreStatus(preStatus!);\n logger.dim('Pull will keep your edits and merge remote-side changes around them.');\n }\n if (remoteDeletions > 0) {\n logger.warning(`Pull will remove ${remoteDeletions} local item(s) that were deleted on remote:`);\n summariseRemoteDeletions(preStatus?.deletedRemotely ?? [], appDeletions);\n logger.dim('Decline to abort and keep your local copies (you can push them back to restore).');\n }\n if (localChanges > 0 && remoteDeletions === 0) {\n logger.dim('To wipe local and reset to remote: re-run with --force.');\n }\n const promptMessage =\n remoteDeletions > 0 && localChanges > 0\n ? `Continue pull (merge into dirty tree AND delete ${remoteDeletions} local item(s))?`\n : remoteDeletions > 0\n ? `Continue pull and delete ${remoteDeletions} local item(s)?`\n : `Continue pulling into a dirty working tree?`;\n // Dirty-tree-only keeps the soft default (Enter = continue\n // merge). The moment remote deletions are on the table we\n // flip to default-false: a wrong \"yes\" wipes local items\n // for good, same calculus as `pull --force` below.\n const confirm = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'proceed',\n message: promptMessage,\n default: remoteDeletions === 0,\n },\n ]);\n if (!confirm.proceed) {\n logger.info('Pull cancelled.');\n return;\n }\n }\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Files \u2550\u2550\u2550'));\n logger.info(`Pulling files from ${tenant}...`);\n\n try {\n let result = await syncService.pull(syncOptions);\n\n // Conflicts: prompt per file (only when not --force).\n if (result.conflicts.length > 0 && !options.force) {\n console.log();\n console.log(chalk.red.bold(`${result.conflicts.length} conflict(s) detected:`));\n console.log();\n for (const conflict of result.conflicts) {\n console.log(chalk.red(` ! ${conflict.filePath}`));\n console.log(chalk.dim(` ${conflict.description}`));\n }\n console.log();\n\n const resolutions: ConflictResolutions = {};\n for (const conflict of result.conflicts) {\n let choices: { name: string; value: string }[];\n if (conflict.type === 'local_modified_remote_deleted') {\n choices = [\n { name: 'Keep local (keep your modified file)', value: 'keep_local' },\n { name: 'Accept deletion (delete local file)', value: 'keep_remote' },\n ];\n } else if (conflict.type === 'local_deleted_remote_modified') {\n choices = [\n { name: \"Keep deleted (don't restore file)\", value: 'keep_local' },\n { name: 'Restore remote version', value: 'keep_remote' },\n ];\n } else {\n choices = [\n { name: 'Keep local version', value: 'keep_local' },\n { name: 'Use remote version (overwrite local)', value: 'keep_remote' },\n { name: 'Keep both (save remote as .remote file)', value: 'keep_both' },\n ];\n // Only offer git-style merge for files we know\n // are text. Binary blobs would just get\n // corrupted by UTF-8 splicing. The service has\n // a defensive fallback for binary anyway, but\n // not showing the option avoids the confusing\n // \"I picked merge_markers but got keep_both\"\n // experience.\n if (isLikelyTextFile(conflict.filePath)) {\n choices.push({\n name: 'Merge with markers (git-style \u2014 edit file, then push to finish)',\n value: 'merge_markers',\n });\n }\n }\n const answer = await inquirer.prompt([\n {\n type: 'list',\n name: 'resolution',\n message: `${conflict.filePath} - ${conflict.description}`,\n choices,\n },\n ]);\n resolutions[conflict.filePath] = answer.resolution;\n }\n result = await syncService.pull({ ...syncOptions, conflictResolutions: resolutions });\n }\n\n if (result.downloaded.length > 0) {\n console.log(chalk.green('Downloaded:'));\n for (const file of result.downloaded) console.log(chalk.green(` + ${file}`));\n }\n\n if (result.deleted.length > 0) {\n console.log(chalk.red('Deleted (removed from remote):'));\n for (const file of result.deleted) console.log(chalk.red(` - ${file}`));\n }\n\n if (result.conflictFilesWritten.length > 0) {\n console.log(chalk.yellow('Conflict files created:'));\n for (const file of result.conflictFilesWritten) console.log(chalk.yellow(` ~ ${file}`));\n if (result.conflictFilesWritten.some((f) => f.includes('(merge markers)'))) {\n console.log();\n logger.dim('Files marked with \"(merge markers)\" contain git-style <<<<<<</=======/>>>>>>>');\n logger.dim('blocks. Open them, pick which version to keep, remove the marker lines,');\n logger.dim(`then run \\`farseer push ${tenant}\\` to upload the resolved version.`);\n }\n }\n\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} (${result.unchanged.length} unchanged)`,\n );\n\n // --force extra: also delete any local-only files. The\n // service-level pull keeps `local_new` files unchanged\n // (it's the right default for a non-destructive pull),\n // but --force at the command layer means \"mirror remote\",\n // so remove those locally.\n let extraLocalDeletes: string[] = [];\n if (options.force) {\n // Forward `--all` so `pull --force --all` wipes every\n // local-only file in scope, not just those that match\n // the default sync scope.\n extraLocalDeletes = await wipeLocalOnly(syncService, filesDir, {\n ...filterOptions,\n all: options.all,\n });\n if (extraLocalDeletes.length > 0) {\n console.log(chalk.red('Local-only files removed (mirror remote):'));\n for (const file of extraLocalDeletes) console.log(chalk.red(` - ${file}`));\n }\n }\n\n // Audit log\n if (result.downloaded.length > 0) {\n const syncState = syncService.loadSyncState();\n const auditEntries: AuditLogEntry[] = result.downloaded.map((filePath) => ({\n operation: 'pulled' as const,\n filePath,\n uploadTime: syncState.files[filePath]?.metadata?.uploadTime,\n uploaderEmail: syncState.files[filePath]?.metadata?.uploaderEmail,\n uploaderName: syncState.files[filePath]?.metadata?.uploaderName,\n }));\n appendToAuditLog(tenant, auditEntries);\n }\n\n let hasChanges =\n result.downloaded.length > 0 || result.deleted.length > 0 || extraLocalDeletes.length > 0;\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Apps \u2550\u2550\u2550'));\n logger.info(`Pulling apps from ${tenant}...`);\n\n const appResult = await appSyncService.pull();\n\n if (appResult.created.length > 0) {\n console.log(chalk.green('New apps:'));\n for (const app of appResult.created) console.log(chalk.green(` + ${app}`));\n }\n if (appResult.updated.length > 0) {\n console.log(chalk.yellow('Updated apps:'));\n for (const app of appResult.updated) console.log(chalk.yellow(` ~ ${app}`));\n }\n if (appResult.deleted.length > 0) {\n console.log(chalk.red('Deleted apps (removed from remote):'));\n for (const app of appResult.deleted) console.log(chalk.red(` - ${app}`));\n }\n\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n\n hasChanges =\n hasChanges ||\n appResult.created.length > 0 ||\n appResult.updated.length > 0 ||\n appResult.deleted.length > 0;\n\n if (!hasChanges) {\n logger.success('Already up to date.');\n printShellHint();\n return;\n }\n\n console.log();\n console.log(chalk.bold('\u2550\u2550\u2550 Summary \u2550\u2550\u2550'));\n logger.success('Pull complete!');\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} ${\n extraLocalDeletes.length > 0 ? `(${extraLocalDeletes.length} local-only removed) ` : ''\n }(${result.unchanged.length} unchanged)`,\n );\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n printShellHint();\n } catch (error) {\n fileLogger.error('pull', error);\n logger.error('Pull failed.');\n logger.error(await formatClientError(error));\n const logPath = fileLogger.getLogPath();\n if (logPath) {\n logger.dim(`Debug log: ${logPath}`);\n }\n process.exit(1);\n }\n });\n}\n\n/**\n * Print actual paths (not just counts) so the user can see what local\n * changes a `pull --force` is about to overwrite. Counts alone hid the\n * destructive blast radius: under `--force --all` someone could lose\n * dozens of in-progress files without knowing which ones. Cap at\n * MAX_PATHS_PER_SECTION per section to avoid scrollback floods on huge\n * trees \u2014 anything beyond that collapses into \"+ N more\".\n */\nfunction summarisePreStatus(status: SyncStatus): void {\n const MAX_PATHS_PER_SECTION = 20;\n const renderSection = (label: string, paths: string[], color: (s: string) => string) => {\n if (paths.length === 0) return;\n console.log(color(` ${label} (${paths.length}):`));\n const visible = paths.slice(0, MAX_PATHS_PER_SECTION);\n for (const p of visible) console.log(color(` ${p}`));\n if (paths.length > MAX_PATHS_PER_SECTION) {\n console.log(chalk.dim(` ... and ${paths.length - MAX_PATHS_PER_SECTION} more`));\n }\n };\n renderSection('+ new local file(s)', status.addedLocally, chalk.green);\n renderSection('M locally modified file(s)', status.modifiedLocally, chalk.yellow);\n renderSection('- locally deleted file(s)', status.deletedLocally, chalk.red);\n if (status.conflicts.length > 0) {\n const conflictPaths = status.conflicts.map((c) => c.filePath);\n renderSection('! conflict(s)', conflictPaths, chalk.red.bold);\n }\n console.log();\n}\n\n/**\n * Print the file + app paths that pull is about to delete because remote\n * removed them. Same cap as `summarisePreStatus` so a huge purge doesn't\n * flood the scrollback \u2014 the user still gets the count above.\n */\nfunction summariseRemoteDeletions(deletedFiles: string[], deletedApps: string[]): void {\n const MAX_PATHS_PER_SECTION = 20;\n const renderSection = (label: string, paths: string[]) => {\n if (paths.length === 0) return;\n console.log(chalk.red(` ${label} (${paths.length}):`));\n const visible = paths.slice(0, MAX_PATHS_PER_SECTION);\n for (const p of visible) console.log(chalk.red(` - ${p}`));\n if (paths.length > MAX_PATHS_PER_SECTION) {\n console.log(chalk.dim(` ... and ${paths.length - MAX_PATHS_PER_SECTION} more`));\n }\n };\n renderSection('file(s) deleted on remote', deletedFiles);\n renderSection('app(s) deleted on remote', deletedApps);\n console.log();\n}\n\n/**\n * Hard-reset helper for `pull --force`. Removes local files that have no\n * remote counterpart (the regular pull keeps them \u2014 see service comment).\n * Cleans up the syncState entry too so the next status doesn't show ghosts.\n */\nasync function wipeLocalOnly(\n syncService: SyncService,\n filesDir: string,\n filterOptions: { all?: boolean; includeExtensions?: string[]; includeFolders?: string[] },\n): Promise<string[]> {\n // `all` matters: under `pull --force --all` the user expects every\n // local-only file to be wiped, not just files in the default sync\n // scope. Without it, getStatus filters down to the curated developer\n // files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden\n // directories and the folder blocklist, so the wipe loop never sees\n // anything those rules exclude.\n const status = await syncService.getStatus({ ...filterOptions, deep: false });\n const removed: string[] = [];\n const failed: { file: string; reason: string }[] = [];\n const syncState = syncService.loadSyncState();\n for (const file of status.addedLocally) {\n const fullPath = safeResolveWithinBase(filesDir, file);\n if (fs.existsSync(fullPath)) {\n // Wrap each unlink so a single permission error / file lock\n // doesn't strand the rest of the wipe. syncState is saved\n // incrementally as each unlink succeeds so a mid-run failure\n // leaves a consistent record for the next run, and the failed\n // list is surfaced at the end for manual cleanup.\n try {\n fs.unlinkSync(fullPath);\n removed.push(file);\n delete syncState.files[file];\n syncService.saveSyncState(syncState);\n } catch (err) {\n failed.push({ file, reason: err instanceof Error ? err.message : String(err) });\n }\n } else {\n // File was already gone \u2014 just drop the syncState entry.\n delete syncState.files[file];\n syncService.saveSyncState(syncState);\n }\n }\n if (failed.length > 0) {\n logger.warning(`${failed.length} local-only file(s) could not be removed:`);\n for (const f of failed) logger.dim(` ${f.file} \u2014 ${f.reason}`);\n }\n return removed;\n}\n\nasync function createDefaultPackageJson(tenantDir: string, tenant: string): Promise<void> {\n const packageJsonPath = path.join(tenantDir, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n return;\n }\n\n const packageJson = {\n name: `farseer-scripts-${tenant}`,\n version: '1.0.0',\n description: `Farseer App scripts for ${tenant}`,\n main: 'src/index.ts',\n scripts: {},\n keywords: ['farseer', 'scripts', tenant],\n author: 'Farseer',\n license: 'ISC',\n dependencies: {\n '@google-cloud/bigquery': '^7.9.0',\n '@google-cloud/storage': '^7.12.1',\n '@googleapis/sheets': '^5.0.5',\n '@sendgrid/mail': '^7.7.0',\n '@types/node-forge': '^1.3.11',\n '@xmldom/xmldom': '^0.9.8',\n arquero: '^5.4.1',\n axios: '^1.10.0',\n 'axios-retry': '^3.9.1',\n 'basic-ftp': '^5.0.5',\n 'client-oauth2': '^4.3.3',\n 'csv-parser': '^3.0.0',\n dotenv: '^16.4.5',\n 'draft-js': '^0.11.7',\n exceljs: '^4.4.0',\n 'farseer-client': FARSEER_CLIENT_URL,\n 'farseer-client-axios': FARSEER_CLIENT_AXIOS_URL,\n 'fast-xml-parser': '^4.5.0',\n 'form-data': '^4.0.0',\n googleapis: '^144.0.0',\n heapdump: '^0.3.15',\n 'image-size': '^1.1.1',\n jszip: '^3.10.1',\n 'lossless-json': '^4.0.1',\n mssql: '^10.0.4',\n 'node-fetch': '^2.7.0',\n 'node-forge': '^1.3.1',\n 'node-sp-auth': '^3.0.8',\n numeral: '^2.0.6',\n oracledb: '^6.6.0',\n papaparse: '^5.5.1',\n pdfkit: '^0.14.0',\n pdfmake: '^0.2.20',\n soap: '^1.1.11',\n 'ssh2-sftp-client': '^11.0.0',\n 'strong-soap': '^4.1.13',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n undici: '^6.19.8',\n uuid: '^11.1.0',\n winston: '^3.17.0',\n xlsx: 'https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz',\n 'xml-crypto': '^6.1.2',\n },\n devDependencies: {\n '@types/draft-js': '^0.11.18',\n '@types/heapdump': '^0.3.4',\n '@types/mssql': '^9.1.5',\n '@types/node': '^18.19.50',\n '@types/node-fetch': '^2.6.11',\n '@types/numeral': '^2.0.5',\n '@types/oracledb': '^6.5.3',\n '@types/papaparse': '^5.3.15',\n '@types/pdfmake': '^0.2.11',\n '@types/soap': '^0.18.0',\n '@types/ssh2-sftp-client': '^9.0.4',\n '@types/tough-cookie': '^4.0.5',\n '@types/uuid': '^10.0.0',\n '@types/xmldom': '^0.1.34',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n },\n };\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');\n logger.dim(`Created package.json for ${tenant}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,sBAAqB;AACrB,oBAAuB;AACvB,wBAA2B;AAC3B,uBAA0B;AAC1B,yBAA6D;AAC7D,4BAA+B;AAC/B,qBAOO;AACP,4BAAkC;AAClC,4BAAiC;AACjC,wBAAmD;AACnD,uBAA6D;AAC7D,uBAAuC;AACvC,SAAoB;AACpB,WAAsB;AAmBf,SAAS,oBA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,wBAAwB;AAAA,MACxB,mBAAmB;AAAA,MACnB,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,cAAc;AAAA,MACd,OAAO;AAAA,MACP,iBAAiB;AAAA,MACjB,OAAO;AAAA,MACP,cAAc;AAAA,MACd,cAAc;AAAA,MACd,gBAAgB;AAAA,MAChB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,oBAAoB;AAAA,MACpB,eAAe;AAAA,MACf,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,MACN,cAAc;AAAA,IAClB;AAAA,IACA,iBAAiB;AAAA,MACb,mBAAmB;AAAA,MACnB,mBAAmB;AAAA,MACnB,gBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,qBAAqB;AAAA,MACrB,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,MAClB,eAAe;AAAA,MACf,2BAA2B;AAAA,MAC3B,uBAAuB;AAAA,MACvB,eAAe;AAAA,MACf,iBAAiB;AAAA,MACjB,WAAW;AAAA,MACX,YAAY;AAAA,IAChB;AAAA,EACJ;AAEA,KAAG,cAAc,iBAAiB,KAAK,UAAU,aAAa,MAAM,CAAC,GAAG,OAAO;AAC/E,uBAAO,IAAI,4BAA4B,MAAM,EAAE;AACnD;",
|
|
6
6
|
"names": ["chalk", "inquirer"]
|
|
7
7
|
}
|
package/dist/commands/push.js
CHANGED
|
@@ -37,6 +37,7 @@ var import_inquirer = __toESM(require("inquirer"));
|
|
|
37
37
|
var import_logger = require("../utils/logger");
|
|
38
38
|
var import_fileLogger = require("../utils/fileLogger");
|
|
39
39
|
var import_farseerFactory = require("../services/farseerFactory");
|
|
40
|
+
var import_preflight = require("../services/preflight");
|
|
40
41
|
var import_syncService = require("../services/syncService");
|
|
41
42
|
var import_appSyncService = require("../services/appSyncService");
|
|
42
43
|
var import_helpers = require("../utils/helpers");
|
|
@@ -60,19 +61,14 @@ function registerPushCommand(program) {
|
|
|
60
61
|
import_cliOptions.collectValues,
|
|
61
62
|
[]
|
|
62
63
|
).action(async (arg1, arg2, options) => {
|
|
63
|
-
const { organisation, tenant } = (0,
|
|
64
|
-
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
65
|
-
if (!clientResult) {
|
|
66
|
-
(0, import_farseerFactory.showLoginPrompt)(tenant);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
64
|
+
const { organisation, tenant, client } = await (0, import_preflight.preflight)(arg1, arg2);
|
|
69
65
|
const filesDir = (0, import_helpers.getTenantFilesDir)(tenant);
|
|
70
66
|
if (!fs.existsSync(filesDir)) {
|
|
71
67
|
import_logger.logger.error(`Local folder not found: ${(0, import_helpers.displayLocalPath)(filesDir)}`);
|
|
72
68
|
import_logger.logger.dim('Run "farseer pull <tenant>" first to initialize the folder.');
|
|
73
69
|
process.exit(1);
|
|
74
70
|
}
|
|
75
|
-
const syncService = new import_syncService.SyncService(tenant,
|
|
71
|
+
const syncService = new import_syncService.SyncService(tenant, client);
|
|
76
72
|
const includeExtensions = (0, import_cliOptions.normalizeExtensions)(options.includeExt);
|
|
77
73
|
const includeFolders = options.includeFolder;
|
|
78
74
|
const onlyFiles = options.only.map(import_cliOptions.normalizeRelativePath);
|
|
@@ -127,7 +123,7 @@ function registerPushCommand(program) {
|
|
|
127
123
|
}
|
|
128
124
|
const plan = buildPushPlan(status, { force: !!options.force });
|
|
129
125
|
const { filesToUpload, filesToDelete, remoteOnlyFiles, filesToRecreate, filesToOverwrite } = plan;
|
|
130
|
-
const appSyncService = new import_appSyncService.AppSyncService(tenant,
|
|
126
|
+
const appSyncService = new import_appSyncService.AppSyncService(tenant, client);
|
|
131
127
|
const appStatus = onlyMode ? { newLocal: [], newRemote: [], modified: [], synced: [] } : await appSyncService.getStatus();
|
|
132
128
|
const hasConflicts = status.conflicts.length > 0;
|
|
133
129
|
const hasFileChanges = filesToUpload.length > 0 || filesToDelete.length > 0 || remoteOnlyFiles.length > 0 || hasConflicts;
|
|
@@ -213,7 +209,7 @@ function registerPushCommand(program) {
|
|
|
213
209
|
return;
|
|
214
210
|
}
|
|
215
211
|
}
|
|
216
|
-
await (0, import_farseerFactory.ensureFreshToken)(
|
|
212
|
+
await (0, import_farseerFactory.ensureFreshToken)(client);
|
|
217
213
|
try {
|
|
218
214
|
let result = {
|
|
219
215
|
uploaded: [],
|