@upstash/redis 1.36.1 → 1.37.0-rc.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/nodejs.mjs CHANGED
@@ -3,7 +3,160 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-LLI2WIYN.mjs";
6
+ } from "./chunk-PDHDP2I5.mjs";
7
+
8
+ // pkg/commands/search/schema-builder.ts
9
+ var BUILD = Symbol("build");
10
+ var TextFieldBuilder = class _TextFieldBuilder {
11
+ _noTokenize;
12
+ _noStem;
13
+ _from;
14
+ constructor(noTokenize = { noTokenize: false }, noStem = { noStem: false }, from = { from: null }) {
15
+ this._noTokenize = noTokenize;
16
+ this._noStem = noStem;
17
+ this._from = from;
18
+ }
19
+ noTokenize() {
20
+ return new _TextFieldBuilder({ noTokenize: true }, this._noStem, this._from);
21
+ }
22
+ noStem() {
23
+ return new _TextFieldBuilder(this._noTokenize, { noStem: true }, this._from);
24
+ }
25
+ from(field) {
26
+ return new _TextFieldBuilder(this._noTokenize, this._noStem, { from: field });
27
+ }
28
+ [BUILD]() {
29
+ const hasOptions = this._noTokenize.noTokenize || this._noStem.noStem || Boolean(this._from.from);
30
+ return hasOptions ? {
31
+ type: "TEXT",
32
+ ...this._noTokenize.noTokenize ? { noTokenize: true } : {},
33
+ ...this._noStem.noStem ? { noStem: true } : {},
34
+ ...this._from.from ? { from: this._from.from } : {}
35
+ } : "TEXT";
36
+ }
37
+ };
38
+ var NumericFieldBuilder = class _NumericFieldBuilder {
39
+ type;
40
+ _from;
41
+ constructor(type, from = { from: null }) {
42
+ this.type = type;
43
+ this._from = from;
44
+ }
45
+ from(field) {
46
+ return new _NumericFieldBuilder(this.type, { from: field });
47
+ }
48
+ [BUILD]() {
49
+ return this._from.from ? {
50
+ type: this.type,
51
+ fast: true,
52
+ from: this._from.from
53
+ } : {
54
+ type: this.type,
55
+ fast: true
56
+ };
57
+ }
58
+ };
59
+ var BoolFieldBuilder = class _BoolFieldBuilder {
60
+ _fast;
61
+ _from;
62
+ constructor(fast = { fast: false }, from = { from: null }) {
63
+ this._fast = fast;
64
+ this._from = from;
65
+ }
66
+ fast() {
67
+ return new _BoolFieldBuilder({ fast: true }, this._from);
68
+ }
69
+ from(field) {
70
+ return new _BoolFieldBuilder(this._fast, { from: field });
71
+ }
72
+ [BUILD]() {
73
+ const hasFast = this._fast.fast;
74
+ const hasFrom = Boolean(this._from.from);
75
+ if (hasFast && hasFrom) {
76
+ return {
77
+ type: "BOOL",
78
+ fast: true,
79
+ from: this._from.from
80
+ };
81
+ }
82
+ if (hasFast) {
83
+ return {
84
+ type: "BOOL",
85
+ fast: true
86
+ };
87
+ }
88
+ if (hasFrom) {
89
+ return {
90
+ type: "BOOL",
91
+ from: this._from.from
92
+ };
93
+ }
94
+ return "BOOL";
95
+ }
96
+ };
97
+ var DateFieldBuilder = class _DateFieldBuilder {
98
+ _fast;
99
+ _from;
100
+ constructor(fast = { fast: false }, from = { from: null }) {
101
+ this._fast = fast;
102
+ this._from = from;
103
+ }
104
+ fast() {
105
+ return new _DateFieldBuilder({ fast: true }, this._from);
106
+ }
107
+ from(field) {
108
+ return new _DateFieldBuilder(this._fast, { from: field });
109
+ }
110
+ [BUILD]() {
111
+ const hasFast = this._fast.fast;
112
+ const hasFrom = Boolean(this._from.from);
113
+ if (hasFast && hasFrom) {
114
+ return {
115
+ type: "DATE",
116
+ fast: true,
117
+ from: this._from.from
118
+ };
119
+ }
120
+ if (hasFast) {
121
+ return {
122
+ type: "DATE",
123
+ fast: true
124
+ };
125
+ }
126
+ if (hasFrom) {
127
+ return {
128
+ type: "DATE",
129
+ from: this._from.from
130
+ };
131
+ }
132
+ return "DATE";
133
+ }
134
+ };
135
+ var s = {
136
+ string() {
137
+ return new TextFieldBuilder();
138
+ },
139
+ number(type = "F64") {
140
+ return new NumericFieldBuilder(type);
141
+ },
142
+ boolean() {
143
+ return new BoolFieldBuilder();
144
+ },
145
+ date() {
146
+ return new DateFieldBuilder();
147
+ },
148
+ object(fields) {
149
+ const result = {};
150
+ for (const [key, value] of Object.entries(fields)) {
151
+ if (value && typeof value === "object" && BUILD in value) {
152
+ result[key] = value[BUILD]();
153
+ } else {
154
+ result[key] = value;
155
+ }
156
+ }
157
+ return result;
158
+ }
159
+ };
7
160
 
8
161
  // platforms/nodejs.ts
9
162
  if (typeof atob === "undefined") {
@@ -61,20 +214,18 @@ var Redis2 = class _Redis extends Redis {
61
214
  keepAlive: configOrRequester.keepAlive,
62
215
  readYourWrites: configOrRequester.readYourWrites
63
216
  });
64
- const safeEnv = typeof process === "object" && process && typeof process.env === "object" && process.env ? process.env : {};
65
217
  super(client, {
66
218
  automaticDeserialization: configOrRequester.automaticDeserialization,
67
- enableTelemetry: configOrRequester.enableTelemetry ?? !safeEnv.UPSTASH_DISABLE_TELEMETRY,
219
+ enableTelemetry: configOrRequester.enableTelemetry ?? !process.env.UPSTASH_DISABLE_TELEMETRY,
68
220
  latencyLogging: configOrRequester.latencyLogging,
69
221
  enableAutoPipelining: configOrRequester.enableAutoPipelining
70
222
  });
71
- const nodeVersion = typeof process === "object" && process ? process.version : void 0;
72
223
  this.addTelemetry({
73
224
  runtime: (
74
225
  // @ts-expect-error to silence compiler
75
- typeof EdgeRuntime === "string" ? "edge-light" : nodeVersion ? `node@${nodeVersion}` : "unknown"
226
+ typeof EdgeRuntime === "string" ? "edge-light" : `node@${process.version}`
76
227
  ),
77
- platform: safeEnv.UPSTASH_CONSOLE ? "console" : safeEnv.VERCEL ? "vercel" : safeEnv.AWS_REGION ? "aws" : "unknown",
228
+ platform: process.env.UPSTASH_CONSOLE ? "console" : process.env.VERCEL ? "vercel" : process.env.AWS_REGION ? "aws" : "unknown",
78
229
  sdk: `@upstash/redis@${VERSION}`
79
230
  });
80
231
  if (this.enableAutoPipelining) {
@@ -95,7 +246,7 @@ var Redis2 = class _Redis extends Redis {
95
246
  * that may use different naming conventions.
96
247
  */
97
248
  static fromEnv(config) {
98
- if (typeof process !== "object" || !process || typeof process.env !== "object" || !process.env) {
249
+ if (process.env === void 0) {
99
250
  throw new TypeError(
100
251
  '[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
101
252
  );
@@ -115,5 +266,6 @@ var Redis2 = class _Redis extends Redis {
115
266
  };
116
267
  export {
117
268
  Redis2 as Redis,
118
- error_exports as errors
269
+ error_exports as errors,
270
+ s
119
271
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/redis","version":"v1.36.1","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"uncrypto":"^0.1.3"}}
1
+ {"name":"@upstash/redis","version":"v1.37.0-rc.1","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"uncrypto":"^0.1.3"}}