@cynodia/axiom-server 0.14.0-alpha.4 → 0.15.0-alpha.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.
Files changed (60) hide show
  1. package/conformance/authorization/action-allow-deny-anonymous.json +704 -0
  2. package/conformance/authorization/constant-deny-policy.json +685 -0
  3. package/conformance/authorization/live-query-resume.json +715 -0
  4. package/conformance/authorization/manifest.json +93 -0
  5. package/conformance/authorization/operation-scope.json +684 -0
  6. package/conformance/authorization/query-public-preserved.json +684 -0
  7. package/conformance/authorization/query-tenant-isolation.json +714 -0
  8. package/conformance/authorization/workflow-cancellation-owner.json +703 -0
  9. package/conformance/authorization/workflow-cancellation-policy.json +710 -0
  10. package/conformance/authorization/workflow-inspection.json +709 -0
  11. package/conformance/authorization/workflow-start.json +699 -0
  12. package/conformance/live/aggregate-reset.json +1 -1
  13. package/conformance/live/dependency-commit-no-change.json +1 -1
  14. package/conformance/live/f2-state-ref-refused.json +1 -1
  15. package/conformance/live/initial-result.json +1 -1
  16. package/conformance/live/insert-on-filter-entry.json +1 -1
  17. package/conformance/live/limit-boundary.json +1 -1
  18. package/conformance/live/manifest.json +1 -1
  19. package/conformance/live/not-live-capable.json +1 -1
  20. package/conformance/live/provider-only-sequence.json +1 -1
  21. package/conformance/live/provider-record-remove.json +1 -1
  22. package/conformance/live/remove-on-filter-exit.json +1 -1
  23. package/conformance/live/update-with-move.json +1 -1
  24. package/conformance/live/update-without-move.json +1 -1
  25. package/conformance/workflow/manifest.json +1 -1
  26. package/conformance/workflow/workflow-action-on-error.json +1 -1
  27. package/conformance/workflow/workflow-action-retry.json +1 -1
  28. package/conformance/workflow/workflow-action-success.json +1 -1
  29. package/conformance/workflow/workflow-action-terminal-failure.json +1 -1
  30. package/conformance/workflow/workflow-branch-false.json +1 -1
  31. package/conformance/workflow/workflow-branch-true.json +1 -1
  32. package/conformance/workflow/workflow-cancel-waiting.json +1 -1
  33. package/conformance/workflow/workflow-event-match.json +1 -1
  34. package/conformance/workflow/workflow-event-nonmatch.json +1 -1
  35. package/conformance/workflow/workflow-event-timeout.json +1 -1
  36. package/conformance/workflow/workflow-start-complete.json +1 -1
  37. package/conformance/workflow/workflow-start-idempotency.json +1 -1
  38. package/conformance/workflow/workflow-timer.json +1 -1
  39. package/dist/authority-identity.d.ts +7 -7
  40. package/dist/authority-identity.js +8 -7
  41. package/dist/authorization-conformance.d.ts +110 -0
  42. package/dist/authorization-conformance.js +201 -0
  43. package/dist/index.d.ts +1 -0
  44. package/dist/index.js +1 -0
  45. package/dist/live-query.js +4 -1
  46. package/dist/server.d.ts +27 -7
  47. package/dist/server.js +222 -21
  48. package/dist/workflows.d.ts +14 -3
  49. package/dist/workflows.js +94 -6
  50. package/package.json +4 -4
  51. package/schema/protocol.v1.schema.json +1 -1
  52. package/schema/server-ir.v1.schema.json +1 -1
  53. package/schema/server-ir.v2.schema.json +1 -1
  54. package/schema/server-ir.v3.schema.json +1 -1
  55. package/schema/server-ir.v4.schema.json +1 -1
  56. package/schema/server-ir.v5.schema.json +1 -1
  57. package/schema/server-ir.v6.schema.json +1 -1
  58. package/schema/server-ir.v7.schema.json +1 -1
  59. package/schema/server-ir.v8.schema.json +1 -1
  60. package/schema/server-ir.v9.schema.json +2899 -0
@@ -0,0 +1,704 @@
1
+ {
2
+ "conformance": "axiom.conformance.v9",
3
+ "name": "action-allow-deny-anonymous",
4
+ "covers": [
5
+ "allow",
6
+ "deny",
7
+ "anonymous",
8
+ "role/claim condition",
9
+ "action invocation"
10
+ ],
11
+ "description": "A role policy on action.invoke: the authorized role is allowed, another role and an anonymous caller are denied AUTHORIZATION_DENIED with no mutation.",
12
+ "providerRows": {
13
+ "entity_doc": [
14
+ {
15
+ "field_doc_id": "a",
16
+ "field_doc_tenant": "t1"
17
+ },
18
+ {
19
+ "field_doc_id": "b",
20
+ "field_doc_tenant": "t2"
21
+ },
22
+ {
23
+ "field_doc_id": "c",
24
+ "field_doc_tenant": "t1"
25
+ }
26
+ ],
27
+ "entity_note": [
28
+ {
29
+ "field_note_id": "n1"
30
+ },
31
+ {
32
+ "field_note_id": "n2"
33
+ }
34
+ ]
35
+ },
36
+ "principals": {
37
+ "admin": {
38
+ "field_user_id": "u-admin",
39
+ "field_user_role": "admin",
40
+ "field_user_tenant": "t1"
41
+ },
42
+ "analyst": {
43
+ "field_user_id": "u-an1",
44
+ "field_user_role": "analyst",
45
+ "field_user_tenant": "t1"
46
+ },
47
+ "analyst2": {
48
+ "field_user_id": "u-an2",
49
+ "field_user_role": "analyst",
50
+ "field_user_tenant": "t2"
51
+ },
52
+ "manager": {
53
+ "field_user_id": "u-mgr",
54
+ "field_user_role": "manager",
55
+ "field_user_tenant": "t1"
56
+ },
57
+ "nobody": {
58
+ "field_user_id": "u-nob",
59
+ "field_user_role": "viewer",
60
+ "field_user_tenant": "t1"
61
+ }
62
+ },
63
+ "steps": [
64
+ {
65
+ "do": "invoke",
66
+ "action": "action_admin",
67
+ "credential": "admin",
68
+ "expect": {
69
+ "decision": "ALLOW"
70
+ }
71
+ },
72
+ {
73
+ "do": "invoke",
74
+ "action": "action_admin",
75
+ "credential": "nobody",
76
+ "expect": {
77
+ "decision": "DENY",
78
+ "reason": "policy-denied"
79
+ }
80
+ },
81
+ {
82
+ "do": "invoke",
83
+ "action": "action_admin",
84
+ "expect": {
85
+ "decision": "DENY",
86
+ "reason": "policy-denied"
87
+ }
88
+ }
89
+ ],
90
+ "expectFinalState": {
91
+ "state_count": 1
92
+ },
93
+ "serverIR": {
94
+ "contract": "axiom.server.v9",
95
+ "id": "authz-conformance",
96
+ "name": "Authorization Conformance",
97
+ "version": "0.15.0-alpha.1",
98
+ "entities": [
99
+ {
100
+ "id": "entity_user",
101
+ "kind": "entity",
102
+ "identityFieldId": "field_user_id",
103
+ "fields": [
104
+ {
105
+ "id": "field_user_id",
106
+ "valueType": {
107
+ "kind": "primitive",
108
+ "primitive": "string"
109
+ },
110
+ "required": true
111
+ },
112
+ {
113
+ "id": "field_user_role",
114
+ "valueType": {
115
+ "kind": "primitive",
116
+ "primitive": "string"
117
+ },
118
+ "required": true
119
+ },
120
+ {
121
+ "id": "field_user_tenant",
122
+ "valueType": {
123
+ "kind": "primitive",
124
+ "primitive": "string"
125
+ },
126
+ "required": true
127
+ }
128
+ ]
129
+ },
130
+ {
131
+ "id": "entity_doc",
132
+ "kind": "entity",
133
+ "identityFieldId": "field_doc_id",
134
+ "fields": [
135
+ {
136
+ "id": "field_doc_id",
137
+ "valueType": {
138
+ "kind": "primitive",
139
+ "primitive": "string"
140
+ },
141
+ "required": true
142
+ },
143
+ {
144
+ "id": "field_doc_tenant",
145
+ "valueType": {
146
+ "kind": "primitive",
147
+ "primitive": "string"
148
+ },
149
+ "required": true
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ "id": "entity_note",
155
+ "kind": "entity",
156
+ "identityFieldId": "field_note_id",
157
+ "fields": [
158
+ {
159
+ "id": "field_note_id",
160
+ "valueType": {
161
+ "kind": "primitive",
162
+ "primitive": "string"
163
+ },
164
+ "required": true
165
+ }
166
+ ]
167
+ },
168
+ {
169
+ "id": "entity_ev",
170
+ "kind": "entity",
171
+ "fields": [
172
+ {
173
+ "id": "field_ev_tag",
174
+ "valueType": {
175
+ "kind": "primitive",
176
+ "primitive": "string"
177
+ },
178
+ "required": true
179
+ }
180
+ ]
181
+ }
182
+ ],
183
+ "fields": {
184
+ "field_user_id": {
185
+ "entityId": "entity_user",
186
+ "field": {
187
+ "id": "field_user_id",
188
+ "valueType": {
189
+ "kind": "primitive",
190
+ "primitive": "string"
191
+ },
192
+ "required": true
193
+ }
194
+ },
195
+ "field_user_role": {
196
+ "entityId": "entity_user",
197
+ "field": {
198
+ "id": "field_user_role",
199
+ "valueType": {
200
+ "kind": "primitive",
201
+ "primitive": "string"
202
+ },
203
+ "required": true
204
+ }
205
+ },
206
+ "field_user_tenant": {
207
+ "entityId": "entity_user",
208
+ "field": {
209
+ "id": "field_user_tenant",
210
+ "valueType": {
211
+ "kind": "primitive",
212
+ "primitive": "string"
213
+ },
214
+ "required": true
215
+ }
216
+ },
217
+ "field_doc_id": {
218
+ "entityId": "entity_doc",
219
+ "field": {
220
+ "id": "field_doc_id",
221
+ "valueType": {
222
+ "kind": "primitive",
223
+ "primitive": "string"
224
+ },
225
+ "required": true
226
+ }
227
+ },
228
+ "field_doc_tenant": {
229
+ "entityId": "entity_doc",
230
+ "field": {
231
+ "id": "field_doc_tenant",
232
+ "valueType": {
233
+ "kind": "primitive",
234
+ "primitive": "string"
235
+ },
236
+ "required": true
237
+ }
238
+ },
239
+ "field_note_id": {
240
+ "entityId": "entity_note",
241
+ "field": {
242
+ "id": "field_note_id",
243
+ "valueType": {
244
+ "kind": "primitive",
245
+ "primitive": "string"
246
+ },
247
+ "required": true
248
+ }
249
+ },
250
+ "field_ev_tag": {
251
+ "entityId": "entity_ev",
252
+ "field": {
253
+ "id": "field_ev_tag",
254
+ "valueType": {
255
+ "kind": "primitive",
256
+ "primitive": "string"
257
+ },
258
+ "required": true
259
+ }
260
+ }
261
+ },
262
+ "states": [
263
+ {
264
+ "id": "state_count",
265
+ "kind": "state",
266
+ "authority": "server",
267
+ "valueType": {
268
+ "kind": "primitive",
269
+ "primitive": "number"
270
+ },
271
+ "initialValue": 0
272
+ }
273
+ ],
274
+ "actions": {
275
+ "action_public": {
276
+ "id": "action_public",
277
+ "kind": "action",
278
+ "operations": [
279
+ {
280
+ "kind": "set",
281
+ "target": {
282
+ "kind": "state",
283
+ "stateId": "state_count"
284
+ },
285
+ "value": {
286
+ "kind": "binary",
287
+ "operator": "add",
288
+ "left": {
289
+ "kind": "ref",
290
+ "targetId": "state_count"
291
+ },
292
+ "right": {
293
+ "kind": "literal",
294
+ "value": 1
295
+ }
296
+ }
297
+ }
298
+ ],
299
+ "preconditions": [],
300
+ "failureModes": []
301
+ },
302
+ "action_admin": {
303
+ "id": "action_admin",
304
+ "kind": "action",
305
+ "authorizationPolicy": "policy_admin",
306
+ "operations": [
307
+ {
308
+ "kind": "set",
309
+ "target": {
310
+ "kind": "state",
311
+ "stateId": "state_count"
312
+ },
313
+ "value": {
314
+ "kind": "binary",
315
+ "operator": "add",
316
+ "left": {
317
+ "kind": "ref",
318
+ "targetId": "state_count"
319
+ },
320
+ "right": {
321
+ "kind": "literal",
322
+ "value": 1
323
+ }
324
+ }
325
+ }
326
+ ],
327
+ "preconditions": [],
328
+ "failureModes": []
329
+ },
330
+ "action_op": {
331
+ "id": "action_op",
332
+ "kind": "action",
333
+ "authorizationPolicy": "policy_op",
334
+ "operations": [
335
+ {
336
+ "kind": "set",
337
+ "target": {
338
+ "kind": "state",
339
+ "stateId": "state_count"
340
+ },
341
+ "value": {
342
+ "kind": "binary",
343
+ "operator": "add",
344
+ "left": {
345
+ "kind": "ref",
346
+ "targetId": "state_count"
347
+ },
348
+ "right": {
349
+ "kind": "literal",
350
+ "value": 1
351
+ }
352
+ }
353
+ }
354
+ ],
355
+ "preconditions": [],
356
+ "failureModes": []
357
+ },
358
+ "action_deny": {
359
+ "id": "action_deny",
360
+ "kind": "action",
361
+ "authorizationPolicy": "policy_deny",
362
+ "operations": [
363
+ {
364
+ "kind": "set",
365
+ "target": {
366
+ "kind": "state",
367
+ "stateId": "state_count"
368
+ },
369
+ "value": {
370
+ "kind": "binary",
371
+ "operator": "add",
372
+ "left": {
373
+ "kind": "ref",
374
+ "targetId": "state_count"
375
+ },
376
+ "right": {
377
+ "kind": "literal",
378
+ "value": 1
379
+ }
380
+ }
381
+ }
382
+ ],
383
+ "preconditions": [],
384
+ "failureModes": []
385
+ },
386
+ "action_step": {
387
+ "id": "action_step",
388
+ "kind": "action",
389
+ "invocation": {
390
+ "allowedSources": [
391
+ "system"
392
+ ]
393
+ },
394
+ "operations": [
395
+ {
396
+ "kind": "set",
397
+ "target": {
398
+ "kind": "state",
399
+ "stateId": "state_count"
400
+ },
401
+ "value": {
402
+ "kind": "binary",
403
+ "operator": "add",
404
+ "left": {
405
+ "kind": "ref",
406
+ "targetId": "state_count"
407
+ },
408
+ "right": {
409
+ "kind": "literal",
410
+ "value": 1
411
+ }
412
+ }
413
+ }
414
+ ],
415
+ "preconditions": [],
416
+ "failureModes": []
417
+ }
418
+ },
419
+ "constraints": [],
420
+ "transitionConstraints": [],
421
+ "principalEntityId": "entity_user",
422
+ "observableStateIds": [
423
+ "state_count"
424
+ ],
425
+ "events": [
426
+ {
427
+ "id": "event_go",
428
+ "kind": "event",
429
+ "payloadType": {
430
+ "kind": "entity",
431
+ "entityId": "entity_ev"
432
+ }
433
+ }
434
+ ],
435
+ "queries": [
436
+ {
437
+ "id": "query_docs",
438
+ "kind": "query",
439
+ "source": "entity_doc",
440
+ "rowScopeId": "scope_row",
441
+ "authorizationPolicy": "policy_analyst",
442
+ "readPolicyId": "readpolicy_tenant",
443
+ "sort": [
444
+ {
445
+ "key": {
446
+ "kind": "field",
447
+ "source": {
448
+ "kind": "ref",
449
+ "targetId": "scope_row"
450
+ },
451
+ "fieldId": "field_doc_id"
452
+ },
453
+ "direction": "asc"
454
+ }
455
+ ],
456
+ "pagination": {
457
+ "strategy": "offset",
458
+ "maxPageSize": 100
459
+ }
460
+ },
461
+ {
462
+ "id": "query_notes",
463
+ "kind": "query",
464
+ "source": "entity_note",
465
+ "rowScopeId": "scope_row",
466
+ "sort": [
467
+ {
468
+ "key": {
469
+ "kind": "field",
470
+ "source": {
471
+ "kind": "ref",
472
+ "targetId": "scope_row"
473
+ },
474
+ "fieldId": "field_note_id"
475
+ },
476
+ "direction": "asc"
477
+ }
478
+ ],
479
+ "pagination": {
480
+ "strategy": "offset",
481
+ "maxPageSize": 100
482
+ }
483
+ }
484
+ ],
485
+ "readPolicies": [
486
+ {
487
+ "id": "readpolicy_tenant",
488
+ "kind": "read-policy",
489
+ "entityId": "entity_doc",
490
+ "rowScopeId": "scope_policy_row",
491
+ "predicate": {
492
+ "kind": "binary",
493
+ "operator": "eq",
494
+ "left": {
495
+ "kind": "field",
496
+ "source": {
497
+ "kind": "ref",
498
+ "targetId": "scope_policy_row"
499
+ },
500
+ "fieldId": "field_doc_tenant"
501
+ },
502
+ "right": {
503
+ "kind": "field",
504
+ "source": {
505
+ "kind": "ref",
506
+ "targetId": "axiom_principal"
507
+ },
508
+ "fieldId": "field_user_tenant"
509
+ }
510
+ }
511
+ }
512
+ ],
513
+ "authorizationPolicies": [
514
+ {
515
+ "id": "policy_admin",
516
+ "kind": "authorization-policy",
517
+ "allow": {
518
+ "kind": "binary",
519
+ "operator": "eq",
520
+ "left": {
521
+ "kind": "field",
522
+ "source": {
523
+ "kind": "ref",
524
+ "targetId": "axiom_principal"
525
+ },
526
+ "fieldId": "field_user_role"
527
+ },
528
+ "right": {
529
+ "kind": "literal",
530
+ "value": "admin"
531
+ }
532
+ }
533
+ },
534
+ {
535
+ "id": "policy_analyst",
536
+ "kind": "authorization-policy",
537
+ "allow": {
538
+ "kind": "binary",
539
+ "operator": "eq",
540
+ "left": {
541
+ "kind": "field",
542
+ "source": {
543
+ "kind": "ref",
544
+ "targetId": "axiom_principal"
545
+ },
546
+ "fieldId": "field_user_role"
547
+ },
548
+ "right": {
549
+ "kind": "literal",
550
+ "value": "analyst"
551
+ }
552
+ }
553
+ },
554
+ {
555
+ "id": "policy_manager",
556
+ "kind": "authorization-policy",
557
+ "allow": {
558
+ "kind": "binary",
559
+ "operator": "eq",
560
+ "left": {
561
+ "kind": "field",
562
+ "source": {
563
+ "kind": "ref",
564
+ "targetId": "axiom_principal"
565
+ },
566
+ "fieldId": "field_user_role"
567
+ },
568
+ "right": {
569
+ "kind": "literal",
570
+ "value": "manager"
571
+ }
572
+ }
573
+ },
574
+ {
575
+ "id": "policy_op",
576
+ "kind": "authorization-policy",
577
+ "allow": {
578
+ "kind": "binary",
579
+ "operator": "eq",
580
+ "left": {
581
+ "kind": "ref",
582
+ "targetId": "axiom_operation"
583
+ },
584
+ "right": {
585
+ "kind": "literal",
586
+ "value": "action.invoke"
587
+ }
588
+ }
589
+ },
590
+ {
591
+ "id": "policy_deny",
592
+ "kind": "authorization-policy",
593
+ "allow": {
594
+ "kind": "literal",
595
+ "value": false
596
+ }
597
+ }
598
+ ],
599
+ "workflows": [
600
+ {
601
+ "id": "wf_guarded",
602
+ "kind": "workflow",
603
+ "startPolicy": "policy_admin",
604
+ "instanceAccessPolicy": "policy_manager",
605
+ "inputs": [
606
+ {
607
+ "id": "input_tag",
608
+ "valueType": {
609
+ "kind": "primitive",
610
+ "primitive": "string"
611
+ },
612
+ "required": true
613
+ }
614
+ ],
615
+ "entry": "g_wait",
616
+ "steps": [
617
+ {
618
+ "type": "wait-event",
619
+ "id": "g_wait",
620
+ "event": "event_go",
621
+ "where": {
622
+ "kind": "binary",
623
+ "operator": "eq",
624
+ "left": {
625
+ "kind": "field",
626
+ "source": {
627
+ "kind": "ref",
628
+ "targetId": "EVENT"
629
+ },
630
+ "fieldId": "field_ev_tag"
631
+ },
632
+ "right": {
633
+ "kind": "ref",
634
+ "targetId": "input_tag"
635
+ }
636
+ },
637
+ "next": "g_do"
638
+ },
639
+ {
640
+ "type": "action",
641
+ "id": "g_do",
642
+ "action": "action_step",
643
+ "arguments": {},
644
+ "next": "g_ok"
645
+ },
646
+ {
647
+ "type": "complete",
648
+ "id": "g_ok"
649
+ }
650
+ ]
651
+ },
652
+ {
653
+ "id": "wf_open",
654
+ "kind": "workflow",
655
+ "inputs": [
656
+ {
657
+ "id": "input_tag",
658
+ "valueType": {
659
+ "kind": "primitive",
660
+ "primitive": "string"
661
+ },
662
+ "required": true
663
+ }
664
+ ],
665
+ "entry": "o_wait",
666
+ "steps": [
667
+ {
668
+ "type": "wait-event",
669
+ "id": "o_wait",
670
+ "event": "event_go",
671
+ "where": {
672
+ "kind": "binary",
673
+ "operator": "eq",
674
+ "left": {
675
+ "kind": "field",
676
+ "source": {
677
+ "kind": "ref",
678
+ "targetId": "EVENT"
679
+ },
680
+ "fieldId": "field_ev_tag"
681
+ },
682
+ "right": {
683
+ "kind": "ref",
684
+ "targetId": "input_tag"
685
+ }
686
+ },
687
+ "next": "o_do"
688
+ },
689
+ {
690
+ "type": "action",
691
+ "id": "o_do",
692
+ "action": "action_step",
693
+ "arguments": {},
694
+ "next": "o_ok"
695
+ },
696
+ {
697
+ "type": "complete",
698
+ "id": "o_ok"
699
+ }
700
+ ]
701
+ }
702
+ ]
703
+ }
704
+ }