@ramme-io/shared 2.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/.turbo/turbo-build.log +19 -0
- package/AGENTS.md +2 -0
- package/dist/index.cjs +223 -0
- package/dist/index.d.cts +1340 -0
- package/dist/index.d.ts +1340 -0
- package/dist/index.js +190 -0
- package/index.ts +4 -0
- package/package.json +25 -0
- package/src/bodewell/schema.ts +35 -0
- package/src/schema.ts +209 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
> @ramme-io/shared@2.0.0 build /Users/danetroup/ramme/ramme-monorepo/packages/shared
|
|
3
|
+
> tsup index.ts --format esm,cjs --dts --clean
|
|
4
|
+
|
|
5
|
+
CLI Building entry: index.ts
|
|
6
|
+
CLI Using tsconfig: tsconfig.json
|
|
7
|
+
CLI tsup v8.5.1
|
|
8
|
+
CLI Target: es2020
|
|
9
|
+
CLI Cleaning output folder
|
|
10
|
+
ESM Build start
|
|
11
|
+
CJS Build start
|
|
12
|
+
ESM dist/index.js 1.96 KB
|
|
13
|
+
ESM ⚡️ Build success in 52ms
|
|
14
|
+
CJS dist/index.cjs 3.07 KB
|
|
15
|
+
CJS ⚡️ Build success in 52ms
|
|
16
|
+
DTS Build start
|
|
17
|
+
DTS ⚡️ Build success in 816ms
|
|
18
|
+
DTS dist/index.d.ts 3.90 KB
|
|
19
|
+
DTS dist/index.d.cts 3.90 KB
|
package/AGENTS.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ActionSchema: () => ActionSchema,
|
|
24
|
+
AppSpecificationSchema: () => AppSpecificationSchema,
|
|
25
|
+
BlockSchema: () => BlockSchema,
|
|
26
|
+
Bodewell: () => schema_exports,
|
|
27
|
+
EntitySchema: () => EntitySchema,
|
|
28
|
+
FieldSchema: () => FieldSchema,
|
|
29
|
+
FloraTelemetrySchema: () => FloraTelemetrySchema,
|
|
30
|
+
PageSchema: () => PageSchema,
|
|
31
|
+
PageSectionSchema: () => PageSectionSchema,
|
|
32
|
+
ResourceSchema: () => ResourceSchema,
|
|
33
|
+
SignalSchema: () => SignalSchema,
|
|
34
|
+
TriggerSchema: () => TriggerSchema,
|
|
35
|
+
WorkflowSchema: () => WorkflowSchema
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(index_exports);
|
|
38
|
+
|
|
39
|
+
// src/schema.ts
|
|
40
|
+
var import_zod = require("zod");
|
|
41
|
+
var FieldSchema = import_zod.z.object({
|
|
42
|
+
key: import_zod.z.string(),
|
|
43
|
+
label: import_zod.z.string(),
|
|
44
|
+
type: import_zod.z.enum(["text", "number", "currency", "date", "boolean", "status", "email", "image", "textarea"]),
|
|
45
|
+
required: import_zod.z.boolean().optional(),
|
|
46
|
+
description: import_zod.z.string().optional(),
|
|
47
|
+
defaultValue: import_zod.z.any().optional()
|
|
48
|
+
});
|
|
49
|
+
var ResourceSchema = import_zod.z.object({
|
|
50
|
+
id: import_zod.z.string(),
|
|
51
|
+
name: import_zod.z.string(),
|
|
52
|
+
fields: import_zod.z.array(FieldSchema),
|
|
53
|
+
defaultView: import_zod.z.enum(["table", "grid", "list"]).optional(),
|
|
54
|
+
features: import_zod.z.object({
|
|
55
|
+
searchable: import_zod.z.boolean().optional(),
|
|
56
|
+
creatable: import_zod.z.boolean().optional(),
|
|
57
|
+
editable: import_zod.z.boolean().optional(),
|
|
58
|
+
deletable: import_zod.z.boolean().optional(),
|
|
59
|
+
exportable: import_zod.z.boolean().optional()
|
|
60
|
+
}).optional()
|
|
61
|
+
});
|
|
62
|
+
var SignalSchema = import_zod.z.object({
|
|
63
|
+
id: import_zod.z.string().min(1, "Signal ID is required"),
|
|
64
|
+
label: import_zod.z.string(),
|
|
65
|
+
description: import_zod.z.string().optional(),
|
|
66
|
+
kind: import_zod.z.enum(["sensor", "actuator", "setpoint", "metric", "status", "kpi"]),
|
|
67
|
+
source: import_zod.z.enum(["mock", "mqtt", "http", "derived", "local"]),
|
|
68
|
+
// Connectivity
|
|
69
|
+
topic: import_zod.z.string().optional(),
|
|
70
|
+
endpoint: import_zod.z.string().optional(),
|
|
71
|
+
jsonPath: import_zod.z.string().optional(),
|
|
72
|
+
refreshRate: import_zod.z.number().optional().default(1e3),
|
|
73
|
+
// Values
|
|
74
|
+
defaultValue: import_zod.z.any().optional(),
|
|
75
|
+
unit: import_zod.z.string().optional(),
|
|
76
|
+
min: import_zod.z.number().optional(),
|
|
77
|
+
max: import_zod.z.number().optional()
|
|
78
|
+
});
|
|
79
|
+
var EntitySchema = import_zod.z.object({
|
|
80
|
+
id: import_zod.z.string(),
|
|
81
|
+
name: import_zod.z.string(),
|
|
82
|
+
description: import_zod.z.string().optional(),
|
|
83
|
+
type: import_zod.z.string(),
|
|
84
|
+
category: import_zod.z.string().default("logical"),
|
|
85
|
+
signals: import_zod.z.array(import_zod.z.string()),
|
|
86
|
+
ui: import_zod.z.object({
|
|
87
|
+
icon: import_zod.z.string().optional(),
|
|
88
|
+
color: import_zod.z.string().optional(),
|
|
89
|
+
dashboardComponent: import_zod.z.string().optional()
|
|
90
|
+
}).optional()
|
|
91
|
+
});
|
|
92
|
+
var TriggerSchema = import_zod.z.object({
|
|
93
|
+
id: import_zod.z.string(),
|
|
94
|
+
type: import_zod.z.enum(["signal_change", "manual_action", "schedule", "webhook"]),
|
|
95
|
+
config: import_zod.z.record(import_zod.z.string(), import_zod.z.any())
|
|
96
|
+
});
|
|
97
|
+
var ActionSchema = import_zod.z.object({
|
|
98
|
+
id: import_zod.z.string(),
|
|
99
|
+
type: import_zod.z.enum([
|
|
100
|
+
"update_resource",
|
|
101
|
+
"send_notification",
|
|
102
|
+
"mqtt_publish",
|
|
103
|
+
"api_call",
|
|
104
|
+
"navigate",
|
|
105
|
+
"agent_task"
|
|
106
|
+
]),
|
|
107
|
+
config: import_zod.z.record(import_zod.z.string(), import_zod.z.any())
|
|
108
|
+
});
|
|
109
|
+
var WorkflowSchema = import_zod.z.object({
|
|
110
|
+
id: import_zod.z.string(),
|
|
111
|
+
name: import_zod.z.string(),
|
|
112
|
+
active: import_zod.z.boolean().default(true),
|
|
113
|
+
trigger: TriggerSchema,
|
|
114
|
+
actions: import_zod.z.array(ActionSchema)
|
|
115
|
+
});
|
|
116
|
+
var BlockSchema = import_zod.z.object({
|
|
117
|
+
id: import_zod.z.string(),
|
|
118
|
+
type: import_zod.z.string(),
|
|
119
|
+
props: import_zod.z.record(import_zod.z.string(), import_zod.z.any()),
|
|
120
|
+
layout: import_zod.z.object({
|
|
121
|
+
colSpan: import_zod.z.number().optional(),
|
|
122
|
+
rowSpan: import_zod.z.number().optional()
|
|
123
|
+
}).optional()
|
|
124
|
+
});
|
|
125
|
+
var PageSectionSchema = import_zod.z.object({
|
|
126
|
+
id: import_zod.z.string(),
|
|
127
|
+
title: import_zod.z.string().optional(),
|
|
128
|
+
description: import_zod.z.string().optional(),
|
|
129
|
+
layout: import_zod.z.object({
|
|
130
|
+
columns: import_zod.z.number().optional(),
|
|
131
|
+
variant: import_zod.z.enum(["grid", "stack", "split"]).optional()
|
|
132
|
+
}).optional(),
|
|
133
|
+
blocks: import_zod.z.array(BlockSchema)
|
|
134
|
+
});
|
|
135
|
+
var PageSchema = import_zod.z.object({
|
|
136
|
+
id: import_zod.z.string(),
|
|
137
|
+
slug: import_zod.z.string(),
|
|
138
|
+
title: import_zod.z.string(),
|
|
139
|
+
description: import_zod.z.string().optional(),
|
|
140
|
+
icon: import_zod.z.string().optional(),
|
|
141
|
+
sections: import_zod.z.array(PageSectionSchema)
|
|
142
|
+
});
|
|
143
|
+
var AppSpecificationSchema = import_zod.z.object({
|
|
144
|
+
meta: import_zod.z.object({
|
|
145
|
+
name: import_zod.z.string(),
|
|
146
|
+
version: import_zod.z.string(),
|
|
147
|
+
description: import_zod.z.string().optional(),
|
|
148
|
+
author: import_zod.z.string().optional(),
|
|
149
|
+
createdAt: import_zod.z.string().optional()
|
|
150
|
+
}),
|
|
151
|
+
config: import_zod.z.object({
|
|
152
|
+
theme: import_zod.z.enum(["light", "dark", "system", "corporate", "midnight", "blueprint"]).default("system"),
|
|
153
|
+
mockMode: import_zod.z.boolean().default(true),
|
|
154
|
+
brokerUrl: import_zod.z.string().optional()
|
|
155
|
+
}),
|
|
156
|
+
modules: import_zod.z.array(import_zod.z.string()).optional(),
|
|
157
|
+
resources: import_zod.z.array(ResourceSchema).optional(),
|
|
158
|
+
domain: import_zod.z.object({
|
|
159
|
+
signals: import_zod.z.array(SignalSchema),
|
|
160
|
+
entities: import_zod.z.array(EntitySchema),
|
|
161
|
+
workflows: import_zod.z.array(WorkflowSchema).optional()
|
|
162
|
+
}),
|
|
163
|
+
pages: import_zod.z.array(PageSchema).optional()
|
|
164
|
+
});
|
|
165
|
+
var FloraTelemetrySchema = import_zod.z.object({
|
|
166
|
+
timestamp: import_zod.z.number(),
|
|
167
|
+
soilMoisture: import_zod.z.number().min(0).max(100),
|
|
168
|
+
ambientLight: import_zod.z.number().min(0).max(1e5),
|
|
169
|
+
temperature: import_zod.z.number().min(-40).max(125)
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// src/bodewell/schema.ts
|
|
173
|
+
var schema_exports = {};
|
|
174
|
+
__export(schema_exports, {
|
|
175
|
+
BodewellCommandSchema: () => BodewellCommandSchema,
|
|
176
|
+
BodewellDeviceID: () => BodewellDeviceID,
|
|
177
|
+
BodewellTelemetrySchema: () => BodewellTelemetrySchema
|
|
178
|
+
});
|
|
179
|
+
var import_zod2 = require("zod");
|
|
180
|
+
var BodewellDeviceID = import_zod2.z.enum([
|
|
181
|
+
"STK-V1-001",
|
|
182
|
+
"STK-V1-002",
|
|
183
|
+
"STK-V1-003",
|
|
184
|
+
"STK-PRO-001",
|
|
185
|
+
"STK-VIS-001"
|
|
186
|
+
]);
|
|
187
|
+
var BodewellTelemetrySchema = import_zod2.z.object({
|
|
188
|
+
device_id: BodewellDeviceID,
|
|
189
|
+
stick_id: import_zod2.z.string().optional().describe("Firmware alias for device_id"),
|
|
190
|
+
timestamp: import_zod2.z.number().optional().describe("Epoch timestamp from NTP"),
|
|
191
|
+
air_temp: import_zod2.z.number().optional().describe("Celsius"),
|
|
192
|
+
air_humid: import_zod2.z.number().optional().describe("Relative Humidity %"),
|
|
193
|
+
humidity: import_zod2.z.number().optional().describe("Firmware alias for air_humid"),
|
|
194
|
+
air_pressure: import_zod2.z.number().optional().describe("hPa"),
|
|
195
|
+
pressure: import_zod2.z.number().optional().describe("Firmware alias for air_pressure"),
|
|
196
|
+
light_lux: import_zod2.z.number().optional().describe("Lux level"),
|
|
197
|
+
soil_temp_stemma: import_zod2.z.number().optional().describe("Celsius"),
|
|
198
|
+
soil_vwc: import_zod2.z.number().describe("Volumetric Water Content / Raw Capacitance"),
|
|
199
|
+
soil_moisture: import_zod2.z.number().optional().describe("Firmware alias for raw capacitance"),
|
|
200
|
+
soil_moisture_raw: import_zod2.z.number().optional().describe("Unscaled capacitance (300-1100)")
|
|
201
|
+
}).passthrough();
|
|
202
|
+
var BodewellCommandSchema = import_zod2.z.object({
|
|
203
|
+
stick_id: BodewellDeviceID,
|
|
204
|
+
// Note: Your API uses stick_id here, not device_id
|
|
205
|
+
type: import_zod2.z.enum(["dry", "wet"]),
|
|
206
|
+
value: import_zod2.z.number()
|
|
207
|
+
});
|
|
208
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
209
|
+
0 && (module.exports = {
|
|
210
|
+
ActionSchema,
|
|
211
|
+
AppSpecificationSchema,
|
|
212
|
+
BlockSchema,
|
|
213
|
+
Bodewell,
|
|
214
|
+
EntitySchema,
|
|
215
|
+
FieldSchema,
|
|
216
|
+
FloraTelemetrySchema,
|
|
217
|
+
PageSchema,
|
|
218
|
+
PageSectionSchema,
|
|
219
|
+
ResourceSchema,
|
|
220
|
+
SignalSchema,
|
|
221
|
+
TriggerSchema,
|
|
222
|
+
WorkflowSchema
|
|
223
|
+
});
|