dexie-cloud-addon 4.3.3 → 4.3.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.
@@ -1,5 +1,5 @@
1
1
  import { DexieCloudOptions } from './DexieCloudOptions';
2
- import { DBRealmRole, DexieCloudSchema } from 'dexie-cloud-common';
2
+ import { DBRealmRole, DexieCloudSchema, AuthProvidersResponse } from 'dexie-cloud-common';
3
3
  import { UserLogin } from './db/entities/UserLogin';
4
4
  import { PersistedSyncState } from './db/entities/PersistedSyncState';
5
5
  import { SyncState } from './types/SyncState';
@@ -76,4 +76,15 @@ export interface DexieCloudAPI {
76
76
  * @param table Table name that the object was retrieved from
77
77
  */
78
78
  permissions<T>(obj: T, table: string): Observable<PermissionChecker<T, string>>;
79
+ /** Query available authentication providers from the server.
80
+ *
81
+ * Returns information about which OAuth providers are configured
82
+ * and whether OTP (email) authentication is enabled.
83
+ *
84
+ * Useful for apps that want to build their own login UI and show
85
+ * provider-specific buttons.
86
+ *
87
+ * @returns Promise resolving to available auth providers
88
+ */
89
+ getAuthProviders(): Promise<AuthProvidersResponse>;
79
90
  }
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.3.3, Thu Jan 22 2026
11
+ * Version 4.3.5, Fri Jan 23 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -1597,6 +1597,25 @@ function otpFetchTokenCallback(db) {
1597
1597
  public_key,
1598
1598
  };
1599
1599
  }
1600
+ else if ((hints === null || hints === void 0 ? void 0 : hints.grant_type) === 'otp' || (hints === null || hints === void 0 ? void 0 : hints.email)) {
1601
+ // User explicitly requested OTP flow - skip provider selection
1602
+ const email = (hints === null || hints === void 0 ? void 0 : hints.email) || (yield promptForEmail(userInteraction, 'Enter email address'));
1603
+ if (/@demo.local$/.test(email)) {
1604
+ tokenRequest = {
1605
+ demo_user: email,
1606
+ grant_type: 'demo',
1607
+ scopes: ['ACCESS_DB'],
1608
+ public_key
1609
+ };
1610
+ }
1611
+ else {
1612
+ tokenRequest = {
1613
+ email,
1614
+ grant_type: 'otp',
1615
+ scopes: ['ACCESS_DB'],
1616
+ };
1617
+ }
1618
+ }
1600
1619
  else {
1601
1620
  // Check for available auth providers (OAuth + OTP)
1602
1621
  const socialAuthEnabled = ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.socialAuth) !== false;
@@ -6915,7 +6934,7 @@ function dexieCloud(dexie) {
6915
6934
  const syncComplete = new Subject();
6916
6935
  dexie.cloud = {
6917
6936
  // @ts-ignore
6918
- version: "4.3.3",
6937
+ version: "4.3.5",
6919
6938
  options: Object.assign({}, DEFAULT_OPTIONS),
6920
6939
  schema: null,
6921
6940
  get currentUserId() {
@@ -6983,6 +7002,16 @@ function dexieCloud(dexie) {
6983
7002
  : yield logout(DexieCloudDB(dexie));
6984
7003
  });
6985
7004
  },
7005
+ getAuthProviders() {
7006
+ return __awaiter(this, void 0, void 0, function* () {
7007
+ const options = dexie.cloud.options;
7008
+ if (!(options === null || options === void 0 ? void 0 : options.databaseUrl)) {
7009
+ throw new Error('Dexie Cloud not configured. Call db.cloud.configure() first.');
7010
+ }
7011
+ const socialAuthEnabled = options.socialAuth !== false;
7012
+ return fetchAuthProviders(options.databaseUrl, socialAuthEnabled);
7013
+ });
7014
+ },
6986
7015
  sync() {
6987
7016
  return __awaiter(this, arguments, void 0, function* ({ wait, purpose } = { wait: true, purpose: 'push' }) {
6988
7017
  var _a;
@@ -7284,7 +7313,7 @@ function dexieCloud(dexie) {
7284
7313
  }
7285
7314
  }
7286
7315
  // @ts-ignore
7287
- dexieCloud.version = "4.3.3";
7316
+ dexieCloud.version = "4.3.5";
7288
7317
  Dexie.Cloud = dexieCloud;
7289
7318
 
7290
7319
  export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };