tauri-plugin-mongoose 0.2.5 → 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
@@ -81,5 +81,14 @@ declare function connect(options: ConnectOptions, callbacks?: ConnectCallbacks):
81
81
  declare function connect(url: string, dbName?: string, callbacks?: ConnectCallbacks): Promise<void>;
82
82
  declare function getUsers(): Promise<MongoDBUser[]>;
83
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
+ }>;
84
93
 
85
- export { type ConnectCallbacks, type ConnectOptions, type InferSchemaType, Model, type MongoDBRole, type MongoDBUser, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect, getUser, getUsers };
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
@@ -81,5 +81,14 @@ declare function connect(options: ConnectOptions, callbacks?: ConnectCallbacks):
81
81
  declare function connect(url: string, dbName?: string, callbacks?: ConnectCallbacks): Promise<void>;
82
82
  declare function getUsers(): Promise<MongoDBUser[]>;
83
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
+ }>;
84
93
 
85
- export { type ConnectCallbacks, type ConnectOptions, type InferSchemaType, Model, type MongoDBRole, type MongoDBUser, type Schema, type SchemaItem, type SchemaTypes, type TypeMap, connect, getUser, getUsers };
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
@@ -22,6 +22,7 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  Model: () => Model,
24
24
  connect: () => connect,
25
+ createUser: () => createUser,
25
26
  getUser: () => getUser,
26
27
  getUsers: () => getUsers
27
28
  });
@@ -176,10 +177,14 @@ async function getUsers() {
176
177
  async function getUser(username, db) {
177
178
  return await (0, import_core2.invoke)("plugin:mongoose|get_user", { username, db });
178
179
  }
180
+ async function createUser(options) {
181
+ return await (0, import_core2.invoke)("plugin:mongoose|create_db_user", { ...options });
182
+ }
179
183
  // Annotate the CommonJS export names for ESM import in node:
180
184
  0 && (module.exports = {
181
185
  Model,
182
186
  connect,
187
+ createUser,
183
188
  getUser,
184
189
  getUsers
185
190
  });
package/dist/index.mjs CHANGED
@@ -149,9 +149,13 @@ async function getUsers() {
149
149
  async function getUser(username, db) {
150
150
  return await invoke2("plugin:mongoose|get_user", { username, db });
151
151
  }
152
+ async function createUser(options) {
153
+ return await invoke2("plugin:mongoose|create_db_user", { ...options });
154
+ }
152
155
  export {
153
156
  Model,
154
157
  connect,
158
+ createUser,
155
159
  getUser,
156
160
  getUsers
157
161
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tauri-plugin-mongoose",
3
- "version": "0.2.5",
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",