@sitecore-content-sdk/core 0.2.0-beta.7 → 0.2.0-beta.8
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/cjs/content/content-client.js +59 -0
- package/dist/cjs/content/taxonomies.js +78 -0
- package/dist/esm/content/content-client.js +59 -0
- package/dist/esm/content/taxonomies.js +75 -0
- package/package.json +2 -2
- package/types/content/content-client.d.ts +35 -0
- package/types/content/taxonomies.d.ts +125 -0
|
@@ -8,6 +8,7 @@ const graphql_request_client_1 = require("../graphql-request-client");
|
|
|
8
8
|
const utils_1 = require("./utils");
|
|
9
9
|
const debug_1 = __importDefault(require("../debug"));
|
|
10
10
|
const locales_1 = require("./locales");
|
|
11
|
+
const taxonomies_1 = require("./taxonomies");
|
|
11
12
|
/**
|
|
12
13
|
* Class representing a client for interacting with the Content API.
|
|
13
14
|
*/
|
|
@@ -83,5 +84,63 @@ class ContentClient {
|
|
|
83
84
|
const response = await this.get(locales_1.GET_LOCALES_QUERY);
|
|
84
85
|
return response.manyLocale;
|
|
85
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Retrieves all available taxonomies with optional pagination support.
|
|
89
|
+
* @param {object} [options] - Optional pagination options.
|
|
90
|
+
* @param {number} [options.pageSize] - Limits the number of taxonomies returned per page. Defaults to the API's default
|
|
91
|
+
* @param {string} [options.after] - Cursor for pagination; use the `cursor` returned from the previous call to fetch the next page.
|
|
92
|
+
* @returns A promise that resolves to an object containing taxonomies, their terms, and pagination info.
|
|
93
|
+
*/
|
|
94
|
+
async getTaxonomies(options) {
|
|
95
|
+
var _a, _b, _c, _d, _e;
|
|
96
|
+
debug_1.default.content('Getting taxonomies (pageSize: %s, after: %s)', (_a = options === null || options === void 0 ? void 0 : options.pageSize) !== null && _a !== void 0 ? _a : 'API Default', (_b = options === null || options === void 0 ? void 0 : options.after) !== null && _b !== void 0 ? _b : '');
|
|
97
|
+
const variables = {
|
|
98
|
+
pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
|
|
99
|
+
after: (_c = options === null || options === void 0 ? void 0 : options.after) !== null && _c !== void 0 ? _c : '',
|
|
100
|
+
};
|
|
101
|
+
const response = await this.get(taxonomies_1.GET_TAXONOMIES_QUERY, variables);
|
|
102
|
+
const data = response === null || response === void 0 ? void 0 : response.manyTaxonomy;
|
|
103
|
+
return {
|
|
104
|
+
results: ((_d = data === null || data === void 0 ? void 0 : data.results) !== null && _d !== void 0 ? _d : []).map((taxonomy) => {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
return ({
|
|
107
|
+
system: taxonomy.system,
|
|
108
|
+
terms: (_b = (_a = taxonomy.terms) === null || _a === void 0 ? void 0 : _a.results) !== null && _b !== void 0 ? _b : [],
|
|
109
|
+
});
|
|
110
|
+
}),
|
|
111
|
+
cursor: data === null || data === void 0 ? void 0 : data.cursor,
|
|
112
|
+
hasMore: (_e = data === null || data === void 0 ? void 0 : data.hasMore) !== null && _e !== void 0 ? _e : false,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Retrieves a taxonomy by its ID, with optional pagination support for its terms.
|
|
117
|
+
* @param {object} options - Options for fetching the taxonomy.
|
|
118
|
+
* @param {string} options.id - The unique identifier of the taxonomy.
|
|
119
|
+
* @param {object} [options.terms] - Optional pagination options for terms.
|
|
120
|
+
* @param {number} [options.terms.pageSize] - Optional. Limits the number of terms returned per page.
|
|
121
|
+
* @param {string} [options.terms.after] - Optional. Cursor for pagination. Used to fetch the next page of terms.
|
|
122
|
+
* @returns A promise that resolves to the taxonomy object, including pagination metadata (`hasMore`, `cursor`) for its terms. Returns `null` if the taxonomy is not found.
|
|
123
|
+
*/
|
|
124
|
+
async getTaxonomy({ id, terms, }) {
|
|
125
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
126
|
+
debug_1.default.content('Getting taxonomy for id: %s (termsPageSize: %s, termsAfter: %s)', id, (_a = terms === null || terms === void 0 ? void 0 : terms.pageSize) !== null && _a !== void 0 ? _a : 'API Default', (_b = terms === null || terms === void 0 ? void 0 : terms.after) !== null && _b !== void 0 ? _b : '');
|
|
127
|
+
const variables = {
|
|
128
|
+
id,
|
|
129
|
+
termsPageSize: terms === null || terms === void 0 ? void 0 : terms.pageSize,
|
|
130
|
+
termsAfter: terms === null || terms === void 0 ? void 0 : terms.after,
|
|
131
|
+
};
|
|
132
|
+
const response = await this.get(taxonomies_1.GET_TAXONOMY_QUERY, variables);
|
|
133
|
+
const taxonomy = response === null || response === void 0 ? void 0 : response.taxonomy;
|
|
134
|
+
if (!taxonomy)
|
|
135
|
+
return null;
|
|
136
|
+
return {
|
|
137
|
+
system: taxonomy.system,
|
|
138
|
+
terms: {
|
|
139
|
+
results: (_d = (_c = taxonomy.terms) === null || _c === void 0 ? void 0 : _c.results) !== null && _d !== void 0 ? _d : [],
|
|
140
|
+
cursor: (_e = taxonomy.terms) === null || _e === void 0 ? void 0 : _e.cursor,
|
|
141
|
+
hasMore: (_g = (_f = taxonomy.terms) === null || _f === void 0 ? void 0 : _f.hasMore) !== null && _g !== void 0 ? _g : false,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
86
145
|
}
|
|
87
146
|
exports.ContentClient = ContentClient;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_TAXONOMY_QUERY = exports.GET_TAXONOMIES_QUERY = void 0;
|
|
4
|
+
// --- GraphQL queries ---
|
|
5
|
+
/**
|
|
6
|
+
* GraphQL query to retrieve all taxonomies with optional pagination for taxonomies only.
|
|
7
|
+
*
|
|
8
|
+
* Variables:
|
|
9
|
+
* - pageSize: The number of taxonomies to retrieve per page.
|
|
10
|
+
* - after: The cursor for fetching the next page of taxonomies.
|
|
11
|
+
*/
|
|
12
|
+
exports.GET_TAXONOMIES_QUERY = `
|
|
13
|
+
query GetAllTaxonomies(
|
|
14
|
+
$pageSize: Int
|
|
15
|
+
$after: String
|
|
16
|
+
) {
|
|
17
|
+
manyTaxonomy(minimumPageSize: $pageSize, after: $after) {
|
|
18
|
+
cursor
|
|
19
|
+
hasMore
|
|
20
|
+
results {
|
|
21
|
+
terms {
|
|
22
|
+
cursor
|
|
23
|
+
hasMore
|
|
24
|
+
results {
|
|
25
|
+
id
|
|
26
|
+
name
|
|
27
|
+
label
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
system {
|
|
31
|
+
id
|
|
32
|
+
name
|
|
33
|
+
version
|
|
34
|
+
label
|
|
35
|
+
createdAt
|
|
36
|
+
createdBy
|
|
37
|
+
updatedAt
|
|
38
|
+
updatedBy
|
|
39
|
+
publishStatus
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
/**
|
|
46
|
+
* GraphQL query to retrieve a specific taxonomy by its ID, with optional pagination for its terms.
|
|
47
|
+
*
|
|
48
|
+
* Variables:
|
|
49
|
+
* - id: The unique ID of the taxonomy to retrieve.
|
|
50
|
+
* - termsPageSize: The number of terms to retrieve per page.
|
|
51
|
+
* - termsAfter: The cursor for fetching the next page of terms.
|
|
52
|
+
*/
|
|
53
|
+
exports.GET_TAXONOMY_QUERY = `
|
|
54
|
+
query GetTaxonomyById($id: ID!, $termsPageSize: Int, $termsAfter: String) {
|
|
55
|
+
taxonomy(id: $id) {
|
|
56
|
+
terms(minimumPageSize: $termsPageSize, after: $termsAfter) {
|
|
57
|
+
cursor
|
|
58
|
+
hasMore
|
|
59
|
+
results {
|
|
60
|
+
id
|
|
61
|
+
name
|
|
62
|
+
label
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
system {
|
|
66
|
+
id
|
|
67
|
+
name
|
|
68
|
+
version
|
|
69
|
+
label
|
|
70
|
+
createdAt
|
|
71
|
+
createdBy
|
|
72
|
+
updatedAt
|
|
73
|
+
updatedBy
|
|
74
|
+
publishStatus
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
@@ -2,6 +2,7 @@ import { GraphQLRequestClient } from '../graphql-request-client';
|
|
|
2
2
|
import { getContentUrl } from './utils';
|
|
3
3
|
import debug from '../debug';
|
|
4
4
|
import { GET_LOCALE_QUERY, GET_LOCALES_QUERY, } from './locales';
|
|
5
|
+
import { GET_TAXONOMY_QUERY, GET_TAXONOMIES_QUERY, } from './taxonomies';
|
|
5
6
|
/**
|
|
6
7
|
* Class representing a client for interacting with the Content API.
|
|
7
8
|
*/
|
|
@@ -77,4 +78,62 @@ export class ContentClient {
|
|
|
77
78
|
const response = await this.get(GET_LOCALES_QUERY);
|
|
78
79
|
return response.manyLocale;
|
|
79
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Retrieves all available taxonomies with optional pagination support.
|
|
83
|
+
* @param {object} [options] - Optional pagination options.
|
|
84
|
+
* @param {number} [options.pageSize] - Limits the number of taxonomies returned per page. Defaults to the API's default
|
|
85
|
+
* @param {string} [options.after] - Cursor for pagination; use the `cursor` returned from the previous call to fetch the next page.
|
|
86
|
+
* @returns A promise that resolves to an object containing taxonomies, their terms, and pagination info.
|
|
87
|
+
*/
|
|
88
|
+
async getTaxonomies(options) {
|
|
89
|
+
var _a, _b, _c, _d, _e;
|
|
90
|
+
debug.content('Getting taxonomies (pageSize: %s, after: %s)', (_a = options === null || options === void 0 ? void 0 : options.pageSize) !== null && _a !== void 0 ? _a : 'API Default', (_b = options === null || options === void 0 ? void 0 : options.after) !== null && _b !== void 0 ? _b : '');
|
|
91
|
+
const variables = {
|
|
92
|
+
pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
|
|
93
|
+
after: (_c = options === null || options === void 0 ? void 0 : options.after) !== null && _c !== void 0 ? _c : '',
|
|
94
|
+
};
|
|
95
|
+
const response = await this.get(GET_TAXONOMIES_QUERY, variables);
|
|
96
|
+
const data = response === null || response === void 0 ? void 0 : response.manyTaxonomy;
|
|
97
|
+
return {
|
|
98
|
+
results: ((_d = data === null || data === void 0 ? void 0 : data.results) !== null && _d !== void 0 ? _d : []).map((taxonomy) => {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
return ({
|
|
101
|
+
system: taxonomy.system,
|
|
102
|
+
terms: (_b = (_a = taxonomy.terms) === null || _a === void 0 ? void 0 : _a.results) !== null && _b !== void 0 ? _b : [],
|
|
103
|
+
});
|
|
104
|
+
}),
|
|
105
|
+
cursor: data === null || data === void 0 ? void 0 : data.cursor,
|
|
106
|
+
hasMore: (_e = data === null || data === void 0 ? void 0 : data.hasMore) !== null && _e !== void 0 ? _e : false,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Retrieves a taxonomy by its ID, with optional pagination support for its terms.
|
|
111
|
+
* @param {object} options - Options for fetching the taxonomy.
|
|
112
|
+
* @param {string} options.id - The unique identifier of the taxonomy.
|
|
113
|
+
* @param {object} [options.terms] - Optional pagination options for terms.
|
|
114
|
+
* @param {number} [options.terms.pageSize] - Optional. Limits the number of terms returned per page.
|
|
115
|
+
* @param {string} [options.terms.after] - Optional. Cursor for pagination. Used to fetch the next page of terms.
|
|
116
|
+
* @returns A promise that resolves to the taxonomy object, including pagination metadata (`hasMore`, `cursor`) for its terms. Returns `null` if the taxonomy is not found.
|
|
117
|
+
*/
|
|
118
|
+
async getTaxonomy({ id, terms, }) {
|
|
119
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
120
|
+
debug.content('Getting taxonomy for id: %s (termsPageSize: %s, termsAfter: %s)', id, (_a = terms === null || terms === void 0 ? void 0 : terms.pageSize) !== null && _a !== void 0 ? _a : 'API Default', (_b = terms === null || terms === void 0 ? void 0 : terms.after) !== null && _b !== void 0 ? _b : '');
|
|
121
|
+
const variables = {
|
|
122
|
+
id,
|
|
123
|
+
termsPageSize: terms === null || terms === void 0 ? void 0 : terms.pageSize,
|
|
124
|
+
termsAfter: terms === null || terms === void 0 ? void 0 : terms.after,
|
|
125
|
+
};
|
|
126
|
+
const response = await this.get(GET_TAXONOMY_QUERY, variables);
|
|
127
|
+
const taxonomy = response === null || response === void 0 ? void 0 : response.taxonomy;
|
|
128
|
+
if (!taxonomy)
|
|
129
|
+
return null;
|
|
130
|
+
return {
|
|
131
|
+
system: taxonomy.system,
|
|
132
|
+
terms: {
|
|
133
|
+
results: (_d = (_c = taxonomy.terms) === null || _c === void 0 ? void 0 : _c.results) !== null && _d !== void 0 ? _d : [],
|
|
134
|
+
cursor: (_e = taxonomy.terms) === null || _e === void 0 ? void 0 : _e.cursor,
|
|
135
|
+
hasMore: (_g = (_f = taxonomy.terms) === null || _f === void 0 ? void 0 : _f.hasMore) !== null && _g !== void 0 ? _g : false,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
80
139
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// --- GraphQL queries ---
|
|
2
|
+
/**
|
|
3
|
+
* GraphQL query to retrieve all taxonomies with optional pagination for taxonomies only.
|
|
4
|
+
*
|
|
5
|
+
* Variables:
|
|
6
|
+
* - pageSize: The number of taxonomies to retrieve per page.
|
|
7
|
+
* - after: The cursor for fetching the next page of taxonomies.
|
|
8
|
+
*/
|
|
9
|
+
export const GET_TAXONOMIES_QUERY = `
|
|
10
|
+
query GetAllTaxonomies(
|
|
11
|
+
$pageSize: Int
|
|
12
|
+
$after: String
|
|
13
|
+
) {
|
|
14
|
+
manyTaxonomy(minimumPageSize: $pageSize, after: $after) {
|
|
15
|
+
cursor
|
|
16
|
+
hasMore
|
|
17
|
+
results {
|
|
18
|
+
terms {
|
|
19
|
+
cursor
|
|
20
|
+
hasMore
|
|
21
|
+
results {
|
|
22
|
+
id
|
|
23
|
+
name
|
|
24
|
+
label
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
system {
|
|
28
|
+
id
|
|
29
|
+
name
|
|
30
|
+
version
|
|
31
|
+
label
|
|
32
|
+
createdAt
|
|
33
|
+
createdBy
|
|
34
|
+
updatedAt
|
|
35
|
+
updatedBy
|
|
36
|
+
publishStatus
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
/**
|
|
43
|
+
* GraphQL query to retrieve a specific taxonomy by its ID, with optional pagination for its terms.
|
|
44
|
+
*
|
|
45
|
+
* Variables:
|
|
46
|
+
* - id: The unique ID of the taxonomy to retrieve.
|
|
47
|
+
* - termsPageSize: The number of terms to retrieve per page.
|
|
48
|
+
* - termsAfter: The cursor for fetching the next page of terms.
|
|
49
|
+
*/
|
|
50
|
+
export const GET_TAXONOMY_QUERY = `
|
|
51
|
+
query GetTaxonomyById($id: ID!, $termsPageSize: Int, $termsAfter: String) {
|
|
52
|
+
taxonomy(id: $id) {
|
|
53
|
+
terms(minimumPageSize: $termsPageSize, after: $termsAfter) {
|
|
54
|
+
cursor
|
|
55
|
+
hasMore
|
|
56
|
+
results {
|
|
57
|
+
id
|
|
58
|
+
name
|
|
59
|
+
label
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
system {
|
|
63
|
+
id
|
|
64
|
+
name
|
|
65
|
+
version
|
|
66
|
+
label
|
|
67
|
+
createdAt
|
|
68
|
+
createdBy
|
|
69
|
+
updatedAt
|
|
70
|
+
updatedBy
|
|
71
|
+
publishStatus
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/core",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.8",
|
|
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": "
|
|
80
|
+
"gitHead": "78f049f5e1c70964d441948e15359337c7098d55",
|
|
81
81
|
"files": [
|
|
82
82
|
"dist",
|
|
83
83
|
"types",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DocumentNode } from 'graphql';
|
|
2
2
|
import { GraphQLRequestClient } from '../graphql-request-client';
|
|
3
3
|
import { FetchOptions } from '../models';
|
|
4
|
+
import { Taxonomy } from './taxonomies';
|
|
4
5
|
/**
|
|
5
6
|
* Interface representing the options for the ContentClient.
|
|
6
7
|
*/
|
|
@@ -54,4 +55,38 @@ export declare class ContentClient {
|
|
|
54
55
|
* @returns A promise that resolves to an array of locales.
|
|
55
56
|
*/
|
|
56
57
|
getLocales(): Promise<import("./locales").Locale[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves all available taxonomies with optional pagination support.
|
|
60
|
+
* @param {object} [options] - Optional pagination options.
|
|
61
|
+
* @param {number} [options.pageSize] - Limits the number of taxonomies returned per page. Defaults to the API's default
|
|
62
|
+
* @param {string} [options.after] - Cursor for pagination; use the `cursor` returned from the previous call to fetch the next page.
|
|
63
|
+
* @returns A promise that resolves to an object containing taxonomies, their terms, and pagination info.
|
|
64
|
+
*/
|
|
65
|
+
getTaxonomies(options?: {
|
|
66
|
+
pageSize?: number;
|
|
67
|
+
after?: string;
|
|
68
|
+
}): Promise<{
|
|
69
|
+
results: {
|
|
70
|
+
system: import("./taxonomies").TaxonomySystem;
|
|
71
|
+
terms: import("./taxonomies").Term[];
|
|
72
|
+
}[];
|
|
73
|
+
cursor: string | undefined;
|
|
74
|
+
hasMore: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Retrieves a taxonomy by its ID, with optional pagination support for its terms.
|
|
78
|
+
* @param {object} options - Options for fetching the taxonomy.
|
|
79
|
+
* @param {string} options.id - The unique identifier of the taxonomy.
|
|
80
|
+
* @param {object} [options.terms] - Optional pagination options for terms.
|
|
81
|
+
* @param {number} [options.terms.pageSize] - Optional. Limits the number of terms returned per page.
|
|
82
|
+
* @param {string} [options.terms.after] - Optional. Cursor for pagination. Used to fetch the next page of terms.
|
|
83
|
+
* @returns A promise that resolves to the taxonomy object, including pagination metadata (`hasMore`, `cursor`) for its terms. Returns `null` if the taxonomy is not found.
|
|
84
|
+
*/
|
|
85
|
+
getTaxonomy({ id, terms, }: {
|
|
86
|
+
id: string;
|
|
87
|
+
terms?: {
|
|
88
|
+
pageSize?: number;
|
|
89
|
+
after?: string;
|
|
90
|
+
};
|
|
91
|
+
}): Promise<Taxonomy | null>;
|
|
57
92
|
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a term within a taxonomy.
|
|
3
|
+
*/
|
|
4
|
+
export type Term = {
|
|
5
|
+
/** The unique identifier of the term. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** The internal name of the term. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** The display label of the term. */
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Represents a list of terms within a taxonomy.
|
|
14
|
+
* In getTaxonomies, terms are always returned as a full list (no pagination).
|
|
15
|
+
* In getTaxonomy, terms may be paginated.
|
|
16
|
+
*/
|
|
17
|
+
export interface TermList {
|
|
18
|
+
/** The list of terms in the current (or full) page. */
|
|
19
|
+
results: Term[];
|
|
20
|
+
/** The cursor to fetch the next page of terms, if available. (Used only in getTaxonomy) */
|
|
21
|
+
cursor?: string | null;
|
|
22
|
+
/** Indicates whether more terms are available after the current page. (Used only in getTaxonomy) */
|
|
23
|
+
hasMore: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents the system metadata of a taxonomy.
|
|
27
|
+
*/
|
|
28
|
+
export type TaxonomySystem = {
|
|
29
|
+
/** The unique identifier of the taxonomy. */
|
|
30
|
+
id: string;
|
|
31
|
+
/** The internal name of the taxonomy. */
|
|
32
|
+
name: string;
|
|
33
|
+
/** The version of the taxonomy. */
|
|
34
|
+
version: number;
|
|
35
|
+
/** The display label of the taxonomy. */
|
|
36
|
+
label: string;
|
|
37
|
+
/** The timestamp when the taxonomy was created (ISO 8601 format). */
|
|
38
|
+
createdAt: string;
|
|
39
|
+
/** The user ID who created the taxonomy. */
|
|
40
|
+
createdBy: string;
|
|
41
|
+
/** The timestamp when the taxonomy was last updated (ISO 8601 format). */
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
/** The user ID who last updated the taxonomy. */
|
|
44
|
+
updatedBy: string;
|
|
45
|
+
/** The publish status of the taxonomy (e.g., PREVIEW, PUBLISHED). */
|
|
46
|
+
publishStatus: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Represents a taxonomy with its associated terms.
|
|
50
|
+
* Terms are paginated only in single-taxonomy queries (getTaxonomy).
|
|
51
|
+
*/
|
|
52
|
+
export type Taxonomy = {
|
|
53
|
+
/** The list of terms within the taxonomy. */
|
|
54
|
+
terms: TermList;
|
|
55
|
+
/** The system metadata of the taxonomy. */
|
|
56
|
+
system: TaxonomySystem;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Represents the response structure for a query that retrieves a specific taxonomy by ID.
|
|
60
|
+
*/
|
|
61
|
+
export interface TaxonomyQueryResponse {
|
|
62
|
+
/** The retrieved taxonomy. */
|
|
63
|
+
taxonomy: {
|
|
64
|
+
/** The system metadata of the taxonomy. */
|
|
65
|
+
system: TaxonomySystem;
|
|
66
|
+
/** The terms for the taxonomy (may be paginated). */
|
|
67
|
+
terms: {
|
|
68
|
+
results: Term[];
|
|
69
|
+
cursor?: string | null;
|
|
70
|
+
hasMore: boolean;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Represents the response structure for a query that retrieves multiple taxonomies.
|
|
76
|
+
*/
|
|
77
|
+
export interface TaxonomiesQueryResponse {
|
|
78
|
+
/** The list of retrieved taxonomies, with pagination metadata. */
|
|
79
|
+
manyTaxonomy: {
|
|
80
|
+
/** The list of taxonomies in the current page. */
|
|
81
|
+
results: {
|
|
82
|
+
/** The terms associated with the taxonomy (always the full list, not paginated). */
|
|
83
|
+
terms: {
|
|
84
|
+
results: Term[];
|
|
85
|
+
cursor?: string | null;
|
|
86
|
+
hasMore: boolean;
|
|
87
|
+
};
|
|
88
|
+
/** The system metadata of the taxonomy. */
|
|
89
|
+
system: TaxonomySystem;
|
|
90
|
+
}[];
|
|
91
|
+
/** The cursor for fetching the next page of taxonomies, if available. */
|
|
92
|
+
cursor?: string;
|
|
93
|
+
/** Indicates whether more taxonomies are available after the current page. */
|
|
94
|
+
hasMore: boolean;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Represents a paginated list of content items (generic for various types, e.g., Taxonomy).
|
|
99
|
+
* Note: This type does not include any stateful fetchNext/fetchMore helpers. Pagination is stateless.
|
|
100
|
+
*/
|
|
101
|
+
export interface ContentItemList<T> {
|
|
102
|
+
/** The list of content items in the current page. */
|
|
103
|
+
results: T[];
|
|
104
|
+
/** The cursor for fetching the next page of items, if available. */
|
|
105
|
+
cursor?: string;
|
|
106
|
+
/** Indicates whether more items are available after the current page. */
|
|
107
|
+
hasMore: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* GraphQL query to retrieve all taxonomies with optional pagination for taxonomies only.
|
|
111
|
+
*
|
|
112
|
+
* Variables:
|
|
113
|
+
* - pageSize: The number of taxonomies to retrieve per page.
|
|
114
|
+
* - after: The cursor for fetching the next page of taxonomies.
|
|
115
|
+
*/
|
|
116
|
+
export declare const GET_TAXONOMIES_QUERY = "\n query GetAllTaxonomies(\n $pageSize: Int\n $after: String\n ) {\n manyTaxonomy(minimumPageSize: $pageSize, after: $after) {\n cursor\n hasMore\n results {\n terms {\n cursor\n hasMore\n results {\n id\n name\n label\n }\n }\n system {\n id\n name\n version\n label\n createdAt\n createdBy\n updatedAt\n updatedBy\n publishStatus\n }\n }\n }\n }\n";
|
|
117
|
+
/**
|
|
118
|
+
* GraphQL query to retrieve a specific taxonomy by its ID, with optional pagination for its terms.
|
|
119
|
+
*
|
|
120
|
+
* Variables:
|
|
121
|
+
* - id: The unique ID of the taxonomy to retrieve.
|
|
122
|
+
* - termsPageSize: The number of terms to retrieve per page.
|
|
123
|
+
* - termsAfter: The cursor for fetching the next page of terms.
|
|
124
|
+
*/
|
|
125
|
+
export declare const GET_TAXONOMY_QUERY = "\n query GetTaxonomyById($id: ID!, $termsPageSize: Int, $termsAfter: String) {\n taxonomy(id: $id) {\n terms(minimumPageSize: $termsPageSize, after: $termsAfter) {\n cursor\n hasMore\n results {\n id\n name\n label\n }\n }\n system {\n id\n name\n version\n label\n createdAt\n createdBy\n updatedAt\n updatedBy\n publishStatus\n }\n }\n }\n";
|