@pleasenobugs/core 0.2.0 → 0.4.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.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The code a wallet's identicon is drawn from, without the address.
3
+ *
4
+ * Every Nimiq wallet shows the same little picture for an address: Nimiq's
5
+ * identicons (`@nimiq/identicons`, MIT) hash the address as the wallet writes
6
+ * it, spaced (`NQ07 0000 ...`), into a string of digits, and the first twelve
7
+ * pick the colours and the parts. This is those twelve, so a board can show
8
+ * somebody's identicon while the address stays on the server: the digits say
9
+ * which picture, and nothing about which wallet.
10
+ *
11
+ * Changing this changes every identicon on every board, so it is part of the
12
+ * v1 contract, like the login message.
13
+ *
14
+ * @example
15
+ * identiconCode('NQ07 0000 0000 0000 0000 0000 0000 0000 0000') // → twelve digits
16
+ */
17
+ export declare function identiconCode(address: string): string;
18
+ /** Whether a string is shaped like an identicon code. */
19
+ export declare function isIdenticonCode(v: unknown): v is string;
20
+ //# sourceMappingURL=identicon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identicon.d.ts","sourceRoot":"","sources":["../src/identicon.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAEvD"}
@@ -0,0 +1,49 @@
1
+ import { normalizeAddress } from './address.js';
2
+ /**
3
+ * The code a wallet's identicon is drawn from, without the address.
4
+ *
5
+ * Every Nimiq wallet shows the same little picture for an address: Nimiq's
6
+ * identicons (`@nimiq/identicons`, MIT) hash the address as the wallet writes
7
+ * it, spaced (`NQ07 0000 ...`), into a string of digits, and the first twelve
8
+ * pick the colours and the parts. This is those twelve, so a board can show
9
+ * somebody's identicon while the address stays on the server: the digits say
10
+ * which picture, and nothing about which wallet.
11
+ *
12
+ * Changing this changes every identicon on every board, so it is part of the
13
+ * v1 contract, like the login message.
14
+ *
15
+ * @example
16
+ * identiconCode('NQ07 0000 0000 0000 0000 0000 0000 0000 0000') // → twelve digits
17
+ */
18
+ export function identiconCode(address) {
19
+ // The hash is a float written out, so in theory it can carry an exponent;
20
+ // a digit stands in for anything else rather than refusing the post.
21
+ return makeHash(spaced(address)).slice(0, 12).replace(/\D/g, '0');
22
+ }
23
+ /** Whether a string is shaped like an identicon code. */
24
+ export function isIdenticonCode(v) {
25
+ return typeof v === 'string' && /^\d{12}$/.test(v);
26
+ }
27
+ /** The spelling wallets show, and hash: groups of four, one space apart. */
28
+ function spaced(address) {
29
+ return normalizeAddress(address).replace(/(.{4})(?=.)/g, '$1 ');
30
+ }
31
+ // Ported as-is from @nimiq/identicons 1.6.2 (MIT, © 2017 Nimiq), so the
32
+ // picture matches the one in the wallet digit for digit.
33
+ function makeHash(text) {
34
+ const r = ('' +
35
+ text
36
+ .split('')
37
+ .map((c) => Number(c.charCodeAt(0)) + 3)
38
+ .reduce((a, e) => a * (1 - a) * chaosHash(e), 0.5))
39
+ .split('')
40
+ .reduce((a, e) => e + a, '');
41
+ return r.replace('.', r[5]).substr(4, 17).padEnd(13, r[5]);
42
+ }
43
+ function chaosHash(n) {
44
+ let r = 1 / n;
45
+ for (let i = 0; i < 100; i++)
46
+ r = (1 - r) * r * 3.569956786876;
47
+ return r;
48
+ }
49
+ //# sourceMappingURL=identicon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identicon.js","sourceRoot":"","sources":["../src/identicon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,0EAA0E;IAC1E,qEAAqE;IACrE,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,E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C,GAAG,GAAG,EAAE,CAAC,EAAE;QAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC;IAC/D,OAAO,CAAC,CAAC;AACX,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,4 +4,6 @@ export * from './rules.js';
4
4
  export * from './login.js';
5
5
  export * from './similar.js';
6
6
  export * from './sort.js';
7
+ export * from './thread.js';
8
+ export * from './identicon.js';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -4,4 +4,6 @@ export * from './rules.js';
4
4
  export * from './login.js';
5
5
  export * from './similar.js';
6
6
  export * from './sort.js';
7
+ export * from './thread.js';
8
+ export * from './identicon.js';
7
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
package/dist/login.d.ts CHANGED
@@ -28,8 +28,8 @@ export declare const DASHBOARD_PROJECT = "dashboard";
28
28
  * the v1 contract.
29
29
  *
30
30
  * @example
31
- * loginMessage({ project: 'shitti', origin: 'https://shitti.me', issued: 0 })
32
- * // → 'PleaseNoBugs login\nProject: shitti\nOrigin: https://shitti.me\nIssued: 1970-01-01T00:00:00.000Z'
31
+ * loginMessage({ project: 'myapp', origin: 'https://my.app', issued: 0 })
32
+ * // → 'PleaseNoBugs login\nProject: myapp\nOrigin: https://my.app\nIssued: 1970-01-01T00:00:00.000Z'
33
33
  */
34
34
  export declare function loginMessage(args: {
35
35
  project: string;
@@ -41,7 +41,7 @@ export declare function loginMessage(args: {
41
41
  * if it is not a URL at all (which then simply never matches anything).
42
42
  *
43
43
  * @example
44
- * normalizeOrigin('https://Shitti.me/') // → 'https://shitti.me'
44
+ * normalizeOrigin('https://My.App/') // → 'https://my.app'
45
45
  */
46
46
  export declare function normalizeOrigin(origin: string): string;
47
47
  /**
package/dist/login.js CHANGED
@@ -27,8 +27,8 @@ export const DASHBOARD_PROJECT = 'dashboard';
27
27
  * the v1 contract.
28
28
  *
29
29
  * @example
30
- * loginMessage({ project: 'shitti', origin: 'https://shitti.me', issued: 0 })
31
- * // → 'PleaseNoBugs login\nProject: shitti\nOrigin: https://shitti.me\nIssued: 1970-01-01T00:00:00.000Z'
30
+ * loginMessage({ project: 'myapp', origin: 'https://my.app', issued: 0 })
31
+ * // → 'PleaseNoBugs login\nProject: myapp\nOrigin: https://my.app\nIssued: 1970-01-01T00:00:00.000Z'
32
32
  */
33
33
  export function loginMessage(args) {
34
34
  return [
@@ -43,7 +43,7 @@ export function loginMessage(args) {
43
43
  * if it is not a URL at all (which then simply never matches anything).
44
44
  *
45
45
  * @example
46
- * normalizeOrigin('https://Shitti.me/') // → 'https://shitti.me'
46
+ * normalizeOrigin('https://My.App/') // → 'https://my.app'
47
47
  */
48
48
  export function normalizeOrigin(origin) {
49
49
  try {
package/dist/rules.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { PostKind, PostStatus, Rules, ShotRule } from './types.js';
1
+ import type { PostFix, PostKind, PostStatus, Rules, ShotRule } from './types.js';
2
2
  /**
3
- * The limits a new project starts with. These are the numbers Shitti's board
4
- * ran on, where they had been tried on real people before being written here.
3
+ * The limits a new project starts with. These are the numbers the board of
4
+ * the app PleaseNoBugs grew out of ran on, where they had been tried on real people before being written here.
5
5
  */
6
6
  export declare const DEFAULT_RULES: Readonly<Rules>;
7
7
  export declare const SHOT_RULES: readonly ShotRule[];
@@ -37,6 +37,60 @@ export type ShotType = (typeof SHOT_TYPES)[number];
37
37
  export declare function takesShot(kind: PostKind): boolean;
38
38
  /** Whether a value is one of the four states, for reading a request body. */
39
39
  export declare function isPostStatus(v: unknown): v is PostStatus;
40
+ /** An update: its title, the lines under it, and how many posts it may say it fixed. */
41
+ export declare const UPDATE_TITLE_MAX = 80;
42
+ export declare const UPDATE_TEXT_MAX = 300;
43
+ export declare const UPDATE_POSTS_MAX = 50;
44
+ /** A version as an app numbers its releases, and a link to a fix. */
45
+ export declare const VERSION_MAX = 24;
46
+ export declare const LINK_MAX = 300;
47
+ /**
48
+ * A version, trimmed: `''` for none, null when it is not one. Letters,
49
+ * digits and `. + _ -`, starting with a letter or a digit, so it reads the
50
+ * same on every card and can never be more than a label.
51
+ *
52
+ * @example
53
+ * cleanVersion(' v1.4.2 ') // → 'v1.4.2'
54
+ * cleanVersion('') // → ''
55
+ * cleanVersion('1.4 beta') // → null
56
+ */
57
+ export declare function cleanVersion(v: unknown): string | null;
58
+ /**
59
+ * A link to a page on github.com or gitlab.com, as one clean `https://`
60
+ * address: `''` for none, null for anything that is not one.
61
+ *
62
+ * Those two and nothing else, on purpose: a link on a board is something an
63
+ * app's users are invited to tap, and "it goes to the code" is a promise this
64
+ * keeps for every board, whoever runs it. A GitLab on somebody's own server
65
+ * is left out for the same reason: its address could be anything. People
66
+ * paste a link the way an address bar shows it, so a missing `https://` is
67
+ * added and `http://` and `www.` are tidied away. A bare `github.com` is
68
+ * refused: it points at nothing in particular.
69
+ *
70
+ * @example
71
+ * cleanCodeLink('github.com/me/app/pull/42') // → 'https://github.com/me/app/pull/42'
72
+ * cleanCodeLink('gitlab.com/me/app/-/merge_requests/7') // → 'https://gitlab.com/me/app/-/merge_requests/7'
73
+ * cleanCodeLink('https://github.com.evil.example') // → null
74
+ * cleanCodeLink('javascript:alert(1)') // → null
75
+ */
76
+ export declare function cleanCodeLink(v: unknown): string | null;
77
+ /**
78
+ * Which site a link goes to, by name, for "View on GitHub": null for one
79
+ * {@link cleanCodeLink} would refuse.
80
+ *
81
+ * @example
82
+ * codeSite('https://gitlab.com/me/app/-/releases/v2') // → 'GitLab'
83
+ */
84
+ export declare function codeSite(link: string): 'GitHub' | 'GitLab' | null;
85
+ /**
86
+ * A fix from a request body, `{ version?, link? }`, cleaned: `{}` when it
87
+ * says nothing, null when either part is not what it claims to be.
88
+ *
89
+ * @example
90
+ * cleanFix({ version: '1.4.2', link: 'github.com/me/app/pull/42' })
91
+ * // → { version: '1.4.2', link: 'https://github.com/me/app/pull/42' }
92
+ */
93
+ export declare function cleanFix(v: unknown): PostFix | null;
40
94
  /**
41
95
  * A post's context, cleaned to what the server will store, or null when it is
42
96
  * not an object at all.
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEx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DAAqD,CAAC;AAC7E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEjD;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,UAAU,CAExD;AAED,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,qEAAqE;AACrE,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,QAAQ,MAAM,CAAC;AAE5B;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKtD;AAUD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAgBvD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAIjE;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAOnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAWtE"}
package/dist/rules.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The limits a new project starts with. These are the numbers Shitti's board
3
- * ran on, where they had been tried on real people before being written here.
2
+ * The limits a new project starts with. These are the numbers the board of
3
+ * the app PleaseNoBugs grew out of ran on, where they had been tried on real people before being written here.
4
4
  */
5
5
  export const DEFAULT_RULES = Object.freeze({
6
6
  perDay: 5,
@@ -55,6 +55,111 @@ export function takesShot(kind) {
55
55
  export function isPostStatus(v) {
56
56
  return typeof v === 'string' && POST_STATUSES.includes(v);
57
57
  }
58
+ /** An update: its title, the lines under it, and how many posts it may say it fixed. */
59
+ export const UPDATE_TITLE_MAX = 80;
60
+ export const UPDATE_TEXT_MAX = 300;
61
+ export const UPDATE_POSTS_MAX = 50;
62
+ /** A version as an app numbers its releases, and a link to a fix. */
63
+ export const VERSION_MAX = 24;
64
+ export const LINK_MAX = 300;
65
+ /**
66
+ * A version, trimmed: `''` for none, null when it is not one. Letters,
67
+ * digits and `. + _ -`, starting with a letter or a digit, so it reads the
68
+ * same on every card and can never be more than a label.
69
+ *
70
+ * @example
71
+ * cleanVersion(' v1.4.2 ') // → 'v1.4.2'
72
+ * cleanVersion('') // → ''
73
+ * cleanVersion('1.4 beta') // → null
74
+ */
75
+ export function cleanVersion(v) {
76
+ if (typeof v !== 'string')
77
+ return null;
78
+ const s = v.trim();
79
+ if (!s)
80
+ return '';
81
+ return s.length <= VERSION_MAX && /^[0-9A-Za-z][0-9A-Za-z.+_-]*$/.test(s) ? s : null;
82
+ }
83
+ /** The sites a fix or an update may link to, by the host a link names, and the host it is written with. */
84
+ const CODE_SITES = {
85
+ 'github.com': 'github.com',
86
+ 'www.github.com': 'github.com',
87
+ 'gitlab.com': 'gitlab.com',
88
+ 'www.gitlab.com': 'gitlab.com',
89
+ };
90
+ /**
91
+ * A link to a page on github.com or gitlab.com, as one clean `https://`
92
+ * address: `''` for none, null for anything that is not one.
93
+ *
94
+ * Those two and nothing else, on purpose: a link on a board is something an
95
+ * app's users are invited to tap, and "it goes to the code" is a promise this
96
+ * keeps for every board, whoever runs it. A GitLab on somebody's own server
97
+ * is left out for the same reason: its address could be anything. People
98
+ * paste a link the way an address bar shows it, so a missing `https://` is
99
+ * added and `http://` and `www.` are tidied away. A bare `github.com` is
100
+ * refused: it points at nothing in particular.
101
+ *
102
+ * @example
103
+ * cleanCodeLink('github.com/me/app/pull/42') // → 'https://github.com/me/app/pull/42'
104
+ * cleanCodeLink('gitlab.com/me/app/-/merge_requests/7') // → 'https://gitlab.com/me/app/-/merge_requests/7'
105
+ * cleanCodeLink('https://github.com.evil.example') // → null
106
+ * cleanCodeLink('javascript:alert(1)') // → null
107
+ */
108
+ export function cleanCodeLink(v) {
109
+ if (typeof v !== 'string')
110
+ return null;
111
+ const s = v.trim();
112
+ if (!s)
113
+ return '';
114
+ if (s.length > LINK_MAX)
115
+ return null;
116
+ let url;
117
+ try {
118
+ url = new URL(/^https?:\/\//i.test(s) ? s : `https://${s}`);
119
+ }
120
+ catch {
121
+ return null;
122
+ }
123
+ if (url.protocol !== 'https:' && url.protocol !== 'http:')
124
+ return null;
125
+ const host = CODE_SITES[url.hostname];
126
+ if (!host)
127
+ return null;
128
+ if (url.username || url.password || url.port || url.pathname.length < 2)
129
+ return null;
130
+ return `https://${host}${url.pathname}${url.search}${url.hash}`;
131
+ }
132
+ /**
133
+ * Which site a link goes to, by name, for "View on GitHub": null for one
134
+ * {@link cleanCodeLink} would refuse.
135
+ *
136
+ * @example
137
+ * codeSite('https://gitlab.com/me/app/-/releases/v2') // → 'GitLab'
138
+ */
139
+ export function codeSite(link) {
140
+ const clean = cleanCodeLink(link);
141
+ if (!clean)
142
+ return null;
143
+ return clean.startsWith('https://gitlab.com/') ? 'GitLab' : 'GitHub';
144
+ }
145
+ /**
146
+ * A fix from a request body, `{ version?, link? }`, cleaned: `{}` when it
147
+ * says nothing, null when either part is not what it claims to be.
148
+ *
149
+ * @example
150
+ * cleanFix({ version: '1.4.2', link: 'github.com/me/app/pull/42' })
151
+ * // → { version: '1.4.2', link: 'https://github.com/me/app/pull/42' }
152
+ */
153
+ export function cleanFix(v) {
154
+ if (!v || typeof v !== 'object' || Array.isArray(v))
155
+ return null;
156
+ const { version, link } = v;
157
+ const ver = version === undefined ? '' : cleanVersion(version);
158
+ const url = link === undefined ? '' : cleanCodeLink(link);
159
+ if (ver === null || url === null)
160
+ return null;
161
+ return { ...(ver ? { version: ver } : {}), ...(url ? { link: url } : {}) };
162
+ }
58
163
  /**
59
164
  * A post's context, cleaned to what the server will store, or null when it is
60
165
  * not an object at all.
package/dist/rules.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAoB,MAAM,CAAC,MAAM,CAAC;IAC1D,MAAM,EAAE,CAAC;IACT;oCACgC;IAChC,OAAO,EAAE,GAAG;IACZ,4EAA4E;IAC5E,QAAQ,EAAE,GAAG;IACb,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAe;IAC9C,WAAW,EAAE,OAAmB;IAChC,OAAO,EAAE,KAAK;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAE1E,2FAA2F;AAC3F,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAK,UAAgC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAE3B,+BAA+B;AAC/B,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,6CAA6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,mFAAmF;AACnF,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,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AAM,GAAG,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC9C,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,CAAU;IACrC,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACjE,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,IAAI,gBAAgB;YAAE,MAAM;QACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,EAAE;YAAE,SAAS;QACnE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAC7C,CAAC,EAAE,CAAC;IACN,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/similar.d.ts CHANGED
@@ -22,7 +22,7 @@ export interface Matchable {
22
22
  * @param projectNoise words common in *this* app, like its own name
23
23
  *
24
24
  * @example
25
- * const likeThis = createMatcher(['shitti', 'nim', 'taak', 'task']);
25
+ * const likeThis = createMatcher(['nim', 'wallet', 'task']);
26
26
  * likeThis(posts, 'de camera opent niet bij het bewijs');
27
27
  * // → the existing "camera opent niet" post, if there is one
28
28
  */
package/dist/similar.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Words too common to say anything about what a post is about, one group per
3
3
  * language the widget speaks.
4
4
  *
5
- * **A new language owes this table a group.** Shitti added German without one,
5
+ * **A new language owes this table a group.** German was once added without one,
6
6
  * which left "aufgabe" significant where its Dutch and English twins were not:
7
7
  * two unrelated German posts sharing it and one filler word matched, and the
8
8
  * suggestions filled with lookalikes nobody meant.
@@ -45,7 +45,7 @@ const NOISE = [
45
45
  * @param projectNoise words common in *this* app, like its own name
46
46
  *
47
47
  * @example
48
- * const likeThis = createMatcher(['shitti', 'nim', 'taak', 'task']);
48
+ * const likeThis = createMatcher(['nim', 'wallet', 'task']);
49
49
  * likeThis(posts, 'de camera opent niet bij het bewijs');
50
50
  * // → the existing "camera opent niet" post, if there is one
51
51
  */
@@ -0,0 +1,38 @@
1
+ import type { Message, PostKind, PostReply, PostStatus } from './types.js';
2
+ /**
3
+ * The rules of the conversation under a post, in one place, so the server
4
+ * that enforces them and the widget that draws them can never disagree about
5
+ * whose turn it is.
6
+ *
7
+ * A hidden message does not count. To everybody but the owners it is not
8
+ * there, so counting it would leave its author staring at a conversation that
9
+ * ends with the app's question and no way to answer it.
10
+ */
11
+ /** Whether a kind has a conversation the author can join. A review gets the app's answer and nothing back. */
12
+ export declare function takesAnswers(kind: PostKind): boolean;
13
+ /** Whether a status closes the conversation for the author: it is done, or will not be. */
14
+ export declare function isClosed(status: PostStatus): boolean;
15
+ /** The messages everybody sees, in order. */
16
+ export declare function shownThread(thread: Message[] | undefined): Message[];
17
+ /** The last message everybody sees, or undefined before anybody wrote. */
18
+ export declare function lastWord(thread: Message[] | undefined): Message | undefined;
19
+ /**
20
+ * Whether the author may write under their post now: a bug or an idea that
21
+ * is still open or planned, right after a message from the app.
22
+ *
23
+ * @example
24
+ * authorMayAnswer({ kind: 'bug', status: 'open', thread: [{ from: 'app', … }] }) // → true
25
+ * authorMayAnswer({ kind: 'bug', status: 'open', thread: [{ from: 'author', … }] }) // → false, the app is next
26
+ */
27
+ export declare function authorMayAnswer(post: {
28
+ kind: PostKind;
29
+ status: PostStatus;
30
+ thread?: Message[];
31
+ }): boolean;
32
+ /** Whether the author answered and the app has not said anything since: what "New answer" means to an owner. */
33
+ export declare function waitingOnApp(post: {
34
+ thread?: Message[];
35
+ }): boolean;
36
+ /** The app's latest message as the one reply widgets from before conversations read, or undefined. */
37
+ export declare function latestReply(thread: Message[] | undefined): PostReply | undefined;
38
+ //# sourceMappingURL=thread.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../src/thread.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE3E;;;;;;;;GAQG;AAEH,8GAA8G;AAC9G,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEpD;AAED,2FAA2F;AAC3F,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAEpD;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CAEpE;AAED,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAG3E;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG,OAAO,CAEzG;AAED,gHAAgH;AAChH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG,OAAO,CAElE;AAED,sGAAsG;AACtG,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAIhF"}
package/dist/thread.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The rules of the conversation under a post, in one place, so the server
3
+ * that enforces them and the widget that draws them can never disagree about
4
+ * whose turn it is.
5
+ *
6
+ * A hidden message does not count. To everybody but the owners it is not
7
+ * there, so counting it would leave its author staring at a conversation that
8
+ * ends with the app's question and no way to answer it.
9
+ */
10
+ /** Whether a kind has a conversation the author can join. A review gets the app's answer and nothing back. */
11
+ export function takesAnswers(kind) {
12
+ return kind === 'bug' || kind === 'idea';
13
+ }
14
+ /** Whether a status closes the conversation for the author: it is done, or will not be. */
15
+ export function isClosed(status) {
16
+ return status === 'done' || status === 'declined';
17
+ }
18
+ /** The messages everybody sees, in order. */
19
+ export function shownThread(thread) {
20
+ return (thread ?? []).filter((m) => !m.hidden);
21
+ }
22
+ /** The last message everybody sees, or undefined before anybody wrote. */
23
+ export function lastWord(thread) {
24
+ const shown = shownThread(thread);
25
+ return shown[shown.length - 1];
26
+ }
27
+ /**
28
+ * Whether the author may write under their post now: a bug or an idea that
29
+ * is still open or planned, right after a message from the app.
30
+ *
31
+ * @example
32
+ * authorMayAnswer({ kind: 'bug', status: 'open', thread: [{ from: 'app', … }] }) // → true
33
+ * authorMayAnswer({ kind: 'bug', status: 'open', thread: [{ from: 'author', … }] }) // → false, the app is next
34
+ */
35
+ export function authorMayAnswer(post) {
36
+ return takesAnswers(post.kind) && !isClosed(post.status) && lastWord(post.thread)?.from === 'app';
37
+ }
38
+ /** Whether the author answered and the app has not said anything since: what "New answer" means to an owner. */
39
+ export function waitingOnApp(post) {
40
+ return lastWord(post.thread)?.from === 'author';
41
+ }
42
+ /** The app's latest message as the one reply widgets from before conversations read, or undefined. */
43
+ export function latestReply(thread) {
44
+ const app = shownThread(thread).filter((m) => m.from === 'app');
45
+ const last = app[app.length - 1];
46
+ return last ? { text: last.text, at: last.at } : undefined;
47
+ }
48
+ //# sourceMappingURL=thread.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread.js","sourceRoot":"","sources":["../src/thread.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,8GAA8G;AAC9G,MAAM,UAAU,YAAY,CAAC,IAAc;IACzC,OAAO,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,MAAM,CAAC;AAC3C,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,QAAQ,CAAC,MAAkB;IACzC,OAAO,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,UAAU,CAAC;AACpD,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,WAAW,CAAC,MAA6B;IACvD,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,QAAQ,CAAC,MAA6B;IACpD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAgE;IAC9F,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,KAAK,KAAK,CAAC;AACpG,CAAC;AAED,gHAAgH;AAChH,MAAM,UAAU,YAAY,CAAC,IAA4B;IACvD,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,KAAK,QAAQ,CAAC;AAClD,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,WAAW,CAAC,MAA6B;IACvD,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC"}
package/dist/types.d.ts CHANGED
@@ -20,11 +20,53 @@ export type PostKind = 'bug' | 'idea' | 'review';
20
20
  * nothing was ever answered.
21
21
  */
22
22
  export type PostStatus = 'open' | 'planned' | 'done' | 'declined';
23
- /** An owner's answer under a post. One reply, never a thread. */
23
+ /**
24
+ * The app's latest message under a post, for widgets from before
25
+ * conversations: they read this and nothing else. The whole conversation is
26
+ * `thread`.
27
+ */
24
28
  export interface PostReply {
25
29
  text: string;
26
30
  at: number;
27
31
  }
32
+ /**
33
+ * Who wrote a message under a post: the app (one of the project's owners,
34
+ * speaking for it) or whoever wrote the post.
35
+ */
36
+ export type MessageFrom = 'app' | 'author';
37
+ /**
38
+ * One message in the conversation under a bug or an idea.
39
+ *
40
+ * The turns are the point: the app may write whenever it likes, the author
41
+ * only right after the app said something. So a conversation is always the
42
+ * app asking and the author answering, and never somebody talking to a wall.
43
+ */
44
+ export interface Message {
45
+ /** Minted by whoever sends it, so a retry is recognised. */
46
+ id: string;
47
+ from: MessageFrom;
48
+ text: string;
49
+ at: number;
50
+ /** When it was last changed, if it was. Only ever the last message, before anybody answered it. */
51
+ edited?: number;
52
+ /** Owners only: an author's message an owner took off the board. */
53
+ hidden?: boolean;
54
+ }
55
+ /**
56
+ * Where a fix can be found, set by an owner on a bug or an idea they marked
57
+ * done: the version it shipped in, and the page on GitHub or GitLab that
58
+ * shows it. Both optional, and gone as soon as the post stands anywhere but
59
+ * done.
60
+ *
61
+ * github.com and gitlab.com and nothing else, so a link on somebody's board
62
+ * always goes where it says it goes (see `cleanCodeLink`).
63
+ */
64
+ export interface PostFix {
65
+ /** As the app numbers its releases: `1.4.2`, `v2.0-beta`. */
66
+ version?: string;
67
+ /** A page on github.com or gitlab.com: a commit, a pull request or a release. */
68
+ link?: string;
69
+ }
28
70
  /**
29
71
  * Free-form detail for reproducing a bug: an app version, a screen, whether
30
72
  * the user was inside Nimiq Pay. Owners' eyes only.
@@ -72,7 +114,21 @@ export interface Post {
72
114
  /** The author's display name. Absent when they posted anonymously or never
73
115
  * chose one. Never an address: a name is a label, an address an identity. */
74
116
  who?: string;
117
+ /**
118
+ * The author's identicon, as the code `identiconCode` makes from their
119
+ * address: the picture their wallet shows, never the address. Only on a post
120
+ * that is not anonymous. `GET /v1/identicons/:code.svg` draws it.
121
+ */
122
+ face?: string;
123
+ /** The app's latest message, for widgets from before `thread`. */
75
124
  reply?: PostReply;
125
+ /**
126
+ * The conversation under it, oldest first. Absent until somebody wrote.
127
+ * Hidden messages reach owners only, marked.
128
+ */
129
+ thread?: Message[];
130
+ /** A done bug or idea only: where the fix is. Sent to everybody. */
131
+ fix?: PostFix;
76
132
  /** Reviews only: 1 to 5 stars. */
77
133
  rating?: number;
78
134
  /** Owners only. */
@@ -135,6 +191,8 @@ export interface Project extends PublicProject {
135
191
  export interface Me {
136
192
  owner: boolean;
137
193
  name?: string;
194
+ /** This wallet's identicon code, to show beside the name before posting. */
195
+ face?: string;
138
196
  /** Posts left in this wallet's rolling day. The allowance itself is
139
197
  * `rules.perDay`: read it from the project, never from a copy. */
140
198
  left: number;
@@ -146,12 +204,46 @@ export interface BoardRead {
146
204
  posts: Post[];
147
205
  /** Present only when the request carried a valid proof. */
148
206
  me?: Me;
207
+ /**
208
+ * How many updates the project has written, when it has any, so a widget
209
+ * can offer the Updates page without reading it first.
210
+ */
211
+ updates?: number;
149
212
  }
150
- /** One of your own posts that an owner has answered. `at` is when. */
213
+ /**
214
+ * One of your own posts that an owner has answered. `at` is when. Where it
215
+ * stands and its fix come along, so an app can say "fixed in 1.4.2" rather
216
+ * than only that there is news.
217
+ */
151
218
  export interface Answer {
152
219
  id: string;
153
220
  text: string;
154
221
  at: number;
222
+ status?: PostStatus;
223
+ fix?: PostFix;
224
+ }
225
+ /**
226
+ * What changed in the app, written by an owner for the Updates page. Anybody
227
+ * may read a project's updates, signed in or not, like the board.
228
+ *
229
+ * Every update has a link, because what the page is for is getting from "it
230
+ * changed" to the change itself, on GitHub or GitLab, in one tap.
231
+ */
232
+ export interface Update {
233
+ id: string;
234
+ title: string;
235
+ /** A few lines on what changed. */
236
+ text?: string;
237
+ version?: string;
238
+ /** A page on github.com or gitlab.com. */
239
+ link: string;
240
+ at: number;
241
+ /**
242
+ * The bugs and ideas on the board it fixed or built, as post ids. Each was
243
+ * marked done with this update's version and link when it was written. Only
244
+ * those still on the board are sent.
245
+ */
246
+ posts: string[];
155
247
  }
156
248
  /**
157
249
  * Who is asking, sent base64url-encoded in `Authorization: Nimiq <...>`.
@@ -187,5 +279,5 @@ export interface AppLogin {
187
279
  message: string;
188
280
  }
189
281
  /** Every error the API answers with, as `{ error: ErrorCode }`. */
190
- export type ErrorCode = 'bad_request' | 'unauthorized' | 'not_yours' | 'not_owner' | 'origin_not_allowed' | 'no_project' | 'no_post' | 'duplicate' | 'reviewed' | 'too_many' | 'rate_limited' | 'not_found' | 'internal';
282
+ export type ErrorCode = 'bad_request' | 'unauthorized' | 'not_yours' | 'not_owner' | 'origin_not_allowed' | 'no_project' | 'no_post' | 'no_update' | 'duplicate' | 'reviewed' | 'not_your_turn' | 'closed' | 'too_many' | 'rate_limited' | 'not_found' | 'internal';
191
283
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.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GACV,cAAc,GACd,WAAW,GACX,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pleasenobugs/core",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Types, rules, the login message and the lookalike matcher shared by every PleaseNoBugs package.",
5
5
  "license": "MIT",
6
6
  "repository": {