@garchicms/garchi-node-sdk 0.0.10 → 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)
@@ -156,6 +158,24 @@ const newItem = await garchi.dataItem.create({
156
158
  });
157
159
  ```
158
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
+
159
179
  #### Get All Items
160
180
 
161
181
  ```typescript
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
  }
@@ -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, GetItemChildrenParams, GetItemParams, GetItemsByIdsParams, GetItemsBySpaceParams, QueryItemsParams, 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 * 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 Garchi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ACA,YAAM,WAAW,MAAM,KAAK,OAAO,IAAI,UAAU,SAAS,oBAAoB;AAC9E,YAAM,OAAO,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"]}
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,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;A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E;AACtE,YAAM,OAAO,SAAS;AAGtB,aAAO,KAAK;AAAA,IAChB,SACO,OAAY;AACf,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,MAAM,UAAU,WAAmD;AAC/D,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,IAAI,UAAU,SAAS,QAAQ;AAClE,YAAM,OAAO,SAAS;AACtB,aAAO;AAAA,IACX,SACO,OAAY;AACf,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,MAAM,qBAAqB,WAAgD;AACvE,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,IAAI,UAAU,SAAS,oBAAoB;AAC9E,YAAM,OAAO,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
@@ -249,11 +249,28 @@ interface UpdateDataItemParams {
249
249
  scratched_price?: number;
250
250
  detail_description?: string;
251
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
+ */
252
257
  make_public?: boolean;
253
258
  slug?: string;
254
259
  agent_description?: string;
255
260
  parent_id?: number | null;
256
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;
273
+ }
257
274
  type MetaType = "string" | "array" | "url" | "object" | "numeric" | "email" | "date" | "color" | "icon_hero" | "icon_lucid";
258
275
  interface MetaInfo {
259
276
  key: string;
@@ -422,7 +439,22 @@ declare class CompoundQuery extends APIClient {
422
439
  declare class DataItem extends APIClient {
423
440
  create(params: CreateDataItemParams): Promise<GarchiItem>;
424
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
+ */
425
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>;
426
458
  createMetaInfo(params: CreateMetaInfoParams): Promise<GarchiItemMeta[]>;
427
459
  deleteMetaInfo(params: DeleteMetaInfoParams): Promise<string>;
428
460
  updateMetaInfo(params: UpdateMetaInfoParams): Promise<string>;
@@ -490,4 +522,4 @@ declare class GarchiCMS {
490
522
  constructor(options: GarchiCMSInitOptions);
491
523
  }
492
524
 
493
- 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 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
@@ -249,11 +249,28 @@ interface UpdateDataItemParams {
249
249
  scratched_price?: number;
250
250
  detail_description?: string;
251
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
+ */
252
257
  make_public?: boolean;
253
258
  slug?: string;
254
259
  agent_description?: string;
255
260
  parent_id?: number | null;
256
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;
273
+ }
257
274
  type MetaType = "string" | "array" | "url" | "object" | "numeric" | "email" | "date" | "color" | "icon_hero" | "icon_lucid";
258
275
  interface MetaInfo {
259
276
  key: string;
@@ -422,7 +439,22 @@ declare class CompoundQuery extends APIClient {
422
439
  declare class DataItem extends APIClient {
423
440
  create(params: CreateDataItemParams): Promise<GarchiItem>;
424
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
+ */
425
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>;
426
458
  createMetaInfo(params: CreateMetaInfoParams): Promise<GarchiItemMeta[]>;
427
459
  deleteMetaInfo(params: DeleteMetaInfoParams): Promise<string>;
428
460
  updateMetaInfo(params: UpdateMetaInfoParams): Promise<string>;
@@ -490,4 +522,4 @@ declare class GarchiCMS {
490
522
  constructor(options: GarchiCMSInitOptions);
491
523
  }
492
524
 
493
- 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 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
  }
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, GetItemChildrenParams, GetItemParams, GetItemsByIdsParams, GetItemsBySpaceParams, QueryItemsParams, 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 * 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\";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AAM,OAAO,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":[]}
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,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;AAAA,QAC9E,WAAW,O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AAAA,EAEA,MAAM,UAAU,WAAmD;AAC/D,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,IAAI,UAAU,SAAS,QAAQ;AAClE,YAAM,OAAO,SAAS;AACtB,aAAO;AAAA,IACX,SACO,OAAY;AACf,YAAM,MAAM,UAAU,QAAQ,IAAI,MAAM,eAAe;AAAA,IAC3D;AAAA,EACJ;AAAA,EAEA,MAAM,qBAAqB,WAAgD;AACvE,QAAI;AACA,YAAM,WAAW,MAAM,KAAK,OAAO,IAAI,UAAU,SAAS,oBAAoB;AAC9E,YAAM,OAAO,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.10",
4
+ "version": "0.0.11",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",