@powerhousedao/powerhouse-vetra-packages 6.2.2-dev.70 → 6.2.2-dev.71
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/browser/assets/{entry-BBghrmE1.js → entry-D9kxNMhQ.js} +2 -2
- package/dist/browser/assets/{projection-entry-BtmaPdIp.js → projection-entry-CuhmOECW.js} +3 -3
- package/dist/browser/{connect-DmCpI0kg.js → connect-BQ3NfcJz.js} +4 -4
- package/dist/browser/{connect-DmCpI0kg.js.map → connect-BQ3NfcJz.js.map} +1 -1
- package/dist/browser/{dist-DfoAQf6g.js → dist-Ha_NNo7z.js} +253 -41
- package/dist/browser/dist-Ha_NNo7z.js.map +1 -0
- package/dist/browser/{document-drive-D6XhjHzr.js → document-drive-BgXuuZ9v.js} +2 -2
- package/dist/browser/{document-drive-D6XhjHzr.js.map → document-drive-BgXuuZ9v.js.map} +1 -1
- package/dist/browser/document-models/index.js +1 -1
- package/dist/browser/{editor-C069kNOj.js → editor-DHPXrcLc.js} +5 -5
- package/dist/browser/{editor-C069kNOj.js.map → editor-DHPXrcLc.js.map} +1 -1
- package/dist/browser/{editor-XlOiVjqp.js → editor-XuCmPGuB.js} +6 -6
- package/dist/browser/{editor-XlOiVjqp.js.map → editor-XuCmPGuB.js.map} +1 -1
- package/dist/browser/editors/document-model-editor/module.js +1 -1
- package/dist/browser/editors/generic-drive-explorer/index.js +4 -4
- package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
- package/dist/browser/{folder-view-B4b9Ik-G.js → folder-view-CuDz6ylG.js} +3 -3
- package/dist/browser/{folder-view-B4b9Ik-G.js.map → folder-view-CuDz6ylG.js.map} +1 -1
- package/dist/browser/{graphql-editor-BDze7_wI.js → graphql-editor-DSVq4B4o.js} +3 -3
- package/dist/browser/{graphql-editor-BDze7_wI.js.map → graphql-editor-DSVq4B4o.js.map} +1 -1
- package/dist/browser/index.js +2 -2
- package/dist/browser/{json-editor-nI61gbA-.js → json-editor-CKhR3Fvh.js} +3 -3
- package/dist/browser/{json-editor-nI61gbA-.js.map → json-editor-CKhR3Fvh.js.map} +1 -1
- package/dist/browser/{lib-CE5V8jW5.js → lib-DMgQj1v2.js} +2 -2
- package/dist/browser/lib-DMgQj1v2.js.map +1 -0
- package/dist/browser/{state-schemas-DvpLHgMU.js → state-schemas-D0_9u4nu.js} +3 -3
- package/dist/browser/{state-schemas-DvpLHgMU.js.map → state-schemas-D0_9u4nu.js.map} +1 -1
- package/dist/node/{connect-BOwTtHRq.mjs → connect-DOD5zQrl.mjs} +4 -4
- package/dist/node/{connect-BOwTtHRq.mjs.map → connect-DOD5zQrl.mjs.map} +1 -1
- package/dist/node/{dist-CRrgpr8A.mjs → dist-CNlIJlyu.mjs} +253 -41
- package/dist/node/dist-CNlIJlyu.mjs.map +1 -0
- package/dist/node/{document-drive-B65n0lIk.mjs → document-drive-BV8zVgUr.mjs} +2 -2
- package/dist/node/{document-drive-B65n0lIk.mjs.map → document-drive-BV8zVgUr.mjs.map} +1 -1
- package/dist/node/document-models/index.mjs +1 -1
- package/dist/node/{editor-DIiXhhl2.mjs → editor-BIIW42CR.mjs} +5 -5
- package/dist/node/{editor-DIiXhhl2.mjs.map → editor-BIIW42CR.mjs.map} +1 -1
- package/dist/node/{editor-BGcLm6LA.mjs → editor-BznTtugG.mjs} +6 -6
- package/dist/node/{editor-BGcLm6LA.mjs.map → editor-BznTtugG.mjs.map} +1 -1
- package/dist/node/editors/document-model-editor/module.mjs +1 -1
- package/dist/node/editors/generic-drive-explorer/index.mjs +4 -4
- package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
- package/dist/node/{folder-view-DyijTEeD.mjs → folder-view-WvkfzzHI.mjs} +3 -3
- package/dist/node/{folder-view-DyijTEeD.mjs.map → folder-view-WvkfzzHI.mjs.map} +1 -1
- package/dist/node/{graphql-editor-5YU1uHpd.mjs → graphql-editor-aDsDHPSg.mjs} +3 -3
- package/dist/node/{graphql-editor-5YU1uHpd.mjs.map → graphql-editor-aDsDHPSg.mjs.map} +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/node/{json-editor-iuJkZEgS.mjs → json-editor-hK4xilEL.mjs} +3 -3
- package/dist/node/{json-editor-iuJkZEgS.mjs.map → json-editor-hK4xilEL.mjs.map} +1 -1
- package/dist/node/{main-B5JSm6Hi.mjs → main-DutzjcaZ.mjs} +2 -2
- package/dist/node/main-DutzjcaZ.mjs.map +1 -0
- package/dist/node/{state-schemas-DHQAxfto.mjs → state-schemas-CQ4bprzx.mjs} +3 -3
- package/dist/node/{state-schemas-DHQAxfto.mjs.map → state-schemas-CQ4bprzx.mjs.map} +1 -1
- package/package.json +7 -7
- package/dist/browser/dist-DfoAQf6g.js.map +0 -1
- package/dist/browser/lib-CE5V8jW5.js.map +0 -1
- package/dist/node/dist-CRrgpr8A.mjs.map +0 -1
- package/dist/node/main-B5JSm6Hi.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { D as __commonJSMin, M as __toESM, t as capitalCase } from "./dist-DT7jI9ol.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { a as DriveCollectionId, i as SyncStatus, o as ModuleNotFoundError, t as require_main } from "./main-
|
|
2
|
+
import { C as baseLoadFromInputVersioned, O as createPresignedHeader, Q as setName, S as baseLoadFromInput, T as buildSignedAction, U as replayDocumentVersioned, a as handleTargetNameCollisions, ct as validateStateSchemaName, f as logger, h as UnsupportedDocumentModelVersionError, i as generateNodesCopy, j as createZip, l as moveNode, lt as generateId, n as copyNode, o as isFileNode, ot as validateInitialState, s as isFolderNode, st as validateModules, t as addFolder, u as updateNode, w as baseSaveToFileHandle, y as assertAuthPreservedOnDuplicate } from "./document-drive-BV8zVgUr.mjs";
|
|
3
|
+
import { a as DriveCollectionId, i as SyncStatus, o as ModuleNotFoundError, t as require_main } from "./main-DutzjcaZ.mjs";
|
|
4
4
|
import { t as require_graphql } from "./graphql-BfAoPeWM.mjs";
|
|
5
5
|
import { createContext, use, useCallback, useContext, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
6
6
|
import "react/jsx-runtime";
|
|
@@ -1801,7 +1801,16 @@ slug.setLocale = function(locale) {
|
|
|
1801
1801
|
defaultLocale = locales[locale] || {};
|
|
1802
1802
|
};
|
|
1803
1803
|
//#endregion
|
|
1804
|
-
//#region ../reactor-browser/dist/document-operations-
|
|
1804
|
+
//#region ../reactor-browser/dist/document-operations-B2lxu6qg.js
|
|
1805
|
+
var UnsupportedDocumentTypeError = class extends Error {
|
|
1806
|
+
constructor(documentType) {
|
|
1807
|
+
super(`Document type ${documentType} is not supported`);
|
|
1808
|
+
this.name = "UnsupportedDocumentTypeError";
|
|
1809
|
+
}
|
|
1810
|
+
static isError(error) {
|
|
1811
|
+
return Error.isError(error) && error.name === "UnsupportedDocumentTypeError";
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1805
1814
|
var DocumentModelNotFoundError = class extends Error {
|
|
1806
1815
|
documentType;
|
|
1807
1816
|
name = "DocumentModelNotFoundError";
|
|
@@ -1839,6 +1848,20 @@ function showDeleteNodeModal(nodeOrId) {
|
|
|
1839
1848
|
id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
|
|
1840
1849
|
});
|
|
1841
1850
|
}
|
|
1851
|
+
function isDocumentTypeSupported(documentType, supportedDocuments) {
|
|
1852
|
+
if (!supportedDocuments?.length) return true;
|
|
1853
|
+
return supportedDocuments.some((pattern) => {
|
|
1854
|
+
if (pattern.endsWith("/*")) {
|
|
1855
|
+
const prefix = pattern.slice(0, -2);
|
|
1856
|
+
return documentType.startsWith(prefix + "/");
|
|
1857
|
+
}
|
|
1858
|
+
if (pattern.endsWith("*") && !pattern.endsWith("/*")) {
|
|
1859
|
+
const prefix = pattern.slice(0, -1);
|
|
1860
|
+
return documentType.startsWith(prefix);
|
|
1861
|
+
}
|
|
1862
|
+
return pattern === documentType;
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1842
1865
|
function getUserPermissions() {
|
|
1843
1866
|
const user = window.ph?.renown?.user;
|
|
1844
1867
|
const allowList = window.ph?.allowList;
|
|
@@ -1852,6 +1875,40 @@ function getUserPermissions() {
|
|
|
1852
1875
|
};
|
|
1853
1876
|
}
|
|
1854
1877
|
const NON_DOMAIN_SCOPES = new Set(["auth", "document"]);
|
|
1878
|
+
/** An unreadable drive cannot be shown to hold no duplicate, so reads throw. */
|
|
1879
|
+
async function isDocumentInLocation(reactorClient, document, driveId, parentFolder) {
|
|
1880
|
+
const drive = await reactorClient.get(driveId);
|
|
1881
|
+
const nodeById = drive.state.global.nodes.find((node) => node.id === document.header.id);
|
|
1882
|
+
if (nodeById && nodeById.parentFolder === (parentFolder ?? null)) return {
|
|
1883
|
+
isDuplicate: true,
|
|
1884
|
+
duplicateType: "id",
|
|
1885
|
+
nodeId: nodeById.id
|
|
1886
|
+
};
|
|
1887
|
+
const nodeByNameAndType = drive.state.global.nodes.find((node) => isFileNode(node) && node.name === document.header.name && node.documentType === document.header.documentType && node.parentFolder === (parentFolder ?? null));
|
|
1888
|
+
if (nodeByNameAndType) return {
|
|
1889
|
+
isDuplicate: true,
|
|
1890
|
+
duplicateType: "name",
|
|
1891
|
+
nodeId: nodeByNameAndType.id
|
|
1892
|
+
};
|
|
1893
|
+
return { isDuplicate: false };
|
|
1894
|
+
}
|
|
1895
|
+
function getDocumentTypeIcon(document) {
|
|
1896
|
+
switch (document.header.documentType) {
|
|
1897
|
+
case "powerhouse/document-model": return "document-model";
|
|
1898
|
+
case "powerhouse/app": return "app";
|
|
1899
|
+
case "powerhouse/document-editor": return "editor";
|
|
1900
|
+
case "powerhouse/subgraph": return "subgraph";
|
|
1901
|
+
case "powerhouse/package": return "package";
|
|
1902
|
+
case "powerhouse/processor": {
|
|
1903
|
+
const processorType = document.state.global?.type;
|
|
1904
|
+
if (processorType === "analytics") return "analytics-processor";
|
|
1905
|
+
if (processorType === "relational") return "relational-processor";
|
|
1906
|
+
if (processorType === "codegen") return "codegen-processor";
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
default: return;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1855
1912
|
async function downloadFile(document, fileName) {
|
|
1856
1913
|
try {
|
|
1857
1914
|
const data = await createZip(document);
|
|
@@ -2056,37 +2113,201 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
|
|
|
2056
2113
|
kind: "file"
|
|
2057
2114
|
};
|
|
2058
2115
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2116
|
+
/**
|
|
2117
|
+
* How many ids an import will try before giving up. The check before the create
|
|
2118
|
+
* catches an id that is already taken; this bound covers the window between the
|
|
2119
|
+
* two, where a create can still lose to a claim made in the meantime.
|
|
2120
|
+
*/
|
|
2121
|
+
const IMPORT_ID_ATTEMPTS = 3;
|
|
2122
|
+
/** True when this error, or anything it wraps, is a taken document id. */
|
|
2123
|
+
function isDocumentAlreadyExists(error) {
|
|
2124
|
+
let current = error;
|
|
2125
|
+
while (current instanceof Error) {
|
|
2126
|
+
if (current.name === "DocumentAlreadyExistsError") return true;
|
|
2127
|
+
current = current.cause;
|
|
2128
|
+
}
|
|
2129
|
+
return false;
|
|
2130
|
+
}
|
|
2131
|
+
/**
|
|
2132
|
+
* Creates the imported document under an id that is free, retrying on a
|
|
2133
|
+
* collision.
|
|
2134
|
+
*
|
|
2135
|
+
* The check cannot stand on its own: it answers for the moment it ran, and the
|
|
2136
|
+
* create that follows can still land on an id claimed in between. The store
|
|
2137
|
+
* rejects that create as DocumentAlreadyExistsError, which is not retryable
|
|
2138
|
+
* under the same id and is resolved by minting another one. A create that
|
|
2139
|
+
* fails leaves the drive untouched, so a retry has nothing to clean up.
|
|
2140
|
+
*/
|
|
2141
|
+
async function createImportedDocument(reactor, document, driveId, name, parentFolder) {
|
|
2142
|
+
let documentId = await reactor.isDocumentIdTaken(document.header.id) ? generateId() : document.header.id;
|
|
2143
|
+
for (let attempt = 1;; attempt++) {
|
|
2144
|
+
const header = createPresignedHeader(documentId, document.header.documentType);
|
|
2145
|
+
header.lastModifiedAtUtcIso = document.header.createdAtUtcIso;
|
|
2146
|
+
header.meta = document.header.meta;
|
|
2147
|
+
header.name = name || document.header.name;
|
|
2148
|
+
const initialDocument = {
|
|
2149
|
+
...document,
|
|
2150
|
+
header,
|
|
2151
|
+
state: document.initialState,
|
|
2152
|
+
operations: Object.keys(document.operations).reduce((acc, key) => {
|
|
2153
|
+
acc[key] = [];
|
|
2154
|
+
return acc;
|
|
2155
|
+
}, {})
|
|
2156
|
+
};
|
|
2157
|
+
try {
|
|
2158
|
+
const fileNode = await addDocument(driveId, name || document.header.name, document.header.documentType, parentFolder, initialDocument, documentId, document.header.meta?.preferredEditor);
|
|
2159
|
+
if (!fileNode) throw new Error("There was an error adding file");
|
|
2160
|
+
return {
|
|
2161
|
+
documentId,
|
|
2162
|
+
fileNode
|
|
2163
|
+
};
|
|
2164
|
+
} catch (error) {
|
|
2165
|
+
if (!isDocumentAlreadyExists(error) || attempt === IMPORT_ID_ATTEMPTS) throw error;
|
|
2166
|
+
logger.warn(`Document id ${documentId} was taken between the check and the create; importing under a new id`);
|
|
2167
|
+
documentId = generateId();
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
async function addFileWithProgress(file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict) {
|
|
2172
|
+
logger.verbose(`addFileWithProgress(drive: ${driveId}, name: ${name}, folder: ${parentFolder})`);
|
|
2173
|
+
const reactor = window.ph?.reactorClientModule?.client;
|
|
2174
|
+
if (!reactor) {
|
|
2175
|
+
onProgress?.({
|
|
2176
|
+
stage: "failed",
|
|
2177
|
+
progress: 100,
|
|
2178
|
+
error: "ReactorClient not initialized"
|
|
2179
|
+
});
|
|
2180
|
+
throw new Error("ReactorClient not initialized");
|
|
2181
|
+
}
|
|
2061
2182
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2062
2183
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create files");
|
|
2063
|
-
const document = await loadFile(file);
|
|
2064
|
-
let duplicateId = false;
|
|
2065
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2066
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2067
2184
|
try {
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2185
|
+
onProgress?.({
|
|
2186
|
+
stage: "loading",
|
|
2187
|
+
progress: 0
|
|
2188
|
+
});
|
|
2189
|
+
let document;
|
|
2190
|
+
try {
|
|
2191
|
+
document = await loadFile(file);
|
|
2192
|
+
} catch (loadError) {
|
|
2193
|
+
if (UnsupportedDocumentModelVersionError.isError(loadError)) {
|
|
2194
|
+
showPHModal({
|
|
2195
|
+
type: "documentVersionUnsupported",
|
|
2196
|
+
documentType: loadError.documentType,
|
|
2197
|
+
requiredVersion: loadError.requiredVersion,
|
|
2198
|
+
availableVersions: loadError.availableVersions
|
|
2199
|
+
});
|
|
2200
|
+
onProgress?.({
|
|
2201
|
+
stage: "failed",
|
|
2202
|
+
progress: 100,
|
|
2203
|
+
error: loadError.message
|
|
2204
|
+
});
|
|
2205
|
+
return;
|
|
2206
|
+
}
|
|
2207
|
+
const discoveryService = window.ph?.packageDiscoveryService;
|
|
2208
|
+
if (discoveryService && DocumentModelNotFoundError.isError(loadError)) {
|
|
2209
|
+
retryAfterDiscovery(discoveryService, loadError.documentType, file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict).catch((retryError) => {
|
|
2210
|
+
logger.error("Import retry after discovery failed: @error", retryError);
|
|
2211
|
+
onProgress?.({
|
|
2212
|
+
stage: "failed",
|
|
2213
|
+
progress: 100,
|
|
2214
|
+
error: retryError instanceof Error ? retryError.message : String(retryError)
|
|
2215
|
+
});
|
|
2216
|
+
});
|
|
2217
|
+
return;
|
|
2218
|
+
}
|
|
2219
|
+
throw loadError;
|
|
2220
|
+
}
|
|
2221
|
+
const duplicateCheck = await isDocumentInLocation(reactor, document, driveId, parentFolder);
|
|
2222
|
+
if (duplicateCheck.isDuplicate && !resolveConflict) {
|
|
2223
|
+
onProgress?.({
|
|
2224
|
+
stage: "conflict",
|
|
2225
|
+
progress: 0,
|
|
2226
|
+
duplicateType: duplicateCheck.duplicateType
|
|
2227
|
+
});
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
const documentType = getDocumentTypeIcon(document);
|
|
2231
|
+
if (documentType) onProgress?.({
|
|
2232
|
+
stage: "loading",
|
|
2233
|
+
progress: 10,
|
|
2234
|
+
documentType
|
|
2235
|
+
});
|
|
2236
|
+
else onProgress?.({
|
|
2237
|
+
stage: "loading",
|
|
2238
|
+
progress: 10
|
|
2239
|
+
});
|
|
2240
|
+
if (!isDocumentTypeSupported(document.header.documentType, documentTypes)) {
|
|
2241
|
+
onProgress?.({
|
|
2242
|
+
stage: "unsupported-document-type",
|
|
2243
|
+
progress: 100,
|
|
2244
|
+
error: `Document type ${document.header.documentType} is not supported`
|
|
2245
|
+
});
|
|
2246
|
+
throw new UnsupportedDocumentTypeError(document.header.documentType);
|
|
2247
|
+
}
|
|
2248
|
+
await reactor.getDocumentModelModule(document.header.documentType);
|
|
2249
|
+
onProgress?.({
|
|
2250
|
+
stage: "initializing",
|
|
2251
|
+
progress: 10
|
|
2252
|
+
});
|
|
2253
|
+
const created = await createImportedDocument(reactor, document, driveId, name, parentFolder);
|
|
2254
|
+
const documentId = created.documentId;
|
|
2255
|
+
const fileNode = created.fileNode;
|
|
2256
|
+
onProgress?.({
|
|
2257
|
+
stage: "initializing",
|
|
2258
|
+
progress: 20
|
|
2259
|
+
});
|
|
2260
|
+
await reactor.get(documentId);
|
|
2261
|
+
console.log("Document created, starting upload of operations");
|
|
2262
|
+
const segments = splitAtUpgradeBoundaries(document.operations);
|
|
2263
|
+
const totalOperations = segments.reduce((total, segment) => total + countOperations(segment.operations), 0);
|
|
2264
|
+
let uploadedBefore = 0;
|
|
2265
|
+
for (const segment of segments) {
|
|
2266
|
+
await uploadOperations(documentId, segment.operations, queueOperations, { onProgress: (uploadProgress) => {
|
|
2267
|
+
if (uploadProgress.uploadedOperations === void 0) return;
|
|
2268
|
+
const uploaded = uploadedBefore + uploadProgress.uploadedOperations;
|
|
2269
|
+
const uploadPercent = totalOperations > 0 ? uploaded / totalOperations : 0;
|
|
2270
|
+
onProgress?.({
|
|
2271
|
+
stage: "uploading",
|
|
2272
|
+
progress: 20 + Math.round(uploadPercent * 80),
|
|
2273
|
+
totalOperations,
|
|
2274
|
+
uploadedOperations: uploaded
|
|
2275
|
+
});
|
|
2276
|
+
} });
|
|
2277
|
+
uploadedBefore += countOperations(segment.operations);
|
|
2278
|
+
if (segment.upgradeTo !== void 0) await reactor.upgradeDocument(documentId, segment.upgradeTo);
|
|
2279
|
+
}
|
|
2280
|
+
onProgress?.({
|
|
2281
|
+
stage: "complete",
|
|
2282
|
+
progress: 100,
|
|
2283
|
+
fileNode
|
|
2284
|
+
});
|
|
2285
|
+
return fileNode;
|
|
2286
|
+
} catch (error) {
|
|
2287
|
+
if (!UnsupportedDocumentTypeError.isError(error)) {
|
|
2288
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2289
|
+
onProgress?.({
|
|
2290
|
+
stage: "failed",
|
|
2291
|
+
progress: 100,
|
|
2292
|
+
error: errorMessage
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
throw error;
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
async function retryAfterDiscovery(discoveryService, documentType, file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict) {
|
|
2299
|
+
if (!discoveryService) return;
|
|
2300
|
+
try {
|
|
2301
|
+
await discoveryService.load(documentType);
|
|
2302
|
+
} catch {
|
|
2303
|
+
onProgress?.({
|
|
2304
|
+
stage: "unsupported-document-type",
|
|
2305
|
+
progress: 100,
|
|
2306
|
+
error: `Document type ${documentType} is not supported`
|
|
2307
|
+
});
|
|
2308
|
+
return;
|
|
2089
2309
|
}
|
|
2310
|
+
await addFileWithProgress(file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict);
|
|
2090
2311
|
}
|
|
2091
2312
|
async function addFolder$1(driveId, name, parentFolder) {
|
|
2092
2313
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
@@ -2216,15 +2437,6 @@ async function copyNode$1(driveId, src, target) {
|
|
|
2216
2437
|
return await queueActions(drive, copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput)));
|
|
2217
2438
|
}
|
|
2218
2439
|
/**
|
|
2219
|
-
* Upgrades a document to a newer document model version. Defaults to the
|
|
2220
|
-
* latest registered version for the document's type.
|
|
2221
|
-
*/
|
|
2222
|
-
async function upgradeDocument(documentId, toVersion) {
|
|
2223
|
-
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
2224
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2225
|
-
return reactorClient.upgradeDocument(documentId, toVersion);
|
|
2226
|
-
}
|
|
2227
|
-
/**
|
|
2228
2440
|
* The operation selection of `GetDocumentOperations`, lifted into a fragment so
|
|
2229
2441
|
* the write path can reuse `remoteOperationToLocal` on the items it selects.
|
|
2230
2442
|
*/
|
|
@@ -3837,7 +4049,7 @@ function useNodeActions() {
|
|
|
3837
4049
|
const drives = useDrives();
|
|
3838
4050
|
async function onAddFile(file, parent) {
|
|
3839
4051
|
if (!selectedDriveId) return;
|
|
3840
|
-
return
|
|
4052
|
+
return addFileWithProgress(file, selectedDriveId, file.name.replace(/\..+/gim, ""), resolveNode(selectedDriveId, parent)?.id, void 0, void 0, "duplicate");
|
|
3841
4053
|
}
|
|
3842
4054
|
async function onAddFolder(name, parent) {
|
|
3843
4055
|
if (!selectedDriveId) return;
|
|
@@ -4161,4 +4373,4 @@ createDebouncedRefreshReactorDataClient();
|
|
|
4161
4373
|
//#endregion
|
|
4162
4374
|
export { showRevisionHistory as A, t$2 as B, addFolder$1 as C, setSelectedNode as D, setSelectedDrive as E, useSelectedDriveId as F, useDocumentById as H, useSelectedDriveSafe as I, useStudioMode as L, useDragNode as M, useDropNode as N, showDeleteNodeModal as O, usePHToast as P, e$1 as R, addDocument as S, isFolderNodeKind as T, t$5 as V, useSelectedNodePath as _, useDownloadDocument as a, useTheme as b, useGetSwitchboardLink as c, useNodeParentFolderById as d, useNodesInSelectedDriveOrFolder as f, useSelectedFolder as g, useSelectedDocumentSafe as h, useDocumentVersionStatus as i, useDisabledEditors as j, showPHModal as k, useNodeActions as l, useSelectedDocumentOfType as m, preloadEditorModule as n, useEditorModules as o, useParentFolderForSelectedNode as p, useAllowedDocumentModelModules as r, useEditorModulesForDocumentType as s, getSyncStatusSync as t, useNodeById as u, useSetPHAppConfig as v, isFileNodeKind as w, useUserPermissions as x, useSetPHDocumentEditorConfig as y, e$4 as z };
|
|
4163
4375
|
|
|
4164
|
-
//# sourceMappingURL=dist-
|
|
4376
|
+
//# sourceMappingURL=dist-CNlIJlyu.mjs.map
|