diff --git a/site/decodal-site/src/scripts/playground-examples.js b/site/decodal-site/src/scripts/playground-examples.js index 9e3859d..0c1cab9 100644 --- a/site/decodal-site/src/scripts/playground-examples.js +++ b/site/decodal-site/src/scripts/playground-examples.js @@ -5,33 +5,33 @@ export const playgroundExamples = [ activePath: 'main.dcdl', files: { 'main.dcdl': `let - schema = import "./schemas/service.dcdl"; - prod = import "./env/prod.dcdl"; - shared = import "./shared/tags.dcdl"; + schema = import "./schemas/service.dcdl"; + prod = import "./env/prod.dcdl"; + shared = import "./shared/tags.dcdl"; in - schema.Service & prod.ServicePatch & { - name = "api"; - image = "registry.example.com/api:2026-06-24"; - port = 9000 + 443; - public = prod.is_public && 9000 + 443 > 9000; - tags = shared.common ++ ["api", "edge"]; - } + schema.Service & prod.ServicePatch & { + name = "api"; + image = "registry.example.com/api:2026-06-24"; + port = 9000 + 443; + public = prod.is_public && 9000 + 443 > 9000; + tags = shared.common ++ ["api", "edge"]; + } `, 'schemas/service.dcdl': `Service = { - name = String; - image = String; - port = Int & > 443 default 8443; - replicas = Int & > 0 default 2; - public = Bool default false; - feature.metrics = Bool default true; - feature.tracing = Bool default false; + name = String; + image = String; + port = Int & > 443 default 8443; + replicas = Int & > 0 default 2; + public = Bool default false; + feature.metrics = Bool default true; + feature.tracing = Bool default false; }; `, 'env/prod.dcdl': `is_public = true; ServicePatch = { - replicas = 3; - feature.tracing = true; + replicas = 3; + feature.tracing = true; }; `, 'shared/tags.dcdl': `common = ["decodal", "prod"]; @@ -44,24 +44,24 @@ ServicePatch = { activePath: 'main.dcdl', files: { 'main.dcdl': `let - policy = import "./policy/base.dcdl"; - teams = import "./policy/teams.dcdl"; - env = "prod"; + policy = import "./policy/base.dcdl"; + teams = import "./policy/teams.dcdl"; + env = "prod"; in -{ - service = "payments"; - readers = policy.defaultReaders ++ teams.observability; - writers = policy.defaultWriters ++ teams.payments; - admins = match env { - "prod": policy.breakglassAdmins; - _: teams.platform; - }; - audit.required = env == "prod"; - audit.retention_days = match env { - "prod": 365; - _: 30; - }; -} + { + service = "payments"; + readers = policy.defaultReaders ++ teams.observability; + writers = policy.defaultWriters ++ teams.payments; + admins = match env { + "prod": policy.breakglassAdmins; + _: teams.platform; + }; + audit.required = env == "prod"; + audit.retention_days = match env { + "prod": 365; + _: 30; + }; + } `, 'policy/base.dcdl': `defaultReaders = ["group:engineering", "group:support"]; defaultWriters = ["group:platform"]; @@ -79,27 +79,27 @@ observability = ["group:observability"]; activePath: 'main.dcdl', files: { 'main.dcdl': `let - schema = import "./schemas/worker.dcdl"; - routes = import "./routes.dcdl"; - production = true; + schema = import "./schemas/worker.dcdl"; + routes = import "./routes.dcdl"; + production = true; in - schema.Worker & { - name = "decodal-docs"; - compatibility_date = "2026-06-15"; - workers_dev = !production; - route.host = routes.primary_host; - route.paths = routes.docs_paths ++ routes.playground_paths; - cache.ttl_seconds = 60 * 60; - cache.bypass = !production; - } + schema.Worker & { + name = "decodal-docs"; + compatibility_date = "2026-06-15"; + workers_dev = !production; + route.host = routes.primary_host; + route.paths = routes.docs_paths ++ routes.playground_paths; + cache.ttl_seconds = 60 * 60; + cache.bypass = !production; + } `, 'schemas/worker.dcdl': `Worker = { - name = String; - compatibility_date = String; - workers_dev = Bool default false; - route.host = String; - cache.ttl_seconds = Int & >= 0 default 300; - cache.bypass = Bool default false; + name = String; + compatibility_date = String; + workers_dev = Bool default false; + route.host = String; + cache.ttl_seconds = Int & >= 0 default 300; + cache.bypass = Bool default false; }; `, 'routes.dcdl': `primary_host = "decodal.example.com"; @@ -114,38 +114,38 @@ playground_paths = ["/playground/*"]; activePath: 'main.dcdl', files: { 'main.dcdl': `let - schema = import "./schemas/pipeline.dcdl"; - presets = import "./presets/batch.dcdl"; - env = "staging"; + schema = import "./schemas/pipeline.dcdl"; + presets = import "./presets/batch.dcdl"; + env = "staging"; in - schema.Pipeline & presets.Batch & { - name = "events-rollup"; - source.topic = "events.raw"; - sink.table = "analytics.events_daily"; - workers = match env { - "prod": 8; - "staging": 3; - _: 1; - }; - alerts.enabled = env != "dev"; - transforms = presets.standardTransforms ++ ["dedupe", "aggregate_daily"]; - } + schema.Pipeline & presets.Batch & { + name = "events-rollup"; + source.topic = "events.raw"; + sink.table = "analytics.events_daily"; + workers = match env { + "prod": 8; + "staging": 3; + _: 1; + }; + alerts.enabled = env != "dev"; + transforms = presets.standardTransforms ++ ["dedupe", "aggregate_daily"]; + } `, 'schemas/pipeline.dcdl': `Pipeline = { - name = String; - source.topic = String; - sink.table = String; - workers = Int & > 0 default 1; - batch.size = Int & >= 100 default 1000; - batch.timeout_seconds = Int & > 0 default 60; - alerts.enabled = Bool default false; + name = String; + source.topic = String; + sink.table = String; + workers = Int & > 0 default 1; + batch.size = Int & >= 100 default 1000; + batch.timeout_seconds = Int & > 0 default 60; + alerts.enabled = Bool default false; }; `, 'presets/batch.dcdl': `standardTransforms = ["parse_json", "validate_schema", "enrich_metadata"]; Batch = { - batch.size = 5000; - batch.timeout_seconds = 30 + 30; + batch.size = 5000; + batch.timeout_seconds = 30 + 30; }; `, }, @@ -156,17 +156,17 @@ Batch = { activePath: 'main.dcdl', files: { 'main.dcdl': `let - schema = import "./schemas/service.dcdl"; + schema = import "./schemas/service.dcdl"; in - schema.Service & { - name = "broken-api"; - port = 442; - } + schema.Service & { + name = "broken-api"; + port = 442; + } `, 'schemas/service.dcdl': `Service = { - name = String; - port = Int & > 443 default 8443; - replicas = Int & > 0 default 2; + name = String; + port = Int & > 443 default 8443; + replicas = Int & > 0 default 2; }; `, },