@mestra-dev/contract 0.0.63 → 0.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +103 -19
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -167,10 +167,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
167
167
  readonly example: "2025-01-20T10:30:00.000Z";
168
168
  };
169
169
  readonly error: {
170
- readonly type: "object";
171
170
  readonly nullable: true;
172
- readonly description: "Validation error details when the payload is invalid.";
173
- readonly additionalProperties: true;
171
+ readonly description: "Validation details (object) or a linking error string such as Phone already in use.";
172
+ readonly oneOf: readonly [
173
+ {
174
+ readonly type: "object";
175
+ readonly additionalProperties: true;
176
+ },
177
+ {
178
+ readonly type: "string";
179
+ readonly enum: readonly [
180
+ "User not found",
181
+ "Phone is already verified",
182
+ "Email is already verified",
183
+ "Phone already in use",
184
+ "Email already in use",
185
+ "An active OTP already exists"
186
+ ];
187
+ }
188
+ ];
174
189
  };
175
190
  };
176
191
  };
@@ -192,7 +207,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
192
207
  };
193
208
  readonly refreshToken: {
194
209
  readonly type: "string";
195
- readonly description: "JWT refresh token (expires in 12 hours or 7 days when keepSignIn is true). Claims include email and userId.";
210
+ readonly description: "JWT refresh token (expires in 7 days, or 30 days when keepSignIn is true). Claims include email and userId.";
196
211
  };
197
212
  };
198
213
  };
@@ -219,10 +234,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
219
234
  readonly example: null;
220
235
  };
221
236
  readonly error: {
222
- readonly type: "object";
223
237
  readonly nullable: true;
224
- readonly description: "Validation error details when the payload is invalid.";
225
- readonly additionalProperties: true;
238
+ readonly description: "Validation details (object) or a linking error string.";
239
+ readonly oneOf: readonly [
240
+ {
241
+ readonly type: "object";
242
+ readonly additionalProperties: true;
243
+ },
244
+ {
245
+ readonly type: "string";
246
+ readonly enum: readonly [
247
+ "User not found",
248
+ "Invalid or expired OTP",
249
+ "Phone is already verified",
250
+ "Email is already verified",
251
+ "Phone already in use",
252
+ "Email already in use"
253
+ ];
254
+ }
255
+ ];
226
256
  };
227
257
  };
228
258
  };
@@ -4560,7 +4590,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
4560
4590
  };
4561
4591
  };
4562
4592
  readonly 400: {
4563
- readonly description: "Validation failed or an active OTP already exists.";
4593
+ readonly description: "Validation failed, an active OTP already exists, or linking was rejected (email already verified / in use).";
4564
4594
  readonly content: {
4565
4595
  readonly "application/json": {
4566
4596
  readonly schema: {
@@ -4569,6 +4599,16 @@ declare const routes: import("hono/hono-base").HonoBase<{
4569
4599
  };
4570
4600
  };
4571
4601
  };
4602
+ readonly 403: {
4603
+ readonly description: "Authorization header was sent but the access token is missing, invalid, or expired.";
4604
+ readonly content: {
4605
+ readonly "application/json": {
4606
+ readonly schema: {
4607
+ readonly $ref: "#/components/schemas/ErrorResponse";
4608
+ };
4609
+ };
4610
+ };
4611
+ };
4572
4612
  };
4573
4613
  };
4574
4614
  };
@@ -4605,7 +4645,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
4605
4645
  };
4606
4646
  readonly keepSignIn: {
4607
4647
  readonly type: "boolean";
4608
- readonly description: "Extend refresh token validity to 7 days when true (default 12 hours).";
4648
+ readonly description: "Login only. Extend refresh token validity to 30 days when true (default 7 days). Ignored when linking a contact.";
4609
4649
  };
4610
4650
  };
4611
4651
  };
@@ -4614,17 +4654,24 @@ declare const routes: import("hono/hono-base").HonoBase<{
4614
4654
  };
4615
4655
  readonly responses: {
4616
4656
  readonly 200: {
4617
- readonly description: "OTP verified successfully.";
4657
+ readonly description: "Login returns tokens. Linking an email to the current account returns success only (no new tokens).";
4618
4658
  readonly content: {
4619
4659
  readonly "application/json": {
4620
4660
  readonly schema: {
4621
- readonly $ref: "#/components/schemas/VerifyOtpSuccess";
4661
+ readonly oneOf: readonly [
4662
+ {
4663
+ readonly $ref: "#/components/schemas/VerifyOtpSuccess";
4664
+ },
4665
+ {
4666
+ readonly $ref: "#/components/schemas/SimpleSuccess";
4667
+ }
4668
+ ];
4622
4669
  };
4623
4670
  };
4624
4671
  };
4625
4672
  };
4626
4673
  readonly 400: {
4627
- readonly description: "Validation failed or OTP is invalid/expired.";
4674
+ readonly description: "Validation failed, OTP is invalid/expired, or linking was rejected.";
4628
4675
  readonly content: {
4629
4676
  readonly "application/json": {
4630
4677
  readonly schema: {
@@ -4633,6 +4680,16 @@ declare const routes: import("hono/hono-base").HonoBase<{
4633
4680
  };
4634
4681
  };
4635
4682
  };
4683
+ readonly 403: {
4684
+ readonly description: "Authorization header was sent but the access token is missing, invalid, or expired.";
4685
+ readonly content: {
4686
+ readonly "application/json": {
4687
+ readonly schema: {
4688
+ readonly $ref: "#/components/schemas/ErrorResponse";
4689
+ };
4690
+ };
4691
+ };
4692
+ };
4636
4693
  readonly 429: {
4637
4694
  readonly description: "Too Many Requests - Rate limit exceeded.";
4638
4695
  readonly content: {
@@ -4652,7 +4709,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
4652
4709
  "Auth"
4653
4710
  ];
4654
4711
  readonly summary: "Request a one-time password by SMS";
4655
- readonly description: "Without a bearer token this starts SMS login/signup. With an access token it links a phone to the current account (for users who signed in with email). SMS is sent via Kod.mobi only when dialCode is +7.";
4712
+ readonly description: "Without a bearer token this starts SMS login/signup. With an access token it links a phone to the current account (for users who signed in with email). SMS is sent via Kod.mobi only when dialCode is +7. Dial code +98 does not send SMS; the OTP is always 987321 for testing.";
4656
4713
  readonly security: readonly [
4657
4714
  never
4658
4715
  ];
@@ -4694,7 +4751,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
4694
4751
  };
4695
4752
  };
4696
4753
  readonly 400: {
4697
- readonly description: "Validation failed or an active OTP already exists.";
4754
+ readonly description: "Validation failed, an active OTP already exists, or linking was rejected (phone already verified / in use).";
4698
4755
  readonly content: {
4699
4756
  readonly "application/json": {
4700
4757
  readonly schema: {
@@ -4703,6 +4760,16 @@ declare const routes: import("hono/hono-base").HonoBase<{
4703
4760
  };
4704
4761
  };
4705
4762
  };
4763
+ readonly 403: {
4764
+ readonly description: "Authorization header was sent but the access token is missing, invalid, or expired.";
4765
+ readonly content: {
4766
+ readonly "application/json": {
4767
+ readonly schema: {
4768
+ readonly $ref: "#/components/schemas/ErrorResponse";
4769
+ };
4770
+ };
4771
+ };
4772
+ };
4706
4773
  readonly 429: {
4707
4774
  readonly description: "Too Many Requests - Rate limit exceeded.";
4708
4775
  readonly content: {
@@ -4755,7 +4822,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
4755
4822
  };
4756
4823
  readonly keepSignIn: {
4757
4824
  readonly type: "boolean";
4758
- readonly description: "Extend refresh token validity to 30 days when true (default 7 days).";
4825
+ readonly description: "Login only. Extend refresh token validity to 30 days when true (default 7 days). Ignored when linking a contact.";
4759
4826
  };
4760
4827
  };
4761
4828
  };
@@ -4764,17 +4831,24 @@ declare const routes: import("hono/hono-base").HonoBase<{
4764
4831
  };
4765
4832
  readonly responses: {
4766
4833
  readonly 200: {
4767
- readonly description: "OTP verified successfully.";
4834
+ readonly description: "Login returns tokens. Linking a phone to the current account returns success only (no new tokens).";
4768
4835
  readonly content: {
4769
4836
  readonly "application/json": {
4770
4837
  readonly schema: {
4771
- readonly $ref: "#/components/schemas/VerifyOtpSuccess";
4838
+ readonly oneOf: readonly [
4839
+ {
4840
+ readonly $ref: "#/components/schemas/VerifyOtpSuccess";
4841
+ },
4842
+ {
4843
+ readonly $ref: "#/components/schemas/SimpleSuccess";
4844
+ }
4845
+ ];
4772
4846
  };
4773
4847
  };
4774
4848
  };
4775
4849
  };
4776
4850
  readonly 400: {
4777
- readonly description: "Validation failed or OTP is invalid/expired.";
4851
+ readonly description: "Validation failed, OTP is invalid/expired, or linking was rejected.";
4778
4852
  readonly content: {
4779
4853
  readonly "application/json": {
4780
4854
  readonly schema: {
@@ -4783,6 +4857,16 @@ declare const routes: import("hono/hono-base").HonoBase<{
4783
4857
  };
4784
4858
  };
4785
4859
  };
4860
+ readonly 403: {
4861
+ readonly description: "Authorization header was sent but the access token is missing, invalid, or expired.";
4862
+ readonly content: {
4863
+ readonly "application/json": {
4864
+ readonly schema: {
4865
+ readonly $ref: "#/components/schemas/ErrorResponse";
4866
+ };
4867
+ };
4868
+ };
4869
+ };
4786
4870
  readonly 429: {
4787
4871
  readonly description: "Too Many Requests - Rate limit exceeded.";
4788
4872
  readonly content: {
@@ -4802,7 +4886,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
4802
4886
  "Auth"
4803
4887
  ];
4804
4888
  readonly summary: "Get current authenticated user";
4805
- readonly description: "Returns the user profile for the `userId` claim on the provided access token.";
4889
+ readonly description: "Returns the user profile for the `userId` claim on the provided access token. SMS-only accounts have `email: null` until an email is linked. Use `emailVerified` and `phoneVerified` to decide whether the user can create a workspace or accept an invite.";
4806
4890
  readonly security: readonly [
4807
4891
  never
4808
4892
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -27,7 +27,7 @@
27
27
  "devDependencies": {
28
28
  "@types/bun": "^1.3.14",
29
29
  "dts-bundle-generator": "^9.5.1",
30
- "hono": "^4.13.1",
30
+ "hono": "^4.13.2",
31
31
  "typescript": "^5.9.3"
32
32
  }
33
33
  }