@tangle-network/agent-app 0.58.20 → 0.59.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/dist/VaultPane-OH4W5MXW.js +7 -0
- package/dist/app-auth/index.d.ts +6 -3
- package/dist/app-auth/index.js +26 -23
- package/dist/app-auth/index.js.map +1 -1
- package/dist/assistant/index.js +1 -1
- package/dist/chat-routes/index.js +1 -1
- package/dist/chunk-AB63T2LM.js +32 -0
- package/dist/chunk-AB63T2LM.js.map +1 -0
- package/dist/{chunk-QPMEXMH6.js → chunk-FMX3IOJM.js} +1 -1
- package/dist/{chunk-QPMEXMH6.js.map → chunk-FMX3IOJM.js.map} +1 -1
- package/dist/{chunk-CJW24QMJ.js → chunk-SUIHWGQT.js} +8 -1
- package/dist/chunk-SUIHWGQT.js.map +1 -0
- package/dist/chunk-YPPVNQOC.js +413 -0
- package/dist/chunk-YPPVNQOC.js.map +1 -0
- package/dist/email/index.d.ts +25 -0
- package/dist/email/index.js +19 -0
- package/dist/email/index.js.map +1 -0
- package/dist/email/layout.d.ts +77 -0
- package/dist/email/lint.d.ts +12 -0
- package/dist/email/mark.generated.d.ts +2 -0
- package/dist/email/palette.d.ts +40 -0
- package/dist/email/templates.d.ts +69 -0
- package/dist/sandbox/index.d.ts +10 -0
- package/dist/sandbox/index.js +1 -1
- package/dist/teams/index.js +2 -4
- package/dist/teams/invitations-api.d.ts +1 -1
- package/dist/teams/invitations-api.js +4 -4
- package/dist/teams/invitations-api.js.map +1 -1
- package/dist/teams/invitations.d.ts +4 -37
- package/dist/vault/index.js +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/vault/recent-files.d.ts +0 -2
- package/dist/web-react/index.js +1 -1
- package/package.json +6 -1
- package/dist/VaultPane-UNX4CWSM.js +0 -7
- package/dist/chunk-2DRYTJHI.js +0 -58
- package/dist/chunk-2DRYTJHI.js.map +0 -1
- package/dist/chunk-CJW24QMJ.js.map +0 -1
- /package/dist/{VaultPane-UNX4CWSM.js.map → VaultPane-OH4W5MXW.js.map} +0 -0
package/dist/chunk-2DRYTJHI.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// src/teams/invitations.ts
|
|
2
|
-
var INVITATION_EXPIRY_DAYS = 7;
|
|
3
|
-
var INVITATION_PERMISSIONS = ["admin", "editor", "viewer"];
|
|
4
|
-
var TOKEN_BYTE_LENGTH = 32;
|
|
5
|
-
function normalizeInvitationEmail(email) {
|
|
6
|
-
return email.trim().toLowerCase();
|
|
7
|
-
}
|
|
8
|
-
function parseInvitationPermission(value) {
|
|
9
|
-
return INVITATION_PERMISSIONS.includes(value) ? value : null;
|
|
10
|
-
}
|
|
11
|
-
function getInvitationExpiresAt(now = /* @__PURE__ */ new Date()) {
|
|
12
|
-
return new Date(now.getTime() + INVITATION_EXPIRY_DAYS * 24 * 60 * 60 * 1e3);
|
|
13
|
-
}
|
|
14
|
-
function generateInvitationToken() {
|
|
15
|
-
const bytes = new Uint8Array(TOKEN_BYTE_LENGTH);
|
|
16
|
-
globalThis.crypto.getRandomValues(bytes);
|
|
17
|
-
const token = Array.from(bytes, (byte) => String.fromCharCode(byte)).join("");
|
|
18
|
-
return `inv_${btoa(token).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "")}`;
|
|
19
|
-
}
|
|
20
|
-
function inviteUrlForToken(origin, token) {
|
|
21
|
-
return `${origin.replace(/\/+$/, "")}/invite/${encodeURIComponent(token)}`;
|
|
22
|
-
}
|
|
23
|
-
function renderInvitationEmail(input, brand) {
|
|
24
|
-
const role = input.permission.toLowerCase();
|
|
25
|
-
const expiry = input.expiresAt.toLocaleDateString("en-US", {
|
|
26
|
-
month: "short",
|
|
27
|
-
day: "numeric",
|
|
28
|
-
year: "numeric"
|
|
29
|
-
});
|
|
30
|
-
return {
|
|
31
|
-
from: brand.fromAddress,
|
|
32
|
-
subject: `${input.inviterEmail} invited you to ${input.workspaceName}`,
|
|
33
|
-
html: [
|
|
34
|
-
`<p>${escapeHtml(input.inviterEmail)} invited you to join <strong>${escapeHtml(input.workspaceName)}</strong> as ${escapeHtml(role)}.</p>`,
|
|
35
|
-
`<p><a href="${input.inviteUrl}">Accept the invitation</a></p>`,
|
|
36
|
-
`<p>This invitation expires on ${expiry}.</p>`
|
|
37
|
-
].join(""),
|
|
38
|
-
text: [
|
|
39
|
-
`${input.inviterEmail} invited you to join ${input.workspaceName} as ${role}.`,
|
|
40
|
-
`Accept the invitation: ${input.inviteUrl}`,
|
|
41
|
-
`This invitation expires on ${expiry}.`
|
|
42
|
-
].join("\n\n")
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function escapeHtml(value) {
|
|
46
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export {
|
|
50
|
-
INVITATION_EXPIRY_DAYS,
|
|
51
|
-
normalizeInvitationEmail,
|
|
52
|
-
parseInvitationPermission,
|
|
53
|
-
getInvitationExpiresAt,
|
|
54
|
-
generateInvitationToken,
|
|
55
|
-
inviteUrlForToken,
|
|
56
|
-
renderInvitationEmail
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=chunk-2DRYTJHI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/teams/invitations.ts"],"sourcesContent":["/**\n * Pure invitation helpers + email-template renderer for the teams capability.\n * Zero dependencies: no drizzle, no env, no react, no network. The lifecycle API\n * (`./invitations-api`) and an app's own mail transport build on these; this leaf\n * imports nothing back, so a consumer can pull just the token/expiry math or the\n * template renderer without dragging in drizzle or a mail client.\n *\n * `renderInvitationEmail` is deliberately transport-free: it returns the\n * `{ from, subject, html, text }` an app hands to its own Resend/SES/etc. The\n * secret (API key) and the network call stay in the app's seam — agent-app ships\n * only the deterministic template.\n */\n\nimport type { AssignableWorkspaceRole } from './roles'\n\n/** The role an invitation grants — the assignable workspace ladder (never owner). */\nexport type InvitationPermission = AssignableWorkspaceRole\n\n/** Define possible states for an invitation's lifecycle including pending, accepted, expired, and revoked */\nexport type InvitationStatus = 'pending' | 'accepted' | 'expired' | 'revoked'\n/** Define possible statuses for the sending state of an invitation email */\nexport type InvitationEmailStatus = 'not_sent' | 'sent' | 'failed'\n\n/** Define the number of days before an invitation expires */\nexport const INVITATION_EXPIRY_DAYS = 7\n\nconst INVITATION_PERMISSIONS = ['admin', 'editor', 'viewer'] as const\nconst TOKEN_BYTE_LENGTH = 32\n\n/** Normalize an invitation email by trimming whitespace and converting to lowercase */\nexport function normalizeInvitationEmail(email: string): string {\n return email.trim().toLowerCase()\n}\n\n/** Resolve invitation permission from a string or return null if invalid */\nexport function parseInvitationPermission(value: string | undefined): InvitationPermission | null {\n return INVITATION_PERMISSIONS.includes(value as InvitationPermission) ? (value as InvitationPermission) : null\n}\n\n/** Calculate the expiration date of an invitation based on the given or current date */\nexport function getInvitationExpiresAt(now: Date = new Date()): Date {\n return new Date(now.getTime() + INVITATION_EXPIRY_DAYS * 24 * 60 * 60 * 1000)\n}\n\n/**\n * A cryptographically-random, URL-safe invitation token. `inv_`-prefixed so a\n * token is self-identifying and never collides with the workspaceMember invite\n * tokens minted by `members-api` (`generateInviteToken`).\n */\nexport function generateInvitationToken(): string {\n const bytes = new Uint8Array(TOKEN_BYTE_LENGTH)\n globalThis.crypto.getRandomValues(bytes)\n const token = Array.from(bytes, (byte) => String.fromCharCode(byte)).join('')\n return `inv_${btoa(token).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/g, '')}`\n}\n\n/** Generate an invite URL by combining the origin with an encoded token */\nexport function inviteUrlForToken(origin: string, token: string): string {\n return `${origin.replace(/\\/+$/, '')}/invite/${encodeURIComponent(token)}`\n}\n\n// ── email template (pure; no transport) ──\n\n/** Define input data required to render an invitation email template */\nexport interface RenderInvitationEmailInput {\n to: string\n workspaceName: string\n inviterEmail: string\n permission: string\n inviteUrl: string\n expiresAt: Date\n}\n\n/** Define the structure for an invitation email brand including the RFC-5322 From header */\nexport interface InvitationEmailBrand {\n /** RFC-5322 From header, e.g. `GTM Agent <noreply@gtm.tangle.tools>`. */\n fromAddress: string\n}\n\n/** Define the structure of a fully rendered invitation email with sender, subject, and content fields */\nexport interface RenderedInvitationEmail {\n from: string\n subject: string\n html: string\n text: string\n}\n\n/**\n * Render the invitation email body — pure, deterministic, transport-free. The\n * caller passes the result to its own mail client; this never reads a secret or\n * touches the network.\n */\nexport function renderInvitationEmail(\n input: RenderInvitationEmailInput,\n brand: InvitationEmailBrand,\n): RenderedInvitationEmail {\n const role = input.permission.toLowerCase()\n const expiry = input.expiresAt.toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n return {\n from: brand.fromAddress,\n subject: `${input.inviterEmail} invited you to ${input.workspaceName}`,\n html: [\n `<p>${escapeHtml(input.inviterEmail)} invited you to join <strong>${escapeHtml(input.workspaceName)}</strong> as ${escapeHtml(role)}.</p>`,\n `<p><a href=\"${input.inviteUrl}\">Accept the invitation</a></p>`,\n `<p>This invitation expires on ${expiry}.</p>`,\n ].join(''),\n text: [\n `${input.inviterEmail} invited you to join ${input.workspaceName} as ${role}.`,\n `Accept the invitation: ${input.inviteUrl}`,\n `This invitation expires on ${expiry}.`,\n ].join('\\n\\n'),\n }\n}\n\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n}\n"],"mappings":";AAwBO,IAAM,yBAAyB;AAEtC,IAAM,yBAAyB,CAAC,SAAS,UAAU,QAAQ;AAC3D,IAAM,oBAAoB;AAGnB,SAAS,yBAAyB,OAAuB;AAC9D,SAAO,MAAM,KAAK,EAAE,YAAY;AAClC;AAGO,SAAS,0BAA0B,OAAwD;AAChG,SAAO,uBAAuB,SAAS,KAA6B,IAAK,QAAiC;AAC5G;AAGO,SAAS,uBAAuB,MAAY,oBAAI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