stacks 0.49.1 → 0.49.3
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 +2 -2
- package/buddy/README.md +2 -2
- package/buddy/package.json +3 -3
- package/buddy/src/commands/dev.ts +15 -2
- package/buddy/src/commands/fresh.ts +1 -1
- package/buddy/src/commands/lint.ts +2 -2
- package/buddy/src/commands/release.ts +8 -0
- package/components/vue/package.json +1 -1
- package/components/web/package.json +1 -1
- package/core/actions/package.json +3 -3
- package/core/actions/src/dev.ts +0 -2
- package/core/actions/src/helpers/utils.ts +2 -2
- package/core/actions/src/lint-fix.ts +1 -1
- package/core/ai/package.json +3 -3
- package/core/alias/package.json +3 -3
- package/core/arrays/package.json +3 -3
- package/core/arrays/src/index.ts +14 -0
- package/core/auth/package.json +3 -3
- package/core/build/package.json +3 -3
- package/core/cache/package.json +7 -5
- package/core/cache/src/drivers/memcached.ts +1 -1
- package/core/cache/src/drivers/upstash.ts +2 -0
- package/core/cache/src/index.ts +1 -0
- package/core/chat/package.json +3 -4
- package/core/cli/README.md +1 -1
- package/core/cli/package.json +3 -3
- package/core/cli/src/actions/run.ts +4 -1
- package/core/cli/src/helpers.ts +1 -1
- package/core/cloud/package.json +3 -3
- package/core/collections/package.json +3 -3
- package/core/config/package.json +3 -3
- package/core/dashboard/package.json +3 -3
- package/core/database/package.json +4 -4
- package/core/datetime/package.json +3 -3
- package/core/desktop/node_modules/.bin/tauri +2 -2
- package/core/desktop/package.json +4 -4
- package/core/docs/node_modules/.bin/vitepress +2 -2
- package/core/docs/package.json +4 -4
- package/core/domains/package.json +3 -3
- package/core/drivers/package.json +3 -3
- package/core/email/package.json +4 -4
- package/core/error-handling/package.json +3 -3
- package/core/events/package.json +3 -3
- package/core/git/node_modules/.bin/commitizen +2 -2
- package/core/git/node_modules/.bin/cz +2 -2
- package/core/git/node_modules/.bin/git-cz +2 -2
- package/core/git/package.json +3 -3
- package/core/health/package.json +3 -3
- package/core/lint/package.json +3 -3
- package/core/logging/package.json +3 -3
- package/core/modules/package.json +3 -3
- package/core/notifications/README.md +3 -0
- package/core/notifications/build.config.ts +1 -0
- package/core/notifications/package.json +6 -5
- package/core/notifications/src/index.ts +2 -2
- package/core/objects/package.json +3 -3
- package/core/objects/src/index.ts +17 -1
- package/core/path/package.json +3 -3
- package/core/payments/package.json +3 -3
- package/core/push/package.json +3 -4
- package/core/queue/README.md +59 -0
- package/core/{chat/node_modules/.bin/maizzle → queue/node_modules/.bin/mkdist} +2 -2
- package/core/{push/node_modules/.bin/maizzle → queue/node_modules/.bin/tsc} +2 -2
- package/core/{sms/node_modules/.bin/maizzle → queue/node_modules/.bin/tsserver} +2 -2
- package/core/queue/package.json +54 -0
- package/core/queue/src/index.ts +1 -0
- package/core/queue/tests/example.test.ts +7 -0
- package/core/realtime/package.json +3 -3
- package/core/router/package.json +3 -3
- package/core/search-engine/package.json +4 -4
- package/core/search-engine/src/index.ts +0 -1
- package/core/security/package.json +3 -3
- package/core/server/package.json +3 -3
- package/core/sms/package.json +3 -5
- package/core/storage/package.json +3 -3
- package/core/storage/src/index.ts +1 -3
- package/core/strings/package.json +3 -3
- package/core/tables/dist/index.html +15 -0
- package/core/tables/package.json +2 -2
- package/core/tables/vite.config.ts +1 -1
- package/core/testing/node_modules/.bin/vitest +2 -2
- package/core/testing/package.json +6 -6
- package/core/types/node_modules/.bin/vitepress +2 -2
- package/core/types/package.json +5 -5
- package/core/types/src/cli.ts +5 -5
- package/core/types/src/notifications.ts +2 -2
- package/core/ui/package.json +4 -4
- package/core/utils/node_modules/.bin/rimraf +2 -2
- package/core/utils/package.json +7 -7
- package/core/utils/src/base.ts +14 -5
- package/core/utils/src/equal.ts +27 -0
- package/core/utils/src/helpers.ts +2 -1
- package/core/utils/src/index.ts +5 -4
- package/core/utils/src/is.ts +11 -9
- package/core/utils/src/p.ts +4 -3
- package/core/utils/src/promise.ts +50 -17
- package/core/x-ray/package.json +3 -3
- package/functions/package.json +1 -1
- package/package.json +4 -4
package/core/utils/src/is.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { toString } from './base'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// export const isWindow = (val: any): boolean => typeof window !== 'undefined' && toString(val) === '[object Window]'
|
|
3
|
+
export const isDef = <T = any>(val?: T): val is T => typeof val !== 'undefined'
|
|
4
|
+
export const isBoolean = (val: any): val is boolean => typeof val === 'boolean'
|
|
5
|
+
export const isFunction = <T extends Function> (val: any): val is T => typeof val === 'function'
|
|
6
|
+
export const isNumber = (val: any): val is number => typeof val === 'number'
|
|
7
|
+
export const isString = (val: unknown): val is string => typeof val === 'string'
|
|
8
|
+
export const isObject = (val: any): val is object => toString(val) === '[object Object]'
|
|
9
|
+
export const isWindow = (val: any): boolean => typeof window !== 'undefined' && toString(val) === '[object Window]'
|
|
11
10
|
export const isBrowser = typeof window !== 'undefined'
|
|
12
11
|
export const isServer = typeof document === 'undefined' // https://remix.run/docs/en/v1/pages/gotchas#typeof-window-checks
|
|
12
|
+
export const isMap = (val: any): val is Map<any, any> => toString(val) === '[object Map]'
|
|
13
|
+
export const isSet = (val: any): val is Set<any> => toString(val) === '[object Set]'
|
|
14
|
+
export const isPromise = <T = any>(val: any): val is Promise<T> => isObject(val) && isFunction(val.then) && isFunction(val.catch)
|
package/core/utils/src/p.ts
CHANGED
|
@@ -81,10 +81,11 @@ class PInstance<T = any> extends Promise<Awaited<T>[]> {
|
|
|
81
81
|
|
|
82
82
|
then(fn?: () => PromiseLike<any>) {
|
|
83
83
|
const p = this.promise
|
|
84
|
+
|
|
84
85
|
if (fn)
|
|
85
86
|
return p.then(fn)
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
return p
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
catch(fn?: (err: unknown) => PromiseLike<any>) {
|
|
@@ -103,7 +104,7 @@ class PInstance<T = any> extends Promise<Awaited<T>[]> {
|
|
|
103
104
|
* @category Promise
|
|
104
105
|
* @example
|
|
105
106
|
* ```
|
|
106
|
-
* import { p } from '@
|
|
107
|
+
* import { p } from '@stacksjs/utils'
|
|
107
108
|
*
|
|
108
109
|
* const items = [1, 2, 3, 4, 5]
|
|
109
110
|
*
|
|
@@ -1,22 +1,48 @@
|
|
|
1
1
|
import { remove } from '@stacksjs/arrays'
|
|
2
2
|
import type { Fn } from '@stacksjs/types'
|
|
3
3
|
|
|
4
|
+
export interface SingletonPromiseReturn<T> {
|
|
5
|
+
(): Promise<T>
|
|
6
|
+
/**
|
|
7
|
+
* Reset current staled promise.
|
|
8
|
+
* Await it to have proper shutdown.
|
|
9
|
+
*/
|
|
10
|
+
reset: () => Promise<void>
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
14
|
+
* Promise with `resolve` and `reject` methods of itself
|
|
15
|
+
*/
|
|
16
|
+
export interface ControlledPromise<T = void> extends Promise<T> {
|
|
17
|
+
resolve(value: T | PromiseLike<T>): void
|
|
18
|
+
reject(reason?: any): void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Create singleton promise function.
|
|
6
23
|
*
|
|
7
24
|
* @category Promise
|
|
8
25
|
*/
|
|
9
|
-
export function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
export function createSingletonPromise<T>(fn: () => Promise<T>): SingletonPromiseReturn<T> {
|
|
27
|
+
let _promise: Promise<T> | undefined
|
|
28
|
+
|
|
29
|
+
function wrapper() {
|
|
30
|
+
if (!_promise)
|
|
31
|
+
_promise = fn()
|
|
32
|
+
return _promise
|
|
33
|
+
}
|
|
34
|
+
wrapper.reset = async () => {
|
|
35
|
+
const _prev = _promise
|
|
36
|
+
_promise = undefined
|
|
37
|
+
if (_prev)
|
|
38
|
+
await _prev
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return wrapper
|
|
16
42
|
}
|
|
17
43
|
|
|
18
44
|
/**
|
|
19
|
-
* Create a promise lock
|
|
45
|
+
* Create a promise lock.
|
|
20
46
|
*
|
|
21
47
|
* @category Promise
|
|
22
48
|
* @example
|
|
@@ -57,14 +83,6 @@ export function createPromiseLock() {
|
|
|
57
83
|
}
|
|
58
84
|
}
|
|
59
85
|
|
|
60
|
-
/**
|
|
61
|
-
* Promise with `resolve` and `reject` methods of itself
|
|
62
|
-
*/
|
|
63
|
-
export interface ControlledPromise<T = void> extends Promise<T> {
|
|
64
|
-
resolve(value: T | PromiseLike<T>): void
|
|
65
|
-
reject(reason?: any): void
|
|
66
|
-
}
|
|
67
|
-
|
|
68
86
|
/**
|
|
69
87
|
* Return a Promise with `resolve` and `reject` methods
|
|
70
88
|
*
|
|
@@ -89,3 +107,18 @@ export function createControlledPromise<T>(): ControlledPromise<T> {
|
|
|
89
107
|
promise.reject = reject
|
|
90
108
|
return promise
|
|
91
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Promised `setTimeout`.
|
|
113
|
+
*
|
|
114
|
+
* @category Promise
|
|
115
|
+
*/
|
|
116
|
+
export function sleep(ms: number, callback?: Fn<any>) {
|
|
117
|
+
return new Promise<void>(resolve =>
|
|
118
|
+
|
|
119
|
+
setTimeout(async () => {
|
|
120
|
+
await callback?.()
|
|
121
|
+
resolve()
|
|
122
|
+
}, ms),
|
|
123
|
+
)
|
|
124
|
+
}
|
package/core/x-ray/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/x-ray",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
5
|
-
"packageManager": "pnpm@7.25.
|
|
4
|
+
"version": "0.49.3",
|
|
5
|
+
"packageManager": "pnpm@7.25.1",
|
|
6
6
|
"description": "All you need to debug, log & analyze.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
],
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=v18.13.0",
|
|
42
|
-
"pnpm": ">=7.25.
|
|
42
|
+
"pnpm": ">=7.25.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "echo 'wip'",
|
package/functions/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stacks",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
5
|
-
"packageManager": "pnpm@7.25.
|
|
4
|
+
"version": "0.49.3",
|
|
5
|
+
"packageManager": "pnpm@7.25.1",
|
|
6
6
|
"description": "The Stacks framework.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"license": "MIT",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
],
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=v18.13.0",
|
|
64
|
-
"pnpm": ">=7.25.
|
|
64
|
+
"pnpm": ">=7.25.1"
|
|
65
65
|
},
|
|
66
66
|
"web-types": "./web-types.json",
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@stacksjs/buddy": "0.49.
|
|
68
|
+
"@stacksjs/buddy": "0.49.3"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"buddy": "esno ./buddy/src/cli.ts",
|