@upstash/redis 0.2.0 → 1.0.0-alpha.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.
- package/dist/chunk-RYSRH3HC.mjs +1084 -0
- package/dist/commands.d.ts +205 -0
- package/dist/commands.js +1201 -0
- package/dist/commands.mjs +218 -0
- package/dist/index.d.ts +1011 -0
- package/dist/index.js +1754 -0
- package/dist/index.mjs +862 -0
- package/dist/zunionstore-462de5d3.d.ts +695 -0
- package/package.json +1 -75
- package/README.md +0 -63
- package/dist/main/client.d.ts +0 -21
- package/dist/main/client.js +0 -556
- package/dist/main/index-cjs.d.ts +0 -1
- package/dist/main/index-cjs.js +0 -120
- package/dist/main/types.d.ts +0 -177
- package/dist/main/types.js +0 -2
- package/dist/module/client.d.ts +0 -21
- package/dist/module/client.js +0 -551
- package/dist/module/index.d.ts +0 -3
- package/dist/module/index.js +0 -3
- package/dist/module/types.d.ts +0 -177
- package/dist/module/types.js +0 -1
- package/jest.config.js +0 -5
- package/src/client.ts +0 -618
- package/src/index-cjs.ts +0 -117
- package/src/index.ts +0 -118
- package/src/types.ts +0 -408
- package/tsconfig.json +0 -20
- package/tsconfig.module.json +0 -8
package/package.json
CHANGED
|
@@ -1,75 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@upstash/redis",
|
|
3
|
-
"version": "0.2.0",
|
|
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/index-cjs.js",
|
|
8
|
-
"module": "dist/module/index.js",
|
|
9
|
-
"types": "dist/module/index.d.ts",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"clean": "rimraf dist",
|
|
12
|
-
"format": "prettier --write \"{src,test}/**/*.ts\"",
|
|
13
|
-
"build": "run-s clean format build:*",
|
|
14
|
-
"build:main": "tsc -p tsconfig.json",
|
|
15
|
-
"build:module": "tsc -p tsconfig.module.json",
|
|
16
|
-
"test": "jest --runInBand && npm run size",
|
|
17
|
-
"size": "size-limit"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"isomorphic-unfetch": "^3.1.0"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@size-limit/preset-small-lib": "^6.0.4",
|
|
24
|
-
"@types/jest": "^27.0.2",
|
|
25
|
-
"@types/node-fetch": "^2.5.12",
|
|
26
|
-
"dotenv": "^10.0.0",
|
|
27
|
-
"jest": "^27.3.1",
|
|
28
|
-
"nanoid": "^3.1.30",
|
|
29
|
-
"npm-run-all": "^4.1.5",
|
|
30
|
-
"prettier": "^2.3.2",
|
|
31
|
-
"rimraf": "^3.0.2",
|
|
32
|
-
"size-limit": "^6.0.4",
|
|
33
|
-
"ts-jest": "^27.0.7",
|
|
34
|
-
"ts-loader": "^9.2.6",
|
|
35
|
-
"typescript": "^4.5.2"
|
|
36
|
-
},
|
|
37
|
-
"size-limit": [
|
|
38
|
-
{
|
|
39
|
-
"path": "dist/main/index-cjs.js",
|
|
40
|
-
"limit": "3 KB"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"path": "dist/module/index.js",
|
|
44
|
-
"limit": "3 KB"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
"prettier": {
|
|
48
|
-
"printWidth": 80,
|
|
49
|
-
"semi": true,
|
|
50
|
-
"singleQuote": true,
|
|
51
|
-
"trailingComma": "es5"
|
|
52
|
-
},
|
|
53
|
-
"engines": {
|
|
54
|
-
"node": ">=10"
|
|
55
|
-
},
|
|
56
|
-
"repository": {
|
|
57
|
-
"type": "git",
|
|
58
|
-
"url": "git+https://github.com/upstash/upstash-redis.git"
|
|
59
|
-
},
|
|
60
|
-
"bugs": {
|
|
61
|
-
"url": "https://github.com/upstash/upstash-redis/issues"
|
|
62
|
-
},
|
|
63
|
-
"homepage": "https://github.com/upstash/upstash-redis#readme",
|
|
64
|
-
"directories": {
|
|
65
|
-
"example": "examples",
|
|
66
|
-
"test": "test"
|
|
67
|
-
},
|
|
68
|
-
"keywords": [
|
|
69
|
-
"redis",
|
|
70
|
-
"database",
|
|
71
|
-
"serverless",
|
|
72
|
-
"edge",
|
|
73
|
-
"upstash"
|
|
74
|
-
]
|
|
75
|
-
}
|
|
1
|
+
{ "name": "@upstash/redis", "version": "v1.0.0-alpha.1", "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,63 +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
|
-
[](https://github.com/upstash/upstash-redis/actions/workflows/test.yml)
|
|
6
|
-

|
|
7
|
-

|
|
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/cloudflare-workers))
|
|
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 Promise
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { auth, set } from '@upstash/redis';
|
|
33
|
-
|
|
34
|
-
auth('UPSTASH_REDIS_REST_URL', 'UPSTASH_REDIS_REST_TOKEN');
|
|
35
|
-
|
|
36
|
-
set('key', 'value').then(({ data }) => {
|
|
37
|
-
console.log(data);
|
|
38
|
-
// -> "OK"
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Usage with async/await
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
import { set } from '@upstash/redis';
|
|
46
|
-
|
|
47
|
-
(async () => {
|
|
48
|
-
try {
|
|
49
|
-
const { data, error } = await set('key', 'value');
|
|
50
|
-
if (error) throw error;
|
|
51
|
-
console.log(data);
|
|
52
|
-
// -> "OK"
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error(error);
|
|
55
|
-
}
|
|
56
|
-
})();
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
> If you define `UPSTASH_REDIS_REST_URL` and` UPSTASH_REDIS_REST_TOKEN` environment variables, you can skip the auth().
|
|
60
|
-
|
|
61
|
-
## Docs
|
|
62
|
-
|
|
63
|
-
See [the documentation](https://docs.upstash.com/features/javascriptsdk) for details.
|
package/dist/main/client.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ClientObjectProps, Upstash } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a Upstash Redis instance
|
|
4
|
-
*
|
|
5
|
-
* @constructor
|
|
6
|
-
* @param {Object} options
|
|
7
|
-
* @param {string} [options.url]
|
|
8
|
-
* @param {string} [options.token]
|
|
9
|
-
* @param {Object} [options.requestOptions]
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```js
|
|
13
|
-
* import upstash from '@upstash/redis'
|
|
14
|
-
*
|
|
15
|
-
* const redis1 = upstash('url', token);
|
|
16
|
-
* const redis2 = upstash({ url: '', token: '', requestOptions: {} });
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare function upstash(options?: ClientObjectProps): Upstash;
|
|
20
|
-
declare function upstash(url?: string, token?: string): Upstash;
|
|
21
|
-
export default upstash;
|