initiative-plugin-sdk 9.0.0 → 9.0.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.
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://initiativetasks.com/schemas/plugin-manifest-v1.json",
4
4
  "title": "Initiative plug-in manifest (the 'definition' body)",
5
- "description": "What a plug-in declares it can do. A plug-in is a container, which names its `service` and answers Initiative's calls, or declarative, which names its `hosts` and no service, and whose endpoints, connection checks, webhook events, schedules and actions Initiative runs itself from the requests and JSONata expressions written here, keeping the values they write on items; one plug-in is never both. This is the 'definition' field of the document served at /.well-known/initiative-plugin.json, NOT that whole document: a registrar also requires protocol_version, public_id and kind alongside it, and refuses a definition served bare. Generated from the platform's own validator vocabulary. A manifest that satisfies this schema is well-formed, not necessarily acceptable. Cross-references (the endpoint a widget binds, a requires term's connection, an endpoint's service prefix), the direction-specific rules on an endpoint, the features/blocks cross-check in both directions, UTF-8 byte-size caps, the rules tying a connection's flow and token to its scope and fields, what a webhooks block names, what a vendor setup writes to, whether every expression parses, what a declarative request and its steps name, the bounds, ids and endpoints of schedules, which terms each kind's schedules, actions, fields and webhook events take, the unique keys and ids of fields, parts, actions and settings, what a part's nodes, a field's element actions and an action's endpoint and params name, the placeholders in a part's text, and a part's size and depth are enforced by the platform on publish and are not expressible here.",
5
+ "description": "What a plug-in declares it can do. A plug-in is a container, which names its `service` and answers Initiative's calls, or declarative, which names its `hosts` and no service, and whose endpoints, connection checks, webhook events, schedules and actions Initiative runs itself from the requests and JSONata expressions written here, keeping the values they write on items; one plug-in is never both. This is the 'definition' field of the document served at /.well-known/initiative-plugin.json, NOT that whole document: a registrar also requires protocol_version, public_id and kind alongside it, and refuses a definition served bare. Generated from the platform's own validator vocabulary. A manifest that satisfies this schema is well-formed, not necessarily acceptable. Cross-references (the endpoint a widget binds, a requires term's connection, an endpoint's service prefix), the direction-specific rules on an endpoint, the features/blocks cross-check in both directions, UTF-8 byte-size caps, the rules tying a connection's flow and token to its scope and fields, what a webhooks block names, what a vendor setup writes to, whether every expression parses, what a declarative request and its steps name, the bounds, ids and endpoints of schedules, which terms each kind's schedules, actions, fields and webhook events take, the unique keys and ids of fields, parts, actions and settings, the unique values of a field's options, what a part's nodes, a field's element actions and an action's endpoint and params name, the placeholders in a part's text, and a part's size and depth are enforced by the platform on publish and are not expressible here.",
6
6
  "type": "object",
7
7
  "required": [
8
8
  "plugin_kind",
@@ -1309,15 +1309,20 @@
1309
1309
  "datetime",
1310
1310
  "link",
1311
1311
  "badge",
1312
- "progress",
1313
- "checkbox"
1312
+ "scale",
1313
+ "checkbox",
1314
+ "url",
1315
+ "currency",
1316
+ "select",
1317
+ "multi_select",
1318
+ "user_reference"
1314
1319
  ],
1315
- "description": "What the value is, and so how it is drawn: 'text' a string; 'number' a number; 'date' a 'YYYY-MM-DD' string; 'datetime' an ISO 8601 string with its offset; 'link' {url, text?}; 'badge' {text, tone?}; 'progress' {value, max}; 'checkbox' a boolean."
1320
+ "description": "What the value is, and so how it is drawn: 'text' a string; 'number' a number; 'date' a 'YYYY-MM-DD' string; 'datetime' an ISO 8601 string with its offset; 'link' {url, text?}; 'badge' {text, tone?}; 'scale' a number from 0 to 100, or {value, max}, which Initiative keeps as value ÷ max × 100, drawn as a number, stars or a bar; 'checkbox' a boolean; 'url' an address, as a string; 'currency' a number, an amount in the field's 'currency'; 'select' the value of one of the field's 'options'; 'multi_select' a list of them; 'user_reference' a person, as the install's own reference for them: the 'id' Initiative gives the person wherever the plug-in reads one."
1316
1321
  },
1317
1322
  "list": {
1318
1323
  "type": "boolean",
1319
1324
  "default": false,
1320
- "description": "Several values rather than one: the value is a list of elements, each one value of 'kind' with a 'ref' that tells it from the others ('listElement'). A change gives the whole list in 'set', or adds, replaces and removes elements by 'ref' with 'upsert' and 'remove'. Absent: one value, which a change sets."
1325
+ "description": "Several values rather than one: the value is a list of elements, each one value of 'kind' with a 'ref' that tells it from the others ('listElement'). A change gives the whole list in 'set', or adds, replaces and removes elements by 'ref' with 'upsert' and 'remove'. Absent: one value, which a change sets. Every kind but 'multi_select', whose one value is already several."
1321
1326
  },
1322
1327
  "on": {
1323
1328
  "type": "array",
@@ -1350,6 +1355,20 @@
1350
1355
  ],
1351
1356
  "description": "A badge's tone when its value names none."
1352
1357
  },
1358
+ "currency": {
1359
+ "type": "string",
1360
+ "pattern": "^[A-Z]{3}$",
1361
+ "description": "A currency field's ISO 4217 code, such as 'EUR': what its amounts are in. Required on one."
1362
+ },
1363
+ "options": {
1364
+ "type": "array",
1365
+ "minItems": 1,
1366
+ "maxItems": 24,
1367
+ "items": {
1368
+ "$ref": "#/$defs/fieldOption"
1369
+ },
1370
+ "description": "A select or multi_select field's options, each value at most once. Required on one."
1371
+ },
1353
1372
  "states": {
1354
1373
  "type": "object",
1355
1374
  "minProperties": 1,
@@ -1360,7 +1379,7 @@
1360
1379
  "additionalProperties": {
1361
1380
  "$ref": "#/$defs/stateFacet"
1362
1381
  },
1363
- "description": "What state the value is in, as facets by id, at most 4, each with keys of its own. The value names a key of each facet it is in as 'state', {\"<facet>\": \"<key>\"}, and Initiative draws each as a badge, labelled in the reader's language. A list element, and a link, badge or progress value, carries 'state' beside its other properties; a text, number, date, datetime or checkbox value that carries one is written as an element is, without the 'ref': {\"value\": …, \"state\": …}."
1382
+ "description": "What state the value is in, as facets by id, at most 4, each with keys of its own. The value names a key of each facet it is in as 'state', {\"<facet>\": \"<key>\"}, and Initiative draws each as a badge, labelled in the reader's language. A list element, and a link, badge or scale value written as an object, carries 'state' beside its other properties; any other value that carries one is written as an element is, without the 'ref': {\"value\": …, \"state\": …}."
1364
1383
  },
1365
1384
  "actions": {
1366
1385
  "type": "array",
@@ -1375,7 +1394,92 @@
1375
1394
  "requires": {
1376
1395
  "$ref": "#/$defs/requires"
1377
1396
  }
1378
- }
1397
+ },
1398
+ "allOf": [
1399
+ {
1400
+ "if": {
1401
+ "properties": {
1402
+ "kind": {
1403
+ "const": "currency"
1404
+ }
1405
+ },
1406
+ "required": [
1407
+ "kind"
1408
+ ]
1409
+ },
1410
+ "then": {
1411
+ "required": [
1412
+ "currency"
1413
+ ]
1414
+ }
1415
+ },
1416
+ {
1417
+ "if": {
1418
+ "properties": {
1419
+ "kind": {
1420
+ "enum": [
1421
+ "select",
1422
+ "multi_select"
1423
+ ]
1424
+ }
1425
+ },
1426
+ "required": [
1427
+ "kind"
1428
+ ]
1429
+ },
1430
+ "then": {
1431
+ "required": [
1432
+ "options"
1433
+ ]
1434
+ }
1435
+ },
1436
+ {
1437
+ "if": {
1438
+ "properties": {
1439
+ "kind": {
1440
+ "const": "multi_select"
1441
+ }
1442
+ },
1443
+ "required": [
1444
+ "kind"
1445
+ ]
1446
+ },
1447
+ "then": {
1448
+ "properties": {
1449
+ "list": {
1450
+ "const": false
1451
+ }
1452
+ }
1453
+ }
1454
+ }
1455
+ ]
1456
+ },
1457
+ "fieldOption": {
1458
+ "type": "object",
1459
+ "description": "One option of a select or multi_select field: the value a value names, and how Initiative shows it.",
1460
+ "required": [
1461
+ "value",
1462
+ "label"
1463
+ ],
1464
+ "properties": {
1465
+ "value": {
1466
+ "type": "string",
1467
+ "minLength": 1,
1468
+ "maxLength": 64,
1469
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_\\-]*$",
1470
+ "description": "What a value holds when it names this option: a letter or a digit, then letters, digits, '_' and '-'. Unique among the field's options."
1471
+ },
1472
+ "label": {
1473
+ "$ref": "#/$defs/localizedText",
1474
+ "description": "The option's words, in the reader's language."
1475
+ },
1476
+ "color": {
1477
+ "type": "string",
1478
+ "pattern": "^#[0-9A-Fa-f]{6}$",
1479
+ "description": "The option's colour, as '#rrggbb'."
1480
+ }
1481
+ },
1482
+ "additionalProperties": false
1379
1483
  },
1380
1484
  "stateFacet": {
1381
1485
  "type": "object",
@@ -1964,7 +2068,7 @@
1964
2068
  },
1965
2069
  "listElement": {
1966
2070
  "type": "object",
1967
- "description": "One element of a list field's value: one value of the field's 'kind', with a 'ref' that tells it from the list's others. A text, number, date, datetime or checkbox element holds its value in 'value'; a link element is {ref, url, text?}, a badge element {ref, text, tone?} and a progress element {ref, value, max}. Initiative keeps each element as a value of its own, of at most 8192 bytes as JSON. An 'upsert' may give only some of an element's properties: they are merged into the element with its 'ref'.",
2071
+ "description": "One element of a list field's value: one value of the field's 'kind', with a 'ref' that tells it from the list's others. A text, number, date, datetime, checkbox, url, currency, select or user_reference element holds its value in 'value'; a link element is {ref, url, text?}, a badge element {ref, text, tone?} and a scale element {ref, value, max?}. Initiative keeps each element as a value of its own, of at most 8192 bytes as JSON. An 'upsert' may give only some of an element's properties: they are merged into the element with its 'ref'.",
1968
2072
  "required": [
1969
2073
  "ref"
1970
2074
  ],
@@ -1978,7 +2082,7 @@
1978
2082
  "number",
1979
2083
  "boolean"
1980
2084
  ],
1981
- "description": "A text, number, date, datetime or checkbox element's value, or a progress element's figure."
2085
+ "description": "A text, number, date, datetime, checkbox, url, currency, select or user_reference element's value, or a scale element's figure: from 0 to 100, or out of its 'max'."
1982
2086
  },
1983
2087
  "url": {
1984
2088
  "type": "string",
@@ -2001,7 +2105,8 @@
2001
2105
  },
2002
2106
  "max": {
2003
2107
  "type": "number",
2004
- "description": "A progress element's whole."
2108
+ "exclusiveMinimum": 0,
2109
+ "description": "A scale element's whole, when its figure is not already out of 100: Initiative keeps value ÷ max × 100."
2005
2110
  },
2006
2111
  "state": {
2007
2112
  "type": "object",