delectusnon 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. package/.prettierignore +2 -0
  2. package/.travis.yml +33 -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 +172 -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 +118 -0
  19. package/demos/batch-geocoder-node/config-template.js +18 -0
  20. package/demos/batch-geocoder-node/package-lock.json +116 -0
  21. package/demos/batch-geocoder-node/package.json +39 -0
  22. package/demos/express/README.md +10 -0
  23. package/demos/express/config.json.template +3 -0
  24. package/demos/express/package-lock.json +473 -0
  25. package/demos/express/package.json +18 -0
  26. package/demos/express/server.js +28 -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 +8 -0
  38. package/demos/jsapi-integration/config.js +6 -0
  39. package/demos/jsapi-integration/index.html +79 -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 +12 -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 +301 -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 +31 -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 +88 -0
  104. package/packages/arcgis-rest-auth/README.md +64 -0
  105. package/packages/arcgis-rest-auth/package-lock.json +11 -0
  106. package/packages/arcgis-rest-auth/package.json +51 -0
  107. package/packages/arcgis-rest-auth/src/ApplicationSession.ts +109 -0
  108. package/packages/arcgis-rest-auth/src/UserSession.ts +873 -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 +995 -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-types/README.md +61 -0
  120. package/packages/arcgis-rest-common-types/package.json +38 -0
  121. package/packages/arcgis-rest-common-types/src/group.ts +54 -0
  122. package/packages/arcgis-rest-common-types/src/index.ts +467 -0
  123. package/packages/arcgis-rest-common-types/src/item.ts +45 -0
  124. package/packages/arcgis-rest-common-types/src/webmap.ts +1232 -0
  125. package/packages/arcgis-rest-common-types/tsconfig.json +11 -0
  126. package/packages/arcgis-rest-feature-service/README.md +70 -0
  127. package/packages/arcgis-rest-feature-service/package-lock.json +11 -0
  128. package/packages/arcgis-rest-feature-service/package.json +50 -0
  129. package/packages/arcgis-rest-feature-service/src/add.ts +81 -0
  130. package/packages/arcgis-rest-feature-service/src/addAttachment.ts +65 -0
  131. package/packages/arcgis-rest-feature-service/src/delete.ts +85 -0
  132. package/packages/arcgis-rest-feature-service/src/deleteAttachments.ts +68 -0
  133. package/packages/arcgis-rest-feature-service/src/getAttachments.ts +64 -0
  134. package/packages/arcgis-rest-feature-service/src/helpers.ts +80 -0
  135. package/packages/arcgis-rest-feature-service/src/index.ts +12 -0
  136. package/packages/arcgis-rest-feature-service/src/query.ts +172 -0
  137. package/packages/arcgis-rest-feature-service/src/queryRelated.ts +91 -0
  138. package/packages/arcgis-rest-feature-service/src/update.ts +81 -0
  139. package/packages/arcgis-rest-feature-service/src/updateAttachment.ts +74 -0
  140. package/packages/arcgis-rest-feature-service/test/attachments.test.ts +203 -0
  141. package/packages/arcgis-rest-feature-service/test/features.test.ts +252 -0
  142. package/packages/arcgis-rest-feature-service/test/mocks/feature.ts +279 -0
  143. package/packages/arcgis-rest-feature-service/test/mocks/foo.txt +1 -0
  144. package/packages/arcgis-rest-feature-service/tsconfig.json +6 -0
  145. package/packages/arcgis-rest-feature-service-admin/README.md +66 -0
  146. package/packages/arcgis-rest-feature-service-admin/package-lock.json +11 -0
  147. package/packages/arcgis-rest-feature-service-admin/package.json +53 -0
  148. package/packages/arcgis-rest-feature-service-admin/src/addTo.ts +70 -0
  149. package/packages/arcgis-rest-feature-service-admin/src/create.ts +195 -0
  150. package/packages/arcgis-rest-feature-service-admin/src/index.ts +2 -0
  151. package/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts +310 -0
  152. package/packages/arcgis-rest-feature-service-admin/test/create.test.ts +412 -0
  153. package/packages/arcgis-rest-feature-service-admin/test/mocks/move.ts +14 -0
  154. package/packages/arcgis-rest-feature-service-admin/test/mocks/service.ts +72 -0
  155. package/packages/arcgis-rest-feature-service-admin/tsconfig.json +6 -0
  156. package/packages/arcgis-rest-geocoder/README.md +79 -0
  157. package/packages/arcgis-rest-geocoder/package-lock.json +11 -0
  158. package/packages/arcgis-rest-geocoder/package.json +52 -0
  159. package/packages/arcgis-rest-geocoder/src/bulk.ts +102 -0
  160. package/packages/arcgis-rest-geocoder/src/geocode.ts +117 -0
  161. package/packages/arcgis-rest-geocoder/src/helpers.ts +79 -0
  162. package/packages/arcgis-rest-geocoder/src/index.ts +8 -0
  163. package/packages/arcgis-rest-geocoder/src/reverse.ts +84 -0
  164. package/packages/arcgis-rest-geocoder/src/suggest.ts +72 -0
  165. package/packages/arcgis-rest-geocoder/test/bulk.test.ts +113 -0
  166. package/packages/arcgis-rest-geocoder/test/geocode.test.ts +121 -0
  167. package/packages/arcgis-rest-geocoder/test/helpers.test.ts +113 -0
  168. package/packages/arcgis-rest-geocoder/test/mocks/responses.ts +591 -0
  169. package/packages/arcgis-rest-geocoder/test/reverse.test.ts +126 -0
  170. package/packages/arcgis-rest-geocoder/test/suggest.test.ts +77 -0
  171. package/packages/arcgis-rest-geocoder/tsconfig.json +6 -0
  172. package/packages/arcgis-rest-groups/README.md +64 -0
  173. package/packages/arcgis-rest-groups/package-lock.json +11 -0
  174. package/packages/arcgis-rest-groups/package.json +52 -0
  175. package/packages/arcgis-rest-groups/src/create.ts +34 -0
  176. package/packages/arcgis-rest-groups/src/get.ts +95 -0
  177. package/packages/arcgis-rest-groups/src/helpers.ts +26 -0
  178. package/packages/arcgis-rest-groups/src/index.ts +11 -0
  179. package/packages/arcgis-rest-groups/src/notification.ts +77 -0
  180. package/packages/arcgis-rest-groups/src/protect.ts +40 -0
  181. package/packages/arcgis-rest-groups/src/remove.ts +23 -0
  182. package/packages/arcgis-rest-groups/src/search.ts +64 -0
  183. package/packages/arcgis-rest-groups/src/update.ts +36 -0
  184. package/packages/arcgis-rest-groups/test/crud.test.ts +104 -0
  185. package/packages/arcgis-rest-groups/test/get.test.ts +101 -0
  186. package/packages/arcgis-rest-groups/test/mocks/responses.ts +141 -0
  187. package/packages/arcgis-rest-groups/test/notification.test.ts +102 -0
  188. package/packages/arcgis-rest-groups/test/protect.test.ts +64 -0
  189. package/packages/arcgis-rest-groups/test/search.test.ts +85 -0
  190. package/packages/arcgis-rest-groups/tsconfig.json +6 -0
  191. package/packages/arcgis-rest-items/README.md +66 -0
  192. package/packages/arcgis-rest-items/package-lock.json +11 -0
  193. package/packages/arcgis-rest-items/package.json +52 -0
  194. package/packages/arcgis-rest-items/src/add.ts +103 -0
  195. package/packages/arcgis-rest-items/src/create.ts +110 -0
  196. package/packages/arcgis-rest-items/src/get.ts +79 -0
  197. package/packages/arcgis-rest-items/src/helpers.ts +147 -0
  198. package/packages/arcgis-rest-items/src/index.ts +11 -0
  199. package/packages/arcgis-rest-items/src/protect.ts +38 -0
  200. package/packages/arcgis-rest-items/src/remove.ts +58 -0
  201. package/packages/arcgis-rest-items/src/search.ts +78 -0
  202. package/packages/arcgis-rest-items/src/update.ts +134 -0
  203. package/packages/arcgis-rest-items/test/add.test.ts +256 -0
  204. package/packages/arcgis-rest-items/test/create.test.ts +371 -0
  205. package/packages/arcgis-rest-items/test/get.test.ts +181 -0
  206. package/packages/arcgis-rest-items/test/mocks/foo.zip +0 -0
  207. package/packages/arcgis-rest-items/test/mocks/item.ts +33 -0
  208. package/packages/arcgis-rest-items/test/mocks/resources.ts +31 -0
  209. package/packages/arcgis-rest-items/test/mocks/search.ts +63 -0
  210. package/packages/arcgis-rest-items/test/protect.test.ts +122 -0
  211. package/packages/arcgis-rest-items/test/remove.test.ts +161 -0
  212. package/packages/arcgis-rest-items/test/search.test.ts +159 -0
  213. package/packages/arcgis-rest-items/test/update.test.ts +450 -0
  214. package/packages/arcgis-rest-items/tsconfig.json +6 -0
  215. package/packages/arcgis-rest-request/README.md +65 -0
  216. package/packages/arcgis-rest-request/package-lock.json +11 -0
  217. package/packages/arcgis-rest-request/package.json +42 -0
  218. package/packages/arcgis-rest-request/src/index.ts +13 -0
  219. package/packages/arcgis-rest-request/src/request.ts +293 -0
  220. package/packages/arcgis-rest-request/src/utils/ArcGISAuthError.ts +67 -0
  221. package/packages/arcgis-rest-request/src/utils/ArcGISRequestError.ts +76 -0
  222. package/packages/arcgis-rest-request/src/utils/ErrorTypes.ts +29 -0
  223. package/packages/arcgis-rest-request/src/utils/check-for-errors.ts +65 -0
  224. package/packages/arcgis-rest-request/src/utils/encode-form-data.ts +34 -0
  225. package/packages/arcgis-rest-request/src/utils/encode-query-string.ts +23 -0
  226. package/packages/arcgis-rest-request/src/utils/get-portal-url.ts +25 -0
  227. package/packages/arcgis-rest-request/src/utils/get-portal.ts +45 -0
  228. package/packages/arcgis-rest-request/src/utils/process-params.ts +99 -0
  229. package/packages/arcgis-rest-request/test/mocks/errors.ts +68 -0
  230. package/packages/arcgis-rest-request/test/mocks/geojson-feature-collection.ts +13 -0
  231. package/packages/arcgis-rest-request/test/mocks/portal.ts +112 -0
  232. package/packages/arcgis-rest-request/test/mocks/sharing-rest-info.ts +41 -0
  233. package/packages/arcgis-rest-request/test/mocks/webmap.ts +41 -0
  234. package/packages/arcgis-rest-request/test/request.test.ts +299 -0
  235. package/packages/arcgis-rest-request/test/utils/ArcGISAuthError.test.ts +170 -0
  236. package/packages/arcgis-rest-request/test/utils/ArcGISRequestError.test.ts +51 -0
  237. package/packages/arcgis-rest-request/test/utils/check-for-errors.test.ts +111 -0
  238. package/packages/arcgis-rest-request/test/utils/encode-form-data.test.ts +133 -0
  239. package/packages/arcgis-rest-request/test/utils/get-portal-url.test.ts +37 -0
  240. package/packages/arcgis-rest-request/test/utils/portal.test.ts +97 -0
  241. package/packages/arcgis-rest-request/test/utils/process-params.test.ts +193 -0
  242. package/packages/arcgis-rest-request/tsconfig.json +6 -0
  243. package/packages/arcgis-rest-sharing/README.md +67 -0
  244. package/packages/arcgis-rest-sharing/package-lock.json +11 -0
  245. package/packages/arcgis-rest-sharing/package.json +57 -0
  246. package/packages/arcgis-rest-sharing/src/access.ts +85 -0
  247. package/packages/arcgis-rest-sharing/src/group-sharing.ts +211 -0
  248. package/packages/arcgis-rest-sharing/src/helpers.ts +82 -0
  249. package/packages/arcgis-rest-sharing/src/index.ts +5 -0
  250. package/packages/arcgis-rest-sharing/test/access.test.ts +154 -0
  251. package/packages/arcgis-rest-sharing/test/group-sharing.test.ts +566 -0
  252. package/packages/arcgis-rest-sharing/test/helpers.test.ts +55 -0
  253. package/packages/arcgis-rest-sharing/test/mocks/sharing.ts +18 -0
  254. package/packages/arcgis-rest-sharing/tsconfig.json +6 -0
  255. package/packages/arcgis-rest-users/README.md +71 -0
  256. package/packages/arcgis-rest-users/package-lock.json +11 -0
  257. package/packages/arcgis-rest-users/package.json +51 -0
  258. package/packages/arcgis-rest-users/src/get.ts +69 -0
  259. package/packages/arcgis-rest-users/src/index.ts +6 -0
  260. package/packages/arcgis-rest-users/src/invitation.ts +166 -0
  261. package/packages/arcgis-rest-users/src/notification.ts +73 -0
  262. package/packages/arcgis-rest-users/test/get.test.ts +99 -0
  263. package/packages/arcgis-rest-users/test/invitation.test.ts +169 -0
  264. package/packages/arcgis-rest-users/test/mocks/invitation.ts +70 -0
  265. package/packages/arcgis-rest-users/test/mocks/notification.ts +34 -0
  266. package/packages/arcgis-rest-users/test/mocks/user.ts +173 -0
  267. package/packages/arcgis-rest-users/test/notification.test.ts +83 -0
  268. package/packages/arcgis-rest-users/tsconfig.json +6 -0
  269. package/support/changelog.js +394 -0
  270. package/support/deploy-doc-site.js +16 -0
  271. package/support/publish.sh +43 -0
  272. package/support/test-helpers.js +8 -0
  273. package/tsconfig.json +69 -0
  274. package/tslint.json +15 -0
  275. package/umd-base-profile.js +82 -0
  276. package/umd-production-profile.js +13 -0
@@ -0,0 +1,301 @@
1
+ const spawn = require("cross-spawn");
2
+ const { join, resolve } = require("path");
3
+ const { readFile, writeFile } = require("fs");
4
+ const _ = require("lodash");
5
+ const OUTPUT = join(process.cwd(), "docs", "src", `typedoc.json`);
6
+ const { prettyifyUrl } = require("acetate/lib/utils.js");
7
+ const slug = require("slug");
8
+ const minimatch = require("minimatch");
9
+ const cheerio = require("cheerio");
10
+ const MarkdownIt = require("markdown-it");
11
+ const md = new MarkdownIt();
12
+
13
+ (function generateTypeDoc() {
14
+ return new Promise((resolve, reject) => {
15
+ const typedoc = spawn(
16
+ "typedoc",
17
+ [
18
+ "-json",
19
+ OUTPUT,
20
+ "--ignoreCompilerErrors",
21
+ "--module",
22
+ "common",
23
+ "--tsconfig",
24
+ "./tsconfig.json"
25
+ ],
26
+ {
27
+ stdio: "inherit"
28
+ }
29
+ );
30
+
31
+ typedoc.on("close", code => {
32
+ if (code !== 0) {
33
+ reject(code);
34
+ return;
35
+ }
36
+
37
+ readFile(OUTPUT, (error, content) => {
38
+ if (error) {
39
+ reject(error);
40
+ return;
41
+ }
42
+
43
+ resolve(JSON.parse(content.toString()));
44
+ });
45
+ });
46
+ })
47
+ .then(json => {
48
+ /**
49
+ * `json.children` will be a list of all TypeScript files in our project.
50
+ * We dont care about the files, we just need all their children so we reduce
51
+ * to a single list of everything in the entire project.
52
+ */
53
+ return json.children.reduce(
54
+ (allChildren, fileChildren) => allChildren.concat(fileChildren),
55
+ []
56
+ );
57
+ })
58
+ .then(children => {
59
+ /**
60
+ * We dont want TypeScript files that have been symlinked into `node_modules`
61
+ * folders by Lerna so ignore any child whose source file has `node_modules`
62
+ * in its `fileName`
63
+ */
64
+ return children.filter(
65
+ c => !minimatch(c.sources[0].fileName, "**/node_modules/**")
66
+ );
67
+ })
68
+ .then(children => {
69
+ /**
70
+ * We now only want children that are actual source files, not tests, so
71
+ * filter out all children without `src` in their path.
72
+ */
73
+ return children.filter(c =>
74
+ minimatch(c.sources[0].fileName, "**/src/**/*.ts")
75
+ );
76
+ })
77
+ .then(children => {
78
+ /**
79
+ * Some children might be empty so there is nothing to document in them.
80
+ * For example most `index.ts` files don't have anything besides `import`
81
+ * or `export` so we can safely filter these children out.
82
+ */
83
+ return children.filter(c => !!c.children);
84
+ })
85
+ .then(children => {
86
+ /**
87
+ * The `name` of each child is wrapped in extra quote marks remove these
88
+ * quote marks and add `.ts` back to the end of the `name`,
89
+ */
90
+ return children.map(child => {
91
+ child.name = child.name.replace(/\"/g, "") + ".ts";
92
+ return child;
93
+ });
94
+ })
95
+ .then(children => {
96
+ /**
97
+ * Now determine which `package` each of our children belongs to based on
98
+ * its name.
99
+ */
100
+ return children.map(child => {
101
+ child.name = _.first(child.name.split("/"));
102
+ child.package = child.name;
103
+ return child;
104
+ });
105
+ })
106
+ .then(children => {
107
+ /**
108
+ * `children` is currently a list of all TypeScript source files in
109
+ * `packages`. `children.children` is an array of all declarations in that
110
+ * source file. We need to concat all `children.children` arrays together
111
+ * into a giant array of all declarations in all packages.
112
+ */
113
+ return children.reduce((allChildren, child) => {
114
+ return allChildren.concat(
115
+ child.children.map(c => {
116
+ c.package = child.package;
117
+ return c;
118
+ })
119
+ );
120
+ }, []);
121
+ })
122
+ .then(children => {
123
+ /**
124
+ * Next we remove all children that are not exported out of their files.
125
+ */
126
+ return children.filter(c => c.flags && c.flags.isExported);
127
+ })
128
+ .then(declarations => {
129
+ /**
130
+ * Now that we have a list of all declarations across the entire project
131
+ * we can begin to generate additional information about each declaration.
132
+ * For example we can now determine the `src` of the page that will
133
+ * be generated for this declaration. Each `declaration` will also have
134
+ * `children` which we can generate and define an `icon` property for. These
135
+ * additional properties, `src`, `pageUrl`, `icon` and `children` are then
136
+ * merged into the `declaration`. This also adds a `title`, `description`
137
+ * and `titleSegments` to each page which are used in the template for SEO.
138
+ */
139
+ return declarations.map(declaration => {
140
+ const abbreviatedPackageName = declaration.package.replace("arcgis-rest-", "")
141
+ const src = `arcgis-rest-js/api/${abbreviatedPackageName}/${declaration.name}.html`;
142
+ let children;
143
+
144
+ if (declaration.children) {
145
+ children = declaration.children.map(child => {
146
+ child.icon = `tsd-kind-${slug(
147
+ child.kindString
148
+ ).toLowerCase()} tsd-parent-kind-${slug(
149
+ declaration.kindString
150
+ ).toLowerCase()}`;
151
+
152
+ if (child.flags.isPrivate) {
153
+ child.icon += ` tsd-is-private`;
154
+ }
155
+
156
+ if (child.flags.isProtected) {
157
+ child.icon += ` tsd-is-protected`;
158
+ }
159
+
160
+ if (child.flags.isStatic) {
161
+ child.icon += ` tsd-is-static`;
162
+ }
163
+
164
+ if (child.signatures) {
165
+ child.signatures = child.signatures.map(sig => {
166
+ sig.icon = child.icon;
167
+ return sig;
168
+ });
169
+ }
170
+
171
+ return child;
172
+ });
173
+ }
174
+
175
+ declaration.title = declaration.name;
176
+ declaration.titleSegments = ["API Reference"];
177
+ declaration.description =
178
+ declaration.comment && declaration.comment.shortText
179
+ ? cheerio
180
+ .load(md.render(declaration.comment.shortText))
181
+ .text()
182
+ .replace("\n", "")
183
+ : "API Reference documentation for ${child.name}, part of ${declaration.package}.";
184
+
185
+ return Object.assign(declaration, {
186
+ src,
187
+ pageUrl: prettyifyUrl(src),
188
+ icon: `tsd-kind-${slug(declaration.kindString).toLowerCase()}`,
189
+ children
190
+ });
191
+ });
192
+ })
193
+ .then(declarations => {
194
+ /**
195
+ * We now have a list of `declarations` that will be used to generate the
196
+ * individual API reference pages, but we still need to generate a landing
197
+ * page for each `package`. Return a new object with our `declarations` and
198
+ * a new property `packages` which is an array of every `package` with a
199
+ * page `src`, a `pageUrl`, an `icon` and a list of `declarations`. This
200
+ * also adds a `title`, `description` and `titleSegments` to each page
201
+ * which are used in the template for SEO.
202
+ */
203
+ return {
204
+ declarations,
205
+ packages: _(declarations)
206
+ .map(d => d.package)
207
+ .uniq()
208
+ .reduce((packages, package) => {
209
+ const abbreviatedPackageName = package.replace("arcgis-rest-", "")
210
+ const src = `arcgis-rest-js/api/${abbreviatedPackageName}.html`;
211
+ const pkg = require(`${process.cwd()}/packages/${package}/package.json`);
212
+
213
+ packages.push({
214
+ package,
215
+ pkg,
216
+ title: package,
217
+ description: pkg.description,
218
+ titleSegments: ["API Reference"],
219
+ name: package,
220
+ declarations: declarations.filter(d => d.package === package),
221
+ icon: "tsd-kind-module",
222
+ src,
223
+ pageUrl: prettyifyUrl(src)
224
+ });
225
+ return packages;
226
+ }, [])
227
+ };
228
+ })
229
+ .then(api => {
230
+ /**
231
+ * Since we generated the TypeDoc for the entire project at once each
232
+ * `declaration` has a unique numerical `id` property. We occasionally
233
+ * need to lookup a declaration by its `id` so we can prebuild an index of
234
+ * them here.
235
+ */
236
+ api.index = api.declarations.reduce((index, declaration) => {
237
+ index[declaration.id] = declaration;
238
+ return index;
239
+ }, {});
240
+
241
+ return api;
242
+ })
243
+ .then(api => {
244
+ /**
245
+ * In order to power the API reference quick search we can build an array
246
+ * of all declarations and child items
247
+ */
248
+ api.quickSearchIndex = api.declarations.reduce(
249
+ (quickSearchIndex, declaration) => {
250
+ if (declaration.children) {
251
+ quickSearchIndex = quickSearchIndex.concat(
252
+ declaration.children.map(child => {
253
+ return {
254
+ title: `${declaration.name}.${child.name}`,
255
+ url: `${declaration.pageUrl}#${child.name}`,
256
+ icon: child.icon
257
+ };
258
+ })
259
+ );
260
+ }
261
+
262
+ return quickSearchIndex.concat([
263
+ {
264
+ title: declaration.name,
265
+ url: declaration.pageUrl,
266
+ icon: declaration.icon
267
+ }
268
+ ]);
269
+ },
270
+ []
271
+ );
272
+
273
+ return api;
274
+ })
275
+ .then(api => {
276
+ /**
277
+ * Our final object looks like this:
278
+ *
279
+ * {
280
+ * packages: [Array of packages.],
281
+ * declarations: [Array of each exported declaration accross all source files.]
282
+ * index: { Object mapping each declaration.id as a key with the declaration as its value}
283
+ * }
284
+ *
285
+ * We now export this to the Acetate source directory.
286
+ */
287
+ return new Promise((resolve, reject) => {
288
+ writeFile(OUTPUT, JSON.stringify(api, null, 2), e => {
289
+ if (e) {
290
+ reject(e);
291
+ return;
292
+ }
293
+
294
+ resolve(api);
295
+ });
296
+ });
297
+ })
298
+ .catch(e => {
299
+ console.error(e);
300
+ });
301
+ })();
@@ -0,0 +1,82 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta content="IE=edge" http-equiv="X-UA-Compatible">
6
+ <meta name="viewport" content="width=device-width, user-scalable=no">
7
+ <title>{{title if title}}{{" | " + titleSegments | join(" |") if titleSegments}}{{" | " if title}}ArcGIS REST JS</title>
8
+ {% if description %}
9
+ <meta name="description" content="A modular, high quality toolkit for working with the ArcGIS REST API.">
10
+ {% endif %}
11
+ <link rel="stylesheet" href="https://s3-us-west-1.amazonaws.com/patterns.esri.com/files/calcite-web/1.0.0-rc.7/css/calcite-web.min.css">
12
+ <link rel="stylesheet" href="/arcgis-rest-js/css/style.css">
13
+ {% block css %}{% endblock %}
14
+ </head>
15
+ <body>
16
+ <!-- Drawer -->
17
+ <div class="drawer drawer-left js-drawer" data-drawer="top-nav" tabindex="0">
18
+ <nav class="drawer-nav" role="navigation">
19
+ <aside class="side-nav">
20
+ <h2 class="side-nav-title">ArcGIS REST JS</h2>
21
+ {% link "/arcgis-rest-js/guides/", "Guides", class="side-nav-link" %}
22
+ {% link "/arcgis-rest-js/api/", "API Reference", class="side-nav-link"%}
23
+ </aside>
24
+ </nav>
25
+ </div>
26
+
27
+ <div id="page" class="wrapper">
28
+ <!-- Sample HTML -->
29
+ <header class="top-nav">
30
+ <div class="grid-container">
31
+ <div class="column-24">
32
+ <!-- desktop sized navigation -->
33
+ <div class="tablet-hide">
34
+ <!-- logo / home -->
35
+ <a href="/arcgis-rest-js/" class="top-nav-title">ArcGIS REST JS</a>
36
+ <!-- primary navigation sections -->
37
+ <nav class="top-nav-list" role="navigation" aria-labelledby="topnav">
38
+ {% link "/arcgis-rest-js/guides/", "Guides", class="top-nav-link" %}
39
+ {% link "/arcgis-rest-js/api/", "API Reference", class="top-nav-link"%}
40
+ </nav>
41
+ </div>
42
+
43
+ <!-- tablet and mobile sized navigation -->
44
+ <div class="tablet-show top-nav-flex">
45
+ <!-- open primary navigation drawer -->
46
+ <nav class="top-nav-flex-list" role="navigation" aria-labelledby="topnav">
47
+ <a href="/arcgis-rest-js/" class="icon-ui-menu top-nav-link js-drawer-toggle" data-drawer="top-nav"><span class="phone-hide">Menu</span></a>
48
+ </nav>
49
+ <!-- logo / home -->
50
+ <header class="top-nav-flex-title">
51
+ <a href="/arcgis-rest-js/" class="top-nav-link">ArcGIS REST API JavaScript Client</a>
52
+ </header>
53
+ </div>
54
+ </div>
55
+
56
+ </div>
57
+ </header>
58
+
59
+
60
+ <main id="#skip-to-content">
61
+ {% block main %}{% endblock %}
62
+ </main>
63
+ </div>
64
+
65
+ <footer class="footer leader-1">
66
+ {% block footer %}{% endblock %}
67
+ <div class="grid-container">
68
+ <div class="column-24 trailer-half">
69
+ <a href="https://github.com/Esri/arcgis-rest-js" class="font-size--1">Fork this project on GitHub</a>
70
+ </div>
71
+ </div>
72
+ </footer>
73
+
74
+ <script src="https://s3-us-west-1.amazonaws.com/patterns.esri.com/files/calcite-web/1.0.0-rc.7/js/calcite-web.min.js"></script>
75
+
76
+ <script>
77
+ calcite.init()
78
+ </script>
79
+
80
+ {% block scripts %}{% endblock %}
81
+ </body>
82
+ </html>