@vecto-os/entity-schema 0.1.0 → 0.1.1
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/index.js +27 -24
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @vecto-os/entity-schema — Shared Zod schemas for the ENTITY node-type.
|
|
3
4
|
*
|
|
@@ -15,45 +16,47 @@
|
|
|
15
16
|
* See EPC-67 / DOC-286 / IDX-309 / IDX-310 in vcto-project for design context.
|
|
16
17
|
* Tier-A classification: feedback_node_type_tier_classification.md.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.EntityUpdatePayloadSchema = exports.EntityCreatePayloadSchema = exports.EntityAttributesSchema = exports.EntityTypeSchema = exports.ExternalRefsSchema = exports.ExternalRefSchema = void 0;
|
|
21
|
+
const zod_1 = require("zod");
|
|
19
22
|
// ─── External references ────────────────────────────────────────────────────
|
|
20
23
|
/**
|
|
21
24
|
* One external-system reference for an ENTITY. Allows the same physical thing
|
|
22
25
|
* to be tracked across multiple systems (a Matter bridge can sit in both an
|
|
23
26
|
* Apple-Home and a Google-Home fabric with different node IDs).
|
|
24
27
|
*/
|
|
25
|
-
|
|
26
|
-
source: z.string().min(1).describe('Originating system (matter, apple-home, homey, unifi, gs1, ...)'),
|
|
27
|
-
id: z.string().min(1).describe('Identifier within that source system'),
|
|
28
|
-
metadata: z.record(z.string(), z.unknown()).optional().describe('Source-specific extra data'),
|
|
28
|
+
exports.ExternalRefSchema = zod_1.z.object({
|
|
29
|
+
source: zod_1.z.string().min(1).describe('Originating system (matter, apple-home, homey, unifi, gs1, ...)'),
|
|
30
|
+
id: zod_1.z.string().min(1).describe('Identifier within that source system'),
|
|
31
|
+
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional().describe('Source-specific extra data'),
|
|
29
32
|
});
|
|
30
|
-
|
|
33
|
+
exports.ExternalRefsSchema = zod_1.z.array(exports.ExternalRefSchema);
|
|
31
34
|
// ─── Entity-type discriminator ──────────────────────────────────────────────
|
|
32
35
|
/**
|
|
33
36
|
* Free-text discriminator for ENTITY rows. Per-project configurable (no
|
|
34
37
|
* platform-wide enum — see ADR scope-fences). Convention: kebab-case
|
|
35
38
|
* (host, iot-device, boardgame-component, supplier).
|
|
36
39
|
*/
|
|
37
|
-
|
|
40
|
+
exports.EntityTypeSchema = zod_1.z
|
|
38
41
|
.string()
|
|
39
42
|
.min(1)
|
|
40
43
|
.max(64)
|
|
41
44
|
.regex(/^[a-z0-9][a-z0-9-]*$/, 'Must be lowercase kebab-case (a-z, 0-9, hyphens)');
|
|
42
45
|
// ─── Attributes ─────────────────────────────────────────────────────────────
|
|
43
46
|
/** Free-form structured key-value map. Shape is per-entity_type, not enforced. */
|
|
44
|
-
|
|
47
|
+
exports.EntityAttributesSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
|
|
45
48
|
// ─── Create / update payloads ──────────────────────────────────────────────
|
|
46
49
|
/**
|
|
47
50
|
* Body for `POST /api/entities` or MCP `create_node` when type=ENTITY.
|
|
48
51
|
*/
|
|
49
|
-
|
|
50
|
-
entity_type: EntityTypeSchema,
|
|
51
|
-
title: z.string().min(1).max(255),
|
|
52
|
-
attributes: EntityAttributesSchema.optional().default({}),
|
|
53
|
-
external_refs: ExternalRefsSchema.optional().default([]),
|
|
54
|
-
body: z.string().optional().describe('Optional markdown body for notes/history'),
|
|
55
|
-
parent_ref: z.string().optional().describe('Parent ref for CONTAINS-edge'),
|
|
56
|
-
lifecycle_status: z
|
|
52
|
+
exports.EntityCreatePayloadSchema = zod_1.z.object({
|
|
53
|
+
entity_type: exports.EntityTypeSchema,
|
|
54
|
+
title: zod_1.z.string().min(1).max(255),
|
|
55
|
+
attributes: exports.EntityAttributesSchema.optional().default({}),
|
|
56
|
+
external_refs: exports.ExternalRefsSchema.optional().default([]),
|
|
57
|
+
body: zod_1.z.string().optional().describe('Optional markdown body for notes/history'),
|
|
58
|
+
parent_ref: zod_1.z.string().optional().describe('Parent ref for CONTAINS-edge'),
|
|
59
|
+
lifecycle_status: zod_1.z
|
|
57
60
|
.string()
|
|
58
61
|
.optional()
|
|
59
62
|
.describe('Free-text per entity_type (active, decommissioned, prototype, shipping, ...)'),
|
|
@@ -63,12 +66,12 @@ export const EntityCreatePayloadSchema = z.object({
|
|
|
63
66
|
* partial-merge semantics on attributes/external_refs are handled
|
|
64
67
|
* service-side (replace, not deep-merge).
|
|
65
68
|
*/
|
|
66
|
-
|
|
67
|
-
entity_type: EntityTypeSchema.optional(),
|
|
68
|
-
title: z.string().min(1).max(255).optional(),
|
|
69
|
-
attributes: EntityAttributesSchema.optional(),
|
|
70
|
-
external_refs: ExternalRefsSchema.optional(),
|
|
71
|
-
body: z.string().optional(),
|
|
72
|
-
status: z.string().optional(),
|
|
73
|
-
lifecycle_status: z.string().optional(),
|
|
69
|
+
exports.EntityUpdatePayloadSchema = zod_1.z.object({
|
|
70
|
+
entity_type: exports.EntityTypeSchema.optional(),
|
|
71
|
+
title: zod_1.z.string().min(1).max(255).optional(),
|
|
72
|
+
attributes: exports.EntityAttributesSchema.optional(),
|
|
73
|
+
external_refs: exports.ExternalRefsSchema.optional(),
|
|
74
|
+
body: zod_1.z.string().optional(),
|
|
75
|
+
status: zod_1.z.string().optional(),
|
|
76
|
+
lifecycle_status: zod_1.z.string().optional(),
|
|
74
77
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vecto-os/entity-schema",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
5
|
-
"description": "Shared Zod schemas for the Vecto ENTITY node-type. Single source of truth for ExternalRef, EntityAttributes, EntityCreatePayload, EntityUpdatePayload — consumed by dash-api (REST validation), graph-tools (MCP tool input), and vecto-mcp (forwarding).",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Shared Zod schemas for the Vecto ENTITY node-type. Single source of truth for ExternalRef, EntityAttributes, EntityCreatePayload, EntityUpdatePayload — consumed by dash-api (CommonJS REST), graph-tools and vecto-mcp (ESM, via Node interop).",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"vecto",
|
|
8
7
|
"entity",
|