@juzi/wechaty-puppet-service 1.0.16 → 1.0.19
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.
- package/dist/cjs/src/client/payload-store.d.ts +2 -0
- package/dist/cjs/src/client/payload-store.d.ts.map +1 -1
- package/dist/cjs/src/client/payload-store.js +10 -0
- package/dist/cjs/src/client/payload-store.js.map +1 -1
- package/dist/cjs/src/client/puppet-service.d.ts +14 -11
- package/dist/cjs/src/client/puppet-service.d.ts.map +1 -1
- package/dist/cjs/src/client/puppet-service.js +127 -82
- package/dist/cjs/src/client/puppet-service.js.map +1 -1
- package/dist/cjs/src/config.d.ts +1 -0
- package/dist/cjs/src/config.d.ts.map +1 -1
- package/dist/cjs/src/config.js +2 -1
- package/dist/cjs/src/config.js.map +1 -1
- package/dist/cjs/src/package-json.js +5 -5
- package/dist/cjs/src/package-json.js.map +1 -1
- package/dist/cjs/src/server/event-stream-manager.d.ts.map +1 -1
- package/dist/cjs/src/server/event-stream-manager.js +7 -0
- package/dist/cjs/src/server/event-stream-manager.js.map +1 -1
- package/dist/cjs/src/server/puppet-implementation.d.ts.map +1 -1
- package/dist/cjs/src/server/puppet-implementation.js +98 -59
- package/dist/cjs/src/server/puppet-implementation.js.map +1 -1
- package/dist/esm/src/client/payload-store.d.ts +2 -0
- package/dist/esm/src/client/payload-store.d.ts.map +1 -1
- package/dist/esm/src/client/payload-store.js +10 -0
- package/dist/esm/src/client/payload-store.js.map +1 -1
- package/dist/esm/src/client/puppet-service.d.ts +14 -11
- package/dist/esm/src/client/puppet-service.d.ts.map +1 -1
- package/dist/esm/src/client/puppet-service.js +128 -83
- package/dist/esm/src/client/puppet-service.js.map +1 -1
- package/dist/esm/src/config.d.ts +1 -0
- package/dist/esm/src/config.d.ts.map +1 -1
- package/dist/esm/src/config.js +1 -0
- package/dist/esm/src/config.js.map +1 -1
- package/dist/esm/src/package-json.js +5 -5
- package/dist/esm/src/package-json.js.map +1 -1
- package/dist/esm/src/server/event-stream-manager.d.ts.map +1 -1
- package/dist/esm/src/server/event-stream-manager.js +7 -0
- package/dist/esm/src/server/event-stream-manager.js.map +1 -1
- package/dist/esm/src/server/puppet-implementation.d.ts.map +1 -1
- package/dist/esm/src/server/puppet-implementation.js +98 -59
- package/dist/esm/src/server/puppet-implementation.js.map +1 -1
- package/package.json +5 -5
- package/src/client/payload-store.ts +10 -0
- package/src/client/puppet-service.ts +162 -100
- package/src/config.ts +1 -0
- package/src/package-json.ts +5 -5
- package/src/server/event-stream-manager.ts +7 -0
- package/src/server/puppet-implementation.ts +106 -59
|
@@ -1209,8 +1209,13 @@ function puppetImplementation (
|
|
|
1209
1209
|
try {
|
|
1210
1210
|
const roomId = call.request.getId()
|
|
1211
1211
|
const contactId = call.request.getContactId()
|
|
1212
|
+
const contactIds = call.request.getContactIdsList()
|
|
1212
1213
|
|
|
1213
|
-
|
|
1214
|
+
if (contactIds.length > 1) {
|
|
1215
|
+
await puppet.roomDel(roomId, contactId)
|
|
1216
|
+
} else {
|
|
1217
|
+
await puppet.roomDel(roomId, contactId || (contactIds[0]) || '')
|
|
1218
|
+
}
|
|
1214
1219
|
|
|
1215
1220
|
return callback(null, new grpcPuppet.RoomDelResponse())
|
|
1216
1221
|
|
|
@@ -1502,11 +1507,16 @@ function puppetImplementation (
|
|
|
1502
1507
|
log.verbose('PuppetServiceImpl', 'tagContactTagAdd()')
|
|
1503
1508
|
|
|
1504
1509
|
try {
|
|
1505
|
-
const
|
|
1506
|
-
const
|
|
1507
|
-
const
|
|
1510
|
+
const tagsProb = call.request.getTagsList()
|
|
1511
|
+
const contactIds = call.request.getContactIdsList()
|
|
1512
|
+
const tags = tagsProb.map(tagProb => {
|
|
1513
|
+
return {
|
|
1514
|
+
id: tagProb.getId(),
|
|
1515
|
+
groupId: tagProb.getGroupId(),
|
|
1516
|
+
}
|
|
1517
|
+
})
|
|
1508
1518
|
|
|
1509
|
-
await puppet.tagContactTagAdd(
|
|
1519
|
+
await puppet.tagContactTagAdd(tags, contactIds)
|
|
1510
1520
|
|
|
1511
1521
|
return callback(null, new grpcPuppet.TagContactTagAddResponse())
|
|
1512
1522
|
} catch (e) {
|
|
@@ -1518,11 +1528,16 @@ function puppetImplementation (
|
|
|
1518
1528
|
log.verbose('PuppetServiceImpl', 'tagContactTagRemove()')
|
|
1519
1529
|
|
|
1520
1530
|
try {
|
|
1521
|
-
const
|
|
1522
|
-
const
|
|
1523
|
-
const
|
|
1531
|
+
const tagsProb = call.request.getTagsList()
|
|
1532
|
+
const contactIds = call.request.getContactIdsList()
|
|
1533
|
+
const tags = tagsProb.map(tagProb => {
|
|
1534
|
+
return {
|
|
1535
|
+
id: tagProb.getId(),
|
|
1536
|
+
groupId: tagProb.getGroupId(),
|
|
1537
|
+
}
|
|
1538
|
+
})
|
|
1524
1539
|
|
|
1525
|
-
await puppet.tagContactTagRemove(
|
|
1540
|
+
await puppet.tagContactTagRemove(tags, contactIds)
|
|
1526
1541
|
|
|
1527
1542
|
return callback(null, new grpcPuppet.TagContactTagRemoveResponse())
|
|
1528
1543
|
} catch (e) {
|
|
@@ -1537,13 +1552,11 @@ function puppetImplementation (
|
|
|
1537
1552
|
const tagGroupName = call.request.getTagGroupName()
|
|
1538
1553
|
|
|
1539
1554
|
const result = await puppet.tagGroupAdd(tagGroupName)
|
|
1540
|
-
|
|
1555
|
+
|
|
1541
1556
|
const response = new grpcPuppet.TagGroupAddResponse()
|
|
1542
1557
|
|
|
1543
1558
|
if (result) {
|
|
1544
|
-
|
|
1545
|
-
payload.setName(result.name)
|
|
1546
|
-
response.setPayload(payload)
|
|
1559
|
+
response.setTagGroupId(result)
|
|
1547
1560
|
}
|
|
1548
1561
|
|
|
1549
1562
|
return callback(null, response)
|
|
@@ -1573,18 +1586,16 @@ function puppetImplementation (
|
|
|
1573
1586
|
const tagGroupId = call.request.getTagGroupId()
|
|
1574
1587
|
const tagName = call.request.getTagName()
|
|
1575
1588
|
|
|
1576
|
-
const result = await puppet.tagTagAdd(
|
|
1577
|
-
const
|
|
1589
|
+
const result = await puppet.tagTagAdd(tagName, tagGroupId)
|
|
1590
|
+
const tagIdentifier = new grpcPuppet.TagIdentifier()
|
|
1578
1591
|
const response = new grpcPuppet.TagTagAddResponse()
|
|
1579
1592
|
|
|
1580
1593
|
if (result) {
|
|
1581
|
-
|
|
1582
|
-
payload.setName(result.name)
|
|
1583
|
-
payload.setType(result.type)
|
|
1594
|
+
tagIdentifier.setId(result.id)
|
|
1584
1595
|
if (result.groupId) {
|
|
1585
|
-
|
|
1596
|
+
tagIdentifier.setGroupId(result.groupId)
|
|
1586
1597
|
}
|
|
1587
|
-
response.
|
|
1598
|
+
response.setTag(tagIdentifier)
|
|
1588
1599
|
}
|
|
1589
1600
|
|
|
1590
1601
|
return callback(null, response)
|
|
@@ -1597,10 +1608,11 @@ function puppetImplementation (
|
|
|
1597
1608
|
log.verbose('PuppetServiceImpl', 'tagTagDelete()')
|
|
1598
1609
|
|
|
1599
1610
|
try {
|
|
1600
|
-
const
|
|
1601
|
-
const
|
|
1611
|
+
const tagProb = call.request.getTag()
|
|
1612
|
+
const id = tagProb?.getId()!
|
|
1613
|
+
const groupId = tagProb?.getGroupId()
|
|
1602
1614
|
|
|
1603
|
-
await puppet.tagTagDelete(
|
|
1615
|
+
await puppet.tagTagDelete({ id, groupId })
|
|
1604
1616
|
|
|
1605
1617
|
return callback(null, new grpcPuppet.TagTagDeleteResponse())
|
|
1606
1618
|
} catch (e) {
|
|
@@ -1614,14 +1626,8 @@ function puppetImplementation (
|
|
|
1614
1626
|
|
|
1615
1627
|
try {
|
|
1616
1628
|
const result = await puppet.tagGroupList()
|
|
1617
|
-
const payloads = result.map(tagGroup => {
|
|
1618
|
-
const payload = new grpcPuppet.TagGroupPayload()
|
|
1619
|
-
payload.setId(tagGroup.id)
|
|
1620
|
-
payload.setName(tagGroup.name)
|
|
1621
|
-
return payload
|
|
1622
|
-
})
|
|
1623
1629
|
const response = new grpcPuppet.TagGroupListResponse()
|
|
1624
|
-
response.
|
|
1630
|
+
response.setTagGroupIdsList(result)
|
|
1625
1631
|
|
|
1626
1632
|
return callback(null, response)
|
|
1627
1633
|
} catch (e) {
|
|
@@ -1636,18 +1642,16 @@ function puppetImplementation (
|
|
|
1636
1642
|
const tagGroupId = call.request.getTagGroupId()
|
|
1637
1643
|
|
|
1638
1644
|
const result = await puppet.tagGroupTagList(tagGroupId)
|
|
1639
|
-
const
|
|
1640
|
-
const
|
|
1641
|
-
|
|
1642
|
-
payload.setName(tag.name)
|
|
1643
|
-
payload.setType(tag.type)
|
|
1645
|
+
const tagIdentifiers = result.map(tag => {
|
|
1646
|
+
const tagIdentifier = new grpcPuppet.TagIdentifier()
|
|
1647
|
+
tagIdentifier.setId(tag.id)
|
|
1644
1648
|
if (tag.groupId) {
|
|
1645
|
-
|
|
1649
|
+
tagIdentifier.setGroupId(tag.groupId)
|
|
1646
1650
|
}
|
|
1647
|
-
return
|
|
1651
|
+
return tagIdentifier
|
|
1648
1652
|
})
|
|
1649
|
-
const response = new grpcPuppet.
|
|
1650
|
-
response.
|
|
1653
|
+
const response = new grpcPuppet.TagGroupTagListResponse()
|
|
1654
|
+
response.setTagsList(tagIdentifiers)
|
|
1651
1655
|
|
|
1652
1656
|
return callback(null, response)
|
|
1653
1657
|
} catch (e) {
|
|
@@ -1661,18 +1665,16 @@ function puppetImplementation (
|
|
|
1661
1665
|
|
|
1662
1666
|
try {
|
|
1663
1667
|
const result = await puppet.tagTagList()
|
|
1664
|
-
const
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1667
|
-
payload.setName(tag.name)
|
|
1668
|
-
payload.setType(tag.type)
|
|
1668
|
+
const tagIdentifiers = result.map(tag => {
|
|
1669
|
+
const tagIdentifier = new grpcPuppet.TagIdentifier()
|
|
1670
|
+
tagIdentifier.setId(tag.id)
|
|
1669
1671
|
if (tag.groupId) {
|
|
1670
|
-
|
|
1672
|
+
tagIdentifier.setGroupId(tag.groupId)
|
|
1671
1673
|
}
|
|
1672
|
-
return
|
|
1674
|
+
return tagIdentifier
|
|
1673
1675
|
})
|
|
1674
1676
|
const response = new grpcPuppet.TagTagListResponse()
|
|
1675
|
-
response.
|
|
1677
|
+
response.setTagsList(tagIdentifiers)
|
|
1676
1678
|
|
|
1677
1679
|
return callback(null, response)
|
|
1678
1680
|
} catch (e) {
|
|
@@ -1687,18 +1689,16 @@ function puppetImplementation (
|
|
|
1687
1689
|
const contactId = call.request.getContactId()
|
|
1688
1690
|
|
|
1689
1691
|
const result = await puppet.tagContactTagList(contactId)
|
|
1690
|
-
const
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1693
|
-
payload.setName(tag.name)
|
|
1694
|
-
payload.setType(tag.type)
|
|
1692
|
+
const tagIdentifiers = result.map(tag => {
|
|
1693
|
+
const tagIdentifier = new grpcPuppet.TagIdentifier()
|
|
1694
|
+
tagIdentifier.setId(tag.id)
|
|
1695
1695
|
if (tag.groupId) {
|
|
1696
|
-
|
|
1696
|
+
tagIdentifier.setGroupId(tag.groupId)
|
|
1697
1697
|
}
|
|
1698
|
-
return
|
|
1698
|
+
return tagIdentifier
|
|
1699
1699
|
})
|
|
1700
1700
|
const response = new grpcPuppet.TagContactTagListResponse()
|
|
1701
|
-
response.
|
|
1701
|
+
response.setTagsList(tagIdentifiers)
|
|
1702
1702
|
|
|
1703
1703
|
return callback(null, response)
|
|
1704
1704
|
} catch (e) {
|
|
@@ -1710,15 +1710,62 @@ function puppetImplementation (
|
|
|
1710
1710
|
log.verbose('PuppetServiceImpl', 'tagTagContactList()')
|
|
1711
1711
|
|
|
1712
1712
|
try {
|
|
1713
|
-
const
|
|
1714
|
-
const
|
|
1713
|
+
const tagProb = call.request.getTag()
|
|
1714
|
+
const id = tagProb?.getId()!
|
|
1715
|
+
const groupId = tagProb?.getGroupId()
|
|
1715
1716
|
|
|
1716
|
-
const result = await puppet.tagTagContactList(
|
|
1717
|
+
const result = await puppet.tagTagContactList({ id, groupId })
|
|
1717
1718
|
|
|
1718
1719
|
const response = new grpcPuppet.TagTagContactListResponse()
|
|
1719
|
-
response.
|
|
1720
|
+
response.setContactIdsList(result)
|
|
1721
|
+
|
|
1722
|
+
return callback(null, response)
|
|
1723
|
+
} catch (e) {
|
|
1724
|
+
return grpcError('tagTagContactList', e, callback)
|
|
1725
|
+
}
|
|
1726
|
+
},
|
|
1727
|
+
|
|
1728
|
+
tagGroupPayload: async (call, callback) => {
|
|
1729
|
+
log.verbose('PuppetServiceImpl', 'tagGroupPayload()')
|
|
1730
|
+
|
|
1731
|
+
try {
|
|
1732
|
+
const id = call.request.getGroupId()
|
|
1733
|
+
|
|
1734
|
+
const result = await puppet.tagGroupPayloadPuppet(id)
|
|
1735
|
+
const response = new grpcPuppet.TagGroupPayloadResponse()
|
|
1736
|
+
const payload = new grpcPuppet.TagGroupPayload()
|
|
1737
|
+
payload.setId(result.id)
|
|
1738
|
+
payload.setName(result.name)
|
|
1739
|
+
response.setPayload(payload)
|
|
1720
1740
|
|
|
1721
1741
|
return callback(null, response)
|
|
1742
|
+
|
|
1743
|
+
} catch (e) {
|
|
1744
|
+
return grpcError('tagTagContactList', e, callback)
|
|
1745
|
+
}
|
|
1746
|
+
},
|
|
1747
|
+
|
|
1748
|
+
tagPayload: async (call, callback) => {
|
|
1749
|
+
log.verbose('PuppetServiceImpl', 'tagPayload()')
|
|
1750
|
+
|
|
1751
|
+
try {
|
|
1752
|
+
const tag = call.request.getTag()!
|
|
1753
|
+
const id = tag.getId()
|
|
1754
|
+
const groupId = tag.getGroupId() || ''
|
|
1755
|
+
|
|
1756
|
+
const result = await puppet.tagPayloadPuppet({ id, groupId })
|
|
1757
|
+
const response = new grpcPuppet.TagPayloadResponse()
|
|
1758
|
+
const payload = new grpcPuppet.TagPayload()
|
|
1759
|
+
payload.setId(result.id)
|
|
1760
|
+
payload.setName(result.name)
|
|
1761
|
+
payload.setType(result.type)
|
|
1762
|
+
if (result.groupId) {
|
|
1763
|
+
payload.setGroupId(result.groupId)
|
|
1764
|
+
}
|
|
1765
|
+
response.setPayload(payload)
|
|
1766
|
+
|
|
1767
|
+
return callback(null, response)
|
|
1768
|
+
|
|
1722
1769
|
} catch (e) {
|
|
1723
1770
|
return grpcError('tagTagContactList', e, callback)
|
|
1724
1771
|
}
|