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
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
import { BaseCloudDriver } from './base-driver.js';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_TAGS = { environment: 'mock' };
|
|
4
|
-
|
|
5
|
-
function cloneValue(value) {
|
|
6
|
-
if (Array.isArray(value)) {
|
|
7
|
-
return value.map(cloneValue);
|
|
8
|
-
}
|
|
9
|
-
if (value && typeof value === 'object') {
|
|
10
|
-
return JSON.parse(JSON.stringify(value));
|
|
11
|
-
}
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function mergeWithDefaults(defaults, resource = {}) {
|
|
16
|
-
const merged = {
|
|
17
|
-
...defaults,
|
|
18
|
-
...resource
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const baseTags = defaults.tags || null;
|
|
22
|
-
const resourceTags = resource.tags || null;
|
|
23
|
-
merged.tags = baseTags || resourceTags
|
|
24
|
-
? { ...(baseTags || {}), ...(resourceTags || {}) }
|
|
25
|
-
: null;
|
|
26
|
-
|
|
27
|
-
const baseLabels = defaults.labels || null;
|
|
28
|
-
const resourceLabels = resource.labels || null;
|
|
29
|
-
merged.labels = baseLabels || resourceLabels
|
|
30
|
-
? { ...(baseLabels || {}), ...(resourceLabels || {}) }
|
|
31
|
-
: null;
|
|
32
|
-
|
|
33
|
-
const baseMetadata = defaults.metadata || {};
|
|
34
|
-
const resourceMetadata = resource.metadata || {};
|
|
35
|
-
merged.metadata = { ...baseMetadata, ...resourceMetadata };
|
|
36
|
-
|
|
37
|
-
const configuration = resource.configuration ?? defaults.configuration ?? {
|
|
38
|
-
id: merged.resourceId,
|
|
39
|
-
note: `Mock configuration for ${defaults.provider}`
|
|
40
|
-
};
|
|
41
|
-
merged.configuration = cloneValue(configuration);
|
|
42
|
-
|
|
43
|
-
return merged;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
class MockCloudDriver extends BaseCloudDriver {
|
|
47
|
-
constructor(options = {}, defaultsBuilder) {
|
|
48
|
-
super(options);
|
|
49
|
-
this._defaultsBuilder = defaultsBuilder;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
_buildDefaults() {
|
|
53
|
-
return this._defaultsBuilder(this);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async initialize() {
|
|
57
|
-
this.logger('debug', 'Mock cloud driver initialized', {
|
|
58
|
-
cloudId: this.id,
|
|
59
|
-
driver: this.driver
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async listResources() {
|
|
64
|
-
const defaults = this._buildDefaults();
|
|
65
|
-
const samples = Array.isArray(this.config.sampleResources) && this.config.sampleResources.length
|
|
66
|
-
? this.config.sampleResources
|
|
67
|
-
: [defaults];
|
|
68
|
-
|
|
69
|
-
return samples.map(entry => mergeWithDefaults(defaults, entry));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function awsDefaults(driver) {
|
|
74
|
-
const accountId = driver.config.accountId || 'mock-aws-account';
|
|
75
|
-
const region = driver.config.region || driver.config.regions?.[0] || 'us-east-1';
|
|
76
|
-
const resourceId = driver.config.resourceId || `i-${accountId.slice(-6) || 'mock'}001`;
|
|
77
|
-
return {
|
|
78
|
-
provider: 'aws',
|
|
79
|
-
driver: 'aws',
|
|
80
|
-
accountId,
|
|
81
|
-
region,
|
|
82
|
-
service: 'ec2',
|
|
83
|
-
resourceType: 'ec2.instance',
|
|
84
|
-
resourceId,
|
|
85
|
-
name: 'mock-ec2-instance',
|
|
86
|
-
tags: { ...DEFAULT_TAGS, Owner: 'cloud-inventory' },
|
|
87
|
-
metadata: { source: 'cloud-inventory-mock' },
|
|
88
|
-
configuration: {
|
|
89
|
-
instanceId: resourceId,
|
|
90
|
-
instanceType: 't3.micro',
|
|
91
|
-
region,
|
|
92
|
-
accountId,
|
|
93
|
-
state: 'running',
|
|
94
|
-
tags: { Environment: 'mock', Owner: 'cloud-inventory' }
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function gcpDefaults(driver) {
|
|
100
|
-
const projectId = driver.config.projectId || 'mock-gcp-project';
|
|
101
|
-
const region = driver.config.region || driver.config.regions?.[0] || 'us-central1';
|
|
102
|
-
const zone = driver.config.zone || `${region}-a`;
|
|
103
|
-
const resourceId = driver.config.resourceId || `${projectId}-instance-1`;
|
|
104
|
-
return {
|
|
105
|
-
provider: 'gcp',
|
|
106
|
-
driver: 'gcp',
|
|
107
|
-
projectId,
|
|
108
|
-
region,
|
|
109
|
-
service: 'compute',
|
|
110
|
-
resourceType: 'gcp.compute.instance',
|
|
111
|
-
resourceId,
|
|
112
|
-
name: 'mock-gce-instance',
|
|
113
|
-
labels: { ...DEFAULT_TAGS, owner: 'cloud-inventory' },
|
|
114
|
-
metadata: { source: 'cloud-inventory-mock', zone },
|
|
115
|
-
configuration: {
|
|
116
|
-
id: resourceId,
|
|
117
|
-
name: 'mock-gce-instance',
|
|
118
|
-
machineType: 'e2-medium',
|
|
119
|
-
status: 'RUNNING',
|
|
120
|
-
projectId,
|
|
121
|
-
zone,
|
|
122
|
-
labels: { environment: 'mock', owner: 'cloud-inventory' }
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function digitalOceanDefaults(driver) {
|
|
128
|
-
const accountId = driver.config.accountId || 'mock-do-account';
|
|
129
|
-
const region = driver.config.region || driver.config.regions?.[0] || 'nyc3';
|
|
130
|
-
const resourceId = driver.config.resourceId || `do-${accountId.slice(-6) || 'mock'}-droplet`;
|
|
131
|
-
return {
|
|
132
|
-
provider: 'digitalocean',
|
|
133
|
-
driver: 'digitalocean',
|
|
134
|
-
accountId,
|
|
135
|
-
region,
|
|
136
|
-
service: 'droplet',
|
|
137
|
-
resourceType: 'do.droplet',
|
|
138
|
-
resourceId,
|
|
139
|
-
name: 'mock-droplet',
|
|
140
|
-
tags: { ...DEFAULT_TAGS, owner: 'cloud-inventory' },
|
|
141
|
-
metadata: { source: 'cloud-inventory-mock' },
|
|
142
|
-
configuration: {
|
|
143
|
-
id: resourceId,
|
|
144
|
-
name: 'mock-droplet',
|
|
145
|
-
size: 's-2vcpu-4gb',
|
|
146
|
-
region,
|
|
147
|
-
status: 'active',
|
|
148
|
-
tags: ['mock', 'cloud-inventory']
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function oracleDefaults(driver) {
|
|
154
|
-
const tenancyId = driver.config.tenancyId || driver.config.organizationId || 'ocid1.tenancy.oc1..mock';
|
|
155
|
-
const compartmentId = driver.config.compartmentId || 'ocid1.compartment.oc1..mock';
|
|
156
|
-
const region = driver.config.region || 'us-phoenix-1';
|
|
157
|
-
const resourceId = driver.config.resourceId || 'ocid1.instance.oc1..mock';
|
|
158
|
-
return {
|
|
159
|
-
provider: 'oracle',
|
|
160
|
-
driver: 'oracle',
|
|
161
|
-
organizationId: tenancyId,
|
|
162
|
-
region,
|
|
163
|
-
service: 'compute',
|
|
164
|
-
resourceType: 'oci.compute.instance',
|
|
165
|
-
resourceId,
|
|
166
|
-
name: 'mock-oci-instance',
|
|
167
|
-
tags: { ...DEFAULT_TAGS, owner: 'cloud-inventory' },
|
|
168
|
-
metadata: {
|
|
169
|
-
source: 'cloud-inventory-mock',
|
|
170
|
-
compartmentId
|
|
171
|
-
},
|
|
172
|
-
configuration: {
|
|
173
|
-
id: resourceId,
|
|
174
|
-
displayName: 'mock-oci-instance',
|
|
175
|
-
compartmentId,
|
|
176
|
-
lifecycleState: 'RUNNING',
|
|
177
|
-
region,
|
|
178
|
-
shape: 'VM.Standard.E4.Flex',
|
|
179
|
-
freeformTags: { Environment: 'mock', Owner: 'cloud-inventory' }
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function azureDefaults(driver) {
|
|
185
|
-
const subscriptionId = driver.config.subscriptionId || driver.config.accountId || '00000000-0000-0000-0000-000000000000';
|
|
186
|
-
const resourceGroup = driver.config.resourceGroup || 'rg-mock';
|
|
187
|
-
const region = driver.config.region || 'eastus';
|
|
188
|
-
const vmName = driver.config.vmName || 'mock-azure-vm';
|
|
189
|
-
const resourceId = driver.config.resourceId || `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.Compute/virtualMachines/${vmName}`;
|
|
190
|
-
return {
|
|
191
|
-
provider: 'azure',
|
|
192
|
-
driver: 'azure',
|
|
193
|
-
subscriptionId,
|
|
194
|
-
region,
|
|
195
|
-
service: 'compute',
|
|
196
|
-
resourceType: 'azure.vm',
|
|
197
|
-
resourceId,
|
|
198
|
-
name: vmName,
|
|
199
|
-
tags: { ...DEFAULT_TAGS, owner: 'cloud-inventory' },
|
|
200
|
-
metadata: {
|
|
201
|
-
source: 'cloud-inventory-mock',
|
|
202
|
-
resourceGroup
|
|
203
|
-
},
|
|
204
|
-
configuration: {
|
|
205
|
-
id: resourceId,
|
|
206
|
-
name: vmName,
|
|
207
|
-
location: region,
|
|
208
|
-
resourceGroup,
|
|
209
|
-
subscriptionId,
|
|
210
|
-
hardwareProfile: { vmSize: 'Standard_B2s' },
|
|
211
|
-
provisioningState: 'Succeeded',
|
|
212
|
-
tags: { Environment: 'mock', Owner: 'cloud-inventory' }
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function vultrDefaults(driver) {
|
|
218
|
-
const accountId = driver.config.accountId || 'mock-vultr-account';
|
|
219
|
-
const region = driver.config.region || 'ewr';
|
|
220
|
-
const resourceId = driver.config.resourceId || `vultr-${accountId.slice(-6) || 'mock'}-instance`;
|
|
221
|
-
return {
|
|
222
|
-
provider: 'vultr',
|
|
223
|
-
driver: 'vultr',
|
|
224
|
-
accountId,
|
|
225
|
-
region,
|
|
226
|
-
service: 'compute',
|
|
227
|
-
resourceType: 'vultr.instance',
|
|
228
|
-
resourceId,
|
|
229
|
-
name: 'mock-vultr-instance',
|
|
230
|
-
tags: { ...DEFAULT_TAGS, owner: 'cloud-inventory' },
|
|
231
|
-
metadata: { source: 'cloud-inventory-mock' },
|
|
232
|
-
configuration: {
|
|
233
|
-
id: resourceId,
|
|
234
|
-
label: 'mock-vultr-instance',
|
|
235
|
-
plan: 'vc2-1c-1gb',
|
|
236
|
-
region,
|
|
237
|
-
status: 'active',
|
|
238
|
-
tags: ['mock', 'cloud-inventory']
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export class AwsMockDriver extends MockCloudDriver {
|
|
244
|
-
constructor(options = {}) {
|
|
245
|
-
super(options, awsDefaults);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export class GcpMockDriver extends MockCloudDriver {
|
|
250
|
-
constructor(options = {}) {
|
|
251
|
-
super(options, gcpDefaults);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export class DigitalOceanMockDriver extends MockCloudDriver {
|
|
256
|
-
constructor(options = {}) {
|
|
257
|
-
super(options, digitalOceanDefaults);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export class OracleMockDriver extends MockCloudDriver {
|
|
262
|
-
constructor(options = {}) {
|
|
263
|
-
super(options, oracleDefaults);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export class AzureMockDriver extends MockCloudDriver {
|
|
268
|
-
constructor(options = {}) {
|
|
269
|
-
super(options, azureDefaults);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export class VultrMockDriver extends MockCloudDriver {
|
|
274
|
-
constructor(options = {}) {
|
|
275
|
-
super(options, vultrDefaults);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function linodeDefaults(driver) {
|
|
280
|
-
const accountId = driver.config.accountId || 'mock-linode-account';
|
|
281
|
-
const region = driver.config.region || driver.config.regions?.[0] || 'us-east';
|
|
282
|
-
const resourceId = driver.config.resourceId || `linode-${accountId.slice(-6) || 'mock'}-instance`;
|
|
283
|
-
return {
|
|
284
|
-
provider: 'linode',
|
|
285
|
-
driver: 'linode',
|
|
286
|
-
accountId,
|
|
287
|
-
region,
|
|
288
|
-
service: 'linodes',
|
|
289
|
-
resourceType: 'linode.compute.instance',
|
|
290
|
-
resourceId,
|
|
291
|
-
name: 'mock-linode-instance',
|
|
292
|
-
tags: ['mock', 'cloud-inventory'],
|
|
293
|
-
metadata: { source: 'cloud-inventory-mock' },
|
|
294
|
-
configuration: {
|
|
295
|
-
id: resourceId,
|
|
296
|
-
label: 'mock-linode-instance',
|
|
297
|
-
type: 'g6-nanode-1',
|
|
298
|
-
region,
|
|
299
|
-
status: 'running',
|
|
300
|
-
tags: ['mock', 'cloud-inventory']
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function hetznerDefaults(driver) {
|
|
306
|
-
const accountId = driver.config.accountId || 'mock-hetzner-account';
|
|
307
|
-
const region = driver.config.region || 'fsn1';
|
|
308
|
-
const resourceId = driver.config.resourceId || `hetzner-${accountId.slice(-6) || 'mock'}-server`;
|
|
309
|
-
return {
|
|
310
|
-
provider: 'hetzner',
|
|
311
|
-
driver: 'hetzner',
|
|
312
|
-
accountId,
|
|
313
|
-
region,
|
|
314
|
-
service: 'servers',
|
|
315
|
-
resourceType: 'hetzner.server',
|
|
316
|
-
resourceId,
|
|
317
|
-
name: 'mock-hetzner-server',
|
|
318
|
-
tags: { ...DEFAULT_TAGS, owner: 'cloud-inventory' },
|
|
319
|
-
metadata: { source: 'cloud-inventory-mock' },
|
|
320
|
-
configuration: {
|
|
321
|
-
id: resourceId,
|
|
322
|
-
name: 'mock-hetzner-server',
|
|
323
|
-
serverType: 'cx11',
|
|
324
|
-
datacenter: { location: { name: region } },
|
|
325
|
-
status: 'running',
|
|
326
|
-
labels: { environment: 'mock', owner: 'cloud-inventory' }
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function alibabaDefaults(driver) {
|
|
332
|
-
const accountId = driver.config.accountId || 'mock-alibaba-account';
|
|
333
|
-
const region = driver.config.region || driver.config.regions?.[0] || 'cn-hangzhou';
|
|
334
|
-
const resourceId = driver.config.resourceId || `i-${accountId.slice(-6) || 'mock'}001`;
|
|
335
|
-
return {
|
|
336
|
-
provider: 'alibaba',
|
|
337
|
-
driver: 'alibaba',
|
|
338
|
-
accountId,
|
|
339
|
-
region,
|
|
340
|
-
service: 'ecs',
|
|
341
|
-
resourceType: 'alibaba.ecs.instance',
|
|
342
|
-
resourceId,
|
|
343
|
-
name: 'mock-ecs-instance',
|
|
344
|
-
tags: { ...DEFAULT_TAGS, owner: 'cloud-inventory' },
|
|
345
|
-
metadata: { source: 'cloud-inventory-mock' },
|
|
346
|
-
configuration: {
|
|
347
|
-
InstanceId: resourceId,
|
|
348
|
-
InstanceName: 'mock-ecs-instance',
|
|
349
|
-
InstanceType: 'ecs.t5-lc1m1.small',
|
|
350
|
-
RegionId: region,
|
|
351
|
-
Status: 'Running',
|
|
352
|
-
Tags: { Tag: [{ TagKey: 'environment', TagValue: 'mock' }] }
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
function cloudflareDefaults(driver) {
|
|
358
|
-
const accountId = driver.config.accountId || 'mock-cloudflare-account';
|
|
359
|
-
const resourceId = driver.config.resourceId || `cf-worker-${accountId.slice(-6) || 'mock'}`;
|
|
360
|
-
return {
|
|
361
|
-
provider: 'cloudflare',
|
|
362
|
-
driver: 'cloudflare',
|
|
363
|
-
accountId,
|
|
364
|
-
region: 'global',
|
|
365
|
-
service: 'workers',
|
|
366
|
-
resourceType: 'cloudflare.workers.script',
|
|
367
|
-
resourceId,
|
|
368
|
-
name: 'mock-worker-script',
|
|
369
|
-
tags: ['mock', 'cloud-inventory'],
|
|
370
|
-
metadata: { source: 'cloud-inventory-mock' },
|
|
371
|
-
configuration: {
|
|
372
|
-
id: resourceId,
|
|
373
|
-
script: 'mock-worker-script',
|
|
374
|
-
etag: 'mock-etag',
|
|
375
|
-
created_on: new Date().toISOString(),
|
|
376
|
-
modified_on: new Date().toISOString(),
|
|
377
|
-
tags: ['mock', 'cloud-inventory']
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
export class LinodeMockDriver extends MockCloudDriver {
|
|
383
|
-
constructor(options = {}) {
|
|
384
|
-
super(options, linodeDefaults);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
export class HetznerMockDriver extends MockCloudDriver {
|
|
389
|
-
constructor(options = {}) {
|
|
390
|
-
super(options, hetznerDefaults);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
export class AlibabaMockDriver extends MockCloudDriver {
|
|
395
|
-
constructor(options = {}) {
|
|
396
|
-
super(options, alibabaDefaults);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export class CloudflareMockDriver extends MockCloudDriver {
|
|
401
|
-
constructor(options = {}) {
|
|
402
|
-
super(options, cloudflareDefaults);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
function mongodbAtlasDefaults(driver) {
|
|
407
|
-
const organizationId = driver.config.organizationId || 'mock-atlas-org';
|
|
408
|
-
const projectId = driver.config.projectId || 'mock-atlas-project';
|
|
409
|
-
const resourceId = driver.config.resourceId || `cluster-${projectId.slice(-6) || 'mock'}`;
|
|
410
|
-
return {
|
|
411
|
-
provider: 'mongodb-atlas',
|
|
412
|
-
driver: 'mongodb-atlas',
|
|
413
|
-
accountId: organizationId,
|
|
414
|
-
region: 'US_EAST_1',
|
|
415
|
-
service: 'clusters',
|
|
416
|
-
resourceType: 'mongodb-atlas.cluster',
|
|
417
|
-
resourceId,
|
|
418
|
-
name: 'mock-atlas-cluster',
|
|
419
|
-
tags: { ...DEFAULT_TAGS, environment: 'development' },
|
|
420
|
-
metadata: {
|
|
421
|
-
source: 'cloud-inventory-mock',
|
|
422
|
-
projectId,
|
|
423
|
-
tier: 'M10',
|
|
424
|
-
provider: 'AWS',
|
|
425
|
-
mongoDBVersion: '7.0'
|
|
426
|
-
},
|
|
427
|
-
configuration: {
|
|
428
|
-
id: resourceId,
|
|
429
|
-
name: 'mock-atlas-cluster',
|
|
430
|
-
clusterType: 'REPLICASET',
|
|
431
|
-
stateName: 'IDLE',
|
|
432
|
-
mongoDBVersion: '7.0.2',
|
|
433
|
-
providerSettings: {
|
|
434
|
-
providerName: 'AWS',
|
|
435
|
-
regionName: 'US_EAST_1',
|
|
436
|
-
instanceSizeName: 'M10'
|
|
437
|
-
},
|
|
438
|
-
tags: { environment: 'development', owner: 'cloud-inventory' }
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
export class MongoDBAtlasMockDriver extends MockCloudDriver {
|
|
444
|
-
constructor(options = {}) {
|
|
445
|
-
super(options, mongodbAtlasDefaults);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
export default MockCloudDriver;
|