docpouch-client 0.8.20 → 0.9.1
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 +7 -43
- package/dist/index.js +0 -36
- package/package.json +1 -1
- package/src/index.ts +9 -62
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,6 +268,8 @@ 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 {
|
|
@@ -303,35 +278,25 @@ export interface I_StructureField {
|
|
|
303
278
|
type: string;
|
|
304
279
|
items?: string;
|
|
305
280
|
}
|
|
306
|
-
export interface I_StructureEntry {
|
|
307
|
-
_id?: string;
|
|
308
|
-
name: string;
|
|
309
|
-
description: string;
|
|
310
|
-
fields: I_StructureField[];
|
|
311
|
-
}
|
|
312
281
|
export interface I_StructureCreation {
|
|
313
282
|
name: string;
|
|
314
283
|
description?: string;
|
|
284
|
+
type: number;
|
|
285
|
+
subType: number;
|
|
315
286
|
fields: I_StructureField[];
|
|
316
287
|
}
|
|
317
288
|
export interface I_StructureUpdate {
|
|
318
289
|
_id?: string;
|
|
319
290
|
name?: string;
|
|
320
291
|
description?: string;
|
|
292
|
+
type?: number;
|
|
293
|
+
subType?: number;
|
|
321
294
|
fields?: I_StructureField[];
|
|
322
295
|
}
|
|
323
|
-
export interface I_DocumentType {
|
|
324
|
-
_id?: string;
|
|
325
|
-
type: number;
|
|
326
|
-
subType: number;
|
|
327
|
-
name: string;
|
|
328
|
-
description?: string;
|
|
329
|
-
defaultStructureID?: string;
|
|
330
|
-
}
|
|
331
296
|
export type I_EventString = 'heartbeatPong' | "heartbeatPing" | "newDocument" | "newStructure" | "newUser" | "newType" | "removedID" | "changedDocument" | "changedStructure" | "changedUser" | "changedType" | "removedUser" | "removedStructure" | "removedDocument" | "removedType";
|
|
332
297
|
export interface I_WsMessage {
|
|
333
298
|
newDocument?: I_DocumentEntry;
|
|
334
|
-
newStructure?:
|
|
299
|
+
newStructure?: I_DataStructure;
|
|
335
300
|
newUser?: I_UserEntry;
|
|
336
301
|
removedID?: string;
|
|
337
302
|
changedDocument?: I_DocumentUpdate;
|
|
@@ -341,5 +306,4 @@ export interface I_WsMessage {
|
|
|
341
306
|
confirmUnsubscription?: boolean;
|
|
342
307
|
heartbeatPing?: number;
|
|
343
308
|
heartbeatPong?: number;
|
|
344
|
-
newType?: I_DocumentType;
|
|
345
309
|
}
|
package/dist/index.js
CHANGED
|
@@ -229,42 +229,6 @@ export default class docPouchClient {
|
|
|
229
229
|
async removeStructure(structureID) {
|
|
230
230
|
await this.request(`/structures/remove/${structureID}`, 'DELETE');
|
|
231
231
|
}
|
|
232
|
-
// Data Type Endpoints
|
|
233
|
-
/**
|
|
234
|
-
* Creates or writes a document type.
|
|
235
|
-
*
|
|
236
|
-
* @param {I_DocumentType} type - The type payload.
|
|
237
|
-
* @returns {Promise<I_DocumentType>} The created or updated type.
|
|
238
|
-
*/
|
|
239
|
-
async createType(type) {
|
|
240
|
-
return await this.request('/types/write', 'POST', type);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Removes a document type by ID.
|
|
244
|
-
*
|
|
245
|
-
* @param {string} typeID - The ID of the type to remove.
|
|
246
|
-
* @returns {Promise<void>}
|
|
247
|
-
*/
|
|
248
|
-
async removeType(typeID) {
|
|
249
|
-
return await this.request(`/types/remove/${typeID}`, 'DELETE');
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Retrieves all document types.
|
|
253
|
-
*
|
|
254
|
-
* @returns {Promise<I_DocumentType[]>} A list of document types.
|
|
255
|
-
*/
|
|
256
|
-
async getTypes() {
|
|
257
|
-
return await this.request('/types/list', 'GET');
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Updates a document type.
|
|
261
|
-
*
|
|
262
|
-
* @param {I_DocumentType} updatedType - The full type payload to persist.
|
|
263
|
-
* @returns {Promise<void>}
|
|
264
|
-
*/
|
|
265
|
-
async updateType(updatedType) {
|
|
266
|
-
await this.request(`/types/write`, 'POST', updatedType);
|
|
267
|
-
}
|
|
268
232
|
/**
|
|
269
233
|
* Sets or clears the authentication token used for API and WebSocket auth.
|
|
270
234
|
*
|
package/package.json
CHANGED
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?:
|
|
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
|
}
|