@hesprs/sync-engine-sdk 3.1.3 → 3.1.5

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/dev.js CHANGED
@@ -1 +1 @@
1
- import e from"./debug-wrapper.js";import t from"./plugin/test/test-kit.js";import n from"./plugin/src/utils/sha-256.js";import r from"./transform.js";export{e as debugWrapper,n as sha256,r as syncEngineModule,t as testKit};
1
+ import e from"./debug-wrapper.js";import t from"./plugin/test/test-kit.js";import n from"./plugin/src/utils/sha-256.js";export{e as debugWrapper,n as sha256,t as testKit};
@@ -80,25 +80,4 @@ declare const testKit: {
80
80
  //#region src/utils/sha-256.d.ts
81
81
  declare function sha256(input: string): Promise<string>;
82
82
  //#endregion
83
- //#region src/sdk/transform.d.ts
84
- type SyncEngineConfig = {
85
- deps?: {
86
- neverBundle?: true | string | RegExp | Array<string | RegExp> | ((id: string, parentId: string | undefined, isResolved: boolean) => boolean | null | undefined);
87
- };
88
- };
89
- type ModuleMeta = Partial<Record<'name' | 'icon' | 'description' | 'source' | 'version' | 'readme', string>>;
90
- type ModuleMetaWithId = ModuleMeta & {
91
- id: string;
92
- };
93
- declare function syncEngineModule(meta?: ModuleMeta | Array<ModuleMetaWithId> | Record<string, ModuleMeta>): {
94
- name: string;
95
- renderChunk(code: string, chunk: {
96
- name: string;
97
- isEntry: boolean;
98
- }): {
99
- code: string;
100
- } | undefined;
101
- tsdownConfig(config: SyncEngineConfig): void;
102
- };
103
- //#endregion
104
- export { debugWrapper, sha256, syncEngineModule, testKit };
83
+ export { debugWrapper, sha256, testKit };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{pipe as e,readWithSize as t,writeWithValue as n}from"./plugin/src/utils/pipe.js";import r from"./plugin/src/components/MigrationModal.js";import i from"./prefix.js";import{generateEditableList as a,reactivelyValidate as o,s}from"./plugin/src/settings/utils.js";function c(e){let t=e;for(;`original`in t;)t=t.original;return t}export{c as digOriginal,a as generateEditableList,e as pipe,i as prefixWrapper,o as reactivelyValidate,t as readWithSize,s,r as setNeedMigration,n as writeWithValue};
1
+ import{chunkSize as e,concurrency as t,pipe as n,readWithSize as r,writeWithValue as i}from"./plugin/src/utils/pipe.js";import a from"./plugin/src/components/MigrationModal.js";import o from"./prefix.js";import{generateEditableList as s,reactivelyValidate as c,s as l}from"./plugin/src/settings/utils.js";function u(e){let t=e;for(;`original`in t;)t=t.original;return t}export{e as chunkSize,t as concurrency,u as digOriginal,s as generateEditableList,n as pipe,o as prefixWrapper,c as reactivelyValidate,r as readWithSize,l as s,a as setNeedMigration,i as writeWithValue};
@@ -74,12 +74,13 @@ declare class EventBus {
74
74
  //#endregion
75
75
  //#region src/modules/I18n.d.ts
76
76
  type ObsidianLanguageCode = 'en' | 'af' | 'am' | 'ar' | 'az' | 'be' | 'bg' | 'bn' | 'ca' | 'cs' | 'da' | 'de' | 'dv' | 'el' | 'en-GB' | 'eo' | 'es' | 'eu' | 'fa' | 'fi' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'ka' | 'kh' | 'kn' | 'ko' | 'ky' | 'la' | 'lt' | 'lv' | 'ml' | 'ms' | 'nan-TW' | 'ne' | 'nl' | 'nn' | 'no' | 'oc' | 'or' | 'pl' | 'pt' | 'pt-BR' | 'ro' | 'ru' | 'sa' | 'si' | 'sk' | 'sl' | 'sq' | 'sr' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'vi' | 'zh' | 'zh-TW';
77
- type Primitive = string | number | boolean | null | undefined;
78
- type Fragment<A = undefined> = (frag: DocumentFragment, args: A) => void;
79
- type TranslationResource = Record<string, string | Fragment<General$1>>;
80
- type InterpolationValues = Record<string, Primitive>;
81
- type TranslateParams<R extends Fragment<General$1> | string> = R extends Fragment<infer A> ? ([undefined] extends [A] ? [] : [A]) : [] | [InterpolationValues];
82
- type Translate<O extends TranslationResource> = <K extends keyof O>(key: K, ...args: TranslateParams<O[K]>) => O[K] extends string ? string : DocumentFragment;
77
+ type Factory<A = undefined> = (args: A) => DocumentFragment | string;
78
+ type Fragment<A = undefined> = (args: A) => DocumentFragment;
79
+ type Snippet<A = undefined> = (args: A) => string;
80
+ type TranslationTypes = string | Factory<General$1>;
81
+ type TranslationResource = Record<string, TranslationTypes>;
82
+ type TranslateParams<R extends TranslationTypes> = R extends Factory<infer A> ? ([A] extends [undefined] ? [] : [A]) : [];
83
+ type Translate<O extends TranslationResource> = <K extends keyof O>(key: K, ...arg: TranslateParams<O[K]>) => O[K] extends string | Snippet<General$1> ? string : DocumentFragment;
83
84
  declare class I18n {
84
85
  private readonly targetLangs;
85
86
  readonly i18n: {};
@@ -87,7 +88,7 @@ declare class I18n {
87
88
  private readonly translate;
88
89
  root: {
89
90
  registerI18n: (code: ObsidianLanguageCode, resource: TranslationResource) => void;
90
- translate: Translate<General$1>;
91
+ translate: Translate<TranslationResource>;
91
92
  };
92
93
  }
93
94
  //#endregion
@@ -113,8 +114,6 @@ type FailedTaskInfo = TaskInfo & {
113
114
  };
114
115
  declare class Sync {
115
116
  private readonly ctx;
116
- dispatch: Dispatch<Events>;
117
- on: On<Events>;
118
117
  constructor(ctx: {
119
118
  dispatch: Dispatch<Events>;
120
119
  initializeSync: () => Infras;
@@ -151,16 +150,7 @@ declare class Sync {
151
150
  private readonly executeSync;
152
151
  private readonly convertDeleteToUpload;
153
152
  root: {
154
- executeSync: (trigger: string) => Promise<{
155
- result: "cancelled";
156
- } | {
157
- result: "completed";
158
- } | {
159
- result: "failed";
160
- error: string;
161
- } | {
162
- result: "noop";
163
- }>;
153
+ executeSync: (trigger: string) => Promise<SyncTerminateReason>;
164
154
  };
165
155
  }
166
156
  //#endregion
@@ -170,6 +160,7 @@ type AddRibbonIcon = (icon: IconName, title: string, callback: (evt: MouseEvent)
170
160
  declare class Observability {
171
161
  private readonly ctx;
172
162
  private lastSyncTime;
163
+ private lastFailure?;
173
164
  private readonly sinceLastSyncText;
174
165
  private readonly syncStage;
175
166
  private readonly walkProgress;
@@ -219,7 +210,7 @@ declare class Observability {
219
210
  //#region src/components/file-tree/index.d.ts
220
211
  type FileTreeTranslations = {
221
212
  selectAll: string;
222
- xSelected: string;
213
+ xSelected: Snippet<number>;
223
214
  };
224
215
  //#endregion
225
216
  //#region src/modules/Extensibility.d.ts
@@ -259,9 +250,9 @@ declare class Extensibility {
259
250
  modules: Record<string, object>;
260
251
  };
261
252
  readonly i18n: {
262
- failedToLoadModule: string;
263
- failedToDownloadModule: string;
264
- failedToFetchSource: string;
253
+ failedToLoadModule: Snippet<string>;
254
+ failedToDownloadModule: Snippet<string>;
255
+ failedToFetchSource: Snippet<string>;
265
256
  };
266
257
  readonly events: {
267
258
  moduleLoaded: string;
@@ -404,15 +395,15 @@ type LabelDefinition = {
404
395
  color?: string;
405
396
  textColor?: string;
406
397
  };
407
- declare function s(parent: (self: SettingTree) => AugmentedSettingDefinitionItem, children?: CallableOrObjectTree): CallableOrObjectTree;
408
- declare function reactivelyValidate<T>({ text, parse, onSave, format, immediate }: {
398
+ export declare function s(parent: (self: SettingTree) => AugmentedSettingDefinitionItem, children?: CallableOrObjectTree): CallableOrObjectTree;
399
+ export declare function reactivelyValidate<T>({ text, parse, onSave, format, immediate }: {
409
400
  text: TextComponent;
410
401
  parse: (value: string) => T | undefined;
411
402
  format?: (value: T) => string;
412
403
  onSave: (value: T) => void;
413
404
  immediate?: boolean;
414
405
  }): void;
415
- declare function generateEditableList<T>({ memoryDB, items, identifier, saveSettings, rerenderSettingTab, defaultValue, render, translations: { add, empty, heading }, extraButtons }: {
406
+ export declare function generateEditableList<T>({ memoryDB, items, identifier, saveSettings, rerenderSettingTab, defaultValue, render, translations: { add, empty, heading }, extraButtons }: {
416
407
  memoryDB: DatabaseSync<EphemeralEditableListSchema>;
417
408
  items: Array<T>;
418
409
  identifier: string;
@@ -459,7 +450,7 @@ type DevelopmentSettingTranslations = {
459
450
  moduleSources: string;
460
451
  moduleSourcesDescription: string;
461
452
  edit: string;
462
- xConfigured: string;
453
+ xConfigured: Snippet<number>;
463
454
  addSource: string;
464
455
  noSourceConfigured: string;
465
456
  moduleSourcePlaceholder: string;
@@ -517,7 +508,7 @@ type FeaturesSettingTranslations = {
517
508
  scheduledSyncPlaceholder: string;
518
509
  asymmetricStorage: string;
519
510
  asymmetricStorageDescription: Fragment;
520
- asymmetricStorageMigration: Fragment<'enable' | 'disable'>;
511
+ asymmetricStorageMigration: Fragment<boolean>;
521
512
  } & MigrationModalTranslations;
522
513
  //#endregion
523
514
  //#region src/settings/filter.d.ts
@@ -527,7 +518,7 @@ type FilterSettingTranslations = {
527
518
  inclusionRulesDescription: Fragment;
528
519
  exclusionRules: string;
529
520
  exclusionRulesDescription: Fragment;
530
- xConfigured: string;
521
+ xConfigured: Snippet<number>;
531
522
  addInclusionRule: string;
532
523
  addExclusionRule: string;
533
524
  noRuleConfigured: string;
@@ -550,7 +541,7 @@ type HeadSettingTranslations = {
550
541
  checkConnection: string;
551
542
  conflictResolveStrategy: string;
552
543
  conflictResolveStrategyDescription: string;
553
- xEnabled: string;
544
+ xEnabled: Snippet<number>;
554
545
  settingTips: Fragment<{
555
546
  labels: Array<LabelDefinition>;
556
547
  addLabel: typeof addLabel;
@@ -574,12 +565,14 @@ type MiscellaneousSettingTranslations = {
574
565
  customHeaders: string;
575
566
  customHeadersDescription: string;
576
567
  edit: string;
577
- xConfigured: string;
568
+ xConfigured: Snippet<number>;
578
569
  addHeader: string;
579
570
  noHeaderConfigured: string;
580
571
  headerKeyPlaceholder: string;
581
572
  headerValuePlaceholder: string;
582
573
  addSecretHeader: string;
574
+ avoidAutoSyncWhenOffline: string;
575
+ avoidAutoSyncWhenOfflineDescription: string;
583
576
  };
584
577
  //#endregion
585
578
  //#region src/components/module-management/index.d.ts
@@ -739,9 +732,9 @@ declare class ProgressModal extends Modal {
739
732
  readonly i18n: {
740
733
  syncProgress: string;
741
734
  completed: string;
742
- failedTasksDescription: string;
743
- confirmDeleteDescription: string;
744
- confirmTasksDescription: Fragment<TaskCounts>;
735
+ failedTasksDescription: Snippet<number>;
736
+ confirmDeleteDescription: Snippet<number>;
737
+ confirmTasksDescription: Snippet<TaskCounts>;
745
738
  hide: string;
746
739
  confirm: string;
747
740
  cancel: string;
@@ -779,6 +772,7 @@ declare class Scheduler {
779
772
  registerEvent: (ref: EventRef) => void;
780
773
  app: App;
781
774
  isIdle: Ref<boolean>;
775
+ dispatch: Dispatch<Events>;
782
776
  });
783
777
  settings: {
784
778
  startupSync: TogglableValue;
@@ -786,6 +780,7 @@ declare class Scheduler {
786
780
  realtimeSync: TogglableValue;
787
781
  exclusionRules: Array<GlobMatchRule>;
788
782
  inclusionRules: Array<GlobMatchRule>;
783
+ avoidAutoSyncWhenOffline: boolean;
789
784
  };
790
785
  private readonly requestSync;
791
786
  start: () => void;
@@ -822,17 +817,18 @@ type Translations = MergeSingleKey<InternalModules, 'i18n'>;
822
817
  declare function prefixWrapper(original: Fs, prefix: string): WrappedFs;
823
818
  //#endregion
824
819
  //#region src/utils/pipe.d.ts
825
- declare function pipe({ from, to, stat, key }: {
820
+ declare const chunkSize: number, concurrency: number;
821
+ export declare function pipe({ from, to, stat, key }: {
826
822
  from: Fs;
827
823
  to: Fs;
828
824
  key: string;
829
825
  stat: FileStat;
830
826
  }): Promise<string | undefined>;
831
- declare function readWithSize(fs: Fs, key: string, stat: FileStat): Promise<Binary | ReadableStream<Binary> | undefined>;
832
- declare function writeWithValue(fs: Fs, key: string, value: Binary | ReadableStream<Binary>, stat: FileStat): MaybePromise<string>;
827
+ export declare function readWithSize(fs: Fs, key: string, stat: FileStat): Promise<Binary | ReadableStream<Binary> | undefined>;
828
+ export declare function writeWithValue(fs: Fs, key: string, value: Binary | ReadableStream<Binary>, stat: FileStat): MaybePromise<string>;
833
829
  //#endregion
834
830
  //#region src/sdk/index.d.ts
835
- declare function digOriginal(wrapped: Fs): RootFs;
836
- type SelectFromContext<O extends object> = Context extends O ? O : never;
831
+ export declare function digOriginal(wrapped: Fs): RootFs;
832
+ export type SelectFromContext<O extends object> = Context extends O ? O : never;
837
833
  //#endregion
838
- export { type AddRecord, type AugmentedModuleMeta, type BaseTask, type BatchOptimizer, type Binary, type CallableOrObjectTree, type CheckConnectionResult, type ConflictResolver, type ConflictResolverEntry, type ConflictResolverPayload, type Context, type CreateLocalDir, type CreateRemoteDir, type CustomAtom, type DatabaseAsync, type DatabaseSync, type Decider, type DeciderEntry, type DeciderInput, type DeleteAtom, type Dispatch, type Download, type Events, type ExistingMemoryDB, type FileStat, type FolderStat, type Fragment, type Fs, type FsWrapperEntry, type InputAtom, type LabelDefinition, type ListReporter, type LocalRequestMiddlewareEntry, type MaybePromise, type MkdirAtom, type ModuleMeta, type MoveAtom, type MoveLocal, type MoveRemote, type ObsidianLanguageCode, type On, type OptimizerEntry, type OptimizerInput, type OptimizerOutput, type OutputAtom, type Progress, type RecordStat, type RecordStatsMap, type RecordStore, type RemoteFsEntry, type RemoteLister, type RemoteListerEntry, type RemoteRequestMiddlewareEntry, type RemoveLocal, type RemoveRecord, type RemoveRemote, type Request, type RequestParam, type RequestResponse, type ResolveConflict, type RootFs, SelectFromContext, type SettingEntry, type Settings, type Stat, type StatsMap, type StoreAsync, type StoreOperations, type StoreSync, type SyncTerminateReason, type TaskFactory, type TaskNames, type Translate, type TranslationResource, type Translations, type Upload, type VaultRequest, type WrappedFs, type WriteAtom, digOriginal, generateEditableList, pipe, prefixWrapper, reactivelyValidate, readWithSize, s, setNeedMigration, writeWithValue };
834
+ export { type AddRecord, type AugmentedModuleMeta, type BaseTask, type BatchOptimizer, type Binary, type CallableOrObjectTree, type CheckConnectionResult, type ConflictResolver, type ConflictResolverEntry, type ConflictResolverPayload, type Context, type CreateLocalDir, type CreateRemoteDir, type CustomAtom, type DatabaseAsync, type DatabaseSync, type Decider, type DeciderEntry, type DeciderInput, type DeleteAtom, type Dispatch, type Download, type Events, type ExistingMemoryDB, type FileStat, type FolderStat, type Fragment, type Fs, type FsWrapperEntry, type InputAtom, type LabelDefinition, type ListReporter, type LocalRequestMiddlewareEntry, type MaybePromise, type MkdirAtom, type ModuleMeta, type MoveAtom, type MoveLocal, type MoveRemote, type ObsidianLanguageCode, type On, type OptimizerEntry, type OptimizerInput, type OptimizerOutput, type OutputAtom, type Progress, type RecordStat, type RecordStatsMap, type RecordStore, type RemoteFsEntry, type RemoteLister, type RemoteListerEntry, type RemoteRequestMiddlewareEntry, type RemoveLocal, type RemoveRecord, type RemoveRemote, type Request, type RequestParam, type RequestResponse, type ResolveConflict, type RootFs, type SettingEntry, type Settings, type Snippet, type Stat, type StatsMap, type StoreAsync, type StoreOperations, type StoreSync, type SyncTerminateReason, type TaskFactory, type TaskNames, type Translate, type TranslationResource, type Translations, type Upload, type VaultRequest, type WrappedFs, type WriteAtom, chunkSize, concurrency, prefixWrapper, setNeedMigration };
@@ -0,0 +1 @@
1
+ import{Platform as e}from"obsidian";function t(e){let t=e,n=[t.status,t.res?.status,t.response?.status];for(let e of n)if(typeof e==`number`)return e}function n(){let t=5*1024**2;`deviceMemory`in navigator&&typeof navigator.deviceMemory==`number`?navigator.deviceMemory<=4&&(t/=2):navigator.hardwareConcurrency<=4&&(t/=2),e.isAndroidApp&&(t/=2);let n=t*.8;return{chunkSize:n,concurrency:Math.floor(16777216/n),streamThreshold:t}}const{chunkSize:r,concurrency:i,streamThreshold:a}=n();async function o({from:e,to:t,stat:n,key:r}){let i=await s(e,r,n);if(i)return c(t,r,i,n)}async function s(e,t,n){try{return n.size>a?await e.readStream(t,n):await e.read(t,n)}catch(e){if(l(e))return;throw e}}function c(e,t,n,r){return n instanceof ReadableStream?e.writeStream(t,n,r):e.write(t,n,r)}function l(e){return t(e)===404||(e.message??String(e)).toLocaleUpperCase().includes(`ENOENT`)}export{c as a,s as i,i as n,o as r,r as t};
@@ -0,0 +1 @@
1
+ const e=16777216;export{e as STREAM_RESERVATION_SIZE};
@@ -1 +1 @@
1
- import{getStatus as e}from"../../../shared/src/get-status.js";const t=2.5*1024**2;async function n({from:e,to:t,stat:n,key:a}){let o=await r(e,a,n);if(o)return i(t,a,o,n)}async function r(e,n,r){try{return r.size>t?await e.readStream(n,r):await e.read(n,r)}catch(e){if(a(e))return;throw e}}function i(e,t,n,r){return n instanceof ReadableStream?e.writeStream(t,n,r):e.write(t,n,r)}function a(t){return e(t)===404||(t.message??String(t)).toLocaleUpperCase().includes(`ENOENT`)}export{n as pipe,r as readWithSize,i as writeWithValue};
1
+ import{getStatus as e}from"../../../shared/src/get-status.js";import{STREAM_RESERVATION_SIZE as t}from"../fs/wrappers/memory-control.js";import{Platform as n}from"obsidian";function r(){let e=5*1024**2;`deviceMemory`in navigator&&typeof navigator.deviceMemory==`number`?navigator.deviceMemory<=4&&(e/=2):navigator.hardwareConcurrency<=4&&(e/=2),n.isAndroidApp&&(e/=2);let r=e*.8;return{chunkSize:r,concurrency:Math.floor(t/r),streamThreshold:e}}const{chunkSize:i,concurrency:a,streamThreshold:o}=r();async function s({from:e,to:t,stat:n,key:r}){let i=await c(e,r,n);if(i)return l(t,r,i,n)}async function c(e,t,n){try{return n.size>o?await e.readStream(t,n):await e.read(t,n)}catch(e){if(u(e))return;throw e}}function l(e,t,n,r){return n instanceof ReadableStream?e.writeStream(t,n,r):e.write(t,n,r)}function u(t){return e(t)===404||(t.message??String(t)).toLocaleUpperCase().includes(`ENOENT`)}export{i as chunkSize,a as concurrency,s as pipe,c as readWithSize,l as writeWithValue};
@@ -0,0 +1,21 @@
1
+ //#region src/sdk/tsdown-plugin.d.ts
2
+ type SyncEngineConfig = {
3
+ deps?: {
4
+ neverBundle?: true | string | RegExp | Array<string | RegExp> | ((id: string, parentId: string | undefined, isResolved: boolean) => boolean | null | undefined);
5
+ };
6
+ };
7
+ type ModuleMeta = Partial<Record<'name' | 'icon' | 'description' | 'source' | 'version' | 'readme', string>>;
8
+ type ModuleMetaWithId = ModuleMeta & {
9
+ id: string;
10
+ };
11
+ export default function syncEngineModule(meta?: ModuleMeta | Array<ModuleMetaWithId> | Record<string, ModuleMeta>): {
12
+ name: string;
13
+ renderChunk(code: string, chunk: {
14
+ name: string;
15
+ isEntry: boolean;
16
+ }): {
17
+ code: string;
18
+ } | undefined;
19
+ tsdownConfig(config: SyncEngineConfig): void;
20
+ };
21
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hesprs/sync-engine-sdk",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "Official SDK for developing modules targeting Sync Engine, the extensible Obsidian syncing plugin.",
5
5
  "keywords": [
6
6
  "obsidian-plugin",
@@ -14,7 +14,7 @@
14
14
  "license": "MIT",
15
15
  "author": {
16
16
  "name": "Hēsperus",
17
- "email": "hesprs@outlook.com"
17
+ "email": "hesprs@yandex.com"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -35,6 +35,10 @@
35
35
  "./dev": {
36
36
  "types": "./dist/dev.spec.d.ts",
37
37
  "default": "./dist/dev.js"
38
+ },
39
+ "./tsdown-plugin": {
40
+ "types": "./dist/tsdown-plugin.spec.d.ts",
41
+ "default": "./dist/tsdown-plugin.js"
38
42
  }
39
43
  },
40
44
  "publishConfig": {
@@ -55,13 +59,13 @@
55
59
  },
56
60
  "devDependencies": {
57
61
  "@repo/shared": "workspace:*",
58
- "@unocss/postcss": "^66.7.5",
59
- "postcss-merge-rules": "^8.0.3",
60
- "solid-js": "^1.9.13",
62
+ "@unocss/postcss": "^66.10.0",
63
+ "postcss-merge-rules": "^9.0.3",
64
+ "solid-js": "^1.9.15",
61
65
  "synthkernel": "./synthkernel.tgz",
62
66
  "uni-kv": "../../uni-kv.tgz",
63
- "unocss": "^66.7.5",
67
+ "unocss": "^66.10.0",
64
68
  "unplugin-solid": "^2.0.0",
65
- "verkit": "^0.3.2"
69
+ "verkit": "^0.4.0"
66
70
  }
67
71
  }
@@ -1 +0,0 @@
1
- function e(e){let t=e,n=[t.status,t.res?.status,t.response?.status];for(let e of n)if(typeof e==`number`)return e}const t=2.5*1024**2;async function n({from:e,to:t,stat:n,key:a}){let o=await r(e,a,n);if(o)return i(t,a,o,n)}async function r(e,n,r){try{return r.size>t?await e.readStream(n,r):await e.read(n,r)}catch(e){if(a(e))return;throw e}}function i(e,t,n,r){return n instanceof ReadableStream?e.writeStream(t,n,r):e.write(t,n,r)}function a(t){return e(t)===404||(t.message??String(t)).toLocaleUpperCase().includes(`ENOENT`)}export{r as n,i as r,n as t};
File without changes