UNPKG

1.62 kBJavaScriptView Raw
1import { __decorate } from "tslib";
2import { body } from "@pnp/queryable";
3import { _SPInstance, _SPCollection, spInvokableFactory, } from "../spqueryable.js";
4import { defaultPath } from "../decorators.js";
5import { spPost } from "../operations.js";
6let _Features = class _Features extends _SPCollection {
7 /**
8 * Adds (activates) the specified feature
9 *
10 * @param id The Id of the feature (GUID)
11 * @param force If true the feature activation will be forced
12 */
13 async add(featureId, force = false) {
14 const data = await spPost(Features(this, "add"), body({
15 featdefScope: 0,
16 featureId,
17 force,
18 }));
19 return {
20 data: data,
21 feature: this.getById(featureId),
22 };
23 }
24 /**
25 * Gets a feature from the collection with the specified guid
26 *
27 * @param id The Id of the feature (GUID)
28 */
29 getById(id) {
30 return Feature(this).concat(`('${id}')`);
31 }
32 /**
33 * Removes (deactivates) a feature from the collection
34 *
35 * @param id The Id of the feature (GUID)
36 * @param force If true the feature deactivation will be forced
37 */
38 remove(featureId, force = false) {
39 return spPost(Features(this, "remove"), body({
40 featureId,
41 force,
42 }));
43 }
44};
45_Features = __decorate([
46 defaultPath("features")
47], _Features);
48export { _Features };
49export const Features = spInvokableFactory(_Features);
50export class _Feature extends _SPInstance {
51}
52export const Feature = spInvokableFactory(_Feature);
53//# sourceMappingURL=types.js.map
\No newline at end of file