ducimusipsa 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.prettierignore +2 -0
- package/.travis.yml +34 -0
- package/.vscode/launch.json +24 -0
- package/.vscode/settings.json +3 -0
- package/demos/ago-node-cli/README.md +29 -0
- package/demos/ago-node-cli/ago.js +32 -0
- package/demos/ago-node-cli/index.js +11 -0
- package/demos/ago-node-cli/lib/item-export-command.js +48 -0
- package/demos/ago-node-cli/lib/item-search-command.js +35 -0
- package/demos/ago-node-cli/package-lock.json +180 -0
- package/demos/ago-node-cli/package.json +30 -0
- package/demos/attachments/README.md +5 -0
- package/demos/attachments/index.html +164 -0
- package/demos/attachments/package-lock.json +182 -0
- package/demos/attachments/package.json +18 -0
- package/demos/batch-geocoder-node/NYC_Restaurant_Inspection_Results.csv +100 -0
- package/demos/batch-geocoder-node/README.md +15 -0
- package/demos/batch-geocoder-node/batch-geocode.js +115 -0
- package/demos/batch-geocoder-node/config-template.js +18 -0
- package/demos/batch-geocoder-node/package-lock.json +109 -0
- package/demos/batch-geocoder-node/package.json +38 -0
- package/demos/express/README.md +15 -0
- package/demos/express/config.json.template +3 -0
- package/demos/express/package-lock.json +428 -0
- package/demos/express/package.json +18 -0
- package/demos/express/server.js +33 -0
- package/demos/feature-service-browser/README.md +6 -0
- package/demos/feature-service-browser/index.html +122 -0
- package/demos/feature-service-browser/package-lock.json +182 -0
- package/demos/feature-service-browser/package.json +18 -0
- package/demos/geocoder-browser/README.md +10 -0
- package/demos/geocoder-browser/config.js.template +1 -0
- package/demos/geocoder-browser/index.html +131 -0
- package/demos/geocoder-browser/package-lock.json +182 -0
- package/demos/geocoder-browser/package.json +19 -0
- package/demos/geocoder-browser/post-sign-in.html +25 -0
- package/demos/jsapi-integration/README.md +25 -0
- package/demos/jsapi-integration/config.js +6 -0
- package/demos/jsapi-integration/index.html +85 -0
- package/demos/jsapi-integration/package-lock.json +184 -0
- package/demos/jsapi-integration/package.json +19 -0
- package/demos/oauth2-browser/README.md +14 -0
- package/demos/oauth2-browser/authenticate.html +32 -0
- package/demos/oauth2-browser/config.js.template +6 -0
- package/demos/oauth2-browser/index.html +202 -0
- package/demos/oauth2-browser/logo.svg +4 -0
- package/demos/oauth2-browser/package-lock.json +163 -0
- package/demos/oauth2-browser/package.json +18 -0
- package/demos/oauth2-browser/style.css +36 -0
- package/demos/oauth2-browser-retry/README.md +25 -0
- package/demos/oauth2-browser-retry/authenticate.html +21 -0
- package/demos/oauth2-browser-retry/index.html +116 -0
- package/demos/oauth2-browser-retry/logo.svg +4 -0
- package/demos/vue/.env.example +11 -0
- package/demos/vue/.eslintrc.js +17 -0
- package/demos/vue/.postcssrc.js +5 -0
- package/demos/vue/README.md +17 -0
- package/demos/vue/babel.config.js +3 -0
- package/demos/vue/package-lock.json +11323 -0
- package/demos/vue/package.json +33 -0
- package/demos/vue/public/favicon.ico +0 -0
- package/demos/vue/public/index.html +24 -0
- package/demos/vue/src/assets/logo.svg +29 -0
- package/demos/vue/src/components/App.vue +308 -0
- package/demos/vue/src/components/Authenticate.vue +65 -0
- package/demos/vue/src/components/Loader.vue +230 -0
- package/demos/vue/src/main.js +92 -0
- package/docs/FAQ.md +28 -0
- package/docs/HISTORY.md +62 -0
- package/docs/acetate.config.js +223 -0
- package/docs/build-typedoc.js +303 -0
- package/docs/src/_layout.html +82 -0
- package/docs/src/api/_declaration.html +496 -0
- package/docs/src/api/_layout.html +127 -0
- package/docs/src/api/_package.html +13 -0
- package/docs/src/api/index.html +23 -0
- package/docs/src/guides/_layout.html +24 -0
- package/docs/src/guides/amd-requirejs-dojo.md +40 -0
- package/docs/src/guides/babel-and-rollup.md +30 -0
- package/docs/src/guides/babel-and-webpack.md +30 -0
- package/docs/src/guides/browser-authentication.md +41 -0
- package/docs/src/guides/browserify.md +9 -0
- package/docs/src/guides/cli-authentication.md +9 -0
- package/docs/src/guides/client-server-authentication.md +9 -0
- package/docs/src/guides/from-a-cdn.md +36 -0
- package/docs/src/guides/index.md +52 -0
- package/docs/src/guides/node.md +70 -0
- package/docs/src/guides/package-overview.md +8 -0
- package/docs/src/guides/server-authentication.md +9 -0
- package/docs/src/guides/typescript-and-webpack.md +9 -0
- package/docs/src/img/icons.png +0 -0
- package/docs/src/img/icons@2x.png +0 -0
- package/docs/src/index.html +12 -0
- package/docs/src/js/api-search.js +112 -0
- package/docs/src/js/nav-toggle.js +41 -0
- package/docs/src/sass/_highlight.scss +96 -0
- package/docs/src/sass/_icons.scss +157 -0
- package/docs/src/sass/style.scss +169 -0
- package/jasmine.json +7 -0
- package/karma.conf.js +100 -0
- package/lerna.json +8 -0
- package/notes/README.md +88 -0
- package/package.json +129 -0
- package/packages/arcgis-rest-auth/README.md +67 -0
- package/packages/arcgis-rest-auth/package-lock.json +11 -0
- package/packages/arcgis-rest-auth/package.json +53 -0
- package/packages/arcgis-rest-auth/src/ApplicationSession.ts +108 -0
- package/packages/arcgis-rest-auth/src/UserSession.ts +880 -0
- package/packages/arcgis-rest-auth/src/authenticated-request-options.ts +24 -0
- package/packages/arcgis-rest-auth/src/fetch-token.ts +52 -0
- package/packages/arcgis-rest-auth/src/generate-token.ts +39 -0
- package/packages/arcgis-rest-auth/src/index.ts +8 -0
- package/packages/arcgis-rest-auth/test/ApplicationSession.test.ts +124 -0
- package/packages/arcgis-rest-auth/test/UserSession.test.ts +1005 -0
- package/packages/arcgis-rest-auth/test/fetchToken.test.ts +112 -0
- package/packages/arcgis-rest-auth/test/generateToken.test.ts +130 -0
- package/packages/arcgis-rest-auth/test/utils.ts +14 -0
- package/packages/arcgis-rest-auth/tsconfig.json +6 -0
- package/packages/arcgis-rest-common/README.md +57 -0
- package/packages/arcgis-rest-common/package-lock.json +11 -0
- package/packages/arcgis-rest-common/package.json +41 -0
- package/packages/arcgis-rest-common/src/index.ts +10 -0
- package/packages/arcgis-rest-common/src/types/feature.ts +14 -0
- package/packages/arcgis-rest-common/src/types/geometry.ts +47 -0
- package/packages/arcgis-rest-common/src/types/symbol.ts +21 -0
- package/packages/arcgis-rest-common/src/util/location.ts +19 -0
- package/packages/arcgis-rest-common/test/location.test.ts +73 -0
- package/packages/arcgis-rest-common/tsconfig.json +6 -0
- package/packages/arcgis-rest-common-types/README.md +64 -0
- package/packages/arcgis-rest-common-types/package.json +40 -0
- package/packages/arcgis-rest-common-types/src/group.ts +54 -0
- package/packages/arcgis-rest-common-types/src/index.ts +469 -0
- package/packages/arcgis-rest-common-types/src/item.ts +47 -0
- package/packages/arcgis-rest-common-types/src/webmap.ts +1267 -0
- package/packages/arcgis-rest-common-types/tsconfig.json +11 -0
- package/packages/arcgis-rest-feature-service/README.md +73 -0
- package/packages/arcgis-rest-feature-service/package-lock.json +11 -0
- package/packages/arcgis-rest-feature-service/package.json +53 -0
- package/packages/arcgis-rest-feature-service/src/add.ts +90 -0
- package/packages/arcgis-rest-feature-service/src/addAttachment.ts +64 -0
- package/packages/arcgis-rest-feature-service/src/decodeValues.ts +129 -0
- package/packages/arcgis-rest-feature-service/src/delete.ts +97 -0
- package/packages/arcgis-rest-feature-service/src/deleteAttachments.ts +67 -0
- package/packages/arcgis-rest-feature-service/src/getAttachments.ts +64 -0
- package/packages/arcgis-rest-feature-service/src/getLayer.ts +27 -0
- package/packages/arcgis-rest-feature-service/src/helpers.ts +50 -0
- package/packages/arcgis-rest-feature-service/src/index.ts +14 -0
- package/packages/arcgis-rest-feature-service/src/query.ts +183 -0
- package/packages/arcgis-rest-feature-service/src/queryRelated.ts +94 -0
- package/packages/arcgis-rest-feature-service/src/update.ts +90 -0
- package/packages/arcgis-rest-feature-service/src/updateAttachment.ts +73 -0
- package/packages/arcgis-rest-feature-service/test/attachments.test.ts +203 -0
- package/packages/arcgis-rest-feature-service/test/crud.test.ts +263 -0
- package/packages/arcgis-rest-feature-service/test/decodeValues.test.ts +67 -0
- package/packages/arcgis-rest-feature-service/test/getLayer.test.ts +31 -0
- package/packages/arcgis-rest-feature-service/test/mocks/cvdQueryResponse.ts +225 -0
- package/packages/arcgis-rest-feature-service/test/mocks/feature.ts +281 -0
- package/packages/arcgis-rest-feature-service/test/mocks/fields.ts +779 -0
- package/packages/arcgis-rest-feature-service/test/mocks/foo.txt +1 -0
- package/packages/arcgis-rest-feature-service/test/mocks/service.ts +259 -0
- package/packages/arcgis-rest-feature-service/test/query.test.ts +140 -0
- package/packages/arcgis-rest-feature-service/tsconfig.json +6 -0
- package/packages/arcgis-rest-feature-service-admin/README.md +69 -0
- package/packages/arcgis-rest-feature-service-admin/package-lock.json +11 -0
- package/packages/arcgis-rest-feature-service-admin/package.json +56 -0
- package/packages/arcgis-rest-feature-service-admin/src/addTo.ts +74 -0
- package/packages/arcgis-rest-feature-service-admin/src/create.ts +207 -0
- package/packages/arcgis-rest-feature-service-admin/src/index.ts +2 -0
- package/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts +353 -0
- package/packages/arcgis-rest-feature-service-admin/test/create.test.ts +412 -0
- package/packages/arcgis-rest-feature-service-admin/test/mocks/layerDefinition.ts +79 -0
- package/packages/arcgis-rest-feature-service-admin/test/mocks/move.ts +14 -0
- package/packages/arcgis-rest-feature-service-admin/test/mocks/service.ts +72 -0
- package/packages/arcgis-rest-feature-service-admin/tsconfig.json +6 -0
- package/packages/arcgis-rest-geocoder/README.md +83 -0
- package/packages/arcgis-rest-geocoder/package-lock.json +11 -0
- package/packages/arcgis-rest-geocoder/package.json +55 -0
- package/packages/arcgis-rest-geocoder/src/bulk.ts +102 -0
- package/packages/arcgis-rest-geocoder/src/geocode.ts +130 -0
- package/packages/arcgis-rest-geocoder/src/helpers.ts +80 -0
- package/packages/arcgis-rest-geocoder/src/index.ts +8 -0
- package/packages/arcgis-rest-geocoder/src/reverse.ts +83 -0
- package/packages/arcgis-rest-geocoder/src/suggest.ts +69 -0
- package/packages/arcgis-rest-geocoder/test/bulk.test.ts +113 -0
- package/packages/arcgis-rest-geocoder/test/geocode.test.ts +176 -0
- package/packages/arcgis-rest-geocoder/test/helpers.test.ts +111 -0
- package/packages/arcgis-rest-geocoder/test/mocks/responses.ts +629 -0
- package/packages/arcgis-rest-geocoder/test/reverse.test.ts +126 -0
- package/packages/arcgis-rest-geocoder/test/suggest.test.ts +98 -0
- package/packages/arcgis-rest-geocoder/tsconfig.json +6 -0
- package/packages/arcgis-rest-groups/README.md +67 -0
- package/packages/arcgis-rest-groups/package-lock.json +11 -0
- package/packages/arcgis-rest-groups/package.json +55 -0
- package/packages/arcgis-rest-groups/src/create.ts +34 -0
- package/packages/arcgis-rest-groups/src/get.ts +95 -0
- package/packages/arcgis-rest-groups/src/helpers.ts +27 -0
- package/packages/arcgis-rest-groups/src/index.ts +11 -0
- package/packages/arcgis-rest-groups/src/notification.ts +77 -0
- package/packages/arcgis-rest-groups/src/protect.ts +40 -0
- package/packages/arcgis-rest-groups/src/remove.ts +23 -0
- package/packages/arcgis-rest-groups/src/search.ts +64 -0
- package/packages/arcgis-rest-groups/src/update.ts +36 -0
- package/packages/arcgis-rest-groups/test/crud.test.ts +134 -0
- package/packages/arcgis-rest-groups/test/get.test.ts +101 -0
- package/packages/arcgis-rest-groups/test/mocks/responses.ts +141 -0
- package/packages/arcgis-rest-groups/test/notification.test.ts +102 -0
- package/packages/arcgis-rest-groups/test/protect.test.ts +64 -0
- package/packages/arcgis-rest-groups/test/search.test.ts +85 -0
- package/packages/arcgis-rest-groups/tsconfig.json +6 -0
- package/packages/arcgis-rest-items/README.md +69 -0
- package/packages/arcgis-rest-items/package-lock.json +11 -0
- package/packages/arcgis-rest-items/package.json +55 -0
- package/packages/arcgis-rest-items/src/add.ts +103 -0
- package/packages/arcgis-rest-items/src/create.ts +110 -0
- package/packages/arcgis-rest-items/src/get.ts +79 -0
- package/packages/arcgis-rest-items/src/helpers.ts +147 -0
- package/packages/arcgis-rest-items/src/index.ts +11 -0
- package/packages/arcgis-rest-items/src/protect.ts +38 -0
- package/packages/arcgis-rest-items/src/remove.ts +58 -0
- package/packages/arcgis-rest-items/src/search.ts +78 -0
- package/packages/arcgis-rest-items/src/update.ts +134 -0
- package/packages/arcgis-rest-items/test/add.test.ts +256 -0
- package/packages/arcgis-rest-items/test/create.test.ts +371 -0
- package/packages/arcgis-rest-items/test/get.test.ts +181 -0
- package/packages/arcgis-rest-items/test/mocks/foo.zip +0 -0
- package/packages/arcgis-rest-items/test/mocks/item.ts +35 -0
- package/packages/arcgis-rest-items/test/mocks/resources.ts +31 -0
- package/packages/arcgis-rest-items/test/mocks/search.ts +62 -0
- package/packages/arcgis-rest-items/test/protect.test.ts +122 -0
- package/packages/arcgis-rest-items/test/remove.test.ts +161 -0
- package/packages/arcgis-rest-items/test/search.test.ts +159 -0
- package/packages/arcgis-rest-items/test/update.test.ts +450 -0
- package/packages/arcgis-rest-items/tsconfig.json +6 -0
- package/packages/arcgis-rest-request/README.md +68 -0
- package/packages/arcgis-rest-request/package-lock.json +11 -0
- package/packages/arcgis-rest-request/package.json +45 -0
- package/packages/arcgis-rest-request/src/index.ts +15 -0
- package/packages/arcgis-rest-request/src/request.ts +358 -0
- package/packages/arcgis-rest-request/src/utils/ArcGISRequestError.ts +76 -0
- package/packages/arcgis-rest-request/src/utils/ErrorTypes.ts +29 -0
- package/packages/arcgis-rest-request/src/utils/append-custom-params.ts +29 -0
- package/packages/arcgis-rest-request/src/utils/encode-form-data.ts +34 -0
- package/packages/arcgis-rest-request/src/utils/encode-query-string.ts +23 -0
- package/packages/arcgis-rest-request/src/utils/get-portal-url.ts +25 -0
- package/packages/arcgis-rest-request/src/utils/get-portal.ts +45 -0
- package/packages/arcgis-rest-request/src/utils/params.ts +52 -0
- package/packages/arcgis-rest-request/src/utils/process-params.ts +99 -0
- package/packages/arcgis-rest-request/src/utils/retryAuthError.ts +9 -0
- package/packages/arcgis-rest-request/src/utils/warn.ts +11 -0
- package/packages/arcgis-rest-request/test/mocks/errors.ts +68 -0
- package/packages/arcgis-rest-request/test/mocks/geojson-feature-collection.ts +13 -0
- package/packages/arcgis-rest-request/test/mocks/portal.ts +112 -0
- package/packages/arcgis-rest-request/test/mocks/sharing-rest-info.ts +41 -0
- package/packages/arcgis-rest-request/test/mocks/webmap.ts +41 -0
- package/packages/arcgis-rest-request/test/request.test.ts +323 -0
- package/packages/arcgis-rest-request/test/utils/ArcGISAuthError.test.ts +170 -0
- package/packages/arcgis-rest-request/test/utils/ArcGISRequestError.test.ts +51 -0
- package/packages/arcgis-rest-request/test/utils/check-for-errors.test.ts +111 -0
- package/packages/arcgis-rest-request/test/utils/encode-form-data.test.ts +133 -0
- package/packages/arcgis-rest-request/test/utils/get-portal-url.test.ts +37 -0
- package/packages/arcgis-rest-request/test/utils/portal.test.ts +97 -0
- package/packages/arcgis-rest-request/test/utils/process-params.test.ts +193 -0
- package/packages/arcgis-rest-request/tsconfig.json +6 -0
- package/packages/arcgis-rest-routing/README.md +71 -0
- package/packages/arcgis-rest-routing/package-lock.json +11 -0
- package/packages/arcgis-rest-routing/package.json +54 -0
- package/packages/arcgis-rest-routing/src/helpers.ts +16 -0
- package/packages/arcgis-rest-routing/src/index.ts +4 -0
- package/packages/arcgis-rest-routing/src/solveRoute.ts +102 -0
- package/packages/arcgis-rest-routing/test/mocks/responses.ts +825 -0
- package/packages/arcgis-rest-routing/test/solveRoute.test.ts +267 -0
- package/packages/arcgis-rest-routing/tsconfig.json +6 -0
- package/packages/arcgis-rest-sharing/README.md +70 -0
- package/packages/arcgis-rest-sharing/package-lock.json +11 -0
- package/packages/arcgis-rest-sharing/package.json +60 -0
- package/packages/arcgis-rest-sharing/src/access.ts +85 -0
- package/packages/arcgis-rest-sharing/src/group-sharing.ts +211 -0
- package/packages/arcgis-rest-sharing/src/helpers.ts +82 -0
- package/packages/arcgis-rest-sharing/src/index.ts +5 -0
- package/packages/arcgis-rest-sharing/test/access.test.ts +154 -0
- package/packages/arcgis-rest-sharing/test/group-sharing.test.ts +566 -0
- package/packages/arcgis-rest-sharing/test/helpers.test.ts +55 -0
- package/packages/arcgis-rest-sharing/test/mocks/sharing.ts +18 -0
- package/packages/arcgis-rest-sharing/tsconfig.json +6 -0
- package/packages/arcgis-rest-users/README.md +74 -0
- package/packages/arcgis-rest-users/package-lock.json +11 -0
- package/packages/arcgis-rest-users/package.json +54 -0
- package/packages/arcgis-rest-users/src/get.ts +69 -0
- package/packages/arcgis-rest-users/src/index.ts +6 -0
- package/packages/arcgis-rest-users/src/invitation.ts +166 -0
- package/packages/arcgis-rest-users/src/notification.ts +73 -0
- package/packages/arcgis-rest-users/test/get.test.ts +99 -0
- package/packages/arcgis-rest-users/test/invitation.test.ts +169 -0
- package/packages/arcgis-rest-users/test/mocks/invitation.ts +70 -0
- package/packages/arcgis-rest-users/test/mocks/notification.ts +34 -0
- package/packages/arcgis-rest-users/test/mocks/user.ts +173 -0
- package/packages/arcgis-rest-users/test/notification.test.ts +83 -0
- package/packages/arcgis-rest-users/tsconfig.json +6 -0
- package/support/changelog.js +394 -0
- package/support/deploy-doc-site.js +16 -0
- package/support/dev.sh +6 -0
- package/support/publish.sh +43 -0
- package/support/test-helpers.js +8 -0
- package/tsconfig.json +69 -0
- package/tslint.json +16 -0
- package/umd-base-profile.js +82 -0
- package/umd-production-profile.js +13 -0
@@ -0,0 +1,303 @@
|
|
1
|
+
const spawn = require("cross-spawn");
|
2
|
+
const { join } = 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
|
+
"--exclude",
|
21
|
+
"**/*test.ts",
|
22
|
+
"--ignoreCompilerErrors",
|
23
|
+
"--module",
|
24
|
+
"common",
|
25
|
+
"--tsconfig",
|
26
|
+
"./tsconfig.json"
|
27
|
+
],
|
28
|
+
{
|
29
|
+
stdio: "inherit"
|
30
|
+
}
|
31
|
+
);
|
32
|
+
|
33
|
+
typedoc.on("close", code => {
|
34
|
+
if (code !== 0) {
|
35
|
+
reject(code);
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
|
39
|
+
readFile(OUTPUT, (error, content) => {
|
40
|
+
if (error) {
|
41
|
+
reject(error);
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
|
45
|
+
resolve(JSON.parse(content.toString()));
|
46
|
+
});
|
47
|
+
});
|
48
|
+
})
|
49
|
+
.then(json => {
|
50
|
+
/**
|
51
|
+
* `json.children` will be a list of all TypeScript files in our project.
|
52
|
+
* We dont care about the files, we just need all their children so we reduce
|
53
|
+
* to a single list of everything in the entire project.
|
54
|
+
*/
|
55
|
+
return json.children.reduce(
|
56
|
+
(allChildren, fileChildren) => allChildren.concat(fileChildren),
|
57
|
+
[]
|
58
|
+
);
|
59
|
+
})
|
60
|
+
.then(children => {
|
61
|
+
/**
|
62
|
+
* We dont want TypeScript files that have been symlinked into `node_modules`
|
63
|
+
* folders by Lerna so ignore any child whose source file has `node_modules`
|
64
|
+
* in its `fileName`
|
65
|
+
*/
|
66
|
+
return children.filter(
|
67
|
+
c => !minimatch(c.sources[0].fileName, "**/node_modules/**")
|
68
|
+
);
|
69
|
+
})
|
70
|
+
.then(children => {
|
71
|
+
/**
|
72
|
+
* We now only want children that are actual source files, not tests, so
|
73
|
+
* filter out all children without `src` in their path.
|
74
|
+
*/
|
75
|
+
return children.filter(c =>
|
76
|
+
minimatch(c.sources[0].fileName, "**/src/**/*.ts")
|
77
|
+
);
|
78
|
+
})
|
79
|
+
.then(children => {
|
80
|
+
/**
|
81
|
+
* Some children might be empty so there is nothing to document in them.
|
82
|
+
* For example most `index.ts` files don't have anything besides `import`
|
83
|
+
* or `export` so we can safely filter these children out.
|
84
|
+
*/
|
85
|
+
return children.filter(c => !!c.children);
|
86
|
+
})
|
87
|
+
.then(children => {
|
88
|
+
/**
|
89
|
+
* The `name` of each child is wrapped in extra quote marks remove these
|
90
|
+
* quote marks and add `.ts` back to the end of the `name`,
|
91
|
+
*/
|
92
|
+
return children.map(child => {
|
93
|
+
child.name = child.name.replace(/\"/g, "") + ".ts";
|
94
|
+
return child;
|
95
|
+
});
|
96
|
+
})
|
97
|
+
.then(children => {
|
98
|
+
/**
|
99
|
+
* Now determine which `package` each of our children belongs to based on
|
100
|
+
* its name.
|
101
|
+
*/
|
102
|
+
return children.map(child => {
|
103
|
+
child.name = _.first(child.name.split("/"));
|
104
|
+
child.package = child.name;
|
105
|
+
return child;
|
106
|
+
});
|
107
|
+
})
|
108
|
+
.then(children => {
|
109
|
+
/**
|
110
|
+
* `children` is currently a list of all TypeScript source files in
|
111
|
+
* `packages`. `children.children` is an array of all declarations in that
|
112
|
+
* source file. We need to concat all `children.children` arrays together
|
113
|
+
* into a giant array of all declarations in all packages.
|
114
|
+
*/
|
115
|
+
return children.reduce((allChildren, child) => {
|
116
|
+
return allChildren.concat(
|
117
|
+
child.children.map(c => {
|
118
|
+
c.package = child.package;
|
119
|
+
return c;
|
120
|
+
})
|
121
|
+
);
|
122
|
+
}, []);
|
123
|
+
})
|
124
|
+
.then(children => {
|
125
|
+
/**
|
126
|
+
* Next we remove all children that are not exported out of their files.
|
127
|
+
*/
|
128
|
+
return children.filter(c => c.flags && c.flags.isExported);
|
129
|
+
})
|
130
|
+
.then(declarations => {
|
131
|
+
/**
|
132
|
+
* Now that we have a list of all declarations across the entire project
|
133
|
+
* we can begin to generate additional information about each declaration.
|
134
|
+
* For example we can now determine the `src` of the page that will
|
135
|
+
* be generated for this declaration. Each `declaration` will also have
|
136
|
+
* `children` which we can generate and define an `icon` property for. These
|
137
|
+
* additional properties, `src`, `pageUrl`, `icon` and `children` are then
|
138
|
+
* merged into the `declaration`. This also adds a `title`, `description`
|
139
|
+
* and `titleSegments` to each page which are used in the template for SEO.
|
140
|
+
*/
|
141
|
+
return declarations.map(declaration => {
|
142
|
+
const abbreviatedPackageName = declaration.package.replace("arcgis-rest-", "")
|
143
|
+
const src = `arcgis-rest-js/api/${abbreviatedPackageName}/${declaration.name}.html`;
|
144
|
+
let children;
|
145
|
+
|
146
|
+
if (declaration.children) {
|
147
|
+
children = declaration.children.map(child => {
|
148
|
+
child.icon = `tsd-kind-${slug(
|
149
|
+
child.kindString
|
150
|
+
).toLowerCase()} tsd-parent-kind-${slug(
|
151
|
+
declaration.kindString
|
152
|
+
).toLowerCase()}`;
|
153
|
+
|
154
|
+
if (child.flags.isPrivate) {
|
155
|
+
child.icon += ` tsd-is-private`;
|
156
|
+
}
|
157
|
+
|
158
|
+
if (child.flags.isProtected) {
|
159
|
+
child.icon += ` tsd-is-protected`;
|
160
|
+
}
|
161
|
+
|
162
|
+
if (child.flags.isStatic) {
|
163
|
+
child.icon += ` tsd-is-static`;
|
164
|
+
}
|
165
|
+
|
166
|
+
if (child.signatures) {
|
167
|
+
child.signatures = child.signatures.map(sig => {
|
168
|
+
sig.icon = child.icon;
|
169
|
+
return sig;
|
170
|
+
});
|
171
|
+
}
|
172
|
+
|
173
|
+
return child;
|
174
|
+
});
|
175
|
+
}
|
176
|
+
|
177
|
+
declaration.title = declaration.name;
|
178
|
+
declaration.titleSegments = ["API Reference"];
|
179
|
+
declaration.description =
|
180
|
+
declaration.comment && declaration.comment.shortText
|
181
|
+
? cheerio
|
182
|
+
.load(md.render(declaration.comment.shortText))
|
183
|
+
.text()
|
184
|
+
.replace("\n", "")
|
185
|
+
: "API Reference documentation for ${child.name}, part of ${declaration.package}.";
|
186
|
+
|
187
|
+
return Object.assign(declaration, {
|
188
|
+
src,
|
189
|
+
pageUrl: prettyifyUrl(src),
|
190
|
+
icon: `tsd-kind-${slug(declaration.kindString).toLowerCase()}`,
|
191
|
+
children
|
192
|
+
});
|
193
|
+
});
|
194
|
+
})
|
195
|
+
.then(declarations => {
|
196
|
+
/**
|
197
|
+
* We now have a list of `declarations` that will be used to generate the
|
198
|
+
* individual API reference pages, but we still need to generate a landing
|
199
|
+
* page for each `package`. Return a new object with our `declarations` and
|
200
|
+
* a new property `packages` which is an array of every `package` with a
|
201
|
+
* page `src`, a `pageUrl`, an `icon` and a list of `declarations`. This
|
202
|
+
* also adds a `title`, `description` and `titleSegments` to each page
|
203
|
+
* which are used in the template for SEO.
|
204
|
+
*/
|
205
|
+
return {
|
206
|
+
declarations,
|
207
|
+
packages: _(declarations)
|
208
|
+
.map(d => d.package)
|
209
|
+
.uniq()
|
210
|
+
.reduce((packages, package) => {
|
211
|
+
const abbreviatedPackageName = package.replace("arcgis-rest-", "")
|
212
|
+
const src = `arcgis-rest-js/api/${abbreviatedPackageName}.html`;
|
213
|
+
const pkg = require(`${process.cwd()}/packages/${package}/package.json`);
|
214
|
+
|
215
|
+
packages.push({
|
216
|
+
package,
|
217
|
+
pkg,
|
218
|
+
title: package,
|
219
|
+
description: pkg.description,
|
220
|
+
titleSegments: ["API Reference"],
|
221
|
+
name: package,
|
222
|
+
declarations: declarations.filter(d => d.package === package),
|
223
|
+
icon: "tsd-kind-module",
|
224
|
+
src,
|
225
|
+
pageUrl: prettyifyUrl(src)
|
226
|
+
});
|
227
|
+
return packages;
|
228
|
+
}, [])
|
229
|
+
};
|
230
|
+
})
|
231
|
+
.then(api => {
|
232
|
+
/**
|
233
|
+
* Since we generated the TypeDoc for the entire project at once each
|
234
|
+
* `declaration` has a unique numerical `id` property. We occasionally
|
235
|
+
* need to lookup a declaration by its `id` so we can prebuild an index of
|
236
|
+
* them here.
|
237
|
+
*/
|
238
|
+
api.index = api.declarations.reduce((index, declaration) => {
|
239
|
+
index[declaration.id] = declaration;
|
240
|
+
return index;
|
241
|
+
}, {});
|
242
|
+
|
243
|
+
return api;
|
244
|
+
})
|
245
|
+
.then(api => {
|
246
|
+
/**
|
247
|
+
* In order to power the API reference quick search we can build an array
|
248
|
+
* of all declarations and child items
|
249
|
+
*/
|
250
|
+
api.quickSearchIndex = api.declarations.reduce(
|
251
|
+
(quickSearchIndex, declaration) => {
|
252
|
+
if (declaration.children) {
|
253
|
+
quickSearchIndex = quickSearchIndex.concat(
|
254
|
+
declaration.children.map(child => {
|
255
|
+
return {
|
256
|
+
title: `${declaration.name}.${child.name}`,
|
257
|
+
url: `${declaration.pageUrl}#${child.name}`,
|
258
|
+
icon: child.icon
|
259
|
+
};
|
260
|
+
})
|
261
|
+
);
|
262
|
+
}
|
263
|
+
|
264
|
+
return quickSearchIndex.concat([
|
265
|
+
{
|
266
|
+
title: declaration.name,
|
267
|
+
url: declaration.pageUrl,
|
268
|
+
icon: declaration.icon
|
269
|
+
}
|
270
|
+
]);
|
271
|
+
},
|
272
|
+
[]
|
273
|
+
);
|
274
|
+
|
275
|
+
return api;
|
276
|
+
})
|
277
|
+
.then(api => {
|
278
|
+
/**
|
279
|
+
* Our final object looks like this:
|
280
|
+
*
|
281
|
+
* {
|
282
|
+
* packages: [Array of packages.],
|
283
|
+
* declarations: [Array of each exported declaration accross all source files.]
|
284
|
+
* index: { Object mapping each declaration.id as a key with the declaration as its value}
|
285
|
+
* }
|
286
|
+
*
|
287
|
+
* We now export this to the Acetate source directory.
|
288
|
+
*/
|
289
|
+
return new Promise((resolve, reject) => {
|
290
|
+
writeFile(OUTPUT, JSON.stringify(api, null, 2), e => {
|
291
|
+
if (e) {
|
292
|
+
reject(e);
|
293
|
+
return;
|
294
|
+
}
|
295
|
+
|
296
|
+
resolve(api);
|
297
|
+
});
|
298
|
+
});
|
299
|
+
})
|
300
|
+
.catch(e => {
|
301
|
+
console.error(e);
|
302
|
+
});
|
303
|
+
})();
|
@@ -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>
|