@localess/cli 3.0.1-dev.20260323212140 → 3.0.1-dev.20260405094412

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.js CHANGED
@@ -123,6 +123,7 @@ function localessClient(options) {
123
123
  if (options.debug) {
124
124
  console.log(LOG_GROUP, "Client Options : ", options);
125
125
  }
126
+ const normalizedOrigin = options.origin.replace(/\/+$/, "");
126
127
  const fetchOptions = {
127
128
  redirect: "follow",
128
129
  headers: {
@@ -138,7 +139,7 @@ function localessClient(options) {
138
139
  if (options.debug) {
139
140
  console.log(LOG_GROUP, "getSpace()");
140
141
  }
141
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}?token=${options.token}`;
142
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}?token=${options.token}`;
142
143
  if (options.debug) {
143
144
  console.log(LOG_GROUP, "getSpace fetch url : ", url);
144
145
  }
@@ -177,7 +178,7 @@ function localessClient(options) {
177
178
  if (params?.excludeChildren) {
178
179
  excludeChildren = `&excludeChildren=${params.excludeChildren}`;
179
180
  }
180
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/links?token=${options.token}${kind}${parentSlug}${excludeChildren}`;
181
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/links?token=${options.token}${kind}${parentSlug}${excludeChildren}`;
181
182
  if (options.debug) {
182
183
  console.log(LOG_GROUP, "getLinks fetch url : ", url);
183
184
  }
@@ -215,7 +216,7 @@ function localessClient(options) {
215
216
  const locale = params?.locale ? `&locale=${params.locale}` : "";
216
217
  const resolveReference = params?.resolveReference ? `&resolveReference=${params.resolveReference}` : "";
217
218
  const resolveLink = params?.resolveLink ? `&resolveLink=${params.resolveLink}` : "";
218
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/contents/slugs/${slug}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
219
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/contents/slugs/${slug}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
219
220
  if (options.debug) {
220
221
  console.log(LOG_GROUP, "getContentBySlug fetch url : ", url);
221
222
  }
@@ -253,7 +254,7 @@ function localessClient(options) {
253
254
  const locale = params?.locale ? `&locale=${params.locale}` : "";
254
255
  const resolveReference = params?.resolveReference ? `&resolveReference=${params.resolveReference}` : "";
255
256
  const resolveLink = params?.resolveLink ? `&resolveLink=${params.resolveLink}` : "";
256
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/contents/${id}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
257
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/contents/${id}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
257
258
  if (options.debug) {
258
259
  console.log(LOG_GROUP, "getContentById fetch url : ", url);
259
260
  }
@@ -288,7 +289,7 @@ function localessClient(options) {
288
289
  if (params?.version && params.version == "draft") {
289
290
  version = `&version=${params.version}`;
290
291
  }
291
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}?token=${options.token}${version}`;
292
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/translations/${locale}?token=${options.token}${version}`;
292
293
  if (options.debug) {
293
294
  console.log(LOG_GROUP, "getTranslations fetch url : ", url);
294
295
  }
@@ -317,7 +318,7 @@ function localessClient(options) {
317
318
  console.log(LOG_GROUP, "updateTranslations() type : ", type);
318
319
  console.log(LOG_GROUP, "updateTranslations() values : ", JSON.stringify(values));
319
320
  }
320
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}`;
321
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/translations/${locale}`;
321
322
  if (options.debug) {
322
323
  console.log(LOG_GROUP, "updateTranslations fetch url : ", url);
323
324
  }
@@ -347,7 +348,7 @@ function localessClient(options) {
347
348
  if (options.debug) {
348
349
  console.log(LOG_GROUP, "getOpenApi()");
349
350
  }
350
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/open-api?token=${options.token}`;
351
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/open-api?token=${options.token}`;
351
352
  if (options.debug) {
352
353
  console.log(LOG_GROUP, "getOpenApi fetch url : ", url);
353
354
  }
@@ -371,13 +372,13 @@ function localessClient(options) {
371
372
  }
372
373
  },
373
374
  syncScriptUrl() {
374
- return `${options.origin}/scripts/sync-v1.js`;
375
+ return `${normalizedOrigin}/scripts/sync-v1.js`;
375
376
  },
376
377
  assetLink(asset) {
377
378
  if (typeof asset === "string") {
378
- return `${options.origin}/api/v1/spaces/${options.spaceId}/assets/${asset}`;
379
+ return `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/assets/${asset}`;
379
380
  } else {
380
- return `${options.origin}/api/v1/spaces/${options.spaceId}/assets/${asset.uri}`;
381
+ return `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/assets/${asset.uri}`;
381
382
  }
382
383
  }
383
384
  };
package/dist/index.mjs CHANGED
@@ -100,6 +100,7 @@ function localessClient(options) {
100
100
  if (options.debug) {
101
101
  console.log(LOG_GROUP, "Client Options : ", options);
102
102
  }
103
+ const normalizedOrigin = options.origin.replace(/\/+$/, "");
103
104
  const fetchOptions = {
104
105
  redirect: "follow",
105
106
  headers: {
@@ -115,7 +116,7 @@ function localessClient(options) {
115
116
  if (options.debug) {
116
117
  console.log(LOG_GROUP, "getSpace()");
117
118
  }
118
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}?token=${options.token}`;
119
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}?token=${options.token}`;
119
120
  if (options.debug) {
120
121
  console.log(LOG_GROUP, "getSpace fetch url : ", url);
121
122
  }
@@ -154,7 +155,7 @@ function localessClient(options) {
154
155
  if (params?.excludeChildren) {
155
156
  excludeChildren = `&excludeChildren=${params.excludeChildren}`;
156
157
  }
157
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/links?token=${options.token}${kind}${parentSlug}${excludeChildren}`;
158
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/links?token=${options.token}${kind}${parentSlug}${excludeChildren}`;
158
159
  if (options.debug) {
159
160
  console.log(LOG_GROUP, "getLinks fetch url : ", url);
160
161
  }
@@ -192,7 +193,7 @@ function localessClient(options) {
192
193
  const locale = params?.locale ? `&locale=${params.locale}` : "";
193
194
  const resolveReference = params?.resolveReference ? `&resolveReference=${params.resolveReference}` : "";
194
195
  const resolveLink = params?.resolveLink ? `&resolveLink=${params.resolveLink}` : "";
195
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/contents/slugs/${slug}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
196
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/contents/slugs/${slug}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
196
197
  if (options.debug) {
197
198
  console.log(LOG_GROUP, "getContentBySlug fetch url : ", url);
198
199
  }
@@ -230,7 +231,7 @@ function localessClient(options) {
230
231
  const locale = params?.locale ? `&locale=${params.locale}` : "";
231
232
  const resolveReference = params?.resolveReference ? `&resolveReference=${params.resolveReference}` : "";
232
233
  const resolveLink = params?.resolveLink ? `&resolveLink=${params.resolveLink}` : "";
233
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/contents/${id}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
234
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/contents/${id}?token=${options.token}${version}${locale}${resolveReference}${resolveLink}`;
234
235
  if (options.debug) {
235
236
  console.log(LOG_GROUP, "getContentById fetch url : ", url);
236
237
  }
@@ -265,7 +266,7 @@ function localessClient(options) {
265
266
  if (params?.version && params.version == "draft") {
266
267
  version = `&version=${params.version}`;
267
268
  }
268
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}?token=${options.token}${version}`;
269
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/translations/${locale}?token=${options.token}${version}`;
269
270
  if (options.debug) {
270
271
  console.log(LOG_GROUP, "getTranslations fetch url : ", url);
271
272
  }
@@ -294,7 +295,7 @@ function localessClient(options) {
294
295
  console.log(LOG_GROUP, "updateTranslations() type : ", type);
295
296
  console.log(LOG_GROUP, "updateTranslations() values : ", JSON.stringify(values));
296
297
  }
297
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/translations/${locale}`;
298
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/translations/${locale}`;
298
299
  if (options.debug) {
299
300
  console.log(LOG_GROUP, "updateTranslations fetch url : ", url);
300
301
  }
@@ -324,7 +325,7 @@ function localessClient(options) {
324
325
  if (options.debug) {
325
326
  console.log(LOG_GROUP, "getOpenApi()");
326
327
  }
327
- let url = `${options.origin}/api/v1/spaces/${options.spaceId}/open-api?token=${options.token}`;
328
+ let url = `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/open-api?token=${options.token}`;
328
329
  if (options.debug) {
329
330
  console.log(LOG_GROUP, "getOpenApi fetch url : ", url);
330
331
  }
@@ -348,13 +349,13 @@ function localessClient(options) {
348
349
  }
349
350
  },
350
351
  syncScriptUrl() {
351
- return `${options.origin}/scripts/sync-v1.js`;
352
+ return `${normalizedOrigin}/scripts/sync-v1.js`;
352
353
  },
353
354
  assetLink(asset) {
354
355
  if (typeof asset === "string") {
355
- return `${options.origin}/api/v1/spaces/${options.spaceId}/assets/${asset}`;
356
+ return `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/assets/${asset}`;
356
357
  } else {
357
- return `${options.origin}/api/v1/spaces/${options.spaceId}/assets/${asset.uri}`;
358
+ return `${normalizedOrigin}/api/v1/spaces/${options.spaceId}/assets/${asset.uri}`;
358
359
  }
359
360
  }
360
361
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localess/cli",
3
- "version": "3.0.1-dev.20260323212140",
3
+ "version": "3.0.1-dev.20260405094412",
4
4
  "description": "Localess Command Line.",
5
5
  "keywords": [
6
6
  "localess",