UNPKG

2.99 kBJavaScriptView Raw
1import { __decorate } from "tslib";
2import { _SPCollection, spInvokableFactory, deleteable, _SPInstance, } from "../spqueryable.js";
3import { body } from "@pnp/queryable";
4import { defaultPath } from "../decorators.js";
5import { spPost, spPostMerge } from "../operations.js";
6let _UserCustomActions = class _UserCustomActions extends _SPCollection {
7 /**
8 * Returns the user custom action with the specified id
9 *
10 * @param id The GUID id of the user custom action to retrieve
11 */
12 getById(id) {
13 return UserCustomAction(this).concat(`('${id}')`);
14 }
15 /**
16 * Creates a user custom action
17 *
18 * @param properties The information object of property names and values which define the new user custom action
19 */
20 async add(properties) {
21 const data = await spPost(this, body(properties));
22 return {
23 action: this.getById(data.Id),
24 data,
25 };
26 }
27 /**
28 * Deletes all user custom actions in the collection
29 */
30 clear() {
31 return spPost(UserCustomActions(this, "clear"));
32 }
33};
34_UserCustomActions = __decorate([
35 defaultPath("usercustomactions")
36], _UserCustomActions);
37export { _UserCustomActions };
38export const UserCustomActions = spInvokableFactory(_UserCustomActions);
39export class _UserCustomAction extends _SPInstance {
40 constructor() {
41 super(...arguments);
42 this.delete = deleteable();
43 }
44 /**
45 * Updates this user custom action with the supplied properties
46 *
47 * @param properties An information object of property names and values to update for this user custom action
48 */
49 async update(props) {
50 const data = await spPostMerge(this, body(props));
51 return {
52 data,
53 action: this,
54 };
55 }
56}
57export const UserCustomAction = spInvokableFactory(_UserCustomAction);
58export var UserCustomActionRegistrationType;
59(function (UserCustomActionRegistrationType) {
60 UserCustomActionRegistrationType[UserCustomActionRegistrationType["None"] = 0] = "None";
61 UserCustomActionRegistrationType[UserCustomActionRegistrationType["List"] = 1] = "List";
62 UserCustomActionRegistrationType[UserCustomActionRegistrationType["ContentType"] = 2] = "ContentType";
63 UserCustomActionRegistrationType[UserCustomActionRegistrationType["ProgId"] = 3] = "ProgId";
64 UserCustomActionRegistrationType[UserCustomActionRegistrationType["FileType"] = 4] = "FileType";
65})(UserCustomActionRegistrationType || (UserCustomActionRegistrationType = {}));
66export var UserCustomActionScope;
67(function (UserCustomActionScope) {
68 UserCustomActionScope[UserCustomActionScope["Unknown"] = 0] = "Unknown";
69 UserCustomActionScope[UserCustomActionScope["Site"] = 2] = "Site";
70 UserCustomActionScope[UserCustomActionScope["Web"] = 3] = "Web";
71 UserCustomActionScope[UserCustomActionScope["List"] = 4] = "List";
72})(UserCustomActionScope || (UserCustomActionScope = {}));
73//# sourceMappingURL=types.js.map
\No newline at end of file