Skip to content

Commit 20d04c4

Browse files
committed
Fix use of observeChanges to observeChangesAsync
1 parent e9ad824 commit 20d04c4

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## v2.0.2 - 2024-08-10
4+
5+
- Fix use of `observeChanges` to `observeChangesAsync`
6+
- Updated `zodern:types` to v1.0.13
7+
38
## v2.0.1 - 2024-07-16
49

510
- Added option to depend on the latest v2 of `aldeed:simple-schema` as well as v1.13.1

package.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* global Package */
22
Package.describe({
33
name: 'freedombase:legal-management',
4-
version: '2.0.1',
4+
version: '2.0.2',
55
summary: 'Manage your legal documents and user consent.',
66
git: 'https://github.com/freedombase/meteor-legal-management',
77
documentation: 'README.md',
@@ -17,7 +17,7 @@ Package.onUse(function (api) {
1717
'ddp',
1818
'typescript',
1919
'callback-hook',
20-
'zodern:types@1.0.11',
20+
'zodern:types@1.0.13',
2121
])
2222
api.use([
2323
'aldeed:collection2@4.0.3',

server/legal-server.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ LegalCollection.createIndexAsync({ documentId: 1 })
2222
*/
2323
Meteor.publish(
2424
'freedombase:legal.getLatest',
25-
function (documentAbbr, language) {
25+
async function (documentAbbr, language) {
2626
check(documentAbbr, String)
2727
check(language, Match.Maybe(String))
2828
const sub = this
2929
const options = { limit: 1, sort: { effectiveAt: -1 } }
3030

31-
const handle = LegalCollection.find(
31+
const cursor = LegalCollection.find(
3232
{ documentAbbr, effectiveAt: { $lte: new Date() } },
3333
options,
34-
).observeChanges({
34+
)
35+
36+
const handle = await cursor.observeChangesAsync({
3537
added(id: string, doc: LegalDocument) {
3638
if (
3739
language &&
@@ -92,15 +94,16 @@ Meteor.publish('freedombase:legal.getLatestTiny', (documentAbbr) => {
9294
*/
9395
Meteor.publish(
9496
'freedombase:legal.getAll',
95-
function (documentAbbr: string, language: string) {
97+
async function (documentAbbr: string, language: string) {
9698
check(documentAbbr, String)
9799
check(language, Match.Maybe(String))
98100
const sub = this
99101

100-
const handle = LegalCollection.find(
102+
const cursor = LegalCollection.find(
101103
{ documentAbbr },
102104
{ sort: { effectiveAt: -1 } },
103-
).observeChanges({
105+
)
106+
const handle = await cursor.observeChangesAsync({
104107
added(id: string, doc: LegalDocument) {
105108
if (language && doc.language !== language && doc.i18n) {
106109
if (doc.i18n[language].title) doc.title = doc.i18n[language].title
@@ -136,16 +139,17 @@ Meteor.publish(
136139
*/
137140
Meteor.publish(
138141
'freedombase:legal.get',
139-
function (documentAbbr: string, version: string, language: string) {
142+
async function (documentAbbr: string, version: string, language: string) {
140143
check(documentAbbr, String)
141144
check(version, String)
142145
check(language, Match.Maybe(String))
143146
const sub = this
144147

145-
const handle = LegalCollection.find(
148+
const cursor = LegalCollection.find(
146149
{ documentAbbr, version },
147150
{ limit: 1, sort: { effectiveAt: -1 } },
148-
).observeChanges({
151+
)
152+
const handle = await cursor.observeChangesAsync({
149153
added(id: string, doc: LegalDocument) {
150154
if (
151155
language &&

0 commit comments

Comments
 (0)