@stacksjs/types 0.64.6 → 0.66.0

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.
Files changed (87) hide show
  1. package/dist/ai.d.ts +15 -0
  2. package/dist/analytics.d.ts +15 -0
  3. package/dist/api.d.ts +67 -0
  4. package/dist/app.d.ts +135 -0
  5. package/dist/auto-imports.d.ts +1 -0
  6. package/dist/binary.d.ts +11 -0
  7. package/dist/build.d.ts +2 -0
  8. package/dist/cache.d.ts +62 -0
  9. package/dist/cdn.d.ts +16 -0
  10. package/dist/chat.d.ts +3 -0
  11. package/dist/cli.d.ts +252 -0
  12. package/dist/cloud.d.ts +69 -0
  13. package/dist/components.d.ts +60 -0
  14. package/dist/configure.d.ts +12 -0
  15. package/dist/cron-jobs.d.ts +43 -0
  16. package/dist/database.d.ts +47 -0
  17. package/dist/dependencies.d.ts +62 -0
  18. package/dist/deploy.d.ts +16 -0
  19. package/dist/dns.d.ts +175 -0
  20. package/dist/docs.d.ts +22 -0
  21. package/dist/email.d.ts +11 -0
  22. package/dist/env.d.ts +0 -0
  23. package/dist/errors.d.ts +70 -0
  24. package/dist/events.d.ts +30 -0
  25. package/dist/exit-code.d.ts +10 -0
  26. package/dist/file-systems.d.ts +60 -0
  27. package/dist/git.d.ts +128 -0
  28. package/dist/hashing.d.ts +100 -0
  29. package/dist/helpers.d.ts +1 -0
  30. package/dist/i18n.d.ts +19 -0
  31. package/dist/index.d.ts +61 -0
  32. package/dist/index.js +3 -2
  33. package/dist/index.js.map +11 -10
  34. package/dist/inspect.d.ts +9 -0
  35. package/dist/layout.d.ts +0 -0
  36. package/dist/library.d.ts +142 -0
  37. package/dist/logging.d.ts +28 -0
  38. package/dist/manifest.d.ts +9 -0
  39. package/dist/model-names.d.ts +1 -0
  40. package/dist/model.d.ts +144 -0
  41. package/dist/native.d.ts +0 -0
  42. package/dist/notifications.d.ts +106 -0
  43. package/dist/pages.d.ts +10 -0
  44. package/dist/payments.d.ts +60 -0
  45. package/dist/ports.d.ts +20 -0
  46. package/dist/promise.d.ts +1 -0
  47. package/dist/push.d.ts +31 -0
  48. package/dist/pwa.d.ts +7 -0
  49. package/dist/queue.d.ts +34 -0
  50. package/dist/reactivity.d.ts +1 -0
  51. package/dist/request.d.ts +30 -0
  52. package/dist/router.d.ts +55 -0
  53. package/dist/scheduler.d.ts +1 -0
  54. package/dist/search-engine.d.ts +114 -0
  55. package/dist/security.d.ts +18 -0
  56. package/dist/server.d.ts +6 -0
  57. package/dist/services.d.ts +29 -0
  58. package/dist/settings-config.d.ts +9 -0
  59. package/dist/sms.d.ts +0 -0
  60. package/dist/ssg.d.ts +2 -0
  61. package/dist/stacks.d.ts +204 -0
  62. package/dist/storage.d.ts +12 -0
  63. package/dist/tables.d.ts +52 -0
  64. package/dist/team.d.ts +8 -0
  65. package/dist/ui.d.ts +165 -0
  66. package/dist/utils.d.ts +30 -0
  67. package/package.json +19 -19
  68. package/src/api.ts +6 -6
  69. package/src/app.ts +1 -1
  70. package/src/chat.ts +1 -1
  71. package/src/cli.ts +15 -3
  72. package/src/cloud.ts +1 -1
  73. package/src/cron-jobs.ts +1 -0
  74. package/src/deploy.ts +1 -0
  75. package/src/errors.ts +50 -51
  76. package/src/git.ts +1 -1
  77. package/src/helpers.ts +3 -2
  78. package/src/index.ts +8 -7
  79. package/src/model-names.ts +1 -10
  80. package/src/model.ts +35 -19
  81. package/src/notifications.ts +1 -5
  82. package/src/request.ts +16 -15
  83. package/src/router.ts +1 -0
  84. package/src/search-engine.ts +3 -3
  85. package/src/server.ts +16 -0
  86. package/src/settings-config.ts +2 -2
  87. package/src/stacks.ts +0 -1
package/src/errors.ts CHANGED
@@ -7,55 +7,54 @@
7
7
  // toString(): string
8
8
  // }
9
9
 
10
- // export type StacksError = Error
11
10
  export type CommandError = Error
12
11
 
13
12
  export interface ErrorOptions {
14
13
  messages: {
15
- string: string
16
- email: string
17
- regex: string
18
- url: string
19
- activeUrl: string
20
- alpha: string
21
- alphaNumeric: string
22
- minLength: string
23
- maxLength: string
24
- fixedLength: string
25
- confirmed: string
26
- endsWith: string
27
- startsWith: string
28
- sameAs: string
29
- notSameAs: string
30
- in: string
31
- notIn: string
32
- ipAddress: string
33
- uuid: string
34
- ascii: string
35
- creditCard: string
36
- hexCode: string
37
- iban: string
38
- jwt: string
39
- coordinates: string
40
- mobile: string
41
- passport: string
42
- postalCode: string
14
+ 'string': string
15
+ 'email': string
16
+ 'regex': string
17
+ 'url': string
18
+ 'activeUrl': string
19
+ 'alpha': string
20
+ 'alphaNumeric': string
21
+ 'minLength': string
22
+ 'maxLength': string
23
+ 'fixedLength': string
24
+ 'confirmed': string
25
+ 'endsWith': string
26
+ 'startsWith': string
27
+ 'sameAs': string
28
+ 'notSameAs': string
29
+ 'in': string
30
+ 'notIn': string
31
+ 'ipAddress': string
32
+ 'uuid': string
33
+ 'ascii': string
34
+ 'creditCard': string
35
+ 'hexCode': string
36
+ 'iban': string
37
+ 'jwt': string
38
+ 'coordinates': string
39
+ 'mobile': string
40
+ 'passport': string
41
+ 'postalCode': string
43
42
 
44
43
  // boolean
45
- boolean: string
44
+ 'boolean': string
46
45
 
47
46
  // number
48
- number: string
49
- min: string
50
- max: string
51
- range: string
52
- positive: string
53
- negative: string
54
- decimal: string
55
- withoutDecimals: string
47
+ 'number': string
48
+ 'min': string
49
+ 'max': string
50
+ 'range': string
51
+ 'positive': string
52
+ 'negative': string
53
+ 'decimal': string
54
+ 'withoutDecimals': string
56
55
 
57
56
  // date
58
- date: string
57
+ 'date': string
59
58
  'date.equals': string
60
59
  'date.after': string
61
60
  'date.before': string
@@ -66,38 +65,38 @@ export interface ErrorOptions {
66
65
  'date.afterField': string
67
66
 
68
67
  // accepted
69
- accepted: string
68
+ 'accepted': string
70
69
 
71
70
  // enum
72
- enum: string
71
+ 'enum': string
73
72
 
74
73
  // literal
75
- literal: string
74
+ 'literal': string
76
75
 
77
76
  // object
78
- object: string
77
+ 'object': string
79
78
 
80
79
  // record
81
- record: string
80
+ 'record': string
82
81
  'record.minLength': string
83
82
  'record.maxLength': string
84
83
  'record.fixedLength': string
85
84
 
86
85
  // array
87
- array: string
86
+ 'array': string
88
87
  'array.minLength': string
89
88
  'array.maxLength': string
90
89
  'array.fixedLength': string
91
- notEmpty: string
92
- distinct: string
90
+ 'notEmpty': string
91
+ 'distinct': string
93
92
 
94
93
  // tuple
95
- tuple: string
94
+ 'tuple': string
96
95
 
97
96
  // union
98
- union: string
99
- unionGroup: string
100
- unionOfTypes: string
97
+ 'union': string
98
+ 'unionGroup': string
99
+ 'unionOfTypes': string
101
100
  }
102
101
  }
103
102
 
package/src/git.ts CHANGED
@@ -111,7 +111,7 @@ interface Hooks {
111
111
  'post-merge'?: string
112
112
  'pre-push'?: string
113
113
  'pre-receive'?: string
114
- update?: string
114
+ 'update'?: string
115
115
  'proc-receive'?: string
116
116
  'post-receive'?: string
117
117
  'post-update'?: string
package/src/helpers.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { toString } from '@stacksjs/strings'
2
2
 
3
- export function getTypeName(v: any) {
4
- if (v === null) return 'null'
3
+ export function getTypeName(v: any): string {
4
+ if (v === null)
5
+ return 'null'
5
6
  const type = toString(v).slice(8, -1).toLowerCase()
6
7
 
7
8
  return typeof v === 'object' || typeof v === 'function' ? type : typeof v
package/src/index.ts CHANGED
@@ -18,14 +18,15 @@ export * from './dependencies'
18
18
  export * from './deploy'
19
19
  export * from './dns'
20
20
  export * from './docs'
21
- export * from './errors'
22
21
  export * from './email'
23
22
  export * from './env'
23
+ export * from './errors'
24
24
  export * from './events'
25
25
  export * from './exit-code'
26
26
  export * from './file-systems'
27
27
  export * from './git'
28
28
  export * from './hashing'
29
+ export * from './helpers'
29
30
  export * from './i18n'
30
31
  export * from './inspect'
31
32
  // export * from './layout'
@@ -39,24 +40,24 @@ export * from './pages'
39
40
  export * from './payments'
40
41
  export * from './ports'
41
42
  export * from './promise'
42
- export * from './pwa'
43
43
  export * from './push'
44
+ export * from './pwa'
44
45
  export * from './queue'
45
- export * from './request'
46
46
  export * from './reactivity'
47
+ export * from './request'
47
48
  export * from './router'
48
49
  export * from './scheduler'
49
50
  export * from './search-engine'
50
51
  export * from './security'
52
+ export * from './server'
51
53
  export * from './services'
52
54
  export * from './settings-config.ts'
53
55
  export * from './sms'
54
56
  export * from './ssg'
55
- export * from './storage'
56
57
  export * from './stacks'
57
- export * from './team'
58
+ export * from './storage'
58
59
  export * from './tables'
60
+ export * from './team'
59
61
  export * from './ui'
60
- export * from './utils'
61
62
 
62
- export * from './helpers'
63
+ export * from './utils'
@@ -1,10 +1 @@
1
- export type ModelNames =
2
- | 'Project'
3
- | 'SubscriberEmail'
4
- | 'AccessToken'
5
- | 'Team'
6
- | 'Subscriber'
7
- | 'Deployment'
8
- | 'Release'
9
- | 'User'
10
- | 'Post'
1
+ export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post'
package/src/model.ts CHANGED
@@ -4,13 +4,27 @@ import type { DeepPartial, Nullable, SearchOptions } from '.'
4
4
 
5
5
  export type Model = Partial<ModelOptions>
6
6
 
7
- export type AuthOptions = {
7
+ export interface FieldArrayElement {
8
+ entity: string
9
+ charValue?: string | null
10
+ // Add other properties as needed
11
+ }
12
+
13
+ export interface ModelElement {
14
+ field: string
15
+ default: string | number | boolean | Date | undefined | null
16
+ unique: boolean
17
+ fieldArray: FieldArrayElement | null
18
+ }
19
+
20
+ export interface AuthOptions {
8
21
  useTwoFactor?: boolean
22
+ usePasskey?: boolean
9
23
  }
10
24
 
11
25
  type ActionPath = string
12
26
  type ActionName = string
13
- type Action = ActionPath | ActionName
27
+ type Action = ActionPath | ActionName | undefined
14
28
 
15
29
  export type ApiRoutes = 'index' | 'show' | 'store' | 'update' | 'destroy'
16
30
 
@@ -21,7 +35,7 @@ export interface SeedOptions {
21
35
 
22
36
  type LogAttribute = string
23
37
 
24
- type ActivityLogOption = {
38
+ interface ActivityLogOption {
25
39
  exclude: LogAttribute[]
26
40
  include: LogAttribute[] // default to “*”
27
41
  logOnly: LogAttribute[]
@@ -38,9 +52,11 @@ interface BelongsToManyType {
38
52
  export interface ApiSettings {
39
53
  uri: string
40
54
  middleware: string[]
41
- routes: {
42
- [key in ApiRoutes]: Action
43
- }
55
+ routes:
56
+ | {
57
+ [key in ApiRoutes]: Action
58
+ }
59
+ | string[]
44
60
  openApi: boolean
45
61
  }
46
62
 
@@ -60,7 +76,7 @@ export interface SoftDeleteOptions {
60
76
  deletedAt?: string // defaults to 'deleted_at' & can be used for localized tables
61
77
  }
62
78
 
63
- type Base = {}
79
+ interface Base {}
64
80
 
65
81
  /**
66
82
  * Model.
@@ -102,24 +118,24 @@ export interface ModelOptions extends Base {
102
118
  // relationships
103
119
  hasOne?:
104
120
  | {
105
- model: ModelNames
106
- foreignKey?: string
107
- relationName?: string
108
- }[]
121
+ model: ModelNames
122
+ foreignKey?: string
123
+ relationName?: string
124
+ }[]
109
125
  | string[]
110
126
  hasMany?:
111
127
  | {
112
- model: ModelNames // should be typed as ModelName
113
- foreignKey?: string
114
- relationName?: string
115
- }[]
128
+ model: ModelNames // should be typed as ModelName
129
+ foreignKey?: string
130
+ relationName?: string
131
+ }[]
116
132
  | ModelNames[]
117
133
  belongsTo?:
118
134
  | {
119
- model: ModelNames // should be typed as ModelName
120
- foreignKey?: string
121
- relationName?: string
122
- }[]
135
+ model: ModelNames // should be typed as ModelName
136
+ foreignKey?: string
137
+ relationName?: string
138
+ }[]
123
139
  | ModelNames[] // belongsTo: 'User'
124
140
  belongsToMany?: BelongsToManyType[] | ModelNames[]
125
141
  hasOneThrough?: {
@@ -145,11 +145,7 @@ export interface NotificationOptions {
145
145
  secret: string
146
146
  }
147
147
 
148
- discord?: {
149
- // appId: string
150
- // clientId: string
151
- // secret: string
152
- }
148
+ // discord?: {}
153
149
  }
154
150
  }
155
151
  }
package/src/request.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { VineType } from '@stacksjs/types'
2
2
 
3
+ export type * from '../../../types/requests'
3
4
  interface RequestData {
4
- [key: string]: string
5
+ [key: string]: any
5
6
  }
6
7
 
7
8
  type RouteParams = { [key: string]: string | number } | null
@@ -16,31 +17,31 @@ interface CustomAttributes {
16
17
  }
17
18
 
18
19
  export interface RequestInstance {
19
- addQuery(url: URL): void
20
+ addQuery: (url: URL) => void
20
21
 
21
- addBodies(params: any): void
22
+ addBodies: (params: any) => void
22
23
 
23
- addParam(param: RouteParams): void
24
+ addParam: (param: RouteParams) => void
24
25
 
25
- get(element: string): string | number | undefined
26
+ get: <T>(element: T) => string | undefined
26
27
 
27
- header(element: string): string | number | boolean | null
28
+ header: (element: string) => string | number | boolean | null
28
29
 
29
- Header(element: string): string | number | boolean | null
30
+ Header: (element: string) => string | number | boolean | null
30
31
 
31
- all(): RequestData
32
+ all: () => RequestData
32
33
 
33
- validate(attributes: CustomAttributes): void
34
+ validate: (attributes: CustomAttributes) => void
34
35
 
35
- has(element: string): boolean
36
+ has: (element: string) => boolean
36
37
 
37
- isEmpty(): boolean
38
+ isEmpty: () => boolean
38
39
 
39
- extractParamsFromRoute(routePattern: string, pathname: string): void
40
+ extractParamsFromRoute: (routePattern: string, pathname: string) => void
40
41
 
41
- getParam(key: string): number | string | null
42
+ getParam: (key: string) => number | string | null
42
43
 
43
- getParams(): RouteParams
44
+ getParams: () => RouteParams
44
45
 
45
- getParamAsInt(key: string): number | null
46
+ getParamAsInt: (key: string) => number | null
46
47
  }
package/src/router.ts CHANGED
@@ -25,6 +25,7 @@ export interface MiddlewareOptions {
25
25
  name: string
26
26
  description?: string
27
27
  priority: number
28
+ // eslint-disable-next-line ts/no-unsafe-function-type
28
29
  handle: Function
29
30
  }
30
31
 
@@ -2,8 +2,8 @@ import type {
2
2
  EnqueuedTask,
3
3
  Hits,
4
4
  Index,
5
- IndexOptions,
6
5
  IndexesResults,
6
+ IndexOptions,
7
7
  MeiliSearch,
8
8
  Settings as MeilisearchOptions,
9
9
  DocumentOptions as RecordOptions,
@@ -151,11 +151,11 @@ export type {
151
151
  EnqueuedTask,
152
152
  Hits,
153
153
  Index,
154
- IndexOptions,
155
154
  IndexesResults,
155
+ IndexOptions,
156
156
  MeiliSearch,
157
- RecordOptions,
158
157
  MeilisearchOptions,
158
+ RecordOptions,
159
159
  SearchParams,
160
160
  SearchResponse,
161
161
  }
package/src/server.ts ADDED
@@ -0,0 +1,16 @@
1
+ export interface ServerOptions {
2
+ type?:
3
+ | 'frontend'
4
+ | 'backend'
5
+ | 'api'
6
+ | 'library'
7
+ | 'desktop'
8
+ | 'docs'
9
+ | 'email'
10
+ | 'admin'
11
+ | 'system-tray'
12
+ | 'database'
13
+ host?: string
14
+ port?: number
15
+ open?: boolean
16
+ }
@@ -1,10 +1,10 @@
1
- export type SettingsMenuOption = {
1
+ export interface SettingsMenuOption {
2
2
  label: string
3
3
  path: string
4
4
  icon?: MenuIcon
5
5
  }
6
6
 
7
- export type MenuIcon = {
7
+ export interface MenuIcon {
8
8
  name?: string
9
9
  source?: string
10
10
  }
package/src/stacks.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type {
2
2
  AiConfig,
3
3
  AnalyticsConfig,
4
- ApiConfig,
5
4
  AppConfig,
6
5
  BinaryConfig,
7
6
  CacheConfig,