@klappay/types 1.0.7 → 1.0.9

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/dist/index.js CHANGED
@@ -30,6 +30,9 @@ __export(index_exports, {
30
30
  CHARGE_EXPIRES_IN_MAX_SECONDS: () => CHARGE_EXPIRES_IN_MAX_SECONDS,
31
31
  CHARGE_EXPIRES_IN_MIN_SECONDS: () => CHARGE_EXPIRES_IN_MIN_SECONDS,
32
32
  CapabilitiesSchema: () => CapabilitiesSchema,
33
+ ChangeEmailSchema: () => ChangeEmailSchema,
34
+ ChangeNameSchema: () => ChangeNameSchema,
35
+ ChangePasswordSchema: () => ChangePasswordSchema,
33
36
  ChargeModeSchema: () => ChargeModeSchema,
34
37
  ChargeSchema: () => ChargeSchema,
35
38
  ChargeStatusEventSchema: () => ChargeStatusEventSchema,
@@ -38,6 +41,7 @@ __export(index_exports, {
38
41
  ChargesDateFieldSchema: () => ChargesDateFieldSchema,
39
42
  ChargesMetricFieldSchema: () => ChargesMetricFieldSchema,
40
43
  ChargesQueryFieldSchema: () => ChargesQueryFieldSchema,
44
+ ConfirmEmailChangeSchema: () => ConfirmEmailChangeSchema,
41
45
  CreateApiKeySchema: () => CreateApiKeySchema,
42
46
  CreateChargeSchema: () => CreateChargeSchema,
43
47
  CreateWebhookSchema: () => CreateWebhookSchema,
@@ -49,6 +53,7 @@ __export(index_exports, {
49
53
  EnvironmentSchema: () => EnvironmentSchema,
50
54
  ErrorPayloadSchema: () => ErrorPayloadSchema,
51
55
  ForgotPasswordSchema: () => ForgotPasswordSchema,
56
+ GetChargeQrCodeQuerySchema: () => GetChargeQrCodeQuerySchema,
52
57
  HealthSchema: () => HealthSchema,
53
58
  InvitationSchema: () => InvitationSchema,
54
59
  InviteUserSchema: () => InviteUserSchema,
@@ -97,6 +102,7 @@ __export(index_exports, {
97
102
  SandboxEventTriggerSchema: () => SandboxEventTriggerSchema,
98
103
  SandboxTriggerSchema: () => SandboxTriggerSchema,
99
104
  SecurityWebhookEventTypeSchema: () => SecurityWebhookEventTypeSchema,
105
+ SelfUserSchema: () => SelfUserSchema,
100
106
  SettlementStatusSchema: () => SettlementStatusSchema,
101
107
  SignupSchema: () => SignupSchema,
102
108
  SplitDistributionStatusSchema: () => SplitDistributionStatusSchema,
@@ -385,6 +391,12 @@ var ListChargesSchema = import_zod6.z.object({
385
391
  isOverpaid: import_zod6.z.enum(["true", "false"]).transform((v) => v === "true").optional()
386
392
  }).extend(PaginationQuerySchema.shape);
387
393
  var PaginatedChargesSchema = paginatedSchema(ChargeSchema);
394
+ var GetChargeQrCodeQuerySchema = import_zod6.z.object({
395
+ token: TokenSchema.optional().describe(
396
+ "Which accepted `(token, network)` pair to encode in the QR \u2014 required if `acceptedPayments` has more than one pair, since there is no single unambiguous default to fall back to. Ignored (and unnecessary) when the charge accepts exactly one pair."
397
+ ),
398
+ network: NetworkSchema.optional()
399
+ });
388
400
  var ChargeStatusEventSchema = import_zod6.z.object({
389
401
  id: import_zod6.z.string(),
390
402
  status: ChargeStatusSchema,
@@ -719,9 +731,12 @@ var SecurityWebhookEventTypeSchema = import_zod9.z.enum([
719
731
  "auth.suspicious_activity",
720
732
  "auth.email_verified",
721
733
  "auth.password_reset_requested",
722
- "auth.password_reset_completed"
734
+ "auth.password_reset_completed",
735
+ "auth.password_changed",
736
+ "auth.email_change_requested",
737
+ "auth.email_changed"
723
738
  ]).describe(
724
- "Account security signals. `auth.suspicious_activity` is a soft heuristic (login from an IP not seen on this account before), not a block \u2014 evaluate it, not enforce against it. `auth.password_reset_requested` only ever dispatches when the requested email actually matches an account (there is nowhere to notify otherwise) \u2014 `POST /v1/auth/forgot-password` itself always returns the same generic response either way, so this event never becomes a second channel for the same enumeration question the endpoint response deliberately avoids answering. `data` per event: `auth.login`: `{ userId, ipAddress }`; `auth.login_failed`: `{ email, ipAddress }`; `auth.suspicious_activity`: `{ userId, ipAddress, previousIpAddress }`; `auth.email_verified`/`auth.password_reset_requested`/`auth.password_reset_completed`: `{ userId, email }`."
739
+ "Account security signals. `auth.suspicious_activity` is a soft heuristic (login from an IP not seen on this account before), not a block \u2014 evaluate it, not enforce against it. `auth.password_reset_requested` only ever dispatches when the requested email actually matches an account (there is nowhere to notify otherwise) \u2014 `POST /v1/auth/forgot-password` itself always returns the same generic response either way, so this event never becomes a second channel for the same enumeration question the endpoint response deliberately avoids answering. `auth.password_changed` is the self-service counterpart to `auth.password_reset_completed` \u2014 fires from `POST /v1/auth/change-password` (requires the current password) instead of the unauthenticated forgot-password flow. `auth.email_change_requested`/`auth.email_changed` are the request/complete pair for `POST /v1/auth/change-email` \u2192 `POST /v1/auth/confirm-email-change` \u2014 the change only takes effect, and `email_changed` only fires, once the confirmation link sent to the *current* address is used. `data` per event: `auth.login`: `{ userId, ipAddress }`; `auth.login_failed`: `{ email, ipAddress }`; `auth.suspicious_activity`: `{ userId, ipAddress, previousIpAddress }`; `auth.email_verified`/`auth.password_reset_requested`/`auth.password_reset_completed`/`auth.password_changed`: `{ userId, email }`; `auth.email_change_requested`: `{ userId, email, newEmail }`; `auth.email_changed`: `{ userId, previousEmail, newEmail }`."
725
740
  );
726
741
  var WebhookEventTypeSchema = import_zod9.z.union([
727
742
  ChargeWebhookEventTypeSchema,
@@ -907,11 +922,26 @@ var ResetPasswordSchema = import_zod13.z.object({
907
922
  var MessageResponseSchema = import_zod13.z.object({
908
923
  message: import_zod13.z.string().describe("Human-readable confirmation, safe to show a user directly.")
909
924
  });
925
+ var SelfUserSchema = UserSchema.omit({ createdAt: true, role: true });
910
926
  var AuthResponseSchema = import_zod13.z.object({
911
927
  token: import_zod13.z.string().describe(
912
928
  "Session JWT, valid 7 days \u2014 use as `Authorization: Bearer <token>` on every `/v1/organizations/*` request (which nests API keys, members, and invitations \u2014 see `GET /v1/organizations`). This token identifies only you; it carries no organization or role \u2014 every `/v1/organizations/{id}/*` request is authorized fresh against your actual membership in that specific organization. This is a separate credential from an API key: it authenticates a human/dashboard session, not payment operations. Create an API key with it before you can create charges."
913
929
  ),
914
- user: UserSchema.omit({ createdAt: true, role: true })
930
+ user: SelfUserSchema
931
+ });
932
+ var ChangeNameSchema = import_zod13.z.object({
933
+ name: import_zod13.z.string().min(1).max(255).describe("Your display name.")
934
+ });
935
+ var ChangePasswordSchema = import_zod13.z.object({
936
+ currentPassword: import_zod13.z.string().min(1).max(128),
937
+ newPassword: import_zod13.z.string().min(8).max(128)
938
+ });
939
+ var ChangeEmailSchema = import_zod13.z.object({
940
+ currentPassword: import_zod13.z.string().min(1).max(128),
941
+ newEmail: NormalizedEmailSchema
942
+ });
943
+ var ConfirmEmailChangeSchema = import_zod13.z.object({
944
+ token: import_zod13.z.string().min(1).describe("The token from the confirmation email sent to your current address.")
915
945
  });
916
946
 
917
947
  // src/organization.ts
@@ -1105,6 +1135,9 @@ var CapabilitiesSchema = import_zod20.z.object({
1105
1135
  CHARGE_EXPIRES_IN_MAX_SECONDS,
1106
1136
  CHARGE_EXPIRES_IN_MIN_SECONDS,
1107
1137
  CapabilitiesSchema,
1138
+ ChangeEmailSchema,
1139
+ ChangeNameSchema,
1140
+ ChangePasswordSchema,
1108
1141
  ChargeModeSchema,
1109
1142
  ChargeSchema,
1110
1143
  ChargeStatusEventSchema,
@@ -1113,6 +1146,7 @@ var CapabilitiesSchema = import_zod20.z.object({
1113
1146
  ChargesDateFieldSchema,
1114
1147
  ChargesMetricFieldSchema,
1115
1148
  ChargesQueryFieldSchema,
1149
+ ConfirmEmailChangeSchema,
1116
1150
  CreateApiKeySchema,
1117
1151
  CreateChargeSchema,
1118
1152
  CreateWebhookSchema,
@@ -1124,6 +1158,7 @@ var CapabilitiesSchema = import_zod20.z.object({
1124
1158
  EnvironmentSchema,
1125
1159
  ErrorPayloadSchema,
1126
1160
  ForgotPasswordSchema,
1161
+ GetChargeQrCodeQuerySchema,
1127
1162
  HealthSchema,
1128
1163
  InvitationSchema,
1129
1164
  InviteUserSchema,
@@ -1172,6 +1207,7 @@ var CapabilitiesSchema = import_zod20.z.object({
1172
1207
  SandboxEventTriggerSchema,
1173
1208
  SandboxTriggerSchema,
1174
1209
  SecurityWebhookEventTypeSchema,
1210
+ SelfUserSchema,
1175
1211
  SettlementStatusSchema,
1176
1212
  SignupSchema,
1177
1213
  SplitDistributionStatusSchema,