docpouch-client 0.8.19 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -153,33 +153,6 @@ export default class docPouchClient {
153
153
  * @returns {Promise<void>}
154
154
  */
155
155
  removeStructure(structureID: string): Promise<void>;
156
- /**
157
- * Creates or writes a document type.
158
- *
159
- * @param {I_DocumentType} type - The type payload.
160
- * @returns {Promise<I_DocumentType>} The created or updated type.
161
- */
162
- createType(type: I_DocumentType): Promise<I_DocumentType>;
163
- /**
164
- * Removes a document type by ID.
165
- *
166
- * @param {string} typeID - The ID of the type to remove.
167
- * @returns {Promise<void>}
168
- */
169
- removeType(typeID: string): Promise<void>;
170
- /**
171
- * Retrieves all document types.
172
- *
173
- * @returns {Promise<I_DocumentType[]>} A list of document types.
174
- */
175
- getTypes(): Promise<I_DocumentType[]>;
176
- /**
177
- * Updates a document type.
178
- *
179
- * @param {I_DocumentType} updatedType - The full type payload to persist.
180
- * @returns {Promise<void>}
181
- */
182
- updateType(updatedType: I_DocumentType): Promise<void>;
183
156
  /**
184
157
  * Sets or clears the authentication token used for API and WebSocket auth.
185
158
  *
@@ -295,42 +268,35 @@ export interface I_DataStructure {
295
268
  _id?: string | undefined;
296
269
  name: string;
297
270
  description: string;
271
+ type: number;
272
+ subtype: number;
298
273
  fields: I_StructureField[];
299
274
  }
300
275
  export interface I_StructureField {
301
276
  name: string;
277
+ displayName: string;
302
278
  type: string;
303
279
  items?: string;
304
280
  }
305
- export interface I_StructureEntry {
306
- _id?: string;
307
- name: string;
308
- description: string;
309
- fields: I_StructureField[];
310
- }
311
281
  export interface I_StructureCreation {
312
282
  name: string;
313
283
  description?: string;
284
+ type: number;
285
+ subtype: number;
314
286
  fields: I_StructureField[];
315
287
  }
316
288
  export interface I_StructureUpdate {
317
289
  _id?: string;
318
290
  name?: string;
319
291
  description?: string;
292
+ type?: number;
293
+ subtype?: number;
320
294
  fields?: I_StructureField[];
321
295
  }
322
- export interface I_DocumentType {
323
- _id?: string;
324
- type: number;
325
- subType: number;
326
- name: string;
327
- description?: string;
328
- defaultStructureID?: string;
329
- }
330
296
  export type I_EventString = 'heartbeatPong' | "heartbeatPing" | "newDocument" | "newStructure" | "newUser" | "newType" | "removedID" | "changedDocument" | "changedStructure" | "changedUser" | "changedType" | "removedUser" | "removedStructure" | "removedDocument" | "removedType";
331
297
  export interface I_WsMessage {
332
298
  newDocument?: I_DocumentEntry;
333
- newStructure?: I_StructureEntry;
299
+ newStructure?: I_DataStructure;
334
300
  newUser?: I_UserEntry;
335
301
  removedID?: string;
336
302
  changedDocument?: I_DocumentUpdate;
@@ -340,5 +306,4 @@ export interface I_WsMessage {
340
306
  confirmUnsubscription?: boolean;
341
307
  heartbeatPing?: number;
342
308
  heartbeatPong?: number;
343
- newType?: I_DocumentType;
344
309
  }
package/dist/index.js CHANGED
@@ -100,7 +100,13 @@ export default class docPouchClient {
100
100
  if (this.realTimeSync) {
101
101
  this.initWebSocket();
102
102
  }
103
- return { _id: response._id, token: response.token, isAdmin: response.isAdmin, userName: response.userName, expiresIn: response.expiresIn };
103
+ return {
104
+ _id: response._id,
105
+ token: response.token,
106
+ isAdmin: response.isAdmin,
107
+ userName: response.userName,
108
+ expiresIn: response.expiresIn
109
+ };
104
110
  }
105
111
  return null;
106
112
  }
@@ -223,42 +229,6 @@ export default class docPouchClient {
223
229
  async removeStructure(structureID) {
224
230
  await this.request(`/structures/remove/${structureID}`, 'DELETE');
225
231
  }
226
- // Data Type Endpoints
227
- /**
228
- * Creates or writes a document type.
229
- *
230
- * @param {I_DocumentType} type - The type payload.
231
- * @returns {Promise<I_DocumentType>} The created or updated type.
232
- */
233
- async createType(type) {
234
- return await this.request('/types/write', 'POST', type);
235
- }
236
- /**
237
- * Removes a document type by ID.
238
- *
239
- * @param {string} typeID - The ID of the type to remove.
240
- * @returns {Promise<void>}
241
- */
242
- async removeType(typeID) {
243
- return await this.request(`/types/remove/${typeID}`, 'DELETE');
244
- }
245
- /**
246
- * Retrieves all document types.
247
- *
248
- * @returns {Promise<I_DocumentType[]>} A list of document types.
249
- */
250
- async getTypes() {
251
- return await this.request('/types/list', 'GET');
252
- }
253
- /**
254
- * Updates a document type.
255
- *
256
- * @param {I_DocumentType} updatedType - The full type payload to persist.
257
- * @returns {Promise<void>}
258
- */
259
- async updateType(updatedType) {
260
- await this.request(`/types/write`, 'POST', updatedType);
261
- }
262
232
  /**
263
233
  * Sets or clears the authentication token used for API and WebSocket auth.
264
234
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docpouch-client",
3
- "version": "0.8.19",
3
+ "version": "0.9.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
package/src/index.ts CHANGED
@@ -42,7 +42,7 @@ export default class docPouchClient {
42
42
  * @private
43
43
  * @type {boolean}
44
44
  */
45
- private connectionInProgress = false;
45
+ private connectionInProgress: boolean = false;
46
46
 
47
47
  /**
48
48
  * Creates an instance of docPouchClient.
@@ -273,46 +273,6 @@ export default class docPouchClient {
273
273
  await this.request<void>(`/structures/remove/${structureID}`, 'DELETE');
274
274
  }
275
275
 
276
- // Data Type Endpoints
277
- /**
278
- * Creates or writes a document type.
279
- *
280
- * @param {I_DocumentType} type - The type payload.
281
- * @returns {Promise<I_DocumentType>} The created or updated type.
282
- */
283
- async createType(type: I_DocumentType): Promise<I_DocumentType> {
284
- return await this.request<I_DocumentType>('/types/write', 'POST', type);
285
- }
286
-
287
- /**
288
- * Removes a document type by ID.
289
- *
290
- * @param {string} typeID - The ID of the type to remove.
291
- * @returns {Promise<void>}
292
- */
293
- async removeType(typeID: string) {
294
- return await this.request<void>(`/types/remove/${typeID}`, 'DELETE');
295
- }
296
-
297
- /**
298
- * Retrieves all document types.
299
- *
300
- * @returns {Promise<I_DocumentType[]>} A list of document types.
301
- */
302
- async getTypes(): Promise<I_DocumentType[]> {
303
- return await this.request<I_DocumentType[]>('/types/list', 'GET');
304
- }
305
-
306
- /**
307
- * Updates a document type.
308
- *
309
- * @param {I_DocumentType} updatedType - The full type payload to persist.
310
- * @returns {Promise<void>}
311
- */
312
- async updateType(updatedType: I_DocumentType): Promise<void> {
313
- await this.request<void>(`/types/write`, 'POST', updatedType);
314
- }
315
-
316
276
  /**
317
277
  * Sets or clears the authentication token used for API and WebSocket auth.
318
278
  *
@@ -357,7 +317,7 @@ export default class docPouchClient {
357
317
  *
358
318
  * @returns {string} The semantic version string.
359
319
  */
360
- getVersion() {
320
+ getVersion():string {
361
321
  return packetJson.version;
362
322
  }
363
323
 
@@ -614,6 +574,8 @@ export interface I_DataStructure {
614
574
  _id?: string | undefined;
615
575
  name: string;
616
576
  description: string;
577
+ type: number
578
+ subtype: number
617
579
  fields: I_StructureField[];
618
580
  }
619
581
 
@@ -624,17 +586,11 @@ export interface I_StructureField {
624
586
  items?: string;
625
587
  }
626
588
 
627
- export interface I_StructureEntry {
628
- _id?: string;
629
- name: string;
630
- description: string;
631
- fields: I_StructureField[];
632
- }
633
-
634
-
635
589
  export interface I_StructureCreation {
636
590
  name: string;
637
591
  description?: string;
592
+ type: number
593
+ subtype: number
638
594
  fields: I_StructureField[];
639
595
  }
640
596
 
@@ -642,19 +598,11 @@ export interface I_StructureUpdate {
642
598
  _id?: string
643
599
  name?: string;
644
600
  description?: string;
601
+ type?: number
602
+ subtype?: number
645
603
  fields?: I_StructureField[];
646
604
  }
647
605
 
648
- // Document type related types
649
- export interface I_DocumentType {
650
- _id?: string;
651
- type: number;
652
- subType: number;
653
- name: string;
654
- description?: string;
655
- defaultStructureID?: string;
656
- }
657
-
658
606
  // WebSocket-related types
659
607
  export type I_EventString = 'heartbeatPong' | "heartbeatPing" | "newDocument" | "newStructure" |
660
608
  "newUser" | "newType" | "removedID" | "changedDocument" | "changedStructure" | "changedUser" | "changedType" |
@@ -662,7 +610,7 @@ export type I_EventString = 'heartbeatPong' | "heartbeatPing" | "newDocument" |
662
610
 
663
611
  export interface I_WsMessage {
664
612
  newDocument?: I_DocumentEntry;
665
- newStructure?: I_StructureEntry;
613
+ newStructure?: I_DataStructure;
666
614
  newUser?: I_UserEntry;
667
615
  removedID?: string;
668
616
  changedDocument?: I_DocumentUpdate;
@@ -672,5 +620,4 @@ export interface I_WsMessage {
672
620
  confirmUnsubscription?: boolean;
673
621
  heartbeatPing?: number;
674
622
  heartbeatPong?: number;
675
- newType?: I_DocumentType;
676
623
  }