├── .gitignore
├── LICENSE
├── README.md
├── bower.json
├── doc
├── assets
│ ├── css
│ │ ├── main.css
│ │ └── main.css.map
│ ├── images
│ │ ├── icons.png
│ │ ├── icons@2x.png
│ │ ├── streamdataio-logo.png
│ │ ├── widgets.png
│ │ └── widgets@2x.png
│ └── js
│ │ ├── main.js
│ │ └── search.js
├── classes
│ ├── eventtype.html
│ ├── jsonhelper.html
│ ├── listeners.html
│ ├── logger.html
│ ├── preconditions.html
│ ├── streamdata.html
│ ├── streamdataerror.html
│ ├── streamdataeventsource.html
│ ├── streamdataio.html
│ ├── streamdataserver.html
│ ├── streamdataurl.html
│ └── urlhelper.html
├── enums
│ └── loglevel.html
├── globals.html
├── index.html
└── interfaces
│ ├── dataevent.html
│ ├── errorevent.html
│ ├── event.html
│ ├── listener.html
│ ├── monitorevent.html
│ ├── openevent.html
│ ├── patchevent.html
│ ├── streamdataauthstrategy.html
│ └── streamdatawindow.html
├── stockmarket-angular
├── README.md
├── favicon.ico
├── img
│ ├── angular.png
│ ├── info.png
│ ├── spinner.gif
│ └── streamdataio-logo.svg
├── index.html
├── package-lock.json
├── package.json
├── scripts
│ ├── main.js
│ └── streamdataio-auth.min.js
└── styles
│ └── main.css
├── stockmarket-angular2
├── .angular-cli.json
├── .editorconfig
├── .gitignore
├── README.md
├── e2e
│ ├── app.e2e-spec.ts
│ ├── app.po.ts
│ └── tsconfig.e2e.json
├── karma.conf.js
├── package-lock.json
├── package.json
├── protractor.conf.js
├── src
│ ├── app
│ │ ├── app.component.css
│ │ ├── app.component.html
│ │ ├── app.component.spec.ts
│ │ ├── app.component.ts
│ │ └── app.module.ts
│ ├── assets
│ │ ├── .gitkeep
│ │ └── streamdataio-logo.svg
│ ├── environments
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── favicon.ico
│ ├── index.html
│ ├── main.ts
│ ├── polyfills.ts
│ ├── shared
│ │ └── StockMarket.ts
│ ├── styles.css
│ ├── test.ts
│ ├── tsconfig.app.json
│ ├── tsconfig.spec.json
│ └── typings.d.ts
├── tsconfig.json
└── tslint.json
├── stockmarket-angular8
├── .editorconfig
├── .gitignore
├── README.md
├── angular.json
├── browserslist
├── e2e
│ ├── protractor.conf.js
│ ├── src
│ │ ├── app.e2e-spec.ts
│ │ └── app.po.ts
│ └── tsconfig.e2e.json
├── package-lock.json
├── package.json
├── src
│ ├── app
│ │ ├── app.component.css
│ │ ├── app.component.html
│ │ ├── app.component.spec.ts
│ │ ├── app.component.ts
│ │ └── app.module.ts
│ ├── assets
│ │ ├── .gitkeep
│ │ └── streamdataio-logo.svg
│ ├── environments
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── favicon.ico
│ ├── index.html
│ ├── karma.conf.js
│ ├── main.ts
│ ├── polyfills.ts
│ ├── shared
│ │ └── StockMarket.ts
│ ├── styles.css
│ ├── test.ts
│ ├── tsconfig.app.json
│ ├── tsconfig.spec.json
│ └── tslint.json
├── tsconfig.json
└── tslint.json
├── stockmarket-console
├── README.md
├── index.html
├── package-lock.json
└── package.json
├── stockmarket-nodejs
├── .gitignore
├── LICENSE
├── README.md
├── package-lock.json
├── package.json
└── server.js
├── stockmarket-vuejs
├── .babelrc
├── .editorconfig
├── .gitignore
├── .postcssrc.js
├── LICENSE
├── README.md
├── build
│ ├── build.js
│ ├── check-versions.js
│ ├── dev-client.js
│ ├── dev-server.js
│ ├── utils.js
│ ├── vue-loader.conf.js
│ ├── webpack.base.conf.js
│ ├── webpack.dev.conf.js
│ └── webpack.prod.conf.js
├── config
│ ├── dev.env.js
│ ├── index.js
│ └── prod.env.js
├── index.html
├── package-lock.json
├── package.json
├── src
│ ├── App.vue
│ ├── assets
│ │ ├── streamdataio.png
│ │ └── vuejs.png
│ ├── components
│ │ └── Streamdataio.vue
│ └── main.js
└── static
│ └── .gitkeep
└── streamdataio-auth.min.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io
2 |
3 | ### OSX ###
4 | .DS_Store
5 | .AppleDouble
6 | .LSOverride
7 |
8 | # Icon must end with two \r
9 | Icon
10 |
11 |
12 | # Thumbnails
13 | ._*
14 |
15 | # Files that might appear in the root of a volume
16 | .DocumentRevisions-V100
17 | .fseventsd
18 | .Spotlight-V100
19 | .TemporaryItems
20 | .Trashes
21 | .VolumeIcon.icns
22 |
23 | # Directories potentially created on remote AFP share
24 | .AppleDB
25 | .AppleDesktop
26 | Network Trash Folder
27 | Temporary Items
28 | .apdisk
29 |
30 |
31 | ### SublimeText ###
32 | # cache files for sublime text
33 | *.tmlanguage.cache
34 | *.tmPreferences.cache
35 | *.stTheme.cache
36 |
37 | # workspace files are user-specific
38 | *.sublime-workspace
39 |
40 | # project files should be checked into the repository, unless a significant
41 | # proportion of contributors will probably not be using SublimeText
42 | # *.sublime-project
43 |
44 | # sftp configuration file
45 | sftp-config.json
46 |
47 |
48 | ### Emacs ###
49 | # -*- mode: gitignore; -*-
50 | *~
51 | \#*\#
52 | /.emacs.desktop
53 | /.emacs.desktop.lock
54 | *.elc
55 | auto-save-list
56 | tramp
57 | .\#*
58 |
59 | # Org-mode
60 | .org-id-locations
61 | *_archive
62 |
63 | # flymake-mode
64 | *_flymake.*
65 |
66 | # eshell files
67 | /eshell/history
68 | /eshell/lastdir
69 |
70 | # elpa packages
71 | /elpa/
72 |
73 | # reftex files
74 | *.rel
75 |
76 | # AUCTeX auto folder
77 | /auto/
78 |
79 | # cask packages
80 | .cask/
81 |
82 | # Created by https://www.gitignore.io
83 |
84 | ### Intellij ###
85 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
86 |
87 | *.iml
88 |
89 | ## Directory-based project format:
90 | .idea/
91 | # if you remove the above rule, at least ignore the following:
92 |
93 | # User-specific stuff:
94 | # .idea/workspace.xml
95 | # .idea/tasks.xml
96 | # .idea/dictionaries
97 |
98 | # Sensitive or high-churn files:
99 | # .idea/dataSources.ids
100 | # .idea/dataSources.xml
101 | # .idea/sqlDataSources.xml
102 | # .idea/dynamic.xml
103 | # .idea/uiDesigner.xml
104 |
105 | # Gradle:
106 | # .idea/gradle.xml
107 | # .idea/libraries
108 |
109 | # Mongo Explorer plugin:
110 | # .idea/mongoSettings.xml
111 |
112 | ## File-based project format:
113 | *.ipr
114 | *.iws
115 |
116 | ## Plugin-specific files:
117 |
118 | # IntelliJ
119 | /out/
120 |
121 | # mpeltonen/sbt-idea plugin
122 | .idea_modules/
123 |
124 | # JIRA plugin
125 | atlassian-ide-plugin.xml
126 |
127 | # Crashlytics plugin (for Android Studio and IntelliJ)
128 | com_crashlytics_export_strings.xml
129 | crashlytics.properties
130 | crashlytics-build.properties
131 |
132 | **/node_modules
133 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # streamdataio-js
2 | Streamdata.io by Axway (aka AMPLIFY Streams) Javascript SDK package containing SDK, documentation and sample applications.
3 |
4 | The SDK allows the use of the Streams SaaS proxy to get data pushed from various sources and to use them in your application.
5 |
6 | In this directory, you will find:
7 | - a minified version of the SDK for UI (streamdataio-web.min.js) and Node.js (streamdataio-node.min.js)
8 | - the documentation that helps you to understand how it works (doc)
9 | - several sample projects that show how to use this SDK within a Javascript application, using your favorite JS stack
10 | - stockmarket sample shows how to get data from a demo data source returning simulated market data, and bind them to a simple UI using JQuery
11 | - stockmarket-angular is another version of stockmarket projet using AngularJS
12 |
13 | To run a sample and understand how it works, clone the git repository, open the index.html of the sample in your browser (Chrome, Firefox, Safari) and browse the code!
14 |
15 | If you have any questions or feedback, feel free to ask: https://developer.axway.com/
16 |
17 | Enjoy!
18 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "streamdataio-js",
3 | "version": "1.0.2-alpha.1",
4 | "main": "streamdataio.min.js",
5 | "homepage": "https://github.com/streamdataio/streamdataio-js",
6 | "authors": [
7 | "Streamdataio support@streamdata.io"
8 | ],
9 | "description": "Javascript SDK for Streamdata.io",
10 | "keywords": [
11 | "streamdata",
12 | "streamdata.io",
13 | "push",
14 | "sse",
15 | "server-sent-event",
16 | "api",
17 | "streaming"
18 | ],
19 | "license": "Apache 2 License",
20 | "private": false,
21 | "ignore": [
22 | "node_modules",
23 | "bower_components",
24 | "test"
25 | ],
26 | "dependencies": {},
27 | "devDependencies": {}
28 | }
29 |
--------------------------------------------------------------------------------
/doc/assets/images/icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/doc/assets/images/icons.png
--------------------------------------------------------------------------------
/doc/assets/images/icons@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/doc/assets/images/icons@2x.png
--------------------------------------------------------------------------------
/doc/assets/images/streamdataio-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/doc/assets/images/streamdataio-logo.png
--------------------------------------------------------------------------------
/doc/assets/images/widgets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/doc/assets/images/widgets.png
--------------------------------------------------------------------------------
/doc/assets/images/widgets@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/doc/assets/images/widgets@2x.png
--------------------------------------------------------------------------------
/doc/interfaces/dataevent.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
181 |
240 |
241 |
242 |
243 |
244 |
--------------------------------------------------------------------------------
/stockmarket-angular/README.md:
--------------------------------------------------------------------------------
1 | # streamdata-js/stockmarket-angular
2 | This sample application shows how to use the streamdata.io Javascript SDK with AngularJS.
3 |
4 | The streamdata.io JavaScript SDK allows the use of streamdata.io to get data pushed from various sources and use them in your application.
5 |
6 | In a shell terminal, run the commands:
7 |
8 | ```
9 | cd stockmarket-angular
10 | npm install
11 | ```
12 |
13 | This will install the streamdata.io JavaScript SDK and a Json-Patch JavaScript library.
14 |
15 | To run the sample, open the index.html in your browser (Chrome, Firefox, Safari, IE > 10).
16 | You will be asked to fill in you application Token. To get them, connect to the streamdata.io portal and follow the guidelines.
17 |
18 | If you have any questions or feedback, feel free to ask: support@streamdata.io
19 |
20 | Enjoy!
21 |
--------------------------------------------------------------------------------
/stockmarket-angular/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/stockmarket-angular/favicon.ico
--------------------------------------------------------------------------------
/stockmarket-angular/img/angular.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/stockmarket-angular/img/angular.png
--------------------------------------------------------------------------------
/stockmarket-angular/img/info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/stockmarket-angular/img/info.png
--------------------------------------------------------------------------------
/stockmarket-angular/img/spinner.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/stockmarket-angular/img/spinner.gif
--------------------------------------------------------------------------------
/stockmarket-angular/index.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | Streamdata.io Stock-Market
24 |
25 |
26 |
27 |
28 |
29 |
33 |
34 |
35 |
36 |
38 |
39 |
40 |
45 |
46 |
50 |
51 |
52 |
53 |
54 |
55 |
Stock-Market demo with
56 |
57 |
58 |
59 | {{appCtrl.errorMsg}}
60 |
61 |
62 |
63 |
64 |
An application token is required for authentication. Sign Up to get yours.
Disclaimer: data is emulated and does not reflect the actual market data.
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, async } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 | import {MatFormFieldModule} from '@angular/material/form-field';
4 | import {MatButtonModule} from '@angular/material/button';
5 | import {MatIconModule} from '@angular/material/icon';
6 | import {MatInputModule} from '@angular/material/input';
7 | import {MatProgressBarModule} from '@angular/material/progress-bar';
8 | import {MatTableModule} from '@angular/material/table';
9 | import {BrowserModule} from '@angular/platform-browser';
10 | import {FormsModule} from '@angular/forms';
11 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
12 |
13 | describe('AppComponent', () => {
14 | beforeEach(async(() => {
15 | TestBed.configureTestingModule({
16 | declarations: [
17 | AppComponent
18 | ],
19 | imports: [
20 | BrowserModule,
21 | FormsModule,
22 | BrowserAnimationsModule,
23 | MatFormFieldModule,
24 | MatButtonModule,
25 | MatIconModule,
26 | MatInputModule,
27 | MatProgressBarModule,
28 | MatTableModule
29 | ]
30 | }).compileComponents();
31 | }));
32 |
33 | it('should create the app', () => {
34 | const fixture = TestBed.createComponent(AppComponent);
35 | const app = fixture.debugElement.componentInstance;
36 | expect(app).toBeTruthy();
37 | });
38 |
39 | it('should render title in a h3 tag', () => {
40 | const fixture = TestBed.createComponent(AppComponent);
41 | fixture.detectChanges();
42 | const compiled = fixture.debugElement.nativeElement;
43 | expect(compiled.querySelector('h3').textContent).toContain('Stock Market demo');
44 | });
45 |
46 | it(`should have a link to portal for retrieve token'`, () => {
47 | const fixture = TestBed.createComponent(AppComponent);
48 | fixture.detectChanges();
49 | const compiled = fixture.debugElement.nativeElement;
50 | expect(compiled.querySelector('a').href).toContain('https://portal.streamdata.io/#/register');
51 | });
52 | });
53 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import {Component} from '@angular/core';
2 | import {StreamData, StreamDataError, StreamDataIo} from 'streamdataio-js-sdk';
3 | import {applyPatch} from 'fast-json-patch';
4 | import {StockMarket} from '../shared/StockMarket';
5 | import {cloneDeep} from 'lodash';
6 |
7 | @Component({
8 | selector: 'app-root',
9 | templateUrl: './app.component.html',
10 | styleUrls: ['./app.component.css']
11 | })
12 |
13 | export class AppComponent {
14 | // Private
15 | private streamData: StreamData;
16 | // Public for bunding
17 | dataSource;
18 | token: string = "";
19 |
20 | url: string = "http://stockmarket.streamdata.io/v2/prices";
21 | result: StockMarket[];
22 | previousResult: StockMarket[];
23 |
24 | columns: Array = [
25 | { name: 'title', label: 'Title' },
26 | { name: 'company', label: 'Company' },
27 | { name: 'ticker', label: 'Ticker' },
28 | { name: 'last', label: 'Last' },
29 | { name: 'source', label: 'Source' },
30 | { name: 'volume', label: 'Volume' },
31 | { name: 'dt', label: 'Timestamp' }
32 | ];
33 |
34 | displayedColumns: string[] = this.columns.map(column => column.name);
35 |
36 | public connect(): void {
37 |
38 | // If ever you wish to get the whole data instead of patches:
39 | // headers = ["Accept: application/json"];
40 | let headers = [];
41 |
42 | if (this.isConnected) {
43 | this.streamData.close();
44 | }
45 |
46 | this.streamData = StreamDataIo.createEventSource(this.url, this.token, headers);
47 |
48 | this.streamData
49 | .onOpen(() => {
50 | console.log('--------------- stream opened ---------------');
51 | // you can also add custom behavior when the stream is opened
52 | this.updatePreviousResult([]);
53 | this.result = [];
54 | })
55 | .onData((data: StockMarket[]) => {
56 | console.log('--------------- snapshot received ---------------');
57 | this.updatePreviousResult(data);
58 | // initialize your data with the initial snapshot
59 | this.result = data;
60 | }, this)
61 | .onPatch((patch) => {
62 | console.log('--------------- patch received ---------------');
63 | this.updatePreviousResult(this.result);
64 | // update the data with the provided patch
65 | applyPatch(this.result, patch);
66 | }, this)
67 | .onError((error: StreamDataError) => {
68 | console.log('--------------- error received ---------------');
69 | // do whatever you need in case of error
70 | console.log('error: %o', error);
71 | this.streamData.close();
72 | console.log('--------------- stream closed ---------------');
73 | });
74 |
75 | this.streamData.open();
76 | }
77 |
78 | public updatePreviousResult(value: StockMarket[]): void {
79 | // Store values to enable changes indicators
80 | this.previousResult = cloneDeep(value);
81 |
82 | setTimeout(() => {
83 | // Forgot previous values to disable changes indicators
84 | this.previousResult = this.result;
85 | }, 1000);
86 |
87 | }
88 |
89 | public disconnect(): void {
90 | this.streamData && this.streamData.close();
91 | this.streamData = null;
92 | }
93 |
94 | public get isConnected(): boolean {
95 | return !!this.streamData && this.streamData.isConnected();
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import {BrowserModule} from '@angular/platform-browser';
2 | import {NgModule} from '@angular/core';
3 | import {FormsModule} from '@angular/forms';
4 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
5 | import { MatButtonModule } from '@angular/material/button';
6 | import { MatIconModule } from '@angular/material/icon';
7 | import { MatInputModule } from '@angular/material/input';
8 | import { MatProgressBarModule } from '@angular/material/progress-bar';
9 | import { MatTableModule } from '@angular/material/table';
10 | import {AppComponent} from './app.component';
11 | import {MatFormFieldModule} from '@angular/material/form-field';
12 |
13 | @NgModule({
14 | declarations: [
15 | AppComponent
16 | ],
17 | imports: [
18 | BrowserModule,
19 | FormsModule,
20 | BrowserAnimationsModule,
21 | MatFormFieldModule,
22 | MatButtonModule,
23 | MatIconModule,
24 | MatInputModule,
25 | MatProgressBarModule,
26 | MatTableModule
27 | ],
28 | providers: [],
29 | bootstrap: [AppComponent]
30 | })
31 | export class AppModule {
32 | }
33 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/stockmarket-angular8/src/assets/.gitkeep
--------------------------------------------------------------------------------
/stockmarket-angular8/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axway-streams/axway-amplify-streams-js/d8ee9481907ea9e7556f3eab73224838b881276a/stockmarket-angular8/src/favicon.ico
--------------------------------------------------------------------------------
/stockmarket-angular8/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Stock Market demo
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage'),
20 | reports: ['html', 'lcovonly', 'text-summary'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false
30 | });
31 | };
--------------------------------------------------------------------------------
/stockmarket-angular8/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /**
38 | * If the application will be indexed by Google Search, the following is required.
39 | * Googlebot uses a renderer based on Chrome 41.
40 | * https://developers.google.com/search/docs/guides/rendering
41 | **/
42 | // import 'core-js/es6/array';
43 |
44 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
45 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
46 |
47 | /** IE10 and IE11 requires the following for the Reflect API. */
48 | // import 'core-js/es6/reflect';
49 |
50 | /**
51 | * Web Animations `@angular/platform-browser/animations`
52 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
53 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
54 | **/
55 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
56 |
57 | /**
58 | * By default, zone.js will patch all possible macroTask and DomEvents
59 | * user can disable parts of macroTask/DomEvents patch by setting following flags
60 | * because those flags need to be set before `zone.js` being loaded, and webpack
61 | * will put import in the top of bundle, so user need to create a separate file
62 | * in this directory (for example: zone-flags.ts), and put the following flags
63 | * into that file, and then add the following code before importing zone.js.
64 | * import './zone-flags.ts';
65 | *
66 | * The flags allowed in zone-flags.ts are listed here.
67 | *
68 | * The following flags will work for all browsers.
69 | *
70 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
71 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
72 | * (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
73 | *
74 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
75 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
76 | *
77 | * (window as any).__Zone_enable_cross_context_check = true;
78 | *
79 | */
80 |
81 | /***************************************************************************************************
82 | * Zone JS is required by default for Angular itself.
83 | */
84 | import 'zone.js/dist/zone'; // Included with Angular CLI.
85 |
86 |
87 | /***************************************************************************************************
88 | * APPLICATION IMPORTS
89 | */
90 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/shared/StockMarket.ts:
--------------------------------------------------------------------------------
1 | export interface StockMarket {
2 |
3 | title: string;
4 | company: string;
5 | ticker: string;
6 | source: string;
7 | last: number;
8 | dt: string;
9 | volume: number;
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 | @import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
--------------------------------------------------------------------------------
/stockmarket-angular8/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "types": []
6 | },
7 | "exclude": [
8 | "test.ts",
9 | "**/*.spec.ts"
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "test.ts",
12 | "polyfills.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/stockmarket-angular8/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/stockmarket-angular8/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "downlevelIteration": true,
6 | "outDir": "./dist/out-tsc",
7 | "sourceMap": true,
8 | "declaration": false,
9 | "module": "esnext",
10 | "moduleResolution": "node",
11 | "emitDecoratorMetadata": true,
12 | "experimentalDecorators": true,
13 | "importHelpers": true,
14 | "target": "es2015",
15 | "typeRoots": [
16 | "node_modules/@types"
17 | ],
18 | "lib": [
19 | "es2018",
20 | "dom"
21 | ]
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/stockmarket-angular8/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "codelyzer"
4 | ],
5 | "rules": {
6 | "arrow-return-shorthand": true,
7 | "callable-types": true,
8 | "class-name": true,
9 | "comment-format": [
10 | true,
11 | "check-space"
12 | ],
13 | "curly": true,
14 | "deprecation": {
15 | "severity": "warn"
16 | },
17 | "eofline": true,
18 | "forin": true,
19 | "import-blacklist": [
20 | true,
21 | "rxjs/Rx"
22 | ],
23 | "import-spacing": true,
24 | "indent": [
25 | true,
26 | "spaces"
27 | ],
28 | "interface-over-type-literal": true,
29 | "label-position": true,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-arg": true,
47 | "no-bitwise": true,
48 | "no-console": [
49 | true,
50 | "debug",
51 | "info",
52 | "time",
53 | "timeEnd",
54 | "trace"
55 | ],
56 | "no-construct": true,
57 | "no-debugger": true,
58 | "no-duplicate-super": true,
59 | "no-empty": false,
60 | "no-empty-interface": true,
61 | "no-eval": true,
62 | "no-inferrable-types": [
63 | true,
64 | "ignore-params"
65 | ],
66 | "no-misused-new": true,
67 | "no-non-null-assertion": true,
68 | "no-redundant-jsdoc": true,
69 | "no-shadowed-variable": true,
70 | "no-string-literal": false,
71 | "no-string-throw": true,
72 | "no-switch-case-fall-through": true,
73 | "no-trailing-whitespace": true,
74 | "no-unnecessary-initializer": true,
75 | "no-unused-expression": true,
76 | "no-use-before-declare": true,
77 | "no-var-keyword": true,
78 | "object-literal-sort-keys": false,
79 | "one-line": [
80 | true,
81 | "check-open-brace",
82 | "check-catch",
83 | "check-else",
84 | "check-whitespace"
85 | ],
86 | "prefer-const": true,
87 | "quotemark": [
88 | true,
89 | "single"
90 | ],
91 | "radix": true,
92 | "semicolon": [
93 | true,
94 | "always"
95 | ],
96 | "triple-equals": [
97 | true,
98 | "allow-null-check"
99 | ],
100 | "typedef-whitespace": [
101 | true,
102 | {
103 | "call-signature": "nospace",
104 | "index-signature": "nospace",
105 | "parameter": "nospace",
106 | "property-declaration": "nospace",
107 | "variable-declaration": "nospace"
108 | }
109 | ],
110 | "unified-signatures": true,
111 | "variable-name": false,
112 | "whitespace": [
113 | true,
114 | "check-branch",
115 | "check-decl",
116 | "check-operator",
117 | "check-separator",
118 | "check-type"
119 | ],
120 | "no-output-on-prefix": true,
121 | "no-inputs-metadata-property": true,
122 | "no-outputs-metadata-property": true,
123 | "no-host-metadata-property": true,
124 | "no-input-rename": true,
125 | "no-output-rename": true,
126 | "use-lifecycle-interface": true,
127 | "use-pipe-transform-interface": true,
128 | "component-class-suffix": true,
129 | "directive-class-suffix": true
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/stockmarket-console/README.md:
--------------------------------------------------------------------------------
1 | # streamdata-js/stockmarket-console
2 |
3 | This sample application shows how to use the streamdata.io Javascript SDK.
4 |
5 | The streamdata.io JavaScript SDK allows the use of streamdata.io to get data pushed from various sources and use them in your application.
6 |
7 | Edit the `index.html` and replace:
8 |
9 | `var token = "";`
10 |
11 | with your streamdata.io token you can get at streamdata.io portal.
12 |
13 | In a shell terminal, run the commands:
14 |
15 | ```
16 | cd stockmarket-console
17 | npm install
18 | ```
19 |
20 | This will install the streamdata.io JavaScript SDK and a Json-Patch JavaScript library.
21 |
22 | Then, to run the sample, open the `index.html` in your browser (Chrome, Firefox, Safari, IE > 10) and the web console of the developers tools of your browser.
23 |
24 | **You should see data and patches printed in the console** (if the web console has not been open first, you may have missed the first data: in this case, refresh the page or open the web console before the `index.html`).
25 |
26 | If you have any questions or feedback, feel free to ask: support@streamdata.io
27 |
28 | Enjoy!
29 |
--------------------------------------------------------------------------------
/stockmarket-console/index.html:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 | Streamdataio Demo
21 |
22 |
23 |
Hello! Open the web console of your browser to see the results!
24 |
25 |
26 |
27 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/stockmarket-console/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "streamdataio-console",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "dependencies": {
6 | "core-js": {
7 | "version": "2.5.1",
8 | "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
9 | "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs="
10 | },
11 | "deep-equal": {
12 | "version": "1.0.1",
13 | "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
14 | "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU="
15 | },
16 | "eventsource": {
17 | "version": "github:streamdataio/eventsource-js#92ceda879f6d4e6d45fd6bb6fc82ca12a0c2c5db"
18 | },
19 | "eventsource-polyfill": {
20 | "version": "github:streamdataio/EventSource#bc353046d1eef182642e1d85deb442a3fd62849e"
21 | },
22 | "fast-json-patch": {
23 | "version": "2.0.6",
24 | "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.0.6.tgz",
25 | "integrity": "sha1-hv/4+GYjkaqBlyKGTWMuYD5u5gU="
26 | },
27 | "original": {
28 | "version": "1.0.0",
29 | "resolved": "https://registry.npmjs.org/original/-/original-1.0.0.tgz",
30 | "integrity": "sha1-kUf5P6FpbQS+YeAb1QuurKZWvTs="
31 | },
32 | "querystringify": {
33 | "version": "0.0.4",
34 | "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-0.0.4.tgz",
35 | "integrity": "sha1-DPf4T5Rj/wrlHExLFC2VvjdyTZw="
36 | },
37 | "requires-port": {
38 | "version": "1.0.0",
39 | "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
40 | "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
41 | },
42 | "streamdataio-js-sdk": {
43 | "version": "2.0.2",
44 | "resolved": "https://registry.npmjs.org/streamdataio-js-sdk/-/streamdataio-js-sdk-2.0.2.tgz",
45 | "integrity": "sha512-Fw0Y5owXy1aTEqOy1YTtZIFEDTg32PeTkAK2X3k3rVSZkLx2KHvswzbV17CvC6zzuvfXFJo4AVxo9RazzHKzbQ=="
46 | },
47 | "url-parse": {
48 | "version": "1.0.5",
49 | "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.0.5.tgz",
50 | "integrity": "sha1-CFSGBCKv3P7+tsllxmLUgAFpkns="
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/stockmarket-console/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "streamdataio-console",
3 | "version": "1.0.0",
4 | "description": "Sample with web console of the Streamdata.io Javascript SDK",
5 | "keywords": [
6 | "streamdata",
7 | "streamdata.io",
8 | "push",
9 | "sse",
10 | "server-sent-event",
11 | "api",
12 | "streaming"
13 | ],
14 | "author": "Streamdataio support@streamdata.io",
15 | "license": "Apache-2.0",
16 | "dependencies": {
17 | "fast-json-patch": "^2.0.3",
18 | "streamdataio-js-sdk": "^2.0.2"
19 | },
20 | "devDependencies": {
21 | "eventsource": "^1.0.4"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/stockmarket-nodejs/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 |
5 | # Runtime data
6 | pids
7 | *.pid
8 | *.seed
9 |
10 | # Directory for instrumented libs generated by jscoverage/JSCover
11 | lib-cov
12 |
13 | # Coverage directory used by tools like istanbul
14 | coverage
15 |
16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17 | .grunt
18 |
19 | # node-waf configuration
20 | .lock-wscript
21 |
22 | # Compiled binary addons (http://nodejs.org/api/addons.html)
23 | build/Release
24 |
25 | # Dependency directory
26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27 | node_modules
28 |
29 | .idea
30 | *.iml
31 |
--------------------------------------------------------------------------------
/stockmarket-nodejs/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/stockmarket-nodejs/README.md:
--------------------------------------------------------------------------------
1 | # Simple node.js app using streamdata.io
2 |
3 | ## Step by step setup
4 |
5 | 1. Create an free account on streamdata.io https://portal.streamdata.io/#/register to get an App token.
6 |
7 | 2. Edit server.js and replace ```[YOUR_STREAMDATAIO_APP_TOKEN]``` with your App token.
8 |
9 | 3. Make sure you have Node version 0.11.5 or later installed
10 |
11 | 4. Install node dependencies by running in a terminal:
12 |
13 | ```
14 | npm install
15 | ```
16 |
17 | 5. Launch node in a terminal:
18 |
19 | ```
20 | node server.js
21 | ```
22 |
23 | You should see data and patches pushed in your application and displayed on your terminal.
24 |
25 | you can use the provided demo example API which simulates updating stocks prices from a financial market:
26 | 'http://stockmarket.streamdata.io/v2/prices'
27 |
28 | Feel free to test it with any REST/Json API of your choice.
29 |
--------------------------------------------------------------------------------
/stockmarket-nodejs/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "stockmarket-nodejs",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "dependencies": {
6 | "core-js": {
7 | "version": "2.5.1",
8 | "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
9 | "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs="
10 | },
11 | "crypto-js": {
12 | "version": "3.1.9-1",
13 | "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz",
14 | "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg="
15 | },
16 | "deep-equal": {
17 | "version": "1.0.1",
18 | "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
19 | "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU="
20 | },
21 | "eventsource": {
22 | "version": "github:streamdataio/eventsource-js#92ceda879f6d4e6d45fd6bb6fc82ca12a0c2c5db"
23 | },
24 | "eventsource-polyfill": {
25 | "version": "github:streamdataio/EventSource#bc353046d1eef182642e1d85deb442a3fd62849e"
26 | },
27 | "fast-json-patch": {
28 | "version": "2.0.6",
29 | "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.0.6.tgz",
30 | "integrity": "sha1-hv/4+GYjkaqBlyKGTWMuYD5u5gU="
31 | },
32 | "node-print": {
33 | "version": "0.0.4",
34 | "resolved": "https://registry.npmjs.org/node-print/-/node-print-0.0.4.tgz",
35 | "integrity": "sha1-5kxpiG4C5HzriWTz7SvepRRwgHY="
36 | },
37 | "original": {
38 | "version": "1.0.0",
39 | "resolved": "https://registry.npmjs.org/original/-/original-1.0.0.tgz",
40 | "integrity": "sha1-kUf5P6FpbQS+YeAb1QuurKZWvTs="
41 | },
42 | "querystringify": {
43 | "version": "0.0.4",
44 | "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-0.0.4.tgz",
45 | "integrity": "sha1-DPf4T5Rj/wrlHExLFC2VvjdyTZw="
46 | },
47 | "requires-port": {
48 | "version": "1.0.0",
49 | "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
50 | "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
51 | },
52 | "streamdataio-js-sdk": {
53 | "version": "2.0.2",
54 | "resolved": "https://registry.npmjs.org/streamdataio-js-sdk/-/streamdataio-js-sdk-2.0.2.tgz",
55 | "integrity": "sha512-Fw0Y5owXy1aTEqOy1YTtZIFEDTg32PeTkAK2X3k3rVSZkLx2KHvswzbV17CvC6zzuvfXFJo4AVxo9RazzHKzbQ=="
56 | },
57 | "streamdataio-js-sdk-auth": {
58 | "version": "2.0.0",
59 | "resolved": "https://registry.npmjs.org/streamdataio-js-sdk-auth/-/streamdataio-js-sdk-auth-2.0.0.tgz",
60 | "integrity": "sha512-y89ECCkmQubmeeJq5QZWRoI03B5w47xzaS9XxlvyCecWIgeWUS5NV1tbZ8P8YCq1eMeoykeaP430gxG3pggmiA=="
61 | },
62 | "url-parse": {
63 | "version": "1.0.5",
64 | "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.0.5.tgz",
65 | "integrity": "sha1-CFSGBCKv3P7+tsllxmLUgAFpkns="
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/stockmarket-nodejs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "stockmarket-nodejs",
3 | "version": "1.0.0",
4 | "description": "Simple node.js app using streamdata.io",
5 | "main": "server.js",
6 | "scripts": {
7 | "start": "node server.js",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "author": "",
11 | "license": "Apache 2 License",
12 | "dependencies": {
13 | "fast-json-patch": "^2.0.3",
14 | "node-print": "0.0.4",
15 | "streamdataio-js-sdk": "^2.0.2",
16 | "streamdataio-js-sdk-auth": "^2.0.0"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/stockmarket-nodejs/server.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2016 Streamdata.io
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // add EventSource dependency
18 | var streamdataio = require('streamdataio-js-sdk/dist/bundles/streamdataio-node');
19 | var AuthStrategy = require('streamdataio-js-sdk-auth');
20 | // add json patch dependency
21 | var jsonPatch = require('fast-json-patch');
22 | var print = require('node-print');
23 |
24 | function server()
25 | {
26 | // targetUrl is the JSON API you wish to stream
27 | // you can use this example API which simulates updating stocks prices from a financial market
28 | var targetUrl = 'http://stockmarket.streamdata.io/v2/prices';
29 |
30 | // appToken is the way Streamdata.io authenticates you as a valid user.
31 | // you MUST provide a valid token for your request to go through.
32 | var appToken = '[YOUR_STREAMDATAIO_APP_TOKEN]';
33 | var privateKey = '[YOUR_STREAMDATAIO_APP_PRIVATE_KEY]';
34 |
35 | eventSource =
36 | streamdataio.createEventSource(targetUrl, appToken, [], AuthStrategy.newSignatureStrategy(appToken, privateKey));
37 | var result = [];
38 |
39 | eventSource
40 | // the standard 'open' callback will be called when connection is established with the server
41 | .onOpen(function ()
42 | {
43 | console.log("connected!");
44 | })
45 | // the streamdata.io specific 'data' event will be called when a fresh Json data set
46 | // is pushed by Streamdata.io coming from the API
47 | .onData(function (data)
48 | {
49 | console.log("data received");
50 | // memorize the fresh data set
51 | result = data;
52 | print.printTable(result);
53 | })
54 | // the streamdata.io specific 'patch' event will be called when a fresh Json patch
55 | // is pushed by streamdata.io from the API. This patch has to be applied to the
56 | // latest data set provided.
57 | .onPatch(function (patch)
58 | {
59 | // display the patch
60 | console.log("patch: ", patch);
61 | // apply the patch to data using json patch API
62 | jsonPatch.applyPatch(result, patch);
63 | // do whatever you wish with the update data
64 | print.printTable(result);
65 |
66 | })
67 |
68 | // the standard 'error' callback will be called when an error occur with the evenSource
69 | // for example with an invalid token provided
70 | .onError(function (error)
71 | {
72 | console.log('ERROR!', error);
73 | eventSource.close();
74 |
75 | });
76 |
77 | eventSource.open();
78 |
79 | }
80 |
81 | console.log('starting');
82 | server();
83 |
84 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", { "modules": false }],
4 | "stage-2"
5 | ],
6 | "plugins": ["transform-runtime"],
7 | "comments": false,
8 | "env": {
9 | "test": {
10 | "presets": ["env", "stage-2"],
11 | "plugins": [ "istanbul" ]
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .idea
3 | *.iml
4 | node_modules/
5 | dist/
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | // to edit target browsers: use "browserlist" field in package.json
6 | "autoprefixer": {}
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/README.md:
--------------------------------------------------------------------------------
1 | # Axway AMPLIFY Streams Vue.js
2 |
3 | This sample application shows how to use the Axway AMPLIFY Streams Javascript SDK with Vue.js.
4 |
5 | The Axway AMPLIFY Streams JavaScript SDK allows the use of [Axway AMPLIFY Streams](https://streamdata.io) to get data pushed from various sources and use them in your application.
6 |
7 | This project was create with [Vue CLI](https://github.com/vuejs/vue-cli) version 2.8.0
8 |
9 | ## Build Setup
10 |
11 | ``` bash
12 | # install dependencies
13 | npm install
14 |
15 | # serve with hot reload at localhost:8080
16 | npm run dev
17 |
18 | # build for production with minification
19 | npm run build
20 |
21 | # build for production and view the bundle analyzer report
22 | npm run build --report
23 | ```
24 |
25 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
26 |
27 | ## Run the demo
28 |
29 | After running the server with npm run dev, navigate to localhost:8080. You will need to enter your Axway AMPLIFY Streams token. If you don't have one, you can get it for free at [Axway AMPLIFY Streams portal](https://portal.streamdata.io).
30 |
31 | This demo uses fake market data emulated by our public API : http://stockmarket.streamdata.io/v2/prices
32 |
33 | ## Contributing
34 |
35 | Please read [Contributing.md](https://github.com/axway-amplify-streams/Common/blob/master/Contributing.md) for details on our code of conduct, and the process for submitting pull requests to us.
36 |
37 | ## Team
38 |
39 | ![alt text][Axwaylogo] Axway Team
40 |
41 | [Axwaylogo]: https://github.com/axway-amplify-streams/Common/blob/master/img/AxwayLogoSmall.png "Axway logo"
42 |
43 | ## License
44 |
45 | [Apache License 2.0](https://github.com/axway-amplify-streams/Common/blob/master/LICENSE)
46 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/build.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 |
3 | process.env.NODE_ENV = 'production'
4 |
5 | var ora = require('ora')
6 | var rm = require('rimraf')
7 | var path = require('path')
8 | var chalk = require('chalk')
9 | var webpack = require('webpack')
10 | var config = require('../config')
11 | var webpackConfig = require('./webpack.prod.conf')
12 |
13 | var spinner = ora('building for production...')
14 | spinner.start()
15 |
16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
17 | if (err) throw err
18 | webpack(webpackConfig, function (err, stats) {
19 | spinner.stop()
20 | if (err) throw err
21 | process.stdout.write(stats.toString({
22 | colors: true,
23 | modules: false,
24 | children: false,
25 | chunks: false,
26 | chunkModules: false
27 | }) + '\n\n')
28 |
29 | console.log(chalk.cyan(' Build complete.\n'))
30 | console.log(chalk.yellow(
31 | ' Tip: built files are meant to be served over an HTTP server.\n' +
32 | ' Opening index.html over file:// won\'t work.\n'
33 | ))
34 | })
35 | })
36 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/check-versions.js:
--------------------------------------------------------------------------------
1 | var chalk = require('chalk')
2 | var semver = require('semver')
3 | var packageConfig = require('../package.json')
4 | var shell = require('shelljs')
5 | function exec (cmd) {
6 | return require('child_process').execSync(cmd).toString().trim()
7 | }
8 |
9 | var versionRequirements = [
10 | {
11 | name: 'node',
12 | currentVersion: semver.clean(process.version),
13 | versionRequirement: packageConfig.engines.node
14 | },
15 | ]
16 |
17 | if (shell.which('npm')) {
18 | versionRequirements.push({
19 | name: 'npm',
20 | currentVersion: exec('npm --version'),
21 | versionRequirement: packageConfig.engines.npm
22 | })
23 | }
24 |
25 | module.exports = function () {
26 | var warnings = []
27 | for (var i = 0; i < versionRequirements.length; i++) {
28 | var mod = versionRequirements[i]
29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
30 | warnings.push(mod.name + ': ' +
31 | chalk.red(mod.currentVersion) + ' should be ' +
32 | chalk.green(mod.versionRequirement)
33 | )
34 | }
35 | }
36 |
37 | if (warnings.length) {
38 | console.log('')
39 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
40 | console.log()
41 | for (var i = 0; i < warnings.length; i++) {
42 | var warning = warnings[i]
43 | console.log(' ' + warning)
44 | }
45 | console.log()
46 | process.exit(1)
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | require('eventsource-polyfill')
3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4 |
5 | hotClient.subscribe(function (event) {
6 | if (event.action === 'reload') {
7 | window.location.reload()
8 | }
9 | })
10 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/dev-server.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 |
3 | var config = require('../config')
4 | if (!process.env.NODE_ENV) {
5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
6 | }
7 |
8 | var opn = require('opn')
9 | var path = require('path')
10 | var express = require('express')
11 | var webpack = require('webpack')
12 | var proxyMiddleware = require('http-proxy-middleware')
13 | var webpackConfig = require('./webpack.dev.conf')
14 |
15 | // default port where dev server listens for incoming traffic
16 | var port = process.env.PORT || config.dev.port
17 | // automatically open browser, if not set will be false
18 | var autoOpenBrowser = !!config.dev.autoOpenBrowser
19 | // Define HTTP proxies to your custom API backend
20 | // https://github.com/chimurai/http-proxy-middleware
21 | var proxyTable = config.dev.proxyTable
22 |
23 | var app = express()
24 | var compiler = webpack(webpackConfig)
25 |
26 | var devMiddleware = require('webpack-dev-middleware')(compiler, {
27 | publicPath: webpackConfig.output.publicPath,
28 | quiet: true
29 | })
30 |
31 | var hotMiddleware = require('webpack-hot-middleware')(compiler, {
32 | log: () => {}
33 | })
34 | // force page reload when html-webpack-plugin template changes
35 | compiler.plugin('compilation', function (compilation) {
36 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
37 | hotMiddleware.publish({ action: 'reload' })
38 | cb()
39 | })
40 | })
41 |
42 | // proxy api requests
43 | Object.keys(proxyTable).forEach(function (context) {
44 | var options = proxyTable[context]
45 | if (typeof options === 'string') {
46 | options = { target: options }
47 | }
48 | app.use(proxyMiddleware(options.filter || context, options))
49 | })
50 |
51 | // handle fallback for HTML5 history API
52 | app.use(require('connect-history-api-fallback')())
53 |
54 | // serve webpack bundle output
55 | app.use(devMiddleware)
56 |
57 | // enable hot-reload and state-preserving
58 | // compilation error display
59 | app.use(hotMiddleware)
60 |
61 | // serve pure static assets
62 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
63 | app.use(staticPath, express.static('./static'))
64 |
65 | var uri = 'http://localhost:' + port
66 |
67 | var _resolve
68 | var readyPromise = new Promise(resolve => {
69 | _resolve = resolve
70 | })
71 |
72 | console.log('> Starting dev server...')
73 | devMiddleware.waitUntilValid(() => {
74 | console.log('> Listening at ' + uri + '\n')
75 | // when env is testing, don't need open it
76 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
77 | opn(uri)
78 | }
79 | _resolve()
80 | })
81 |
82 | var server = app.listen(port)
83 |
84 | module.exports = {
85 | ready: readyPromise,
86 | close: () => {
87 | server.close()
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/utils.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var config = require('../config')
3 | var ExtractTextPlugin = require('extract-text-webpack-plugin')
4 |
5 | exports.assetsPath = function (_path) {
6 | var assetsSubDirectory = process.env.NODE_ENV === 'production'
7 | ? config.build.assetsSubDirectory
8 | : config.dev.assetsSubDirectory
9 | return path.posix.join(assetsSubDirectory, _path)
10 | }
11 |
12 | exports.cssLoaders = function (options) {
13 | options = options || {}
14 |
15 | var cssLoader = {
16 | loader: 'css-loader',
17 | options: {
18 | minimize: process.env.NODE_ENV === 'production',
19 | sourceMap: options.sourceMap
20 | }
21 | }
22 |
23 | // generate loader string to be used with extract text plugin
24 | function generateLoaders (loader, loaderOptions) {
25 | var loaders = [cssLoader]
26 | if (loader) {
27 | loaders.push({
28 | loader: loader + '-loader',
29 | options: Object.assign({}, loaderOptions, {
30 | sourceMap: options.sourceMap
31 | })
32 | })
33 | }
34 |
35 | // Extract CSS when that option is specified
36 | // (which is the case during production build)
37 | if (options.extract) {
38 | return ExtractTextPlugin.extract({
39 | use: loaders,
40 | fallback: 'vue-style-loader'
41 | })
42 | } else {
43 | return ['vue-style-loader'].concat(loaders)
44 | }
45 | }
46 |
47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html
48 | return {
49 | css: generateLoaders(),
50 | postcss: generateLoaders(),
51 | less: generateLoaders('less'),
52 | sass: generateLoaders('sass', { indentedSyntax: true }),
53 | scss: generateLoaders('sass'),
54 | stylus: generateLoaders('stylus'),
55 | styl: generateLoaders('stylus')
56 | }
57 | }
58 |
59 | // Generate loaders for standalone style files (outside of .vue)
60 | exports.styleLoaders = function (options) {
61 | var output = []
62 | var loaders = exports.cssLoaders(options)
63 | for (var extension in loaders) {
64 | var loader = loaders[extension]
65 | output.push({
66 | test: new RegExp('\\.' + extension + '$'),
67 | use: loader
68 | })
69 | }
70 | return output
71 | }
72 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/vue-loader.conf.js:
--------------------------------------------------------------------------------
1 | var utils = require('./utils')
2 | var config = require('../config')
3 | var isProduction = process.env.NODE_ENV === 'production'
4 |
5 | module.exports = {
6 | loaders: utils.cssLoaders({
7 | sourceMap: isProduction
8 | ? config.build.productionSourceMap
9 | : config.dev.cssSourceMap,
10 | extract: isProduction
11 | })
12 | }
13 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var utils = require('./utils')
3 | var config = require('../config')
4 | var vueLoaderConfig = require('./vue-loader.conf')
5 |
6 | function resolve (dir) {
7 | return path.join(__dirname, '..', dir)
8 | }
9 |
10 | module.exports = {
11 | entry: {
12 | app: './src/main.js'
13 | },
14 | output: {
15 | path: config.build.assetsRoot,
16 | filename: '[name].js',
17 | publicPath: process.env.NODE_ENV === 'production'
18 | ? config.build.assetsPublicPath
19 | : config.dev.assetsPublicPath
20 | },
21 | resolve: {
22 | extensions: ['.js', '.vue', '.json'],
23 | alias: {
24 | 'vue$': 'vue/dist/vue.esm.js',
25 | '@': resolve('src')
26 | }
27 | },
28 | module: {
29 | rules: [
30 | {
31 | test: /\.vue$/,
32 | loader: 'vue-loader',
33 | options: vueLoaderConfig
34 | },
35 | {
36 | test: /\.js$/,
37 | loader: 'babel-loader',
38 | include: [resolve('src'), resolve('test')]
39 | },
40 | {
41 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
42 | loader: 'url-loader',
43 | options: {
44 | limit: 10000,
45 | name: utils.assetsPath('img/[name].[hash:7].[ext]')
46 | }
47 | },
48 | {
49 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
50 | loader: 'url-loader',
51 | options: {
52 | limit: 10000,
53 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
54 | }
55 | }
56 | ]
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | var utils = require('./utils')
2 | var webpack = require('webpack')
3 | var config = require('../config')
4 | var merge = require('webpack-merge')
5 | var baseWebpackConfig = require('./webpack.base.conf')
6 | var HtmlWebpackPlugin = require('html-webpack-plugin')
7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
8 |
9 | // add hot-reload related code to entry chunks
10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) {
11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
12 | })
13 |
14 | module.exports = merge(baseWebpackConfig, {
15 | module: {
16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
17 | },
18 | // cheap-module-eval-source-map is faster for development
19 | devtool: '#cheap-module-eval-source-map',
20 | plugins: [
21 | new webpack.DefinePlugin({
22 | 'process.env': config.dev.env
23 | }),
24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
25 | new webpack.HotModuleReplacementPlugin(),
26 | new webpack.NoEmitOnErrorsPlugin(),
27 | // https://github.com/ampedandwired/html-webpack-plugin
28 | new HtmlWebpackPlugin({
29 | filename: 'index.html',
30 | template: 'index.html',
31 | inject: true
32 | }),
33 | new FriendlyErrorsPlugin()
34 | ]
35 | })
36 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/build/webpack.prod.conf.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var utils = require('./utils')
3 | var webpack = require('webpack')
4 | var config = require('../config')
5 | var merge = require('webpack-merge')
6 | var baseWebpackConfig = require('./webpack.base.conf')
7 | var CopyWebpackPlugin = require('copy-webpack-plugin')
8 | var HtmlWebpackPlugin = require('html-webpack-plugin')
9 | var ExtractTextPlugin = require('extract-text-webpack-plugin')
10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
11 |
12 | var env = config.build.env
13 |
14 | var webpackConfig = merge(baseWebpackConfig, {
15 | module: {
16 | rules: utils.styleLoaders({
17 | sourceMap: config.build.productionSourceMap,
18 | extract: true
19 | })
20 | },
21 | devtool: config.build.productionSourceMap ? '#source-map' : false,
22 | output: {
23 | path: config.build.assetsRoot,
24 | filename: utils.assetsPath('js/[name].[chunkhash].js'),
25 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
26 | },
27 | plugins: [
28 | // http://vuejs.github.io/vue-loader/en/workflow/production.html
29 | new webpack.DefinePlugin({
30 | 'process.env': env
31 | }),
32 | new webpack.optimize.UglifyJsPlugin({
33 | compress: {
34 | warnings: false
35 | },
36 | sourceMap: true
37 | }),
38 | // extract css into its own file
39 | new ExtractTextPlugin({
40 | filename: utils.assetsPath('css/[name].[contenthash].css')
41 | }),
42 | // Compress extracted CSS. We are using this plugin so that possible
43 | // duplicated CSS from different components can be deduped.
44 | new OptimizeCSSPlugin({
45 | cssProcessorOptions: {
46 | safe: true
47 | }
48 | }),
49 | // generate dist index.html with correct asset hash for caching.
50 | // you can customize output by editing /index.html
51 | // see https://github.com/ampedandwired/html-webpack-plugin
52 | new HtmlWebpackPlugin({
53 | filename: config.build.index,
54 | template: 'index.html',
55 | inject: true,
56 | minify: {
57 | removeComments: true,
58 | collapseWhitespace: true,
59 | removeAttributeQuotes: true
60 | // more options:
61 | // https://github.com/kangax/html-minifier#options-quick-reference
62 | },
63 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin
64 | chunksSortMode: 'dependency'
65 | }),
66 | // split vendor js into its own file
67 | new webpack.optimize.CommonsChunkPlugin({
68 | name: 'vendor',
69 | minChunks: function (module, count) {
70 | // any required modules inside node_modules are extracted to vendor
71 | return (
72 | module.resource &&
73 | /\.js$/.test(module.resource) &&
74 | module.resource.indexOf(
75 | path.join(__dirname, '../node_modules')
76 | ) === 0
77 | )
78 | }
79 | }),
80 | // extract webpack runtime and module manifest to its own file in order to
81 | // prevent vendor hash from being updated whenever app bundle is updated
82 | new webpack.optimize.CommonsChunkPlugin({
83 | name: 'manifest',
84 | chunks: ['vendor']
85 | }),
86 | // copy custom static assets
87 | new CopyWebpackPlugin([
88 | {
89 | from: path.resolve(__dirname, '../static'),
90 | to: config.build.assetsSubDirectory,
91 | ignore: ['.*']
92 | }
93 | ])
94 | ]
95 | })
96 |
97 | if (config.build.productionGzip) {
98 | var CompressionWebpackPlugin = require('compression-webpack-plugin')
99 |
100 | webpackConfig.plugins.push(
101 | new CompressionWebpackPlugin({
102 | asset: '[path].gz[query]',
103 | algorithm: 'gzip',
104 | test: new RegExp(
105 | '\\.(' +
106 | config.build.productionGzipExtensions.join('|') +
107 | ')$'
108 | ),
109 | threshold: 10240,
110 | minRatio: 0.8
111 | })
112 | )
113 | }
114 |
115 | if (config.build.bundleAnalyzerReport) {
116 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
117 | webpackConfig.plugins.push(new BundleAnalyzerPlugin())
118 | }
119 |
120 | module.exports = webpackConfig
121 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/config/dev.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var prodEnv = require('./prod.env')
3 |
4 | module.exports = merge(prodEnv, {
5 | NODE_ENV: '"development"'
6 | })
7 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | var path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | index: path.resolve(__dirname, '../dist/index.html'),
8 | assetsRoot: path.resolve(__dirname, '../dist'),
9 | assetsSubDirectory: 'static',
10 | assetsPublicPath: '/',
11 | productionSourceMap: true,
12 | // Gzip off by default as many popular static hosts such as
13 | // Surge or Netlify already gzip all static assets for you.
14 | // Before setting to `true`, make sure to:
15 | // npm install --save-dev compression-webpack-plugin
16 | productionGzip: false,
17 | productionGzipExtensions: ['js', 'css'],
18 | // Run the build command with an extra argument to
19 | // View the bundle analyzer report after build finishes:
20 | // `npm run build --report`
21 | // Set to `true` or `false` to always turn it on or off
22 | bundleAnalyzerReport: process.env.npm_config_report
23 | },
24 | dev: {
25 | env: require('./dev.env'),
26 | port: 8080,
27 | autoOpenBrowser: true,
28 | assetsSubDirectory: 'static',
29 | assetsPublicPath: '/',
30 | proxyTable: {},
31 | // CSS Sourcemaps off by default because relative paths are "buggy"
32 | // with this option, according to the CSS-Loader README
33 | // (https://github.com/webpack/css-loader#sourcemaps)
34 | // In our experience, they generally work as expected,
35 | // just be aware of this issue when enabling this option.
36 | cssSourceMap: false
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | stockmarket
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "stockmarket-vuejs",
3 | "version": "1.0.0",
4 | "description": "A Vue.js project",
5 | "author": "lpisicchio ",
6 | "private": true,
7 | "scripts": {
8 | "dev": "node build/dev-server.js",
9 | "start": "node build/dev-server.js",
10 | "build": "node build/build.js"
11 | },
12 | "dependencies": {
13 | "fast-json-patch": "^2.0.3",
14 | "streamdataio-js-sdk": "^2.0.2",
15 | "vue": "^2.3.3",
16 | "vue-material": "^0.7.2",
17 | "bootstrap-vue": "^0.18.0"
18 | },
19 | "devDependencies": {
20 | "autoprefixer": "^6.7.2",
21 | "babel-core": "^6.22.1",
22 | "babel-loader": "^6.2.10",
23 | "babel-plugin-transform-runtime": "^6.22.0",
24 | "babel-preset-env": "^1.3.2",
25 | "babel-preset-stage-2": "^6.22.0",
26 | "babel-register": "^6.22.0",
27 | "braces": "^2.3.1",
28 | "chalk": "^1.1.3",
29 | "clean-css": "^4.1.11",
30 | "connect-history-api-fallback": "^1.3.0",
31 | "copy-webpack-plugin": "^4.0.1",
32 | "css-loader": "^0.28.0",
33 | "eventsource-polyfill": "^0.9.6",
34 | "express": "^4.14.1",
35 | "extract-text-webpack-plugin": "^2.0.0",
36 | "file-loader": "^0.11.1",
37 | "friendly-errors-webpack-plugin": "^1.1.3",
38 | "html-webpack-plugin": "^2.28.0",
39 | "http-proxy-middleware": "^0.17.3",
40 | "js-yaml": "^3.13.1",
41 | "opn": "^4.0.2",
42 | "optimize-css-assets-webpack-plugin": "^1.3.0",
43 | "ora": "^1.3.0",
44 | "rimraf": "^2.6.0",
45 | "semver": "^5.3.0",
46 | "shelljs": "^0.7.6",
47 | "url-loader": "^0.5.8",
48 | "vue-loader": "^12.1.0",
49 | "vue-style-loader": "^3.0.1",
50 | "vue-template-compiler": "^2.3.3",
51 | "webpack": "^2.6.1",
52 | "webpack-bundle-analyzer": "^2.2.1",
53 | "webpack-dev-middleware": "^1.10.0",
54 | "webpack-hot-middleware": "^2.18.0",
55 | "webpack-merge": "^4.1.0"
56 | },
57 | "engines": {
58 | "node": ">= 4.0.0",
59 | "npm": ">= 3.0.0"
60 | },
61 | "browserslist": [
62 | "> 1%",
63 | "last 2 versions",
64 | "not ie <= 8"
65 | ]
66 | }
67 |
--------------------------------------------------------------------------------
/stockmarket-vuejs/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |