@things-factory/guild-overlay 10.1.314 → 10.1.316
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-client/components/guild-coin-layer.d.ts +20 -0
- package/dist-client/components/guild-coin-layer.js +405 -0
- package/dist-client/components/guild-overlay-setting-let.d.ts +11 -0
- package/dist-client/components/guild-overlay-setting-let.js +63 -0
- package/dist-client/index.d.ts +2 -0
- package/dist-client/index.js +3 -0
- package/dist-client/overlay-state.d.ts +52 -0
- package/dist-client/overlay-state.js +110 -0
- package/dist-client/setup-guild-overlay.d.ts +3 -0
- package/dist-client/setup-guild-overlay.js +38 -0
- package/dist-server/committed.d.ts +7 -0
- package/dist-server/committed.js +48 -0
- package/dist-server/hub-route.d.ts +54 -2
- package/dist-server/hub-route.js +4 -7
- package/dist-server/index.d.ts +13 -2
- package/dist-server/index.js +12 -3
- package/dist-server/opportunities.d.ts +23 -0
- package/dist-server/opportunities.js +37 -0
- package/dist-server/overlay-resolver.d.ts +64 -0
- package/dist-server/overlay-resolver.js +298 -0
- package/dist-server/prospect.d.ts +21 -0
- package/dist-server/prospect.js +35 -0
- package/dist-server/pulse.d.ts +36 -0
- package/dist-server/pulse.js +27 -0
- package/dist-server/settings.d.ts +5 -20
- package/dist-server/settings.js +7 -18
- package/package.json +14 -10
- package/translations/en.json +14 -7
- package/translations/es.json +15 -8
- package/translations/ja.json +14 -7
- package/translations/ko.json +14 -7
- package/translations/ms.json +14 -7
- package/translations/zh.json +14 -7
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GuildOverlayResolver = exports.GuildPulseNote = exports.GuildOverlay = exports.GuildOverlayMissed = exports.GuildOverlayKind = exports.GuildOverlayQuest = exports.GuildOverlayBadge = exports.GuildOverlayWallet = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_yoga_1 = require("graphql-yoga");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const define_kinds_js_1 = require("./define-kinds.js");
|
|
9
|
+
const hub_route_js_1 = require("./hub-route.js");
|
|
10
|
+
const opportunities_js_1 = require("./opportunities.js");
|
|
11
|
+
const pulse_js_1 = require("./pulse.js");
|
|
12
|
+
const settings_js_1 = require("./settings.js");
|
|
13
|
+
/*
|
|
14
|
+
* **What the game overlay reads** (design §14-1 「제품 서버에 서는 것」) - on the person's own server, about the person only:
|
|
15
|
+
* the wallet chip, the quest panel and the coins. Nobody's coins or balance but one's own are ever drawn.
|
|
16
|
+
*/
|
|
17
|
+
let GuildOverlayWallet = class GuildOverlayWallet {
|
|
18
|
+
};
|
|
19
|
+
exports.GuildOverlayWallet = GuildOverlayWallet;
|
|
20
|
+
tslib_1.__decorate([
|
|
21
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float),
|
|
22
|
+
tslib_1.__metadata("design:type", Number)
|
|
23
|
+
], GuildOverlayWallet.prototype, "balance", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float),
|
|
26
|
+
tslib_1.__metadata("design:type", Number)
|
|
27
|
+
], GuildOverlayWallet.prototype, "spendable", void 0);
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: "This month's GP still held" }),
|
|
30
|
+
tslib_1.__metadata("design:type", Number)
|
|
31
|
+
], GuildOverlayWallet.prototype, "pendingGp", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: "This month's GP that matured" }),
|
|
34
|
+
tslib_1.__metadata("design:type", Number)
|
|
35
|
+
], GuildOverlayWallet.prototype, "maturedGp", void 0);
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: 'Every GP that ever matured - what the level counts' }),
|
|
38
|
+
tslib_1.__metadata("design:type", Number)
|
|
39
|
+
], GuildOverlayWallet.prototype, "everGp", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
42
|
+
tslib_1.__metadata("design:type", Number)
|
|
43
|
+
], GuildOverlayWallet.prototype, "level", void 0);
|
|
44
|
+
tslib_1.__decorate([
|
|
45
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float),
|
|
46
|
+
tslib_1.__metadata("design:type", Number)
|
|
47
|
+
], GuildOverlayWallet.prototype, "levelFloor", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
50
|
+
tslib_1.__metadata("design:type", Number)
|
|
51
|
+
], GuildOverlayWallet.prototype, "nextLevelAt", void 0);
|
|
52
|
+
exports.GuildOverlayWallet = GuildOverlayWallet = tslib_1.__decorate([
|
|
53
|
+
(0, type_graphql_1.ObjectType)({ description: "One's guild wallet as the overlay chip shows it" })
|
|
54
|
+
], GuildOverlayWallet);
|
|
55
|
+
let GuildOverlayBadge = class GuildOverlayBadge {
|
|
56
|
+
};
|
|
57
|
+
exports.GuildOverlayBadge = GuildOverlayBadge;
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, type_graphql_1.Field)(),
|
|
60
|
+
tslib_1.__metadata("design:type", String)
|
|
61
|
+
], GuildOverlayBadge.prototype, "kind", void 0);
|
|
62
|
+
tslib_1.__decorate([
|
|
63
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
|
64
|
+
tslib_1.__metadata("design:type", Object)
|
|
65
|
+
], GuildOverlayBadge.prototype, "label", void 0);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
68
|
+
tslib_1.__metadata("design:type", Number)
|
|
69
|
+
], GuildOverlayBadge.prototype, "count", void 0);
|
|
70
|
+
tslib_1.__decorate([
|
|
71
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
72
|
+
tslib_1.__metadata("design:type", Number)
|
|
73
|
+
], GuildOverlayBadge.prototype, "step", void 0);
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
76
|
+
tslib_1.__metadata("design:type", Number)
|
|
77
|
+
], GuildOverlayBadge.prototype, "nextStep", void 0);
|
|
78
|
+
exports.GuildOverlayBadge = GuildOverlayBadge = tslib_1.__decorate([
|
|
79
|
+
(0, type_graphql_1.ObjectType)({ description: 'A badge - confirmed contributions of one kind past a milestone' })
|
|
80
|
+
], GuildOverlayBadge);
|
|
81
|
+
let GuildOverlayQuest = class GuildOverlayQuest {
|
|
82
|
+
};
|
|
83
|
+
exports.GuildOverlayQuest = GuildOverlayQuest;
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, type_graphql_1.Field)(),
|
|
86
|
+
tslib_1.__metadata("design:type", String)
|
|
87
|
+
], GuildOverlayQuest.prototype, "kind", void 0);
|
|
88
|
+
tslib_1.__decorate([
|
|
89
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
|
90
|
+
tslib_1.__metadata("design:type", Object)
|
|
91
|
+
], GuildOverlayQuest.prototype, "label", void 0);
|
|
92
|
+
tslib_1.__decorate([
|
|
93
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
94
|
+
tslib_1.__metadata("design:type", Number)
|
|
95
|
+
], GuildOverlayQuest.prototype, "count", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
98
|
+
tslib_1.__metadata("design:type", String)
|
|
99
|
+
], GuildOverlayQuest.prototype, "route", void 0);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'GP for one, by the rule in force' }),
|
|
102
|
+
tslib_1.__metadata("design:type", Number)
|
|
103
|
+
], GuildOverlayQuest.prototype, "gpEach", void 0);
|
|
104
|
+
exports.GuildOverlayQuest = GuildOverlayQuest = tslib_1.__decorate([
|
|
105
|
+
(0, type_graphql_1.ObjectType)({ description: "Work waiting for this person that the guild pays for - today's quest" })
|
|
106
|
+
], GuildOverlayQuest);
|
|
107
|
+
let GuildOverlayKind = class GuildOverlayKind {
|
|
108
|
+
};
|
|
109
|
+
exports.GuildOverlayKind = GuildOverlayKind;
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, type_graphql_1.Field)(),
|
|
112
|
+
tslib_1.__metadata("design:type", String)
|
|
113
|
+
], GuildOverlayKind.prototype, "kind", void 0);
|
|
114
|
+
tslib_1.__decorate([
|
|
115
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
|
116
|
+
tslib_1.__metadata("design:type", Object)
|
|
117
|
+
], GuildOverlayKind.prototype, "label", void 0);
|
|
118
|
+
tslib_1.__decorate([
|
|
119
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
120
|
+
tslib_1.__metadata("design:type", String)
|
|
121
|
+
], GuildOverlayKind.prototype, "route", void 0);
|
|
122
|
+
tslib_1.__decorate([
|
|
123
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
|
124
|
+
tslib_1.__metadata("design:type", Object)
|
|
125
|
+
], GuildOverlayKind.prototype, "hint", void 0);
|
|
126
|
+
tslib_1.__decorate([
|
|
127
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
128
|
+
tslib_1.__metadata("design:type", Number)
|
|
129
|
+
], GuildOverlayKind.prototype, "gpEach", void 0);
|
|
130
|
+
exports.GuildOverlayKind = GuildOverlayKind = tslib_1.__decorate([
|
|
131
|
+
(0, type_graphql_1.ObjectType)({ description: 'A contribution kind and the page it happens on - the 「이 화면의 기여」 chip' })
|
|
132
|
+
], GuildOverlayKind);
|
|
133
|
+
let GuildOverlayMissed = class GuildOverlayMissed {
|
|
134
|
+
};
|
|
135
|
+
exports.GuildOverlayMissed = GuildOverlayMissed;
|
|
136
|
+
tslib_1.__decorate([
|
|
137
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
138
|
+
tslib_1.__metadata("design:type", Number)
|
|
139
|
+
], GuildOverlayMissed.prototype, "count", void 0);
|
|
140
|
+
tslib_1.__decorate([
|
|
141
|
+
(0, type_graphql_1.Field)({ description: 'The latest one’s kind' }),
|
|
142
|
+
tslib_1.__metadata("design:type", String)
|
|
143
|
+
], GuildOverlayMissed.prototype, "kind", void 0);
|
|
144
|
+
tslib_1.__decorate([
|
|
145
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'Its label - a string or one per language' }),
|
|
146
|
+
tslib_1.__metadata("design:type", Object)
|
|
147
|
+
], GuildOverlayMissed.prototype, "label", void 0);
|
|
148
|
+
exports.GuildOverlayMissed = GuildOverlayMissed = tslib_1.__decorate([
|
|
149
|
+
(0, type_graphql_1.ObjectType)({ description: 'What was confirmed while the person was away - one gathered note at the next visit' })
|
|
150
|
+
], GuildOverlayMissed);
|
|
151
|
+
let GuildOverlay = class GuildOverlay {
|
|
152
|
+
};
|
|
153
|
+
exports.GuildOverlay = GuildOverlay;
|
|
154
|
+
tslib_1.__decorate([
|
|
155
|
+
(0, type_graphql_1.Field)({ description: 'Guild::enabled - when off, the overlay draws nothing' }),
|
|
156
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
157
|
+
], GuildOverlay.prototype, "enabled", void 0);
|
|
158
|
+
tslib_1.__decorate([
|
|
159
|
+
(0, type_graphql_1.Field)(type => GuildOverlayMissed, { nullable: true }),
|
|
160
|
+
tslib_1.__metadata("design:type", GuildOverlayMissed)
|
|
161
|
+
], GuildOverlay.prototype, "missed", void 0);
|
|
162
|
+
tslib_1.__decorate([
|
|
163
|
+
(0, type_graphql_1.Field)(type => GuildOverlayWallet, { nullable: true }),
|
|
164
|
+
tslib_1.__metadata("design:type", GuildOverlayWallet)
|
|
165
|
+
], GuildOverlay.prototype, "wallet", void 0);
|
|
166
|
+
tslib_1.__decorate([
|
|
167
|
+
(0, type_graphql_1.Field)(type => [GuildOverlayBadge]),
|
|
168
|
+
tslib_1.__metadata("design:type", Array)
|
|
169
|
+
], GuildOverlay.prototype, "badges", void 0);
|
|
170
|
+
tslib_1.__decorate([
|
|
171
|
+
(0, type_graphql_1.Field)(type => [GuildOverlayQuest]),
|
|
172
|
+
tslib_1.__metadata("design:type", Array)
|
|
173
|
+
], GuildOverlay.prototype, "quests", void 0);
|
|
174
|
+
tslib_1.__decorate([
|
|
175
|
+
(0, type_graphql_1.Field)(type => [GuildOverlayKind]),
|
|
176
|
+
tslib_1.__metadata("design:type", Array)
|
|
177
|
+
], GuildOverlay.prototype, "kinds", void 0);
|
|
178
|
+
exports.GuildOverlay = GuildOverlay = tslib_1.__decorate([
|
|
179
|
+
(0, type_graphql_1.ObjectType)({ description: "The overlay's one read - off, or the person's wallet, badges, quests and the kinds with a page" })
|
|
180
|
+
], GuildOverlay);
|
|
181
|
+
let GuildPulseNote = class GuildPulseNote {
|
|
182
|
+
};
|
|
183
|
+
exports.GuildPulseNote = GuildPulseNote;
|
|
184
|
+
tslib_1.__decorate([
|
|
185
|
+
(0, type_graphql_1.Field)(),
|
|
186
|
+
tslib_1.__metadata("design:type", String)
|
|
187
|
+
], GuildPulseNote.prototype, "kind", void 0);
|
|
188
|
+
tslib_1.__decorate([
|
|
189
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
190
|
+
tslib_1.__metadata("design:type", String)
|
|
191
|
+
], GuildPulseNote.prototype, "contributionKind", void 0);
|
|
192
|
+
tslib_1.__decorate([
|
|
193
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
|
194
|
+
tslib_1.__metadata("design:type", Object)
|
|
195
|
+
], GuildPulseNote.prototype, "label", void 0);
|
|
196
|
+
tslib_1.__decorate([
|
|
197
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
198
|
+
tslib_1.__metadata("design:type", String)
|
|
199
|
+
], GuildPulseNote.prototype, "title", void 0);
|
|
200
|
+
tslib_1.__decorate([
|
|
201
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
202
|
+
tslib_1.__metadata("design:type", String)
|
|
203
|
+
], GuildPulseNote.prototype, "path", void 0);
|
|
204
|
+
tslib_1.__decorate([
|
|
205
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
206
|
+
tslib_1.__metadata("design:type", Number)
|
|
207
|
+
], GuildPulseNote.prototype, "gp", void 0);
|
|
208
|
+
tslib_1.__decorate([
|
|
209
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
210
|
+
tslib_1.__metadata("design:type", Number)
|
|
211
|
+
], GuildPulseNote.prototype, "gpLow", void 0);
|
|
212
|
+
tslib_1.__decorate([
|
|
213
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
214
|
+
tslib_1.__metadata("design:type", Number)
|
|
215
|
+
], GuildPulseNote.prototype, "gpHigh", void 0);
|
|
216
|
+
tslib_1.__decorate([
|
|
217
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
218
|
+
tslib_1.__metadata("design:type", Number)
|
|
219
|
+
], GuildPulseNote.prototype, "gt", void 0);
|
|
220
|
+
tslib_1.__decorate([
|
|
221
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
222
|
+
tslib_1.__metadata("design:type", Number)
|
|
223
|
+
], GuildPulseNote.prototype, "count", void 0);
|
|
224
|
+
tslib_1.__decorate([
|
|
225
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
226
|
+
tslib_1.__metadata("design:type", String)
|
|
227
|
+
], GuildPulseNote.prototype, "reason", void 0);
|
|
228
|
+
tslib_1.__decorate([
|
|
229
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
|
|
230
|
+
tslib_1.__metadata("design:type", Object)
|
|
231
|
+
], GuildPulseNote.prototype, "hint", void 0);
|
|
232
|
+
tslib_1.__decorate([
|
|
233
|
+
(0, type_graphql_1.Field)(),
|
|
234
|
+
tslib_1.__metadata("design:type", String)
|
|
235
|
+
], GuildPulseNote.prototype, "at", void 0);
|
|
236
|
+
exports.GuildPulseNote = GuildPulseNote = tslib_1.__decorate([
|
|
237
|
+
(0, type_graphql_1.ObjectType)({ description: 'One movement of one person’s coins (design §14-1)' })
|
|
238
|
+
], GuildPulseNote);
|
|
239
|
+
let GuildOverlayResolver = class GuildOverlayResolver {
|
|
240
|
+
async guildOverlay(since, context) {
|
|
241
|
+
const { domain, user } = context.state;
|
|
242
|
+
const place = await (0, settings_js_1.guildPlaceOf)(domain);
|
|
243
|
+
if (!place.enabled)
|
|
244
|
+
return { enabled: false, badges: [], quests: [], kinds: [] };
|
|
245
|
+
const road = await (0, hub_route_js_1.hubRoadOf)(undefined, domain);
|
|
246
|
+
const digest = road.kind === 'local' && road.hub.overlayOf ? await road.hub.overlayOf(domain, user, since ?? undefined) : { badges: [], baseGp: {} };
|
|
247
|
+
if (digest.eligible === false)
|
|
248
|
+
return { enabled: false, badges: [], quests: [], kinds: [] };
|
|
249
|
+
const gpOf = (kind) => digest.baseGp[kind];
|
|
250
|
+
const quests = (await (0, opportunities_js_1.opportunitiesOf)(domain, user)).map(one => {
|
|
251
|
+
const declared = (0, define_kinds_js_1.declaredKind)(one.kind)?.kind;
|
|
252
|
+
return { kind: one.kind, label: declared?.label, count: one.count, route: one.route ?? declared?.route, gpEach: gpOf(one.kind) };
|
|
253
|
+
});
|
|
254
|
+
const kinds = Object.keys(digest.baseGp)
|
|
255
|
+
.map(kind => (0, define_kinds_js_1.declaredKind)(kind)?.kind)
|
|
256
|
+
.filter(one => !!one?.route)
|
|
257
|
+
.map(one => ({ kind: one.kind, label: one.label, route: one.route, hint: one.prospectHint, gpEach: gpOf(one.kind) }));
|
|
258
|
+
return {
|
|
259
|
+
enabled: true,
|
|
260
|
+
missed: digest.missed ? { ...digest.missed, label: (0, define_kinds_js_1.declaredKind)(digest.missed.kind)?.kind.label } : undefined,
|
|
261
|
+
wallet: digest.wallet,
|
|
262
|
+
badges: digest.badges.map(one => ({ ...one, label: (0, define_kinds_js_1.declaredKind)(one.kind)?.kind.label })),
|
|
263
|
+
quests,
|
|
264
|
+
kinds
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
guildPulse(message) {
|
|
268
|
+
return message.guildPulse;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
exports.GuildOverlayResolver = GuildOverlayResolver;
|
|
272
|
+
tslib_1.__decorate([
|
|
273
|
+
(0, type_graphql_1.Directive)('@privilege(category: "guild", privilege: "query", domainOwnerGranted: true)'),
|
|
274
|
+
(0, type_graphql_1.Query)(returns => GuildOverlay, { description: "The game overlay's read - the person's own wallet, badges and quests" }),
|
|
275
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('since', type => Date, { nullable: true, description: 'When the person last saw a coin on this device - what was confirmed after it comes back gathered' })),
|
|
276
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
277
|
+
tslib_1.__metadata("design:type", Function),
|
|
278
|
+
tslib_1.__metadata("design:paramtypes", [Date, Object]),
|
|
279
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
280
|
+
], GuildOverlayResolver.prototype, "guildOverlay", null);
|
|
281
|
+
tslib_1.__decorate([
|
|
282
|
+
(0, type_graphql_1.Subscription)({
|
|
283
|
+
subscribe: async ({ context }) => {
|
|
284
|
+
const { domain, user } = context.state;
|
|
285
|
+
if (!domain || !user?.id)
|
|
286
|
+
throw new Error('domain and user required');
|
|
287
|
+
return (0, graphql_yoga_1.pipe)(shell_1.pubsub.subscribe(pulse_js_1.GUILD_PULSE_TOPIC), (0, graphql_yoga_1.filter)((message) => message.domainId === domain.id && message.userId === user.id));
|
|
288
|
+
}
|
|
289
|
+
}),
|
|
290
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
291
|
+
tslib_1.__metadata("design:type", Function),
|
|
292
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
293
|
+
tslib_1.__metadata("design:returntype", GuildPulseNote)
|
|
294
|
+
], GuildOverlayResolver.prototype, "guildPulse", null);
|
|
295
|
+
exports.GuildOverlayResolver = GuildOverlayResolver = tslib_1.__decorate([
|
|
296
|
+
(0, type_graphql_1.Resolver)()
|
|
297
|
+
], GuildOverlayResolver);
|
|
298
|
+
//# sourceMappingURL=overlay-resolver.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EntityManager } from 'typeorm';
|
|
2
|
+
export interface ProspectInput {
|
|
3
|
+
kind: string;
|
|
4
|
+
subject: {
|
|
5
|
+
type: string;
|
|
6
|
+
id: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
};
|
|
10
|
+
contributor: {
|
|
11
|
+
id: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
userType?: string;
|
|
14
|
+
};
|
|
15
|
+
/** The business day it belongs to - YYYY-MM-DD. */
|
|
16
|
+
eventAt?: string;
|
|
17
|
+
signals?: Record<string, number>;
|
|
18
|
+
}
|
|
19
|
+
export declare function emitProspect(tx: EntityManager, domain: {
|
|
20
|
+
id: string;
|
|
21
|
+
}, input: ProspectInput): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitProspect = emitProspect;
|
|
4
|
+
const committed_js_1 = require("./committed.js");
|
|
5
|
+
const define_kinds_js_1 = require("./define-kinds.js");
|
|
6
|
+
const hub_route_js_1 = require("./hub-route.js");
|
|
7
|
+
const pulse_js_1 = require("./pulse.js");
|
|
8
|
+
async function emitProspect(tx, domain, input) {
|
|
9
|
+
const person = input.contributor;
|
|
10
|
+
if (!person?.id || (person.userType && person.userType !== 'user'))
|
|
11
|
+
return;
|
|
12
|
+
const declared = (0, define_kinds_js_1.declaredKind)(input.kind);
|
|
13
|
+
if (!declared)
|
|
14
|
+
return;
|
|
15
|
+
const road = await (0, hub_route_js_1.hubRoadOf)(tx, domain);
|
|
16
|
+
if (road.kind !== 'local' || !road.hub.prospect)
|
|
17
|
+
return;
|
|
18
|
+
const hub = road.hub;
|
|
19
|
+
(0, committed_js_1.afterCommitOf)(tx, async () => {
|
|
20
|
+
const reply = await hub.prospect(domain, declared.product, {
|
|
21
|
+
kind: input.kind,
|
|
22
|
+
contributor: { sourceUserId: person.id, email: person.email },
|
|
23
|
+
eventAt: input.eventAt,
|
|
24
|
+
signals: input.signals
|
|
25
|
+
});
|
|
26
|
+
if (!reply)
|
|
27
|
+
return;
|
|
28
|
+
const about = { contributionKind: input.kind, label: declared.kind.label, title: input.subject.title, path: input.subject.path };
|
|
29
|
+
if ('skipped' in reply)
|
|
30
|
+
(0, pulse_js_1.publishGuildPulse)(domain.id, person.id, { kind: 'skipped', ...about, reason: reply.skipped });
|
|
31
|
+
else
|
|
32
|
+
(0, pulse_js_1.publishGuildPulse)(domain.id, person.id, { kind: 'prospect', ...about, gpLow: reply.gpLow, gpHigh: reply.gpHigh, hint: declared.kind.prospectHint });
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=prospect.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GuildLabel } from './contract.js';
|
|
2
|
+
export declare const GUILD_PULSE_KINDS: readonly ["prospect", "verified", "matured", "issued", "impact", "skipped", "voided"];
|
|
3
|
+
export type GuildPulseKind = (typeof GUILD_PULSE_KINDS)[number];
|
|
4
|
+
export interface GuildPulse {
|
|
5
|
+
kind: GuildPulseKind;
|
|
6
|
+
/** The contribution kind, when the pulse is about one. */
|
|
7
|
+
contributionKind?: string;
|
|
8
|
+
/** The kind's label in the languages it was declared in. */
|
|
9
|
+
label?: GuildLabel;
|
|
10
|
+
/** The record it is about - its title and where it opens. */
|
|
11
|
+
title?: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
/** GP: the amount, or a range for a prospect. */
|
|
14
|
+
gp?: number;
|
|
15
|
+
gpLow?: number;
|
|
16
|
+
gpHigh?: number;
|
|
17
|
+
/** GT, for an issue. */
|
|
18
|
+
gt?: number;
|
|
19
|
+
/** How many, when batched. */
|
|
20
|
+
count?: number;
|
|
21
|
+
/** Why it was skipped or voided - a code the screen words. */
|
|
22
|
+
reason?: string;
|
|
23
|
+
/** The prospect bubble's line. */
|
|
24
|
+
hint?: GuildLabel;
|
|
25
|
+
at: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const GUILD_PULSE_TOPIC = "guild-pulse";
|
|
28
|
+
export interface GuildPulseMessage {
|
|
29
|
+
domainId: string;
|
|
30
|
+
userId: string;
|
|
31
|
+
guildPulse: GuildPulse;
|
|
32
|
+
}
|
|
33
|
+
/** Tell one person on this server. The caller has waited for its work to commit (`afterCommitOf`). */
|
|
34
|
+
export declare function publishGuildPulse(domainId: string, userId: string, pulse: Omit<GuildPulse, 'at'> & {
|
|
35
|
+
at?: string;
|
|
36
|
+
}): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GUILD_PULSE_TOPIC = exports.GUILD_PULSE_KINDS = void 0;
|
|
4
|
+
exports.publishGuildPulse = publishGuildPulse;
|
|
5
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
|
+
/*
|
|
7
|
+
* **What a person hears from the guild** (design §3-2 · §14-1) - their own coins only. The hub on this server publishes
|
|
8
|
+
* straight into the `guildPulse` subscription; nothing is stored. Each kind is one coin movement on the screen:
|
|
9
|
+
*
|
|
10
|
+
* prospect a save that will earn when it is confirmed - an empty coin, a range
|
|
11
|
+
* verified a record confirmed - the held coin turns silver
|
|
12
|
+
* matured holds that ended - coins turn gold, batched
|
|
13
|
+
* issued the month's settlement paid out - the balance rolls up
|
|
14
|
+
* impact someone used what this person made - a star coin
|
|
15
|
+
* skipped confirmed but not paid, with the reason - a bubble, no coin
|
|
16
|
+
* voided taken back - the held coin fades
|
|
17
|
+
*/
|
|
18
|
+
exports.GUILD_PULSE_KINDS = ['prospect', 'verified', 'matured', 'issued', 'impact', 'skipped', 'voided'];
|
|
19
|
+
exports.GUILD_PULSE_TOPIC = 'guild-pulse';
|
|
20
|
+
/** Tell one person on this server. The caller has waited for its work to commit (`afterCommitOf`). */
|
|
21
|
+
function publishGuildPulse(domainId, userId, pulse) {
|
|
22
|
+
if (!domainId || !userId)
|
|
23
|
+
return;
|
|
24
|
+
const message = { domainId, userId, guildPulse: { ...pulse, at: pulse.at ?? new Date().toISOString() } };
|
|
25
|
+
shell_1.pubsub.publish(exports.GUILD_PULSE_TOPIC, message);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=pulse.js.map
|
|
@@ -15,20 +15,6 @@ export declare const GUILD_SETTINGS: {
|
|
|
15
15
|
privilege: "mutation";
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
hub: {
|
|
19
|
-
name: string;
|
|
20
|
-
type: "boolean";
|
|
21
|
-
level: "domain";
|
|
22
|
-
section: "connection";
|
|
23
|
-
card: string;
|
|
24
|
-
label: string;
|
|
25
|
-
hint: string;
|
|
26
|
-
order: number;
|
|
27
|
-
write: {
|
|
28
|
-
category: string;
|
|
29
|
-
privilege: "mutation";
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
18
|
hubPeer: {
|
|
33
19
|
name: string;
|
|
34
20
|
type: "string";
|
|
@@ -48,23 +34,22 @@ export declare const GUILD_SETTINGS: {
|
|
|
48
34
|
};
|
|
49
35
|
text: (domain: {
|
|
50
36
|
id: string;
|
|
51
|
-
}, key: "enabled" | "
|
|
37
|
+
}, key: "enabled" | "hubPeer", manager?: EntityManager) => Promise<string>;
|
|
52
38
|
number: (domain: {
|
|
53
39
|
id: string;
|
|
54
|
-
}, key: "enabled" | "
|
|
40
|
+
}, key: "enabled" | "hubPeer", manager?: EntityManager) => Promise<number>;
|
|
55
41
|
flag: (domain: {
|
|
56
42
|
id: string;
|
|
57
|
-
}, key: "enabled" | "
|
|
43
|
+
}, key: "enabled" | "hubPeer", manager?: EntityManager) => Promise<boolean>;
|
|
58
44
|
json: <V = unknown>(domain: {
|
|
59
45
|
id: string;
|
|
60
|
-
}, key: "enabled" | "
|
|
46
|
+
}, key: "enabled" | "hubPeer", manager?: EntityManager) => Promise<V>;
|
|
61
47
|
};
|
|
62
48
|
export interface GuildPlace {
|
|
63
49
|
enabled: boolean;
|
|
64
|
-
hub: boolean;
|
|
65
50
|
hubPeer?: string;
|
|
66
51
|
}
|
|
67
|
-
/** The
|
|
52
|
+
/** The two settings, read through the work's own manager so a test's or a door's transaction sees them. */
|
|
68
53
|
export declare function guildPlaceOf(domain: {
|
|
69
54
|
id: string;
|
|
70
55
|
}, manager?: EntityManager): Promise<GuildPlace>;
|
package/dist-server/settings.js
CHANGED
|
@@ -5,12 +5,13 @@ exports.guildPlaceOf = guildPlaceOf;
|
|
|
5
5
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
6
6
|
const setting_base_1 = require("@things-factory/setting-base");
|
|
7
7
|
/*
|
|
8
|
-
* **Where the guild is for a domain** (design §9) -
|
|
8
|
+
* **Where the guild is for a domain** (design §9) - two domain settings every application carries, declared here
|
|
9
9
|
* because every application loads this module and only some load the hub.
|
|
10
10
|
*
|
|
11
11
|
* - `Guild::enabled` - off, the application sends nothing and draws nothing; its screens stay as they are.
|
|
12
|
-
* - `Guild::
|
|
13
|
-
*
|
|
12
|
+
* - `Guild::hubPeer` - the rewards are kept on another server: facts go out on the webhook outbox to this peer.
|
|
13
|
+
* Empty, they are kept on this server - where the hub module is loaded, nothing else to switch on (사용자
|
|
14
|
+
* 2026-11-27: 「"이 서버의 허브 사용" 이 말을 쉽게 이해할 수가 있냐」 - the `Guild::hub` switch is gone).
|
|
14
15
|
*
|
|
15
16
|
* They are changed by whoever runs the guild (`guild-admin`).
|
|
16
17
|
*/
|
|
@@ -27,17 +28,6 @@ exports.GUILD_SETTINGS = (0, setting_base_1.declareDomainSettings)('guild-overla
|
|
|
27
28
|
order: 1,
|
|
28
29
|
write: { category: 'guild-admin', privilege: 'mutation' }
|
|
29
30
|
},
|
|
30
|
-
hub: {
|
|
31
|
-
name: 'Guild::hub',
|
|
32
|
-
type: 'boolean',
|
|
33
|
-
level: 'domain',
|
|
34
|
-
section: 'connection',
|
|
35
|
-
card: 'title.guild',
|
|
36
|
-
label: 'label.guild-hub',
|
|
37
|
-
hint: 'text.guild-hub-hint',
|
|
38
|
-
order: 2,
|
|
39
|
-
write: { category: 'guild-admin', privilege: 'mutation' }
|
|
40
|
-
},
|
|
41
31
|
hubPeer: {
|
|
42
32
|
name: 'Guild::hubPeer',
|
|
43
33
|
type: 'string',
|
|
@@ -52,13 +42,12 @@ exports.GUILD_SETTINGS = (0, setting_base_1.declareDomainSettings)('guild-overla
|
|
|
52
42
|
write: { category: 'guild-admin', privilege: 'mutation' }
|
|
53
43
|
}
|
|
54
44
|
});
|
|
55
|
-
/** The
|
|
45
|
+
/** The two settings, read through the work's own manager so a test's or a door's transaction sees them. */
|
|
56
46
|
async function guildPlaceOf(domain, manager) {
|
|
57
47
|
const enabled = await exports.GUILD_SETTINGS.flag(domain, 'enabled', manager);
|
|
58
48
|
if (!enabled)
|
|
59
|
-
return { enabled: false
|
|
60
|
-
const hub = await exports.GUILD_SETTINGS.flag(domain, 'hub', manager);
|
|
49
|
+
return { enabled: false };
|
|
61
50
|
const hubPeer = (await exports.GUILD_SETTINGS.text(domain, 'hubPeer', manager)) || undefined;
|
|
62
|
-
return { enabled,
|
|
51
|
+
return { enabled, ...(hubPeer ? { hubPeer } : {}) };
|
|
63
52
|
}
|
|
64
53
|
//# sourceMappingURL=settings.js.map
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/guild-overlay",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.316",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"files": [
|
|
6
|
+
"dist-client",
|
|
6
7
|
"dist-server",
|
|
7
8
|
"things-factory.config.js",
|
|
8
9
|
"translations",
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
"things-factory": true,
|
|
19
20
|
"license": "MIT",
|
|
20
21
|
"author": "heartyoh <heartyoh@hatiolab.com>",
|
|
21
|
-
"description": "The guild overlay every application loads - it declares the contribution kinds a product sends and hands confirmed contributions to the guild hub, on this server in the same transaction or on another over the webhook outbox (operato-guild)",
|
|
22
|
+
"description": "The guild overlay every application loads - it declares the contribution kinds a product sends and hands confirmed contributions to the guild hub, on this server in the same transaction or on another over the webhook outbox, and draws the game overlay - the wallet chip, the coins and the quest panel (operato-guild)",
|
|
22
23
|
"publishConfig": {
|
|
23
24
|
"access": "public",
|
|
24
25
|
"@things-factory:registry": "https://registry.npmjs.org"
|
|
@@ -29,20 +30,23 @@
|
|
|
29
30
|
"directory": "packages/guild-overlay"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
|
-
"build": "npm run build:server",
|
|
33
|
+
"build": "npm run build:server && npm run build:client",
|
|
33
34
|
"build:server": "npm run clean:server && npx tsc --p ./server/tsconfig.json",
|
|
35
|
+
"build:client": "npm run clean:client && npm run copy:files && npx tsc --p ./client/tsconfig.json",
|
|
36
|
+
"copy:files": "copyfiles -e \"./client/**/*.{ts,js,json}\" -u 1 \"./client/**/*\" dist-client",
|
|
34
37
|
"clean:server": "rm -rf dist-server",
|
|
35
|
-
"clean": "
|
|
38
|
+
"clean:client": "rm -rf dist-client",
|
|
39
|
+
"clean": "npm run clean:server && npm run clean:client",
|
|
36
40
|
"test": "npm run build:server && node --import ./test/resolve-ts-siblings.mjs --test test/*.test.ts"
|
|
37
41
|
},
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@things-factory/auth-base": "^10.1.
|
|
43
|
+
"@things-factory/auth-base": "^10.1.316",
|
|
40
44
|
"@things-factory/env": "^10.1.298",
|
|
41
|
-
"@things-factory/fact-change": "^10.1.
|
|
42
|
-
"@things-factory/setting-base": "^10.1.
|
|
45
|
+
"@things-factory/fact-change": "^10.1.316",
|
|
46
|
+
"@things-factory/setting-base": "^10.1.316",
|
|
43
47
|
"@things-factory/shell": "^10.1.304",
|
|
44
|
-
"@things-factory/webhook": "^10.1.
|
|
45
|
-
"@things-factory/worklist": "^10.1.
|
|
48
|
+
"@things-factory/webhook": "^10.1.316",
|
|
49
|
+
"@things-factory/worklist": "^10.1.316"
|
|
46
50
|
},
|
|
47
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "8bdf4ae696ae7ec9c21312485f86f212052bb10a"
|
|
48
52
|
}
|
package/translations/en.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"title.guild": "Contribution rewards (guild)",
|
|
3
2
|
"label.guild-enabled": "Use contribution rewards",
|
|
4
|
-
"
|
|
5
|
-
"label.guild-
|
|
6
|
-
"
|
|
7
|
-
"label.guild-
|
|
8
|
-
"text.guild-
|
|
9
|
-
|
|
3
|
+
"label.guild-hub-peer": "Server that keeps the rewards, if not this one",
|
|
4
|
+
"label.guild-overlay-reduce-motion": "Reduce motion",
|
|
5
|
+
"label.guild-overlay-show": "Show coins",
|
|
6
|
+
"label.guild-overlay-sound": "Sound",
|
|
7
|
+
"text.guild-enabled-hint": "On: each time someone’s work is confirmed they earn reward points, and a small coin shows for a moment at the top right. Off: no points, no coins.",
|
|
8
|
+
"text.guild-hub-peer-hint": "Usually leave it empty - then this server keeps the rewards. Fill it in only when another server keeps this app’s rewards, with that server’s connection name.",
|
|
9
|
+
"text.guild-overlay-confirmed": "Record confirmed",
|
|
10
|
+
"text.guild-overlay-confirmed-more": "{label} and {count} more",
|
|
11
|
+
"text.guild-overlay-impact": "Your record was put to use",
|
|
12
|
+
"text.guild-overlay-issued": "{gt} GT acquired",
|
|
13
|
+
"text.guild-overlay-setting-note": "Your coins and balance are shown to you alone.",
|
|
14
|
+
"title.guild": "Contribution rewards",
|
|
15
|
+
"title.guild-overlay-setting": "Guild coins"
|
|
16
|
+
}
|
package/translations/es.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"label.guild-
|
|
4
|
-
"
|
|
5
|
-
"label.guild-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"text.guild-hub-peer-hint": "
|
|
9
|
-
|
|
2
|
+
"label.guild-enabled": "Usar recompensas por contribución",
|
|
3
|
+
"label.guild-hub-peer": "Servidor que guarda las recompensas, si no es este",
|
|
4
|
+
"label.guild-overlay-reduce-motion": "Reducir el movimiento",
|
|
5
|
+
"label.guild-overlay-show": "Mostrar monedas",
|
|
6
|
+
"label.guild-overlay-sound": "Sonido",
|
|
7
|
+
"text.guild-enabled-hint": "Activado: cada vez que se confirma el trabajo de alguien, acumula puntos y aparece un instante una pequeña moneda arriba a la derecha. Desactivado: ni puntos ni monedas.",
|
|
8
|
+
"text.guild-hub-peer-hint": "Normalmente déjalo vacío: entonces este servidor guarda las recompensas. Rellénalo solo si otro servidor guarda las recompensas de esta app, con el nombre de conexión de ese servidor.",
|
|
9
|
+
"text.guild-overlay-confirmed": "Registro confirmado",
|
|
10
|
+
"text.guild-overlay-confirmed-more": "{label} y {count} más",
|
|
11
|
+
"text.guild-overlay-impact": "Tu registro se aprovechó",
|
|
12
|
+
"text.guild-overlay-issued": "{gt} GT obtenidos",
|
|
13
|
+
"text.guild-overlay-setting-note": "Tus monedas y tu saldo solo los ves tú.",
|
|
14
|
+
"title.guild": "Recompensas por contribución",
|
|
15
|
+
"title.guild-overlay-setting": "Monedas del gremio"
|
|
16
|
+
}
|