orgnote-api 0.20.2 → 0.40.9

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.
Files changed (288) hide show
  1. package/api.d.ts +93 -98
  2. package/constants/{command-groups.contant.d.ts → command-groups.d.ts} +2 -1
  3. package/constants/{command-groups.contant.js → command-groups.js} +2 -0
  4. package/constants/extension-errors.d.ts +9 -0
  5. package/constants/extension-errors.js +18 -0
  6. package/constants/file-guard-errors.d.ts +8 -0
  7. package/constants/file-guard-errors.js +18 -0
  8. package/constants/git-errors.d.ts +9 -0
  9. package/constants/git-errors.js +18 -0
  10. package/constants/i18n-keys.d.ts +369 -0
  11. package/constants/i18n-keys.js +157 -0
  12. package/constants/index.d.ts +9 -1
  13. package/constants/index.js +9 -1
  14. package/constants/oauth-providers.d.ts +1 -0
  15. package/constants/oauth-providers.js +1 -0
  16. package/constants/route-names.d.ts +36 -0
  17. package/constants/route-names.js +37 -0
  18. package/constants/route-paths.d.ts +5 -0
  19. package/constants/route-paths.js +4 -0
  20. package/constants/style-sizes.d.ts +1 -0
  21. package/constants/style-sizes.js +1 -0
  22. package/encryption/__tests__/encryption.spec.js +4 -5
  23. package/encryption/__tests__/note-encryption.spec.js +49 -340
  24. package/encryption/encryption.d.ts +9 -4
  25. package/encryption/encryption.js +25 -5
  26. package/encryption/note-encryption.d.ts +1 -1
  27. package/encryption/note-encryption.js +6 -6
  28. package/files-api.d.ts +0 -1
  29. package/index.d.ts +4 -1
  30. package/index.js +4 -1
  31. package/mappers/orgnode-to-note.d.ts +2 -2
  32. package/mappers/orgnode-to-note.js +3 -2
  33. package/models/auth-state.d.ts +9 -0
  34. package/models/auth-state.js +12 -0
  35. package/models/auth-store.d.ts +3 -3
  36. package/models/buffer-store.d.ts +14 -0
  37. package/models/buffer.d.ts +24 -0
  38. package/models/colors.d.ts +1 -0
  39. package/models/command.d.ts +13 -8
  40. package/models/commands-group-store.d.ts +11 -0
  41. package/models/commands-store.d.ts +13 -0
  42. package/models/completion-store.d.ts +14 -0
  43. package/models/completion.d.ts +16 -7
  44. package/models/config-store.d.ts +9 -0
  45. package/models/confirmation-modal.d.ts +11 -0
  46. package/models/context-menu-store.d.ts +10 -0
  47. package/models/cron-store.d.ts +21 -0
  48. package/models/cron-task.d.ts +30 -0
  49. package/models/css-utils.d.ts +17 -0
  50. package/models/default-commands.d.ts +52 -3
  51. package/models/default-commands.js +59 -2
  52. package/models/encryption-store.d.ts +10 -0
  53. package/models/encryption-store.js +1 -0
  54. package/models/encryption.d.ts +54 -11
  55. package/models/encryption.js +28 -1
  56. package/models/extension-registry-store.d.ts +9 -0
  57. package/models/extension-registry-store.js +1 -0
  58. package/models/extension-store.d.ts +18 -0
  59. package/models/extension-store.js +1 -0
  60. package/models/extension.d.ts +96 -24
  61. package/models/extension.js +88 -1
  62. package/models/file-guard-store.d.ts +14 -0
  63. package/models/file-guard-store.js +1 -0
  64. package/models/file-guard.d.ts +27 -0
  65. package/models/file-guard.js +1 -0
  66. package/models/{file-cache.d.ts → file-info.d.ts} +1 -1
  67. package/models/file-info.js +1 -0
  68. package/models/file-manager-store.d.ts +10 -12
  69. package/models/file-opener-store.d.ts +6 -4
  70. package/models/file-system-manager-store.d.ts +13 -0
  71. package/models/file-system-manager-store.js +1 -0
  72. package/models/file-system-store.d.ts +19 -0
  73. package/models/file-system-store.js +1 -0
  74. package/models/file-system.d.ts +32 -5
  75. package/models/file-system.js +2 -0
  76. package/models/file-upload.d.ts +6 -0
  77. package/models/file-upload.js +1 -0
  78. package/models/file-watcher-store.d.ts +18 -0
  79. package/models/file-watcher-store.js +1 -0
  80. package/models/files-store.d.ts +2 -2
  81. package/models/git-store.d.ts +12 -0
  82. package/models/git-store.js +1 -0
  83. package/models/git.d.ts +47 -0
  84. package/models/git.js +1 -0
  85. package/models/i18n-keys.d.ts +2 -0
  86. package/models/i18n-keys.js +1 -0
  87. package/models/index.d.ts +57 -2
  88. package/models/index.js +60 -2
  89. package/models/layout-snapshot-repository.d.ts +14 -0
  90. package/models/layout-snapshot-repository.js +1 -0
  91. package/models/layout-store.d.ts +17 -0
  92. package/models/layout-store.js +1 -0
  93. package/models/layout.d.ts +16 -0
  94. package/models/layout.js +1 -0
  95. package/models/log-repository.d.ts +17 -0
  96. package/models/log-repository.js +1 -0
  97. package/models/log-store.d.ts +15 -0
  98. package/models/log-store.js +1 -0
  99. package/models/log.d.ts +12 -0
  100. package/models/log.js +1 -0
  101. package/models/logger.d.ts +8 -0
  102. package/models/logger.js +1 -0
  103. package/models/menu-action.d.ts +18 -0
  104. package/models/menu-action.js +1 -0
  105. package/models/modal-store.d.ts +16 -0
  106. package/models/modal-store.js +1 -0
  107. package/models/modal.d.ts +10 -2
  108. package/models/note.d.ts +30 -13
  109. package/models/notification-config.d.ts +14 -0
  110. package/models/notification-config.js +1 -0
  111. package/models/notifications-store.d.ts +20 -0
  112. package/models/notifications-store.js +1 -0
  113. package/models/oauth-provider.d.ts +2 -1
  114. package/models/orgnote-config.d.ts +80 -0
  115. package/models/orgnote-config.js +42 -0
  116. package/models/orgnote-url.d.ts +6 -0
  117. package/models/orgnote-url.js +1 -0
  118. package/models/pane-snapshot-repository.d.ts +0 -0
  119. package/models/pane-snapshot-repository.js +0 -0
  120. package/models/pane.d.ts +38 -0
  121. package/models/pane.js +1 -0
  122. package/models/panes-store.d.ts +30 -0
  123. package/models/panes-store.js +1 -0
  124. package/models/platform-detection.d.ts +11 -0
  125. package/models/platform-detection.js +1 -0
  126. package/models/platform-specific.d.ts +1 -0
  127. package/models/platform-specific.js +1 -0
  128. package/models/platform.d.ts +2 -0
  129. package/models/platform.js +1 -0
  130. package/models/queue-store.d.ts +49 -0
  131. package/models/queue-store.js +1 -0
  132. package/models/queue-task.d.ts +15 -0
  133. package/models/queue-task.js +1 -0
  134. package/models/repositories.d.ts +58 -38
  135. package/models/screen-detection.d.ts +10 -0
  136. package/models/screen-detection.js +1 -0
  137. package/models/settings-store.d.ts +12 -0
  138. package/models/settings-store.js +1 -0
  139. package/models/settings-ui-store.d.ts +7 -0
  140. package/models/settings-ui-store.js +1 -0
  141. package/models/sidebar-store.d.ts +22 -0
  142. package/models/sidebar-store.js +1 -0
  143. package/models/splash-screen.d.ts +13 -0
  144. package/models/splash-screen.js +1 -0
  145. package/models/store.d.ts +1 -1
  146. package/models/style-size.d.ts +2 -0
  147. package/models/style-size.js +1 -0
  148. package/models/style-variant.d.ts +1 -0
  149. package/models/style-variant.js +1 -0
  150. package/models/sync-store.d.ts +8 -6
  151. package/models/sync.d.ts +0 -5
  152. package/models/system-info.d.ts +47 -0
  153. package/models/system-info.js +1 -0
  154. package/models/theme-store.d.ts +16 -0
  155. package/models/theme-store.js +1 -0
  156. package/models/theme-variables.d.ts +4 -189
  157. package/models/theme-variables.js +2 -191
  158. package/models/toolbar-store.d.ts +9 -0
  159. package/models/toolbar-store.js +1 -0
  160. package/models/ui-store.d.ts +6 -0
  161. package/models/ui-store.js +1 -0
  162. package/models/user.d.ts +4 -7
  163. package/models/vue-component.d.ts +4 -2
  164. package/package.json +38 -27
  165. package/remote-api/api.d.ts +288 -669
  166. package/remote-api/api.js +199 -485
  167. package/remote-api/base.js +1 -1
  168. package/remote-api/common.d.ts +1 -1
  169. package/remote-api/index.d.ts +2 -2
  170. package/remote-api/index.js +0 -1
  171. package/sync/__tests__/memory-state.spec.d.ts +1 -0
  172. package/sync/__tests__/memory-state.spec.js +49 -0
  173. package/sync/__tests__/plan.spec.d.ts +1 -0
  174. package/sync/__tests__/plan.spec.js +116 -0
  175. package/sync/create-sync-plan.d.ts +2 -0
  176. package/sync/create-sync-plan.js +13 -0
  177. package/sync/fetch.d.ts +8 -0
  178. package/sync/fetch.js +32 -0
  179. package/sync/index.d.ts +10 -0
  180. package/sync/index.js +9 -0
  181. package/sync/memory-state.d.ts +2 -0
  182. package/sync/memory-state.js +22 -0
  183. package/sync/operations/conflict.d.ts +10 -0
  184. package/sync/operations/conflict.js +56 -0
  185. package/sync/operations/delete-local.d.ts +2 -0
  186. package/sync/operations/delete-local.js +17 -0
  187. package/sync/operations/delete-remote.d.ts +2 -0
  188. package/sync/operations/delete-remote.js +26 -0
  189. package/sync/operations/download.d.ts +2 -0
  190. package/sync/operations/download.js +20 -0
  191. package/sync/operations/index.d.ts +5 -0
  192. package/sync/operations/index.js +5 -0
  193. package/sync/operations/synced-file.d.ts +14 -0
  194. package/sync/operations/synced-file.js +5 -0
  195. package/sync/operations/upload.d.ts +2 -0
  196. package/sync/operations/upload.js +30 -0
  197. package/sync/plan.d.ts +9 -0
  198. package/sync/plan.js +57 -0
  199. package/sync/recovery.d.ts +2 -0
  200. package/sync/recovery.js +6 -0
  201. package/sync/scan.d.ts +4 -0
  202. package/sync/scan.js +40 -0
  203. package/sync/types.d.ts +74 -0
  204. package/sync/types.js +7 -0
  205. package/sync/utils/__tests__/oldest-synced-at.spec.d.ts +1 -0
  206. package/sync/utils/__tests__/oldest-synced-at.spec.js +38 -0
  207. package/sync/utils/oldest-synced-at.d.ts +2 -0
  208. package/sync/utils/oldest-synced-at.js +9 -0
  209. package/types/index.d.ts +0 -0
  210. package/types/index.js +0 -0
  211. package/utils/__tests__/find-files-diff.spec.d.ts +1 -0
  212. package/{tools → utils}/__tests__/find-files-diff.spec.js +3 -3
  213. package/utils/__tests__/find-note-files-diff.spec.d.ts +1 -0
  214. package/{tools → utils}/__tests__/find-note-files-diff.spec.js +5 -5
  215. package/utils/__tests__/get-file-name.spec.d.ts +1 -0
  216. package/utils/__tests__/get-string-path.spec.d.ts +1 -0
  217. package/utils/__tests__/is-gpg-encrypted.spec.d.ts +1 -0
  218. package/utils/__tests__/is-org-file.spec.d.ts +1 -0
  219. package/utils/__tests__/join.spec.d.ts +1 -0
  220. package/utils/__tests__/join.spec.js +32 -0
  221. package/utils/__tests__/nullable-guards.spec.d.ts +1 -0
  222. package/utils/__tests__/nullable-guards.spec.js +44 -0
  223. package/utils/__tests__/parent-folder.spec.d.ts +1 -0
  224. package/utils/__tests__/read-org-files-recursively.spec.d.ts +1 -0
  225. package/utils/__tests__/split-path.spec.d.ts +1 -0
  226. package/utils/__tests__/to-absolute-path.spec.d.ts +1 -0
  227. package/utils/__tests__/to-absolute-path.spec.js +26 -0
  228. package/utils/__tests__/to-error.spec.d.ts +1 -0
  229. package/utils/__tests__/to-error.spec.js +112 -0
  230. package/utils/__tests__/with-root.spec.d.ts +1 -0
  231. package/utils/__tests__/with-root.spec.js +20 -0
  232. package/utils/auth-state.d.ts +5 -0
  233. package/utils/auth-state.js +18 -0
  234. package/{tools → utils}/find-notes-files-diff.js +6 -3
  235. package/{tools → utils}/index.d.ts +5 -1
  236. package/{tools → utils}/index.js +5 -1
  237. package/utils/join-path.d.ts +1 -0
  238. package/utils/join-path.js +13 -0
  239. package/utils/nullable-guards.d.ts +2 -0
  240. package/utils/nullable-guards.js +6 -0
  241. package/utils/to-absolute-path.d.ts +2 -0
  242. package/utils/to-absolute-path.js +2 -0
  243. package/utils/to-error.d.ts +6 -0
  244. package/utils/to-error.js +33 -0
  245. package/utils/toml.d.ts +3 -0
  246. package/utils/toml.js +31 -0
  247. package/utils/with-root.d.ts +1 -0
  248. package/utils/with-root.js +6 -0
  249. package/websocket/client.d.ts +24 -0
  250. package/websocket/client.js +83 -0
  251. package/models/file-tree.d.ts +0 -12
  252. package/tools/__tests__/join.spec.js +0 -24
  253. package/tools/join-path.d.ts +0 -1
  254. package/tools/join-path.js +0 -7
  255. package/tools/mock-server.d.ts +0 -1
  256. package/tools/mock-server.js +0 -12
  257. /package/models/{file-cache.js → buffer-store.js} +0 -0
  258. /package/models/{file-tree.js → buffer.js} +0 -0
  259. /package/{tools/__tests__/find-files-diff.spec.d.ts → models/colors.js} +0 -0
  260. /package/{tools/__tests__/find-note-files-diff.spec.d.ts → models/commands-group-store.js} +0 -0
  261. /package/{tools/__tests__/get-file-name.spec.d.ts → models/commands-store.js} +0 -0
  262. /package/{tools/__tests__/get-string-path.spec.d.ts → models/completion-store.js} +0 -0
  263. /package/{tools/__tests__/is-gpg-encrypted.spec.d.ts → models/config-store.js} +0 -0
  264. /package/{tools/__tests__/is-org-file.spec.d.ts → models/confirmation-modal.js} +0 -0
  265. /package/{tools/__tests__/join.spec.d.ts → models/context-menu-store.js} +0 -0
  266. /package/{tools/__tests__/parent-folder.spec.d.ts → models/cron-store.js} +0 -0
  267. /package/{tools/__tests__/read-org-files-recursively.spec.d.ts → models/cron-task.js} +0 -0
  268. /package/{tools/__tests__/split-path.spec.d.ts → models/css-utils.js} +0 -0
  269. /package/{tools → utils}/__tests__/get-file-name.spec.js +0 -0
  270. /package/{tools → utils}/__tests__/get-string-path.spec.js +0 -0
  271. /package/{tools → utils}/__tests__/is-gpg-encrypted.spec.js +0 -0
  272. /package/{tools → utils}/__tests__/is-org-file.spec.js +0 -0
  273. /package/{tools → utils}/__tests__/parent-folder.spec.js +0 -0
  274. /package/{tools → utils}/__tests__/read-org-files-recursively.spec.js +0 -0
  275. /package/{tools → utils}/__tests__/split-path.spec.js +0 -0
  276. /package/{tools → utils}/find-notes-files-diff.d.ts +0 -0
  277. /package/{tools → utils}/get-file-name.d.ts +0 -0
  278. /package/{tools → utils}/get-file-name.js +0 -0
  279. /package/{tools → utils}/get-parent-dir.d.ts +0 -0
  280. /package/{tools → utils}/get-parent-dir.js +0 -0
  281. /package/{tools → utils}/get-string-path.d.ts +0 -0
  282. /package/{tools → utils}/get-string-path.js +0 -0
  283. /package/{tools → utils}/is-gpg-encrypted.d.ts +0 -0
  284. /package/{tools → utils}/is-gpg-encrypted.js +0 -0
  285. /package/{tools → utils}/is-org-file.d.ts +0 -0
  286. /package/{tools → utils}/is-org-file.js +0 -0
  287. /package/{tools → utils}/split-path.d.ts +0 -0
  288. /package/{tools → utils}/split-path.js +0 -0
@@ -0,0 +1,6 @@
1
+ import type { Result } from 'neverthrow';
2
+ import { ResultAsync } from 'neverthrow';
3
+ type MapperOrMsg<E> = ((e: unknown) => E) | string;
4
+ export declare function to<R, TThis = unknown, A extends any[] = any[], E = Error>(fn: (this: TThis, ...args: A) => Promise<R>, mapErrorOrMsg?: MapperOrMsg<E>): (this: TThis, ...args: A) => ResultAsync<R, E>;
5
+ export declare function to<R, TThis = unknown, A extends any[] = any[], E = Error>(fn: (this: TThis, ...args: A) => R, mapErrorOrMsg?: MapperOrMsg<E>): (this: TThis, ...args: A) => Result<R, E>;
6
+ export {};
@@ -0,0 +1,33 @@
1
+ import { ResultAsync, ok, err } from 'neverthrow';
2
+ import { isPresent } from "./nullable-guards.js";
3
+ const defaultToError = (e) => (e instanceof Error ? e : new Error(String(e)));
4
+ function isPromiseLike(x) {
5
+ return (typeof x === 'object' &&
6
+ isPresent(x) &&
7
+ 'then' in x &&
8
+ typeof x.then === 'function');
9
+ }
10
+ function resolveMapper(map) {
11
+ if (typeof map === 'function')
12
+ return map;
13
+ if (typeof map === 'string') {
14
+ const msg = map;
15
+ return (e) => new Error(msg, { cause: e instanceof Error ? e : new Error(String(e)) });
16
+ }
17
+ return defaultToError;
18
+ }
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ export function to(fn, mapErrorOrMsg) {
21
+ const mapError = resolveMapper(mapErrorOrMsg);
22
+ return function (...args) {
23
+ try {
24
+ const out = fn.apply(this, args);
25
+ if (isPromiseLike(out))
26
+ return ResultAsync.fromPromise(out, mapError);
27
+ return ok(out);
28
+ }
29
+ catch (e) {
30
+ return err(mapError(e));
31
+ }
32
+ };
33
+ }
@@ -0,0 +1,3 @@
1
+ import { BaseIssue, BaseSchema, InferOutput } from 'valibot';
2
+ export declare function parseToml<T = unknown, S extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | undefined = undefined>(content: string, schema?: S): S extends BaseSchema<unknown, unknown, BaseIssue<unknown>> ? InferOutput<S> : T;
3
+ export declare function stringifyToml(data: unknown): string;
package/utils/toml.js ADDED
@@ -0,0 +1,31 @@
1
+ import { parse, stringify } from 'smol-toml';
2
+ import { safeParse } from 'valibot';
3
+ export function parseToml(content, schema) {
4
+ try {
5
+ const res = parse(content);
6
+ if (!schema) {
7
+ return res;
8
+ }
9
+ const validationResult = safeParse(schema, res);
10
+ if (validationResult.success) {
11
+ return validationResult.output;
12
+ }
13
+ throw new TypeError('Invalid config format', {
14
+ cause: validationResult.issues,
15
+ });
16
+ }
17
+ catch (e) {
18
+ if (e instanceof TypeError) {
19
+ throw e;
20
+ }
21
+ throw new SyntaxError('Invalid TOML format', { cause: e });
22
+ }
23
+ }
24
+ export function stringifyToml(data) {
25
+ try {
26
+ return stringify(data);
27
+ }
28
+ catch (e) {
29
+ throw new Error('Failed to stringify TOML', { cause: e });
30
+ }
31
+ }
@@ -0,0 +1 @@
1
+ export declare function withRoot(path: string): string;
@@ -0,0 +1,6 @@
1
+ export function withRoot(path) {
2
+ if (path.startsWith('/')) {
3
+ return path;
4
+ }
5
+ return `/${path}`;
6
+ }
@@ -0,0 +1,24 @@
1
+ import { Logger } from '../models/logger.js';
2
+ export interface WebSocketEvent<T = unknown> {
3
+ type: string;
4
+ payload: T;
5
+ }
6
+ export type EventHandler<T = unknown> = (payload: T) => void;
7
+ export declare class WebSocketClient {
8
+ private readonly url;
9
+ private readonly logger;
10
+ private readonly webSocketImpl?;
11
+ private socket;
12
+ private handlers;
13
+ private token;
14
+ socketId: string | null;
15
+ constructor(url: string, logger: Logger, webSocketImpl?: unknown);
16
+ connect(token: string): void;
17
+ disconnect(): void;
18
+ on<T>(type: string, handler: EventHandler<T>): void;
19
+ off<T>(type: string, handler: EventHandler<T>): void;
20
+ private onOpen;
21
+ private onMessage;
22
+ private onClose;
23
+ private onError;
24
+ }
@@ -0,0 +1,83 @@
1
+ import ReconnectingWebSocket from 'partysocket/ws';
2
+ export class WebSocketClient {
3
+ url;
4
+ logger;
5
+ webSocketImpl;
6
+ socket = null;
7
+ handlers = new Map();
8
+ token = null;
9
+ socketId = null;
10
+ constructor(url, logger, webSocketImpl) {
11
+ this.url = url;
12
+ this.logger = logger;
13
+ this.webSocketImpl = webSocketImpl;
14
+ }
15
+ connect(token) {
16
+ if (this.socket && this.token === token && this.socket.readyState === this.socket.OPEN) {
17
+ return;
18
+ }
19
+ if (this.socket) {
20
+ this.disconnect();
21
+ }
22
+ this.token = token;
23
+ if (!this.socketId) {
24
+ this.socketId = crypto.randomUUID();
25
+ }
26
+ const url = `${this.url}?token=${this.token}&socket_id=${this.socketId}`;
27
+ try {
28
+ this.socket = new ReconnectingWebSocket(url, [], {
29
+ WebSocket: this.webSocketImpl,
30
+ });
31
+ this.socket.addEventListener('open', this.onOpen.bind(this));
32
+ this.socket.addEventListener('message', this.onMessage.bind(this));
33
+ this.socket.addEventListener('close', this.onClose.bind(this));
34
+ this.socket.addEventListener('error', this.onError.bind(this));
35
+ }
36
+ catch (e) {
37
+ this.logger.error('WebSocket connection failed', e);
38
+ }
39
+ }
40
+ disconnect() {
41
+ if (this.socket) {
42
+ this.socket.close();
43
+ this.socket = null;
44
+ }
45
+ }
46
+ on(type, handler) {
47
+ if (!this.handlers.has(type)) {
48
+ this.handlers.set(type, []);
49
+ }
50
+ this.handlers.get(type)?.push(handler);
51
+ }
52
+ off(type, handler) {
53
+ const handlers = this.handlers.get(type);
54
+ if (!handlers) {
55
+ return;
56
+ }
57
+ const index = handlers.indexOf(handler);
58
+ if (index !== -1) {
59
+ handlers.splice(index, 1);
60
+ }
61
+ }
62
+ onOpen() {
63
+ this.logger.info('WebSocket connected');
64
+ }
65
+ onMessage(event) {
66
+ try {
67
+ const data = JSON.parse(event.data);
68
+ const handlers = this.handlers.get(data.type);
69
+ if (handlers) {
70
+ handlers.forEach((h) => h(data.payload));
71
+ }
72
+ }
73
+ catch (e) {
74
+ this.logger.error('Failed to parse WebSocket message', e);
75
+ }
76
+ }
77
+ onClose() {
78
+ this.logger.info('WebSocket disconnected');
79
+ }
80
+ onError(event) {
81
+ this.logger.error('WebSocket error', event);
82
+ }
83
+ }
@@ -1,12 +0,0 @@
1
- export interface FileNode {
2
- name: string;
3
- id?: string;
4
- filePath: string[];
5
- type: 'file' | 'directory';
6
- meta?: {
7
- color?: string;
8
- icon?: string;
9
- [key: string]: unknown;
10
- };
11
- children?: FileNode[];
12
- }
@@ -1,24 +0,0 @@
1
- import { test, expect } from 'vitest';
2
- import { join } from "../join-path.js";
3
- test('Should join file paths', () => {
4
- const samples = [
5
- ['dir1', 'subdir2', 'file'],
6
- ['dir2/', '/file'],
7
- ['/dri3', 'subdir2/', 'file'],
8
- ['file'],
9
- ];
10
- samples.forEach((sample) => {
11
- const result = join(...sample);
12
- expect(result).toMatchSnapshot();
13
- });
14
- });
15
- test('Should not take slashes from the path array into account.', () => {
16
- const path = ['/', 'this', '/', 'is-path', 'qwe'];
17
- const result = join(...path);
18
- expect(result).toBe('this/is-path/qwe');
19
- });
20
- test('Should not join empty string with additional slash', () => {
21
- const path = ['', 'file'];
22
- const result = join(...path);
23
- expect(result).toBe('file');
24
- });
@@ -1 +0,0 @@
1
- export declare function join(...path: string[]): string;
@@ -1,7 +0,0 @@
1
- export function join(...path) {
2
- return path
3
- .filter((p) => p !== '/' && p)
4
- .join('/')
5
- .replace(/\/+/g, '/')
6
- .replace(/\/+$/, '');
7
- }
@@ -1 +0,0 @@
1
- export declare const mockServer: <T extends (...params: any[]) => any>(fn?: T, defaultValue?: ReturnType<T>) => (...params: Parameters<T>) => ReturnType<T>;
@@ -1,12 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- export const mockServer = (fn, defaultValue) => {
3
- if (!fn) {
4
- return (() => { });
5
- }
6
- return (...params) => {
7
- if (process.env.CLIENT) {
8
- return fn(...params);
9
- }
10
- return defaultValue;
11
- };
12
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes