1 | import { ODataParser } from "./parsers.js";
|
2 | import { getGUID, objectDefinedNotNull } from "@pnp/common";
|
3 | import { cloneQueryableData } from "./queryable.js";
|
4 | import { pipe, getDefaultPipeline } from "./pipeline.js";
|
5 |
|
6 | export function pipelineBinder(pipes) {
|
7 |
|
8 | return function (clientFactory) {
|
9 |
|
10 | return function (method) {
|
11 |
|
12 | return function (o) {
|
13 |
|
14 | return pipe(Object.assign({}, {
|
15 | batch: null,
|
16 | batchDependency: null,
|
17 | batchIndex: -1,
|
18 | cachingOptions: null,
|
19 | clientFactory: clientFactory,
|
20 | cloneParentCacheOptions: null,
|
21 | cloneParentWasCaching: false,
|
22 | hasResult: false,
|
23 | isBatched: objectDefinedNotNull(o.batch),
|
24 | method: method,
|
25 | options: null,
|
26 | parentUrl: "",
|
27 | parser: new ODataParser(),
|
28 | pipes: pipes.slice(0),
|
29 | query: new Map(),
|
30 | requestId: getGUID(),
|
31 | url: "",
|
32 | useCaching: /^get$/i.test(o.method) && o.useCaching,
|
33 | }, cloneQueryableData(o)));
|
34 | };
|
35 | };
|
36 | };
|
37 | }
|
38 | export var defaultPipelineBinder = pipelineBinder(getDefaultPipeline());
|
39 |
|
\ | No newline at end of file |