@polyester/sdk 0.16.0 → 0.18.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.
- package/CHANGELOG.md +22 -0
- package/dist/gen/auth/v1/auth_pb.d.ts +5 -3
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +1 -1
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +90 -2
- package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js +20 -2
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts +35 -6
- package/dist/gen/auth/v1/resolve_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.js +34 -2
- package/dist/gen/auth/v1/resolve_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +72 -16
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +73 -9
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +139 -15
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +139 -3
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/services/accounts/accounts.codecs.js +6 -1
- package/dist/services/accounts/accounts.codecs.js.map +1 -1
- package/dist/services/accounts/accounts.schemas.d.ts +2 -2
- package/dist/services/accounts/accounts.schemas.d.ts.map +1 -1
- package/dist/services/accounts/accounts.schemas.js +4 -3
- package/dist/services/accounts/accounts.schemas.js.map +1 -1
- package/dist/services/auth/auth.d.ts +1 -1
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +2 -2
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/profile/profile.d.ts +9 -1
- package/dist/services/auth/profile/profile.d.ts.map +1 -1
- package/dist/services/auth/profile/profile.js +16 -1
- package/dist/services/auth/profile/profile.js.map +1 -1
- package/dist/services/auth/profile/profile.schemas.d.ts +18 -1
- package/dist/services/auth/profile/profile.schemas.d.ts.map +1 -1
- package/dist/services/auth/profile/profile.schemas.js +12 -2
- package/dist/services/auth/profile/profile.schemas.js.map +1 -1
- package/dist/services/auth/profile/profile.types.d.ts +2 -2
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +42 -42
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +9 -9
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +4 -4
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +8 -8
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +5 -4
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +6 -6
- package/dist/services/orders/orders.codecs.js +20 -1
- package/dist/services/orders/orders.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.codecs.js +16 -9
- package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.js +1 -1
- package/dist/services/subaccounts/subaccounts.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +12 -12
- package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.js +4 -8
- package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +18 -18
- package/package.json +1 -1
|
@@ -11,7 +11,12 @@ const ResolveHintCodec = {
|
|
|
11
11
|
keyToProto,
|
|
12
12
|
keyToProtoLookup: keyToProto
|
|
13
13
|
};
|
|
14
|
+
const ResolvedAccountKindCodec = { protoToOutput: {
|
|
15
|
+
[0]: "unspecified",
|
|
16
|
+
[1]: "root",
|
|
17
|
+
[2]: "sub"
|
|
18
|
+
} };
|
|
14
19
|
//#endregion
|
|
15
|
-
export { ResolveHintCodec };
|
|
20
|
+
export { ResolveHintCodec, ResolvedAccountKindCodec };
|
|
16
21
|
|
|
17
22
|
//# sourceMappingURL=accounts.codecs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.codecs.js","names":[],"sources":["../../../src/services/accounts/accounts.codecs.ts"],"sourcesContent":["import * as ProtoResolve from \"../../gen/auth/v1/resolve_pb.js\";\n\nexport const RESOLVE_HINT_KEYS = [\n \"USERNAME\",\n \"ID\",\n \"PUBLIC_ID\",\n \"SMART_ACCOUNT\",\n \"SMARTACCOUNT\",\n] as const;\nexport type ResolveHintKey = (typeof RESOLVE_HINT_KEYS)[number];\n\nconst keyToProto = {\n USERNAME: ProtoResolve.ResolveHint.USERNAME,\n ID: ProtoResolve.ResolveHint.ID,\n PUBLIC_ID: ProtoResolve.ResolveHint.ID,\n SMART_ACCOUNT: ProtoResolve.ResolveHint.SMART_ACCOUNT,\n SMARTACCOUNT: ProtoResolve.ResolveHint.SMART_ACCOUNT,\n} satisfies Record<ResolveHintKey, ProtoResolve.ResolveHint>;\n\nexport const ResolveHintCodec = {\n keyToProto,\n keyToProtoLookup: keyToProto as Record<string, ProtoResolve.ResolveHint>,\n} as const;\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"accounts.codecs.js","names":[],"sources":["../../../src/services/accounts/accounts.codecs.ts"],"sourcesContent":["import * as ProtoResolve from \"../../gen/auth/v1/resolve_pb.js\";\nimport type { ProtoToOutput } from \"../../utils/types.js\";\n\nexport const RESOLVE_HINT_KEYS = [\n \"USERNAME\",\n \"ID\",\n \"PUBLIC_ID\",\n \"SMART_ACCOUNT\",\n \"SMARTACCOUNT\",\n] as const;\nexport type ResolveHintKey = (typeof RESOLVE_HINT_KEYS)[number];\n\nconst keyToProto = {\n USERNAME: ProtoResolve.ResolveHint.USERNAME,\n ID: ProtoResolve.ResolveHint.ID,\n PUBLIC_ID: ProtoResolve.ResolveHint.ID,\n SMART_ACCOUNT: ProtoResolve.ResolveHint.SMART_ACCOUNT,\n SMARTACCOUNT: ProtoResolve.ResolveHint.SMART_ACCOUNT,\n} satisfies Record<ResolveHintKey, ProtoResolve.ResolveHint>;\n\nexport const ResolveHintCodec = {\n keyToProto,\n keyToProtoLookup: keyToProto as Record<string, ProtoResolve.ResolveHint>,\n} as const;\n\nexport const ResolvedAccountKindCodec = {\n protoToOutput: {\n [ProtoResolve.ResolvedAccount_Kind.KIND_UNSPECIFIED]: \"unspecified\",\n [ProtoResolve.ResolvedAccount_Kind.ROOT]: \"root\",\n [ProtoResolve.ResolvedAccount_Kind.SUB]: \"sub\",\n } satisfies ProtoToOutput<ProtoResolve.ResolvedAccount_Kind, \"root\" | \"sub\">,\n} as const;\n"],"mappings":";;AAYA,MAAM,aAAa;CACf,UAAA;CACA,IAAA;CACA,WAAA;CACA,eAAA;CACA,cAAA;AACJ;AAEA,MAAa,mBAAmB;CAC5B;CACA,kBAAkB;AACtB;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC2C,IAAA;EACZ,IAAA;EACD,IAAA;AAC7C,EACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResolveHint } from "../../gen/auth/v1/resolve_pb.js";
|
|
1
|
+
import { ResolveHint, ResolvedAccount_Kind } from "../../gen/auth/v1/resolve_pb.js";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/services/accounts/accounts.schemas.d.ts
|
|
4
4
|
declare const ResolveAccountInputSchema: v.ObjectSchema<{
|
|
@@ -9,7 +9,7 @@ declare const ResolveAccountInputSchema: v.ObjectSchema<{
|
|
|
9
9
|
type ResolveAccountInput = v.InferInput<typeof ResolveAccountInputSchema>;
|
|
10
10
|
declare const ResolvedAccountSchema: v.ObjectSchema<{
|
|
11
11
|
readonly smartAccountAddress: v.StringSchema<undefined>;
|
|
12
|
-
readonly kind: v.
|
|
12
|
+
readonly kind: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ResolvedAccount_Kind, undefined>, v.TransformAction<ResolvedAccount_Kind, "unspecified" | "sub" | "root">]>;
|
|
13
13
|
readonly rootUsername: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
14
14
|
readonly subaccountLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
15
15
|
readonly accountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.schemas.d.ts","names":[],"sources":["../../../src/services/accounts/accounts.schemas.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"accounts.schemas.d.ts","names":[],"sources":["../../../src/services/accounts/accounts.schemas.ts"],"mappings":";;;cAea,2BAAyB,EAAA;;;;;KAS1B,sBAAsB,EAAE,kBAAkB;cAEzC,uBAAqB,EAAA;;;;;;;KAoBtB,kBAAkB,EAAE,mBAAmB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { requiredEnumLabel } from "../../shared/proto-enum-codec.js";
|
|
1
2
|
import { PublicIdSchema } from "../../shared/schemas.js";
|
|
2
|
-
import "../../gen/auth/v1/resolve_pb.js";
|
|
3
|
-
import { ResolveHintCodec } from "./accounts.codecs.js";
|
|
3
|
+
import { ResolvedAccount_Kind } from "../../gen/auth/v1/resolve_pb.js";
|
|
4
|
+
import { ResolveHintCodec, ResolvedAccountKindCodec } from "./accounts.codecs.js";
|
|
4
5
|
import * as v from "valibot";
|
|
5
6
|
//#region src/services/accounts/accounts.schemas.ts
|
|
6
7
|
function normalizeResolveHint(value) {
|
|
@@ -16,7 +17,7 @@ const ResolveAccountInputSchema = v.object({
|
|
|
16
17
|
});
|
|
17
18
|
const ResolvedAccountSchema = v.object({
|
|
18
19
|
smartAccountAddress: v.string(),
|
|
19
|
-
kind: v.
|
|
20
|
+
kind: v.pipe(v.enum(ResolvedAccount_Kind), v.transform((kind) => requiredEnumLabel(ResolvedAccountKindCodec.protoToOutput, kind, "ResolvedAccountSchema", "kind"))),
|
|
20
21
|
rootUsername: v.optional(v.string()),
|
|
21
22
|
subaccountLabel: v.optional(v.string()),
|
|
22
23
|
accountId: PublicIdSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.schemas.js","names":[],"sources":["../../../src/services/accounts/accounts.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as ProtoResolve from \"../../gen/auth/v1/resolve_pb.js\";\nimport { PublicIdSchema } from \"../../shared/schemas.js\";\nimport { ResolveHintCodec } from \"./accounts.codecs.js\";\n\nfunction normalizeResolveHint(value?: string): ProtoResolve.ResolveHint {\n const raw = (value ?? \"\").trim();\n if (!raw) return ProtoResolve.ResolveHint.RESOLVE_HINT_UNSPECIFIED;\n const key = raw.toUpperCase().replace(/^RESOLVE_HINT_/, \"\");\n return (\n ResolveHintCodec.keyToProtoLookup[key] ?? ProtoResolve.ResolveHint.RESOLVE_HINT_UNSPECIFIED\n );\n}\n\nexport const ResolveAccountInputSchema = v.object({\n query: v.pipe(v.string(), v.trim(), v.minLength(1, \"query is required\")),\n hint: v.pipe(\n v.optional(v.string(), \"\"),\n v.transform((value) => normalizeResolveHint(value)),\n ),\n includeSubaccounts: v.optional(v.boolean(), false),\n});\n\nexport type ResolveAccountInput = v.InferInput<typeof ResolveAccountInputSchema>;\n\nexport const ResolvedAccountSchema = v.object({\n smartAccountAddress: v.string(),\n kind: v.
|
|
1
|
+
{"version":3,"file":"accounts.schemas.js","names":["ProtoResolve.ResolvedAccount_Kind"],"sources":["../../../src/services/accounts/accounts.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as ProtoResolve from \"../../gen/auth/v1/resolve_pb.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { PublicIdSchema } from \"../../shared/schemas.js\";\nimport { ResolvedAccountKindCodec, ResolveHintCodec } from \"./accounts.codecs.js\";\n\nfunction normalizeResolveHint(value?: string): ProtoResolve.ResolveHint {\n const raw = (value ?? \"\").trim();\n if (!raw) return ProtoResolve.ResolveHint.RESOLVE_HINT_UNSPECIFIED;\n const key = raw.toUpperCase().replace(/^RESOLVE_HINT_/, \"\");\n return (\n ResolveHintCodec.keyToProtoLookup[key] ?? ProtoResolve.ResolveHint.RESOLVE_HINT_UNSPECIFIED\n );\n}\n\nexport const ResolveAccountInputSchema = v.object({\n query: v.pipe(v.string(), v.trim(), v.minLength(1, \"query is required\")),\n hint: v.pipe(\n v.optional(v.string(), \"\"),\n v.transform((value) => normalizeResolveHint(value)),\n ),\n includeSubaccounts: v.optional(v.boolean(), false),\n});\n\nexport type ResolveAccountInput = v.InferInput<typeof ResolveAccountInputSchema>;\n\nexport const ResolvedAccountSchema = v.object({\n smartAccountAddress: v.string(),\n kind: v.pipe(\n v.enum(ProtoResolve.ResolvedAccount_Kind),\n v.transform((kind) =>\n requiredEnumLabel(\n ResolvedAccountKindCodec.protoToOutput,\n kind,\n \"ResolvedAccountSchema\",\n \"kind\",\n ),\n ),\n ),\n rootUsername: v.optional(v.string()),\n subaccountLabel: v.optional(v.string()),\n accountId: PublicIdSchema,\n});\n\nexport const ResolvedAccountArraySchema = v.optional(v.array(ResolvedAccountSchema), []);\n\nexport type ResolvedAccount = v.InferOutput<typeof ResolvedAccountSchema>;\n"],"mappings":";;;;;;AAMA,SAAS,qBAAqB,OAA0C;CACpE,MAAM,OAAO,SAAS,GAAA,CAAI,KAAK;CAC/B,IAAI,CAAC,KAAK,OAAA;CACV,MAAM,MAAM,IAAI,YAAY,CAAC,CAAC,QAAQ,kBAAkB,EAAE;CAC1D,OACI,iBAAiB,iBAAiB,QAAA;AAE1C;AAEA,MAAa,4BAA4B,EAAE,OAAO;CAC9C,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,GAAG,mBAAmB,CAAC;CACvE,MAAM,EAAE,KACJ,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE,GACzB,EAAE,WAAW,UAAU,qBAAqB,KAAK,CAAC,CACtD;CACA,oBAAoB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AACrD,CAAC;AAID,MAAa,wBAAwB,EAAE,OAAO;CAC1C,qBAAqB,EAAE,OAAO;CAC9B,MAAM,EAAE,KACJ,EAAE,KAAKA,oBAAiC,GACxC,EAAE,WAAW,SACT,kBACI,yBAAyB,eACzB,MACA,yBACA,MACJ,CACJ,CACJ;CACA,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC;CACnC,iBAAiB,EAAE,SAAS,EAAE,OAAO,CAAC;CACtC,WAAW;AACf,CAAC;AAED,MAAa,6BAA6B,EAAE,SAAS,EAAE,MAAM,qBAAqB,GAAG,CAAC,CAAC"}
|
|
@@ -18,7 +18,7 @@ declare const LoginWithWalletInputSchema: v.StrictObjectSchema<{
|
|
|
18
18
|
type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;
|
|
19
19
|
declare const MeSchema: v.ObjectSchema<{
|
|
20
20
|
readonly accountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
21
|
-
readonly apiKeyId: v.
|
|
21
|
+
readonly apiKeyId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
22
22
|
readonly username: v.StringSchema<undefined>;
|
|
23
23
|
readonly session: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
24
24
|
readonly sessionId: v.StringSchema<undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/services/auth/auth.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/services/auth/auth.ts"],"mappings":";;;;;;;;cAmBa,4BAA0B,EAAA;;;;;;;;;KAU3B,uBAAuB,EAAE,kBAAkB;cAEjD,UAAQ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOF,KAAK,EAAE,mBAAmB;cAEhC,+BAA6B,EAAA;;;;;;;;;KAOvB,0BAA0B,EAAE,mBAAmB;cAErD,aAAW,EAAA;;;;;;;;;;KAKL,QAAQ,EAAE,mBAAmB;;;;cAK5B;;EAGT,SAAS;EAEG,YAAA,YAAY,4BAA4B,UAAU;;;;EASxD,GAAG,UAAU,0BAA0B,QAAQ;;;;;;;EAW/C,kBACF,6BACA,UAAU,0BACX,QAAQ;;;;YAaK,gBACZ,OAAO,sBACP,UAAU,2BACX,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthService as AuthService$1 } from "../../gen/auth/v1/auth_pb.js";
|
|
2
|
-
import {
|
|
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:
|
|
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
|
|
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":";;;;;;;;
|
|
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":";;;;;;;;;;;
|
|
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":";;
|
|
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 {
|
|
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 {
|
|
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 };
|
|
@@ -14,7 +14,7 @@ type TimestampInit = {
|
|
|
14
14
|
declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
15
15
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
16
16
|
readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1s" | "1m" | "5m" | "1h", HeatmapInterval>]>;
|
|
17
|
-
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 1000 | 500 |
|
|
17
|
+
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 1000 | 500 | 50 | 100, HeatmapDepth>]>;
|
|
18
18
|
readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
|
|
19
19
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
|
|
20
20
|
readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
|
|
@@ -227,7 +227,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
|
|
|
227
227
|
declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
228
228
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
229
229
|
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
|
|
230
|
-
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
230
|
+
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 50 | 100>]>;
|
|
231
231
|
readonly chain: v.OptionalSchema<v.ObjectSchema<{
|
|
232
232
|
readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
|
|
233
233
|
readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
@@ -287,7 +287,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
287
287
|
}, undefined>, v.TransformAction<{
|
|
288
288
|
symbolId: number;
|
|
289
289
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
290
|
-
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
290
|
+
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 50 | 100;
|
|
291
291
|
chain?: {
|
|
292
292
|
baseKeyframe?: {
|
|
293
293
|
tsSec: number;
|
|
@@ -347,7 +347,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
347
347
|
}, {
|
|
348
348
|
symbolId: number;
|
|
349
349
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
350
|
-
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
350
|
+
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 50 | 100;
|
|
351
351
|
chain: {
|
|
352
352
|
baseKeyframe: {
|
|
353
353
|
tsSec: number;
|