push neon reactor

This commit is contained in:
2026-07-12 15:11:38 +02:00
parent 172e72dbcd
commit aeab5f7820
9597 changed files with 2407488 additions and 0 deletions
+153
View File
@@ -0,0 +1,153 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT POWER PLATFORM @MICROSOFT/POWER-APPS-CLI
August 2025
These license terms are an agreement between you and Microsoft Corporation (or one of its affiliates). They
apply to the software named above and any Microsoft services or software updates (except to the extent such
services or updates are accompanied by new or additional terms, in which case those different terms apply
prospectively and do not alter your or Microsofts rights relating to pre-updated software or services). IF YOU
COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU
ACCEPT THESE TERMS.
1. INSTALLATION AND USE RIGHTS.
a) General. You may install and use any number of copies of the software to develop and test your
applications.
b) Third Party Components. The software may include third party components with separate legal
notices or governed by other agreements, as may be described in the ThirdPartyNotices file(s)
accompanying the software.
c) Work or School Accounts. You can sign into the software with a work or school email address. If
you do, you agree that the owner of the domain associated with your email address may control and
administer your account, and access and process your data, including the contents of your
communications and files. You further agree that your use of the software may be subject to: i) your
organizations guidelines and policies regarding the use of the software; and ii) the agreements
Microsoft has with you or your organization, and in such case these terms may not apply. If you
already have a Microsoft account and you use a separate work or school email address to access the
software, you may be prompted to update the email address associated with your Microsoft account to
continue accessing the software.
2. SCOPE OF LICENSE. The software is licensed, not sold. Microsoft reserves all other rights. Unless
applicable law gives you more rights despite this limitation, you will not (and have no right to):
a) work around any technical limitations in the software that only allow you to use it in certain ways;
b) reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source
code for the software, except and to the extent required by third party licensing terms governing use
of certain open source components that may be included in the software;
c) remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software;
d) use the software in any way that is against the law or to create or propagate malware; or
e) share, publish, distribute, or lease the software (except for any distributable code, subject to the
terms above), provide the software as a stand-alone offering for others to use, or transfer the
software or this agreement to any third party.
3. DATA.
a) Data Collection. The software may collect information about you and your use of the software, and
send that to Microsoft. Microsoft may use this information to provide services and improve our
products and services. You may opt-out of many of these scenarios, but not all, as described in the
product documentation. There are also some features in the software that may enable you to collect
data from users of your applications. If you use these features to enable data collection in your
applications, you must comply with applicable law, including providing appropriate notices to users of
your applications. You can learn more about data collection and use in the help documentation and
the privacy statement at https://go.microsoft.com/fwlink/?linkid=521839. Your use of the software
operates as your consent to these practices.
b) Processing of Personal Data. To the extent Microsoft is a processor or subprocessor of personal
data in connection with the software, Microsoft makes the commitments in the European Union
General Data Protection Regulation Terms of the Microsoft Products and Services Data Protection
Addendum to all customers effective May 25, 2018, at
https://go.microsoft.com/fwlink/?linkid=2135030.
4. COMPLIANCE WITH TRADE LAWS. Microsoft products, software, technology, and services (“Items”)
may be subject to U.S. and other countries export jurisdictions. Each party will comply with all laws and
regulations applicable to the import or export of the Items, including, without limitation, trade laws of the
U.S., EU, and UK, such as the U.S. Export Administration Regulations, sanctions regulations administered
by the U.S. Office of Foreign Assets Control, the EU Dual Use Regulation 2021/821, and/or other end-user,
end use, and destination restrictions (“Trade Laws”) as well as the global legal compliance standards
detailed in the Microsoft Standards of Business Conduct. Customer will not, and will ensure its Affiliates
will not, take any action that causes Microsoft to violate applicable Trade Laws. Microsoft may suspend or
terminate this agreement immediately without notice to the extent that Microsoft reasonably believes that
performance would cause it to violate Trade Laws or put it at risk of becoming subject to sanctions and
penalties under such laws. Customer remains responsible for its and for its Affiliates compliance with this
section and, to the extent applicable, the Regional Trade Compliance Addendum incorporated herein by
reference.
5. SUPPORT SERVICES. Microsoft is not obligated under this agreement to provide any support services for
the software. Any support provided is “as is”, “with all faults”, and without warranty of any kind.
6. ENTIRE AGREEMENT. This agreement, and any other terms Microsoft may provide for supplements,
updates, or third-party applications, is the entire agreement for the software.
7. APPLICABLE LAW AND PLACE TO RESOLVE DISPUTES. If you acquired the software in the United
States or Canada, the laws of the state or province where you live (or, if a business, where your principal
place of business is located) govern the interpretation of this agreement, claims for its breach, and all
other claims (including consumer protection, unfair competition, and tort claims), regardless of conflict of
laws principles. If you acquired the software in any other country, its laws apply. If U.S. federal jurisdiction
exists, you and Microsoft consent to exclusive jurisdiction and venue in the federal court in King County,
Washington for all disputes heard in court. If not, you and Microsoft consent to exclusive jurisdiction and
venue in the Superior Court of King County, Washington for all disputes heard in court.
8. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights. You
may have other rights, including consumer rights, under the laws of your state or country. Separate and
apart from your relationship with Microsoft, you may also have rights with respect to the party from which
you acquired the software. This agreement does not change those other rights if the laws of your state or
country do not permit it to do so. For example, if you acquired the software in one of the below regions, or
mandatory country law applies, then the following provisions apply to you:
a) Australia. You have statutory guarantees under the Australian Consumer Law and nothing in this
agreement is intended to affect those rights.
b) Canada. If you acquired this software in Canada, you may stop receiving updates by turning off the
automatic update feature, disconnecting your device from the Internet (if and when you re-connect to
the Internet, however, the software will resume checking for and installing updates), or uninstalling
the software. The product documentation, if any, may also specify how to turn off updates for your
specific device or software.
c) Germany and Austria.
i. Warranty. The properly licensed software will perform substantially as described in any Microsoft
materials that accompany the software. However, Microsoft gives no contractual guarantee in
relation to the licensed software.
ii. Limitation of Liability. In case of intentional conduct, gross negligence, claims based on the
Product Liability Act, as well as, in case of death or personal or physical injury, Microsoft is liable
according to the statutory law.
Subject to the foregoing clause ii., Microsoft will only be liable for slight negligence if Microsoft is in
breach of such material contractual obligations, the fulfillment of which facilitate the due performance
of this agreement, the breach of which would endanger the purpose of this agreement and the
compliance with which a party may constantly trust in (so-called "cardinal obligations"). In other cases
of slight negligence, Microsoft will not be liable for slight negligence.
9. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS IS.” YOU BEAR THE RISK OF
USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS.
TO THE EXTENT PERMITTED UNDER APPLICABLE LAWS, MICROSOFT EXCLUDES ALL IMPLIED
WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
NON-INFRINGEMENT.
10. LIMITATION ON AND EXCLUSION OF DAMAGES. IF YOU HAVE ANY BASIS FOR RECOVERING
DAMAGES DESPITE THE PRECEDING DISCLAIMER OF WARRANTY, YOU CAN RECOVER FROM
MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT
RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL,
INDIRECT, OR INCIDENTAL DAMAGES.
This limitation applies to (a) anything related to the software, services, content (including
code) on third party Internet sites, or third party applications; and (b) claims for breach of
contract, warranty, guarantee, or condition; strict liability, negligence, or other tort; or any
other claim; in each case to the extent permitted by applicable law.
It also applies even if Microsoft knew or should have known about the possibility of the
damages. The above limitation or exclusion may not apply to you because your state,
province, or country may not allow the exclusion or limitation of incidental, consequential, or
other damages.
Please note: As this software is distributed in Canada, some of the clauses in this agreement are
provided below in French.
Remarque: Ce logiciel étant distribué au Canada, certaines des clauses dans ce contrat sont
fournies ci-dessous en français.
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute
utilisation de ce logiciel est à votre seule risque et péril. Microsoft naccorde aucune autre
garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la
protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le
droit locale, les garanties implicites de qualité marchande, dadéquation à un usage particulier et
dabsence de contrefaçon sont exclues.
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES
DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de
dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune
indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou
accessoires et pertes de bénéfices.
Cette limitation concerne:
• tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur
des sites Internet tiers ou dans des programmes tiers; et
• les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité
stricte, de négligence ou dune autre faute dans la limite autorisée par la loi en vigueur.
Elle sapplique également, même si Microsoft connaissait ou devrait connaître l’éventualité dun
tel dommage. Si votre pays nautorise pas lexclusion ou la limitation de responsabilité pour les
dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou
lexclusion ci-dessus ne sappliquera pas à votre égard.
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir
dautres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que
vous confèrent les lois de votre pays si celles-ci ne le permettent pas.
DWT 28909173v1 0085000-001126
DWT 28909173v1 0085000-001126
+399
View File
@@ -0,0 +1,399 @@
# @microsoft/power-apps-cli
A command-line interface for managing Power Apps code apps. This CLI enables you to initialize, develop, and publish Code Apps directly from your terminal.
> **Note:** This CLI is designed to be used alongside the `@microsoft/power-apps` package. It is generally not recommended to install this package separately. When you install `@microsoft/power-apps`, this CLI is included automatically.
## Installation
```bash
npm install @microsoft/power-apps-cli
```
After installation, run commands using:
```bash
npx power-apps <command>
```
## Usage
You can use the CLI in two ways:
1. **Pass options directly:** Provide all required options as command-line arguments.
```bash
npx power-apps init --display-name "My App" --environment-id abc-123
```
2. **Interactive prompts:** Simply run a command without options, and the CLI will prompt you for any required information.
```bash
npx power-apps init
# The CLI will interactively ask for display name, environment ID, etc.
```
## Configuration
The CLI reads configuration from your `power.config.json` file:
- **`environmentId`** - Required. The environment ID to connect to. If a config file is not present yet, the CLI will prompt you to provide one.
- **`region`** - The cloud instance. If a config file is not present yet, defaults to `prod`. Use the `--cloud` CLI flag to override.
## Global Options
| Option | Alias | Description |
| ------------------- | ----- | ----------------------------------------------------------------------- |
| `--cloud` | | Cloud instance to use (e.g., prod, test, etc.) |
| `--environment-id` | `-e` | Environment ID to connect to |
| `--non-interactive` | | Run in non-interactive mode (all parameters must be provided via flags) |
| `--json` | | Format output as JSON |
| `--no-color` | | Disable colored output |
| `--help` | `-h` | Display help for a command |
| `--version` | `-v` | Output the current version |
## Commands
### `init`
Initialize a new Power Apps code app.
```bash
npx power-apps init [options]
```
**Options:**
| Option | Alias | Description | Default |
| -------------------- | ----- | ---------------------------------------------- | ----------------------- |
| `--environment-id` | `-e` | Environment ID to connect to | |
| `--cloud` | | Cloud instance to use (e.g., prod, test, etc.) | `prod` |
| `--display-name` | `-n` | Display name for the app | |
| `--description` | `-d` | App description | _(empty)_ |
| `--build-path` | `-b` | Build output path | `./dist` |
| `--file-entry-point` | `-f` | Entry point file for the app | `index.html` |
| `--app-url` | `-a` | Local URL where the app is hosted | `http://localhost:3000` |
| `--logo-path` | `-l` | Path to the app logo file | `Default` |
---
### `run`
Run the code app locally for development.
```bash
npx power-apps run [options]
```
**Options:**
| Option | Alias | Description | Default |
| ----------------- | ----- | --------------------------------- | ----------------------- |
| `--port` | `-p` | Port number for the local server | `8080` |
| `--local-app-url` | `-l` | Local URL where the app is hosted | `http://localhost:3000` |
---
### `push`
Push the code app to the Power Apps environment.
```bash
npx power-apps push [options]
```
**Options:**
| Option | Alias | Description |
| --------------- | ----- | ------------------------------------- |
| `--solution-id` | `-s` | Solution name or ID to add the app to |
---
### `add-data-source`
Add a data source to the current Power Apps code app.
```bash
npx power-apps add-data-source [options]
```
**Options:**
| Option | Alias | Description |
| ------------------------ | ----- | ------------------------- |
| `--api-id` | `-a` | API identifier |
| `--connection-id` | `-c` | Connection identifier |
| `--connection-ref` | `-cr` | Connection reference name |
| `--resource-name` | `-t` | Table or resource name |
| `--dataset` | `-d` | Dataset identifier |
| `--org-url` | `-u` | Organization URL |
| `--sql-stored-procedure` | `-sp` | SQL stored procedure name |
| `--solution-id` | `-s` | Solution identifier |
---
### `create-connection`
Create a new connection for a connector. When the connector is SSO-eligible (single auth type that supports first-party login), the connection is created silently using the current user's identity. For other connectors, the CLI starts a local callback server and opens the browser to a hosted page so you can complete the auth flow interactively. In non-interactive mode, only SSO-eligible connectors are supported.
> **Note:** Browser-based connection creation is currently disabled by default while it is being stabilized. To opt in, set the environment variable `POWERAPPS_CLI_ENABLE_BROWSER_CONNECTION=true`. When the variable is unset or false, connectors that require user interaction fail with a clear error directing you to <https://make.powerapps.com>.
```bash
npx power-apps create-connection [options]
```
**Options:**
| Option | Alias | Description |
| ---------------- | ----- | ------------------------------------------------------ |
| `--api-id` | `-a` | API identifier (connector ID), e.g. `shared_office365` |
| `--display-name` | `-n` | Optional display name for the new connection |
With `--json`, prints `{ "connectionId": "...", "displayName": "..." }` on success.
---
### `delete-data-source`
Remove a data source from the Power Apps code app.
```bash
npx power-apps delete-data-source [options]
```
**Options:**
| Option | Alias | Description |
| ------------------------ | ----- | ---------------------------------------------- |
| `--api-id` | `-a` | API identifier associated with the data source |
| `--data-source-name` | `-n` | Data source or table name to remove |
| `--sql-stored-procedure` | `-sp` | SQL stored procedure name to remove |
---
### `list-codeapps`
List all code apps in the environment.
```bash
npx power-apps list-codeapps
```
---
### `list-connection-references`
List all connection references in the environment.
```bash
npx power-apps list-connection-references [options]
```
**Options:**
| Option | Alias | Description |
| --------------- | ----- | -------------------------------- |
| `--solution-id` | `-s` | Solution identifier to filter by |
| `--org-url` | `-u` | Organization URL |
---
### `list-datasets`
List all datasets for a connection.
```bash
npx power-apps list-datasets [options]
```
**Options:**
| Option | Alias | Description |
| ----------------- | ----- | --------------------- |
| `--api-id` | `-a` | API identifier |
| `--connection-id` | `-c` | Connection identifier |
---
### `list-tables`
List all tables for a dataset.
```bash
npx power-apps list-tables [options]
```
**Options:**
| Option | Alias | Description |
| ----------------- | ----- | --------------------- |
| `--api-id` | `-a` | API identifier |
| `--connection-id` | `-c` | Connection identifier |
| `--dataset` | `-d` | Dataset name |
---
### `list-sqlStoredProcedures`
List all SQL stored procedures for a dataset.
```bash
npx power-apps list-sqlStoredProcedures [options]
```
**Options:**
| Option | Alias | Description |
| ----------------- | ----- | --------------------- |
| `--connection-id` | `-c` | Connection identifier |
| `--dataset` | `-d` | Dataset name |
---
### `list-environment-variables`
List all environment variables in the environment.
```bash
npx power-apps list-environment-variables [options]
```
**Options:**
| Option | Alias | Description |
| ----------- | ----- | ---------------- |
| `--org-url` | `-u` | Organization URL |
---
### `list-flows`
List all solution cloud flows that are invokable from Power Apps.
```bash
npx power-apps list-flows [options]
```
**Options:**
| Option | Alias | Description |
| ---------- | ----- | ------------------------------------------------------- |
| `--search` | `-s` | Filter flows by name (case-insensitive substring match) |
---
### `add-flow`
Add a cloud flow to the current Power Apps code app by flow ID. Fetches the flow metadata and swagger, updates `power.config` with connection references, and generates model services.
```bash
npx power-apps add-flow --flow-id <flow-id>
```
**Options:**
| Option | Alias | Description |
| ----------- | ----- | ----------------------------------------------- |
| `--flow-id` | `-f` | The unique identifier (GUID) of the flow to add |
**Example:**
```bash
npx power-apps add-flow --flow-id 00000000-0000-0000-0000-000000000000
```
---
### `find-dataverse-api`
Search Dataverse actions and functions in the environment by name.
```bash
npx power-apps find-dataverse-api [options]
```
**Options:**
| Option | Alias | Description |
| ---------- | ----- | -------------------------------------------------- |
| `--search` | `-s` | Search term to filter Dataverse operations by name |
**Examples:**
```bash
npx power-apps find-dataverse-api --search "account"
npx power-apps find-dataverse-api --search "account" --json
```
---
### `remove-flow`
Remove a cloud flow from the current Power Apps code app. Deletes the flow's connection references from `power.config`, removes the schema file, and regenerates model services.
```bash
npx power-apps remove-flow [options]
```
**Options:**
| Option | Alias | Description |
| ------------- | ----- | --------------------------------------------------------------------- |
| `--flow-name` | `-n` | The flow data source name to remove (as it appears in `power.config`) |
| `--flow-id` | `-f` | The flow resource ID (GUID) to remove — same ID used with `add-flow` |
Provide either `--flow-name` or `--flow-id`.
**Examples:**
```bash
npx power-apps remove-flow --flow-name myFlow
npx power-apps remove-flow --flow-id 00000000-0000-0000-0000-000000000000
```
---
### `telemetry`
Manage telemetry settings.
```bash
npx power-apps telemetry [options]
```
**Options:**
| Option | Description |
| --------------------- | ----------------------------------------------------- |
| `--enable` | Enable telemetry |
| `--disable` | Disable telemetry |
| `--show-settings` | Show current telemetry settings |
| `--console-only` | Output telemetry to console only |
| `--output-to-console` | Output telemetry to console in addition to sending it |
---
### `logout`
Log out the current user.
```bash
npx power-apps logout
```
## Getting Help
To see help for any command, use the `--help` flag:
```bash
# Global help
npx power-apps --help
# Command-specific help
npx power-apps init --help
npx power-apps add-data-source --help
```
## License
Copyright (C) Microsoft Corporation. All rights reserved.
@@ -0,0 +1,60 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { IHttpClient } from '@microsoft/power-apps-actions';
import type { CliLogger } from './Logger/CliLogger.js';
import type { CliOption } from './Types/Argument.types.js';
import type { IAuthenticationProvider, Verb } from './Types/Cli.types.js';
export interface IArgumentProvider {
addOption(cliOption: CliOption): void;
addOptions(cliOptions: CliOption[]): void;
addSwitch(cliOption: CliOption): void;
addSwitches(cliOptions: CliOption[]): void;
runVerb(): Promise<void>;
getVerb(): Verb;
handleGlobalHelpOrFlagsAndExit(): void;
getOption<T>(key: string, ignorePrompt?: boolean): Promise<T>;
getAuthenticationProvider(): IAuthenticationProvider;
setDescription(description: string): void;
isJsonMode(): boolean;
addExamples(examples: string[]): void;
}
export declare class ArgumentProvider implements IArgumentProvider {
private _httpClient;
private _logger;
private _authenticationProvider;
private _environmentId;
private _region;
private _verb;
private _program;
private _options;
constructor(_httpClient: IHttpClient, _logger: CliLogger, _authenticationProvider: IAuthenticationProvider);
addSwitch(cliOption: CliOption): void;
addSwitches(cliOptions: CliOption[]): void;
addOption(cliOption: CliOption): void;
addOptions(cliOptions: CliOption[]): void;
runVerb(): Promise<void>;
handleGlobalHelpOrFlagsAndExit(): void;
getVerb(): Verb;
getOption<T>(key: string, ignorePrompt?: boolean): Promise<T>;
getAuthenticationProvider(): IAuthenticationProvider;
/**
* Sets the description for the current command context.
* This is used to display help information specific to the verb being executed.
*
* @param {string} description - The description to set for the program.
*/
setDescription(description: string): void;
isJsonMode(): boolean;
addExamples(examples: string[]): void;
getEnvironmentId(): string | undefined;
private _getRequiredVariables;
/**
* @param {CliOption} cliOption
* @param {boolean} [hasValue=true] true if the option requires a value, false for a switch such as --help
*/
private _createOption;
private _createFlags;
private _createSwitchFlags;
}
//# sourceMappingURL=ArgumentProvider.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"ArgumentProvider.d.ts","sourceRoot":"","sources":["../src/ArgumentProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAcjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIvE,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACtC,UAAU,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC1C,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACtC,WAAW,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC3C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,OAAO,IAAI,IAAI,CAAC;IAChB,8BAA8B,IAAI,IAAI,CAAC;IACvC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9D,yBAAyB,IAAI,uBAAuB,CAAC;IACrD,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,UAAU,IAAI,OAAO,CAAC;IACtB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACvC;AAED,qBAAa,gBAAiB,YAAW,iBAAiB;IAQtD,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,uBAAuB;IATjC,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,QAAQ,CAAiC;gBAGvC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,SAAS,EAClB,uBAAuB,EAAE,uBAAuB;IAgFnD,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIrC,WAAW,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAI1C,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAIrC,UAAU,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAInC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B9B,8BAA8B;IAU9B,OAAO,IAAI,IAAI;IAOT,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAqCnE,yBAAyB,IAAI,uBAAuB;IAI3D;;;;;OAKG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIzC,UAAU,IAAI,OAAO;IAIrB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAWrC,gBAAgB,IAAI,MAAM,GAAG,SAAS;YAI/B,qBAAqB;IAsBnC;;;OAGG;IACH,OAAO,CAAC,aAAa;IAsBrB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,kBAAkB;CAI3B"}
@@ -0,0 +1,247 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { initializePlayerServices, updateEnvironmentName, updateRegion, } from '@microsoft/power-apps-actions';
import { Command } from 'commander';
import packageJson from '../package.json' with { type: 'json' };
import { getSettings } from './CliSettings.js';
import { createDefaultStringOption } from './CliUtils.js';
import { HelpStrings } from './Constants/HelpStrings.js';
import { UsageError } from './Errors/CliError.js';
import { buildVerbDescriptionTable } from './Utils/BuildVerbDescriptionTable.js';
import { GlobalArguments } from './Verbs/VerbConstants.js';
export class ArgumentProvider {
_httpClient;
_logger;
_authenticationProvider;
_environmentId;
_region;
_verb;
_program;
_options = {};
constructor(_httpClient, _logger, _authenticationProvider) {
this._httpClient = _httpClient;
this._logger = _logger;
this._authenticationProvider = _authenticationProvider;
this._verb = (process.argv[2] || process.env.VERB);
this._program = new Command();
// Add the --non-interactive switch as a global option
this._program.option('--non-interactive', 'Run in non-interactive mode (no prompts, all parameters must be provided via flags or environment variables)');
this._program.option('--json', 'Format output as JSON');
this._program.option('--no-color', 'Disable colored output');
// If a specific verb is detected (and it's not a flag like --help), we configure the program
// to behave as if that verb is the command itself (e.g., "power-apps-cli add-data-source").
// This allows us to display help specific to that verb (options, description) when --help is used,
// rather than showing the generic top-level help. We omit the [verb] argument definition here
// because the verb is already "consumed" into the program name for this execution context.
if (this._verb && !this._verb.startsWith('-')) {
this._program.name(`power-apps ${this._verb}`);
}
else {
this._program.name('power-apps');
this._program.usage('[option] [command] [<args>]');
}
this._program.version(packageJson.version, '-v, --version', 'output the current version');
this._program.description(HelpStrings.Global.ProgramDescription);
// Register custom help text to show verb table on global --help
// This uses Commander's addHelpText hook which runs when help is displayed
this._program.addHelpText('after', (_context) => {
// Only show verb table for global help (not verb-specific help)
if (!this._verb || this._verb.startsWith('-')) {
return '\n' + buildVerbDescriptionTable() + '\n';
}
return '';
});
const settings = getSettings();
this._environmentId = settings.appConfig?.environmentId;
this._region = settings.appConfig?.region;
if (!this._region) {
// Do not provide a prompt, default to prod
this.addOption({
flags: {
key: GlobalArguments.Cloud.name,
},
env: GlobalArguments.Cloud.envVar,
default: 'prod',
description: HelpStrings.Global.Cloud,
});
}
// If we do not have an environmentId, add an option to get one
if (!this._environmentId) {
this.addOption(createDefaultStringOption({
flags: {
key: GlobalArguments.EnvironmentId.name,
alias: GlobalArguments.EnvironmentId.alias,
},
env: GlobalArguments.EnvironmentId.envVar,
message: 'Please provide the environment ID:',
description: HelpStrings.Global.EnvironmentId,
}));
}
initializePlayerServices({
httpClient: this._httpClient,
logger: this._logger,
// Default region is 'prod' if not specified
region: this._region || 'prod',
// Do a temporary variable
environmentName: this._environmentId || 'default',
});
}
addSwitch(cliOption) {
this._createOption(cliOption, false);
}
addSwitches(cliOptions) {
cliOptions.forEach((cliOption) => this._createOption(cliOption, false));
}
addOption(cliOption) {
this._createOption(cliOption);
}
addOptions(cliOptions) {
cliOptions.forEach((cliOption) => this._createOption(cliOption));
}
async runVerb() {
// Commander needs to see only the verb-specific arguments, so strip the verb token
// when a verb was supplied explicitly; global flag paths skip this method entirely.
if (this._verb && !this._verb.startsWith('-') && process.argv[2] === this._verb) {
const args = [process.argv[0], process.argv[1], ...process.argv.slice(3)];
this._program.parse(args);
}
else {
this._program.parse();
}
await this._getRequiredVariables();
if (!this._region) {
throw new UsageError('Region is not set. Use --cloud or set the CLOUD_INSTANCE environment variable.');
}
await this._authenticationProvider.initAsync(this._region);
await this._logger.initializeTelemetry(this._authenticationProvider);
this._logger.trackActivityEvent('Initialize', {
verb: this._verb,
});
}
// Handles scenarios where only global flags (e.g., --help/--version) are provided.
// Returns 'help' when no verb is present, 'flag' when a flag verb needs Commander handling,
// and 'none' when execution should continue to verb-specific logic.
handleGlobalHelpOrFlagsAndExit() {
if (!this._verb) {
this._program.help(); // This will display help and exit
}
if (this._verb.startsWith('-')) {
this._program.parse(process.argv);
}
}
getVerb() {
if (!this._verb || this._verb.startsWith('-')) {
throw new UsageError('No command specified. Run "power-apps --help" for available commands.');
}
return this._verb;
}
async getOption(key, ignorePrompt) {
const settings = getSettings();
let value = this._program.getOptionValue(key);
const option = this._options[key];
// Fallback to environment variable if not provided via CLI
if (value === undefined && option && option.env) {
value = process.env[option.env];
}
// Fallback to default value if not provided via CLI or Env
if (value === undefined && option && option.default !== undefined) {
value = option.default;
}
if (!value && !ignorePrompt && option?.customPrompt) {
if (!settings.interactive) {
if (option.optionalInNonInteractive) {
// Option is optional — return undefined and let the actions layer handle it.
}
else {
const flagName = option.flags.key;
const alias = option.flags.alias;
const flagHint = alias ? `--${flagName} (-${alias})` : `--${flagName}`;
const envHint = option.env ? ` or environment variable (${option.env})` : '';
throw new UsageError(`Missing required option ${flagHint}${envHint}. In non-interactive mode, all parameters must be provided via flags or environment variables.`);
}
}
else {
value = await option.customPrompt();
}
}
// Option could be undefined by design, so just return it.
return value;
}
getAuthenticationProvider() {
return this._authenticationProvider;
}
/**
* Sets the description for the current command context.
* This is used to display help information specific to the verb being executed.
*
* @param {string} description - The description to set for the program.
*/
setDescription(description) {
this._program.description(description);
}
isJsonMode() {
return this._program.opts().json === true;
}
addExamples(examples) {
if (!examples || examples.length === 0)
return;
this._program.addHelpText('after', () => {
const lines = ['', 'Examples:'];
examples.forEach((example) => {
lines.push(` $ ${example}`);
});
return lines.join('\n');
});
}
getEnvironmentId() {
return this._environmentId;
}
async _getRequiredVariables() {
// We always need a region and environmentId, which we usually get from the config.
// If there is no config we prompt for them, except for init/telemetry which manage their own state.
if (this._verb !== 'telemetry' && this._verb !== 'logout') {
if (!this._environmentId) {
const environmentId = await this.getOption('environmentId');
if (environmentId) {
this._environmentId = environmentId;
updateEnvironmentName(this._environmentId);
}
}
}
if (!this._region) {
const region = await this.getOption('cloud');
if (region) {
this._region = region;
updateRegion(region);
}
}
}
/**
* @param {CliOption} cliOption
* @param {boolean} [hasValue=true] true if the option requires a value, false for a switch such as --help
*/
_createOption(cliOption, hasValue = true) {
const option = this._program.createOption(hasValue ? this._createFlags(cliOption.flags) : this._createSwitchFlags(cliOption.flags), cliOption.description);
// We do not set the env or default here because we want to handle it manually in getOption
// This allows us to hide the env variable from the help text
// Hide global options from help output when showing global help
// This prevents --environment-id and --cloud from showing up in the global help
if (!this._verb || this._verb.startsWith('-')) {
option.hideHelp();
}
this._program.addOption(option);
// Map to CliOption using Commander's camelCase attribute name so
// getOption('environmentId') finds the option registered as --environment-id.
this._options[option.attributeName()] = cliOption;
}
_createFlags(flags) {
const { key, alias } = flags;
return alias ? `-${alias}, --${key} <${key}>` : `--${key} <${key}>`;
}
_createSwitchFlags(flags) {
const { key, alias } = flags;
return alias ? `-${alias}, --${key}` : `--${key}`;
}
}
//# sourceMappingURL=ArgumentProvider.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { Region } from '@microsoft/power-apps-common/services';
import type { IAuthenticationProvider } from '../Types/Cli.types.js';
export declare class NodeMsalAuthenticationProvider implements IAuthenticationProvider {
private _msalClient;
private _tenantId;
private _region;
constructor();
initAsync(region: Region): Promise<void>;
getAccessTokenForResource(resource: string): Promise<string>;
getUserTenantId(): string | undefined;
private _acquireTokenInternal;
private _getInteractiveLoginRequest;
}
//# sourceMappingURL=NodeMsalAuthenticationProvider.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"NodeMsalAuthenticationProvider.d.ts","sourceRoot":"","sources":["../../src/Authentication/NodeMsalAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAKpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,qBAAa,8BAA+B,YAAW,uBAAuB;IAC5E,OAAO,CAAC,WAAW,CAAsC;IACzD,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,OAAO,CAAqB;;IAIvB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BxC,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMlE,eAAe,IAAI,MAAM,GAAG,SAAS;YAI9B,qBAAqB;IAmCnC,OAAO,CAAC,2BAA2B;CAepC"}
@@ -0,0 +1,91 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { InteractionRequiredAuthError, PublicClientApplication } from '@azure/msal-node';
import open from 'open';
import { getAuthority } from '../CliUtils.js';
import { AUTH_CACHE_DIRECTORY } from '../Constants.js';
import { printError, printInfo } from '../Utils/ConsoleOutput.js';
export class NodeMsalAuthenticationProvider {
_msalClient;
_tenantId;
_region;
constructor() { }
async initAsync(region) {
this._region = region;
const { DataProtectionScope, PersistenceCachePlugin, PersistenceCreator } = await import('@azure/msal-node-extensions');
const persistenceConfiguration = {
cachePath: AUTH_CACHE_DIRECTORY + '/msal_cache.json',
dataProtectionScope: DataProtectionScope.CurrentUser,
serviceName: 'power-apps',
accountName: 'power-apps',
usePlaintextFileOnLinux: false,
};
const persistence = await PersistenceCreator.createPersistence(persistenceConfiguration);
const authConfig = {
auth: {
authority: getAuthority(this._region, this._tenantId),
clientId: '9cee029c-6210-4654-90bb-17e6e9d36617',
},
cache: {
cachePlugin: new PersistenceCachePlugin(persistence),
},
};
this._msalClient = new PublicClientApplication(authConfig);
}
async getAccessTokenForResource(resource) {
const result = await this._acquireTokenInternal(resource + '/.default');
this._tenantId = result.tenantId;
return result.accessToken;
}
getUserTenantId() {
return this._tenantId;
}
async _acquireTokenInternal(resource) {
if (!this._msalClient) {
throw new Error('Authentication not initialized yet');
}
const accounts = await this._msalClient.getTokenCache().getAllAccounts();
if (accounts.length === 1) {
const silentRequest = {
account: accounts[0],
scopes: [resource],
};
try {
const result = await this._msalClient.acquireTokenSilent(silentRequest);
return result;
}
catch (error) {
if (error instanceof InteractionRequiredAuthError) {
return this._msalClient.acquireTokenInteractive(this._getInteractiveLoginRequest(resource));
}
throw error;
}
}
else if (accounts.length > 1) {
accounts.forEach((account) => {
printInfo(account.username);
});
return Promise.reject('Multiple accounts found. Please use the logout command to remove existing accounts.');
}
else {
return this._msalClient.acquireTokenInteractive(this._getInteractiveLoginRequest(resource));
}
}
_getInteractiveLoginRequest(resource) {
const openBrowser = async (url) => {
try {
await open(url, { wait: false });
}
catch (error) {
printError(`Failed to open browser: ${String(error)}`);
}
};
return {
scopes: [resource],
openBrowser,
successTemplate: 'You can close this window now.',
};
}
}
//# sourceMappingURL=NodeMsalAuthenticationProvider.js.map
@@ -0,0 +1 @@
{"version":3,"file":"NodeMsalAuthenticationProvider.js","sourceRoot":"","sources":["../../src/Authentication/NodeMsalAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEzF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,OAAO,8BAA8B;IACjC,WAAW,CAAsC;IACjD,SAAS,CAAqB;IAC9B,OAAO,CAAqB;IAEpC,gBAAsB,CAAC;IAEhB,KAAK,CAAC,SAAS,CAAC,MAAc;QACnC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,MAAM,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,GACvE,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;QAC9C,MAAM,wBAAwB,GAAG;YAC/B,SAAS,EAAE,oBAAoB,GAAG,kBAAkB;YACpD,mBAAmB,EAAE,mBAAmB,CAAC,WAAW;YACpD,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,YAAY;YACzB,uBAAuB,EAAE,KAAK;SAC/B,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;QAEzF,MAAM,UAAU,GAAkB;YAChC,IAAI,EAAE;gBACJ,SAAS,EAAE,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;gBACrD,QAAQ,EAAE,sCAAsC;aACjD;YACD,KAAK,EAAE;gBACL,WAAW,EAAE,IAAI,s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,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC,MAAM,CACnB,qFAAqF,CACtF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,IAAI,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;IAEO,2BAA2B,CAAC,QAAgB;QAClD,MAAM,WAAW,GAAG,KAAK,EAAE,GAAW,EAAiB,EAAE;YACvD,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,UAAU,CAAC,2BAA2B,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACzD,CAAC;QACH,CAAC,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,CAAC,QAAQ,CAAC;YAClB,WAAW;YACX,eAAe,EAAE,gCAAgC;SAClD,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,15 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { Region } from '@microsoft/power-apps-common/services';
import type { IAuthenticationProvider } from '../Types/Cli.types.js';
export declare class PacCliAuthenticationProvider implements IAuthenticationProvider {
private _tokenCache;
initAsync(_region: Region): Promise<void>;
getAccessTokenForResource(resource: string): Promise<string>;
getUserTenantId(): string | undefined;
private _getAccessTokenFromResourceInternal;
private _requestToken;
private _readStdIn;
}
//# sourceMappingURL=PacCliAuthenticationProvider.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"PacCliAuthenticationProvider.d.ts","sourceRoot":"","sources":["../../src/Authentication/PacCliAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,qBAAa,4BAA6B,YAAW,uBAAuB;IAC1E,OAAO,CAAC,WAAW,CAA8B;IAEpC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlE,eAAe,IAAI,MAAM,GAAG,SAAS;YAI9B,mCAAmC;IAgBjD,OAAO,CAAC,aAAa;YAIP,UAAU;CAqBzB"}
@@ -0,0 +1,51 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import * as readline from 'readline';
export class PacCliAuthenticationProvider {
_tokenCache = {};
async initAsync(_region) {
// no-op
}
async getAccessTokenForResource(resource) {
return this._getAccessTokenFromResourceInternal(resource);
}
getUserTenantId() {
return undefined;
}
async _getAccessTokenFromResourceInternal(resource) {
if (this._tokenCache[resource]) {
return this._tokenCache[resource];
}
this._requestToken(resource);
const token = await this._readStdIn();
if (!token) {
throw new Error('No token provided');
}
this._tokenCache[resource] = token;
return token;
}
_requestToken(resource) {
console.log('REQUEST_TOKEN ' + resource);
}
async _readStdIn() {
return new Promise((resolve, reject) => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
// Wait 10 seconds to get the token before throwing an error
const timeout = setTimeout(() => {
rl.close();
reject(new Error('Token input timeout: No token received within 10 seconds'));
}, 10000);
rl.once('line', (line) => {
clearTimeout(timeout);
rl.close();
resolve(line.trim());
});
});
}
}
//# sourceMappingURL=PacCliAuthenticationProvider.js.map
@@ -0,0 +1 @@
{"version":3,"file":"PacCliAuthenticationProvider.js","sourceRoot":"","sources":["../../src/Authentication/PacCliAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;A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E,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC,CAAC;YAChF,CAAC,EAAE,KAAK,CAAC,CAAC;YAEV,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACvB,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,EAAE,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,20 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { Region } from '@microsoft/power-apps-common/services';
import type { IAuthenticationProvider } from '../Types/Cli.types.js';
/**
* note: This is meant for use in CI only since it hardcodes the authority & tenant ID.
*/
export declare class ServicePrincipalAuthenticationProvider implements IAuthenticationProvider {
private _msalClient;
private _clientId;
private _clientSecret;
private _tenantId;
private _region;
constructor();
initAsync(region: Region): Promise<void>;
getAccessTokenForResource(resource: string): Promise<string>;
getUserTenantId(): string | undefined;
}
//# sourceMappingURL=ServicePrincipalAuthenticationProvider.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"ServicePrincipalAuthenticationProvider.d.ts","sourceRoot":"","sources":["../../src/Authentication/ServicePrincipalAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE;;GAEG;AACH,qBAAa,sCAAuC,YAAW,uBAAuB;IACpF,OAAO,CAAC,WAAW,CAA4C;IAC/D,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAqB;;IAavB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxC,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBlE,eAAe,IAAI,MAAM,GAAG,SAAS;CAG7C"}
@@ -0,0 +1,51 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { ConfidentialClientApplication } from '@azure/msal-node';
import { getAuthority } from '../CliUtils.js';
/**
* note: This is meant for use in CI only since it hardcodes the authority & tenant ID.
*/
export class ServicePrincipalAuthenticationProvider {
_msalClient;
_clientId;
_clientSecret;
_tenantId;
_region;
constructor() {
if (!process.env.SP_CLIENT_ID || !process.env.SP_CLIENT_SECRET || !process.env.SP_TENANT_ID) {
throw new Error('Service Principal environment variables SP_CLIENT_ID, SP_CLIENT_SECRET, and SP_TENANT_ID must be set');
}
this._clientId = process.env.SP_CLIENT_ID;
this._clientSecret = process.env.SP_CLIENT_SECRET;
this._tenantId = process.env.SP_TENANT_ID;
}
async initAsync(region) {
this._region = region;
const authConfig = {
auth: {
clientId: this._clientId,
clientSecret: this._clientSecret,
authority: getAuthority(this._region, this._tenantId),
},
};
this._msalClient = new ConfidentialClientApplication(authConfig);
}
async getAccessTokenForResource(resource) {
if (!this._msalClient) {
throw new Error('Authentication not initialized yet');
}
const clientCredentialRequest = {
scopes: [resource + '/.default'],
};
const result = await this._msalClient.acquireTokenByClientCredential(clientCredentialRequest);
if (!result?.accessToken) {
throw new Error('Failed to acquire token using service principal');
}
return result.accessToken;
}
getUserTenantId() {
return this._tenantId;
}
}
//# sourceMappingURL=ServicePrincipalAuthenticationProvider.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ServicePrincipalAuthenticationProvider.js","sourceRoot":"","sources":["../../src/Authentication/ServicePrincipalAuthenticationProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,YAAY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AI,CAAC,WAAW,CAAC,8BAA8B,CAAC,uBAAuB,CAAC,CAAC;QAE9F,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,MAAM,CAAC,WAAW,CAAC;IAC5B,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,6 @@
#!/usr/bin/env node
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export {};
//# sourceMappingURL=Bin.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Bin.d.ts","sourceRoot":"","sources":["../src/Bin.ts"],"names":[],"mappings":";AAEA;;GAEG"}
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env node
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { boot } from './Cli.js';
boot();
//# sourceMappingURL=Bin.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Bin.js","sourceRoot":"","sources":["../src/Bin.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
export declare function boot(): Promise<void>;
//# sourceMappingURL=Cli.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Cli.d.ts","sourceRoot":"","sources":["../src/Cli.ts"],"names":[],"mappings":"AAoCA,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuD1C"}
+137
View File
@@ -0,0 +1,137 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { ArgumentProvider } from './ArgumentProvider.js';
import { PacCliAuthenticationProvider } from './Authentication/PacCliAuthenticationProvider.js';
import { initializeCliSettings, setCliLogger } from './CliSettings.js';
import { CliError } from './Errors/CliError.js';
import { CliHttpClient } from './HttpClient/CliHttpClient.js';
import { CliLogger } from './Logger/CliLogger.js';
import { addDataSourceAsync, addDataverseApiAsync, addFlowAsync, createConnectionVerbAsync, deleteDataSourceAsync, findDataverseApiAsync, getCodeAppsAsync, initAsync, listConnectionReferences, listConnectionsAsync, listDatasetsAsync, listSqlStoredProceduresAsync, listTablesAsync, logoutAsync, pushAsync, refreshDataSourceAsync, removeFlowAsync, runAsync, } from './Verbs/index.js';
import { listAllEnvironmentVariablesAsync } from './Verbs/ListEnvironmentVariables.js';
import { listFlowsAsync } from './Verbs/ListFlows.js';
import { modifyTelemetrySettings } from './Verbs/TelemetrySettings.js';
let logger;
let exitCode = 0;
export async function boot() {
try {
if (process.argv.includes('--no-color')) {
process.env.NO_COLOR = '1';
}
const isPacCli = process.env.IS_PAC_CLI === 'true';
const isTestRun = process.env.CI === 'true';
const hasNonInteractiveFlag = process.argv.includes('--non-interactive');
const source = isPacCli ? 'pac-cli' : 'standalone';
const interactive = !isPacCli && !isTestRun && !hasNonInteractiveFlag && process.stdin.isTTY === true;
const cliSettings = await initializeCliSettings({ source, interactive });
let authenticationProvider;
if (isPacCli) {
authenticationProvider = new PacCliAuthenticationProvider();
}
else if (isTestRun) {
const { ServicePrincipalAuthenticationProvider } = await import('./Authentication/ServicePrincipalAuthenticationProvider.js');
authenticationProvider = new ServicePrincipalAuthenticationProvider();
}
else {
// Dynamically import NodeMsalAuthenticationProvider only when needed
const { NodeMsalAuthenticationProvider } = await import('./Authentication/NodeMsalAuthenticationProvider.js');
authenticationProvider = new NodeMsalAuthenticationProvider();
}
const httpClient = new CliHttpClient(authenticationProvider);
// The CLI logger might need to use httpClient and environment info during its initialization
// So we create it after the httpClient and authenticationProvider are ready
logger = await CliLogger.create(cliSettings, httpClient);
setCliLogger(logger);
const argumentProvider = new ArgumentProvider(httpClient, logger, authenticationProvider);
argumentProvider.handleGlobalHelpOrFlagsAndExit();
const verb = argumentProvider.getVerb();
await executeVerb({ verb, argumentProvider });
}
catch (err) {
const message = err instanceof Error ? err.message : String(err);
console.error(message);
exitCode = err instanceof CliError ? err.exitCode : 1;
}
finally {
// Ensure logger flush on exit
if (logger) {
await logger.flush();
}
process.exit(exitCode);
}
}
async function executeVerb(config) {
const { verb, argumentProvider } = config;
switch (verb) {
case 'init':
await initAsync(argumentProvider);
break;
case 'list-codeapps':
await getCodeAppsAsync(argumentProvider);
break;
case 'add-data-source':
await addDataSourceAsync(argumentProvider);
break;
case 'list-datasets':
await listDatasetsAsync(argumentProvider);
break;
case 'list-tables':
await listTablesAsync(argumentProvider);
break;
case 'list-sqlStoredProcedures':
await listSqlStoredProceduresAsync(argumentProvider);
break;
case 'delete-data-source':
await deleteDataSourceAsync(argumentProvider);
break;
case 'refresh-data-source':
await refreshDataSourceAsync(argumentProvider);
break;
case 'logout':
await logoutAsync(argumentProvider);
break;
case 'list-environment-variables':
await listAllEnvironmentVariablesAsync(argumentProvider);
break;
case 'list-connection-references':
await listConnectionReferences(argumentProvider);
break;
case 'list-connections':
await listConnectionsAsync(argumentProvider);
break;
case 'list-flows':
await listFlowsAsync(argumentProvider);
break;
case 'add-dataverse-api':
await addDataverseApiAsync(argumentProvider);
break;
case 'add-flow':
await addFlowAsync(argumentProvider);
break;
case 'create-connection':
await createConnectionVerbAsync(argumentProvider);
break;
case 'remove-flow':
await removeFlowAsync(argumentProvider);
break;
case 'find-dataverse-api':
await findDataverseApiAsync(argumentProvider);
break;
case 'push':
await pushAsync(argumentProvider);
break;
case 'run':
await runAsync(argumentProvider);
break;
case 'telemetry':
await modifyTelemetrySettings(argumentProvider);
break;
default:
unsupportedVerb(verb);
}
}
// Helper function ensures compile time checking for exhaustive verb handling
function unsupportedVerb(verb) {
throw new Error(`The verb "${verb}" is not supported.`);
}
//# sourceMappingURL=Cli.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../src/Cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,4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AgB,CAAC,CAAC;YACpC,MAAM;QACR,KAAK,4BAA4B;YAC/B,MAAM,gCAAgC,CAAC,gBAAgB,CAAC,CAAC;YACzD,MAAM;QACR,KAAK,4BAA4B;YAC/B,MAAM,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;YACjD,MAAM;QACR,KAAK,kBAAkB;YACrB,MAAM,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;YAC7C,MAAM;QACR,KAAK,YAAY;YACf,MAAM,cAAc,CAAC,gBAAgB,CAAC,CAAC;YACvC,MAAM;QACR,KAAK,mBAAmB;YACtB,MAAM,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;YAC7C,MAAM;QACR,KAAK,UAAU;YACb,MAAM,YAAY,CAAC,gBAAgB,CAAC,CAAC;YACrC,MAAM;QACR,KAAK,mBAAmB;YACtB,MAAM,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;YAClD,MAAM;QACR,KAAK,aAAa;YAChB,MAAM,eAAe,CAAC,gBAAgB,CAAC,CAAC;YACxC,MAAM;QACR,KAAK,oBAAoB;YACvB,MAAM,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;YAC9C,MAAM;QACR,KAAK,MAAM;YACT,MAAM,SAAS,CAAC,gBAAgB,CAAC,CAAC;YAClC,MAAM;QACR,KAAK,KAAK;YACR,MAAM,QAAQ,CAAC,gBAAgB,CAAC,CAAC;YACjC,MAAM;QACR,KAAK,WAAW;YACd,MAAM,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;YAChD,MAAM;QACR;YACE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,SAAS,eAAe,CAAC,IAAW;IAClC,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,qBAAqB,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,14 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { ILogger } from '@microsoft/power-apps-actions';
import type { CliSettings, LocalFilePaths } from './Types/Cli.types.js';
export declare function initializeCliSettings({ source, interactive, fileConfig, }: {
source: 'pac-cli' | 'standalone';
interactive: boolean;
fileConfig?: LocalFilePaths;
}): Promise<CliSettings>;
export declare function setCliLogger(logger: ILogger): void;
export declare function getCliLogger(): ILogger;
export declare function getSettings(): CliSettings;
//# sourceMappingURL=CliSettings.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"CliSettings.d.ts","sourceRoot":"","sources":["../src/CliSettings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,+BAA+B,CAAC;AAK5F,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKrE,wBAAsB,qBAAqB,CAAC,EAC1C,MAAM,EACN,WAAW,EACX,UAIC,GACF,EAAE;IACD,MAAM,EAAE,SAAS,GAAG,YAAY,CAAC;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B,wBAwBA;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAElD;AAED,wBAAgB,YAAY,IAAI,OAAO,CAsBtC;AAED,wBAAgB,WAAW,IAAI,WAAW,CAOzC"}
@@ -0,0 +1,69 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { readRepoConfig, setVfs } from '@microsoft/power-apps-actions';
import { APP_CONFIG_FILE, WORKING_DIRECTORY } from './Constants.js';
import { CliFS } from './FS/CliFs.js';
let _cliSettings;
let _logger;
export async function initializeCliSettings({ source, interactive, fileConfig = {
powerConfigPath: `${WORKING_DIRECTORY}/${APP_CONFIG_FILE}`,
schemaPath: `${WORKING_DIRECTORY}/.power/schemas`,
codeGenPath: `${WORKING_DIRECTORY}/src`,
}, }) {
const cliFs = new CliFS({
cwd: process.cwd(),
allowCwdRead: true,
allowCwdWrite: true,
});
// Set VFS at initialize to read the config
setVfs(cliFs);
let appConfig;
try {
appConfig = await readRepoConfig(fileConfig.powerConfigPath);
}
catch (error) {
// Ignore error, there are commands where a config file is not needed
}
_cliSettings = {
source,
interactive,
fileConfig,
cliFs,
appConfig,
};
return _cliSettings;
}
export function setCliLogger(logger) {
_logger = logger;
}
export function getCliLogger() {
if (!_logger) {
// return a no-op logger if not initialized to prevent crashes
/* eslint-disable no-empty-function */
return {
trackActivityEvent: (_eventName, _eventData) => { },
trackErrorEvent: (_eventName, _eventData) => { },
trackScenario: (_name, _scenarioData) => {
return {
scenarioId: '',
complete: (_endScenarioData) => { },
failure: (_failureData) => { },
completeWithError: (_completeWithErrorData) => { },
};
},
stringifyError: (_err) => {
return null;
},
};
}
/* eslint-enable no-empty-function */
return _logger;
}
export function getSettings() {
if (!_cliSettings) {
throw new Error('CLI settings have not been initialized. Please call initializeCliSettings first.');
}
return _cliSettings;
}
//# sourceMappingURL=CliSettings.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CliSettings.js","sourceRoot":"","sources":["../src/CliSettings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,IAAI,YAAyB,CAAC;AAC9B,IAAI,OAAgB,CAAC;AAErB,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,EACN,WAAW,EACX,UAAU,GAAG;IACX,eAAe,EAAE,GAAG,iBAAiB,IAAI,eAAe,EAAE;IAC1D,UAAU,EAAE,GAAG,iBAAiB,iBAAiB;IACjD,WAAW,EAAE,GAAG,iBAAiB,MAAM;CACxC,GAKF;IACC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,YAAY,EAAE,IAAI;QAClB,aA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kFAAkF,CACnF,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,21 @@
import type { Region } from '@microsoft/power-apps-common/services';
import type { CliOption, DefaultStringOption } from './Types/Argument.types.js';
/**
* Prompts the user for text input. Exits the process if the user cancels.
*/
export declare function promptText(options: {
message: string;
initialValue?: string;
}): Promise<string>;
/**
* Prompts the user for confirmation. Exits the process if the user cancels.
*/
export declare function promptConfirm(options: {
message: string;
initialValue?: boolean;
}): Promise<boolean>;
export declare function createDefaultStringOption(options: DefaultStringOption): CliOption<string>;
export declare function isGuid(value: string): boolean;
export declare function createPlayUrl(region: Region, environmentId: string, appId: string, localAppUrl?: string, localConnectionsUrl?: string): string;
export declare function getAuthority(region: Region | undefined, tenantId: string | undefined): string;
//# sourceMappingURL=CliUtils.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"CliUtils.d.ts","sourceRoot":"","sources":["../src/CliUtils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7E;;GAEG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAOlB;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnB;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,MAAM,CAAC,CAWzF;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG7C;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,MAAM,UAgB7B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAU7F"}
@@ -0,0 +1,92 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import * as prompts from '@clack/prompts';
import { isCancel } from '@clack/prompts';
import { printWarning } from './Utils/ConsoleOutput.js';
/**
* Prompts the user for text input. Exits the process if the user cancels.
*/
export async function promptText(options) {
const result = await prompts.text(options);
if (isCancel(result)) {
printWarning('Operation cancelled by user.');
process.exit(0);
}
return result;
}
/**
* Prompts the user for confirmation. Exits the process if the user cancels.
*/
export async function promptConfirm(options) {
const result = await prompts.confirm(options);
if (isCancel(result)) {
printWarning('Operation cancelled by user.');
process.exit(0);
}
return result;
}
export function createDefaultStringOption(options) {
const { flags, env, message, initialValue, description, default: defaultValue } = options;
return {
flags,
env,
description,
default: defaultValue,
customPrompt: async () => {
return await promptText({ message, initialValue });
},
};
}
export function isGuid(value) {
const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
return guidRegex.test(value);
}
export function createPlayUrl(region, environmentId, appId, localAppUrl, localConnectionsUrl) {
const baseUrl = _getBaseUrl(region);
const playUrl = `${baseUrl}/play/e/${environmentId}/app/${appId}`;
const queryParams = [];
if (localAppUrl) {
queryParams.push(`_localAppUrl=${localAppUrl}`);
}
if (localConnectionsUrl) {
queryParams.push(`_localConnectionUrl=${localConnectionsUrl}`);
}
return queryParams.length > 0 ? `${playUrl}?${queryParams.join('&')}` : playUrl;
}
export function getAuthority(region, tenantId) {
switch (region) {
case 'gcchigh':
case 'dod':
return `https://login.microsoftonline.us/${tenantId || 'organizations'}`;
case 'mooncake':
return `https://login.partner.microsoftonline.cn/${tenantId || 'organizations'}`;
default:
return `https://login.microsoftonline.com/${tenantId || 'organizations'}`;
}
}
function _getBaseUrl(region) {
switch (region) {
case 'dev':
return 'https://apps.dev.powerapps.com';
case 'test':
return 'https://apps.test.powerapps.com';
case 'preprod':
return 'https://apps.preprod.powerapps.com';
case 'preview':
return 'https://apps.preview.powerapps.com';
case 'prod':
return 'https://apps.powerapps.com';
case 'gccmoderate':
return 'https://apps.gov.powerapps.us';
case 'gcchigh':
return 'https://apps.high.powerapps.us';
case 'dod':
return 'https://play.apps.appsplatform.us';
case 'mooncake':
return 'https://apps.powerapps.cn';
default:
return '';
}
}
//# sourceMappingURL=CliUtils.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CliUtils.js","sourceRoot":"","sources":["../src/CliUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAGhC;IACC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrB,YAAY,CAAC,8BAA8B,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAGnC;IACC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrB,YAAY,CAAC,8BAA8B,CAAC,C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AClF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAA0B,EAAE,QAA4B;IACnF,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,KAAK;YACR,OAAO,oCAAoC,QAAQ,IAAI,eAAe,EAAE,CAAC;QAC3E,KAAK,UAAU;YACb,OAAO,4CAA4C,QAAQ,IAAI,eAAe,EAAE,CAAC;QACnF;YACE,OAAO,qCAAqC,QAAQ,IAAI,eAAe,EAAE,CAAC;IAC9E,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,MAAc;IACjC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,KAAK;YACR,OAAO,gCAAgC,CAAC;QAC1C,KAAK,MAAM;YACT,OAAO,iCAAiC,CAAC;QAC3C,KAAK,SAAS;YACZ,OAAO,oCAAoC,CAAC;QAC9C,KAAK,SAAS;YACZ,OAAO,oCAAoC,CAAC;QAC9C,KAAK,MAAM;YACT,OAAO,4BAA4B,CAAC;QACtC,KAAK,aAAa;YAChB,OAAO,+BAA+B,CAAC;QACzC,KAAK,SAAS;YACZ,OAAO,gCAAgC,CAAC;QAC1C,KAAK,KAAK;YACR,OAAO,mCAAmC,CAAC;QAC7C,KAAK,UAAU;YACb,OAAO,2BAA2B,CAAC;QACrC;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export declare const APP_CONFIG_FILE = "power.config.json";
export declare const WORKING_DIRECTORY: string;
export declare const CLI_CONFIG_DIRECTORY: string;
export declare const AUTH_CACHE_DIRECTORY: string;
export declare const MS_CLIENT_REQUESTID = "x-ms-client-request-id";
export declare const USER_SETTINGS_FILE = "userSettings.json";
//# sourceMappingURL=Constants.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,eAAO,MAAM,eAAe,sBAAsB,CAAC;AACnD,eAAO,MAAM,iBAAiB,QAAiD,CAAC;AAChF,eAAO,MAAM,oBAAoB,QAA4C,CAAC;AAC9E,eAAO,MAAM,oBAAoB,QAAmD,CAAC;AACrF,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,kBAAkB,sBAAsB,CAAC"}
@@ -0,0 +1,12 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import * as os from 'os';
import * as path from 'path';
export const APP_CONFIG_FILE = 'power.config.json';
export const WORKING_DIRECTORY = process.env.WORKING_DIRECTORY || process.cwd();
export const CLI_CONFIG_DIRECTORY = path.join(os.homedir(), '.powerapps-cli');
export const AUTH_CACHE_DIRECTORY = path.join(CLI_CONFIG_DIRECTORY, 'cache', 'auth');
export const MS_CLIENT_REQUESTID = 'x-ms-client-request-id';
export const USER_SETTINGS_FILE = 'userSettings.json';
//# sourceMappingURL=Constants.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AAChF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACrF,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,179 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export declare const HelpStrings: {
Global: {
ProgramDescription: string;
Cloud: string;
EnvironmentId: string;
};
Verbs: {
'Add-data-source': {
Description: string;
Options: {
ApiId: string;
ConnectionId: string;
ConnectionRef: string;
ResourceName: string;
Dataset: string;
OrgUrl: string;
SqlStoredProcedure: string;
SolutionId: string;
};
Examples: string[];
};
'Delete-data-source': {
Description: string;
Options: {
ApiId: string;
DataSourceName: string;
SqlStoredProcedure: string;
Force: string;
};
Examples: string[];
};
'Refresh-data-source': {
Description: string;
Options: {
DataSourceName: string;
};
Examples: string[];
};
'Add-dataverse-api': {
Description: string;
Options: {
ApiName: string;
};
Examples: string[];
};
'Create-connection': {
Description: string;
Options: {
ApiId: string;
DisplayName: string;
};
Examples: string[];
};
'Find-dataverse-api': {
Description: string;
Options: {
SearchTerm: string;
};
Examples: string[];
};
Init: {
Description: string;
Options: {
EnvironmentId: string;
Cloud: string;
DisplayName: string;
Description: string;
BuildPath: string;
FileEntryPoint: string;
AppUrl: string;
LogoPath: string;
};
Examples: string[];
};
'List-codeapps': {
Description: string;
Examples: string[];
};
'List-connection-references': {
Description: string;
Options: {
SolutionId: string;
};
Examples: string[];
};
'List-connections': {
Description: string;
Options: {
Search: string;
};
Examples: string[];
};
'List-datasets': {
Description: string;
Options: {
ApiId: string;
ConnectionId: string;
};
Examples: string[];
};
'List-environment-variables': {
Description: string;
Examples: string[];
};
'List-flows': {
Description: string;
Options: {
Search: string;
};
Examples: string[];
};
'Add-flow': {
Description: string;
Options: {
FlowId: string;
};
Examples: string[];
};
'Remove-flow': {
Description: string;
Options: {
FlowDataSourceName: string;
FlowId: string;
};
Examples: string[];
};
'List-sqlStoredProcedures': {
Description: string;
Options: {
ConnectionId: string;
Dataset: string;
};
Examples: string[];
};
'List-tables': {
Description: string;
Options: {
ApiId: string;
ConnectionId: string;
Dataset: string;
};
Examples: string[];
};
Logout: {
Description: string;
Examples: string[];
};
Push: {
Description: string;
Options: {
SolutionName: string;
};
Examples: string[];
};
Run: {
Description: string;
Options: {
Port: string;
LocalAppUrl: string;
};
Examples: string[];
};
Telemetry: {
Description: string;
Options: {
Enable: string;
Disable: string;
ShowSettings: string;
ConsoleOnly: string;
OutputToConsole: string;
};
Examples: string[];
};
};
};
//# sourceMappingURL=HelpStrings.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"HelpStrings.d.ts","sourceRoot":"","sources":["../../src/Constants/HelpStrings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyOG,CAAC"}
@@ -0,0 +1,235 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export const HelpStrings = {
Global: {
ProgramDescription: 'Power Apps CLI for managing Power Apps code apps.',
Cloud: 'Cloud instance to use (e.g., prod, test, etc.).',
EnvironmentId: 'Environment ID to connect to.',
},
Verbs: {
'Add-data-source': {
Description: 'Add a data source to the current Power Apps code app.',
Options: {
ApiId: 'API identifier.',
ConnectionId: 'Connection identifier.',
ConnectionRef: 'Connection reference name.',
ResourceName: 'Table or resource name.',
Dataset: 'Dataset identifier.',
OrgUrl: 'Organization URL.',
SqlStoredProcedure: 'SQL stored procedure name.',
SolutionId: 'Solution identifier.',
},
Examples: [
'npx power-apps add-data-source --api-id dataverse --resource-name contact',
'npx power-apps add-data-source --api-id shared_sql --connection-id <id> --dataset <db> --resource-name <table>',
],
},
'Delete-data-source': {
Description: 'Remove a data source from the Power Apps code app.',
Options: {
ApiId: 'API identifier associated with the data source.',
DataSourceName: 'Data source or table name to remove.',
SqlStoredProcedure: 'SQL stored procedure name to remove.',
Force: 'Skip confirmation prompt.',
},
Examples: [
'npx power-apps delete-data-source --api-id dataverse --data-source-name contact',
'npx power-apps delete-data-source --api-id shared_sql --data-source-name <table>',
'npx power-apps delete-data-source --api-id dataverse --data-source-name contact --force',
],
},
'Refresh-data-source': {
Description: 'Refresh one or all data sources in the current Power Apps code app.',
Options: {
DataSourceName: 'Name of the specific data source to refresh. Omit to refresh all.',
},
Examples: [
'npx power-apps refresh-data-source',
'npx power-apps refresh-data-source --data-source-name contact',
'npx power-apps refresh-data-source -n contact',
],
},
'Add-dataverse-api': {
Description: 'Add a Dataverse API (action or function) to the current Power Apps code app.',
Options: {
ApiName: 'Dataverse API name to add.',
},
Examples: [
'npx power-apps add-dataverse-api --api-name msdyn_CreateOrder',
'npx power-apps add-dataverse-api --api-name WinOpportunity',
],
},
'Create-connection': {
Description: 'Create a connection for a connector. Uses silent SSO for SSO-only connectors; otherwise opens the browser to complete sign-in.',
Options: {
ApiId: 'Connector API identifier (e.g. shared_sql, dataverse, office365).',
DisplayName: 'Optional display name for the new connection.',
},
Examples: [
'npx power-apps create-connection --api-id shared_office365',
'npx power-apps create-connection --api-id shared_sql --display-name "Prod SQL"',
'npx power-apps create-connection --api-id shared_office365 --json',
],
},
'Find-dataverse-api': {
Description: 'Search Dataverse actions and functions in the environment by name.',
Options: {
SearchTerm: 'Search term to filter Dataverse operations by name.',
},
Examples: [
'npx power-apps find-dataverse-api --search "account"',
'npx power-apps find-dataverse-api --search "account" --json',
],
},
Init: {
Description: 'Initialize a new Power Apps code app.',
Options: {
EnvironmentId: 'Environment ID to connect to.',
Cloud: 'Cloud instance to use (e.g., prod, test, etc.).',
DisplayName: 'Display name for the app.',
Description: 'App description.',
BuildPath: 'Build output path (default: ./dist).',
FileEntryPoint: 'Entry point file for the app.',
AppUrl: 'Local URL where the app is hosted.',
LogoPath: 'Path to the app logo file.',
},
Examples: [
'npx power-apps init --environment-id <id> --display-name "My App"',
'npx power-apps init --cloud test --environment-id <id> --display-name "My App" --build-path ./build',
],
},
'List-codeapps': {
Description: 'List all code apps in the environment.',
Examples: ['npx power-apps list-codeapps', 'npx power-apps list-codeapps --json'],
},
'List-connection-references': {
Description: 'List all connection references in the environment.',
Options: {
SolutionId: 'Solution identifier to filter by.',
},
Examples: [
'npx power-apps list-connection-references',
'npx power-apps list-connection-references --json',
],
},
'List-connections': {
Description: 'List all connections in the active environment.',
Options: {
Search: 'Optional search term to filter connections by display name or connector ID.',
},
Examples: [
'npx power-apps list-connections',
'npx power-apps list-connections --search sharepoint',
'npx power-apps list-connections --json',
],
},
'List-datasets': {
Description: 'List all datasets for a connection.',
Options: {
ApiId: 'API identifier.',
ConnectionId: 'Connection identifier.',
},
Examples: [
'npx power-apps list-datasets --api-id shared_sql --connection-id <id>',
'npx power-apps list-datasets --api-id shared_sql --connection-id <id> --json',
],
},
'List-environment-variables': {
Description: 'List all environment variables in the environment.',
Examples: [
'npx power-apps list-environment-variables',
'npx power-apps list-environment-variables --json',
],
},
'List-flows': {
Description: 'List all solution cloud flows that are invokable from Power Apps.',
Options: {
Search: 'Filter flows by name (case-insensitive substring match)',
},
Examples: [
'npx power-apps list-flows',
'npx power-apps list-flows --search "approval" --json',
],
},
'Add-flow': {
Description: 'Add a cloud flow to the current Power Apps code app by flow ID.',
Options: {
FlowId: 'The unique identifier (GUID) of the flow to add.',
},
Examples: ['npx power-apps add-flow --flow-id 00000000-0000-0000-0000-000000000000'],
},
'Remove-flow': {
Description: 'Remove a cloud flow from the current Power Apps code app.',
Options: {
FlowDataSourceName: 'The flow data source name to remove (as it appears in power.config). Provide either this or --flow-id.',
FlowId: 'The flow resource ID (GUID) to remove — same ID used with add-flow. Provide either this or --flow-name.',
},
Examples: [
'npx power-apps remove-flow --flow-name myFlow',
'npx power-apps remove-flow --flow-id 00000000-0000-0000-0000-000000000000',
],
},
'List-sqlStoredProcedures': {
Description: 'List all SQL stored procedures for a dataset.',
Options: {
ConnectionId: 'Connection identifier.',
Dataset: 'Dataset name.',
},
Examples: [
'npx power-apps list-sqlStoredProcedures --connection-id <id> --dataset <db>',
'npx power-apps list-sqlStoredProcedures --connection-id <id> --dataset <db> --json',
],
},
'List-tables': {
Description: 'List all tables for a dataset.',
Options: {
ApiId: 'API identifier.',
ConnectionId: 'Connection identifier.',
Dataset: 'Dataset name.',
},
Examples: [
'npx power-apps list-tables --api-id shared_sql --connection-id <id> --dataset <db>',
'npx power-apps list-tables --api-id shared_sql --connection-id <id> --dataset <db> --json',
],
},
Logout: {
Description: 'Log out the current user.',
Examples: ['npx power-apps logout'],
},
Push: {
Description: 'Push the code app to the Power Apps environment.',
Options: {
SolutionName: 'Solution name to add the app to.',
},
Examples: ['npx power-apps push', 'npx power-apps push --solution-name "MySolution"'],
},
Run: {
Description: 'Run the code app locally.',
Options: {
Port: 'Port number for the local server.',
LocalAppUrl: 'Local URL where the app is hosted.',
},
Examples: [
'npx power-apps run',
'npx power-apps run --port 8080 --local-app-url http://localhost:3000',
],
},
Telemetry: {
Description: 'Manage telemetry settings.',
Options: {
Enable: 'Enable telemetry.',
Disable: 'Disable telemetry.',
ShowSettings: 'Show current telemetry settings.',
ConsoleOnly: 'Output telemetry to console only.',
OutputToConsole: 'Output telemetry to console in addition to sending it.',
},
Examples: [
'npx power-apps telemetry --show-settings',
'npx power-apps telemetry --enable',
'npx power-apps telemetry --show-settings --json',
],
},
},
};
//# sourceMappingURL=HelpStrings.js.map
@@ -0,0 +1 @@
{"version":3,"file":"HelpStrings.js","sourceRoot":"","sources":["../../src/Constants/HelpStrings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE;QACN,kBAAkB,EAAE,mDAAmD;QACvE,KAAK,EAAE,iDAAiD;QACxD,aAAa,EAAE,+BAA+B;KAC/C;IACD,KAAK,EAAE;QACL,iBAAiB,EAAE;YACjB,WAAW,EAAE,uDAAuD;YACpE,OAAO,EAAE;gBACP,KAAK,EAAE,iB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oB;gBAC7B,YAAY,EAAE,kCAAkC;gBAChD,WAAW,EAAE,mCAAmC;gBAChD,eAAe,EAAE,wDAAwD;aAC1E;YACD,QAAQ,EAAE;gBACR,0CAA0C;gBAC1C,mCAAmC;gBACnC,iDAAiD;aAClD;SACF;KACF;CACwB,CAAC"}
@@ -0,0 +1,85 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
/**
* Metadata for each CLI verb used to generate help output
*/
export interface VerbMetadata {
description: string;
}
/**
* Central registry of all CLI verbs with their descriptions.
* This array is used to generate the verb table in --help output.
*
* IMPORTANT: When adding a new verb, you must:
* 1. Add to Verb type in Cli.types.ts
* 2. Add case to executeVerb() switch in Cli.ts
* 3. Add entry to this VERB_REGISTRY array
* 4. Add entry to HelpStrings.Verbs in HelpStrings.ts
*/
export declare const VERB_HELP_REGISTRY: {
init: {
description: string;
};
push: {
description: string;
};
run: {
description: string;
};
'add-data-source': {
description: string;
};
'add-dataverse-api': {
description: string;
};
'create-connection': {
description: string;
};
'find-dataverse-api': {
description: string;
};
'list-codeapps': {
description: string;
};
'list-datasets': {
description: string;
};
'list-tables': {
description: string;
};
'list-sqlStoredProcedures': {
description: string;
};
'delete-data-source': {
description: string;
};
'list-environment-variables': {
description: string;
};
'list-connection-references': {
description: string;
};
'list-connections': {
description: string;
};
'list-flows': {
description: string;
};
'add-flow': {
description: string;
};
'remove-flow': {
description: string;
};
'refresh-data-source': {
description: string;
};
logout: {
description: string;
};
telemetry: {
description: string;
};
};
//# sourceMappingURL=VerbRegistry.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"VerbRegistry.d.ts","sourceRoot":"","sources":["../../src/Constants/VerbRegistry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCU,CAAC"}
@@ -0,0 +1,48 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { HelpStrings } from './HelpStrings.js';
/**
* Central registry of all CLI verbs with their descriptions.
* This array is used to generate the verb table in --help output.
*
* IMPORTANT: When adding a new verb, you must:
* 1. Add to Verb type in Cli.types.ts
* 2. Add case to executeVerb() switch in Cli.ts
* 3. Add entry to this VERB_REGISTRY array
* 4. Add entry to HelpStrings.Verbs in HelpStrings.ts
*/
export const VERB_HELP_REGISTRY = {
init: { description: HelpStrings.Verbs.Init.Description },
push: { description: HelpStrings.Verbs.Push.Description },
run: { description: HelpStrings.Verbs.Run.Description },
'add-data-source': { description: HelpStrings.Verbs['Add-data-source'].Description },
'add-dataverse-api': {
description: HelpStrings.Verbs['Add-dataverse-api'].Description,
},
'create-connection': { description: HelpStrings.Verbs['Create-connection'].Description },
'find-dataverse-api': {
description: HelpStrings.Verbs['Find-dataverse-api'].Description,
},
'list-codeapps': { description: HelpStrings.Verbs['List-codeapps'].Description },
'list-datasets': { description: HelpStrings.Verbs['List-datasets'].Description },
'list-tables': { description: HelpStrings.Verbs['List-tables'].Description },
'list-sqlStoredProcedures': {
description: HelpStrings.Verbs['List-sqlStoredProcedures'].Description,
},
'delete-data-source': { description: HelpStrings.Verbs['Delete-data-source'].Description },
'list-environment-variables': {
description: HelpStrings.Verbs['List-environment-variables'].Description,
},
'list-connection-references': {
description: HelpStrings.Verbs['List-connection-references'].Description,
},
'list-connections': { description: HelpStrings.Verbs['List-connections'].Description },
'list-flows': { description: HelpStrings.Verbs['List-flows'].Description },
'add-flow': { description: HelpStrings.Verbs['Add-flow'].Description },
'remove-flow': { description: HelpStrings.Verbs['Remove-flow'].Description },
'refresh-data-source': { description: HelpStrings.Verbs['Refresh-data-source'].Description },
logout: { description: HelpStrings.Verbs.Logout.Description },
telemetry: { description: HelpStrings.Verbs.Telemetry.Description },
};
//# sourceMappingURL=VerbRegistry.js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AE,EAAE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,WAAW,EAAE;IAC1F,4BAA4B,EAAE;QAC5B,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,WAAW;KACzE;IACD,4BAA4B,EAAE;QAC5B,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,WAAW;KACzE;IACD,kBAAkB,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,WAAW,EAAE;IACtF,YAAY,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE;IAC1E,UAAU,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE;IACtE,aAAa,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE;IAC5E,qBAAqB,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,WAAW,EAAE;IAC5F,MAAM,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;IAC7D,SAAS,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;CAC5B,CAAC"}
@@ -0,0 +1,11 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export declare class CliError extends Error {
readonly exitCode: number;
constructor(message: string, exitCode?: number);
}
export declare class UsageError extends CliError {
constructor(message: string);
}
//# sourceMappingURL=CliError.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"CliError.d.ts","sourceRoot":"","sources":["../../src/Errors/CliError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,QAAS,SAAQ,KAAK;aAGf,QAAQ,EAAE,MAAM;gBADhC,OAAO,EAAE,MAAM,EACC,QAAQ,GAAE,MAAU;CAIvC;AAED,qBAAa,UAAW,SAAQ,QAAQ;gBAC1B,OAAO,EAAE,MAAM;CAG5B"}
@@ -0,0 +1,16 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export class CliError extends Error {
exitCode;
constructor(message, exitCode = 1) {
super(message);
this.exitCode = exitCode;
}
}
export class UsageError extends CliError {
constructor(message) {
super(message, 2);
}
}
//# sourceMappingURL=CliError.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CliError.js","sourceRoot":"","sources":["../../src/Errors/CliError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGf;IAFlB,YACE,OAAe,EACC,WAAmB,CAAC;QAEpC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,aAAQ,GAAR,QAAQ,CAAY;IAGtC,CAAC;CACF;AAED,MAAM,OAAO,UAAW,SAAQ,QAAQ;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,41 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { Vfs, VfsConfig, VfsFileStats, WriteFileOptions } from '@microsoft/power-apps-actions';
export declare class CliFS implements Vfs {
private readonly cwd;
constructor(config: VfsConfig);
rmdir(dirPath: string): Promise<void>;
/**
* Normalize and resolve a path within the VFS context
*/
private normalizePath;
/**
* Validate path for read access
*/
private validateReadPath;
/**
* Validate path for write access
*/
private validateWritePath;
getCwd(): string;
getAbsolutePath(relativePath: string): string;
readFile(inputPath: string, encoding?: BufferEncoding): Promise<string>;
writeFile(inputPath: string, content: string, options?: WriteFileOptions): Promise<void>;
appendFile(inputPath: string, content: string): Promise<void>;
readdir(inputPath: string): Promise<string[]>;
mkdir(inputPath: string, options?: {
recursive?: boolean;
}): Promise<void>;
exists(inputPath: string): Promise<boolean>;
stat(inputPath: string): Promise<VfsFileStats>;
isFile(inputPath: string): Promise<boolean>;
isDirectory(inputPath: string): Promise<boolean>;
resolve(...paths: string[]): string;
join(...paths: string[]): string;
relative(from: string, to: string): string;
basename(inputPath: string): string;
dirname(inputPath: string): string;
unlink(inputPath: string): Promise<void>;
}
//# sourceMappingURL=CliFs.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"CliFs.d.ts","sourceRoot":"","sources":["../../src/FS/CliFs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIpG,qBAAa,KAAM,YAAW,GAAG;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,MAAM,EAAE,SAAS;IAQhB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlD;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAQlB,MAAM,IAAI,MAAM;IAIhB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAIvC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBhF,SAAS,CACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAeH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7D,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAM7C,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAY3C,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAa9C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK3C,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMtD,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAInC,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAIhC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM;IAI1C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAInC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIlC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIhD"}
@@ -0,0 +1,136 @@
import fs from 'fs';
import path from 'path';
export class CliFS {
cwd;
constructor(config) {
// Normalize and validate cwd
this.cwd = path.resolve(config.cwd);
if (!fs.existsSync(this.cwd)) {
throw new Error(`Current working directory does not exist: ${this.cwd}`);
}
}
async rmdir(dirPath) {
const normalizedPath = this.validateWritePath(dirPath);
await fs.promises.rm(normalizedPath, { recursive: true });
}
/**
* Normalize and resolve a path within the VFS context
*/
normalizePath(inputPath) {
if (path.isAbsolute(inputPath)) {
return path.resolve(inputPath);
}
return path.resolve(this.cwd, inputPath);
}
/**
* Validate path for read access
*/
validateReadPath(inputPath) {
const normalizedPath = this.normalizePath(inputPath);
return normalizedPath;
}
/**
* Validate path for write access
*/
validateWritePath(inputPath) {
const normalizedPath = this.normalizePath(inputPath);
return normalizedPath;
}
// VFS Interface Implementation
getCwd() {
return this.cwd;
}
getAbsolutePath(relativePath) {
return this.normalizePath(relativePath);
}
async readFile(inputPath, encoding = 'utf-8') {
const normalizedPath = this.validateReadPath(inputPath);
try {
return await fs.promises.readFile(normalizedPath, encoding);
}
catch (error) {
if (error instanceof Error) {
if (error.code === 'ENOENT') {
throw new Error(`File not found: ${normalizedPath}`);
}
throw new Error(`Failed to read file: ${error.message}`);
}
throw new Error('Unknown error occurred while reading file');
}
}
async writeFile(inputPath, content, options = {}) {
const normalizedPath = this.validateWritePath(inputPath);
const { createDirectories = true, encoding = 'utf-8' } = options;
// Create parent directories if needed
if (createDirectories) {
const parentDir = path.dirname(normalizedPath);
if (!fs.existsSync(parentDir)) {
await fs.promises.mkdir(parentDir, { recursive: true });
}
}
await fs.promises.writeFile(normalizedPath, content, { encoding });
}
async appendFile(inputPath, content) {
const normalizedPath = this.validateWritePath(inputPath);
await fs.promises.appendFile(normalizedPath, content, 'utf-8');
}
async readdir(inputPath) {
const normalizedPath = this.validateReadPath(inputPath);
return await fs.promises.readdir(normalizedPath);
}
async mkdir(inputPath, options = {}) {
const normalizedPath = this.validateWritePath(inputPath);
await fs.promises.mkdir(normalizedPath, options);
}
async exists(inputPath) {
const normalizedPath = this.normalizePath(inputPath);
// Don't check permissions for existence checks - just normalize the path
try {
await fs.promises.stat(normalizedPath);
return true;
}
catch {
return false;
}
}
async stat(inputPath) {
const normalizedPath = this.validateReadPath(inputPath);
const stats = await fs.promises.stat(normalizedPath);
return {
isFile: () => stats.isFile(),
isDirectory: () => stats.isDirectory(),
size: stats.size,
mtime: stats.mtime,
ctime: stats.ctime,
};
}
async isFile(inputPath) {
const stats = await this.stat(inputPath);
return stats.isFile();
}
async isDirectory(inputPath) {
const stats = await this.stat(inputPath);
return stats.isDirectory();
}
// Path operation methods (delegate to Node.js path module)
resolve(...paths) {
return path.resolve(...paths);
}
join(...paths) {
return path.join(...paths);
}
relative(from, to) {
return path.relative(from, to);
}
basename(inputPath) {
return path.basename(inputPath);
}
dirname(inputPath) {
return path.dirname(inputPath);
}
unlink(inputPath) {
const normalizedPath = this.validateWritePath(inputPath);
return fs.promises.unlink(normalizedPath);
}
}
//# sourceMappingURL=CliFs.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CliFs.js","sourceRoot":"","sources":["../../src/FS/CliFs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,OAAO,KAAK;IACC,GAAG,CAAS;IAE7B,YAAY,MAAiB;QAC3B,6BAA6B;QAC7B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,OAAe;QAChC,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,SAAiB;QACrC,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,SAAiB;QACxC,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAErD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;OAEG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IAClC,CAAC;IAEM,OAAO,CAAC,SAAiB;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,SAAiB;QAC7B,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACzD,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;CACF"}
@@ -0,0 +1,22 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { IHttpClient, RequestConfig, Response as HttpClientResponse } from '@microsoft/power-apps-actions';
import type { IAuthenticationProvider } from '../Types/Cli.types.js';
export declare class CliHttpClient implements IHttpClient {
private _authenticationProvider;
private _inflight;
private _spinner;
constructor(_authenticationProvider: IAuthenticationProvider);
get<T = unknown>(url: string, config?: RequestConfig): Promise<HttpClientResponse<T>>;
post<T = unknown>(url: string, config?: RequestConfig): Promise<HttpClientResponse<T>>;
patch<T = unknown>(url: string, config?: RequestConfig): Promise<HttpClientResponse<T>>;
put<T = unknown>(url: string, config?: RequestConfig): Promise<HttpClientResponse<T>>;
delete<T = unknown>(url: string, config?: RequestConfig): Promise<HttpClientResponse<T>>;
private _sendRequestAsync;
private _startSpinner;
private _stopSpinner;
private _parseResponse;
private _transformHeaders;
}
//# sourceMappingURL=CliHttpClient.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"CliHttpClient.d.ts","sourceRoot":"","sources":["../../src/HttpClient/CliHttpClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,QAAQ,IAAI,kBAAkB,EAC/B,MAAM,+BAA+B,CAAC;AAKvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAIlE,qBAAa,aAAc,YAAW,WAAW;IAInC,OAAO,CAAC,uBAAuB;IAH3C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,QAAQ,CAAoB;gBAEhB,uBAAuB,EAAE,uBAAuB;IAEvD,GAAG,CAAC,CAAC,GAAG,OAAO,EAC1B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAGpB,IAAI,CAAC,CAAC,GAAG,OAAO,EAC3B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAGpB,KAAK,CAAC,CAAC,GAAG,OAAO,EAC5B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAGpB,GAAG,CAAC,CAAC,GAAG,OAAO,EAC1B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAGpB,MAAM,CAAC,CAAC,GAAG,OAAO,EAC7B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;YAInB,iBAAiB;IAiE/B,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,YAAY;YAON,cAAc;YAkBd,iBAAiB;CAOhC"}
@@ -0,0 +1,115 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { randomUUID } from 'crypto';
import { getSettings } from '../CliSettings.js';
import { MS_CLIENT_REQUESTID } from '../Constants.js';
import { enhanceNetworkError } from '../Utils/EnhanceNetworkError.js';
import { CliSpinner } from '../Utils/Spinner.js';
export class CliHttpClient {
_authenticationProvider;
_inflight = 0;
_spinner = new CliSpinner();
constructor(_authenticationProvider) {
this._authenticationProvider = _authenticationProvider;
}
async get(url, config) {
return this._sendRequestAsync(url, 'GET', config);
}
async post(url, config) {
return this._sendRequestAsync(url, 'POST', config);
}
async patch(url, config) {
return this._sendRequestAsync(url, 'PATCH', config);
}
async put(url, config) {
return this._sendRequestAsync(url, 'PUT', config);
}
async delete(url, config) {
return this._sendRequestAsync(url, 'DELETE', config);
}
async _sendRequestAsync(url, method, config) {
this._startSpinner();
try {
const headers = config?.headers || {};
if (config?.authResource) {
const token = await this._authenticationProvider.getAccessTokenForResource(config.authResource);
headers.Authorization = `Bearer ${token}`;
}
if (!headers['Content-Type']) {
headers['Content-Type'] = 'application/json';
}
headers[MS_CLIENT_REQUESTID] = randomUUID();
// Only JSON.stringify if body is not already a string and Content-Type is JSON
let bodyContent;
if (config?.body !== undefined) {
const isJsonContentType = headers['Content-Type'] === 'application/json';
bodyContent =
typeof config.body === 'string' && !isJsonContentType
? config.body
: JSON.stringify(config.body);
}
const requestOptions = {
method,
headers,
// Only include body if it exists
body: bodyContent,
};
const response = await fetch(url, requestOptions);
if (!response.ok) {
throw new Error(`HTTP error status: ${response.status} for ${method} ${url}: ${await response.text()}`);
}
const data = await this._parseResponse(response);
return {
data,
status: response.status,
headers: await this._transformHeaders(response.headers),
};
}
catch (error) {
throw enhanceNetworkError(error, method, url);
}
finally {
this._stopSpinner();
}
}
_startSpinner() {
this._inflight++;
if (this._inflight === 1 && getSettings().interactive) {
this._spinner.start();
}
}
_stopSpinner() {
this._inflight--;
if (this._inflight === 0 && getSettings().interactive) {
this._spinner.stop();
}
}
async _parseResponse(response) {
const contentType = response.headers.get('content-type');
const responseText = await response.text();
// Handle empty responses or non-JSON content
if (!responseText || responseText.trim() === '') {
return null;
}
else if (contentType && contentType.includes('application/json')) {
try {
return JSON.parse(responseText);
}
catch (parseError) {
throw new Error(`Failed to parse JSON response: ${parseError}`);
}
}
else {
return responseText;
}
}
async _transformHeaders(headers) {
const result = {};
headers.forEach((value, key) => {
result[key] = value;
});
return result;
}
}
//# sourceMappingURL=CliHttpClient.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CliHttpClient.js","sourceRoot":"","sources":["../../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,EAAE,CAAC;YACnE,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAClC,CAAC;YAAC,OAAO,UAAU,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,kCAAkC,UAAU,EAAE,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,YAAiB,CAAC;QAC3B,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAC,OAAgB;QAC9C,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,27 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { IHttpClient, ILogger, Scenario } from '@microsoft/power-apps-actions';
import type { CliSettings, IAuthenticationProvider } from '../Types/Cli.types.js';
/**
* Logger implementation for the CLI
* The logger depends on the CLISettings, HttpClient and authenticationProvider to initialize the OneDS writer
*/
export declare class CliLogger implements ILogger {
private _telemetryWriters;
private _oneDSConfig?;
private constructor();
static create(cliSettings: CliSettings, httpClient: IHttpClient): Promise<CliLogger>;
/**
* Initialize OneDS telemetry after authentication is ready.
* Must be called after authenticationProvider.initAsync() completes.
*/
initializeTelemetry(authenticationProvider: IAuthenticationProvider): Promise<void>;
setCustomDimension(_key: string, _value: string): void;
trackActivityEvent(eventName: string, eventData?: object): void;
trackErrorEvent(eventName: string, eventData?: object): void;
trackScenario(eventName: string, eventData?: object): Scenario;
stringifyError(err: unknown): string | null | undefined;
flush(): Promise<void>;
}
//# sourceMappingURL=CliLogger.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"CliLogger.d.ts","sourceRoot":"","sources":["../../src/Logger/CliLogger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAMpF,OAAO,KAAK,EACV,WAAW,EACX,uBAAuB,EAExB,MAAM,oBAAoB,CAAC;AAqF5B;;;GAGG;AACH,qBAAa,SAAU,YAAW,OAAO;IACvC,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,YAAY,CAAC,CAOnB;IAEF,OAAO;WAIa,MAAM,CACxB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,WAAW,GACtB,OAAO,CAAC,SAAS,CAAC;IAoCrB;;;OAGG;IACU,mBAAmB,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+CzF,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAatD,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAW/D,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAW5D,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ;IAuB9D,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;IAcvD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK9B"}
@@ -0,0 +1,222 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { getEnvironmentByName, initializePlayerServices } from '@microsoft/power-apps-actions';
import { randomUUID } from 'crypto';
import packageJson from '../../package.json' with { type: 'json' };
import { printError } from '../Utils/ConsoleOutput.js';
import { ConsoleWriter } from './ConsoleWriter.js';
import { EUGeoRegions } from './Constants.js';
import { resolveUserTelemetrySettings } from './LoggerSettings.js';
import { OneDSWriter } from './OneDSWriter.js';
/**
* Utility method to create a Scenario
*
* @param {ITelemetryWriter[]} telemetryWriters
* @param {string} name
* @param {object} [data]
* @returns {Scenario}
*/
function createScenarioLogger(telemetryWriters, name, data) {
const scenarioGuid = randomUUID();
const _start = Date.now();
try {
telemetryWriters.forEach((writer) => writer.startScenario(name, { scenarioGuid, ...data, scenarioStartTime: _start }));
}
catch {
// No-op. Telemetry failures should not block CLI operations
}
const base = {
scenarioId: scenarioGuid,
complete: (completeData) => {
try {
telemetryWriters.forEach((writer) => writer.completeScenario(name, {
scenarioGuid,
elapsedTime: Date.now() - _start,
totalElapsedTime: Date.now() - _start,
...completeData,
}));
}
catch {
// No-op. Telemetry failures should not block CLI operations
}
},
failure: (failureData) => {
try {
telemetryWriters.forEach((writer) => writer.scenarioFailed(name, {
scenarioGuid,
elapsedTime: Date.now() - _start,
totalElapsedTime: Date.now() - _start,
...failureData,
}));
}
catch {
// No-op. Telemetry failures should not block CLI operations
}
},
completeWithError: (dataWithErr) => {
try {
telemetryWriters.forEach((writer) => writer.scenarioCompletedWithError(name, {
scenarioGuid,
elapsedTime: Date.now() - _start,
totalElapsedTime: Date.now() - _start,
...dataWithErr,
}));
}
catch {
// No-op. Telemetry failures should not block CLI operations
}
},
};
base._start = _start;
return base;
}
/**
* Logger implementation for the CLI
* The logger depends on the CLISettings, HttpClient and authenticationProvider to initialize the OneDS writer
*/
export class CliLogger {
_telemetryWriters = [];
_oneDSConfig;
constructor(telemetryWriters) {
this._telemetryWriters = telemetryWriters;
}
static async create(cliSettings, httpClient) {
const environmentId = cliSettings.appConfig?.environmentId;
const region = cliSettings.appConfig?.region;
const appId = cliSettings.appConfig?.appId;
const sessionId = randomUUID();
const telemetryWriters = [];
const userTelemetrySettings = resolveUserTelemetrySettings();
const addConsoleWriter = () => telemetryWriters.push(new ConsoleWriter());
if (userTelemetrySettings.consoleOnly) {
addConsoleWriter();
return new CliLogger(telemetryWriters);
}
if (userTelemetrySettings.outputToConsole) {
addConsoleWriter();
}
const instance = new CliLogger(telemetryWriters);
if (userTelemetrySettings.enabled && region && environmentId) {
// Store config for deferred initialization via initializeTelemetry()
instance._oneDSConfig = {
sessionId,
region,
environmentId,
appId,
httpClient,
cliSettings,
};
}
return instance;
}
/**
* Initialize OneDS telemetry after authentication is ready.
* Must be called after authenticationProvider.initAsync() completes.
*/
async initializeTelemetry(authenticationProvider) {
if (!this._oneDSConfig) {
return;
}
const { sessionId, region, environmentId, appId, httpClient, cliSettings } = this._oneDSConfig;
this._oneDSConfig = undefined;
try {
// Initialize player services to get environment metadata
initializePlayerServices({
httpClient,
environmentName: cliSettings.appConfig?.environmentId || 'default',
region: cliSettings.appConfig?.region || 'prod',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
});
const metadata = await getEnvironmentByName(environmentId);
let telemetryLocation = 'global';
if (metadata?.properties?.location && EUGeoRegions.has(metadata.properties.location)) {
telemetryLocation = 'eu';
}
this._telemetryWriters.push(new OneDSWriter(sessionId, region, telemetryLocation, environmentId, appId ?? '', metadata?.properties?.cluster?.geoShortName, packageJson.version, cliSettings.source));
}
catch (error) {
printError(`CliLogger: failed to initialize OneDS telemetry writer: ${String(error)}`);
}
if (authenticationProvider.getUserTenantId()) {
// At this point if the auth provider has fetched a token, we can set the tenantId dimension
this.setCustomDimension('tenantId', authenticationProvider.getUserTenantId());
}
}
setCustomDimension(_key, _value) {
try {
if (!_key || !_value) {
return;
}
this._telemetryWriters.forEach((writer) => {
writer.setCustomDimension(_key, _value);
});
}
catch {
// No-op. Telemetry failures should not block CLI operations
}
}
trackActivityEvent(eventName, eventData) {
try {
if (this._telemetryWriters.length === 0) {
return;
}
this._telemetryWriters.forEach((writer) => writer.trackActivityEvent(eventName, eventData));
}
catch {
// No-op. Telemetry failures should not block CLI operations
}
}
trackErrorEvent(eventName, eventData) {
try {
if (this._telemetryWriters.length === 0) {
return;
}
this._telemetryWriters.forEach((writer) => writer.trackErrorEvent(eventName, eventData));
}
catch {
// No-op. Telemetry failures should not block CLI operations
}
}
trackScenario(eventName, eventData) {
try {
if (this._telemetryWriters.length === 0) {
// Return a no-op scenario so callers don't have to check telemetry state
return {
scenarioId: 'disabled',
complete: () => undefined,
failure: () => undefined,
completeWithError: () => undefined,
};
}
return createScenarioLogger(this._telemetryWriters, eventName, eventData);
}
catch {
// No-op. Telemetry failures should not block CLI operations
return {
scenarioId: 'error',
complete: () => undefined,
failure: () => undefined,
completeWithError: () => undefined,
};
}
}
stringifyError(err) {
if (!err) {
return undefined;
}
if (err instanceof Error) {
return `${err.name}: ${err.message}${err.stack ? '\n' + err.stack : ''}`;
}
try {
return JSON.stringify(err);
}
catch {
return String(err);
}
}
flush() {
return Promise.all(this._telemetryWriters.map((writer) => writer.flush())).then(() => undefined);
}
}
//# sourceMappingURL=CliLogger.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,15 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { ITelemetryWriter } from '../Types/LoggerTypes.types.js';
export declare class ConsoleWriter implements ITelemetryWriter {
trackActivityEvent(eventName: string, eventData?: object): void;
trackErrorEvent(eventName: string, eventData?: object): void;
startScenario(scenarioName: string, startData?: object): void;
completeScenario(scenarioName: string, completeData?: object): void;
scenarioFailed(scenarioName: string, failureData?: object): void;
scenarioCompletedWithError(scenarioName: string, completeWithErrorData?: object): void;
flush(): void;
setCustomDimension(_key: string, _value: string): void;
}
//# sourceMappingURL=ConsoleWriter.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"ConsoleWriter.d.ts","sourceRoot":"","sources":["../../src/Logger/ConsoleWriter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAoBnE,qBAAa,aAAc,YAAW,gBAAgB;IAC7C,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAI/D,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAI5D,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAI7D,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;IAInE,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI;IAIhE,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI;IAItF,KAAK,IAAI,IAAI;IAIb,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAG9D"}
@@ -0,0 +1,45 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import chalk from 'chalk';
/* eslint-disable @typescript-eslint/no-explicit-any */
// Logger function factory
function loggerFn(color, log = console.log.bind(console)) {
return (scenarioName, ...data) => {
const time = new Date().toISOString().split('T')[1];
const prefix = `${chalk.gray(time)}: [${color(scenarioName)}]: `;
log(prefix, ...data);
};
}
const activity = loggerFn(chalk.white.bold);
const scenario = loggerFn(chalk.cyan.bold);
const error = loggerFn(chalk.red.bold, console.error.bind(console));
const warn = loggerFn(chalk.yellow.bold);
export class ConsoleWriter {
trackActivityEvent(eventName, eventData) {
activity(eventName, eventData || {});
}
trackErrorEvent(eventName, eventData) {
error(eventName, eventData || {});
}
startScenario(scenarioName, startData) {
scenario(`[scenario:start] ${scenarioName}`, startData || {});
}
completeScenario(scenarioName, completeData) {
scenario(`[scenario:complete] ${scenarioName}`, completeData || {});
}
scenarioFailed(scenarioName, failureData) {
error(`[scenario:failure] ${scenarioName}`, failureData || {});
}
scenarioCompletedWithError(scenarioName, completeWithErrorData) {
warn(`[scenario:completeWithError] ${scenarioName}`, completeWithErrorData || {});
}
flush() {
// No-op for console writer
}
setCustomDimension(_key, _value) {
// No-op for console writer
}
}
/* eslint-enable @typescript-eslint/no-explicit-any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KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,aAAa,CAAC,YAAoB,EAAE,SAAkB;QAC3D,QAAQ,CAAC,oBAAoB,YAAY,EAAE,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAEM,gBAAgB,CAAC,YAAoB,EAAE,YAAqB;QACjE,QAAQ,CAAC,uBAAuB,YAAY,EAAE,EAAE,YAAY,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;IAEM,cAAc,CAAC,YAAoB,EAAE,WAAoB;QAC9D,KAAK,CAAC,sBAAsB,YAAY,EAAE,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;IAEM,0BAA0B,CAAC,YAAoB,EAAE,qBAA8B;QACpF,IAAI,CAAC,gCAAgC,YAAY,EAAE,EAAE,qBAAqB,IAAI,EAAE,CAAC,CAAC;IACpF,CAAC;IAEM,KAAK;QACV,2BAA2B;IAC7B,CAAC;IAEM,kBAAkB,CAAC,IAAY,EAAE,MAAc;QACpD,2BAA2B;IAC7B,CAAC;CACF;AACD,sDAAsD"}
@@ -0,0 +1,6 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export type { TelemetryLocation } from '@microsoft/power-apps-common/telemetry';
export declare const EUGeoRegions: Set<string>;
//# sourceMappingURL=Constants.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/Logger/Constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,eAAO,MAAM,YAAY,aAUvB,CAAC"}
@@ -0,0 +1,15 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export const EUGeoRegions = new Set([
'europe',
'france',
'germany',
'italy',
'poland',
'norway',
'sweden',
'switzerland',
'unitedkingdom',
]);
//# sourceMappingURL=Constants.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Logger/Constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS;IAC1C,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,eAAe;CAChB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { UserTelemetrySettings } from '../Types/Cli.types.js';
/**
* Resolves the effective user telemetry settings by merging defaults, user config file, and environment overrides.
*
* Resolution priority (highest to lowest):
* 1. Environment variable overrides:
* - POWERAPPS_CLI_TELEMETRY=0/false/no/off forces `enabled: false`
* - PAC_CLI_TELEMETRY_OPTOUT or PAC CLI usersettings.json `telemetryEnabled: false` forces `enabled: false`
* 2. PowerApps CLI user settings file (~/.powerapps-cli/settings.json)
* 3. Default values: `{ enabled: true, consoleOnly: false, outputToConsole: false }`
*
* @returns Resolved telemetry configuration with enabled, consoleOnly, and outputToConsole flags
*/
export declare function resolveUserTelemetrySettings(): UserTelemetrySettings;
//# sourceMappingURL=LoggerSettings.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"LoggerSettings.d.ts","sourceRoot":"","sources":["../../src/Logger/LoggerSettings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAkEhE;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,IAAI,qBAAqB,CAiCpE"}
@@ -0,0 +1,100 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import * as fs from 'fs';
import * as path from 'path';
import { CLI_CONFIG_DIRECTORY, USER_SETTINGS_FILE } from '../Constants.js';
import { printWarning } from '../Utils/ConsoleOutput.js';
/**
* Checks if a string represents a truthy value (1, true, yes, on).
*/
function isTruthy(value) {
if (!value) {
return false;
}
const normalized = value.trim().toLowerCase();
return normalized === '1' || normalized === 'true' || normalized === 'yes' || normalized === 'on';
}
/**
* Checks if a string represents a falsy value (0, false, no, off).
*/
function isFalsy(value) {
if (!value) {
return false;
}
const normalized = value.trim().toLowerCase();
return (normalized === '0' || normalized === 'false' || normalized === 'no' || normalized === 'off');
}
/**
* Determines whether PAC CLI telemetry is enabled by checking environment variables and PAC CLI config.
*
* Checks in order:
* 1. PAC_CLI_TELEMETRY_OPTOUT environment variable (if truthy, returns false)
* 2. PAC CLI usersettings.json file in %LOCALAPPDATA%\Microsoft\PowerAppsCli
*
* @returns `false` if explicitly disabled, `true` if explicitly enabled, `undefined` if not configured
*/
function isPacCliTelemetryEnabled() {
if (isTruthy(process.env.PAC_CLI_TELEMETRY_OPTOUT)) {
return false;
}
const localAppData = process.env.LOCALAPPDATA;
if (!localAppData) {
return undefined;
}
const userSettingsPath = path.join(localAppData, 'Microsoft', 'PowerAppsCli', 'usersettings.json');
if (!fs.existsSync(userSettingsPath)) {
return undefined;
}
try {
const raw = fs.readFileSync(userSettingsPath, 'utf-8');
const parsed = JSON.parse(raw);
return typeof parsed.telemetryEnabled === 'boolean' ? parsed.telemetryEnabled : undefined;
}
catch (error) {
printWarning(`Failed to read PAC CLI telemetry settings: ${error.message}`);
return undefined;
}
}
/**
* Resolves the effective user telemetry settings by merging defaults, user config file, and environment overrides.
*
* Resolution priority (highest to lowest):
* 1. Environment variable overrides:
* - POWERAPPS_CLI_TELEMETRY=0/false/no/off forces `enabled: false`
* - PAC_CLI_TELEMETRY_OPTOUT or PAC CLI usersettings.json `telemetryEnabled: false` forces `enabled: false`
* 2. PowerApps CLI user settings file (~/.powerapps-cli/settings.json)
* 3. Default values: `{ enabled: true, consoleOnly: false, outputToConsole: false }`
*
* @returns Resolved telemetry configuration with enabled, consoleOnly, and outputToConsole flags
*/
export function resolveUserTelemetrySettings() {
const resolved = {
enabled: true,
consoleOnly: false,
outputToConsole: false,
};
const cliUserSettingsPath = path.join(CLI_CONFIG_DIRECTORY, USER_SETTINGS_FILE);
if (fs.existsSync(cliUserSettingsPath)) {
try {
const fileContents = fs.readFileSync(cliUserSettingsPath, 'utf-8');
const parsed = JSON.parse(fileContents);
resolved.enabled = parsed.enabled ?? resolved.enabled;
resolved.consoleOnly = parsed.consoleOnly ?? resolved.consoleOnly;
resolved.outputToConsole = parsed.outputToConsole ?? resolved.outputToConsole;
}
catch (error) {
printWarning(`Failed to read CLI telemetry settings: ${error.message}`);
}
}
if (process.env.POWERAPPS_CLI_TELEMETRY !== undefined &&
isFalsy(process.env.POWERAPPS_CLI_TELEMETRY)) {
resolved.enabled = false;
}
const pacCliSetting = isPacCliTelemetryEnabled();
if (typeof pacCliSetting === 'boolean' && pacCliSetting === false) {
resolved.enabled = false;
}
return resolved;
}
//# sourceMappingURL=LoggerSettings.js.map
@@ -0,0 +1 @@
{"version":3,"file":"LoggerSettings.js","sourceRoot":"","sources":["../../src/Logger/LoggerSettings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;GAEG;AACH,SAAS,QAAQ,CAAC,KAAqB;IACrC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAO,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,KAAK,IAAI,UAAU,KAAK,IAAI,CAAC;AACpG,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CAAC,KAAqB;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,K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/services';
import { type TelemetryLocation } from '@microsoft/power-apps-common/telemetry';
import type { ITelemetryWriter } from '../Types/LoggerTypes.types.js';
export declare class OneDSWriter implements ITelemetryWriter {
private _provider;
private _sequenceNumber;
constructor(sessionId: string, region: Region, telemetryLocation: TelemetryLocation, environmentId: string, appId: string, geoLocation: string | undefined, cliVersion: string, cliSource: string);
trackActivityEvent(operationName: string, eventData?: object): void;
trackErrorEvent(operationName: string, eventData?: object): void;
startScenario(scenarioName: string, startData?: object): void;
completeScenario(scenarioName: string, completeData?: object): void;
scenarioFailed(scenarioName: string, failureData?: object): void;
scenarioCompletedWithError(scenarioName: string, completeWithErrorData?: object): void;
flush(): void;
setCustomDimension(_key: string, _value: string): void;
private static readonly _EVENT_PREFIX;
private _trackEvent;
}
//# sourceMappingURL=OneDSWriter.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"OneDSWriter.d.ts","sourceRoot":"","sources":["../../src/Logger/OneDSWriter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAgBnE,qBAAa,WAAY,YAAW,gBAAgB;IAClD,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,eAAe,CAAa;gBAGlC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM;IAoDZ,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAOnE,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAOhE,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ7D,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;IASnE,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI;IAShE,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI;IAStF,KAAK,IAAI,IAAI;IAIb,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAI7D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAEvD,OAAO,CAAC,WAAW;CA0BpB"}
@@ -0,0 +1,137 @@
import { OneDsTelemetryProvider, ScenarioResults, TelemetryEventNames, } from '@microsoft/power-apps-common/telemetry';
import { getScrubbedCustomDimensions } from './Scrubber/ScrubCustomDimensions.js';
function regionToClusterCategory(region) {
switch (region) {
case 'preview':
return 'prod';
case 'gccmoderate':
return 'gov';
case 'gcchigh':
return 'high';
default:
return region;
}
}
export class OneDSWriter {
_provider;
_sequenceNumber = 1;
constructor(sessionId, region, telemetryLocation, environmentId, appId, geoLocation, cliVersion, cliSource) {
const commonProperties = {
environmentId,
isOnePlayer: 'false',
webPlayerScenario: 'CodeApp_CLI_Authoring',
cloud: region === 'preview' ? 'prod' : region,
sessionStartTime: new Date().toISOString(),
station: 'Unknown',
telemetryLocation,
cliVersion,
cliSource,
};
if (appId) {
commonProperties.playerAppId = `/providers/Microsoft.PowerApps/apps/${appId}`;
}
if (geoLocation) {
commonProperties.geoLocation = geoLocation;
}
this._provider = new OneDsTelemetryProvider({
clientType: cliSource === 'pac-cli' ? 'PacCLI' : 'NodeCLI',
clusterCategory: regionToClusterCategory(region),
telemetryLocation,
commonProperties,
propertyColumnMap: {
latencyInMs: 'duration',
elapsedTime: 'duration',
updateCadence: 'updateCadence',
requestedUrl: 'url',
status: 'httpStatus',
statusCode: 'httpStatus',
},
channelConfig: {
maxEvtPerBatch: 500,
maxEventRetryAttempts: 6,
eventsLimitInMem: 10000,
},
});
this._provider.sessionId = sessionId;
// Sync 1DS session id with CLI session id in Part A extension
this._provider.addTelemetryInitializer((envelope) => {
const ext = (envelope.ext = envelope.ext ?? {});
const app = (ext.app = ext.app ?? {});
app.sesId = sessionId;
});
}
trackActivityEvent(operationName, eventData) {
this._trackEvent(TelemetryEventNames.Activity, {
...eventData,
operationName,
});
}
trackErrorEvent(operationName, eventData) {
this._trackEvent(TelemetryEventNames.Error, {
...eventData,
operationName,
});
}
startScenario(scenarioName, startData) {
this._trackEvent(TelemetryEventNames.StartScenario, {
operationName: scenarioName,
...startData,
scenarioName,
});
}
completeScenario(scenarioName, completeData) {
this._trackEvent(TelemetryEventNames.EndScenario, {
operationName: scenarioName,
...completeData,
scenarioName,
scenarioResult: ScenarioResults.Success,
});
}
scenarioFailed(scenarioName, failureData) {
this._trackEvent(TelemetryEventNames.EndScenario, {
operationName: scenarioName,
...failureData,
scenarioName,
scenarioResult: ScenarioResults.Failed,
});
}
scenarioCompletedWithError(scenarioName, completeWithErrorData) {
this._trackEvent(TelemetryEventNames.EndScenario, {
operationName: scenarioName,
...completeWithErrorData,
scenarioName,
scenarioResult: ScenarioResults.SuccessWithErrors,
});
}
flush() {
this._provider.flush();
}
setCustomDimension(_key, _value) {
this._provider.setDefaultProperty(_key, _value);
}
static _EVENT_PREFIX = 'CodeAppsCLI.';
_trackEvent(eventName, eventData) {
const operationName = eventData.operationName || '';
const scrubbed = getScrubbedCustomDimensions(eventName, operationName, eventData);
const properties = {};
for (const [key, value] of Object.entries(scrubbed)) {
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
properties[key] = value;
}
else {
properties[key] = String(value);
}
}
if (operationName) {
properties.operationName = `${OneDSWriter._EVENT_PREFIX}${operationName}`;
}
this._provider.track({
eventName,
timestamp: new Date().toISOString(),
severity: 'info',
sequenceNumber: this._sequenceNumber++,
properties,
});
}
}
//# sourceMappingURL=OneDSWriter.js.map
@@ -0,0 +1 @@
{"version":3,"file":"OneDSWriter.js","sourceRoot":"","sources":["../../src/Logger/OneDSWriter.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,mBAAmB,GAEpB,MAAM,wCAAwC,CAAC;AAIhD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,SAAS,uBAAuB,CAAC,MAAc;IAC7C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC;QAChB,KAAK,aAAa;YAChB,OAAO,KAAK,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAED,MAAM,OAAO,WAAW;IACd,SAAS,CAAyB;IAClC,eAAe,GAAW,CAAC,CAAC;IAEpC,YACE,SAAiB,EACjB,MAAc,EACd,iBAAoC,EACpC,aAAqB,EACrB,KAAa,EACb,WAA+B,EAC/B,UAAkB,EAClB,SAAiB;QAEjB,MAAM,gBAAgB,GAA2B;YAC/C,aAAa;YACb,WAAW,EAAE,OAAO;YACpB,iBAAiB,EAAE,uBAAuB;YAC1C,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;YAC7C,gBAAgB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAC1C,OAAO,EAAE,SAAS;YAClB,iBAAiB;YACjB,UAAU;YACV,SAAS;SACV,CAAC;QAEF,IAAI,KAAK,EAAE,CAAC;YACV,gBAAgB,CAAC,WAAW,GAAG,uCAAuC,KAAK,EAAE,CAAC;QAChF,CAAC;QAED,IAAI,WAAW,EAAE,CAAC;YAChB,gBAA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AM,QAAQ,GAAG,2BAA2B,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAElF,MAAM,UAAU,GAA8C,EAAE,CAAC;QACjE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;gBACzF,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YAClB,UAAU,CAAC,aAAa,GAAG,GAAG,WAAW,CAAC,aAAa,GAAG,aAAa,EAAE,CAAC;QAC5E,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YACnB,SAAS;YACT,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,QAAQ,EAAE,MAAM;YAChB,cAAc,EAAE,IAAI,CAAC,eAAe,EAAE;YACtC,UAAU;SACX,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,5 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export declare function getScrubbedCustomDimensions(eventName: string, operationName: string, customDimensions: object): object;
//# sourceMappingURL=ScrubCustomDimensions.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"ScrubCustomDimensions.d.ts","sourceRoot":"","sources":["../../../src/Logger/Scrubber/ScrubCustomDimensions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAwCR"}
@@ -0,0 +1,46 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { EventsToScrubConfig } from './ScrubCustomDimensionsConfig.js';
// note: This code is copied from powerapps-telemetry-utils package
// to avoid adding that package as a dependency to powerapps-player-cli package
// powerapps-player-cli is a published package, and powerapps-telemetry-utils is not => pa-client-build does not support this scenario yet
export function getScrubbedCustomDimensions(eventName, operationName, customDimensions) {
// To avoid the performance impact of scrubbing all events, we want to target specific events to scrub
const eventConfig = EventsToScrubConfig[eventName];
if (eventConfig) {
const scenarioName = customDimensions.scenarioName || '';
const scrubConfigList = eventConfig['*'] ||
eventConfig.operations?.[operationName] ||
eventConfig.scenarios?.[scenarioName];
if (scrubConfigList) {
let currentScrubberName;
try {
const value = JSON.stringify(customDimensions);
for (const { scrubberName, shouldScrubValue } of scrubConfigList) {
currentScrubberName = scrubberName;
if (shouldScrubValue(value)) {
return {
eventName,
operationName,
scenarioName,
scrubber: currentScrubberName,
message: '_scrubbedByPowerAppsTelemetryUtils_: Custom dimensions were scrubbed by host',
};
}
}
}
catch (error) {
return {
eventName,
operationName,
scenarioName,
scrubber: currentScrubberName,
message: '_scrubbedByPowerAppsTelemetryUtils_: Failed to parse custom dimensions while scrubbing',
};
}
}
}
return customDimensions;
}
//# sourceMappingURL=ScrubCustomDimensions.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ScrubCustomDimensions.js","sourceRoot":"","sources":["../../../src/Logger/Scrubber/ScrubCustomDimensions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,mEAAmE;AACnE,+EAA+E;AAC/E,0IAA0I;AAC1I,MAAM,UAAU,2BAA2B,CACzC,SAAiB,EACjB,aAAqB,EACrB,gBAAwB;IAExB,sGAAsG;IACtG,MAAM,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACnD,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,YAAY,GAAI,gBAA8C,CAAC,YAAY,IAAI,EAAE,CAAC;QACxF,MAAM,eAAe,GACnB,WAAW,CAAC,GAAG,CAAC;YAChB,WAAW,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC;YACvC,WAAW,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC;QACxC,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,mBAAuC,CAAC;YAC5C,IAAI,CAAC;gBACH,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;gBAC/C,KAAK,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,IAAI,eAAe,EAAE,CAAC;oBACjE,mBAAmB,GAAG,YAAY,CAAC;oBACnC,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;wBAC5B,OAAO;4BACL,SAAS;4BACT,aAAa;4BACb,YAAY;4BACZ,QAAQ,EAAE,mBAAmB;4BAC7B,OAAO,EACL,8EAA8E;yBACjF,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS;oBACT,aAAa;oBACb,YAAY;oBACZ,QAAQ,EAAE,mBAAmB;oBAC7B,OAAO,EACL,wFAAwF;iBAC3F,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,27 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export type ScrubConfig = {
scrubberName: string;
shouldScrubValue: (value: string) => boolean;
};
export type ScrubConfigList = ScrubConfig[];
export type EventConfig = {
/** When assigned, this will apply the given scrub config list if the event_Name matches */
['*']?: ScrubConfigList;
/**
* This configuration is a mapping of Record<operation_Name, ScrubConfigList>
* When assigned, any event that matches the event_Name and operation_Name will be scrubbed
*/
operations?: Record<string, ScrubConfigList>;
/**
* This configuration is a mapping of Record<scenarioName, ScrubConfigList>
* When assigned, any event that matches the event_Name and scenarioName will be scrubbed
*/
scenarios?: Record<string, ScrubConfigList>;
};
/**
* This configuration is a mapping of Record<event_Name, EventConfig>
*/
export declare const EventsToScrubConfig: Record<string, EventConfig>;
//# sourceMappingURL=ScrubCustomDimensionsConfig.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"ScrubCustomDimensionsConfig.d.ts","sourceRoot":"","sources":["../../../src/Logger/Scrubber/ScrubCustomDimensionsConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,WAAW,EAAE,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,2FAA2F;IAC3F,CAAC,GAAG,CAAC,CAAC,EAAE,eAAe,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC7C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC7C,CAAC;AAyBF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CA8I3D,CAAC"}
@@ -0,0 +1,168 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import { containsEmail, containsGoogleApiKey, containsSasKeySig, containsSymmKey256, } from './ScrubUtils.js';
const EmailScrubConfig = {
scrubberName: 'email',
shouldScrubValue: containsEmail,
};
const GoogleApiKeyScrubConfig = {
scrubberName: 'googleApiKey',
shouldScrubValue: containsGoogleApiKey,
};
const SasKeySigScrubConfig = {
scrubberName: 'sasKeySig',
shouldScrubValue: containsSasKeySig,
};
const SymmKey256ScrubConfig = {
scrubberName: 'symmKey256',
shouldScrubValue: containsSymmKey256,
};
/** A scrub config list for handling events with sas keys. Currently this just scrubs the sig */
const SasKeyScrubConfigList = [SasKeySigScrubConfig];
/**
* This configuration is a mapping of Record<event_Name, EventConfig>
*/
export const EventsToScrubConfig = {
'AppHostClientSDK.getCanvasAppMetadataAsync': {
'*': SasKeyScrubConfigList,
},
'AppModuleMetadataProvider.getCanvasAppMetadataAsync.Failure': {
'*': SasKeyScrubConfigList,
},
'AppModuleMetadataProvider.getRootAppMetadataAsync.Failure': {
'*': SasKeyScrubConfigList,
},
CustomPageInlineRendering: {
'*': SasKeyScrubConfigList,
},
'DefaultCanvasAppContainer.renderAsync': {
'*': SasKeyScrubConfigList,
},
'FilePluginService.GetFileOrDirectory': {
'*': SasKeyScrubConfigList,
},
'Player.CanvasAppGlue.openErrorDialog': {
'*': SasKeyScrubConfigList,
},
'PlayerCordovaPlugin.onPluginRequestFailure': {
'*': SasKeyScrubConfigList,
},
'PowerAppsClient.Activity': {
operations: {
'App.disposeAsync': SasKeyScrubConfigList,
'GlobalControlProperty.setModelValueInternal': SasKeyScrubConfigList,
'IDataRuntime.reportRuntimeError': SasKeyScrubConfigList,
'IDataRuntime.tryCreateGatedReportRuntimeError': [
GoogleApiKeyScrubConfig,
SasKeySigScrubConfig,
],
'PassThroughWebUriResolver.getAsBinaryAsync': SasKeyScrubConfigList,
'PerEndpointRetryPipeline._xhrWithRetryAsync': SasKeyScrubConfigList,
'Player.AppCatalog.GetAppDetailByIDSuccess': SasKeyScrubConfigList,
'Player.CanvasAppGlue.exitAppHost': SasKeyScrubConfigList,
'Player.CustomBranding.RPResponse': SasKeyScrubConfigList,
'Player.CustomBranding.Save': SasKeyScrubConfigList,
'Player.PublishedApp.Open.AppInfo': SasKeyScrubConfigList,
'Player.PublishedApp.WebServer.Start': SasKeyScrubConfigList,
'PlayerLifecycle.WebPlayer.Play.ErrorPage': SasKeyScrubConfigList,
'PowerAppsClient.PcfComponent.Failure': SasKeyScrubConfigList,
'PowerAppsClient.Performance.PerformanceObserver': SasKeyScrubConfigList,
'PowerAppsEmbedding.Automation.Player': SasKeyScrubConfigList,
'CachedQueryDataProvider._onDataDownloaded': [EmailScrubConfig],
'CachedQueryDataProvider._getDataForExpiredCacheAsync': [EmailScrubConfig],
},
},
'PowerAppsClient.AllApps.App.DismissedWithError': {
'*': SasKeyScrubConfigList,
},
'PowerAppsClient.App.GalleryPagingManagerError': {
'*': SasKeyScrubConfigList,
},
'PowerAppsClient.ControlsActivity': {
operations: {
'Attachments.OnView': SasKeyScrubConfigList,
},
},
'PowerAppsClient.EndScenario': {
scenarios: {
'PowerAppsClient.Scenario.ContextLoadApp': SasKeyScrubConfigList,
'PowerAppsClient.Scenario.DocumentVmInitialize': SasKeyScrubConfigList,
'PowerAppsClient.Scenario.ScreenCreation': SasKeyScrubConfigList,
'PlayerLifecycle.PlayerSDK.PlayApp.LoadApp.CreateAppFrame': SasKeyScrubConfigList,
'PlayerLifecycle.PlayerSDK.PlayApp.LoadApp': SasKeyScrubConfigList,
'PlayerLifecycle.PlayerSDK.PlayApp.LoadMetadata.FetchAppPackageMetadata': SasKeyScrubConfigList,
'PlayerLifecycle.PlayerSDK.PlayApp': SasKeyScrubConfigList,
'PlayerLifecycle.WebPlayer.Play.PlayApp': SasKeyScrubConfigList,
'PlayerLifecycle.WebPlayer.Play': SasKeyScrubConfigList,
'PowerAppsClient.Scenario.CachedQueryDataProviderNotify': [EmailScrubConfig],
},
},
'PowerAppsClient.Error': {
operations: {
'AppInfoParser.parseAppInfo': SasKeyScrubConfigList,
'AppLifecyclePlugin.notifyAppFailed': SasKeyScrubConfigList,
'AttachmentsView._viewItem': SasKeyScrubConfigList,
'BaseWebPlayerHost._onAppFailure': SasKeyScrubConfigList,
'Context.loadAppAsync': SasKeyScrubConfigList,
'DocumentViewModel.initializeAsync': SasKeyScrubConfigList,
'GeneratedCode.ReportAndContinue': SasKeyScrubConfigList,
'MediaRuntime.getMediaAsBinaryAsync': SasKeyScrubConfigList,
'NestedAppModuleMetadataProvider.getCanvasAppMetadataAsync.Failure': SasKeyScrubConfigList,
'Player.SessionSummary.Failure': SasKeyScrubConfigList,
'PlayerLaunchService.playerLaunchAppAsync': SasKeyScrubConfigList,
'PlayerPublishedApp._onInitializationError': SasKeyScrubConfigList,
'PowerAppsClient.PublishedApp.ErrorLoadingScript': SasKeyScrubConfigList,
'PublishedAppHostActions.handleErrorDuringInstall': SasKeyScrubConfigList,
'PublishedAppInstance.runAllScreensInitFnsAsync': SasKeyScrubConfigList,
'RNSendHttpPipeline._performXhrRequestAsync': [SymmKey256ScrubConfig],
'RequirementsManager.loadRequirement': SasKeyScrubConfigList,
'runtimebase._onCallFailed': SasKeyScrubConfigList,
'Text._validateTextWithCharacters': SasKeyScrubConfigList,
'Url.constructor': SasKeyScrubConfigList,
},
},
'PowerAppsClient.Functions.InternalError': {
'*': SasKeyScrubConfigList,
},
'PowerAppsClient.MessageDialog.Dismissed': {
operations: {
'Studio.Reducers.STUDIO_UPDATE_CONNECTION_TABLES_LOADING_ERROR_INFO': SasKeyScrubConfigList,
},
},
'PowerAppsClient.MessageDialog.ShowAsync': {
operations: {
'Studio.Reducers.STUDIO_UPDATE_CONNECTION_TABLES_LOADING_ERROR_INFO': SasKeyScrubConfigList,
},
},
'PowerAppsClient.StartScenario': {
scenarios: {
'PowerAppsClient.Scenario.CachedQueryDataProviderNotify': [EmailScrubConfig],
},
},
'PowerAppsClient.Verbose': {
operations: {
'ReactRedux.HandleActionsWithReset': SasKeyScrubConfigList,
},
},
'PowerAppsClient.WebPlayer.Load': {
operations: {
'PowerAppsClient._notifyAppFailed': SasKeyScrubConfigList,
'PowerAppsClient.AppDetailsRetriever._getAppDetailsInternal.Failure': SasKeyScrubConfigList,
'PowerAppsClient.ResourcePathResolution': SasKeyScrubConfigList,
},
},
'PublishedAppLoader.ScriptError': {
operations: {
'GlobalErrorHandler:UnhandledError': SasKeyScrubConfigList,
'PowerAppsClient.AppDetailsRetriever._getAppDetailsInternal.Failure': SasKeyScrubConfigList,
},
},
'RuntimeTelemetry.logException': {
'*': SasKeyScrubConfigList,
},
'TestOrchestrator.setupTestsAsync': {
'*': SasKeyScrubConfigList,
},
};
//# sourceMappingURL=ScrubCustomDimensionsConfig.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ScrubCustomDimensionsConfig.js","sourceRoot":"","sources":["../../../src/Logger/Scrubber/ScrubCustomDimensionsConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAwBtB,MAAM,gBAAgB,GAAgB;IACpC,YAAY,EAAE,OAAO;IACrB,gBAAgB,EAAE,aAAa;CAChC,CAAC;AAEF,MAAM,uBAAuB,GAAgB;IAC3C,YAAY,EAAE,cAAc;IAC5B,gBAAgB,EAAE,oBAAoB;CACvC,CAAC;AAEF,MAAM,oBAAoB,GAAgB;IACxC,YAAY,EAAE,WAAW;IACzB,gBAAgB,EAAE,iBAAiB;CACpC,CAAC;AAEF,MAAM,qBAAqB,GAAgB;IACzC,YAAY,EAAE,YAAY;IAC1B,gBAAgB,EAAE,kBAAkB;CACrC,CAAC;AAEF,gGAAgG;AAChG,MAAM,qBAAqB,GAAoB,CAAC,oBAAoB,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAgC;IAC9D,4CAA4C,EAAE;QAC5C,GAAG,EAAE,qBAAqB;KAC3B;IACD,6DAA6D,EAAE;QAC7D,GAAG,EAAE,qBAAqB;KAC3B;IACD,2DAA2D,EAAE;QAC3D,GAAG,EAAE,qBAAqB;KAC3B;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,qBAAqB;KAC3B;IACD,uCAAuC,EAAE;QACvC,GAAG,EAAE,qBAAqB;KAC3B;IACD,sCAAsC,EAAE;QACtC,GAAG,EAAE,qBAAqB;KAC3B;IACD,sCAAsC,EAAE;QACtC,GAAG,EAAE,qBAAqB;KAC3B;IACD,4CAA4C,EAAE;QAC5C,GAAG,EAAE,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,GAAG,EAAE,qBAAqB;KAC3B;IACD,kCAAkC,EAAE;QAClC,GAAG,EAAE,qBAAqB;KAC3B;CACF,CAAC"}
@@ -0,0 +1,8 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export declare function containsEmail(value: string): boolean;
export declare function containsGoogleApiKey(value: string): boolean;
export declare function containsSasKeySig(value: string): boolean;
export declare function containsSymmKey256(value: string): boolean;
//# sourceMappingURL=ScrubUtils.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"ScrubUtils.d.ts","sourceRoot":"","sources":["../../../src/Logger/Scrubber/ScrubUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAyBH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD"}
@@ -0,0 +1,34 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
// These values should align with cred scan: https://msazure.visualstudio.com/One/_git/SecEng-CredScan-Core?path=/KnowledgeBase/Prefilter/CredScan-Kusto-UDF.kql
const GoogleApiKeyRegex = /AIza[a-z0-9_\\-]{35}/i;
const SymmKey256Regex = /[a-z0-9\/+]{43}=/i; // eslint-disable-line no-useless-escape
// Regex adapted from CredScan:
// https://dev.azure.com/msazure/One/_git/SecEng-CredScan-Core?path=/KnowledgeBase/samples/CredScanClientHelloWorld/Security.SharedStrings.Internal.txt&version=GC0612bfb7be3c3f60b1896992118f1a110013320d&line=225&lineEnd=226&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
// Modifications from original:
// 1. Converted from PCRE to JS regex
// 2. Replaced named captures with non-capturing groups
// 3. Remove the URL and just leave the sig=
// 4. Add _ and & to the negated char (handles sig=_scrubbedSensitiveData_)
// 5. Require 8 characters after the sig= (handles things like sig=43chars)
const SasKeyRegex = /(?:dsas_secret|sig)=[^#\)\(<>\r\n\s'",\\_&]{8}/i; // eslint-disable-line no-useless-escape
// RFC 6530 spec https://tools.ietf.org/html/rfc6530
// A nice set of test cases: http://isemail.info/_system/is_email/test/?all
// How to compile ranges of Unicode characters that are likely to be used in email addresses: http://apps.timwhitlock.info/js/regex
/* eslint-disable no-misleading-character-class, no-useless-escape */
const emailRegExp = new RegExp(/[a-zA-Z0-9\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF\.!#$%&'*+?^_{|}~\-\d]+(@|%40)[a-zA-Z0-9\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF\-\.\d]+\.[a-zA-Z\u0080-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF\u1000-\u109F\u10A0-\u10FF\u1100-\u11FF\u1200-\u137F\u1380-\u139F\u13A0-\u13FF\u1400-\u167F\u1680-\u169F\u16A0-\u16FF\u1700-\u171F\u1720-\u173F\u1740-\u175F\u1760-\u177F\u1780-\u17FF\u1800-\u18AF\u1900-\u194F\u1950-\u197F\u1980-\u19DF\u19E0-\u19FF\u1A00-\u1A1F\u1B00-\u1B7F\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u1E00-\u1EFF\u1F00-\u1FFF\u20D0-\u20FF\u2100-\u214F\u2C00-\u2C5F\u2C60-\u2C7F\u2C80-\u2CFF\u2D00-\u2D2F\u2D30-\u2D7F\u2D80-\u2DDF\u2F00-\u2FDF\u2FF0-\u2FFF\u3040-\u309F\u30A0-\u30FF\u3100-\u312F\u3130-\u318F\u3190-\u319F\u31C0-\u31EF\u31F0-\u31FF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FFF\uA000-\uA48F\uA490-\uA4CF\uA700-\uA71F\uA800-\uA82F\uA840-\uA87F\uAC00-\uD7AF\uF900-\uFAFF]{2,63}/);
/* eslint-enable no-misleading-character-class, no-useless-escape */
export function containsEmail(value) {
return emailRegExp.test(value);
}
export function containsGoogleApiKey(value) {
return GoogleApiKeyRegex.test(value);
}
export function containsSasKeySig(value) {
return SasKeyRegex.test(value);
}
export function containsSymmKey256(value) {
return SymmKey256Regex.test(value);
}
//# sourceMappingURL=ScrubUtils.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ScrubUtils.js","sourceRoot":"","sources":["../../../src/Logger/Scrubber/ScrubUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gKAAgK;AAChK,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAClD,MAAM,eAAe,GAAG,mBAAmB,CAAC,CAAC,wCAAwC;AAErF,+BAA+B;AAC/B,6RAA6R;AAC7R,+BAA+B;AAC/B,qCAAqC;AACrC,uDAAuD;AACvD,4CAA4C;AAC5C,2EAA2E;AAC3E,2EAA2E;AAC3E,MAAM,WAAW,GAAG,iDAAiD,CAAC,CAAC,wCAAwC;AAE/G,qDAAqD;AACrD,2EAA2E;AAC3E,mIAAmI;AACnI,qEAAqE;AACrE,MAAM,WAAW,GAAG,IAAI,MAAM,CAC5B,ivGAAivG,CAClvG,CAAC;AACF,oEAAoE;AAEpE,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,20 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export type DefaultStringOption = CliOption & {
message: string;
initialValue?: string;
};
export type Flags = {
key: string;
alias?: string;
};
export interface CliOption<T = unknown> {
flags: Flags;
env: string;
description?: string;
default?: T;
customPrompt?: () => Promise<T>;
optionalInNonInteractive?: boolean;
}
//# sourceMappingURL=Argument.types.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Argument.types.d.ts","sourceRoot":"","sources":["../../src/Types/Argument.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACpC,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAGhC,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC"}
@@ -0,0 +1,5 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export {};
//# sourceMappingURL=Argument.types.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Argument.types.js","sourceRoot":"","sources":["../../src/Types/Argument.types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,35 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
import type { PowerAppsRepoConfig } from '@microsoft/power-apps-actions';
import type { Region } from '@microsoft/power-apps-common/services';
import type { ArgumentProvider } from '../ArgumentProvider.js';
import type { CliFS } from '../FS/CliFs.js';
export interface IAuthenticationProvider {
initAsync(region: Region): Promise<void>;
getAccessTokenForResource(resource: string): Promise<string>;
getUserTenantId(): string | undefined;
}
export type Verb = 'init' | 'push' | 'run' | 'add-data-source' | 'add-dataverse-api' | 'create-connection' | 'find-dataverse-api' | 'list-codeapps' | 'list-datasets' | 'list-tables' | 'list-sqlStoredProcedures' | 'delete-data-source' | 'list-environment-variables' | 'list-connection-references' | 'list-connections' | 'list-flows' | 'add-flow' | 'remove-flow' | 'refresh-data-source' | 'logout' | 'telemetry';
export type CliSettings = {
source: 'pac-cli' | 'standalone';
interactive: boolean;
fileConfig: LocalFilePaths;
cliFs: CliFS;
appConfig?: PowerAppsRepoConfig;
};
export type LocalFilePaths = {
powerConfigPath: string;
schemaPath: string;
codeGenPath: string;
};
export type ExecuteVerbConfig = {
verb: Verb;
argumentProvider: ArgumentProvider;
};
export type UserTelemetrySettings = {
enabled: boolean;
consoleOnly: boolean;
outputToConsole: boolean;
};
//# sourceMappingURL=Cli.types.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Cli.types.d.ts","sourceRoot":"","sources":["../../src/Types/Cli.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,eAAe,IAAI,MAAM,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,MAAM,IAAI,GACZ,MAAM,GACN,MAAM,GACN,KAAK,GACL,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,eAAe,GACf,aAAa,GACb,0BAA0B,GAC1B,oBAAoB,GACpB,4BAA4B,GAC5B,4BAA4B,GAC5B,kBAAkB,GAClB,YAAY,GACZ,UAAU,GACV,aAAa,GACb,qBAAqB,GACrB,QAAQ,GACR,WAAW,CAAC;AAEhB,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,SAAS,GAAG,YAAY,CAAC;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,cAAc,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,mBAAmB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,5 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
export {};
//# sourceMappingURL=Cli.types.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Cli.types.js","sourceRoot":"","sources":["../../src/Types/Cli.types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,43 @@
/*!
* Copyright (C) Microsoft Corporation. All rights reserved.
*/
interface DataverseDataSource {
entitySetName: string;
logicalName: string;
isHidden: boolean;
}
interface DataSet {
dataSources: Record<string, {
tableName?: string;
}>;
datasetOverride?: {
environmentVariableName: string;
};
}
interface ConnectionReference {
id: string;
displayName: string;
dataSources: string[];
authenticationType?: string;
sharedConnectionId?: string;
dataSets?: Record<string, DataSet>;
xrmConnectionReferenceLogicalName?: string | undefined;
}
interface TabularMetadata {
dataset: string;
resourceName: string;
isProcedure: boolean;
friendlyName?: string;
datasetOverride?: string;
resourceNameOverride?: string;
}
interface DatabaseReference {
state: string;
instanceUrl: string;
webApiVersion: string;
dataSources: Record<string, DataverseDataSource>;
version: string;
environmentVariableName: string;
}
export type { ConnectionReference, DatabaseReference, DataSet, DataverseDataSource, TabularMetadata, };
//# sourceMappingURL=Datasource.types.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Datasource.types.d.ts","sourceRoot":"","sources":["../../src/Types/Datasource.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,UAAU,mBAAmB;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,OAAO;IACf,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,eAAe,CAAC,EAAE;QAAE,uBAAuB,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD;AAED,UAAU,mBAAmB;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,iCAAiC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxD;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,OAAO,EACP,mBAAmB,EACnB,eAAe,GAChB,CAAC"}

Some files were not shown because too many files have changed in this diff Show More