@company-semantics/contracts 39.8.0 → 40.0.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "39.8.0",
3
+ "version": "40.0.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit. Run pnpm generate:spec-hash to regenerate.
2
- export const SPEC_HASH = 'e8cf36a33d43' as const;
3
- export const SPEC_HASH_FULL = 'e8cf36a33d43bec5e4383c8edbfbdccd37fe8d081a5ddd02e96c83cb5e7bd21a' as const;
2
+ export const SPEC_HASH = '402a9b3f7788' as const;
3
+ export const SPEC_HASH_FULL = '402a9b3f77881eef9d41ee5ad49aa2b184a5b838ce948cc43ea4226e434f9b81' as const;
@@ -1423,23 +1423,6 @@ export interface paths {
1423
1423
  patch?: never;
1424
1424
  trace?: never;
1425
1425
  };
1426
- "/api/company-md/docs/{id}/content": {
1427
- parameters: {
1428
- query?: never;
1429
- header?: never;
1430
- path?: never;
1431
- cookie?: never;
1432
- };
1433
- get?: never;
1434
- /** Update a company.md document content */
1435
- put: operations["updateCompanyMdDocContent"];
1436
- post?: never;
1437
- delete?: never;
1438
- options?: never;
1439
- head?: never;
1440
- patch?: never;
1441
- trace?: never;
1442
- };
1443
1426
  "/api/company-md/docs/{id}/title": {
1444
1427
  parameters: {
1445
1428
  query?: never;
@@ -4660,9 +4643,6 @@ export interface components {
4660
4643
  createdAt: string;
4661
4644
  updatedAt: string;
4662
4645
  };
4663
- UpdateCompanyMdContentRequest: {
4664
- content: string;
4665
- };
4666
4646
  UpdateCompanyMdTitleRequest: {
4667
4647
  title: string;
4668
4648
  };
@@ -8224,30 +8204,6 @@ export interface operations {
8224
8204
  };
8225
8205
  };
8226
8206
  };
8227
- updateCompanyMdDocContent: {
8228
- parameters: {
8229
- query?: never;
8230
- header?: never;
8231
- path: {
8232
- id: string;
8233
- };
8234
- cookie?: never;
8235
- };
8236
- requestBody: {
8237
- content: {
8238
- "application/json": components["schemas"]["UpdateCompanyMdContentRequest"];
8239
- };
8240
- };
8241
- responses: {
8242
- /** @description Content updated */
8243
- 204: {
8244
- headers: {
8245
- [name: string]: unknown;
8246
- };
8247
- content?: never;
8248
- };
8249
- };
8250
- };
8251
8207
  updateCompanyMdDocTitle: {
8252
8208
  parameters: {
8253
8209
  query?: never;
@@ -34,7 +34,6 @@ export const openApiRoutes = {
34
34
  '/api/company-md/docs/{id}/collab/stream': ['GET'],
35
35
  '/api/company-md/docs/{id}/collab/sync': ['GET'],
36
36
  '/api/company-md/docs/{id}/collab/updates': ['POST'],
37
- '/api/company-md/docs/{id}/content': ['PUT'],
38
37
  '/api/company-md/docs/{id}/context-bank': ['GET'],
39
38
  '/api/company-md/docs/{id}/context-bank/associate': ['POST'],
40
39
  '/api/company-md/docs/{id}/context-bank/retry': ['POST'],
@@ -28,8 +28,13 @@ export const accessRequestedDefinition: NotificationDefinition<"companyMd.access
28
28
  {
29
29
  kind: "companyMd.access_requested",
30
30
  compose: (payload, context) => {
31
- const { requesterName, docTitle, message, requestedAccessLevel, reviewUrl } =
32
- payload;
31
+ const {
32
+ requesterName,
33
+ docTitle,
34
+ message,
35
+ requestedAccessLevel,
36
+ reviewUrl,
37
+ } = payload;
33
38
 
34
39
  return {
35
40
  metadata: {
@@ -24,10 +24,38 @@ export const ACCESS_REQUEST_STATUSES = [
24
24
  export const AccessRequestStatusSchema = z.enum(ACCESS_REQUEST_STATUSES);
25
25
  export type AccessRequestStatus = z.infer<typeof AccessRequestStatusSchema>;
26
26
 
27
+ /**
28
+ * Character cap on an access-request message.
29
+ *
30
+ * A note to an owner, not a document: 280 is enough to say why you want access
31
+ * and short enough to read in an inbox row. Exported so the request dialog's
32
+ * `maxLength` and its remaining-character counter read the SAME number the API
33
+ * rejects on — a UI that let you type past the server's limit would fail the
34
+ * send with no explanation.
35
+ *
36
+ * Enforced in three places, deliberately: the input caps typing, this schema
37
+ * rejects the request, and a CHECK constraint on
38
+ * `company_md_doc_access_requests.message` bounds anything that reaches the
39
+ * table by another path.
40
+ */
41
+ export const ACCESS_REQUEST_MESSAGE_MAX_LENGTH = 280;
42
+
43
+ /**
44
+ * Plain text only. Rejects C0/C1 control characters — a pasted binary blob or a
45
+ * terminal dump — while allowing the newlines and tabs a human types. The field
46
+ * is rendered as text, never as markup, so this is about what may be STORED,
47
+ * not about escaping at render time.
48
+ */
49
+ const PLAIN_TEXT = /^[^\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]*$/;
50
+
27
51
  /** POST body to create an access request. */
28
52
  export const AccessRequestCreateSchema = z.object({
29
53
  /** Optional context the requester sends to the owner(s). */
30
- message: z.string().max(2000).optional(),
54
+ message: z
55
+ .string()
56
+ .max(ACCESS_REQUEST_MESSAGE_MAX_LENGTH)
57
+ .regex(PLAIN_TEXT, "Message must be plain text")
58
+ .optional(),
31
59
  /**
32
60
  * The band the requester is asking for (ADR-CONTRACTS-098 / ADR-BE-454):
33
61
  * `viewer` from the locked preview, `editor` from the view-only Editor tab