@stackframe/stack-shared 2.7.22 → 2.7.25
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/CHANGELOG.md +10 -0
- package/dist/schema-fields.js +4 -0
- package/dist/utils/arrays.js +0 -1
- package/dist/utils/proxies.js +0 -31
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/schema-fields.js
CHANGED
|
@@ -171,6 +171,10 @@ export const adaptSchema = yupMixed();
|
|
|
171
171
|
* Yup's URL schema does not recognize some URLs (including `http://localhost`) as a valid URL. This schema is a workaround for that.
|
|
172
172
|
*/
|
|
173
173
|
export const urlSchema = yupString().test({
|
|
174
|
+
name: 'no-spaces',
|
|
175
|
+
message: (params) => `${params.path} contains spaces`,
|
|
176
|
+
test: (value) => value == null || !value.includes(' ')
|
|
177
|
+
}).test({
|
|
174
178
|
name: 'url',
|
|
175
179
|
message: (params) => `${params.path} is not a valid URL`,
|
|
176
180
|
test: (value) => value == null || isValidUrl(value)
|
package/dist/utils/arrays.js
CHANGED
|
@@ -75,7 +75,6 @@ import.meta.vitest?.test("groupBy", ({ expect }) => {
|
|
|
75
75
|
expect(grouped.get("odd")).toEqual([1, 3, 5]);
|
|
76
76
|
// Check the actual lengths of the words to ensure our test is correct
|
|
77
77
|
const words = ["apple", "banana", "cherry", "date", "elderberry"];
|
|
78
|
-
console.log("Word lengths:", words.map(w => `${w}: ${w.length}`));
|
|
79
78
|
const byLength = groupBy(words, (w) => w.length);
|
|
80
79
|
// Adjust expectations based on actual word lengths
|
|
81
80
|
expect(byLength.get(5)).toEqual(["apple"]);
|
package/dist/utils/proxies.js
CHANGED
|
@@ -57,37 +57,6 @@ export function logged(name, toLog, options = {}) {
|
|
|
57
57
|
});
|
|
58
58
|
return proxy;
|
|
59
59
|
}
|
|
60
|
-
import.meta.vitest?.test("logged", ({ expect }) => {
|
|
61
|
-
// Test with a simple object
|
|
62
|
-
const obj = {
|
|
63
|
-
value: 42,
|
|
64
|
-
method(x) { return x * 2; }
|
|
65
|
-
};
|
|
66
|
-
const loggedObj = logged("testObj", obj);
|
|
67
|
-
// Test property access
|
|
68
|
-
expect(loggedObj.value).toBe(42);
|
|
69
|
-
// Test method call
|
|
70
|
-
const result = loggedObj.method(21);
|
|
71
|
-
expect(result).toBe(42);
|
|
72
|
-
// Test property setting
|
|
73
|
-
loggedObj.value = 100;
|
|
74
|
-
expect(loggedObj.value).toBe(100);
|
|
75
|
-
// Test with a promise-returning method
|
|
76
|
-
const asyncObj = {
|
|
77
|
-
async asyncMethod(x) { return x * 3; }
|
|
78
|
-
};
|
|
79
|
-
const loggedAsyncObj = logged("asyncObj", asyncObj);
|
|
80
|
-
// Test async method
|
|
81
|
-
const promise = loggedAsyncObj.asyncMethod(7);
|
|
82
|
-
expect(promise instanceof Promise).toBe(true);
|
|
83
|
-
// Test error handling
|
|
84
|
-
const errorObj = {
|
|
85
|
-
throwError() { throw new Error("Test error"); }
|
|
86
|
-
};
|
|
87
|
-
const loggedErrorObj = logged("errorObj", errorObj);
|
|
88
|
-
// Test error throwing
|
|
89
|
-
expect(() => loggedErrorObj.throwError()).toThrow("Test error");
|
|
90
|
-
});
|
|
91
60
|
export function createLazyProxy(factory) {
|
|
92
61
|
let cache = undefined;
|
|
93
62
|
let initialized = false;
|