@phnx-labs/artifacts-cli 0.9.13 → 0.11.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.
- package/CHANGELOG.md +35 -0
- package/README.md +7 -9
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +34 -190
- package/dist/cli.js.map +1 -1
- package/dist/commands/auth.d.ts +3 -1
- package/dist/commands/auth.js +17 -18
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/comments.js +2 -2
- package/dist/commands/comments.js.map +1 -1
- package/dist/commands/new.js +3 -3
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/share.d.ts +58 -111
- package/dist/commands/share.js +314 -638
- package/dist/commands/share.js.map +1 -1
- package/dist/lib/collab.d.ts +3 -3
- package/dist/lib/collab.js +183 -13
- package/dist/lib/collab.js.map +1 -1
- package/dist/lib/components.js +0 -1
- package/dist/lib/components.js.map +1 -1
- package/dist/lib/config.d.ts +0 -17
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/embedded-html.d.ts +1 -1
- package/dist/lib/embedded-html.js +0 -15
- package/dist/lib/embedded-html.js.map +1 -1
- package/dist/lib/freshness.d.ts +2 -6
- package/dist/lib/freshness.js +4 -33
- package/dist/lib/freshness.js.map +1 -1
- package/dist/lib/header-actions.d.ts +10 -37
- package/dist/lib/header-actions.js +19 -94
- package/dist/lib/header-actions.js.map +1 -1
- package/dist/lib/metadata-menu.d.ts +10 -33
- package/dist/lib/metadata-menu.js +12 -51
- package/dist/lib/metadata-menu.js.map +1 -1
- package/dist/lib/reader-anchors.d.ts +3 -3
- package/dist/lib/reader-anchors.js +7 -4
- package/dist/lib/reader-anchors.js.map +1 -1
- package/dist/lib/render.d.ts +2 -19
- package/dist/lib/render.js +37 -321
- package/dist/lib/render.js.map +1 -1
- package/dist/lib/section-collapse.d.ts +1 -2
- package/dist/lib/section-collapse.js +1 -2
- package/dist/lib/section-collapse.js.map +1 -1
- package/dist/lib/selection-toolbar.d.ts +9 -0
- package/dist/lib/selection-toolbar.js +49 -0
- package/dist/lib/selection-toolbar.js.map +1 -0
- package/dist/lib/share/backend.d.ts +8 -75
- package/dist/lib/share/backend.js +11 -123
- package/dist/lib/share/backend.js.map +1 -1
- package/dist/lib/share/config.d.ts +0 -79
- package/dist/lib/share/config.js +3 -175
- package/dist/lib/share/config.js.map +1 -1
- package/dist/lib/share/delete.d.ts +3 -14
- package/dist/lib/share/delete.js +8 -12
- package/dist/lib/share/delete.js.map +1 -1
- package/dist/lib/share/http-error.d.ts +12 -0
- package/dist/lib/share/http-error.js +32 -0
- package/dist/lib/share/http-error.js.map +1 -1
- package/dist/lib/share/media.d.ts +1 -6
- package/dist/lib/share/media.js +9 -17
- package/dist/lib/share/media.js.map +1 -1
- package/dist/lib/share/og.d.ts +0 -3
- package/dist/lib/share/og.js +2 -4
- package/dist/lib/share/og.js.map +1 -1
- package/dist/lib/share/people.d.ts +56 -0
- package/dist/lib/share/people.js +139 -0
- package/dist/lib/share/people.js.map +1 -0
- package/dist/lib/share/provision.d.ts +7 -120
- package/dist/lib/share/provision.js +30 -290
- package/dist/lib/share/provision.js.map +1 -1
- package/dist/lib/share/publish.d.ts +21 -63
- package/dist/lib/share/publish.js +44 -131
- package/dist/lib/share/publish.js.map +1 -1
- package/dist/lib/share/visibility.d.ts +13 -36
- package/dist/lib/share/visibility.js +8 -35
- package/dist/lib/share/visibility.js.map +1 -1
- package/dist/lib/share/worker-media-template.js +1 -1
- package/dist/lib/share/worker-people-template.d.ts +1 -0
- package/dist/lib/share/worker-people-template.js +491 -0
- package/dist/lib/share/worker-people-template.js.map +1 -0
- package/dist/lib/share/worker-publish-template.d.ts +1 -1
- package/dist/lib/share/worker-publish-template.js +5 -0
- package/dist/lib/share/worker-publish-template.js.map +1 -1
- package/dist/lib/share/worker-template.d.ts +2 -14
- package/dist/lib/share/worker-template.js +303 -52
- package/dist/lib/share/worker-template.js.map +1 -1
- package/dist/lib/templates.d.ts +1 -2
- package/dist/lib/templates.js +1 -19
- package/dist/lib/templates.js.map +1 -1
- package/dist/lib/validate.js +1 -29
- package/dist/lib/validate.js.map +1 -1
- package/package.json +1 -4
- package/dist/commands/answers.d.ts +0 -6
- package/dist/commands/answers.js +0 -91
- package/dist/commands/answers.js.map +0 -1
- package/dist/commands/favorite.d.ts +0 -9
- package/dist/commands/favorite.js +0 -59
- package/dist/commands/favorite.js.map +0 -1
- package/dist/commands/history.d.ts +0 -4
- package/dist/commands/history.js +0 -29
- package/dist/commands/history.js.map +0 -1
- package/dist/commands/notes.d.ts +0 -5
- package/dist/commands/notes.js +0 -28
- package/dist/commands/notes.js.map +0 -1
- package/dist/lib/browser-detect.d.ts +0 -28
- package/dist/lib/browser-detect.js +0 -126
- package/dist/lib/browser-detect.js.map +0 -1
- package/dist/lib/favorites.d.ts +0 -73
- package/dist/lib/favorites.js +0 -180
- package/dist/lib/favorites.js.map +0 -1
- package/dist/lib/github.d.ts +0 -14
- package/dist/lib/github.js +0 -36
- package/dist/lib/github.js.map +0 -1
- package/dist/lib/highlights.d.ts +0 -11
- package/dist/lib/highlights.js +0 -116
- package/dist/lib/highlights.js.map +0 -1
- package/dist/lib/link-previews.d.ts +0 -67
- package/dist/lib/link-previews.js +0 -427
- package/dist/lib/link-previews.js.map +0 -1
- package/dist/lib/notes.d.ts +0 -22
- package/dist/lib/notes.js +0 -22
- package/dist/lib/notes.js.map +0 -1
- package/dist/lib/pdf.d.ts +0 -13
- package/dist/lib/pdf.js +0 -66
- package/dist/lib/pdf.js.map +0 -1
- package/dist/lib/revisions.d.ts +0 -102
- package/dist/lib/revisions.js +0 -445
- package/dist/lib/revisions.js.map +0 -1
- package/dist/lib/share/analytics.d.ts +0 -13
- package/dist/lib/share/analytics.js +0 -46
- package/dist/lib/share/analytics.js.map +0 -1
- package/dist/lib/share/capture.d.ts +0 -31
- package/dist/lib/share/capture.js +0 -175
- package/dist/lib/share/capture.js.map +0 -1
- package/dist/lib/tokens.d.ts +0 -12
- package/dist/lib/tokens.js +0 -28
- package/dist/lib/tokens.js.map +0 -1
- package/dist/lib/worksheet.d.ts +0 -94
- package/dist/lib/worksheet.js +0 -394
- package/dist/lib/worksheet.js.map +0 -1
package/dist/lib/share/og.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"og.js","sourceRoot":"","sources":["../../../src/lib/share/og.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAChD,MAAM,aAAa,GAAG,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"og.js","sourceRoot":"","sources":["../../../src/lib/share/og.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAChD,MAAM,aAAa,GAAG,2BAA2B,CAAC;AASlD,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC;SACL,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC;SACL,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,aAAa,GAAG,YAAY;IACnE,MAAM,UAAU,GAAG,kCAAkC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,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CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACpC,MAAM,KAAK,GACT,GAAG,YAAY,IAAI;QACnB,+CAA+C;QAC/C,uDAAuD;QACvD,sCAAsC,CAAC,MAAM;QAC7C,4CAA4C,CAAC,MAAM;QACnD,oCAAoC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM;QAC/D,sCAAsC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM;QAClE,mDAAmD;QACnD,mDAAmD;QACnD,4DAA4D;QAC5D,uCAAuC,CAAC,MAAM;QAC9C,6CAA6C,CAAC,MAAM;QACpD,uCAAuC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM;QACnE,GAAG,aAAa,IAAI,CAAC;IAEvB,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9C,IAAI,SAAS,KAAK,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5F,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/C,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,KAAK,GAAG,OAAO,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ShareBackend } from './backend.js';
|
|
2
|
+
import type { PhoenixSession } from '../identity/client.js';
|
|
3
|
+
/** The most addresses one page can list; the Worker refuses more. */
|
|
4
|
+
export declare const SHARE_PEOPLE_MAX = 50;
|
|
5
|
+
export interface SharePerson {
|
|
6
|
+
email: string;
|
|
7
|
+
/** The Rush account's name, or null when the address has none. */
|
|
8
|
+
name: string | null;
|
|
9
|
+
avatar_url: string | null;
|
|
10
|
+
/** The address's domain differs from the owner's. */
|
|
11
|
+
external: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface SharePeopleList {
|
|
14
|
+
visibility: string;
|
|
15
|
+
org_domain: string | null;
|
|
16
|
+
people: SharePerson[];
|
|
17
|
+
/** The list's version ('' when there is none yet), sent back as If-Match. */
|
|
18
|
+
version: string;
|
|
19
|
+
/** Set when Rush could not be asked for names; every name is then null. */
|
|
20
|
+
names_error?: 'names_unavailable';
|
|
21
|
+
}
|
|
22
|
+
export interface SharePeopleUpdate {
|
|
23
|
+
people: string[];
|
|
24
|
+
version: string;
|
|
25
|
+
added: string[];
|
|
26
|
+
removed: string[];
|
|
27
|
+
/** The added addresses that were emailed a link. */
|
|
28
|
+
notified: string[];
|
|
29
|
+
/** Set when the invitation email failed; the list was still saved. */
|
|
30
|
+
notify_error?: 'email_unavailable';
|
|
31
|
+
/** The added addresses that were not emailed. */
|
|
32
|
+
notify_failed?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface SharePeopleOpts {
|
|
35
|
+
backend?: ShareBackend;
|
|
36
|
+
session?: PhoenixSession | null;
|
|
37
|
+
fetchImpl?: typeof fetch;
|
|
38
|
+
}
|
|
39
|
+
/** Addresses from repeatable and comma-separated values, lowercased, deduplicated. */
|
|
40
|
+
export declare function parseEmailList(values: string[]): string[];
|
|
41
|
+
/** The visibility of a page you own at target, or null when you have none there. */
|
|
42
|
+
export declare function existingPageVisibility(target: string, opts?: SharePeopleOpts): Promise<string | null>;
|
|
43
|
+
/** Who a page you own is shared with, with Rush names where the address has an account. */
|
|
44
|
+
export declare function readSharePeople(target: string, opts?: SharePeopleOpts): Promise<SharePeopleList>;
|
|
45
|
+
/**
|
|
46
|
+
* Add and remove addresses on a page you own. The Worker takes the whole list,
|
|
47
|
+
* so this reads the current one first; only the addresses it adds are emailed,
|
|
48
|
+
* unless notify is false.
|
|
49
|
+
*/
|
|
50
|
+
export declare function changeSharePeople(target: string, change: {
|
|
51
|
+
add?: string[];
|
|
52
|
+
remove?: string[];
|
|
53
|
+
notify?: boolean;
|
|
54
|
+
}, opts?: SharePeopleOpts): Promise<SharePeopleUpdate>;
|
|
55
|
+
export declare function formatSharePeopleList(key: string, list: SharePeopleList): string;
|
|
56
|
+
export declare function formatSharePeopleUpdate(update: SharePeopleUpdate): string;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// `artifacts share <file> --with` and `artifacts share people` (PHNX-4394):
|
|
2
|
+
// read and change the people a published page is shared with by email, through
|
|
3
|
+
// the share Worker's owner-only /__people/<user>/<slug>.
|
|
4
|
+
import { resolveShareBackend } from './backend.js';
|
|
5
|
+
import { resolveDeleteTarget } from './delete.js';
|
|
6
|
+
import { workerBehindError } from './http-error.js';
|
|
7
|
+
/** The most addresses one page can list; the Worker refuses more. */
|
|
8
|
+
export const SHARE_PEOPLE_MAX = 50;
|
|
9
|
+
const PEOPLE_FEATURE = 'sharing with people (`/__people`)';
|
|
10
|
+
const EMAIL = /^[^\s@/,;<>"]+@[^\s@/,;<>"]+\.[^\s@/,;<>"]+$/;
|
|
11
|
+
const WORKER_ERRORS = {
|
|
12
|
+
invalid_email: 'is not an email address',
|
|
13
|
+
too_many_people: `lists more than ${SHARE_PEOPLE_MAX} people`,
|
|
14
|
+
owner_in_list: 'names your own address; you can always open your pages',
|
|
15
|
+
people_need_sign_in: 'is a protected (token) link; share it with people as --visibility me or org instead',
|
|
16
|
+
};
|
|
17
|
+
/** Addresses from repeatable and comma-separated values, lowercased, deduplicated. */
|
|
18
|
+
export function parseEmailList(values) {
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const value of values) {
|
|
21
|
+
for (const part of value.split(',')) {
|
|
22
|
+
const email = part.trim().toLowerCase();
|
|
23
|
+
if (!email)
|
|
24
|
+
continue;
|
|
25
|
+
if (!EMAIL.test(email))
|
|
26
|
+
throw new Error(`Not an email address: ${part.trim()}`);
|
|
27
|
+
if (!out.includes(email))
|
|
28
|
+
out.push(email);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
async function peopleRequest(target, init, opts) {
|
|
34
|
+
const backend = opts.backend ?? resolveShareBackend({ session: opts.session });
|
|
35
|
+
const { key } = resolveDeleteTarget(target, backend.namespace);
|
|
36
|
+
const url = `${backend.baseUrl.replace(/\/+$/, '')}/__people/${key.split('/').map(encodeURIComponent).join('/')}`;
|
|
37
|
+
const headers = { accept: 'application/json', authorization: `Bearer ${backend.token}` };
|
|
38
|
+
if (init.body !== undefined)
|
|
39
|
+
headers['content-type'] = 'application/json';
|
|
40
|
+
if (init.ifMatch !== undefined)
|
|
41
|
+
headers['if-match'] = `"${init.ifMatch}"`;
|
|
42
|
+
const res = await (opts.fetchImpl ?? fetch)(url, {
|
|
43
|
+
method: init.method,
|
|
44
|
+
headers,
|
|
45
|
+
body: init.body === undefined ? undefined : JSON.stringify(init.body),
|
|
46
|
+
redirect: 'manual',
|
|
47
|
+
});
|
|
48
|
+
const text = await res.text();
|
|
49
|
+
let body;
|
|
50
|
+
try {
|
|
51
|
+
body = JSON.parse(text);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// A Worker from before this route answers 404 text/plain or 405.
|
|
55
|
+
throw await workerBehindError(backend.baseUrl, PEOPLE_FEATURE);
|
|
56
|
+
}
|
|
57
|
+
// Someone changed the list since it was read; the caller merges again.
|
|
58
|
+
if (res.status === 412 && body.error === 'people_changed')
|
|
59
|
+
return { key, status: res.status, body };
|
|
60
|
+
if (res.status === 404 && init.missingOk)
|
|
61
|
+
return { key, status: res.status, body };
|
|
62
|
+
if (!res.ok) {
|
|
63
|
+
const code = typeof body.error === 'string' ? body.error : '';
|
|
64
|
+
if (res.status === 404)
|
|
65
|
+
throw new Error(`No page you own at ${key}.`);
|
|
66
|
+
if (res.status === 401)
|
|
67
|
+
throw new Error("Not signed in. Run 'artifacts auth login', then retry.");
|
|
68
|
+
if (res.status === 429)
|
|
69
|
+
throw new Error(`Too many people added this hour; retry in ${Math.ceil(Number(body.retryAfterSec ?? 3600) / 60)} minutes.`);
|
|
70
|
+
if (WORKER_ERRORS[code]) {
|
|
71
|
+
const which = typeof body.email === 'string' ? ` (${body.email})` : '';
|
|
72
|
+
throw new Error(`The people list for ${key} ${WORKER_ERRORS[code]}${which}.`);
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`Sharing ${key} with people failed (${res.status}): ${code || text.slice(0, 200)}`);
|
|
75
|
+
}
|
|
76
|
+
return { key, status: res.status, body };
|
|
77
|
+
}
|
|
78
|
+
/** The visibility of a page you own at target, or null when you have none there. */
|
|
79
|
+
export async function existingPageVisibility(target, opts = {}) {
|
|
80
|
+
const { status, body } = await peopleRequest(target, { method: 'GET', missingOk: true }, opts);
|
|
81
|
+
return status === 404 ? null : String(body.visibility);
|
|
82
|
+
}
|
|
83
|
+
/** Who a page you own is shared with, with Rush names where the address has an account. */
|
|
84
|
+
export async function readSharePeople(target, opts = {}) {
|
|
85
|
+
const { body } = await peopleRequest(target, { method: 'GET' }, opts);
|
|
86
|
+
if (!Array.isArray(body.people))
|
|
87
|
+
throw await workerBehindError((opts.backend ?? resolveShareBackend({ session: opts.session })).baseUrl, PEOPLE_FEATURE);
|
|
88
|
+
return body;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Add and remove addresses on a page you own. The Worker takes the whole list,
|
|
92
|
+
* so this reads the current one first; only the addresses it adds are emailed,
|
|
93
|
+
* unless notify is false.
|
|
94
|
+
*/
|
|
95
|
+
export async function changeSharePeople(target, change, opts = {}) {
|
|
96
|
+
const read = await readSharePeople(target, opts);
|
|
97
|
+
let current = read.people.map((person) => person.email);
|
|
98
|
+
let version = read.version;
|
|
99
|
+
const remove = new Set(change.remove ?? []);
|
|
100
|
+
// The Worker refuses a write based on a stale read (412 people_changed, with
|
|
101
|
+
// the list as it now is); merge onto that once rather than drop someone.
|
|
102
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
103
|
+
const base = current;
|
|
104
|
+
const next = [...base, ...(change.add ?? []).filter((email) => !base.includes(email))].filter((email) => !remove.has(email));
|
|
105
|
+
const { status, body } = await peopleRequest(target, { method: 'PUT', body: { people: next, notify: change.notify !== false }, ifMatch: version }, opts);
|
|
106
|
+
if (status !== 412)
|
|
107
|
+
return body;
|
|
108
|
+
current = Array.isArray(body.people) ? body.people : [];
|
|
109
|
+
version = typeof body.version === 'string' ? body.version : '';
|
|
110
|
+
}
|
|
111
|
+
throw new Error(`The people list for ${target} kept changing while it was being saved; retry.`);
|
|
112
|
+
}
|
|
113
|
+
export function formatSharePeopleList(key, list) {
|
|
114
|
+
if (!list.people.length)
|
|
115
|
+
return `${key} is not shared with anyone by email.`;
|
|
116
|
+
const lines = [`${key} is shared with:`];
|
|
117
|
+
for (const person of list.people) {
|
|
118
|
+
const labels = [person.name ?? (list.names_error ? null : 'No Rush account'), person.external ? 'External' : null].filter(Boolean);
|
|
119
|
+
lines.push(` ${person.email}${labels.length ? ` (${labels.join(', ')})` : ''}`);
|
|
120
|
+
}
|
|
121
|
+
if (list.names_error)
|
|
122
|
+
lines.push('Names are unavailable right now.');
|
|
123
|
+
return lines.join('\n');
|
|
124
|
+
}
|
|
125
|
+
export function formatSharePeopleUpdate(update) {
|
|
126
|
+
const lines = [];
|
|
127
|
+
if (update.added.length)
|
|
128
|
+
lines.push(`Added ${update.added.join(', ')}`);
|
|
129
|
+
if (update.removed.length)
|
|
130
|
+
lines.push(`Removed ${update.removed.join(', ')}`);
|
|
131
|
+
if (!update.added.length && !update.removed.length)
|
|
132
|
+
lines.push('No change to the people list.');
|
|
133
|
+
if (update.notified.length)
|
|
134
|
+
lines.push(`Emailed a link to ${update.notified.join(', ')}`);
|
|
135
|
+
if (update.notify_error)
|
|
136
|
+
lines.push(`The invitation email could not be sent to ${(update.notify_failed ?? []).join(', ') || 'everyone added'}; the list was saved. Send them the link yourself.`);
|
|
137
|
+
return lines.join('\n');
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=people.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"people.js","sourceRoot":"","sources":["../../../src/lib/share/people.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+EAA+E;AAC/E,yDAAyD;AAEzD,OAAO,EAAE,mBAAmB,EAAqB,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAwCnC,MAAM,cAAc,GAAG,mCAAmC,CAAC;AAC3D,MAAM,KAAK,GAAG,8CAA8C,CAAC;AAE7D,MAAM,aAAa,GAA2B;IAC5C,aAAa,EAAE,yBAAyB;IACxC,eAAe,EAAE,mBAAmB,gBAAgB,SAAS;IAC7D,aAAa,EAAE,wDAAwD;IACvE,mBAAmB,EAAE,qFAAqF;CAC3G,CAAC;AAEF,sFAAsF;AACtF,MAAM,UAAU,cAAc,CAAC,MAAgB;IAC7C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACxC,IAAI,CAAC,KAAK;gBAAE,SAAS;YACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAChF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,KAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IACrE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,MAAyB;IAC/D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxE,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAChG,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,qBAAqB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1F,IAAI,MAAM,CAAC,YAAY;QAAE,KAAK,CAAC,IAAI,CAAC,6CAA6C,CAAC,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,gBAAgB,oDAAoD,CAAC,CAAC;IAClM,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,39 +1,4 @@
|
|
|
1
|
-
import { type UnlimitedStorage } from './storage-policy.js';
|
|
2
1
|
import type { WorkerBundle } from './worker-template.js';
|
|
3
|
-
export declare const SHARE_LIFECYCLE_RULE_ID = "agents-share-expire-objects";
|
|
4
|
-
export declare const SHARE_LIFECYCLE_RETENTION_DAYS = 366;
|
|
5
|
-
interface R2LifecycleRule {
|
|
6
|
-
id: string;
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
conditions: {
|
|
9
|
-
prefix: string;
|
|
10
|
-
};
|
|
11
|
-
deleteObjectsTransition?: {
|
|
12
|
-
condition: {
|
|
13
|
-
type: 'Age';
|
|
14
|
-
maxAge: number;
|
|
15
|
-
} | {
|
|
16
|
-
type: 'Date';
|
|
17
|
-
date: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
abortMultipartUploadsTransition?: {
|
|
21
|
-
condition?: {
|
|
22
|
-
type: 'Age';
|
|
23
|
-
maxAge: number;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
storageClassTransitions?: Array<{
|
|
27
|
-
condition: {
|
|
28
|
-
type: 'Age';
|
|
29
|
-
maxAge: number;
|
|
30
|
-
} | {
|
|
31
|
-
type: 'Date';
|
|
32
|
-
date: string;
|
|
33
|
-
};
|
|
34
|
-
storageClass: 'InfrequentAccess';
|
|
35
|
-
}>;
|
|
36
|
-
}
|
|
37
2
|
export interface CloudflareRequest {
|
|
38
3
|
apiToken: string;
|
|
39
4
|
method: string;
|
|
@@ -44,91 +9,13 @@ export interface CloudflareRequest {
|
|
|
44
9
|
export type CloudflareRequester = <T = unknown>(request: CloudflareRequest) => Promise<T>;
|
|
45
10
|
interface ProvisionOptions {
|
|
46
11
|
request?: CloudflareRequester;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
/** Bind the media job's vendor keys. Omitted, a deploy carries an existing
|
|
52
|
-
* complete set forward and binds nothing new. */
|
|
53
|
-
media?: MediaBinding;
|
|
54
|
-
}
|
|
55
|
-
/** The Worker env names for hosted review threads (PHNX-3835). */
|
|
56
|
-
export declare const WORKER_COLLAB_API_BASE_SECRET = "COLLAB_API_BASE";
|
|
57
|
-
export declare const WORKER_COLLAB_SERVICE_TOKEN_SECRET = "COLLAB_SERVICE_TOKEN";
|
|
58
|
-
/** Where `artifacts share setup|update --collab-api` reads the service token,
|
|
59
|
-
* the same name Rush Cloud reads it under, so one secrets bundle serves both. */
|
|
60
|
-
export declare const COLLAB_SERVICE_TOKEN_ENV = "ARTIFACT_COLLAB_SERVICE_TOKEN";
|
|
61
|
-
/**
|
|
62
|
-
* Rush Cloud's origin plus the service token the Worker presents to its
|
|
63
|
-
* `/internal/artifact-collab` API. Always both: the Worker treats a half-bound
|
|
64
|
-
* pair as unbound, so provisioning never writes one without the other.
|
|
65
|
-
*/
|
|
66
|
-
export interface CollabBinding {
|
|
67
|
-
apiBase: string;
|
|
68
|
-
serviceToken: string;
|
|
12
|
+
/** Bindings the Worker must already have. A deploy to a missing Worker, or to
|
|
13
|
+
* one without these (or with BUCKET on another bucket), is refused, so wrong
|
|
14
|
+
* credentials cannot create a Worker that has none of its secrets. */
|
|
15
|
+
requireBindings?: string[];
|
|
69
16
|
}
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* The Worker secrets behind video transcripts and summaries (PHNX-4287), read
|
|
75
|
-
* from the environment under these same names: Deepgram transcribes, OpenRouter
|
|
76
|
-
* summarizes, and MEDIA_JOB_SECRET signs Deepgram's source link and callback.
|
|
77
|
-
* Always all three: the Worker treats a partial set as unbound.
|
|
78
|
-
*/
|
|
79
|
-
export declare const MEDIA_KEY_SECRETS: readonly ["DEEPGRAM_API_KEY", "OPENROUTER_API_KEY", "MEDIA_JOB_SECRET"];
|
|
80
|
-
export type MediaBinding = Record<(typeof MEDIA_KEY_SECRETS)[number], string>;
|
|
81
|
-
/** The binding `--media-keys` asks for, every value from the environment.
|
|
82
|
-
* `undefined` when the flag was not passed; throws naming any missing key. */
|
|
83
|
-
export declare function mediaBindingFromFlag(mediaKeys: boolean | undefined, env?: NodeJS.ProcessEnv): MediaBinding | undefined;
|
|
84
|
-
/** Create the R2 bucket (idempotent). */
|
|
85
|
-
export declare function createBucket(apiToken: string, accountId: string, name: string, opts?: ProvisionOptions): Promise<void>;
|
|
86
|
-
export declare function buildShareLifecycleRule(days?: number): R2LifecycleRule;
|
|
87
|
-
export declare function mergeShareLifecycleRule(existing?: R2LifecycleRule[], rule?: R2LifecycleRule): R2LifecycleRule[];
|
|
88
|
-
/** Ensure the share bucket self-cleans old objects. Exact per-link expiry is enforced by the Worker. */
|
|
89
|
-
export declare function configureBucketLifecycle(apiToken: string, accountId: string, bucketName: string, opts?: ProvisionOptions): Promise<void>;
|
|
90
|
-
/** Upload the module Worker with an R2 binding (`BUCKET`). Secrets are set via the Workers Secrets API. */
|
|
17
|
+
/** Upload the module Worker with an R2 binding (`BUCKET`). Every other binding
|
|
18
|
+
* the Worker already has (its secrets) is carried forward with `inherit`, so a
|
|
19
|
+
* deploy needs none of their values. */
|
|
91
20
|
export declare function deployWorker(apiToken: string, accountId: string, workerName: string, worker: string | WorkerBundle, bucketName: string, opts?: ProvisionOptions): Promise<void>;
|
|
92
|
-
/** sha256 of the rendered Worker script, so a deployed endpoint can be compared
|
|
93
|
-
* against the current `worker-template.ts` without redeploying to find out. */
|
|
94
|
-
export declare function hashWorkerScript(script: string): string;
|
|
95
|
-
export interface UpdateWorkerResult {
|
|
96
|
-
/** sha256 of `script` (the hash the endpoint now matches, whether or not this
|
|
97
|
-
* call actually redeployed). */
|
|
98
|
-
templateHash: string;
|
|
99
|
-
/** True when the upload was skipped because `previousHash` already matched. */
|
|
100
|
-
skipped: boolean;
|
|
101
|
-
}
|
|
102
|
-
/** Cloudflare `secret_text` name the Worker reads as `env.PHOENIX_ID_BASE`. */
|
|
103
|
-
export declare const WORKER_PHOENIX_ID_BASE_SECRET = "PHOENIX_ID_BASE";
|
|
104
|
-
export type UpdateWorkerOpts = ProvisionOptions & {
|
|
105
|
-
force?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Phoenix ID base URL to bind as `PHOENIX_ID_BASE` after the script upload.
|
|
108
|
-
* Pass this for a managed deployment; omit it for a pure-BYO Worker (which
|
|
109
|
-
* authenticates only via WRITE_TOKEN). An empty string is a caller bug and
|
|
110
|
-
* fails loud — do not pass a blank to "skip".
|
|
111
|
-
*/
|
|
112
|
-
phoenixIdBase?: string;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Re-deploy the Worker script against an ALREADY-provisioned endpoint (same
|
|
116
|
-
* account/worker/bucket `deployWorker` was first called with) and idempotently
|
|
117
|
-
* no-op when the template hasn't changed.
|
|
118
|
-
*
|
|
119
|
-
* Uploads explicitly inherit an existing storage policy when none is supplied.
|
|
120
|
-
* WRITE_TOKEN and, for managed deployments, PHOENIX_ID_BASE are re-applied via
|
|
121
|
-
* the Secrets API using the caller's configured values after the upload.
|
|
122
|
-
*/
|
|
123
|
-
export declare function updateWorker(apiToken: string, accountId: string, workerName: string, bucketName: string, worker: string | WorkerBundle, writeToken: string, previousHash: string | undefined, opts?: UpdateWorkerOpts): Promise<UpdateWorkerResult>;
|
|
124
|
-
/** Add/update a secret_text binding using Cloudflare's Workers Secrets API. */
|
|
125
|
-
export declare function putWorkerSecret(apiToken: string, accountId: string, workerName: string, name: string, text: string, opts?: ProvisionOptions): Promise<void>;
|
|
126
|
-
/** Add/update the WRITE_TOKEN binding using Cloudflare's Workers Secrets API. */
|
|
127
|
-
export declare function setWorkerSecret(apiToken: string, accountId: string, workerName: string, writeToken: string, opts?: ProvisionOptions): Promise<void>;
|
|
128
|
-
/** Enable the free `*.workers.dev` route for the script, and return the account subdomain. */
|
|
129
|
-
export declare function enableWorkersDev(apiToken: string, accountId: string, workerName: string, opts?: ProvisionOptions): Promise<string>;
|
|
130
|
-
/** Resolve a zone id for a domain the token can see, or null if not owned/visible. */
|
|
131
|
-
export declare function findZoneId(apiToken: string, domain: string, opts?: ProvisionOptions): Promise<string | null>;
|
|
132
|
-
/** Map a custom hostname (e.g. `share.getrush.ai`) to the Worker via Workers Custom Domains. */
|
|
133
|
-
export declare function addCustomDomain(apiToken: string, accountId: string, workerName: string, zoneId: string, hostname: string, opts?: ProvisionOptions): Promise<void>;
|
|
134
21
|
export {};
|