s3db.js 13.6.0 → 14.0.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.
- package/README.md +139 -43
- package/dist/s3db.cjs +72425 -38970
- package/dist/s3db.cjs.map +1 -1
- package/dist/s3db.es.js +72177 -38764
- package/dist/s3db.es.js.map +1 -1
- package/mcp/lib/base-handler.js +157 -0
- package/mcp/lib/handlers/connection-handler.js +280 -0
- package/mcp/lib/handlers/query-handler.js +533 -0
- package/mcp/lib/handlers/resource-handler.js +428 -0
- package/mcp/lib/tool-registry.js +336 -0
- package/mcp/lib/tools/connection-tools.js +161 -0
- package/mcp/lib/tools/query-tools.js +267 -0
- package/mcp/lib/tools/resource-tools.js +404 -0
- package/package.json +94 -49
- package/src/clients/memory-client.class.js +346 -191
- package/src/clients/memory-storage.class.js +300 -84
- package/src/clients/s3-client.class.js +7 -6
- package/src/concerns/geo-encoding.js +19 -2
- package/src/concerns/ip.js +59 -9
- package/src/concerns/money.js +8 -1
- package/src/concerns/password-hashing.js +49 -8
- package/src/concerns/plugin-storage.js +186 -18
- package/src/concerns/storage-drivers/filesystem-driver.js +284 -0
- package/src/database.class.js +139 -29
- package/src/errors.js +332 -42
- package/src/plugins/api/auth/oidc-auth.js +66 -17
- package/src/plugins/api/auth/strategies/base-strategy.class.js +74 -0
- package/src/plugins/api/auth/strategies/factory.class.js +63 -0
- package/src/plugins/api/auth/strategies/global-strategy.class.js +44 -0
- package/src/plugins/api/auth/strategies/path-based-strategy.class.js +83 -0
- package/src/plugins/api/auth/strategies/path-rules-strategy.class.js +118 -0
- package/src/plugins/api/concerns/failban-manager.js +106 -57
- package/src/plugins/api/concerns/opengraph-helper.js +116 -0
- package/src/plugins/api/concerns/route-context.js +601 -0
- package/src/plugins/api/concerns/state-machine.js +288 -0
- package/src/plugins/api/index.js +180 -41
- package/src/plugins/api/routes/auth-routes.js +198 -30
- package/src/plugins/api/routes/resource-routes.js +19 -4
- package/src/plugins/api/server/health-manager.class.js +163 -0
- package/src/plugins/api/server/middleware-chain.class.js +310 -0
- package/src/plugins/api/server/router.class.js +472 -0
- package/src/plugins/api/server.js +280 -1303
- package/src/plugins/api/utils/custom-routes.js +17 -5
- package/src/plugins/api/utils/guards.js +76 -17
- package/src/plugins/api/utils/openapi-generator-cached.class.js +133 -0
- package/src/plugins/api/utils/openapi-generator.js +7 -6
- package/src/plugins/api/utils/template-engine.js +77 -3
- package/src/plugins/audit.plugin.js +30 -8
- package/src/plugins/backup.plugin.js +110 -14
- package/src/plugins/cache/cache.class.js +22 -5
- package/src/plugins/cache/filesystem-cache.class.js +116 -19
- package/src/plugins/cache/memory-cache.class.js +211 -57
- package/src/plugins/cache/multi-tier-cache.class.js +371 -0
- package/src/plugins/cache/partition-aware-filesystem-cache.class.js +168 -47
- package/src/plugins/cache/redis-cache.class.js +552 -0
- package/src/plugins/cache/s3-cache.class.js +17 -8
- package/src/plugins/cache.plugin.js +176 -61
- package/src/plugins/cloud-inventory/drivers/alibaba-driver.js +8 -1
- package/src/plugins/cloud-inventory/drivers/aws-driver.js +60 -29
- package/src/plugins/cloud-inventory/drivers/azure-driver.js +8 -1
- package/src/plugins/cloud-inventory/drivers/base-driver.js +16 -2
- package/src/plugins/cloud-inventory/drivers/cloudflare-driver.js +8 -1
- package/src/plugins/cloud-inventory/drivers/digitalocean-driver.js +8 -1
- package/src/plugins/cloud-inventory/drivers/hetzner-driver.js +8 -1
- package/src/plugins/cloud-inventory/drivers/linode-driver.js +8 -1
- package/src/plugins/cloud-inventory/drivers/mongodb-atlas-driver.js +8 -1
- package/src/plugins/cloud-inventory/drivers/vultr-driver.js +8 -1
- package/src/plugins/cloud-inventory/index.js +29 -8
- package/src/plugins/cloud-inventory/registry.js +64 -42
- package/src/plugins/cloud-inventory.plugin.js +240 -138
- package/src/plugins/concerns/plugin-dependencies.js +54 -0
- package/src/plugins/concerns/resource-names.js +100 -0
- package/src/plugins/consumers/index.js +10 -2
- package/src/plugins/consumers/sqs-consumer.js +12 -2
- package/src/plugins/cookie-farm-suite.plugin.js +278 -0
- package/src/plugins/cookie-farm.errors.js +73 -0
- package/src/plugins/cookie-farm.plugin.js +869 -0
- package/src/plugins/costs.plugin.js +7 -1
- package/src/plugins/eventual-consistency/analytics.js +94 -19
- package/src/plugins/eventual-consistency/config.js +15 -7
- package/src/plugins/eventual-consistency/consolidation.js +29 -11
- package/src/plugins/eventual-consistency/garbage-collection.js +3 -1
- package/src/plugins/eventual-consistency/helpers.js +39 -14
- package/src/plugins/eventual-consistency/install.js +21 -2
- package/src/plugins/eventual-consistency/utils.js +32 -10
- package/src/plugins/fulltext.plugin.js +38 -11
- package/src/plugins/geo.plugin.js +61 -9
- package/src/plugins/identity/concerns/config.js +61 -0
- package/src/plugins/identity/concerns/mfa-manager.js +15 -2
- package/src/plugins/identity/concerns/rate-limit.js +124 -0
- package/src/plugins/identity/concerns/resource-schemas.js +9 -1
- package/src/plugins/identity/concerns/token-generator.js +29 -4
- package/src/plugins/identity/drivers/auth-driver.interface.js +76 -0
- package/src/plugins/identity/drivers/client-credentials-driver.js +127 -0
- package/src/plugins/identity/drivers/index.js +18 -0
- package/src/plugins/identity/drivers/password-driver.js +122 -0
- package/src/plugins/identity/email-service.js +17 -2
- package/src/plugins/identity/index.js +413 -69
- package/src/plugins/identity/oauth2-server.js +413 -30
- package/src/plugins/identity/oidc-discovery.js +16 -8
- package/src/plugins/identity/rsa-keys.js +115 -35
- package/src/plugins/identity/server.js +166 -45
- package/src/plugins/identity/session-manager.js +53 -7
- package/src/plugins/identity/ui/pages/mfa-verification.js +17 -15
- package/src/plugins/identity/ui/routes.js +363 -255
- package/src/plugins/importer/index.js +153 -20
- package/src/plugins/index.js +9 -2
- package/src/plugins/kubernetes-inventory/index.js +6 -0
- package/src/plugins/kubernetes-inventory/k8s-driver.js +867 -0
- package/src/plugins/kubernetes-inventory/resource-types.js +274 -0
- package/src/plugins/kubernetes-inventory.plugin.js +980 -0
- package/src/plugins/metrics.plugin.js +64 -16
- package/src/plugins/ml/base-model.class.js +25 -15
- package/src/plugins/ml/regression-model.class.js +1 -1
- package/src/plugins/ml.errors.js +57 -25
- package/src/plugins/ml.plugin.js +28 -4
- package/src/plugins/namespace.js +210 -0
- package/src/plugins/plugin.class.js +180 -8
- package/src/plugins/puppeteer/console-monitor.js +729 -0
- package/src/plugins/puppeteer/cookie-manager.js +492 -0
- package/src/plugins/puppeteer/network-monitor.js +816 -0
- package/src/plugins/puppeteer/performance-manager.js +746 -0
- package/src/plugins/puppeteer/proxy-manager.js +478 -0
- package/src/plugins/puppeteer/stealth-manager.js +556 -0
- package/src/plugins/puppeteer.errors.js +81 -0
- package/src/plugins/puppeteer.plugin.js +1327 -0
- package/src/plugins/queue-consumer.plugin.js +69 -14
- package/src/plugins/recon/behaviors/uptime-behavior.js +691 -0
- package/src/plugins/recon/concerns/command-runner.js +148 -0
- package/src/plugins/recon/concerns/diff-detector.js +372 -0
- package/src/plugins/recon/concerns/fingerprint-builder.js +307 -0
- package/src/plugins/recon/concerns/process-manager.js +338 -0
- package/src/plugins/recon/concerns/report-generator.js +478 -0
- package/src/plugins/recon/concerns/security-analyzer.js +571 -0
- package/src/plugins/recon/concerns/target-normalizer.js +68 -0
- package/src/plugins/recon/config/defaults.js +321 -0
- package/src/plugins/recon/config/resources.js +370 -0
- package/src/plugins/recon/index.js +778 -0
- package/src/plugins/recon/managers/dependency-manager.js +174 -0
- package/src/plugins/recon/managers/scheduler-manager.js +179 -0
- package/src/plugins/recon/managers/storage-manager.js +745 -0
- package/src/plugins/recon/managers/target-manager.js +274 -0
- package/src/plugins/recon/stages/asn-stage.js +314 -0
- package/src/plugins/recon/stages/certificate-stage.js +84 -0
- package/src/plugins/recon/stages/dns-stage.js +107 -0
- package/src/plugins/recon/stages/dnsdumpster-stage.js +362 -0
- package/src/plugins/recon/stages/fingerprint-stage.js +71 -0
- package/src/plugins/recon/stages/google-dorks-stage.js +440 -0
- package/src/plugins/recon/stages/http-stage.js +89 -0
- package/src/plugins/recon/stages/latency-stage.js +148 -0
- package/src/plugins/recon/stages/massdns-stage.js +302 -0
- package/src/plugins/recon/stages/osint-stage.js +1373 -0
- package/src/plugins/recon/stages/ports-stage.js +169 -0
- package/src/plugins/recon/stages/screenshot-stage.js +94 -0
- package/src/plugins/recon/stages/secrets-stage.js +514 -0
- package/src/plugins/recon/stages/subdomains-stage.js +295 -0
- package/src/plugins/recon/stages/tls-audit-stage.js +78 -0
- package/src/plugins/recon/stages/vulnerability-stage.js +78 -0
- package/src/plugins/recon/stages/web-discovery-stage.js +113 -0
- package/src/plugins/recon/stages/whois-stage.js +349 -0
- package/src/plugins/recon.plugin.js +75 -0
- package/src/plugins/recon.plugin.js.backup +2635 -0
- package/src/plugins/relation.errors.js +87 -14
- package/src/plugins/replicator.plugin.js +514 -137
- package/src/plugins/replicators/base-replicator.class.js +89 -1
- package/src/plugins/replicators/bigquery-replicator.class.js +66 -22
- package/src/plugins/replicators/dynamodb-replicator.class.js +22 -15
- package/src/plugins/replicators/mongodb-replicator.class.js +22 -15
- package/src/plugins/replicators/mysql-replicator.class.js +52 -17
- package/src/plugins/replicators/planetscale-replicator.class.js +30 -4
- package/src/plugins/replicators/postgres-replicator.class.js +62 -27
- package/src/plugins/replicators/s3db-replicator.class.js +25 -18
- package/src/plugins/replicators/schema-sync.helper.js +3 -3
- package/src/plugins/replicators/sqs-replicator.class.js +8 -2
- package/src/plugins/replicators/turso-replicator.class.js +23 -3
- package/src/plugins/replicators/webhook-replicator.class.js +42 -4
- package/src/plugins/s3-queue.plugin.js +464 -65
- package/src/plugins/scheduler.plugin.js +20 -6
- package/src/plugins/state-machine.plugin.js +40 -9
- package/src/plugins/tfstate/README.md +126 -126
- package/src/plugins/tfstate/base-driver.js +28 -4
- package/src/plugins/tfstate/errors.js +65 -10
- package/src/plugins/tfstate/filesystem-driver.js +52 -8
- package/src/plugins/tfstate/index.js +163 -90
- package/src/plugins/tfstate/s3-driver.js +64 -6
- package/src/plugins/ttl.plugin.js +72 -17
- package/src/plugins/vector/distances.js +18 -12
- package/src/plugins/vector/kmeans.js +26 -4
- package/src/resource.class.js +115 -19
- package/src/testing/factory.class.js +20 -3
- package/src/testing/seeder.class.js +7 -1
- package/src/clients/memory-client.md +0 -917
- package/src/plugins/cloud-inventory/drivers/mock-drivers.js +0 -449
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query tool definitions
|
|
3
|
+
*/
|
|
4
|
+
export const queryTools = [
|
|
5
|
+
{
|
|
6
|
+
name: 'queryCreate',
|
|
7
|
+
method: 'create',
|
|
8
|
+
description: 'Create a query builder for complex queries',
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
resourceName: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Resource to query'
|
|
15
|
+
},
|
|
16
|
+
queryId: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Custom query ID (optional)'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
required: ['resourceName']
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
name: 'queryFilter',
|
|
27
|
+
method: 'filter',
|
|
28
|
+
description: 'Add filter conditions to query',
|
|
29
|
+
inputSchema: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
queryId: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Query builder ID'
|
|
35
|
+
},
|
|
36
|
+
field: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'Field to filter (supports nested: user.name)'
|
|
39
|
+
},
|
|
40
|
+
operator: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
enum: ['eq', 'ne', 'gt', 'gte', 'lt', 'lte', 'in', 'nin', 'contains', 'startsWith', 'endsWith', 'regex', 'exists', 'type'],
|
|
43
|
+
description: 'Comparison operator'
|
|
44
|
+
},
|
|
45
|
+
value: {
|
|
46
|
+
description: 'Value to compare against'
|
|
47
|
+
},
|
|
48
|
+
combineWith: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
enum: ['AND', 'OR'],
|
|
51
|
+
description: 'How to combine with previous filters',
|
|
52
|
+
default: 'AND'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
required: ['queryId', 'field', 'operator', 'value']
|
|
56
|
+
},
|
|
57
|
+
examples: [
|
|
58
|
+
{
|
|
59
|
+
description: 'Filter by age greater than 18',
|
|
60
|
+
args: {
|
|
61
|
+
queryId: 'query_123',
|
|
62
|
+
field: 'age',
|
|
63
|
+
operator: 'gt',
|
|
64
|
+
value: 18
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
description: 'Filter by status in list',
|
|
69
|
+
args: {
|
|
70
|
+
queryId: 'query_123',
|
|
71
|
+
field: 'status',
|
|
72
|
+
operator: 'in',
|
|
73
|
+
value: ['active', 'pending']
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
{
|
|
80
|
+
name: 'querySort',
|
|
81
|
+
method: 'sort',
|
|
82
|
+
description: 'Add sorting to query',
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
properties: {
|
|
86
|
+
queryId: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'Query builder ID'
|
|
89
|
+
},
|
|
90
|
+
field: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
description: 'Field to sort by'
|
|
93
|
+
},
|
|
94
|
+
direction: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
enum: ['asc', 'desc'],
|
|
97
|
+
description: 'Sort direction',
|
|
98
|
+
default: 'asc'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
required: ['queryId', 'field']
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
{
|
|
106
|
+
name: 'queryProject',
|
|
107
|
+
method: 'project',
|
|
108
|
+
description: 'Select specific fields to return',
|
|
109
|
+
inputSchema: {
|
|
110
|
+
type: 'object',
|
|
111
|
+
properties: {
|
|
112
|
+
queryId: {
|
|
113
|
+
type: 'string',
|
|
114
|
+
description: 'Query builder ID'
|
|
115
|
+
},
|
|
116
|
+
fields: {
|
|
117
|
+
type: 'array',
|
|
118
|
+
items: { type: 'string' },
|
|
119
|
+
description: 'Fields to include/exclude'
|
|
120
|
+
},
|
|
121
|
+
exclude: {
|
|
122
|
+
type: 'boolean',
|
|
123
|
+
description: 'Exclude specified fields instead',
|
|
124
|
+
default: false
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
required: ['queryId', 'fields']
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
{
|
|
132
|
+
name: 'queryExecute',
|
|
133
|
+
method: 'execute',
|
|
134
|
+
description: 'Execute built query',
|
|
135
|
+
inputSchema: {
|
|
136
|
+
type: 'object',
|
|
137
|
+
properties: {
|
|
138
|
+
queryId: {
|
|
139
|
+
type: 'string',
|
|
140
|
+
description: 'Query builder ID'
|
|
141
|
+
},
|
|
142
|
+
limit: {
|
|
143
|
+
type: 'number',
|
|
144
|
+
description: 'Override limit',
|
|
145
|
+
minimum: 1,
|
|
146
|
+
maximum: 10000
|
|
147
|
+
},
|
|
148
|
+
offset: {
|
|
149
|
+
type: 'number',
|
|
150
|
+
description: 'Override offset',
|
|
151
|
+
minimum: 0
|
|
152
|
+
},
|
|
153
|
+
explain: {
|
|
154
|
+
type: 'boolean',
|
|
155
|
+
description: 'Return execution plan instead',
|
|
156
|
+
default: false
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
required: ['queryId']
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
{
|
|
164
|
+
name: 'queryAggregate',
|
|
165
|
+
method: 'aggregate',
|
|
166
|
+
description: 'Perform aggregation operations',
|
|
167
|
+
inputSchema: {
|
|
168
|
+
type: 'object',
|
|
169
|
+
properties: {
|
|
170
|
+
resourceName: {
|
|
171
|
+
type: 'string',
|
|
172
|
+
description: 'Resource to aggregate'
|
|
173
|
+
},
|
|
174
|
+
pipeline: {
|
|
175
|
+
type: 'array',
|
|
176
|
+
description: 'Aggregation pipeline stages',
|
|
177
|
+
items: {
|
|
178
|
+
type: 'object',
|
|
179
|
+
properties: {
|
|
180
|
+
stage: {
|
|
181
|
+
type: 'string',
|
|
182
|
+
enum: ['match', 'group', 'sort', 'limit', 'count', 'sum', 'avg', 'min', 'max']
|
|
183
|
+
},
|
|
184
|
+
params: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
description: 'Stage parameters'
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
required: ['stage', 'params']
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
required: ['resourceName', 'pipeline']
|
|
194
|
+
},
|
|
195
|
+
examples: [
|
|
196
|
+
{
|
|
197
|
+
description: 'Count by category',
|
|
198
|
+
args: {
|
|
199
|
+
resourceName: 'products',
|
|
200
|
+
pipeline: [
|
|
201
|
+
{
|
|
202
|
+
stage: 'group',
|
|
203
|
+
params: {
|
|
204
|
+
by: 'category',
|
|
205
|
+
aggregations: [
|
|
206
|
+
{ type: 'count', name: 'total' }
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
description: 'Average price by brand',
|
|
215
|
+
args: {
|
|
216
|
+
resourceName: 'products',
|
|
217
|
+
pipeline: [
|
|
218
|
+
{
|
|
219
|
+
stage: 'group',
|
|
220
|
+
params: {
|
|
221
|
+
by: 'brand',
|
|
222
|
+
aggregations: [
|
|
223
|
+
{ type: 'avg', field: 'price', name: 'avgPrice' }
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
stage: 'sort',
|
|
229
|
+
params: {
|
|
230
|
+
rules: [{ field: 'avgPrice', direction: 'desc' }]
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
{
|
|
240
|
+
name: 'queryBuildFromText',
|
|
241
|
+
method: 'buildFromText',
|
|
242
|
+
description: 'Build query from natural language',
|
|
243
|
+
inputSchema: {
|
|
244
|
+
type: 'object',
|
|
245
|
+
properties: {
|
|
246
|
+
resourceName: {
|
|
247
|
+
type: 'string',
|
|
248
|
+
description: 'Resource to query'
|
|
249
|
+
},
|
|
250
|
+
query: {
|
|
251
|
+
type: 'string',
|
|
252
|
+
description: 'Natural language query'
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
required: ['resourceName', 'query']
|
|
256
|
+
},
|
|
257
|
+
examples: [
|
|
258
|
+
{
|
|
259
|
+
description: 'Simple text query',
|
|
260
|
+
args: {
|
|
261
|
+
resourceName: 'users',
|
|
262
|
+
query: 'Find users where age is greater than 18 sorted by name'
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
];
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource tool definitions
|
|
3
|
+
*/
|
|
4
|
+
export const resourceTools = [
|
|
5
|
+
{
|
|
6
|
+
name: 'dbCreateResource',
|
|
7
|
+
method: 'createResource',
|
|
8
|
+
description: 'Create a new resource (collection/table)',
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
name: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Resource name',
|
|
15
|
+
pattern: '^[a-zA-Z][a-zA-Z0-9_]*$'
|
|
16
|
+
},
|
|
17
|
+
attributes: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
description: 'Schema attributes (e.g., {"name": "string|required"})'
|
|
20
|
+
},
|
|
21
|
+
behavior: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: ['user-managed', 'body-only', 'body-overflow', 'enforce-limits', 'truncate-data'],
|
|
24
|
+
description: 'Storage behavior strategy',
|
|
25
|
+
default: 'user-managed'
|
|
26
|
+
},
|
|
27
|
+
timestamps: {
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
description: 'Auto-add createdAt/updatedAt',
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
partitions: {
|
|
33
|
+
type: 'object',
|
|
34
|
+
description: 'Partition configuration'
|
|
35
|
+
},
|
|
36
|
+
paranoid: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
description: 'Enable soft deletes',
|
|
39
|
+
default: true
|
|
40
|
+
},
|
|
41
|
+
hooks: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
description: 'Lifecycle hooks'
|
|
44
|
+
},
|
|
45
|
+
events: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
description: 'Event listeners'
|
|
48
|
+
},
|
|
49
|
+
idSize: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
description: 'Length of auto-generated IDs',
|
|
52
|
+
default: 22,
|
|
53
|
+
minimum: 4,
|
|
54
|
+
maximum: 128
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
required: ['name', 'attributes']
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
name: 'dbListResources',
|
|
63
|
+
method: 'listResources',
|
|
64
|
+
description: 'List all resources in database',
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {},
|
|
68
|
+
required: []
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
{
|
|
73
|
+
name: 'resourceInsert',
|
|
74
|
+
method: 'insert',
|
|
75
|
+
description: 'Insert a document into resource',
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: 'object',
|
|
78
|
+
properties: {
|
|
79
|
+
resourceName: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
description: 'Target resource name'
|
|
82
|
+
},
|
|
83
|
+
data: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
description: 'Document data to insert'
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
required: ['resourceName', 'data']
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
{
|
|
93
|
+
name: 'resourceInsertMany',
|
|
94
|
+
method: 'insertMany',
|
|
95
|
+
description: 'Insert multiple documents',
|
|
96
|
+
inputSchema: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
properties: {
|
|
99
|
+
resourceName: {
|
|
100
|
+
type: 'string',
|
|
101
|
+
description: 'Target resource name'
|
|
102
|
+
},
|
|
103
|
+
data: {
|
|
104
|
+
type: 'array',
|
|
105
|
+
description: 'Array of documents',
|
|
106
|
+
minItems: 1,
|
|
107
|
+
maxItems: 10000
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
required: ['resourceName', 'data']
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
{
|
|
115
|
+
name: 'resourceGet',
|
|
116
|
+
method: 'get',
|
|
117
|
+
description: 'Get document by ID',
|
|
118
|
+
inputSchema: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
resourceName: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'Resource name'
|
|
124
|
+
},
|
|
125
|
+
id: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'Document ID'
|
|
128
|
+
},
|
|
129
|
+
partition: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
description: 'Partition name for optimization'
|
|
132
|
+
},
|
|
133
|
+
partitionValues: {
|
|
134
|
+
type: 'object',
|
|
135
|
+
description: 'Partition field values'
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
required: ['resourceName', 'id']
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
{
|
|
143
|
+
name: 'resourceGetMany',
|
|
144
|
+
method: 'getMany',
|
|
145
|
+
description: 'Get multiple documents by IDs',
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {
|
|
149
|
+
resourceName: {
|
|
150
|
+
type: 'string',
|
|
151
|
+
description: 'Resource name'
|
|
152
|
+
},
|
|
153
|
+
ids: {
|
|
154
|
+
type: 'array',
|
|
155
|
+
items: { type: 'string' },
|
|
156
|
+
description: 'Document IDs',
|
|
157
|
+
minItems: 1,
|
|
158
|
+
maxItems: 1000
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
required: ['resourceName', 'ids']
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
{
|
|
166
|
+
name: 'resourceUpdate',
|
|
167
|
+
method: 'update',
|
|
168
|
+
description: 'Update a document',
|
|
169
|
+
inputSchema: {
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: {
|
|
172
|
+
resourceName: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
description: 'Resource name'
|
|
175
|
+
},
|
|
176
|
+
id: {
|
|
177
|
+
type: 'string',
|
|
178
|
+
description: 'Document ID'
|
|
179
|
+
},
|
|
180
|
+
data: {
|
|
181
|
+
type: 'object',
|
|
182
|
+
description: 'Update data'
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
required: ['resourceName', 'id', 'data']
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
{
|
|
190
|
+
name: 'resourceUpsert',
|
|
191
|
+
method: 'upsert',
|
|
192
|
+
description: 'Insert or update document',
|
|
193
|
+
inputSchema: {
|
|
194
|
+
type: 'object',
|
|
195
|
+
properties: {
|
|
196
|
+
resourceName: {
|
|
197
|
+
type: 'string',
|
|
198
|
+
description: 'Resource name'
|
|
199
|
+
},
|
|
200
|
+
data: {
|
|
201
|
+
type: 'object',
|
|
202
|
+
description: 'Document data (include id for update)'
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
required: ['resourceName', 'data']
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
{
|
|
210
|
+
name: 'resourceDelete',
|
|
211
|
+
method: 'delete',
|
|
212
|
+
description: 'Delete a document',
|
|
213
|
+
inputSchema: {
|
|
214
|
+
type: 'object',
|
|
215
|
+
properties: {
|
|
216
|
+
resourceName: {
|
|
217
|
+
type: 'string',
|
|
218
|
+
description: 'Resource name'
|
|
219
|
+
},
|
|
220
|
+
id: {
|
|
221
|
+
type: 'string',
|
|
222
|
+
description: 'Document ID'
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
required: ['resourceName', 'id']
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
{
|
|
230
|
+
name: 'resourceDeleteMany',
|
|
231
|
+
method: 'deleteMany',
|
|
232
|
+
description: 'Delete multiple documents',
|
|
233
|
+
inputSchema: {
|
|
234
|
+
type: 'object',
|
|
235
|
+
properties: {
|
|
236
|
+
resourceName: {
|
|
237
|
+
type: 'string',
|
|
238
|
+
description: 'Resource name'
|
|
239
|
+
},
|
|
240
|
+
ids: {
|
|
241
|
+
type: 'array',
|
|
242
|
+
items: { type: 'string' },
|
|
243
|
+
description: 'Document IDs to delete',
|
|
244
|
+
minItems: 1
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
required: ['resourceName', 'ids']
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
{
|
|
252
|
+
name: 'resourceDeleteAll',
|
|
253
|
+
method: 'deleteAll',
|
|
254
|
+
description: 'Delete all documents (dangerous)',
|
|
255
|
+
inputSchema: {
|
|
256
|
+
type: 'object',
|
|
257
|
+
properties: {
|
|
258
|
+
resourceName: {
|
|
259
|
+
type: 'string',
|
|
260
|
+
description: 'Resource name'
|
|
261
|
+
},
|
|
262
|
+
confirm: {
|
|
263
|
+
type: 'boolean',
|
|
264
|
+
description: 'Confirmation flag (must be true)'
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
required: ['resourceName', 'confirm']
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
{
|
|
272
|
+
name: 'resourceExists',
|
|
273
|
+
method: 'exists',
|
|
274
|
+
description: 'Check if document exists',
|
|
275
|
+
inputSchema: {
|
|
276
|
+
type: 'object',
|
|
277
|
+
properties: {
|
|
278
|
+
resourceName: {
|
|
279
|
+
type: 'string',
|
|
280
|
+
description: 'Resource name'
|
|
281
|
+
},
|
|
282
|
+
id: {
|
|
283
|
+
type: 'string',
|
|
284
|
+
description: 'Document ID'
|
|
285
|
+
},
|
|
286
|
+
partition: {
|
|
287
|
+
type: 'string',
|
|
288
|
+
description: 'Partition name'
|
|
289
|
+
},
|
|
290
|
+
partitionValues: {
|
|
291
|
+
type: 'object',
|
|
292
|
+
description: 'Partition values'
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
required: ['resourceName', 'id']
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
{
|
|
300
|
+
name: 'resourceList',
|
|
301
|
+
method: 'list',
|
|
302
|
+
description: 'List documents with pagination',
|
|
303
|
+
inputSchema: {
|
|
304
|
+
type: 'object',
|
|
305
|
+
properties: {
|
|
306
|
+
resourceName: {
|
|
307
|
+
type: 'string',
|
|
308
|
+
description: 'Resource name'
|
|
309
|
+
},
|
|
310
|
+
limit: {
|
|
311
|
+
type: 'number',
|
|
312
|
+
description: 'Max documents to return',
|
|
313
|
+
default: 100,
|
|
314
|
+
minimum: 1,
|
|
315
|
+
maximum: 10000
|
|
316
|
+
},
|
|
317
|
+
offset: {
|
|
318
|
+
type: 'number',
|
|
319
|
+
description: 'Documents to skip',
|
|
320
|
+
default: 0,
|
|
321
|
+
minimum: 0
|
|
322
|
+
},
|
|
323
|
+
partition: {
|
|
324
|
+
type: 'string',
|
|
325
|
+
description: 'Filter by partition'
|
|
326
|
+
},
|
|
327
|
+
partitionValues: {
|
|
328
|
+
type: 'object',
|
|
329
|
+
description: 'Partition filter values'
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
required: ['resourceName']
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
{
|
|
337
|
+
name: 'resourceListIds',
|
|
338
|
+
method: 'listIds',
|
|
339
|
+
description: 'List document IDs only',
|
|
340
|
+
inputSchema: {
|
|
341
|
+
type: 'object',
|
|
342
|
+
properties: {
|
|
343
|
+
resourceName: {
|
|
344
|
+
type: 'string',
|
|
345
|
+
description: 'Resource name'
|
|
346
|
+
},
|
|
347
|
+
limit: {
|
|
348
|
+
type: 'number',
|
|
349
|
+
description: 'Max IDs to return',
|
|
350
|
+
default: 1000,
|
|
351
|
+
minimum: 1,
|
|
352
|
+
maximum: 100000
|
|
353
|
+
},
|
|
354
|
+
offset: {
|
|
355
|
+
type: 'number',
|
|
356
|
+
description: 'IDs to skip',
|
|
357
|
+
default: 0,
|
|
358
|
+
minimum: 0
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
required: ['resourceName']
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
{
|
|
366
|
+
name: 'resourceCount',
|
|
367
|
+
method: 'count',
|
|
368
|
+
description: 'Count documents in resource',
|
|
369
|
+
inputSchema: {
|
|
370
|
+
type: 'object',
|
|
371
|
+
properties: {
|
|
372
|
+
resourceName: {
|
|
373
|
+
type: 'string',
|
|
374
|
+
description: 'Resource name'
|
|
375
|
+
},
|
|
376
|
+
partition: {
|
|
377
|
+
type: 'string',
|
|
378
|
+
description: 'Count within partition'
|
|
379
|
+
},
|
|
380
|
+
partitionValues: {
|
|
381
|
+
type: 'object',
|
|
382
|
+
description: 'Partition filter'
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
required: ['resourceName']
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
{
|
|
390
|
+
name: 'resourceGetAll',
|
|
391
|
+
method: 'getAll',
|
|
392
|
+
description: 'Get all documents (use carefully)',
|
|
393
|
+
inputSchema: {
|
|
394
|
+
type: 'object',
|
|
395
|
+
properties: {
|
|
396
|
+
resourceName: {
|
|
397
|
+
type: 'string',
|
|
398
|
+
description: 'Resource name'
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
required: ['resourceName']
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
];
|