@stacksjs/types 0.66.0 → 0.68.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 (80) hide show
  1. package/dist/ai.d.ts +17 -14
  2. package/dist/analytics.d.ts +12 -14
  3. package/dist/api.d.ts +25 -66
  4. package/dist/app.d.ts +29 -134
  5. package/dist/auto-imports.d.ts +1 -1
  6. package/dist/binary.d.ts +7 -10
  7. package/dist/build.d.ts +2 -2
  8. package/dist/cache.d.ts +48 -61
  9. package/dist/cdn.d.ts +3 -15
  10. package/dist/chat.d.ts +2 -2
  11. package/dist/cli.d.ts +252 -238
  12. package/dist/cloud.d.ts +305 -68
  13. package/dist/components.d.ts +11 -59
  14. package/dist/configure.d.ts +11 -11
  15. package/dist/cron-jobs.d.ts +34 -41
  16. package/dist/database.d.ts +50 -45
  17. package/dist/dependencies.d.ts +15 -61
  18. package/dist/deploy.d.ts +10 -16
  19. package/dist/dns.d.ts +349 -167
  20. package/dist/docs.d.ts +20 -19
  21. package/dist/email.d.ts +15 -10
  22. package/dist/errors.d.ts +87 -69
  23. package/dist/events.d.ts +3 -30
  24. package/dist/exit-code.d.ts +4 -9
  25. package/dist/file-systems.d.ts +52 -56
  26. package/dist/git.d.ts +54 -126
  27. package/dist/hashing.d.ts +30 -97
  28. package/dist/helpers.d.ts +1 -1
  29. package/dist/i18n.d.ts +10 -18
  30. package/dist/index.d.ts +62 -61
  31. package/dist/index.js +1 -4
  32. package/dist/inspect.d.ts +3 -9
  33. package/dist/library.d.ts +798 -139
  34. package/dist/logging.d.ts +5 -27
  35. package/dist/manifest.d.ts +6 -9
  36. package/dist/model-names.d.ts +1 -1
  37. package/dist/model.d.ts +150 -130
  38. package/dist/notifications.d.ts +150 -105
  39. package/dist/pages.d.ts +10 -10
  40. package/dist/payments.d.ts +84 -55
  41. package/dist/ports.d.ts +13 -20
  42. package/dist/promise.d.ts +1 -1
  43. package/dist/push.d.ts +34 -30
  44. package/dist/pwa.d.ts +3 -7
  45. package/dist/queue.d.ts +36 -33
  46. package/dist/reactivity.d.ts +1 -1
  47. package/dist/request.d.ts +39 -26
  48. package/dist/router.d.ts +51 -51
  49. package/dist/saas.d.ts +32 -0
  50. package/dist/scheduler.d.ts +1 -1
  51. package/dist/search-engine.d.ts +85 -111
  52. package/dist/security.d.ts +18 -16
  53. package/dist/server.d.ts +16 -6
  54. package/dist/services.d.ts +34 -28
  55. package/dist/settings-config.d.ts +8 -8
  56. package/dist/ssg.d.ts +3 -2
  57. package/dist/stacks.d.ts +53 -203
  58. package/dist/storage.d.ts +29 -11
  59. package/dist/tables.d.ts +34 -52
  60. package/dist/team.d.ts +7 -8
  61. package/dist/ui.d.ts +39 -162
  62. package/dist/utils.d.ts +20 -30
  63. package/package.json +9 -10
  64. package/src/cache.ts +18 -0
  65. package/src/cli.ts +4 -0
  66. package/src/cloud.ts +16 -4
  67. package/src/errors.ts +8 -0
  68. package/src/index.ts +1 -0
  69. package/src/model-names.ts +1 -1
  70. package/src/model.ts +6 -0
  71. package/src/payments.ts +32 -0
  72. package/src/router.ts +1 -2
  73. package/src/saas.ts +33 -0
  74. package/src/stacks.ts +10 -0
  75. package/src/storage.ts +27 -0
  76. package/dist/env.d.ts +0 -0
  77. package/dist/index.js.map +0 -20
  78. package/dist/layout.d.ts +0 -0
  79. package/dist/native.d.ts +0 -0
  80. package/dist/sms.d.ts +0 -0
package/dist/tables.d.ts CHANGED
@@ -1,52 +1,34 @@
1
- import type { Hits, SearchResponse } from "meilisearch";
2
- /**
3
- * the TableStore interface is primarily used to unify the persisting of data to localStorage
4
- */
5
- export interface TableStore {
6
- /**
7
- * The search engine index name.
8
- * i.e. the type of table, like `users`, `posts`, `products`, etc.
9
- */
10
- index: string;
11
- /**
12
- * The search engine results object.
13
- */
14
- results?: SearchResponse<Record<string, any>>;
15
- /**
16
- * The search engine hits object.
17
- */
18
- hits?: Hits;
19
- columns: string[];
20
- source?: string;
21
- password?: string;
22
- searchable?: string | boolean;
23
- query?: string;
24
- sortable?: string | boolean;
25
- sort?: string;
26
- sorts?: string | string[];
27
- filterable?: string | boolean;
28
- filters?: string | string[];
29
- filterValue?: any[];
30
- actionable?: string | boolean;
31
- actions?: string | string[];
32
- perPage: number;
33
- selectable?: string | boolean;
34
- selectedRows?: number[] | string[];
35
- selectedAll?: boolean;
36
- goToNextPage: number;
37
- goToPage: number;
38
- goToPrevPage: number;
39
- lastPageNumber: number;
40
- searchFilters?: object;
41
- searchParams?: object;
42
- setTotalHits: number;
43
- /**
44
- *
45
- * The current page number
46
- * @default 1
47
- * @type {number}
48
- * @memberof TableStore
49
- * @example 1
50
- */
51
- currentPage: number;
52
- }
1
+ import type { Hits, SearchResponse } from 'meilisearch';
2
+
3
+ export declare interface TableStore {
4
+ index: string
5
+ results?: SearchResponse<Record<string, any>>
6
+ hits?: Hits
7
+
8
+ columns: string[]
9
+ source?: string
10
+ password?: string
11
+ searchable?: string | boolean
12
+ query?: string
13
+ sortable?: string | boolean
14
+ sort?: string
15
+ sorts?: string | string[]
16
+ filterable?: string | boolean
17
+ filters?: string | string[]
18
+ filterValue?: any[]
19
+ actionable?: string | boolean
20
+ actions?: string | string[]
21
+ perPage: number
22
+ selectable?: string | boolean
23
+ selectedRows?: number[] | string[]
24
+ selectedAll?: boolean
25
+ goToNextPage: number
26
+ goToPage: number
27
+ goToPrevPage: number
28
+ lastPageNumber: number
29
+ searchFilters?: object
30
+ searchParams?: object
31
+ setTotalHits: number
32
+
33
+ currentPage: number
34
+ }
package/dist/team.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- type TeamMemberName = string;
2
- type Email = string;
3
- type TeamMembers = Record<TeamMemberName, Email>;
4
- export interface Team {
5
- name: string;
6
- members?: TeamMembers;
7
- }
8
- export {};
1
+ declare type TeamMemberName = string
2
+ type Email = string
3
+ type TeamMembers = Record<TeamMemberName, Email>
4
+ export declare interface Team {
5
+ name: string
6
+ members?: TeamMembers
7
+ }
package/dist/ui.d.ts CHANGED
@@ -1,165 +1,42 @@
1
- import type { UserConfig } from "@unocss/core";
2
- import type { UserShortcuts } from "unocss";
3
- export type Font = "inter" | "mona" | "hubot";
4
- export type Icon = "heroicons";
5
- export type WebFontsProviders = "google" | "bunny" | "fontshare";
6
- export type Shortcuts = UserShortcuts;
7
- export interface FontInfo {
8
- title: string;
9
- text: string;
1
+ import type { UserConfig } from '@unocss/core';
2
+ import type { UserShortcuts } from 'unocss';
3
+
4
+ export declare type Font = 'inter' | 'mona' | 'hubot'
5
+ export type Icon = 'heroicons'
6
+ export declare type WebFontsProviders = 'google' | 'bunny' | 'fontshare'
7
+ export type Shortcuts = UserShortcuts
8
+ export declare interface FontInfo {
9
+ title: string
10
+ text: string
10
11
  }
11
- export interface WebFontMeta {
12
- name: string;
13
- weights?: (string | number)[];
14
- italic?: boolean;
15
- provider?: WebFontsProviders;
12
+ export declare interface WebFontMeta {
13
+ name: string
14
+ weights?: (string | number)[]
15
+ italic?: boolean
16
+ provider?: WebFontsProviders
16
17
  }
17
- /**
18
- * **UI Engine Options**
19
- *
20
- * This type defines all of your UI Engine options. Because Stacks is fully-typed, you may
21
- * hover any of the options below and the definitions will be provided. In case you
22
- * have any questions, feel free to reach out via Discord or GitHub Discussions.
23
- */
24
- export interface UiOptions {
25
- /**
26
- * **Shortcuts**
27
- *
28
- * Shortcuts provide you with the ability to combine
29
- * utility names for reusability purposes.
30
- *
31
- * @example
32
- * ```
33
- * config: {
34
- * shortcuts: {
35
- * 'btn': 'px-4 py-2 rounded text-white bg-blue-500',
36
- * 'btn-lg': 'btn px-6 py-3',
37
- * }
38
- * }
39
- * ```
40
- */
41
- shortcuts: Shortcuts;
42
- /**
43
- * **Safelist**
44
- *
45
- * Use the `safelist` option to ensure the generation of
46
- * those utility classes. This is useful when certain
47
- * class names don’t exist in your content files.
48
- *
49
- * @example
50
- * ```ts
51
- * safelist: [
52
- * 'btn',
53
- * 'btn-lg',
54
- * 'btn-blue',
55
- * 'btn-blue-500',
56
- * ]
57
- */
58
- safelist: string;
59
- /**
60
- * **Trigger String**
61
- *
62
- * The "trigger string" defines the class name markup
63
- * you want to add into your components.
64
- *
65
- * @default ':stx:'
66
- *
67
- * @example
68
- * ```ts
69
- * trigger: ':stx:'
70
- * ```
71
- */
72
- trigger?: string;
73
- /**
74
- * **Class Prefix**
75
- *
76
- * The prefix for the compiled class name. When transforming
77
- * all utility classes into a single class, this prefix
78
- * will be added to the generated CSS class name.
79
- *
80
- * @default 'stx-'
81
- *
82
- * @example
83
- * ```ts
84
- * prefix: 'stx-'
85
- * ```
86
- */
87
- classPrefix?: string;
88
- /**
89
- * **Hash Function**
90
- *
91
- * The hash function used to generate the class name.
92
- *
93
- * @example
94
- * ```ts
95
- * hash: (str: string) => {
96
- * return str
97
- * .split('')
98
- * .reduce((a, b) => {
99
- * a = ((a << 5) - a) + b.charCodeAt(0)
100
- * return a & a
101
- * }, 0)
102
- * .toString(36)
103
- * }
104
- */
105
- hashFn?: (str: string) => string;
106
- /**
107
- * **CSS Resets—Preset**
108
- *
109
- * Define a standard of reset CSS stylesheets. By default, the Tailwind
110
- * reset styles are utilized. You may set this value to `null`
111
- * if you prefer not applying any default stylesheets.
112
- *
113
- * @url https://www.npmjs.com/package/@unocss/reset
114
- * @todo preset needs to be added via a Vite plugin on development & build
115
- * @example
116
- * ```ts
117
- * reset: 'tailwind'
118
- * ```
119
- */
120
- reset?: ResetPreset;
121
- /**
122
- * **Fonts**
123
- *
124
- * Define the fonts you want to use. By default, Stacks provides support
125
- * for several local font providers. You may set this value to
126
- * `null` if you prefer not utilize any local fonts.
127
- *
128
- * @see https://stacksjs.org/docs/fonts
129
- * ```
130
- */
131
- fonts?: any;
132
- useWebFonts?: boolean | WebFontsProviders;
133
- /**
134
- * **Icon Sets**
135
- *
136
- * This value defines the icon sets you want to use. When using icons, they
137
- * are displayed utilizing a technique called "icons in pure css."
138
- * Learn more here https://antfu.me/posts/icons-in-pure-css.
139
- *
140
- * @see https://stacks.ow3.org/config/icons — list of available icon sets
141
- * @todo implement this into Vite build flow
142
- * @example
143
- * ```ts
144
- * icons: ['heroicons']
145
- * ```
146
- * @example
147
- * ```html
148
- * <i class="i-heroicons-outline-book-open w-8 h-8 text-gray-500" aria-hidden="true" />
149
- * ```
150
- */
151
- icons: Icon | Icon[];
152
- theme: UserConfig["theme"];
153
- variants: UserConfig["variants"];
154
- layers: UserConfig["layers"];
18
+ export declare interface UiOptions {
19
+ shortcuts: Shortcuts
20
+
21
+ safelist: string
22
+
23
+ trigger?: string
24
+
25
+ classPrefix?: string
26
+
27
+ hashFn?: (str: string) => string
28
+
29
+ reset?: ResetPreset
30
+
31
+ fonts?: any
32
+
33
+ useWebFonts?: boolean | WebFontsProviders
34
+
35
+ icons: Icon | Icon[]
36
+
37
+ theme: UserConfig['theme']
38
+ variants: UserConfig['variants']
39
+ layers: UserConfig['layers']
155
40
  }
156
- export type UiConfig = Partial<UiOptions>;
157
- /**
158
- * **Style Reset — Preset**
159
- *
160
- * This value sets the "reset preset." A preset defines certain
161
- * CSS defaults to be applied.
162
- *
163
- * @default "tailwind"
164
- */
165
- export type ResetPreset = "tailwind" | "normalize" | "sanitize" | "eric-meyer" | "antfu" | null;
41
+ export declare type UiConfig = Partial<UiOptions>
42
+ export declare type ResetPreset = 'tailwind' | 'normalize' | 'sanitize' | 'eric-meyer' | 'antfu' | null
package/dist/utils.d.ts CHANGED
@@ -1,30 +1,20 @@
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 ? { [K in keyof T] : MergeInsertions<T[K]> } : T;
26
- export type DeepMerge<
27
- F,
28
- S
29
- > = MergeInsertions<{ [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
- export type DeepPartial<T> = { [P in keyof T]? : DeepPartial<T[P]> };
1
+ export declare type Nullable<T> = T | null | undefined
2
+ export declare type Fn<T = void> = () => T
3
+ export declare type Arrayable<T> = T | Array<T>
4
+ export declare type Constructor<T = void> = new (...args: any[]) => T
5
+ export declare type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void
6
+ ? I
7
+ : never
8
+ export declare type MergeInsertions<T> = T extends object ? { [K in keyof T]: MergeInsertions<T[K]> } : T
9
+ export declare type DeepMerge<F, S> = MergeInsertions<{
10
+ [K in keyof F | keyof S]: K extends keyof S & keyof F
11
+ ? DeepMerge<F[K], S[K]>
12
+ : K extends keyof S
13
+ ? S[K]
14
+ : K extends keyof F
15
+ ? F[K]
16
+ : never
17
+ }>
18
+ export declare type DeepPartial<T> = {
19
+ [P in keyof T]?: DeepPartial<T[P]>
20
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.66.0",
4
+ "version": "0.68.0",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -26,7 +26,6 @@
26
26
  ],
27
27
  "exports": {
28
28
  ".": {
29
- "bun": "./src/index.ts",
30
29
  "types": "./dist/index.d.ts",
31
30
  "import": "./dist/index.js"
32
31
  },
@@ -48,10 +47,10 @@
48
47
  "@mdit-vue/plugin-component": "^2.1.3",
49
48
  "@mdit-vue/plugin-frontmatter": "^2.1.3",
50
49
  "@mdit-vue/types": "^2.1.0",
51
- "@rollup/pluginutils": "^5.1.2",
52
- "@stacksjs/validation": "0.65.1",
50
+ "@rollup/pluginutils": "^5.1.3",
51
+ "@stacksjs/validation": "0.67.0",
53
52
  "@types/aws4": "^1.11.6",
54
- "@types/bun": "^1.1.11",
53
+ "@types/bun": "^1.1.12",
55
54
  "@types/crypto-js": "^4.2.2",
56
55
  "@types/fs-extra": "^11.0.4",
57
56
  "@types/markdown-it-link-attributes": "^3.0.5",
@@ -61,20 +60,20 @@
61
60
  "cac": "^6.7.14",
62
61
  "markdown-it": "^14.1.0",
63
62
  "meilisearch": "^0.44.1",
64
- "neverthrow": "^8.0.0",
63
+ "neverthrow": "^8.1.1",
65
64
  "ora": "^8.1.0",
66
65
  "unocss": "0.61.0",
67
66
  "unplugin-auto-import": "^0.18.3",
68
67
  "unplugin-vue-components": "^0.27.4",
69
- "vite": "^5.4.8",
68
+ "vite": "^5.4.10",
70
69
  "vite-plugin-inspect": "^0.8.7",
71
70
  "vite-plugin-pwa": "^0.20.5",
72
71
  "vite-ssg": "^0.23.8",
73
- "vitepress": "1.4.0",
74
- "vue": "^3.5.11"
72
+ "vitepress": "1.4.1",
73
+ "vue": "^3.5.12"
75
74
  },
76
75
  "devDependencies": {
77
- "aws-cdk-lib": "^2.161.1",
76
+ "aws-cdk-lib": "^2.164.1",
78
77
  "typescript": "^5.6.3"
79
78
  }
80
79
  }
package/src/cache.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { BentoCache } from 'bentocache'
2
+
1
3
  export interface CacheOptions {
2
4
  /**
3
5
  * **Cache Driver**
@@ -102,3 +104,19 @@ export interface CacheOptions {
102
104
  }
103
105
 
104
106
  export type CacheConfig = Partial<CacheOptions>
107
+
108
+ export interface CacheDriver {
109
+ set: (key: string, value: string, ttl?: number) => Promise<void>
110
+ setForever: (key: string, value: string, ttl?: number) => Promise<void>
111
+ get: (key: string) => Promise<string | undefined | null>
112
+ getOrSet: (key: string, value: string) => Promise<string | undefined | null>
113
+ remove: (key: string) => Promise<void>
114
+ has: (key: string) => Promise<boolean>
115
+ missing: (key: string) => Promise<boolean>
116
+ del: (key: string) => Promise<void>
117
+ deleteMany: (keys: string[]) => Promise<void>
118
+ clear: () => Promise<void>
119
+ deleteAll: () => Promise<void>
120
+ disconnect: () => Promise<void>
121
+ client: BentoCache<Record<string, any>>
122
+ }
package/src/cli.ts CHANGED
@@ -141,6 +141,8 @@ export interface CliOptions {
141
141
  */
142
142
  cwd?: string
143
143
 
144
+ stdio?: [In, Out, Out]
145
+
144
146
  /**
145
147
  * **stdio**
146
148
  *
@@ -360,6 +362,8 @@ export type DomainsOptions = CliOptions & {
360
362
  }
361
363
 
362
364
  export interface CleanOptions extends CliOptions {}
365
+
366
+ export interface SaasOptions extends CliOptions {}
363
367
  export interface CloudCliOptions extends CliOptions {
364
368
  ssh?: boolean
365
369
  connect?: boolean
package/src/cloud.ts CHANGED
@@ -254,13 +254,15 @@ export type CountryCode =
254
254
 
255
255
  type Environment = 'development' | 'staging' | 'production'
256
256
 
257
- export interface CloudOptions {
258
- type: 'serverless' // | 'server' coming soon
257
+ interface SiteConfig {
258
+ domain: string
259
+ path: string
260
+ }
259
261
 
262
+ type InfrastuctureOptions = Partial<{
263
+ type: 'serverless' // | 'server' coming soon
260
264
  driver: 'aws'
261
-
262
265
  api: ApiConfig
263
-
264
266
  storage: object
265
267
 
266
268
  /**
@@ -325,6 +327,16 @@ export interface CloudOptions {
325
327
  cli: boolean
326
328
  docs: boolean
327
329
  fileSystem: boolean
330
+ }>
331
+
332
+ export interface CloudOptions {
333
+ sites: {
334
+ root: string
335
+ path: string
336
+ [site: string]: string | SiteConfig
337
+ }
338
+
339
+ infrastructure: InfrastuctureOptions
328
340
  }
329
341
 
330
342
  export type CloudConfig = Partial<CloudOptions>
package/src/errors.ts CHANGED
@@ -9,6 +9,14 @@
9
9
 
10
10
  export type CommandError = Error
11
11
 
12
+ export interface ErrorResponse {
13
+ status: number // HTTP status code
14
+ errors: string | object // Error message(s), which can be a string or an object
15
+ stack?: string // Optional stack trace
16
+ name: string
17
+ message: string
18
+ }
19
+
12
20
  export interface ErrorOptions {
13
21
  messages: {
14
22
  'string': string
package/src/index.ts CHANGED
@@ -46,6 +46,7 @@ export * from './queue'
46
46
  export * from './reactivity'
47
47
  export * from './request'
48
48
  export * from './router'
49
+ export * from './saas'
49
50
  export * from './scheduler'
50
51
  export * from './search-engine'
51
52
  export * from './security'
@@ -1 +1 @@
1
- export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post'
1
+ export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'Subscription' | 'Error'
package/src/model.ts CHANGED
@@ -110,6 +110,7 @@ export interface ModelOptions extends Base {
110
110
  searchable?: boolean | SearchOptions // useSearch alias
111
111
  useApi?: ApiOptions | boolean
112
112
  observe?: string[] | boolean
113
+ billable?: boolean
113
114
  useActivityLog?: boolean | ActivityLogOption
114
115
  }
115
116
 
@@ -146,6 +147,10 @@ export interface ModelOptions extends Base {
146
147
  relationName?: string
147
148
  }[]
148
149
 
150
+ scopes?: {
151
+ [key: string]: (value: any) => any
152
+ }
153
+
149
154
  get?: {
150
155
  [key: string]: (value: any) => any
151
156
  }
@@ -181,6 +186,7 @@ export interface RelationConfig {
181
186
  relationModel?: string
182
187
  relationTable?: string
183
188
  foreignKey: string
189
+ modelKey: string
184
190
  relationName?: string
185
191
  throughModel?: string
186
192
  throughForeignKey?: string
package/src/payments.ts CHANGED
@@ -1,5 +1,12 @@
1
+ import type Stripe from 'stripe'
2
+
1
3
  export interface PaymentOptions {
2
4
  driver: 'stripe'
5
+
6
+ stripe: {
7
+ publishableKey: string
8
+ secretKey: string
9
+ }
3
10
  }
4
11
 
5
12
  export type PaymentConfig = Partial<PaymentOptions>
@@ -17,6 +24,21 @@ export interface ChargeOptions {
17
24
  }
18
25
  }
19
26
 
27
+ export interface StripeCustomerOptions {
28
+ address?: {
29
+ line1?: string
30
+ city?: string
31
+ state?: string
32
+ postal_code?: string
33
+ country?: string
34
+ }
35
+ name?: string
36
+ phone?: string
37
+ metadata?: Stripe.Emptyable<Stripe.MetadataParam>
38
+ email?: string
39
+ preferred_locales?: string[]
40
+ }
41
+
20
42
  export interface CustomerOptions {
21
43
  description?: string
22
44
  address?: string
@@ -63,3 +85,13 @@ export interface EventOptions {
63
85
  type?: string
64
86
  }
65
87
  }
88
+
89
+ export interface CheckoutLineItem {
90
+ priceId: string
91
+ quantity: number
92
+ }
93
+
94
+ export interface CheckoutOptions extends Partial<Stripe.Checkout.SessionCreateParams> {
95
+ enableTax?: boolean
96
+ allowPromotions?: boolean
97
+ }
package/src/router.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { Action } from '@stacksjs/actions'
2
2
 
3
- type ActionPath = string // TODO: narrow this by automating its generation
4
-
3
+ type ActionPath = string
5
4
  // need to refactor before, after, view to be a part of some other type
6
5
  export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'before' | 'after' | 'view'
7
6
 
package/src/saas.ts ADDED
@@ -0,0 +1,33 @@
1
+ export interface SaasOption {
2
+ plans: {
3
+ productName: string
4
+ description: string
5
+ pricing: {
6
+ key: string
7
+ price: number
8
+ interval: 'day' | 'month' | 'week' | 'year'
9
+ currency: string
10
+ }[]
11
+ metadata: {
12
+ createdBy: string
13
+ version: string
14
+ }
15
+ }[]
16
+ webhook: {
17
+ endpoint: string
18
+ secret: string
19
+ }
20
+ currencies: string[]
21
+ coupons: {
22
+ code: string
23
+ amountOff: number
24
+ duration: 'once' | 'repeating' | 'forever'
25
+ }[]
26
+ products: {
27
+ name: string
28
+ description: string
29
+ images: string[]
30
+ }[]
31
+ }
32
+
33
+ export type SaasConfig = Partial<SaasOption>
package/src/stacks.ts CHANGED
@@ -18,6 +18,7 @@ import type {
18
18
  PaymentConfig,
19
19
  Ports,
20
20
  QueueConfig,
21
+ SaasConfig,
21
22
  SearchEngineConfig,
22
23
  SecurityConfig,
23
24
  ServicesConfig,
@@ -198,6 +199,15 @@ export interface StacksOptions {
198
199
  */
199
200
  queue: QueueConfig
200
201
 
202
+ /**
203
+ * **SaaS Options**
204
+ *
205
+ * This configuration defines all of your SaaS options. Because Stacks is fully-typed,
206
+ * you may hover any of the options below and the definitions will be provided. In case
207
+ * you have any questions, feel free to reach out via Discord or GitHub Discussions.
208
+ */
209
+ saas: SaasConfig
210
+
201
211
  /**
202
212
  * **Search Engine Options**
203
213
  *