Граф коммитов

1556 Коммитов

Автор SHA1 Сообщение Дата
McCall Saltzman be19c3bf02
Make syntax localization util internal instead of private (#2663)
Working on some cleanup of localization code, and this utility is
duplicated in PA Client.
2024-09-30 11:43:53 -07:00
Adithya Selvaprithiviraj de16049af3
Change NamedType definition syntax (#2616)
Changes NamedType definitions to use `:=`
2024-09-27 17:47:50 -07:00
Luc Genetier 6a096a18c2
Add test for ZD CDP connector, using enums (#2658)
Validate that we can process option sets properly with CDP connectors
2024-09-27 07:21:44 -07:00
Carlos Figueira a5c0920366
Add new test to validate the DType always orders its fields (#2657)
Currently the tree that stores fields of a complex DType (records or arrays) stores those in an ordered way (ordinal comparison). There is some code that relies on that, so codifying it as a test to make it a "specification"
2024-09-26 14:13:51 +00:00
Luc Genetier dd32f3ce9c
JSON UO update (#2655) 2024-09-26 06:06:50 -07:00
Luc Genetier ee0ca2c67e
JSON function: serialize UO (#2639)
>> JSON(ParseJSON("{""a"": 1}"), JSONFormat.IgnoreUnsupportedTypes)
"{""a"":1}"
2024-09-25 18:09:23 +00:00
Carlos Figueira 93daa65514
Update the Trace function to return a Void type (#2650)
The Trace function doesn't return anything. For legacy reasons, it currently returns DType.Boolean (when it was created, we didn't have DType.Void). This PR updates it to return Void instead.
2024-09-25 09:29:51 -07:00
Luc Genetier c0e1ad7c42
Update SAP tabular test (#2652) 2024-09-25 15:51:56 +02:00
Anderson Silva 71818556f4
UO support for functions (#2649)
'Column' and 'CountRows' functions now support PAD UO values.
2024-09-23 15:48:48 -07:00
Adithya Selvaprithiviraj ff7aeb8773
Fix CompletionItemKind for Types to display correct Intellisense Icon (#2647)
Fixes CompletionItemKind for SuggestioonKind.Types to display correct
Intellisense Icon .


![image](https://github.com/user-attachments/assets/59f5806c-0046-42ca-85e8-46c3995eb255)
2024-09-23 12:51:13 -07:00
Adithya Selvaprithiviraj dcbdffb779
Enable UDF on REPL (#2559)
Adds ability to define User-defined functions in REPL.

Parsing UDFs requires a different parser from the Texl Expression parser
and this is addressed by using the DefinitionsParser as a fallback to
check when regular parsing fails. If definitions parsing is successful
and we find UDF, we add it to the Engine.


![image](https://github.com/user-attachments/assets/ee86d499-2ee6-4232-a7cd-3b5ca9e09d1e)

Fixes #2546
2024-09-23 09:25:43 -07:00
Carlos Figueira b87018f486
Prevent NullReferenceException found in telemetry (#2644)
We found a NRE in Power Apps telemetry that was happening in the Intellisense code on Power Fx. We don't know exactly the cause, but this change adds a defense-in-depth that will help preventing that.
2024-09-19 16:12:39 +00:00
Jas Valgotar f4232bf481
Adds async way to get value from NamedValue (#2642) 2024-09-18 18:46:18 +00:00
Carlos Figueira 166ceb2bfc
Add a warning to the CountRows function if a data source that caches its count is passed to it (#2640)
Some data sources, like Dataverse, will cache its count and not return the accurate result if a CountRows call is made to it (see note at https://learn.microsoft.com/power-platform/power-fx/reference/function-table-counts#description). This adds a warning to the node if this happens, to make it more explicit to the makers that this is the case.
2024-09-18 10:56:55 -07:00
zeye bbe833d870
Try fallback to "value" and "displayName" when building connector suggestions API response (#2635)
Address the schema and actual response misalignment issue especially for
Teams Connector.

**Context**:
In Teams connector, the suggestions API "GetMessageLocations" is
declared as below:

```ts
// dynamic schema
"x-ms-dynamic-values": {
    "operationId": "GetMessageLocations",
    "value-path": "id",
    "value-title": "displayName",
    "value-collection": "value",
    "parameters": {
        "messageType": "ParentMessage",
        "poster": {
            "parameter": "poster"
        }
    }
}

// response type
{
  "type": "object",
  "properties": {
      "locations": {
          "type": "array",
          "items": {
              "type": "object"
          },
          "description": "valid locations to post a message or reply, make verbose"
      }
  }
}
```

It's a historical issue (PAuto supports weak type and consumes this
format) that the actual response format ("value" and "displayName") is
misaligned with the expected format ("id" and "displayName"). Then it
caused the MCS suggestions API returning empty result.

**Proposed solution**:
Fallback to accept "value" and "displayName" when building the
suggestion response if the value accessed by "value-path" or
"value-title" is empty.

(This approached was proved to work in MCS but since some version update
there was a regression.)
2024-09-12 12:11:06 -07:00
zeye cf51f357de
Add new ConnectorSettings "IncludeWebhookFunctions" to allow using more Teams operation (#2633)
In the Teams connector, the operation "PostCardAndWaitForResponse"
contains extension "x-ms-notification-content" and is excluded from the
parse result of `GetFunctions`.

In MCS, we want to make this operation available to our internal users
to keep parity with Power Automate behavior.

This PR fixes the issue by
1. Creating a new setting "IncludeWebhookFunctions" to conditionally
include those "webhook" functions on demand.
2. Consume that new setting when filtering on the webhook functions, it
set to true, it won't filter away those functions.

As a result, 4 more operations inside Teams connector will be supported
by merging this change.
On MCS side, PFX `GetFunctions` will be invoked with an additional
setting parameter `IncludeWebhookFunctions = true`.
2024-09-10 08:19:00 -07:00
Anderson Silva 580cd8639d
Fixing PA locale nullable (#2632) 2024-09-09 10:57:34 -05:00
Adithya Selvaprithiviraj 3c7c076696
Add Namedtype suggestions for Type arguments in IntelliSense (#2625)
Adds Namedtype suggestions for Type arguments in functions that accept
type (ParseJSON, IsType, AsType).

Suggestion handler for TypeLiteralNode is currently in PAclient and will
be moved to this repo in a follow up PR.
2024-09-06 12:03:29 -07:00
Luc Genetier d6aa0dd8f6
CDP connectors - manage enums per OpenApi spec (#2628)
Add CDP compatibility flag
When enabled, we don't require format=enum
2024-09-06 17:23:19 +02:00
Luc Genetier 09e9820c1c
SAP connector fix, avoid crash when getting Items (#2629) 2024-09-05 17:41:46 +00:00
Anderson Silva 5da279a04c
Localizing intellisense signatures (#2627)
Issue https://github.com/microsoft/Power-Fx/issues/2576. There were
uncovered cases.
2024-09-04 14:05:29 -07:00
toshio-msft 0dc8d0f647
[[Power-Fx]] Localization hand-back [CTAS - RunID=20240903-211830-rzk42hw0a6] (#2626)
Translation handback check-in (PR Created by automation).
2024-09-03 17:39:21 -05:00
Akshar 85e769e971
Mark UDFs and NFs Async If there's a reference to cross screen control (#2620)
Marks UDF and Nf async if they refer to cross screen control and a new
binding config to do that is enabled. There's no definite way to say
where binder is binding nf or udf rules so config would be used to
communicate the marking of top parse node as async upon countering those
references. We don't need to mark those async if all they refer to is
component definition but there's no definite way to also check that.
ExternalTemplate.IsComponent returns true for component defs and
instances but we need to check only for the former. However that
shouldn't matter as code gen to lazy load component defs would be no op
since component defs are loaded upfront.
2024-08-30 20:29:59 -04:00
Anderson Silva 923f50139e
Localize runtime error messages (#2602) 2024-08-30 13:17:18 -07:00
rick-nguyen 077ede80ce
Avoid NRE in cycle edge case of imperative UDF binding (#2622)
In scenario of `F():Void = { F(); }`, when finalizing the binding, the
Binder will attempt to fetch the CallNode datasource,

Because UDF `TryGetDatasource` override needs the binding, in this
cycle/"recursive" edge case, there will be a null reference exception
without the check added in this PR.
2024-08-30 09:27:02 -07:00
rick-nguyen a82afed6d9
Fix UDFs not properly handled in TryGetDataSource recursion (#2615)
`FilterUDF():DataSource = Filter(DataSource, Value > 10);
FilterUDF2():DataSource = Filter(FilterUDF(), Value > 11);`

`TryGetDsInfo(Callnode)` would not get a datasource for `FilterUDF()`,
leading to Binder not marking this node async. This led to an issue of
delegation not being preserved on `FilterUDF2()`.
2024-08-29 11:10:49 -07:00
Anderson Silva 0089d2f8db
Dont anonymize known custom functions (#2614)
We are adding a way for the hosts to declare a list of non-core public
functions that should be kept plain when getting function names from an
expression.
2024-08-28 08:56:35 +00:00
rick-nguyen 1a6f9c481a
Support Pretty Parser formatting for User Definitions (#2605)
The pretty parser was broken with introduction of UDFs, though it was
never property implemented for Named Formulas either. This PR introduces
this support.
2024-08-27 20:27:56 -07:00
Carlos Figueira f18ac11f62
Split WeekNum tests to better reflect setup (#2613)
Some tests for WeekNum should be split properly between those with support for strongly-typed enums and those without.
2024-08-26 17:05:15 +00:00
Mark Overholt 27cc764b4e
Add ability to get trigger operations from an OpenApi definition (#2610)
Add new methods to OpenApiParser to fetch triggers from OpenApi
definitions
2024-08-23 14:58:21 -07:00
Jas Valgotar 071ffb1991
Adds a virtual to get primary key (#2609)
Primarily used for optimizing delegation when looking up record with
primary key on a relationship.
e.g. LookUp(t1, relationField.PrimaryKey = GUID).
2024-08-23 16:29:34 +00:00
Adithya Selvaprithiviraj 251e918f32
Introduce IsType, AsType and ParseJSON overloads with custom types (#2569)
Support IsType, AsType and ParseJSON functions with custom type as input
parameter

```
>> IsType(ParseJSON("42"), Number)
true

>> AsType(ParseJSON("42"), Number)
42

>> ParseJSON("42", Number)
42

>> AsType(ParseJSON("{ ""a"": 42 }"), Type({a: Number}))
{a : 42}

```

---------

Co-authored-by: Luc Genetier <69138830+LucGenetier@users.noreply.github.com>
2024-08-20 19:31:55 -07:00
Anderson Silva 930ca694c5
ColumnName to work with array untyped object (#2601)
Reply to https://github.com/microsoft/Power-Fx/pull/2588.
2024-08-19 17:03:32 -07:00
Anderson Silva 6559d64c51
Adjusting "Option to anonymize unknown public functions" (#2600)
Avoids breaking change at
https://github.com/microsoft/Power-Fx/pull/2597.
2024-08-19 22:31:23 +00:00
Anderson Silva fd52aff3df
Option to anonymize unknown public functions (#2597)
Previously at https://github.com/microsoft/Power-Fx/pull/2474 we
introduced an API to get a list of called functions from an expression.
We are now adding an option to anonymize a custom function to mask any
private information.
2024-08-19 20:22:27 +00:00
Anderson Silva cd3900e105
PAD Change test cases example (#2596) 2024-08-19 18:39:09 +00:00
rick-nguyen 6b0ca3fdca
Fix check to exclude UDFs from being marked as async if binding does not exist (#2595)
There was a mistake in following PR UDF delegation:
752efe46c4
2024-08-17 00:57:41 +00:00
rick-nguyen 752efe46c4
Add IsDelegatable and IsPageable flags to UDF class (#2459)
These flags will allow the binder to mark a UDF as delegatable/pageable
correctly based on the rule bound to it.
2024-08-16 12:02:26 -04:00
Luc Genetier 7c7e66bcea
Fix UOValue.GetProperty XML comment (#2593) 2024-08-14 13:33:50 +02:00
Anderson Silva 72f09636da
UO.TryGetProperty should determine the result value (#2592)
Issue https://github.com/microsoft/Power-Fx/issues/2591.
2024-08-13 23:42:04 +00:00
Anderson Silva 8c5342c598
GUID is a known function (#2590)
`GUID` is a known function.
`Guid` is an unknown function but PFx mistakenly finds it in the list of
unsupported known functions.


Before:

![image](https://github.com/user-attachments/assets/f29380d7-1f6d-48ab-9aa7-7af81a14c2e6)


After:

![image](https://github.com/user-attachments/assets/c218a9b4-16e8-4a33-a18e-87785e8115c7)
2024-08-13 11:27:28 -07:00
Luc Genetier aa26cfadd8
CDP updates (#2584)
Make GetDatasetsMetadataAsync a static method
Fix a NullReference exception when processing SQL relationships and no
relationship is found
2024-08-12 14:55:10 +00:00
Luc Genetier 97dae48ff7
Make CdpDataSource GetDatasetsMetadataAsync public and return metadata (#2583) 2024-08-08 20:06:20 +00:00
Anderson Silva fd50fe1a2d
Localize intellisense messages (#2581)
Issue https://github.com/microsoft/Power-Fx/issues/2576.
2024-08-08 11:04:18 -07:00
McCall Saltzman 59aa6c1a63
Fixes reuse of expandinfo from cache when expand is accessed via a different path (#2580)
Unable to easily test in this repo. Tests added in PA Client. 

Scenario is, e.g. for this expression, the expand info to the second
PrimaryContact access should have ManagingPartner as part of it's expand
path.

"ClearCollect(c3, Filter(Accounts,'Primary Contact'.Status <> 'Status
(Contacts)'.Active));" +
"ClearCollect(c4, Filter(Contacts, 'Managing Partner'.'Primary
Contact'.Status <> 'Status (Contacts)'.Inactive))"
2024-08-06 18:41:40 +00:00
Akshar 75a9c04000
Make Nl2Fx/Fx2nl Handler creation Async to allow for setting up custom NlHandler with Nl2Fx context reduction filters (#2578)
This pr makes nl handler creation async so during creation time, PA can
attach context reduction filters with Nl handler which would then later
be used to trim down the context. This pr also refactors nl2fx, fx2nl
handlers to avoid class fields
2024-08-06 17:21:55 +00:00
Luc Genetier ca23c68fd5
Add Date/Time/NoTZ management in FormulaValueSerializer (#2579) 2024-08-06 16:04:08 +02:00
Luc Genetier 1ceef60c2f
Add CDP GetTableAsync (#2575) 2024-08-05 18:13:03 +02:00
Luc Genetier dbffee13ff
Update nuget.config source (#2574) 2024-08-05 17:21:50 +02:00
Carlos Figueira daed51d0f2
Update order of checking for scoping variable during binder's visit of FirstName (#2570)
For an expression such as `With({a:1}, Set(a, 10))`, the first argument of the Set function should not refer to the scope variable `a` defined by the With function.
2024-08-02 09:58:57 -07:00