@microsoft/power-apps-cli 0.5.3 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Constants/HelpStrings.d.ts +3 -3
- package/lib/Constants/HelpStrings.js +3 -3
- package/lib/Constants/HelpStrings.js.map +1 -1
- package/lib/HttpClient/CliHttpClient.d.ts.map +1 -1
- package/lib/HttpClient/CliHttpClient.js +8 -1
- package/lib/HttpClient/CliHttpClient.js.map +1 -1
- package/lib/Verbs/AddDataSource.d.ts.map +1 -1
- package/lib/Verbs/AddDataSource.js +25 -18
- package/lib/Verbs/AddDataSource.js.map +1 -1
- package/lib/Verbs/DeleteDataSource.d.ts +1 -1
- package/lib/Verbs/DeleteDataSource.d.ts.map +1 -1
- package/lib/Verbs/DeleteDataSource.js +5 -4
- package/lib/Verbs/DeleteDataSource.js.map +1 -1
- package/lib/Verbs/Init.d.ts.map +1 -1
- package/lib/Verbs/Init.js +20 -0
- package/lib/Verbs/Init.js.map +1 -1
- package/lib/Verbs/ListConnectionReferences.js +6 -6
- package/lib/Verbs/ListConnectionReferences.js.map +1 -1
- package/lib/Verbs/ListEnvironmentVariables.js +6 -6
- package/lib/Verbs/ListEnvironmentVariables.js.map +1 -1
- package/lib/Verbs/Push.js +7 -10
- package/lib/Verbs/Push.js.map +1 -1
- package/lib/Verbs/VerbConstants.d.ts +1 -1
- package/lib/Verbs/VerbConstants.js +3 -3
- package/lib/Verbs/VerbConstants.js.map +1 -1
- package/lib/__tests__/E2eTests/addAndDeleteDataverseDS.test.js +4 -3
- package/lib/__tests__/E2eTests/addAndDeleteDataverseDS.test.js.map +1 -1
- package/lib/__tests__/E2eTests/addTop10Datasources.test.js +3 -2
- package/lib/__tests__/E2eTests/addTop10Datasources.test.js.map +1 -1
- package/lib/__tests__/E2eTests/cliHelp.test.js +4 -11
- package/lib/__tests__/E2eTests/cliHelp.test.js.map +1 -1
- package/lib/__tests__/helpers/e2eTestHelpers.d.ts +24 -0
- package/lib/__tests__/helpers/e2eTestHelpers.d.ts.map +1 -0
- package/lib/__tests__/helpers/e2eTestHelpers.js +28 -0
- package/lib/__tests__/helpers/e2eTestHelpers.js.map +1 -0
- package/lib-cjs/Constants/HelpStrings.d.ts +3 -3
- package/lib-cjs/Constants/HelpStrings.js +3 -3
- package/lib-cjs/Constants/HelpStrings.js.map +1 -1
- package/lib-cjs/HttpClient/CliHttpClient.d.ts.map +1 -1
- package/lib-cjs/HttpClient/CliHttpClient.js +8 -2
- package/lib-cjs/HttpClient/CliHttpClient.js.map +1 -1
- package/lib-cjs/Verbs/AddDataSource.d.ts.map +1 -1
- package/lib-cjs/Verbs/AddDataSource.js +44 -48
- package/lib-cjs/Verbs/AddDataSource.js.map +1 -1
- package/lib-cjs/Verbs/DeleteDataSource.d.ts +1 -1
- package/lib-cjs/Verbs/DeleteDataSource.d.ts.map +1 -1
- package/lib-cjs/Verbs/DeleteDataSource.js +15 -19
- package/lib-cjs/Verbs/DeleteDataSource.js.map +1 -1
- package/lib-cjs/Verbs/Init.d.ts.map +1 -1
- package/lib-cjs/Verbs/Init.js +39 -8
- package/lib-cjs/Verbs/Init.js.map +1 -1
- package/lib-cjs/Verbs/ListConnectionReferences.js +6 -6
- package/lib-cjs/Verbs/ListConnectionReferences.js.map +1 -1
- package/lib-cjs/Verbs/ListEnvironmentVariables.js +6 -6
- package/lib-cjs/Verbs/ListEnvironmentVariables.js.map +1 -1
- package/lib-cjs/Verbs/Push.js +11 -16
- package/lib-cjs/Verbs/Push.js.map +1 -1
- package/lib-cjs/Verbs/VerbConstants.d.ts +1 -1
- package/lib-cjs/Verbs/VerbConstants.js +3 -3
- package/lib-cjs/Verbs/VerbConstants.js.map +1 -1
- package/lib-cjs/__tests__/E2eTests/addAndDeleteDataverseDS.test.js +3 -2
- package/lib-cjs/__tests__/E2eTests/addAndDeleteDataverseDS.test.js.map +1 -1
- package/lib-cjs/__tests__/E2eTests/addTop10Datasources.test.js +2 -1
- package/lib-cjs/__tests__/E2eTests/addTop10Datasources.test.js.map +1 -1
- package/lib-cjs/__tests__/E2eTests/cliHelp.test.js +4 -11
- package/lib-cjs/__tests__/E2eTests/cliHelp.test.js.map +1 -1
- package/lib-cjs/__tests__/helpers/e2eTestHelpers.d.ts +23 -0
- package/lib-cjs/__tests__/helpers/e2eTestHelpers.d.ts.map +1 -0
- package/lib-cjs/__tests__/helpers/e2eTestHelpers.js +31 -0
- package/lib-cjs/__tests__/helpers/e2eTestHelpers.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/README.md +193 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.gbl.js +4844 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.gbl.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.gbl.min.js +7 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.gbl.min.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.integrity.json +46 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.js +4848 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.min.js +7 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties-4.3.9.min.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.gbl.js +4844 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.gbl.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.gbl.min.js +7 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.gbl.min.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.integrity.json +46 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.js +4848 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.min.js +7 -0
- package/node_modules/@microsoft/1ds-properties-js/bundle/es5/ms.properties.min.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist/es5/ms.properties.js +4827 -0
- package/node_modules/@microsoft/1ds-properties-js/dist/es5/ms.properties.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist/es5/ms.properties.min.js +7 -0
- package/node_modules/@microsoft/1ds-properties-js/dist/es5/ms.properties.min.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/DataModels.js +13 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/DataModels.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/ExtensionKeys.js +95 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/ExtensionKeys.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/Index.js +16 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/Index.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/InternalConstants.js +30 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/InternalConstants.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/PropertiesPlugin.js +200 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/PropertiesPlugin.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/SessionManager.js +168 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/SessionManager.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/TelemetryContext.js +286 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/TelemetryContext.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/Utils.js +106 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/Utils.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Application.js +178 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Application.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Cloud.js +17 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Cloud.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Device.js +17 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Device.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/IntWeb.js +58 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/IntWeb.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Loc.js +29 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Loc.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/OperatingSystem.js +176 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/OperatingSystem.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Sdk.js +71 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Sdk.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Session.js +47 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Session.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Trace.js +36 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Trace.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/User.js +102 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/User.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Utc.js +64 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Utc.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Web.js +274 -0
- package/node_modules/@microsoft/1ds-properties-js/dist-es5/context/Web.js.map +1 -0
- package/node_modules/@microsoft/1ds-properties-js/package.json +65 -0
- package/node_modules/@microsoft/1ds-properties-js/tsconfig.json +27 -0
- package/node_modules/@microsoft/1ds-properties-js/types/1ds-properties-js.d.ts +706 -0
- package/node_modules/@microsoft/1ds-properties-js/types/1ds-properties-js.namespaced.d.ts +2908 -0
- package/node_modules/@microsoft/powerapps-data/package.json +3 -3
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/AddDataSource.js +31 -25
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/AddDataSource.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/DataUtils.d.ts +6 -4
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/DataUtils.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/DataUtils.js +11 -5
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/DataUtils.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/DeleteDataSource.js +3 -3
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/DeleteDataSource.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/PushApp.js +10 -3
- package/node_modules/@microsoft/powerapps-player-actions/lib/Actions/PushApp.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/codeGenUtils.d.ts +20 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/codeGenUtils.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/codeGenUtils.js +79 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/codeGenUtils.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/dataSourceInfoProcessor.d.ts +2 -2
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/dataSourceInfoProcessor.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/dataSourceInfoProcessor.js +27 -68
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/dataSourceInfoProcessor.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/modelServiceGenerator.d.ts +0 -59
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/modelServiceGenerator.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/modelServiceGenerator.js +69 -281
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/modelServiceGenerator.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/nameUtility.d.ts +26 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/nameUtility.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/nameUtility.js +153 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/nameUtility.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/Types/ActionTypes.d.ts +16 -11
- package/node_modules/@microsoft/powerapps-player-actions/lib/Types/ActionTypes.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/AddDataSource.spec.js +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/AddDataSource.spec.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/AzureDevOpsModelServiceGenerator.spec.d.ts +5 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/AzureDevOpsModelServiceGenerator.spec.d.ts.map +1 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/AzureDevOpsModelServiceGenerator.spec.js +93 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/AzureDevOpsModelServiceGenerator.spec.js.map +1 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/DataSourceInfoProcessor.spec.js +897 -2
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/DataSourceInfoProcessor.spec.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/ModelServiceGenerator.spec.js +1 -17
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/ModelServiceGenerator.spec.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/arrayTypeGeneration.spec.d.ts +5 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/arrayTypeGeneration.spec.d.ts.map +1 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/arrayTypeGeneration.spec.js +63 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib/__tests__/arrayTypeGeneration.spec.js.map +1 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/AddDataSource.js +104 -86
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/AddDataSource.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/DataUtils.d.ts +6 -4
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/DataUtils.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/DataUtils.js +26 -4
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/DataUtils.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/DeleteDataSource.js +52 -46
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/DeleteDataSource.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/PushApp.js +9 -4
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Actions/PushApp.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/codeGenUtils.d.ts +20 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/codeGenUtils.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/codeGenUtils.js +86 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/codeGenUtils.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/dataSourceInfoProcessor.d.ts +2 -2
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/dataSourceInfoProcessor.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/dataSourceInfoProcessor.js +25 -67
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/dataSourceInfoProcessor.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/modelServiceGenerator.d.ts +0 -59
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/modelServiceGenerator.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/modelServiceGenerator.js +65 -279
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/modelServiceGenerator.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/nameUtility.d.ts +26 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/nameUtility.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/nameUtility.js +161 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/CodeGen/nameUtility.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Types/ActionTypes.d.ts +16 -11
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/Types/ActionTypes.d.ts.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/AddDataSource.spec.js +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/AddDataSource.spec.js.map +1 -1
- package/node_modules/@microsoft/{powerapps-data/lib/components/codeGen/dataSourceInfo.js → powerapps-player-actions/lib-cjs/__tests__/AzureDevOpsModelServiceGenerator.spec.d.ts} +0 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/AzureDevOpsModelServiceGenerator.spec.d.ts.map +1 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/AzureDevOpsModelServiceGenerator.spec.js +206 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/AzureDevOpsModelServiceGenerator.spec.js.map +1 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/DataSourceInfoProcessor.spec.js +1277 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/DataSourceInfoProcessor.spec.js.map +1 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/ModelServiceGenerator.spec.js +0 -32
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/ModelServiceGenerator.spec.js.map +1 -1
- package/node_modules/@microsoft/{powerapps-data/lib/__tests__/dataSourceInfoProcessor.test.d.ts → powerapps-player-actions/lib-cjs/__tests__/arrayTypeGeneration.spec.d.ts} +0 -1
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/arrayTypeGeneration.spec.d.ts.map +1 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/arrayTypeGeneration.spec.js +171 -0
- package/node_modules/@microsoft/powerapps-player-actions/lib-cjs/__tests__/arrayTypeGeneration.spec.js.map +1 -0
- package/node_modules/@microsoft/powerapps-player-actions/package.json +2 -2
- package/node_modules/@pa-client/powerapps-player-services/package.json +69 -69
- package/package.json +7 -5
- package/node_modules/@microsoft/powerapps-data/lib/__tests__/dataSourceInfoProcessor.test.d.ts.map +0 -1
- package/node_modules/@microsoft/powerapps-data/lib/__tests__/dataSourceInfoProcessor.test.js +0 -782
- package/node_modules/@microsoft/powerapps-data/lib/__tests__/dataSourceInfoProcessor.test.js.map +0 -1
- package/node_modules/@microsoft/powerapps-data/lib/components/codeGen/dataSourceInfo.d.ts +0 -28
- package/node_modules/@microsoft/powerapps-data/lib/components/codeGen/dataSourceInfo.d.ts.map +0 -1
- package/node_modules/@microsoft/powerapps-data/lib/components/codeGen/dataSourceInfo.js.map +0 -1
- package/node_modules/@microsoft/powerapps-data/lib/components/codeGen/dataSourceInfoProcessor.d.ts +0 -10
- package/node_modules/@microsoft/powerapps-data/lib/components/codeGen/dataSourceInfoProcessor.d.ts.map +0 -1
- package/node_modules/@microsoft/powerapps-data/lib/components/codeGen/dataSourceInfoProcessor.js +0 -530
- package/node_modules/@microsoft/powerapps-data/lib/components/codeGen/dataSourceInfoProcessor.js.map +0 -1
package/node_modules/@microsoft/powerapps-player-actions/lib/CodeGen/modelServiceGenerator.js
CHANGED
|
@@ -5,8 +5,8 @@ var _a;
|
|
|
5
5
|
import * as path from 'path';
|
|
6
6
|
import { ParameterPropertyInfo } from '../Common/parameterPropertyInfo';
|
|
7
7
|
import { getVfs } from '../VfsManager';
|
|
8
|
-
import { convertToValidIdentifier, getAllJsonFiles } from './codeGenUtils';
|
|
9
|
-
import { sanitizeName,
|
|
8
|
+
import { convertToValidIdentifier, getAllJsonFiles, isDataverseEntity, isSharepointSchema, isSqlStoredProcedure, } from './codeGenUtils';
|
|
9
|
+
import { extractModelName, formatPropertyName, getServiceName, isValidPropertyName, normalizePropertyName, sanitizeName, } from './nameUtility';
|
|
10
10
|
/**
|
|
11
11
|
* TypeScript type constants
|
|
12
12
|
*/
|
|
@@ -103,10 +103,10 @@ export class ModelServiceGenerator {
|
|
|
103
103
|
if (this.isSwaggerSchema(schema)) {
|
|
104
104
|
await this.handleSwaggerSchema(modelName, dataSourceName, schema, processedOutputDir, vfs);
|
|
105
105
|
}
|
|
106
|
-
else if (
|
|
106
|
+
else if (isSqlStoredProcedure(schema)) {
|
|
107
107
|
await this.handleSqlStoredProcedure(modelName, dataSourceName, schema, schemaJson, processedOutputDir, vfs);
|
|
108
108
|
}
|
|
109
|
-
else if (
|
|
109
|
+
else if (isSharepointSchema(schema)) {
|
|
110
110
|
await this.handleSharepointSchema(modelName, dataSourceName, schema, schemaJson, processedOutputDir, vfs);
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
@@ -118,7 +118,7 @@ export class ModelServiceGenerator {
|
|
|
118
118
|
*/
|
|
119
119
|
static async getModelNameFromSchema(schemaPath, vfs) {
|
|
120
120
|
const schema = await this.loadSchemaFromFile(schemaPath, vfs, false);
|
|
121
|
-
const { modelName } =
|
|
121
|
+
const { modelName } = extractModelName(schema, schemaPath, vfs);
|
|
122
122
|
return modelName;
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
@@ -132,7 +132,9 @@ export class ModelServiceGenerator {
|
|
|
132
132
|
if (typeof schema !== 'object' || schema === null || Array.isArray(schema)) {
|
|
133
133
|
throw new Error('Schema must be a valid JSON object');
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
// model name is used for the generated TypeScript interface and file names
|
|
136
|
+
// dataSourceName is the logical name of the datasource ex:entity set name for Dataverse
|
|
137
|
+
const { modelName, dataSourceName } = extractModelName(schema, schemaPath, vfs);
|
|
136
138
|
return {
|
|
137
139
|
schema: schema,
|
|
138
140
|
schemaJson,
|
|
@@ -179,128 +181,6 @@ export class ModelServiceGenerator {
|
|
|
179
181
|
!Array.isArray(schema.properties) &&
|
|
180
182
|
Object.prototype.hasOwnProperty.call(schema.properties, 'swagger'));
|
|
181
183
|
}
|
|
182
|
-
/**
|
|
183
|
-
* The extractModelName method extracts the model name and data source name from the schema.
|
|
184
|
-
* Returns an object with modelName and dataSourceName.
|
|
185
|
-
*/
|
|
186
|
-
static extractModelName(schema, schemaPath, vfs) {
|
|
187
|
-
if (!schema) {
|
|
188
|
-
throw new Error('Schema cannot be null.');
|
|
189
|
-
}
|
|
190
|
-
// Check if this is a Dataverse entity schema
|
|
191
|
-
if (this.isDataverseEntity(schema)) {
|
|
192
|
-
const entitySetName = this.getDataverseEntitySetName(schema);
|
|
193
|
-
if (entitySetName) {
|
|
194
|
-
const modelName = this.capitalizeForFileName(sanitizeName(entitySetName));
|
|
195
|
-
return { modelName, dataSourceName: entitySetName === null || entitySetName === void 0 ? void 0 : entitySetName.trim() };
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
const nameNode = this.getNameNode(schema);
|
|
199
|
-
let modelName;
|
|
200
|
-
let dataSourceName;
|
|
201
|
-
if (this.isSharedName(nameNode)) {
|
|
202
|
-
modelName = this.getDisplayName(schema);
|
|
203
|
-
dataSourceName = this.getSharedDataSourceName(nameNode);
|
|
204
|
-
}
|
|
205
|
-
else if (this.isGuid(nameNode)) {
|
|
206
|
-
modelName = this.getTitle(schema);
|
|
207
|
-
dataSourceName = modelName;
|
|
208
|
-
}
|
|
209
|
-
else if (this.isSqlStoredProcedure(schema)) {
|
|
210
|
-
modelName = sanitizeSqlName(nameNode);
|
|
211
|
-
dataSourceName = this.getParentFolderName(schemaPath, vfs);
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
modelName = /[\\/](sql)[\\/]/i.test(schemaPath) ? sanitizeSqlName(nameNode) : sanitizeName(nameNode);
|
|
215
|
-
dataSourceName = modelName;
|
|
216
|
-
}
|
|
217
|
-
modelName = this.capitalizeForFileName(sanitizeName(modelName));
|
|
218
|
-
return { modelName, dataSourceName };
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* The getNameNode method retrieves the name node from the schema.
|
|
222
|
-
*/
|
|
223
|
-
static getNameNode(schema) {
|
|
224
|
-
if (schema !== null && typeof schema === 'object' && !Array.isArray(schema)) {
|
|
225
|
-
const nameNode = schema.name;
|
|
226
|
-
if (typeof nameNode !== 'string' || !nameNode.trim()) {
|
|
227
|
-
throw new Error("No 'name' node found in schema");
|
|
228
|
-
}
|
|
229
|
-
return nameNode;
|
|
230
|
-
}
|
|
231
|
-
throw new Error('Schema must be a JSON object to extract name');
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* The isSharedName method checks if the name node is a shared name.
|
|
235
|
-
*/
|
|
236
|
-
static isSharedName(nameNode) {
|
|
237
|
-
return nameNode.toLowerCase().startsWith('shared_');
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* The getDisplayName method retrieves the display name from the schema.
|
|
241
|
-
*/
|
|
242
|
-
static getDisplayName(schema) {
|
|
243
|
-
if (schema !== null && typeof schema === 'object' && !Array.isArray(schema)) {
|
|
244
|
-
const properties = schema.properties;
|
|
245
|
-
if (typeof properties === 'object' && properties !== null && !Array.isArray(properties)) {
|
|
246
|
-
const displayName = properties.displayName;
|
|
247
|
-
if (typeof displayName !== 'string' || !displayName.trim()) {
|
|
248
|
-
throw new Error("No 'displayName' found in schema properties");
|
|
249
|
-
}
|
|
250
|
-
return displayName;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
throw new Error('Schema must be a JSON object with properties to extract displayName');
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* The getSharedDataSourceName method retrieves the shared data source name from the name node.
|
|
257
|
-
*/
|
|
258
|
-
static getSharedDataSourceName(nameNode) {
|
|
259
|
-
return sanitizeName(nameNode.replace(/^shared_/i, '')).toLowerCase();
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* The isGuid method checks if the name node is a GUID.
|
|
263
|
-
*/
|
|
264
|
-
static isGuid(nameNode) {
|
|
265
|
-
// GUID regex, C# Guid.TryParse equivalent
|
|
266
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(nameNode);
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* The isDataverseEntity method checks if the schema represents a Dataverse entity.
|
|
270
|
-
*/
|
|
271
|
-
static isDataverseEntity(schema) {
|
|
272
|
-
if (schema !== null && typeof schema === 'object' && !Array.isArray(schema)) {
|
|
273
|
-
const schemaObject = schema;
|
|
274
|
-
// Check if this has the Dataverse schema structure with schema.items
|
|
275
|
-
if (typeof schemaObject.schema === 'object' && schemaObject.schema !== null) {
|
|
276
|
-
const schemaProperty = schemaObject.schema;
|
|
277
|
-
if (typeof schemaProperty.items === 'object' && schemaProperty.items !== null) {
|
|
278
|
-
const items = schemaProperty.items;
|
|
279
|
-
return items['x-ms-dataverse-entity'] === true;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
return false;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* The getDataverseEntitySetName method retrieves the entity set name from a Dataverse schema.
|
|
287
|
-
*/
|
|
288
|
-
static getDataverseEntitySetName(schema) {
|
|
289
|
-
if (schema !== null && typeof schema === 'object' && !Array.isArray(schema)) {
|
|
290
|
-
const schemaObject = schema;
|
|
291
|
-
if (typeof schemaObject.schema === 'object' && schemaObject.schema !== null) {
|
|
292
|
-
const schemaProperty = schemaObject.schema;
|
|
293
|
-
if (typeof schemaProperty.items === 'object' && schemaProperty.items !== null) {
|
|
294
|
-
const items = schemaProperty.items;
|
|
295
|
-
const entitySetName = items['x-ms-dataverse-entityset'];
|
|
296
|
-
if (typeof entitySetName === 'string' && entitySetName.trim()) {
|
|
297
|
-
return entitySetName;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
184
|
/**
|
|
305
185
|
* Checks if a property is a Dataverse lookup column.
|
|
306
186
|
*/
|
|
@@ -336,42 +216,6 @@ export class ModelServiceGenerator {
|
|
|
336
216
|
static generateLookupValuePropertyName(lookupPropertyName) {
|
|
337
217
|
return `_${lookupPropertyName}_value`;
|
|
338
218
|
}
|
|
339
|
-
/**
|
|
340
|
-
* The getTitle method retrieves the title from the schema.
|
|
341
|
-
*/
|
|
342
|
-
static getTitle(schema) {
|
|
343
|
-
if (schema !== null && typeof schema === 'object' && !Array.isArray(schema)) {
|
|
344
|
-
const title = schema.title;
|
|
345
|
-
if (typeof title !== 'string' || !title.trim()) {
|
|
346
|
-
throw new Error("No 'title' found in schema");
|
|
347
|
-
}
|
|
348
|
-
return title;
|
|
349
|
-
}
|
|
350
|
-
throw new Error('Schema must be a JSON object to extract title');
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* The getParentFolderName method retrieves the parent folder name from the schema path.
|
|
354
|
-
*/
|
|
355
|
-
static getParentFolderName(schemaPath, vfs) {
|
|
356
|
-
const directoryName = vfs.dirname(schemaPath);
|
|
357
|
-
if (!directoryName) {
|
|
358
|
-
throw new Error('The schemaPath does not have a valid directory.');
|
|
359
|
-
}
|
|
360
|
-
const parentFolderName = vfs.basename(directoryName);
|
|
361
|
-
if (!parentFolderName) {
|
|
362
|
-
throw new Error('The directory does not have a valid parent folder name.');
|
|
363
|
-
}
|
|
364
|
-
return parentFolderName.toLowerCase();
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Capitalizes the first letter of a string for file naming purposes only
|
|
368
|
-
*/
|
|
369
|
-
static capitalizeForFileName(name) {
|
|
370
|
-
if (!name) {
|
|
371
|
-
return name;
|
|
372
|
-
}
|
|
373
|
-
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
374
|
-
}
|
|
375
219
|
/**
|
|
376
220
|
* The addCopyrightNotice method adds a copyright notice to the generated files.
|
|
377
221
|
*/
|
|
@@ -437,14 +281,14 @@ export class ModelServiceGenerator {
|
|
|
437
281
|
// Ensure schemaName is a string before passing to generateODataBindPropertyName
|
|
438
282
|
const schemaNameStr = typeof schemaName === 'string' ? schemaName : propName;
|
|
439
283
|
const odataBindProp = this.generateODataBindPropertyName(schemaNameStr);
|
|
440
|
-
const formattedPropName =
|
|
284
|
+
const formattedPropName = formatPropertyName(odataBindProp);
|
|
441
285
|
const optionalMark = requiredFields.has(propName) ? '' : '?';
|
|
442
286
|
lines.push(` ${formattedPropName}${optionalMark}: string;`);
|
|
443
287
|
}
|
|
444
288
|
continue;
|
|
445
289
|
}
|
|
446
|
-
let formattedPropName =
|
|
447
|
-
formattedPropName =
|
|
290
|
+
let formattedPropName = formatPropertyName(convertToValidIdentifier(propName));
|
|
291
|
+
formattedPropName = normalizePropertyName(formattedPropName);
|
|
448
292
|
const tsType = this.determineTypeScriptType(originalModelName, propValueAsObject, '', propName);
|
|
449
293
|
const optionalMark = requiredFields.has(propName) ? '' : '?';
|
|
450
294
|
this.addPropertyComment(lines, propValueAsObject, '');
|
|
@@ -475,8 +319,8 @@ export class ModelServiceGenerator {
|
|
|
475
319
|
if (lookupColumns.has(propName)) {
|
|
476
320
|
continue;
|
|
477
321
|
}
|
|
478
|
-
let formattedPropName =
|
|
479
|
-
formattedPropName =
|
|
322
|
+
let formattedPropName = formatPropertyName(convertToValidIdentifier(propName));
|
|
323
|
+
formattedPropName = normalizePropertyName(formattedPropName);
|
|
480
324
|
const tsType = this.determineTypeScriptType(modelName, propValueAsObject, '', propName);
|
|
481
325
|
const optionalMark = requiredFields.has(propName) ? '' : '?';
|
|
482
326
|
this.addPropertyComment(lines, propValueAsObject, '');
|
|
@@ -486,10 +330,10 @@ export class ModelServiceGenerator {
|
|
|
486
330
|
const lookupPropNames = Array.from(lookupColumns.keys());
|
|
487
331
|
for (const lookupPropName of lookupPropNames) {
|
|
488
332
|
// Add the lookup object property
|
|
489
|
-
lines.push(` ${
|
|
333
|
+
lines.push(` ${formatPropertyName(convertToValidIdentifier(lookupPropName))}?: object;`);
|
|
490
334
|
// Add the lookup value property (_propname_value)
|
|
491
335
|
const valuePropName = this.generateLookupValuePropertyName(lookupPropName);
|
|
492
|
-
const formattedValuePropName =
|
|
336
|
+
const formattedValuePropName = formatPropertyName(valuePropName);
|
|
493
337
|
lines.push(` ${formattedValuePropName}?: string;`);
|
|
494
338
|
}
|
|
495
339
|
lines.push('}');
|
|
@@ -614,11 +458,13 @@ export class ModelServiceGenerator {
|
|
|
614
458
|
*/
|
|
615
459
|
static generateModelFromSchema(modelName, definition) {
|
|
616
460
|
modelName = convertToValidIdentifier(this.simplifyGenericInterfaceName(modelName));
|
|
617
|
-
// Start with copyright notice
|
|
618
461
|
const lines = [];
|
|
619
|
-
|
|
620
|
-
//
|
|
621
|
-
if ('type' in definition &&
|
|
462
|
+
// If it's a simple type (e.g., string, number, boolean) and has no "properties" or "items", generate a type alias
|
|
463
|
+
// Note: We exclude definitions with "items" because those are array types that need special handling
|
|
464
|
+
if ('type' in definition &&
|
|
465
|
+
definition.type &&
|
|
466
|
+
!('properties' in definition) &&
|
|
467
|
+
!('items' in definition)) {
|
|
622
468
|
const tsType = this.mapJsonTypeToTypeScript(definition.type);
|
|
623
469
|
lines.push(`export type ${modelName} = ${tsType};`);
|
|
624
470
|
return lines.join('\n');
|
|
@@ -629,7 +475,18 @@ export class ModelServiceGenerator {
|
|
|
629
475
|
lines.push(this.generateTypeAliasForEmptyObject(modelName));
|
|
630
476
|
return lines.join('\n');
|
|
631
477
|
}
|
|
632
|
-
//
|
|
478
|
+
// Check if this is an array type definition
|
|
479
|
+
const isArrayType = definition.type === 'array' && itemsNode;
|
|
480
|
+
if (isArrayType) {
|
|
481
|
+
// For array types, generate an interface for the item type and a type alias for the array
|
|
482
|
+
const itemInterfaceName = `${modelName}Item`;
|
|
483
|
+
const itemModelCode = this.generatePropertyLines(itemInterfaceName, itemsNode);
|
|
484
|
+
lines.push(itemModelCode);
|
|
485
|
+
lines.push('');
|
|
486
|
+
lines.push(`export type ${modelName} = ${itemInterfaceName}[];`);
|
|
487
|
+
return lines.join('\n');
|
|
488
|
+
}
|
|
489
|
+
// If itemsNode exists but not an array type, pass that; otherwise, pass the full definition
|
|
633
490
|
const modelCode = itemsNode
|
|
634
491
|
? this.generatePropertyLines(modelName, itemsNode)
|
|
635
492
|
: this.generatePropertyLines(modelName, definition);
|
|
@@ -691,9 +548,9 @@ export class ModelServiceGenerator {
|
|
|
691
548
|
}
|
|
692
549
|
this.addInterfaceDeclarationWithPadding(lines, modelName, addInterfaceName, padding);
|
|
693
550
|
for (const [propName, propValue] of Object.entries(propertiesNode)) {
|
|
694
|
-
let formattedPropName =
|
|
551
|
+
let formattedPropName = formatPropertyName(convertToValidIdentifier(propName));
|
|
695
552
|
// Normalize specific property names (e.g., "resultsets" => "ResultSets")
|
|
696
|
-
formattedPropName =
|
|
553
|
+
formattedPropName = normalizePropertyName(formattedPropName);
|
|
697
554
|
const propValueAsObject = typeof propValue === 'object' && propValue !== null && !Array.isArray(propValue)
|
|
698
555
|
? propValue
|
|
699
556
|
: undefined;
|
|
@@ -705,13 +562,6 @@ export class ModelServiceGenerator {
|
|
|
705
562
|
this.closeInterfaceDeclarationWithPadding(lines, padding);
|
|
706
563
|
return lines.join('\n');
|
|
707
564
|
}
|
|
708
|
-
/**
|
|
709
|
-
* The normalizePropertyName method standardizes specific property names.
|
|
710
|
-
* For example, it converts "resultsets" to "ResultSets".
|
|
711
|
-
*/
|
|
712
|
-
static normalizePropertyName(propertyName) {
|
|
713
|
-
return propertyName.toLowerCase() === 'resultsets' ? 'ResultSets' : propertyName;
|
|
714
|
-
}
|
|
715
565
|
/**
|
|
716
566
|
* Checks if a property has optionset data (enum and x-ms-enum-values)
|
|
717
567
|
*/
|
|
@@ -723,7 +573,7 @@ export class ModelServiceGenerator {
|
|
|
723
573
|
* Generates the enum name for an optionset property
|
|
724
574
|
*/
|
|
725
575
|
static generateOptionsetEnumName(modelName, propName) {
|
|
726
|
-
const formattedPropName =
|
|
576
|
+
const formattedPropName = formatPropertyName(propName);
|
|
727
577
|
return `${modelName}${formattedPropName}`;
|
|
728
578
|
}
|
|
729
579
|
/**
|
|
@@ -882,11 +732,12 @@ export class ModelServiceGenerator {
|
|
|
882
732
|
/*
|
|
883
733
|
* The extractReferencedType method extracts the referenced type from the ref value.
|
|
884
734
|
* It splits the ref value by '/' and returns the last part as the type name.
|
|
735
|
+
* The result is converted to a valid TypeScript identifier (e.g., spaces become underscores).
|
|
885
736
|
*/
|
|
886
737
|
static extractReferencedType(refValue) {
|
|
887
738
|
const parts = refValue.split('/');
|
|
888
739
|
const typeName = parts[parts.length - 1];
|
|
889
|
-
return this.normalizeGenericTypeName(typeName);
|
|
740
|
+
return convertToValidIdentifier(this.normalizeGenericTypeName(typeName));
|
|
890
741
|
}
|
|
891
742
|
/*
|
|
892
743
|
* The mapDataverseTypeToTypeScript method maps Dataverse types to TypeScript types.
|
|
@@ -1002,17 +853,6 @@ export class ModelServiceGenerator {
|
|
|
1002
853
|
return TypeScriptTypes.UNKNOWN;
|
|
1003
854
|
}
|
|
1004
855
|
}
|
|
1005
|
-
/*
|
|
1006
|
-
* The formatPropertyName method formats the property name.
|
|
1007
|
-
* Skips formatting if the property name already starts and ends with quotes.
|
|
1008
|
-
*/
|
|
1009
|
-
static formatPropertyName(propName) {
|
|
1010
|
-
// Skip if already quoted
|
|
1011
|
-
if (propName.startsWith('"') && propName.endsWith('"')) {
|
|
1012
|
-
return propName;
|
|
1013
|
-
}
|
|
1014
|
-
return this.isValidPropertyName(propName) ? propName : `"${propName}"`;
|
|
1015
|
-
}
|
|
1016
856
|
/*
|
|
1017
857
|
* The addPropertyComment method adds a comment for the property.
|
|
1018
858
|
*/
|
|
@@ -1528,7 +1368,7 @@ export class ModelServiceGenerator {
|
|
|
1528
1368
|
* and operation ID as parameters.
|
|
1529
1369
|
*/
|
|
1530
1370
|
static addMethodWithoutParameters(operations, operationFuncName, outputModel, operationId, modelName) {
|
|
1531
|
-
operations.push(` public static async ${operationFuncName}(): Promise<IOperationResult<${outputModel}>> {`, ` const result = await ${modelName}Service.client.executeAsync<void, ${outputModel}>(`, ` {`, ` connectorOperation: {`, ` tableName: ${
|
|
1371
|
+
operations.push(` public static async ${operationFuncName}(): Promise<IOperationResult<${outputModel}>> {`, ` const result = await ${modelName}Service.client.executeAsync<void, ${outputModel}>(`, ` {`, ` connectorOperation: {`, ` tableName: ${getServiceName(modelName)},`, ` operationName: '${operationId}',`, ` },`, ` });`, ` return result;`, ` }`);
|
|
1532
1372
|
}
|
|
1533
1373
|
/*
|
|
1534
1374
|
* The addMethodWithParameters method generates a method with parameters for the service class.
|
|
@@ -1536,7 +1376,7 @@ export class ModelServiceGenerator {
|
|
|
1536
1376
|
* parameter object, output model, data source name, and operation ID as parameters.
|
|
1537
1377
|
*/
|
|
1538
1378
|
static addMethodWithParameters(operations, operationFuncName, parameterSignature, parametersType, parameterObject, outputModel, operationId, modelName) {
|
|
1539
|
-
operations.push(` public static async ${operationFuncName}(${parameterSignature}): Promise<IOperationResult<${outputModel}>> {`, ` const params: ${parametersType} = { ${parameterObject} };`, ` const result = await ${modelName}Service.client.executeAsync<${parametersType}, ${outputModel}>(`, ` {`, ` connectorOperation: {`, ` tableName: ${
|
|
1379
|
+
operations.push(` public static async ${operationFuncName}(${parameterSignature}): Promise<IOperationResult<${outputModel}>> {`, ` const params: ${parametersType} = { ${parameterObject} };`, ` const result = await ${modelName}Service.client.executeAsync<${parametersType}, ${outputModel}>(`, ` {`, ` connectorOperation: {`, ` tableName: ${getServiceName(modelName)},`, ` operationName: '${operationId}',`, ` parameters: params`, ` },`, ` });`, ` return result;`, ` }`);
|
|
1540
1380
|
}
|
|
1541
1381
|
/*
|
|
1542
1382
|
* The handleSqlStoredProcedure method handles the SQL stored procedure generation.
|
|
@@ -1720,46 +1560,13 @@ export class ModelServiceGenerator {
|
|
|
1720
1560
|
const serviceFilePath = vfs.join(outputDir, this.SERVICES_FOLDER, `${modelName}Service.ts`);
|
|
1721
1561
|
await this.writeToFile(serviceFilePath, [serviceCode], vfs);
|
|
1722
1562
|
}
|
|
1723
|
-
/*
|
|
1724
|
-
* The isSqlStoredProcedure method checks if the schema is a SQL stored procedure.
|
|
1725
|
-
* It returns true if the schema contains a "procedureresultschema" node.
|
|
1726
|
-
*/
|
|
1727
|
-
static isSqlStoredProcedure(schema) {
|
|
1728
|
-
// Logic to identify SQL stored procedures
|
|
1729
|
-
// Check if the "schema" node contains a "procedureresultschema" node
|
|
1730
|
-
if (schema !== null && typeof schema === 'object' && !Array.isArray(schema)) {
|
|
1731
|
-
const schemaObj = schema;
|
|
1732
|
-
const schemaNode = schemaObj.schema;
|
|
1733
|
-
if (typeof schemaNode === 'object' && schemaNode !== null && !Array.isArray(schemaNode)) {
|
|
1734
|
-
const schemaNodeObj = schemaNode;
|
|
1735
|
-
return !!schemaNodeObj.procedureresultschema;
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
return false;
|
|
1739
|
-
}
|
|
1740
|
-
/**
|
|
1741
|
-
* The isSharepointSchema method checks if the schema is a SharePoint schema.
|
|
1742
|
-
* It returns true if the schema contains SharePoint-specific indicators.
|
|
1743
|
-
*/
|
|
1744
|
-
static isSharepointSchema(schema) {
|
|
1745
|
-
// Logic to identify SharePoint schemas
|
|
1746
|
-
// Check if the schema has SharePoint-specific properties or structure
|
|
1747
|
-
if (schema !== null && typeof schema === 'object' && !Array.isArray(schema)) {
|
|
1748
|
-
const schemaObj = schema;
|
|
1749
|
-
// Check for referencedEntities which is common in SharePoint schemas
|
|
1750
|
-
if (schemaObj.referencedEntities && typeof schemaObj.referencedEntities === 'object') {
|
|
1751
|
-
return true;
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
return false;
|
|
1755
|
-
}
|
|
1756
1563
|
/*
|
|
1757
1564
|
* The handleStandardSchema method generates TypeScript models and services from any schema type.
|
|
1758
1565
|
* It routes to the appropriate handler based on schema type.
|
|
1759
1566
|
*/
|
|
1760
1567
|
static async handleStandardSchema(modelName, dataSourceName, schema, schemaJson, outputDir, vfs) {
|
|
1761
1568
|
// Check if this is a Dataverse entity schema (has nested schema.items structure)
|
|
1762
|
-
if (
|
|
1569
|
+
if (isDataverseEntity(schema)) {
|
|
1763
1570
|
await this.handleDataverseSchema(modelName, dataSourceName, schema, outputDir, vfs);
|
|
1764
1571
|
}
|
|
1765
1572
|
else {
|
|
@@ -1882,7 +1689,7 @@ export class ModelServiceGenerator {
|
|
|
1882
1689
|
*/
|
|
1883
1690
|
static addGetMethodForReferenceEntitiesCore(lines, modelName) {
|
|
1884
1691
|
// Add method summary
|
|
1885
|
-
lines.push(`/**`, `* Utility method to get possible values of a referenced entity by its name.`, `*/`, ` public static async getReferencedEntity(search: string, referencedEntityKeyNormalized: string): Promise<IOperationResult<unknown>> {`, ` const params: {search: string} = { search };`, ` const result = await ${modelName}Service.client.executeAsync<{search: string}, unknown>(`, ` {`, ` connectorOperation: {`, ` tableName: ${
|
|
1692
|
+
lines.push(`/**`, `* Utility method to get possible values of a referenced entity by its name.`, `*/`, ` public static async getReferencedEntity(search: string, referencedEntityKeyNormalized: string): Promise<IOperationResult<unknown>> {`, ` const params: {search: string} = { search };`, ` const result = await ${modelName}Service.client.executeAsync<{search: string}, unknown>(`, ` {`, ` connectorOperation: {`, ` tableName: ${getServiceName(modelName)},`, ` operationName: 'Get' + referencedEntityKeyNormalized,`, ` parameters: params`, ` }`, ` });`, ` return result;`, ` }`, ``);
|
|
1886
1693
|
}
|
|
1887
1694
|
/*
|
|
1888
1695
|
* The ensureCommonModelFileExists method checks if the CommonModels.ts file exists in the specified output directory.
|
|
@@ -1995,7 +1802,7 @@ export class ModelServiceGenerator {
|
|
|
1995
1802
|
// lines.push(`export interface ${modelName} {`);
|
|
1996
1803
|
for (const propName of Object.keys(propertiesNode)) {
|
|
1997
1804
|
let propNameNormalized = propName;
|
|
1998
|
-
if (!
|
|
1805
|
+
if (!isValidPropertyName(propName)) {
|
|
1999
1806
|
propNameNormalized = `"${propName}"`; // Enclose invalid property names in double quotes
|
|
2000
1807
|
}
|
|
2001
1808
|
const isRequired = requiredFields.has(propName);
|
|
@@ -2153,32 +1960,22 @@ export class ModelServiceGenerator {
|
|
|
2153
1960
|
primaryKey.value = propName;
|
|
2154
1961
|
}
|
|
2155
1962
|
// Check if the property name is valid
|
|
2156
|
-
if (!
|
|
1963
|
+
if (!isValidPropertyName(propName)) {
|
|
2157
1964
|
propName = `"${propName}"`; // Enclose invalid property names in double quotes
|
|
2158
1965
|
}
|
|
2159
1966
|
const isRequired = requiredFields.has(propertyName);
|
|
2160
1967
|
const optionalMark = isRequired ? '' : '?';
|
|
2161
1968
|
lines.push(` ${propName}${optionalMark}: ${propType};`);
|
|
2162
1969
|
}
|
|
2163
|
-
/*
|
|
2164
|
-
* The isValidPropertyName method checks if a property name is valid according to TypeScript rules.
|
|
2165
|
-
* A valid property name must start with a letter, underscore, or dollar sign
|
|
2166
|
-
* and can only contain letters, numbers, underscores, or dollar signs.
|
|
2167
|
-
*/
|
|
2168
|
-
static isValidPropertyName(propName) {
|
|
2169
|
-
// A valid property name must start with a letter, underscore, or dollar sign
|
|
2170
|
-
// and can only contain letters, numbers, underscores, or dollar signs
|
|
2171
|
-
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(propName);
|
|
2172
|
-
}
|
|
2173
1970
|
/*
|
|
2174
1971
|
* The generateTypeScriptService method generates a TypeScript service class for the model.
|
|
2175
1972
|
* It includes methods for CRUD operations and uses the Power SDK for data access.
|
|
2176
1973
|
*/
|
|
2177
|
-
static generateTypeScriptService(modelName, dataSourceName, primaryKey,
|
|
1974
|
+
static generateTypeScriptService(modelName, dataSourceName, primaryKey, isADataverseEntity) {
|
|
2178
1975
|
const lines = [];
|
|
2179
1976
|
this.addCopyrightNotice(lines);
|
|
2180
|
-
this.addStandardServiceImports(lines, modelName,
|
|
2181
|
-
this.addServiceClassDefinition(lines, modelName, dataSourceName, primaryKey,
|
|
1977
|
+
this.addStandardServiceImports(lines, modelName, isADataverseEntity, false);
|
|
1978
|
+
this.addServiceClassDefinition(lines, modelName, dataSourceName, primaryKey, isADataverseEntity);
|
|
2182
1979
|
return lines.join('\n');
|
|
2183
1980
|
}
|
|
2184
1981
|
/*
|
|
@@ -2195,10 +1992,10 @@ export class ModelServiceGenerator {
|
|
|
2195
1992
|
/*
|
|
2196
1993
|
* The addStandardServiceImports method adds the necessary imports for the service class.
|
|
2197
1994
|
*/
|
|
2198
|
-
static addStandardServiceImports(lines, modelName,
|
|
1995
|
+
static addStandardServiceImports(lines, modelName, isADataverseEntity, additionalLine = true) {
|
|
2199
1996
|
const imports = [...this.collectStandardImports('crud')];
|
|
2200
1997
|
imports.push(`import type { IGetOptions, IGetAllOptions } from '${this.RELATIVE_MODEL_PATH}/CommonModels';`, `import type { ${modelName} } from '${this.RELATIVE_MODEL_PATH}/${modelName}Model';`);
|
|
2201
|
-
if (
|
|
1998
|
+
if (isADataverseEntity) {
|
|
2202
1999
|
imports.push("import type { GetEntityMetadataOptions, EntityMetadata } from '@microsoft/power-apps/data/metadata/dataverse';");
|
|
2203
2000
|
}
|
|
2204
2001
|
lines.push(...imports.sort());
|
|
@@ -2251,9 +2048,9 @@ export class ModelServiceGenerator {
|
|
|
2251
2048
|
* The AddServiceClassDefinition method generates the service class definition.
|
|
2252
2049
|
* It takes the lines to write to, model name, data source name, schema, and response model name as parameters.
|
|
2253
2050
|
*/
|
|
2254
|
-
static addServiceClassDefinition(lines, modelName, dataSourceName, primaryKey,
|
|
2051
|
+
static addServiceClassDefinition(lines, modelName, dataSourceName, primaryKey, isADataverseEntity) {
|
|
2255
2052
|
this.addServiceClassHeader(lines, modelName, dataSourceName, true);
|
|
2256
|
-
this.addServiceMethods(lines, modelName, dataSourceName, primaryKey,
|
|
2053
|
+
this.addServiceMethods(lines, modelName, dataSourceName, primaryKey, isADataverseEntity);
|
|
2257
2054
|
lines.push('}');
|
|
2258
2055
|
lines.push('');
|
|
2259
2056
|
}
|
|
@@ -2270,14 +2067,14 @@ export class ModelServiceGenerator {
|
|
|
2270
2067
|
* The addServiceMethods method generates the CRUD methods for the service class.
|
|
2271
2068
|
* It includes create, update, delete, get, and getAll methods.
|
|
2272
2069
|
*/
|
|
2273
|
-
static addServiceMethods(lines, modelName, dataSourceName, primaryKey,
|
|
2070
|
+
static addServiceMethods(lines, modelName, dataSourceName, primaryKey, isADataverseEntity) {
|
|
2274
2071
|
const methods = [];
|
|
2275
2072
|
methods.push(this.generateCreateMethod(modelName, primaryKey));
|
|
2276
2073
|
methods.push(this.generateUpdateMethod(modelName, primaryKey));
|
|
2277
2074
|
methods.push(this.generateDeleteMethod(modelName));
|
|
2278
2075
|
methods.push(this.generateGetMethod(modelName));
|
|
2279
2076
|
methods.push(this.generateGetAllMethod(modelName));
|
|
2280
|
-
if (
|
|
2077
|
+
if (isADataverseEntity) {
|
|
2281
2078
|
methods.push(this.generateGetMetadataMethod(modelName));
|
|
2282
2079
|
}
|
|
2283
2080
|
for (const method of methods) {
|
|
@@ -2310,7 +2107,7 @@ export class ModelServiceGenerator {
|
|
|
2310
2107
|
return [
|
|
2311
2108
|
` public static async create(record: ${datatypeForCreate}): Promise<IOperationResult<${modelName}>> {`,
|
|
2312
2109
|
` const result = await ${modelName}Service.client.createRecordAsync<${datatypeForCreate}, ${modelName}>(`,
|
|
2313
|
-
` ${
|
|
2110
|
+
` ${getServiceName(modelName)},`,
|
|
2314
2111
|
` record`,
|
|
2315
2112
|
` );`,
|
|
2316
2113
|
` return result;`,
|
|
@@ -2325,7 +2122,7 @@ export class ModelServiceGenerator {
|
|
|
2325
2122
|
return [
|
|
2326
2123
|
` public static async update(id: string, changedFields: ${datatypeForUpdate}): Promise<IOperationResult<${modelName}>> {`,
|
|
2327
2124
|
` const result = await ${modelName}Service.client.updateRecordAsync<${datatypeForUpdate}, ${modelName}>(`,
|
|
2328
|
-
` ${
|
|
2125
|
+
` ${getServiceName(modelName)},`,
|
|
2329
2126
|
` id.toString(),`,
|
|
2330
2127
|
` changedFields`,
|
|
2331
2128
|
` );`,
|
|
@@ -2340,7 +2137,7 @@ export class ModelServiceGenerator {
|
|
|
2340
2137
|
return [
|
|
2341
2138
|
` public static async delete(id: string): Promise<void> {`,
|
|
2342
2139
|
` await ${modelName}Service.client.deleteRecordAsync(`,
|
|
2343
|
-
` ${
|
|
2140
|
+
` ${getServiceName(modelName)},`,
|
|
2344
2141
|
` id.toString());`,
|
|
2345
2142
|
` }`,
|
|
2346
2143
|
];
|
|
@@ -2352,7 +2149,7 @@ export class ModelServiceGenerator {
|
|
|
2352
2149
|
return [
|
|
2353
2150
|
` public static async get(id: string, options?: IGetOptions): Promise<IOperationResult<${modelName}>> {`,
|
|
2354
2151
|
` const result = await ${modelName}Service.client.retrieveRecordAsync<${modelName}>(`,
|
|
2355
|
-
` ${
|
|
2152
|
+
` ${getServiceName(modelName)},`,
|
|
2356
2153
|
` id.toString(),`,
|
|
2357
2154
|
` options`,
|
|
2358
2155
|
` );`,
|
|
@@ -2367,7 +2164,7 @@ export class ModelServiceGenerator {
|
|
|
2367
2164
|
return [
|
|
2368
2165
|
` public static async getAll(options?: IGetAllOptions): Promise<IOperationResult<${modelName}[]>> {`,
|
|
2369
2166
|
` const result = await ${modelName}Service.client.retrieveMultipleRecordsAsync<${modelName}>(`,
|
|
2370
|
-
` ${
|
|
2167
|
+
` ${getServiceName(modelName)},`,
|
|
2371
2168
|
` options`,
|
|
2372
2169
|
` );`,
|
|
2373
2170
|
` return result;`,
|
|
@@ -2383,7 +2180,7 @@ export class ModelServiceGenerator {
|
|
|
2383
2180
|
` dataverseRequest: {`,
|
|
2384
2181
|
` action: "getEntityMetadata",`,
|
|
2385
2182
|
` parameters: {`,
|
|
2386
|
-
` tableName: ${
|
|
2183
|
+
` tableName: ${getServiceName(modelName)},`,
|
|
2387
2184
|
` options: options as GetEntityMetadataOptions,`,
|
|
2388
2185
|
` },`,
|
|
2389
2186
|
` },`,
|
|
@@ -2408,7 +2205,7 @@ export class ModelServiceGenerator {
|
|
|
2408
2205
|
return [
|
|
2409
2206
|
` public static async create(record: ${datatypeForCreate}): Promise<IOperationResult<${returnType}>> {`,
|
|
2410
2207
|
` const result = await ${modelName}Service.client.createRecordAsync<${datatypeForCreate}, ${returnType}>(`,
|
|
2411
|
-
` ${
|
|
2208
|
+
` ${getServiceName(modelName)},`,
|
|
2412
2209
|
` record`,
|
|
2413
2210
|
` );`,
|
|
2414
2211
|
` return result;`,
|
|
@@ -2432,7 +2229,7 @@ export class ModelServiceGenerator {
|
|
|
2432
2229
|
return [
|
|
2433
2230
|
` public static async update(id: string, changedFields: ${datatypeForUpdate}): Promise<IOperationResult<${returnType}>> {`,
|
|
2434
2231
|
` const result = await ${modelName}Service.client.updateRecordAsync<${datatypeForUpdate}, ${returnType}>(`,
|
|
2435
|
-
` ${
|
|
2232
|
+
` ${getServiceName(modelName)},`,
|
|
2436
2233
|
` id.toString(),`,
|
|
2437
2234
|
` changedFields`,
|
|
2438
2235
|
` );`,
|
|
@@ -2447,7 +2244,7 @@ export class ModelServiceGenerator {
|
|
|
2447
2244
|
return [
|
|
2448
2245
|
` public static async delete(id: string): Promise<void> {`,
|
|
2449
2246
|
` await ${modelName}Service.client.deleteRecordAsync(`,
|
|
2450
|
-
` ${
|
|
2247
|
+
` ${getServiceName(modelName)},`,
|
|
2451
2248
|
` id.toString());`,
|
|
2452
2249
|
` }`,
|
|
2453
2250
|
];
|
|
@@ -2466,7 +2263,7 @@ export class ModelServiceGenerator {
|
|
|
2466
2263
|
return [
|
|
2467
2264
|
` public static async get(id: string, options?: IGetOptions): Promise<IOperationResult<${returnType}>> {`,
|
|
2468
2265
|
` const result = await ${modelName}Service.client.retrieveRecordAsync<${returnType}>(`,
|
|
2469
|
-
` ${
|
|
2266
|
+
` ${getServiceName(modelName)},`,
|
|
2470
2267
|
` id.toString(),`,
|
|
2471
2268
|
` options`,
|
|
2472
2269
|
` );`,
|
|
@@ -2482,7 +2279,7 @@ export class ModelServiceGenerator {
|
|
|
2482
2279
|
return [
|
|
2483
2280
|
` public static async getAll(options?: IGetAllOptions): Promise<IOperationResult<${returnType}[]>> {`,
|
|
2484
2281
|
` const result = await ${modelName}Service.client.retrieveMultipleRecordsAsync<${returnType}>(`,
|
|
2485
|
-
` ${
|
|
2282
|
+
` ${getServiceName(modelName)},`,
|
|
2486
2283
|
` options`,
|
|
2487
2284
|
` );`,
|
|
2488
2285
|
` return result;`,
|
|
@@ -2499,7 +2296,7 @@ export class ModelServiceGenerator {
|
|
|
2499
2296
|
return [
|
|
2500
2297
|
` public static async create(record: ${datatypeForCreate}): Promise<IOperationResult<${extendedInterfaceName}>> {`,
|
|
2501
2298
|
` const result = await ${modelName}Service.client.createRecordAsync<${datatypeForCreate}, ${extendedInterfaceName}>(`,
|
|
2502
|
-
` ${
|
|
2299
|
+
` ${getServiceName(modelName)},`,
|
|
2503
2300
|
` record`,
|
|
2504
2301
|
` );`,
|
|
2505
2302
|
` return result;`,
|
|
@@ -2516,7 +2313,7 @@ export class ModelServiceGenerator {
|
|
|
2516
2313
|
return [
|
|
2517
2314
|
` public static async update(id: string, changedFields: ${datatypeForUpdate}): Promise<IOperationResult<${extendedInterfaceName}>> {`,
|
|
2518
2315
|
` const result = await ${modelName}Service.client.updateRecordAsync<${datatypeForUpdate}, ${extendedInterfaceName}>(`,
|
|
2519
|
-
` ${
|
|
2316
|
+
` ${getServiceName(modelName)},`,
|
|
2520
2317
|
` id.toString(),`,
|
|
2521
2318
|
` changedFields`,
|
|
2522
2319
|
` );`,
|
|
@@ -2532,7 +2329,7 @@ export class ModelServiceGenerator {
|
|
|
2532
2329
|
return [
|
|
2533
2330
|
` public static async get(id: string, options?: IGetOptions): Promise<IOperationResult<${extendedInterfaceName}>> {`,
|
|
2534
2331
|
` const result = await ${modelName}Service.client.retrieveRecordAsync<${extendedInterfaceName}>(`,
|
|
2535
|
-
` ${
|
|
2332
|
+
` ${getServiceName(modelName)},`,
|
|
2536
2333
|
` id.toString(),`,
|
|
2537
2334
|
` options`,
|
|
2538
2335
|
` );`,
|
|
@@ -2548,7 +2345,7 @@ export class ModelServiceGenerator {
|
|
|
2548
2345
|
return [
|
|
2549
2346
|
` public static async getAll(options?: IGetAllOptions): Promise<IOperationResult<${extendedInterfaceName}[]>> {`,
|
|
2550
2347
|
` const result = await ${modelName}Service.client.retrieveMultipleRecordsAsync<${extendedInterfaceName}>(`,
|
|
2551
|
-
` ${
|
|
2348
|
+
` ${getServiceName(modelName)},`,
|
|
2552
2349
|
` options`,
|
|
2553
2350
|
` );`,
|
|
2554
2351
|
` return result;`,
|
|
@@ -2568,7 +2365,7 @@ export class ModelServiceGenerator {
|
|
|
2568
2365
|
` dataverseRequest: {`,
|
|
2569
2366
|
` action: "getEntityMetadata",`,
|
|
2570
2367
|
` parameters: {`,
|
|
2571
|
-
` tableName: ${
|
|
2368
|
+
` tableName: ${getServiceName(modelName)},`,
|
|
2572
2369
|
` options: options as GetEntityMetadataOptions,`,
|
|
2573
2370
|
` },`,
|
|
2574
2371
|
` },`,
|
|
@@ -2576,15 +2373,6 @@ export class ModelServiceGenerator {
|
|
|
2576
2373
|
` }`,
|
|
2577
2374
|
];
|
|
2578
2375
|
}
|
|
2579
|
-
/*
|
|
2580
|
-
* The getServiceName method generates a service name by appending "Service" to the given model name.
|
|
2581
|
-
*/
|
|
2582
|
-
static getServiceName(modelName) {
|
|
2583
|
-
if (!modelName || !modelName.trim()) {
|
|
2584
|
-
throw new Error('Model name cannot be null or empty.');
|
|
2585
|
-
}
|
|
2586
|
-
return `${modelName}Service.dataSourceName`;
|
|
2587
|
-
}
|
|
2588
2376
|
/**
|
|
2589
2377
|
* The generateIndexFile method creates an index.ts file that exports all models and services.
|
|
2590
2378
|
*/
|