@basemaps/shared 6.9.1 → 6.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/build/__test__/api.path.test.js +57 -60
  3. package/build/__test__/api.test.js +29 -32
  4. package/build/__test__/env.test.js +9 -12
  5. package/build/__test__/util.test.js +36 -39
  6. package/build/__test__/vdom.parse.test.js +18 -21
  7. package/build/__test__/vdom.test.js +29 -32
  8. package/build/api.js +6 -10
  9. package/build/api.path.d.ts.map +1 -1
  10. package/build/api.path.js +15 -23
  11. package/build/aws/aws.dynamo.table.d.ts.map +1 -1
  12. package/build/aws/aws.dynamo.table.js +1 -2
  13. package/build/cli/__test__/git.tag.test.js +7 -10
  14. package/build/cli/api.key.js +4 -9
  15. package/build/cli/git.tag.js +4 -8
  16. package/build/composite.error.d.ts +1 -7
  17. package/build/composite.error.d.ts.map +1 -1
  18. package/build/composite.error.js +1 -13
  19. package/build/const.d.ts.map +1 -1
  20. package/build/const.js +3 -6
  21. package/build/file/__test__/file.local.test.js +33 -22
  22. package/build/file/__test__/file.operator.test.helper.d.ts.map +1 -1
  23. package/build/file/__test__/file.operator.test.helper.js +17 -21
  24. package/build/file/file.config.d.ts.map +1 -1
  25. package/build/file/file.config.js +2 -7
  26. package/build/file/index.d.ts +3 -3
  27. package/build/file/index.d.ts.map +1 -1
  28. package/build/file/index.js +19 -23
  29. package/build/index.d.ts +12 -14
  30. package/build/index.d.ts.map +1 -1
  31. package/build/index.js +18 -36
  32. package/build/log.d.ts +0 -3
  33. package/build/log.d.ts.map +1 -1
  34. package/build/log.js +6 -16
  35. package/build/logger.fatal.error.d.ts.map +1 -1
  36. package/build/logger.fatal.error.js +1 -5
  37. package/build/proj/__test__/projection.test.js +30 -33
  38. package/build/proj/__test__/projection.tile.matrix.set.test.js +115 -118
  39. package/build/proj/__test__/test.util.d.ts.map +1 -1
  40. package/build/proj/__test__/test.util.js +10 -17
  41. package/build/proj/citm2000.js +1 -4
  42. package/build/proj/nztm2000.js +1 -4
  43. package/build/proj/projection.d.ts +33 -33
  44. package/build/proj/projection.d.ts.map +1 -1
  45. package/build/proj/projection.js +47 -52
  46. package/build/proj/tile.set.name.d.ts.map +1 -1
  47. package/build/proj/tile.set.name.js +3 -7
  48. package/build/util.d.ts.map +1 -1
  49. package/build/util.js +5 -13
  50. package/build/vdom.d.ts.map +1 -1
  51. package/build/vdom.js +4 -11
  52. package/build/vdom.parse.d.ts +1 -1
  53. package/build/vdom.parse.d.ts.map +1 -1
  54. package/build/vdom.parse.js +5 -10
  55. package/package.json +12 -9
  56. package/build/__test__/aws.init.test.d.ts +0 -2
  57. package/build/__test__/aws.init.test.d.ts.map +0 -1
  58. package/build/__test__/aws.init.test.js +0 -9
  59. package/build/aws/api.key.table.d.ts +0 -29
  60. package/build/aws/api.key.table.d.ts.map +0 -1
  61. package/build/aws/api.key.table.js +0 -38
  62. package/build/aws/credentials.d.ts +0 -21
  63. package/build/aws/credentials.d.ts.map +0 -1
  64. package/build/aws/credentials.js +0 -42
  65. package/build/aws/index.d.ts +0 -16
  66. package/build/aws/index.d.ts.map +0 -1
  67. package/build/aws/index.js +0 -38
  68. package/build/aws/object.cache.d.ts +0 -6
  69. package/build/aws/object.cache.d.ts.map +0 -1
  70. package/build/aws/object.cache.js +0 -17
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.S3Cache = exports.CredentialsCache = void 0;
4
- const tslib_1 = require("tslib");
5
- const object_cache_1 = require("./object.cache");
6
- const os_1 = require("os");
7
- const const_1 = require("../const");
8
- const s3_1 = tslib_1.__importDefault(require("aws-sdk/clients/s3"));
9
- /**
10
- * Nasty Hack
11
- *
12
- * to prevent type pollution we do not want to include the entire aws-sdk
13
- * This bypasses the type checker but still inits the AWS SDK so we have access to credentials
14
- */
15
- // eslint-disable-next-line @typescript-eslint/no-var-requires
16
- const AWS = require('aws-sdk');
17
- const OneHourSeconds = 60 * 60;
18
- /**
19
- * Credentials need to be cached or a separate assume role will be called for each individual
20
- * instance of the credential chain
21
- */
22
- class CredentialObjectCache extends object_cache_1.ObjectCache {
23
- create(opts) {
24
- return new AWS.ChainableTemporaryCredentials({
25
- params: {
26
- RoleArn: opts.roleArn,
27
- ExternalId: opts.externalId,
28
- RoleSessionName: `bm-${os_1.hostname().substr(0, 32)}-${Date.now()}`,
29
- DurationSeconds: const_1.Env.getNumber(const_1.Env.AwsRoleDurationHours, 8) * OneHourSeconds,
30
- },
31
- masterCredentials: AWS.config.credentials,
32
- });
33
- }
34
- }
35
- exports.CredentialsCache = new CredentialObjectCache();
36
- class S3ObjectCache extends object_cache_1.ObjectCache {
37
- create(opt) {
38
- const credentials = exports.CredentialsCache.getOrMake(opt.roleArn, opt);
39
- return new s3_1.default({ credentials });
40
- }
41
- }
42
- exports.S3Cache = new S3ObjectCache();
@@ -1,16 +0,0 @@
1
- import S3 from 'aws-sdk/clients/s3';
2
- import { ChainableTemporaryCredentials } from 'aws-sdk/lib/credentials/chainable_temporary_credentials';
3
- import { ApiKeyTable } from './api.key.table';
4
- import { StsAssumeRoleConfig } from './credentials';
5
- export declare const Aws: {
6
- s3: S3;
7
- credentials: {
8
- /**
9
- * Get a s3 that is bound to a specific role
10
- */
11
- getS3ForRole(opts?: StsAssumeRoleConfig | undefined): S3;
12
- getCredentialsForRole(roleArn: string, externalId?: string | undefined): ChainableTemporaryCredentials;
13
- };
14
- apiKey: ApiKeyTable;
15
- };
16
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aws/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,yDAAyD,CAAC;AAExG,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAA6B,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG/E,eAAO,MAAM,GAAG;;;QAGR;;WAEG;8DACuC,EAAE;uCAIb,MAAM,oCAAwB,6BAA6B;;;CAKjG,CAAC"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Aws = void 0;
4
- const tslib_1 = require("tslib");
5
- /**
6
- * AWS by default does not reuse http connections this causes requests to the same service
7
- * (S3, Dynamo, etc) to open a new HTTPS connection for every request the TLS handshake adds
8
- * a lot of delay to every request (50+ms)
9
- *
10
- * This logic caches open TLS connections so that they can be reused
11
- *
12
- * **This needs to happen before anything tries to use the AWS SDK**
13
- */
14
- process.env['AWS_NODEJS_CONNECTION_REUSE_ENABLED'] = '1';
15
- const config_1 = require("@basemaps/config");
16
- const s3_1 = tslib_1.__importDefault(require("aws-sdk/clients/s3"));
17
- const const_1 = require("../const");
18
- const api_key_table_1 = require("./api.key.table");
19
- const credentials_1 = require("./credentials");
20
- const s3 = new s3_1.default();
21
- exports.Aws = {
22
- s3,
23
- credentials: {
24
- /**
25
- * Get a s3 that is bound to a specific role
26
- */
27
- getS3ForRole(opts) {
28
- if (opts == null)
29
- return s3;
30
- return credentials_1.S3Cache.getOrMake(opts.roleArn, opts);
31
- },
32
- getCredentialsForRole(roleArn, externalId) {
33
- return credentials_1.CredentialsCache.getOrMake(roleArn, { roleArn, externalId });
34
- },
35
- },
36
- apiKey: new api_key_table_1.ApiKeyTable(),
37
- };
38
- config_1.Config.setConfigProvider(new config_1.ConfigProviderDynamo(const_1.Const.TileMetadata.TableName));
@@ -1,6 +0,0 @@
1
- export declare abstract class ObjectCache<T, K> {
2
- map: Map<string, T>;
3
- getOrMake(key: string, args: K): T;
4
- abstract create(args: K): T;
5
- }
6
- //# sourceMappingURL=object.cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.cache.d.ts","sourceRoot":"","sources":["../../src/aws/object.cache.ts"],"names":[],"mappings":"AAAA,8BAAsB,WAAW,CAAC,CAAC,EAAE,CAAC;IAClC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAa;IAEhC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC;IASlC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC;CAC9B"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectCache = void 0;
4
- class ObjectCache {
5
- constructor() {
6
- this.map = new Map();
7
- }
8
- getOrMake(key, args) {
9
- let existing = this.map.get(key);
10
- if (existing == null) {
11
- existing = this.create(args);
12
- this.map.set(key, existing);
13
- }
14
- return existing;
15
- }
16
- }
17
- exports.ObjectCache = ObjectCache;