assignment-user-matcher 1.0.10 → 1.0.14
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/LICENCE +53 -0
- package/README.md +196 -148
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/matcher.class.d.ts +60 -0
- package/dist/matcher.class.d.ts.map +1 -0
- package/dist/matcher.class.js +363 -0
- package/package.json +16 -3
- package/.github/workflows/npm-publish.yml +0 -84
- package/.mocharc.json +0 -11
- package/.prettierignore +0 -1
- package/.vscode/launch.json +0 -32
- package/docs/README.md +0 -109
- package/docs/classes/default.md +0 -397
- package/docs/interfaces/User.md +0 -34
- package/docs/modules.md +0 -91
- package/src/matcher.class.ts +0 -291
- package/tests/matcher.test.ts +0 -372
- package/tsconfig.json +0 -22
package/docs/classes/default.md
DELETED
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
[assignment-engine](../README.md) / [Exports](../modules.md) / default
|
|
2
|
-
|
|
3
|
-
# Class: default
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Constructors
|
|
8
|
-
|
|
9
|
-
- [constructor](default.md#constructor)
|
|
10
|
-
|
|
11
|
-
### Properties
|
|
12
|
-
|
|
13
|
-
- [assignmentsKey](default.md#assignmentskey)
|
|
14
|
-
- [assignmentsRefKey](default.md#assignmentsrefkey)
|
|
15
|
-
- [enableDefaultMatching](default.md#enabledefaultmatching)
|
|
16
|
-
- [maxUserBacklogSize](default.md#maxuserbacklogsize)
|
|
17
|
-
- [redisClient](default.md#redisclient)
|
|
18
|
-
- [redisPrefix](default.md#redisprefix)
|
|
19
|
-
- [relevantBatchSize](default.md#relevantbatchsize)
|
|
20
|
-
- [usersKey](default.md#userskey)
|
|
21
|
-
|
|
22
|
-
### Accessors
|
|
23
|
-
|
|
24
|
-
- [stats](default.md#stats)
|
|
25
|
-
- [usersWithoutAssignment](default.md#userswithoutassignment)
|
|
26
|
-
|
|
27
|
-
### Methods
|
|
28
|
-
|
|
29
|
-
- [addAssignment](default.md#addassignment)
|
|
30
|
-
- [addUser](default.md#adduser)
|
|
31
|
-
- [calculatePriority](default.md#calculatepriority)
|
|
32
|
-
- [getAllAssignments](default.md#getallassignments)
|
|
33
|
-
- [getCurrentAssignmentsForUser](default.md#getcurrentassignmentsforuser)
|
|
34
|
-
- [getUserRelatedAssignments](default.md#getuserrelatedassignments)
|
|
35
|
-
- [initRedis](default.md#initredis)
|
|
36
|
-
- [matchScore](default.md#matchscore)
|
|
37
|
-
- [matchUsersAssignments](default.md#matchusersassignments)
|
|
38
|
-
- [removeAssignment](default.md#removeassignment)
|
|
39
|
-
- [removeUser](default.md#removeuser)
|
|
40
|
-
- [setAssignmentPriority](default.md#setassignmentpriority)
|
|
41
|
-
|
|
42
|
-
## Constructors
|
|
43
|
-
|
|
44
|
-
### constructor
|
|
45
|
-
|
|
46
|
-
• **new default**(`redisClient`, `options?`)
|
|
47
|
-
|
|
48
|
-
#### Parameters
|
|
49
|
-
|
|
50
|
-
| Name | Type |
|
|
51
|
-
| :------------ | :------------------------------------------------------------------- |
|
|
52
|
-
| `redisClient` | `RedisClientType`<`RedisModules`, `RedisFunctions`, `RedisScripts`\> |
|
|
53
|
-
| `options?` | [`options`](../modules.md#options) |
|
|
54
|
-
|
|
55
|
-
#### Defined in
|
|
56
|
-
|
|
57
|
-
matcher.class.ts:48
|
|
58
|
-
|
|
59
|
-
## Properties
|
|
60
|
-
|
|
61
|
-
### assignmentsKey
|
|
62
|
-
|
|
63
|
-
• **assignmentsKey**: `string`
|
|
64
|
-
|
|
65
|
-
#### Defined in
|
|
66
|
-
|
|
67
|
-
matcher.class.ts:42
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
### assignmentsRefKey
|
|
72
|
-
|
|
73
|
-
• **assignmentsRefKey**: `string`
|
|
74
|
-
|
|
75
|
-
#### Defined in
|
|
76
|
-
|
|
77
|
-
matcher.class.ts:43
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
### enableDefaultMatching
|
|
82
|
-
|
|
83
|
-
• **enableDefaultMatching**: `boolean`
|
|
84
|
-
|
|
85
|
-
#### Defined in
|
|
86
|
-
|
|
87
|
-
matcher.class.ts:46
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
### maxUserBacklogSize
|
|
92
|
-
|
|
93
|
-
• **maxUserBacklogSize**: `number`
|
|
94
|
-
|
|
95
|
-
#### Defined in
|
|
96
|
-
|
|
97
|
-
matcher.class.ts:45
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
### redisClient
|
|
102
|
-
|
|
103
|
-
• **redisClient**: `RedisClientType`<`RedisModules`, `RedisFunctions`, `RedisScripts`\>
|
|
104
|
-
|
|
105
|
-
#### Defined in
|
|
106
|
-
|
|
107
|
-
matcher.class.ts:48
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
### redisPrefix
|
|
112
|
-
|
|
113
|
-
• **redisPrefix**: `string`
|
|
114
|
-
|
|
115
|
-
#### Defined in
|
|
116
|
-
|
|
117
|
-
matcher.class.ts:41
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
### relevantBatchSize
|
|
122
|
-
|
|
123
|
-
• **relevantBatchSize**: `number`
|
|
124
|
-
|
|
125
|
-
#### Defined in
|
|
126
|
-
|
|
127
|
-
matcher.class.ts:40
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
### usersKey
|
|
132
|
-
|
|
133
|
-
• **usersKey**: `string`
|
|
134
|
-
|
|
135
|
-
#### Defined in
|
|
136
|
-
|
|
137
|
-
matcher.class.ts:44
|
|
138
|
-
|
|
139
|
-
## Accessors
|
|
140
|
-
|
|
141
|
-
### stats
|
|
142
|
-
|
|
143
|
-
• `get` **stats**(): `Promise`<[`Stats`](../modules.md#stats)\>
|
|
144
|
-
|
|
145
|
-
#### Returns
|
|
146
|
-
|
|
147
|
-
`Promise`<[`Stats`](../modules.md#stats)\>
|
|
148
|
-
|
|
149
|
-
#### Defined in
|
|
150
|
-
|
|
151
|
-
matcher.class.ts:164
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
### usersWithoutAssignment
|
|
156
|
-
|
|
157
|
-
• `get` **usersWithoutAssignment**(): `Promise`<`string`[]\>
|
|
158
|
-
|
|
159
|
-
#### Returns
|
|
160
|
-
|
|
161
|
-
`Promise`<`string`[]\>
|
|
162
|
-
|
|
163
|
-
#### Defined in
|
|
164
|
-
|
|
165
|
-
matcher.class.ts:182
|
|
166
|
-
|
|
167
|
-
## Methods
|
|
168
|
-
|
|
169
|
-
### addAssignment
|
|
170
|
-
|
|
171
|
-
▸ **addAssignment**(`assignment`): `Promise`<[`Assignment`](../modules.md#assignment)\>
|
|
172
|
-
|
|
173
|
-
#### Parameters
|
|
174
|
-
|
|
175
|
-
| Name | Type |
|
|
176
|
-
| :----------- | :--------------------------------------- |
|
|
177
|
-
| `assignment` | [`Assignment`](../modules.md#assignment) |
|
|
178
|
-
|
|
179
|
-
#### Returns
|
|
180
|
-
|
|
181
|
-
`Promise`<[`Assignment`](../modules.md#assignment)\>
|
|
182
|
-
|
|
183
|
-
#### Defined in
|
|
184
|
-
|
|
185
|
-
matcher.class.ts:83
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
### addUser
|
|
190
|
-
|
|
191
|
-
▸ **addUser**(`user`): `Promise`<[`User`](../interfaces/User.md)\>
|
|
192
|
-
|
|
193
|
-
#### Parameters
|
|
194
|
-
|
|
195
|
-
| Name | Type |
|
|
196
|
-
| :----- | :------------------------------ |
|
|
197
|
-
| `user` | [`User`](../interfaces/User.md) |
|
|
198
|
-
|
|
199
|
-
#### Returns
|
|
200
|
-
|
|
201
|
-
`Promise`<[`User`](../interfaces/User.md)\>
|
|
202
|
-
|
|
203
|
-
#### Defined in
|
|
204
|
-
|
|
205
|
-
matcher.class.ts:67
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
### calculatePriority
|
|
210
|
-
|
|
211
|
-
▸ `Private` **calculatePriority**(`...args`): `Promise`<`number`\>
|
|
212
|
-
|
|
213
|
-
#### Parameters
|
|
214
|
-
|
|
215
|
-
| Name | Type |
|
|
216
|
-
| :-------- | :---------------------------------------------------------- |
|
|
217
|
-
| `...args` | (`undefined` \| [`Assignment`](../modules.md#assignment))[] |
|
|
218
|
-
|
|
219
|
-
#### Returns
|
|
220
|
-
|
|
221
|
-
`Promise`<`number`\>
|
|
222
|
-
|
|
223
|
-
#### Defined in
|
|
224
|
-
|
|
225
|
-
matcher.class.ts:159
|
|
226
|
-
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
### getAllAssignments
|
|
230
|
-
|
|
231
|
-
▸ **getAllAssignments**(): `Promise`<[`Assignment`](../modules.md#assignment)[]\>
|
|
232
|
-
|
|
233
|
-
#### Returns
|
|
234
|
-
|
|
235
|
-
`Promise`<[`Assignment`](../modules.md#assignment)[]\>
|
|
236
|
-
|
|
237
|
-
#### Defined in
|
|
238
|
-
|
|
239
|
-
matcher.class.ts:136
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
### getCurrentAssignmentsForUser
|
|
244
|
-
|
|
245
|
-
▸ **getCurrentAssignmentsForUser**(`userId`): `Promise`<`string`[]\>
|
|
246
|
-
|
|
247
|
-
#### Parameters
|
|
248
|
-
|
|
249
|
-
| Name | Type |
|
|
250
|
-
| :------- | :------- |
|
|
251
|
-
| `userId` | `string` |
|
|
252
|
-
|
|
253
|
-
#### Returns
|
|
254
|
-
|
|
255
|
-
`Promise`<`string`[]\>
|
|
256
|
-
|
|
257
|
-
#### Defined in
|
|
258
|
-
|
|
259
|
-
matcher.class.ts:289
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
### getUserRelatedAssignments
|
|
264
|
-
|
|
265
|
-
▸ `Private` **getUserRelatedAssignments**(`user`): `Promise`<`any`[]\>
|
|
266
|
-
|
|
267
|
-
#### Parameters
|
|
268
|
-
|
|
269
|
-
| Name | Type |
|
|
270
|
-
| :----- | :------------------------------ |
|
|
271
|
-
| `user` | [`User`](../interfaces/User.md) |
|
|
272
|
-
|
|
273
|
-
#### Returns
|
|
274
|
-
|
|
275
|
-
`Promise`<`any`[]\>
|
|
276
|
-
|
|
277
|
-
#### Defined in
|
|
278
|
-
|
|
279
|
-
matcher.class.ts:203
|
|
280
|
-
|
|
281
|
-
---
|
|
282
|
-
|
|
283
|
-
### initRedis
|
|
284
|
-
|
|
285
|
-
▸ `Private` **initRedis**(): `Promise`<[`default`](default.md)\>
|
|
286
|
-
|
|
287
|
-
#### Returns
|
|
288
|
-
|
|
289
|
-
`Promise`<[`default`](default.md)\>
|
|
290
|
-
|
|
291
|
-
#### Defined in
|
|
292
|
-
|
|
293
|
-
matcher.class.ts:62
|
|
294
|
-
|
|
295
|
-
---
|
|
296
|
-
|
|
297
|
-
### matchScore
|
|
298
|
-
|
|
299
|
-
▸ `Private` **matchScore**(`user`, `assignmentTags`, `assignmentPriority`, `assignmentId?`): `Promise`<[`number`, `number`]\>
|
|
300
|
-
|
|
301
|
-
#### Parameters
|
|
302
|
-
|
|
303
|
-
| Name | Type |
|
|
304
|
-
| :------------------- | :------------------------------ |
|
|
305
|
-
| `user` | [`User`](../interfaces/User.md) |
|
|
306
|
-
| `assignmentTags` | `string` |
|
|
307
|
-
| `assignmentPriority` | `string` \| `number` |
|
|
308
|
-
| `assignmentId?` | `string` |
|
|
309
|
-
|
|
310
|
-
#### Returns
|
|
311
|
-
|
|
312
|
-
`Promise`<[`number`, `number`]\>
|
|
313
|
-
|
|
314
|
-
#### Defined in
|
|
315
|
-
|
|
316
|
-
matcher.class.ts:143
|
|
317
|
-
|
|
318
|
-
---
|
|
319
|
-
|
|
320
|
-
### matchUsersAssignments
|
|
321
|
-
|
|
322
|
-
▸ **matchUsersAssignments**(`userId?`): `Promise`<`void`\>
|
|
323
|
-
|
|
324
|
-
#### Parameters
|
|
325
|
-
|
|
326
|
-
| Name | Type |
|
|
327
|
-
| :-------- | :------- |
|
|
328
|
-
| `userId?` | `string` |
|
|
329
|
-
|
|
330
|
-
#### Returns
|
|
331
|
-
|
|
332
|
-
`Promise`<`void`\>
|
|
333
|
-
|
|
334
|
-
#### Defined in
|
|
335
|
-
|
|
336
|
-
matcher.class.ts:255
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
|
-
### removeAssignment
|
|
341
|
-
|
|
342
|
-
▸ **removeAssignment**(`id`): `Promise`<`string`\>
|
|
343
|
-
|
|
344
|
-
#### Parameters
|
|
345
|
-
|
|
346
|
-
| Name | Type |
|
|
347
|
-
| :--- | :------- |
|
|
348
|
-
| `id` | `string` |
|
|
349
|
-
|
|
350
|
-
#### Returns
|
|
351
|
-
|
|
352
|
-
`Promise`<`string`\>
|
|
353
|
-
|
|
354
|
-
#### Defined in
|
|
355
|
-
|
|
356
|
-
matcher.class.ts:110
|
|
357
|
-
|
|
358
|
-
---
|
|
359
|
-
|
|
360
|
-
### removeUser
|
|
361
|
-
|
|
362
|
-
▸ **removeUser**(`userId`): `Promise`<`string`\>
|
|
363
|
-
|
|
364
|
-
#### Parameters
|
|
365
|
-
|
|
366
|
-
| Name | Type |
|
|
367
|
-
| :------- | :------- |
|
|
368
|
-
| `userId` | `string` |
|
|
369
|
-
|
|
370
|
-
#### Returns
|
|
371
|
-
|
|
372
|
-
`Promise`<`string`\>
|
|
373
|
-
|
|
374
|
-
#### Defined in
|
|
375
|
-
|
|
376
|
-
matcher.class.ts:126
|
|
377
|
-
|
|
378
|
-
---
|
|
379
|
-
|
|
380
|
-
### setAssignmentPriority
|
|
381
|
-
|
|
382
|
-
▸ **setAssignmentPriority**(`id`, `priority`): `Promise`<{ `id`: `string` ; `priority`: `number` }\>
|
|
383
|
-
|
|
384
|
-
#### Parameters
|
|
385
|
-
|
|
386
|
-
| Name | Type |
|
|
387
|
-
| :--------- | :------- |
|
|
388
|
-
| `id` | `string` |
|
|
389
|
-
| `priority` | `number` |
|
|
390
|
-
|
|
391
|
-
#### Returns
|
|
392
|
-
|
|
393
|
-
`Promise`<{ `id`: `string` ; `priority`: `number` }\>
|
|
394
|
-
|
|
395
|
-
#### Defined in
|
|
396
|
-
|
|
397
|
-
matcher.class.ts:195
|
package/docs/interfaces/User.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
[assignment-engine](../README.md) / [Exports](../modules.md) / User
|
|
2
|
-
|
|
3
|
-
# Interface: User
|
|
4
|
-
|
|
5
|
-
## Indexable
|
|
6
|
-
|
|
7
|
-
▪ [key: `string`]: `any`
|
|
8
|
-
|
|
9
|
-
## Table of contents
|
|
10
|
-
|
|
11
|
-
### Properties
|
|
12
|
-
|
|
13
|
-
- [id](User.md#id)
|
|
14
|
-
- [tags](User.md#tags)
|
|
15
|
-
|
|
16
|
-
## Properties
|
|
17
|
-
|
|
18
|
-
### id
|
|
19
|
-
|
|
20
|
-
• **id**: `string`
|
|
21
|
-
|
|
22
|
-
#### Defined in
|
|
23
|
-
|
|
24
|
-
matcher.class.ts:5
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
### tags
|
|
29
|
-
|
|
30
|
-
• **tags**: `string`[]
|
|
31
|
-
|
|
32
|
-
#### Defined in
|
|
33
|
-
|
|
34
|
-
matcher.class.ts:6
|
package/docs/modules.md
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
[assignment-engine](README.md) / Exports
|
|
2
|
-
|
|
3
|
-
# assignment-engine
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Classes
|
|
8
|
-
|
|
9
|
-
- [default](classes/default.md)
|
|
10
|
-
|
|
11
|
-
### Interfaces
|
|
12
|
-
|
|
13
|
-
- [User](interfaces/User.md)
|
|
14
|
-
|
|
15
|
-
### Type Aliases
|
|
16
|
-
|
|
17
|
-
- [Assignment](modules.md#assignment)
|
|
18
|
-
- [RedisClientType](modules.md#redisclienttype)
|
|
19
|
-
- [Stats](modules.md#stats)
|
|
20
|
-
- [options](modules.md#options)
|
|
21
|
-
|
|
22
|
-
## Type Aliases
|
|
23
|
-
|
|
24
|
-
### Assignment
|
|
25
|
-
|
|
26
|
-
Ƭ **Assignment**: `Object`
|
|
27
|
-
|
|
28
|
-
#### Index signature
|
|
29
|
-
|
|
30
|
-
▪ [key: `string`]: `any`
|
|
31
|
-
|
|
32
|
-
#### Type declaration
|
|
33
|
-
|
|
34
|
-
| Name | Type |
|
|
35
|
-
| :---------- | :--------- |
|
|
36
|
-
| `id` | `string` |
|
|
37
|
-
| `priority?` | `number` |
|
|
38
|
-
| `tags` | `string`[] |
|
|
39
|
-
|
|
40
|
-
#### Defined in
|
|
41
|
-
|
|
42
|
-
matcher.class.ts:10
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
### RedisClientType
|
|
47
|
-
|
|
48
|
-
Ƭ **RedisClientType**: `ReturnType`<typeof `createClient`\>
|
|
49
|
-
|
|
50
|
-
#### Defined in
|
|
51
|
-
|
|
52
|
-
matcher.class.ts:2
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
### Stats
|
|
57
|
-
|
|
58
|
-
Ƭ **Stats**: `Object`
|
|
59
|
-
|
|
60
|
-
#### Type declaration
|
|
61
|
-
|
|
62
|
-
| Name | Type |
|
|
63
|
-
| :------------------------ | :--------- |
|
|
64
|
-
| `remainingAssignments?` | `number` |
|
|
65
|
-
| `users?` | `number` |
|
|
66
|
-
| `usersWithoutAssignment?` | `string`[] |
|
|
67
|
-
|
|
68
|
-
#### Defined in
|
|
69
|
-
|
|
70
|
-
matcher.class.ts:17
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
### options
|
|
75
|
-
|
|
76
|
-
Ƭ **options**: `Object`
|
|
77
|
-
|
|
78
|
-
#### Type declaration
|
|
79
|
-
|
|
80
|
-
| Name | Type |
|
|
81
|
-
| :------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
82
|
-
| `enableDefaultMatching?` | `boolean` |
|
|
83
|
-
| `matchingFunction?` | (`user`: [`User`](interfaces/User.md), `assignmentTags`: `string`, `assignmentPriority`: `number` \| `string`, `assignmentId?`: `string`) => `Promise`<[`number`, `number`]\> |
|
|
84
|
-
| `maxUserBacklogSize?` | `number` |
|
|
85
|
-
| `prioritizationFunction?` | (...`args`: ([`Assignment`](modules.md#assignment) \| `undefined`)[]) => `Promise`<`number`\> |
|
|
86
|
-
| `redisPrefix?` | `string` |
|
|
87
|
-
| `relevantBatchSize?` | `number` |
|
|
88
|
-
|
|
89
|
-
#### Defined in
|
|
90
|
-
|
|
91
|
-
matcher.class.ts:23
|