tauri-plugin-mongoose 0.2.4 → 0.2.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/index.d.mts CHANGED
@@ -60,7 +60,35 @@ 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>;
84
+ interface CreateUserOptions {
85
+ username: string;
86
+ password: string;
87
+ db: string;
88
+ roles: MongoDBRole[];
89
+ }
90
+ declare function createUser(options: CreateUserOptions): Promise<{
91
+ ok: number;
92
+ }>;
65
93
 
66
- export { type ConnectCallbacks, type ConnectOptions, type InferSchemaType, Model, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect };
94
+ export { type ConnectCallbacks, type ConnectOptions, type CreateUserOptions, type InferSchemaType, Model, type MongoDBRole, type MongoDBUser, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect, createUser, getUser, getUsers };
package/dist/index.d.ts CHANGED
@@ -60,7 +60,35 @@ 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>;
84
+ interface CreateUserOptions {
85
+ username: string;
86
+ password: string;
87
+ db: string;
88
+ roles: MongoDBRole[];
89
+ }
90
+ declare function createUser(options: CreateUserOptions): Promise<{
91
+ ok: number;
92
+ }>;
65
93
 
66
- export { type ConnectCallbacks, type ConnectOptions, type InferSchemaType, Model, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect };
94
+ export { type ConnectCallbacks, type ConnectOptions, type CreateUserOptions, type InferSchemaType, Model, type MongoDBRole, type MongoDBUser, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect, createUser, getUser, getUsers };
package/dist/index.js CHANGED
@@ -21,7 +21,10 @@ 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
+ createUser: () => createUser,
26
+ getUser: () => getUser,
27
+ getUsers: () => getUsers
25
28
  });
26
29
  module.exports = __toCommonJS(index_exports);
27
30
  var import_core2 = require("@tauri-apps/api/core");
@@ -168,8 +171,20 @@ async function connect(urlOrOptions, dbNameOrCallbacks, callbacks) {
168
171
  throw error;
169
172
  }
170
173
  }
174
+ async function getUsers() {
175
+ return await (0, import_core2.invoke)("plugin:mongoose|get_users");
176
+ }
177
+ async function getUser(username, db) {
178
+ return await (0, import_core2.invoke)("plugin:mongoose|get_user", { username, db });
179
+ }
180
+ async function createUser(options) {
181
+ return await (0, import_core2.invoke)("plugin:mongoose|create_db_user", { ...options });
182
+ }
171
183
  // Annotate the CommonJS export names for ESM import in node:
172
184
  0 && (module.exports = {
173
185
  Model,
174
- connect
186
+ connect,
187
+ createUser,
188
+ getUser,
189
+ getUsers
175
190
  });
package/dist/index.mjs CHANGED
@@ -143,7 +143,19 @@ 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
+ }
152
+ async function createUser(options) {
153
+ return await invoke2("plugin:mongoose|create_db_user", { ...options });
154
+ }
146
155
  export {
147
156
  Model,
148
- connect
157
+ connect,
158
+ createUser,
159
+ getUser,
160
+ getUsers
149
161
  };
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.7",
4
4
  "description": "Tauri plugin for MongoDB/Mongoose-like database operations",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",