@hexclave/js 1.0.66 → 1.0.68

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.
Files changed (65) hide show
  1. package/dist/{admin-app-impl-BqCnEjjC.d.ts → admin-app-impl-DxZSp6ov.d.ts} +10 -5
  2. package/dist/admin-app-impl-DxZSp6ov.d.ts.map +1 -0
  3. package/dist/clickmap/clickmap-core.d.ts +1 -1
  4. package/dist/clickmap/index.d.ts +1 -1
  5. package/dist/{client-app-o8N3XCYe.d.ts → client-app-DBcv6rRn.d.ts} +13 -6
  6. package/dist/client-app-DBcv6rRn.d.ts.map +1 -0
  7. package/dist/dev-tool/dev-tool-core.d.ts +1 -1
  8. package/dist/dev-tool/index.d.ts +1 -1
  9. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -1
  10. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  11. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +7 -2
  12. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
  13. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js +22 -5
  14. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
  15. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.sign-in-cache-warmup.test.d.ts +1 -0
  16. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.sign-in-cache-warmup.test.js +97 -0
  17. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.sign-in-cache-warmup.test.js.map +1 -0
  18. package/dist/esm/lib/hexclave-app/apps/implementations/common.js +2 -2
  19. package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts.map +1 -1
  20. package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js +1 -4
  21. package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js.map +1 -1
  22. package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -1
  23. package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.d.ts.map +1 -1
  24. package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.js.map +1 -1
  25. package/dist/esm/lib/hexclave-app/teams/index.d.ts +1 -0
  26. package/dist/esm/lib/hexclave-app/teams/index.d.ts.map +1 -1
  27. package/dist/esm/lib/hexclave-app/teams/index.js.map +1 -1
  28. package/dist/esm/lib/hexclave-app/users/index.d.ts +10 -4
  29. package/dist/esm/lib/hexclave-app/users/index.d.ts.map +1 -1
  30. package/dist/esm/lib/hexclave-app/users/index.js.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -1
  33. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -1
  34. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js +22 -5
  35. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
  36. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.sign-in-cache-warmup.test.d.ts +1 -0
  37. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.sign-in-cache-warmup.test.js +96 -0
  38. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.sign-in-cache-warmup.test.js.map +1 -0
  39. package/dist/lib/hexclave-app/apps/implementations/common.js +2 -2
  40. package/dist/lib/hexclave-app/apps/implementations/index.d.ts +1 -1
  41. package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
  42. package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js +1 -4
  43. package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js.map +1 -1
  44. package/dist/lib/hexclave-app/apps/index.d.ts +1 -1
  45. package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts +1 -1
  46. package/dist/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -1
  47. package/dist/lib/hexclave-app/apps/interfaces/client-app.js.map +1 -1
  48. package/dist/lib/hexclave-app/apps/interfaces/server-app.d.ts +1 -1
  49. package/dist/lib/hexclave-app/index.d.ts +1 -1
  50. package/dist/lib/hexclave-app/projects/index.d.ts +1 -1
  51. package/dist/lib/hexclave-app/teams/index.d.ts +1 -1
  52. package/dist/lib/hexclave-app/teams/index.js.map +1 -1
  53. package/dist/lib/hexclave-app/users/index.d.ts +1 -1
  54. package/dist/lib/hexclave-app/users/index.js.map +1 -1
  55. package/dist/pushed-config-error-overlay/index.d.ts +1 -1
  56. package/package.json +2 -2
  57. package/src/integrations/convex/component/README.md +4 -4
  58. package/src/lib/hexclave-app/apps/implementations/client-app-impl.sign-in-cache-warmup.test.ts +94 -0
  59. package/src/lib/hexclave-app/apps/implementations/client-app-impl.ts +33 -8
  60. package/src/lib/hexclave-app/apps/implementations/server-app-impl.ts +1 -10
  61. package/src/lib/hexclave-app/apps/interfaces/client-app.ts +1 -1
  62. package/src/lib/hexclave-app/teams/index.ts +1 -0
  63. package/src/lib/hexclave-app/users/index.ts +9 -4
  64. package/dist/admin-app-impl-BqCnEjjC.d.ts.map +0 -1
  65. package/dist/client-app-o8N3XCYe.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/lib/hexclave-app/teams/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { TeamsCrud } from \"@hexclave/shared/dist/interface/crud/teams\";\nimport { ReadonlyJson } from \"@hexclave/shared/dist/utils/json\";\n\nimport { ApiKeyCreationOptions, TeamApiKey, TeamApiKeyFirstView } from \"../api-keys\";\nimport { AsyncStoreProperty } from \"../common\";\nimport { Customer } from \"../customers\";\nimport { ServerUser } from \"../users\";\n\n\nexport type TeamMemberProfile = {\n displayName: string | null,\n profileImageUrl: string | null,\n}\n\nexport type TeamMemberProfileUpdateOptions = {\n displayName?: string,\n profileImageUrl?: string | null,\n};\n\nexport type EditableTeamMemberProfile = TeamMemberProfile & {\n update(update: TeamMemberProfileUpdateOptions): Promise<void>,\n}\n\nexport type TeamUser = {\n id: string,\n teamProfile: TeamMemberProfile,\n}\n\n/**\n * A team invitation as seen from the team's perspective (ie. the sender).\n *\n * Returned by `team.listInvitations()`. Contains the recipient email and allows\n * revoking the invitation.\n */\nexport type SentTeamInvitation = {\n id: string,\n recipientEmail: string | null,\n expiresAt: Date,\n revoke(): Promise<void>,\n}\n\n/**\n * @deprecated Use `SentTeamInvitation` instead.\n */\nexport type TeamInvitation = SentTeamInvitation;\n\n/**\n * A team invitation as seen from the invited user's perspective (ie. the receiver).\n *\n * Returned by `user.listTeamInvitations()`. Contains information about teams that have\n * sent invitations to any of the user's verified email addresses, and allows accepting\n * the invitation to join the team.\n */\nexport type ReceivedTeamInvitation = {\n id: string,\n teamId: string,\n teamDisplayName: string,\n recipientEmail: string,\n expiresAt: Date,\n\n /**\n * Accepts the invitation, adding the current user to the team.\n *\n * The user must have a verified email address matching the invitation's recipient email.\n */\n accept(): Promise<void>,\n}\n\nexport type Team = {\n id: string,\n displayName: string,\n profileImageUrl: string | null,\n clientMetadata: any,\n clientReadOnlyMetadata: any,\n inviteUser(options: { email: string, callbackUrl?: string }): Promise<void>,\n listUsers(): Promise<TeamUser[]>,\n listInvitations(): Promise<SentTeamInvitation[]>,\n update(update: TeamUpdateOptions): Promise<void>,\n delete(): Promise<void>,\n createApiKey(options: ApiKeyCreationOptions<\"team\">): Promise<TeamApiKeyFirstView>,\n} & AsyncStoreProperty<\"apiKeys\", [], TeamApiKey[], true> & Customer;\n\nexport type TeamUpdateOptions = {\n displayName?: string,\n profileImageUrl?: string | null,\n clientMetadata?: ReadonlyJson,\n};\nexport function teamUpdateOptionsToCrud(options: TeamUpdateOptions): TeamsCrud[\"Client\"][\"Update\"] {\n return {\n display_name: options.displayName,\n profile_image_url: options.profileImageUrl,\n client_metadata: options.clientMetadata,\n };\n}\n\nexport type TeamCreateOptions = {\n displayName: string,\n profileImageUrl?: string,\n}\nexport function teamCreateOptionsToCrud(options: TeamCreateOptions, creatorUserId: string): TeamsCrud[\"Client\"][\"Create\"] {\n return {\n display_name: options.displayName,\n profile_image_url: options.profileImageUrl,\n creator_user_id: creatorUserId,\n };\n}\n\n\nexport type ServerTeamMemberProfile = TeamMemberProfile;\n\nexport type ServerTeamUser = ServerUser & {\n teamProfile: ServerTeamMemberProfile,\n}\n\nexport type ServerTeam = {\n createdAt: Date,\n serverMetadata: any,\n listUsers(): Promise<ServerTeamUser[]>,\n update(update: ServerTeamUpdateOptions): Promise<void>,\n delete(): Promise<void>,\n addUser(userId: string): Promise<void>,\n inviteUser(options: { email: string, callbackUrl?: string }): Promise<void>,\n removeUser(userId: string): Promise<void>,\n} & Team;\n\ntype ServerListUsersOptionsBase = {\n cursor?: string,\n limit?: number,\n orderBy?: 'signedUpAt' | 'lastActiveAt',\n desc?: boolean,\n /**\n * Free-text search. Matches user ID (exact UUID), display name, and contact channels (e.g. primary email).\n */\n query?: string,\n /**\n * Exclude users whose primary email domain matches one of these exact domains.\n */\n excludedEmailDomains?: string[],\n /**\n * Only return users who are members of the given team.\n */\n teamId?: string,\n /**\n * Whether to include restricted users (users who haven't completed onboarding requirements).\n * Defaults to false.\n */\n includeRestricted?: boolean,\n /**\n * Whether to include anonymous users (and restricted users).\n * Defaults to false.\n */\n includeAnonymous?: boolean,\n};\n\nexport type ServerListUsersOptions = ServerListUsersOptionsBase & (\n {\n onlyAnonymous?: false,\n } | {\n /**\n * Whether to return only anonymous users.\n * Requires includeAnonymous=true.\n * Defaults to false.\n */\n onlyAnonymous: true,\n includeAnonymous: true,\n }\n);\n\nexport type ServerListTeamsOptions = {\n orderBy?: 'createdAt',\n desc?: boolean,\n cursor?: string,\n limit?: number,\n /**\n * Free-text search. Matches team ID (exact UUID) and display name.\n */\n query?: string,\n};\n\nexport type ServerTeamCreateOptions = TeamCreateOptions & {\n creatorUserId?: string,\n};\nexport function serverTeamCreateOptionsToCrud(options: ServerTeamCreateOptions): TeamsCrud[\"Server\"][\"Create\"] {\n return {\n display_name: options.displayName,\n profile_image_url: options.profileImageUrl,\n creator_user_id: options.creatorUserId,\n };\n}\n\nexport type ServerTeamUpdateOptions = TeamUpdateOptions & {\n clientReadOnlyMetadata?: ReadonlyJson,\n serverMetadata?: ReadonlyJson,\n};\nexport function serverTeamUpdateOptionsToCrud(options: ServerTeamUpdateOptions): TeamsCrud[\"Server\"][\"Update\"] {\n return {\n display_name: options.displayName,\n profile_image_url: options.profileImageUrl,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n };\n}\n"],"mappings":";AA2FA,SAAgB,wBAAwB,SAA2D;CACjG,OAAO;EACL,cAAc,QAAQ;EACtB,mBAAmB,QAAQ;EAC3B,iBAAiB,QAAQ;CAC3B;AACF;AAMA,SAAgB,wBAAwB,SAA4B,eAAsD;CACxH,OAAO;EACL,cAAc,QAAQ;EACtB,mBAAmB,QAAQ;EAC3B,iBAAiB;CACnB;AACF;AA6EA,SAAgB,8BAA8B,SAAiE;CAC7G,OAAO;EACL,cAAc,QAAQ;EACtB,mBAAmB,QAAQ;EAC3B,iBAAiB,QAAQ;CAC3B;AACF;AAMA,SAAgB,8BAA8B,SAAiE;CAC7G,OAAO;EACL,cAAc,QAAQ;EACtB,mBAAmB,QAAQ;EAC3B,iBAAiB,QAAQ;EACzB,2BAA2B,QAAQ;EACnC,iBAAiB,QAAQ;CAC3B;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/lib/hexclave-app/teams/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { TeamsCrud } from \"@hexclave/shared/dist/interface/crud/teams\";\nimport { ReadonlyJson } from \"@hexclave/shared/dist/utils/json\";\n\nimport { ApiKeyCreationOptions, TeamApiKey, TeamApiKeyFirstView } from \"../api-keys\";\nimport { AsyncStoreProperty } from \"../common\";\nimport { Customer } from \"../customers\";\nimport { ServerUser } from \"../users\";\n\n\nexport type TeamMemberProfile = {\n displayName: string | null,\n profileImageUrl: string | null,\n}\n\nexport type TeamMemberProfileUpdateOptions = {\n displayName?: string,\n profileImageUrl?: string | null,\n};\n\nexport type EditableTeamMemberProfile = TeamMemberProfile & {\n update(update: TeamMemberProfileUpdateOptions): Promise<void>,\n}\n\nexport type TeamUser = {\n id: string,\n teamProfile: TeamMemberProfile,\n}\n\n/**\n * A team invitation as seen from the team's perspective (ie. the sender).\n *\n * Returned by `team.listInvitations()`. Contains the recipient email and allows\n * revoking the invitation.\n */\nexport type SentTeamInvitation = {\n id: string,\n recipientEmail: string | null,\n expiresAt: Date,\n revoke(): Promise<void>,\n}\n\n/**\n * @deprecated Use `SentTeamInvitation` instead.\n */\nexport type TeamInvitation = SentTeamInvitation;\n\n/**\n * A team invitation as seen from the invited user's perspective (ie. the receiver).\n *\n * Returned by `user.listTeamInvitations()`. Contains information about teams that have\n * sent invitations to any of the user's verified email addresses, and allows accepting\n * the invitation to join the team.\n */\nexport type ReceivedTeamInvitation = {\n id: string,\n teamId: string,\n teamDisplayName: string,\n recipientEmail: string,\n expiresAt: Date,\n\n /**\n * Accepts the invitation, adding the current user to the team.\n *\n * The user must have a verified email address matching the invitation's recipient email.\n */\n accept(): Promise<void>,\n}\n\nexport type Team = {\n id: string,\n displayName: string,\n profileImageUrl: string | null,\n clientMetadata: any,\n clientReadOnlyMetadata: any,\n inviteUser(options: { email: string, callbackUrl?: string }): Promise<void>,\n listUsers(): Promise<TeamUser[]>,\n removeUser(userId: string): Promise<void>,\n listInvitations(): Promise<SentTeamInvitation[]>,\n update(update: TeamUpdateOptions): Promise<void>,\n delete(): Promise<void>,\n createApiKey(options: ApiKeyCreationOptions<\"team\">): Promise<TeamApiKeyFirstView>,\n} & AsyncStoreProperty<\"apiKeys\", [], TeamApiKey[], true> & Customer;\n\nexport type TeamUpdateOptions = {\n displayName?: string,\n profileImageUrl?: string | null,\n clientMetadata?: ReadonlyJson,\n};\nexport function teamUpdateOptionsToCrud(options: TeamUpdateOptions): TeamsCrud[\"Client\"][\"Update\"] {\n return {\n display_name: options.displayName,\n profile_image_url: options.profileImageUrl,\n client_metadata: options.clientMetadata,\n };\n}\n\nexport type TeamCreateOptions = {\n displayName: string,\n profileImageUrl?: string,\n}\nexport function teamCreateOptionsToCrud(options: TeamCreateOptions, creatorUserId: string): TeamsCrud[\"Client\"][\"Create\"] {\n return {\n display_name: options.displayName,\n profile_image_url: options.profileImageUrl,\n creator_user_id: creatorUserId,\n };\n}\n\n\nexport type ServerTeamMemberProfile = TeamMemberProfile;\n\nexport type ServerTeamUser = ServerUser & {\n teamProfile: ServerTeamMemberProfile,\n}\n\nexport type ServerTeam = {\n createdAt: Date,\n serverMetadata: any,\n listUsers(): Promise<ServerTeamUser[]>,\n update(update: ServerTeamUpdateOptions): Promise<void>,\n delete(): Promise<void>,\n addUser(userId: string): Promise<void>,\n inviteUser(options: { email: string, callbackUrl?: string }): Promise<void>,\n removeUser(userId: string): Promise<void>,\n} & Team;\n\ntype ServerListUsersOptionsBase = {\n cursor?: string,\n limit?: number,\n orderBy?: 'signedUpAt' | 'lastActiveAt',\n desc?: boolean,\n /**\n * Free-text search. Matches user ID (exact UUID), display name, and contact channels (e.g. primary email).\n */\n query?: string,\n /**\n * Exclude users whose primary email domain matches one of these exact domains.\n */\n excludedEmailDomains?: string[],\n /**\n * Only return users who are members of the given team.\n */\n teamId?: string,\n /**\n * Whether to include restricted users (users who haven't completed onboarding requirements).\n * Defaults to false.\n */\n includeRestricted?: boolean,\n /**\n * Whether to include anonymous users (and restricted users).\n * Defaults to false.\n */\n includeAnonymous?: boolean,\n};\n\nexport type ServerListUsersOptions = ServerListUsersOptionsBase & (\n {\n onlyAnonymous?: false,\n } | {\n /**\n * Whether to return only anonymous users.\n * Requires includeAnonymous=true.\n * Defaults to false.\n */\n onlyAnonymous: true,\n includeAnonymous: true,\n }\n);\n\nexport type ServerListTeamsOptions = {\n orderBy?: 'createdAt',\n desc?: boolean,\n cursor?: string,\n limit?: number,\n /**\n * Free-text search. Matches team ID (exact UUID) and display name.\n */\n query?: string,\n};\n\nexport type ServerTeamCreateOptions = TeamCreateOptions & {\n creatorUserId?: string,\n};\nexport function serverTeamCreateOptionsToCrud(options: ServerTeamCreateOptions): TeamsCrud[\"Server\"][\"Create\"] {\n return {\n display_name: options.displayName,\n profile_image_url: options.profileImageUrl,\n creator_user_id: options.creatorUserId,\n };\n}\n\nexport type ServerTeamUpdateOptions = TeamUpdateOptions & {\n clientReadOnlyMetadata?: ReadonlyJson,\n serverMetadata?: ReadonlyJson,\n};\nexport function serverTeamUpdateOptionsToCrud(options: ServerTeamUpdateOptions): TeamsCrud[\"Server\"][\"Update\"] {\n return {\n display_name: options.displayName,\n profile_image_url: options.profileImageUrl,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n };\n}\n"],"mappings":";AA4FA,SAAgB,wBAAwB,SAA2D;CACjG,OAAO;EACL,cAAc,QAAQ;EACtB,mBAAmB,QAAQ;EAC3B,iBAAiB,QAAQ;CAC3B;AACF;AAMA,SAAgB,wBAAwB,SAA4B,eAAsD;CACxH,OAAO;EACL,cAAc,QAAQ;EACtB,mBAAmB,QAAQ;EAC3B,iBAAiB;CACnB;AACF;AA6EA,SAAgB,8BAA8B,SAAiE;CAC7G,OAAO;EACL,cAAc,QAAQ;EACtB,mBAAmB,QAAQ;EAC3B,iBAAiB,QAAQ;CAC3B;AACF;AAMA,SAAgB,8BAA8B,SAAiE;CAC7G,OAAO;EACL,cAAc,QAAQ;EACtB,mBAAmB,QAAQ;EAC3B,iBAAiB,QAAQ;EACzB,2BAA2B,QAAQ;EACnC,iBAAiB,QAAQ;CAC3B;AACF"}
@@ -114,7 +114,15 @@ type BaseUser = {
114
114
  * The reason why the user is restricted, e.g., { type: "email_not_verified" }, { type: "anonymous" }, or { type: "restricted_by_administrator" }.
115
115
  * Null if the user is not restricted.
116
116
  */
117
- readonly restrictedReason: RestrictedReason | null;
117
+ readonly restrictedReason: RestrictedReason | null; /** Whether the user is restricted by an administrator. Can be set manually or by sign-up rules. */
118
+ readonly restrictedByAdmin: boolean;
119
+ /**
120
+ * Public reason shown to the user explaining why an administrator restricted them, or null if none was given.
121
+ *
122
+ * This is intentionally readable by the user themselves (unlike `restrictedByAdminPrivateDetails`, which is
123
+ * server-only), so onboarding screens can tell them why they can't continue.
124
+ */
125
+ readonly restrictedByAdminReason: string | null;
118
126
  toClientJson(): CurrentUserCrud["Client"]["Read"];
119
127
  /**
120
128
  * @deprecated, use contact channel's usedForAuth instead
@@ -255,9 +263,7 @@ type ServerBaseUser = {
255
263
  readonly lastActiveAt: Date;
256
264
  readonly serverMetadata: any;
257
265
  setServerMetadata(metadata: any): Promise<void>;
258
- setClientReadOnlyMetadata(metadata: any): Promise<void>; /** Whether the user is restricted by an administrator. Can be set manually or by sign-up rules. */
259
- readonly restrictedByAdmin: boolean; /** Public reason shown to the user explaining why they are restricted. Optional. */
260
- readonly restrictedByAdminReason: string | null; /** Private details about the restriction (e.g., which sign-up rule triggered). Only visible to server access and above. */
266
+ setClientReadOnlyMetadata(metadata: any): Promise<void>; /** Private details about the restriction (e.g., which sign-up rule triggered). Only visible to server access and above. */
261
267
  readonly restrictedByAdminPrivateDetails: string | null; /** Best-effort ISO country code captured at sign-up time from request geo headers. */
262
268
  readonly countryCode: string | null; /** Server-only risk scores used during sign-up risk evaluation. */
263
269
  readonly riskScores: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../../../src/lib/hexclave-app/users/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;iBA0BgB,wBAAA,mBAA2C,MAAA,EAAQ,CAAA,GAAI,CAAC;AAAA,K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A,EAAO,IAAA,EAAM,YAAA,UAAsB,OAAA;EAAY,MAAA;AAAA,IAAqB,mBAAA,kBACtG,kBAAA,iBAAmC,KAAA,EAAO,IAAA,EAAM,OAAA;EAAY,MAAA;AAAA,IAAqB,mBAAA;;;;;KAMvE,UAAA,GAAa,cAAA,GAAiB,QAAA,GAAW,SAAA,GAAY,QAAA;AAAA,KAErD,iBAAA,GAAoB,IAAA,GAAO,UAAU;AAAA,KAErC,yBAAA,GAA4B,iBAAA,GAAoB,iBAAiB;AAAA,KAEjE,wBAAA,cAAsC,SAAA,sBAA+B,yBAAA,GAA4B,iBAAA;AAAA,KAEjG,uBAAA,GAA0B,iBAAA,GAAoB,IAAA,CACxD,UAAA;AAAA,KAIU,uBAAA;EACV,YAAA;EACA,oBAAA;EACA,uBAAA;EACA,sBAAA,GAAyB,YAAA;EACzB,cAAA,GAAiB,YAAA;EACjB,QAAA;EACA,iBAAA;EACA,uBAAA;EACA,+BAAA;EACA,WAAA;EACA,UAAA;IACE,MAAA;MACE,GAAA;MACA,cAAA;IAAA;EAAA;AAAA,IAGF,iBAAA;AAAA,iBACY,6BAAA,CAA8B,OAAA,EAAS,uBAAA,GAA0B,eAAe;AAAA,KA+BpF,uBAAA;EACV,YAAA;EACA,uBAAA;EACA,QAAA;EACA,cAAA;EACA,WAAA;EACA,oBAAA;EACA,cAAA;EACA,sBAAA;EACA,cAAA;EACA,WAAA;EACA,UAAA;IACE,MAAA;MACE,GAAA;MACA,cAAA;IAAA;EAAA;AAAA;AAAA,iBAIU,6BAAA,CAA8B,OAAA,EAAS,uBAAA,GAA0B,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/lib/hexclave-app/users/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { KnownErrors } from \"@hexclave/shared\";\nimport { CurrentUserCrud } from \"@hexclave/shared/dist/interface/crud/current-user\";\nimport { UsersCrud } from \"@hexclave/shared/dist/interface/crud/users\";\nimport type { RestrictedReason } from \"@hexclave/shared/dist/schema-fields\";\nimport { InternalSession } from \"@hexclave/shared/dist/sessions\";\nimport { encodeBase64 } from \"@hexclave/shared/dist/utils/bytes\";\nimport { GeoInfo } from \"@hexclave/shared/dist/utils/geo\";\nimport { ReadonlyJson } from \"@hexclave/shared/dist/utils/json\";\nimport { ProviderType } from \"@hexclave/shared/dist/utils/oauth\";\nimport { Result } from \"@hexclave/shared/dist/utils/results\";\nimport { ApiKeyCreationOptions, UserApiKey, UserApiKeyFirstView } from \"../api-keys\";\nimport { AsyncStoreProperty, AuthLike } from \"../common\";\nimport { DeprecatedOAuthConnection, OAuthConnection } from \"../connected-accounts\";\nimport { ContactChannel, ContactChannelCreateOptions, ServerContactChannel, ServerContactChannelCreateOptions } from \"../contact-channels\";\nimport { Customer } from \"../customers\";\nimport { NotificationCategory } from \"../notification-categories\";\nimport { AdminTeamPermission, TeamPermission } from \"../permissions\";\nimport { AdminOwnedProject, AdminProjectCreateOptions } from \"../projects\";\nimport { EditableTeamMemberProfile, ReceivedTeamInvitation, ServerListTeamsOptions, ServerTeam, ServerTeamCreateOptions, Team, TeamCreateOptions } from \"../teams\";\n\nconst userGetterErrorMessage = \"Hexclave: useUser() already returns the user object. Use `const user = useUser()` (or `const user = await app.getUser()`) instead of destructuring it like `const { user } = ...`.\";\n\nexport function withUserDestructureGuard<T extends object>(target: T): T {\n Object.freeze(target);\n return new Proxy(target, {\n get(target, prop, receiver) {\n if (prop === \"user\") {\n return guardGetter();\n }\n return target[prop as keyof T];\n },\n });\n}\n\nfunction guardGetter(): never {\n throw new Error(userGetterErrorMessage);\n}\n\nexport type OAuthProvider = {\n readonly id: string,\n readonly type: string,\n readonly userId: string,\n readonly accountId?: string,\n readonly email?: string,\n readonly allowSignIn: boolean,\n readonly allowConnectedAccounts: boolean,\n update(data: { allowSignIn?: boolean, allowConnectedAccounts?: boolean }): Promise<Result<void,\n InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>\n >>,\n delete(): Promise<void>,\n};\n\nexport type ServerOAuthProvider = {\n readonly id: string,\n readonly type: string,\n readonly userId: string,\n readonly accountId: string,\n readonly email?: string,\n readonly allowSignIn: boolean,\n readonly allowConnectedAccounts: boolean,\n update(data: { accountId?: string, email?: string, allowSignIn?: boolean, allowConnectedAccounts?: boolean }): Promise<Result<void,\n InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>\n >>,\n delete(): Promise<void>,\n};\n\n\n/**\n * Contains everything related to the current user session.\n */\nexport type Auth = AuthLike<{}> & {\n readonly _internalSession: InternalSession,\n readonly currentSession: {\n getTokens(): Promise<{ accessToken: string | null, refreshToken: string | null }>,\n },\n};\n\n/**\n * ```\n * +----------+-------------+-------------------+\n * | \\ | !Server | Server |\n * +----------+-------------+-------------------+\n * | !Session | User | ServerUser |\n * | Session | CurrentUser | CurrentServerUser |\n * +----------+-------------+-------------------+\n * ```\n *\n * The fields on each of these types are available iff:\n * BaseUser: true\n * Auth: Session\n * ServerBaseUser: Server\n * UserExtra: Session OR Server\n *\n * The types are defined as follows (in the typescript manner):\n * User = BaseUser\n * CurrentUser = BaseUser & Auth & UserExtra\n * ServerUser = BaseUser & ServerBaseUser & UserExtra\n * CurrentServerUser = BaseUser & ServerBaseUser & Auth & UserExtra\n **/\n\nexport type BaseUser = {\n readonly id: string,\n\n readonly displayName: string | null,\n\n /**\n * The user's email address.\n *\n * Note: This might NOT be unique across multiple users, so always use `id` for unique identification.\n */\n readonly primaryEmail: string | null,\n readonly primaryEmailVerified: boolean,\n readonly profileImageUrl: string | null,\n\n readonly signedUpAt: Date,\n\n readonly clientMetadata: any,\n readonly clientReadOnlyMetadata: any,\n\n /**\n * Whether the user has a password set.\n */\n readonly hasPassword: boolean,\n readonly otpAuthEnabled: boolean,\n readonly passkeyAuthEnabled: boolean,\n\n readonly isMultiFactorRequired: boolean,\n readonly isAnonymous: boolean,\n /**\n * Whether the user is in restricted state (signed up but hasn't completed onboarding requirements).\n * For example, if email verification is required but the user hasn't verified their email yet.\n */\n readonly isRestricted: boolean,\n /**\n * The reason why the user is restricted, e.g., { type: \"email_not_verified\" }, { type: \"anonymous\" }, or { type: \"restricted_by_administrator\" }.\n * Null if the user is not restricted.\n */\n readonly restrictedReason: RestrictedReason | null,\n toClientJson(): CurrentUserCrud[\"Client\"][\"Read\"],\n\n /**\n * @deprecated, use contact channel's usedForAuth instead\n */\n readonly emailAuthEnabled: boolean,\n /**\n * @deprecated\n */\n readonly oauthProviders: readonly { id: string }[],\n}\n\nexport type UserExtra = {\n setDisplayName(displayName: string | null): Promise<void>,\n /** @deprecated Use contact channel's sendVerificationEmail instead */\n sendVerificationEmail(): Promise<KnownErrors[\"EmailAlreadyVerified\"] | void>,\n setClientMetadata(metadata: any): Promise<void>,\n updatePassword(options: { oldPassword: string, newPassword: string}): Promise<KnownErrors[\"PasswordConfirmationMismatch\"] | KnownErrors[\"PasswordRequirementsNotMet\"] | void>,\n setPassword(options: { password: string }): Promise<KnownErrors[\"PasswordRequirementsNotMet\"] | void>,\n\n /**\n * A shorthand method to update multiple fields of the user at once.\n */\n update(update: UserUpdateOptions): Promise<void>,\n\n listContactChannels(): Promise<ContactChannel[]>,\n createContactChannel(data: ContactChannelCreateOptions): Promise<ContactChannel>,\n\n listNotificationCategories(): Promise<NotificationCategory[]>,\n\n delete(): Promise<void>,\n\n /** @deprecated Use `getOrLinkConnectedAccount` for redirect behavior, or `getConnectedAccount({ provider, providerAccountId })` for existence check. */\n getConnectedAccount(id: ProviderType, options: { or: 'redirect', scopes?: string[] }): Promise<DeprecatedOAuthConnection>,\n /** @deprecated Use `getConnectedAccount({ provider, providerAccountId })` for existence check, or `getOrLinkConnectedAccount` for redirect behavior. */\n getConnectedAccount(id: ProviderType, options?: { or?: 'redirect' | 'throw' | 'return-null', scopes?: string[] }): Promise<DeprecatedOAuthConnection | null>,\n /** Get a specific connected account by provider and providerAccountId. Returns null if not found. */\n getConnectedAccount(account: { provider: string, providerAccountId: string }): Promise<OAuthConnection | null>,\n\n\n /** List all connected accounts for this user (only those with allowConnectedAccounts enabled). */\n listConnectedAccounts(): Promise<OAuthConnection[]>,\n /** React hook to list all connected accounts. */\n /** Redirect the user to the OAuth flow to link a new connected account. Always redirects, never returns. */\n linkConnectedAccount(provider: string, options?: { scopes?: string[] }): Promise<void>,\n /** Get a connected account for the given provider, or redirect to link one if none exists or the token/scopes are insufficient. */\n getOrLinkConnectedAccount(provider: string, options?: { scopes?: string[] }): Promise<OAuthConnection>,\n /** React hook: get a connected account for the given provider, or redirect to link one if none exists or the token/scopes are insufficient. */\n\n hasPermission(scope: Team, permissionId: string): Promise<boolean>,\n hasPermission(permissionId: string): Promise<boolean>,\n\n getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>,\n getPermission(permissionId: string): Promise<TeamPermission | null>,\n\n listPermissions(scope: Team, options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n listPermissions(options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n\n\n readonly selectedTeam: Team | null,\n setSelectedTeam(teamOrId: string | Team | null): Promise<void>,\n createTeam(data: TeamCreateOptions): Promise<Team>,\n leaveTeam(team: Team): Promise<void>,\n\n /**\n * Lists all pending team invitations sent to any of the current user's verified email addresses.\n *\n * This allows the user to discover which teams have invited them, even if they haven't\n * joined those teams yet. Only invitations sent to verified email addresses are included.\n *\n * @returns An array of `ReceivedTeamInvitation` objects, each containing the team ID, team\n * display name, recipient email, and expiration date.\n *\n * @example\n * ```ts\n * const invitations = await user.listTeamInvitations();\n * for (const invitation of invitations) {\n * console.log(`Invited to ${invitation.teamDisplayName} via ${invitation.recipientEmail}`);\n * }\n * ```\n */\n listTeamInvitations(): Promise<ReceivedTeamInvitation[]>,\n /**\n * Lists all pending team invitations sent to any of the current user's verified email addresses.\n *\n * React hook version of `listTeamInvitations()`. Automatically re-renders when invitations change.\n */\n\n getActiveSessions(): Promise<ActiveSession[]>,\n revokeSession(sessionId: string): Promise<void>,\n getTeamProfile(team: Team): Promise<EditableTeamMemberProfile>,\n\n createApiKey(options: ApiKeyCreationOptions<\"user\">): Promise<UserApiKeyFirstView>,\n\n listOAuthProviders(): Promise<OAuthProvider[]>,\n\n getOAuthProvider(id: string): Promise<OAuthProvider | null>,\n\n registerPasskey(options?: { hostname?: string }): Promise<Result<undefined, KnownErrors[\"PasskeyRegistrationFailed\"] | KnownErrors[\"PasskeyWebAuthnError\"]>>,\n}\n& AsyncStoreProperty<\"apiKeys\", [], UserApiKey[], true>\n& AsyncStoreProperty<\"team\", [id: string], Team | null, false>\n& AsyncStoreProperty<\"teams\", [], Team[], true>\n& AsyncStoreProperty<\"teamInvitations\", [], ReceivedTeamInvitation[], true>\n& AsyncStoreProperty<\"permission\", [scope: Team, permissionId: string, options?: { recursive?: boolean }], TeamPermission | null, false>\n& AsyncStoreProperty<\"permissions\", [scope: Team, options?: { recursive?: boolean }], TeamPermission[], true>;\n\nexport type InternalUserExtra =\n & {\n createProject(newProject: AdminProjectCreateOptions): Promise<AdminOwnedProject>,\n transferProject(projectIdToTransfer: string, newTeamId: string): Promise<void>,\n }\n & AsyncStoreProperty<\"ownedProjects\", [], AdminOwnedProject[], true>\n\nexport type User = BaseUser;\n\nexport type CurrentUser = BaseUser & Auth & UserExtra & Customer;\n\nexport type CurrentInternalUser = CurrentUser & InternalUserExtra;\n\nexport type ProjectCurrentUser<ProjectId> = ProjectId extends \"internal\" ? CurrentInternalUser : CurrentUser;\n\nexport type TokenPartialUser = Pick<\n User,\n | \"id\"\n | \"displayName\"\n | \"primaryEmail\"\n | \"primaryEmailVerified\"\n | \"isAnonymous\"\n | \"isMultiFactorRequired\"\n | \"isRestricted\"\n | \"restrictedReason\"\n>\n\nexport type SyncedPartialUser = TokenPartialUser & Pick<\n User,\n | \"id\"\n | \"displayName\"\n | \"primaryEmail\"\n | \"primaryEmailVerified\"\n | \"profileImageUrl\"\n | \"signedUpAt\"\n | \"clientMetadata\"\n | \"clientReadOnlyMetadata\"\n | \"isAnonymous\"\n | \"hasPassword\"\n | \"isRestricted\"\n | \"restrictedReason\"\n>;\n\n\nexport type ActiveSession = {\n id: string,\n userId: string,\n createdAt: Date,\n isImpersonation: boolean,\n lastUsedAt: Date | undefined,\n isCurrentSession: boolean,\n geoInfo?: GeoInfo,\n};\n\nexport type UserUpdateOptions = {\n displayName?: string | null,\n clientMetadata?: ReadonlyJson,\n selectedTeamId?: string | null,\n totpMultiFactorSecret?: Uint8Array | null,\n profileImageUrl?: string | null,\n otpAuthEnabled?: boolean,\n passkeyAuthEnabled?: boolean,\n primaryEmail?: string | null,\n}\nexport function userUpdateOptionsToCrud(options: UserUpdateOptions): CurrentUserCrud[\"Client\"][\"Update\"] {\n return {\n display_name: options.displayName,\n client_metadata: options.clientMetadata,\n selected_team_id: options.selectedTeamId,\n totp_secret_base64: options.totpMultiFactorSecret != null ? encodeBase64(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,\n profile_image_url: options.profileImageUrl,\n otp_auth_enabled: options.otpAuthEnabled,\n passkey_auth_enabled: options.passkeyAuthEnabled,\n primary_email: options.primaryEmail,\n };\n}\n\n\nexport type ServerBaseUser = {\n setPrimaryEmail(email: string | null, options?: { verified?: boolean | undefined }): Promise<void>,\n\n readonly lastActiveAt: Date,\n\n readonly serverMetadata: any,\n setServerMetadata(metadata: any): Promise<void>,\n setClientReadOnlyMetadata(metadata: any): Promise<void>,\n\n /** Whether the user is restricted by an administrator. Can be set manually or by sign-up rules. */\n readonly restrictedByAdmin: boolean,\n /** Public reason shown to the user explaining why they are restricted. Optional. */\n readonly restrictedByAdminReason: string | null,\n /** Private details about the restriction (e.g., which sign-up rule triggered). Only visible to server access and above. */\n readonly restrictedByAdminPrivateDetails: string | null,\n /** Best-effort ISO country code captured at sign-up time from request geo headers. */\n readonly countryCode: string | null,\n /** Server-only risk scores used during sign-up risk evaluation. */\n readonly riskScores: {\n readonly signUp: {\n readonly bot: number,\n readonly freeTrialAbuse: number,\n },\n },\n\n createTeam(data: Omit<ServerTeamCreateOptions, \"creatorUserId\">): Promise<ServerTeam>,\n\n listContactChannels(): Promise<ServerContactChannel[]>,\n createContactChannel(data: ServerContactChannelCreateOptions): Promise<ServerContactChannel>,\n\n update(user: ServerUserUpdateOptions): Promise<void>,\n\n grantPermission(scope: Team, permissionId: string): Promise<void>,\n grantPermission(permissionId: string): Promise<void>,\n\n revokePermission(scope: Team, permissionId: string): Promise<void>,\n revokePermission(permissionId: string): Promise<void>,\n\n getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>,\n getPermission(permissionId: string): Promise<TeamPermission | null>,\n\n hasPermission(scope: Team, permissionId: string): Promise<boolean>,\n hasPermission(permissionId: string): Promise<boolean>,\n\n listPermissions(scope: Team, options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n listPermissions(options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n\n\n listOAuthProviders(): Promise<ServerOAuthProvider[]>,\n\n getOAuthProvider(id: string): Promise<ServerOAuthProvider | null>,\n\n /**\n * Creates a new session object with a refresh token for this user. Can be used to impersonate them.\n */\n createSession(options?: { expiresInMillis?: number, isImpersonation?: boolean }): Promise<{\n getTokens(): Promise<{ accessToken: string | null, refreshToken: string | null }>,\n }>,\n}\n& AsyncStoreProperty<\"team\", [id: string], ServerTeam | null, false>\n& AsyncStoreProperty<\"teams\", [options?: ServerListTeamsOptions], ServerTeam[] & { nextCursor: string | null }, true>\n& AsyncStoreProperty<\"permission\", [scope: Team, permissionId: string, options?: { direct?: boolean }], AdminTeamPermission | null, false>\n& AsyncStoreProperty<\"permissions\", [scope: Team, options?: { direct?: boolean }], AdminTeamPermission[], true>;\n\n/**\n * A user including sensitive fields that should only be used on the server, never sent to the client\n * (such as sensitive information and serverMetadata).\n */\nexport type ServerUser = ServerBaseUser & BaseUser & UserExtra & Customer<true>;\n\nexport type CurrentServerUser = Auth & ServerUser;\n\nexport type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;\n\nexport type ProjectCurrentServerUser<ProjectId> = ProjectId extends \"internal\" ? CurrentInternalServerUser : CurrentServerUser;\n\nexport type SyncedPartialServerUser = SyncedPartialUser & Pick<\n ServerUser,\n | \"serverMetadata\"\n>;\n\nexport type ServerUserUpdateOptions = {\n primaryEmail?: string | null,\n primaryEmailVerified?: boolean,\n primaryEmailAuthEnabled?: boolean,\n clientReadOnlyMetadata?: ReadonlyJson,\n serverMetadata?: ReadonlyJson,\n password?: string,\n restrictedByAdmin?: boolean,\n restrictedByAdminReason?: string | null,\n restrictedByAdminPrivateDetails?: string | null,\n countryCode?: string | null,\n riskScores?: {\n signUp: {\n bot: number,\n freeTrialAbuse: number,\n },\n },\n} & UserUpdateOptions;\nexport function serverUserUpdateOptionsToCrud(options: ServerUserUpdateOptions): CurrentUserCrud[\"Server\"][\"Update\"] {\n // Base update options\n const baseUpdate: CurrentUserCrud[\"Server\"][\"Update\"] = {\n display_name: options.displayName,\n primary_email: options.primaryEmail,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n selected_team_id: options.selectedTeamId,\n primary_email_auth_enabled: options.primaryEmailAuthEnabled,\n primary_email_verified: options.primaryEmailVerified,\n password: options.password,\n profile_image_url: options.profileImageUrl,\n totp_secret_base64: options.totpMultiFactorSecret != null ? encodeBase64(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,\n };\n return {\n ...baseUpdate,\n restricted_by_admin: options.restrictedByAdmin,\n restricted_by_admin_reason: options.restrictedByAdminReason,\n restricted_by_admin_private_details: options.restrictedByAdminPrivateDetails,\n country_code: options.countryCode,\n risk_scores: options.riskScores ? {\n sign_up: {\n bot: options.riskScores.signUp.bot,\n free_trial_abuse: options.riskScores.signUp.freeTrialAbuse,\n },\n } : undefined,\n };\n}\n\n\nexport type ServerUserCreateOptions = {\n primaryEmail?: string | null,\n primaryEmailAuthEnabled?: boolean,\n password?: string,\n otpAuthEnabled?: boolean,\n displayName?: string,\n primaryEmailVerified?: boolean,\n clientMetadata?: any,\n clientReadOnlyMetadata?: any,\n serverMetadata?: any,\n countryCode?: string | null,\n riskScores?: {\n signUp: {\n bot: number,\n freeTrialAbuse: number,\n },\n },\n}\nexport function serverUserCreateOptionsToCrud(options: ServerUserCreateOptions): UsersCrud[\"Server\"][\"Create\"] {\n return {\n primary_email: options.primaryEmail,\n password: options.password,\n otp_auth_enabled: options.otpAuthEnabled,\n primary_email_auth_enabled: options.primaryEmailAuthEnabled,\n display_name: options.displayName,\n primary_email_verified: options.primaryEmailVerified,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n country_code: options.countryCode,\n risk_scores: options.riskScores ? {\n sign_up: {\n bot: options.riskScores.signUp.bot,\n free_trial_abuse: options.riskScores.signUp.freeTrialAbuse,\n },\n } : undefined,\n };\n}\n"],"mappings":";;AAwBA,MAAM,yBAAyB;AAE/B,SAAgB,yBAA2C,QAAc;CACvE,OAAO,OAAO,MAAM;CACpB,OAAO,IAAI,MAAM,QAAQ,EACvB,IAAI,QAAQ,MAAM,UAAU;EAC1B,IAAI,SAAS,QACX,OAAO,YAAY;EAErB,OAAO,OAAO;CAChB,EACF,CAAC;AACH;AAEA,SAAS,cAAqB;CAC5B,MAAM,IAAI,MAAM,sBAAsB;AACxC;AAiRA,SAAgB,wBAAwB,SAAiE;CACvG,OAAO;EACL,cAAc,QAAQ;EACtB,iBAAiB,QAAQ;EACzB,kBAAkB,QAAQ;EAC1B,oBAAoB,QAAQ,yBAAyB,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;EAClH,mBAAmB,QAAQ;EAC3B,kBAAkB,QAAQ;EAC1B,sBAAsB,QAAQ;EAC9B,eAAe,QAAQ;CACzB;AACF;AAsGA,SAAgB,8BAA8B,SAAuE;CAenH,OAAO;EAZL,cAAc,QAAQ;EACtB,eAAe,QAAQ;EACvB,iBAAiB,QAAQ;EACzB,2BAA2B,QAAQ;EACnC,iBAAiB,QAAQ;EACzB,kBAAkB,QAAQ;EAC1B,4BAA4B,QAAQ;EACpC,wBAAwB,QAAQ;EAChC,UAAU,QAAQ;EAClB,mBAAmB,QAAQ;EAC3B,oBAAoB,QAAQ,yBAAyB,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;EAIlH,qBAAqB,QAAQ;EAC7B,4BAA4B,QAAQ;EACpC,qCAAqC,QAAQ;EAC7C,cAAc,QAAQ;EACtB,aAAa,QAAQ,aAAa,EAChC,SAAS;GACP,KAAK,QAAQ,WAAW,OAAO;GAC/B,kBAAkB,QAAQ,WAAW,OAAO;EAC9C,EACF,IAAI,KAAA;CACN;AACF;AAqBA,SAAgB,8BAA8B,SAAiE;CAC7G,OAAO;EACL,eAAe,QAAQ;EACvB,UAAU,QAAQ;EAClB,kBAAkB,QAAQ;EAC1B,4BAA4B,QAAQ;EACpC,cAAc,QAAQ;EACtB,wBAAwB,QAAQ;EAChC,iBAAiB,QAAQ;EACzB,2BAA2B,QAAQ;EACnC,iBAAiB,QAAQ;EACzB,cAAc,QAAQ;EACtB,aAAa,QAAQ,aAAa,EAChC,SAAS;GACP,KAAK,QAAQ,WAAW,OAAO;GAC/B,kBAAkB,QAAQ,WAAW,OAAO;EAC9C,EACF,IAAI,KAAA;CACN;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/lib/hexclave-app/users/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { KnownErrors } from \"@hexclave/shared\";\nimport { CurrentUserCrud } from \"@hexclave/shared/dist/interface/crud/current-user\";\nimport { UsersCrud } from \"@hexclave/shared/dist/interface/crud/users\";\nimport type { RestrictedReason } from \"@hexclave/shared/dist/schema-fields\";\nimport { InternalSession } from \"@hexclave/shared/dist/sessions\";\nimport { encodeBase64 } from \"@hexclave/shared/dist/utils/bytes\";\nimport { GeoInfo } from \"@hexclave/shared/dist/utils/geo\";\nimport { ReadonlyJson } from \"@hexclave/shared/dist/utils/json\";\nimport { ProviderType } from \"@hexclave/shared/dist/utils/oauth\";\nimport { Result } from \"@hexclave/shared/dist/utils/results\";\nimport { ApiKeyCreationOptions, UserApiKey, UserApiKeyFirstView } from \"../api-keys\";\nimport { AsyncStoreProperty, AuthLike } from \"../common\";\nimport { DeprecatedOAuthConnection, OAuthConnection } from \"../connected-accounts\";\nimport { ContactChannel, ContactChannelCreateOptions, ServerContactChannel, ServerContactChannelCreateOptions } from \"../contact-channels\";\nimport { Customer } from \"../customers\";\nimport { NotificationCategory } from \"../notification-categories\";\nimport { AdminTeamPermission, TeamPermission } from \"../permissions\";\nimport { AdminOwnedProject, AdminProjectCreateOptions } from \"../projects\";\nimport { EditableTeamMemberProfile, ReceivedTeamInvitation, ServerListTeamsOptions, ServerTeam, ServerTeamCreateOptions, Team, TeamCreateOptions } from \"../teams\";\n\nconst userGetterErrorMessage = \"Hexclave: useUser() already returns the user object. Use `const user = useUser()` (or `const user = await app.getUser()`) instead of destructuring it like `const { user } = ...`.\";\n\nexport function withUserDestructureGuard<T extends object>(target: T): T {\n Object.freeze(target);\n return new Proxy(target, {\n get(target, prop, receiver) {\n if (prop === \"user\") {\n return guardGetter();\n }\n return target[prop as keyof T];\n },\n });\n}\n\nfunction guardGetter(): never {\n throw new Error(userGetterErrorMessage);\n}\n\nexport type OAuthProvider = {\n readonly id: string,\n readonly type: string,\n readonly userId: string,\n readonly accountId?: string,\n readonly email?: string,\n readonly allowSignIn: boolean,\n readonly allowConnectedAccounts: boolean,\n update(data: { allowSignIn?: boolean, allowConnectedAccounts?: boolean }): Promise<Result<void,\n InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>\n >>,\n delete(): Promise<void>,\n};\n\nexport type ServerOAuthProvider = {\n readonly id: string,\n readonly type: string,\n readonly userId: string,\n readonly accountId: string,\n readonly email?: string,\n readonly allowSignIn: boolean,\n readonly allowConnectedAccounts: boolean,\n update(data: { accountId?: string, email?: string, allowSignIn?: boolean, allowConnectedAccounts?: boolean }): Promise<Result<void,\n InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>\n >>,\n delete(): Promise<void>,\n};\n\n\n/**\n * Contains everything related to the current user session.\n */\nexport type Auth = AuthLike<{}> & {\n readonly _internalSession: InternalSession,\n readonly currentSession: {\n getTokens(): Promise<{ accessToken: string | null, refreshToken: string | null }>,\n },\n};\n\n/**\n * ```\n * +----------+-------------+-------------------+\n * | \\ | !Server | Server |\n * +----------+-------------+-------------------+\n * | !Session | User | ServerUser |\n * | Session | CurrentUser | CurrentServerUser |\n * +----------+-------------+-------------------+\n * ```\n *\n * The fields on each of these types are available iff:\n * BaseUser: true\n * Auth: Session\n * ServerBaseUser: Server\n * UserExtra: Session OR Server\n *\n * The types are defined as follows (in the typescript manner):\n * User = BaseUser\n * CurrentUser = BaseUser & Auth & UserExtra\n * ServerUser = BaseUser & ServerBaseUser & UserExtra\n * CurrentServerUser = BaseUser & ServerBaseUser & Auth & UserExtra\n **/\n\nexport type BaseUser = {\n readonly id: string,\n\n readonly displayName: string | null,\n\n /**\n * The user's email address.\n *\n * Note: This might NOT be unique across multiple users, so always use `id` for unique identification.\n */\n readonly primaryEmail: string | null,\n readonly primaryEmailVerified: boolean,\n readonly profileImageUrl: string | null,\n\n readonly signedUpAt: Date,\n\n readonly clientMetadata: any,\n readonly clientReadOnlyMetadata: any,\n\n /**\n * Whether the user has a password set.\n */\n readonly hasPassword: boolean,\n readonly otpAuthEnabled: boolean,\n readonly passkeyAuthEnabled: boolean,\n\n readonly isMultiFactorRequired: boolean,\n readonly isAnonymous: boolean,\n /**\n * Whether the user is in restricted state (signed up but hasn't completed onboarding requirements).\n * For example, if email verification is required but the user hasn't verified their email yet.\n */\n readonly isRestricted: boolean,\n /**\n * The reason why the user is restricted, e.g., { type: \"email_not_verified\" }, { type: \"anonymous\" }, or { type: \"restricted_by_administrator\" }.\n * Null if the user is not restricted.\n */\n readonly restrictedReason: RestrictedReason | null,\n /** Whether the user is restricted by an administrator. Can be set manually or by sign-up rules. */\n readonly restrictedByAdmin: boolean,\n /**\n * Public reason shown to the user explaining why an administrator restricted them, or null if none was given.\n *\n * This is intentionally readable by the user themselves (unlike `restrictedByAdminPrivateDetails`, which is\n * server-only), so onboarding screens can tell them why they can't continue.\n */\n readonly restrictedByAdminReason: string | null,\n toClientJson(): CurrentUserCrud[\"Client\"][\"Read\"],\n\n /**\n * @deprecated, use contact channel's usedForAuth instead\n */\n readonly emailAuthEnabled: boolean,\n /**\n * @deprecated\n */\n readonly oauthProviders: readonly { id: string }[],\n}\n\nexport type UserExtra = {\n setDisplayName(displayName: string | null): Promise<void>,\n /** @deprecated Use contact channel's sendVerificationEmail instead */\n sendVerificationEmail(): Promise<KnownErrors[\"EmailAlreadyVerified\"] | void>,\n setClientMetadata(metadata: any): Promise<void>,\n updatePassword(options: { oldPassword: string, newPassword: string}): Promise<KnownErrors[\"PasswordConfirmationMismatch\"] | KnownErrors[\"PasswordRequirementsNotMet\"] | void>,\n setPassword(options: { password: string }): Promise<KnownErrors[\"PasswordRequirementsNotMet\"] | void>,\n\n /**\n * A shorthand method to update multiple fields of the user at once.\n */\n update(update: UserUpdateOptions): Promise<void>,\n\n listContactChannels(): Promise<ContactChannel[]>,\n createContactChannel(data: ContactChannelCreateOptions): Promise<ContactChannel>,\n\n listNotificationCategories(): Promise<NotificationCategory[]>,\n\n delete(): Promise<void>,\n\n /** @deprecated Use `getOrLinkConnectedAccount` for redirect behavior, or `getConnectedAccount({ provider, providerAccountId })` for existence check. */\n getConnectedAccount(id: ProviderType, options: { or: 'redirect', scopes?: string[] }): Promise<DeprecatedOAuthConnection>,\n /** @deprecated Use `getConnectedAccount({ provider, providerAccountId })` for existence check, or `getOrLinkConnectedAccount` for redirect behavior. */\n getConnectedAccount(id: ProviderType, options?: { or?: 'redirect' | 'throw' | 'return-null', scopes?: string[] }): Promise<DeprecatedOAuthConnection | null>,\n /** Get a specific connected account by provider and providerAccountId. Returns null if not found. */\n getConnectedAccount(account: { provider: string, providerAccountId: string }): Promise<OAuthConnection | null>,\n\n\n /** List all connected accounts for this user (only those with allowConnectedAccounts enabled). */\n listConnectedAccounts(): Promise<OAuthConnection[]>,\n /** React hook to list all connected accounts. */\n /** Redirect the user to the OAuth flow to link a new connected account. Always redirects, never returns. */\n linkConnectedAccount(provider: string, options?: { scopes?: string[] }): Promise<void>,\n /** Get a connected account for the given provider, or redirect to link one if none exists or the token/scopes are insufficient. */\n getOrLinkConnectedAccount(provider: string, options?: { scopes?: string[] }): Promise<OAuthConnection>,\n /** React hook: get a connected account for the given provider, or redirect to link one if none exists or the token/scopes are insufficient. */\n\n hasPermission(scope: Team, permissionId: string): Promise<boolean>,\n hasPermission(permissionId: string): Promise<boolean>,\n\n getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>,\n getPermission(permissionId: string): Promise<TeamPermission | null>,\n\n listPermissions(scope: Team, options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n listPermissions(options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n\n\n readonly selectedTeam: Team | null,\n setSelectedTeam(teamOrId: string | Team | null): Promise<void>,\n createTeam(data: TeamCreateOptions): Promise<Team>,\n leaveTeam(team: Team): Promise<void>,\n\n /**\n * Lists all pending team invitations sent to any of the current user's verified email addresses.\n *\n * This allows the user to discover which teams have invited them, even if they haven't\n * joined those teams yet. Only invitations sent to verified email addresses are included.\n *\n * @returns An array of `ReceivedTeamInvitation` objects, each containing the team ID, team\n * display name, recipient email, and expiration date.\n *\n * @example\n * ```ts\n * const invitations = await user.listTeamInvitations();\n * for (const invitation of invitations) {\n * console.log(`Invited to ${invitation.teamDisplayName} via ${invitation.recipientEmail}`);\n * }\n * ```\n */\n listTeamInvitations(): Promise<ReceivedTeamInvitation[]>,\n /**\n * Lists all pending team invitations sent to any of the current user's verified email addresses.\n *\n * React hook version of `listTeamInvitations()`. Automatically re-renders when invitations change.\n */\n\n getActiveSessions(): Promise<ActiveSession[]>,\n revokeSession(sessionId: string): Promise<void>,\n getTeamProfile(team: Team): Promise<EditableTeamMemberProfile>,\n\n createApiKey(options: ApiKeyCreationOptions<\"user\">): Promise<UserApiKeyFirstView>,\n\n listOAuthProviders(): Promise<OAuthProvider[]>,\n\n getOAuthProvider(id: string): Promise<OAuthProvider | null>,\n\n registerPasskey(options?: { hostname?: string }): Promise<Result<undefined, KnownErrors[\"PasskeyRegistrationFailed\"] | KnownErrors[\"PasskeyWebAuthnError\"]>>,\n}\n& AsyncStoreProperty<\"apiKeys\", [], UserApiKey[], true>\n& AsyncStoreProperty<\"team\", [id: string], Team | null, false>\n& AsyncStoreProperty<\"teams\", [], Team[], true>\n& AsyncStoreProperty<\"teamInvitations\", [], ReceivedTeamInvitation[], true>\n& AsyncStoreProperty<\"permission\", [scope: Team, permissionId: string, options?: { recursive?: boolean }], TeamPermission | null, false>\n& AsyncStoreProperty<\"permissions\", [scope: Team, options?: { recursive?: boolean }], TeamPermission[], true>;\n\nexport type InternalUserExtra =\n & {\n createProject(newProject: AdminProjectCreateOptions): Promise<AdminOwnedProject>,\n transferProject(projectIdToTransfer: string, newTeamId: string): Promise<void>,\n }\n & AsyncStoreProperty<\"ownedProjects\", [], AdminOwnedProject[], true>\n\nexport type User = BaseUser;\n\nexport type CurrentUser = BaseUser & Auth & UserExtra & Customer;\n\nexport type CurrentInternalUser = CurrentUser & InternalUserExtra;\n\nexport type ProjectCurrentUser<ProjectId> = ProjectId extends \"internal\" ? CurrentInternalUser : CurrentUser;\n\nexport type TokenPartialUser = Pick<\n User,\n | \"id\"\n | \"displayName\"\n | \"primaryEmail\"\n | \"primaryEmailVerified\"\n | \"isAnonymous\"\n | \"isMultiFactorRequired\"\n | \"isRestricted\"\n | \"restrictedReason\"\n>\n\nexport type SyncedPartialUser = TokenPartialUser & Pick<\n User,\n | \"id\"\n | \"displayName\"\n | \"primaryEmail\"\n | \"primaryEmailVerified\"\n | \"profileImageUrl\"\n | \"signedUpAt\"\n | \"clientMetadata\"\n | \"clientReadOnlyMetadata\"\n | \"isAnonymous\"\n | \"hasPassword\"\n | \"isRestricted\"\n | \"restrictedReason\"\n>;\n\n\nexport type ActiveSession = {\n id: string,\n userId: string,\n createdAt: Date,\n isImpersonation: boolean,\n lastUsedAt: Date | undefined,\n isCurrentSession: boolean,\n geoInfo?: GeoInfo,\n};\n\nexport type UserUpdateOptions = {\n displayName?: string | null,\n clientMetadata?: ReadonlyJson,\n selectedTeamId?: string | null,\n totpMultiFactorSecret?: Uint8Array | null,\n profileImageUrl?: string | null,\n otpAuthEnabled?: boolean,\n passkeyAuthEnabled?: boolean,\n primaryEmail?: string | null,\n}\nexport function userUpdateOptionsToCrud(options: UserUpdateOptions): CurrentUserCrud[\"Client\"][\"Update\"] {\n return {\n display_name: options.displayName,\n client_metadata: options.clientMetadata,\n selected_team_id: options.selectedTeamId,\n totp_secret_base64: options.totpMultiFactorSecret != null ? encodeBase64(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,\n profile_image_url: options.profileImageUrl,\n otp_auth_enabled: options.otpAuthEnabled,\n passkey_auth_enabled: options.passkeyAuthEnabled,\n primary_email: options.primaryEmail,\n };\n}\n\n\nexport type ServerBaseUser = {\n setPrimaryEmail(email: string | null, options?: { verified?: boolean | undefined }): Promise<void>,\n\n readonly lastActiveAt: Date,\n\n readonly serverMetadata: any,\n setServerMetadata(metadata: any): Promise<void>,\n setClientReadOnlyMetadata(metadata: any): Promise<void>,\n\n /** Private details about the restriction (e.g., which sign-up rule triggered). Only visible to server access and above. */\n readonly restrictedByAdminPrivateDetails: string | null,\n /** Best-effort ISO country code captured at sign-up time from request geo headers. */\n readonly countryCode: string | null,\n /** Server-only risk scores used during sign-up risk evaluation. */\n readonly riskScores: {\n readonly signUp: {\n readonly bot: number,\n readonly freeTrialAbuse: number,\n },\n },\n\n createTeam(data: Omit<ServerTeamCreateOptions, \"creatorUserId\">): Promise<ServerTeam>,\n\n listContactChannels(): Promise<ServerContactChannel[]>,\n createContactChannel(data: ServerContactChannelCreateOptions): Promise<ServerContactChannel>,\n\n update(user: ServerUserUpdateOptions): Promise<void>,\n\n grantPermission(scope: Team, permissionId: string): Promise<void>,\n grantPermission(permissionId: string): Promise<void>,\n\n revokePermission(scope: Team, permissionId: string): Promise<void>,\n revokePermission(permissionId: string): Promise<void>,\n\n getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>,\n getPermission(permissionId: string): Promise<TeamPermission | null>,\n\n hasPermission(scope: Team, permissionId: string): Promise<boolean>,\n hasPermission(permissionId: string): Promise<boolean>,\n\n listPermissions(scope: Team, options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n listPermissions(options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n\n\n listOAuthProviders(): Promise<ServerOAuthProvider[]>,\n\n getOAuthProvider(id: string): Promise<ServerOAuthProvider | null>,\n\n /**\n * Creates a new session object with a refresh token for this user. Can be used to impersonate them.\n */\n createSession(options?: { expiresInMillis?: number, isImpersonation?: boolean }): Promise<{\n getTokens(): Promise<{ accessToken: string | null, refreshToken: string | null }>,\n }>,\n}\n& AsyncStoreProperty<\"team\", [id: string], ServerTeam | null, false>\n& AsyncStoreProperty<\"teams\", [options?: ServerListTeamsOptions], ServerTeam[] & { nextCursor: string | null }, true>\n& AsyncStoreProperty<\"permission\", [scope: Team, permissionId: string, options?: { direct?: boolean }], AdminTeamPermission | null, false>\n& AsyncStoreProperty<\"permissions\", [scope: Team, options?: { direct?: boolean }], AdminTeamPermission[], true>;\n\n/**\n * A user including sensitive fields that should only be used on the server, never sent to the client\n * (such as sensitive information and serverMetadata).\n */\nexport type ServerUser = ServerBaseUser & BaseUser & UserExtra & Customer<true>;\n\nexport type CurrentServerUser = Auth & ServerUser;\n\nexport type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;\n\nexport type ProjectCurrentServerUser<ProjectId> = ProjectId extends \"internal\" ? CurrentInternalServerUser : CurrentServerUser;\n\nexport type SyncedPartialServerUser = SyncedPartialUser & Pick<\n ServerUser,\n | \"serverMetadata\"\n>;\n\nexport type ServerUserUpdateOptions = {\n primaryEmail?: string | null,\n primaryEmailVerified?: boolean,\n primaryEmailAuthEnabled?: boolean,\n clientReadOnlyMetadata?: ReadonlyJson,\n serverMetadata?: ReadonlyJson,\n password?: string,\n restrictedByAdmin?: boolean,\n restrictedByAdminReason?: string | null,\n restrictedByAdminPrivateDetails?: string | null,\n countryCode?: string | null,\n riskScores?: {\n signUp: {\n bot: number,\n freeTrialAbuse: number,\n },\n },\n} & UserUpdateOptions;\nexport function serverUserUpdateOptionsToCrud(options: ServerUserUpdateOptions): CurrentUserCrud[\"Server\"][\"Update\"] {\n // Base update options\n const baseUpdate: CurrentUserCrud[\"Server\"][\"Update\"] = {\n display_name: options.displayName,\n primary_email: options.primaryEmail,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n selected_team_id: options.selectedTeamId,\n primary_email_auth_enabled: options.primaryEmailAuthEnabled,\n primary_email_verified: options.primaryEmailVerified,\n password: options.password,\n profile_image_url: options.profileImageUrl,\n totp_secret_base64: options.totpMultiFactorSecret != null ? encodeBase64(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,\n };\n return {\n ...baseUpdate,\n restricted_by_admin: options.restrictedByAdmin,\n restricted_by_admin_reason: options.restrictedByAdminReason,\n restricted_by_admin_private_details: options.restrictedByAdminPrivateDetails,\n country_code: options.countryCode,\n risk_scores: options.riskScores ? {\n sign_up: {\n bot: options.riskScores.signUp.bot,\n free_trial_abuse: options.riskScores.signUp.freeTrialAbuse,\n },\n } : undefined,\n };\n}\n\n\nexport type ServerUserCreateOptions = {\n primaryEmail?: string | null,\n primaryEmailAuthEnabled?: boolean,\n password?: string,\n otpAuthEnabled?: boolean,\n displayName?: string,\n primaryEmailVerified?: boolean,\n clientMetadata?: any,\n clientReadOnlyMetadata?: any,\n serverMetadata?: any,\n countryCode?: string | null,\n riskScores?: {\n signUp: {\n bot: number,\n freeTrialAbuse: number,\n },\n },\n}\nexport function serverUserCreateOptionsToCrud(options: ServerUserCreateOptions): UsersCrud[\"Server\"][\"Create\"] {\n return {\n primary_email: options.primaryEmail,\n password: options.password,\n otp_auth_enabled: options.otpAuthEnabled,\n primary_email_auth_enabled: options.primaryEmailAuthEnabled,\n display_name: options.displayName,\n primary_email_verified: options.primaryEmailVerified,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n country_code: options.countryCode,\n risk_scores: options.riskScores ? {\n sign_up: {\n bot: options.riskScores.signUp.bot,\n free_trial_abuse: options.riskScores.signUp.freeTrialAbuse,\n },\n } : undefined,\n };\n}\n"],"mappings":";;AAwBA,MAAM,yBAAyB;AAE/B,SAAgB,yBAA2C,QAAc;CACvE,OAAO,OAAO,MAAM;CACpB,OAAO,IAAI,MAAM,QAAQ,EACvB,IAAI,QAAQ,MAAM,UAAU;EAC1B,IAAI,SAAS,QACX,OAAO,YAAY;EAErB,OAAO,OAAO;CAChB,EACF,CAAC;AACH;AAEA,SAAS,cAAqB;CAC5B,MAAM,IAAI,MAAM,sBAAsB;AACxC;AA0RA,SAAgB,wBAAwB,SAAiE;CACvG,OAAO;EACL,cAAc,QAAQ;EACtB,iBAAiB,QAAQ;EACzB,kBAAkB,QAAQ;EAC1B,oBAAoB,QAAQ,yBAAyB,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;EAClH,mBAAmB,QAAQ;EAC3B,kBAAkB,QAAQ;EAC1B,sBAAsB,QAAQ;EAC9B,eAAe,QAAQ;CACzB;AACF;AAkGA,SAAgB,8BAA8B,SAAuE;CAenH,OAAO;EAZL,cAAc,QAAQ;EACtB,eAAe,QAAQ;EACvB,iBAAiB,QAAQ;EACzB,2BAA2B,QAAQ;EACnC,iBAAiB,QAAQ;EACzB,kBAAkB,QAAQ;EAC1B,4BAA4B,QAAQ;EACpC,wBAAwB,QAAQ;EAChC,UAAU,QAAQ;EAClB,mBAAmB,QAAQ;EAC3B,oBAAoB,QAAQ,yBAAyB,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;EAIlH,qBAAqB,QAAQ;EAC7B,4BAA4B,QAAQ;EACpC,qCAAqC,QAAQ;EAC7C,cAAc,QAAQ;EACtB,aAAa,QAAQ,aAAa,EAChC,SAAS;GACP,KAAK,QAAQ,WAAW,OAAO;GAC/B,kBAAkB,QAAQ,WAAW,OAAO;EAC9C,EACF,IAAI,KAAA;CACN;AACF;AAqBA,SAAgB,8BAA8B,SAAiE;CAC7G,OAAO;EACL,eAAe,QAAQ;EACvB,UAAU,QAAQ;EAClB,kBAAkB,QAAQ;EAC1B,4BAA4B,QAAQ;EACpC,cAAc,QAAQ;EACtB,wBAAwB,QAAQ;EAChC,iBAAiB,QAAQ;EACzB,2BAA2B,QAAQ;EACnC,iBAAiB,QAAQ;EACzB,cAAc,QAAQ;EACtB,aAAa,QAAQ,aAAa,EAChC,SAAS;GACP,KAAK,QAAQ,WAAW,OAAO;GAC/B,kBAAkB,QAAQ,WAAW,OAAO;EAC9C,EACF,IAAI,KAAA;CACN;AACF"}
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { a as AdminTeamPermission, c as AdminTeamPermissionDefinitionUpdateOptio
5
5
  import { a as PlanUsageRow, i as PlanUsagePlanId, n as PlanUsageKind, r as PlanUsageNextPlanId, t as PlanUsage } from "./index-B594jg4e.js";
6
6
  import { r as OAuthConnection, t as Connection } from "./index-ClBTM-St.js";
7
7
  import { i as ServerContactChannel, t as ContactChannel } from "./index-DN04TjLM.js";
8
- import { $ as TeamCreateOptions, B as StackServerAppConstructor, D as HexclaveAdminApp, E as EmailOutboxUpdateOptions, F as StackAdminAppConstructorOptions, H as EditableTeamMemberProfile, I as HexclaveServerApp, J as ServerTeamCreateOptions, K as ServerListUsersOptions, L as HexclaveServerAppConstructor, N as StackAdminApp, O as HexclaveAdminAppConstructor, Ot as User, P as StackAdminAppConstructor, Q as Team, R as HexclaveServerAppConstructorOptions, St as ServerUser, T as EmailOutboxListResult, U as ReceivedTeamInvitation, V as StackServerAppConstructorOptions, W as SentTeamInvitation, X as ServerTeamUpdateOptions, Y as ServerTeamMemberProfile, Z as ServerTeamUser, _ as AdminProjectCreateOptions, _t as OAuthProvider, a as StackClientApp, c as StackClientAppJson, d as AdminDeploymentEnvVarOptions, et as TeamInvitation, f as AdminDeploymentRunJson, ft as CurrentInternalServerUser, g as AdminProject, h as AdminOwnedProject, ht as CurrentUser, i as HexclaveClientAppJson, it as TeamUser, k as HexclaveAdminAppConstructorOptions, l as AdminDeploymentDomainJson, m as AdminDeploymentServiceJson, mt as CurrentServerUser, n as HexclaveClientAppConstructor, o as StackClientAppConstructor, p as AdminDeploymentServiceBuildOptions, pt as CurrentInternalUser, q as ServerTeam, r as HexclaveClientAppConstructorOptions, rt as TeamUpdateOptions, s as StackClientAppConstructorOptions, t as HexclaveClientApp, tt as TeamMemberProfile, u as AdminDeploymentEnvVarJson, ut as Auth, v as AdminProjectUpdateOptions, w as EmailOutboxListOptions, x as PushedConfigSource, xt as ServerOAuthProvider, y as Project, z as StackServerApp } from "./client-app-o8N3XCYe.js";
8
+ import { $ as TeamCreateOptions, B as StackServerAppConstructor, D as HexclaveAdminApp, E as EmailOutboxUpdateOptions, F as StackAdminAppConstructorOptions, H as EditableTeamMemberProfile, I as HexclaveServerApp, J as ServerTeamCreateOptions, K as ServerListUsersOptions, L as HexclaveServerAppConstructor, N as StackAdminApp, O as HexclaveAdminAppConstructor, Ot as User, P as StackAdminAppConstructor, Q as Team, R as HexclaveServerAppConstructorOptions, St as ServerUser, T as EmailOutboxListResult, U as ReceivedTeamInvitation, V as StackServerAppConstructorOptions, W as SentTeamInvitation, X as ServerTeamUpdateOptions, Y as ServerTeamMemberProfile, Z as ServerTeamUser, _ as AdminProjectCreateOptions, _t as OAuthProvider, a as StackClientApp, c as StackClientAppJson, d as AdminDeploymentEnvVarOptions, et as TeamInvitation, f as AdminDeploymentRunJson, ft as CurrentInternalServerUser, g as AdminProject, h as AdminOwnedProject, ht as CurrentUser, i as HexclaveClientAppJson, it as TeamUser, k as HexclaveAdminAppConstructorOptions, l as AdminDeploymentDomainJson, m as AdminDeploymentServiceJson, mt as CurrentServerUser, n as HexclaveClientAppConstructor, o as StackClientAppConstructor, p as AdminDeploymentServiceBuildOptions, pt as CurrentInternalUser, q as ServerTeam, r as HexclaveClientAppConstructorOptions, rt as TeamUpdateOptions, s as StackClientAppConstructorOptions, t as HexclaveClientApp, tt as TeamMemberProfile, u as AdminDeploymentEnvVarJson, ut as Auth, v as AdminProjectUpdateOptions, w as EmailOutboxListOptions, x as PushedConfigSource, xt as ServerOAuthProvider, y as Project, z as StackServerApp } from "./client-app-DBcv6rRn.js";
9
9
  import { a as AdminProjectConfigUpdateOptions, i as AdminProjectConfig, n as AdminEmailConfig, o as OAuthProviderConfig, r as AdminOAuthProviderConfig, s as ProjectConfig, t as AdminDomainConfig } from "./index-Dq4xsW7_.js";
10
10
  import { r as getPagePrompt } from "./url-targets-BJgkwPGW.js";
11
11
  import { getConvexProvidersConfig } from "./integrations/convex.js";
@@ -1,2 +1,2 @@
1
- import { t as _HexclaveAdminAppImplIncomplete } from "../../../../admin-app-impl-BqCnEjjC.js";
1
+ import { t as _HexclaveAdminAppImplIncomplete } from "../../../../admin-app-impl-DxZSp6ov.js";
2
2
  export { _HexclaveAdminAppImplIncomplete };
@@ -1,2 +1,2 @@
1
- import { r as _HexclaveClientAppImplIncomplete } from "../../../../admin-app-impl-BqCnEjjC.js";
1
+ import { r as _HexclaveClientAppImplIncomplete } from "../../../../admin-app-impl-DxZSp6ov.js";
2
2
  export { _HexclaveClientAppImplIncomplete };
@@ -359,6 +359,7 @@ var _HexclaveClientAppImplIncomplete = class _HexclaveClientAppImplIncomplete {
359
359
  this._storedBrowserCookieTokenStore = null;
360
360
  this._mostRecentQueuedCookieRefreshIndex = 0;
361
361
  this._sessionsByTokenStoreAndSessionKey = /* @__PURE__ */ new WeakMap();
362
+ this._signInAttemptCounter = 0;
362
363
  const resolvedOptions = (0, __common_js.resolveConstructorOptions)(options);
363
364
  if (!_HexclaveClientAppImplIncomplete.LazyStackAdminAppImpl.value) throw new _hexclave_shared_dist_utils_errors.HexclaveAssertionError("Admin app implementation not initialized. Did you import the _HexclaveClientApp from hexclave-app/apps/implementations/index.ts? You can't import it directly from ./apps/implementations/client-app-impl.ts as that causes a circular dependency (see the comment at _LazyHexclaveAdminAppImpl for more details).");
364
365
  this._options = resolvedOptions;
@@ -952,8 +953,12 @@ var _HexclaveClientAppImplIncomplete = class _HexclaveClientAppImplIncomplete {
952
953
  throw new Error(`Invalid token store ${tokenStoreInit}`);
953
954
  }
954
955
  }
955
- _getSessionFromTokenStore(tokenStore) {
956
- const tokenObj = tokenStore.get();
956
+ /**
957
+ * @param overrideTokenObj The tokens to build the session for, if they haven't been written to the token store yet
958
+ * (so we can warm a sign-in's session before the token store publishes it).
959
+ */
960
+ _getSessionFromTokenStore(tokenStore, overrideTokenObj) {
961
+ const tokenObj = overrideTokenObj ?? tokenStore.get();
957
962
  const sessionKey = _hexclave_shared_dist_sessions.InternalSession.calculateSessionKey(tokenObj);
958
963
  const existing = sessionKey ? this._sessionsByTokenStoreAndSessionKey.get(tokenStore)?.get(sessionKey) : null;
959
964
  if (existing) return existing;
@@ -986,11 +991,13 @@ var _HexclaveClientAppImplIncomplete = class _HexclaveClientAppImplIncomplete {
986
991
  }
987
992
  async _signInToAccountWithTokens(tokens) {
988
993
  if (!("accessToken" in tokens) || !("refreshToken" in tokens)) throw new _hexclave_shared_dist_utils_errors.HexclaveAssertionError("Invalid tokens object; can't sign in with this", { tokens });
994
+ const attemptId = ++this._signInAttemptCounter;
989
995
  const tokenStore = this._getOrCreateTokenStore(await this._createCookieHelper());
990
- tokenStore.set(tokens);
991
- const session = this._getSessionFromTokenStore(tokenStore);
996
+ const session = this._getSessionFromTokenStore(tokenStore, tokens);
992
997
  session.updateAccessToken(tokens);
993
- (0, _hexclave_shared_dist_utils_promises.runAsynchronously)(this._currentUserCache.getOrWait([session], "write-only"));
998
+ await _hexclave_shared_dist_utils_results.Result.fromPromise(this._currentUserCache.getOrWait([session], "write-only"));
999
+ if (attemptId !== this._signInAttemptCounter) return;
1000
+ tokenStore.set(tokens);
994
1001
  }
995
1002
  _getTokenStoreInitForFreshTokens(tokens) {
996
1003
  if (tokens.accessToken == null) return;
@@ -1131,6 +1138,12 @@ var _HexclaveClientAppImplIncomplete = class _HexclaveClientAppImplIncomplete {
1131
1138
  async listUsers() {
1132
1139
  return _hexclave_shared_dist_utils_results.Result.orThrow(await app._teamMemberProfilesCache.getOrWait([session, crud.id], "write-only")).map((crud) => app._clientTeamUserFromCrud(crud));
1133
1140
  },
1141
+ async removeUser(userId) {
1142
+ await app._interface.removeUserFromTeam(crud.id, userId, session);
1143
+ await app._teamMemberProfilesCache.refresh([session, crud.id]);
1144
+ await app._currentUserTeamsCache.refresh([session]);
1145
+ await app._currentUserCache.refresh([session]);
1146
+ },
1134
1147
  async listInvitations() {
1135
1148
  return _hexclave_shared_dist_utils_results.Result.orThrow(await app._teamInvitationsCache.getOrWait([session, crud.id], "write-only")).map((crud) => app._clientSentTeamInvitationFromCrud(session, crud));
1136
1149
  },
@@ -1331,6 +1344,8 @@ var _HexclaveClientAppImplIncomplete = class _HexclaveClientAppImplIncomplete {
1331
1344
  isAnonymous: crud.is_anonymous,
1332
1345
  isRestricted: crud.is_restricted,
1333
1346
  restrictedReason: crud.restricted_reason,
1347
+ restrictedByAdmin: crud.restricted_by_admin,
1348
+ restrictedByAdminReason: crud.restricted_by_admin_reason,
1334
1349
  toClientJson() {
1335
1350
  return crud;
1336
1351
  }
@@ -1404,6 +1419,8 @@ var _HexclaveClientAppImplIncomplete = class _HexclaveClientAppImplIncomplete {
1404
1419
  },
1405
1420
  async leaveTeam(team) {
1406
1421
  await app._interface.leaveTeam(team.id, session);
1422
+ await app._currentUserTeamsCache.refresh([session]);
1423
+ await app._currentUserCache.refresh([session]);
1407
1424
  },
1408
1425
  async listTeamInvitations() {
1409
1426
  return _hexclave_shared_dist_utils_results.Result.orThrow(await app._currentUserTeamInvitationsCache.getOrWait([session], "write-only")).map((crud) => app._clientReceivedTeamInvitationFromCrud(session, crud));