├── @here ├── olp-sdk-core │ ├── lib │ │ ├── .gitkeep │ │ ├── client │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── cache │ │ │ └── index.ts │ │ └── utils │ │ │ ├── FetchOptions.ts │ │ │ ├── userAgent.ts │ │ │ ├── DownloadManager.ts │ │ │ ├── Uuid.ts │ │ │ ├── index.ts │ │ │ ├── HttpError.ts │ │ │ └── getDataSizeUtil.ts │ ├── test │ │ ├── unit │ │ │ ├── .gitkeep │ │ │ ├── Uuid.test.ts │ │ │ └── userAgent.test.ts │ │ ├── tsconfig.json │ │ └── mocha.opts │ ├── .prettierrc.json │ ├── .gitignore │ ├── tsconfig.json │ ├── .npmignore │ ├── webpack.config.js │ ├── lib.version.ts │ ├── index.web.ts │ ├── index.ts │ ├── README.md │ └── package.json ├── olp-sdk-fetch │ ├── test │ │ ├── resources │ │ │ ├── test.bin │ │ │ └── test.json │ │ ├── tsconfig.json │ │ └── mocha.opts │ ├── .prettierrc.json │ ├── tsconfig.json │ ├── .gitignore │ ├── .npmignore │ ├── webpack.config.js │ ├── index.web.ts │ ├── README.md │ └── package.json ├── olp-sdk-authentication │ ├── .prettierrc.json │ ├── olp-sdk-authentication │ ├── test │ │ ├── tsconfig.json │ │ ├── mocha.opts │ │ ├── test-error-credentials.properties │ │ ├── test-credentials.properties │ │ └── loadCredentialsFromFile.test.ts │ ├── .gitignore │ ├── tsconfig.json │ ├── .npmignore │ ├── webpack.config.js │ ├── index.ts │ ├── oauth-requester │ ├── index.web.ts │ ├── index.node.ts │ └── lib │ │ ├── requestToken.ts │ │ └── loadCredentialsFromFile.ts ├── olp-sdk-dataservice-api │ ├── .prettierrc.json │ ├── test │ │ ├── tsconfig.json │ │ ├── mocha.opts │ │ ├── DataStoreApi.test.ts │ │ └── MockedRequestBuilder.ts │ ├── tsconfig.json │ ├── .gitignore │ ├── .npmignore │ ├── api-generator │ │ ├── README.md │ │ └── templates │ │ │ └── TypeScript-Fetch │ │ │ └── licenseInfo.mustache │ ├── webpack.config.js │ ├── README.md │ ├── index.ts │ └── package.json ├── olp-sdk-dataservice-read │ ├── .prettierrc.json │ ├── test │ │ ├── tsconfig.json │ │ ├── mocha.opts │ │ └── unit │ │ │ ├── CatalogRequest.test.ts │ │ │ ├── TileRequest.test.ts │ │ │ ├── UnsubscribeRequest.test.ts │ │ │ ├── PollRequest.test.ts │ │ │ ├── IndexQueryRequest.test.ts │ │ │ └── SchemaRequest.test.ts │ ├── .gitignore │ ├── tsconfig.json │ ├── .npmignore │ ├── webpack.config.js │ ├── index.web.ts │ ├── lib │ │ ├── index.ts │ │ ├── cache │ │ │ └── index.ts │ │ ├── utils │ │ │ ├── index.ts │ │ │ ├── validatePartitionsIdsList.ts │ │ │ └── validateBillingTag.ts │ │ └── client │ │ │ ├── CatalogRequest.ts │ │ │ ├── index.ts │ │ │ ├── PollRequest.ts │ │ │ ├── UnsubscribeRequest.ts │ │ │ └── IndexQueryRequest.ts │ └── index.ts └── olp-sdk-dataservice-write │ ├── .prettierrc.json │ ├── test │ ├── tsconfig.json │ ├── mocha.opts │ └── unit │ │ ├── BufferData.test.ts │ │ ├── UploadBlobResult.test.ts │ │ ├── GetBatchRequest.test.ts │ │ ├── CancelBatchRequest.test.ts │ │ ├── CompleteBatchRequest.test.ts │ │ ├── WebData.test.ts │ │ ├── CheckDataExistsRequest.test.ts │ │ ├── StartBatchRequest.test.ts │ │ └── UploadBlobRequest.test.ts │ ├── .gitignore │ ├── tsconfig.json │ ├── .npmignore │ ├── webpack.config.js │ ├── index.web.ts │ ├── lib │ ├── index.ts │ ├── utils │ │ ├── index.ts │ │ ├── multipartupload-internal │ │ │ ├── BufferData.ts │ │ │ ├── WebData.ts │ │ │ ├── UploadRequest.ts │ │ │ └── NodeFileData.ts │ │ └── BlobData.ts │ └── client │ │ ├── index.ts │ │ ├── UploadBlobResult.ts │ │ ├── CancelBatchRequest.ts │ │ ├── CompleteBatchRequest.ts │ │ └── GetBatchRequest.ts │ └── index.ts ├── examples ├── react-app-example │ ├── .env │ ├── public │ │ ├── robots.txt │ │ ├── credentials.json.sample │ │ ├── favicon.ico │ │ ├── manifest.json │ │ └── index.html │ ├── .gitignore │ ├── tsconfig.json │ ├── src │ │ ├── Catalogs.css │ │ ├── index.tsx │ │ ├── index.css │ │ ├── listOfCatalogs.ts │ │ ├── getOlpClientSettings.ts │ │ ├── Catalogs.tsx │ │ ├── App.tsx │ │ └── Catalog.tsx │ ├── package.json │ └── README.md ├── authorization-example │ ├── tsconfig.json │ ├── index.html │ ├── package.json │ ├── webpack.config.js │ └── README.md ├── multipart-upload-wrapper-example │ └── README.md ├── nodejs-example │ ├── package.json │ ├── tsconfig.json │ ├── writeToFile.ts │ ├── getOlpClientSettings.ts │ ├── getUserAuth.ts │ ├── README.md │ └── options.ts └── README.md ├── tests ├── integration │ ├── bundles │ │ └── umd │ │ │ ├── tsconfig.json │ │ │ ├── static │ │ │ └── index.html │ │ │ └── olp-sdk-authentication-testCases.ts │ ├── mocha.opts │ └── api-breaks │ │ ├── mocha.opts │ │ ├── MockedRequestBuilder.ts │ │ ├── HttpError.test.ts │ │ ├── HttpErrorAuth.test.ts │ │ ├── CatalogRequest.test.ts │ │ └── KeyValueCache.test.ts ├── functional │ └── mocha.opts ├── utils │ └── mocked-olp-server │ │ ├── README.md │ │ ├── base-urls.js │ │ ├── urls.js │ │ ├── blob_service.js │ │ └── errors_generator.js └── performance │ ├── longMemoryTest.ts │ ├── longCacheInMemoryTest.ts │ ├── shortMemoryTest.ts │ ├── shortCacheInMemoryTest.ts │ └── utils.ts ├── lerna.json ├── .ort.yml ├── .gitignore ├── tsconfig.json ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ ├── ci.yml │ └── deploy.yml ├── docs └── create-platform-client-settings.md ├── typedoc.json ├── codecov.yml ├── scripts ├── linux │ └── psv │ │ └── build_test_psv.sh ├── misc │ └── commit_message_recom.txt └── publish-packages.sh └── package.json /@here/olp-sdk-core/lib/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/test/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/react-app-example/.env: -------------------------------------------------------------------------------- 1 | BROWSER=none -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/test/resources/test.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /@here/olp-sdk-core/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4 3 | } -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4 3 | } -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4 3 | } -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4 3 | } -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4 3 | } -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4 3 | } -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/test/resources/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "Test message" 3 | } 4 | -------------------------------------------------------------------------------- /tests/integration/bundles/umd/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../../tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/olp-sdk-authentication: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require("./lib/tokenRequester"); 4 | -------------------------------------------------------------------------------- /examples/react-app-example/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "@here/**" 4 | ], 5 | "npmClient": "yarn", 6 | "useWorkspaces": true, 7 | "version": "independent" 8 | } 9 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "importHelpers": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "importHelpers": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/react-app-example/public/credentials.json.sample: -------------------------------------------------------------------------------- 1 | { 2 | "accessKeyId": "your-access-key-id", 3 | "accessKeySecret": "your-access-key-secret" 4 | } 5 | -------------------------------------------------------------------------------- /examples/react-app-example/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heremaps/here-data-sdk-typescript/HEAD/examples/react-app-example/public/favicon.ico -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "importHelpers": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "importHelpers": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "importHelpers": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "importHelpers": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": [ 4 | "./test", 5 | "index.ts", 6 | "index.web.ts" 7 | ] 8 | } -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": [ 4 | "./lib", 5 | "./test", 6 | "index.ts" 7 | ] 8 | } -------------------------------------------------------------------------------- /@here/olp-sdk-core/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | doc/ 4 | .vscode 5 | coverage 6 | .nyc_output 7 | xunit.xml 8 | *.js 9 | *.d.ts 10 | *.js.map 11 | app.ts 12 | !webpack.config.js -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | doc/ 4 | .vscode 5 | coverage 6 | .nyc_output 7 | xunit.xml 8 | *.js 9 | *.d.ts 10 | *.js.map 11 | app.ts 12 | !webpack.config.js -------------------------------------------------------------------------------- /tests/integration/bundles/umd/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Bundles testing Toolkit 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | doc/ 4 | .vscode 5 | coverage 6 | .nyc_output 7 | xunit.xml 8 | *.js 9 | *.d.ts 10 | *.js.map 11 | app.ts 12 | !webpack.config.js -------------------------------------------------------------------------------- /@here/olp-sdk-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": [ 4 | "./lib", 5 | "./test", 6 | "index.ts", 7 | "index.web.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | doc/ 4 | .vscode 5 | coverage 6 | .nyc_output 7 | xunit.xml 8 | *.js 9 | *.d.ts 10 | *.js.map 11 | app.ts 12 | !webpack.config.js -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | doc/ 4 | .vscode 5 | coverage 6 | .nyc_output 7 | xunit.xml 8 | *.js 9 | *.d.ts 10 | *.js.map 11 | app.ts 12 | !webpack.config.js -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | doc/ 4 | .vscode 5 | coverage 6 | .nyc_output 7 | xunit.xml 8 | *.js 9 | *.d.ts 10 | *.js.map 11 | app.ts 12 | !webpack.config.js -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": [ 4 | "./lib", 5 | "./test", 6 | "index.ts", 7 | "index.web.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": [ 4 | "./lib", 5 | "./test", 6 | "index.ts", 7 | "index.web.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": [ 4 | "./lib", 5 | "./test", 6 | "index.ts", 7 | "index.web.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /.ort.yml: -------------------------------------------------------------------------------- 1 | excludes: 2 | scopes: 3 | - name: "devDependencies" 4 | reason: "BUILD_TOOL_OF" 5 | comment: "Scope with dependencies only used for development. Not included in released artifacts in the context of this project." -------------------------------------------------------------------------------- /@here/olp-sdk-core/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=xunit.xml 8 | test/**/*.test.ts -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=xunit.xml 8 | test/**/*.test.ts -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=xunit.xml 8 | test/**/*.test.ts -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=xunit.xml 8 | test/**/*.test.ts -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=xunit.xml 8 | test/**/*.test.ts -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=xunit.xml 8 | test/**/*.test.ts -------------------------------------------------------------------------------- /@here/olp-sdk-core/.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | .nyc_output 4 | coverage 5 | test 6 | tests 7 | dist 8 | tsconfig.json 9 | .gitignore 10 | .gitreview 11 | *.tgz 12 | .prettierrc.json 13 | tslint.json 14 | xunit.xml 15 | webpack.config.js 16 | !*.js -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | .nyc_output 4 | coverage 5 | test 6 | tests 7 | dist 8 | tsconfig.json 9 | .gitignore 10 | .gitreview 11 | *.tgz 12 | .prettierrc.json 13 | tslint.json 14 | xunit.xml 15 | webpack.config.js 16 | !*.js -------------------------------------------------------------------------------- /tests/integration/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=tests/integration/xunit.xml 8 | tests/integration/olp-sdk-*/*.test.ts 9 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | .nyc_output 4 | coverage 5 | test 6 | tests 7 | dist 8 | tsconfig.json 9 | .gitignore 10 | .gitreview 11 | *.tgz 12 | .prettierrc.json 13 | tslint.json 14 | xunit.xml 15 | webpack.config.js 16 | !*.js -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | .nyc_output 4 | coverage 5 | test 6 | tests 7 | dist 8 | tsconfig.json 9 | .gitignore 10 | .gitreview 11 | *.tgz 12 | .prettierrc.json 13 | tslint.json 14 | xunit.xml 15 | webpack.config.js 16 | !*.js -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | .nyc_output 4 | coverage 5 | test 6 | tests 7 | dist 8 | tsconfig.json 9 | .gitignore 10 | .gitreview 11 | *.tgz 12 | .prettierrc.json 13 | tslint.json 14 | xunit.xml 15 | webpack.config.js 16 | !*.js -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | !*.d.ts 3 | .nyc_output 4 | coverage 5 | test 6 | tests 7 | dist 8 | tsconfig.json 9 | .gitignore 10 | .gitreview 11 | *.tgz 12 | .prettierrc.json 13 | tslint.json 14 | xunit.xml 15 | webpack.config.js 16 | !*.js -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/test/test-error-credentials.properties: -------------------------------------------------------------------------------- 1 | here.user.id = test-user-id 2 | here.client.id = test-client-id 3 | here.access.key.id = 4 | here.access.key.secret = khcy1LMBtMZsRVn1-dn7riw9x8 5 | here.token.endpoint.url = https://account.api.here.com/oauth2/token 6 | -------------------------------------------------------------------------------- /tests/functional/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=tests/functional/xunit.xml 8 | -timeout 10000 9 | tests/functional/*.test.ts 10 | -------------------------------------------------------------------------------- /tests/integration/api-breaks/mocha.opts: -------------------------------------------------------------------------------- 1 | --require ts-node/register 2 | --require source-map-support/register 3 | --full-trace 4 | --bail 5 | --check-leaks 6 | --reporter xunit 7 | --reporter-option output=tests/integration/api-breaks/xunit.xml 8 | tests/integration/api-breaks/*.test.ts -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/test/test-credentials.properties: -------------------------------------------------------------------------------- 1 | here.user.id = test-user-id 2 | here.client.id = test-client-id 3 | here.access.key.id = Tt7wZRTAar 4 | here.access.key.secret = khcy1LMBtMZsRVn1-dn7riw9x8 5 | here.token.endpoint.url = https://account.api.here.com/oauth2/token 6 | -------------------------------------------------------------------------------- /examples/authorization-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "build", 6 | "target": "es2020", 7 | "lib": [ 8 | "es2020", 9 | "dom" 10 | ], 11 | "module": "commonjs", 12 | "esModuleInterop": true, 13 | "strict": true, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | doc/ 4 | .vscode 5 | coverage 6 | .nyc_output 7 | xunit.xml 8 | *.js 9 | !webpack.config.js 10 | *.d.ts 11 | *.js.map 12 | app.ts 13 | .cache/ 14 | .mocha-puppeteer/ 15 | FlameGraph/ 16 | core 17 | errors.txt 18 | reports/ 19 | *.gz 20 | *.zst 21 | heaptrack/ 22 | heaptrack_report.html 23 | !tests/utils/mocked-olp-server/*.js 24 | CertificateAuthorityCertificate.pem 25 | demo-app 26 | build 27 | .DS_Store 28 | -------------------------------------------------------------------------------- /examples/react-app-example/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Here Data SDK Typescript Example App", 3 | "name": "Here Data SDK Typescript Example App", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /examples/react-app-example/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | credentials.json 26 | -------------------------------------------------------------------------------- /examples/authorization-example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ts-demo-webpack 7 | 8 | 9 |

OLP SDK Authorization Example App.

10 |
11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/authorization-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "compile": "tsc", 5 | "build": "webpack", 6 | "start": "webpack serve" 7 | }, 8 | "devDependencies": { 9 | "webpack-dev-server": "^3.11.0", 10 | "@here/olp-sdk-authentication": "2.0.0", 11 | "@here/olp-sdk-dataservice-api": "2.0.0", 12 | "copy-webpack-plugin": "^6.3.1", 13 | "ts-loader": "^8.0.11", 14 | "typescript": "^4.0.5", 15 | "webpack": "^5.5.1", 16 | "webpack-cli": "^4.2.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "lib": ["es2017", "dom"], 6 | "sourceMap": true, 7 | "declaration": true, 8 | "baseUrl": ".", 9 | "rootDir": ".", 10 | "strict": true, 11 | "resolveJsonModule": true, 12 | "downlevelIteration": true, 13 | "newLine": "LF", 14 | "noImplicitReturns": true 15 | }, 16 | "include": [ 17 | "tests" 18 | ], 19 | "exclude": ["node_modules", "@here/*/node_modules"] 20 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Describe the bug. 11 | 12 | ### Which version/tag/hash of the HERE OLP SDK are you using? 13 | 14 | ### What TypeScript version are you using to compile? 15 | 16 | ### Are you using node.js or browser? What type/version? 17 | 18 | ### Steps to reproduce the issue. 19 | 20 | ### Expected behavior. 21 | 22 | ### Can you provide any TRACE level logs? 23 | *Please strip sensitive data prior to upload!* 24 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/api-generator/README.md: -------------------------------------------------------------------------------- 1 | Generates code from OpenAPI descriptions 2 | 3 | Use the official swagger-codegen, (https://github.com/swagger-api/swagger-codegen) 4 | 5 | Here's an example invocation to generate our output: 6 | 7 | ```bash 8 | java \ 9 | -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar \ 10 | generate \ 11 | -i swagger-specification.json 12 | -t templates/TypeScript-Fetch \ 13 | -l typescript-fetch \ 14 | -o out 15 | ``` 16 | 17 | Use `--template-engine mustache` for V3 (https://github.com/swagger-api/swagger-codegen/issues/7330#issuecomment-450925645) 18 | -------------------------------------------------------------------------------- /examples/multipart-upload-wrapper-example/README.md: -------------------------------------------------------------------------------- 1 | # Publish large data files in a browser 2 | 3 | This example app uses an HTML and JS UI and an HTTP server with mocked routes to simulate the real `DataStore` class. 4 | You can use this app to learn how to work with the `MultipartUploadWrapper` class and publish large files of more than 8 GB to a versioned layer without loading them in memory. 5 | 6 | ## Setup 7 | 8 | This example does not need any setup. Nevertheless, make sure you installed Node.js. 9 | 10 | ## Run 11 | 12 | 1. Start the server. 13 | ``` 14 | node server.js 15 | ``` 16 | 2. In your favorite browser, open `http://localhost:8080/`. 17 | -------------------------------------------------------------------------------- /examples/react-app-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const TerserPlugin = require("terser-webpack-plugin"); 3 | 4 | module.exports = env => { 5 | const isProd = env.NODE_ENV === "production"; 6 | 7 | return { 8 | target: "web", 9 | mode: env.NODE_ENV, 10 | devtool: isProd ? undefined : "inline-source-map", 11 | resolve: { 12 | extensions: [".js"] 13 | }, 14 | entry: "./index.web.js", 15 | output: { 16 | filename: `bundle.umd${isProd ? '.min' : '.dev'}.js`, 17 | path: path.resolve(__dirname), 18 | libraryTarget: "umd", 19 | globalObject: 'this' 20 | }, 21 | optimization: { 22 | minimize: true, 23 | minimizer: [new TerserPlugin()], 24 | } 25 | }; 26 | }; 27 | -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const TerserPlugin = require("terser-webpack-plugin"); 3 | 4 | module.exports = env => { 5 | const isProd = env.NODE_ENV === "production"; 6 | 7 | return { 8 | target: "web", 9 | mode: env.NODE_ENV, 10 | devtool: isProd ? undefined : "inline-source-map", 11 | resolve: { 12 | extensions: [".js"] 13 | }, 14 | entry: "./index.web.js", 15 | output: { 16 | filename: `bundle.umd${isProd ? '.min' : '.dev'}.js`, 17 | path: path.resolve(__dirname), 18 | libraryTarget: "umd", 19 | globalObject: 'this' 20 | }, 21 | optimization: { 22 | minimize: true, 23 | minimizer: [new TerserPlugin()], 24 | } 25 | }; 26 | }; 27 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const TerserPlugin = require("terser-webpack-plugin"); 3 | 4 | module.exports = env => { 5 | const isProd = env.NODE_ENV === "production"; 6 | 7 | return { 8 | mode: env.NODE_ENV, 9 | target: "web", 10 | devtool: isProd ? undefined : "inline-source-map", 11 | resolve: { 12 | extensions: [".js"] 13 | }, 14 | entry: "./index.web.js", 15 | output: { 16 | filename: `bundle.umd${isProd ? '.min' : '.dev'}.js`, 17 | path: path.resolve(__dirname), 18 | libraryTarget: "umd", 19 | globalObject: 'this' 20 | }, 21 | optimization: { 22 | minimize: true, 23 | minimizer: [new TerserPlugin()], 24 | } 25 | }; 26 | }; 27 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const TerserPlugin = require("terser-webpack-plugin"); 3 | 4 | module.exports = env => { 5 | const isProd = env.NODE_ENV === "production"; 6 | 7 | return { 8 | target: "web", 9 | mode: env.NODE_ENV, 10 | devtool: isProd ? undefined : "inline-source-map", 11 | resolve: { 12 | extensions: [".js"] 13 | }, 14 | entry: "./index.js", 15 | output: { 16 | filename: `bundle.umd${isProd ? '.min' : '.dev'}.js`, 17 | path: path.resolve(__dirname), 18 | libraryTarget: "umd", 19 | globalObject: 'this' 20 | }, 21 | optimization: { 22 | minimize: true, 23 | minimizer: [new TerserPlugin()], 24 | } 25 | }; 26 | }; 27 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const TerserPlugin = require("terser-webpack-plugin"); 3 | 4 | module.exports = env => { 5 | const isProd = env.NODE_ENV === "production"; 6 | 7 | return { 8 | target: "web", 9 | mode: env.NODE_ENV, 10 | devtool: isProd ? undefined : "inline-source-map", 11 | resolve: { 12 | extensions: [".js"] 13 | }, 14 | entry: "./index.web.js", 15 | output: { 16 | filename: `bundle.umd${isProd ? '.min' : '.dev'}.js`, 17 | path: path.resolve(__dirname), 18 | libraryTarget: "umd", 19 | globalObject: 'this' 20 | }, 21 | optimization: { 22 | minimize: true, 23 | minimizer: [new TerserPlugin()], 24 | } 25 | }; 26 | }; 27 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const TerserPlugin = require("terser-webpack-plugin"); 3 | 4 | module.exports = env => { 5 | const isProd = env.NODE_ENV === "production"; 6 | 7 | return { 8 | target: "web", 9 | mode: env.NODE_ENV, 10 | devtool: isProd ? undefined : "inline-source-map", 11 | resolve: { 12 | extensions: [".js"] 13 | }, 14 | entry: "./index.web.js", 15 | output: { 16 | filename: `bundle.umd${isProd ? '.min' : '.dev'}.js`, 17 | path: path.resolve(__dirname), 18 | libraryTarget: "umd", 19 | globalObject: 'this' 20 | }, 21 | optimization: { 22 | minimize: true, 23 | minimizer: [new TerserPlugin()], 24 | } 25 | }; 26 | }; 27 | -------------------------------------------------------------------------------- /examples/react-app-example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | Here Data SDK Typescript Example App 15 | 16 | 17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /tests/utils/mocked-olp-server/README.md: -------------------------------------------------------------------------------- 1 | # Local OLP server 2 | 3 | This folder contains sources of a server that mimics the OLP services. 4 | 5 | Supported operations: 6 | 7 | * Lookup API 8 | * Retrieve catalog configuration 9 | * Retrieve catalog latest version 10 | * Retrieve layers versions 11 | * Retrieve layer metadata (partitions) 12 | * Retrieve data from a blob service 13 | 14 | Requests are always valid (no validation performed). 15 | Blob service returns generated text data (400-500 kb. size) 16 | 17 | ## How to run a server 18 | 19 | To run a server execute the script: 20 | 21 | ```shell 22 | node server.js 23 | ``` 24 | 25 | The server implemented as a proxy between the client and the OLP. Clients can connect to it directly; no authorization required. 26 | Note: server supports HTTP protocol only. -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/index.web.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./lib"; 21 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/index.web.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./lib"; 21 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/index.ts: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2019 HERE Europe B.V. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | * SPDX-License-Identifier: Apache-2.0 18 | * License-Filename: LICENSE 19 | */ 20 | 21 | export * from "./index.node"; 22 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib.version.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020-2024 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export const LIB_VERSION = "2.0.0"; 21 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/client/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./OlpClientSettings"; 21 | -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/index.web.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export type FetchFunction = typeof fetch; 21 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/index.web.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./lib"; 21 | export * from "./lib.version"; 22 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./client"; 21 | export * from "./utils"; 22 | -------------------------------------------------------------------------------- /examples/authorization-example/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const CopyWebpackPlugin = require("copy-webpack-plugin"); 3 | const webpack = require("webpack"); 4 | 5 | module.exports = { 6 | entry: { 7 | main: "./build/main.js", 8 | }, 9 | output: { 10 | path: path.join(__dirname, "build"), 11 | filename: "[name]-bundle.js", 12 | }, 13 | devServer: { 14 | contentBase: path.join(__dirname, 'build'), 15 | port: 8080 16 | }, 17 | plugins: [ 18 | new webpack.DefinePlugin({ 19 | "credentials": JSON.stringify({ 20 | appKey: process.env.OLP_APP_KEY, 21 | appSecret: process.env.OLP_APP_SECRET 22 | }) 23 | }), 24 | new CopyWebpackPlugin({ 25 | patterns: [ 26 | { 27 | from: "index.html", 28 | }, 29 | ], 30 | }), 31 | ], 32 | }; 33 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/oauth-requester: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | * Copyright (C) 2020 HERE Europe B.V. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * SPDX-License-Identifier: Apache-2.0 19 | * License-Filename: LICENSE 20 | */ 21 | 22 | require("./lib/tokenRequester"); 23 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./cache"; 21 | export * from "./utils"; 22 | export * from "./client"; 23 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/utils/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./BlobData"; 21 | export * from "./MultiPartUploadWrapper"; 22 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./utils"; 21 | export * from "./client"; 22 | export * from "./cache"; 23 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/cache/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./LRUCache"; 21 | export * from "./ApiCacheRepository"; 22 | export * from "./KeyValueCache"; 23 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/cache/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./MetadataCacheRepository"; 21 | export * from "./QuadTreeIndexCacheRepository"; 22 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | // tslint:disable-next-line: no-import-side-effect 21 | import "@here/olp-sdk-fetch"; 22 | 23 | export * from "./lib"; 24 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | // tslint:disable-next-line: no-import-side-effect 21 | import "@here/olp-sdk-fetch"; 22 | 23 | export * from "./lib"; 24 | -------------------------------------------------------------------------------- /examples/react-app-example/src/Catalogs.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | .catalogs-list { 21 | margin: 20px; 22 | } 23 | 24 | .catalogs-list ul li { 25 | margin-top: 10px; 26 | } 27 | -------------------------------------------------------------------------------- /docs/create-platform-client-settings.md: -------------------------------------------------------------------------------- 1 | # Create platform client settings 2 | 3 | You need to create the `OlpClientSettings` object to publish data and get catalog and partition metadata, as well as layer data from the HERE platform. 4 | 5 | **To create the `OlpClientSettings` object:** 6 | 7 | 1. [Authenticate](authenticate.md) to the HERE platform. 8 | 9 | 2. Import the `OlpClientSettings` class from the `olp-sdk-core` module. 10 | 11 | ```typescript 12 | import { OlpClientSettings } from "@here/olp-sdk-core"; 13 | ``` 14 | 15 | 3. Create the `olpClientSettings` instance using the environment in which you work and the `getToken` method. 16 | 17 | ```typescript 18 | const olpClientSettings = new OlpClientSettings({ 19 | environment: 20 | "here | here-dev | here-cn | here-cn-dev | http://YourLocalEnvironment", 21 | getToken: () => userAuth.getToken() 22 | }); 23 | ``` 24 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/utils/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./validateBillingTag"; 21 | export * from "./validatePartitionsIdsList"; 22 | export * from "./getTile"; 23 | -------------------------------------------------------------------------------- /examples/nodejs-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "partitions-downloader", 3 | "version": "0.0.1", 4 | "description": "An example node app for fetching tiles from layers.", 5 | "scripts": { 6 | "build": "tsc" 7 | }, 8 | "bin": { 9 | "download-partitions": "index.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/heremaps/here-data-sdk-typescript/tree/master/docs/examples/tile-downloader" 14 | }, 15 | "author": { 16 | "name": "HERE Europe B.V.", 17 | "url": "https://here.com" 18 | }, 19 | "license": "Apache-2.0", 20 | "private": true, 21 | "devDependencies": { 22 | "@types/node": "^18.7.14", 23 | "@types/yargs": "^15.0.9", 24 | "typescript": "^4.0.5" 25 | }, 26 | "dependencies": { 27 | "@here/olp-sdk-authentication": "2.0.0", 28 | "@here/olp-sdk-dataservice-read": "2.0.0", 29 | "yargs": "^16.1.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/index.web.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export { OAuthArgs, Token } from "./lib/requestToken_common"; 21 | export * from "./lib/requestToken.web"; 22 | export * from "./lib/UserAuth"; 23 | -------------------------------------------------------------------------------- /examples/nodejs-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ 4 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 5 | "strict": true, /* Enable all strict type-checking options. */ 6 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 7 | "skipLibCheck": true, /* Skip type checking of declaration files. */ 8 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /typedoc.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "@here/olp-sdk-ts", 4 | "out": "dist/doc", 5 | "entryPoints": [ 6 | "@here/olp-sdk-authentication/index.ts", 7 | "@here/olp-sdk-dataservice-read/index.ts", 8 | "@here/olp-sdk-dataservice-write/index.ts", 9 | "@here/olp-sdk-dataservice-api/index.ts", 10 | "@here/olp-sdk-core/index.ts", 11 | "@here/olp-sdk-fetch/index.ts" 12 | ], 13 | "exclude": [ 14 | "**/index.ts", 15 | "**/index.node.ts", 16 | "**/index.web.ts", 17 | "**/node_modules/**", 18 | "**/test/**/*.ts", 19 | "**/tests/**/*.ts", 20 | "**/dist/**/*.ts", 21 | "**/scripts/*.ts", 22 | "@here/olp-sdk-authentication/lib.version.ts", 23 | "@here/olp-sdk-authentication/lib/HttpError.ts", 24 | "examples/**" 25 | ], 26 | "readme": "README.md", 27 | "excludePrivate": "true", 28 | "excludeExternals": "true" 29 | } -------------------------------------------------------------------------------- /@here/olp-sdk-core/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | // tslint:disable-next-line: no-import-side-effect 21 | import "@here/olp-sdk-fetch"; 22 | 23 | export * from "./lib"; 24 | export * from "./lib.version"; 25 | 26 | export * as fs from "fs"; 27 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/test/DataStoreApi.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { assert } from "chai"; 21 | 22 | describe("DataStoreApiTest", function() { 23 | it("ok", function() { 24 | assert(true); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/utils/mocked-olp-server/base-urls.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | exports.lookup = "/lookup-service"; 21 | exports.config = "/config-service" 22 | exports.metadata = "/metadata-service" 23 | exports.query = "/query-service" 24 | exports.blob = "/blob-service" 25 | -------------------------------------------------------------------------------- /examples/authorization-example/README.md: -------------------------------------------------------------------------------- 1 | # Authorization Web App 2 | 3 | It is a web app with configured compiling of TS into JS and bundling with webpack. 4 | The app shows how to use the APIs from `@here/olp-sdk-dataservice-api`. 5 | 6 | You can use all the `AuthorizationAPI` functions in the same way as in this example. 7 | 8 | ## Setup 9 | 10 | 1. Download the current folder to your PC. 11 | 2. Add your app key and secret to your enviropment. 12 | ``` 13 | export OLP_APP_KEY= 14 | export OLP_APP_SECRET= 15 | ``` 16 | 3. Install the dependencies. 17 | 18 | ``` 19 | npm install 20 | ``` 21 | 22 | ## Build and run 23 | 24 | 1. Compile TS into JS. 25 | 26 | ``` 27 | npm run compile 28 | ``` 29 | 30 | 2. Bundle with webpack. 31 | 32 | ``` 33 | npm run build 34 | ``` 35 | 36 | 3. Start the web server. 37 | 38 | ``` 39 | npm start 40 | ``` 41 | 42 | 4. Open in your favorite browser http://localhost:8080 -------------------------------------------------------------------------------- /tests/performance/longMemoryTest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { getDataMemoryTest } from "./getDataMemoryTest"; 21 | 22 | getDataMemoryTest({ 23 | requestsPerSecond: 12, 24 | runTimeSeconds: 60 * 60 25 | }).then(_ => { 26 | console.log("Long memory test done."); 27 | }); 28 | -------------------------------------------------------------------------------- /tests/utils/mocked-olp-server/urls.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | exports.lookup = "api-lookup.data.api.platform.here.com"; 21 | exports.config = "config_service.com" 22 | exports.metadata = "metadata_service.com" 23 | exports.query = "query_service.com" 24 | exports.blob = "blob_service.com" 25 | -------------------------------------------------------------------------------- /tests/performance/longCacheInMemoryTest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { getPartitionsMemoryTest } from "./getDataPartitionsTest"; 21 | 22 | getPartitionsMemoryTest({ 23 | requestsPerSecond: 12, 24 | runTimeSeconds: 60 * 60 25 | }).then(_ => { 26 | console.log("Long cache in memory test done."); 27 | }); 28 | -------------------------------------------------------------------------------- /tests/performance/shortMemoryTest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /* tslint:disable */ 21 | 22 | import { getDataMemoryTest } from "./getDataMemoryTest"; 23 | 24 | getDataMemoryTest({ 25 | requestsPerSecond: 12, 26 | runTimeSeconds: 60 * 5 27 | }).then(_ => { 28 | console.log("Short memory test done."); 29 | }); 30 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 80..100 3 | round: up 4 | precision: 4 5 | notify: 6 | wait_for_ci: false 7 | status: 8 | project: 9 | authentication: 10 | paths: 11 | - ./@here/olp-sdk-authentication 12 | threshold: 1 13 | dataservice-read: 14 | paths: 15 | - ./@here/olp-sdk-dataservice-read 16 | threshold: 1 17 | dataservice-write: 18 | paths: 19 | - ./@here/olp-sdk-dataservice-write 20 | threshold: 1 21 | olp-sdk-fetch: 22 | paths: 23 | - ./@here/olp-sdk-fetch 24 | threshold: 1 25 | olp-sdk-dataservice-api: 26 | paths: 27 | - ./@here/olp-sdk-dataservice-api 28 | threshold: 1 29 | ignore: 30 | - ./@here/olp-sdk-authentication/test 31 | - ./@here/olp-sdk-core/test 32 | - ./@here/olp-sdk-dataservice-api/test 33 | - ./@here/olp-sdk-dataservice-read/test 34 | - ./@here/olp-sdk-dataservice-write/test 35 | - ./@here/olp-sdk-fetch/test 36 | - docs 37 | - scripts 38 | - tests 39 | -------------------------------------------------------------------------------- /tests/performance/shortCacheInMemoryTest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /* tslint:disable */ 21 | 22 | import { getPartitionsMemoryTest } from "./getDataPartitionsTest"; 23 | 24 | getPartitionsMemoryTest({ 25 | requestsPerSecond: 12, 26 | runTimeSeconds: 60 * 5 27 | }).then(_ => { 28 | console.log("Short cache in memory test done."); 29 | }); 30 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/index.node.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | // tslint:disable-next-line: no-import-side-effect 21 | import "@here/olp-sdk-fetch"; 22 | export { OAuthArgs, Token } from "./lib/requestToken_common"; 23 | export * from "./lib/requestToken"; 24 | export * from "./lib/UserAuth"; 25 | export * from "./lib/loadCredentialsFromFile"; 26 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/api-generator/templates/TypeScript-Fetch/licenseInfo.mustache: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020-2021 HERE Europe B.V. and its affiliate(s). 3 | * All rights reserved. 4 | * 5 | * This software and other materials contain proprietary information 6 | * controlled by HERE and are protected by applicable copyright legislation. 7 | * Any use and utilization of this software and other materials and 8 | * disclosure to any third parties is conditional upon having a separate 9 | * agreement with HERE for the access, use, utilization or disclosure of this 10 | * software. In the absence of such agreement, the use of the software is not 11 | * allowed. 12 | */ 13 | 14 | /** 15 | * {{{appName}}} 16 | * {{{appDescription}}} 17 | * 18 | * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} 19 | *{{#infoEmail}} Contact: {{{infoEmail}}}{{/infoEmail}} 20 | * 21 | * NOTE: This class is auto generated by the swagger code generator program. 22 | * https://github.com/swagger-api/swagger-codegen.git 23 | * 24 | * Do not edit the class manually. 25 | */ 26 | -------------------------------------------------------------------------------- /examples/react-app-example/src/index.tsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import React from 'react'; 21 | import './index.css'; 22 | import App from './App'; 23 | import ReactDOM from "react-dom"; 24 | import { BrowserRouter as Router } from "react-router-dom"; 25 | 26 | ReactDOM.render( 27 | 28 | 29 | 30 | 31 | , 32 | document.getElementById('root') 33 | ); 34 | -------------------------------------------------------------------------------- /tests/performance/utils.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /* tslint:disable */ 21 | export interface TestParams { 22 | runTimeSeconds: number; 23 | requestsPerSecond: number; 24 | } 25 | 26 | export function getSleepPeriod(countRequestsPerSec: number): number { 27 | return 1000 / countRequestsPerSec; 28 | } 29 | 30 | export async function sleep(milliseconds: number) { 31 | return new Promise(resolve => setTimeout(resolve, milliseconds)); 32 | } 33 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | HERE Data SDK for TypeScript contains several examples that demonstrate some of the key use cases: 4 | 5 | - [Authorization example](https://github.com/heremaps/here-data-sdk-typescript/tree/master/examples/authorization-example) – build the Data SDK using webpack and work with the APIs from `@here/olp-sdk-dataservice-api`. You can use this example application to find the list of groups that you have access to as well as create groups. 6 | - [React App example](https://github.com/heremaps/here-data-sdk-typescript/tree/master/examples/react-app-example) – use the Data SDK and React in a browser and learn how to work with the following modules: `olp-sdk-authentication`, `olp-sdk-dataservice-read`, and `olp-sdk-dataservice-write`. 7 | - [Node.js example](https://github.com/heremaps/here-data-sdk-typescript/tree/master/examples/nodejs-example) – work with the Data SDK in Node.js and learn how to get data from versioned layers and save it to files. 8 | - [MultiPartUploadWrapper example](https://github.com/heremaps/here-data-sdk-typescript/blob/master/examples/multipart-upload-wrapper-example) – use the Data SDK to upload and publish a large amount of data in a browser. 9 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Typescript PSV CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - '*' 10 | 11 | jobs: 12 | psv-linux-build-test-codecov: 13 | name: PSV / Linux Build / Tests / Code coverage 14 | runs-on: ubuntu-22.04 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Use Node.js 18 | uses: actions/setup-node@v4 19 | with: 20 | node-version: 18 21 | cache: npm 22 | - name: Build / Tests / Coverage 23 | run: scripts/linux/psv/build_test_psv.sh 24 | - name: Upload coverage to Codecov 25 | uses: codecov/codecov-action@v4 26 | with: 27 | fail_ci_if_error: true # optional (default = false) 28 | verbose: true # optional (default = false) 29 | env: 30 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 31 | 32 | psv-commit-checker: 33 | name: PSV.Commit.Checker 34 | runs-on: ubuntu-latest 35 | steps: 36 | - uses: actions/checkout@v4 37 | with: 38 | fetch-depth: 0 39 | - name: Commit checker script. Verify commit text 40 | run: scripts/misc/commit_checker.sh 41 | shell: bash 42 | 43 | -------------------------------------------------------------------------------- /examples/nodejs-example/writeToFile.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import fs from "fs"; 21 | 22 | /** 23 | * Saves data to the file. 24 | * 25 | * @param path The path to the file. 26 | * @param data `Buffer` that you want to save. 27 | */ 28 | export function writeToFile(path: string, data: Buffer) { 29 | fs.writeFile(path, data, err => { 30 | if (err) { 31 | return console.log(err); 32 | } 33 | console.log(`The file ${path} was saved!`); 34 | }); 35 | } 36 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Typescript SDK Deploy Workflow 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | chooseDeploy: 7 | description: 'Package to deploy' 8 | required: true 9 | default: '' 10 | type: choice 11 | options: 12 | - fetch 13 | - api 14 | - core 15 | - auth 16 | - read 17 | - write 18 | - verify 19 | 20 | jobs: 21 | deploy-sdk-package-to-npm: 22 | name: Typescript SDK Build and Deploy 23 | runs-on: ubuntu-latest 24 | steps: 25 | - run: | 26 | echo "Package to deploy: $PACKAGE_NAME" 27 | env: 28 | PACKAGE_NAME: ${{ inputs.chooseDeploy }} 29 | - uses: actions/checkout@v4 30 | - name: Use Node.js 31 | uses: actions/setup-node@v4 32 | with: 33 | node-version: '18' 34 | cache: npm 35 | - name: Build / Tests 36 | run: scripts/linux/psv/build_test_psv.sh && env 37 | - name: Deploy to NPM 38 | run: scripts/publish-packages.sh -${PACKAGE_NAME} 39 | env: 40 | PACKAGE_NAME: ${{ inputs.chooseDeploy }} 41 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 42 | -------------------------------------------------------------------------------- /examples/react-app-example/src/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | body { 21 | margin: 50; 22 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 23 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 24 | sans-serif; 25 | -webkit-font-smoothing: antialiased; 26 | -moz-osx-font-smoothing: grayscale; 27 | } 28 | 29 | code { 30 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 31 | monospace; 32 | } 33 | -------------------------------------------------------------------------------- /tests/integration/api-breaks/MockedRequestBuilder.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { UrlBuilder, RequestBuilder } from "@here/olp-sdk-dataservice-api"; 21 | 22 | export const mockedRequestBuilder: RequestBuilder = { 23 | baseUrl: "http://mocked.url", 24 | request: async (urlBuilder: UrlBuilder, options: any) => { 25 | return Promise.resolve("success"); 26 | }, 27 | requestBlob: async (urlBuilder: UrlBuilder, options: any) => { 28 | return Promise.resolve("success"); 29 | } 30 | } as any; 31 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/client/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./VersionedLayerClient"; 21 | export * from "./StartBatchRequest"; 22 | export * from "./CancelBatchRequest"; 23 | export * from "./CheckDataExistsRequest"; 24 | export * from "./CompleteBatchRequest"; 25 | export * from "./PublishSinglePartitionRequest"; 26 | export * from "./UploadPartitionsRequest"; 27 | export * from "./GetBatchRequest"; 28 | export * from "./UploadBlobRequest"; 29 | export * from "./UploadBlobResult"; 30 | -------------------------------------------------------------------------------- /examples/react-app-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "here-data-sdk-example", 3 | "version": "0.1.0", 4 | "private": true, 5 | "devDependencies": { 6 | "@here/olp-sdk-authentication": "2.0.0", 7 | "@here/olp-sdk-core": "2.0.0", 8 | "@here/olp-sdk-dataservice-read": "2.0.0", 9 | "@here/olp-sdk-dataservice-write": "2.0.0", 10 | "@types/node": "^18.7.14", 11 | "@types/react": "^16.9.53", 12 | "@types/react-dom": "^16.9.8", 13 | "@types/react-router-dom": "^5.1.6", 14 | "react": "^17.0.1", 15 | "react-dom": "^17.0.1", 16 | "react-scripts": "^4.0.3", 17 | "react-router-dom": "^5.2.0", 18 | "typescript": "^4.0.3" 19 | }, 20 | "scripts": { 21 | "start": "export NODE_OPTIONS=--openssl-legacy-provider && react-scripts start", 22 | "build": "export NODE_OPTIONS=--openssl-legacy-provider && react-scripts build" 23 | }, 24 | "eslintConfig": { 25 | "extends": [ 26 | "react-app" 27 | ] 28 | }, 29 | "browserslist": { 30 | "production": [ 31 | ">0.2%", 32 | "not dead", 33 | "not op_mini all" 34 | ], 35 | "development": [ 36 | "last 1 chrome version", 37 | "last 1 firefox version", 38 | "last 1 safari version" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/utils/FetchOptions.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Enumerates the fetch option that controls how requests are handled. 22 | */ 23 | export enum FetchOptions { 24 | /** 25 | * A default option. Queries the network if the requested resource is not 26 | * found in the cache. 27 | */ 28 | OnlineIfNotFound, 29 | 30 | /** 31 | * Skips cache lookups and queries the network right away. 32 | */ 33 | OnlineOnly, 34 | 35 | /** 36 | * Returns immediately if a cache lookup fails. 37 | */ 38 | CacheOnly 39 | } 40 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/README.md: -------------------------------------------------------------------------------- 1 | # DataService API Library 2 | 3 | ## Overview 4 | 5 | This API is generated directly from the official OpenAPI (former Swagger) definition of the [Data API](https://developer.here.com/documentation/data-api/data_dev_guide/index.html). 6 | 7 | ## Generate a Bundle 8 | 9 | If you want to have a compiled project, you can use bundle commands. After running each of the following commands in the `@here/olp-sdk-dataservice-api` folder from the root folder, you get the JavaScript bundled files. 10 | 11 | To get bundled files with a source map, run: 12 | 13 | ```sh 14 | npm run bundle 15 | ``` 16 | 17 | To get minified version for production, run: 18 | 19 | ```sh 20 | npm run bundle:prod 21 | ``` 22 | 23 | To get bundled and minified JavaScript files, run: 24 | 25 | ```sh 26 | npm run prepublish-bundle 27 | ``` 28 | 29 | ## Use a Bundle from CDN 30 | 31 | Add minified JavaScript files to your `html`: 32 | 33 | ```html 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | ``` 42 | 43 | ## LICENSE 44 | 45 | Copyright (C) 2019-2023 HERE Europe B.V. 46 | 47 | For license details, see the [LICENSE](LICENSE). 48 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/utils/multipartupload-internal/BufferData.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { BlobData } from "@here/olp-sdk-dataservice-write"; 21 | 22 | /** 23 | * @internal 24 | * Implementation of BlobData for reading bytes from buffer. 25 | */ 26 | export class BufferData implements BlobData { 27 | constructor(private readonly data: ArrayBufferLike) {} 28 | 29 | async readBytes(offset: number, count: number): Promise { 30 | return this.data.slice(offset, offset + count); 31 | } 32 | 33 | size(): number { 34 | return this.data.byteLength; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/utils/userAgent.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { LIB_VERSION } from "@here/olp-sdk-core/lib.version"; 21 | 22 | /** 23 | * The string for adding to the requests as query parameter. 24 | */ 25 | export const SENT_WITH_PARAM = `sentWith=OLP-TS-SDK-${LIB_VERSION}`; 26 | 27 | /** 28 | * Adds sentWith param to the url. 29 | * @param url the string, representing the url 30 | * @returns the string, representing updated URL 31 | */ 32 | export function addSentWithParam(url: string): string { 33 | return url.split("?").length === 1 34 | ? `${url}?${SENT_WITH_PARAM}` 35 | : `${url}&${SENT_WITH_PARAM}`; 36 | } 37 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/utils/multipartupload-internal/WebData.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { BlobData } from "@here/olp-sdk-dataservice-write"; 21 | 22 | /** 23 | * @internal 24 | * Implementation of reading bytes from Blob or File 25 | * object in browsers. 26 | */ 27 | export class WebData implements BlobData { 28 | constructor(private readonly data: Blob | File) {} 29 | 30 | async readBytes(offset: number, count: number): Promise { 31 | return this.data.slice(offset, offset + count).arrayBuffer(); 32 | } 33 | 34 | size(): number { 35 | return this.data.size; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/utils/validatePartitionsIdsList.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Validates a list of partitions IDs. 22 | * 23 | * It must be between 1–100 items. 24 | * 25 | * @param list The lists of strings that represent the partitions IDs. 26 | * @returns The list of strings if it's valid. Otherwise, throws an error. 27 | */ 28 | export function validatePartitionsIdsList(list: string[]): string[] { 29 | const LIST_MAX_LENGTH = 100; 30 | const length = list.length; 31 | 32 | if (length < 1 || length > LIST_MAX_LENGTH) { 33 | throw new Error("The partition ids quantity must be between 1 - 100"); 34 | } 35 | return list; 36 | } 37 | -------------------------------------------------------------------------------- /examples/react-app-example/src/listOfCatalogs.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { ConfigClient } from "@here/olp-sdk-dataservice-read"; 21 | import { OlpClientSettings } from "@here/olp-sdk-core"; 22 | 23 | async function listOfCatalogs(settings: OlpClientSettings) { 24 | const client = new ConfigClient(settings); 25 | return client 26 | .getCatalogs() 27 | .then(res => res.results && res.results.items) 28 | .then(items => { 29 | if (items) { 30 | return (items as any).map((item: any) => ({ 31 | title: item.title, 32 | hrn: item.hrn 33 | })); 34 | } 35 | return []; 36 | }); 37 | } 38 | 39 | export default listOfCatalogs; 40 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/utils/validateBillingTag.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Validates the billinig tag. 22 | * 23 | * It must be 4–16 characters long and contain only alphanumeric ASCII characters [A-Za-z0-9]. 24 | * 25 | * @param tag The string that represents the billing tag. 26 | * @return The billing tag if it's valid. Otherwise, throws an error. 27 | */ 28 | export function validateBillingTag(tag: string): string { 29 | const pattern = /^[A-Za-z0-9_-]{4,16}$/; 30 | 31 | if (!pattern.test(tag)) { 32 | throw new Error( 33 | "The billing tag must be between 4 - 16 characters, contain only alpha/numeric ASCII characters [A-Za-z0-9]" 34 | ); 35 | } 36 | 37 | return tag; 38 | } 39 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/client/UploadBlobResult.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export class UploadBlobResult { 21 | private dataHandle?: string; 22 | 23 | /** 24 | * @brief Sets the data handle of the uploaded data. 25 | * @param id The data handle. 26 | * 27 | * @returns A reference to this object 28 | */ 29 | public withDataHandle(dataHandle: string): UploadBlobResult { 30 | this.dataHandle = dataHandle; 31 | return this; 32 | } 33 | 34 | /** 35 | * @brief Gets the data handle of the uploaded data. 36 | * 37 | * @returns The data handle of the uploaded data. 38 | */ 39 | public getDataHandle(): string | undefined { 40 | return this.dataHandle; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/test/unit/Uuid.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { assert } from "chai"; 21 | import { Uuid } from "@here/olp-sdk-core"; 22 | 23 | describe("Uuid", function() { 24 | it("Should be unique and valid value", function() { 25 | const validator = new RegExp( 26 | "^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$", 27 | "i" 28 | ); 29 | const uuids = []; 30 | for (let index = 0; index < 5000; index++) { 31 | const uuid = Uuid.create(); 32 | assert.isTrue(validator.test(uuid)); 33 | assert.isTrue(uuids.indexOf(uuid) === -1); 34 | uuids.push(uuid); 35 | } 36 | 37 | assert.isTrue(uuids.indexOf(Uuid.create()) === -1); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /examples/nodejs-example/getOlpClientSettings.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { UserAuth } from "@here/olp-sdk-authentication"; 21 | import { OlpClientSettings } from "@here/olp-sdk-core"; 22 | 23 | /** 24 | * Gets the `OlpClientSettings` instance. 25 | * 26 | * @param userAuth The `UserAuth` instance. 27 | * @param env (Optional) The environment that you want to use to get the URL of the API Lookup API. 28 | * You can also specify a URL of your custom service. The default value is `here`. 29 | * 30 | * @returns The `OlpClientSettings` instance. 31 | */ 32 | export function getOlpClientSettings( 33 | userAuth: UserAuth, 34 | env?: string 35 | ): OlpClientSettings { 36 | return new OlpClientSettings({ 37 | getToken: () => userAuth.getToken(), 38 | environment: env || "here" 39 | }); 40 | } 41 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/test/unit/userAgent.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { assert } from "chai"; 21 | import { addSentWithParam, SENT_WITH_PARAM } from "@here/olp-sdk-core"; 22 | 23 | describe("addSentWithParam", function() { 24 | it("Should be preparing string as an adding additional param", function() { 25 | const url = "https://example.com/test/url?someParam=test"; 26 | 27 | const result = addSentWithParam(url); 28 | 29 | assert.isTrue(result === url + "&" + SENT_WITH_PARAM); 30 | }); 31 | 32 | it("Should be preparing string as an adding the first param", function() { 33 | const url = "https://example.com/test/url"; 34 | 35 | const result = addSentWithParam(url); 36 | 37 | assert.isTrue(result === url + "?" + SENT_WITH_PARAM); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/utils/DownloadManager.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * It's an interface for `@here/olp-sdk-dataservice-api` that is used to send requests to platform services. 22 | * [[DataStoreRequestBuilder]] has its own default implementation of the download manager. 23 | * If you want to use your download manager, you can implement this interface, and then set your download manager. 24 | * 25 | * @see [[DataStoreRequestBuilder]] 26 | */ 27 | export interface DownloadManager { 28 | /** 29 | * Downloads data from the specified URL. 30 | * 31 | * @param url The URL that you want to download. 32 | * @param init The helper object for the request. 33 | * @return The data from the specified URL. 34 | */ 35 | download(url: string, init?: RequestInit): Promise; 36 | } 37 | -------------------------------------------------------------------------------- /scripts/linux/psv/build_test_psv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | # 3 | # Copyright (C) 2019 HERE Europe B.V. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # License-Filename: LICENSE 19 | 20 | ################################################### 21 | # Following script is for SDK building verification 22 | ################################################### 23 | 24 | # Install main dependencies 25 | yarn 26 | 27 | # Initialize lerna monorepo with yarn workspaces 28 | yarn bootstrap 29 | 30 | # Build the project 31 | npm run build 32 | 33 | # Generate bundles and typedocs 34 | npm run bundle 35 | npm run typedoc 36 | 37 | # Check the lints 38 | npm run lint 39 | 40 | # Run tests 41 | npm run test 42 | 43 | # Integration tests 44 | npm run integration-test 45 | 46 | # Functional tests 47 | npm run functional-test 48 | 49 | # Test the generated bundles 50 | npm run http-server-testing-bundles & npm run test-generated-bundles 51 | 52 | # Generate and upload codecov 53 | npm run codecov 54 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/utils/Uuid.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | // tslint:disable:no-bitwise 21 | // tslint:disable: no-magic-numbers 22 | 23 | /** 24 | * @brief Lets you generate uuid code 25 | */ 26 | export class Uuid { 27 | /** 28 | * Creates an UUID 29 | */ 30 | public static create(): string { 31 | return [ 32 | Uuid.generate(2), 33 | Uuid.generate(1), 34 | Uuid.generate(1), 35 | Uuid.generate(1), 36 | Uuid.generate(3) 37 | ].join("-"); 38 | } 39 | 40 | private static generate(count: number) { 41 | let result = ""; 42 | for (let i = 0; i < count; i++) { 43 | result += (((1 + Math.random()) * 0x10000) | 0) 44 | .toString(16) 45 | .substring(1); 46 | } 47 | return result; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/lib/requestToken.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as crypto from "crypto"; 21 | import { OAuthArgs, requestToken_common, Token } from "./requestToken_common"; 22 | 23 | async function sign(data: ArrayBufferLike, secretKey: string): Promise { 24 | const hmac = crypto.createHmac("sha256", secretKey); 25 | hmac.update(Buffer.from(data)); 26 | return Promise.resolve(hmac.digest("base64")); 27 | } 28 | 29 | function getRandomValues(data: Uint8Array): Uint8Array { 30 | return crypto.randomFillSync(data); 31 | } 32 | 33 | /** 34 | * Creates an access token. 35 | * 36 | * @param args The arguments needed to get the access token. 37 | * @return The generated access token. 38 | */ 39 | export async function requestToken(args: OAuthArgs): Promise { 40 | return requestToken_common(args, { sign, getRandomValues }); 41 | } 42 | -------------------------------------------------------------------------------- /examples/nodejs-example/getUserAuth.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { 21 | UserAuth, 22 | requestToken, 23 | loadCredentialsFromFile 24 | } from "@here/olp-sdk-authentication"; 25 | 26 | /** 27 | * Gets the configured `UserAuth` instance. 28 | * 29 | * @param pathToCredentials The path to the `credential.properties` file. 30 | * For instructions, see the [Register Your Application](https://developer.here.com/documentation/identity-access-management/dev_guide/topics/plat-token.html#step-1-register-your-application) 31 | * section in the Identity & Access Management Developer Guide. 32 | * 33 | * @returns The `UserAuth` instance. 34 | */ 35 | export function getUserAuth(pathToCredentials: string): UserAuth { 36 | const credentials = loadCredentialsFromFile(pathToCredentials); 37 | return new UserAuth({ 38 | tokenRequester: requestToken, 39 | credentials 40 | }); 41 | } 42 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/utils/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Status codes of HTTP responses. 22 | */ 23 | export enum STATUS_CODES { 24 | OK = 200, 25 | CREATED = 201, 26 | NO_CONTENT = 204, 27 | FOUND = 302, 28 | BAD_REQUEST = 400, 29 | NOT_FOUND = 404, 30 | TO_MANY_REQUESTS = 429, 31 | INTERNAL_SERVER_ERROR = 500, 32 | SERVICE_UNAVAIBLE = 503, 33 | NETWORK_CONNECT_TIMEOUT = 599 34 | } 35 | 36 | export * from "./DataStoreDownloadManager"; 37 | export * from "./DataStoreRequestBuilder"; 38 | export * from "./DownloadManager"; 39 | export * from "./RequestBuilderFactory"; 40 | export * from "./getEnvLookupUrl"; 41 | export * from "./HRN"; 42 | export * from "./getDataSizeUtil"; 43 | export * from "./HttpError"; 44 | export * from "./FetchOptions"; 45 | export * from "./TileKey"; 46 | export * from "./Uuid"; 47 | export * from "./userAgent"; 48 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/BufferData.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { BufferData } from "../../lib/utils/multipartupload-internal/BufferData"; 23 | 24 | chai.use(sinonChai); 25 | const expect = chai.expect; 26 | 27 | describe("BufferData", function() { 28 | let mockedData: Buffer; 29 | beforeEach(() => { 30 | mockedData = Buffer.from("test-data", "utf-8"); 31 | }); 32 | 33 | it("readBytes", async function() { 34 | const data = new BufferData(mockedData); 35 | const bytes = await data.readBytes(2, 3); 36 | expect(bytes.byteLength).eqls(3); 37 | expect(bytes.toString()).eqls("st-"); 38 | }); 39 | 40 | it("size", function() { 41 | const data = new BufferData(mockedData); 42 | expect(data.size()).eqls(9); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/UploadBlobResult.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { UploadBlobResult } from "@here/olp-sdk-dataservice-write"; 23 | 24 | chai.use(sinonChai); 25 | 26 | const assert = chai.assert; 27 | const expect = chai.expect; 28 | 29 | describe("UploadBlobResult", function() { 30 | it("Should initialize", function() { 31 | const request = new UploadBlobResult(); 32 | 33 | assert.isDefined(request); 34 | expect(request).be.instanceOf(UploadBlobResult); 35 | }); 36 | 37 | it("Should set and get parameters", function() { 38 | const mockedDataHandle = "mocked-datahandle"; 39 | const request = new UploadBlobResult().withDataHandle(mockedDataHandle); 40 | expect(request.getDataHandle()).to.be.equal(mockedDataHandle); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /tests/integration/api-breaks/HttpError.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | 23 | import { HttpError } from "@here/olp-sdk-core"; 24 | 25 | chai.use(sinonChai); 26 | 27 | const assert = chai.assert; 28 | const expect = chai.expect; 29 | 30 | describe("HttpError", function() { 31 | it("Shoud be initialized with arguments", async function() { 32 | const testError = new HttpError(101, "Test Error"); 33 | assert.isDefined(testError); 34 | 35 | expect(testError).to.be.instanceOf(HttpError); 36 | assert.isDefined(testError.status); 37 | assert.isDefined(testError.message); 38 | }); 39 | 40 | it("Test isHttpError method with HttpError", async function() { 41 | const testError = new HttpError(101, "Test Error"); 42 | const response = HttpError.isHttpError(testError); 43 | assert.isTrue(response); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /tests/integration/api-breaks/HttpErrorAuth.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | 23 | import { HttpError } from "@here/olp-sdk-core"; 24 | 25 | chai.use(sinonChai); 26 | 27 | const assert = chai.assert; 28 | const expect = chai.expect; 29 | 30 | describe("Authentication HttpError", function() { 31 | it("Shoud be initialized with arguments", async function() { 32 | const testError = new HttpError(101, "Test Error"); 33 | assert.isDefined(testError); 34 | 35 | expect(testError).to.be.instanceOf(HttpError); 36 | assert.isDefined(testError.status); 37 | assert.isDefined(testError.message); 38 | }); 39 | 40 | it("Test isHttpError method with HttpError", async function() { 41 | const testError = new HttpError(101, "Test Error"); 42 | const response = HttpError.isHttpError(testError); 43 | assert.isTrue(response); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /scripts/misc/commit_message_recom.txt: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | ####################################################################### 3 | Summarize changes in around 50 characters or less. 4 | 5 | More detailed explanatory text. Wrap it to about 72 6 | characters or so. In some contexts, the first line is treated as the 7 | subject of the commit and the rest of the text as the body. The 8 | blank line separating the summary from the body is critical (unless 9 | you omit the body entirely); various tools like `log`, `shortlog` 10 | and `rebase` can get confused if you run the two together. 11 | 12 | Explain the problem that this commit is solving. Focus on why you 13 | are making this change as opposed to how (the code explains that). 14 | Are there side effects or other unintuitive consequences of this 15 | change? Here's the place to explain them. 16 | 17 | Further paragraphs come after blank lines. 18 | 19 | - Bullet points are okay, too. 20 | 21 | - Typically a hyphen or asterisk is used for the bullet, preceded 22 | by a single space, with blank lines in between, but conventions 23 | vary here. 24 | 25 | All commits need to reference a ticket (ABC-333) or Github issue (#123), 26 | again separated by a blank line from the commit message summary above. 27 | If message do not contain @here.com then following ticket reference is 28 | optional: 29 | 30 | Resolves: ABC-111, #123 31 | Relates-To: ABC-333, #321 32 | See also: ABC-432, #456, #789 33 | 34 | Signed-off-by: FirstName LastName 35 | ####################################################################### 36 | ####################################################################### -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/test/unit/CatalogRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import sinon = require("sinon"); 21 | import * as chai from "chai"; 22 | import sinonChai = require("sinon-chai"); 23 | 24 | import { CatalogRequest } from "../../lib"; 25 | 26 | chai.use(sinonChai); 27 | 28 | const assert = chai.assert; 29 | const expect = chai.expect; 30 | 31 | describe("CatalogRequest", function() { 32 | const billingTag = "billingTag"; 33 | 34 | it("Should initialize", function() { 35 | const catalogRequest = new CatalogRequest(); 36 | 37 | assert.isDefined(CatalogRequest); 38 | expect(catalogRequest).be.instanceOf(CatalogRequest); 39 | }); 40 | 41 | it("Should set parameters", function() { 42 | const catalogRequest = new CatalogRequest(); 43 | const catalogRequestWithBillTag = catalogRequest.withBillingTag( 44 | billingTag 45 | ); 46 | 47 | expect(catalogRequestWithBillTag.getBillingTag()).to.be.equal( 48 | billingTag 49 | ); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/test/loadCredentialsFromFile.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { assert } from "chai"; 21 | import { loadCredentialsFromFile } from "../lib/loadCredentialsFromFile"; 22 | 23 | describe("loadCredentialsFromFile", function() { 24 | it("should return correct AuthCredentials", function() { 25 | const credentials = loadCredentialsFromFile( 26 | "./test/test-credentials.properties" 27 | ); 28 | 29 | assert.strictEqual(credentials.accessKeyId, "Tt7wZRTAar"); 30 | assert.strictEqual( 31 | credentials.accessKeySecret, 32 | "khcy1LMBtMZsRVn1-dn7riw9x8" 33 | ); 34 | }); 35 | 36 | it("should throw an error", function() { 37 | try { 38 | loadCredentialsFromFile("./test/test-error-credentials.properties"); 39 | } catch (error) { 40 | assert.strictEqual( 41 | error.message, 42 | "Error parsing value here.access.key.id from configuration" 43 | ); 44 | } 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/README.md: -------------------------------------------------------------------------------- 1 | # Fetch Library 2 | 3 | ## Overview 4 | 5 | This module adds a supporting file:// to the [fetch](https://fetch.spec.whatwg.org/) API for [Node.js](https://nodejs.org/). This allows fetching the files from the local folders. 6 | 7 | The main goal of this module is to provide the possibility to read files from the local folders with `fetch` API in the Node.js environment. 8 | 9 | ## Usage 10 | 11 | Import the module for its side-effects: 12 | 13 | ```JavaScript 14 | import "@here/olp-sdk-fetch" 15 | ``` 16 | 17 | This adds `fetch` to the global `Node.js` namespace. 18 | 19 | ## Behavior in a Browser Context 20 | 21 | When this module is used in a browser context, it does not perform any actions, nor adds any code. 22 | 23 | ## Generate a Bundle 24 | 25 | If you want to have a compiled project, you can use bundle commands. After running each of the following commands in the `@here/olp-sdk-fetch` folder from the root folder, you get the JavaScript bundled files. 26 | 27 | To have the bundled files with source map, run: 28 | 29 | ```sh 30 | npm run bundle 31 | ``` 32 | 33 | To get a minified version for production, run: 34 | 35 | ```sh 36 | npm run bundle:prod 37 | ``` 38 | 39 | To get a bundled and minified JavaScript files, run: 40 | 41 | ```sh 42 | npm run prepublish-bundle 43 | ``` 44 | 45 | ## Use a Bundle from CDN 46 | 47 | Add minified JavaScript file to your `html` and create an object of userAuth: 48 | 49 | ```html 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | ``` 58 | 59 | ## LICENSE 60 | 61 | Copyright (C) 2019-2024 HERE Europe B.V. 62 | 63 | For license details, see the [LICENSE](LICENSE). 64 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/test/MockedRequestBuilder.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { RequestBuilder, RequestOptions } from "../lib/RequestBuilder"; 21 | 22 | export class MockedRequestBuilder extends RequestBuilder { 23 | constructor( 24 | private readonly params: { 25 | baseUrl?: string; 26 | request?: (url: string, init?: RequestOptions) => Promise; 27 | requestBlob?: ( 28 | url: string, 29 | init?: RequestOptions 30 | ) => Promise; 31 | } 32 | ) { 33 | super(params.baseUrl || "http://mocked.url"); 34 | } 35 | 36 | async download(url: string, init?: RequestOptions): Promise { 37 | return this.params.request 38 | ? this.params.request(url, init) 39 | : Promise.resolve({} as T); 40 | } 41 | 42 | async downloadBlob(url: string, init?: RequestOptions): Promise { 43 | return this.params.requestBlob 44 | ? this.params.requestBlob(url, init) 45 | : Promise.resolve(new Response()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /examples/react-app-example/src/getOlpClientSettings.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { requestToken, UserAuth } from "@here/olp-sdk-authentication"; 21 | import { OlpClientSettings } from "@here/olp-sdk-core"; 22 | 23 | function getOlpClientSettings() { 24 | return fetch("/credentials.json") 25 | .then(res => res.json()) 26 | .then(credentials => { 27 | const userAuth = new UserAuth({ 28 | tokenRequester: requestToken, 29 | env: "here", 30 | credentials 31 | }); 32 | 33 | return new OlpClientSettings({ 34 | environment: "here", 35 | getToken: () => userAuth.getToken() 36 | }); 37 | }) 38 | .catch(_ => { 39 | throw new Error(`Please create file ./public/credentials.json and add your credentials in format: { 40 | "accessKeyId": "your access key id", 41 | "accessKeySecret": "your access key secret" 42 | }. 43 | For more info please visit https://developer.here.com/documentation/sdk-typescript/dev_guide/topics/authenticate.html`); 44 | }); 45 | } 46 | 47 | export default getOlpClientSettings; 48 | -------------------------------------------------------------------------------- /tests/integration/bundles/umd/olp-sdk-authentication-testCases.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import assert = require("assert"); 21 | import { requestToken, UserAuth } from "@here/olp-sdk-authentication"; 22 | 23 | export const OlpSdkAuthenticationTestCases: { 24 | it: string; 25 | callback: () => void; 26 | }[] = [ 27 | { 28 | it: "UserAuth should be defined", 29 | callback: function() { 30 | assert(UserAuth !== undefined); 31 | } 32 | }, 33 | { 34 | it: "UserAuth should be initialised", 35 | callback: function() { 36 | const userAuth = new UserAuth({ 37 | credentials: { 38 | accessKeyId: "mocked-id", 39 | accessKeySecret: "mocked-str" 40 | }, 41 | tokenRequester: requestToken 42 | }); 43 | 44 | assert(userAuth.getToken !== undefined); 45 | assert(userAuth.getUserInfo !== undefined); 46 | assert(userAuth.validateAccessToken !== undefined); 47 | } 48 | }, 49 | { 50 | it: "requestToken should be defined", 51 | callback: function() { 52 | assert(requestToken !== undefined); 53 | } 54 | } 55 | ]; 56 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/GetBatchRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { GetBatchRequest } from "@here/olp-sdk-dataservice-write"; 23 | 24 | chai.use(sinonChai); 25 | 26 | const assert = chai.assert; 27 | const expect = chai.expect; 28 | 29 | describe("GetBatchRequest", function() { 30 | it("Should initialize", function() { 31 | const request = new GetBatchRequest(); 32 | 33 | assert.isDefined(request); 34 | expect(request).be.instanceOf(GetBatchRequest); 35 | }); 36 | 37 | it("Should set and get parameters", function() { 38 | const mockedPublicationId = "publication-id"; 39 | const mockedBillingTag = "mocked-billing-tag"; 40 | 41 | const request = new GetBatchRequest() 42 | .withPublicationId(mockedPublicationId) 43 | .withBillingTag(mockedBillingTag); 44 | 45 | expect(request.getPublicationId()).to.be.equal(mockedPublicationId); 46 | expect(request.getBillingTag()).to.be.equal(mockedBillingTag); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/client/CatalogRequest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { validateBillingTag } from "@here/olp-sdk-dataservice-read"; 21 | 22 | /** 23 | * Prepares information for calls to get catalog metadata from the platform Config Service. 24 | */ 25 | export class CatalogRequest { 26 | private billingTag?: string; 27 | 28 | /** 29 | * An optional free-form tag that is used for grouping billing records together. 30 | * If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A-Za-z0-9]. 31 | * 32 | * @param tag The `BillingTag` string. 33 | * @return The updated [[CatalogRequest]] instance that you can use to chain methods. 34 | */ 35 | public withBillingTag(tag: string): CatalogRequest { 36 | this.billingTag = validateBillingTag(tag); 37 | return this; 38 | } 39 | 40 | /** 41 | * Gets a billing tag to group billing records together. 42 | * 43 | * @return The `BillingTag` string. 44 | */ 45 | public getBillingTag(): string | undefined { 46 | return this.billingTag; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/CancelBatchRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { CancelBatchRequest } from "@here/olp-sdk-dataservice-write"; 23 | 24 | chai.use(sinonChai); 25 | 26 | const assert = chai.assert; 27 | const expect = chai.expect; 28 | 29 | describe("CancelBatchRequest", function() { 30 | it("Should initialize", function() { 31 | const request = new CancelBatchRequest(); 32 | 33 | assert.isDefined(request); 34 | expect(request).be.instanceOf(CancelBatchRequest); 35 | }); 36 | 37 | it("Should set and get parameters", function() { 38 | const mockedPublicationId = "publication-id"; 39 | const mockedBillingTag = "mocked-billing-tag"; 40 | 41 | const request = new CancelBatchRequest() 42 | .withPublicationId(mockedPublicationId) 43 | .withBillingTag(mockedBillingTag); 44 | 45 | expect(request.getPublicationId()).to.be.equal(mockedPublicationId); 46 | expect(request.getBillingTag()).to.be.equal(mockedBillingTag); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/client/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./CatalogClient"; 21 | export * from "./CatalogRequest"; 22 | export * from "./DataRequest"; 23 | export * from "./StatisticsClient"; 24 | export * from "./StatisticsRequest"; 25 | export * from "./SummaryRequest"; 26 | export * from "./VersionedLayerClient"; 27 | export * from "./VolatileLayerClient"; 28 | export * from "./ConfigClient"; 29 | export * from "./CatalogsRequest"; 30 | export * from "./SchemaDetailsRequest"; 31 | export * from "./ArtifactClient"; 32 | export * from "./PartitionsRequest"; 33 | export * from "./QueryClient"; 34 | export * from "./QuadTreeIndexRequest"; 35 | export * from "./QuadKeyPartitionsRequest"; 36 | export * from "./SchemaRequest"; 37 | export * from "./CatalogVersionRequest"; 38 | export * from "./LayerVersionsRequest"; 39 | export * from "./IndexLayerClient"; 40 | export * from "./IndexQueryRequest"; 41 | export * from "./StreamLayerClient"; 42 | export * from "./SubscribeRequest"; 43 | export * from "./PollRequest"; 44 | export * from "./UnsubscribeRequest"; 45 | export * from "./SeekRequest"; 46 | export * from "./TileRequest"; 47 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/CompleteBatchRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { CompleteBatchRequest } from "@here/olp-sdk-dataservice-write"; 23 | 24 | chai.use(sinonChai); 25 | 26 | const assert = chai.assert; 27 | const expect = chai.expect; 28 | 29 | describe("CompleteBatchRequest", function() { 30 | it("Should initialize", function() { 31 | const request = new CompleteBatchRequest(); 32 | 33 | assert.isDefined(request); 34 | expect(request).be.instanceOf(CompleteBatchRequest); 35 | }); 36 | 37 | it("Should set and get parameters", function() { 38 | const mockedPublicationId = "publication-id"; 39 | const mockedBillingTag = "mocked-billing-tag"; 40 | 41 | const request = new CompleteBatchRequest() 42 | .withPublicationId(mockedPublicationId) 43 | .withBillingTag(mockedBillingTag); 44 | 45 | expect(request.getPublicationId()).to.be.equal(mockedPublicationId); 46 | expect(request.getBillingTag()).to.be.equal(mockedBillingTag); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/README.md: -------------------------------------------------------------------------------- 1 | # HERE Data SDK Core Library 2 | 3 | ## Overview 4 | 5 | This repository contains the complete source code for the HERE Data SDK Core for TypeScript `@here/olp-sdk-core` project. `olp-sdk-core` is a TypeScript library that contains the common code for `@here/olp-sdk-dataservice-read`, `@here/olp-sdk-dataservice-api`, and `@here/olp-sdk-authentication`. 6 | 7 | ## Directory Layout 8 | 9 | Here is an overview of the top-level files of the repository: 10 | 11 | | 12 | +- @here/olp-sdk-core 13 | | 14 | +- lib # Implementation of the project 15 | | 16 | +- test # Test code 17 | 18 | ## Development 19 | 20 | ### Prerequisites 21 | 22 | The following NPM packages are required to build/test the library: 23 | 24 | - node: >= 10.0.0 25 | - npm: >= 6.0.0 26 | 27 | ### Build 28 | 29 | Open a command prompt of the working tree's root directory and type: 30 | 31 | ```sh 32 | npm install 33 | npm run build 34 | ``` 35 | 36 | ### Test 37 | 38 | Open a command prompt of the working tree's root directory and type: 39 | 40 | ```sh 41 | npm run test 42 | ``` 43 | 44 | ### Generate a Bundle 45 | 46 | If you want to have a compiled project, you can use bundle commands. After running each of the following commands in the `@here/olp-sdk-dataservice-read` folder from the root folder, you get the JavaScript bundled files. 47 | 48 | To get bundled files with a source map, run: 49 | 50 | ```sh 51 | npm run bundle 52 | ``` 53 | 54 | To get minified version for production, run: 55 | 56 | ```sh 57 | npm run bundle:prod 58 | ``` 59 | 60 | To get bundled and minified JavaScript files, run: 61 | 62 | ```sh 63 | npm run prepublish-bundle 64 | ``` 65 | 66 | ## LICENSE 67 | 68 | Copyright (C) 2020-2023 HERE Europe B.V. 69 | 70 | For license details, see the [LICENSE](LICENSE). 71 | -------------------------------------------------------------------------------- /examples/react-app-example/src/Catalogs.tsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { OlpClientSettings } from "@here/olp-sdk-core"; 21 | import React from "react"; 22 | import { Link } from "react-router-dom"; 23 | import "./Catalogs.css"; 24 | import listOfCatalogs from "./listOfCatalogs"; 25 | 26 | class Catalogs extends React.Component< 27 | { settings: OlpClientSettings }, 28 | { 29 | catalogs: { title: string; hrn: string }[]; 30 | } 31 | > { 32 | constructor(props: { settings: OlpClientSettings }) { 33 | super(props); 34 | this.state = { 35 | catalogs: [], 36 | }; 37 | } 38 | 39 | componentDidMount() { 40 | listOfCatalogs(this.props.settings).then((catalogs) => { 41 | this.setState({ catalogs }); 42 | }); 43 | } 44 | 45 | render() { 46 | return ( 47 |
48 | Catalogs 49 |
    50 | {this.state.catalogs.map((el, index) => ( 51 |
  • 52 | {el.title} 53 |
  • 54 | ))} 55 |
56 |
57 | ); 58 | } 59 | } 60 | 61 | export default Catalogs; 62 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/utils/BlobData.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * An abstraction for `BlobData` instances. 22 | * 23 | * The wrapper of data (`Blob`, `Buffer`, `File`, string, and so on) 24 | * that allows to read a specific range of bytes and get data size. 25 | */ 26 | export abstract class BlobData { 27 | /** 28 | * Gets buffer from a range of data. 29 | * 30 | * @param offset The first byte of the data range for reading. 31 | * @param count The number of bytes to read from the underlying data. 32 | * This value will be trimmed if the count exceeded the EOF or end of the stream. 33 | * 34 | * @returns The `Promise` object with the buffer. 35 | */ 36 | abstract readBytes(offset: number, count: number): Promise; 37 | 38 | /** 39 | * Gets the size of the data. 40 | * 41 | * @returns The `Promise` object with the length of the data in bytes. 42 | */ 43 | abstract size(): number; 44 | 45 | /** 46 | * This method should always be called at the end of the reading process 47 | * so that we can properly clean up. 48 | */ 49 | abstract finally?(): Promise; 50 | } 51 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/WebData.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { WebData } from "../../lib/utils/multipartupload-internal/WebData"; 23 | 24 | chai.use(sinonChai); 25 | const expect = chai.expect; 26 | 27 | describe("WebData", function() { 28 | let mockedBlob: Blob; 29 | const mockedDataSize = 9; 30 | beforeEach(() => { 31 | mockedBlob = { 32 | slice: (from: number, to: number) => { 33 | return { 34 | arrayBuffer: () => 35 | Promise.resolve( 36 | Buffer.from("test-data", "utf8").slice(from, to) 37 | ) 38 | }; 39 | }, 40 | size: mockedDataSize 41 | } as any; 42 | }); 43 | 44 | it("readBytes", async function() { 45 | const data = new WebData(mockedBlob); 46 | const bytes = await data.readBytes(2, 3); 47 | expect(bytes.byteLength).eqls(3); 48 | expect(bytes.toString()).eqls("st-"); 49 | }); 50 | 51 | it("size", function() { 52 | const data = new WebData(mockedBlob); 53 | expect(data.size()).eqls(9); 54 | }); 55 | }); 56 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/utils/HttpError.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Provides more usable errors from the HERE platform Services. 22 | * 23 | * This class is used in the methods 24 | * to propagate errors with an HTTP status code and with a message 25 | * if something goes wrong during the request. 26 | * The `HttpError` class extends generic `Error` class from V8 and 27 | * adds property code to the HTTP statuses. 28 | */ 29 | export class HttpError extends Error { 30 | /** A name of the error type. The initial value is `Error`. */ 31 | public readonly name: string; 32 | 33 | /** 34 | * Constructs the `HttpError` instance. 35 | * 36 | * @param status The error status number. 37 | * @param message A human-readable description of the error. 38 | */ 39 | constructor(public status: number, message: string) { 40 | super(message); 41 | this.name = "HttpError"; 42 | } 43 | 44 | /** 45 | * Checks if the given error is an HTTP error. 46 | * 47 | * @param error The `Error` object that is checked. 48 | * @returns True is the given error is an HTTP error; false otherwise. 49 | */ 50 | public static isHttpError(error: any): error is HttpError { 51 | return error.name === "HttpError"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/CheckDataExistsRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { CheckDataExistsRequest } from "@here/olp-sdk-dataservice-write"; 23 | 24 | chai.use(sinonChai); 25 | 26 | const assert = chai.assert; 27 | const expect = chai.expect; 28 | 29 | describe("CheckDataExistsRequest", function() { 30 | it("Should initialize", function() { 31 | const request = new CheckDataExistsRequest(); 32 | 33 | assert.isDefined(request); 34 | expect(request).be.instanceOf(CheckDataExistsRequest); 35 | }); 36 | 37 | it("Should set and get parameters", function() { 38 | const mockedLayer = "layer-0"; 39 | const mockedBillingTag = "mocked-billing-tag"; 40 | const mockedDataHandle = "datahandle123"; 41 | 42 | const request = new CheckDataExistsRequest() 43 | .withLayerId(mockedLayer) 44 | .withDataHandle(mockedDataHandle) 45 | .withBillingTag(mockedBillingTag); 46 | 47 | expect(request.getLayerId()).to.be.equal(mockedLayer); 48 | expect(request.getBillingTag()).to.be.equal(mockedBillingTag); 49 | expect(request.getDataHandle()).to.be.equal(mockedDataHandle); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /tests/utils/mocked-olp-server/blob_service.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | function generateGetBlobApiResponse(request) { 21 | const layer = request[1] 22 | const dataHandle = request[2] // ignored 23 | 24 | // Generate a blob 400-500 Kb 25 | var response = "" 26 | var length = (Math.floor(Math.random() * 100) + 400) * 1024 27 | var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 28 | var charactersLength = characters.length; 29 | for ( var i = 0; i < length; i++ ) { 30 | response += characters.charAt(Math.floor(Math.random() * charactersLength)); 31 | } 32 | 33 | return response; 34 | } 35 | 36 | const methods = [ 37 | { 38 | regex: /layers\/(.+)\/data\/(.+)$/, 39 | handler: generateGetBlobApiResponse 40 | } 41 | ] 42 | 43 | function blob_handler(pathname, query) { 44 | for (method of methods) { 45 | const match = pathname.match(method.regex) 46 | if (match) { 47 | const response = method.handler(match, query) 48 | return { status: 200, text: response, headers : {"Content-Type": "application/x-protobuf"} } 49 | } 50 | } 51 | console.log("Not handled", pathname) 52 | return { status: 404, text: "Not Found" } 53 | } 54 | 55 | exports.handler = blob_handler -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/utils/multipartupload-internal/UploadRequest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * @internal 22 | * Interfaces for upload requests classes. 23 | */ 24 | export abstract class UploadRequest { 25 | abstract startMultipartUpload(opts: { 26 | layerId: string; 27 | handle: string; 28 | contentType: string; 29 | contentEncoding?: string; 30 | billingTag?: string; 31 | }): Promise<{ 32 | multipartToken?: string; 33 | uploadPartUrl?: string; 34 | completeUrl?: string; 35 | statusUrl?: string; 36 | }>; 37 | 38 | abstract uploadPart(opts: { 39 | data: ArrayBuffer; 40 | multipartToken?: string; 41 | layerId?: string; 42 | url?: string; 43 | contentType?: string; 44 | partNumber?: number; 45 | contentLength?: number; 46 | billingTag?: string; 47 | }): Promise<{ 48 | partNumber: number; 49 | partId: string; 50 | }>; 51 | 52 | abstract completeMultipartUpload(opts: { 53 | parts: { 54 | id: string; 55 | number: number; 56 | }[]; 57 | layerId?: string; 58 | multipartToken?: string; 59 | url?: string; 60 | billingTag?: string; 61 | }): Promise; 62 | } 63 | -------------------------------------------------------------------------------- /examples/react-app-example/README.md: -------------------------------------------------------------------------------- 1 | # Get started with the React App and HERE Data SDK for Typescript 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Run the app 6 | 7 | 1. Copy `./public/credentials.json.sample` to `./public/credentials.json`, and then add your credentials to that file. 8 | 9 | For more information, see the [related section](https://www.here.com/docs/bundle/data-sdk-for-typescript-developer-guide/page/docs/GettingStartedGuide.html) in our Developer Guide. 10 | 11 | 2. To fetch dependencies, run `yarn && yarn add react-scripts`. 12 | 13 | 3. To run the app in the development mode, run `yarn start`. 14 | 15 | 4. In your favorite browser, open `http://localhost:3000`. 16 | 17 | ## Available scripts 18 | 19 | In the project directory, you can run the following scripts: 20 | 21 | - `yarn start` – runs the app in the development mode.\ 22 | To view it in the browser, open [http://localhost:3000](http://localhost:3000). 23 | 24 | The page reloads if you make edits.\ 25 | You will also see no lint errors in the console. 26 | 27 | - `yarn build` – builds the app for production in the `build` folder.\ 28 | It correctly bundles React in the production mode and optimizes the build for the best performance. 29 | 30 | The build is minified, and the filenames include hashes.\ 31 | Your app is ready to be deployed. For more information on deployment, see the [related section](https://facebook.github.io/create-react-app/docs/deployment) in the Create React App documentation. 32 | 33 | ## Learn more 34 | 35 | For more information, see the following documentation: 36 | 37 | - Data API Developer Guide and API Reference 38 | - [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started) 39 | - [React documentation](https://reactjs.org/) 40 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/test/unit/TileRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import sinon = require("sinon"); 21 | import * as chai from "chai"; 22 | import sinonChai = require("sinon-chai"); 23 | 24 | import * as dataServiceRead from "../../lib"; 25 | import { FetchOptions } from "@here/olp-sdk-core"; 26 | 27 | chai.use(sinonChai); 28 | 29 | const assert = chai.assert; 30 | const expect = chai.expect; 31 | 32 | describe("TileRequest", function() { 33 | const mockedQuadKey = { 34 | row: 1, 35 | column: 2, 36 | level: 3 37 | }; 38 | 39 | const mockedBillingTag = "billing-tag"; 40 | 41 | const request = new dataServiceRead.TileRequest(); 42 | 43 | it("Should initialize", function() { 44 | assert.isDefined(request); 45 | expect(request).be.instanceOf(dataServiceRead.TileRequest); 46 | }); 47 | 48 | it("Should get parameters with chain", async function() { 49 | request 50 | .withTileKey(mockedQuadKey) 51 | .withBillingTag(mockedBillingTag) 52 | .withFetchOption(FetchOptions.OnlineOnly); 53 | 54 | expect(request.getTileKey()).to.be.equal(mockedQuadKey); 55 | expect(request.getFetchOption()).to.be.equal(FetchOptions.OnlineOnly); 56 | expect(request.getBillingTag()).to.be.equal(mockedBillingTag); 57 | }); 58 | }); 59 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | export * from "./lib/RequestBuilder"; 21 | 22 | import * as ArtifactApi from "./lib/artifact-api"; 23 | import * as AuthorizationAPI from "./lib/authorization-api-v1.1"; 24 | import * as BlobApi from "./lib/blob-api"; 25 | import * as ConfigApi from "./lib/config-api"; 26 | import * as CoverageApi from "./lib/coverage-api"; 27 | import * as IndexApi from "./lib/index-api"; 28 | import * as LookupApi from "./lib/lookup-api"; 29 | import * as MetadataApi from "./lib/metadata-api"; 30 | import * as PublishApi from "./lib/publish-api-v2"; 31 | import * as QueryApi from "./lib/query-api"; 32 | import * as StreamApi from "./lib/stream-api"; 33 | import * as VolatileBlobApi from "./lib/volatile-blob-api"; 34 | import * as ObjectStoreApi from "./lib/blob.v2.api"; 35 | import * as InteractiveApi from "./lib/interactive-api-v1"; 36 | 37 | // tslint:disable-next-line: array-type 38 | export type AdditionalFields = Array< 39 | "dataSize" | "checksum" | "compressedDataSize" | "crc" 40 | >; 41 | 42 | export { 43 | AuthorizationAPI, 44 | LookupApi, 45 | MetadataApi, 46 | ConfigApi, 47 | ArtifactApi, 48 | QueryApi, 49 | CoverageApi, 50 | BlobApi, 51 | VolatileBlobApi, 52 | IndexApi, 53 | StreamApi, 54 | PublishApi, 55 | ObjectStoreApi, 56 | InteractiveApi 57 | }; 58 | -------------------------------------------------------------------------------- /examples/nodejs-example/README.md: -------------------------------------------------------------------------------- 1 | # Download data with HERE Data SDK for Typescript 2 | 3 | You can use this example app to fetch data from versioned layers and save it to files. 4 | 5 | ## Build and install 6 | 7 | To build the app, run `npm run build`. 8 | 9 | If you want to use the app in any folder, install it globally by running `npm install -g .`. 10 | 11 | ## Use the app 12 | 13 | If you installed the app globally, to see the list of available parameters, run `download-partitions --help`. 14 | Otherwise, in the app folder, run `node . --help`. 15 | 16 | You can use the app to do the following: 17 | 18 | - Download and save partitions to the current directory. 19 | 20 | ```bash 21 | download-partitions -c \ 22 | -l \ 23 | -p partitionId1,partitionId2,partitionId3 24 | ``` 25 | 26 | - Download partitions from a catalog version and save them to the current directory. 27 | 28 | ```bash 29 | download-partitions -c \ 30 | -l \ 31 | -p partitionId1,partitionId2,partitionId3 \ 32 | -v 33 | ``` 34 | 35 | - Download and save partitions to a specific directory. 36 | 37 | ```bash 38 | download-partitions -c \ 39 | -l \ 40 | -p partitionId1,partitionId2,partitionId3 \ 41 | -o 42 | ``` 43 | 44 | - Download partitions defined in a file and save them to a specific directory. 45 | 46 | ```bash 47 | download-partitions -c \ 48 | -l \ 49 | --pf \ 50 | -o 51 | ``` 52 | 53 | - Download a partition from a versioned layer with the HERE tile partitioning schema using the `row,column,level` string (a tile key) and save the partition to a specific directory. 54 | 55 | ```bash 56 | download-partitions -c \ 57 | -l \ 58 | -q 1580,2069,12 \ 59 | -o 60 | ``` 61 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/client/PollRequest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Prepares information for calls to the platform Stream Service. 22 | */ 23 | export class PollRequest { 24 | private mode?: "serial" | "parallel"; 25 | private subscriptionId?: string; 26 | 27 | /** 28 | * Gets the subscription mode for the request. 29 | * 30 | * @return The subscription mode. 31 | */ 32 | public getMode(): "serial" | "parallel" | undefined { 33 | return this.mode; 34 | } 35 | 36 | /** 37 | * A setter for the provided subscription mode. 38 | * 39 | * @param mode The subscription mode. 40 | * @returns The [[PollRequest]] instance that you can use to chain methods. 41 | */ 42 | public withMode(mode: "serial" | "parallel"): PollRequest { 43 | this.mode = mode; 44 | return this; 45 | } 46 | 47 | /** 48 | * Gets the subscription id for the request. 49 | * 50 | * @return The subscription id. 51 | */ 52 | public getSubscriptionId(): string | undefined { 53 | return this.subscriptionId; 54 | } 55 | 56 | /** 57 | * A setter for the provided subscription id. 58 | * 59 | * @param id The subscription id. 60 | * @returns The [[PollRequest]] instance that you can use to chain methods. 61 | */ 62 | public withSubscriptionId(id: string): PollRequest { 63 | this.subscriptionId = id; 64 | return this; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /examples/react-app-example/src/App.tsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import React from "react"; 21 | import { Switch, Route } from "react-router-dom"; 22 | import Catalogs from "./Catalogs"; 23 | import Catalog from "./Catalog"; 24 | import Layer from "./Layer"; 25 | import getOlpClientSettings from "./getOlpClientSettings"; 26 | import { OlpClientSettings } from "@here/olp-sdk-core"; 27 | 28 | export const OlpClientSettingsContext = React.createContext({}); 29 | class App extends React.Component< 30 | any, 31 | { 32 | settings?: OlpClientSettings; 33 | } 34 | > { 35 | constructor(props: any) { 36 | super(props); 37 | this.state = {}; 38 | } 39 | 40 | componentDidMount() { 41 | getOlpClientSettings().then((settings) => { 42 | this.setState({ settings }); 43 | }); 44 | } 45 | render() { 46 | if (!this.state.settings) { 47 | return null; 48 | } 49 | return ( 50 |
51 |

An example React app with Here Data SDK Typescript.

52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
65 | ); 66 | } 67 | } 68 | 69 | export default App; 70 | -------------------------------------------------------------------------------- /tests/integration/api-breaks/CatalogRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { CatalogRequest } from "@here/olp-sdk-dataservice-read"; 23 | 24 | chai.use(sinonChai); 25 | 26 | const assert = chai.assert; 27 | const expect = chai.expect; 28 | 29 | describe("CatalogRequest", function() { 30 | class CatalogRequestTest extends CatalogRequest { 31 | withBillingTag(tag: string): CatalogRequest { 32 | return this; 33 | } 34 | 35 | getBillingTag(): string { 36 | return "billing-tag"; 37 | } 38 | } 39 | 40 | it("Shoud be initialized", async function() { 41 | const catalogRequest = new CatalogRequestTest(); 42 | assert.isDefined(catalogRequest); 43 | expect(catalogRequest).to.be.instanceOf(CatalogRequest); 44 | 45 | assert.isFunction(catalogRequest.withBillingTag); 46 | assert.isFunction(catalogRequest.getBillingTag); 47 | }); 48 | 49 | it("Test withBillingTag method with tag", async function() { 50 | const catalogRequest = new CatalogRequestTest(); 51 | 52 | const response = catalogRequest.withBillingTag("test-tag"); 53 | assert.isDefined(response); 54 | }); 55 | 56 | it("Test getBillingTag method without params", async function() { 57 | const catalogRequest = new CatalogRequestTest(); 58 | catalogRequest.withBillingTag("test-tag"); 59 | 60 | const response = catalogRequest.getBillingTag(); 61 | assert.isDefined(response); 62 | }); 63 | }); 64 | -------------------------------------------------------------------------------- /tests/utils/mocked-olp-server/errors_generator.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | function generateErrorAtRandom() { 21 | const errorList = [ 22 | { 23 | status: 403, 24 | text: JSON.stringify( 25 | '{"error":"Forbidden","error_description":"These credentials do not authorize access"}'), 26 | headers: { 'Content-Type': 'application/json' } 27 | }, 28 | { 29 | status: 404, 30 | text: JSON.stringify( 31 | '{"error":"Resource not Found","error_description":"Requested resource not found"}'), 32 | headers: { 'Content-Type': 'application/json' } 33 | }, 34 | { 35 | status: 401, 36 | text: JSON.stringify( 37 | '{"errorId":"ERROR-3aaaa33b-3fb6-41cc-a238-7ff97c17bca7","httpStatus":401,"errorCode":401202,"message":"Invalid Client Authorization header, expecting signed request format."}'), 38 | headers: { 'Content-Type': 'application/json' } 39 | }, 40 | { 41 | status: 404, 42 | text: JSON.stringify( 43 | '{"title":"Not Found","detail":[{"name":"other","error":"API not found blob/v10"}],"status":404}'), 44 | headers: { 'Content-Type': 'application/json' } 45 | }, 46 | { 47 | status: 500, 48 | text: JSON.stringify('{"title":"Internal Server Error","status":500}'), 49 | headers: { 'Content-Type': 'application/json' } 50 | } 51 | ]; 52 | 53 | const index = Math.floor(Math.random() * errorList.length); 54 | return errorList[index]; 55 | } 56 | 57 | exports.handler = generateErrorAtRandom -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/client/UnsubscribeRequest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Prepares information for calls to the platform Stream Service. 22 | */ 23 | export class UnsubscribeRequest { 24 | private mode?: "serial" | "parallel"; 25 | private subscriptionId?: string; 26 | 27 | /** 28 | * Gets the subscription mode for the request. 29 | * 30 | * @return The subscription mode. 31 | */ 32 | public getMode(): "serial" | "parallel" | undefined { 33 | return this.mode; 34 | } 35 | 36 | /** 37 | * A setter for the provided subscription mode. 38 | * 39 | * @param mode The subscription mode. 40 | * @returns The [[UnsubscribeRequest]] instance that you can use to chain methods. 41 | */ 42 | public withMode(mode: "serial" | "parallel"): UnsubscribeRequest { 43 | this.mode = mode; 44 | return this; 45 | } 46 | 47 | /** 48 | * Gets the subscription id for the request. 49 | * 50 | * @return The subscription id. 51 | */ 52 | public getSubscriptionId(): string | undefined { 53 | return this.subscriptionId; 54 | } 55 | 56 | /** 57 | * A setter for the provided subscription id. 58 | * 59 | * @param id The subscription id. 60 | * @returns The [[UnsubscribeRequest]] instance that you can use to chain methods. 61 | */ 62 | public withSubscriptionId(id: string): UnsubscribeRequest { 63 | this.subscriptionId = id; 64 | return this; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/test/unit/UnsubscribeRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | 23 | import { UnsubscribeRequest } from "../../lib"; 24 | 25 | chai.use(sinonChai); 26 | 27 | const assert = chai.assert; 28 | const expect = chai.expect; 29 | 30 | describe("SubscribeRequest", function() { 31 | it("Should initialize", function() { 32 | const request = new UnsubscribeRequest(); 33 | 34 | assert.isDefined(request); 35 | expect(request).be.instanceOf(UnsubscribeRequest); 36 | }); 37 | 38 | it("Should set parameters", function() { 39 | const mockMode = "parallel"; 40 | const mockSubId = "1111111111"; 41 | const request = new UnsubscribeRequest(); 42 | const requestWithMode = request.withMode(mockMode); 43 | const requestWithSub = request.withSubscriptionId(mockSubId); 44 | 45 | expect(requestWithMode.getMode()).to.be.equal(mockMode); 46 | expect(requestWithSub.getSubscriptionId()).to.be.equal(mockSubId); 47 | }); 48 | 49 | it("Should get parameters with chain", function() { 50 | const mockMode = "parallel"; 51 | const mockSubId = "1111111111"; 52 | 53 | const request = new UnsubscribeRequest() 54 | .withMode(mockMode) 55 | .withSubscriptionId(mockSubId); 56 | 57 | expect(request.getMode()).to.be.equal(mockMode); 58 | expect(request.getSubscriptionId()).to.be.equal(mockSubId); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/test/unit/PollRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | 23 | import { PollRequest } from "../../lib"; 24 | 25 | chai.use(sinonChai); 26 | 27 | const assert = chai.assert; 28 | const expect = chai.expect; 29 | 30 | describe("PollRequest", function() { 31 | it("Should initialize", function() { 32 | const pollRequest = new PollRequest(); 33 | 34 | assert.isDefined(pollRequest); 35 | expect(pollRequest).be.instanceOf(PollRequest); 36 | }); 37 | 38 | it("Should set parameters", function() { 39 | const mockMode = "parallel"; 40 | const mockSubId = "1111111111"; 41 | 42 | const pollRequest = new PollRequest(); 43 | const pollRequestWithMode = pollRequest.withMode(mockMode); 44 | const pollRequestWithSub = pollRequest.withSubscriptionId(mockSubId); 45 | 46 | expect(pollRequestWithMode.getMode()).to.be.equal(mockMode); 47 | expect(pollRequestWithSub.getSubscriptionId()).to.be.equal(mockSubId); 48 | }); 49 | 50 | it("Should get parameters with chain", function() { 51 | const mockMode = "parallel"; 52 | const mockSubId = "1111111111"; 53 | const pollRequest = new PollRequest() 54 | .withMode(mockMode) 55 | .withSubscriptionId(mockSubId); 56 | 57 | expect(pollRequest.getMode()).to.be.equal(mockMode); 58 | expect(pollRequest.getSubscriptionId()).to.be.equal(mockSubId); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /examples/react-app-example/src/Catalog.tsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { HRN, OlpClientSettings } from "@here/olp-sdk-core"; 21 | import { CatalogClient, CatalogRequest } from "@here/olp-sdk-dataservice-read"; 22 | import { ConfigApi } from "@here/olp-sdk-dataservice-api"; 23 | import React, { useEffect, useState } from "react"; 24 | import { Link, useParams } from "react-router-dom"; 25 | 26 | function Catalog(props: { settings: OlpClientSettings }) { 27 | const { hrn } = useParams() as { hrn: string }; 28 | const client = new CatalogClient(HRN.fromString(hrn), props.settings); 29 | const [catalog, setCatalog] = useState(); 30 | 31 | useEffect(() => { 32 | if (!catalog) { 33 | client 34 | .getCatalog(new CatalogRequest()) 35 | .then((response) => { 36 | setCatalog(response); 37 | }) 38 | .catch((error) => { 39 | throw new Error(error); 40 | }); 41 | } 42 | }); 43 | 44 | if (!catalog) { 45 | return null; 46 | } 47 | 48 | return ( 49 |
50 | Catalogs 51 | {" > "} 52 | Layers in catalog "{catalog.name}" 53 |
    54 | {catalog.layers.map((layer, index) => ( 55 |
  • 56 | 57 | {`${layer.name} (${layer.layerType})`} 58 | 59 |

    {layer.description}

    60 |
  • 61 | ))} 62 |
63 |
64 | ); 65 | } 66 | 67 | export default Catalog; 68 | -------------------------------------------------------------------------------- /@here/olp-sdk-fetch/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@here/olp-sdk-fetch", 3 | "version": "2.0.0", 4 | "description": "Adds a subset of the fetch API for Node.js", 5 | "main": "index.js", 6 | "browser": "index.web.js", 7 | "typings": "index.web", 8 | "directories": { 9 | "test": "test" 10 | }, 11 | "scripts": { 12 | "build": "tsc", 13 | "lint": "tslint -c tslint.json -p tsconfig.json", 14 | "test": "tsc -p ./test/tsconfig.json && mocha", 15 | "coverage": "nyc npm run test", 16 | "codecov": "npm run coverage && nyc report --reporter=lcov", 17 | "prepare": "tsc --sourceMap false && npm run bundle", 18 | "bundle": "npm run bundle:dev && npm run bundle:prod", 19 | "bundle:prod": "webpack --env.NODE_ENV=production", 20 | "bundle:dev": "webpack --env.NODE_ENV=development" 21 | }, 22 | "nyc": { 23 | "include": [ 24 | "*.ts", 25 | "*.js" 26 | ], 27 | "extension": [ 28 | ".ts" 29 | ], 30 | "require": [ 31 | "ts-node/register" 32 | ], 33 | "reporter": [ 34 | "text", 35 | "html" 36 | ], 37 | "sourceMap": true, 38 | "instrument": true 39 | }, 40 | "repository": { 41 | "type": "git", 42 | "url": "ssh://git@github.com:heremaps/here-data-sdk-typescript.git", 43 | "directory": "@here/olp-sdk-fetch" 44 | }, 45 | "author": { 46 | "name": "HERE Europe B.V.", 47 | "url": "https://here.com" 48 | }, 49 | "license": "Apache-2.0", 50 | "devDependencies": { 51 | "@types/chai": "^4.2.7", 52 | "@types/mocha": "^5.2.7", 53 | "@types/node": "18.7.14", 54 | "@types/sinon": "7.0.3", 55 | "@types/sinon-chai": "^3.2.3", 56 | "chai": "^4.2.0", 57 | "glob": "^7.1.6", 58 | "husky": "^3.1.0", 59 | "lint-staged": "^9.5.0", 60 | "mocha": "^6.2.2", 61 | "nyc": "^15.0.0", 62 | "prettier": "^1.19.1", 63 | "sinon": "7.4.2", 64 | "sinon-chai": "^3.4.0", 65 | "source-map-support": "^0.5.16", 66 | "ts-node": "10.9.2", 67 | "tslint": "^6.1.3", 68 | "tslint-config-prettier": "^1.18.0", 69 | "typedoc": "^0.22.13", 70 | "typescript": "4.0.3", 71 | "webpack": "^4.46.0", 72 | "webpack-cli": "^3.3.10", 73 | "terser-webpack-plugin": "^1.4.5" 74 | }, 75 | "engines": { 76 | "node": ">= 18.0.0" 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@here/olp-sdk-dataservice-api", 3 | "version": "2.0.0", 4 | "description": "Generated from the OpenAPI specification of the HERE Open Location Platform Data API", 5 | "main": "index.js", 6 | "typings": "index", 7 | "directories": { 8 | "test": "test", 9 | "lib": "lib" 10 | }, 11 | "scripts": { 12 | "build": "tsc", 13 | "lint": "tslint -c tslint.json -p tsconfig.json", 14 | "test": "tsc -p ./test/tsconfig.json && mocha", 15 | "coverage": "nyc npm run test", 16 | "codecov": "npm run coverage && nyc report --reporter=lcov", 17 | "prepare": "tsc --sourceMap false && npm run bundle", 18 | "bundle": "npm run bundle:dev && npm run bundle:prod", 19 | "bundle:prod": "webpack --env.NODE_ENV=production", 20 | "bundle:dev": "webpack --env.NODE_ENV=development" 21 | }, 22 | "nyc": { 23 | "include": [ 24 | "lib/**/*.ts", 25 | "lib/**/*.js" 26 | ], 27 | "extension": [ 28 | ".ts" 29 | ], 30 | "require": [ 31 | "ts-node/register" 32 | ], 33 | "reporter": [ 34 | "text", 35 | "html" 36 | ], 37 | "sourceMap": true, 38 | "instrument": true 39 | }, 40 | "repository": { 41 | "type": "git", 42 | "url": "ssh://git@github.com:heremaps/here-data-sdk-typescript.git", 43 | "directory": "@here/olp-sdk-dataservice-api" 44 | }, 45 | "author": { 46 | "name": "HERE Europe B.V.", 47 | "url": "https://here.com" 48 | }, 49 | "license": "Apache-2.0", 50 | "dependencies": {}, 51 | "devDependencies": { 52 | "@types/chai": "^4.2.7", 53 | "@types/mocha": "^5.2.7", 54 | "@types/sinon-chai": "^3.2.3", 55 | "@types/sinon": "7.0.3", 56 | "chai": "^4.2.0", 57 | "husky": "^3.1.0", 58 | "lint-staged": "^9.5.0", 59 | "mocha": "^6.2.2", 60 | "sinon-chai": "^3.4.0", 61 | "sinon": "7.4.2", 62 | "nyc": "^15.0.0", 63 | "prettier": "^1.19.1", 64 | "ts-node": "10.9.2", 65 | "source-map-support": "^0.5.16", 66 | "tslint": "^6.1.3", 67 | "tslint-config-prettier": "^1.18.0", 68 | "typescript": "4.0.3", 69 | "webpack": "^4.46.0", 70 | "webpack-cli": "^3.3.10", 71 | "typedoc": "^0.22.13", 72 | "terser-webpack-plugin": "^1.4.5" 73 | }, 74 | "engines": { 75 | "node": ">= 18.0.0" 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/client/CancelBatchRequest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Cancels a versioned batch operation. 22 | */ 23 | export class CancelBatchRequest { 24 | private publicationId?: string; 25 | private billingTag?: string; 26 | 27 | /** 28 | * Sets the ID of the publication that you want to cancel. 29 | * 30 | * @param id The ID of the publication. 31 | * 32 | * @returns A reference to this object. 33 | */ 34 | public withPublicationId(id: string): CancelBatchRequest { 35 | this.publicationId = id; 36 | return this; 37 | } 38 | 39 | /** 40 | * Sets the billing tag. 41 | * 42 | * @param tag The free-form tag that is used for grouping billing records together. 43 | * If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A–Za–z0–9]. 44 | * 45 | * @returns A reference to this object. 46 | */ 47 | public withBillingTag(tag: string): CancelBatchRequest { 48 | this.billingTag = tag; 49 | return this; 50 | } 51 | 52 | /** 53 | * Gets the ID of the publication that you want to cancel. 54 | * 55 | * @returns The ID of the publication. 56 | */ 57 | public getPublicationId(): string | undefined { 58 | return this.publicationId; 59 | } 60 | 61 | /** 62 | * Gets the billing tag (if it was set). 63 | * 64 | * @return The billing tag or `undefined` if it was not. 65 | */ 66 | public getBillingTag(): string | undefined { 67 | return this.billingTag; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/client/CompleteBatchRequest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Completes a publication. 22 | */ 23 | export class CompleteBatchRequest { 24 | private publicationId?: string; 25 | private billingTag?: string; 26 | 27 | /** 28 | * Sets the ID of the publication that you want to submit. 29 | * 30 | * @param id The ID of the publication to submit. 31 | * 32 | * @returns A reference to this object. 33 | */ 34 | public withPublicationId(id: string): CompleteBatchRequest { 35 | this.publicationId = id; 36 | return this; 37 | } 38 | 39 | /** 40 | * Sets the billing tag. 41 | * 42 | * @param tag The free-form tag that is used for grouping billing records together. 43 | * If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A–Za–z0–9]. 44 | * 45 | * @returns A reference to this object. 46 | */ 47 | public withBillingTag(tag: string): CompleteBatchRequest { 48 | this.billingTag = tag; 49 | return this; 50 | } 51 | 52 | /** 53 | * Gets the ID of the publication that you want to submit. 54 | * 55 | * @returns The publication ID. 56 | */ 57 | public getPublicationId(): string | undefined { 58 | return this.publicationId; 59 | } 60 | 61 | /** 62 | * Gets the billing tag (if it was set). 63 | * 64 | * @return The billing tag or `undefined` if it was not set. 65 | */ 66 | public getBillingTag(): string | undefined { 67 | return this.billingTag; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /tests/integration/api-breaks/KeyValueCache.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | 23 | import { KeyValueCache } from "@here/olp-sdk-core"; 24 | 25 | chai.use(sinonChai); 26 | 27 | const assert = chai.assert; 28 | const expect = chai.expect; 29 | 30 | describe("KeyValueCache", function() { 31 | it("Shoud be initialized withouth arguments", async function() { 32 | const testKeyValueCache = new KeyValueCache(); 33 | assert.isDefined(testKeyValueCache); 34 | 35 | expect(testKeyValueCache).to.be.instanceOf(KeyValueCache); 36 | assert.isDefined(testKeyValueCache.put); 37 | assert.isDefined(testKeyValueCache.get); 38 | assert.isDefined(testKeyValueCache.remove); 39 | }); 40 | 41 | it("Test put method with params", async function() { 42 | const testKeyValueCache = new KeyValueCache(); 43 | 44 | const response = testKeyValueCache.put("test-key", "test"); 45 | assert.isTrue(response); 46 | }); 47 | 48 | it("Test get method with params", async function() { 49 | const testKeyValueCache = new KeyValueCache(); 50 | testKeyValueCache.put("test-key", "test"); 51 | 52 | const response = testKeyValueCache.get("test-key"); 53 | assert.isDefined(response); 54 | }); 55 | 56 | it("Test remove method with params", async function() { 57 | const testKeyValueCache = new KeyValueCache(); 58 | testKeyValueCache.put("test-key", "test"); 59 | testKeyValueCache.put("test-key2", "test"); 60 | 61 | const response = testKeyValueCache.remove("test-key"); 62 | assert.isTrue(response); 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /@here/olp-sdk-authentication/lib/loadCredentialsFromFile.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as PropertiesReader from "properties-reader"; 21 | import { AuthCredentials } from "./UserAuth"; 22 | 23 | /** 24 | * Parses the **credentials.properties** file from the 25 | * [HERE platform](https://developer.here.com/documentation/access-control/user-guide/topics/get-credentials.html) 26 | * and retrieves an object with user credentials. 27 | * 28 | * @param path The path to the **credentials.properties** file. 29 | * @throws An error if the parsing is not successful. 30 | * @return The object with the access key ID and access key secret. 31 | */ 32 | export function loadCredentialsFromFile(path: string): AuthCredentials { 33 | const config = PropertiesReader(path); 34 | const configAccessKeyIdValueName = "here.access.key.id"; 35 | const configAccessKeySecretValueName = "here.access.key.secret"; 36 | 37 | const parseValueFromConfig = ( 38 | value: string | number | boolean | null, 39 | valueName: string 40 | ): string => { 41 | if (!value) { 42 | throw new Error( 43 | `Error parsing value ${valueName} from configuration` 44 | ); 45 | } 46 | 47 | return value.toString(); 48 | }; 49 | 50 | return { 51 | accessKeyId: parseValueFromConfig( 52 | config.get(configAccessKeyIdValueName), 53 | configAccessKeyIdValueName 54 | ), 55 | accessKeySecret: parseValueFromConfig( 56 | config.get(configAccessKeySecretValueName), 57 | configAccessKeySecretValueName 58 | ) 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/StartBatchRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { StartBatchRequest } from "@here/olp-sdk-dataservice-write"; 23 | 24 | chai.use(sinonChai); 25 | 26 | const assert = chai.assert; 27 | const expect = chai.expect; 28 | 29 | describe("StartBatchRequest", function() { 30 | it("Should initialize", function() { 31 | const request = new StartBatchRequest(); 32 | 33 | assert.isDefined(request); 34 | expect(request).be.instanceOf(StartBatchRequest); 35 | }); 36 | 37 | it("Should set and get parameters", function() { 38 | const mockedLayers = ["layer-0", "layer-1", "layer-2"]; 39 | const mockedBillingTag = "mocked-billing-tag"; 40 | const mockedVersionDependencies = [ 41 | { 42 | direct: true, 43 | hrn: "mocked-hrn-0", 44 | version: 0 45 | }, 46 | { 47 | direct: false, 48 | hrn: "mocked-hrn-1", 49 | version: 123 50 | } 51 | ]; 52 | 53 | const request = new StartBatchRequest() 54 | .withLayers(mockedLayers) 55 | .withVersionDependencies(mockedVersionDependencies) 56 | .withBillingTag(mockedBillingTag); 57 | 58 | expect(request.getLayers()).to.be.equal(mockedLayers); 59 | expect(request.getBillingTag()).to.be.equal(mockedBillingTag); 60 | expect(request.getVersionDependencies()).to.be.equal( 61 | mockedVersionDependencies 62 | ); 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /examples/nodejs-example/options.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import yargs from "yargs"; 21 | const homedir = require("os").homedir(); 22 | const path = require("path"); 23 | 24 | export const options = yargs 25 | .usage(`Usage: -c -l ...optional params`) 26 | .option("creds", { 27 | alias: "credentials", 28 | describe: "Path to your credentials file", 29 | type: "string", 30 | default: path.join(homedir, ".here", "credentials.properties") 31 | }) 32 | .option("c", { 33 | alias: "catalog", 34 | describe: "The catalog HRN", 35 | type: "string", 36 | demandOption: true 37 | }) 38 | .option("l", { 39 | alias: "layer", 40 | describe: "The layer ID", 41 | type: "string", 42 | demandOption: true 43 | }) 44 | .option("o", { 45 | alias: "output", 46 | describe: "Output folder for saving downloaded files", 47 | type: "string", 48 | default: process.cwd() 49 | }) 50 | .option("p", { 51 | alias: "partitions", 52 | describe: "Partition IDs, separated by comma.", 53 | type: "string" 54 | }) 55 | .option("pf", { 56 | alias: "partitionsFile", 57 | describe: 58 | "Path of a file which contains Partition IDs. One Partition ID per line", 59 | type: "string" 60 | }) 61 | .option("q", { 62 | alias: "quadkey", 63 | describe: 64 | "For HEREtile partitioning, specify Partition by quad key in format row,column,level", 65 | type: "string" 66 | }) 67 | .option("v", { 68 | alias: "catalogVersion", 69 | describe: 70 | "The version of catalog to use. The latest version is used by default", 71 | type: "number" 72 | }).argv; 73 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/lib/client/IndexQueryRequest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Prepares information for calls to get partitions metadata from the platform Index Service. 22 | */ 23 | export class IndexQueryRequest { 24 | private queryString?: string; 25 | private isHugeResponse?: boolean; 26 | 27 | /** 28 | * @param query An RSQL query to use to retrieve partitions that match the query. 29 | * The query must use the indexing attributes defined in the index layer. 30 | * @returns The updated [[IndexQueryRequest]] instance that you can use to chain methods. 31 | */ 32 | public withQueryString(query?: string): IndexQueryRequest { 33 | this.queryString = query; 34 | return this; 35 | } 36 | 37 | /** 38 | * A setter for the provided isHugeResponse parameter. 39 | * 40 | * @param isHuge The boolean parameter shows is the query huge. 41 | * 42 | * @returns The updated [[IndexQueryRequest]] instance that you can use to chain methods. 43 | */ 44 | public withHugeResponse(isHuge: boolean): IndexQueryRequest { 45 | this.isHugeResponse = isHuge; 46 | return this; 47 | } 48 | 49 | /** 50 | * Gets a queryString for the request. 51 | * 52 | * @return The queryString string. 53 | */ 54 | public getQueryString(): string | undefined { 55 | return this.queryString; 56 | } 57 | 58 | /** 59 | * Gets isHugeResponse property for the request. 60 | * 61 | * @return The `isHugeResponse` boolean. 62 | */ 63 | public getHugeResponse(): boolean | undefined { 64 | return this.isHugeResponse; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/test/unit/IndexQueryRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import sinon = require("sinon"); 21 | import * as chai from "chai"; 22 | import sinonChai = require("sinon-chai"); 23 | 24 | import { IndexQueryRequest } from "../../lib"; 25 | 26 | chai.use(sinonChai); 27 | 28 | const assert = chai.assert; 29 | const expect = chai.expect; 30 | 31 | describe("IndexQueryRequest", function() { 32 | const mockedQuery = "ingestionTime>1552341200000;"; 33 | 34 | it("Should initialize", function() { 35 | const indexQueryRequest = new IndexQueryRequest(); 36 | 37 | assert.isDefined(indexQueryRequest); 38 | expect(indexQueryRequest).be.instanceOf(IndexQueryRequest); 39 | }); 40 | 41 | it("Should set parameters", function() { 42 | const indexQueryRequest = new IndexQueryRequest(); 43 | const indexQueryRequestWithHuge = indexQueryRequest.withHugeResponse( 44 | true 45 | ); 46 | const indexQueryRequestWithQuery = indexQueryRequest.withQueryString( 47 | mockedQuery 48 | ); 49 | 50 | expect(indexQueryRequestWithHuge.getHugeResponse()).to.be.equal(true); 51 | expect(indexQueryRequestWithQuery.getQueryString()).to.be.equal( 52 | mockedQuery 53 | ); 54 | }); 55 | 56 | it("Should set parameters with chain", function() { 57 | const indexQueryRequest = new IndexQueryRequest() 58 | .withHugeResponse(false) 59 | .withQueryString(mockedQuery); 60 | 61 | expect(indexQueryRequest.getHugeResponse()).to.be.equal(false); 62 | expect(indexQueryRequest.getQueryString()).to.be.equal(mockedQuery); 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/client/GetBatchRequest.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | /** 21 | * Gets publication details. 22 | */ 23 | export class GetBatchRequest { 24 | private publicationId?: string; 25 | private billingTag?: string; 26 | 27 | /** 28 | * Sets the ID of the publication to retrieve the publication details. 29 | * 30 | * @param id The ID of the publication details of which you want to retrieve. 31 | * 32 | * @returns A reference to this object. 33 | */ 34 | public withPublicationId(id: string): GetBatchRequest { 35 | this.publicationId = id; 36 | return this; 37 | } 38 | 39 | /** 40 | * Sets the billing tag. 41 | * 42 | * @param tag The free-form tag that is used for grouping billing records together. 43 | * If supplied, it must be 4–16 characters long and contain only alphanumeric ASCII characters [A–Za–z0–9]. 44 | * 45 | * @returns A reference to this object. 46 | */ 47 | public withBillingTag(tag: string): GetBatchRequest { 48 | this.billingTag = tag; 49 | return this; 50 | } 51 | 52 | /** 53 | * Gets the ID of the publication to retrieve the publication details. 54 | * 55 | * @returns The ID of the publication details of which you want to retrieve. 56 | */ 57 | public getPublicationId(): string | undefined { 58 | return this.publicationId; 59 | } 60 | 61 | /** 62 | * Gets the billing tag (if it was set). 63 | * 64 | * @return The billing tag or `undefined` if it was not set. 65 | */ 66 | public getBillingTag(): string | undefined { 67 | return this.billingTag; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /scripts/publish-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright (C) 2019-2022 HERE Europe B.V. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # SPDX-License-Identifier: Apache-2.0 18 | # License-Filename: LICENSE 19 | 20 | # Simple script that bundles the publishing of packages, 21 | # to be run from GitHub Actions 22 | 23 | echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/.npmrc 24 | 25 | yarn 26 | 27 | while [[ $# -gt 0 ]]; do 28 | key="$1" 29 | case "$key" in 30 | -fetch) 31 | # olp-sdk-fetch publish 32 | cd @here/olp-sdk-fetch && npm install && npm publish && cd - 33 | ;; 34 | -core) 35 | # olp-sdk-core publish 36 | cd @here/olp-sdk-core && npm install && npm publish && cd - 37 | ;; 38 | -api) 39 | # olp-sdk-dataservice-api publish 40 | cd @here/olp-sdk-dataservice-api && npm install && npm publish && cd - 41 | ;; 42 | -auth) 43 | # olp-sdk-authentication publish 44 | cd @here/olp-sdk-authentication && npm install && npm publish && cd - 45 | ;; 46 | -read) 47 | # olp-sdk-dataservice-read publish 48 | cd @here/olp-sdk-dataservice-read && npm install && npm publish && cd - 49 | ;; 50 | -write) 51 | # olp-sdk-dataservice-write publish 52 | cd @here/olp-sdk-dataservice-write && npm install && npm publish && cd - 53 | ;; 54 | -verify) 55 | # verify all published 56 | echo 'Publish verification...' 57 | yarn 58 | yarn bootstrap 59 | npm run --silent build 60 | npm run --silent http-server-testing-bundles & npm run --silent test-published-bundles 61 | echo 'Publish verification done! ' 62 | ;; 63 | esac 64 | # Shift after checking all the cases to get the next option 65 | shift 66 | done 67 | echo 'Publish done!' -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@here/olp-sdk-ts", 3 | "version": "2.0.0", 4 | "description": "HERE OLP SDK for TypeScript", 5 | "author": { 6 | "name": "HERE Europe B.V.", 7 | "url": "https://here.com" 8 | }, 9 | "license": "Apache-2.0", 10 | "private": true, 11 | "workspaces": [ 12 | "@here/*" 13 | ], 14 | "nyc": { 15 | "include": [ 16 | "@here/**/*.ts", 17 | "@here/**/*.js" 18 | ], 19 | "extension": [ 20 | ".ts" 21 | ], 22 | "require": [ 23 | "ts-node/register" 24 | ], 25 | "reporter": [ 26 | "text", 27 | "html" 28 | ], 29 | "sourceMap": true, 30 | "instrument": true 31 | }, 32 | "husky": { 33 | "hooks": { 34 | "pre-commit": "lint-staged" 35 | } 36 | }, 37 | "lint-staged": { 38 | "*.ts": [ 39 | "prettier --write", 40 | "git add" 41 | ] 42 | }, 43 | "scripts": { 44 | "bootstrap": "lerna bootstrap --use-workspaces", 45 | "build": "lerna run build", 46 | "test": "lerna run test", 47 | "http-server-testing-bundles": "serve -l tcp://localhost:8080 tests/integration/bundles/umd/static", 48 | "test-published-bundles": "cd tests/integration/bundles/umd && tsc && cd - && mocha --timeout 5000 tests/integration/bundles/umd/olp-sdk-published.test.js", 49 | "test-generated-bundles": "cd tests/integration/bundles/umd && tsc && cd - && mocha --timeout 5000 tests/integration/bundles/umd/olp-sdk-generated.test.js", 50 | "api-breaks-test": "nyc mocha --opts ./tests/integration/api-breaks/mocha.opts", 51 | "integration-test": "nyc mocha --opts ./tests/integration/mocha.opts", 52 | "functional-test": "nyc mocha --opts ./tests/functional/mocha.opts", 53 | "coverage": "lerna run coverage", 54 | "codecov": "lerna run codecov", 55 | "lint": "lerna run lint", 56 | "bundle": "lerna run bundle", 57 | "bundle:dev": "lerna run bundle:dev", 58 | "bundle:prod": "lerna run bundle:prod", 59 | "typedoc": "npx typedoc --options typedoc.json" 60 | }, 61 | "devDependencies": { 62 | "@types/node": "18.7.14", 63 | "lerna": "^4.0.0", 64 | "typescript": "4.0.3", 65 | "codecov": "3.7.2", 66 | "mockserver-node": "^5.12.0", 67 | "mockserver-client": "^5.12.0", 68 | "ts-node": "10.9.2", 69 | "puppeteer": "^13.1.3", 70 | "puppeteer-to-istanbul": "^1.4.0", 71 | "nyc": "^15.0.0", 72 | "mocha": "^7.1.1", 73 | "serve": "^13.0.2" 74 | } 75 | } -------------------------------------------------------------------------------- /@here/olp-sdk-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@here/olp-sdk-core", 3 | "version": "2.0.0", 4 | "description": "Core features of the HERE Data Platform", 5 | "main": "index.js", 6 | "browser": "index.web.js", 7 | "typings": "index.web", 8 | "directories": { 9 | "test": "test", 10 | "lib": "lib" 11 | }, 12 | "scripts": { 13 | "build": "tsc", 14 | "lint": "tslint -c tslint.json -p tsconfig.json", 15 | "test": "tsc -p ./test/tsconfig.json && mocha", 16 | "coverage": "nyc npm run test", 17 | "codecov": "npm run coverage && nyc report --reporter=lcov", 18 | "prepare": "tsc --sourceMap false && npm run bundle", 19 | "bundle": "npm run bundle:dev && npm run bundle:prod", 20 | "bundle:prod": "webpack --env.NODE_ENV=production", 21 | "bundle:dev": "webpack --env.NODE_ENV=development" 22 | }, 23 | "nyc": { 24 | "include": [ 25 | "lib/**/*.ts", 26 | "lib/**/*.js" 27 | ], 28 | "extension": [ 29 | ".ts" 30 | ], 31 | "require": [ 32 | "ts-node/register" 33 | ], 34 | "reporter": [ 35 | "text", 36 | "html" 37 | ], 38 | "sourceMap": true, 39 | "instrument": true 40 | }, 41 | "repository": { 42 | "type": "git", 43 | "url": "ssh://git@github.com:heremaps/here-data-sdk-typescript.git", 44 | "directory": "@here/olp-sdk-core" 45 | }, 46 | "author": { 47 | "name": "HERE Europe B.V.", 48 | "url": "https://here.com" 49 | }, 50 | "license": "Apache-2.0", 51 | "dependencies": { 52 | "@here/olp-sdk-fetch": "^2.0.0", 53 | "@here/olp-sdk-dataservice-api": "^2.0.0" 54 | }, 55 | "devDependencies": { 56 | "@types/chai": "^4.2.7", 57 | "@types/mocha": "^5.2.7", 58 | "@types/node": "18.7.14", 59 | "@types/sinon": "7.0.3", 60 | "@types/sinon-chai": "^3.2.3", 61 | "chai": "^4.2.0", 62 | "glob": "^7.1.6", 63 | "husky": "^3.1.0", 64 | "lint-staged": "^9.5.0", 65 | "mocha": "^6.2.2", 66 | "nyc": "^15.0.0", 67 | "prettier": "^1.19.1", 68 | "sinon": "7.4.2", 69 | "sinon-chai": "^3.4.0", 70 | "source-map-support": "^0.5.16", 71 | "ts-node": "10.9.2", 72 | "tslint": "^6.1.3", 73 | "tslint-config-prettier": "^1.18.0", 74 | "typedoc": "^0.22.13", 75 | "typescript": "4.0.3", 76 | "webpack": "^4.46.0", 77 | "webpack-cli": "^3.3.10", 78 | "terser-webpack-plugin": "^1.4.5" 79 | }, 80 | "engines": { 81 | "node": ">= 18.0.0" 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /@here/olp-sdk-core/lib/utils/getDataSizeUtil.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | const BYTES_IN_NUMBER = 8; 21 | const BYTES_IN_BOOLEAN = 4; 22 | 23 | /** 24 | * Calculate memory size of javascript object, it is not an accurate value 25 | * @param data. The string or number or boolean or array or object. 26 | * @returns The size of value in bytes. 27 | */ 28 | export function getDataSize(data: string | number | boolean | object) { 29 | let bytes = 0; 30 | 31 | function sizeOf(obj: any) { 32 | if (obj !== null && obj !== undefined) { 33 | switch (typeof obj) { 34 | case "number": 35 | bytes += BYTES_IN_NUMBER; 36 | break; 37 | case "string": 38 | bytes += obj.length * 2; 39 | break; 40 | case "boolean": 41 | bytes += BYTES_IN_BOOLEAN; 42 | break; 43 | case "object": 44 | const objClass = Object.prototype.toString.call(obj); 45 | if ( 46 | objClass === "[object Object]" || 47 | objClass === "[object Array]" 48 | ) { 49 | for (const key in obj) { 50 | if (!obj.hasOwnProperty(key)) { 51 | continue; 52 | } 53 | sizeOf(obj[key]); 54 | } 55 | } else { 56 | bytes += obj.toString().length * 2; 57 | } 58 | break; 59 | } 60 | } 61 | return bytes; 62 | } 63 | 64 | return sizeOf(data); 65 | } 66 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/lib/utils/multipartupload-internal/NodeFileData.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import { BlobData } from "@here/olp-sdk-dataservice-write"; 21 | 22 | // @ts-ignore disable typechecking for this line 23 | import { fs } from "@here/olp-sdk-core"; 24 | 25 | /** 26 | * @internal 27 | * Implementation of reading bytes from file by filepath 28 | * in Node.js. 29 | */ 30 | export class NodeFileData implements BlobData { 31 | private readonly fileHandle: fs.promises.FileHandle; 32 | private readonly fileStats: fs.Stats; 33 | 34 | constructor(opts: { 35 | fileHandle: fs.promises.FileHandle; 36 | fileStats: fs.Stats; 37 | }) { 38 | this.fileHandle = opts.fileHandle; 39 | this.fileStats = opts.fileStats; 40 | } 41 | 42 | static async fromPath(filePath: string): Promise { 43 | const fileHandle = await fs.promises.open(filePath, "r"); 44 | const fileStats = await fileHandle.stat(); 45 | return new NodeFileData({ fileStats, fileHandle }); 46 | } 47 | 48 | async readBytes(offset: number, count: number): Promise { 49 | const fileSize = this.size(); 50 | 51 | const bufferLength = 52 | offset + count > fileSize ? fileSize - offset : count; 53 | 54 | const buffer = Buffer.alloc(bufferLength); 55 | const chunk = await this.fileHandle.read( 56 | buffer, 57 | 0, 58 | bufferLength, 59 | offset 60 | ); 61 | return chunk.buffer; 62 | } 63 | 64 | size(): number { 65 | return this.fileStats.size; 66 | } 67 | 68 | async finally() { 69 | await this.fileHandle.close(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-write/test/unit/UploadBlobRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import * as chai from "chai"; 21 | import sinonChai = require("sinon-chai"); 22 | import { UploadBlobRequest } from "@here/olp-sdk-dataservice-write"; 23 | 24 | chai.use(sinonChai); 25 | 26 | const assert = chai.assert; 27 | const expect = chai.expect; 28 | 29 | describe("UploadBlobRequest", function() { 30 | it("Should initialize", function() { 31 | const request = new UploadBlobRequest(); 32 | 33 | assert.isDefined(request); 34 | expect(request).be.instanceOf(UploadBlobRequest); 35 | }); 36 | 37 | it("Should set and get parameters", function() { 38 | const mockedLayerId = "mocked-layer-id"; 39 | const mockedBillingTag = "mocked-billing-tag"; 40 | const mockedContentType = "plain/text"; 41 | const mockedData = Buffer.alloc(10); 42 | const mockedDatahandle = "mocked-datahandle"; 43 | const mockedContentEncoding = "gzip"; 44 | 45 | const request = new UploadBlobRequest() 46 | .withDataHandle(mockedDatahandle) 47 | .withLayerId(mockedLayerId) 48 | .withData(mockedData) 49 | .withContentType(mockedContentType) 50 | .withContentEncoding(mockedContentEncoding) 51 | .withBillingTag(mockedBillingTag); 52 | 53 | expect(request.getDataHandle()).to.be.equal(mockedDatahandle); 54 | expect(request.getLayerId()).to.be.equal(mockedLayerId); 55 | expect(request.getData()).to.be.equal(mockedData); 56 | expect(request.getContentType()).to.be.equal(mockedContentType); 57 | expect(request.getContentEncoding()).to.be.equal(mockedContentEncoding); 58 | expect(request.getBillingTag()).to.be.equal(mockedBillingTag); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /@here/olp-sdk-dataservice-read/test/unit/SchemaRequest.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 HERE Europe B.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * License-Filename: LICENSE 18 | */ 19 | 20 | import sinon = require("sinon"); 21 | import * as chai from "chai"; 22 | import sinonChai = require("sinon-chai"); 23 | 24 | import { SchemaRequest } from "../../lib"; 25 | 26 | chai.use(sinonChai); 27 | 28 | const assert = chai.assert; 29 | const expect = chai.expect; 30 | 31 | describe("SchemaRequest", function() { 32 | const billingTag = "billingTag"; 33 | const mockedVersion = { 34 | id: "42", 35 | url: "http://fake.url" 36 | }; 37 | 38 | it("Should initialize", function() { 39 | const schemaRequest = new SchemaRequest(); 40 | 41 | assert.isDefined(schemaRequest); 42 | expect(schemaRequest).be.instanceOf(SchemaRequest); 43 | }); 44 | 45 | it("Should set parameters", function() { 46 | const schemaRequest = new SchemaRequest(); 47 | 48 | const schemaRequestWithVariant = schemaRequest.withVariant( 49 | mockedVersion 50 | ); 51 | const schemaRequestWithBilTag = schemaRequest.withBillingTag( 52 | billingTag 53 | ); 54 | 55 | assert.isDefined(schemaRequestWithVariant); 56 | assert.isDefined(schemaRequestWithBilTag); 57 | expect(schemaRequestWithVariant.getVariant()).to.be.equal( 58 | mockedVersion 59 | ); 60 | expect(schemaRequestWithBilTag.getBillingTag()).to.be.equal(billingTag); 61 | }); 62 | 63 | it("Should set parameters with chain", function() { 64 | const schemaRequest = new SchemaRequest() 65 | .withVariant(mockedVersion) 66 | .withBillingTag(billingTag); 67 | 68 | expect(schemaRequest.getVariant()).to.be.equal(mockedVersion); 69 | expect(schemaRequest.getBillingTag()).to.be.equal(billingTag); 70 | }); 71 | }); 72 | --------------------------------------------------------------------------------