@kedaruma/revlm-client 1.0.48 → 1.0.50
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-Y6FXYEAI.mjs → chunk-EBO3CZXG.mjs} +6 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +109 -0
- package/dist/index.mjs +109 -1
- package/dist/rn-setup.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1
2
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
3
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
4
|
}) : x)(function(x) {
|
|
4
5
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
6
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
7
|
});
|
|
8
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
7
11
|
|
|
8
12
|
export {
|
|
9
|
-
__require
|
|
13
|
+
__require,
|
|
14
|
+
__commonJS
|
|
10
15
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -173,6 +173,7 @@ type EmailPasswordCredential = {
|
|
|
173
173
|
type UserInput = Omit<User, 'userType'> & {
|
|
174
174
|
userType: User['userType'] | string;
|
|
175
175
|
};
|
|
176
|
+
type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
176
177
|
type RevlmOptions = {
|
|
177
178
|
fetchImpl?: typeof fetch;
|
|
178
179
|
defaultHeaders?: Record<string, string>;
|
|
@@ -181,6 +182,7 @@ type RevlmOptions = {
|
|
|
181
182
|
provisionalAuthDomain?: string;
|
|
182
183
|
autoSetToken?: boolean;
|
|
183
184
|
autoRefreshOn401?: boolean;
|
|
185
|
+
logLevel?: LogLevel;
|
|
184
186
|
};
|
|
185
187
|
type RevlmResponse<T = any> = {
|
|
186
188
|
ok: boolean;
|
|
@@ -201,6 +203,7 @@ declare class Revlm {
|
|
|
201
203
|
private autoSetToken;
|
|
202
204
|
private autoRefreshOn401;
|
|
203
205
|
private cookieCheckPromise?;
|
|
206
|
+
private logLevel;
|
|
204
207
|
constructor(baseUrl: string, opts?: RevlmOptions);
|
|
205
208
|
setToken(token: string): void;
|
|
206
209
|
getToken(): string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -173,6 +173,7 @@ type EmailPasswordCredential = {
|
|
|
173
173
|
type UserInput = Omit<User, 'userType'> & {
|
|
174
174
|
userType: User['userType'] | string;
|
|
175
175
|
};
|
|
176
|
+
type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
176
177
|
type RevlmOptions = {
|
|
177
178
|
fetchImpl?: typeof fetch;
|
|
178
179
|
defaultHeaders?: Record<string, string>;
|
|
@@ -181,6 +182,7 @@ type RevlmOptions = {
|
|
|
181
182
|
provisionalAuthDomain?: string;
|
|
182
183
|
autoSetToken?: boolean;
|
|
183
184
|
autoRefreshOn401?: boolean;
|
|
185
|
+
logLevel?: LogLevel;
|
|
184
186
|
};
|
|
185
187
|
type RevlmResponse<T = any> = {
|
|
186
188
|
ok: boolean;
|
|
@@ -201,6 +203,7 @@ declare class Revlm {
|
|
|
201
203
|
private autoSetToken;
|
|
202
204
|
private autoRefreshOn401;
|
|
203
205
|
private cookieCheckPromise?;
|
|
206
|
+
private logLevel;
|
|
204
207
|
constructor(baseUrl: string, opts?: RevlmOptions);
|
|
205
208
|
setToken(token: string): void;
|
|
206
209
|
getToken(): string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -27,6 +30,73 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
30
|
));
|
|
28
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
32
|
|
|
33
|
+
// package.json
|
|
34
|
+
var require_package = __commonJS({
|
|
35
|
+
"package.json"(exports2, module2) {
|
|
36
|
+
module2.exports = {
|
|
37
|
+
name: "@kedaruma/revlm-client",
|
|
38
|
+
version: "1.0.50",
|
|
39
|
+
private: false,
|
|
40
|
+
description: "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
|
|
41
|
+
keywords: [
|
|
42
|
+
"realm",
|
|
43
|
+
"realm-web",
|
|
44
|
+
"mongodb-realm",
|
|
45
|
+
"mongodb",
|
|
46
|
+
"realm-alternative",
|
|
47
|
+
"app-services",
|
|
48
|
+
"auth"
|
|
49
|
+
],
|
|
50
|
+
main: "dist/index.js",
|
|
51
|
+
module: "dist/index.mjs",
|
|
52
|
+
types: "dist/index.d.ts",
|
|
53
|
+
exports: {
|
|
54
|
+
".": {
|
|
55
|
+
import: {
|
|
56
|
+
types: "./dist/index.d.mts",
|
|
57
|
+
default: "./dist/index.mjs"
|
|
58
|
+
},
|
|
59
|
+
require: {
|
|
60
|
+
types: "./dist/index.d.ts",
|
|
61
|
+
default: "./dist/index.js"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"./rn-setup": {
|
|
65
|
+
import: {
|
|
66
|
+
types: "./dist/rn-setup.d.mts",
|
|
67
|
+
default: "./dist/rn-setup.mjs"
|
|
68
|
+
},
|
|
69
|
+
require: {
|
|
70
|
+
types: "./dist/rn-setup.d.ts",
|
|
71
|
+
default: "./dist/rn-setup.js"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
sideEffects: false,
|
|
76
|
+
files: [
|
|
77
|
+
"dist/"
|
|
78
|
+
],
|
|
79
|
+
license: "ISC",
|
|
80
|
+
publishConfig: {
|
|
81
|
+
access: "public"
|
|
82
|
+
},
|
|
83
|
+
scripts: {
|
|
84
|
+
build: "tsup src/index.ts src/rn-setup.ts --format cjs,esm --dts --tsconfig tsconfig.build.json",
|
|
85
|
+
clean: "rm -rf dist node_modules kedaruma-revlm-client-*.tgz",
|
|
86
|
+
test: "pnpm exec jest --config ../../jest.config.cjs packages/revlm-client/src/__tests__/ --runInBand --watchman=false --verbose"
|
|
87
|
+
},
|
|
88
|
+
dependencies: {
|
|
89
|
+
"@kedaruma/revlm-shared": "workspace:*",
|
|
90
|
+
bson: "^6.10.4",
|
|
91
|
+
dotenv: "^17.2.3"
|
|
92
|
+
},
|
|
93
|
+
devDependencies: {
|
|
94
|
+
tsup: "^8.5.1"
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
30
100
|
// src/index.ts
|
|
31
101
|
var index_exports = {};
|
|
32
102
|
__export(index_exports, {
|
|
@@ -146,6 +216,29 @@ var RevlmDBDatabase = class {
|
|
|
146
216
|
};
|
|
147
217
|
|
|
148
218
|
// src/Revlm.ts
|
|
219
|
+
function normalizeLogLevel(value) {
|
|
220
|
+
if (!value) return "info";
|
|
221
|
+
const lowered = value.toLowerCase();
|
|
222
|
+
if (lowered === "true" || lowered === "1") return "debug";
|
|
223
|
+
if (lowered === "false" || lowered === "0") return "error";
|
|
224
|
+
if (lowered === "error" || lowered === "warn" || lowered === "info" || lowered === "debug") {
|
|
225
|
+
return lowered;
|
|
226
|
+
}
|
|
227
|
+
return "info";
|
|
228
|
+
}
|
|
229
|
+
function maskSecret(value) {
|
|
230
|
+
if (!value) return void 0;
|
|
231
|
+
return `<...:${value.length}>`;
|
|
232
|
+
}
|
|
233
|
+
function getRevlmClientVersion() {
|
|
234
|
+
try {
|
|
235
|
+
const pkg = require_package();
|
|
236
|
+
if (pkg && typeof pkg.version === "string") return pkg.version;
|
|
237
|
+
} catch {
|
|
238
|
+
}
|
|
239
|
+
const globalVersion = globalThis?.REVLM_CLIENT_VERSION;
|
|
240
|
+
return typeof globalVersion === "string" ? globalVersion : "unknown";
|
|
241
|
+
}
|
|
149
242
|
var Revlm = class {
|
|
150
243
|
baseUrl;
|
|
151
244
|
fetchImpl;
|
|
@@ -157,6 +250,7 @@ var Revlm = class {
|
|
|
157
250
|
autoSetToken;
|
|
158
251
|
autoRefreshOn401;
|
|
159
252
|
cookieCheckPromise;
|
|
253
|
+
logLevel;
|
|
160
254
|
constructor(baseUrl, opts = {}) {
|
|
161
255
|
if (!baseUrl) throw new Error("baseUrl is required");
|
|
162
256
|
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
@@ -167,9 +261,24 @@ var Revlm = class {
|
|
|
167
261
|
this.provisionalAuthDomain = opts.provisionalAuthDomain || "";
|
|
168
262
|
this.autoSetToken = opts.autoSetToken ?? true;
|
|
169
263
|
this.autoRefreshOn401 = opts.autoRefreshOn401 || false;
|
|
264
|
+
this.logLevel = normalizeLogLevel(opts.logLevel);
|
|
170
265
|
if (!this.fetchImpl) {
|
|
171
266
|
throw new Error("No fetch implementation available. Provide fetchImpl in options or run in Node 18+ with global fetch.");
|
|
172
267
|
}
|
|
268
|
+
if (this.logLevel === "debug" || this.logLevel === "info") {
|
|
269
|
+
console.log("\u{1F680} Revlm Client Init", {
|
|
270
|
+
version: getRevlmClientVersion(),
|
|
271
|
+
baseUrl: this.baseUrl,
|
|
272
|
+
autoSetToken: this.autoSetToken,
|
|
273
|
+
autoRefreshOn401: this.autoRefreshOn401,
|
|
274
|
+
provisionalEnabled: this.provisionalEnabled,
|
|
275
|
+
provisionalAuthDomain: this.provisionalAuthDomain || void 0,
|
|
276
|
+
provisionalAuthSecretMaster: maskSecret(this.provisionalAuthSecretMaster),
|
|
277
|
+
defaultHeaders: Object.keys(this.defaultHeaders || {}),
|
|
278
|
+
fetchImplProvided: !!opts.fetchImpl,
|
|
279
|
+
logLevel: this.logLevel
|
|
280
|
+
});
|
|
281
|
+
}
|
|
173
282
|
}
|
|
174
283
|
setToken(token) {
|
|
175
284
|
this._token = token;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,73 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__commonJS
|
|
3
|
+
} from "./chunk-EBO3CZXG.mjs";
|
|
4
|
+
|
|
5
|
+
// package.json
|
|
6
|
+
var require_package = __commonJS({
|
|
7
|
+
"package.json"(exports, module) {
|
|
8
|
+
module.exports = {
|
|
9
|
+
name: "@kedaruma/revlm-client",
|
|
10
|
+
version: "1.0.50",
|
|
11
|
+
private: false,
|
|
12
|
+
description: "TypeScript client SDK for talking to the Revlm server replacement for MongoDB Realm.",
|
|
13
|
+
keywords: [
|
|
14
|
+
"realm",
|
|
15
|
+
"realm-web",
|
|
16
|
+
"mongodb-realm",
|
|
17
|
+
"mongodb",
|
|
18
|
+
"realm-alternative",
|
|
19
|
+
"app-services",
|
|
20
|
+
"auth"
|
|
21
|
+
],
|
|
22
|
+
main: "dist/index.js",
|
|
23
|
+
module: "dist/index.mjs",
|
|
24
|
+
types: "dist/index.d.ts",
|
|
25
|
+
exports: {
|
|
26
|
+
".": {
|
|
27
|
+
import: {
|
|
28
|
+
types: "./dist/index.d.mts",
|
|
29
|
+
default: "./dist/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
require: {
|
|
32
|
+
types: "./dist/index.d.ts",
|
|
33
|
+
default: "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"./rn-setup": {
|
|
37
|
+
import: {
|
|
38
|
+
types: "./dist/rn-setup.d.mts",
|
|
39
|
+
default: "./dist/rn-setup.mjs"
|
|
40
|
+
},
|
|
41
|
+
require: {
|
|
42
|
+
types: "./dist/rn-setup.d.ts",
|
|
43
|
+
default: "./dist/rn-setup.js"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
sideEffects: false,
|
|
48
|
+
files: [
|
|
49
|
+
"dist/"
|
|
50
|
+
],
|
|
51
|
+
license: "ISC",
|
|
52
|
+
publishConfig: {
|
|
53
|
+
access: "public"
|
|
54
|
+
},
|
|
55
|
+
scripts: {
|
|
56
|
+
build: "tsup src/index.ts src/rn-setup.ts --format cjs,esm --dts --tsconfig tsconfig.build.json",
|
|
57
|
+
clean: "rm -rf dist node_modules kedaruma-revlm-client-*.tgz",
|
|
58
|
+
test: "pnpm exec jest --config ../../jest.config.cjs packages/revlm-client/src/__tests__/ --runInBand --watchman=false --verbose"
|
|
59
|
+
},
|
|
60
|
+
dependencies: {
|
|
61
|
+
"@kedaruma/revlm-shared": "workspace:*",
|
|
62
|
+
bson: "^6.10.4",
|
|
63
|
+
dotenv: "^17.2.3"
|
|
64
|
+
},
|
|
65
|
+
devDependencies: {
|
|
66
|
+
tsup: "^8.5.1"
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
2
71
|
|
|
3
72
|
// src/Revlm.ts
|
|
4
73
|
import { EJSON } from "bson";
|
|
@@ -103,6 +172,29 @@ var RevlmDBDatabase = class {
|
|
|
103
172
|
};
|
|
104
173
|
|
|
105
174
|
// src/Revlm.ts
|
|
175
|
+
function normalizeLogLevel(value) {
|
|
176
|
+
if (!value) return "info";
|
|
177
|
+
const lowered = value.toLowerCase();
|
|
178
|
+
if (lowered === "true" || lowered === "1") return "debug";
|
|
179
|
+
if (lowered === "false" || lowered === "0") return "error";
|
|
180
|
+
if (lowered === "error" || lowered === "warn" || lowered === "info" || lowered === "debug") {
|
|
181
|
+
return lowered;
|
|
182
|
+
}
|
|
183
|
+
return "info";
|
|
184
|
+
}
|
|
185
|
+
function maskSecret(value) {
|
|
186
|
+
if (!value) return void 0;
|
|
187
|
+
return `<...:${value.length}>`;
|
|
188
|
+
}
|
|
189
|
+
function getRevlmClientVersion() {
|
|
190
|
+
try {
|
|
191
|
+
const pkg = require_package();
|
|
192
|
+
if (pkg && typeof pkg.version === "string") return pkg.version;
|
|
193
|
+
} catch {
|
|
194
|
+
}
|
|
195
|
+
const globalVersion = globalThis?.REVLM_CLIENT_VERSION;
|
|
196
|
+
return typeof globalVersion === "string" ? globalVersion : "unknown";
|
|
197
|
+
}
|
|
106
198
|
var Revlm = class {
|
|
107
199
|
baseUrl;
|
|
108
200
|
fetchImpl;
|
|
@@ -114,6 +206,7 @@ var Revlm = class {
|
|
|
114
206
|
autoSetToken;
|
|
115
207
|
autoRefreshOn401;
|
|
116
208
|
cookieCheckPromise;
|
|
209
|
+
logLevel;
|
|
117
210
|
constructor(baseUrl, opts = {}) {
|
|
118
211
|
if (!baseUrl) throw new Error("baseUrl is required");
|
|
119
212
|
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
@@ -124,9 +217,24 @@ var Revlm = class {
|
|
|
124
217
|
this.provisionalAuthDomain = opts.provisionalAuthDomain || "";
|
|
125
218
|
this.autoSetToken = opts.autoSetToken ?? true;
|
|
126
219
|
this.autoRefreshOn401 = opts.autoRefreshOn401 || false;
|
|
220
|
+
this.logLevel = normalizeLogLevel(opts.logLevel);
|
|
127
221
|
if (!this.fetchImpl) {
|
|
128
222
|
throw new Error("No fetch implementation available. Provide fetchImpl in options or run in Node 18+ with global fetch.");
|
|
129
223
|
}
|
|
224
|
+
if (this.logLevel === "debug" || this.logLevel === "info") {
|
|
225
|
+
console.log("\u{1F680} Revlm Client Init", {
|
|
226
|
+
version: getRevlmClientVersion(),
|
|
227
|
+
baseUrl: this.baseUrl,
|
|
228
|
+
autoSetToken: this.autoSetToken,
|
|
229
|
+
autoRefreshOn401: this.autoRefreshOn401,
|
|
230
|
+
provisionalEnabled: this.provisionalEnabled,
|
|
231
|
+
provisionalAuthDomain: this.provisionalAuthDomain || void 0,
|
|
232
|
+
provisionalAuthSecretMaster: maskSecret(this.provisionalAuthSecretMaster),
|
|
233
|
+
defaultHeaders: Object.keys(this.defaultHeaders || {}),
|
|
234
|
+
fetchImplProvided: !!opts.fetchImpl,
|
|
235
|
+
logLevel: this.logLevel
|
|
236
|
+
});
|
|
237
|
+
}
|
|
130
238
|
}
|
|
131
239
|
setToken(token) {
|
|
132
240
|
this._token = token;
|
package/dist/rn-setup.mjs
CHANGED