1 | import { IFetchOptions, IConfigOptions, IRequestClient, ITypedHash, Runtime } from "@pnp/common";
|
2 | import { ICachingOptions } from "./caching.js";
|
3 | import { Batch } from "./batch.js";
|
4 | import { PipelineMethod } from "./pipeline.js";
|
5 | import { IODataParser } from "./parsers.js";
|
6 | export declare function cloneQueryableData(source: Partial<IQueryableData>): Partial<IQueryableData>;
|
7 | export interface IQueryableData<DefaultActionType = any> {
|
8 | batch: Batch | null;
|
9 | batchIndex: number;
|
10 | batchDependency: () => void | null;
|
11 | cachingOptions: ICachingOptions | null;
|
12 | cloneParentCacheOptions: ICachingOptions | null;
|
13 | cloneParentWasCaching: boolean;
|
14 | query: Map<string, string>;
|
15 | options: IFetchOptions | null;
|
16 | url: string;
|
17 | parentUrl: string;
|
18 | useCaching: boolean;
|
19 | pipes?: PipelineMethod<DefaultActionType>[];
|
20 | parser?: IODataParser<DefaultActionType>;
|
21 | clientFactory?: () => IRequestClient;
|
22 | method?: string;
|
23 | }
|
24 | export interface IQueryable<DefaultActionType> {
|
25 | data: Partial<IQueryableData<DefaultActionType>>;
|
26 | query: Map<string, string>;
|
27 | append(pathPart: string): void;
|
28 | inBatch(batch: Batch): this;
|
29 | addBatchDependency(): () => void;
|
30 | toUrlAndQuery(): string;
|
31 | toUrl(): string;
|
32 | concat(pathPart: string): this;
|
33 | configure(options: IConfigOptions): this;
|
34 | configureFrom(o: IQueryable<DefaultActionType>): this;
|
35 | usingCaching(options?: ICachingOptions): this;
|
36 | usingParser(parser: IODataParser<any>): this;
|
37 | withPipeline(pipeline: PipelineMethod<DefaultActionType>[]): this;
|
38 | defaultAction(options?: IFetchOptions): Promise<DefaultActionType>;
|
39 | getRuntime(): Runtime;
|
40 | setRuntime(runtime: Runtime): this;
|
41 | setRuntime(cloneGlobal: boolean, additionalConfig?: ITypedHash<any>): this;
|
42 | }
|
43 | export declare abstract class Queryable<DefaultActionType = any> implements IQueryable<DefaultActionType> {
|
44 | private _data;
|
45 | private _runtime;
|
46 | constructor(dataSeed?: Partial<IQueryableData<DefaultActionType>>);
|
47 | get data(): Partial<IQueryableData<DefaultActionType>>;
|
48 | set data(value: Partial<IQueryableData<DefaultActionType>>);
|
49 | getRuntime(): Runtime;
|
50 | setRuntime(runtime: Runtime): this;
|
51 | setRuntime(cloneGlobal: boolean, additionalConfig?: ITypedHash<any>): this;
|
52 | /**
|
53 | * Gets the full url with query information
|
54 | *
|
55 | */
|
56 | abstract toUrlAndQuery(): string;
|
57 | /**
|
58 | * The default action for this
|
59 | */
|
60 | abstract defaultAction(options?: IFetchOptions): Promise<DefaultActionType>;
|
61 | /**
|
62 | * Gets the current url
|
63 | *
|
64 | */
|
65 | toUrl(): string;
|
66 | /**
|
67 | * Directly concatenates the supplied string to the current url, not normalizing "/" chars
|
68 | *
|
69 | * @param pathPart The string to concatenate to the url
|
70 | */
|
71 | concat(pathPart: string): this;
|
72 | /**
|
73 | * Provides access to the query builder for this url
|
74 | *
|
75 | */
|
76 | get query(): Map<string, string>;
|
77 | /**
|
78 | * Sets custom options for current object and all derived objects accessible via chaining
|
79 | *
|
80 | * @param options custom options
|
81 | */
|
82 | configure(options: IConfigOptions): this;
|
83 | /**
|
84 | * Configures this instance from the configure options of the supplied instance
|
85 | *
|
86 | * @param o Instance from which options should be taken
|
87 | */
|
88 | configureFrom(o: IQueryable<any>): this;
|
89 | /**
|
90 | * Enables caching for this request
|
91 | *
|
92 | * @param options Defines the options used when caching this request
|
93 | */
|
94 | usingCaching(options?: string | ICachingOptions): this;
|
95 | usingParser(parser: IODataParser<any>): this;
|
96 | /**
|
97 | * Allows you to set a request specific processing pipeline
|
98 | *
|
99 | * @param pipeline The set of methods, in order, to execute a given request
|
100 | */
|
101 | withPipeline(pipeline: PipelineMethod<DefaultActionType>[]): this;
|
102 | /**
|
103 | * Appends the given string and normalizes "/" chars
|
104 | *
|
105 | * @param pathPart The string to append
|
106 | */
|
107 | append(pathPart: string): void;
|
108 | /**
|
109 | * Adds this query to the supplied batch
|
110 | *
|
111 | * @example
|
112 | * ```
|
113 | *
|
114 | * let b = pnp.sp.createBatch();
|
115 | * pnp.sp.web.inBatch(b).get().then(...);
|
116 | * b.execute().then(...)
|
117 | * ```
|
118 | */
|
119 | inBatch(batch: Batch): this;
|
120 | /**
|
121 | * Blocks a batch call from occuring, MUST be cleared by calling the returned function
|
122 | */
|
123 | addBatchDependency(): () => void;
|
124 | /**
|
125 | * Indicates if the current query has a batch associated
|
126 | *
|
127 | */
|
128 | protected get hasBatch(): boolean;
|
129 | /**
|
130 | * The batch currently associated with this query or null
|
131 | *
|
132 | */
|
133 | protected get batch(): Batch | null;
|
134 | /**
|
135 | * Gets the parent url used when creating this instance
|
136 | *
|
137 | */
|
138 | protected get parentUrl(): string;
|
139 | /**
|
140 | * Clones this instance's data to target
|
141 | *
|
142 | * @param target Instance to which data is written
|
143 | * @param settings [Optional] Settings controlling how clone is applied
|
144 | */
|
145 | protected cloneTo<T extends IQueryable<any>>(target: T, settings?: {
|
146 | includeBatch?: boolean;
|
147 | includeQuery?: boolean;
|
148 | }): T;
|
149 | }
|
150 | //# sourceMappingURL=queryable.d.ts.map |
\ | No newline at end of file |