@garchicms/garchi-node-sdk 0.0.9 → 0.0.11

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
@@ -11,6 +11,7 @@
11
11
  - [Example usages](#example-usages)
12
12
  - [Data item API](#data-item-api)
13
13
  - [Create a Data Item](#create-a-data-item)
14
+ - [Update a published item](#update-a-published-item)
14
15
  - [Get All Items](#get-all-items)
15
16
  - [Category API](#category-api)
16
17
  - [Create a Category](#create-a-category)
@@ -85,6 +86,7 @@ Each module corresponds to a specific API group:
85
86
  - garchi.dataItem → Data Item/Items API
86
87
  - garchi.dataItem.create() corresponds to [Create data item API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-item)
87
88
  - garchi.dataItem.update() corresponds to [Update data item API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-update-item)
89
+ - garchi.dataItem.updateWithStatus() is the same API, and also returns `has_draft`
88
90
  - garchi.dataItem.delete() corresponds to [Delete data item API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-delete-item)
89
91
  - garchi.dataItem.createMetaInfo() corresponds to [Create meta info for item API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-item_meta)
90
92
  - garchi.dataItem.deleteMetaInfo() corresponds to [Delete meta info for item API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-delete-item_meta)
@@ -97,6 +99,8 @@ Each module corresponds to a specific API group:
97
99
  - garchi.dataItem.filter() corresponds to [Filter data items API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-items-filter)
98
100
  - garchi.dataItem.filterByMeta() corresponds to [Filter data items by meta information API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-items-filter-bymeta)
99
101
  - garchi.dataItem.getByIds() corresponds to [Get data items by IDs API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-items-byids)
102
+ - garchi.dataItem.query() corresponds to [Query items API](https://garchi.co.uk/docs/v2#item-POSTapi-v2-space--uid--items-query)
103
+ - garchi.dataItem.getChildren() corresponds to [List the items inside an item API](https://garchi.co.uk/docs/v2#item-GETapi-v2-space--uid--items--item--children)
100
104
 
101
105
 
102
106
  - garchi.category → Category API
@@ -154,12 +158,64 @@ const newItem = await garchi.dataItem.create({
154
158
  });
155
159
  ```
156
160
 
161
+ #### Update a published item
162
+
163
+ Visitors keep seeing a published item while it changes: an update to it is kept as unpublished changes unless `make_public` is true. `updateWithStatus()` tells you which happened.
164
+
165
+ ```typescript
166
+ const result = await garchi.dataItem.updateWithStatus({
167
+ item_id: 51,
168
+ space_uid: 'your_space_uid',
169
+ name: 'Winter coat',
170
+ });
171
+ // result.has_draft === true: saved as unpublished changes, the published item is unchanged
172
+
173
+ await garchi.dataItem.update({ item_id: 51, space_uid: 'your_space_uid', make_public: true });
174
+ // publishes them; a 409 error ({ message }) says why they could not be published
175
+ ```
176
+
177
+ Metadata changes to a published item are kept with its unpublished changes too, and an entry added there has a negative `meta_id` until it is published.
178
+
157
179
  #### Get All Items
158
180
 
159
181
  ```typescript
160
182
  const items = await client.dataItem.getAll({ size: 10 });
161
183
  ```
162
184
 
185
+ #### Query items by their fields and metadata
186
+
187
+ ```typescript
188
+ const items = await garchi.dataItem.query({
189
+ uid: 'your_space_uid',
190
+ where: {
191
+ all: [
192
+ { field: 'meta.color', op: 'in', value: ['red', 'blue'] },
193
+ { field: 'price', op: 'lte', value: 50 },
194
+ ],
195
+ },
196
+ sort: [{ field: 'price', direction: 'asc' }],
197
+ size: 20,
198
+ });
199
+ ```
200
+
201
+ #### Items inside items (variants, lessons)
202
+
203
+ A data item can sit inside another one, such as a variant inside its product or a lesson inside its course. Every item has `parent_id` and `children_count`; pass `children: 'include'` to get the items inside as well.
204
+
205
+ ```typescript
206
+ // The published items inside a product, in their order
207
+ const variants = await garchi.dataItem.getChildren({ uid: 'your_space_uid', item: 'oak-table' });
208
+
209
+ // A product with its variants in one call
210
+ const product = await garchi.dataItem.get({ item: 'oak-table', children: 'include' });
211
+
212
+ // Create a variant inside a product
213
+ await garchi.dataItem.create({ space_uid: 'your_space_uid', name: 'Oak table - large', categories: [1], parent_id: 48 });
214
+
215
+ // Top-level items only
216
+ const topLevel = await garchi.dataItem.query({ uid: 'your_space_uid', where: { field: 'parent_id', op: 'not_exists' } });
217
+ ```
218
+
163
219
  ### Category API
164
220
 
165
221
  #### Create a Category
package/dist/index.cjs CHANGED
@@ -131,11 +131,27 @@ var DataItem = class extends APIClient_default {
131
131
  throw error.response?.data || new Error("Network Error");
132
132
  }
133
133
  }
134
+ /**
135
+ * Update a data item. For an item that is already published, the update
136
+ * is kept as unpublished changes unless `make_public` is true. Use
137
+ * {@link updateWithStatus} to know which happened.
138
+ *
139
+ * @returns A message saying what happened.
140
+ */
134
141
  async update(params) {
142
+ return (await this.updateWithStatus(params)).data;
143
+ }
144
+ /**
145
+ * Update a data item and learn whether a published item's changes were
146
+ * published or kept as unpublished changes (`has_draft`).
147
+ *
148
+ * Throws the API's error body, such as `{ message }` with status 409 when
149
+ * `make_public` is true but the changes could not be published.
150
+ */
151
+ async updateWithStatus(params) {
135
152
  try {
136
153
  const response = await this.client.post(`/update/item`, params);
137
- const data = response.data;
138
- return data.data;
154
+ return response.data;
139
155
  } catch (error) {
140
156
  throw error.response?.data || new Error("Network Error");
141
157
  }
@@ -255,6 +271,34 @@ var DataItem = class extends APIClient_default {
255
271
  throw error.response?.data || new Error("Network Error");
256
272
  }
257
273
  }
274
+ /**
275
+ * Query the published items of a space with conditions on their fields and
276
+ * metadata, including nested JSON values. See the API docs for the operators.
277
+ */
278
+ async query(params) {
279
+ try {
280
+ const { uid, ...body } = params;
281
+ const response = await this.client.post(`/space/${uid}/items/query`, body);
282
+ return response.data;
283
+ } catch (error) {
284
+ throw error.response?.data || new Error("Network Error");
285
+ }
286
+ }
287
+ /**
288
+ * The published items inside an item (variants of a product, lessons of a
289
+ * course), in their order. The parent itself must be published.
290
+ */
291
+ async getChildren(params) {
292
+ try {
293
+ const { uid, item, ...query } = params;
294
+ const response = await this.client.get(`/space/${uid}/items/${encodeURIComponent(String(item))}/children`, {
295
+ params: query
296
+ });
297
+ return response.data;
298
+ } catch (error) {
299
+ throw error.response?.data || new Error("Network Error");
300
+ }
301
+ }
258
302
  };
259
303
  var DataItem_default = DataItem;
260
304
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/services/APIClient.ts","../src/services/api-wrappers/Category.ts","../src/services/api-wrappers/CompoundQuery.ts","../src/services/api-wrappers/DataItem.ts","../src/services/api-wrappers/Headless.ts","../src/services/api-wrappers/Reaction.ts","../src/services/api-wrappers/Review.ts","../src/services/api-wrappers/Space.ts","../src/services/GarchiCMS.ts"],"sourcesContent":["import GarchiCMS from \"./services/GarchiCMS\";\n\n\n\nexport default GarchiCMS;\n\n\nexport * from \"./types/index\";\n\n","import axios, { AxiosInstance } from \"axios\";\nimport { GarchiCMSInitOptions } from \"../types\";\n\nclass APIClient {\n\n client: AxiosInstance\n\n\n constructor(options: GarchiCMSInitOptions | null) {\n \n this.client = axios.create({\n baseURL: \"https://garchi.co.uk/api/v2\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\",\n \"Authorization\": `Bearer ${options?.api_key || process.env.GARCHI_API_KEY}`,\n ...options?.headers\n }\n })\n\n }\n}\n\nexport default APIClient;","import { CreateCategoryParams, DeleteCategoryParams, GarchiCategory, UpdateCategoryParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Category extends APIClient {\n\n async create(params: CreateCategoryParams) : Promise<GarchiCategory> {\n try {\n const response = await this.client.post(\"/category\", params);\n let data = response.data as {\n data: GarchiCategory\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(params: DeleteCategoryParams) : Promise<string> {\n try {\n const response = await this.client.post(`/delete/category/${params.space_uid}/${params.category_id}`);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(params: UpdateCategoryParams) : Promise<string> {\n try {\n const response = await this.client.post(`/update/category/${params.category_id}`, {\n space_uid: params.space_uid,\n category: params.category\n });\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getAll() : Promise<GarchiCategory[]> {\n try {\n const response = await this.client.get(\"/categories\");\n const data = response.data as {\n data: GarchiCategory[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Category;","import { CompoundQueryBody, GarchiCategoryAPIResponse, GarchiItemAPIResponse, GarchiReview, ItemsQueryParams, PaginatedResponse } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass CompoundQuery extends APIClient {\n async query(body: CompoundQueryBody, params: ItemsQueryParams) : Promise<GarchiItemAPIResponse | GarchiCategoryAPIResponse | \n PaginatedResponse<GarchiReview>>\n {\n try {\n const response = await this.client.post(`/compound_query`, body, {\n params\n });\n return response.data as GarchiItemAPIResponse | GarchiCategoryAPIResponse | PaginatedResponse<GarchiReview>;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n} \n\nexport default CompoundQuery;","\n\nimport { CreateDataItemParams, CreateMetaInfoParams, DeleteDataItemParams, DeleteMetaInfoParams, FilterItemsByMetaParams, FilterItemsParams, GarchiItem, GarchiItemAPIResponse, GarchiItemMeta, GetAllItemsParams, GetFeaturedItemsParams, GetItemParams, GetItemsByIdsParams, GetItemsBySpaceParams, SemanticSearchParams, UpdateDataItemParams, UpdateMetaInfoParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass DataItem extends APIClient {\n\n\n async create(params: CreateDataItemParams): Promise<GarchiItem> {\n try {\n const response = await this.client.post(\"/item\", params);\n let data = response.data as {\n data: GarchiItem\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(params: DeleteDataItemParams): Promise<string> {\n try {\n const response = await this.client.post(`/delete/item`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n\n async update(params: UpdateDataItemParams): Promise<string> {\n try {\n const response = await this.client.post(`/update/item`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async createMetaInfo(params: CreateMetaInfoParams): Promise<GarchiItemMeta[]> {\n try {\n const response = await this.client.post(`/item_meta`, params);\n const data = response.data as {\n data: GarchiItemMeta[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async deleteMetaInfo(params: DeleteMetaInfoParams): Promise<string> {\n try {\n const response = await this.client.post(`/delete/item_meta`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async updateMetaInfo(params: UpdateMetaInfoParams): Promise<string> {\n try {\n const response = await this.client.post(`/update/item_meta`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getBySpace(params: GetItemsBySpaceParams): Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/space/${params.uid}/items`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async semanticSearch(params: SemanticSearchParams): Promise<GarchiItem[]> {\n try {\n const response = await this.client.get(`/items/semantic-search`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async featured(params: GetFeaturedItemsParams) : Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/items/featured`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async get(params: GetItemParams): Promise<GarchiItem> {\n try {\n const response = await this.client.get(`/item/${params.item}`, {\n params: params,\n });\n const data = response.data as GarchiItemAPIResponse\n return data.data[0] as GarchiItem;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n\n async getAll(params: GetAllItemsParams): Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/items`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n\n }\n }\n\n async filter(params: FilterItemsParams) : Promise<GarchiItem[]> {\n try {\n const response = await this.client.post(`/items/filter`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n\n }\n\n async filterByMeta(params: FilterItemsByMetaParams) : Promise<GarchiItem[]> {\n try {\n const response = await this.client.post(`/items/filter/bymeta`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getByIds(params: GetItemsByIdsParams) : Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.post(`/items/byids`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\n\nexport default DataItem;","import { BlankSectionRequest, BlankSectionResponse, CreateOrUpdateSectionTemplateParams, CreatePageRequest, CreatePageResponse, GarchiAsset, GarchiPage, GetPageParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Headless extends APIClient {\n\n async getAsset(file_name: string, space_uid: string) : Promise<GarchiAsset> {\n try {\n const response = await this.client.get(`/space/assets/${file_name}`, {\n params: {\n space_uid\n }\n });\n return response.data as GarchiAsset;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getPage(params: GetPageParams) : Promise<GarchiPage> {\n try {\n const response = await this.client.post(`/page`, params);\n return response.data as GarchiPage;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async createOrUpdateSectionTemplates(params: CreateOrUpdateSectionTemplateParams) : Promise<string> {\n try {\n const response = await this.client.post(`/section_template`, params);\n return response.data as string;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async addPage(params: CreatePageRequest) : Promise<CreatePageResponse>\n {\n try {\n const response = await this.client.post(`/space/${params.space_uid}/create_page`, {\n title: params.title,\n path: params.path,\n description: params.description,\n })\n return response.data as CreatePageResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async addBlankSectionToPage(params: BlankSectionRequest) : Promise<BlankSectionResponse>\n {\n try {\n const response = await this.client.post('/page/add_blank_section', {\n section_template_id: params.section_template_id,\n parent_id: params.parent_id,\n page_id: params.page_id,\n })\n return response.data as BlankSectionResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n \n \n}\n\nexport default Headless;","import { GarchiReaction, GarchiReactionCreate } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Reaction extends APIClient {\n async manage(params: GarchiReactionCreate) : Promise<GarchiReaction> {\n try {\n const response = await this.client.post(\"/manage-reaction\", params);\n let data = response.data as {\n data: GarchiReaction\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Reaction;","import { GarchiReview, GarchiReviewCreate, PaginateQueryParams, GarchiReviewUpdate, PaginatedResponse } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Review extends APIClient{\n async create(params: GarchiReviewCreate): Promise<GarchiReview> {\n try {\n const response = await this.client.post('/reviews/item', params);\n const data = response.data as {\n data: GarchiReview\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(params: GarchiReviewUpdate): Promise<string> {\n try {\n const response = await this.client.post('/reviews/edit', params);\n const data = response.data as {\n message: string\n }\n return data.message;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(review_id: number): Promise<string> {\n try {\n const response = await this.client.post(`/reviews/delete`, {\n review_id\n });\n const data = response.data as {\n message: string\n }\n return data.message;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getByItem(item_id: number | string, queryParams: PaginateQueryParams) : Promise<PaginatedResponse<GarchiReview>> {\n try {\n const response = await this.client.get(`/reviews/item/${item_id}`, {\n params: queryParams\n });\n const data = response.data as PaginatedResponse<GarchiReview>;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Review;","import { CreatePageResponse, GarchiCategory, GarchiSpace, GarchiSpaceAPIResponse, GarchiSpaceCreate, PaginatedResponse, PaginateQueryParams, SectionTemplate } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Space extends APIClient {\n \n\n async categories(space_uid: string) : Promise<GarchiCategory[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/categories`);\n const data = response.data as {\n data: GarchiCategory[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getAll(params: PaginateQueryParams) : Promise<GarchiSpaceAPIResponse> {\n try {\n const response = await this.client.get('/spaces', {\n params\n });\n const data = response.data as GarchiSpaceAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n } \n \n async get(space_uid: string) : Promise<GarchiSpace> {\n try {\n const response = await this.client.get(`/space/${space_uid}`);\n const data = response.data as {\n data: GarchiSpace\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async create(params: GarchiSpaceCreate): Promise<GarchiSpace> {\n try {\n const formData = new FormData()\n formData.append('name', params.name)\n if(params.logo) {\n formData.append('logo', params.logo)\n }\n const response = await this.client.post('/space', formData);\n const data = response.data as {\n data: GarchiSpace\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(space_uid: string, params: {\n name?: string,\n logo?: File\n }) : Promise<string> {\n try {\n const formData = new FormData();\n if(params.name) {\n formData.append('name', params.name)\n }\n if(params.logo) {\n formData.append('logo', params.logo)\n }\n const response = await this.client.post(`/update/space/${space_uid}`, formData);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(space_uid: string) : Promise<string> {\n try {\n const response = await this.client.delete(`/delete/space/${space_uid}`);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async listPages(space_uid: string) : Promise<CreatePageResponse[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/pages`);\n const data = response.data\n return data as CreatePageResponse[];\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async listSectionTemplates(space_uid: string) : Promise<SectionTemplate[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/section_templates`);\n const data = response.data\n return data as SectionTemplate[];\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n}\nexport default Space;","import { GarchiCMSInitOptions } from \"../types\";\nimport Category from \"./api-wrappers/Category\";\nimport CompoundQuery from \"./api-wrappers/CompoundQuery\";\nimport DataItem from \"./api-wrappers/DataItem\";\nimport Headless from \"./api-wrappers/Headless\";\nimport Reaction from \"./api-wrappers/Reaction\";\nimport Review from \"./api-wrappers/Review\";\nimport Space from \"./api-wrappers/Space\";\n\n\nclass GarchiCMS {\n\n dataItem: DataItem\n category: Category\n space: Space\n review: Review\n headless: Headless\n reaction: Reaction\n compoundQuery: CompoundQuery\n \n constructor(options: GarchiCMSInitOptions) {\n this.dataItem = new DataItem(options)\n this.category = new Category(options)\n this.space = new Space(options)\n this.review = new Review(options) \n this.headless = new Headless(options)\n this.reaction = new Reaction(options)\n this.compoundQuery = new CompoundQuery(options)\n }\n\n \n\n \n}\n\nexport default GarchiCMS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAqC;AAGrC,IAAM,YAAN,MAAgB;AAAA,EAEZ;AAAA,EAGA,YAAY,SAAsC;AAE9C,SAAK,SAAS,aAAAA,QAAM,OAAO;AAAA,MACvB,SAAS;AAAA,MACT,SAAS;AAAA,QACL,gBAAgB;AAAA,QAChB,UAAU;AAAA,QACV,iBAAiB,UAAU,SAAS,WAAW,QAAQ,IAAI,cAAc;AAAA,QACzE,GAAG,SAAS;AAAA,MAChB;AAAA,IACJ,CAAC;AAAA,EAEL;AACJ;AAEA,IAAO,oBAAQ;;;ACpBf,IAAM,WAAN,cAAuB,kBAAU;AAAA,EAE7B,MAAM,OAAO,QAAwD;AACjE,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,aAAa,MAAM;AAC3D,UAAI,OAAO,SAAS;AAGpB,aAAO,KAAK;AAAA,IAChB,SAAS,OAAY;AACjB,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,MAAM,OAAO,QAAgD;AACzD,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,oBAAoB,OAAO,SAAS,IAAI,OAAO,WAAW,EAAE;AACpG,YAAM,OAAQ,SAAS;AAGvB,aAAO,KAAK;AAAA,IAChB,SACO,OAAY;AACf,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,MAAM,OAAO,QAAgD;AACzD,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,oBAAoB,OAAO,WAAW,IAAI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AAChC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,gBAAgB,IAAI,sBAAc,OAAO;AAAA,EAClD;AAKJ;AAEA,IAAO,oBAAQ;;;AT/Bf,IAAO,gBAAQ;","names":["axios"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/services/APIClient.ts","../src/services/api-wrappers/Category.ts","../src/services/api-wrappers/CompoundQuery.ts","../src/services/api-wrappers/DataItem.ts","../src/services/api-wrappers/Headless.ts","../src/services/api-wrappers/Reaction.ts","../src/services/api-wrappers/Review.ts","../src/services/api-wrappers/Space.ts","../src/services/GarchiCMS.ts"],"sourcesContent":["import GarchiCMS from \"./services/GarchiCMS\";\n\n\n\nexport default GarchiCMS;\n\n\nexport * from \"./types/index\";\n\n","import axios, { AxiosInstance } from \"axios\";\nimport { GarchiCMSInitOptions } from \"../types\";\n\nclass APIClient {\n\n client: AxiosInstance\n\n\n constructor(options: GarchiCMSInitOptions | null) {\n \n this.client = axios.create({\n baseURL: \"https://garchi.co.uk/api/v2\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\",\n \"Authorization\": `Bearer ${options?.api_key || process.env.GARCHI_API_KEY}`,\n ...options?.headers\n }\n })\n\n }\n}\n\nexport default APIClient;","import { CreateCategoryParams, DeleteCategoryParams, GarchiCategory, UpdateCategoryParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Category extends APIClient {\n\n async create(params: CreateCategoryParams) : Promise<GarchiCategory> {\n try {\n const response = await this.client.post(\"/category\", params);\n let data = response.data as {\n data: GarchiCategory\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(params: DeleteCategoryParams) : Promise<string> {\n try {\n const response = await this.client.post(`/delete/category/${params.space_uid}/${params.category_id}`);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(params: UpdateCategoryParams) : Promise<string> {\n try {\n const response = await this.client.post(`/update/category/${params.category_id}`, {\n space_uid: params.space_uid,\n category: params.category\n });\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getAll() : Promise<GarchiCategory[]> {\n try {\n const response = await this.client.get(\"/categories\");\n const data = response.data as {\n data: GarchiCategory[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Category;","import { CompoundQueryBody, GarchiCategoryAPIResponse, GarchiItemAPIResponse, GarchiReview, ItemsQueryParams, PaginatedResponse } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass CompoundQuery extends APIClient {\n async query(body: CompoundQueryBody, params: ItemsQueryParams) : Promise<GarchiItemAPIResponse | GarchiCategoryAPIResponse | \n PaginatedResponse<GarchiReview>>\n {\n try {\n const response = await this.client.post(`/compound_query`, body, {\n params\n });\n return response.data as GarchiItemAPIResponse | GarchiCategoryAPIResponse | PaginatedResponse<GarchiReview>;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n} \n\nexport default CompoundQuery;","\n\nimport { CreateDataItemParams, CreateMetaInfoParams, DeleteDataItemParams, DeleteMetaInfoParams, FilterItemsByMetaParams, FilterItemsParams, GarchiItem, GarchiItemAPIResponse, GarchiItemMeta, GetAllItemsParams, GetFeaturedItemsParams, GetItemChildrenParams, GetItemParams, GetItemsByIdsParams, GetItemsBySpaceParams, QueryItemsParams, SemanticSearchParams, UpdateDataItemParams, UpdateDataItemResult, UpdateMetaInfoParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass DataItem extends APIClient {\n\n\n async create(params: CreateDataItemParams): Promise<GarchiItem> {\n try {\n const response = await this.client.post(\"/item\", params);\n let data = response.data as {\n data: GarchiItem\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(params: DeleteDataItemParams): Promise<string> {\n try {\n const response = await this.client.post(`/delete/item`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n\n /**\n * Update a data item. For an item that is already published, the update\n * is kept as unpublished changes unless `make_public` is true. Use\n * {@link updateWithStatus} to know which happened.\n *\n * @returns A message saying what happened.\n */\n async update(params: UpdateDataItemParams): Promise<string> {\n return (await this.updateWithStatus(params)).data;\n }\n\n /**\n * Update a data item and learn whether a published item's changes were\n * published or kept as unpublished changes (`has_draft`).\n *\n * Throws the API's error body, such as `{ message }` with status 409 when\n * `make_public` is true but the changes could not be published.\n */\n async updateWithStatus(params: UpdateDataItemParams): Promise<UpdateDataItemResult> {\n try {\n const response = await this.client.post(`/update/item`, params);\n return response.data as UpdateDataItemResult;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async createMetaInfo(params: CreateMetaInfoParams): Promise<GarchiItemMeta[]> {\n try {\n const response = await this.client.post(`/item_meta`, params);\n const data = response.data as {\n data: GarchiItemMeta[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async deleteMetaInfo(params: DeleteMetaInfoParams): Promise<string> {\n try {\n const response = await this.client.post(`/delete/item_meta`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async updateMetaInfo(params: UpdateMetaInfoParams): Promise<string> {\n try {\n const response = await this.client.post(`/update/item_meta`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getBySpace(params: GetItemsBySpaceParams): Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/space/${params.uid}/items`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async semanticSearch(params: SemanticSearchParams): Promise<GarchiItem[]> {\n try {\n const response = await this.client.get(`/items/semantic-search`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async featured(params: GetFeaturedItemsParams) : Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/items/featured`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async get(params: GetItemParams): Promise<GarchiItem> {\n try {\n const response = await this.client.get(`/item/${params.item}`, {\n params: params,\n });\n const data = response.data as GarchiItemAPIResponse\n return data.data[0] as GarchiItem;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n\n async getAll(params: GetAllItemsParams): Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/items`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n\n }\n }\n\n async filter(params: FilterItemsParams) : Promise<GarchiItem[]> {\n try {\n const response = await this.client.post(`/items/filter`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n\n }\n\n async filterByMeta(params: FilterItemsByMetaParams) : Promise<GarchiItem[]> {\n try {\n const response = await this.client.post(`/items/filter/bymeta`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getByIds(params: GetItemsByIdsParams) : Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.post(`/items/byids`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n /**\n * Query the published items of a space with conditions on their fields and\n * metadata, including nested JSON values. See the API docs for the operators.\n */\n async query(params: QueryItemsParams): Promise<GarchiItemAPIResponse> {\n try {\n const { uid, ...body } = params;\n const response = await this.client.post(`/space/${uid}/items/query`, body);\n return response.data as GarchiItemAPIResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n /**\n * The published items inside an item (variants of a product, lessons of a\n * course), in their order. The parent itself must be published.\n */\n async getChildren(params: GetItemChildrenParams): Promise<GarchiItemAPIResponse> {\n try {\n const { uid, item, ...query } = params;\n const response = await this.client.get(`/space/${uid}/items/${encodeURIComponent(String(item))}/children`, {\n params: query\n });\n return response.data as GarchiItemAPIResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\n\nexport default DataItem;","import { BlankSectionRequest, BlankSectionResponse, CreateOrUpdateSectionTemplateParams, CreatePageRequest, CreatePageResponse, GarchiAsset, GarchiPage, GetPageParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Headless extends APIClient {\n\n async getAsset(file_name: string, space_uid: string) : Promise<GarchiAsset> {\n try {\n const response = await this.client.get(`/space/assets/${file_name}`, {\n params: {\n space_uid\n }\n });\n return response.data as GarchiAsset;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getPage(params: GetPageParams) : Promise<GarchiPage> {\n try {\n const response = await this.client.post(`/page`, params);\n return response.data as GarchiPage;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async createOrUpdateSectionTemplates(params: CreateOrUpdateSectionTemplateParams) : Promise<string> {\n try {\n const response = await this.client.post(`/section_template`, params);\n return response.data as string;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async addPage(params: CreatePageRequest) : Promise<CreatePageResponse>\n {\n try {\n const response = await this.client.post(`/space/${params.space_uid}/create_page`, {\n title: params.title,\n path: params.path,\n description: params.description,\n })\n return response.data as CreatePageResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async addBlankSectionToPage(params: BlankSectionRequest) : Promise<BlankSectionResponse>\n {\n try {\n const response = await this.client.post('/page/add_blank_section', {\n section_template_id: params.section_template_id,\n parent_id: params.parent_id,\n page_id: params.page_id,\n })\n return response.data as BlankSectionResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n \n \n}\n\nexport default Headless;","import { GarchiReaction, GarchiReactionCreate } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Reaction extends APIClient {\n async manage(params: GarchiReactionCreate) : Promise<GarchiReaction> {\n try {\n const response = await this.client.post(\"/manage-reaction\", params);\n let data = response.data as {\n data: GarchiReaction\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Reaction;","import { GarchiReview, GarchiReviewCreate, PaginateQueryParams, GarchiReviewUpdate, PaginatedResponse } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Review extends APIClient{\n async create(params: GarchiReviewCreate): Promise<GarchiReview> {\n try {\n const response = await this.client.post('/reviews/item', params);\n const data = response.data as {\n data: GarchiReview\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(params: GarchiReviewUpdate): Promise<string> {\n try {\n const response = await this.client.post('/reviews/edit', params);\n const data = response.data as {\n message: string\n }\n return data.message;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(review_id: number): Promise<string> {\n try {\n const response = await this.client.post(`/reviews/delete`, {\n review_id\n });\n const data = response.data as {\n message: string\n }\n return data.message;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getByItem(item_id: number | string, queryParams: PaginateQueryParams) : Promise<PaginatedResponse<GarchiReview>> {\n try {\n const response = await this.client.get(`/reviews/item/${item_id}`, {\n params: queryParams\n });\n const data = response.data as PaginatedResponse<GarchiReview>;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Review;","import { CreatePageResponse, GarchiCategory, GarchiSpace, GarchiSpaceAPIResponse, GarchiSpaceCreate, PaginatedResponse, PaginateQueryParams, SectionTemplate } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Space extends APIClient {\n \n\n async categories(space_uid: string) : Promise<GarchiCategory[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/categories`);\n const data = response.data as {\n data: GarchiCategory[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getAll(params: PaginateQueryParams) : Promise<GarchiSpaceAPIResponse> {\n try {\n const response = await this.client.get('/spaces', {\n params\n });\n const data = response.data as GarchiSpaceAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n } \n \n async get(space_uid: string) : Promise<GarchiSpace> {\n try {\n const response = await this.client.get(`/space/${space_uid}`);\n const data = response.data as {\n data: GarchiSpace\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async create(params: GarchiSpaceCreate): Promise<GarchiSpace> {\n try {\n const formData = new FormData()\n formData.append('name', params.name)\n if(params.logo) {\n formData.append('logo', params.logo)\n }\n const response = await this.client.post('/space', formData);\n const data = response.data as {\n data: GarchiSpace\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(space_uid: string, params: {\n name?: string,\n logo?: File\n }) : Promise<string> {\n try {\n const formData = new FormData();\n if(params.name) {\n formData.append('name', params.name)\n }\n if(params.logo) {\n formData.append('logo', params.logo)\n }\n const response = await this.client.post(`/update/space/${space_uid}`, formData);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(space_uid: string) : Promise<string> {\n try {\n const response = await this.client.delete(`/delete/space/${space_uid}`);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async listPages(space_uid: string) : Promise<CreatePageResponse[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/pages`);\n const data = response.data\n return data as CreatePageResponse[];\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async listSectionTemplates(space_uid: string) : Promise<SectionTemplate[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/section_templates`);\n const data = response.data\n return data as SectionTemplate[];\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n}\nexport default Space;","import { GarchiCMSInitOptions } from \"../types\";\nimport Category from \"./api-wrappers/Category\";\nimport CompoundQuery from \"./api-wrappers/CompoundQuery\";\nimport DataItem from \"./api-wrappers/DataItem\";\nimport Headless from \"./api-wrappers/Headless\";\nimport Reaction from \"./api-wrappers/Reaction\";\nimport Review from \"./api-wrappers/Review\";\nimport Space from \"./api-wrappers/Space\";\n\n\nclass GarchiCMS {\n\n dataItem: DataItem\n category: Category\n space: Space\n review: Review\n headless: Headless\n reaction: Reaction\n compoundQuery: CompoundQuery\n \n constructor(options: GarchiCMSInitOptions) {\n this.dataItem = new DataItem(options)\n this.category = new Category(options)\n this.space = new Space(options)\n this.review = new Review(options) \n this.headless = new Headless(options)\n this.reaction = new Reaction(options)\n this.compoundQuery = new CompoundQuery(options)\n }\n\n \n\n \n}\n\nexport default GarchiCMS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAqC;AAGrC,IAAM,YAAN,MAAgB;AAAA,EAEZ;AAAA,EAGA,YAAY,SAAsC;AAE9C,SAAK,SAAS,aAAAA,QAAM,OAAO;AAAA,MACvB,SAAS;AAAA,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AAO,SAAS;AACtB,aAAO;AAAA,IACX,SACO,OAAY;AACf,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAEJ;AACA,IAAO,gBAAQ;;;AChHf,IAAM,YAAN,MAAgB;AAAA,EAEZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAY,SAA+B;AACvC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,QAAQ,IAAI,cAAM,OAAO;AAC9B,SAAK,SAAS,IAAI,eAAO,OAAO;AAChC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,gBAAgB,IAAI,sBAAc,OAAO;AAAA,EAClD;AAKJ;AAEA,IAAO,oBAAQ;;;AT/Bf,IAAO,gBAAQ;","names":["axios"]}
package/dist/index.d.cts CHANGED
@@ -182,6 +182,9 @@ type GarchiItemMeta = {
182
182
  type GarchiItem = {
183
183
  item_id: number;
184
184
  slug: string;
185
+ parent_id?: number | null;
186
+ children_count?: number;
187
+ children?: GarchiItem[];
185
188
  sku?: string;
186
189
  agent_description?: string;
187
190
  name: string;
@@ -229,6 +232,7 @@ interface CreateDataItemParams {
229
232
  external_url?: string;
230
233
  slug?: string;
231
234
  agent_description?: string;
235
+ parent_id?: number;
232
236
  }
233
237
  interface DeleteDataItemParams {
234
238
  item_id: number;
@@ -245,9 +249,27 @@ interface UpdateDataItemParams {
245
249
  scratched_price?: number;
246
250
  detail_description?: string;
247
251
  external_url?: string;
252
+ /**
253
+ * true publishes the item. For an item that is already published, an
254
+ * update is kept as unpublished changes unless this is true, which
255
+ * publishes them with the update.
256
+ */
248
257
  make_public?: boolean;
249
258
  slug?: string;
250
259
  agent_description?: string;
260
+ parent_id?: number | null;
261
+ }
262
+ /**
263
+ * The result of updating a data item.
264
+ */
265
+ interface UpdateDataItemResult {
266
+ data: string;
267
+ /**
268
+ * For an item that is already published: true when the update was kept
269
+ * as unpublished changes (visitors still see the published item), false
270
+ * when it was published. Absent for an item that is not published.
271
+ */
272
+ has_draft?: boolean;
251
273
  }
252
274
  type MetaType = "string" | "array" | "url" | "object" | "numeric" | "email" | "date" | "color" | "icon_hero" | "icon_lucid";
253
275
  interface MetaInfo {
@@ -281,6 +303,7 @@ interface ItemsQueryParams extends PaginateQueryParams {
281
303
  order_by?: "asc" | "desc";
282
304
  reactions?: "include" | "exclude";
283
305
  description?: "include" | "exclude";
306
+ children?: "include" | "exclude";
284
307
  }
285
308
  interface GetItemsBySpaceParams extends ItemsQueryParams {
286
309
  uid: string;
@@ -290,14 +313,54 @@ interface SemanticSearchParams {
290
313
  threshold?: number;
291
314
  reactions?: "include" | "exclude";
292
315
  description?: "include" | "exclude";
316
+ children?: "include" | "exclude";
293
317
  }
294
318
  interface GetFeaturedItemsParams {
295
319
  reactions?: "include" | "exclude";
296
320
  description?: "include" | "exclude";
321
+ children?: "include" | "exclude";
297
322
  }
298
323
  interface GetItemParams {
299
324
  item: string | number;
300
325
  reactions?: "include" | "exclude";
326
+ children?: "include" | "exclude";
327
+ }
328
+ interface GetItemChildrenParams extends PaginateQueryParams {
329
+ uid: string;
330
+ item: string | number;
331
+ reactions?: "include" | "exclude";
332
+ description?: "include" | "exclude";
333
+ children?: "include" | "exclude";
334
+ }
335
+ /** Operators of the item query endpoint. */
336
+ type ItemQueryOperator = "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "between" | "in" | "not_in" | "contains" | "starts_with" | "exists" | "not_exists" | "has_all";
337
+ /**
338
+ * Item fields, or `meta.<key>` with dots into JSON objects (e.g. `meta.specs.weight`).
339
+ * `parent_id` finds the items inside an item; `not_exists` on it finds items on their own.
340
+ */
341
+ type ItemQueryField = "item_id" | "name" | "slug" | "sku" | "price" | "scratched_price" | "stock" | "created" | "updated" | "category" | "type" | "parent_id" | "position" | `meta.${string}`;
342
+ interface ItemQueryCondition {
343
+ field: ItemQueryField;
344
+ op: ItemQueryOperator;
345
+ value?: string | number | boolean | Array<string | number | boolean>;
346
+ }
347
+ /** A condition, a group where every entry must match, or a group where at least one must. */
348
+ type ItemQueryWhere = ItemQueryCondition | {
349
+ all: ItemQueryWhere[];
350
+ } | {
351
+ any: ItemQueryWhere[];
352
+ } | ItemQueryWhere[];
353
+ interface ItemQuerySort {
354
+ field: Exclude<ItemQueryField, "category" | "type">;
355
+ direction?: "asc" | "desc";
356
+ }
357
+ interface QueryItemsParams extends PaginateQueryParams {
358
+ uid: string;
359
+ where?: ItemQueryWhere;
360
+ sort?: ItemQuerySort[];
361
+ reactions?: "include" | "exclude";
362
+ description?: "include" | "exclude";
363
+ children?: "include" | "exclude";
301
364
  }
302
365
  interface GetAllItemsParams extends ItemsQueryParams {
303
366
  search_keyword?: string;
@@ -376,7 +439,22 @@ declare class CompoundQuery extends APIClient {
376
439
  declare class DataItem extends APIClient {
377
440
  create(params: CreateDataItemParams): Promise<GarchiItem>;
378
441
  delete(params: DeleteDataItemParams): Promise<string>;
442
+ /**
443
+ * Update a data item. For an item that is already published, the update
444
+ * is kept as unpublished changes unless `make_public` is true. Use
445
+ * {@link updateWithStatus} to know which happened.
446
+ *
447
+ * @returns A message saying what happened.
448
+ */
379
449
  update(params: UpdateDataItemParams): Promise<string>;
450
+ /**
451
+ * Update a data item and learn whether a published item's changes were
452
+ * published or kept as unpublished changes (`has_draft`).
453
+ *
454
+ * Throws the API's error body, such as `{ message }` with status 409 when
455
+ * `make_public` is true but the changes could not be published.
456
+ */
457
+ updateWithStatus(params: UpdateDataItemParams): Promise<UpdateDataItemResult>;
380
458
  createMetaInfo(params: CreateMetaInfoParams): Promise<GarchiItemMeta[]>;
381
459
  deleteMetaInfo(params: DeleteMetaInfoParams): Promise<string>;
382
460
  updateMetaInfo(params: UpdateMetaInfoParams): Promise<string>;
@@ -388,6 +466,16 @@ declare class DataItem extends APIClient {
388
466
  filter(params: FilterItemsParams): Promise<GarchiItem[]>;
389
467
  filterByMeta(params: FilterItemsByMetaParams): Promise<GarchiItem[]>;
390
468
  getByIds(params: GetItemsByIdsParams): Promise<GarchiItemAPIResponse>;
469
+ /**
470
+ * Query the published items of a space with conditions on their fields and
471
+ * metadata, including nested JSON values. See the API docs for the operators.
472
+ */
473
+ query(params: QueryItemsParams): Promise<GarchiItemAPIResponse>;
474
+ /**
475
+ * The published items inside an item (variants of a product, lessons of a
476
+ * course), in their order. The parent itself must be published.
477
+ */
478
+ getChildren(params: GetItemChildrenParams): Promise<GarchiItemAPIResponse>;
391
479
  }
392
480
 
393
481
  declare class Headless extends APIClient {
@@ -434,4 +522,4 @@ declare class GarchiCMS {
434
522
  constructor(options: GarchiCMSInitOptions);
435
523
  }
436
524
 
437
- export { type BlankSectionRequest, type BlankSectionResponse, type CategoryFields, type CompoundQueryBody, type ConditionType, type CreateCategoryParams, type CreateDataItemParams, type CreateMetaInfoParams, type CreateOrUpdateSectionTemplateParams, type CreatePageRequest, type CreatePageResponse, type DatasetType, type DeleteCategoryParams, type DeleteDataItemParams, type DeleteMetaInfoParams, type FilterItemsBodyParams, type FilterItemsByMetaBodyParams, type FilterItemsByMetaParams, type FilterItemsParams, type GarchiAsset, type GarchiAttribute, type GarchiAttributeOption, type GarchiCMSInitOptions, type GarchiCategory, type GarchiCategoryAPIResponse, type GarchiItem, type GarchiItemAPIResponse, type GarchiItemMeta, type GarchiPage, type GarchiReaction, type GarchiReactionCreate, type GarchiReview, type GarchiReviewCreate, type GarchiReviewUpdate, type GarchiSection, type GarchiSpace, type GarchiSpaceAPIResponse, type GarchiSpaceCreate, type GetAllItemsParams, type GetFeaturedItemsParams, type GetItemParams, type GetItemsByIdsBodyParams, type GetItemsByIdsParams, type GetItemsBySpaceParams, type GetPageParams, type ItemFields, type ItemsQueryParams, type LogicType, type MetaFilter, type MetaFilterOperator, type MetaInfo, type MetaType, type PaginateQueryParams, type PaginatedResponse, type PaginationLinks, type PaginationMeta, type ReviewFields, type SectionPropType, type SectionTemplate, type SectionTemplateProp, type SemanticSearchParams, type UpdateCategoryParams, type UpdateDataItemParams, type UpdateMetaInfoParams, GarchiCMS as default };
525
+ export { type BlankSectionRequest, type BlankSectionResponse, type CategoryFields, type CompoundQueryBody, type ConditionType, type CreateCategoryParams, type CreateDataItemParams, type CreateMetaInfoParams, type CreateOrUpdateSectionTemplateParams, type CreatePageRequest, type CreatePageResponse, type DatasetType, type DeleteCategoryParams, type DeleteDataItemParams, type DeleteMetaInfoParams, type FilterItemsBodyParams, type FilterItemsByMetaBodyParams, type FilterItemsByMetaParams, type FilterItemsParams, type GarchiAsset, type GarchiAttribute, type GarchiAttributeOption, type GarchiCMSInitOptions, type GarchiCategory, type GarchiCategoryAPIResponse, type GarchiItem, type GarchiItemAPIResponse, type GarchiItemMeta, type GarchiPage, type GarchiReaction, type GarchiReactionCreate, type GarchiReview, type GarchiReviewCreate, type GarchiReviewUpdate, type GarchiSection, type GarchiSpace, type GarchiSpaceAPIResponse, type GarchiSpaceCreate, type GetAllItemsParams, type GetFeaturedItemsParams, type GetItemChildrenParams, type GetItemParams, type GetItemsByIdsBodyParams, type GetItemsByIdsParams, type GetItemsBySpaceParams, type GetPageParams, type ItemFields, type ItemQueryCondition, type ItemQueryField, type ItemQueryOperator, type ItemQuerySort, type ItemQueryWhere, type ItemsQueryParams, type LogicType, type MetaFilter, type MetaFilterOperator, type MetaInfo, type MetaType, type PaginateQueryParams, type PaginatedResponse, type PaginationLinks, type PaginationMeta, type QueryItemsParams, type ReviewFields, type SectionPropType, type SectionTemplate, type SectionTemplateProp, type SemanticSearchParams, type UpdateCategoryParams, type UpdateDataItemParams, type UpdateDataItemResult, type UpdateMetaInfoParams, GarchiCMS as default };
package/dist/index.d.ts CHANGED
@@ -182,6 +182,9 @@ type GarchiItemMeta = {
182
182
  type GarchiItem = {
183
183
  item_id: number;
184
184
  slug: string;
185
+ parent_id?: number | null;
186
+ children_count?: number;
187
+ children?: GarchiItem[];
185
188
  sku?: string;
186
189
  agent_description?: string;
187
190
  name: string;
@@ -229,6 +232,7 @@ interface CreateDataItemParams {
229
232
  external_url?: string;
230
233
  slug?: string;
231
234
  agent_description?: string;
235
+ parent_id?: number;
232
236
  }
233
237
  interface DeleteDataItemParams {
234
238
  item_id: number;
@@ -245,9 +249,27 @@ interface UpdateDataItemParams {
245
249
  scratched_price?: number;
246
250
  detail_description?: string;
247
251
  external_url?: string;
252
+ /**
253
+ * true publishes the item. For an item that is already published, an
254
+ * update is kept as unpublished changes unless this is true, which
255
+ * publishes them with the update.
256
+ */
248
257
  make_public?: boolean;
249
258
  slug?: string;
250
259
  agent_description?: string;
260
+ parent_id?: number | null;
261
+ }
262
+ /**
263
+ * The result of updating a data item.
264
+ */
265
+ interface UpdateDataItemResult {
266
+ data: string;
267
+ /**
268
+ * For an item that is already published: true when the update was kept
269
+ * as unpublished changes (visitors still see the published item), false
270
+ * when it was published. Absent for an item that is not published.
271
+ */
272
+ has_draft?: boolean;
251
273
  }
252
274
  type MetaType = "string" | "array" | "url" | "object" | "numeric" | "email" | "date" | "color" | "icon_hero" | "icon_lucid";
253
275
  interface MetaInfo {
@@ -281,6 +303,7 @@ interface ItemsQueryParams extends PaginateQueryParams {
281
303
  order_by?: "asc" | "desc";
282
304
  reactions?: "include" | "exclude";
283
305
  description?: "include" | "exclude";
306
+ children?: "include" | "exclude";
284
307
  }
285
308
  interface GetItemsBySpaceParams extends ItemsQueryParams {
286
309
  uid: string;
@@ -290,14 +313,54 @@ interface SemanticSearchParams {
290
313
  threshold?: number;
291
314
  reactions?: "include" | "exclude";
292
315
  description?: "include" | "exclude";
316
+ children?: "include" | "exclude";
293
317
  }
294
318
  interface GetFeaturedItemsParams {
295
319
  reactions?: "include" | "exclude";
296
320
  description?: "include" | "exclude";
321
+ children?: "include" | "exclude";
297
322
  }
298
323
  interface GetItemParams {
299
324
  item: string | number;
300
325
  reactions?: "include" | "exclude";
326
+ children?: "include" | "exclude";
327
+ }
328
+ interface GetItemChildrenParams extends PaginateQueryParams {
329
+ uid: string;
330
+ item: string | number;
331
+ reactions?: "include" | "exclude";
332
+ description?: "include" | "exclude";
333
+ children?: "include" | "exclude";
334
+ }
335
+ /** Operators of the item query endpoint. */
336
+ type ItemQueryOperator = "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "between" | "in" | "not_in" | "contains" | "starts_with" | "exists" | "not_exists" | "has_all";
337
+ /**
338
+ * Item fields, or `meta.<key>` with dots into JSON objects (e.g. `meta.specs.weight`).
339
+ * `parent_id` finds the items inside an item; `not_exists` on it finds items on their own.
340
+ */
341
+ type ItemQueryField = "item_id" | "name" | "slug" | "sku" | "price" | "scratched_price" | "stock" | "created" | "updated" | "category" | "type" | "parent_id" | "position" | `meta.${string}`;
342
+ interface ItemQueryCondition {
343
+ field: ItemQueryField;
344
+ op: ItemQueryOperator;
345
+ value?: string | number | boolean | Array<string | number | boolean>;
346
+ }
347
+ /** A condition, a group where every entry must match, or a group where at least one must. */
348
+ type ItemQueryWhere = ItemQueryCondition | {
349
+ all: ItemQueryWhere[];
350
+ } | {
351
+ any: ItemQueryWhere[];
352
+ } | ItemQueryWhere[];
353
+ interface ItemQuerySort {
354
+ field: Exclude<ItemQueryField, "category" | "type">;
355
+ direction?: "asc" | "desc";
356
+ }
357
+ interface QueryItemsParams extends PaginateQueryParams {
358
+ uid: string;
359
+ where?: ItemQueryWhere;
360
+ sort?: ItemQuerySort[];
361
+ reactions?: "include" | "exclude";
362
+ description?: "include" | "exclude";
363
+ children?: "include" | "exclude";
301
364
  }
302
365
  interface GetAllItemsParams extends ItemsQueryParams {
303
366
  search_keyword?: string;
@@ -376,7 +439,22 @@ declare class CompoundQuery extends APIClient {
376
439
  declare class DataItem extends APIClient {
377
440
  create(params: CreateDataItemParams): Promise<GarchiItem>;
378
441
  delete(params: DeleteDataItemParams): Promise<string>;
442
+ /**
443
+ * Update a data item. For an item that is already published, the update
444
+ * is kept as unpublished changes unless `make_public` is true. Use
445
+ * {@link updateWithStatus} to know which happened.
446
+ *
447
+ * @returns A message saying what happened.
448
+ */
379
449
  update(params: UpdateDataItemParams): Promise<string>;
450
+ /**
451
+ * Update a data item and learn whether a published item's changes were
452
+ * published or kept as unpublished changes (`has_draft`).
453
+ *
454
+ * Throws the API's error body, such as `{ message }` with status 409 when
455
+ * `make_public` is true but the changes could not be published.
456
+ */
457
+ updateWithStatus(params: UpdateDataItemParams): Promise<UpdateDataItemResult>;
380
458
  createMetaInfo(params: CreateMetaInfoParams): Promise<GarchiItemMeta[]>;
381
459
  deleteMetaInfo(params: DeleteMetaInfoParams): Promise<string>;
382
460
  updateMetaInfo(params: UpdateMetaInfoParams): Promise<string>;
@@ -388,6 +466,16 @@ declare class DataItem extends APIClient {
388
466
  filter(params: FilterItemsParams): Promise<GarchiItem[]>;
389
467
  filterByMeta(params: FilterItemsByMetaParams): Promise<GarchiItem[]>;
390
468
  getByIds(params: GetItemsByIdsParams): Promise<GarchiItemAPIResponse>;
469
+ /**
470
+ * Query the published items of a space with conditions on their fields and
471
+ * metadata, including nested JSON values. See the API docs for the operators.
472
+ */
473
+ query(params: QueryItemsParams): Promise<GarchiItemAPIResponse>;
474
+ /**
475
+ * The published items inside an item (variants of a product, lessons of a
476
+ * course), in their order. The parent itself must be published.
477
+ */
478
+ getChildren(params: GetItemChildrenParams): Promise<GarchiItemAPIResponse>;
391
479
  }
392
480
 
393
481
  declare class Headless extends APIClient {
@@ -434,4 +522,4 @@ declare class GarchiCMS {
434
522
  constructor(options: GarchiCMSInitOptions);
435
523
  }
436
524
 
437
- export { type BlankSectionRequest, type BlankSectionResponse, type CategoryFields, type CompoundQueryBody, type ConditionType, type CreateCategoryParams, type CreateDataItemParams, type CreateMetaInfoParams, type CreateOrUpdateSectionTemplateParams, type CreatePageRequest, type CreatePageResponse, type DatasetType, type DeleteCategoryParams, type DeleteDataItemParams, type DeleteMetaInfoParams, type FilterItemsBodyParams, type FilterItemsByMetaBodyParams, type FilterItemsByMetaParams, type FilterItemsParams, type GarchiAsset, type GarchiAttribute, type GarchiAttributeOption, type GarchiCMSInitOptions, type GarchiCategory, type GarchiCategoryAPIResponse, type GarchiItem, type GarchiItemAPIResponse, type GarchiItemMeta, type GarchiPage, type GarchiReaction, type GarchiReactionCreate, type GarchiReview, type GarchiReviewCreate, type GarchiReviewUpdate, type GarchiSection, type GarchiSpace, type GarchiSpaceAPIResponse, type GarchiSpaceCreate, type GetAllItemsParams, type GetFeaturedItemsParams, type GetItemParams, type GetItemsByIdsBodyParams, type GetItemsByIdsParams, type GetItemsBySpaceParams, type GetPageParams, type ItemFields, type ItemsQueryParams, type LogicType, type MetaFilter, type MetaFilterOperator, type MetaInfo, type MetaType, type PaginateQueryParams, type PaginatedResponse, type PaginationLinks, type PaginationMeta, type ReviewFields, type SectionPropType, type SectionTemplate, type SectionTemplateProp, type SemanticSearchParams, type UpdateCategoryParams, type UpdateDataItemParams, type UpdateMetaInfoParams, GarchiCMS as default };
525
+ export { type BlankSectionRequest, type BlankSectionResponse, type CategoryFields, type CompoundQueryBody, type ConditionType, type CreateCategoryParams, type CreateDataItemParams, type CreateMetaInfoParams, type CreateOrUpdateSectionTemplateParams, type CreatePageRequest, type CreatePageResponse, type DatasetType, type DeleteCategoryParams, type DeleteDataItemParams, type DeleteMetaInfoParams, type FilterItemsBodyParams, type FilterItemsByMetaBodyParams, type FilterItemsByMetaParams, type FilterItemsParams, type GarchiAsset, type GarchiAttribute, type GarchiAttributeOption, type GarchiCMSInitOptions, type GarchiCategory, type GarchiCategoryAPIResponse, type GarchiItem, type GarchiItemAPIResponse, type GarchiItemMeta, type GarchiPage, type GarchiReaction, type GarchiReactionCreate, type GarchiReview, type GarchiReviewCreate, type GarchiReviewUpdate, type GarchiSection, type GarchiSpace, type GarchiSpaceAPIResponse, type GarchiSpaceCreate, type GetAllItemsParams, type GetFeaturedItemsParams, type GetItemChildrenParams, type GetItemParams, type GetItemsByIdsBodyParams, type GetItemsByIdsParams, type GetItemsBySpaceParams, type GetPageParams, type ItemFields, type ItemQueryCondition, type ItemQueryField, type ItemQueryOperator, type ItemQuerySort, type ItemQueryWhere, type ItemsQueryParams, type LogicType, type MetaFilter, type MetaFilterOperator, type MetaInfo, type MetaType, type PaginateQueryParams, type PaginatedResponse, type PaginationLinks, type PaginationMeta, type QueryItemsParams, type ReviewFields, type SectionPropType, type SectionTemplate, type SectionTemplateProp, type SemanticSearchParams, type UpdateCategoryParams, type UpdateDataItemParams, type UpdateDataItemResult, type UpdateMetaInfoParams, GarchiCMS as default };
package/dist/index.js CHANGED
@@ -95,11 +95,27 @@ var DataItem = class extends APIClient_default {
95
95
  throw error.response?.data || new Error("Network Error");
96
96
  }
97
97
  }
98
+ /**
99
+ * Update a data item. For an item that is already published, the update
100
+ * is kept as unpublished changes unless `make_public` is true. Use
101
+ * {@link updateWithStatus} to know which happened.
102
+ *
103
+ * @returns A message saying what happened.
104
+ */
98
105
  async update(params) {
106
+ return (await this.updateWithStatus(params)).data;
107
+ }
108
+ /**
109
+ * Update a data item and learn whether a published item's changes were
110
+ * published or kept as unpublished changes (`has_draft`).
111
+ *
112
+ * Throws the API's error body, such as `{ message }` with status 409 when
113
+ * `make_public` is true but the changes could not be published.
114
+ */
115
+ async updateWithStatus(params) {
99
116
  try {
100
117
  const response = await this.client.post(`/update/item`, params);
101
- const data = response.data;
102
- return data.data;
118
+ return response.data;
103
119
  } catch (error) {
104
120
  throw error.response?.data || new Error("Network Error");
105
121
  }
@@ -219,6 +235,34 @@ var DataItem = class extends APIClient_default {
219
235
  throw error.response?.data || new Error("Network Error");
220
236
  }
221
237
  }
238
+ /**
239
+ * Query the published items of a space with conditions on their fields and
240
+ * metadata, including nested JSON values. See the API docs for the operators.
241
+ */
242
+ async query(params) {
243
+ try {
244
+ const { uid, ...body } = params;
245
+ const response = await this.client.post(`/space/${uid}/items/query`, body);
246
+ return response.data;
247
+ } catch (error) {
248
+ throw error.response?.data || new Error("Network Error");
249
+ }
250
+ }
251
+ /**
252
+ * The published items inside an item (variants of a product, lessons of a
253
+ * course), in their order. The parent itself must be published.
254
+ */
255
+ async getChildren(params) {
256
+ try {
257
+ const { uid, item, ...query } = params;
258
+ const response = await this.client.get(`/space/${uid}/items/${encodeURIComponent(String(item))}/children`, {
259
+ params: query
260
+ });
261
+ return response.data;
262
+ } catch (error) {
263
+ throw error.response?.data || new Error("Network Error");
264
+ }
265
+ }
222
266
  };
223
267
  var DataItem_default = DataItem;
224
268
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/services/APIClient.ts","../src/services/api-wrappers/Category.ts","../src/services/api-wrappers/CompoundQuery.ts","../src/services/api-wrappers/DataItem.ts","../src/services/api-wrappers/Headless.ts","../src/services/api-wrappers/Reaction.ts","../src/services/api-wrappers/Review.ts","../src/services/api-wrappers/Space.ts","../src/services/GarchiCMS.ts","../src/index.ts"],"sourcesContent":["import axios, { AxiosInstance } from \"axios\";\nimport { GarchiCMSInitOptions } from \"../types\";\n\nclass APIClient {\n\n client: AxiosInstance\n\n\n constructor(options: GarchiCMSInitOptions | null) {\n \n this.client = axios.create({\n baseURL: \"https://garchi.co.uk/api/v2\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\",\n \"Authorization\": `Bearer ${options?.api_key || process.env.GARCHI_API_KEY}`,\n ...options?.headers\n }\n })\n\n }\n}\n\nexport default APIClient;","import { CreateCategoryParams, DeleteCategoryParams, GarchiCategory, UpdateCategoryParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Category extends APIClient {\n\n async create(params: CreateCategoryParams) : Promise<GarchiCategory> {\n try {\n const response = await this.client.post(\"/category\", params);\n let data = response.data as {\n data: GarchiCategory\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(params: DeleteCategoryParams) : Promise<string> {\n try {\n const response = await this.client.post(`/delete/category/${params.space_uid}/${params.category_id}`);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(params: UpdateCategoryParams) : Promise<string> {\n try {\n const response = await this.client.post(`/update/category/${params.category_id}`, {\n space_uid: params.space_uid,\n category: params.category\n });\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getAll() : Promise<GarchiCategory[]> {\n try {\n const response = await this.client.get(\"/categories\");\n const data = response.data as {\n data: GarchiCategory[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Category;","import { CompoundQueryBody, GarchiCategoryAPIResponse, GarchiItemAPIResponse, GarchiReview, ItemsQueryParams, PaginatedResponse } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass CompoundQuery extends APIClient {\n async query(body: CompoundQueryBody, params: ItemsQueryParams) : Promise<GarchiItemAPIResponse | GarchiCategoryAPIResponse | \n PaginatedResponse<GarchiReview>>\n {\n try {\n const response = await this.client.post(`/compound_query`, body, {\n params\n });\n return response.data as GarchiItemAPIResponse | GarchiCategoryAPIResponse | PaginatedResponse<GarchiReview>;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n} \n\nexport default CompoundQuery;","\n\nimport { CreateDataItemParams, CreateMetaInfoParams, DeleteDataItemParams, DeleteMetaInfoParams, FilterItemsByMetaParams, FilterItemsParams, GarchiItem, GarchiItemAPIResponse, GarchiItemMeta, GetAllItemsParams, GetFeaturedItemsParams, GetItemParams, GetItemsByIdsParams, GetItemsBySpaceParams, SemanticSearchParams, UpdateDataItemParams, UpdateMetaInfoParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass DataItem extends APIClient {\n\n\n async create(params: CreateDataItemParams): Promise<GarchiItem> {\n try {\n const response = await this.client.post(\"/item\", params);\n let data = response.data as {\n data: GarchiItem\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(params: DeleteDataItemParams): Promise<string> {\n try {\n const response = await this.client.post(`/delete/item`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n\n async update(params: UpdateDataItemParams): Promise<string> {\n try {\n const response = await this.client.post(`/update/item`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async createMetaInfo(params: CreateMetaInfoParams): Promise<GarchiItemMeta[]> {\n try {\n const response = await this.client.post(`/item_meta`, params);\n const data = response.data as {\n data: GarchiItemMeta[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async deleteMetaInfo(params: DeleteMetaInfoParams): Promise<string> {\n try {\n const response = await this.client.post(`/delete/item_meta`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async updateMetaInfo(params: UpdateMetaInfoParams): Promise<string> {\n try {\n const response = await this.client.post(`/update/item_meta`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getBySpace(params: GetItemsBySpaceParams): Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/space/${params.uid}/items`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async semanticSearch(params: SemanticSearchParams): Promise<GarchiItem[]> {\n try {\n const response = await this.client.get(`/items/semantic-search`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async featured(params: GetFeaturedItemsParams) : Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/items/featured`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async get(params: GetItemParams): Promise<GarchiItem> {\n try {\n const response = await this.client.get(`/item/${params.item}`, {\n params: params,\n });\n const data = response.data as GarchiItemAPIResponse\n return data.data[0] as GarchiItem;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n\n async getAll(params: GetAllItemsParams): Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/items`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n\n }\n }\n\n async filter(params: FilterItemsParams) : Promise<GarchiItem[]> {\n try {\n const response = await this.client.post(`/items/filter`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n\n }\n\n async filterByMeta(params: FilterItemsByMetaParams) : Promise<GarchiItem[]> {\n try {\n const response = await this.client.post(`/items/filter/bymeta`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getByIds(params: GetItemsByIdsParams) : Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.post(`/items/byids`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\n\nexport default DataItem;","import { BlankSectionRequest, BlankSectionResponse, CreateOrUpdateSectionTemplateParams, CreatePageRequest, CreatePageResponse, GarchiAsset, GarchiPage, GetPageParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Headless extends APIClient {\n\n async getAsset(file_name: string, space_uid: string) : Promise<GarchiAsset> {\n try {\n const response = await this.client.get(`/space/assets/${file_name}`, {\n params: {\n space_uid\n }\n });\n return response.data as GarchiAsset;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getPage(params: GetPageParams) : Promise<GarchiPage> {\n try {\n const response = await this.client.post(`/page`, params);\n return response.data as GarchiPage;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async createOrUpdateSectionTemplates(params: CreateOrUpdateSectionTemplateParams) : Promise<string> {\n try {\n const response = await this.client.post(`/section_template`, params);\n return response.data as string;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async addPage(params: CreatePageRequest) : Promise<CreatePageResponse>\n {\n try {\n const response = await this.client.post(`/space/${params.space_uid}/create_page`, {\n title: params.title,\n path: params.path,\n description: params.description,\n })\n return response.data as CreatePageResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async addBlankSectionToPage(params: BlankSectionRequest) : Promise<BlankSectionResponse>\n {\n try {\n const response = await this.client.post('/page/add_blank_section', {\n section_template_id: params.section_template_id,\n parent_id: params.parent_id,\n page_id: params.page_id,\n })\n return response.data as BlankSectionResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n \n \n}\n\nexport default Headless;","import { GarchiReaction, GarchiReactionCreate } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Reaction extends APIClient {\n async manage(params: GarchiReactionCreate) : Promise<GarchiReaction> {\n try {\n const response = await this.client.post(\"/manage-reaction\", params);\n let data = response.data as {\n data: GarchiReaction\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Reaction;","import { GarchiReview, GarchiReviewCreate, PaginateQueryParams, GarchiReviewUpdate, PaginatedResponse } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Review extends APIClient{\n async create(params: GarchiReviewCreate): Promise<GarchiReview> {\n try {\n const response = await this.client.post('/reviews/item', params);\n const data = response.data as {\n data: GarchiReview\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(params: GarchiReviewUpdate): Promise<string> {\n try {\n const response = await this.client.post('/reviews/edit', params);\n const data = response.data as {\n message: string\n }\n return data.message;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(review_id: number): Promise<string> {\n try {\n const response = await this.client.post(`/reviews/delete`, {\n review_id\n });\n const data = response.data as {\n message: string\n }\n return data.message;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getByItem(item_id: number | string, queryParams: PaginateQueryParams) : Promise<PaginatedResponse<GarchiReview>> {\n try {\n const response = await this.client.get(`/reviews/item/${item_id}`, {\n params: queryParams\n });\n const data = response.data as PaginatedResponse<GarchiReview>;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Review;","import { CreatePageResponse, GarchiCategory, GarchiSpace, GarchiSpaceAPIResponse, GarchiSpaceCreate, PaginatedResponse, PaginateQueryParams, SectionTemplate } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Space extends APIClient {\n \n\n async categories(space_uid: string) : Promise<GarchiCategory[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/categories`);\n const data = response.data as {\n data: GarchiCategory[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getAll(params: PaginateQueryParams) : Promise<GarchiSpaceAPIResponse> {\n try {\n const response = await this.client.get('/spaces', {\n params\n });\n const data = response.data as GarchiSpaceAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n } \n \n async get(space_uid: string) : Promise<GarchiSpace> {\n try {\n const response = await this.client.get(`/space/${space_uid}`);\n const data = response.data as {\n data: GarchiSpace\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async create(params: GarchiSpaceCreate): Promise<GarchiSpace> {\n try {\n const formData = new FormData()\n formData.append('name', params.name)\n if(params.logo) {\n formData.append('logo', params.logo)\n }\n const response = await this.client.post('/space', formData);\n const data = response.data as {\n data: GarchiSpace\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(space_uid: string, params: {\n name?: string,\n logo?: File\n }) : Promise<string> {\n try {\n const formData = new FormData();\n if(params.name) {\n formData.append('name', params.name)\n }\n if(params.logo) {\n formData.append('logo', params.logo)\n }\n const response = await this.client.post(`/update/space/${space_uid}`, formData);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(space_uid: string) : Promise<string> {\n try {\n const response = await this.client.delete(`/delete/space/${space_uid}`);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async listPages(space_uid: string) : Promise<CreatePageResponse[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/pages`);\n const data = response.data\n return data as CreatePageResponse[];\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async listSectionTemplates(space_uid: string) : Promise<SectionTemplate[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/section_templates`);\n const data = response.data\n return data as SectionTemplate[];\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n}\nexport default Space;","import { GarchiCMSInitOptions } from \"../types\";\nimport Category from \"./api-wrappers/Category\";\nimport CompoundQuery from \"./api-wrappers/CompoundQuery\";\nimport DataItem from \"./api-wrappers/DataItem\";\nimport Headless from \"./api-wrappers/Headless\";\nimport Reaction from \"./api-wrappers/Reaction\";\nimport Review from \"./api-wrappers/Review\";\nimport Space from \"./api-wrappers/Space\";\n\n\nclass GarchiCMS {\n\n dataItem: DataItem\n category: Category\n space: Space\n review: Review\n headless: Headless\n reaction: Reaction\n compoundQuery: CompoundQuery\n \n constructor(options: GarchiCMSInitOptions) {\n this.dataItem = new DataItem(options)\n this.category = new Category(options)\n this.space = new Space(options)\n this.review = new Review(options) \n this.headless = new Headless(options)\n this.reaction = new Reaction(options)\n this.compoundQuery = new CompoundQuery(options)\n }\n\n \n\n \n}\n\nexport default GarchiCMS","import GarchiCMS from \"./services/GarchiCMS\";\n\n\n\nexport default GarchiCMS;\n\n\nexport * from \"./types/index\";\n\n"],"mappings":";AAAA,OAAO,WAA8B;AAGrC,IAAM,YAAN,MAAgB;AAAA,EAEZ;AAAA,EAGA,YAAY,SAAsC;AAE9C,SAAK,SAAS,MAAM,OAAO;AAAA,MACvB,SAAS;AAAA,MACT,SAAS;AAAA,QACL,gBAAgB;AAAA,QAChB,UAAU;AAAA,QACV,iBAAiB,UAAU,SAAS,WAAW,QAAQ,IAAI,cAAc;AAAA,QACzE,GAAG,SAAS;AAAA,MAChB;AAAA,IACJ,CAAC;AAAA,EAEL;AACJ;AAEA,IAAO,oBAAQ;;;ACpBf,IAAM,WAAN,cAAuB,kBAAU;AAAA,EAE7B,MAAM,OAAO,QAAwD;AACjE,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,aAAa,MAAM;AAC3D,UAAI,OAAO,SAAS;AAGpB,aAAO,KAAK;AAAA,IAChB,SAAS,OAAY;AACjB,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,MAAM,OAAO,QAAgD;AACzD,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,oBAAoB,OAAO,SAAS,IAAI,OAAO,WAAW,EAAE;AACpG,YAAM,OAAQ,SAAS;AAGvB,aAAO,KAAK;AAAA,IAChB,SACO,OAAY;AACf,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,MAAM,OAAO,QAAgD;AACzD,Q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C,SAAK,QAAQ,IAAI,cAAM,OAAO;AAC9B,SAAK,SAAS,IAAI,eAAO,OAAO;AAChC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,gBAAgB,IAAI,sBAAc,OAAO;AAAA,EAClD;AAKJ;AAEA,IAAO,oBAAQ;;;AC/Bf,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/services/APIClient.ts","../src/services/api-wrappers/Category.ts","../src/services/api-wrappers/CompoundQuery.ts","../src/services/api-wrappers/DataItem.ts","../src/services/api-wrappers/Headless.ts","../src/services/api-wrappers/Reaction.ts","../src/services/api-wrappers/Review.ts","../src/services/api-wrappers/Space.ts","../src/services/GarchiCMS.ts","../src/index.ts"],"sourcesContent":["import axios, { AxiosInstance } from \"axios\";\nimport { GarchiCMSInitOptions } from \"../types\";\n\nclass APIClient {\n\n client: AxiosInstance\n\n\n constructor(options: GarchiCMSInitOptions | null) {\n \n this.client = axios.create({\n baseURL: \"https://garchi.co.uk/api/v2\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\",\n \"Authorization\": `Bearer ${options?.api_key || process.env.GARCHI_API_KEY}`,\n ...options?.headers\n }\n })\n\n }\n}\n\nexport default APIClient;","import { CreateCategoryParams, DeleteCategoryParams, GarchiCategory, UpdateCategoryParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Category extends APIClient {\n\n async create(params: CreateCategoryParams) : Promise<GarchiCategory> {\n try {\n const response = await this.client.post(\"/category\", params);\n let data = response.data as {\n data: GarchiCategory\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(params: DeleteCategoryParams) : Promise<string> {\n try {\n const response = await this.client.post(`/delete/category/${params.space_uid}/${params.category_id}`);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(params: UpdateCategoryParams) : Promise<string> {\n try {\n const response = await this.client.post(`/update/category/${params.category_id}`, {\n space_uid: params.space_uid,\n category: params.category\n });\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getAll() : Promise<GarchiCategory[]> {\n try {\n const response = await this.client.get(\"/categories\");\n const data = response.data as {\n data: GarchiCategory[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Category;","import { CompoundQueryBody, GarchiCategoryAPIResponse, GarchiItemAPIResponse, GarchiReview, ItemsQueryParams, PaginatedResponse } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass CompoundQuery extends APIClient {\n async query(body: CompoundQueryBody, params: ItemsQueryParams) : Promise<GarchiItemAPIResponse | GarchiCategoryAPIResponse | \n PaginatedResponse<GarchiReview>>\n {\n try {\n const response = await this.client.post(`/compound_query`, body, {\n params\n });\n return response.data as GarchiItemAPIResponse | GarchiCategoryAPIResponse | PaginatedResponse<GarchiReview>;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n} \n\nexport default CompoundQuery;","\n\nimport { CreateDataItemParams, CreateMetaInfoParams, DeleteDataItemParams, DeleteMetaInfoParams, FilterItemsByMetaParams, FilterItemsParams, GarchiItem, GarchiItemAPIResponse, GarchiItemMeta, GetAllItemsParams, GetFeaturedItemsParams, GetItemChildrenParams, GetItemParams, GetItemsByIdsParams, GetItemsBySpaceParams, QueryItemsParams, SemanticSearchParams, UpdateDataItemParams, UpdateDataItemResult, UpdateMetaInfoParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass DataItem extends APIClient {\n\n\n async create(params: CreateDataItemParams): Promise<GarchiItem> {\n try {\n const response = await this.client.post(\"/item\", params);\n let data = response.data as {\n data: GarchiItem\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(params: DeleteDataItemParams): Promise<string> {\n try {\n const response = await this.client.post(`/delete/item`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n\n /**\n * Update a data item. For an item that is already published, the update\n * is kept as unpublished changes unless `make_public` is true. Use\n * {@link updateWithStatus} to know which happened.\n *\n * @returns A message saying what happened.\n */\n async update(params: UpdateDataItemParams): Promise<string> {\n return (await this.updateWithStatus(params)).data;\n }\n\n /**\n * Update a data item and learn whether a published item's changes were\n * published or kept as unpublished changes (`has_draft`).\n *\n * Throws the API's error body, such as `{ message }` with status 409 when\n * `make_public` is true but the changes could not be published.\n */\n async updateWithStatus(params: UpdateDataItemParams): Promise<UpdateDataItemResult> {\n try {\n const response = await this.client.post(`/update/item`, params);\n return response.data as UpdateDataItemResult;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async createMetaInfo(params: CreateMetaInfoParams): Promise<GarchiItemMeta[]> {\n try {\n const response = await this.client.post(`/item_meta`, params);\n const data = response.data as {\n data: GarchiItemMeta[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async deleteMetaInfo(params: DeleteMetaInfoParams): Promise<string> {\n try {\n const response = await this.client.post(`/delete/item_meta`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async updateMetaInfo(params: UpdateMetaInfoParams): Promise<string> {\n try {\n const response = await this.client.post(`/update/item_meta`, params);\n const data = response.data as {\n data: string\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getBySpace(params: GetItemsBySpaceParams): Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/space/${params.uid}/items`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async semanticSearch(params: SemanticSearchParams): Promise<GarchiItem[]> {\n try {\n const response = await this.client.get(`/items/semantic-search`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async featured(params: GetFeaturedItemsParams) : Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/items/featured`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async get(params: GetItemParams): Promise<GarchiItem> {\n try {\n const response = await this.client.get(`/item/${params.item}`, {\n params: params,\n });\n const data = response.data as GarchiItemAPIResponse\n return data.data[0] as GarchiItem;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n\n async getAll(params: GetAllItemsParams): Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.get(`/items`, {\n params: params\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n\n }\n }\n\n async filter(params: FilterItemsParams) : Promise<GarchiItem[]> {\n try {\n const response = await this.client.post(`/items/filter`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n\n }\n\n async filterByMeta(params: FilterItemsByMetaParams) : Promise<GarchiItem[]> {\n try {\n const response = await this.client.post(`/items/filter/bymeta`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getByIds(params: GetItemsByIdsParams) : Promise<GarchiItemAPIResponse> {\n try {\n const response = await this.client.post(`/items/byids`, params.body, {\n params: params.query\n });\n const data = response.data as GarchiItemAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n /**\n * Query the published items of a space with conditions on their fields and\n * metadata, including nested JSON values. See the API docs for the operators.\n */\n async query(params: QueryItemsParams): Promise<GarchiItemAPIResponse> {\n try {\n const { uid, ...body } = params;\n const response = await this.client.post(`/space/${uid}/items/query`, body);\n return response.data as GarchiItemAPIResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n /**\n * The published items inside an item (variants of a product, lessons of a\n * course), in their order. The parent itself must be published.\n */\n async getChildren(params: GetItemChildrenParams): Promise<GarchiItemAPIResponse> {\n try {\n const { uid, item, ...query } = params;\n const response = await this.client.get(`/space/${uid}/items/${encodeURIComponent(String(item))}/children`, {\n params: query\n });\n return response.data as GarchiItemAPIResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\n\nexport default DataItem;","import { BlankSectionRequest, BlankSectionResponse, CreateOrUpdateSectionTemplateParams, CreatePageRequest, CreatePageResponse, GarchiAsset, GarchiPage, GetPageParams } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Headless extends APIClient {\n\n async getAsset(file_name: string, space_uid: string) : Promise<GarchiAsset> {\n try {\n const response = await this.client.get(`/space/assets/${file_name}`, {\n params: {\n space_uid\n }\n });\n return response.data as GarchiAsset;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getPage(params: GetPageParams) : Promise<GarchiPage> {\n try {\n const response = await this.client.post(`/page`, params);\n return response.data as GarchiPage;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async createOrUpdateSectionTemplates(params: CreateOrUpdateSectionTemplateParams) : Promise<string> {\n try {\n const response = await this.client.post(`/section_template`, params);\n return response.data as string;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async addPage(params: CreatePageRequest) : Promise<CreatePageResponse>\n {\n try {\n const response = await this.client.post(`/space/${params.space_uid}/create_page`, {\n title: params.title,\n path: params.path,\n description: params.description,\n })\n return response.data as CreatePageResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async addBlankSectionToPage(params: BlankSectionRequest) : Promise<BlankSectionResponse>\n {\n try {\n const response = await this.client.post('/page/add_blank_section', {\n section_template_id: params.section_template_id,\n parent_id: params.parent_id,\n page_id: params.page_id,\n })\n return response.data as BlankSectionResponse;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n \n \n}\n\nexport default Headless;","import { GarchiReaction, GarchiReactionCreate } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Reaction extends APIClient {\n async manage(params: GarchiReactionCreate) : Promise<GarchiReaction> {\n try {\n const response = await this.client.post(\"/manage-reaction\", params);\n let data = response.data as {\n data: GarchiReaction\n }\n return data.data;\n } catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Reaction;","import { GarchiReview, GarchiReviewCreate, PaginateQueryParams, GarchiReviewUpdate, PaginatedResponse } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Review extends APIClient{\n async create(params: GarchiReviewCreate): Promise<GarchiReview> {\n try {\n const response = await this.client.post('/reviews/item', params);\n const data = response.data as {\n data: GarchiReview\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(params: GarchiReviewUpdate): Promise<string> {\n try {\n const response = await this.client.post('/reviews/edit', params);\n const data = response.data as {\n message: string\n }\n return data.message;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(review_id: number): Promise<string> {\n try {\n const response = await this.client.post(`/reviews/delete`, {\n review_id\n });\n const data = response.data as {\n message: string\n }\n return data.message;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getByItem(item_id: number | string, queryParams: PaginateQueryParams) : Promise<PaginatedResponse<GarchiReview>> {\n try {\n const response = await this.client.get(`/reviews/item/${item_id}`, {\n params: queryParams\n });\n const data = response.data as PaginatedResponse<GarchiReview>;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n}\n\nexport default Review;","import { CreatePageResponse, GarchiCategory, GarchiSpace, GarchiSpaceAPIResponse, GarchiSpaceCreate, PaginatedResponse, PaginateQueryParams, SectionTemplate } from \"../../types\";\nimport APIClient from \"../APIClient\";\n\nclass Space extends APIClient {\n \n\n async categories(space_uid: string) : Promise<GarchiCategory[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/categories`);\n const data = response.data as {\n data: GarchiCategory[]\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async getAll(params: PaginateQueryParams) : Promise<GarchiSpaceAPIResponse> {\n try {\n const response = await this.client.get('/spaces', {\n params\n });\n const data = response.data as GarchiSpaceAPIResponse;\n return data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n } \n \n async get(space_uid: string) : Promise<GarchiSpace> {\n try {\n const response = await this.client.get(`/space/${space_uid}`);\n const data = response.data as {\n data: GarchiSpace\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async create(params: GarchiSpaceCreate): Promise<GarchiSpace> {\n try {\n const formData = new FormData()\n formData.append('name', params.name)\n if(params.logo) {\n formData.append('logo', params.logo)\n }\n const response = await this.client.post('/space', formData);\n const data = response.data as {\n data: GarchiSpace\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async update(space_uid: string, params: {\n name?: string,\n logo?: File\n }) : Promise<string> {\n try {\n const formData = new FormData();\n if(params.name) {\n formData.append('name', params.name)\n }\n if(params.logo) {\n formData.append('logo', params.logo)\n }\n const response = await this.client.post(`/update/space/${space_uid}`, formData);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async delete(space_uid: string) : Promise<string> {\n try {\n const response = await this.client.delete(`/delete/space/${space_uid}`);\n const data = response.data as {\n data: string\n }\n return data.data;\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async listPages(space_uid: string) : Promise<CreatePageResponse[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/pages`);\n const data = response.data\n return data as CreatePageResponse[];\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n async listSectionTemplates(space_uid: string) : Promise<SectionTemplate[]> {\n try {\n const response = await this.client.get(`/space/${space_uid}/section_templates`);\n const data = response.data\n return data as SectionTemplate[];\n }\n catch (error: any) {\n throw error.response?.data || new Error(\"Network Error\");\n }\n }\n\n}\nexport default Space;","import { GarchiCMSInitOptions } from \"../types\";\nimport Category from \"./api-wrappers/Category\";\nimport CompoundQuery from \"./api-wrappers/CompoundQuery\";\nimport DataItem from \"./api-wrappers/DataItem\";\nimport Headless from \"./api-wrappers/Headless\";\nimport Reaction from \"./api-wrappers/Reaction\";\nimport Review from \"./api-wrappers/Review\";\nimport Space from \"./api-wrappers/Space\";\n\n\nclass GarchiCMS {\n\n dataItem: DataItem\n category: Category\n space: Space\n review: Review\n headless: Headless\n reaction: Reaction\n compoundQuery: CompoundQuery\n \n constructor(options: GarchiCMSInitOptions) {\n this.dataItem = new DataItem(options)\n this.category = new Category(options)\n this.space = new Space(options)\n this.review = new Review(options) \n this.headless = new Headless(options)\n this.reaction = new Reaction(options)\n this.compoundQuery = new CompoundQuery(options)\n }\n\n \n\n \n}\n\nexport default GarchiCMS","import GarchiCMS from \"./services/GarchiCMS\";\n\n\n\nexport default GarchiCMS;\n\n\nexport * from \"./types/index\";\n\n"],"mappings":";AAAA,OAAO,WAA8B;AAGrC,IAAM,YAAN,MAAgB;AAAA,EAEZ;AAAA,EAGA,YAAY,SAAsC;AAE9C,SAAK,SAAS,MAAM,OAAO;AAAA,MACvB,SAAS;AAAA,MAC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O,SAAS;AACtB,aAAO;AAAA,IACX,SACO,OAAY;AACf,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAEJ;AACA,IAAO,gBAAQ;;;AChHf,IAAM,YAAN,MAAgB;AAAA,EAEZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YAAY,SAA+B;AACvC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,QAAQ,IAAI,cAAM,OAAO;AAC9B,SAAK,SAAS,IAAI,eAAO,OAAO;AAChC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,WAAW,IAAI,iBAAS,OAAO;AACpC,SAAK,gBAAgB,IAAI,sBAAc,OAAO;AAAA,EAClD;AAKJ;AAEA,IAAO,oBAAQ;;;AC/Bf,IAAO,gBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@garchicms/garchi-node-sdk",
3
3
  "description": "Node SDK for light weight wrapper for Garchi CMS API",
4
- "version": "0.0.9",
4
+ "version": "0.0.11",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",