@almadar/std 16.21.3 → 16.21.4

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.
@@ -0,0 +1,382 @@
1
+ {
2
+ "name": "std-autocomplete",
3
+ "version": "1.0.0",
4
+ "description": "std-autocomplete — reusable inline typeahead: as the user types (AUTO_QUERY), fetches the linked entity filtered by @config.searchField and shows a compact suggestions list; picking one emits AUTO_SELECTED { id } for the consumer to open the record or fill a field. Rebind to any entity; configure searchField + the label field shown per suggestion.",
5
+ "orbitals": [
6
+ {
7
+ "name": "AutocompleteOrbital",
8
+ "entity": {
9
+ "name": "AutoTarget",
10
+ "persistence": "runtime",
11
+ "fields": [
12
+ {
13
+ "name": "id",
14
+ "type": "string",
15
+ "required": true
16
+ },
17
+ {
18
+ "name": "name",
19
+ "type": "string",
20
+ "description": "The primary label matched + shown per suggestion.",
21
+ "synonyms": "title, label, productName"
22
+ },
23
+ {
24
+ "name": "searchTerm",
25
+ "type": "string",
26
+ "default": "",
27
+ "intrinsic": true,
28
+ "description": "The current typed query.",
29
+ "synonyms": "query, term, q"
30
+ }
31
+ ]
32
+ },
33
+ "traits": [
34
+ {
35
+ "name": "Autocomplete",
36
+ "entityRebindable": true,
37
+ "entityContract": {
38
+ "requires": [],
39
+ "provides": [
40
+ "searchTerm"
41
+ ]
42
+ },
43
+ "category": "interaction",
44
+ "linkedEntity": "AutoTarget",
45
+ "emits": [
46
+ {
47
+ "event": "AutoLoaded",
48
+ "description": "Suggestion matches loaded",
49
+ "scope": "internal",
50
+ "payloadSchema": [
51
+ {
52
+ "name": "data",
53
+ "type": "[AutoTarget]"
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "event": "AutoFailed",
59
+ "description": "Suggestion fetch failed",
60
+ "scope": "internal",
61
+ "payloadSchema": [
62
+ {
63
+ "name": "error",
64
+ "type": "string"
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "event": "AUTO_SELECTED",
70
+ "description": "A suggestion was picked; carries the chosen record id for the consumer to open or bind.",
71
+ "synonyms": "select, choose, pick",
72
+ "tier": "essential",
73
+ "scope": "external",
74
+ "payloadSchema": [
75
+ {
76
+ "name": "id",
77
+ "type": "string",
78
+ "required": true
79
+ }
80
+ ]
81
+ }
82
+ ],
83
+ "stateMachine": {
84
+ "states": [
85
+ {
86
+ "name": "idle",
87
+ "isInitial": true
88
+ }
89
+ ],
90
+ "events": [
91
+ {
92
+ "key": "INIT",
93
+ "name": "Initialize"
94
+ },
95
+ {
96
+ "key": "AUTO_QUERY",
97
+ "name": "Auto Query",
98
+ "description": "The user typed/submitted a query in the typeahead input.",
99
+ "synonyms": "type, query, search",
100
+ "tier": "essential",
101
+ "payloadSchema": [
102
+ {
103
+ "name": "value",
104
+ "type": "string"
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ "key": "AutoLoaded",
110
+ "name": "Auto loaded",
111
+ "payloadSchema": [
112
+ {
113
+ "name": "data",
114
+ "type": "[AutoTarget]"
115
+ }
116
+ ]
117
+ },
118
+ {
119
+ "key": "AUTO_SELECT",
120
+ "name": "Auto Select",
121
+ "description": "The user clicked a suggestion.",
122
+ "synonyms": "pick, choose, open",
123
+ "tier": "essential",
124
+ "payloadSchema": [
125
+ {
126
+ "name": "id",
127
+ "type": "string",
128
+ "required": true
129
+ }
130
+ ]
131
+ },
132
+ {
133
+ "key": "AutoFailed",
134
+ "name": "Auto failed",
135
+ "payloadSchema": [
136
+ {
137
+ "name": "error",
138
+ "type": "string"
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ "key": "AUTO_SELECTED",
144
+ "name": "Auto Selected",
145
+ "description": "A suggestion was picked; carries the chosen record id for the consumer to open or bind.",
146
+ "synonyms": "select, choose, pick",
147
+ "tier": "essential"
148
+ }
149
+ ],
150
+ "transitions": [
151
+ {
152
+ "from": "idle",
153
+ "to": "idle",
154
+ "event": "INIT",
155
+ "effects": [
156
+ [
157
+ "fetch",
158
+ "AutoTarget",
159
+ {}
160
+ ],
161
+ [
162
+ "render-ui",
163
+ "main",
164
+ {
165
+ "event": "AUTO_QUERY",
166
+ "placeholder": "@config.placeholder",
167
+ "type": "search-input",
168
+ "query": "@entity.searchTerm"
169
+ }
170
+ ]
171
+ ]
172
+ },
173
+ {
174
+ "from": "idle",
175
+ "to": "idle",
176
+ "event": "AUTO_QUERY",
177
+ "effects": [
178
+ [
179
+ "set",
180
+ "@entity.searchTerm",
181
+ "@payload.value"
182
+ ],
183
+ [
184
+ "fetch",
185
+ "AutoTarget",
186
+ {
187
+ "filter": [
188
+ "or",
189
+ [
190
+ "=",
191
+ "@payload.value",
192
+ ""
193
+ ],
194
+ [
195
+ "str/includes",
196
+ [
197
+ "object/get",
198
+ "@entity",
199
+ "@config.searchField"
200
+ ],
201
+ "@payload.value"
202
+ ]
203
+ ],
204
+ "emit": {
205
+ "success": "AutoLoaded",
206
+ "failure": "AutoFailed"
207
+ }
208
+ }
209
+ ],
210
+ [
211
+ "render-ui",
212
+ "main",
213
+ {
214
+ "gap": "xs",
215
+ "direction": "vertical",
216
+ "children": [
217
+ {
218
+ "type": "search-input",
219
+ "event": "AUTO_QUERY",
220
+ "query": "@entity.searchTerm",
221
+ "placeholder": "@config.placeholder"
222
+ },
223
+ {
224
+ "type": "spinner",
225
+ "size": "sm"
226
+ }
227
+ ],
228
+ "type": "stack"
229
+ }
230
+ ]
231
+ ]
232
+ },
233
+ {
234
+ "from": "idle",
235
+ "to": "idle",
236
+ "event": "AutoLoaded",
237
+ "effects": [
238
+ [
239
+ "render-ui",
240
+ "main",
241
+ {
242
+ "children": [
243
+ {
244
+ "event": "AUTO_QUERY",
245
+ "query": "@entity.searchTerm",
246
+ "type": "search-input",
247
+ "placeholder": "@config.placeholder"
248
+ },
249
+ {
250
+ "entity": "@payload.data",
251
+ "fields": "@config.suggestionFields",
252
+ "type": "data-list",
253
+ "itemActions": [
254
+ {
255
+ "variant": "ghost",
256
+ "label": "Open",
257
+ "event": "AUTO_SELECT"
258
+ }
259
+ ]
260
+ }
261
+ ],
262
+ "gap": "xs",
263
+ "direction": "vertical",
264
+ "type": "stack"
265
+ }
266
+ ]
267
+ ]
268
+ },
269
+ {
270
+ "from": "idle",
271
+ "to": "idle",
272
+ "event": "AUTO_SELECT",
273
+ "effects": [
274
+ [
275
+ "emit",
276
+ "AUTO_SELECTED",
277
+ {
278
+ "id": "@payload.id"
279
+ }
280
+ ],
281
+ [
282
+ "render-ui",
283
+ "main",
284
+ {
285
+ "event": "AUTO_QUERY",
286
+ "placeholder": "@config.placeholder",
287
+ "query": "@entity.searchTerm",
288
+ "type": "search-input"
289
+ }
290
+ ]
291
+ ]
292
+ },
293
+ {
294
+ "from": "idle",
295
+ "to": "idle",
296
+ "event": "AutoFailed",
297
+ "effects": [
298
+ [
299
+ "render-ui",
300
+ "main",
301
+ {
302
+ "query": "@entity.searchTerm",
303
+ "type": "search-input",
304
+ "placeholder": "@config.placeholder",
305
+ "event": "AUTO_QUERY"
306
+ }
307
+ ]
308
+ ]
309
+ }
310
+ ]
311
+ },
312
+ "config": {
313
+ "searchField": {
314
+ "type": "string",
315
+ "default": "name",
316
+ "label": "Search field",
317
+ "description": "Entity field matched against the typed query (case-insensitive substring).",
318
+ "tier": "presentation"
319
+ },
320
+ "placeholder": {
321
+ "type": "string",
322
+ "default": "Search…",
323
+ "label": "Placeholder",
324
+ "description": "Hint text in the empty typeahead input.",
325
+ "tier": "presentation"
326
+ },
327
+ "suggestionFields": {
328
+ "type": "[AutoSuggestSpec]",
329
+ "default": [
330
+ {
331
+ "label": "Name",
332
+ "name": "name",
333
+ "variant": "body"
334
+ }
335
+ ],
336
+ "label": "Suggestion fields",
337
+ "description": "Fields shown per suggestion row.",
338
+ "tier": "presentation",
339
+ "items": {
340
+ "type": "object",
341
+ "properties": {
342
+ "label": {
343
+ "name": "label",
344
+ "type": "string",
345
+ "required": false
346
+ },
347
+ "variant": {
348
+ "name": "variant",
349
+ "type": "string",
350
+ "required": false
351
+ },
352
+ "icon": {
353
+ "name": "icon",
354
+ "type": "string",
355
+ "required": false
356
+ },
357
+ "name": {
358
+ "name": "name",
359
+ "type": "string",
360
+ "required": true
361
+ }
362
+ }
363
+ }
364
+ }
365
+ },
366
+ "scope": "collection"
367
+ }
368
+ ],
369
+ "pages": [
370
+ {
371
+ "name": "AutocompletePage",
372
+ "path": "/autocomplete",
373
+ "traits": [
374
+ {
375
+ "ref": "Autocomplete"
376
+ }
377
+ ]
378
+ }
379
+ ]
380
+ }
381
+ ]
382
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "std-notify-on-event",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "std-notify-on-event — cross-orbital wiring atom. Subscribes to events from another orbital (e.g. CheckoutOrbital emits OrderPlaced, OrderRecordOrbital reacts via this atom) and dispatches a notification. Use when one orbital needs to react to or be notified about events that happen in another orbital — the wiring goes through this atom's `EventOccurred` listener which the molecule renames via traitOverrides.events to the upstream event name. Resolves recipient from `recipients` (first entry; multi-recipient fan-out is a future extension) or falls back to `@user.id`. Skips dispatch when the recipient is in `suppressionList`. Emits in-app `notify` when `notifyChannel` is `\"in-app\"`, or persists a `NotificationRecord` row for out-of-band delivery when channel is `\"email\"` or `\"sms\"`.",
5
5
  "orbitals": [
6
6
  {
@@ -103,6 +103,10 @@
103
103
  {
104
104
  "name": "data",
105
105
  "type": "object"
106
+ },
107
+ {
108
+ "name": "status",
109
+ "type": "string"
106
110
  }
107
111
  ]
108
112
  },
@@ -134,6 +138,19 @@
134
138
  "from": "idle",
135
139
  "to": "idle",
136
140
  "event": "EventOccurred",
141
+ "guard": [
142
+ "or",
143
+ [
144
+ "=",
145
+ "@config.triggerStatus",
146
+ ""
147
+ ],
148
+ [
149
+ "=",
150
+ "@payload.status",
151
+ "@config.triggerStatus"
152
+ ]
153
+ ],
137
154
  "effects": [
138
155
  [
139
156
  "set",
@@ -222,12 +239,12 @@
222
239
  "create",
223
240
  "NotificationRecord",
224
241
  {
225
- "dispatched": false,
226
242
  "channel": "@config.notifyChannel",
227
- "recordedAt": 0.0,
228
243
  "recipient": "@entity.recipient",
229
- "message": "@config.template",
230
- "severity": "@config.severity"
244
+ "severity": "@config.severity",
245
+ "recordedAt": 0.0,
246
+ "dispatched": false,
247
+ "message": "@config.template"
231
248
  }
232
249
  ]
233
250
  ]
@@ -236,10 +253,10 @@
236
253
  "emit",
237
254
  "NotificationDispatched",
238
255
  {
256
+ "recipient": "@entity.recipient",
239
257
  "channel": "@config.notifyChannel",
240
258
  "severity": "@config.severity",
241
- "message": "@config.template",
242
- "recipient": "@entity.recipient"
259
+ "message": "@config.template"
243
260
  }
244
261
  ]
245
262
  ]
@@ -247,36 +264,65 @@
247
264
  ]
248
265
  },
249
266
  "config": {
250
- "suppressionList": {
267
+ "triggerStatus": {
268
+ "type": "string",
269
+ "default": "",
270
+ "label": "Trigger status",
271
+ "description": "When set, dispatch only when the upstream event's `status` field equals this value (e.g. fire only when a record becomes 'approved'). Empty = fire on every subscribed event.",
272
+ "synonyms": "on status, when status, status filter, only when, fire on, react on status",
273
+ "tier": "policy"
274
+ },
275
+ "quietHours": {
276
+ "type": "QuietHoursSpec",
277
+ "default": {
278
+ "start": "",
279
+ "end": ""
280
+ },
281
+ "label": "Quiet hours",
282
+ "description": "Local-time window during which dispatch is suppressed. Both start and end required to activate. WIRING DEFERRED: needs @now-aware time comparison primitive (gap — docs/Almadar_Std_Factories.md).",
283
+ "tier": "policy",
284
+ "properties": {
285
+ "start": {
286
+ "name": "start",
287
+ "type": "string",
288
+ "required": false
289
+ },
290
+ "end": {
291
+ "name": "end",
292
+ "type": "string",
293
+ "required": false
294
+ }
295
+ }
296
+ },
297
+ "frequencyCapPerWeek": {
298
+ "type": "number",
299
+ "default": 0.0,
300
+ "label": "Frequency cap (per week)",
301
+ "description": "Max sends per (channel, recipient) per rolling 7-day window. 0 = uncapped. WIRING DEFERRED: needs stateful history query (gap — docs/Almadar_Std_Factories.md).",
302
+ "tier": "policy"
303
+ },
304
+ "recipients": {
251
305
  "type": "[string]",
252
306
  "default": [],
253
- "label": "Suppression list",
254
- "description": "Recipient ids/addresses to skip (e.g. unsubscribed users). Suppression check runs before dispatch.",
255
- "synonyms": "block list, unsubscribed, opt-out list",
307
+ "label": "Recipients",
308
+ "description": "Recipient ids/addresses. v1.1 uses the first entry; multi-recipient fan-out lands in v1.2 (gap). When empty, falls back to the authenticated user.",
309
+ "synonyms": "targets, addressees, notify to",
256
310
  "tier": "policy",
257
311
  "items": {
258
312
  "type": "string"
259
313
  }
260
314
  },
261
- "listensFor": {
315
+ "suppressionList": {
262
316
  "type": "[string]",
263
317
  "default": [],
264
- "label": "Trigger events",
265
- "description": "Event names that should fire a notification. Set this to the upstream event name (e.g. OrderPlaced, CheckoutCompleted) so this atom listens for events from the orbital that emits them. The orbital owning this trait reacts whenever the named event fires anywhere in the schema.",
266
- "synonyms": "subscribe to event, listen for event, react to event, watch for, wire upstream event, observe event from another orbital, cross-orbital subscription, on-event trigger",
267
- "tier": "internal",
318
+ "label": "Suppression list",
319
+ "description": "Recipient ids/addresses to skip (e.g. unsubscribed users). Suppression check runs before dispatch.",
320
+ "synonyms": "block list, unsubscribed, opt-out list",
321
+ "tier": "policy",
268
322
  "items": {
269
323
  "type": "string"
270
324
  }
271
325
  },
272
- "template": {
273
- "type": "string",
274
- "default": "",
275
- "label": "Message template",
276
- "description": "Text shown to the recipient; supports payload interpolation",
277
- "synonyms": "notification text, message body, alert text",
278
- "tier": "presentation"
279
- },
280
326
  "notifyChannel": {
281
327
  "type": "string",
282
328
  "default": "in-app",
@@ -285,46 +331,25 @@
285
331
  "synonyms": "delivery method, notification channel, send via, dispatch through",
286
332
  "tier": "policy"
287
333
  },
288
- "frequencyCapPerWeek": {
289
- "type": "number",
290
- "default": 0.0,
291
- "label": "Frequency cap (per week)",
292
- "description": "Max sends per (channel, recipient) per rolling 7-day window. 0 = uncapped. WIRING DEFERRED: needs stateful history query (gap — docs/Almadar_Std_Factories.md).",
293
- "tier": "policy"
334
+ "template": {
335
+ "type": "string",
336
+ "default": "",
337
+ "label": "Message template",
338
+ "description": "Text shown to the recipient; supports payload interpolation",
339
+ "synonyms": "notification text, message body, alert text",
340
+ "tier": "presentation"
294
341
  },
295
- "recipients": {
342
+ "listensFor": {
296
343
  "type": "[string]",
297
344
  "default": [],
298
- "label": "Recipients",
299
- "description": "Recipient ids/addresses. v1.1 uses the first entry; multi-recipient fan-out lands in v1.2 (gap). When empty, falls back to the authenticated user.",
300
- "synonyms": "targets, addressees, notify to",
301
- "tier": "policy",
345
+ "label": "Trigger events",
346
+ "description": "Event names that should fire a notification. Set this to the upstream event name (e.g. OrderPlaced, CheckoutCompleted) so this atom listens for events from the orbital that emits them. The orbital owning this trait reacts whenever the named event fires anywhere in the schema.",
347
+ "synonyms": "subscribe to event, listen for event, react to event, watch for, wire upstream event, observe event from another orbital, cross-orbital subscription, on-event trigger",
348
+ "tier": "internal",
302
349
  "items": {
303
350
  "type": "string"
304
351
  }
305
352
  },
306
- "quietHours": {
307
- "type": "QuietHoursSpec",
308
- "default": {
309
- "start": "",
310
- "end": ""
311
- },
312
- "label": "Quiet hours",
313
- "description": "Local-time window during which dispatch is suppressed. Both start and end required to activate. WIRING DEFERRED: needs @now-aware time comparison primitive (gap — docs/Almadar_Std_Factories.md).",
314
- "tier": "policy",
315
- "properties": {
316
- "start": {
317
- "name": "start",
318
- "type": "string",
319
- "required": false
320
- },
321
- "end": {
322
- "name": "end",
323
- "type": "string",
324
- "required": false
325
- }
326
- }
327
- },
328
353
  "severity": {
329
354
  "type": "string",
330
355
  "default": "info",