Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

dbbasic-object-server/dron/dron-package.schema.json
Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 19 minutes ago History
dron-package.schema.json · 22.3 KB · 578 lines
1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "DRON package manifest",
4 "description": "DRON (Data Rules Object Notation) is a portable, declarative description of an application's data and the rules over it. The package manifest is its table of contents: which collection schemas, permission rules and seed data make up one app, what it depends on, which recurring passes it needs, which doors it puts in the site menu, and which queues of work wait on a person. It names things; it does not run them. This file validates one packages/<id>/dbbasic-package.json. DRON 0.2.",
5 "type": "object",
6 "required": [
7 "id",
8 "name",
9 "version"
10 ],
11 "additionalProperties": false,
12 "properties": {
13 "$schema": {
14 "description": "Optional pointer to this file so an editor can offer completion and flag mistakes. The engine ignores it.",
15 "type": "string"
16 },
17 "dron": {
18 "description": "The DRON version this package was written for, as \"MAJOR.MINOR\" text. A server installs it when it reads that version or a later minor of the same major; otherwise the install is refused before anything is written, naming both versions (upgrade the server, or for an older major update the package). Leave it out and the package is read as written before versions were declared. Write the version the files in dron/ say. Example: \"0.2\".",
19 "type": "string",
20 "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
21 },
22 "id": {
23 "description": "The package's identifier. It must equal the package directory's name. Lowercase letters, digits, underscores and hyphens, starting with a letter, at most 64 characters. Example: \"app-invoices\".",
24 "$ref": "dron-common.schema.json#/$defs/packageId"
25 },
26 "name": {
27 "description": "Human name of the app. Example: \"Invoices\".",
28 "$ref": "dron-common.schema.json#/$defs/nonBlankText"
29 },
30 "version": {
31 "description": "Package version. Letters, digits, dots, underscores, plus and hyphens, starting with a letter or digit, at most 64 characters. Bump it on ANY content change so install changelogs and restore points stay meaningful. Example: \"0.4.1\".",
32 "type": "string",
33 "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$"
34 },
35 "description": {
36 "description": "One or two sentences on what the app is for.",
37 "type": "string"
38 },
39 "compatibility": {
40 "description": "Which engine versions the package works with, as {engine: version-range}. Recorded, not enforced. Example: {\"dbbasic_object_server\": \">=0.1.0\"}.",
41 "type": "object",
42 "additionalProperties": {
43 "type": "string"
44 }
45 },
46 "dependencies": {
47 "description": "Other packages this one needs. Declared, not resolved: the installer does not install them for you. Each entry is a package id, or {\"id\", \"version\"}.",
48 "type": "array",
49 "items": {
50 "oneOf": [
51 {
52 "$ref": "dron-common.schema.json#/$defs/packageId"
53 },
54 {
55 "type": "object",
56 "required": [
57 "id"
58 ],
59 "additionalProperties": false,
60 "properties": {
61 "id": {
62 "$ref": "dron-common.schema.json#/$defs/packageId"
63 },
64 "version": {
65 "description": "The version or range wanted.",
66 "type": "string"
67 }
68 }
69 }
70 ]
71 }
72 },
73 "objects": {
74 "description": "The code objects the package ships (pages, actions, hooks, system passes). Code is outside DRON's data and rules; an entry only names it. Example: [{\"id\": \"site_invoices\", \"path\": \"objects/site/invoices.py\"}].",
75 "type": "array",
76 "items": {
77 "type": "object",
78 "required": [
79 "id",
80 "path"
81 ],
82 "additionalProperties": false,
83 "properties": {
84 "id": {
85 "description": "The object id the engine runs it as: letters, digits and underscores, 1 to 64 characters.",
86 "$ref": "dron-common.schema.json#/$defs/collectionName"
87 },
88 "path": {
89 "description": "Package-relative path of the source file.",
90 "$ref": "dron-common.schema.json#/$defs/relativePath"
91 }
92 }
93 }
94 },
95 "schemas": {
96 "description": "The collection schemas the package ships, each a DRON collection (see dron-collection.schema.json). Installing writes them into the data directory; an existing schema is replaced only when the installer is told it may.",
97 "type": "array",
98 "items": {
99 "type": "object",
100 "required": [
101 "collection",
102 "path"
103 ],
104 "additionalProperties": false,
105 "properties": {
106 "collection": {
107 "description": "The collection's name. It should equal the name inside the file.",
108 "$ref": "dron-common.schema.json#/$defs/collectionName"
109 },
110 "path": {
111 "description": "Package-relative path of the schema file. Example: \"schemas/invoices.json\".",
112 "$ref": "dron-common.schema.json#/$defs/relativePath"
113 }
114 }
115 }
116 },
117 "permissions": {
118 "description": "The permission-rule files the package ships (see dron-permissions.schema.json). Installing merges their rules into the deployment's policy, tagged with this package, and withdraws rules the package used to ship and no longer does.",
119 "type": "array",
120 "items": {
121 "type": "object",
122 "required": [
123 "path"
124 ],
125 "additionalProperties": false,
126 "properties": {
127 "path": {
128 "description": "Package-relative path of the rules file. Example: \"permissions/rules.json\".",
129 "$ref": "dron-common.schema.json#/$defs/relativePath"
130 }
131 }
132 }
133 },
134 "seed": {
135 "description": "Starting records, one TSV file per collection (first row is the header and must include id). Install-once: written only when the collection has no records yet, so an upgrade never overwrites live data.",
136 "type": "array",
137 "items": {
138 "type": "object",
139 "required": [
140 "collection",
141 "path"
142 ],
143 "additionalProperties": false,
144 "properties": {
145 "collection": {
146 "description": "The collection the rows go into.",
147 "$ref": "dron-common.schema.json#/$defs/collectionName"
148 },
149 "path": {
150 "description": "Package-relative path of the TSV file. Example: \"seed/invoices.tsv\".",
151 "$ref": "dron-common.schema.json#/$defs/relativePath"
152 }
153 }
154 }
155 },
156 "migrations": {
157 "description": "Data migrations. Accepted and reported in a dry run, but install refuses a package that ships any until run semantics exist, so leave this empty.",
158 "type": "array",
159 "items": {
160 "type": "object",
161 "required": [
162 "id",
163 "path"
164 ],
165 "additionalProperties": false,
166 "properties": {
167 "id": {
168 "description": "Migration id: letters, digits, underscores and hyphens, starting with a letter or digit.",
169 "type": "string",
170 "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$"
171 },
172 "path": {
173 "$ref": "dron-common.schema.json#/$defs/relativePath"
174 }
175 }
176 }
177 },
178 "connectors": {
179 "description": "Declares that a collection is reconciled against an external system by a module inside this package.",
180 "type": "array",
181 "items": {
182 "type": "object",
183 "required": [
184 "collection",
185 "module"
186 ],
187 "additionalProperties": false,
188 "properties": {
189 "collection": {
190 "description": "The collection kept in step with the outside system.",
191 "$ref": "dron-common.schema.json#/$defs/collectionName"
192 },
193 "module": {
194 "description": "Package-relative path of the connector module.",
195 "$ref": "dron-common.schema.json#/$defs/relativePath"
196 },
197 "entry": {
198 "description": "Name of the function in the module to call. A Python identifier. Default \"reconcile\".",
199 "type": "string",
200 "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
201 }
202 }
203 }
204 },
205 "schedules": {
206 "description": "Recurring or one-time passes the app needs. If the app needs something to run on a clock, declare it here: a schedule that exists only on a running server is invisible to review and lost on a rebuild. Run history and an operator's pause survive reinstalls.",
207 "type": "array",
208 "items": {
209 "$ref": "#/$defs/schedule"
210 }
211 },
212 "nav": {
213 "description": "The doors the app puts on the site: one entry per page a person opens from the menu. Each becomes a row in the shared navigation registry. An operator may hide an entry without editing the package.",
214 "type": "array",
215 "items": {
216 "$ref": "#/$defs/nav"
217 }
218 },
219 "nav_optional": {
220 "description": "true says this app deliberately has no menu entry (it serves only a widget, a fragment or a per-record document), so \"no front page\" is a reviewable claim rather than an omission. Default false.",
221 "type": "boolean"
222 },
223 "attention": {
224 "description": "Queues of work that wait on a person (receipts to confirm, invoices past due). Each is a count the home page shows only when it is above zero, linking to where the work is done. Write a declared count (collection + where) whenever the queue is rows of one collection in a waiting state; name a code provider (object_id) only when the number needs arithmetic or other collections.",
225 "type": "array",
226 "items": {
227 "$ref": "#/$defs/attention"
228 }
229 }
230 },
231 "$defs": {
232 "schedule": {
233 "title": "DRON schedule",
234 "description": "One recurring or one-time pass: call an object on a clock.",
235 "type": "object",
236 "required": [
237 "id",
238 "object_id",
239 "schedule"
240 ],
241 "additionalProperties": false,
242 "properties": {
243 "id": {
244 "description": "Identifier, unique within the package. Lowercase letters, digits and underscores, starting with a letter. Example: \"invoices_overdue_nightly\".",
245 "$ref": "dron-common.schema.json#/$defs/slug"
246 },
247 "object_id": {
248 "description": "The object to call. It must be shipped by this package or provided by the server.",
249 "$ref": "dron-common.schema.json#/$defs/collectionName"
250 },
251 "schedule": {
252 "description": "For type cron: a cron expression of 5 or 6 space-separated fields. For type onetime: an ISO-8601 timestamp. A string that can never fire is refused at install. Example: \"10 6 * * *\" (06:10 every day).",
253 "type": "string",
254 "pattern": "\\S",
255 "not": {
256 "pattern": "[\\t\\n]"
257 }
258 },
259 "type": {
260 "description": "cron (default) repeats; onetime runs once at the timestamp.",
261 "enum": [
262 "cron",
263 "onetime"
264 ]
265 },
266 "method": {
267 "description": "Which function of the object to call. Default POST. Remember an object that only defines EVENT is never called by the scheduler: define the method named here.",
268 "enum": [
269 "POST",
270 "GET",
271 "PUT",
272 "DELETE"
273 ]
274 },
275 "payload": {
276 "description": "Fixed arguments passed to the call.",
277 "type": "object"
278 },
279 "description": {
280 "description": "What the pass does, in a sentence.",
281 "type": "string"
282 }
283 },
284 "allOf": [
285 {
286 "if": {
287 "required": [
288 "type"
289 ],
290 "properties": {
291 "type": {
292 "const": "onetime"
293 }
294 }
295 },
296 "then": {
297 "properties": {
298 "schedule": {
299 "pattern": "^\\d{4}-\\d{2}-\\d{2}"
300 }
301 }
302 },
303 "else": {
304 "properties": {
305 "schedule": {
306 "pattern": "^\\s*\\S+(\\s+\\S+){4,5}\\s*$"
307 }
308 }
309 }
310 }
311 ]
312 },
313 "nav": {
314 "title": "DRON nav entry",
315 "description": "One door: a page the menu and the home grid link to.",
316 "type": "object",
317 "required": [
318 "id",
319 "label",
320 "path"
321 ],
322 "additionalProperties": false,
323 "properties": {
324 "id": {
325 "description": "Identifier, unique across every installed package. Lowercase letters, digits and underscores, starting with a letter. Example: \"invoices\".",
326 "$ref": "dron-common.schema.json#/$defs/slug"
327 },
328 "label": {
329 "description": "The menu text. Example: \"Invoices\".",
330 "$ref": "dron-common.schema.json#/$defs/nonBlankText"
331 },
332 "path": {
333 "description": "The URL the entry opens. Starts with / and holds no whitespace. Whether anything serves it is not checked. Example: \"/invoices\".",
334 "type": "string",
335 "pattern": "^/\\S*$"
336 },
337 "blurb": {
338 "description": "One honest line in the present tense saying what the app does, shown under the label. No marketing.",
339 "type": "string"
340 },
341 "surface": {
342 "description": "Who the MENU shows it to: public (everyone), member (signed-in users, the default), operator (admins), hidden (nobody). This governs the menu only; permissions decide who may open the page.",
343 "enum": [
344 "public",
345 "member",
346 "operator",
347 "hidden"
348 ]
349 },
350 "group": {
351 "description": "The menu heading. Free text, default \"Apps\". House groups: Work, Publishing, Money, Commerce, Warehouse, System.",
352 "type": "string"
353 },
354 "order": {
355 "description": "Integer sort key, default 100. Packages band it by group (Work 0s, Publishing 200s, Money 300s, Commerce 400s, Warehouse 500s, System 600s) so group order falls out of the same number.",
356 "type": "integer"
357 }
358 }
359 },
360 "attention": {
361 "title": "DRON attention source",
362 "description": "One queue of work waiting on a person. Name exactly one source of the number: a declared count (collection with where, and optionally detail) or a code provider (object_id, optionally reads).",
363 "type": "object",
364 "required": [
365 "id",
366 "label",
367 "path"
368 ],
369 "additionalProperties": false,
370 "properties": {
371 "id": {
372 "description": "Identifier, unique across every installed package. Lowercase letters, digits and underscores, starting with a letter. Example: \"scans_to_confirm\".",
373 "$ref": "dron-common.schema.json#/$defs/slug"
374 },
375 "label": {
376 "description": "What a person calls the queue, in their words: \"Receipts to confirm\", not \"scans.status=extracted\".",
377 "$ref": "dron-common.schema.json#/$defs/nonBlankText"
378 },
379 "path": {
380 "description": "Where the count clicks through to. Starts with / and holds no whitespace. A number that cannot be acted on in one click does not belong on a home page. Example: \"/scans\".",
381 "type": "string",
382 "pattern": "^/\\S*$"
383 },
384 "nav_id": {
385 "description": "The nav entry this count decorates, so the app list reads \"Invoices - 5 overdue\". Omit when the package ships no door.",
386 "$ref": "dron-common.schema.json#/$defs/slug"
387 },
388 "group": {
389 "description": "Heading on the home band. Free text, default \"Apps\"; use the nav house groups.",
390 "type": "string"
391 },
392 "severity": {
393 "description": "normal (default): work waiting. warning: work already late (an overdue invoice). urgent: something broken. The first sort key on the home band.",
394 "enum": [
395 "normal",
396 "warning",
397 "urgent"
398 ]
399 },
400 "collection": {
401 "description": "A declared count: the collection whose rows are counted, for each viewer, over the rows they may read. Lowercase letters, digits and underscores, starting with a letter. Use instead of object_id.",
402 "$ref": "dron-common.schema.json#/$defs/slug"
403 },
404 "where": {
405 "description": "Which rows count (declared count only; required with collection). The row-filter language plus older_than_days. It needs at least one literal equality (a value, or op eq or in) so rows are found by index; a where made only of ne and ranges is refused at install. Example: {\"status\": \"extracted\"}; \"my own rows\" is {\"owner_id\": \"$user_id\"}.",
406 "$ref": "dron-common.schema.json#/$defs/attentionWhere"
407 },
408 "detail": {
409 "description": "Optional sentence under the number (declared count only): one part, or a list of parts joined with \", \". A part whose value is 0 is left out unless show_zero. Example: {\"op\": \"count\", \"where\": {\"created_at\": {\"op\": \"older_than_days\", \"value\": 7}}, \"text\": \"{value} over a week old\"}.",
410 "anyOf": [
411 {
412 "$ref": "#/$defs/detailPart"
413 },
414 {
415 "type": "array",
416 "minItems": 1,
417 "items": {
418 "$ref": "#/$defs/detailPart"
419 }
420 }
421 ]
422 },
423 "object_id": {
424 "description": "A code provider: the object whose COUNT function returns {\"count\": int, \"detail\"?: str}. Use only when the number needs another collection, arithmetic between fields, or a comparison the row-filter language lacks. It must be shipped by this package or provided by the server. Use instead of collection.",
425 "$ref": "dron-common.schema.json#/$defs/collectionName"
426 },
427 "reads": {
428 "description": "Provider only. The collections the provider folds its number from. The number is computed with no viewer, so it is shown only to a viewer who may read EVERY row of each listed collection; without reads only admins see it. Example: [\"orders\", \"shipments\"].",
429 "type": "array",
430 "uniqueItems": true,
431 "items": {
432 "$ref": "dron-common.schema.json#/$defs/slug"
433 }
434 }
435 },
436 "if": {
437 "required": [
438 "collection"
439 ]
440 },
441 "then": {
442 "required": [
443 "where"
444 ],
445 "allOf": [
446 {
447 "description": "A count is either declared or provided, never both.",
448 "not": {
449 "required": [
450 "object_id"
451 ]
452 }
453 },
454 {
455 "description": "reads is for a provider; a declared count is counted per viewer over the rows they may read.",
456 "not": {
457 "required": [
458 "reads"
459 ]
460 }
461 }
462 ]
463 },
464 "else": {
465 "required": [
466 "object_id"
467 ],
468 "allOf": [
469 {
470 "description": "where needs a collection to read.",
471 "not": {
472 "required": [
473 "where"
474 ]
475 }
476 },
477 {
478 "description": "detail needs a collection to read.",
479 "not": {
480 "required": [
481 "detail"
482 ]
483 }
484 }
485 ]
486 }
487 },
488 "detailPart": {
489 "title": "DRON attention detail part",
490 "description": "One clause of the sentence under an attention count. op count: the counted rows, or those also matching where. op sum: an integer field summed (an unparseable cell adds 0). op max_age_days: the age in days of the oldest dated row.",
491 "type": "object",
492 "required": [
493 "op",
494 "text"
495 ],
496 "additionalProperties": false,
497 "properties": {
498 "op": {
499 "enum": [
500 "count",
501 "sum",
502 "max_age_days"
503 ],
504 "description": "count: rows counted. sum: an integer field added up. max_age_days: the age in days of the oldest dated row."
505 },
506 "text": {
507 "description": "The sentence, at most 200 characters. {value} is replaced by the number and is the only placeholder allowed; a text without it is a fixed sentence shown exactly when the part would have been. Example: \"{value} over a week old\".",
508 "type": "string",
509 "minLength": 1,
510 "maxLength": 200,
511 "pattern": "^(?=.*\\S)(?:[^{}]|\\{value\\})*$"
512 },
513 "field": {
514 "description": "The field summed or aged. Required for sum and max_age_days; not allowed for count.",
515 "$ref": "dron-common.schema.json#/$defs/fieldName"
516 },
517 "where": {
518 "description": "Further narrows the counted rows for this part. Unlike the count's own where it needs no literal equality.",
519 "$ref": "dron-common.schema.json#/$defs/attentionWhere"
520 },
521 "format": {
522 "description": "How a sum is written: integer (default), cents (1,234.56), dollars ($1234.56), hours (seconds as hours, one decimal). Only a sum takes a format other than integer.",
523 "enum": [
524 "integer",
525 "cents",
526 "dollars",
527 "hours"
528 ]
529 },
530 "show_zero": {
531 "description": "true shows the part even when its value is 0. Default false.",
532 "type": "boolean"
533 }
534 },
535 "allOf": [
536 {
537 "if": {
538 "properties": {
539 "op": {
540 "const": "count"
541 }
542 }
543 },
544 "then": {
545 "not": {
546 "required": [
547 "field"
548 ]
549 }
550 },
551 "else": {
552 "required": [
553 "field"
554 ]
555 }
556 },
557 {
558 "if": {
559 "properties": {
560 "op": {
561 "not": {
562 "const": "sum"
563 }
564 }
565 }
566 },
567 "then": {
568 "properties": {
569 "format": {
570 "const": "integer"
571 }
572 }
573 }
574 }
575 ]
576 }
577 }
578}