@localess/client 3.0.1-dev.20260411012947 → 3.0.1-dev.20260413071348
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/cache.d.ts +29 -0
- package/dist/client.d.ts +102 -0
- package/dist/editable.d.ts +19 -0
- package/dist/index.d.ts +9 -318
- package/dist/index.js +1 -292
- package/dist/index.mjs +150 -255
- package/dist/models/content-asset.d.ts +13 -0
- package/dist/models/content-data.d.ts +27 -0
- package/dist/models/content-link.d.ts +21 -0
- package/dist/models/content-metadata.d.ts +41 -0
- package/dist/models/content-reference.d.ts +13 -0
- package/dist/models/content-rich-text.d.ts +13 -0
- package/dist/models/content.d.ts +21 -0
- package/dist/models/index.d.ts +11 -0
- package/dist/models/links.d.ts +7 -0
- package/dist/models/locale.d.ts +10 -0
- package/dist/models/references.d.ts +7 -0
- package/dist/models/translations.d.ts +6 -0
- package/dist/sync.d.ts +6 -0
- package/dist/utils.d.ts +43 -0
- package/package.json +5 -5
- package/dist/index.d.mts +0 -336
package/dist/index.mjs
CHANGED
|
@@ -1,259 +1,154 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
version = `&version=${params.version}`;
|
|
115
|
-
}
|
|
116
|
-
const locale = params?.locale ? `&locale=${params.locale}` : "";
|
|
117
|
-
const resolveReference = params?.resolveReference ? `&resolveReference=${params.resolveReference}` : "";
|
|
118
|
-
const resolveLink = params?.resolveLink ? `&resolveLink=${params.resolveLink}` : "";
|
|
119
|
-
let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/contents/slugs/${slug}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
|
|
120
|
-
if (options.debug) {
|
|
121
|
-
console.log(LOG_GROUP, "getContentBySlug fetch url : ", url);
|
|
122
|
-
}
|
|
123
|
-
if (cache.has(url)) {
|
|
124
|
-
if (options.debug) {
|
|
125
|
-
console.log(LOG_GROUP, "getContentBySlug cache hit");
|
|
126
|
-
}
|
|
127
|
-
return cache.get(url);
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
const response = await fetch(url, fetchOptions);
|
|
131
|
-
if (options.debug) {
|
|
132
|
-
console.log(LOG_GROUP, "getContentBySlug status : ", response.status);
|
|
133
|
-
}
|
|
134
|
-
const data = await response.json();
|
|
135
|
-
cache.set(url, data);
|
|
136
|
-
return data;
|
|
137
|
-
} catch (error) {
|
|
138
|
-
console.error(LOG_GROUP, "getContentBySlug error : ", error);
|
|
139
|
-
return {};
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
async getContentById(id, params) {
|
|
143
|
-
if (options.debug) {
|
|
144
|
-
console.log(LOG_GROUP, "getContentById() id : ", id);
|
|
145
|
-
console.log(LOG_GROUP, "getContentById() params : ", JSON.stringify(params));
|
|
146
|
-
}
|
|
147
|
-
let version = "";
|
|
148
|
-
if (options?.version && options.version == "draft") {
|
|
149
|
-
version = `&version=${options.version}`;
|
|
150
|
-
}
|
|
151
|
-
if (params?.version && params.version == "draft") {
|
|
152
|
-
version = `&version=${params.version}`;
|
|
153
|
-
}
|
|
154
|
-
const locale = params?.locale ? `&locale=${params.locale}` : "";
|
|
155
|
-
const resolveReference = params?.resolveReference ? `&resolveReference=${params.resolveReference}` : "";
|
|
156
|
-
const resolveLink = params?.resolveLink ? `&resolveLink=${params.resolveLink}` : "";
|
|
157
|
-
let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/contents/${id}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
|
|
158
|
-
if (options.debug) {
|
|
159
|
-
console.log(LOG_GROUP, "getContentById fetch url : ", url);
|
|
160
|
-
}
|
|
161
|
-
if (cache.has(url)) {
|
|
162
|
-
if (options.debug) {
|
|
163
|
-
console.log(LOG_GROUP, "getContentById cache hit");
|
|
164
|
-
}
|
|
165
|
-
return cache.get(url);
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
const response = await fetch(url, fetchOptions);
|
|
169
|
-
if (options.debug) {
|
|
170
|
-
console.log(LOG_GROUP, "getContentById status : ", response.status);
|
|
171
|
-
}
|
|
172
|
-
const data = await response.json();
|
|
173
|
-
cache.set(url, data);
|
|
174
|
-
return data;
|
|
175
|
-
} catch (error) {
|
|
176
|
-
console.error(LOG_GROUP, "getContentById error : ", error);
|
|
177
|
-
return {};
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
async getTranslations(locale) {
|
|
181
|
-
if (options.debug) {
|
|
182
|
-
console.log(LOG_GROUP, "getTranslations() locale : ", locale);
|
|
183
|
-
}
|
|
184
|
-
let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/translations/${locale}?token=${options.token}`;
|
|
185
|
-
if (options.debug) {
|
|
186
|
-
console.log(LOG_GROUP, "getTranslations fetch url : ", url);
|
|
187
|
-
}
|
|
188
|
-
if (cache.has(url)) {
|
|
189
|
-
if (options.debug) {
|
|
190
|
-
console.log(LOG_GROUP, "getTranslations cache hit");
|
|
191
|
-
}
|
|
192
|
-
return cache.get(url);
|
|
193
|
-
}
|
|
194
|
-
try {
|
|
195
|
-
const response = await fetch(url, fetchOptions);
|
|
196
|
-
if (options.debug) {
|
|
197
|
-
console.log(LOG_GROUP, "getTranslations status : ", response.status);
|
|
198
|
-
}
|
|
199
|
-
const data = await response.json();
|
|
200
|
-
cache.set(url, data);
|
|
201
|
-
return data;
|
|
202
|
-
} catch (error) {
|
|
203
|
-
console.error(LOG_GROUP, "getTranslations error : ", error);
|
|
204
|
-
return {};
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
syncScriptUrl() {
|
|
208
|
-
return `${normalizedOrigin}/scripts/sync-v1.js`;
|
|
209
|
-
},
|
|
210
|
-
assetLink(asset) {
|
|
211
|
-
if (typeof asset === "string") {
|
|
212
|
-
return `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/assets/${asset}`;
|
|
213
|
-
} else {
|
|
214
|
-
return `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/assets/${asset.uri}`;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
};
|
|
1
|
+
//#region src/utils.ts
|
|
2
|
+
var e = "\x1B[0m", t = "\x1B[34m", n = () => typeof window < "u", r = () => typeof window > "u", i = () => n() && window.self !== window.top, a = class {
|
|
3
|
+
set(e, t) {}
|
|
4
|
+
get(e) {}
|
|
5
|
+
has(e) {
|
|
6
|
+
return !1;
|
|
7
|
+
}
|
|
8
|
+
}, o = class {
|
|
9
|
+
cache = /* @__PURE__ */ new Map();
|
|
10
|
+
constructor(e = 3e5) {
|
|
11
|
+
this.ttlMs = e;
|
|
12
|
+
}
|
|
13
|
+
set(e, t) {
|
|
14
|
+
this.cache.set(e, {
|
|
15
|
+
value: t,
|
|
16
|
+
expiresAt: Date.now() + this.ttlMs
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
get(e) {
|
|
20
|
+
let t = this.cache.get(e);
|
|
21
|
+
if (t) {
|
|
22
|
+
if (Date.now() > t.expiresAt) {
|
|
23
|
+
this.cache.delete(e);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
return t.value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
has(e) {
|
|
30
|
+
return this.get(e) !== void 0;
|
|
31
|
+
}
|
|
32
|
+
}, s = `${t}[Localess:Client]${e}`;
|
|
33
|
+
function c(e) {
|
|
34
|
+
e.debug && console.log(s, "Client Options : ", e);
|
|
35
|
+
let t = e.origin.replace(/\/+$/, ""), n = {
|
|
36
|
+
redirect: "follow",
|
|
37
|
+
headers: {
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
Accept: "application/json",
|
|
40
|
+
"X-Localess-Agent": "Localess-JS-Client",
|
|
41
|
+
"X-Localess-Agent-Version": "0.9.0"
|
|
42
|
+
}
|
|
43
|
+
}, r = e.cacheTTL === !1 ? new a() : new o(e.cacheTTL);
|
|
44
|
+
return {
|
|
45
|
+
async getLinks(i) {
|
|
46
|
+
e.debug && console.log(s, "getLinks() params : ", JSON.stringify(i));
|
|
47
|
+
let a = "";
|
|
48
|
+
i?.kind && (a = `&kind=${i.kind}`);
|
|
49
|
+
let o = "";
|
|
50
|
+
i?.parentSlug && (o = `&parentSlug=${i.parentSlug}`);
|
|
51
|
+
let c = "";
|
|
52
|
+
i?.excludeChildren && (c = `&excludeChildren=${i.excludeChildren}`);
|
|
53
|
+
let l = `${t}/api/v1/spaces/${e.spaceId}/links?token=${e.token}${a}${o}${c}`;
|
|
54
|
+
if (e.debug && console.log(s, "getLinks fetch url : ", l), r.has(l)) return e.debug && console.log(s, "getLinks cache hit"), r.get(l);
|
|
55
|
+
try {
|
|
56
|
+
let t = await fetch(l, n);
|
|
57
|
+
e.debug && console.log(s, "getLinks status : ", t.status);
|
|
58
|
+
let i = await t.json();
|
|
59
|
+
return r.set(l, i), i;
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return console.error(s, "getLinks error : ", e), {};
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
async getContentBySlug(i, a) {
|
|
65
|
+
e.debug && (console.log(s, "getContentBySlug() slug : ", i), console.log(s, "getContentBySlug() params : ", JSON.stringify(a)));
|
|
66
|
+
let o = "";
|
|
67
|
+
e?.version && e.version == "draft" && (o = `&version=${e.version}`), a?.version && a.version == "draft" && (o = `&version=${a.version}`);
|
|
68
|
+
let c = a?.locale ? `&locale=${a.locale}` : "", l = a?.resolveReference ? `&resolveReference=${a.resolveReference}` : "", u = a?.resolveLink ? `&resolveLink=${a.resolveLink}` : "", d = `${t}/api/v1/spaces/${e.spaceId}/contents/slugs/${i}?token=${e.token}${o}${c}${l}${u}`;
|
|
69
|
+
if (e.debug && console.log(s, "getContentBySlug fetch url : ", d), r.has(d)) return e.debug && console.log(s, "getContentBySlug cache hit"), r.get(d);
|
|
70
|
+
try {
|
|
71
|
+
let t = await fetch(d, n);
|
|
72
|
+
e.debug && console.log(s, "getContentBySlug status : ", t.status);
|
|
73
|
+
let i = await t.json();
|
|
74
|
+
return r.set(d, i), i;
|
|
75
|
+
} catch (e) {
|
|
76
|
+
return console.error(s, "getContentBySlug error : ", e), {};
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
async getContentById(i, a) {
|
|
80
|
+
e.debug && (console.log(s, "getContentById() id : ", i), console.log(s, "getContentById() params : ", JSON.stringify(a)));
|
|
81
|
+
let o = "";
|
|
82
|
+
e?.version && e.version == "draft" && (o = `&version=${e.version}`), a?.version && a.version == "draft" && (o = `&version=${a.version}`);
|
|
83
|
+
let c = a?.locale ? `&locale=${a.locale}` : "", l = a?.resolveReference ? `&resolveReference=${a.resolveReference}` : "", u = a?.resolveLink ? `&resolveLink=${a.resolveLink}` : "", d = `${t}/api/v1/spaces/${e.spaceId}/contents/${i}?token=${e.token}${o}${c}${l}${u}`;
|
|
84
|
+
if (e.debug && console.log(s, "getContentById fetch url : ", d), r.has(d)) return e.debug && console.log(s, "getContentById cache hit"), r.get(d);
|
|
85
|
+
try {
|
|
86
|
+
let t = await fetch(d, n);
|
|
87
|
+
e.debug && console.log(s, "getContentById status : ", t.status);
|
|
88
|
+
let i = await t.json();
|
|
89
|
+
return r.set(d, i), i;
|
|
90
|
+
} catch (e) {
|
|
91
|
+
return console.error(s, "getContentById error : ", e), {};
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
async getTranslations(i) {
|
|
95
|
+
e.debug && console.log(s, "getTranslations() locale : ", i);
|
|
96
|
+
let a = `${t}/api/v1/spaces/${e.spaceId}/translations/${i}?token=${e.token}`;
|
|
97
|
+
if (e.debug && console.log(s, "getTranslations fetch url : ", a), r.has(a)) return e.debug && console.log(s, "getTranslations cache hit"), r.get(a);
|
|
98
|
+
try {
|
|
99
|
+
let t = await fetch(a, n);
|
|
100
|
+
e.debug && console.log(s, "getTranslations status : ", t.status);
|
|
101
|
+
let i = await t.json();
|
|
102
|
+
return r.set(a, i), i;
|
|
103
|
+
} catch (e) {
|
|
104
|
+
return console.error(s, "getTranslations error : ", e), {};
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
syncScriptUrl() {
|
|
108
|
+
return `${t}/scripts/sync-v1.js`;
|
|
109
|
+
},
|
|
110
|
+
assetLink(n) {
|
|
111
|
+
return typeof n == "string" ? `${t}/api/v1/spaces/${e.spaceId}/assets/${n}` : `${t}/api/v1/spaces/${e.spaceId}/assets/${n.uri}`;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
218
114
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
function
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/editable.ts
|
|
117
|
+
function l(e) {
|
|
118
|
+
return {
|
|
119
|
+
"data-ll-id": e._id,
|
|
120
|
+
"data-ll-schema": e._schema
|
|
121
|
+
};
|
|
226
122
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
"data-ll-field": fieldName
|
|
230
|
-
};
|
|
123
|
+
function u(e) {
|
|
124
|
+
return { "data-ll-field": e };
|
|
231
125
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
var
|
|
235
|
-
function
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/sync.ts
|
|
128
|
+
var d = "localess-js-sync";
|
|
129
|
+
async function f(e, t = !1) {
|
|
130
|
+
return new Promise((t, n) => {
|
|
131
|
+
if (r()) {
|
|
132
|
+
n(void 0);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!i()) {
|
|
136
|
+
console.warn("Localess Sync is loaded only in Visual Editor."), n(void 0);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (window.localess !== void 0) {
|
|
140
|
+
n(void 0);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (document.getElementById(d)) {
|
|
144
|
+
n(void 0);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
let a = document.createElement("script");
|
|
148
|
+
a.id = d, a.type = "text/javascript", a.src = `${e}/scripts/sync-v1.js`, a.async = !0, a.onerror = (e) => n(e), a.onload = (e) => {
|
|
149
|
+
console.info("Localess Sync Script loaded"), t();
|
|
150
|
+
}, document.head.appendChild(a);
|
|
151
|
+
});
|
|
250
152
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
isIframe,
|
|
254
|
-
isServer,
|
|
255
|
-
loadLocalessSync,
|
|
256
|
-
localessClient,
|
|
257
|
-
localessEditable,
|
|
258
|
-
localessEditableField
|
|
259
|
-
};
|
|
153
|
+
//#endregion
|
|
154
|
+
export { n as isBrowser, i as isIframe, r as isServer, f as loadLocalessSync, c as localessClient, l as localessEditable, u as localessEditableField };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ContentAsset } from './content-asset';
|
|
2
|
+
import { ContentLink } from './content-link';
|
|
3
|
+
import { ContentRichText } from './content-rich-text';
|
|
4
|
+
import { ContentReference } from './content-reference';
|
|
5
|
+
export type ContentDataField = any | string | string[] | number | boolean | ContentLink | ContentRichText | ContentData | ContentData[] | ContentAsset | ContentAsset[] | ContentReference | ContentReference[];
|
|
6
|
+
/**
|
|
7
|
+
* Content Data Schema related information.
|
|
8
|
+
*/
|
|
9
|
+
export interface ContentDataSchema {
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier of a component in a content.
|
|
12
|
+
*/
|
|
13
|
+
_id: string;
|
|
14
|
+
/**
|
|
15
|
+
* Unique identifier for the Schema object.
|
|
16
|
+
*/
|
|
17
|
+
_schema: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* ContentData defined Object to connect all possible root Schemas.
|
|
21
|
+
*/
|
|
22
|
+
export interface ContentData extends ContentDataSchema {
|
|
23
|
+
/**
|
|
24
|
+
* Other Schema-specific fields
|
|
25
|
+
*/
|
|
26
|
+
[field: string]: ContentDataField | undefined;
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Link define reference to a Link.
|
|
3
|
+
*/
|
|
4
|
+
export interface ContentLink {
|
|
5
|
+
/**
|
|
6
|
+
* Define the type of Link
|
|
7
|
+
*/
|
|
8
|
+
kind: 'LINK';
|
|
9
|
+
/**
|
|
10
|
+
* Define the target of the link. _blank for the new tab and _self for the same tab.
|
|
11
|
+
*/
|
|
12
|
+
target: '_blank' | '_self';
|
|
13
|
+
/**
|
|
14
|
+
* Define the type of Link. URL for external links and Content for internal links.
|
|
15
|
+
*/
|
|
16
|
+
type: 'url' | 'content';
|
|
17
|
+
/**
|
|
18
|
+
* If the type is content, then it will be Content ID. Otherwise, it will be URL.
|
|
19
|
+
*/
|
|
20
|
+
uri: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Metadata defines short information about a Content for navigation reason.
|
|
3
|
+
*/
|
|
4
|
+
export interface ContentMetadata {
|
|
5
|
+
/**
|
|
6
|
+
* Date and Time at which the Content was created.
|
|
7
|
+
*/
|
|
8
|
+
createdAt: string;
|
|
9
|
+
/**
|
|
10
|
+
* Combination of SLUG and Parent SLUG of the Content
|
|
11
|
+
*/
|
|
12
|
+
fullSlug: string;
|
|
13
|
+
/**
|
|
14
|
+
* Unique identifier for the object.
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* Define the type of Content, whether it is a FOLDER or DOCUMENT.
|
|
19
|
+
*/
|
|
20
|
+
kind: 'FOLDER' | 'DOCUMENT';
|
|
21
|
+
/**
|
|
22
|
+
* Name of the Content
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Parent SLUG of the Content
|
|
27
|
+
*/
|
|
28
|
+
parentSlug: string;
|
|
29
|
+
/**
|
|
30
|
+
* Date and Time at which the Content was published.
|
|
31
|
+
*/
|
|
32
|
+
publishedAt?: string;
|
|
33
|
+
/**
|
|
34
|
+
* SLUG of the Content
|
|
35
|
+
*/
|
|
36
|
+
slug: string;
|
|
37
|
+
/**
|
|
38
|
+
* Date and Time at which the Content was updated.
|
|
39
|
+
*/
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ContentData } from './content-data';
|
|
2
|
+
import { ContentMetadata } from './content-metadata';
|
|
3
|
+
import { Links } from './links';
|
|
4
|
+
import { References } from './references';
|
|
5
|
+
/**
|
|
6
|
+
* Content defines a shared object for all possible Content Types.
|
|
7
|
+
*/
|
|
8
|
+
export interface Content<T extends ContentData = ContentData> extends ContentMetadata {
|
|
9
|
+
/**
|
|
10
|
+
* Content Data
|
|
11
|
+
*/
|
|
12
|
+
data?: T;
|
|
13
|
+
/**
|
|
14
|
+
* All links used in the content.
|
|
15
|
+
*/
|
|
16
|
+
links?: Links;
|
|
17
|
+
/**
|
|
18
|
+
* All references used in the content.
|
|
19
|
+
*/
|
|
20
|
+
references?: References;
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './content';
|
|
2
|
+
export * from './content-asset';
|
|
3
|
+
export * from './content-data';
|
|
4
|
+
export * from './content-link';
|
|
5
|
+
export * from './content-metadata';
|
|
6
|
+
export * from './content-reference';
|
|
7
|
+
export * from './content-rich-text';
|
|
8
|
+
export * from './links';
|
|
9
|
+
export * from './locale';
|
|
10
|
+
export * from './references';
|
|
11
|
+
export * from './translations';
|
package/dist/sync.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inject Localess Sync Script in Header
|
|
3
|
+
* @param {string} origin A fully qualified domain name with protocol (http/https) and port.
|
|
4
|
+
* @param {boolean} force Force Script Injection even if the application is not in Visual Editor.
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadLocalessSync(origin: string, force?: boolean): Promise<void>;
|