@appweaver/skill 3.0.0 → 3.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.
- package/package.json +1 -1
- package/skill/SKILL.md +1 -0
- package/skill/references/audit.md +2 -0
- package/skill/references/cli.md +32 -1
- package/skill/references/client.md +123 -25
- package/skill/references/configuration.md +83 -18
- package/skill/references/database.md +4 -0
- package/skill/references/dependency-injection.md +1 -1
- package/skill/references/errors.md +183 -163
- package/skill/references/logging.md +1 -0
- package/skill/references/modules.md +46 -37
- package/skill/references/patterns.md +1 -0
- package/skill/references/payments.md +795 -0
- package/skill/references/resources.md +13 -3
- package/skill/references/telemetry.md +19 -14
- package/skill/references/workflow.md +1 -0
|
@@ -104,6 +104,7 @@ their prefix:
|
|
|
104
104
|
| `RealtimeError` | `@appweaver/common` | `REALTIME_` | The realtime connections: tickets, subscriptions, actions, streams and limits |
|
|
105
105
|
| `AiError` | `@appweaver/common` | `AI_` | The AI models: unknown models, missing capabilities, provider failures, invalid objects |
|
|
106
106
|
| `McpError` | `@appweaver/common` | `MCP_` | The MCP server: denied origins, invalid tool inputs, results too large, rate limits |
|
|
107
|
+
| `PaymentError` | `@appweaver/common` | `PAYMENT_` | The payments: declined payments, failed gateway requests, invalid states and webhooks |
|
|
107
108
|
|
|
108
109
|
```ts
|
|
109
110
|
import { ErrorCode } from '@appweaver/common';
|
|
@@ -125,172 +126,191 @@ code and narrows the details, `isAppweaverError(error)` recognizes an error of a
|
|
|
125
126
|
The `ErrorCode` enum of `@appweaver/common` lists every code the framework raises, mapped to its HTTP status by
|
|
126
127
|
`errorHttpMap` of `@appweaver/web`:
|
|
127
128
|
|
|
128
|
-
| Code | Status | Title
|
|
129
|
-
|
|
130
|
-
| `INTERNAL_ERROR` | 500 | Internal server error
|
|
131
|
-
| `VALIDATION_FAILED` | 400 | Validation failed
|
|
132
|
-
| `MALFORMED_REQUEST` | 400 | Malformed request
|
|
133
|
-
| `UNSUPPORTED_MEDIA_TYPE` | 415 | Unsupported media type
|
|
134
|
-
| `PAYLOAD_TOO_LARGE` | 413 | Payload too large
|
|
135
|
-
| `ROUTE_NOT_FOUND` | 404 | Route not found
|
|
136
|
-
| `RATE_LIMITED` | 429 | Too many requests
|
|
137
|
-
| `REQUEST_FAILED` | 400 | Request failed
|
|
138
|
-
| `REQUEST_TIMEOUT` | 503 | Request timed out
|
|
139
|
-
| `CONFIGURATION_INVALID` | 500 | Invalid configuration
|
|
140
|
-
| `CONTEXT_DEFINITION_MISSING` | 500 | Missing context definition
|
|
141
|
-
| `CONTEXT_DEFINITION_DUPLICATE` | 500 | Duplicate context definition
|
|
142
|
-
| `CONTEXT_SERVER_UNAVAILABLE` | 500 | Server unavailable
|
|
143
|
-
| `MODULE_INVALID` | 500 | Invalid module
|
|
144
|
-
| `MODULE_MISSING` | 500 | Missing module
|
|
145
|
-
| `MODULE_DUPLICATE` | 500 | Duplicate module
|
|
146
|
-
| `MODULE_INCOMPATIBLE` | 500 | Incompatible module
|
|
147
|
-
| `MODULE_PROVIDER_MISSING` | 500 | Missing provider
|
|
148
|
-
| `MODULE_PROVIDER_AMBIGUOUS` | 500 | Ambiguous provider
|
|
149
|
-
| `DATABASE_UNIQUE_VIOLATION` | 409 | Unique constraint violation
|
|
150
|
-
| `DATABASE_FOREIGN_KEY_VIOLATION` | 409 | Relation constraint violation
|
|
151
|
-
| `DATABASE_NULL_VIOLATION` | 400 | Required field missing
|
|
152
|
-
| `DATABASE_VALUE_TOO_LONG` | 400 | Value too long
|
|
153
|
-
| `DATABASE_VALUE_OUT_OF_RANGE` | 400 | Value out of range
|
|
154
|
-
| `DATABASE_INVALID_VALUE` | 400 | Invalid value
|
|
155
|
-
| `DATABASE_RECORD_NOT_FOUND` | 404 | Record not found
|
|
156
|
-
| `DATABASE_WRITE_CONFLICT` | 409 | Write conflict
|
|
157
|
-
| `DATABASE_INVALID_TRANSACTION` | 500 | Invalid transaction
|
|
158
|
-
| `DATABASE_UNAVAILABLE` | 503 | Database unavailable
|
|
159
|
-
| `DATABASE_OPERATION_FAILED` | 500 | Database operation failed
|
|
160
|
-
| `RESOURCE_NOT_FOUND` | 404 | Resource not found
|
|
161
|
-
| `RESOURCE_FORBIDDEN` | 403 | Resource access forbidden
|
|
162
|
-
| `RESOURCE_INVALID_SORT` | 400 | Invalid sort
|
|
163
|
-
| `RESOURCE_FILTER_TOO_COMPLEX` | 400 | Filter too complex
|
|
164
|
-
| `RESOURCE_INVALID_AGGREGATE` | 400 | Invalid aggregation
|
|
165
|
-
| `RESOURCE_INVALID_CURSOR` | 400 | Invalid pagination cursor
|
|
166
|
-
| `RESOURCE_OFFSET_TOO_LARGE` | 400 | Page offset too large
|
|
167
|
-
| `RESOURCE_PRECONDITION_FAILED` | 412 | Resource changed since it was read
|
|
168
|
-
| `RESOURCE_INVALID_QUERY_PARAMETER` | 400 | Invalid query parameter
|
|
169
|
-
| `RESOURCE_INVALID_RELATION` | 400 | Invalid relation
|
|
170
|
-
| `RESOURCE_DELETE_RESTRICTED` | 409 | Delete restricted
|
|
171
|
-
| `AUTH_UNAUTHORIZED` | 401 | Unauthorized
|
|
172
|
-
| `AUTH_INVALID_CREDENTIALS` | 401 | Invalid credentials
|
|
173
|
-
| `AUTH_INVALID_HEADER` | 401 | Invalid authorization header
|
|
174
|
-
| `AUTH_INVALID_TOKEN` | 401 | Invalid token
|
|
175
|
-
| `AUTH_TOKEN_EXPIRED` | 401 | Token expired
|
|
176
|
-
| `AUTH_REFRESH_TOKEN_REUSED` | 401 | Refresh token used again
|
|
177
|
-
| `AUTH_FORBIDDEN` | 403 | Forbidden
|
|
178
|
-
| `AUTH_SCOPE_FORBIDDEN` | 403 | Token scope forbidden
|
|
179
|
-
| `AUTH_USER_NOT_FOUND` | 400 | User not found or disabled
|
|
180
|
-
| `AUTH_PASSWORD_DISABLED` | 403 | Password authentication disabled
|
|
181
|
-
| `AUTH_PASSWORD_INVALID` | 403 | Invalid password
|
|
182
|
-
| `AUTH_PASSWORD_WEAK` | 400 | Password too weak
|
|
183
|
-
| `AUTH_PASSWORD_REQUIRED` | 401 | Password confirmation required
|
|
184
|
-
| `AUTH_API_KEY_MISSING` | 401 | API key missing
|
|
185
|
-
| `AUTH_API_KEY_INVALID` | 401 | Invalid API key
|
|
186
|
-
| `AUTH_API_KEY_EXPIRED` | 403 | API key expired
|
|
187
|
-
| `AUTH_API_KEY_PERMISSION_DENIED` | 403 | API key permission denied
|
|
188
|
-
| `AUTH_PROXY_AUTHENTICATION_REQUIRED` | 407 | Proxy authentication required
|
|
189
|
-
| `AUTH_INVALID_REDIRECT_URL` | 400 | Invalid redirect URL
|
|
190
|
-
| `ACCOUNT_FEATURE_UNAVAILABLE` | 501 | Account feature unavailable
|
|
191
|
-
| `ACCOUNT_EMAIL_ALREADY_VERIFIED` | 409 | Email already verified
|
|
192
|
-
| `ACCOUNT_PASSWORD_NOT_SET` | 403 | Password not set
|
|
193
|
-
| `ACCOUNT_EMAIL_NOT_VERIFIED` | 403 | Email not verified
|
|
194
|
-
| `ACCOUNT_PHONE_NOT_VERIFIED` | 403 | Phone number not verified
|
|
195
|
-
| `ACCOUNT_PHONE_ALREADY_VERIFIED` | 409 | Phone number already verified
|
|
196
|
-
| `ACCOUNT_PHONE_NOT_SET` | 400 | Phone number not set
|
|
197
|
-
| `ACCOUNT_TWO_FACTOR_METHOD_UNAVAILABLE` | 400 | 2FA method unavailable
|
|
198
|
-
| `ACCOUNT_TWO_FACTOR_METHOD_NOT_ENABLED` | 400 | 2FA method not enabled
|
|
199
|
-
| `ACCOUNT_TWO_FACTOR_METHOD_ALREADY_ENABLED` | 409 | 2FA method already enabled
|
|
200
|
-
| `ACCOUNT_TWO_FACTOR_CODE_INVALID` | 400 | Invalid 2FA code
|
|
201
|
-
| `ACCOUNT_TWO_FACTOR_TOO_MANY_ATTEMPTS` | 429 | Too many 2FA attempts
|
|
202
|
-
| `OAUTH2_PROVIDER_ERROR` | 502 | OAuth2 provider error
|
|
203
|
-
| `OAUTH2_EMAIL_UNAVAILABLE` | 403 | OAuth2 email unavailable
|
|
204
|
-
| `OAUTH2_EMAIL_UNVERIFIED` | 403 | OAuth2 email unverified
|
|
205
|
-
| `OAUTH2_REGISTRATION_DISABLED` | 403 | OAuth2 registration disabled
|
|
206
|
-
| `OAUTH2_ACCOUNT_CONFLICT` | 409 | OAuth2 account linked to another user
|
|
207
|
-
| `OAUTH2_USER_REJECTED` | 403 | OAuth2 user rejected
|
|
208
|
-
| `RECAPTCHA_MISSING` | 400 | reCAPTCHA missing
|
|
209
|
-
| `RECAPTCHA_INVALID` | 400 | Invalid reCAPTCHA
|
|
210
|
-
| `RECAPTCHA_ACTION_MISMATCH` | 403 | reCAPTCHA action mismatch
|
|
211
|
-
| `RECAPTCHA_LOW_SCORE` | 403 | reCAPTCHA low score
|
|
212
|
-
| `RECAPTCHA_UNAVAILABLE` | 502 | reCAPTCHA unavailable
|
|
213
|
-
| `TURNSTILE_MISSING` | 400 | Turnstile missing
|
|
214
|
-
| `TURNSTILE_INVALID` | 400 | Invalid Turnstile
|
|
215
|
-
| `TURNSTILE_ACTION_MISMATCH` | 403 | Turnstile action mismatch
|
|
216
|
-
| `TURNSTILE_UNAVAILABLE` | 502 | Turnstile unavailable
|
|
217
|
-
| `FILE_NOT_FOUND` | 404 | File not found
|
|
218
|
-
| `FILE_FORBIDDEN` | 403 | File access forbidden
|
|
219
|
-
| `FILE_FIELD_NOT_FOUND` | 400 | File field not found
|
|
220
|
-
| `FILE_UNSUPPORTED_TYPE` | 415 | Unsupported file type
|
|
221
|
-
| `FILE_TOO_LARGE` | 413 | File too large
|
|
222
|
-
| `FILE_LIMIT_EXCEEDED` | 400 | File limit exceeded
|
|
223
|
-
| `FILE_INVALID_PATH` | 400 | Invalid file path
|
|
224
|
-
| `FILE_NONE_PROVIDED` | 400 | No files provided
|
|
225
|
-
| `FILE_UPLOAD_FAILED` | 400 | File upload failed
|
|
226
|
-
| `FILE_DELETE_FAILED` | 400 | File delete failed
|
|
227
|
-
| `FILE_STORAGE_ERROR` | 500 | File storage error
|
|
228
|
-
| `FILE_VERSION_NOT_FOUND` | 404 | File version not found
|
|
229
|
-
| `FILE_VERSIONING_DISABLED` | 400 | File versioning disabled
|
|
230
|
-
| `FILE_REPLACE_TARGET_INVALID` | 400 | Invalid file to replace
|
|
231
|
-
| `EXPORT_FAILED` | 500 | Export failed
|
|
232
|
-
| `QUEUE_CLOSED` | 503 | Queue closed
|
|
233
|
-
| `QUEUE_UNAVAILABLE` | 503 | Queue unavailable
|
|
234
|
-
| `QUEUE_JOB_TIMEOUT` | 504 | Queue job timed out
|
|
235
|
-
| `MAILER_SEND_FAILED` | 502 | Email sending failed
|
|
236
|
-
| `MAILER_SENDER_MISSING` | 500 | Email sender missing
|
|
237
|
-
| `SMS_SEND_FAILED` | 502 | SMS sending failed
|
|
238
|
-
| `TEMPLATE_NOT_FOUND` | 500 | Template not found
|
|
239
|
-
| `TEMPLATE_RENDER_FAILED` | 500 | Template rendering failed
|
|
240
|
-
| `TEMPLATE_LOAD_FAILED` | 500 | Template loading failed
|
|
241
|
-
| `TEMPLATE_PREVIEW_NOT_FOUND` | 404 | Template preview not found
|
|
242
|
-
| `LOCALE_LOAD_FAILED` | 500 | Locale loading failed
|
|
243
|
-
| `LOCK_NOT_ACQUIRED` | 503 | Resource is locked
|
|
244
|
-
| `MEMORY_UNAVAILABLE` | 503 | Memory unavailable
|
|
245
|
-
| `MEMORY_VALUE_INVALID` | 500 | Memory value invalid
|
|
246
|
-
| `TIMESERIES_NOT_ENABLED` | 404 | Time series not enabled
|
|
247
|
-
| `TIMESERIES_INVALID_FIELD` | 400 | Invalid time series field
|
|
248
|
-
| `TIMESERIES_INVALID_VALUE` | 400 | Invalid time series value
|
|
249
|
-
| `TIMESERIES_INVALID_TIME` | 400 | Invalid time series point time
|
|
250
|
-
| `TIMESERIES_INVALID_RANGE` | 400 | Invalid time series range
|
|
251
|
-
| `TIMESERIES_INVALID_BUCKET` | 400 | Invalid time series bucket
|
|
252
|
-
| `TIMESERIES_INVALID_AGGREGATE` | 400 | Invalid time series aggregate
|
|
253
|
-
| `TIMESERIES_TOO_MANY_POINTS` | 413 | Too many time series points
|
|
254
|
-
| `TIMESERIES_TOO_MANY_RESOURCES` | 400 | Too many time series resources
|
|
255
|
-
| `TIMESERIES_FORBIDDEN` | 403 | Time series access forbidden
|
|
256
|
-
| `TIMESERIES_UNSUPPORTED` | 501 | Time series operation not supported
|
|
257
|
-
| `SPATIAL_INVALID_GEOMETRY` | 400 | Invalid geometry
|
|
258
|
-
| `SPATIAL_INVALID_FILTER` | 400 | Invalid spatial filter
|
|
259
|
-
| `SPATIAL_TOO_MANY_CANDIDATES` | 400 | Too many spatial matches
|
|
260
|
-
| `REALTIME_TICKET_INVALID` | 401 | Invalid realtime ticket
|
|
261
|
-
| `REALTIME_CHANNEL_UNKNOWN` | 404 | Unknown realtime channel
|
|
262
|
-
| `REALTIME_SUBSCRIPTION_DENIED` | 403 | Realtime subscription denied
|
|
263
|
-
| `REALTIME_SUBSCRIPTION_LIMIT` | 429 | Too many realtime subscriptions
|
|
264
|
-
| `REALTIME_ACTION_UNKNOWN` | 404 | Unknown realtime action
|
|
265
|
-
| `REALTIME_ACTION_DENIED` | 403 | Realtime action denied
|
|
266
|
-
| `REALTIME_PAYLOAD_INVALID` | 400 | Invalid realtime payload
|
|
267
|
-
| `REALTIME_MESSAGE_INVALID` | 400 | Invalid realtime message
|
|
268
|
-
| `REALTIME_CONNECTION_LIMIT` | 429 | Too many realtime connections
|
|
269
|
-
| `REALTIME_RATE_LIMITED` | 429 | Realtime messages rate limited
|
|
270
|
-
| `REALTIME_TRANSPORT_DISABLED` | 404 | Realtime transport disabled
|
|
271
|
-
| `REALTIME_STREAM_NOT_FOUND` | 404 | Realtime stream not found
|
|
272
|
-
| `REALTIME_STREAM_ENDED` | 409 | Realtime stream ended
|
|
273
|
-
| `REALTIME_STREAM_LOST` | 503 | Realtime stream lost
|
|
274
|
-
| `REALTIME_STREAM_ACCEPT` | 406 | Realtime stream not accepted
|
|
275
|
-
| `REALTIME_INPUT_LIMIT` | 413 | Realtime input too large
|
|
276
|
-
| `REALTIME_SHUTTING_DOWN` | 503 | Realtime server shutting down
|
|
277
|
-
| `AI_MODEL_UNKNOWN` | 500 | AI model unknown
|
|
278
|
-
| `AI_REQUEST_INVALID` | 400 | Invalid AI request
|
|
279
|
-
| `AI_CAPABILITY_UNSUPPORTED` | 400 | AI capability not supported by the model
|
|
280
|
-
| `AI_REQUEST_FAILED` | 502 | AI request failed
|
|
281
|
-
| `AI_AUTH_FAILED` | 502 | AI provider authentication failed
|
|
282
|
-
| `AI_RATE_LIMITED` | 429 | AI provider rate limited
|
|
283
|
-
| `AI_TIMEOUT` | 504 | AI request timed out
|
|
284
|
-
| `AI_PROVIDER_UNAVAILABLE` | 503 | AI provider unavailable
|
|
285
|
-
| `AI_CONTEXT_LENGTH_EXCEEDED` | 422 | AI context length exceeded
|
|
286
|
-
| `AI_OUTPUT_INVALID` | 502 | Invalid AI model output
|
|
287
|
-
| `MCP_ORIGIN_DENIED` | 403 | MCP origin denied
|
|
288
|
-
| `MCP_INPUT_INVALID` | 400 | Invalid MCP tool input
|
|
289
|
-
| `MCP_RESULT_TOO_LARGE` | 413 | MCP tool result too large
|
|
290
|
-
| `MCP_RATE_LIMITED` | 429 | MCP rate limit exceeded
|
|
129
|
+
| Code | Status | Title |
|
|
130
|
+
|---------------------------------------------|--------|-------------------------------------------------|
|
|
131
|
+
| `INTERNAL_ERROR` | 500 | Internal server error |
|
|
132
|
+
| `VALIDATION_FAILED` | 400 | Validation failed |
|
|
133
|
+
| `MALFORMED_REQUEST` | 400 | Malformed request |
|
|
134
|
+
| `UNSUPPORTED_MEDIA_TYPE` | 415 | Unsupported media type |
|
|
135
|
+
| `PAYLOAD_TOO_LARGE` | 413 | Payload too large |
|
|
136
|
+
| `ROUTE_NOT_FOUND` | 404 | Route not found |
|
|
137
|
+
| `RATE_LIMITED` | 429 | Too many requests |
|
|
138
|
+
| `REQUEST_FAILED` | 400 | Request failed |
|
|
139
|
+
| `REQUEST_TIMEOUT` | 503 | Request timed out |
|
|
140
|
+
| `CONFIGURATION_INVALID` | 500 | Invalid configuration |
|
|
141
|
+
| `CONTEXT_DEFINITION_MISSING` | 500 | Missing context definition |
|
|
142
|
+
| `CONTEXT_DEFINITION_DUPLICATE` | 500 | Duplicate context definition |
|
|
143
|
+
| `CONTEXT_SERVER_UNAVAILABLE` | 500 | Server unavailable |
|
|
144
|
+
| `MODULE_INVALID` | 500 | Invalid module |
|
|
145
|
+
| `MODULE_MISSING` | 500 | Missing module |
|
|
146
|
+
| `MODULE_DUPLICATE` | 500 | Duplicate module |
|
|
147
|
+
| `MODULE_INCOMPATIBLE` | 500 | Incompatible module |
|
|
148
|
+
| `MODULE_PROVIDER_MISSING` | 500 | Missing provider |
|
|
149
|
+
| `MODULE_PROVIDER_AMBIGUOUS` | 500 | Ambiguous provider |
|
|
150
|
+
| `DATABASE_UNIQUE_VIOLATION` | 409 | Unique constraint violation |
|
|
151
|
+
| `DATABASE_FOREIGN_KEY_VIOLATION` | 409 | Relation constraint violation |
|
|
152
|
+
| `DATABASE_NULL_VIOLATION` | 400 | Required field missing |
|
|
153
|
+
| `DATABASE_VALUE_TOO_LONG` | 400 | Value too long |
|
|
154
|
+
| `DATABASE_VALUE_OUT_OF_RANGE` | 400 | Value out of range |
|
|
155
|
+
| `DATABASE_INVALID_VALUE` | 400 | Invalid value |
|
|
156
|
+
| `DATABASE_RECORD_NOT_FOUND` | 404 | Record not found |
|
|
157
|
+
| `DATABASE_WRITE_CONFLICT` | 409 | Write conflict |
|
|
158
|
+
| `DATABASE_INVALID_TRANSACTION` | 500 | Invalid transaction |
|
|
159
|
+
| `DATABASE_UNAVAILABLE` | 503 | Database unavailable |
|
|
160
|
+
| `DATABASE_OPERATION_FAILED` | 500 | Database operation failed |
|
|
161
|
+
| `RESOURCE_NOT_FOUND` | 404 | Resource not found |
|
|
162
|
+
| `RESOURCE_FORBIDDEN` | 403 | Resource access forbidden |
|
|
163
|
+
| `RESOURCE_INVALID_SORT` | 400 | Invalid sort |
|
|
164
|
+
| `RESOURCE_FILTER_TOO_COMPLEX` | 400 | Filter too complex |
|
|
165
|
+
| `RESOURCE_INVALID_AGGREGATE` | 400 | Invalid aggregation |
|
|
166
|
+
| `RESOURCE_INVALID_CURSOR` | 400 | Invalid pagination cursor |
|
|
167
|
+
| `RESOURCE_OFFSET_TOO_LARGE` | 400 | Page offset too large |
|
|
168
|
+
| `RESOURCE_PRECONDITION_FAILED` | 412 | Resource changed since it was read |
|
|
169
|
+
| `RESOURCE_INVALID_QUERY_PARAMETER` | 400 | Invalid query parameter |
|
|
170
|
+
| `RESOURCE_INVALID_RELATION` | 400 | Invalid relation |
|
|
171
|
+
| `RESOURCE_DELETE_RESTRICTED` | 409 | Delete restricted |
|
|
172
|
+
| `AUTH_UNAUTHORIZED` | 401 | Unauthorized |
|
|
173
|
+
| `AUTH_INVALID_CREDENTIALS` | 401 | Invalid credentials |
|
|
174
|
+
| `AUTH_INVALID_HEADER` | 401 | Invalid authorization header |
|
|
175
|
+
| `AUTH_INVALID_TOKEN` | 401 | Invalid token |
|
|
176
|
+
| `AUTH_TOKEN_EXPIRED` | 401 | Token expired |
|
|
177
|
+
| `AUTH_REFRESH_TOKEN_REUSED` | 401 | Refresh token used again |
|
|
178
|
+
| `AUTH_FORBIDDEN` | 403 | Forbidden |
|
|
179
|
+
| `AUTH_SCOPE_FORBIDDEN` | 403 | Token scope forbidden |
|
|
180
|
+
| `AUTH_USER_NOT_FOUND` | 400 | User not found or disabled |
|
|
181
|
+
| `AUTH_PASSWORD_DISABLED` | 403 | Password authentication disabled |
|
|
182
|
+
| `AUTH_PASSWORD_INVALID` | 403 | Invalid password |
|
|
183
|
+
| `AUTH_PASSWORD_WEAK` | 400 | Password too weak |
|
|
184
|
+
| `AUTH_PASSWORD_REQUIRED` | 401 | Password confirmation required |
|
|
185
|
+
| `AUTH_API_KEY_MISSING` | 401 | API key missing |
|
|
186
|
+
| `AUTH_API_KEY_INVALID` | 401 | Invalid API key |
|
|
187
|
+
| `AUTH_API_KEY_EXPIRED` | 403 | API key expired |
|
|
188
|
+
| `AUTH_API_KEY_PERMISSION_DENIED` | 403 | API key permission denied |
|
|
189
|
+
| `AUTH_PROXY_AUTHENTICATION_REQUIRED` | 407 | Proxy authentication required |
|
|
190
|
+
| `AUTH_INVALID_REDIRECT_URL` | 400 | Invalid redirect URL |
|
|
191
|
+
| `ACCOUNT_FEATURE_UNAVAILABLE` | 501 | Account feature unavailable |
|
|
192
|
+
| `ACCOUNT_EMAIL_ALREADY_VERIFIED` | 409 | Email already verified |
|
|
193
|
+
| `ACCOUNT_PASSWORD_NOT_SET` | 403 | Password not set |
|
|
194
|
+
| `ACCOUNT_EMAIL_NOT_VERIFIED` | 403 | Email not verified |
|
|
195
|
+
| `ACCOUNT_PHONE_NOT_VERIFIED` | 403 | Phone number not verified |
|
|
196
|
+
| `ACCOUNT_PHONE_ALREADY_VERIFIED` | 409 | Phone number already verified |
|
|
197
|
+
| `ACCOUNT_PHONE_NOT_SET` | 400 | Phone number not set |
|
|
198
|
+
| `ACCOUNT_TWO_FACTOR_METHOD_UNAVAILABLE` | 400 | 2FA method unavailable |
|
|
199
|
+
| `ACCOUNT_TWO_FACTOR_METHOD_NOT_ENABLED` | 400 | 2FA method not enabled |
|
|
200
|
+
| `ACCOUNT_TWO_FACTOR_METHOD_ALREADY_ENABLED` | 409 | 2FA method already enabled |
|
|
201
|
+
| `ACCOUNT_TWO_FACTOR_CODE_INVALID` | 400 | Invalid 2FA code |
|
|
202
|
+
| `ACCOUNT_TWO_FACTOR_TOO_MANY_ATTEMPTS` | 429 | Too many 2FA attempts |
|
|
203
|
+
| `OAUTH2_PROVIDER_ERROR` | 502 | OAuth2 provider error |
|
|
204
|
+
| `OAUTH2_EMAIL_UNAVAILABLE` | 403 | OAuth2 email unavailable |
|
|
205
|
+
| `OAUTH2_EMAIL_UNVERIFIED` | 403 | OAuth2 email unverified |
|
|
206
|
+
| `OAUTH2_REGISTRATION_DISABLED` | 403 | OAuth2 registration disabled |
|
|
207
|
+
| `OAUTH2_ACCOUNT_CONFLICT` | 409 | OAuth2 account linked to another user |
|
|
208
|
+
| `OAUTH2_USER_REJECTED` | 403 | OAuth2 user rejected |
|
|
209
|
+
| `RECAPTCHA_MISSING` | 400 | reCAPTCHA missing |
|
|
210
|
+
| `RECAPTCHA_INVALID` | 400 | Invalid reCAPTCHA |
|
|
211
|
+
| `RECAPTCHA_ACTION_MISMATCH` | 403 | reCAPTCHA action mismatch |
|
|
212
|
+
| `RECAPTCHA_LOW_SCORE` | 403 | reCAPTCHA low score |
|
|
213
|
+
| `RECAPTCHA_UNAVAILABLE` | 502 | reCAPTCHA unavailable |
|
|
214
|
+
| `TURNSTILE_MISSING` | 400 | Turnstile missing |
|
|
215
|
+
| `TURNSTILE_INVALID` | 400 | Invalid Turnstile |
|
|
216
|
+
| `TURNSTILE_ACTION_MISMATCH` | 403 | Turnstile action mismatch |
|
|
217
|
+
| `TURNSTILE_UNAVAILABLE` | 502 | Turnstile unavailable |
|
|
218
|
+
| `FILE_NOT_FOUND` | 404 | File not found |
|
|
219
|
+
| `FILE_FORBIDDEN` | 403 | File access forbidden |
|
|
220
|
+
| `FILE_FIELD_NOT_FOUND` | 400 | File field not found |
|
|
221
|
+
| `FILE_UNSUPPORTED_TYPE` | 415 | Unsupported file type |
|
|
222
|
+
| `FILE_TOO_LARGE` | 413 | File too large |
|
|
223
|
+
| `FILE_LIMIT_EXCEEDED` | 400 | File limit exceeded |
|
|
224
|
+
| `FILE_INVALID_PATH` | 400 | Invalid file path |
|
|
225
|
+
| `FILE_NONE_PROVIDED` | 400 | No files provided |
|
|
226
|
+
| `FILE_UPLOAD_FAILED` | 400 | File upload failed |
|
|
227
|
+
| `FILE_DELETE_FAILED` | 400 | File delete failed |
|
|
228
|
+
| `FILE_STORAGE_ERROR` | 500 | File storage error |
|
|
229
|
+
| `FILE_VERSION_NOT_FOUND` | 404 | File version not found |
|
|
230
|
+
| `FILE_VERSIONING_DISABLED` | 400 | File versioning disabled |
|
|
231
|
+
| `FILE_REPLACE_TARGET_INVALID` | 400 | Invalid file to replace |
|
|
232
|
+
| `EXPORT_FAILED` | 500 | Export failed |
|
|
233
|
+
| `QUEUE_CLOSED` | 503 | Queue closed |
|
|
234
|
+
| `QUEUE_UNAVAILABLE` | 503 | Queue unavailable |
|
|
235
|
+
| `QUEUE_JOB_TIMEOUT` | 504 | Queue job timed out |
|
|
236
|
+
| `MAILER_SEND_FAILED` | 502 | Email sending failed |
|
|
237
|
+
| `MAILER_SENDER_MISSING` | 500 | Email sender missing |
|
|
238
|
+
| `SMS_SEND_FAILED` | 502 | SMS sending failed |
|
|
239
|
+
| `TEMPLATE_NOT_FOUND` | 500 | Template not found |
|
|
240
|
+
| `TEMPLATE_RENDER_FAILED` | 500 | Template rendering failed |
|
|
241
|
+
| `TEMPLATE_LOAD_FAILED` | 500 | Template loading failed |
|
|
242
|
+
| `TEMPLATE_PREVIEW_NOT_FOUND` | 404 | Template preview not found |
|
|
243
|
+
| `LOCALE_LOAD_FAILED` | 500 | Locale loading failed |
|
|
244
|
+
| `LOCK_NOT_ACQUIRED` | 503 | Resource is locked |
|
|
245
|
+
| `MEMORY_UNAVAILABLE` | 503 | Memory unavailable |
|
|
246
|
+
| `MEMORY_VALUE_INVALID` | 500 | Memory value invalid |
|
|
247
|
+
| `TIMESERIES_NOT_ENABLED` | 404 | Time series not enabled |
|
|
248
|
+
| `TIMESERIES_INVALID_FIELD` | 400 | Invalid time series field |
|
|
249
|
+
| `TIMESERIES_INVALID_VALUE` | 400 | Invalid time series value |
|
|
250
|
+
| `TIMESERIES_INVALID_TIME` | 400 | Invalid time series point time |
|
|
251
|
+
| `TIMESERIES_INVALID_RANGE` | 400 | Invalid time series range |
|
|
252
|
+
| `TIMESERIES_INVALID_BUCKET` | 400 | Invalid time series bucket |
|
|
253
|
+
| `TIMESERIES_INVALID_AGGREGATE` | 400 | Invalid time series aggregate |
|
|
254
|
+
| `TIMESERIES_TOO_MANY_POINTS` | 413 | Too many time series points |
|
|
255
|
+
| `TIMESERIES_TOO_MANY_RESOURCES` | 400 | Too many time series resources |
|
|
256
|
+
| `TIMESERIES_FORBIDDEN` | 403 | Time series access forbidden |
|
|
257
|
+
| `TIMESERIES_UNSUPPORTED` | 501 | Time series operation not supported |
|
|
258
|
+
| `SPATIAL_INVALID_GEOMETRY` | 400 | Invalid geometry |
|
|
259
|
+
| `SPATIAL_INVALID_FILTER` | 400 | Invalid spatial filter |
|
|
260
|
+
| `SPATIAL_TOO_MANY_CANDIDATES` | 400 | Too many spatial matches |
|
|
261
|
+
| `REALTIME_TICKET_INVALID` | 401 | Invalid realtime ticket |
|
|
262
|
+
| `REALTIME_CHANNEL_UNKNOWN` | 404 | Unknown realtime channel |
|
|
263
|
+
| `REALTIME_SUBSCRIPTION_DENIED` | 403 | Realtime subscription denied |
|
|
264
|
+
| `REALTIME_SUBSCRIPTION_LIMIT` | 429 | Too many realtime subscriptions |
|
|
265
|
+
| `REALTIME_ACTION_UNKNOWN` | 404 | Unknown realtime action |
|
|
266
|
+
| `REALTIME_ACTION_DENIED` | 403 | Realtime action denied |
|
|
267
|
+
| `REALTIME_PAYLOAD_INVALID` | 400 | Invalid realtime payload |
|
|
268
|
+
| `REALTIME_MESSAGE_INVALID` | 400 | Invalid realtime message |
|
|
269
|
+
| `REALTIME_CONNECTION_LIMIT` | 429 | Too many realtime connections |
|
|
270
|
+
| `REALTIME_RATE_LIMITED` | 429 | Realtime messages rate limited |
|
|
271
|
+
| `REALTIME_TRANSPORT_DISABLED` | 404 | Realtime transport disabled |
|
|
272
|
+
| `REALTIME_STREAM_NOT_FOUND` | 404 | Realtime stream not found |
|
|
273
|
+
| `REALTIME_STREAM_ENDED` | 409 | Realtime stream ended |
|
|
274
|
+
| `REALTIME_STREAM_LOST` | 503 | Realtime stream lost |
|
|
275
|
+
| `REALTIME_STREAM_ACCEPT` | 406 | Realtime stream not accepted |
|
|
276
|
+
| `REALTIME_INPUT_LIMIT` | 413 | Realtime input too large |
|
|
277
|
+
| `REALTIME_SHUTTING_DOWN` | 503 | Realtime server shutting down |
|
|
278
|
+
| `AI_MODEL_UNKNOWN` | 500 | AI model unknown |
|
|
279
|
+
| `AI_REQUEST_INVALID` | 400 | Invalid AI request |
|
|
280
|
+
| `AI_CAPABILITY_UNSUPPORTED` | 400 | AI capability not supported by the model |
|
|
281
|
+
| `AI_REQUEST_FAILED` | 502 | AI request failed |
|
|
282
|
+
| `AI_AUTH_FAILED` | 502 | AI provider authentication failed |
|
|
283
|
+
| `AI_RATE_LIMITED` | 429 | AI provider rate limited |
|
|
284
|
+
| `AI_TIMEOUT` | 504 | AI request timed out |
|
|
285
|
+
| `AI_PROVIDER_UNAVAILABLE` | 503 | AI provider unavailable |
|
|
286
|
+
| `AI_CONTEXT_LENGTH_EXCEEDED` | 422 | AI context length exceeded |
|
|
287
|
+
| `AI_OUTPUT_INVALID` | 502 | Invalid AI model output |
|
|
288
|
+
| `MCP_ORIGIN_DENIED` | 403 | MCP origin denied |
|
|
289
|
+
| `MCP_INPUT_INVALID` | 400 | Invalid MCP tool input |
|
|
290
|
+
| `MCP_RESULT_TOO_LARGE` | 413 | MCP tool result too large |
|
|
291
|
+
| `MCP_RATE_LIMITED` | 429 | MCP rate limit exceeded |
|
|
292
|
+
| `PAYMENT_GATEWAY_UNKNOWN` | 500 | Payment gateway unknown |
|
|
293
|
+
| `PAYMENT_GATEWAY_FAILED` | 502 | Payment gateway request failed |
|
|
294
|
+
| `PAYMENT_GATEWAY_UNAVAILABLE` | 503 | Payment gateway unavailable |
|
|
295
|
+
| `PAYMENT_REQUEST_INVALID` | 400 | Invalid payment request |
|
|
296
|
+
| `PAYMENT_CAPABILITY_UNSUPPORTED` | 501 | Payment capability not supported by the gateway |
|
|
297
|
+
| `PAYMENT_DECLINED` | 402 | Payment declined |
|
|
298
|
+
| `PAYMENT_NOT_FOUND` | 404 | Payment not found |
|
|
299
|
+
| `PAYMENT_INVALID_STATE` | 409 | Invalid payment state |
|
|
300
|
+
| `PAYMENT_AMOUNT_INVALID` | 400 | Invalid payment amount |
|
|
301
|
+
| `PAYMENT_CURRENCY_UNSUPPORTED` | 400 | Payment currency not supported |
|
|
302
|
+
| `PAYMENT_REFUND_EXCEEDED` | 409 | Refund exceeds the refundable amount |
|
|
303
|
+
| `PAYMENT_METHOD_NOT_FOUND` | 404 | Payment method not found |
|
|
304
|
+
| `PAYMENT_PLAN_UNKNOWN` | 404 | Payment plan unknown |
|
|
305
|
+
| `PAYMENT_SUBSCRIPTION_NOT_FOUND` | 404 | Subscription not found |
|
|
306
|
+
| `PAYMENT_SUBSCRIPTIONS_DISABLED` | 501 | Subscriptions disabled |
|
|
307
|
+
| `PAYMENT_WEBHOOK_INVALID` | 400 | Invalid payment webhook |
|
|
291
308
|
|
|
292
309
|
`REQUEST_FAILED` keeps the 4xx status of an error a Fastify plugin raised with no code of its own.
|
|
293
310
|
|
|
311
|
+
The `PAYMENT_*` codes and their `details` (the `gateway`, the `declineCode` of a refused card, the `refundable`
|
|
312
|
+
amount) are described with the [payments](./payments.md#errors).
|
|
313
|
+
|
|
294
314
|
## Throwing errors in the application
|
|
295
315
|
|
|
296
316
|
Throw the framework error that fits from a service hook, a policy or a custom route, so the response and the OpenAPI
|
|
@@ -98,6 +98,7 @@ LOG_LEVELS=database:trace,cache:error
|
|
|
98
98
|
| `scheduler` | Jobs added with their next run, started, stopped and removed, each run with its duration |
|
|
99
99
|
| `mailer` | E-mails queued and sent, the SMTP message id, and the e-mails of the `json` mailer |
|
|
100
100
|
| `sms` | Text messages sent, the message id of Twilio, and the messages of the `json` SMS sender |
|
|
101
|
+
| `payments` | Gateways connected, plans read, payment emails queued, payments and webhook events that failed or were not reconciled |
|
|
101
102
|
| `template` | The loaded templates and the template preview route |
|
|
102
103
|
| `locale` | The loaded translations and the missing keys |
|
|
103
104
|
| `storage` | `FileService`, the `local` storage driver and the processed images |
|
|
@@ -7,29 +7,31 @@ first-party module does.
|
|
|
7
7
|
|
|
8
8
|
## First-party modules
|
|
9
9
|
|
|
10
|
-
| Module | Enabled
|
|
11
|
-
| -------------------------- |
|
|
12
|
-
| `@appweaver/core` | Always
|
|
13
|
-
| `@appweaver/data` | Installed
|
|
14
|
-
| `@appweaver/web` | Installed (requires `data`)
|
|
15
|
-
| `@appweaver/redis` | Installed
|
|
16
|
-
| `@appweaver/bullmq` | Installed (requires `redis`)
|
|
17
|
-
| `@appweaver/cron` | Installed
|
|
18
|
-
| `@appweaver/nodemailer` | Installed
|
|
19
|
-
| `@appweaver/twilio` | Installed
|
|
20
|
-
| `@appweaver/realtime` | Installed (requires `web`)
|
|
21
|
-
| `@appweaver/ai` | Installed
|
|
22
|
-
| `@appweaver/openai` | Installed (requires `ai`)
|
|
23
|
-
| `@appweaver/mcp` | Installed (requires `web`)
|
|
24
|
-
| `@appweaver/opentelemetry` | Installed
|
|
25
|
-
| `@appweaver/
|
|
26
|
-
| `@appweaver/
|
|
10
|
+
| Module | Enabled | Brings |
|
|
11
|
+
| -------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
12
|
+
| `@appweaver/core` | Always | The contracts and the in-process drivers: `memory`, `node` events, `memory` pub/sub, `local` storage, `memory` queue, `json` mailer, `json` SMS sender, `memory` time series |
|
|
13
|
+
| `@appweaver/data` | Installed | The `prisma` database, the resources, `FileService`, the `database` security store, the `database` and `timescale` time series |
|
|
14
|
+
| `@appweaver/web` | Installed (requires `data`) | The Fastify server (`HttpServer`), authentication, account, 2FA (`TwoFactorService`) and OAuth2 services |
|
|
15
|
+
| `@appweaver/redis` | Installed | The `redis` memory, also the store of the cache and the rate limit, and the `redis` pub/sub |
|
|
16
|
+
| `@appweaver/bullmq` | Installed (requires `redis`) | The `bullmq` queue |
|
|
17
|
+
| `@appweaver/cron` | Installed | The `cron` scheduler |
|
|
18
|
+
| `@appweaver/nodemailer` | Installed | The `smtp` mailer |
|
|
19
|
+
| `@appweaver/twilio` | Installed | The `twilio` SMS sender (`SmsSender`), with the REST API of Twilio and no SDK |
|
|
20
|
+
| `@appweaver/realtime` | Installed (requires `web`) | The realtime connections (`RealtimeGateway`) over WebSocket and SSE: channels, resource events and actions, see [realtime](./realtime.md) |
|
|
21
|
+
| `@appweaver/ai` | Installed | `AiService` calling the AI models of the endpoints of the `ai` config, the tools, the built-in `mock` driver, see [ai](./ai.md) |
|
|
22
|
+
| `@appweaver/openai` | Installed (requires `ai`) | The `openai` AI driver (`AiDriver`), for OpenAI and every OpenAI-compatible server (Ollama, OpenRouter, vLLM, ...), with the `openai` SDK |
|
|
23
|
+
| `@appweaver/mcp` | Installed (requires `web`) | The MCP server of the AI agents: the resource actions of the `mcp` route config and `createMcpTool`, see [mcp](./mcp.md) |
|
|
24
|
+
| `@appweaver/opentelemetry` | Installed | The OpenTelemetry SDK (`TelemetryService`) exporting the traces, metrics and logs over OTLP, see [telemetry](./telemetry.md) |
|
|
25
|
+
| `@appweaver/payments` | Installed (requires `data`) | `PaymentsService` and `SubscriptionsService`: one-time and recurring payments on the gateways of the `payments` config, several at once, their webhooks, events and emails, the built-in `fake` gateway, see [payments](./payments.md) |
|
|
26
|
+
| `@appweaver/stripe` | Installed (requires `payments`) | The `stripe` payment gateway driver (`PaymentGateway`), with the official `stripe` SDK |
|
|
27
|
+
| `@appweaver/handlebars` | Installed | The `handlebars` template engine |
|
|
28
|
+
| `@appweaver/sharp` | Installed | The `sharp` image processor |
|
|
27
29
|
|
|
28
30
|
Every first-party module but core is a package of its own, enabled like any [package module](#package-modules): by
|
|
29
31
|
being a dependency of the application's `package.json`. A driver package carries the library it wraps as a dependency,
|
|
30
32
|
so `npm install @appweaver/redis` moves the memory, the cache and the rate limit to Redis without any config, and
|
|
31
33
|
installing `ioredis` alone enables nothing. The scaffold modules of `weaver module add` (`data`, `web`, `redis`,
|
|
32
|
-
`queue`, `mailer`, `sms`,
|
|
34
|
+
`queue`, `mailer`, `sms`, `payments`,
|
|
33
35
|
...) install these packages along with their config and files.
|
|
34
36
|
|
|
35
37
|
## Discovery
|
|
@@ -107,7 +109,7 @@ export default defineModule({ name: 'appweaver-newsletter' /* ... */ });
|
|
|
107
109
|
| `requires` | `string[]` | The modules that must be enabled with it (`@appweaver/bullmq` requires `@appweaver/redis`) |
|
|
108
110
|
| `config` | `object[]` | Its config sections, defined with `defineConfig`, validated at start and listed in `appweaver.schema.json` (a driver's validated only when selected) |
|
|
109
111
|
| `loggers` | `string[]` | The names of the loggers it creates with `createLogger`, suggested as the keys of `log.levels` in `appweaver.schema.json` |
|
|
110
|
-
| `contracts` | `{ contract, provider: () => string }[]` | The contracts it declares, with the function reading the provider key, i.e. `() =>
|
|
112
|
+
| `contracts` | `{ contract, provider: () => string }[]` | The contracts it declares, with the function reading the provider key, i.e. `() => searchConfig.PROVIDER` |
|
|
111
113
|
| `providers` | `{ contract, name, load, auto? }[]` | Its contract implementations. `load` imports the class lazily (`() => import('./gcs-storage')`), `auto` is `true`, `'fallback'` or `false` |
|
|
112
114
|
| `services` | `{ load, requires? }[]` | Classes defined at startup by their class name, with their lifecycle hooks and health checks; `requires` lists the contracts that must be provided |
|
|
113
115
|
| `setup` | `(context) => unknown` | Run after the providers and services of every module, before the `main` parts and the application files (see below) |
|
|
@@ -320,13 +322,18 @@ The same values as environment variables: `STORAGE_PROVIDER=gcs`, `STORAGE_GCS_B
|
|
|
320
322
|
The jobs keeping the data in shape run on their schedule in every instance, never two runs of a job at once, registered
|
|
321
323
|
with `defineMaintenanceJob` of `@appweaver/core` by the framework or by a module or the application:
|
|
322
324
|
|
|
323
|
-
| Job
|
|
324
|
-
|
|
325
|
-
| `auditRetention`
|
|
326
|
-
| `timeseriesRetention`
|
|
327
|
-
| `fileVersionsPrune`
|
|
328
|
-
| `oneTimeTokens`
|
|
329
|
-
| `softDeletePurge`
|
|
325
|
+
| Job | Module | Deletes | Schedule |
|
|
326
|
+
| ------------------------ | -------- | ------------------------------------------------------------------------------------------------ | -------- |
|
|
327
|
+
| `auditRetention` | data | The audit log entries older than the retention of their category (`audit.retention`) | `1h` |
|
|
328
|
+
| `timeseriesRetention` | data | The time series points older than the retention of their model (the `database` provider) | `1h` |
|
|
329
|
+
| `fileVersionsPrune` | data | The file versions older than the `maxAge` of their field | `1h` |
|
|
330
|
+
| `oneTimeTokens` | data | The expired one-time tokens of the `database` security store | `1h` |
|
|
331
|
+
| `softDeletePurge` | data | The records soft deleted longer ago than the `softDelete.purgeAfter` of their model | `1d` |
|
|
332
|
+
| `paymentEventsRetention` | payments | The processed webhook events and the delivered events of the payments older than their retention | `1h` |
|
|
333
|
+
|
|
334
|
+
`@appweaver/payments` also registers two jobs deleting nothing: `paymentsReconcile` (`5m`) reads the payments and
|
|
335
|
+
subscriptions in a state that is not final from their gateways again, and `paymentsRedeliver` (`1m`) queues the
|
|
336
|
+
webhook events and the events of the payments no job finished (see [payments](./payments.md#maintenance-jobs)).
|
|
330
337
|
|
|
331
338
|
A job runs only when it applies (the audit log enabled with a retention, a model with a `purgeAfter`, ...), on a
|
|
332
339
|
timer for an interval, or as a job of the `Scheduler` (`@appweaver/cron`) for a cron expression, and takes a lock of
|
|
@@ -460,21 +467,23 @@ testStorageContract('GcsStorage', () => new GcsStorage());
|
|
|
460
467
|
A driver of an external service runs the suite on an in-memory stand-in of its client, the way `@appweaver/redis` runs
|
|
461
468
|
`testMemoryContract` on `ioredis-mock` (`jest.mock('ioredis', ...)`), or on a real service in an integration test.
|
|
462
469
|
|
|
463
|
-
| Suite
|
|
464
|
-
|
|
|
465
|
-
| `testMemoryContract`
|
|
466
|
-
| `testStorageContract`
|
|
467
|
-
| `testQueueContract`
|
|
468
|
-
| `testSchedulerContract`
|
|
469
|
-
| `testMailerContract`
|
|
470
|
-
| `testAiDriverContract`
|
|
471
|
-
| `testSmsContract`
|
|
472
|
-
| `
|
|
470
|
+
| Suite | Contract | Tests |
|
|
471
|
+
| ---------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
472
|
+
| `testMemoryContract` | `Memory` | Values and their expiry, a value JSON cannot hold refused, `exists` and `delete`, key patterns, locks, the health check |
|
|
473
|
+
| `testStorageContract` | `Storage` | Storing and streaming a file and a byte range, `exists`, `delete`, `url`, the health check |
|
|
474
|
+
| `testQueueContract` | `Queue` | A job processed by a worker and its result, outside of the context of its sender, a failed job, a given job id and an ignored send of one still queued, closing a queue, the health check |
|
|
475
|
+
| `testSchedulerContract` | `Scheduler` | Adding, starting, stopping and removing a job, an unknown job id (yearly jobs, none ticks) |
|
|
476
|
+
| `testMailerContract` | `Mailer` | Sending an email with every field of the contract, the health check |
|
|
477
|
+
| `testAiDriverContract` | `AiDriver` | A text answer, a tool call and a conversation with its result, the JSON mode, a stream and a streamed tool call, the embeddings (unless `embeddings: false`), the capabilities and the health check |
|
|
478
|
+
| `testSmsContract` | `SmsSender` | Sending a text message with and without a sender, the name of its health check, the health check |
|
|
479
|
+
| `testPaymentGatewayContract` | `PaymentGateway` | The capabilities (an undeclared one throws `PAYMENT_CAPABILITY_UNSUPPORTED`), a customer, a payment the client confirms and its idempotency key, cancelling, an unknown payment, a hosted checkout, a setup, the prices and the portal, a rejected webhook signature, the health check; with the `savedMethod`, `priceId` and `signedWebhook` options also a charge, a refund, a capture, the saved methods, a subscription and a verified webhook |
|
|
480
|
+
| `testTimeSeriesContract` | `TimeSeries` | Writing and merging points, selecting fields and ranges, ordering and limiting, every aggregate by bucket and over the range, deleting a range (a store with `supportsDelete`), the health check |
|
|
473
481
|
|
|
474
482
|
The suites use the `describe`, `test`, `beforeEach`, `afterEach` and `expect` globals, so they run under Jest, Vitest
|
|
475
483
|
(with `globals: true`) and Bun. A driver of a remote service runs them against a test instance or emulator, the
|
|
476
484
|
mailer suite against a test inbox or a mocked transport, since it sends a real email, and the SMS suite against a test
|
|
477
|
-
number or a mocked API (`jest.spyOn(global, 'fetch')` for Twilio)
|
|
485
|
+
number or a mocked API (`jest.spyOn(global, 'fetch')` for Twilio), and the payment gateway suite against a mocked
|
|
486
|
+
API or a test account of the provider, since it creates payments. Set the config the driver reads
|
|
478
487
|
with `configOverrides` of `@appweaver/common` in the factory or a `beforeAll`.
|
|
479
488
|
|
|
480
489
|
A driver delivering work later in its own process (a timer, an immediate, the events of a connection) creates it in
|
|
@@ -55,6 +55,7 @@ with `data` and `web`:
|
|
|
55
55
|
| `realtime` | `@appweaver/realtime` (requires `web`): channels, resource events, actions and streams over WebSocket and SSE | no realtime connections |
|
|
56
56
|
| `mcp` | `@appweaver/mcp` (requires `web`): the MCP server of the AI agents at `/mcp` | no MCP server |
|
|
57
57
|
| `ai` | `@appweaver/ai` and `@appweaver/openai`: `AiService` on a local Ollama in `dev`, the `mock` model in `test` | no AI models |
|
|
58
|
+
| `payments` | `@appweaver/payments`, `@appweaver/stripe` (requires `data`), the Stripe keys of `.env`, `fake` gateway in test | no online payments |
|
|
58
59
|
| `docker` | `Dockerfile`, `.dockerignore`, `docker-compose.yml`, `start.sh` | no Docker files |
|
|
59
60
|
|
|
60
61
|
Options are given after the positional arguments, since `--add` and `--exclude` take every following value up to the
|