{ "kind": "open-flow-workflow", "version": 1, "name": "Save Analytics Sessions by Country to Airtable", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_b7641bb5abebcf25": { "name": "Start report", "kind": "start", "inputDefs": [] }, "n_6cd02414dcc69fd3": { "inputs": { "propertyId": { "kind": "value", "value": "YOUR_GA4_PROPERTY_ID" }, "dateRanges": { "kind": "value", "value": [ { "startDate": "2025-01-01", "endDate": "2025-01-31" } ] }, "dimensions": { "kind": "value", "value": [ "country" ] }, "metrics": { "kind": "value", "value": [ "sessions" ] }, "limit": { "kind": "value", "value": 10000 }, "offset": { "kind": "value", "value": 0 } }, "name": "Read sessions by country", "kind": "task", "task": { "inputs": [ { "description": "The Google Analytics property ID, with or without the properties/ prefix.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The Google Analytics property ID, with or without the properties/ prefix." }, "nullable": false, "handle": "propertyId" }, { "description": "The date ranges for the report.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "startDate": { "type": "string", "minLength": 1, "description": "The inclusive start date in YYYY-MM-DD format or a relative value such as 7daysAgo." }, "endDate": { "type": "string", "minLength": 1, "description": "The inclusive end date in YYYY-MM-DD format or a relative value such as today." }, "name": { "type": "string", "minLength": 1, "description": "The optional date range name used in response dimensions." } }, "required": [ "startDate", "endDate" ], "additionalProperties": false, "description": "A Google Analytics Data API date range." }, "minItems": 1, "description": "The date ranges for the report." }, "nullable": false, "handle": "dateRanges" }, { "description": "The dimensions to include in the report.", "jsonSchema": { "type": "array", "items": { "anyOf": [ { "type": "string", "minLength": 1, "description": "The API name of the dimension or metric." }, { "type": "object", "properties": {}, "additionalProperties": true, "description": "The official Google Analytics Dimension or Metric object, usually containing a name field." } ], "description": "A Google Analytics named dimension or metric request." }, "minItems": 1, "description": "The dimensions to include in the report." }, "nullable": true, "handle": "dimensions", "value": null }, { "description": "The metrics to include in the report.", "jsonSchema": { "type": "array", "items": { "anyOf": [ { "type": "string", "minLength": 1, "description": "The API name of the dimension or metric." }, { "type": "object", "properties": {}, "additionalProperties": true, "description": "The official Google Analytics Dimension or Metric object, usually containing a name field." } ], "description": "A Google Analytics named dimension or metric request." }, "minItems": 1, "description": "The metrics to include in the report." }, "nullable": false, "handle": "metrics" }, { "description": "A Google Analytics Data API FilterExpression object.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Google Analytics Data API FilterExpression object." }, "nullable": true, "handle": "dimensionFilter", "value": null }, { "description": "A Google Analytics Data API FilterExpression object.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Google Analytics Data API FilterExpression object." }, "nullable": true, "handle": "metricFilter", "value": null }, { "description": "The report ordering rules.", "jsonSchema": { "type": "array", "items": { "anyOf": [ { "type": "object", "properties": { "metric": { "type": "object", "properties": { "metricName": { "type": "string", "minLength": 1, "description": "The requested metric name to sort by." } }, "required": [ "metricName" ], "additionalProperties": false, "description": "The metric ordering configuration." }, "desc": { "type": "boolean", "description": "Whether to sort the values in descending order." } }, "required": [ "metric" ], "additionalProperties": false, "description": "A Google Analytics metric ordering rule." }, { "type": "object", "properties": { "dimension": { "type": "object", "properties": { "dimensionName": { "type": "string", "minLength": 1, "description": "The requested dimension name to sort by." }, "orderType": { "type": "string", "enum": [ "ORDER_TYPE_UNSPECIFIED", "ALPHANUMERIC", "CASE_INSENSITIVE_ALPHANUMERIC", "NUMERIC" ], "description": "The rule used to order dimension string values." } }, "required": [ "dimensionName" ], "additionalProperties": false, "description": "The dimension ordering configuration." }, "desc": { "type": "boolean", "description": "Whether to sort the values in descending order." } }, "required": [ "dimension" ], "additionalProperties": false, "description": "A Google Analytics dimension ordering rule." }, { "type": "object", "properties": { "pivot": { "type": "object", "properties": { "metricName": { "type": "string", "minLength": 1, "description": "The requested metric name to sort by." }, "pivotSelections": { "type": "array", "items": { "type": "object", "properties": { "dimensionName": { "type": "string", "minLength": 1, "description": "The pivot dimension name." }, "dimensionValue": { "type": "string", "description": "The pivot dimension value." } }, "required": [ "dimensionName", "dimensionValue" ], "additionalProperties": false, "description": "A dimension name and value pair selecting a pivot column." }, "description": "The dimension name and value pairs selecting the pivot column group." } }, "required": [ "metricName" ], "additionalProperties": false, "description": "The pivot ordering configuration." }, "desc": { "type": "boolean", "description": "Whether to sort the values in descending order." } }, "required": [ "pivot" ], "additionalProperties": false, "description": "A Google Analytics pivot ordering rule." } ], "description": "A Google Analytics Data API OrderBy object." }, "minItems": 1, "description": "The report ordering rules." }, "nullable": true, "handle": "orderBys", "value": null }, { "description": "The ISO 4217 currency code for currency metrics.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The ISO 4217 currency code for currency metrics." }, "nullable": true, "handle": "currencyCode", "value": null }, { "description": "The Google Analytics Data API cohort specification for cohort reports.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The Google Analytics Data API cohort specification for cohort reports." }, "nullable": true, "handle": "cohortSpec", "value": null }, { "description": "Whether rows with zero metric values should be returned.", "jsonSchema": { "type": "boolean", "description": "Whether rows with zero metric values should be returned." }, "nullable": true, "handle": "keepEmptyRows", "value": null }, { "description": "The metric aggregations to include in the report.", "jsonSchema": { "type": "array", "items": { "type": "string", "enum": [ "METRIC_AGGREGATION_UNSPECIFIED", "TOTAL", "MINIMUM", "MAXIMUM", "COUNT" ], "description": "A Google Analytics metric aggregation enum value." }, "minItems": 1, "description": "The metric aggregations to include in the report." }, "nullable": true, "handle": "metricAggregations", "value": null }, { "description": "The comparisons to include in the report.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Google Analytics Data API comparison object." }, "minItems": 1, "description": "The comparisons to include in the report." }, "nullable": true, "handle": "comparisons", "value": null }, { "description": "A Google Analytics int64 request value.", "jsonSchema": { "anyOf": [ { "type": "string", "minLength": 1, "description": "The int64 value encoded as a string." }, { "type": "integer", "description": "The int64 value encoded as an integer." } ], "description": "A Google Analytics int64 request value." }, "nullable": true, "handle": "limit", "value": null }, { "description": "A Google Analytics int64 request value.", "jsonSchema": { "anyOf": [ { "type": "string", "minLength": 1, "description": "The int64 value encoded as a string." }, { "type": "integer", "description": "The int64 value encoded as an integer." } ], "description": "A Google Analytics int64 request value." }, "nullable": true, "handle": "offset", "value": null }, { "description": "Whether to return the property quota with the response.", "jsonSchema": { "type": "boolean", "description": "Whether to return the property quota with the response." }, "nullable": true, "handle": "returnPropertyQuota", "value": null } ], "outputs": [ { "description": "A normalized Google Analytics report response.", "jsonSchema": { "type": "object", "properties": { "dimensionHeaders": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": [ "string", "null" ], "description": "The header name." }, "type": { "type": [ "string", "null" ], "description": "The metric type when present." } }, "required": [ "name", "type" ], "additionalProperties": false, "description": "A Google Analytics report header." }, "description": "The dimension headers returned by the report." }, "metricHeaders": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": [ "string", "null" ], "description": "The header name." }, "type": { "type": [ "string", "null" ], "description": "The metric type when present." } }, "required": [ "name", "type" ], "additionalProperties": false, "description": "A Google Analytics report header." }, "description": "The metric headers returned by the report." }, "rows": { "type": "array", "items": { "type": "object", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values keyed by dimension header name." }, "metrics": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values keyed by metric header name." }, "dimensionValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values in response order." }, "metricValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values in response order." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensions", "metrics", "dimensionValues", "metricValues", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report row." }, "description": "The normalized report rows." }, "rowCount": { "type": [ "integer", "null" ], "description": "The total row count returned by Google Analytics." }, "metadata": { "type": [ "object", "null" ], "properties": { "currencyCode": { "type": [ "string", "null" ], "description": "The currency code used by the report." }, "timeZone": { "type": [ "string", "null" ], "description": "The property timezone used by the report." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "currencyCode", "timeZone", "raw" ], "additionalProperties": false, "description": "Normalized Google Analytics report metadata." }, "propertyQuota": { "type": [ "object", "null" ], "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." }, "totals": { "type": "array", "items": { "type": "object", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values keyed by dimension header name." }, "metrics": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values keyed by metric header name." }, "dimensionValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values in response order." }, "metricValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values in response order." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensions", "metrics", "dimensionValues", "metricValues", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report row." }, "description": "Total rows returned by Google Analytics." }, "minimums": { "type": "array", "items": { "type": "object", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values keyed by dimension header name." }, "metrics": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values keyed by metric header name." }, "dimensionValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values in response order." }, "metricValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values in response order." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensions", "metrics", "dimensionValues", "metricValues", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report row." }, "description": "Minimum rows returned by Google Analytics." }, "maximums": { "type": "array", "items": { "type": "object", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values keyed by dimension header name." }, "metrics": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values keyed by metric header name." }, "dimensionValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values in response order." }, "metricValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values in response order." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensions", "metrics", "dimensionValues", "metricValues", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report row." }, "description": "Maximum rows returned by Google Analytics." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensionHeaders", "metricHeaders", "rows", "rowCount", "metadata", "propertyQuota", "totals", "minimums", "maximums", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report response." }, "nullable": false, "handle": "report" } ], "name": "Read sessions by country", "executor": { "kind": "connector", "action": "google_analytics.run_report" } } }, "n_6c5d9ae2b671ce6d": { "inputs": { "report": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6cd02414dcc69fd3", "output": "report" } ] } }, "name": "Validate report rows", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "properties": { "dimensionHeaders": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": [ "string", "null" ], "description": "The header name." }, "type": { "type": [ "string", "null" ], "description": "The metric type when present." } }, "required": [ "name", "type" ], "additionalProperties": false, "description": "A Google Analytics report header." }, "description": "The dimension headers returned by the report." }, "metricHeaders": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": [ "string", "null" ], "description": "The header name." }, "type": { "type": [ "string", "null" ], "description": "The metric type when present." } }, "required": [ "name", "type" ], "additionalProperties": false, "description": "A Google Analytics report header." }, "description": "The metric headers returned by the report." }, "rows": { "type": "array", "items": { "type": "object", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values keyed by dimension header name." }, "metrics": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values keyed by metric header name." }, "dimensionValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values in response order." }, "metricValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values in response order." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensions", "metrics", "dimensionValues", "metricValues", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report row." }, "description": "The normalized report rows." }, "rowCount": { "type": [ "integer", "null" ], "description": "The total row count returned by Google Analytics." }, "metadata": { "type": [ "object", "null" ], "properties": { "currencyCode": { "type": [ "string", "null" ], "description": "The currency code used by the report." }, "timeZone": { "type": [ "string", "null" ], "description": "The property timezone used by the report." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "currencyCode", "timeZone", "raw" ], "additionalProperties": false, "description": "Normalized Google Analytics report metadata." }, "propertyQuota": { "type": [ "object", "null" ], "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." }, "totals": { "type": "array", "items": { "type": "object", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values keyed by dimension header name." }, "metrics": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values keyed by metric header name." }, "dimensionValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values in response order." }, "metricValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values in response order." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensions", "metrics", "dimensionValues", "metricValues", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report row." }, "description": "Total rows returned by Google Analytics." }, "minimums": { "type": "array", "items": { "type": "object", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values keyed by dimension header name." }, "metrics": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values keyed by metric header name." }, "dimensionValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values in response order." }, "metricValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values in response order." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensions", "metrics", "dimensionValues", "metricValues", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report row." }, "description": "Minimum rows returned by Google Analytics." }, "maximums": { "type": "array", "items": { "type": "object", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values keyed by dimension header name." }, "metrics": { "type": "object", "additionalProperties": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values keyed by metric header name." }, "dimensionValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Dimension values in response order." }, "metricValues": { "type": "array", "items": { "type": "string", "description": "A string value returned by Google Analytics." }, "description": "Metric values in response order." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensions", "metrics", "dimensionValues", "metricValues", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report row." }, "description": "Maximum rows returned by Google Analytics." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw Google Analytics object." } }, "required": [ "dimensionHeaders", "metricHeaders", "rows", "rowCount", "metadata", "propertyQuota", "totals", "minimums", "maximums", "raw" ], "additionalProperties": false, "description": "A normalized Google Analytics report response." }, "nullable": false, "handle": "report" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "rows" } ], "name": "Validate report rows", "moduleId": "n_b9cacb9ed1bc5902", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_2df4dcd6328fac61": { "inputs": { "rows": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6c5d9ae2b671ce6d", "output": "rows" } ] }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2df4dcd6328fac61", "output": "state" } ] } }, "name": "Prepare the next country", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "rows" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previous" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "fields": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Field values for the new Airtable record." } }, "required": [ "fields" ], "additionalProperties": false, "description": "Record payload used when creating Airtable records." }, "minItems": 1, "maxItems": 10, "description": "Records to create in the Airtable table." }, "nullable": false, "handle": "records" } ], "name": "Prepare the next country", "moduleId": "n_26f75a7e6bb7cd04", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_e648cacc109f561e": { "inputs": {}, "name": "More countries?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "create", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_2df4dcd6328fac61", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_1ab3c76f00760ccb": { "inputs": { "baseId": { "kind": "value", "value": "YOUR_AIRTABLE_BASE_ID" }, "tableIdOrName": { "kind": "value", "value": "Analytics" }, "records": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2df4dcd6328fac61", "output": "records" } ] }, "typecast": { "kind": "value", "value": false } }, "name": "Create Airtable record", "kind": "task", "task": { "inputs": [ { "description": "Base ID in the format appXXXXXXXXXXXXXX.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Base ID in the format appXXXXXXXXXXXXXX." }, "nullable": false, "handle": "baseId" }, { "description": "Table ID or table name accepted by the Airtable path parameter.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Table ID or table name accepted by the Airtable path parameter." }, "nullable": false, "handle": "tableIdOrName" }, { "description": "Records to create in the Airtable table.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "fields": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Field values for the new Airtable record." } }, "required": [ "fields" ], "additionalProperties": false, "description": "Record payload used when creating Airtable records." }, "minItems": 1, "maxItems": 10, "description": "Records to create in the Airtable table." }, "nullable": false, "handle": "records" }, { "description": "Whether Airtable should coerce incoming values to compatible field types.", "jsonSchema": { "type": "boolean", "description": "Whether Airtable should coerce incoming values to compatible field types." }, "nullable": true, "handle": "typecast", "value": null }, { "description": "Whether Airtable should return field IDs instead of field names in record objects.", "jsonSchema": { "type": "boolean", "description": "Whether Airtable should return field IDs instead of field names in record objects." }, "nullable": true, "handle": "returnFieldsByFieldId", "value": null } ], "outputs": [ { "description": "Records created by Airtable.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Record ID." }, "createdTime": { "type": "string", "description": "Record creation timestamp returned by Airtable." }, "fields": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Record fields keyed by field name or field ID." }, "commentCount": { "type": "integer", "description": "Comment count returned by Airtable when enabled on the endpoint." } }, "required": [ "id", "fields" ], "additionalProperties": true, "description": "Airtable record." }, "description": "Records created by Airtable." }, "nullable": false, "handle": "records" } ], "name": "Create Airtable record", "executor": { "kind": "connector", "action": "airtable.create_records" } } }, "n_bb6050799b18f6c5": { "inputs": { "records": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_1ab3c76f00760ccb", "output": "records" } ] } }, "name": "Confirm the record", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Record ID." }, "createdTime": { "type": "string", "description": "Record creation timestamp returned by Airtable." }, "fields": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Record fields keyed by field name or field ID." }, "commentCount": { "type": "integer", "description": "Comment count returned by Airtable when enabled on the endpoint." } }, "required": [ "id", "fields" ], "additionalProperties": true, "description": "Airtable record." }, "description": "Records created by Airtable." }, "nullable": false, "handle": "records" } ], "outputs": [], "name": "Confirm the record", "moduleId": "n_5793a75e951d2ba2", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } } }, "edges": [ { "source": "n_b7641bb5abebcf25", "target": "n_6cd02414dcc69fd3" }, { "source": "n_6cd02414dcc69fd3", "target": "n_6c5d9ae2b671ce6d" }, { "source": "n_6c5d9ae2b671ce6d", "target": "n_2df4dcd6328fac61" }, { "source": "n_2df4dcd6328fac61", "target": "n_e648cacc109f561e" }, { "source": "n_e648cacc109f561e", "target": "n_1ab3c76f00760ccb", "sourceHandle": "create" }, { "source": "n_1ab3c76f00760ccb", "target": "n_bb6050799b18f6c5" }, { "source": "n_bb6050799b18f6c5", "target": "n_2df4dcd6328fac61" } ] } }, "modules": { "n_b9cacb9ed1bc5902": { "name": "Validate report rows", "imports": [], "source": "export default function rows({report}){\n if(!report||typeof report!=='object')throw Error('Invalid Analytics report');\n const data=report.raw??report;if(!data||typeof data!=='object'||Array.isArray(data))throw Error('Invalid Analytics response');\n const rows=data.rows??[];if(!Array.isArray(rows))throw Error('Invalid Analytics rows');const count=data.rowCount??(rows.length===0?0:null);\n if(!Number.isInteger(count)||count<0||count!==rows.length||count>10000)throw Error('Incomplete Analytics report');\n if(!rows.length)return {rows:[]};\n if(data.dimensionHeaders?.length!==1||data.dimensionHeaders[0]?.name!=='country'||data.metricHeaders?.length!==1||data.metricHeaders[0]?.name!=='sessions')throw Error('Unexpected Analytics columns');\n return {rows:rows.map(row=>{const country=row?.dimensionValues?.[0]?.value,n=row?.metricValues?.[0]?.value;if(typeof country!=='string'||!country||typeof n!=='string'||!/^\\d+$/.test(n)||!Number.isSafeInteger(Number(n)))throw Error('Invalid Analytics row');return {Country:country,Metric:Number(n)};})};\n}\n" }, "n_26f75a7e6bb7cd04": { "name": "Prepare the next country", "imports": [], "source": "export default function next({rows,previous}){const i=previous?.next??0;if(!Array.isArray(rows)||!Number.isInteger(i)||i<0||i>rows.length)throw Error('Invalid row state');return {state:{next:i+1},more:i