@upstash/redis 0.1.4 → 0.1.8

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/README.md CHANGED
@@ -9,7 +9,7 @@ An HTTP/REST based Redis client built on top of [Upstash REST API](https://docs.
9
9
  It is the only connectionless (HTTP based) Redis client and designed for:
10
10
 
11
11
  - Serverless functions (AWS Lambda ...)
12
- - Cloudflare Workers (see [the example](https://github.com/upstash/upstash-redis/tree/master/examples/workers-with-upstash))
12
+ - Cloudflare Workers (see [the example](https://github.com/upstash/upstash-redis/tree/master/examples/cloudflare-workers))
13
13
  - Fastly Compute@Edge
14
14
  - Next.js, Jamstack ...
15
15
  - Client side web/mobile applications
@@ -58,38 +58,6 @@ import { set } from '@upstash/redis';
58
58
 
59
59
  > If you define `UPSTASH_REDIS_REST_URL` and` UPSTASH_REDIS_REST_TOKEN` environment variables, you can skip the auth().
60
60
 
61
- ### Edge Support
62
-
63
- Once you set `edgeUrl`, all read commands are fetched using edge url. The REST URL is used for write/update commands.
64
-
65
- ```typescript
66
- import { auth, get } from '@upstash/redis';
67
-
68
- auth({
69
- url: 'UPSTASH_REDIS_REST_URL',
70
- token: 'UPSTASH_REDIS_REST_TOKEN',
71
- edgeUrl: 'UPSTASH_REDIS_EDGE_URL',
72
- });
73
-
74
- (async () => {
75
- try {
76
- // the below reads using edge url
77
- const { data, error, metadata } = await get('key');
78
- if (error) throw error;
79
- console.log(data);
80
- // -> null | string
81
- console.log(metadata);
82
- // -> { edge: boolean, cache: null | 'miss' | 'hit' }
83
-
84
- // the below reads using REST url (non-edge)
85
- const get1 = await get('key', { edge: false });
86
- if (get1.error) throw get1.error;
87
- } catch (error) {
88
- console.error(error);
89
- }
90
- })();
91
- ```
92
-
93
61
  ## Docs
94
62
 
95
63
  See [the documentation](https://docs.upstash.com/features/javascriptsdk) for details.
@@ -1,25 +1,21 @@
1
- import { ClientObjectProps, Upstash } from './type';
1
+ import { ClientObjectProps, Upstash } from './types';
2
2
  /**
3
3
  * Creates a Upstash Redis instance
4
4
  *
5
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
6
+ * @param {Object} options
7
+ * @param {string} [options.url]
8
+ * @param {string} [options.token]
9
+ * @param {Object} [options.requestOptions]
13
10
  *
14
11
  * @example
15
12
  * ```js
16
13
  * import upstash from '@upstash/redis'
17
14
  *
18
15
  * const redis1 = upstash('url', token);
19
- * const redis2 = upstash({ url: '', token: '', edgeUrl: '', readFromEdge: false });
16
+ * const redis2 = upstash({ url: '', token: '', requestOptions: {} });
20
17
  * ```
21
18
  */
22
19
  declare function upstash(options?: ClientObjectProps): Upstash;
23
20
  declare function upstash(url?: string, token?: string): Upstash;
24
21
  export default upstash;
25
- //# sourceMappingURL=client.d.ts.map