@instantdb/core 1.0.59 → 1.0.60-branch-sm-e2e-extra-fields-test.30932613644.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instantdb/core",
3
- "version": "1.0.59",
3
+ "version": "1.0.60-branch-sm-e2e-extra-fields-test.30932613644.1",
4
4
  "description": "Instant's core local abstraction",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/instantdb/instant/tree/main/client/packages/core",
@@ -57,7 +57,7 @@
57
57
  "dependencies": {
58
58
  "mutative": "^1.0.10",
59
59
  "uuid": "^11.1.0",
60
- "@instantdb/version": "1.0.59"
60
+ "@instantdb/version": "1.0.60-branch-sm-e2e-extra-fields-test.30932613644.1"
61
61
  },
62
62
  "msw": {
63
63
  "workerDirectory": [
package/src/Reactor.js CHANGED
@@ -2378,10 +2378,11 @@ export default class Reactor {
2378
2378
  return res;
2379
2379
  }
2380
2380
 
2381
- async signInAsGuest() {
2381
+ async signInAsGuest(params) {
2382
2382
  const res = await authAPI.signInAsGuest({
2383
2383
  apiURI: this.config.apiURI,
2384
2384
  appId: this.config.appId,
2385
+ extraFields: params?.extraFields,
2385
2386
  });
2386
2387
  await this.changeCurrentUser(res.user);
2387
2388
  return res;
package/src/authAPI.ts CHANGED
@@ -105,15 +105,20 @@ export async function verifyRefreshToken({
105
105
  return res;
106
106
  }
107
107
 
108
+ export type SignInAsGuestParams = {
109
+ extraFields?: Record<string, any> | undefined;
110
+ };
108
111
  export async function signInAsGuest({
109
112
  apiURI,
110
113
  appId,
111
- }: SharedInput): Promise<VerifyResponse> {
114
+ extraFields,
115
+ }: SharedInput & SignInAsGuestParams): Promise<VerifyResponse> {
112
116
  const res = await jsonFetch(`${apiURI}/runtime/auth/sign_in_guest`, {
113
117
  method: 'POST',
114
118
  headers: { 'content-type': 'application/json' },
115
119
  body: JSON.stringify({
116
120
  'app-id': appId,
121
+ ...(extraFields ? { 'extra-fields': extraFields } : {}),
117
122
  }),
118
123
  });
119
124
  return res;
package/src/index.ts CHANGED
@@ -126,6 +126,7 @@ import type {
126
126
  ExchangeCodeForTokenParams,
127
127
  SendMagicCodeParams,
128
128
  SendMagicCodeResponse,
129
+ SignInAsGuestParams,
129
130
  SignInWithIdTokenParams,
130
131
  VerifyMagicCodeParams,
131
132
  VerifyResponse,
@@ -403,8 +404,8 @@ class Auth {
403
404
  * @example
404
405
  * db.auth.signInAsGuest();
405
406
  */
406
- signInAsGuest = (): Promise<VerifyResponse> => {
407
- return this.db.signInAsGuest();
407
+ signInAsGuest = (params?: SignInAsGuestParams): Promise<VerifyResponse> => {
408
+ return this.db.signInAsGuest(params);
408
409
  };
409
410
 
410
411
  /**
@@ -1209,6 +1210,7 @@ export {
1209
1210
  type ExchangeCodeForTokenParams,
1210
1211
  type SendMagicCodeParams,
1211
1212
  type SendMagicCodeResponse,
1213
+ type SignInAsGuestParams,
1212
1214
  type SignInWithIdTokenParams,
1213
1215
  type VerifyMagicCodeParams,
1214
1216
  type VerifyResponse,