@littlebearapps/platform-admin-sdk 1.0.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/README.md +112 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +89 -0
- package/dist/prompts.d.ts +27 -0
- package/dist/prompts.js +80 -0
- package/dist/scaffold.d.ts +5 -0
- package/dist/scaffold.js +65 -0
- package/dist/templates.d.ts +16 -0
- package/dist/templates.js +131 -0
- package/package.json +46 -0
- package/templates/full/migrations/006_pattern_discovery.sql +199 -0
- package/templates/full/migrations/007_notifications_search.sql +127 -0
- package/templates/full/workers/lib/pattern-discovery/ai-prompt.ts +644 -0
- package/templates/full/workers/lib/pattern-discovery/clustering.ts +278 -0
- package/templates/full/workers/lib/pattern-discovery/shadow-evaluation.ts +603 -0
- package/templates/full/workers/lib/pattern-discovery/storage.ts +806 -0
- package/templates/full/workers/lib/pattern-discovery/types.ts +159 -0
- package/templates/full/workers/lib/pattern-discovery/validation.ts +278 -0
- package/templates/full/workers/pattern-discovery.ts +661 -0
- package/templates/full/workers/platform-alert-router.ts +1809 -0
- package/templates/full/workers/platform-notifications.ts +424 -0
- package/templates/full/workers/platform-search.ts +480 -0
- package/templates/full/workers/platform-settings.ts +436 -0
- package/templates/full/wrangler.alert-router.jsonc.hbs +34 -0
- package/templates/full/wrangler.notifications.jsonc.hbs +23 -0
- package/templates/full/wrangler.pattern-discovery.jsonc.hbs +33 -0
- package/templates/full/wrangler.search.jsonc.hbs +16 -0
- package/templates/full/wrangler.settings.jsonc.hbs +23 -0
- package/templates/shared/README.md.hbs +69 -0
- package/templates/shared/config/budgets.yaml.hbs +72 -0
- package/templates/shared/config/services.yaml.hbs +45 -0
- package/templates/shared/migrations/001_core_tables.sql +117 -0
- package/templates/shared/migrations/002_usage_warehouse.sql +830 -0
- package/templates/shared/migrations/003_feature_tracking.sql +250 -0
- package/templates/shared/migrations/004_settings_alerts.sql +452 -0
- package/templates/shared/migrations/seed.sql.hbs +4 -0
- package/templates/shared/package.json.hbs +21 -0
- package/templates/shared/scripts/sync-config.ts +242 -0
- package/templates/shared/tsconfig.json +12 -0
- package/templates/shared/workers/lib/analytics-engine.ts +357 -0
- package/templates/shared/workers/lib/billing.ts +293 -0
- package/templates/shared/workers/lib/circuit-breaker-middleware.ts +25 -0
- package/templates/shared/workers/lib/control.ts +292 -0
- package/templates/shared/workers/lib/economics.ts +368 -0
- package/templates/shared/workers/lib/metrics.ts +103 -0
- package/templates/shared/workers/lib/platform-settings.ts +407 -0
- package/templates/shared/workers/lib/shared/allowances.ts +333 -0
- package/templates/shared/workers/lib/shared/cloudflare.ts +1362 -0
- package/templates/shared/workers/lib/shared/types.ts +58 -0
- package/templates/shared/workers/lib/telemetry-sampling.ts +360 -0
- package/templates/shared/workers/lib/usage/collectors/example.ts +96 -0
- package/templates/shared/workers/lib/usage/collectors/index.ts +128 -0
- package/templates/shared/workers/lib/usage/handlers/audit.ts +306 -0
- package/templates/shared/workers/lib/usage/handlers/backfill.ts +845 -0
- package/templates/shared/workers/lib/usage/handlers/behavioral.ts +429 -0
- package/templates/shared/workers/lib/usage/handlers/data-queries.ts +507 -0
- package/templates/shared/workers/lib/usage/handlers/dlq-admin.ts +364 -0
- package/templates/shared/workers/lib/usage/handlers/health-trends.ts +222 -0
- package/templates/shared/workers/lib/usage/handlers/index.ts +35 -0
- package/templates/shared/workers/lib/usage/handlers/usage-admin.ts +421 -0
- package/templates/shared/workers/lib/usage/handlers/usage-features.ts +1262 -0
- package/templates/shared/workers/lib/usage/handlers/usage-metrics.ts +2420 -0
- package/templates/shared/workers/lib/usage/handlers/usage-settings.ts +610 -0
- package/templates/shared/workers/lib/usage/queue/budget-enforcement.ts +1032 -0
- package/templates/shared/workers/lib/usage/queue/cost-budget-enforcement.ts +128 -0
- package/templates/shared/workers/lib/usage/queue/cost-calculator.ts +77 -0
- package/templates/shared/workers/lib/usage/queue/dlq-handler.ts +161 -0
- package/templates/shared/workers/lib/usage/queue/index.ts +19 -0
- package/templates/shared/workers/lib/usage/queue/telemetry-processor.ts +790 -0
- package/templates/shared/workers/lib/usage/scheduled/anomaly-detection.ts +732 -0
- package/templates/shared/workers/lib/usage/scheduled/data-collection.ts +956 -0
- package/templates/shared/workers/lib/usage/scheduled/error-digest.ts +343 -0
- package/templates/shared/workers/lib/usage/scheduled/index.ts +18 -0
- package/templates/shared/workers/lib/usage/scheduled/rollups.ts +1561 -0
- package/templates/shared/workers/lib/usage/shared/constants.ts +362 -0
- package/templates/shared/workers/lib/usage/shared/index.ts +14 -0
- package/templates/shared/workers/lib/usage/shared/types.ts +1066 -0
- package/templates/shared/workers/lib/usage/shared/utils.ts +795 -0
- package/templates/shared/workers/platform-usage.ts +1915 -0
- package/templates/shared/wrangler.usage.jsonc.hbs +58 -0
- package/templates/standard/migrations/005_error_collection.sql +162 -0
- package/templates/standard/workers/error-collector.ts +2670 -0
- package/templates/standard/workers/lib/error-collector/capture.ts +213 -0
- package/templates/standard/workers/lib/error-collector/digest.ts +448 -0
- package/templates/standard/workers/lib/error-collector/email-health-alerts.ts +262 -0
- package/templates/standard/workers/lib/error-collector/fingerprint.ts +258 -0
- package/templates/standard/workers/lib/error-collector/gap-alerts.ts +293 -0
- package/templates/standard/workers/lib/error-collector/github.ts +329 -0
- package/templates/standard/workers/lib/error-collector/types.ts +262 -0
- package/templates/standard/workers/lib/sentinel/gap-detection.ts +734 -0
- package/templates/standard/workers/lib/shared/slack-alerts.ts +585 -0
- package/templates/standard/workers/platform-sentinel.ts +1744 -0
- package/templates/standard/wrangler.error-collector.jsonc.hbs +44 -0
- package/templates/standard/wrangler.sentinel.jsonc.hbs +45 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
3
|
+
"name": "{{projectSlug}}-error-collector",
|
|
4
|
+
"main": "workers/error-collector.ts",
|
|
5
|
+
"compatibility_date": "2026-01-01",
|
|
6
|
+
"compatibility_flags": ["nodejs_compat_v2"],
|
|
7
|
+
"observability": { "enabled": true },
|
|
8
|
+
|
|
9
|
+
// Cron: 15-minute error processing + midnight daily digest
|
|
10
|
+
"triggers": {
|
|
11
|
+
"crons": ["*/15 * * * *", "0 0 * * *"]
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
// Tail worker: receives logs from other workers
|
|
15
|
+
"tail_consumers": [
|
|
16
|
+
{ "service": "{{projectSlug}}-usage" }
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
"d1_databases": [
|
|
20
|
+
{
|
|
21
|
+
"binding": "PLATFORM_DB",
|
|
22
|
+
"database_name": "{{projectSlug}}-metrics",
|
|
23
|
+
"database_id": "YOUR_D1_DATABASE_ID"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
"kv_namespaces": [
|
|
28
|
+
{
|
|
29
|
+
"binding": "PLATFORM_CACHE",
|
|
30
|
+
"id": "YOUR_KV_NAMESPACE_ID"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
|
|
34
|
+
"vars": {
|
|
35
|
+
"GITHUB_ORG": "{{githubOrg}}",
|
|
36
|
+
"DEFAULT_ASSIGNEE": "{{defaultAssignee}}",
|
|
37
|
+
"GATUS_HEARTBEAT_URL": "{{gatusUrl}}"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Secrets needed (set via wrangler secret put):
|
|
41
|
+
// GITHUB_APP_ID
|
|
42
|
+
// GITHUB_APP_PRIVATE_KEY
|
|
43
|
+
// GITHUB_APP_INSTALLATION_ID
|
|
44
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
3
|
+
"name": "{{projectSlug}}-sentinel",
|
|
4
|
+
"main": "workers/platform-sentinel.ts",
|
|
5
|
+
"compatibility_date": "2026-01-01",
|
|
6
|
+
"compatibility_flags": ["nodejs_compat_v2"],
|
|
7
|
+
"observability": { "enabled": true },
|
|
8
|
+
|
|
9
|
+
// Cron: 15-minute gap detection + cost spike monitoring
|
|
10
|
+
"triggers": {
|
|
11
|
+
"crons": ["*/15 * * * *"]
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
"d1_databases": [
|
|
15
|
+
{
|
|
16
|
+
"binding": "PLATFORM_DB",
|
|
17
|
+
"database_name": "{{projectSlug}}-metrics",
|
|
18
|
+
"database_id": "YOUR_D1_DATABASE_ID"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
|
|
22
|
+
"kv_namespaces": [
|
|
23
|
+
{
|
|
24
|
+
"binding": "PLATFORM_CACHE",
|
|
25
|
+
"id": "YOUR_KV_NAMESPACE_ID"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"binding": "PLATFORM_ALERTS",
|
|
29
|
+
"id": "YOUR_KV_ALERTS_NAMESPACE_ID"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
"services": [
|
|
34
|
+
{ "binding": "ERROR_COLLECTOR", "service": "{{projectSlug}}-error-collector" }
|
|
35
|
+
],
|
|
36
|
+
|
|
37
|
+
"vars": {
|
|
38
|
+
"CLOUDFLARE_ACCOUNT_ID": "YOUR_CLOUDFLARE_ACCOUNT_ID",
|
|
39
|
+
"GATUS_HEARTBEAT_URL": "{{gatusUrl}}"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Secrets needed (set via wrangler secret put):
|
|
43
|
+
// CLOUDFLARE_API_TOKEN
|
|
44
|
+
// SLACK_WEBHOOK_URL (optional)
|
|
45
|
+
}
|