@microsoft/power-apps-native-host 0.2.22
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/LICENSE +112 -0
- package/README.md +59 -0
- package/app.plugin.js +4 -0
- package/lib/NOTICE.txt +1659 -0
- package/lib/commonjs/ErrorBoundary.js +128 -0
- package/lib/commonjs/auth/AuthContext.js +281 -0
- package/lib/commonjs/bridge/NativePowerAppsBridge.js +279 -0
- package/lib/commonjs/bridge/setupNativeHost.js +65 -0
- package/lib/commonjs/connections/ConnectionSetupScreen.js +531 -0
- package/lib/commonjs/connections/disambiguate.js +88 -0
- package/lib/commonjs/connections/types.js +58 -0
- package/lib/commonjs/connections/useConnectionSetup.js +236 -0
- package/lib/commonjs/controls/FilePicker.js +183 -0
- package/lib/commonjs/controls/ImagePicker.js +236 -0
- package/lib/commonjs/index.js +246 -0
- package/lib/commonjs/logger.js +27 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/platform/PowerPlatformConnectionApi.js +606 -0
- package/lib/commonjs/platform/PowerPlatformEnvironmentApi.js +194 -0
- package/lib/commonjs/platform/resolveConnections.js +264 -0
- package/lib/commonjs/platform/useConnectionRefs.js +270 -0
- package/lib/commonjs/provider/PowerAppsHostProvider.js +336 -0
- package/lib/commonjs/provider/PowerAppsProvider.js +351 -0
- package/lib/commonjs/telemetry/index.js +70 -0
- package/lib/commonjs/theme/ThemeProvider.js +80 -0
- package/lib/commonjs/theme/tokens.js +50 -0
- package/lib/commonjs/utils/dataverseUtils.js +98 -0
- package/lib/commonjs/utils/isDevPlayer.js +27 -0
- package/lib/module/ErrorBoundary.js +122 -0
- package/lib/module/auth/AuthContext.js +276 -0
- package/lib/module/bridge/NativePowerAppsBridge.js +273 -0
- package/lib/module/bridge/setupNativeHost.js +62 -0
- package/lib/module/connections/ConnectionSetupScreen.js +526 -0
- package/lib/module/connections/disambiguate.js +83 -0
- package/lib/module/connections/types.js +60 -0
- package/lib/module/connections/useConnectionSetup.js +233 -0
- package/lib/module/controls/FilePicker.js +178 -0
- package/lib/module/controls/ImagePicker.js +231 -0
- package/lib/module/index.js +41 -0
- package/lib/module/logger.js +22 -0
- package/lib/module/package.json +1 -0
- package/lib/module/platform/PowerPlatformConnectionApi.js +595 -0
- package/lib/module/platform/PowerPlatformEnvironmentApi.js +186 -0
- package/lib/module/platform/resolveConnections.js +259 -0
- package/lib/module/platform/useConnectionRefs.js +267 -0
- package/lib/module/provider/PowerAppsHostProvider.js +332 -0
- package/lib/module/provider/PowerAppsProvider.js +345 -0
- package/lib/module/telemetry/index.js +55 -0
- package/lib/module/theme/ThemeProvider.js +63 -0
- package/lib/module/theme/tokens.js +46 -0
- package/lib/module/utils/dataverseUtils.js +90 -0
- package/lib/module/utils/isDevPlayer.js +23 -0
- package/lib/typescript/commonjs/ErrorBoundary.d.ts +30 -0
- package/lib/typescript/commonjs/auth/AuthContext.d.ts +57 -0
- package/lib/typescript/commonjs/bridge/NativePowerAppsBridge.d.ts +112 -0
- package/lib/typescript/commonjs/bridge/setupNativeHost.d.ts +39 -0
- package/lib/typescript/commonjs/connections/ConnectionSetupScreen.d.ts +107 -0
- package/lib/typescript/commonjs/connections/disambiguate.d.ts +43 -0
- package/lib/typescript/commonjs/connections/types.d.ts +91 -0
- package/lib/typescript/commonjs/connections/useConnectionSetup.d.ts +96 -0
- package/lib/typescript/commonjs/controls/FilePicker.d.ts +65 -0
- package/lib/typescript/commonjs/controls/ImagePicker.d.ts +76 -0
- package/lib/typescript/commonjs/index.d.ts +42 -0
- package/lib/typescript/commonjs/logger.d.ts +11 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/platform/PowerPlatformConnectionApi.d.ts +205 -0
- package/lib/typescript/commonjs/platform/PowerPlatformEnvironmentApi.d.ts +108 -0
- package/lib/typescript/commonjs/platform/resolveConnections.d.ts +86 -0
- package/lib/typescript/commonjs/platform/useConnectionRefs.d.ts +126 -0
- package/lib/typescript/commonjs/provider/PowerAppsHostProvider.d.ts +123 -0
- package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +148 -0
- package/lib/typescript/commonjs/telemetry/index.d.ts +48 -0
- package/lib/typescript/commonjs/theme/ThemeProvider.d.ts +30 -0
- package/lib/typescript/commonjs/theme/tokens.d.ts +27 -0
- package/lib/typescript/commonjs/utils/dataverseUtils.d.ts +39 -0
- package/lib/typescript/commonjs/utils/isDevPlayer.d.ts +19 -0
- package/lib/typescript/module/ErrorBoundary.d.ts +30 -0
- package/lib/typescript/module/auth/AuthContext.d.ts +57 -0
- package/lib/typescript/module/bridge/NativePowerAppsBridge.d.ts +112 -0
- package/lib/typescript/module/bridge/setupNativeHost.d.ts +39 -0
- package/lib/typescript/module/connections/ConnectionSetupScreen.d.ts +107 -0
- package/lib/typescript/module/connections/disambiguate.d.ts +43 -0
- package/lib/typescript/module/connections/types.d.ts +91 -0
- package/lib/typescript/module/connections/useConnectionSetup.d.ts +96 -0
- package/lib/typescript/module/controls/FilePicker.d.ts +65 -0
- package/lib/typescript/module/controls/ImagePicker.d.ts +76 -0
- package/lib/typescript/module/index.d.ts +42 -0
- package/lib/typescript/module/logger.d.ts +11 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/platform/PowerPlatformConnectionApi.d.ts +205 -0
- package/lib/typescript/module/platform/PowerPlatformEnvironmentApi.d.ts +108 -0
- package/lib/typescript/module/platform/resolveConnections.d.ts +86 -0
- package/lib/typescript/module/platform/useConnectionRefs.d.ts +126 -0
- package/lib/typescript/module/provider/PowerAppsHostProvider.d.ts +123 -0
- package/lib/typescript/module/provider/PowerAppsProvider.d.ts +148 -0
- package/lib/typescript/module/telemetry/index.d.ts +48 -0
- package/lib/typescript/module/theme/ThemeProvider.d.ts +30 -0
- package/lib/typescript/module/theme/tokens.d.ts +27 -0
- package/lib/typescript/module/utils/dataverseUtils.d.ts +39 -0
- package/lib/typescript/module/utils/isDevPlayer.d.ts +19 -0
- package/package.json +119 -0
- package/scripts/build-ios-base.js +96 -0
- package/scripts/bundle.js +95 -0
- package/scripts/generate-connector-schemas.js +75 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* generate-connector-schemas
|
|
4
|
+
*
|
|
5
|
+
* Auto-generates src/connectorSchemas.ts by scanning .power/schemas/ for
|
|
6
|
+
* connector schema JSON files placed there by `pac code add-data-source`.
|
|
7
|
+
*
|
|
8
|
+
* Run from the root of your Expo app (where .power/schemas/ lives):
|
|
9
|
+
* npx generate-connector-schemas
|
|
10
|
+
*
|
|
11
|
+
* Or wire it into package.json scripts:
|
|
12
|
+
* "prestart": "generate-connector-schemas"
|
|
13
|
+
*
|
|
14
|
+
* The generated file is re-created on every run and should be committed to
|
|
15
|
+
* source control so TypeScript can resolve the connector schema types at
|
|
16
|
+
* compile time.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
|
|
24
|
+
// Run relative to the calling app's working directory, not this script's location.
|
|
25
|
+
const appDir = process.cwd();
|
|
26
|
+
const schemasDir = path.join(appDir, '.power', 'schemas');
|
|
27
|
+
const outFile = path.join(appDir, 'src', 'generated', 'connectorSchemas.ts');
|
|
28
|
+
|
|
29
|
+
const imports = [];
|
|
30
|
+
const mapEntries = [];
|
|
31
|
+
|
|
32
|
+
if (fs.existsSync(schemasDir)) {
|
|
33
|
+
const directories = fs
|
|
34
|
+
.readdirSync(schemasDir, { withFileTypes: true })
|
|
35
|
+
.filter(d => d.isDirectory() && d.name !== 'appschemas');
|
|
36
|
+
|
|
37
|
+
for (const dir of directories) {
|
|
38
|
+
const schemaFile = path.join(schemasDir, dir.name, `${dir.name}.Schema.json`);
|
|
39
|
+
if (!fs.existsSync(schemaFile)) continue;
|
|
40
|
+
|
|
41
|
+
const varName = `${camelize(dir.name)}Schema`;
|
|
42
|
+
const relPath = `../../.power/schemas/${dir.name}/${dir.name}.Schema.json`;
|
|
43
|
+
imports.push(`import ${varName} from '${relPath}';`);
|
|
44
|
+
mapEntries.push(` ${dir.name}: ${varName},`);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
console.warn('[generate-connector-schemas] .power/schemas/ not found — emitting empty schemaMap.');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const content = `// AUTO-GENERATED — do not edit manually.
|
|
51
|
+
// Re-generated automatically on every \`npm run start\` / \`npm run build\`.
|
|
52
|
+
// To add a connector: pac code add-data-source (no further changes needed).
|
|
53
|
+
// Generator: @microsoft/power-apps-native-host/scripts/generate-connector-schemas.js
|
|
54
|
+
|
|
55
|
+
import type { ConnectorSchema } from '@microsoft/power-apps-native-host';
|
|
56
|
+
|
|
57
|
+
${imports.join('\n')}
|
|
58
|
+
|
|
59
|
+
export const schemaMap: Record<string, ConnectorSchema> = {
|
|
60
|
+
${mapEntries.join('\n')}
|
|
61
|
+
};
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
// Ensure the output directory exists.
|
|
65
|
+
fs.mkdirSync(path.dirname(outFile), { recursive: true });
|
|
66
|
+
fs.writeFileSync(outFile, content, 'utf8');
|
|
67
|
+
console.log(
|
|
68
|
+
`[generate-connector-schemas] ${mapEntries.length} connector(s) → src/generated/connectorSchemas.ts`,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
function camelize(str) {
|
|
74
|
+
return str.replace(/[-_](.)/g, (_, c) => c.toUpperCase());
|
|
75
|
+
}
|