synapse 2.195.1__py311-none-any.whl → 2.197.0__py311-none-any.whl
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.
Potentially problematic release.
This version of synapse might be problematic. Click here for more details.
- synapse/axon.py +72 -5
- synapse/common.py +23 -0
- synapse/cortex.py +13 -8
- synapse/cryotank.py +2 -2
- synapse/daemon.py +1 -0
- synapse/lib/aha.py +159 -4
- synapse/lib/cell.py +133 -8
- synapse/lib/config.py +3 -3
- synapse/lib/jsonstor.py +2 -1
- synapse/lib/modelrev.py +5 -1
- synapse/lib/multislabseqn.py +2 -2
- synapse/lib/nexus.py +4 -1
- synapse/lib/reflect.py +4 -5
- synapse/lib/schemas.py +478 -1
- synapse/lib/snap.py +14 -7
- synapse/lib/storm.py +12 -394
- synapse/lib/stormlib/aha.py +351 -1
- synapse/lib/stormlib/graph.py +0 -61
- synapse/lib/stormlib/index.py +52 -0
- synapse/lib/stormlib/utils.py +37 -0
- synapse/lib/stormtypes.py +121 -1
- synapse/lib/task.py +13 -2
- synapse/lib/urlhelp.py +1 -1
- synapse/lib/version.py +2 -2
- synapse/models/base.py +3 -0
- synapse/models/doc.py +62 -0
- synapse/models/infotech.py +55 -16
- synapse/models/orgs.py +20 -14
- synapse/models/risk.py +23 -10
- synapse/models/transport.py +8 -3
- synapse/telepath.py +12 -0
- synapse/tests/test_axon.py +23 -0
- synapse/tests/test_common.py +28 -0
- synapse/tests/test_datamodel.py +15 -0
- synapse/tests/test_lib_aha.py +201 -0
- synapse/tests/test_lib_boss.py +15 -6
- synapse/tests/test_lib_cell.py +104 -0
- synapse/tests/test_lib_jsonstor.py +1 -0
- synapse/tests/test_lib_modelrev.py +6 -0
- synapse/tests/test_lib_stormlib_aha.py +188 -0
- synapse/tests/test_lib_stormlib_index.py +39 -0
- synapse/tests/test_lib_stormlib_utils.py +14 -0
- synapse/tests/test_lib_stormtypes.py +90 -3
- synapse/tests/test_lib_task.py +31 -13
- synapse/tests/test_model_base.py +2 -0
- synapse/tests/test_model_doc.py +38 -0
- synapse/tests/test_model_infotech.py +28 -1
- synapse/tests/test_model_orgs.py +9 -0
- synapse/tests/test_model_risk.py +2 -0
- synapse/tests/test_model_transport.py +1 -0
- synapse/tests/test_telepath.py +26 -0
- synapse/tests/test_tools_aha.py +192 -0
- synapse/tools/aha/mirror.py +193 -0
- synapse/tools/changelog.py +32 -27
- synapse/tools/genpkg.py +2 -2
- {synapse-2.195.1.dist-info → synapse-2.197.0.dist-info}/METADATA +1 -1
- {synapse-2.195.1.dist-info → synapse-2.197.0.dist-info}/RECORD +60 -55
- {synapse-2.195.1.dist-info → synapse-2.197.0.dist-info}/LICENSE +0 -0
- {synapse-2.195.1.dist-info → synapse-2.197.0.dist-info}/WHEEL +0 -0
- {synapse-2.195.1.dist-info → synapse-2.197.0.dist-info}/top_level.txt +0 -0
synapse/lib/modelrev.py
CHANGED
|
@@ -13,7 +13,7 @@ import synapse.models.infotech as s_infotech
|
|
|
13
13
|
|
|
14
14
|
logger = logging.getLogger(__name__)
|
|
15
15
|
|
|
16
|
-
maxvers = (0, 2,
|
|
16
|
+
maxvers = (0, 2, 33)
|
|
17
17
|
|
|
18
18
|
class ModelRev:
|
|
19
19
|
|
|
@@ -51,6 +51,7 @@ class ModelRev:
|
|
|
51
51
|
((0, 2, 30), self.revModel_0_2_30),
|
|
52
52
|
((0, 2, 31), self.revModel_0_2_31),
|
|
53
53
|
((0, 2, 32), self.revModel_0_2_32),
|
|
54
|
+
((0, 2, 33), self.revModel_0_2_33),
|
|
54
55
|
)
|
|
55
56
|
|
|
56
57
|
async def _uniqSortArray(self, todoprops, layers):
|
|
@@ -820,6 +821,9 @@ class ModelRev:
|
|
|
820
821
|
await self._normPropValu(layers, 'transport:air:craft:model')
|
|
821
822
|
await self._normPropValu(layers, 'transport:sea:vessel:model')
|
|
822
823
|
|
|
824
|
+
async def revModel_0_2_33(self, layers):
|
|
825
|
+
await self._propToForm(layers, 'transport:sea:vessel:name', 'entity:name')
|
|
826
|
+
|
|
823
827
|
async def runStorm(self, text, opts=None):
|
|
824
828
|
'''
|
|
825
829
|
Run storm code in a schedcoro and log the output messages.
|
synapse/lib/multislabseqn.py
CHANGED
|
@@ -150,7 +150,7 @@ class MultiSlabSeqn(s_base.Base):
|
|
|
150
150
|
firstidx = firstitem[0] # might not match the separately stored first index due to culling
|
|
151
151
|
|
|
152
152
|
if firstidx < fnstartidx:
|
|
153
|
-
raise s_exc.BadCoreStore('Multislab: filename inconsistent with contents')
|
|
153
|
+
raise s_exc.BadCoreStore(mesg='Multislab: filename inconsistent with contents')
|
|
154
154
|
|
|
155
155
|
lastidx = seqn.index() - 1
|
|
156
156
|
|
|
@@ -161,7 +161,7 @@ class MultiSlabSeqn(s_base.Base):
|
|
|
161
161
|
self.firstindx = lowindx
|
|
162
162
|
|
|
163
163
|
if self.firstindx > self.indx:
|
|
164
|
-
raise s_exc.BadCoreStore('Invalid firstindx value')
|
|
164
|
+
raise s_exc.BadCoreStore(mesg='Invalid firstindx value')
|
|
165
165
|
|
|
166
166
|
await self._initTailSlab(fnstartidx)
|
|
167
167
|
|
synapse/lib/nexus.py
CHANGED
|
@@ -413,7 +413,7 @@ class NexsRoot(s_base.Base):
|
|
|
413
413
|
|
|
414
414
|
return await func(nexus, *args, **kwargs)
|
|
415
415
|
|
|
416
|
-
async def iter(self, offs: int, tellready=False) -> AsyncIterator[Any]:
|
|
416
|
+
async def iter(self, offs: int, tellready=False, wait=True) -> AsyncIterator[Any]:
|
|
417
417
|
'''
|
|
418
418
|
Returns an iterator of change entries in the log
|
|
419
419
|
'''
|
|
@@ -434,6 +434,9 @@ class NexsRoot(s_base.Base):
|
|
|
434
434
|
if tellready:
|
|
435
435
|
yield None
|
|
436
436
|
|
|
437
|
+
if not wait:
|
|
438
|
+
return
|
|
439
|
+
|
|
437
440
|
async with self.getChangeDist(maxoffs) as dist:
|
|
438
441
|
async for item in dist:
|
|
439
442
|
if self.isfini:
|
synapse/lib/reflect.py
CHANGED
|
@@ -87,17 +87,16 @@ def getShareInfo(item):
|
|
|
87
87
|
if not callable(attr):
|
|
88
88
|
continue
|
|
89
89
|
|
|
90
|
+
meths[name] = meth = {}
|
|
91
|
+
|
|
90
92
|
# We know we can cleanly unwrap these functions
|
|
91
93
|
# for asyncgenerator inspection.
|
|
92
94
|
wrapped = getattr(attr, '__syn_wrapped__', None)
|
|
93
95
|
if wrapped in unwraps:
|
|
94
|
-
|
|
95
|
-
if inspect.isasyncgenfunction(real):
|
|
96
|
-
meths[name] = {'genr': True}
|
|
97
|
-
continue
|
|
96
|
+
attr = inspect.unwrap(attr)
|
|
98
97
|
|
|
99
98
|
if inspect.isasyncgenfunction(attr):
|
|
100
|
-
|
|
99
|
+
meth['genr'] = True
|
|
101
100
|
|
|
102
101
|
try:
|
|
103
102
|
setattr(item, key, info)
|
synapse/lib/schemas.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import synapse.lib.const as s_const
|
|
2
2
|
import synapse.lib.config as s_config
|
|
3
|
+
import synapse.lib.grammar as s_grammar
|
|
3
4
|
import synapse.lib.msgpack as s_msgpack
|
|
4
|
-
|
|
5
|
+
import synapse.lib.version as s_version
|
|
5
6
|
|
|
6
7
|
easyPermSchema = {
|
|
7
8
|
'type': 'object',
|
|
@@ -551,3 +552,479 @@ stixIngestBundleSchema = {
|
|
|
551
552
|
},
|
|
552
553
|
}
|
|
553
554
|
reqValidStixIngestBundle = s_config.getJsValidator(stixIngestBundleSchema)
|
|
555
|
+
|
|
556
|
+
_reqValidGdefSchema = {
|
|
557
|
+
'type': 'object',
|
|
558
|
+
'properties': {
|
|
559
|
+
'iden': {'type': 'string', 'pattern': s_config.re_iden},
|
|
560
|
+
'name': {'type': 'string', 'minLength': 1},
|
|
561
|
+
'desc': {'type': 'string', 'default': ''},
|
|
562
|
+
'scope': {'type': 'string', 'enum': ['user', 'power-up']},
|
|
563
|
+
'creator': {'type': 'string', 'pattern': s_config.re_iden},
|
|
564
|
+
'power-up': {'type': 'string', 'minLength': 1},
|
|
565
|
+
'maxsize': {'type': 'number', 'minimum': 0},
|
|
566
|
+
'existing': {'type': 'array', 'items': {'type': 'string'}},
|
|
567
|
+
'created': {'type': 'number'},
|
|
568
|
+
'updated': {'type': 'number'},
|
|
569
|
+
'refs': {'type': 'boolean', 'default': False},
|
|
570
|
+
'edges': {'type': 'boolean', 'default': True},
|
|
571
|
+
'edgelimit': {'type': 'number', 'default': 3000},
|
|
572
|
+
'degrees': {'type': ['integer', 'null'], 'minimum': 0},
|
|
573
|
+
'filterinput': {'type': 'boolean', 'default': True},
|
|
574
|
+
'yieldfiltered': {'type': 'boolean', 'default': False},
|
|
575
|
+
'filters': {
|
|
576
|
+
'type': ['array', 'null'],
|
|
577
|
+
'items': {'type': 'string'}
|
|
578
|
+
},
|
|
579
|
+
'pivots': {
|
|
580
|
+
'type': ['array', 'null'],
|
|
581
|
+
'items': {'type': 'string'}
|
|
582
|
+
},
|
|
583
|
+
'forms': {
|
|
584
|
+
'type': 'object',
|
|
585
|
+
'patternProperties': {
|
|
586
|
+
'^.*$': {
|
|
587
|
+
'type': 'object',
|
|
588
|
+
'properties': {
|
|
589
|
+
'filters': {
|
|
590
|
+
'type': ['array', 'null'],
|
|
591
|
+
'items': {'type': 'string'}
|
|
592
|
+
},
|
|
593
|
+
'pivots': {
|
|
594
|
+
'type': ['array', 'null'],
|
|
595
|
+
'items': {'type': 'string'}
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
'additionalProperties': False,
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
'permissions': s_msgpack.deepcopy(easyPermSchema)
|
|
603
|
+
},
|
|
604
|
+
'additionalProperties': False,
|
|
605
|
+
'required': ['iden', 'name', 'scope'],
|
|
606
|
+
'allOf': [
|
|
607
|
+
{
|
|
608
|
+
'if': {'properties': {'scope': {'const': 'power-up'}}},
|
|
609
|
+
'then': {'required': ['power-up']},
|
|
610
|
+
'else': {'required': ['creator']},
|
|
611
|
+
}
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
reqValidGdef = s_config.getJsValidator(_reqValidGdefSchema)
|
|
615
|
+
|
|
616
|
+
_reqValidPermDefSchema = {
|
|
617
|
+
'type': 'object',
|
|
618
|
+
'properties': {
|
|
619
|
+
'perm': {'type': 'array', 'items': {'type': 'string'}},
|
|
620
|
+
'desc': {'type': 'string'},
|
|
621
|
+
'gate': {'type': 'string'},
|
|
622
|
+
'ex': {'type': 'string'}, # Example string
|
|
623
|
+
'workflowconfig': {'type': 'boolean'},
|
|
624
|
+
'default': {'type': 'boolean', 'default': False},
|
|
625
|
+
},
|
|
626
|
+
'required': ['perm', 'desc', 'gate'],
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
reqValidPermDef = s_config.getJsValidator(_reqValidPermDefSchema)
|
|
630
|
+
|
|
631
|
+
# N.B. This is kept in sync with s_datamodel.Datamodel().types
|
|
632
|
+
# with the DatamodelTest.test_datamodel_schema_basetypes test.
|
|
633
|
+
datamodel_basetypes = [
|
|
634
|
+
'int',
|
|
635
|
+
'float',
|
|
636
|
+
'range',
|
|
637
|
+
'str',
|
|
638
|
+
'hex',
|
|
639
|
+
'bool',
|
|
640
|
+
'time',
|
|
641
|
+
'duration',
|
|
642
|
+
'ival',
|
|
643
|
+
'guid',
|
|
644
|
+
'syn:tag:part',
|
|
645
|
+
'syn:tag',
|
|
646
|
+
'comp',
|
|
647
|
+
'loc',
|
|
648
|
+
'ndef',
|
|
649
|
+
'array',
|
|
650
|
+
'edge',
|
|
651
|
+
'timeedge',
|
|
652
|
+
'data',
|
|
653
|
+
'nodeprop',
|
|
654
|
+
'hugenum',
|
|
655
|
+
'taxon',
|
|
656
|
+
'taxonomy',
|
|
657
|
+
'velocity',
|
|
658
|
+
]
|
|
659
|
+
|
|
660
|
+
_reqValidPkgdefSchema = {
|
|
661
|
+
'type': 'object',
|
|
662
|
+
'properties': {
|
|
663
|
+
'name': {'type': 'string'},
|
|
664
|
+
'version': {
|
|
665
|
+
'type': 'string',
|
|
666
|
+
'pattern': s_version.semverstr,
|
|
667
|
+
},
|
|
668
|
+
'build': {
|
|
669
|
+
'type' 'object'
|
|
670
|
+
'properties': {
|
|
671
|
+
'time': {'type': 'number'},
|
|
672
|
+
},
|
|
673
|
+
'required': ['time'],
|
|
674
|
+
},
|
|
675
|
+
'codesign': {
|
|
676
|
+
'type': 'object',
|
|
677
|
+
'properties': {
|
|
678
|
+
'sign': {'type': 'string'},
|
|
679
|
+
'cert': {'type': 'string'},
|
|
680
|
+
},
|
|
681
|
+
'required': ['cert', 'sign'],
|
|
682
|
+
},
|
|
683
|
+
# TODO: Remove me after Synapse 3.0.0.
|
|
684
|
+
'synapse_minversion': {
|
|
685
|
+
'type': ['array', 'null'],
|
|
686
|
+
'items': {'type': 'number'}
|
|
687
|
+
},
|
|
688
|
+
'synapse_version': {
|
|
689
|
+
'type': 'string',
|
|
690
|
+
},
|
|
691
|
+
'modules': {
|
|
692
|
+
'type': ['array', 'null'],
|
|
693
|
+
'items': {'$ref': '#/definitions/module'}
|
|
694
|
+
},
|
|
695
|
+
'docs': {
|
|
696
|
+
'type': ['array', 'null'],
|
|
697
|
+
'items': {'$ref': '#/definitions/doc'},
|
|
698
|
+
},
|
|
699
|
+
'logo': {
|
|
700
|
+
'type': 'object',
|
|
701
|
+
'properties': {
|
|
702
|
+
'mime': {'type': 'string'},
|
|
703
|
+
'file': {'type': 'string'},
|
|
704
|
+
},
|
|
705
|
+
'additionalProperties': True,
|
|
706
|
+
'required': ['mime', 'file'],
|
|
707
|
+
},
|
|
708
|
+
'commands': {
|
|
709
|
+
'type': ['array', 'null'],
|
|
710
|
+
'items': {'$ref': '#/definitions/command'},
|
|
711
|
+
},
|
|
712
|
+
'graphs': {
|
|
713
|
+
'type': ['array', 'null'],
|
|
714
|
+
'items': s_msgpack.deepcopy(_reqValidGdefSchema, use_list=True),
|
|
715
|
+
},
|
|
716
|
+
'desc': {'type': 'string'},
|
|
717
|
+
'svciden': {'type': ['string', 'null'], 'pattern': s_config.re_iden},
|
|
718
|
+
'onload': {'type': 'string'},
|
|
719
|
+
'author': {
|
|
720
|
+
'type': 'object',
|
|
721
|
+
'properties': {
|
|
722
|
+
'url': {'type': 'string'},
|
|
723
|
+
'name': {'type': 'string'},
|
|
724
|
+
},
|
|
725
|
+
'required': ['name', 'url'],
|
|
726
|
+
},
|
|
727
|
+
'depends': {
|
|
728
|
+
'properties': {
|
|
729
|
+
'requires': {'type': 'array', 'items': {'$ref': '#/definitions/require'}},
|
|
730
|
+
'conflicts': {'type': 'array', 'items': {'$ref': '#/definitions/conflict'}},
|
|
731
|
+
},
|
|
732
|
+
'additionalProperties': True,
|
|
733
|
+
},
|
|
734
|
+
'perms': {
|
|
735
|
+
'type': 'array',
|
|
736
|
+
'items': s_msgpack.deepcopy(_reqValidPermDefSchema),
|
|
737
|
+
},
|
|
738
|
+
'configvars': {
|
|
739
|
+
'type': 'array',
|
|
740
|
+
'items': {
|
|
741
|
+
'type': 'object',
|
|
742
|
+
'properties': {
|
|
743
|
+
'name': {'type': 'string'},
|
|
744
|
+
'varname': {'type': 'string'},
|
|
745
|
+
'desc': {'type': 'string'},
|
|
746
|
+
'default': {},
|
|
747
|
+
'workflowconfig': {'type': 'boolean'},
|
|
748
|
+
'type': {'$ref': '#/definitions/configvartype'},
|
|
749
|
+
'scopes': {
|
|
750
|
+
'type': 'array',
|
|
751
|
+
'items': {
|
|
752
|
+
'type': 'string',
|
|
753
|
+
'enum': ['global', 'self']
|
|
754
|
+
},
|
|
755
|
+
},
|
|
756
|
+
},
|
|
757
|
+
'required': ['name', 'varname', 'desc', 'type', 'scopes'],
|
|
758
|
+
},
|
|
759
|
+
},
|
|
760
|
+
},
|
|
761
|
+
'additionalProperties': True,
|
|
762
|
+
'required': ['name', 'version'],
|
|
763
|
+
'definitions': {
|
|
764
|
+
'doc': {
|
|
765
|
+
'type': 'object',
|
|
766
|
+
'properties': {
|
|
767
|
+
'title': {'type': 'string'},
|
|
768
|
+
'content': {'type': 'string'},
|
|
769
|
+
},
|
|
770
|
+
'additionalProperties': True,
|
|
771
|
+
'required': ['title', 'content'],
|
|
772
|
+
},
|
|
773
|
+
'module': {
|
|
774
|
+
'type': 'object',
|
|
775
|
+
'properties': {
|
|
776
|
+
'name': {'type': 'string'},
|
|
777
|
+
'storm': {'type': 'string'},
|
|
778
|
+
'modconf': {'type': 'object'},
|
|
779
|
+
'apidefs': {
|
|
780
|
+
'type': ['array', 'null'],
|
|
781
|
+
'items': {'$ref': '#/definitions/apidef'},
|
|
782
|
+
},
|
|
783
|
+
'asroot': {'type': 'boolean'},
|
|
784
|
+
'asroot:perms': {'type': 'array',
|
|
785
|
+
'items': {'type': 'array',
|
|
786
|
+
'items': {'type': 'string'}},
|
|
787
|
+
},
|
|
788
|
+
},
|
|
789
|
+
'additionalProperties': True,
|
|
790
|
+
'required': ['name', 'storm']
|
|
791
|
+
},
|
|
792
|
+
'apidef': {
|
|
793
|
+
'type': 'object',
|
|
794
|
+
'properties': {
|
|
795
|
+
'name': {'type': 'string'},
|
|
796
|
+
'desc': {'type': 'string'},
|
|
797
|
+
'deprecated': {'$ref': '#/definitions/deprecatedItem'},
|
|
798
|
+
'type': {
|
|
799
|
+
'type': 'object',
|
|
800
|
+
'properties': {
|
|
801
|
+
'type': {
|
|
802
|
+
'type': 'string',
|
|
803
|
+
'enum': ['function']
|
|
804
|
+
},
|
|
805
|
+
'args': {
|
|
806
|
+
'type': 'array',
|
|
807
|
+
'items': {'$ref': '#/definitions/apiarg'},
|
|
808
|
+
},
|
|
809
|
+
'returns': {
|
|
810
|
+
'type': 'object',
|
|
811
|
+
'properties': {
|
|
812
|
+
'name': {
|
|
813
|
+
'type': 'string',
|
|
814
|
+
'enum': ['yields'],
|
|
815
|
+
},
|
|
816
|
+
'desc': {'type': 'string'},
|
|
817
|
+
'type': {
|
|
818
|
+
'oneOf': [
|
|
819
|
+
{'$ref': '#/definitions/apitype'},
|
|
820
|
+
{'type': 'array', 'items': {'$ref': '#/definitions/apitype'}},
|
|
821
|
+
],
|
|
822
|
+
},
|
|
823
|
+
},
|
|
824
|
+
'additionalProperties': False,
|
|
825
|
+
'required': ['type', 'desc']
|
|
826
|
+
},
|
|
827
|
+
},
|
|
828
|
+
'additionalProperties': False,
|
|
829
|
+
'required': ['type', 'returns'],
|
|
830
|
+
},
|
|
831
|
+
},
|
|
832
|
+
'additionalProperties': False,
|
|
833
|
+
'required': ['name', 'desc', 'type']
|
|
834
|
+
},
|
|
835
|
+
'apiarg': {
|
|
836
|
+
'type': 'object',
|
|
837
|
+
'properties': {
|
|
838
|
+
'name': {'type': 'string'},
|
|
839
|
+
'desc': {'type': 'string'},
|
|
840
|
+
'type': {
|
|
841
|
+
'oneOf': [
|
|
842
|
+
{'$ref': '#/definitions/apitype'},
|
|
843
|
+
{'type': 'array', 'items': {'$ref': '#/definitions/apitype'}},
|
|
844
|
+
],
|
|
845
|
+
},
|
|
846
|
+
'default': {'type': ['boolean', 'integer', 'string', 'null']},
|
|
847
|
+
},
|
|
848
|
+
'additionalProperties': False,
|
|
849
|
+
'required': ['name', 'desc', 'type']
|
|
850
|
+
},
|
|
851
|
+
'deprecatedItem': {
|
|
852
|
+
'type': 'object',
|
|
853
|
+
'properties': {
|
|
854
|
+
'eolvers': {'type': 'string', 'minLength': 1,
|
|
855
|
+
'description': "The version which will not longer support the item."},
|
|
856
|
+
'eoldate': {'type': 'string', 'minLength': 1,
|
|
857
|
+
'description': 'Optional string indicating Synapse releases after this date may no longer support the item.'},
|
|
858
|
+
'mesg': {'type': ['string', 'null'], 'default': None,
|
|
859
|
+
'description': 'Optional message to include in the warning text.'}
|
|
860
|
+
},
|
|
861
|
+
'oneOf': [
|
|
862
|
+
{
|
|
863
|
+
'required': ['eolvers'],
|
|
864
|
+
'not': {'required': ['eoldate']}
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
'required': ['eoldate'],
|
|
868
|
+
'not': {'required': ['eolvers']}
|
|
869
|
+
}
|
|
870
|
+
],
|
|
871
|
+
'additionalProperties': False,
|
|
872
|
+
},
|
|
873
|
+
'apitype': {
|
|
874
|
+
'type': 'string',
|
|
875
|
+
},
|
|
876
|
+
'command': {
|
|
877
|
+
'type': 'object',
|
|
878
|
+
'properties': {
|
|
879
|
+
'name': {
|
|
880
|
+
'type': 'string',
|
|
881
|
+
'pattern': s_grammar.re_scmd
|
|
882
|
+
},
|
|
883
|
+
'cmdargs': {
|
|
884
|
+
'type': ['array', 'null'],
|
|
885
|
+
'items': {'$ref': '#/definitions/cmdarg'},
|
|
886
|
+
},
|
|
887
|
+
'cmdinputs': {
|
|
888
|
+
'type': ['array', 'null'],
|
|
889
|
+
'items': {'$ref': '#/definitions/cmdinput'},
|
|
890
|
+
},
|
|
891
|
+
'storm': {'type': 'string'},
|
|
892
|
+
'forms': {'$ref': '#/definitions/cmdformhints'},
|
|
893
|
+
'perms': {'type': 'array',
|
|
894
|
+
'items': {'type': 'array',
|
|
895
|
+
'items': {'type': 'string'}},
|
|
896
|
+
},
|
|
897
|
+
},
|
|
898
|
+
'additionalProperties': True,
|
|
899
|
+
'required': ['name', 'storm']
|
|
900
|
+
},
|
|
901
|
+
'cmdarg': {
|
|
902
|
+
'type': 'array',
|
|
903
|
+
'items': [
|
|
904
|
+
{'type': 'string'},
|
|
905
|
+
{
|
|
906
|
+
'type': 'object',
|
|
907
|
+
'properties': {
|
|
908
|
+
'help': {'type': 'string'},
|
|
909
|
+
'default': {},
|
|
910
|
+
'dest': {'type': 'string'},
|
|
911
|
+
'required': {'type': 'boolean'},
|
|
912
|
+
'action': {'type': 'string'},
|
|
913
|
+
'nargs': {'type': ['string', 'integer']},
|
|
914
|
+
'choices': {
|
|
915
|
+
'type': 'array',
|
|
916
|
+
'uniqueItems': True,
|
|
917
|
+
'minItems': 1,
|
|
918
|
+
},
|
|
919
|
+
'type': {
|
|
920
|
+
'type': 'string',
|
|
921
|
+
'enum': s_msgpack.deepcopy(datamodel_basetypes),
|
|
922
|
+
},
|
|
923
|
+
},
|
|
924
|
+
}
|
|
925
|
+
],
|
|
926
|
+
'additionalItems': False,
|
|
927
|
+
},
|
|
928
|
+
'cmdinput': {
|
|
929
|
+
'type': 'object',
|
|
930
|
+
'properties': {
|
|
931
|
+
'form': {'type': 'string'},
|
|
932
|
+
'help': {'type': 'string'},
|
|
933
|
+
},
|
|
934
|
+
'additionalProperties': True,
|
|
935
|
+
'required': ['form'],
|
|
936
|
+
},
|
|
937
|
+
'configvartype': {
|
|
938
|
+
'anyOf': [
|
|
939
|
+
{'type': 'array', 'items': {'$ref': '#/definitions/configvartype'}},
|
|
940
|
+
{'type': 'string'},
|
|
941
|
+
]
|
|
942
|
+
},
|
|
943
|
+
# deprecated
|
|
944
|
+
'cmdformhints': {
|
|
945
|
+
'type': 'object',
|
|
946
|
+
'properties': {
|
|
947
|
+
'input': {
|
|
948
|
+
'type': 'array',
|
|
949
|
+
'uniqueItems': True,
|
|
950
|
+
'items': {
|
|
951
|
+
'type': 'string',
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
'output': {
|
|
955
|
+
'type': 'array',
|
|
956
|
+
'uniqueItems': True,
|
|
957
|
+
'items': {
|
|
958
|
+
'type': 'string',
|
|
959
|
+
}
|
|
960
|
+
},
|
|
961
|
+
'nodedata': {
|
|
962
|
+
'type': 'array',
|
|
963
|
+
'uniqueItems': True,
|
|
964
|
+
'items': {
|
|
965
|
+
'type': 'array',
|
|
966
|
+
'items': [
|
|
967
|
+
{'type': 'string'},
|
|
968
|
+
{'type': 'string'},
|
|
969
|
+
],
|
|
970
|
+
'additionalItems': False,
|
|
971
|
+
},
|
|
972
|
+
},
|
|
973
|
+
}
|
|
974
|
+
},
|
|
975
|
+
'require': {
|
|
976
|
+
'type': 'object',
|
|
977
|
+
'properties': {
|
|
978
|
+
'name': {'type': 'string'},
|
|
979
|
+
'version': {'type': 'string'},
|
|
980
|
+
'desc': {'type': 'string'},
|
|
981
|
+
'optional': {'type': 'boolean'},
|
|
982
|
+
},
|
|
983
|
+
'additionalItems': True,
|
|
984
|
+
'required': ('name', 'version'),
|
|
985
|
+
},
|
|
986
|
+
'conflict': {
|
|
987
|
+
'type': 'object',
|
|
988
|
+
'properties': {
|
|
989
|
+
'name': {'type': 'string'},
|
|
990
|
+
'version': {'type': 'string'},
|
|
991
|
+
'desc': {'type': 'string'},
|
|
992
|
+
},
|
|
993
|
+
'additionalItems': True,
|
|
994
|
+
'required': ('name',),
|
|
995
|
+
},
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
reqValidPkgdef = s_config.getJsValidator(_reqValidPkgdefSchema)
|
|
999
|
+
|
|
1000
|
+
_reqValidDdefSchema = {
|
|
1001
|
+
'type': 'object',
|
|
1002
|
+
'properties': {
|
|
1003
|
+
'name': {'type': 'string'},
|
|
1004
|
+
'storm': {'type': 'string'},
|
|
1005
|
+
'view': {'type': 'string', 'pattern': s_config.re_iden},
|
|
1006
|
+
'user': {'type': 'string', 'pattern': s_config.re_iden},
|
|
1007
|
+
'iden': {'type': 'string', 'pattern': s_config.re_iden},
|
|
1008
|
+
'enabled': {'type': 'boolean', 'default': True},
|
|
1009
|
+
'stormopts': {
|
|
1010
|
+
'oneOf': [
|
|
1011
|
+
{'type': 'null'},
|
|
1012
|
+
{'$ref': '#/definitions/stormopts'}
|
|
1013
|
+
]
|
|
1014
|
+
}
|
|
1015
|
+
},
|
|
1016
|
+
'additionalProperties': True,
|
|
1017
|
+
'required': ['iden', 'user', 'storm'],
|
|
1018
|
+
'definitions': {
|
|
1019
|
+
'stormopts': {
|
|
1020
|
+
'type': 'object',
|
|
1021
|
+
'properties': {
|
|
1022
|
+
'repr': {'type': 'boolean'},
|
|
1023
|
+
'path': {'type': 'string'},
|
|
1024
|
+
'show': {'type': 'array', 'items': {'type': 'string'}}
|
|
1025
|
+
},
|
|
1026
|
+
'additionalProperties': True,
|
|
1027
|
+
},
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
reqValidDdef = s_config.getJsValidator(_reqValidDdefSchema)
|
synapse/lib/snap.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import sys
|
|
3
4
|
import types
|
|
4
5
|
import asyncio
|
|
5
6
|
import logging
|
|
@@ -318,7 +319,7 @@ class ProtoNode:
|
|
|
318
319
|
|
|
319
320
|
if prop.locked:
|
|
320
321
|
mesg = f'Tagprop {name} is locked.'
|
|
321
|
-
return await self.ctx.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg)
|
|
322
|
+
return await self.ctx.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg, prop=name)
|
|
322
323
|
|
|
323
324
|
try:
|
|
324
325
|
norm, info = prop.type.norm(valu)
|
|
@@ -348,14 +349,14 @@ class ProtoNode:
|
|
|
348
349
|
|
|
349
350
|
if prop.locked:
|
|
350
351
|
mesg = f'Prop {prop.full} is locked due to deprecation.'
|
|
351
|
-
await self.ctx.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg)
|
|
352
|
+
await self.ctx.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg, prop=prop.full)
|
|
352
353
|
return False
|
|
353
354
|
|
|
354
355
|
if isinstance(prop.type, s_types.Array):
|
|
355
356
|
arrayform = self.ctx.snap.core.model.form(prop.type.arraytype.name)
|
|
356
357
|
if arrayform is not None and arrayform.locked:
|
|
357
358
|
mesg = f'Prop {prop.full} is locked due to deprecation.'
|
|
358
|
-
await self.ctx.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg)
|
|
359
|
+
await self.ctx.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg, prop=prop.full)
|
|
359
360
|
return False
|
|
360
361
|
|
|
361
362
|
if norminfo is None:
|
|
@@ -375,7 +376,7 @@ class ProtoNode:
|
|
|
375
376
|
ndefform = self.ctx.snap.core.model.form(valu[0])
|
|
376
377
|
if ndefform.locked:
|
|
377
378
|
mesg = f'Prop {prop.full} is locked due to deprecation.'
|
|
378
|
-
await self.ctx.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg)
|
|
379
|
+
await self.ctx.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg, prop=prop.full)
|
|
379
380
|
return False
|
|
380
381
|
|
|
381
382
|
curv = self.get(prop.name)
|
|
@@ -414,7 +415,8 @@ class ProtoNode:
|
|
|
414
415
|
if propsubs is not None:
|
|
415
416
|
for subname, subvalu in propsubs.items():
|
|
416
417
|
full = f'{prop.name}:{subname}'
|
|
417
|
-
|
|
418
|
+
subprop = self.form.props.get(full)
|
|
419
|
+
if subprop is not None and not subprop.locked:
|
|
418
420
|
await self.set(full, subvalu)
|
|
419
421
|
|
|
420
422
|
propadds = norminfo.get('adds')
|
|
@@ -445,7 +447,8 @@ class ProtoNode:
|
|
|
445
447
|
if propsubs is not None:
|
|
446
448
|
for subname, subvalu in propsubs.items():
|
|
447
449
|
full = f'{prop.name}:{subname}'
|
|
448
|
-
|
|
450
|
+
subprop = self.form.props.get(full)
|
|
451
|
+
if subprop is not None and not subprop.locked:
|
|
449
452
|
ops.append(self.getSetOps(full, subvalu))
|
|
450
453
|
|
|
451
454
|
propadds = norminfo.get('adds')
|
|
@@ -487,7 +490,7 @@ class SnapEditor:
|
|
|
487
490
|
|
|
488
491
|
if form.locked:
|
|
489
492
|
mesg = f'Form {form.full} is locked due to deprecation for valu={valu}.'
|
|
490
|
-
return await self.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg)
|
|
493
|
+
return await self.snap._raiseOnStrict(s_exc.IsDeprLocked, mesg, prop=form.full)
|
|
491
494
|
|
|
492
495
|
if norminfo is None:
|
|
493
496
|
try:
|
|
@@ -1615,6 +1618,10 @@ class Snap(s_base.Base):
|
|
|
1615
1618
|
return tagnode
|
|
1616
1619
|
|
|
1617
1620
|
async def _raiseOnStrict(self, ctor, mesg, **info):
|
|
1621
|
+
if __debug__:
|
|
1622
|
+
if issubclass(ctor, s_exc.IsDeprLocked):
|
|
1623
|
+
sys.audit('synapse.exc.IsDeprLocked', (mesg, info))
|
|
1624
|
+
|
|
1618
1625
|
if self.strict:
|
|
1619
1626
|
raise ctor(mesg=mesg, **info)
|
|
1620
1627
|
await self.warn(mesg)
|