@localess/js-client 0.6.1-next.20250331-165335.0 → 0.6.1-next.20250409-075652.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/index.d.mts CHANGED
@@ -132,6 +132,13 @@ interface ContentMetadata {
132
132
  updatedAt: string;
133
133
  }
134
134
 
135
+ /**
136
+ * Key-Value Object. Where Key is Unique identifier for the Content object and Value is Content Metadata.
137
+ */
138
+ interface Links {
139
+ [key: string]: ContentMetadata;
140
+ }
141
+
135
142
  /**
136
143
  * Content define shared object for all possible Content Types.
137
144
  */
@@ -140,13 +147,10 @@ interface Content<T extends ContentData = ContentData> extends ContentMetadata {
140
147
  * Content Data
141
148
  */
142
149
  data?: T;
143
- }
144
-
145
- /**
146
- * Key-Value Object. Where Key is Unique identifier for the Content object and Value is Content Metadata.
147
- */
148
- interface Links {
149
- [key: string]: ContentMetadata;
150
+ /**
151
+ * References of all links used in the content.
152
+ */
153
+ links?: Links;
150
154
  }
151
155
 
152
156
  /**
@@ -210,11 +214,7 @@ type ContentFetchParams = {
210
214
  */
211
215
  locale?: string;
212
216
  };
213
- /**
214
- * Create a Localess API Client
215
- * @param {LocalessClientOptions} options connection details
216
- */
217
- declare function localessClient(options: LocalessClientOptions): {
217
+ interface LocalessClient {
218
218
  /**
219
219
  * Get all links
220
220
  * @param params{LinksFetchParams} - Fetch parameters
@@ -234,7 +234,7 @@ declare function localessClient(options: LocalessClientOptions): {
234
234
  * @param params{ContentFetchParams} - Fetch parameters
235
235
  * @returns {Promise<Content>}
236
236
  */
237
- getContentById<T_1 extends ContentData = ContentData>(id: string, params?: ContentFetchParams): Promise<Content<T_1>>;
237
+ getContentById<T extends ContentData = ContentData>(id: string, params?: ContentFetchParams): Promise<Content<T>>;
238
238
  /**
239
239
  * Get translations for the given locale
240
240
  * @param locale{string} - Locale identifier (ISO 639-1)
@@ -242,7 +242,12 @@ declare function localessClient(options: LocalessClientOptions): {
242
242
  getTranslations(locale: string): Promise<Translations>;
243
243
  syncScriptUrl(): string;
244
244
  assetLink(asset: ContentAsset | string): string;
245
- };
245
+ }
246
+ /**
247
+ * Create a Localess API Client
248
+ * @param {LocalessClientOptions} options connection details
249
+ */
250
+ declare function localessClient(options: LocalessClientOptions): LocalessClient;
246
251
 
247
252
  declare function llEditable(content: ContentDataSchema): {
248
253
  'data-ll-id': string;
@@ -276,4 +281,4 @@ declare global {
276
281
  }
277
282
  }
278
283
 
279
- export { type Content, type ContentAsset, type ContentData, type ContentDataField, type ContentDataSchema, type ContentFetchParams, type ContentLink, type ContentMetadata, type ContentReference, type ContentRichText, type EventCallback, type EventToApp, type EventToAppType, type Links, type LinksFetchParams, type LocalessClientOptions, type LocalessSync, type Translations, llEditable, loadLocalessSync, localessClient };
284
+ export { type Content, type ContentAsset, type ContentData, type ContentDataField, type ContentDataSchema, type ContentFetchParams, type ContentLink, type ContentMetadata, type ContentReference, type ContentRichText, type EventCallback, type EventToApp, type EventToAppType, type Links, type LinksFetchParams, type LocalessClient, type LocalessClientOptions, type LocalessSync, type Translations, llEditable, loadLocalessSync, localessClient };
package/dist/index.d.ts CHANGED
@@ -132,6 +132,13 @@ interface ContentMetadata {
132
132
  updatedAt: string;
133
133
  }
134
134
 
135
+ /**
136
+ * Key-Value Object. Where Key is Unique identifier for the Content object and Value is Content Metadata.
137
+ */
138
+ interface Links {
139
+ [key: string]: ContentMetadata;
140
+ }
141
+
135
142
  /**
136
143
  * Content define shared object for all possible Content Types.
137
144
  */
@@ -140,13 +147,10 @@ interface Content<T extends ContentData = ContentData> extends ContentMetadata {
140
147
  * Content Data
141
148
  */
142
149
  data?: T;
143
- }
144
-
145
- /**
146
- * Key-Value Object. Where Key is Unique identifier for the Content object and Value is Content Metadata.
147
- */
148
- interface Links {
149
- [key: string]: ContentMetadata;
150
+ /**
151
+ * References of all links used in the content.
152
+ */
153
+ links?: Links;
150
154
  }
151
155
 
152
156
  /**
@@ -210,11 +214,7 @@ type ContentFetchParams = {
210
214
  */
211
215
  locale?: string;
212
216
  };
213
- /**
214
- * Create a Localess API Client
215
- * @param {LocalessClientOptions} options connection details
216
- */
217
- declare function localessClient(options: LocalessClientOptions): {
217
+ interface LocalessClient {
218
218
  /**
219
219
  * Get all links
220
220
  * @param params{LinksFetchParams} - Fetch parameters
@@ -234,7 +234,7 @@ declare function localessClient(options: LocalessClientOptions): {
234
234
  * @param params{ContentFetchParams} - Fetch parameters
235
235
  * @returns {Promise<Content>}
236
236
  */
237
- getContentById<T_1 extends ContentData = ContentData>(id: string, params?: ContentFetchParams): Promise<Content<T_1>>;
237
+ getContentById<T extends ContentData = ContentData>(id: string, params?: ContentFetchParams): Promise<Content<T>>;
238
238
  /**
239
239
  * Get translations for the given locale
240
240
  * @param locale{string} - Locale identifier (ISO 639-1)
@@ -242,7 +242,12 @@ declare function localessClient(options: LocalessClientOptions): {
242
242
  getTranslations(locale: string): Promise<Translations>;
243
243
  syncScriptUrl(): string;
244
244
  assetLink(asset: ContentAsset | string): string;
245
- };
245
+ }
246
+ /**
247
+ * Create a Localess API Client
248
+ * @param {LocalessClientOptions} options connection details
249
+ */
250
+ declare function localessClient(options: LocalessClientOptions): LocalessClient;
246
251
 
247
252
  declare function llEditable(content: ContentDataSchema): {
248
253
  'data-ll-id': string;
@@ -276,4 +281,4 @@ declare global {
276
281
  }
277
282
  }
278
283
 
279
- export { type Content, type ContentAsset, type ContentData, type ContentDataField, type ContentDataSchema, type ContentFetchParams, type ContentLink, type ContentMetadata, type ContentReference, type ContentRichText, type EventCallback, type EventToApp, type EventToAppType, type Links, type LinksFetchParams, type LocalessClientOptions, type LocalessSync, type Translations, llEditable, loadLocalessSync, localessClient };
284
+ export { type Content, type ContentAsset, type ContentData, type ContentDataField, type ContentDataSchema, type ContentFetchParams, type ContentLink, type ContentMetadata, type ContentReference, type ContentRichText, type EventCallback, type EventToApp, type EventToAppType, type Links, type LinksFetchParams, type LocalessClient, type LocalessClientOptions, type LocalessSync, type Translations, llEditable, loadLocalessSync, localessClient };
package/dist/index.js CHANGED
@@ -42,15 +42,10 @@ function localessClient(options) {
42
42
  "Content-Type": "application/json",
43
43
  "Accept": "application/json",
44
44
  "X-Localess-Agent": "Localess-JS-Client",
45
- "X-Localess-Agent-Version": "0.3.0"
45
+ "X-Localess-Agent-Version": "0.6.0"
46
46
  }
47
47
  };
48
48
  return {
49
- /**
50
- * Get all links
51
- * @param params{LinksFetchParams} - Fetch parameters
52
- * @returns {Promise<Links>}
53
- */
54
49
  async getLinks(params) {
55
50
  if (options.debug) {
56
51
  console.log(LOG_GROUP, "getLinks() params : " + params);
@@ -83,12 +78,6 @@ function localessClient(options) {
83
78
  return {};
84
79
  }
85
80
  },
86
- /**
87
- * Get content by SLUG
88
- * @param slug{string} - Content SLUG
89
- * @param params{ContentFetchParams} - Fetch parameters
90
- * @returns {Promise<Content>}
91
- */
92
81
  async getContentBySlug(slug, params) {
93
82
  if (options.debug) {
94
83
  console.log(LOG_GROUP, "getContentBySlug() slug : ", slug);
@@ -118,12 +107,6 @@ function localessClient(options) {
118
107
  return {};
119
108
  }
120
109
  },
121
- /**
122
- * Get content by ID
123
- * @param id{string} - Content ID
124
- * @param params{ContentFetchParams} - Fetch parameters
125
- * @returns {Promise<Content>}
126
- */
127
110
  async getContentById(id, params) {
128
111
  if (options.debug) {
129
112
  console.log(LOG_GROUP, "getContentById() id : ", id);
@@ -148,15 +131,11 @@ function localessClient(options) {
148
131
  const data = await response.json();
149
132
  return data;
150
133
  },
151
- /**
152
- * Get translations for the given locale
153
- * @param locale{string} - Locale identifier (ISO 639-1)
154
- */
155
134
  async getTranslations(locale) {
156
135
  if (options.debug) {
157
136
  console.log(LOG_GROUP, "getTranslations() locale : ", locale);
158
137
  }
159
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}`;
138
+ let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}?token=${options.token}`;
160
139
  if (options.debug) {
161
140
  console.log(LOG_GROUP, "getTranslations fetch url : ", url);
162
141
  }
package/dist/index.mjs CHANGED
@@ -14,15 +14,10 @@ function localessClient(options) {
14
14
  "Content-Type": "application/json",
15
15
  "Accept": "application/json",
16
16
  "X-Localess-Agent": "Localess-JS-Client",
17
- "X-Localess-Agent-Version": "0.3.0"
17
+ "X-Localess-Agent-Version": "0.6.0"
18
18
  }
19
19
  };
20
20
  return {
21
- /**
22
- * Get all links
23
- * @param params{LinksFetchParams} - Fetch parameters
24
- * @returns {Promise<Links>}
25
- */
26
21
  async getLinks(params) {
27
22
  if (options.debug) {
28
23
  console.log(LOG_GROUP, "getLinks() params : " + params);
@@ -55,12 +50,6 @@ function localessClient(options) {
55
50
  return {};
56
51
  }
57
52
  },
58
- /**
59
- * Get content by SLUG
60
- * @param slug{string} - Content SLUG
61
- * @param params{ContentFetchParams} - Fetch parameters
62
- * @returns {Promise<Content>}
63
- */
64
53
  async getContentBySlug(slug, params) {
65
54
  if (options.debug) {
66
55
  console.log(LOG_GROUP, "getContentBySlug() slug : ", slug);
@@ -90,12 +79,6 @@ function localessClient(options) {
90
79
  return {};
91
80
  }
92
81
  },
93
- /**
94
- * Get content by ID
95
- * @param id{string} - Content ID
96
- * @param params{ContentFetchParams} - Fetch parameters
97
- * @returns {Promise<Content>}
98
- */
99
82
  async getContentById(id, params) {
100
83
  if (options.debug) {
101
84
  console.log(LOG_GROUP, "getContentById() id : ", id);
@@ -120,15 +103,11 @@ function localessClient(options) {
120
103
  const data = await response.json();
121
104
  return data;
122
105
  },
123
- /**
124
- * Get translations for the given locale
125
- * @param locale{string} - Locale identifier (ISO 639-1)
126
- */
127
106
  async getTranslations(locale) {
128
107
  if (options.debug) {
129
108
  console.log(LOG_GROUP, "getTranslations() locale : ", locale);
130
109
  }
131
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}`;
110
+ let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}?token=${options.token}`;
132
111
  if (options.debug) {
133
112
  console.log(LOG_GROUP, "getTranslations fetch url : ", url);
134
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localess/js-client",
3
- "version": "0.6.1-next.20250331-165335.0",
3
+ "version": "0.6.1-next.20250409-075652.0",
4
4
  "description": "Universal JavaScript/TypeScript SDK for Localess's API.",
5
5
  "keywords": [
6
6
  "localess",