@tenonhq/dovetail-core 0.0.85
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 +6 -0
- package/dist/FileLogger.js +207 -0
- package/dist/FileUtils.js +387 -0
- package/dist/Logger.js +88 -0
- package/dist/MultiScopeWatcher.js +615 -0
- package/dist/PluginManager.js +125 -0
- package/dist/_defaultOptionsOLD.js +44 -0
- package/dist/allScopesCommands.js +418 -0
- package/dist/appUtils.js +929 -0
- package/dist/benchmark.js +104 -0
- package/dist/bootstrap.js +62 -0
- package/dist/claudeCommand.js +60 -0
- package/dist/clickupCommands.js +472 -0
- package/dist/clickupPushHelper.js +33 -0
- package/dist/commander.js +466 -0
- package/dist/commands.js +378 -0
- package/dist/config.js +697 -0
- package/dist/constants.js +15 -0
- package/dist/createRecordCommand.js +314 -0
- package/dist/dashboardCommand.js +38 -0
- package/dist/defaultOptions.js +14 -0
- package/dist/deleteRecordCommand.js +282 -0
- package/dist/flowDesigner/values.js +55 -0
- package/dist/genericUtils.js +189 -0
- package/dist/gitUtils.js +99 -0
- package/dist/index.js +35 -0
- package/dist/initSystem/corePlugin.js +344 -0
- package/dist/initSystem/discovery.js +107 -0
- package/dist/initSystem/orchestrator.js +408 -0
- package/dist/logMessages.js +82 -0
- package/dist/loginCommand.js +20 -0
- package/dist/migrateCommand.js +123 -0
- package/dist/projectFiles.js +32 -0
- package/dist/recentEdits.js +66 -0
- package/dist/schemaCommand.js +85 -0
- package/dist/snClient.js +519 -0
- package/dist/tests/benchmarkRefresh.test.js +265 -0
- package/dist/tests/clickupCommands.test.js +384 -0
- package/dist/tests/clickupPushHelper.test.js +124 -0
- package/dist/tests/configFallback.test.js +68 -0
- package/dist/tests/cred.test.js +59 -0
- package/dist/tests/discovery.test.js +67 -0
- package/dist/tests/ensureUpdateSetWarnings.test.js +218 -0
- package/dist/tests/errorLogLevels.test.js +273 -0
- package/dist/tests/example.test.js +6 -0
- package/dist/tests/fileContextSkipReason.test.js +116 -0
- package/dist/tests/globalDebounce.test.js +308 -0
- package/dist/tests/migrateCommand.test.js +113 -0
- package/dist/tests/multi-scope-watcher.test.js +558 -0
- package/dist/tests/orchestrator.test.js +23 -0
- package/dist/tests/pushFiles.test.js +248 -0
- package/dist/tests/rateLimitCoordination.test.js +271 -0
- package/dist/tests/resolveConfigReadOnly.test.js +67 -0
- package/dist/tests/retryOnHttpErr.test.js +154 -0
- package/dist/tests/scopeCaching.test.js +115 -0
- package/dist/tests/serializeUpdateSetConfig.test.js +325 -0
- package/dist/tests/snClient.fallback.test.js +120 -0
- package/dist/tests/syncManifestRefresh.test.js +287 -0
- package/dist/tests/syncManifestWhitelist.test.js +192 -0
- package/dist/tests/taskClear.test.js +170 -0
- package/dist/tests/taskStaleness.test.js +220 -0
- package/dist/tests/unwrapSNResponseError.test.js +145 -0
- package/dist/tests/v2Values.test.js +79 -0
- package/dist/tests/validateTaskId.test.js +304 -0
- package/dist/tests/verifyUpdateSetSwitch.test.js +277 -0
- package/dist/tests/writeEnvVar.test.js +119 -0
- package/dist/updateSetCommands.js +702 -0
- package/dist/wizard.js +40 -0
- package/package.json +69 -0
- package/skills/dove-configure-pipeline.md +158 -0
- package/skills/dove-create-plugin.md +174 -0
- package/skills/dove-create-record.md +135 -0
- package/skills/dove-debug-build.md +117 -0
- package/skills/dove-delete-record.md +104 -0
- package/skills/dove-manage-tables.md +174 -0
- package/skills/dove-manage-update-sets.md +88 -0
- package/skills/dove-setup-project.md +154 -0
- package/skills/dove-troubleshoot-sync.md +113 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeV2Values = decodeV2Values;
|
|
4
|
+
exports.encodeV2Values = encodeV2Values;
|
|
5
|
+
const zlib_1 = require("zlib");
|
|
6
|
+
/**
|
|
7
|
+
* Decode a ServiceNow V2 Flow Designer `values` blob.
|
|
8
|
+
*
|
|
9
|
+
* Source tables:
|
|
10
|
+
* - sys_hub_action_instance_v2.values
|
|
11
|
+
* - sys_hub_trigger_instance_v2.values
|
|
12
|
+
* - sys_hub_flow_logic_instance_v2.values
|
|
13
|
+
*
|
|
14
|
+
* Storage format: base64-encoded gzipped JSON.
|
|
15
|
+
* Mirrors `GlideStringUtil.base64DecodeAsBytes()` + `GlideCompressionUtil.expandToString()`
|
|
16
|
+
* + `JSON.parse` on the ServiceNow platform.
|
|
17
|
+
*
|
|
18
|
+
* Throws with a clear message if the blob is empty, not base64, or not gzip.
|
|
19
|
+
*/
|
|
20
|
+
function decodeV2Values(blob) {
|
|
21
|
+
if (typeof blob !== "string" || blob.trim().length === 0) {
|
|
22
|
+
throw new Error("decodeV2Values: blob must be a non-empty string");
|
|
23
|
+
}
|
|
24
|
+
let buf;
|
|
25
|
+
try {
|
|
26
|
+
buf = Buffer.from(blob.trim(), "base64");
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
throw new Error("decodeV2Values: blob is not valid base64");
|
|
30
|
+
}
|
|
31
|
+
let json;
|
|
32
|
+
try {
|
|
33
|
+
json = (0, zlib_1.gunzipSync)(buf).toString("utf8");
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
throw new Error("decodeV2Values: decompression failed (input is not valid gzip after base64 decode)");
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(json);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
throw new Error("decodeV2Values: decompressed body is not valid JSON");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Encode a V2 values payload back to ServiceNow's storage format.
|
|
47
|
+
*
|
|
48
|
+
* Inverse of decodeV2Values. Provided for symmetry, diagnostic round-trip
|
|
49
|
+
* tests, and any future write path. Current Craftsman sync treats sys_hub_*
|
|
50
|
+
* as _readOnlyTables, so this is not invoked on the push path today.
|
|
51
|
+
*/
|
|
52
|
+
function encodeV2Values(value) {
|
|
53
|
+
const json = JSON.stringify(value);
|
|
54
|
+
return (0, zlib_1.gzipSync)(Buffer.from(json, "utf8")).toString("base64");
|
|
55
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.aggregateErrorMessages = exports.allSettled = void 0;
|
|
40
|
+
exports.parseFileNameParams = parseFileNameParams;
|
|
41
|
+
exports.getParsedFilesPayload = getParsedFilesPayload;
|
|
42
|
+
exports.wait = wait;
|
|
43
|
+
exports.chunkArr = chunkArr;
|
|
44
|
+
exports.processBatched = processBatched;
|
|
45
|
+
exports.allSettledBatched = allSettledBatched;
|
|
46
|
+
const path_1 = __importDefault(require("path"));
|
|
47
|
+
const ConfigManager = __importStar(require("./config"));
|
|
48
|
+
async function _getConfigFromPath(params) {
|
|
49
|
+
try {
|
|
50
|
+
let curManifest = ConfigManager.getManifest();
|
|
51
|
+
if (!curManifest) {
|
|
52
|
+
throw new Error("No Manifest file");
|
|
53
|
+
}
|
|
54
|
+
const { tableName, name } = params;
|
|
55
|
+
const { tables, scope } = curManifest;
|
|
56
|
+
const { records } = tables[tableName];
|
|
57
|
+
let sys_id = "";
|
|
58
|
+
if (records.hasOwnProperty(name)) {
|
|
59
|
+
sys_id = records[name].sys_id;
|
|
60
|
+
if (!fieldExists(records[name], params)) {
|
|
61
|
+
throw new Error(`${params.targetField} not found in the manifest for ${records[name].name}`);
|
|
62
|
+
}
|
|
63
|
+
return Object.assign({}, params, { scope: scope, sys_id: sys_id });
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
throw new Error(`Cannot find record called ${name} in ${tableName}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function fieldExists(record, context) {
|
|
74
|
+
let matches = record.files.filter((cur) => {
|
|
75
|
+
return cur.name === context.targetField;
|
|
76
|
+
});
|
|
77
|
+
return matches.length === 1;
|
|
78
|
+
}
|
|
79
|
+
function getExtension(filePath) {
|
|
80
|
+
try {
|
|
81
|
+
let ext = "." + path_1.default.basename(filePath).split(".").slice(1).join(".");
|
|
82
|
+
return ext;
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function parseFileNameParams(filePath) {
|
|
89
|
+
const ext = getExtension(filePath);
|
|
90
|
+
const resourcePath = path_1.default.dirname(filePath).split(path_1.default.sep);
|
|
91
|
+
const resources = resourcePath.slice(-3);
|
|
92
|
+
let targetField = path_1.default.basename(filePath, ext);
|
|
93
|
+
const tableName = resources[1];
|
|
94
|
+
const name = resources[2];
|
|
95
|
+
if (tableName === "sys_atf_step")
|
|
96
|
+
targetField = "inputs.script";
|
|
97
|
+
return await _getConfigFromPath({
|
|
98
|
+
filePath,
|
|
99
|
+
tableName,
|
|
100
|
+
name,
|
|
101
|
+
targetField,
|
|
102
|
+
ext,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async function getParsedFilesPayload(arr) {
|
|
106
|
+
let results = [];
|
|
107
|
+
for (let file of arr) {
|
|
108
|
+
let res = await parseFileNameParams(file);
|
|
109
|
+
if (res) {
|
|
110
|
+
results.push(res);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return results;
|
|
114
|
+
}
|
|
115
|
+
function wait(ms) {
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
setTimeout(resolve, ms);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function chunkArr(arr, chunkSize) {
|
|
121
|
+
const numChunks = Math.ceil(arr.length / chunkSize);
|
|
122
|
+
const chunks = [];
|
|
123
|
+
for (let i = 0; i < numChunks; i++) {
|
|
124
|
+
const rangeBegin = i * chunkSize;
|
|
125
|
+
const rangeEnd = rangeBegin + chunkSize > arr.length ? arr.length : rangeBegin + chunkSize;
|
|
126
|
+
chunks.push(arr.slice(rangeBegin, rangeEnd));
|
|
127
|
+
}
|
|
128
|
+
return chunks;
|
|
129
|
+
}
|
|
130
|
+
async function processBatched(items, concurrency, fn) {
|
|
131
|
+
var results = new Array(items.length);
|
|
132
|
+
var index = 0;
|
|
133
|
+
async function runNext() {
|
|
134
|
+
while (index < items.length) {
|
|
135
|
+
var currentIndex = index;
|
|
136
|
+
index++;
|
|
137
|
+
results[currentIndex] = await fn(items[currentIndex]);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
var workers = [];
|
|
141
|
+
var workerCount = Math.min(concurrency, items.length);
|
|
142
|
+
for (var i = 0; i < workerCount; i++) {
|
|
143
|
+
workers.push(runNext());
|
|
144
|
+
}
|
|
145
|
+
await Promise.all(workers);
|
|
146
|
+
return results;
|
|
147
|
+
}
|
|
148
|
+
async function allSettledBatched(items, concurrency, fn) {
|
|
149
|
+
var results = new Array(items.length);
|
|
150
|
+
var index = 0;
|
|
151
|
+
async function runNext() {
|
|
152
|
+
while (index < items.length) {
|
|
153
|
+
var currentIndex = index;
|
|
154
|
+
index++;
|
|
155
|
+
try {
|
|
156
|
+
var value = await fn(items[currentIndex]);
|
|
157
|
+
results[currentIndex] = { status: "fulfilled", value: value };
|
|
158
|
+
}
|
|
159
|
+
catch (e) {
|
|
160
|
+
results[currentIndex] = { status: "rejected", reason: e };
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
var workers = [];
|
|
165
|
+
var workerCount = Math.min(concurrency, items.length);
|
|
166
|
+
for (var i = 0; i < workerCount; i++) {
|
|
167
|
+
workers.push(runNext());
|
|
168
|
+
}
|
|
169
|
+
await Promise.all(workers);
|
|
170
|
+
return results;
|
|
171
|
+
}
|
|
172
|
+
const allSettled = (promises) => {
|
|
173
|
+
return Promise.all(promises.map((prom) => prom
|
|
174
|
+
.then((value) => ({
|
|
175
|
+
status: "fulfilled",
|
|
176
|
+
value,
|
|
177
|
+
}))
|
|
178
|
+
.catch((reason) => ({
|
|
179
|
+
status: "rejected",
|
|
180
|
+
reason,
|
|
181
|
+
}))));
|
|
182
|
+
};
|
|
183
|
+
exports.allSettled = allSettled;
|
|
184
|
+
const aggregateErrorMessages = (errs, defaultMsg, labelFn) => {
|
|
185
|
+
return errs.reduce((acc, err, index) => {
|
|
186
|
+
return `${acc}\n${labelFn(err, index)}:\n${err.message || defaultMsg}`;
|
|
187
|
+
}, "");
|
|
188
|
+
};
|
|
189
|
+
exports.aggregateErrorMessages = aggregateErrorMessages;
|
package/dist/gitUtils.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.writeDiff = exports.gitDiffToEncodedPaths = void 0;
|
|
40
|
+
const cp = __importStar(require("child_process"));
|
|
41
|
+
const util_1 = require("util");
|
|
42
|
+
const path_1 = __importDefault(require("path"));
|
|
43
|
+
const Logger_1 = require("./Logger");
|
|
44
|
+
const constants_1 = require("./constants");
|
|
45
|
+
const ConfigManager = __importStar(require("./config"));
|
|
46
|
+
const fs_1 = __importDefault(require("fs"));
|
|
47
|
+
const fUtils = __importStar(require("./FileUtils"));
|
|
48
|
+
const execFile = (0, util_1.promisify)(cp.execFile);
|
|
49
|
+
const gitDiffToEncodedPaths = async (diff) => {
|
|
50
|
+
if (diff !== "")
|
|
51
|
+
return gitDiff(diff, ConfigManager.getSourcePath());
|
|
52
|
+
return ConfigManager.getSourcePath();
|
|
53
|
+
};
|
|
54
|
+
exports.gitDiffToEncodedPaths = gitDiffToEncodedPaths;
|
|
55
|
+
const gitDiff = async (target, sourcePath) => {
|
|
56
|
+
const { stdout } = await execFile("git", [
|
|
57
|
+
"diff",
|
|
58
|
+
"--name-status",
|
|
59
|
+
`${target}...`,
|
|
60
|
+
"--",
|
|
61
|
+
sourcePath,
|
|
62
|
+
]);
|
|
63
|
+
return formatGitFiles(stdout.trim());
|
|
64
|
+
};
|
|
65
|
+
const writeDiff = async (files) => {
|
|
66
|
+
let paths = await fUtils.encodedPathsToFilePaths(files);
|
|
67
|
+
Logger_1.logger.silly(`${paths.length} paths found...`);
|
|
68
|
+
Logger_1.logger.silly(JSON.stringify(paths, null, 2));
|
|
69
|
+
fs_1.default.promises.writeFile(ConfigManager.getDiffPath(), JSON.stringify({ changed: paths }));
|
|
70
|
+
};
|
|
71
|
+
exports.writeDiff = writeDiff;
|
|
72
|
+
const formatGitFiles = async (gitFiles) => {
|
|
73
|
+
const baseRepoPath = await getRepoRootDir();
|
|
74
|
+
const workspaceDir = process.cwd();
|
|
75
|
+
const fileSplit = gitFiles.split(/\r?\n/);
|
|
76
|
+
const fileArray = [];
|
|
77
|
+
fileSplit.forEach((diffFile) => {
|
|
78
|
+
if (diffFile !== "") {
|
|
79
|
+
const modCode = diffFile.charAt(0);
|
|
80
|
+
if (modCode !== "D") {
|
|
81
|
+
const filePath = diffFile.slice(1).trim();
|
|
82
|
+
if (isValidScope(filePath, workspaceDir, baseRepoPath)) {
|
|
83
|
+
Logger_1.logger.info(diffFile);
|
|
84
|
+
const absFilePath = path_1.default.resolve(baseRepoPath, filePath);
|
|
85
|
+
fileArray.push(absFilePath);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return fileArray.join(constants_1.PATH_DELIMITER);
|
|
91
|
+
};
|
|
92
|
+
const getRepoRootDir = async () => {
|
|
93
|
+
const { stdout } = await execFile("git", ["rev-parse", "--show-toplevel"]);
|
|
94
|
+
return stdout.trim();
|
|
95
|
+
};
|
|
96
|
+
const isValidScope = (file, scope, baseRepoPath) => {
|
|
97
|
+
const relativePath = path_1.default.relative(baseRepoPath, scope);
|
|
98
|
+
return file.startsWith(relativePath) ? true : false;
|
|
99
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.encodeV2Values = exports.decodeV2Values = void 0;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const bootstrap_1 = require("./bootstrap");
|
|
10
|
+
const FileLogger_1 = require("./FileLogger");
|
|
11
|
+
// Library exports — consumers can `import { decodeV2Values } from "@tenonhq/dovetail-core"`.
|
|
12
|
+
// Keep exports above the CLI entry so bundlers/TS can tree-shake and require() consumers
|
|
13
|
+
// never accidentally invoke main().
|
|
14
|
+
var values_1 = require("./flowDesigner/values");
|
|
15
|
+
Object.defineProperty(exports, "decodeV2Values", { enumerable: true, get: function () { return values_1.decodeV2Values; } });
|
|
16
|
+
Object.defineProperty(exports, "encodeV2Values", { enumerable: true, get: function () { return values_1.encodeV2Values; } });
|
|
17
|
+
async function main() {
|
|
18
|
+
// Initialize file logging as early as possible
|
|
19
|
+
FileLogger_1.fileLogger.info("Starting Dovetail...");
|
|
20
|
+
// Deprecated alias: warn once when the CLI is invoked as `sinc` instead of `dove`.
|
|
21
|
+
// The `sinc` bin shim is kept for one minor version to avoid breaking existing scripts.
|
|
22
|
+
const invokedAs = path_1.default.basename(process.argv[1] || "").replace(/\.(js|cmd|exe)$/i, "");
|
|
23
|
+
if (invokedAs === "sinc") {
|
|
24
|
+
process.stderr.write("[deprecation] The 'sinc' command has been renamed to 'dove'. Run 'npx dove migrate' to update your project, then call 'dove' going forward. The 'sinc' alias will be removed in the next major release.\n");
|
|
25
|
+
}
|
|
26
|
+
await (0, bootstrap_1.init)();
|
|
27
|
+
}
|
|
28
|
+
// Only run the CLI when this file is executed directly (e.g. `npx dove`, `node dist/index.js`).
|
|
29
|
+
// When imported as a library, require.main !== module and main() is skipped.
|
|
30
|
+
if (require.main === module) {
|
|
31
|
+
main().catch(function (e) {
|
|
32
|
+
FileLogger_1.fileLogger.error("Fatal error: " + String(e));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
});
|
|
35
|
+
}
|