Skip to content

Commit

Permalink
Merge pull request #3185 from pnp/version-4
Browse files Browse the repository at this point in the history
Release 4.8.0
  • Loading branch information
juliemturner authored Dec 23, 2024
2 parents 7252895 + f280c21 commit 51f5033
Show file tree
Hide file tree
Showing 24 changed files with 1,403 additions and 842 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ site
# allow folks to add things to the debug /launch and /serve folder, but don't include them in git
debug/launch/*
!debug/launch/main.ts
!debug/launch/spadmin.ts
!debug/launch/sp.ts
!debug/launch/graph.ts
!debug/launch/tsconfig.json
Expand Down
23 changes: 17 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 4.8.0 - 2024-Dec-23

- graph
- Fixed issue with resumableUpload

- nodejs
- Removed node-fetch as minimum supported NodeJS version support native fetch.

- queryable
- reversed removal of .clone()

## 4.7.0 - 2024-Nov-18

- sp
- Introduces new filter lamda patterns as beta
- Introduces new filter lamda patterns as beta

- graph
- Renamed OneNote Pages to OneNotePages
- Basic Pages API support as beta
- Site Open Extensions as beta
- Fixed #3136 for improving paging support for query params
- Renamed OneNote Pages to OneNotePages
- Basic Pages API support as beta
- Site Open Extensions as beta
- Fixed #3136 for improving paging support for query params

- queryable
- Introduced DebugHeaders behavior
- Introduced DebugHeaders behavior

## 4.6.0 - 2024-Oct-14

Expand Down
1 change: 1 addition & 0 deletions debug/launch/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ITestingSettings } from "../../test/load-settings.js";
// will allow you to keep all your debugging files locally
// comment out the example
import { Example } from "./sp.js";
// import { Example } from "./spadmin.js";
// import { Example } from "./graph.js";

// setup the connection to SharePoint using the settings file, you can
Expand Down
22 changes: 22 additions & 0 deletions debug/launch/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@ export function spSetup(settings: ITestingSettings): SPFI {
return sp;
}

export function spAdminSetup(settings: ITestingSettings): SPFI {

const sp = spfi(settings.testing.spadmin.url).using(SPDefault({
msal: {
config: settings.testing.spadmin.msal.init,
scopes: settings.testing.spadmin.msal.scopes,
},
})).using(
PnPLogging(LogLevel.Verbose),
function (instance: Queryable) {

instance.on.pre(async (url, init, result) => {

// we remove telemetry for debugging
delete init.headers["X-ClientService-ClientTag"];
return [url, init, result];
});
});

return sp;
}

export function graphSetup(settings: ITestingSettings): GraphFI {

const graph = graphfi().using(
Expand Down
2 changes: 2 additions & 0 deletions debug/launch/sp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export async function Example(settings: ITestingSettings) {

process.exit(0);
}


21 changes: 21 additions & 0 deletions debug/launch/spadmin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ITestingSettings } from "../../test/load-settings.js";
import { Logger, LogLevel } from "@pnp/logging";
import { spAdminSetup } from "./setup.js";
import "@pnp/sp-admin/index.js";

declare var process: { exit(code?: number): void };

export async function Example(settings: ITestingSettings) {

const spAdmin = spAdminSetup(settings);

const s = await spAdmin.admin.tenant.getSitePropertiesByUrl('https://sympjt.sharepoint.com/sites/pnpjsteam', true);

Logger.log({
data: s,
level: LogLevel.Info,
message: "Web Data",
});

process.exit(0);
}
2 changes: 1 addition & 1 deletion docs/core/behaviors.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function CompanyDefault(): TimelinePipe<Queryable> {
DefaultHeaders(),
// use the default init, but change the base url to beta
DefaultInit("https://graph.microsoft.com/beta"),
// use node-fetch with retry
// use fetch with retry
NodeFetchWithRetry(),
// use the default parsing
DefaultParse(),
Expand Down
2 changes: 1 addition & 1 deletion docs/nodejs/behaviors.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The article describes the behaviors exported by the `@pnp/nodejs` library. Pleas

## NodeFetch

This behavior, for use in nodejs, provides basic fetch support through the `node-fetch` package. It replaces any other registered observers on the send moment by default, but this can be controlled via the props. Remember, when registering observers on the send moment only the first one will be used so not replacing
This behavior, for use in nodejs, provides basic fetch support using native fetch api. It replaces any other registered observers on the send moment by default, but this can be controlled via the props. Remember, when registering observers on the send moment only the first one will be used so not replacing

> For fetch configuration in browsers please see [@pnp/queryable behaviors]("../../../queryable/behaviors.md).
Expand Down
18 changes: 12 additions & 6 deletions docs/sp-admin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,27 @@ The `tenant` node represents calls to the `_api/Microsoft.Online.SharePoint.Tena
import { spfi } from "@pnp/sp";
import "@pnp/sp-admin";

const sp = spfi("https://{tenant}-admin.sharepoint.com");
const spAdmin = spfi("https://{tenant}-admin.sharepoint.com");

// The MSAL scope will be: "https://{tenant}-admin.sharepoint.com/.default"

// default props
const defaultProps = await sp.admin.tenant();
const defaultProps = await spAdmin.admin.tenant();

// all props
const allProps = await sp.admin.tenant.select("*")();
const allProps = await spAdmin.admin.tenant.select("*")();

// select specific props
const selectedProps = await sp.admin.tenant.select("AllowEditing", "DefaultContentCenterSite")();
const selectedProps = await spAdmin.admin.tenant.select("AllowEditing", "DefaultContentCenterSite")();

// call method
const templates = await sp.admin.tenant.getSPOTenantAllWebTemplates();
const templates = await spAdmin.admin.tenant.getSPOTenantAllWebTemplates();

// get site properties by url
const props = await spAdmin.admin.tenant.getSitePropertiesByUrl("https://contoso.sharepoint.com/sites/dev", true);

// set site properties by id -- GUID of SharePoint site (not root web)
await spAdmin.admin.tenant.setSitePropertiesById("{siteId}", {LockedState: "ReadOnly"});
```

## office365Tenant
Expand Down Expand Up @@ -116,7 +122,7 @@ await sp.admin.siteProperties.clearSharingLockDown("https://tenant.sharepoint.co
## call

All those nodes support a `call` method to easily allow calling methods not explictly added to the library. If there is a method you use often that would be a good candidate to add, please open an issue or submit a PR. The call method is meant to help unblock folks before methods are added.
All those nodes support a `call` method to easily allow calling methods not explicitly added to the library. If there is a method you use often that would be a good candidate to add, please open an issue or submit a PR. The call method is meant to help unblock folks before methods are added.

This sample shows using call to invoke the "AddTenantCdnOrigin" method of office365Tenant. While we already support for this method, it helps to show the relationship between `call` and an existing method.

Expand Down
Loading

0 comments on commit 51f5033

Please sign in to comment.