@pnp/cli-microsoft365 7.0.0-beta.90ef876 → 7.0.0-beta.e25bf4a
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/dist/Command.js +1 -1
- package/dist/cli/Cli.js +23 -8
- package/dist/m365/aad/commands/user/user-get.js +7 -1
- package/dist/m365/aad/commands/user/user-set.js +20 -20
- package/dist/m365/booking/commands/business/business-get.js +14 -15
- package/dist/m365/cli/commands/config/config-set.js +1 -1
- package/dist/m365/pa/commands/app/app-consent-set.js +2 -2
- package/dist/m365/pa/commands/app/app-export.js +3 -3
- package/dist/m365/pa/commands/app/app-list.js +5 -5
- package/dist/m365/pa/commands/app/app-owner-set.js +115 -0
- package/dist/m365/pa/commands/app/app-permission-list.js +104 -0
- package/dist/m365/pa/commands.js +2 -0
- package/dist/m365/planner/commands/bucket/bucket-add.js +14 -10
- package/dist/m365/planner/commands/bucket/bucket-get.js +25 -19
- package/dist/m365/planner/commands/bucket/bucket-list.js +14 -10
- package/dist/m365/planner/commands/bucket/bucket-remove.js +26 -20
- package/dist/m365/planner/commands/bucket/bucket-set.js +26 -28
- package/dist/m365/planner/commands/roster/roster-member-add.js +3 -14
- package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +2 -2
- package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-list.js +2 -2
- package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-remove.js +3 -3
- package/dist/m365/pp/commands/card/card-clone.js +3 -3
- package/dist/m365/pp/commands/card/card-get.js +2 -2
- package/dist/m365/pp/commands/card/card-list.js +2 -2
- package/dist/m365/pp/commands/card/card-remove.js +3 -3
- package/dist/m365/pp/commands/chatbot/chatbot-get.js +2 -2
- package/dist/m365/pp/commands/chatbot/chatbot-list.js +3 -3
- package/dist/m365/pp/commands/chatbot/chatbot-remove.js +3 -3
- package/dist/m365/pp/commands/dataverse/dataverse-table-get.js +2 -2
- package/dist/m365/pp/commands/dataverse/dataverse-table-list.js +2 -2
- package/dist/m365/pp/commands/dataverse/dataverse-table-remove.js +2 -2
- package/dist/m365/pp/commands/dataverse/dataverse-table-row-list.js +2 -2
- package/dist/m365/pp/commands/dataverse/dataverse-table-row-remove.js +2 -2
- package/dist/m365/pp/commands/solution/solution-get.js +2 -2
- package/dist/m365/pp/commands/solution/solution-list.js +2 -2
- package/dist/m365/pp/commands/solution/solution-publish.js +3 -3
- package/dist/m365/pp/commands/solution/solution-publisher-add.js +2 -2
- package/dist/m365/pp/commands/solution/solution-publisher-get.js +2 -2
- package/dist/m365/pp/commands/solution/solution-publisher-list.js +2 -2
- package/dist/m365/pp/commands/solution/solution-publisher-remove.js +3 -3
- package/dist/m365/pp/commands/solution/solution-remove.js +3 -3
- package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +19 -17
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +19 -17
- package/dist/m365/search/commands/externalconnection/externalconnection-remove.js +35 -34
- package/dist/m365/spfx/commands/project/project-externalize/rules/DynamicRule.js +59 -51
- package/dist/m365/spo/commands/file/file-list.js +3 -14
- package/dist/m365/spo/commands/folder/folder-remove.js +30 -28
- package/dist/m365/spo/commands/list/list-add.js +0 -9
- package/dist/m365/spo/commands/list/list-retentionlabel-ensure.js +0 -4
- package/dist/m365/spo/commands/list/list-retentionlabel-get.js +0 -4
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +9 -47
- package/dist/m365/spo/commands/list/list-set.js +0 -9
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +4 -4
- package/dist/m365/spo/commands/page/page-remove.js +33 -31
- package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +25 -23
- package/dist/m365/spo/commands/site/site-apppermission-add.js +3 -3
- package/dist/m365/spo/commands/site/site-commsite-enable.js +9 -18
- package/dist/m365/spo/commands/site/site-set.js +10 -2
- package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +13 -16
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +80 -2
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +48 -48
- package/dist/m365/spo/commands/theme/theme-get.js +1 -2
- package/dist/m365/spo/commands/user/user-get.js +5 -5
- package/dist/m365/spo/commands.js +0 -2
- package/dist/m365/teams/commands/chat/chat-get.js +4 -4
- package/dist/m365/teams/commands/chat/chat-member-add.js +117 -0
- package/dist/m365/teams/commands/chat/chat-message-send.js +4 -4
- package/dist/m365/teams/commands/meeting/meeting-get.js +16 -24
- package/dist/m365/teams/commands/meeting/meeting-list.js +2 -15
- package/dist/m365/teams/commands/team/team-app-list.js +1 -1
- package/dist/m365/teams/commands.js +1 -0
- package/dist/utils/spo.js +74 -0
- package/docs/docs/_clisettings.mdx +1 -1
- package/docs/docs/cmd/_global.mdx +1 -1
- package/docs/docs/cmd/aad/user/user-get.mdx +118 -25
- package/docs/docs/cmd/aad/user/user-set.mdx +11 -11
- package/docs/docs/cmd/pa/app/app-consent-set.mdx +3 -3
- package/docs/docs/cmd/pa/app/app-export.mdx +3 -3
- package/docs/docs/cmd/pa/app/app-list.mdx +2 -2
- package/docs/docs/cmd/pa/app/app-owner-set.mdx +60 -0
- package/docs/docs/cmd/pa/app/app-permission-list.mdx +132 -0
- package/docs/docs/cmd/planner/bucket/bucket-add.mdx +21 -4
- package/docs/docs/cmd/planner/bucket/bucket-get.mdx +22 -5
- package/docs/docs/cmd/planner/bucket/bucket-list.mdx +21 -4
- package/docs/docs/cmd/planner/bucket/bucket-remove.mdx +21 -4
- package/docs/docs/cmd/planner/bucket/bucket-set.mdx +22 -5
- package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-get.mdx +4 -4
- package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-list.mdx +4 -4
- package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-remove.mdx +4 -4
- package/docs/docs/cmd/pp/card/card-clone.mdx +6 -6
- package/docs/docs/cmd/pp/card/card-get.mdx +6 -6
- package/docs/docs/cmd/pp/card/card-list.mdx +4 -4
- package/docs/docs/cmd/pp/card/card-remove.mdx +9 -9
- package/docs/docs/cmd/pp/chatbot/chatbot-get.mdx +6 -6
- package/docs/docs/cmd/pp/chatbot/chatbot-list.mdx +4 -4
- package/docs/docs/cmd/pp/chatbot/chatbot-remove.mdx +4 -4
- package/docs/docs/cmd/pp/dataverse/dataverse-table-get.mdx +2 -2
- package/docs/docs/cmd/pp/dataverse/dataverse-table-list.mdx +2 -2
- package/docs/docs/cmd/pp/dataverse/dataverse-table-remove.mdx +1 -1
- package/docs/docs/cmd/pp/dataverse/dataverse-table-row-list.mdx +5 -5
- package/docs/docs/cmd/pp/dataverse/dataverse-table-row-remove.mdx +5 -5
- package/docs/docs/cmd/pp/solution/solution-get.mdx +6 -6
- package/docs/docs/cmd/pp/solution/solution-list.mdx +4 -4
- package/docs/docs/cmd/pp/solution/solution-publish.mdx +4 -4
- package/docs/docs/cmd/pp/solution/solution-publisher-add.mdx +3 -3
- package/docs/docs/cmd/pp/solution/solution-publisher-get.mdx +6 -6
- package/docs/docs/cmd/pp/solution/solution-publisher-list.mdx +4 -4
- package/docs/docs/cmd/pp/solution/solution-publisher-remove.mdx +5 -5
- package/docs/docs/cmd/pp/solution/solution-remove.mdx +9 -9
- package/docs/docs/cmd/spo/file/file-list.mdx +6 -10
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/list/list-add.mdx +0 -3
- package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.mdx +0 -6
- package/docs/docs/cmd/spo/list/list-retentionlabel-get.mdx +0 -6
- package/docs/docs/cmd/spo/list/list-set.mdx +0 -3
- package/docs/docs/cmd/spo/listitem/listitem-attachment-list.mdx +7 -7
- package/docs/docs/cmd/spo/site/site-add.mdx +35 -0
- package/docs/docs/cmd/spo/site/site-appcatalog-add.mdx +5 -1
- package/docs/docs/cmd/spo/site/site-appcatalog-list.mdx +14 -0
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +68 -0
- package/docs/docs/cmd/spo/site/site-apppermission-get.mdx +55 -0
- package/docs/docs/cmd/spo/site/site-apppermission-list.mdx +55 -0
- package/docs/docs/cmd/spo/site/site-apppermission-remove.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-apppermission-set.mdx +66 -0
- package/docs/docs/cmd/spo/site/site-chrome-set.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-commsite-enable.mdx +11 -1
- package/docs/docs/cmd/spo/site/site-ensure.mdx +70 -0
- package/docs/docs/cmd/spo/site/site-get.mdx +179 -0
- package/docs/docs/cmd/spo/site/site-groupify.mdx +54 -0
- package/docs/docs/cmd/spo/site/site-hubsite-connect.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-hubsite-disconnect.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-hubsite-theme-sync.mdx +5 -1
- package/docs/docs/cmd/spo/site/site-inplacerecordsmanagement-set.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-list.mdx +303 -0
- package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +80 -0
- package/docs/docs/cmd/spo/site/site-recyclebinitem-restore.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-remove.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-rename.mdx +92 -0
- package/docs/docs/cmd/spo/site/site-set.mdx +13 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-add.mdx +116 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-apply.mdx +125 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-get.mdx +117 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-list.mdx +94 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-remove.mdx +4 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-grant.mdx +4 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-list.mdx +54 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-revoke.mdx +4 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-list.mdx +66 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-status-get.mdx +65 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-set.mdx +117 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-get.mdx +61 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-list.mdx +60 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-remove.mdx +4 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-add.mdx +75 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +62 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-list.mdx +60 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-remove.mdx +4 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-set.mdx +63 -0
- package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +53 -0
- package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +54 -0
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +4 -0
- package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +4 -0
- package/docs/docs/cmd/spo/tenant/tenant-appcatalog-add.mdx +4 -0
- package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.mdx +35 -0
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-set.mdx +12 -3
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-list.mdx +67 -0
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-remove.mdx +4 -0
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +50 -0
- package/docs/docs/cmd/spo/tenant/tenant-settings-list.mdx +729 -0
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.mdx +5 -0
- package/docs/docs/cmd/spo/theme/theme-apply.mdx +35 -0
- package/docs/docs/cmd/spo/theme/theme-get.mdx +74 -0
- package/docs/docs/cmd/spo/theme/theme-list.mdx +52 -0
- package/docs/docs/cmd/spo/theme/theme-remove.mdx +4 -0
- package/docs/docs/cmd/spo/theme/theme-set.mdx +4 -0
- package/docs/docs/cmd/spo/user/user-get.mdx +6 -6
- package/docs/docs/cmd/teams/chat/chat-member-add.mdx +66 -0
- package/npm-shrinkwrap.json +212 -212
- package/package.json +10 -10
|
@@ -57,7 +57,7 @@ class PpDataverseTableRemoveCommand extends PowerPlatformCommand_1.default {
|
|
|
57
57
|
removeDataverseTable(options) {
|
|
58
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
59
|
try {
|
|
60
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(options.
|
|
60
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(options.environmentName, options.asAdmin);
|
|
61
61
|
const requestOptions = {
|
|
62
62
|
url: `${dynamicsApiUrl}/api/data/v9.0/EntityDefinitions(LogicalName='${options.name}')`,
|
|
63
63
|
headers: {
|
|
@@ -82,7 +82,7 @@ _PpDataverseTableRemoveCommand_instances = new WeakSet(), _PpDataverseTableRemov
|
|
|
82
82
|
});
|
|
83
83
|
}, _PpDataverseTableRemoveCommand_initOptions = function _PpDataverseTableRemoveCommand_initOptions() {
|
|
84
84
|
this.options.unshift({
|
|
85
|
-
option: '-e, --
|
|
85
|
+
option: '-e, --environmentName <environmentName>'
|
|
86
86
|
}, {
|
|
87
87
|
option: '-n, --name <name>'
|
|
88
88
|
}, {
|
|
@@ -40,7 +40,7 @@ class PpDataverseTableRowListCommand extends PowerPlatformCommand_1.default {
|
|
|
40
40
|
logger.logToStderr('Retrieving list of table rows');
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
43
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
44
44
|
const entitySetName = yield this.getEntitySetName(dynamicsApiUrl, args);
|
|
45
45
|
if (this.verbose) {
|
|
46
46
|
logger.logToStderr('Entity set name is: ' + entitySetName);
|
|
@@ -80,7 +80,7 @@ _PpDataverseTableRowListCommand_instances = new WeakSet(), _PpDataverseTableRowL
|
|
|
80
80
|
});
|
|
81
81
|
}, _PpDataverseTableRowListCommand_initOptions = function _PpDataverseTableRowListCommand_initOptions() {
|
|
82
82
|
this.options.unshift({
|
|
83
|
-
option: '-e, --
|
|
83
|
+
option: '-e, --environmentName <environmentName>'
|
|
84
84
|
}, {
|
|
85
85
|
option: '--entitySetName [entitySetName]'
|
|
86
86
|
}, {
|
|
@@ -60,7 +60,7 @@ class PpDataverseTableRowRemoveCommand extends PowerPlatformCommand_1.default {
|
|
|
60
60
|
deleteTableRow(logger, args) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
62
|
try {
|
|
63
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
63
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
64
64
|
const entitySetName = yield this.getEntitySetName(dynamicsApiUrl, args);
|
|
65
65
|
if (this.verbose) {
|
|
66
66
|
logger.logToStderr('Entity set name is: ' + entitySetName);
|
|
@@ -107,7 +107,7 @@ _PpDataverseTableRowRemoveCommand_instances = new WeakSet(), _PpDataverseTableRo
|
|
|
107
107
|
});
|
|
108
108
|
}, _PpDataverseTableRowRemoveCommand_initOptions = function _PpDataverseTableRowRemoveCommand_initOptions() {
|
|
109
109
|
this.options.unshift({
|
|
110
|
-
option: '-e, --
|
|
110
|
+
option: '-e, --environmentName <environmentName>'
|
|
111
111
|
}, {
|
|
112
112
|
option: '-i, --id <id>'
|
|
113
113
|
}, {
|
|
@@ -45,7 +45,7 @@ class PpSolutionGetCommand extends PowerPlatformCommand_1.default {
|
|
|
45
45
|
logger.logToStderr(`Retrieving a specific solution '${args.options.id || args.options.name}'...`);
|
|
46
46
|
}
|
|
47
47
|
try {
|
|
48
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
48
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
49
49
|
const res = yield this.getSolution(dynamicsApiUrl, args.options);
|
|
50
50
|
if (!args.options.output || !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
|
|
51
51
|
logger.log(res);
|
|
@@ -96,7 +96,7 @@ _PpSolutionGetCommand_instances = new WeakSet(), _PpSolutionGetCommand_initTelem
|
|
|
96
96
|
});
|
|
97
97
|
}, _PpSolutionGetCommand_initOptions = function _PpSolutionGetCommand_initOptions() {
|
|
98
98
|
this.options.unshift({
|
|
99
|
-
option: '-e, --
|
|
99
|
+
option: '-e, --environmentName <environmentName>'
|
|
100
100
|
}, {
|
|
101
101
|
option: '-i, --id [id]'
|
|
102
102
|
}, {
|
|
@@ -42,7 +42,7 @@ class PpSolutionListCommand extends PowerPlatformCommand_1.default {
|
|
|
42
42
|
logger.logToStderr(`Retrieving list of solutions for which the user is an admin...`);
|
|
43
43
|
}
|
|
44
44
|
try {
|
|
45
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
45
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
46
46
|
const requestUrl = `${dynamicsApiUrl}/api/data/v9.0/solutions?$filter=isvisible eq true&$expand=publisherid($select=friendlyname)&$select=solutionid,uniquename,version,publisherid,installedon,solutionpackageversion,friendlyname,versionnumber&api-version=9.1`;
|
|
47
47
|
const res = yield odata_1.odata.getAllItems(requestUrl);
|
|
48
48
|
if (!args.options.output || !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
|
|
@@ -73,7 +73,7 @@ _PpSolutionListCommand_instances = new WeakSet(), _PpSolutionListCommand_initTel
|
|
|
73
73
|
});
|
|
74
74
|
}, _PpSolutionListCommand_initOptions = function _PpSolutionListCommand_initOptions() {
|
|
75
75
|
this.options.unshift({
|
|
76
|
-
option: '-e, --
|
|
76
|
+
option: '-e, --environmentName <environmentName>'
|
|
77
77
|
}, {
|
|
78
78
|
option: '--asAdmin'
|
|
79
79
|
});
|
|
@@ -41,7 +41,7 @@ class PpSolutionPublishCommand extends PowerPlatformCommand_1.default {
|
|
|
41
41
|
commandAction(logger, args) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
try {
|
|
44
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
44
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
45
45
|
const solutionId = yield this.getSolutionId(args, logger);
|
|
46
46
|
const solutionComponents = yield this.getSolutionComponents(dynamicsApiUrl, solutionId, logger);
|
|
47
47
|
const parameterXml = this.buildXmlRequestObject(solutionComponents, logger);
|
|
@@ -95,7 +95,7 @@ class PpSolutionPublishCommand extends PowerPlatformCommand_1.default {
|
|
|
95
95
|
logger.logToStderr(`Retrieving solutionId`);
|
|
96
96
|
}
|
|
97
97
|
const options = {
|
|
98
|
-
|
|
98
|
+
environmentName: args.options.environmentName,
|
|
99
99
|
name: args.options.name,
|
|
100
100
|
output: 'json',
|
|
101
101
|
debug: this.debug,
|
|
@@ -132,7 +132,7 @@ _PpSolutionPublishCommand_instances = new WeakSet(), _PpSolutionPublishCommand_i
|
|
|
132
132
|
});
|
|
133
133
|
}, _PpSolutionPublishCommand_initOptions = function _PpSolutionPublishCommand_initOptions() {
|
|
134
134
|
this.options.unshift({
|
|
135
|
-
option: '-e, --
|
|
135
|
+
option: '-e, --environmentName <environmentName>'
|
|
136
136
|
}, {
|
|
137
137
|
option: '-i, --id [id]'
|
|
138
138
|
}, {
|
|
@@ -39,7 +39,7 @@ class PpSolutionPublisherAddCommand extends PowerPlatformCommand_1.default {
|
|
|
39
39
|
logger.logToStderr(`Adding new publisher '${args.options.name}'...`);
|
|
40
40
|
}
|
|
41
41
|
try {
|
|
42
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
42
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
43
43
|
const requestOptions = {
|
|
44
44
|
url: `${dynamicsApiUrl}/api/data/v9.0/publishers`,
|
|
45
45
|
headers: {
|
|
@@ -69,7 +69,7 @@ _PpSolutionPublisherAddCommand_instances = new WeakSet(), _PpSolutionPublisherAd
|
|
|
69
69
|
});
|
|
70
70
|
}, _PpSolutionPublisherAddCommand_initOptions = function _PpSolutionPublisherAddCommand_initOptions() {
|
|
71
71
|
this.options.unshift({
|
|
72
|
-
option: '-e, --
|
|
72
|
+
option: '-e, --environmentName <environmentName>'
|
|
73
73
|
}, {
|
|
74
74
|
option: '-n, --name <name>'
|
|
75
75
|
}, {
|
|
@@ -56,7 +56,7 @@ class PpSolutionPublisherGetCommand extends PowerPlatformCommand_1.default {
|
|
|
56
56
|
responseType: 'json'
|
|
57
57
|
};
|
|
58
58
|
try {
|
|
59
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
59
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
60
60
|
if (args.options.id) {
|
|
61
61
|
requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/publishers(${args.options.id})?$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix&api-version=9.1`;
|
|
62
62
|
const result = yield request_1.default.get(requestOptions);
|
|
@@ -85,7 +85,7 @@ _PpSolutionPublisherGetCommand_instances = new WeakSet(), _PpSolutionPublisherGe
|
|
|
85
85
|
});
|
|
86
86
|
}, _PpSolutionPublisherGetCommand_initOptions = function _PpSolutionPublisherGetCommand_initOptions() {
|
|
87
87
|
this.options.unshift({
|
|
88
|
-
option: '-e, --
|
|
88
|
+
option: '-e, --environmentName <environmentName>'
|
|
89
89
|
}, {
|
|
90
90
|
option: '-i, --id [id]'
|
|
91
91
|
}, {
|
|
@@ -41,7 +41,7 @@ class PpSolutionPublisherListCommand extends PowerPlatformCommand_1.default {
|
|
|
41
41
|
logger.logToStderr(`Retrieving list of publishers...`);
|
|
42
42
|
}
|
|
43
43
|
try {
|
|
44
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
44
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
45
45
|
const requestOptions = {
|
|
46
46
|
url: `${dynamicsApiUrl}/api/data/v9.0/publishers?$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix${!args.options.includeMicrosoftPublishers ? `&$filter=publisherid ne 'd21aab70-79e7-11dd-8874-00188b01e34f'` : ''}&api-version=9.1`,
|
|
47
47
|
headers: {
|
|
@@ -67,7 +67,7 @@ _PpSolutionPublisherListCommand_instances = new WeakSet(), _PpSolutionPublisherL
|
|
|
67
67
|
});
|
|
68
68
|
}, _PpSolutionPublisherListCommand_initOptions = function _PpSolutionPublisherListCommand_initOptions() {
|
|
69
69
|
this.options.unshift({
|
|
70
|
-
option: '-e, --
|
|
70
|
+
option: '-e, --environmentName <environmentName>'
|
|
71
71
|
}, {
|
|
72
72
|
option: '--includeMicrosoftPublishers'
|
|
73
73
|
}, {
|
|
@@ -64,7 +64,7 @@ class PpSolutionPublisherRemoveCommand extends PowerPlatformCommand_1.default {
|
|
|
64
64
|
return args.options.id;
|
|
65
65
|
}
|
|
66
66
|
const options = {
|
|
67
|
-
|
|
67
|
+
environmentName: args.options.environmentName,
|
|
68
68
|
name: args.options.name,
|
|
69
69
|
output: 'json',
|
|
70
70
|
debug: this.debug,
|
|
@@ -78,7 +78,7 @@ class PpSolutionPublisherRemoveCommand extends PowerPlatformCommand_1.default {
|
|
|
78
78
|
deletePublisher(args) {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
try {
|
|
81
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
81
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
82
82
|
const publisherId = yield this.getPublisherId(args);
|
|
83
83
|
const requestOptions = {
|
|
84
84
|
url: `${dynamicsApiUrl}/api/data/v9.1/publishers(${publisherId})`,
|
|
@@ -106,7 +106,7 @@ _PpSolutionPublisherRemoveCommand_instances = new WeakSet(), _PpSolutionPublishe
|
|
|
106
106
|
});
|
|
107
107
|
}, _PpSolutionPublisherRemoveCommand_initOptions = function _PpSolutionPublisherRemoveCommand_initOptions() {
|
|
108
108
|
this.options.unshift({
|
|
109
|
-
option: '-e, --
|
|
109
|
+
option: '-e, --environmentName <environmentName>'
|
|
110
110
|
}, {
|
|
111
111
|
option: '-i, --id [id]'
|
|
112
112
|
}, {
|
|
@@ -64,7 +64,7 @@ class PpSolutionRemoveCommand extends PowerPlatformCommand_1.default {
|
|
|
64
64
|
return args.options.id;
|
|
65
65
|
}
|
|
66
66
|
const options = {
|
|
67
|
-
|
|
67
|
+
environmentName: args.options.environmentName,
|
|
68
68
|
name: args.options.name,
|
|
69
69
|
output: 'json',
|
|
70
70
|
debug: this.debug,
|
|
@@ -78,7 +78,7 @@ class PpSolutionRemoveCommand extends PowerPlatformCommand_1.default {
|
|
|
78
78
|
deleteSolution(args) {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
try {
|
|
81
|
-
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.
|
|
81
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
82
82
|
const solutionId = yield this.getSolutionId(args);
|
|
83
83
|
const requestOptions = {
|
|
84
84
|
url: `${dynamicsApiUrl}/api/data/v9.1/solutions(${solutionId})`,
|
|
@@ -106,7 +106,7 @@ _PpSolutionRemoveCommand_instances = new WeakSet(), _PpSolutionRemoveCommand_ini
|
|
|
106
106
|
});
|
|
107
107
|
}, _PpSolutionRemoveCommand_initOptions = function _PpSolutionRemoveCommand_initOptions() {
|
|
108
108
|
this.options.unshift({
|
|
109
|
-
option: '-e, --
|
|
109
|
+
option: '-e, --environmentName <environmentName>'
|
|
110
110
|
}, {
|
|
111
111
|
option: '-i, --id [id]'
|
|
112
112
|
}, {
|
|
@@ -36,23 +36,8 @@ class PurviewRetentionEventRemoveCommand extends GraphCommand_1.default {
|
|
|
36
36
|
}
|
|
37
37
|
commandAction(logger, args) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const removeRetentionEvent = () => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
try {
|
|
41
|
-
const requestOptions = {
|
|
42
|
-
url: `${this.resource}/v1.0/security/triggers/retentionEvents/${args.options.id}`,
|
|
43
|
-
headers: {
|
|
44
|
-
accept: 'application/json;odata.metadata=none'
|
|
45
|
-
},
|
|
46
|
-
responseType: 'json'
|
|
47
|
-
};
|
|
48
|
-
yield request_1.default.delete(requestOptions);
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
this.handleRejectedODataJsonPromise(err);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
39
|
if (args.options.force) {
|
|
55
|
-
yield removeRetentionEvent();
|
|
40
|
+
yield this.removeRetentionEvent(args.options);
|
|
56
41
|
}
|
|
57
42
|
else {
|
|
58
43
|
const result = yield Cli_1.Cli.prompt({
|
|
@@ -62,11 +47,28 @@ class PurviewRetentionEventRemoveCommand extends GraphCommand_1.default {
|
|
|
62
47
|
message: `Are you sure you want to remove the retention event ${args.options.id}?`
|
|
63
48
|
});
|
|
64
49
|
if (result.continue) {
|
|
65
|
-
yield removeRetentionEvent();
|
|
50
|
+
yield this.removeRetentionEvent(args.options);
|
|
66
51
|
}
|
|
67
52
|
}
|
|
68
53
|
});
|
|
69
54
|
}
|
|
55
|
+
removeRetentionEvent(options) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
try {
|
|
58
|
+
const requestOptions = {
|
|
59
|
+
url: `${this.resource}/beta/security/triggers/retentionEvents/${options.id}`,
|
|
60
|
+
headers: {
|
|
61
|
+
accept: 'application/json;odata.metadata=none'
|
|
62
|
+
},
|
|
63
|
+
responseType: 'json'
|
|
64
|
+
};
|
|
65
|
+
yield request_1.default.delete(requestOptions);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
this.handleRejectedODataJsonPromise(err);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
73
|
_PurviewRetentionEventRemoveCommand_instances = new WeakSet(), _PurviewRetentionEventRemoveCommand_initTelemetry = function _PurviewRetentionEventRemoveCommand_initTelemetry() {
|
|
72
74
|
this.telemetry.push((args) => {
|
|
@@ -36,23 +36,8 @@ class PurviewRetentionEventTypeRemoveCommand extends GraphCommand_1.default {
|
|
|
36
36
|
}
|
|
37
37
|
commandAction(logger, args) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const removeRetentionEventType = () => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
try {
|
|
41
|
-
const requestOptions = {
|
|
42
|
-
url: `${this.resource}/v1.0/security/triggerTypes/retentionEventTypes/${args.options.id}`,
|
|
43
|
-
headers: {
|
|
44
|
-
accept: 'application/json;odata.metadata=none'
|
|
45
|
-
},
|
|
46
|
-
responseType: 'json'
|
|
47
|
-
};
|
|
48
|
-
yield request_1.default.delete(requestOptions);
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
this.handleRejectedODataJsonPromise(err);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
39
|
if (args.options.force) {
|
|
55
|
-
yield removeRetentionEventType();
|
|
40
|
+
yield this.removeRetentionEventType(args.options);
|
|
56
41
|
}
|
|
57
42
|
else {
|
|
58
43
|
const result = yield Cli_1.Cli.prompt({
|
|
@@ -62,11 +47,28 @@ class PurviewRetentionEventTypeRemoveCommand extends GraphCommand_1.default {
|
|
|
62
47
|
message: `Are you sure you want to remove the retention event type with id ${args.options.id}?`
|
|
63
48
|
});
|
|
64
49
|
if (result.continue) {
|
|
65
|
-
yield removeRetentionEventType();
|
|
50
|
+
yield this.removeRetentionEventType(args.options);
|
|
66
51
|
}
|
|
67
52
|
}
|
|
68
53
|
});
|
|
69
54
|
}
|
|
55
|
+
removeRetentionEventType(options) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
try {
|
|
58
|
+
const requestOptions = {
|
|
59
|
+
url: `${this.resource}/v1.0/security/triggerTypes/retentionEventTypes/${options.id}`,
|
|
60
|
+
headers: {
|
|
61
|
+
accept: 'application/json;odata.metadata=none'
|
|
62
|
+
},
|
|
63
|
+
responseType: 'json'
|
|
64
|
+
};
|
|
65
|
+
yield request_1.default.delete(requestOptions);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
this.handleRejectedODataJsonPromise(err);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
73
|
_PurviewRetentionEventTypeRemoveCommand_instances = new WeakSet(), _PurviewRetentionEventTypeRemoveCommand_initTelemetry = function _PurviewRetentionEventTypeRemoveCommand_initTelemetry() {
|
|
72
74
|
this.telemetry.push((args) => {
|
|
@@ -35,48 +35,31 @@ class SearchExternalConnectionRemoveCommand extends GraphCommand_1.default {
|
|
|
35
35
|
__classPrivateFieldGet(this, _SearchExternalConnectionRemoveCommand_instances, "m", _SearchExternalConnectionRemoveCommand_initOptionSets).call(this);
|
|
36
36
|
}
|
|
37
37
|
getExternalConnectionId(args) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.get(requestOptions)
|
|
50
|
-
.then((res) => {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
if (args.options.id) {
|
|
40
|
+
return args.options.id;
|
|
41
|
+
}
|
|
42
|
+
const requestOptions = {
|
|
43
|
+
url: `${this.resource}/v1.0/external/connections?$filter=name eq '${formatting_1.formatting.encodeQueryParameter(args.options.name)}'&$select=id`,
|
|
44
|
+
headers: {
|
|
45
|
+
accept: 'application/json;odata.metadata=none'
|
|
46
|
+
},
|
|
47
|
+
responseType: 'json'
|
|
48
|
+
};
|
|
49
|
+
const res = yield request_1.default.get(requestOptions);
|
|
51
50
|
if (res.value.length === 1) {
|
|
52
|
-
return
|
|
51
|
+
return res.value[0].id;
|
|
53
52
|
}
|
|
54
53
|
if (res.value.length === 0) {
|
|
55
|
-
|
|
54
|
+
throw `The specified connection does not exist in Microsoft Search`;
|
|
56
55
|
}
|
|
57
|
-
|
|
56
|
+
throw `Multiple external connections with name ${args.options.name} found. Please disambiguate (IDs): ${res.value.map(x => x.id).join(', ')}`;
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
commandAction(logger, args) {
|
|
61
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const removeExternalConnection = () => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
try {
|
|
64
|
-
const externalConnectionId = yield this.getExternalConnectionId(args);
|
|
65
|
-
const requestOptions = {
|
|
66
|
-
url: `${this.resource}/v1.0/external/connections/${formatting_1.formatting.encodeQueryParameter(externalConnectionId)}`,
|
|
67
|
-
headers: {
|
|
68
|
-
accept: 'application/json;odata.metadata=none'
|
|
69
|
-
},
|
|
70
|
-
responseType: 'json'
|
|
71
|
-
};
|
|
72
|
-
yield request_1.default.delete(requestOptions);
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
this.handleRejectedODataJsonPromise(err);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
61
|
if (args.options.force) {
|
|
79
|
-
yield removeExternalConnection();
|
|
62
|
+
yield this.removeExternalConnection(args);
|
|
80
63
|
}
|
|
81
64
|
else {
|
|
82
65
|
const result = yield Cli_1.Cli.prompt({
|
|
@@ -86,11 +69,29 @@ class SearchExternalConnectionRemoveCommand extends GraphCommand_1.default {
|
|
|
86
69
|
message: `Are you sure you want to remove the external connection '${args.options.id || args.options.name}'?`
|
|
87
70
|
});
|
|
88
71
|
if (result.continue) {
|
|
89
|
-
yield removeExternalConnection();
|
|
72
|
+
yield this.removeExternalConnection(args);
|
|
90
73
|
}
|
|
91
74
|
}
|
|
92
75
|
});
|
|
93
76
|
}
|
|
77
|
+
removeExternalConnection(args) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
try {
|
|
80
|
+
const externalConnectionId = yield this.getExternalConnectionId(args);
|
|
81
|
+
const requestOptions = {
|
|
82
|
+
url: `${this.resource}/v1.0/external/connections/${formatting_1.formatting.encodeQueryParameter(externalConnectionId)}`,
|
|
83
|
+
headers: {
|
|
84
|
+
accept: 'application/json;odata.metadata=none'
|
|
85
|
+
},
|
|
86
|
+
responseType: 'json'
|
|
87
|
+
};
|
|
88
|
+
yield request_1.default.delete(requestOptions);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
this.handleRejectedODataJsonPromise(err);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
94
95
|
}
|
|
95
96
|
_SearchExternalConnectionRemoveCommand_instances = new WeakSet(), _SearchExternalConnectionRemoveCommand_initTelemetry = function _SearchExternalConnectionRemoveCommand_initTelemetry() {
|
|
96
97
|
this.telemetry.push((args) => {
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.DynamicRule = void 0;
|
|
4
13
|
const fs = require("fs");
|
|
@@ -12,36 +21,32 @@ class DynamicRule extends BasicDependencyRule_1.BasicDependencyRule {
|
|
|
12
21
|
this.fileVariationSuffixes = ['.min', '.bundle', '-min', '.bundle.min'];
|
|
13
22
|
}
|
|
14
23
|
visit(project) {
|
|
15
|
-
|
|
16
|
-
!project.packageJson.dependencies) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.all(validPackageNames.map((x) => this.getExternalEntryForPackage(x, project)))
|
|
24
|
-
.then((res) => {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
if (!project.packageJson || !project.packageJson.dependencies) {
|
|
26
|
+
return { entries: [], suggestions: [] };
|
|
27
|
+
}
|
|
28
|
+
const validPackageNames = Object.getOwnPropertyNames(project.packageJson.dependencies)
|
|
29
|
+
.filter(x => this.restrictedNamespaces.map(y => x.indexOf(y) === -1).reduce((y, z) => y && z))
|
|
30
|
+
.filter(x => this.restrictedModules.indexOf(x) === -1);
|
|
31
|
+
const res = yield Promise.all(validPackageNames.map((x) => this.getExternalEntryForPackage(x, project)));
|
|
25
32
|
return {
|
|
26
|
-
entries: res
|
|
27
|
-
.filter(x => x !== undefined)
|
|
28
|
-
.map(x => x),
|
|
33
|
+
entries: res.filter(x => x !== undefined),
|
|
29
34
|
suggestions: []
|
|
30
35
|
};
|
|
31
36
|
});
|
|
32
37
|
}
|
|
33
38
|
getExternalEntryForPackage(packageName, project) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const version = project.packageJson.dependencies[packageName];
|
|
41
|
+
const filesPaths = this.getFilePath(packageName).map(x => this.cleanFilePath(x));
|
|
42
|
+
if (!version || filesPaths.length === 0) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const filesPathsVariations = filesPaths
|
|
46
|
+
.map(x => this.fileVariationSuffixes.map(y => x.indexOf(y) === -1 ? x.replace('.js', `${y}.js`) : x))
|
|
47
|
+
.reduce((x, y) => [...x, ...y]);
|
|
48
|
+
const pathsAndVariations = [...filesPaths, ...filesPathsVariations];
|
|
49
|
+
const externalizeEntryCandidates = yield Promise.all(pathsAndVariations.map(x => this.getExternalEntryForFilePath(x, packageName, version)));
|
|
45
50
|
const dExternalizeEntryCandidates = externalizeEntryCandidates.filter(x => x !== undefined);
|
|
46
51
|
const minifiedModule = dExternalizeEntryCandidates.find(x => !x.globalName && this.pathContainsMinifySuffix(x.path));
|
|
47
52
|
const minifiedNonModule = dExternalizeEntryCandidates.find(x => x.globalName && this.pathContainsMinifySuffix(x.path));
|
|
@@ -57,31 +62,29 @@ class DynamicRule extends BasicDependencyRule_1.BasicDependencyRule {
|
|
|
57
62
|
.filter(y => y > -1).length > 0;
|
|
58
63
|
}
|
|
59
64
|
getExternalEntryForFilePath(filePath, packageName, version) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.testUrl(url)
|
|
63
|
-
.then((testResult) => {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const url = this.getFileUrl(packageName, version, filePath);
|
|
67
|
+
const testResult = yield this.testUrl(url);
|
|
64
68
|
if (!testResult) {
|
|
65
|
-
return
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const moduleInfo = yield this.getModuleType(url);
|
|
72
|
+
if (moduleInfo.scriptType === 'CommonJs') {
|
|
73
|
+
return undefined; //browsers don't support those module types without an additional library
|
|
74
|
+
}
|
|
75
|
+
else if (moduleInfo.scriptType === 'ES2015' || moduleInfo.scriptType === 'AMD') {
|
|
76
|
+
return {
|
|
77
|
+
key: packageName,
|
|
78
|
+
path: url
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
else { //TODO for non-module and UMD we should technically add dependencies as well
|
|
82
|
+
return {
|
|
83
|
+
key: packageName,
|
|
84
|
+
path: url,
|
|
85
|
+
globalName: moduleInfo.exports && moduleInfo.exports.length > 0 ? moduleInfo.exports[0] : packageName // examples where this is not good https://unpkg.com/@pnp/polyfill-ie11@^1.0.2/dist/index.js https://unpkg.com/moment-timezone@^0.5.27/builds/moment-timezone-with-data.js
|
|
86
|
+
};
|
|
66
87
|
}
|
|
67
|
-
return this.getModuleType(url).then((moduleInfo) => {
|
|
68
|
-
if (moduleInfo.scriptType === 'CommonJs') {
|
|
69
|
-
return Promise.resolve(undefined); //browsers don't support those module types without an additional library
|
|
70
|
-
}
|
|
71
|
-
else if (moduleInfo.scriptType === 'ES2015' || moduleInfo.scriptType === 'AMD') {
|
|
72
|
-
return {
|
|
73
|
-
key: packageName,
|
|
74
|
-
path: url
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
else { //TODO for non-module and UMD we should technically add dependencies as well
|
|
78
|
-
return {
|
|
79
|
-
key: packageName,
|
|
80
|
-
path: url,
|
|
81
|
-
globalName: moduleInfo.exports && moduleInfo.exports.length > 0 ? moduleInfo.exports[0] : packageName // examples where this is not good https://unpkg.com/@pnp/polyfill-ie11@^1.0.2/dist/index.js https://unpkg.com/moment-timezone@^0.5.27/builds/moment-timezone-with-data.js
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
88
|
});
|
|
86
89
|
}
|
|
87
90
|
getModuleType(url) {
|
|
@@ -101,10 +104,15 @@ class DynamicRule extends BasicDependencyRule_1.BasicDependencyRule {
|
|
|
101
104
|
return `https://unpkg.com/${packageName}@${version}/${filePath}`;
|
|
102
105
|
}
|
|
103
106
|
testUrl(url) {
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
try {
|
|
109
|
+
yield request_1.default.head({ url: url, headers: { 'x-anonymous': 'true' } });
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
catch (_a) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
108
116
|
}
|
|
109
117
|
getFilePath(packageName) {
|
|
110
118
|
const packageJsonFilePath = `node_modules/${packageName}/package.json`;
|