@colveor/admin 0.0.0-stage → 0.5.2

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 (154) hide show
  1. package/LICENSE.md +106 -0
  2. package/TAILWINDADMIN-LICENSE +21 -0
  3. package/dist/account/data.d.ts +1 -0
  4. package/dist/account/data.js +44 -0
  5. package/dist/account/profile.d.ts +6 -0
  6. package/dist/account/profile.js +118 -0
  7. package/dist/account/sessions.d.ts +1 -0
  8. package/dist/account/sessions.js +26 -0
  9. package/dist/account/shared.d.ts +26 -0
  10. package/dist/account/shared.js +44 -0
  11. package/dist/account/two-factor.d.ts +5 -0
  12. package/dist/account/two-factor.js +60 -0
  13. package/dist/actions.d.ts +39 -0
  14. package/dist/actions.js +81 -0
  15. package/dist/api/audit.gen.d.ts +80 -0
  16. package/dist/api/audit.gen.js +43 -0
  17. package/dist/api/auth.gen.d.ts +537 -0
  18. package/dist/api/auth.gen.js +313 -0
  19. package/dist/api/errors.gen.d.ts +16 -0
  20. package/dist/api/errors.gen.js +2 -0
  21. package/dist/api/gormx.gen.d.ts +60 -0
  22. package/dist/api/gormx.gen.js +16 -0
  23. package/dist/api/health.gen.d.ts +103 -0
  24. package/dist/api/health.gen.js +23 -0
  25. package/dist/api/index.gen.d.ts +21 -0
  26. package/dist/api/index.gen.js +22 -0
  27. package/dist/api/invitations.gen.d.ts +128 -0
  28. package/dist/api/invitations.gen.js +57 -0
  29. package/dist/api/ledger.gen.d.ts +269 -0
  30. package/dist/api/ledger.gen.js +113 -0
  31. package/dist/api/msgtemplate.gen.d.ts +31 -0
  32. package/dist/api/msgtemplate.gen.js +2 -0
  33. package/dist/api/notifications.gen.d.ts +66 -0
  34. package/dist/api/notifications.gen.js +28 -0
  35. package/dist/api/outbox.gen.d.ts +8 -0
  36. package/dist/api/outbox.gen.js +2 -0
  37. package/dist/api/queue.gen.d.ts +112 -0
  38. package/dist/api/queue.gen.js +15 -0
  39. package/dist/api/rbac.gen.d.ts +406 -0
  40. package/dist/api/rbac.gen.js +191 -0
  41. package/dist/api/reauth.gen.d.ts +289 -0
  42. package/dist/api/reauth.gen.js +122 -0
  43. package/dist/api/recorded_payments.gen.d.ts +171 -0
  44. package/dist/api/recorded_payments.gen.js +79 -0
  45. package/dist/api/sessions.gen.d.ts +64 -0
  46. package/dist/api/sessions.gen.js +48 -0
  47. package/dist/api/settings.gen.d.ts +147 -0
  48. package/dist/api/settings.gen.js +69 -0
  49. package/dist/api/storage.gen.d.ts +327 -0
  50. package/dist/api/storage.gen.js +208 -0
  51. package/dist/api/support_access.gen.d.ts +155 -0
  52. package/dist/api/support_access.gen.js +131 -0
  53. package/dist/api/users.gen.d.ts +407 -0
  54. package/dist/api/users.gen.js +159 -0
  55. package/dist/api/verification.gen.d.ts +427 -0
  56. package/dist/api/verification.gen.js +280 -0
  57. package/dist/api/webhooks.gen.d.ts +110 -0
  58. package/dist/api/webhooks.gen.js +45 -0
  59. package/dist/auth-layout.d.ts +9 -0
  60. package/dist/auth-layout.js +5 -0
  61. package/dist/client.d.ts +41 -0
  62. package/dist/client.js +72 -0
  63. package/dist/config.d.ts +27 -0
  64. package/dist/config.js +82 -0
  65. package/dist/dates.d.ts +4 -0
  66. package/dist/dates.js +16 -0
  67. package/dist/header.d.ts +12 -0
  68. package/dist/header.js +105 -0
  69. package/dist/icons.d.ts +2 -0
  70. package/dist/icons.js +15 -0
  71. package/dist/index.d.ts +28 -0
  72. package/dist/index.js +42 -0
  73. package/dist/kit/avatar.d.ts +5 -0
  74. package/dist/kit/avatar.js +16 -0
  75. package/dist/kit/badge.d.ts +10 -0
  76. package/dist/kit/badge.js +31 -0
  77. package/dist/kit/card.d.ts +12 -0
  78. package/dist/kit/card.js +7 -0
  79. package/dist/kit/code-area.d.ts +15 -0
  80. package/dist/kit/code-area.js +69 -0
  81. package/dist/kit/dropdown.d.ts +26 -0
  82. package/dist/kit/dropdown.js +67 -0
  83. package/dist/kit/filter-tabs.d.ts +9 -0
  84. package/dist/kit/filter-tabs.js +7 -0
  85. package/dist/kit/modal.d.ts +8 -0
  86. package/dist/kit/modal.js +15 -0
  87. package/dist/kit/page-header.d.ts +13 -0
  88. package/dist/kit/page-header.js +13 -0
  89. package/dist/kit/search.d.ts +4 -0
  90. package/dist/kit/search.js +16 -0
  91. package/dist/kit/tooltip.d.ts +17 -0
  92. package/dist/kit/tooltip.js +52 -0
  93. package/dist/message-editor.d.ts +9 -0
  94. package/dist/message-editor.js +80 -0
  95. package/dist/money.d.ts +10 -0
  96. package/dist/money.js +17 -0
  97. package/dist/next.d.ts +6 -0
  98. package/dist/next.js +19 -0
  99. package/dist/pages/account.d.ts +1 -0
  100. package/dist/pages/account.js +47 -0
  101. package/dist/pages/audit.d.ts +1 -0
  102. package/dist/pages/audit.js +88 -0
  103. package/dist/pages/forgot-password.d.ts +1 -0
  104. package/dist/pages/forgot-password.js +73 -0
  105. package/dist/pages/ledger.d.ts +1 -0
  106. package/dist/pages/ledger.js +132 -0
  107. package/dist/pages/roles.d.ts +1 -0
  108. package/dist/pages/roles.js +102 -0
  109. package/dist/pages/settings.d.ts +1 -0
  110. package/dist/pages/settings.js +86 -0
  111. package/dist/pages/sign-in.d.ts +5 -0
  112. package/dist/pages/sign-in.js +117 -0
  113. package/dist/pages/status.d.ts +1 -0
  114. package/dist/pages/status.js +122 -0
  115. package/dist/pages/support.d.ts +1 -0
  116. package/dist/pages/support.js +90 -0
  117. package/dist/pages/teams.d.ts +1 -0
  118. package/dist/pages/teams.js +94 -0
  119. package/dist/pages/users.d.ts +1 -0
  120. package/dist/pages/users.js +158 -0
  121. package/dist/pages/webhooks.d.ts +1 -0
  122. package/dist/pages/webhooks.js +88 -0
  123. package/dist/permissions.d.ts +5 -0
  124. package/dist/permissions.js +31 -0
  125. package/dist/proof.d.ts +10 -0
  126. package/dist/proof.js +78 -0
  127. package/dist/proxy.d.ts +10 -0
  128. package/dist/proxy.js +166 -0
  129. package/dist/retry.d.ts +8 -0
  130. package/dist/retry.js +30 -0
  131. package/dist/router.d.ts +13 -0
  132. package/dist/router.js +14 -0
  133. package/dist/setting-fields.d.ts +12 -0
  134. package/dist/setting-fields.js +102 -0
  135. package/dist/setting-list.d.ts +22 -0
  136. package/dist/setting-list.js +78 -0
  137. package/dist/shell.d.ts +40 -0
  138. package/dist/shell.js +97 -0
  139. package/dist/support.d.ts +37 -0
  140. package/dist/support.js +76 -0
  141. package/dist/table.d.ts +40 -0
  142. package/dist/table.js +73 -0
  143. package/dist/ui.d.ts +39 -0
  144. package/dist/ui.js +56 -0
  145. package/dist/user-actions.d.ts +30 -0
  146. package/dist/user-actions.js +129 -0
  147. package/dist/user-roles.d.ts +4 -0
  148. package/dist/user-roles.js +51 -0
  149. package/dist/user-row-menu.d.ts +14 -0
  150. package/dist/user-row-menu.js +45 -0
  151. package/dist/version.d.ts +1 -0
  152. package/dist/version.js +3 -0
  153. package/package.json +59 -4
  154. package/README.md +0 -3
@@ -0,0 +1,280 @@
1
+ //////////
2
+ // source: errors.go
3
+ /**
4
+ * Stable error codes for verification. They keep the "auth." prefix they
5
+ * were released with when verification was part of the auth module: a code
6
+ * must not change once clients depend on it.
7
+ */
8
+ export const ErrCodeInvalidCode = "auth.invalid_code";
9
+ /**
10
+ * Stable error codes for verification. They keep the "auth." prefix they
11
+ * were released with when verification was part of the auth module: a code
12
+ * must not change once clients depend on it.
13
+ */
14
+ export const ErrCodeRateLimited = "auth.rate_limited";
15
+ /**
16
+ * Stable error codes for verification. They keep the "auth." prefix they
17
+ * were released with when verification was part of the auth module: a code
18
+ * must not change once clients depend on it.
19
+ */
20
+ export const ErrCodeVerificationExpired = "auth.verification_expired";
21
+ /**
22
+ * Stable error codes for verification. They keep the "auth." prefix they
23
+ * were released with when verification was part of the auth module: a code
24
+ * must not change once clients depend on it.
25
+ */
26
+ export const ErrCodeMaxAttemptsExceeded = "auth.max_attempts_exceeded";
27
+ /**
28
+ * Stable error codes for verification. They keep the "auth." prefix they
29
+ * were released with when verification was part of the auth module: a code
30
+ * must not change once clients depend on it.
31
+ */
32
+ export const ErrCodeInvalidVerificationID = "auth.invalid_verification_id";
33
+ /**
34
+ * Stable error codes for verification. They keep the "auth." prefix they
35
+ * were released with when verification was part of the auth module: a code
36
+ * must not change once clients depend on it.
37
+ */
38
+ export const ErrCodeVerificationMismatch = "auth.verification_mismatch";
39
+ /**
40
+ * Stable error codes for verification. They keep the "auth." prefix they
41
+ * were released with when verification was part of the auth module: a code
42
+ * must not change once clients depend on it.
43
+ */
44
+ export const ErrCodeMissingRecipient = "auth.missing_recipient";
45
+ /**
46
+ * Stable error codes for verification. They keep the "auth." prefix they
47
+ * were released with when verification was part of the auth module: a code
48
+ * must not change once clients depend on it.
49
+ */
50
+ export const ErrCodeVerificationUnavailable = "auth.verification_unavailable";
51
+ /**
52
+ * Stable error codes for verification. They keep the "auth." prefix they
53
+ * were released with when verification was part of the auth module: a code
54
+ * must not change once clients depend on it.
55
+ */
56
+ export const ErrCodeLinkRequiresEmail = "auth.link_requires_email";
57
+ /**
58
+ * Stable error codes for verification. They keep the "auth." prefix they
59
+ * were released with when verification was part of the auth module: a code
60
+ * must not change once clients depend on it.
61
+ */
62
+ export const ErrCodeLinkUnavailable = "auth.link_unavailable";
63
+ /**
64
+ * Stable error codes for verification. They keep the "auth." prefix they
65
+ * were released with when verification was part of the auth module: a code
66
+ * must not change once clients depend on it.
67
+ */
68
+ export const ErrCodeInvalidLink = "auth.invalid_link";
69
+ /**
70
+ * Stable error codes for verification. They keep the "auth." prefix they
71
+ * were released with when verification was part of the auth module: a code
72
+ * must not change once clients depend on it.
73
+ */
74
+ export const ErrCodeMaxResendsExceeded = "auth.max_resends_exceeded";
75
+ /**
76
+ * NoticeAccountUnavailable goes to the owner of an account that is not
77
+ * active when someone starts a verification for it (today: forgot
78
+ * password). The HTTP response is a decoy, so the requester learns
79
+ * nothing; only the inbox owner is told why no code or link arrived.
80
+ */
81
+ export const NoticeAccountUnavailable = "account_unavailable";
82
+ /**
83
+ * NoticeIdentityLinked tells the account owner a Google or Apple
84
+ * sign-in was connected, so a link they did not make (from a stolen
85
+ * session) does not go unnoticed.
86
+ */
87
+ export const NoticeIdentityLinked = "identity_linked";
88
+ /**
89
+ * NoticeIdentifierChanged tells the account owner, at their previous
90
+ * address, that the sign-in email or phone was changed or added.
91
+ */
92
+ export const NoticeIdentifierChanged = "identifier_changed";
93
+ /**
94
+ * NoticeReauthLocked tells the account owner that confirming their
95
+ * identity failed too many times, so that method is locked for now.
96
+ */
97
+ export const NoticeReauthLocked = "reauth_locked";
98
+ /**
99
+ * NoticeSecurityChanged tells the account owner that a way of
100
+ * confirming it's them was added or changed, such as a PIN.
101
+ */
102
+ export const NoticeSecurityChanged = "security_changed";
103
+ /**
104
+ * NoticePasswordChanged tells the account owner their password was
105
+ * set, changed or reset, and that every device was signed out.
106
+ */
107
+ export const NoticePasswordChanged = "password_changed";
108
+ /**
109
+ * NoticeNewSignIn tells the account owner someone signed in from a
110
+ * device not seen before, with the device and IP (NoticeDetails).
111
+ */
112
+ export const NoticeNewSignIn = "new_sign_in";
113
+ /**
114
+ * NoticeRecoveryCodeUsed tells the account owner a two-factor recovery
115
+ * code was used, so its usual second factor was not.
116
+ */
117
+ export const NoticeRecoveryCodeUsed = "recovery_code_used";
118
+ //////////
119
+ // source: ratelimits.go
120
+ /**
121
+ * RateLimitStartIP limits starting and resending per client IP.
122
+ */
123
+ export const RateLimitStartIP = "verification.start_ip";
124
+ /**
125
+ * RateLimitStartRecipient limits sends to one email or phone, on top
126
+ * of the resend cooldown.
127
+ */
128
+ export const RateLimitStartRecipient = "verification.start_recipient";
129
+ /**
130
+ * RateLimitStartDaily caps sends across everyone per day: SMS and
131
+ * email cost money.
132
+ */
133
+ export const RateLimitStartDaily = "verification.start_daily";
134
+ /**
135
+ * RateLimitVerify limits verify attempts per client IP (guessing is
136
+ * also capped per challenge by max_attempts).
137
+ */
138
+ export const RateLimitVerify = "verification.verify";
139
+ //////////
140
+ // source: settings.go
141
+ /**
142
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
143
+ * constants are the single source of truth for the keys; read them through
144
+ * the settings.Reader in modular.Deps. Message templates are one setting
145
+ * per purpose and per notice: see SettingMessage and SettingNotice.
146
+ */
147
+ export const SettingVerificationCodeTTLSeconds = "verification.code_ttl_seconds";
148
+ /**
149
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
150
+ * constants are the single source of truth for the keys; read them through
151
+ * the settings.Reader in modular.Deps. Message templates are one setting
152
+ * per purpose and per notice: see SettingMessage and SettingNotice.
153
+ */
154
+ export const SettingVerificationLinkTTLSeconds = "verification.link_ttl_seconds";
155
+ /**
156
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
157
+ * constants are the single source of truth for the keys; read them through
158
+ * the settings.Reader in modular.Deps. Message templates are one setting
159
+ * per purpose and per notice: see SettingMessage and SettingNotice.
160
+ */
161
+ export const SettingVerificationTokenTTLSeconds = "verification.token_ttl_seconds";
162
+ /**
163
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
164
+ * constants are the single source of truth for the keys; read them through
165
+ * the settings.Reader in modular.Deps. Message templates are one setting
166
+ * per purpose and per notice: see SettingMessage and SettingNotice.
167
+ */
168
+ export const SettingVerificationLinkURL = "verification.link_url";
169
+ /**
170
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
171
+ * constants are the single source of truth for the keys; read them through
172
+ * the settings.Reader in modular.Deps. Message templates are one setting
173
+ * per purpose and per notice: see SettingMessage and SettingNotice.
174
+ */
175
+ export const SettingVerificationMaxResends = "verification.max_resends";
176
+ /**
177
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
178
+ * constants are the single source of truth for the keys; read them through
179
+ * the settings.Reader in modular.Deps. Message templates are one setting
180
+ * per purpose and per notice: see SettingMessage and SettingNotice.
181
+ */
182
+ export const SettingVerificationCodeLength = "verification.code_length";
183
+ /**
184
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
185
+ * constants are the single source of truth for the keys; read them through
186
+ * the settings.Reader in modular.Deps. Message templates are one setting
187
+ * per purpose and per notice: see SettingMessage and SettingNotice.
188
+ */
189
+ export const SettingVerificationMaxAttempts = "verification.max_attempts";
190
+ /**
191
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
192
+ * constants are the single source of truth for the keys; read them through
193
+ * the settings.Reader in modular.Deps. Message templates are one setting
194
+ * per purpose and per notice: see SettingMessage and SettingNotice.
195
+ */
196
+ export const SettingVerificationResendCooldownSeconds = "verification.resend_cooldown_seconds";
197
+ /**
198
+ * Runtime settings this module owns (section 24.5: <module>.<key>). The
199
+ * constants are the single source of truth for the keys; read them through
200
+ * the settings.Reader in modular.Deps. Message templates are one setting
201
+ * per purpose and per notice: see SettingMessage and SettingNotice.
202
+ */
203
+ export const SettingVerificationTestPhones = "verification.test_phones";
204
+ /**
205
+ * Bounds for verification.code_length, shared by the setting's
206
+ * validation and the generator. The upper bound keeps the generated number
207
+ * inside int64 (10^18 < 2^63).
208
+ */
209
+ export const MinCodeLength = 4;
210
+ /**
211
+ * Bounds for verification.code_length, shared by the setting's
212
+ * validation and the generator. The upper bound keeps the generated number
213
+ * inside int64 (10^18 < 2^63).
214
+ */
215
+ export const MaxCodeLength = 18;
216
+ export const ChannelEmail = "email";
217
+ export const ChannelPhone = "phone";
218
+ /**
219
+ * Adding a purpose: add the constant, add it to VerificationPurposes and
220
+ * to the oneof tags on StartVerificationRequest.Purpose and
221
+ * VerifyResponseData.Purpose
222
+ * (TestPurposeTagsMatchRegistry fails until you do), and give it a default
223
+ * message in messageDefaults.
224
+ */
225
+ export const PurposeSignup = "signup";
226
+ /**
227
+ * Adding a purpose: add the constant, add it to VerificationPurposes and
228
+ * to the oneof tags on StartVerificationRequest.Purpose and
229
+ * VerifyResponseData.Purpose
230
+ * (TestPurposeTagsMatchRegistry fails until you do), and give it a default
231
+ * message in messageDefaults.
232
+ */
233
+ export const PurposeLogin = "login";
234
+ /**
235
+ * Adding a purpose: add the constant, add it to VerificationPurposes and
236
+ * to the oneof tags on StartVerificationRequest.Purpose and
237
+ * VerifyResponseData.Purpose
238
+ * (TestPurposeTagsMatchRegistry fails until you do), and give it a default
239
+ * message in messageDefaults.
240
+ */
241
+ export const PurposeForgotPassword = "forgot_password";
242
+ /**
243
+ * Adding a purpose: add the constant, add it to VerificationPurposes and
244
+ * to the oneof tags on StartVerificationRequest.Purpose and
245
+ * VerifyResponseData.Purpose
246
+ * (TestPurposeTagsMatchRegistry fails until you do), and give it a default
247
+ * message in messageDefaults.
248
+ */
249
+ export const PurposeVerifyEmail = "verify_email";
250
+ /**
251
+ * Adding a purpose: add the constant, add it to VerificationPurposes and
252
+ * to the oneof tags on StartVerificationRequest.Purpose and
253
+ * VerifyResponseData.Purpose
254
+ * (TestPurposeTagsMatchRegistry fails until you do), and give it a default
255
+ * message in messageDefaults.
256
+ */
257
+ export const PurposeUpdateEmail = "update_email";
258
+ /**
259
+ * Adding a purpose: add the constant, add it to VerificationPurposes and
260
+ * to the oneof tags on StartVerificationRequest.Purpose and
261
+ * VerifyResponseData.Purpose
262
+ * (TestPurposeTagsMatchRegistry fails until you do), and give it a default
263
+ * message in messageDefaults.
264
+ */
265
+ export const PurposeVerifyPhone = "verify_phone";
266
+ /**
267
+ * Adding a purpose: add the constant, add it to VerificationPurposes and
268
+ * to the oneof tags on StartVerificationRequest.Purpose and
269
+ * VerifyResponseData.Purpose
270
+ * (TestPurposeTagsMatchRegistry fails until you do), and give it a default
271
+ * message in messageDefaults.
272
+ */
273
+ export const PurposeUpdatePhone = "update_phone";
274
+ /**
275
+ * PurposeReauth confirms a signed-in user before a sensitive action
276
+ * (the reauth module's email_code and phone_code methods).
277
+ */
278
+ export const PurposeReauth = "reauth";
279
+ export const DeliveryModeCode = "code";
280
+ export const DeliveryModeLink = "link";
@@ -0,0 +1,110 @@
1
+ /**
2
+ * ActionReplayed is audited when an admin replays a failed event.
3
+ */
4
+ export declare const ActionReplayed = "webhooks.EventReplayed";
5
+ /**
6
+ * Jobs.
7
+ */
8
+ export declare const JobProcess = "webhooks.process";
9
+ /**
10
+ * Jobs.
11
+ */
12
+ export declare const JobPurge = "webhooks.purge";
13
+ /**
14
+ * Statuses of a received event.
15
+ */
16
+ export declare const StatusPending = "pending";
17
+ /**
18
+ * Statuses of a received event.
19
+ */
20
+ export declare const StatusProcessed = "processed";
21
+ /**
22
+ * Statuses of a received event.
23
+ */
24
+ export declare const StatusFailed = "failed";
25
+ /**
26
+ * EventResponse is an event in the admin list. Payload is only in Get.
27
+ */
28
+ export interface EventResponse {
29
+ id: string;
30
+ provider: string;
31
+ event_id: string;
32
+ type: string;
33
+ account?: string;
34
+ status: string;
35
+ attempts: number;
36
+ last_error?: string;
37
+ received_at: string;
38
+ processed_at?: string;
39
+ payload?: string;
40
+ }
41
+ export declare const PermissionRead: string;
42
+ export declare const PermissionReplay: string;
43
+ /**
44
+ * RateLimitReceive limits the webhook route per IP.
45
+ */
46
+ export declare const RateLimitReceive = "webhooks.receive";
47
+ /**
48
+ * Registry is where a module registers its providers, in Require.
49
+ */
50
+ export type Registry = unknown;
51
+ /**
52
+ * Provider is one sender of webhooks. It is reached at
53
+ * POST /v1/webhooks/{name}, or /v1/webhooks/{name}/{account} when each
54
+ * account (a shop) has its own signing secret.
55
+ */
56
+ export interface Provider {
57
+ /**
58
+ * Name is lower-case letters, digits and dashes: "paystack".
59
+ */
60
+ Name: string;
61
+ /**
62
+ * Verify checks the request came from the provider (its signature, and
63
+ * a timestamp when it sends one) and returns the event's ID and type. An
64
+ * error answers 401 and nothing is kept. Use VerifyHMAC and Fresh.
65
+ */
66
+ Verify: unknown;
67
+ /**
68
+ * Handle processes the event, in a job, inside a transaction that also
69
+ * marks the event processed: the module's writes through gormx.Conn
70
+ * commit with it, or neither does. An error retries it with backoff;
71
+ * queue.ErrPermanent stops the retries. Either way a failed event is
72
+ * listed for admins, who can replay it.
73
+ */
74
+ Handle: unknown;
75
+ }
76
+ /**
77
+ * Request is what Verify sees.
78
+ */
79
+ export interface Request {
80
+ /**
81
+ * Account is the last path segment, empty without one.
82
+ */
83
+ Account: string;
84
+ Header: Record<string, string[]>;
85
+ Body: string;
86
+ }
87
+ /**
88
+ * Verified is what Verify found. ID is the provider's event ID, used to
89
+ * drop duplicates; empty means the body's hash.
90
+ */
91
+ export interface Verified {
92
+ ID: string;
93
+ Type: string;
94
+ }
95
+ /**
96
+ * Event is a received event, as Handle gets it.
97
+ */
98
+ export interface Event {
99
+ ID: string;
100
+ Provider: string;
101
+ EventID: string;
102
+ Type: string;
103
+ Account: string;
104
+ Payload: string;
105
+ ReceivedAt: string;
106
+ }
107
+ /**
108
+ * SettingKeepDays is how long a processed event is kept.
109
+ */
110
+ export declare const SettingKeepDays: string;
@@ -0,0 +1,45 @@
1
+ // Code generated by tygo. DO NOT EDIT.
2
+ //////////
3
+ // source: actions.go
4
+ /**
5
+ * ActionReplayed is audited when an admin replays a failed event.
6
+ */
7
+ export const ActionReplayed = "webhooks.EventReplayed";
8
+ /**
9
+ * Jobs.
10
+ */
11
+ export const JobProcess = "webhooks.process";
12
+ /**
13
+ * Jobs.
14
+ */
15
+ export const JobPurge = "webhooks.purge";
16
+ //////////
17
+ // source: dto.go
18
+ /**
19
+ * Statuses of a received event.
20
+ */
21
+ export const StatusPending = "pending";
22
+ /**
23
+ * Statuses of a received event.
24
+ */
25
+ export const StatusProcessed = "processed";
26
+ /**
27
+ * Statuses of a received event.
28
+ */
29
+ export const StatusFailed = "failed";
30
+ //////////
31
+ // source: permissions.go
32
+ export const PermissionRead = "webhooks.read";
33
+ export const PermissionReplay = "webhooks.replay";
34
+ //////////
35
+ // source: ratelimits.go
36
+ /**
37
+ * RateLimitReceive limits the webhook route per IP.
38
+ */
39
+ export const RateLimitReceive = "webhooks.receive";
40
+ //////////
41
+ // source: settings.go
42
+ /**
43
+ * SettingKeepDays is how long a processed event is kept.
44
+ */
45
+ export const SettingKeepDays = "webhooks.keep_days";
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function AuthLayout(props: {
3
+ /** The panel's name, on the brand side. */
4
+ name?: string;
5
+ title: string;
6
+ subtitle?: ReactNode;
7
+ children: ReactNode;
8
+ footer?: ReactNode;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ export function AuthLayout(props) {
4
+ return (_jsxs("div", { className: "grid min-h-screen bg-white lg:grid-cols-2 dark:bg-gray-900", children: [_jsx("div", { className: "flex flex-col justify-center px-6 py-12 sm:px-12", children: _jsxs("div", { className: "mx-auto w-full max-w-md animate-slide-down", children: [_jsx("h1", { className: "text-title-sm font-semibold text-gray-800 sm:text-title-lg dark:text-white/90", children: props.title }), props.subtitle && (_jsx("p", { className: "mt-2 text-sm text-gray-500 dark:text-gray-400", children: props.subtitle })), _jsx("div", { className: "mt-8", children: props.children }), props.footer && (_jsx("div", { className: "mt-6 text-center text-sm text-gray-500 dark:text-gray-400", children: props.footer }))] }) }), _jsxs("div", { className: "relative hidden overflow-hidden bg-brand-950 lg:flex lg:items-center lg:justify-center dark:bg-white/5", children: [_jsx("div", { className: "absolute inset-0 bg-[linear-gradient(to_right,rgba(255,255,255,0.06)_1px,transparent_1px),linear-gradient(to_bottom,rgba(255,255,255,0.06)_1px,transparent_1px)] bg-[size:48px_48px]" }), _jsx("div", { className: "absolute -top-32 -right-32 size-96 rounded-full bg-brand-500/30 blur-3xl" }), _jsx("div", { className: "absolute -bottom-32 -left-32 size-96 rounded-full bg-brand-400/20 blur-3xl" }), _jsxs("div", { className: "relative max-w-sm animate-fade-in px-8 text-center", children: [_jsx("p", { className: "text-3xl font-semibold text-white", children: props.name ?? "Admin" }), _jsx("p", { className: "mt-3 text-gray-400", children: "Manage your users, roles, settings and money in one place." })] })] })] }));
5
+ }
@@ -0,0 +1,41 @@
1
+ import type * as errors from "./api/errors.gen";
2
+ /** Where the proxy is mounted (app/api/colveor/[...path]/route.ts). */
3
+ export declare const proxyPath = "/api/colveor";
4
+ /** An error response: code is the API's stable error code (rbac.forbidden). */
5
+ export declare class ApiError extends Error {
6
+ readonly status: number;
7
+ readonly code: string;
8
+ readonly data: Record<string, unknown>;
9
+ /** The whole response body: a 503 status report still has its checks. */
10
+ readonly body: unknown;
11
+ constructor(status: number, body: Partial<errors.Error>);
12
+ }
13
+ /** What a change may need: useAction fills these in when the API asks. */
14
+ export interface SendOptions {
15
+ /** Why the change is made (X-Reason), for the audit log. */
16
+ reason?: string;
17
+ /** A re-authentication token (X-Reauth-Token), from <StepUp>. */
18
+ reauthToken?: string;
19
+ /** Makes a resent request run once (Idempotency-Key). */
20
+ idempotencyKey?: string;
21
+ }
22
+ export interface CallOptions extends SendOptions {
23
+ method?: string;
24
+ body?: unknown;
25
+ query?: Record<string, string | number | boolean | undefined>;
26
+ headers?: Record<string, string>;
27
+ }
28
+ /** Calls an API path ("/v1/rbac/roles") and returns its JSON. */
29
+ export declare function call<T>(path: string, options?: CallOptions): Promise<T>;
30
+ type Query = CallOptions["query"];
31
+ /** The API, by method. A change takes SendOptions (from useAction's run). */
32
+ export declare const api: {
33
+ get: <T>(path: string, query?: Query) => Promise<T>;
34
+ post: <T>(path: string, body?: unknown, options?: SendOptions) => Promise<T>;
35
+ put: <T>(path: string, body?: unknown, options?: SendOptions) => Promise<T>;
36
+ patch: <T>(path: string, body?: unknown, options?: SendOptions) => Promise<T>;
37
+ delete: <T>(path: string, options?: SendOptions) => Promise<T>;
38
+ };
39
+ /** Signs out this session, then goes to the sign-in page. */
40
+ export declare function signOut(signInPath?: string): Promise<void>;
41
+ export {};
package/dist/client.js ADDED
@@ -0,0 +1,72 @@
1
+ // Calls the API through the proxy (proxy.ts). Types come from the
2
+ // generated namespaces: api.get<gormx.Page<rbac.RoleResponse>>("/v1/rbac/roles").
3
+ /** Where the proxy is mounted (app/api/colveor/[...path]/route.ts). */
4
+ export const proxyPath = "/api/colveor";
5
+ /** An error response: code is the API's stable error code (rbac.forbidden). */
6
+ export class ApiError extends Error {
7
+ status;
8
+ code;
9
+ data;
10
+ /** The whole response body: a 503 status report still has its checks. */
11
+ body;
12
+ constructor(status, body) {
13
+ super(body.message ?? `request failed (${status})`);
14
+ this.status = status;
15
+ this.code = body.code ?? "";
16
+ this.data = body.data ?? {};
17
+ this.body = body;
18
+ }
19
+ }
20
+ /** Calls an API path ("/v1/rbac/roles") and returns its JSON. */
21
+ export async function call(path, options = {}) {
22
+ const query = new URLSearchParams();
23
+ for (const [k, v] of Object.entries(options.query ?? {})) {
24
+ if (v !== undefined && v !== "") {
25
+ query.set(k, String(v));
26
+ }
27
+ }
28
+ const headers = { ...options.headers };
29
+ if (options.body !== undefined) {
30
+ headers["content-type"] = "application/json";
31
+ }
32
+ if (options.reason !== undefined) {
33
+ headers["x-reason"] = options.reason;
34
+ }
35
+ if (options.reauthToken !== undefined) {
36
+ headers["x-reauth-token"] = options.reauthToken;
37
+ }
38
+ if (options.idempotencyKey !== undefined) {
39
+ headers["idempotency-key"] = options.idempotencyKey;
40
+ }
41
+ const qs = query.toString();
42
+ const res = await fetch(proxyPath + path + (qs === "" ? "" : `?${qs}`), {
43
+ method: options.method ?? (options.body === undefined ? "GET" : "POST"),
44
+ headers,
45
+ body: options.body === undefined ? undefined : JSON.stringify(options.body),
46
+ });
47
+ const text = await res.text();
48
+ let json;
49
+ try {
50
+ json = text === "" ? undefined : JSON.parse(text);
51
+ }
52
+ catch {
53
+ json = { message: text };
54
+ }
55
+ if (!res.ok) {
56
+ throw new ApiError(res.status, (json ?? {}));
57
+ }
58
+ return json;
59
+ }
60
+ /** The API, by method. A change takes SendOptions (from useAction's run). */
61
+ export const api = {
62
+ get: (path, query) => call(path, { query }),
63
+ post: (path, body, options) => call(path, { ...options, method: "POST", body }),
64
+ put: (path, body, options) => call(path, { ...options, method: "PUT", body }),
65
+ patch: (path, body, options) => call(path, { ...options, method: "PATCH", body }),
66
+ delete: (path, options) => call(path, { ...options, method: "DELETE" }),
67
+ };
68
+ /** Signs out this session, then goes to the sign-in page. */
69
+ export async function signOut(signInPath = "/login") {
70
+ await call("/v1/auth/logout", { method: "POST" }).catch(() => undefined);
71
+ window.location.assign(signInPath);
72
+ }
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from "react";
2
+ export interface NavItem {
3
+ label: string;
4
+ href: string;
5
+ /**
6
+ * Shown only to users holding it, or any one of a list. A module that is
7
+ * off grants none.
8
+ */
9
+ permission?: string | string[];
10
+ /** Shown beside the label, and alone when the menu is collapsed. */
11
+ icon?: ReactNode;
12
+ /** The menu's heading it goes under ("Management"); items keep their order. */
13
+ group?: string;
14
+ }
15
+ export interface AdminConfig {
16
+ /** The panel's name, in the menu and the browser tab. */
17
+ name: string;
18
+ /** A path or URL of the logo shown above the menu. */
19
+ logo?: string;
20
+ /** The project's own menu items, after the framework's. */
21
+ nav?: NavItem[];
22
+ /** Where signed-out users are sent. Default: /login. */
23
+ signInPath?: string;
24
+ }
25
+ /** Declares admin.config.ts, typed: export default defineConfig({ ... }). */
26
+ export declare function defineConfig(config: AdminConfig): AdminConfig;
27
+ export declare const coreNav: NavItem[];
package/dist/config.js ADDED
@@ -0,0 +1,82 @@
1
+ // admin.config.ts: what a project sets (docs/admin.md, Adding a project page).
2
+ import * as audit from "./api/audit.gen";
3
+ import * as health from "./api/health.gen";
4
+ import * as ledger from "./api/ledger.gen";
5
+ import * as rbac from "./api/rbac.gen";
6
+ import * as settings from "./api/settings.gen";
7
+ import * as support from "./api/support_access.gen";
8
+ import * as users from "./api/users.gen";
9
+ import * as webhooks from "./api/webhooks.gen";
10
+ import { icons } from "./icons";
11
+ /** Declares admin.config.ts, typed: export default defineConfig({ ... }). */
12
+ export function defineConfig(config) {
13
+ return config;
14
+ }
15
+ // The framework's pages, added as they are built (docs/ADMIN_ROADMAP.md, A4).
16
+ export const coreNav = [
17
+ {
18
+ label: "Users",
19
+ href: "/users",
20
+ group: "Management",
21
+ icon: icons.users,
22
+ permission: users.PermissionUserRead,
23
+ },
24
+ {
25
+ label: "Roles",
26
+ href: "/roles",
27
+ group: "Management",
28
+ icon: icons.roles,
29
+ permission: rbac.PermissionRead,
30
+ },
31
+ {
32
+ label: "Teams",
33
+ href: "/teams",
34
+ group: "Management",
35
+ icon: icons.teams,
36
+ permission: rbac.PermissionSuspendTeams,
37
+ },
38
+ // Only while the support_access module is on (its permissions exist then).
39
+ {
40
+ label: "Support access",
41
+ href: "/support",
42
+ group: "Management",
43
+ icon: icons.support,
44
+ permission: [support.PermissionRequest, support.PermissionRead],
45
+ },
46
+ {
47
+ label: "Settings",
48
+ href: "/settings",
49
+ group: "System",
50
+ icon: icons.settings,
51
+ permission: settings.PermissionSettingRead,
52
+ },
53
+ {
54
+ label: "Audit log",
55
+ href: "/audit",
56
+ group: "System",
57
+ icon: icons.audit,
58
+ permission: audit.PermissionRead,
59
+ },
60
+ {
61
+ label: "Webhook events",
62
+ href: "/webhooks",
63
+ group: "System",
64
+ icon: icons.webhooks,
65
+ permission: webhooks.PermissionRead,
66
+ },
67
+ {
68
+ label: "System status",
69
+ href: "/status",
70
+ group: "System",
71
+ icon: icons.status,
72
+ permission: health.PermissionHealthRead,
73
+ },
74
+ // Any one of the ledger's admin permissions: the page shows its parts.
75
+ {
76
+ label: "Ledger",
77
+ href: "/ledger",
78
+ group: "Money",
79
+ icon: icons.ledger,
80
+ permission: [ledger.PermissionApprove, ledger.PermissionManage, ledger.PermissionAdjust],
81
+ },
82
+ ];