@company-semantics/contracts 13.0.1 → 13.2.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/package.json
CHANGED
|
@@ -32,6 +32,18 @@ describe("EMAIL_KINDS golden snapshot", () => {
|
|
|
32
32
|
plainTextRequired: true,
|
|
33
33
|
htmlSupported: true,
|
|
34
34
|
},
|
|
35
|
+
"org.ownership_transfer": {
|
|
36
|
+
kind: "org.ownership_transfer",
|
|
37
|
+
subject: "You've been invited to become a workspace owner",
|
|
38
|
+
plainTextRequired: true,
|
|
39
|
+
htmlSupported: false,
|
|
40
|
+
},
|
|
41
|
+
"org.ownership_transfer_completed": {
|
|
42
|
+
kind: "org.ownership_transfer_completed",
|
|
43
|
+
subject: "Workspace ownership has been transferred",
|
|
44
|
+
plainTextRequired: true,
|
|
45
|
+
htmlSupported: false,
|
|
46
|
+
},
|
|
35
47
|
"security.alert": {
|
|
36
48
|
kind: "security.alert",
|
|
37
49
|
subject: "Security alert for your account",
|
|
@@ -44,6 +56,12 @@ describe("EMAIL_KINDS golden snapshot", () => {
|
|
|
44
56
|
plainTextRequired: true,
|
|
45
57
|
htmlSupported: true,
|
|
46
58
|
},
|
|
59
|
+
"share.granted": {
|
|
60
|
+
kind: "share.granted",
|
|
61
|
+
subject: "Something has been shared with you",
|
|
62
|
+
plainTextRequired: true,
|
|
63
|
+
htmlSupported: true,
|
|
64
|
+
},
|
|
47
65
|
});
|
|
48
66
|
});
|
|
49
67
|
});
|
package/src/email/registry.ts
CHANGED
|
@@ -82,6 +82,18 @@ export const EMAIL_KINDS = {
|
|
|
82
82
|
plainTextRequired: true,
|
|
83
83
|
htmlSupported: true,
|
|
84
84
|
},
|
|
85
|
+
"org.ownership_transfer": {
|
|
86
|
+
kind: "org.ownership_transfer",
|
|
87
|
+
subject: "You've been invited to become a workspace owner",
|
|
88
|
+
plainTextRequired: true,
|
|
89
|
+
htmlSupported: false,
|
|
90
|
+
},
|
|
91
|
+
"org.ownership_transfer_completed": {
|
|
92
|
+
kind: "org.ownership_transfer_completed",
|
|
93
|
+
subject: "Workspace ownership has been transferred",
|
|
94
|
+
plainTextRequired: true,
|
|
95
|
+
htmlSupported: false,
|
|
96
|
+
},
|
|
85
97
|
"security.alert": {
|
|
86
98
|
kind: "security.alert",
|
|
87
99
|
subject: "Security alert for your account",
|
|
@@ -94,6 +106,12 @@ export const EMAIL_KINDS = {
|
|
|
94
106
|
plainTextRequired: true,
|
|
95
107
|
htmlSupported: true,
|
|
96
108
|
},
|
|
109
|
+
"share.granted": {
|
|
110
|
+
kind: "share.granted",
|
|
111
|
+
subject: "Something has been shared with you",
|
|
112
|
+
plainTextRequired: true,
|
|
113
|
+
htmlSupported: true,
|
|
114
|
+
},
|
|
97
115
|
} as const satisfies Record<EmailKind, EmailKindDefinition>;
|
|
98
116
|
|
|
99
117
|
// =============================================================================
|
package/src/email/types.ts
CHANGED
|
@@ -28,8 +28,11 @@ export type EmailKind =
|
|
|
28
28
|
| "auth.magic_link" // future
|
|
29
29
|
| "org.invite" // future
|
|
30
30
|
| "org.leadership_granted"
|
|
31
|
+
| "org.ownership_transfer"
|
|
32
|
+
| "org.ownership_transfer_completed"
|
|
31
33
|
| "security.alert" // future
|
|
32
|
-
| "chat.shared"
|
|
34
|
+
| "chat.shared"
|
|
35
|
+
| "share.granted";
|
|
33
36
|
|
|
34
37
|
// =============================================================================
|
|
35
38
|
// Email Payloads
|
|
@@ -73,6 +76,22 @@ export interface EmailPayloads {
|
|
|
73
76
|
/** Optional message from the granter, shown in the email and recorded with the grant */
|
|
74
77
|
message?: string;
|
|
75
78
|
};
|
|
79
|
+
"org.ownership_transfer": {
|
|
80
|
+
/** Name of the organization being transferred (subject is static; org name renders in the body) */
|
|
81
|
+
orgName: string;
|
|
82
|
+
/** Full URL to accept the transfer (token-bearing) */
|
|
83
|
+
acceptUrl: string;
|
|
84
|
+
/** How long until the invitation expires */
|
|
85
|
+
expiresInDays: number;
|
|
86
|
+
/** Optional message from the current owner */
|
|
87
|
+
note?: string;
|
|
88
|
+
};
|
|
89
|
+
"org.ownership_transfer_completed": {
|
|
90
|
+
/** Name of the organization that was transferred */
|
|
91
|
+
orgName: string;
|
|
92
|
+
/** Email address of the new owner */
|
|
93
|
+
newOwnerEmail: string;
|
|
94
|
+
};
|
|
76
95
|
"security.alert": {
|
|
77
96
|
/** Type of security alert */
|
|
78
97
|
alertType: "excessive_otp_requests" | "unusual_login_location";
|
|
@@ -93,6 +112,22 @@ export interface EmailPayloads {
|
|
|
93
112
|
/** First ~200 chars of chat content for email preview. Generated server-side from snapshot. */
|
|
94
113
|
previewText?: string;
|
|
95
114
|
};
|
|
115
|
+
"share.granted": {
|
|
116
|
+
/** Display name of the person who shared */
|
|
117
|
+
granterName: string;
|
|
118
|
+
/** Display name of the recipient (optional; falls back to a neutral greeting) */
|
|
119
|
+
recipientName?: string;
|
|
120
|
+
/** Human-readable entity label, e.g. "document" | "work item" | "meeting" */
|
|
121
|
+
entityLabel: string;
|
|
122
|
+
/** Title of the shared entity (absent for entities without titles, e.g. meetings) */
|
|
123
|
+
entityTitle?: string;
|
|
124
|
+
/** Access level the recipient was granted */
|
|
125
|
+
accessLevel: "editor" | "commenter" | "viewer";
|
|
126
|
+
/** Full URL to view the shared entity in the app */
|
|
127
|
+
ctaUrl: string;
|
|
128
|
+
/** Optional message from the granter, included in the email only (not persisted) */
|
|
129
|
+
message?: string;
|
|
130
|
+
};
|
|
96
131
|
}
|
|
97
132
|
|
|
98
133
|
// =============================================================================
|
|
@@ -9,8 +9,8 @@ describe("VIEW_SCOPE_MAP golden snapshot", () => {
|
|
|
9
9
|
teamwork: "org.view_teamwork",
|
|
10
10
|
"teamwork-member": "org.view_teamwork",
|
|
11
11
|
"company-md": "org.view_company_md",
|
|
12
|
-
teams: "org.view_teams",
|
|
13
12
|
"internal-admin": "internal.view_admin",
|
|
13
|
+
teams: null,
|
|
14
14
|
chat: null,
|
|
15
15
|
settings: null,
|
|
16
16
|
chats: null,
|
|
@@ -35,6 +35,8 @@ describe("getViewScope", () => {
|
|
|
35
35
|
expect(getViewScope("settings")).toBeNull();
|
|
36
36
|
expect(getViewScope("chats")).toBeNull();
|
|
37
37
|
expect(getViewScope("upgrade")).toBeNull();
|
|
38
|
+
// teams is membership-derived, not scope-gated (ADR-CONTRACTS-062).
|
|
39
|
+
expect(getViewScope("teams")).toBeNull();
|
|
38
40
|
});
|
|
39
41
|
|
|
40
42
|
it("returns null for unknown view string", () => {
|
package/src/org/view-scopes.ts
CHANGED
|
@@ -22,9 +22,12 @@ export const VIEW_SCOPE_MAP = {
|
|
|
22
22
|
teamwork: "org.view_teamwork",
|
|
23
23
|
"teamwork-member": "org.view_teamwork",
|
|
24
24
|
"company-md": "org.view_company_md",
|
|
25
|
-
teams: "org.view_teams",
|
|
26
25
|
"internal-admin": "internal.view_admin",
|
|
27
26
|
// Public views (require only authentication)
|
|
27
|
+
// `teams`: team/directory visibility is membership-derived (ADR-BE-241 tier 1),
|
|
28
|
+
// not a scope. Repointed from the never-enforced `org.view_teams` to null when
|
|
29
|
+
// that scope was retired from the backend catalog (ADR-CONTRACTS-062 / ADR-BE-256).
|
|
30
|
+
teams: null,
|
|
28
31
|
chat: null,
|
|
29
32
|
settings: null,
|
|
30
33
|
chats: null,
|
|
@@ -34,6 +34,18 @@ export type EntityVisibility = z.infer<typeof EntityVisibilitySchema>;
|
|
|
34
34
|
|
|
35
35
|
export const AclGrantRequestSchema = z.object({
|
|
36
36
|
access_level: GrantableAccessLevelSchema,
|
|
37
|
+
/**
|
|
38
|
+
* Optional message from the granter, included in the notify email only.
|
|
39
|
+
* Ephemeral notification-event metadata — never persisted on the grant.
|
|
40
|
+
* Bound matches the leadership note/reason fields (2000).
|
|
41
|
+
*/
|
|
42
|
+
note: z.string().max(2000).optional(),
|
|
43
|
+
/**
|
|
44
|
+
* When true, email the grantee(s) about the new grant. Gates the email
|
|
45
|
+
* side-effect only; omitted is treated as false (no .default(), mirrors
|
|
46
|
+
* CreateDelegationRequestSchema).
|
|
47
|
+
*/
|
|
48
|
+
notify: z.boolean().optional(),
|
|
37
49
|
});
|
|
38
50
|
export type AclGrantRequest = z.infer<typeof AclGrantRequestSchema>;
|
|
39
51
|
|