powerbi-visuals-tools 7.0.0 → 7.0.1

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.
Files changed (48) hide show
  1. package/Changelog.md +4 -0
  2. package/certs/blank +0 -0
  3. package/lib/CertificateTools.js +262 -0
  4. package/lib/CommandManager.js +75 -0
  5. package/lib/ConsoleWriter.js +188 -0
  6. package/lib/FeatureManager.js +43 -0
  7. package/lib/LintValidator.js +61 -0
  8. package/lib/Package.js +46 -0
  9. package/lib/TemplateFetcher.js +111 -0
  10. package/lib/Visual.js +29 -0
  11. package/lib/VisualGenerator.js +221 -0
  12. package/lib/VisualManager.js +316 -0
  13. package/lib/WebPackWrap.js +274 -0
  14. package/lib/features/APIVersion.js +16 -0
  15. package/lib/features/AdvancedEditMode.js +12 -0
  16. package/lib/features/AllowInteractions.js +12 -0
  17. package/lib/features/AnalyticsPane.js +17 -0
  18. package/lib/features/BaseFeature.js +9 -0
  19. package/lib/features/Bookmarks.js +12 -0
  20. package/lib/features/ColorPalette.js +12 -0
  21. package/lib/features/ConditionalFormatting.js +12 -0
  22. package/lib/features/ContextMenu.js +12 -0
  23. package/lib/features/DrillDown.js +16 -0
  24. package/lib/features/FeatureTypes.js +23 -0
  25. package/lib/features/FetchMoreData.js +22 -0
  26. package/lib/features/FileDownload.js +12 -0
  27. package/lib/features/FormatPane.js +12 -0
  28. package/lib/features/HighContrast.js +12 -0
  29. package/lib/features/HighlightData.js +12 -0
  30. package/lib/features/KeyboardNavigation.js +12 -0
  31. package/lib/features/LandingPage.js +12 -0
  32. package/lib/features/LaunchURL.js +12 -0
  33. package/lib/features/LocalStorage.js +12 -0
  34. package/lib/features/Localizations.js +12 -0
  35. package/lib/features/ModalDialog.js +12 -0
  36. package/lib/features/RenderingEvents.js +13 -0
  37. package/lib/features/SelectionAcrossVisuals.js +12 -0
  38. package/lib/features/SyncSlicer.js +12 -0
  39. package/lib/features/Tooltips.js +12 -0
  40. package/lib/features/TotalSubTotal.js +12 -0
  41. package/lib/features/VisualVersion.js +12 -0
  42. package/lib/features/WarningIcon.js +12 -0
  43. package/lib/features/index.js +28 -0
  44. package/lib/utils.js +43 -0
  45. package/lib/webpack.config.js +169 -0
  46. package/package.json +7 -6
  47. package/.eslintrc.json +0 -21
  48. package/CVClientLA.md +0 -85
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class Tooltips {
3
+ static featureName = "Tooltips";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/add-tooltips";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain("tooltipService") && packageInstance.isCapabilityEnabled({ tooltips: {} });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class TotalSubTotal {
3
+ static featureName = "Total SubTotal";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/total-subtotal-api";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.Matrix;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({ subtotals: {} });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class VisualVersion {
3
+ static featureName = "Visual version";
4
+ static expectedVersionLength = 4;
5
+ static errorMessage = `${this.featureName} should consist of ${this.expectedVersionLength} parts. Update the pbiviz.json file`;
6
+ static severity = Severity.Error;
7
+ static stage = Stage.PreBuild;
8
+ static visualFeatureType = VisualFeatureType.All;
9
+ static isSupported(visual) {
10
+ return visual.isVisualVersionValid(this.expectedVersionLength);
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class WarningIcon {
3
+ static featureName = "Warning Icon";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/visual-display-warning-icon";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".displayWarningIcon");
11
+ }
12
+ }
@@ -0,0 +1,28 @@
1
+ import AdvancedEditMode from './AdvancedEditMode.js';
2
+ import AllowInteractions from './AllowInteractions.js';
3
+ import AnalyticsPane from './AnalyticsPane.js';
4
+ import Bookmarks from './Bookmarks.js';
5
+ import ColorPalette from './ColorPalette.js';
6
+ import ConditionalFormatting from './ConditionalFormatting.js';
7
+ import ContextMenu from './ContextMenu.js';
8
+ import DrillDown from './DrillDown.js';
9
+ import FetchMoreData from './FetchMoreData.js';
10
+ import FileDownload from './FileDownload.js';
11
+ import FormatPane from './FormatPane.js';
12
+ import HighContrast from './HighContrast.js';
13
+ import HighlightData from './HighlightData.js';
14
+ import KeyboardNavigation from './KeyboardNavigation.js';
15
+ import LandingPage from './LandingPage.js';
16
+ import LaunchURL from './LaunchURL.js';
17
+ import Localizations from './Localizations.js';
18
+ import LocalStorage from './LocalStorage.js';
19
+ import ModalDialog from './ModalDialog.js';
20
+ import RenderingEvents from './RenderingEvents.js';
21
+ import SelectionAcrossVisuals from './SelectionAcrossVisuals.js';
22
+ import SyncSlicer from './SyncSlicer.js';
23
+ import Tooltips from './Tooltips.js';
24
+ import TotalSubTotal from './TotalSubTotal.js';
25
+ import WarningIcon from './WarningIcon.js';
26
+ import APIVersion from './APIVersion.js';
27
+ import VisualVersion from './VisualVersion.js';
28
+ export { AdvancedEditMode, AllowInteractions, AnalyticsPane, Bookmarks, ColorPalette, ConditionalFormatting, ContextMenu, DrillDown, FetchMoreData, FileDownload, FormatPane, HighContrast, HighlightData, KeyboardNavigation, LandingPage, LaunchURL, Localizations, LocalStorage, ModalDialog, RenderingEvents, SelectionAcrossVisuals, SyncSlicer, Tooltips, TotalSubTotal, WarningIcon, APIVersion, VisualVersion };
package/lib/utils.js ADDED
@@ -0,0 +1,43 @@
1
+ import fs from 'fs-extra';
2
+ import https from "https";
3
+ import path from "path";
4
+ import { fileURLToPath } from 'node:url';
5
+ export function download(url, pathToFile) {
6
+ return new Promise((resolve, reject) => {
7
+ const fileStream = fs.createWriteStream(pathToFile);
8
+ https.get(url, (res) => {
9
+ res.pipe(fileStream);
10
+ fileStream.on('close', () => resolve(fileStream));
11
+ res.on('error', (error) => reject(error));
12
+ })
13
+ .on('error', (error) => reject(error));
14
+ });
15
+ }
16
+ export function createFolder(folderName) {
17
+ const folder = path.join("./", folderName);
18
+ fs.ensureDirSync(folder);
19
+ return folder;
20
+ }
21
+ export function getRootPath() {
22
+ const pathToDirectory = fileURLToPath(import.meta.url);
23
+ return path.join(pathToDirectory, "..", "..");
24
+ }
25
+ export function getJsPath(filePath) {
26
+ return filePath.replace(/\.json$/, '.mjs');
27
+ }
28
+ async function safelyImport(filePath) {
29
+ return fs.existsSync(filePath) && (await import(`file://${filePath}`)).default;
30
+ }
31
+ function safelyParse(filePath) {
32
+ return fs.existsSync(filePath) && JSON.parse(fs.readFileSync(filePath, "utf-8"));
33
+ }
34
+ export async function readJsonFromRoot(jsonFilename) {
35
+ const jsonPath = path.join(getRootPath(), jsonFilename);
36
+ const jsPath = getJsPath(jsonPath);
37
+ return (await safelyImport(jsPath)) || safelyParse(jsonPath);
38
+ }
39
+ export async function readJsonFromVisual(filePath, visualPath) {
40
+ const jsonPath = path.join(visualPath ?? process.cwd(), filePath);
41
+ const jsPath = getJsPath(jsonPath);
42
+ return (await safelyImport(jsPath)) || safelyParse(jsonPath);
43
+ }
@@ -0,0 +1,169 @@
1
+ import { getRootPath, readJsonFromRoot } from './utils.js';
2
+ import MiniCssExtractPlugin from "mini-css-extract-plugin";
3
+ import TerserPlugin from "terser-webpack-plugin";
4
+ import path from "path";
5
+ const config = await readJsonFromRoot("/config.json");
6
+ const rootPath = getRootPath();
7
+ const webpackConfig = {
8
+ entry: {
9
+ 'visual.js': ['./src/visual.ts']
10
+ },
11
+ target: 'web',
12
+ node: false,
13
+ devtool: false,
14
+ mode: "production",
15
+ optimization: {
16
+ minimizer: [
17
+ new TerserPlugin({
18
+ parallel: true,
19
+ terserOptions: {}
20
+ })
21
+ ],
22
+ minimize: false,
23
+ concatenateModules: false
24
+ },
25
+ performance: {
26
+ maxEntrypointSize: 1024000,
27
+ maxAssetSize: 1024000,
28
+ hints: false
29
+ },
30
+ module: {
31
+ rules: [
32
+ {
33
+ parser: {
34
+ amd: false
35
+ }
36
+ },
37
+ {
38
+ test: /\.m?js/,
39
+ resolve: {
40
+ fullySpecified: false
41
+ }
42
+ },
43
+ {
44
+ test: /\.json$/,
45
+ loader: "json-loader",
46
+ type: "javascript/auto"
47
+ },
48
+ {
49
+ test: /(\.less)|(\.css)$/,
50
+ use: [
51
+ {
52
+ loader: MiniCssExtractPlugin.loader
53
+ },
54
+ {
55
+ loader: "css-loader"
56
+ },
57
+ {
58
+ loader: "less-loader",
59
+ options: {
60
+ lessOptions: {
61
+ paths: [path.resolve(rootPath, 'node_modules')]
62
+ }
63
+ }
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ test: /\.(woff|ttf|ico|woff2|jpg|jpeg|png|webp|gif|svg|eot)$/i,
69
+ type: 'asset/inline'
70
+ }
71
+ ]
72
+ },
73
+ resolveLoader: {
74
+ modules: ['node_modules', path.resolve(rootPath, 'node_modules')],
75
+ },
76
+ externals: {
77
+ "powerbi-visuals-api": 'null',
78
+ // Prevent Node.js core modules from being bundled
79
+ "fs": "{}",
80
+ "path": "{}",
81
+ "os": "{}",
82
+ "crypto": "{}",
83
+ "http": "{}",
84
+ "https": "{}",
85
+ "url": "{}",
86
+ "util": "{}",
87
+ "stream": "{}",
88
+ "buffer": "{}",
89
+ "process": "{}",
90
+ "events": "{}",
91
+ "child_process": "{}",
92
+ "cluster": "{}",
93
+ "dgram": "{}",
94
+ "dns": "{}",
95
+ "net": "{}",
96
+ "readline": "{}",
97
+ "repl": "{}",
98
+ "tls": "{}",
99
+ "tty": "{}",
100
+ "zlib": "{}",
101
+ "constants": "{}",
102
+ "vm": "{}",
103
+ "assert": "{}"
104
+ },
105
+ resolve: {
106
+ symlinks: false,
107
+ extensions: ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.css'],
108
+ modules: ['node_modules', path.resolve(rootPath, 'node_modules')],
109
+ fallback: {
110
+ assert: false,
111
+ buffer: false,
112
+ console: false,
113
+ constants: false,
114
+ crypto: false,
115
+ domain: false,
116
+ events: false,
117
+ http: false,
118
+ https: false,
119
+ os: false,
120
+ path: false,
121
+ punycode: false,
122
+ process: false,
123
+ querystring: false,
124
+ stream: false,
125
+ _stream_duplex: false,
126
+ _stream_passthrough: false,
127
+ _stream_readable: false,
128
+ _stream_transform: false,
129
+ _stream_writable: false,
130
+ string_decoder: false,
131
+ sys: false,
132
+ timers: false,
133
+ tty: false,
134
+ url: false,
135
+ util: false,
136
+ vm: false,
137
+ zlib: false
138
+ }
139
+ },
140
+ output: {
141
+ path: null,
142
+ publicPath: 'assets',
143
+ filename: "[name]"
144
+ },
145
+ devServer: {
146
+ allowedHosts: "all",
147
+ static: {
148
+ directory: null
149
+ },
150
+ compress: true,
151
+ port: 8080,
152
+ hot: false,
153
+ server: 'https',
154
+ headers: {
155
+ "access-control-allow-origin": "*",
156
+ "cache-control": "public, max-age=0"
157
+ }
158
+ },
159
+ watchOptions: {
160
+ ignored: ['node_modules/**']
161
+ },
162
+ plugins: [
163
+ new MiniCssExtractPlugin({
164
+ filename: config.build.css,
165
+ chunkFilename: "[id].css"
166
+ })
167
+ ]
168
+ };
169
+ export default webpackConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerbi-visuals-tools",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Command line tool for creating and publishing visuals for Power BI",
5
5
  "main": "./bin/pbiviz.js",
6
6
  "type": "module",
@@ -40,27 +40,28 @@
40
40
  "inline-source-map": "^0.6.3",
41
41
  "json-loader": "0.5.7",
42
42
  "jszip": "^3.10.1",
43
- "less": "^4.4.1",
43
+ "less": "^4.4.2",
44
44
  "less-loader": "^12.3.0",
45
45
  "lodash.clonedeep": "4.5.0",
46
46
  "lodash.defaults": "4.2.0",
47
47
  "lodash.isequal": "4.5.0",
48
48
  "lodash.ismatch": "^4.4.0",
49
49
  "mini-css-extract-plugin": "^2.9.4",
50
+ "powerbi-visuals-api": "~5.3.0",
50
51
  "powerbi-visuals-webpack-plugin": "^4.3.1",
51
52
  "terser-webpack-plugin": "^5.3.14",
52
53
  "ts-loader": "^9.5.4",
53
54
  "typescript": "^5.9.3",
54
- "webpack": "^5.102.0",
55
+ "webpack": "^5.103.0",
55
56
  "webpack-bundle-analyzer": "4.10.2",
56
57
  "webpack-dev-server": "^5.2.2"
57
58
  },
58
59
  "devDependencies": {
59
- "@typescript-eslint/eslint-plugin": "^8.45.0",
60
- "eslint": "^9.36.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.47.0",
61
+ "eslint": "^9.39.1",
61
62
  "jasmine": "5.3.1",
62
63
  "jasmine-spec-reporter": "7.0.0",
63
- "semver": "7.7.2",
64
+ "semver": "7.7.3",
64
65
  "tree-kill": "1.2.2",
65
66
  "webpack-cli": "^6.0.1"
66
67
  },
package/.eslintrc.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "env": {
3
- "es6": true,
4
- "node": true
5
- },
6
- "parser": "@typescript-eslint/parser",
7
- "extends": "eslint:recommended",
8
- "plugins": [
9
- "@typescript-eslint"
10
- ],
11
- "parserOptions": {
12
- "ecmaVersion": 2023,
13
- "sourceType": "module",
14
- "project": "tsconfig.json",
15
- "tsconfigRootDir": "."
16
- },
17
- "rules": {
18
- "no-unused-vars": "off",
19
- "@typescript-eslint/no-unused-vars": "error"
20
- }
21
- }
package/CVClientLA.md DELETED
@@ -1,85 +0,0 @@
1
- **POWER BI CUSTOM VISUALS – STANDARD VISUALIZATION LICENSE TERMS**
2
-
3
- These license terms are an agreement between you and the visualization developer. Please read them.
4
- They apply to the visualization for Power BI you download from the Public AppSource store, including any updates
5
- or supplements for the visualization (the “Visualization”), unless the Visualization comes with separate
6
- terms, in which case those terms apply.
7
-
8
- **BY DOWNLOADING OR USING THE VISUALIZATION, OR ATTEMPTING TO DO ANY OF THESE, YOU
9
- ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, YOU HAVE NO RIGHT TO AND MUST NOT
10
- DOWNLOAD OR USE THE VISUALIZATION.**
11
-
12
- **The Visualization developer means the entity licensing the Visualization to you, as identified in the
13
- Public AppSource store.**
14
-
15
- **If you comply with these license terms, you have the rights below.**
16
-
17
- 1. **INSTALLATION AND USE RIGHTS.** You may install and use any number of copies of the Visualization
18
- for use with a product or service that supports the Power BI visual interface.
19
-
20
- 2. **INTERNET-BASED SERVICES.**
21
- **a. Consent for Internet-Based or Wireless Services.** The Visualization connects to computer systems
22
- over the Internet, which may include via a wireless network. Using the Visualization operates as your
23
- consent to the transmission of standard device information (including but not limited to technical
24
- information about your device, system and Visualization software, and peripherals) for internet-based
25
- or wireless services.
26
- **b. Misuse of Internet-based Services.** You may not use any Internet-based service in any way that could
27
- harm it or impair anyone else’s use of it or the wireless network. You may not use the service to try to
28
- gain unauthorized access to any service, data, account or network by any means.
29
- 3. **SCOPE OF LICENSE.** The Visualization is licensed, not sold. This agreement only gives you some rights
30
- to use the Visualization. Visualization developer reserves all other rights. Unless applicable law gives you
31
- more rights despite this limitation, you may use the Visualization only as expressly permitted in this
32
- agreement. You may not
33
- • work around any technical limitations in the Visualization; or
34
- • reverse engineer, decompile or disassemble the Visualization, except and only to the extent that
35
- applicable law expressly permits, despite this limitation.
36
- 4. **DOCUMENTATION.** If documentation is provided with the Visualization, you may copy and use the
37
- documentation for personal reference purposes.
38
- 5. **TECHNOLOGY AND EXPORT RESTRICTIONS.** The Visualization may be subject to United States or
39
- international technology control or export laws and regulations. You must comply with all domestic and
40
- international export laws and regulations that apply to the technology used or supported by the
41
- Visualization. These laws include restrictions on destinations, end users and end use. For information on
42
- Microsoft branded products, see www.microsoft.com/exporting.
43
- 6. **SUPPORT SERVICES.** Microsoft is not responsible for providing support services for the Visualization. If
44
- Microsoft is the Visualization developer, it may provide support services, but is not obligated to do so
45
- under this agreement. Contact the Visualization developer to determine what support services are
46
- available.
47
- 7. **ENTIRE AGREEMENT.** This agreement, any applicable Visualization developer privacy policy, and the
48
- terms for supplements and updates are the entire agreement between you and Visualization developer
49
- for the Visualization. If Microsoft is the Visualization developer, this agreement does not change the
50
- terms of your relationship with Microsoft with regard to Power BI, Microsoft Office, the Public AppSource store, or
51
- any other Microsoft product or service (which is governed by the software license terms that
52
- accompanied, or terms of use that are associated with, the applicable product or service).
53
- 8. **APPLICABLE LAW.**
54
- a. **United States. If you acquired the Visualization in the United States, Washington state law governs
55
- the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of
56
- laws principles. The laws of the state where you live govern all other claims, including claims under
57
- state consumer protection laws, unfair competition laws, and in tort.**
58
- b. **Outside the United States. If you acquired the Visualization in any other country, the laws of that
59
- country apply.**
60
-
61
- 9. **LEGAL EFFECT.** This agreement describes certain legal rights. You may have other rights under the
62
- laws of your state or country. This agreement does not change your rights under the laws of your state
63
- or country if the laws of your state or country do not permit it to do so.
64
- 10. **DISCLAIMER OF WARRANTY. TO THE FULLEST EXTENT PERMITTED BY LAW, (A) THE VISUALIZATION
65
- IS LICENSED "AS-IS," "WITH ALL FAULTS," AND "AS AVAILABLE" AND YOU BEAR ALL RISK OF USING IT;
66
- (B) THE VISUALIZATION DEVELOPER, ON BEHALF OF ITSELF, MICROSOFT (IF MICROSOFT IS NOT THE
67
- VISUALIZATION DEVELOPER), AND EACH OF OUR RESPECTIVE AFFILIATES, VENDORS, AGENTS AND
68
- SUPPLIERS, GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS IN RELATION TO THE
69
- VISUALIZATION; (C) YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS UNDER YOUR LOCAL LAWS
70
- THAT THIS AGREEMENT CANNOT CHANGE; AND (D) VISUALIZATION DEVELOPER AND MICROSOFT
71
- EXCLUDE ANY IMPLIED WARRANTIES OR CONDITIONS, INCLUDING THOSE OF MERCHANTABILITY,
72
- FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.**
73
- 11. **LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. TO THE EXTENT NOT PROHIBITED
74
- BY LAW, YOU CAN RECOVER FROM THE VISUALIZATION DEVELOPER ONLY DIRECT DAMAGES UP TO
75
- THE AMOUNT YOU PAID FOR THE VISUALIZATION OR $1.00, WHICHEVER IS GREATER. YOU WILL NOT,
76
- AND WAIVE ANY RIGHT TO, SEEK TO RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL,
77
- LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES FROM THE VISUALIZATION DEVELOPER.**
78
- **This limitation applies to
79
- • anything related to the Visualization or services made available through the Visualization; and
80
- • claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence,
81
- or other tort to the extent permitted by applicable law.
82
- It also applies even if
83
- • repair, replacement or a refund for the Visualization does not fully compensate you for any losses;
84
- or
85
- • Visualization developer knew or should have known about the possibility of the damages.**