1 | import * as assert from 'assert'
|
2 |
|
3 | export const Strings = {
|
4 | BadMessageKey: 'Bad Message Key: ?0',
|
5 |
|
6 | ManagerFailedToStart: 'Coordinator failed to start',
|
7 | ManagerErrorFn: 'Coordinator Function failed ?0',
|
8 | ManagerInitialized: 'Coordinator is already initialized',
|
9 | ManagerNotInitialized: 'Coordinator not initialized',
|
10 | ManagerSettled: 'Coordinator is settled',
|
11 | ManagerNotSettled: 'Coordinator not settled',
|
12 | ManagerInitComplete: 'dont forget to start when models are prepared, start triggers model prep, including table create',
|
13 | ManagerNoSyncModels: 'Create tables is disabled, nothing to prepare',
|
14 | ManagerOnlyOneKeyType: 'An attribute can only have 1 key type ?0',
|
15 | ManagerTypeStoreRequired: 'TypeStore required on options',
|
16 | PromiseUnhandledRejection: 'Unhandled promise rejection ?0',
|
17 | PromiseRejected: 'Handled rejection - just for debugging/tracing'
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | export function msg(str, ...args) {
|
30 | if (!str) {
|
31 | str = Strings.BadMessageKey
|
32 | args.splice(0,0,str)
|
33 | }
|
34 |
|
35 | args.forEach((arg,index) => {
|
36 | str = str.replace(new RegExp(`\\?${index}`),arg)
|
37 | })
|
38 |
|
39 | return str
|
40 | }
|