diff --git a/cli/src/main/java/io/aklivity/zillabase/cli/config/ZillabaseZillaConfig.java b/cli/src/main/java/io/aklivity/zillabase/cli/config/ZillabaseZillaConfig.java index dcb7ef6d..c2b49d4e 100644 --- a/cli/src/main/java/io/aklivity/zillabase/cli/config/ZillabaseZillaConfig.java +++ b/cli/src/main/java/io/aklivity/zillabase/cli/config/ZillabaseZillaConfig.java @@ -18,7 +18,7 @@ public class ZillabaseZillaConfig { - public static final String DEFAULT_ZILLA_TAG = "0.9.105"; + public static final String DEFAULT_ZILLA_TAG = "0.9.112"; private static final List DEFAULT_PORT_LIST = List.of( new ZillabaseZillaPortConfig() diff --git a/cli/src/main/java/io/aklivity/zillabase/cli/internal/commands/start/ZillabaseStartCommand.java b/cli/src/main/java/io/aklivity/zillabase/cli/internal/commands/start/ZillabaseStartCommand.java index 0dc74eef..c2872e08 100644 --- a/cli/src/main/java/io/aklivity/zillabase/cli/internal/commands/start/ZillabaseStartCommand.java +++ b/cli/src/main/java/io/aklivity/zillabase/cli/internal/commands/start/ZillabaseStartCommand.java @@ -176,7 +176,7 @@ public final class ZillabaseStartCommand extends ZillabaseDockerCommand { private static final int SERVICE_INITIALIZATION_DELAY_MS = 5000; private static final int MAX_RETRIES = 5; - private static final Pattern TOPIC_PATTERN = Pattern.compile("(^|-|_)(.)"); + private static final Pattern TOPIC_PATTERN = Pattern.compile("(\\w+)\\.(\\w+)"); private static final String DEFAULT_KEYCLOAK_ADMIN_CREDENTIAL = "admin"; private static final String ADMIN_REALMS_PATH = "/admin/realms"; private static final String ADMIN_REALMS_CLIENTS_PATH = "/admin/realms/%s/clients"; @@ -1528,13 +1528,15 @@ private String generateHttpAsyncApiSpecs( JsonObject channelsJson = jsonValue.asJsonObject().getJsonObject("channels"); for (Map.Entry channelJson : channelsJson.entrySet()) { - String name = channelJson.getKey(); - if (name.endsWith("_replies")) + String channelName = channelJson.getKey(); + if (channelName.endsWith("_replies")) { continue; } - String label = matcher.reset(name).replaceAll(match -> match.group(2).toUpperCase()); + String name = matcher.reset(channelName).replaceFirst(match -> match.group(2)); + String label = name.toUpperCase(); + if (secure) { String scope = label.toLowerCase(); diff --git a/examples/petstore/zillabase/migrations/000000__create_tables.sql b/examples/petstore/zillabase/migrations/000000__create_tables.sql index 2d2dec14..bd5cf7bd 100644 --- a/examples/petstore/zillabase/migrations/000000__create_tables.sql +++ b/examples/petstore/zillabase/migrations/000000__create_tables.sql @@ -1,18 +1,18 @@ -- create_tables -CREATE TABLE petstore_pets( +CREATE ZTABLE petstore_pets( id VARCHAR, breed VARCHAR, PRIMARY KEY (id) ); -CREATE TABLE petstore_customers( +CREATE ZTABLE petstore_customers( name VARCHAR, status VARCHAR, PRIMARY KEY (name) ); -CREATE TABLE petstore_verified_customers( +CREATE ZTABLE petstore_verified_customers( id VARCHAR, points VARCHAR, PRIMARY KEY (id) diff --git a/examples/streampay/zillabase/migrations/000000__create_users.sql b/examples/streampay/zillabase/migrations/000000__create_users.sql index d0d6b1b3..0a74b9fe 100644 --- a/examples/streampay/zillabase/migrations/000000__create_users.sql +++ b/examples/streampay/zillabase/migrations/000000__create_users.sql @@ -6,9 +6,8 @@ A Table creates the topic and CRUD APIs to insert and query data. A Stream creates the topic and CRUD APIs to produce and fetch data. */ - -- A table to store user data -CREATE TABLE streampay_users( +CREATE ZTABLE streampay_users( id VARCHAR, name VARCHAR, username VARCHAR, diff --git a/examples/streampay/zillabase/migrations/000001__create_commands_and_replies.sql b/examples/streampay/zillabase/migrations/000001__create_commands_and_replies.sql index 2eb86b28..98ca9044 100644 --- a/examples/streampay/zillabase/migrations/000001__create_commands_and_replies.sql +++ b/examples/streampay/zillabase/migrations/000001__create_commands_and_replies.sql @@ -12,7 +12,7 @@ CREATE STREAM streampay_commands( zilla_timestamp TIMESTAMP ); -CREATE MATERIALIZED VIEW IF NOT EXISTS streampay_replies AS +CREATE ZVIEW IF NOT EXISTS streampay_replies AS SELECT '400' AS status, encode(zilla_correlation_id, 'escape') AS correlation_id from streampay_commands where type NOT IN ('SendPayment', 'RequestPayment', 'RejectRequest') UNION SELECT '200' AS status, encode(zilla_correlation_id, 'escape') AS correlation_id from streampay_commands where type IN ('SendPayment', 'RequestPayment', 'RejectRequest'); diff --git a/examples/streampay/zillabase/migrations/000002__create_balances.sql b/examples/streampay/zillabase/migrations/000002__create_balances.sql index 0f7310b7..2d3f5235 100644 --- a/examples/streampay/zillabase/migrations/000002__create_balances.sql +++ b/examples/streampay/zillabase/migrations/000002__create_balances.sql @@ -31,7 +31,7 @@ CREATE VIEW all_user_transactions AS FROM user_transactions; -CREATE MATERIALIZED VIEW streampay_balances AS +CREATE ZVIEW streampay_balances AS SELECT user_id, SUM(net_amount) AS balance diff --git a/examples/streampay/zillabase/migrations/000004__create_activities.sql b/examples/streampay/zillabase/migrations/000004__create_activities.sql index 8dc87531..ebf8bcda 100644 --- a/examples/streampay/zillabase/migrations/000004__create_activities.sql +++ b/examples/streampay/zillabase/migrations/000004__create_activities.sql @@ -1,6 +1,6 @@ -- create_activities -CREATE MATERIALIZED VIEW streampay_activities AS +CREATE ZVIEW streampay_activities AS SELECT generate_unique_id()::varchar AS id, 'PaymentSent' AS eventName, @@ -48,18 +48,3 @@ CREATE MATERIALIZED VIEW streampay_activities AS LEFT JOIN streampay_users tu ON sc.user_id = tu.id WHERE sc.type = 'RequestPayment'; - SELECT - generate_unique_id()::varchar AS id, - 'PaymentRejected' AS eventName, - encode(sc.zilla_identity, 'escape') AS from_user_id, - fu.username AS from_username, - sc.user_id AS to_user_id, - tu.username AS to_username, - sc.amount, - CAST(extract(epoch FROM sc.zilla_timestamp) AS FLOAT) * 1000 AS timestamp - FROM - streampay_commands sc - LEFT JOIN streampay_users fu ON encode(sc.zilla_identity, 'escape') = fu.id - LEFT JOIN streampay_users tu ON sc.user_id = tu.id - WHERE - sc.type = 'RejectRequest'; diff --git a/examples/streampay/zillabase/migrations/000005__create_payment_requests.sql b/examples/streampay/zillabase/migrations/000005__create_payment_requests.sql index 104c51ae..8234f4fd 100644 --- a/examples/streampay/zillabase/migrations/000005__create_payment_requests.sql +++ b/examples/streampay/zillabase/migrations/000005__create_payment_requests.sql @@ -35,7 +35,7 @@ CREATE VIEW status_updates AS sc.type IN ('SendPayment', 'RejectRequest') AND (sc.request_id IS NOT NULL AND sc.request_id <> ''); -CREATE MATERIALIZED VIEW streampay_payment_requests AS +CREATE ZVIEW streampay_payment_requests AS SELECT rp.id, rp.from_user_id, diff --git a/examples/streampay/zillabase/migrations/000006__create_payment_risk_assessment.sql b/examples/streampay/zillabase/migrations/000006__create_payment_risk_assessment.sql index b36fb01f..50a1efe9 100644 --- a/examples/streampay/zillabase/migrations/000006__create_payment_risk_assessment.sql +++ b/examples/streampay/zillabase/migrations/000006__create_payment_risk_assessment.sql @@ -4,7 +4,7 @@ CREATE FUNCTION assess_fraud(varchar, varchar, double precision) RETURNS struct LANGUAGE python AS 'assess_fraud'; -CREATE MATERIALIZED VIEW streampay_payment_risk_assessment AS +CREATE ZVIEW streampay_payment_risk_assessment AS SELECT ar.id, ar.to_user_id_identity,