@polyester/sdk 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/_virtual/_rolldown/runtime.js +1 -15
- package/dist/catalogs/snapshot-validation.js +63 -63
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/services/accounts/accounts.js +1 -1
- package/dist/services/accounts/accounts.js.map +1 -1
- package/dist/services/accounts/accounts.schemas.d.ts +13 -13
- package/dist/services/accounts/accounts.schemas.d.ts.map +1 -1
- package/dist/services/accounts/accounts.schemas.js +11 -11
- package/dist/services/accounts/accounts.schemas.js.map +1 -1
- package/dist/services/address-book/address-book.js.map +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +751 -751
- package/dist/services/address-book/address-book.schemas.d.ts.map +1 -1
- package/dist/services/address-book/address-book.schemas.js +160 -159
- package/dist/services/address-book/address-book.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.d.ts +6 -6
- package/dist/services/api-keys/api-keys.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +62 -62
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +34 -34
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/auth/auth.d.ts +39 -39
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +19 -18
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/profile/profile.d.ts +2 -2
- package/dist/services/auth/profile/profile.d.ts.map +1 -1
- package/dist/services/auth/profile/profile.js +3 -2
- package/dist/services/auth/profile/profile.js.map +1 -1
- package/dist/services/auth/profile/profile.schemas.d.ts +41 -41
- package/dist/services/auth/profile/profile.schemas.d.ts.map +1 -1
- package/dist/services/auth/profile/profile.schemas.js +27 -27
- package/dist/services/auth/profile/profile.schemas.js.map +1 -1
- package/dist/services/auth/session.schemas.js +17 -17
- package/dist/services/auth/session.schemas.js.map +1 -1
- package/dist/services/balances/balances.d.ts.map +1 -1
- package/dist/services/balances/balances.js +3 -2
- package/dist/services/balances/balances.js.map +1 -1
- package/dist/services/balances/balances.schemas.d.ts +95 -95
- package/dist/services/balances/balances.schemas.d.ts.map +1 -1
- package/dist/services/balances/balances.schemas.js +61 -61
- package/dist/services/balances/balances.schemas.js.map +1 -1
- package/dist/services/candles/candles.d.ts.map +1 -1
- package/dist/services/candles/candles.js +5 -4
- package/dist/services/candles/candles.js.map +1 -1
- package/dist/services/candles/candles.schemas.d.ts +64 -64
- package/dist/services/candles/candles.schemas.d.ts.map +1 -1
- package/dist/services/candles/candles.schemas.js +47 -47
- package/dist/services/candles/candles.schemas.js.map +1 -1
- package/dist/services/chain-analytics/chain-analytics.js.map +1 -1
- package/dist/services/chain-analytics/chain-analytics.schemas.d.ts +68 -68
- package/dist/services/chain-analytics/chain-analytics.schemas.d.ts.map +1 -1
- package/dist/services/chain-analytics/chain-analytics.schemas.js +29 -29
- package/dist/services/chain-analytics/chain-analytics.schemas.js.map +1 -1
- package/dist/services/deposit/deposit.js.map +1 -1
- package/dist/services/deposit/deposit.schemas.d.ts +17 -17
- package/dist/services/deposit/deposit.schemas.d.ts.map +1 -1
- package/dist/services/deposit/deposit.schemas.js +11 -11
- package/dist/services/deposit/deposit.schemas.js.map +1 -1
- package/dist/services/guard-signer/guard-signer.js.map +1 -1
- package/dist/services/guard-signer/guard-signer.schemas.d.ts +75 -75
- package/dist/services/guard-signer/guard-signer.schemas.d.ts.map +1 -1
- package/dist/services/guard-signer/guard-signer.schemas.js +42 -42
- package/dist/services/guard-signer/guard-signer.schemas.js.map +1 -1
- package/dist/services/heatmap/heatmap.d.ts.map +1 -1
- package/dist/services/heatmap/heatmap.js +5 -4
- package/dist/services/heatmap/heatmap.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +138 -138
- package/dist/services/heatmap/heatmap.schemas.d.ts.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.js +47 -47
- package/dist/services/heatmap/heatmap.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +53 -53
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +27 -27
- package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.js +3 -2
- package/dist/services/lifecycle/lifecycle.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +614 -614
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +146 -146
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.d.ts.map +1 -1
- package/dist/services/market-data/market-data.js +4 -3
- package/dist/services/market-data/market-data.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.d.ts +19 -19
- package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +50 -50
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/market-overview/market-overview.d.ts.map +1 -1
- package/dist/services/market-overview/market-overview.js +3 -2
- package/dist/services/market-overview/market-overview.js.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +37 -37
- package/dist/services/market-overview/market-overview.schemas.d.ts.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.js +33 -33
- package/dist/services/market-overview/market-overview.schemas.js.map +1 -1
- package/dist/services/mfa/mfa.js +1 -1
- package/dist/services/mfa/mfa.js.map +1 -1
- package/dist/services/mfa/mfa.schemas.d.ts +206 -206
- package/dist/services/mfa/mfa.schemas.d.ts.map +1 -1
- package/dist/services/mfa/mfa.schemas.js +83 -83
- package/dist/services/mfa/mfa.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.d.ts +2 -2
- package/dist/services/orderbook/orderbook.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.js +3 -2
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +23 -23
- package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.js +15 -15
- package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +18 -18
- package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
- package/dist/services/orders/order-errors.schemas.js +8 -8
- package/dist/services/orders/order-errors.schemas.js.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +504 -504
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +117 -117
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-identifiers.schemas.js +5 -5
- package/dist/services/orders/orders-identifiers.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +648 -648
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +95 -95
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-modify.schemas.d.ts +351 -351
- package/dist/services/orders/orders-modify.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-modify.schemas.js +44 -44
- package/dist/services/orders/orders-modify.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +183 -183
- package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-output.schemas.js +49 -49
- package/dist/services/orders/orders-output.schemas.js.map +1 -1
- package/dist/services/orders/orders-risk.schemas.d.ts +226 -226
- package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +69 -69
- package/dist/services/orders/orders-risk.schemas.js.map +1 -1
- package/dist/services/orders/orders.d.ts +6 -6
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +4 -3
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts +6 -6
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +105 -105
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +49 -49
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
- package/dist/services/policies/shared.d.ts +5 -5
- package/dist/services/policies/shared.d.ts.map +1 -1
- package/dist/services/policies/shared.js +10 -10
- package/dist/services/policies/shared.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +6 -6
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +3 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +124 -124
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +75 -75
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/shared.js +11 -11
- package/dist/services/shared.js.map +1 -1
- package/dist/services/social-verification/social-verification.d.ts +3 -3
- package/dist/services/social-verification/social-verification.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts +54 -54
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +28 -28
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.d.ts +14 -14
- package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.js +9 -8
- package/dist/services/subaccounts/subaccounts.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +135 -135
- package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.js +72 -72
- package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
- package/dist/services/trades/trades.d.ts +2 -2
- package/dist/services/trades/trades.d.ts.map +1 -1
- package/dist/services/trades/trades.js +3 -2
- package/dist/services/trades/trades.js.map +1 -1
- package/dist/services/trades/trades.schemas.d.ts +31 -31
- package/dist/services/trades/trades.schemas.d.ts.map +1 -1
- package/dist/services/trades/trades.schemas.js +24 -24
- package/dist/services/trades/trades.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +45 -45
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +36 -36
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/transfers/transfers.d.ts.map +1 -1
- package/dist/services/transfers/transfers.js +3 -2
- package/dist/services/transfers/transfers.js.map +1 -1
- package/dist/services/transfers/transfers.schemas.d.ts +42 -42
- package/dist/services/transfers/transfers.schemas.d.ts.map +1 -1
- package/dist/services/transfers/transfers.schemas.js +30 -30
- package/dist/services/transfers/transfers.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-child-order.schemas.js +23 -23
- package/dist/services/triggers/trigger-child-order.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +226 -226
- package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +53 -53
- package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +209 -209
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +152 -152
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +4 -3
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/services/whiteboard/whiteboard.js.map +1 -1
- package/dist/services/whiteboard/whiteboard.schemas.d.ts +379 -379
- package/dist/services/whiteboard/whiteboard.schemas.d.ts.map +1 -1
- package/dist/services/whiteboard/whiteboard.schemas.js +71 -71
- package/dist/services/whiteboard/whiteboard.schemas.js.map +1 -1
- package/dist/services/zipper/zipper.js.map +1 -1
- package/dist/services/zipper/zipper.schemas.d.ts +1 -1
- package/dist/services/zipper/zipper.schemas.js +54 -54
- package/dist/services/zipper/zipper.schemas.js.map +1 -1
- package/dist/shared/account-scope.d.ts +6 -6
- package/dist/shared/account-scope.d.ts.map +1 -1
- package/dist/shared/account-scope.js +3 -3
- package/dist/shared/account-scope.js.map +1 -1
- package/dist/shared/connect-error-mapping.js +2 -2
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +12 -12
- package/dist/shared/rate-limit.schemas.d.ts.map +1 -1
- package/dist/shared/rate-limit.schemas.js +7 -7
- package/dist/shared/rate-limit.schemas.js.map +1 -1
- package/dist/shared/schemas.js +26 -26
- package/dist/shared/schemas.js.map +1 -1
- package/dist/shared/validation.js +1 -6
- package/dist/shared/validation.js.map +1 -1
- package/dist/utils/connect-order-errors.js +2 -2
- package/dist/utils/connect-order-errors.js.map +1 -1
- package/package.json +3 -3
- package/dist/shared/validation.d.ts +0 -14
- package/dist/shared/validation.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-book.schemas.js","names":["v","Proto.AccountScopeType","Proto.DestinationWhitelistStatus","Proto.AddressBookEntryKind","Proto.TransferCounterpartyDirection","Proto.InternalWhitelistResolutionStatus","RequiredTimestampMsSchema"],"sources":["../../../src/services/address-book/address-book.schemas.ts"],"sourcesContent":["import * as v from \"../../shared/validation.js\";\nimport * as Proto from \"../../gen/auth/v1/address_book_pb.js\";\nimport { SubaccountRole } from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport {\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n PublicIdSchema,\n TimestampMsSchema as RequiredTimestampMsSchema,\n idInputSchema,\n optionalSubaccountIdInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n ADDRESS_BOOK_ENTRY_KIND_VALUES,\n AccountScopeTypeCodec,\n AddressBookEntryKindCodec,\n DestinationWhitelistStatusCodec,\n InternalWhitelistResolutionStatusCodec,\n TRANSFER_COUNTERPARTY_DIRECTION_VALUES,\n TransferCounterpartyDirectionCodec,\n} from \"./address-book.codecs.js\";\nimport { SubaccountRoleCodec } from \"../subaccounts/subaccounts.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst OptionalSubaccountIdSchema = optionalSubaccountIdInputSchema();\nconst IdSchema = idInputSchema;\n\nconst AddressBookLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(500)),\n);\nconst AddressBookCounterpartyLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(200)),\n);\nconst AddressBookViewLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(200)),\n);\nconst PageTokenSchema = v.optional(v.pipe(v.string(), v.trim()), \"\");\n\nconst TimestampMsSchema = OptionalTimestampMsSchema;\n\nconst AddressBookTagInputSchema = v.strictObject({\n name: v.pipe(v.string(), v.trim(), v.minLength(1)),\n color: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n});\n\nexport const ListAddressBookEntriesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, kind, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n pageToken,\n })),\n);\n\nexport type ListAddressBookEntriesInput = v.InferInput<typeof ListAddressBookEntriesInputSchema>;\n\nexport const CreateAddressBookEntryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n label: v.pipe(v.string(), v.trim(), v.minLength(1)),\n note: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n entry: v.variant(\"kind\", [\n v.strictObject({\n kind: v.literal(\"external\"),\n polychainChainId: v.pipe(v.number(), v.integer(), v.gtValue(0)),\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.strictObject({\n kind: v.literal(\"internal\"),\n smartAccountAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n tagIds: v.optional(v.array(IdSchema(\"tagId\")), []),\n newTags: v.optional(v.array(AddressBookTagInputSchema), []),\n }),\n v.transform(({ account, entry, ...rest }) => ({\n ...rest,\n subaccountId: accountScopeToSubaccountId(account),\n entry:\n entry.kind === \"external\"\n ? {\n case: \"external\" as const,\n value: {\n polychainChainId: entry.polychainChainId,\n address: entry.address,\n },\n }\n : {\n case: \"internal\" as const,\n value: {\n smartAccountAddress: entry.smartAccountAddress,\n },\n },\n })),\n);\n\nexport type CreateAddressBookEntryInput = v.InferInput<typeof CreateAddressBookEntryInputSchema>;\n\nexport function validateCreateAddressBookEntryInput(input: CreateAddressBookEntryInput): void {\n v.parse(CreateAddressBookEntryInputSchema, input);\n}\n\ntype AddressBookEntryPatch = {\n label?: string;\n note?: string;\n tagIds?: bigint[];\n};\n\nconst ADDRESS_BOOK_ENTRY_PATCH_FIELDS = defineProtoPatchFields<AddressBookEntryPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n note: { path: \"note\", encode: (note) => ({ note }) },\n tagIds: { path: \"tag_ids\", encode: (tagIds) => ({ tagIds }) },\n});\n\nexport const UpdateAddressBookEntryInputSchema = v.pipe(\n v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.pipe(v.string(), v.trim())),\n note: v.optional(v.pipe(v.string(), v.trim())),\n tagIds: v.optional(v.array(IdSchema(\"tagId\"))),\n }),\n v.check(\n ({ label, note, tagIds }) =>\n label !== undefined || note !== undefined || tagIds !== undefined,\n \"At least one address-book entry field must be provided\",\n ),\n v.transform(({ addressBookEntryId, expectedRevision, ...input }) => {\n const { patch: entry, updateMask } = buildProtoPatch(\n input,\n ADDRESS_BOOK_ENTRY_PATCH_FIELDS,\n );\n return { addressBookEntryId, entry, updateMask, expectedRevision };\n }),\n);\n\nexport type UpdateAddressBookEntryInput = v.InferInput<typeof UpdateAddressBookEntryInputSchema>;\n\nexport const DeleteAddressBookEntryInputSchema = v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n});\n\nexport type DeleteAddressBookEntryInput = v.InferInput<typeof DeleteAddressBookEntryInputSchema>;\n\nexport const CopyAddressBookEntryInputSchema = v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n targetSubaccountId: OptionalSubaccountIdSchema,\n});\n\nexport type CopyAddressBookEntryInput = v.InferInput<typeof CopyAddressBookEntryInputSchema>;\n\nexport const CreateAddressBookTagInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n name: v.pipe(v.string(), v.trim(), v.minLength(1)),\n color: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type CreateAddressBookTagInput = v.InferInput<typeof CreateAddressBookTagInputSchema>;\n\nexport const UpdateAddressBookTagInputSchema = v.pipe(\n v.strictObject({\n tagId: IdSchema(\"tagId\"),\n name: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1))),\n color: v.optional(v.pipe(v.string(), v.trim())),\n }),\n v.check(\n ({ name, color }) => name !== undefined || color !== undefined,\n \"At least one address-book tag field must be provided\",\n ),\n);\n\nexport type UpdateAddressBookTagInput = v.InferInput<typeof UpdateAddressBookTagInputSchema>;\n\nexport const DeleteAddressBookTagInputSchema = v.strictObject({\n tagId: IdSchema(\"tagId\"),\n});\n\nexport type DeleteAddressBookTagInput = v.InferInput<typeof DeleteAddressBookTagInputSchema>;\n\nexport const ListTransferCounterpartiesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n direction: v.optional(v.picklist(TRANSFER_COUNTERPARTY_DIRECTION_VALUES)),\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookCounterpartyLimitSchema,\n }),\n v.transform(({ account, direction, kind, limit }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n direction: direction\n ? TransferCounterpartyDirectionCodec.inputToProto[direction]\n : undefined,\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n })),\n);\n\nexport type ListTransferCounterpartiesInput = v.InferInput<\n typeof ListTransferCounterpartiesInputSchema\n>;\n\nexport const ListTransferDestinationsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, kind, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n pageToken,\n })),\n);\n\nexport type ListTransferDestinationsInput = v.InferInput<\n typeof ListTransferDestinationsInputSchema\n>;\n\nexport const SubaccountScopedInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n }),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type SubaccountScopedInput = v.InferInput<typeof SubaccountScopedInputSchema>;\n\nexport const ListInternalTransferWhitelistEntriesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n pageToken,\n })),\n);\n\nexport type ListInternalTransferWhitelistEntriesInput = v.InferInput<\n typeof ListInternalTransferWhitelistEntriesInputSchema\n>;\n\nexport const GetAddressBookViewInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: AddressBookViewLimitSchema,\n }),\n v.transform(({ account, limit }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n })),\n);\n\nexport type GetAddressBookViewInput = v.InferInput<typeof GetAddressBookViewInputSchema>;\n\nconst CountSchema = v.pipe(\n v.bigint(),\n v.transform((value) => Number(value)),\n);\n\nconst AccountScopeSchema = v.object({\n scopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AccountScopeSchema\",\n \"scope type\",\n ),\n ),\n ),\n rootAccountId: PublicIdSchema,\n subaccountId: PublicIdSchema,\n});\n\nconst ExternalWithdrawAddressSchema = v.object({\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n});\n\nconst InternalTransferAccountSchema = v.object({\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferAccountSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n});\n\nconst AddressBookEntryValueSchema = v.variant(\"case\", [\n v.object({ case: v.literal(\"external\"), value: ExternalWithdrawAddressSchema }),\n v.object({ case: v.literal(\"internal\"), value: InternalTransferAccountSchema }),\n v.object({ case: v.undefined(), value: v.optional(v.undefined()) }),\n]);\n\nconst DestinationWhitelistStatusSchema = v.pipe(\n v.enum(Proto.DestinationWhitelistStatus),\n v.transform((value) =>\n requiredEnumLabel(\n DestinationWhitelistStatusCodec.protoToOutput,\n value,\n \"PolyesterClient.DestinationWhitelistStatusSchema\",\n \"whitelist status\",\n ),\n ),\n);\n\nconst AddressBookEntryKindSchema = v.pipe(\n v.enum(Proto.AddressBookEntryKind),\n v.transform((value) =>\n requiredEnumLabel(\n AddressBookEntryKindCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookEntryKindSchema\",\n \"entry kind\",\n ),\n ),\n);\n\nconst TransferCounterpartyDirectionSchema = v.pipe(\n v.enum(Proto.TransferCounterpartyDirection),\n v.transform((value) =>\n requiredEnumLabel(\n TransferCounterpartyDirectionCodec.protoToOutput,\n value,\n \"PolyesterClient.TransferCounterpartyDirectionSchema\",\n \"direction\",\n ),\n ),\n);\n\nexport const AddressBookSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n callerRole: v.pipe(\n v.enum(SubaccountRole),\n v.transform((role) =>\n requiredEnumLabel(\n SubaccountRoleCodec.protoToOutput,\n role,\n \"AddressBookEntrySchema\",\n \"caller role\",\n ),\n ),\n ),\n label: v.string(),\n ownerUsername: v.string(),\n smartAccountAddress: v.string(),\n});\n\nexport type AddressBook = v.InferOutput<typeof AddressBookSchema>;\n\nexport const AddressBookTagSummarySchema = v.object({\n tagId: PublicIdSchema,\n name: v.string(),\n color: v.string(),\n});\n\nexport type AddressBookTagSummary = v.InferOutput<typeof AddressBookTagSummarySchema>;\n\nexport const AddressBookTagSchema = v.object({\n tagId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n name: v.string(),\n color: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n});\n\nexport type AddressBookTag = v.InferOutput<typeof AddressBookTagSchema>;\n\nexport const AddressBookEntrySchema = v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n kind: AddressBookEntryKindSchema,\n label: v.string(),\n note: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n entry: AddressBookEntryValueSchema,\n tags: v.array(AddressBookTagSchema),\n revision: BigIntStringSchema,\n});\n\nexport type AddressBookEntry = v.InferOutput<typeof AddressBookEntrySchema>;\n\nexport const AddressBookEntriesSchema = v.array(AddressBookEntrySchema);\nexport type AddressBookEntries = v.InferOutput<typeof AddressBookEntriesSchema>;\n\nexport const TransferCounterpartySchema = v.object({\n counterpartyId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n direction: TransferCounterpartyDirectionSchema,\n kind: AddressBookEntryKindSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n firstSeenAt: TimestampMsSchema,\n lastSeenAt: TimestampMsSchema,\n counterparty: AddressBookEntryValueSchema,\n});\n\nexport type TransferCounterparty = v.InferOutput<typeof TransferCounterpartySchema>;\n\nexport const TransferCounterpartiesSchema = v.array(TransferCounterpartySchema);\nexport type TransferCounterparties = v.InferOutput<typeof TransferCounterpartiesSchema>;\n\nexport const TransferDestinationSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n kind: AddressBookEntryKindSchema,\n saved: v.boolean(),\n whitelisted: v.boolean(),\n whitelistStatus: DestinationWhitelistStatusSchema,\n addressBookEntry: v.optional(AddressBookEntrySchema),\n destination: AddressBookEntryValueSchema,\n whitelistEffectiveAt: TimestampMsSchema,\n whitelistUpdatedAt: TimestampMsSchema,\n});\n\nexport type TransferDestination = v.InferOutput<typeof TransferDestinationSchema>;\n\nexport const TransferDestinationsSchema = v.array(TransferDestinationSchema);\nexport type TransferDestinations = v.InferOutput<typeof TransferDestinationsSchema>;\n\nexport const InternalTransferWhitelistEntrySchema = v.object({\n entryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferWhitelistEntrySchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n resolutionStatus: v.pipe(\n v.enum(Proto.InternalWhitelistResolutionStatus),\n v.transform((value) =>\n requiredEnumLabel(\n InternalWhitelistResolutionStatusCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferWhitelistEntrySchema\",\n \"resolution status\",\n ),\n ),\n ),\n});\n\nexport type InternalTransferWhitelistEntry = v.InferOutput<\n typeof InternalTransferWhitelistEntrySchema\n>;\n\nexport const InternalTransferWhitelistEntriesSchema = v.array(InternalTransferWhitelistEntrySchema);\n\nexport type InternalTransferWhitelistEntries = v.InferOutput<\n typeof InternalTransferWhitelistEntriesSchema\n>;\n\nexport const MirroredWithdrawWhitelistEntrySchema = v.object({\n canonicalAddress: v.string(),\n rawAddressHex: v.string(),\n updatedAt: TimestampMsSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n});\n\nexport type MirroredWithdrawWhitelistEntry = v.InferOutput<\n typeof MirroredWithdrawWhitelistEntrySchema\n>;\n\nexport const WithdrawWhitelistViewSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n externalWhitelistRequired: v.boolean(),\n internalWhitelistRequired: v.boolean(),\n activeEntries: v.optional(v.array(MirroredWithdrawWhitelistEntrySchema), []),\n});\n\nexport type WithdrawWhitelistView = v.InferOutput<typeof WithdrawWhitelistViewSchema>;\n\nexport const AddressBookEntriesViewSchema = v.object({\n external: v.optional(\n v.array(\n v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n label: v.string(),\n note: v.string(),\n tagIds: v.optional(v.array(PublicIdSchema), []),\n whitelistStatus: DestinationWhitelistStatusSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n revision: BigIntStringSchema,\n }),\n ),\n [],\n ),\n internal: v.optional(\n v.array(\n v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n label: v.string(),\n note: v.string(),\n tagIds: v.optional(v.array(PublicIdSchema), []),\n whitelistStatus: DestinationWhitelistStatusSchema,\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookEntriesViewSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n revision: BigIntStringSchema,\n }),\n ),\n [],\n ),\n});\n\nexport type AddressBookEntriesView = v.InferOutput<typeof AddressBookEntriesViewSchema>;\n\nexport const AddressBookRecentDestinationsViewSchema = v.object({\n external: v.optional(\n v.array(\n v.object({\n scope: v.optional(AccountScopeSchema),\n lastDirection: TransferCounterpartyDirectionSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n lastSeenAt: TimestampMsSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n }),\n ),\n [],\n ),\n internal: v.optional(\n v.array(\n v.object({\n scope: v.optional(AccountScopeSchema),\n lastDirection: TransferCounterpartyDirectionSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n lastSeenAt: TimestampMsSchema,\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookRecentDestinationsViewSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n }),\n ),\n [],\n ),\n});\n\nexport type AddressBookRecentDestinationsView = v.InferOutput<\n typeof AddressBookRecentDestinationsViewSchema\n>;\n\nexport const AddressBookViewSchema = v.object({\n books: v.optional(v.array(AddressBookSchema), []),\n entries: v.optional(AddressBookEntriesViewSchema),\n recentDestinations: v.optional(AddressBookRecentDestinationsViewSchema),\n tags: v.optional(v.array(AddressBookTagSummarySchema), []),\n withdrawWhitelist: v.optional(WithdrawWhitelistViewSchema),\n recentDestinationsTruncated: v.optional(v.boolean(), false),\n});\n\nexport type AddressBookView = v.InferOutput<typeof AddressBookViewSchema>;\n\nexport const AddressBookViewInvalidatedSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n invalidatedAt: RequiredTimestampMsSchema,\n});\n\nexport type AddressBookViewInvalidated = v.InferOutput<typeof AddressBookViewInvalidatedSchema>;\n"],"mappings":";;;;;;;;;;AA6BA,MAAM,6BAA6B,gCAAgC;AACnE,MAAM,WAAW;AAEjB,MAAM,yBAAyBA,mBAAE,SAC7BA,mBAAE,KAAKA,mBAAE,OAAO,GAAGA,mBAAE,QAAQ,GAAGA,mBAAE,QAAQ,CAAC,GAAGA,mBAAE,SAAS,GAAG,CAAC,CACjE;AACA,MAAM,qCAAqCA,mBAAE,SACzCA,mBAAE,KAAKA,mBAAE,OAAO,GAAGA,mBAAE,QAAQ,GAAGA,mBAAE,QAAQ,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EA,mBAAE,OAAO;EACL,OAAOA,mBAAE,SAAS,kBAAkB;EACpC,eAAe;EACf,OAAOA,mBAAE,QAAQ;EACjB,oBAAoB;EACpB,UAAU;EACV,YAAY;EACZ,kBAAkBA,mBAAE,KAAKA,mBAAE,OAAO,GAAGA,mBAAE,QAAQ,CAAC;EAChD,SAASA,mBAAE,OAAO;CACtB,CAAC,CACL,GACA,CAAC,CACL;CACA,UAAUA,mBAAE,SACRA,mBAAE,MACEA,mBAAE,OAAO;EACL,OAAOA,mBAAE,SAAS,kBAAkB;EACpC,eAAe;EACf,OAAOA,mBAAE,QAAQ;EACjB,oBAAoB;EACpB,UAAU;EACV,YAAY;EACZ,eAAe;EACf,iBAAiB;EACjB,iBAAiBA,mBAAE,KACfA,mBAAE,KAAKC,gBAAsB,GAC7BD,mBAAE,WAAW,UACT,kBACI,sBAAsB,eACtB,OACA,2DACA,mBACJ,CACJ,CACJ;EACA,qBAAqBA,mBAAE,OAAO;EAC9B,cAAcA,mBAAE,OAAO;EACvB,iBAAiBA,mBAAE,OAAO;CAC9B,CAAC,CACL,GACA,CAAC,CACL;AACJ,CAAC;AAMD,MAAa,wBAAwBA,mBAAE,OAAO;CAC1C,OAAOA,mBAAE,SAASA,mBAAE,MAAM,iBAAiB,GAAG,CAAC,CAAC;CAChD,SAASA,mBAAE,SAAS,4BAA4B;CAChD,oBAAoBA,mBAAE,SAAS,uCAAuC;CACtE,MAAMA,mBAAE,SAASA,mBAAE,MAAM,2BAA2B,GAAG,CAAC,CAAC;CACzD,mBAAmBA,mBAAE,SAAS,2BAA2B;CACzD,6BAA6BA,mBAAE,SAASA,mBAAE,QAAQ,GAAG,KAAK;AAC9D,CAAC;AAID,MAAa,mCAAmCA,mBAAE,OAAO;CACrD,OAAOA,mBAAE,SAAS,kBAAkB;CACpC,eAAeM;AACnB,CAAC"}
|
|
1
|
+
{"version":3,"file":"address-book.schemas.js","names":["Proto.AccountScopeType","Proto.DestinationWhitelistStatus","Proto.AddressBookEntryKind","Proto.TransferCounterpartyDirection","Proto.InternalWhitelistResolutionStatus","RequiredTimestampMsSchema"],"sources":["../../../src/services/address-book/address-book.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport * as Proto from \"../../gen/auth/v1/address_book_pb.js\";\nimport { SubaccountRole } from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport {\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n PublicIdSchema,\n TimestampMsSchema as RequiredTimestampMsSchema,\n idInputSchema,\n optionalSubaccountIdInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n ADDRESS_BOOK_ENTRY_KIND_VALUES,\n AccountScopeTypeCodec,\n AddressBookEntryKindCodec,\n DestinationWhitelistStatusCodec,\n InternalWhitelistResolutionStatusCodec,\n TRANSFER_COUNTERPARTY_DIRECTION_VALUES,\n TransferCounterpartyDirectionCodec,\n} from \"./address-book.codecs.js\";\nimport { SubaccountRoleCodec } from \"../subaccounts/subaccounts.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst OptionalSubaccountIdSchema = optionalSubaccountIdInputSchema();\nconst IdSchema = idInputSchema;\n\nconst AddressBookLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(500)),\n);\nconst AddressBookCounterpartyLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(200)),\n);\nconst AddressBookViewLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(200)),\n);\nconst PageTokenSchema = v.optional(v.pipe(v.string(), v.trim()), \"\");\n\nconst TimestampMsSchema = OptionalTimestampMsSchema;\n\nconst AddressBookTagInputSchema = v.strictObject({\n name: v.pipe(v.string(), v.trim(), v.minLength(1)),\n color: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n});\n\nexport const ListAddressBookEntriesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, kind, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n pageToken,\n })),\n);\n\nexport type ListAddressBookEntriesInput = v.InferInput<typeof ListAddressBookEntriesInputSchema>;\n\nexport const CreateAddressBookEntryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n label: v.pipe(v.string(), v.trim(), v.minLength(1)),\n note: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n entry: v.variant(\"kind\", [\n v.strictObject({\n kind: v.literal(\"external\"),\n polychainChainId: v.pipe(v.number(), v.integer(), v.gtValue(0)),\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.strictObject({\n kind: v.literal(\"internal\"),\n smartAccountAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n tagIds: v.optional(v.array(IdSchema(\"tagId\")), []),\n newTags: v.optional(v.array(AddressBookTagInputSchema), []),\n }),\n v.transform(({ account, entry, ...rest }) => ({\n ...rest,\n subaccountId: accountScopeToSubaccountId(account),\n entry:\n entry.kind === \"external\"\n ? {\n case: \"external\" as const,\n value: {\n polychainChainId: entry.polychainChainId,\n address: entry.address,\n },\n }\n : {\n case: \"internal\" as const,\n value: {\n smartAccountAddress: entry.smartAccountAddress,\n },\n },\n })),\n);\n\nexport type CreateAddressBookEntryInput = v.InferInput<typeof CreateAddressBookEntryInputSchema>;\n\nexport function validateCreateAddressBookEntryInput(input: CreateAddressBookEntryInput): void {\n parse(CreateAddressBookEntryInputSchema, input);\n}\n\ntype AddressBookEntryPatch = {\n label?: string;\n note?: string;\n tagIds?: bigint[];\n};\n\nconst ADDRESS_BOOK_ENTRY_PATCH_FIELDS = defineProtoPatchFields<AddressBookEntryPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n note: { path: \"note\", encode: (note) => ({ note }) },\n tagIds: { path: \"tag_ids\", encode: (tagIds) => ({ tagIds }) },\n});\n\nexport const UpdateAddressBookEntryInputSchema = v.pipe(\n v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.pipe(v.string(), v.trim())),\n note: v.optional(v.pipe(v.string(), v.trim())),\n tagIds: v.optional(v.array(IdSchema(\"tagId\"))),\n }),\n v.check(\n ({ label, note, tagIds }) =>\n label !== undefined || note !== undefined || tagIds !== undefined,\n \"At least one address-book entry field must be provided\",\n ),\n v.transform(({ addressBookEntryId, expectedRevision, ...input }) => {\n const { patch: entry, updateMask } = buildProtoPatch(\n input,\n ADDRESS_BOOK_ENTRY_PATCH_FIELDS,\n );\n return { addressBookEntryId, entry, updateMask, expectedRevision };\n }),\n);\n\nexport type UpdateAddressBookEntryInput = v.InferInput<typeof UpdateAddressBookEntryInputSchema>;\n\nexport const DeleteAddressBookEntryInputSchema = v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n});\n\nexport type DeleteAddressBookEntryInput = v.InferInput<typeof DeleteAddressBookEntryInputSchema>;\n\nexport const CopyAddressBookEntryInputSchema = v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n targetSubaccountId: OptionalSubaccountIdSchema,\n});\n\nexport type CopyAddressBookEntryInput = v.InferInput<typeof CopyAddressBookEntryInputSchema>;\n\nexport const CreateAddressBookTagInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n name: v.pipe(v.string(), v.trim(), v.minLength(1)),\n color: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type CreateAddressBookTagInput = v.InferInput<typeof CreateAddressBookTagInputSchema>;\n\nexport const UpdateAddressBookTagInputSchema = v.pipe(\n v.strictObject({\n tagId: IdSchema(\"tagId\"),\n name: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1))),\n color: v.optional(v.pipe(v.string(), v.trim())),\n }),\n v.check(\n ({ name, color }) => name !== undefined || color !== undefined,\n \"At least one address-book tag field must be provided\",\n ),\n);\n\nexport type UpdateAddressBookTagInput = v.InferInput<typeof UpdateAddressBookTagInputSchema>;\n\nexport const DeleteAddressBookTagInputSchema = v.strictObject({\n tagId: IdSchema(\"tagId\"),\n});\n\nexport type DeleteAddressBookTagInput = v.InferInput<typeof DeleteAddressBookTagInputSchema>;\n\nexport const ListTransferCounterpartiesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n direction: v.optional(v.picklist(TRANSFER_COUNTERPARTY_DIRECTION_VALUES)),\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookCounterpartyLimitSchema,\n }),\n v.transform(({ account, direction, kind, limit }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n direction: direction\n ? TransferCounterpartyDirectionCodec.inputToProto[direction]\n : undefined,\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n })),\n);\n\nexport type ListTransferCounterpartiesInput = v.InferInput<\n typeof ListTransferCounterpartiesInputSchema\n>;\n\nexport const ListTransferDestinationsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, kind, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n pageToken,\n })),\n);\n\nexport type ListTransferDestinationsInput = v.InferInput<\n typeof ListTransferDestinationsInputSchema\n>;\n\nexport const SubaccountScopedInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n }),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type SubaccountScopedInput = v.InferInput<typeof SubaccountScopedInputSchema>;\n\nexport const ListInternalTransferWhitelistEntriesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n pageToken,\n })),\n);\n\nexport type ListInternalTransferWhitelistEntriesInput = v.InferInput<\n typeof ListInternalTransferWhitelistEntriesInputSchema\n>;\n\nexport const GetAddressBookViewInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: AddressBookViewLimitSchema,\n }),\n v.transform(({ account, limit }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n })),\n);\n\nexport type GetAddressBookViewInput = v.InferInput<typeof GetAddressBookViewInputSchema>;\n\nconst CountSchema = v.pipe(\n v.bigint(),\n v.transform((value) => Number(value)),\n);\n\nconst AccountScopeSchema = v.object({\n scopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AccountScopeSchema\",\n \"scope type\",\n ),\n ),\n ),\n rootAccountId: PublicIdSchema,\n subaccountId: PublicIdSchema,\n});\n\nconst ExternalWithdrawAddressSchema = v.object({\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n});\n\nconst InternalTransferAccountSchema = v.object({\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferAccountSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n});\n\nconst AddressBookEntryValueSchema = v.variant(\"case\", [\n v.object({ case: v.literal(\"external\"), value: ExternalWithdrawAddressSchema }),\n v.object({ case: v.literal(\"internal\"), value: InternalTransferAccountSchema }),\n v.object({ case: v.undefined(), value: v.optional(v.undefined()) }),\n]);\n\nconst DestinationWhitelistStatusSchema = v.pipe(\n v.enum(Proto.DestinationWhitelistStatus),\n v.transform((value) =>\n requiredEnumLabel(\n DestinationWhitelistStatusCodec.protoToOutput,\n value,\n \"PolyesterClient.DestinationWhitelistStatusSchema\",\n \"whitelist status\",\n ),\n ),\n);\n\nconst AddressBookEntryKindSchema = v.pipe(\n v.enum(Proto.AddressBookEntryKind),\n v.transform((value) =>\n requiredEnumLabel(\n AddressBookEntryKindCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookEntryKindSchema\",\n \"entry kind\",\n ),\n ),\n);\n\nconst TransferCounterpartyDirectionSchema = v.pipe(\n v.enum(Proto.TransferCounterpartyDirection),\n v.transform((value) =>\n requiredEnumLabel(\n TransferCounterpartyDirectionCodec.protoToOutput,\n value,\n \"PolyesterClient.TransferCounterpartyDirectionSchema\",\n \"direction\",\n ),\n ),\n);\n\nexport const AddressBookSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n callerRole: v.pipe(\n v.enum(SubaccountRole),\n v.transform((role) =>\n requiredEnumLabel(\n SubaccountRoleCodec.protoToOutput,\n role,\n \"AddressBookEntrySchema\",\n \"caller role\",\n ),\n ),\n ),\n label: v.string(),\n ownerUsername: v.string(),\n smartAccountAddress: v.string(),\n});\n\nexport type AddressBook = v.InferOutput<typeof AddressBookSchema>;\n\nexport const AddressBookTagSummarySchema = v.object({\n tagId: PublicIdSchema,\n name: v.string(),\n color: v.string(),\n});\n\nexport type AddressBookTagSummary = v.InferOutput<typeof AddressBookTagSummarySchema>;\n\nexport const AddressBookTagSchema = v.object({\n tagId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n name: v.string(),\n color: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n});\n\nexport type AddressBookTag = v.InferOutput<typeof AddressBookTagSchema>;\n\nexport const AddressBookEntrySchema = v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n kind: AddressBookEntryKindSchema,\n label: v.string(),\n note: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n entry: AddressBookEntryValueSchema,\n tags: v.array(AddressBookTagSchema),\n revision: BigIntStringSchema,\n});\n\nexport type AddressBookEntry = v.InferOutput<typeof AddressBookEntrySchema>;\n\nexport const AddressBookEntriesSchema = v.array(AddressBookEntrySchema);\nexport type AddressBookEntries = v.InferOutput<typeof AddressBookEntriesSchema>;\n\nexport const TransferCounterpartySchema = v.object({\n counterpartyId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n direction: TransferCounterpartyDirectionSchema,\n kind: AddressBookEntryKindSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n firstSeenAt: TimestampMsSchema,\n lastSeenAt: TimestampMsSchema,\n counterparty: AddressBookEntryValueSchema,\n});\n\nexport type TransferCounterparty = v.InferOutput<typeof TransferCounterpartySchema>;\n\nexport const TransferCounterpartiesSchema = v.array(TransferCounterpartySchema);\nexport type TransferCounterparties = v.InferOutput<typeof TransferCounterpartiesSchema>;\n\nexport const TransferDestinationSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n kind: AddressBookEntryKindSchema,\n saved: v.boolean(),\n whitelisted: v.boolean(),\n whitelistStatus: DestinationWhitelistStatusSchema,\n addressBookEntry: v.optional(AddressBookEntrySchema),\n destination: AddressBookEntryValueSchema,\n whitelistEffectiveAt: TimestampMsSchema,\n whitelistUpdatedAt: TimestampMsSchema,\n});\n\nexport type TransferDestination = v.InferOutput<typeof TransferDestinationSchema>;\n\nexport const TransferDestinationsSchema = v.array(TransferDestinationSchema);\nexport type TransferDestinations = v.InferOutput<typeof TransferDestinationsSchema>;\n\nexport const InternalTransferWhitelistEntrySchema = v.object({\n entryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferWhitelistEntrySchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n resolutionStatus: v.pipe(\n v.enum(Proto.InternalWhitelistResolutionStatus),\n v.transform((value) =>\n requiredEnumLabel(\n InternalWhitelistResolutionStatusCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferWhitelistEntrySchema\",\n \"resolution status\",\n ),\n ),\n ),\n});\n\nexport type InternalTransferWhitelistEntry = v.InferOutput<\n typeof InternalTransferWhitelistEntrySchema\n>;\n\nexport const InternalTransferWhitelistEntriesSchema = v.array(InternalTransferWhitelistEntrySchema);\n\nexport type InternalTransferWhitelistEntries = v.InferOutput<\n typeof InternalTransferWhitelistEntriesSchema\n>;\n\nexport const MirroredWithdrawWhitelistEntrySchema = v.object({\n canonicalAddress: v.string(),\n rawAddressHex: v.string(),\n updatedAt: TimestampMsSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n});\n\nexport type MirroredWithdrawWhitelistEntry = v.InferOutput<\n typeof MirroredWithdrawWhitelistEntrySchema\n>;\n\nexport const WithdrawWhitelistViewSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n externalWhitelistRequired: v.boolean(),\n internalWhitelistRequired: v.boolean(),\n activeEntries: v.optional(v.array(MirroredWithdrawWhitelistEntrySchema), []),\n});\n\nexport type WithdrawWhitelistView = v.InferOutput<typeof WithdrawWhitelistViewSchema>;\n\nexport const AddressBookEntriesViewSchema = v.object({\n external: v.optional(\n v.array(\n v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n label: v.string(),\n note: v.string(),\n tagIds: v.optional(v.array(PublicIdSchema), []),\n whitelistStatus: DestinationWhitelistStatusSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n revision: BigIntStringSchema,\n }),\n ),\n [],\n ),\n internal: v.optional(\n v.array(\n v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n label: v.string(),\n note: v.string(),\n tagIds: v.optional(v.array(PublicIdSchema), []),\n whitelistStatus: DestinationWhitelistStatusSchema,\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookEntriesViewSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n revision: BigIntStringSchema,\n }),\n ),\n [],\n ),\n});\n\nexport type AddressBookEntriesView = v.InferOutput<typeof AddressBookEntriesViewSchema>;\n\nexport const AddressBookRecentDestinationsViewSchema = v.object({\n external: v.optional(\n v.array(\n v.object({\n scope: v.optional(AccountScopeSchema),\n lastDirection: TransferCounterpartyDirectionSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n lastSeenAt: TimestampMsSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n }),\n ),\n [],\n ),\n internal: v.optional(\n v.array(\n v.object({\n scope: v.optional(AccountScopeSchema),\n lastDirection: TransferCounterpartyDirectionSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n lastSeenAt: TimestampMsSchema,\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookRecentDestinationsViewSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n }),\n ),\n [],\n ),\n});\n\nexport type AddressBookRecentDestinationsView = v.InferOutput<\n typeof AddressBookRecentDestinationsViewSchema\n>;\n\nexport const AddressBookViewSchema = v.object({\n books: v.optional(v.array(AddressBookSchema), []),\n entries: v.optional(AddressBookEntriesViewSchema),\n recentDestinations: v.optional(AddressBookRecentDestinationsViewSchema),\n tags: v.optional(v.array(AddressBookTagSummarySchema), []),\n withdrawWhitelist: v.optional(WithdrawWhitelistViewSchema),\n recentDestinationsTruncated: v.optional(v.boolean(), false),\n});\n\nexport type AddressBookView = v.InferOutput<typeof AddressBookViewSchema>;\n\nexport const AddressBookViewInvalidatedSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n invalidatedAt: RequiredTimestampMsSchema,\n});\n\nexport type AddressBookViewInvalidated = v.InferOutput<typeof AddressBookViewInvalidatedSchema>;\n"],"mappings":";;;;;;;;;;;AA8BA,MAAM,6BAA6B,gCAAgC;AACnE,MAAM,WAAW;AAEjB,MAAM,yBAAyB,EAAE,SAC7B,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,CAAC,CACjE;AACA,MAAM,qCAAqC,EAAE,SACzC,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,CAAC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AAO;EACvB,iBAAiB,EAAE,OAAO;CAC9B,CAAC,CACL,GACA,CAAC,CACL;AACJ,CAAC;AAMD,MAAa,wBAAwB,EAAE,OAAO;CAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,GAAG,CAAC,CAAC;CAChD,SAAS,EAAE,SAAS,4BAA4B;CAChD,oBAAoB,EAAE,SAAS,uCAAuC;CACtE,MAAM,EAAE,SAAS,EAAE,MAAM,2BAA2B,GAAG,CAAC,CAAC;CACzD,mBAAmB,EAAE,SAAS,2BAA2B;CACzD,6BAA6B,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AAC9D,CAAC;AAID,MAAa,mCAAmC,EAAE,OAAO;CACrD,OAAO,EAAE,SAAS,kBAAkB;CACpC,eAAeK;AACnB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { validation_d_exports } from "../../shared/validation.js";
|
|
2
1
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
2
|
import { SubaccountResolver } from "../subaccount-resolver.js";
|
|
4
3
|
import { PolyesterRealtime } from "../../realtime/types.js";
|
|
@@ -8,6 +7,7 @@ import { ApiKeyPoliciesService } from "../policies/api-key-policies/api-key-poli
|
|
|
8
7
|
import "../policies/api-key-policies/index.js";
|
|
9
8
|
import { ApiKey, ApiKeyIdInputSchema, ApiKeysCreateInputSchema, ApiKeysListInputSchema, ApiKeysUpdateInputSchema } from "./api-keys.schemas.js";
|
|
10
9
|
import { Transport } from "@connectrpc/connect";
|
|
10
|
+
import * as v from "valibot";
|
|
11
11
|
//#region src/services/api-keys/api-keys.d.ts
|
|
12
12
|
interface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {
|
|
13
13
|
accountId: string;
|
|
@@ -22,23 +22,23 @@ declare class ApiKeysService {
|
|
|
22
22
|
/**
|
|
23
23
|
* Returns non-revoked API keys owned by the caller, newest first, optionally scoped through an explicit or resolver-provided subaccount ID.
|
|
24
24
|
*/
|
|
25
|
-
list(params?:
|
|
25
|
+
list(params?: v.InferInput<typeof ApiKeysListInputSchema>, options?: PolyesterRequestOptions): Promise<ApiKey[]>;
|
|
26
26
|
/**
|
|
27
27
|
* Fetches one caller-owned API key by ak_... key ID and returns null when no matching key is returned.
|
|
28
28
|
*/
|
|
29
|
-
get(input:
|
|
29
|
+
get(input: v.InferInput<typeof ApiKeyIdInputSchema>, options?: PolyesterRequestOptions): Promise<ApiKey | null>;
|
|
30
30
|
/**
|
|
31
31
|
* Creates API key metadata using a client-generated Ed25519 public key; security settings may require MFA fresh step-up and retrying with stepUpToken.
|
|
32
32
|
*/
|
|
33
|
-
create(payload:
|
|
33
|
+
create(payload: v.InferInput<typeof ApiKeysCreateInputSchema>, options?: PolyesterMutationOptions): Promise<ApiKey | null>;
|
|
34
34
|
/**
|
|
35
35
|
* Permanently revokes the specified API key; revoked keys cannot authenticate again.
|
|
36
36
|
*/
|
|
37
|
-
delete(input:
|
|
37
|
+
delete(input: v.InferInput<typeof ApiKeyIdInputSchema>, options?: PolyesterMutationOptions): Promise<void>;
|
|
38
38
|
/**
|
|
39
39
|
* Updates mutable key metadata, ACTIVE/DISABLED status, IP whitelist replacement/clearing, and optional expiry; revocation must use delete.
|
|
40
40
|
*/
|
|
41
|
-
update(payload:
|
|
41
|
+
update(payload: v.InferInput<typeof ApiKeysUpdateInputSchema>, options?: PolyesterMutationOptions): Promise<ApiKey | null>;
|
|
42
42
|
/**
|
|
43
43
|
* Generates an Ed25519 keypair locally and returns public and secret key material as both hex strings and byte arrays; only the public key should be sent to the API.
|
|
44
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.ts"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.ts"],"mappings":";;;;;;;;;;;UA0BU,8BAA8B,mBAAmB;EACvD;;;;;cAMS;;WACA,UAAU;EAMP,YAAA,WAAW,WAAW,UAAU,mBAAmB,WAAW;;;;EAUpE,KACF,SAAQ,EAAE,kBAAkB,yBAC5B,UAAU,0BACX,QAAQ;;;;EAcL,IACF,OAAO,EAAE,kBAAkB,sBAC3B,UAAU,0BACX,QAAQ;;;;EASL,OACF,SAAS,EAAE,kBAAkB,2BAC7B,UAAU,2BACX,QAAQ;;;;EAaL,OACF,OAAO,EAAE,kBAAkB,sBAC3B,UAAU,2BACX;;;;EAQG,OACF,SAAS,EAAE,kBAAkB,2BAC7B,UAAU,2BACX,QAAQ;;;;EAYL,mBAAmB;IACrB;MAAa;MAAa,OAAO;;IACjC;MAAa;MAAa,OAAO;;;;;;EAkBrC,UAAU,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.js","names":["#client","Proto.ApiKeyService","#realtime","#resolver","
|
|
1
|
+
{"version":3,"file":"api-keys.js","names":["#client","Proto.ApiKeyService","#realtime","#resolver","ApiKeySchema","Proto.ApiKeySchema"],"sources":["../../../src/services/api-keys/api-keys.ts"],"sourcesContent":["import { createClient, type Client, type Transport } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/api_keys_pb.js\";\nimport type * 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 { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport { keygenAsync } from \"@noble/ed25519\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport { ApiKeyPoliciesService } from \"../policies/api-key-policies/index.js\";\nimport {\n ApiKeyIdInputSchema,\n ApiKeysListInputSchema,\n ApiKeysCreateInputSchema,\n ApiKeysUpdateInputSchema,\n ApiKeySchema,\n ApiKeysSchema,\n type ApiKey,\n} from \"./api-keys.schemas.js\";\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Manages API key metadata, client-generated Ed25519 keypairs, policies, and realtime API key updates.\n */\nexport class ApiKeysService {\n readonly policies: ApiKeyPoliciesService;\n\n #client: Client<typeof Proto.ApiKeyService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(transport: Transport, realtime: PolyesterRealtime, resolver?: SubaccountResolver) {\n this.policies = new ApiKeyPoliciesService(transport);\n this.#client = createClient(Proto.ApiKeyService, transport);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns non-revoked API keys owned by the caller, newest first, optionally scoped through an explicit or resolver-provided subaccount ID.\n */\n async list(\n params: v.InferInput<typeof ApiKeysListInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<ApiKey[]> {\n const resolved = resolveAccountScopedInput(params, this.#resolver);\n const validatedParams = parse(ApiKeysListInputSchema, resolved);\n const res = await this.#client.listApiKeys(\n removeUndefined(validatedParams),\n toConnectCallOptions(options),\n );\n\n return parse(ApiKeysSchema, res.apiKeys);\n }\n\n /**\n * Fetches one caller-owned API key by ak_... key ID and returns null when no matching key is returned.\n */\n async get(\n input: v.InferInput<typeof ApiKeyIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<ApiKey | null> {\n const validatedInput = parse(ApiKeyIdInputSchema, input);\n const res = await this.#client.getApiKey(validatedInput, toConnectCallOptions(options));\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Creates API key metadata using a client-generated Ed25519 public key; security settings may require MFA fresh step-up and retrying with stepUpToken.\n */\n async create(\n payload: v.InferInput<typeof ApiKeysCreateInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKey | null> {\n const resolved = resolveAccountScopedInput(payload, this.#resolver);\n const validatedPayload = parse(ApiKeysCreateInputSchema, resolved);\n const res = await this.#client.createApiKey(\n removeUndefined(validatedPayload),\n toConnectCallOptions(options),\n );\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Permanently revokes the specified API key; revoked keys cannot authenticate again.\n */\n async delete(\n input: v.InferInput<typeof ApiKeyIdInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<void> {\n const validatedInput = parse(ApiKeyIdInputSchema, input);\n await this.#client.deleteApiKey(validatedInput, toConnectCallOptions(options));\n }\n\n /**\n * Updates mutable key metadata, ACTIVE/DISABLED status, IP whitelist replacement/clearing, and optional expiry; revocation must use delete.\n */\n async update(\n payload: v.InferInput<typeof ApiKeysUpdateInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKey | null> {\n const validatedPayload = parse(ApiKeysUpdateInputSchema, payload);\n const res = await this.#client.updateApiKey(\n removeUndefined(validatedPayload),\n toConnectCallOptions(options),\n );\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Generates an Ed25519 keypair locally and returns public and secret key material as both hex strings and byte arrays; only the public key should be sent to the API.\n */\n async generateKeypair(): Promise<{\n publicKey: { hex: string; bytes: Uint8Array };\n secretKey: { hex: string; bytes: Uint8Array };\n }> {\n const { secretKey, publicKey } = await keygenAsync();\n return {\n publicKey: {\n hex: bytesToHex(publicKey),\n bytes: publicKey,\n },\n secretKey: {\n hex: bytesToHex(secretKey),\n bytes: secretKey,\n },\n };\n }\n\n /**\n * Subscribes to private API key updates for an account and emits normalized API key metadata from realtime protobuf publications.\n */\n subscribe(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\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AC3B,gBAAgB,gBAAgB,GAChC,qBAAqB,OAAO,CAChC;EACA,OAAO,IAAI,SAAS,MAAMI,gBAAc,IAAI,MAAM,IAAI;CAC1D;;;;CAKA,MAAM,kBAGH;EACC,MAAM,EAAE,WAAW,cAAc,MAAM,YAAY;EACnD,OAAO;GACH,WAAW;IACP,KAAK,WAAW,SAAS;IACzB,OAAO;GACX;GACA,WAAW;IACP,KAAK,WAAW,SAAS;IACzB,OAAO;GACX;EACJ;CACJ;;;;CAKA,UAAU,OAA8B;EACpC,MAAM,UAAU,yBAAyB,MAAM,UAAU;EAEzD,OAAO,KAAKF,UAAU,oBAAoB;GACtC;GACA,QAAQG;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAMD,gBAAc,IAAI;IACvC,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { validation_d_exports } from "../../shared/validation.js";
|
|
2
1
|
import { ApiKeyStatus as ApiKeyStatus$1 } from "../../gen/auth/v1/api_keys_pb.js";
|
|
2
|
+
import * as v from "valibot";
|
|
3
3
|
//#region src/services/api-keys/api-keys.schemas.d.ts
|
|
4
|
-
declare const ApiKeyStatusSchema:
|
|
5
|
-
type ApiKeyStatus =
|
|
6
|
-
declare const ApiKeysListInputSchema:
|
|
7
|
-
readonly account:
|
|
8
|
-
readonly subaccountId:
|
|
4
|
+
declare const ApiKeyStatusSchema: v.PicklistSchema<readonly ["active", "revoked", "disabled"], undefined>;
|
|
5
|
+
type ApiKeyStatus = v.InferOutput<typeof ApiKeyStatusSchema>;
|
|
6
|
+
declare const ApiKeysListInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
7
|
+
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
8
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
9
9
|
}, undefined>], undefined>, undefined>;
|
|
10
|
-
}, undefined>,
|
|
10
|
+
}, undefined>, v.TransformAction<{
|
|
11
11
|
account?: "active" | "main" | {
|
|
12
12
|
subaccountId: string;
|
|
13
13
|
} | undefined;
|
|
14
14
|
}, {
|
|
15
15
|
subaccountId: bigint | undefined;
|
|
16
16
|
}>]>;
|
|
17
|
-
type ApiKeysListInput =
|
|
18
|
-
declare const ApiKeyIdInputSchema:
|
|
19
|
-
readonly keyId:
|
|
17
|
+
type ApiKeysListInput = v.InferInput<typeof ApiKeysListInputSchema>;
|
|
18
|
+
declare const ApiKeyIdInputSchema: v.StrictObjectSchema<{
|
|
19
|
+
readonly keyId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "keyId is required">]>;
|
|
20
20
|
}, undefined>;
|
|
21
|
-
type ApiKeyIdInput =
|
|
22
|
-
declare const ApiKeysCreateInputSchema:
|
|
23
|
-
readonly ipWhitelist:
|
|
24
|
-
readonly publicKeyEd25519:
|
|
21
|
+
type ApiKeyIdInput = v.InferInput<typeof ApiKeyIdInputSchema>;
|
|
22
|
+
declare const ApiKeysCreateInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
23
|
+
readonly ipWhitelist: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
24
|
+
readonly publicKeyEd25519: v.InstanceSchema<{
|
|
25
25
|
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array<ArrayBufferLike>;
|
|
26
26
|
readonly prototype: Uint8Array<ArrayBufferLike>;
|
|
27
27
|
readonly BYTES_PER_ELEMENT: number;
|
|
@@ -31,13 +31,13 @@ declare const ApiKeysCreateInputSchema: validation_d_exports.SchemaWithPipe<read
|
|
|
31
31
|
from(elements: Iterable<number>): Uint8Array<ArrayBuffer>;
|
|
32
32
|
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
|
|
33
33
|
}, undefined>;
|
|
34
|
-
readonly account:
|
|
35
|
-
readonly subaccountId:
|
|
34
|
+
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
35
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
36
36
|
}, undefined>], undefined>, undefined>;
|
|
37
|
-
readonly label:
|
|
38
|
-
readonly icon:
|
|
39
|
-
readonly color:
|
|
40
|
-
}, undefined>,
|
|
37
|
+
readonly label: v.StringSchema<undefined>;
|
|
38
|
+
readonly icon: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
39
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
40
|
+
}, undefined>, v.TransformAction<{
|
|
41
41
|
ipWhitelist: string[];
|
|
42
42
|
publicKeyEd25519: Uint8Array<ArrayBufferLike>;
|
|
43
43
|
account?: "active" | "main" | {
|
|
@@ -54,17 +54,17 @@ declare const ApiKeysCreateInputSchema: validation_d_exports.SchemaWithPipe<read
|
|
|
54
54
|
icon: string;
|
|
55
55
|
color: string;
|
|
56
56
|
}>]>;
|
|
57
|
-
type ApiKeysCreateInput =
|
|
58
|
-
declare const ApiKeysUpdateInputSchema:
|
|
59
|
-
readonly keyId:
|
|
60
|
-
readonly expectedRevision:
|
|
61
|
-
readonly label:
|
|
62
|
-
readonly icon:
|
|
63
|
-
readonly color:
|
|
64
|
-
readonly status:
|
|
65
|
-
readonly ipWhitelist:
|
|
66
|
-
readonly expiresAtIso:
|
|
67
|
-
}, undefined>,
|
|
57
|
+
type ApiKeysCreateInput = v.InferInput<typeof ApiKeysCreateInputSchema>;
|
|
58
|
+
declare const ApiKeysUpdateInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
59
|
+
readonly keyId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "keyId is required">]>;
|
|
60
|
+
readonly expectedRevision: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, v.RegexAction<string, `${string} must be a decimal integer`>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than 0`>]>;
|
|
61
|
+
readonly label: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
62
|
+
readonly icon: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
63
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
64
|
+
readonly status: v.OptionalSchema<v.PicklistSchema<readonly ["active", "disabled"], undefined>, undefined>;
|
|
65
|
+
readonly ipWhitelist: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
66
|
+
readonly expiresAtIso: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "expiresAtIso must be a valid timestamp">]>, undefined>, undefined>;
|
|
67
|
+
}, undefined>, v.CheckAction<{
|
|
68
68
|
keyId: string;
|
|
69
69
|
expectedRevision: bigint;
|
|
70
70
|
label?: string | undefined;
|
|
@@ -73,7 +73,7 @@ declare const ApiKeysUpdateInputSchema: validation_d_exports.SchemaWithPipe<read
|
|
|
73
73
|
status?: "disabled" | "active" | undefined;
|
|
74
74
|
ipWhitelist?: string[] | undefined;
|
|
75
75
|
expiresAtIso?: string | null | undefined;
|
|
76
|
-
}, "At least one API key field must be provided">,
|
|
76
|
+
}, "At least one API key field must be provided">, v.TransformAction<{
|
|
77
77
|
keyId: string;
|
|
78
78
|
expectedRevision: bigint;
|
|
79
79
|
label?: string | undefined;
|
|
@@ -90,34 +90,34 @@ declare const ApiKeysUpdateInputSchema: validation_d_exports.SchemaWithPipe<read
|
|
|
90
90
|
};
|
|
91
91
|
expectedRevision: bigint;
|
|
92
92
|
}>]>;
|
|
93
|
-
type ApiKeysUpdateInput =
|
|
94
|
-
declare const ApiKeySchema:
|
|
95
|
-
readonly keyId:
|
|
96
|
-
readonly label:
|
|
97
|
-
readonly icon:
|
|
98
|
-
readonly color:
|
|
99
|
-
readonly ipWhitelist:
|
|
100
|
-
readonly subaccountId:
|
|
101
|
-
readonly policyId:
|
|
102
|
-
readonly createdAt:
|
|
103
|
-
readonly seconds:
|
|
104
|
-
readonly nanos:
|
|
105
|
-
}, undefined>,
|
|
93
|
+
type ApiKeysUpdateInput = v.InferInput<typeof ApiKeysUpdateInputSchema>;
|
|
94
|
+
declare const ApiKeySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
95
|
+
readonly keyId: v.StringSchema<undefined>;
|
|
96
|
+
readonly label: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
97
|
+
readonly icon: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
98
|
+
readonly color: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
99
|
+
readonly ipWhitelist: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
100
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
101
|
+
readonly policyId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
102
|
+
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
103
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
104
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
105
|
+
}, undefined>, v.TransformAction<{
|
|
106
106
|
seconds: bigint;
|
|
107
107
|
nanos: number;
|
|
108
108
|
}, number>]>;
|
|
109
|
-
readonly updatedAt:
|
|
110
|
-
readonly seconds:
|
|
111
|
-
readonly nanos:
|
|
109
|
+
readonly updatedAt: v.OptionalSchema<v.ObjectSchema<{
|
|
110
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
111
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
112
112
|
}, undefined>, undefined>;
|
|
113
|
-
readonly lastUsedAt:
|
|
114
|
-
readonly seconds:
|
|
115
|
-
readonly nanos:
|
|
116
|
-
}, undefined>, undefined>,
|
|
113
|
+
readonly lastUsedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
114
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
115
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
116
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
117
117
|
seconds: bigint;
|
|
118
118
|
nanos: number;
|
|
119
119
|
} | undefined, number | undefined>]>;
|
|
120
|
-
readonly publicKeyEd25519:
|
|
120
|
+
readonly publicKeyEd25519: v.InstanceSchema<{
|
|
121
121
|
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array<ArrayBufferLike>;
|
|
122
122
|
readonly prototype: Uint8Array<ArrayBufferLike>;
|
|
123
123
|
readonly BYTES_PER_ELEMENT: number;
|
|
@@ -127,17 +127,17 @@ declare const ApiKeySchema: validation_d_exports.SchemaWithPipe<readonly [valida
|
|
|
127
127
|
from(elements: Iterable<number>): Uint8Array<ArrayBuffer>;
|
|
128
128
|
from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
|
|
129
129
|
}, undefined>;
|
|
130
|
-
readonly expiresAt:
|
|
131
|
-
readonly seconds:
|
|
132
|
-
readonly nanos:
|
|
133
|
-
}, undefined>, undefined>,
|
|
130
|
+
readonly expiresAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
131
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
132
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
133
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
134
134
|
seconds: bigint;
|
|
135
135
|
nanos: number;
|
|
136
136
|
} | undefined, string | undefined>]>;
|
|
137
|
-
readonly status:
|
|
138
|
-
readonly createdByActor:
|
|
139
|
-
readonly revision:
|
|
140
|
-
}, undefined>,
|
|
137
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ApiKeyStatus$1, undefined>, v.TransformAction<ApiKeyStatus$1, "unspecified" | "disabled" | "active" | "revoked">]>;
|
|
138
|
+
readonly createdByActor: v.StringSchema<undefined>;
|
|
139
|
+
readonly revision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
140
|
+
}, undefined>, v.TransformAction<{
|
|
141
141
|
keyId: string;
|
|
142
142
|
label: string;
|
|
143
143
|
icon: string;
|
|
@@ -175,7 +175,7 @@ declare const ApiKeySchema: validation_d_exports.SchemaWithPipe<readonly [valida
|
|
|
175
175
|
createdByActor: string;
|
|
176
176
|
revision: string;
|
|
177
177
|
}>]>;
|
|
178
|
-
type ApiKey =
|
|
178
|
+
type ApiKey = v.InferOutput<typeof ApiKeySchema>;
|
|
179
179
|
//#endregion
|
|
180
180
|
export { ApiKey, ApiKeyIdInput, ApiKeyIdInputSchema, ApiKeySchema, ApiKeyStatus, ApiKeysCreateInput, ApiKeysCreateInputSchema, ApiKeysListInput, ApiKeysListInputSchema, ApiKeysUpdateInput, ApiKeysUpdateInputSchema };
|
|
181
181
|
//# sourceMappingURL=api-keys.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.schemas.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"mappings":";;;cAyBM,oBAAkB,
|
|
1
|
+
{"version":3,"file":"api-keys.schemas.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"mappings":";;;cAyBM,oBAAkB,EAAA;KAGZ,eAAe,EAAE,mBAAmB;cAEnC,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;KASvB,mBAAmB,EAAE,kBAAkB;cAEtC,qBAAmB,EAAA;;;KAIpB,gBAAgB,EAAE,kBAAkB;cAEnC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAezB,qBAAqB,EAAE,kBAAkB;cAsCxC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCzB,qBAAqB,EAAE,kBAAkB;cAExC,cAAY,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8Cb,SAAS,EAAE,mBAAmB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { validation_exports } from "../../shared/validation.js";
|
|
2
1
|
import { requiredEnumLabel } from "../../shared/proto-enum-codec.js";
|
|
3
2
|
import { tsObjToMs, tsObjToNsString } from "../../utils/time.js";
|
|
4
3
|
import { BigIntStringSchema, OptionalPublicIdSchema, OptionalTimestampMsSchema, TimestampMsSchema, TimestampSchema, positiveBigintStringInputSchema } from "../../shared/schemas.js";
|
|
@@ -7,20 +6,21 @@ import { buildProtoPatch, defineProtoPatchFields } from "../../utils/proto-patch
|
|
|
7
6
|
import { toTimestamp } from "../../utils/timestamp.js";
|
|
8
7
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
9
8
|
import { API_KEY_STATUS_VALUES, API_KEY_UPDATE_STATUS_VALUES, ApiKeyStatusCodec } from "./api-keys.codecs.js";
|
|
9
|
+
import * as v from "valibot";
|
|
10
10
|
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
11
11
|
//#region src/services/api-keys/api-keys.schemas.ts
|
|
12
|
-
|
|
13
|
-
const ApiKeyUpdateStatusSchema =
|
|
14
|
-
const ApiKeysListInputSchema =
|
|
15
|
-
const ApiKeyIdInputSchema =
|
|
16
|
-
const ApiKeysCreateInputSchema =
|
|
17
|
-
label:
|
|
18
|
-
icon:
|
|
19
|
-
color:
|
|
12
|
+
v.picklist(API_KEY_STATUS_VALUES);
|
|
13
|
+
const ApiKeyUpdateStatusSchema = v.picklist(API_KEY_UPDATE_STATUS_VALUES);
|
|
14
|
+
const ApiKeysListInputSchema = v.pipe(v.strictObject({ ...AccountScopeInputEntries }), v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })));
|
|
15
|
+
const ApiKeyIdInputSchema = v.strictObject({ keyId: v.pipe(v.string(), v.trim(), v.minLength(1, "keyId is required")) });
|
|
16
|
+
const ApiKeysCreateInputSchema = v.pipe(v.strictObject({
|
|
17
|
+
label: v.string(),
|
|
18
|
+
icon: v.optional(v.string(), ""),
|
|
19
|
+
color: v.optional(v.string(), ""),
|
|
20
20
|
...AccountScopeInputEntries,
|
|
21
|
-
ipWhitelist:
|
|
22
|
-
publicKeyEd25519:
|
|
23
|
-
}),
|
|
21
|
+
ipWhitelist: v.optional(v.array(v.string()), []),
|
|
22
|
+
publicKeyEd25519: v.instance(Uint8Array)
|
|
23
|
+
}), v.transform(({ account, ...input }) => ({
|
|
24
24
|
...input,
|
|
25
25
|
subaccountId: accountScopeToSubaccountId(account)
|
|
26
26
|
})));
|
|
@@ -57,16 +57,16 @@ const API_KEY_PATCH_FIELDS = defineProtoPatchFields()({
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
const ApiKeysUpdateInputSchema =
|
|
61
|
-
keyId:
|
|
60
|
+
const ApiKeysUpdateInputSchema = v.pipe(v.strictObject({
|
|
61
|
+
keyId: v.pipe(v.string(), v.trim(), v.minLength(1, "keyId is required")),
|
|
62
62
|
expectedRevision: positiveBigintStringInputSchema("expectedRevision"),
|
|
63
|
-
label:
|
|
64
|
-
icon:
|
|
65
|
-
color:
|
|
66
|
-
status:
|
|
67
|
-
ipWhitelist:
|
|
68
|
-
expiresAtIso:
|
|
69
|
-
}),
|
|
63
|
+
label: v.optional(v.string()),
|
|
64
|
+
icon: v.optional(v.string()),
|
|
65
|
+
color: v.optional(v.string()),
|
|
66
|
+
status: v.optional(ApiKeyUpdateStatusSchema),
|
|
67
|
+
ipWhitelist: v.optional(v.array(v.string())),
|
|
68
|
+
expiresAtIso: v.optional(v.nullable(v.pipe(v.string(), v.check((value) => Number.isFinite(Date.parse(value)), "expiresAtIso must be a valid timestamp"))))
|
|
69
|
+
}), v.check(({ label, icon, color, status, ipWhitelist, expiresAtIso }) => label !== void 0 || icon !== void 0 || color !== void 0 || status !== void 0 || ipWhitelist !== void 0 || expiresAtIso !== void 0, "At least one API key field must be provided"), v.transform(({ keyId, expectedRevision, ...input }) => {
|
|
70
70
|
const { patch: apiKey, updateMask } = buildProtoPatch(input, API_KEY_PATCH_FIELDS);
|
|
71
71
|
return {
|
|
72
72
|
keyId,
|
|
@@ -75,26 +75,26 @@ const ApiKeysUpdateInputSchema = validation_exports.pipe(validation_exports.stri
|
|
|
75
75
|
expectedRevision
|
|
76
76
|
};
|
|
77
77
|
}));
|
|
78
|
-
const ApiKeySchema =
|
|
79
|
-
keyId:
|
|
80
|
-
label:
|
|
81
|
-
icon:
|
|
82
|
-
color:
|
|
83
|
-
ipWhitelist:
|
|
78
|
+
const ApiKeySchema = v.pipe(v.object({
|
|
79
|
+
keyId: v.string(),
|
|
80
|
+
label: v.optional(v.string(), ""),
|
|
81
|
+
icon: v.optional(v.string(), ""),
|
|
82
|
+
color: v.optional(v.string(), ""),
|
|
83
|
+
ipWhitelist: v.optional(v.array(v.string()), []),
|
|
84
84
|
subaccountId: OptionalPublicIdSchema,
|
|
85
85
|
policyId: OptionalPublicIdSchema,
|
|
86
86
|
createdAt: TimestampMsSchema,
|
|
87
|
-
updatedAt:
|
|
87
|
+
updatedAt: v.optional(TimestampSchema),
|
|
88
88
|
lastUsedAt: OptionalTimestampMsSchema,
|
|
89
|
-
publicKeyEd25519:
|
|
90
|
-
expiresAt:
|
|
89
|
+
publicKeyEd25519: v.instance(Uint8Array),
|
|
90
|
+
expiresAt: v.pipe(v.optional(TimestampSchema), v.transform((v) => {
|
|
91
91
|
const ms = tsObjToMs(v);
|
|
92
92
|
return ms ? new Date(ms).toISOString() : void 0;
|
|
93
93
|
})),
|
|
94
|
-
status:
|
|
95
|
-
createdByActor:
|
|
94
|
+
status: v.pipe(v.enum(ApiKeyStatus), v.transform((v) => requiredEnumLabel(ApiKeyStatusCodec.protoToOutput, v, "PolyesterClient.ApiKeySchema", "status"))),
|
|
95
|
+
createdByActor: v.string(),
|
|
96
96
|
revision: BigIntStringSchema
|
|
97
|
-
}),
|
|
97
|
+
}), v.transform(({ subaccountId, updatedAt, ...rest }) => {
|
|
98
98
|
const hex = bytesToHex(rest.publicKeyEd25519);
|
|
99
99
|
return {
|
|
100
100
|
...rest,
|
|
@@ -104,7 +104,7 @@ const ApiKeySchema = validation_exports.pipe(validation_exports.object({
|
|
|
104
104
|
publicKeyHex: hex
|
|
105
105
|
};
|
|
106
106
|
}));
|
|
107
|
-
const ApiKeysSchema =
|
|
107
|
+
const ApiKeysSchema = v.array(ApiKeySchema);
|
|
108
108
|
//#endregion
|
|
109
109
|
export { ApiKeyIdInputSchema, ApiKeySchema, ApiKeysCreateInputSchema, ApiKeysListInputSchema, ApiKeysSchema, ApiKeysUpdateInputSchema };
|
|
110
110
|
|