@polyester/sdk 0.16.0 → 0.17.0

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 (43) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/gen/auth/v1/auth_pb.d.ts +5 -3
  3. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  4. package/dist/gen/auth/v1/auth_pb.js +1 -1
  5. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  6. package/dist/gen/auth/v1/profile_pb.d.ts +90 -2
  7. package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
  8. package/dist/gen/auth/v1/profile_pb.js +20 -2
  9. package/dist/gen/auth/v1/profile_pb.js.map +1 -1
  10. package/dist/gen/auth/v1/subaccounts_pb.d.ts +37 -8
  11. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  12. package/dist/gen/auth/v1/subaccounts_pb.js +41 -9
  13. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  14. package/dist/gen/orders/v1/orders_pb.d.ts +15 -1
  15. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  16. package/dist/gen/orders/v1/orders_pb.js +15 -1
  17. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  18. package/dist/index.d.ts +2 -2
  19. package/dist/services/auth/auth.d.ts +1 -1
  20. package/dist/services/auth/auth.d.ts.map +1 -1
  21. package/dist/services/auth/auth.js +2 -2
  22. package/dist/services/auth/auth.js.map +1 -1
  23. package/dist/services/auth/profile/profile.d.ts +9 -1
  24. package/dist/services/auth/profile/profile.d.ts.map +1 -1
  25. package/dist/services/auth/profile/profile.js +16 -1
  26. package/dist/services/auth/profile/profile.js.map +1 -1
  27. package/dist/services/auth/profile/profile.schemas.d.ts +18 -1
  28. package/dist/services/auth/profile/profile.schemas.d.ts.map +1 -1
  29. package/dist/services/auth/profile/profile.schemas.js +12 -2
  30. package/dist/services/auth/profile/profile.schemas.js.map +1 -1
  31. package/dist/services/auth/profile/profile.types.d.ts +2 -2
  32. package/dist/services/lifecycle/lifecycle.schemas.d.ts +42 -42
  33. package/dist/services/orders/orders-input.schemas.d.ts +1 -1
  34. package/dist/services/orders/orders-output.schemas.d.ts +6 -6
  35. package/dist/services/subaccounts/subaccounts.codecs.js +5 -8
  36. package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
  37. package/dist/services/subaccounts/subaccounts.schemas.d.ts +7 -7
  38. package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
  39. package/dist/services/subaccounts/subaccounts.schemas.js +2 -2
  40. package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
  41. package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
  42. package/dist/services/triggers/triggers-output.schemas.d.ts +15 -15
  43. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { AuthService as AuthService$1 } from "../../gen/auth/v1/auth_pb.js";
2
- import { OptionalPublicIdSchema, OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema } from "../../shared/schemas.js";
2
+ import { OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema } from "../../shared/schemas.js";
3
3
  import { parse } from "../../shared/validation.js";
4
4
  import { toConnectCallOptions } from "../../shared/request-options.js";
5
5
  import { ProfileService } from "./profile/profile.js";
@@ -18,7 +18,7 @@ const LoginWithWalletInputSchema = v.strictObject({
18
18
  });
19
19
  const MeSchema = v.object({
20
20
  accountId: PublicIdSchema,
21
- apiKeyId: OptionalPublicIdSchema,
21
+ apiKeyId: v.optional(v.string()),
22
22
  username: v.string(),
23
23
  session: v.optional(MfaSessionInfoSchema)
24
24
  });
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport {\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: v.string(),\n nonce: v.string(),\n signature: v.string(),\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n primaryWalletAddress: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: OptionalPublicIdSchema,\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst NonceSchema = v.object({\n nonce: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type Nonce = v.InferOutput<typeof NonceSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Requests a short-lived nonce for the given smart-account EVM address.\n * The nonce is single-purpose, replaced by subsequent requests, and expires\n * after about five minutes. The optional expiry is milliseconds since the\n * Unix epoch.\n */\n async requestLoginNonce(\n smartAccountAddress: string,\n options?: PolyesterRequestOptions,\n ): Promise<Nonce> {\n return parse(\n NonceSchema,\n await this.#publicClient.getNonce(\n { smartAccountAddress },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed login nonce for an authenticated session token and account identity returned by the auth API.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;AAoBA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB,EAAE,OAAO;CAC9B,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,sBAAsB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/C,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAID,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU;CACV,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,SAAS,oBAAoB;AAC5C,CAAC;AAID,MAAM,gCAAgC,EAAE,OAAO;CAC3C,aAAa,EAAE,OAAO;CACtB,WAAW,EAAE,SAAS,eAAe;CACrC,WAAW;CACX,UAAU,EAAE,OAAO;AACvB,CAAC;AAID,MAAM,cAAc,EAAE,OAAO;CACzB,OAAO,EAAE,OAAO;CAChB,WAAW;AACf,CAAC;;;;AAOD,IAAa,cAAb,MAAyB;CACrB;CACA;CACA;CAEA,YAAY,YAAwC,UAA6B;EAC7E,KAAKA,gBAAgB,aAAaC,eAAmB,WAAW,SAAS;EACzE,KAAKC,cAAc,aAAaD,eAAmB,WAAW,OAAO;EACrE,KAAK,UAAU,IAAI,eAAe,YAAY,QAAQ;CAC1D;;;;CAKA,MAAM,GAAG,SAAgD;EACrD,MAAM,MAAM,MAAM,KAAKC,YAAY,GAAG,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvE,OAAO,MAAM,UAAU,GAAG;CAC9B;;;;;;;CAQA,MAAM,kBACF,qBACA,SACc;EACd,OAAO,MACH,aACA,MAAM,KAAKF,cAAc,SACrB,EAAE,oBAAoB,GACtB,qBAAqB,OAAO,CAChC,CACJ;CACJ;;;;CAKA,MAAgB,gBACZ,OACA,SACgC;EAChC,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
1
+ {"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: v.string(),\n nonce: v.string(),\n signature: v.string(),\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n primaryWalletAddress: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: v.optional(v.string()),\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst NonceSchema = v.object({\n nonce: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type Nonce = v.InferOutput<typeof NonceSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Requests a short-lived nonce for the given smart-account EVM address.\n * The nonce is single-purpose, replaced by subsequent requests, and expires\n * after about five minutes. The optional expiry is milliseconds since the\n * Unix epoch.\n */\n async requestLoginNonce(\n smartAccountAddress: string,\n options?: PolyesterRequestOptions,\n ): Promise<Nonce> {\n return parse(\n NonceSchema,\n await this.#publicClient.getNonce(\n { smartAccountAddress },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed login nonce for an authenticated session token and account identity returned by the auth API.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB,EAAE,OAAO;CAC9B,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,sBAAsB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/C,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAID,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,SAAS,oBAAoB;AAC5C,CAAC;AAID,MAAM,gCAAgC,EAAE,OAAO;CAC3C,aAAa,EAAE,OAAO;CACtB,WAAW,EAAE,SAAS,eAAe;CACrC,WAAW;CACX,UAAU,EAAE,OAAO;AACvB,CAAC;AAID,MAAM,cAAc,EAAE,OAAO;CACzB,OAAO,EAAE,OAAO;CAChB,WAAW;AACf,CAAC;;;;AAOD,IAAa,cAAb,MAAyB;CACrB;CACA;CACA;CAEA,YAAY,YAAwC,UAA6B;EAC7E,KAAKA,gBAAgB,aAAaC,eAAmB,WAAW,SAAS;EACzE,KAAKC,cAAc,aAAaD,eAAmB,WAAW,OAAO;EACrE,KAAK,UAAU,IAAI,eAAe,YAAY,QAAQ;CAC1D;;;;CAKA,MAAM,GAAG,SAAgD;EACrD,MAAM,MAAM,MAAM,KAAKC,YAAY,GAAG,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvE,OAAO,MAAM,UAAU,GAAG;CAC9B;;;;;;;CAQA,MAAM,kBACF,qBACA,SACc;EACd,OAAO,MACH,aACA,MAAM,KAAKF,cAAc,SACrB,EAAE,oBAAoB,GACtB,qBAAqB,OAAO,CAChC,CACJ;CACJ;;;;CAKA,MAAgB,gBACZ,OACA,SACgC;EAChC,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
@@ -3,7 +3,7 @@ import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../../shar
3
3
  import { PolyesterRealtime } from "../../../realtime/types.js";
4
4
  import "../../../realtime/index.js";
5
5
  import { BaseSubscribeInput } from "../../../shared/types.js";
6
- import { AccountIdentity, Profile, UpdateProfileInputSchema, UsernameHistoryEntry } from "./profile.schemas.js";
6
+ import { AccountIdentity, ClaimGeneratedUsernameInputSchema, GeneratedUsernameOffer, Profile, UpdateProfileInputSchema, UsernameHistoryEntry } from "./profile.schemas.js";
7
7
  import * as v from "valibot";
8
8
  //#region src/services/auth/profile/profile.d.ts
9
9
  interface SubscribeIdentityInput extends BaseSubscribeInput<AccountIdentity> {}
@@ -25,6 +25,14 @@ declare class ProfileService {
25
25
  * Returns the caller's recent username changes, newest first, capped at 20 entries.
26
26
  */
27
27
  getUsernameHistory(options?: PolyesterRequestOptions): Promise<UsernameHistoryEntry[]>;
28
+ /**
29
+ * Returns five generated username options and the short-lived offer token required to claim one of them.
30
+ */
31
+ generateUsernameOptions(options?: PolyesterRequestOptions): Promise<GeneratedUsernameOffer>;
32
+ /**
33
+ * Claims one username from a generated offer by its zero-based option index.
34
+ */
35
+ claimGeneratedUsername(input: v.InferInput<typeof ClaimGeneratedUsernameInputSchema>, options?: PolyesterMutationOptions): Promise<Profile>;
28
36
  /**
29
37
  * Subscribes to public identity updates and emits normalized account identity records with base58 account IDs, username, avatar URL, and root smart-account address.
30
38
  */
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.ts"],"mappings":";;;;;;;;UAuBU,+BAA+B,mBAAmB;;;;cAK/C;;EAIG,YAAA,YAAY,mBAAmB,UAAU;;;;EAQ/C,IAAI,UAAU,0BAA0B,QAAQ;;;;EAShD,OACF,OAAO,EAAE,kBAAkB,2BAC3B,UAAU,2BACX,QAAQ;;;;EAYL,mBAAmB,UAAU,0BAA0B,QAAQ;;;;EAQrE,kBAAkB,OAAO"}
1
+ {"version":3,"file":"profile.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.ts"],"mappings":";;;;;;;;UA0BU,+BAA+B,mBAAmB;;;;cAK/C;;EAIG,YAAA,YAAY,mBAAmB,UAAU;;;;EAQ/C,IAAI,UAAU,0BAA0B,QAAQ;;;;EAShD,OACF,OAAO,EAAE,kBAAkB,2BAC3B,UAAU,2BACX,QAAQ;;;;EAYL,mBAAmB,UAAU,0BAA0B,QAAQ;;;;EAQ/D,wBACF,UAAU,0BACX,QAAQ;;;;EAQL,uBACF,OAAO,EAAE,kBAAkB,oCAC3B,UAAU,2BACX,QAAQ;;;;EAYX,kBAAkB,OAAO"}
@@ -2,7 +2,7 @@ import { parse } from "../../../shared/validation.js";
2
2
  import { toConnectCallOptions } from "../../../shared/request-options.js";
3
3
  import { removeUndefined } from "../../../utils/remove-undefined.js";
4
4
  import { AccountIdentitySchema, ProfileService as ProfileService$1 } from "../../../gen/auth/v1/profile_pb.js";
5
- import { AccountIdentitySchema as AccountIdentitySchema$1, ProfileSchema, UpdateProfileInputSchema, UsernameHistoryEntrySchema } from "./profile.schemas.js";
5
+ import { AccountIdentitySchema as AccountIdentitySchema$1, ClaimGeneratedUsernameInputSchema, GeneratedUsernameOfferSchema, ProfileSchema, UpdateProfileInputSchema, UsernameHistoryEntrySchema } from "./profile.schemas.js";
6
6
  import { createClient } from "@connectrpc/connect";
7
7
  import * as v from "valibot";
8
8
  //#region src/services/auth/profile/profile.ts
@@ -40,6 +40,21 @@ var ProfileService = class {
40
40
  return parse(v.array(UsernameHistoryEntrySchema), res.history);
41
41
  }
42
42
  /**
43
+ * Returns five generated username options and the short-lived offer token required to claim one of them.
44
+ */
45
+ async generateUsernameOptions(options) {
46
+ const res = await this.#client.generateUsernameOptions({}, toConnectCallOptions(options));
47
+ return parse(GeneratedUsernameOfferSchema, res);
48
+ }
49
+ /**
50
+ * Claims one username from a generated offer by its zero-based option index.
51
+ */
52
+ async claimGeneratedUsername(input, options) {
53
+ const validatedInput = parse(ClaimGeneratedUsernameInputSchema, input);
54
+ const res = await this.#client.claimGeneratedUsername(validatedInput, toConnectCallOptions(options));
55
+ return parse(ProfileSchema, res);
56
+ }
57
+ /**
43
58
  * Subscribes to public identity updates and emits normalized account identity records with base58 account IDs, username, avatar URL, and root smart-account address.
44
59
  */
45
60
  subscribeIdentity(input) {
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","names":["#client","Proto.ProfileService","#realtime","Proto.AccountIdentitySchema","AccountIdentitySchema"],"sources":["../../../../src/services/auth/profile/profile.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../../gen/auth/v1/profile_pb.js\";\nimport type { AuthApiTransports } from \"../../../shared/transports.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport {\n AccountIdentitySchema,\n ProfileSchema,\n UpdateProfileInputSchema,\n UsernameHistoryEntrySchema,\n type AccountIdentity,\n type Profile,\n type UsernameHistoryEntry,\n} from \"./profile.schemas.js\";\nimport type { BaseSubscribeInput } from \"../../../shared/types.js\";\nimport type { PolyesterRealtime } from \"../../../realtime/index.js\";\n\ninterface SubscribeIdentityInput extends BaseSubscribeInput<AccountIdentity> {}\n\n/**\n * Manages the authenticated account's public profile and realtime identity updates.\n */\nexport class ProfileService {\n #client: Client<typeof Proto.ProfileService>;\n #realtime: PolyesterRealtime;\n\n constructor(transports: AuthApiTransports, realtime: PolyesterRealtime) {\n this.#client = createClient(Proto.ProfileService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Fetches the caller's public profile, including username eligibility/cooldown, verified social handles, avatar, VIP tier, and account creation timestamp.\n */\n async get(options?: PolyesterRequestOptions): Promise<Profile> {\n const res = await this.#client.getProfile({}, toConnectCallOptions(options));\n if (!res) throw new Error(\"Profile not found\");\n return parse(ProfileSchema, res);\n }\n\n /**\n * Updates only the provided mutable profile fields; omitted fields are unchanged, while present empty strings clear optional text fields such as bio, website, Twitter, and avatar URL.\n */\n async update(\n input: v.InferInput<typeof UpdateProfileInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Profile> {\n const validatedInput = parse(UpdateProfileInputSchema, input);\n const res = await this.#client.updateProfile(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(ProfileSchema, res);\n }\n\n /**\n * Returns the caller's recent username changes, newest first, capped at 20 entries.\n */\n async getUsernameHistory(options?: PolyesterRequestOptions): Promise<UsernameHistoryEntry[]> {\n const res = await this.#client.getUsernameHistory({}, toConnectCallOptions(options));\n return parse(v.array(UsernameHistoryEntrySchema), res.history);\n }\n\n /**\n * Subscribes to public identity updates and emits normalized account identity records with base58 account IDs, username, avatar URL, and root smart-account address.\n */\n subscribeIdentity(input: SubscribeIdentityInput): () => void {\n const channel = \"public:identity:updates:proto\";\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.AccountIdentitySchema,\n onPublication: (data) => {\n const identity = parse(AccountIdentitySchema, data);\n input.onEvent(identity);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AA4BA,IAAa,iBAAb,MAA4B;CACxB;CACA;CAEA,YAAY,YAA+B,UAA6B;EACpE,KAAKA,UAAU,aAAaC,kBAAsB,WAAW,OAAO;EACpE,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,IAAI,SAAqD;EAC3D,MAAM,MAAM,MAAM,KAAKF,QAAQ,WAAW,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAC3E,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,mBAAmB;EAC7C,OAAO,MAAM,eAAe,GAAG;CACnC;;;;CAKA,MAAM,OACF,OACA,SACgB;EAChB,MAAM,iBAAiB,MAAM,0BAA0B,KAAK;EAC5D,MAAM,MAAM,MAAM,KAAKA,QAAQ,cAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,eAAe,GAAG;CACnC;;;;CAKA,MAAM,mBAAmB,SAAoE;EACzF,MAAM,MAAM,MAAM,KAAKA,QAAQ,mBAAmB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACnF,OAAO,MAAM,EAAE,MAAM,0BAA0B,GAAG,IAAI,OAAO;CACjE;;;;CAKA,kBAAkB,OAA2C;EAEzD,OAAO,KAAKE,UAAU,oBAAoB;GACtC,SAAA;GACA,QAAQC;GACR,gBAAgB,SAAS;IACrB,MAAM,WAAW,MAAMC,yBAAuB,IAAI;IAClD,MAAM,QAAQ,QAAQ;GAC1B;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
1
+ {"version":3,"file":"profile.js","names":["#client","Proto.ProfileService","#realtime","Proto.AccountIdentitySchema","AccountIdentitySchema"],"sources":["../../../../src/services/auth/profile/profile.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../../gen/auth/v1/profile_pb.js\";\nimport type { AuthApiTransports } from \"../../../shared/transports.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport {\n AccountIdentitySchema,\n ClaimGeneratedUsernameInputSchema,\n GeneratedUsernameOfferSchema,\n ProfileSchema,\n UpdateProfileInputSchema,\n UsernameHistoryEntrySchema,\n type AccountIdentity,\n type GeneratedUsernameOffer,\n type Profile,\n type UsernameHistoryEntry,\n} from \"./profile.schemas.js\";\nimport type { BaseSubscribeInput } from \"../../../shared/types.js\";\nimport type { PolyesterRealtime } from \"../../../realtime/index.js\";\n\ninterface SubscribeIdentityInput extends BaseSubscribeInput<AccountIdentity> {}\n\n/**\n * Manages the authenticated account's public profile and realtime identity updates.\n */\nexport class ProfileService {\n #client: Client<typeof Proto.ProfileService>;\n #realtime: PolyesterRealtime;\n\n constructor(transports: AuthApiTransports, realtime: PolyesterRealtime) {\n this.#client = createClient(Proto.ProfileService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Fetches the caller's public profile, including username eligibility/cooldown, verified social handles, avatar, VIP tier, and account creation timestamp.\n */\n async get(options?: PolyesterRequestOptions): Promise<Profile> {\n const res = await this.#client.getProfile({}, toConnectCallOptions(options));\n if (!res) throw new Error(\"Profile not found\");\n return parse(ProfileSchema, res);\n }\n\n /**\n * Updates only the provided mutable profile fields; omitted fields are unchanged, while present empty strings clear optional text fields such as bio, website, Twitter, and avatar URL.\n */\n async update(\n input: v.InferInput<typeof UpdateProfileInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Profile> {\n const validatedInput = parse(UpdateProfileInputSchema, input);\n const res = await this.#client.updateProfile(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(ProfileSchema, res);\n }\n\n /**\n * Returns the caller's recent username changes, newest first, capped at 20 entries.\n */\n async getUsernameHistory(options?: PolyesterRequestOptions): Promise<UsernameHistoryEntry[]> {\n const res = await this.#client.getUsernameHistory({}, toConnectCallOptions(options));\n return parse(v.array(UsernameHistoryEntrySchema), res.history);\n }\n\n /**\n * Returns five generated username options and the short-lived offer token required to claim one of them.\n */\n async generateUsernameOptions(\n options?: PolyesterRequestOptions,\n ): Promise<GeneratedUsernameOffer> {\n const res = await this.#client.generateUsernameOptions({}, toConnectCallOptions(options));\n return parse(GeneratedUsernameOfferSchema, res);\n }\n\n /**\n * Claims one username from a generated offer by its zero-based option index.\n */\n async claimGeneratedUsername(\n input: v.InferInput<typeof ClaimGeneratedUsernameInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Profile> {\n const validatedInput = parse(ClaimGeneratedUsernameInputSchema, input);\n const res = await this.#client.claimGeneratedUsername(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(ProfileSchema, res);\n }\n\n /**\n * Subscribes to public identity updates and emits normalized account identity records with base58 account IDs, username, avatar URL, and root smart-account address.\n */\n subscribeIdentity(input: SubscribeIdentityInput): () => void {\n const channel = \"public:identity:updates:proto\";\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.AccountIdentitySchema,\n onPublication: (data) => {\n const identity = parse(AccountIdentitySchema, data);\n input.onEvent(identity);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AA+BA,IAAa,iBAAb,MAA4B;CACxB;CACA;CAEA,YAAY,YAA+B,UAA6B;EACpE,KAAKA,UAAU,aAAaC,kBAAsB,WAAW,OAAO;EACpE,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,IAAI,SAAqD;EAC3D,MAAM,MAAM,MAAM,KAAKF,QAAQ,WAAW,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAC3E,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,mBAAmB;EAC7C,OAAO,MAAM,eAAe,GAAG;CACnC;;;;CAKA,MAAM,OACF,OACA,SACgB;EAChB,MAAM,iBAAiB,MAAM,0BAA0B,KAAK;EAC5D,MAAM,MAAM,MAAM,KAAKA,QAAQ,cAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,eAAe,GAAG;CACnC;;;;CAKA,MAAM,mBAAmB,SAAoE;EACzF,MAAM,MAAM,MAAM,KAAKA,QAAQ,mBAAmB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACnF,OAAO,MAAM,EAAE,MAAM,0BAA0B,GAAG,IAAI,OAAO;CACjE;;;;CAKA,MAAM,wBACF,SAC+B;EAC/B,MAAM,MAAM,MAAM,KAAKA,QAAQ,wBAAwB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACxF,OAAO,MAAM,8BAA8B,GAAG;CAClD;;;;CAKA,MAAM,uBACF,OACA,SACgB;EAChB,MAAM,iBAAiB,MAAM,mCAAmC,KAAK;EACrE,MAAM,MAAM,MAAM,KAAKA,QAAQ,uBAC3B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,eAAe,GAAG;CACnC;;;;CAKA,kBAAkB,OAA2C;EAEzD,OAAO,KAAKE,UAAU,oBAAoB;GACtC,SAAA;GACA,QAAQC;GACR,gBAAgB,SAAS;IACrB,MAAM,WAAW,MAAMC,yBAAuB,IAAI;IAClD,MAAM,QAAQ,QAAQ;GAC1B;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
@@ -46,6 +46,23 @@ declare const UsernameHistoryEntrySchema: v.ObjectSchema<{
46
46
  } | undefined, number | undefined>]>;
47
47
  }, undefined>;
48
48
  type UsernameHistoryEntry = v.InferOutput<typeof UsernameHistoryEntrySchema>;
49
+ declare const GeneratedUsernameOfferSchema: v.ObjectSchema<{
50
+ readonly usernames: v.ArraySchema<v.StringSchema<undefined>, undefined>;
51
+ readonly offerToken: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
52
+ readonly expiresAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
53
+ readonly seconds: v.BigintSchema<undefined>;
54
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
55
+ }, undefined>, undefined>, v.TransformAction<{
56
+ seconds: bigint;
57
+ nanos: number;
58
+ } | undefined, number | undefined>]>;
59
+ }, undefined>;
60
+ type GeneratedUsernameOffer = v.InferOutput<typeof GeneratedUsernameOfferSchema>;
61
+ declare const ClaimGeneratedUsernameInputSchema: v.StrictObjectSchema<{
62
+ readonly offerToken: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
63
+ readonly optionIndex: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
64
+ }, undefined>;
65
+ type ClaimGeneratedUsernameInput = v.InferInput<typeof ClaimGeneratedUsernameInputSchema>;
49
66
  declare const AccountIdentitySchema: v.ObjectSchema<{
50
67
  readonly accountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
51
68
  readonly username: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -54,5 +71,5 @@ declare const AccountIdentitySchema: v.ObjectSchema<{
54
71
  }, undefined>;
55
72
  type AccountIdentity = v.InferOutput<typeof AccountIdentitySchema>;
56
73
  //#endregion
57
- export { AccountIdentity, AccountIdentitySchema, Profile, ProfileSchema, UpdateProfileInput, UpdateProfileInputSchema, UsernameHistoryEntry, UsernameHistoryEntrySchema };
74
+ export { AccountIdentity, AccountIdentitySchema, ClaimGeneratedUsernameInput, ClaimGeneratedUsernameInputSchema, GeneratedUsernameOffer, GeneratedUsernameOfferSchema, Profile, ProfileSchema, UpdateProfileInput, UpdateProfileInputSchema, UsernameHistoryEntry, UsernameHistoryEntrySchema };
58
75
  //# sourceMappingURL=profile.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile.schemas.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"mappings":";;cAIa,eAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KAqBd,UAAU,EAAE,mBAAmB;cAG9B,0BAAwB,EAAA;;;;;;;KAOzB,qBAAqB,EAAE,kBAAkB;cAExC,4BAA0B,EAAA;;;;;;;;;;KAQ3B,uBAAuB,EAAE,mBAAmB;cAE3C,uBAAqB,EAAA;;;;;;KAOtB,kBAAkB,EAAE,mBAAmB"}
1
+ {"version":3,"file":"profile.schemas.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"mappings":";;cASa,eAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KAqBd,UAAU,EAAE,mBAAmB;cAG9B,0BAAwB,EAAA;;;;;;;KAOzB,qBAAqB,EAAE,kBAAkB;cAExC,4BAA0B,EAAA;;;;;;;;;;KAQ3B,uBAAuB,EAAE,mBAAmB;cAE3C,8BAA4B,EAAA;;;;;;;;;;;KAM7B,yBAAyB,EAAE,mBAAmB;cAE7C,mCAAiC,EAAA;;;;KAKlC,8BAA8B,EAAE,kBAAkB;cAEjD,uBAAqB,EAAA;;;;;;KAOtB,kBAAkB,EAAE,mBAAmB"}
@@ -1,5 +1,6 @@
1
1
  import { tsObjToMs } from "../../../utils/time.js";
2
- import { PublicIdSchema, TimestampSchema } from "../../../shared/schemas.js";
2
+ import { PROTOBUF_UINT32_MAX } from "../../../shared/wire-bounds.js";
3
+ import { OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema } from "../../../shared/schemas.js";
3
4
  import * as v from "valibot";
4
5
  //#region src/services/auth/profile/profile.schemas.ts
5
6
  const ProfileSchema = v.object({
@@ -27,6 +28,15 @@ const UsernameHistoryEntrySchema = v.object({
27
28
  username: v.string(),
28
29
  setAt: v.pipe(v.optional(TimestampSchema), v.transform((v) => v ? tsObjToMs(v) : void 0))
29
30
  });
31
+ const GeneratedUsernameOfferSchema = v.object({
32
+ usernames: v.array(v.string()),
33
+ offerToken: v.pipe(v.string(), v.minLength(1)),
34
+ expiresAt: OptionalTimestampMsSchema
35
+ });
36
+ const ClaimGeneratedUsernameInputSchema = v.strictObject({
37
+ offerToken: v.pipe(v.string(), v.minLength(1)),
38
+ optionIndex: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX))
39
+ });
30
40
  const AccountIdentitySchema = v.object({
31
41
  accountId: PublicIdSchema,
32
42
  username: v.optional(v.string()),
@@ -34,6 +44,6 @@ const AccountIdentitySchema = v.object({
34
44
  rootSmartAccountAddress: v.string()
35
45
  });
36
46
  //#endregion
37
- export { AccountIdentitySchema, ProfileSchema, UpdateProfileInputSchema, UsernameHistoryEntrySchema };
47
+ export { AccountIdentitySchema, ClaimGeneratedUsernameInputSchema, GeneratedUsernameOfferSchema, ProfileSchema, UpdateProfileInputSchema, UsernameHistoryEntrySchema };
38
48
 
39
49
  //# sourceMappingURL=profile.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile.schemas.js","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { PublicIdSchema, TimestampSchema } from \"../../../shared/schemas.js\";\nimport { tsObjToMs } from \"../../../utils/time.js\";\n\nexport const ProfileSchema = v.object({\n username: v.string(),\n bio: v.string(),\n website: v.string(),\n twitter: v.string(),\n twitterVerified: v.optional(v.boolean(), false),\n discord: v.string(),\n discordVerified: v.optional(v.boolean(), false),\n avatarUrl: v.string(),\n createdAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n nextUsernameChangeAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n vipTier: v.number(),\n usernameUnlocked: v.optional(v.boolean(), false),\n});\n\nexport type Profile = v.InferOutput<typeof ProfileSchema>;\n// Deliberately non-strict: update() accepts a round-tripped Profile\n// ({ ...profile, bio }) and strips its readonly fields instead of rejecting.\nexport const UpdateProfileInputSchema = v.object({\n username: v.optional(v.string()),\n bio: v.optional(v.string()),\n website: v.optional(v.string()),\n twitter: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n});\nexport type UpdateProfileInput = v.InferInput<typeof UpdateProfileInputSchema>;\n\nexport const UsernameHistoryEntrySchema = v.object({\n username: v.string(),\n setAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n});\n\nexport type UsernameHistoryEntry = v.InferOutput<typeof UsernameHistoryEntrySchema>;\n\nexport const AccountIdentitySchema = v.object({\n accountId: PublicIdSchema,\n username: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n rootSmartAccountAddress: v.string(),\n});\n\nexport type AccountIdentity = v.InferOutput<typeof AccountIdentitySchema>;\n"],"mappings":";;;;AAIA,MAAa,gBAAgB,EAAE,OAAO;CAClC,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,KACT,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,sBAAsB,EAAE,KACpB,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,SAAS,EAAE,OAAO;CAClB,kBAAkB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AACnD,CAAC;AAKD,MAAa,2BAA2B,EAAE,OAAO;CAC7C,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;CAC1B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;AACpC,CAAC;AAGD,MAAa,6BAA6B,EAAE,OAAO;CAC/C,UAAU,EAAE,OAAO;CACnB,OAAO,EAAE,KACL,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;AACJ,CAAC;AAID,MAAa,wBAAwB,EAAE,OAAO;CAC1C,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,yBAAyB,EAAE,OAAO;AACtC,CAAC"}
1
+ {"version":3,"file":"profile.schemas.js","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport { tsObjToMs } from \"../../../utils/time.js\";\n\nexport const ProfileSchema = v.object({\n username: v.string(),\n bio: v.string(),\n website: v.string(),\n twitter: v.string(),\n twitterVerified: v.optional(v.boolean(), false),\n discord: v.string(),\n discordVerified: v.optional(v.boolean(), false),\n avatarUrl: v.string(),\n createdAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n nextUsernameChangeAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n vipTier: v.number(),\n usernameUnlocked: v.optional(v.boolean(), false),\n});\n\nexport type Profile = v.InferOutput<typeof ProfileSchema>;\n// Deliberately non-strict: update() accepts a round-tripped Profile\n// ({ ...profile, bio }) and strips its readonly fields instead of rejecting.\nexport const UpdateProfileInputSchema = v.object({\n username: v.optional(v.string()),\n bio: v.optional(v.string()),\n website: v.optional(v.string()),\n twitter: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n});\nexport type UpdateProfileInput = v.InferInput<typeof UpdateProfileInputSchema>;\n\nexport const UsernameHistoryEntrySchema = v.object({\n username: v.string(),\n setAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n});\n\nexport type UsernameHistoryEntry = v.InferOutput<typeof UsernameHistoryEntrySchema>;\n\nexport const GeneratedUsernameOfferSchema = v.object({\n usernames: v.array(v.string()),\n offerToken: v.pipe(v.string(), v.minLength(1)),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type GeneratedUsernameOffer = v.InferOutput<typeof GeneratedUsernameOfferSchema>;\n\nexport const ClaimGeneratedUsernameInputSchema = v.strictObject({\n offerToken: v.pipe(v.string(), v.minLength(1)),\n optionIndex: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n});\n\nexport type ClaimGeneratedUsernameInput = v.InferInput<typeof ClaimGeneratedUsernameInputSchema>;\n\nexport const AccountIdentitySchema = v.object({\n accountId: PublicIdSchema,\n username: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n rootSmartAccountAddress: v.string(),\n});\n\nexport type AccountIdentity = v.InferOutput<typeof AccountIdentitySchema>;\n"],"mappings":";;;;;AASA,MAAa,gBAAgB,EAAE,OAAO;CAClC,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,KACT,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,sBAAsB,EAAE,KACpB,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,SAAS,EAAE,OAAO;CAClB,kBAAkB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AACnD,CAAC;AAKD,MAAa,2BAA2B,EAAE,OAAO;CAC7C,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;CAC1B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;AACpC,CAAC;AAGD,MAAa,6BAA6B,EAAE,OAAO;CAC/C,UAAU,EAAE,OAAO;CACnB,OAAO,EAAE,KACL,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;AACJ,CAAC;AAID,MAAa,+BAA+B,EAAE,OAAO;CACjD,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;CAC7B,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,CAAC;CAC7C,WAAW;AACf,CAAC;AAID,MAAa,oCAAoC,EAAE,aAAa;CAC5D,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,CAAC;CAC7C,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,mBAAmB,CAAC;AAC/F,CAAC;AAID,MAAa,wBAAwB,EAAE,OAAO;CAC1C,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,yBAAyB,EAAE,OAAO;AACtC,CAAC"}
@@ -1,2 +1,2 @@
1
- import { AccountIdentity, Profile, UpdateProfileInput, UsernameHistoryEntry } from "./profile.schemas.js";
2
- export type { AccountIdentity, Profile, UpdateProfileInput, UsernameHistoryEntry };
1
+ import { AccountIdentity, ClaimGeneratedUsernameInput, GeneratedUsernameOffer, Profile, UpdateProfileInput, UsernameHistoryEntry } from "./profile.schemas.js";
2
+ export type { AccountIdentity, ClaimGeneratedUsernameInput, GeneratedUsernameOffer, Profile, UpdateProfileInput, UsernameHistoryEntry };