@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyputer/puter.js",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "description": "Puter.js - A JavaScript library for interacting with Puter services.",
5
5
  "main": "src/index.js",
6
6
  "types": "index.d.ts",
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 = globalThis.PUTER_API_ORIGIN ?? 'https://api.puter.com';
49
- defaultGUIOrigin = globalThis.PUTER_ORIGIN ?? 'https://puter.com';
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' };