ducimusipsa 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (307) hide show
  1. package/.prettierignore +2 -0
  2. package/.travis.yml +34 -0
  3. package/.vscode/launch.json +24 -0
  4. package/.vscode/settings.json +3 -0
  5. package/demos/ago-node-cli/README.md +29 -0
  6. package/demos/ago-node-cli/ago.js +32 -0
  7. package/demos/ago-node-cli/index.js +11 -0
  8. package/demos/ago-node-cli/lib/item-export-command.js +48 -0
  9. package/demos/ago-node-cli/lib/item-search-command.js +35 -0
  10. package/demos/ago-node-cli/package-lock.json +180 -0
  11. package/demos/ago-node-cli/package.json +30 -0
  12. package/demos/attachments/README.md +5 -0
  13. package/demos/attachments/index.html +164 -0
  14. package/demos/attachments/package-lock.json +182 -0
  15. package/demos/attachments/package.json +18 -0
  16. package/demos/batch-geocoder-node/NYC_Restaurant_Inspection_Results.csv +100 -0
  17. package/demos/batch-geocoder-node/README.md +15 -0
  18. package/demos/batch-geocoder-node/batch-geocode.js +115 -0
  19. package/demos/batch-geocoder-node/config-template.js +18 -0
  20. package/demos/batch-geocoder-node/package-lock.json +109 -0
  21. package/demos/batch-geocoder-node/package.json +38 -0
  22. package/demos/express/README.md +15 -0
  23. package/demos/express/config.json.template +3 -0
  24. package/demos/express/package-lock.json +428 -0
  25. package/demos/express/package.json +18 -0
  26. package/demos/express/server.js +33 -0
  27. package/demos/feature-service-browser/README.md +6 -0
  28. package/demos/feature-service-browser/index.html +122 -0
  29. package/demos/feature-service-browser/package-lock.json +182 -0
  30. package/demos/feature-service-browser/package.json +18 -0
  31. package/demos/geocoder-browser/README.md +10 -0
  32. package/demos/geocoder-browser/config.js.template +1 -0
  33. package/demos/geocoder-browser/index.html +131 -0
  34. package/demos/geocoder-browser/package-lock.json +182 -0
  35. package/demos/geocoder-browser/package.json +19 -0
  36. package/demos/geocoder-browser/post-sign-in.html +25 -0
  37. package/demos/jsapi-integration/README.md +25 -0
  38. package/demos/jsapi-integration/config.js +6 -0
  39. package/demos/jsapi-integration/index.html +85 -0
  40. package/demos/jsapi-integration/package-lock.json +184 -0
  41. package/demos/jsapi-integration/package.json +19 -0
  42. package/demos/oauth2-browser/README.md +14 -0
  43. package/demos/oauth2-browser/authenticate.html +32 -0
  44. package/demos/oauth2-browser/config.js.template +6 -0
  45. package/demos/oauth2-browser/index.html +202 -0
  46. package/demos/oauth2-browser/logo.svg +4 -0
  47. package/demos/oauth2-browser/package-lock.json +163 -0
  48. package/demos/oauth2-browser/package.json +18 -0
  49. package/demos/oauth2-browser/style.css +36 -0
  50. package/demos/oauth2-browser-retry/README.md +25 -0
  51. package/demos/oauth2-browser-retry/authenticate.html +21 -0
  52. package/demos/oauth2-browser-retry/index.html +116 -0
  53. package/demos/oauth2-browser-retry/logo.svg +4 -0
  54. package/demos/vue/.env.example +11 -0
  55. package/demos/vue/.eslintrc.js +17 -0
  56. package/demos/vue/.postcssrc.js +5 -0
  57. package/demos/vue/README.md +17 -0
  58. package/demos/vue/babel.config.js +3 -0
  59. package/demos/vue/package-lock.json +11323 -0
  60. package/demos/vue/package.json +33 -0
  61. package/demos/vue/public/favicon.ico +0 -0
  62. package/demos/vue/public/index.html +24 -0
  63. package/demos/vue/src/assets/logo.svg +29 -0
  64. package/demos/vue/src/components/App.vue +308 -0
  65. package/demos/vue/src/components/Authenticate.vue +65 -0
  66. package/demos/vue/src/components/Loader.vue +230 -0
  67. package/demos/vue/src/main.js +92 -0
  68. package/docs/FAQ.md +28 -0
  69. package/docs/HISTORY.md +62 -0
  70. package/docs/acetate.config.js +223 -0
  71. package/docs/build-typedoc.js +303 -0
  72. package/docs/src/_layout.html +82 -0
  73. package/docs/src/api/_declaration.html +496 -0
  74. package/docs/src/api/_layout.html +127 -0
  75. package/docs/src/api/_package.html +13 -0
  76. package/docs/src/api/index.html +23 -0
  77. package/docs/src/guides/_layout.html +24 -0
  78. package/docs/src/guides/amd-requirejs-dojo.md +40 -0
  79. package/docs/src/guides/babel-and-rollup.md +30 -0
  80. package/docs/src/guides/babel-and-webpack.md +30 -0
  81. package/docs/src/guides/browser-authentication.md +41 -0
  82. package/docs/src/guides/browserify.md +9 -0
  83. package/docs/src/guides/cli-authentication.md +9 -0
  84. package/docs/src/guides/client-server-authentication.md +9 -0
  85. package/docs/src/guides/from-a-cdn.md +36 -0
  86. package/docs/src/guides/index.md +52 -0
  87. package/docs/src/guides/node.md +70 -0
  88. package/docs/src/guides/package-overview.md +8 -0
  89. package/docs/src/guides/server-authentication.md +9 -0
  90. package/docs/src/guides/typescript-and-webpack.md +9 -0
  91. package/docs/src/img/icons.png +0 -0
  92. package/docs/src/img/icons@2x.png +0 -0
  93. package/docs/src/index.html +12 -0
  94. package/docs/src/js/api-search.js +112 -0
  95. package/docs/src/js/nav-toggle.js +41 -0
  96. package/docs/src/sass/_highlight.scss +96 -0
  97. package/docs/src/sass/_icons.scss +157 -0
  98. package/docs/src/sass/style.scss +169 -0
  99. package/jasmine.json +7 -0
  100. package/karma.conf.js +100 -0
  101. package/lerna.json +8 -0
  102. package/notes/README.md +88 -0
  103. package/package.json +129 -0
  104. package/packages/arcgis-rest-auth/README.md +67 -0
  105. package/packages/arcgis-rest-auth/package-lock.json +11 -0
  106. package/packages/arcgis-rest-auth/package.json +53 -0
  107. package/packages/arcgis-rest-auth/src/ApplicationSession.ts +108 -0
  108. package/packages/arcgis-rest-auth/src/UserSession.ts +880 -0
  109. package/packages/arcgis-rest-auth/src/authenticated-request-options.ts +24 -0
  110. package/packages/arcgis-rest-auth/src/fetch-token.ts +52 -0
  111. package/packages/arcgis-rest-auth/src/generate-token.ts +39 -0
  112. package/packages/arcgis-rest-auth/src/index.ts +8 -0
  113. package/packages/arcgis-rest-auth/test/ApplicationSession.test.ts +124 -0
  114. package/packages/arcgis-rest-auth/test/UserSession.test.ts +1005 -0
  115. package/packages/arcgis-rest-auth/test/fetchToken.test.ts +112 -0
  116. package/packages/arcgis-rest-auth/test/generateToken.test.ts +130 -0
  117. package/packages/arcgis-rest-auth/test/utils.ts +14 -0
  118. package/packages/arcgis-rest-auth/tsconfig.json +6 -0
  119. package/packages/arcgis-rest-common/README.md +57 -0
  120. package/packages/arcgis-rest-common/package-lock.json +11 -0
  121. package/packages/arcgis-rest-common/package.json +41 -0
  122. package/packages/arcgis-rest-common/src/index.ts +10 -0
  123. package/packages/arcgis-rest-common/src/types/feature.ts +14 -0
  124. package/packages/arcgis-rest-common/src/types/geometry.ts +47 -0
  125. package/packages/arcgis-rest-common/src/types/symbol.ts +21 -0
  126. package/packages/arcgis-rest-common/src/util/location.ts +19 -0
  127. package/packages/arcgis-rest-common/test/location.test.ts +73 -0
  128. package/packages/arcgis-rest-common/tsconfig.json +6 -0
  129. package/packages/arcgis-rest-common-types/README.md +64 -0
  130. package/packages/arcgis-rest-common-types/package.json +40 -0
  131. package/packages/arcgis-rest-common-types/src/group.ts +54 -0
  132. package/packages/arcgis-rest-common-types/src/index.ts +469 -0
  133. package/packages/arcgis-rest-common-types/src/item.ts +47 -0
  134. package/packages/arcgis-rest-common-types/src/webmap.ts +1267 -0
  135. package/packages/arcgis-rest-common-types/tsconfig.json +11 -0
  136. package/packages/arcgis-rest-feature-service/README.md +73 -0
  137. package/packages/arcgis-rest-feature-service/package-lock.json +11 -0
  138. package/packages/arcgis-rest-feature-service/package.json +53 -0
  139. package/packages/arcgis-rest-feature-service/src/add.ts +90 -0
  140. package/packages/arcgis-rest-feature-service/src/addAttachment.ts +64 -0
  141. package/packages/arcgis-rest-feature-service/src/decodeValues.ts +129 -0
  142. package/packages/arcgis-rest-feature-service/src/delete.ts +97 -0
  143. package/packages/arcgis-rest-feature-service/src/deleteAttachments.ts +67 -0
  144. package/packages/arcgis-rest-feature-service/src/getAttachments.ts +64 -0
  145. package/packages/arcgis-rest-feature-service/src/getLayer.ts +27 -0
  146. package/packages/arcgis-rest-feature-service/src/helpers.ts +50 -0
  147. package/packages/arcgis-rest-feature-service/src/index.ts +14 -0
  148. package/packages/arcgis-rest-feature-service/src/query.ts +183 -0
  149. package/packages/arcgis-rest-feature-service/src/queryRelated.ts +94 -0
  150. package/packages/arcgis-rest-feature-service/src/update.ts +90 -0
  151. package/packages/arcgis-rest-feature-service/src/updateAttachment.ts +73 -0
  152. package/packages/arcgis-rest-feature-service/test/attachments.test.ts +203 -0
  153. package/packages/arcgis-rest-feature-service/test/crud.test.ts +263 -0
  154. package/packages/arcgis-rest-feature-service/test/decodeValues.test.ts +67 -0
  155. package/packages/arcgis-rest-feature-service/test/getLayer.test.ts +31 -0
  156. package/packages/arcgis-rest-feature-service/test/mocks/cvdQueryResponse.ts +225 -0
  157. package/packages/arcgis-rest-feature-service/test/mocks/feature.ts +281 -0
  158. package/packages/arcgis-rest-feature-service/test/mocks/fields.ts +779 -0
  159. package/packages/arcgis-rest-feature-service/test/mocks/foo.txt +1 -0
  160. package/packages/arcgis-rest-feature-service/test/mocks/service.ts +259 -0
  161. package/packages/arcgis-rest-feature-service/test/query.test.ts +140 -0
  162. package/packages/arcgis-rest-feature-service/tsconfig.json +6 -0
  163. package/packages/arcgis-rest-feature-service-admin/README.md +69 -0
  164. package/packages/arcgis-rest-feature-service-admin/package-lock.json +11 -0
  165. package/packages/arcgis-rest-feature-service-admin/package.json +56 -0
  166. package/packages/arcgis-rest-feature-service-admin/src/addTo.ts +74 -0
  167. package/packages/arcgis-rest-feature-service-admin/src/create.ts +207 -0
  168. package/packages/arcgis-rest-feature-service-admin/src/index.ts +2 -0
  169. package/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts +353 -0
  170. package/packages/arcgis-rest-feature-service-admin/test/create.test.ts +412 -0
  171. package/packages/arcgis-rest-feature-service-admin/test/mocks/layerDefinition.ts +79 -0
  172. package/packages/arcgis-rest-feature-service-admin/test/mocks/move.ts +14 -0
  173. package/packages/arcgis-rest-feature-service-admin/test/mocks/service.ts +72 -0
  174. package/packages/arcgis-rest-feature-service-admin/tsconfig.json +6 -0
  175. package/packages/arcgis-rest-geocoder/README.md +83 -0
  176. package/packages/arcgis-rest-geocoder/package-lock.json +11 -0
  177. package/packages/arcgis-rest-geocoder/package.json +55 -0
  178. package/packages/arcgis-rest-geocoder/src/bulk.ts +102 -0
  179. package/packages/arcgis-rest-geocoder/src/geocode.ts +130 -0
  180. package/packages/arcgis-rest-geocoder/src/helpers.ts +80 -0
  181. package/packages/arcgis-rest-geocoder/src/index.ts +8 -0
  182. package/packages/arcgis-rest-geocoder/src/reverse.ts +83 -0
  183. package/packages/arcgis-rest-geocoder/src/suggest.ts +69 -0
  184. package/packages/arcgis-rest-geocoder/test/bulk.test.ts +113 -0
  185. package/packages/arcgis-rest-geocoder/test/geocode.test.ts +176 -0
  186. package/packages/arcgis-rest-geocoder/test/helpers.test.ts +111 -0
  187. package/packages/arcgis-rest-geocoder/test/mocks/responses.ts +629 -0
  188. package/packages/arcgis-rest-geocoder/test/reverse.test.ts +126 -0
  189. package/packages/arcgis-rest-geocoder/test/suggest.test.ts +98 -0
  190. package/packages/arcgis-rest-geocoder/tsconfig.json +6 -0
  191. package/packages/arcgis-rest-groups/README.md +67 -0
  192. package/packages/arcgis-rest-groups/package-lock.json +11 -0
  193. package/packages/arcgis-rest-groups/package.json +55 -0
  194. package/packages/arcgis-rest-groups/src/create.ts +34 -0
  195. package/packages/arcgis-rest-groups/src/get.ts +95 -0
  196. package/packages/arcgis-rest-groups/src/helpers.ts +27 -0
  197. package/packages/arcgis-rest-groups/src/index.ts +11 -0
  198. package/packages/arcgis-rest-groups/src/notification.ts +77 -0
  199. package/packages/arcgis-rest-groups/src/protect.ts +40 -0
  200. package/packages/arcgis-rest-groups/src/remove.ts +23 -0
  201. package/packages/arcgis-rest-groups/src/search.ts +64 -0
  202. package/packages/arcgis-rest-groups/src/update.ts +36 -0
  203. package/packages/arcgis-rest-groups/test/crud.test.ts +134 -0
  204. package/packages/arcgis-rest-groups/test/get.test.ts +101 -0
  205. package/packages/arcgis-rest-groups/test/mocks/responses.ts +141 -0
  206. package/packages/arcgis-rest-groups/test/notification.test.ts +102 -0
  207. package/packages/arcgis-rest-groups/test/protect.test.ts +64 -0
  208. package/packages/arcgis-rest-groups/test/search.test.ts +85 -0
  209. package/packages/arcgis-rest-groups/tsconfig.json +6 -0
  210. package/packages/arcgis-rest-items/README.md +69 -0
  211. package/packages/arcgis-rest-items/package-lock.json +11 -0
  212. package/packages/arcgis-rest-items/package.json +55 -0
  213. package/packages/arcgis-rest-items/src/add.ts +103 -0
  214. package/packages/arcgis-rest-items/src/create.ts +110 -0
  215. package/packages/arcgis-rest-items/src/get.ts +79 -0
  216. package/packages/arcgis-rest-items/src/helpers.ts +147 -0
  217. package/packages/arcgis-rest-items/src/index.ts +11 -0
  218. package/packages/arcgis-rest-items/src/protect.ts +38 -0
  219. package/packages/arcgis-rest-items/src/remove.ts +58 -0
  220. package/packages/arcgis-rest-items/src/search.ts +78 -0
  221. package/packages/arcgis-rest-items/src/update.ts +134 -0
  222. package/packages/arcgis-rest-items/test/add.test.ts +256 -0
  223. package/packages/arcgis-rest-items/test/create.test.ts +371 -0
  224. package/packages/arcgis-rest-items/test/get.test.ts +181 -0
  225. package/packages/arcgis-rest-items/test/mocks/foo.zip +0 -0
  226. package/packages/arcgis-rest-items/test/mocks/item.ts +35 -0
  227. package/packages/arcgis-rest-items/test/mocks/resources.ts +31 -0
  228. package/packages/arcgis-rest-items/test/mocks/search.ts +62 -0
  229. package/packages/arcgis-rest-items/test/protect.test.ts +122 -0
  230. package/packages/arcgis-rest-items/test/remove.test.ts +161 -0
  231. package/packages/arcgis-rest-items/test/search.test.ts +159 -0
  232. package/packages/arcgis-rest-items/test/update.test.ts +450 -0
  233. package/packages/arcgis-rest-items/tsconfig.json +6 -0
  234. package/packages/arcgis-rest-request/README.md +68 -0
  235. package/packages/arcgis-rest-request/package-lock.json +11 -0
  236. package/packages/arcgis-rest-request/package.json +45 -0
  237. package/packages/arcgis-rest-request/src/index.ts +15 -0
  238. package/packages/arcgis-rest-request/src/request.ts +358 -0
  239. package/packages/arcgis-rest-request/src/utils/ArcGISRequestError.ts +76 -0
  240. package/packages/arcgis-rest-request/src/utils/ErrorTypes.ts +29 -0
  241. package/packages/arcgis-rest-request/src/utils/append-custom-params.ts +29 -0
  242. package/packages/arcgis-rest-request/src/utils/encode-form-data.ts +34 -0
  243. package/packages/arcgis-rest-request/src/utils/encode-query-string.ts +23 -0
  244. package/packages/arcgis-rest-request/src/utils/get-portal-url.ts +25 -0
  245. package/packages/arcgis-rest-request/src/utils/get-portal.ts +45 -0
  246. package/packages/arcgis-rest-request/src/utils/params.ts +52 -0
  247. package/packages/arcgis-rest-request/src/utils/process-params.ts +99 -0
  248. package/packages/arcgis-rest-request/src/utils/retryAuthError.ts +9 -0
  249. package/packages/arcgis-rest-request/src/utils/warn.ts +11 -0
  250. package/packages/arcgis-rest-request/test/mocks/errors.ts +68 -0
  251. package/packages/arcgis-rest-request/test/mocks/geojson-feature-collection.ts +13 -0
  252. package/packages/arcgis-rest-request/test/mocks/portal.ts +112 -0
  253. package/packages/arcgis-rest-request/test/mocks/sharing-rest-info.ts +41 -0
  254. package/packages/arcgis-rest-request/test/mocks/webmap.ts +41 -0
  255. package/packages/arcgis-rest-request/test/request.test.ts +323 -0
  256. package/packages/arcgis-rest-request/test/utils/ArcGISAuthError.test.ts +170 -0
  257. package/packages/arcgis-rest-request/test/utils/ArcGISRequestError.test.ts +51 -0
  258. package/packages/arcgis-rest-request/test/utils/check-for-errors.test.ts +111 -0
  259. package/packages/arcgis-rest-request/test/utils/encode-form-data.test.ts +133 -0
  260. package/packages/arcgis-rest-request/test/utils/get-portal-url.test.ts +37 -0
  261. package/packages/arcgis-rest-request/test/utils/portal.test.ts +97 -0
  262. package/packages/arcgis-rest-request/test/utils/process-params.test.ts +193 -0
  263. package/packages/arcgis-rest-request/tsconfig.json +6 -0
  264. package/packages/arcgis-rest-routing/README.md +71 -0
  265. package/packages/arcgis-rest-routing/package-lock.json +11 -0
  266. package/packages/arcgis-rest-routing/package.json +54 -0
  267. package/packages/arcgis-rest-routing/src/helpers.ts +16 -0
  268. package/packages/arcgis-rest-routing/src/index.ts +4 -0
  269. package/packages/arcgis-rest-routing/src/solveRoute.ts +102 -0
  270. package/packages/arcgis-rest-routing/test/mocks/responses.ts +825 -0
  271. package/packages/arcgis-rest-routing/test/solveRoute.test.ts +267 -0
  272. package/packages/arcgis-rest-routing/tsconfig.json +6 -0
  273. package/packages/arcgis-rest-sharing/README.md +70 -0
  274. package/packages/arcgis-rest-sharing/package-lock.json +11 -0
  275. package/packages/arcgis-rest-sharing/package.json +60 -0
  276. package/packages/arcgis-rest-sharing/src/access.ts +85 -0
  277. package/packages/arcgis-rest-sharing/src/group-sharing.ts +211 -0
  278. package/packages/arcgis-rest-sharing/src/helpers.ts +82 -0
  279. package/packages/arcgis-rest-sharing/src/index.ts +5 -0
  280. package/packages/arcgis-rest-sharing/test/access.test.ts +154 -0
  281. package/packages/arcgis-rest-sharing/test/group-sharing.test.ts +566 -0
  282. package/packages/arcgis-rest-sharing/test/helpers.test.ts +55 -0
  283. package/packages/arcgis-rest-sharing/test/mocks/sharing.ts +18 -0
  284. package/packages/arcgis-rest-sharing/tsconfig.json +6 -0
  285. package/packages/arcgis-rest-users/README.md +74 -0
  286. package/packages/arcgis-rest-users/package-lock.json +11 -0
  287. package/packages/arcgis-rest-users/package.json +54 -0
  288. package/packages/arcgis-rest-users/src/get.ts +69 -0
  289. package/packages/arcgis-rest-users/src/index.ts +6 -0
  290. package/packages/arcgis-rest-users/src/invitation.ts +166 -0
  291. package/packages/arcgis-rest-users/src/notification.ts +73 -0
  292. package/packages/arcgis-rest-users/test/get.test.ts +99 -0
  293. package/packages/arcgis-rest-users/test/invitation.test.ts +169 -0
  294. package/packages/arcgis-rest-users/test/mocks/invitation.ts +70 -0
  295. package/packages/arcgis-rest-users/test/mocks/notification.ts +34 -0
  296. package/packages/arcgis-rest-users/test/mocks/user.ts +173 -0
  297. package/packages/arcgis-rest-users/test/notification.test.ts +83 -0
  298. package/packages/arcgis-rest-users/tsconfig.json +6 -0
  299. package/support/changelog.js +394 -0
  300. package/support/deploy-doc-site.js +16 -0
  301. package/support/dev.sh +6 -0
  302. package/support/publish.sh +43 -0
  303. package/support/test-helpers.js +8 -0
  304. package/tsconfig.json +69 -0
  305. package/tslint.json +16 -0
  306. package/umd-base-profile.js +82 -0
  307. package/umd-production-profile.js +13 -0
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "batch-geocoder",
3
+ "version": "1.14.1",
4
+ "description": "arcgis-rest-js batch geocode sample",
5
+ "main": "batch-geocode.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "start": "node batch-geocode.js"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/Esri/arcgis-rest-js.git"
13
+ },
14
+ "keywords": [
15
+ "geocode",
16
+ "batch",
17
+ "arcgis",
18
+ "rest",
19
+ "js",
20
+ "arcgis-rest-js"
21
+ ],
22
+ "author": "Max Payson (mpayson)",
23
+ "license": "Apache-2.0",
24
+ "private": true,
25
+ "bugs": {
26
+ "url": "https://github.com/Esri/arcgis-rest-js/issues"
27
+ },
28
+ "homepage": "https://github.com/Esri/arcgis-rest-js#readme",
29
+ "dependencies": {
30
+ "@esri/arcgis-rest-auth": "^1.14.1",
31
+ "@esri/arcgis-rest-common-types": "^1.14.0",
32
+ "@esri/arcgis-rest-geocoder": "^1.14.1",
33
+ "@esri/arcgis-rest-request": "^1.14.0",
34
+ "isomorphic-fetch": "^2.2.1",
35
+ "isomorphic-form-data": "^2.0.0",
36
+ "papaparse": "^4.6.0"
37
+ }
38
+ }
@@ -0,0 +1,15 @@
1
+ # ArcGIS REST JS Express Demo
2
+
3
+ This demo explains how to trigger OAuth 2.0 via custom server-side code
4
+
5
+ ## Setup
6
+ 1. Make sure you run `npm run bootstrap` in the root folder to setup the dependencies
7
+ 2. Create a new application on https://developers.arcgis.com
8
+ 3. Add `http://localhost:3000/authenticate` as a redirect uri for your application.
9
+ 4. Copy the `config.json.template` file, rename it to `config.json`
10
+ 5. Copy your application's client id into your new `config.json` file.
11
+
12
+ ## Running the demo
13
+ 6. `npm start`
14
+ 7. Visit http://localhost:3000/authorize to start the OAuth 2.0 process.
15
+
@@ -0,0 +1,3 @@
1
+ {
2
+ "clientId": "QVQNb3XfDzoboWS0" // change me
3
+ }
@@ -0,0 +1,428 @@
1
+ {
2
+ "requires": true,
3
+ "lockfileVersion": 1,
4
+ "dependencies": {
5
+ "accepts": {
6
+ "version": "1.3.5",
7
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
8
+ "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
9
+ "requires": {
10
+ "mime-types": "~2.1.18",
11
+ "negotiator": "0.6.1"
12
+ }
13
+ },
14
+ "array-flatten": {
15
+ "version": "1.1.1",
16
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
17
+ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
18
+ },
19
+ "asynckit": {
20
+ "version": "0.4.0",
21
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
22
+ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
23
+ },
24
+ "body-parser": {
25
+ "version": "1.18.3",
26
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
27
+ "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
28
+ "requires": {
29
+ "bytes": "3.0.0",
30
+ "content-type": "~1.0.4",
31
+ "debug": "2.6.9",
32
+ "depd": "~1.1.2",
33
+ "http-errors": "~1.6.3",
34
+ "iconv-lite": "0.4.23",
35
+ "on-finished": "~2.3.0",
36
+ "qs": "6.5.2",
37
+ "raw-body": "2.3.3",
38
+ "type-is": "~1.6.16"
39
+ }
40
+ },
41
+ "bytes": {
42
+ "version": "3.0.0",
43
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
44
+ "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
45
+ },
46
+ "combined-stream": {
47
+ "version": "1.0.7",
48
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
49
+ "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==",
50
+ "requires": {
51
+ "delayed-stream": "~1.0.0"
52
+ }
53
+ },
54
+ "content-disposition": {
55
+ "version": "0.5.2",
56
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
57
+ "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
58
+ },
59
+ "content-type": {
60
+ "version": "1.0.4",
61
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
62
+ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
63
+ },
64
+ "cookie": {
65
+ "version": "0.3.1",
66
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
67
+ "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
68
+ },
69
+ "cookie-signature": {
70
+ "version": "1.0.6",
71
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
72
+ "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
73
+ },
74
+ "debug": {
75
+ "version": "2.6.9",
76
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
77
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
78
+ "requires": {
79
+ "ms": "2.0.0"
80
+ }
81
+ },
82
+ "delayed-stream": {
83
+ "version": "1.0.0",
84
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
85
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
86
+ },
87
+ "depd": {
88
+ "version": "1.1.2",
89
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
90
+ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
91
+ },
92
+ "destroy": {
93
+ "version": "1.0.4",
94
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
95
+ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
96
+ },
97
+ "ee-first": {
98
+ "version": "1.1.1",
99
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
100
+ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
101
+ },
102
+ "encodeurl": {
103
+ "version": "1.0.2",
104
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
105
+ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
106
+ },
107
+ "encoding": {
108
+ "version": "0.1.12",
109
+ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
110
+ "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
111
+ "requires": {
112
+ "iconv-lite": "~0.4.13"
113
+ }
114
+ },
115
+ "escape-html": {
116
+ "version": "1.0.3",
117
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
118
+ "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
119
+ },
120
+ "etag": {
121
+ "version": "1.8.1",
122
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
123
+ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
124
+ },
125
+ "express": {
126
+ "version": "4.16.4",
127
+ "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz",
128
+ "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==",
129
+ "requires": {
130
+ "accepts": "~1.3.5",
131
+ "array-flatten": "1.1.1",
132
+ "body-parser": "1.18.3",
133
+ "content-disposition": "0.5.2",
134
+ "content-type": "~1.0.4",
135
+ "cookie": "0.3.1",
136
+ "cookie-signature": "1.0.6",
137
+ "debug": "2.6.9",
138
+ "depd": "~1.1.2",
139
+ "encodeurl": "~1.0.2",
140
+ "escape-html": "~1.0.3",
141
+ "etag": "~1.8.1",
142
+ "finalhandler": "1.1.1",
143
+ "fresh": "0.5.2",
144
+ "merge-descriptors": "1.0.1",
145
+ "methods": "~1.1.2",
146
+ "on-finished": "~2.3.0",
147
+ "parseurl": "~1.3.2",
148
+ "path-to-regexp": "0.1.7",
149
+ "proxy-addr": "~2.0.4",
150
+ "qs": "6.5.2",
151
+ "range-parser": "~1.2.0",
152
+ "safe-buffer": "5.1.2",
153
+ "send": "0.16.2",
154
+ "serve-static": "1.13.2",
155
+ "setprototypeof": "1.1.0",
156
+ "statuses": "~1.4.0",
157
+ "type-is": "~1.6.16",
158
+ "utils-merge": "1.0.1",
159
+ "vary": "~1.1.2"
160
+ }
161
+ },
162
+ "finalhandler": {
163
+ "version": "1.1.1",
164
+ "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
165
+ "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
166
+ "requires": {
167
+ "debug": "2.6.9",
168
+ "encodeurl": "~1.0.2",
169
+ "escape-html": "~1.0.3",
170
+ "on-finished": "~2.3.0",
171
+ "parseurl": "~1.3.2",
172
+ "statuses": "~1.4.0",
173
+ "unpipe": "~1.0.0"
174
+ }
175
+ },
176
+ "form-data": {
177
+ "version": "2.3.3",
178
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
179
+ "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
180
+ "requires": {
181
+ "asynckit": "^0.4.0",
182
+ "combined-stream": "^1.0.6",
183
+ "mime-types": "^2.1.12"
184
+ }
185
+ },
186
+ "forwarded": {
187
+ "version": "0.1.2",
188
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
189
+ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
190
+ },
191
+ "fresh": {
192
+ "version": "0.5.2",
193
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
194
+ "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
195
+ },
196
+ "http-errors": {
197
+ "version": "1.6.3",
198
+ "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
199
+ "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
200
+ "requires": {
201
+ "depd": "~1.1.2",
202
+ "inherits": "2.0.3",
203
+ "setprototypeof": "1.1.0",
204
+ "statuses": ">= 1.4.0 < 2"
205
+ }
206
+ },
207
+ "iconv-lite": {
208
+ "version": "0.4.23",
209
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
210
+ "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
211
+ "requires": {
212
+ "safer-buffer": ">= 2.1.2 < 3"
213
+ }
214
+ },
215
+ "inherits": {
216
+ "version": "2.0.3",
217
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
218
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
219
+ },
220
+ "ipaddr.js": {
221
+ "version": "1.8.0",
222
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz",
223
+ "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4="
224
+ },
225
+ "is-stream": {
226
+ "version": "1.1.0",
227
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
228
+ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
229
+ },
230
+ "isomorphic-fetch": {
231
+ "version": "2.2.1",
232
+ "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz",
233
+ "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=",
234
+ "requires": {
235
+ "node-fetch": "^1.0.1",
236
+ "whatwg-fetch": ">=0.10.0"
237
+ }
238
+ },
239
+ "isomorphic-form-data": {
240
+ "version": "2.0.0",
241
+ "resolved": "https://registry.npmjs.org/isomorphic-form-data/-/isomorphic-form-data-2.0.0.tgz",
242
+ "integrity": "sha512-TYgVnXWeESVmQSg4GLVbalmQ+B4NPi/H4eWxqALKj63KsUrcu301YDjBqaOw3h+cbak7Na4Xyps3BiptHtxTfg==",
243
+ "requires": {
244
+ "form-data": "^2.3.2"
245
+ }
246
+ },
247
+ "media-typer": {
248
+ "version": "0.3.0",
249
+ "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
250
+ "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
251
+ },
252
+ "merge-descriptors": {
253
+ "version": "1.0.1",
254
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
255
+ "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
256
+ },
257
+ "methods": {
258
+ "version": "1.1.2",
259
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
260
+ "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
261
+ },
262
+ "mime": {
263
+ "version": "1.4.1",
264
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
265
+ "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
266
+ },
267
+ "mime-db": {
268
+ "version": "1.37.0",
269
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
270
+ "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg=="
271
+ },
272
+ "mime-types": {
273
+ "version": "2.1.21",
274
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
275
+ "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
276
+ "requires": {
277
+ "mime-db": "~1.37.0"
278
+ }
279
+ },
280
+ "ms": {
281
+ "version": "2.0.0",
282
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
283
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
284
+ },
285
+ "negotiator": {
286
+ "version": "0.6.1",
287
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
288
+ "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
289
+ },
290
+ "node-fetch": {
291
+ "version": "1.7.3",
292
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
293
+ "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
294
+ "requires": {
295
+ "encoding": "^0.1.11",
296
+ "is-stream": "^1.0.1"
297
+ }
298
+ },
299
+ "on-finished": {
300
+ "version": "2.3.0",
301
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
302
+ "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
303
+ "requires": {
304
+ "ee-first": "1.1.1"
305
+ }
306
+ },
307
+ "parseurl": {
308
+ "version": "1.3.2",
309
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
310
+ "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
311
+ },
312
+ "path-to-regexp": {
313
+ "version": "0.1.7",
314
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
315
+ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
316
+ },
317
+ "proxy-addr": {
318
+ "version": "2.0.4",
319
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz",
320
+ "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==",
321
+ "requires": {
322
+ "forwarded": "~0.1.2",
323
+ "ipaddr.js": "1.8.0"
324
+ }
325
+ },
326
+ "qs": {
327
+ "version": "6.5.2",
328
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
329
+ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
330
+ },
331
+ "range-parser": {
332
+ "version": "1.2.0",
333
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
334
+ "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
335
+ },
336
+ "raw-body": {
337
+ "version": "2.3.3",
338
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
339
+ "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
340
+ "requires": {
341
+ "bytes": "3.0.0",
342
+ "http-errors": "1.6.3",
343
+ "iconv-lite": "0.4.23",
344
+ "unpipe": "1.0.0"
345
+ }
346
+ },
347
+ "safe-buffer": {
348
+ "version": "5.1.2",
349
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
350
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
351
+ },
352
+ "safer-buffer": {
353
+ "version": "2.1.2",
354
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
355
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
356
+ },
357
+ "send": {
358
+ "version": "0.16.2",
359
+ "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
360
+ "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
361
+ "requires": {
362
+ "debug": "2.6.9",
363
+ "depd": "~1.1.2",
364
+ "destroy": "~1.0.4",
365
+ "encodeurl": "~1.0.2",
366
+ "escape-html": "~1.0.3",
367
+ "etag": "~1.8.1",
368
+ "fresh": "0.5.2",
369
+ "http-errors": "~1.6.2",
370
+ "mime": "1.4.1",
371
+ "ms": "2.0.0",
372
+ "on-finished": "~2.3.0",
373
+ "range-parser": "~1.2.0",
374
+ "statuses": "~1.4.0"
375
+ }
376
+ },
377
+ "serve-static": {
378
+ "version": "1.13.2",
379
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
380
+ "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
381
+ "requires": {
382
+ "encodeurl": "~1.0.2",
383
+ "escape-html": "~1.0.3",
384
+ "parseurl": "~1.3.2",
385
+ "send": "0.16.2"
386
+ }
387
+ },
388
+ "setprototypeof": {
389
+ "version": "1.1.0",
390
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
391
+ "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
392
+ },
393
+ "statuses": {
394
+ "version": "1.4.0",
395
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
396
+ "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
397
+ },
398
+ "type-is": {
399
+ "version": "1.6.16",
400
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
401
+ "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
402
+ "requires": {
403
+ "media-typer": "0.3.0",
404
+ "mime-types": "~2.1.18"
405
+ }
406
+ },
407
+ "unpipe": {
408
+ "version": "1.0.0",
409
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
410
+ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
411
+ },
412
+ "utils-merge": {
413
+ "version": "1.0.1",
414
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
415
+ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
416
+ },
417
+ "vary": {
418
+ "version": "1.1.2",
419
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
420
+ "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
421
+ },
422
+ "whatwg-fetch": {
423
+ "version": "3.0.0",
424
+ "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz",
425
+ "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q=="
426
+ }
427
+ }
428
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@esri/arcgis-rest-demo-express",
3
+ "version": "1.14.1",
4
+ "private": true,
5
+ "description": "Demo of @esri/arcgis-rest-* packages in an Express server",
6
+ "author": "",
7
+ "license": "Apache-2.0",
8
+ "dependencies": {
9
+ "@esri/arcgis-rest-auth": "^1.14.1",
10
+ "@esri/arcgis-rest-request": "^1.14.0",
11
+ "express": "^4.16.3",
12
+ "isomorphic-fetch": "^2.2.1",
13
+ "isomorphic-form-data": "^2.0.0"
14
+ },
15
+ "scripts": {
16
+ "start": "node server.js"
17
+ }
18
+ }
@@ -0,0 +1,33 @@
1
+ require("isomorphic-fetch");
2
+ require("isomorphic-form-data");
3
+ const express = require("express");
4
+ const app = express();
5
+ const { UserSession } = require("@esri/arcgis-rest-auth");
6
+ const { clientId } = require("./config.json");
7
+
8
+ const credentials = {
9
+ clientId,
10
+ redirectUri: "http://localhost:3000/authenticate"
11
+ };
12
+
13
+ app.get("/authorize", function(req, res) {
14
+ UserSession.authorize(credentials, res);
15
+ });
16
+
17
+ app.get("/authenticate", function(req, res) {
18
+ if (credentials) {
19
+ UserSession.exchangeAuthorizationCode(
20
+ credentials,
21
+ req.query.code
22
+ ).then(session => {
23
+ res.send(session.token);
24
+ });
25
+ } else {
26
+ res.send("please visit http://localhost:3000/authorize");
27
+ }
28
+
29
+ });
30
+
31
+ app.listen(3000, function() {
32
+ console.log("Example app listening on port 3000!");
33
+ });
@@ -0,0 +1,6 @@
1
+ # Running this demo
2
+
3
+ 1. Make sure you run `npm run bootstrap` in the root folder to setup the dependencies
4
+ 1. `npm start`
5
+ 1. Visit http://localhost:8080
6
+ 1. Enter a search term and click "Search" to see results
@@ -0,0 +1,122 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
5
+ </head>
6
+ <body>
7
+
8
+ <div class="container-fluid">
9
+ <div class="row">
10
+ <div class="col-md-12">
11
+ <div class="jumbotron" >
12
+ <h1>query features!</h1>
13
+ <form id="queryForm" class="form-inline">
14
+ <div class="form-group">
15
+ <label for="resultRecordCount">Show up to</label>
16
+ <select id="resultRecordCount" class="form-control">
17
+ <option>5</option>
18
+ <option selected>10</option>
19
+ <option>25</option>
20
+ <option>50</option>
21
+ </select>
22
+ </div>
23
+ <div class="form-group">
24
+ <label for="queryField">records where</label>
25
+ <select id="queryField" class="form-control">
26
+ <option value="Cmn_Name">Type</option>
27
+ <option value="Condition">Condition</option>
28
+ </select>
29
+ </div>
30
+ <div class="form-group">
31
+ <label for="queryTerm">contains</label>
32
+ <input type="text" class="form-control" id="queryTerm" style="width: 200px" tabindex="0">
33
+ </div>
34
+ <button type="submit" class="btn btn-default">Go</button>
35
+ </form>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ <div class="row">
40
+ <div class="col-md-12">
41
+ <table id="featureTable" class="table table-striped" style="display: none">
42
+ <thead>
43
+ <tr>
44
+ <th>Tree ID</th>
45
+ <th>Type</th>
46
+ <th>Condition</th>
47
+ </tr>
48
+ </thead>
49
+ <tbody id="tableBody">
50
+ </tbody>
51
+ </table>
52
+ <p id="suggestedTermsMessage">Try 'elm' or 'oak' for <strong>Type</strong>. Try 'fair' or 'good' for <strong>Condition</strong>.</p id="suggestedTermsMessage">
53
+ <p id="recordCountMessage"></p>
54
+ <p id="additionalRowsMessage" style="display: none" class="alert alert-warning">There are additional rows that meet your query criteria.</p>
55
+ </div>
56
+ </div>
57
+ </div>
58
+
59
+ <!-- load arcgis rest libraries -->
60
+ <script src="node_modules/@esri/arcgis-rest-request/dist/umd/request.umd.js"></script>
61
+ <script src="node_modules/@esri/arcgis-rest-feature-service/dist/umd/feature-service.umd.js"></script>
62
+
63
+ <script>
64
+ // respond when a user fills out the query form and
65
+ // either hits enter or clicks on the button
66
+ var queryForm = document.getElementById('queryForm');
67
+ queryForm.addEventListener('submit', function (e) {
68
+ // don't submit the form and reload the page (the default behavior)
69
+ e.preventDefault();
70
+ // get query params from form fields
71
+ var queryField = e.target.queryField.value;
72
+ var queryTerm = e.target.queryTerm.value;
73
+ var resultRecordCount = e.target.resultRecordCount.value;
74
+ // execute the query
75
+ queryTrees(queryField, queryTerm, resultRecordCount)
76
+ .then(function(response) {
77
+ // display the features in a table
78
+ refreshTable(response);
79
+ });
80
+ });
81
+
82
+ // perform query against the feature service and
83
+ // return a promise that will resolve with the response
84
+ function queryTrees(queryField, queryTerm, resultRecordCount) {
85
+ return arcgisRest.queryFeatures({
86
+ url: 'https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0',
87
+ // see: https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm
88
+ // for all possible query parameters
89
+ params: {
90
+ // NOTE: returnGeometry is set to false by default
91
+ where: queryField + ' LIKE \'%' + queryTerm + '%\'',
92
+ outFields: ['FID','Tree_ID','Cmn_Name','Condition'],
93
+ // limit to number of records that will show on the page
94
+ resultRecordCount: resultRecordCount
95
+ }
96
+ });
97
+ }
98
+
99
+ function refreshTable(response) {
100
+ var features = response.features;
101
+ // clear table
102
+ var tableBody = document.getElementById('tableBody');
103
+ tableBody.innerHTML = '';
104
+ // show returned features (if any)
105
+ var recordCount = features.length;
106
+ var featureTableDisplay = recordCount > 0 ? 'table' : 'none';
107
+ document.getElementById('featureTable').style.display = featureTableDisplay;
108
+ var rows = features.map(function (feature) {
109
+ return '<tr><td>' + feature.attributes.Tree_ID + '<td>' + feature.attributes.Cmn_Name + '</td><td>' + feature.attributes.Condition + '</td></tr>';
110
+ });
111
+ tableBody.innerHTML = rows.join('');
112
+ // show number of returned features
113
+ document.getElementById('recordCountMessage').innerHTML = recordCount + ' record(s) returned.';
114
+ // show/hide additional messages
115
+ var suggestedTermsMessageDisplay = recordCount > 0 ? 'none' : 'block';
116
+ var additionalRowsMessageDisplay = response.exceededTransferLimit ? 'block' : 'none';
117
+ document.getElementById('suggestedTermsMessage').style.display = suggestedTermsMessageDisplay;
118
+ document.getElementById('additionalRowsMessage').style.display = additionalRowsMessageDisplay;
119
+ }
120
+ </script>
121
+ </body>
122
+ </html>