@timbenniks/contentstack-platform-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.cjs +607 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +108 -0
- package/dist/auth/index.d.ts +108 -0
- package/dist/auth/index.mjs +25 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/brandkit/index.cjs +525 -0
- package/dist/brandkit/index.cjs.map +1 -0
- package/dist/brandkit/index.d.cts +95 -0
- package/dist/brandkit/index.d.ts +95 -0
- package/dist/brandkit/index.mjs +11 -0
- package/dist/brandkit/index.mjs.map +1 -0
- package/dist/chunk-3C6J2BDB.mjs +84 -0
- package/dist/chunk-3C6J2BDB.mjs.map +1 -0
- package/dist/chunk-3KE63N3I.mjs +64 -0
- package/dist/chunk-3KE63N3I.mjs.map +1 -0
- package/dist/chunk-4CJ4IVPJ.mjs +212 -0
- package/dist/chunk-4CJ4IVPJ.mjs.map +1 -0
- package/dist/chunk-4JFUI7MJ.mjs +368 -0
- package/dist/chunk-4JFUI7MJ.mjs.map +1 -0
- package/dist/chunk-7VFGD32I.mjs +26 -0
- package/dist/chunk-7VFGD32I.mjs.map +1 -0
- package/dist/chunk-ARPJDW3A.mjs +44 -0
- package/dist/chunk-ARPJDW3A.mjs.map +1 -0
- package/dist/chunk-AVJHCFRK.mjs +52 -0
- package/dist/chunk-AVJHCFRK.mjs.map +1 -0
- package/dist/chunk-BK2IBTQS.mjs +131 -0
- package/dist/chunk-BK2IBTQS.mjs.map +1 -0
- package/dist/chunk-BUZ6CQHE.mjs +75 -0
- package/dist/chunk-BUZ6CQHE.mjs.map +1 -0
- package/dist/chunk-CKMAOWBQ.mjs +379 -0
- package/dist/chunk-CKMAOWBQ.mjs.map +1 -0
- package/dist/chunk-DJQLN4TR.mjs +1 -0
- package/dist/chunk-DJQLN4TR.mjs.map +1 -0
- package/dist/chunk-DMERADWM.mjs +67 -0
- package/dist/chunk-DMERADWM.mjs.map +1 -0
- package/dist/chunk-EREPKWTW.mjs +926 -0
- package/dist/chunk-EREPKWTW.mjs.map +1 -0
- package/dist/chunk-FQP4PB5X.mjs +88 -0
- package/dist/chunk-FQP4PB5X.mjs.map +1 -0
- package/dist/chunk-GNPQJBFX.mjs +144 -0
- package/dist/chunk-GNPQJBFX.mjs.map +1 -0
- package/dist/chunk-GOSB24M6.mjs +87 -0
- package/dist/chunk-GOSB24M6.mjs.map +1 -0
- package/dist/chunk-JL2E3EOT.mjs +255 -0
- package/dist/chunk-JL2E3EOT.mjs.map +1 -0
- package/dist/chunk-JYGZBKTH.mjs +222 -0
- package/dist/chunk-JYGZBKTH.mjs.map +1 -0
- package/dist/chunk-JZE2W7VW.mjs +52 -0
- package/dist/chunk-JZE2W7VW.mjs.map +1 -0
- package/dist/chunk-K76DKSHJ.mjs +18 -0
- package/dist/chunk-K76DKSHJ.mjs.map +1 -0
- package/dist/chunk-KLVIROVU.mjs +232 -0
- package/dist/chunk-KLVIROVU.mjs.map +1 -0
- package/dist/chunk-LPVVA5J3.mjs +18 -0
- package/dist/chunk-LPVVA5J3.mjs.map +1 -0
- package/dist/chunk-NKLOZ5VI.mjs +112 -0
- package/dist/chunk-NKLOZ5VI.mjs.map +1 -0
- package/dist/chunk-QGA4WBDC.mjs +7 -0
- package/dist/chunk-QGA4WBDC.mjs.map +1 -0
- package/dist/chunk-QW7TVYOA.mjs +56 -0
- package/dist/chunk-QW7TVYOA.mjs.map +1 -0
- package/dist/chunk-SU5QEKYW.mjs +83 -0
- package/dist/chunk-SU5QEKYW.mjs.map +1 -0
- package/dist/chunk-T5A2E2RI.mjs +654 -0
- package/dist/chunk-T5A2E2RI.mjs.map +1 -0
- package/dist/chunk-T5OIJQK7.mjs +116 -0
- package/dist/chunk-T5OIJQK7.mjs.map +1 -0
- package/dist/chunk-VW7DD6HV.mjs +253 -0
- package/dist/chunk-VW7DD6HV.mjs.map +1 -0
- package/dist/chunk-XH7NLHGW.mjs +133 -0
- package/dist/chunk-XH7NLHGW.mjs.map +1 -0
- package/dist/client-DJ5haQGd.d.cts +22 -0
- package/dist/client-DwVGVSQz.d.ts +22 -0
- package/dist/cma/index.cjs +1349 -0
- package/dist/cma/index.cjs.map +1 -0
- package/dist/cma/index.d.cts +22 -0
- package/dist/cma/index.d.ts +22 -0
- package/dist/cma/index.mjs +70 -0
- package/dist/cma/index.mjs.map +1 -0
- package/dist/errors-CAw-IRCP.d.cts +65 -0
- package/dist/errors-CAw-IRCP.d.ts +65 -0
- package/dist/generative-ai/index.cjs +401 -0
- package/dist/generative-ai/index.cjs.map +1 -0
- package/dist/generative-ai/index.d.cts +31 -0
- package/dist/generative-ai/index.d.ts +31 -0
- package/dist/generative-ai/index.mjs +10 -0
- package/dist/generative-ai/index.mjs.map +1 -0
- package/dist/images/index.cjs +185 -0
- package/dist/images/index.cjs.map +1 -0
- package/dist/images/index.d.cts +27 -0
- package/dist/images/index.d.ts +27 -0
- package/dist/images/index.mjs +8 -0
- package/dist/images/index.mjs.map +1 -0
- package/dist/index.cjs +2909 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.mjs +153 -0
- package/dist/index.mjs.map +1 -0
- package/dist/knowledge-vault/index.cjs +413 -0
- package/dist/knowledge-vault/index.cjs.map +1 -0
- package/dist/knowledge-vault/index.d.cts +49 -0
- package/dist/knowledge-vault/index.d.ts +49 -0
- package/dist/knowledge-vault/index.mjs +10 -0
- package/dist/knowledge-vault/index.mjs.map +1 -0
- package/dist/launch/index.cjs +624 -0
- package/dist/launch/index.cjs.map +1 -0
- package/dist/launch/index.d.cts +169 -0
- package/dist/launch/index.d.ts +169 -0
- package/dist/launch/index.mjs +11 -0
- package/dist/launch/index.mjs.map +1 -0
- package/dist/react/auth/index.cjs +113 -0
- package/dist/react/auth/index.cjs.map +1 -0
- package/dist/react/auth/index.d.cts +33 -0
- package/dist/react/auth/index.d.ts +33 -0
- package/dist/react/auth/index.mjs +13 -0
- package/dist/react/auth/index.mjs.map +1 -0
- package/dist/react/content/index.cjs +113 -0
- package/dist/react/content/index.cjs.map +1 -0
- package/dist/react/content/index.d.cts +25 -0
- package/dist/react/content/index.d.ts +25 -0
- package/dist/react/content/index.mjs +7 -0
- package/dist/react/content/index.mjs.map +1 -0
- package/dist/react/hooks/index.cjs +2097 -0
- package/dist/react/hooks/index.cjs.map +1 -0
- package/dist/react/hooks/index.d.cts +77 -0
- package/dist/react/hooks/index.d.ts +77 -0
- package/dist/react/hooks/index.mjs +46 -0
- package/dist/react/hooks/index.mjs.map +1 -0
- package/dist/react/index.cjs +2307 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +16 -0
- package/dist/react/index.d.ts +16 -0
- package/dist/react/index.mjs +67 -0
- package/dist/react/index.mjs.map +1 -0
- package/dist/react/provider/index.cjs +83 -0
- package/dist/react/provider/index.cjs.map +1 -0
- package/dist/react/provider/index.d.cts +30 -0
- package/dist/react/provider/index.d.ts +30 -0
- package/dist/react/provider/index.mjs +11 -0
- package/dist/react/provider/index.mjs.map +1 -0
- package/dist/regions/index.cjs +171 -0
- package/dist/regions/index.cjs.map +1 -0
- package/dist/regions/index.d.cts +55 -0
- package/dist/regions/index.d.ts +55 -0
- package/dist/regions/index.mjs +13 -0
- package/dist/regions/index.mjs.map +1 -0
- package/dist/request-builders-BxeolQIw.d.ts +735 -0
- package/dist/request-builders-C2IG1LUo.d.cts +735 -0
- package/dist/rte/index.cjs +683 -0
- package/dist/rte/index.cjs.map +1 -0
- package/dist/rte/index.d.cts +33 -0
- package/dist/rte/index.d.ts +33 -0
- package/dist/rte/index.mjs +17 -0
- package/dist/rte/index.mjs.map +1 -0
- package/dist/server/index.cjs +917 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/server/index.d.cts +6 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.mjs +45 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/server/middleware/index.cjs +614 -0
- package/dist/server/middleware/index.cjs.map +1 -0
- package/dist/server/middleware/index.d.cts +77 -0
- package/dist/server/middleware/index.d.ts +77 -0
- package/dist/server/middleware/index.mjs +27 -0
- package/dist/server/middleware/index.mjs.map +1 -0
- package/dist/server/proxy/index.cjs +329 -0
- package/dist/server/proxy/index.cjs.map +1 -0
- package/dist/server/proxy/index.d.cts +143 -0
- package/dist/server/proxy/index.d.ts +143 -0
- package/dist/server/proxy/index.mjs +29 -0
- package/dist/server/proxy/index.mjs.map +1 -0
- package/dist/server/webhooks/index.cjs +131 -0
- package/dist/server/webhooks/index.cjs.map +1 -0
- package/dist/server/webhooks/index.d.cts +230 -0
- package/dist/server/webhooks/index.d.ts +230 -0
- package/dist/server/webhooks/index.mjs +23 -0
- package/dist/server/webhooks/index.mjs.map +1 -0
- package/dist/types-6D9VR7pT.d.cts +26 -0
- package/dist/types-AelT0rFJ.d.cts +21 -0
- package/dist/types-AelT0rFJ.d.ts +21 -0
- package/dist/types-Bu5yCgmw.d.ts +26 -0
- package/dist/types-DgixK-ll.d.cts +23 -0
- package/dist/types-DgixK-ll.d.ts +23 -0
- package/dist/types-DrMwdlH9.d.cts +245 -0
- package/dist/types-DrMwdlH9.d.ts +245 -0
- package/dist/ui/css/index.cjs +31 -0
- package/dist/ui/css/index.cjs.map +1 -0
- package/dist/ui/css/index.d.cts +15 -0
- package/dist/ui/css/index.d.ts +15 -0
- package/dist/ui/css/index.mjs +7 -0
- package/dist/ui/css/index.mjs.map +1 -0
- package/dist/ui/index.cjs +368 -0
- package/dist/ui/index.cjs.map +1 -0
- package/dist/ui/index.d.cts +4 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.mjs +33 -0
- package/dist/ui/index.mjs.map +1 -0
- package/dist/ui/theme/index.cjs +105 -0
- package/dist/ui/theme/index.cjs.map +1 -0
- package/dist/ui/theme/index.d.cts +33 -0
- package/dist/ui/theme/index.d.ts +33 -0
- package/dist/ui/theme/index.mjs +15 -0
- package/dist/ui/theme/index.mjs.map +1 -0
- package/dist/ui/tokens/index.cjs +286 -0
- package/dist/ui/tokens/index.cjs.map +1 -0
- package/dist/ui/tokens/index.d.cts +54 -0
- package/dist/ui/tokens/index.d.ts +54 -0
- package/dist/ui/tokens/index.mjs +17 -0
- package/dist/ui/tokens/index.mjs.map +1 -0
- package/dist/ui/tokens.css +408 -0
- package/dist/vue/auth/index.cjs +141 -0
- package/dist/vue/auth/index.cjs.map +1 -0
- package/dist/vue/auth/index.d.cts +78 -0
- package/dist/vue/auth/index.d.ts +78 -0
- package/dist/vue/auth/index.mjs +13 -0
- package/dist/vue/auth/index.mjs.map +1 -0
- package/dist/vue/composables/index.cjs +2108 -0
- package/dist/vue/composables/index.cjs.map +1 -0
- package/dist/vue/composables/index.d.cts +78 -0
- package/dist/vue/composables/index.d.ts +78 -0
- package/dist/vue/composables/index.mjs +46 -0
- package/dist/vue/composables/index.mjs.map +1 -0
- package/dist/vue/content/index.cjs +142 -0
- package/dist/vue/content/index.cjs.map +1 -0
- package/dist/vue/content/index.d.cts +47 -0
- package/dist/vue/content/index.d.ts +47 -0
- package/dist/vue/content/index.mjs +7 -0
- package/dist/vue/content/index.mjs.map +1 -0
- package/dist/vue/index.cjs +2389 -0
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.cts +16 -0
- package/dist/vue/index.d.ts +16 -0
- package/dist/vue/index.mjs +69 -0
- package/dist/vue/index.mjs.map +1 -0
- package/dist/vue/provider/index.cjs +97 -0
- package/dist/vue/provider/index.cjs.map +1 -0
- package/dist/vue/provider/index.d.cts +90 -0
- package/dist/vue/provider/index.d.ts +90 -0
- package/dist/vue/provider/index.mjs +13 -0
- package/dist/vue/provider/index.mjs.map +1 -0
- package/package.json +195 -0
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
import {
|
|
2
|
+
collectAll,
|
|
3
|
+
paginate
|
|
4
|
+
} from "./chunk-JZE2W7VW.mjs";
|
|
5
|
+
import {
|
|
6
|
+
ContentstackHttpClient
|
|
7
|
+
} from "./chunk-4CJ4IVPJ.mjs";
|
|
8
|
+
import {
|
|
9
|
+
resolveEndpoints
|
|
10
|
+
} from "./chunk-BK2IBTQS.mjs";
|
|
11
|
+
|
|
12
|
+
// src/cma/assets.ts
|
|
13
|
+
var AssetsClient = class {
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.http = http;
|
|
16
|
+
}
|
|
17
|
+
list(opts) {
|
|
18
|
+
return paginate(
|
|
19
|
+
async (skip, limit) => {
|
|
20
|
+
const params = {
|
|
21
|
+
skip: String(skip),
|
|
22
|
+
limit: String(limit)
|
|
23
|
+
};
|
|
24
|
+
if (opts?.folder) params.folder = opts.folder;
|
|
25
|
+
const response = await this.http.get("/assets", params);
|
|
26
|
+
return { items: response.data.assets ?? [], count: response.data.count };
|
|
27
|
+
},
|
|
28
|
+
{ limit: opts?.limit }
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
async listAll(opts) {
|
|
32
|
+
return collectAll(this.list(opts));
|
|
33
|
+
}
|
|
34
|
+
async get(uid) {
|
|
35
|
+
const response = await this.http.get(`/assets/${uid}`);
|
|
36
|
+
return response.data.asset;
|
|
37
|
+
}
|
|
38
|
+
async upload(form) {
|
|
39
|
+
const response = await this.http.upload("/assets", form);
|
|
40
|
+
return response.data.asset;
|
|
41
|
+
}
|
|
42
|
+
async update(uid, data) {
|
|
43
|
+
const response = await this.http.put(`/assets/${uid}`, { asset: data });
|
|
44
|
+
return response.data.asset;
|
|
45
|
+
}
|
|
46
|
+
async delete(uid) {
|
|
47
|
+
await this.http.delete(`/assets/${uid}`);
|
|
48
|
+
}
|
|
49
|
+
async publish(uid, data) {
|
|
50
|
+
await this.http.post(`/assets/${uid}/publish`, { asset: data });
|
|
51
|
+
}
|
|
52
|
+
async unpublish(uid, data) {
|
|
53
|
+
await this.http.post(`/assets/${uid}/unpublish`, { asset: data });
|
|
54
|
+
}
|
|
55
|
+
// ─── Folders ──────────────────────────────────────────────────────
|
|
56
|
+
async listFolders(opts) {
|
|
57
|
+
const response = await this.http.get("/assets/folders", {
|
|
58
|
+
limit: String(opts?.limit ?? 100)
|
|
59
|
+
});
|
|
60
|
+
return response.data.assets ?? [];
|
|
61
|
+
}
|
|
62
|
+
async getFolder(uid) {
|
|
63
|
+
const response = await this.http.get(`/assets/folders/${uid}`);
|
|
64
|
+
return response.data.asset;
|
|
65
|
+
}
|
|
66
|
+
async createFolder(data) {
|
|
67
|
+
const response = await this.http.post("/assets/folders", {
|
|
68
|
+
asset: data
|
|
69
|
+
});
|
|
70
|
+
return response.data.asset;
|
|
71
|
+
}
|
|
72
|
+
async updateFolder(uid, data) {
|
|
73
|
+
const response = await this.http.put(`/assets/folders/${uid}`, {
|
|
74
|
+
asset: data
|
|
75
|
+
});
|
|
76
|
+
return response.data.asset;
|
|
77
|
+
}
|
|
78
|
+
async deleteFolder(uid) {
|
|
79
|
+
await this.http.delete(`/assets/folders/${uid}`);
|
|
80
|
+
}
|
|
81
|
+
// ─── Additional Operations ──────────────────────────────────────
|
|
82
|
+
async replace(uid, form) {
|
|
83
|
+
const response = await this.http.upload(`/assets/${uid}`, form);
|
|
84
|
+
return response.data.asset;
|
|
85
|
+
}
|
|
86
|
+
async getReferences(uid) {
|
|
87
|
+
const response = await this.http.get(`/assets/${uid}/references`);
|
|
88
|
+
return response.data.references ?? [];
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// src/cma/base-client.ts
|
|
93
|
+
var CrudClient = class {
|
|
94
|
+
constructor(http, config) {
|
|
95
|
+
this.http = http;
|
|
96
|
+
this.config = config;
|
|
97
|
+
}
|
|
98
|
+
list(opts) {
|
|
99
|
+
return paginate(
|
|
100
|
+
async (skip, limit) => {
|
|
101
|
+
const response = await this.http.get(this.config.basePath, {
|
|
102
|
+
skip: String(skip),
|
|
103
|
+
limit: String(limit)
|
|
104
|
+
});
|
|
105
|
+
const items = response.data[this.config.pluralKey] ?? [];
|
|
106
|
+
return { items, count: response.data.count };
|
|
107
|
+
},
|
|
108
|
+
{ limit: opts?.limit }
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
async listAll(opts) {
|
|
112
|
+
return collectAll(this.list(opts));
|
|
113
|
+
}
|
|
114
|
+
async get(uid) {
|
|
115
|
+
const response = await this.http.get(`${this.config.basePath}/${uid}`);
|
|
116
|
+
return response.data[this.config.singularKey];
|
|
117
|
+
}
|
|
118
|
+
async create(data) {
|
|
119
|
+
const response = await this.http.post(this.config.basePath, {
|
|
120
|
+
[this.config.singularKey]: data
|
|
121
|
+
});
|
|
122
|
+
return response.data[this.config.singularKey];
|
|
123
|
+
}
|
|
124
|
+
async update(uid, data) {
|
|
125
|
+
const response = await this.http.put(
|
|
126
|
+
`${this.config.basePath}/${uid}`,
|
|
127
|
+
{ [this.config.singularKey]: data }
|
|
128
|
+
);
|
|
129
|
+
return response.data[this.config.singularKey];
|
|
130
|
+
}
|
|
131
|
+
async delete(uid) {
|
|
132
|
+
await this.http.delete(`${this.config.basePath}/${uid}`);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/cma/audit-log.ts
|
|
137
|
+
var AuditLogClient = class extends CrudClient {
|
|
138
|
+
constructor(http) {
|
|
139
|
+
super(http, { basePath: "/audit-logs", singularKey: "audit_log", pluralKey: "audit_logs" });
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// src/cma/branch-aliases.ts
|
|
144
|
+
var BranchAliasesClient = class {
|
|
145
|
+
constructor(http) {
|
|
146
|
+
this.http = http;
|
|
147
|
+
}
|
|
148
|
+
async list() {
|
|
149
|
+
const response = await this.http.get(
|
|
150
|
+
"/stacks/branch_aliases"
|
|
151
|
+
);
|
|
152
|
+
return response.data.branch_aliases ?? [];
|
|
153
|
+
}
|
|
154
|
+
async get(uid) {
|
|
155
|
+
const response = await this.http.get(
|
|
156
|
+
`/stacks/branch_aliases/${uid}`
|
|
157
|
+
);
|
|
158
|
+
return response.data.branch_alias;
|
|
159
|
+
}
|
|
160
|
+
async createOrUpdate(uid, targetBranch) {
|
|
161
|
+
const response = await this.http.put(
|
|
162
|
+
`/stacks/branch_aliases/${uid}`,
|
|
163
|
+
{ branch_alias: { target_branch: targetBranch } }
|
|
164
|
+
);
|
|
165
|
+
return response.data.branch_alias;
|
|
166
|
+
}
|
|
167
|
+
async delete(uid) {
|
|
168
|
+
await this.http.delete(`/stacks/branch_aliases/${uid}`);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// src/cma/branches.ts
|
|
173
|
+
var BranchesClient = class {
|
|
174
|
+
constructor(http) {
|
|
175
|
+
this.http = http;
|
|
176
|
+
}
|
|
177
|
+
list(opts) {
|
|
178
|
+
return paginate(
|
|
179
|
+
async (skip, limit) => {
|
|
180
|
+
const response = await this.http.get(
|
|
181
|
+
"/stacks/branches",
|
|
182
|
+
{ skip: String(skip), limit: String(limit) }
|
|
183
|
+
);
|
|
184
|
+
return { items: response.data.branches ?? [], count: response.data.count };
|
|
185
|
+
},
|
|
186
|
+
{ limit: opts?.limit }
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
async listAll(opts) {
|
|
190
|
+
return collectAll(this.list(opts));
|
|
191
|
+
}
|
|
192
|
+
async get(uid) {
|
|
193
|
+
const response = await this.http.get(`/stacks/branches/${uid}`);
|
|
194
|
+
return response.data.branch;
|
|
195
|
+
}
|
|
196
|
+
async create(data) {
|
|
197
|
+
const response = await this.http.post("/stacks/branches", {
|
|
198
|
+
branch: data
|
|
199
|
+
});
|
|
200
|
+
return response.data.branch;
|
|
201
|
+
}
|
|
202
|
+
async delete(uid) {
|
|
203
|
+
await this.http.delete(`/stacks/branches/${uid}`);
|
|
204
|
+
}
|
|
205
|
+
async compare(baseBranch, compareBranch) {
|
|
206
|
+
const response = await this.http.get("/stacks/branches_compare", {
|
|
207
|
+
base_branch: baseBranch,
|
|
208
|
+
compare_branch: compareBranch
|
|
209
|
+
});
|
|
210
|
+
return response.data;
|
|
211
|
+
}
|
|
212
|
+
async merge(data) {
|
|
213
|
+
const response = await this.http.post("/stacks/branches_merge", data);
|
|
214
|
+
return response.data.merge_job;
|
|
215
|
+
}
|
|
216
|
+
async listMergeJobs() {
|
|
217
|
+
const response = await this.http.get("/stacks/branches_queue");
|
|
218
|
+
return response.data.merge_jobs ?? [];
|
|
219
|
+
}
|
|
220
|
+
async getMergeJob(uid) {
|
|
221
|
+
const response = await this.http.get(`/stacks/branches_queue/${uid}`);
|
|
222
|
+
return response.data.merge_job;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// src/cma/bulk.ts
|
|
227
|
+
var BulkOperationsClient = class {
|
|
228
|
+
constructor(http) {
|
|
229
|
+
this.http = http;
|
|
230
|
+
}
|
|
231
|
+
async publish(data) {
|
|
232
|
+
await this.http.post("/bulk/publish", data);
|
|
233
|
+
}
|
|
234
|
+
async unpublish(data) {
|
|
235
|
+
await this.http.post("/bulk/unpublish", data);
|
|
236
|
+
}
|
|
237
|
+
async delete(data) {
|
|
238
|
+
await this.http.post("/bulk/delete", data);
|
|
239
|
+
}
|
|
240
|
+
async updateWorkflow(data) {
|
|
241
|
+
await this.http.post("/bulk/workflow", data);
|
|
242
|
+
}
|
|
243
|
+
async addItems(data) {
|
|
244
|
+
await this.http.post("/bulk/add", data);
|
|
245
|
+
}
|
|
246
|
+
async updateItems(data) {
|
|
247
|
+
await this.http.post("/bulk/update", data);
|
|
248
|
+
}
|
|
249
|
+
async jobStatus(jobId) {
|
|
250
|
+
const response = await this.http.get(`/bulk/jobs/${jobId}`);
|
|
251
|
+
return response.data.job;
|
|
252
|
+
}
|
|
253
|
+
async getJobItems(jobId, opts) {
|
|
254
|
+
const params = {};
|
|
255
|
+
if (opts?.limit) params.limit = String(opts.limit);
|
|
256
|
+
if (opts?.skip) params.skip = String(opts.skip);
|
|
257
|
+
const response = await this.http.get(
|
|
258
|
+
`/bulk/jobs/${jobId}/items`,
|
|
259
|
+
Object.keys(params).length > 0 ? params : void 0
|
|
260
|
+
);
|
|
261
|
+
return response.data.items ?? [];
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// src/cma/content-types.ts
|
|
266
|
+
var ContentTypesClient = class extends CrudClient {
|
|
267
|
+
constructor(http) {
|
|
268
|
+
super(http, {
|
|
269
|
+
basePath: "/content_types",
|
|
270
|
+
singularKey: "content_type",
|
|
271
|
+
pluralKey: "content_types"
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
list(opts) {
|
|
275
|
+
return paginate(
|
|
276
|
+
async (skip, limit) => {
|
|
277
|
+
const params = {
|
|
278
|
+
skip: String(skip),
|
|
279
|
+
limit: String(limit)
|
|
280
|
+
};
|
|
281
|
+
if (opts?.include_count) params.include_count = "true";
|
|
282
|
+
const response = await this.http.get("/content_types", params);
|
|
283
|
+
return { items: response.data.content_types ?? [], count: response.data.count };
|
|
284
|
+
},
|
|
285
|
+
{ limit: opts?.limit }
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
async listAll(opts) {
|
|
289
|
+
return collectAll(this.list(opts));
|
|
290
|
+
}
|
|
291
|
+
async export(uid) {
|
|
292
|
+
const response = await this.http.get(
|
|
293
|
+
`/content_types/${uid}/export`
|
|
294
|
+
);
|
|
295
|
+
return response.data.content_type;
|
|
296
|
+
}
|
|
297
|
+
async import(data) {
|
|
298
|
+
const response = await this.http.post(
|
|
299
|
+
"/content_types/import",
|
|
300
|
+
data
|
|
301
|
+
);
|
|
302
|
+
return response.data.content_type;
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// src/cma/entries.ts
|
|
307
|
+
var EntriesClient = class {
|
|
308
|
+
constructor(http) {
|
|
309
|
+
this.http = http;
|
|
310
|
+
}
|
|
311
|
+
basePath(ctUid) {
|
|
312
|
+
return `/content_types/${ctUid}/entries`;
|
|
313
|
+
}
|
|
314
|
+
list(ctUid, opts) {
|
|
315
|
+
return paginate(
|
|
316
|
+
async (skip, limit) => {
|
|
317
|
+
const params = {
|
|
318
|
+
skip: String(skip),
|
|
319
|
+
limit: String(limit)
|
|
320
|
+
};
|
|
321
|
+
if (opts?.locale) params.locale = opts.locale;
|
|
322
|
+
if (opts?.include_publish_details) params.include_publish_details = "true";
|
|
323
|
+
if (opts?.include_workflow) params.include_workflow = "true";
|
|
324
|
+
if (opts?.include_count) params.include_count = "true";
|
|
325
|
+
if (opts?.query) params.query = JSON.stringify(opts.query);
|
|
326
|
+
if (opts?.asc) params.asc = opts.asc;
|
|
327
|
+
if (opts?.desc) params.desc = opts.desc;
|
|
328
|
+
const response = await this.http.get(
|
|
329
|
+
this.basePath(ctUid),
|
|
330
|
+
params
|
|
331
|
+
);
|
|
332
|
+
return { items: response.data.entries ?? [], count: response.data.count };
|
|
333
|
+
},
|
|
334
|
+
{ limit: opts?.limit }
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
async listAll(ctUid, opts) {
|
|
338
|
+
return collectAll(this.list(ctUid, opts));
|
|
339
|
+
}
|
|
340
|
+
async get(ctUid, entryUid, opts) {
|
|
341
|
+
const params = {};
|
|
342
|
+
if (opts?.locale) params.locale = opts.locale;
|
|
343
|
+
if (opts?.include_publish_details) params.include_publish_details = "true";
|
|
344
|
+
if (opts?.include_workflow) params.include_workflow = "true";
|
|
345
|
+
if (opts?.version) params.version = String(opts.version);
|
|
346
|
+
const response = await this.http.get(
|
|
347
|
+
`${this.basePath(ctUid)}/${entryUid}`,
|
|
348
|
+
Object.keys(params).length > 0 ? params : void 0
|
|
349
|
+
);
|
|
350
|
+
return response.data.entry;
|
|
351
|
+
}
|
|
352
|
+
async create(ctUid, data) {
|
|
353
|
+
const response = await this.http.post(this.basePath(ctUid), { entry: data });
|
|
354
|
+
return response.data.entry;
|
|
355
|
+
}
|
|
356
|
+
async update(ctUid, entryUid, data) {
|
|
357
|
+
const response = await this.http.put(`${this.basePath(ctUid)}/${entryUid}`, {
|
|
358
|
+
entry: data
|
|
359
|
+
});
|
|
360
|
+
return response.data.entry;
|
|
361
|
+
}
|
|
362
|
+
async delete(ctUid, entryUid, opts) {
|
|
363
|
+
let path = `${this.basePath(ctUid)}/${entryUid}`;
|
|
364
|
+
if (opts?.locale) path += `?locale=${encodeURIComponent(opts.locale)}`;
|
|
365
|
+
await this.http.delete(path);
|
|
366
|
+
}
|
|
367
|
+
async publish(ctUid, entryUid, data) {
|
|
368
|
+
await this.http.post(`${this.basePath(ctUid)}/${entryUid}/publish`, { entry: data });
|
|
369
|
+
}
|
|
370
|
+
async unpublish(ctUid, entryUid, data) {
|
|
371
|
+
await this.http.post(`${this.basePath(ctUid)}/${entryUid}/unpublish`, { entry: data });
|
|
372
|
+
}
|
|
373
|
+
async localize(ctUid, entryUid, data) {
|
|
374
|
+
const response = await this.http.post(
|
|
375
|
+
`${this.basePath(ctUid)}/${entryUid}/localize`,
|
|
376
|
+
{ entry: data }
|
|
377
|
+
);
|
|
378
|
+
return response.data.entry;
|
|
379
|
+
}
|
|
380
|
+
async setWorkflowStage(ctUid, entryUid, data) {
|
|
381
|
+
await this.http.post(`${this.basePath(ctUid)}/${entryUid}/workflow`, data);
|
|
382
|
+
}
|
|
383
|
+
async references(ctUid, entryUid) {
|
|
384
|
+
const response = await this.http.get(
|
|
385
|
+
`${this.basePath(ctUid)}/${entryUid}/references`
|
|
386
|
+
);
|
|
387
|
+
return response.data.references ?? [];
|
|
388
|
+
}
|
|
389
|
+
async languages(ctUid, entryUid) {
|
|
390
|
+
const response = await this.http.get(
|
|
391
|
+
`${this.basePath(ctUid)}/${entryUid}/languages`
|
|
392
|
+
);
|
|
393
|
+
return response.data.locales ?? [];
|
|
394
|
+
}
|
|
395
|
+
async versions(ctUid, entryUid) {
|
|
396
|
+
const response = await this.http.get(
|
|
397
|
+
`${this.basePath(ctUid)}/${entryUid}/versions`
|
|
398
|
+
);
|
|
399
|
+
return response.data.versions ?? [];
|
|
400
|
+
}
|
|
401
|
+
async import(ctUid, data, opts) {
|
|
402
|
+
let path = `${this.basePath(ctUid)}/import`;
|
|
403
|
+
const params = [];
|
|
404
|
+
if (opts?.locale) params.push(`locale=${encodeURIComponent(opts.locale)}`);
|
|
405
|
+
if (opts?.overwrite) params.push("overwrite=true");
|
|
406
|
+
if (params.length > 0) path += `?${params.join("&")}`;
|
|
407
|
+
const response = await this.http.post(path, data);
|
|
408
|
+
return response.data.entry;
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// src/cma/environments.ts
|
|
413
|
+
var EnvironmentsClient = class extends CrudClient {
|
|
414
|
+
constructor(http) {
|
|
415
|
+
super(http, {
|
|
416
|
+
basePath: "/environments",
|
|
417
|
+
singularKey: "environment",
|
|
418
|
+
pluralKey: "environments"
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
// src/cma/extensions.ts
|
|
424
|
+
var ExtensionsClient = class extends CrudClient {
|
|
425
|
+
constructor(http) {
|
|
426
|
+
super(http, { basePath: "/extensions", singularKey: "extension", pluralKey: "extensions" });
|
|
427
|
+
}
|
|
428
|
+
async upload(form) {
|
|
429
|
+
const response = await this.http.upload("/extensions", form);
|
|
430
|
+
return response.data.extension;
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
// src/cma/global-fields.ts
|
|
435
|
+
var GlobalFieldsClient = class extends CrudClient {
|
|
436
|
+
constructor(http) {
|
|
437
|
+
super(http, {
|
|
438
|
+
basePath: "/global_fields",
|
|
439
|
+
singularKey: "global_field",
|
|
440
|
+
pluralKey: "global_fields"
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
async export(uid) {
|
|
444
|
+
const response = await this.http.get(
|
|
445
|
+
`/global_fields/${uid}/export`
|
|
446
|
+
);
|
|
447
|
+
return response.data.global_field;
|
|
448
|
+
}
|
|
449
|
+
async import(data) {
|
|
450
|
+
const response = await this.http.post(
|
|
451
|
+
"/global_fields/import",
|
|
452
|
+
data
|
|
453
|
+
);
|
|
454
|
+
return response.data.global_field;
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
// src/cma/labels.ts
|
|
459
|
+
var LabelsClient = class extends CrudClient {
|
|
460
|
+
constructor(http) {
|
|
461
|
+
super(http, { basePath: "/labels", singularKey: "label", pluralKey: "labels" });
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// src/cma/locales.ts
|
|
466
|
+
var LocalesClient = class extends CrudClient {
|
|
467
|
+
constructor(http) {
|
|
468
|
+
super(http, { basePath: "/locales", singularKey: "locale", pluralKey: "locales" });
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
// src/cma/publish-rules.ts
|
|
473
|
+
var PublishRulesClient = class extends CrudClient {
|
|
474
|
+
constructor(http) {
|
|
475
|
+
super(http, {
|
|
476
|
+
basePath: "/workflows/publishing_rules",
|
|
477
|
+
singularKey: "publishing_rule",
|
|
478
|
+
pluralKey: "publishing_rules"
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
// src/cma/releases.ts
|
|
484
|
+
var ReleasesClient = class {
|
|
485
|
+
constructor(http) {
|
|
486
|
+
this.http = http;
|
|
487
|
+
}
|
|
488
|
+
list(opts) {
|
|
489
|
+
return paginate(
|
|
490
|
+
async (skip, limit) => {
|
|
491
|
+
const params = {
|
|
492
|
+
skip: String(skip),
|
|
493
|
+
limit: String(limit)
|
|
494
|
+
};
|
|
495
|
+
if (opts?.include_count) params.include_count = "true";
|
|
496
|
+
const response = await this.http.get(
|
|
497
|
+
"/releases",
|
|
498
|
+
params
|
|
499
|
+
);
|
|
500
|
+
return { items: response.data.releases ?? [], count: response.data.count };
|
|
501
|
+
},
|
|
502
|
+
{ limit: opts?.limit }
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
async listAll(opts) {
|
|
506
|
+
return collectAll(this.list(opts));
|
|
507
|
+
}
|
|
508
|
+
async get(uid) {
|
|
509
|
+
const response = await this.http.get(`/releases/${uid}`);
|
|
510
|
+
return response.data.release;
|
|
511
|
+
}
|
|
512
|
+
async create(data) {
|
|
513
|
+
const response = await this.http.post("/releases", { release: data });
|
|
514
|
+
return response.data.release;
|
|
515
|
+
}
|
|
516
|
+
async update(uid, data) {
|
|
517
|
+
const response = await this.http.put(`/releases/${uid}`, {
|
|
518
|
+
release: data
|
|
519
|
+
});
|
|
520
|
+
return response.data.release;
|
|
521
|
+
}
|
|
522
|
+
async delete(uid) {
|
|
523
|
+
await this.http.delete(`/releases/${uid}`);
|
|
524
|
+
}
|
|
525
|
+
async deploy(uid, data) {
|
|
526
|
+
await this.http.post(`/releases/${uid}/deploy`, { release: data });
|
|
527
|
+
}
|
|
528
|
+
// ─── Items ──────────────────────────────────────────────────────
|
|
529
|
+
async listItems(uid) {
|
|
530
|
+
const response = await this.http.get(`/releases/${uid}/items`);
|
|
531
|
+
return response.data.items ?? [];
|
|
532
|
+
}
|
|
533
|
+
async addItem(uid, item) {
|
|
534
|
+
await this.http.post(`/releases/${uid}/items`, { item });
|
|
535
|
+
}
|
|
536
|
+
async removeItem(uid, item) {
|
|
537
|
+
await this.http.post(`/releases/${uid}/items/delete`, { item });
|
|
538
|
+
}
|
|
539
|
+
async clone(uid, data) {
|
|
540
|
+
const response = await this.http.post(`/releases/${uid}/clone`, {
|
|
541
|
+
release: data
|
|
542
|
+
});
|
|
543
|
+
return response.data.release;
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
// src/cma/roles.ts
|
|
548
|
+
var RolesClient = class extends CrudClient {
|
|
549
|
+
constructor(http) {
|
|
550
|
+
super(http, { basePath: "/roles", singularKey: "role", pluralKey: "roles" });
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
// src/cma/taxonomies.ts
|
|
555
|
+
var TaxonomiesClient = class {
|
|
556
|
+
constructor(http) {
|
|
557
|
+
this.http = http;
|
|
558
|
+
}
|
|
559
|
+
// ─── Taxonomies ───────────────────────────────────────────────────
|
|
560
|
+
list(opts) {
|
|
561
|
+
return paginate(
|
|
562
|
+
async (skip, limit) => {
|
|
563
|
+
const response = await this.http.get(
|
|
564
|
+
"/taxonomies",
|
|
565
|
+
{ skip: String(skip), limit: String(limit) }
|
|
566
|
+
);
|
|
567
|
+
return { items: response.data.taxonomies ?? [], count: response.data.count };
|
|
568
|
+
},
|
|
569
|
+
{ limit: opts?.limit }
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
async listAll(opts) {
|
|
573
|
+
return collectAll(this.list(opts));
|
|
574
|
+
}
|
|
575
|
+
async get(uid) {
|
|
576
|
+
const response = await this.http.get(`/taxonomies/${uid}`);
|
|
577
|
+
return response.data.taxonomy;
|
|
578
|
+
}
|
|
579
|
+
async create(data) {
|
|
580
|
+
const response = await this.http.post("/taxonomies", {
|
|
581
|
+
taxonomy: data
|
|
582
|
+
});
|
|
583
|
+
return response.data.taxonomy;
|
|
584
|
+
}
|
|
585
|
+
async update(uid, data) {
|
|
586
|
+
const response = await this.http.put(`/taxonomies/${uid}`, {
|
|
587
|
+
taxonomy: data
|
|
588
|
+
});
|
|
589
|
+
return response.data.taxonomy;
|
|
590
|
+
}
|
|
591
|
+
async delete(uid) {
|
|
592
|
+
await this.http.delete(`/taxonomies/${uid}`);
|
|
593
|
+
}
|
|
594
|
+
// ─── Terms ────────────────────────────────────────────────────────
|
|
595
|
+
listTerms(taxonomyUid, opts) {
|
|
596
|
+
return paginate(
|
|
597
|
+
async (skip, limit) => {
|
|
598
|
+
const response = await this.http.get(
|
|
599
|
+
`/taxonomies/${taxonomyUid}/terms`,
|
|
600
|
+
{ skip: String(skip), limit: String(limit) }
|
|
601
|
+
);
|
|
602
|
+
return { items: response.data.terms ?? [], count: response.data.count };
|
|
603
|
+
},
|
|
604
|
+
{ limit: opts?.limit }
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
async listAllTerms(taxonomyUid, opts) {
|
|
608
|
+
return collectAll(this.listTerms(taxonomyUid, opts));
|
|
609
|
+
}
|
|
610
|
+
async getTerm(taxonomyUid, termUid) {
|
|
611
|
+
const response = await this.http.get(
|
|
612
|
+
`/taxonomies/${taxonomyUid}/terms/${termUid}`
|
|
613
|
+
);
|
|
614
|
+
return response.data.term;
|
|
615
|
+
}
|
|
616
|
+
async createTerm(taxonomyUid, data) {
|
|
617
|
+
const response = await this.http.post(
|
|
618
|
+
`/taxonomies/${taxonomyUid}/terms`,
|
|
619
|
+
{ term: data }
|
|
620
|
+
);
|
|
621
|
+
return response.data.term;
|
|
622
|
+
}
|
|
623
|
+
async updateTerm(taxonomyUid, termUid, data) {
|
|
624
|
+
const response = await this.http.put(
|
|
625
|
+
`/taxonomies/${taxonomyUid}/terms/${termUid}`,
|
|
626
|
+
{ term: data }
|
|
627
|
+
);
|
|
628
|
+
return response.data.term;
|
|
629
|
+
}
|
|
630
|
+
async deleteTerm(taxonomyUid, termUid) {
|
|
631
|
+
await this.http.delete(`/taxonomies/${taxonomyUid}/terms/${termUid}`);
|
|
632
|
+
}
|
|
633
|
+
async ancestors(taxonomyUid, termUid) {
|
|
634
|
+
const response = await this.http.get(
|
|
635
|
+
`/taxonomies/${taxonomyUid}/terms/${termUid}/ancestors`
|
|
636
|
+
);
|
|
637
|
+
return response.data.terms ?? [];
|
|
638
|
+
}
|
|
639
|
+
async descendants(taxonomyUid, termUid) {
|
|
640
|
+
const response = await this.http.get(
|
|
641
|
+
`/taxonomies/${taxonomyUid}/terms/${termUid}/descendants`
|
|
642
|
+
);
|
|
643
|
+
return response.data.terms ?? [];
|
|
644
|
+
}
|
|
645
|
+
async moveTerm(taxonomyUid, termUid, data) {
|
|
646
|
+
const response = await this.http.put(
|
|
647
|
+
`/taxonomies/${taxonomyUid}/terms/${termUid}/move`,
|
|
648
|
+
{ term: data }
|
|
649
|
+
);
|
|
650
|
+
return response.data.term;
|
|
651
|
+
}
|
|
652
|
+
// ─── Import / Export ──────────────────────────────────────────────
|
|
653
|
+
async export(uid) {
|
|
654
|
+
const response = await this.http.get(`/taxonomies/${uid}/export`);
|
|
655
|
+
return response.data.taxonomy;
|
|
656
|
+
}
|
|
657
|
+
async import(data) {
|
|
658
|
+
const response = await this.http.post("/taxonomies/import", data);
|
|
659
|
+
return response.data.taxonomy;
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
// src/cma/tokens.ts
|
|
664
|
+
function tokenCrud(http, basePath) {
|
|
665
|
+
return {
|
|
666
|
+
async list() {
|
|
667
|
+
const response = await http.get(basePath);
|
|
668
|
+
return response.data.tokens ?? [];
|
|
669
|
+
},
|
|
670
|
+
async get(uid) {
|
|
671
|
+
const response = await http.get(`${basePath}/${uid}`);
|
|
672
|
+
return response.data.token;
|
|
673
|
+
},
|
|
674
|
+
async create(data) {
|
|
675
|
+
const response = await http.post(basePath, { token: data });
|
|
676
|
+
return response.data.token;
|
|
677
|
+
},
|
|
678
|
+
async update(uid, data) {
|
|
679
|
+
const response = await http.put(`${basePath}/${uid}`, { token: data });
|
|
680
|
+
return response.data.token;
|
|
681
|
+
},
|
|
682
|
+
async delete(uid) {
|
|
683
|
+
await http.delete(`${basePath}/${uid}`);
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
var TokensClient = class {
|
|
688
|
+
management;
|
|
689
|
+
delivery;
|
|
690
|
+
preview;
|
|
691
|
+
constructor(http) {
|
|
692
|
+
this.management = tokenCrud(http, "/stacks/management_tokens");
|
|
693
|
+
this.delivery = tokenCrud(http, "/stacks/delivery_tokens");
|
|
694
|
+
this.preview = tokenCrud(http, "/stacks/preview_tokens");
|
|
695
|
+
}
|
|
696
|
+
// ─── Management Tokens ────────────────────────────────────────────
|
|
697
|
+
listManagementTokens() {
|
|
698
|
+
return this.management.list();
|
|
699
|
+
}
|
|
700
|
+
getManagementToken(uid) {
|
|
701
|
+
return this.management.get(uid);
|
|
702
|
+
}
|
|
703
|
+
createManagementToken(data) {
|
|
704
|
+
return this.management.create(data);
|
|
705
|
+
}
|
|
706
|
+
updateManagementToken(uid, data) {
|
|
707
|
+
return this.management.update(uid, data);
|
|
708
|
+
}
|
|
709
|
+
deleteManagementToken(uid) {
|
|
710
|
+
return this.management.delete(uid);
|
|
711
|
+
}
|
|
712
|
+
// ─── Delivery Tokens ──────────────────────────────────────────────
|
|
713
|
+
listDeliveryTokens() {
|
|
714
|
+
return this.delivery.list();
|
|
715
|
+
}
|
|
716
|
+
getDeliveryToken(uid) {
|
|
717
|
+
return this.delivery.get(uid);
|
|
718
|
+
}
|
|
719
|
+
createDeliveryToken(data) {
|
|
720
|
+
return this.delivery.create(data);
|
|
721
|
+
}
|
|
722
|
+
updateDeliveryToken(uid, data) {
|
|
723
|
+
return this.delivery.update(uid, data);
|
|
724
|
+
}
|
|
725
|
+
deleteDeliveryToken(uid) {
|
|
726
|
+
return this.delivery.delete(uid);
|
|
727
|
+
}
|
|
728
|
+
// ─── Preview Tokens ──────────────────────────────────────────────
|
|
729
|
+
listPreviewTokens() {
|
|
730
|
+
return this.preview.list();
|
|
731
|
+
}
|
|
732
|
+
getPreviewToken(uid) {
|
|
733
|
+
return this.preview.get(uid);
|
|
734
|
+
}
|
|
735
|
+
createPreviewToken(data) {
|
|
736
|
+
return this.preview.create(data);
|
|
737
|
+
}
|
|
738
|
+
updatePreviewToken(uid, data) {
|
|
739
|
+
return this.preview.update(uid, data);
|
|
740
|
+
}
|
|
741
|
+
deletePreviewToken(uid) {
|
|
742
|
+
return this.preview.delete(uid);
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
// src/cma/webhooks.ts
|
|
747
|
+
var WebhooksClient = class extends CrudClient {
|
|
748
|
+
constructor(http) {
|
|
749
|
+
super(http, { basePath: "/webhooks", singularKey: "webhook", pluralKey: "webhooks" });
|
|
750
|
+
}
|
|
751
|
+
async logs(uid) {
|
|
752
|
+
const response = await this.http.get(`/webhooks/${uid}/logs`);
|
|
753
|
+
return response.data.logs ?? [];
|
|
754
|
+
}
|
|
755
|
+
async retry(uid, executionUid) {
|
|
756
|
+
await this.http.post(`/webhooks/${uid}/retry/${executionUid}`, {});
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
// src/cma/workflows.ts
|
|
761
|
+
var WorkflowsClient = class extends CrudClient {
|
|
762
|
+
constructor(http) {
|
|
763
|
+
super(http, { basePath: "/workflows", singularKey: "workflow", pluralKey: "workflows" });
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
// src/cma/client.ts
|
|
768
|
+
function createCMAClient(config) {
|
|
769
|
+
const endpoints = resolveEndpoints(config.region);
|
|
770
|
+
const headers = { api_key: config.apiKey };
|
|
771
|
+
switch (config.auth.type) {
|
|
772
|
+
case "management-token":
|
|
773
|
+
headers.authorization = config.auth.token;
|
|
774
|
+
break;
|
|
775
|
+
case "oauth":
|
|
776
|
+
headers.authorization = `Bearer ${config.auth.accessToken}`;
|
|
777
|
+
break;
|
|
778
|
+
case "authtoken":
|
|
779
|
+
headers.authtoken = config.auth.token;
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
if (config.branch) {
|
|
783
|
+
headers.branch = config.branch;
|
|
784
|
+
}
|
|
785
|
+
const http = new ContentstackHttpClient({
|
|
786
|
+
...config.httpOptions,
|
|
787
|
+
baseUrl: config.httpOptions?.baseUrl ?? `${endpoints.cma}/v3`,
|
|
788
|
+
headers: {
|
|
789
|
+
...config.httpOptions?.headers,
|
|
790
|
+
...headers
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
return {
|
|
794
|
+
entries: new EntriesClient(http),
|
|
795
|
+
contentTypes: new ContentTypesClient(http),
|
|
796
|
+
assets: new AssetsClient(http),
|
|
797
|
+
environments: new EnvironmentsClient(http),
|
|
798
|
+
locales: new LocalesClient(http),
|
|
799
|
+
globalFields: new GlobalFieldsClient(http),
|
|
800
|
+
webhooks: new WebhooksClient(http),
|
|
801
|
+
workflows: new WorkflowsClient(http),
|
|
802
|
+
releases: new ReleasesClient(http),
|
|
803
|
+
branches: new BranchesClient(http),
|
|
804
|
+
branchAliases: new BranchAliasesClient(http),
|
|
805
|
+
taxonomies: new TaxonomiesClient(http),
|
|
806
|
+
bulk: new BulkOperationsClient(http),
|
|
807
|
+
tokens: new TokensClient(http),
|
|
808
|
+
labels: new LabelsClient(http),
|
|
809
|
+
roles: new RolesClient(http),
|
|
810
|
+
auditLog: new AuditLogClient(http),
|
|
811
|
+
extensions: new ExtensionsClient(http),
|
|
812
|
+
publishRules: new PublishRulesClient(http),
|
|
813
|
+
onBranch(branchUid) {
|
|
814
|
+
return createCMAClient({ ...config, branch: branchUid });
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// src/cma/request-builders.ts
|
|
820
|
+
function nonEmptyParams(params) {
|
|
821
|
+
return Object.keys(params).length > 0 ? params : void 0;
|
|
822
|
+
}
|
|
823
|
+
function buildEntryParams(options) {
|
|
824
|
+
if (!options) return void 0;
|
|
825
|
+
const params = {};
|
|
826
|
+
if (options.locale) params.locale = options.locale;
|
|
827
|
+
if (options.version !== void 0) params.version = String(options.version);
|
|
828
|
+
if (options.includePublishDetails) params.include_publish_details = "true";
|
|
829
|
+
return nonEmptyParams(params);
|
|
830
|
+
}
|
|
831
|
+
function buildEntriesParams(options) {
|
|
832
|
+
if (!options) return void 0;
|
|
833
|
+
const params = {};
|
|
834
|
+
if (options.locale) params.locale = options.locale;
|
|
835
|
+
if (options.limit !== void 0) params.limit = String(options.limit);
|
|
836
|
+
if (options.skip !== void 0) params.skip = String(options.skip);
|
|
837
|
+
if (options.includePublishDetails) params.include_publish_details = "true";
|
|
838
|
+
if (options.query) params.query = JSON.stringify(options.query);
|
|
839
|
+
return nonEmptyParams(params);
|
|
840
|
+
}
|
|
841
|
+
function buildAssetsParams(options) {
|
|
842
|
+
if (!options) return void 0;
|
|
843
|
+
const params = {};
|
|
844
|
+
if (options.folder) params.folder = options.folder;
|
|
845
|
+
if (options.limit !== void 0) params.limit = String(options.limit);
|
|
846
|
+
if (options.skip !== void 0) params.skip = String(options.skip);
|
|
847
|
+
return nonEmptyParams(params);
|
|
848
|
+
}
|
|
849
|
+
function appendQueryString(path, params) {
|
|
850
|
+
const query = params.toString();
|
|
851
|
+
return query ? `${path}?${query}` : path;
|
|
852
|
+
}
|
|
853
|
+
function buildCreateEntryRequest(vars) {
|
|
854
|
+
const params = new URLSearchParams();
|
|
855
|
+
if (vars.locale) params.set("locale", vars.locale);
|
|
856
|
+
return {
|
|
857
|
+
path: appendQueryString(`/content_types/${vars.contentTypeUid}/entries`, params),
|
|
858
|
+
body: { entry: vars.entry }
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
function buildUpdateEntryRequest(vars) {
|
|
862
|
+
const params = new URLSearchParams();
|
|
863
|
+
if (vars.locale) params.set("locale", vars.locale);
|
|
864
|
+
return {
|
|
865
|
+
path: appendQueryString(
|
|
866
|
+
`/content_types/${vars.contentTypeUid}/entries/${vars.entryUid}`,
|
|
867
|
+
params
|
|
868
|
+
),
|
|
869
|
+
body: { entry: vars.entry }
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
function buildDeleteEntryRequest(vars) {
|
|
873
|
+
const params = new URLSearchParams();
|
|
874
|
+
if (vars.locale) params.set("locale", vars.locale);
|
|
875
|
+
if (vars.deleteAllLocalized) params.set("delete_all_localized", "true");
|
|
876
|
+
return {
|
|
877
|
+
path: appendQueryString(
|
|
878
|
+
`/content_types/${vars.contentTypeUid}/entries/${vars.entryUid}`,
|
|
879
|
+
params
|
|
880
|
+
)
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function buildPublishEntryRequest(vars) {
|
|
884
|
+
return {
|
|
885
|
+
path: `/content_types/${vars.contentTypeUid}/entries/${vars.entryUid}/publish`,
|
|
886
|
+
body: {
|
|
887
|
+
entry: {
|
|
888
|
+
environments: vars.environments,
|
|
889
|
+
locales: vars.locales,
|
|
890
|
+
...vars.scheduledAt ? { scheduled_at: vars.scheduledAt } : {}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
export {
|
|
897
|
+
AssetsClient,
|
|
898
|
+
CrudClient,
|
|
899
|
+
AuditLogClient,
|
|
900
|
+
BranchAliasesClient,
|
|
901
|
+
BranchesClient,
|
|
902
|
+
BulkOperationsClient,
|
|
903
|
+
ContentTypesClient,
|
|
904
|
+
EntriesClient,
|
|
905
|
+
EnvironmentsClient,
|
|
906
|
+
ExtensionsClient,
|
|
907
|
+
GlobalFieldsClient,
|
|
908
|
+
LabelsClient,
|
|
909
|
+
LocalesClient,
|
|
910
|
+
PublishRulesClient,
|
|
911
|
+
ReleasesClient,
|
|
912
|
+
RolesClient,
|
|
913
|
+
TaxonomiesClient,
|
|
914
|
+
TokensClient,
|
|
915
|
+
WebhooksClient,
|
|
916
|
+
WorkflowsClient,
|
|
917
|
+
createCMAClient,
|
|
918
|
+
buildEntryParams,
|
|
919
|
+
buildEntriesParams,
|
|
920
|
+
buildAssetsParams,
|
|
921
|
+
buildCreateEntryRequest,
|
|
922
|
+
buildUpdateEntryRequest,
|
|
923
|
+
buildDeleteEntryRequest,
|
|
924
|
+
buildPublishEntryRequest
|
|
925
|
+
};
|
|
926
|
+
//# sourceMappingURL=chunk-EREPKWTW.mjs.map
|