For the Record support in PA Client for merge attributes, we're
introducing a function that is only callable from generated expressions,
not user code. This adds a flag to tell if an identifier is from source
directly, or from something we generated.
This is an early prototype of support for a [Partial] attribute that
enables combining named formulas.
This is done via name-mangling in the parser, renaming each NF to
foo_Guid_0, foo_guid_1, ... and then creating a new hidden nf
Foo = Op(foo_guid0, foo_guid1, ...). This allows us to update the
formulas independently in authoring, and process them without real
changes to NF handling on the PA side.
![Animation
1](https://github.com/microsoft/Power-Fx/assets/69215460/12923e11-01b0-4e71-80f5-b053dfb50fe4)
There were some parts of the code that were mistakenly treating the GMT (i.e., London) time zone as UTC. Those are the same for part of the year, but not for all of it, which was causing some issues with parsing and adding date values. This change addresses it.
Trying to implement a scenario using IR rewriting to handle HTML escaping automatically:
- Literal strings are not escaped
- Variables are escaped (can potentially have unsafe data)
- Data from tables are escaped (can potentially have unsafe data)
- IR tree is traversed and whenever there are unsafe string nodes being concatenated, those nodes are escaped.
When swagger file type "binary" is used, we are now generating a warning
that we might return incorrect results as we default to a string
Updated Yaml comparer accordingly
This removes a pointless restriction on property access via
Gallery.Selected.
These properties were already accessible directly on children of the
gallery, and this restriction doesn't have any runtime justification for
existing. It also blocks deprecation of primary output properties (Icon
has a design primary output prop, others might as well)
With the completion of #2096 we started accepting void arguments in the pattern (first argument) and matches (even-numbered arguments) for the Switch function, so something like this would not have any compile-time errors: `Switch(If(1<0, 1, {}), 1, "ok", "not ok")`. This is an invalid expression - the first argument (a void value) cannot be compared with anything else. This fixes that, and adds some additional tests to prevent this from happening again.
Issue: During tight loops we sometimes need only error count and at this
time we can only call GetErrors() which returns IEnumerable and the
iterate though each error using Count() extension. It would improve
performance if we can have native Count property
Co-authored-by: Andrew Petrochuk (from Dev Box) <anpetroc@microsoft.com>
Several Power Fx functions have no real return value. To date, Canvas
apps have returned Boolean values that aren't seen and likely this
behavior is not well known. With the Repl, these values are being
printed as part of the stream and it can be confusing. to see `Set( x, 3
)` and then `true`. Similarly, it is seems odd in a strongly typed
language to return a value that really has no meaning (the `true` from
Set) which could be a coding error, the kind of thing that strong typing
should catch.
Changes to be made:
1. Void will accept all types, including Void. In Power Apps, behavior
properties would be of type Void, and they work with any formula,
dropping the computed value.
2. Void will not be accepted by any other types (except Void). Trying to
use the output from Set will result in an error.
3. The following functions will return Void: Set, Clear, Remove, Notify
(Repl), Help (Repl), Exit (Repl). Future functions that have no return
value will return Void.
There is a tiny loss of functionality with this change. The result from
Remove can no longer be put in a variable. Which normally doesn't matter
as Remove returns no value. But, if Remove encounters an error, that
error can no longer be put in a variable. The error will still be
reported and can be caught and processed with IfError and App.OnError in
Power Apps. With an IfError, the error record can be extracted and that
can be put in a variable. The team discussed this and we do not believe
this is a common pattern, if used at all.
With this change, it is also not possible to use Boolean logic to short
circuit the use of these functions. For example, it used to be possible
to `Back() && Clear( table )` and the Clear would only be executed if
the Back() returned true. We don't think the intent here is very clear,
especially for a non-pro developer, and we'd prefer it be written as
`If( Back(), Clear( table )`. Usage on Canvas apps is very low for this
pattern.
This pr performs necessary wiring to enable creating NL Handler for
Nl2Fx and FX2NL based on the current IPowerFxScope language server is
operating on. This is necessary to support Nl2FX scenarios in Power Apps
and the current approach which uses Nl2FxImplementation property is not
a thread safe. With the plan to perform Nl2Fx operations in parallel and
given that we only create 1 instance of Language Server SDK, two
concurrent Nl2FX tasks can overwrite Nl2FxImplementation unexpectedly.
The new approach in this pr scopes the creation of handler to every
Nl2FX task. It allows the creation of handler based on the scope itself
which has "host" specific entities which are required to create a more
meaningful NlHandler. For Power Apps, "host" contains document, control
and property which are critical to context building for Nl2Fx model
inside NL Handler.
A regression was caused during AI Disclaimer changes that resulted in
formula bar always showing first parameter in signature help as active
parameter even when a user is not typing a first parameter and is on
let's say a fourth parameter.
This happened due to the addition of "ActiveParameter" property in
SignatureInformation model. There are two "active parameter" properties
as shown below
![image](https://github.com/microsoft/Power-Fx/assets/25670945/1a9cfc68-6a95-4d16-95b4-c647ed29e15c)
On the left is active parameter for specific signature information which
we never had but was introduced with Ai disclaimer change. On the right
is a global one that we used and applied to all signatures.
Active parameter for specific signature info takes precedence over
global one so in this case since we introduced this property for each
signature info but never set it to anything, it was always being set to
"0" causing formula bar to set first parameter as an active parameter
This pr removes that active parameter property for each specific
signature info as we never had it and we always used global one
Current Regression:
![image](https://github.com/microsoft/Power-Fx/assets/25670945/6c155495-106c-4ad2-961a-65ed993f02d8)
After this Pr:
![image](https://github.com/microsoft/Power-Fx/assets/25670945/bce3f25c-de7c-41d6-8c24-2c609277ef9e)
We currently have support for untyped objects, but to access their fields they need to be known at build time. This makes the support really untyped - we can access the column names of untyped records and also retrieve a column value given its name as a string.
- Avoid throwing exceptions when we could successfully load a swagger
file and have working functions
Function where we identify issues or using unsupported features will be
marked as unsupported
- [Breaking] Separation of IsDeprecated & IsSupported flags
Before, IsDeprecated was implying IsSupported = false, this is no more
the case
By default, deprecated functions will be marked as supported.
- ConnectorFunction.NotSupportedReason now shows the complete list of
identified failures whereever they are (parameters, return type,
dynamic-* extensions...)
- [Breaking] Calling ConnectorFunction.InvokeAsync will now fail on
unsupported functions
- Connector logger now reports all errors occurring during swagger
processing
- When an HTTP exception occurs during function invocation, add
reasonPhrase in error message for better clarity
- In FormulaValue serializer or Http function invoker, change exceptions
from NotImplementedException, ArgumentException or
InvalidOperationException to PowerFxConnectorException
- Determine function parameter default values at swagger load time, not
runtime: better error handling, faster execution
- Few code improvements reported by static code analyzers
---------
Co-authored-by: Anderson Silva <joyle@outlook.com>
- New Microsoft.PowerFx.TexlFunctionExporter project/nuget with
SwaggerIdentification & YamlExporter features
- Fix Intellisense issue for connector functions having optional
parameters (Intellisense wasn't reporting required parameters alongside
w/ optional params)
- Extend api-version workaround to a couple more headers (linked to
https://github.com/microsoft/Power-Fx/pull/1987 -
https://github.com/microsoft/Power-Fx/issues/1982)
Fixes 'Azure App Service', 'Azure Automation', 'Azure Container
Instance', 'Azure Data Factory', 'Azure Event Grid', 'Azure Resource
Manager', 'Azure VM' and 'GitHub Utils' connectors
- Fix an issue when a connector function contains a return type 'file'
(as described in swagger file) which was preventing the generation of
the TexlFunction
- Add ability to return unknown record fields (not described in swagger)
as UntypedObject (ReturnUnknownRecordFieldsAsUntypedObjects internal
property on ConnectorSettings, only with swagger compatibility)
- Add GenerateYamlFiles test
Add userAgent to PowerPlatformConnectorClient to generate a User Agent
when calling APIM like below
`MyProduct/v1.2 PowerFx/1.3.0-build.20240110-1001`
Following RFC9110
As we increase our official NuGet version, the version from a local build should have a higher version number. This increases it to a very large number, which should be enough until our major version update.
> [!CAUTION]
> BREAKING CHANGE
> - Internal functions are no more visible externally
Functions having _x-ms-visibility_ extension with "internal" value are
not visible in PowerApps
We were making all these functions visible and this is now fixed
**⚠️ Some customers had access to functions they won't find them
anymore**
Tabular connectors are heavily impacted here - those connectors
shouldn't be exposed as they aren't presented like PowerApps as a table
It is possible to expose internal functions via
_ConnectorSettings.IncludeInternalFunctions_ (default value false) but
this should only be reserved for tests and never set in production
FYI, these internal functions are heavily used in dynamic Intellisense
- Serialization of "date-time" and "date-no-tz" swagger types was
incorrect
- "date-time" fields are converted properly (wasn't the case) & sent as
UTC on the wire (`yyyy-MM-ddTHH:mm:ss.fffZ` format), precision has been
fixed (trucated to 1 ms)
This is what PowerApps is doing
- "date-no-tz" fields are sent on the wire with
`yyyy-MM-ddTHH:mm:ss.fff` format (no Z, truncated to 1ms)
PowerApps has a bug under investigation (PA swallows seconds, ms and us,
potentially leading to incorrect results)
- Deserialization of "date-time" fields was having some timezone
conversion issues
This is fixed
- Connector parameters are case-sensitive and we were managing them as
case-insensitive
This is fixed
- Some parameters with identical names (which are renamed with _1, _2...
like in PA) where improperly serialized in HTTP payload
This is fixed
- Connector parameters with array parameters in circular references
where improperly identified as strings (instead of array)
This is fixed
- O365 Outlook _GetSensitivityLabels_ hidden function doesn't work due
to a very probable bug in its swagger definition - this is under
investigation
This impacts _SendEmail_ and _SendEmailV2_ functions where dynamic
intellisense will not work properly for _Sensitivity_ param (no
suggestion returned)
- Connector MediaKind is now identified in swagger files
(_x-ms-media-kind_ extension)
Unused for now, but this is to properly support image params later
Fix#1202
The disclaimer is markdown (including a help link) in the resources.
1. TexlFunction gets a virtual flag noting whether the function needs a
disclaimer. Default impl is based on a whitelist of AI functions, but we
can override this flag next.
2. LSP will get flag and append , and send markdown to formula bar.
This productizes the POC from #2099 .
- Full validation of O365 Groups connector
- Full validation of O365 Users connector
- Fix in connector code around internal parameters (discovered a
variation w/ PA Client which is confirmed as a bug on their end)
- add logic in HttpFunctionInvoker to trace requests (disabled by
default)
- add support in test code for providing JPG response files as byte
array
-Fixes Accepts() for option set.
Earlier OptionSet did not have equality defined, so accepts was using
reference equality which can cause issues, as an example in caching.
Partial for #2004.
Not doing categories yet because we need to discuss how to support that
longer term. Is there a curated set? Do we expose the category enum?