@thatopen/services 0.32.0 → 0.34.2
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 +148 -37
- package/dist/cli.js.map +1 -1
- package/dist/core/builtin-recipes/shapes-to-families.d.ts +37 -1
- package/dist/core/client.d.ts +37 -0
- package/dist/core/client.export.test.d.ts +1 -0
- package/dist/core/documents.d.ts +9 -0
- package/dist/core/frag-items.d.ts +2 -0
- package/dist/core/history.d.ts +2 -0
- package/dist/core/platform-client.d.ts +70 -1
- package/dist/core/platform-client.members.test.d.ts +1 -0
- package/dist/core/platform-client.tokens.test.d.ts +1 -0
- package/dist/core/recipes.d.ts +2 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3148 -1964
- package/dist/index.es.js.map +1 -1
- package/dist/types/projects.d.ts +36 -1
- package/dist/types/tokens.d.ts +22 -0
- package/docs/revit-collab-quickstart.md +11 -5
- package/docs/sheet-sets-guide.md +69 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6810,6 +6810,7 @@ const HISTORY_FILE = "revitflow_history.json";
|
|
|
6810
6810
|
const LEGACY_MODEL_FILE = "revitflow_model.frag";
|
|
6811
6811
|
const INTERNAL_PREFIX = "revitflow_";
|
|
6812
6812
|
const LOCKS_ANCHOR = "bimterop-locks-anchor";
|
|
6813
|
+
const jsonReads = /* @__PURE__ */ new Map();
|
|
6813
6814
|
function childrenOf(folders, parentId) {
|
|
6814
6815
|
return folders.filter((f) => String(f.parentId ?? "") === parentId);
|
|
6815
6816
|
}
|
|
@@ -7200,7 +7201,7 @@ class FlowDoc {
|
|
|
7200
7201
|
...head ? { parents: [head.guid] } : {},
|
|
7201
7202
|
author: input.author,
|
|
7202
7203
|
source: input.source,
|
|
7203
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7204
|
+
timestamp: input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
7204
7205
|
...input.message ? { message: input.message } : {},
|
|
7205
7206
|
...input.userId ? { userId: input.userId } : {},
|
|
7206
7207
|
...input.kind ? { kind: input.kind } : {},
|
|
@@ -7215,16 +7216,13 @@ class FlowDoc {
|
|
|
7215
7216
|
version2.full = true;
|
|
7216
7217
|
}
|
|
7217
7218
|
if (input.delta) {
|
|
7218
|
-
const
|
|
7219
|
-
if (!
|
|
7219
|
+
const hangsFrom = (await this.#modelFile())?.id ?? input.file?.fileId ?? void 0;
|
|
7220
|
+
if (!hangsFrom) {
|
|
7220
7221
|
throw new Error(
|
|
7221
7222
|
"A delta needs the model file to hang from: sync a full model first."
|
|
7222
7223
|
);
|
|
7223
7224
|
}
|
|
7224
|
-
const hidden = await this.client.createHiddenFile(
|
|
7225
|
-
input.delta,
|
|
7226
|
-
modelFile.id
|
|
7227
|
-
);
|
|
7225
|
+
const hidden = await this.client.createHiddenFile(input.delta, hangsFrom);
|
|
7228
7226
|
version2.deltaId = hiddenIdOf(hidden);
|
|
7229
7227
|
}
|
|
7230
7228
|
const fresh = await this.#readHistory();
|
|
@@ -7291,7 +7289,8 @@ class FlowDoc {
|
|
|
7291
7289
|
});
|
|
7292
7290
|
return items2.map((item) => ({
|
|
7293
7291
|
id: idOf$2(item),
|
|
7294
|
-
name: String(item.name ?? "")
|
|
7292
|
+
name: String(item.name ?? ""),
|
|
7293
|
+
stamp: stampOf(item)
|
|
7295
7294
|
}));
|
|
7296
7295
|
})();
|
|
7297
7296
|
this.#filesListed.catch(() => {
|
|
@@ -7320,6 +7319,18 @@ class FlowDoc {
|
|
|
7320
7319
|
async #readJson(name) {
|
|
7321
7320
|
const file = await this.#file(name);
|
|
7322
7321
|
if (!file) return void 0;
|
|
7322
|
+
const kept = file.stamp ? jsonReads.get(file.id) : void 0;
|
|
7323
|
+
if (kept && kept.stamp === file.stamp) return structuredClone(await kept.value);
|
|
7324
|
+
const value2 = this.#downloadJson(file, name);
|
|
7325
|
+
if (file.stamp) {
|
|
7326
|
+
jsonReads.set(file.id, { stamp: file.stamp, value: value2 });
|
|
7327
|
+
value2.catch(() => {
|
|
7328
|
+
if (jsonReads.get(file.id)?.value === value2) jsonReads.delete(file.id);
|
|
7329
|
+
});
|
|
7330
|
+
}
|
|
7331
|
+
return structuredClone(await value2);
|
|
7332
|
+
}
|
|
7333
|
+
async #downloadJson(file, name) {
|
|
7323
7334
|
const response = await this.client.downloadFile(file.id);
|
|
7324
7335
|
if (!response.ok) throw new Error(`Reading ${name} answered ${response.status}`);
|
|
7325
7336
|
const text2 = await response.text();
|
|
@@ -7335,6 +7346,7 @@ class FlowDoc {
|
|
|
7335
7346
|
});
|
|
7336
7347
|
const existing = await this.#file(name);
|
|
7337
7348
|
if (existing) {
|
|
7349
|
+
jsonReads.delete(existing.id);
|
|
7338
7350
|
await this.client.updateFile(existing.id, {
|
|
7339
7351
|
file: blob,
|
|
7340
7352
|
versionTag: await this.client.nextVersionTag(existing.id)
|
|
@@ -7440,11 +7452,12 @@ function mintGuid() {
|
|
|
7440
7452
|
}
|
|
7441
7453
|
const DOCUMENT_TYPES = {
|
|
7442
7454
|
bim: { label: "BIM model", icon: "tabler:building" },
|
|
7443
|
-
|
|
7455
|
+
// «Drawing set» (Antonio 25-10; was «Drawings», and «plan set» in the Planner). The key stays 'drawings'.
|
|
7456
|
+
drawings: { label: "Drawing set", icon: "tabler:layout-board" },
|
|
7444
7457
|
reality: { label: "Reality capture", icon: "tabler:3d-cube-sphere" },
|
|
7445
7458
|
// 🔴 The project's coordination record (Antonio, 22-10: «los topics sean su propio documento… no pertenecen a
|
|
7446
7459
|
// ningún modelo, pueden hablar de varios a la vez»): its topics, as a BCF, with a history of their own. Named as a thing,
|
|
7447
|
-
// as a
|
|
7460
|
+
// as a drawing set is («Coordination set», Antonio 22-10).
|
|
7448
7461
|
coordination: { label: "Coordination set", icon: "tabler:messages" },
|
|
7449
7462
|
generic: { label: "Generic", icon: "tabler:file" }
|
|
7450
7463
|
};
|
|
@@ -7499,6 +7512,7 @@ function idOf$1(item) {
|
|
|
7499
7512
|
return String(item._id ?? item.id ?? "");
|
|
7500
7513
|
}
|
|
7501
7514
|
const descriptorReads = /* @__PURE__ */ new Map();
|
|
7515
|
+
let descriptorsRouteMissing = false;
|
|
7502
7516
|
const stampOf = (item) => {
|
|
7503
7517
|
const it = item;
|
|
7504
7518
|
const newest = [...it.versions ?? []].sort((a, b) => String(b.createdAt ?? "").localeCompare(String(a.createdAt ?? "")))[0];
|
|
@@ -7525,6 +7539,8 @@ class ProjectDocuments {
|
|
|
7525
7539
|
return all.filter((d) => types2.includes(documentTypeOf(d.descriptor)));
|
|
7526
7540
|
}
|
|
7527
7541
|
async #listAll() {
|
|
7542
|
+
const all = await this.#listAllAtOnce();
|
|
7543
|
+
if (all) return all;
|
|
7528
7544
|
const files = await this.client.listFiles({ projectId: this.projectId });
|
|
7529
7545
|
const descriptors = files.filter(
|
|
7530
7546
|
(item) => String(item.name ?? "") === DOCUMENT_FILE
|
|
@@ -7556,13 +7572,20 @@ class ProjectDocuments {
|
|
|
7556
7572
|
const item = await this.client.getFile(fileId);
|
|
7557
7573
|
const fileName2 = String(item.name ?? "");
|
|
7558
7574
|
const format2 = formatOf(fileName2, item.fileExtension);
|
|
7559
|
-
const
|
|
7560
|
-
const
|
|
7561
|
-
name
|
|
7562
|
-
item.folderId ? String(item.folderId) : void 0,
|
|
7563
|
-
this.projectId
|
|
7575
|
+
const wanted = options?.name ?? fileName2.replace(/\.[^.]+$/, "") ?? fileName2;
|
|
7576
|
+
const taken = new Set(
|
|
7577
|
+
(await this.list().catch(() => [])).map((d) => String(d.descriptor.name ?? "").toLowerCase())
|
|
7564
7578
|
);
|
|
7565
|
-
const
|
|
7579
|
+
const parentId = item.folderId ? String(item.folderId) : void 0;
|
|
7580
|
+
let name = wanted;
|
|
7581
|
+
let folderId = "";
|
|
7582
|
+
for (let n = 1; n < 100; n++) {
|
|
7583
|
+
name = n === 1 ? wanted : `${wanted} (${n})`;
|
|
7584
|
+
if (taken.has(name.toLowerCase())) continue;
|
|
7585
|
+
const folder = await this.client.createFolder(name, parentId, this.projectId);
|
|
7586
|
+
folderId = idOf$1(folder);
|
|
7587
|
+
if (!await this.#descriptorFile(folderId)) break;
|
|
7588
|
+
}
|
|
7566
7589
|
await this.client.updateFile(fileId, { parentFolderId: folderId });
|
|
7567
7590
|
const views = [];
|
|
7568
7591
|
const derivedId = await this.#derivedFileId(item);
|
|
@@ -7616,6 +7639,37 @@ class ProjectDocuments {
|
|
|
7616
7639
|
if (!file) return null;
|
|
7617
7640
|
return this.#readDescriptor(file.id, file.stamp);
|
|
7618
7641
|
}
|
|
7642
|
+
/**
|
|
7643
|
+
* Every descriptor from the platform in one request, or null when the
|
|
7644
|
+
* platform has no such route (one from before it: 404, or 400 taking
|
|
7645
|
+
* `documents` for an item id) and they are read one by one. Asked once per
|
|
7646
|
+
* page: a platform without it is not asked again. A 429 or a 5xx is an
|
|
7647
|
+
* error, never "no documents" (23-10).
|
|
7648
|
+
*/
|
|
7649
|
+
async #listAllAtOnce() {
|
|
7650
|
+
if (descriptorsRouteMissing) return null;
|
|
7651
|
+
let answer;
|
|
7652
|
+
try {
|
|
7653
|
+
answer = await this.client.listDocumentDescriptors(this.projectId);
|
|
7654
|
+
} catch (error2) {
|
|
7655
|
+
const status = error2.status;
|
|
7656
|
+
if (status === 404 || status === 400 || status === 405) {
|
|
7657
|
+
descriptorsRouteMissing = true;
|
|
7658
|
+
return null;
|
|
7659
|
+
}
|
|
7660
|
+
throw error2;
|
|
7661
|
+
}
|
|
7662
|
+
const found = [];
|
|
7663
|
+
for (const one of answer?.documents ?? []) {
|
|
7664
|
+
const descriptor = normalize$1(one.descriptor);
|
|
7665
|
+
if (!descriptor || !one.folderId) continue;
|
|
7666
|
+
if (one.fileId && one.versionTag) {
|
|
7667
|
+
descriptorReads.set(one.fileId, { stamp: one.versionTag, value: Promise.resolve(descriptor) });
|
|
7668
|
+
}
|
|
7669
|
+
found.push({ folderId: String(one.folderId), descriptor });
|
|
7670
|
+
}
|
|
7671
|
+
return found;
|
|
7672
|
+
}
|
|
7619
7673
|
/**
|
|
7620
7674
|
* 🔴 EACH DESCRIPTOR READ ONCE A VERSION (Antonio 23-10: the calls «siempre lo mínimo posible»): kept by its file and
|
|
7621
7675
|
* the moment its listing says it last changed, for every list and panel of the page (the Coordinator's start read
|
|
@@ -7744,11 +7798,33 @@ class ProjectDocuments {
|
|
|
7744
7798
|
const base = String(item.name ?? "").replace(/\.[^.]+$/, "").toLowerCase();
|
|
7745
7799
|
if (!base) return void 0;
|
|
7746
7800
|
listed ??= await this.client.listFiles({ projectId: this.projectId }).catch(() => []);
|
|
7747
|
-
const
|
|
7801
|
+
const folderOf = (one) => String(one.folderId ?? one.parentFolderId ?? "");
|
|
7802
|
+
const inDocuments = new Set(
|
|
7803
|
+
listed.filter((one) => String(one.name ?? "") === DOCUMENT_FILE).map(folderOf)
|
|
7804
|
+
);
|
|
7805
|
+
const twins = listed.filter((one) => {
|
|
7748
7806
|
const name = String(one.name ?? "").toLowerCase();
|
|
7749
|
-
return name === `${base}.frag` && !one.archived && idOf$1(one) !== idOf$1(item);
|
|
7807
|
+
return name === `${base}.frag` && !one.archived && idOf$1(one) !== idOf$1(item) && !inDocuments.has(folderOf(one));
|
|
7750
7808
|
});
|
|
7751
|
-
|
|
7809
|
+
for (const twin of twins) {
|
|
7810
|
+
const source = await this.#sourceIfcOf(twin);
|
|
7811
|
+
if (source === void 0 || source === idOf$1(item)) return idOf$1(twin);
|
|
7812
|
+
}
|
|
7813
|
+
return void 0;
|
|
7814
|
+
}
|
|
7815
|
+
/** The IFC a processed frag says it was made from (`sourceIfcId` in its latest version's metadata), if it says. */
|
|
7816
|
+
async #sourceIfcOf(file) {
|
|
7817
|
+
const versions = file.versions ?? [];
|
|
7818
|
+
const latest = [...versions].sort(
|
|
7819
|
+
(a, b) => String(b.createdAt ?? "").localeCompare(String(a.createdAt ?? ""))
|
|
7820
|
+
)[0];
|
|
7821
|
+
if (!latest) return void 0;
|
|
7822
|
+
try {
|
|
7823
|
+
const metadata2 = await this.client.getFileVersionMetadata(idOf$1(file), latest.tag);
|
|
7824
|
+
return typeof metadata2?.sourceIfcId === "string" && metadata2.sourceIfcId ? metadata2.sourceIfcId : void 0;
|
|
7825
|
+
} catch {
|
|
7826
|
+
return void 0;
|
|
7827
|
+
}
|
|
7752
7828
|
}
|
|
7753
7829
|
async #derivedFromVersions(item, known) {
|
|
7754
7830
|
const versions = [...known].sort(
|
|
@@ -7909,7 +7985,11 @@ function normalize$1(parsed) {
|
|
|
7909
7985
|
const native = raw.native;
|
|
7910
7986
|
const hasNative = !!native && typeof native === "object" && typeof native.fileId === "string" && typeof native.format === "string";
|
|
7911
7987
|
const type2 = typeof raw.type === "string" && raw.type in DOCUMENT_TYPES ? raw.type : void 0;
|
|
7988
|
+
const rest = { ...raw };
|
|
7989
|
+
delete rest.type;
|
|
7990
|
+
delete rest.native;
|
|
7912
7991
|
return {
|
|
7992
|
+
...rest,
|
|
7913
7993
|
schema: DOCUMENT_SCHEMA,
|
|
7914
7994
|
name: raw.name,
|
|
7915
7995
|
...type2 ? { type: type2 } : {},
|
|
@@ -7921,6 +8001,7 @@ const RESERVED = "flow:";
|
|
|
7921
8001
|
const OP_KEY = "flow:op";
|
|
7922
8002
|
const SOURCE_KEY = "flow:source";
|
|
7923
8003
|
const HOST_KEY = "flow:host";
|
|
8004
|
+
const PRINT_KEY = "flow:print";
|
|
7924
8005
|
const OP_SCHEMA = "revitflow/op@2";
|
|
7925
8006
|
const CATEGORY_CHANGE = "REVITFLOWCHANGE";
|
|
7926
8007
|
const CATEGORY_OPERATION = "REVITFLOWOPERATION";
|
|
@@ -8021,7 +8102,7 @@ class OperationBuilder {
|
|
|
8021
8102
|
pack(attrs, placement) {
|
|
8022
8103
|
const out = {};
|
|
8023
8104
|
for (const [k, v] of Object.entries(attrs ?? {})) {
|
|
8024
|
-
if (k.startsWith(RESERVED)) continue;
|
|
8105
|
+
if (k.startsWith(RESERVED) && k !== PRINT_KEY) continue;
|
|
8025
8106
|
out[k] = String(v);
|
|
8026
8107
|
}
|
|
8027
8108
|
if (placement.position) out.Position = placement.position.map(num).join(",");
|
|
@@ -8781,6 +8862,9 @@ const ITEM_TYPE_APP = "APP";
|
|
|
8781
8862
|
const RETRY_BASE_DELAY_MS = 500;
|
|
8782
8863
|
const RETRY_MAX_DELAY_MS = 3e4;
|
|
8783
8864
|
const READ_SHARED_MS = 2e3;
|
|
8865
|
+
const LISTING_SHARED_MS = 15e3;
|
|
8866
|
+
const isAsking = (path2) => /^\/?project\/permissions\/check/.test(path2);
|
|
8867
|
+
const isListing = (path2) => /^\/?(item\/folder\/?$|item\/?$|item\/folder\/[^/]+\/items\/?$|project\/[^/]+\/data\/?$)/.test(path2);
|
|
8784
8868
|
const sharedReads = /* @__PURE__ */ new Map();
|
|
8785
8869
|
const RETRY_JITTER_RATIO = 0.25;
|
|
8786
8870
|
const sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
@@ -8951,7 +9035,7 @@ class EngineServicesClient {
|
|
|
8951
9035
|
const key = `${this.#buildUrl(path2)}?${new URLSearchParams(this.#cleanData(requestData?.query)).toString()}`;
|
|
8952
9036
|
const now = Date.now();
|
|
8953
9037
|
const kept = sharedReads.get(key);
|
|
8954
|
-
if (kept && (kept.pending || now - kept.at < READ_SHARED_MS)) {
|
|
9038
|
+
if (kept && (kept.pending || now - kept.at < (isListing(path2) ? LISTING_SHARED_MS : READ_SHARED_MS))) {
|
|
8955
9039
|
return kept.answer.then((data) => data === void 0 ? data : structuredClone(data));
|
|
8956
9040
|
}
|
|
8957
9041
|
const entry = { at: now, pending: true, answer: this.#requestApiOnce(method, path2, requestData) };
|
|
@@ -8967,7 +9051,7 @@ class EngineServicesClient {
|
|
|
8967
9051
|
);
|
|
8968
9052
|
return entry.answer.then((data) => data === void 0 ? data : structuredClone(data));
|
|
8969
9053
|
}
|
|
8970
|
-
if (method !== "GET") sharedReads.clear();
|
|
9054
|
+
if (method !== "GET" && !isAsking(path2)) sharedReads.clear();
|
|
8971
9055
|
return this.#requestApiOnce(method, path2, requestData);
|
|
8972
9056
|
}
|
|
8973
9057
|
async #requestApiOnce(method, path2, requestData) {
|
|
@@ -9070,6 +9154,26 @@ class EngineServicesClient {
|
|
|
9070
9154
|
}
|
|
9071
9155
|
});
|
|
9072
9156
|
}
|
|
9157
|
+
/**
|
|
9158
|
+
* Every document descriptor of a project in one request, read by the
|
|
9159
|
+
* platform (`GET /item/documents`). Throws a {@link RequestError} like any
|
|
9160
|
+
* request; a platform from before the route answers 404 (or 400, taking
|
|
9161
|
+
* `documents` for an item id), which `documents.list()` reads as "ask one
|
|
9162
|
+
* by one".
|
|
9163
|
+
*/
|
|
9164
|
+
async listDocumentDescriptors(projectId) {
|
|
9165
|
+
return await this.#requestApi("GET", `${ITEM_PATH}/documents`, { query: { projectId } });
|
|
9166
|
+
}
|
|
9167
|
+
async exportProjectDocuments(projectId, options) {
|
|
9168
|
+
if (options?.format === "csv") {
|
|
9169
|
+
const blob = await this.#requestApi("GET", `${ITEM_PATH}/export`, {
|
|
9170
|
+
query: { projectId, format: "csv" },
|
|
9171
|
+
responseType: "blob"
|
|
9172
|
+
});
|
|
9173
|
+
return (await blob.text()).replace(/^/, "");
|
|
9174
|
+
}
|
|
9175
|
+
return await this.#requestApi("GET", `${ITEM_PATH}/export`, { query: { projectId } });
|
|
9176
|
+
}
|
|
9073
9177
|
/**
|
|
9074
9178
|
* Gets a single file by ID, optionally including version history.
|
|
9075
9179
|
* @param fileId - The file's unique identifier.
|
|
@@ -10008,12 +10112,13 @@ return main;`);
|
|
|
10008
10112
|
formData.append("file", file);
|
|
10009
10113
|
formData.append("versionTag", versionTag);
|
|
10010
10114
|
extraProps && formData.append("extraProps", JSON.stringify(extraProps));
|
|
10011
|
-
|
|
10012
|
-
return await this.#requestApi(
|
|
10115
|
+
const version2 = await this.#requestApi(
|
|
10013
10116
|
"POST",
|
|
10014
10117
|
`${ITEM_PATH}/${itemId}/version`,
|
|
10015
10118
|
{ body: formData }
|
|
10016
10119
|
);
|
|
10120
|
+
if (metadata2) await this.updateFileVersionMetadata(itemId, version2?.tag ?? versionTag, metadata2);
|
|
10121
|
+
return version2;
|
|
10017
10122
|
}
|
|
10018
10123
|
/**
|
|
10019
10124
|
* Lists versions of an item. Pass `archived: true` to fetch only archived
|
|
@@ -10185,7 +10290,6 @@ return main;`);
|
|
|
10185
10290
|
formData.append("file", file);
|
|
10186
10291
|
versionTag && formData.append("versionTag", versionTag);
|
|
10187
10292
|
extraProps && formData.append("extraProps", JSON.stringify(extraProps));
|
|
10188
|
-
metadata2 && formData.append("metadata", JSON.stringify(metadata2));
|
|
10189
10293
|
version2 = await this.#requestApi(
|
|
10190
10294
|
"POST",
|
|
10191
10295
|
`${ITEM_PATH}/${itemId}/version`,
|
|
@@ -10193,6 +10297,8 @@ return main;`);
|
|
|
10193
10297
|
body: formData
|
|
10194
10298
|
}
|
|
10195
10299
|
);
|
|
10300
|
+
const tag = version2?.tag ?? versionTag;
|
|
10301
|
+
if (metadata2 && tag) await this.updateFileVersionMetadata(itemId, tag, metadata2);
|
|
10196
10302
|
}
|
|
10197
10303
|
if (name || parentFolderId) {
|
|
10198
10304
|
const body = {
|
|
@@ -14117,7 +14223,7 @@ function discoverAddin() {
|
|
|
14117
14223
|
if (!require$$3$1.existsSync(file)) {
|
|
14118
14224
|
console.error("");
|
|
14119
14225
|
console.error(" The That Open Revit add-in is not running.");
|
|
14120
|
-
console.error(" Open Revit
|
|
14226
|
+
console.error(" Open Revit (2024-2027, with the add-in installed) and try again.");
|
|
14121
14227
|
console.error(" If it is not installed yet, install it and restart Revit.");
|
|
14122
14228
|
console.error("");
|
|
14123
14229
|
process.exit(1);
|
|
@@ -14177,18 +14283,23 @@ function isRevitRunning() {
|
|
|
14177
14283
|
}
|
|
14178
14284
|
}
|
|
14179
14285
|
function startRevit() {
|
|
14180
|
-
const
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14286
|
+
const root = "C:\\Program Files\\Autodesk";
|
|
14287
|
+
if (!require$$3$1.existsSync(root)) {
|
|
14288
|
+
console.log(" Could not find Revit.exe. Start Revit yourself and this will pick it up.");
|
|
14289
|
+
return;
|
|
14290
|
+
}
|
|
14291
|
+
const years = require$$3$1.readdirSync(root).map((dir) => /^Revit (\d{4})$/.exec(dir)?.[1]).filter((year2) => !!year2 && require$$3$1.existsSync(require$$2.join(root, `Revit ${year2}`, "Revit.exe"))).sort().reverse();
|
|
14292
|
+
const appData = process.env.APPDATA ?? "";
|
|
14293
|
+
const withAddin = years.find(
|
|
14294
|
+
(year2) => require$$3$1.existsSync(require$$2.join(appData, "Autodesk", "Revit", "Addins", year2, "revitflow.addin"))
|
|
14295
|
+
);
|
|
14296
|
+
const year = withAddin ?? years[0];
|
|
14297
|
+
if (!year) {
|
|
14298
|
+
console.log(" Could not find Revit.exe. Start Revit yourself and this will pick it up.");
|
|
14299
|
+
return;
|
|
14190
14300
|
}
|
|
14191
|
-
|
|
14301
|
+
require$$1.spawn(require$$2.join(root, `Revit ${year}`, "Revit.exe"), [], { detached: true, stdio: "ignore" }).unref();
|
|
14302
|
+
console.log(` Started Revit ${year}.`);
|
|
14192
14303
|
}
|
|
14193
14304
|
const REVIT_ADDIN_PACKAGE = "@thatopen-platform/flow-revit";
|
|
14194
14305
|
const revitCommand = new Command2("revit").description(
|