@stacksjs/types 0.58.72 → 0.59.1
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/dist/ai.d.ts +15 -0
- package/dist/analytics.d.ts +19 -0
- package/dist/api.d.ts +59 -0
- package/dist/app.d.ts +135 -0
- package/dist/auto-imports.d.ts +1 -0
- package/dist/binary.d.ts +11 -0
- package/dist/build.d.ts +2 -0
- package/dist/cache.d.ts +88 -0
- package/dist/cdn.d.ts +16 -0
- package/dist/chat.d.ts +4 -0
- package/dist/cli.d.ts +278 -0
- package/dist/cloud.d.ts +69 -0
- package/dist/components.d.ts +60 -0
- package/dist/configure.d.ts +12 -0
- package/dist/cron-jobs.d.ts +43 -0
- package/dist/database.d.ts +37 -0
- package/dist/dependencies.d.ts +62 -0
- package/dist/deploy.d.ts +12 -0
- package/dist/dns.d.ts +175 -0
- package/dist/docs.d.ts +22 -0
- package/dist/email.d.ts +14 -0
- package/dist/env.d.ts +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/events.d.ts +30 -0
- package/dist/exit-code.d.ts +10 -0
- package/dist/file-systems.d.ts +60 -0
- package/dist/git.d.ts +129 -0
- package/dist/hashing.d.ts +109 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/i18n.d.ts +19 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +14 -1791
- package/dist/inspect.d.ts +9 -0
- package/dist/library.d.ts +134 -0
- package/dist/logger.d.ts +49 -0
- package/dist/manifest.d.ts +9 -0
- package/dist/model.d.ts +70 -0
- package/dist/money.d.ts +2 -0
- package/dist/notifications.d.ts +117 -0
- package/dist/pages.d.ts +10 -0
- package/dist/payments.d.ts +60 -0
- package/dist/ports.d.ts +19 -0
- package/dist/promise.d.ts +1 -0
- package/dist/push.d.ts +35 -0
- package/dist/pwa.d.ts +7 -0
- package/dist/queue.d.ts +36 -0
- package/dist/reactivity.d.ts +1 -0
- package/dist/router.d.ts +78 -0
- package/dist/scheduler.d.ts +1 -0
- package/dist/search-engine.d.ts +118 -0
- package/dist/security.d.ts +18 -0
- package/dist/services.d.ts +33 -0
- package/dist/sms.d.ts +1 -0
- package/dist/ssg.d.ts +2 -0
- package/dist/stacks.d.ts +196 -0
- package/dist/storage.d.ts +12 -0
- package/dist/tables.d.ts +52 -0
- package/dist/team.d.ts +8 -0
- package/dist/ui.d.ts +165 -0
- package/dist/utils.d.ts +33 -0
- package/package.json +9 -10
- package/src/app.ts +0 -21
- package/src/chat.ts +1 -2
- package/src/cli.ts +21 -3
- package/src/cloud.ts +2 -0
- package/src/email.ts +5 -2
- package/src/index.ts +1 -1
- package/src/model.ts +19 -9
- package/src/ports.ts +19 -0
- package/src/router.ts +24 -4
- package/src/scheduler.ts +1 -1
- package/src/services.ts +0 -4
- package/src/sms.ts +3 -3
- package/src/stacks.ts +10 -0
- package/src/request.ts +0 -3
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Null or whatever.
|
|
3
|
+
*/
|
|
4
|
+
export type Nullable<T> = T | null | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Function
|
|
7
|
+
*/
|
|
8
|
+
export type Fn<T = void> = () => T;
|
|
9
|
+
/**
|
|
10
|
+
* Array, or not yet
|
|
11
|
+
*/
|
|
12
|
+
export type Arrayable<T> = T | Array<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor.
|
|
15
|
+
*/
|
|
16
|
+
export type Constructor<T = void> = new (...args: any[]) => T;
|
|
17
|
+
/**
|
|
18
|
+
* Defines an intersection type of all union items.
|
|
19
|
+
*
|
|
20
|
+
* @param U Union of any types that will be intersected.
|
|
21
|
+
* @returns U items intersected
|
|
22
|
+
* @see https://stackoverflow.com/a/50375286/9259330
|
|
23
|
+
*/
|
|
24
|
+
export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
25
|
+
export type MergeInsertions<T> = T extends object ? {
|
|
26
|
+
[K in keyof T]: MergeInsertions<T[K]>;
|
|
27
|
+
} : T;
|
|
28
|
+
export type DeepMerge<F, S> = MergeInsertions<{
|
|
29
|
+
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
|
|
30
|
+
}>;
|
|
31
|
+
export type DeepPartial<T> = {
|
|
32
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/types",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.59.1",
|
|
5
5
|
"description": "The Stacks framework types.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -51,18 +51,17 @@
|
|
|
51
51
|
"@mdit-vue/plugin-component": "^2.0.0",
|
|
52
52
|
"@mdit-vue/plugin-frontmatter": "^2.0.0",
|
|
53
53
|
"@mdit-vue/types": "^2.0.0",
|
|
54
|
-
"@novu/stateless": "^0.23.1",
|
|
55
54
|
"@rollup/pluginutils": "^5.1.0",
|
|
56
55
|
"@stacksjs/validation": "latest",
|
|
57
56
|
"@types/aws4": "^1.11.6",
|
|
58
57
|
"@types/bcryptjs": "^2.4.6",
|
|
59
|
-
"@types/bun": "^1.0.
|
|
58
|
+
"@types/bun": "^1.0.8",
|
|
60
59
|
"@types/crypto-js": "^4.2.2",
|
|
61
|
-
"@types/eslint": "^8.56.
|
|
60
|
+
"@types/eslint": "^8.56.5",
|
|
62
61
|
"@types/fs-extra": "^11.0.4",
|
|
63
62
|
"@types/markdown-it-link-attributes": "^3.0.4",
|
|
64
63
|
"@types/minimatch": "^5.1.2",
|
|
65
|
-
"@types/node": "^20.11.
|
|
64
|
+
"@types/node": "^20.11.24",
|
|
66
65
|
"@types/nprogress": "^0.2.3",
|
|
67
66
|
"@vinejs/vine": "^1.7.1",
|
|
68
67
|
"cac": "^6.7.14",
|
|
@@ -73,15 +72,15 @@
|
|
|
73
72
|
"unocss": "^0.58.5",
|
|
74
73
|
"unplugin-auto-import": "^0.17.5",
|
|
75
74
|
"unplugin-vue-components": "^0.26.0",
|
|
76
|
-
"vite": "^5.1.
|
|
75
|
+
"vite": "^5.1.5",
|
|
77
76
|
"vite-plugin-inspect": "^0.8.3",
|
|
78
|
-
"vite-plugin-pwa": "^0.
|
|
77
|
+
"vite-plugin-pwa": "^0.19.2",
|
|
79
78
|
"vite-ssg": "^0.23.6",
|
|
80
|
-
"vitepress": "1.0.0-rc.
|
|
81
|
-
"vue": "^3.4.
|
|
79
|
+
"vitepress": "1.0.0-rc.44",
|
|
80
|
+
"vue": "^3.4.21"
|
|
82
81
|
},
|
|
83
82
|
"devDependencies": {
|
|
84
|
-
"aws-cdk-lib": "^2.
|
|
83
|
+
"aws-cdk-lib": "^2.131.0",
|
|
85
84
|
"typescript": "^5.3.3"
|
|
86
85
|
}
|
|
87
86
|
}
|
package/src/app.ts
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
export type AppEnvType = 'local' | 'dev' | 'stage' | 'prod' | string
|
|
2
2
|
|
|
3
|
-
interface Ports {
|
|
4
|
-
frontend: number
|
|
5
|
-
backend: number // proxies api
|
|
6
|
-
api: number // the Bun server
|
|
7
|
-
admin: number
|
|
8
|
-
library: number
|
|
9
|
-
desktop: number
|
|
10
|
-
email: number
|
|
11
|
-
docs: number
|
|
12
|
-
inspect: number
|
|
13
|
-
}
|
|
14
|
-
|
|
15
3
|
/**
|
|
16
4
|
* **Application Options**
|
|
17
5
|
*
|
|
@@ -104,15 +92,6 @@ export interface AppOptions {
|
|
|
104
92
|
*/
|
|
105
93
|
key: string
|
|
106
94
|
|
|
107
|
-
/**
|
|
108
|
-
* **Application Ports**
|
|
109
|
-
*
|
|
110
|
-
* This port is used by the Stacks servers when running your application, library, email services,
|
|
111
|
-
* and other services. You may change this port to any other port that is free
|
|
112
|
-
* on your machine, as long as the following 6 ports are also available.
|
|
113
|
-
*/
|
|
114
|
-
ports: Ports
|
|
115
|
-
|
|
116
95
|
/**
|
|
117
96
|
* **Application Timezone**
|
|
118
97
|
*
|
package/src/chat.ts
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BunFile } from 'bun'
|
|
2
|
+
import type { Ports } from './ports'
|
|
2
3
|
|
|
3
4
|
type ArrayBufferView = NodeJS.TypedArray | DataView
|
|
4
5
|
|
|
@@ -121,6 +122,16 @@ export interface CliOptions {
|
|
|
121
122
|
*/
|
|
122
123
|
silent?: boolean
|
|
123
124
|
|
|
125
|
+
/**
|
|
126
|
+
* **Quiet Mode**
|
|
127
|
+
*
|
|
128
|
+
* When you are using "quiet"-mode, the CLI will output minimally
|
|
129
|
+
* to the console.
|
|
130
|
+
*
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
quiet?: boolean
|
|
134
|
+
|
|
124
135
|
/**
|
|
125
136
|
* **Current Work Directory**
|
|
126
137
|
*
|
|
@@ -163,7 +174,7 @@ export interface CliOptions {
|
|
|
163
174
|
|
|
164
175
|
input?: string | ArrayBufferView | ReadableStream | Blob | Response | Request
|
|
165
176
|
|
|
166
|
-
|
|
177
|
+
project?: string // TODO: can create an action that automates creating a type for this
|
|
167
178
|
}
|
|
168
179
|
|
|
169
180
|
export type CliConfig = CliOptions
|
|
@@ -207,7 +218,7 @@ export type DevOptions = {
|
|
|
207
218
|
[key in DevOption]: boolean;
|
|
208
219
|
} & CliOptions
|
|
209
220
|
|
|
210
|
-
export type GeneratorOption = 'types' | 'entries' | 'webTypes' | 'customData' | 'ideHelpers' | 'componentMeta'
|
|
221
|
+
export type GeneratorOption = 'types' | 'entries' | 'webTypes' | 'customData' | 'ideHelpers' | 'componentMeta' | 'coreSymlink' | 'pkgxConfig'
|
|
211
222
|
export type GeneratorOptions = {
|
|
212
223
|
[key in GeneratorOption]?: boolean;
|
|
213
224
|
} & CliOptions
|
|
@@ -225,7 +236,8 @@ export type MakeOptions = {
|
|
|
225
236
|
[key in MakeStringOption]: string
|
|
226
237
|
} & CliOptions
|
|
227
238
|
|
|
228
|
-
export type UpgradeBoolean = 'framework' | 'dependencies' | '
|
|
239
|
+
export type UpgradeBoolean = 'framework' | 'dependencies' | 'bun' | 'shell' | 'binary' | 'all' | 'force'
|
|
240
|
+
|
|
229
241
|
export type UpgradeString = 'version'
|
|
230
242
|
|
|
231
243
|
export type UpgradeOptions = {
|
|
@@ -305,8 +317,14 @@ export interface InstallOptions extends CliOptions { }
|
|
|
305
317
|
export interface ReleaseOptions extends CliOptions {
|
|
306
318
|
dryRun?: boolean
|
|
307
319
|
}
|
|
320
|
+
export interface ProjectsOptions extends CliOptions {
|
|
321
|
+
list?: boolean
|
|
322
|
+
}
|
|
308
323
|
export interface PreinstallOptions extends CliOptions { }
|
|
309
324
|
export interface PrepublishOptions extends CliOptions { }
|
|
325
|
+
export interface PortsOptions extends CliOptions {
|
|
326
|
+
ports?: Partial<Ports>
|
|
327
|
+
}
|
|
310
328
|
export interface TinkerOptions extends CliOptions { }
|
|
311
329
|
export interface TypesOptions extends CliOptions { }
|
|
312
330
|
|
package/src/cloud.ts
CHANGED
package/src/email.ts
CHANGED
|
@@ -2,12 +2,15 @@ import type { IEmailOptions } from '@novu/stateless'
|
|
|
2
2
|
|
|
3
3
|
export type EmailOptions = Omit<IEmailOptions, 'from'> & {
|
|
4
4
|
from: {
|
|
5
|
-
name
|
|
6
|
-
address
|
|
5
|
+
name: string
|
|
6
|
+
address: string
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
mailboxes: string[]
|
|
10
10
|
|
|
11
|
+
url: string
|
|
12
|
+
charset: string // e.g. UTF-8
|
|
13
|
+
|
|
11
14
|
server: {
|
|
12
15
|
scan?: boolean
|
|
13
16
|
}
|
package/src/index.ts
CHANGED
|
@@ -37,12 +37,12 @@ export * from './money'
|
|
|
37
37
|
export * from './notifications'
|
|
38
38
|
export * from './pages'
|
|
39
39
|
export * from './payments'
|
|
40
|
+
export * from './ports'
|
|
40
41
|
export * from './promise'
|
|
41
42
|
export * from './pwa'
|
|
42
43
|
export * from './push'
|
|
43
44
|
export * from './queue'
|
|
44
45
|
export * from './reactivity'
|
|
45
|
-
export * from './request'
|
|
46
46
|
export * from './router'
|
|
47
47
|
export * from './scheduler'
|
|
48
48
|
export * from './search-engine'
|
package/src/model.ts
CHANGED
|
@@ -25,27 +25,37 @@ interface Base {}
|
|
|
25
25
|
export interface ModelOptions extends Base {
|
|
26
26
|
name: string // defaults to the file name of the model
|
|
27
27
|
table: string // defaults to the lowercase, plural name of the model
|
|
28
|
-
|
|
28
|
+
primaryKey?: string // defaults to `id`
|
|
29
|
+
autoIncrement?: boolean // defaults to true
|
|
30
|
+
|
|
31
|
+
traits: {
|
|
32
|
+
useUuid?: boolean // defaults to false
|
|
33
|
+
useTimestamps?: boolean | TimestampOptions // defaults to true
|
|
34
|
+
useSoftDeletes?: boolean | SoftDeleteOptions // defaults to false
|
|
35
|
+
|
|
36
|
+
useAuth?: boolean | AuthOptions // defaults to false
|
|
37
|
+
authenticatable?: boolean | AuthOptions // useAuth alias
|
|
38
|
+
useSeeder?: boolean | SeedOptions // defaults to a count of 10
|
|
39
|
+
seedable?: boolean | SeedOptions // useSeeder alias
|
|
40
|
+
useSearch?: boolean | SearchEngineSettings // defaults to false
|
|
41
|
+
searchable?: boolean | SearchEngineSettings // useSearch alias
|
|
42
|
+
}
|
|
43
|
+
|
|
29
44
|
fields: Fields
|
|
45
|
+
|
|
46
|
+
// relationships
|
|
30
47
|
hasOne: string // hasOne: 'Post'
|
|
31
48
|
hasMany: {
|
|
32
49
|
model: string // should be typed as ModelName
|
|
33
50
|
foreignKey?: string
|
|
34
51
|
}
|
|
52
|
+
belongsTo: string // belongsTo: 'User'
|
|
35
53
|
belongsToMany: object
|
|
36
54
|
hasThrough: {
|
|
37
55
|
model: string // should be typed as ModelName
|
|
38
56
|
through: string
|
|
39
57
|
using: string
|
|
40
58
|
}
|
|
41
|
-
authenticatable: boolean | AuthOptions
|
|
42
|
-
seedable: boolean | SeedOptions
|
|
43
|
-
searchable: boolean | SearchEngineSettings
|
|
44
|
-
useSeed: boolean | SeedOptions
|
|
45
|
-
useSearch: boolean | SearchEngineSettings
|
|
46
|
-
useSearchEngine: boolean | SearchEngineSettings
|
|
47
|
-
useTimestamps: boolean | TimestampOptions
|
|
48
|
-
useSoftDeletes: boolean | SoftDeleteOptions
|
|
49
59
|
|
|
50
60
|
attributes: {
|
|
51
61
|
[key: string]: {
|
package/src/ports.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Stacks Ports**
|
|
3
|
+
*
|
|
4
|
+
* This port is used by the Stacks servers when running your application, library, email services,
|
|
5
|
+
* and other services. You may change this port to any other port that is free
|
|
6
|
+
* on your machine, as long as the following 6 ports are also available.
|
|
7
|
+
*/
|
|
8
|
+
export interface Ports {
|
|
9
|
+
frontend: number
|
|
10
|
+
backend: number // proxies api
|
|
11
|
+
admin: number
|
|
12
|
+
library: number
|
|
13
|
+
desktop: number
|
|
14
|
+
email: number
|
|
15
|
+
docs: number
|
|
16
|
+
inspect: number
|
|
17
|
+
api: number // the bun server
|
|
18
|
+
systemTray: number
|
|
19
|
+
}
|
package/src/router.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Action } from '@stacksjs/actions'
|
|
2
|
+
import type { ActionPath } from '~/storage/framework/types/actions'
|
|
2
3
|
|
|
3
4
|
export interface NitroEventHandler {
|
|
4
5
|
/**
|
|
@@ -36,23 +37,22 @@ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'before'
|
|
|
36
37
|
|
|
37
38
|
export type RouteCallback = (params?: Record<string, any>) => any | string | object
|
|
38
39
|
|
|
39
|
-
type ActionName = string
|
|
40
40
|
export interface Route {
|
|
41
41
|
name: string
|
|
42
42
|
uri: string
|
|
43
43
|
url: string // used synonymously with uri
|
|
44
44
|
method: HttpMethod
|
|
45
45
|
pattern: RegExp
|
|
46
|
-
callback: RouteCallback |
|
|
46
|
+
callback: RouteCallback | ActionPath | Action | Promise<any> // we may be able to improve the `Promise<any>` if we could narrow this type `import('../app/Actions/BuddyAction')`
|
|
47
47
|
paramNames: string[]
|
|
48
48
|
middleware?: string | string[]
|
|
49
49
|
statusCode?: StatusCode
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export interface
|
|
52
|
+
export interface MiddlewareOptions {
|
|
53
53
|
name: string
|
|
54
|
+
description?: string
|
|
54
55
|
priority: number
|
|
55
|
-
|
|
56
56
|
handle: Function
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -71,3 +71,23 @@ export interface RouteGroupOptions {
|
|
|
71
71
|
prefix?: string
|
|
72
72
|
middleware?: Route['middleware']
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
type Prefix = string
|
|
76
|
+
|
|
77
|
+
export interface RouterInterface {
|
|
78
|
+
get: (url: Route['url'], callback: Route['callback']) => Promise<this>
|
|
79
|
+
post: (url: Route['url'], callback: Route['callback']) => this
|
|
80
|
+
view: (url: Route['url'], callback: Route['callback']) => this
|
|
81
|
+
redirect: (url: Route['url'], callback: Route['callback'], status?: RedirectCode) => this
|
|
82
|
+
delete: (url: Route['url'], callback: Route['callback']) => this
|
|
83
|
+
patch: (url: Route['url'], callback: Route['callback']) => this
|
|
84
|
+
put: (url: Route['url'], callback: Route['callback']) => this
|
|
85
|
+
email: (url: Route['url']) => Promise<this>
|
|
86
|
+
health: () => Promise<this>
|
|
87
|
+
job: (url: Route['url']) => Promise<this>
|
|
88
|
+
action: (url: Route['url']) => Promise<this>
|
|
89
|
+
group: (options: Prefix | RouteGroupOptions, callback: () => void) => this
|
|
90
|
+
name: (name: string) => this
|
|
91
|
+
middleware: (middleware: Route['middleware']) => this
|
|
92
|
+
getRoutes: () => Promise<Route[]>
|
|
93
|
+
}
|
package/src/scheduler.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { Schedule
|
|
1
|
+
export type { Schedule } from '@stacksjs/scheduler'
|
package/src/services.ts
CHANGED
package/src/sms.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ISmsOptions as SmsOptions } from '@novu/stateless'
|
|
1
|
+
// import type { ISmsOptions as SmsOptions } from '@novu/stateless'
|
|
2
2
|
|
|
3
|
-
export type { SmsOptions }
|
|
3
|
+
// export type { SmsOptions }
|
|
4
4
|
|
|
5
|
-
export type SmsConfig = SmsOptions
|
|
5
|
+
// export type SmsConfig = SmsOptions
|
package/src/stacks.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
LoggerConfig,
|
|
16
16
|
NotificationConfig,
|
|
17
17
|
PaymentConfig,
|
|
18
|
+
Ports,
|
|
18
19
|
QueueConfig,
|
|
19
20
|
SearchEngineConfig,
|
|
20
21
|
SecurityConfig,
|
|
@@ -169,6 +170,15 @@ export interface StacksOptions {
|
|
|
169
170
|
*/
|
|
170
171
|
payment: PaymentConfig
|
|
171
172
|
|
|
173
|
+
/**
|
|
174
|
+
* **Ports**
|
|
175
|
+
*
|
|
176
|
+
* This configuration defines all of your Ports options. Because Stacks is fully-typed, you
|
|
177
|
+
* may hover any of the options below and the definitions will be provided. In case you
|
|
178
|
+
* have any questions, feel free to reach out via Discord or GitHub Discussions.
|
|
179
|
+
*/
|
|
180
|
+
ports: Ports
|
|
181
|
+
|
|
172
182
|
/**
|
|
173
183
|
* **Queue Options**
|
|
174
184
|
*
|
package/src/request.ts
DELETED