roboto-js 1.9.4 → 1.9.7
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/.last-build +1 -1
- package/README.md +580 -0
- package/dist/cjs/cookie_storage_adaptor.cjs +22 -7
- package/dist/cjs/index.cjs +251 -81
- package/dist/cjs/rbt_api.cjs +529 -298
- package/dist/cjs/version.cjs +2 -2
- package/dist/cookie_storage_adaptor.js +12 -26
- package/dist/esm/cookie_storage_adaptor.js +22 -7
- package/dist/esm/index.js +251 -81
- package/dist/esm/rbt_api.js +529 -298
- package/dist/esm/version.js +2 -2
- package/dist/index.js +118 -3
- package/dist/rbt_object.js +8 -4
- package/dist/version.js +2 -2
- package/package.json +1 -1
- package/src/cookie_storage_adaptor.js +14 -15
- package/src/index.js +123 -2
- package/src/rbt_api.js +164 -0
- package/src/version.js +2 -2
package/dist/cjs/version.cjs
CHANGED
|
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = void 0;
|
|
7
7
|
// Auto-generated version file
|
|
8
8
|
// DO NOT EDIT - This file is automatically updated from package.cjson
|
|
9
|
-
// Version: 1.9.
|
|
10
|
-
var version = exports.version = '1.9.
|
|
9
|
+
// Version: 1.9.7
|
|
10
|
+
var version = exports.version = '1.9.7';
|
|
@@ -43,6 +43,7 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
43
43
|
// Keys that should be stored without prefix for server-side access
|
|
44
44
|
serverAccessKeys: (_options$serverAccess = options.serverAccessKeys) !== null && _options$serverAccess !== void 0 ? _options$serverAccess : ['authtoken', 'accessKey', 'apikey']
|
|
45
45
|
}, options);
|
|
46
|
+
/*
|
|
46
47
|
console.log('[CookieStorageAdaptor] Initialized with options:', {
|
|
47
48
|
secure: this.options.secure,
|
|
48
49
|
sameSite: this.options.sameSite,
|
|
@@ -51,7 +52,7 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
51
52
|
domain: this.options.domain,
|
|
52
53
|
prefix: this.options.prefix,
|
|
53
54
|
serverAccessKeys: this.options.serverAccessKeys
|
|
54
|
-
})
|
|
55
|
+
})*/
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
/**
|
|
@@ -69,7 +70,6 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
69
70
|
_context.n = 1;
|
|
70
71
|
break;
|
|
71
72
|
}
|
|
72
|
-
console.log("[CookieStorageAdaptor] getItem(".concat(key, "): document undefined, returning null"));
|
|
73
73
|
return _context.a(2, null);
|
|
74
74
|
case 1:
|
|
75
75
|
// Check if this key should be stored without prefix for server access
|
|
@@ -77,11 +77,8 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
77
77
|
cookieName = usePrefix ? this.options.prefix + key : key;
|
|
78
78
|
name = cookieName + '=';
|
|
79
79
|
decodedCookie = decodeURIComponent(document.cookie);
|
|
80
|
-
cookies = decodedCookie.split(';');
|
|
81
|
-
console.log(
|
|
82
|
-
console.log("[CookieStorageAdaptor] Available cookies:", cookies.map(function (c) {
|
|
83
|
-
return c.trim().split('=')[0];
|
|
84
|
-
}).join(', '));
|
|
80
|
+
cookies = decodedCookie.split(';'); //console.log(`[CookieStorageAdaptor] getItem(${key}): looking for cookie "${cookieName}" ${usePrefix ? '(prefixed)' : '(server-accessible)'}`)
|
|
81
|
+
//console.log(`[CookieStorageAdaptor] Available cookies:`, cookies.map(c => c.trim().split('=')[0]).join(', '))
|
|
85
82
|
_iterator = _createForOfIteratorHelper(cookies);
|
|
86
83
|
_context.p = 2;
|
|
87
84
|
_iterator.s();
|
|
@@ -96,18 +93,14 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
96
93
|
_context.n = 6;
|
|
97
94
|
break;
|
|
98
95
|
}
|
|
99
|
-
rawValue = cookie.substring(name.length, cookie.length);
|
|
100
|
-
console.log("[CookieStorageAdaptor] Found cookie \"".concat(cookieName, "\" with raw value:"), rawValue);
|
|
101
|
-
|
|
96
|
+
rawValue = cookie.substring(name.length, cookie.length); //console.log(`[CookieStorageAdaptor] Found cookie "${cookieName}" with raw value:`, rawValue)
|
|
102
97
|
// Handle JSON values (like rbtUser)
|
|
103
98
|
_context.p = 4;
|
|
104
|
-
parsedValue = JSON.parse(rawValue);
|
|
105
|
-
console.log("[CookieStorageAdaptor] getItem(".concat(key, "): returning parsed JSON:"), parsedValue);
|
|
99
|
+
parsedValue = JSON.parse(rawValue); //console.log(`[CookieStorageAdaptor] getItem(${key}): returning parsed JSON:`, parsedValue)
|
|
106
100
|
return _context.a(2, parsedValue);
|
|
107
101
|
case 5:
|
|
108
102
|
_context.p = 5;
|
|
109
103
|
_t = _context.v;
|
|
110
|
-
console.log("[CookieStorageAdaptor] getItem(".concat(key, "): returning string value:"), rawValue);
|
|
111
104
|
return _context.a(2, rawValue);
|
|
112
105
|
case 6:
|
|
113
106
|
_context.n = 3;
|
|
@@ -124,7 +117,6 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
124
117
|
_iterator.f();
|
|
125
118
|
return _context.f(9);
|
|
126
119
|
case 10:
|
|
127
|
-
console.log("[CookieStorageAdaptor] getItem(".concat(key, "): cookie \"").concat(cookieName, "\" not found, returning null"));
|
|
128
120
|
return _context.a(2, null);
|
|
129
121
|
}
|
|
130
122
|
}, _callee, this, [[4, 5], [2, 8, 9, 10]]);
|
|
@@ -156,17 +148,14 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
156
148
|
// Check if this key should be stored without prefix for server access
|
|
157
149
|
usePrefix = !this.options.serverAccessKeys.includes(key);
|
|
158
150
|
cookieName = usePrefix ? this.options.prefix + key : key; // Stringify objects/arrays like localStorage does
|
|
159
|
-
cookieValue = _typeof(value) === 'object' ? JSON.stringify(value) : String(value);
|
|
160
|
-
console.log(
|
|
161
|
-
console.log(
|
|
162
|
-
console.log("[CookieStorageAdaptor] Cookie value:", cookieValue);
|
|
163
|
-
|
|
151
|
+
cookieValue = _typeof(value) === 'object' ? JSON.stringify(value) : String(value); //console.log(`[CookieStorageAdaptor] setItem(${key}): storing as "${cookieName}" ${usePrefix ? '(prefixed)' : '(server-accessible)'}`)
|
|
152
|
+
//console.log(`[CookieStorageAdaptor] Original value:`, value)
|
|
153
|
+
//console.log(`[CookieStorageAdaptor] Cookie value:`, cookieValue)
|
|
164
154
|
// Build cookie string with security options
|
|
165
155
|
secureFlag = this.options.secure ? '; Secure' : '';
|
|
166
156
|
domainFlag = this.options.domain ? "; Domain=".concat(this.options.domain) : '';
|
|
167
157
|
httpOnlyFlag = this.options.httpOnly ? '; HttpOnly' : '';
|
|
168
|
-
cookieString = "".concat(cookieName, "=").concat(encodeURIComponent(cookieValue), "; path=").concat(this.options.path, "; max-age=").concat(this.options.maxAge, "; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag).concat(httpOnlyFlag);
|
|
169
|
-
console.log("[CookieStorageAdaptor] Full cookie string:", cookieString);
|
|
158
|
+
cookieString = "".concat(cookieName, "=").concat(encodeURIComponent(cookieValue), "; path=").concat(this.options.path, "; max-age=").concat(this.options.maxAge, "; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag).concat(httpOnlyFlag); //console.log(`[CookieStorageAdaptor] Full cookie string:`, cookieString)
|
|
170
159
|
document.cookie = cookieString;
|
|
171
160
|
|
|
172
161
|
// Verify the cookie was set by immediately reading it back
|
|
@@ -210,9 +199,7 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
210
199
|
case 1:
|
|
211
200
|
// Check if this key should be stored without prefix for server access
|
|
212
201
|
usePrefix = !this.options.serverAccessKeys.includes(key);
|
|
213
|
-
cookieName = usePrefix ? this.options.prefix + key : key;
|
|
214
|
-
console.log("[CookieStorageAdaptor] removeItem(".concat(key, "): removing cookie \"").concat(cookieName, "\" ").concat(usePrefix ? '(prefixed)' : '(server-accessible)'));
|
|
215
|
-
|
|
202
|
+
cookieName = usePrefix ? this.options.prefix + key : key; //console.log(`[CookieStorageAdaptor] removeItem(${key}): removing cookie "${cookieName}" ${usePrefix ? '(prefixed)' : '(server-accessible)'}`)
|
|
216
203
|
// Check if cookie exists before removal
|
|
217
204
|
_context3.n = 2;
|
|
218
205
|
return this.getItem(key);
|
|
@@ -225,8 +212,7 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
225
212
|
}
|
|
226
213
|
secureFlag = this.options.secure ? '; Secure' : '';
|
|
227
214
|
domainFlag = this.options.domain ? "; Domain=".concat(this.options.domain) : '';
|
|
228
|
-
removalString = "".concat(cookieName, "=; path=").concat(this.options.path, "; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag);
|
|
229
|
-
console.log("[CookieStorageAdaptor] Removal cookie string:", removalString);
|
|
215
|
+
removalString = "".concat(cookieName, "=; path=").concat(this.options.path, "; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag); //console.log(`[CookieStorageAdaptor] Removal cookie string:`, removalString)
|
|
230
216
|
document.cookie = removalString;
|
|
231
217
|
|
|
232
218
|
// Verify the cookie was removed
|
|
@@ -42,6 +42,16 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
42
42
|
// Keys that should be stored without prefix for server-side access
|
|
43
43
|
serverAccessKeys: (_options$serverAccess = options.serverAccessKeys) !== null && _options$serverAccess !== void 0 ? _options$serverAccess : ['authtoken', 'accessKey', 'apikey']
|
|
44
44
|
}, options);
|
|
45
|
+
/*
|
|
46
|
+
console.log('[CookieStorageAdaptor] Initialized with options:', {
|
|
47
|
+
secure: this.options.secure,
|
|
48
|
+
sameSite: this.options.sameSite,
|
|
49
|
+
path: this.options.path,
|
|
50
|
+
maxAge: this.options.maxAge,
|
|
51
|
+
domain: this.options.domain,
|
|
52
|
+
prefix: this.options.prefix,
|
|
53
|
+
serverAccessKeys: this.options.serverAccessKeys
|
|
54
|
+
})*/
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
/**
|
|
@@ -66,7 +76,8 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
66
76
|
cookieName = usePrefix ? this.options.prefix + key : key;
|
|
67
77
|
name = cookieName + '=';
|
|
68
78
|
decodedCookie = decodeURIComponent(document.cookie);
|
|
69
|
-
cookies = decodedCookie.split(';');
|
|
79
|
+
cookies = decodedCookie.split(';'); //console.log(`[CookieStorageAdaptor] getItem(${key}): looking for cookie "${cookieName}" ${usePrefix ? '(prefixed)' : '(server-accessible)'}`)
|
|
80
|
+
//console.log(`[CookieStorageAdaptor] Available cookies:`, cookies.map(c => c.trim().split('=')[0]).join(', '))
|
|
70
81
|
_iterator = _createForOfIteratorHelper(cookies);
|
|
71
82
|
_context.prev = 8;
|
|
72
83
|
_iterator.s();
|
|
@@ -81,9 +92,10 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
81
92
|
_context.next = 23;
|
|
82
93
|
break;
|
|
83
94
|
}
|
|
84
|
-
rawValue = cookie.substring(name.length, cookie.length);
|
|
95
|
+
rawValue = cookie.substring(name.length, cookie.length); //console.log(`[CookieStorageAdaptor] Found cookie "${cookieName}" with raw value:`, rawValue)
|
|
96
|
+
// Handle JSON values (like rbtUser)
|
|
85
97
|
_context.prev = 15;
|
|
86
|
-
parsedValue = JSON.parse(rawValue);
|
|
98
|
+
parsedValue = JSON.parse(rawValue); //console.log(`[CookieStorageAdaptor] getItem(${key}): returning parsed JSON:`, parsedValue)
|
|
87
99
|
return _context.abrupt("return", parsedValue);
|
|
88
100
|
case 20:
|
|
89
101
|
_context.prev = 20;
|
|
@@ -137,12 +149,14 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
137
149
|
// Check if this key should be stored without prefix for server access
|
|
138
150
|
usePrefix = !this.options.serverAccessKeys.includes(key);
|
|
139
151
|
cookieName = usePrefix ? this.options.prefix + key : key; // Stringify objects/arrays like localStorage does
|
|
140
|
-
cookieValue = _typeof(value) === 'object' ? JSON.stringify(value) : String(value);
|
|
152
|
+
cookieValue = _typeof(value) === 'object' ? JSON.stringify(value) : String(value); //console.log(`[CookieStorageAdaptor] setItem(${key}): storing as "${cookieName}" ${usePrefix ? '(prefixed)' : '(server-accessible)'}`)
|
|
153
|
+
//console.log(`[CookieStorageAdaptor] Original value:`, value)
|
|
154
|
+
//console.log(`[CookieStorageAdaptor] Cookie value:`, cookieValue)
|
|
141
155
|
// Build cookie string with security options
|
|
142
156
|
secureFlag = this.options.secure ? '; Secure' : '';
|
|
143
157
|
domainFlag = this.options.domain ? "; Domain=".concat(this.options.domain) : '';
|
|
144
158
|
httpOnlyFlag = this.options.httpOnly ? '; HttpOnly' : '';
|
|
145
|
-
cookieString = "".concat(cookieName, "=").concat(encodeURIComponent(cookieValue), "; path=").concat(this.options.path, "; max-age=").concat(this.options.maxAge, "; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag).concat(httpOnlyFlag);
|
|
159
|
+
cookieString = "".concat(cookieName, "=").concat(encodeURIComponent(cookieValue), "; path=").concat(this.options.path, "; max-age=").concat(this.options.maxAge, "; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag).concat(httpOnlyFlag); //console.log(`[CookieStorageAdaptor] Full cookie string:`, cookieString)
|
|
146
160
|
document.cookie = cookieString;
|
|
147
161
|
|
|
148
162
|
// Verify the cookie was set by immediately reading it back
|
|
@@ -184,7 +198,8 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
184
198
|
case 2:
|
|
185
199
|
// Check if this key should be stored without prefix for server access
|
|
186
200
|
usePrefix = !this.options.serverAccessKeys.includes(key);
|
|
187
|
-
cookieName = usePrefix ? this.options.prefix + key : key;
|
|
201
|
+
cookieName = usePrefix ? this.options.prefix + key : key; //console.log(`[CookieStorageAdaptor] removeItem(${key}): removing cookie "${cookieName}" ${usePrefix ? '(prefixed)' : '(server-accessible)'}`)
|
|
202
|
+
// Check if cookie exists before removal
|
|
188
203
|
_context3.next = 6;
|
|
189
204
|
return this.getItem(key);
|
|
190
205
|
case 6:
|
|
@@ -192,7 +207,7 @@ var CookieStorageAdaptor = /*#__PURE__*/function () {
|
|
|
192
207
|
if (existingValue !== null) {} else {}
|
|
193
208
|
secureFlag = this.options.secure ? '; Secure' : '';
|
|
194
209
|
domainFlag = this.options.domain ? "; Domain=".concat(this.options.domain) : '';
|
|
195
|
-
removalString = "".concat(cookieName, "=; path=").concat(this.options.path, "; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag);
|
|
210
|
+
removalString = "".concat(cookieName, "=; path=").concat(this.options.path, "; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=").concat(this.options.sameSite).concat(secureFlag).concat(domainFlag); //console.log(`[CookieStorageAdaptor] Removal cookie string:`, removalString)
|
|
196
211
|
document.cookie = removalString;
|
|
197
212
|
|
|
198
213
|
// Verify the cookie was removed
|