lattris 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/build.json +1 -4
- package/dist/dispatch-form.js +78 -9
- package/dist/dispatch-words.js +35 -26
- package/dist/dispatch.js +2 -2
- package/dist/entry/setup.js +14 -2
- package/dist/main.js +2 -6
- package/dist/memory/access.js +88 -0
- package/dist/memory/capture-common.js +109 -5
- package/dist/memory/capture-help.js +18 -9
- package/dist/memory/capture-note.js +26 -16
- package/dist/memory/capture-session.js +18 -16
- package/dist/memory/get-help.js +12 -1
- package/dist/memory/get.js +38 -5
- package/dist/memory/recording.js +36 -27
- package/dist/memory/transcript.js +3 -0
- package/dist/memory/views.js +12 -3
- package/dist/nouns/contact.js +119 -23
- package/dist/nouns/index.js +29 -2
- package/dist/nouns/invite.js +45 -19
- package/dist/nouns/questions.js +56 -3
- package/dist/nouns/share.js +199 -30
- package/dist/nouns/words.js +21 -6
- package/dist/registry/memory.js +8 -2
- package/dist/render/rows.js +46 -1
- package/dist/request/door.js +2 -1
- package/package.json +2 -2
package/dist/nouns/contact.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { formatContact } from "../render/rows.js";
|
|
2
|
+
import { renderRunHint, sanitizeForTerminal } from "../render/text.js";
|
|
2
3
|
import { verbsOf } from "./form.js";
|
|
3
4
|
const CONTACT_HELP = [
|
|
4
5
|
'contact — the people and AIs you work with. A contact is yours alone: it',
|
|
@@ -6,33 +7,76 @@ const CONTACT_HELP = [
|
|
|
6
7
|
'so its contact can point at its page.',
|
|
7
8
|
'',
|
|
8
9
|
'Usage:',
|
|
9
|
-
' lattris contact add --name "<v>" [--email <v>] [--ai]',
|
|
10
|
+
' lattris contact add --name "<v>" [--email <v>] [--phone <v>] [--ai]',
|
|
10
11
|
' record a person by name; --email keeps',
|
|
11
12
|
' their address as your own note',
|
|
12
|
-
' lattris contact create "<name>" [--ai] [--email <v>]',
|
|
13
|
+
' lattris contact create "<name>" [--ai] [--email <v>] [--phone <v>]',
|
|
13
14
|
' the same, with the name first',
|
|
14
|
-
' lattris contact list
|
|
15
|
+
' lattris contact list [--phone <v>] every contact of yours, as the API sends them;',
|
|
16
|
+
' --phone answers the one holding that number, or none',
|
|
15
17
|
' lattris contact get <id> one contact, by its full id or a unique prefix',
|
|
16
|
-
' lattris contact update <id> [--name "<v>"] [--email <v> | --clear-email] [--ai | --person] [--root <block-id>]',
|
|
17
|
-
' rename, change the email or the kind, or point',
|
|
18
|
+
' lattris contact update <id> [--name "<v>"] [--email <v> | --clear-email] [--phone <v> | --clear-phone] [--ai | --person] [--root <block-id>]',
|
|
19
|
+
' rename, change the email, the number or the kind, or point',
|
|
18
20
|
' it at a block of yours (an AI role at its page)',
|
|
21
|
+
' lattris contact delete <id-or-name> [--yes] remove a contact nothing holds on to: asks at a',
|
|
22
|
+
' terminal, needs --yes on a pipe',
|
|
23
|
+
' lattris contact link <id-or-name> --handle <h>',
|
|
24
|
+
' ask the account at that handle to let this',
|
|
25
|
+
' contact stand for it; they accept from their inbox',
|
|
19
26
|
'',
|
|
20
27
|
' --email <v> the address you keep for this contact. It is your record',
|
|
21
28
|
' alone: the contact never sees it, nobody else reads it,',
|
|
22
29
|
' and changing it asks nobody',
|
|
30
|
+
' --phone <v> the number this contact is reached at, in full',
|
|
31
|
+
' international form: + then digits, like +61412345678.',
|
|
32
|
+
' One per contact, and no two of your contacts may hold',
|
|
33
|
+
' one number.',
|
|
23
34
|
' --root <block-id> the full id of one of your own blocks, never a prefix; the',
|
|
24
35
|
' API refuses a block you do not own',
|
|
36
|
+
' --handle <h> the public address of the account you are asking, as it',
|
|
37
|
+
' appears at /by/<handle>. A handle that names nobody is',
|
|
38
|
+
' answered exactly as one that names an account, and nothing',
|
|
39
|
+
' is sent, so a typo is not told apart from a private page',
|
|
25
40
|
'',
|
|
26
41
|
'A contact shows "linked" once it stands for a Lattris account: yours are',
|
|
27
42
|
'linked when someone accepts the invitation you minted for that contact,',
|
|
28
|
-
'
|
|
29
|
-
'
|
|
43
|
+
'or the link request you sent for it, and the person who invited or asked',
|
|
44
|
+
'you appears among your contacts, linked, the moment you accept. A share',
|
|
45
|
+
'or a deny names any contact, linked or not; a linked contact also sees a',
|
|
46
|
+
'share on the website.',
|
|
47
|
+
'',
|
|
48
|
+
'A link request carries your name and handle to their inbox, nothing else:',
|
|
49
|
+
'not the name you keep for them, not their email. They answer with',
|
|
50
|
+
'`lattris accept contact <id>` or `lattris decline contact <id>`; a decline',
|
|
51
|
+
'is not reported back. The newest ask stands: asking again for a different',
|
|
52
|
+
'account, or a handle that names nobody, takes the earlier request back.',
|
|
53
|
+
'You see the outcome where you see a share: the contact reads linked.',
|
|
30
54
|
'',
|
|
31
55
|
'Another person’s contact is not yours to read or change: the API answers',
|
|
32
56
|
'not found. A block names a contact with --contributor <id>, on capture and',
|
|
33
|
-
'on update memory alike.'
|
|
57
|
+
'on update memory alike.',
|
|
58
|
+
'',
|
|
59
|
+
'A contact that contributed a memory, that an invitation links, or that a',
|
|
60
|
+
'deny names cannot be deleted: the API refuses and says which. A deny is',
|
|
61
|
+
'lifted with `lattris remove deny <id> --to <contact>` first, so the same',
|
|
62
|
+
'number added back later never skips it.'
|
|
34
63
|
].join('\n');
|
|
35
|
-
const
|
|
64
|
+
const deniedBlocksWords = (body, contactId) => {
|
|
65
|
+
if (body.code !== 'contact:has-denies')
|
|
66
|
+
return '';
|
|
67
|
+
const blocks = body.detail?.blocks;
|
|
68
|
+
if (!Array.isArray(blocks) || blocks.length === 0)
|
|
69
|
+
return '';
|
|
70
|
+
const lines = blocks.map((b) => ` ${b.id} ${sanitizeForTerminal(b.title ?? '(untitled)')} — ${renderRunHint([
|
|
71
|
+
'remove',
|
|
72
|
+
'deny',
|
|
73
|
+
b.id,
|
|
74
|
+
'--to',
|
|
75
|
+
contactId
|
|
76
|
+
])}`);
|
|
77
|
+
return `Denies naming this contact:\n${lines.join('\n')}\n`;
|
|
78
|
+
};
|
|
79
|
+
const CONTACT_UPDATE_USAGE = 'Usage: lattris contact update <id> [--name "<v>"] [--email <v> | --clear-email] [--phone <v> | --clear-phone] [--ai | --person] [--root <block-id>]';
|
|
36
80
|
const contactRow = (c) => formatContact(c);
|
|
37
81
|
export const contacts = {
|
|
38
82
|
name: 'contacts',
|
|
@@ -43,8 +87,8 @@ export const contacts = {
|
|
|
43
87
|
unknownVerb: 'Unknown contact verb: {verb}\n\n' + CONTACT_HELP + '\n',
|
|
44
88
|
verbs: verbsOf({
|
|
45
89
|
add: {
|
|
46
|
-
usage: 'Usage: lattris contact add --name "<v>" [--email <v>] [--ai]',
|
|
47
|
-
flags: { '--name': 'name', '--email': 'email' },
|
|
90
|
+
usage: 'Usage: lattris contact add --name "<v>" [--email <v>] [--phone <v>] [--ai]',
|
|
91
|
+
flags: { '--name': 'name', '--email': 'email', '--phone': 'phone' },
|
|
48
92
|
switches: ['--ai'],
|
|
49
93
|
positionals: 0,
|
|
50
94
|
requiredFlags: ['name'],
|
|
@@ -54,14 +98,15 @@ export const contacts = {
|
|
|
54
98
|
body: {
|
|
55
99
|
displayName: { flag: 'name' },
|
|
56
100
|
type: { switch: '--ai', value: 'ai' },
|
|
57
|
-
email: { flag: 'email' }
|
|
101
|
+
email: { flag: 'email' },
|
|
102
|
+
phone: { flag: 'phone' }
|
|
58
103
|
}
|
|
59
104
|
},
|
|
60
105
|
render: (c) => `Recorded contact ${contactRow(c)}`
|
|
61
106
|
},
|
|
62
107
|
create: {
|
|
63
|
-
usage: 'Usage: lattris contact create "<name>" [--ai] [--email <v>]',
|
|
64
|
-
flags: { '--email': 'email' },
|
|
108
|
+
usage: 'Usage: lattris contact create "<name>" [--ai] [--email <v>] [--phone <v>]',
|
|
109
|
+
flags: { '--email': 'email', '--phone': 'phone' },
|
|
65
110
|
switches: ['--ai'],
|
|
66
111
|
positionals: 1,
|
|
67
112
|
request: {
|
|
@@ -70,18 +115,22 @@ export const contacts = {
|
|
|
70
115
|
body: {
|
|
71
116
|
displayName: { positional: 0 },
|
|
72
117
|
type: { switch: '--ai', value: 'ai' },
|
|
73
|
-
email: { flag: 'email' }
|
|
118
|
+
email: { flag: 'email' },
|
|
119
|
+
phone: { flag: 'phone' }
|
|
74
120
|
}
|
|
75
121
|
},
|
|
76
122
|
render: (c) => `Recorded contact ${contactRow(c)}`
|
|
77
123
|
},
|
|
78
124
|
list: {
|
|
79
|
-
usage: 'Usage: lattris contact list',
|
|
125
|
+
usage: 'Usage: lattris contact list [--phone <v>]',
|
|
126
|
+
flags: { '--phone': 'phone' },
|
|
80
127
|
positionals: 0,
|
|
81
128
|
unknownFlagIsUsage: true,
|
|
82
|
-
request: { method: 'GET', path: '/contacts' },
|
|
83
|
-
render: (list) => list.length === 0
|
|
84
|
-
?
|
|
129
|
+
request: { method: 'GET', path: '/contacts', query: { phone: { flag: 'phone' } } },
|
|
130
|
+
render: (list, context) => list.length === 0
|
|
131
|
+
? context.flags.phone !== undefined
|
|
132
|
+
? `No contact of yours holds ${sanitizeForTerminal(context.flags.phone)}.`
|
|
133
|
+
: 'No contacts yet. `lattris contact create "<name>"` records one.'
|
|
85
134
|
: list.map(formatContact).join('\n')
|
|
86
135
|
},
|
|
87
136
|
get: {
|
|
@@ -98,8 +147,8 @@ export const contacts = {
|
|
|
98
147
|
},
|
|
99
148
|
update: {
|
|
100
149
|
usage: CONTACT_UPDATE_USAGE,
|
|
101
|
-
flags: { '--name': 'name', '--root': 'root', '--email': 'email' },
|
|
102
|
-
switches: ['--ai', '--person', '--clear-email'],
|
|
150
|
+
flags: { '--name': 'name', '--root': 'root', '--email': 'email', '--phone': 'phone' },
|
|
151
|
+
switches: ['--ai', '--person', '--clear-email', '--clear-phone'],
|
|
103
152
|
positionals: 1,
|
|
104
153
|
uuidPositionals: [0],
|
|
105
154
|
idPositionals: [0],
|
|
@@ -113,6 +162,11 @@ export const contacts = {
|
|
|
113
162
|
a: '--clear-email',
|
|
114
163
|
b: 'email',
|
|
115
164
|
message: '--email and --clear-email contradict each other; pass one.\n'
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
a: '--clear-phone',
|
|
168
|
+
b: 'phone',
|
|
169
|
+
message: '--phone and --clear-phone contradict each other; pass one.\n'
|
|
116
170
|
}
|
|
117
171
|
],
|
|
118
172
|
uuidFlags: [
|
|
@@ -131,11 +185,53 @@ export const contacts = {
|
|
|
131
185
|
],
|
|
132
186
|
rootBlockId: { flag: 'root' },
|
|
133
187
|
displayName: { flag: 'name' },
|
|
134
|
-
email: [{ flag: 'email' }, { switch: '--clear-email', value: null }]
|
|
188
|
+
email: [{ flag: 'email' }, { switch: '--clear-email', value: null }],
|
|
189
|
+
phone: [{ flag: 'phone' }, { switch: '--clear-phone', value: null }]
|
|
135
190
|
},
|
|
136
|
-
emptyBodyMessage: `Nothing to update: pass --name, --email, --clear-email, --ai, --person or --root.\n${CONTACT_UPDATE_USAGE}\n`
|
|
191
|
+
emptyBodyMessage: `Nothing to update: pass --name, --email, --clear-email, --phone, --clear-phone, --ai, --person or --root.\n${CONTACT_UPDATE_USAGE}\n`
|
|
137
192
|
},
|
|
138
193
|
render: (c) => `Updated contact ${contactRow(c)}`
|
|
194
|
+
},
|
|
195
|
+
delete: {
|
|
196
|
+
usage: 'Usage: lattris contact delete <id-or-name> [--yes]',
|
|
197
|
+
switches: ['--yes'],
|
|
198
|
+
positionals: 1,
|
|
199
|
+
idPositionals: [0],
|
|
200
|
+
steps: {
|
|
201
|
+
contact: { from: ['p0'] },
|
|
202
|
+
pipedNeedsYes: {
|
|
203
|
+
message: 'Refusing to delete a contact without confirmation on a non-interactive session. Pass --yes to skip the prompt.\n'
|
|
204
|
+
},
|
|
205
|
+
confirm: {
|
|
206
|
+
question: 'Delete contact "{name}" ({contact.id}) permanently? [y/N] ',
|
|
207
|
+
onNo: { text: 'Cancelled.\n', to: 'stderr' },
|
|
208
|
+
onInterrupted: { text: 'Cancelled.\n', exit: 1 }
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
request: { method: 'DELETE', path: '/contacts/{contact.id}' },
|
|
212
|
+
refusalWords: (body, context) => deniedBlocksWords(body, context.contact?.id ?? ''),
|
|
213
|
+
renderTo: 'stderr',
|
|
214
|
+
render: (_answer, context) => `Deleted contact ${sanitizeForTerminal(context.contact?.displayName ?? context.positionals[0])}`
|
|
215
|
+
},
|
|
216
|
+
link: {
|
|
217
|
+
usage: 'Usage: lattris contact link <id-or-name> --handle <h>',
|
|
218
|
+
flags: { '--handle': 'handle' },
|
|
219
|
+
positionals: 1,
|
|
220
|
+
idPositionals: [0],
|
|
221
|
+
requiredFlags: ['handle'],
|
|
222
|
+
steps: {
|
|
223
|
+
contact: {
|
|
224
|
+
from: ['p0'],
|
|
225
|
+
mustBePerson: '{name} is an AI contact; only a person contact can stand for an account.\n'
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
request: {
|
|
229
|
+
method: 'POST',
|
|
230
|
+
path: '/contacts/{contact.id}/link',
|
|
231
|
+
body: { handle: { flag: 'handle' } }
|
|
232
|
+
},
|
|
233
|
+
renderAlways: true,
|
|
234
|
+
render: (_answer, context) => `Asked @${sanitizeForTerminal(context.flags.handle ?? '')} to let ${sanitizeForTerminal(context.contact?.displayName ?? context.positionals[0])} stand for their account. They answer from their inbox; the contact reads linked once they accept.`
|
|
139
235
|
}
|
|
140
236
|
})
|
|
141
237
|
};
|
package/dist/nouns/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import { CONSENT_HELP } from "./consent.js";
|
|
|
5
5
|
import { datasets } from "./datasets.js";
|
|
6
6
|
import { LINK_HELP, edges } from "./edges.js";
|
|
7
7
|
import { INVITE_HELP, invites } from "./invite.js";
|
|
8
|
-
import { ASK_HELP, CLOSE_HELP, CLOSE_USAGE, questions } from "./questions.js";
|
|
9
|
-
import { SHARE_HELP, UNSHARE_HELP, grants } from "./share.js";
|
|
8
|
+
import { ACCEPT_HELP, ACCEPT_USAGE, ASK_HELP, CLOSE_HELP, CLOSE_USAGE, DECLINE_HELP, DECLINE_USAGE, questions } from "./questions.js";
|
|
9
|
+
import { DENY_HELP, REMOVE_DENY_HELP, SHARE_HELP, UNSHARE_HELP, grants } from "./share.js";
|
|
10
10
|
export const listNouns = [contacts, questions, edges, invites, grants, datasets];
|
|
11
11
|
export const listVerbs = {
|
|
12
12
|
ask: { help: ASK_HELP, helpBeforeAuth: true },
|
|
@@ -16,6 +16,18 @@ export const listVerbs = {
|
|
|
16
16
|
bareIsHelp: true,
|
|
17
17
|
badNoun: { stderr: `${CLOSE_USAGE}\n` }
|
|
18
18
|
},
|
|
19
|
+
accept: {
|
|
20
|
+
help: ACCEPT_HELP,
|
|
21
|
+
helpBeforeAuth: true,
|
|
22
|
+
bareIsHelp: true,
|
|
23
|
+
badNoun: { stderr: `${ACCEPT_USAGE}\n` }
|
|
24
|
+
},
|
|
25
|
+
decline: {
|
|
26
|
+
help: DECLINE_HELP,
|
|
27
|
+
helpBeforeAuth: true,
|
|
28
|
+
bareIsHelp: true,
|
|
29
|
+
badNoun: { stderr: `${DECLINE_USAGE}\n` }
|
|
30
|
+
},
|
|
19
31
|
link: { help: LINK_HELP, helpBeforeAuth: true, bareIsHelp: true },
|
|
20
32
|
unlink: { help: LINK_HELP, helpBeforeAuth: true, bareIsHelp: true },
|
|
21
33
|
invite: { help: INVITE_HELP },
|
|
@@ -29,6 +41,21 @@ export const listVerbs = {
|
|
|
29
41
|
help: UNSHARE_HELP,
|
|
30
42
|
bareIsHelp: true,
|
|
31
43
|
badNoun: { stderr: 'Usage: lattris unshare memory <id> [--with <audience>]\n' }
|
|
44
|
+
},
|
|
45
|
+
deny: {
|
|
46
|
+
help: DENY_HELP,
|
|
47
|
+
helpBeforeAuth: true,
|
|
48
|
+
bareIsHelp: true,
|
|
49
|
+
badNoun: { stderr: 'Usage: lattris deny memory <id> --to <all-contacts | contact>\n' }
|
|
50
|
+
},
|
|
51
|
+
remove: { help: REMOVE_DENY_HELP, helpBeforeAuth: true },
|
|
52
|
+
undeny: {
|
|
53
|
+
help: REMOVE_DENY_HELP,
|
|
54
|
+
helpBeforeAuth: true,
|
|
55
|
+
bareIsHelp: true,
|
|
56
|
+
badNoun: {
|
|
57
|
+
stderr: 'Usage: lattris undeny memory <id> --to <all-contacts | contact> [--yes]\n'
|
|
58
|
+
}
|
|
32
59
|
}
|
|
33
60
|
};
|
|
34
61
|
//# sourceMappingURL=index.js.map
|
package/dist/nouns/invite.js
CHANGED
|
@@ -3,15 +3,16 @@ import { sanitizeForTerminal } from "../render/text.js";
|
|
|
3
3
|
const inviteLink = (webUrl, token) => `${webUrl}/i/${token}`;
|
|
4
4
|
const formatInvite = (webUrl, i) => {
|
|
5
5
|
const label = i.targetName ? ` — ${sanitizeForTerminal(i.targetName)}` : '';
|
|
6
|
+
const admits = i.email ? `\n admits ${sanitizeForTerminal(i.email)}` : '';
|
|
6
7
|
if (i.redeemedAt) {
|
|
7
8
|
const who = i.redeemedBy
|
|
8
9
|
? `${sanitizeForTerminal(i.redeemedBy.displayName ?? i.redeemedBy.handle)} (${sanitizeForTerminal(i.redeemedBy.handle)})`
|
|
9
10
|
: 'someone';
|
|
10
|
-
return `taken${label}\n by ${who} on ${i.redeemedAt}`;
|
|
11
|
+
return `taken${label}${admits}\n by ${who} on ${i.redeemedAt}`;
|
|
11
12
|
}
|
|
12
13
|
if (i.revokedAt)
|
|
13
|
-
return `revoked${label}\n minted ${i.createdAt}`;
|
|
14
|
-
return `live${label}\n ${inviteLink(webUrl, i.token)}\n minted ${i.createdAt}`;
|
|
14
|
+
return `revoked${label}${admits}\n minted ${i.createdAt}`;
|
|
15
|
+
return `live${label}${admits}\n ${inviteLink(webUrl, i.token)}\n minted ${i.createdAt}`;
|
|
15
16
|
};
|
|
16
17
|
const INVITE_HELP = [
|
|
17
18
|
'invite — bring one person in.',
|
|
@@ -25,16 +26,22 @@ const INVITE_HELP = [
|
|
|
25
26
|
'when you send it.',
|
|
26
27
|
'',
|
|
27
28
|
'Usage:',
|
|
28
|
-
' lattris invite <contact-name-or-id> [--yes]',
|
|
29
|
-
' lattris invite --for <name-or-id> [--yes] compatibility spelling',
|
|
29
|
+
' lattris invite <contact-name-or-id> [--email <address>] [--yes]',
|
|
30
|
+
' lattris invite --for <name-or-id> [--email <address>] [--yes] compatibility spelling',
|
|
30
31
|
'',
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
32
|
+
'An invitation admits one email address: the one the person will sign up',
|
|
33
|
+
'with. The contact must be one of yours. A name is matched exactly, ignoring',
|
|
34
|
+
'case, and a name of more than one word needs no quotes. If that name does',
|
|
35
|
+
'not exist, a person contact is created holding that email before minting.',
|
|
36
|
+
'A contact that already holds an email needs no --email, and its email is',
|
|
37
|
+
'the one sent; one that holds a different email is refused, never changed.',
|
|
38
|
+
'A contact holding none has the email recorded on it first. Duplicate names',
|
|
39
|
+
'are never guessed: use the contact id shown by `lattris contact list`.',
|
|
35
40
|
'',
|
|
36
|
-
' --
|
|
37
|
-
'
|
|
41
|
+
' --email <address> the address the invitation admits; needed unless the',
|
|
42
|
+
' contact already holds one',
|
|
43
|
+
' --yes required when not at a terminal (there is no prompt',
|
|
44
|
+
' to answer there); at a terminal you are always asked.',
|
|
38
45
|
'',
|
|
39
46
|
'To see the ones you have out: lattris get invites'
|
|
40
47
|
].join('\n');
|
|
@@ -42,33 +49,52 @@ const inviteVerb = {
|
|
|
42
49
|
verb: 'invite',
|
|
43
50
|
form: {
|
|
44
51
|
usage: INVITE_HELP,
|
|
45
|
-
flags: { '--for': 'for' },
|
|
52
|
+
flags: { '--for': 'for', '--email': 'email' },
|
|
46
53
|
switches: ['--yes'],
|
|
47
54
|
positionals: 0,
|
|
48
55
|
positionalsAtMost: 1,
|
|
56
|
+
joinPositionals: true,
|
|
49
57
|
contradictions: [{ a: 'p0', b: 'for', message: `${INVITE_HELP}\n` }],
|
|
58
|
+
addressFlags: [{ key: 'email', message: '--email takes an email address, not "{value}".\n' }],
|
|
50
59
|
steps: {
|
|
51
60
|
contact: {
|
|
52
61
|
from: ['p0', 'flag:for'],
|
|
53
62
|
required: 'A contact name or id is required.\n',
|
|
54
63
|
mustBePerson: '{name} is an AI contact. An invitation must go to a person contact.\n',
|
|
55
|
-
createIfMissing: true
|
|
64
|
+
createIfMissing: true,
|
|
65
|
+
email: {
|
|
66
|
+
flag: 'email',
|
|
67
|
+
required: 'No email for {name}: an invitation admits one address, and this contact holds none. Pass --email <address>.\n',
|
|
68
|
+
requiredNew: '{name} is not among your contacts. Creating them for an invitation needs --email <address>.\n',
|
|
69
|
+
conflict: '{name} holds {held}, and --email says {typed}. Pass the one the contact holds, or change it first: lattris contact update {contact.id} --email <address>\n'
|
|
70
|
+
}
|
|
56
71
|
},
|
|
57
72
|
pipedNeedsYes: {
|
|
58
73
|
message: 'Refusing to mint without confirmation. Pass --yes once the person has asked you to invite someone.\n'
|
|
59
74
|
},
|
|
60
75
|
confirm: {
|
|
61
|
-
question: 'Mint an invitation for {name}? [y/N] ',
|
|
62
|
-
whenMissing: 'Create person contact "{name}" and mint their invitation? [y/N] ',
|
|
76
|
+
question: 'Mint an invitation for {name}, admitting {email}? [y/N] ',
|
|
77
|
+
whenMissing: 'Create person contact "{name}" holding {email}, and mint their invitation? [y/N] ',
|
|
78
|
+
whenRecording: 'Record {email} on {name}, and mint their invitation? [y/N] ',
|
|
63
79
|
onNo: { text: 'Not minted.\n', to: 'stdout' }
|
|
64
80
|
}
|
|
65
81
|
},
|
|
66
|
-
request: {
|
|
82
|
+
request: {
|
|
83
|
+
method: 'POST',
|
|
84
|
+
path: '/invites',
|
|
85
|
+
body: { contactId: { context: 'contact.id' }, email: { context: 'email' } }
|
|
86
|
+
},
|
|
67
87
|
render: (data, context) => {
|
|
68
88
|
const i = data;
|
|
69
89
|
const contact = context.contact;
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
const admitted = sanitizeForTerminal(i.email ?? context.email ?? '');
|
|
91
|
+
const first = context.createdContact
|
|
92
|
+
? `Recorded person contact ${formatContact(contact)}.\n\n`
|
|
93
|
+
: context.recordedEmail
|
|
94
|
+
? `Recorded ${admitted} on ${sanitizeForTerminal(contact.displayName)}.\n\n`
|
|
95
|
+
: '';
|
|
96
|
+
return (first +
|
|
97
|
+
`Invitation minted${i.targetName ? ` for ${sanitizeForTerminal(i.targetName)}` : ''}, admitting ${admitted}.\n\n` +
|
|
72
98
|
` ${inviteLink(context.webUrl, i.token)}\n\n` +
|
|
73
99
|
`Hand it to ONE person — it is spent when someone signs up with it.\n` +
|
|
74
100
|
`It is not permission to join; whether they may register is decided separately.\n` +
|
|
@@ -84,7 +110,7 @@ const getInvites = {
|
|
|
84
110
|
positionals: 0,
|
|
85
111
|
request: { method: 'GET', path: '/invites' },
|
|
86
112
|
render: (list, context) => list.length === 0
|
|
87
|
-
? 'No invitations yet. `lattris invite <contact>` mints one.'
|
|
113
|
+
? 'No invitations yet. `lattris invite <contact> --email <address>` mints one.'
|
|
88
114
|
: list.map((i) => formatInvite(context.webUrl, i)).join('\n\n')
|
|
89
115
|
}
|
|
90
116
|
};
|
package/dist/nouns/questions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatAsked, formatClosed, formatQuestionList } from "../render/rows.js";
|
|
1
|
+
import { formatAsked, formatClosed, formatLinkAnswer, formatQuestionList } from "../render/rows.js";
|
|
2
2
|
export const ASK_HELP = [
|
|
3
3
|
'ask — leave a question on someone’s tree.',
|
|
4
4
|
'',
|
|
@@ -106,11 +106,64 @@ const getQuestions = {
|
|
|
106
106
|
: 'No questions on your tree.'
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
+
const ACCEPT_USAGE = 'Usage: lattris accept contact <id-or-prefix>';
|
|
110
|
+
const DECLINE_USAGE = 'Usage: lattris decline contact <id-or-prefix>';
|
|
111
|
+
export const ACCEPT_HELP = [
|
|
112
|
+
'accept — say yes to a request in your inbox to link you as a contact.',
|
|
113
|
+
'',
|
|
114
|
+
ACCEPT_USAGE,
|
|
115
|
+
'',
|
|
116
|
+
' <id-or-prefix> the request’s full UUID, or a >=4-char hex prefix over',
|
|
117
|
+
' YOUR OWN link requests — an ambiguous prefix refuses and',
|
|
118
|
+
' lists the candidates, like `close question`',
|
|
119
|
+
'',
|
|
120
|
+
'Accepting links both sides at once: their contact comes to stand for your',
|
|
121
|
+
'account, and a contact naming them appears among yours, linked. If you',
|
|
122
|
+
'had asked them too, your contact from that request is the one linked and',
|
|
123
|
+
'that request closes as accepted as well. A request whose contact was',
|
|
124
|
+
'linked elsewhere meanwhile closes as superseded and links nothing.',
|
|
125
|
+
'Your inbox: lattris get questions'
|
|
126
|
+
].join('\n');
|
|
127
|
+
export const DECLINE_HELP = [
|
|
128
|
+
'decline — say no to a request in your inbox to link you as a contact.',
|
|
129
|
+
'',
|
|
130
|
+
DECLINE_USAGE,
|
|
131
|
+
'',
|
|
132
|
+
' <id-or-prefix> the request’s full UUID, or a >=4-char hex prefix over',
|
|
133
|
+
' YOUR OWN link requests',
|
|
134
|
+
'',
|
|
135
|
+
'Declining closes the request and changes nothing else; the person who',
|
|
136
|
+
'asked is not told. Your inbox: lattris get questions'
|
|
137
|
+
].join('\n');
|
|
138
|
+
const acceptVerb = {
|
|
139
|
+
verb: 'accept',
|
|
140
|
+
nouns: ['contact', 'contacts'],
|
|
141
|
+
form: {
|
|
142
|
+
usage: ACCEPT_USAGE,
|
|
143
|
+
idPositionals: [0],
|
|
144
|
+
positionals: 1,
|
|
145
|
+
unknownFlagIsUsage: true,
|
|
146
|
+
request: { method: 'POST', path: '/questions/{p0}/accept' },
|
|
147
|
+
render: (q) => formatLinkAnswer(q)
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const declineVerb = {
|
|
151
|
+
verb: 'decline',
|
|
152
|
+
nouns: ['contact', 'contacts'],
|
|
153
|
+
form: {
|
|
154
|
+
usage: DECLINE_USAGE,
|
|
155
|
+
idPositionals: [0],
|
|
156
|
+
positionals: 1,
|
|
157
|
+
unknownFlagIsUsage: true,
|
|
158
|
+
request: { method: 'POST', path: '/questions/{p0}/decline' },
|
|
159
|
+
render: (q) => formatLinkAnswer(q)
|
|
160
|
+
}
|
|
161
|
+
};
|
|
109
162
|
export const questions = {
|
|
110
163
|
name: 'questions',
|
|
111
164
|
words: { singular: 'question', plural: 'questions' },
|
|
112
165
|
help: CLOSE_HELP,
|
|
113
|
-
verbs: [askVerb, closeVerb, getQuestions]
|
|
166
|
+
verbs: [askVerb, closeVerb, getQuestions, acceptVerb, declineVerb]
|
|
114
167
|
};
|
|
115
|
-
export { CLOSE_USAGE };
|
|
168
|
+
export { ACCEPT_USAGE, CLOSE_USAGE, DECLINE_USAGE };
|
|
116
169
|
//# sourceMappingURL=questions.js.map
|