@company-semantics/contracts 19.1.0 → 19.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "19.1.0",
3
+ "version": "19.2.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -23,7 +23,12 @@ export type InsightConfidence = "low" | "medium" | "high";
23
23
  export type InvariantPhase = "observe" | "stabilize" | "enforce";
24
24
 
25
25
  // Integration partner categories — surface grouping in settings UIs
26
- export const INTEGRATION_CATEGORIES = ["Meetings", "Comms", "Docs"] as const;
26
+ export const INTEGRATION_CATEGORIES = [
27
+ "Meetings",
28
+ "Comms",
29
+ "Docs",
30
+ "HR",
31
+ ] as const;
27
32
  export type IntegrationCategory = (typeof INTEGRATION_CATEGORIES)[number];
28
33
 
29
34
  // System diagram types
@@ -838,3 +843,8 @@ export * from "./permissions";
838
843
  // Single source of truth for upload formats; the backend normalizer joins its
839
844
  // private dispatch fields locally, the app derives its accept-set + copy.
840
845
  export * from "./ingestion";
846
+
847
+ // Third-party integration vocabulary (PRD-00793)
848
+ // HrConnectionStatus / HrConnectInput — see ./integrations/schemas.ts.
849
+ // Pairs with the `HR` member of INTEGRATION_CATEGORIES above.
850
+ export * from "./integrations";
@@ -0,0 +1,46 @@
1
+ # integrations/
2
+
3
+ Shared vocabulary for third-party integration surfaces.
4
+
5
+ ## Purpose
6
+
7
+ The cross-repo contract for HR-system integrations. The backend owns the
8
+ provider sync and persistence; the app renders the connection state and submits
9
+ the connect form. Both repos share the same `HrConnectionStatus` projection and
10
+ `HrConnectInput` shape so the boundary stays stable across independent releases.
11
+
12
+ The `HR` member of `INTEGRATION_CATEGORIES` (package root) names this category
13
+ alongside `Meetings`, `Comms`, and `Docs`.
14
+
15
+ ## Invariants
16
+
17
+ - `HrConnectionStatusSchema` is a read projection: count and sync fields are
18
+ `null` until the first successful sync (a connected, never-synced integration).
19
+ - `HrConnectInputSchema` carries only the customer's provider `subdomain`; no
20
+ secrets or provider credentials live in contracts.
21
+ - Pure vocabulary — `zod` is the only runtime import (vocabulary-guard).
22
+
23
+ <!-- BEGIN GENERATED: readme-public-api — derived from code by `pnpm readme-api`. Do not edit. -->
24
+
25
+ ## Public API
26
+
27
+ - `HrConnectInput` _(type)_
28
+ - `HrConnectInputSchema` — Input submitted by the app to initiate an HR provider connection.
29
+ - `HrConnectionStatus` _(type)_
30
+ - `HrConnectionStatusSchema` — Health of the most recent HR provider sync.
31
+
32
+ <!-- END GENERATED: readme-public-api -->
33
+
34
+ <!-- BEGIN GENERATED: readme-dependencies — derived from code by `pnpm readme-api`. Do not edit. -->
35
+
36
+ ## Dependencies
37
+
38
+ **Internal domains:**
39
+
40
+ _None._
41
+
42
+ **External packages:**
43
+
44
+ - `zod`
45
+
46
+ <!-- END GENERATED: readme-dependencies -->
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Third-party integration vocabulary barrel (PRD-00793).
3
+ *
4
+ * @see ./schemas.ts for the full schema definitions and invariants.
5
+ */
6
+ export { HrConnectionStatusSchema, HrConnectInputSchema } from "./schemas";
7
+
8
+ export type { HrConnectionStatus, HrConnectInput } from "./schemas";
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Third-party integration shared vocabulary (PRD-00793).
3
+ *
4
+ * Zod schemas describing the cross-repo contract for HR-system integrations.
5
+ * The `HR` integration category joins the existing `INTEGRATION_CATEGORIES`
6
+ * tuple in the package root; these schemas describe the connection-status
7
+ * projection the backend exposes and the connect input the app submits.
8
+ *
9
+ * Lives in contracts because the integration surface crosses backend (which
10
+ * owns the provider sync + persistence) and app (which renders the connection
11
+ * state and the connect form), and breaking it would require coordinated
12
+ * releases (see the promotion rule in CLAUDE.md).
13
+ *
14
+ * Per the durable user preference `feedback_structured_metadata_not_json_strings`,
15
+ * descriptions live in `.meta({ description })` — structured metadata, not
16
+ * stringified JSON blobs on the schema.
17
+ */
18
+ import { z } from "zod";
19
+
20
+ // =============================================================================
21
+ // HR connection status
22
+ // =============================================================================
23
+
24
+ /**
25
+ * Health of the most recent HR provider sync. `null` when no sync has run yet
26
+ * (a freshly connected, never-synced integration).
27
+ */
28
+ export const HrConnectionStatusSchema = z
29
+ .object({
30
+ connected: z.boolean().meta({
31
+ description: "Whether an HR provider is currently connected.",
32
+ }),
33
+ employeeCount: z.number().int().nonnegative().nullable().meta({
34
+ description:
35
+ "Employees mirrored from the HR provider; null when never synced.",
36
+ }),
37
+ departmentCount: z.number().int().nonnegative().nullable().meta({
38
+ description:
39
+ "Departments mirrored from the HR provider; null when never synced.",
40
+ }),
41
+ lastSyncAt: z.string().datetime().nullable().meta({
42
+ description: "ISO timestamp of the last successful sync; null if never.",
43
+ }),
44
+ syncHealth: z.enum(["healthy", "degraded", "error"]).nullable().meta({
45
+ description:
46
+ "Health of the most recent sync; null when no sync has run yet.",
47
+ }),
48
+ })
49
+ .meta({
50
+ description: "Connection-status projection for an HR integration.",
51
+ });
52
+ export type HrConnectionStatus = z.infer<typeof HrConnectionStatusSchema>;
53
+
54
+ // =============================================================================
55
+ // HR connect input
56
+ // =============================================================================
57
+
58
+ /**
59
+ * Input submitted by the app to initiate an HR provider connection. The
60
+ * `subdomain` identifies the customer's tenant on the provider (e.g. the
61
+ * BambooHR company subdomain).
62
+ */
63
+ export const HrConnectInputSchema = z
64
+ .object({
65
+ subdomain: z.string().meta({
66
+ description: "Customer tenant subdomain on the HR provider.",
67
+ }),
68
+ })
69
+ .meta({
70
+ description: "Input to initiate an HR provider connection.",
71
+ });
72
+ export type HrConnectInput = z.infer<typeof HrConnectInputSchema>;