@sleekcms/client 2.3.0 → 2.3.1

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/README.md CHANGED
@@ -213,12 +213,12 @@ const logo = client.getImage('logo');
213
213
  // { url: 'https://...', alt: '...', ... }
214
214
  ```
215
215
 
216
- ### `getOptionSet(name)`
216
+ ### `getOptions(name)`
217
217
 
218
218
  Get a option set (array of label/value pairs).
219
219
 
220
220
  ```typescript
221
- const categories = client.getOptionSet('categories');
221
+ const categories = client.getOptions('categories');
222
222
  // [{ label: 'Tech', value: 'tech' }, ...]
223
223
  ```
224
224
 
package/index.cjs CHANGED
@@ -209,7 +209,7 @@ async function createClient(options) {
209
209
  if (!name) return null;
210
210
  return data.images ? data.images[name] : null;
211
211
  }
212
- function getOptionSet(name) {
212
+ function getOptions(name) {
213
213
  if (!name) return null;
214
214
  const options2 = data.options ?? {};
215
215
  const optionSet = options2[name];
@@ -222,7 +222,7 @@ async function createClient(options) {
222
222
  getEntry,
223
223
  getSlugs,
224
224
  getImage,
225
- getOptionSet
225
+ getOptions
226
226
  };
227
227
  }
228
228
  function createAsyncClient(options) {
@@ -274,9 +274,9 @@ function createAsyncClient(options) {
274
274
  const images = await fetchSiteContent({ siteToken, env: tag ?? env, search: "images", lang, cache });
275
275
  return images ? images[name] : null;
276
276
  }
277
- async function getOptionSet(name) {
277
+ async function getOptions(name) {
278
278
  if (cdn && !tag) tag = await fetchEnvTag({ siteToken, env });
279
- if (syncClient) return syncClient.getOptionSet(name);
279
+ if (syncClient) return syncClient.getOptions(name);
280
280
  const options2 = await fetchSiteContent({ siteToken, env: tag ?? env, search: "options", lang, cache });
281
281
  const optionSet = options2[name];
282
282
  return Array.isArray(optionSet) ? optionSet : null;
@@ -295,7 +295,7 @@ function createAsyncClient(options) {
295
295
  getEntry,
296
296
  getSlugs,
297
297
  getImage,
298
- getOptionSet,
298
+ getOptions,
299
299
  _getFetchUrl,
300
300
  _getEnvTag
301
301
  };
package/index.d.cts CHANGED
@@ -45,7 +45,7 @@ interface SleekClient {
45
45
  getEntry(handle: string): Entry | Entry[] | null;
46
46
  getSlugs(path: string): string[];
47
47
  getImage(name: string): Image | null;
48
- getOptionSet(name: string): Options | null;
48
+ getOptions(name: string): Options | null;
49
49
  }
50
50
  interface SleekAsyncClient {
51
51
  getContent(query?: string): Promise<SleekSiteContent>;
@@ -54,7 +54,7 @@ interface SleekAsyncClient {
54
54
  getEntry(handle: string): Promise<Entry | Entry[] | null>;
55
55
  getSlugs(path: string): Promise<string[]>;
56
56
  getImage(name: string): Promise<Image | null>;
57
- getOptionSet(name: string): Promise<Options | null>;
57
+ getOptions(name: string): Promise<Options | null>;
58
58
  _getFetchUrl(): string;
59
59
  _getEnvTag(): Promise<string>;
60
60
  }
package/index.d.ts CHANGED
@@ -45,7 +45,7 @@ interface SleekClient {
45
45
  getEntry(handle: string): Entry | Entry[] | null;
46
46
  getSlugs(path: string): string[];
47
47
  getImage(name: string): Image | null;
48
- getOptionSet(name: string): Options | null;
48
+ getOptions(name: string): Options | null;
49
49
  }
50
50
  interface SleekAsyncClient {
51
51
  getContent(query?: string): Promise<SleekSiteContent>;
@@ -54,7 +54,7 @@ interface SleekAsyncClient {
54
54
  getEntry(handle: string): Promise<Entry | Entry[] | null>;
55
55
  getSlugs(path: string): Promise<string[]>;
56
56
  getImage(name: string): Promise<Image | null>;
57
- getOptionSet(name: string): Promise<Options | null>;
57
+ getOptions(name: string): Promise<Options | null>;
58
58
  _getFetchUrl(): string;
59
59
  _getEnvTag(): Promise<string>;
60
60
  }
package/index.mjs CHANGED
@@ -173,7 +173,7 @@ async function createClient(options) {
173
173
  if (!name) return null;
174
174
  return data.images ? data.images[name] : null;
175
175
  }
176
- function getOptionSet(name) {
176
+ function getOptions(name) {
177
177
  if (!name) return null;
178
178
  const options2 = data.options ?? {};
179
179
  const optionSet = options2[name];
@@ -186,7 +186,7 @@ async function createClient(options) {
186
186
  getEntry,
187
187
  getSlugs,
188
188
  getImage,
189
- getOptionSet
189
+ getOptions
190
190
  };
191
191
  }
192
192
  function createAsyncClient(options) {
@@ -238,9 +238,9 @@ function createAsyncClient(options) {
238
238
  const images = await fetchSiteContent({ siteToken, env: tag ?? env, search: "images", lang, cache });
239
239
  return images ? images[name] : null;
240
240
  }
241
- async function getOptionSet(name) {
241
+ async function getOptions(name) {
242
242
  if (cdn && !tag) tag = await fetchEnvTag({ siteToken, env });
243
- if (syncClient) return syncClient.getOptionSet(name);
243
+ if (syncClient) return syncClient.getOptions(name);
244
244
  const options2 = await fetchSiteContent({ siteToken, env: tag ?? env, search: "options", lang, cache });
245
245
  const optionSet = options2[name];
246
246
  return Array.isArray(optionSet) ? optionSet : null;
@@ -259,7 +259,7 @@ function createAsyncClient(options) {
259
259
  getEntry,
260
260
  getSlugs,
261
261
  getImage,
262
- getOptionSet,
262
+ getOptions,
263
263
  _getFetchUrl,
264
264
  _getEnvTag
265
265
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleekcms/client",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Official SleekCMS content client for Node 18+ and browser",
5
5
  "type": "module",
6
6
  "main": "index.cjs",