zooid 0.1.1 → 0.2.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/dist/index.js +28 -6
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -465,7 +465,7 @@ async function runChannelCreate(id, options, client) {
|
|
|
465
465
|
description: options.description,
|
|
466
466
|
is_public: options.public ?? true,
|
|
467
467
|
strict: options.strict,
|
|
468
|
-
|
|
468
|
+
config: options.config
|
|
469
469
|
});
|
|
470
470
|
if (!client) {
|
|
471
471
|
const config = loadConfig();
|
|
@@ -1499,7 +1499,10 @@ async function runDeploy() {
|
|
|
1499
1499
|
);
|
|
1500
1500
|
printSuccess("Schema up to date");
|
|
1501
1501
|
}
|
|
1502
|
-
const migrations = [
|
|
1502
|
+
const migrations = [
|
|
1503
|
+
"ALTER TABLE events ADD COLUMN publisher_name TEXT",
|
|
1504
|
+
"ALTER TABLE channels ADD COLUMN config TEXT"
|
|
1505
|
+
];
|
|
1503
1506
|
for (const sql of migrations) {
|
|
1504
1507
|
try {
|
|
1505
1508
|
wrangler(
|
|
@@ -1510,6 +1513,15 @@ async function runDeploy() {
|
|
|
1510
1513
|
} catch {
|
|
1511
1514
|
}
|
|
1512
1515
|
}
|
|
1516
|
+
try {
|
|
1517
|
+
const dataMigrationSql = `UPDATE channels SET config = json_object('types', (SELECT json_group_object(key, json_object('schema', json_each.value)) FROM json_each(schema))) WHERE schema IS NOT NULL AND config IS NULL`;
|
|
1518
|
+
wrangler(
|
|
1519
|
+
`d1 execute ${dbName} --remote --command="${dataMigrationSql}"`,
|
|
1520
|
+
stagingDir,
|
|
1521
|
+
creds
|
|
1522
|
+
);
|
|
1523
|
+
} catch {
|
|
1524
|
+
}
|
|
1513
1525
|
try {
|
|
1514
1526
|
const keysOutput = wrangler(
|
|
1515
1527
|
`d1 execute ${dbName} --remote --json --command="SELECT kid FROM trusted_keys WHERE issuer = 'local' LIMIT 1"`,
|
|
@@ -1790,18 +1802,23 @@ channelCmd.command("create <id>").description("Create a new channel").option("--
|
|
|
1790
1802
|
"Path to JSON schema file (map of event types to JSON schemas)"
|
|
1791
1803
|
).action(async (id, opts) => {
|
|
1792
1804
|
try {
|
|
1793
|
-
let
|
|
1805
|
+
let config;
|
|
1794
1806
|
if (opts.schema) {
|
|
1795
1807
|
const fs7 = await import("fs");
|
|
1796
1808
|
const raw = fs7.readFileSync(opts.schema, "utf-8");
|
|
1797
|
-
|
|
1809
|
+
const parsed = JSON.parse(raw);
|
|
1810
|
+
const types = {};
|
|
1811
|
+
for (const [eventType, schemaDef] of Object.entries(parsed)) {
|
|
1812
|
+
types[eventType] = { schema: schemaDef };
|
|
1813
|
+
}
|
|
1814
|
+
config = { types };
|
|
1798
1815
|
}
|
|
1799
1816
|
const result = await runChannelCreate(id, {
|
|
1800
1817
|
name: opts.name,
|
|
1801
1818
|
description: opts.description,
|
|
1802
1819
|
public: opts.private ? false : true,
|
|
1803
1820
|
strict: opts.strict,
|
|
1804
|
-
|
|
1821
|
+
config
|
|
1805
1822
|
});
|
|
1806
1823
|
printSuccess(`Created channel: ${id}`);
|
|
1807
1824
|
printInfo("Publish token", result.publish_token);
|
|
@@ -1825,7 +1842,12 @@ channelCmd.command("update <id>").description("Update a channel").option("--name
|
|
|
1825
1842
|
if (opts.schema) {
|
|
1826
1843
|
const fs7 = await import("fs");
|
|
1827
1844
|
const raw = fs7.readFileSync(opts.schema, "utf-8");
|
|
1828
|
-
|
|
1845
|
+
const parsed = JSON.parse(raw);
|
|
1846
|
+
const types = {};
|
|
1847
|
+
for (const [eventType, schemaDef] of Object.entries(parsed)) {
|
|
1848
|
+
types[eventType] = { schema: schemaDef };
|
|
1849
|
+
}
|
|
1850
|
+
fields.config = { types };
|
|
1829
1851
|
}
|
|
1830
1852
|
if (opts.strict !== void 0) fields.strict = opts.strict;
|
|
1831
1853
|
if (Object.keys(fields).length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zooid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Open-source pub/sub server for AI agents. Publish signals, subscribe via webhook, WebSocket, polling, or RSS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@inquirer/checkbox": "^5.0.7",
|
|
26
26
|
"commander": "^14.0.3",
|
|
27
|
-
"@zooid/sdk": "^0.
|
|
28
|
-
"@zooid/
|
|
29
|
-
"@zooid/
|
|
27
|
+
"@zooid/sdk": "^0.2.0",
|
|
28
|
+
"@zooid/server": "^0.2.0",
|
|
29
|
+
"@zooid/types": "^0.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@cloudflare/vitest-pool-workers": "^0.8.34",
|