waha-shared 1.0.531-orpc.0 → 1.0.532-orpc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,7 +38,7 @@ exports.PaymentSheetParams = zod_1.default.object({
38
38
  * Creates a Stripe PaymentIntent for an app donation, under a Stripe customer
39
39
  * keyed by the caller's Firebase uid.
40
40
  */
41
- const createPaymentIntent = procedure_1.accountProcedure
41
+ const createPaymentIntent = procedure_1.userProcedure
42
42
  .route({ method: 'POST', path: '/create-payment-intent' })
43
43
  .errors({ UPSTREAM_FAILED: errors_1.UPSTREAM_FAILED })
44
44
  .input(exports.CreatePaymentIntentInput)
@@ -16,7 +16,7 @@ export declare const contract: {
16
16
  already_enrolled: "already_enrolled";
17
17
  unsupported_language: "unsupported_language";
18
18
  }>;
19
- }, import("zod/v4/core").$strip>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<Record<never, never>, {
19
+ }, import("zod/v4/core").$strip>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<Record<never, never>, {
20
20
  BAD_REQUEST: {
21
21
  status: number;
22
22
  data: import("zod").ZodObject<{
@@ -40,6 +40,7 @@ export declare const contract: {
40
40
  NO_ACCOUNT_EMAIL: {
41
41
  status: number;
42
42
  };
43
+ }>, {
43
44
  UPSTREAM_FAILED: {
44
45
  status: number;
45
46
  data: import("zod").ZodObject<{
@@ -8,12 +8,15 @@ import z from 'zod';
8
8
  * - `verified`: requires a Firebase ID token (the app) or a reCAPTCHA token
9
9
  * (the website's forms). Anonymous accounts make an ID token free to get, so
10
10
  * either one only shows the caller is a real client, not who they are.
11
- * - `account`: requires a Firebase ID token, because the procedure acts on
12
- * the account's uid or email.
11
+ * - `user`: requires a Firebase ID token, anonymous or signed in, because the
12
+ * procedure acts on the user's uid.
13
+ * - `account`: requires a Firebase ID token with an email, which only a
14
+ * signed-in user's has, because the procedure acts on the account's email.
13
15
  */
14
16
  export declare const ApiAuth: z.ZodEnum<{
15
17
  public: "public";
16
18
  verified: "verified";
19
+ user: "user";
17
20
  account: "account";
18
21
  }>;
19
22
  export type ApiAuth = z.infer<typeof ApiAuth>;
@@ -62,8 +65,30 @@ export declare const procedure: import("@orpc/contract", { with: { "resolution-m
62
65
  }, z.core.$strip>;
63
66
  };
64
67
  }>, ApiMeta & Record<never, never>>;
68
+ /** Starts a `user` procedure. */
69
+ export declare const userProcedure: import("@orpc/contract", { with: { "resolution-mode": "import" } }).ContractProcedureBuilder<import("@orpc/contract", { with: { "resolution-mode": "import" } }).Schema<unknown, unknown>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).Schema<unknown, unknown>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<Record<never, never>, {
70
+ BAD_REQUEST: {
71
+ status: number;
72
+ data: z.ZodObject<{
73
+ issues: z.ZodArray<z.ZodObject<{
74
+ message: z.ZodString;
75
+ path: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
76
+ }, z.core.$strip>>;
77
+ }, z.core.$strip>;
78
+ };
79
+ }>, {
80
+ UNAUTHORIZED: {
81
+ status: number;
82
+ data: z.ZodObject<{
83
+ reason: z.ZodEnum<{
84
+ missing_credentials: "missing_credentials";
85
+ invalid_token: "invalid_token";
86
+ }>;
87
+ }, z.core.$strip>;
88
+ };
89
+ }>, ApiMeta & Record<never, never>>;
65
90
  /** Starts an `account` procedure. */
66
- export declare const accountProcedure: import("@orpc/contract", { with: { "resolution-mode": "import" } }).ContractProcedureBuilder<import("@orpc/contract", { with: { "resolution-mode": "import" } }).Schema<unknown, unknown>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).Schema<unknown, unknown>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<Record<never, never>, {
91
+ export declare const accountProcedure: import("@orpc/contract", { with: { "resolution-mode": "import" } }).ContractProcedureBuilder<import("@orpc/contract", { with: { "resolution-mode": "import" } }).Schema<unknown, unknown>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).Schema<unknown, unknown>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<Record<never, never>, {
67
92
  BAD_REQUEST: {
68
93
  status: number;
69
94
  data: z.ZodObject<{
@@ -83,6 +108,10 @@ export declare const accountProcedure: import("@orpc/contract", { with: { "resol
83
108
  }>;
84
109
  }, z.core.$strip>;
85
110
  };
111
+ }>, {
112
+ NO_ACCOUNT_EMAIL: {
113
+ status: number;
114
+ };
86
115
  }>, ApiMeta & Record<never, never>>;
87
116
  /** Starts a `public` procedure. */
88
117
  export declare const publicProcedure: import("@orpc/contract", { with: { "resolution-mode": "import" } }).ContractProcedureBuilder<import("@orpc/contract", { with: { "resolution-mode": "import" } }).Schema<unknown, unknown>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).Schema<unknown, unknown>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<Record<never, never>, {
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.publicProcedure = exports.accountProcedure = exports.procedure = exports.CAPTCHA_HEADER = exports.ApiAuth = void 0;
6
+ exports.publicProcedure = exports.accountProcedure = exports.userProcedure = exports.procedure = exports.CAPTCHA_HEADER = exports.ApiAuth = void 0;
7
7
  const contract_1 = require("@orpc/contract");
8
8
  const zod_1 = __importDefault(require("zod"));
9
9
  const errors_1 = require("./errors");
@@ -16,10 +16,12 @@ const errors_1 = require("./errors");
16
16
  * - `verified`: requires a Firebase ID token (the app) or a reCAPTCHA token
17
17
  * (the website's forms). Anonymous accounts make an ID token free to get, so
18
18
  * either one only shows the caller is a real client, not who they are.
19
- * - `account`: requires a Firebase ID token, because the procedure acts on
20
- * the account's uid or email.
19
+ * - `user`: requires a Firebase ID token, anonymous or signed in, because the
20
+ * procedure acts on the user's uid.
21
+ * - `account`: requires a Firebase ID token with an email, which only a
22
+ * signed-in user's has, because the procedure acts on the account's email.
21
23
  */
22
- exports.ApiAuth = zod_1.default.enum(['public', 'verified', 'account']);
24
+ exports.ApiAuth = zod_1.default.enum(['public', 'verified', 'user', 'account']);
23
25
  /** Carries a reCAPTCHA token, so auth stays out of procedure inputs. */
24
26
  exports.CAPTCHA_HEADER = 'X-Captcha-Token';
25
27
  const base = contract_1.oc.$meta({ auth: 'verified' }).errors({ BAD_REQUEST: errors_1.BAD_REQUEST });
@@ -33,9 +35,13 @@ exports.procedure = base.errors({
33
35
  // reCAPTCHA itself is unreachable.
34
36
  UPSTREAM_FAILED: errors_1.UPSTREAM_FAILED,
35
37
  });
38
+ /** Starts a `user` procedure. */
39
+ exports.userProcedure = base
40
+ .meta({ auth: 'user' })
41
+ .errors({ UNAUTHORIZED: errors_1.UNAUTHORIZED });
36
42
  /** Starts an `account` procedure. */
37
- exports.accountProcedure = base
43
+ exports.accountProcedure = exports.userProcedure
38
44
  .meta({ auth: 'account' })
39
- .errors({ UNAUTHORIZED: errors_1.UNAUTHORIZED });
45
+ .errors({ NO_ACCOUNT_EMAIL: errors_1.NO_ACCOUNT_EMAIL });
40
46
  /** Starts a `public` procedure. */
41
47
  exports.publicProcedure = base.meta({ auth: 'public' });
@@ -44,7 +44,7 @@ export declare const resend: {
44
44
  already_enrolled: "already_enrolled";
45
45
  unsupported_language: "unsupported_language";
46
46
  }>;
47
- }, z.core.$strip>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<Record<never, never>, {
47
+ }, z.core.$strip>, import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<import("@orpc/contract", { with: { "resolution-mode": "import" } }).MergedErrorMap<Record<never, never>, {
48
48
  BAD_REQUEST: {
49
49
  status: number;
50
50
  data: z.ZodObject<{
@@ -68,6 +68,7 @@ export declare const resend: {
68
68
  NO_ACCOUNT_EMAIL: {
69
69
  status: number;
70
70
  };
71
+ }>, {
71
72
  UPSTREAM_FAILED: {
72
73
  status: number;
73
74
  data: z.ZodObject<{
@@ -27,7 +27,7 @@ exports.SubscribeDripBody = zod_1.default.object({
27
27
  /** Signs a newly signed-up app user up for a localized onboarding drip. */
28
28
  const subscribeDrip = procedure_1.accountProcedure
29
29
  .route({ method: 'POST', path: '/subscribe-drip' })
30
- .errors({ NO_ACCOUNT_EMAIL: errors_1.NO_ACCOUNT_EMAIL, UPSTREAM_FAILED: errors_1.UPSTREAM_FAILED })
30
+ .errors({ UPSTREAM_FAILED: errors_1.UPSTREAM_FAILED })
31
31
  .input(exports.SubscribeDripBody)
32
32
  .output(zod_1.default.object({
33
33
  status: zod_1.default.enum(['enrolled', 'already_enrolled', 'unsupported_language']),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waha-shared",
3
- "version": "1.0.531-orpc.0",
3
+ "version": "1.0.532-orpc.0",
4
4
  "author": "Waha",
5
5
  "dependencies": {
6
6
  "@types/signale": "^1.4.7",