insert dry run into plan records
This commit is contained in:
parent
6fce079481
commit
13537d1481
@ -165,3 +165,5 @@ export const DEFAULT_DEBUG_FOLDER = "_debug_remotely_save/";
|
||||
export const DEFAULT_SYNC_PLANS_HISTORY_FILE_PREFIX =
|
||||
"sync_plans_hist_exported_on_";
|
||||
export const DEFAULT_LOG_HISTORY_FILE_PREFIX = "log_hist_exported_on_";
|
||||
|
||||
export type SyncTriggerSourceType = "manual" | "auto" | "dry" | "autoOnceInit";
|
||||
|
||||
10
src/main.ts
10
src/main.ts
@ -9,7 +9,10 @@ import {
|
||||
} from "obsidian";
|
||||
import cloneDeep from "lodash/cloneDeep";
|
||||
import { createElement, RotateCcw, RefreshCcw, FileText } from "lucide";
|
||||
import type { RemotelySavePluginSettings } from "./baseTypes";
|
||||
import type {
|
||||
RemotelySavePluginSettings,
|
||||
SyncTriggerSourceType,
|
||||
} from "./baseTypes";
|
||||
import {
|
||||
COMMAND_CALLBACK,
|
||||
COMMAND_CALLBACK_ONEDRIVE,
|
||||
@ -89,8 +92,6 @@ interface OAuth2Info {
|
||||
revokeAuthSetting?: Setting;
|
||||
}
|
||||
|
||||
type SyncTriggerSourceType = "manual" | "auto" | "dry" | "autoOnceInit";
|
||||
|
||||
const iconNameSyncWait = `remotely-save-sync-wait`;
|
||||
const iconNameSyncRunning = `remotely-save-sync-running`;
|
||||
const iconNameLogs = `remotely-save-logs`;
|
||||
@ -286,6 +287,7 @@ export default class RemotelySavePlugin extends Plugin {
|
||||
origMetadataOnRemote.deletions,
|
||||
localHistory,
|
||||
client.serviceType,
|
||||
triggerSource,
|
||||
this.app.vault,
|
||||
this.settings.syncConfigDir,
|
||||
this.app.vault.configDir,
|
||||
@ -293,9 +295,7 @@ export default class RemotelySavePlugin extends Plugin {
|
||||
this.settings.password
|
||||
);
|
||||
log.info(plan.mixedStates); // for debugging
|
||||
if (triggerSource !== "dry") {
|
||||
await insertSyncPlanRecordByVault(this.db, plan, this.vaultRandomID);
|
||||
}
|
||||
|
||||
// The operations above are almost read only and kind of safe.
|
||||
// The operations below begins to write or delete (!!!) something.
|
||||
|
||||
10
src/sync.ts
10
src/sync.ts
@ -7,13 +7,14 @@ import {
|
||||
} from "obsidian";
|
||||
import AggregateError from "aggregate-error";
|
||||
import PQueue from "p-queue";
|
||||
import {
|
||||
import type {
|
||||
RemoteItem,
|
||||
SUPPORTED_SERVICES_TYPE,
|
||||
SyncTriggerSourceType,
|
||||
DecisionType,
|
||||
FileOrFolderMixedState,
|
||||
API_VER_STAT_FOLDER,
|
||||
SUPPORTED_SERVICES_TYPE,
|
||||
} from "./baseTypes";
|
||||
import { API_VER_STAT_FOLDER } from "./baseTypes";
|
||||
import {
|
||||
decryptBase32ToString,
|
||||
decryptBase64urlToString,
|
||||
@ -65,6 +66,7 @@ export type SyncStatusType =
|
||||
export interface SyncPlanType {
|
||||
ts: number;
|
||||
tsFmt?: string;
|
||||
syncTriggerSource?: SyncTriggerSourceType;
|
||||
remoteType: SUPPORTED_SERVICES_TYPE;
|
||||
mixedStates: Record<string, FileOrFolderMixedState>;
|
||||
}
|
||||
@ -752,6 +754,7 @@ export const getSyncPlan = async (
|
||||
remoteDeleteHistory: DeletionOnRemote[],
|
||||
localFileHistory: FileFolderHistoryRecord[],
|
||||
remoteType: SUPPORTED_SERVICES_TYPE,
|
||||
triggerSource: SyncTriggerSourceType,
|
||||
vault: Vault,
|
||||
syncConfigDir: boolean,
|
||||
configDir: string,
|
||||
@ -824,6 +827,7 @@ export const getSyncPlan = async (
|
||||
ts: currTs,
|
||||
tsFmt: currTsFmt,
|
||||
remoteType: remoteType,
|
||||
syncTriggerSource: triggerSource,
|
||||
mixedStates: mixedStates,
|
||||
} as SyncPlanType;
|
||||
return {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user