@api-client/core 0.6.24 → 0.6.25

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.
@@ -90,17 +90,40 @@ export interface ContextDeleteEventDetail {
90
90
  */
91
91
  parent?: string;
92
92
  }
93
+ export interface ContextDeleteBulkEventDetail {
94
+ /**
95
+ * The list of ids of the domain object to remove.
96
+ */
97
+ ids: string[];
98
+ /**
99
+ * The id of the parent object, if applicable.
100
+ */
101
+ parent?: string;
102
+ }
93
103
  /**
94
104
  * An event to be used to delete a state in the context provider.
95
105
  */
96
106
  export declare class ContextDeleteEvent extends ContextEvent<ContextDeleteEventDetail, ContextDeleteRecord> {
97
107
  /**
108
+ * An event to be used to delete a state in the context provider.
98
109
  * @param type The type of the event to dispatch.
99
110
  * @param id The id of the object to delete
100
111
  * @param parent The id of the parent object, if applicable.
101
112
  */
102
113
  constructor(type: string, id: string, parent?: string);
103
114
  }
115
+ /**
116
+ * An event to be used to delete a number of entities in the context provider.
117
+ */
118
+ export declare class ContextDeleteBulkEvent extends ContextEvent<ContextDeleteBulkEventDetail, ContextDeleteRecord> {
119
+ /**
120
+ * An event to be used to delete a number of entities in the context provider.
121
+ * @param type The type of the event to dispatch.
122
+ * @param ids The list of ids of the domain object to remove.
123
+ * @param parent The id of the parent object, if applicable.
124
+ */
125
+ constructor(type: string, ids: string[], parent?: string);
126
+ }
104
127
  export interface ContextDeleteRecord {
105
128
  /**
106
129
  * The data kind of the deleted item.
@@ -116,6 +139,20 @@ export interface ContextDeleteRecord {
116
139
  */
117
140
  parent?: string;
118
141
  }
142
+ /**
143
+ * An event dispatched to the context store to restore previously deleted items.
144
+ */
145
+ export declare class ContextRestoreEvent<T> extends ContextEvent<ContextDeleteRecord[], ContextChangeRecord<T>> {
146
+ /**
147
+ * An event dispatched to the context store to restore previously deleted items.
148
+ *
149
+ * The result of the event is the list of `ContextChangeRecord` for the restored items.
150
+ *
151
+ * @param type The type of the event.
152
+ * @param records The records of previously deleted items.
153
+ */
154
+ constructor(type: string, records: ContextDeleteRecord[]);
155
+ }
119
156
  /**
120
157
  * An event dispatched when a context store object has been deleted.
121
158
  * In general a single context store uses the same event to dispatch the change record.
@@ -154,10 +191,37 @@ export interface ContextUpdateEventDetail<T> {
154
191
  * This is equivalent to PUT operation in REST HTTP.
155
192
  *
156
193
  * @template T The object that is being updated.
194
+ * @template U The object that is returned by the context store after updating. By default it is the `T`.
157
195
  */
158
196
  export declare class ContextUpdateEvent<T extends object, U = T> extends ContextEvent<ContextUpdateEventDetail<T>, ContextChangeRecord<U>> {
197
+ /**
198
+ * An event that is dispatched to update the entire object in the store.
199
+ * This is equivalent to PUT operation in REST HTTP.
200
+ *
201
+ * @param type The type of the event to dispatch
202
+ * @param updateInfo The update information.
203
+ */
159
204
  constructor(type: string, updateInfo: ContextUpdateEventDetail<T>);
160
205
  }
206
+ /**
207
+ * An event that is dispatched to update a list of objects in the store.
208
+ * This is equivalent to PUT operation in REST HTTP.
209
+ *
210
+ * If there's a parent, this event only allows to update entities in bulk for the same parent.
211
+ *
212
+ * @template T The object that is being updated.
213
+ * @template U The object that is returned by the context store after updating. By default it is the `T`.
214
+ */
215
+ export declare class ContextUpdateBulkEvent<T extends object, U = T> extends ContextEvent<ContextUpdateEventDetail<T[]>, ContextChangeRecord<U>[]> {
216
+ /**
217
+ * An event that is dispatched to update the entire object in the store.
218
+ * This is equivalent to PUT operation in REST HTTP.
219
+ *
220
+ * @param type The type of the event to dispatch
221
+ * @param updateInfo The update information.
222
+ */
223
+ constructor(type: string, updateInfo: ContextUpdateEventDetail<T[]>);
224
+ }
161
225
  /**
162
226
  * Data store query result object.
163
227
  */
@@ -193,3 +257,46 @@ export declare class ContextListEvent<T> extends ContextEvent<ContextListOptions
193
257
  */
194
258
  constructor(type: string, opts?: ContextListOptions);
195
259
  }
260
+ export interface IQueryDetail {
261
+ /**
262
+ * The query term. All values are always passed as string. Context store must parse value if it requires other types.
263
+ */
264
+ term: string;
265
+ /**
266
+ * If the context store supports it, the tags to use with the query function to limit the results.
267
+ */
268
+ tags?: string[];
269
+ /**
270
+ * General purpose type to be defined by the context store.
271
+ * Allows to specify the type of the query to perform.
272
+ */
273
+ type?: string;
274
+ /**
275
+ * General purpose keyword to be defined by the context store.
276
+ * The purpose is to instruct the context store to perform detailed search.
277
+ * Usually this means longer search time but more accurate results.
278
+ */
279
+ detailed?: boolean;
280
+ }
281
+ /**
282
+ * An event dispatched to the context store to perform a query operation.
283
+ * If the context store supports the query operation, it should use the definition of `IQueryDetail` to perform the query.
284
+ * The result is the list of objects ordered by the store from the most relevant items to the least.
285
+ *
286
+ * The implementation should not assume pagination and return enough results for the user to find what they were looking for
287
+ * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.
288
+ */
289
+ export declare class ContextQueryEvent<T = unknown> extends ContextEvent<IQueryDetail, T[]> {
290
+ /**
291
+ * An event dispatched to the context store to perform a query operation.
292
+ * If the context store supports the query operation, it should use the definition of `IQueryDetail` to perform the query.
293
+ * The result is the list of objects ordered by the store from the most relevant items to the least.
294
+ *
295
+ * The implementation should not assume pagination and return enough results for the user to find what they were looking for
296
+ * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.
297
+ *
298
+ * @param type The type of the event.
299
+ * @param opts The query options.
300
+ */
301
+ constructor(type: string, opts: IQueryDetail);
302
+ }
@@ -49,6 +49,7 @@ export class ContextReadBulkEvent extends ContextEvent {
49
49
  */
50
50
  export class ContextDeleteEvent extends ContextEvent {
51
51
  /**
52
+ * An event to be used to delete a state in the context provider.
52
53
  * @param type The type of the event to dispatch.
53
54
  * @param id The id of the object to delete
54
55
  * @param parent The id of the parent object, if applicable.
@@ -57,6 +58,36 @@ export class ContextDeleteEvent extends ContextEvent {
57
58
  super(type, { id, parent });
58
59
  }
59
60
  }
61
+ /**
62
+ * An event to be used to delete a number of entities in the context provider.
63
+ */
64
+ export class ContextDeleteBulkEvent extends ContextEvent {
65
+ /**
66
+ * An event to be used to delete a number of entities in the context provider.
67
+ * @param type The type of the event to dispatch.
68
+ * @param ids The list of ids of the domain object to remove.
69
+ * @param parent The id of the parent object, if applicable.
70
+ */
71
+ constructor(type, ids, parent) {
72
+ super(type, { ids, parent });
73
+ }
74
+ }
75
+ /**
76
+ * An event dispatched to the context store to restore previously deleted items.
77
+ */
78
+ export class ContextRestoreEvent extends ContextEvent {
79
+ /**
80
+ * An event dispatched to the context store to restore previously deleted items.
81
+ *
82
+ * The result of the event is the list of `ContextChangeRecord` for the restored items.
83
+ *
84
+ * @param type The type of the event.
85
+ * @param records The records of previously deleted items.
86
+ */
87
+ constructor(type, records) {
88
+ super(type, records);
89
+ }
90
+ }
60
91
  /**
61
92
  * An event dispatched when a context store object has been deleted.
62
93
  * In general a single context store uses the same event to dispatch the change record.
@@ -99,8 +130,37 @@ export class ContextStateUpdateEvent extends CustomEvent {
99
130
  * This is equivalent to PUT operation in REST HTTP.
100
131
  *
101
132
  * @template T The object that is being updated.
133
+ * @template U The object that is returned by the context store after updating. By default it is the `T`.
102
134
  */
103
135
  export class ContextUpdateEvent extends ContextEvent {
136
+ /**
137
+ * An event that is dispatched to update the entire object in the store.
138
+ * This is equivalent to PUT operation in REST HTTP.
139
+ *
140
+ * @param type The type of the event to dispatch
141
+ * @param updateInfo The update information.
142
+ */
143
+ constructor(type, updateInfo) {
144
+ super(type, updateInfo);
145
+ }
146
+ }
147
+ /**
148
+ * An event that is dispatched to update a list of objects in the store.
149
+ * This is equivalent to PUT operation in REST HTTP.
150
+ *
151
+ * If there's a parent, this event only allows to update entities in bulk for the same parent.
152
+ *
153
+ * @template T The object that is being updated.
154
+ * @template U The object that is returned by the context store after updating. By default it is the `T`.
155
+ */
156
+ export class ContextUpdateBulkEvent extends ContextEvent {
157
+ /**
158
+ * An event that is dispatched to update the entire object in the store.
159
+ * This is equivalent to PUT operation in REST HTTP.
160
+ *
161
+ * @param type The type of the event to dispatch
162
+ * @param updateInfo The update information.
163
+ */
104
164
  constructor(type, updateInfo) {
105
165
  super(type, updateInfo);
106
166
  }
@@ -114,4 +174,28 @@ export class ContextListEvent extends ContextEvent {
114
174
  super(type, opts);
115
175
  }
116
176
  }
177
+ /**
178
+ * An event dispatched to the context store to perform a query operation.
179
+ * If the context store supports the query operation, it should use the definition of `IQueryDetail` to perform the query.
180
+ * The result is the list of objects ordered by the store from the most relevant items to the least.
181
+ *
182
+ * The implementation should not assume pagination and return enough results for the user to find what they were looking for
183
+ * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.
184
+ */
185
+ export class ContextQueryEvent extends ContextEvent {
186
+ /**
187
+ * An event dispatched to the context store to perform a query operation.
188
+ * If the context store supports the query operation, it should use the definition of `IQueryDetail` to perform the query.
189
+ * The result is the list of objects ordered by the store from the most relevant items to the least.
190
+ *
191
+ * The implementation should not assume pagination and return enough results for the user to find what they were looking for
192
+ * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.
193
+ *
194
+ * @param type The type of the event.
195
+ * @param opts The query options.
196
+ */
197
+ constructor(type, opts) {
198
+ super(type, opts);
199
+ }
200
+ }
117
201
  //# sourceMappingURL=BaseEvents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseEvents.js","sourceRoot":"","sources":["../../../src/events/BaseEvents.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAc3C;;GAEG;AACH,MAAM,OAAO,YAAkC,SAAQ,WAAgD;IACrG;;;OAGG;IACH,YAAY,IAAY,EAAE,MAAS;QACjC,KAAK,CAAC,IAAI,EAAE;YACV,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE;gBACN,MAAM,EAAE,SAAS;gBACjB,GAAG,MAAM;aACV;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAaD;;GAEG;AACH,MAAM,OAAO,gBAAoB,SAAQ,YAAuC;IAC9E;;;;OAIG;IACH,YAAY,IAAY,EAAE,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AOG;AACH,MAAM,OAAO,iBAA+B,SAAQ,YAA+B;IACjF;;;;;;;;;;OAUG;IACH,YAAY,IAAY,EAAE,IAAkB;QAC1C,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
3
  "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.6.24",
4
+ "version": "0.6.25",
5
5
  "license": "Apache-2.0",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",
@@ -113,11 +113,23 @@ export interface ContextDeleteEventDetail {
113
113
  parent?: string;
114
114
  }
115
115
 
116
+ export interface ContextDeleteBulkEventDetail {
117
+ /**
118
+ * The list of ids of the domain object to remove.
119
+ */
120
+ ids: string[];
121
+ /**
122
+ * The id of the parent object, if applicable.
123
+ */
124
+ parent?: string;
125
+ }
126
+
116
127
  /**
117
128
  * An event to be used to delete a state in the context provider.
118
129
  */
119
130
  export class ContextDeleteEvent extends ContextEvent<ContextDeleteEventDetail, ContextDeleteRecord> {
120
131
  /**
132
+ * An event to be used to delete a state in the context provider.
121
133
  * @param type The type of the event to dispatch.
122
134
  * @param id The id of the object to delete
123
135
  * @param parent The id of the parent object, if applicable.
@@ -127,6 +139,21 @@ export class ContextDeleteEvent extends ContextEvent<ContextDeleteEventDetail, C
127
139
  }
128
140
  }
129
141
 
142
+ /**
143
+ * An event to be used to delete a number of entities in the context provider.
144
+ */
145
+ export class ContextDeleteBulkEvent extends ContextEvent<ContextDeleteBulkEventDetail, ContextDeleteRecord> {
146
+ /**
147
+ * An event to be used to delete a number of entities in the context provider.
148
+ * @param type The type of the event to dispatch.
149
+ * @param ids The list of ids of the domain object to remove.
150
+ * @param parent The id of the parent object, if applicable.
151
+ */
152
+ constructor(type: string, ids: string[], parent?: string) {
153
+ super(type, { ids, parent });
154
+ }
155
+ }
156
+
130
157
  export interface ContextDeleteRecord {
131
158
  /**
132
159
  * The data kind of the deleted item.
@@ -143,6 +170,23 @@ export interface ContextDeleteRecord {
143
170
  parent?: string;
144
171
  }
145
172
 
173
+ /**
174
+ * An event dispatched to the context store to restore previously deleted items.
175
+ */
176
+ export class ContextRestoreEvent<T> extends ContextEvent<ContextDeleteRecord[], ContextChangeRecord<T>> {
177
+ /**
178
+ * An event dispatched to the context store to restore previously deleted items.
179
+ *
180
+ * The result of the event is the list of `ContextChangeRecord` for the restored items.
181
+ *
182
+ * @param type The type of the event.
183
+ * @param records The records of previously deleted items.
184
+ */
185
+ constructor(type: string, records: ContextDeleteRecord[]) {
186
+ super(type, records);
187
+ }
188
+ }
189
+
146
190
  /**
147
191
  * An event dispatched when a context store object has been deleted.
148
192
  * In general a single context store uses the same event to dispatch the change record.
@@ -198,13 +242,43 @@ export interface ContextUpdateEventDetail<T> {
198
242
  * This is equivalent to PUT operation in REST HTTP.
199
243
  *
200
244
  * @template T The object that is being updated.
245
+ * @template U The object that is returned by the context store after updating. By default it is the `T`.
201
246
  */
202
247
  export class ContextUpdateEvent<T extends object, U = T> extends ContextEvent<ContextUpdateEventDetail<T>, ContextChangeRecord<U>> {
248
+ /**
249
+ * An event that is dispatched to update the entire object in the store.
250
+ * This is equivalent to PUT operation in REST HTTP.
251
+ *
252
+ * @param type The type of the event to dispatch
253
+ * @param updateInfo The update information.
254
+ */
203
255
  constructor(type: string, updateInfo: ContextUpdateEventDetail<T>) {
204
256
  super(type, updateInfo);
205
257
  }
206
258
  }
207
259
 
260
+ /**
261
+ * An event that is dispatched to update a list of objects in the store.
262
+ * This is equivalent to PUT operation in REST HTTP.
263
+ *
264
+ * If there's a parent, this event only allows to update entities in bulk for the same parent.
265
+ *
266
+ * @template T The object that is being updated.
267
+ * @template U The object that is returned by the context store after updating. By default it is the `T`.
268
+ */
269
+ export class ContextUpdateBulkEvent<T extends object, U = T> extends ContextEvent<ContextUpdateEventDetail<T[]>, ContextChangeRecord<U>[]> {
270
+ /**
271
+ * An event that is dispatched to update the entire object in the store.
272
+ * This is equivalent to PUT operation in REST HTTP.
273
+ *
274
+ * @param type The type of the event to dispatch
275
+ * @param updateInfo The update information.
276
+ */
277
+ constructor(type: string, updateInfo: ContextUpdateEventDetail<T[]>) {
278
+ super(type, updateInfo);
279
+ }
280
+ }
281
+
208
282
  /**
209
283
  * Data store query result object.
210
284
  */
@@ -244,3 +318,53 @@ export class ContextListEvent<T> extends ContextEvent<ContextListOptions, Contex
244
318
  super(type, opts);
245
319
  }
246
320
  }
321
+
322
+ export interface IQueryDetail {
323
+ /**
324
+ * The query term. All values are always passed as string. Context store must parse value if it requires other types.
325
+ */
326
+ term: string;
327
+
328
+ /**
329
+ * If the context store supports it, the tags to use with the query function to limit the results.
330
+ */
331
+ tags?: string[];
332
+
333
+ /**
334
+ * General purpose type to be defined by the context store.
335
+ * Allows to specify the type of the query to perform.
336
+ */
337
+ type?: string;
338
+
339
+ /**
340
+ * General purpose keyword to be defined by the context store.
341
+ * The purpose is to instruct the context store to perform detailed search.
342
+ * Usually this means longer search time but more accurate results.
343
+ */
344
+ detailed?: boolean;
345
+ }
346
+
347
+ /**
348
+ * An event dispatched to the context store to perform a query operation.
349
+ * If the context store supports the query operation, it should use the definition of `IQueryDetail` to perform the query.
350
+ * The result is the list of objects ordered by the store from the most relevant items to the least.
351
+ *
352
+ * The implementation should not assume pagination and return enough results for the user to find what they were looking for
353
+ * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.
354
+ */
355
+ export class ContextQueryEvent<T = unknown> extends ContextEvent<IQueryDetail, T[]> {
356
+ /**
357
+ * An event dispatched to the context store to perform a query operation.
358
+ * If the context store supports the query operation, it should use the definition of `IQueryDetail` to perform the query.
359
+ * The result is the list of objects ordered by the store from the most relevant items to the least.
360
+ *
361
+ * The implementation should not assume pagination and return enough results for the user to find what they were looking for
362
+ * or to redefine the query. Suggested limit is `50` which in many cases is equivalent of 2 pages of results.
363
+ *
364
+ * @param type The type of the event.
365
+ * @param opts The query options.
366
+ */
367
+ constructor(type: string, opts: IQueryDetail) {
368
+ super(type, opts);
369
+ }
370
+ }