diff --git a/.meteor/packages b/.meteor/packages index cd12a6f..2e94f44 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -15,11 +15,12 @@ standard-minifier-css@1.2.0 # CSS minifier run for production mode standard-minifier-js@1.2.0 # JS minifier run for production mode es5-shim@4.6.14 # ECMAScript 5 compatibility for older browsers. -autopublish@1.0.7 # Publish all data to the clients (for prototyping) insecure@1.0.7 # Allow all DB writes from clients (for prototyping) angular2-compilers practicalmeteor:mocha xolvio:cleaner hwillson:stub-collections dispatch:mocha-phantomjs +metemq:metemq@0.5.2 shell-server +autopublish diff --git a/.meteor/versions b/.meteor/versions index 9886afc..bd4048a 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -1,7 +1,10 @@ +accounts-base@1.2.11 +accounts-password@1.3.0 +aldeed:simple-schema@1.5.3 allow-deny@1.0.5 angular2-compilers@0.6.1 autopublish@1.0.7 -autoupdate@1.2.11 +autoupdate@1.3.11 babel-compiler@6.9.1 babel-runtime@0.1.11 barbatus:css-compiler@0.3.0 @@ -14,15 +17,16 @@ binary-heap@1.0.9 blaze@2.1.9 blaze-tools@1.0.10 boilerplate-generator@1.0.10 -caching-compiler@1.0.6 +caching-compiler@1.1.7 caching-html-compiler@1.0.6 callback-hook@1.0.9 check@1.2.3 -coffeescript@1.1.4 +coffeescript@1.2.4_1 ddp@1.2.5 -ddp-client@1.2.9 +ddp-client@1.3.1 ddp-common@1.2.6 -ddp-server@1.2.10 +ddp-rate-limiter@1.0.5 +ddp-server@1.3.10 deps@1.0.12 diff-sequence@1.0.6 dispatch:mocha-phantomjs@0.1.7 @@ -30,20 +34,25 @@ dispatch:phantomjs-tests@0.0.5 ecmascript@0.5.8 ecmascript-runtime@0.3.14 ejson@1.0.12 +email@1.1.17 es5-shim@4.6.14 fastclick@1.0.12 geojson-utils@1.0.9 hot-code-push@1.0.4 html-tools@1.0.11 htmljs@1.0.11 -http@1.1.8 +http@1.2.8 hwillson:stub-collections@1.0.1 id-map@1.0.8 insecure@1.0.7 jquery@1.11.9 launch-screen@1.0.12 livedata@1.0.18 +localstorage@1.0.11 logging@1.1.15 +mdg:validated-method@1.1.0 +mdg:validation-error@0.2.0 +metemq:metemq@0.5.2 meteor@1.2.17 meteor-base@1.0.4 minifier-css@1.2.14 @@ -55,6 +64,7 @@ modules@0.7.6 modules-runtime@0.7.6 mongo@1.1.12 mongo-id@1.0.5 +npm-bcrypt@0.9.1 npm-mongo@1.5.49 observe-sequence@1.0.12 ordered-dict@1.0.8 @@ -65,17 +75,21 @@ practicalmeteor:mocha-core@1.0.1 practicalmeteor:sinon@1.14.1_2 promise@0.8.7 random@1.0.10 +rate-limit@1.0.5 reactive-var@1.0.10 reload@1.1.10 retry@1.0.8 routepolicy@1.0.11 +service-configuration@1.0.10 +sha@1.0.8 shell-server@0.2.1 -spacebars@1.0.13 -spacebars-compiler@1.0.13 +spacebars@1.0.12 +spacebars-compiler@1.0.12 +srp@1.0.9 standard-minifier-css@1.2.0 standard-minifier-js@1.2.0 -templating@1.1.14 -templating-tools@1.0.5 +templating@1.2.14 +templating-tools@1.0.4 tmeasday:test-reporter-helpers@0.2.1 tracker@1.1.0 ui@1.0.12 diff --git a/both/metemq/source.ts b/both/metemq/source.ts new file mode 100644 index 0000000..59b1b0b --- /dev/null +++ b/both/metemq/source.ts @@ -0,0 +1,3 @@ +import { Source } from 'meteor/metemq:metemq'; + +export const source = new Source(); diff --git a/package.json b/package.json index 2057f88..db1383a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "angular2-meteor-polyfills": "^0.1.1", "angular2-meteor-tests-polyfills": "0.0.2", "meteor-node-stubs": "0.2.3", - "meteor-rxjs": "0.1.0", + "meteor-rxjs": "^0.1.0", "reflect-metadata": "^0.1.8", "rxjs": "5.0.0-beta.12", "zone.js": "^0.6.21" diff --git a/server/imports/server-main/main.ts b/server/imports/server-main/main.ts index d4b1cda..ed0dd18 100644 --- a/server/imports/server-main/main.ts +++ b/server/imports/server-main/main.ts @@ -1,27 +1,53 @@ import { DemoCollection } from '../../../both/collections/demo-collection'; import { DemoDataObject } from '../../../both/models/demo-data-object'; +import { source } from '../../../both/metemq/source'; +import { Things } from 'meteor/metemq:metemq'; export class Main { - start(): void { - this.initFakeData(); - } - - initFakeData(): void { - if (DemoCollection.find({}).cursor.count() === 0) { - const data: DemoDataObject[] = [{ - name: 'Dotan', - age: 25 - }, { - name: 'Liran', - age: 26 - }, { - name: 'Uri', - age: 30 - }]; - - data.forEach((obj: DemoDataObject) => { - DemoCollection.insert(obj); - }); + constructor() { + } + + start(): void { + this.initFakeData(); + this.initPublish(); + this.initMethods(); + } + + initPublish(): void { + source.publish('demo', function() { + return DemoCollection.find(); + }, ['name', 'age']); + } + + initMethods(): void { + source.methods({ + hello() { + console.log('Thing says "hello"'); + + const thing = Things.findOne({ _id: this.thingId }); + thing.act('print', 'print this for me...'); + + return 'world!'; + } + }); + } + + initFakeData(): void { + if (DemoCollection.find({}).cursor.count() === 0) { + const data: DemoDataObject[] = [{ + name: 'Dotan', + age: 25 + }, { + name: 'Liran', + age: 26 + }, { + name: 'Uri', + age: 30 + }]; + + data.forEach((obj: DemoDataObject) => { + DemoCollection.insert(obj); + }); + } } - } }