grafana / cog

Code Generation with a human touch
Apache License 2.0
48 stars 2 forks source link

Always trigger a release in foundation-sdk when a package file is modified #545

Closed K-Phoen closed 2 months ago

K-Phoen commented 2 months ago

Should help with #534

github-actions[bot] commented 2 months ago

Note: in addition to the changes introduced by this PR, the diff includes unreleased changes living in main.

### 🔎 Changes to `grafana-foundation-sdk@next+cog-v0.0.x` ```patch diff --git a/.github/workflows/java-release.yaml b/.github/workflows/java-release.yaml index 766ded7..8df83a9 100644 --- a/.github/workflows/java-release.yaml +++ b/.github/workflows/java-release.yaml @@ -5,6 +5,7 @@ on: pull_request_target: types: [ closed ] paths: + - 'java/gradle.properties' - 'java/src/**' env: diff --git a/.github/workflows/python-release.yaml b/.github/workflows/python-release.yaml index 1413f67..b2974ac 100644 --- a/.github/workflows/python-release.yaml +++ b/.github/workflows/python-release.yaml @@ -5,6 +5,7 @@ on: pull_request_target: types: [ closed ] paths: + - 'python/pyproject.toml' - 'python/grafana_foundation_sdk/**' env: diff --git a/.github/workflows/typescript-release.yaml b/.github/workflows/typescript-release.yaml index fd065bf..b5d29dc 100644 --- a/.github/workflows/typescript-release.yaml +++ b/.github/workflows/typescript-release.yaml @@ -5,6 +5,7 @@ on: pull_request_target: types: [closed] paths: + - 'typescript/package.json' - 'typescript/src/**' env: diff --git a/java/gradle.properties b/java/gradle.properties index 68bbabc..9ba642b 100644 --- a/java/gradle.properties +++ b/java/gradle.properties @@ -1 +1 @@ -grafanaFoundationSDKVersion=next-1725620594 +grafanaFoundationSDKVersion=next-1726135831 diff --git a/php/src/Azuremonitor/AzureMonitorQuery.php b/php/src/Azuremonitor/AzureMonitorQuery.php index 819dbef..de10233 100644 --- a/php/src/Azuremonitor/AzureMonitorQuery.php +++ b/php/src/Azuremonitor/AzureMonitorQuery.php @@ -159,26 +159,26 @@ class AzureMonitorQuery implements \JsonSerializable, \Grafana\Foundation\Cog\Da \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["kind"]) { - case "MetricNamespaceQuery": - return MetricNamespaceQuery::fromArray($input); + case "AppInsightsGroupByQuery": + return AppInsightsGroupByQuery::fromArray($input); + case "AppInsightsMetricNameQuery": + return AppInsightsMetricNameQuery::fromArray($input); + case "MetricDefinitionsQuery": + return MetricDefinitionsQuery::fromArray($input); case "MetricNamesQuery": return MetricNamesQuery::fromArray($input); - case "UnknownQuery": - return UnknownQuery::fromArray($input); + case "MetricNamespaceQuery": + return MetricNamespaceQuery::fromArray($input); case "ResourceGroupsQuery": return ResourceGroupsQuery::fromArray($input); - case "AppInsightsGroupByQuery": - return AppInsightsGroupByQuery::fromArray($input); - case "SubscriptionsQuery": - return SubscriptionsQuery::fromArray($input); case "ResourceNamesQuery": return ResourceNamesQuery::fromArray($input); - case "MetricDefinitionsQuery": - return MetricDefinitionsQuery::fromArray($input); + case "SubscriptionsQuery": + return SubscriptionsQuery::fromArray($input); + case "UnknownQuery": + return UnknownQuery::fromArray($input); case "WorkspacesQuery": return WorkspacesQuery::fromArray($input); - case "AppInsightsMetricNameQuery": - return AppInsightsMetricNameQuery::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } diff --git a/php/src/Cloudwatch/QueryEditorArrayExpression.php b/php/src/Cloudwatch/QueryEditorArrayExpression.php index 3a87b04..54a9ee2 100644 --- a/php/src/Cloudwatch/QueryEditorArrayExpression.php +++ b/php/src/Cloudwatch/QueryEditorArrayExpression.php @@ -34,20 +34,20 @@ class QueryEditorArrayExpression implements \JsonSerializable \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["type"]) { - case "operator": - return QueryEditorOperatorExpression::fromArray($input); case "and": return QueryEditorArrayExpression::fromArray($input); - case "or": - return QueryEditorArrayExpression::fromArray($input); - case "property": - return QueryEditorPropertyExpression::fromArray($input); - case "groupBy": - return QueryEditorGroupByExpression::fromArray($input); case "function": return QueryEditorFunctionExpression::fromArray($input); case "functionParameter": return QueryEditorFunctionParameterExpression::fromArray($input); + case "groupBy": + return QueryEditorGroupByExpression::fromArray($input); + case "operator": + return QueryEditorOperatorExpression::fromArray($input); + case "or": + return QueryEditorArrayExpression::fromArray($input); + case "property": + return QueryEditorPropertyExpression::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } diff --git a/php/src/Cloudwatch/SQLExpression.php b/php/src/Cloudwatch/SQLExpression.php index 2fb8653..88380e3 100644 --- a/php/src/Cloudwatch/SQLExpression.php +++ b/php/src/Cloudwatch/SQLExpression.php @@ -77,10 +77,10 @@ class SQLExpression implements \JsonSerializable \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["type"]) { - case "property": - return QueryEditorPropertyExpression::fromArray($input); case "function": return QueryEditorFunctionExpression::fromArray($input); + case "property": + return QueryEditorPropertyExpression::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } diff --git a/php/src/Cloudwatch/VariantConfig.php b/php/src/Cloudwatch/VariantConfig.php index 54991a9..e25091d 100644 --- a/php/src/Cloudwatch/VariantConfig.php +++ b/php/src/Cloudwatch/VariantConfig.php @@ -12,12 +12,12 @@ final class VariantConfig \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["queryMode"]) { - case "Metrics": - return CloudWatchMetricsQuery::fromArray($input); - case "Logs": - return CloudWatchLogsQuery::fromArray($input); case "Annotations": return CloudWatchAnnotationQuery::fromArray($input); + case "Logs": + return CloudWatchLogsQuery::fromArray($input); + case "Metrics": + return CloudWatchMetricsQuery::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } diff --git a/php/src/Common/TableFieldOptions.php b/php/src/Common/TableFieldOptions.php index a4cae59..46af2a5 100644 --- a/php/src/Common/TableFieldOptions.php +++ b/php/src/Common/TableFieldOptions.php @@ -78,22 +78,22 @@ class TableFieldOptions implements \JsonSerializable \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["type"]) { - case "sparkline": - return TableSparklineCellOptions::fromArray($input); - case "gauge": - return TableBarGaugeCellOptions::fromArray($input); + case "auto": + return TableAutoCellOptions::fromArray($input); case "color-background": return TableColoredBackgroundCellOptions::fromArray($input); case "color-text": return TableColorTextCellOptions::fromArray($input); - case "image": - return TableImageCellOptions::fromArray($input); case "data-links": return TableDataLinksCellOptions::fromArray($input); + case "gauge": + return TableBarGaugeCellOptions::fromArray($input); + case "image": + return TableImageCellOptions::fromArray($input); case "json-view": return TableJsonViewCellOptions::fromArray($input); - case "auto": - return TableAutoCellOptions::fromArray($input); + case "sparkline": + return TableSparklineCellOptions::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } diff --git a/php/src/Dashboard/FieldConfig.php b/php/src/Dashboard/FieldConfig.php index a02d949..596a155 100644 --- a/php/src/Dashboard/FieldConfig.php +++ b/php/src/Dashboard/FieldConfig.php @@ -170,14 +170,14 @@ class FieldConfig implements \JsonSerializable \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["type"]) { + case "range": + return RangeMap::fromArray($input); case "regex": return RegexMap::fromArray($input); case "special": return SpecialValueMap::fromArray($input); case "value": return ValueMap::fromArray($input); - case "range": - return RangeMap::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } diff --git a/php/src/Elasticsearch/Dataquery.php b/php/src/Elasticsearch/Dataquery.php index e3dd120..a97256e 100644 --- a/php/src/Elasticsearch/Dataquery.php +++ b/php/src/Elasticsearch/Dataquery.php @@ -97,18 +97,18 @@ class Dataquery implements \JsonSerializable, \Grafana\Foundation\Cog\Dataquery \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["type"]) { - case "histogram": - return Histogram::fromArray($input); - case "terms": - return Terms::fromArray($input); + case "date_histogram": + return DateHistogram::fromArray($input); case "filters": return Filters::fromArray($input); case "geohash_grid": return GeoHashGrid::fromArray($input); + case "histogram": + return Histogram::fromArray($input); case "nested": return Nested::fromArray($input); - case "date_histogram": - return DateHistogram::fromArray($input); + case "terms": + return Terms::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } @@ -117,44 +117,44 @@ class Dataquery implements \JsonSerializable, \Grafana\Foundation\Cog\Dataquery \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["type"]) { - case "percentiles": - return Percentiles::fromArray($input); + case "avg": + return Average::fromArray($input); + case "bucket_script": + return BucketScript::fromArray($input); + case "cardinality": + return UniqueCount::fromArray($input); + case "count": + return Count::fromArray($input); case "cumulative_sum": return CumulativeSum::fromArray($input); + case "derivative": + return Derivative::fromArray($input); case "extended_stats": return ExtendedStats::fromArray($input); - case "sum": - return Sum::fromArray($input); - case "count": - return Count::fromArray($input); - case "rate": - return Rate::fromArray($input); - case "bucket_script": - return BucketScript::fromArray($input); - case "moving_fn": - return MovingFunction::fromArray($input); case "logs": return Logs::fromArray($input); - case "top_metrics": - return TopMetrics::fromArray($input); - case "serial_diff": - return SerialDiff::fromArray($input); - case "min": - return Min::fromArray($input); - case "derivative": - return Derivative::fromArray($input); case "max": return Max::fromArray($input); - case "avg": - return Average::fromArray($input); + case "min": + return Min::fromArray($input); + case "moving_avg": + return MovingAverage::fromArray($input); + case "moving_fn": + return MovingFunction::fromArray($input); + case "percentiles": + return Percentiles::fromArray($input); + case "rate": + return Rate::fromArray($input); case "raw_data": return RawData::fromArray($input); case "raw_document": return RawDocument::fromArray($input); - case "cardinality": - return UniqueCount::fromArray($input); - case "moving_avg": - return MovingAverage::fromArray($input); + case "serial_diff": + return SerialDiff::fromArray($input); + case "sum": + return Sum::fromArray($input); + case "top_metrics": + return TopMetrics::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } diff --git a/php/src/Expr/VariantConfig.php b/php/src/Expr/VariantConfig.php index 9ca27eb..565348f 100644 --- a/php/src/Expr/VariantConfig.php +++ b/php/src/Expr/VariantConfig.php @@ -12,18 +12,18 @@ final class VariantConfig \assert(is_array($input), 'expected disjunction value to be an array'); switch ($input["type"]) { + case "classic_conditions": + return TypeClassicConditions::fromArray($input); + case "math": + return TypeMath::fromArray($input); case "reduce": return TypeReduce::fromArray($input); case "resample": return TypeResample::fromArray($input); - case "classic_conditions": - return TypeClassicConditions::fromArray($input); - case "threshold": - return TypeThreshold::fromArray($input); case "sql": return TypeSql::fromArray($input); - case "math": - return TypeMath::fromArray($input); + case "threshold": + return TypeThreshold::fromArray($input); default: throw new \ValueError('can not parse disjunction from array'); } diff --git a/python/grafana_foundation_sdk/cog/plugins.py b/python/grafana_foundation_sdk/cog/plugins.py index 039c61c..16832aa 100644 --- a/python/grafana_foundation_sdk/cog/plugins.py +++ b/python/grafana_foundation_sdk/cog/plugins.py @@ -1,39 +1,39 @@ # Code generated - EDITING IS FUTILE. DO NOT EDIT. -from ..models import grafanapyroscope +from ..models import loki from ..models import piechart -from ..models import table -from ..models import statetimeline -from ..models import stat from ..models import tempo -from ..models import expr -from ..models import candlestick -from ..models import logs -from ..models import debug +from ..models import prometheus +from ..models import barchart +from ..models import cloudwatch +from ..models import dashboardlist from ..models import gauge -from ..models import news +from ..models import heatmap from ..models import nodegraph from ..models import statushistory -from ..models import prometheus -from ..models import dashboardlist -from ..models import timeseries -from ..models import xychart from ..models import annotationslist -from ..models import histogram +from ..models import azuremonitor from ..models import canvas +from ..models import googlecloudmonitoring +from ..models import xychart from ..models import geomap -from ..models import text +from ..models import statetimeline +from ..models import news +from ..models import elasticsearch +from ..models import timeseries +from ..models import bargauge +from ..models import candlestick +from ..models import table from ..models import trend -from ..models import azuremonitor -from ..models import barchart -from ..models import loki -from ..models import parca +from ..models import expr from ..models import datagrid -from ..models import bargauge -from ..models import cloudwatch -from ..models import elasticsearch -from ..models import googlecloudmonitoring -from ..models import heatmap +from ..models import logs +from ..models import grafanapyroscope +from ..models import histogram +from ..models import parca +from ..models import stat +from ..models import text +from ..models import debug from . import runtime as cogruntime diff --git a/python/grafana_foundation_sdk/models/cloudwatch.py b/python/grafana_foundation_sdk/models/cloudwatch.py index 799f88e..7f94561 100644 --- a/python/grafana_foundation_sdk/models/cloudwatch.py +++ b/python/grafana_foundation_sdk/models/cloudwatch.py @@ -332,7 +332,7 @@ class SQLExpression: if "select" in data: args["select"] = QueryEditorFunctionExpression.from_json(data["select"]) if "from" in data: - decoding_map: dict[str, typing.Union[typing.Type[QueryEditorPropertyExpression], typing.Type[QueryEditorFunctionExpression]]] = {"property": QueryEditorPropertyExpression, "function": QueryEditorFunctionExpression} + decoding_map: dict[str, typing.Union[typing.Type[QueryEditorFunctionExpression], typing.Type[QueryEditorPropertyExpression]]] = {"function": QueryEditorFunctionExpression, "property": QueryEditorPropertyExpression} args["from_val"] = decoding_map[data["from"]["type"]].from_json(data["from"]) if "where" in data: args["where"] = QueryEditorArrayExpression.from_json(data["where"]) @@ -894,7 +894,7 @@ CloudWatchQuery: typing.TypeAlias = typing.Union['CloudWatchMetricsQuery', 'Clou def variant_config() -> cogruntime.DataqueryConfig: - decoding_map: dict[str, typing.Union[typing.Type[CloudWatchMetricsQuery], typing.Type[CloudWatchLogsQuery], typing.Type[CloudWatchAnnotationQuery]]] = {"Metrics": CloudWatchMetricsQuery, "Logs": CloudWatchLogsQuery, "Annotations": CloudWatchAnnotationQuery} + decoding_map: dict[str, typing.Union[typing.Type[CloudWatchAnnotationQuery], typing.Type[CloudWatchLogsQuery], typing.Type[CloudWatchMetricsQuery]]] = {"Annotations": CloudWatchAnnotationQuery, "Logs": CloudWatchLogsQuery, "Metrics": CloudWatchMetricsQuery} return cogruntime.DataqueryConfig( identifier="cloudwatch", from_json_hook=lambda data: decoding_map[data["queryMode"]].from_json(data), diff --git a/python/grafana_foundation_sdk/models/expr.py b/python/grafana_foundation_sdk/models/expr.py index de1ce61..8fe1c87 100644 --- a/python/grafana_foundation_sdk/models/expr.py +++ b/python/grafana_foundation_sdk/models/expr.py @@ -9,7 +9,7 @@ Expr: typing.TypeAlias = typing.Union['TypeMath', 'TypeReduce', 'TypeResample', def variant_config() -> cogruntime.DataqueryConfig: - decoding_map: dict[str, typing.Union[typing.Type[TypeThreshold], typing.Type[TypeSql], typing.Type[TypeMath], typing.Type[TypeReduce], typing.Type[TypeResample], typing.Type[TypeClassicConditions]]] = {"threshold": TypeThreshold, "sql": TypeSql, "math": TypeMath, "reduce": TypeReduce, "resample": TypeResample, "classic_conditions": TypeClassicConditions} + decoding_map: dict[str, typing.Union[typing.Type[TypeClassicConditions], typing.Type[TypeMath], typing.Type[TypeReduce], typing.Type[TypeResample], typing.Type[TypeSql], typing.Type[TypeThreshold]]] = {"classic_conditions": TypeClassicConditions, "math": TypeMath, "reduce": TypeReduce, "resample": TypeResample, "sql": TypeSql, "threshold": TypeThreshold} return cogruntime.DataqueryConfig( identifier="__expr__", from_json_hook=lambda data: decoding_map[data["type"]].from_json(data), diff --git a/python/pyproject.toml b/python/pyproject.toml index d650f3b..edebf86 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -13,7 +13,7 @@ keywords = [ "traces", "metrics" ] -version = "1725620594!next" +version = "1726135831!next" dependencies = [] requires-python = ">=3.11" classifiers = [ diff --git a/typescript/package.json b/typescript/package.json index e8a7368..02497b0 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@grafana/grafana-foundation-sdk", - "version": "next-cogv0.0.x.1725620594", + "version": "next-cogv0.0.x.1726135831", "description": "A set of tools, types and libraries for building and manipulating Grafana objects.", "keywords": [ "observability", ```