@solvapay/server 1.0.8-preview.8 → 1.0.8-preview.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.
Files changed (141) hide show
  1. package/dist/edge.d.ts +24 -1
  2. package/dist/edge.js +72 -0
  3. package/dist/index.cjs +12 -307
  4. package/dist/index.d.cts +3 -35
  5. package/dist/index.d.ts +3 -35
  6. package/dist/index.js +12 -303
  7. package/package.json +7 -7
  8. package/dist/chunk-R5U7XKVJ.js +0 -16
  9. package/dist/dist-EPVKJAIP.js +0 -94
  10. package/dist/dist-JBJ4HMP7.js +0 -94
  11. package/dist/esm-5GYCIXIY.js +0 -3475
  12. package/dist/esm-UW7WCMEK.js +0 -3475
  13. package/dist/src/adapters/base.d.ts +0 -57
  14. package/dist/src/adapters/base.d.ts.map +0 -1
  15. package/dist/src/adapters/base.js +0 -73
  16. package/dist/src/adapters/base.js.map +0 -1
  17. package/dist/src/adapters/http.d.ts +0 -25
  18. package/dist/src/adapters/http.d.ts.map +0 -1
  19. package/dist/src/adapters/http.js +0 -99
  20. package/dist/src/adapters/http.js.map +0 -1
  21. package/dist/src/adapters/index.d.ts +0 -11
  22. package/dist/src/adapters/index.d.ts.map +0 -1
  23. package/dist/src/adapters/index.js +0 -10
  24. package/dist/src/adapters/index.js.map +0 -1
  25. package/dist/src/adapters/mcp.d.ts +0 -24
  26. package/dist/src/adapters/mcp.d.ts.map +0 -1
  27. package/dist/src/adapters/mcp.js +0 -75
  28. package/dist/src/adapters/mcp.js.map +0 -1
  29. package/dist/src/adapters/next.d.ts +0 -24
  30. package/dist/src/adapters/next.d.ts.map +0 -1
  31. package/dist/src/adapters/next.js +0 -109
  32. package/dist/src/adapters/next.js.map +0 -1
  33. package/dist/src/client.d.ts +0 -58
  34. package/dist/src/client.d.ts.map +0 -1
  35. package/dist/src/client.js +0 -495
  36. package/dist/src/client.js.map +0 -1
  37. package/dist/src/edge.d.ts +0 -22
  38. package/dist/src/edge.d.ts.map +0 -1
  39. package/dist/src/edge.js +0 -91
  40. package/dist/src/edge.js.map +0 -1
  41. package/dist/src/factory.d.ts +0 -605
  42. package/dist/src/factory.d.ts.map +0 -1
  43. package/dist/src/factory.js +0 -215
  44. package/dist/src/factory.js.map +0 -1
  45. package/dist/src/helpers/auth.d.ts +0 -47
  46. package/dist/src/helpers/auth.d.ts.map +0 -1
  47. package/dist/src/helpers/auth.js +0 -73
  48. package/dist/src/helpers/auth.js.map +0 -1
  49. package/dist/src/helpers/checkout.d.ts +0 -45
  50. package/dist/src/helpers/checkout.d.ts.map +0 -1
  51. package/dist/src/helpers/checkout.js +0 -89
  52. package/dist/src/helpers/checkout.js.map +0 -1
  53. package/dist/src/helpers/customer.d.ts +0 -51
  54. package/dist/src/helpers/customer.d.ts.map +0 -1
  55. package/dist/src/helpers/customer.js +0 -77
  56. package/dist/src/helpers/customer.js.map +0 -1
  57. package/dist/src/helpers/error.d.ts +0 -15
  58. package/dist/src/helpers/error.d.ts.map +0 -1
  59. package/dist/src/helpers/error.js +0 -35
  60. package/dist/src/helpers/error.js.map +0 -1
  61. package/dist/src/helpers/index.d.ts +0 -17
  62. package/dist/src/helpers/index.d.ts.map +0 -1
  63. package/dist/src/helpers/index.js +0 -23
  64. package/dist/src/helpers/index.js.map +0 -1
  65. package/dist/src/helpers/payment.d.ts +0 -107
  66. package/dist/src/helpers/payment.d.ts.map +0 -1
  67. package/dist/src/helpers/payment.js +0 -150
  68. package/dist/src/helpers/payment.js.map +0 -1
  69. package/dist/src/helpers/plans.d.ts +0 -19
  70. package/dist/src/helpers/plans.d.ts.map +0 -1
  71. package/dist/src/helpers/plans.js +0 -53
  72. package/dist/src/helpers/plans.js.map +0 -1
  73. package/dist/src/helpers/renewal.d.ts +0 -23
  74. package/dist/src/helpers/renewal.d.ts.map +0 -1
  75. package/dist/src/helpers/renewal.js +0 -90
  76. package/dist/src/helpers/renewal.js.map +0 -1
  77. package/dist/src/helpers/subscription.d.ts +0 -23
  78. package/dist/src/helpers/subscription.d.ts.map +0 -1
  79. package/dist/src/helpers/subscription.js +0 -101
  80. package/dist/src/helpers/subscription.js.map +0 -1
  81. package/dist/src/helpers/types.d.ts +0 -22
  82. package/dist/src/helpers/types.d.ts.map +0 -1
  83. package/dist/src/helpers/types.js +0 -7
  84. package/dist/src/helpers/types.js.map +0 -1
  85. package/dist/src/index.d.ts +0 -73
  86. package/dist/src/index.d.ts.map +0 -1
  87. package/dist/src/index.js +0 -106
  88. package/dist/src/index.js.map +0 -1
  89. package/dist/src/mcp/auth-bridge.d.ts +0 -9
  90. package/dist/src/mcp/auth-bridge.d.ts.map +0 -1
  91. package/dist/src/mcp/auth-bridge.js +0 -46
  92. package/dist/src/mcp/auth-bridge.js.map +0 -1
  93. package/dist/src/mcp/oauth-bridge.d.ts +0 -48
  94. package/dist/src/mcp/oauth-bridge.d.ts.map +0 -1
  95. package/dist/src/mcp/oauth-bridge.js +0 -110
  96. package/dist/src/mcp/oauth-bridge.js.map +0 -1
  97. package/dist/src/mcp-auth.d.ts +0 -17
  98. package/dist/src/mcp-auth.d.ts.map +0 -1
  99. package/dist/src/mcp-auth.js +0 -57
  100. package/dist/src/mcp-auth.js.map +0 -1
  101. package/dist/src/paywall.d.ts +0 -119
  102. package/dist/src/paywall.d.ts.map +0 -1
  103. package/dist/src/paywall.js +0 -700
  104. package/dist/src/paywall.js.map +0 -1
  105. package/dist/src/register-virtual-tools-mcp.d.ts +0 -23
  106. package/dist/src/register-virtual-tools-mcp.d.ts.map +0 -1
  107. package/dist/src/register-virtual-tools-mcp.js +0 -86
  108. package/dist/src/register-virtual-tools-mcp.js.map +0 -1
  109. package/dist/src/types/client.d.ts +0 -216
  110. package/dist/src/types/client.d.ts.map +0 -1
  111. package/dist/src/types/client.js +0 -7
  112. package/dist/src/types/client.js.map +0 -1
  113. package/dist/src/types/generated.d.ts +0 -2834
  114. package/dist/src/types/generated.d.ts.map +0 -1
  115. package/dist/src/types/generated.js +0 -6
  116. package/dist/src/types/generated.js.map +0 -1
  117. package/dist/src/types/index.d.ts +0 -13
  118. package/dist/src/types/index.d.ts.map +0 -1
  119. package/dist/src/types/index.js +0 -8
  120. package/dist/src/types/index.js.map +0 -1
  121. package/dist/src/types/options.d.ts +0 -126
  122. package/dist/src/types/options.d.ts.map +0 -1
  123. package/dist/src/types/options.js +0 -8
  124. package/dist/src/types/options.js.map +0 -1
  125. package/dist/src/types/paywall.d.ts +0 -64
  126. package/dist/src/types/paywall.d.ts.map +0 -1
  127. package/dist/src/types/paywall.js +0 -7
  128. package/dist/src/types/paywall.js.map +0 -1
  129. package/dist/src/types/webhook.d.ts +0 -50
  130. package/dist/src/types/webhook.d.ts.map +0 -1
  131. package/dist/src/types/webhook.js +0 -2
  132. package/dist/src/types/webhook.js.map +0 -1
  133. package/dist/src/utils.d.ts +0 -110
  134. package/dist/src/utils.d.ts.map +0 -1
  135. package/dist/src/utils.js +0 -217
  136. package/dist/src/utils.js.map +0 -1
  137. package/dist/src/virtual-tools.d.ts +0 -44
  138. package/dist/src/virtual-tools.d.ts.map +0 -1
  139. package/dist/src/virtual-tools.js +0 -140
  140. package/dist/src/virtual-tools.js.map +0 -1
  141. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,94 +0,0 @@
1
- import "./chunk-R5U7XKVJ.js";
2
-
3
- // ../auth/dist/chunk-OETEFHW6.js
4
- var MockAuthAdapter = class {
5
- async getUserIdFromRequest(req) {
6
- const headers = "headers" in req ? req.headers : req;
7
- const headerUserId = headers.get("x-mock-user-id");
8
- if (headerUserId) {
9
- return headerUserId;
10
- }
11
- if (typeof process !== "undefined" && process.env.MOCK_USER_ID) {
12
- return process.env.MOCK_USER_ID;
13
- }
14
- return null;
15
- }
16
- };
17
-
18
- // ../auth/dist/chunk-B4VVTQWS.js
19
- function getUserIdFromRequest(request, options) {
20
- const headerName = options?.headerName || "x-user-id";
21
- return request.headers.get(headerName);
22
- }
23
- async function getUserEmailFromRequest(request, options) {
24
- const authHeader = request.headers.get("authorization");
25
- if (!authHeader || !authHeader.startsWith("Bearer ")) {
26
- return null;
27
- }
28
- const token = authHeader.slice(7);
29
- if (!token) {
30
- return null;
31
- }
32
- try {
33
- const { jwtVerify } = await import("./esm-5GYCIXIY.js");
34
- const jwtSecret = options?.jwtSecret || process.env.SUPABASE_JWT_SECRET;
35
- if (!jwtSecret) {
36
- return null;
37
- }
38
- const secret = new TextEncoder().encode(jwtSecret);
39
- const { payload } = await jwtVerify(token, secret, {
40
- algorithms: ["HS256"]
41
- });
42
- return payload.email ? String(payload.email) : null;
43
- } catch {
44
- return null;
45
- }
46
- }
47
- async function getUserNameFromRequest(request, options) {
48
- const authHeader = request.headers.get("authorization");
49
- if (!authHeader || !authHeader.startsWith("Bearer ")) {
50
- return null;
51
- }
52
- const token = authHeader.slice(7);
53
- if (!token) {
54
- return null;
55
- }
56
- try {
57
- const { jwtVerify } = await import("./esm-5GYCIXIY.js");
58
- const jwtSecret = options?.jwtSecret || process.env.SUPABASE_JWT_SECRET;
59
- if (!jwtSecret) {
60
- return null;
61
- }
62
- const secret = new TextEncoder().encode(jwtSecret);
63
- const { payload } = await jwtVerify(token, secret, {
64
- algorithms: ["HS256"]
65
- });
66
- const name = payload.user_metadata?.name || payload.name || null;
67
- return name ? String(name) : null;
68
- } catch {
69
- return null;
70
- }
71
- }
72
- function requireUserId(request, options) {
73
- const headerName = options?.headerName || "x-user-id";
74
- const errorMessage = options?.errorMessage || "Unauthorized";
75
- const errorDetails = options?.errorDetails || "User ID not found. Ensure middleware is configured.";
76
- const userId = request.headers.get(headerName);
77
- if (!userId) {
78
- return new Response(
79
- JSON.stringify({ error: errorMessage, details: errorDetails }),
80
- {
81
- status: 401,
82
- headers: { "Content-Type": "application/json" }
83
- }
84
- );
85
- }
86
- return userId;
87
- }
88
- export {
89
- MockAuthAdapter,
90
- getUserEmailFromRequest,
91
- getUserIdFromRequest,
92
- getUserNameFromRequest,
93
- requireUserId
94
- };