From 5f032039a64e5e148876b1c93bd20e474b5b30b9 Mon Sep 17 00:00:00 2001 From: Patrick Rodgers Date: Tue, 27 Feb 2024 11:17:29 -0500 Subject: [PATCH] commenting out wip changes --- packages/queryable/queryable.ts | 29 +++++++++++++++-------------- packages/sp/spqueryable.ts | 10 +++++----- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/packages/queryable/queryable.ts b/packages/queryable/queryable.ts index 1d40836dd..276bdb3ab 100644 --- a/packages/queryable/queryable.ts +++ b/packages/queryable/queryable.ts @@ -231,7 +231,7 @@ export interface Queryable extends IInvokable { } // this interface is required to stop the class from recursively referencing itself through the DefaultBehaviors type export interface IQueryableInternal extends Timeline, IInvokable { readonly query: URLSearchParams; - new(...params: any[]); + // new(...params: any[]); (this: IQueryableInternal, init?: RequestInit): Promise; using(...behaviors: TimelinePipe[]): this; toRequestUrl(): string; @@ -269,7 +269,7 @@ export function op(q: IQueryableInternal, operation: Operation, init?: Reques return Reflect.apply(operation, q, [init]); } -export function queryableFactory( +export function queryableFactory( constructor: { new(init: QueryableInit, path?: string): InstanceType }, ): (init: QueryableInit, path?: string) => InstanceType { @@ -287,22 +287,23 @@ export function queryableFactory( }; } -// extends IQueryableInternal -export function queryableFactory2(constructor: InstanceType): (...args: ConstructorParameters) => InstanceType & IInvokable { +// // extends IQueryableInternal +// export function queryableFactory2(constructor: InstanceType): +// (...args: ConstructorParameters) => InstanceType & IInvokable { - return (...args: ConstructorParameters) => { +// return (...args: ConstructorParameters) => { - // construct the concrete instance - const instance: InstanceType = new constructor(...args); +// // construct the concrete instance +// const instance: InstanceType = new constructor(...args); - // we emit the construct event from the factory because we need all of the decorators and constructors - // to have fully finished before we emit, which is now true. We type the instance to any to get around - // the protected nature of emit - (instance).emit.construct(...args); +// // we emit the construct event from the factory because we need all of the decorators and constructors +// // to have fully finished before we emit, which is now true. We type the instance to any to get around +// // the protected nature of emit +// (instance).emit.construct(...args); - return instance; - }; -} +// return instance; +// }; +// } /** * Allows a decorated object to be invoked as a function, optionally providing an implementation for that action diff --git a/packages/sp/spqueryable.ts b/packages/sp/spqueryable.ts index ea4222eb9..eff41c793 100644 --- a/packages/sp/spqueryable.ts +++ b/packages/sp/spqueryable.ts @@ -1,5 +1,5 @@ import { combine, isUrlAbsolute, isArray, objectDefinedNotNull, stringIsNullOrEmpty } from "@pnp/core"; -import { Queryable, queryableFactory, queryableFactory2, op, get, post, patch, del, IInvokable } from "@pnp/queryable"; +import { Queryable, queryableFactory, op, get, post, patch, del, IInvokable } from "@pnp/queryable"; export type SPInit = string | ISPQueryable | [ISPQueryable, string]; @@ -15,16 +15,16 @@ export const spInvokableFactory = (f: any): ISPInvokable -export type ISPInvokableFactory2 = (...args: any[]) => R & IInvokable; +// export type ISPInvokableFactory2 = (...args: any[]) => R & IInvokable; -export const spInvokableFactory2 = , T extends ISPQueryable>(f: T): ISPInvokableFactory2 => { +// export const spInvokableFactory2 = , T extends ISPQueryable>(f: T): ISPInvokableFactory2 => { - return queryableFactory2(f); -}; +// return queryableFactory2(f); +// }; /**