Initial Commit
This commit is contained in:
110
packages/api-stack/api/api-plugin-example/plugin.json
Normal file
110
packages/api-stack/api/api-plugin-example/plugin.json
Normal file
@@ -0,0 +1,110 @@
|
||||
{
|
||||
"name": "@suaveplan/api-plugin-example",
|
||||
"version": "0.1.0",
|
||||
"apiHost": "^0.1.0",
|
||||
"isolation": "trusted",
|
||||
"trustLevel": "first-party",
|
||||
"requiredCapabilities": [],
|
||||
"optionalCapabilities": [
|
||||
"db",
|
||||
"events",
|
||||
"secrets",
|
||||
"auth.session",
|
||||
"tenant"
|
||||
],
|
||||
"permissions": {
|
||||
"fs": [],
|
||||
"fetch": ["https://api.stripe.com"],
|
||||
"env": [
|
||||
"EXAMPLE_STRIPE_KEY",
|
||||
"EXAMPLE_HMAC_SIGNING_KEY",
|
||||
"EXAMPLE_WEBHOOK_TOKEN"
|
||||
]
|
||||
},
|
||||
"dependsOn": [],
|
||||
"routes": [
|
||||
{ "method": "GET", "path": "/example/public/ping", "auth": "none" },
|
||||
{ "method": "GET", "path": "/example/health", "auth": "none" },
|
||||
{ "method": "GET", "path": "/example/invoices", "scopes": ["example:read"] },
|
||||
{ "method": "GET", "path": "/example/invoices/:id", "scopes": ["example:read"] },
|
||||
{ "method": "POST", "path": "/example/invoices", "scopes": ["example:write"], "idempotent": true },
|
||||
{ "method": "POST", "path": "/example/invoices/:id/finalise", "scopes": ["example:write"] },
|
||||
{ "method": "GET", "path": "/example/stream/large-report", "streaming": true },
|
||||
{ "method": "GET", "path": "/example/rate-limited", "rateLimit": { "rps": 10, "burst": 20 } },
|
||||
{ "method": "GET", "path": "/example/subscription-required" },
|
||||
{ "method": "GET", "path": "/_/test/fail-response", "responseValidation": "enforce" }
|
||||
],
|
||||
"graphql": {
|
||||
"types": ["ExampleInvoice"],
|
||||
"queries": ["exampleInvoice"],
|
||||
"mutations": ["createExampleInvoice"],
|
||||
"subscriptions": ["exampleInvoiceCreated"]
|
||||
},
|
||||
"websockets": [
|
||||
{ "path": "/example/ws", "topics": ["example.invoice.created"] }
|
||||
],
|
||||
"sse": [
|
||||
{ "path": "/example/sse", "topics": ["example.invoice.created"], "resume": "last-event-id" }
|
||||
],
|
||||
"sagas": [
|
||||
{
|
||||
"name": "example-invoice-billing",
|
||||
"steps": ["reserve", "charge", "settle"],
|
||||
"owns": true
|
||||
}
|
||||
],
|
||||
"twoPhaseCommit": {
|
||||
"participant": true,
|
||||
"voteTimeoutMs": 5000
|
||||
},
|
||||
"database": {
|
||||
"schemaVersion": 2,
|
||||
"migrationsDir": "migrations/postgres",
|
||||
"dialect": "postgres"
|
||||
},
|
||||
"jobs": {
|
||||
"cron": [
|
||||
{ "name": "reconcile-invoices", "schedule": "0 * * * *" },
|
||||
{ "name": "send-monthly-statements", "schedule": "0 0 1 * *", "perTenant": true }
|
||||
],
|
||||
"queued": [
|
||||
{ "name": "send-receipt", "maxAttempts": 5, "backoff": "exponential" }
|
||||
]
|
||||
},
|
||||
"events": {
|
||||
"publishes": ["example.invoice.created"],
|
||||
"subscribes": ["users.user.deleted"]
|
||||
},
|
||||
"secrets": [
|
||||
{ "name": "EXAMPLE_STRIPE_KEY", "required": true },
|
||||
{ "name": "EXAMPLE_HMAC_SIGNING_KEY", "required": true },
|
||||
{ "name": "EXAMPLE_WEBHOOK_TOKEN", "required": false }
|
||||
],
|
||||
"config": {
|
||||
"schemaRef": "./src/schemas/schemas.ts"
|
||||
},
|
||||
"scopes": ["example:read", "example:write"],
|
||||
"telemetry": {
|
||||
"metrics": [
|
||||
{ "name": "example.invoices_finalised_total", "kind": "counter" },
|
||||
{ "name": "example.stripe.call_duration_ms", "kind": "histogram", "unit": "ms" },
|
||||
{ "name": "example.outstanding_invoice_count", "kind": "counter" }
|
||||
]
|
||||
},
|
||||
"openapi": {
|
||||
"version": "3.1.0",
|
||||
"title": "@suaveplan/api-plugin-example",
|
||||
"ui": "scalar"
|
||||
},
|
||||
"errors": {
|
||||
"statusMap": {
|
||||
"PLUGIN.EXAMPLE.SUBSCRIPTION_INACTIVE": 409,
|
||||
"PLUGIN.EXAMPLE.INVOICE_NOT_FOUND": 404,
|
||||
"PLUGIN.EXAMPLE.INVALID_INVOICE_STATE": 422,
|
||||
"PLUGIN.EXAMPLE.RESPONSE_VALIDATION_TRIGGER": 200
|
||||
}
|
||||
},
|
||||
"uninstall": {
|
||||
"dataPolicy": "drop"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user