Skip to content

Commit

Permalink
Use Machine
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Feb 16, 2024
1 parent 6bdcf7c commit beb8896
Show file tree
Hide file tree
Showing 28 changed files with 79 additions and 69 deletions.
8 changes: 6 additions & 2 deletions api/lib/connection-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import Modeler from '@openaddresses/batch-generic';
import { Connection } from './schema.js';
import { InferSelectModel } from 'drizzle-orm';
import sleep from './sleep.js';
import ConnectionConfig from './connection-config.js';
import ConnectionConfig, {
MachineConnConfig
}from './connection-config.js';

export class ConnectionClient {
config: ConnectionConfig;
Expand Down Expand Up @@ -68,8 +70,10 @@ export default class ConnectionPool extends Map<number | string, ConnectionClien
return new Promise((resolve, reject) => {
stream.on('data', async (conn: InferSelectModel<typeof Connection>) => {
if (conn.enabled && !this.config.local) {
conns.push(this.add(conn));
conns.push(this.add(new MachineConnConfig(conn)));
}
}).on('error', (err) => {
return reject(err);
}).on('end', async () => {
try {
await Promise.all(conns);
Expand Down
8 changes: 4 additions & 4 deletions api/schema/connection_sinks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"updated": {
"$ref": "./connection_sinks/updated.json"
},
"name": {
"$ref": "./connection_sinks/name.json"
},
"enabled": {
"$ref": "./connection_sinks/enabled.json"
},
"connection": {
"$ref": "./connection_sinks/connection.json"
},
"name": {
"$ref": "./connection_sinks/name.json"
},
"type": {
"$ref": "./connection_sinks/type.json"
},
Expand All @@ -34,9 +34,9 @@
"id",
"created",
"updated",
"name",
"enabled",
"connection",
"name",
"type",
"body",
"logging"
Expand Down
2 changes: 1 addition & 1 deletion api/schema/connections/auth.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "object",
"description": "",
"description": "Authentication settings for the connection",
"$comment": "json"
}
2 changes: 1 addition & 1 deletion api/schema/connections/created.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "string",
"description": "",
"description": "Creation TimeStamp",
"$comment": "timestamptz",
"format": "date-time"
}
2 changes: 1 addition & 1 deletion api/schema/connections/description.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "string",
"description": "",
"description": "Human readable description",
"$comment": "text"
}
2 changes: 1 addition & 1 deletion api/schema/connections/enabled.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "boolean",
"description": "",
"description": "Is the connection passing CoT messages from layers",
"$comment": "bool"
}
2 changes: 1 addition & 1 deletion api/schema/connections/id.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "number",
"description": "",
"description": "Unique Connection ID",
"$comment": "int4"
}
2 changes: 1 addition & 1 deletion api/schema/connections/name.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "string",
"description": "",
"description": "Unique human readable name",
"$comment": "text"
}
2 changes: 1 addition & 1 deletion api/schema/connections/updated.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "string",
"description": "",
"description": "Updated TimeStamp",
"$comment": "timestamptz",
"format": "date-time"
}
32 changes: 16 additions & 16 deletions api/schema/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"$ref": "./icons/id.json"
},
"created": {
"$ref": "./icons/created.json"
},
"updated": {
"$ref": "./icons/updated.json"
"iconset": {
"$ref": "./icons/iconset.json"
},
"name": {
"$ref": "./icons/name.json"
},
"iconset": {
"$ref": "./icons/iconset.json"
},
"type2525b": {
"$ref": "./icons/type2525b.json"
},
"created": {
"$ref": "./icons/created.json"
},
"updated": {
"$ref": "./icons/updated.json"
},
"data": {
"$ref": "./icons/data.json"
},
"path": {
"$ref": "./icons/path.json"
},
"id": {
"$ref": "./icons/id.json"
}
},
"required": [
"id",
"created",
"updated",
"name",
"iconset",
"name",
"type2525b",
"created",
"updated",
"data",
"path"
"path",
"id"
]
}
18 changes: 9 additions & 9 deletions api/schema/iconsets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
"uid": {
"$ref": "./iconsets/uid.json"
},
"created": {
"$ref": "./iconsets/created.json"
},
"updated": {
"$ref": "./iconsets/updated.json"
},
"version": {
"$ref": "./iconsets/version.json"
},
Expand All @@ -34,19 +28,25 @@
},
"skip_resize": {
"$ref": "./iconsets/skip_resize.json"
},
"created": {
"$ref": "./iconsets/created.json"
},
"updated": {
"$ref": "./iconsets/updated.json"
}
},
"required": [
"uid",
"created",
"updated",
"version",
"name",
"default_group",
"default_friendly",
"default_hostile",
"default_neutral",
"default_unknown",
"skip_resize"
"skip_resize",
"created",
"updated"
]
}
18 changes: 9 additions & 9 deletions api/schema/imports.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
"updated": {
"$ref": "./imports/updated.json"
},
"name": {
"$ref": "./imports/name.json"
},
"status": {
"$ref": "./imports/status.json"
},
Expand All @@ -23,30 +20,33 @@
"result": {
"$ref": "./imports/result.json"
},
"name": {
"$ref": "./imports/name.json"
},
"username": {
"$ref": "./imports/username.json"
},
"mode": {
"$ref": "./imports/mode.json"
},
"mode_id": {
"$ref": "./imports/mode_id.json"
},
"config": {
"$ref": "./imports/config.json"
},
"mode_id": {
"$ref": "./imports/mode_id.json"
}
},
"required": [
"id",
"created",
"updated",
"name",
"status",
"error",
"result",
"name",
"username",
"mode",
"mode_id",
"config"
"config",
"mode_id"
]
}
2 changes: 1 addition & 1 deletion api/schema/layer_alerts/layer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "number",
"description": "",
"$comment": "int4"
"$comment": "int8"
}
8 changes: 4 additions & 4 deletions api/schema/layers.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"id": {
"$ref": "./layers/id.json"
},
"name": {
"$ref": "./layers/name.json"
},
"created": {
"$ref": "./layers/created.json"
},
"updated": {
"$ref": "./layers/updated.json"
},
"name": {
"$ref": "./layers/name.json"
},
"description": {
"$ref": "./layers/description.json"
},
Expand Down Expand Up @@ -59,9 +59,9 @@
},
"required": [
"id",
"name",
"created",
"updated",
"name",
"description",
"enabled",
"enabled_styles",
Expand Down
5 changes: 4 additions & 1 deletion api/schema/layers/connection.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"type": "number",
"type": [
"number",
"null"
],
"description": "",
"$comment": "int4"
}
2 changes: 1 addition & 1 deletion api/schema/layers/created.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "string",
"description": "",
"description": "Creation TimeStamp",
"$comment": "timestamptz",
"format": "date-time"
}
5 changes: 1 addition & 4 deletions api/schema/layers/cron.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"type": [
"string",
"null"
],
"type": "string",
"description": "",
"$comment": "text"
}
5 changes: 4 additions & 1 deletion api/schema/layers/data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"type": "number",
"type": [
"number",
"null"
],
"description": "",
"$comment": "int4"
}
2 changes: 1 addition & 1 deletion api/schema/layers/description.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "string",
"description": "",
"description": "Human readable description",
"$comment": "text"
}
2 changes: 1 addition & 1 deletion api/schema/layers/enabled.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "boolean",
"description": "",
"description": "Is the layer passing CoT messages",
"$comment": "bool"
}
2 changes: 1 addition & 1 deletion api/schema/layers/enabled_styles.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "boolean",
"description": "",
"description": "Is styling enabled for the layer",
"$comment": "bool"
}
2 changes: 1 addition & 1 deletion api/schema/layers/id.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "number",
"description": "",
"description": "Unique Layer ID",
"$comment": "int4"
}
2 changes: 1 addition & 1 deletion api/schema/layers/name.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "string",
"description": "",
"description": "Unique human readable name",
"$comment": "text"
}
2 changes: 1 addition & 1 deletion api/schema/layers/styles.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "object",
"description": "",
"description": "Styling rules for the layer",
"$comment": "json"
}
2 changes: 1 addition & 1 deletion api/schema/layers/updated.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "string",
"description": "",
"description": "Updated TimeStamp",
"$comment": "timestamptz",
"format": "date-time"
}
Loading

0 comments on commit beb8896

Please sign in to comment.