@upstash/redis 0.1.22 → 1.0.0-alpha.0

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 (51) hide show
  1. package/dist/chunk-RYSRH3HC.mjs +1084 -0
  2. package/dist/commands.d.ts +205 -0
  3. package/dist/commands.js +1201 -0
  4. package/dist/commands.mjs +218 -0
  5. package/dist/index.d.ts +1001 -0
  6. package/dist/index.js +1750 -0
  7. package/dist/index.mjs +858 -0
  8. package/dist/zunionstore-f1aa0b4a.d.ts +689 -0
  9. package/package.json +1 -84
  10. package/README.md +0 -103
  11. package/dist/main/src/client.d.ts +0 -25
  12. package/dist/main/src/client.d.ts.map +0 -1
  13. package/dist/main/src/client.js +0 -748
  14. package/dist/main/src/client.js.map +0 -1
  15. package/dist/main/src/index.d.ts +0 -73
  16. package/dist/main/src/index.d.ts.map +0 -1
  17. package/dist/main/src/index.js +0 -124
  18. package/dist/main/src/index.js.map +0 -1
  19. package/dist/main/src/type.d.ts +0 -466
  20. package/dist/main/src/type.d.ts.map +0 -1
  21. package/dist/main/src/type.js +0 -3
  22. package/dist/main/src/type.js.map +0 -1
  23. package/dist/main/utils/helper.d.ts +0 -5
  24. package/dist/main/utils/helper.d.ts.map +0 -1
  25. package/dist/main/utils/helper.js +0 -20
  26. package/dist/main/utils/helper.js.map +0 -1
  27. package/dist/module/src/client.d.ts +0 -25
  28. package/dist/module/src/client.d.ts.map +0 -1
  29. package/dist/module/src/client.js +0 -743
  30. package/dist/module/src/client.js.map +0 -1
  31. package/dist/module/src/index.d.ts +0 -73
  32. package/dist/module/src/index.d.ts.map +0 -1
  33. package/dist/module/src/index.js +0 -5
  34. package/dist/module/src/index.js.map +0 -1
  35. package/dist/module/src/type.d.ts +0 -466
  36. package/dist/module/src/type.d.ts.map +0 -1
  37. package/dist/module/src/type.js +0 -2
  38. package/dist/module/src/type.js.map +0 -1
  39. package/dist/module/utils/helper.d.ts +0 -5
  40. package/dist/module/utils/helper.d.ts.map +0 -1
  41. package/dist/module/utils/helper.js +0 -13
  42. package/dist/module/utils/helper.js.map +0 -1
  43. package/dist/umd/upstash-redis.js +0 -1
  44. package/jest.config.js +0 -5
  45. package/src/client.ts +0 -1232
  46. package/src/index.ts +0 -233
  47. package/src/type.ts +0 -1194
  48. package/tsconfig.json +0 -18
  49. package/tsconfig.module.json +0 -7
  50. package/utils/helper.ts +0 -17
  51. package/webpack.config.js +0 -34
package/package.json CHANGED
@@ -1,84 +1 @@
1
- {
2
- "name": "@upstash/redis",
3
- "version": "0.1.22",
4
- "description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
5
- "author": "Adem ilter <adem@upstash.com>",
6
- "license": "MIT",
7
- "main": "dist/main/src/index.js",
8
- "types": "dist/main/src/index.d.ts",
9
- "module": "dist/module/src/index.js",
10
- "jsdelivr": "dist/umd/upstash-redis.js",
11
- "unpkg": "dist/umd/upstash-redis.js",
12
- "scripts": {
13
- "clean": "rimraf dist",
14
- "format": "prettier --write \"{src,test}/**/*.ts\"",
15
- "build": "run-s clean format build:*",
16
- "build:main": "tsc -p tsconfig.json",
17
- "build:module": "tsc -p tsconfig.module.json",
18
- "build:umd": "webpack",
19
- "test": "jest --runInBand && npm run size",
20
- "size": "size-limit"
21
- },
22
- "dependencies": {
23
- "isomorphic-unfetch": "^3.1.0"
24
- },
25
- "devDependencies": {
26
- "@size-limit/preset-small-lib": "^5.0.3",
27
- "@types/jest": "^26.0.24",
28
- "@types/node-fetch": "^2.5.12",
29
- "dotenv": "^10.0.0",
30
- "jest": "^27.0.6",
31
- "nanoid": "^3.1.25",
32
- "npm-run-all": "^4.1.5",
33
- "prettier": "^2.3.2",
34
- "rimraf": "^3.0.2",
35
- "size-limit": "^5.0.3",
36
- "ts-jest": "^27.0.4",
37
- "ts-loader": "^9.2.5",
38
- "typescript": "^4.3.5",
39
- "webpack": "^5.49.0",
40
- "webpack-cli": "^4.7.2"
41
- },
42
- "size-limit": [
43
- {
44
- "path": "dist/main/src/index.js",
45
- "limit": "6 KB"
46
- },
47
- {
48
- "path": "dist/module/src/index.js",
49
- "limit": "6 KB"
50
- },
51
- {
52
- "path": "dist/umd/upstash-redis.js",
53
- "limit": "6 KB"
54
- }
55
- ],
56
- "prettier": {
57
- "printWidth": 80,
58
- "semi": true,
59
- "singleQuote": true,
60
- "trailingComma": "es5"
61
- },
62
- "engines": {
63
- "node": ">=10"
64
- },
65
- "repository": {
66
- "type": "git",
67
- "url": "git+https://github.com/upstash/upstash-redis.git"
68
- },
69
- "bugs": {
70
- "url": "https://github.com/upstash/upstash-redis/issues"
71
- },
72
- "homepage": "https://github.com/upstash/upstash-redis#readme",
73
- "directories": {
74
- "example": "examples",
75
- "test": "test"
76
- },
77
- "keywords": [
78
- "redis",
79
- "database",
80
- "serverless",
81
- "edge",
82
- "upstash"
83
- ]
84
- }
1
+ { "name": "@upstash/redis", "version": "v1.0.0-alpha.0", "engines": { "node": ">=10" }, "description": "An HTTP/REST based Redis client built on top of Upstash REST API.", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "exports": { ".": { "require": "./dist/index.js", "import": "./dist/index.mjs", "types": "./dist/index.d.ts" } }, "files": [ "package.json", "dist" ], "scripts": { "test": "jest -i", "fmt": "pnpm lint && pnpm prettier --write .", "lint": "eslint --ext .ts --fix --ignore-path .gitignore .", "build": "tsup && pnpm size-limit" }, "repository": { "type": "git", "url": "git+https://github.com/upstash/upstash-redis.git" }, "keywords": [ "redis", "database", "serverless", "edge", "upstash" ], "author": "Andreas Thomas <andreas.thomas@chronark.com>", "license": "MIT", "bugs": { "url": "https://github.com/upstash/upstash-redis/issues" }, "homepage": "https://github.com/upstash/upstash-redis#readme", "directories": { "examples": "examples" }, "devDependencies": { "@jest/globals": "^27.4.6", "@size-limit/preset-small-lib": "^7.0.8", "@trivago/prettier-plugin-sort-imports": "^3.2.0", "@types/jest": "^27.4.0", "@types/node": "^17.0.8", "@typescript-eslint/eslint-plugin": "^5.9.1", "@typescript-eslint/parser": "^5.9.1", "dotenv": "^12.0.3", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "jest": "^27.4.7", "prettier": "^2.5.1", "size-limit": "^7.0.8", "ts-jest": "^27.1.3", "tsup": "^5.11.11", "typescript": "^4.5.5" }, "dependencies": { "isomorphic-fetch": "^3.0.0" }, "browser": { "isomorphic-fetch": false }, "size-limit": [ { "path": "dist/index.js", "limit": "5 KB" }, { "path": "dist/index.mjs", "limit": "5 KB" } ] }
package/README.md DELETED
@@ -1,103 +0,0 @@
1
- # Upstash Redis
2
-
3
- An HTTP/REST based Redis client built on top of [Upstash REST API](https://docs.upstash.com/features/restapi).
4
-
5
- [![Tests](https://github.com/upstash/upstash-redis/actions/workflows/test.yml/badge.svg)](https://github.com/upstash/upstash-redis/actions/workflows/test.yml)
6
- ![npm (scoped)](https://img.shields.io/npm/v/@upstash/redis)
7
- ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@upstash/redis)
8
-
9
- It is the only connectionless (HTTP based) Redis client and designed for:
10
-
11
- - Serverless functions (AWS Lambda ...)
12
- - Cloudflare Workers (see [the example](https://github.com/upstash/upstash-redis/tree/master/examples/workers-with-upstash))
13
- - Fastly Compute@Edge
14
- - Next.js, Jamstack ...
15
- - Client side web/mobile applications
16
- - WebAssembly
17
- - and other environments where HTTP is preferred over TCP.
18
-
19
- See [the list of APIs](https://docs.upstash.com/features/restapi#rest---redis-api-compatibility) supported.
20
-
21
- ## Quick Start
22
-
23
- ### Install
24
-
25
- ```bash
26
- npm install @upstash/redis
27
- ```
28
-
29
- ### Usage with Callback Style
30
-
31
- ```typescript
32
- import upstash from '@upstash/redis';
33
-
34
- const redis = upstash('UPSTASH_REDIS_REST_URL', 'UPSTASH_REDIS_REST_TOKEN');
35
-
36
- redis.get('key', function ({ data, error }) {
37
- if (error) {
38
- return console.error(error);
39
- }
40
- console.log(data);
41
- });
42
- ```
43
-
44
- ### Usage with async/await (Promise)
45
-
46
- ```typescript
47
- import upstash from '@upstash/redis';
48
-
49
- const redis = upstash('UPSTASH_REDIS_REST_URL', 'UPSTASH_REDIS_REST_TOKEN');
50
-
51
- (async () => {
52
- try {
53
- const { data, error } = await redis.get('key');
54
- if (error) throw error;
55
- console.log(data);
56
- } catch (error) {
57
- console.error(error);
58
- }
59
- })();
60
- ```
61
-
62
- If you define `UPSTASH_REDIS_REST_URL` and` UPSTASH_REDIS_REST_TOKEN` environment variables, you can run the Redis commands directly.
63
-
64
- ```typescript
65
- import { get } from '@upstash/redis';
66
-
67
- (async () => {
68
- try {
69
- const { data, error } = await get('key');
70
- if (error) throw error;
71
- console.log(data);
72
- } catch (error) {
73
- console.error(error);
74
- }
75
- })();
76
- ```
77
-
78
- ### Edge Support
79
-
80
- > Only GET requests are supported in Edge Caching. As a result, write/update commands are not supported.
81
-
82
- ```typescript
83
- import upstash from '@upstash/redis';
84
-
85
- const redis = upstash({
86
- url: 'UPSTASH_REDIS_REST_URL',
87
- token: 'UPSTASH_REDIS_REST_TOKEN',
88
- edgeUrl: 'UPSTASH_REDIS_EDGE_URL',
89
- });
90
-
91
- (async () => {
92
- try {
93
- const { data, error, metadata } = await redis.get('key');
94
- if (error) throw error;
95
- console.log(data);
96
- // -> null | string
97
- console.log(metadata);
98
- // -> { edge: boolean, cache: null | 'miss' | 'hit' }
99
- } catch (error) {
100
- console.error(error);
101
- }
102
- })();
103
- ```
@@ -1,25 +0,0 @@
1
- import { ClientObjectProps, Upstash } from './type';
2
- /**
3
- * Creates a Upstash Redis instance
4
- *
5
- * @constructor
6
- * @param {string} url - database rest url
7
- * @param {string} token - database rest token
8
- * @param {Object} options - database config
9
- * @param {string} [options.url] - database rest url
10
- * @param {string} [options.token] - database rest token
11
- * @param {string} [options.edgeUrl] - database rest edge url
12
- * @param {string} [options.readFromEdge] - database rest read from edge
13
- *
14
- * @example
15
- * ```js
16
- * import Upstash from '@upstash/redis'
17
- *
18
- * const redis1 = new Upstash('url', token);
19
- * const redis2 = new Upstash({ url: '', token: '', edgeUrl: '', readFromEdge: false });
20
- * ```
21
- */
22
- export default Upstash;
23
- declare function Upstash(url?: string, token?: string): Upstash;
24
- declare function Upstash(options?: ClientObjectProps): Upstash;
25
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EAMjB,OAAO,EAIR,MAAM,QAAQ,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAe,OAAO,CAAC;AACvB,iBAAS,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;AACxD,iBAAS,OAAO,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC"}