dce-reactkit 3.2.0-beta.7 → 3.2.0-beta.9
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/cjs/index.js +69 -64
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/types/LogBuiltInMetadata.d.ts +15 -0
- package/dist/cjs/types/types/LogFunction.d.ts +1 -1
- package/dist/esm/index.js +69 -64
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/types/LogBuiltInMetadata.d.ts +15 -0
- package/dist/esm/types/types/LogFunction.d.ts +1 -1
- package/dist/index.d.ts +12 -7
- package/package.json +1 -1
- package/src/helpers/genRouteHandler.ts +16 -9
- package/src/helpers/logClientEvent.tsx +9 -6
- package/src/index.ts +1 -1
- package/src/types/LogBuiltInMetadata.ts +18 -0
- package/src/types/LogFunction.ts +5 -3
- package/dist/cjs/types/types/LogBuiltInCategory.d.ts +0 -10
- package/dist/esm/types/types/LogBuiltInCategory.d.ts +0 -10
- package/src/types/LogBuiltInCategory.ts +0 -11
|
@@ -54,6 +54,6 @@ import Log from './types/Log';
|
|
|
54
54
|
import LogType from './types/LogType';
|
|
55
55
|
import LogSource from './types/LogSource';
|
|
56
56
|
import LogAction from './types/LogAction';
|
|
57
|
-
import LogBuiltInCategory from './types/
|
|
57
|
+
import LogBuiltInCategory from './types/LogBuiltInMetadata';
|
|
58
58
|
import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
59
59
|
export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, visitServerEndpoint, logClientEvent, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInCategory, PickableItem, ParamType, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in categories for logs
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
declare const LogBuiltInMetadata: {
|
|
6
|
+
Category: {
|
|
7
|
+
Uncategorized: string;
|
|
8
|
+
ServerRenderedErrorPage: string;
|
|
9
|
+
ServerEndpointError: string;
|
|
10
|
+
};
|
|
11
|
+
Target: {
|
|
12
|
+
NoSpecificTarget: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default LogBuiltInMetadata;
|
package/dist/index.d.ts
CHANGED
|
@@ -645,8 +645,8 @@ declare type LogFunction = (opts: ({
|
|
|
645
645
|
} & ({
|
|
646
646
|
error: any;
|
|
647
647
|
} | {
|
|
648
|
-
target: string;
|
|
649
648
|
action: LogAction;
|
|
649
|
+
target?: string;
|
|
650
650
|
}))) => Promise<Log>;
|
|
651
651
|
|
|
652
652
|
/**
|
|
@@ -886,10 +886,15 @@ declare enum DayOfWeek {
|
|
|
886
886
|
* Built-in categories for logs
|
|
887
887
|
* @author Gabe Abrams
|
|
888
888
|
*/
|
|
889
|
-
declare
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
889
|
+
declare const LogBuiltInMetadata: {
|
|
890
|
+
Category: {
|
|
891
|
+
Uncategorized: string;
|
|
892
|
+
ServerRenderedErrorPage: string;
|
|
893
|
+
ServerEndpointError: string;
|
|
894
|
+
};
|
|
895
|
+
Target: {
|
|
896
|
+
NoSpecificTarget: string;
|
|
897
|
+
};
|
|
898
|
+
};
|
|
894
899
|
|
|
895
|
-
export { AppWrapper, ButtonInputGroup, CheckboxButton, CopiableBox, DAY_IN_MS, DayOfWeek, Drawer, ErrorBox, ErrorWithCode, HOUR_IN_MS, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInCategory, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, Variant, abbreviate, alert, avg, ceilToNumDecimals, confirm, floorToNumDecimals, forceNumIntoBounds, genRouteHandler, getHumanReadableDate, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initLogCollection, initServer, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
|
|
900
|
+
export { AppWrapper, ButtonInputGroup, CheckboxButton, CopiableBox, DAY_IN_MS, DayOfWeek, Drawer, ErrorBox, ErrorWithCode, HOUR_IN_MS, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata as LogBuiltInCategory, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, Variant, abbreviate, alert, avg, ceilToNumDecimals, confirm, floorToNumDecimals, forceNumIntoBounds, genRouteHandler, getHumanReadableDate, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, initLogCollection, initServer, logClientEvent, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, roundToNumDecimals, showFatalError, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, visitServerEndpoint, waitMs };
|
package/package.json
CHANGED
|
@@ -23,7 +23,8 @@ import LogSource from '../types/LogSource';
|
|
|
23
23
|
import LogTypeSpecificInfo from '../types/Log/LogTypeSpecificInfo';
|
|
24
24
|
import LogMainInfo from '../types/Log/LogMainInfo';
|
|
25
25
|
import LogSourceSpecificInfo from '../types/Log/LogSourceSpecificInfo';
|
|
26
|
-
import
|
|
26
|
+
import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
|
|
27
|
+
import LogAction from '../types/LogAction';
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Generate an express API route handler
|
|
@@ -512,7 +513,7 @@ const genRouteHandler = (
|
|
|
512
513
|
? opts.category
|
|
513
514
|
: (
|
|
514
515
|
((opts.category as any) ?? {})._
|
|
515
|
-
??
|
|
516
|
+
?? LogBuiltInMetadata.Category.Uncategorized
|
|
516
517
|
)
|
|
517
518
|
),
|
|
518
519
|
subcategory: (
|
|
@@ -520,7 +521,7 @@ const genRouteHandler = (
|
|
|
520
521
|
? opts.subcategory
|
|
521
522
|
: (
|
|
522
523
|
((opts.subcategory as any) ?? {})._
|
|
523
|
-
??
|
|
524
|
+
?? LogBuiltInMetadata.Category.Uncategorized
|
|
524
525
|
)
|
|
525
526
|
),
|
|
526
527
|
tags: opts.tags ?? [],
|
|
@@ -538,8 +539,14 @@ const genRouteHandler = (
|
|
|
538
539
|
}
|
|
539
540
|
: {
|
|
540
541
|
type: LogType.Action,
|
|
541
|
-
target: (
|
|
542
|
-
|
|
542
|
+
target: (
|
|
543
|
+
(opts as any).target
|
|
544
|
+
?? LogBuiltInMetadata.Target.NoSpecificTarget
|
|
545
|
+
),
|
|
546
|
+
action: (
|
|
547
|
+
(opts as any).action
|
|
548
|
+
?? LogAction.Unknown
|
|
549
|
+
),
|
|
543
550
|
}
|
|
544
551
|
);
|
|
545
552
|
|
|
@@ -611,8 +618,8 @@ const genRouteHandler = (
|
|
|
611
618
|
timestamp: Date.now(),
|
|
612
619
|
tags: [],
|
|
613
620
|
metadata: {},
|
|
614
|
-
category:
|
|
615
|
-
subcategory:
|
|
621
|
+
category: LogBuiltInMetadata.Category.Uncategorized,
|
|
622
|
+
subcategory: LogBuiltInMetadata.Category.Uncategorized,
|
|
616
623
|
};
|
|
617
624
|
|
|
618
625
|
const dummyTypeSpecificInfo: LogTypeSpecificInfo = {
|
|
@@ -692,7 +699,7 @@ const genRouteHandler = (
|
|
|
692
699
|
|
|
693
700
|
// Log
|
|
694
701
|
logServerEvent({
|
|
695
|
-
category:
|
|
702
|
+
category: LogBuiltInMetadata.Category.ServerRenderedErrorPage,
|
|
696
703
|
error: {
|
|
697
704
|
message: `${opts.title}: ${opts.description}`,
|
|
698
705
|
code: opts.code,
|
|
@@ -733,7 +740,7 @@ const genRouteHandler = (
|
|
|
733
740
|
|
|
734
741
|
// Log server-side error
|
|
735
742
|
logServerEvent({
|
|
736
|
-
category:
|
|
743
|
+
category: LogBuiltInMetadata.Category.ServerEndpointError,
|
|
737
744
|
error: err,
|
|
738
745
|
});
|
|
739
746
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Import shared types
|
|
2
2
|
import LOG_ROUTE_PATH from '../constants/LOG_ROUTE_PATH';
|
|
3
|
-
import
|
|
3
|
+
import LogBuiltInMetadata from '../types/LogBuiltInMetadata';
|
|
4
4
|
import LogFunction from '../types/LogFunction';
|
|
5
5
|
|
|
6
6
|
// Import shared functions
|
|
@@ -20,7 +20,7 @@ const logClientEvent: LogFunction = async (opts) => {
|
|
|
20
20
|
? opts.category
|
|
21
21
|
: (
|
|
22
22
|
((opts.category as any) ?? {})._
|
|
23
|
-
??
|
|
23
|
+
?? LogBuiltInMetadata.Category.Uncategorized
|
|
24
24
|
)
|
|
25
25
|
),
|
|
26
26
|
subcategory: (
|
|
@@ -28,10 +28,10 @@ const logClientEvent: LogFunction = async (opts) => {
|
|
|
28
28
|
? opts.subcategory
|
|
29
29
|
: (
|
|
30
30
|
((opts.subcategory as any) ?? {})._
|
|
31
|
-
??
|
|
31
|
+
?? LogBuiltInMetadata.Category.Uncategorized
|
|
32
32
|
)
|
|
33
33
|
),
|
|
34
|
-
tags: JSON.stringify(opts.tags),
|
|
34
|
+
tags: JSON.stringify(opts.tags ?? []),
|
|
35
35
|
metadata: JSON.stringify(opts.metadata ?? {}),
|
|
36
36
|
errorMessage: (
|
|
37
37
|
(opts as any).error
|
|
@@ -49,8 +49,11 @@ const logClientEvent: LogFunction = async (opts) => {
|
|
|
49
49
|
: undefined
|
|
50
50
|
),
|
|
51
51
|
target: (
|
|
52
|
-
(opts as any).
|
|
53
|
-
? (
|
|
52
|
+
(opts as any).action
|
|
53
|
+
? (
|
|
54
|
+
(opts as any).target
|
|
55
|
+
?? LogBuiltInMetadata.Target.NoSpecificTarget
|
|
56
|
+
)
|
|
54
57
|
: undefined
|
|
55
58
|
),
|
|
56
59
|
action: (
|
package/src/index.ts
CHANGED
|
@@ -63,7 +63,7 @@ import Log from './types/Log';
|
|
|
63
63
|
import LogType from './types/LogType';
|
|
64
64
|
import LogSource from './types/LogSource';
|
|
65
65
|
import LogAction from './types/LogAction';
|
|
66
|
-
import LogBuiltInCategory from './types/
|
|
66
|
+
import LogBuiltInCategory from './types/LogBuiltInMetadata';
|
|
67
67
|
|
|
68
68
|
// Component-specific-types
|
|
69
69
|
import PickableItem from './components/ItemPicker/types/PickableItem';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in categories for logs
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
*/
|
|
5
|
+
const LogBuiltInMetadata = {
|
|
6
|
+
// Categories
|
|
7
|
+
Category: {
|
|
8
|
+
Uncategorized: 'n/a',
|
|
9
|
+
ServerRenderedErrorPage: '_server-rendered-error-page',
|
|
10
|
+
ServerEndpointError: '_server-endpoint-error',
|
|
11
|
+
},
|
|
12
|
+
// Targets
|
|
13
|
+
Target: {
|
|
14
|
+
NoSpecificTarget: 'n/a',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default LogBuiltInMetadata;
|
package/src/types/LogFunction.ts
CHANGED
|
@@ -28,11 +28,13 @@ type LogFunction = (
|
|
|
28
28
|
}
|
|
29
29
|
// Action
|
|
30
30
|
| {
|
|
31
|
+
// The type of action performed
|
|
32
|
+
action: LogAction,
|
|
31
33
|
// Target of the action (each app determines the list of targets)
|
|
32
34
|
// These are usually buttons, panels, elements, etc.
|
|
33
|
-
target
|
|
34
|
-
//
|
|
35
|
-
|
|
35
|
+
// If no target is included, this should indicate that this is an action
|
|
36
|
+
// being performed on the whole feature (open/close/etc)
|
|
37
|
+
target?: string,
|
|
36
38
|
}
|
|
37
39
|
)
|
|
38
40
|
),
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Built-in categories for logs
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
declare enum LogBuiltInCategory {
|
|
6
|
-
Uncategorized = "n/a",
|
|
7
|
-
ServerRenderedErrorPage = "_server-rendered-error-page",
|
|
8
|
-
ServerEndpointError = "_server-endpoint-error"
|
|
9
|
-
}
|
|
10
|
-
export default LogBuiltInCategory;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Built-in categories for logs
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
declare enum LogBuiltInCategory {
|
|
6
|
-
Uncategorized = "n/a",
|
|
7
|
-
ServerRenderedErrorPage = "_server-rendered-error-page",
|
|
8
|
-
ServerEndpointError = "_server-endpoint-error"
|
|
9
|
-
}
|
|
10
|
-
export default LogBuiltInCategory;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Built-in categories for logs
|
|
3
|
-
* @author Gabe Abrams
|
|
4
|
-
*/
|
|
5
|
-
enum LogBuiltInCategory {
|
|
6
|
-
Uncategorized = 'n/a',
|
|
7
|
-
ServerRenderedErrorPage = '_server-rendered-error-page',
|
|
8
|
-
ServerEndpointError = '_server-endpoint-error',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default LogBuiltInCategory;
|