commit
a27f98e644
@ -0,0 +1,5 @@
|
||||
# Order is important; the last matching pattern takes the most precedence.
|
||||
* @tauri-apps/plugin-maintainers
|
||||
|
||||
# Currently CI/CD for plugins are in heavy flux, and the plugin team manages it themselves.
|
||||
# .github @tauri-apps/wg-devops
|
@ -1,2 +1,3 @@
|
||||
target
|
||||
node_modules
|
||||
dist
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -1,7 +0,0 @@
|
||||
export declare class Authenticator {
|
||||
init(): Promise<void>;
|
||||
register(challenge: string, application: string): Promise<string>;
|
||||
verifyRegistration(challenge: string, application: string, registerData: string, clientData: string): Promise<string>;
|
||||
sign(challenge: string, application: string, keyHandle: string): Promise<string>;
|
||||
verifySignature(challenge: string, application: string, signData: string, clientData: string, keyHandle: string, pubkey: string): Promise<number>;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
class Authenticator {
|
||||
async init() {
|
||||
return await c("plugin:authenticator|init");
|
||||
}
|
||||
async register(challenge, application) {
|
||||
return await c("plugin:authenticator|register", {
|
||||
timeout: 10000,
|
||||
challenge,
|
||||
application,
|
||||
});
|
||||
}
|
||||
async verifyRegistration(challenge, application, registerData, clientData) {
|
||||
return await c("plugin:authenticator|verify_registration", {
|
||||
challenge,
|
||||
application,
|
||||
registerData,
|
||||
clientData,
|
||||
});
|
||||
}
|
||||
async sign(challenge, application, keyHandle) {
|
||||
return await c("plugin:authenticator|sign", {
|
||||
timeout: 10000,
|
||||
challenge,
|
||||
application,
|
||||
keyHandle,
|
||||
});
|
||||
}
|
||||
async verifySignature(challenge, application, signData, clientData, keyHandle, pubkey) {
|
||||
return await c("plugin:authenticator|verify_signature", {
|
||||
challenge,
|
||||
application,
|
||||
signData,
|
||||
clientData,
|
||||
keyHandle,
|
||||
pubkey,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Authenticator };
|
||||
//# sourceMappingURL=index.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`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C,EAAE;YAC9D,SAAS;YACT,WAAW;YACX,YAAY;YACZ,UAAU;AACX,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,IAAI,CACR,SAAiB,EACjB,WAAmB,EACnB,SAAiB,EAAA;AAEjB,QAAA,OAAO,MAAMA,CAAM,CAAC,2BAA2B,EAAE;AAC/C,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;YACX,SAAS;AACV,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,eAAe,CACnB,SAAiB,EACjB,WAAmB,EACnB,QAAgB,EAChB,UAAkB,EAClB,SAAiB,EACjB,MAAc,EAAA;AAEd,QAAA,OAAO,MAAMA,CAAM,CAAC,uCAAuC,EAAE;YAC3D,SAAS;YACT,WAAW;YACX,QAAQ;YACR,UAAU;YACV,SAAS;YACT,MAAM;AACP,SAAA,CAAC,CAAC;KACJ;AACF;;;;"}
|
@ -1,43 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
class Authenticator {
|
||||
async init() {
|
||||
return await invoke("plugin:authenticator|init");
|
||||
}
|
||||
async register(challenge, application) {
|
||||
return await invoke("plugin:authenticator|register", {
|
||||
timeout: 10000,
|
||||
challenge,
|
||||
application,
|
||||
});
|
||||
}
|
||||
async verifyRegistration(challenge, application, registerData, clientData) {
|
||||
return await invoke("plugin:authenticator|verify_registration", {
|
||||
challenge,
|
||||
application,
|
||||
registerData,
|
||||
clientData,
|
||||
});
|
||||
}
|
||||
async sign(challenge, application, keyHandle) {
|
||||
return await invoke("plugin:authenticator|sign", {
|
||||
timeout: 10000,
|
||||
challenge,
|
||||
application,
|
||||
keyHandle,
|
||||
});
|
||||
}
|
||||
async verifySignature(challenge, application, signData, clientData, keyHandle, pubkey) {
|
||||
return await invoke("plugin:authenticator|verify_signature", {
|
||||
challenge,
|
||||
application,
|
||||
signData,
|
||||
clientData,
|
||||
keyHandle,
|
||||
pubkey,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Authenticator };
|
||||
//# sourceMappingURL=index.mjs.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;MAEa,aAAa,CAAA;AACxB,IAAA,MAAM,IAAI,GAAA;AACR,QAAA,OAAO,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;KAClD;AAED,IAAA,MAAM,QAAQ,CAAC,SAAiB,EAAE,WAAmB,EAAA;AACnD,QAAA,OAAO,MAAM,MAAM,CAAC,+BAA+B,EAAE;AACnD,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;AACZ,SAAA,CAAC,CAAC;KACJ;IAED,MAAM,kBAAkB,CACtB,SAAiB,EACjB,WAAmB,EACnB,YAAoB,EACpB,UAAkB,EAAA;AAElB,QAAA,OAAO,MAAM,MAAM,CAAC,0CAA0C,EAAE;YAC9D,SAAS;YACT,WAAW;YACX,YAAY;YACZ,UAAU;AACX,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,IAAI,CACR,SAAiB,EACjB,WAAmB,EACnB,SAAiB,EAAA;AAEjB,QAAA,OAAO,MAAM,MAAM,CAAC,2BAA2B,EAAE;AAC/C,YAAA,OAAO,EAAE,KAAK;YACd,SAAS;YACT,WAAW;YACX,SAAS;AACV,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,MAAM,eAAe,CACnB,SAAiB,EACjB,WAAmB,EACnB,QAAgB,EAChB,UAAkB,EAClB,SAAiB,EACjB,MAAc,EAAA;AAEd,QAAA,OAAO,MAAM,MAAM,CAAC,uCAAuC,EAAE;YAC3D,SAAS;YACT,WAAW;YACX,QAAQ;YACR,UAAU;YACV,SAAS;YACT,MAAM;AACP,SAAA,CAAC,CAAC;KACJ;AACF;;;;"}
|
@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "tauri-plugin-authenticator-api",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT or APACHE-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
},
|
||||
"files": [
|
||||
"guest-js/dist",
|
||||
"!guest-js/dist/**/*.map",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.2.0"
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -1,3 +0,0 @@
|
||||
export declare function isEnabled(): Promise<boolean>;
|
||||
export declare function enable(): Promise<void>;
|
||||
export declare function disable(): Promise<void>;
|
@ -1,17 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
async function isEnabled() {
|
||||
return await c("plugin:autostart|is_enabled");
|
||||
}
|
||||
async function enable() {
|
||||
await c("plugin:autostart|enable");
|
||||
}
|
||||
async function disable() {
|
||||
await c("plugin:autostart|disable");
|
||||
}
|
||||
|
||||
export { disable, enable, isEnabled };
|
||||
//# sourceMappingURL=index.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encode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Programme within The Commons Conservancy
|
||||
async function isEnabled() {
|
||||
return await invoke("plugin:autostart|is_enabled");
|
||||
}
|
||||
async function enable() {
|
||||
await invoke("plugin:autostart|enable");
|
||||
}
|
||||
async function disable() {
|
||||
await invoke("plugin:autostart|disable");
|
||||
}
|
||||
|
||||
export { disable, enable, isEnabled };
|
||||
//# sourceMappingURL=index.mjs.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAMO,eAAe,SAAS,GAAA;AAC7B,IAAA,OAAO,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;AACrD,CAAC;AAEM,eAAe,MAAM,GAAA;AAC1B,IAAA,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAC1C,CAAC;AAEM,eAAe,OAAO,GAAA;AAC3B,IAAA,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC3C;;;;"}
|
@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
@ -1,8 +1,9 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -1,87 +0,0 @@
|
||||
export interface Permissions {
|
||||
/**
|
||||
* `true` if these permissions describe a readonly (unwritable) file.
|
||||
*/
|
||||
readonly: boolean;
|
||||
/**
|
||||
* The underlying raw `st_mode` bits that contain the standard Unix permissions for this file.
|
||||
*/
|
||||
mode: number | undefined;
|
||||
}
|
||||
/**
|
||||
* Metadata information about a file.
|
||||
* This structure is returned from the `metadata` function or method
|
||||
* and represents known metadata about a file such as its permissions, size, modification times, etc.
|
||||
*/
|
||||
export interface Metadata {
|
||||
/**
|
||||
* The last access time of this metadata.
|
||||
*/
|
||||
accessedAt: Date;
|
||||
/**
|
||||
* The creation time listed in this metadata.
|
||||
*/
|
||||
createdAt: Date;
|
||||
/**
|
||||
* The last modification time listed in this metadata.
|
||||
*/
|
||||
modifiedAt: Date;
|
||||
/**
|
||||
* `true` if this metadata is for a directory.
|
||||
*/
|
||||
isDir: boolean;
|
||||
/**
|
||||
* `true` if this metadata is for a regular file.
|
||||
*/
|
||||
isFile: boolean;
|
||||
/**
|
||||
* `true` if this metadata is for a symbolic link.
|
||||
*/
|
||||
isSymlink: boolean;
|
||||
/**
|
||||
* The size of the file, in bytes, this metadata is for.
|
||||
*/
|
||||
size: number;
|
||||
/**
|
||||
* The permissions of the file this metadata is for.
|
||||
*/
|
||||
permissions: Permissions;
|
||||
/**
|
||||
* The ID of the device containing the file. Only available on Unix.
|
||||
*/
|
||||
dev: number | undefined;
|
||||
/**
|
||||
* The inode number. Only available on Unix.
|
||||
*/
|
||||
ino: number | undefined;
|
||||
/**
|
||||
* The rights applied to this file. Only available on Unix.
|
||||
*/
|
||||
mode: number | undefined;
|
||||
/**
|
||||
* The number of hard links pointing to this file. Only available on Unix.
|
||||
*/
|
||||
nlink: number | undefined;
|
||||
/**
|
||||
* The user ID of the owner of this file. Only available on Unix.
|
||||
*/
|
||||
uid: number | undefined;
|
||||
/**
|
||||
* The group ID of the owner of this file. Only available on Unix.
|
||||
*/
|
||||
gid: number | undefined;
|
||||
/**
|
||||
* The device ID of this file (if it is a special one). Only available on Unix.
|
||||
*/
|
||||
rdev: number | undefined;
|
||||
/**
|
||||
* The block size for filesystem I/O. Only available on Unix.
|
||||
*/
|
||||
blksize: number | undefined;
|
||||
/**
|
||||
* The number of blocks allocated to the file, in 512-byte units. Only available on Unix.
|
||||
*/
|
||||
blocks: number | undefined;
|
||||
}
|
||||
export declare function metadata(path: string): Promise<Metadata>;
|
||||
export declare function exists(path: string): Promise<boolean>;
|
@ -1,24 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
async function metadata(path) {
|
||||
return await c("plugin:fs-extra|metadata", {
|
||||
path,
|
||||
}).then((metadata) => {
|
||||
const { accessedAtMs, createdAtMs, modifiedAtMs, ...data } = metadata;
|
||||
return {
|
||||
accessedAt: new Date(accessedAtMs),
|
||||
createdAt: new Date(createdAtMs),
|
||||
modifiedAt: new Date(modifiedAtMs),
|
||||
...data,
|
||||
};
|
||||
});
|
||||
}
|
||||
async function exists(path) {
|
||||
return await c("plugin:fs-extra|exists", { path });
|
||||
}
|
||||
|
||||
export { exists, metadata };
|
||||
//# sourceMappingURL=index.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,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C,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;;ACAtuB;AAiHO,eAAe,QAAQ,CAAC,IAAY,EAAA;AACzC,IAAA,OAAO,MAAMC,CAAM,CAAkB,0BAA0B,EAAE;QAC/D,IAAI;AACL,KAAA,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAI;AACnB,QAAA,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACtE,OAAO;AACL,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,SAAS,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC;AAChC,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,GAAG,IAAI;SACR,CAAC;AACJ,KAAC,CAAC,CAAC;AACL,CAAC;AAEM,eAAe,MAAM,CAAC,IAAY,EAAA;IACvC,OAAO,MAAMA,CAAM,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1D;;;;"}
|
@ -1,22 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||
async function metadata(path) {
|
||||
return await invoke("plugin:fs-extra|metadata", {
|
||||
path,
|
||||
}).then((metadata) => {
|
||||
const { accessedAtMs, createdAtMs, modifiedAtMs, ...data } = metadata;
|
||||
return {
|
||||
accessedAt: new Date(accessedAtMs),
|
||||
createdAt: new Date(createdAtMs),
|
||||
modifiedAt: new Date(modifiedAtMs),
|
||||
...data,
|
||||
};
|
||||
});
|
||||
}
|
||||
async function exists(path) {
|
||||
return await invoke("plugin:fs-extra|exists", { path });
|
||||
}
|
||||
|
||||
export { exists, metadata };
|
||||
//# sourceMappingURL=index.mjs.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAiHO,eAAe,QAAQ,CAAC,IAAY,EAAA;AACzC,IAAA,OAAO,MAAM,MAAM,CAAkB,0BAA0B,EAAE;QAC/D,IAAI;AACL,KAAA,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAI;AACnB,QAAA,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QACtE,OAAO;AACL,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,SAAS,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC;AAChC,YAAA,UAAU,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;AAClC,YAAA,GAAG,IAAI;SACR,CAAC;AACJ,KAAC,CAAC,CAAC;AACL,CAAC;AAEM,eAAe,MAAM,CAAC,IAAY,EAAA;IACvC,OAAO,MAAM,MAAM,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1D;;;;"}
|
@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
@ -1,8 +1,9 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -1,45 +0,0 @@
|
||||
import { UnlistenFn } from "@tauri-apps/api/event";
|
||||
export interface WatchOptions {
|
||||
recursive?: boolean;
|
||||
}
|
||||
export interface DebouncedWatchOptions extends WatchOptions {
|
||||
delayMs?: number;
|
||||
}
|
||||
export interface RawEvent {
|
||||
path: string | null;
|
||||
operation: number;
|
||||
cookie: number | null;
|
||||
}
|
||||
export type DebouncedEvent = {
|
||||
type: "NoticeWrite";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "NoticeRemove";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Create";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Write";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Chmod";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Remove";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Rename";
|
||||
payload: string;
|
||||
} | {
|
||||
type: "Rescan";
|
||||
payload: null;
|
||||
} | {
|
||||
type: "Error";
|
||||
payload: {
|
||||
error: string;
|
||||
path: string | null;
|
||||
};
|
||||
};
|
||||
export declare function watch(paths: string | string[], options: DebouncedWatchOptions, cb: (event: DebouncedEvent) => void): Promise<UnlistenFn>;
|
||||
export declare function watchImmediate(paths: string | string[], options: WatchOptions, cb: (event: RawEvent) => void): Promise<UnlistenFn>;
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,64 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
import { appWindow } from '@tauri-apps/api/window';
|
||||
|
||||
const w = appWindow;
|
||||
async function unwatch(id) {
|
||||
await invoke("plugin:fs-watch|unwatch", { id });
|
||||
}
|
||||
async function watch(paths, options, cb) {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
delayMs: 2000,
|
||||
...options,
|
||||
};
|
||||
let watchPaths;
|
||||
if (typeof paths === "string") {
|
||||
watchPaths = [paths];
|
||||
}
|
||||
else {
|
||||
watchPaths = paths;
|
||||
}
|
||||
const id = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
await invoke("plugin:fs-watch|watch", {
|
||||
id,
|
||||
paths: watchPaths,
|
||||
options: opts,
|
||||
});
|
||||
const unlisten = await w.listen(`watcher://debounced-event/${id}`, (event) => {
|
||||
cb(event.payload);
|
||||
});
|
||||
return () => {
|
||||
void unwatch(id);
|
||||
unlisten();
|
||||
};
|
||||
}
|
||||
async function watchImmediate(paths, options, cb) {
|
||||
const opts = {
|
||||
recursive: false,
|
||||
...options,
|
||||
delayMs: null,
|
||||
};
|
||||
let watchPaths;
|
||||
if (typeof paths === "string") {
|
||||
watchPaths = [paths];
|
||||
}
|
||||
else {
|
||||
watchPaths = paths;
|
||||
}
|
||||
const id = window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
await invoke("plugin:fs-watch|watch", {
|
||||
id,
|
||||
paths: watchPaths,
|
||||
options: opts,
|
||||
});
|
||||
const unlisten = await w.listen(`watcher://raw-event/${id}`, (event) => {
|
||||
cb(event.payload);
|
||||
});
|
||||
return () => {
|
||||
void unwatch(id);
|
||||
unlisten();
|
||||
};
|
||||
}
|
||||
|
||||
export { watch, watchImmediate };
|
||||
//# sourceMappingURL=index.mjs.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA,MAAM,CAAC,GAAkB,SAAS,CAAC;AA2BnC,eAAe,OAAO,CAAC,EAAU,EAAA;IAC/B,MAAM,MAAM,CAAC,yBAAyB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC;AAEM,eAAe,KAAK,CACzB,KAAwB,EACxB,OAA8B,EAC9B,EAAmC,EAAA;AAEnC,IAAA,MAAM,IAAI,GAAG;AACX,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,GAAG,OAAO;KACX,CAAC;AACF,IAAA,IAAI,UAAU,CAAC;AACf,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,QAAA,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,KAAA;AAAM,SAAA;QACL,UAAU,GAAG,KAAK,CAAC;AACpB,KAAA;AAED,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CA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,CAAC,KAAK,KAAI;AACR,QAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACpB,KAAC,CACF,CAAC;AAEF,IAAA,OAAO,MAAK;AACV,QAAA,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC;AACjB,QAAA,QAAQ,EAAE,CAAC;AACb,KAAC,CAAC;AACJ;;;;"}
|
@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
@ -1,8 +1,9 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -1,25 +1,86 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Configurable logging for your Tauri app.
|
||||
|
||||
## Install
|
||||
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
|
||||
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-log
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-log
|
||||
# or
|
||||
yarn add https://github.com/tauri-apps/tauri-plugin-log
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
use tauri_plugin_log::{LogTarget};
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_log::Builder::default().targets([
|
||||
LogTarget::LogDir,
|
||||
LogTarget::Stdout,
|
||||
LogTarget::Webview,
|
||||
]).build())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { trace, info, error, attachConsole } from 'tauri-plugin-log-api'
|
||||
|
||||
// with LogTarget::Webview enabled this function will print logs to the browser console
|
||||
const detach = await attachConsole()
|
||||
|
||||
trace("Trace")
|
||||
info("Info")
|
||||
error("Error")
|
||||
|
||||
// detach the browser console from the log stream
|
||||
detach()
|
||||
```
|
||||
|
||||
To log from rust code, add the log crate to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
log = "^0.4"
|
||||
```
|
||||
|
||||
Now, you can use the macros provided by the log crate to log messages from your backend. See the [docs](https://docs.rs/log/latest) for more details.
|
||||
|
||||
## Contributing
|
||||
|
||||
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
@ -1,87 +0,0 @@
|
||||
import { UnlistenFn } from "@tauri-apps/api/event";
|
||||
export type LogOptions = {
|
||||
file?: string;
|
||||
line?: number;
|
||||
} & Record<string, string | undefined>;
|
||||
/**
|
||||
* Logs a message at the error level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { error } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const err_info = "No connection";
|
||||
* const port = 22;
|
||||
*
|
||||
* error(`Error: ${err_info} on port ${port}`);
|
||||
* ```
|
||||
*/
|
||||
export declare function error(message: string, options?: LogOptions): Promise<void>;
|
||||
/**
|
||||
* Logs a message at the warn level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { warn } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const warn_description = "Invalid Input";
|
||||
*
|
||||
* warn(`Warning! {warn_description}!`);
|
||||
* ```
|
||||
*/
|
||||
export declare function warn(message: string, options?: LogOptions): Promise<void>;
|
||||
/**
|
||||
* Logs a message at the info level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { info } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const conn_info = { port: 40, speed: 3.20 };
|
||||
*
|
||||
* info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`);
|
||||
* ```
|
||||
*/
|
||||
export declare function info(message: string, options?: LogOptions): Promise<void>;
|
||||
/**
|
||||
* Logs a message at the debug level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { debug } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* debug(`New position: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
export declare function debug(message: string, options?: LogOptions): Promise<void>;
|
||||
/**
|
||||
* Logs a message at the trace level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { trace } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* let pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* trace(`Position is: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
export declare function trace(message: string, options?: LogOptions): Promise<void>;
|
||||
export declare function attachConsole(): Promise<UnlistenFn>;
|
@ -1,180 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c$1,transformCallback:()=>s$1});function u$1(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s$1(e,r=!1){let n=u$1(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c$1(e,r={}){return new Promise((n,t)=>{let o=s$1(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s$1(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
async function a(i){return c$1("tauri",i)}
|
||||
|
||||
var W={};e(W,{TauriEvent:()=>c,emit:()=>D,listen:()=>E,once:()=>_});async function s(n,t){return a({__tauriModule:"Event",message:{cmd:"unlisten",event:n,eventId:t}})}async function m(n,t,i){await a({__tauriModule:"Event",message:{cmd:"emit",event:n,windowLabel:t,payload:i}});}async function o(n,t,i){return a({__tauriModule:"Event",message:{cmd:"listen",event:n,windowLabel:t,handler:s$1(i)}}).then(r=>async()=>s(n,r))}async function u(n,t,i){return o(n,t,r=>{i(r),s(n,r.id).catch(()=>{});})}var c=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e.CHECK_UPDATE="tauri://update",e.UPDATE_AVAILABLE="tauri://update-available",e.INSTALL_UPDATE="tauri://update-install",e.STATUS_UPDATE="tauri://update-status",e.DOWNLOAD_PROGRESS="tauri://update-download-progress",e))(c||{});async function E(n,t){return o(n,null,t)}async function _(n,t){return u(n,null,t)}async function D(n,t){return m(n,void 0,t)}
|
||||
|
||||
var LogLevel;
|
||||
(function (LogLevel) {
|
||||
/**
|
||||
* The "trace" level.
|
||||
*
|
||||
* Designates very low priority, often extremely verbose, information.
|
||||
*/
|
||||
LogLevel[LogLevel["Trace"] = 1] = "Trace";
|
||||
/**
|
||||
* The "debug" level.
|
||||
*
|
||||
* Designates lower priority information.
|
||||
*/
|
||||
LogLevel[LogLevel["Debug"] = 2] = "Debug";
|
||||
/**
|
||||
* The "info" level.
|
||||
*
|
||||
* Designates useful information.
|
||||
*/
|
||||
LogLevel[LogLevel["Info"] = 3] = "Info";
|
||||
/**
|
||||
* The "warn" level.
|
||||
*
|
||||
* Designates hazardous situations.
|
||||
*/
|
||||
LogLevel[LogLevel["Warn"] = 4] = "Warn";
|
||||
/**
|
||||
* The "error" level.
|
||||
*
|
||||
* Designates very serious errors.
|
||||
*/
|
||||
LogLevel[LogLevel["Error"] = 5] = "Error";
|
||||
})(LogLevel || (LogLevel = {}));
|
||||
async function log(level, message, options) {
|
||||
var _a, _b;
|
||||
const traces = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.split("\n").map((line) => line.split("@"));
|
||||
const filtered = traces === null || traces === void 0 ? void 0 : traces.filter(([name, location]) => {
|
||||
return name.length > 0 && location !== "[native code]";
|
||||
});
|
||||
const { file, line, ...keyValues } = options !== null && options !== void 0 ? options : {};
|
||||
await c$1("plugin:log|log", {
|
||||
level,
|
||||
message,
|
||||
location: (_b = filtered === null || filtered === void 0 ? void 0 : filtered[0]) === null || _b === void 0 ? void 0 : _b.filter((v) => v.length > 0).join("@"),
|
||||
file,
|
||||
line,
|
||||
keyValues,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Logs a message at the error level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { error } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const err_info = "No connection";
|
||||
* const port = 22;
|
||||
*
|
||||
* error(`Error: ${err_info} on port ${port}`);
|
||||
* ```
|
||||
*/
|
||||
async function error(message, options) {
|
||||
await log(LogLevel.Error, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the warn level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { warn } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const warn_description = "Invalid Input";
|
||||
*
|
||||
* warn(`Warning! {warn_description}!`);
|
||||
* ```
|
||||
*/
|
||||
async function warn(message, options) {
|
||||
await log(LogLevel.Warn, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the info level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { info } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const conn_info = { port: 40, speed: 3.20 };
|
||||
*
|
||||
* info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`);
|
||||
* ```
|
||||
*/
|
||||
async function info(message, options) {
|
||||
await log(LogLevel.Info, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the debug level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { debug } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* debug(`New position: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
async function debug(message, options) {
|
||||
await log(LogLevel.Debug, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the trace level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { trace } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* let pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* trace(`Position is: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
async function trace(message, options) {
|
||||
await log(LogLevel.Trace, message, options);
|
||||
}
|
||||
async function attachConsole() {
|
||||
return await E("log://log", (event) => {
|
||||
const payload = event.payload;
|
||||
// Strip ANSI escape codes
|
||||
const message = payload.message.replace(
|
||||
// eslint-disable-next-line no-control-regex
|
||||
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
||||
switch (payload.level) {
|
||||
case LogLevel.Trace:
|
||||
console.log(message);
|
||||
break;
|
||||
case LogLevel.Debug:
|
||||
console.debug(message);
|
||||
break;
|
||||
case LogLevel.Info:
|
||||
console.info(message);
|
||||
break;
|
||||
case LogLevel.Warn:
|
||||
console.warn(message);
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
console.error(message);
|
||||
break;
|
||||
default:
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
throw new Error(`unknown log level ${payload.level}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { attachConsole, debug, error, info, trace, warn };
|
||||
//# sourceMappingURL=index.min.js.map
|
File diff suppressed because one or more lines are too long
@ -1,175 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
|
||||
var LogLevel;
|
||||
(function (LogLevel) {
|
||||
/**
|
||||
* The "trace" level.
|
||||
*
|
||||
* Designates very low priority, often extremely verbose, information.
|
||||
*/
|
||||
LogLevel[LogLevel["Trace"] = 1] = "Trace";
|
||||
/**
|
||||
* The "debug" level.
|
||||
*
|
||||
* Designates lower priority information.
|
||||
*/
|
||||
LogLevel[LogLevel["Debug"] = 2] = "Debug";
|
||||
/**
|
||||
* The "info" level.
|
||||
*
|
||||
* Designates useful information.
|
||||
*/
|
||||
LogLevel[LogLevel["Info"] = 3] = "Info";
|
||||
/**
|
||||
* The "warn" level.
|
||||
*
|
||||
* Designates hazardous situations.
|
||||
*/
|
||||
LogLevel[LogLevel["Warn"] = 4] = "Warn";
|
||||
/**
|
||||
* The "error" level.
|
||||
*
|
||||
* Designates very serious errors.
|
||||
*/
|
||||
LogLevel[LogLevel["Error"] = 5] = "Error";
|
||||
})(LogLevel || (LogLevel = {}));
|
||||
async function log(level, message, options) {
|
||||
var _a, _b;
|
||||
const traces = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.split("\n").map((line) => line.split("@"));
|
||||
const filtered = traces === null || traces === void 0 ? void 0 : traces.filter(([name, location]) => {
|
||||
return name.length > 0 && location !== "[native code]";
|
||||
});
|
||||
const { file, line, ...keyValues } = options !== null && options !== void 0 ? options : {};
|
||||
await invoke("plugin:log|log", {
|
||||
level,
|
||||
message,
|
||||
location: (_b = filtered === null || filtered === void 0 ? void 0 : filtered[0]) === null || _b === void 0 ? void 0 : _b.filter((v) => v.length > 0).join("@"),
|
||||
file,
|
||||
line,
|
||||
keyValues,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Logs a message at the error level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { error } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const err_info = "No connection";
|
||||
* const port = 22;
|
||||
*
|
||||
* error(`Error: ${err_info} on port ${port}`);
|
||||
* ```
|
||||
*/
|
||||
async function error(message, options) {
|
||||
await log(LogLevel.Error, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the warn level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { warn } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const warn_description = "Invalid Input";
|
||||
*
|
||||
* warn(`Warning! {warn_description}!`);
|
||||
* ```
|
||||
*/
|
||||
async function warn(message, options) {
|
||||
await log(LogLevel.Warn, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the info level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { info } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const conn_info = { port: 40, speed: 3.20 };
|
||||
*
|
||||
* info(`Connected to port {conn_info.port} at {conn_info.speed} Mb/s`);
|
||||
* ```
|
||||
*/
|
||||
async function info(message, options) {
|
||||
await log(LogLevel.Info, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the debug level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { debug } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* const pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* debug(`New position: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
async function debug(message, options) {
|
||||
await log(LogLevel.Debug, message, options);
|
||||
}
|
||||
/**
|
||||
* Logs a message at the trace level.
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* ```js
|
||||
* import { trace } from 'tauri-plugin-log-api';
|
||||
*
|
||||
* let pos = { x: 3.234, y: -1.223 };
|
||||
*
|
||||
* trace(`Position is: x: {pos.x}, y: {pos.y}`);
|
||||
* ```
|
||||
*/
|
||||
async function trace(message, options) {
|
||||
await log(LogLevel.Trace, message, options);
|
||||
}
|
||||
async function attachConsole() {
|
||||
return await listen("log://log", (event) => {
|
||||
const payload = event.payload;
|
||||
// Strip ANSI escape codes
|
||||
const message = payload.message.replace(
|
||||
// eslint-disable-next-line no-control-regex
|
||||
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
||||
switch (payload.level) {
|
||||
case LogLevel.Trace:
|
||||
console.log(message);
|
||||
break;
|
||||
case LogLevel.Debug:
|
||||
console.debug(message);
|
||||
break;
|
||||
case LogLevel.Info:
|
||||
console.info(message);
|
||||
break;
|
||||
case LogLevel.Warn:
|
||||
console.warn(message);
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
console.error(message);
|
||||
break;
|
||||
default:
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
throw new Error(`unknown log level ${payload.level}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export { attachConsole, debug, error, info, trace, warn };
|
||||
//# sourceMappingURL=index.mjs.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAQA,IAAK,QA+BJ,CAAA;AA/BD,CAAA,UAAK,QAAQ,EAAA;AACX;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAS,CAAA;AACT;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACL;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACJ;;;;AAIG;AACH,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK,CAAA;AACP,CAAC,EA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K,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;YACR,KAAK,QAAQ,CAAC,IAAI;AAChB,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,QAAQ,CAAC,IAAI;AAChB,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,QAAQ,CAAC,KAAK;AACjB,gBAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvB,MAAM;AACR,YAAA;;gBAEE,MAAM,IAAI,KAAK,CAAC,CAAA,kBAAA,EAAqB,OAAO,CAAC,KAAK,CAAE,CAAA,CAAC,CAAC;AACzD,SAAA;AACH,KAAC,CAAC,CAAC;AACL;;;;"}
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "tauri-plugin-log",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT or APACHE-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"!dist/**/*.map",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"devDependencies": {
|
||||
"tslib": "^2.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.2.0"
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
@ -1,18 +1,18 @@
|
||||
{
|
||||
"name": "tauri-plugin-authenticator-api",
|
||||
"name": "tauri-plugin-log-api",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT or APACHE-2.0",
|
||||
"authors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"type": "module",
|
||||
"browser": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"browser": "guest-js/dist/index.min.js",
|
||||
"module": "guest-js/dist/index.mjs",
|
||||
"types": "guest-js/dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./dist/index.min.js"
|
||||
"import": "./guest-js/dist/index.mjs",
|
||||
"types": "./guest-js/dist/index.d.ts",
|
||||
"browser": "./guest-js/dist/index.min.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c"
|
@ -0,0 +1,11 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
@ -1,25 +1,45 @@
|
||||

|
||||
|
||||
<!-- description -->
|
||||
Save filesystem and asset scopes and restore them when the app is reopened.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
There are three general methods of installation that we can recommend.
|
||||
|
||||
1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
|
||||
2. Pull sources directly from Github using git tags / revision hashes (most secure)
|
||||
3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
|
||||
|
||||
Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
`src-tauri/Cargo.toml`
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
First you need to register the core plugin with Tauri:
|
||||
|
||||
`src-tauri/src/main.rs`
|
||||
```rust
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_persisted_scope::init())
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
```
|
||||
|
||||
Afterwards the plugin will automatically save and restore filesystem and asset scopes.
|
||||
|
||||
## Contributing
|
||||
|
||||
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
||||
|
||||
## License
|
||||
|
||||
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -1,27 +0,0 @@
|
||||
/**
|
||||
* Well known window positions.
|
||||
*/
|
||||
export declare enum Position {
|
||||
TopLeft = 0,
|
||||
TopRight = 1,
|
||||
BottomLeft = 2,
|
||||
BottomRight = 3,
|
||||
TopCenter = 4,
|
||||
BottomCenter = 5,
|
||||
LeftCenter = 6,
|
||||
RightCenter = 7,
|
||||
Center = 8,
|
||||
TrayLeft = 9,
|
||||
TrayBottomLeft = 10,
|
||||
TrayRight = 11,
|
||||
TrayBottomRight = 12,
|
||||
TrayCenter = 13,
|
||||
TrayBottomCenter = 14
|
||||
}
|
||||
/**
|
||||
* Moves the `Window` to the given {@link Position} using `WindowExt.move_window()`
|
||||
* All positions are relative to the **current** screen.
|
||||
*
|
||||
* @param to The {@link Position} to move to.
|
||||
*/
|
||||
export declare function moveWindow(to: Position): Promise<void>;
|
@ -1,40 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
// Copyright 2021 Jonas Kruckenberg
|
||||
/**
|
||||
* Well known window positions.
|
||||
*/
|
||||
var Position;
|
||||
(function (Position) {
|
||||
Position[Position["TopLeft"] = 0] = "TopLeft";
|
||||
Position[Position["TopRight"] = 1] = "TopRight";
|
||||
Position[Position["BottomLeft"] = 2] = "BottomLeft";
|
||||
Position[Position["BottomRight"] = 3] = "BottomRight";
|
||||
Position[Position["TopCenter"] = 4] = "TopCenter";
|
||||
Position[Position["BottomCenter"] = 5] = "BottomCenter";
|
||||
Position[Position["LeftCenter"] = 6] = "LeftCenter";
|
||||
Position[Position["RightCenter"] = 7] = "RightCenter";
|
||||
Position[Position["Center"] = 8] = "Center";
|
||||
Position[Position["TrayLeft"] = 9] = "TrayLeft";
|
||||
Position[Position["TrayBottomLeft"] = 10] = "TrayBottomLeft";
|
||||
Position[Position["TrayRight"] = 11] = "TrayRight";
|
||||
Position[Position["TrayBottomRight"] = 12] = "TrayBottomRight";
|
||||
Position[Position["TrayCenter"] = 13] = "TrayCenter";
|
||||
Position[Position["TrayBottomCenter"] = 14] = "TrayBottomCenter";
|
||||
})(Position || (Position = {}));
|
||||
/**
|
||||
* Moves the `Window` to the given {@link Position} using `WindowExt.move_window()`
|
||||
* All positions are relative to the **current** screen.
|
||||
*
|
||||
* @param to The {@link Position} to move to.
|
||||
*/
|
||||
async function moveWindow(to) {
|
||||
await c("plugin:positioner|move_window", {
|
||||
position: to,
|
||||
});
|
||||
}
|
||||
|
||||
export { Position, moveWindow };
|
||||
//# sourceMappingURL=index.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CA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A,CAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM,CAAA;AACN,IAAA,QAAA,CAAA,QAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,gBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAc,CAAA;AACd,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,EAAA,CAAA,GAAA,WAAS,CAAA;AACT,IAAA,QAAA,CAAA,QAAA,CAAA,iBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,iBAAe,CAAA;AACf,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,EAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,kBAAgB,CAAA;AAClB,CAAC,EAhBW,QAAQ,KAAR,QAAQ,GAgBnB,EAAA,CAAA,CAAA,CAAA;AAED;;;;;AAKG;AACI,eAAe,UAAU,CAAC,EAAY,EAAA;IAC3C,MAAMC,CAAM,CAAC,+BAA+B,EAAE;AAC5C,QAAA,QAAQ,EAAE,EAAE;AACb,KAAA,CAAC,CAAC;AACL;;;;"}
|
@ -1,38 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
// Copyright 2021 Jonas Kruckenberg
|
||||
/**
|
||||
* Well known window positions.
|
||||
*/
|
||||
var Position;
|
||||
(function (Position) {
|
||||
Position[Position["TopLeft"] = 0] = "TopLeft";
|
||||
Position[Position["TopRight"] = 1] = "TopRight";
|
||||
Position[Position["BottomLeft"] = 2] = "BottomLeft";
|
||||
Position[Position["BottomRight"] = 3] = "BottomRight";
|
||||
Position[Position["TopCenter"] = 4] = "TopCenter";
|
||||
Position[Position["BottomCenter"] = 5] = "BottomCenter";
|
||||
Position[Position["LeftCenter"] = 6] = "LeftCenter";
|
||||
Position[Position["RightCenter"] = 7] = "RightCenter";
|
||||
Position[Position["Center"] = 8] = "Center";
|
||||
Position[Position["TrayLeft"] = 9] = "TrayLeft";
|
||||
Position[Position["TrayBottomLeft"] = 10] = "TrayBottomLeft";
|
||||
Position[Position["TrayRight"] = 11] = "TrayRight";
|
||||
Position[Position["TrayBottomRight"] = 12] = "TrayBottomRight";
|
||||
Position[Position["TrayCenter"] = 13] = "TrayCenter";
|
||||
Position[Position["TrayBottomCenter"] = 14] = "TrayBottomCenter";
|
||||
})(Position || (Position = {}));
|
||||
/**
|
||||
* Moves the `Window` to the given {@link Position} using `WindowExt.move_window()`
|
||||
* All positions are relative to the **current** screen.
|
||||
*
|
||||
* @param to The {@link Position} to move to.
|
||||
*/
|
||||
async function moveWindow(to) {
|
||||
await invoke("plugin:positioner|move_window", {
|
||||
position: to,
|
||||
});
|
||||
}
|
||||
|
||||
export { Position, moveWindow };
|
||||
//# sourceMappingURL=index.mjs.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AAKA;;AAEG;IACS,SAgBX;AAhBD,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,QAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAW,CAAA;AACX,IAAA,QAAA,CAAA,QAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAQ,CAAA;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAW,CAAA;AACX,IAAA,QAAA,CAAA,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createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
@ -0,0 +1,11 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -1,95 +0,0 @@
|
||||
export interface QueryResult {
|
||||
/** The number of rows affected by the query. */
|
||||
rowsAffected: number;
|
||||
/**
|
||||
* The last inserted `id`.
|
||||
*
|
||||
* This value is always `0` when using the Postgres driver. If the
|
||||
* last inserted id is required on Postgres, the `select` function
|
||||
* must be used, with a `RETURNING` clause
|
||||
* (`INSERT INTO todos (title) VALUES ($1) RETURNING id`).
|
||||
*/
|
||||
lastInsertId: number;
|
||||
}
|
||||
/**
|
||||
* **Database**
|
||||
*
|
||||
* The `Database` class serves as the primary interface for
|
||||
* communicating with the rust side of the sql plugin.
|
||||
*/
|
||||
export default class Database {
|
||||
path: string;
|
||||
constructor(path: string);
|
||||
/**
|
||||
* **load**
|
||||
*
|
||||
* A static initializer which connects to the underlying database and
|
||||
* returns a `Database` instance once a connection to the database is established.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = await Database.load("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static load(path: string): Promise<Database>;
|
||||
/**
|
||||
* **get**
|
||||
*
|
||||
* A static initializer which synchronously returns an instance of
|
||||
* the Database class while deferring the actual database connection
|
||||
* until the first invocation or selection on the database.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = Database.get("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static get(path: string): Database;
|
||||
/**
|
||||
* **execute**
|
||||
*
|
||||
* Passes a SQL expression to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.execute(
|
||||
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||
* [ todos.title, todos.status, todos.id ]
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
execute(query: string, bindValues?: unknown[]): Promise<QueryResult>;
|
||||
/**
|
||||
* **select**
|
||||
*
|
||||
* Passes in a SELECT query to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.select(
|
||||
* "SELECT * from todos WHERE id = $1", id
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
select<T>(query: string, bindValues?: unknown[]): Promise<T>;
|
||||
/**
|
||||
* **close**
|
||||
*
|
||||
* Closes the database connection pool.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const success = await db.close()
|
||||
* ```
|
||||
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
||||
*/
|
||||
close(db?: string): Promise<boolean>;
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0});};
|
||||
|
||||
var f={};e(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`);},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`);},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r});})}function w(e,r="asset"){let n=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}
|
||||
|
||||
/**
|
||||
* **Database**
|
||||
*
|
||||
* The `Database` class serves as the primary interface for
|
||||
* communicating with the rust side of the sql plugin.
|
||||
*/
|
||||
class Database {
|
||||
constructor(path) {
|
||||
this.path = path;
|
||||
}
|
||||
/**
|
||||
* **load**
|
||||
*
|
||||
* A static initializer which connects to the underlying database and
|
||||
* returns a `Database` instance once a connection to the database is established.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = await Database.load("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static async load(path) {
|
||||
const _path = await c("plugin:sql|load", {
|
||||
db: path,
|
||||
});
|
||||
return new Database(_path);
|
||||
}
|
||||
/**
|
||||
* **get**
|
||||
*
|
||||
* A static initializer which synchronously returns an instance of
|
||||
* the Database class while deferring the actual database connection
|
||||
* until the first invocation or selection on the database.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = Database.get("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static get(path) {
|
||||
return new Database(path);
|
||||
}
|
||||
/**
|
||||
* **execute**
|
||||
*
|
||||
* Passes a SQL expression to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.execute(
|
||||
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||
* [ todos.title, todos.status, todos.id ]
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async execute(query, bindValues) {
|
||||
const [rowsAffected, lastInsertId] = await c("plugin:sql|execute", {
|
||||
db: this.path,
|
||||
query,
|
||||
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
||||
});
|
||||
return {
|
||||
lastInsertId,
|
||||
rowsAffected,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* **select**
|
||||
*
|
||||
* Passes in a SELECT query to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.select(
|
||||
* "SELECT * from todos WHERE id = $1", id
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async select(query, bindValues) {
|
||||
const result = await c("plugin:sql|select", {
|
||||
db: this.path,
|
||||
query,
|
||||
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* **close**
|
||||
*
|
||||
* Closes the database connection pool.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const success = await db.close()
|
||||
* ```
|
||||
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
||||
*/
|
||||
async close(db) {
|
||||
const success = await c("plugin:sql|close", {
|
||||
db,
|
||||
});
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
export { Database as default };
|
||||
//# sourceMappingURL=index.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.min.js","sources":["../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-FEIY7W7S.js","../../../../node_modules/.pnpm/@tauri-apps+api@1.2.0/node_modules/@tauri-apps/api/chunk-RCPA6UVN.js","../index.ts"],"sourcesContent":["var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n","import{a as d}from\"./chunk-FEIY7W7S.js\";var f={};d(f,{convertFileSrc:()=>w,invoke:()=>c,transformCallback:()=>s});function u(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}function s(e,r=!1){let n=u(),t=`_${n}`;return Object.defineProperty(window,t,{value:o=>(r&&Reflect.deleteProperty(window,t),e==null?void 0:e(o)),writable:!1,configurable:!0}),n}async function c(e,r={}){return new Promise((n,t)=>{let o=s(i=>{n(i),Reflect.deleteProperty(window,`_${a}`)},!0),a=s(i=>{t(i),Reflect.deleteProperty(window,`_${o}`)},!0);window.__TAURI_IPC__({cmd:e,callback:o,error:a,...r})})}function w(e,r=\"asset\"){let n=encodeURIComponent(e);return navigator.userAgent.includes(\"Windows\")?`https://${r}.localhost/${n}`:`${r}://localhost/${n}`}export{s as a,c as b,w as c,f as d};\n",null],"names":["d","invoke"],"mappings":"AAAA,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC;;ACAjD,IAAI,CAAC,CAAC,EAAE,CAACA,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,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QAAA,MAAM,OAAO,GAAG,MAAMA,CAAM,CAAU,kBAAkB,EAAE;YACxD,EAAE;AACH,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,OAAO,CAAC;KAChB;AACF;;;;"}
|
@ -1,117 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
/**
|
||||
* **Database**
|
||||
*
|
||||
* The `Database` class serves as the primary interface for
|
||||
* communicating with the rust side of the sql plugin.
|
||||
*/
|
||||
class Database {
|
||||
constructor(path) {
|
||||
this.path = path;
|
||||
}
|
||||
/**
|
||||
* **load**
|
||||
*
|
||||
* A static initializer which connects to the underlying database and
|
||||
* returns a `Database` instance once a connection to the database is established.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = await Database.load("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static async load(path) {
|
||||
const _path = await invoke("plugin:sql|load", {
|
||||
db: path,
|
||||
});
|
||||
return new Database(_path);
|
||||
}
|
||||
/**
|
||||
* **get**
|
||||
*
|
||||
* A static initializer which synchronously returns an instance of
|
||||
* the Database class while deferring the actual database connection
|
||||
* until the first invocation or selection on the database.
|
||||
*
|
||||
* # Sqlite
|
||||
*
|
||||
* The path is relative to `tauri::api::path::BaseDirectory::App` and must start with `sqlite:`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const db = Database.get("sqlite:test.db");
|
||||
* ```
|
||||
*/
|
||||
static get(path) {
|
||||
return new Database(path);
|
||||
}
|
||||
/**
|
||||
* **execute**
|
||||
*
|
||||
* Passes a SQL expression to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.execute(
|
||||
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
||||
* [ todos.title, todos.status, todos.id ]
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async execute(query, bindValues) {
|
||||
const [rowsAffected, lastInsertId] = await invoke("plugin:sql|execute", {
|
||||
db: this.path,
|
||||
query,
|
||||
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
||||
});
|
||||
return {
|
||||
lastInsertId,
|
||||
rowsAffected,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* **select**
|
||||
*
|
||||
* Passes in a SELECT query to the database for execution.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const result = await db.select(
|
||||
* "SELECT * from todos WHERE id = $1", id
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
async select(query, bindValues) {
|
||||
const result = await invoke("plugin:sql|select", {
|
||||
db: this.path,
|
||||
query,
|
||||
values: bindValues !== null && bindValues !== void 0 ? bindValues : [],
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* **close**
|
||||
*
|
||||
* Closes the database connection pool.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const success = await db.close()
|
||||
* ```
|
||||
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
||||
*/
|
||||
async close(db) {
|
||||
const success = await invoke("plugin:sql|close", {
|
||||
db,
|
||||
});
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
export { Database as default };
|
||||
//# sourceMappingURL=index.mjs.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAgBA;;;;;AAKG;AACW,MAAO,QAAQ,CAAA;AAE3B,IAAA,WAAA,CAAY,IAAY,EAAA;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;AAED;;;;;;;;;;;;;;AAcG;AACH,IAAA,aAAa,IAAI,CAAC,IAAY,EAAA;AAC5B,QAAA,MAAM,KAAK,GAAG,MAAM,MAAM,CAAS,iBAAiB,EAAE;AACpD,YAAA,EAAE,EAAE,IAAI;AACT,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC5B;AAED;;;;;;;;;;;;;;;AAeG;IACH,OAAO,GAAG,CAAC,IAAY,EAAA;AACrB,QAAA,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC3B;AAED;;;;;;;;;;;;AAYG;AACH,IAAA,MAAM,OAAO,CAAC,KAAa,EAAE,UAAsB,EAAA;QACjD,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,MAAM,MAAM,CAC/C,oBAAoB,EACpB;YACE,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CACF,CAAC;QAEF,OAAO;YACL,YAAY;YACZ,YAAY;SACb,CAAC;KACH;AAED;;;;;;;;;;;AAWG;AACH,IAAA,MAAM,MAAM,CAAI,KAAa,EAAE,UAAsB,EAAA;AACnD,QAAA,MAAM,MAAM,GAAG,MAAM,MAAM,CAAI,mBAAmB,EAAE;YAClD,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,KAAK;AACL,YAAA,MAAM,EAAE,UAAU,KAAA,IAAA,IAAV,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,EAAE;AACzB,SAAA,CAAC,CAAC;AAEH,QAAA,OAAO,MAAM,CAAC;KACf;AAED;;;;;;;;;;AAUG;IACH,MAAM,KAAK,CAAC,EAAW,EAAA;AACrB,QAAA,MAAM,OAAO,GAAG,MAAM,MAAM,CAAU,kBAAkB,EAAE;YACxD,EAAE;AACH,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,OAAO,CAAC;KAChB;AACF;;;;"}
|
@ -1,10 +0,0 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
@ -1 +0,0 @@
|
||||
../../../shared/tsconfig.json
|
@ -0,0 +1,11 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
input: "guest-js/index.ts",
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
@ -0,0 +1 @@
|
||||
../../shared/tsconfig.json
|
@ -0,0 +1 @@
|
||||
node_modules
|
@ -1,105 +0,0 @@
|
||||
import { UnlistenFn } from "@tauri-apps/api/event";
|
||||
/**
|
||||
* A key-value store persisted by the backend layer.
|
||||
*/
|
||||
export declare class Store {
|
||||
path: string;
|
||||
constructor(path: string);
|
||||
/**
|
||||
* Inserts a key-value pair into the store.
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
set(key: string, value: unknown): Promise<void>;
|
||||
/**
|
||||
* Returns the value for the given `key` or `null` the key does not exist.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
get<T>(key: string): Promise<T | null>;
|
||||
/**
|
||||
* Returns `true` if the given `key` exists in the store.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
has(key: string): Promise<boolean>;
|
||||
/**
|
||||
* Removes a key-value pair from the store.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
delete(key: string): Promise<boolean>;
|
||||
/**
|
||||
* Clears the store, removing all key-value pairs.
|
||||
*
|
||||
* Note: To clear the storage and reset it to it's `default` value, use `reset` instead.
|
||||
* @returns
|
||||
*/
|
||||
clear(): Promise<void>;
|
||||
/**
|
||||
* Resets the store to it's `default` value.
|
||||
*
|
||||
* If no default value has been set, this method behaves identical to `clear`.
|
||||
* @returns
|
||||
*/
|
||||
reset(): Promise<void>;
|
||||
/**
|
||||
* Returns a list of all key in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
keys(): Promise<string[]>;
|
||||
/**
|
||||
* Returns a list of all values in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
values(): Promise<string[]>;
|
||||
/**
|
||||
* Returns a list of all entries in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
entries<T>(): Promise<Array<[key: string, value: T]>>;
|
||||
/**
|
||||
* Returns the number of key-value pairs in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
length(): Promise<string[]>;
|
||||
/**
|
||||
* Attempts to load the on-disk state at the stores `path` into memory.
|
||||
*
|
||||
* This method is useful if the on-disk state was edited by the user and you want to synchronize the changes.
|
||||
*
|
||||
* Note: This method does not emit change events.
|
||||
* @returns
|
||||
*/
|
||||
load(): Promise<void>;
|
||||
/**
|
||||
* Saves the store to disk at the stores `path`.
|
||||
*
|
||||
* As the store is only persistet to disk before the apps exit, changes might be lost in a crash.
|
||||
* This method let's you persist the store to disk whenever you deem necessary.
|
||||
* @returns
|
||||
*/
|
||||
save(): Promise<void>;
|
||||
/**
|
||||
* Listen to changes on a store key.
|
||||
* @param key
|
||||
* @param cb
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
*/
|
||||
onKeyChange<T>(key: string, cb: (value: T | null) => void): Promise<UnlistenFn>;
|
||||
/**
|
||||
* Listen to changes on the store.
|
||||
* @param cb
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
*/
|
||||
onChange(cb: (key: string, value: unknown) => void): Promise<UnlistenFn>;
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,177 +0,0 @@
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
import { appWindow } from '@tauri-apps/api/window';
|
||||
|
||||
// Copyright 2021 Tauri Programme within The Commons Conservancy
|
||||
/**
|
||||
* A key-value store persisted by the backend layer.
|
||||
*/
|
||||
class Store {
|
||||
constructor(path) {
|
||||
this.path = path;
|
||||
}
|
||||
/**
|
||||
* Inserts a key-value pair into the store.
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
async set(key, value) {
|
||||
return await invoke("plugin:store|set", {
|
||||
path: this.path,
|
||||
key,
|
||||
value,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns the value for the given `key` or `null` the key does not exist.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
async get(key) {
|
||||
return await invoke("plugin:store|get", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns `true` if the given `key` exists in the store.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
async has(key) {
|
||||
return await invoke("plugin:store|has", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Removes a key-value pair from the store.
|
||||
*
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
async delete(key) {
|
||||
return await invoke("plugin:store|delete", {
|
||||
path: this.path,
|
||||
key,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Clears the store, removing all key-value pairs.
|
||||
*
|
||||
* Note: To clear the storage and reset it to it's `default` value, use `reset` instead.
|
||||
* @returns
|
||||
*/
|
||||
async clear() {
|
||||
return await invoke("plugin:store|clear", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Resets the store to it's `default` value.
|
||||
*
|
||||
* If no default value has been set, this method behaves identical to `clear`.
|
||||
* @returns
|
||||
*/
|
||||
async reset() {
|
||||
return await invoke("plugin:store|reset", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of all key in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async keys() {
|
||||
return await invoke("plugin:store|keys", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of all values in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async values() {
|
||||
return await invoke("plugin:store|values", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of all entries in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async entries() {
|
||||
return await invoke("plugin:store|entries", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns the number of key-value pairs in the store.
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async length() {
|
||||
return await invoke("plugin:store|length", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Attempts to load the on-disk state at the stores `path` into memory.
|
||||
*
|
||||
* This method is useful if the on-disk state was edited by the user and you want to synchronize the changes.
|
||||
*
|
||||
* Note: This method does not emit change events.
|
||||
* @returns
|
||||
*/
|
||||
async load() {
|
||||
return await invoke("plugin:store|load", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Saves the store to disk at the stores `path`.
|
||||
*
|
||||
* As the store is only persisted to disk before the apps exit, changes might be lost in a crash.
|
||||
* This method lets you persist the store to disk whenever you deem necessary.
|
||||
* @returns
|
||||
*/
|
||||
async save() {
|
||||
return await invoke("plugin:store|save", {
|
||||
path: this.path,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Listen to changes on a store key.
|
||||
* @param key
|
||||
* @param cb
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
*/
|
||||
async onKeyChange(key, cb) {
|
||||
return await appWindow.listen("store://change", (event) => {
|
||||
if (event.payload.path === this.path && event.payload.key === key) {
|
||||
cb(event.payload.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Listen to changes on the store.
|
||||
* @param cb
|
||||
* @returns A promise resolving to a function to unlisten to the event.
|
||||
*/
|
||||
async onChange(cb) {
|
||||
return await appWindow.listen("store://change", (event) => {
|
||||
if (event.payload.path === this.path) {
|
||||
cb(event.payload.key, event.payload.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Store };
|
||||
//# sourceMappingURL=index.mjs.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;AAcA;;AAEG;MACU,KAAK,CAAA;AAEhB,IAAA,WAAA,CAAY,IAAY,EAAA;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;AAED;;;;;;AAMG;AACH,IAAA,MAAM,GAAG,CAAC,GAAW,EAAE,KAAc,EAAA;AACnC,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;YACH,KAAK;AACN,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,GAAG,CAAI,GAAW,EAAA;AACtB,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;AACJ,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,GAAG,CAAC,GAAW,EAAA;AACnB,QAAA,OAAO,MAAM,MAAM,CAAC,kBAAkB,EAAE;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;AACJ,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;IACH,MAAM,MAAM,CAAC,GAAW,EAAA;AACtB,QAAA,OAAO,MAAM,MAAM,CAAC,qBAAqB,EAAE;YACzC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG;AACJ,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;AACH,IAAA,MAAM,KAAK,GAAA;AACT,QAAA,OAAO,MAAM,MAAM,CAAC,oBAAoB,EAAE;YACxC,IAAI,EAAE,IAAI,CAAC,IAAI;AAChB,SAAA,CAAC,CAAC;KACJ;AAED;;;;;AAKG;AACH,IAAA,MAAM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;AACR,YAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,EAAE;AACjE,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACzB,aAAA;AACH,SAAC,CACF,CAAC;KACH;AAED;;;;AAIG;IACH,MAAM,QAAQ,CACZ,EAA0C,EAAA;QAE1C,OAAO,MAAM,SAAS,CAAC,MAAM,CAC3B,gBAAgB,EAChB,CAAC,KAAK,KAAI;YACR,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;AACpC,gBAAA,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5C,aAAA;AACH,SAAC,CACF,CAAC;KACH;AACF;;;;"}
|
@ -1,10 +0,0 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
import { createConfig } from "../../../shared/rollup.config.mjs";
|
||||
|
||||
export default createConfig({
|
||||
pkg: JSON.parse(
|
||||
readFileSync(new URL("./package.json", import.meta.url), "utf8")
|
||||
),
|
||||
external: [/^@tauri-apps\/api/],
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue