@thatopen/services 0.21.0 → 0.22.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/dist/cli.js +43 -7
- package/dist/cli.js.map +1 -1
- package/dist/core/history.d.ts +7 -0
- package/dist/core/recipes.d.ts +39 -5
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +428 -396
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6837,10 +6837,21 @@ class ProjectHistory {
|
|
|
6837
6837
|
const name = String(folder.name ?? "");
|
|
6838
6838
|
const dash = name.indexOf("-");
|
|
6839
6839
|
if (dash <= 0) continue;
|
|
6840
|
+
const files = await this.client.listFiles({
|
|
6841
|
+
folderId: idOf(folder)
|
|
6842
|
+
});
|
|
6843
|
+
const names2 = files.map(
|
|
6844
|
+
(f) => String(f.name ?? "")
|
|
6845
|
+
);
|
|
6846
|
+
const model = names2.find((n) => n === LEGACY_MODEL_FILE) ?? names2.find(
|
|
6847
|
+
(n) => n.endsWith(".frag") && !n.startsWith(INTERNAL_PREFIX)
|
|
6848
|
+
);
|
|
6849
|
+
const hasAny = names2.includes(HISTORY_FILE) || names2.includes(OPS_FILE) || !!model;
|
|
6840
6850
|
docs.push({
|
|
6841
6851
|
source: name.slice(0, dash),
|
|
6842
6852
|
docId: name.slice(dash + 1),
|
|
6843
|
-
modelName:
|
|
6853
|
+
modelName: model,
|
|
6854
|
+
...hasAny ? {} : { empty: true }
|
|
6844
6855
|
});
|
|
6845
6856
|
}
|
|
6846
6857
|
return docs;
|
|
@@ -7260,14 +7271,39 @@ class Recipes {
|
|
|
7260
7271
|
return this.#registry.get(name);
|
|
7261
7272
|
}
|
|
7262
7273
|
/**
|
|
7263
|
-
* Runs a recipe WITHOUT queueing anything: the dry pass. Returns
|
|
7264
|
-
*
|
|
7265
|
-
*
|
|
7266
|
-
*
|
|
7274
|
+
* Runs a recipe WITHOUT queueing anything: the dry pass. Returns a
|
|
7275
|
+
* {@link RecipePlan} — the result to show (title, tallies, targets) plus
|
|
7276
|
+
* everything {@link queue} needs to queue EXACTLY this, payload and opId
|
|
7277
|
+
* included, with no second run. Discard it and the plan never happened.
|
|
7267
7278
|
*/
|
|
7268
7279
|
async plan(name, options) {
|
|
7269
|
-
const { result } = await this.#execute(name, options);
|
|
7270
|
-
return
|
|
7280
|
+
const { base, opId, result } = await this.#execute(name, options);
|
|
7281
|
+
return {
|
|
7282
|
+
opId,
|
|
7283
|
+
projectId: options.projectId,
|
|
7284
|
+
target: options.target,
|
|
7285
|
+
...base?.guid ? { baseCommitGuid: base.guid } : {},
|
|
7286
|
+
result
|
|
7287
|
+
};
|
|
7288
|
+
}
|
|
7289
|
+
/**
|
|
7290
|
+
* Queues exactly what {@link plan} planned: same opId, same payload, no
|
|
7291
|
+
* second execution. The pair plan → confirm → queue is the UI flow; `run`
|
|
7292
|
+
* is the one-shot shortcut.
|
|
7293
|
+
*/
|
|
7294
|
+
async queue(plan, options) {
|
|
7295
|
+
const targetDoc = this.client.history(plan.projectId).doc(plan.target.source, plan.target.docId);
|
|
7296
|
+
const suggestion = await targetDoc.suggest({
|
|
7297
|
+
opId: plan.opId,
|
|
7298
|
+
title: plan.result.title,
|
|
7299
|
+
verb: plan.result.verb,
|
|
7300
|
+
author: options.author,
|
|
7301
|
+
payload: plan.result.payload,
|
|
7302
|
+
targets: plan.result.targets,
|
|
7303
|
+
userId: options.userId,
|
|
7304
|
+
baseCommitGuid: plan.baseCommitGuid
|
|
7305
|
+
});
|
|
7306
|
+
return { suggestion, result: plan.result };
|
|
7271
7307
|
}
|
|
7272
7308
|
/**
|
|
7273
7309
|
* Runs a recipe and queues its suggestion on the target document. Safe to
|