push neon reactor
This commit is contained in:
Generated
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { ServiceConfig, ServiceRegion } from './types/Services.types.js';
|
||||
export declare const getAuthResource: () => {
|
||||
test: string;
|
||||
preprod: string;
|
||||
preview: string;
|
||||
prod: string;
|
||||
gccmoderate: string;
|
||||
gcchigh: string;
|
||||
dod: string;
|
||||
mooncake: string;
|
||||
ex: string;
|
||||
rx: string;
|
||||
};
|
||||
export declare const getBapRPAuthResource: () => {
|
||||
test: string;
|
||||
preprod: string;
|
||||
preview: string;
|
||||
prod: string;
|
||||
gccmoderate: string;
|
||||
gcchigh: string;
|
||||
dod: string;
|
||||
mooncake: string;
|
||||
ex: string;
|
||||
rx: string;
|
||||
};
|
||||
export declare function getPowerPlatformApiEnvironmentConfig(authResource?: {
|
||||
[key in ServiceRegion]: string;
|
||||
}): ServiceConfig;
|
||||
//# sourceMappingURL=PowerPlatformApiUtils.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerPlatformApiUtils.d.ts","sourceRoot":"","sources":["../../src/services/PowerPlatformApiUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE3E,eAAO,MAAM,eAAe;;;;;;;;;;;CAa3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;CAahC,CAAC;AAEF,wBAAgB,oCAAoC,CAAC,YAAY,CAAC,EAAE;KACjE,GAAG,IAAI,aAAa,GAAG,MAAM;CAC/B,GAAG,aAAa,CAmBhB"}
|
||||
Generated
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import { PowerPlatformApiDiscovery, } from '@microsoft/power-apps-common/services';
|
||||
import { getPlayerServiceConfig } from './initializePlayerServices.js';
|
||||
import { getServiceConfig } from './ServiceUtils.js';
|
||||
export const getAuthResource = () => {
|
||||
return {
|
||||
test: new PowerPlatformApiDiscovery('test').getTokenAudience(),
|
||||
preprod: new PowerPlatformApiDiscovery('preprod').getTokenAudience(),
|
||||
preview: new PowerPlatformApiDiscovery('firstrelease').getTokenAudience(),
|
||||
prod: new PowerPlatformApiDiscovery('prod').getTokenAudience(),
|
||||
gccmoderate: new PowerPlatformApiDiscovery('gov').getTokenAudience(),
|
||||
gcchigh: new PowerPlatformApiDiscovery('high').getTokenAudience(),
|
||||
dod: new PowerPlatformApiDiscovery('dod').getTokenAudience(),
|
||||
mooncake: new PowerPlatformApiDiscovery('mooncake').getTokenAudience(),
|
||||
ex: new PowerPlatformApiDiscovery('ex').getTokenAudience(),
|
||||
rx: new PowerPlatformApiDiscovery('rx').getTokenAudience(),
|
||||
};
|
||||
};
|
||||
export const getBapRPAuthResource = () => {
|
||||
return {
|
||||
test: 'https://service.powerapps.com/',
|
||||
preprod: 'https://service.powerapps.com/',
|
||||
preview: 'https://service.powerapps.com/',
|
||||
prod: 'https://service.powerapps.com/',
|
||||
gccmoderate: 'https://gov.service.powerapps.us/',
|
||||
gcchigh: 'https://high.service.powerapps.us/',
|
||||
dod: 'https://service.apps.appsplatform.us/',
|
||||
mooncake: 'https://service.powerapps.cn/',
|
||||
ex: 'https://service.powerapps.eaglex.ic.gov/',
|
||||
rx: 'https://service.powerapps.microsoft.scloud/',
|
||||
};
|
||||
};
|
||||
export function getPowerPlatformApiEnvironmentConfig(authResource) {
|
||||
const { environmentName } = getPlayerServiceConfig();
|
||||
return getServiceConfig({
|
||||
endpoint: {
|
||||
test: new PowerPlatformApiDiscovery('test').getEnvironmentEndpoint(environmentName),
|
||||
preprod: new PowerPlatformApiDiscovery('preprod').getEnvironmentEndpoint(environmentName),
|
||||
preview: new PowerPlatformApiDiscovery('firstrelease').getEnvironmentEndpoint(environmentName),
|
||||
prod: new PowerPlatformApiDiscovery('prod').getEnvironmentEndpoint(environmentName),
|
||||
gccmoderate: new PowerPlatformApiDiscovery('gov').getEnvironmentEndpoint(environmentName),
|
||||
gcchigh: new PowerPlatformApiDiscovery('high').getEnvironmentEndpoint(environmentName),
|
||||
dod: new PowerPlatformApiDiscovery('dod').getEnvironmentEndpoint(environmentName),
|
||||
mooncake: new PowerPlatformApiDiscovery('mooncake').getEnvironmentEndpoint(environmentName),
|
||||
ex: new PowerPlatformApiDiscovery('ex').getEnvironmentEndpoint(environmentName),
|
||||
rx: new PowerPlatformApiDiscovery('rx').getEnvironmentEndpoint(environmentName),
|
||||
},
|
||||
authResource: authResource || getAuthResource(),
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=PowerPlatformApiUtils.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerPlatformApiUtils.js","sourceRoot":"","sources":["../../src/services/PowerPlatformApiUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,yBAAyB,GAC1B,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,OAAO;QACL,IAAI,EAAE,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC,gBAAgB,EAAE;QAC9D,OAAO,EAAE,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC,gBAAgB,EAAE;QACpE,OAAO,EAAE,IAAI,yBAAyB,CAAC,cAAc,CAAC,CAAC,gBAAgB,EAAE;QACzE,IAAI,EAAE,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC,gBAAgB,EAAE;QAC9D,WAAW,EAAE,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE;QACpE,OAAO,EAAE,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC,gBAAgB,EAAE;QACjE,GAAG,EAAE,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE;QAC5D,QAAQ,EAAE,IAAI,yBAAyB,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE;QACtE,EAAE,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE;QAC1D,EAAE,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE;KAClB,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,OAAO;QACL,IAAI,EAAE,gCAAgC;QACtC,OAAO,EAAE,gCAAgC;QACzC,OAAO,EAAE,gCAAgC;QACzC,IAAI,EAAE,gCAAgC;QACtC,WAAW,EAAE,mCAAmC;QAChD,OAAO,EAAE,oCAAoC;QAC7C,GAAG,EAAE,uCAAuC;QAC5C,QAAQ,EAAE,+BAA+B;QACzC,EAAE,EAAE,0CAA0C;QAC9C,EAAE,EAAE,6CAA6C;KACT,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,UAAU,oCAAoC,CAAC,YAEpD;IACC,MAAM,EAAE,eAAe,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACrD,OAAO,gBAAgB,CAAC;QACtB,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;YACnF,OAAO,EAAE,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;YACzF,OAAO,EAAE,IAAI,yBAAyB,CAAC,cAAc,CAAC,CAAC,sBAAsB,CAC3E,eAAe,CAChB;YACD,IAAI,EAAE,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;YACnF,WAAW,EAAE,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;YACzF,OAAO,EAAE,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;YACtF,GAAG,EAAE,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;YACjF,QAAQ,EAAE,IAAI,yBAAyB,CAAC,UAAU,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;YAC3F,EAAE,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;YAC/E,EAAE,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC;SAChF;QACD,YAAY,EAAE,YAAY,IAAI,eAAe,EAAE;KAChD,CAAC,CAAC;AACL,CAAC"}
|
||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { ServiceConfig, ServiceDefinition } from './types/Services.types.js';
|
||||
export declare function getServiceConfig(serviceDefinition: ServiceDefinition): ServiceConfig;
|
||||
//# sourceMappingURL=ServiceUtils.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ServiceUtils.d.ts","sourceRoot":"","sources":["../../src/services/ServiceUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,wBAAgB,gBAAgB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,aAAa,CAQpF"}
|
||||
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import { getPlayerServiceConfig } from './initializePlayerServices.js';
|
||||
export function getServiceConfig(serviceDefinition) {
|
||||
const { region } = getPlayerServiceConfig();
|
||||
const serviceRegion = region === 'local' || region === 'dev' ? 'test' : region;
|
||||
return {
|
||||
endpoint: serviceDefinition.endpoint[serviceRegion],
|
||||
authResource: serviceDefinition.authResource[serviceRegion],
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=ServiceUtils.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ServiceUtils.js","sourceRoot":"","sources":["../../src/services/ServiceUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,MAAM,UAAU,gBAAgB,CAAC,iBAAoC;IACnE,MAAM,EAAE,MAAM,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAC5C,MAAM,aAAa,GAAG,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAE/E,OAAO;QACL,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,CAAC,aAAa,CAAC;QACnD,YAAY,EAAE,iBAAiB,CAAC,YAAY,CAAC,aAAa,CAAC;KAC5D,CAAC;AACJ,CAAC"}
|
||||
Generated
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { IAuthenticationProvider } from '../../Types/PlayerActions.types.js';
|
||||
import type { Api, Connection } from '../types/ApiTypes.js';
|
||||
import type { ILogger } from '../types/PlayerServices.types.js';
|
||||
export declare function isEncoded(str: string): boolean;
|
||||
export declare function isDoubleEncoded(str: string): boolean;
|
||||
export declare function ensureEncoded(str: string): string;
|
||||
export interface IConnectedDataset {
|
||||
Name: string;
|
||||
DisplayName: string;
|
||||
Categories?: string[];
|
||||
}
|
||||
export interface IConnectedDatasetListMetadata {
|
||||
value: IConnectedDataset[];
|
||||
}
|
||||
export interface IConnectedDataTable {
|
||||
Name: string;
|
||||
DisplayName: string;
|
||||
Categories?: string[];
|
||||
Type?: string;
|
||||
}
|
||||
export interface IConnectedDataTableListMetadata {
|
||||
value: IConnectedDataTable[];
|
||||
}
|
||||
export declare function getResourceMetadataAsync(connection: Connection, connector: Api, dataset: string, resourceName: string, resourceType: string, logger: ILogger): Promise<unknown>;
|
||||
export declare function getDatasetsAsync(connection: Connection, connector: Api, logger: ILogger): Promise<IConnectedDatasetListMetadata>;
|
||||
export declare function getTablesAsync(connection: Connection, connector: Api, dataset: string, logger: ILogger): Promise<IConnectedDataTableListMetadata>;
|
||||
export declare function getSqlStoredProceduresAsync(connection: Connection, connector: Api, dataset: string, logger: ILogger): Promise<IConnectedDataTableListMetadata>;
|
||||
export declare function getSqlStoredProcedureMetadataAsync(connection: Connection, connector: Api, dataset: string, storedProcedure: string, logger: ILogger): Promise<unknown>;
|
||||
export declare function getTableMetadataAsync(connection: Connection, connector: Api, dataset: string, tableName: string, logger: ILogger): Promise<unknown>;
|
||||
/**
|
||||
* Returns the tabular API version string for a connector (e.g. 'v2', or '' for v1).
|
||||
* Determined by the highest-numbered production revision of the CDPTabular interface.
|
||||
*/
|
||||
export declare function getTabularConnectorVersion(connector: Api): string;
|
||||
/**
|
||||
* Handles the first party login step of connection creation by POSTing the OBO token to the
|
||||
* provided firstPartyLoginUri.
|
||||
*
|
||||
* Calls httpClient.post with no authResource so that the underlying HTTP client omits the
|
||||
* Authorization header — the consent server rejects requests that carry one. The token is sent
|
||||
* only in the request body as { accessToken }.
|
||||
*/
|
||||
export declare function connectionFirstPartyLoginAsync(authProvider: IAuthenticationProvider, firstPartyLoginUri: string, logger: ILogger): Promise<void>;
|
||||
/**
|
||||
* Verifies the connection is live by calling the server-provided test link.
|
||||
*
|
||||
* The connection PUT/GET response includes `properties.testLinks`, an array of
|
||||
* `{ requestUri, method }` entries owned by the API Hub runtime. We invoke the
|
||||
* first entry, using the API Hub bearer audience for the current region.
|
||||
*/
|
||||
export declare function testConnectionAsync(connection: Connection, logger?: ILogger): Promise<void>;
|
||||
//# sourceMappingURL=ApimService.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApimService.d.ts","sourceRoot":"","sources":["../../../src/services/connectivity/ApimService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAqB7D,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAM9C;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQpD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAuBjD;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AACD,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,mBAAmB,EAAE,CAAC;CAC9B;AAoCD,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,OAAO,CAAC,CAoClB;AAED,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,EACd,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,6BAA6B,CAAC,CAqCxC;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,+BAA+B,CAAC,CA4C1C;AAED,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,+BAA+B,CAAC,CAqC1C;AAED,wBAAsB,kCAAkC,CACtD,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,OAAO,CAAC,CASlB;AAED,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,OAAO,CAAC,CAElB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,GAAG,GAAG,MAAM,CAOjE;AAED;;;;;;;GAOG;AACH,wBAAsB,8BAA8B,CAClD,YAAY,EAAE,uBAAuB,EACrC,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA4CjG"}
|
||||
Generated
Vendored
+334
@@ -0,0 +1,334 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import { getPlayerServiceConfig } from '../initializePlayerServices.js';
|
||||
const apiHubResourceMap = {
|
||||
local: 'https://apihub.azure.com',
|
||||
dev: 'https://apihub.azure.com',
|
||||
test: 'https://apihub.azure.com',
|
||||
preprod: 'https://apihub.azure.com',
|
||||
preview: 'https://apihub.azure.com',
|
||||
prod: 'https://apihub.azure.com',
|
||||
gccmoderate: 'https://power-apis-usgov001-public.azure-apihub.us',
|
||||
gcchigh: 'https://power-apis-usgov001-sovereign.azure-apihub.us',
|
||||
dod: 'https://power-apis-usdod-001.azure-apihub.us',
|
||||
mooncake: 'https://china.azure-apihub.cn/',
|
||||
ex: 'https://azure-apihub.eaglex.ic.gov',
|
||||
rx: 'https://azure-apihub.microsoft.scloud',
|
||||
};
|
||||
function getApiHubResource(region) {
|
||||
return apiHubResourceMap[region];
|
||||
}
|
||||
export function isEncoded(str) {
|
||||
try {
|
||||
return decodeURIComponent(str) !== str;
|
||||
}
|
||||
catch {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
export function isDoubleEncoded(str) {
|
||||
try {
|
||||
const decodedOnce = decodeURIComponent(str);
|
||||
const decodedTwice = decodeURIComponent(decodedOnce);
|
||||
return str !== decodedOnce && decodedOnce !== decodedTwice;
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export function ensureEncoded(str) {
|
||||
if (str.includes(',')) {
|
||||
const parts = str.split(',');
|
||||
return parts
|
||||
.map((part) => {
|
||||
if (isDoubleEncoded(part)) {
|
||||
return part;
|
||||
}
|
||||
else if (isEncoded(part)) {
|
||||
return encodeURIComponent(part);
|
||||
}
|
||||
else {
|
||||
return encodeURIComponent(encodeURIComponent(part));
|
||||
}
|
||||
})
|
||||
.join(',');
|
||||
}
|
||||
if (isDoubleEncoded(str)) {
|
||||
return str;
|
||||
}
|
||||
else if (isEncoded(str)) {
|
||||
return encodeURIComponent(str);
|
||||
}
|
||||
else {
|
||||
return encodeURIComponent(encodeURIComponent(str));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the baseUrl of the highest-numbered production CDPTabular1 revision, or null if none exists.
|
||||
*/
|
||||
function getLatestCdpTabularBaseUrl(connector) {
|
||||
const cdpTabular1 = connector.properties.interfaces?.CDPTabular1;
|
||||
if (!cdpTabular1) {
|
||||
return null;
|
||||
}
|
||||
const prodRevisions = Object.entries(cdpTabular1.revisions)
|
||||
.filter(([, rev]) => rev.status === 'Production')
|
||||
.map(([version, rev]) => ({ version: parseInt(version, 10), rev }))
|
||||
.sort((a, b) => b.version - a.version);
|
||||
return prodRevisions.length > 0 ? prodRevisions[0].rev.baseUrl : null;
|
||||
}
|
||||
function getRuntimeRequestUrl(connector, connection) {
|
||||
const baseUrl = getLatestCdpTabularBaseUrl(connector);
|
||||
if (baseUrl === null) {
|
||||
throw new Error("No production revisions found for the 'CDPTabular1' interface in the connector's interfaces.");
|
||||
}
|
||||
const urlString = connector.properties.primaryRuntimeUrl.replace(/\/+$/, '');
|
||||
const connectionNameTrimmed = connection.name.replace(/\/+$/, '');
|
||||
const revisionTrimmed = baseUrl.replace(/^\/+|\/+$/g, '');
|
||||
return revisionTrimmed
|
||||
? `${urlString}/${connectionNameTrimmed}/${revisionTrimmed}`
|
||||
: `${urlString}/${connectionNameTrimmed}`;
|
||||
}
|
||||
export async function getResourceMetadataAsync(connection, connector, dataset, resourceName, resourceType, logger) {
|
||||
const scenario = logger.trackScenario('ApimService.GetResourceMetadataAsync', {
|
||||
connectionId: connection.id,
|
||||
apiId: connector.id,
|
||||
apiName: connector.name,
|
||||
dataset,
|
||||
resourceName,
|
||||
resourceType,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { httpClient, region } = getPlayerServiceConfig();
|
||||
const authResource = getApiHubResource(region);
|
||||
let url = getRuntimeRequestUrl(connector, connection);
|
||||
const safeDataset = ensureEncoded(dataset);
|
||||
const safeResourceName = ensureEncoded(resourceName);
|
||||
url += `/$metadata.json/datasets/${safeDataset}/${resourceType}/${safeResourceName}`;
|
||||
additionalScenarioData = { url, authResource };
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
if (response.status === 200) {
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
export async function getDatasetsAsync(connection, connector, logger) {
|
||||
const { httpClient, region } = getPlayerServiceConfig();
|
||||
const authResource = getApiHubResource(region);
|
||||
const scenario = logger.trackScenario('ApimService.GetDatasetsAsync', {
|
||||
connectionId: connection.id,
|
||||
connectionName: connection.name,
|
||||
connectionType: connection.type,
|
||||
apiName: connector.name,
|
||||
apiId: connector.id,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
let url = getRuntimeRequestUrl(connector, connection);
|
||||
url += `/datasets`;
|
||||
additionalScenarioData = { url, authResource };
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
if (response.status === 200) {
|
||||
scenario.complete();
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
let errorMessage = `Failed to get datasets for connection '${connection.name}' and connector '${connector.name}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
export async function getTablesAsync(connection, connector, dataset, logger) {
|
||||
if (!connection || !connector || !dataset) {
|
||||
throw new Error('Connection, connector, and dataset are required parameters');
|
||||
}
|
||||
const scenario = logger.trackScenario('ApimService.GetTablesAsync', {
|
||||
connectionId: connection.id,
|
||||
connectionName: connection.name,
|
||||
apiId: connector.id,
|
||||
apiName: connector.name,
|
||||
dataset,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { httpClient, region } = getPlayerServiceConfig();
|
||||
const authResource = getApiHubResource(region);
|
||||
let url = getRuntimeRequestUrl(connector, connection);
|
||||
const tablePath = connector.name.toLowerCase() === 'shared_sharepointonline' ? 'allTables' : 'tables';
|
||||
const safeDataset = ensureEncoded(dataset);
|
||||
url += `/datasets/${safeDataset}/${tablePath}`;
|
||||
additionalScenarioData = { url, authResource };
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
if (response.status === 200) {
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
let errorMessage = `Failed to get tables for connection '${connection.name}' and connector '${connector.name}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
export async function getSqlStoredProceduresAsync(connection, connector, dataset, logger) {
|
||||
const { httpClient, region } = getPlayerServiceConfig();
|
||||
const authResource = getApiHubResource(region);
|
||||
const scenario = logger.trackScenario('ApimService.GetSqlStoredProceduresAsync', {
|
||||
connectionId: connection.id,
|
||||
connectionName: connection.name,
|
||||
apiId: connector.id,
|
||||
apiName: connector.name,
|
||||
dataset,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
let url = getRuntimeRequestUrl(connector, connection);
|
||||
const safeDataset = ensureEncoded(dataset);
|
||||
url += `/datasets/${safeDataset}/procedures`;
|
||||
additionalScenarioData = { url, authResource };
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
if (response.status === 200) {
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
let errorMessage = `Failed to get stored procedures for connection '${connection.name}' and connector '${connector.name}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
export async function getSqlStoredProcedureMetadataAsync(connection, connector, dataset, storedProcedure, logger) {
|
||||
return getResourceMetadataAsync(connection, connector, dataset, storedProcedure, 'procedures', logger);
|
||||
}
|
||||
export async function getTableMetadataAsync(connection, connector, dataset, tableName, logger) {
|
||||
return getResourceMetadataAsync(connection, connector, dataset, tableName, 'tables', logger);
|
||||
}
|
||||
/**
|
||||
* Returns the tabular API version string for a connector (e.g. 'v2', or '' for v1).
|
||||
* Determined by the highest-numbered production revision of the CDPTabular interface.
|
||||
*/
|
||||
export function getTabularConnectorVersion(connector) {
|
||||
const latestBaseUrl = getLatestCdpTabularBaseUrl(connector);
|
||||
if (latestBaseUrl === null) {
|
||||
return '';
|
||||
}
|
||||
const match = latestBaseUrl.match(/\/(v\d+)/);
|
||||
return match ? match[1] : '';
|
||||
}
|
||||
/**
|
||||
* Handles the first party login step of connection creation by POSTing the OBO token to the
|
||||
* provided firstPartyLoginUri.
|
||||
*
|
||||
* Calls httpClient.post with no authResource so that the underlying HTTP client omits the
|
||||
* Authorization header — the consent server rejects requests that carry one. The token is sent
|
||||
* only in the request body as { accessToken }.
|
||||
*/
|
||||
export async function connectionFirstPartyLoginAsync(authProvider, firstPartyLoginUri, logger) {
|
||||
const scenario = logger.trackScenario('ApimService.ConnectionFirstPartyLoginAsync');
|
||||
const { httpClient, region } = getPlayerServiceConfig();
|
||||
const authResource = getApiHubResource(region);
|
||||
const consentToken = await authProvider.getAccessTokenForResource(authResource);
|
||||
// No authResource → CliHttpClient omits the Authorization header.
|
||||
// The consent server expects only { accessToken } in the body and rejects requests
|
||||
// that carry an Authorization header.
|
||||
const response = await httpClient.post(firstPartyLoginUri, {
|
||||
body: { accessToken: consentToken },
|
||||
});
|
||||
if (response.status < 200 || response.status >= 300) {
|
||||
const error = new Error(`First-party OBO authentication failed: HTTP ${response.status}`);
|
||||
scenario.failure({ error, status: response.status });
|
||||
throw error;
|
||||
}
|
||||
scenario.complete({ status: response.status });
|
||||
}
|
||||
/**
|
||||
* Verifies the connection is live by calling the server-provided test link.
|
||||
*
|
||||
* The connection PUT/GET response includes `properties.testLinks`, an array of
|
||||
* `{ requestUri, method }` entries owned by the API Hub runtime. We invoke the
|
||||
* first entry, using the API Hub bearer audience for the current region.
|
||||
*/
|
||||
export async function testConnectionAsync(connection, logger) {
|
||||
const scenario = logger?.trackScenario('TestConnectionAsync', {
|
||||
connectionId: connection.id,
|
||||
});
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const testLink = connection.properties.testLinks?.[0];
|
||||
if (!testLink?.requestUri) {
|
||||
throw new Error(`Connection '${connection.id}' did not return a testLinks entry — ` +
|
||||
`cannot verify the connection.`);
|
||||
}
|
||||
const { httpClient, region } = getPlayerServiceConfig();
|
||||
const authResource = getApiHubResource(region);
|
||||
const url = testLink.requestUri;
|
||||
const method = (testLink.method ?? 'GET').toUpperCase();
|
||||
additionalScenarioData = { url, method, authResource };
|
||||
let response;
|
||||
if (method === 'GET') {
|
||||
response = await httpClient.get(url, { authResource });
|
||||
}
|
||||
else if (method === 'POST') {
|
||||
response = await httpClient.post(url, { authResource });
|
||||
}
|
||||
else {
|
||||
throw new Error(`Connection '${connection.id}' testLinks entry has unsupported method '${testLink.method}'; ` +
|
||||
`expected 'GET' or 'POST'.`);
|
||||
}
|
||||
additionalScenarioData.status = response.status;
|
||||
if (response.status !== 200 && response.status !== 204) {
|
||||
scenario?.completeWithError(additionalScenarioData);
|
||||
throw new Error(`Connection test failed for connection '${connection.id}': HTTP ${response.status}`);
|
||||
}
|
||||
scenario?.complete(additionalScenarioData);
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ApimService.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { Api, Connection } from '../types/ApiTypes.js';
|
||||
import type { ILogger } from '../types/PlayerServices.types.js';
|
||||
export declare function getConnectorAsync(connectorId: string, logger?: ILogger): Promise<Api>;
|
||||
export declare function getConnectionByNameAsync(connectionName: string, connectorId: string, logger?: ILogger): Promise<Connection | undefined>;
|
||||
export declare function listConnectionsForConnectorAsync(connectorId: string, logger?: ILogger): Promise<Connection[]>;
|
||||
export declare function listAllConnectionsAsync(search?: string, logger?: ILogger): Promise<Connection[]>;
|
||||
export declare function isConnectionShareable(connector: Api, authType: string | undefined): boolean;
|
||||
/**
|
||||
* Creates a new connection via PUT to the connectivity API.
|
||||
*
|
||||
* When `ssoSetName` is provided (from `validateSsoEligible`), the body uses
|
||||
* `connectionParametersSet: { name, values: {} }` — required for connectors that
|
||||
* use `connectionParameterSets` (e.g. SQL). Otherwise falls back to
|
||||
* `connectionParameters: {}` for flat-parameter connectors (e.g. Office 365).
|
||||
*/
|
||||
export declare function putConnectionAsync(connectorId: string, connectionId: string, displayName: string, logger?: ILogger, ssoSetName?: string | null): Promise<Connection>;
|
||||
/**
|
||||
* Deletes a connection. Used to clean up orphaned connections when a
|
||||
* later step of the creation flow fails.
|
||||
*/
|
||||
export declare function deleteConnectionAsync(connectorId: string, connectionId: string, logger?: ILogger): Promise<void>;
|
||||
/**
|
||||
* Validates that a connector is eligible for silent SSO connection creation.
|
||||
*
|
||||
* When `connectionParameterSets` is present, it takes precedence over
|
||||
* `connectionParameters`. The function returns the name of the first
|
||||
* SSO-eligible set, or throws if none qualifies.
|
||||
*
|
||||
* When only `connectionParameters` is present, the same two-condition check
|
||||
* applies. Returns `null` to signal "use flat connectionParameters".
|
||||
*
|
||||
* @returns The name of the SSO-eligible `connectionParameterSet` to use, or
|
||||
* `null` if the connector uses flat `connectionParameters`.
|
||||
*/
|
||||
export declare function validateSsoEligible(connector: Api, connectorId: string): string | null;
|
||||
/**
|
||||
* Checks whether a connector supports SSO as its *only* authentication type.
|
||||
* Returns `true` when the connector has a single auth type (or flat params)
|
||||
* that is SSO-eligible. Returns `false` if there are multiple auth types
|
||||
* (even if one is SSO-capable) — in that case the user should choose
|
||||
* interactively.
|
||||
*/
|
||||
export declare function isSsoOnlyConnector(connector: Api): boolean;
|
||||
//# sourceMappingURL=ConnectivityService.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ConnectivityService.d.ts","sourceRoot":"","sources":["../../../src/services/connectivity/ConnectivityService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAiC,MAAM,mBAAmB,CAAC;AAExF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAuB3F;AAED,wBAAsB,wBAAwB,CAC5C,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAwBjC;AAED,wBAAsB,gCAAgC,CACpD,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,UAAU,EAAE,CAAC,CAmBvB;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,UAAU,EAAE,CAAC,CAyCvB;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAU3F;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,EAChB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,UAAU,CAAC,CAiCrB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAgBf;AA+BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsBtF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAa1D"}
|
||||
Generated
Vendored
+268
@@ -0,0 +1,268 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import { getPlayerServiceConfig } from '../initializePlayerServices.js';
|
||||
import { getPowerPlatformApiEnvironmentConfig } from '../PowerPlatformApiUtils.js';
|
||||
export async function getConnectorAsync(connectorId, logger) {
|
||||
const scenario = logger?.trackScenario('GetConnectorAsync', {
|
||||
connectorId,
|
||||
});
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const { httpClient, environmentName } = getPlayerServiceConfig();
|
||||
const url = `https://${endpoint}/connectivity/connectors/${connectorId}?api-version=1&$filter=environment+eq+'${environmentName}'`;
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
additionalScenarioData = { url, authResource, status: response.status };
|
||||
if (response.status === 200) {
|
||||
scenario?.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
scenario?.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
export async function getConnectionByNameAsync(connectionName, connectorId, logger) {
|
||||
const scenario = logger?.trackScenario('GetConnectionByNameAsync', {
|
||||
connectionName,
|
||||
connectorId,
|
||||
});
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const { httpClient, environmentName } = getPlayerServiceConfig();
|
||||
const url = `https://${endpoint}/connectivity/connectors/${connectorId}/connections/${connectionName}?api-version=1&$filter=environment+eq+'${environmentName}'`;
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
additionalScenarioData = { url, authResource, status: response.status };
|
||||
if (response.status === 200) {
|
||||
scenario?.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
scenario?.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
export async function listConnectionsForConnectorAsync(connectorId, logger) {
|
||||
const scenario = logger?.trackScenario('ListConnectionsForConnectorAsync', { connectorId });
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const { httpClient, environmentName } = getPlayerServiceConfig();
|
||||
const url = `https://${endpoint}/connectivity/connectors/${connectorId}/connections?api-version=1&$filter=environment+eq+'${environmentName}'`;
|
||||
const response = await httpClient.get(url, { authResource });
|
||||
additionalScenarioData = { url, authResource, status: response.status };
|
||||
if (response.status === 200) {
|
||||
scenario?.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
scenario?.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response.data.value ?? [];
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
export async function listAllConnectionsAsync(search, logger) {
|
||||
const scenario = logger?.trackScenario('ListAllConnectionsAsync', { search });
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const { httpClient, environmentName } = getPlayerServiceConfig();
|
||||
const initialUrl = `https://${endpoint}/connectivity/connections?api-version=1&$filter=environment+eq+'${environmentName}'&%24expand=api`;
|
||||
additionalScenarioData = { url: initialUrl, authResource };
|
||||
const allConnections = [];
|
||||
let nextUrl = initialUrl;
|
||||
while (nextUrl) {
|
||||
const currentUrl = nextUrl;
|
||||
const response = await httpClient.get(currentUrl, {
|
||||
authResource,
|
||||
});
|
||||
additionalScenarioData = { url: currentUrl, authResource, status: response.status };
|
||||
if (response.status !== 200) {
|
||||
scenario?.completeWithError(additionalScenarioData);
|
||||
throw new Error(`Failed to list connections. Received status ${response.status}.`);
|
||||
}
|
||||
allConnections.push(...(response.data.value ?? []));
|
||||
nextUrl = response.data['@odata.nextLink'];
|
||||
}
|
||||
let connections = allConnections;
|
||||
if (search) {
|
||||
const lower = search.toLowerCase();
|
||||
connections = connections.filter((c) => c.properties.displayName.toLowerCase().includes(lower) ||
|
||||
c.properties.apiId.toLowerCase().includes(lower));
|
||||
}
|
||||
scenario?.complete({ ...additionalScenarioData, count: connections.length });
|
||||
return connections;
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
export function isConnectionShareable(connector, authType) {
|
||||
if (authType) {
|
||||
const paramSet = connector.properties.connectionParameterSets?.values?.find((x) => x.name === authType);
|
||||
if (paramSet) {
|
||||
return paramSet.metadata?.allowSharing ?? false;
|
||||
}
|
||||
}
|
||||
return connector.properties.metadata?.allowSharing ?? false;
|
||||
}
|
||||
/**
|
||||
* Creates a new connection via PUT to the connectivity API.
|
||||
*
|
||||
* When `ssoSetName` is provided (from `validateSsoEligible`), the body uses
|
||||
* `connectionParametersSet: { name, values: {} }` — required for connectors that
|
||||
* use `connectionParameterSets` (e.g. SQL). Otherwise falls back to
|
||||
* `connectionParameters: {}` for flat-parameter connectors (e.g. Office 365).
|
||||
*/
|
||||
export async function putConnectionAsync(connectorId, connectionId, displayName, logger, ssoSetName) {
|
||||
const scenario = logger?.trackScenario('PutConnectionAsync', { connectorId, connectionId });
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const { httpClient, environmentName } = getPlayerServiceConfig();
|
||||
const url = `https://${endpoint}/connectivity/connectors/${connectorId}/connections/${connectionId}?api-version=1&$expand=ConsentLink`;
|
||||
const connectionBody = ssoSetName
|
||||
? { connectionParametersSet: { name: ssoSetName, values: {} } }
|
||||
: { connectionParameters: {} };
|
||||
const body = {
|
||||
properties: {
|
||||
displayName,
|
||||
...connectionBody,
|
||||
environment: { name: environmentName },
|
||||
consentInfo: { redirectUrl: 'https://www.microsoft.com/' },
|
||||
},
|
||||
};
|
||||
additionalScenarioData = { url, authResource };
|
||||
const response = await httpClient.put(url, { authResource, body });
|
||||
additionalScenarioData.status = response.status;
|
||||
if (response.status !== 200 && response.status !== 201) {
|
||||
scenario?.completeWithError(additionalScenarioData);
|
||||
throw new Error(`Failed to create connection for connector '${connectorId}': HTTP ${response.status}`);
|
||||
}
|
||||
scenario?.complete(additionalScenarioData);
|
||||
return response.data;
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Deletes a connection. Used to clean up orphaned connections when a
|
||||
* later step of the creation flow fails.
|
||||
*/
|
||||
export async function deleteConnectionAsync(connectorId, connectionId, logger) {
|
||||
const scenario = logger?.trackScenario('DeleteConnectionAsync', { connectorId, connectionId });
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const { httpClient, environmentName } = getPlayerServiceConfig();
|
||||
const url = `https://${endpoint}/connectivity/connectors/${connectorId}/connections/${connectionId}` +
|
||||
`?api-version=1&$filter=environment+eq+'${environmentName}'`;
|
||||
additionalScenarioData = { url, authResource };
|
||||
const response = await httpClient.delete(url, { authResource });
|
||||
scenario?.complete({ ...additionalScenarioData, status: response.status });
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns true if the given parameter map is SSO-eligible:
|
||||
* 1. Has at least one `type === 'oauthSetting'` entry.
|
||||
* 2. That oauthSetting has `oAuthSettings.properties.IsOnbehalfofLoginSupported === true`
|
||||
* (connector must support the OBO silent token flow).
|
||||
* 3. All other entries have `uiDefinition.constraints.hidden === 'true'`
|
||||
* and `uiDefinition.constraints.required === 'false'`.
|
||||
* An empty/absent map is considered eligible (no user input needed).
|
||||
*/
|
||||
function isParamSetSsoEligible(params) {
|
||||
if (!params || Object.keys(params).length === 0)
|
||||
return true;
|
||||
const oauthParams = Object.values(params).filter((p) => p.type === 'oauthSetting');
|
||||
if (oauthParams.length === 0)
|
||||
return false;
|
||||
if (!oauthParams.some((p) => p.oAuthSettings?.properties?.IsOnbehalfofLoginSupported === true)) {
|
||||
return false;
|
||||
}
|
||||
return !Object.entries(params).some(([, p]) => {
|
||||
if (p.type === 'oauthSetting')
|
||||
return false;
|
||||
const c = p.uiDefinition?.constraints;
|
||||
return c?.hidden !== 'true' || c?.required !== 'false';
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Validates that a connector is eligible for silent SSO connection creation.
|
||||
*
|
||||
* When `connectionParameterSets` is present, it takes precedence over
|
||||
* `connectionParameters`. The function returns the name of the first
|
||||
* SSO-eligible set, or throws if none qualifies.
|
||||
*
|
||||
* When only `connectionParameters` is present, the same two-condition check
|
||||
* applies. Returns `null` to signal "use flat connectionParameters".
|
||||
*
|
||||
* @returns The name of the SSO-eligible `connectionParameterSet` to use, or
|
||||
* `null` if the connector uses flat `connectionParameters`.
|
||||
*/
|
||||
export function validateSsoEligible(connector, connectorId) {
|
||||
const notEligibleError = `Connector '${connectorId}' is not eligible for silent SSO.`;
|
||||
const sets = connector.properties.connectionParameterSets?.values;
|
||||
if (sets && sets.length > 0) {
|
||||
// connectionParameterSets takes precedence over connectionParameters
|
||||
const ssoSet = sets.find((set) => isParamSetSsoEligible(set.parameters));
|
||||
if (!ssoSet) {
|
||||
throw new Error(notEligibleError);
|
||||
}
|
||||
return ssoSet.name;
|
||||
}
|
||||
// Fall back to flat connectionParameters
|
||||
const params = connector.properties.connectionParameters;
|
||||
if (!params || Object.keys(params).length === 0)
|
||||
return null;
|
||||
if (!isParamSetSsoEligible(params)) {
|
||||
throw new Error(notEligibleError);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Checks whether a connector supports SSO as its *only* authentication type.
|
||||
* Returns `true` when the connector has a single auth type (or flat params)
|
||||
* that is SSO-eligible. Returns `false` if there are multiple auth types
|
||||
* (even if one is SSO-capable) — in that case the user should choose
|
||||
* interactively.
|
||||
*/
|
||||
export function isSsoOnlyConnector(connector) {
|
||||
const sets = connector.properties.connectionParameterSets?.values;
|
||||
if (sets && sets.length > 0) {
|
||||
// Multiple auth types → user must choose interactively
|
||||
if (sets.length > 1)
|
||||
return false;
|
||||
return isParamSetSsoEligible(sets[0].parameters);
|
||||
}
|
||||
// Fall back to flat connectionParameters
|
||||
const params = connector.properties.connectionParameters;
|
||||
if (!params || Object.keys(params).length === 0)
|
||||
return true;
|
||||
return isParamSetSsoEligible(params);
|
||||
}
|
||||
//# sourceMappingURL=ConnectivityService.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { CsdlOperation } from './DataverseTypes.js';
|
||||
/**
|
||||
* Parses a Dataverse OData $metadata CSDL XML string and returns all Action and Function
|
||||
* definitions. Only top-level <Function> and <Action> tags are matched — <FunctionImport>
|
||||
* and <ActionImport> inside <EntityContainer> are excluded by name.
|
||||
*
|
||||
* @param xml - The full XML string from the $metadata endpoint.
|
||||
* @param nameFilter - Optional case-insensitive substring filter on operation name.
|
||||
*/
|
||||
export declare function parseCsdlMetadata(xml: string, nameFilter?: string): CsdlOperation[];
|
||||
//# sourceMappingURL=CsdlMetadataParser.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CsdlMetadataParser.d.ts","sourceRoot":"","sources":["../../../src/services/dataverse/CsdlMetadataParser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,kBAAkB,CAAC;AAUrF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,EAAE,CAoDnF"}
|
||||
Generated
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import sax from 'sax';
|
||||
/**
|
||||
* Parses a Dataverse OData $metadata CSDL XML string and returns all Action and Function
|
||||
* definitions. Only top-level <Function> and <Action> tags are matched — <FunctionImport>
|
||||
* and <ActionImport> inside <EntityContainer> are excluded by name.
|
||||
*
|
||||
* @param xml - The full XML string from the $metadata endpoint.
|
||||
* @param nameFilter - Optional case-insensitive substring filter on operation name.
|
||||
*/
|
||||
export function parseCsdlMetadata(xml, nameFilter) {
|
||||
const results = [];
|
||||
let scratch = null;
|
||||
const lowerFilter = nameFilter?.toLowerCase();
|
||||
const parser = sax.parser(/* strict */ true);
|
||||
parser.onopentag = (node) => {
|
||||
if (node.name === 'Function' || node.name === 'Action') {
|
||||
const name = node.attributes['Name'];
|
||||
const isBound = node.attributes['IsBound'] === 'true';
|
||||
scratch = { name, kind: node.name, isBound, parameters: [], returnType: undefined };
|
||||
return;
|
||||
}
|
||||
if (scratch === null)
|
||||
return;
|
||||
if (node.name === 'Parameter') {
|
||||
const nullable = node.attributes['Nullable'] !== 'false';
|
||||
scratch.parameters.push({
|
||||
name: node.attributes['Name'],
|
||||
type: node.attributes['Type'],
|
||||
nullable,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (node.name === 'ReturnType') {
|
||||
const nullable = node.attributes['Nullable'] !== 'false';
|
||||
scratch.returnType = {
|
||||
type: node.attributes['Type'],
|
||||
nullable,
|
||||
};
|
||||
}
|
||||
};
|
||||
parser.onclosetag = (name) => {
|
||||
if ((name === 'Function' || name === 'Action') && scratch !== null) {
|
||||
if (!lowerFilter || scratch.name.toLowerCase().includes(lowerFilter)) {
|
||||
results.push({ ...scratch, parameters: [...scratch.parameters] });
|
||||
}
|
||||
scratch = null;
|
||||
}
|
||||
};
|
||||
parser.onerror = (error) => {
|
||||
throw new Error(`Failed to parse $metadata CSDL: ${error.message}`);
|
||||
};
|
||||
parser.write(xml).close();
|
||||
return results;
|
||||
}
|
||||
//# sourceMappingURL=CsdlMetadataParser.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CsdlMetadataParser.js","sourceRoot":"","sources":["../../../src/services/dataverse/CsdlMetadataParser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,GAAG,MAAM,KAAK,CAAC;AAYtB;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,UAAmB;IAChE,MAAM,OAAO,GAAoB,EAAE,CAAC;IACpC,IAAI,OAAO,GAA4B,IAAI,CAAC;IAC5C,MAAM,WAAW,GAAG,UAAU,EAAE,WAAW,EAAE,CAAC;IAE9C,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAE7C,MAAM,CAAC,SAAS,GAAG,CAAC,IAAI,EAAE,EAAE;QAC1B,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAW,CAAC;YAC/C,MAAM,OAAO,GAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAwB,KAAK,MAAM,CAAC;YAC9E,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;YACpF,OAAO;QACT,CAAC;QAED,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO;QAE7B,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAwB,KAAK,OAAO,CAAC;YACjF,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;gBACtB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAW;gBACvC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAW;gBACvC,QAAQ;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAwB,KAAK,OAAO,CAAC;YACjF,OAAO,CAAC,UAAU,GAAG;gBACnB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAW;gBACvC,QAAQ;aACT,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,CAAC,UAAU,GAAG,CAAC,IAAI,EAAE,EAAE;QAC3B,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,QAAQ,CAAC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACnE,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBACrE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IAE1B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { IHttpClient } from '../types/IHttpClient.js';
|
||||
import type { ILogger } from '../types/PlayerServices.types.js';
|
||||
import type { CsdlOperation, DataverseEntityDefinition, DataverseSchemaWrapper } from './DataverseTypes.js';
|
||||
export declare class DataverseMetadataService {
|
||||
private httpClient;
|
||||
constructor(httpClient: IHttpClient);
|
||||
getEntityDefinitionAsync(orgUrl: string, tableName: string, includeOptionSets: boolean | undefined, logger: ILogger): Promise<DataverseEntityDefinition>;
|
||||
/**
|
||||
* Fetches the OData $metadata CSDL document and returns all Action and Function definitions
|
||||
* whose name contains the given search term (case-insensitive).
|
||||
*/
|
||||
searchCsdlOperations(orgUrl: string, searchTerm: string, logger: ILogger): Promise<CsdlOperation[]>;
|
||||
convertEntityDefinitionToSchema(entityDefinition: DataverseEntityDefinition): DataverseSchemaWrapper;
|
||||
private mapDataverseTypeToJsonSchemaType;
|
||||
private enrichWithOptionSetMetadata;
|
||||
private createOptionSetRequests;
|
||||
private mergeOptionSetData;
|
||||
private enrichPropertyWithOptionSetData;
|
||||
}
|
||||
//# sourceMappingURL=DataverseMetadataService.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DataverseMetadataService.d.ts","sourceRoot":"","sources":["../../../src/services/dataverse/DataverseMetadataService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EACV,aAAa,EAEb,yBAAyB,EAEzB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,wBAAwB;IACvB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,WAAW;IAE9B,wBAAwB,CACnC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,OAAO,YAAO,EACjC,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,yBAAyB,CAAC;IA4ErC;;;OAGG;IACU,oBAAoB,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,aAAa,EAAE,CAAC;IAkCpB,+BAA+B,CACpC,gBAAgB,EAAE,yBAAyB,GAC1C,sBAAsB;IA8EzB,OAAO,CAAC,gCAAgC;YAoC1B,2BAA2B;IAyBzC,OAAO,CAAC,uBAAuB;IAgD/B,OAAO,CAAC,kBAAkB;IAsC1B,OAAO,CAAC,+BAA+B;CA+ExC"}
|
||||
Generated
Vendored
+337
@@ -0,0 +1,337 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import { stringifyError } from '../../ErrorUtils.js';
|
||||
import { parseCsdlMetadata } from './CsdlMetadataParser.js';
|
||||
export class DataverseMetadataService {
|
||||
httpClient;
|
||||
constructor(httpClient) {
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
async getEntityDefinitionAsync(orgUrl, tableName, includeOptionSets = true, logger) {
|
||||
if (!orgUrl || !tableName) {
|
||||
throw new Error('orgUrl and tableName are required parameters');
|
||||
}
|
||||
const scenario = logger.trackScenario('DataverseMetadataService.GetEntityDefinition', {
|
||||
orgUrl,
|
||||
tableName,
|
||||
includeOptionSets,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
const selectParam = 'MetadataId,LogicalName,DisplayCollectionName,DisplayName,EntitySetName,Description,HasNotes,IsActivity,IsIntersect,IsManaged,TableType,IsPrivate,IsLogicalEntity,PrimaryIdAttribute,PrimaryNameAttribute,ObjectTypeCode,OwnershipType,Privileges,IsAvailableOffline,IsOfflineInMobileClient';
|
||||
const expandParam = 'Attributes,ManyToOneRelationships,OneToManyRelationships,ManyToManyRelationships';
|
||||
const requestUri = `EntityDefinitions(LogicalName='${tableName}')` +
|
||||
`?$select=${selectParam}` +
|
||||
`&$expand=${expandParam}`;
|
||||
const fullUrl = `${baseUrl}/api/data/v9.0/${requestUri}`;
|
||||
const authResource = baseUrl + '/';
|
||||
additionalScenarioData = { url: fullUrl, authResource };
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong',
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
},
|
||||
});
|
||||
if (includeOptionSets && response.data.Attributes) {
|
||||
try {
|
||||
await this.enrichWithOptionSetMetadata(baseUrl, tableName, response.data, authResource, logger);
|
||||
}
|
||||
catch (optionSetError) {
|
||||
logger.trackErrorEvent('DataverseMetadataService.GetEntityDefinition.OptionsetRetrievalFailed', {
|
||||
tableName,
|
||||
error: stringifyError(optionSetError),
|
||||
});
|
||||
}
|
||||
}
|
||||
if (response.status === 200) {
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
let errorMessage = `Failed to get entity definition for table '${tableName}' from organization '${orgUrl}'`;
|
||||
errorMessage += `: ${stringifyError(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fetches the OData $metadata CSDL document and returns all Action and Function definitions
|
||||
* whose name contains the given search term (case-insensitive).
|
||||
*/
|
||||
async searchCsdlOperations(orgUrl, searchTerm, logger) {
|
||||
const scenario = logger.trackScenario('DataverseMetadataService.SearchCsdlOperations', {
|
||||
orgUrl,
|
||||
searchTerm,
|
||||
});
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
// v9.2 is required for full CSDL including custom operations (Actions/Functions)
|
||||
const fullUrl = `${baseUrl}/api/data/v9.2/$metadata`;
|
||||
const authResource = baseUrl + '/';
|
||||
additionalScenarioData = { url: fullUrl, authResource };
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
responseType: 'text',
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Accept: 'application/xml',
|
||||
},
|
||||
});
|
||||
const operations = parseCsdlMetadata(response.data, searchTerm);
|
||||
additionalScenarioData.resultCount = operations.length;
|
||||
scenario.complete(additionalScenarioData);
|
||||
return operations;
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
throw new Error(`Failed to search CSDL operations in organization '${orgUrl}': ${stringifyError(error)}`);
|
||||
}
|
||||
}
|
||||
convertEntityDefinitionToSchema(entityDefinition) {
|
||||
const displayName = entityDefinition.DisplayCollectionName?.UserLocalizedLabel?.Label ||
|
||||
entityDefinition.DisplayName?.UserLocalizedLabel?.Label ||
|
||||
entityDefinition.LogicalName;
|
||||
const properties = {};
|
||||
const requiredFields = [];
|
||||
if (entityDefinition.Attributes) {
|
||||
for (const attribute of entityDefinition.Attributes) {
|
||||
const propertySchema = {
|
||||
type: this.mapDataverseTypeToJsonSchemaType(attribute.AttributeTypeName?.Value),
|
||||
title: attribute.DisplayName?.UserLocalizedLabel?.Label || attribute.LogicalName,
|
||||
'x-ms-dataverse-attribute': attribute.LogicalName,
|
||||
'x-ms-dataverse-type': attribute.AttributeTypeName?.Value,
|
||||
'x-ms-schema-name': attribute.SchemaName,
|
||||
};
|
||||
if (attribute.IsValidForCreate === false && attribute.IsValidForUpdate === false) {
|
||||
propertySchema['x-ms-read-only'] = true;
|
||||
}
|
||||
if (attribute.IsPrimaryId) {
|
||||
propertySchema['x-ms-dataverse-primary-id'] = true;
|
||||
}
|
||||
if (attribute.IsPrimaryName) {
|
||||
propertySchema['x-ms-dataverse-primary-name'] = true;
|
||||
}
|
||||
if (attribute.RequiredLevel?.Value === 'ApplicationRequired' ||
|
||||
attribute.RequiredLevel?.Value === 'SystemRequired') {
|
||||
propertySchema.required = true;
|
||||
requiredFields.push(attribute.LogicalName);
|
||||
}
|
||||
if (attribute.MaxLength && attribute.MaxLength > 0) {
|
||||
propertySchema.maxLength = attribute.MaxLength;
|
||||
}
|
||||
if (attribute.LogicalName === entityDefinition.PrimaryIdAttribute) {
|
||||
propertySchema['x-ms-keyType'] = 'primary';
|
||||
}
|
||||
if (attribute.OptionSet) {
|
||||
propertySchema.enum = [];
|
||||
propertySchema['x-ms-enum-values'] = [];
|
||||
propertySchema.Color = [];
|
||||
this.enrichPropertyWithOptionSetData(propertySchema, attribute);
|
||||
}
|
||||
if (attribute.AttributeTypeName?.Value?.toLowerCase() === 'datetime') {
|
||||
propertySchema.format = 'date-time';
|
||||
}
|
||||
properties[attribute.LogicalName] = propertySchema;
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: entityDefinition.LogicalName,
|
||||
title: displayName,
|
||||
schema: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
'x-ms-dataverse-entity': true,
|
||||
'x-ms-dataverse-entityset': entityDefinition.EntitySetName,
|
||||
'x-ms-dataverse-primary-id': entityDefinition.PrimaryIdAttribute,
|
||||
'x-ms-dataverse-primary-name': entityDefinition.PrimaryNameAttribute,
|
||||
properties,
|
||||
required: requiredFields.length > 0 ? requiredFields : undefined,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
mapDataverseTypeToJsonSchemaType(dataverseType) {
|
||||
if (!dataverseType) {
|
||||
return 'string';
|
||||
}
|
||||
switch (dataverseType.toLowerCase()) {
|
||||
case 'string':
|
||||
case 'memo':
|
||||
case 'entityname':
|
||||
return 'string';
|
||||
case 'integer':
|
||||
case 'bigint':
|
||||
return 'integer';
|
||||
case 'decimal':
|
||||
case 'double':
|
||||
case 'money':
|
||||
return 'number';
|
||||
case 'boolean':
|
||||
return 'boolean';
|
||||
case 'datetime':
|
||||
return 'string';
|
||||
case 'uniqueidentifier':
|
||||
return 'string';
|
||||
case 'lookup':
|
||||
case 'owner':
|
||||
case 'customer':
|
||||
return 'object';
|
||||
case 'picklist':
|
||||
case 'state':
|
||||
case 'status':
|
||||
return 'object';
|
||||
default:
|
||||
return 'string';
|
||||
}
|
||||
}
|
||||
async enrichWithOptionSetMetadata(baseUrl, tableName, entityDefinition, authResource, logger) {
|
||||
const scenario = logger.trackScenario('DataverseMetadataService.EnrichWithOptionSetMetadata', {
|
||||
tableName,
|
||||
});
|
||||
try {
|
||||
const optionSetRequests = this.createOptionSetRequests(baseUrl, tableName, authResource, logger);
|
||||
const optionSetResponses = await Promise.allSettled(optionSetRequests);
|
||||
this.mergeOptionSetData(entityDefinition, optionSetResponses);
|
||||
scenario.complete();
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error });
|
||||
}
|
||||
}
|
||||
createOptionSetRequests(baseUrl, tableName, authResource, logger) {
|
||||
const optionSetRequestTemplate = `${baseUrl}/api/data/v9.0/EntityDefinitions(LogicalName='${tableName}')/Attributes/Microsoft.Dynamics.CRM.{0}` +
|
||||
'?$select=MetadataId,LogicalName,SchemaName,DisplayName' +
|
||||
'&$expand=OptionSet';
|
||||
const requestHeaders = {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong',
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
};
|
||||
const optionSetTypes = [
|
||||
'PicklistAttributeMetadata',
|
||||
'MultiSelectPicklistAttributeMetadata',
|
||||
'StateAttributeMetadata',
|
||||
'StatusAttributeMetadata',
|
||||
'BooleanAttributeMetadata',
|
||||
'EntityNameAttributeMetadata',
|
||||
];
|
||||
return optionSetTypes.map(async (type) => {
|
||||
logger.trackActivityEvent('DataverseMetadataService.CreateOptionSetRequest', {
|
||||
optionSetRequestTemplate: optionSetRequestTemplate.replace('{0}', type),
|
||||
});
|
||||
try {
|
||||
const response = await this.httpClient.get(optionSetRequestTemplate.replace('{0}', type), {
|
||||
authResource,
|
||||
headers: requestHeaders,
|
||||
});
|
||||
return { type, data: response.data };
|
||||
}
|
||||
catch (error) {
|
||||
logger.trackErrorEvent('DataverseMetadataService.CreateOptionSetRequest.Failure', {
|
||||
optionSetRequestTemplate: optionSetRequestTemplate.replace('{0}', type),
|
||||
error: stringifyError(error),
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
mergeOptionSetData(entityDefinition, optionSetResponses) {
|
||||
if (!entityDefinition.Attributes) {
|
||||
return;
|
||||
}
|
||||
const optionSetAttributes = new Map();
|
||||
for (const result of optionSetResponses) {
|
||||
if (result.status === 'fulfilled' &&
|
||||
result.value?.data &&
|
||||
typeof result.value.data === 'object' &&
|
||||
result.value.data !== null &&
|
||||
'value' in result.value.data &&
|
||||
Array.isArray(result.value.data.value)) {
|
||||
for (const attribute of result.value.data.value) {
|
||||
if (attribute && typeof attribute === 'object' && 'LogicalName' in attribute) {
|
||||
optionSetAttributes.set(attribute.LogicalName, attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const attribute of entityDefinition.Attributes) {
|
||||
const optionSetData = optionSetAttributes.get(attribute.LogicalName);
|
||||
if (optionSetData && optionSetData.OptionSet) {
|
||||
attribute.OptionSet = optionSetData.OptionSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
enrichPropertyWithOptionSetData(propertySchema, attribute) {
|
||||
const optionSet = attribute.OptionSet;
|
||||
if (!optionSet) {
|
||||
return;
|
||||
}
|
||||
if (optionSet.MetadataId) {
|
||||
propertySchema['x-ms-optionsetmetadataid'] = optionSet.MetadataId;
|
||||
}
|
||||
if (optionSet.IsGlobal !== undefined) {
|
||||
propertySchema['x-ms-isGlobal'] = optionSet.IsGlobal;
|
||||
}
|
||||
if (optionSet.DisplayName?.UserLocalizedLabel?.Label) {
|
||||
propertySchema['x-ms-optionsetdisplayname'] = optionSet.DisplayName.UserLocalizedLabel.Label;
|
||||
}
|
||||
if (optionSet.OptionSetType) {
|
||||
propertySchema['x-ms-optionSetType'] = optionSet.OptionSetType;
|
||||
}
|
||||
if (optionSet &&
|
||||
typeof optionSet === 'object' &&
|
||||
'TrueOption' in optionSet &&
|
||||
'FalseOption' in optionSet) {
|
||||
const booleanOptionSet = optionSet;
|
||||
const labels = [
|
||||
booleanOptionSet.FalseOption?.Label?.UserLocalizedLabel?.Label || 'False',
|
||||
booleanOptionSet.TrueOption?.Label?.UserLocalizedLabel?.Label || 'True',
|
||||
];
|
||||
const values = [
|
||||
booleanOptionSet.FalseOption?.Value ?? 0,
|
||||
booleanOptionSet.TrueOption?.Value ?? 1,
|
||||
];
|
||||
const colors = [
|
||||
booleanOptionSet.FalseOption?.Color || null,
|
||||
booleanOptionSet.TrueOption?.Color || null,
|
||||
];
|
||||
propertySchema.enum = labels;
|
||||
propertySchema['x-ms-enum-values'] = values;
|
||||
propertySchema.Color = colors;
|
||||
}
|
||||
else if (optionSet.Options && optionSet.Options.length > 0) {
|
||||
const labels = [];
|
||||
const values = [];
|
||||
const colors = [];
|
||||
for (const option of optionSet.Options) {
|
||||
if (option.Value !== undefined) {
|
||||
const label = option.Label?.UserLocalizedLabel?.Label || option.Value.toString();
|
||||
labels.push(label);
|
||||
values.push(option.Value);
|
||||
colors.push(option.Color || null);
|
||||
}
|
||||
}
|
||||
propertySchema.enum = labels;
|
||||
propertySchema['x-ms-enum-values'] = values;
|
||||
propertySchema.Color = colors;
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=DataverseMetadataService.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { IHttpClient } from '../types/IHttpClient.js';
|
||||
import type { ILogger } from '../types/PlayerServices.types.js';
|
||||
import type { ConnectionReferenceSolutionComponent, DataverseSolution, DataverseWorkflow, EnvironmentVariableDefinition } from './DataverseTypes.js';
|
||||
export declare class DataverseSystemDataService {
|
||||
private httpClient;
|
||||
constructor(httpClient: IHttpClient);
|
||||
getEnvironmentVariables(orgUrl: string, logger: ILogger): Promise<EnvironmentVariableDefinition[]>;
|
||||
getEnvironmentVariable(orgUrl: string, variableSchemaName: string, logger: ILogger): Promise<EnvironmentVariableDefinition | undefined>;
|
||||
getConnectionReferencesInSolution(solutionId: string, orgUrl: string, logger: ILogger): Promise<ConnectionReferenceSolutionComponent[]>;
|
||||
getConnectionIdForReference(connectionReferenceLogicalName: string, orgUrl: string, logger: ILogger): Promise<string | undefined>;
|
||||
getPreferredSolution(orgUrl: string): Promise<string | undefined>;
|
||||
getSolutions(orgUrl: string): Promise<DataverseSolution[]>;
|
||||
/**
|
||||
* Retrieves all cloud flows (workflows with category = 5) from a Dataverse organization.
|
||||
* @param orgUrl The URL of the Dataverse organization.
|
||||
* @param logger The logger instance for tracking the scenario.
|
||||
* @param search Optional search term to filter flows by name (case-insensitive substring match).
|
||||
* @returns A promise that resolves to an array of DataverseWorkflow objects.
|
||||
* @throws An error if the HTTP request to the Dataverse API fails.
|
||||
*/
|
||||
getWorkflows(orgUrl: string, logger: ILogger, search?: string): Promise<DataverseWorkflow[]>;
|
||||
}
|
||||
//# sourceMappingURL=DataverseSystemDataService.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DataverseSystemDataService.d.ts","sourceRoot":"","sources":["../../../src/services/dataverse/DataverseSystemDataService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EACV,oCAAoC,EAEpC,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC9B,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,0BAA0B;IACzB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,WAAW;IAE9B,uBAAuB,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,6BAA6B,EAAE,CAAC;IAgD9B,sBAAsB,CACjC,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC;IAmDxC,iCAAiC,CAC5C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,oCAAoC,EAAE,CAAC;IA6CrC,2BAA2B,CACtC,8BAA8B,EAAE,MAAM,EACtC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA6CjB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA0BjE,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA8BvE;;;;;;;OAOG;IACU,YAAY,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAwDhC"}
|
||||
Generated
Vendored
+279
@@ -0,0 +1,279 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export class DataverseSystemDataService {
|
||||
httpClient;
|
||||
constructor(httpClient) {
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
async getEnvironmentVariables(orgUrl, logger) {
|
||||
const scenario = logger.trackScenario('GetEnvironmentVariables', {
|
||||
orgUrl,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
const selectParam = 'type,schemaname,displayname';
|
||||
const expandParam = 'environmentvariabledefinition_environmentvariablevalue($select=value)';
|
||||
const requestUri = `environmentvariabledefinitions` + `?$select=${selectParam}` + `&$expand=${expandParam}`;
|
||||
const fullUrl = `${baseUrl}/api/data/v9.0/${requestUri}`;
|
||||
const authResource = baseUrl + '/';
|
||||
additionalScenarioData = { url: fullUrl, authResource };
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong',
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
},
|
||||
});
|
||||
if (response.status === 200) {
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response?.data?.value;
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
let errorMessage = `Failed to get environment variables from organization '${orgUrl}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
async getEnvironmentVariable(orgUrl, variableSchemaName, logger) {
|
||||
const scenario = logger.trackScenario('GetEnvironmentVariable', {
|
||||
orgUrl,
|
||||
variableSchemaName,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
const selectParam = 'type,schemaname,displayname';
|
||||
const expandParam = 'environmentvariabledefinition_environmentvariablevalue($select=value)';
|
||||
const requestUri = `environmentvariabledefinitions?$filter=schemaname%20eq%20%27${variableSchemaName}%27` +
|
||||
`&$select=${selectParam}` +
|
||||
`&$expand=${expandParam}`;
|
||||
const fullUrl = `${baseUrl}/api/data/v9.0/${requestUri}`;
|
||||
const authResource = baseUrl + '/';
|
||||
additionalScenarioData = { url: fullUrl, authResource };
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong',
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
},
|
||||
});
|
||||
if (response.status === 200) {
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response?.data?.value?.[0];
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
let errorMessage = `Failed to get environment variable '${variableSchemaName}' from organization '${orgUrl}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
async getConnectionReferencesInSolution(solutionId, orgUrl, logger) {
|
||||
const scenario = logger.trackScenario('GetConnectionReferencesInSolution', {
|
||||
solutionId,
|
||||
orgUrl,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
const requestUri = `msdyn_solutioncomponentsummaries?$filter=(msdyn_solutionid eq ${solutionId}) and (msdyn_componentlogicalname eq 'connectionreference')&$orderby=msdyn_displayname asc&$select=msdyn_name,msdyn_displayname,msdyn_description`;
|
||||
const fullUrl = `${baseUrl}/api/data/v9.0/${requestUri}`;
|
||||
const authResource = baseUrl + '/';
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong',
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
},
|
||||
});
|
||||
additionalScenarioData = { url: fullUrl, authResource };
|
||||
if (response.status === 200) {
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response?.data?.value || [];
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
let errorMessage = `Failed to get connection references for solution '${solutionId}' in organization '${orgUrl}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
async getConnectionIdForReference(connectionReferenceLogicalName, orgUrl, logger) {
|
||||
const scenario = logger.trackScenario('GetConnectionIdForReference', {
|
||||
connectionReferenceLogicalName,
|
||||
orgUrl,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
const selectParam = `connectionreferenceid,connectionid,connectionreferencelogicalname`;
|
||||
const filterParam = `connectionreferencelogicalname eq '${connectionReferenceLogicalName}'`;
|
||||
const requestUri = `connectionreferences?$filter=${filterParam}&$select=${selectParam}`;
|
||||
const fullUrl = `${baseUrl}/api/data/v9.0/${requestUri}`;
|
||||
const authResource = baseUrl + '/';
|
||||
additionalScenarioData = { url: fullUrl, authResource };
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong',
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
},
|
||||
});
|
||||
if (response.status === 200) {
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response?.data?.value?.[0]?.connectionid;
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
async getPreferredSolution(orgUrl) {
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
const fullUrl = `${baseUrl}/api/data/v9.0/GetPreferredSolution`;
|
||||
const authResource = baseUrl + '/';
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong',
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
},
|
||||
});
|
||||
return response?.data?.solutionid;
|
||||
}
|
||||
catch (error) {
|
||||
let errorMessage = `Failed to get preferred solution from organization '${orgUrl}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
async getSolutions(orgUrl) {
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
const selectParam = 'solutionid,uniquename,friendlyname,version,description,ismanaged';
|
||||
const requestUri = `solutions?$select=${selectParam}&$orderby=friendlyname asc`;
|
||||
const fullUrl = `${baseUrl}/api/data/v9.0/${requestUri}`;
|
||||
const authResource = baseUrl + '/';
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong',
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
},
|
||||
});
|
||||
return response?.data?.value || [];
|
||||
}
|
||||
catch (error) {
|
||||
let errorMessage = `Failed to get solutions from organization '${orgUrl}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Retrieves all cloud flows (workflows with category = 5) from a Dataverse organization.
|
||||
* @param orgUrl The URL of the Dataverse organization.
|
||||
* @param logger The logger instance for tracking the scenario.
|
||||
* @param search Optional search term to filter flows by name (case-insensitive substring match).
|
||||
* @returns A promise that resolves to an array of DataverseWorkflow objects.
|
||||
* @throws An error if the HTTP request to the Dataverse API fails.
|
||||
*/
|
||||
async getWorkflows(orgUrl, logger, search) {
|
||||
const scenario = logger.trackScenario('DataverseSystemDataService.GetWorkflows', {
|
||||
orgUrl,
|
||||
search,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const baseUrl = orgUrl.endsWith('/') ? orgUrl.slice(0, -1) : orgUrl;
|
||||
const selectParam = 'workflowid,workflowidunique,solutionid,name,modifiedon,statecode,clientdata,resourceid';
|
||||
let filterParam = 'category eq 5'; // Category 5 represents cloud flows
|
||||
// Add name filter if search is provided
|
||||
if (search) {
|
||||
filterParam += ` and contains(name,'${search.replace(/'/g, "''")}')`;
|
||||
}
|
||||
const requestUri = `workflows?$filter=${encodeURIComponent(filterParam)}&$select=${selectParam}`;
|
||||
const fullUrl = `${baseUrl}/api/data/v9.0/${requestUri}`;
|
||||
const authResource = baseUrl + '/';
|
||||
additionalScenarioData = { url: fullUrl, authResource };
|
||||
const response = await this.httpClient.get(fullUrl, {
|
||||
authResource,
|
||||
headers: {
|
||||
'User-Agent': 'PowerApps',
|
||||
Consistency: 'Strong', // Force CDS to return latest metadata
|
||||
Accept: 'application/json',
|
||||
'OData-MaxVersion': '4.0',
|
||||
'OData-Version': '4.0',
|
||||
},
|
||||
});
|
||||
if (response.status === 200) {
|
||||
additionalScenarioData.resultCount = response.data.value.length;
|
||||
additionalScenarioData.hasNextLink = !!response.data['@odata.nextLink'];
|
||||
scenario.complete(additionalScenarioData);
|
||||
}
|
||||
else {
|
||||
additionalScenarioData.response = response.data;
|
||||
additionalScenarioData.status = response.status;
|
||||
scenario.completeWithError(additionalScenarioData);
|
||||
}
|
||||
return response?.data?.value || [];
|
||||
}
|
||||
catch (error) {
|
||||
scenario.failure({ error, ...additionalScenarioData });
|
||||
let errorMessage = `Failed to get workflows from organization '${orgUrl}'`;
|
||||
errorMessage += `: ${JSON.stringify(error)}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=DataverseSystemDataService.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+237
@@ -0,0 +1,237 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export interface DataverseEntityDefinition {
|
||||
MetadataId?: string;
|
||||
LogicalName: string;
|
||||
DisplayCollectionName?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
DisplayName?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
Description?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
Attributes?: DataverseAttributeDefinition[];
|
||||
PrimaryIdAttribute?: string;
|
||||
PrimaryNameAttribute?: string;
|
||||
EntitySetName?: string;
|
||||
ObjectTypeCode?: number;
|
||||
HasNotes?: boolean;
|
||||
IsActivity?: boolean;
|
||||
IsIntersect?: boolean;
|
||||
IsManaged?: boolean;
|
||||
TableType?: string;
|
||||
IsPrivate?: boolean;
|
||||
IsLogicalEntity?: boolean;
|
||||
OwnershipType?: string;
|
||||
Privileges?: unknown[];
|
||||
IsAvailableOffline?: boolean;
|
||||
IsOfflineInMobileClient?: boolean;
|
||||
ManyToOneRelationships?: unknown[];
|
||||
OneToManyRelationships?: unknown[];
|
||||
ManyToManyRelationships?: unknown[];
|
||||
}
|
||||
export interface DataverseAttributeDefinition {
|
||||
LogicalName: string;
|
||||
DisplayName?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
AttributeType?: string;
|
||||
AttributeTypeName?: {
|
||||
Value: string;
|
||||
};
|
||||
IsPrimaryId?: boolean;
|
||||
IsPrimaryName?: boolean;
|
||||
IsValidODataAttribute?: boolean;
|
||||
RequiredLevel?: {
|
||||
Value: string;
|
||||
};
|
||||
MaxLength?: number;
|
||||
OptionSet?: {
|
||||
MetadataId?: string;
|
||||
Name?: string;
|
||||
DisplayName?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
Description?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
IsGlobal?: boolean;
|
||||
OptionSetType?: string;
|
||||
Options?: DataverseOptionMetadata[];
|
||||
};
|
||||
GlobalOptionSet?: {
|
||||
MetadataId?: string;
|
||||
Name?: string;
|
||||
DisplayName?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
Description?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
IsGlobal?: boolean;
|
||||
OptionSetType?: string;
|
||||
Options?: DataverseOptionMetadata[];
|
||||
};
|
||||
SchemaName?: string;
|
||||
IsValidForUpdate?: boolean;
|
||||
IsValidForCreate?: boolean;
|
||||
}
|
||||
export interface DataverseOptionMetadata {
|
||||
Value?: number;
|
||||
Label?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
Description?: {
|
||||
UserLocalizedLabel?: {
|
||||
Label: string;
|
||||
};
|
||||
};
|
||||
Color?: string;
|
||||
}
|
||||
export interface DataverseEntitySchema {
|
||||
name: string;
|
||||
title: string;
|
||||
type: string;
|
||||
'x-ms-dataverse-entity': boolean;
|
||||
'x-ms-dataverse-entityset'?: string;
|
||||
'x-ms-dataverse-primary-id'?: string;
|
||||
'x-ms-dataverse-primary-name'?: string;
|
||||
properties: Record<string, DataversePropertySchema>;
|
||||
}
|
||||
export interface DataversePropertySchema {
|
||||
type: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
format?: string;
|
||||
'x-ms-dataverse-attribute': string;
|
||||
'x-ms-dataverse-type'?: string;
|
||||
'x-ms-dataverse-primary-id'?: boolean;
|
||||
'x-ms-dataverse-primary-name'?: boolean;
|
||||
'x-ms-keyType'?: string;
|
||||
required?: boolean;
|
||||
maxLength?: number;
|
||||
'x-ms-optionsetmetadataid'?: string;
|
||||
'x-ms-optionsetdisplayname'?: string;
|
||||
'x-ms-isGlobal'?: boolean;
|
||||
'x-ms-optionSetType'?: string;
|
||||
default?: string | number;
|
||||
enum?: Array<string | number>;
|
||||
'x-ms-enum-values'?: Array<number | null>;
|
||||
properties?: {
|
||||
Id: {
|
||||
type: string;
|
||||
};
|
||||
Value: {
|
||||
type: string;
|
||||
};
|
||||
Color: {
|
||||
type: string;
|
||||
};
|
||||
};
|
||||
Color?: Array<string | null>;
|
||||
'x-ms-schema-name'?: string;
|
||||
'x-ms-read-only'?: boolean;
|
||||
}
|
||||
export interface DataverseSchemaWrapper {
|
||||
name: string;
|
||||
title: string;
|
||||
schema: {
|
||||
type: string;
|
||||
items: {
|
||||
type: string;
|
||||
'x-ms-dataverse-entity': boolean;
|
||||
'x-ms-dataverse-entityset'?: string;
|
||||
'x-ms-dataverse-primary-id'?: string;
|
||||
'x-ms-dataverse-primary-name'?: string;
|
||||
properties: Record<string, DataversePropertySchema>;
|
||||
required?: string[];
|
||||
};
|
||||
};
|
||||
}
|
||||
export interface EnvironmentVariableValue {
|
||||
value: string;
|
||||
}
|
||||
export interface EnvironmentVariableDefinition {
|
||||
type: number;
|
||||
schemaname: string;
|
||||
displayname: string;
|
||||
environmentvariabledefinition_environmentvariablevalue: EnvironmentVariableValue[];
|
||||
}
|
||||
export interface ConnectionReferenceSolutionComponent {
|
||||
msdyn_description: string;
|
||||
msdyn_displayname: string;
|
||||
msdyn_name: string;
|
||||
}
|
||||
export interface DataverseSolution {
|
||||
solutionid: string;
|
||||
friendlyname: string;
|
||||
uniquename: string;
|
||||
}
|
||||
export interface DataversePreferredSolutionResponse {
|
||||
solutionid?: string;
|
||||
}
|
||||
export interface DataverseWorkflow {
|
||||
'@odata.etag'?: string;
|
||||
workflowid: string;
|
||||
workflowidunique: string;
|
||||
solutionid: string;
|
||||
name: string;
|
||||
modifiedon: string;
|
||||
statecode: number;
|
||||
clientdata: string;
|
||||
resourceid: string | undefined;
|
||||
}
|
||||
/**
|
||||
* A single parameter from a CSDL <Function> or <Action> element.
|
||||
*/
|
||||
export interface CsdlParameter {
|
||||
name: string;
|
||||
/** Raw CSDL type string, e.g. "Edm.String", "Edm.Guid", "mscrm.account", "Collection(mscrm.crmbaseentity)" */
|
||||
type: string;
|
||||
/** false means the parameter is required (Nullable="false" in CSDL) */
|
||||
nullable: boolean;
|
||||
}
|
||||
/**
|
||||
* The return type from a CSDL <ReturnType> element.
|
||||
*/
|
||||
export interface CsdlReturnType {
|
||||
/** Raw CSDL type string */
|
||||
type: string;
|
||||
nullable: boolean;
|
||||
}
|
||||
/**
|
||||
* A Dataverse Action or Function parsed from the OData $metadata CSDL document.
|
||||
* Covers both first-party and custom operations.
|
||||
*/
|
||||
export interface CsdlOperation {
|
||||
name: string;
|
||||
kind: 'Function' | 'Action';
|
||||
/** True when the first parameter is the entity binding (IsBound="true" in CSDL) */
|
||||
isBound: boolean;
|
||||
/** All parameters including the binding parameter at index 0 when isBound is true */
|
||||
parameters: CsdlParameter[];
|
||||
/** Undefined for actions/functions with no <ReturnType> element */
|
||||
returnType: CsdlReturnType | undefined;
|
||||
}
|
||||
//# sourceMappingURL=DataverseTypes.d.ts.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=DataverseTypes.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DataverseTypes.js","sourceRoot":"","sources":["../../../src/services/dataverse/DataverseTypes.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export * from './DataverseMetadataService.js';
|
||||
export * from './DataverseSystemDataService.js';
|
||||
export * from './DataverseTypes.js';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/dataverse/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC"}
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export * from './DataverseMetadataService.js';
|
||||
export * from './DataverseSystemDataService.js';
|
||||
export * from './DataverseTypes.js';
|
||||
//# sourceMappingURL=index.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/dataverse/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC"}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export { getPlayerServiceConfig, initializePlayerServices, updateEnvironmentName, updateRegion, } from './initializePlayerServices.js';
|
||||
export type { IHttpClient, RequestConfig, Response } from './types/IHttpClient.js';
|
||||
export type { ILogger, IPlayerServicesConfig, Scenario } from './types/PlayerServices.types.js';
|
||||
export type { RpCodeApp } from './powerAppsRp/PowerAppsRpService.types.js';
|
||||
export type { Api, App, CdsDatabaseReference, Connection, ConnectionReference, Environment, } from './types/ApiTypes.js';
|
||||
export type { IConnectedDatasetListMetadata, IConnectedDataTableListMetadata, } from './connectivity/ApimService.js';
|
||||
export { getDatasetsAsync, getSqlStoredProcedureMetadataAsync, getSqlStoredProceduresAsync, getTableMetadataAsync, getTablesAsync, getTabularConnectorVersion, } from './connectivity/ApimService.js';
|
||||
export { connectionFirstPartyLoginAsync } from './connectivity/ApimService.js';
|
||||
export { getConnectionByNameAsync, getConnectorAsync, isConnectionShareable, isSsoOnlyConnector, listAllConnectionsAsync, listConnectionsForConnectorAsync, validateSsoEligible, } from './connectivity/ConnectivityService.js';
|
||||
export { DataverseMetadataService } from './dataverse/index.js';
|
||||
export { DataverseSystemDataService } from './dataverse/DataverseSystemDataService.js';
|
||||
export type { ConnectionReferenceSolutionComponent, CsdlOperation, CsdlParameter, CsdlReturnType, DataverseSchemaWrapper, DataverseWorkflow, EnvironmentVariableDefinition, } from './dataverse/DataverseTypes.js';
|
||||
export { createApp, endSession, generateResourceStorage, getEnvironmentByName, listAppsAsync, makeAppSolutionAware, publishApp, saveApp, startSession, } from './powerAppsRp/PowerAppsRpService.js';
|
||||
export { getFlowMetadataAsync, getFlowSwaggerAsync, } from './powerAutomateRp/PowerAutomateRpService.js';
|
||||
export type { FlowConnectionReferenceResponse, FlowMetadataResponse, } from './powerAutomateRp/PowerAutomateRpService.types.js';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,YAAY,GACb,MAAM,4BAA4B,CAAC;AAGpC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChF,YAAY,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAG7F,YAAY,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACxE,YAAY,EACV,GAAG,EACH,GAAG,EACH,oBAAoB,EACpB,UAAU,EACV,mBAAmB,EACnB,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,6BAA6B,EAC7B,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,kCAAkC,EAClC,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,EACd,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,gCAAgC,EAChC,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,YAAY,EACV,oCAAoC,EACpC,aAAa,EACb,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,SAAS,EACT,UAAU,EACV,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,OAAO,EACP,YAAY,GACb,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,0CAA0C,CAAC;AAClD,YAAY,EACV,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,gDAAgD,CAAC"}
|
||||
Generated
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
// Core
|
||||
export { getPlayerServiceConfig, initializePlayerServices, updateEnvironmentName, updateRegion, } from './initializePlayerServices.js';
|
||||
export { getDatasetsAsync, getSqlStoredProcedureMetadataAsync, getSqlStoredProceduresAsync, getTableMetadataAsync, getTablesAsync, getTabularConnectorVersion, } from './connectivity/ApimService.js';
|
||||
export { connectionFirstPartyLoginAsync } from './connectivity/ApimService.js';
|
||||
export { getConnectionByNameAsync, getConnectorAsync, isConnectionShareable, isSsoOnlyConnector, listAllConnectionsAsync, listConnectionsForConnectorAsync, validateSsoEligible, } from './connectivity/ConnectivityService.js';
|
||||
// Dataverse
|
||||
export { DataverseMetadataService } from './dataverse/index.js';
|
||||
export { DataverseSystemDataService } from './dataverse/DataverseSystemDataService.js';
|
||||
// PowerApps RP
|
||||
export { createApp, endSession, generateResourceStorage, getEnvironmentByName, listAppsAsync, makeAppSolutionAware, publishApp, saveApp, startSession, } from './powerAppsRp/PowerAppsRpService.js';
|
||||
// Power Automate RP
|
||||
export { getFlowMetadataAsync, getFlowSwaggerAsync, } from './powerAutomateRp/PowerAutomateRpService.js';
|
||||
//# sourceMappingURL=index.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO;AACP,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,YAAY,GACb,MAAM,4BAA4B,CAAC;AAsBpC,OAAO,EACL,gBAAgB,EAChB,kCAAkC,EAClC,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,EACd,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,gCAAgC,EAChC,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAE5C,YAAY;AACZ,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAWpF,eAAe;AACf,OAAO,EACL,SAAS,EACT,UAAU,EACV,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,OAAO,EACP,YAAY,GACb,MAAM,kCAAkC,CAAC;AAE1C,oBAAoB;AACpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,0CAA0C,CAAC"}
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { Region } from '@microsoft/power-apps-common/services';
|
||||
import type { ILogger, IPlayerServiceOptions, IPlayerServicesConfig } from './types/PlayerServices.types.js';
|
||||
export declare function initializePlayerServices(options: IPlayerServiceOptions): void;
|
||||
export declare function getPlayerServiceConfig(): IPlayerServicesConfig;
|
||||
export declare function updateEnvironmentName(environmentName: string): void;
|
||||
export declare function updateRegion(region: Region): void;
|
||||
export declare function updateLogger(logger: ILogger): void;
|
||||
//# sourceMappingURL=initializePlayerServices.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"initializePlayerServices.d.ts","sourceRoot":"","sources":["../../src/services/initializePlayerServices.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,KAAK,EACV,OAAO,EACP,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,8BAA8B,CAAC;AAItC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,qBAAqB,QA8BtE;AAED,wBAAgB,sBAAsB,IAAI,qBAAqB,CAE9D;AAED,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,QAE5D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,QAE1C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,QAE3C"}
|
||||
Generated
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
let _playerServicesConfig;
|
||||
export function initializePlayerServices(options) {
|
||||
const { logger, httpClient, region, environmentName } = options;
|
||||
_playerServicesConfig = {
|
||||
logger,
|
||||
httpClient,
|
||||
region,
|
||||
environmentName,
|
||||
featureGates: {
|
||||
usePowerPlatformAPI: options.featureGates?.usePowerPlatformAPI || false,
|
||||
},
|
||||
apiVersions: {
|
||||
bapRp: options.apiVersions?.bapRp || '2021-04-01',
|
||||
launchService: options.apiVersions?.launchService || '2',
|
||||
launchOperations: options.apiVersions?.launchOperations || '1',
|
||||
monitoringHubLogAppOpen: options.apiVersions?.monitoringHubLogAppOpen || '2',
|
||||
monitoringHubLogAppNavigate: options.apiVersions?.monitoringHubLogAppNavigate || '1',
|
||||
monitoringHubLogDataRequests: options.apiVersions?.monitoringHubLogDataRequests || '1',
|
||||
requestAccess: options.apiVersions?.requestAccess || '1',
|
||||
permissions: options.apiVersions?.permissions || '1',
|
||||
modifyPermissions: options.apiVersions?.modifyPermissions || '1',
|
||||
evaluateEntitlements: options.apiVersions?.evaluateEntitlements || '1',
|
||||
appExtendedMetadata: options.apiVersions?.appExtendedMetadata || '1',
|
||||
getPreloadMetadata: options.apiVersions?.getPreloadMetadata || '1',
|
||||
getPublishMetadata: options.apiVersions?.getPublishMetadata || '3',
|
||||
copilotStatus: options.apiVersions?.copilotStatus || '1',
|
||||
neptune: options.apiVersions?.neptune || '1',
|
||||
environment: options.apiVersions?.environment || '1',
|
||||
},
|
||||
};
|
||||
}
|
||||
export function getPlayerServiceConfig() {
|
||||
return _playerServicesConfig;
|
||||
}
|
||||
export function updateEnvironmentName(environmentName) {
|
||||
_playerServicesConfig.environmentName = environmentName;
|
||||
}
|
||||
export function updateRegion(region) {
|
||||
_playerServicesConfig.region = region;
|
||||
}
|
||||
export function updateLogger(logger) {
|
||||
_playerServicesConfig.logger = logger;
|
||||
}
|
||||
//# sourceMappingURL=initializePlayerServices.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"initializePlayerServices.js","sourceRoot":"","sources":["../../src/services/initializePlayerServices.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,IAAI,qBAA4C,CAAC;AAEjD,MAAM,UAAU,wBAAwB,CAAC,OAA8B;IACrE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEhE,qBAAqB,GAAG;QACtB,MAAM;QACN,UAAU;QACV,MAAM;QACN,eAAe;QACf,YAAY,EAAE;YACZ,mBAAmB,EAAE,OAAO,CAAC,YAAY,EAAE,mBAAmB,IAAI,KAAK;SACxE;QACD,WAAW,EAAE;YACX,KAAK,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,IAAI,YAAY;YACjD,aAAa,EAAE,OAAO,CAAC,WAAW,EAAE,aAAa,IAAI,GAAG;YACxD,gBAAgB,EAAE,OAAO,CAAC,WAAW,EAAE,gBAAgB,IAAI,GAAG;YAC9D,uBAAuB,EAAE,OAAO,CAAC,WAAW,EAAE,uBAAuB,IAAI,GAAG;YAC5E,2BAA2B,EAAE,OAAO,CAAC,WAAW,EAAE,2BAA2B,IAAI,GAAG;YACpF,4BAA4B,EAAE,OAAO,CAAC,WAAW,EAAE,4BAA4B,IAAI,GAAG;YACtF,aAAa,EAAE,OAAO,CAAC,WAAW,EAAE,aAAa,IAAI,GAAG;YACxD,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW,IAAI,GAAG;YACpD,iBAAiB,EAAE,OAAO,CAAC,WAAW,EAAE,iBAAiB,IAAI,GAAG;YAChE,oBAAoB,EAAE,OAAO,CAAC,WAAW,EAAE,oBAAoB,IAAI,GAAG;YACtE,mBAAmB,EAAE,OAAO,CAAC,WAAW,EAAE,mBAAmB,IAAI,GAAG;YACpE,kBAAkB,EAAE,OAAO,CAAC,WAAW,EAAE,kBAAkB,IAAI,GAAG;YAClE,kBAAkB,EAAE,OAAO,CAAC,WAAW,EAAE,kBAAkB,IAAI,GAAG;YAClE,aAAa,EAAE,OAAO,CAAC,WAAW,EAAE,aAAa,IAAI,GAAG;YACxD,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,IAAI,GAAG;YAC5C,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW,IAAI,GAAG;SACrD;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,eAAuB;IAC3D,qBAAqB,CAAC,eAAe,GAAG,eAAe,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,qBAAqB,CAAC,MAAM,GAAG,MAAM,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,qBAAqB,CAAC,MAAM,GAAG,MAAM,CAAC;AACxC,CAAC"}
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { App, Environment } from '../types/ApiTypes.js';
|
||||
import type { AppLeaseSessionResponse, RpCodeApp } from './PowerAppsRpService.types.js';
|
||||
export declare function listAppsAsync(): Promise<App[]>;
|
||||
export declare function getEnvironmentByName(environmentName: string): Promise<Environment>;
|
||||
export declare function createApp(app: RpCodeApp): Promise<App>;
|
||||
export declare function saveApp(appNameOrLogicalName: string, app: RpCodeApp): Promise<App>;
|
||||
export declare function publishApp(appNameOrLogicalName: string): Promise<void>;
|
||||
export declare function generateResourceStorage(): Promise<string>;
|
||||
export declare function startSession(appNameOrLogicalName: string): Promise<AppLeaseSessionResponse>;
|
||||
export declare function endSession(appNameOrLogicalName: string, sessionId: string): Promise<void>;
|
||||
export declare function makeAppSolutionAware(appNameOrLogicalName: string, solutionId: string): Promise<void>;
|
||||
//# sourceMappingURL=PowerAppsRpService.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerAppsRpService.d.ts","sourceRoot":"","sources":["../../../src/services/powerAppsRp/PowerAppsRpService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAErF,wBAAsB,aAAa,mBASlC;AAED,wBAAsB,oBAAoB,CAAC,eAAe,EAAE,MAAM,wBASjE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAU5D;AAED,wBAAsB,OAAO,CAAC,oBAAoB,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CASxF;AAED,wBAAsB,UAAU,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO5E;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAS/D;AAED,wBAAsB,YAAY,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAYjG;AAED,wBAAsB,UAAU,CAAC,oBAAoB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO/F;AAED,wBAAsB,oBAAoB,CAAC,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAU1F"}
|
||||
Generated
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import { getPlayerServiceConfig } from '../initializePlayerServices.js';
|
||||
import { getPowerPlatformApiEnvironmentConfig } from '../PowerPlatformApiUtils.js';
|
||||
export async function listAppsAsync() {
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/apps?api-version=1`;
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
return response.data.value;
|
||||
}
|
||||
export async function getEnvironmentByName(environmentName) {
|
||||
const { httpClient, apiVersions } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/environment?api-version=${apiVersions.environment}&$filter=name eq '${environmentName}'`;
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
export async function createApp(app) {
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/apps?api-version=1`;
|
||||
const response = await httpClient.post(url, {
|
||||
authResource,
|
||||
body: app,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
export async function saveApp(appNameOrLogicalName, app) {
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/apps/${appNameOrLogicalName}?api-version=1`;
|
||||
const result = await httpClient.put(url, {
|
||||
authResource,
|
||||
body: app,
|
||||
});
|
||||
return result.data;
|
||||
}
|
||||
export async function publishApp(appNameOrLogicalName) {
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/apps/${appNameOrLogicalName}/publish?api-version=1`;
|
||||
await httpClient.post(url, {
|
||||
authResource,
|
||||
});
|
||||
}
|
||||
export async function generateResourceStorage() {
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/generateResourceStorage?api-version=1`;
|
||||
const result = await httpClient.post(url, {
|
||||
authResource,
|
||||
});
|
||||
return result.data.sharedAccessSignature;
|
||||
}
|
||||
export async function startSession(appNameOrLogicalName) {
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/apps/${appNameOrLogicalName}/startSession?forceStartNewSession=true&api-version=1`;
|
||||
const result = await httpClient.post(url, {
|
||||
authResource,
|
||||
body: {
|
||||
sessionType: 'Writer',
|
||||
},
|
||||
});
|
||||
return result.data;
|
||||
}
|
||||
export async function endSession(appNameOrLogicalName, sessionId) {
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/apps/${appNameOrLogicalName}/sessions/${sessionId}/endSession?api-version=1`;
|
||||
await httpClient.post(url, {
|
||||
authResource,
|
||||
});
|
||||
}
|
||||
export async function makeAppSolutionAware(appNameOrLogicalName, solutionId) {
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig();
|
||||
const url = `https://${endpoint}/powerapps/apps/${appNameOrLogicalName}/makeSolutionAware?api-version=1`;
|
||||
await httpClient.post(url, {
|
||||
authResource,
|
||||
body: {
|
||||
solutionId,
|
||||
},
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=PowerAppsRpService.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerAppsRpService.js","sourceRoot":"","sources":["../../../src/services/powerAppsRp/PowerAppsRpService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAIhF,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,+BAA+B,CAAC;IAC/D,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,GAAG,CAAmB,GAAG,EAAE;QAC3D,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;AAC7B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,eAAuB;IAChE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAC7D,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,sCAAsC,WAAW,CAAC,WAAW,qBAAqB,eAAe,GAAG,CAAC;IACpI,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,GAAG,CAAc,GAAG,EAAE;QACtD,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAc;IAC5C,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,+BAA+B,CAAC;IAC/D,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,IAAI,CAAM,GAAG,EAAE;QAC/C,YAAY;QACZ,IAAI,EAAE,GAAG;KACV,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,oBAA4B,EAAE,GAAc;IACxE,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,mBAAmB,oBAAoB,gBAAgB,CAAC;IACvF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAM,GAAG,EAAE;QAC5C,YAAY;QACZ,IAAI,EAAE,GAAG;KACV,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,oBAA4B;IAC3D,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,mBAAmB,oBAAoB,wBAAwB,CAAC;IAC/F,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE;QACzB,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,kDAAkD,CAAC;IAClF,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAoC,GAAG,EAAE;QAC3E,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,oBAA4B;IAC7D,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,mBAAmB,oBAAoB,uDAAuD,CAAC;IAC9H,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAA0B,GAAG,EAAE;QACjE,YAAY;QACZ,IAAI,EAAE;YACJ,WAAW,EAAE,QAAQ;SACtB;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,oBAA4B,EAAE,SAAiB;IAC9E,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,mBAAmB,oBAAoB,aAAa,SAAS,2BAA2B,CAAC;IACxH,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE;QACzB,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,oBAA4B,EAAE,UAAkB;IACzF,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAChD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,WAAW,QAAQ,mBAAmB,oBAAoB,kCAAkC,CAAC;IACzG,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE;QACzB,YAAY;QACZ,IAAI,EAAE;YACJ,UAAU;SACX;KACF,CAAC,CAAC;AACL,CAAC"}
|
||||
Generated
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { CdsDatabaseReference, ConnectionReference } from '../types/ApiTypes.js';
|
||||
export type RpCodeApp = {
|
||||
appType: string;
|
||||
appSubtype?: string;
|
||||
properties: RpAppProperties;
|
||||
};
|
||||
type RpAppProperties = {
|
||||
appOpenUri?: string;
|
||||
displayName: string;
|
||||
description: string;
|
||||
backgroundColor: string;
|
||||
backgroundImageUri: string;
|
||||
environment: {
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
createdByClientVersion: {
|
||||
major: number;
|
||||
};
|
||||
appUris: {
|
||||
documentUri?: {
|
||||
value: string;
|
||||
readonlyValue: string;
|
||||
};
|
||||
codeAppPackageUri?: {
|
||||
value: string;
|
||||
readonlyValue: string;
|
||||
};
|
||||
};
|
||||
lifeCycleId: string;
|
||||
connectionReferences?: Record<string, ConnectionReference>;
|
||||
databaseReferences?: Record<string, CdsDatabaseReference>;
|
||||
};
|
||||
export type AppLeaseSessionResponse = {
|
||||
currentSession: {
|
||||
sessionId: string;
|
||||
};
|
||||
};
|
||||
export {};
|
||||
//# sourceMappingURL=PowerAppsRpService.types.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerAppsRpService.types.d.ts","sourceRoot":"","sources":["../../../src/services/powerAppsRp/PowerAppsRpService.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEnF,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,sBAAsB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,OAAO,EAAE;QACP,WAAW,CAAC,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,aAAa,EAAE,MAAM,CAAC;SACvB,CAAC;QACF,iBAAiB,CAAC,EAAE;YAClB,KAAK,EAAE,MAAM,CAAC;YACd,aAAa,EAAE,MAAM,CAAC;SACvB,CAAC;KACH,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC3D,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC"}
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=PowerAppsRpService.types.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerAppsRpService.types.js","sourceRoot":"","sources":["../../../src/services/powerAppsRp/PowerAppsRpService.types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { ILogger } from '../types/PlayerServices.types.js';
|
||||
import type { FlowMetadataResponse } from './PowerAutomateRpService.types.js';
|
||||
export declare function getFlowMetadataAsync(flowId: string, logger?: ILogger): Promise<FlowMetadataResponse>;
|
||||
export declare function getFlowSwaggerAsync(flowId: string, logger?: ILogger): Promise<unknown>;
|
||||
//# sourceMappingURL=PowerAutomateRpService.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerAutomateRpService.d.ts","sourceRoot":"","sources":["../../../src/services/powerAutomateRp/PowerAutomateRpService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,oBAAoB,CAAC,CAsB/B;AAED,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAsB5F"}
|
||||
Generated
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import { getPlayerServiceConfig } from '../initializePlayerServices.js';
|
||||
import { getBapRPAuthResource, getPowerPlatformApiEnvironmentConfig, } from '../PowerPlatformApiUtils.js';
|
||||
export async function getFlowMetadataAsync(flowId, logger) {
|
||||
const scenario = logger?.trackScenario('GetFlowMetadataAsync', { flowId });
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig(getBapRPAuthResource());
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const url = `https://${endpoint}/powerautomate/flows/${flowId}?api-version=1&$expand=properties,properties.connectionreferences.apidefinition`;
|
||||
const response = await httpClient.get(url, {
|
||||
authResource,
|
||||
});
|
||||
additionalScenarioData = { url, authResource, status: response.status };
|
||||
if (response.status === 200) {
|
||||
scenario?.complete(additionalScenarioData);
|
||||
return response.data;
|
||||
}
|
||||
else {
|
||||
scenario?.completeWithError(additionalScenarioData);
|
||||
throw new Error(`Unexpected response status ${response.status} from ${url}`);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
export async function getFlowSwaggerAsync(flowId, logger) {
|
||||
const scenario = logger?.trackScenario('GetFlowSwaggerAsync', { flowId });
|
||||
let additionalScenarioData = {};
|
||||
try {
|
||||
const { endpoint, authResource } = getPowerPlatformApiEnvironmentConfig(getBapRPAuthResource());
|
||||
const { httpClient } = getPlayerServiceConfig();
|
||||
const url = `https://${endpoint}/powerautomate/flows/${flowId}/listSwagger?api-version=2024-10-01`;
|
||||
const response = await httpClient.post(url, {
|
||||
authResource,
|
||||
});
|
||||
additionalScenarioData = { url, authResource, status: response.status };
|
||||
if (response.status === 200) {
|
||||
scenario?.complete(additionalScenarioData);
|
||||
return response.data;
|
||||
}
|
||||
else {
|
||||
scenario?.completeWithError(additionalScenarioData);
|
||||
throw new Error(`Unexpected response status ${response.status} from ${url}`);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
scenario?.failure({ error, ...additionalScenarioData });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=PowerAutomateRpService.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerAutomateRpService.js","sourceRoot":"","sources":["../../../src/services/powerAutomateRp/PowerAutomateRpService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,oCAAoC,GACrC,MAAM,0BAA0B,CAAC;AAIlC,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,MAAgB;IAEhB,MAAM,QAAQ,GAAG,MAAM,EAAE,aAAa,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3E,IAAI,sBAAsB,GAA4B,EAAE,CAAC;IACzD,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAChG,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;QAChD,MAAM,GAAG,GAAG,WAAW,QAAQ,wBAAwB,MAAM,iFAAiF,CAAC;QAC/I,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,GAAG,CAAuB,GAAG,EAAE;YAC/D,YAAY;SACb,CAAC,CAAC;QACH,sBAAsB,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACxE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,QAAQ,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;YAC3C,OAAO,QAAQ,CAAC,IAA4B,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,QAAQ,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,sBAAsB,EAAE,CAAC,CAAC;QACxD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAc,EAAE,MAAgB;IACxE,MAAM,QAAQ,GAAG,MAAM,EAAE,aAAa,CAAC,qBAAqB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1E,IAAI,sBAAsB,GAA4B,EAAE,CAAC;IACzD,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,oCAAoC,CAAC,oBAAoB,EAAE,CAAC,CAAC;QAChG,MAAM,EAAE,UAAU,EAAE,GAAG,sBAAsB,EAAE,CAAC;QAChD,MAAM,GAAG,GAAG,WAAW,QAAQ,wBAAwB,MAAM,qCAAqC,CAAC;QACnG,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,IAAI,CAAU,GAAG,EAAE;YACnD,YAAY;SACb,CAAC,CAAC;QACH,sBAAsB,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACxE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,QAAQ,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC;YAC3C,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,QAAQ,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,sBAAsB,EAAE,CAAC,CAAC;QACxD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
||||
Generated
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { Api } from '@microsoft/power-apps-common/types';
|
||||
export type FlowConnectionReferenceResponse = {
|
||||
id: string;
|
||||
displayName: string;
|
||||
connectionReferenceLogicalName: string;
|
||||
connectionName: string;
|
||||
apiDefinition: Api;
|
||||
source: string;
|
||||
};
|
||||
export type FlowTriggerSummary = {
|
||||
/** The trigger kind, e.g. "PowerApp", "PowerAppV2", "Http", "Recurrence". */
|
||||
kind?: string;
|
||||
/** The trigger type, e.g. "Request", "Recurrence". */
|
||||
type?: string;
|
||||
};
|
||||
export type FlowMetadataResponse = {
|
||||
name: string;
|
||||
properties: {
|
||||
displayName: string;
|
||||
workflowEntityId: string;
|
||||
connectionReferences: Record<string, FlowConnectionReferenceResponse>;
|
||||
/**
|
||||
* A summary of the flow's definition, including trigger metadata.
|
||||
* Populated when the API expands `properties`.
|
||||
*/
|
||||
definitionSummary?: {
|
||||
triggers?: FlowTriggerSummary[];
|
||||
};
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=PowerAutomateRpService.types.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerAutomateRpService.types.d.ts","sourceRoot":"","sources":["../../../src/services/powerAutomateRp/PowerAutomateRpService.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAC;AAE9D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,8BAA8B,EAAE,MAAM,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,GAAG,CAAC;IAEnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QACV,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAC;QACtE;;;WAGG;QACH,iBAAiB,CAAC,EAAE;YAClB,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAC;SACjC,CAAC;KACH,CAAC;CACH,CAAC"}
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=PowerAutomateRpService.types.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PowerAutomateRpService.types.js","sourceRoot":"","sources":["../../../src/services/powerAutomateRp/PowerAutomateRpService.types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
||||
Generated
Vendored
+226
@@ -0,0 +1,226 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export type App = {
|
||||
appType: AppType;
|
||||
appSubtype?: AppSubtype;
|
||||
id: string;
|
||||
logicalName?: string;
|
||||
metadataVersion?: number;
|
||||
name: string;
|
||||
properties: AppProperties;
|
||||
tags?: Record<string, string>;
|
||||
type: string;
|
||||
};
|
||||
export type ConnectionParameterDefinition = {
|
||||
/** Top-level parameter type, e.g. 'oauthSetting' for OAuth-handled params */
|
||||
type?: string;
|
||||
oAuthSettings?: {
|
||||
properties?: {
|
||||
IsFirstParty?: string;
|
||||
/** Whether this connector supports the OBO (on-behalf-of) silent SSO token flow. */
|
||||
IsOnbehalfofLoginSupported?: boolean;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
};
|
||||
uiDefinition?: {
|
||||
constraints?: {
|
||||
required?: 'true' | 'false';
|
||||
hidden?: 'true' | 'false';
|
||||
};
|
||||
[key: string]: unknown;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
};
|
||||
export type Api = {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
properties: {
|
||||
primaryRuntimeUrl: string;
|
||||
displayName: string;
|
||||
interfaces: {
|
||||
[key: string]: {
|
||||
revisions: {
|
||||
[key: string]: {
|
||||
baseUrl: string;
|
||||
status: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
swagger?: object;
|
||||
metadata?: {
|
||||
allowSharing?: boolean;
|
||||
};
|
||||
connectionParameters?: Record<string, ConnectionParameterDefinition>;
|
||||
connectionParameterSets?: {
|
||||
values?: Array<{
|
||||
name: string;
|
||||
parameters?: Record<string, ConnectionParameterDefinition>;
|
||||
metadata?: {
|
||||
allowSharing?: boolean;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
capabilities?: string[];
|
||||
};
|
||||
};
|
||||
export type Connection = {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
properties: {
|
||||
reference: string;
|
||||
displayName: string;
|
||||
apiId: string;
|
||||
connectionParametersSet?: {
|
||||
name: string;
|
||||
};
|
||||
api?: Api;
|
||||
/** Present when the PUT was made with $expand=ConsentLink */
|
||||
consentInfo?: {
|
||||
firstPartyLoginUri?: string;
|
||||
};
|
||||
/** Present only for on-premises gateway connections. */
|
||||
gatewayObject?: {
|
||||
id: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* Server-provided URLs used to verify the connection is live.
|
||||
* Returned by the connection PUT/GET; consumed by `testConnectionAsync`.
|
||||
*/
|
||||
testLinks?: Array<{
|
||||
requestUri: string;
|
||||
/** HTTP method to use. Known values: 'get' | 'post'. Defaults to 'get' when omitted. */
|
||||
method?: string;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
export type AppProperties = {
|
||||
aiGeneratedDescription?: string;
|
||||
almMode?: string;
|
||||
appOpenUri?: string;
|
||||
appOverrides?: object;
|
||||
appPackageDetails?: AppPackageDetails;
|
||||
appPlayUri?: string;
|
||||
appUris?: object;
|
||||
appVersion: string;
|
||||
authorizationReferences?: unknown[];
|
||||
backgroundColor: string;
|
||||
backgroundImageUri?: string;
|
||||
bypassConsent?: boolean;
|
||||
commitMessage?: string;
|
||||
connectionReferences?: Record<string, ConnectionReference>;
|
||||
createdByClientVersion?: {
|
||||
major: number;
|
||||
minor?: number;
|
||||
build?: number;
|
||||
revision?: number;
|
||||
};
|
||||
createdTime?: string;
|
||||
databaseReferences?: {
|
||||
[key: string]: CdsDatabaseReference;
|
||||
};
|
||||
description?: string;
|
||||
displayName: string;
|
||||
environment: Environment;
|
||||
hasCustomMiddleTier?: boolean;
|
||||
lastPublishTime?: string;
|
||||
lifeCycleId?: string;
|
||||
publisher?: string;
|
||||
};
|
||||
export type Environment = {
|
||||
id: string;
|
||||
name: string;
|
||||
properties: {
|
||||
displayName?: string;
|
||||
location?: string;
|
||||
environmentSku?: string;
|
||||
environmentType?: string;
|
||||
createdBy?: object;
|
||||
runtimeEndpoints?: object;
|
||||
linkedEnvironmentMetadata?: {
|
||||
baseLanguage?: number;
|
||||
createdTime?: string;
|
||||
domainName?: string;
|
||||
friendlyName?: string;
|
||||
instanceApiUrl?: string;
|
||||
instanceState?: string;
|
||||
instanceUrl?: string;
|
||||
platformSku?: string;
|
||||
resourceId?: string;
|
||||
uniqueName?: string;
|
||||
version?: string;
|
||||
};
|
||||
governanceConfiguration?: {
|
||||
protectionLevel?: 'basic' | 'standard';
|
||||
};
|
||||
updateCadence?: object;
|
||||
cluster?: EnvironmentCluster;
|
||||
};
|
||||
};
|
||||
export type EnvironmentCluster = {
|
||||
environment: 'Experiment' | 'Test' | 'Prod' | 'Gov' | 'Mooncake' | 'Rx' | 'Ex';
|
||||
category: 'Dev' | 'Prv' | 'Test' | 'Preprod' | 'FirstRelease' | 'Prod' | 'Gov' | 'High' | 'DoD' | 'Mooncake' | 'Ex' | 'Rx';
|
||||
geoShortName: string;
|
||||
number: string;
|
||||
uriSuffix: string;
|
||||
};
|
||||
export type ConnectionReference = {
|
||||
id: string;
|
||||
displayName: string;
|
||||
dataSources: string[];
|
||||
nestedActions: object[];
|
||||
actions: string[];
|
||||
parameterHintsV2: object;
|
||||
parameterHints: object;
|
||||
dependents: string[];
|
||||
dependencies: string[];
|
||||
dataSets: object;
|
||||
sharedConnectionId?: string | null;
|
||||
authenticationType?: string | null;
|
||||
};
|
||||
export type CdsDatabaseReference = {
|
||||
databaseDetails: {
|
||||
environmentName: string;
|
||||
overrideValues?: {
|
||||
environmentName?: string;
|
||||
environmentVariableName?: string;
|
||||
};
|
||||
linkedEnvironmentMetadata?: object;
|
||||
};
|
||||
dataSources?: {
|
||||
[key: string]: DatabaseDataSource;
|
||||
};
|
||||
components?: object[];
|
||||
actions?: string[];
|
||||
};
|
||||
export type DatabaseDataSource = {
|
||||
entitySetName: string;
|
||||
logicalName: string;
|
||||
overrideValues?: {
|
||||
entitySetName?: string;
|
||||
logicalName?: string;
|
||||
};
|
||||
apps?: string[];
|
||||
};
|
||||
export type AppPackageDetails = {
|
||||
appPackageResourcesKind?: string;
|
||||
playerPackage?: AppUri;
|
||||
unauthenticatedWebPackage?: AppUri;
|
||||
unauthenticatedModernRuntimePackage?: AppUri;
|
||||
webPackage?: AppUri;
|
||||
packagePropertiesJson?: string;
|
||||
logicalName?: string;
|
||||
id?: string;
|
||||
};
|
||||
export type AppUri = {
|
||||
value: string;
|
||||
readonlyValue?: string;
|
||||
};
|
||||
export type AppType = 'AppComponentLibrary' | 'ClassicCanvasApp' | 'CustomCanvasPage' | 'UnifiedApp' | 'CodeApp' | 'MobileApp';
|
||||
export type AppSubtype = 'AppBuilderApp' | 'BYOCApp' | 'CopilotCanvasApp' | 'PowerAppsApp';
|
||||
//# sourceMappingURL=ApiTypes.d.ts.map
|
||||
CodeApp_NeonReactor/node_modules/@microsoft/power-apps-actions/dist/services/types/ApiTypes.d.ts.map
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=ApiTypes.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApiTypes.js","sourceRoot":"","sources":["../../../src/services/types/ApiTypes.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
||||
Generated
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export type RequestConfig = {
|
||||
/** The authentication resource to be injected into the request as a bearer token */
|
||||
authResource?: string;
|
||||
/** The headers for the request */
|
||||
headers?: Record<string, string>;
|
||||
/** The type of response for the request. Defaults to json */
|
||||
responseType?: 'json' | 'text' | 'blob';
|
||||
/** The body of the request to send. Requires a JSON object */
|
||||
body?: unknown;
|
||||
/** Prevents default headers from being added to the request */
|
||||
excludeDefaultHeaders?: boolean;
|
||||
/** Use fetch implementation */
|
||||
useFetch?: boolean;
|
||||
/** operation name of the telemetry event we want logged */
|
||||
operationName?: string;
|
||||
/** event data of the telemetry event we want logged */
|
||||
eventData?: object;
|
||||
/** retryable error handler */
|
||||
handleRetry?: (originalRequest: Request, response: globalThis.Response) => Promise<Request | null>;
|
||||
};
|
||||
export type Response<T = unknown> = {
|
||||
data: T;
|
||||
status: number;
|
||||
headers: Record<string, string>;
|
||||
};
|
||||
export interface IHttpClient {
|
||||
get<T = unknown>(url: string, config?: RequestConfig): Promise<Response<T>>;
|
||||
post<T = unknown>(url: string, config?: RequestConfig): Promise<Response<T>>;
|
||||
patch<T = unknown>(url: string, config?: RequestConfig): Promise<Response<T>>;
|
||||
put<T = unknown>(url: string, config?: RequestConfig): Promise<Response<T>>;
|
||||
delete<T = unknown>(url: string, config?: RequestConfig): Promise<Response<T>>;
|
||||
}
|
||||
//# sourceMappingURL=IHttpClient.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IHttpClient.d.ts","sourceRoot":"","sources":["../../../src/services/types/IHttpClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACxC,8DAA8D;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+DAA+D;IAC/D,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,CACZ,eAAe,EAAE,OAAO,EACxB,QAAQ,EAAE,UAAU,CAAC,QAAQ,KAC1B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,OAAO,IAAI;IAClC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CAChF"}
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=IHttpClient.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IHttpClient.js","sourceRoot":"","sources":["../../../src/services/types/IHttpClient.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
||||
Generated
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { Region } from '@microsoft/power-apps-common/services';
|
||||
import type { IHttpClient } from './IHttpClient.js';
|
||||
export interface IPlayerServicesConfig {
|
||||
logger: ILogger;
|
||||
httpClient: IHttpClient;
|
||||
region: Region;
|
||||
environmentName: string;
|
||||
featureGates: FeatureGates;
|
||||
apiVersions: Required<ApiVersions>;
|
||||
}
|
||||
export interface IPlayerServiceOptions {
|
||||
logger: ILogger;
|
||||
httpClient: IHttpClient;
|
||||
region: Region;
|
||||
environmentName: string;
|
||||
featureGates?: FeatureGates;
|
||||
apiVersions?: ApiVersions;
|
||||
}
|
||||
export type FeatureGates = {
|
||||
usePowerPlatformAPI?: boolean;
|
||||
};
|
||||
export type ApiVersions = {
|
||||
bapRp?: string;
|
||||
launchService?: string;
|
||||
launchOperations?: string;
|
||||
monitoringHubLogAppOpen?: string;
|
||||
monitoringHubLogAppNavigate?: string;
|
||||
monitoringHubLogDataRequests?: string;
|
||||
requestAccess?: string;
|
||||
permissions?: string;
|
||||
modifyPermissions?: string;
|
||||
evaluateEntitlements?: string;
|
||||
appExtendedMetadata?: string;
|
||||
getPreloadMetadata?: string;
|
||||
getPublishMetadata?: string;
|
||||
copilotStatus?: string;
|
||||
neptune?: string;
|
||||
environment?: string;
|
||||
};
|
||||
export interface ILogger {
|
||||
trackActivityEvent(eventName: string, eventData?: object): void;
|
||||
trackErrorEvent(eventName: string, eventData?: object): void;
|
||||
trackScenario(name: string, scenarioData?: object): Scenario;
|
||||
stringifyError(err: unknown): string | null | undefined;
|
||||
}
|
||||
export type Scenario = {
|
||||
scenarioId: string;
|
||||
complete: (completeData?: object) => void;
|
||||
failure: (failureData?: object) => void;
|
||||
completeWithError: (completeWithErrorData?: object) => void;
|
||||
};
|
||||
//# sourceMappingURL=PlayerServices.types.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PlayerServices.types.d.ts","sourceRoot":"","sources":["../../../src/services/types/PlayerServices.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;CACpC;AAID,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAGD,MAAM,MAAM,YAAY,GAAG;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAGF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF,MAAM,WAAW,OAAO;IACtB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChE,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7D,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7D,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzD;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iBAAiB,EAAE,CAAC,qBAAqB,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7D,CAAC"}
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=PlayerServices.types.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PlayerServices.types.js","sourceRoot":"","sources":["../../../src/services/types/PlayerServices.types.ts"],"names":[],"mappings":""}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
import type { Region } from '@microsoft/power-apps-common/services';
|
||||
export type ServiceRegion = Exclude<Region, 'dev' | 'local'>;
|
||||
export type ServiceConfig = {
|
||||
endpoint: string;
|
||||
authResource: string;
|
||||
};
|
||||
export type ServiceDefinition = {
|
||||
endpoint: {
|
||||
[key in ServiceRegion]: string;
|
||||
};
|
||||
authResource: {
|
||||
[key in ServiceRegion]: string;
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=Services.types.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Services.types.d.ts","sourceRoot":"","sources":["../../../src/services/types/Services.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAEpE,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC;AAE7D,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE;SAAG,GAAG,IAAI,aAAa,GAAG,MAAM;KAAE,CAAC;IAC7C,YAAY,EAAE;SAAG,GAAG,IAAI,aAAa,GAAG,MAAM;KAAE,CAAC;CAClD,CAAC"}
|
||||
CodeApp_NeonReactor/node_modules/@microsoft/power-apps-actions/dist/services/types/Services.types.js
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=Services.types.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Services.types.js","sourceRoot":"","sources":["../../../src/services/types/Services.types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
||||
Reference in New Issue
Block a user