@instantdb/admin
Advanced tools
Comparing version 0.14.10 to 0.14.11
@@ -171,2 +171,19 @@ import { tx, lookup, i, id, type TransactionChunk, type AuthToken, type Exactly, type User, type Query, type QueryResponse, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantSchemaDatabase, type InstantObject, type InstantEntity, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes } from "@instantdb/core"; | ||
/** | ||
* Generates a magic code for the user with the given email, used to sign in on the frontend. | ||
* This is useful for writing custom auth flows. | ||
* | ||
* @example | ||
* try { | ||
* const user = await db.auth.generateMagicCode({ email }) | ||
* // send an email to user with magic code | ||
* } catch (err) { | ||
* console.error("Failed to generate magic code:", err.message); | ||
* } | ||
* | ||
* @see https://instantdb.com/docs/backend#generate-magic-code | ||
*/ | ||
generateMagicCode: (email: string) => Promise<{ | ||
code: string; | ||
}>; | ||
/** | ||
* Creates a login token for the user with the given email. | ||
@@ -173,0 +190,0 @@ * If that user does not exist, we create one. |
@@ -261,2 +261,23 @@ "use strict"; | ||
/** | ||
* Generates a magic code for the user with the given email, used to sign in on the frontend. | ||
* This is useful for writing custom auth flows. | ||
* | ||
* @example | ||
* try { | ||
* const user = await db.auth.generateMagicCode({ email }) | ||
* // send an email to user with magic code | ||
* } catch (err) { | ||
* console.error("Failed to generate magic code:", err.message); | ||
* } | ||
* | ||
* @see https://instantdb.com/docs/backend#generate-magic-code | ||
*/ | ||
this.generateMagicCode = (email) => __awaiter(this, void 0, void 0, function* () { | ||
return jsonFetch(`${this.config.apiURI}/admin/magic_code`, { | ||
method: "POST", | ||
headers: authorizedHeaders(this.config), | ||
body: JSON.stringify({ email }), | ||
}); | ||
}); | ||
/** | ||
* Creates a login token for the user with the given email. | ||
@@ -263,0 +284,0 @@ * If that user does not exist, we create one. |
@@ -171,2 +171,19 @@ import { tx, lookup, i, id, type TransactionChunk, type AuthToken, type Exactly, type User, type Query, type QueryResponse, type InstaQLQueryParams, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantSchemaDatabase, type InstantObject, type InstantEntity, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes } from "@instantdb/core"; | ||
/** | ||
* Generates a magic code for the user with the given email, used to sign in on the frontend. | ||
* This is useful for writing custom auth flows. | ||
* | ||
* @example | ||
* try { | ||
* const user = await db.auth.generateMagicCode({ email }) | ||
* // send an email to user with magic code | ||
* } catch (err) { | ||
* console.error("Failed to generate magic code:", err.message); | ||
* } | ||
* | ||
* @see https://instantdb.com/docs/backend#generate-magic-code | ||
*/ | ||
generateMagicCode: (email: string) => Promise<{ | ||
code: string; | ||
}>; | ||
/** | ||
* Creates a login token for the user with the given email. | ||
@@ -173,0 +190,0 @@ * If that user does not exist, we create one. |
@@ -252,2 +252,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
/** | ||
* Generates a magic code for the user with the given email, used to sign in on the frontend. | ||
* This is useful for writing custom auth flows. | ||
* | ||
* @example | ||
* try { | ||
* const user = await db.auth.generateMagicCode({ email }) | ||
* // send an email to user with magic code | ||
* } catch (err) { | ||
* console.error("Failed to generate magic code:", err.message); | ||
* } | ||
* | ||
* @see https://instantdb.com/docs/backend#generate-magic-code | ||
*/ | ||
this.generateMagicCode = (email) => __awaiter(this, void 0, void 0, function* () { | ||
return jsonFetch(`${this.config.apiURI}/admin/magic_code`, { | ||
method: "POST", | ||
headers: authorizedHeaders(this.config), | ||
body: JSON.stringify({ email }), | ||
}); | ||
}); | ||
/** | ||
* Creates a login token for the user with the given email. | ||
@@ -254,0 +275,0 @@ * If that user does not exist, we create one. |
{ | ||
"name": "@instantdb/admin", | ||
"version": "v0.14.10", | ||
"version": "v0.14.11", | ||
"description": "Admin SDK for Instant DB", | ||
@@ -28,4 +28,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@instantdb/core": "v0.14.10" | ||
"@instantdb/core": "v0.14.11" | ||
} | ||
} |
@@ -379,2 +379,24 @@ import { | ||
/** | ||
* Generates a magic code for the user with the given email, used to sign in on the frontend. | ||
* This is useful for writing custom auth flows. | ||
* | ||
* @example | ||
* try { | ||
* const user = await db.auth.generateMagicCode({ email }) | ||
* // send an email to user with magic code | ||
* } catch (err) { | ||
* console.error("Failed to generate magic code:", err.message); | ||
* } | ||
* | ||
* @see https://instantdb.com/docs/backend#generate-magic-code | ||
*/ | ||
generateMagicCode = async (email: string): Promise<{ code: string }> => { | ||
return jsonFetch(`${this.config.apiURI}/admin/magic_code`, { | ||
method: "POST", | ||
headers: authorizedHeaders(this.config), | ||
body: JSON.stringify({ email }), | ||
}); | ||
}; | ||
/** | ||
* Creates a login token for the user with the given email. | ||
@@ -381,0 +403,0 @@ * If that user does not exist, we create one. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
151555
2328
Updated@instantdb/core@v0.14.11