@heyputer/puter.js 2.0.12 → 2.0.13
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 +15 -0
- package/dist/puter.js +4 -1
- package/package.json +1 -1
- package/src/index.js +16 -2
- package/src/init.cjs +4 -1
- package/src/modules/KV.js +0 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -45,8 +45,22 @@ const puterInit = (function() {
|
|
|
45
45
|
// 'web' means the SDK is running in a 3rd-party website.
|
|
46
46
|
env;
|
|
47
47
|
|
|
48
|
-
defaultAPIOrigin =
|
|
49
|
-
defaultGUIOrigin =
|
|
48
|
+
#defaultAPIOrigin = 'https://api.puter.com';
|
|
49
|
+
#defaultGUIOrigin = 'https://puter.com';
|
|
50
|
+
|
|
51
|
+
get defaultAPIOrigin() {
|
|
52
|
+
return globalThis.PUTER_API_ORIGIN || globalThis.PUTER_API_ORIGIN_ENV || this.#defaultAPIOrigin;
|
|
53
|
+
}
|
|
54
|
+
set defaultAPIOrigin(v) {
|
|
55
|
+
this.#defaultAPIOrigin = v;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get defaultGUIOrigin() {
|
|
59
|
+
return globalThis.PUTER_ORIGIN || globalThis.PUTER_ORIGIN_ENV || this.#defaultGUIOrigin;
|
|
60
|
+
}
|
|
61
|
+
set defaultGUIOrigin(v) {
|
|
62
|
+
this.#defaultGUIOrigin = v;
|
|
63
|
+
}
|
|
50
64
|
|
|
51
65
|
// An optional callback when the user is authenticated. This can be set by the app using the SDK.
|
|
52
66
|
onAuth;
|
package/src/init.cjs
CHANGED
|
@@ -7,7 +7,10 @@ const { resolve } = require('node:path');
|
|
|
7
7
|
* @returns {import('../index').puter} The `puter` object from puter.js
|
|
8
8
|
*/
|
|
9
9
|
const init = (authToken) => {
|
|
10
|
-
const goodContext = {
|
|
10
|
+
const goodContext = {
|
|
11
|
+
PUTER_API_ORIGIN: globalThis.PUTER_API_ORIGIN,
|
|
12
|
+
PUTER_ORIGIN: globalThis.PUTER_ORIGIN,
|
|
13
|
+
};
|
|
11
14
|
Object.getOwnPropertyNames(globalThis).forEach(name => {
|
|
12
15
|
try {
|
|
13
16
|
goodContext[name] = globalThis[name];
|
package/src/modules/KV.js
CHANGED
|
@@ -104,8 +104,6 @@ class KV{
|
|
|
104
104
|
*/
|
|
105
105
|
set = utils.make_driver_method(['key', 'value', 'expireAt'], 'puter-kvstore', undefined, 'set', {
|
|
106
106
|
preprocess: (args) => {
|
|
107
|
-
console.log(args);
|
|
108
|
-
|
|
109
107
|
// key cannot be undefined or null
|
|
110
108
|
if ( args.key === undefined || args.key === null ){
|
|
111
109
|
throw { message: 'Key cannot be undefined', code: 'key_undefined' };
|