@proton-app/main 0.1.6 → 0.1.7
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/files.d.ts +3 -1
- package/dist/files.js +3 -1
- package/dist/storage.d.ts +13 -2
- package/package.json +1 -1
package/dist/files.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { BrowserWindow } from "electron";
|
|
1
|
+
import { app, BrowserWindow } from "electron";
|
|
2
2
|
type Props = {
|
|
3
3
|
window: BrowserWindow;
|
|
4
4
|
title: string;
|
|
5
5
|
defaultPath: "music";
|
|
6
6
|
};
|
|
7
7
|
export declare function choosePath({ window, title, defaultPath }: Props): Promise<string | null>;
|
|
8
|
+
type SystemFolder = Parameters<typeof app.getPath>[0];
|
|
9
|
+
export declare const getSystemPath: (folder: SystemFolder, ...segments: string[]) => string;
|
|
8
10
|
export declare const getUserDataPath: (...segments: string[]) => string;
|
|
9
11
|
export declare const getAppDataPath: (...segments: string[]) => string;
|
|
10
12
|
export {};
|
package/dist/files.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAppDataPath = exports.getUserDataPath = void 0;
|
|
3
|
+
exports.getAppDataPath = exports.getUserDataPath = exports.getSystemPath = void 0;
|
|
4
4
|
exports.choosePath = choosePath;
|
|
5
5
|
const electron_1 = require("electron");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -15,6 +15,8 @@ async function choosePath({ window, title, defaultPath }) {
|
|
|
15
15
|
return result.filePaths[0];
|
|
16
16
|
}
|
|
17
17
|
;
|
|
18
|
+
const getSystemPath = (folder, ...segments) => (0, path_1.join)(electron_1.app.getPath(folder), ...segments);
|
|
19
|
+
exports.getSystemPath = getSystemPath;
|
|
18
20
|
const getUserDataPath = (...segments) => (0, path_1.join)(electron_1.app.getPath("userData"), ...segments);
|
|
19
21
|
exports.getUserDataPath = getUserDataPath;
|
|
20
22
|
const getAppDataPath = (...segments) => (0, path_1.join)(electron_1.app.getPath("appData"), ...segments);
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import ElectronStore from "electron-store";
|
|
2
|
+
type JSONType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
2
3
|
type StorageSchema = Record<string, {
|
|
3
|
-
type:
|
|
4
|
+
type: JSONType | readonly JSONType[];
|
|
4
5
|
default: unknown;
|
|
5
6
|
}>;
|
|
6
7
|
type BaseStorage = {
|
|
7
8
|
access_token: string | null;
|
|
8
9
|
};
|
|
10
|
+
type TypeMap = {
|
|
11
|
+
string: string;
|
|
12
|
+
number: number;
|
|
13
|
+
integer: number;
|
|
14
|
+
boolean: boolean;
|
|
15
|
+
object: Record<string, unknown>;
|
|
16
|
+
array: unknown[];
|
|
17
|
+
null: null;
|
|
18
|
+
};
|
|
19
|
+
type FromType<T> = T extends readonly JSONType[] ? TypeMap[T[number]] : T extends JSONType ? TypeMap[T] : never;
|
|
9
20
|
type InferSchema<T extends StorageSchema> = BaseStorage & {
|
|
10
|
-
[K in Exclude<keyof T, keyof BaseStorage>]: T[K]["
|
|
21
|
+
[K in Exclude<keyof T, keyof BaseStorage>]: FromType<T[K]["type"]>;
|
|
11
22
|
};
|
|
12
23
|
export declare class Storage<const T extends StorageSchema> extends ElectronStore<InferSchema<T>> {
|
|
13
24
|
constructor(schema: T);
|