Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code cleanup, changelog updates #2989

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- ISite now supports `async rebase()` to ensure any ISite is represented by the url pattern /sites/{site id} regardless of how it was first loaded
- ISites.getAllSites()
- support for operations for ISite and IList
- support for file labels
- support for mail folders, mailbox, rules
- completed support for Files
- admin module
- analytics module
- appCatalog module
- compliance module
- list-item module
- mail module
- operations module
- permissions module
- places module
- taxonomy module
- to-do module

- sp
- explict error thrown if SPFx context is null or undefined when needed
Expand All @@ -40,15 +53,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- startUpload, continueUpload, finishUpload File protected methods removed
- removed legacy support for @target query param
- removed "favorites", please use graph favorites
- taxonomy module, please use graph taxonomy

- nodejs
- removed stream extensions, moved into sp

### Changed

- tsconfig.json
- set preserveConstEnums: false

- buildsystem
- Rewritten using Timeline
- Updated to v4

- testing
- SPA application now has a button to trigger the code vs running on page load

- msaljsclient
- updated to use @azure/msal-browser v3

- queryable
- moved add-props.ts and request-builders.ts to index.ts
- Changed interface for `query` property
Expand All @@ -59,9 +83,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- All GraphQueryable*, _GraphQueryable*, and IGraphQueryable* have been renamed to remove "Queryable" (ex: GraphQueryableCollection is now GraphCollection)
- @pnp/graph/onedrive renamed to @pnp/graph/files
- ISites.getByUrl is now async
- @pnp/graph/outlook is not in @pnp/graph/mail, included all mail endpoints
- @pnp/graph/outlook is now in @pnp/graph/mail, included all mail endpoints
- mailCategory.add() returns Microsoft Graph types OutlookCategory vs object with data property.
- Changed how query params are parsed to custom logic
- Improvements to shared module
- Greatly expanded what is supported through teams module


- sp
- _Items and IItems now supports async iterator pattern
Expand Down
218 changes: 0 additions & 218 deletions packages/core/extendable.ts

This file was deleted.

25 changes: 14 additions & 11 deletions packages/core/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ export const noInherit = addFlag(ObserverLifecycleFlags.noInherit);
*/
export const once = addFlag(ObserverLifecycleFlags.once);

const enum ObserverAddBehavior {
Add = 1,
Prepend = 2,
Replace = 3,
}

/**
* Timeline represents a set of operations executed in order of definition,
* with each moment's behavior controlled by the implementing function
Expand Down Expand Up @@ -170,7 +176,7 @@ export abstract class Timeline<T extends Moments> {
get: (target: any, p: string) => Object.assign((handler: ValidObserver) => {

target.cloneObserversOnChange();
addObserver(target.observers, p, handler, "add");
addObserver(target.observers, p, handler, ObserverAddBehavior.Add);
return target;

}, {
Expand All @@ -180,13 +186,13 @@ export abstract class Timeline<T extends Moments> {
replace: (handler: ValidObserver) => {

target.cloneObserversOnChange();
addObserver(target.observers, p, handler, "replace");
addObserver(target.observers, p, handler, ObserverAddBehavior.Replace);
return target;
},
prepend: (handler: ValidObserver) => {

target.cloneObserversOnChange();
addObserver(target.observers, p, handler, "prepend");
addObserver(target.observers, p, handler, ObserverAddBehavior.Prepend);
return target;
},
clear: (): boolean => {
Expand Down Expand Up @@ -309,9 +315,7 @@ export abstract class Timeline<T extends Moments> {
} catch (e) {

// shouldn't happen, but possible dispose throws - which may be missed as the usercode await will have resolved.
const e2 = Object.assign(Error("Error in dispose."), {
innerException: e,
});
const e2 = Object.assign(Error("Error in dispose."), { innerException: e });

this.error(e2);
}
Expand Down Expand Up @@ -349,7 +353,7 @@ export abstract class Timeline<T extends Moments> {
* @param addBehavior Determines how the observer is added to the collection
*
*/
function addObserver(target: Record<string, any>, moment: string, observer: ValidObserver, addBehavior: "add" | "replace" | "prepend"): any[] {
function addObserver(target: Record<string, any>, moment: string, observer: ValidObserver, addBehavior: ObserverAddBehavior): any[] {

if (!isFunc(observer)) {
throw Error("Observers must be functions.");
Expand All @@ -364,13 +368,13 @@ function addObserver(target: Record<string, any>, moment: string, observer: Vali

// if we have an existing property then we follow the specified behavior
switch (addBehavior) {
case "add":
case ObserverAddBehavior.Add:
target[moment].push(observer);
break;
case "prepend":
case ObserverAddBehavior.Prepend:
target[moment].unshift(observer);
break;
case "replace":
case ObserverAddBehavior.Replace:
target[moment].length = 0;
target[moment].push(observer);
break;
Expand All @@ -384,7 +388,6 @@ export function cloneObserverCollection(source: ObserverCollection): ObserverCol

return Reflect.ownKeys(source).reduce((clone: ObserverCollection, key: string) => {

// eslint-disable-next-line no-bitwise
clone[key] = [...source[key].filter(byFlag(ObserverLifecycleFlags.noInherit))];

return clone;
Expand Down
11 changes: 0 additions & 11 deletions packages/logging/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
export * from "./listeners.js";
/**
* A set of logging levels
*/
export var LogLevel;
(function (LogLevel) {
LogLevel[LogLevel["Verbose"] = 0] = "Verbose";
LogLevel[LogLevel["Info"] = 1] = "Info";
LogLevel[LogLevel["Warning"] = 2] = "Warning";
LogLevel[LogLevel["Error"] = 3] = "Error";
LogLevel[LogLevel["Off"] = 99] = "Off";
})(LogLevel || (LogLevel = {}));
const _subscribers = [];
let _activeLogLevel = 2 /* Warning */;
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/logging/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export * from "./listeners.js";
/**
* A set of logging levels
*/
export const enum LogLevel {
export enum LogLevel {
Verbose = 0,
Info = 1,
Warning = 2,
Expand Down
2 changes: 1 addition & 1 deletion packages/sp/clientside-pages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { createBatch } from "../batching.js";
/**
* Page promotion state
*/
export const enum PromotedState {
export enum PromotedState {
/**
* Regular client side page
*/
Expand Down
Loading
Loading