@pleasenobugs/core 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +20 -2
- package/dist/address.d.ts +21 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +25 -0
- package/dist/address.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/login.d.ts +62 -0
- package/dist/login.d.ts.map +1 -0
- package/dist/login.js +107 -0
- package/dist/login.js.map +1 -0
- package/dist/rules.d.ts +35 -0
- package/dist/rules.d.ts.map +1 -0
- package/dist/rules.js +60 -0
- package/dist/rules.js.map +1 -0
- package/dist/similar.d.ts +30 -0
- package/dist/similar.d.ts.map +1 -0
- package/dist/similar.js +84 -0
- package/dist/similar.js.map +1 -0
- package/dist/sort.d.ts +22 -0
- package/dist/sort.d.ts.map +1 -0
- package/dist/sort.js +22 -0
- package/dist/sort.js.map +1 -0
- package/dist/types.d.ts +150 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +32 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lennylenders
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pleasenobugs/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The part of [PleaseNoBugs](../../README.md) every other package shares. No
|
|
4
|
+
dependencies, runs in a browser and in Node 18+.
|
|
5
|
+
|
|
6
|
+
- **Types**: the v1 contract (`Post`, `Project`, `BoardRead`, `LoginProof`, ...).
|
|
7
|
+
See [docs/api-v1.md](../../docs/api-v1.md).
|
|
8
|
+
- **Rules**: `DEFAULT_RULES`, the limits, and body validators.
|
|
9
|
+
- **Login**: `loginMessage()`, the exact text a wallet signs, plus encoding the
|
|
10
|
+
proof into an `Authorization` header.
|
|
11
|
+
- **Lookalikes**: `createMatcher()`, which finds existing posts resembling the
|
|
12
|
+
one being typed.
|
|
13
|
+
- **Sorting**: `sortPosts()` for the Top and New tabs.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createMatcher, sortPosts } from '@pleasenobugs/core';
|
|
17
|
+
|
|
18
|
+
const likeThis = createMatcher(['myapp']); // words common in your app
|
|
19
|
+
likeThis(board.posts, draft); // → up to 3 lookalikes
|
|
20
|
+
sortPosts(board.posts, 'top');
|
|
21
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Nimiq address in the one spelling every comparison and every stored row
|
|
3
|
+
* uses: upper case, no spaces.
|
|
4
|
+
*
|
|
5
|
+
* Wallets hand addresses out spaced (`NQ07 0000 ...`) and people paste them
|
|
6
|
+
* however they like. Comparing two spellings of one wallet as different
|
|
7
|
+
* wallets is how one person gets two votes, so nothing is compared until it
|
|
8
|
+
* has been through here.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* normalizeAddress('nq07 0000 0000 0000 0000 0000 0000 0000 0000')
|
|
12
|
+
* // → 'NQ070000000000000000000000000000000000'
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeAddress(address: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether a string is shaped like a Nimiq address (in any spelling). Shape
|
|
17
|
+
* only: the checksum is the wallet's business, and a signature from a key
|
|
18
|
+
* proves far more than a checksum could.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isNimiqAddress(v: unknown): v is string;
|
|
21
|
+
//# sourceMappingURL=address.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAEtD"}
|
package/dist/address.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Nimiq address in the one spelling every comparison and every stored row
|
|
3
|
+
* uses: upper case, no spaces.
|
|
4
|
+
*
|
|
5
|
+
* Wallets hand addresses out spaced (`NQ07 0000 ...`) and people paste them
|
|
6
|
+
* however they like. Comparing two spellings of one wallet as different
|
|
7
|
+
* wallets is how one person gets two votes, so nothing is compared until it
|
|
8
|
+
* has been through here.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* normalizeAddress('nq07 0000 0000 0000 0000 0000 0000 0000 0000')
|
|
12
|
+
* // → 'NQ070000000000000000000000000000000000'
|
|
13
|
+
*/
|
|
14
|
+
export function normalizeAddress(address) {
|
|
15
|
+
return address.replace(/\s+/g, '').toUpperCase();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Whether a string is shaped like a Nimiq address (in any spelling). Shape
|
|
19
|
+
* only: the checksum is the wallet's business, and a signature from a key
|
|
20
|
+
* proves far more than a checksum could.
|
|
21
|
+
*/
|
|
22
|
+
export function isNimiqAddress(v) {
|
|
23
|
+
return typeof v === 'string' && /^NQ\d{2}[0-9A-Z]{32}$/.test(normalizeAddress(v));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../src/address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,CAAU;IACvC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,uBAAuB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AACpF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +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"}
|
package/dist/login.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { LoginProof } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* How long a proof is good for. After that the widget asks the wallet again.
|
|
4
|
+
*
|
|
5
|
+
* Long, because every signature is a native prompt the user has to tap, and a
|
|
6
|
+
* board you have to re-sign weekly is a board people stop using. The proof
|
|
7
|
+
* proves *who*, nothing more; it cannot move funds.
|
|
8
|
+
*/
|
|
9
|
+
export declare const LOGIN_TTL_MS: number;
|
|
10
|
+
/** How far in the future `issued` may be, for a phone whose clock runs fast. */
|
|
11
|
+
export declare const LOGIN_SKEW_MS: number;
|
|
12
|
+
/** The project name a dashboard proof carries instead of a project id. */
|
|
13
|
+
export declare const DASHBOARD_PROJECT = "dashboard";
|
|
14
|
+
/**
|
|
15
|
+
* The exact text a wallet signs to post on one project's board.
|
|
16
|
+
*
|
|
17
|
+
* **It names the project and the origin, and that is the whole security
|
|
18
|
+
* story.** One server serves many apps. If they all had their users sign one
|
|
19
|
+
* fixed sentence, any app could collect those signatures and post as its
|
|
20
|
+
* users on every other board. Scoped like this, a proof is useless anywhere
|
|
21
|
+
* but the board and the site it was given to.
|
|
22
|
+
*
|
|
23
|
+
* Plain lines a person can read, because Nimiq Pay and the Hub show the
|
|
24
|
+
* message before signing it, and "PleaseNoBugs login, Project: x, Origin: y"
|
|
25
|
+
* is something a user can judge.
|
|
26
|
+
*
|
|
27
|
+
* Changing this string invalidates every proof in the wild, so it is part of
|
|
28
|
+
* the v1 contract.
|
|
29
|
+
*
|
|
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'
|
|
33
|
+
*/
|
|
34
|
+
export declare function loginMessage(args: {
|
|
35
|
+
project: string;
|
|
36
|
+
origin: string;
|
|
37
|
+
issued: number;
|
|
38
|
+
}): string;
|
|
39
|
+
/**
|
|
40
|
+
* An origin in the one spelling every comparison uses, or the input unchanged
|
|
41
|
+
* if it is not a URL at all (which then simply never matches anything).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* normalizeOrigin('https://Shitti.me/') // → 'https://shitti.me'
|
|
45
|
+
*/
|
|
46
|
+
export declare function normalizeOrigin(origin: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether a proof's timestamp is still usable at `now`.
|
|
49
|
+
*
|
|
50
|
+
* Shared by both ends on purpose: the client uses it to re-sign *before* the
|
|
51
|
+
* server would refuse, so a user is asked at a moment of their choosing rather
|
|
52
|
+
* than having a post bounce.
|
|
53
|
+
*/
|
|
54
|
+
export declare function proofIsFresh(issued: number, now?: number): boolean;
|
|
55
|
+
/** The `Authorization` header value for a proof. */
|
|
56
|
+
export declare function encodeProof(proof: LoginProof): string;
|
|
57
|
+
/**
|
|
58
|
+
* The proof inside an `Authorization` header, or null for anything that is
|
|
59
|
+
* not one. Shape only: whether it is *valid* is the server's question.
|
|
60
|
+
*/
|
|
61
|
+
export declare function decodeProof(header: string | undefined | null): LoginProof | null;
|
|
62
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,QAA2B,CAAC;AAErD,gFAAgF;AAChF,eAAO,MAAM,aAAa,QAAgB,CAAC;AAE3C,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAO9F;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,OAAO,CAE9E;AAED,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAmBhF"}
|
package/dist/login.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long a proof is good for. After that the widget asks the wallet again.
|
|
3
|
+
*
|
|
4
|
+
* Long, because every signature is a native prompt the user has to tap, and a
|
|
5
|
+
* board you have to re-sign weekly is a board people stop using. The proof
|
|
6
|
+
* proves *who*, nothing more; it cannot move funds.
|
|
7
|
+
*/
|
|
8
|
+
export const LOGIN_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
9
|
+
/** How far in the future `issued` may be, for a phone whose clock runs fast. */
|
|
10
|
+
export const LOGIN_SKEW_MS = 5 * 60 * 1000;
|
|
11
|
+
/** The project name a dashboard proof carries instead of a project id. */
|
|
12
|
+
export const DASHBOARD_PROJECT = 'dashboard';
|
|
13
|
+
/**
|
|
14
|
+
* The exact text a wallet signs to post on one project's board.
|
|
15
|
+
*
|
|
16
|
+
* **It names the project and the origin, and that is the whole security
|
|
17
|
+
* story.** One server serves many apps. If they all had their users sign one
|
|
18
|
+
* fixed sentence, any app could collect those signatures and post as its
|
|
19
|
+
* users on every other board. Scoped like this, a proof is useless anywhere
|
|
20
|
+
* but the board and the site it was given to.
|
|
21
|
+
*
|
|
22
|
+
* Plain lines a person can read, because Nimiq Pay and the Hub show the
|
|
23
|
+
* message before signing it, and "PleaseNoBugs login, Project: x, Origin: y"
|
|
24
|
+
* is something a user can judge.
|
|
25
|
+
*
|
|
26
|
+
* Changing this string invalidates every proof in the wild, so it is part of
|
|
27
|
+
* the v1 contract.
|
|
28
|
+
*
|
|
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'
|
|
32
|
+
*/
|
|
33
|
+
export function loginMessage(args) {
|
|
34
|
+
return [
|
|
35
|
+
'PleaseNoBugs login',
|
|
36
|
+
`Project: ${args.project}`,
|
|
37
|
+
`Origin: ${normalizeOrigin(args.origin)}`,
|
|
38
|
+
`Issued: ${new Date(args.issued).toISOString()}`,
|
|
39
|
+
].join('\n');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* An origin in the one spelling every comparison uses, or the input unchanged
|
|
43
|
+
* if it is not a URL at all (which then simply never matches anything).
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* normalizeOrigin('https://Shitti.me/') // → 'https://shitti.me'
|
|
47
|
+
*/
|
|
48
|
+
export function normalizeOrigin(origin) {
|
|
49
|
+
try {
|
|
50
|
+
return new URL(origin).origin;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return origin;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Whether a proof's timestamp is still usable at `now`.
|
|
58
|
+
*
|
|
59
|
+
* Shared by both ends on purpose: the client uses it to re-sign *before* the
|
|
60
|
+
* server would refuse, so a user is asked at a moment of their choosing rather
|
|
61
|
+
* than having a post bounce.
|
|
62
|
+
*/
|
|
63
|
+
export function proofIsFresh(issued, now = Date.now()) {
|
|
64
|
+
return Number.isFinite(issued) && issued <= now + LOGIN_SKEW_MS && now - issued <= LOGIN_TTL_MS;
|
|
65
|
+
}
|
|
66
|
+
/** The `Authorization` header value for a proof. */
|
|
67
|
+
export function encodeProof(proof) {
|
|
68
|
+
return `Nimiq ${toBase64Url(JSON.stringify(proof))}`;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The proof inside an `Authorization` header, or null for anything that is
|
|
72
|
+
* not one. Shape only: whether it is *valid* is the server's question.
|
|
73
|
+
*/
|
|
74
|
+
export function decodeProof(header) {
|
|
75
|
+
if (!header || !header.startsWith('Nimiq '))
|
|
76
|
+
return null;
|
|
77
|
+
try {
|
|
78
|
+
const raw = JSON.parse(fromBase64Url(header.slice(6).trim()));
|
|
79
|
+
const { address, publicKey, signature, origin, issued, message } = raw;
|
|
80
|
+
if (typeof address !== 'string' ||
|
|
81
|
+
typeof publicKey !== 'string' ||
|
|
82
|
+
typeof signature !== 'string' ||
|
|
83
|
+
typeof origin !== 'string' ||
|
|
84
|
+
typeof issued !== 'number' ||
|
|
85
|
+
(message !== undefined && typeof message !== 'string')) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return { address, publicKey, signature, origin, issued, ...(message !== undefined ? { message } : {}) };
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** base64url over UTF-8, with the same code in a browser and in Node 18+. */
|
|
95
|
+
function toBase64Url(text) {
|
|
96
|
+
const bytes = new TextEncoder().encode(text);
|
|
97
|
+
let binary = '';
|
|
98
|
+
for (const b of bytes)
|
|
99
|
+
binary += String.fromCharCode(b);
|
|
100
|
+
return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
101
|
+
}
|
|
102
|
+
function fromBase64Url(encoded) {
|
|
103
|
+
const padded = encoded.replace(/-/g, '+').replace(/_/g, '/');
|
|
104
|
+
const binary = atob(padded + '='.repeat((4 - (padded.length % 4)) % 4));
|
|
105
|
+
return new TextDecoder().decode(Uint8Array.from(binary, (c) => c.charCodeAt(0)));
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAErD,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3C,0EAA0E;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAAC,IAAyD;IACpF,OAAO;QACL,oBAAoB;QACpB,YAAY,IAAI,CAAC,OAAO,EAAE;QAC1B,WAAW,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACzC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE;KACjD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,MAAc,IAAI,CAAC,GAAG,EAAE;IACnE,OAAO,MAAM,CAAC,QAAQ,CA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W,CAAC,IAAY;IAC/B,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC"}
|
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PostKind, PostStatus, Rules } from './types.js';
|
|
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.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_RULES: Readonly<Rules>;
|
|
7
|
+
/** A display name. Long enough for a real one, short enough for a card. */
|
|
8
|
+
export declare const NAME_MAX = 24;
|
|
9
|
+
/** A client-minted post id. */
|
|
10
|
+
export declare const POST_ID_MAX = 128;
|
|
11
|
+
/** How much `context` one post may carry. */
|
|
12
|
+
export declare const CONTEXT_MAX_KEYS = 10;
|
|
13
|
+
export declare const CONTEXT_VALUE_MAX = 100;
|
|
14
|
+
/** The window `rules.perDay` is counted over. Rolling, never reset at midnight. */
|
|
15
|
+
export declare const DAY_MS: number;
|
|
16
|
+
export declare const POST_KINDS: readonly PostKind[];
|
|
17
|
+
export declare const POST_STATUSES: readonly PostStatus[];
|
|
18
|
+
/** Whether a value is one of the two kinds, for reading a request body. */
|
|
19
|
+
export declare function isPostKind(v: unknown): v is PostKind;
|
|
20
|
+
/** Whether a value is one of the four states, for reading a request body. */
|
|
21
|
+
export declare function isPostStatus(v: unknown): v is PostStatus;
|
|
22
|
+
/**
|
|
23
|
+
* A post's context, cleaned to what the server will store, or null when it is
|
|
24
|
+
* not an object at all.
|
|
25
|
+
*
|
|
26
|
+
* Silently drops what does not fit rather than refusing the post: losing a
|
|
27
|
+
* debug label is cheap, and losing somebody's bug report because the host app
|
|
28
|
+
* sent an eleventh key is not.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* cleanContext({ version: '1.4.0', count: 3, host: 'nimiq-pay' })
|
|
32
|
+
* // → { version: '1.4.0', host: 'nimiq-pay' } (the number is not a string)
|
|
33
|
+
*/
|
|
34
|
+
export declare function cleanContext(v: unknown): Record<string, string> | null;
|
|
35
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +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,MAAM,YAAY,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,KAAK,CAQxC,CAAC;AAEH,2EAA2E;AAC3E,eAAO,MAAM,QAAQ,KAAK,CAAC;AAE3B,+BAA+B;AAC/B,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,mFAAmF;AACnF,eAAO,MAAM,MAAM,QAAsB,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAAoB,CAAC;AAC/D,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAA4C,CAAC;AAE5F,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,QAAQ,CAEpD;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,UAAU,CAExD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAWtE"}
|
package/dist/rules.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
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.
|
|
4
|
+
*/
|
|
5
|
+
export const DEFAULT_RULES = Object.freeze({
|
|
6
|
+
perDay: 5,
|
|
7
|
+
/** One field, and a short one: a wish needs more room than a title and
|
|
8
|
+
* still less than an essay. */
|
|
9
|
+
textMax: 200,
|
|
10
|
+
/** Longer than a post, because the reply is the one that has to explain. */
|
|
11
|
+
replyMax: 300,
|
|
12
|
+
kinds: ['bug', 'idea'],
|
|
13
|
+
});
|
|
14
|
+
/** A display name. Long enough for a real one, short enough for a card. */
|
|
15
|
+
export const NAME_MAX = 24;
|
|
16
|
+
/** A client-minted post id. */
|
|
17
|
+
export const POST_ID_MAX = 128;
|
|
18
|
+
/** How much `context` one post may carry. */
|
|
19
|
+
export const CONTEXT_MAX_KEYS = 10;
|
|
20
|
+
export const CONTEXT_VALUE_MAX = 100;
|
|
21
|
+
/** The window `rules.perDay` is counted over. Rolling, never reset at midnight. */
|
|
22
|
+
export const DAY_MS = 24 * 60 * 60 * 1000;
|
|
23
|
+
export const POST_KINDS = ['bug', 'idea'];
|
|
24
|
+
export const POST_STATUSES = ['open', 'planned', 'done', 'declined'];
|
|
25
|
+
/** Whether a value is one of the two kinds, for reading a request body. */
|
|
26
|
+
export function isPostKind(v) {
|
|
27
|
+
return typeof v === 'string' && POST_KINDS.includes(v);
|
|
28
|
+
}
|
|
29
|
+
/** Whether a value is one of the four states, for reading a request body. */
|
|
30
|
+
export function isPostStatus(v) {
|
|
31
|
+
return typeof v === 'string' && POST_STATUSES.includes(v);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A post's context, cleaned to what the server will store, or null when it is
|
|
35
|
+
* not an object at all.
|
|
36
|
+
*
|
|
37
|
+
* Silently drops what does not fit rather than refusing the post: losing a
|
|
38
|
+
* debug label is cheap, and losing somebody's bug report because the host app
|
|
39
|
+
* sent an eleventh key is not.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* cleanContext({ version: '1.4.0', count: 3, host: 'nimiq-pay' })
|
|
43
|
+
* // → { version: '1.4.0', host: 'nimiq-pay' } (the number is not a string)
|
|
44
|
+
*/
|
|
45
|
+
export function cleanContext(v) {
|
|
46
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
47
|
+
return null;
|
|
48
|
+
const out = {};
|
|
49
|
+
let n = 0;
|
|
50
|
+
for (const [key, value] of Object.entries(v)) {
|
|
51
|
+
if (n >= CONTEXT_MAX_KEYS)
|
|
52
|
+
break;
|
|
53
|
+
if (typeof value !== 'string' || !key || key.length > 40)
|
|
54
|
+
continue;
|
|
55
|
+
out[key] = value.slice(0, CONTEXT_VALUE_MAX);
|
|
56
|
+
n++;
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMapping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rC,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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** What the matcher needs from a post, so it works on any list. */
|
|
2
|
+
export interface Matchable {
|
|
3
|
+
text: string;
|
|
4
|
+
votes: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A matcher for posts that look like the one somebody is typing, so they can
|
|
8
|
+
* second an existing wish instead of writing the same one again.
|
|
9
|
+
*
|
|
10
|
+
* Deliberately dumb: shared significant words, nothing learned and nothing
|
|
11
|
+
* fetched. A board this size does not need to be right, it needs to be right
|
|
12
|
+
* often enough that the obvious repeat gets caught, and being occasionally
|
|
13
|
+
* unhelpful costs a glance where being slow would cost the compose screen.
|
|
14
|
+
*
|
|
15
|
+
* Two shared words is the bar. One catches everything (every second post says
|
|
16
|
+
* "button"), and three catches almost nothing at 200 characters.
|
|
17
|
+
*
|
|
18
|
+
* A factory rather than a function because each matcher keeps its own cache:
|
|
19
|
+
* the matcher runs on every keystroke over the whole board, a post's text
|
|
20
|
+
* never changes, and the cache is only valid for one set of noise words.
|
|
21
|
+
*
|
|
22
|
+
* @param projectNoise words common in *this* app, like its own name
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const likeThis = createMatcher(['shitti', 'nim', 'taak', 'task']);
|
|
26
|
+
* likeThis(posts, 'de camera opent niet bij het bewijs');
|
|
27
|
+
* // → the existing "camera opent niet" post, if there is one
|
|
28
|
+
*/
|
|
29
|
+
export declare function createMatcher(projectNoise?: Iterable<string>): <P extends Matchable>(posts: P[], text: string, limit?: number) => P[];
|
|
30
|
+
//# sourceMappingURL=similar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"similar.d.ts","sourceRoot":"","sources":["../src/similar.ts"],"names":[],"mappings":"AA6BA,mEAAmE;AACnE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,YAAY,GAAE,QAAQ,CAAC,MAAM,CAAM,IActC,CAAC,SAAS,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,MAAM,EAAE,cAAS,KAAG,CAAC,EAAE,CAmBxF"}
|
package/dist/similar.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Words too common to say anything about what a post is about, one group per
|
|
3
|
+
* language the widget speaks.
|
|
4
|
+
*
|
|
5
|
+
* **A new language owes this table a group.** Shitti added German without one,
|
|
6
|
+
* which left "aufgabe" significant where its Dutch and English twins were not:
|
|
7
|
+
* two unrelated German posts sharing it and one filler word matched, and the
|
|
8
|
+
* suggestions filled with lookalikes nobody meant.
|
|
9
|
+
*
|
|
10
|
+
* Words that are common because of *what the app is* ("task", "nim", the app's
|
|
11
|
+
* own name) are not here: those belong to a project, and are passed to
|
|
12
|
+
* {@link createMatcher}.
|
|
13
|
+
*/
|
|
14
|
+
const NOISE = [
|
|
15
|
+
// Dutch
|
|
16
|
+
'aan', 'als', 'bij', 'dan', 'dat', 'deze', 'die', 'dit', 'een', 'heb', 'het',
|
|
17
|
+
'ik', 'is', 'kan', 'kun', 'maar', 'met', 'mijn', 'niet', 'ook', 'van', 'voor',
|
|
18
|
+
'wil', 'word', 'wordt', 'zijn', 'zou', 'graag', 'meer', 'moet',
|
|
19
|
+
// English
|
|
20
|
+
'and', 'are', 'but', 'can', 'for', 'have', 'more', 'not', 'should', 'that',
|
|
21
|
+
'the', 'this', 'want', 'when', 'with', 'would', 'you', 'your',
|
|
22
|
+
// German
|
|
23
|
+
'aber', 'auch', 'bitte', 'dass', 'denn', 'ein', 'eine', 'einen', 'gerne',
|
|
24
|
+
'ich', 'ist', 'kann', 'mehr', 'mein', 'meine', 'nicht', 'oder', 'sein',
|
|
25
|
+
'sollte', 'und', 'wenn', 'werden', 'wird', 'wollen', 'möchte',
|
|
26
|
+
// Every board is about an app
|
|
27
|
+
'app',
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* A matcher for posts that look like the one somebody is typing, so they can
|
|
31
|
+
* second an existing wish instead of writing the same one again.
|
|
32
|
+
*
|
|
33
|
+
* Deliberately dumb: shared significant words, nothing learned and nothing
|
|
34
|
+
* fetched. A board this size does not need to be right, it needs to be right
|
|
35
|
+
* often enough that the obvious repeat gets caught, and being occasionally
|
|
36
|
+
* unhelpful costs a glance where being slow would cost the compose screen.
|
|
37
|
+
*
|
|
38
|
+
* Two shared words is the bar. One catches everything (every second post says
|
|
39
|
+
* "button"), and three catches almost nothing at 200 characters.
|
|
40
|
+
*
|
|
41
|
+
* A factory rather than a function because each matcher keeps its own cache:
|
|
42
|
+
* the matcher runs on every keystroke over the whole board, a post's text
|
|
43
|
+
* never changes, and the cache is only valid for one set of noise words.
|
|
44
|
+
*
|
|
45
|
+
* @param projectNoise words common in *this* app, like its own name
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const likeThis = createMatcher(['shitti', 'nim', 'taak', 'task']);
|
|
49
|
+
* likeThis(posts, 'de camera opent niet bij het bewijs');
|
|
50
|
+
* // → the existing "camera opent niet" post, if there is one
|
|
51
|
+
*/
|
|
52
|
+
export function createMatcher(projectNoise = []) {
|
|
53
|
+
const noise = new Set([...NOISE, ...[...projectNoise].map((w) => w.toLowerCase())]);
|
|
54
|
+
// Weak, so a post that falls out of the list takes its entry with it.
|
|
55
|
+
const boiled = new WeakMap();
|
|
56
|
+
const meaningful = (text) => new Set(text
|
|
57
|
+
.toLowerCase()
|
|
58
|
+
.replace(/[^\p{L}\p{N}\s]/gu, ' ')
|
|
59
|
+
.split(/\s+/)
|
|
60
|
+
.filter((w) => w.length >= 4 && !noise.has(w)));
|
|
61
|
+
return function likeThis(posts, text, limit = 3) {
|
|
62
|
+
const mine = meaningful(text);
|
|
63
|
+
if (mine.size < 2)
|
|
64
|
+
return [];
|
|
65
|
+
return posts
|
|
66
|
+
.map((post) => {
|
|
67
|
+
let theirs = boiled.get(post);
|
|
68
|
+
if (!theirs) {
|
|
69
|
+
theirs = meaningful(post.text);
|
|
70
|
+
boiled.set(post, theirs);
|
|
71
|
+
}
|
|
72
|
+
let shared = 0;
|
|
73
|
+
for (const word of mine)
|
|
74
|
+
if (theirs.has(word))
|
|
75
|
+
shared++;
|
|
76
|
+
return { post, shared };
|
|
77
|
+
})
|
|
78
|
+
.filter((s) => s.shared >= 2)
|
|
79
|
+
.sort((a, b) => b.shared - a.shared || b.post.votes - a.post.votes)
|
|
80
|
+
.slice(0, limit)
|
|
81
|
+
.map((s) => s.post);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=similar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"similar.js","sourceRoot":"","sources":["../src/similar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,E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AAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;aAClE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;aACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/sort.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Which order the board is read in. */
|
|
2
|
+
export type BoardSort = 'top' | 'new';
|
|
3
|
+
/**
|
|
4
|
+
* The board in the order a tab asks for.
|
|
5
|
+
*
|
|
6
|
+
* Two tabs rather than one order, because most-voted-first eats its own young:
|
|
7
|
+
* a new post starts at one vote and lands under everything, so on a board more
|
|
8
|
+
* than a fortnight old nobody would ever read a new idea.
|
|
9
|
+
*
|
|
10
|
+
* `top` breaks ties by date rather than by arrival order, so a board where
|
|
11
|
+
* nothing has been voted on yet reads newest-first instead of shuffling under
|
|
12
|
+
* people as they scroll.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* sortPosts(posts, 'top') // most wanted first
|
|
16
|
+
* sortPosts(posts, 'new') // most recent first
|
|
17
|
+
*/
|
|
18
|
+
export declare function sortPosts<P extends {
|
|
19
|
+
at: number;
|
|
20
|
+
votes: number;
|
|
21
|
+
}>(posts: P[], sort: BoardSort): P[];
|
|
22
|
+
//# sourceMappingURL=sort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;AAEtC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,GAAG,CAAC,EAAE,CAInG"}
|
package/dist/sort.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The board in the order a tab asks for.
|
|
3
|
+
*
|
|
4
|
+
* Two tabs rather than one order, because most-voted-first eats its own young:
|
|
5
|
+
* a new post starts at one vote and lands under everything, so on a board more
|
|
6
|
+
* than a fortnight old nobody would ever read a new idea.
|
|
7
|
+
*
|
|
8
|
+
* `top` breaks ties by date rather than by arrival order, so a board where
|
|
9
|
+
* nothing has been voted on yet reads newest-first instead of shuffling under
|
|
10
|
+
* people as they scroll.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* sortPosts(posts, 'top') // most wanted first
|
|
14
|
+
* sortPosts(posts, 'new') // most recent first
|
|
15
|
+
*/
|
|
16
|
+
export function sortPosts(posts, sort) {
|
|
17
|
+
const out = [...posts];
|
|
18
|
+
if (sort === 'new')
|
|
19
|
+
return out.sort((a, b) => b.at - a.at);
|
|
20
|
+
return out.sort((a, b) => b.votes - a.votes || b.at - a.at);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=sort.js.map
|
package/dist/sort.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort.js","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,SAAS,CAA0C,KAAU,EAAE,IAAe;IAC5F,MAAM,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IACvB,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;AAC9D,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes that travel between the server and its clients.
|
|
3
|
+
*
|
|
4
|
+
* This file is the contract described in `docs/api-v1.md`. Inside v1 these
|
|
5
|
+
* types may only grow: a new optional field is fine, a renamed or retyped one
|
|
6
|
+
* is a v2. Clients must ignore fields they do not know, which is what lets the
|
|
7
|
+
* server add one without breaking an app nobody has updated.
|
|
8
|
+
*/
|
|
9
|
+
/** Something is broken, or something is missing. */
|
|
10
|
+
export type PostKind = 'bug' | 'idea';
|
|
11
|
+
/**
|
|
12
|
+
* Where a post stands, set by a project's owners and nobody else.
|
|
13
|
+
*
|
|
14
|
+
* This is what separates a board from a wishing well. Without it every post
|
|
15
|
+
* reads the same three months later, and the only signal anybody gets is that
|
|
16
|
+
* nothing was ever answered.
|
|
17
|
+
*/
|
|
18
|
+
export type PostStatus = 'open' | 'planned' | 'done' | 'declined';
|
|
19
|
+
/** An owner's answer under a post. One reply, never a thread. */
|
|
20
|
+
export interface PostReply {
|
|
21
|
+
text: string;
|
|
22
|
+
at: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Free-form detail for reproducing a bug: an app version, a screen, whether
|
|
26
|
+
* the user was inside Nimiq Pay. Owners' eyes only.
|
|
27
|
+
*
|
|
28
|
+
* Strings only and a handful of keys (see `CONTEXT_MAX_KEYS`), so it can never
|
|
29
|
+
* become a place to stash anything bigger than a label.
|
|
30
|
+
*/
|
|
31
|
+
export type PostContext = Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* One post, as a reader receives it.
|
|
34
|
+
*
|
|
35
|
+
* What is *not* here is the point: the author's address and the list of who
|
|
36
|
+
* voted never leave the server. A reader learns only whether they wrote it
|
|
37
|
+
* themselves and whether they voted.
|
|
38
|
+
*/
|
|
39
|
+
export interface Post {
|
|
40
|
+
id: string;
|
|
41
|
+
kind: PostKind;
|
|
42
|
+
text: string;
|
|
43
|
+
at: number;
|
|
44
|
+
status: PostStatus;
|
|
45
|
+
/** How many wallets want this, the author included. */
|
|
46
|
+
votes: number;
|
|
47
|
+
/** Whether this reader is one of them. Always false without a proof. */
|
|
48
|
+
voted: boolean;
|
|
49
|
+
/** Whether this reader wrote it. Always false without a proof. */
|
|
50
|
+
mine: boolean;
|
|
51
|
+
/** The author's display name. Absent when they posted anonymously or never
|
|
52
|
+
* chose one. Never an address: a name is a label, an address an identity. */
|
|
53
|
+
who?: string;
|
|
54
|
+
reply?: PostReply;
|
|
55
|
+
/** Owners only. */
|
|
56
|
+
context?: PostContext;
|
|
57
|
+
/** Owners only: a post they took off the board, kept so it can come back. */
|
|
58
|
+
hidden?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** A project's limits. Defaults in `DEFAULT_RULES`. */
|
|
61
|
+
export interface Rules {
|
|
62
|
+
/** Posts per wallet per rolling 24 hours. Not a punishment: a reason to pick
|
|
63
|
+
* the good one. */
|
|
64
|
+
perDay: number;
|
|
65
|
+
textMax: number;
|
|
66
|
+
replyMax: number;
|
|
67
|
+
/** Which kinds this board accepts, in the order the widget offers them. */
|
|
68
|
+
kinds: PostKind[];
|
|
69
|
+
}
|
|
70
|
+
/** What anybody may know about a project. */
|
|
71
|
+
export interface PublicProject {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
rules: Rules;
|
|
75
|
+
}
|
|
76
|
+
/** The whole project, as its owners see it. */
|
|
77
|
+
export interface Project extends PublicProject {
|
|
78
|
+
/** Wallet addresses. Never empty: a project nobody owns nobody can answer. */
|
|
79
|
+
owners: string[];
|
|
80
|
+
/** Where the widget may run, as `URL.origin` strings. */
|
|
81
|
+
origins: string[];
|
|
82
|
+
/**
|
|
83
|
+
* Fixed messages this app's own wallet login already signs, accepted as a
|
|
84
|
+
* proof on this project and no other. Lets an app with a login hand the
|
|
85
|
+
* widget the signature it already has, so nobody signs twice.
|
|
86
|
+
*
|
|
87
|
+
* Off unless the owner sets it, because such a proof never expires: the
|
|
88
|
+
* message has no timestamp in it. See "App logins" in `docs/api-v1.md`.
|
|
89
|
+
*/
|
|
90
|
+
loginMessages?: string[];
|
|
91
|
+
createdAt: number;
|
|
92
|
+
}
|
|
93
|
+
/** What the reader needs to know about themselves before typing anything. */
|
|
94
|
+
export interface Me {
|
|
95
|
+
owner: boolean;
|
|
96
|
+
name?: string;
|
|
97
|
+
/** Posts left in this wallet's rolling day. The allowance itself is
|
|
98
|
+
* `rules.perDay`: read it from the project, never from a copy. */
|
|
99
|
+
left: number;
|
|
100
|
+
}
|
|
101
|
+
/** `GET /v1/projects/:pid/posts`. */
|
|
102
|
+
export interface BoardRead {
|
|
103
|
+
project: PublicProject;
|
|
104
|
+
/** In no promised order; see `sortPosts`. */
|
|
105
|
+
posts: Post[];
|
|
106
|
+
/** Present only when the request carried a valid proof. */
|
|
107
|
+
me?: Me;
|
|
108
|
+
}
|
|
109
|
+
/** One of your own posts that an owner has answered. `at` is when. */
|
|
110
|
+
export interface Answer {
|
|
111
|
+
id: string;
|
|
112
|
+
text: string;
|
|
113
|
+
at: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Who is asking, sent base64url-encoded in `Authorization: Nimiq <...>`.
|
|
117
|
+
*
|
|
118
|
+
* `origin` and `issued` travel because the server has to rebuild the signed
|
|
119
|
+
* message byte for byte and both are part of it. The project is not here: it
|
|
120
|
+
* is the one in the URL, which is what makes a proof useless on any other
|
|
121
|
+
* board.
|
|
122
|
+
*/
|
|
123
|
+
export interface LoginProof {
|
|
124
|
+
address: string;
|
|
125
|
+
/** Hex. */
|
|
126
|
+
publicKey: string;
|
|
127
|
+
/** Hex. */
|
|
128
|
+
signature: string;
|
|
129
|
+
/** The origin written into the signed message, or where an app login is used. */
|
|
130
|
+
origin: string;
|
|
131
|
+
/** Milliseconds since the epoch, as written into the signed message. 0 on an app login. */
|
|
132
|
+
issued: number;
|
|
133
|
+
/**
|
|
134
|
+
* Present only on an **app login**: the app's own fixed login message, which
|
|
135
|
+
* is what was signed instead of `loginMessage()`. Accepted only by a project
|
|
136
|
+
* that lists it in `loginMessages`.
|
|
137
|
+
*/
|
|
138
|
+
message?: string;
|
|
139
|
+
}
|
|
140
|
+
/** An app's own login signature, handed to the client to reuse. */
|
|
141
|
+
export interface AppLogin {
|
|
142
|
+
address: string;
|
|
143
|
+
publicKey: string;
|
|
144
|
+
signature: string;
|
|
145
|
+
/** The exact text that was signed. */
|
|
146
|
+
message: string;
|
|
147
|
+
}
|
|
148
|
+
/** Every error the API answers with, as `{ error: ErrorCode }`. */
|
|
149
|
+
export type ErrorCode = 'bad_request' | 'unauthorized' | 'not_yours' | 'not_owner' | 'origin_not_allowed' | 'no_project' | 'no_post' | 'duplicate' | 'too_many' | 'rate_limited' | 'not_found' | 'internal';
|
|
150
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oDAAoD;AACpD,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAElE,iEAAiE;AACjE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAA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2D;IAC3D,EAAE,CAAC,EAAE,EAAE,CAAC;CACT;AAED,sEAAsE;AACtE,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,mEAAmE;AACnE,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,mEAAmE;AACnE,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,cAAc,GACd,WAAW,GACX,WAAW,GACX,oBAAoB,GACpB,YAAY,GACZ,SAAS,GACT,WAAW,GACX,UAAU,GACV,cAAc,GACd,WAAW,GACX,UAAU,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes that travel between the server and its clients.
|
|
3
|
+
*
|
|
4
|
+
* This file is the contract described in `docs/api-v1.md`. Inside v1 these
|
|
5
|
+
* types may only grow: a new optional field is fine, a renamed or retyped one
|
|
6
|
+
* is a v2. Clients must ignore fields they do not know, which is what lets the
|
|
7
|
+
* server add one without breaking an app nobody has updated.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pleasenobugs/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Types, rules, the login message and the lookalike matcher shared by every PleaseNoBugs package.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/lennylenders/PleaseNoBugs.git",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/lennylenders/PleaseNoBugs#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/lennylenders/PleaseNoBugs/issues"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.json"
|
|
33
|
+
}
|
|
34
|
+
}
|