cloudstructs 0.4.0 → 0.4.4

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 (173) hide show
  1. package/.jsii +3 -3
  2. package/assets/codecommit-mirror/docker/mirror.sh +0 -0
  3. package/changelog.md +2 -0
  4. package/lib/codecommit-mirror/index.js +2 -2
  5. package/lib/ecs-service-roller/index.js +2 -2
  6. package/lib/email-receiver/receiver.js +1 -1
  7. package/lib/saml-identity-provider/index.js +2 -2
  8. package/lib/slack-app/manifest.js +1 -1
  9. package/lib/slack-app/slack-app.js +2 -2
  10. package/lib/slack-events/index.js +1 -1
  11. package/lib/slack-textract/index.js +1 -1
  12. package/lib/state-machine-cr-provider/index.js +1 -1
  13. package/lib/static-website/index.js +1 -1
  14. package/lib/url-shortener/index.js +1 -1
  15. package/node_modules/@sindresorhus/is/dist/index.d.ts +4 -2
  16. package/node_modules/@sindresorhus/is/dist/index.js +3 -1
  17. package/node_modules/@sindresorhus/is/package.json +1 -1
  18. package/node_modules/@sindresorhus/is/readme.md +23 -0
  19. package/node_modules/@slack/logger/node_modules/@types/node/README.md +2 -2
  20. package/node_modules/@slack/logger/node_modules/@types/node/assert.d.ts +1 -1
  21. package/node_modules/@slack/logger/node_modules/@types/node/async_hooks.d.ts +7 -3
  22. package/node_modules/@slack/logger/node_modules/@types/node/buffer.d.ts +9 -9
  23. package/node_modules/@slack/logger/node_modules/@types/node/child_process.d.ts +1 -1
  24. package/node_modules/@slack/logger/node_modules/@types/node/cluster.d.ts +1 -1
  25. package/node_modules/@slack/logger/node_modules/@types/node/console.d.ts +1 -1
  26. package/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +2 -2
  27. package/node_modules/@slack/logger/node_modules/@types/node/dgram.d.ts +2 -2
  28. package/node_modules/@slack/logger/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
  29. package/node_modules/@slack/logger/node_modules/@types/node/dns/promises.d.ts +12 -10
  30. package/node_modules/@slack/logger/node_modules/@types/node/dns.d.ts +17 -12
  31. package/node_modules/@slack/logger/node_modules/@types/node/domain.d.ts +1 -1
  32. package/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +2 -2
  33. package/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +5 -5
  34. package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +62 -11
  35. package/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +3 -3
  36. package/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +31 -4
  37. package/node_modules/@slack/logger/node_modules/@types/node/http2.d.ts +6 -6
  38. package/node_modules/@slack/logger/node_modules/@types/node/https.d.ts +1 -1
  39. package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +1 -2
  40. package/node_modules/@slack/logger/node_modules/@types/node/inspector.d.ts +4 -5
  41. package/node_modules/@slack/logger/node_modules/@types/node/net.d.ts +15 -14
  42. package/node_modules/@slack/logger/node_modules/@types/node/os.d.ts +1 -1
  43. package/node_modules/@slack/logger/node_modules/@types/node/package.json +2 -7
  44. package/node_modules/@slack/logger/node_modules/@types/node/path.d.ts +9 -1
  45. package/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +6 -4
  46. package/node_modules/@slack/logger/node_modules/@types/node/process.d.ts +1 -1
  47. package/node_modules/@slack/logger/node_modules/@types/node/punycode.d.ts +1 -1
  48. package/node_modules/@slack/logger/node_modules/@types/node/querystring.d.ts +1 -1
  49. package/node_modules/@slack/logger/node_modules/@types/node/readline.d.ts +121 -14
  50. package/node_modules/@slack/logger/node_modules/@types/node/repl.d.ts +1 -1
  51. package/node_modules/@slack/logger/node_modules/@types/node/stream/web.d.ts +3 -65
  52. package/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +10 -10
  53. package/node_modules/@slack/logger/node_modules/@types/node/string_decoder.d.ts +1 -1
  54. package/node_modules/@slack/logger/node_modules/@types/node/timers.d.ts +1 -1
  55. package/node_modules/@slack/logger/node_modules/@types/node/tls.d.ts +3 -2
  56. package/node_modules/@slack/logger/node_modules/@types/node/trace_events.d.ts +1 -1
  57. package/node_modules/@slack/logger/node_modules/@types/node/tty.d.ts +1 -1
  58. package/node_modules/@slack/logger/node_modules/@types/node/url.d.ts +58 -18
  59. package/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +3 -3
  60. package/node_modules/@slack/logger/node_modules/@types/node/v8.d.ts +3 -3
  61. package/node_modules/@slack/logger/node_modules/@types/node/vm.d.ts +1 -1
  62. package/node_modules/@slack/logger/node_modules/@types/node/wasi.d.ts +1 -1
  63. package/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +4 -4
  64. package/node_modules/@slack/logger/node_modules/@types/node/zlib.d.ts +1 -1
  65. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +2 -2
  66. package/node_modules/@slack/web-api/node_modules/@types/node/assert.d.ts +1 -1
  67. package/node_modules/@slack/web-api/node_modules/@types/node/async_hooks.d.ts +7 -3
  68. package/node_modules/@slack/web-api/node_modules/@types/node/buffer.d.ts +9 -9
  69. package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +1 -1
  70. package/node_modules/@slack/web-api/node_modules/@types/node/cluster.d.ts +1 -1
  71. package/node_modules/@slack/web-api/node_modules/@types/node/console.d.ts +1 -1
  72. package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +2 -2
  73. package/node_modules/@slack/web-api/node_modules/@types/node/dgram.d.ts +2 -2
  74. package/node_modules/@slack/web-api/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
  75. package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +12 -10
  76. package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +17 -12
  77. package/node_modules/@slack/web-api/node_modules/@types/node/domain.d.ts +1 -1
  78. package/node_modules/@slack/web-api/node_modules/@types/node/events.d.ts +2 -2
  79. package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +5 -5
  80. package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +62 -11
  81. package/node_modules/@slack/web-api/node_modules/@types/node/globals.d.ts +3 -3
  82. package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +31 -4
  83. package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +6 -6
  84. package/node_modules/@slack/web-api/node_modules/@types/node/https.d.ts +1 -1
  85. package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +1 -2
  86. package/node_modules/@slack/web-api/node_modules/@types/node/inspector.d.ts +4 -5
  87. package/node_modules/@slack/web-api/node_modules/@types/node/net.d.ts +15 -14
  88. package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +1 -1
  89. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -7
  90. package/node_modules/@slack/web-api/node_modules/@types/node/path.d.ts +9 -1
  91. package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +6 -4
  92. package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +1 -1
  93. package/node_modules/@slack/web-api/node_modules/@types/node/punycode.d.ts +1 -1
  94. package/node_modules/@slack/web-api/node_modules/@types/node/querystring.d.ts +1 -1
  95. package/node_modules/@slack/web-api/node_modules/@types/node/readline.d.ts +121 -14
  96. package/node_modules/@slack/web-api/node_modules/@types/node/repl.d.ts +1 -1
  97. package/node_modules/@slack/web-api/node_modules/@types/node/stream/web.d.ts +3 -65
  98. package/node_modules/@slack/web-api/node_modules/@types/node/stream.d.ts +10 -10
  99. package/node_modules/@slack/web-api/node_modules/@types/node/string_decoder.d.ts +1 -1
  100. package/node_modules/@slack/web-api/node_modules/@types/node/timers.d.ts +1 -1
  101. package/node_modules/@slack/web-api/node_modules/@types/node/tls.d.ts +3 -2
  102. package/node_modules/@slack/web-api/node_modules/@types/node/trace_events.d.ts +1 -1
  103. package/node_modules/@slack/web-api/node_modules/@types/node/tty.d.ts +1 -1
  104. package/node_modules/@slack/web-api/node_modules/@types/node/url.d.ts +58 -18
  105. package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +3 -3
  106. package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +3 -3
  107. package/node_modules/@slack/web-api/node_modules/@types/node/vm.d.ts +1 -1
  108. package/node_modules/@slack/web-api/node_modules/@types/node/wasi.d.ts +1 -1
  109. package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +4 -4
  110. package/node_modules/@slack/web-api/node_modules/@types/node/zlib.d.ts +1 -1
  111. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +2 -2
  112. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +3 -3
  113. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +11 -1
  114. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +3 -3
  115. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +0 -1
  116. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +4 -3
  117. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +2 -7
  118. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +8 -0
  119. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +2 -0
  120. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1 -1
  121. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +8 -8
  122. package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +2 -1
  123. package/node_modules/@types/is-stream/node_modules/@types/node/README.md +2 -2
  124. package/node_modules/@types/is-stream/node_modules/@types/node/globals.d.ts +3 -3
  125. package/node_modules/@types/is-stream/node_modules/@types/node/http.d.ts +11 -1
  126. package/node_modules/@types/is-stream/node_modules/@types/node/http2.d.ts +3 -3
  127. package/node_modules/@types/is-stream/node_modules/@types/node/index.d.ts +0 -1
  128. package/node_modules/@types/is-stream/node_modules/@types/node/net.d.ts +4 -3
  129. package/node_modules/@types/is-stream/node_modules/@types/node/package.json +2 -7
  130. package/node_modules/@types/is-stream/node_modules/@types/node/path.d.ts +8 -0
  131. package/node_modules/@types/is-stream/node_modules/@types/node/perf_hooks.d.ts +2 -0
  132. package/node_modules/@types/is-stream/node_modules/@types/node/process.d.ts +1 -1
  133. package/node_modules/@types/is-stream/node_modules/@types/node/stream.d.ts +8 -8
  134. package/node_modules/@types/is-stream/node_modules/@types/node/tls.d.ts +2 -1
  135. package/node_modules/@types/keyv/node_modules/@types/node/README.md +2 -2
  136. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +3 -3
  137. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +11 -1
  138. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +3 -3
  139. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +0 -1
  140. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +4 -3
  141. package/node_modules/@types/keyv/node_modules/@types/node/package.json +2 -7
  142. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +8 -0
  143. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +2 -0
  144. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1 -1
  145. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +8 -8
  146. package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +2 -1
  147. package/node_modules/@types/responselike/node_modules/@types/node/README.md +2 -2
  148. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +3 -3
  149. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +11 -1
  150. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +3 -3
  151. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +0 -1
  152. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +4 -3
  153. package/node_modules/@types/responselike/node_modules/@types/node/package.json +2 -7
  154. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +8 -0
  155. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +2 -0
  156. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1 -1
  157. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +8 -8
  158. package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +2 -1
  159. package/node_modules/follow-redirects/index.js +2 -2
  160. package/node_modules/follow-redirects/package.json +1 -1
  161. package/node_modules/keyv/.nyc_output/37411020-4142-4b08-b825-343ba2427bf7.json +1 -0
  162. package/node_modules/keyv/.nyc_output/cd79f2de-c8b8-4493-bc15-b2bde28efa4b.json +1 -0
  163. package/node_modules/keyv/.nyc_output/processinfo/37411020-4142-4b08-b825-343ba2427bf7.json +1 -0
  164. package/node_modules/keyv/.nyc_output/processinfo/cd79f2de-c8b8-4493-bc15-b2bde28efa4b.json +1 -0
  165. package/node_modules/keyv/.nyc_output/processinfo/index.json +1 -0
  166. package/node_modules/keyv/README.md +9 -8
  167. package/node_modules/keyv/package.json +5 -7
  168. package/node_modules/keyv/test/test.js +132 -0
  169. package/node_modules/keyv/test/testdb.sqlite +0 -0
  170. package/package.json +20 -16
  171. package/releasetag.txt +1 -0
  172. package/version.txt +1 -0
  173. package/node_modules/keyv/LICENSE +0 -21
@@ -102,13 +102,13 @@ const keyv = new Keyv({ serialize: JSON.stringify, deserialize: JSON.parse });
102
102
 
103
103
  The official storage adapters are covered by [over 150 integration tests](https://github.com/jaredwray/keyv/actions/workflows/build.yaml) to guarantee consistent behaviour. They are lightweight, efficient wrappers over the DB clients making use of indexes and native TTLs where available.
104
104
 
105
- Database | Adapter | Native TTL | Status
106
- ---|---|---|---
107
- Redis | [@keyv/redis](https://github.com/lukechilds/keyv-redis) | Yes | [![build](https://github.com/lukechilds/keyv-redis/actions/workflows/build.yaml/badge.svg)](https://github.com/lukechilds/keyv-redis/actions/workflows/build.yaml) [![Coverage Status](https://coveralls.io/repos/github/lukechilds/keyv-redis/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/keyv-redis?branch=master)
108
- MongoDB | [@keyv/mongo](https://github.com/lukechilds/keyv-mongo) | Yes | [![build](https://github.com/lukechilds/keyv-mongo/actions/workflows/build.yaml/badge.svg)](https://github.com/lukechilds/keyv-mongo/actions/workflows/build.yaml) [![Coverage Status](https://coveralls.io/repos/github/lukechilds/keyv-mongo/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/keyv-mongo?branch=master)
109
- SQLite | [@keyv/sqlite](https://github.com/lukechilds/keyv-sqlite) | No | [![build](https://github.com/lukechilds/keyv-sqlite/actions/workflows/build.yaml/badge.svg)](https://github.com/lukechilds/keyv-sqlite/actions/workflows/build.yaml) [![Coverage Status](https://coveralls.io/repos/github/lukechilds/keyv-sqlite/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/keyv-sqlite?branch=master)
110
- PostgreSQL | [@keyv/postgres](https://github.com/lukechilds/keyv-postgres) | No | [![build](https://github.com/lukechilds/keyv-postgres/actions/workflows/build.yaml/badge.svg)](https://github.com/lukechilds/keyv-postgres/actions/workflows/build.yaml) [![Coverage Status](https://coveralls.io/repos/github/lukechilds/keyv-postgres/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/keyv-postgres?branch=master)
111
- MySQL | [@keyv/mysql](https://github.com/lukechilds/keyv-mysql) | No | [![build](https://github.com/jaredwray/keyv-mysql/actions/workflows/build.yaml/badge.svg)](https://github.com/jaredwray/keyv-mysql/actions/workflows/build.yaml) [![Coverage Status](https://coveralls.io/repos/github/lukechilds/keyv-mysql/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/keyv-mysql?branch=master)
105
+ Database | Adapter | Native TTL
106
+ ---|---|---
107
+ Redis | [@keyv/redis](https://github.com/jaredwray/keyv/tree/master/packages/redis) | Yes
108
+ MongoDB | [@keyv/mongo](https://github.com/jaredwray/keyv/tree/master/packages/mongo) | Yes
109
+ SQLite | [@keyv/sqlite](https://github.com/jaredwray/keyv/tree/master/packages/sqlite) | No
110
+ PostgreSQL | [@keyv/postgres](https://github.com/jaredwray/keyv/tree/master/packages/postgres) | No
111
+ MySQL | [@keyv/mysql](https://github.com/jaredwray/keyv/tree/master/packages/mysql) | No
112
112
 
113
113
  ## Third-party Storage Adapters
114
114
 
@@ -146,7 +146,8 @@ The following are third-party storage adapters compatible with Keyv:
146
146
  - [keyv-null](https://www.npmjs.com/package/keyv-null) - Null storage adapter for Keyv
147
147
  - [keyv-firestore ](https://github.com/goto-bus-stop/keyv-firestore) – Firebase Cloud Firestore adapter for Keyv
148
148
  - [keyv-mssql](https://github.com/pmorgan3/keyv-mssql) - Microsoft Sql Server adapter for Keyv
149
- - [keyv-memcache](https://github.com/jaredwray/keyv-memcache) - Memcache storage adapter for Keyv
149
+ - [keyv-memcache](https://github.com/jaredwray/keyv/tree/master/packages/memcache) - Memcache storage adapter for Keyv
150
+ - [keyv-azuretable](https://github.com/howlowck/keyv-azuretable) - Azure Table Storage/API adapter for Keyv
150
151
 
151
152
  ## Add Cache Support to your Module
152
153
 
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "keyv",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "Simple key-value storage with support for multiple backends",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
- "test": "xo && nyc ava test/keyv.js",
8
- "test:full": "xo && nyc ava --serial",
9
- "test:services:start": "docker-compose -f ./test/storage-adapters/services-compose.yaml up -d",
10
- "test:services:stop": "docker-compose -f ./test/storage-adapters/services-compose.yaml down -v",
11
- "coverage": "nyc report --reporter=text-lcov > coverage.lcov"
7
+ "test": "xo && nyc ava --serial",
8
+ "coverage": "nyc report --reporter=text-lcov > coverage.lcov",
9
+ "clean": "rm -rf node_modules && rm -rf .nyc_output && rm -rf coverage.lcov && rm -rf ./test/testdb.sqlite"
12
10
  },
13
11
  "xo": {
14
12
  "extends": "xo-lukechilds",
@@ -44,8 +42,8 @@
44
42
  "@keyv/sqlite": "*",
45
43
  "@keyv/test-suite": "*",
46
44
  "ava": "^3.15.0",
47
- "codecov": "^3.8.3",
48
45
  "eslint-config-xo-lukechilds": "^1.0.0",
46
+ "eslint-plugin-promise": "^5.1.1",
49
47
  "nyc": "^15.1.0",
50
48
  "this": "^1.0.2",
51
49
  "timekeeper": "^2.0.0",
@@ -0,0 +1,132 @@
1
+ const test = require('ava');
2
+ const keyvTestSuite = require('@keyv/test-suite').default;
3
+ const { keyvOfficialTests } = require('@keyv/test-suite');
4
+ const Keyv = require('this');
5
+ const tk = require('timekeeper');
6
+ const KeyvSqlite = require('@keyv/sqlite');
7
+
8
+ keyvOfficialTests(test, Keyv, 'sqlite://test/testdb.sqlite', 'sqlite://non/existent/database.sqlite');
9
+
10
+ const store = () => new KeyvSqlite({ uri: 'sqlite://test/testdb.sqlite', busyTimeout: 3000 });
11
+ keyvTestSuite(test, Keyv, store);
12
+
13
+ test.serial('Keyv is a class', t => {
14
+ t.is(typeof Keyv, 'function');
15
+ t.throws(() => Keyv()); // eslint-disable-line new-cap
16
+ t.notThrows(() => new Keyv());
17
+ });
18
+
19
+ test.serial('Keyv accepts storage adapters', async t => {
20
+ const store = new Map();
21
+ const keyv = new Keyv({ store });
22
+ t.is(store.size, 0);
23
+ await keyv.set('foo', 'bar');
24
+ t.is(await keyv.get('foo'), 'bar');
25
+ t.is(store.size, 1);
26
+ });
27
+
28
+ test.serial('Keyv passes tll info to stores', async t => {
29
+ t.plan(1);
30
+ const store = new Map();
31
+ const storeSet = store.set;
32
+ store.set = (key, value, ttl) => {
33
+ t.is(ttl, 100);
34
+ storeSet.call(store, key, value, ttl);
35
+ };
36
+
37
+ const keyv = new Keyv({ store });
38
+ await keyv.set('foo', 'bar', 100);
39
+ });
40
+
41
+ test.serial('Keyv respects default tll option', async t => {
42
+ const store = new Map();
43
+ const keyv = new Keyv({ store, ttl: 100 });
44
+ await keyv.set('foo', 'bar');
45
+ t.is(await keyv.get('foo'), 'bar');
46
+ tk.freeze(Date.now() + 150);
47
+ t.is(await keyv.get('foo'), undefined);
48
+ t.is(store.size, 0);
49
+ tk.reset();
50
+ });
51
+
52
+ test.serial('.set(key, val, ttl) overwrites default tll option', async t => {
53
+ const startTime = Date.now();
54
+ tk.freeze(startTime);
55
+ const store = new Map();
56
+ const keyv = new Keyv({ store, ttl: 200 });
57
+ await keyv.set('foo', 'bar');
58
+ await keyv.set('fizz', 'buzz', 100);
59
+ await keyv.set('ping', 'pong', 300);
60
+ t.is(await keyv.get('foo'), 'bar');
61
+ t.is(await keyv.get('fizz'), 'buzz');
62
+ t.is(await keyv.get('ping'), 'pong');
63
+ tk.freeze(startTime + 150);
64
+ t.is(await keyv.get('foo'), 'bar');
65
+ t.is(await keyv.get('fizz'), undefined);
66
+ t.is(await keyv.get('ping'), 'pong');
67
+ tk.freeze(startTime + 250);
68
+ t.is(await keyv.get('foo'), undefined);
69
+ t.is(await keyv.get('ping'), 'pong');
70
+ tk.freeze(startTime + 350);
71
+ t.is(await keyv.get('ping'), undefined);
72
+ tk.reset();
73
+ });
74
+
75
+ test.serial('.set(key, val, ttl) where ttl is "0" overwrites default tll option and sets key to never expire', async t => {
76
+ const startTime = Date.now();
77
+ tk.freeze(startTime);
78
+ const store = new Map();
79
+ const keyv = new Keyv({ store, ttl: 200 });
80
+ await keyv.set('foo', 'bar', 0);
81
+ t.is(await keyv.get('foo'), 'bar');
82
+ tk.freeze(startTime + 250);
83
+ t.is(await keyv.get('foo'), 'bar');
84
+ tk.reset();
85
+ });
86
+
87
+ test.serial('.get(key, {raw: true}) returns the raw object instead of the value', async t => {
88
+ const store = new Map();
89
+ const keyv = new Keyv({ store });
90
+ await keyv.set('foo', 'bar');
91
+ const value = await keyv.get('foo');
92
+ const rawObject = await keyv.get('foo', { raw: true });
93
+ t.is(value, 'bar');
94
+ t.is(rawObject.value, 'bar');
95
+ });
96
+
97
+ test.serial('Keyv uses custom serializer when provided instead of json-buffer', async t => {
98
+ t.plan(3);
99
+ const store = new Map();
100
+ const serialize = data => {
101
+ t.pass();
102
+ return JSON.stringify(data);
103
+ };
104
+
105
+ const deserialize = data => {
106
+ t.pass();
107
+ return JSON.parse(data);
108
+ };
109
+
110
+ const keyv = new Keyv({ store, serialize, deserialize });
111
+ await keyv.set('foo', 'bar');
112
+ t.is(await keyv.get('foo'), 'bar');
113
+ });
114
+
115
+ test.serial('Keyv supports async serializer/deserializer', async t => {
116
+ t.plan(3);
117
+ const store = new Map();
118
+
119
+ const serialize = async data => {
120
+ t.pass();
121
+ return JSON.stringify(data);
122
+ };
123
+
124
+ const deserialize = async data => {
125
+ t.pass();
126
+ return JSON.parse(data);
127
+ };
128
+
129
+ const keyv = new Keyv({ store, serialize, deserialize });
130
+ await keyv.set('foo', 'bar');
131
+ t.is(await keyv.get('foo'), 'bar');
132
+ });
package/package.json CHANGED
@@ -19,8 +19,12 @@
19
19
  "integ:slack-app:destroy": "npx projen integ:slack-app:destroy",
20
20
  "integ:slack-app:snapshot": "npx projen integ:slack-app:snapshot",
21
21
  "integ:slack-app:watch": "npx projen integ:slack-app:watch",
22
+ "integ:snapshot-all": "npx projen integ:snapshot-all",
22
23
  "package": "npx projen package",
24
+ "package-all": "npx projen package-all",
25
+ "package:js": "npx projen package:js",
23
26
  "post-compile": "npx projen post-compile",
27
+ "post-upgrade": "npx projen post-upgrade",
24
28
  "pre-compile": "npx projen pre-compile",
25
29
  "release": "npx projen release",
26
30
  "test": "npx projen test",
@@ -38,34 +42,33 @@
38
42
  "organization": false
39
43
  },
40
44
  "devDependencies": {
41
- "@aws-cdk/aws-apigatewayv2-alpha": "^2.1.0-alpha.0",
42
- "@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.1.0-alpha.0",
43
- "@types/aws-lambda": "^8.10.87",
45
+ "@aws-cdk/aws-apigatewayv2-alpha": "2.1.0-alpha.0",
46
+ "@aws-cdk/aws-apigatewayv2-integrations-alpha": "2.1.0-alpha.0",
47
+ "@types/aws-lambda": "^8.10.90",
44
48
  "@types/jest": "^26.0.24",
45
49
  "@types/node": "^12",
46
50
  "@types/tsscmp": "^1.0.0",
47
51
  "@typescript-eslint/eslint-plugin": "^5",
48
52
  "@typescript-eslint/parser": "^5",
49
- "aws-cdk": "^2.2.0",
53
+ "aws-cdk": "^2",
50
54
  "aws-cdk-lib": "2.1.0",
51
- "aws-sdk": "^2.1046.0",
52
- "aws-sdk-mock": "^5.5.0",
55
+ "aws-sdk": "^2.1059.0",
56
+ "aws-sdk-mock": "^5.5.1",
53
57
  "constructs": "10.0.5",
54
- "esbuild": "^0.14.3",
58
+ "esbuild": "^0.14.11",
55
59
  "eslint": "^8",
56
60
  "eslint-import-resolver-node": "^0.3.6",
57
61
  "eslint-import-resolver-typescript": "^2.5.0",
58
- "eslint-plugin-import": "^2.25.3",
62
+ "eslint-plugin-import": "^2.25.4",
59
63
  "jest": "^26.6.3",
60
64
  "jest-junit": "^13",
61
- "jsii": "^1.48.0",
62
- "jsii-diff": "^1.48.0",
65
+ "jsii": "^1.52.1",
66
+ "jsii-diff": "^1.52.1",
63
67
  "jsii-docgen": "^1.8.110",
64
- "jsii-pacmak": "^1.48.0",
65
68
  "json-schema": "^0.4.0",
66
- "nock": "^13.2.1",
69
+ "nock": "^13.2.2",
67
70
  "npm-check-updates": "^12",
68
- "projen": "^0.45.4",
71
+ "projen": "^0.51.5",
69
72
  "standard-version": "^9",
70
73
  "ts-jest": "^26.5.6",
71
74
  "ts-node": "^10.4.0",
@@ -90,11 +93,11 @@
90
93
  ],
91
94
  "main": "lib/index.js",
92
95
  "license": "Apache-2.0",
93
- "version": "0.4.0",
96
+ "version": "0.4.4",
94
97
  "jest": {
95
98
  "testMatch": [
96
- "**/__tests__/**/*.ts?(x)",
97
- "**/?(*.)+(spec|test).ts?(x)"
99
+ "<rootDir>/src/**/__tests__/**/*.ts?(x)",
100
+ "<rootDir>/(test|src)/**/?(*.)+(spec|test).ts?(x)"
98
101
  ],
99
102
  "clearMocks": true,
100
103
  "collectCoverage": true,
@@ -102,6 +105,7 @@
102
105
  "json",
103
106
  "lcov",
104
107
  "clover",
108
+ "cobertura",
105
109
  "text"
106
110
  ],
107
111
  "coverageDirectory": "coverage",
package/releasetag.txt ADDED
@@ -0,0 +1 @@
1
+ v0.4.4
package/version.txt ADDED
@@ -0,0 +1 @@
1
+ 0.4.4
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017-2021 Jared Wray & Luke Childs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.