@powerhousedao/powerhouse-vetra-packages 6.2.2-dev.70 → 6.2.2-dev.72
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 { A as __toESM, D as __commonJSMin, t as capitalCase } from "./dist-B4FWbuEM.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as SyncStatus, o as DriveCollectionId, s as ModuleNotFoundError, t as gql } from "./lib-
|
|
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-BgXuuZ9v.js";
|
|
3
|
+
import { a as SyncStatus, o as DriveCollectionId, s as ModuleNotFoundError, t as gql } from "./lib-DMgQj1v2.js";
|
|
4
4
|
import "./parser-CkF6Qt8V.js";
|
|
5
5
|
import "./printer-CEYr4JOg.js";
|
|
6
6
|
import { createContext, use, useCallback, useContext, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
@@ -1800,7 +1800,16 @@ slug.setLocale = function(locale) {
|
|
|
1800
1800
|
defaultLocale = locales[locale] || {};
|
|
1801
1801
|
};
|
|
1802
1802
|
//#endregion
|
|
1803
|
-
//#region ../reactor-browser/dist/document-operations-
|
|
1803
|
+
//#region ../reactor-browser/dist/document-operations-B2lxu6qg.js
|
|
1804
|
+
var UnsupportedDocumentTypeError = class extends Error {
|
|
1805
|
+
constructor(documentType) {
|
|
1806
|
+
super(`Document type ${documentType} is not supported`);
|
|
1807
|
+
this.name = "UnsupportedDocumentTypeError";
|
|
1808
|
+
}
|
|
1809
|
+
static isError(error) {
|
|
1810
|
+
return Error.isError(error) && error.name === "UnsupportedDocumentTypeError";
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1804
1813
|
var DocumentModelNotFoundError = class extends Error {
|
|
1805
1814
|
documentType;
|
|
1806
1815
|
name = "DocumentModelNotFoundError";
|
|
@@ -1838,6 +1847,20 @@ function showDeleteNodeModal(nodeOrId) {
|
|
|
1838
1847
|
id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
|
|
1839
1848
|
});
|
|
1840
1849
|
}
|
|
1850
|
+
function isDocumentTypeSupported(documentType, supportedDocuments) {
|
|
1851
|
+
if (!supportedDocuments?.length) return true;
|
|
1852
|
+
return supportedDocuments.some((pattern) => {
|
|
1853
|
+
if (pattern.endsWith("/*")) {
|
|
1854
|
+
const prefix = pattern.slice(0, -2);
|
|
1855
|
+
return documentType.startsWith(prefix + "/");
|
|
1856
|
+
}
|
|
1857
|
+
if (pattern.endsWith("*") && !pattern.endsWith("/*")) {
|
|
1858
|
+
const prefix = pattern.slice(0, -1);
|
|
1859
|
+
return documentType.startsWith(prefix);
|
|
1860
|
+
}
|
|
1861
|
+
return pattern === documentType;
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1841
1864
|
function getUserPermissions() {
|
|
1842
1865
|
const user = window.ph?.renown?.user;
|
|
1843
1866
|
const allowList = window.ph?.allowList;
|
|
@@ -1851,6 +1874,40 @@ function getUserPermissions() {
|
|
|
1851
1874
|
};
|
|
1852
1875
|
}
|
|
1853
1876
|
const NON_DOMAIN_SCOPES = new Set(["auth", "document"]);
|
|
1877
|
+
/** An unreadable drive cannot be shown to hold no duplicate, so reads throw. */
|
|
1878
|
+
async function isDocumentInLocation(reactorClient, document, driveId, parentFolder) {
|
|
1879
|
+
const drive = await reactorClient.get(driveId);
|
|
1880
|
+
const nodeById = drive.state.global.nodes.find((node) => node.id === document.header.id);
|
|
1881
|
+
if (nodeById && nodeById.parentFolder === (parentFolder ?? null)) return {
|
|
1882
|
+
isDuplicate: true,
|
|
1883
|
+
duplicateType: "id",
|
|
1884
|
+
nodeId: nodeById.id
|
|
1885
|
+
};
|
|
1886
|
+
const nodeByNameAndType = drive.state.global.nodes.find((node) => isFileNode(node) && node.name === document.header.name && node.documentType === document.header.documentType && node.parentFolder === (parentFolder ?? null));
|
|
1887
|
+
if (nodeByNameAndType) return {
|
|
1888
|
+
isDuplicate: true,
|
|
1889
|
+
duplicateType: "name",
|
|
1890
|
+
nodeId: nodeByNameAndType.id
|
|
1891
|
+
};
|
|
1892
|
+
return { isDuplicate: false };
|
|
1893
|
+
}
|
|
1894
|
+
function getDocumentTypeIcon(document) {
|
|
1895
|
+
switch (document.header.documentType) {
|
|
1896
|
+
case "powerhouse/document-model": return "document-model";
|
|
1897
|
+
case "powerhouse/app": return "app";
|
|
1898
|
+
case "powerhouse/document-editor": return "editor";
|
|
1899
|
+
case "powerhouse/subgraph": return "subgraph";
|
|
1900
|
+
case "powerhouse/package": return "package";
|
|
1901
|
+
case "powerhouse/processor": {
|
|
1902
|
+
const processorType = document.state.global?.type;
|
|
1903
|
+
if (processorType === "analytics") return "analytics-processor";
|
|
1904
|
+
if (processorType === "relational") return "relational-processor";
|
|
1905
|
+
if (processorType === "codegen") return "codegen-processor";
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
default: return;
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1854
1911
|
async function downloadFile(document, fileName) {
|
|
1855
1912
|
try {
|
|
1856
1913
|
const data = await createZip(document);
|
|
@@ -2055,37 +2112,201 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
|
|
|
2055
2112
|
kind: "file"
|
|
2056
2113
|
};
|
|
2057
2114
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2115
|
+
/**
|
|
2116
|
+
* How many ids an import will try before giving up. The check before the create
|
|
2117
|
+
* catches an id that is already taken; this bound covers the window between the
|
|
2118
|
+
* two, where a create can still lose to a claim made in the meantime.
|
|
2119
|
+
*/
|
|
2120
|
+
const IMPORT_ID_ATTEMPTS = 3;
|
|
2121
|
+
/** True when this error, or anything it wraps, is a taken document id. */
|
|
2122
|
+
function isDocumentAlreadyExists(error) {
|
|
2123
|
+
let current = error;
|
|
2124
|
+
while (current instanceof Error) {
|
|
2125
|
+
if (current.name === "DocumentAlreadyExistsError") return true;
|
|
2126
|
+
current = current.cause;
|
|
2127
|
+
}
|
|
2128
|
+
return false;
|
|
2129
|
+
}
|
|
2130
|
+
/**
|
|
2131
|
+
* Creates the imported document under an id that is free, retrying on a
|
|
2132
|
+
* collision.
|
|
2133
|
+
*
|
|
2134
|
+
* The check cannot stand on its own: it answers for the moment it ran, and the
|
|
2135
|
+
* create that follows can still land on an id claimed in between. The store
|
|
2136
|
+
* rejects that create as DocumentAlreadyExistsError, which is not retryable
|
|
2137
|
+
* under the same id and is resolved by minting another one. A create that
|
|
2138
|
+
* fails leaves the drive untouched, so a retry has nothing to clean up.
|
|
2139
|
+
*/
|
|
2140
|
+
async function createImportedDocument(reactor, document, driveId, name, parentFolder) {
|
|
2141
|
+
let documentId = await reactor.isDocumentIdTaken(document.header.id) ? generateId() : document.header.id;
|
|
2142
|
+
for (let attempt = 1;; attempt++) {
|
|
2143
|
+
const header = createPresignedHeader(documentId, document.header.documentType);
|
|
2144
|
+
header.lastModifiedAtUtcIso = document.header.createdAtUtcIso;
|
|
2145
|
+
header.meta = document.header.meta;
|
|
2146
|
+
header.name = name || document.header.name;
|
|
2147
|
+
const initialDocument = {
|
|
2148
|
+
...document,
|
|
2149
|
+
header,
|
|
2150
|
+
state: document.initialState,
|
|
2151
|
+
operations: Object.keys(document.operations).reduce((acc, key) => {
|
|
2152
|
+
acc[key] = [];
|
|
2153
|
+
return acc;
|
|
2154
|
+
}, {})
|
|
2155
|
+
};
|
|
2156
|
+
try {
|
|
2157
|
+
const fileNode = await addDocument(driveId, name || document.header.name, document.header.documentType, parentFolder, initialDocument, documentId, document.header.meta?.preferredEditor);
|
|
2158
|
+
if (!fileNode) throw new Error("There was an error adding file");
|
|
2159
|
+
return {
|
|
2160
|
+
documentId,
|
|
2161
|
+
fileNode
|
|
2162
|
+
};
|
|
2163
|
+
} catch (error) {
|
|
2164
|
+
if (!isDocumentAlreadyExists(error) || attempt === IMPORT_ID_ATTEMPTS) throw error;
|
|
2165
|
+
logger.warn(`Document id ${documentId} was taken between the check and the create; importing under a new id`);
|
|
2166
|
+
documentId = generateId();
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
async function addFileWithProgress(file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict) {
|
|
2171
|
+
logger.verbose(`addFileWithProgress(drive: ${driveId}, name: ${name}, folder: ${parentFolder})`);
|
|
2172
|
+
const reactor = window.ph?.reactorClientModule?.client;
|
|
2173
|
+
if (!reactor) {
|
|
2174
|
+
onProgress?.({
|
|
2175
|
+
stage: "failed",
|
|
2176
|
+
progress: 100,
|
|
2177
|
+
error: "ReactorClient not initialized"
|
|
2178
|
+
});
|
|
2179
|
+
throw new Error("ReactorClient not initialized");
|
|
2180
|
+
}
|
|
2060
2181
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
2061
2182
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create files");
|
|
2062
|
-
const document = await loadFile(file);
|
|
2063
|
-
let duplicateId = false;
|
|
2064
|
-
const reactorClient = window.ph?.reactorClient;
|
|
2065
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2066
2183
|
try {
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2184
|
+
onProgress?.({
|
|
2185
|
+
stage: "loading",
|
|
2186
|
+
progress: 0
|
|
2187
|
+
});
|
|
2188
|
+
let document;
|
|
2189
|
+
try {
|
|
2190
|
+
document = await loadFile(file);
|
|
2191
|
+
} catch (loadError) {
|
|
2192
|
+
if (UnsupportedDocumentModelVersionError.isError(loadError)) {
|
|
2193
|
+
showPHModal({
|
|
2194
|
+
type: "documentVersionUnsupported",
|
|
2195
|
+
documentType: loadError.documentType,
|
|
2196
|
+
requiredVersion: loadError.requiredVersion,
|
|
2197
|
+
availableVersions: loadError.availableVersions
|
|
2198
|
+
});
|
|
2199
|
+
onProgress?.({
|
|
2200
|
+
stage: "failed",
|
|
2201
|
+
progress: 100,
|
|
2202
|
+
error: loadError.message
|
|
2203
|
+
});
|
|
2204
|
+
return;
|
|
2205
|
+
}
|
|
2206
|
+
const discoveryService = window.ph?.packageDiscoveryService;
|
|
2207
|
+
if (discoveryService && DocumentModelNotFoundError.isError(loadError)) {
|
|
2208
|
+
retryAfterDiscovery(discoveryService, loadError.documentType, file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict).catch((retryError) => {
|
|
2209
|
+
logger.error("Import retry after discovery failed: @error", retryError);
|
|
2210
|
+
onProgress?.({
|
|
2211
|
+
stage: "failed",
|
|
2212
|
+
progress: 100,
|
|
2213
|
+
error: retryError instanceof Error ? retryError.message : String(retryError)
|
|
2214
|
+
});
|
|
2215
|
+
});
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2218
|
+
throw loadError;
|
|
2219
|
+
}
|
|
2220
|
+
const duplicateCheck = await isDocumentInLocation(reactor, document, driveId, parentFolder);
|
|
2221
|
+
if (duplicateCheck.isDuplicate && !resolveConflict) {
|
|
2222
|
+
onProgress?.({
|
|
2223
|
+
stage: "conflict",
|
|
2224
|
+
progress: 0,
|
|
2225
|
+
duplicateType: duplicateCheck.duplicateType
|
|
2226
|
+
});
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2229
|
+
const documentType = getDocumentTypeIcon(document);
|
|
2230
|
+
if (documentType) onProgress?.({
|
|
2231
|
+
stage: "loading",
|
|
2232
|
+
progress: 10,
|
|
2233
|
+
documentType
|
|
2234
|
+
});
|
|
2235
|
+
else onProgress?.({
|
|
2236
|
+
stage: "loading",
|
|
2237
|
+
progress: 10
|
|
2238
|
+
});
|
|
2239
|
+
if (!isDocumentTypeSupported(document.header.documentType, documentTypes)) {
|
|
2240
|
+
onProgress?.({
|
|
2241
|
+
stage: "unsupported-document-type",
|
|
2242
|
+
progress: 100,
|
|
2243
|
+
error: `Document type ${document.header.documentType} is not supported`
|
|
2244
|
+
});
|
|
2245
|
+
throw new UnsupportedDocumentTypeError(document.header.documentType);
|
|
2246
|
+
}
|
|
2247
|
+
await reactor.getDocumentModelModule(document.header.documentType);
|
|
2248
|
+
onProgress?.({
|
|
2249
|
+
stage: "initializing",
|
|
2250
|
+
progress: 10
|
|
2251
|
+
});
|
|
2252
|
+
const created = await createImportedDocument(reactor, document, driveId, name, parentFolder);
|
|
2253
|
+
const documentId = created.documentId;
|
|
2254
|
+
const fileNode = created.fileNode;
|
|
2255
|
+
onProgress?.({
|
|
2256
|
+
stage: "initializing",
|
|
2257
|
+
progress: 20
|
|
2258
|
+
});
|
|
2259
|
+
await reactor.get(documentId);
|
|
2260
|
+
console.log("Document created, starting upload of operations");
|
|
2261
|
+
const segments = splitAtUpgradeBoundaries(document.operations);
|
|
2262
|
+
const totalOperations = segments.reduce((total, segment) => total + countOperations(segment.operations), 0);
|
|
2263
|
+
let uploadedBefore = 0;
|
|
2264
|
+
for (const segment of segments) {
|
|
2265
|
+
await uploadOperations(documentId, segment.operations, queueOperations, { onProgress: (uploadProgress) => {
|
|
2266
|
+
if (uploadProgress.uploadedOperations === void 0) return;
|
|
2267
|
+
const uploaded = uploadedBefore + uploadProgress.uploadedOperations;
|
|
2268
|
+
const uploadPercent = totalOperations > 0 ? uploaded / totalOperations : 0;
|
|
2269
|
+
onProgress?.({
|
|
2270
|
+
stage: "uploading",
|
|
2271
|
+
progress: 20 + Math.round(uploadPercent * 80),
|
|
2272
|
+
totalOperations,
|
|
2273
|
+
uploadedOperations: uploaded
|
|
2274
|
+
});
|
|
2275
|
+
} });
|
|
2276
|
+
uploadedBefore += countOperations(segment.operations);
|
|
2277
|
+
if (segment.upgradeTo !== void 0) await reactor.upgradeDocument(documentId, segment.upgradeTo);
|
|
2278
|
+
}
|
|
2279
|
+
onProgress?.({
|
|
2280
|
+
stage: "complete",
|
|
2281
|
+
progress: 100,
|
|
2282
|
+
fileNode
|
|
2283
|
+
});
|
|
2284
|
+
return fileNode;
|
|
2285
|
+
} catch (error) {
|
|
2286
|
+
if (!UnsupportedDocumentTypeError.isError(error)) {
|
|
2287
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2288
|
+
onProgress?.({
|
|
2289
|
+
stage: "failed",
|
|
2290
|
+
progress: 100,
|
|
2291
|
+
error: errorMessage
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
throw error;
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
async function retryAfterDiscovery(discoveryService, documentType, file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict) {
|
|
2298
|
+
if (!discoveryService) return;
|
|
2299
|
+
try {
|
|
2300
|
+
await discoveryService.load(documentType);
|
|
2301
|
+
} catch {
|
|
2302
|
+
onProgress?.({
|
|
2303
|
+
stage: "unsupported-document-type",
|
|
2304
|
+
progress: 100,
|
|
2305
|
+
error: `Document type ${documentType} is not supported`
|
|
2306
|
+
});
|
|
2307
|
+
return;
|
|
2088
2308
|
}
|
|
2309
|
+
await addFileWithProgress(file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict);
|
|
2089
2310
|
}
|
|
2090
2311
|
async function addFolder$1(driveId, name, parentFolder) {
|
|
2091
2312
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
@@ -2214,15 +2435,6 @@ async function copyNode$1(driveId, src, target) {
|
|
|
2214
2435
|
}
|
|
2215
2436
|
return await queueActions(drive, copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput)));
|
|
2216
2437
|
}
|
|
2217
|
-
/**
|
|
2218
|
-
* Upgrades a document to a newer document model version. Defaults to the
|
|
2219
|
-
* latest registered version for the document's type.
|
|
2220
|
-
*/
|
|
2221
|
-
async function upgradeDocument(documentId, toVersion) {
|
|
2222
|
-
const reactorClient = window.ph?.reactorClientModule?.client;
|
|
2223
|
-
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2224
|
-
return reactorClient.upgradeDocument(documentId, toVersion);
|
|
2225
|
-
}
|
|
2226
2438
|
gql`
|
|
2227
2439
|
mutation MutateDocumentWithOperations(
|
|
2228
2440
|
$documentIdentifier: String!
|
|
@@ -3831,7 +4043,7 @@ function useNodeActions() {
|
|
|
3831
4043
|
const drives = useDrives();
|
|
3832
4044
|
async function onAddFile(file, parent) {
|
|
3833
4045
|
if (!selectedDriveId) return;
|
|
3834
|
-
return
|
|
4046
|
+
return addFileWithProgress(file, selectedDriveId, file.name.replace(/\..+/gim, ""), resolveNode(selectedDriveId, parent)?.id, void 0, void 0, "duplicate");
|
|
3835
4047
|
}
|
|
3836
4048
|
async function onAddFolder(name, parent) {
|
|
3837
4049
|
if (!selectedDriveId) return;
|
|
@@ -4155,4 +4367,4 @@ createDebouncedRefreshReactorDataClient();
|
|
|
4155
4367
|
//#endregion
|
|
4156
4368
|
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 };
|
|
4157
4369
|
|
|
4158
|
-
//# sourceMappingURL=dist-
|
|
4370
|
+
//# sourceMappingURL=dist-Ha_NNo7z.js.map
|