@danypops/papyrus 0.35.0 → 0.35.1
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/package.json +1 -1
- package/src/modules/discuss.ts +6 -1
package/package.json
CHANGED
package/src/modules/discuss.ts
CHANGED
|
@@ -12,10 +12,15 @@ type OperationInput = Record<string, unknown>;
|
|
|
12
12
|
|
|
13
13
|
function string(input: OperationInput, key: string): string {
|
|
14
14
|
const value = input[key];
|
|
15
|
-
if (typeof value !== "string" || value.length === 0) throw new Error(`${key} is required`);
|
|
15
|
+
if (typeof value !== "string" || value.length === 0) throw new Error(`${key} is required${REQUIRED_FIELD_HINTS[key] ? ` (${REQUIRED_FIELD_HINTS[key]})` : ""}`);
|
|
16
16
|
return value;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/** Fields whose name alone doesn't say what a valid value looks like -- everything else (title, content, id, settlement) is self-explanatory. */
|
|
20
|
+
const REQUIRED_FIELD_HINTS: Record<string, string> = {
|
|
21
|
+
actor: 'a display name for who is posting, e.g. "alice" or "agent"',
|
|
22
|
+
};
|
|
23
|
+
|
|
19
24
|
function optionalString(input: OperationInput, key: string): string | undefined {
|
|
20
25
|
const value = input[key];
|
|
21
26
|
if (value === undefined) return undefined;
|