@dappermountain/payload-plugin-achievements 1.0.0-beta.3 → 1.1.0
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/README.md +22 -8
- package/dist/admin/LucideIconField.d.ts +1 -0
- package/dist/admin/LucideIconField.d.ts.map +1 -1
- package/dist/admin/LucideIconField.js +54 -101
- package/dist/admin/ReconcileProgressionButton.d.ts +1 -1
- package/dist/admin/ReconcileProgressionButton.d.ts.map +1 -1
- package/dist/admin/ReconcileProgressionButton.js +21 -7
- package/dist/admin/useEventTypeFlags.d.ts.map +1 -1
- package/dist/admin/useEventTypeFlags.js +7 -4
- package/dist/admin/usePluginT.d.ts +6 -0
- package/dist/admin/usePluginT.d.ts.map +1 -0
- package/dist/admin/usePluginT.js +10 -0
- package/dist/adminLabel.d.ts +17 -0
- package/dist/adminLabel.d.ts.map +1 -0
- package/dist/adminLabel.js +28 -0
- package/dist/catalog.d.ts +10 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +7 -1
- package/dist/collections/AchievementRequests/hooks/prepareAchievementRequest.d.ts.map +1 -1
- package/dist/collections/AchievementRequests/hooks/prepareAchievementRequest.js +8 -7
- package/dist/collections/AchievementRequests/index.d.ts.map +1 -1
- package/dist/collections/AchievementRequests/index.js +19 -5
- package/dist/collections/Achievements/index.d.ts.map +1 -1
- package/dist/collections/Achievements/index.js +30 -13
- package/dist/collections/EventTypes/index.d.ts.map +1 -1
- package/dist/collections/EventTypes/index.js +26 -12
- package/dist/collections/Grants/hooks/ensureUniqueGrant.js +2 -2
- package/dist/collections/Grants/index.d.ts.map +1 -1
- package/dist/collections/Grants/index.js +51 -11
- package/dist/collections/Logs/fields/validators.d.ts.map +1 -1
- package/dist/collections/Logs/fields/validators.js +8 -7
- package/dist/collections/Logs/hooks/ensureTypeRequirements.d.ts.map +1 -1
- package/dist/collections/Logs/hooks/ensureTypeRequirements.js +9 -7
- package/dist/collections/Logs/index.d.ts.map +1 -1
- package/dist/collections/Logs/index.js +33 -15
- package/dist/collections/MetricBalances/index.d.ts.map +1 -1
- package/dist/collections/MetricBalances/index.js +9 -3
- package/dist/collections/Metrics/index.d.ts.map +1 -1
- package/dist/collections/Metrics/index.js +35 -16
- package/dist/collections/Reactions/index.d.ts.map +1 -1
- package/dist/collections/Reactions/index.js +25 -13
- package/dist/collections/TierRequests/hooks/prepareTierRequest.d.ts.map +1 -1
- package/dist/collections/TierRequests/hooks/prepareTierRequest.js +8 -7
- package/dist/collections/TierRequests/index.d.ts.map +1 -1
- package/dist/collections/TierRequests/index.js +13 -7
- package/dist/collections/Tiers/index.d.ts.map +1 -1
- package/dist/collections/Tiers/index.js +18 -8
- package/dist/collections/fields/index.d.ts +1 -1
- package/dist/collections/fields/index.d.ts.map +1 -1
- package/dist/collections/fields/index.js +1 -1
- package/dist/collections/fields/localizedText.d.ts.map +1 -1
- package/dist/collections/fields/localizedText.js +3 -0
- package/dist/collections/fields/ruleFields.d.ts +27 -14
- package/dist/collections/fields/ruleFields.d.ts.map +1 -1
- package/dist/collections/fields/ruleFields.js +107 -34
- package/dist/collections/fields/scopeField.d.ts.map +1 -1
- package/dist/collections/fields/scopeField.js +3 -1
- package/dist/collections/fields/userField.d.ts.map +1 -1
- package/dist/collections/fields/userField.js +2 -0
- package/dist/collections/fields/usersAchievementsGroup.d.ts.map +1 -1
- package/dist/collections/fields/usersAchievementsGroup.js +2 -1
- package/dist/collections/helpers.d.ts.map +1 -1
- package/dist/collections/helpers.js +2 -1
- package/dist/collections/hooks/preventCatalogDelete.d.ts.map +1 -1
- package/dist/collections/hooks/preventCatalogDelete.js +6 -3
- package/dist/collections/slugs.d.ts +5 -2
- package/dist/collections/slugs.d.ts.map +1 -1
- package/dist/collections/slugs.js +7 -5
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.d.ts.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +2 -1
- package/dist/extensions/elapsedSinceOptions.d.ts +1 -1
- package/dist/extensions/elapsedSinceOptions.d.ts.map +1 -1
- package/dist/extensions/elapsedSinceOptions.js +4 -3
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +20 -0
- package/dist/seed/index.d.ts +2 -0
- package/dist/seed/index.d.ts.map +1 -1
- package/dist/seed/index.js +1 -0
- package/dist/services/achievement/builtInRules.d.ts.map +1 -1
- package/dist/services/achievement/builtInRules.js +10 -2
- package/dist/services/achievement/grantLifecycle.d.ts +31 -0
- package/dist/services/achievement/grantLifecycle.d.ts.map +1 -0
- package/dist/services/achievement/grantLifecycle.js +139 -0
- package/dist/services/achievement/grantSideEffects.d.ts +22 -0
- package/dist/services/achievement/grantSideEffects.d.ts.map +1 -1
- package/dist/services/achievement/grantSideEffects.js +89 -1
- package/dist/services/achievement/index.d.ts +1 -0
- package/dist/services/achievement/index.d.ts.map +1 -1
- package/dist/services/achievement/index.js +1 -0
- package/dist/services/achievement/logData.d.ts +3 -2
- package/dist/services/achievement/logData.d.ts.map +1 -1
- package/dist/translations/index.d.ts +8723 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +96 -0
- package/dist/translations/keys.d.ts +4 -0
- package/dist/translations/keys.d.ts.map +1 -0
- package/dist/translations/keys.js +5 -0
- package/dist/translations/languages/ar.d.ts +199 -0
- package/dist/translations/languages/ar.d.ts.map +1 -0
- package/dist/translations/languages/ar.js +198 -0
- package/dist/translations/languages/az.d.ts +199 -0
- package/dist/translations/languages/az.d.ts.map +1 -0
- package/dist/translations/languages/az.js +198 -0
- package/dist/translations/languages/bg.d.ts +199 -0
- package/dist/translations/languages/bg.d.ts.map +1 -0
- package/dist/translations/languages/bg.js +198 -0
- package/dist/translations/languages/bnBd.d.ts +199 -0
- package/dist/translations/languages/bnBd.d.ts.map +1 -0
- package/dist/translations/languages/bnBd.js +198 -0
- package/dist/translations/languages/bnIn.d.ts +199 -0
- package/dist/translations/languages/bnIn.d.ts.map +1 -0
- package/dist/translations/languages/bnIn.js +198 -0
- package/dist/translations/languages/ca.d.ts +199 -0
- package/dist/translations/languages/ca.d.ts.map +1 -0
- package/dist/translations/languages/ca.js +198 -0
- package/dist/translations/languages/cs.d.ts +199 -0
- package/dist/translations/languages/cs.d.ts.map +1 -0
- package/dist/translations/languages/cs.js +198 -0
- package/dist/translations/languages/da.d.ts +199 -0
- package/dist/translations/languages/da.d.ts.map +1 -0
- package/dist/translations/languages/da.js +198 -0
- package/dist/translations/languages/de.d.ts +199 -0
- package/dist/translations/languages/de.d.ts.map +1 -0
- package/dist/translations/languages/de.js +198 -0
- package/dist/translations/languages/en.d.ts +199 -0
- package/dist/translations/languages/en.d.ts.map +1 -0
- package/dist/translations/languages/en.js +198 -0
- package/dist/translations/languages/es.d.ts +199 -0
- package/dist/translations/languages/es.d.ts.map +1 -0
- package/dist/translations/languages/es.js +198 -0
- package/dist/translations/languages/et.d.ts +199 -0
- package/dist/translations/languages/et.d.ts.map +1 -0
- package/dist/translations/languages/et.js +198 -0
- package/dist/translations/languages/fa.d.ts +199 -0
- package/dist/translations/languages/fa.d.ts.map +1 -0
- package/dist/translations/languages/fa.js +198 -0
- package/dist/translations/languages/fr.d.ts +199 -0
- package/dist/translations/languages/fr.d.ts.map +1 -0
- package/dist/translations/languages/fr.js +198 -0
- package/dist/translations/languages/he.d.ts +199 -0
- package/dist/translations/languages/he.d.ts.map +1 -0
- package/dist/translations/languages/he.js +198 -0
- package/dist/translations/languages/hr.d.ts +199 -0
- package/dist/translations/languages/hr.d.ts.map +1 -0
- package/dist/translations/languages/hr.js +198 -0
- package/dist/translations/languages/hu.d.ts +199 -0
- package/dist/translations/languages/hu.d.ts.map +1 -0
- package/dist/translations/languages/hu.js +198 -0
- package/dist/translations/languages/hy.d.ts +199 -0
- package/dist/translations/languages/hy.d.ts.map +1 -0
- package/dist/translations/languages/hy.js +198 -0
- package/dist/translations/languages/id.d.ts +199 -0
- package/dist/translations/languages/id.d.ts.map +1 -0
- package/dist/translations/languages/id.js +198 -0
- package/dist/translations/languages/is.d.ts +199 -0
- package/dist/translations/languages/is.d.ts.map +1 -0
- package/dist/translations/languages/is.js +198 -0
- package/dist/translations/languages/it.d.ts +199 -0
- package/dist/translations/languages/it.d.ts.map +1 -0
- package/dist/translations/languages/it.js +198 -0
- package/dist/translations/languages/ja.d.ts +199 -0
- package/dist/translations/languages/ja.d.ts.map +1 -0
- package/dist/translations/languages/ja.js +198 -0
- package/dist/translations/languages/ko.d.ts +199 -0
- package/dist/translations/languages/ko.d.ts.map +1 -0
- package/dist/translations/languages/ko.js +198 -0
- package/dist/translations/languages/lt.d.ts +199 -0
- package/dist/translations/languages/lt.d.ts.map +1 -0
- package/dist/translations/languages/lt.js +198 -0
- package/dist/translations/languages/lv.d.ts +199 -0
- package/dist/translations/languages/lv.d.ts.map +1 -0
- package/dist/translations/languages/lv.js +198 -0
- package/dist/translations/languages/my.d.ts +199 -0
- package/dist/translations/languages/my.d.ts.map +1 -0
- package/dist/translations/languages/my.js +198 -0
- package/dist/translations/languages/nb.d.ts +199 -0
- package/dist/translations/languages/nb.d.ts.map +1 -0
- package/dist/translations/languages/nb.js +198 -0
- package/dist/translations/languages/nl.d.ts +199 -0
- package/dist/translations/languages/nl.d.ts.map +1 -0
- package/dist/translations/languages/nl.js +198 -0
- package/dist/translations/languages/pl.d.ts +199 -0
- package/dist/translations/languages/pl.d.ts.map +1 -0
- package/dist/translations/languages/pl.js +198 -0
- package/dist/translations/languages/pt.d.ts +199 -0
- package/dist/translations/languages/pt.d.ts.map +1 -0
- package/dist/translations/languages/pt.js +198 -0
- package/dist/translations/languages/ro.d.ts +199 -0
- package/dist/translations/languages/ro.d.ts.map +1 -0
- package/dist/translations/languages/ro.js +198 -0
- package/dist/translations/languages/rs.d.ts +199 -0
- package/dist/translations/languages/rs.d.ts.map +1 -0
- package/dist/translations/languages/rs.js +198 -0
- package/dist/translations/languages/rsLatin.d.ts +199 -0
- package/dist/translations/languages/rsLatin.d.ts.map +1 -0
- package/dist/translations/languages/rsLatin.js +198 -0
- package/dist/translations/languages/ru.d.ts +199 -0
- package/dist/translations/languages/ru.d.ts.map +1 -0
- package/dist/translations/languages/ru.js +198 -0
- package/dist/translations/languages/sk.d.ts +199 -0
- package/dist/translations/languages/sk.d.ts.map +1 -0
- package/dist/translations/languages/sk.js +198 -0
- package/dist/translations/languages/sl.d.ts +199 -0
- package/dist/translations/languages/sl.d.ts.map +1 -0
- package/dist/translations/languages/sl.js +198 -0
- package/dist/translations/languages/sv.d.ts +199 -0
- package/dist/translations/languages/sv.d.ts.map +1 -0
- package/dist/translations/languages/sv.js +198 -0
- package/dist/translations/languages/ta.d.ts +199 -0
- package/dist/translations/languages/ta.d.ts.map +1 -0
- package/dist/translations/languages/ta.js +198 -0
- package/dist/translations/languages/th.d.ts +199 -0
- package/dist/translations/languages/th.d.ts.map +1 -0
- package/dist/translations/languages/th.js +198 -0
- package/dist/translations/languages/tr.d.ts +199 -0
- package/dist/translations/languages/tr.d.ts.map +1 -0
- package/dist/translations/languages/tr.js +198 -0
- package/dist/translations/languages/uk.d.ts +199 -0
- package/dist/translations/languages/uk.d.ts.map +1 -0
- package/dist/translations/languages/uk.js +198 -0
- package/dist/translations/languages/vi.d.ts +199 -0
- package/dist/translations/languages/vi.d.ts.map +1 -0
- package/dist/translations/languages/vi.js +198 -0
- package/dist/translations/languages/zh.d.ts +199 -0
- package/dist/translations/languages/zh.d.ts.map +1 -0
- package/dist/translations/languages/zh.js +198 -0
- package/dist/translations/languages/zhTw.d.ts +199 -0
- package/dist/translations/languages/zhTw.d.ts.map +1 -0
- package/dist/translations/languages/zhTw.js +198 -0
- package/dist/translations/reqT.d.ts +14 -0
- package/dist/translations/reqT.d.ts.map +1 -0
- package/dist/translations/reqT.js +26 -0
- package/dist/types.d.ts +8 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tEntityDescription, tLabel } from '../../adminLabel.js';
|
|
1
2
|
import { catalogFilterOptions, metricLogFilterOptions } from '../fields/catalogFilter.js';
|
|
2
3
|
import { collectionAdmin, collectionOf, optionalFields, slugOf } from '../helpers.js';
|
|
3
4
|
import { getAchievementOptions } from '../../options-store.js';
|
|
@@ -15,8 +16,9 @@ function subjectLogField(eventTypesSlug) {
|
|
|
15
16
|
relationTo: collections,
|
|
16
17
|
index: true,
|
|
17
18
|
validate: validateSubject,
|
|
19
|
+
label: tLabel('subject'),
|
|
18
20
|
admin: {
|
|
19
|
-
description: '
|
|
21
|
+
description: tLabel('hostDocumentThisEntryIsAboutPostComment'),
|
|
20
22
|
components: {
|
|
21
23
|
Field: {
|
|
22
24
|
path: '@dappermountain/payload-plugin-achievements/client#SubjectField',
|
|
@@ -34,8 +36,8 @@ export function buildLogsCollection() {
|
|
|
34
36
|
return {
|
|
35
37
|
slug: slugOf('logs'),
|
|
36
38
|
labels: {
|
|
37
|
-
singular: '
|
|
38
|
-
plural: '
|
|
39
|
+
singular: tLabel('achievementLog'),
|
|
40
|
+
plural: tLabel('achievementLogs'),
|
|
39
41
|
},
|
|
40
42
|
access: { ...access },
|
|
41
43
|
hooks,
|
|
@@ -50,7 +52,7 @@ export function buildLogsCollection() {
|
|
|
50
52
|
'change',
|
|
51
53
|
'createdAt',
|
|
52
54
|
],
|
|
53
|
-
description: '
|
|
55
|
+
description: tEntityDescription('memberActivityHistoryGrantsRevokesScoreChangesTier'),
|
|
54
56
|
}),
|
|
55
57
|
fields: [
|
|
56
58
|
...optionalFields(scopeField()),
|
|
@@ -65,7 +67,11 @@ export function buildLogsCollection() {
|
|
|
65
67
|
required: true,
|
|
66
68
|
index: true,
|
|
67
69
|
filterOptions: catalogFilterOptions,
|
|
68
|
-
|
|
70
|
+
label: tLabel('eventType'),
|
|
71
|
+
admin: {
|
|
72
|
+
width: '50%',
|
|
73
|
+
description: tLabel('whatKindOfThingHappened'),
|
|
74
|
+
},
|
|
69
75
|
},
|
|
70
76
|
{
|
|
71
77
|
name: 'actor',
|
|
@@ -73,9 +79,10 @@ export function buildLogsCollection() {
|
|
|
73
79
|
relationTo: users,
|
|
74
80
|
index: true,
|
|
75
81
|
validate: validateActor,
|
|
82
|
+
label: tLabel('actor'),
|
|
76
83
|
admin: {
|
|
77
84
|
width: '50%',
|
|
78
|
-
description: '
|
|
85
|
+
description: tLabel('whoCausedIt'),
|
|
79
86
|
components: {
|
|
80
87
|
Field: {
|
|
81
88
|
path: '@dappermountain/payload-plugin-achievements/client#ActorField',
|
|
@@ -90,9 +97,10 @@ export function buildLogsCollection() {
|
|
|
90
97
|
relationTo: collectionOf('metrics'),
|
|
91
98
|
filterOptions: metricLogFilterOptions,
|
|
92
99
|
validate: validateMetric,
|
|
100
|
+
label: tLabel('metric'),
|
|
93
101
|
admin: {
|
|
94
102
|
width: '50%',
|
|
95
|
-
description: '
|
|
103
|
+
description: tLabel('whichStoredScoreMovedComputedMetricsLikeDays'),
|
|
96
104
|
components: {
|
|
97
105
|
Field: {
|
|
98
106
|
path: '@dappermountain/payload-plugin-achievements/client#MetricField',
|
|
@@ -105,9 +113,10 @@ export function buildLogsCollection() {
|
|
|
105
113
|
name: 'change',
|
|
106
114
|
type: 'number',
|
|
107
115
|
validate: validateChange,
|
|
116
|
+
label: tLabel('change'),
|
|
108
117
|
admin: {
|
|
109
118
|
width: '50%',
|
|
110
|
-
description: '
|
|
119
|
+
description: tLabel('howMuchItChangedForExample10Or'),
|
|
111
120
|
components: {
|
|
112
121
|
Field: {
|
|
113
122
|
path: '@dappermountain/payload-plugin-achievements/client#MetricChangeField',
|
|
@@ -124,7 +133,7 @@ export function buildLogsCollection() {
|
|
|
124
133
|
type: 'array',
|
|
125
134
|
admin: {
|
|
126
135
|
readOnly: true,
|
|
127
|
-
description: '
|
|
136
|
+
description: tLabel('derivedLadderRankOfTheActorWhenThis'),
|
|
128
137
|
},
|
|
129
138
|
fields: [
|
|
130
139
|
...optionalFields(scopeField()),
|
|
@@ -133,34 +142,43 @@ export function buildLogsCollection() {
|
|
|
133
142
|
type: 'relationship',
|
|
134
143
|
relationTo: collectionOf('tiers'),
|
|
135
144
|
required: true,
|
|
136
|
-
|
|
145
|
+
label: tLabel('tier'),
|
|
146
|
+
admin: {
|
|
147
|
+
description: tLabel('whichLadderStepTheyHeld'),
|
|
148
|
+
},
|
|
137
149
|
},
|
|
138
150
|
{
|
|
139
151
|
name: 'rank',
|
|
140
152
|
type: 'number',
|
|
141
153
|
required: true,
|
|
142
|
-
|
|
154
|
+
label: tLabel('rank'),
|
|
155
|
+
admin: {
|
|
156
|
+
description: tLabel('ladderRankAtWriteTimeHigherIsFurther'),
|
|
157
|
+
},
|
|
143
158
|
},
|
|
144
159
|
],
|
|
145
160
|
},
|
|
146
161
|
{
|
|
147
162
|
type: 'collapsible',
|
|
148
|
-
label: '
|
|
163
|
+
label: tLabel('details'),
|
|
149
164
|
admin: {
|
|
150
165
|
initCollapsed: true,
|
|
151
|
-
description: '
|
|
166
|
+
description: tLabel('extraDetailIfYouNeedIt'),
|
|
152
167
|
},
|
|
153
168
|
fields: [
|
|
154
169
|
{
|
|
155
170
|
name: 'reason',
|
|
156
171
|
type: 'text',
|
|
157
|
-
admin: {
|
|
172
|
+
admin: {
|
|
173
|
+
description: tLabel('aShortNoteAboutWhyThisWasRecorded'),
|
|
174
|
+
},
|
|
158
175
|
},
|
|
159
176
|
{
|
|
160
177
|
name: 'data',
|
|
161
178
|
type: 'json',
|
|
179
|
+
label: tLabel('data'),
|
|
162
180
|
admin: {
|
|
163
|
-
description: '
|
|
181
|
+
description: tLabel('engineTransitionEnvelopeFromToEachIdSlug'),
|
|
164
182
|
},
|
|
165
183
|
},
|
|
166
184
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/MetricBalances/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/MetricBalances/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAc/C,wBAAgB,6BAA6B,IAAI,gBAAgB,CAgDhE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tEntityDescription, tLabel } from '../../adminLabel.js';
|
|
1
2
|
import { collectionAdmin, collectionOf, columnsWithOptionalScope, optionalFields, slugOf, } from '../helpers.js';
|
|
2
3
|
import { scopeField, userField } from '../fields/index.js';
|
|
3
4
|
import { access } from './access/index.js';
|
|
@@ -5,12 +6,16 @@ import { hooks } from './hooks/index.js';
|
|
|
5
6
|
export function buildMetricBalancesCollection() {
|
|
6
7
|
return {
|
|
7
8
|
slug: slugOf('metricBalances'),
|
|
9
|
+
labels: {
|
|
10
|
+
singular: tLabel('metricBalance'),
|
|
11
|
+
plural: tLabel('metricBalances'),
|
|
12
|
+
},
|
|
8
13
|
access: { ...access },
|
|
9
14
|
hooks,
|
|
10
15
|
admin: collectionAdmin({
|
|
11
16
|
useAsTitle: 'key',
|
|
12
17
|
defaultColumns: columnsWithOptionalScope(['metric', 'user', 'value', 'scope', 'updatedAt']),
|
|
13
|
-
description: '
|
|
18
|
+
description: tEntityDescription('storedMetricTotalsPerUserAndScopeUpdated'),
|
|
14
19
|
}),
|
|
15
20
|
fields: [
|
|
16
21
|
userField(),
|
|
@@ -21,6 +26,7 @@ export function buildMetricBalancesCollection() {
|
|
|
21
26
|
relationTo: collectionOf('metrics'),
|
|
22
27
|
required: true,
|
|
23
28
|
index: true,
|
|
29
|
+
label: tLabel('metric'),
|
|
24
30
|
},
|
|
25
31
|
{
|
|
26
32
|
name: 'value',
|
|
@@ -29,7 +35,7 @@ export function buildMetricBalancesCollection() {
|
|
|
29
35
|
defaultValue: 0,
|
|
30
36
|
index: true,
|
|
31
37
|
admin: {
|
|
32
|
-
description: '
|
|
38
|
+
description: tLabel('currentTotalSumOfMetricDeltaChanges'),
|
|
33
39
|
},
|
|
34
40
|
},
|
|
35
41
|
{
|
|
@@ -40,7 +46,7 @@ export function buildMetricBalancesCollection() {
|
|
|
40
46
|
index: true,
|
|
41
47
|
admin: {
|
|
42
48
|
readOnly: true,
|
|
43
|
-
description: '
|
|
49
|
+
description: tLabel('stableUniqueKeyUserScopeMetric'),
|
|
44
50
|
},
|
|
45
51
|
},
|
|
46
52
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Metrics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Metrics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAU/C,wBAAgB,sBAAsB,IAAI,gBAAgB,CAkHzD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tEntityDescription, tLabel } from '../../adminLabel.js';
|
|
1
2
|
import { collectionAdmin, collectionOf, columnsWithOptionalScope, optionalFields, slugOf } from '../helpers.js';
|
|
2
3
|
import { localizedNameField, scopeField } from '../fields/index.js';
|
|
3
4
|
import { catalogFilterOptions } from '../fields/catalogFilter.js';
|
|
@@ -7,12 +8,16 @@ import { hooks } from './hooks/index.js';
|
|
|
7
8
|
export function buildMetricsCollection() {
|
|
8
9
|
return {
|
|
9
10
|
slug: slugOf('metrics'),
|
|
11
|
+
labels: {
|
|
12
|
+
singular: tLabel('metric'),
|
|
13
|
+
plural: tLabel('metrics'),
|
|
14
|
+
},
|
|
10
15
|
access: { ...access },
|
|
11
16
|
hooks,
|
|
12
17
|
admin: collectionAdmin({
|
|
13
18
|
useAsTitle: 'name',
|
|
14
19
|
defaultColumns: columnsWithOptionalScope(['name', 'slug', 'kind', 'system', 'scope']),
|
|
15
|
-
description: '
|
|
20
|
+
description: tEntityDescription('namedNumbersStoredMetricsAreScoreTotalsFrom'),
|
|
16
21
|
}),
|
|
17
22
|
fields: [
|
|
18
23
|
...optionalFields(scopeField()),
|
|
@@ -20,7 +25,15 @@ export function buildMetricsCollection() {
|
|
|
20
25
|
type: 'row',
|
|
21
26
|
fields: [
|
|
22
27
|
localizedNameField({ width: '50%' }),
|
|
23
|
-
{
|
|
28
|
+
{
|
|
29
|
+
name: 'slug',
|
|
30
|
+
type: 'text',
|
|
31
|
+
required: true,
|
|
32
|
+
unique: true,
|
|
33
|
+
index: true,
|
|
34
|
+
label: tLabel('slug'),
|
|
35
|
+
admin: { width: '50%' },
|
|
36
|
+
},
|
|
24
37
|
],
|
|
25
38
|
},
|
|
26
39
|
{
|
|
@@ -28,52 +41,56 @@ export function buildMetricsCollection() {
|
|
|
28
41
|
type: 'select',
|
|
29
42
|
required: true,
|
|
30
43
|
defaultValue: 'stored',
|
|
44
|
+
label: tLabel('kind'),
|
|
31
45
|
enumName: 'ach_metric_kind',
|
|
32
46
|
options: [
|
|
33
|
-
{ label: '
|
|
34
|
-
{ label: '
|
|
47
|
+
{ label: tLabel('storedLogDeltas'), value: 'stored' },
|
|
48
|
+
{ label: tLabel('computed'), value: 'computed' },
|
|
35
49
|
],
|
|
36
50
|
admin: {
|
|
37
|
-
description: '
|
|
51
|
+
description: tLabel('storedSumOfMetricDeltaLogsViaBalances'),
|
|
38
52
|
},
|
|
39
53
|
},
|
|
40
54
|
{
|
|
41
55
|
name: 'compute',
|
|
42
56
|
type: 'select',
|
|
43
57
|
defaultValue: 'elapsed',
|
|
58
|
+
label: tLabel('compute'),
|
|
44
59
|
enumName: 'ach_metric_compute',
|
|
45
|
-
options: [{ label: '
|
|
60
|
+
options: [{ label: tLabel('elapsedTime'), value: 'elapsed' }],
|
|
46
61
|
admin: {
|
|
47
62
|
condition: (_, sibling) => sibling?.kind === 'computed',
|
|
48
|
-
description: '
|
|
63
|
+
description: tLabel('howThisNumberIsDerived'),
|
|
49
64
|
},
|
|
50
65
|
},
|
|
51
66
|
{
|
|
52
67
|
name: 'unit',
|
|
53
68
|
type: 'select',
|
|
54
69
|
defaultValue: 'days',
|
|
70
|
+
label: tLabel('unit'),
|
|
55
71
|
enumName: 'ach_metric_unit',
|
|
56
72
|
options: [
|
|
57
|
-
{ label: '
|
|
58
|
-
{ label: '
|
|
59
|
-
{ label: '
|
|
60
|
-
{ label: '
|
|
61
|
-
{ label: '
|
|
73
|
+
{ label: tLabel('seconds'), value: 'seconds' },
|
|
74
|
+
{ label: tLabel('minutes'), value: 'minutes' },
|
|
75
|
+
{ label: tLabel('hours'), value: 'hours' },
|
|
76
|
+
{ label: tLabel('days'), value: 'days' },
|
|
77
|
+
{ label: tLabel('years'), value: 'years' },
|
|
62
78
|
],
|
|
63
79
|
admin: {
|
|
64
80
|
condition: (_, sibling) => sibling?.kind === 'computed' && sibling?.compute === 'elapsed',
|
|
65
|
-
description: '
|
|
81
|
+
description: tLabel('unitOfTheExposedNumberWholeUnitsSince'),
|
|
66
82
|
},
|
|
67
83
|
},
|
|
68
84
|
{
|
|
69
85
|
name: 'since',
|
|
70
86
|
type: 'select',
|
|
71
87
|
defaultValue: 'user-created-at',
|
|
88
|
+
label: tLabel('since'),
|
|
72
89
|
enumName: 'ach_metric_since',
|
|
73
90
|
options: elapsedSinceSelectOptions(),
|
|
74
91
|
admin: {
|
|
75
92
|
condition: (_, sibling) => sibling?.kind === 'computed' && sibling?.compute === 'elapsed',
|
|
76
|
-
description: '
|
|
93
|
+
description: tLabel('whichTimestampStartsTheClock'),
|
|
77
94
|
},
|
|
78
95
|
},
|
|
79
96
|
{
|
|
@@ -81,20 +98,22 @@ export function buildMetricsCollection() {
|
|
|
81
98
|
type: 'relationship',
|
|
82
99
|
relationTo: collectionOf('eventTypes'),
|
|
83
100
|
filterOptions: catalogFilterOptions,
|
|
101
|
+
label: tLabel('firstEventType'),
|
|
84
102
|
admin: {
|
|
85
103
|
condition: (_, sibling) => sibling?.kind === 'computed' &&
|
|
86
104
|
sibling?.compute === 'elapsed' &&
|
|
87
105
|
sibling?.since === 'first-event',
|
|
88
|
-
description: '
|
|
106
|
+
description: tLabel('eventTypeWhoseFirstLogStartsTheClock'),
|
|
89
107
|
},
|
|
90
108
|
},
|
|
91
109
|
{
|
|
92
110
|
name: 'system',
|
|
93
111
|
type: 'checkbox',
|
|
94
112
|
defaultValue: false,
|
|
113
|
+
label: tLabel('system'),
|
|
95
114
|
admin: {
|
|
96
115
|
readOnly: true,
|
|
97
|
-
description: '
|
|
116
|
+
description: tLabel('builtInMetricItCanTBeDeleted'),
|
|
98
117
|
},
|
|
99
118
|
},
|
|
100
119
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Reactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Reactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAoBtD,wBAAgB,wBAAwB,IAAI,gBAAgB,CA6F3D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tEntityDescription, tLabel } from '../../adminLabel.js';
|
|
1
2
|
import { actionSelectOptions, BUILTIN_GRANT_ACTION, getHostActions } from '../../extensions/actions.js';
|
|
2
3
|
import { catalogFilterOptions } from '../fields/catalogFilter.js';
|
|
3
4
|
import { whenSiblingEquals } from '../fields/whenSibling.js';
|
|
@@ -17,14 +18,14 @@ export function buildReactionsCollection() {
|
|
|
17
18
|
return {
|
|
18
19
|
slug: slugOf('reactions'),
|
|
19
20
|
labels: {
|
|
20
|
-
singular: '
|
|
21
|
-
plural: '
|
|
21
|
+
singular: tLabel('achievementReaction'),
|
|
22
|
+
plural: tLabel('achievementReactions'),
|
|
22
23
|
},
|
|
23
24
|
access: { ...access },
|
|
24
25
|
admin: collectionAdmin({
|
|
25
26
|
useAsTitle: 'name',
|
|
26
27
|
defaultColumns: columnsWithOptionalScope(['name', 'trigger', 'action', 'enabled', 'scope']),
|
|
27
|
-
description: '
|
|
28
|
+
description: tEntityDescription('whenAnEventIsLoggedOrAnAchievement'),
|
|
28
29
|
}),
|
|
29
30
|
fields: [
|
|
30
31
|
...optionalFields(scopeField()),
|
|
@@ -33,25 +34,31 @@ export function buildReactionsCollection() {
|
|
|
33
34
|
type: 'text',
|
|
34
35
|
required: true,
|
|
35
36
|
index: true,
|
|
36
|
-
admin: {
|
|
37
|
+
admin: {
|
|
38
|
+
description: tLabel('adminLabelForThisReaction'),
|
|
39
|
+
},
|
|
37
40
|
},
|
|
38
41
|
{
|
|
39
42
|
name: 'enabled',
|
|
40
43
|
type: 'checkbox',
|
|
41
44
|
defaultValue: true,
|
|
42
|
-
|
|
45
|
+
label: tLabel('enabled'),
|
|
46
|
+
admin: {
|
|
47
|
+
description: tLabel('turnOffToKeepTheRowWithoutRunning'),
|
|
48
|
+
},
|
|
43
49
|
},
|
|
44
50
|
{
|
|
45
51
|
name: 'trigger',
|
|
46
52
|
type: 'select',
|
|
47
53
|
required: true,
|
|
54
|
+
label: tLabel('trigger'),
|
|
48
55
|
options: [
|
|
49
|
-
{ label: '
|
|
50
|
-
{ label: '
|
|
51
|
-
{ label: '
|
|
56
|
+
{ label: tLabel('eventLogged'), value: 'event' },
|
|
57
|
+
{ label: tLabel('achievementGranted'), value: 'achievement.granted' },
|
|
58
|
+
{ label: tLabel('achievementRevoked'), value: 'achievement.revoked' },
|
|
52
59
|
],
|
|
53
60
|
admin: {
|
|
54
|
-
description: '
|
|
61
|
+
description: tLabel('grantRevokeTriggersFireFromTheGrantRow'),
|
|
55
62
|
},
|
|
56
63
|
},
|
|
57
64
|
{
|
|
@@ -59,9 +66,10 @@ export function buildReactionsCollection() {
|
|
|
59
66
|
type: 'relationship',
|
|
60
67
|
relationTo: collectionOf('eventTypes'),
|
|
61
68
|
filterOptions: catalogFilterOptions,
|
|
69
|
+
label: tLabel('eventType'),
|
|
62
70
|
admin: {
|
|
63
71
|
condition: (_, sibling) => sibling?.trigger === 'event',
|
|
64
|
-
description: '
|
|
72
|
+
description: tLabel('whichLogTypeStartsThisReaction'),
|
|
65
73
|
},
|
|
66
74
|
},
|
|
67
75
|
{
|
|
@@ -69,17 +77,21 @@ export function buildReactionsCollection() {
|
|
|
69
77
|
type: 'relationship',
|
|
70
78
|
relationTo: collectionOf('achievements'),
|
|
71
79
|
filterOptions: catalogFilterOptions,
|
|
80
|
+
label: tLabel('achievement'),
|
|
72
81
|
admin: {
|
|
73
82
|
condition: (_, sibling) => sibling?.trigger === 'achievement.granted' || sibling?.trigger === 'achievement.revoked',
|
|
74
|
-
description: '
|
|
83
|
+
description: tLabel('whichAchievementGrantRevokeStartsThisReaction'),
|
|
75
84
|
},
|
|
76
85
|
},
|
|
77
86
|
{
|
|
78
87
|
name: 'action',
|
|
79
88
|
type: 'select',
|
|
80
89
|
required: true,
|
|
90
|
+
label: tLabel('action'),
|
|
81
91
|
options: actionSelectOptions(),
|
|
82
|
-
admin: {
|
|
92
|
+
admin: {
|
|
93
|
+
description: tLabel('setBasedCommandToRunHostsRegisterExtra'),
|
|
94
|
+
},
|
|
83
95
|
},
|
|
84
96
|
{
|
|
85
97
|
name: 'targetAchievement',
|
|
@@ -88,7 +100,7 @@ export function buildReactionsCollection() {
|
|
|
88
100
|
filterOptions: catalogFilterOptions,
|
|
89
101
|
admin: {
|
|
90
102
|
condition: (_, sibling) => sibling?.action === BUILTIN_GRANT_ACTION,
|
|
91
|
-
description: '
|
|
103
|
+
description: tLabel('achievementToGrantNoOpsIfTheyAlready'),
|
|
92
104
|
},
|
|
93
105
|
},
|
|
94
106
|
...hostActionParamFields(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareTierRequest.d.ts","sourceRoot":"","sources":["../../../../src/collections/TierRequests/hooks/prepareTierRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,4BAA4B,EAE7B,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"prepareTierRequest.d.ts","sourceRoot":"","sources":["../../../../src/collections/TierRequests/hooks/prepareTierRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,4BAA4B,EAE7B,MAAM,SAAS,CAAA;AA4BhB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,4BAiGhC,CAAA;AA8CD,eAAO,MAAM,sBAAsB,EAAE,yBAkCpC,CAAA"}
|
|
@@ -5,6 +5,7 @@ import { evaluateRules } from '../../../services/achievement/evaluateRules.js';
|
|
|
5
5
|
import { catalogRef } from '../../../services/achievement/logData.js';
|
|
6
6
|
import { recordLog, syncTierChangedLog } from '../../../services/achievement/recordEvent.js';
|
|
7
7
|
import { relationId } from '../../../services/achievement/relationId.js';
|
|
8
|
+
import { throwApiError } from '../../../translations/reqT.js';
|
|
8
9
|
function scopeIdOf(data) {
|
|
9
10
|
return relationId(data?.scope);
|
|
10
11
|
}
|
|
@@ -31,15 +32,15 @@ export const prepareTierRequest = async ({ data, operation, req, originalDoc, })
|
|
|
31
32
|
else {
|
|
32
33
|
const bound = relationId(data.user);
|
|
33
34
|
if (!bound)
|
|
34
|
-
|
|
35
|
+
throwApiError(req, 'errorUserRequired', 400);
|
|
35
36
|
data.user = bound;
|
|
36
37
|
}
|
|
37
38
|
const userId = relationId(data.user);
|
|
38
39
|
if (!userId)
|
|
39
|
-
|
|
40
|
+
throwApiError(req, 'errorUserRequired', 400);
|
|
40
41
|
const tierId = relationId(data.tier);
|
|
41
42
|
if (!tierId)
|
|
42
|
-
|
|
43
|
+
throwApiError(req, 'errorTierRequired', 400);
|
|
43
44
|
const tier = (await req.payload.findByID({
|
|
44
45
|
collection: collectionOf('tiers'),
|
|
45
46
|
id: tierId,
|
|
@@ -48,9 +49,9 @@ export const prepareTierRequest = async ({ data, operation, req, originalDoc, })
|
|
|
48
49
|
req,
|
|
49
50
|
}));
|
|
50
51
|
if (!tier)
|
|
51
|
-
|
|
52
|
+
throwApiError(req, 'errorUnknownTier', 400, { id: tierId });
|
|
52
53
|
if (tier.requiresReview !== true) {
|
|
53
|
-
|
|
54
|
+
throwApiError(req, 'errorTierDoesNotRequireReview', 400);
|
|
54
55
|
}
|
|
55
56
|
data.tier = tierId;
|
|
56
57
|
if (!system) {
|
|
@@ -63,7 +64,7 @@ export const prepareTierRequest = async ({ data, operation, req, originalDoc, })
|
|
|
63
64
|
scopeId,
|
|
64
65
|
});
|
|
65
66
|
if (!unlocked) {
|
|
66
|
-
|
|
67
|
+
throwApiError(req, 'errorUnlockRulesNotMet', 400);
|
|
67
68
|
}
|
|
68
69
|
// Members cannot self-approve; only reviewers / system may set approved|rejected.
|
|
69
70
|
data.status = 'pending';
|
|
@@ -100,7 +101,7 @@ export const prepareTierRequest = async ({ data, operation, req, originalDoc, })
|
|
|
100
101
|
scopeId,
|
|
101
102
|
});
|
|
102
103
|
if (!unlocked) {
|
|
103
|
-
|
|
104
|
+
throwApiError(req, 'errorUnlockRulesNotMet', 400);
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/TierRequests/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/TierRequests/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAQtD,wBAAgB,2BAA2B,IAAI,gBAAgB,CA+C9D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tEntityDescription, tLabel } from '../../adminLabel.js';
|
|
1
2
|
import { collectionAdmin, collectionOf, optionalFields, slugOf } from '../helpers.js';
|
|
2
3
|
import { scopeField, userField } from '../fields/index.js';
|
|
3
4
|
import { access } from './access/index.js';
|
|
@@ -6,15 +7,15 @@ export function buildTierRequestsCollection() {
|
|
|
6
7
|
return {
|
|
7
8
|
slug: slugOf('tierRequests'),
|
|
8
9
|
labels: {
|
|
9
|
-
singular: '
|
|
10
|
-
plural: '
|
|
10
|
+
singular: tLabel('tierRequest'),
|
|
11
|
+
plural: tLabel('tierRequests'),
|
|
11
12
|
},
|
|
12
13
|
access: { ...access },
|
|
13
14
|
hooks,
|
|
14
15
|
admin: collectionAdmin({
|
|
15
16
|
useAsTitle: 'id',
|
|
16
17
|
defaultColumns: ['user', 'tier', 'status', 'createdAt'],
|
|
17
|
-
description: '
|
|
18
|
+
description: tEntityDescription('whenAMemberHasMetATierS'),
|
|
18
19
|
}),
|
|
19
20
|
fields: [
|
|
20
21
|
...optionalFields(scopeField()),
|
|
@@ -25,22 +26,27 @@ export function buildTierRequestsCollection() {
|
|
|
25
26
|
relationTo: collectionOf('tiers'),
|
|
26
27
|
required: true,
|
|
27
28
|
index: true,
|
|
29
|
+
label: tLabel('tier'),
|
|
28
30
|
},
|
|
29
31
|
{
|
|
30
32
|
name: 'status',
|
|
31
33
|
type: 'select',
|
|
32
34
|
required: true,
|
|
33
35
|
defaultValue: 'pending',
|
|
36
|
+
label: tLabel('status'),
|
|
34
37
|
options: [
|
|
35
|
-
{ label: '
|
|
36
|
-
{ label: '
|
|
37
|
-
{ label: '
|
|
38
|
+
{ label: tLabel('pending'), value: 'pending' },
|
|
39
|
+
{ label: tLabel('approved'), value: 'approved' },
|
|
40
|
+
{ label: tLabel('rejected'), value: 'rejected' },
|
|
38
41
|
],
|
|
39
42
|
},
|
|
40
43
|
{
|
|
41
44
|
name: 'note',
|
|
42
45
|
type: 'textarea',
|
|
43
|
-
|
|
46
|
+
label: tLabel('note'),
|
|
47
|
+
admin: {
|
|
48
|
+
description: tLabel('optionalNoteFromTheRequesterOrReviewer'),
|
|
49
|
+
},
|
|
44
50
|
},
|
|
45
51
|
],
|
|
46
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Tiers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Tiers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAS/C,wBAAgB,oBAAoB,IAAI,gBAAgB,CAgGvD"}
|