@strimz/shared-types 0.1.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.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +69 -0
  3. package/dist/agents.cjs +148 -0
  4. package/dist/agents.cjs.map +1 -0
  5. package/dist/agents.d.cts +317 -0
  6. package/dist/agents.d.ts +317 -0
  7. package/dist/agents.js +137 -0
  8. package/dist/agents.js.map +1 -0
  9. package/dist/api-keys.cjs +91 -0
  10. package/dist/api-keys.cjs.map +1 -0
  11. package/dist/api-keys.d.cts +155 -0
  12. package/dist/api-keys.d.ts +155 -0
  13. package/dist/api-keys.js +84 -0
  14. package/dist/api-keys.js.map +1 -0
  15. package/dist/common.cjs +56 -0
  16. package/dist/common.cjs.map +1 -0
  17. package/dist/common.d.cts +82 -0
  18. package/dist/common.d.ts +82 -0
  19. package/dist/common.js +37 -0
  20. package/dist/common.js.map +1 -0
  21. package/dist/compliance.cjs +61 -0
  22. package/dist/compliance.cjs.map +1 -0
  23. package/dist/compliance.d.cts +59 -0
  24. package/dist/compliance.d.ts +59 -0
  25. package/dist/compliance.js +56 -0
  26. package/dist/compliance.js.map +1 -0
  27. package/dist/customers.cjs +56 -0
  28. package/dist/customers.cjs.map +1 -0
  29. package/dist/customers.d.cts +64 -0
  30. package/dist/customers.d.ts +64 -0
  31. package/dist/customers.js +53 -0
  32. package/dist/customers.js.map +1 -0
  33. package/dist/events.cjs +675 -0
  34. package/dist/events.cjs.map +1 -0
  35. package/dist/events.d.cts +7907 -0
  36. package/dist/events.d.ts +7907 -0
  37. package/dist/events.js +650 -0
  38. package/dist/events.js.map +1 -0
  39. package/dist/index.cjs +976 -0
  40. package/dist/index.cjs.map +1 -0
  41. package/dist/index.d.cts +113 -0
  42. package/dist/index.d.ts +113 -0
  43. package/dist/index.js +858 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/invoices.cjs +72 -0
  46. package/dist/invoices.cjs.map +1 -0
  47. package/dist/invoices.d.cts +159 -0
  48. package/dist/invoices.d.ts +159 -0
  49. package/dist/invoices.js +67 -0
  50. package/dist/invoices.js.map +1 -0
  51. package/dist/merchants.cjs +104 -0
  52. package/dist/merchants.cjs.map +1 -0
  53. package/dist/merchants.d.cts +259 -0
  54. package/dist/merchants.d.ts +259 -0
  55. package/dist/merchants.js +93 -0
  56. package/dist/merchants.js.map +1 -0
  57. package/dist/payment-sessions.cjs +125 -0
  58. package/dist/payment-sessions.cjs.map +1 -0
  59. package/dist/payment-sessions.d.cts +180 -0
  60. package/dist/payment-sessions.d.ts +180 -0
  61. package/dist/payment-sessions.js +120 -0
  62. package/dist/payment-sessions.js.map +1 -0
  63. package/dist/refunds.cjs +81 -0
  64. package/dist/refunds.cjs.map +1 -0
  65. package/dist/refunds.d.cts +91 -0
  66. package/dist/refunds.d.ts +91 -0
  67. package/dist/refunds.js +75 -0
  68. package/dist/refunds.js.map +1 -0
  69. package/dist/storefronts.cjs +223 -0
  70. package/dist/storefronts.cjs.map +1 -0
  71. package/dist/storefronts.d.cts +177 -0
  72. package/dist/storefronts.d.ts +177 -0
  73. package/dist/storefronts.js +216 -0
  74. package/dist/storefronts.js.map +1 -0
  75. package/dist/subscriptions.cjs +175 -0
  76. package/dist/subscriptions.cjs.map +1 -0
  77. package/dist/subscriptions.d.cts +290 -0
  78. package/dist/subscriptions.d.ts +290 -0
  79. package/dist/subscriptions.js +163 -0
  80. package/dist/subscriptions.js.map +1 -0
  81. package/dist/transactions.cjs +67 -0
  82. package/dist/transactions.cjs.map +1 -0
  83. package/dist/transactions.d.cts +78 -0
  84. package/dist/transactions.d.ts +78 -0
  85. package/dist/transactions.js +63 -0
  86. package/dist/transactions.js.map +1 -0
  87. package/dist/webhooks.cjs +116 -0
  88. package/dist/webhooks.cjs.map +1 -0
  89. package/dist/webhooks.d.cts +201 -0
  90. package/dist/webhooks.d.ts +201 -0
  91. package/dist/webhooks.js +107 -0
  92. package/dist/webhooks.js.map +1 -0
  93. package/package.json +134 -0
  94. package/src/agents.ts +149 -0
  95. package/src/api-keys.ts +78 -0
  96. package/src/common.ts +113 -0
  97. package/src/compliance.ts +40 -0
  98. package/src/customers.ts +40 -0
  99. package/src/events.ts +176 -0
  100. package/src/index.ts +23 -0
  101. package/src/invoices.ts +53 -0
  102. package/src/merchants.ts +104 -0
  103. package/src/payment-sessions.ts +131 -0
  104. package/src/refunds.ts +68 -0
  105. package/src/storefronts.ts +89 -0
  106. package/src/subscriptions.ts +180 -0
  107. package/src/tokens.ts +60 -0
  108. package/src/transactions.ts +52 -0
  109. package/src/webhooks.ts +109 -0
@@ -0,0 +1,155 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * API keys.
5
+ *
6
+ * A merchant has independent test and live keys. The full secret is shown
7
+ * exactly once at creation; the backend stores only a hash and a display prefix.
8
+ */
9
+
10
+ declare const apiKeyKindSchema: z.ZodEnum<["secret", "publishable"]>;
11
+ type ApiKeyKind = z.infer<typeof apiKeyKindSchema>;
12
+ /**
13
+ * Underscore-separated to match the Prisma `ApiKeyScope` enum (Prisma
14
+ * does not allow `:` in enum values). The DB and the wire format use the
15
+ * same form so there is no boundary translation.
16
+ */
17
+ declare const apiKeyScopeSchema: z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write"]>;
18
+ type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>;
19
+ declare const apiKeySchema: z.ZodObject<{
20
+ id: z.ZodString;
21
+ merchantId: z.ZodString;
22
+ name: z.ZodString;
23
+ kind: z.ZodEnum<["secret", "publishable"]>;
24
+ mode: z.ZodEnum<["test", "live"]>;
25
+ prefix: z.ZodString;
26
+ lastFour: z.ZodString;
27
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write"]>, "atleastone">;
28
+ createdAt: z.ZodString;
29
+ lastUsedAt: z.ZodNullable<z.ZodString>;
30
+ revokedAt: z.ZodNullable<z.ZodString>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ id: string;
33
+ merchantId: string;
34
+ name: string;
35
+ kind: "secret" | "publishable";
36
+ mode: "test" | "live";
37
+ prefix: string;
38
+ lastFour: string;
39
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
40
+ createdAt: string;
41
+ lastUsedAt: string | null;
42
+ revokedAt: string | null;
43
+ }, {
44
+ id: string;
45
+ merchantId: string;
46
+ name: string;
47
+ kind: "secret" | "publishable";
48
+ mode: "test" | "live";
49
+ prefix: string;
50
+ lastFour: string;
51
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
52
+ createdAt: string;
53
+ lastUsedAt: string | null;
54
+ revokedAt: string | null;
55
+ }>;
56
+ type ApiKey = z.infer<typeof apiKeySchema>;
57
+ declare const createApiKeyInputSchema: z.ZodObject<{
58
+ name: z.ZodString;
59
+ kind: z.ZodEnum<["secret", "publishable"]>;
60
+ mode: z.ZodEnum<["test", "live"]>;
61
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write"]>, "atleastone">;
62
+ }, "strip", z.ZodTypeAny, {
63
+ name: string;
64
+ kind: "secret" | "publishable";
65
+ mode: "test" | "live";
66
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
67
+ }, {
68
+ name: string;
69
+ kind: "secret" | "publishable";
70
+ mode: "test" | "live";
71
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
72
+ }>;
73
+ type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>;
74
+ declare const createApiKeyOutputSchema: z.ZodObject<{
75
+ apiKey: z.ZodObject<{
76
+ id: z.ZodString;
77
+ merchantId: z.ZodString;
78
+ name: z.ZodString;
79
+ kind: z.ZodEnum<["secret", "publishable"]>;
80
+ mode: z.ZodEnum<["test", "live"]>;
81
+ prefix: z.ZodString;
82
+ lastFour: z.ZodString;
83
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write"]>, "atleastone">;
84
+ createdAt: z.ZodString;
85
+ lastUsedAt: z.ZodNullable<z.ZodString>;
86
+ revokedAt: z.ZodNullable<z.ZodString>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ id: string;
89
+ merchantId: string;
90
+ name: string;
91
+ kind: "secret" | "publishable";
92
+ mode: "test" | "live";
93
+ prefix: string;
94
+ lastFour: string;
95
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
96
+ createdAt: string;
97
+ lastUsedAt: string | null;
98
+ revokedAt: string | null;
99
+ }, {
100
+ id: string;
101
+ merchantId: string;
102
+ name: string;
103
+ kind: "secret" | "publishable";
104
+ mode: "test" | "live";
105
+ prefix: string;
106
+ lastFour: string;
107
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
108
+ createdAt: string;
109
+ lastUsedAt: string | null;
110
+ revokedAt: string | null;
111
+ }>;
112
+ /** Full plaintext key — shown exactly once. */
113
+ secret: z.ZodString;
114
+ }, "strip", z.ZodTypeAny, {
115
+ secret: string;
116
+ apiKey: {
117
+ id: string;
118
+ merchantId: string;
119
+ name: string;
120
+ kind: "secret" | "publishable";
121
+ mode: "test" | "live";
122
+ prefix: string;
123
+ lastFour: string;
124
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
125
+ createdAt: string;
126
+ lastUsedAt: string | null;
127
+ revokedAt: string | null;
128
+ };
129
+ }, {
130
+ secret: string;
131
+ apiKey: {
132
+ id: string;
133
+ merchantId: string;
134
+ name: string;
135
+ kind: "secret" | "publishable";
136
+ mode: "test" | "live";
137
+ prefix: string;
138
+ lastFour: string;
139
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
140
+ createdAt: string;
141
+ lastUsedAt: string | null;
142
+ revokedAt: string | null;
143
+ };
144
+ }>;
145
+ type CreateApiKeyOutput = z.infer<typeof createApiKeyOutputSchema>;
146
+ declare const rotateApiKeyInputSchema: z.ZodObject<{
147
+ id: z.ZodString;
148
+ }, "strip", z.ZodTypeAny, {
149
+ id: string;
150
+ }, {
151
+ id: string;
152
+ }>;
153
+ type RotateApiKeyInput = z.infer<typeof rotateApiKeyInputSchema>;
154
+
155
+ export { type ApiKey, type ApiKeyKind, type ApiKeyScope, type CreateApiKeyInput, type CreateApiKeyOutput, type RotateApiKeyInput, apiKeyKindSchema, apiKeySchema, apiKeyScopeSchema, createApiKeyInputSchema, createApiKeyOutputSchema, rotateApiKeyInputSchema };
@@ -0,0 +1,155 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * API keys.
5
+ *
6
+ * A merchant has independent test and live keys. The full secret is shown
7
+ * exactly once at creation; the backend stores only a hash and a display prefix.
8
+ */
9
+
10
+ declare const apiKeyKindSchema: z.ZodEnum<["secret", "publishable"]>;
11
+ type ApiKeyKind = z.infer<typeof apiKeyKindSchema>;
12
+ /**
13
+ * Underscore-separated to match the Prisma `ApiKeyScope` enum (Prisma
14
+ * does not allow `:` in enum values). The DB and the wire format use the
15
+ * same form so there is no boundary translation.
16
+ */
17
+ declare const apiKeyScopeSchema: z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write"]>;
18
+ type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>;
19
+ declare const apiKeySchema: z.ZodObject<{
20
+ id: z.ZodString;
21
+ merchantId: z.ZodString;
22
+ name: z.ZodString;
23
+ kind: z.ZodEnum<["secret", "publishable"]>;
24
+ mode: z.ZodEnum<["test", "live"]>;
25
+ prefix: z.ZodString;
26
+ lastFour: z.ZodString;
27
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write"]>, "atleastone">;
28
+ createdAt: z.ZodString;
29
+ lastUsedAt: z.ZodNullable<z.ZodString>;
30
+ revokedAt: z.ZodNullable<z.ZodString>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ id: string;
33
+ merchantId: string;
34
+ name: string;
35
+ kind: "secret" | "publishable";
36
+ mode: "test" | "live";
37
+ prefix: string;
38
+ lastFour: string;
39
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
40
+ createdAt: string;
41
+ lastUsedAt: string | null;
42
+ revokedAt: string | null;
43
+ }, {
44
+ id: string;
45
+ merchantId: string;
46
+ name: string;
47
+ kind: "secret" | "publishable";
48
+ mode: "test" | "live";
49
+ prefix: string;
50
+ lastFour: string;
51
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
52
+ createdAt: string;
53
+ lastUsedAt: string | null;
54
+ revokedAt: string | null;
55
+ }>;
56
+ type ApiKey = z.infer<typeof apiKeySchema>;
57
+ declare const createApiKeyInputSchema: z.ZodObject<{
58
+ name: z.ZodString;
59
+ kind: z.ZodEnum<["secret", "publishable"]>;
60
+ mode: z.ZodEnum<["test", "live"]>;
61
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write"]>, "atleastone">;
62
+ }, "strip", z.ZodTypeAny, {
63
+ name: string;
64
+ kind: "secret" | "publishable";
65
+ mode: "test" | "live";
66
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
67
+ }, {
68
+ name: string;
69
+ kind: "secret" | "publishable";
70
+ mode: "test" | "live";
71
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
72
+ }>;
73
+ type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>;
74
+ declare const createApiKeyOutputSchema: z.ZodObject<{
75
+ apiKey: z.ZodObject<{
76
+ id: z.ZodString;
77
+ merchantId: z.ZodString;
78
+ name: z.ZodString;
79
+ kind: z.ZodEnum<["secret", "publishable"]>;
80
+ mode: z.ZodEnum<["test", "live"]>;
81
+ prefix: z.ZodString;
82
+ lastFour: z.ZodString;
83
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write"]>, "atleastone">;
84
+ createdAt: z.ZodString;
85
+ lastUsedAt: z.ZodNullable<z.ZodString>;
86
+ revokedAt: z.ZodNullable<z.ZodString>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ id: string;
89
+ merchantId: string;
90
+ name: string;
91
+ kind: "secret" | "publishable";
92
+ mode: "test" | "live";
93
+ prefix: string;
94
+ lastFour: string;
95
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
96
+ createdAt: string;
97
+ lastUsedAt: string | null;
98
+ revokedAt: string | null;
99
+ }, {
100
+ id: string;
101
+ merchantId: string;
102
+ name: string;
103
+ kind: "secret" | "publishable";
104
+ mode: "test" | "live";
105
+ prefix: string;
106
+ lastFour: string;
107
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
108
+ createdAt: string;
109
+ lastUsedAt: string | null;
110
+ revokedAt: string | null;
111
+ }>;
112
+ /** Full plaintext key — shown exactly once. */
113
+ secret: z.ZodString;
114
+ }, "strip", z.ZodTypeAny, {
115
+ secret: string;
116
+ apiKey: {
117
+ id: string;
118
+ merchantId: string;
119
+ name: string;
120
+ kind: "secret" | "publishable";
121
+ mode: "test" | "live";
122
+ prefix: string;
123
+ lastFour: string;
124
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
125
+ createdAt: string;
126
+ lastUsedAt: string | null;
127
+ revokedAt: string | null;
128
+ };
129
+ }, {
130
+ secret: string;
131
+ apiKey: {
132
+ id: string;
133
+ merchantId: string;
134
+ name: string;
135
+ kind: "secret" | "publishable";
136
+ mode: "test" | "live";
137
+ prefix: string;
138
+ lastFour: string;
139
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write")[]];
140
+ createdAt: string;
141
+ lastUsedAt: string | null;
142
+ revokedAt: string | null;
143
+ };
144
+ }>;
145
+ type CreateApiKeyOutput = z.infer<typeof createApiKeyOutputSchema>;
146
+ declare const rotateApiKeyInputSchema: z.ZodObject<{
147
+ id: z.ZodString;
148
+ }, "strip", z.ZodTypeAny, {
149
+ id: string;
150
+ }, {
151
+ id: string;
152
+ }>;
153
+ type RotateApiKeyInput = z.infer<typeof rotateApiKeyInputSchema>;
154
+
155
+ export { type ApiKey, type ApiKeyKind, type ApiKeyScope, type CreateApiKeyInput, type CreateApiKeyOutput, type RotateApiKeyInput, apiKeyKindSchema, apiKeySchema, apiKeyScopeSchema, createApiKeyInputSchema, createApiKeyOutputSchema, rotateApiKeyInputSchema };
@@ -0,0 +1,84 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/api-keys.ts
4
+ var idSchema = z.string().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/, "id must be URL-safe");
5
+ z.string().regex(/^0x[a-fA-F0-9]{40}$/, "must be a 0x-prefixed 40-character hex EVM address").transform((v) => v.toLowerCase());
6
+ z.string().regex(/^0x[a-fA-F0-9]{64}$/, "must be a 0x-prefixed 64-character hex EVM transaction hash");
7
+ z.string().email().trim().toLowerCase().max(320);
8
+ z.string().url().refine((v) => v.startsWith("https://"), {
9
+ message: "must be an https:// URL"
10
+ });
11
+ z.string().url();
12
+ z.string().regex(/^[0-9]+$/, "must be a non-negative integer string (base-10)").refine((v) => BigInt(v) >= 0n, "must be >= 0");
13
+ z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
14
+ var isoTimestampSchema = z.string().datetime({ offset: true, message: "must be an ISO-8601 timestamp" });
15
+ z.string().length(2).regex(/^[A-Z]{2}$/, "must be an ISO-3166 alpha-2 country code");
16
+ z.object({
17
+ limit: z.number().int().min(1).max(100).default(25),
18
+ cursor: z.string().min(1).max(200).nullish()
19
+ });
20
+ z.record(
21
+ z.string().min(1).max(40),
22
+ z.union([z.string().max(500), z.number(), z.boolean(), z.null()])
23
+ ).refine((m) => Object.keys(m).length <= 50, "at most 50 metadata keys").default({});
24
+ var modeSchema = z.enum(["test", "live"]);
25
+ z.enum(["USDC", "EURC"]);
26
+ z.enum(["USDC", "EURC", "USYC"]);
27
+ z.enum(["free", "growth", "business", "enterprise"]);
28
+ z.enum(["testnet", "mainnet"]);
29
+
30
+ // src/api-keys.ts
31
+ var apiKeyKindSchema = z.enum(["secret", "publishable"]);
32
+ var apiKeyScopeSchema = z.enum([
33
+ "sessions_read",
34
+ "sessions_write",
35
+ "subscriptions_read",
36
+ "subscriptions_write",
37
+ "refunds_read",
38
+ "refunds_write",
39
+ "transactions_read",
40
+ "webhooks_read",
41
+ "webhooks_write",
42
+ "invoices_read",
43
+ "invoices_write",
44
+ "storefronts_read",
45
+ "storefronts_write",
46
+ "agents_read",
47
+ "agents_write",
48
+ // Meta-tx relayer — submitting payer-signed EIP-3009 / EIP-2612
49
+ // authorizations on the merchant's behalf. Granted to keys used by
50
+ // hosted checkout and merchants embedding the SDK.
51
+ "relay_read",
52
+ "relay_write"
53
+ ]);
54
+ var apiKeySchema = z.object({
55
+ id: idSchema,
56
+ merchantId: idSchema,
57
+ name: z.string().min(1).max(60),
58
+ kind: apiKeyKindSchema,
59
+ mode: modeSchema,
60
+ prefix: z.string().min(8).max(24),
61
+ lastFour: z.string().length(4),
62
+ scopes: z.array(apiKeyScopeSchema).nonempty(),
63
+ createdAt: isoTimestampSchema,
64
+ lastUsedAt: isoTimestampSchema.nullable(),
65
+ revokedAt: isoTimestampSchema.nullable()
66
+ });
67
+ var createApiKeyInputSchema = z.object({
68
+ name: z.string().min(1).max(60),
69
+ kind: apiKeyKindSchema,
70
+ mode: modeSchema,
71
+ scopes: z.array(apiKeyScopeSchema).nonempty()
72
+ });
73
+ var createApiKeyOutputSchema = z.object({
74
+ apiKey: apiKeySchema,
75
+ /** Full plaintext key — shown exactly once. */
76
+ secret: z.string()
77
+ });
78
+ var rotateApiKeyInputSchema = z.object({
79
+ id: idSchema
80
+ });
81
+
82
+ export { apiKeyKindSchema, apiKeySchema, apiKeyScopeSchema, createApiKeyInputSchema, createApiKeyOutputSchema, rotateApiKeyInputSchema };
83
+ //# sourceMappingURL=api-keys.js.map
84
+ //# sourceMappingURL=api-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common.ts","../src/api-keys.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAGlB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa;AAGJ,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D;AAGlE,CAAA,CAAE,MAAA,EAAO,CAA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CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAChC,QAAA,EAAUA,CAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,CAAA;AAAA,EAC7B,MAAA,EAAQA,CAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA,EAAS;AAAA,EAC5C,SAAA,EAAW,kBAAA;AAAA,EACX,UAAA,EAAY,mBAAmB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,mBAAmB,QAAA;AAChC,CAAC;AAKM,IAAM,uBAAA,GAA0BA,EAAE,MAAA,CAAO;AAAA,EAC9C,IAAA,EAAMA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,CAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA;AACrC,CAAC;AAGM,IAAM,wBAAA,GAA2BA,EAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA;AAAA,EAER,MAAA,EAAQA,EAAE,MAAA;AACZ,CAAC;AAGM,IAAM,uBAAA,GAA0BA,EAAE,MAAA,CAAO;AAAA,EAC9C,EAAA,EAAI;AACN,CAAC","file":"api-keys.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum — mirrors `@strimz/shared-config`. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum — mirrors `@strimz/shared-config`. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * API keys.\n *\n * A merchant has independent test and live keys. The full secret is shown\n * exactly once at creation; the backend stores only a hash and a display prefix.\n */\n\nimport { z } from 'zod'\nimport { idSchema, isoTimestampSchema, modeSchema } from './common.js'\n\nexport const apiKeyKindSchema = z.enum(['secret', 'publishable'])\nexport type ApiKeyKind = z.infer<typeof apiKeyKindSchema>\n\n/**\n * Underscore-separated to match the Prisma `ApiKeyScope` enum (Prisma\n * does not allow `:` in enum values). The DB and the wire format use the\n * same form so there is no boundary translation.\n */\nexport const apiKeyScopeSchema = z.enum([\n 'sessions_read',\n 'sessions_write',\n 'subscriptions_read',\n 'subscriptions_write',\n 'refunds_read',\n 'refunds_write',\n 'transactions_read',\n 'webhooks_read',\n 'webhooks_write',\n 'invoices_read',\n 'invoices_write',\n 'storefronts_read',\n 'storefronts_write',\n 'agents_read',\n 'agents_write',\n // Meta-tx relayer — submitting payer-signed EIP-3009 / EIP-2612\n // authorizations on the merchant's behalf. Granted to keys used by\n // hosted checkout and merchants embedding the SDK.\n 'relay_read',\n 'relay_write',\n])\nexport type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>\n\nexport const apiKeySchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n prefix: z.string().min(8).max(24),\n lastFour: z.string().length(4),\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n createdAt: isoTimestampSchema,\n lastUsedAt: isoTimestampSchema.nullable(),\n revokedAt: isoTimestampSchema.nullable(),\n})\nexport type ApiKey = z.infer<typeof apiKeySchema>\n\n// ---------- DTOs ----------\n\nexport const createApiKeyInputSchema = z.object({\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n})\nexport type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>\n\nexport const createApiKeyOutputSchema = z.object({\n apiKey: apiKeySchema,\n /** Full plaintext key — shown exactly once. */\n secret: z.string(),\n})\nexport type CreateApiKeyOutput = z.infer<typeof createApiKeyOutputSchema>\n\nexport const rotateApiKeyInputSchema = z.object({\n id: idSchema,\n})\nexport type RotateApiKeyInput = z.infer<typeof rotateApiKeyInputSchema>\n"]}
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // src/common.ts
6
+ var idSchema = zod.z.string().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/, "id must be URL-safe");
7
+ var evmAddressSchema = zod.z.string().regex(/^0x[a-fA-F0-9]{40}$/, "must be a 0x-prefixed 40-character hex EVM address").transform((v) => v.toLowerCase());
8
+ var evmTxHashSchema = zod.z.string().regex(/^0x[a-fA-F0-9]{64}$/, "must be a 0x-prefixed 64-character hex EVM transaction hash");
9
+ var emailSchema = zod.z.string().email().trim().toLowerCase().max(320);
10
+ var httpsUrlSchema = zod.z.string().url().refine((v) => v.startsWith("https://"), {
11
+ message: "must be an https:// URL"
12
+ });
13
+ var httpUrlSchema = zod.z.string().url();
14
+ var tokenAmountSchema = zod.z.string().regex(/^[0-9]+$/, "must be a non-negative integer string (base-10)").refine((v) => BigInt(v) >= 0n, "must be >= 0");
15
+ var uintSchema = zod.z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
16
+ var isoTimestampSchema = zod.z.string().datetime({ offset: true, message: "must be an ISO-8601 timestamp" });
17
+ var countryCodeSchema = zod.z.string().length(2).regex(/^[A-Z]{2}$/, "must be an ISO-3166 alpha-2 country code");
18
+ var paginationInputSchema = zod.z.object({
19
+ limit: zod.z.number().int().min(1).max(100).default(25),
20
+ cursor: zod.z.string().min(1).max(200).nullish()
21
+ });
22
+ var makePaginatedSchema = (item) => zod.z.object({
23
+ data: zod.z.array(item),
24
+ nextCursor: zod.z.string().nullable(),
25
+ hasMore: zod.z.boolean()
26
+ });
27
+ var metadataSchema = zod.z.record(
28
+ zod.z.string().min(1).max(40),
29
+ zod.z.union([zod.z.string().max(500), zod.z.number(), zod.z.boolean(), zod.z.null()])
30
+ ).refine((m) => Object.keys(m).length <= 50, "at most 50 metadata keys").default({});
31
+ var modeSchema = zod.z.enum(["test", "live"]);
32
+ var paymentCurrencySchema = zod.z.enum(["USDC", "EURC"]);
33
+ var tokenSymbolSchema = zod.z.enum(["USDC", "EURC", "USYC"]);
34
+ var merchantTierSchema = zod.z.enum(["free", "growth", "business", "enterprise"]);
35
+ var arcEnvironmentSchema = zod.z.enum(["testnet", "mainnet"]);
36
+
37
+ exports.arcEnvironmentSchema = arcEnvironmentSchema;
38
+ exports.countryCodeSchema = countryCodeSchema;
39
+ exports.emailSchema = emailSchema;
40
+ exports.evmAddressSchema = evmAddressSchema;
41
+ exports.evmTxHashSchema = evmTxHashSchema;
42
+ exports.httpUrlSchema = httpUrlSchema;
43
+ exports.httpsUrlSchema = httpsUrlSchema;
44
+ exports.idSchema = idSchema;
45
+ exports.isoTimestampSchema = isoTimestampSchema;
46
+ exports.makePaginatedSchema = makePaginatedSchema;
47
+ exports.merchantTierSchema = merchantTierSchema;
48
+ exports.metadataSchema = metadataSchema;
49
+ exports.modeSchema = modeSchema;
50
+ exports.paginationInputSchema = paginationInputSchema;
51
+ exports.paymentCurrencySchema = paymentCurrencySchema;
52
+ exports.tokenAmountSchema = tokenAmountSchema;
53
+ exports.tokenSymbolSchema = tokenSymbolSchema;
54
+ exports.uintSchema = uintSchema;
55
+ //# sourceMappingURL=common.cjs.map
56
+ //# sourceMappingURL=common.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D;AAGtF,IAAM,WAAA,GAAcA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAGnE,IAAM,cAAA,GAAiBA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,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AO,CAAE,QAAA,EAAS;AAAA,EAChC,OAAA,EAASA,MAAE,OAAA;AACb,CAAC;AAGI,IAAM,iBAAiBA,KAAA,CAC3B,MAAA;AAAA,EACCA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EACxBA,MAAE,KAAA,CAAM,CAACA,MAAE,MAAA,EAAO,CAAE,IAAI,GAAG,CAAA,EAAGA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,OAAA,IAAWA,KAAA,CAAE,IAAA,EAAM,CAAC;AAClE,CAAA,CACC,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,CAAE,MAAA,IAAU,EAAA,EAAI,0BAA0B,CAAA,CACrE,OAAA,CAAQ,EAAE;AAGN,IAAM,aAAaA,KAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC;AAI1C,IAAM,wBAAwBA,KAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC;AAIrD,IAAM,oBAAoBA,KAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAA,EAAQ,MAAM,CAAC;AAIzD,IAAM,kBAAA,GAAqBA,MAAE,IAAA,CAAK,CAAC,QAAQ,QAAA,EAAU,UAAA,EAAY,YAAY,CAAC;AAI9E,IAAM,uBAAuBA,KAAA,CAAE,IAAA,CAAK,CAAC,SAAA,EAAW,SAAS,CAAC","file":"common.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum — mirrors `@strimz/shared-config`. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum — mirrors `@strimz/shared-config`. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n"]}
@@ -0,0 +1,82 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Primitive schemas shared across every entity.
5
+ * Every higher-level schema builds on these so validation is consistent.
6
+ */
7
+
8
+ /** CUID2 or UUID-style opaque identifier. */
9
+ declare const idSchema: z.ZodString;
10
+ /** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */
11
+ declare const evmAddressSchema: z.ZodEffects<z.ZodString, string, string>;
12
+ /** EVM transaction hash. 32-byte hex. */
13
+ declare const evmTxHashSchema: z.ZodString;
14
+ /** Email address, trimmed and lower-cased. */
15
+ declare const emailSchema: z.ZodString;
16
+ /** HTTPS URL. No http:// allowed outside dev. */
17
+ declare const httpsUrlSchema: z.ZodEffects<z.ZodString, string, string>;
18
+ /** URL permitting http and https (dev + prod). */
19
+ declare const httpUrlSchema: z.ZodString;
20
+ /**
21
+ * Amount expressed in the token's smallest unit, serialised as a string to
22
+ * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),
23
+ * 1 USDC is the string "1000000".
24
+ */
25
+ declare const tokenAmountSchema: z.ZodEffects<z.ZodString, string, string>;
26
+ /** Unsigned integer up to 2^53 - 1; validated and returned as number. */
27
+ declare const uintSchema: z.ZodNumber;
28
+ /** ISO-8601 timestamp string (`.toISOString()`-compatible). */
29
+ declare const isoTimestampSchema: z.ZodString;
30
+ /** Two-letter ISO-3166 country code. */
31
+ declare const countryCodeSchema: z.ZodString;
32
+ /** Pagination inputs used by every list endpoint. */
33
+ declare const paginationInputSchema: z.ZodObject<{
34
+ limit: z.ZodDefault<z.ZodNumber>;
35
+ cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ limit: number;
38
+ cursor?: string | null | undefined;
39
+ }, {
40
+ limit?: number | undefined;
41
+ cursor?: string | null | undefined;
42
+ }>;
43
+ type PaginationInput = z.infer<typeof paginationInputSchema>;
44
+ /** Pagination envelope used by every list response. */
45
+ declare const makePaginatedSchema: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
46
+ data: z.ZodArray<T, "many">;
47
+ nextCursor: z.ZodNullable<z.ZodString>;
48
+ hasMore: z.ZodBoolean;
49
+ }, "strip", z.ZodTypeAny, {
50
+ data: T["_output"][];
51
+ nextCursor: string | null;
52
+ hasMore: boolean;
53
+ }, {
54
+ data: T["_input"][];
55
+ nextCursor: string | null;
56
+ hasMore: boolean;
57
+ }>;
58
+ /** Free-form metadata bag the API round-trips for merchants. */
59
+ declare const metadataSchema: z.ZodDefault<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>;
60
+ /** Environment mode carried on every mode-scoped resource. */
61
+ declare const modeSchema: z.ZodEnum<["test", "live"]>;
62
+ type Mode = z.infer<typeof modeSchema>;
63
+ /** Payment token enum — mirrors `@strimz/shared-config`. */
64
+ declare const paymentCurrencySchema: z.ZodEnum<["USDC", "EURC"]>;
65
+ type PaymentCurrency = z.infer<typeof paymentCurrencySchema>;
66
+ /** Every display-level currency (payment + treasury). */
67
+ declare const tokenSymbolSchema: z.ZodEnum<["USDC", "EURC", "USYC"]>;
68
+ type TokenSymbol = z.infer<typeof tokenSymbolSchema>;
69
+ /** Merchant tier enum — mirrors `@strimz/shared-config`. */
70
+ declare const merchantTierSchema: z.ZodEnum<["free", "growth", "business", "enterprise"]>;
71
+ type MerchantTier = z.infer<typeof merchantTierSchema>;
72
+ /** Arc environment enum. */
73
+ declare const arcEnvironmentSchema: z.ZodEnum<["testnet", "mainnet"]>;
74
+ type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>;
75
+ type Id = z.infer<typeof idSchema>;
76
+ type EvmAddress = z.infer<typeof evmAddressSchema>;
77
+ type EvmTxHash = z.infer<typeof evmTxHashSchema>;
78
+ type TokenAmount = z.infer<typeof tokenAmountSchema>;
79
+ type IsoTimestamp = z.infer<typeof isoTimestampSchema>;
80
+ type Metadata = z.infer<typeof metadataSchema>;
81
+
82
+ export { type ArcEnvironment, type EvmAddress, type EvmTxHash, type Id, type IsoTimestamp, type MerchantTier, type Metadata, type Mode, type PaginationInput, type PaymentCurrency, type TokenAmount, type TokenSymbol, arcEnvironmentSchema, countryCodeSchema, emailSchema, evmAddressSchema, evmTxHashSchema, httpUrlSchema, httpsUrlSchema, idSchema, isoTimestampSchema, makePaginatedSchema, merchantTierSchema, metadataSchema, modeSchema, paginationInputSchema, paymentCurrencySchema, tokenAmountSchema, tokenSymbolSchema, uintSchema };