tauri-plugin-mongoose 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -60,7 +60,26 @@ interface ConnectCallbacks {
60
60
  onSuccess?: () => void;
61
61
  onError?: (error: string) => void;
62
62
  }
63
+ interface MongoDBRole {
64
+ role: string;
65
+ db: string;
66
+ }
67
+ interface MongoDBUser {
68
+ _id: string;
69
+ userId: {
70
+ $binary: {
71
+ base64: string;
72
+ subType: string;
73
+ };
74
+ };
75
+ user: string;
76
+ db: string;
77
+ roles: MongoDBRole[];
78
+ mechanisms?: string[];
79
+ }
63
80
  declare function connect(options: ConnectOptions, callbacks?: ConnectCallbacks): Promise<void>;
64
81
  declare function connect(url: string, dbName?: string, callbacks?: ConnectCallbacks): Promise<void>;
82
+ declare function getUsers(): Promise<MongoDBUser[]>;
83
+ declare function getUser(username: string, db?: string): Promise<MongoDBUser | null>;
65
84
 
66
- export { type ConnectCallbacks, type ConnectOptions, type InferSchemaType, Model, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect };
85
+ export { type ConnectCallbacks, type ConnectOptions, type InferSchemaType, Model, type MongoDBRole, type MongoDBUser, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect, getUser, getUsers };
package/dist/index.d.ts CHANGED
@@ -60,7 +60,26 @@ interface ConnectCallbacks {
60
60
  onSuccess?: () => void;
61
61
  onError?: (error: string) => void;
62
62
  }
63
+ interface MongoDBRole {
64
+ role: string;
65
+ db: string;
66
+ }
67
+ interface MongoDBUser {
68
+ _id: string;
69
+ userId: {
70
+ $binary: {
71
+ base64: string;
72
+ subType: string;
73
+ };
74
+ };
75
+ user: string;
76
+ db: string;
77
+ roles: MongoDBRole[];
78
+ mechanisms?: string[];
79
+ }
63
80
  declare function connect(options: ConnectOptions, callbacks?: ConnectCallbacks): Promise<void>;
64
81
  declare function connect(url: string, dbName?: string, callbacks?: ConnectCallbacks): Promise<void>;
82
+ declare function getUsers(): Promise<MongoDBUser[]>;
83
+ declare function getUser(username: string, db?: string): Promise<MongoDBUser | null>;
65
84
 
66
- export { type ConnectCallbacks, type ConnectOptions, type InferSchemaType, Model, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect };
85
+ export { type ConnectCallbacks, type ConnectOptions, type InferSchemaType, Model, type MongoDBRole, type MongoDBUser, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect, getUser, getUsers };
package/dist/index.js CHANGED
@@ -21,7 +21,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  Model: () => Model,
24
- connect: () => connect
24
+ connect: () => connect,
25
+ getUser: () => getUser,
26
+ getUsers: () => getUsers
25
27
  });
26
28
  module.exports = __toCommonJS(index_exports);
27
29
  var import_core2 = require("@tauri-apps/api/core");
@@ -168,8 +170,16 @@ async function connect(urlOrOptions, dbNameOrCallbacks, callbacks) {
168
170
  throw error;
169
171
  }
170
172
  }
173
+ async function getUsers() {
174
+ return await (0, import_core2.invoke)("plugin:mongoose|get_users");
175
+ }
176
+ async function getUser(username, db) {
177
+ return await (0, import_core2.invoke)("plugin:mongoose|get_user", { username, db });
178
+ }
171
179
  // Annotate the CommonJS export names for ESM import in node:
172
180
  0 && (module.exports = {
173
181
  Model,
174
- connect
182
+ connect,
183
+ getUser,
184
+ getUsers
175
185
  });
package/dist/index.mjs CHANGED
@@ -143,7 +143,15 @@ async function connect(urlOrOptions, dbNameOrCallbacks, callbacks) {
143
143
  throw error;
144
144
  }
145
145
  }
146
+ async function getUsers() {
147
+ return await invoke2("plugin:mongoose|get_users");
148
+ }
149
+ async function getUser(username, db) {
150
+ return await invoke2("plugin:mongoose|get_user", { username, db });
151
+ }
146
152
  export {
147
153
  Model,
148
- connect
154
+ connect,
155
+ getUser,
156
+ getUsers
149
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tauri-plugin-mongoose",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Tauri plugin for MongoDB/Mongoose-like database operations",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",