@sitecore-content-sdk/core 0.2.0-beta.8 → 0.2.0-beta.9

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.
@@ -71,18 +71,20 @@ class ContentClient {
71
71
  * @returns A promise that resolves to the locale information associated with the specified locale ID.
72
72
  */
73
73
  async getLocale(id) {
74
+ var _a;
74
75
  debug_1.default.content('Getting locale for id: %s', id);
75
76
  const response = await this.get(locales_1.GET_LOCALE_QUERY, { id });
76
- return response.locale;
77
+ return ((_a = response.locale) === null || _a === void 0 ? void 0 : _a.system) || null;
77
78
  }
78
79
  /**
79
80
  * Retrieves all available locales from the content service.
80
81
  * @returns A promise that resolves to an array of locales.
81
82
  */
82
83
  async getLocales() {
84
+ var _a, _b;
83
85
  debug_1.default.content('Getting all locales');
84
86
  const response = await this.get(locales_1.GET_LOCALES_QUERY);
85
- return response.manyLocale;
87
+ return (_b = (_a = response === null || response === void 0 ? void 0 : response.manyLocale) === null || _a === void 0 ? void 0 : _a.map((entry) => entry.system)) !== null && _b !== void 0 ? _b : [];
86
88
  }
87
89
  /**
88
90
  * Retrieves all available taxonomies with optional pagination support.
@@ -8,10 +8,12 @@ exports.GET_LOCALES_QUERY = exports.GET_LOCALE_QUERY = void 0;
8
8
  * - id: The ID of the locale to retrieve.
9
9
  */
10
10
  exports.GET_LOCALE_QUERY = `
11
- query GetLocaleById ($id: ID!) {
11
+ query GetLocaleById($id: ID!) {
12
12
  locale(id: $id) {
13
- id
14
- label
13
+ system {
14
+ id
15
+ label
16
+ }
15
17
  }
16
18
  }
17
19
  `;
@@ -19,10 +21,12 @@ exports.GET_LOCALE_QUERY = `
19
21
  * GraphQL query to retrieve all available locales.
20
22
  */
21
23
  exports.GET_LOCALES_QUERY = `
22
- query GetAllLocales{
24
+ query GetAllLocales {
23
25
  manyLocale {
24
- id
25
- label
26
+ system {
27
+ id
28
+ label
29
+ }
26
30
  }
27
31
  }
28
32
  `;
@@ -65,18 +65,20 @@ export class ContentClient {
65
65
  * @returns A promise that resolves to the locale information associated with the specified locale ID.
66
66
  */
67
67
  async getLocale(id) {
68
+ var _a;
68
69
  debug.content('Getting locale for id: %s', id);
69
70
  const response = await this.get(GET_LOCALE_QUERY, { id });
70
- return response.locale;
71
+ return ((_a = response.locale) === null || _a === void 0 ? void 0 : _a.system) || null;
71
72
  }
72
73
  /**
73
74
  * Retrieves all available locales from the content service.
74
75
  * @returns A promise that resolves to an array of locales.
75
76
  */
76
77
  async getLocales() {
78
+ var _a, _b;
77
79
  debug.content('Getting all locales');
78
80
  const response = await this.get(GET_LOCALES_QUERY);
79
- return response.manyLocale;
81
+ return (_b = (_a = response === null || response === void 0 ? void 0 : response.manyLocale) === null || _a === void 0 ? void 0 : _a.map((entry) => entry.system)) !== null && _b !== void 0 ? _b : [];
80
82
  }
81
83
  /**
82
84
  * Retrieves all available taxonomies with optional pagination support.
@@ -5,10 +5,12 @@
5
5
  * - id: The ID of the locale to retrieve.
6
6
  */
7
7
  export const GET_LOCALE_QUERY = `
8
- query GetLocaleById ($id: ID!) {
8
+ query GetLocaleById($id: ID!) {
9
9
  locale(id: $id) {
10
- id
11
- label
10
+ system {
11
+ id
12
+ label
13
+ }
12
14
  }
13
15
  }
14
16
  `;
@@ -16,10 +18,12 @@ export const GET_LOCALE_QUERY = `
16
18
  * GraphQL query to retrieve all available locales.
17
19
  */
18
20
  export const GET_LOCALES_QUERY = `
19
- query GetAllLocales{
21
+ query GetAllLocales {
20
22
  manyLocale {
21
- id
22
- label
23
+ system {
24
+ id
25
+ label
26
+ }
23
27
  }
24
28
  }
25
29
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/core",
3
- "version": "0.2.0-beta.8",
3
+ "version": "0.2.0-beta.9",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "description": "",
79
79
  "types": "types/index.d.ts",
80
- "gitHead": "78f049f5e1c70964d441948e15359337c7098d55",
80
+ "gitHead": "d40003619ae6e4b8b25e0401a382c9e96c284882",
81
81
  "files": [
82
82
  "dist",
83
83
  "types",
@@ -1,32 +1,38 @@
1
1
  /**
2
- * Represents the response structure for a query that retrieves a locale.
2
+ * Represents the locale entity.
3
+ */
4
+ export type Locale = {
5
+ /** The unique identifier of the locale. */
6
+ id: string;
7
+ /** The label of the locale. */
8
+ label: string;
9
+ };
10
+ /**
11
+ * A locale item included in a locale query response.
12
+ */
13
+ export type LocaleItem = {
14
+ system: Locale;
15
+ };
16
+ /**
17
+ * Represents the response structure for a query that retrieves a single locale.
3
18
  */
4
19
  export interface LocaleQueryResponse {
5
- locale: Locale | null;
20
+ locale: LocaleItem | null;
6
21
  }
7
22
  /**
8
23
  * Represents the response structure for a query that retrieves multiple locales.
9
24
  */
10
25
  export interface LocalesQueryResponse {
11
- manyLocale: Locale[];
26
+ manyLocale: LocaleItem[];
12
27
  }
13
- /**
14
- * Represents a locale with an id and a label.
15
- */
16
- export type Locale = {
17
- /** The unique identifier for the locale. */
18
- id: string;
19
- /** The display name or label for the locale. */
20
- label: string;
21
- };
22
28
  /**
23
29
  * GraphQL query to retrieve a specific locale by its ID.
24
30
  *
25
31
  * Variables:
26
32
  * - id: The ID of the locale to retrieve.
27
33
  */
28
- export declare const GET_LOCALE_QUERY = "\n query GetLocaleById ($id: ID!) {\n locale(id: $id) {\n id\n label\n }\n }\n";
34
+ export declare const GET_LOCALE_QUERY = "\n query GetLocaleById($id: ID!) {\n locale(id: $id) {\n system {\n id\n label\n }\n }\n }\n";
29
35
  /**
30
36
  * GraphQL query to retrieve all available locales.
31
37
  */
32
- export declare const GET_LOCALES_QUERY = "\n query GetAllLocales{\n manyLocale {\n id\n label\n }\n }\n";
38
+ export declare const GET_LOCALES_QUERY = "\n query GetAllLocales {\n manyLocale {\n system {\n id\n label\n }\n }\n }\n";