Skip to content

Instantly share code, notes, and snippets.

@sporto
Created January 19, 2021 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sporto/9a35f5caa1184807ea9d12412fcadac7 to your computer and use it in GitHub Desktop.
Save sporto/9a35f5caa1184807ea9d12412fcadac7 to your computer and use it in GitHub Desktop.
Output VSCode Elm LS 2
[Trace - 11:59:50 am] Sending request 'initialize - (0)'.
Params: {
"processId": 453470,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.52.1"
},
"locale": "en-gb",
"rootPath": "/home/sebastian/Source/staxio/stax",
"rootUri": "file:///home/sebastian/Source/staxio/stax",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": true
}
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
}
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true,
"semanticTokens": {
"refreshSupport": true
},
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
}
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"insertReplaceSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
},
"activeParameterSupport": true
},
"contextSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"honorsChangeAnnotations": false
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"prepareSupportDefaultBehavior": 1,
"honorsChangeAnnotations": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false
},
"linkedEditingRange": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "1.1.0"
}
}
},
"initializationOptions": {
"elmFormatPath": "",
"elmPath": "",
"elmTestPath": "",
"trace": {
"server": "verbose"
},
"extendedCapabilities": {
"moveFunctionRefactoringSupport": true,
"exposeUnexposeSupport": true
},
"disableElmLSDiagnostics": false
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/sebastian/Source/staxio/stax",
"name": "stax"
}
],
"workDoneToken": "0662d826-2f0a-4526-8cb7-8eb361db882c"
}
[Trace - 11:59:50 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm"
}
[Info - 11:59:50 am] Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:51 am] Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:51 am] Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client"
}
[Info - 11:59:51 am] Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client
[Trace - 11:59:51 am] Received notification '$/progress'.
Params: {
"token": "0662d826-2f0a-4526-8cb7-8eb361db882c",
"value": {
"kind": "begin",
"title": "Indexing Elm",
"percentage": 0
}
}
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Elm version 0.19.1 detected."
}
[Info - 11:59:51 am] Elm version 0.19.1 detected.
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json"
}
[Info - 11:59:51 am] Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 2,
"message": "{\"shortMessage\":\"Command failed with exit code 1: elm make\",\"command\":\"elm make\",\"exitCode\":1,\"stdout\":\"\",\"stderr\":\"\\n-- ERROR -----------------------------------------------------------------------\\n\\nI ran into something that bypassed the normal error reporting process! I\\nextracted whatever information I could from the internal error:\\n\\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\\nThese errors are usually pretty confusing, so start by asking around on one of\\nforums listed at https://elm-lang.org/community to see if anyone can get you\\nunstuck quickly.\\n\\n-- REQUEST ---------------------------------------------------------------------\\n\\nIf you are feeling up to it, please try to get your code down to the smallest\\nversion that still triggers this message. Ideally in a single Main.elm and\\nelm.json file.\\n\\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\\nabout if someone else saw something similar. More examples is better!\\n\\nThis kind of error is usually tied up in larger architectural choices that are\\nhard to change, so even when we have a couple good examples, it can take some\\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\",\"failed\":true,\"timedOut\":false,\"isCanceled\":false,\"killed\":false}"
}
[Warn - 11:59:51 am] {"shortMessage":"Command failed with exit code 1: elm make","command":"elm make","exitCode":1,"stdout":"","stderr":"\n-- ERROR -----------------------------------------------------------------------\n\nI ran into something that bypassed the normal error reporting process! I\nextracted whatever information I could from the internal error:\n\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n\nThese errors are usually pretty confusing, so start by asking around on one of\nforums listed at https://elm-lang.org/community to see if anyone can get you\nunstuck quickly.\n\n-- REQUEST ---------------------------------------------------------------------\n\nIf you are feeling up to it, please try to get your code down to the smallest\nversion that still triggers this message. Ideally in a single Main.elm and\nelm.json file.\n\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\nabout if someone else saw something similar. More examples is better!\n\nThis kind of error is usually tied up in larger architectural choices that are\nhard to change, so even when we have a couple good examples, it can take some\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n","failed":true,"timedOut":false,"isCanceled":false,"killed":false}
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:\nError: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'"
}
[Error - 11:59:51 am] Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:
Error: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'
[Trace - 11:59:51 am] Received notification '$/progress'.
Params: {
"token": "0662d826-2f0a-4526-8cb7-8eb361db882c",
"value": {
"kind": "end"
}
}
[Trace - 11:59:51 am] Received response 'initialize - (0)' in 578ms.
Result: {
"capabilities": {
"codeActionProvider": {
"resolveProvider": true
},
"codeLensProvider": {
"resolveProvider": true
},
"completionProvider": {
"triggerCharacters": [
"."
]
},
"definitionProvider": true,
"documentFormattingProvider": true,
"documentSymbolProvider": {
"label": "Elm"
},
"executeCommandProvider": {
"commands": [
"elmLS.elmMakeFixer-fa3d58d984ac277c725be9002e97e0f9",
"elm.installPackage"
]
},
"foldingRangeProvider": true,
"hoverProvider": true,
"referencesProvider": true,
"renameProvider": {
"prepareProvider": true
},
"selectionRangeProvider": true,
"textDocumentSync": 2,
"workspaceSymbolProvider": true,
"workspace": {
"fileOperations": {
"didCreate": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
},
"willRename": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
},
{
"scheme": "file",
"pattern": {
"glob": "**/",
"matches": "folder"
}
}
]
},
"willDelete": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
}
}
},
"linkedEditingRangeProvider": true
}
}
[Trace - 11:59:51 am] Sending notification 'initialized'.
Params: {}
[Trace - 11:59:51 am] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm",
"languageId": "elm",
"version": 1,
"text": "module Elements.RawDataV3.Filter exposing\n ( allPartsOrdered\n , baseParts\n , codeForPartCondition\n , codeForPartDimension\n , codeForPartTemplate\n , dataRange_removeFromLocation\n , dateRange_setMonthInReportQuery\n , decodeNumericCondition\n , dimensionKeysV2\n , encodeNumericCondition\n , filter_addPartConditionToLocation\n , filter_addPartConditionToReportQuery\n , filter_addPartToLocationQuery\n , filter_addPartsToLocation\n , filter_addPartsToLocationQuery\n , filter_addPartsToReportQuery\n , filter_canAddPart\n , filter_fromBoolFilter\n , filter_getWhereComponents_fromGlobal\n , filter_hasPart\n , filter_jsonDecoder\n , filter_partFromFilterCondition\n , filter_partsFromLocation\n , filter_partsFromQuery\n , filter_removeAllPartsFromLocation\n , filter_removeAllPartsFromReportQuery\n , filter_removePartConditionFromLocation\n , filter_removePartConditionFromReportQuery\n , filter_setMonthInLocation\n , filter_setPartsInLocation\n , filter_toBoolFilter\n , filter_validateAndCorrectCondition\n , groupBys_add\n , groupBys_addToReportQuery\n , groupBys_canUsePart\n , groupBys_fromLocation\n , groupBys_hasAny\n , groupBys_hasPart\n , groupBys_jsonDecoder\n , groupBys_jsonEncode\n , groupBys_remove\n , groupBys_removeAllPartsFromLocation\n , groupBys_removeAllPartsFromReportQuery\n , groupBys_removeFromReportQuery\n , groupBys_setGroupBysInLocation\n , haveSamePartDimension\n , isSamePartCondition\n , isSamePartDimension\n , locationForArn\n , locationForViewSegment\n , partConditionConstructor\n , partConditionToDimension\n , partCondition_haveSameDimension\n , query_decoder\n , query_encodeQuery\n , query_getReportQueryFromLocation\n , query_isEmpty\n , query_setInLocation\n , selectedMonthDefaultFromContext\n , selectedMonthFromLocationWithDefault\n , templateParts\n , withNameSpace\n )\n\nimport Api.Enum.BillingData_PaymentOptionCode as PaymentOptionCode\nimport Date exposing (Date)\nimport Dict exposing (Dict)\nimport Elements.RawDataV3.Types exposing (..)\nimport Json.Decode as Decode\nimport Json.Encode as Encode\nimport Json.Encode.Extra as EncodeExtra\nimport List.Extra\nimport Result.Extra\nimport Set exposing (Set)\nimport Shared.AppLocation as AppLocation exposing (..)\nimport Shared.BoolFilterV2 as BoolFilter\nimport Shared.Context exposing (Context)\nimport Shared.Format as Format\nimport Shared.GlobalFilters as GlobalFilters\nimport Shared.Routes as Routes\nimport Shared.Times as Times\nimport Time exposing (Posix)\n\n\ntemplateParts =\n { arn = Part_Arn \"\"\n , awsAccountID = Part_AwsAccountID \"\"\n , awsProductCode = Part_AwsProductCode \"\"\n , awsRegionCode = Part_AwsRegionCode \"\"\n , financialCost = Part_FinancialCost NumericCondition_None\n , kind = Part_Kind \"\"\n , paymentOptionCode = Part_PaymentOptionCode PaymentOptionCode.Standard\n , reservationArn = Part_ReservationArn \"\"\n , resourceType = Part_ResourceType \"\"\n , savingPlanArn = Part_SavingsPlanArn \"\"\n , subUsageCode = Part_SubUsageCode \"\"\n , tag = Part_Tag \"\" \"\"\n , usageCode = Part_UsageCode \"\"\n , usageCost = Part_UsageCost NumericCondition_None\n , usageQuantity = Part_UsageQuantity NumericCondition_None\n , viewSegment = Part_ViewSegment \"\" \"\"\n }\n\n\ntemplatePartForPart : Part -> PartTemplate\ntemplatePartForPart part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag _ _ ->\n templateParts.tag\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment _ _ _ ->\n templateParts.viewSegment\n in\n PartTemplate part_\n\n\n{-| Is fine to go from specific to general\n-}\npartConditionToDimension : PartCondition -> PartDimension\npartConditionToDimension (PartCondition part) =\n PartDimension part\n\n\npartToPartDimension : Part -> PartDimension\npartToPartDimension part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag key _ ->\n Part_Tag key \"\"\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment global viewID _ ->\n Part_ViewSegment global viewID \"\"\n in\n PartDimension part_\n\n\nallPartsOrdered : List PartTemplate\nallPartsOrdered =\n let\n {-\n This function is useless but will cause the\n compiler to fail if types arent added here. It is\n up to the developer to ensure the are also in the\n return list. This is a work around for union types\n not being iterable\n -}\n ignored thing =\n case thing of\n Part_Arn _ ->\n []\n\n Part_AwsAccountID _ ->\n []\n\n Part_AwsProductCode _ ->\n []\n\n Part_AwsRegionCode _ ->\n []\n\n Part_FinancialCost _ ->\n []\n\n Part_UsageCost _ ->\n []\n\n Part_Kind _ ->\n []\n\n Part_PaymentOptionCode _ ->\n []\n\n Part_ReservationArn _ ->\n []\n\n Part_ResourceType _ ->\n []\n\n Part_SavingsPlanArn _ ->\n []\n\n Part_SubUsageCode _ ->\n []\n\n Part_Tag _ _ ->\n []\n\n Part_UsageCode _ ->\n []\n\n Part_UsageQuantity _ ->\n []\n\n Part_ViewSegment _ _ _ ->\n []\n in\n -- All parts ordered for iteration in UI\n [ templateParts.viewSegment\n , templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n , templateParts.tag\n ]\n ++ ignored (Part_Arn \"\")\n |> List.map PartTemplate\n\n\n{-| Same as all, but without view and tags which are iterated differently\n-}\nbaseParts : List PartTemplate\nbaseParts =\n [ templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n ]\n |> List.map PartTemplate\n\n\n{-| Some conditions can be constructed by providing a single String\n-}\npartConditionConstructor : PartDimension -> Maybe (String -> PartCondition)\npartConditionConstructor (PartDimension part) =\n let\n maybeConstructor =\n case part of\n Part_Arn _ ->\n Just Part_Arn\n\n Part_AwsAccountID _ ->\n Just Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n Just Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n Just Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n Nothing\n\n Part_UsageCost _ ->\n Nothing\n\n Part_Kind _ ->\n Just Part_Kind\n\n Part_PaymentOptionCode _ ->\n (\\s ->\n Part_PaymentOptionCode\n (s\n |> PaymentOptionCode.fromString\n |> Maybe.withDefault PaymentOptionCode.Standard\n )\n )\n |> Just\n\n Part_ReservationArn _ ->\n Just Part_ReservationArn\n\n Part_ResourceType _ ->\n Just Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n Just Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n Just Part_SubUsageCode\n\n Part_Tag key _ ->\n Just (Part_Tag key)\n\n Part_UsageCode _ ->\n Just Part_UsageCode\n\n Part_UsageQuantity _ ->\n Nothing\n\n Part_ViewSegment global view _ ->\n Just (Part_ViewSegment global view)\n in\n case maybeConstructor of\n Nothing ->\n Nothing\n\n Just constructor ->\n Just (constructor >> PartCondition)\n\n\nfilter_hasPart : PartCondition -> List PartCondition -> Bool\nfilter_hasPart part parts =\n case List.Extra.find (isSamePartCondition part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\nfilter_canAddPart : PartCondition -> List PartCondition -> Bool\nfilter_canAddPart part parts =\n if filter_hasPart part parts then\n filter_canAddMultipleOf part\n\n else\n True\n\n\nfilter_validateAndCorrectCondition : PartCondition -> Maybe PartCondition\nfilter_validateAndCorrectCondition (PartCondition part) =\n let\n validateValue value =\n if String.isEmpty value then\n Nothing\n\n else\n Just part\n\n validatedPart =\n case part of\n Part_Arn value ->\n validateValue value\n\n Part_AwsAccountID value ->\n validateValue value\n\n Part_AwsProductCode value ->\n validateValue value\n\n Part_AwsRegionCode value ->\n validateValue value\n\n Part_FinancialCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_FinancialCost corrected)\n\n Part_UsageCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageCost corrected)\n\n Part_Kind value ->\n validateValue value\n\n Part_PaymentOptionCode _ ->\n Just part\n\n Part_ReservationArn value ->\n validateValue value\n\n Part_ResourceType value ->\n validateValue value\n\n Part_SavingsPlanArn value ->\n validateValue value\n\n Part_SubUsageCode value ->\n validateValue value\n\n Part_Tag _ value ->\n validateValue value\n\n Part_UsageCode value ->\n validateValue value\n\n Part_UsageQuantity numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageQuantity corrected)\n\n Part_ViewSegment _ _ segmentID ->\n validateValue segmentID\n in\n validatedPart |> Maybe.map PartCondition\n\n\nfilter_canAddMultipleOf : PartCondition -> Bool\nfilter_canAddMultipleOf (PartCondition part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\nfilter_addPart : PartCondition -> List PartCondition -> List PartCondition\nfilter_addPart part parts =\n if filter_canAddPart part parts then\n parts ++ [ part ]\n\n else\n parts\n\n\nremovePartDimension : PartDimension -> List PartDimension -> List PartDimension\nremovePartDimension part parts =\n parts\n |> List.Extra.filterNot (isSamePartDimension part)\n\n\nremovePartCondition : PartCondition -> List PartCondition -> List PartCondition\nremovePartCondition part parts =\n parts\n |> List.Extra.filterNot (isSamePartCondition part)\n\n\n{-| These are the same template part if they use the same constructor\n-}\nhaveSamePartTemplate : Part -> Part -> Bool\nhaveSamePartTemplate a b =\n templatePartForPart a == templatePartForPart b\n\n\nisSamePartDimension : PartDimension -> PartDimension -> Bool\nisSamePartDimension (PartDimension a) (PartDimension b) =\n haveSamePartDimension a b\n\n\npartCondition_haveSameDimension : PartCondition -> PartCondition -> Bool\npartCondition_haveSameDimension (PartCondition a) (PartCondition b) =\n haveSamePartDimension a b\n\n\n{-| View and Tag are the same dimension if they have the same view or tag key\n-}\nhaveSamePartDimension : Part -> Part -> Bool\nhaveSamePartDimension a b =\n partToPartDimension a == partToPartDimension b\n\n\nisSamePartCondition : PartCondition -> PartCondition -> Bool\nisSamePartCondition a b =\n a == b\n\n\nfilter_partsFromLocation : AppLocation -> List PartCondition\nfilter_partsFromLocation location =\n filter_partsFromQuery location.query\n\n\nfilter_partsFromQuery : Query -> List PartCondition\nfilter_partsFromQuery query =\n allPartsOrdered\n |> List.concatMap (filter_partFromQuery query)\n |> filter_uniqueParts\n\n\n{-| Given a template part e.g. Part\\_Arn \"\"\nThis may return multiple parts [Part_Arn \"123\", Part_Arn \"456\"]\n-}\nfilter_partFromQuery : Query -> PartTemplate -> List PartCondition\nfilter_partFromQuery query (PartTemplate templatePart) =\n let\n parsePair pair =\n case String.split valueKeySeparator pair of\n [ a, b ] ->\n Just ( a, b )\n\n _ ->\n Nothing\n\n partConditions =\n case templatePart of\n Part_Arn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.arn)\n |> List.map Part_Arn\n\n Part_AwsAccountID _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_account_id)\n |> List.map Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_product_code)\n |> List.map Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_region_code)\n |> List.map Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n filter_getNumericInputFromQuery\n Part_FinancialCost\n (withNameSpace dimensionKeysV2.financial_cost)\n query\n\n Part_UsageCost _ ->\n filter_getNumericInputFromQuery\n Part_UsageCost\n (withNameSpace dimensionKeysV2.usage_cost)\n query\n\n Part_Kind _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.kind)\n |> List.map Part_Kind\n\n Part_PaymentOptionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.payment_option_code)\n |> List.filterMap PaymentOptionCode.fromString\n |> List.map Part_PaymentOptionCode\n\n Part_ReservationArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.reservation_arn)\n |> List.map Part_ReservationArn\n\n Part_ResourceType _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.resource_type)\n |> List.map Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n |> List.map Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.sub_usage_code)\n |> List.map Part_SubUsageCode\n\n Part_Tag _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.tags)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_Tag a b)\n\n Part_UsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.usage_code)\n |> List.map Part_UsageCode\n\n Part_UsageQuantity _ ->\n filter_getNumericInputFromQuery\n Part_UsageQuantity\n (withNameSpace dimensionKeysV2.usage_quantity)\n query\n\n Part_ViewSegment _ _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.segment_ids)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_ViewSegment a b)\n in\n partConditions |> List.map PartCondition\n\n\nfilter_partFromFilterCondition : Dict String String -> BoolFilter.Condition -> Result String PartCondition\nfilter_partFromFilterCondition viewIDlookupMap filterCondition =\n let\n keys =\n dimensionKeysV2\n\n ( key, val ) =\n case filterCondition of\n BoolFilter.Eq pair ->\n pair\n\n BoolFilter.NotEq pair ->\n pair\n\n BoolFilter.LessOrEqualThan pair ->\n pair\n\n BoolFilter.LessThan pair ->\n pair\n\n BoolFilter.ListIncludes pair ->\n pair\n\n BoolFilter.Matches pair ->\n pair\n\n BoolFilter.MoreOrEqualThan pair ->\n pair\n\n BoolFilter.MoreThan pair ->\n pair\n\n numericCondition =\n case filterCondition of\n BoolFilter.Eq _ ->\n NumericCondition_None\n\n BoolFilter.NotEq _ ->\n NumericCondition_None\n\n BoolFilter.LessOrEqualThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.LessThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.ListIncludes _ ->\n NumericCondition_None\n\n BoolFilter.Matches _ ->\n NumericCondition_None\n\n BoolFilter.MoreOrEqualThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n BoolFilter.MoreThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n part : Result String Part\n part =\n if key == keys.arn then\n Ok (Part_Arn val)\n\n else if key == keys.aws_account_id then\n Ok (Part_AwsAccountID val)\n\n else if key == keys.aws_product_code then\n Ok (Part_AwsProductCode val)\n\n else if key == keys.aws_region_code then\n Ok (Part_AwsRegionCode val)\n\n else if key == keys.financial_cost then\n Ok (Part_FinancialCost numericCondition)\n\n else if key == keys.usage_cost then\n Ok (Part_UsageCost numericCondition)\n\n else if key == keys.kind then\n Ok (Part_Kind val)\n\n else if key == keys.payment_option_code then\n PaymentOptionCode.fromString val\n |> Result.fromMaybe val\n |> Result.map Part_PaymentOptionCode\n\n else if key == keys.reservation_arn then\n Ok (Part_ReservationArn val)\n\n else if key == keys.resource_type then\n Ok (Part_ResourceType val)\n\n else if key == keys.savings_plan_arn then\n Ok (Part_SavingsPlanArn val)\n\n else if key == keys.sub_usage_code then\n Ok (Part_SubUsageCode val)\n\n else if String.startsWith \"tags\" key then\n case String.split \".\" key of\n [ a, b ] ->\n Ok (Part_Tag b val)\n\n _ ->\n Err key\n\n else if key == keys.usage_code then\n Ok (Part_UsageCode val)\n\n else if key == keys.usage_quantity then\n Ok (Part_UsageQuantity numericCondition)\n\n else if key == keys.segment_ids then\n case Dict.get val viewIDlookupMap of\n Nothing ->\n Err val\n\n Just viewID ->\n Ok (Part_ViewSegment viewID val)\n\n else\n Err key\n in\n part |> Result.map PartCondition\n\n\nfilter_getNumericInputFromQuery :\n (NumericCondition -> Part)\n -> String\n -> AppLocation.Query\n -> List Part\nfilter_getNumericInputFromQuery constructor queryKey query =\n case filter_getNumericConditionFromQuery queryKey query of\n Nothing ->\n []\n\n Just condition ->\n [ constructor condition ]\n\n\nfilter_getNumericConditionFromQuery :\n String\n -> AppLocation.Query\n -> Maybe NumericCondition\nfilter_getNumericConditionFromQuery queryKey query =\n getStringFromQuery queryKey query\n |> Maybe.andThen decodeNumericCondition\n\n\ngroupBys_fromLocation : AppLocation -> List PartDimension\ngroupBys_fromLocation location =\n let\n groupBys =\n getQueryAsStringList queryKeys.exploreData.groupBy location.query\n in\n List.filterMap groupBys_codeToPart groupBys\n\n\ngroupBys_canUsePart : PartDimension -> Bool\ngroupBys_canUsePart (PartDimension part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\ngroupBys_hasAny location =\n groupBys_fromLocation location\n |> List.isEmpty\n |> not\n\n\ngroupBys_add : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_add part parts =\n if groupBys_hasPart part parts then\n parts\n\n else\n parts ++ [ part ]\n\n\ngroupBys_addToReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_addToReportQuery part query =\n { query\n | groupBys = groupBys_add part query.groupBys\n }\n\n\ngroupBys_hasPart : PartDimension -> List PartDimension -> Bool\ngroupBys_hasPart part parts =\n case List.Extra.find (isSamePartDimension part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\ngroupBys_remove : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_remove =\n removePartDimension\n\n\ngroupBys_removeFromReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_removeFromReportQuery part query =\n { query\n | groupBys = groupBys_remove part query.groupBys\n }\n\n\ngroupBys_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\ngroupBys_removeAllPartsFromReportQuery query =\n { query | groupBys = [] }\n\n\ngroupBys_removeAllPartsFromLocation : AppLocation -> AppLocation\ngroupBys_removeAllPartsFromLocation location =\n { location | query = groupBys_removeAllPartsFromQuery location.query }\n\n\ngroupBys_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\ngroupBys_removeAllPartsFromQuery query =\n AppLocation.removeQuery\n queryKeys.exploreData.groupBy\n query\n\n\n{-| Parts that cannot be grouped by will return Nothing\n-}\ngroupBys_partToCode : PartDimension -> Maybe String\ngroupBys_partToCode partDimension =\n if groupBys_canUsePart partDimension then\n Just (codeForPartDimension partDimension)\n\n else\n Nothing\n\n\ngroupBys_codeToPart : String -> Maybe PartDimension\ngroupBys_codeToPart code =\n let\n dims =\n dimensionKeysV2\n\n partCondition =\n if code == dims.arn then\n Just templateParts.arn\n\n else if code == dims.aws_account_id then\n Just templateParts.awsAccountID\n\n else if code == dims.aws_product_code then\n Just templateParts.awsProductCode\n\n else if code == dims.aws_region_code then\n Just templateParts.awsRegionCode\n\n else if code == dims.financial_cost then\n Just templateParts.financialCost\n\n else if code == dims.kind then\n Just templateParts.kind\n\n else if code == dims.payment_option_code then\n Just templateParts.paymentOptionCode\n\n else if code == dims.reservation_arn then\n Just templateParts.reservationArn\n\n else if code == dims.resource_type then\n Just templateParts.resourceType\n\n else if code == dims.savings_plan_arn then\n Just templateParts.savingPlanArn\n\n else if code == dims.sub_usage_code then\n Just templateParts.subUsageCode\n\n else if code == dims.usage_code then\n Just templateParts.usageCode\n\n else if code == dims.usage_cost then\n Just templateParts.usageCost\n\n else if code == dims.usage_quantity then\n Just templateParts.usageQuantity\n\n else if String.startsWith groupByOnlyKeys.tag code then\n Just (Part_Tag (String.replace groupByOnlyKeys.tag \"\" code) \"\")\n\n else if String.startsWith groupByOnlyKeys.viewId code then\n Just (Part_ViewSegment (String.replace groupByOnlyKeys.viewId \"\" code) \"\")\n\n else\n -- Ignored\n -- month\n Nothing\n in\n Maybe.map PartDimension partCondition\n\n\ngroupBys_jsonEncode : List PartDimension -> Encode.Value\ngroupBys_jsonEncode parts =\n parts\n |> List.filterMap groupBys_partToCode\n |> Encode.list Encode.string\n\n\ngroupBys_jsonDecoder : Decode.Decoder (List PartDimension)\ngroupBys_jsonDecoder =\n Decode.list groupBys_jsonDimensionDecoder\n\n\ngroupBys_jsonDimensionDecoder : Decode.Decoder PartDimension\ngroupBys_jsonDimensionDecoder =\n Decode.string\n |> Decode.andThen\n (\\code ->\n case groupBys_codeToPart code of\n Nothing ->\n Decode.fail \"code\"\n\n Just part ->\n Decode.succeed part\n )\n\n\n{-| Dimension keys\nUsed for the URL query string and the API Query\nThese must not be changed as they are expected like this by the API\n-}\ndimensionKeysV2 =\n { arn = \"arn\"\n , aws_account_id = \"linked_account_id\"\n , aws_product_code = \"product_code\"\n , aws_region_code = \"region_code\"\n , financial_cost = \"unallocated_unblended_cost\"\n , kind = \"kind\"\n , month = \"month\"\n , payment_option_code = \"payment_option_code\"\n , reservation_arn = \"reservation_arn\"\n , resource_type = \"resource_type\"\n , savings_plan_arn = \"savings_plan_arn\"\n , segment_ids = \"segment_ids\"\n , sub_usage_code = \"sub_usage_code\"\n , tags = \"tags\"\n , usage_code = \"usage_code\"\n , usage_cost = \"unallocated_amortised_cost\"\n , usage_quantity = \"total_usage_quantity\"\n }\n\n\nnamespace =\n \"rd.\"\n\n\nwithNameSpace key =\n namespace ++ key\n\n\nvalueKeySeparator =\n \"|\"\n\n\ngroupByOnlyKeys =\n { tag = \"tags.\"\n , viewId = \"viewId.\"\n }\n\n\ncodeForPartTemplate : PartTemplate -> String\ncodeForPartTemplate (PartTemplate part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n groupByOnlyKeys.tag\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n groupByOnlyKeys.viewId\n\n\ncodeForPartDimension : PartDimension -> String\ncodeForPartDimension (PartDimension part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag k _ ->\n groupByOnlyKeys.tag ++ k\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ viewId _ ->\n groupByOnlyKeys.viewId ++ viewId\n\n\ncodeForPartCondition : PartCondition -> String\ncodeForPartCondition (PartCondition part) =\n codeForPartDimension (PartDimension part)\n\n\n{-| A unique code for a part condition\nUsed for removing duplicates\n-}\ncodeForPartConditionUnique : PartCondition -> String\ncodeForPartConditionUnique (PartCondition part) =\n case part of\n Part_Arn arn ->\n dimensionKeysV2.arn ++ arn\n\n Part_AwsAccountID id ->\n dimensionKeysV2.aws_account_id ++ id\n\n Part_AwsProductCode code ->\n dimensionKeysV2.aws_product_code ++ code\n\n Part_AwsRegionCode code ->\n dimensionKeysV2.aws_region_code ++ code\n\n Part_FinancialCost condition ->\n dimensionKeysV2.financial_cost ++ encodeNumericCondition condition\n\n Part_UsageCost condition ->\n dimensionKeysV2.usage_cost ++ encodeNumericCondition condition\n\n Part_Kind kind ->\n dimensionKeysV2.kind ++ kind\n\n Part_PaymentOptionCode code ->\n dimensionKeysV2.payment_option_code ++ PaymentOptionCode.toString code\n\n Part_ReservationArn arn ->\n dimensionKeysV2.reservation_arn ++ arn\n\n Part_ResourceType type_ ->\n dimensionKeysV2.resource_type ++ type_\n\n Part_SavingsPlanArn arn ->\n dimensionKeysV2.savings_plan_arn ++ arn\n\n Part_SubUsageCode code ->\n dimensionKeysV2.sub_usage_code ++ code\n\n Part_Tag k v ->\n groupByOnlyKeys.tag ++ k ++ \"=\" ++ v\n\n Part_UsageCode code ->\n dimensionKeysV2.usage_code ++ code\n\n Part_UsageQuantity condition ->\n dimensionKeysV2.usage_quantity ++ encodeNumericCondition condition\n\n Part_ViewSegment _ viewId segmentID ->\n groupByOnlyKeys.viewId ++ viewId ++ segmentID\n\n\n{-| Used in the query string too\nMust be query string safe. Dont' use:\n\n : / ? # [ ] @ ! $ & ' ( ) * + , ; =\n\nOk to use:\n\n - . _ ~\n\nUsed like\n\n ?rd.usage_cost=between.123~344&...\n\n-}\nencodeNumericCondition : NumericCondition -> String\nencodeNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n \"none\"\n\n NumericCondition_MoreOrEqualThan value ->\n \"get_\" ++ value\n\n NumericCondition_LessOrEqualThan value ->\n \"let_\" ++ value\n\n NumericCondition_Between one two ->\n \"between_\" ++ one ++ \"~\" ++ two\n\n\ndecodeNumericCondition : String -> Maybe NumericCondition\ndecodeNumericCondition value =\n case String.split \"_\" value of\n [ operation, body ] ->\n case operation of\n \"get\" ->\n Just (NumericCondition_MoreOrEqualThan body)\n\n \"let\" ->\n Just (NumericCondition_LessOrEqualThan body)\n\n \"between\" ->\n case String.split \"~\" body of\n [ min, max ] ->\n Just (NumericCondition_Between min max)\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n\n{-|\n\n e.g. rd.segment_ids\n\n-}\nqueryKeyForPart : PartTemplate -> String\nqueryKeyForPart (PartTemplate part) =\n let\n key =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n dimensionKeysV2.tags\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n dimensionKeysV2.segment_ids\n in\n withNameSpace key\n\n\n\n-- FILTER\n\n\nquery_getReportQueryFromLocation : Context -> List Segment -> ReportQuery\nquery_getReportQueryFromLocation context availableSegments =\n let\n selectedMonth =\n selectedMonthFromLocationWithDefaultAsMonth context\n\n whereFilterComponents : List PartCondition\n whereFilterComponents =\n filter_getWhereComponents\n context\n availableSegments\n\n groupBys : List PartDimension\n groupBys =\n groupBys_fromLocation\n context.location\n in\n { selectedMonth = selectedMonth\n , wheres = whereFilterComponents\n , groupBys = groupBys\n }\n\n\nquery_setInLocation : ReportQuery -> AppLocation -> AppLocation\nquery_setInLocation query location =\n location\n |> filter_setMonthInLocation query.selectedMonth\n |> filter_setPartsInLocation query.wheres\n |> groupBys_setGroupBysInLocation query.groupBys\n\n\nquery_isEmpty : ReportQuery -> Bool\nquery_isEmpty query =\n List.isEmpty query.wheres && List.isEmpty query.groupBys\n\n\nfilter_jsonEncode : BoolFilter.Root -> Encode.Value\nfilter_jsonEncode =\n BoolFilter.jsonEncode\n\n\nfilter_getWhereComponents :\n Context\n -> List Segment\n -> List PartCondition\nfilter_getWhereComponents context availableSegments =\n let\n globalFilterParts : List PartCondition\n globalFilterParts =\n filter_getWhereComponents_fromGlobal\n context\n availableSegments\n\n parts =\n context.location\n |> filter_partsFromLocation\n |> (++) globalFilterParts\n |> filter_uniqueParts\n in\n parts\n\n\nfilter_getWhereComponents_fromGlobal : Context -> List Segment -> List PartCondition\nfilter_getWhereComponents_fromGlobal context availableSegments =\n filter_getSelectedSegmentsForGlobalFilter context availableSegments\n |> List.map\n (\\{ viewDbId, dbID } ->\n Part_ViewSegment (unwrapDbID viewDbId) (unwrapDbID dbID) |> PartCondition\n )\n\n\nfilter_getSelectedSegmentsForGlobalFilter :\n Context\n -> List Segment\n -> List Segment\nfilter_getSelectedSegmentsForGlobalFilter context availableSegments =\n let\n globalFilter =\n GlobalFilters.fromLocation context.location\n\n isSelected : Segment -> Bool\n isSelected segment =\n List.member (unwrapID segment.id) globalFilter.segmentIDs\n in\n List.filter isSelected availableSegments\n\n\nfilter_jsonDecoder : Dict String String -> Decode.Decoder (List PartCondition)\nfilter_jsonDecoder viewIDlookupMap =\n BoolFilter.jsonDecoder\n |> Decode.andThen\n (\\filter ->\n case filter_fromBoolFilter viewIDlookupMap filter of\n Err err ->\n Decode.fail err\n\n Ok conditions ->\n Decode.succeed conditions\n )\n\n\nfilter_fromBoolFilter : Dict String String -> BoolFilter.Root -> Result String (List PartCondition)\nfilter_fromBoolFilter viewIDlookupMap filter =\n filter\n |> BoolFilter.conditions\n |> List.map (filter_partFromFilterCondition viewIDlookupMap)\n |> Result.Extra.combine\n\n\nfilter_toBoolFilter : List PartCondition -> BoolFilter.Root\nfilter_toBoolFilter parts =\n allPartsOrdered\n |> List.foldl (filter_toBoolFilter_addPart parts) BoolFilter.empty\n |> BoolFilter.collapse\n\n\nfilter_toBoolFilter_addPart : List PartCondition -> PartTemplate -> BoolFilter.Root -> BoolFilter.Root\nfilter_toBoolFilter_addPart allPartsInFilter (PartTemplate templatePart) filter =\n let\n haveSamePartTemplate_ (PartCondition partCondition) =\n haveSamePartTemplate templatePart partCondition\n in\n allPartsInFilter\n -- Filter parts for this template\n |> List.filter haveSamePartTemplate_\n |> filter_joinTemplateConditions\n -- And join using AND with the rest of the filter\n |> (\\joined -> BoolFilter.addAnd joined filter)\n\n\nfilter_joinTemplateConditions : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions conditions =\n let\n viewBranches =\n conditions\n |> List.filter isViewCondition\n |> filter_joinTemplateConditions_views\n\n tagBranches =\n conditions\n |> List.filter isTagCondition\n |> filter_joinTemplateConditions_tags\n\n restBranches : List BoolFilter.Branch\n restBranches =\n conditions\n |> List.filter isNeitherViewOrTagCondition\n |> List.map filter_toBoolFilter_partToCondition\n in\n (restBranches ++ [ viewBranches, tagBranches ])\n |> BoolFilter.joinBranchesUsingOr\n\n\nisViewCondition : PartCondition -> Bool\nisViewCondition (PartCondition part) =\n case part of\n Part_ViewSegment _ _ _ ->\n True\n\n _ ->\n False\n\n\nisTagCondition : PartCondition -> Bool\nisTagCondition (PartCondition part) =\n case part of\n Part_Tag _ _ ->\n True\n\n _ ->\n False\n\n\nisNeitherViewOrTagCondition : PartCondition -> Bool\nisNeitherViewOrTagCondition condition =\n not (isViewCondition condition)\n && not (isTagCondition condition)\n\n\n{-| View branches are special\nSame view needs to be joined with OR\nDifferent views need to be joined with AND\n-}\nfilter_joinTemplateConditions_views : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_views conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_ViewSegment _ id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_tags : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_tags conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_Tag id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_dimension :\n { getDimensionID : PartCondition -> Maybe String\n }\n -> List PartCondition\n -> BoolFilter.Branch\nfilter_joinTemplateConditions_dimension config conditionsForViews =\n let\n isSameDimensionID wantedID condition =\n config.getDimensionID condition == Just wantedID\n\n getConditionsFor wantedID =\n List.filter (isSameDimensionID wantedID) conditionsForViews\n\n joinGroup : List PartCondition -> BoolFilter.Branch\n joinGroup group =\n group\n |> List.map filter_toBoolFilter_partToCondition\n |> BoolFilter.joinBranchesUsingOr\n in\n conditionsForViews\n -- Collect the dimension ids\n |> List.filterMap config.getDimensionID\n -- Ensure the list is unique\n |> Set.fromList\n |> Set.toList\n -- For each collect the relevant conditions\n |> List.map getConditionsFor\n -- Join each of these groups using OR\n |> List.map joinGroup\n -- Join the groups using AND\n |> BoolFilter.joinBranchesUsingAnd\n\n\nfilter_toBoolFilter_partToCondition : PartCondition -> BoolFilter.Branch\nfilter_toBoolFilter_partToCondition (PartCondition part) =\n case part of\n Part_Arn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.arn\n arn\n |> BoolFilter.branchCondition\n\n Part_AwsAccountID id ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_account_id\n id\n |> BoolFilter.branchCondition\n\n Part_AwsProductCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_product_code\n code\n |> BoolFilter.branchCondition\n\n Part_AwsRegionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_region_code\n code\n |> BoolFilter.branchCondition\n\n Part_FinancialCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.financial_cost\n condition\n\n Part_UsageCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_cost\n condition\n\n Part_Kind kind ->\n BoolFilter.equalStr\n dimensionKeysV2.kind\n kind\n |> BoolFilter.branchCondition\n\n Part_PaymentOptionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.payment_option_code\n (PaymentOptionCode.toString code)\n |> BoolFilter.branchCondition\n\n Part_ReservationArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.reservation_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_ResourceType rt ->\n BoolFilter.equalStr\n dimensionKeysV2.resource_type\n rt\n |> BoolFilter.branchCondition\n\n Part_SavingsPlanArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.savings_plan_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_SubUsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.sub_usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_Tag k v ->\n BoolFilter.matchesStr\n (dimensionKeysV2.tags ++ \".\" ++ k)\n v\n |> BoolFilter.branchCondition\n\n Part_UsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_UsageQuantity condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_quantity\n condition\n\n Part_ViewSegment _ _ segmentID ->\n BoolFilter.listIncludes\n dimensionKeysV2.segment_ids\n segmentID\n |> BoolFilter.branchCondition\n\n\nboolFilterConditionsForNumeric : String -> NumericCondition -> BoolFilter.Branch\nboolFilterConditionsForNumeric key numericCondition =\n case numericCondition of\n NumericCondition_None ->\n BoolFilter.branchNoOp\n\n NumericCondition_MoreOrEqualThan value ->\n BoolFilter.moreOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_LessOrEqualThan value ->\n BoolFilter.lessOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_Between min max ->\n BoolFilter.and\n (BoolFilter.moreOrEqualThanStr key min |> BoolFilter.branchCondition)\n (BoolFilter.lessOrEqualThanStr key max |> BoolFilter.branchCondition)\n\n\n\n-- FILTER AND GROUP BY\n\n\nquery_encodeQuery : ReportQuery -> Encode.Value\nquery_encodeQuery reportQuery =\n let\n month =\n Format.monthInYearToISO reportQuery.selectedMonth\n in\n Encode.object\n [ ( \"version\", Encode.int 1 )\n , ( \"query\"\n , Encode.object\n [ ( \"duration\", Encode.string (month ++ \"T00:00:00.000Z/P1M\") )\n , ( \"group_by\", groupBys_jsonEncode reportQuery.groupBys )\n , ( \"where\", filter_toBoolFilter reportQuery.wheres |> filter_jsonEncode )\n ]\n )\n ]\n\n\nquery_decoder : Dict String String -> Decode.Decoder ReportQuery\nquery_decoder viewIDlookupMap =\n Decode.map3 ReportQuery\n (Decode.field \"duration\" monthDecoder)\n (Decode.field \"where\" (filter_jsonDecoder viewIDlookupMap))\n (Decode.field \"group_by\" groupBys_jsonDecoder)\n\n\nmonthDecoder : Decode.Decoder Times.MonthInYear\nmonthDecoder =\n Decode.string\n |> Decode.andThen\n (\\month ->\n case String.split \"T\" month of\n [ a, b ] ->\n case Times.isoToDate a of\n Nothing ->\n Decode.fail a\n\n Just date ->\n Times.dateToMonthInYear date\n |> Decode.succeed\n\n _ ->\n Decode.fail month\n )\n\n\ndateRange_setMonthInReportQuery : Times.MonthInYear -> ReportQuery -> ReportQuery\ndateRange_setMonthInReportQuery monthInYear query =\n { query\n | selectedMonth = monthInYear\n }\n\n\ndataRange_removeFromLocation : AppLocation -> AppLocation\ndataRange_removeFromLocation location =\n { location | query = dataRange_removeFromQuery location.query }\n\n\ndataRange_removeFromQuery : AppLocation.Query -> AppLocation.Query\ndataRange_removeFromQuery query =\n AppLocation.removeQuery (withNameSpace dimensionKeysV2.month) query\n\n\nfilter_setMonthInLocation : Times.MonthInYear -> AppLocation -> AppLocation\nfilter_setMonthInLocation monthInYear location =\n let\n iso =\n monthInYear\n |> Format.monthInYearToISO\n\n query =\n setQueryStr\n (withNameSpace dimensionKeysV2.month)\n iso\n location.query\n in\n { location\n | query = query\n }\n\n\nfilter_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\nfilter_removeAllPartsFromReportQuery query =\n { query\n | wheres = []\n }\n\n\nfilter_removeAllPartsFromLocation : AppLocation -> AppLocation\nfilter_removeAllPartsFromLocation location =\n { location | query = filter_removeAllPartsFromQuery location.query }\n\n\nfilter_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\nfilter_removeAllPartsFromQuery query =\n List.foldl\n filter_removePartDimensionFromQuery\n query\n allPartsOrdered\n\n\nfilter_removePartDimensionFromQuery : PartTemplate -> AppLocation.Query -> AppLocation.Query\nfilter_removePartDimensionFromQuery part query =\n AppLocation.removeQuery\n (queryKeyForPart part)\n query\n\n\nfilter_removePartConditionFromReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_removePartConditionFromReportQuery part query =\n { query\n | wheres = filter_removePartCondition part query.wheres\n }\n\n\nfilter_removePartConditionFromLocation : PartCondition -> AppLocation -> AppLocation\nfilter_removePartConditionFromLocation part location =\n { location | query = filter_removePartConditionFromQuery part location.query }\n\n\nfilter_removePartConditionFromQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_removePartConditionFromQuery part query =\n let\n newParts : List PartCondition\n newParts =\n query\n |> filter_partsFromQuery\n |> filter_removePartCondition part\n in\n query\n |> filter_setPartsInQuery newParts\n\n\nfilter_removePartCondition part parts =\n List.filter (isSamePartCondition part >> not) parts\n\n\nfilter_addPartsToLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_addPartsToLocation parts location =\n { location\n | query = filter_addPartsToLocationQuery parts location.query\n }\n\n\nfilter_addPartConditionToLocation : PartCondition -> AppLocation -> AppLocation\nfilter_addPartConditionToLocation part location =\n { location\n | query = filter_addPartToLocationQuery part location.query\n }\n\n\nfilter_addPartConditionToReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartConditionToReportQuery part query =\n { query\n | wheres = part :: query.wheres\n }\n\n\nfilter_addPartsToLocationQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartsToLocationQuery parts query =\n List.foldl filter_addPartToLocationQuery query parts\n\n\nfilter_addPartToLocationQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartToLocationQuery (PartCondition part) query =\n case part of\n Part_Arn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.arn)\n arn\n query\n\n Part_AwsAccountID id ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_account_id)\n id\n query\n\n Part_AwsProductCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_product_code)\n code\n query\n\n Part_AwsRegionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_region_code)\n code\n query\n\n Part_FinancialCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.financial_cost)\n condition\n query\n\n Part_UsageCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_cost)\n condition\n query\n\n Part_Kind kind ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.kind)\n kind\n query\n\n Part_PaymentOptionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.payment_option_code)\n (PaymentOptionCode.toString code)\n query\n\n Part_ReservationArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.reservation_arn)\n arn\n query\n\n Part_ResourceType rt ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.resource_type)\n rt\n query\n\n Part_SavingsPlanArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n arn\n query\n\n Part_SubUsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.sub_usage_code)\n code\n query\n\n Part_Tag k v ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.tags)\n (k ++ valueKeySeparator ++ v)\n query\n\n Part_UsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.usage_code)\n code\n query\n\n Part_UsageQuantity condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_quantity)\n condition\n query\n\n Part_ViewSegment v s ->\n -- rd.segments[]=974|104302&rd.segments[]=849|102740\n addListValueToQuery\n (withNameSpace dimensionKeysV2.segment_ids)\n (v ++ valueKeySeparator ++ s)\n query\n\n\naddNumericConditionToQuery : String -> NumericCondition -> AppLocation.Query -> AppLocation.Query\naddNumericConditionToQuery key numericCondition query =\n let\n value =\n encodeNumericCondition numericCondition\n in\n case numericCondition of\n NumericCondition_None ->\n removeQuery key query\n\n _ ->\n query\n |> addSingleValueToQuery\n key\n value\n\n\naddSingleValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddSingleValueToQuery key value query =\n setQueryStr key value query\n\n\naddListValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddListValueToQuery key value query =\n let\n currentValues =\n getQueryAsStringList key query\n\n nextValues =\n (currentValues ++ [ value ]) |> List.Extra.unique\n in\n setQueryListStr\n key\n nextValues\n query\n\n\nfilter_addPartsToReportQuery : List PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartsToReportQuery parts query =\n { query\n | wheres = parts ++ query.wheres |> filter_uniqueParts\n }\n\n\nfilter_uniqueParts : List PartCondition -> List PartCondition\nfilter_uniqueParts parts =\n List.Extra.uniqueBy codeForPartConditionUnique parts\n\n\n{-| Replace the current parts with the given list\n-}\nfilter_setPartsInLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_setPartsInLocation parts location =\n { location | query = filter_setPartsInQuery parts location.query }\n\n\nfilter_setPartsInQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_setPartsInQuery parts query =\n query\n |> filter_removeAllPartsFromQuery\n |> filter_addPartsToLocationQuery parts\n\n\ngroupBys_setGroupBysInLocation : List PartDimension -> AppLocation -> AppLocation\ngroupBys_setGroupBysInLocation groupByParts location =\n location\n |> setQueryListStrInLocation\n queryKeys.exploreData.groupBy\n (List.filterMap groupBys_partToCode groupByParts)\n\n\nmaybeUnrwap_Part_Tag part =\n case part of\n Part_Tag k v ->\n Just ( k, v )\n\n _ ->\n Nothing\n\n\nmaybeUnrwap_Part_ViewSegment part =\n case part of\n Part_ViewSegment v s ->\n Just ( v, s )\n\n _ ->\n Nothing\n\n\nselectedMonthFromLocation : AppLocation -> Maybe String\nselectedMonthFromLocation location =\n location.query\n |> getStringFromQuery\n (withNameSpace dimensionKeysV2.month)\n\n\nselectedMonthFromLocationAsTime : AppLocation -> Maybe Posix\nselectedMonthFromLocationAsTime =\n selectedMonthFromLocation\n >> Maybe.andThen (Times.posixFromIso >> Result.toMaybe)\n\n\nselectedMonthFromLocationAsDate : AppLocation -> Maybe Date\nselectedMonthFromLocationAsDate =\n selectedMonthFromLocation\n >> Maybe.andThen (Date.fromIsoString >> Result.toMaybe)\n\n\nselectedMonthFromLocationWithDefault : Context -> Posix\nselectedMonthFromLocationWithDefault context =\n selectedMonthFromLocationAsTime context.location\n |> Maybe.withDefault (Times.beginningOfMonth Time.utc context.currentTime)\n\n\nselectedMonthFromLocationWithDefaultAsMonth : Context -> Times.MonthInYear\nselectedMonthFromLocationWithDefaultAsMonth context =\n selectedMonthFromLocationAsDate context.location\n |> Maybe.map Times.dateToMonthInYear\n |> Maybe.withDefault (selectedMonthDefaultFromContext context)\n\n\nselectedMonthDefaultFromContext : Context -> Times.MonthInYear\nselectedMonthDefaultFromContext context =\n Date.fromPosix Time.utc context.currentTime\n |> Times.dateToMonthInYear\n\n\n\n-- helpers\n\n\ngetStringFromQuery : String -> Query -> Maybe String\ngetStringFromQuery key query =\n getQueryAsStr key query\n\n\nvalidateNumericCondition : NumericCondition -> Maybe NumericCondition\nvalidateNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n Nothing\n\n NumericCondition_LessOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_MoreOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_Between minValue maxValue ->\n if String.isEmpty minValue then\n Nothing\n\n else if String.isEmpty maxValue then\n Nothing\n\n else\n Maybe.map2\n (\\minFloat maxFloat ->\n NumericCondition_Between\n (String.fromFloat (min minFloat maxFloat))\n (String.fromFloat (max minFloat maxFloat))\n )\n (String.toFloat minValue)\n (String.toFloat maxValue)\n\n\nlocationForArn : String -> AppLocation -> AppLocation\nlocationForArn arn location =\n let\n condition =\n PartCondition (Part_Arn arn)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n\n\nlocationForViewSegment : String -> String -> AppLocation -> AppLocation\nlocationForViewSegment viewID segmentID location =\n let\n condition =\n PartCondition (Part_ViewSegment viewID segmentID)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n"
}
}
[Trace - 11:59:51 am] Received request 'workspace/configuration - (0)'.
Params: {
"items": [
{
"section": "elmLS"
}
]
}
[Trace - 11:59:51 am] Sending response 'workspace/configuration - (0)'. Processing request took 0ms
Result: [
{
"trace": {
"server": "verbose"
},
"elmPath": "",
"elmFormatPath": "",
"elmTestPath": "",
"disableElmLSDiagnostics": false,
"skipInstallPackageConfirmation": false,
"elmAnalyseTrigger": "never"
}
]
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined"
}
[Error - 11:59:51 am] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined
[Trace - 11:59:51 am] Sending request 'textDocument/documentSymbol - (1)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
}
}
[Trace - 11:59:51 am] Sending request 'textDocument/codeAction - (2)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
},
"range": {
"start": {
"line": 1764,
"character": 43
},
"end": {
"line": 1764,
"character": 43
}
},
"context": {
"diagnostics": []
}
}
TypeError: Cannot read property 'synchronize' of undefined
/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1
var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.TreeSitter=t()}(0,function(){var e,t={};for(e in Module)Module.hasOwnProperty(e)&&(t[e]=Module[e]);var r,n,s=[],o=function(e,t){throw t},_=!1,a=!1;_="object"==typeof window,a="function"==typeof importScripts,r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,n=!_&&!r&&!a;var i,u,l,d,c="";r?(c=a?require("path").dirname(c)+"/":__dirname+"/",i=function(e,t){return l||(l=require("fs")),d||(d=require("path")),e=d.normalize(e),l.readFileSync(e,t?null:"utf8")},u=function(e){var t=i(e,!0);return t.buffer||(t=new Uint8Array(t)),L(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),s=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),process.on("uncaughtExce
RuntimeError: abort(TypeError: Cannot read property 'synchronize' of undefined). Build with -s ASSERTIONS=1 for more info.
at process.fe (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1:10450)
at process.emit (events.js:228:7)
at processPromiseRejections (internal/process/promises.js:201:33)
at processTicksAndRejections (internal/process/task_queues.js:95:32)
[Info - 11:59:51 am] Connection to server got closed. Server will restart.
[Error - 11:59:51 am] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:223:5)
at Pipe.<anonymous> (net.js:664:12)
[Error - 11:59:51 am] Request textDocument/codeAction failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:223:5)
at Pipe.<anonymous> (net.js:664:12)
[Trace - 11:59:51 am] Sending request 'initialize - (0)'.
Params: {
"processId": 453470,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.52.1"
},
"locale": "en-gb",
"rootPath": "/home/sebastian/Source/staxio/stax",
"rootUri": "file:///home/sebastian/Source/staxio/stax",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": true
}
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
}
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true,
"semanticTokens": {
"refreshSupport": true
},
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
}
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"insertReplaceSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
},
"activeParameterSupport": true
},
"contextSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"honorsChangeAnnotations": false
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"prepareSupportDefaultBehavior": 1,
"honorsChangeAnnotations": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false
},
"linkedEditingRange": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "1.1.0"
}
}
},
"initializationOptions": {
"elmFormatPath": "",
"elmPath": "",
"elmTestPath": "",
"trace": {
"server": "verbose"
},
"extendedCapabilities": {
"moveFunctionRefactoringSupport": true,
"exposeUnexposeSupport": true
},
"disableElmLSDiagnostics": false
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/sebastian/Source/staxio/stax",
"name": "stax"
}
],
"workDoneToken": "aa5e37d5-4ca7-4ef4-a776-6506c44c6c9b"
}
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm"
}
[Info - 11:59:51 am] Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:51 am] Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:51 am] Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client"
}
[Info - 11:59:51 am] Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client
[Trace - 11:59:51 am] Received notification '$/progress'.
Params: {
"token": "aa5e37d5-4ca7-4ef4-a776-6506c44c6c9b",
"value": {
"kind": "begin",
"title": "Indexing Elm",
"percentage": 0
}
}
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Elm version 0.19.1 detected."
}
[Info - 11:59:51 am] Elm version 0.19.1 detected.
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json"
}
[Info - 11:59:51 am] Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 2,
"message": "{\"shortMessage\":\"Command failed with exit code 1: elm make\",\"command\":\"elm make\",\"exitCode\":1,\"stdout\":\"\",\"stderr\":\"\\n-- ERROR -----------------------------------------------------------------------\\n\\nI ran into something that bypassed the normal error reporting process! I\\nextracted whatever information I could from the internal error:\\n\\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\\nThese errors are usually pretty confusing, so start by asking around on one of\\nforums listed at https://elm-lang.org/community to see if anyone can get you\\nunstuck quickly.\\n\\n-- REQUEST ---------------------------------------------------------------------\\n\\nIf you are feeling up to it, please try to get your code down to the smallest\\nversion that still triggers this message. Ideally in a single Main.elm and\\nelm.json file.\\n\\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\\nabout if someone else saw something similar. More examples is better!\\n\\nThis kind of error is usually tied up in larger architectural choices that are\\nhard to change, so even when we have a couple good examples, it can take some\\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\",\"failed\":true,\"timedOut\":false,\"isCanceled\":false,\"killed\":false}"
}
[Warn - 11:59:51 am] {"shortMessage":"Command failed with exit code 1: elm make","command":"elm make","exitCode":1,"stdout":"","stderr":"\n-- ERROR -----------------------------------------------------------------------\n\nI ran into something that bypassed the normal error reporting process! I\nextracted whatever information I could from the internal error:\n\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n\nThese errors are usually pretty confusing, so start by asking around on one of\nforums listed at https://elm-lang.org/community to see if anyone can get you\nunstuck quickly.\n\n-- REQUEST ---------------------------------------------------------------------\n\nIf you are feeling up to it, please try to get your code down to the smallest\nversion that still triggers this message. Ideally in a single Main.elm and\nelm.json file.\n\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\nabout if someone else saw something similar. More examples is better!\n\nThis kind of error is usually tied up in larger architectural choices that are\nhard to change, so even when we have a couple good examples, it can take some\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n","failed":true,"timedOut":false,"isCanceled":false,"killed":false}
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:\nError: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'"
}
[Error - 11:59:51 am] Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:
Error: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'
[Trace - 11:59:51 am] Received notification '$/progress'.
Params: {
"token": "aa5e37d5-4ca7-4ef4-a776-6506c44c6c9b",
"value": {
"kind": "end"
}
}
[Trace - 11:59:51 am] Received response 'initialize - (0)' in 516ms.
Result: {
"capabilities": {
"codeActionProvider": {
"resolveProvider": true
},
"codeLensProvider": {
"resolveProvider": true
},
"completionProvider": {
"triggerCharacters": [
"."
]
},
"definitionProvider": true,
"documentFormattingProvider": true,
"documentSymbolProvider": {
"label": "Elm"
},
"executeCommandProvider": {
"commands": [
"elmLS.elmMakeFixer-947af10eeb73ace63e95fdafe233121c",
"elm.installPackage"
]
},
"foldingRangeProvider": true,
"hoverProvider": true,
"referencesProvider": true,
"renameProvider": {
"prepareProvider": true
},
"selectionRangeProvider": true,
"textDocumentSync": 2,
"workspaceSymbolProvider": true,
"workspace": {
"fileOperations": {
"didCreate": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
},
"willRename": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
},
{
"scheme": "file",
"pattern": {
"glob": "**/",
"matches": "folder"
}
}
]
},
"willDelete": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
}
}
},
"linkedEditingRangeProvider": true
}
}
[Trace - 11:59:51 am] Sending notification 'initialized'.
Params: {}
[Trace - 11:59:51 am] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm",
"languageId": "elm",
"version": 1,
"text": "module Elements.RawDataV3.Filter exposing\n ( allPartsOrdered\n , baseParts\n , codeForPartCondition\n , codeForPartDimension\n , codeForPartTemplate\n , dataRange_removeFromLocation\n , dateRange_setMonthInReportQuery\n , decodeNumericCondition\n , dimensionKeysV2\n , encodeNumericCondition\n , filter_addPartConditionToLocation\n , filter_addPartConditionToReportQuery\n , filter_addPartToLocationQuery\n , filter_addPartsToLocation\n , filter_addPartsToLocationQuery\n , filter_addPartsToReportQuery\n , filter_canAddPart\n , filter_fromBoolFilter\n , filter_getWhereComponents_fromGlobal\n , filter_hasPart\n , filter_jsonDecoder\n , filter_partFromFilterCondition\n , filter_partsFromLocation\n , filter_partsFromQuery\n , filter_removeAllPartsFromLocation\n , filter_removeAllPartsFromReportQuery\n , filter_removePartConditionFromLocation\n , filter_removePartConditionFromReportQuery\n , filter_setMonthInLocation\n , filter_setPartsInLocation\n , filter_toBoolFilter\n , filter_validateAndCorrectCondition\n , groupBys_add\n , groupBys_addToReportQuery\n , groupBys_canUsePart\n , groupBys_fromLocation\n , groupBys_hasAny\n , groupBys_hasPart\n , groupBys_jsonDecoder\n , groupBys_jsonEncode\n , groupBys_remove\n , groupBys_removeAllPartsFromLocation\n , groupBys_removeAllPartsFromReportQuery\n , groupBys_removeFromReportQuery\n , groupBys_setGroupBysInLocation\n , haveSamePartDimension\n , isSamePartCondition\n , isSamePartDimension\n , locationForArn\n , locationForViewSegment\n , partConditionConstructor\n , partConditionToDimension\n , partCondition_haveSameDimension\n , query_decoder\n , query_encodeQuery\n , query_getReportQueryFromLocation\n , query_isEmpty\n , query_setInLocation\n , selectedMonthDefaultFromContext\n , selectedMonthFromLocationWithDefault\n , templateParts\n , withNameSpace\n )\n\nimport Api.Enum.BillingData_PaymentOptionCode as PaymentOptionCode\nimport Date exposing (Date)\nimport Dict exposing (Dict)\nimport Elements.RawDataV3.Types exposing (..)\nimport Json.Decode as Decode\nimport Json.Encode as Encode\nimport Json.Encode.Extra as EncodeExtra\nimport List.Extra\nimport Result.Extra\nimport Set exposing (Set)\nimport Shared.AppLocation as AppLocation exposing (..)\nimport Shared.BoolFilterV2 as BoolFilter\nimport Shared.Context exposing (Context)\nimport Shared.Format as Format\nimport Shared.GlobalFilters as GlobalFilters\nimport Shared.Routes as Routes\nimport Shared.Times as Times\nimport Time exposing (Posix)\n\n\ntemplateParts =\n { arn = Part_Arn \"\"\n , awsAccountID = Part_AwsAccountID \"\"\n , awsProductCode = Part_AwsProductCode \"\"\n , awsRegionCode = Part_AwsRegionCode \"\"\n , financialCost = Part_FinancialCost NumericCondition_None\n , kind = Part_Kind \"\"\n , paymentOptionCode = Part_PaymentOptionCode PaymentOptionCode.Standard\n , reservationArn = Part_ReservationArn \"\"\n , resourceType = Part_ResourceType \"\"\n , savingPlanArn = Part_SavingsPlanArn \"\"\n , subUsageCode = Part_SubUsageCode \"\"\n , tag = Part_Tag \"\" \"\"\n , usageCode = Part_UsageCode \"\"\n , usageCost = Part_UsageCost NumericCondition_None\n , usageQuantity = Part_UsageQuantity NumericCondition_None\n , viewSegment = Part_ViewSegment \"\" \"\"\n }\n\n\ntemplatePartForPart : Part -> PartTemplate\ntemplatePartForPart part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag _ _ ->\n templateParts.tag\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment _ _ _ ->\n templateParts.viewSegment\n in\n PartTemplate part_\n\n\n{-| Is fine to go from specific to general\n-}\npartConditionToDimension : PartCondition -> PartDimension\npartConditionToDimension (PartCondition part) =\n PartDimension part\n\n\npartToPartDimension : Part -> PartDimension\npartToPartDimension part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag key _ ->\n Part_Tag key \"\"\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment global viewID _ ->\n Part_ViewSegment global viewID \"\"\n in\n PartDimension part_\n\n\nallPartsOrdered : List PartTemplate\nallPartsOrdered =\n let\n {-\n This function is useless but will cause the\n compiler to fail if types arent added here. It is\n up to the developer to ensure the are also in the\n return list. This is a work around for union types\n not being iterable\n -}\n ignored thing =\n case thing of\n Part_Arn _ ->\n []\n\n Part_AwsAccountID _ ->\n []\n\n Part_AwsProductCode _ ->\n []\n\n Part_AwsRegionCode _ ->\n []\n\n Part_FinancialCost _ ->\n []\n\n Part_UsageCost _ ->\n []\n\n Part_Kind _ ->\n []\n\n Part_PaymentOptionCode _ ->\n []\n\n Part_ReservationArn _ ->\n []\n\n Part_ResourceType _ ->\n []\n\n Part_SavingsPlanArn _ ->\n []\n\n Part_SubUsageCode _ ->\n []\n\n Part_Tag _ _ ->\n []\n\n Part_UsageCode _ ->\n []\n\n Part_UsageQuantity _ ->\n []\n\n Part_ViewSegment _ _ _ ->\n []\n in\n -- All parts ordered for iteration in UI\n [ templateParts.viewSegment\n , templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n , templateParts.tag\n ]\n ++ ignored (Part_Arn \"\")\n |> List.map PartTemplate\n\n\n{-| Same as all, but without view and tags which are iterated differently\n-}\nbaseParts : List PartTemplate\nbaseParts =\n [ templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n ]\n |> List.map PartTemplate\n\n\n{-| Some conditions can be constructed by providing a single String\n-}\npartConditionConstructor : PartDimension -> Maybe (String -> PartCondition)\npartConditionConstructor (PartDimension part) =\n let\n maybeConstructor =\n case part of\n Part_Arn _ ->\n Just Part_Arn\n\n Part_AwsAccountID _ ->\n Just Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n Just Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n Just Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n Nothing\n\n Part_UsageCost _ ->\n Nothing\n\n Part_Kind _ ->\n Just Part_Kind\n\n Part_PaymentOptionCode _ ->\n (\\s ->\n Part_PaymentOptionCode\n (s\n |> PaymentOptionCode.fromString\n |> Maybe.withDefault PaymentOptionCode.Standard\n )\n )\n |> Just\n\n Part_ReservationArn _ ->\n Just Part_ReservationArn\n\n Part_ResourceType _ ->\n Just Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n Just Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n Just Part_SubUsageCode\n\n Part_Tag key _ ->\n Just (Part_Tag key)\n\n Part_UsageCode _ ->\n Just Part_UsageCode\n\n Part_UsageQuantity _ ->\n Nothing\n\n Part_ViewSegment global view _ ->\n Just (Part_ViewSegment global view)\n in\n case maybeConstructor of\n Nothing ->\n Nothing\n\n Just constructor ->\n Just (constructor >> PartCondition)\n\n\nfilter_hasPart : PartCondition -> List PartCondition -> Bool\nfilter_hasPart part parts =\n case List.Extra.find (isSamePartCondition part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\nfilter_canAddPart : PartCondition -> List PartCondition -> Bool\nfilter_canAddPart part parts =\n if filter_hasPart part parts then\n filter_canAddMultipleOf part\n\n else\n True\n\n\nfilter_validateAndCorrectCondition : PartCondition -> Maybe PartCondition\nfilter_validateAndCorrectCondition (PartCondition part) =\n let\n validateValue value =\n if String.isEmpty value then\n Nothing\n\n else\n Just part\n\n validatedPart =\n case part of\n Part_Arn value ->\n validateValue value\n\n Part_AwsAccountID value ->\n validateValue value\n\n Part_AwsProductCode value ->\n validateValue value\n\n Part_AwsRegionCode value ->\n validateValue value\n\n Part_FinancialCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_FinancialCost corrected)\n\n Part_UsageCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageCost corrected)\n\n Part_Kind value ->\n validateValue value\n\n Part_PaymentOptionCode _ ->\n Just part\n\n Part_ReservationArn value ->\n validateValue value\n\n Part_ResourceType value ->\n validateValue value\n\n Part_SavingsPlanArn value ->\n validateValue value\n\n Part_SubUsageCode value ->\n validateValue value\n\n Part_Tag _ value ->\n validateValue value\n\n Part_UsageCode value ->\n validateValue value\n\n Part_UsageQuantity numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageQuantity corrected)\n\n Part_ViewSegment _ _ segmentID ->\n validateValue segmentID\n in\n validatedPart |> Maybe.map PartCondition\n\n\nfilter_canAddMultipleOf : PartCondition -> Bool\nfilter_canAddMultipleOf (PartCondition part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\nfilter_addPart : PartCondition -> List PartCondition -> List PartCondition\nfilter_addPart part parts =\n if filter_canAddPart part parts then\n parts ++ [ part ]\n\n else\n parts\n\n\nremovePartDimension : PartDimension -> List PartDimension -> List PartDimension\nremovePartDimension part parts =\n parts\n |> List.Extra.filterNot (isSamePartDimension part)\n\n\nremovePartCondition : PartCondition -> List PartCondition -> List PartCondition\nremovePartCondition part parts =\n parts\n |> List.Extra.filterNot (isSamePartCondition part)\n\n\n{-| These are the same template part if they use the same constructor\n-}\nhaveSamePartTemplate : Part -> Part -> Bool\nhaveSamePartTemplate a b =\n templatePartForPart a == templatePartForPart b\n\n\nisSamePartDimension : PartDimension -> PartDimension -> Bool\nisSamePartDimension (PartDimension a) (PartDimension b) =\n haveSamePartDimension a b\n\n\npartCondition_haveSameDimension : PartCondition -> PartCondition -> Bool\npartCondition_haveSameDimension (PartCondition a) (PartCondition b) =\n haveSamePartDimension a b\n\n\n{-| View and Tag are the same dimension if they have the same view or tag key\n-}\nhaveSamePartDimension : Part -> Part -> Bool\nhaveSamePartDimension a b =\n partToPartDimension a == partToPartDimension b\n\n\nisSamePartCondition : PartCondition -> PartCondition -> Bool\nisSamePartCondition a b =\n a == b\n\n\nfilter_partsFromLocation : AppLocation -> List PartCondition\nfilter_partsFromLocation location =\n filter_partsFromQuery location.query\n\n\nfilter_partsFromQuery : Query -> List PartCondition\nfilter_partsFromQuery query =\n allPartsOrdered\n |> List.concatMap (filter_partFromQuery query)\n |> filter_uniqueParts\n\n\n{-| Given a template part e.g. Part\\_Arn \"\"\nThis may return multiple parts [Part_Arn \"123\", Part_Arn \"456\"]\n-}\nfilter_partFromQuery : Query -> PartTemplate -> List PartCondition\nfilter_partFromQuery query (PartTemplate templatePart) =\n let\n parsePair pair =\n case String.split valueKeySeparator pair of\n [ a, b ] ->\n Just ( a, b )\n\n _ ->\n Nothing\n\n partConditions =\n case templatePart of\n Part_Arn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.arn)\n |> List.map Part_Arn\n\n Part_AwsAccountID _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_account_id)\n |> List.map Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_product_code)\n |> List.map Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_region_code)\n |> List.map Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n filter_getNumericInputFromQuery\n Part_FinancialCost\n (withNameSpace dimensionKeysV2.financial_cost)\n query\n\n Part_UsageCost _ ->\n filter_getNumericInputFromQuery\n Part_UsageCost\n (withNameSpace dimensionKeysV2.usage_cost)\n query\n\n Part_Kind _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.kind)\n |> List.map Part_Kind\n\n Part_PaymentOptionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.payment_option_code)\n |> List.filterMap PaymentOptionCode.fromString\n |> List.map Part_PaymentOptionCode\n\n Part_ReservationArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.reservation_arn)\n |> List.map Part_ReservationArn\n\n Part_ResourceType _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.resource_type)\n |> List.map Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n |> List.map Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.sub_usage_code)\n |> List.map Part_SubUsageCode\n\n Part_Tag _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.tags)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_Tag a b)\n\n Part_UsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.usage_code)\n |> List.map Part_UsageCode\n\n Part_UsageQuantity _ ->\n filter_getNumericInputFromQuery\n Part_UsageQuantity\n (withNameSpace dimensionKeysV2.usage_quantity)\n query\n\n Part_ViewSegment _ _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.segment_ids)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_ViewSegment a b)\n in\n partConditions |> List.map PartCondition\n\n\nfilter_partFromFilterCondition : Dict String String -> BoolFilter.Condition -> Result String PartCondition\nfilter_partFromFilterCondition viewIDlookupMap filterCondition =\n let\n keys =\n dimensionKeysV2\n\n ( key, val ) =\n case filterCondition of\n BoolFilter.Eq pair ->\n pair\n\n BoolFilter.NotEq pair ->\n pair\n\n BoolFilter.LessOrEqualThan pair ->\n pair\n\n BoolFilter.LessThan pair ->\n pair\n\n BoolFilter.ListIncludes pair ->\n pair\n\n BoolFilter.Matches pair ->\n pair\n\n BoolFilter.MoreOrEqualThan pair ->\n pair\n\n BoolFilter.MoreThan pair ->\n pair\n\n numericCondition =\n case filterCondition of\n BoolFilter.Eq _ ->\n NumericCondition_None\n\n BoolFilter.NotEq _ ->\n NumericCondition_None\n\n BoolFilter.LessOrEqualThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.LessThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.ListIncludes _ ->\n NumericCondition_None\n\n BoolFilter.Matches _ ->\n NumericCondition_None\n\n BoolFilter.MoreOrEqualThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n BoolFilter.MoreThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n part : Result String Part\n part =\n if key == keys.arn then\n Ok (Part_Arn val)\n\n else if key == keys.aws_account_id then\n Ok (Part_AwsAccountID val)\n\n else if key == keys.aws_product_code then\n Ok (Part_AwsProductCode val)\n\n else if key == keys.aws_region_code then\n Ok (Part_AwsRegionCode val)\n\n else if key == keys.financial_cost then\n Ok (Part_FinancialCost numericCondition)\n\n else if key == keys.usage_cost then\n Ok (Part_UsageCost numericCondition)\n\n else if key == keys.kind then\n Ok (Part_Kind val)\n\n else if key == keys.payment_option_code then\n PaymentOptionCode.fromString val\n |> Result.fromMaybe val\n |> Result.map Part_PaymentOptionCode\n\n else if key == keys.reservation_arn then\n Ok (Part_ReservationArn val)\n\n else if key == keys.resource_type then\n Ok (Part_ResourceType val)\n\n else if key == keys.savings_plan_arn then\n Ok (Part_SavingsPlanArn val)\n\n else if key == keys.sub_usage_code then\n Ok (Part_SubUsageCode val)\n\n else if String.startsWith \"tags\" key then\n case String.split \".\" key of\n [ a, b ] ->\n Ok (Part_Tag b val)\n\n _ ->\n Err key\n\n else if key == keys.usage_code then\n Ok (Part_UsageCode val)\n\n else if key == keys.usage_quantity then\n Ok (Part_UsageQuantity numericCondition)\n\n else if key == keys.segment_ids then\n case Dict.get val viewIDlookupMap of\n Nothing ->\n Err val\n\n Just viewID ->\n Ok (Part_ViewSegment viewID val)\n\n else\n Err key\n in\n part |> Result.map PartCondition\n\n\nfilter_getNumericInputFromQuery :\n (NumericCondition -> Part)\n -> String\n -> AppLocation.Query\n -> List Part\nfilter_getNumericInputFromQuery constructor queryKey query =\n case filter_getNumericConditionFromQuery queryKey query of\n Nothing ->\n []\n\n Just condition ->\n [ constructor condition ]\n\n\nfilter_getNumericConditionFromQuery :\n String\n -> AppLocation.Query\n -> Maybe NumericCondition\nfilter_getNumericConditionFromQuery queryKey query =\n getStringFromQuery queryKey query\n |> Maybe.andThen decodeNumericCondition\n\n\ngroupBys_fromLocation : AppLocation -> List PartDimension\ngroupBys_fromLocation location =\n let\n groupBys =\n getQueryAsStringList queryKeys.exploreData.groupBy location.query\n in\n List.filterMap groupBys_codeToPart groupBys\n\n\ngroupBys_canUsePart : PartDimension -> Bool\ngroupBys_canUsePart (PartDimension part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\ngroupBys_hasAny location =\n groupBys_fromLocation location\n |> List.isEmpty\n |> not\n\n\ngroupBys_add : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_add part parts =\n if groupBys_hasPart part parts then\n parts\n\n else\n parts ++ [ part ]\n\n\ngroupBys_addToReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_addToReportQuery part query =\n { query\n | groupBys = groupBys_add part query.groupBys\n }\n\n\ngroupBys_hasPart : PartDimension -> List PartDimension -> Bool\ngroupBys_hasPart part parts =\n case List.Extra.find (isSamePartDimension part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\ngroupBys_remove : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_remove =\n removePartDimension\n\n\ngroupBys_removeFromReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_removeFromReportQuery part query =\n { query\n | groupBys = groupBys_remove part query.groupBys\n }\n\n\ngroupBys_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\ngroupBys_removeAllPartsFromReportQuery query =\n { query | groupBys = [] }\n\n\ngroupBys_removeAllPartsFromLocation : AppLocation -> AppLocation\ngroupBys_removeAllPartsFromLocation location =\n { location | query = groupBys_removeAllPartsFromQuery location.query }\n\n\ngroupBys_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\ngroupBys_removeAllPartsFromQuery query =\n AppLocation.removeQuery\n queryKeys.exploreData.groupBy\n query\n\n\n{-| Parts that cannot be grouped by will return Nothing\n-}\ngroupBys_partToCode : PartDimension -> Maybe String\ngroupBys_partToCode partDimension =\n if groupBys_canUsePart partDimension then\n Just (codeForPartDimension partDimension)\n\n else\n Nothing\n\n\ngroupBys_codeToPart : String -> Maybe PartDimension\ngroupBys_codeToPart code =\n let\n dims =\n dimensionKeysV2\n\n partCondition =\n if code == dims.arn then\n Just templateParts.arn\n\n else if code == dims.aws_account_id then\n Just templateParts.awsAccountID\n\n else if code == dims.aws_product_code then\n Just templateParts.awsProductCode\n\n else if code == dims.aws_region_code then\n Just templateParts.awsRegionCode\n\n else if code == dims.financial_cost then\n Just templateParts.financialCost\n\n else if code == dims.kind then\n Just templateParts.kind\n\n else if code == dims.payment_option_code then\n Just templateParts.paymentOptionCode\n\n else if code == dims.reservation_arn then\n Just templateParts.reservationArn\n\n else if code == dims.resource_type then\n Just templateParts.resourceType\n\n else if code == dims.savings_plan_arn then\n Just templateParts.savingPlanArn\n\n else if code == dims.sub_usage_code then\n Just templateParts.subUsageCode\n\n else if code == dims.usage_code then\n Just templateParts.usageCode\n\n else if code == dims.usage_cost then\n Just templateParts.usageCost\n\n else if code == dims.usage_quantity then\n Just templateParts.usageQuantity\n\n else if String.startsWith groupByOnlyKeys.tag code then\n Just (Part_Tag (String.replace groupByOnlyKeys.tag \"\" code) \"\")\n\n else if String.startsWith groupByOnlyKeys.viewId code then\n Just (Part_ViewSegment (String.replace groupByOnlyKeys.viewId \"\" code) \"\")\n\n else\n -- Ignored\n -- month\n Nothing\n in\n Maybe.map PartDimension partCondition\n\n\ngroupBys_jsonEncode : List PartDimension -> Encode.Value\ngroupBys_jsonEncode parts =\n parts\n |> List.filterMap groupBys_partToCode\n |> Encode.list Encode.string\n\n\ngroupBys_jsonDecoder : Decode.Decoder (List PartDimension)\ngroupBys_jsonDecoder =\n Decode.list groupBys_jsonDimensionDecoder\n\n\ngroupBys_jsonDimensionDecoder : Decode.Decoder PartDimension\ngroupBys_jsonDimensionDecoder =\n Decode.string\n |> Decode.andThen\n (\\code ->\n case groupBys_codeToPart code of\n Nothing ->\n Decode.fail \"code\"\n\n Just part ->\n Decode.succeed part\n )\n\n\n{-| Dimension keys\nUsed for the URL query string and the API Query\nThese must not be changed as they are expected like this by the API\n-}\ndimensionKeysV2 =\n { arn = \"arn\"\n , aws_account_id = \"linked_account_id\"\n , aws_product_code = \"product_code\"\n , aws_region_code = \"region_code\"\n , financial_cost = \"unallocated_unblended_cost\"\n , kind = \"kind\"\n , month = \"month\"\n , payment_option_code = \"payment_option_code\"\n , reservation_arn = \"reservation_arn\"\n , resource_type = \"resource_type\"\n , savings_plan_arn = \"savings_plan_arn\"\n , segment_ids = \"segment_ids\"\n , sub_usage_code = \"sub_usage_code\"\n , tags = \"tags\"\n , usage_code = \"usage_code\"\n , usage_cost = \"unallocated_amortised_cost\"\n , usage_quantity = \"total_usage_quantity\"\n }\n\n\nnamespace =\n \"rd.\"\n\n\nwithNameSpace key =\n namespace ++ key\n\n\nvalueKeySeparator =\n \"|\"\n\n\ngroupByOnlyKeys =\n { tag = \"tags.\"\n , viewId = \"viewId.\"\n }\n\n\ncodeForPartTemplate : PartTemplate -> String\ncodeForPartTemplate (PartTemplate part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n groupByOnlyKeys.tag\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n groupByOnlyKeys.viewId\n\n\ncodeForPartDimension : PartDimension -> String\ncodeForPartDimension (PartDimension part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag k _ ->\n groupByOnlyKeys.tag ++ k\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ viewId _ ->\n groupByOnlyKeys.viewId ++ viewId\n\n\ncodeForPartCondition : PartCondition -> String\ncodeForPartCondition (PartCondition part) =\n codeForPartDimension (PartDimension part)\n\n\n{-| A unique code for a part condition\nUsed for removing duplicates\n-}\ncodeForPartConditionUnique : PartCondition -> String\ncodeForPartConditionUnique (PartCondition part) =\n case part of\n Part_Arn arn ->\n dimensionKeysV2.arn ++ arn\n\n Part_AwsAccountID id ->\n dimensionKeysV2.aws_account_id ++ id\n\n Part_AwsProductCode code ->\n dimensionKeysV2.aws_product_code ++ code\n\n Part_AwsRegionCode code ->\n dimensionKeysV2.aws_region_code ++ code\n\n Part_FinancialCost condition ->\n dimensionKeysV2.financial_cost ++ encodeNumericCondition condition\n\n Part_UsageCost condition ->\n dimensionKeysV2.usage_cost ++ encodeNumericCondition condition\n\n Part_Kind kind ->\n dimensionKeysV2.kind ++ kind\n\n Part_PaymentOptionCode code ->\n dimensionKeysV2.payment_option_code ++ PaymentOptionCode.toString code\n\n Part_ReservationArn arn ->\n dimensionKeysV2.reservation_arn ++ arn\n\n Part_ResourceType type_ ->\n dimensionKeysV2.resource_type ++ type_\n\n Part_SavingsPlanArn arn ->\n dimensionKeysV2.savings_plan_arn ++ arn\n\n Part_SubUsageCode code ->\n dimensionKeysV2.sub_usage_code ++ code\n\n Part_Tag k v ->\n groupByOnlyKeys.tag ++ k ++ \"=\" ++ v\n\n Part_UsageCode code ->\n dimensionKeysV2.usage_code ++ code\n\n Part_UsageQuantity condition ->\n dimensionKeysV2.usage_quantity ++ encodeNumericCondition condition\n\n Part_ViewSegment _ viewId segmentID ->\n groupByOnlyKeys.viewId ++ viewId ++ segmentID\n\n\n{-| Used in the query string too\nMust be query string safe. Dont' use:\n\n : / ? # [ ] @ ! $ & ' ( ) * + , ; =\n\nOk to use:\n\n - . _ ~\n\nUsed like\n\n ?rd.usage_cost=between.123~344&...\n\n-}\nencodeNumericCondition : NumericCondition -> String\nencodeNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n \"none\"\n\n NumericCondition_MoreOrEqualThan value ->\n \"get_\" ++ value\n\n NumericCondition_LessOrEqualThan value ->\n \"let_\" ++ value\n\n NumericCondition_Between one two ->\n \"between_\" ++ one ++ \"~\" ++ two\n\n\ndecodeNumericCondition : String -> Maybe NumericCondition\ndecodeNumericCondition value =\n case String.split \"_\" value of\n [ operation, body ] ->\n case operation of\n \"get\" ->\n Just (NumericCondition_MoreOrEqualThan body)\n\n \"let\" ->\n Just (NumericCondition_LessOrEqualThan body)\n\n \"between\" ->\n case String.split \"~\" body of\n [ min, max ] ->\n Just (NumericCondition_Between min max)\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n\n{-|\n\n e.g. rd.segment_ids\n\n-}\nqueryKeyForPart : PartTemplate -> String\nqueryKeyForPart (PartTemplate part) =\n let\n key =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n dimensionKeysV2.tags\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n dimensionKeysV2.segment_ids\n in\n withNameSpace key\n\n\n\n-- FILTER\n\n\nquery_getReportQueryFromLocation : Context -> List Segment -> ReportQuery\nquery_getReportQueryFromLocation context availableSegments =\n let\n selectedMonth =\n selectedMonthFromLocationWithDefaultAsMonth context\n\n whereFilterComponents : List PartCondition\n whereFilterComponents =\n filter_getWhereComponents\n context\n availableSegments\n\n groupBys : List PartDimension\n groupBys =\n groupBys_fromLocation\n context.location\n in\n { selectedMonth = selectedMonth\n , wheres = whereFilterComponents\n , groupBys = groupBys\n }\n\n\nquery_setInLocation : ReportQuery -> AppLocation -> AppLocation\nquery_setInLocation query location =\n location\n |> filter_setMonthInLocation query.selectedMonth\n |> filter_setPartsInLocation query.wheres\n |> groupBys_setGroupBysInLocation query.groupBys\n\n\nquery_isEmpty : ReportQuery -> Bool\nquery_isEmpty query =\n List.isEmpty query.wheres && List.isEmpty query.groupBys\n\n\nfilter_jsonEncode : BoolFilter.Root -> Encode.Value\nfilter_jsonEncode =\n BoolFilter.jsonEncode\n\n\nfilter_getWhereComponents :\n Context\n -> List Segment\n -> List PartCondition\nfilter_getWhereComponents context availableSegments =\n let\n globalFilterParts : List PartCondition\n globalFilterParts =\n filter_getWhereComponents_fromGlobal\n context\n availableSegments\n\n parts =\n context.location\n |> filter_partsFromLocation\n |> (++) globalFilterParts\n |> filter_uniqueParts\n in\n parts\n\n\nfilter_getWhereComponents_fromGlobal : Context -> List Segment -> List PartCondition\nfilter_getWhereComponents_fromGlobal context availableSegments =\n filter_getSelectedSegmentsForGlobalFilter context availableSegments\n |> List.map\n (\\{ viewDbId, dbID } ->\n Part_ViewSegment (unwrapDbID viewDbId) (unwrapDbID dbID) |> PartCondition\n )\n\n\nfilter_getSelectedSegmentsForGlobalFilter :\n Context\n -> List Segment\n -> List Segment\nfilter_getSelectedSegmentsForGlobalFilter context availableSegments =\n let\n globalFilter =\n GlobalFilters.fromLocation context.location\n\n isSelected : Segment -> Bool\n isSelected segment =\n List.member (unwrapID segment.id) globalFilter.segmentIDs\n in\n List.filter isSelected availableSegments\n\n\nfilter_jsonDecoder : Dict String String -> Decode.Decoder (List PartCondition)\nfilter_jsonDecoder viewIDlookupMap =\n BoolFilter.jsonDecoder\n |> Decode.andThen\n (\\filter ->\n case filter_fromBoolFilter viewIDlookupMap filter of\n Err err ->\n Decode.fail err\n\n Ok conditions ->\n Decode.succeed conditions\n )\n\n\nfilter_fromBoolFilter : Dict String String -> BoolFilter.Root -> Result String (List PartCondition)\nfilter_fromBoolFilter viewIDlookupMap filter =\n filter\n |> BoolFilter.conditions\n |> List.map (filter_partFromFilterCondition viewIDlookupMap)\n |> Result.Extra.combine\n\n\nfilter_toBoolFilter : List PartCondition -> BoolFilter.Root\nfilter_toBoolFilter parts =\n allPartsOrdered\n |> List.foldl (filter_toBoolFilter_addPart parts) BoolFilter.empty\n |> BoolFilter.collapse\n\n\nfilter_toBoolFilter_addPart : List PartCondition -> PartTemplate -> BoolFilter.Root -> BoolFilter.Root\nfilter_toBoolFilter_addPart allPartsInFilter (PartTemplate templatePart) filter =\n let\n haveSamePartTemplate_ (PartCondition partCondition) =\n haveSamePartTemplate templatePart partCondition\n in\n allPartsInFilter\n -- Filter parts for this template\n |> List.filter haveSamePartTemplate_\n |> filter_joinTemplateConditions\n -- And join using AND with the rest of the filter\n |> (\\joined -> BoolFilter.addAnd joined filter)\n\n\nfilter_joinTemplateConditions : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions conditions =\n let\n viewBranches =\n conditions\n |> List.filter isViewCondition\n |> filter_joinTemplateConditions_views\n\n tagBranches =\n conditions\n |> List.filter isTagCondition\n |> filter_joinTemplateConditions_tags\n\n restBranches : List BoolFilter.Branch\n restBranches =\n conditions\n |> List.filter isNeitherViewOrTagCondition\n |> List.map filter_toBoolFilter_partToCondition\n in\n (restBranches ++ [ viewBranches, tagBranches ])\n |> BoolFilter.joinBranchesUsingOr\n\n\nisViewCondition : PartCondition -> Bool\nisViewCondition (PartCondition part) =\n case part of\n Part_ViewSegment _ _ _ ->\n True\n\n _ ->\n False\n\n\nisTagCondition : PartCondition -> Bool\nisTagCondition (PartCondition part) =\n case part of\n Part_Tag _ _ ->\n True\n\n _ ->\n False\n\n\nisNeitherViewOrTagCondition : PartCondition -> Bool\nisNeitherViewOrTagCondition condition =\n not (isViewCondition condition)\n && not (isTagCondition condition)\n\n\n{-| View branches are special\nSame view needs to be joined with OR\nDifferent views need to be joined with AND\n-}\nfilter_joinTemplateConditions_views : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_views conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_ViewSegment _ id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_tags : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_tags conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_Tag id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_dimension :\n { getDimensionID : PartCondition -> Maybe String\n }\n -> List PartCondition\n -> BoolFilter.Branch\nfilter_joinTemplateConditions_dimension config conditionsForViews =\n let\n isSameDimensionID wantedID condition =\n config.getDimensionID condition == Just wantedID\n\n getConditionsFor wantedID =\n List.filter (isSameDimensionID wantedID) conditionsForViews\n\n joinGroup : List PartCondition -> BoolFilter.Branch\n joinGroup group =\n group\n |> List.map filter_toBoolFilter_partToCondition\n |> BoolFilter.joinBranchesUsingOr\n in\n conditionsForViews\n -- Collect the dimension ids\n |> List.filterMap config.getDimensionID\n -- Ensure the list is unique\n |> Set.fromList\n |> Set.toList\n -- For each collect the relevant conditions\n |> List.map getConditionsFor\n -- Join each of these groups using OR\n |> List.map joinGroup\n -- Join the groups using AND\n |> BoolFilter.joinBranchesUsingAnd\n\n\nfilter_toBoolFilter_partToCondition : PartCondition -> BoolFilter.Branch\nfilter_toBoolFilter_partToCondition (PartCondition part) =\n case part of\n Part_Arn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.arn\n arn\n |> BoolFilter.branchCondition\n\n Part_AwsAccountID id ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_account_id\n id\n |> BoolFilter.branchCondition\n\n Part_AwsProductCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_product_code\n code\n |> BoolFilter.branchCondition\n\n Part_AwsRegionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_region_code\n code\n |> BoolFilter.branchCondition\n\n Part_FinancialCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.financial_cost\n condition\n\n Part_UsageCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_cost\n condition\n\n Part_Kind kind ->\n BoolFilter.equalStr\n dimensionKeysV2.kind\n kind\n |> BoolFilter.branchCondition\n\n Part_PaymentOptionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.payment_option_code\n (PaymentOptionCode.toString code)\n |> BoolFilter.branchCondition\n\n Part_ReservationArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.reservation_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_ResourceType rt ->\n BoolFilter.equalStr\n dimensionKeysV2.resource_type\n rt\n |> BoolFilter.branchCondition\n\n Part_SavingsPlanArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.savings_plan_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_SubUsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.sub_usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_Tag k v ->\n BoolFilter.matchesStr\n (dimensionKeysV2.tags ++ \".\" ++ k)\n v\n |> BoolFilter.branchCondition\n\n Part_UsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_UsageQuantity condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_quantity\n condition\n\n Part_ViewSegment _ _ segmentID ->\n BoolFilter.listIncludes\n dimensionKeysV2.segment_ids\n segmentID\n |> BoolFilter.branchCondition\n\n\nboolFilterConditionsForNumeric : String -> NumericCondition -> BoolFilter.Branch\nboolFilterConditionsForNumeric key numericCondition =\n case numericCondition of\n NumericCondition_None ->\n BoolFilter.branchNoOp\n\n NumericCondition_MoreOrEqualThan value ->\n BoolFilter.moreOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_LessOrEqualThan value ->\n BoolFilter.lessOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_Between min max ->\n BoolFilter.and\n (BoolFilter.moreOrEqualThanStr key min |> BoolFilter.branchCondition)\n (BoolFilter.lessOrEqualThanStr key max |> BoolFilter.branchCondition)\n\n\n\n-- FILTER AND GROUP BY\n\n\nquery_encodeQuery : ReportQuery -> Encode.Value\nquery_encodeQuery reportQuery =\n let\n month =\n Format.monthInYearToISO reportQuery.selectedMonth\n in\n Encode.object\n [ ( \"version\", Encode.int 1 )\n , ( \"query\"\n , Encode.object\n [ ( \"duration\", Encode.string (month ++ \"T00:00:00.000Z/P1M\") )\n , ( \"group_by\", groupBys_jsonEncode reportQuery.groupBys )\n , ( \"where\", filter_toBoolFilter reportQuery.wheres |> filter_jsonEncode )\n ]\n )\n ]\n\n\nquery_decoder : Dict String String -> Decode.Decoder ReportQuery\nquery_decoder viewIDlookupMap =\n Decode.map3 ReportQuery\n (Decode.field \"duration\" monthDecoder)\n (Decode.field \"where\" (filter_jsonDecoder viewIDlookupMap))\n (Decode.field \"group_by\" groupBys_jsonDecoder)\n\n\nmonthDecoder : Decode.Decoder Times.MonthInYear\nmonthDecoder =\n Decode.string\n |> Decode.andThen\n (\\month ->\n case String.split \"T\" month of\n [ a, b ] ->\n case Times.isoToDate a of\n Nothing ->\n Decode.fail a\n\n Just date ->\n Times.dateToMonthInYear date\n |> Decode.succeed\n\n _ ->\n Decode.fail month\n )\n\n\ndateRange_setMonthInReportQuery : Times.MonthInYear -> ReportQuery -> ReportQuery\ndateRange_setMonthInReportQuery monthInYear query =\n { query\n | selectedMonth = monthInYear\n }\n\n\ndataRange_removeFromLocation : AppLocation -> AppLocation\ndataRange_removeFromLocation location =\n { location | query = dataRange_removeFromQuery location.query }\n\n\ndataRange_removeFromQuery : AppLocation.Query -> AppLocation.Query\ndataRange_removeFromQuery query =\n AppLocation.removeQuery (withNameSpace dimensionKeysV2.month) query\n\n\nfilter_setMonthInLocation : Times.MonthInYear -> AppLocation -> AppLocation\nfilter_setMonthInLocation monthInYear location =\n let\n iso =\n monthInYear\n |> Format.monthInYearToISO\n\n query =\n setQueryStr\n (withNameSpace dimensionKeysV2.month)\n iso\n location.query\n in\n { location\n | query = query\n }\n\n\nfilter_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\nfilter_removeAllPartsFromReportQuery query =\n { query\n | wheres = []\n }\n\n\nfilter_removeAllPartsFromLocation : AppLocation -> AppLocation\nfilter_removeAllPartsFromLocation location =\n { location | query = filter_removeAllPartsFromQuery location.query }\n\n\nfilter_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\nfilter_removeAllPartsFromQuery query =\n List.foldl\n filter_removePartDimensionFromQuery\n query\n allPartsOrdered\n\n\nfilter_removePartDimensionFromQuery : PartTemplate -> AppLocation.Query -> AppLocation.Query\nfilter_removePartDimensionFromQuery part query =\n AppLocation.removeQuery\n (queryKeyForPart part)\n query\n\n\nfilter_removePartConditionFromReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_removePartConditionFromReportQuery part query =\n { query\n | wheres = filter_removePartCondition part query.wheres\n }\n\n\nfilter_removePartConditionFromLocation : PartCondition -> AppLocation -> AppLocation\nfilter_removePartConditionFromLocation part location =\n { location | query = filter_removePartConditionFromQuery part location.query }\n\n\nfilter_removePartConditionFromQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_removePartConditionFromQuery part query =\n let\n newParts : List PartCondition\n newParts =\n query\n |> filter_partsFromQuery\n |> filter_removePartCondition part\n in\n query\n |> filter_setPartsInQuery newParts\n\n\nfilter_removePartCondition part parts =\n List.filter (isSamePartCondition part >> not) parts\n\n\nfilter_addPartsToLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_addPartsToLocation parts location =\n { location\n | query = filter_addPartsToLocationQuery parts location.query\n }\n\n\nfilter_addPartConditionToLocation : PartCondition -> AppLocation -> AppLocation\nfilter_addPartConditionToLocation part location =\n { location\n | query = filter_addPartToLocationQuery part location.query\n }\n\n\nfilter_addPartConditionToReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartConditionToReportQuery part query =\n { query\n | wheres = part :: query.wheres\n }\n\n\nfilter_addPartsToLocationQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartsToLocationQuery parts query =\n List.foldl filter_addPartToLocationQuery query parts\n\n\nfilter_addPartToLocationQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartToLocationQuery (PartCondition part) query =\n case part of\n Part_Arn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.arn)\n arn\n query\n\n Part_AwsAccountID id ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_account_id)\n id\n query\n\n Part_AwsProductCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_product_code)\n code\n query\n\n Part_AwsRegionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_region_code)\n code\n query\n\n Part_FinancialCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.financial_cost)\n condition\n query\n\n Part_UsageCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_cost)\n condition\n query\n\n Part_Kind kind ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.kind)\n kind\n query\n\n Part_PaymentOptionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.payment_option_code)\n (PaymentOptionCode.toString code)\n query\n\n Part_ReservationArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.reservation_arn)\n arn\n query\n\n Part_ResourceType rt ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.resource_type)\n rt\n query\n\n Part_SavingsPlanArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n arn\n query\n\n Part_SubUsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.sub_usage_code)\n code\n query\n\n Part_Tag k v ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.tags)\n (k ++ valueKeySeparator ++ v)\n query\n\n Part_UsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.usage_code)\n code\n query\n\n Part_UsageQuantity condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_quantity)\n condition\n query\n\n Part_ViewSegment v s ->\n -- rd.segments[]=974|104302&rd.segments[]=849|102740\n addListValueToQuery\n (withNameSpace dimensionKeysV2.segment_ids)\n (v ++ valueKeySeparator ++ s)\n query\n\n\naddNumericConditionToQuery : String -> NumericCondition -> AppLocation.Query -> AppLocation.Query\naddNumericConditionToQuery key numericCondition query =\n let\n value =\n encodeNumericCondition numericCondition\n in\n case numericCondition of\n NumericCondition_None ->\n removeQuery key query\n\n _ ->\n query\n |> addSingleValueToQuery\n key\n value\n\n\naddSingleValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddSingleValueToQuery key value query =\n setQueryStr key value query\n\n\naddListValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddListValueToQuery key value query =\n let\n currentValues =\n getQueryAsStringList key query\n\n nextValues =\n (currentValues ++ [ value ]) |> List.Extra.unique\n in\n setQueryListStr\n key\n nextValues\n query\n\n\nfilter_addPartsToReportQuery : List PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartsToReportQuery parts query =\n { query\n | wheres = parts ++ query.wheres |> filter_uniqueParts\n }\n\n\nfilter_uniqueParts : List PartCondition -> List PartCondition\nfilter_uniqueParts parts =\n List.Extra.uniqueBy codeForPartConditionUnique parts\n\n\n{-| Replace the current parts with the given list\n-}\nfilter_setPartsInLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_setPartsInLocation parts location =\n { location | query = filter_setPartsInQuery parts location.query }\n\n\nfilter_setPartsInQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_setPartsInQuery parts query =\n query\n |> filter_removeAllPartsFromQuery\n |> filter_addPartsToLocationQuery parts\n\n\ngroupBys_setGroupBysInLocation : List PartDimension -> AppLocation -> AppLocation\ngroupBys_setGroupBysInLocation groupByParts location =\n location\n |> setQueryListStrInLocation\n queryKeys.exploreData.groupBy\n (List.filterMap groupBys_partToCode groupByParts)\n\n\nmaybeUnrwap_Part_Tag part =\n case part of\n Part_Tag k v ->\n Just ( k, v )\n\n _ ->\n Nothing\n\n\nmaybeUnrwap_Part_ViewSegment part =\n case part of\n Part_ViewSegment v s ->\n Just ( v, s )\n\n _ ->\n Nothing\n\n\nselectedMonthFromLocation : AppLocation -> Maybe String\nselectedMonthFromLocation location =\n location.query\n |> getStringFromQuery\n (withNameSpace dimensionKeysV2.month)\n\n\nselectedMonthFromLocationAsTime : AppLocation -> Maybe Posix\nselectedMonthFromLocationAsTime =\n selectedMonthFromLocation\n >> Maybe.andThen (Times.posixFromIso >> Result.toMaybe)\n\n\nselectedMonthFromLocationAsDate : AppLocation -> Maybe Date\nselectedMonthFromLocationAsDate =\n selectedMonthFromLocation\n >> Maybe.andThen (Date.fromIsoString >> Result.toMaybe)\n\n\nselectedMonthFromLocationWithDefault : Context -> Posix\nselectedMonthFromLocationWithDefault context =\n selectedMonthFromLocationAsTime context.location\n |> Maybe.withDefault (Times.beginningOfMonth Time.utc context.currentTime)\n\n\nselectedMonthFromLocationWithDefaultAsMonth : Context -> Times.MonthInYear\nselectedMonthFromLocationWithDefaultAsMonth context =\n selectedMonthFromLocationAsDate context.location\n |> Maybe.map Times.dateToMonthInYear\n |> Maybe.withDefault (selectedMonthDefaultFromContext context)\n\n\nselectedMonthDefaultFromContext : Context -> Times.MonthInYear\nselectedMonthDefaultFromContext context =\n Date.fromPosix Time.utc context.currentTime\n |> Times.dateToMonthInYear\n\n\n\n-- helpers\n\n\ngetStringFromQuery : String -> Query -> Maybe String\ngetStringFromQuery key query =\n getQueryAsStr key query\n\n\nvalidateNumericCondition : NumericCondition -> Maybe NumericCondition\nvalidateNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n Nothing\n\n NumericCondition_LessOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_MoreOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_Between minValue maxValue ->\n if String.isEmpty minValue then\n Nothing\n\n else if String.isEmpty maxValue then\n Nothing\n\n else\n Maybe.map2\n (\\minFloat maxFloat ->\n NumericCondition_Between\n (String.fromFloat (min minFloat maxFloat))\n (String.fromFloat (max minFloat maxFloat))\n )\n (String.toFloat minValue)\n (String.toFloat maxValue)\n\n\nlocationForArn : String -> AppLocation -> AppLocation\nlocationForArn arn location =\n let\n condition =\n PartCondition (Part_Arn arn)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n\n\nlocationForViewSegment : String -> String -> AppLocation -> AppLocation\nlocationForViewSegment viewID segmentID location =\n let\n condition =\n PartCondition (Part_ViewSegment viewID segmentID)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n"
}
}
[Trace - 11:59:51 am] Received request 'workspace/configuration - (0)'.
Params: {
"items": [
{
"section": "elmLS"
}
]
}
[Trace - 11:59:51 am] Sending response 'workspace/configuration - (0)'. Processing request took 1ms
Result: [
{
"trace": {
"server": "verbose"
},
"elmPath": "",
"elmFormatPath": "",
"elmTestPath": "",
"disableElmLSDiagnostics": false,
"skipInstallPackageConfirmation": false,
"elmAnalyseTrigger": "never"
}
]
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined"
}
[Error - 11:59:51 am] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined
[Trace - 11:59:51 am] Sending request 'textDocument/documentSymbol - (1)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
}
}
[Trace - 11:59:51 am] Sending request 'textDocument/codeAction - (2)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
},
"range": {
"start": {
"line": 1764,
"character": 43
},
"end": {
"line": 1764,
"character": 43
}
},
"context": {
"diagnostics": []
}
}
TypeError: Cannot read property 'synchronize' of undefined
/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1
var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.TreeSitter=t()}(0,function(){var e,t={};for(e in Module)Module.hasOwnProperty(e)&&(t[e]=Module[e]);var r,n,s=[],o=function(e,t){throw t},_=!1,a=!1;_="object"==typeof window,a="function"==typeof importScripts,r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,n=!_&&!r&&!a;var i,u,l,d,c="";r?(c=a?require("path").dirname(c)+"/":__dirname+"/",i=function(e,t){return l||(l=require("fs")),d||(d=require("path")),e=d.normalize(e),l.readFileSync(e,t?null:"utf8")},u=function(e){var t=i(e,!0);return t.buffer||(t=new Uint8Array(t)),L(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),s=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),process.on("uncaughtExce
RuntimeError: abort(TypeError: Cannot read property 'synchronize' of undefined). Build with -s ASSERTIONS=1 for more info.
at process.fe (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1:10450)
at process.emit (events.js:228:7)
at processPromiseRejections (internal/process/promises.js:201:33)
at processTicksAndRejections (internal/process/task_queues.js:95:32)
[Info - 11:59:51 am] Connection to server got closed. Server will restart.
[Error - 11:59:51 am] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:223:5)
at Pipe.<anonymous> (net.js:664:12)
[Error - 11:59:51 am] Request textDocument/codeAction failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:223:5)
at Pipe.<anonymous> (net.js:664:12)
[Trace - 11:59:51 am] Sending request 'initialize - (0)'.
Params: {
"processId": 453470,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.52.1"
},
"locale": "en-gb",
"rootPath": "/home/sebastian/Source/staxio/stax",
"rootUri": "file:///home/sebastian/Source/staxio/stax",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": true
}
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
}
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true,
"semanticTokens": {
"refreshSupport": true
},
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
}
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"insertReplaceSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
},
"activeParameterSupport": true
},
"contextSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"honorsChangeAnnotations": false
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"prepareSupportDefaultBehavior": 1,
"honorsChangeAnnotations": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false
},
"linkedEditingRange": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "1.1.0"
}
}
},
"initializationOptions": {
"elmFormatPath": "",
"elmPath": "",
"elmTestPath": "",
"trace": {
"server": "verbose"
},
"extendedCapabilities": {
"moveFunctionRefactoringSupport": true,
"exposeUnexposeSupport": true
},
"disableElmLSDiagnostics": false
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/sebastian/Source/staxio/stax",
"name": "stax"
}
],
"workDoneToken": "4e64dc66-c494-4368-a0bb-61e2aa851add"
}
[Trace - 11:59:51 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm"
}
[Info - 11:59:51 am] Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:52 am] Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:52 am] Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client"
}
[Info - 11:59:52 am] Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client
[Trace - 11:59:52 am] Received notification '$/progress'.
Params: {
"token": "4e64dc66-c494-4368-a0bb-61e2aa851add",
"value": {
"kind": "begin",
"title": "Indexing Elm",
"percentage": 0
}
}
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Elm version 0.19.1 detected."
}
[Info - 11:59:52 am] Elm version 0.19.1 detected.
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json"
}
[Info - 11:59:52 am] Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 2,
"message": "{\"shortMessage\":\"Command failed with exit code 1: elm make\",\"command\":\"elm make\",\"exitCode\":1,\"stdout\":\"\",\"stderr\":\"\\n-- ERROR -----------------------------------------------------------------------\\n\\nI ran into something that bypassed the normal error reporting process! I\\nextracted whatever information I could from the internal error:\\n\\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\\nThese errors are usually pretty confusing, so start by asking around on one of\\nforums listed at https://elm-lang.org/community to see if anyone can get you\\nunstuck quickly.\\n\\n-- REQUEST ---------------------------------------------------------------------\\n\\nIf you are feeling up to it, please try to get your code down to the smallest\\nversion that still triggers this message. Ideally in a single Main.elm and\\nelm.json file.\\n\\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\\nabout if someone else saw something similar. More examples is better!\\n\\nThis kind of error is usually tied up in larger architectural choices that are\\nhard to change, so even when we have a couple good examples, it can take some\\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\",\"failed\":true,\"timedOut\":false,\"isCanceled\":false,\"killed\":false}"
}
[Warn - 11:59:52 am] {"shortMessage":"Command failed with exit code 1: elm make","command":"elm make","exitCode":1,"stdout":"","stderr":"\n-- ERROR -----------------------------------------------------------------------\n\nI ran into something that bypassed the normal error reporting process! I\nextracted whatever information I could from the internal error:\n\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n\nThese errors are usually pretty confusing, so start by asking around on one of\nforums listed at https://elm-lang.org/community to see if anyone can get you\nunstuck quickly.\n\n-- REQUEST ---------------------------------------------------------------------\n\nIf you are feeling up to it, please try to get your code down to the smallest\nversion that still triggers this message. Ideally in a single Main.elm and\nelm.json file.\n\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\nabout if someone else saw something similar. More examples is better!\n\nThis kind of error is usually tied up in larger architectural choices that are\nhard to change, so even when we have a couple good examples, it can take some\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n","failed":true,"timedOut":false,"isCanceled":false,"killed":false}
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:\nError: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'"
}
[Error - 11:59:52 am] Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:
Error: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'
[Trace - 11:59:52 am] Received notification '$/progress'.
Params: {
"token": "4e64dc66-c494-4368-a0bb-61e2aa851add",
"value": {
"kind": "end"
}
}
[Trace - 11:59:52 am] Received response 'initialize - (0)' in 516ms.
Result: {
"capabilities": {
"codeActionProvider": {
"resolveProvider": true
},
"codeLensProvider": {
"resolveProvider": true
},
"completionProvider": {
"triggerCharacters": [
"."
]
},
"definitionProvider": true,
"documentFormattingProvider": true,
"documentSymbolProvider": {
"label": "Elm"
},
"executeCommandProvider": {
"commands": [
"elmLS.elmMakeFixer-0b99ca4fcbb918ef8183684a38c0edc8",
"elm.installPackage"
]
},
"foldingRangeProvider": true,
"hoverProvider": true,
"referencesProvider": true,
"renameProvider": {
"prepareProvider": true
},
"selectionRangeProvider": true,
"textDocumentSync": 2,
"workspaceSymbolProvider": true,
"workspace": {
"fileOperations": {
"didCreate": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
},
"willRename": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
},
{
"scheme": "file",
"pattern": {
"glob": "**/",
"matches": "folder"
}
}
]
},
"willDelete": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
}
}
},
"linkedEditingRangeProvider": true
}
}
[Trace - 11:59:52 am] Sending notification 'initialized'.
Params: {}
[Trace - 11:59:52 am] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm",
"languageId": "elm",
"version": 1,
"text": "module Elements.RawDataV3.Filter exposing\n ( allPartsOrdered\n , baseParts\n , codeForPartCondition\n , codeForPartDimension\n , codeForPartTemplate\n , dataRange_removeFromLocation\n , dateRange_setMonthInReportQuery\n , decodeNumericCondition\n , dimensionKeysV2\n , encodeNumericCondition\n , filter_addPartConditionToLocation\n , filter_addPartConditionToReportQuery\n , filter_addPartToLocationQuery\n , filter_addPartsToLocation\n , filter_addPartsToLocationQuery\n , filter_addPartsToReportQuery\n , filter_canAddPart\n , filter_fromBoolFilter\n , filter_getWhereComponents_fromGlobal\n , filter_hasPart\n , filter_jsonDecoder\n , filter_partFromFilterCondition\n , filter_partsFromLocation\n , filter_partsFromQuery\n , filter_removeAllPartsFromLocation\n , filter_removeAllPartsFromReportQuery\n , filter_removePartConditionFromLocation\n , filter_removePartConditionFromReportQuery\n , filter_setMonthInLocation\n , filter_setPartsInLocation\n , filter_toBoolFilter\n , filter_validateAndCorrectCondition\n , groupBys_add\n , groupBys_addToReportQuery\n , groupBys_canUsePart\n , groupBys_fromLocation\n , groupBys_hasAny\n , groupBys_hasPart\n , groupBys_jsonDecoder\n , groupBys_jsonEncode\n , groupBys_remove\n , groupBys_removeAllPartsFromLocation\n , groupBys_removeAllPartsFromReportQuery\n , groupBys_removeFromReportQuery\n , groupBys_setGroupBysInLocation\n , haveSamePartDimension\n , isSamePartCondition\n , isSamePartDimension\n , locationForArn\n , locationForViewSegment\n , partConditionConstructor\n , partConditionToDimension\n , partCondition_haveSameDimension\n , query_decoder\n , query_encodeQuery\n , query_getReportQueryFromLocation\n , query_isEmpty\n , query_setInLocation\n , selectedMonthDefaultFromContext\n , selectedMonthFromLocationWithDefault\n , templateParts\n , withNameSpace\n )\n\nimport Api.Enum.BillingData_PaymentOptionCode as PaymentOptionCode\nimport Date exposing (Date)\nimport Dict exposing (Dict)\nimport Elements.RawDataV3.Types exposing (..)\nimport Json.Decode as Decode\nimport Json.Encode as Encode\nimport Json.Encode.Extra as EncodeExtra\nimport List.Extra\nimport Result.Extra\nimport Set exposing (Set)\nimport Shared.AppLocation as AppLocation exposing (..)\nimport Shared.BoolFilterV2 as BoolFilter\nimport Shared.Context exposing (Context)\nimport Shared.Format as Format\nimport Shared.GlobalFilters as GlobalFilters\nimport Shared.Routes as Routes\nimport Shared.Times as Times\nimport Time exposing (Posix)\n\n\ntemplateParts =\n { arn = Part_Arn \"\"\n , awsAccountID = Part_AwsAccountID \"\"\n , awsProductCode = Part_AwsProductCode \"\"\n , awsRegionCode = Part_AwsRegionCode \"\"\n , financialCost = Part_FinancialCost NumericCondition_None\n , kind = Part_Kind \"\"\n , paymentOptionCode = Part_PaymentOptionCode PaymentOptionCode.Standard\n , reservationArn = Part_ReservationArn \"\"\n , resourceType = Part_ResourceType \"\"\n , savingPlanArn = Part_SavingsPlanArn \"\"\n , subUsageCode = Part_SubUsageCode \"\"\n , tag = Part_Tag \"\" \"\"\n , usageCode = Part_UsageCode \"\"\n , usageCost = Part_UsageCost NumericCondition_None\n , usageQuantity = Part_UsageQuantity NumericCondition_None\n , viewSegment = Part_ViewSegment \"\" \"\"\n }\n\n\ntemplatePartForPart : Part -> PartTemplate\ntemplatePartForPart part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag _ _ ->\n templateParts.tag\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment _ _ _ ->\n templateParts.viewSegment\n in\n PartTemplate part_\n\n\n{-| Is fine to go from specific to general\n-}\npartConditionToDimension : PartCondition -> PartDimension\npartConditionToDimension (PartCondition part) =\n PartDimension part\n\n\npartToPartDimension : Part -> PartDimension\npartToPartDimension part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag key _ ->\n Part_Tag key \"\"\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment global viewID _ ->\n Part_ViewSegment global viewID \"\"\n in\n PartDimension part_\n\n\nallPartsOrdered : List PartTemplate\nallPartsOrdered =\n let\n {-\n This function is useless but will cause the\n compiler to fail if types arent added here. It is\n up to the developer to ensure the are also in the\n return list. This is a work around for union types\n not being iterable\n -}\n ignored thing =\n case thing of\n Part_Arn _ ->\n []\n\n Part_AwsAccountID _ ->\n []\n\n Part_AwsProductCode _ ->\n []\n\n Part_AwsRegionCode _ ->\n []\n\n Part_FinancialCost _ ->\n []\n\n Part_UsageCost _ ->\n []\n\n Part_Kind _ ->\n []\n\n Part_PaymentOptionCode _ ->\n []\n\n Part_ReservationArn _ ->\n []\n\n Part_ResourceType _ ->\n []\n\n Part_SavingsPlanArn _ ->\n []\n\n Part_SubUsageCode _ ->\n []\n\n Part_Tag _ _ ->\n []\n\n Part_UsageCode _ ->\n []\n\n Part_UsageQuantity _ ->\n []\n\n Part_ViewSegment _ _ _ ->\n []\n in\n -- All parts ordered for iteration in UI\n [ templateParts.viewSegment\n , templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n , templateParts.tag\n ]\n ++ ignored (Part_Arn \"\")\n |> List.map PartTemplate\n\n\n{-| Same as all, but without view and tags which are iterated differently\n-}\nbaseParts : List PartTemplate\nbaseParts =\n [ templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n ]\n |> List.map PartTemplate\n\n\n{-| Some conditions can be constructed by providing a single String\n-}\npartConditionConstructor : PartDimension -> Maybe (String -> PartCondition)\npartConditionConstructor (PartDimension part) =\n let\n maybeConstructor =\n case part of\n Part_Arn _ ->\n Just Part_Arn\n\n Part_AwsAccountID _ ->\n Just Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n Just Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n Just Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n Nothing\n\n Part_UsageCost _ ->\n Nothing\n\n Part_Kind _ ->\n Just Part_Kind\n\n Part_PaymentOptionCode _ ->\n (\\s ->\n Part_PaymentOptionCode\n (s\n |> PaymentOptionCode.fromString\n |> Maybe.withDefault PaymentOptionCode.Standard\n )\n )\n |> Just\n\n Part_ReservationArn _ ->\n Just Part_ReservationArn\n\n Part_ResourceType _ ->\n Just Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n Just Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n Just Part_SubUsageCode\n\n Part_Tag key _ ->\n Just (Part_Tag key)\n\n Part_UsageCode _ ->\n Just Part_UsageCode\n\n Part_UsageQuantity _ ->\n Nothing\n\n Part_ViewSegment global view _ ->\n Just (Part_ViewSegment global view)\n in\n case maybeConstructor of\n Nothing ->\n Nothing\n\n Just constructor ->\n Just (constructor >> PartCondition)\n\n\nfilter_hasPart : PartCondition -> List PartCondition -> Bool\nfilter_hasPart part parts =\n case List.Extra.find (isSamePartCondition part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\nfilter_canAddPart : PartCondition -> List PartCondition -> Bool\nfilter_canAddPart part parts =\n if filter_hasPart part parts then\n filter_canAddMultipleOf part\n\n else\n True\n\n\nfilter_validateAndCorrectCondition : PartCondition -> Maybe PartCondition\nfilter_validateAndCorrectCondition (PartCondition part) =\n let\n validateValue value =\n if String.isEmpty value then\n Nothing\n\n else\n Just part\n\n validatedPart =\n case part of\n Part_Arn value ->\n validateValue value\n\n Part_AwsAccountID value ->\n validateValue value\n\n Part_AwsProductCode value ->\n validateValue value\n\n Part_AwsRegionCode value ->\n validateValue value\n\n Part_FinancialCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_FinancialCost corrected)\n\n Part_UsageCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageCost corrected)\n\n Part_Kind value ->\n validateValue value\n\n Part_PaymentOptionCode _ ->\n Just part\n\n Part_ReservationArn value ->\n validateValue value\n\n Part_ResourceType value ->\n validateValue value\n\n Part_SavingsPlanArn value ->\n validateValue value\n\n Part_SubUsageCode value ->\n validateValue value\n\n Part_Tag _ value ->\n validateValue value\n\n Part_UsageCode value ->\n validateValue value\n\n Part_UsageQuantity numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageQuantity corrected)\n\n Part_ViewSegment _ _ segmentID ->\n validateValue segmentID\n in\n validatedPart |> Maybe.map PartCondition\n\n\nfilter_canAddMultipleOf : PartCondition -> Bool\nfilter_canAddMultipleOf (PartCondition part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\nfilter_addPart : PartCondition -> List PartCondition -> List PartCondition\nfilter_addPart part parts =\n if filter_canAddPart part parts then\n parts ++ [ part ]\n\n else\n parts\n\n\nremovePartDimension : PartDimension -> List PartDimension -> List PartDimension\nremovePartDimension part parts =\n parts\n |> List.Extra.filterNot (isSamePartDimension part)\n\n\nremovePartCondition : PartCondition -> List PartCondition -> List PartCondition\nremovePartCondition part parts =\n parts\n |> List.Extra.filterNot (isSamePartCondition part)\n\n\n{-| These are the same template part if they use the same constructor\n-}\nhaveSamePartTemplate : Part -> Part -> Bool\nhaveSamePartTemplate a b =\n templatePartForPart a == templatePartForPart b\n\n\nisSamePartDimension : PartDimension -> PartDimension -> Bool\nisSamePartDimension (PartDimension a) (PartDimension b) =\n haveSamePartDimension a b\n\n\npartCondition_haveSameDimension : PartCondition -> PartCondition -> Bool\npartCondition_haveSameDimension (PartCondition a) (PartCondition b) =\n haveSamePartDimension a b\n\n\n{-| View and Tag are the same dimension if they have the same view or tag key\n-}\nhaveSamePartDimension : Part -> Part -> Bool\nhaveSamePartDimension a b =\n partToPartDimension a == partToPartDimension b\n\n\nisSamePartCondition : PartCondition -> PartCondition -> Bool\nisSamePartCondition a b =\n a == b\n\n\nfilter_partsFromLocation : AppLocation -> List PartCondition\nfilter_partsFromLocation location =\n filter_partsFromQuery location.query\n\n\nfilter_partsFromQuery : Query -> List PartCondition\nfilter_partsFromQuery query =\n allPartsOrdered\n |> List.concatMap (filter_partFromQuery query)\n |> filter_uniqueParts\n\n\n{-| Given a template part e.g. Part\\_Arn \"\"\nThis may return multiple parts [Part_Arn \"123\", Part_Arn \"456\"]\n-}\nfilter_partFromQuery : Query -> PartTemplate -> List PartCondition\nfilter_partFromQuery query (PartTemplate templatePart) =\n let\n parsePair pair =\n case String.split valueKeySeparator pair of\n [ a, b ] ->\n Just ( a, b )\n\n _ ->\n Nothing\n\n partConditions =\n case templatePart of\n Part_Arn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.arn)\n |> List.map Part_Arn\n\n Part_AwsAccountID _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_account_id)\n |> List.map Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_product_code)\n |> List.map Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_region_code)\n |> List.map Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n filter_getNumericInputFromQuery\n Part_FinancialCost\n (withNameSpace dimensionKeysV2.financial_cost)\n query\n\n Part_UsageCost _ ->\n filter_getNumericInputFromQuery\n Part_UsageCost\n (withNameSpace dimensionKeysV2.usage_cost)\n query\n\n Part_Kind _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.kind)\n |> List.map Part_Kind\n\n Part_PaymentOptionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.payment_option_code)\n |> List.filterMap PaymentOptionCode.fromString\n |> List.map Part_PaymentOptionCode\n\n Part_ReservationArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.reservation_arn)\n |> List.map Part_ReservationArn\n\n Part_ResourceType _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.resource_type)\n |> List.map Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n |> List.map Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.sub_usage_code)\n |> List.map Part_SubUsageCode\n\n Part_Tag _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.tags)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_Tag a b)\n\n Part_UsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.usage_code)\n |> List.map Part_UsageCode\n\n Part_UsageQuantity _ ->\n filter_getNumericInputFromQuery\n Part_UsageQuantity\n (withNameSpace dimensionKeysV2.usage_quantity)\n query\n\n Part_ViewSegment _ _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.segment_ids)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_ViewSegment a b)\n in\n partConditions |> List.map PartCondition\n\n\nfilter_partFromFilterCondition : Dict String String -> BoolFilter.Condition -> Result String PartCondition\nfilter_partFromFilterCondition viewIDlookupMap filterCondition =\n let\n keys =\n dimensionKeysV2\n\n ( key, val ) =\n case filterCondition of\n BoolFilter.Eq pair ->\n pair\n\n BoolFilter.NotEq pair ->\n pair\n\n BoolFilter.LessOrEqualThan pair ->\n pair\n\n BoolFilter.LessThan pair ->\n pair\n\n BoolFilter.ListIncludes pair ->\n pair\n\n BoolFilter.Matches pair ->\n pair\n\n BoolFilter.MoreOrEqualThan pair ->\n pair\n\n BoolFilter.MoreThan pair ->\n pair\n\n numericCondition =\n case filterCondition of\n BoolFilter.Eq _ ->\n NumericCondition_None\n\n BoolFilter.NotEq _ ->\n NumericCondition_None\n\n BoolFilter.LessOrEqualThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.LessThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.ListIncludes _ ->\n NumericCondition_None\n\n BoolFilter.Matches _ ->\n NumericCondition_None\n\n BoolFilter.MoreOrEqualThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n BoolFilter.MoreThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n part : Result String Part\n part =\n if key == keys.arn then\n Ok (Part_Arn val)\n\n else if key == keys.aws_account_id then\n Ok (Part_AwsAccountID val)\n\n else if key == keys.aws_product_code then\n Ok (Part_AwsProductCode val)\n\n else if key == keys.aws_region_code then\n Ok (Part_AwsRegionCode val)\n\n else if key == keys.financial_cost then\n Ok (Part_FinancialCost numericCondition)\n\n else if key == keys.usage_cost then\n Ok (Part_UsageCost numericCondition)\n\n else if key == keys.kind then\n Ok (Part_Kind val)\n\n else if key == keys.payment_option_code then\n PaymentOptionCode.fromString val\n |> Result.fromMaybe val\n |> Result.map Part_PaymentOptionCode\n\n else if key == keys.reservation_arn then\n Ok (Part_ReservationArn val)\n\n else if key == keys.resource_type then\n Ok (Part_ResourceType val)\n\n else if key == keys.savings_plan_arn then\n Ok (Part_SavingsPlanArn val)\n\n else if key == keys.sub_usage_code then\n Ok (Part_SubUsageCode val)\n\n else if String.startsWith \"tags\" key then\n case String.split \".\" key of\n [ a, b ] ->\n Ok (Part_Tag b val)\n\n _ ->\n Err key\n\n else if key == keys.usage_code then\n Ok (Part_UsageCode val)\n\n else if key == keys.usage_quantity then\n Ok (Part_UsageQuantity numericCondition)\n\n else if key == keys.segment_ids then\n case Dict.get val viewIDlookupMap of\n Nothing ->\n Err val\n\n Just viewID ->\n Ok (Part_ViewSegment viewID val)\n\n else\n Err key\n in\n part |> Result.map PartCondition\n\n\nfilter_getNumericInputFromQuery :\n (NumericCondition -> Part)\n -> String\n -> AppLocation.Query\n -> List Part\nfilter_getNumericInputFromQuery constructor queryKey query =\n case filter_getNumericConditionFromQuery queryKey query of\n Nothing ->\n []\n\n Just condition ->\n [ constructor condition ]\n\n\nfilter_getNumericConditionFromQuery :\n String\n -> AppLocation.Query\n -> Maybe NumericCondition\nfilter_getNumericConditionFromQuery queryKey query =\n getStringFromQuery queryKey query\n |> Maybe.andThen decodeNumericCondition\n\n\ngroupBys_fromLocation : AppLocation -> List PartDimension\ngroupBys_fromLocation location =\n let\n groupBys =\n getQueryAsStringList queryKeys.exploreData.groupBy location.query\n in\n List.filterMap groupBys_codeToPart groupBys\n\n\ngroupBys_canUsePart : PartDimension -> Bool\ngroupBys_canUsePart (PartDimension part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\ngroupBys_hasAny location =\n groupBys_fromLocation location\n |> List.isEmpty\n |> not\n\n\ngroupBys_add : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_add part parts =\n if groupBys_hasPart part parts then\n parts\n\n else\n parts ++ [ part ]\n\n\ngroupBys_addToReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_addToReportQuery part query =\n { query\n | groupBys = groupBys_add part query.groupBys\n }\n\n\ngroupBys_hasPart : PartDimension -> List PartDimension -> Bool\ngroupBys_hasPart part parts =\n case List.Extra.find (isSamePartDimension part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\ngroupBys_remove : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_remove =\n removePartDimension\n\n\ngroupBys_removeFromReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_removeFromReportQuery part query =\n { query\n | groupBys = groupBys_remove part query.groupBys\n }\n\n\ngroupBys_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\ngroupBys_removeAllPartsFromReportQuery query =\n { query | groupBys = [] }\n\n\ngroupBys_removeAllPartsFromLocation : AppLocation -> AppLocation\ngroupBys_removeAllPartsFromLocation location =\n { location | query = groupBys_removeAllPartsFromQuery location.query }\n\n\ngroupBys_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\ngroupBys_removeAllPartsFromQuery query =\n AppLocation.removeQuery\n queryKeys.exploreData.groupBy\n query\n\n\n{-| Parts that cannot be grouped by will return Nothing\n-}\ngroupBys_partToCode : PartDimension -> Maybe String\ngroupBys_partToCode partDimension =\n if groupBys_canUsePart partDimension then\n Just (codeForPartDimension partDimension)\n\n else\n Nothing\n\n\ngroupBys_codeToPart : String -> Maybe PartDimension\ngroupBys_codeToPart code =\n let\n dims =\n dimensionKeysV2\n\n partCondition =\n if code == dims.arn then\n Just templateParts.arn\n\n else if code == dims.aws_account_id then\n Just templateParts.awsAccountID\n\n else if code == dims.aws_product_code then\n Just templateParts.awsProductCode\n\n else if code == dims.aws_region_code then\n Just templateParts.awsRegionCode\n\n else if code == dims.financial_cost then\n Just templateParts.financialCost\n\n else if code == dims.kind then\n Just templateParts.kind\n\n else if code == dims.payment_option_code then\n Just templateParts.paymentOptionCode\n\n else if code == dims.reservation_arn then\n Just templateParts.reservationArn\n\n else if code == dims.resource_type then\n Just templateParts.resourceType\n\n else if code == dims.savings_plan_arn then\n Just templateParts.savingPlanArn\n\n else if code == dims.sub_usage_code then\n Just templateParts.subUsageCode\n\n else if code == dims.usage_code then\n Just templateParts.usageCode\n\n else if code == dims.usage_cost then\n Just templateParts.usageCost\n\n else if code == dims.usage_quantity then\n Just templateParts.usageQuantity\n\n else if String.startsWith groupByOnlyKeys.tag code then\n Just (Part_Tag (String.replace groupByOnlyKeys.tag \"\" code) \"\")\n\n else if String.startsWith groupByOnlyKeys.viewId code then\n Just (Part_ViewSegment (String.replace groupByOnlyKeys.viewId \"\" code) \"\")\n\n else\n -- Ignored\n -- month\n Nothing\n in\n Maybe.map PartDimension partCondition\n\n\ngroupBys_jsonEncode : List PartDimension -> Encode.Value\ngroupBys_jsonEncode parts =\n parts\n |> List.filterMap groupBys_partToCode\n |> Encode.list Encode.string\n\n\ngroupBys_jsonDecoder : Decode.Decoder (List PartDimension)\ngroupBys_jsonDecoder =\n Decode.list groupBys_jsonDimensionDecoder\n\n\ngroupBys_jsonDimensionDecoder : Decode.Decoder PartDimension\ngroupBys_jsonDimensionDecoder =\n Decode.string\n |> Decode.andThen\n (\\code ->\n case groupBys_codeToPart code of\n Nothing ->\n Decode.fail \"code\"\n\n Just part ->\n Decode.succeed part\n )\n\n\n{-| Dimension keys\nUsed for the URL query string and the API Query\nThese must not be changed as they are expected like this by the API\n-}\ndimensionKeysV2 =\n { arn = \"arn\"\n , aws_account_id = \"linked_account_id\"\n , aws_product_code = \"product_code\"\n , aws_region_code = \"region_code\"\n , financial_cost = \"unallocated_unblended_cost\"\n , kind = \"kind\"\n , month = \"month\"\n , payment_option_code = \"payment_option_code\"\n , reservation_arn = \"reservation_arn\"\n , resource_type = \"resource_type\"\n , savings_plan_arn = \"savings_plan_arn\"\n , segment_ids = \"segment_ids\"\n , sub_usage_code = \"sub_usage_code\"\n , tags = \"tags\"\n , usage_code = \"usage_code\"\n , usage_cost = \"unallocated_amortised_cost\"\n , usage_quantity = \"total_usage_quantity\"\n }\n\n\nnamespace =\n \"rd.\"\n\n\nwithNameSpace key =\n namespace ++ key\n\n\nvalueKeySeparator =\n \"|\"\n\n\ngroupByOnlyKeys =\n { tag = \"tags.\"\n , viewId = \"viewId.\"\n }\n\n\ncodeForPartTemplate : PartTemplate -> String\ncodeForPartTemplate (PartTemplate part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n groupByOnlyKeys.tag\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n groupByOnlyKeys.viewId\n\n\ncodeForPartDimension : PartDimension -> String\ncodeForPartDimension (PartDimension part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag k _ ->\n groupByOnlyKeys.tag ++ k\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ viewId _ ->\n groupByOnlyKeys.viewId ++ viewId\n\n\ncodeForPartCondition : PartCondition -> String\ncodeForPartCondition (PartCondition part) =\n codeForPartDimension (PartDimension part)\n\n\n{-| A unique code for a part condition\nUsed for removing duplicates\n-}\ncodeForPartConditionUnique : PartCondition -> String\ncodeForPartConditionUnique (PartCondition part) =\n case part of\n Part_Arn arn ->\n dimensionKeysV2.arn ++ arn\n\n Part_AwsAccountID id ->\n dimensionKeysV2.aws_account_id ++ id\n\n Part_AwsProductCode code ->\n dimensionKeysV2.aws_product_code ++ code\n\n Part_AwsRegionCode code ->\n dimensionKeysV2.aws_region_code ++ code\n\n Part_FinancialCost condition ->\n dimensionKeysV2.financial_cost ++ encodeNumericCondition condition\n\n Part_UsageCost condition ->\n dimensionKeysV2.usage_cost ++ encodeNumericCondition condition\n\n Part_Kind kind ->\n dimensionKeysV2.kind ++ kind\n\n Part_PaymentOptionCode code ->\n dimensionKeysV2.payment_option_code ++ PaymentOptionCode.toString code\n\n Part_ReservationArn arn ->\n dimensionKeysV2.reservation_arn ++ arn\n\n Part_ResourceType type_ ->\n dimensionKeysV2.resource_type ++ type_\n\n Part_SavingsPlanArn arn ->\n dimensionKeysV2.savings_plan_arn ++ arn\n\n Part_SubUsageCode code ->\n dimensionKeysV2.sub_usage_code ++ code\n\n Part_Tag k v ->\n groupByOnlyKeys.tag ++ k ++ \"=\" ++ v\n\n Part_UsageCode code ->\n dimensionKeysV2.usage_code ++ code\n\n Part_UsageQuantity condition ->\n dimensionKeysV2.usage_quantity ++ encodeNumericCondition condition\n\n Part_ViewSegment _ viewId segmentID ->\n groupByOnlyKeys.viewId ++ viewId ++ segmentID\n\n\n{-| Used in the query string too\nMust be query string safe. Dont' use:\n\n : / ? # [ ] @ ! $ & ' ( ) * + , ; =\n\nOk to use:\n\n - . _ ~\n\nUsed like\n\n ?rd.usage_cost=between.123~344&...\n\n-}\nencodeNumericCondition : NumericCondition -> String\nencodeNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n \"none\"\n\n NumericCondition_MoreOrEqualThan value ->\n \"get_\" ++ value\n\n NumericCondition_LessOrEqualThan value ->\n \"let_\" ++ value\n\n NumericCondition_Between one two ->\n \"between_\" ++ one ++ \"~\" ++ two\n\n\ndecodeNumericCondition : String -> Maybe NumericCondition\ndecodeNumericCondition value =\n case String.split \"_\" value of\n [ operation, body ] ->\n case operation of\n \"get\" ->\n Just (NumericCondition_MoreOrEqualThan body)\n\n \"let\" ->\n Just (NumericCondition_LessOrEqualThan body)\n\n \"between\" ->\n case String.split \"~\" body of\n [ min, max ] ->\n Just (NumericCondition_Between min max)\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n\n{-|\n\n e.g. rd.segment_ids\n\n-}\nqueryKeyForPart : PartTemplate -> String\nqueryKeyForPart (PartTemplate part) =\n let\n key =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n dimensionKeysV2.tags\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n dimensionKeysV2.segment_ids\n in\n withNameSpace key\n\n\n\n-- FILTER\n\n\nquery_getReportQueryFromLocation : Context -> List Segment -> ReportQuery\nquery_getReportQueryFromLocation context availableSegments =\n let\n selectedMonth =\n selectedMonthFromLocationWithDefaultAsMonth context\n\n whereFilterComponents : List PartCondition\n whereFilterComponents =\n filter_getWhereComponents\n context\n availableSegments\n\n groupBys : List PartDimension\n groupBys =\n groupBys_fromLocation\n context.location\n in\n { selectedMonth = selectedMonth\n , wheres = whereFilterComponents\n , groupBys = groupBys\n }\n\n\nquery_setInLocation : ReportQuery -> AppLocation -> AppLocation\nquery_setInLocation query location =\n location\n |> filter_setMonthInLocation query.selectedMonth\n |> filter_setPartsInLocation query.wheres\n |> groupBys_setGroupBysInLocation query.groupBys\n\n\nquery_isEmpty : ReportQuery -> Bool\nquery_isEmpty query =\n List.isEmpty query.wheres && List.isEmpty query.groupBys\n\n\nfilter_jsonEncode : BoolFilter.Root -> Encode.Value\nfilter_jsonEncode =\n BoolFilter.jsonEncode\n\n\nfilter_getWhereComponents :\n Context\n -> List Segment\n -> List PartCondition\nfilter_getWhereComponents context availableSegments =\n let\n globalFilterParts : List PartCondition\n globalFilterParts =\n filter_getWhereComponents_fromGlobal\n context\n availableSegments\n\n parts =\n context.location\n |> filter_partsFromLocation\n |> (++) globalFilterParts\n |> filter_uniqueParts\n in\n parts\n\n\nfilter_getWhereComponents_fromGlobal : Context -> List Segment -> List PartCondition\nfilter_getWhereComponents_fromGlobal context availableSegments =\n filter_getSelectedSegmentsForGlobalFilter context availableSegments\n |> List.map\n (\\{ viewDbId, dbID } ->\n Part_ViewSegment (unwrapDbID viewDbId) (unwrapDbID dbID) |> PartCondition\n )\n\n\nfilter_getSelectedSegmentsForGlobalFilter :\n Context\n -> List Segment\n -> List Segment\nfilter_getSelectedSegmentsForGlobalFilter context availableSegments =\n let\n globalFilter =\n GlobalFilters.fromLocation context.location\n\n isSelected : Segment -> Bool\n isSelected segment =\n List.member (unwrapID segment.id) globalFilter.segmentIDs\n in\n List.filter isSelected availableSegments\n\n\nfilter_jsonDecoder : Dict String String -> Decode.Decoder (List PartCondition)\nfilter_jsonDecoder viewIDlookupMap =\n BoolFilter.jsonDecoder\n |> Decode.andThen\n (\\filter ->\n case filter_fromBoolFilter viewIDlookupMap filter of\n Err err ->\n Decode.fail err\n\n Ok conditions ->\n Decode.succeed conditions\n )\n\n\nfilter_fromBoolFilter : Dict String String -> BoolFilter.Root -> Result String (List PartCondition)\nfilter_fromBoolFilter viewIDlookupMap filter =\n filter\n |> BoolFilter.conditions\n |> List.map (filter_partFromFilterCondition viewIDlookupMap)\n |> Result.Extra.combine\n\n\nfilter_toBoolFilter : List PartCondition -> BoolFilter.Root\nfilter_toBoolFilter parts =\n allPartsOrdered\n |> List.foldl (filter_toBoolFilter_addPart parts) BoolFilter.empty\n |> BoolFilter.collapse\n\n\nfilter_toBoolFilter_addPart : List PartCondition -> PartTemplate -> BoolFilter.Root -> BoolFilter.Root\nfilter_toBoolFilter_addPart allPartsInFilter (PartTemplate templatePart) filter =\n let\n haveSamePartTemplate_ (PartCondition partCondition) =\n haveSamePartTemplate templatePart partCondition\n in\n allPartsInFilter\n -- Filter parts for this template\n |> List.filter haveSamePartTemplate_\n |> filter_joinTemplateConditions\n -- And join using AND with the rest of the filter\n |> (\\joined -> BoolFilter.addAnd joined filter)\n\n\nfilter_joinTemplateConditions : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions conditions =\n let\n viewBranches =\n conditions\n |> List.filter isViewCondition\n |> filter_joinTemplateConditions_views\n\n tagBranches =\n conditions\n |> List.filter isTagCondition\n |> filter_joinTemplateConditions_tags\n\n restBranches : List BoolFilter.Branch\n restBranches =\n conditions\n |> List.filter isNeitherViewOrTagCondition\n |> List.map filter_toBoolFilter_partToCondition\n in\n (restBranches ++ [ viewBranches, tagBranches ])\n |> BoolFilter.joinBranchesUsingOr\n\n\nisViewCondition : PartCondition -> Bool\nisViewCondition (PartCondition part) =\n case part of\n Part_ViewSegment _ _ _ ->\n True\n\n _ ->\n False\n\n\nisTagCondition : PartCondition -> Bool\nisTagCondition (PartCondition part) =\n case part of\n Part_Tag _ _ ->\n True\n\n _ ->\n False\n\n\nisNeitherViewOrTagCondition : PartCondition -> Bool\nisNeitherViewOrTagCondition condition =\n not (isViewCondition condition)\n && not (isTagCondition condition)\n\n\n{-| View branches are special\nSame view needs to be joined with OR\nDifferent views need to be joined with AND\n-}\nfilter_joinTemplateConditions_views : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_views conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_ViewSegment _ id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_tags : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_tags conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_Tag id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_dimension :\n { getDimensionID : PartCondition -> Maybe String\n }\n -> List PartCondition\n -> BoolFilter.Branch\nfilter_joinTemplateConditions_dimension config conditionsForViews =\n let\n isSameDimensionID wantedID condition =\n config.getDimensionID condition == Just wantedID\n\n getConditionsFor wantedID =\n List.filter (isSameDimensionID wantedID) conditionsForViews\n\n joinGroup : List PartCondition -> BoolFilter.Branch\n joinGroup group =\n group\n |> List.map filter_toBoolFilter_partToCondition\n |> BoolFilter.joinBranchesUsingOr\n in\n conditionsForViews\n -- Collect the dimension ids\n |> List.filterMap config.getDimensionID\n -- Ensure the list is unique\n |> Set.fromList\n |> Set.toList\n -- For each collect the relevant conditions\n |> List.map getConditionsFor\n -- Join each of these groups using OR\n |> List.map joinGroup\n -- Join the groups using AND\n |> BoolFilter.joinBranchesUsingAnd\n\n\nfilter_toBoolFilter_partToCondition : PartCondition -> BoolFilter.Branch\nfilter_toBoolFilter_partToCondition (PartCondition part) =\n case part of\n Part_Arn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.arn\n arn\n |> BoolFilter.branchCondition\n\n Part_AwsAccountID id ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_account_id\n id\n |> BoolFilter.branchCondition\n\n Part_AwsProductCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_product_code\n code\n |> BoolFilter.branchCondition\n\n Part_AwsRegionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_region_code\n code\n |> BoolFilter.branchCondition\n\n Part_FinancialCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.financial_cost\n condition\n\n Part_UsageCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_cost\n condition\n\n Part_Kind kind ->\n BoolFilter.equalStr\n dimensionKeysV2.kind\n kind\n |> BoolFilter.branchCondition\n\n Part_PaymentOptionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.payment_option_code\n (PaymentOptionCode.toString code)\n |> BoolFilter.branchCondition\n\n Part_ReservationArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.reservation_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_ResourceType rt ->\n BoolFilter.equalStr\n dimensionKeysV2.resource_type\n rt\n |> BoolFilter.branchCondition\n\n Part_SavingsPlanArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.savings_plan_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_SubUsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.sub_usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_Tag k v ->\n BoolFilter.matchesStr\n (dimensionKeysV2.tags ++ \".\" ++ k)\n v\n |> BoolFilter.branchCondition\n\n Part_UsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_UsageQuantity condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_quantity\n condition\n\n Part_ViewSegment _ _ segmentID ->\n BoolFilter.listIncludes\n dimensionKeysV2.segment_ids\n segmentID\n |> BoolFilter.branchCondition\n\n\nboolFilterConditionsForNumeric : String -> NumericCondition -> BoolFilter.Branch\nboolFilterConditionsForNumeric key numericCondition =\n case numericCondition of\n NumericCondition_None ->\n BoolFilter.branchNoOp\n\n NumericCondition_MoreOrEqualThan value ->\n BoolFilter.moreOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_LessOrEqualThan value ->\n BoolFilter.lessOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_Between min max ->\n BoolFilter.and\n (BoolFilter.moreOrEqualThanStr key min |> BoolFilter.branchCondition)\n (BoolFilter.lessOrEqualThanStr key max |> BoolFilter.branchCondition)\n\n\n\n-- FILTER AND GROUP BY\n\n\nquery_encodeQuery : ReportQuery -> Encode.Value\nquery_encodeQuery reportQuery =\n let\n month =\n Format.monthInYearToISO reportQuery.selectedMonth\n in\n Encode.object\n [ ( \"version\", Encode.int 1 )\n , ( \"query\"\n , Encode.object\n [ ( \"duration\", Encode.string (month ++ \"T00:00:00.000Z/P1M\") )\n , ( \"group_by\", groupBys_jsonEncode reportQuery.groupBys )\n , ( \"where\", filter_toBoolFilter reportQuery.wheres |> filter_jsonEncode )\n ]\n )\n ]\n\n\nquery_decoder : Dict String String -> Decode.Decoder ReportQuery\nquery_decoder viewIDlookupMap =\n Decode.map3 ReportQuery\n (Decode.field \"duration\" monthDecoder)\n (Decode.field \"where\" (filter_jsonDecoder viewIDlookupMap))\n (Decode.field \"group_by\" groupBys_jsonDecoder)\n\n\nmonthDecoder : Decode.Decoder Times.MonthInYear\nmonthDecoder =\n Decode.string\n |> Decode.andThen\n (\\month ->\n case String.split \"T\" month of\n [ a, b ] ->\n case Times.isoToDate a of\n Nothing ->\n Decode.fail a\n\n Just date ->\n Times.dateToMonthInYear date\n |> Decode.succeed\n\n _ ->\n Decode.fail month\n )\n\n\ndateRange_setMonthInReportQuery : Times.MonthInYear -> ReportQuery -> ReportQuery\ndateRange_setMonthInReportQuery monthInYear query =\n { query\n | selectedMonth = monthInYear\n }\n\n\ndataRange_removeFromLocation : AppLocation -> AppLocation\ndataRange_removeFromLocation location =\n { location | query = dataRange_removeFromQuery location.query }\n\n\ndataRange_removeFromQuery : AppLocation.Query -> AppLocation.Query\ndataRange_removeFromQuery query =\n AppLocation.removeQuery (withNameSpace dimensionKeysV2.month) query\n\n\nfilter_setMonthInLocation : Times.MonthInYear -> AppLocation -> AppLocation\nfilter_setMonthInLocation monthInYear location =\n let\n iso =\n monthInYear\n |> Format.monthInYearToISO\n\n query =\n setQueryStr\n (withNameSpace dimensionKeysV2.month)\n iso\n location.query\n in\n { location\n | query = query\n }\n\n\nfilter_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\nfilter_removeAllPartsFromReportQuery query =\n { query\n | wheres = []\n }\n\n\nfilter_removeAllPartsFromLocation : AppLocation -> AppLocation\nfilter_removeAllPartsFromLocation location =\n { location | query = filter_removeAllPartsFromQuery location.query }\n\n\nfilter_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\nfilter_removeAllPartsFromQuery query =\n List.foldl\n filter_removePartDimensionFromQuery\n query\n allPartsOrdered\n\n\nfilter_removePartDimensionFromQuery : PartTemplate -> AppLocation.Query -> AppLocation.Query\nfilter_removePartDimensionFromQuery part query =\n AppLocation.removeQuery\n (queryKeyForPart part)\n query\n\n\nfilter_removePartConditionFromReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_removePartConditionFromReportQuery part query =\n { query\n | wheres = filter_removePartCondition part query.wheres\n }\n\n\nfilter_removePartConditionFromLocation : PartCondition -> AppLocation -> AppLocation\nfilter_removePartConditionFromLocation part location =\n { location | query = filter_removePartConditionFromQuery part location.query }\n\n\nfilter_removePartConditionFromQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_removePartConditionFromQuery part query =\n let\n newParts : List PartCondition\n newParts =\n query\n |> filter_partsFromQuery\n |> filter_removePartCondition part\n in\n query\n |> filter_setPartsInQuery newParts\n\n\nfilter_removePartCondition part parts =\n List.filter (isSamePartCondition part >> not) parts\n\n\nfilter_addPartsToLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_addPartsToLocation parts location =\n { location\n | query = filter_addPartsToLocationQuery parts location.query\n }\n\n\nfilter_addPartConditionToLocation : PartCondition -> AppLocation -> AppLocation\nfilter_addPartConditionToLocation part location =\n { location\n | query = filter_addPartToLocationQuery part location.query\n }\n\n\nfilter_addPartConditionToReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartConditionToReportQuery part query =\n { query\n | wheres = part :: query.wheres\n }\n\n\nfilter_addPartsToLocationQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartsToLocationQuery parts query =\n List.foldl filter_addPartToLocationQuery query parts\n\n\nfilter_addPartToLocationQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartToLocationQuery (PartCondition part) query =\n case part of\n Part_Arn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.arn)\n arn\n query\n\n Part_AwsAccountID id ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_account_id)\n id\n query\n\n Part_AwsProductCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_product_code)\n code\n query\n\n Part_AwsRegionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_region_code)\n code\n query\n\n Part_FinancialCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.financial_cost)\n condition\n query\n\n Part_UsageCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_cost)\n condition\n query\n\n Part_Kind kind ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.kind)\n kind\n query\n\n Part_PaymentOptionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.payment_option_code)\n (PaymentOptionCode.toString code)\n query\n\n Part_ReservationArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.reservation_arn)\n arn\n query\n\n Part_ResourceType rt ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.resource_type)\n rt\n query\n\n Part_SavingsPlanArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n arn\n query\n\n Part_SubUsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.sub_usage_code)\n code\n query\n\n Part_Tag k v ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.tags)\n (k ++ valueKeySeparator ++ v)\n query\n\n Part_UsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.usage_code)\n code\n query\n\n Part_UsageQuantity condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_quantity)\n condition\n query\n\n Part_ViewSegment v s ->\n -- rd.segments[]=974|104302&rd.segments[]=849|102740\n addListValueToQuery\n (withNameSpace dimensionKeysV2.segment_ids)\n (v ++ valueKeySeparator ++ s)\n query\n\n\naddNumericConditionToQuery : String -> NumericCondition -> AppLocation.Query -> AppLocation.Query\naddNumericConditionToQuery key numericCondition query =\n let\n value =\n encodeNumericCondition numericCondition\n in\n case numericCondition of\n NumericCondition_None ->\n removeQuery key query\n\n _ ->\n query\n |> addSingleValueToQuery\n key\n value\n\n\naddSingleValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddSingleValueToQuery key value query =\n setQueryStr key value query\n\n\naddListValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddListValueToQuery key value query =\n let\n currentValues =\n getQueryAsStringList key query\n\n nextValues =\n (currentValues ++ [ value ]) |> List.Extra.unique\n in\n setQueryListStr\n key\n nextValues\n query\n\n\nfilter_addPartsToReportQuery : List PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartsToReportQuery parts query =\n { query\n | wheres = parts ++ query.wheres |> filter_uniqueParts\n }\n\n\nfilter_uniqueParts : List PartCondition -> List PartCondition\nfilter_uniqueParts parts =\n List.Extra.uniqueBy codeForPartConditionUnique parts\n\n\n{-| Replace the current parts with the given list\n-}\nfilter_setPartsInLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_setPartsInLocation parts location =\n { location | query = filter_setPartsInQuery parts location.query }\n\n\nfilter_setPartsInQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_setPartsInQuery parts query =\n query\n |> filter_removeAllPartsFromQuery\n |> filter_addPartsToLocationQuery parts\n\n\ngroupBys_setGroupBysInLocation : List PartDimension -> AppLocation -> AppLocation\ngroupBys_setGroupBysInLocation groupByParts location =\n location\n |> setQueryListStrInLocation\n queryKeys.exploreData.groupBy\n (List.filterMap groupBys_partToCode groupByParts)\n\n\nmaybeUnrwap_Part_Tag part =\n case part of\n Part_Tag k v ->\n Just ( k, v )\n\n _ ->\n Nothing\n\n\nmaybeUnrwap_Part_ViewSegment part =\n case part of\n Part_ViewSegment v s ->\n Just ( v, s )\n\n _ ->\n Nothing\n\n\nselectedMonthFromLocation : AppLocation -> Maybe String\nselectedMonthFromLocation location =\n location.query\n |> getStringFromQuery\n (withNameSpace dimensionKeysV2.month)\n\n\nselectedMonthFromLocationAsTime : AppLocation -> Maybe Posix\nselectedMonthFromLocationAsTime =\n selectedMonthFromLocation\n >> Maybe.andThen (Times.posixFromIso >> Result.toMaybe)\n\n\nselectedMonthFromLocationAsDate : AppLocation -> Maybe Date\nselectedMonthFromLocationAsDate =\n selectedMonthFromLocation\n >> Maybe.andThen (Date.fromIsoString >> Result.toMaybe)\n\n\nselectedMonthFromLocationWithDefault : Context -> Posix\nselectedMonthFromLocationWithDefault context =\n selectedMonthFromLocationAsTime context.location\n |> Maybe.withDefault (Times.beginningOfMonth Time.utc context.currentTime)\n\n\nselectedMonthFromLocationWithDefaultAsMonth : Context -> Times.MonthInYear\nselectedMonthFromLocationWithDefaultAsMonth context =\n selectedMonthFromLocationAsDate context.location\n |> Maybe.map Times.dateToMonthInYear\n |> Maybe.withDefault (selectedMonthDefaultFromContext context)\n\n\nselectedMonthDefaultFromContext : Context -> Times.MonthInYear\nselectedMonthDefaultFromContext context =\n Date.fromPosix Time.utc context.currentTime\n |> Times.dateToMonthInYear\n\n\n\n-- helpers\n\n\ngetStringFromQuery : String -> Query -> Maybe String\ngetStringFromQuery key query =\n getQueryAsStr key query\n\n\nvalidateNumericCondition : NumericCondition -> Maybe NumericCondition\nvalidateNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n Nothing\n\n NumericCondition_LessOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_MoreOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_Between minValue maxValue ->\n if String.isEmpty minValue then\n Nothing\n\n else if String.isEmpty maxValue then\n Nothing\n\n else\n Maybe.map2\n (\\minFloat maxFloat ->\n NumericCondition_Between\n (String.fromFloat (min minFloat maxFloat))\n (String.fromFloat (max minFloat maxFloat))\n )\n (String.toFloat minValue)\n (String.toFloat maxValue)\n\n\nlocationForArn : String -> AppLocation -> AppLocation\nlocationForArn arn location =\n let\n condition =\n PartCondition (Part_Arn arn)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n\n\nlocationForViewSegment : String -> String -> AppLocation -> AppLocation\nlocationForViewSegment viewID segmentID location =\n let\n condition =\n PartCondition (Part_ViewSegment viewID segmentID)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n"
}
}
[Trace - 11:59:52 am] Received request 'workspace/configuration - (0)'.
Params: {
"items": [
{
"section": "elmLS"
}
]
}
[Trace - 11:59:52 am] Sending response 'workspace/configuration - (0)'. Processing request took 0ms
Result: [
{
"trace": {
"server": "verbose"
},
"elmPath": "",
"elmFormatPath": "",
"elmTestPath": "",
"disableElmLSDiagnostics": false,
"skipInstallPackageConfirmation": false,
"elmAnalyseTrigger": "never"
}
]
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined"
}
[Error - 11:59:52 am] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined
[Trace - 11:59:52 am] Sending request 'textDocument/documentSymbol - (1)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
}
}
[Trace - 11:59:52 am] Sending request 'textDocument/codeAction - (2)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
},
"range": {
"start": {
"line": 1764,
"character": 43
},
"end": {
"line": 1764,
"character": 43
}
},
"context": {
"diagnostics": []
}
}
TypeError: Cannot read property 'synchronize' of undefined
/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1
var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.TreeSitter=t()}(0,function(){var e,t={};for(e in Module)Module.hasOwnProperty(e)&&(t[e]=Module[e]);var r,n,s=[],o=function(e,t){throw t},_=!1,a=!1;_="object"==typeof window,a="function"==typeof importScripts,r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,n=!_&&!r&&!a;var i,u,l,d,c="";r?(c=a?require("path").dirname(c)+"/":__dirname+"/",i=function(e,t){return l||(l=require("fs")),d||(d=require("path")),e=d.normalize(e),l.readFileSync(e,t?null:"utf8")},u=function(e){var t=i(e,!0);return t.buffer||(t=new Uint8Array(t)),L(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),s=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),process.on("uncaughtExce
RuntimeError: abort(TypeError: Cannot read property 'synchronize' of undefined). Build with -s ASSERTIONS=1 for more info.
at process.fe (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1:10450)
at process.emit (events.js:228:7)
at processPromiseRejections (internal/process/promises.js:201:33)
at processTicksAndRejections (internal/process/task_queues.js:95:32)
[Info - 11:59:52 am] Connection to server got closed. Server will restart.
[Error - 11:59:52 am] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:223:5)
at Pipe.<anonymous> (net.js:664:12)
[Error - 11:59:52 am] Request textDocument/codeAction failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:223:5)
at Pipe.<anonymous> (net.js:664:12)
[Trace - 11:59:52 am] Sending request 'initialize - (0)'.
Params: {
"processId": 453470,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.52.1"
},
"locale": "en-gb",
"rootPath": "/home/sebastian/Source/staxio/stax",
"rootUri": "file:///home/sebastian/Source/staxio/stax",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": true
}
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
}
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true,
"semanticTokens": {
"refreshSupport": true
},
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
}
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"insertReplaceSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
},
"activeParameterSupport": true
},
"contextSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"honorsChangeAnnotations": false
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"prepareSupportDefaultBehavior": 1,
"honorsChangeAnnotations": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false
},
"linkedEditingRange": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "1.1.0"
}
}
},
"initializationOptions": {
"elmFormatPath": "",
"elmPath": "",
"elmTestPath": "",
"trace": {
"server": "verbose"
},
"extendedCapabilities": {
"moveFunctionRefactoringSupport": true,
"exposeUnexposeSupport": true
},
"disableElmLSDiagnostics": false
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/sebastian/Source/staxio/stax",
"name": "stax"
}
],
"workDoneToken": "83c0957c-0559-4a6d-aa52-f2dd415c382a"
}
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm"
}
[Info - 11:59:52 am] Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:52 am] Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:52 am] Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client"
}
[Info - 11:59:52 am] Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client
[Trace - 11:59:52 am] Received notification '$/progress'.
Params: {
"token": "83c0957c-0559-4a6d-aa52-f2dd415c382a",
"value": {
"kind": "begin",
"title": "Indexing Elm",
"percentage": 0
}
}
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Elm version 0.19.1 detected."
}
[Info - 11:59:52 am] Elm version 0.19.1 detected.
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json"
}
[Info - 11:59:52 am] Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 2,
"message": "{\"shortMessage\":\"Command failed with exit code 1: elm make\",\"command\":\"elm make\",\"exitCode\":1,\"stdout\":\"\",\"stderr\":\"\\n-- ERROR -----------------------------------------------------------------------\\n\\nI ran into something that bypassed the normal error reporting process! I\\nextracted whatever information I could from the internal error:\\n\\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\\nThese errors are usually pretty confusing, so start by asking around on one of\\nforums listed at https://elm-lang.org/community to see if anyone can get you\\nunstuck quickly.\\n\\n-- REQUEST ---------------------------------------------------------------------\\n\\nIf you are feeling up to it, please try to get your code down to the smallest\\nversion that still triggers this message. Ideally in a single Main.elm and\\nelm.json file.\\n\\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\\nabout if someone else saw something similar. More examples is better!\\n\\nThis kind of error is usually tied up in larger architectural choices that are\\nhard to change, so even when we have a couple good examples, it can take some\\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\",\"failed\":true,\"timedOut\":false,\"isCanceled\":false,\"killed\":false}"
}
[Warn - 11:59:52 am] {"shortMessage":"Command failed with exit code 1: elm make","command":"elm make","exitCode":1,"stdout":"","stderr":"\n-- ERROR -----------------------------------------------------------------------\n\nI ran into something that bypassed the normal error reporting process! I\nextracted whatever information I could from the internal error:\n\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n\nThese errors are usually pretty confusing, so start by asking around on one of\nforums listed at https://elm-lang.org/community to see if anyone can get you\nunstuck quickly.\n\n-- REQUEST ---------------------------------------------------------------------\n\nIf you are feeling up to it, please try to get your code down to the smallest\nversion that still triggers this message. Ideally in a single Main.elm and\nelm.json file.\n\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\nabout if someone else saw something similar. More examples is better!\n\nThis kind of error is usually tied up in larger architectural choices that are\nhard to change, so even when we have a couple good examples, it can take some\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n","failed":true,"timedOut":false,"isCanceled":false,"killed":false}
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:\nError: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'"
}
[Error - 11:59:52 am] Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:
Error: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'
[Trace - 11:59:52 am] Received notification '$/progress'.
Params: {
"token": "83c0957c-0559-4a6d-aa52-f2dd415c382a",
"value": {
"kind": "end"
}
}
[Trace - 11:59:52 am] Received response 'initialize - (0)' in 416ms.
Result: {
"capabilities": {
"codeActionProvider": {
"resolveProvider": true
},
"codeLensProvider": {
"resolveProvider": true
},
"completionProvider": {
"triggerCharacters": [
"."
]
},
"definitionProvider": true,
"documentFormattingProvider": true,
"documentSymbolProvider": {
"label": "Elm"
},
"executeCommandProvider": {
"commands": [
"elmLS.elmMakeFixer-89be333a6f91513ee4cbcd23225130d6",
"elm.installPackage"
]
},
"foldingRangeProvider": true,
"hoverProvider": true,
"referencesProvider": true,
"renameProvider": {
"prepareProvider": true
},
"selectionRangeProvider": true,
"textDocumentSync": 2,
"workspaceSymbolProvider": true,
"workspace": {
"fileOperations": {
"didCreate": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
},
"willRename": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
},
{
"scheme": "file",
"pattern": {
"glob": "**/",
"matches": "folder"
}
}
]
},
"willDelete": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
}
}
},
"linkedEditingRangeProvider": true
}
}
[Trace - 11:59:52 am] Sending notification 'initialized'.
Params: {}
[Trace - 11:59:52 am] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm",
"languageId": "elm",
"version": 1,
"text": "module Elements.RawDataV3.Filter exposing\n ( allPartsOrdered\n , baseParts\n , codeForPartCondition\n , codeForPartDimension\n , codeForPartTemplate\n , dataRange_removeFromLocation\n , dateRange_setMonthInReportQuery\n , decodeNumericCondition\n , dimensionKeysV2\n , encodeNumericCondition\n , filter_addPartConditionToLocation\n , filter_addPartConditionToReportQuery\n , filter_addPartToLocationQuery\n , filter_addPartsToLocation\n , filter_addPartsToLocationQuery\n , filter_addPartsToReportQuery\n , filter_canAddPart\n , filter_fromBoolFilter\n , filter_getWhereComponents_fromGlobal\n , filter_hasPart\n , filter_jsonDecoder\n , filter_partFromFilterCondition\n , filter_partsFromLocation\n , filter_partsFromQuery\n , filter_removeAllPartsFromLocation\n , filter_removeAllPartsFromReportQuery\n , filter_removePartConditionFromLocation\n , filter_removePartConditionFromReportQuery\n , filter_setMonthInLocation\n , filter_setPartsInLocation\n , filter_toBoolFilter\n , filter_validateAndCorrectCondition\n , groupBys_add\n , groupBys_addToReportQuery\n , groupBys_canUsePart\n , groupBys_fromLocation\n , groupBys_hasAny\n , groupBys_hasPart\n , groupBys_jsonDecoder\n , groupBys_jsonEncode\n , groupBys_remove\n , groupBys_removeAllPartsFromLocation\n , groupBys_removeAllPartsFromReportQuery\n , groupBys_removeFromReportQuery\n , groupBys_setGroupBysInLocation\n , haveSamePartDimension\n , isSamePartCondition\n , isSamePartDimension\n , locationForArn\n , locationForViewSegment\n , partConditionConstructor\n , partConditionToDimension\n , partCondition_haveSameDimension\n , query_decoder\n , query_encodeQuery\n , query_getReportQueryFromLocation\n , query_isEmpty\n , query_setInLocation\n , selectedMonthDefaultFromContext\n , selectedMonthFromLocationWithDefault\n , templateParts\n , withNameSpace\n )\n\nimport Api.Enum.BillingData_PaymentOptionCode as PaymentOptionCode\nimport Date exposing (Date)\nimport Dict exposing (Dict)\nimport Elements.RawDataV3.Types exposing (..)\nimport Json.Decode as Decode\nimport Json.Encode as Encode\nimport Json.Encode.Extra as EncodeExtra\nimport List.Extra\nimport Result.Extra\nimport Set exposing (Set)\nimport Shared.AppLocation as AppLocation exposing (..)\nimport Shared.BoolFilterV2 as BoolFilter\nimport Shared.Context exposing (Context)\nimport Shared.Format as Format\nimport Shared.GlobalFilters as GlobalFilters\nimport Shared.Routes as Routes\nimport Shared.Times as Times\nimport Time exposing (Posix)\n\n\ntemplateParts =\n { arn = Part_Arn \"\"\n , awsAccountID = Part_AwsAccountID \"\"\n , awsProductCode = Part_AwsProductCode \"\"\n , awsRegionCode = Part_AwsRegionCode \"\"\n , financialCost = Part_FinancialCost NumericCondition_None\n , kind = Part_Kind \"\"\n , paymentOptionCode = Part_PaymentOptionCode PaymentOptionCode.Standard\n , reservationArn = Part_ReservationArn \"\"\n , resourceType = Part_ResourceType \"\"\n , savingPlanArn = Part_SavingsPlanArn \"\"\n , subUsageCode = Part_SubUsageCode \"\"\n , tag = Part_Tag \"\" \"\"\n , usageCode = Part_UsageCode \"\"\n , usageCost = Part_UsageCost NumericCondition_None\n , usageQuantity = Part_UsageQuantity NumericCondition_None\n , viewSegment = Part_ViewSegment \"\" \"\"\n }\n\n\ntemplatePartForPart : Part -> PartTemplate\ntemplatePartForPart part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag _ _ ->\n templateParts.tag\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment _ _ _ ->\n templateParts.viewSegment\n in\n PartTemplate part_\n\n\n{-| Is fine to go from specific to general\n-}\npartConditionToDimension : PartCondition -> PartDimension\npartConditionToDimension (PartCondition part) =\n PartDimension part\n\n\npartToPartDimension : Part -> PartDimension\npartToPartDimension part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag key _ ->\n Part_Tag key \"\"\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment global viewID _ ->\n Part_ViewSegment global viewID \"\"\n in\n PartDimension part_\n\n\nallPartsOrdered : List PartTemplate\nallPartsOrdered =\n let\n {-\n This function is useless but will cause the\n compiler to fail if types arent added here. It is\n up to the developer to ensure the are also in the\n return list. This is a work around for union types\n not being iterable\n -}\n ignored thing =\n case thing of\n Part_Arn _ ->\n []\n\n Part_AwsAccountID _ ->\n []\n\n Part_AwsProductCode _ ->\n []\n\n Part_AwsRegionCode _ ->\n []\n\n Part_FinancialCost _ ->\n []\n\n Part_UsageCost _ ->\n []\n\n Part_Kind _ ->\n []\n\n Part_PaymentOptionCode _ ->\n []\n\n Part_ReservationArn _ ->\n []\n\n Part_ResourceType _ ->\n []\n\n Part_SavingsPlanArn _ ->\n []\n\n Part_SubUsageCode _ ->\n []\n\n Part_Tag _ _ ->\n []\n\n Part_UsageCode _ ->\n []\n\n Part_UsageQuantity _ ->\n []\n\n Part_ViewSegment _ _ _ ->\n []\n in\n -- All parts ordered for iteration in UI\n [ templateParts.viewSegment\n , templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n , templateParts.tag\n ]\n ++ ignored (Part_Arn \"\")\n |> List.map PartTemplate\n\n\n{-| Same as all, but without view and tags which are iterated differently\n-}\nbaseParts : List PartTemplate\nbaseParts =\n [ templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n ]\n |> List.map PartTemplate\n\n\n{-| Some conditions can be constructed by providing a single String\n-}\npartConditionConstructor : PartDimension -> Maybe (String -> PartCondition)\npartConditionConstructor (PartDimension part) =\n let\n maybeConstructor =\n case part of\n Part_Arn _ ->\n Just Part_Arn\n\n Part_AwsAccountID _ ->\n Just Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n Just Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n Just Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n Nothing\n\n Part_UsageCost _ ->\n Nothing\n\n Part_Kind _ ->\n Just Part_Kind\n\n Part_PaymentOptionCode _ ->\n (\\s ->\n Part_PaymentOptionCode\n (s\n |> PaymentOptionCode.fromString\n |> Maybe.withDefault PaymentOptionCode.Standard\n )\n )\n |> Just\n\n Part_ReservationArn _ ->\n Just Part_ReservationArn\n\n Part_ResourceType _ ->\n Just Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n Just Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n Just Part_SubUsageCode\n\n Part_Tag key _ ->\n Just (Part_Tag key)\n\n Part_UsageCode _ ->\n Just Part_UsageCode\n\n Part_UsageQuantity _ ->\n Nothing\n\n Part_ViewSegment global view _ ->\n Just (Part_ViewSegment global view)\n in\n case maybeConstructor of\n Nothing ->\n Nothing\n\n Just constructor ->\n Just (constructor >> PartCondition)\n\n\nfilter_hasPart : PartCondition -> List PartCondition -> Bool\nfilter_hasPart part parts =\n case List.Extra.find (isSamePartCondition part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\nfilter_canAddPart : PartCondition -> List PartCondition -> Bool\nfilter_canAddPart part parts =\n if filter_hasPart part parts then\n filter_canAddMultipleOf part\n\n else\n True\n\n\nfilter_validateAndCorrectCondition : PartCondition -> Maybe PartCondition\nfilter_validateAndCorrectCondition (PartCondition part) =\n let\n validateValue value =\n if String.isEmpty value then\n Nothing\n\n else\n Just part\n\n validatedPart =\n case part of\n Part_Arn value ->\n validateValue value\n\n Part_AwsAccountID value ->\n validateValue value\n\n Part_AwsProductCode value ->\n validateValue value\n\n Part_AwsRegionCode value ->\n validateValue value\n\n Part_FinancialCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_FinancialCost corrected)\n\n Part_UsageCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageCost corrected)\n\n Part_Kind value ->\n validateValue value\n\n Part_PaymentOptionCode _ ->\n Just part\n\n Part_ReservationArn value ->\n validateValue value\n\n Part_ResourceType value ->\n validateValue value\n\n Part_SavingsPlanArn value ->\n validateValue value\n\n Part_SubUsageCode value ->\n validateValue value\n\n Part_Tag _ value ->\n validateValue value\n\n Part_UsageCode value ->\n validateValue value\n\n Part_UsageQuantity numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageQuantity corrected)\n\n Part_ViewSegment _ _ segmentID ->\n validateValue segmentID\n in\n validatedPart |> Maybe.map PartCondition\n\n\nfilter_canAddMultipleOf : PartCondition -> Bool\nfilter_canAddMultipleOf (PartCondition part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\nfilter_addPart : PartCondition -> List PartCondition -> List PartCondition\nfilter_addPart part parts =\n if filter_canAddPart part parts then\n parts ++ [ part ]\n\n else\n parts\n\n\nremovePartDimension : PartDimension -> List PartDimension -> List PartDimension\nremovePartDimension part parts =\n parts\n |> List.Extra.filterNot (isSamePartDimension part)\n\n\nremovePartCondition : PartCondition -> List PartCondition -> List PartCondition\nremovePartCondition part parts =\n parts\n |> List.Extra.filterNot (isSamePartCondition part)\n\n\n{-| These are the same template part if they use the same constructor\n-}\nhaveSamePartTemplate : Part -> Part -> Bool\nhaveSamePartTemplate a b =\n templatePartForPart a == templatePartForPart b\n\n\nisSamePartDimension : PartDimension -> PartDimension -> Bool\nisSamePartDimension (PartDimension a) (PartDimension b) =\n haveSamePartDimension a b\n\n\npartCondition_haveSameDimension : PartCondition -> PartCondition -> Bool\npartCondition_haveSameDimension (PartCondition a) (PartCondition b) =\n haveSamePartDimension a b\n\n\n{-| View and Tag are the same dimension if they have the same view or tag key\n-}\nhaveSamePartDimension : Part -> Part -> Bool\nhaveSamePartDimension a b =\n partToPartDimension a == partToPartDimension b\n\n\nisSamePartCondition : PartCondition -> PartCondition -> Bool\nisSamePartCondition a b =\n a == b\n\n\nfilter_partsFromLocation : AppLocation -> List PartCondition\nfilter_partsFromLocation location =\n filter_partsFromQuery location.query\n\n\nfilter_partsFromQuery : Query -> List PartCondition\nfilter_partsFromQuery query =\n allPartsOrdered\n |> List.concatMap (filter_partFromQuery query)\n |> filter_uniqueParts\n\n\n{-| Given a template part e.g. Part\\_Arn \"\"\nThis may return multiple parts [Part_Arn \"123\", Part_Arn \"456\"]\n-}\nfilter_partFromQuery : Query -> PartTemplate -> List PartCondition\nfilter_partFromQuery query (PartTemplate templatePart) =\n let\n parsePair pair =\n case String.split valueKeySeparator pair of\n [ a, b ] ->\n Just ( a, b )\n\n _ ->\n Nothing\n\n partConditions =\n case templatePart of\n Part_Arn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.arn)\n |> List.map Part_Arn\n\n Part_AwsAccountID _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_account_id)\n |> List.map Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_product_code)\n |> List.map Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_region_code)\n |> List.map Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n filter_getNumericInputFromQuery\n Part_FinancialCost\n (withNameSpace dimensionKeysV2.financial_cost)\n query\n\n Part_UsageCost _ ->\n filter_getNumericInputFromQuery\n Part_UsageCost\n (withNameSpace dimensionKeysV2.usage_cost)\n query\n\n Part_Kind _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.kind)\n |> List.map Part_Kind\n\n Part_PaymentOptionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.payment_option_code)\n |> List.filterMap PaymentOptionCode.fromString\n |> List.map Part_PaymentOptionCode\n\n Part_ReservationArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.reservation_arn)\n |> List.map Part_ReservationArn\n\n Part_ResourceType _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.resource_type)\n |> List.map Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n |> List.map Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.sub_usage_code)\n |> List.map Part_SubUsageCode\n\n Part_Tag _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.tags)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_Tag a b)\n\n Part_UsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.usage_code)\n |> List.map Part_UsageCode\n\n Part_UsageQuantity _ ->\n filter_getNumericInputFromQuery\n Part_UsageQuantity\n (withNameSpace dimensionKeysV2.usage_quantity)\n query\n\n Part_ViewSegment _ _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.segment_ids)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_ViewSegment a b)\n in\n partConditions |> List.map PartCondition\n\n\nfilter_partFromFilterCondition : Dict String String -> BoolFilter.Condition -> Result String PartCondition\nfilter_partFromFilterCondition viewIDlookupMap filterCondition =\n let\n keys =\n dimensionKeysV2\n\n ( key, val ) =\n case filterCondition of\n BoolFilter.Eq pair ->\n pair\n\n BoolFilter.NotEq pair ->\n pair\n\n BoolFilter.LessOrEqualThan pair ->\n pair\n\n BoolFilter.LessThan pair ->\n pair\n\n BoolFilter.ListIncludes pair ->\n pair\n\n BoolFilter.Matches pair ->\n pair\n\n BoolFilter.MoreOrEqualThan pair ->\n pair\n\n BoolFilter.MoreThan pair ->\n pair\n\n numericCondition =\n case filterCondition of\n BoolFilter.Eq _ ->\n NumericCondition_None\n\n BoolFilter.NotEq _ ->\n NumericCondition_None\n\n BoolFilter.LessOrEqualThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.LessThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.ListIncludes _ ->\n NumericCondition_None\n\n BoolFilter.Matches _ ->\n NumericCondition_None\n\n BoolFilter.MoreOrEqualThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n BoolFilter.MoreThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n part : Result String Part\n part =\n if key == keys.arn then\n Ok (Part_Arn val)\n\n else if key == keys.aws_account_id then\n Ok (Part_AwsAccountID val)\n\n else if key == keys.aws_product_code then\n Ok (Part_AwsProductCode val)\n\n else if key == keys.aws_region_code then\n Ok (Part_AwsRegionCode val)\n\n else if key == keys.financial_cost then\n Ok (Part_FinancialCost numericCondition)\n\n else if key == keys.usage_cost then\n Ok (Part_UsageCost numericCondition)\n\n else if key == keys.kind then\n Ok (Part_Kind val)\n\n else if key == keys.payment_option_code then\n PaymentOptionCode.fromString val\n |> Result.fromMaybe val\n |> Result.map Part_PaymentOptionCode\n\n else if key == keys.reservation_arn then\n Ok (Part_ReservationArn val)\n\n else if key == keys.resource_type then\n Ok (Part_ResourceType val)\n\n else if key == keys.savings_plan_arn then\n Ok (Part_SavingsPlanArn val)\n\n else if key == keys.sub_usage_code then\n Ok (Part_SubUsageCode val)\n\n else if String.startsWith \"tags\" key then\n case String.split \".\" key of\n [ a, b ] ->\n Ok (Part_Tag b val)\n\n _ ->\n Err key\n\n else if key == keys.usage_code then\n Ok (Part_UsageCode val)\n\n else if key == keys.usage_quantity then\n Ok (Part_UsageQuantity numericCondition)\n\n else if key == keys.segment_ids then\n case Dict.get val viewIDlookupMap of\n Nothing ->\n Err val\n\n Just viewID ->\n Ok (Part_ViewSegment viewID val)\n\n else\n Err key\n in\n part |> Result.map PartCondition\n\n\nfilter_getNumericInputFromQuery :\n (NumericCondition -> Part)\n -> String\n -> AppLocation.Query\n -> List Part\nfilter_getNumericInputFromQuery constructor queryKey query =\n case filter_getNumericConditionFromQuery queryKey query of\n Nothing ->\n []\n\n Just condition ->\n [ constructor condition ]\n\n\nfilter_getNumericConditionFromQuery :\n String\n -> AppLocation.Query\n -> Maybe NumericCondition\nfilter_getNumericConditionFromQuery queryKey query =\n getStringFromQuery queryKey query\n |> Maybe.andThen decodeNumericCondition\n\n\ngroupBys_fromLocation : AppLocation -> List PartDimension\ngroupBys_fromLocation location =\n let\n groupBys =\n getQueryAsStringList queryKeys.exploreData.groupBy location.query\n in\n List.filterMap groupBys_codeToPart groupBys\n\n\ngroupBys_canUsePart : PartDimension -> Bool\ngroupBys_canUsePart (PartDimension part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\ngroupBys_hasAny location =\n groupBys_fromLocation location\n |> List.isEmpty\n |> not\n\n\ngroupBys_add : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_add part parts =\n if groupBys_hasPart part parts then\n parts\n\n else\n parts ++ [ part ]\n\n\ngroupBys_addToReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_addToReportQuery part query =\n { query\n | groupBys = groupBys_add part query.groupBys\n }\n\n\ngroupBys_hasPart : PartDimension -> List PartDimension -> Bool\ngroupBys_hasPart part parts =\n case List.Extra.find (isSamePartDimension part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\ngroupBys_remove : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_remove =\n removePartDimension\n\n\ngroupBys_removeFromReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_removeFromReportQuery part query =\n { query\n | groupBys = groupBys_remove part query.groupBys\n }\n\n\ngroupBys_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\ngroupBys_removeAllPartsFromReportQuery query =\n { query | groupBys = [] }\n\n\ngroupBys_removeAllPartsFromLocation : AppLocation -> AppLocation\ngroupBys_removeAllPartsFromLocation location =\n { location | query = groupBys_removeAllPartsFromQuery location.query }\n\n\ngroupBys_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\ngroupBys_removeAllPartsFromQuery query =\n AppLocation.removeQuery\n queryKeys.exploreData.groupBy\n query\n\n\n{-| Parts that cannot be grouped by will return Nothing\n-}\ngroupBys_partToCode : PartDimension -> Maybe String\ngroupBys_partToCode partDimension =\n if groupBys_canUsePart partDimension then\n Just (codeForPartDimension partDimension)\n\n else\n Nothing\n\n\ngroupBys_codeToPart : String -> Maybe PartDimension\ngroupBys_codeToPart code =\n let\n dims =\n dimensionKeysV2\n\n partCondition =\n if code == dims.arn then\n Just templateParts.arn\n\n else if code == dims.aws_account_id then\n Just templateParts.awsAccountID\n\n else if code == dims.aws_product_code then\n Just templateParts.awsProductCode\n\n else if code == dims.aws_region_code then\n Just templateParts.awsRegionCode\n\n else if code == dims.financial_cost then\n Just templateParts.financialCost\n\n else if code == dims.kind then\n Just templateParts.kind\n\n else if code == dims.payment_option_code then\n Just templateParts.paymentOptionCode\n\n else if code == dims.reservation_arn then\n Just templateParts.reservationArn\n\n else if code == dims.resource_type then\n Just templateParts.resourceType\n\n else if code == dims.savings_plan_arn then\n Just templateParts.savingPlanArn\n\n else if code == dims.sub_usage_code then\n Just templateParts.subUsageCode\n\n else if code == dims.usage_code then\n Just templateParts.usageCode\n\n else if code == dims.usage_cost then\n Just templateParts.usageCost\n\n else if code == dims.usage_quantity then\n Just templateParts.usageQuantity\n\n else if String.startsWith groupByOnlyKeys.tag code then\n Just (Part_Tag (String.replace groupByOnlyKeys.tag \"\" code) \"\")\n\n else if String.startsWith groupByOnlyKeys.viewId code then\n Just (Part_ViewSegment (String.replace groupByOnlyKeys.viewId \"\" code) \"\")\n\n else\n -- Ignored\n -- month\n Nothing\n in\n Maybe.map PartDimension partCondition\n\n\ngroupBys_jsonEncode : List PartDimension -> Encode.Value\ngroupBys_jsonEncode parts =\n parts\n |> List.filterMap groupBys_partToCode\n |> Encode.list Encode.string\n\n\ngroupBys_jsonDecoder : Decode.Decoder (List PartDimension)\ngroupBys_jsonDecoder =\n Decode.list groupBys_jsonDimensionDecoder\n\n\ngroupBys_jsonDimensionDecoder : Decode.Decoder PartDimension\ngroupBys_jsonDimensionDecoder =\n Decode.string\n |> Decode.andThen\n (\\code ->\n case groupBys_codeToPart code of\n Nothing ->\n Decode.fail \"code\"\n\n Just part ->\n Decode.succeed part\n )\n\n\n{-| Dimension keys\nUsed for the URL query string and the API Query\nThese must not be changed as they are expected like this by the API\n-}\ndimensionKeysV2 =\n { arn = \"arn\"\n , aws_account_id = \"linked_account_id\"\n , aws_product_code = \"product_code\"\n , aws_region_code = \"region_code\"\n , financial_cost = \"unallocated_unblended_cost\"\n , kind = \"kind\"\n , month = \"month\"\n , payment_option_code = \"payment_option_code\"\n , reservation_arn = \"reservation_arn\"\n , resource_type = \"resource_type\"\n , savings_plan_arn = \"savings_plan_arn\"\n , segment_ids = \"segment_ids\"\n , sub_usage_code = \"sub_usage_code\"\n , tags = \"tags\"\n , usage_code = \"usage_code\"\n , usage_cost = \"unallocated_amortised_cost\"\n , usage_quantity = \"total_usage_quantity\"\n }\n\n\nnamespace =\n \"rd.\"\n\n\nwithNameSpace key =\n namespace ++ key\n\n\nvalueKeySeparator =\n \"|\"\n\n\ngroupByOnlyKeys =\n { tag = \"tags.\"\n , viewId = \"viewId.\"\n }\n\n\ncodeForPartTemplate : PartTemplate -> String\ncodeForPartTemplate (PartTemplate part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n groupByOnlyKeys.tag\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n groupByOnlyKeys.viewId\n\n\ncodeForPartDimension : PartDimension -> String\ncodeForPartDimension (PartDimension part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag k _ ->\n groupByOnlyKeys.tag ++ k\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ viewId _ ->\n groupByOnlyKeys.viewId ++ viewId\n\n\ncodeForPartCondition : PartCondition -> String\ncodeForPartCondition (PartCondition part) =\n codeForPartDimension (PartDimension part)\n\n\n{-| A unique code for a part condition\nUsed for removing duplicates\n-}\ncodeForPartConditionUnique : PartCondition -> String\ncodeForPartConditionUnique (PartCondition part) =\n case part of\n Part_Arn arn ->\n dimensionKeysV2.arn ++ arn\n\n Part_AwsAccountID id ->\n dimensionKeysV2.aws_account_id ++ id\n\n Part_AwsProductCode code ->\n dimensionKeysV2.aws_product_code ++ code\n\n Part_AwsRegionCode code ->\n dimensionKeysV2.aws_region_code ++ code\n\n Part_FinancialCost condition ->\n dimensionKeysV2.financial_cost ++ encodeNumericCondition condition\n\n Part_UsageCost condition ->\n dimensionKeysV2.usage_cost ++ encodeNumericCondition condition\n\n Part_Kind kind ->\n dimensionKeysV2.kind ++ kind\n\n Part_PaymentOptionCode code ->\n dimensionKeysV2.payment_option_code ++ PaymentOptionCode.toString code\n\n Part_ReservationArn arn ->\n dimensionKeysV2.reservation_arn ++ arn\n\n Part_ResourceType type_ ->\n dimensionKeysV2.resource_type ++ type_\n\n Part_SavingsPlanArn arn ->\n dimensionKeysV2.savings_plan_arn ++ arn\n\n Part_SubUsageCode code ->\n dimensionKeysV2.sub_usage_code ++ code\n\n Part_Tag k v ->\n groupByOnlyKeys.tag ++ k ++ \"=\" ++ v\n\n Part_UsageCode code ->\n dimensionKeysV2.usage_code ++ code\n\n Part_UsageQuantity condition ->\n dimensionKeysV2.usage_quantity ++ encodeNumericCondition condition\n\n Part_ViewSegment _ viewId segmentID ->\n groupByOnlyKeys.viewId ++ viewId ++ segmentID\n\n\n{-| Used in the query string too\nMust be query string safe. Dont' use:\n\n : / ? # [ ] @ ! $ & ' ( ) * + , ; =\n\nOk to use:\n\n - . _ ~\n\nUsed like\n\n ?rd.usage_cost=between.123~344&...\n\n-}\nencodeNumericCondition : NumericCondition -> String\nencodeNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n \"none\"\n\n NumericCondition_MoreOrEqualThan value ->\n \"get_\" ++ value\n\n NumericCondition_LessOrEqualThan value ->\n \"let_\" ++ value\n\n NumericCondition_Between one two ->\n \"between_\" ++ one ++ \"~\" ++ two\n\n\ndecodeNumericCondition : String -> Maybe NumericCondition\ndecodeNumericCondition value =\n case String.split \"_\" value of\n [ operation, body ] ->\n case operation of\n \"get\" ->\n Just (NumericCondition_MoreOrEqualThan body)\n\n \"let\" ->\n Just (NumericCondition_LessOrEqualThan body)\n\n \"between\" ->\n case String.split \"~\" body of\n [ min, max ] ->\n Just (NumericCondition_Between min max)\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n\n{-|\n\n e.g. rd.segment_ids\n\n-}\nqueryKeyForPart : PartTemplate -> String\nqueryKeyForPart (PartTemplate part) =\n let\n key =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n dimensionKeysV2.tags\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n dimensionKeysV2.segment_ids\n in\n withNameSpace key\n\n\n\n-- FILTER\n\n\nquery_getReportQueryFromLocation : Context -> List Segment -> ReportQuery\nquery_getReportQueryFromLocation context availableSegments =\n let\n selectedMonth =\n selectedMonthFromLocationWithDefaultAsMonth context\n\n whereFilterComponents : List PartCondition\n whereFilterComponents =\n filter_getWhereComponents\n context\n availableSegments\n\n groupBys : List PartDimension\n groupBys =\n groupBys_fromLocation\n context.location\n in\n { selectedMonth = selectedMonth\n , wheres = whereFilterComponents\n , groupBys = groupBys\n }\n\n\nquery_setInLocation : ReportQuery -> AppLocation -> AppLocation\nquery_setInLocation query location =\n location\n |> filter_setMonthInLocation query.selectedMonth\n |> filter_setPartsInLocation query.wheres\n |> groupBys_setGroupBysInLocation query.groupBys\n\n\nquery_isEmpty : ReportQuery -> Bool\nquery_isEmpty query =\n List.isEmpty query.wheres && List.isEmpty query.groupBys\n\n\nfilter_jsonEncode : BoolFilter.Root -> Encode.Value\nfilter_jsonEncode =\n BoolFilter.jsonEncode\n\n\nfilter_getWhereComponents :\n Context\n -> List Segment\n -> List PartCondition\nfilter_getWhereComponents context availableSegments =\n let\n globalFilterParts : List PartCondition\n globalFilterParts =\n filter_getWhereComponents_fromGlobal\n context\n availableSegments\n\n parts =\n context.location\n |> filter_partsFromLocation\n |> (++) globalFilterParts\n |> filter_uniqueParts\n in\n parts\n\n\nfilter_getWhereComponents_fromGlobal : Context -> List Segment -> List PartCondition\nfilter_getWhereComponents_fromGlobal context availableSegments =\n filter_getSelectedSegmentsForGlobalFilter context availableSegments\n |> List.map\n (\\{ viewDbId, dbID } ->\n Part_ViewSegment (unwrapDbID viewDbId) (unwrapDbID dbID) |> PartCondition\n )\n\n\nfilter_getSelectedSegmentsForGlobalFilter :\n Context\n -> List Segment\n -> List Segment\nfilter_getSelectedSegmentsForGlobalFilter context availableSegments =\n let\n globalFilter =\n GlobalFilters.fromLocation context.location\n\n isSelected : Segment -> Bool\n isSelected segment =\n List.member (unwrapID segment.id) globalFilter.segmentIDs\n in\n List.filter isSelected availableSegments\n\n\nfilter_jsonDecoder : Dict String String -> Decode.Decoder (List PartCondition)\nfilter_jsonDecoder viewIDlookupMap =\n BoolFilter.jsonDecoder\n |> Decode.andThen\n (\\filter ->\n case filter_fromBoolFilter viewIDlookupMap filter of\n Err err ->\n Decode.fail err\n\n Ok conditions ->\n Decode.succeed conditions\n )\n\n\nfilter_fromBoolFilter : Dict String String -> BoolFilter.Root -> Result String (List PartCondition)\nfilter_fromBoolFilter viewIDlookupMap filter =\n filter\n |> BoolFilter.conditions\n |> List.map (filter_partFromFilterCondition viewIDlookupMap)\n |> Result.Extra.combine\n\n\nfilter_toBoolFilter : List PartCondition -> BoolFilter.Root\nfilter_toBoolFilter parts =\n allPartsOrdered\n |> List.foldl (filter_toBoolFilter_addPart parts) BoolFilter.empty\n |> BoolFilter.collapse\n\n\nfilter_toBoolFilter_addPart : List PartCondition -> PartTemplate -> BoolFilter.Root -> BoolFilter.Root\nfilter_toBoolFilter_addPart allPartsInFilter (PartTemplate templatePart) filter =\n let\n haveSamePartTemplate_ (PartCondition partCondition) =\n haveSamePartTemplate templatePart partCondition\n in\n allPartsInFilter\n -- Filter parts for this template\n |> List.filter haveSamePartTemplate_\n |> filter_joinTemplateConditions\n -- And join using AND with the rest of the filter\n |> (\\joined -> BoolFilter.addAnd joined filter)\n\n\nfilter_joinTemplateConditions : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions conditions =\n let\n viewBranches =\n conditions\n |> List.filter isViewCondition\n |> filter_joinTemplateConditions_views\n\n tagBranches =\n conditions\n |> List.filter isTagCondition\n |> filter_joinTemplateConditions_tags\n\n restBranches : List BoolFilter.Branch\n restBranches =\n conditions\n |> List.filter isNeitherViewOrTagCondition\n |> List.map filter_toBoolFilter_partToCondition\n in\n (restBranches ++ [ viewBranches, tagBranches ])\n |> BoolFilter.joinBranchesUsingOr\n\n\nisViewCondition : PartCondition -> Bool\nisViewCondition (PartCondition part) =\n case part of\n Part_ViewSegment _ _ _ ->\n True\n\n _ ->\n False\n\n\nisTagCondition : PartCondition -> Bool\nisTagCondition (PartCondition part) =\n case part of\n Part_Tag _ _ ->\n True\n\n _ ->\n False\n\n\nisNeitherViewOrTagCondition : PartCondition -> Bool\nisNeitherViewOrTagCondition condition =\n not (isViewCondition condition)\n && not (isTagCondition condition)\n\n\n{-| View branches are special\nSame view needs to be joined with OR\nDifferent views need to be joined with AND\n-}\nfilter_joinTemplateConditions_views : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_views conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_ViewSegment _ id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_tags : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_tags conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_Tag id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_dimension :\n { getDimensionID : PartCondition -> Maybe String\n }\n -> List PartCondition\n -> BoolFilter.Branch\nfilter_joinTemplateConditions_dimension config conditionsForViews =\n let\n isSameDimensionID wantedID condition =\n config.getDimensionID condition == Just wantedID\n\n getConditionsFor wantedID =\n List.filter (isSameDimensionID wantedID) conditionsForViews\n\n joinGroup : List PartCondition -> BoolFilter.Branch\n joinGroup group =\n group\n |> List.map filter_toBoolFilter_partToCondition\n |> BoolFilter.joinBranchesUsingOr\n in\n conditionsForViews\n -- Collect the dimension ids\n |> List.filterMap config.getDimensionID\n -- Ensure the list is unique\n |> Set.fromList\n |> Set.toList\n -- For each collect the relevant conditions\n |> List.map getConditionsFor\n -- Join each of these groups using OR\n |> List.map joinGroup\n -- Join the groups using AND\n |> BoolFilter.joinBranchesUsingAnd\n\n\nfilter_toBoolFilter_partToCondition : PartCondition -> BoolFilter.Branch\nfilter_toBoolFilter_partToCondition (PartCondition part) =\n case part of\n Part_Arn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.arn\n arn\n |> BoolFilter.branchCondition\n\n Part_AwsAccountID id ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_account_id\n id\n |> BoolFilter.branchCondition\n\n Part_AwsProductCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_product_code\n code\n |> BoolFilter.branchCondition\n\n Part_AwsRegionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_region_code\n code\n |> BoolFilter.branchCondition\n\n Part_FinancialCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.financial_cost\n condition\n\n Part_UsageCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_cost\n condition\n\n Part_Kind kind ->\n BoolFilter.equalStr\n dimensionKeysV2.kind\n kind\n |> BoolFilter.branchCondition\n\n Part_PaymentOptionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.payment_option_code\n (PaymentOptionCode.toString code)\n |> BoolFilter.branchCondition\n\n Part_ReservationArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.reservation_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_ResourceType rt ->\n BoolFilter.equalStr\n dimensionKeysV2.resource_type\n rt\n |> BoolFilter.branchCondition\n\n Part_SavingsPlanArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.savings_plan_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_SubUsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.sub_usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_Tag k v ->\n BoolFilter.matchesStr\n (dimensionKeysV2.tags ++ \".\" ++ k)\n v\n |> BoolFilter.branchCondition\n\n Part_UsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_UsageQuantity condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_quantity\n condition\n\n Part_ViewSegment _ _ segmentID ->\n BoolFilter.listIncludes\n dimensionKeysV2.segment_ids\n segmentID\n |> BoolFilter.branchCondition\n\n\nboolFilterConditionsForNumeric : String -> NumericCondition -> BoolFilter.Branch\nboolFilterConditionsForNumeric key numericCondition =\n case numericCondition of\n NumericCondition_None ->\n BoolFilter.branchNoOp\n\n NumericCondition_MoreOrEqualThan value ->\n BoolFilter.moreOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_LessOrEqualThan value ->\n BoolFilter.lessOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_Between min max ->\n BoolFilter.and\n (BoolFilter.moreOrEqualThanStr key min |> BoolFilter.branchCondition)\n (BoolFilter.lessOrEqualThanStr key max |> BoolFilter.branchCondition)\n\n\n\n-- FILTER AND GROUP BY\n\n\nquery_encodeQuery : ReportQuery -> Encode.Value\nquery_encodeQuery reportQuery =\n let\n month =\n Format.monthInYearToISO reportQuery.selectedMonth\n in\n Encode.object\n [ ( \"version\", Encode.int 1 )\n , ( \"query\"\n , Encode.object\n [ ( \"duration\", Encode.string (month ++ \"T00:00:00.000Z/P1M\") )\n , ( \"group_by\", groupBys_jsonEncode reportQuery.groupBys )\n , ( \"where\", filter_toBoolFilter reportQuery.wheres |> filter_jsonEncode )\n ]\n )\n ]\n\n\nquery_decoder : Dict String String -> Decode.Decoder ReportQuery\nquery_decoder viewIDlookupMap =\n Decode.map3 ReportQuery\n (Decode.field \"duration\" monthDecoder)\n (Decode.field \"where\" (filter_jsonDecoder viewIDlookupMap))\n (Decode.field \"group_by\" groupBys_jsonDecoder)\n\n\nmonthDecoder : Decode.Decoder Times.MonthInYear\nmonthDecoder =\n Decode.string\n |> Decode.andThen\n (\\month ->\n case String.split \"T\" month of\n [ a, b ] ->\n case Times.isoToDate a of\n Nothing ->\n Decode.fail a\n\n Just date ->\n Times.dateToMonthInYear date\n |> Decode.succeed\n\n _ ->\n Decode.fail month\n )\n\n\ndateRange_setMonthInReportQuery : Times.MonthInYear -> ReportQuery -> ReportQuery\ndateRange_setMonthInReportQuery monthInYear query =\n { query\n | selectedMonth = monthInYear\n }\n\n\ndataRange_removeFromLocation : AppLocation -> AppLocation\ndataRange_removeFromLocation location =\n { location | query = dataRange_removeFromQuery location.query }\n\n\ndataRange_removeFromQuery : AppLocation.Query -> AppLocation.Query\ndataRange_removeFromQuery query =\n AppLocation.removeQuery (withNameSpace dimensionKeysV2.month) query\n\n\nfilter_setMonthInLocation : Times.MonthInYear -> AppLocation -> AppLocation\nfilter_setMonthInLocation monthInYear location =\n let\n iso =\n monthInYear\n |> Format.monthInYearToISO\n\n query =\n setQueryStr\n (withNameSpace dimensionKeysV2.month)\n iso\n location.query\n in\n { location\n | query = query\n }\n\n\nfilter_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\nfilter_removeAllPartsFromReportQuery query =\n { query\n | wheres = []\n }\n\n\nfilter_removeAllPartsFromLocation : AppLocation -> AppLocation\nfilter_removeAllPartsFromLocation location =\n { location | query = filter_removeAllPartsFromQuery location.query }\n\n\nfilter_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\nfilter_removeAllPartsFromQuery query =\n List.foldl\n filter_removePartDimensionFromQuery\n query\n allPartsOrdered\n\n\nfilter_removePartDimensionFromQuery : PartTemplate -> AppLocation.Query -> AppLocation.Query\nfilter_removePartDimensionFromQuery part query =\n AppLocation.removeQuery\n (queryKeyForPart part)\n query\n\n\nfilter_removePartConditionFromReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_removePartConditionFromReportQuery part query =\n { query\n | wheres = filter_removePartCondition part query.wheres\n }\n\n\nfilter_removePartConditionFromLocation : PartCondition -> AppLocation -> AppLocation\nfilter_removePartConditionFromLocation part location =\n { location | query = filter_removePartConditionFromQuery part location.query }\n\n\nfilter_removePartConditionFromQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_removePartConditionFromQuery part query =\n let\n newParts : List PartCondition\n newParts =\n query\n |> filter_partsFromQuery\n |> filter_removePartCondition part\n in\n query\n |> filter_setPartsInQuery newParts\n\n\nfilter_removePartCondition part parts =\n List.filter (isSamePartCondition part >> not) parts\n\n\nfilter_addPartsToLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_addPartsToLocation parts location =\n { location\n | query = filter_addPartsToLocationQuery parts location.query\n }\n\n\nfilter_addPartConditionToLocation : PartCondition -> AppLocation -> AppLocation\nfilter_addPartConditionToLocation part location =\n { location\n | query = filter_addPartToLocationQuery part location.query\n }\n\n\nfilter_addPartConditionToReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartConditionToReportQuery part query =\n { query\n | wheres = part :: query.wheres\n }\n\n\nfilter_addPartsToLocationQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartsToLocationQuery parts query =\n List.foldl filter_addPartToLocationQuery query parts\n\n\nfilter_addPartToLocationQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartToLocationQuery (PartCondition part) query =\n case part of\n Part_Arn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.arn)\n arn\n query\n\n Part_AwsAccountID id ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_account_id)\n id\n query\n\n Part_AwsProductCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_product_code)\n code\n query\n\n Part_AwsRegionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_region_code)\n code\n query\n\n Part_FinancialCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.financial_cost)\n condition\n query\n\n Part_UsageCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_cost)\n condition\n query\n\n Part_Kind kind ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.kind)\n kind\n query\n\n Part_PaymentOptionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.payment_option_code)\n (PaymentOptionCode.toString code)\n query\n\n Part_ReservationArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.reservation_arn)\n arn\n query\n\n Part_ResourceType rt ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.resource_type)\n rt\n query\n\n Part_SavingsPlanArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n arn\n query\n\n Part_SubUsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.sub_usage_code)\n code\n query\n\n Part_Tag k v ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.tags)\n (k ++ valueKeySeparator ++ v)\n query\n\n Part_UsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.usage_code)\n code\n query\n\n Part_UsageQuantity condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_quantity)\n condition\n query\n\n Part_ViewSegment v s ->\n -- rd.segments[]=974|104302&rd.segments[]=849|102740\n addListValueToQuery\n (withNameSpace dimensionKeysV2.segment_ids)\n (v ++ valueKeySeparator ++ s)\n query\n\n\naddNumericConditionToQuery : String -> NumericCondition -> AppLocation.Query -> AppLocation.Query\naddNumericConditionToQuery key numericCondition query =\n let\n value =\n encodeNumericCondition numericCondition\n in\n case numericCondition of\n NumericCondition_None ->\n removeQuery key query\n\n _ ->\n query\n |> addSingleValueToQuery\n key\n value\n\n\naddSingleValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddSingleValueToQuery key value query =\n setQueryStr key value query\n\n\naddListValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddListValueToQuery key value query =\n let\n currentValues =\n getQueryAsStringList key query\n\n nextValues =\n (currentValues ++ [ value ]) |> List.Extra.unique\n in\n setQueryListStr\n key\n nextValues\n query\n\n\nfilter_addPartsToReportQuery : List PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartsToReportQuery parts query =\n { query\n | wheres = parts ++ query.wheres |> filter_uniqueParts\n }\n\n\nfilter_uniqueParts : List PartCondition -> List PartCondition\nfilter_uniqueParts parts =\n List.Extra.uniqueBy codeForPartConditionUnique parts\n\n\n{-| Replace the current parts with the given list\n-}\nfilter_setPartsInLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_setPartsInLocation parts location =\n { location | query = filter_setPartsInQuery parts location.query }\n\n\nfilter_setPartsInQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_setPartsInQuery parts query =\n query\n |> filter_removeAllPartsFromQuery\n |> filter_addPartsToLocationQuery parts\n\n\ngroupBys_setGroupBysInLocation : List PartDimension -> AppLocation -> AppLocation\ngroupBys_setGroupBysInLocation groupByParts location =\n location\n |> setQueryListStrInLocation\n queryKeys.exploreData.groupBy\n (List.filterMap groupBys_partToCode groupByParts)\n\n\nmaybeUnrwap_Part_Tag part =\n case part of\n Part_Tag k v ->\n Just ( k, v )\n\n _ ->\n Nothing\n\n\nmaybeUnrwap_Part_ViewSegment part =\n case part of\n Part_ViewSegment v s ->\n Just ( v, s )\n\n _ ->\n Nothing\n\n\nselectedMonthFromLocation : AppLocation -> Maybe String\nselectedMonthFromLocation location =\n location.query\n |> getStringFromQuery\n (withNameSpace dimensionKeysV2.month)\n\n\nselectedMonthFromLocationAsTime : AppLocation -> Maybe Posix\nselectedMonthFromLocationAsTime =\n selectedMonthFromLocation\n >> Maybe.andThen (Times.posixFromIso >> Result.toMaybe)\n\n\nselectedMonthFromLocationAsDate : AppLocation -> Maybe Date\nselectedMonthFromLocationAsDate =\n selectedMonthFromLocation\n >> Maybe.andThen (Date.fromIsoString >> Result.toMaybe)\n\n\nselectedMonthFromLocationWithDefault : Context -> Posix\nselectedMonthFromLocationWithDefault context =\n selectedMonthFromLocationAsTime context.location\n |> Maybe.withDefault (Times.beginningOfMonth Time.utc context.currentTime)\n\n\nselectedMonthFromLocationWithDefaultAsMonth : Context -> Times.MonthInYear\nselectedMonthFromLocationWithDefaultAsMonth context =\n selectedMonthFromLocationAsDate context.location\n |> Maybe.map Times.dateToMonthInYear\n |> Maybe.withDefault (selectedMonthDefaultFromContext context)\n\n\nselectedMonthDefaultFromContext : Context -> Times.MonthInYear\nselectedMonthDefaultFromContext context =\n Date.fromPosix Time.utc context.currentTime\n |> Times.dateToMonthInYear\n\n\n\n-- helpers\n\n\ngetStringFromQuery : String -> Query -> Maybe String\ngetStringFromQuery key query =\n getQueryAsStr key query\n\n\nvalidateNumericCondition : NumericCondition -> Maybe NumericCondition\nvalidateNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n Nothing\n\n NumericCondition_LessOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_MoreOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_Between minValue maxValue ->\n if String.isEmpty minValue then\n Nothing\n\n else if String.isEmpty maxValue then\n Nothing\n\n else\n Maybe.map2\n (\\minFloat maxFloat ->\n NumericCondition_Between\n (String.fromFloat (min minFloat maxFloat))\n (String.fromFloat (max minFloat maxFloat))\n )\n (String.toFloat minValue)\n (String.toFloat maxValue)\n\n\nlocationForArn : String -> AppLocation -> AppLocation\nlocationForArn arn location =\n let\n condition =\n PartCondition (Part_Arn arn)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n\n\nlocationForViewSegment : String -> String -> AppLocation -> AppLocation\nlocationForViewSegment viewID segmentID location =\n let\n condition =\n PartCondition (Part_ViewSegment viewID segmentID)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n"
}
}
[Trace - 11:59:52 am] Received request 'workspace/configuration - (0)'.
Params: {
"items": [
{
"section": "elmLS"
}
]
}
[Trace - 11:59:52 am] Sending response 'workspace/configuration - (0)'. Processing request took 0ms
Result: [
{
"trace": {
"server": "verbose"
},
"elmPath": "",
"elmFormatPath": "",
"elmTestPath": "",
"disableElmLSDiagnostics": false,
"skipInstallPackageConfirmation": false,
"elmAnalyseTrigger": "never"
}
]
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined"
}
[Error - 11:59:52 am] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined
[Trace - 11:59:52 am] Sending request 'textDocument/documentSymbol - (1)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
}
}
[Trace - 11:59:52 am] Sending request 'textDocument/codeAction - (2)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
},
"range": {
"start": {
"line": 1764,
"character": 43
},
"end": {
"line": 1764,
"character": 43
}
},
"context": {
"diagnostics": []
}
}
TypeError: Cannot read property 'synchronize' of undefined
/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1
var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.TreeSitter=t()}(0,function(){var e,t={};for(e in Module)Module.hasOwnProperty(e)&&(t[e]=Module[e]);var r,n,s=[],o=function(e,t){throw t},_=!1,a=!1;_="object"==typeof window,a="function"==typeof importScripts,r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,n=!_&&!r&&!a;var i,u,l,d,c="";r?(c=a?require("path").dirname(c)+"/":__dirname+"/",i=function(e,t){return l||(l=require("fs")),d||(d=require("path")),e=d.normalize(e),l.readFileSync(e,t?null:"utf8")},u=function(e){var t=i(e,!0);return t.buffer||(t=new Uint8Array(t)),L(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),s=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),process.on("uncaughtExce
RuntimeError: abort(TypeError: Cannot read property 'synchronize' of undefined). Build with -s ASSERTIONS=1 for more info.
at process.fe (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1:10450)
at process.emit (events.js:228:7)
at processPromiseRejections (internal/process/promises.js:201:33)
at processTicksAndRejections (internal/process/task_queues.js:95:32)
[Info - 11:59:52 am] Connection to server got closed. Server will restart.
[Error - 11:59:52 am] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
[Error - 11:59:52 am] Request textDocument/codeAction failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
[Trace - 11:59:52 am] Sending request 'initialize - (0)'.
Params: {
"processId": 453470,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.52.1"
},
"locale": "en-gb",
"rootPath": "/home/sebastian/Source/staxio/stax",
"rootUri": "file:///home/sebastian/Source/staxio/stax",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": true
}
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
}
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true,
"semanticTokens": {
"refreshSupport": true
},
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
}
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"insertReplaceSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
},
"activeParameterSupport": true
},
"contextSupport": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"honorsChangeAnnotations": false
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"prepareSupportDefaultBehavior": 1,
"honorsChangeAnnotations": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false
},
"linkedEditingRange": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "1.1.0"
}
}
},
"initializationOptions": {
"elmFormatPath": "",
"elmPath": "",
"elmTestPath": "",
"trace": {
"server": "verbose"
},
"extendedCapabilities": {
"moveFunctionRefactoringSupport": true,
"exposeUnexposeSupport": true
},
"disableElmLSDiagnostics": false
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/sebastian/Source/staxio/stax",
"name": "stax"
}
],
"workDoneToken": "15d84c8e-0304-433c-94d7-922c4211437a"
}
[Trace - 11:59:52 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm"
}
[Info - 11:59:52 am] Loading Elm tree-sitter syntax from ../../../.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/out/tree-sitter-elm.wasm
[Trace - 11:59:53 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:53 am] Found 2 elm.json files for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:53 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax"
}
[Info - 11:59:53 am] Found 1 unique elmWorkspaces for workspace /home/sebastian/Source/staxio/stax
[Trace - 11:59:53 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client"
}
[Info - 11:59:53 am] Starting language server for folder: file:///home/sebastian/Source/staxio/stax/client
[Trace - 11:59:53 am] Received notification '$/progress'.
Params: {
"token": "15d84c8e-0304-433c-94d7-922c4211437a",
"value": {
"kind": "begin",
"title": "Indexing Elm",
"percentage": 0
}
}
[Trace - 11:59:53 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Elm version 0.19.1 detected."
}
[Info - 11:59:53 am] Elm version 0.19.1 detected.
[Trace - 11:59:53 am] Received notification 'window/logMessage'.
Params: {
"type": 3,
"message": "Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json"
}
[Info - 11:59:53 am] Reading elm.json from /home/sebastian/Source/staxio/stax/client/elm.json
[Trace - 11:59:53 am] Received notification 'window/logMessage'.
Params: {
"type": 2,
"message": "{\"shortMessage\":\"Command failed with exit code 1: elm make\",\"command\":\"elm make\",\"exitCode\":1,\"stdout\":\"\",\"stderr\":\"\\n-- ERROR -----------------------------------------------------------------------\\n\\nI ran into something that bypassed the normal error reporting process! I\\nextracted whatever information I could from the internal error:\\n\\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\\nThese errors are usually pretty confusing, so start by asking around on one of\\nforums listed at https://elm-lang.org/community to see if anyone can get you\\nunstuck quickly.\\n\\n-- REQUEST ---------------------------------------------------------------------\\n\\nIf you are feeling up to it, please try to get your code down to the smallest\\nversion that still triggers this message. Ideally in a single Main.elm and\\nelm.json file.\\n\\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\\nabout if someone else saw something similar. More examples is better!\\n\\nThis kind of error is usually tied up in larger architectural choices that are\\nhard to change, so even when we have a couple good examples, it can take some\\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\\n\",\"failed\":true,\"timedOut\":false,\"isCanceled\":false,\"killed\":false}"
}
[Warn - 11:59:53 am] {"shortMessage":"Command failed with exit code 1: elm make","command":"elm make","exitCode":1,"stdout":"","stderr":"\n-- ERROR -----------------------------------------------------------------------\n\nI ran into something that bypassed the normal error reporting process! I\nextracted whatever information I could from the internal error:\n\n> /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n\nThese errors are usually pretty confusing, so start by asking around on one of\nforums listed at https://elm-lang.org/community to see if anyone can get you\nunstuck quickly.\n\n-- REQUEST ---------------------------------------------------------------------\n\nIf you are feeling up to it, please try to get your code down to the smallest\nversion that still triggers this message. Ideally in a single Main.elm and\nelm.json file.\n\nFrom there open a NEW issue at https://github.com/elm/compiler/issues with your\nreduced example pasted in directly. (Not a link to a repo or gist!) Do not worry\nabout if someone else saw something similar. More examples is better!\n\nThis kind of error is usually tied up in larger architectural choices that are\nhard to change, so even when we have a couple good examples, it can take some\ntime to resolve in a solid way.elm: /home/sebastian/Source/staxio/stax/client/elm-stuff/0.19.1: createDirectory: permission denied (Permission denied)\n","failed":true,"timedOut":false,"isCanceled":false,"killed":false}
[Trace - 11:59:53 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:\nError: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'"
}
[Error - 11:59:53 am] Error parsing files for /home/sebastian/Source/staxio/stax/client/elm.json:
Error: ENOENT: no such file or directory, open '/home/sebastian/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.0/elm.json'
[Trace - 11:59:53 am] Received notification '$/progress'.
Params: {
"token": "15d84c8e-0304-433c-94d7-922c4211437a",
"value": {
"kind": "end"
}
}
[Trace - 11:59:53 am] Received response 'initialize - (0)' in 415ms.
Result: {
"capabilities": {
"codeActionProvider": {
"resolveProvider": true
},
"codeLensProvider": {
"resolveProvider": true
},
"completionProvider": {
"triggerCharacters": [
"."
]
},
"definitionProvider": true,
"documentFormattingProvider": true,
"documentSymbolProvider": {
"label": "Elm"
},
"executeCommandProvider": {
"commands": [
"elmLS.elmMakeFixer-c8be20f1cc981af04a7eaaedf8de1c58",
"elm.installPackage"
]
},
"foldingRangeProvider": true,
"hoverProvider": true,
"referencesProvider": true,
"renameProvider": {
"prepareProvider": true
},
"selectionRangeProvider": true,
"textDocumentSync": 2,
"workspaceSymbolProvider": true,
"workspace": {
"fileOperations": {
"didCreate": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
},
"willRename": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
},
{
"scheme": "file",
"pattern": {
"glob": "**/",
"matches": "folder"
}
}
]
},
"willDelete": {
"filters": [
{
"scheme": "file",
"pattern": {
"glob": "**/*.elm",
"matches": "file"
}
}
]
}
}
},
"linkedEditingRangeProvider": true
}
}
[Trace - 11:59:53 am] Sending notification 'initialized'.
Params: {}
[Trace - 11:59:53 am] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm",
"languageId": "elm",
"version": 1,
"text": "module Elements.RawDataV3.Filter exposing\n ( allPartsOrdered\n , baseParts\n , codeForPartCondition\n , codeForPartDimension\n , codeForPartTemplate\n , dataRange_removeFromLocation\n , dateRange_setMonthInReportQuery\n , decodeNumericCondition\n , dimensionKeysV2\n , encodeNumericCondition\n , filter_addPartConditionToLocation\n , filter_addPartConditionToReportQuery\n , filter_addPartToLocationQuery\n , filter_addPartsToLocation\n , filter_addPartsToLocationQuery\n , filter_addPartsToReportQuery\n , filter_canAddPart\n , filter_fromBoolFilter\n , filter_getWhereComponents_fromGlobal\n , filter_hasPart\n , filter_jsonDecoder\n , filter_partFromFilterCondition\n , filter_partsFromLocation\n , filter_partsFromQuery\n , filter_removeAllPartsFromLocation\n , filter_removeAllPartsFromReportQuery\n , filter_removePartConditionFromLocation\n , filter_removePartConditionFromReportQuery\n , filter_setMonthInLocation\n , filter_setPartsInLocation\n , filter_toBoolFilter\n , filter_validateAndCorrectCondition\n , groupBys_add\n , groupBys_addToReportQuery\n , groupBys_canUsePart\n , groupBys_fromLocation\n , groupBys_hasAny\n , groupBys_hasPart\n , groupBys_jsonDecoder\n , groupBys_jsonEncode\n , groupBys_remove\n , groupBys_removeAllPartsFromLocation\n , groupBys_removeAllPartsFromReportQuery\n , groupBys_removeFromReportQuery\n , groupBys_setGroupBysInLocation\n , haveSamePartDimension\n , isSamePartCondition\n , isSamePartDimension\n , locationForArn\n , locationForViewSegment\n , partConditionConstructor\n , partConditionToDimension\n , partCondition_haveSameDimension\n , query_decoder\n , query_encodeQuery\n , query_getReportQueryFromLocation\n , query_isEmpty\n , query_setInLocation\n , selectedMonthDefaultFromContext\n , selectedMonthFromLocationWithDefault\n , templateParts\n , withNameSpace\n )\n\nimport Api.Enum.BillingData_PaymentOptionCode as PaymentOptionCode\nimport Date exposing (Date)\nimport Dict exposing (Dict)\nimport Elements.RawDataV3.Types exposing (..)\nimport Json.Decode as Decode\nimport Json.Encode as Encode\nimport Json.Encode.Extra as EncodeExtra\nimport List.Extra\nimport Result.Extra\nimport Set exposing (Set)\nimport Shared.AppLocation as AppLocation exposing (..)\nimport Shared.BoolFilterV2 as BoolFilter\nimport Shared.Context exposing (Context)\nimport Shared.Format as Format\nimport Shared.GlobalFilters as GlobalFilters\nimport Shared.Routes as Routes\nimport Shared.Times as Times\nimport Time exposing (Posix)\n\n\ntemplateParts =\n { arn = Part_Arn \"\"\n , awsAccountID = Part_AwsAccountID \"\"\n , awsProductCode = Part_AwsProductCode \"\"\n , awsRegionCode = Part_AwsRegionCode \"\"\n , financialCost = Part_FinancialCost NumericCondition_None\n , kind = Part_Kind \"\"\n , paymentOptionCode = Part_PaymentOptionCode PaymentOptionCode.Standard\n , reservationArn = Part_ReservationArn \"\"\n , resourceType = Part_ResourceType \"\"\n , savingPlanArn = Part_SavingsPlanArn \"\"\n , subUsageCode = Part_SubUsageCode \"\"\n , tag = Part_Tag \"\" \"\"\n , usageCode = Part_UsageCode \"\"\n , usageCost = Part_UsageCost NumericCondition_None\n , usageQuantity = Part_UsageQuantity NumericCondition_None\n , viewSegment = Part_ViewSegment \"\" \"\"\n }\n\n\ntemplatePartForPart : Part -> PartTemplate\ntemplatePartForPart part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag _ _ ->\n templateParts.tag\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment _ _ _ ->\n templateParts.viewSegment\n in\n PartTemplate part_\n\n\n{-| Is fine to go from specific to general\n-}\npartConditionToDimension : PartCondition -> PartDimension\npartConditionToDimension (PartCondition part) =\n PartDimension part\n\n\npartToPartDimension : Part -> PartDimension\npartToPartDimension part =\n let\n part_ =\n case part of\n Part_Arn _ ->\n templateParts.arn\n\n Part_AwsAccountID _ ->\n templateParts.awsAccountID\n\n Part_AwsProductCode _ ->\n templateParts.awsProductCode\n\n Part_AwsRegionCode _ ->\n templateParts.awsRegionCode\n\n Part_FinancialCost _ ->\n templateParts.financialCost\n\n Part_UsageCost _ ->\n templateParts.usageCost\n\n Part_Kind _ ->\n templateParts.kind\n\n Part_PaymentOptionCode _ ->\n templateParts.paymentOptionCode\n\n Part_ReservationArn _ ->\n templateParts.reservationArn\n\n Part_ResourceType _ ->\n templateParts.resourceType\n\n Part_SavingsPlanArn _ ->\n templateParts.savingPlanArn\n\n Part_SubUsageCode _ ->\n templateParts.subUsageCode\n\n Part_Tag key _ ->\n Part_Tag key \"\"\n\n Part_UsageCode _ ->\n templateParts.usageCode\n\n Part_UsageQuantity _ ->\n templateParts.usageQuantity\n\n Part_ViewSegment global viewID _ ->\n Part_ViewSegment global viewID \"\"\n in\n PartDimension part_\n\n\nallPartsOrdered : List PartTemplate\nallPartsOrdered =\n let\n {-\n This function is useless but will cause the\n compiler to fail if types arent added here. It is\n up to the developer to ensure the are also in the\n return list. This is a work around for union types\n not being iterable\n -}\n ignored thing =\n case thing of\n Part_Arn _ ->\n []\n\n Part_AwsAccountID _ ->\n []\n\n Part_AwsProductCode _ ->\n []\n\n Part_AwsRegionCode _ ->\n []\n\n Part_FinancialCost _ ->\n []\n\n Part_UsageCost _ ->\n []\n\n Part_Kind _ ->\n []\n\n Part_PaymentOptionCode _ ->\n []\n\n Part_ReservationArn _ ->\n []\n\n Part_ResourceType _ ->\n []\n\n Part_SavingsPlanArn _ ->\n []\n\n Part_SubUsageCode _ ->\n []\n\n Part_Tag _ _ ->\n []\n\n Part_UsageCode _ ->\n []\n\n Part_UsageQuantity _ ->\n []\n\n Part_ViewSegment _ _ _ ->\n []\n in\n -- All parts ordered for iteration in UI\n [ templateParts.viewSegment\n , templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n , templateParts.tag\n ]\n ++ ignored (Part_Arn \"\")\n |> List.map PartTemplate\n\n\n{-| Same as all, but without view and tags which are iterated differently\n-}\nbaseParts : List PartTemplate\nbaseParts =\n [ templateParts.arn\n , templateParts.reservationArn\n , templateParts.savingPlanArn\n , templateParts.awsAccountID\n , templateParts.awsProductCode\n , templateParts.awsRegionCode\n , templateParts.financialCost\n , templateParts.usageCost\n , templateParts.kind\n , templateParts.usageCode\n , templateParts.subUsageCode\n , templateParts.resourceType\n , templateParts.paymentOptionCode\n , templateParts.usageQuantity\n ]\n |> List.map PartTemplate\n\n\n{-| Some conditions can be constructed by providing a single String\n-}\npartConditionConstructor : PartDimension -> Maybe (String -> PartCondition)\npartConditionConstructor (PartDimension part) =\n let\n maybeConstructor =\n case part of\n Part_Arn _ ->\n Just Part_Arn\n\n Part_AwsAccountID _ ->\n Just Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n Just Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n Just Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n Nothing\n\n Part_UsageCost _ ->\n Nothing\n\n Part_Kind _ ->\n Just Part_Kind\n\n Part_PaymentOptionCode _ ->\n (\\s ->\n Part_PaymentOptionCode\n (s\n |> PaymentOptionCode.fromString\n |> Maybe.withDefault PaymentOptionCode.Standard\n )\n )\n |> Just\n\n Part_ReservationArn _ ->\n Just Part_ReservationArn\n\n Part_ResourceType _ ->\n Just Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n Just Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n Just Part_SubUsageCode\n\n Part_Tag key _ ->\n Just (Part_Tag key)\n\n Part_UsageCode _ ->\n Just Part_UsageCode\n\n Part_UsageQuantity _ ->\n Nothing\n\n Part_ViewSegment global view _ ->\n Just (Part_ViewSegment global view)\n in\n case maybeConstructor of\n Nothing ->\n Nothing\n\n Just constructor ->\n Just (constructor >> PartCondition)\n\n\nfilter_hasPart : PartCondition -> List PartCondition -> Bool\nfilter_hasPart part parts =\n case List.Extra.find (isSamePartCondition part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\nfilter_canAddPart : PartCondition -> List PartCondition -> Bool\nfilter_canAddPart part parts =\n if filter_hasPart part parts then\n filter_canAddMultipleOf part\n\n else\n True\n\n\nfilter_validateAndCorrectCondition : PartCondition -> Maybe PartCondition\nfilter_validateAndCorrectCondition (PartCondition part) =\n let\n validateValue value =\n if String.isEmpty value then\n Nothing\n\n else\n Just part\n\n validatedPart =\n case part of\n Part_Arn value ->\n validateValue value\n\n Part_AwsAccountID value ->\n validateValue value\n\n Part_AwsProductCode value ->\n validateValue value\n\n Part_AwsRegionCode value ->\n validateValue value\n\n Part_FinancialCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_FinancialCost corrected)\n\n Part_UsageCost numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageCost corrected)\n\n Part_Kind value ->\n validateValue value\n\n Part_PaymentOptionCode _ ->\n Just part\n\n Part_ReservationArn value ->\n validateValue value\n\n Part_ResourceType value ->\n validateValue value\n\n Part_SavingsPlanArn value ->\n validateValue value\n\n Part_SubUsageCode value ->\n validateValue value\n\n Part_Tag _ value ->\n validateValue value\n\n Part_UsageCode value ->\n validateValue value\n\n Part_UsageQuantity numericCondition ->\n case validateNumericCondition numericCondition of\n Nothing ->\n Nothing\n\n Just corrected ->\n Just (Part_UsageQuantity corrected)\n\n Part_ViewSegment _ _ segmentID ->\n validateValue segmentID\n in\n validatedPart |> Maybe.map PartCondition\n\n\nfilter_canAddMultipleOf : PartCondition -> Bool\nfilter_canAddMultipleOf (PartCondition part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\nfilter_addPart : PartCondition -> List PartCondition -> List PartCondition\nfilter_addPart part parts =\n if filter_canAddPart part parts then\n parts ++ [ part ]\n\n else\n parts\n\n\nremovePartDimension : PartDimension -> List PartDimension -> List PartDimension\nremovePartDimension part parts =\n parts\n |> List.Extra.filterNot (isSamePartDimension part)\n\n\nremovePartCondition : PartCondition -> List PartCondition -> List PartCondition\nremovePartCondition part parts =\n parts\n |> List.Extra.filterNot (isSamePartCondition part)\n\n\n{-| These are the same template part if they use the same constructor\n-}\nhaveSamePartTemplate : Part -> Part -> Bool\nhaveSamePartTemplate a b =\n templatePartForPart a == templatePartForPart b\n\n\nisSamePartDimension : PartDimension -> PartDimension -> Bool\nisSamePartDimension (PartDimension a) (PartDimension b) =\n haveSamePartDimension a b\n\n\npartCondition_haveSameDimension : PartCondition -> PartCondition -> Bool\npartCondition_haveSameDimension (PartCondition a) (PartCondition b) =\n haveSamePartDimension a b\n\n\n{-| View and Tag are the same dimension if they have the same view or tag key\n-}\nhaveSamePartDimension : Part -> Part -> Bool\nhaveSamePartDimension a b =\n partToPartDimension a == partToPartDimension b\n\n\nisSamePartCondition : PartCondition -> PartCondition -> Bool\nisSamePartCondition a b =\n a == b\n\n\nfilter_partsFromLocation : AppLocation -> List PartCondition\nfilter_partsFromLocation location =\n filter_partsFromQuery location.query\n\n\nfilter_partsFromQuery : Query -> List PartCondition\nfilter_partsFromQuery query =\n allPartsOrdered\n |> List.concatMap (filter_partFromQuery query)\n |> filter_uniqueParts\n\n\n{-| Given a template part e.g. Part\\_Arn \"\"\nThis may return multiple parts [Part_Arn \"123\", Part_Arn \"456\"]\n-}\nfilter_partFromQuery : Query -> PartTemplate -> List PartCondition\nfilter_partFromQuery query (PartTemplate templatePart) =\n let\n parsePair pair =\n case String.split valueKeySeparator pair of\n [ a, b ] ->\n Just ( a, b )\n\n _ ->\n Nothing\n\n partConditions =\n case templatePart of\n Part_Arn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.arn)\n |> List.map Part_Arn\n\n Part_AwsAccountID _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_account_id)\n |> List.map Part_AwsAccountID\n\n Part_AwsProductCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_product_code)\n |> List.map Part_AwsProductCode\n\n Part_AwsRegionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.aws_region_code)\n |> List.map Part_AwsRegionCode\n\n Part_FinancialCost _ ->\n filter_getNumericInputFromQuery\n Part_FinancialCost\n (withNameSpace dimensionKeysV2.financial_cost)\n query\n\n Part_UsageCost _ ->\n filter_getNumericInputFromQuery\n Part_UsageCost\n (withNameSpace dimensionKeysV2.usage_cost)\n query\n\n Part_Kind _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.kind)\n |> List.map Part_Kind\n\n Part_PaymentOptionCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.payment_option_code)\n |> List.filterMap PaymentOptionCode.fromString\n |> List.map Part_PaymentOptionCode\n\n Part_ReservationArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.reservation_arn)\n |> List.map Part_ReservationArn\n\n Part_ResourceType _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.resource_type)\n |> List.map Part_ResourceType\n\n Part_SavingsPlanArn _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n |> List.map Part_SavingsPlanArn\n\n Part_SubUsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.sub_usage_code)\n |> List.map Part_SubUsageCode\n\n Part_Tag _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.tags)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_Tag a b)\n\n Part_UsageCode _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.usage_code)\n |> List.map Part_UsageCode\n\n Part_UsageQuantity _ ->\n filter_getNumericInputFromQuery\n Part_UsageQuantity\n (withNameSpace dimensionKeysV2.usage_quantity)\n query\n\n Part_ViewSegment _ _ _ ->\n query\n |> getQueryAsStringList\n (withNameSpace dimensionKeysV2.segment_ids)\n |> List.filterMap parsePair\n |> List.map (\\( a, b ) -> Part_ViewSegment a b)\n in\n partConditions |> List.map PartCondition\n\n\nfilter_partFromFilterCondition : Dict String String -> BoolFilter.Condition -> Result String PartCondition\nfilter_partFromFilterCondition viewIDlookupMap filterCondition =\n let\n keys =\n dimensionKeysV2\n\n ( key, val ) =\n case filterCondition of\n BoolFilter.Eq pair ->\n pair\n\n BoolFilter.NotEq pair ->\n pair\n\n BoolFilter.LessOrEqualThan pair ->\n pair\n\n BoolFilter.LessThan pair ->\n pair\n\n BoolFilter.ListIncludes pair ->\n pair\n\n BoolFilter.Matches pair ->\n pair\n\n BoolFilter.MoreOrEqualThan pair ->\n pair\n\n BoolFilter.MoreThan pair ->\n pair\n\n numericCondition =\n case filterCondition of\n BoolFilter.Eq _ ->\n NumericCondition_None\n\n BoolFilter.NotEq _ ->\n NumericCondition_None\n\n BoolFilter.LessOrEqualThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.LessThan _ ->\n NumericCondition_LessOrEqualThan val\n\n BoolFilter.ListIncludes _ ->\n NumericCondition_None\n\n BoolFilter.Matches _ ->\n NumericCondition_None\n\n BoolFilter.MoreOrEqualThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n BoolFilter.MoreThan _ ->\n NumericCondition_MoreOrEqualThan val\n\n part : Result String Part\n part =\n if key == keys.arn then\n Ok (Part_Arn val)\n\n else if key == keys.aws_account_id then\n Ok (Part_AwsAccountID val)\n\n else if key == keys.aws_product_code then\n Ok (Part_AwsProductCode val)\n\n else if key == keys.aws_region_code then\n Ok (Part_AwsRegionCode val)\n\n else if key == keys.financial_cost then\n Ok (Part_FinancialCost numericCondition)\n\n else if key == keys.usage_cost then\n Ok (Part_UsageCost numericCondition)\n\n else if key == keys.kind then\n Ok (Part_Kind val)\n\n else if key == keys.payment_option_code then\n PaymentOptionCode.fromString val\n |> Result.fromMaybe val\n |> Result.map Part_PaymentOptionCode\n\n else if key == keys.reservation_arn then\n Ok (Part_ReservationArn val)\n\n else if key == keys.resource_type then\n Ok (Part_ResourceType val)\n\n else if key == keys.savings_plan_arn then\n Ok (Part_SavingsPlanArn val)\n\n else if key == keys.sub_usage_code then\n Ok (Part_SubUsageCode val)\n\n else if String.startsWith \"tags\" key then\n case String.split \".\" key of\n [ a, b ] ->\n Ok (Part_Tag b val)\n\n _ ->\n Err key\n\n else if key == keys.usage_code then\n Ok (Part_UsageCode val)\n\n else if key == keys.usage_quantity then\n Ok (Part_UsageQuantity numericCondition)\n\n else if key == keys.segment_ids then\n case Dict.get val viewIDlookupMap of\n Nothing ->\n Err val\n\n Just viewID ->\n Ok (Part_ViewSegment viewID val)\n\n else\n Err key\n in\n part |> Result.map PartCondition\n\n\nfilter_getNumericInputFromQuery :\n (NumericCondition -> Part)\n -> String\n -> AppLocation.Query\n -> List Part\nfilter_getNumericInputFromQuery constructor queryKey query =\n case filter_getNumericConditionFromQuery queryKey query of\n Nothing ->\n []\n\n Just condition ->\n [ constructor condition ]\n\n\nfilter_getNumericConditionFromQuery :\n String\n -> AppLocation.Query\n -> Maybe NumericCondition\nfilter_getNumericConditionFromQuery queryKey query =\n getStringFromQuery queryKey query\n |> Maybe.andThen decodeNumericCondition\n\n\ngroupBys_fromLocation : AppLocation -> List PartDimension\ngroupBys_fromLocation location =\n let\n groupBys =\n getQueryAsStringList queryKeys.exploreData.groupBy location.query\n in\n List.filterMap groupBys_codeToPart groupBys\n\n\ngroupBys_canUsePart : PartDimension -> Bool\ngroupBys_canUsePart (PartDimension part) =\n case part of\n Part_Arn _ ->\n True\n\n Part_AwsAccountID _ ->\n True\n\n Part_AwsProductCode _ ->\n True\n\n Part_AwsRegionCode _ ->\n True\n\n Part_FinancialCost _ ->\n False\n\n Part_UsageCost _ ->\n False\n\n Part_Kind _ ->\n True\n\n Part_PaymentOptionCode _ ->\n True\n\n Part_ReservationArn _ ->\n True\n\n Part_ResourceType _ ->\n True\n\n Part_SavingsPlanArn _ ->\n True\n\n Part_SubUsageCode _ ->\n True\n\n Part_Tag _ _ ->\n True\n\n Part_UsageCode _ ->\n True\n\n Part_UsageQuantity _ ->\n False\n\n Part_ViewSegment _ _ _ ->\n True\n\n\ngroupBys_hasAny location =\n groupBys_fromLocation location\n |> List.isEmpty\n |> not\n\n\ngroupBys_add : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_add part parts =\n if groupBys_hasPart part parts then\n parts\n\n else\n parts ++ [ part ]\n\n\ngroupBys_addToReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_addToReportQuery part query =\n { query\n | groupBys = groupBys_add part query.groupBys\n }\n\n\ngroupBys_hasPart : PartDimension -> List PartDimension -> Bool\ngroupBys_hasPart part parts =\n case List.Extra.find (isSamePartDimension part) parts of\n Nothing ->\n False\n\n Just _ ->\n True\n\n\ngroupBys_remove : PartDimension -> List PartDimension -> List PartDimension\ngroupBys_remove =\n removePartDimension\n\n\ngroupBys_removeFromReportQuery : PartDimension -> ReportQuery -> ReportQuery\ngroupBys_removeFromReportQuery part query =\n { query\n | groupBys = groupBys_remove part query.groupBys\n }\n\n\ngroupBys_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\ngroupBys_removeAllPartsFromReportQuery query =\n { query | groupBys = [] }\n\n\ngroupBys_removeAllPartsFromLocation : AppLocation -> AppLocation\ngroupBys_removeAllPartsFromLocation location =\n { location | query = groupBys_removeAllPartsFromQuery location.query }\n\n\ngroupBys_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\ngroupBys_removeAllPartsFromQuery query =\n AppLocation.removeQuery\n queryKeys.exploreData.groupBy\n query\n\n\n{-| Parts that cannot be grouped by will return Nothing\n-}\ngroupBys_partToCode : PartDimension -> Maybe String\ngroupBys_partToCode partDimension =\n if groupBys_canUsePart partDimension then\n Just (codeForPartDimension partDimension)\n\n else\n Nothing\n\n\ngroupBys_codeToPart : String -> Maybe PartDimension\ngroupBys_codeToPart code =\n let\n dims =\n dimensionKeysV2\n\n partCondition =\n if code == dims.arn then\n Just templateParts.arn\n\n else if code == dims.aws_account_id then\n Just templateParts.awsAccountID\n\n else if code == dims.aws_product_code then\n Just templateParts.awsProductCode\n\n else if code == dims.aws_region_code then\n Just templateParts.awsRegionCode\n\n else if code == dims.financial_cost then\n Just templateParts.financialCost\n\n else if code == dims.kind then\n Just templateParts.kind\n\n else if code == dims.payment_option_code then\n Just templateParts.paymentOptionCode\n\n else if code == dims.reservation_arn then\n Just templateParts.reservationArn\n\n else if code == dims.resource_type then\n Just templateParts.resourceType\n\n else if code == dims.savings_plan_arn then\n Just templateParts.savingPlanArn\n\n else if code == dims.sub_usage_code then\n Just templateParts.subUsageCode\n\n else if code == dims.usage_code then\n Just templateParts.usageCode\n\n else if code == dims.usage_cost then\n Just templateParts.usageCost\n\n else if code == dims.usage_quantity then\n Just templateParts.usageQuantity\n\n else if String.startsWith groupByOnlyKeys.tag code then\n Just (Part_Tag (String.replace groupByOnlyKeys.tag \"\" code) \"\")\n\n else if String.startsWith groupByOnlyKeys.viewId code then\n Just (Part_ViewSegment (String.replace groupByOnlyKeys.viewId \"\" code) \"\")\n\n else\n -- Ignored\n -- month\n Nothing\n in\n Maybe.map PartDimension partCondition\n\n\ngroupBys_jsonEncode : List PartDimension -> Encode.Value\ngroupBys_jsonEncode parts =\n parts\n |> List.filterMap groupBys_partToCode\n |> Encode.list Encode.string\n\n\ngroupBys_jsonDecoder : Decode.Decoder (List PartDimension)\ngroupBys_jsonDecoder =\n Decode.list groupBys_jsonDimensionDecoder\n\n\ngroupBys_jsonDimensionDecoder : Decode.Decoder PartDimension\ngroupBys_jsonDimensionDecoder =\n Decode.string\n |> Decode.andThen\n (\\code ->\n case groupBys_codeToPart code of\n Nothing ->\n Decode.fail \"code\"\n\n Just part ->\n Decode.succeed part\n )\n\n\n{-| Dimension keys\nUsed for the URL query string and the API Query\nThese must not be changed as they are expected like this by the API\n-}\ndimensionKeysV2 =\n { arn = \"arn\"\n , aws_account_id = \"linked_account_id\"\n , aws_product_code = \"product_code\"\n , aws_region_code = \"region_code\"\n , financial_cost = \"unallocated_unblended_cost\"\n , kind = \"kind\"\n , month = \"month\"\n , payment_option_code = \"payment_option_code\"\n , reservation_arn = \"reservation_arn\"\n , resource_type = \"resource_type\"\n , savings_plan_arn = \"savings_plan_arn\"\n , segment_ids = \"segment_ids\"\n , sub_usage_code = \"sub_usage_code\"\n , tags = \"tags\"\n , usage_code = \"usage_code\"\n , usage_cost = \"unallocated_amortised_cost\"\n , usage_quantity = \"total_usage_quantity\"\n }\n\n\nnamespace =\n \"rd.\"\n\n\nwithNameSpace key =\n namespace ++ key\n\n\nvalueKeySeparator =\n \"|\"\n\n\ngroupByOnlyKeys =\n { tag = \"tags.\"\n , viewId = \"viewId.\"\n }\n\n\ncodeForPartTemplate : PartTemplate -> String\ncodeForPartTemplate (PartTemplate part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n groupByOnlyKeys.tag\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n groupByOnlyKeys.viewId\n\n\ncodeForPartDimension : PartDimension -> String\ncodeForPartDimension (PartDimension part) =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag k _ ->\n groupByOnlyKeys.tag ++ k\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ viewId _ ->\n groupByOnlyKeys.viewId ++ viewId\n\n\ncodeForPartCondition : PartCondition -> String\ncodeForPartCondition (PartCondition part) =\n codeForPartDimension (PartDimension part)\n\n\n{-| A unique code for a part condition\nUsed for removing duplicates\n-}\ncodeForPartConditionUnique : PartCondition -> String\ncodeForPartConditionUnique (PartCondition part) =\n case part of\n Part_Arn arn ->\n dimensionKeysV2.arn ++ arn\n\n Part_AwsAccountID id ->\n dimensionKeysV2.aws_account_id ++ id\n\n Part_AwsProductCode code ->\n dimensionKeysV2.aws_product_code ++ code\n\n Part_AwsRegionCode code ->\n dimensionKeysV2.aws_region_code ++ code\n\n Part_FinancialCost condition ->\n dimensionKeysV2.financial_cost ++ encodeNumericCondition condition\n\n Part_UsageCost condition ->\n dimensionKeysV2.usage_cost ++ encodeNumericCondition condition\n\n Part_Kind kind ->\n dimensionKeysV2.kind ++ kind\n\n Part_PaymentOptionCode code ->\n dimensionKeysV2.payment_option_code ++ PaymentOptionCode.toString code\n\n Part_ReservationArn arn ->\n dimensionKeysV2.reservation_arn ++ arn\n\n Part_ResourceType type_ ->\n dimensionKeysV2.resource_type ++ type_\n\n Part_SavingsPlanArn arn ->\n dimensionKeysV2.savings_plan_arn ++ arn\n\n Part_SubUsageCode code ->\n dimensionKeysV2.sub_usage_code ++ code\n\n Part_Tag k v ->\n groupByOnlyKeys.tag ++ k ++ \"=\" ++ v\n\n Part_UsageCode code ->\n dimensionKeysV2.usage_code ++ code\n\n Part_UsageQuantity condition ->\n dimensionKeysV2.usage_quantity ++ encodeNumericCondition condition\n\n Part_ViewSegment _ viewId segmentID ->\n groupByOnlyKeys.viewId ++ viewId ++ segmentID\n\n\n{-| Used in the query string too\nMust be query string safe. Dont' use:\n\n : / ? # [ ] @ ! $ & ' ( ) * + , ; =\n\nOk to use:\n\n - . _ ~\n\nUsed like\n\n ?rd.usage_cost=between.123~344&...\n\n-}\nencodeNumericCondition : NumericCondition -> String\nencodeNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n \"none\"\n\n NumericCondition_MoreOrEqualThan value ->\n \"get_\" ++ value\n\n NumericCondition_LessOrEqualThan value ->\n \"let_\" ++ value\n\n NumericCondition_Between one two ->\n \"between_\" ++ one ++ \"~\" ++ two\n\n\ndecodeNumericCondition : String -> Maybe NumericCondition\ndecodeNumericCondition value =\n case String.split \"_\" value of\n [ operation, body ] ->\n case operation of\n \"get\" ->\n Just (NumericCondition_MoreOrEqualThan body)\n\n \"let\" ->\n Just (NumericCondition_LessOrEqualThan body)\n\n \"between\" ->\n case String.split \"~\" body of\n [ min, max ] ->\n Just (NumericCondition_Between min max)\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n _ ->\n Nothing\n\n\n{-|\n\n e.g. rd.segment_ids\n\n-}\nqueryKeyForPart : PartTemplate -> String\nqueryKeyForPart (PartTemplate part) =\n let\n key =\n case part of\n Part_Arn _ ->\n dimensionKeysV2.arn\n\n Part_AwsAccountID _ ->\n dimensionKeysV2.aws_account_id\n\n Part_AwsProductCode _ ->\n dimensionKeysV2.aws_product_code\n\n Part_AwsRegionCode _ ->\n dimensionKeysV2.aws_region_code\n\n Part_FinancialCost _ ->\n dimensionKeysV2.financial_cost\n\n Part_UsageCost _ ->\n dimensionKeysV2.usage_cost\n\n Part_Kind _ ->\n dimensionKeysV2.kind\n\n Part_PaymentOptionCode _ ->\n dimensionKeysV2.payment_option_code\n\n Part_ReservationArn _ ->\n dimensionKeysV2.reservation_arn\n\n Part_ResourceType _ ->\n dimensionKeysV2.resource_type\n\n Part_SavingsPlanArn _ ->\n dimensionKeysV2.savings_plan_arn\n\n Part_SubUsageCode _ ->\n dimensionKeysV2.sub_usage_code\n\n Part_Tag _ _ ->\n dimensionKeysV2.tags\n\n Part_UsageCode _ ->\n dimensionKeysV2.usage_code\n\n Part_UsageQuantity _ ->\n dimensionKeysV2.usage_quantity\n\n Part_ViewSegment _ _ _ ->\n dimensionKeysV2.segment_ids\n in\n withNameSpace key\n\n\n\n-- FILTER\n\n\nquery_getReportQueryFromLocation : Context -> List Segment -> ReportQuery\nquery_getReportQueryFromLocation context availableSegments =\n let\n selectedMonth =\n selectedMonthFromLocationWithDefaultAsMonth context\n\n whereFilterComponents : List PartCondition\n whereFilterComponents =\n filter_getWhereComponents\n context\n availableSegments\n\n groupBys : List PartDimension\n groupBys =\n groupBys_fromLocation\n context.location\n in\n { selectedMonth = selectedMonth\n , wheres = whereFilterComponents\n , groupBys = groupBys\n }\n\n\nquery_setInLocation : ReportQuery -> AppLocation -> AppLocation\nquery_setInLocation query location =\n location\n |> filter_setMonthInLocation query.selectedMonth\n |> filter_setPartsInLocation query.wheres\n |> groupBys_setGroupBysInLocation query.groupBys\n\n\nquery_isEmpty : ReportQuery -> Bool\nquery_isEmpty query =\n List.isEmpty query.wheres && List.isEmpty query.groupBys\n\n\nfilter_jsonEncode : BoolFilter.Root -> Encode.Value\nfilter_jsonEncode =\n BoolFilter.jsonEncode\n\n\nfilter_getWhereComponents :\n Context\n -> List Segment\n -> List PartCondition\nfilter_getWhereComponents context availableSegments =\n let\n globalFilterParts : List PartCondition\n globalFilterParts =\n filter_getWhereComponents_fromGlobal\n context\n availableSegments\n\n parts =\n context.location\n |> filter_partsFromLocation\n |> (++) globalFilterParts\n |> filter_uniqueParts\n in\n parts\n\n\nfilter_getWhereComponents_fromGlobal : Context -> List Segment -> List PartCondition\nfilter_getWhereComponents_fromGlobal context availableSegments =\n filter_getSelectedSegmentsForGlobalFilter context availableSegments\n |> List.map\n (\\{ viewDbId, dbID } ->\n Part_ViewSegment (unwrapDbID viewDbId) (unwrapDbID dbID) |> PartCondition\n )\n\n\nfilter_getSelectedSegmentsForGlobalFilter :\n Context\n -> List Segment\n -> List Segment\nfilter_getSelectedSegmentsForGlobalFilter context availableSegments =\n let\n globalFilter =\n GlobalFilters.fromLocation context.location\n\n isSelected : Segment -> Bool\n isSelected segment =\n List.member (unwrapID segment.id) globalFilter.segmentIDs\n in\n List.filter isSelected availableSegments\n\n\nfilter_jsonDecoder : Dict String String -> Decode.Decoder (List PartCondition)\nfilter_jsonDecoder viewIDlookupMap =\n BoolFilter.jsonDecoder\n |> Decode.andThen\n (\\filter ->\n case filter_fromBoolFilter viewIDlookupMap filter of\n Err err ->\n Decode.fail err\n\n Ok conditions ->\n Decode.succeed conditions\n )\n\n\nfilter_fromBoolFilter : Dict String String -> BoolFilter.Root -> Result String (List PartCondition)\nfilter_fromBoolFilter viewIDlookupMap filter =\n filter\n |> BoolFilter.conditions\n |> List.map (filter_partFromFilterCondition viewIDlookupMap)\n |> Result.Extra.combine\n\n\nfilter_toBoolFilter : List PartCondition -> BoolFilter.Root\nfilter_toBoolFilter parts =\n allPartsOrdered\n |> List.foldl (filter_toBoolFilter_addPart parts) BoolFilter.empty\n |> BoolFilter.collapse\n\n\nfilter_toBoolFilter_addPart : List PartCondition -> PartTemplate -> BoolFilter.Root -> BoolFilter.Root\nfilter_toBoolFilter_addPart allPartsInFilter (PartTemplate templatePart) filter =\n let\n haveSamePartTemplate_ (PartCondition partCondition) =\n haveSamePartTemplate templatePart partCondition\n in\n allPartsInFilter\n -- Filter parts for this template\n |> List.filter haveSamePartTemplate_\n |> filter_joinTemplateConditions\n -- And join using AND with the rest of the filter\n |> (\\joined -> BoolFilter.addAnd joined filter)\n\n\nfilter_joinTemplateConditions : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions conditions =\n let\n viewBranches =\n conditions\n |> List.filter isViewCondition\n |> filter_joinTemplateConditions_views\n\n tagBranches =\n conditions\n |> List.filter isTagCondition\n |> filter_joinTemplateConditions_tags\n\n restBranches : List BoolFilter.Branch\n restBranches =\n conditions\n |> List.filter isNeitherViewOrTagCondition\n |> List.map filter_toBoolFilter_partToCondition\n in\n (restBranches ++ [ viewBranches, tagBranches ])\n |> BoolFilter.joinBranchesUsingOr\n\n\nisViewCondition : PartCondition -> Bool\nisViewCondition (PartCondition part) =\n case part of\n Part_ViewSegment _ _ _ ->\n True\n\n _ ->\n False\n\n\nisTagCondition : PartCondition -> Bool\nisTagCondition (PartCondition part) =\n case part of\n Part_Tag _ _ ->\n True\n\n _ ->\n False\n\n\nisNeitherViewOrTagCondition : PartCondition -> Bool\nisNeitherViewOrTagCondition condition =\n not (isViewCondition condition)\n && not (isTagCondition condition)\n\n\n{-| View branches are special\nSame view needs to be joined with OR\nDifferent views need to be joined with AND\n-}\nfilter_joinTemplateConditions_views : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_views conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_ViewSegment _ id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_tags : List PartCondition -> BoolFilter.Branch\nfilter_joinTemplateConditions_tags conditionsForViews =\n filter_joinTemplateConditions_dimension\n { getDimensionID =\n \\(PartCondition part) ->\n case part of\n Part_Tag id _ ->\n Just id\n\n _ ->\n Nothing\n }\n conditionsForViews\n\n\nfilter_joinTemplateConditions_dimension :\n { getDimensionID : PartCondition -> Maybe String\n }\n -> List PartCondition\n -> BoolFilter.Branch\nfilter_joinTemplateConditions_dimension config conditionsForViews =\n let\n isSameDimensionID wantedID condition =\n config.getDimensionID condition == Just wantedID\n\n getConditionsFor wantedID =\n List.filter (isSameDimensionID wantedID) conditionsForViews\n\n joinGroup : List PartCondition -> BoolFilter.Branch\n joinGroup group =\n group\n |> List.map filter_toBoolFilter_partToCondition\n |> BoolFilter.joinBranchesUsingOr\n in\n conditionsForViews\n -- Collect the dimension ids\n |> List.filterMap config.getDimensionID\n -- Ensure the list is unique\n |> Set.fromList\n |> Set.toList\n -- For each collect the relevant conditions\n |> List.map getConditionsFor\n -- Join each of these groups using OR\n |> List.map joinGroup\n -- Join the groups using AND\n |> BoolFilter.joinBranchesUsingAnd\n\n\nfilter_toBoolFilter_partToCondition : PartCondition -> BoolFilter.Branch\nfilter_toBoolFilter_partToCondition (PartCondition part) =\n case part of\n Part_Arn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.arn\n arn\n |> BoolFilter.branchCondition\n\n Part_AwsAccountID id ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_account_id\n id\n |> BoolFilter.branchCondition\n\n Part_AwsProductCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_product_code\n code\n |> BoolFilter.branchCondition\n\n Part_AwsRegionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.aws_region_code\n code\n |> BoolFilter.branchCondition\n\n Part_FinancialCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.financial_cost\n condition\n\n Part_UsageCost condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_cost\n condition\n\n Part_Kind kind ->\n BoolFilter.equalStr\n dimensionKeysV2.kind\n kind\n |> BoolFilter.branchCondition\n\n Part_PaymentOptionCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.payment_option_code\n (PaymentOptionCode.toString code)\n |> BoolFilter.branchCondition\n\n Part_ReservationArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.reservation_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_ResourceType rt ->\n BoolFilter.equalStr\n dimensionKeysV2.resource_type\n rt\n |> BoolFilter.branchCondition\n\n Part_SavingsPlanArn arn ->\n BoolFilter.equalStr\n dimensionKeysV2.savings_plan_arn\n arn\n |> BoolFilter.branchCondition\n\n Part_SubUsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.sub_usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_Tag k v ->\n BoolFilter.matchesStr\n (dimensionKeysV2.tags ++ \".\" ++ k)\n v\n |> BoolFilter.branchCondition\n\n Part_UsageCode code ->\n BoolFilter.equalStr\n dimensionKeysV2.usage_code\n code\n |> BoolFilter.branchCondition\n\n Part_UsageQuantity condition ->\n boolFilterConditionsForNumeric\n dimensionKeysV2.usage_quantity\n condition\n\n Part_ViewSegment _ _ segmentID ->\n BoolFilter.listIncludes\n dimensionKeysV2.segment_ids\n segmentID\n |> BoolFilter.branchCondition\n\n\nboolFilterConditionsForNumeric : String -> NumericCondition -> BoolFilter.Branch\nboolFilterConditionsForNumeric key numericCondition =\n case numericCondition of\n NumericCondition_None ->\n BoolFilter.branchNoOp\n\n NumericCondition_MoreOrEqualThan value ->\n BoolFilter.moreOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_LessOrEqualThan value ->\n BoolFilter.lessOrEqualThanStr key value\n |> BoolFilter.branchCondition\n\n NumericCondition_Between min max ->\n BoolFilter.and\n (BoolFilter.moreOrEqualThanStr key min |> BoolFilter.branchCondition)\n (BoolFilter.lessOrEqualThanStr key max |> BoolFilter.branchCondition)\n\n\n\n-- FILTER AND GROUP BY\n\n\nquery_encodeQuery : ReportQuery -> Encode.Value\nquery_encodeQuery reportQuery =\n let\n month =\n Format.monthInYearToISO reportQuery.selectedMonth\n in\n Encode.object\n [ ( \"version\", Encode.int 1 )\n , ( \"query\"\n , Encode.object\n [ ( \"duration\", Encode.string (month ++ \"T00:00:00.000Z/P1M\") )\n , ( \"group_by\", groupBys_jsonEncode reportQuery.groupBys )\n , ( \"where\", filter_toBoolFilter reportQuery.wheres |> filter_jsonEncode )\n ]\n )\n ]\n\n\nquery_decoder : Dict String String -> Decode.Decoder ReportQuery\nquery_decoder viewIDlookupMap =\n Decode.map3 ReportQuery\n (Decode.field \"duration\" monthDecoder)\n (Decode.field \"where\" (filter_jsonDecoder viewIDlookupMap))\n (Decode.field \"group_by\" groupBys_jsonDecoder)\n\n\nmonthDecoder : Decode.Decoder Times.MonthInYear\nmonthDecoder =\n Decode.string\n |> Decode.andThen\n (\\month ->\n case String.split \"T\" month of\n [ a, b ] ->\n case Times.isoToDate a of\n Nothing ->\n Decode.fail a\n\n Just date ->\n Times.dateToMonthInYear date\n |> Decode.succeed\n\n _ ->\n Decode.fail month\n )\n\n\ndateRange_setMonthInReportQuery : Times.MonthInYear -> ReportQuery -> ReportQuery\ndateRange_setMonthInReportQuery monthInYear query =\n { query\n | selectedMonth = monthInYear\n }\n\n\ndataRange_removeFromLocation : AppLocation -> AppLocation\ndataRange_removeFromLocation location =\n { location | query = dataRange_removeFromQuery location.query }\n\n\ndataRange_removeFromQuery : AppLocation.Query -> AppLocation.Query\ndataRange_removeFromQuery query =\n AppLocation.removeQuery (withNameSpace dimensionKeysV2.month) query\n\n\nfilter_setMonthInLocation : Times.MonthInYear -> AppLocation -> AppLocation\nfilter_setMonthInLocation monthInYear location =\n let\n iso =\n monthInYear\n |> Format.monthInYearToISO\n\n query =\n setQueryStr\n (withNameSpace dimensionKeysV2.month)\n iso\n location.query\n in\n { location\n | query = query\n }\n\n\nfilter_removeAllPartsFromReportQuery : ReportQuery -> ReportQuery\nfilter_removeAllPartsFromReportQuery query =\n { query\n | wheres = []\n }\n\n\nfilter_removeAllPartsFromLocation : AppLocation -> AppLocation\nfilter_removeAllPartsFromLocation location =\n { location | query = filter_removeAllPartsFromQuery location.query }\n\n\nfilter_removeAllPartsFromQuery : AppLocation.Query -> AppLocation.Query\nfilter_removeAllPartsFromQuery query =\n List.foldl\n filter_removePartDimensionFromQuery\n query\n allPartsOrdered\n\n\nfilter_removePartDimensionFromQuery : PartTemplate -> AppLocation.Query -> AppLocation.Query\nfilter_removePartDimensionFromQuery part query =\n AppLocation.removeQuery\n (queryKeyForPart part)\n query\n\n\nfilter_removePartConditionFromReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_removePartConditionFromReportQuery part query =\n { query\n | wheres = filter_removePartCondition part query.wheres\n }\n\n\nfilter_removePartConditionFromLocation : PartCondition -> AppLocation -> AppLocation\nfilter_removePartConditionFromLocation part location =\n { location | query = filter_removePartConditionFromQuery part location.query }\n\n\nfilter_removePartConditionFromQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_removePartConditionFromQuery part query =\n let\n newParts : List PartCondition\n newParts =\n query\n |> filter_partsFromQuery\n |> filter_removePartCondition part\n in\n query\n |> filter_setPartsInQuery newParts\n\n\nfilter_removePartCondition part parts =\n List.filter (isSamePartCondition part >> not) parts\n\n\nfilter_addPartsToLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_addPartsToLocation parts location =\n { location\n | query = filter_addPartsToLocationQuery parts location.query\n }\n\n\nfilter_addPartConditionToLocation : PartCondition -> AppLocation -> AppLocation\nfilter_addPartConditionToLocation part location =\n { location\n | query = filter_addPartToLocationQuery part location.query\n }\n\n\nfilter_addPartConditionToReportQuery : PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartConditionToReportQuery part query =\n { query\n | wheres = part :: query.wheres\n }\n\n\nfilter_addPartsToLocationQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartsToLocationQuery parts query =\n List.foldl filter_addPartToLocationQuery query parts\n\n\nfilter_addPartToLocationQuery : PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_addPartToLocationQuery (PartCondition part) query =\n case part of\n Part_Arn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.arn)\n arn\n query\n\n Part_AwsAccountID id ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_account_id)\n id\n query\n\n Part_AwsProductCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_product_code)\n code\n query\n\n Part_AwsRegionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.aws_region_code)\n code\n query\n\n Part_FinancialCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.financial_cost)\n condition\n query\n\n Part_UsageCost condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_cost)\n condition\n query\n\n Part_Kind kind ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.kind)\n kind\n query\n\n Part_PaymentOptionCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.payment_option_code)\n (PaymentOptionCode.toString code)\n query\n\n Part_ReservationArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.reservation_arn)\n arn\n query\n\n Part_ResourceType rt ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.resource_type)\n rt\n query\n\n Part_SavingsPlanArn arn ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.savings_plan_arn)\n arn\n query\n\n Part_SubUsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.sub_usage_code)\n code\n query\n\n Part_Tag k v ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.tags)\n (k ++ valueKeySeparator ++ v)\n query\n\n Part_UsageCode code ->\n addListValueToQuery\n (withNameSpace dimensionKeysV2.usage_code)\n code\n query\n\n Part_UsageQuantity condition ->\n addNumericConditionToQuery\n (withNameSpace dimensionKeysV2.usage_quantity)\n condition\n query\n\n Part_ViewSegment v s ->\n -- rd.segments[]=974|104302&rd.segments[]=849|102740\n addListValueToQuery\n (withNameSpace dimensionKeysV2.segment_ids)\n (v ++ valueKeySeparator ++ s)\n query\n\n\naddNumericConditionToQuery : String -> NumericCondition -> AppLocation.Query -> AppLocation.Query\naddNumericConditionToQuery key numericCondition query =\n let\n value =\n encodeNumericCondition numericCondition\n in\n case numericCondition of\n NumericCondition_None ->\n removeQuery key query\n\n _ ->\n query\n |> addSingleValueToQuery\n key\n value\n\n\naddSingleValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddSingleValueToQuery key value query =\n setQueryStr key value query\n\n\naddListValueToQuery : String -> String -> AppLocation.Query -> AppLocation.Query\naddListValueToQuery key value query =\n let\n currentValues =\n getQueryAsStringList key query\n\n nextValues =\n (currentValues ++ [ value ]) |> List.Extra.unique\n in\n setQueryListStr\n key\n nextValues\n query\n\n\nfilter_addPartsToReportQuery : List PartCondition -> ReportQuery -> ReportQuery\nfilter_addPartsToReportQuery parts query =\n { query\n | wheres = parts ++ query.wheres |> filter_uniqueParts\n }\n\n\nfilter_uniqueParts : List PartCondition -> List PartCondition\nfilter_uniqueParts parts =\n List.Extra.uniqueBy codeForPartConditionUnique parts\n\n\n{-| Replace the current parts with the given list\n-}\nfilter_setPartsInLocation : List PartCondition -> AppLocation -> AppLocation\nfilter_setPartsInLocation parts location =\n { location | query = filter_setPartsInQuery parts location.query }\n\n\nfilter_setPartsInQuery : List PartCondition -> AppLocation.Query -> AppLocation.Query\nfilter_setPartsInQuery parts query =\n query\n |> filter_removeAllPartsFromQuery\n |> filter_addPartsToLocationQuery parts\n\n\ngroupBys_setGroupBysInLocation : List PartDimension -> AppLocation -> AppLocation\ngroupBys_setGroupBysInLocation groupByParts location =\n location\n |> setQueryListStrInLocation\n queryKeys.exploreData.groupBy\n (List.filterMap groupBys_partToCode groupByParts)\n\n\nmaybeUnrwap_Part_Tag part =\n case part of\n Part_Tag k v ->\n Just ( k, v )\n\n _ ->\n Nothing\n\n\nmaybeUnrwap_Part_ViewSegment part =\n case part of\n Part_ViewSegment v s ->\n Just ( v, s )\n\n _ ->\n Nothing\n\n\nselectedMonthFromLocation : AppLocation -> Maybe String\nselectedMonthFromLocation location =\n location.query\n |> getStringFromQuery\n (withNameSpace dimensionKeysV2.month)\n\n\nselectedMonthFromLocationAsTime : AppLocation -> Maybe Posix\nselectedMonthFromLocationAsTime =\n selectedMonthFromLocation\n >> Maybe.andThen (Times.posixFromIso >> Result.toMaybe)\n\n\nselectedMonthFromLocationAsDate : AppLocation -> Maybe Date\nselectedMonthFromLocationAsDate =\n selectedMonthFromLocation\n >> Maybe.andThen (Date.fromIsoString >> Result.toMaybe)\n\n\nselectedMonthFromLocationWithDefault : Context -> Posix\nselectedMonthFromLocationWithDefault context =\n selectedMonthFromLocationAsTime context.location\n |> Maybe.withDefault (Times.beginningOfMonth Time.utc context.currentTime)\n\n\nselectedMonthFromLocationWithDefaultAsMonth : Context -> Times.MonthInYear\nselectedMonthFromLocationWithDefaultAsMonth context =\n selectedMonthFromLocationAsDate context.location\n |> Maybe.map Times.dateToMonthInYear\n |> Maybe.withDefault (selectedMonthDefaultFromContext context)\n\n\nselectedMonthDefaultFromContext : Context -> Times.MonthInYear\nselectedMonthDefaultFromContext context =\n Date.fromPosix Time.utc context.currentTime\n |> Times.dateToMonthInYear\n\n\n\n-- helpers\n\n\ngetStringFromQuery : String -> Query -> Maybe String\ngetStringFromQuery key query =\n getQueryAsStr key query\n\n\nvalidateNumericCondition : NumericCondition -> Maybe NumericCondition\nvalidateNumericCondition numericCondition =\n case numericCondition of\n NumericCondition_None ->\n Nothing\n\n NumericCondition_LessOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_MoreOrEqualThan value ->\n if String.isEmpty value then\n Nothing\n\n else\n Just numericCondition\n\n NumericCondition_Between minValue maxValue ->\n if String.isEmpty minValue then\n Nothing\n\n else if String.isEmpty maxValue then\n Nothing\n\n else\n Maybe.map2\n (\\minFloat maxFloat ->\n NumericCondition_Between\n (String.fromFloat (min minFloat maxFloat))\n (String.fromFloat (max minFloat maxFloat))\n )\n (String.toFloat minValue)\n (String.toFloat maxValue)\n\n\nlocationForArn : String -> AppLocation -> AppLocation\nlocationForArn arn location =\n let\n condition =\n PartCondition (Part_Arn arn)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n\n\nlocationForViewSegment : String -> String -> AppLocation -> AppLocation\nlocationForViewSegment viewID segmentID location =\n let\n condition =\n PartCondition (Part_ViewSegment viewID segmentID)\n in\n location\n |> AppLocation.setRoute Routes.routeForExploreDataCreate\n |> filter_removeAllPartsFromLocation\n |> groupBys_removeAllPartsFromLocation\n |> filter_addPartConditionToLocation condition\n"
}
}
[Trace - 11:59:53 am] Received request 'workspace/configuration - (0)'.
Params: {
"items": [
{
"section": "elmLS"
}
]
}
[Trace - 11:59:53 am] Sending response 'workspace/configuration - (0)'. Processing request took 0ms
Result: [
{
"trace": {
"server": "verbose"
},
"elmPath": "",
"elmFormatPath": "",
"elmTestPath": "",
"disableElmLSDiagnostics": false,
"skipInstallPackageConfirmation": false,
"elmAnalyseTrigger": "never"
}
]
[Trace - 11:59:53 am] Received notification 'window/logMessage'.
Params: {
"type": 1,
"message": "Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined"
}
[Error - 11:59:53 am] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'getTree' of undefined
[Trace - 11:59:53 am] Sending request 'textDocument/documentSymbol - (1)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
}
}
[Trace - 11:59:53 am] Sending request 'textDocument/codeAction - (2)'.
Params: {
"textDocument": {
"uri": "file:///home/sebastian/Source/staxio/stax/client/src/Elm/Elements/RawDataV3/Filter.elm"
},
"range": {
"start": {
"line": 1764,
"character": 43
},
"end": {
"line": 1764,
"character": 43
}
},
"context": {
"diagnostics": []
}
}
TypeError: Cannot read property 'synchronize' of undefined
/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1
var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.TreeSitter=t()}(0,function(){var e,t={};for(e in Module)Module.hasOwnProperty(e)&&(t[e]=Module[e]);var r,n,s=[],o=function(e,t){throw t},_=!1,a=!1;_="object"==typeof window,a="function"==typeof importScripts,r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,n=!_&&!r&&!a;var i,u,l,d,c="";r?(c=a?require("path").dirname(c)+"/":__dirname+"/",i=function(e,t){return l||(l=require("fs")),d||(d=require("path")),e=d.normalize(e),l.readFileSync(e,t?null:"utf8")},u=function(e){var t=i(e,!0);return t.buffer||(t=new Uint8Array(t)),L(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),s=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),process.on("uncaughtExce
RuntimeError: abort(TypeError: Cannot read property 'synchronize' of undefined). Build with -s ASSERTIONS=1 for more info.
at process.fe (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/server/node_modules/web-tree-sitter/tree-sitter.js:1:10450)
at process.emit (events.js:228:7)
at processPromiseRejections (internal/process/promises.js:201:33)
at processTicksAndRejections (internal/process/task_queues.js:95:32)
[Error - 11:59:53 am] Connection to server got closed. Server will not be restarted.
[Error - 11:59:53 am] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
[Error - 11:59:53 am] Request textDocument/codeAction failed.
Error: Connection got disposed.
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:1044:27)
at Object.dispose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:73:35)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2424:42)
at LanguageClient.handleConnectionClosed (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/node/main.js:155:15)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-languageclient/lib/common/client.js:2411:18)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at closeHandler (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/connection.js:256:26)
at CallbackList.invoke (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
at Emitter.fire (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
at IPCMessageReader.fireClose (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/common/messageReader.js:40:27)
at ChildProcess.<anonymous> (/home/sebastian/.vscode/extensions/elmtooling.elm-ls-vscode-2.0.0/client/node_modules/vscode-jsonrpc/lib/node/main.js:33:45)
at ChildProcess.emit (events.js:228:7)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment