@pnp/cli-microsoft365 10.8.0-beta.cdb5c81 → 10.9.0-beta.9d7d19b

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.
@@ -4,8 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SppModelGetCommand_instances, _SppModelGetCommand_initTelemetry, _SppModelGetCommand_initOptions, _SppModelGetCommand_initValidators, _SppModelGetCommand_initOptionSets, _SppModelGetCommand_initTypes;
7
- import request from '../../../../request.js';
8
- import { formatting } from '../../../../utils/formatting.js';
9
7
  import { odata } from '../../../../utils/odata.js';
10
8
  import { spp } from '../../../../utils/spp.js';
11
9
  import { urlUtil } from '../../../../utils/urlUtil.js';
@@ -30,34 +28,19 @@ class SppModelGetCommand extends SpoCommand {
30
28
  }
31
29
  async commandAction(logger, args) {
32
30
  try {
33
- if (this.verbose) {
34
- await logger.log(`Retrieving model information from ${args.options.siteUrl}...`);
35
- }
36
31
  const siteUrl = urlUtil.removeTrailingSlashes(args.options.siteUrl);
37
- await spp.assertSiteIsContentCenter(siteUrl);
38
- let requestUrl = `${siteUrl}/_api/machinelearning/models/`;
32
+ await spp.assertSiteIsContentCenter(siteUrl, logger, this.verbose);
33
+ let result = null;
39
34
  if (args.options.title) {
40
- let requestTitle = args.options.title.toLowerCase();
41
- if (!requestTitle.endsWith('.classifier')) {
42
- requestTitle += '.classifier';
43
- }
44
- requestUrl += `getbytitle('${formatting.encodeQueryParameter(requestTitle)}')`;
35
+ result = await spp.getModelByTitle(siteUrl, args.options.title, logger, this.verbose);
45
36
  }
46
37
  else {
47
- requestUrl += `getbyuniqueid('${args.options.id}')`;
48
- }
49
- const requestOptions = {
50
- url: requestUrl,
51
- headers: {
52
- accept: 'application/json;odata=nometadata'
53
- },
54
- responseType: 'json'
55
- };
56
- const result = await request.get(requestOptions);
57
- if (result['odata.null'] === true) {
58
- throw 'Model not found.';
38
+ result = await spp.getModelById(siteUrl, args.options.id, logger, this.verbose);
59
39
  }
60
40
  if (args.options.withPublications) {
41
+ if (this.verbose) {
42
+ await logger.log(`Retrieving publications for model...`);
43
+ }
61
44
  result.Publications = await odata.getAllItems(`${siteUrl}/_api/machinelearning/publications/getbymodeluniqueid('${result.UniqueId}')`);
62
45
  }
63
46
  await logger.log({
@@ -33,7 +33,7 @@ class SppModelListCommand extends SpoCommand {
33
33
  await logger.log(`Retrieving models from ${args.options.siteUrl}...`);
34
34
  }
35
35
  const siteUrl = urlUtil.removeTrailingSlashes(args.options.siteUrl);
36
- await spp.assertSiteIsContentCenter(siteUrl);
36
+ await spp.assertSiteIsContentCenter(siteUrl, logger, this.verbose);
37
37
  const result = await odata.getAllItems(`${siteUrl}/_api/machinelearning/models`);
38
38
  await logger.log(result);
39
39
  }
@@ -40,7 +40,7 @@ class SppModelRemoveCommand extends SpoCommand {
40
40
  await logger.log(`Removing model from ${args.options.siteUrl}...`);
41
41
  }
42
42
  const siteUrl = urlUtil.removeTrailingSlashes(args.options.siteUrl);
43
- await spp.assertSiteIsContentCenter(siteUrl);
43
+ await spp.assertSiteIsContentCenter(siteUrl, logger, this.verbose);
44
44
  let requestUrl = `${siteUrl}/_api/machinelearning/models/`;
45
45
  if (args.options.title) {
46
46
  let requestTitle = args.options.title.toLowerCase();
@@ -1,6 +1,7 @@
1
1
  const prefix = 'spp';
2
2
  export default {
3
3
  CONTENTCENTER_LIST: `${prefix} contentcenter list`,
4
+ MODEL_APPLY: `${prefix} model apply`,
4
5
  MODEL_GET: `${prefix} model get`,
5
6
  MODEL_LIST: `${prefix} model list`,
6
7
  MODEL_REMOVE: `${prefix} model remove`
package/dist/utils/spp.js CHANGED
@@ -1,11 +1,17 @@
1
1
  import request from '../request.js';
2
+ import { formatting } from './formatting.js';
2
3
  export const spp = {
3
4
  /**
4
5
  * Asserts whether the specified site is a content center
5
6
  * @param siteUrl The URL of the site to check
7
+ * @param logger Logger instance
8
+ * @param verbose Whether to log verbose messages
6
9
  * @throws error when site is not a content center.
7
10
  */
8
- async assertSiteIsContentCenter(siteUrl) {
11
+ async assertSiteIsContentCenter(siteUrl, logger, verbose) {
12
+ if (verbose) {
13
+ await logger.log(`Checking if '${siteUrl}' is a valid content center site...`);
14
+ }
9
15
  const requestOptions = {
10
16
  url: `${siteUrl}/_api/web?$select=WebTemplateConfiguration`,
11
17
  headers: {
@@ -17,6 +23,58 @@ export const spp = {
17
23
  if (response.WebTemplateConfiguration !== 'CONTENTCTR#0') {
18
24
  throw Error(`${siteUrl} is not a content site.`);
19
25
  }
26
+ },
27
+ /**
28
+ * Gets a SharePoint Premium model by title
29
+ * @param contentCenterUrl a content center site URL
30
+ * @param title model title
31
+ * @param logger Logger instance
32
+ * @param verbose Whether to log verbose messages
33
+ * @returns SharePoint Premium model
34
+ */
35
+ async getModelByTitle(contentCenterUrl, title, logger, verbose) {
36
+ if (verbose) {
37
+ await logger.log(`Retrieving model information...`);
38
+ }
39
+ let requestTitle = title.toLowerCase();
40
+ if (!requestTitle.endsWith('.classifier')) {
41
+ requestTitle += '.classifier';
42
+ }
43
+ const requestUrl = `${contentCenterUrl}/_api/machinelearning/models/getbytitle('${formatting.encodeQueryParameter(requestTitle)}')`;
44
+ const requestOptions = {
45
+ url: requestUrl,
46
+ headers: {
47
+ accept: 'application/json;odata=nometadata'
48
+ },
49
+ responseType: 'json'
50
+ };
51
+ const result = await request.get(requestOptions);
52
+ if (result['odata.null'] === true) {
53
+ throw Error(`Model '${title}' was not found.`);
54
+ }
55
+ return result;
56
+ },
57
+ /**
58
+ * Gets a SharePoint Premium model by unique id
59
+ * @param contentCenterUrl a content center site URL
60
+ * @param id model unique id
61
+ * @param logger Logger instance
62
+ * @param verbose Whether to log verbose messages
63
+ * @returns SharePoint Premium model
64
+ */
65
+ async getModelById(contentCenterUrl, id, logger, verbose) {
66
+ if (verbose) {
67
+ await logger.log(`Retrieving model information...`);
68
+ }
69
+ const requestUrl = `${contentCenterUrl}/_api/machinelearning/models/getbyuniqueid('${id}')`;
70
+ const requestOptions = {
71
+ url: requestUrl,
72
+ headers: {
73
+ accept: 'application/json;odata=nometadata'
74
+ },
75
+ responseType: 'json'
76
+ };
77
+ return await request.get(requestOptions);
20
78
  }
21
79
  };
22
80
  //# sourceMappingURL=spp.js.map
@@ -0,0 +1,135 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # graph directoryextension list
6
+
7
+ Retrieves a list of directory extensions
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 graph directoryextension list [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `--appId [appId]`
19
+ : Application (client) ID of the Entra application where the directory extensions are registered. Specify either `appId`, `appObjectId` or `appName`, but not multiple.
20
+
21
+ `--appObjectId [appObjectId]`
22
+ : Object ID of the Entra application where the directory extensions are registered. Specify either `appId`, `appObjectId` or `appName`, but not multiple.
23
+
24
+ `--appName [appName]`
25
+ : The name of Entra application where the directory extensions are registered. Specify either `appId`, `appObjectId` or `appName`, but not multiple.
26
+ ```
27
+
28
+ <Global />
29
+
30
+ ## Remarks
31
+
32
+ When neither `appId`, `appObjectId` nor `appName` is specified, the command will return all available directory extensions including those registered for multi-tenant apps.
33
+
34
+ https://learn.microsoft.com/en-us/graph/api/directoryobject-getavailableextensionproperties?view=graph-rest-1.0&tabs=http
35
+
36
+ Otherwise, it will return directory extensions for a specific application.
37
+
38
+ https://learn.microsoft.com/en-us/graph/api/application-list-extensionproperty?view=graph-rest-1.0&tabs=http
39
+
40
+ ## Examples
41
+
42
+ Get all available directory extensions including those registered for multi-tenant apps
43
+
44
+ ```sh
45
+ m365 graph directoryextension list
46
+ ```
47
+
48
+ Get all directory extensions registered for an application specified by app id.
49
+
50
+ ```sh
51
+ m365 graph directoryextension list --appId fd918e4b-c821-4efb-b50a-5eddd23afc6f
52
+ ```
53
+
54
+ Get all directory extensions registered for an application specified by app object id.
55
+
56
+ ```sh
57
+ m365 graph directoryextension list --appObjectId 1caf7dcd-7e83-4c3a-94f7-932a1299c844
58
+ ```
59
+
60
+ Get all directory extensions registered for an application specified by name.
61
+
62
+ ```sh
63
+ m365 graph directoryextension list --appName ContosoApp
64
+ ```
65
+
66
+ ## Response
67
+
68
+ <Tabs>
69
+ <TabItem value="JSON">
70
+
71
+ ```json
72
+ [
73
+ {
74
+ "id": "8133c498-ad76-4a7b-90a0-675bf5adf492",
75
+ "deletedDateTime": null,
76
+ "appDisplayName": "ContosoApp",
77
+ "dataType": "String",
78
+ "isMultiValued": true,
79
+ "isSyncedFromOnPremises": false,
80
+ "name": "extension_66eac1c505384aec9e024b9e60f5e4b9_jobGroup",
81
+ "targetObjects": [
82
+ "User"
83
+ ]
84
+ }
85
+ ]
86
+ ```
87
+
88
+ </TabItem>
89
+ <TabItem value="Text">
90
+
91
+ ```text
92
+ appDisplayName : ContosoApp
93
+ dataType : String
94
+ deletedDateTime : null
95
+ id : 8133c498-ad76-4a7b-90a0-675bf5adf492
96
+ isMultiValued : true
97
+ isSyncedFromOnPremises: false
98
+ name : extension_66eac1c505384aec9e024b9e60f5e4b9_jobGroup
99
+ targetObjects : ["User"]
100
+ ```
101
+
102
+ </TabItem>
103
+ <TabItem value="CSV">
104
+
105
+ ```csv
106
+ id,deletedDateTime,appDisplayName,dataType,isMultiValued,isSyncedFromOnPremises,name
107
+ 8133c498-ad76-4a7b-90a0-675bf5adf492,,ContosoApp,String,1,0,extension_66eac1c505384aec9e024b9e60f5e4b9_jobGroup
108
+ ```
109
+
110
+ </TabItem>
111
+ <TabItem value="Markdown">
112
+
113
+ ```md
114
+ # graph directoryextension list --debug "false" --verbose "false" --appId "66eac1c5-0538-4aec-9e02-4b9e60f5e4b9"
115
+
116
+ Date: 3/23/2025
117
+
118
+ ## extension_66eac1c505384aec9e024b9e60f5e4b9_jobGroup (8133c498-ad76-4a7b-90a0-675bf5adf492)
119
+
120
+ Property | Value
121
+ ---------|-------
122
+ id | 8133c498-ad76-4a7b-90a0-675bf5adf492
123
+ appDisplayName | ContosoApp
124
+ dataType | String
125
+ isMultiValued | true
126
+ isSyncedFromOnPremises | false
127
+ name | extension\_66eac1c505384aec9e024b9e60f5e4b9\_jobGroup
128
+ ```
129
+
130
+ </TabItem>
131
+ </Tabs>
132
+
133
+ ## More information
134
+
135
+ - Directory extensions: https://learn.microsoft.com/graph/extensibility-overview#directory-microsoft-entra-id-extensions
@@ -19,13 +19,16 @@ m365 spo list get [options]
19
19
  : URL of the site where the list to retrieve is located.
20
20
 
21
21
  `-i, --id [id]`
22
- : ID of the list to retrieve information for. Specify either `id`, `title`, or `url` but not multiple.
22
+ : ID of the list to retrieve information for. Specify either `id`, `title`,`url` or `default` but not multiple.
23
23
 
24
24
  `-t, --title [title]`
25
- : Title of the list to retrieve information for. Specify either `id`, `title`, or `url` but not multiple.
25
+ : Title of the list to retrieve information for. Specify either `id`, `title`,`url` or `default` but not multiple.
26
26
 
27
27
  `--url [url]`
28
- : Server- or site-relative URL of the list. Specify either `id`, `title`, or `url` but not multiple.
28
+ : Server- or site-relative URL of the list. Specify either `id`, `title`,`url` or `default` but not multiple.
29
+
30
+ `--default`
31
+ : Set to retrieve the default list from the site. Specify either `id`, `title`, `url`, or `default` but not multiple.
29
32
 
30
33
  `-p, --properties [properties]`
31
34
  : Comma-separated list of properties to retrieve from the list. Will retrieve all properties possible from default response, if not specified.
@@ -42,6 +45,12 @@ When the `properties` option includes values with a `/`, for example: `ListItemA
42
45
 
43
46
  ## Examples
44
47
 
48
+ Get the default document library located in the specified site.
49
+
50
+ ```sh
51
+ m365 spo list get --webUrl https://contoso.sharepoint.com/sites/project-x --default
52
+ ```
53
+
45
54
  Get information about a list with specified ID located in the specified site.
46
55
 
47
56
  ```sh
@@ -0,0 +1,79 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # spp model apply
6
+
7
+ Applies (or syncs) a trained document understanding model to a document library
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 spp model apply [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-u, --webUrl <webUrl>`
19
+ : The URL of the web where the library is located.
20
+
21
+ `-c, --contentCenterUrl <contentCenterUrl>`
22
+ : The URL of the content center site where model is located.
23
+
24
+ `-i, --id [id]`
25
+ : The unique ID of the model. Specify either `id` or `title` but not both.
26
+
27
+ `-t, --title [title]`
28
+ : The display name of the model. Specify either `id` or `title` but not both.
29
+
30
+ `--listTitle [listTitle]`
31
+ : The title of the document library to which the model will be applied. Specify either `listTitle`, `listId`, or `listUrl` but not multiple.
32
+
33
+ `--listId [listId]`
34
+ : The ID of the library to which the model will be applied. Specify either `listTitle`, `listId`, or `listUrl` but not multiple.
35
+
36
+ `--listUrl [listUrl]`
37
+ : Server or web-relative URL of the library to which the model will be applied. Specify either `listTitle`, `listId`, or `listUrl` but not multiple.
38
+
39
+ `--viewOption [viewOption]`
40
+ : Defines whether the model view should be set as the default view for the document library. Allowed values are: `NewViewAsDefault`, `DoNotChangeDefault`, `TileViewAsDefault`. The default value is `NewViewAsDefault`.
41
+ ```
42
+
43
+ <Global />
44
+
45
+ ## Examples
46
+
47
+ Applies a trained document understanding model using its unique ID to a document library, identified by its title.
48
+
49
+ ```sh
50
+ m365 spp model apply --webUrl "https://contoso.sharepoint.com" --contentCenterUrl "https://contoso.sharepoint.com/sites/ContentCenter" --id "7645e69d-21fb-4a24-a17a-9bdfa7cb63dc" --listTitle "Shared Documents"
51
+ ```
52
+
53
+ Applies a trained document understanding model using its display name to a document library, identified by its title.
54
+
55
+ ```sh
56
+ m365 spp model apply --webUrl "https://contoso.sharepoint.com" --contentCenterUrl "https://contoso.sharepoint.com/sites/ContentCenter" --title "ModelExample" --listTitle "Shared Documents"
57
+ ```
58
+
59
+ Applies a trained document understanding model using its display name to a document library, identified by its URL.
60
+
61
+ ```sh
62
+ m365 spp model apply --webUrl "https://contoso.sharepoint.com" --contentCenterUrl "https://contoso.sharepoint.com/sites/ContentCenter" --title "ModelExample" --listUrl "/Shared Documents"
63
+ ```
64
+
65
+ Applies a trained document understanding model using its display name to a document library, identified by its unique ID.
66
+
67
+ ```sh
68
+ m365 spp model apply --webUrl "https://contoso.sharepoint.com" --contentCenterUrl "https://contoso.sharepoint.com/sites/ContentCenter" --title "ModelExample" --listId "b4cfa0d9-b3d7-49ae-a0f0-f14ffdd005f7"
69
+ ```
70
+
71
+ Applies a trained document understanding model using its display name to a document library, identified by its unique ID. Without changing a default document library view.
72
+
73
+ ```sh
74
+ m365 spp model apply --webUrl "https://contoso.sharepoint.com" --contentCenterUrl "https://contoso.sharepoint.com/sites/ContentCenter" --title "ModelExample" --listId "b4cfa0d9-b3d7-49ae-a0f0-f14ffdd005f7" --viewOption "DoNotChangeDefault"
75
+ ```
76
+
77
+ ## Response
78
+
79
+ The command won't return a response on success.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "10.8.0",
3
+ "version": "10.9.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pnp/cli-microsoft365",
9
- "version": "10.8.0",
9
+ "version": "10.9.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@azure/msal-common": "^15.5.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "10.8.0-beta.cdb5c81",
3
+ "version": "10.9.0-beta.9d7d19b",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",
@@ -177,7 +177,7 @@
177
177
  "Levert, Sebastien <slevert@outlook.com>",
178
178
  "Lingstuyl, Martin <mlingstuyl@live.com>",
179
179
  "Macháček, Martin <machacek@edhouse.cz>",
180
- "Maestrini Tobias <tobias@bee365.ch>",
180
+ "Maestrini, Tobias <tobias.maestrini@gmail.com>",
181
181
  "Maillot, Michaël <battosaimykle@gmail.com>",
182
182
  "Mastykarz, Waldek <waldek@mastykarz.nl>",
183
183
  "McDonnell, Kevin <kevin@mcd79.com>",