synapse 2.171.0__py311-none-any.whl → 2.173.1__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.

Files changed (57) hide show
  1. synapse/common.py +20 -0
  2. synapse/cortex.py +86 -4
  3. synapse/lib/agenda.py +13 -7
  4. synapse/lib/ast.py +9 -8
  5. synapse/lib/cache.py +2 -2
  6. synapse/lib/cell.py +5 -0
  7. synapse/lib/coro.py +12 -0
  8. synapse/lib/hiveauth.py +81 -4
  9. synapse/lib/layer.py +124 -84
  10. synapse/lib/lmdbslab.py +17 -10
  11. synapse/lib/node.py +1 -1
  12. synapse/lib/slabseqn.py +11 -5
  13. synapse/lib/storm.py +7 -71
  14. synapse/lib/stormhttp.py +1 -1
  15. synapse/lib/stormlib/auth.py +19 -0
  16. synapse/lib/stormlib/cell.py +42 -4
  17. synapse/lib/stormlib/compression.py +6 -6
  18. synapse/lib/stormlib/env.py +50 -0
  19. synapse/lib/stormlib/gen.py +1 -1
  20. synapse/lib/stormlib/model.py +1 -1
  21. synapse/lib/stormtypes.py +35 -11
  22. synapse/lib/types.py +6 -6
  23. synapse/lib/version.py +2 -2
  24. synapse/lib/view.py +6 -12
  25. synapse/models/base.py +13 -0
  26. synapse/models/biz.py +14 -0
  27. synapse/models/economic.py +3 -0
  28. synapse/models/inet.py +474 -4
  29. synapse/models/infotech.py +163 -22
  30. synapse/models/orgs.py +22 -2
  31. synapse/models/person.py +5 -2
  32. synapse/models/planning.py +5 -0
  33. synapse/models/risk.py +15 -1
  34. synapse/models/transport.py +1 -1
  35. synapse/tests/test_common.py +15 -0
  36. synapse/tests/test_lib_ast.py +2 -1
  37. synapse/tests/test_lib_hiveauth.py +139 -1
  38. synapse/tests/test_lib_layer.py +207 -44
  39. synapse/tests/test_lib_lmdbslab.py +13 -0
  40. synapse/tests/test_lib_stormlib_auth.py +22 -0
  41. synapse/tests/test_lib_stormlib_cell.py +47 -0
  42. synapse/tests/test_lib_stormlib_env.py +25 -0
  43. synapse/tests/test_lib_view.py +9 -9
  44. synapse/tests/test_model_base.py +5 -3
  45. synapse/tests/test_model_economic.py +4 -0
  46. synapse/tests/test_model_inet.py +405 -1
  47. synapse/tests/test_model_infotech.py +135 -3
  48. synapse/tests/test_model_orgs.py +14 -2
  49. synapse/tests/test_model_person.py +2 -0
  50. synapse/tests/test_model_risk.py +8 -0
  51. synapse/tests/test_tools_storm.py +46 -8
  52. synapse/tools/storm.py +14 -6
  53. {synapse-2.171.0.dist-info → synapse-2.173.1.dist-info}/METADATA +1 -1
  54. {synapse-2.171.0.dist-info → synapse-2.173.1.dist-info}/RECORD +57 -55
  55. {synapse-2.171.0.dist-info → synapse-2.173.1.dist-info}/WHEEL +1 -1
  56. {synapse-2.171.0.dist-info → synapse-2.173.1.dist-info}/LICENSE +0 -0
  57. {synapse-2.171.0.dist-info → synapse-2.173.1.dist-info}/top_level.txt +0 -0
@@ -53,7 +53,7 @@ class Bzip2Lib(s_stormtypes.Lib):
53
53
  try:
54
54
  return bz2.compress(valu)
55
55
  except Exception as e:
56
- mesg = f'Error during bzip2 compression - {str(e)}: {repr(valu)[:256]}'
56
+ mesg = f'Error during bzip2 compression - {str(e)}: {s_common.trimText(repr(valu))}'
57
57
  raise s_exc.StormRuntimeError(mesg=mesg) from None
58
58
 
59
59
  async def un(self, valu):
@@ -61,7 +61,7 @@ class Bzip2Lib(s_stormtypes.Lib):
61
61
  try:
62
62
  return bz2.decompress(valu)
63
63
  except Exception as e:
64
- mesg = f'Error during bzip2 decompression - {str(e)}: {repr(valu)[:256]}'
64
+ mesg = f'Error during bzip2 decompression - {str(e)}: {s_common.trimText(repr(valu))}'
65
65
  raise s_exc.StormRuntimeError(mesg=mesg) from None
66
66
 
67
67
  @s_stormtypes.registry.registerLib
@@ -110,7 +110,7 @@ class GzipLib(s_stormtypes.Lib):
110
110
  try:
111
111
  return gzip.compress(valu)
112
112
  except Exception as e:
113
- mesg = f'Error during gzip compression - {str(e)}: {repr(valu)[:256]}'
113
+ mesg = f'Error during gzip compression - {str(e)}: {s_common.trimText(repr(valu))}'
114
114
  raise s_exc.StormRuntimeError(mesg=mesg) from None
115
115
 
116
116
  async def un(self, valu):
@@ -118,7 +118,7 @@ class GzipLib(s_stormtypes.Lib):
118
118
  try:
119
119
  return gzip.decompress(valu)
120
120
  except Exception as e:
121
- mesg = f'Error during gzip decompression - {str(e)}: {repr(valu)[:256]}'
121
+ mesg = f'Error during gzip decompression - {str(e)}: {s_common.trimText(repr(valu))}'
122
122
  raise s_exc.StormRuntimeError(mesg=mesg) from None
123
123
 
124
124
  @s_stormtypes.registry.registerLib
@@ -167,7 +167,7 @@ class ZlibLib(s_stormtypes.Lib):
167
167
  try:
168
168
  return zlib.compress(valu)
169
169
  except Exception as e:
170
- mesg = f'Error during zlib compression - {str(e)}: {repr(valu)[:256]}'
170
+ mesg = f'Error during zlib compression - {str(e)}: {s_common.trimText(repr(valu))}'
171
171
  raise s_exc.StormRuntimeError(mesg=mesg) from None
172
172
 
173
173
  async def un(self, valu):
@@ -175,5 +175,5 @@ class ZlibLib(s_stormtypes.Lib):
175
175
  try:
176
176
  return zlib.decompress(valu)
177
177
  except Exception as e:
178
- mesg = f'Error during zlib decompression - {str(e)}: {repr(valu)[:256]}'
178
+ mesg = f'Error during zlib decompression - {str(e)}: {s_common.trimText(repr(valu))}'
179
179
  raise s_exc.StormRuntimeError(mesg=mesg) from None
@@ -0,0 +1,50 @@
1
+ import os
2
+
3
+ import synapse.exc as s_exc
4
+ import synapse.common as s_common
5
+ import synapse.lib.stormtypes as s_stormtypes
6
+
7
+ @s_stormtypes.registry.registerLib
8
+ class LibEnv(s_stormtypes.Lib):
9
+ '''
10
+ A Storm Library for accessing environment vars.
11
+ '''
12
+ _storm_locals = (
13
+ {'name': 'get', 'desc': '''
14
+ Retrieve an environment variable.
15
+
16
+ Notes:
17
+ Environment variables must begin with ``SYN_STORM_ENV_`` in
18
+ order to be accessed by this API.
19
+ ''',
20
+ 'type': {
21
+ 'type': 'function', '_funcname': '_libEnvGet',
22
+ 'args': (
23
+ {'name': 'name', 'type': 'str', 'desc': 'The name of the environment variable.', },
24
+ {'name': 'default', 'type': 'obj', 'default': None,
25
+ 'desc': 'The value to return if the environment variable is not set.', },
26
+ ),
27
+ 'returns': {'type': 'str', 'desc': 'The environment variable string.'},
28
+ },
29
+ },
30
+ )
31
+ _storm_lib_path = ('env',)
32
+
33
+ def getObjLocals(self):
34
+ return {
35
+ 'get': self._libEnvGet,
36
+ }
37
+
38
+ @s_stormtypes.stormfunc(readonly=True)
39
+ async def _libEnvGet(self, name, default=None):
40
+
41
+ self.runt.reqAdmin(mesg='$lib.env.get() requires admin privileges.')
42
+
43
+ name = await s_stormtypes.tostr(name)
44
+ default = await s_stormtypes.toprim(default)
45
+
46
+ if not name.startswith('SYN_STORM_ENV_'):
47
+ mesg = f'Environment variable must start with SYN_STORM_ENV_ : {name}'
48
+ raise s_exc.BadArg(mesg=mesg)
49
+
50
+ return os.getenv(name, default=default)
@@ -603,7 +603,7 @@ stormcmds = (
603
603
  {
604
604
  'name': 'gen.it.av.scan.result',
605
605
  'descr': '''
606
- Lift (or create) the it:av:scan:result node by deconflicting the target and signature time.
606
+ Lift (or create) the it:av:scan:result node by deconflicting the target and signature name.
607
607
 
608
608
  The scan time and scanner name may also optionally be provided for deconfliction.
609
609
 
@@ -1090,7 +1090,7 @@ class LibModelMigrations(s_stormtypes.Lib, MigrationEditorMixin):
1090
1090
  self.runt.confirmPropSet(riskvuln.props['vuln'])
1091
1091
  self.runt.confirmPropSet(riskvuln.props['node'])
1092
1092
 
1093
- if (seen := n.get('.seen')):
1093
+ if seen := n.get('.seen'):
1094
1094
  self.runt.confirmPropSet(riskvuln.props['.seen'])
1095
1095
  props['.seen'] = seen
1096
1096
 
synapse/lib/stormtypes.py CHANGED
@@ -4130,7 +4130,7 @@ class LibBase64(Lib):
4130
4130
  return base64.urlsafe_b64encode(valu).decode('ascii')
4131
4131
  return base64.b64encode(valu).decode('ascii')
4132
4132
  except TypeError as e:
4133
- mesg = f'Error during base64 encoding - {str(e)}: {repr(valu)[:256]}'
4133
+ mesg = f'Error during base64 encoding - {str(e)}: {s_common.trimText(repr(valu))}'
4134
4134
  raise s_exc.StormRuntimeError(mesg=mesg, urlsafe=urlsafe) from None
4135
4135
 
4136
4136
  @stormfunc(readonly=True)
@@ -4140,7 +4140,7 @@ class LibBase64(Lib):
4140
4140
  return base64.urlsafe_b64decode(valu)
4141
4141
  return base64.b64decode(valu)
4142
4142
  except binascii.Error as e:
4143
- mesg = f'Error during base64 decoding - {str(e)}: {repr(valu)[:256]}'
4143
+ mesg = f'Error during base64 decoding - {str(e)}: {s_common.trimText(repr(valu))}'
4144
4144
  raise s_exc.StormRuntimeError(mesg=mesg, urlsafe=urlsafe) from None
4145
4145
 
4146
4146
  @functools.total_ordering
@@ -4488,7 +4488,7 @@ class Str(Prim):
4488
4488
  try:
4489
4489
  return self.valu.encode(encoding, 'surrogatepass')
4490
4490
  except UnicodeEncodeError as e:
4491
- raise s_exc.StormRuntimeError(mesg=f'{e}: {repr(self.valu)[:256]}') from None
4491
+ raise s_exc.StormRuntimeError(mesg=f'{e}: {s_common.trimText(repr(self.valu))}') from None
4492
4492
 
4493
4493
  @stormfunc(readonly=True)
4494
4494
  async def _methStrSplit(self, text, maxsplit=-1):
@@ -4733,7 +4733,7 @@ class Bytes(Prim):
4733
4733
  try:
4734
4734
  return self.valu.decode(encoding, errors)
4735
4735
  except UnicodeDecodeError as e:
4736
- raise s_exc.StormRuntimeError(mesg=f'{e}: {repr(self.valu)[:256]}') from None
4736
+ raise s_exc.StormRuntimeError(mesg=f'{e}: {s_common.trimText(repr(self.valu))}') from None
4737
4737
 
4738
4738
  async def _methBunzip(self):
4739
4739
  return bz2.decompress(self.valu)
@@ -4763,7 +4763,7 @@ class Bytes(Prim):
4763
4763
  return json.loads(valu.decode(encoding, errors))
4764
4764
 
4765
4765
  except UnicodeDecodeError as e:
4766
- raise s_exc.StormRuntimeError(mesg=f'{e}: {repr(valu)[:256]}') from None
4766
+ raise s_exc.StormRuntimeError(mesg=f'{e}: {s_common.trimText(repr(valu))}') from None
4767
4767
 
4768
4768
  except json.JSONDecodeError as e:
4769
4769
  mesg = f'Unable to decode bytes as json: {e.args[0]}'
@@ -6606,7 +6606,12 @@ class Layer(Prim):
6606
6606
  {'name': 'repr', 'desc': 'Get a string representation of the Layer.',
6607
6607
  'type': {'type': 'function', '_funcname': '_methLayerRepr',
6608
6608
  'returns': {'type': 'str', 'desc': 'A string that can be printed, representing a Layer.', }}},
6609
- {'name': 'edits', 'desc': 'Yield (offs, nodeedits) tuples from the given offset.',
6609
+ {'name': 'edits', 'desc': '''
6610
+ Yield (offs, nodeedits) tuples from the given offset.
6611
+
6612
+ Notes:
6613
+ Specifying reverse=(true) disables the wait behavior.
6614
+ ''',
6610
6615
  'type': {'type': 'function', '_funcname': '_methLayerEdits',
6611
6616
  'args': (
6612
6617
  {'name': 'offs', 'type': 'int', 'desc': 'Offset to start getting nodeedits from the layer at.',
@@ -6616,9 +6621,14 @@ class Layer(Prim):
6616
6621
  'otherwise exit the generator when there are no more edits.', },
6617
6622
  {'name': 'size', 'type': 'int', 'desc': 'The maximum number of nodeedits to yield.',
6618
6623
  'default': None, },
6624
+ {'name': 'reverse', 'type': 'boolean', 'desc': 'Yield the edits in reverse order.',
6625
+ 'default': False, },
6619
6626
  ),
6620
6627
  'returns': {'name': 'Yields', 'type': 'list',
6621
6628
  'desc': 'Yields offset, nodeedit tuples from a given offset.', }}},
6629
+ {'name': 'edited', 'desc': 'Return the last time the layer was edited or null if no edits are present.',
6630
+ 'type': {'type': 'function', '_funcname': '_methLayerEdited',
6631
+ 'returns': {'type': 'time', 'desc': 'The last time the layer was edited.', }}},
6622
6632
  {'name': 'addPush', 'desc': 'Configure the layer to push edits to a remote layer/feed.',
6623
6633
  'type': {'type': 'function', '_funcname': '_addPush',
6624
6634
  'args': (
@@ -6901,6 +6911,7 @@ class Layer(Prim):
6901
6911
  'pack': self._methLayerPack,
6902
6912
  'repr': self._methLayerRepr,
6903
6913
  'edits': self._methLayerEdits,
6914
+ 'edited': self._methLayerEdited,
6904
6915
  'verify': self.verify,
6905
6916
  'addPush': self._addPush,
6906
6917
  'delPush': self._delPush,
@@ -7181,15 +7192,22 @@ class Layer(Prim):
7181
7192
  return layr.getTagPropValuCount(form, tag, prop.name, prop.type.stortype, norm)
7182
7193
 
7183
7194
  @stormfunc(readonly=True)
7184
- async def _methLayerEdits(self, offs=0, wait=True, size=None):
7195
+ async def _methLayerEdits(self, offs=0, wait=True, size=None, reverse=False):
7185
7196
  offs = await toint(offs)
7186
7197
  wait = await tobool(wait)
7187
- layriden = self.valu.get('iden')
7188
- gatekeys = ((self.runt.user.iden, ('layer', 'edits', 'read'), layriden),)
7189
- todo = s_common.todo('syncNodeEdits', offs, wait=wait)
7198
+ reverse = await tobool(reverse)
7199
+
7200
+ layr = self.runt.snap.core.reqLayer(self.valu.get('iden'))
7201
+
7202
+ self.runt.confirm(('layer', 'edits', 'read'), gateiden=layr.iden)
7203
+
7204
+ if reverse:
7205
+ wait = False
7206
+ if offs == 0:
7207
+ offs = 0xffffffffffffffff
7190
7208
 
7191
7209
  count = 0
7192
- async for item in self.runt.dyniter(layriden, todo, gatekeys=gatekeys):
7210
+ async for item in layr.syncNodeEdits(offs, wait=wait, reverse=reverse):
7193
7211
 
7194
7212
  yield item
7195
7213
 
@@ -7197,6 +7215,12 @@ class Layer(Prim):
7197
7215
  if size is not None and size == count:
7198
7216
  break
7199
7217
 
7218
+ @stormfunc(readonly=True)
7219
+ async def _methLayerEdited(self):
7220
+ layr = self.runt.snap.core.reqLayer(self.valu.get('iden'))
7221
+ async for offs, edits, meta in layr.syncNodeEdits2(0xffffffffffffffff, wait=False, reverse=True):
7222
+ return meta.get('time')
7223
+
7200
7224
  @stormfunc(readonly=True)
7201
7225
  async def getStorNode(self, nodeid):
7202
7226
  nodeid = await tostr(nodeid)
synapse/lib/types.py CHANGED
@@ -507,7 +507,7 @@ class Comp(Type):
507
507
  fields = self.opts.get('fields')
508
508
  if len(fields) != len(valu):
509
509
  raise s_exc.BadTypeValu(name=self.name, fields=fields, numitems=len(valu),
510
- mesg=f'invalid number of fields given for norming: {repr(valu)[:256]}')
510
+ mesg=f'invalid number of fields given for norming: {s_common.trimText(repr(valu))}')
511
511
 
512
512
  subs = {}
513
513
  adds = []
@@ -1589,7 +1589,7 @@ class Data(Type):
1589
1589
  if self.validator is not None:
1590
1590
  self.validator(valu)
1591
1591
  except (s_exc.MustBeJsonSafe, s_exc.SchemaViolation) as e:
1592
- raise s_exc.BadTypeValu(name=self.name, mesg=f'{e}: {repr(valu)[:256]}') from None
1592
+ raise s_exc.BadTypeValu(name=self.name, mesg=f'{e}: {s_common.trimText(repr(valu))}') from None
1593
1593
  byts = s_msgpack.en(valu)
1594
1594
  return s_msgpack.un(byts), {}
1595
1595
 
@@ -1608,7 +1608,7 @@ class NodeProp(Type):
1608
1608
 
1609
1609
  def _normPyTuple(self, valu):
1610
1610
  if len(valu) != 2:
1611
- mesg = f'Must be a 2-tuple: {repr(valu)[:256]}'
1611
+ mesg = f'Must be a 2-tuple: {s_common.trimText(repr(valu))}'
1612
1612
  raise s_exc.BadTypeValu(name=self.name, numitems=len(valu), mesg=mesg) from None
1613
1613
 
1614
1614
  propname, propvalu = valu
@@ -1650,7 +1650,7 @@ class Range(Type):
1650
1650
 
1651
1651
  def _normPyTuple(self, valu):
1652
1652
  if len(valu) != 2:
1653
- mesg = f'Must be a 2-tuple of type {self.subtype.name}: {repr(valu)[:256]}'
1653
+ mesg = f'Must be a 2-tuple of type {self.subtype.name}: {s_common.trimText(repr(valu))}'
1654
1654
  raise s_exc.BadTypeValu(numitems=len(valu), name=self.name, mesg=mesg)
1655
1655
 
1656
1656
  minv = self.subtype.norm(valu[0])[0]
@@ -2262,11 +2262,11 @@ class Time(IntBase):
2262
2262
  '''
2263
2263
 
2264
2264
  if not isinstance(vals, (list, tuple)):
2265
- mesg = f'Must be a 2-tuple: {repr(vals)[:256]}'
2265
+ mesg = f'Must be a 2-tuple: {s_common.trimText(repr(vals))}'
2266
2266
  raise s_exc.BadCmprValu(itemtype=type(vals), cmpr='range=', mesg=mesg)
2267
2267
 
2268
2268
  if len(vals) != 2:
2269
- mesg = f'Must be a 2-tuple: {repr(vals)[:256]}'
2269
+ mesg = f'Must be a 2-tuple: {s_common.trimText(repr(vals))}'
2270
2270
  raise s_exc.BadCmprValu(itemtype=type(vals), cmpr='range=', mesg=mesg)
2271
2271
 
2272
2272
  tick, tock = self.getTickTock(vals)
synapse/lib/version.py CHANGED
@@ -223,6 +223,6 @@ def reqVersion(valu, reqver,
223
223
  ##############################################################################
224
224
  # The following are touched during the release process by bumpversion.
225
225
  # Do not modify these directly.
226
- version = (2, 171, 0)
226
+ version = (2, 173, 1)
227
227
  verstring = '.'.join([str(x) for x in version])
228
- commit = 'c89839928860a36f70377a8cefd09aaa4b12595a'
228
+ commit = '06b04fd5f58964b7897442d4c88cbfed145093d9'
synapse/lib/view.py CHANGED
@@ -1444,11 +1444,7 @@ class View(s_nexus.Pusher): # type: ignore
1444
1444
  if user is None or user.isAdmin() or user.isAdmin(gateiden=parentlayr.iden):
1445
1445
  return
1446
1446
 
1447
- async with await self.parent.snap(user=user) as snap:
1448
- async for nodeedit in fromlayr.iterLayerNodeEdits():
1449
- for offs, perm in s_layer.getNodeEditPerms([nodeedit]):
1450
- self.parent._confirm(user, perm)
1451
- await asyncio.sleep(0)
1447
+ await fromlayr.confirmLayerEditPerms(user, parentlayr.iden)
1452
1448
 
1453
1449
  async def wipeAllowed(self, user=None):
1454
1450
  '''
@@ -1457,10 +1453,8 @@ class View(s_nexus.Pusher): # type: ignore
1457
1453
  if user is None or user.isAdmin():
1458
1454
  return
1459
1455
 
1460
- async for nodeedit in self.layers[0].iterWipeNodeEdits():
1461
- for offs, perm in s_layer.getNodeEditPerms([nodeedit]):
1462
- self._confirm(user, perm)
1463
- await asyncio.sleep(0)
1456
+ layer = self.layers[0]
1457
+ await layer.confirmLayerEditPerms(user, layer.iden, delete=True)
1464
1458
 
1465
1459
  async def runTagAdd(self, node, tag, valu):
1466
1460
 
@@ -1564,14 +1558,14 @@ class View(s_nexus.Pusher): # type: ignore
1564
1558
  async def getTrigger(self, iden):
1565
1559
  trig = self.triggers.get(iden)
1566
1560
  if trig is None:
1567
- raise s_exc.NoSuchIden("Trigger not found")
1561
+ raise s_exc.NoSuchIden(mesg=f"Trigger not found {iden=}", iden=iden)
1568
1562
 
1569
1563
  return trig
1570
1564
 
1571
1565
  async def delTrigger(self, iden):
1572
1566
  trig = self.triggers.get(iden)
1573
1567
  if trig is None:
1574
- raise s_exc.NoSuchIden("Trigger not found")
1568
+ raise s_exc.NoSuchIden(mesg=f"Trigger not found {iden=}", iden=iden)
1575
1569
 
1576
1570
  return await self._push('trigger:del', iden)
1577
1571
 
@@ -1592,7 +1586,7 @@ class View(s_nexus.Pusher): # type: ignore
1592
1586
  async def setTriggerInfo(self, iden, name, valu):
1593
1587
  trig = self.triggers.get(iden)
1594
1588
  if trig is None:
1595
- raise s_exc.NoSuchIden("Trigger not found")
1589
+ raise s_exc.NoSuchIden(mesg=f"Trigger not found {iden=}", iden=iden)
1596
1590
  await trig.set(name, valu)
1597
1591
 
1598
1592
  await self.core.feedBeholder('trigger:set', {'iden': trig.iden, 'view': trig.view.iden, 'name': name, 'valu': valu}, gates=[trig.iden])
synapse/models/base.py CHANGED
@@ -195,8 +195,12 @@ class BaseModule(s_module.CoreModule):
195
195
 
196
196
  ('created', ('time', {}), {
197
197
  'doc': 'The time the note was created.'}),
198
+
198
199
  ('updated', ('time', {}), {
199
200
  'doc': 'The time the note was updated.'}),
201
+
202
+ ('replyto', ('meta:note', {}), {
203
+ 'doc': 'The note is a reply to the specified note.'}),
200
204
  )),
201
205
 
202
206
  ('meta:timeline', {}, (
@@ -213,17 +217,26 @@ class BaseModule(s_module.CoreModule):
213
217
  ('meta:timeline:taxonomy', {}, ()),
214
218
 
215
219
  ('meta:event', {}, (
220
+
216
221
  ('timeline', ('meta:timeline', {}), {
217
222
  'doc': 'The timeline containing the event.'}),
223
+
218
224
  ('title', ('str', {}), {
219
225
  'doc': 'A title for the event.'}),
226
+
220
227
  ('summary', ('str', {}), {
221
228
  'disp': {'hint': 'text'},
222
229
  'doc': 'A prose summary of the event.'}),
230
+
223
231
  ('time', ('time', {}), {
224
232
  'doc': 'The time that the event occurred.'}),
233
+
234
+ ('index', ('int', {}), {
235
+ 'doc': 'The index of this event in a timeline without exact times.'}),
236
+
225
237
  ('duration', ('duration', {}), {
226
238
  'doc': 'The duration of the event.'}),
239
+
227
240
  ('type', ('meta:event:taxonomy', {}), {
228
241
  'doc': 'Type of event.'}),
229
242
  )),
synapse/models/biz.py CHANGED
@@ -175,22 +175,36 @@ class BizModule(s_module.CoreModule):
175
175
  }),
176
176
  )),
177
177
  ('biz:listing', {}, (
178
+
178
179
  ('seller', ('ps:contact', {}), {
179
180
  'doc': 'The contact information for the seller.'}),
181
+
180
182
  ('product', ('biz:product', {}), {
181
183
  'doc': 'The product being offered.'}),
184
+
182
185
  ('service', ('biz:service', {}), {
183
186
  'doc': 'The service being offered.'}),
187
+
184
188
  ('current', ('bool', {}), {
185
189
  'doc': 'Set to true if the offer is still current.'}),
190
+
186
191
  ('time', ('time', {}), {
187
192
  'doc': 'The first known offering of this product/service by the organization for the asking price.'}),
193
+
188
194
  ('expires', ('time', {}), {
189
195
  'doc': 'Set if the offer has a known expiration date.'}),
196
+
190
197
  ('price', ('econ:price', {}), {
191
198
  'doc': 'The asking price of the product or service.'}),
199
+
192
200
  ('currency', ('econ:currency', {}), {
193
201
  'doc': 'The currency of the asking price.'}),
202
+
203
+ ('count:total', ('int', {'min': 0}), {
204
+ 'doc': 'The number of instances for sale.'}),
205
+
206
+ ('count:remaining', ('int', {'min': 0}), {
207
+ 'doc': 'The current remaining number of instances for sale.'}),
194
208
  )),
195
209
  ('biz:service', {}, (
196
210
  ('provider', ('ps:contact', {}), {
@@ -169,6 +169,9 @@ class EconModule(s_module.CoreModule):
169
169
 
170
170
  ('currency', ('econ:currency', {}), {
171
171
  'doc': 'The econ:price of the purchase'}),
172
+
173
+ ('listing', ('biz:listing', {}), {
174
+ 'doc': 'The purchase was made based on the given listing.'}),
172
175
  )),
173
176
 
174
177
  ('econ:receipt:item', {}, (