@tenonhq/dovetail-core 0.0.133 → 0.0.134
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/dist/FileUtils.js +7 -0
- package/dist/fingerprint.js +4 -3
- package/dist/layoutElements.js +386 -0
- package/dist/reconcileCommand.js +6 -0
- package/dist/snClient.js +49 -6
- package/dist/tests/layoutElements.test.js +259 -0
- package/dist/tests/layoutElementsWriteGuards.test.js +113 -0
- package/dist/tests/snClient.layoutElements.test.js +133 -0
- package/package.json +3 -3
- package/release-manifest.json +31 -22
package/dist/FileUtils.js
CHANGED
|
@@ -45,6 +45,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
45
45
|
const ConfigManager = __importStar(require("./config"));
|
|
46
46
|
const FileLogger_1 = require("./FileLogger");
|
|
47
47
|
const fingerprint_1 = require("./fingerprint");
|
|
48
|
+
const layoutElements_1 = require("./layoutElements");
|
|
48
49
|
const SNFileExists = (parentDirPath) => async (file) => {
|
|
49
50
|
try {
|
|
50
51
|
const files = await fs_1.promises.readdir(parentDirPath);
|
|
@@ -211,6 +212,12 @@ const getFileContextWithSkipReason = (filePath) => {
|
|
|
211
212
|
if ((0, fingerprint_1.isFingerprintFilePath)(filePath)) {
|
|
212
213
|
return { skipReason: "fingerprint only, read-only" };
|
|
213
214
|
}
|
|
215
|
+
// A layout elements file (columns.txt, fields.txt, sections.txt) is read from
|
|
216
|
+
// a layout's child rows (layoutElements.ts); it is not a field of the layout,
|
|
217
|
+
// so it is never pushed, whatever the manifest says.
|
|
218
|
+
if ((0, layoutElements_1.isLayoutElementsFilePath)(filePath)) {
|
|
219
|
+
return { skipReason: "layout elements, read-only" };
|
|
220
|
+
}
|
|
214
221
|
const ext = getFileExtension(filePath);
|
|
215
222
|
const [tableName, recordName] = path_1.default
|
|
216
223
|
.dirname(filePath)
|
package/dist/fingerprint.js
CHANGED
|
@@ -64,9 +64,9 @@ const fingerprintFieldsFor = (tableOptions, tableName) => {
|
|
|
64
64
|
return fields;
|
|
65
65
|
};
|
|
66
66
|
exports.fingerprintFieldsFor = fingerprintFieldsFor;
|
|
67
|
-
// A copy of tableOptions without the client-only `fingerprint
|
|
68
|
-
// request body. The input is
|
|
69
|
-
// the
|
|
67
|
+
// A copy of tableOptions without the client-only keys (`fingerprint`, and
|
|
68
|
+
// `layoutElements` from layoutElements.ts), for the request body. The input is
|
|
69
|
+
// never mutated: the caller keeps using it to apply them to the response.
|
|
70
70
|
const stripClientOnlyTableOptions = (tableOptions) => {
|
|
71
71
|
const out = {};
|
|
72
72
|
if (!isPlainObject(tableOptions))
|
|
@@ -79,6 +79,7 @@ const stripClientOnlyTableOptions = (tableOptions) => {
|
|
|
79
79
|
continue;
|
|
80
80
|
const copy = Object.assign({}, opts);
|
|
81
81
|
delete copy.fingerprint;
|
|
82
|
+
delete copy.layoutElements;
|
|
82
83
|
out[tables[i]] = copy;
|
|
83
84
|
}
|
|
84
85
|
return out;
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Layout elements: mirror what a layout shows, not only that it exists.
|
|
3
|
+
//
|
|
4
|
+
// A list layout (sys_ui_list), a form section (sys_ui_section) and a form
|
|
5
|
+
// (sys_ui_form) are application files, but their content lives in child rows that
|
|
6
|
+
// are not: sys_ui_list_element (the columns), sys_ui_element (the fields) and
|
|
7
|
+
// sys_ui_form_section (the section order). Those rows carry no sys_scope, so the
|
|
8
|
+
// instance cannot list them per application. This module reads them through the
|
|
9
|
+
// Table API, which every instance already serves, and writes them as one text
|
|
10
|
+
// file in the parent layout's folder:
|
|
11
|
+
//
|
|
12
|
+
// sys_ui_list/<layout>/columns.txt one column per line, in list order
|
|
13
|
+
// sys_ui_section/<section>/fields.txt one form element per line, in form order
|
|
14
|
+
// sys_ui_form/<form>/sections.txt one section caption per line, in tab order
|
|
15
|
+
//
|
|
16
|
+
// Configured per table in dove.config.js, off by default:
|
|
17
|
+
//
|
|
18
|
+
// tableOptions: { sys_ui_list: { layoutElements: true } }
|
|
19
|
+
//
|
|
20
|
+
// Applied in snClient to the two reads every writer uses: getManifest lists the
|
|
21
|
+
// file on each record, and getMissingFiles (bulkDownload) fills its content. The
|
|
22
|
+
// file name is never sent to the instance as a field. Push refuses these files
|
|
23
|
+
// (FileUtils.getFileContextWithSkipReason) and a reconcile create leaves them
|
|
24
|
+
// out, so a layout is never written back from them.
|
|
25
|
+
//
|
|
26
|
+
// Client-side only: `layoutElements` is stripped from tableOptions before they
|
|
27
|
+
// are sent to the instance.
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.recordIdsByTable = exports.fillLayoutElementContent = exports.readLayoutElements = exports.splitLayoutElementRequests = exports.addLayoutElementFiles = exports.formatLayoutElements = exports.isLayoutElementsFilePath = exports.isLayoutElementsFile = exports.layoutElementTablesFor = exports.LAYOUT_ELEMENT_TABLES = exports.LAYOUT_ELEMENTS_FILE_TYPE = void 0;
|
|
33
|
+
const path_1 = __importDefault(require("path"));
|
|
34
|
+
exports.LAYOUT_ELEMENTS_FILE_TYPE = "txt";
|
|
35
|
+
const SYS_ID_RE = /^[0-9a-f]{32}$/;
|
|
36
|
+
const isPlainObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
37
|
+
// A Table API value is a plain string, or { value, link } for a reference when
|
|
38
|
+
// the link is not excluded. Anything else reads as "".
|
|
39
|
+
const valueOf = (row, key) => {
|
|
40
|
+
const v = row[key];
|
|
41
|
+
if (typeof v === "string")
|
|
42
|
+
return v;
|
|
43
|
+
if (typeof v === "number" || typeof v === "boolean")
|
|
44
|
+
return String(v);
|
|
45
|
+
if (isPlainObject(v) && typeof v.value === "string")
|
|
46
|
+
return v.value;
|
|
47
|
+
return "";
|
|
48
|
+
};
|
|
49
|
+
const isTrue = (v) => v === "true" || v === "1";
|
|
50
|
+
const AGGREGATES = [
|
|
51
|
+
["sum", "sum"],
|
|
52
|
+
["average_value", "average"],
|
|
53
|
+
["min_value", "min"],
|
|
54
|
+
["max_value", "max"],
|
|
55
|
+
];
|
|
56
|
+
const columnLine = (row) => {
|
|
57
|
+
const element = valueOf(row, "element") || "(no element)";
|
|
58
|
+
const flags = [];
|
|
59
|
+
for (let i = 0; i < AGGREGATES.length; i++) {
|
|
60
|
+
if (isTrue(valueOf(row, AGGREGATES[i][0])))
|
|
61
|
+
flags.push(AGGREGATES[i][1]);
|
|
62
|
+
}
|
|
63
|
+
return flags.length ? element + " [" + flags.join(", ") + "]" : element;
|
|
64
|
+
};
|
|
65
|
+
// A split or other marker row repeats its type as the element (".split"), so
|
|
66
|
+
// the type is only written when it adds something ("activity.xml [formatter]").
|
|
67
|
+
const fieldLine = (row) => {
|
|
68
|
+
const element = valueOf(row, "element") || "(no element)";
|
|
69
|
+
const type = valueOf(row, "type");
|
|
70
|
+
return type && type !== element ? element + " [" + type + "]" : element;
|
|
71
|
+
};
|
|
72
|
+
// A form lists its sections by reference. The main section has no caption; a
|
|
73
|
+
// reference to a section that cannot be read keeps its id, so it stays visible.
|
|
74
|
+
const sectionLine = (row) => {
|
|
75
|
+
const sectionId = valueOf(row, "sys_ui_section");
|
|
76
|
+
if (valueOf(row, "sys_ui_section.sys_id") === "") {
|
|
77
|
+
return "(missing section " + (sectionId || "with no id") + ")";
|
|
78
|
+
}
|
|
79
|
+
const caption = valueOf(row, "sys_ui_section.caption");
|
|
80
|
+
return caption !== "" ? caption : "(no caption)";
|
|
81
|
+
};
|
|
82
|
+
const SPECS = {
|
|
83
|
+
sys_ui_list: {
|
|
84
|
+
file: "columns",
|
|
85
|
+
childTable: "sys_ui_list_element",
|
|
86
|
+
parentField: "list_id",
|
|
87
|
+
fields: ["sys_id", "list_id", "element", "position", "sum", "average_value", "min_value", "max_value"],
|
|
88
|
+
line: columnLine,
|
|
89
|
+
},
|
|
90
|
+
sys_ui_section: {
|
|
91
|
+
file: "fields",
|
|
92
|
+
childTable: "sys_ui_element",
|
|
93
|
+
parentField: "sys_ui_section",
|
|
94
|
+
fields: ["sys_id", "sys_ui_section", "element", "type", "position"],
|
|
95
|
+
line: fieldLine,
|
|
96
|
+
},
|
|
97
|
+
sys_ui_form: {
|
|
98
|
+
file: "sections",
|
|
99
|
+
childTable: "sys_ui_form_section",
|
|
100
|
+
parentField: "sys_ui_form",
|
|
101
|
+
fields: ["sys_id", "sys_ui_form", "sys_ui_section", "position", "sys_ui_section.sys_id", "sys_ui_section.caption"],
|
|
102
|
+
line: sectionLine,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
const specFor = (table) => Object.prototype.hasOwnProperty.call(SPECS, table) ? SPECS[table] : undefined;
|
|
106
|
+
/** The tables that can carry layout elements. */
|
|
107
|
+
exports.LAYOUT_ELEMENT_TABLES = Object.keys(SPECS);
|
|
108
|
+
/**
|
|
109
|
+
* The layout tables whose table options set `layoutElements: true`. Any other
|
|
110
|
+
* value, or the option on a table that has no layout elements, is ignored and
|
|
111
|
+
* reported through `warn`, so a typo mirrors nothing instead of guessing.
|
|
112
|
+
*/
|
|
113
|
+
const layoutElementTablesFor = (tableOptions, warn) => {
|
|
114
|
+
if (!isPlainObject(tableOptions))
|
|
115
|
+
return [];
|
|
116
|
+
const out = [];
|
|
117
|
+
const tables = Object.keys(tableOptions).sort();
|
|
118
|
+
for (let i = 0; i < tables.length; i++) {
|
|
119
|
+
const opts = tableOptions[tables[i]];
|
|
120
|
+
if (!isPlainObject(opts) || !("layoutElements" in opts))
|
|
121
|
+
continue;
|
|
122
|
+
const value = opts.layoutElements;
|
|
123
|
+
if (!specFor(tables[i])) {
|
|
124
|
+
if (warn)
|
|
125
|
+
warn("tableOptions." + tables[i] + ".layoutElements is ignored: only " + exports.LAYOUT_ELEMENT_TABLES.join(", ") + " have layout elements");
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (value !== true) {
|
|
129
|
+
if (value !== false && warn)
|
|
130
|
+
warn("tableOptions." + tables[i] + ".layoutElements is ignored: it must be true or false");
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
out.push(tables[i]);
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
};
|
|
137
|
+
exports.layoutElementTablesFor = layoutElementTablesFor;
|
|
138
|
+
/** True for a layout elements file: one of the three derived files of its table. */
|
|
139
|
+
const isLayoutElementsFile = (table, name, type) => {
|
|
140
|
+
const spec = specFor(table);
|
|
141
|
+
if (!spec || name !== spec.file)
|
|
142
|
+
return false;
|
|
143
|
+
return type === undefined || type === exports.LAYOUT_ELEMENTS_FILE_TYPE;
|
|
144
|
+
};
|
|
145
|
+
exports.isLayoutElementsFile = isLayoutElementsFile;
|
|
146
|
+
/** True for the on-disk path of a layout elements file: <table>/<record>/<file>.txt */
|
|
147
|
+
const isLayoutElementsFilePath = (filePath) => {
|
|
148
|
+
if (typeof filePath !== "string" || filePath === "")
|
|
149
|
+
return false;
|
|
150
|
+
const ext = "." + exports.LAYOUT_ELEMENTS_FILE_TYPE;
|
|
151
|
+
const base = path_1.default.basename(filePath);
|
|
152
|
+
if (base.slice(-ext.length) !== ext)
|
|
153
|
+
return false;
|
|
154
|
+
const table = path_1.default.basename(path_1.default.dirname(path_1.default.dirname(filePath)));
|
|
155
|
+
return (0, exports.isLayoutElementsFile)(table, base.slice(0, -ext.length), exports.LAYOUT_ELEMENTS_FILE_TYPE);
|
|
156
|
+
};
|
|
157
|
+
exports.isLayoutElementsFilePath = isLayoutElementsFilePath;
|
|
158
|
+
const positionOf = (row) => {
|
|
159
|
+
const n = parseInt(valueOf(row, "position"), 10);
|
|
160
|
+
return isNaN(n) ? Number.MAX_SAFE_INTEGER : n;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* The file content for one parent's child rows: one line per row, ordered by
|
|
164
|
+
* position, then by the line, then by the row's id, so the file is the same on
|
|
165
|
+
* every pull. No rows is an empty file.
|
|
166
|
+
*/
|
|
167
|
+
const formatLayoutElements = (table, rows) => {
|
|
168
|
+
const spec = specFor(table);
|
|
169
|
+
if (!spec)
|
|
170
|
+
throw new Error("Table " + table + " has no layout elements");
|
|
171
|
+
const items = [];
|
|
172
|
+
for (let i = 0; i < rows.length; i++) {
|
|
173
|
+
const row = rows[i];
|
|
174
|
+
if (!isPlainObject(row))
|
|
175
|
+
continue;
|
|
176
|
+
items.push({ pos: positionOf(row), line: spec.line(row), id: valueOf(row, "sys_id") });
|
|
177
|
+
}
|
|
178
|
+
items.sort(function (a, b) {
|
|
179
|
+
if (a.pos !== b.pos)
|
|
180
|
+
return a.pos - b.pos;
|
|
181
|
+
if (a.line !== b.line)
|
|
182
|
+
return a.line < b.line ? -1 : 1;
|
|
183
|
+
if (a.id !== b.id)
|
|
184
|
+
return a.id < b.id ? -1 : 1;
|
|
185
|
+
return 0;
|
|
186
|
+
});
|
|
187
|
+
if (items.length === 0)
|
|
188
|
+
return "";
|
|
189
|
+
return items.map(function (it) { return it.line; }).join("\n") + "\n";
|
|
190
|
+
};
|
|
191
|
+
exports.formatLayoutElements = formatLayoutElements;
|
|
192
|
+
/**
|
|
193
|
+
* Add the layout elements file to every record of an enabled table in a
|
|
194
|
+
* getManifest table map, in place. Idempotent; a no-op for any other table.
|
|
195
|
+
*/
|
|
196
|
+
const addLayoutElementFiles = (tables, enabledTables) => {
|
|
197
|
+
if (!isPlainObject(tables))
|
|
198
|
+
return tables;
|
|
199
|
+
for (let t = 0; t < enabledTables.length; t++) {
|
|
200
|
+
const spec = specFor(enabledTables[t]);
|
|
201
|
+
const table = tables[enabledTables[t]];
|
|
202
|
+
if (!spec || !isPlainObject(table) || !isPlainObject(table.records))
|
|
203
|
+
continue;
|
|
204
|
+
const names = Object.keys(table.records);
|
|
205
|
+
for (let r = 0; r < names.length; r++) {
|
|
206
|
+
const record = table.records[names[r]];
|
|
207
|
+
if (!isPlainObject(record))
|
|
208
|
+
continue;
|
|
209
|
+
if (!Array.isArray(record.files))
|
|
210
|
+
record.files = [];
|
|
211
|
+
const has = record.files.some(function (f) { return isPlainObject(f) && f.name === spec.file; });
|
|
212
|
+
if (!has)
|
|
213
|
+
record.files.push({ name: spec.file, type: exports.LAYOUT_ELEMENTS_FILE_TYPE });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return tables;
|
|
217
|
+
};
|
|
218
|
+
exports.addLayoutElementFiles = addLayoutElementFiles;
|
|
219
|
+
/**
|
|
220
|
+
* Take the layout elements files out of a bulkDownload request (they are not
|
|
221
|
+
* fields, so the instance cannot serve them) and remember which records asked
|
|
222
|
+
* for them. The caller's map is not mutated.
|
|
223
|
+
*/
|
|
224
|
+
const splitLayoutElementRequests = (missingFiles) => {
|
|
225
|
+
const request = {};
|
|
226
|
+
const wanted = {};
|
|
227
|
+
if (!isPlainObject(missingFiles))
|
|
228
|
+
return { request: request, wanted: wanted };
|
|
229
|
+
const tables = Object.keys(missingFiles);
|
|
230
|
+
for (let t = 0; t < tables.length; t++) {
|
|
231
|
+
const tableName = tables[t];
|
|
232
|
+
const records = missingFiles[tableName];
|
|
233
|
+
const spec = specFor(tableName);
|
|
234
|
+
if (!spec || !isPlainObject(records)) {
|
|
235
|
+
request[tableName] = records;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const out = {};
|
|
239
|
+
const ids = Object.keys(records);
|
|
240
|
+
for (let r = 0; r < ids.length; r++) {
|
|
241
|
+
const files = Array.isArray(records[ids[r]]) ? records[ids[r]] : [];
|
|
242
|
+
const kept = [];
|
|
243
|
+
let asked = false;
|
|
244
|
+
for (let f = 0; f < files.length; f++) {
|
|
245
|
+
if ((0, exports.isLayoutElementsFile)(tableName, files[f].name, files[f].type))
|
|
246
|
+
asked = true;
|
|
247
|
+
else
|
|
248
|
+
kept.push(files[f]);
|
|
249
|
+
}
|
|
250
|
+
out[ids[r]] = kept;
|
|
251
|
+
if (asked) {
|
|
252
|
+
if (!wanted[tableName])
|
|
253
|
+
wanted[tableName] = [];
|
|
254
|
+
wanted[tableName].push(ids[r]);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
request[tableName] = out;
|
|
258
|
+
}
|
|
259
|
+
return { request: request, wanted: wanted };
|
|
260
|
+
};
|
|
261
|
+
exports.splitLayoutElementRequests = splitLayoutElementRequests;
|
|
262
|
+
const DEFAULT_READ = { pageSize: 1000, chunkSize: 100 };
|
|
263
|
+
const MAX_PAGES_PER_CHUNK = 1000;
|
|
264
|
+
/**
|
|
265
|
+
* Read the child rows of each parent layout and format them. Every parent gets
|
|
266
|
+
* an entry: "" when it has no child rows. A parent id that is not a record id is
|
|
267
|
+
* refused before any query runs, and a failed read throws, so a missing read can
|
|
268
|
+
* never be written as an empty layout.
|
|
269
|
+
*/
|
|
270
|
+
const readLayoutElements = async (read, table, parentIds, options) => {
|
|
271
|
+
const spec = specFor(table);
|
|
272
|
+
if (!spec)
|
|
273
|
+
throw new Error("Table " + table + " has no layout elements");
|
|
274
|
+
const opts = Object.assign({}, DEFAULT_READ, options || {});
|
|
275
|
+
if (!(opts.pageSize >= 1) || !(opts.chunkSize >= 1))
|
|
276
|
+
throw new Error("Invalid layout elements read options");
|
|
277
|
+
const ids = [];
|
|
278
|
+
for (let i = 0; i < parentIds.length; i++) {
|
|
279
|
+
const pid = parentIds[i];
|
|
280
|
+
if (typeof pid !== "string" || !SYS_ID_RE.test(pid)) {
|
|
281
|
+
throw new Error("Refusing to read " + spec.childTable + " for '" + String(pid) + "': not a record id");
|
|
282
|
+
}
|
|
283
|
+
if (ids.indexOf(pid) === -1)
|
|
284
|
+
ids.push(pid);
|
|
285
|
+
}
|
|
286
|
+
const rowsByParent = {};
|
|
287
|
+
for (let i = 0; i < ids.length; i++)
|
|
288
|
+
rowsByParent[ids[i]] = [];
|
|
289
|
+
for (let c = 0; c < ids.length; c += opts.chunkSize) {
|
|
290
|
+
const chunk = ids.slice(c, c + opts.chunkSize);
|
|
291
|
+
const query = spec.parentField + "IN" + chunk.join(",") + "^ORDERBYsys_id";
|
|
292
|
+
let offset = 0;
|
|
293
|
+
for (let page = 0;; page++) {
|
|
294
|
+
if (page >= MAX_PAGES_PER_CHUNK) {
|
|
295
|
+
throw new Error("Too many pages reading " + spec.childTable + "; refusing to continue");
|
|
296
|
+
}
|
|
297
|
+
const rows = await read(spec.childTable, query, spec.fields, opts.pageSize, offset);
|
|
298
|
+
if (!Array.isArray(rows))
|
|
299
|
+
throw new Error("Unexpected response reading " + spec.childTable);
|
|
300
|
+
for (let r = 0; r < rows.length; r++) {
|
|
301
|
+
const row = rows[r];
|
|
302
|
+
if (!isPlainObject(row))
|
|
303
|
+
continue;
|
|
304
|
+
const parent = valueOf(row, spec.parentField);
|
|
305
|
+
// A row for a parent that was not asked for is ignored, never attached.
|
|
306
|
+
if (Object.prototype.hasOwnProperty.call(rowsByParent, parent) && chunk.indexOf(parent) !== -1) {
|
|
307
|
+
rowsByParent[parent].push(row);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (rows.length < opts.pageSize)
|
|
311
|
+
break;
|
|
312
|
+
offset += opts.pageSize;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
const out = {};
|
|
316
|
+
for (let i = 0; i < ids.length; i++)
|
|
317
|
+
out[ids[i]] = (0, exports.formatLayoutElements)(table, rowsByParent[ids[i]]);
|
|
318
|
+
return out;
|
|
319
|
+
};
|
|
320
|
+
exports.readLayoutElements = readLayoutElements;
|
|
321
|
+
/**
|
|
322
|
+
* Fill the layout elements file of each wanted record in a table map (a
|
|
323
|
+
* bulkDownload result, or a getManifest map read with contents), in place.
|
|
324
|
+
* Records are matched by sys_id, never by name. A wanted record the map does
|
|
325
|
+
* not hold is left alone.
|
|
326
|
+
*/
|
|
327
|
+
const fillLayoutElementContent = async (tables, wanted, read, options) => {
|
|
328
|
+
if (!isPlainObject(tables) || !isPlainObject(wanted))
|
|
329
|
+
return tables;
|
|
330
|
+
const tableNames = Object.keys(wanted).sort();
|
|
331
|
+
for (let t = 0; t < tableNames.length; t++) {
|
|
332
|
+
const tableName = tableNames[t];
|
|
333
|
+
const spec = specFor(tableName);
|
|
334
|
+
const ids = wanted[tableName];
|
|
335
|
+
if (!spec || !Array.isArray(ids) || ids.length === 0)
|
|
336
|
+
continue;
|
|
337
|
+
const content = await (0, exports.readLayoutElements)(read, tableName, ids, options);
|
|
338
|
+
const table = tables[tableName];
|
|
339
|
+
if (!isPlainObject(table) || !isPlainObject(table.records))
|
|
340
|
+
continue;
|
|
341
|
+
const names = Object.keys(table.records);
|
|
342
|
+
for (let r = 0; r < names.length; r++) {
|
|
343
|
+
const record = table.records[names[r]];
|
|
344
|
+
if (!isPlainObject(record) || typeof record.sys_id !== "string")
|
|
345
|
+
continue;
|
|
346
|
+
if (!Object.prototype.hasOwnProperty.call(content, record.sys_id))
|
|
347
|
+
continue;
|
|
348
|
+
if (!Array.isArray(record.files))
|
|
349
|
+
record.files = [];
|
|
350
|
+
const file = { name: spec.file, type: exports.LAYOUT_ELEMENTS_FILE_TYPE, content: content[record.sys_id] };
|
|
351
|
+
let replaced = false;
|
|
352
|
+
for (let f = 0; f < record.files.length; f++) {
|
|
353
|
+
if (isPlainObject(record.files[f]) && record.files[f].name === spec.file) {
|
|
354
|
+
record.files[f] = file;
|
|
355
|
+
replaced = true;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (!replaced)
|
|
359
|
+
record.files.push(file);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return tables;
|
|
363
|
+
};
|
|
364
|
+
exports.fillLayoutElementContent = fillLayoutElementContent;
|
|
365
|
+
/** Record ids of every record of the enabled tables in a table map. */
|
|
366
|
+
const recordIdsByTable = (tables, enabledTables) => {
|
|
367
|
+
const out = {};
|
|
368
|
+
if (!isPlainObject(tables))
|
|
369
|
+
return out;
|
|
370
|
+
for (let t = 0; t < enabledTables.length; t++) {
|
|
371
|
+
const table = tables[enabledTables[t]];
|
|
372
|
+
if (!isPlainObject(table) || !isPlainObject(table.records))
|
|
373
|
+
continue;
|
|
374
|
+
const ids = [];
|
|
375
|
+
const names = Object.keys(table.records);
|
|
376
|
+
for (let r = 0; r < names.length; r++) {
|
|
377
|
+
const record = table.records[names[r]];
|
|
378
|
+
if (isPlainObject(record) && typeof record.sys_id === "string")
|
|
379
|
+
ids.push(record.sys_id);
|
|
380
|
+
}
|
|
381
|
+
if (ids.length)
|
|
382
|
+
out[enabledTables[t]] = ids;
|
|
383
|
+
}
|
|
384
|
+
return out;
|
|
385
|
+
};
|
|
386
|
+
exports.recordIdsByTable = recordIdsByTable;
|
package/dist/reconcileCommand.js
CHANGED
|
@@ -73,6 +73,7 @@ const recordSource_1 = require("./reconcile/recordSource");
|
|
|
73
73
|
const recordDiff_1 = require("./reconcile/recordDiff");
|
|
74
74
|
const fields_1 = require("./reconcile/fields");
|
|
75
75
|
const fingerprint_1 = require("./fingerprint");
|
|
76
|
+
const layoutElements_1 = require("./layoutElements");
|
|
76
77
|
const baseline_1 = require("./reconcile/baseline");
|
|
77
78
|
const report_1 = require("./reconcile/report");
|
|
78
79
|
const applyPlan_1 = require("./reconcile/applyPlan");
|
|
@@ -333,6 +334,11 @@ async function buildCreateFields(scope, change) {
|
|
|
333
334
|
if (!(0, fields_1.isComparableField)({ name, type })) {
|
|
334
335
|
continue;
|
|
335
336
|
}
|
|
337
|
+
// A layout elements file is read from the layout's child rows
|
|
338
|
+
// (layoutElements.ts), not a field of the record: never send it.
|
|
339
|
+
if ((0, layoutElements_1.isLayoutElementsFile)(change.table, name, type)) {
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
336
342
|
try {
|
|
337
343
|
const stat = await fs_1.promises.stat(path_1.default.join(recordDir, entry));
|
|
338
344
|
if (stat.isFile()) {
|
package/dist/snClient.js
CHANGED
|
@@ -18,6 +18,7 @@ const genericUtils_1 = require("./genericUtils");
|
|
|
18
18
|
const Logger_1 = require("./Logger");
|
|
19
19
|
const FileLogger_1 = require("./FileLogger");
|
|
20
20
|
const fingerprint_1 = require("./fingerprint");
|
|
21
|
+
const layoutElements_1 = require("./layoutElements");
|
|
21
22
|
const authFailure_1 = require("./authFailure");
|
|
22
23
|
// Benchmark sink. Null when --benchmark is off; zero overhead in that case.
|
|
23
24
|
let _benchmarkSink = null;
|
|
@@ -606,20 +607,52 @@ const snClient = (baseURL, username, password, apiKey) => {
|
|
|
606
607
|
user: userSysId,
|
|
607
608
|
});
|
|
608
609
|
};
|
|
610
|
+
// Rows of one table through the Table API, raw values, reference links left
|
|
611
|
+
// out. Used for the child rows of layouts (layoutElements.ts); the table, the
|
|
612
|
+
// fields and the query are built there from constants and checked record ids.
|
|
613
|
+
const readTableRows = async (table, query, fields, limit, offset) => {
|
|
614
|
+
const endpoint = "api/now/table/" + encodeURIComponent(table);
|
|
615
|
+
const resp = await client.get(endpoint, {
|
|
616
|
+
params: {
|
|
617
|
+
sysparm_query: query,
|
|
618
|
+
sysparm_fields: fields.join(","),
|
|
619
|
+
sysparm_limit: String(limit),
|
|
620
|
+
sysparm_offset: String(offset),
|
|
621
|
+
sysparm_exclude_reference_link: "true",
|
|
622
|
+
sysparm_display_value: "false",
|
|
623
|
+
// With a long IN list the instance cannot build its pagination Link
|
|
624
|
+
// header and answers HTTP 400 "Pagination not supported". Paging is
|
|
625
|
+
// done here by limit and offset, so the header is not needed.
|
|
626
|
+
sysparm_suppress_pagination_header: "true",
|
|
627
|
+
},
|
|
628
|
+
});
|
|
629
|
+
const rows = resp && resp.data ? resp.data.result : undefined;
|
|
630
|
+
if (!Array.isArray(rows)) {
|
|
631
|
+
throw new Error("Unexpected response reading " + table + " (no result array)");
|
|
632
|
+
}
|
|
633
|
+
return rows;
|
|
634
|
+
};
|
|
635
|
+
const warnLayoutOption = (message) => {
|
|
636
|
+
Logger_1.logger.warn(message);
|
|
637
|
+
};
|
|
609
638
|
const getMissingFiles = (missingFiles, tableOptions) => {
|
|
610
639
|
const endpoint = `api/cadso/dovetail_sync/bulkDownload`;
|
|
611
640
|
const tableCount = Object.keys(missingFiles).length;
|
|
612
641
|
FileLogger_1.fileLogger.debug("Bulk downloading files for " + tableCount + " tables");
|
|
613
|
-
//
|
|
614
|
-
//
|
|
642
|
+
// A layout elements file is not a field: ask the instance for the real
|
|
643
|
+
// fields only, then read the child rows through the Table API.
|
|
644
|
+
const layoutRequests = (0, layoutElements_1.splitLayoutElementRequests)(missingFiles);
|
|
645
|
+
// `fingerprint` and `layoutElements` are client-only: stripped from the
|
|
646
|
+
// request, applied to the response (see fingerprint.ts, layoutElements.ts).
|
|
615
647
|
return client
|
|
616
648
|
.post(endpoint, {
|
|
617
|
-
missingFiles,
|
|
649
|
+
missingFiles: layoutRequests.request,
|
|
618
650
|
tableOptions: (0, fingerprint_1.stripClientOnlyTableOptions)(tableOptions),
|
|
619
651
|
})
|
|
620
|
-
.then(function (resp) {
|
|
652
|
+
.then(async function (resp) {
|
|
621
653
|
if (resp && resp.data && resp.data.result) {
|
|
622
654
|
(0, fingerprint_1.applyFingerprints)(resp.data.result, tableOptions);
|
|
655
|
+
await (0, layoutElements_1.fillLayoutElementContent)(resp.data.result, layoutRequests.wanted, readTableRows);
|
|
623
656
|
}
|
|
624
657
|
return resp;
|
|
625
658
|
});
|
|
@@ -639,12 +672,22 @@ const snClient = (baseURL, username, password, apiKey) => {
|
|
|
639
672
|
withFiles,
|
|
640
673
|
getContents: withFiles, // ServiceNow expects getContents, not withFiles
|
|
641
674
|
})
|
|
642
|
-
.then(function (resp) {
|
|
675
|
+
.then(async function (resp) {
|
|
643
676
|
// Fingerprinted fields come back as `<field>.sha256` entries (and with
|
|
644
677
|
// hashed content when withFiles is set), so the manifest, the
|
|
645
678
|
// missing-file check and every writer agree on the on-disk name.
|
|
646
679
|
if (resp && resp.data && resp.data.result && resp.data.result.tables) {
|
|
647
|
-
|
|
680
|
+
const tables = resp.data.result.tables;
|
|
681
|
+
(0, fingerprint_1.applyFingerprints)(tables, tableOptions);
|
|
682
|
+
// Layout elements: list the file on every record of an enabled layout
|
|
683
|
+
// table, and read its content now when contents were asked for.
|
|
684
|
+
const layoutTables = (0, layoutElements_1.layoutElementTablesFor)(tableOptions, warnLayoutOption);
|
|
685
|
+
if (layoutTables.length > 0) {
|
|
686
|
+
(0, layoutElements_1.addLayoutElementFiles)(tables, layoutTables);
|
|
687
|
+
if (withFiles) {
|
|
688
|
+
await (0, layoutElements_1.fillLayoutElementContent)(tables, (0, layoutElements_1.recordIdsByTable)(tables, layoutTables), readTableRows);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
648
691
|
}
|
|
649
692
|
return resp;
|
|
650
693
|
});
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Layout elements (layoutElements.ts): the child rows of a list layout, a form
|
|
3
|
+
// section and a form are mirrored as one ordered, line-per-item text file in the
|
|
4
|
+
// parent layout's folder. Covers config validation, formatting and ordering, the
|
|
5
|
+
// manifest and bulkDownload rewrites, the Table API reads, and the path test
|
|
6
|
+
// push uses to refuse these files.
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
const layoutElements_1 = require("../layoutElements");
|
|
9
|
+
const LIST_A = "a".repeat(32);
|
|
10
|
+
const LIST_B = "b".repeat(32);
|
|
11
|
+
const SECTION = "c".repeat(32);
|
|
12
|
+
const FORM = "d".repeat(32);
|
|
13
|
+
const MAIN_SECTION = "e".repeat(32);
|
|
14
|
+
const DETAILS_SECTION = "f".repeat(32);
|
|
15
|
+
function id(n) {
|
|
16
|
+
const s = String(n);
|
|
17
|
+
return "0".repeat(32 - s.length) + s;
|
|
18
|
+
}
|
|
19
|
+
// A reader that answers from in-memory child rows, honoring the IN list, the
|
|
20
|
+
// page size and the offset, and records every call.
|
|
21
|
+
function fakeReader(rowsByTable, parentField) {
|
|
22
|
+
const calls = [];
|
|
23
|
+
const read = async function (table, query, fields, limit, offset) {
|
|
24
|
+
calls.push({ table: table, query: query, fields: fields, limit: limit, offset: offset });
|
|
25
|
+
const m = /^([a-z_]+)IN([0-9a-f,]+)\^ORDERBYsys_id$/.exec(query);
|
|
26
|
+
if (!m)
|
|
27
|
+
throw new Error("unexpected query " + query);
|
|
28
|
+
const ids = m[2].split(",");
|
|
29
|
+
const all = (rowsByTable[table] || [])
|
|
30
|
+
.filter(function (r) { return ids.indexOf(String(r[parentField[table]])) !== -1; })
|
|
31
|
+
.slice()
|
|
32
|
+
.sort(function (x, y) { return String(x.sys_id) < String(y.sys_id) ? -1 : 1; });
|
|
33
|
+
return all.slice(offset, offset + limit);
|
|
34
|
+
};
|
|
35
|
+
return { read: read, calls: calls };
|
|
36
|
+
}
|
|
37
|
+
const PARENT_FIELD = {
|
|
38
|
+
sys_ui_list_element: "list_id",
|
|
39
|
+
sys_ui_element: "sys_ui_section",
|
|
40
|
+
sys_ui_form_section: "sys_ui_form",
|
|
41
|
+
};
|
|
42
|
+
describe("layoutElementTablesFor", function () {
|
|
43
|
+
it("is off by default: no option, no tables", function () {
|
|
44
|
+
expect((0, layoutElements_1.layoutElementTablesFor)(undefined)).toEqual([]);
|
|
45
|
+
expect((0, layoutElements_1.layoutElementTablesFor)({})).toEqual([]);
|
|
46
|
+
expect((0, layoutElements_1.layoutElementTablesFor)({ sys_ui_list: { query: "sys_userISEMPTY" } })).toEqual([]);
|
|
47
|
+
});
|
|
48
|
+
it("returns the layout tables that set layoutElements: true", function () {
|
|
49
|
+
const opts = {
|
|
50
|
+
sys_ui_list: { layoutElements: true },
|
|
51
|
+
sys_ui_section: { layoutElements: true },
|
|
52
|
+
sys_ui_form: { layoutElements: true },
|
|
53
|
+
};
|
|
54
|
+
expect((0, layoutElements_1.layoutElementTablesFor)(opts).sort()).toEqual(["sys_ui_form", "sys_ui_list", "sys_ui_section"]);
|
|
55
|
+
});
|
|
56
|
+
it("ignores and reports a value that is not true, or a table that has no layout elements", function () {
|
|
57
|
+
const warnings = [];
|
|
58
|
+
const opts = {
|
|
59
|
+
sys_ui_list: { layoutElements: "yes" },
|
|
60
|
+
sys_ui_section: { layoutElements: false },
|
|
61
|
+
sys_script: { layoutElements: true },
|
|
62
|
+
};
|
|
63
|
+
expect((0, layoutElements_1.layoutElementTablesFor)(opts, function (m) { warnings.push(m); })).toEqual([]);
|
|
64
|
+
expect(warnings.length).toBe(2);
|
|
65
|
+
expect(warnings.join("\n")).toContain("sys_ui_list");
|
|
66
|
+
expect(warnings.join("\n")).toContain("sys_script");
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe("formatLayoutElements", function () {
|
|
70
|
+
it("writes a list's columns in position order, one per line, with aggregates", function () {
|
|
71
|
+
const rows = [
|
|
72
|
+
{ sys_id: id(3), list_id: LIST_A, element: "state", position: "2", sum: "false", average_value: "false", min_value: "false", max_value: "false" },
|
|
73
|
+
{ sys_id: id(1), list_id: LIST_A, element: "number", position: "0", sum: "false", average_value: "false", min_value: "false", max_value: "false" },
|
|
74
|
+
{ sys_id: id(2), list_id: LIST_A, element: "assigned_to.name", position: "1", sum: "false", average_value: "false", min_value: "false", max_value: "false" },
|
|
75
|
+
{ sys_id: id(4), list_id: LIST_A, element: "amount", position: "10", sum: "true", average_value: "true", min_value: "false", max_value: "true" },
|
|
76
|
+
];
|
|
77
|
+
expect((0, layoutElements_1.formatLayoutElements)("sys_ui_list", rows)).toBe("number\nassigned_to.name\nstate\namount [sum, average, max]\n");
|
|
78
|
+
});
|
|
79
|
+
it("writes a section's fields in position order with the element type when it adds something", function () {
|
|
80
|
+
const rows = [
|
|
81
|
+
{ sys_id: id(5), sys_ui_section: SECTION, element: ".end_split", type: ".end_split", position: "4" },
|
|
82
|
+
{ sys_id: id(1), sys_ui_section: SECTION, element: ".begin_split", type: ".begin_split", position: "0" },
|
|
83
|
+
{ sys_id: id(2), sys_ui_section: SECTION, element: "name", type: "", position: "1" },
|
|
84
|
+
{ sys_id: id(3), sys_ui_section: SECTION, element: ".split", type: ".split", position: "2" },
|
|
85
|
+
{ sys_id: id(4), sys_ui_section: SECTION, element: "activity.xml", type: "formatter", position: "3" },
|
|
86
|
+
{ sys_id: id(6), sys_ui_section: SECTION, element: "x_cadso_work_task.project", type: "list", position: "5" },
|
|
87
|
+
];
|
|
88
|
+
expect((0, layoutElements_1.formatLayoutElements)("sys_ui_section", rows)).toBe(".begin_split\nname\n.split\nactivity.xml [formatter]\n.end_split\nx_cadso_work_task.project [list]\n");
|
|
89
|
+
});
|
|
90
|
+
it("writes a form's sections in position order by caption", function () {
|
|
91
|
+
const rows = [
|
|
92
|
+
{ sys_id: id(2), sys_ui_form: FORM, position: "1", sys_ui_section: DETAILS_SECTION, "sys_ui_section.sys_id": DETAILS_SECTION, "sys_ui_section.caption": "Details" },
|
|
93
|
+
{ sys_id: id(1), sys_ui_form: FORM, position: "0", sys_ui_section: MAIN_SECTION, "sys_ui_section.sys_id": MAIN_SECTION, "sys_ui_section.caption": "" },
|
|
94
|
+
{ sys_id: id(3), sys_ui_form: FORM, position: "2", sys_ui_section: id(99), "sys_ui_section.sys_id": "", "sys_ui_section.caption": "" },
|
|
95
|
+
];
|
|
96
|
+
expect((0, layoutElements_1.formatLayoutElements)("sys_ui_form", rows)).toBe("(no caption)\nDetails\n(missing section " + id(99) + ")\n");
|
|
97
|
+
});
|
|
98
|
+
it("orders equal positions by the line, then by the row id, so the file is stable across pulls", function () {
|
|
99
|
+
const rows = [
|
|
100
|
+
{ sys_id: id(9), list_id: LIST_A, element: "b", position: "1" },
|
|
101
|
+
{ sys_id: id(8), list_id: LIST_A, element: "a", position: "1" },
|
|
102
|
+
{ sys_id: id(7), list_id: LIST_A, element: "a", position: "1" },
|
|
103
|
+
];
|
|
104
|
+
const once = (0, layoutElements_1.formatLayoutElements)("sys_ui_list", rows);
|
|
105
|
+
expect(once).toBe("a\na\nb\n");
|
|
106
|
+
expect((0, layoutElements_1.formatLayoutElements)("sys_ui_list", rows.slice().reverse())).toBe(once);
|
|
107
|
+
});
|
|
108
|
+
it("writes an empty list as an empty file", function () {
|
|
109
|
+
expect((0, layoutElements_1.formatLayoutElements)("sys_ui_list", [])).toBe("");
|
|
110
|
+
});
|
|
111
|
+
it("reads reference values whether or not the reference link is excluded", function () {
|
|
112
|
+
const rows = [
|
|
113
|
+
{ sys_id: id(1), sys_ui_form: { value: FORM, link: "x" }, position: "0", sys_ui_section: { value: MAIN_SECTION, link: "y" }, "sys_ui_section.sys_id": MAIN_SECTION, "sys_ui_section.caption": "Main" },
|
|
114
|
+
];
|
|
115
|
+
expect((0, layoutElements_1.formatLayoutElements)("sys_ui_form", rows)).toBe("Main\n");
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
describe("addLayoutElementFiles", function () {
|
|
119
|
+
function manifestTables() {
|
|
120
|
+
return {
|
|
121
|
+
sys_ui_list: {
|
|
122
|
+
records: {
|
|
123
|
+
"x_cadso_work_task.Default view": { name: "x_cadso_work_task.Default view", sys_id: LIST_A, files: [{ name: "name", type: "txt" }] },
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
sys_script: {
|
|
127
|
+
records: { "My rule": { name: "My rule", sys_id: id(1), files: [{ name: "script", type: "js" }] } },
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
it("adds the columns file to every record of an enabled table, and nothing else", function () {
|
|
132
|
+
const tables = manifestTables();
|
|
133
|
+
(0, layoutElements_1.addLayoutElementFiles)(tables, ["sys_ui_list"]);
|
|
134
|
+
expect(tables.sys_ui_list.records["x_cadso_work_task.Default view"].files).toEqual([
|
|
135
|
+
{ name: "name", type: "txt" },
|
|
136
|
+
{ name: "columns", type: "txt" },
|
|
137
|
+
]);
|
|
138
|
+
expect(tables.sys_script.records["My rule"].files).toEqual([{ name: "script", type: "js" }]);
|
|
139
|
+
});
|
|
140
|
+
it("is a no-op when the option is off, and idempotent when on", function () {
|
|
141
|
+
const off = manifestTables();
|
|
142
|
+
(0, layoutElements_1.addLayoutElementFiles)(off, []);
|
|
143
|
+
expect(off).toEqual(manifestTables());
|
|
144
|
+
const on = manifestTables();
|
|
145
|
+
(0, layoutElements_1.addLayoutElementFiles)(on, ["sys_ui_list"]);
|
|
146
|
+
(0, layoutElements_1.addLayoutElementFiles)(on, ["sys_ui_list"]);
|
|
147
|
+
expect(on.sys_ui_list.records["x_cadso_work_task.Default view"].files.length).toBe(2);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
describe("splitLayoutElementRequests", function () {
|
|
151
|
+
it("takes the derived files out of the request and remembers which records asked for them", function () {
|
|
152
|
+
const missing = {
|
|
153
|
+
sys_ui_list: {
|
|
154
|
+
[LIST_A]: [{ name: "name", type: "txt" }, { name: "columns", type: "txt" }],
|
|
155
|
+
[LIST_B]: [{ name: "columns", type: "txt" }],
|
|
156
|
+
},
|
|
157
|
+
sys_script: { [id(1)]: [{ name: "script", type: "js" }] },
|
|
158
|
+
};
|
|
159
|
+
const split = (0, layoutElements_1.splitLayoutElementRequests)(missing);
|
|
160
|
+
expect(split.request).toEqual({
|
|
161
|
+
sys_ui_list: { [LIST_A]: [{ name: "name", type: "txt" }], [LIST_B]: [] },
|
|
162
|
+
sys_script: { [id(1)]: [{ name: "script", type: "js" }] },
|
|
163
|
+
});
|
|
164
|
+
expect(split.wanted).toEqual({ sys_ui_list: [LIST_A, LIST_B] });
|
|
165
|
+
// The caller's map is not mutated.
|
|
166
|
+
expect(missing.sys_ui_list[LIST_A].length).toBe(2);
|
|
167
|
+
});
|
|
168
|
+
it("leaves a same-named field of another table alone", function () {
|
|
169
|
+
const missing = { x_custom: { [id(1)]: [{ name: "columns", type: "txt" }] } };
|
|
170
|
+
const split = (0, layoutElements_1.splitLayoutElementRequests)(missing);
|
|
171
|
+
expect(split.request).toEqual(missing);
|
|
172
|
+
expect(split.wanted).toEqual({});
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
describe("readLayoutElements", function () {
|
|
176
|
+
it("reads child rows for every parent, pages through them, and writes empty for a parent with none", async function () {
|
|
177
|
+
const rows = [];
|
|
178
|
+
for (let i = 0; i < 5; i++) {
|
|
179
|
+
rows.push({ sys_id: id(i + 1), list_id: LIST_A, element: "f" + i, position: String(4 - i) });
|
|
180
|
+
}
|
|
181
|
+
const fake = fakeReader({ sys_ui_list_element: rows }, PARENT_FIELD);
|
|
182
|
+
const out = await (0, layoutElements_1.readLayoutElements)(fake.read, "sys_ui_list", [LIST_A, LIST_B], { pageSize: 2, chunkSize: 100 });
|
|
183
|
+
expect(out[LIST_A]).toBe("f4\nf3\nf2\nf1\nf0\n");
|
|
184
|
+
expect(out[LIST_B]).toBe("");
|
|
185
|
+
expect(fake.calls.map(function (c) { return c.offset; })).toEqual([0, 2, 4]);
|
|
186
|
+
expect(fake.calls[0].table).toBe("sys_ui_list_element");
|
|
187
|
+
expect(fake.calls[0].query).toBe("list_idIN" + LIST_A + "," + LIST_B + "^ORDERBYsys_id");
|
|
188
|
+
});
|
|
189
|
+
it("splits a long parent list into several queries", async function () {
|
|
190
|
+
const parents = [];
|
|
191
|
+
for (let i = 0; i < 5; i++)
|
|
192
|
+
parents.push(id(100 + i));
|
|
193
|
+
const fake = fakeReader({ sys_ui_element: [] }, PARENT_FIELD);
|
|
194
|
+
await (0, layoutElements_1.readLayoutElements)(fake.read, "sys_ui_section", parents, { pageSize: 1000, chunkSize: 2 });
|
|
195
|
+
expect(fake.calls.length).toBe(3);
|
|
196
|
+
});
|
|
197
|
+
it("refuses a parent id that is not a record id, before any query runs", async function () {
|
|
198
|
+
const fake = fakeReader({}, PARENT_FIELD);
|
|
199
|
+
await expect((0, layoutElements_1.readLayoutElements)(fake.read, "sys_ui_list", [LIST_A, "x^NQsys_id!=1"], { pageSize: 1000, chunkSize: 100 })).rejects.toThrow(/record id/);
|
|
200
|
+
expect(fake.calls.length).toBe(0);
|
|
201
|
+
});
|
|
202
|
+
it("fails instead of writing an empty file when a read fails", async function () {
|
|
203
|
+
const read = async function () { throw new Error("HTTP 403"); };
|
|
204
|
+
await expect((0, layoutElements_1.readLayoutElements)(read, "sys_ui_list", [LIST_A], { pageSize: 1000, chunkSize: 100 })).rejects.toThrow(/403/);
|
|
205
|
+
});
|
|
206
|
+
it("ignores a returned row whose parent was not asked for", async function () {
|
|
207
|
+
const read = async function () {
|
|
208
|
+
return [{ sys_id: id(1), list_id: LIST_B, element: "stray", position: "0" }];
|
|
209
|
+
};
|
|
210
|
+
const out = await (0, layoutElements_1.readLayoutElements)(read, "sys_ui_list", [LIST_A], { pageSize: 1000, chunkSize: 100 });
|
|
211
|
+
expect(out).toEqual({ [LIST_A]: "" });
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
describe("fillLayoutElementContent", function () {
|
|
215
|
+
it("keys the content by record id, so two layouts with colliding names get their own columns", async function () {
|
|
216
|
+
const tables = {
|
|
217
|
+
sys_ui_list: {
|
|
218
|
+
records: {
|
|
219
|
+
"csm_consumer.Default view (aaaaaaaa)": { name: "csm_consumer.Default view (aaaaaaaa)", sys_id: LIST_A, files: [{ name: "name", type: "txt", content: "csm_consumer" }] },
|
|
220
|
+
"csm_consumer.Default view (bbbbbbbb)": { name: "csm_consumer.Default view (bbbbbbbb)", sys_id: LIST_B, files: [{ name: "name", type: "txt", content: "csm_consumer" }] },
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
const fake = fakeReader({
|
|
225
|
+
sys_ui_list_element: [
|
|
226
|
+
{ sys_id: id(1), list_id: LIST_A, element: "first_name", position: "0" },
|
|
227
|
+
{ sys_id: id(2), list_id: LIST_B, element: "email", position: "0" },
|
|
228
|
+
{ sys_id: id(3), list_id: LIST_B, element: "phone", position: "1" },
|
|
229
|
+
],
|
|
230
|
+
}, PARENT_FIELD);
|
|
231
|
+
await (0, layoutElements_1.fillLayoutElementContent)(tables, { sys_ui_list: [LIST_A, LIST_B] }, fake.read);
|
|
232
|
+
const a = tables.sys_ui_list.records["csm_consumer.Default view (aaaaaaaa)"].files;
|
|
233
|
+
const b = tables.sys_ui_list.records["csm_consumer.Default view (bbbbbbbb)"].files;
|
|
234
|
+
expect(a[a.length - 1]).toEqual({ name: "columns", type: "txt", content: "first_name\n" });
|
|
235
|
+
expect(b[b.length - 1]).toEqual({ name: "columns", type: "txt", content: "email\nphone\n" });
|
|
236
|
+
});
|
|
237
|
+
it("does nothing when no record asked for layout elements", async function () {
|
|
238
|
+
const fake = fakeReader({}, PARENT_FIELD);
|
|
239
|
+
const tables = { sys_ui_list: { records: {} } };
|
|
240
|
+
await (0, layoutElements_1.fillLayoutElementContent)(tables, {}, fake.read);
|
|
241
|
+
expect(fake.calls.length).toBe(0);
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
describe("isLayoutElementsFile / isLayoutElementsFilePath", function () {
|
|
245
|
+
it("recognizes the three derived files by table and name", function () {
|
|
246
|
+
expect((0, layoutElements_1.isLayoutElementsFile)("sys_ui_list", "columns", "txt")).toBe(true);
|
|
247
|
+
expect((0, layoutElements_1.isLayoutElementsFile)("sys_ui_section", "fields", "txt")).toBe(true);
|
|
248
|
+
expect((0, layoutElements_1.isLayoutElementsFile)("sys_ui_form", "sections", "txt")).toBe(true);
|
|
249
|
+
expect((0, layoutElements_1.isLayoutElementsFile)("sys_ui_list", "name", "txt")).toBe(false);
|
|
250
|
+
expect((0, layoutElements_1.isLayoutElementsFile)("x_custom", "columns", "txt")).toBe(false);
|
|
251
|
+
});
|
|
252
|
+
it("recognizes a derived file from its path on disk", function () {
|
|
253
|
+
expect((0, layoutElements_1.isLayoutElementsFilePath)("/repo/src/Work/sys_ui_list/x_cadso_work_task.Default view/columns.txt")).toBe(true);
|
|
254
|
+
expect((0, layoutElements_1.isLayoutElementsFilePath)("/repo/src/Work/sys_ui_section/x_cadso_work_task.Default view.Details/fields.txt")).toBe(true);
|
|
255
|
+
expect((0, layoutElements_1.isLayoutElementsFilePath)("/repo/src/Work/sys_ui_form/x_cadso_work_task.Default view/sections.txt")).toBe(true);
|
|
256
|
+
expect((0, layoutElements_1.isLayoutElementsFilePath)("/repo/src/Work/sys_ui_list/x_cadso_work_task.Default view/name.txt")).toBe(false);
|
|
257
|
+
expect((0, layoutElements_1.isLayoutElementsFilePath)("/repo/src/Work/x_custom/rec/columns.txt")).toBe(false);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// A layout elements file (columns.txt, fields.txt, sections.txt) is read from the
|
|
3
|
+
// child rows of a layout; it is not a field of the layout record. Push must
|
|
4
|
+
// refuse it even though the manifest lists it, and a reconcile create must not
|
|
5
|
+
// send it as a field.
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
jest.mock("../Logger", function () {
|
|
11
|
+
return {
|
|
12
|
+
logger: {
|
|
13
|
+
info: jest.fn(),
|
|
14
|
+
debug: jest.fn(),
|
|
15
|
+
warn: jest.fn(),
|
|
16
|
+
error: jest.fn(),
|
|
17
|
+
success: jest.fn(),
|
|
18
|
+
getLogLevel: function () { return "debug"; },
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
jest.mock("../FileLogger", function () {
|
|
23
|
+
return { fileLogger: { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn(), log: jest.fn() } };
|
|
24
|
+
});
|
|
25
|
+
var mockManifest = null;
|
|
26
|
+
var mockSourcePath = "";
|
|
27
|
+
jest.mock("../config", function () {
|
|
28
|
+
return {
|
|
29
|
+
getManifest: function () { return mockManifest; },
|
|
30
|
+
isMultiScopeManifest: function () { return false; },
|
|
31
|
+
resolveScopeFromPath: function () { return undefined; },
|
|
32
|
+
resolveManifestForScope: function () { return undefined; },
|
|
33
|
+
getSourcePathForScope: function () { return mockSourcePath; },
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
var mockPost = jest.fn();
|
|
37
|
+
jest.mock("../snClient", function () {
|
|
38
|
+
var actual = jest.requireActual("../snClient");
|
|
39
|
+
var client = actual.snClient("https://x.service-now.com/", "u", "p");
|
|
40
|
+
client.client.post = mockPost;
|
|
41
|
+
return Object.assign({}, actual, {
|
|
42
|
+
defaultClient: function () {
|
|
43
|
+
return client;
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
const fs_1 = __importDefault(require("fs"));
|
|
48
|
+
const os_1 = __importDefault(require("os"));
|
|
49
|
+
const path_1 = __importDefault(require("path"));
|
|
50
|
+
const FileUtils_1 = require("../FileUtils");
|
|
51
|
+
const reconcileCommand_1 = require("../reconcileCommand");
|
|
52
|
+
const LIST = "a".repeat(32);
|
|
53
|
+
describe("push refuses layout elements files", function () {
|
|
54
|
+
beforeEach(function () {
|
|
55
|
+
mockManifest = {
|
|
56
|
+
scope: "x_cadso_work",
|
|
57
|
+
tables: {
|
|
58
|
+
sys_ui_list: {
|
|
59
|
+
records: {
|
|
60
|
+
"x_cadso_work_task.Default view": {
|
|
61
|
+
name: "x_cadso_work_task.Default view",
|
|
62
|
+
sys_id: LIST,
|
|
63
|
+
files: [{ name: "name", type: "txt" }, { name: "columns", type: "txt" }],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
it("skips columns.txt with a named reason although the manifest lists it", function () {
|
|
71
|
+
const result = (0, FileUtils_1.getFileContextWithSkipReason)("/project/src/sys_ui_list/x_cadso_work_task.Default view/columns.txt");
|
|
72
|
+
expect(result.context).toBeUndefined();
|
|
73
|
+
expect(result.skipReason).toBe("layout elements, read-only");
|
|
74
|
+
});
|
|
75
|
+
it("still resolves the layout's own field file", function () {
|
|
76
|
+
const result = (0, FileUtils_1.getFileContextWithSkipReason)("/project/src/sys_ui_list/x_cadso_work_task.Default view/name.txt");
|
|
77
|
+
expect(result.skipReason).toBeUndefined();
|
|
78
|
+
expect(result.context && result.context.targetField).toBe("name");
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe("reconcile create leaves layout elements out of the record fields", function () {
|
|
82
|
+
let tmp = "";
|
|
83
|
+
beforeEach(function () {
|
|
84
|
+
mockPost.mockReset();
|
|
85
|
+
mockPost.mockResolvedValue({ status: 201, data: { result: { sys_id: LIST } } });
|
|
86
|
+
tmp = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "dove-layout-create-"));
|
|
87
|
+
mockSourcePath = tmp;
|
|
88
|
+
const recordDir = path_1.default.join(tmp, "sys_ui_list", "x_cadso_work_task.Default view");
|
|
89
|
+
fs_1.default.mkdirSync(recordDir, { recursive: true });
|
|
90
|
+
fs_1.default.writeFileSync(path_1.default.join(recordDir, "name.txt"), "x_cadso_work_task");
|
|
91
|
+
fs_1.default.writeFileSync(path_1.default.join(recordDir, "columns.txt"), "number\nstate\n");
|
|
92
|
+
fs_1.default.writeFileSync(path_1.default.join(recordDir, "metaData.json"), JSON.stringify({ name: { value: "x_cadso_work_task" } }));
|
|
93
|
+
});
|
|
94
|
+
afterEach(function () {
|
|
95
|
+
fs_1.default.rmSync(tmp, { recursive: true, force: true });
|
|
96
|
+
});
|
|
97
|
+
it("posts the record without a columns field", async function () {
|
|
98
|
+
const change = {
|
|
99
|
+
kind: "create",
|
|
100
|
+
table: "sys_ui_list",
|
|
101
|
+
scope: "x_cadso_work",
|
|
102
|
+
sys_id: LIST,
|
|
103
|
+
name: "x_cadso_work_task.Default view",
|
|
104
|
+
fieldDeltas: [],
|
|
105
|
+
};
|
|
106
|
+
await (0, reconcileCommand_1.applyCreates)("x_cadso_work", [change], "us1");
|
|
107
|
+
expect(mockPost).toHaveBeenCalled();
|
|
108
|
+
const body = JSON.stringify(mockPost.mock.calls[0][1]);
|
|
109
|
+
expect(body).toContain("x_cadso_work_task");
|
|
110
|
+
expect(body).not.toContain("columns");
|
|
111
|
+
expect(body).not.toContain("number\\nstate");
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// getManifest and getMissingFiles (bulkDownload) are the two reads every
|
|
3
|
+
// refresh/download/pull path uses, so layout elements are added there once.
|
|
4
|
+
// Checks that `layoutElements` never reaches the instance, that a filter such as
|
|
5
|
+
// `query: "sys_userISEMPTY"` still does, that the child rows are read through the
|
|
6
|
+
// Table API, and that nothing changes for a mirror that does not set the option.
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
jest.mock("../Logger", function () {
|
|
9
|
+
return {
|
|
10
|
+
logger: {
|
|
11
|
+
info: jest.fn(),
|
|
12
|
+
debug: jest.fn(),
|
|
13
|
+
warn: jest.fn(),
|
|
14
|
+
error: jest.fn(),
|
|
15
|
+
getLogLevel: function () { return "debug"; },
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
jest.mock("../FileLogger", function () {
|
|
20
|
+
return { fileLogger: { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn() } };
|
|
21
|
+
});
|
|
22
|
+
const snClient_1 = require("../snClient");
|
|
23
|
+
const SHARED = "1".repeat(32);
|
|
24
|
+
const PERSONAL = "2".repeat(32);
|
|
25
|
+
function okResponse(result) {
|
|
26
|
+
return { status: 200, data: { result: result }, headers: {}, statusText: "OK", config: {} };
|
|
27
|
+
}
|
|
28
|
+
function makeClient(post, get) {
|
|
29
|
+
const c = (0, snClient_1.snClient)("https://x.service-now.com/", "u", "p");
|
|
30
|
+
c.client.post = post;
|
|
31
|
+
c.client.get = get;
|
|
32
|
+
return c;
|
|
33
|
+
}
|
|
34
|
+
const LAYOUT_OPTIONS = {
|
|
35
|
+
sys_ui_list: { layoutElements: true, query: "sys_userISEMPTY", nameTemplate: "{name}.{view}" },
|
|
36
|
+
};
|
|
37
|
+
describe("snClient layout elements hook", function () {
|
|
38
|
+
it("getManifest strips layoutElements, forwards the personal-layout filter, and lists the columns file", async function () {
|
|
39
|
+
// The instance applies `query`, so only the shared layout comes back.
|
|
40
|
+
const post = jest.fn().mockResolvedValue(okResponse({
|
|
41
|
+
scope: "x_cadso_work",
|
|
42
|
+
tables: {
|
|
43
|
+
sys_ui_list: {
|
|
44
|
+
records: {
|
|
45
|
+
"x_cadso_work_task.Default view": {
|
|
46
|
+
name: "x_cadso_work_task.Default view",
|
|
47
|
+
sys_id: SHARED,
|
|
48
|
+
files: [{ name: "name", type: "txt" }],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
54
|
+
const get = jest.fn();
|
|
55
|
+
const c = makeClient(post, get);
|
|
56
|
+
const config = { includes: {}, excludes: {}, tableOptions: LAYOUT_OPTIONS };
|
|
57
|
+
const resp = await c.getManifest("x_cadso_work", config);
|
|
58
|
+
const body = post.mock.calls[0][1];
|
|
59
|
+
expect(body.tableOptions).toEqual({ sys_ui_list: { query: "sys_userISEMPTY", nameTemplate: "{name}.{view}" } });
|
|
60
|
+
expect(JSON.stringify(body)).not.toContain("layoutElements");
|
|
61
|
+
expect(resp.data.result.tables.sys_ui_list.records["x_cadso_work_task.Default view"].files).toEqual([
|
|
62
|
+
{ name: "name", type: "txt" },
|
|
63
|
+
{ name: "columns", type: "txt" },
|
|
64
|
+
]);
|
|
65
|
+
// Structure only: no child rows are read yet.
|
|
66
|
+
expect(get).not.toHaveBeenCalled();
|
|
67
|
+
// The caller's config is not mutated.
|
|
68
|
+
expect(LAYOUT_OPTIONS.sys_ui_list.layoutElements).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
it("getMissingFiles asks the instance for real fields only and fills the columns from the Table API", async function () {
|
|
71
|
+
const post = jest.fn().mockResolvedValue(okResponse({
|
|
72
|
+
sys_ui_list: {
|
|
73
|
+
records: {
|
|
74
|
+
"x_cadso_work_task.Default view": {
|
|
75
|
+
name: "x_cadso_work_task.Default view",
|
|
76
|
+
sys_id: SHARED,
|
|
77
|
+
files: [
|
|
78
|
+
{ name: "name", type: "txt", content: "x_cadso_work_task" },
|
|
79
|
+
{ name: "metaData", type: "json", content: "{}" },
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
}));
|
|
85
|
+
const get = jest.fn().mockResolvedValue(okResponse([
|
|
86
|
+
{ sys_id: "9".repeat(32), list_id: SHARED, element: "short_description", position: "1" },
|
|
87
|
+
{ sys_id: "8".repeat(32), list_id: SHARED, element: "number", position: "0" },
|
|
88
|
+
]));
|
|
89
|
+
const c = makeClient(post, get);
|
|
90
|
+
const resp = await c.getMissingFiles({ sys_ui_list: { [SHARED]: [{ name: "name", type: "txt" }, { name: "columns", type: "txt" }] } }, LAYOUT_OPTIONS);
|
|
91
|
+
const body = post.mock.calls[0][1];
|
|
92
|
+
expect(body.missingFiles).toEqual({ sys_ui_list: { [SHARED]: [{ name: "name", type: "txt" }] } });
|
|
93
|
+
expect(JSON.stringify(body.tableOptions)).not.toContain("layoutElements");
|
|
94
|
+
expect(get).toHaveBeenCalledTimes(1);
|
|
95
|
+
const url = get.mock.calls[0][0];
|
|
96
|
+
const params = get.mock.calls[0][1].params;
|
|
97
|
+
expect(url).toBe("api/now/table/sys_ui_list_element");
|
|
98
|
+
expect(params.sysparm_query).toBe("list_idIN" + SHARED + "^ORDERBYsys_id");
|
|
99
|
+
expect(params.sysparm_exclude_reference_link).toBe("true");
|
|
100
|
+
// A long IN list makes the instance refuse to build its pagination Link
|
|
101
|
+
// header ("Pagination not supported", HTTP 400); paging is done by offset here.
|
|
102
|
+
expect(params.sysparm_suppress_pagination_header).toBe("true");
|
|
103
|
+
expect(params.sysparm_limit).toBe("1000");
|
|
104
|
+
expect(params.sysparm_offset).toBe("0");
|
|
105
|
+
const files = resp.data.result.sys_ui_list.records["x_cadso_work_task.Default view"].files;
|
|
106
|
+
expect(files[files.length - 1]).toEqual({ name: "columns", type: "txt", content: "number\nshort_description\n" });
|
|
107
|
+
});
|
|
108
|
+
it("never reads or writes a personal layout the instance left out", async function () {
|
|
109
|
+
const post = jest.fn().mockResolvedValue(okResponse({ sys_ui_list: { records: {} } }));
|
|
110
|
+
const get = jest.fn().mockResolvedValue(okResponse([]));
|
|
111
|
+
const c = makeClient(post, get);
|
|
112
|
+
await c.getMissingFiles({ sys_ui_list: { [SHARED]: [{ name: "columns", type: "txt" }] } }, LAYOUT_OPTIONS);
|
|
113
|
+
const query = get.mock.calls[0][1].params.sysparm_query;
|
|
114
|
+
expect(query).not.toContain(PERSONAL);
|
|
115
|
+
});
|
|
116
|
+
it("changes nothing for a mirror that does not set layoutElements", async function () {
|
|
117
|
+
const result = {
|
|
118
|
+
scope: "x_cadso_work",
|
|
119
|
+
tables: {
|
|
120
|
+
sys_ui_list: {
|
|
121
|
+
records: { a: { name: "a", sys_id: SHARED, files: [{ name: "name", type: "txt" }] } },
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const post = jest.fn().mockResolvedValue(okResponse(JSON.parse(JSON.stringify(result))));
|
|
126
|
+
const get = jest.fn();
|
|
127
|
+
const c = makeClient(post, get);
|
|
128
|
+
const config = { includes: {}, excludes: {}, tableOptions: { sys_ui_list: { query: "sys_userISEMPTY" } } };
|
|
129
|
+
const resp = await c.getManifest("x_cadso_work", config);
|
|
130
|
+
expect(resp.data.result).toEqual(result);
|
|
131
|
+
expect(get).not.toHaveBeenCalled();
|
|
132
|
+
});
|
|
133
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenonhq/dovetail-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.134",
|
|
4
4
|
"description": "Next-gen file syncer",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">=22"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@tenonhq/dovetail-types": "~0.0.
|
|
25
|
+
"@tenonhq/dovetail-types": "~0.0.25",
|
|
26
26
|
"@types/dotenv": "^6.1.1",
|
|
27
27
|
"@types/inquirer": "^8.2.10",
|
|
28
28
|
"@types/jest": "^29.5.5",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@tenonhq/dovetail-clickup": "~0.0.15",
|
|
42
|
-
"@tenonhq/dovetail-schema": "~0.0.
|
|
42
|
+
"@tenonhq/dovetail-schema": "~0.0.18",
|
|
43
43
|
"axios": "^1.20.0",
|
|
44
44
|
"axios-cookiejar-support": "^4.0.7",
|
|
45
45
|
"axios-rate-limit": "^1.3.0",
|
package/release-manifest.json
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "dovetail-manifest/v1",
|
|
3
|
-
"generated_at": "2026-11-
|
|
3
|
+
"generated_at": "2026-11-27T14:58:30.686Z",
|
|
4
4
|
"events": [
|
|
5
|
+
{
|
|
6
|
+
"$schema": "dovetail-release-event/v1",
|
|
7
|
+
"event_id": "dovetail-core@0.0.133",
|
|
8
|
+
"package": "@tenonhq/dovetail-core",
|
|
9
|
+
"version": "0.0.133",
|
|
10
|
+
"prev_version": "0.0.132",
|
|
11
|
+
"published_at": "2026-11-27T14:58:30.679Z",
|
|
12
|
+
"git": {
|
|
13
|
+
"sha": "8c2034fbcae9d56a043e5120a05b606e6ea4b1b1",
|
|
14
|
+
"tag": "dovetail-core@0.0.133"
|
|
15
|
+
},
|
|
16
|
+
"semver_bump": "patch",
|
|
17
|
+
"commits": [
|
|
18
|
+
{
|
|
19
|
+
"sha": "8c2034fbc",
|
|
20
|
+
"subject": "fix(core): one folder per record when names collide (name twins, letter-case twins, ignored paths) (#388)",
|
|
21
|
+
"pr": 388
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"sha": "dcb136da0",
|
|
25
|
+
"subject": "chore(release): publish 3 packages [skip ci]"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"sha": "575518878",
|
|
29
|
+
"subject": "chore(release): publish 11 packages [skip ci]"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"exports_delta": null,
|
|
33
|
+
"narrative": null
|
|
34
|
+
},
|
|
5
35
|
{
|
|
6
36
|
"$schema": "dovetail-release-event/v1",
|
|
7
37
|
"event_id": "dovetail-servicenow@0.0.73",
|
|
@@ -1204,27 +1234,6 @@
|
|
|
1204
1234
|
],
|
|
1205
1235
|
"exports_delta": null,
|
|
1206
1236
|
"narrative": null
|
|
1207
|
-
},
|
|
1208
|
-
{
|
|
1209
|
-
"$schema": "dovetail-release-event/v1",
|
|
1210
|
-
"event_id": "dovetail-mcp@0.0.62",
|
|
1211
|
-
"package": "@tenonhq/dovetail-mcp",
|
|
1212
|
-
"version": "0.0.62",
|
|
1213
|
-
"prev_version": "0.0.61",
|
|
1214
|
-
"published_at": "2026-11-19T21:14:03.601Z",
|
|
1215
|
-
"git": {
|
|
1216
|
-
"sha": "de718f6370c29dc8ab803f3f61fc85a8a5527a6a",
|
|
1217
|
-
"tag": "dovetail-mcp@0.0.62"
|
|
1218
|
-
},
|
|
1219
|
-
"semver_bump": "patch",
|
|
1220
|
-
"commits": [
|
|
1221
|
-
{
|
|
1222
|
-
"sha": "3ec6ec235",
|
|
1223
|
-
"subject": "chore(release): publish 5 packages [skip ci]"
|
|
1224
|
-
}
|
|
1225
|
-
],
|
|
1226
|
-
"exports_delta": null,
|
|
1227
|
-
"narrative": null
|
|
1228
1237
|
}
|
|
1229
1238
|
]
|
|
1230
1239
|
}
|