1 | import { __decorate } from "tslib";
|
2 | import { body } from "@pnp/queryable";
|
3 | import { _SPCollection, _SPInstance, spInvokableFactory, SPCollection, deleteable, } from "../spqueryable.js";
|
4 | import { defaultPath } from "../decorators.js";
|
5 | import { spPost, spPostMerge } from "../operations.js";
|
6 | let _ContentTypes = class _ContentTypes extends _SPCollection {
|
7 | |
8 |
|
9 |
|
10 |
|
11 |
|
12 | async addAvailableContentType(contentTypeId) {
|
13 | const data = await spPost(ContentTypes(this, "addAvailableContentType"), body({ "contentTypeId": contentTypeId }));
|
14 | return {
|
15 | contentType: this.getById(data.id),
|
16 | data: data,
|
17 | };
|
18 | }
|
19 | |
20 |
|
21 |
|
22 |
|
23 | getById(id) {
|
24 | return ContentType(this).concat(`('${id}')`);
|
25 | }
|
26 | |
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | async add(id, name, description = "", group = "Custom Content Types", additionalSettings = {}) {
|
38 | const postBody = body({
|
39 | Description: description,
|
40 | Group: group,
|
41 | Id: { StringValue: id },
|
42 | Name: name,
|
43 | ...additionalSettings,
|
44 | });
|
45 | const data = await spPost(this, postBody);
|
46 | return { contentType: this.getById(data.id), data };
|
47 | }
|
48 | };
|
49 | _ContentTypes = __decorate([
|
50 | defaultPath("contenttypes")
|
51 | ], _ContentTypes);
|
52 | export { _ContentTypes };
|
53 | export const ContentTypes = spInvokableFactory(_ContentTypes);
|
54 | export class _ContentType extends _SPInstance {
|
55 | constructor() {
|
56 | super(...arguments);
|
57 | this.delete = deleteable();
|
58 | }
|
59 | |
60 |
|
61 |
|
62 |
|
63 |
|
64 | async update(properties) {
|
65 | return spPostMerge(this, body(properties));
|
66 | }
|
67 | |
68 |
|
69 |
|
70 | get fieldLinks() {
|
71 | return FieldLinks(this);
|
72 | }
|
73 | |
74 |
|
75 |
|
76 | get fields() {
|
77 | return SPCollection(this, "fields");
|
78 | }
|
79 | |
80 |
|
81 |
|
82 | get parent() {
|
83 | return ContentType(this, "parent");
|
84 | }
|
85 | |
86 |
|
87 |
|
88 | get workflowAssociations() {
|
89 | return SPCollection(this, "workflowAssociations");
|
90 | }
|
91 | }
|
92 | export const ContentType = spInvokableFactory(_ContentType);
|
93 | let _FieldLinks = class _FieldLinks extends _SPCollection {
|
94 | |
95 |
|
96 |
|
97 |
|
98 |
|
99 | getById(id) {
|
100 | return FieldLink(this).concat(`(guid'${id}')`);
|
101 | }
|
102 | };
|
103 | _FieldLinks = __decorate([
|
104 | defaultPath("fieldlinks")
|
105 | ], _FieldLinks);
|
106 | export { _FieldLinks };
|
107 | export const FieldLinks = spInvokableFactory(_FieldLinks);
|
108 | export class _FieldLink extends _SPInstance {
|
109 | }
|
110 | export const FieldLink = spInvokableFactory(_FieldLink);
|
111 |
|
\ | No newline at end of file |